22 lines
No EOL
323 KiB
JavaScript
22 lines
No EOL
323 KiB
JavaScript
/**
|
||
* @licstart The following is the entire license notice for the
|
||
* JavaScript code in this page
|
||
*
|
||
* Copyright 2023 Mozilla Foundation
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*
|
||
* @licend The above is the entire license notice for the
|
||
* JavaScript code in this page
|
||
*/
|
||
!function webpackUniversalModuleDefinition(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("pdfjs-dist/build/pdf",[],e):"object"==typeof exports?exports["pdfjs-dist/build/pdf"]=e():t["pdfjs-dist/build/pdf"]=t.pdfjsLib=e()}(globalThis,(()=>(()=>{var __webpack_modules__=[,(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.VerbosityLevel=e.Util=e.UnknownErrorException=e.UnexpectedResponseException=e.TextRenderingMode=e.RenderingIntentFlag=e.PromiseCapability=e.PermissionFlag=e.PasswordResponses=e.PasswordException=e.PageActionEventType=e.OPS=e.MissingPDFException=e.MAX_IMAGE_SIZE_TO_CACHE=e.LINE_FACTOR=e.LINE_DESCENT_FACTOR=e.InvalidPDFException=e.ImageKind=e.IDENTITY_MATRIX=e.FormatError=e.FeatureTest=e.FONT_IDENTITY_MATRIX=e.DocumentActionEventType=e.CMapCompressionType=e.BaseException=e.BASELINE_FACTOR=e.AnnotationType=e.AnnotationStateModelType=e.AnnotationReviewState=e.AnnotationReplyType=e.AnnotationMode=e.AnnotationMarkedState=e.AnnotationFlag=e.AnnotationFieldFlag=e.AnnotationEditorType=e.AnnotationEditorPrefix=e.AnnotationEditorParamsType=e.AnnotationBorderStyleType=e.AnnotationActionEventType=e.AbortException=void 0;e.assert=function assert(t,e){t||unreachable(e)};e.bytesToString=function bytesToString(t){"object"==typeof t&&void 0!==(null==t?void 0:t.length)||unreachable("Invalid argument for bytesToString");const e=t.length,n=8192;if(e<n)return String.fromCharCode.apply(null,t);const r=[];for(let i=0;i<e;i+=n){const s=Math.min(i+n,e),a=t.subarray(i,s);r.push(String.fromCharCode.apply(null,a))}return r.join("")};e.createValidAbsoluteUrl=function createValidAbsoluteUrl(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if(!t)return null;try{if(n&&"string"==typeof t){if(n.addDefaultProtocol&&t.startsWith("www.")){const e=t.match(/\./g);(null==e?void 0:e.length)>=2&&(t=`http://${t}`)}if(n.tryConvertEncoding)try{t=stringToUTF8String(t)}catch(t){}}const r=e?new URL(t,e):new URL(t);if(function _isValidProtocol(t){switch(null==t?void 0:t.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":return!0;default:return!1}}(r))return r}catch(t){}return null};e.getModificationDate=function getModificationDate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Date;return[t.getUTCFullYear().toString(),(t.getUTCMonth()+1).toString().padStart(2,"0"),t.getUTCDate().toString().padStart(2,"0"),t.getUTCHours().toString().padStart(2,"0"),t.getUTCMinutes().toString().padStart(2,"0"),t.getUTCSeconds().toString().padStart(2,"0")].join("")};e.getVerbosityLevel=function getVerbosityLevel(){return i};e.info=function info(t){i>=r.INFOS&&console.log(`Info: ${t}`)};e.isArrayBuffer=function isArrayBuffer(t){return"object"==typeof t&&void 0!==(null==t?void 0:t.byteLength)};e.isArrayEqual=function isArrayEqual(t,e){if(t.length!==e.length)return!1;for(let n=0,r=t.length;n<r;n++)if(t[n]!==e[n])return!1;return!0};e.normalizeUnicode=function normalizeUnicode(t){if(!l){l=/([\u00a0\u00b5\u037e\u0eb3\u2000-\u200a\u202f\u2126\ufb00-\ufb04\ufb06\ufb20-\ufb36\ufb38-\ufb3c\ufb3e\ufb40-\ufb41\ufb43-\ufb44\ufb46-\ufba1\ufba4-\ufba9\ufbae-\ufbb1\ufbd3-\ufbdc\ufbde-\ufbe7\ufbea-\ufbf8\ufbfc-\ufbfd\ufc00-\ufc5d\ufc64-\ufcf1\ufcf5-\ufd3d\ufd88\ufdf4\ufdfa-\ufdfb\ufe71\ufe77\ufe79\ufe7b\ufe7d]+)|(\ufb05+)/gu;c=new Map([["ſt","ſt"]])}return t.replaceAll(l,((t,e,n)=>e?e.normalize("NFKC"):c.get(n)))};e.objectFromMap=function objectFromMap(t){const e=Object.create(null);for(const[n,r]of t)e[n]=r;return e};e.objectSize=function objectSize(t){return Object.keys(t).length};e.setVerbosityLevel=function setVerbosityLevel(t){Number.isInteger(t)&&(i=t)};e.shadow=shadow;e.string32=function string32(t){return String.fromCharCode(t>>24&255,t>>16&255,t>>8&255,255&t)};e.stringToBytes=stringToBytes;e.stringToPDFString=function stringToPDFString(t){if(t[0]>="ï"){let e;"þ"===t[0]&&"ÿ"===t[1]?e="utf-16be":"ÿ"===t[0]&&"þ"===t[1]?e="utf-16le":"ï"===t[0]&&"»"===t[1]&&"¿"===t[2]&&(e="utf-8");if(e)try{const n=new TextDecoder(e,{fatal:!0}),r=stringToBytes(t);return n.decode(r)}catch(t){warn(`stringToPDFString: "${t}".`)}}const e=[];for(let n=0,r=t.length;n<r;n++){const r=o[t.charCodeAt(n)];e.push(r?String.fromCharCode(r):t.charAt(n))}return e.join("")};e.stringToUTF8String=stringToUTF8String;e.unreachable=unreachable;e.utf8StringToString=function utf8StringToString(t){return unescape(encodeURIComponent(t))};e.warn=warn;if(!globalThis._pdfjsCompatibilityChecked){globalThis._pdfjsCompatibilityChecked=!0;n(2)}e.IDENTITY_MATRIX=[1,0,0,1,0,0];e.FONT_IDENTITY_MATRIX=[.001,0,0,.001,0,0];e.MAX_IMAGE_SIZE_TO_CACHE=1e7;e.LINE_FACTOR=1.35;e.LINE_DESCENT_FACTOR=.35;e.BASELINE_FACTOR=.25925925925925924;e.RenderingIntentFlag={ANY:1,DISPLAY:2,PRINT:4,SAVE:8,ANNOTATIONS_FORMS:16,ANNOTATIONS_STORAGE:32,ANNOTATIONS_DISABLE:64,OPLIST:256};e.AnnotationMode={DISABLE:0,ENABLE:1,ENABLE_FORMS:2,ENABLE_STORAGE:3};e.AnnotationEditorPrefix="pdfjs_internal_editor_";e.AnnotationEditorType={DISABLE:-1,NONE:0,FREETEXT:3,INK:15};e.AnnotationEditorParamsType={FREETEXT_SIZE:1,FREETEXT_COLOR:2,FREETEXT_OPACITY:3,INK_COLOR:11,INK_THICKNESS:12,INK_OPACITY:13};e.PermissionFlag={PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048};e.TextRenderingMode={FILL:0,STROKE:1,FILL_STROKE:2,INVISIBLE:3,FILL_ADD_TO_PATH:4,STROKE_ADD_TO_PATH:5,FILL_STROKE_ADD_TO_PATH:6,ADD_TO_PATH:7,FILL_STROKE_MASK:3,ADD_TO_PATH_FLAG:4};e.ImageKind={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3};e.AnnotationType={TEXT:1,LINK:2,FREETEXT:3,LINE:4,SQUARE:5,CIRCLE:6,POLYGON:7,POLYLINE:8,HIGHLIGHT:9,UNDERLINE:10,SQUIGGLY:11,STRIKEOUT:12,STAMP:13,CARET:14,INK:15,POPUP:16,FILEATTACHMENT:17,SOUND:18,MOVIE:19,WIDGET:20,SCREEN:21,PRINTERMARK:22,TRAPNET:23,WATERMARK:24,THREED:25,REDACT:26};e.AnnotationStateModelType={MARKED:"Marked",REVIEW:"Review"};e.AnnotationMarkedState={MARKED:"Marked",UNMARKED:"Unmarked"};e.AnnotationReviewState={ACCEPTED:"Accepted",REJECTED:"Rejected",CANCELLED:"Cancelled",COMPLETED:"Completed",NONE:"None"};e.AnnotationReplyType={GROUP:"Group",REPLY:"R"};e.AnnotationFlag={INVISIBLE:1,HIDDEN:2,PRINT:4,NOZOOM:8,NOROTATE:16,NOVIEW:32,READONLY:64,LOCKED:128,TOGGLENOVIEW:256,LOCKEDCONTENTS:512};e.AnnotationFieldFlag={READONLY:1,REQUIRED:2,NOEXPORT:4,MULTILINE:4096,PASSWORD:8192,NOTOGGLETOOFF:16384,RADIO:32768,PUSHBUTTON:65536,COMBO:131072,EDIT:262144,SORT:524288,FILESELECT:1048576,MULTISELECT:2097152,DONOTSPELLCHECK:4194304,DONOTSCROLL:8388608,COMB:16777216,RICHTEXT:33554432,RADIOSINUNISON:33554432,COMMITONSELCHANGE:67108864};e.AnnotationBorderStyleType={SOLID:1,DASHED:2,BEVELED:3,INSET:4,UNDERLINE:5};e.AnnotationActionEventType={E:"Mouse Enter",X:"Mouse Exit",D:"Mouse Down",U:"Mouse Up",Fo:"Focus",Bl:"Blur",PO:"PageOpen",PC:"PageClose",PV:"PageVisible",PI:"PageInvisible",K:"Keystroke",F:"Format",V:"Validate",C:"Calculate"};e.DocumentActionEventType={WC:"WillClose",WS:"WillSave",DS:"DidSave",WP:"WillPrint",DP:"DidPrint"};e.PageActionEventType={O:"PageOpen",C:"PageClose"};const r={ERRORS:0,WARNINGS:1,INFOS:5};e.VerbosityLevel=r;e.CMapCompressionType={NONE:0,BINARY:1};e.OPS={dependency:1,setLineWidth:2,setLineCap:3,setLineJoin:4,setMiterLimit:5,setDash:6,setRenderingIntent:7,setFlatness:8,setGState:9,save:10,restore:11,transform:12,moveTo:13,lineTo:14,curveTo:15,curveTo2:16,curveTo3:17,closePath:18,rectangle:19,stroke:20,closeStroke:21,fill:22,eoFill:23,fillStroke:24,eoFillStroke:25,closeFillStroke:26,closeEOFillStroke:27,endPath:28,clip:29,eoClip:30,beginText:31,endText:32,setCharSpacing:33,setWordSpacing:34,setHScale:35,setLeading:36,setFont:37,setTextRenderingMode:38,setTextRise:39,moveText:40,setLeadingMoveText:41,setTextMatrix:42,nextLine:43,showText:44,showSpacedText:45,nextLineShowText:46,nextLineSetSpacingShowText:47,setCharWidth:48,setCharWidthAndBounds:49,setStrokeColorSpace:50,setFillColorSpace:51,setStrokeColor:52,setStrokeColorN:53,setFillColor:54,setFillColorN:55,setStrokeGray:56,setFillGray:57,setStrokeRGBColor:58,setFillRGBColor:59,setStrokeCMYKColor:60,setFillCMYKColor:61,shadingFill:62,beginInlineImage:63,beginImageData:64,endInlineImage:65,paintXObject:66,markPoint:67,markPointProps:68,beginMarkedContent:69,beginMarkedContentProps:70,endMarkedContent:71,beginCompat:72,endCompat:73,paintFormXObjectBegin:74,paintFormXObjectEnd:75,beginGroup:76,endGroup:77,beginAnnotation:80,endAnnotation:81,paintImageMaskXObject:83,paintImageMaskXObjectGroup:84,paintImageXObject:85,paintInlineImageXObject:86,paintInlineImageXObjectGroup:87,paintImageXObjectRepeat:88,paintImageMaskXObjectRepeat:89,paintSolidColorImageMask:90,constructPath:91};e.PasswordResponses={NEED_PASSWORD:1,INCORRECT_PASSWORD:2};let i=r.WARNINGS;function warn(t){i>=r.WARNINGS&&console.log(`Warning: ${t}`)}function unreachable(t){throw new Error(t)}function shadow(t,e,n){let r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];Object.defineProperty(t,e,{value:n,enumerable:!r,configurable:!0,writable:!1});return n}const s=function BaseExceptionClosure(){function BaseException(t,e){this.constructor===BaseException&&unreachable("Cannot initialize BaseException.");this.message=t;this.name=e}BaseException.prototype=new Error;BaseException.constructor=BaseException;return BaseException}();e.BaseException=s;e.PasswordException=class PasswordException extends s{constructor(t,e){super(t,"PasswordException");this.code=e}};e.UnknownErrorException=class UnknownErrorException extends s{constructor(t,e){super(t,"UnknownErrorException");this.details=e}};e.InvalidPDFException=class InvalidPDFException extends s{constructor(t){super(t,"InvalidPDFException")}};e.MissingPDFException=class MissingPDFException extends s{constructor(t){super(t,"MissingPDFException")}};e.UnexpectedResponseException=class UnexpectedResponseException extends s{constructor(t,e){super(t,"UnexpectedResponseException");this.status=e}};e.FormatError=class FormatError extends s{constructor(t){super(t,"FormatError")}};e.AbortException=class AbortException extends s{constructor(t){super(t,"AbortException")}};function stringToBytes(t){"string"!=typeof t&&unreachable("Invalid argument for stringToBytes");const e=t.length,n=new Uint8Array(e);for(let r=0;r<e;++r)n[r]=255&t.charCodeAt(r);return n}e.FeatureTest=class FeatureTest{static get isLittleEndian(){return shadow(this,"isLittleEndian",function isLittleEndian(){const t=new Uint8Array(4);t[0]=1;return 1===new Uint32Array(t.buffer,0,1)[0]}())}static get isEvalSupported(){return shadow(this,"isEvalSupported",function isEvalSupported(){try{new Function("");return!0}catch(t){return!1}}())}static get isOffscreenCanvasSupported(){return shadow(this,"isOffscreenCanvasSupported","undefined"!=typeof OffscreenCanvas)}static get platform(){return"undefined"==typeof navigator?shadow(this,"platform",{isWin:!1,isMac:!1}):shadow(this,"platform",{isWin:navigator.platform.includes("Win"),isMac:navigator.platform.includes("Mac")})}};const a=[...Array(256).keys()].map((t=>t.toString(16).padStart(2,"0")));class Util{static makeHexColor(t,e,n){return`#${a[t]}${a[e]}${a[n]}`}static scaleMinMax(t,e){let n;if(t[0]){if(t[0]<0){n=e[0];e[0]=e[1];e[1]=n}e[0]*=t[0];e[1]*=t[0];if(t[3]<0){n=e[2];e[2]=e[3];e[3]=n}e[2]*=t[3];e[3]*=t[3]}else{n=e[0];e[0]=e[2];e[2]=n;n=e[1];e[1]=e[3];e[3]=n;if(t[1]<0){n=e[2];e[2]=e[3];e[3]=n}e[2]*=t[1];e[3]*=t[1];if(t[2]<0){n=e[0];e[0]=e[1];e[1]=n}e[0]*=t[2];e[1]*=t[2]}e[0]+=t[4];e[1]+=t[4];e[2]+=t[5];e[3]+=t[5]}static transform(t,e){return[t[0]*e[0]+t[2]*e[1],t[1]*e[0]+t[3]*e[1],t[0]*e[2]+t[2]*e[3],t[1]*e[2]+t[3]*e[3],t[0]*e[4]+t[2]*e[5]+t[4],t[1]*e[4]+t[3]*e[5]+t[5]]}static applyTransform(t,e){return[t[0]*e[0]+t[1]*e[2]+e[4],t[0]*e[1]+t[1]*e[3]+e[5]]}static applyInverseTransform(t,e){const n=e[0]*e[3]-e[1]*e[2];return[(t[0]*e[3]-t[1]*e[2]+e[2]*e[5]-e[4]*e[3])/n,(-t[0]*e[1]+t[1]*e[0]+e[4]*e[1]-e[5]*e[0])/n]}static getAxialAlignedBoundingBox(t,e){const n=Util.applyTransform(t,e),r=Util.applyTransform(t.slice(2,4),e),i=Util.applyTransform([t[0],t[3]],e),s=Util.applyTransform([t[2],t[1]],e);return[Math.min(n[0],r[0],i[0],s[0]),Math.min(n[1],r[1],i[1],s[1]),Math.max(n[0],r[0],i[0],s[0]),Math.max(n[1],r[1],i[1],s[1])]}static inverseTransform(t){const e=t[0]*t[3]-t[1]*t[2];return[t[3]/e,-t[1]/e,-t[2]/e,t[0]/e,(t[2]*t[5]-t[4]*t[3])/e,(t[4]*t[1]-t[5]*t[0])/e]}static singularValueDecompose2dScale(t){const e=[t[0],t[2],t[1],t[3]],n=t[0]*e[0]+t[1]*e[2],r=t[0]*e[1]+t[1]*e[3],i=t[2]*e[0]+t[3]*e[2],s=t[2]*e[1]+t[3]*e[3],a=(n+s)/2,o=Math.sqrt((n+s)**2-4*(n*s-i*r))/2,l=a+o||1,c=a-o||1;return[Math.sqrt(l),Math.sqrt(c)]}static normalizeRect(t){const e=t.slice(0);if(t[0]>t[2]){e[0]=t[2];e[2]=t[0]}if(t[1]>t[3]){e[1]=t[3];e[3]=t[1]}return e}static intersect(t,e){const n=Math.max(Math.min(t[0],t[2]),Math.min(e[0],e[2])),r=Math.min(Math.max(t[0],t[2]),Math.max(e[0],e[2]));if(n>r)return null;const i=Math.max(Math.min(t[1],t[3]),Math.min(e[1],e[3])),s=Math.min(Math.max(t[1],t[3]),Math.max(e[1],e[3]));return i>s?null:[n,i,r,s]}static bezierBoundingBox(t,e,n,r,i,s,a,o){const l=[],c=[[],[]];let d,h,u,p,f,g,m,v;for(let c=0;c<2;++c){if(0===c){h=6*t-12*n+6*i;d=-3*t+9*n-9*i+3*a;u=3*n-3*t}else{h=6*e-12*r+6*s;d=-3*e+9*r-9*s+3*o;u=3*r-3*e}if(Math.abs(d)<1e-12){if(Math.abs(h)<1e-12)continue;p=-u/h;0<p&&p<1&&l.push(p)}else{m=h*h-4*u*d;v=Math.sqrt(m);if(!(m<0)){f=(-h+v)/(2*d);0<f&&f<1&&l.push(f);g=(-h-v)/(2*d);0<g&&g<1&&l.push(g)}}}let b,y=l.length;const A=y;for(;y--;){p=l[y];b=1-p;c[0][y]=b*b*b*t+3*b*b*p*n+3*b*p*p*i+p*p*p*a;c[1][y]=b*b*b*e+3*b*b*p*r+3*b*p*p*s+p*p*p*o}c[0][A]=t;c[1][A]=e;c[0][A+1]=a;c[1][A+1]=o;c[0].length=c[1].length=A+2;return[Math.min(...c[0]),Math.min(...c[1]),Math.max(...c[0]),Math.max(...c[1])]}}e.Util=Util;const o=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,728,711,710,729,733,731,730,732,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8226,8224,8225,8230,8212,8211,402,8260,8249,8250,8722,8240,8222,8220,8221,8216,8217,8218,8482,64257,64258,321,338,352,376,381,305,322,339,353,382,0,8364];function stringToUTF8String(t){return decodeURIComponent(escape(t))}e.PromiseCapability=class PromiseCapability{#t=!1;constructor(){this.promise=new Promise(((t,e)=>{this.resolve=e=>{this.#t=!0;t(e)};this.reject=t=>{this.#t=!0;e(t)}}))}get settled(){return this.#t}};let l=null,c=null},(t,e,n)=>{"use strict";var r=n(3);!function checkDOMMatrix(){!globalThis.DOMMatrix&&r.isNodeJS&&(globalThis.DOMMatrix=require("canvas").DOMMatrix)}();!function checkPath2D(){if(globalThis.Path2D||!r.isNodeJS)return;const{CanvasRenderingContext2D:t}=require("canvas"),{polyfillPath2D:e}=require("path2d-polyfill");globalThis.CanvasRenderingContext2D=t;e(globalThis)}();!function checkArrayAt(){Array.prototype.at||n(4)}();!function checkTypedArrayAt(){Uint8Array.prototype.at||n(78)}();!function checkStructuredClone(){globalThis.structuredClone||n(90)}()},(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.isNodeJS=void 0;const n=!("object"!=typeof process||process+""!="[object process]"||process.versions.nw||process.versions.electron&&process.type&&"browser"!==process.type);e.isNodeJS=n},(t,e,n)=>{n(5);var r=n(77);t.exports=r("Array","at")},(t,e,n)=>{"use strict";var r=n(6),i=n(43),s=n(67),a=n(65),o=n(72);r({target:"Array",proto:!0},{at:function at(t){var e=i(this),n=s(e),r=a(t),o=r>=0?r:n+r;return o<0||o>=n?void 0:e[o]}});o("at")},(t,e,n)=>{var r=n(7),i=n(8).f,s=n(47),a=n(51),o=n(41),l=n(59),c=n(71);t.exports=function(t,e){var n,d,h,u,p,f=t.target,g=t.global,m=t.stat;if(n=g?r:m?r[f]||o(f,{}):(r[f]||{}).prototype)for(d in e){u=e[d];h=t.dontCallGetSet?(p=i(n,d))&&p.value:n[d];if(!c(g?d:f+(m?".":"#")+d,t.forced)&&void 0!==h){if(typeof u==typeof h)continue;l(u,h)}(t.sham||h&&h.sham)&&s(u,"sham",!0);a(n,d,u,t)}}},function(t){var check=function(t){return t&&t.Math==Math&&t};t.exports=check("object"==typeof globalThis&&globalThis)||check("object"==typeof window&&window)||check("object"==typeof self&&self)||check("object"==typeof global&&global)||function(){return this}()||this||Function("return this")()},(t,e,n)=>{var r=n(9),i=n(11),s=n(13),a=n(14),o=n(15),l=n(21),c=n(42),d=n(45),h=Object.getOwnPropertyDescriptor;e.f=r?h:function getOwnPropertyDescriptor(t,e){t=o(t);e=l(e);if(d)try{return h(t,e)}catch(t){}if(c(t,e))return a(!i(s.f,t,e),t[e])}},(t,e,n)=>{var r=n(10);t.exports=!r((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]}))},t=>{t.exports=function(t){try{return!!t()}catch(t){return!0}}},(t,e,n)=>{var r=n(12),i=Function.prototype.call;t.exports=r?i.bind(i):function(){return i.apply(i,arguments)}},(t,e,n)=>{var r=n(10);t.exports=!r((function(){var t=function(){}.bind();return"function"!=typeof t||t.hasOwnProperty("prototype")}))},(t,e)=>{"use strict";var n={}.propertyIsEnumerable,r=Object.getOwnPropertyDescriptor,i=r&&!n.call({1:2},1);e.f=i?function propertyIsEnumerable(t){var e=r(this,t);return!!e&&e.enumerable}:n},t=>{t.exports=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}}},(t,e,n)=>{var r=n(16),i=n(19);t.exports=function(t){return r(i(t))}},(t,e,n)=>{var r=n(17),i=n(10),s=n(18),a=Object,o=r("".split);t.exports=i((function(){return!a("z").propertyIsEnumerable(0)}))?function(t){return"String"==s(t)?o(t,""):a(t)}:a},(t,e,n)=>{var r=n(12),i=Function.prototype,s=i.call,a=r&&i.bind.bind(s,s);t.exports=r?a:function(t){return function(){return s.apply(t,arguments)}}},(t,e,n)=>{var r=n(17),i=r({}.toString),s=r("".slice);t.exports=function(t){return s(i(t),8,-1)}},(t,e,n)=>{var r=n(20),i=TypeError;t.exports=function(t){if(r(t))throw i("Can't call method on "+t);return t}},t=>{t.exports=function(t){return null==t}},(t,e,n)=>{var r=n(22),i=n(26);t.exports=function(t){var e=r(t,"string");return i(e)?e:e+""}},(t,e,n)=>{var r=n(11),i=n(23),s=n(26),a=n(33),o=n(36),l=n(37),c=TypeError,d=l("toPrimitive");t.exports=function(t,e){if(!i(t)||s(t))return t;var n,l=a(t,d);if(l){void 0===e&&(e="default");n=r(l,t,e);if(!i(n)||s(n))return n;throw c("Can't convert object to primitive value")}void 0===e&&(e="number");return o(t,e)}},(t,e,n)=>{var r=n(24),i=n(25),s=i.all;t.exports=i.IS_HTMLDDA?function(t){return"object"==typeof t?null!==t:r(t)||t===s}:function(t){return"object"==typeof t?null!==t:r(t)}},(t,e,n)=>{var r=n(25),i=r.all;t.exports=r.IS_HTMLDDA?function(t){return"function"==typeof t||t===i}:function(t){return"function"==typeof t}},t=>{var e="object"==typeof document&&document.all,n=void 0===e&&void 0!==e;t.exports={all:e,IS_HTMLDDA:n}},(t,e,n)=>{var r=n(27),i=n(24),s=n(28),a=n(29),o=Object;t.exports=a?function(t){return"symbol"==typeof t}:function(t){var e=r("Symbol");return i(e)&&s(e.prototype,o(t))}},(t,e,n)=>{var r=n(7),i=n(24);t.exports=function(t,e){return arguments.length<2?(n=r[t],i(n)?n:void 0):r[t]&&r[t][e];var n}},(t,e,n)=>{var r=n(17);t.exports=r({}.isPrototypeOf)},(t,e,n)=>{var r=n(30);t.exports=r&&!Symbol.sham&&"symbol"==typeof Symbol.iterator},(t,e,n)=>{var r=n(31),i=n(10),s=n(7).String;t.exports=!!Object.getOwnPropertySymbols&&!i((function(){var t=Symbol();return!s(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&r&&r<41}))},(t,e,n)=>{var r,i,s=n(7),a=n(32),o=s.process,l=s.Deno,c=o&&o.versions||l&&l.version,d=c&&c.v8;d&&(i=(r=d.split("."))[0]>0&&r[0]<4?1:+(r[0]+r[1]));!i&&a&&(!(r=a.match(/Edge\/(\d+)/))||r[1]>=74)&&(r=a.match(/Chrome\/(\d+)/))&&(i=+r[1]);t.exports=i},t=>{t.exports="undefined"!=typeof navigator&&String(navigator.userAgent)||""},(t,e,n)=>{var r=n(34),i=n(20);t.exports=function(t,e){var n=t[e];return i(n)?void 0:r(n)}},(t,e,n)=>{var r=n(24),i=n(35),s=TypeError;t.exports=function(t){if(r(t))return t;throw s(i(t)+" is not a function")}},t=>{var e=String;t.exports=function(t){try{return e(t)}catch(t){return"Object"}}},(t,e,n)=>{var r=n(11),i=n(24),s=n(23),a=TypeError;t.exports=function(t,e){var n,o;if("string"===e&&i(n=t.toString)&&!s(o=r(n,t)))return o;if(i(n=t.valueOf)&&!s(o=r(n,t)))return o;if("string"!==e&&i(n=t.toString)&&!s(o=r(n,t)))return o;throw a("Can't convert object to primitive value")}},(t,e,n)=>{var r=n(7),i=n(38),s=n(42),a=n(44),o=n(30),l=n(29),c=r.Symbol,d=i("wks"),h=l?c.for||c:c&&c.withoutSetter||a;t.exports=function(t){s(d,t)||(d[t]=o&&s(c,t)?c[t]:h("Symbol."+t));return d[t]}},(t,e,n)=>{var r=n(39),i=n(40);(t.exports=function(t,e){return i[t]||(i[t]=void 0!==e?e:{})})("versions",[]).push({version:"3.30.2",mode:r?"pure":"global",copyright:"© 2014-2023 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.30.2/LICENSE",source:"https://github.com/zloirock/core-js"})},t=>{t.exports=!1},(t,e,n)=>{var r=n(7),i=n(41),s="__core-js_shared__",a=r[s]||i(s,{});t.exports=a},(t,e,n)=>{var r=n(7),i=Object.defineProperty;t.exports=function(t,e){try{i(r,t,{value:e,configurable:!0,writable:!0})}catch(n){r[t]=e}return e}},(t,e,n)=>{var r=n(17),i=n(43),s=r({}.hasOwnProperty);t.exports=Object.hasOwn||function hasOwn(t,e){return s(i(t),e)}},(t,e,n)=>{var r=n(19),i=Object;t.exports=function(t){return i(r(t))}},(t,e,n)=>{var r=n(17),i=0,s=Math.random(),a=r(1..toString);t.exports=function(t){return"Symbol("+(void 0===t?"":t)+")_"+a(++i+s,36)}},(t,e,n)=>{var r=n(9),i=n(10),s=n(46);t.exports=!r&&!i((function(){return 7!=Object.defineProperty(s("div"),"a",{get:function(){return 7}}).a}))},(t,e,n)=>{var r=n(7),i=n(23),s=r.document,a=i(s)&&i(s.createElement);t.exports=function(t){return a?s.createElement(t):{}}},(t,e,n)=>{var r=n(9),i=n(48),s=n(14);t.exports=r?function(t,e,n){return i.f(t,e,s(1,n))}:function(t,e,n){t[e]=n;return t}},(t,e,n)=>{var r=n(9),i=n(45),s=n(49),a=n(50),o=n(21),l=TypeError,c=Object.defineProperty,d=Object.getOwnPropertyDescriptor,h="enumerable",u="configurable",p="writable";e.f=r?s?function defineProperty(t,e,n){a(t);e=o(e);a(n);if("function"==typeof t&&"prototype"===e&&"value"in n&&p in n&&!n[p]){var r=d(t,e);if(r&&r[p]){t[e]=n.value;n={configurable:u in n?n[u]:r[u],enumerable:h in n?n[h]:r[h],writable:!1}}}return c(t,e,n)}:c:function defineProperty(t,e,n){a(t);e=o(e);a(n);if(i)try{return c(t,e,n)}catch(t){}if("get"in n||"set"in n)throw l("Accessors not supported");"value"in n&&(t[e]=n.value);return t}},(t,e,n)=>{var r=n(9),i=n(10);t.exports=r&&i((function(){return 42!=Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype}))},(t,e,n)=>{var r=n(23),i=String,s=TypeError;t.exports=function(t){if(r(t))return t;throw s(i(t)+" is not an object")}},(t,e,n)=>{var r=n(24),i=n(48),s=n(52),a=n(41);t.exports=function(t,e,n,o){o||(o={});var l=o.enumerable,c=void 0!==o.name?o.name:e;r(n)&&s(n,c,o);if(o.global)l?t[e]=n:a(e,n);else{try{o.unsafe?t[e]&&(l=!0):delete t[e]}catch(t){}l?t[e]=n:i.f(t,e,{value:n,enumerable:!1,configurable:!o.nonConfigurable,writable:!o.nonWritable})}return t}},(t,e,n)=>{var r=n(17),i=n(10),s=n(24),a=n(42),o=n(9),l=n(53).CONFIGURABLE,c=n(54),d=n(55),h=d.enforce,u=d.get,p=String,f=Object.defineProperty,g=r("".slice),m=r("".replace),v=r([].join),b=o&&!i((function(){return 8!==f((function(){}),"length",{value:8}).length})),y=String(String).split("String"),A=t.exports=function(t,e,n){"Symbol("===g(p(e),0,7)&&(e="["+m(p(e),/^Symbol\(([^)]*)\)/,"$1")+"]");n&&n.getter&&(e="get "+e);n&&n.setter&&(e="set "+e);(!a(t,"name")||l&&t.name!==e)&&(o?f(t,"name",{value:e,configurable:!0}):t.name=e);b&&n&&a(n,"arity")&&t.length!==n.arity&&f(t,"length",{value:n.arity});try{n&&a(n,"constructor")&&n.constructor?o&&f(t,"prototype",{writable:!1}):t.prototype&&(t.prototype=void 0)}catch(t){}var r=h(t);a(r,"source")||(r.source=v(y,"string"==typeof e?e:""));return t};Function.prototype.toString=A((function toString(){return s(this)&&u(this).source||c(this)}),"toString")},(t,e,n)=>{var r=n(9),i=n(42),s=Function.prototype,a=r&&Object.getOwnPropertyDescriptor,o=i(s,"name"),l=o&&"something"===function something(){}.name,c=o&&(!r||r&&a(s,"name").configurable);t.exports={EXISTS:o,PROPER:l,CONFIGURABLE:c}},(t,e,n)=>{var r=n(17),i=n(24),s=n(40),a=r(Function.toString);i(s.inspectSource)||(s.inspectSource=function(t){return a(t)});t.exports=s.inspectSource},(t,e,n)=>{var r,i,s,a=n(56),o=n(7),l=n(23),c=n(47),d=n(42),h=n(40),u=n(57),p=n(58),f="Object already initialized",g=o.TypeError,m=o.WeakMap;if(a||h.state){var v=h.state||(h.state=new m);v.get=v.get;v.has=v.has;v.set=v.set;r=function(t,e){if(v.has(t))throw g(f);e.facade=t;v.set(t,e);return e};i=function(t){return v.get(t)||{}};s=function(t){return v.has(t)}}else{var b=u("state");p[b]=!0;r=function(t,e){if(d(t,b))throw g(f);e.facade=t;c(t,b,e);return e};i=function(t){return d(t,b)?t[b]:{}};s=function(t){return d(t,b)}}t.exports={set:r,get:i,has:s,enforce:function(t){return s(t)?i(t):r(t,{})},getterFor:function(t){return function(e){var n;if(!l(e)||(n=i(e)).type!==t)throw g("Incompatible receiver, "+t+" required");return n}}}},(t,e,n)=>{var r=n(7),i=n(24),s=r.WeakMap;t.exports=i(s)&&/native code/.test(String(s))},(t,e,n)=>{var r=n(38),i=n(44),s=r("keys");t.exports=function(t){return s[t]||(s[t]=i(t))}},t=>{t.exports={}},(t,e,n)=>{var r=n(42),i=n(60),s=n(8),a=n(48);t.exports=function(t,e,n){for(var o=i(e),l=a.f,c=s.f,d=0;d<o.length;d++){var h=o[d];r(t,h)||n&&r(n,h)||l(t,h,c(e,h))}}},(t,e,n)=>{var r=n(27),i=n(17),s=n(61),a=n(70),o=n(50),l=i([].concat);t.exports=r("Reflect","ownKeys")||function ownKeys(t){var e=s.f(o(t)),n=a.f;return n?l(e,n(t)):e}},(t,e,n)=>{var r=n(62),i=n(69).concat("length","prototype");e.f=Object.getOwnPropertyNames||function getOwnPropertyNames(t){return r(t,i)}},(t,e,n)=>{var r=n(17),i=n(42),s=n(15),a=n(63).indexOf,o=n(58),l=r([].push);t.exports=function(t,e){var n,r=s(t),c=0,d=[];for(n in r)!i(o,n)&&i(r,n)&&l(d,n);for(;e.length>c;)i(r,n=e[c++])&&(~a(d,n)||l(d,n));return d}},(t,e,n)=>{var r=n(15),i=n(64),s=n(67),createMethod=function(t){return function(e,n,a){var o,l=r(e),c=s(l),d=i(a,c);if(t&&n!=n){for(;c>d;)if((o=l[d++])!=o)return!0}else for(;c>d;d++)if((t||d in l)&&l[d]===n)return t||d||0;return!t&&-1}};t.exports={includes:createMethod(!0),indexOf:createMethod(!1)}},(t,e,n)=>{var r=n(65),i=Math.max,s=Math.min;t.exports=function(t,e){var n=r(t);return n<0?i(n+e,0):s(n,e)}},(t,e,n)=>{var r=n(66);t.exports=function(t){var e=+t;return e!=e||0===e?0:r(e)}},t=>{var e=Math.ceil,n=Math.floor;t.exports=Math.trunc||function trunc(t){var r=+t;return(r>0?n:e)(r)}},(t,e,n)=>{var r=n(68);t.exports=function(t){return r(t.length)}},(t,e,n)=>{var r=n(65),i=Math.min;t.exports=function(t){return t>0?i(r(t),9007199254740991):0}},t=>{t.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},(t,e)=>{e.f=Object.getOwnPropertySymbols},(t,e,n)=>{var r=n(10),i=n(24),s=/#|\.prototype\./,isForced=function(t,e){var n=o[a(t)];return n==c||n!=l&&(i(e)?r(e):!!e)},a=isForced.normalize=function(t){return String(t).replace(s,".").toLowerCase()},o=isForced.data={},l=isForced.NATIVE="N",c=isForced.POLYFILL="P";t.exports=isForced},(t,e,n)=>{var r=n(37),i=n(73),s=n(48).f,a=r("unscopables"),o=Array.prototype;null==o[a]&&s(o,a,{configurable:!0,value:i(null)});t.exports=function(t){o[a][t]=!0}},(t,e,n)=>{var r,i=n(50),s=n(74),a=n(69),o=n(58),l=n(76),c=n(46),d=n(57),h="prototype",u="script",p=d("IE_PROTO"),EmptyConstructor=function(){},scriptTag=function(t){return"<"+u+">"+t+"</"+u+">"},NullProtoObjectViaActiveX=function(t){t.write(scriptTag(""));t.close();var e=t.parentWindow.Object;t=null;return e},NullProtoObject=function(){try{r=new ActiveXObject("htmlfile")}catch(t){}NullProtoObject="undefined"!=typeof document?document.domain&&r?NullProtoObjectViaActiveX(r):function(){var t,e=c("iframe"),n="java"+u+":";e.style.display="none";l.appendChild(e);e.src=String(n);(t=e.contentWindow.document).open();t.write(scriptTag("document.F=Object"));t.close();return t.F}():NullProtoObjectViaActiveX(r);for(var t=a.length;t--;)delete NullProtoObject[h][a[t]];return NullProtoObject()};o[p]=!0;t.exports=Object.create||function create(t,e){var n;if(null!==t){EmptyConstructor[h]=i(t);n=new EmptyConstructor;EmptyConstructor[h]=null;n[p]=t}else n=NullProtoObject();return void 0===e?n:s.f(n,e)}},(t,e,n)=>{var r=n(9),i=n(49),s=n(48),a=n(50),o=n(15),l=n(75);e.f=r&&!i?Object.defineProperties:function defineProperties(t,e){a(t);for(var n,r=o(e),i=l(e),c=i.length,d=0;c>d;)s.f(t,n=i[d++],r[n]);return t}},(t,e,n)=>{var r=n(62),i=n(69);t.exports=Object.keys||function keys(t){return r(t,i)}},(t,e,n)=>{var r=n(27);t.exports=r("document","documentElement")},(t,e,n)=>{var r=n(7),i=n(17);t.exports=function(t,e){return i(r[t].prototype[e])}},(t,e,n)=>{n(79)},(t,e,n)=>{"use strict";var r=n(80),i=n(67),s=n(65),a=r.aTypedArray;(0,r.exportTypedArrayMethod)("at",(function at(t){var e=a(this),n=i(e),r=s(t),o=r>=0?r:n+r;return o<0||o>=n?void 0:e[o]}))},(t,e,n)=>{"use strict";var r,i,s,a=n(81),o=n(9),l=n(7),c=n(24),d=n(23),h=n(42),u=n(82),p=n(35),f=n(47),g=n(51),m=n(84),v=n(28),b=n(85),y=n(87),A=n(37),_=n(44),S=n(55),x=S.enforce,E=S.get,C=l.Int8Array,w=C&&C.prototype,P=l.Uint8ClampedArray,T=P&&P.prototype,k=C&&b(C),M=w&&b(w),R=Object.prototype,D=l.TypeError,I=A("toStringTag"),O=_("TYPED_ARRAY_TAG"),L="TypedArrayConstructor",N=a&&!!y&&"Opera"!==u(l.opera),j=!1,B={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8},U={BigInt64Array:8,BigUint64Array:8},getTypedArrayConstructor=function(t){var e=b(t);if(d(e)){var n=E(e);return n&&h(n,L)?n[L]:getTypedArrayConstructor(e)}},isTypedArray=function(t){if(!d(t))return!1;var e=u(t);return h(B,e)||h(U,e)};for(r in B)(s=(i=l[r])&&i.prototype)?x(s)[L]=i:N=!1;for(r in U)(s=(i=l[r])&&i.prototype)&&(x(s)[L]=i);if(!N||!c(k)||k===Function.prototype){k=function TypedArray(){throw D("Incorrect invocation")};if(N)for(r in B)l[r]&&y(l[r],k)}if(!N||!M||M===R){M=k.prototype;if(N)for(r in B)l[r]&&y(l[r].prototype,M)}N&&b(T)!==M&&y(T,M);if(o&&!h(M,I)){j=!0;m(M,I,{configurable:!0,get:function(){return d(this)?this[O]:void 0}});for(r in B)l[r]&&f(l[r],O,r)}t.exports={NATIVE_ARRAY_BUFFER_VIEWS:N,TYPED_ARRAY_TAG:j&&O,aTypedArray:function(t){if(isTypedArray(t))return t;throw D("Target is not a typed array")},aTypedArrayConstructor:function(t){if(c(t)&&(!y||v(k,t)))return t;throw D(p(t)+" is not a typed array constructor")},exportTypedArrayMethod:function(t,e,n,r){if(o){if(n)for(var i in B){var s=l[i];if(s&&h(s.prototype,t))try{delete s.prototype[t]}catch(n){try{s.prototype[t]=e}catch(t){}}}M[t]&&!n||g(M,t,n?e:N&&w[t]||e,r)}},exportTypedArrayStaticMethod:function(t,e,n){var r,i;if(o){if(y){if(n)for(r in B)if((i=l[r])&&h(i,t))try{delete i[t]}catch(t){}if(k[t]&&!n)return;try{return g(k,t,n?e:N&&k[t]||e)}catch(t){}}for(r in B)!(i=l[r])||i[t]&&!n||g(i,t,e)}},getTypedArrayConstructor:getTypedArrayConstructor,isView:function isView(t){if(!d(t))return!1;var e=u(t);return"DataView"===e||h(B,e)||h(U,e)},isTypedArray:isTypedArray,TypedArray:k,TypedArrayPrototype:M}},t=>{t.exports="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof DataView},(t,e,n)=>{var r=n(83),i=n(24),s=n(18),a=n(37)("toStringTag"),o=Object,l="Arguments"==s(function(){return arguments}());t.exports=r?s:function(t){var e,n,r;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(n=function(t,e){try{return t[e]}catch(t){}}(e=o(t),a))?n:l?s(e):"Object"==(r=s(e))&&i(e.callee)?"Arguments":r}},(t,e,n)=>{var r={};r[n(37)("toStringTag")]="z";t.exports="[object z]"===String(r)},(t,e,n)=>{var r=n(52),i=n(48);t.exports=function(t,e,n){n.get&&r(n.get,e,{getter:!0});n.set&&r(n.set,e,{setter:!0});return i.f(t,e,n)}},(t,e,n)=>{var r=n(42),i=n(24),s=n(43),a=n(57),o=n(86),l=a("IE_PROTO"),c=Object,d=c.prototype;t.exports=o?c.getPrototypeOf:function(t){var e=s(t);if(r(e,l))return e[l];var n=e.constructor;return i(n)&&e instanceof n?n.prototype:e instanceof c?d:null}},(t,e,n)=>{var r=n(10);t.exports=!r((function(){function F(){}F.prototype.constructor=null;return Object.getPrototypeOf(new F)!==F.prototype}))},(t,e,n)=>{var r=n(88),i=n(50),s=n(89);t.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var t,e=!1,n={};try{(t=r(Object.prototype,"__proto__","set"))(n,[]);e=n instanceof Array}catch(t){}return function setPrototypeOf(n,r){i(n);s(r);e?t(n,r):n.__proto__=r;return n}}():void 0)},(t,e,n)=>{var r=n(17),i=n(34);t.exports=function(t,e,n){try{return r(i(Object.getOwnPropertyDescriptor(t,e)[n]))}catch(t){}}},(t,e,n)=>{var r=n(24),i=String,s=TypeError;t.exports=function(t){if("object"==typeof t||r(t))return t;throw s("Can't set "+i(t)+" as a prototype")}},(t,e,n)=>{n(91);n(98);n(100);n(123);n(125);var r=n(137);t.exports=r.structuredClone},(t,e,n)=>{"use strict";var r=n(15),i=n(72),s=n(92),a=n(55),o=n(48).f,l=n(93),c=n(97),d=n(39),h=n(9),u="Array Iterator",p=a.set,f=a.getterFor(u);t.exports=l(Array,"Array",(function(t,e){p(this,{type:u,target:r(t),index:0,kind:e})}),(function(){var t=f(this),e=t.target,n=t.kind,r=t.index++;if(!e||r>=e.length){t.target=void 0;return c(void 0,!0)}return c("keys"==n?r:"values"==n?e[r]:[r,e[r]],!1)}),"values");var g=s.Arguments=s.Array;i("keys");i("values");i("entries");if(!d&&h&&"values"!==g.name)try{o(g,"name",{value:"values"})}catch(t){}},t=>{t.exports={}},(t,e,n)=>{"use strict";var r=n(6),i=n(11),s=n(39),a=n(53),o=n(24),l=n(94),c=n(85),d=n(87),h=n(96),u=n(47),p=n(51),f=n(37),g=n(92),m=n(95),v=a.PROPER,b=a.CONFIGURABLE,y=m.IteratorPrototype,A=m.BUGGY_SAFARI_ITERATORS,_=f("iterator"),S="keys",x="values",E="entries",returnThis=function(){return this};t.exports=function(t,e,n,a,f,m,C){l(n,e,a);var w,P,T,getIterationMethod=function(t){if(t===f&&I)return I;if(!A&&t in R)return R[t];switch(t){case S:return function keys(){return new n(this,t)};case x:return function values(){return new n(this,t)};case E:return function entries(){return new n(this,t)}}return function(){return new n(this)}},k=e+" Iterator",M=!1,R=t.prototype,D=R[_]||R["@@iterator"]||f&&R[f],I=!A&&D||getIterationMethod(f),O="Array"==e&&R.entries||D;if(O&&(w=c(O.call(new t)))!==Object.prototype&&w.next){s||c(w)===y||(d?d(w,y):o(w[_])||p(w,_,returnThis));h(w,k,!0,!0);s&&(g[k]=returnThis)}if(v&&f==x&&D&&D.name!==x)if(!s&&b)u(R,"name",x);else{M=!0;I=function values(){return i(D,this)}}if(f){P={values:getIterationMethod(x),keys:m?I:getIterationMethod(S),entries:getIterationMethod(E)};if(C)for(T in P)(A||M||!(T in R))&&p(R,T,P[T]);else r({target:e,proto:!0,forced:A||M},P)}s&&!C||R[_]===I||p(R,_,I,{name:f});g[e]=I;return P}},(t,e,n)=>{"use strict";var r=n(95).IteratorPrototype,i=n(73),s=n(14),a=n(96),o=n(92),returnThis=function(){return this};t.exports=function(t,e,n,l){var c=e+" Iterator";t.prototype=i(r,{next:s(+!l,n)});a(t,c,!1,!0);o[c]=returnThis;return t}},(t,e,n)=>{"use strict";var r,i,s,a=n(10),o=n(24),l=n(23),c=n(73),d=n(85),h=n(51),u=n(37),p=n(39),f=u("iterator"),g=!1;[].keys&&("next"in(s=[].keys())?(i=d(d(s)))!==Object.prototype&&(r=i):g=!0);!l(r)||a((function(){var t={};return r[f].call(t)!==t}))?r={}:p&&(r=c(r));o(r[f])||h(r,f,(function(){return this}));t.exports={IteratorPrototype:r,BUGGY_SAFARI_ITERATORS:g}},(t,e,n)=>{var r=n(48).f,i=n(42),s=n(37)("toStringTag");t.exports=function(t,e,n){t&&!n&&(t=t.prototype);t&&!i(t,s)&&r(t,s,{configurable:!0,value:e})}},t=>{t.exports=function(t,e){return{value:t,done:e}}},(t,e,n)=>{var r=n(83),i=n(51),s=n(99);r||i(Object.prototype,"toString",s,{unsafe:!0})},(t,e,n)=>{"use strict";var r=n(83),i=n(82);t.exports=r?{}.toString:function toString(){return"[object "+i(this)+"]"}},(t,e,n)=>{n(101)},(t,e,n)=>{"use strict";n(102)("Map",(function(t){return function Map(){return t(this,arguments.length?arguments[0]:void 0)}}),n(120))},(t,e,n)=>{"use strict";var r=n(6),i=n(7),s=n(17),a=n(71),o=n(51),l=n(103),c=n(110),d=n(117),h=n(24),u=n(20),p=n(23),f=n(10),g=n(118),m=n(96),v=n(119);t.exports=function(t,e,n){var b=-1!==t.indexOf("Map"),y=-1!==t.indexOf("Weak"),A=b?"set":"add",_=i[t],S=_&&_.prototype,x=_,E={},fixMethod=function(t){var e=s(S[t]);o(S,t,"add"==t?function add(t){e(this,0===t?0:t);return this}:"delete"==t?function(t){return!(y&&!p(t))&&e(this,0===t?0:t)}:"get"==t?function get(t){return y&&!p(t)?void 0:e(this,0===t?0:t)}:"has"==t?function has(t){return!(y&&!p(t))&&e(this,0===t?0:t)}:function set(t,n){e(this,0===t?0:t,n);return this})};if(a(t,!h(_)||!(y||S.forEach&&!f((function(){(new _).entries().next()}))))){x=n.getConstructor(e,t,b,A);l.enable()}else if(a(t,!0)){var C=new x,w=C[A](y?{}:-0,1)!=C,P=f((function(){C.has(1)})),T=g((function(t){new _(t)})),k=!y&&f((function(){for(var t=new _,e=5;e--;)t[A](e,e);return!t.has(-0)}));if(!T){(x=e((function(t,e){d(t,S);var n=v(new _,t,x);u(e)||c(e,n[A],{that:n,AS_ENTRIES:b});return n}))).prototype=S;S.constructor=x}if(P||k){fixMethod("delete");fixMethod("has");b&&fixMethod("get")}(k||w)&&fixMethod(A);y&&S.clear&&delete S.clear}E[t]=x;r({global:!0,constructor:!0,forced:x!=_},E);m(x,t);y||n.setStrong(x,t,b);return x}},(t,e,n)=>{var r=n(6),i=n(17),s=n(58),a=n(23),o=n(42),l=n(48).f,c=n(61),d=n(104),h=n(107),u=n(44),p=n(109),f=!1,g=u("meta"),m=0,setMetadata=function(t){l(t,g,{value:{objectID:"O"+m++,weakData:{}}})},v=t.exports={enable:function(){v.enable=function(){};f=!0;var t=c.f,e=i([].splice),n={};n[g]=1;if(t(n).length){c.f=function(n){for(var r=t(n),i=0,s=r.length;i<s;i++)if(r[i]===g){e(r,i,1);break}return r};r({target:"Object",stat:!0,forced:!0},{getOwnPropertyNames:d.f})}},fastKey:function(t,e){if(!a(t))return"symbol"==typeof t?t:("string"==typeof t?"S":"P")+t;if(!o(t,g)){if(!h(t))return"F";if(!e)return"E";setMetadata(t)}return t[g].objectID},getWeakData:function(t,e){if(!o(t,g)){if(!h(t))return!0;if(!e)return!1;setMetadata(t)}return t[g].weakData},onFreeze:function(t){p&&f&&h(t)&&!o(t,g)&&setMetadata(t);return t}};s[g]=!0},(t,e,n)=>{var r=n(18),i=n(15),s=n(61).f,a=n(105),o="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];t.exports.f=function getOwnPropertyNames(t){return o&&"Window"==r(t)?function(t){try{return s(t)}catch(t){return a(o)}}(t):s(i(t))}},(t,e,n)=>{var r=n(64),i=n(67),s=n(106),a=Array,o=Math.max;t.exports=function(t,e,n){for(var l=i(t),c=r(e,l),d=r(void 0===n?l:n,l),h=a(o(d-c,0)),u=0;c<d;c++,u++)s(h,u,t[c]);h.length=u;return h}},(t,e,n)=>{"use strict";var r=n(21),i=n(48),s=n(14);t.exports=function(t,e,n){var a=r(e);a in t?i.f(t,a,s(0,n)):t[a]=n}},(t,e,n)=>{var r=n(10),i=n(23),s=n(18),a=n(108),o=Object.isExtensible,l=r((function(){o(1)}));t.exports=l||a?function isExtensible(t){return!!i(t)&&((!a||"ArrayBuffer"!=s(t))&&(!o||o(t)))}:o},(t,e,n)=>{var r=n(10);t.exports=r((function(){if("function"==typeof ArrayBuffer){var t=new ArrayBuffer(8);Object.isExtensible(t)&&Object.defineProperty(t,"a",{value:8})}}))},(t,e,n)=>{var r=n(10);t.exports=!r((function(){return Object.isExtensible(Object.preventExtensions({}))}))},(t,e,n)=>{var r=n(111),i=n(11),s=n(50),a=n(35),o=n(113),l=n(67),c=n(28),d=n(114),h=n(115),u=n(116),p=TypeError,Result=function(t,e){this.stopped=t;this.result=e},f=Result.prototype;t.exports=function(t,e,n){var g,m,v,b,y,A,_,S=n&&n.that,x=!(!n||!n.AS_ENTRIES),E=!(!n||!n.IS_RECORD),C=!(!n||!n.IS_ITERATOR),w=!(!n||!n.INTERRUPTED),P=r(e,S),stop=function(t){g&&u(g,"normal",t);return new Result(!0,t)},callFn=function(t){if(x){s(t);return w?P(t[0],t[1],stop):P(t[0],t[1])}return w?P(t,stop):P(t)};if(E)g=t.iterator;else if(C)g=t;else{if(!(m=h(t)))throw p(a(t)+" is not iterable");if(o(m)){for(v=0,b=l(t);b>v;v++)if((y=callFn(t[v]))&&c(f,y))return y;return new Result(!1)}g=d(t,m)}A=E?t.next:g.next;for(;!(_=i(A,g)).done;){try{y=callFn(_.value)}catch(t){u(g,"throw",t)}if("object"==typeof y&&y&&c(f,y))return y}return new Result(!1)}},(t,e,n)=>{var r=n(112),i=n(34),s=n(12),a=r(r.bind);t.exports=function(t,e){i(t);return void 0===e?t:s?a(t,e):function(){return t.apply(e,arguments)}}},(t,e,n)=>{var r=n(18),i=n(17);t.exports=function(t){if("Function"===r(t))return i(t)}},(t,e,n)=>{var r=n(37),i=n(92),s=r("iterator"),a=Array.prototype;t.exports=function(t){return void 0!==t&&(i.Array===t||a[s]===t)}},(t,e,n)=>{var r=n(11),i=n(34),s=n(50),a=n(35),o=n(115),l=TypeError;t.exports=function(t,e){var n=arguments.length<2?o(t):e;if(i(n))return s(r(n,t));throw l(a(t)+" is not iterable")}},(t,e,n)=>{var r=n(82),i=n(33),s=n(20),a=n(92),o=n(37)("iterator");t.exports=function(t){if(!s(t))return i(t,o)||i(t,"@@iterator")||a[r(t)]}},(t,e,n)=>{var r=n(11),i=n(50),s=n(33);t.exports=function(t,e,n){var a,o;i(t);try{if(!(a=s(t,"return"))){if("throw"===e)throw n;return n}a=r(a,t)}catch(t){o=!0;a=t}if("throw"===e)throw n;if(o)throw a;i(a);return n}},(t,e,n)=>{var r=n(28),i=TypeError;t.exports=function(t,e){if(r(e,t))return t;throw i("Incorrect invocation")}},(t,e,n)=>{var r=n(37)("iterator"),i=!1;try{var s=0,a={next:function(){return{done:!!s++}},return:function(){i=!0}};a[r]=function(){return this};Array.from(a,(function(){throw 2}))}catch(t){}t.exports=function(t,e){if(!e&&!i)return!1;var n=!1;try{var s={};s[r]=function(){return{next:function(){return{done:n=!0}}}};t(s)}catch(t){}return n}},(t,e,n)=>{var r=n(24),i=n(23),s=n(87);t.exports=function(t,e,n){var a,o;s&&r(a=e.constructor)&&a!==n&&i(o=a.prototype)&&o!==n.prototype&&s(t,o);return t}},(t,e,n)=>{"use strict";var r=n(73),i=n(84),s=n(121),a=n(111),o=n(117),l=n(20),c=n(110),d=n(93),h=n(97),u=n(122),p=n(9),f=n(103).fastKey,g=n(55),m=g.set,v=g.getterFor;t.exports={getConstructor:function(t,e,n,d){var h=t((function(t,i){o(t,u);m(t,{type:e,index:r(null),first:void 0,last:void 0,size:0});p||(t.size=0);l(i)||c(i,t[d],{that:t,AS_ENTRIES:n})})),u=h.prototype,g=v(e),define=function(t,e,n){var r,i,s=g(t),a=getEntry(t,e);if(a)a.value=n;else{s.last=a={index:i=f(e,!0),key:e,value:n,previous:r=s.last,next:void 0,removed:!1};s.first||(s.first=a);r&&(r.next=a);p?s.size++:t.size++;"F"!==i&&(s.index[i]=a)}return t},getEntry=function(t,e){var n,r=g(t),i=f(e);if("F"!==i)return r.index[i];for(n=r.first;n;n=n.next)if(n.key==e)return n};s(u,{clear:function clear(){for(var t=g(this),e=t.index,n=t.first;n;){n.removed=!0;n.previous&&(n.previous=n.previous.next=void 0);delete e[n.index];n=n.next}t.first=t.last=void 0;p?t.size=0:this.size=0},delete:function(t){var e=this,n=g(e),r=getEntry(e,t);if(r){var i=r.next,s=r.previous;delete n.index[r.index];r.removed=!0;s&&(s.next=i);i&&(i.previous=s);n.first==r&&(n.first=i);n.last==r&&(n.last=s);p?n.size--:e.size--}return!!r},forEach:function forEach(t){for(var e,n=g(this),r=a(t,arguments.length>1?arguments[1]:void 0);e=e?e.next:n.first;){r(e.value,e.key,this);for(;e&&e.removed;)e=e.previous}},has:function has(t){return!!getEntry(this,t)}});s(u,n?{get:function get(t){var e=getEntry(this,t);return e&&e.value},set:function set(t,e){return define(this,0===t?0:t,e)}}:{add:function add(t){return define(this,t=0===t?0:t,t)}});p&&i(u,"size",{configurable:!0,get:function(){return g(this).size}});return h},setStrong:function(t,e,n){var r=e+" Iterator",i=v(e),s=v(r);d(t,e,(function(t,e){m(this,{type:r,target:t,state:i(t),kind:e,last:void 0})}),(function(){for(var t=s(this),e=t.kind,n=t.last;n&&n.removed;)n=n.previous;if(!t.target||!(t.last=n=n?n.next:t.state.first)){t.target=void 0;return h(void 0,!0)}return h("keys"==e?n.key:"values"==e?n.value:[n.key,n.value],!1)}),n?"entries":"values",!n,!0);u(e)}}},(t,e,n)=>{var r=n(51);t.exports=function(t,e,n){for(var i in e)r(t,i,e[i],n);return t}},(t,e,n)=>{"use strict";var r=n(27),i=n(84),s=n(37),a=n(9),o=s("species");t.exports=function(t){var e=r(t);a&&e&&!e[o]&&i(e,o,{configurable:!0,get:function(){return this}})}},(t,e,n)=>{n(124)},(t,e,n)=>{"use strict";n(102)("Set",(function(t){return function Set(){return t(this,arguments.length?arguments[0]:void 0)}}),n(120))},(t,e,n)=>{var r,i=n(39),s=n(6),a=n(7),o=n(27),l=n(17),c=n(10),d=n(44),h=n(24),u=n(126),p=n(20),f=n(23),g=n(26),m=n(110),v=n(50),b=n(82),y=n(42),A=n(106),_=n(47),S=n(67),x=n(127),E=n(128),C=n(130),w=n(131),P=n(132),T=n(133),k=a.Object,M=a.Array,R=a.Date,D=a.Error,I=a.EvalError,O=a.RangeError,L=a.ReferenceError,N=a.SyntaxError,j=a.TypeError,B=a.URIError,U=a.PerformanceMark,W=a.WebAssembly,q=W&&W.CompileError||D,G=W&&W.LinkError||D,H=W&&W.RuntimeError||D,z=o("DOMException"),V=C.Map,X=C.has,$=C.get,Y=C.set,K=w.Set,J=w.add,Q=o("Object","keys"),Z=l([].push),tt=l((!0).valueOf),et=l(1..valueOf),nt=l("".valueOf),rt=l(R.prototype.getTime),it=d("structuredClone"),st="DataCloneError",ot="Transferring",checkBasicSemantic=function(t){return!c((function(){var e=new a.Set([7]),n=t(e),r=t(k(7));return n==e||!n.has(7)||"object"!=typeof r||7!=r}))&&t},checkErrorsCloning=function(t,e){return!c((function(){var n=new e,r=t({a:n,b:n});return!(r&&r.a===r.b&&r.a instanceof e&&r.a.stack===n.stack)}))},lt=a.structuredClone,ct=i||!checkErrorsCloning(lt,D)||!checkErrorsCloning(lt,z)||!(r=lt,!c((function(){var t=r(new a.AggregateError([1],it,{cause:3}));return"AggregateError"!=t.name||1!=t.errors[0]||t.message!=it||3!=t.cause}))),dt=!lt&&checkBasicSemantic((function(t){return new U(it,{detail:t}).detail})),ht=checkBasicSemantic(lt)||dt,throwUncloneable=function(t){throw new z("Uncloneable type: "+t,st)},throwUnpolyfillable=function(t,e){throw new z((e||"Cloning")+" of "+t+" cannot be properly polyfilled in this engine",st)},tryNativeRestrictedStructuredClone=function(t,e){ht||throwUnpolyfillable(e);return ht(t)},structuredCloneInternal=function(t,e){g(t)&&throwUncloneable("Symbol");if(!f(t))return t;if(e){if(X(e,t))return $(e,t)}else e=new V;var n,r,i,s,l,c,d,u,p,m,v,x=b(t),C=!1;switch(x){case"Array":i=M(S(t));C=!0;break;case"Object":i={};C=!0;break;case"Map":i=new V;C=!0;break;case"Set":i=new K;C=!0;break;case"RegExp":i=new RegExp(t.source,E(t));break;case"Error":switch(r=t.name){case"AggregateError":i=o("AggregateError")([]);break;case"EvalError":i=I();break;case"RangeError":i=O();break;case"ReferenceError":i=L();break;case"SyntaxError":i=N();break;case"TypeError":i=j();break;case"URIError":i=B();break;case"CompileError":i=q();break;case"LinkError":i=G();break;case"RuntimeError":i=H();break;default:i=D()}C=!0;break;case"DOMException":i=new z(t.message,t.name);C=!0;break;case"DataView":case"Int8Array":case"Uint8Array":case"Uint8ClampedArray":case"Int16Array":case"Uint16Array":case"Int32Array":case"Uint32Array":case"Float32Array":case"Float64Array":case"BigInt64Array":case"BigUint64Array":n=a[x];f(n)||throwUnpolyfillable(x);i=new n(structuredCloneInternal(t.buffer,e),t.byteOffset,"DataView"===x?t.byteLength:t.length);break;case"DOMQuad":try{i=new DOMQuad(structuredCloneInternal(t.p1,e),structuredCloneInternal(t.p2,e),structuredCloneInternal(t.p3,e),structuredCloneInternal(t.p4,e))}catch(e){i=tryNativeRestrictedStructuredClone(t,x)}break;case"File":if(ht)try{i=ht(t);b(i)!==x&&(i=void 0)}catch(t){}if(!i)try{i=new File([t],t.name,t)}catch(t){}i||throwUnpolyfillable(x);break;case"FileList":if(s=function(){var t;try{t=new a.DataTransfer}catch(e){try{t=new a.ClipboardEvent("").clipboardData}catch(t){}}return t&&t.items&&t.files?t:null}()){for(l=0,c=S(t);l<c;l++)s.items.add(structuredCloneInternal(t[l],e));i=s.files}else i=tryNativeRestrictedStructuredClone(t,x);break;case"ImageData":try{i=new ImageData(structuredCloneInternal(t.data,e),t.width,t.height,{colorSpace:t.colorSpace})}catch(e){i=tryNativeRestrictedStructuredClone(t,x)}break;default:if(ht)i=ht(t);else switch(x){case"BigInt":i=k(t.valueOf());break;case"Boolean":i=k(tt(t));break;case"Number":i=k(et(t));break;case"String":i=k(nt(t));break;case"Date":i=new R(rt(t));break;case"ArrayBuffer":(n=a.DataView)||"function"==typeof t.slice||throwUnpolyfillable(x);try{if("function"!=typeof t.slice||t.resizable){c=t.byteLength;v="maxByteLength"in t?{maxByteLength:t.maxByteLength}:void 0;i=new ArrayBuffer(c,v);p=new n(t);m=new n(i);for(l=0;l<c;l++)m.setUint8(l,p.getUint8(l))}else i=t.slice(0)}catch(t){throw new z("ArrayBuffer is detached",st)}break;case"SharedArrayBuffer":i=t;break;case"Blob":try{i=t.slice(0,t.size,t.type)}catch(t){throwUnpolyfillable(x)}break;case"DOMPoint":case"DOMPointReadOnly":n=a[x];try{i=n.fromPoint?n.fromPoint(t):new n(t.x,t.y,t.z,t.w)}catch(t){throwUnpolyfillable(x)}break;case"DOMRect":case"DOMRectReadOnly":n=a[x];try{i=n.fromRect?n.fromRect(t):new n(t.x,t.y,t.width,t.height)}catch(t){throwUnpolyfillable(x)}break;case"DOMMatrix":case"DOMMatrixReadOnly":n=a[x];try{i=n.fromMatrix?n.fromMatrix(t):new n(t)}catch(t){throwUnpolyfillable(x)}break;case"AudioData":case"VideoFrame":h(t.clone)||throwUnpolyfillable(x);try{i=t.clone()}catch(t){throwUncloneable(x)}break;case"CropTarget":case"CryptoKey":case"FileSystemDirectoryHandle":case"FileSystemFileHandle":case"FileSystemHandle":case"GPUCompilationInfo":case"GPUCompilationMessage":case"ImageBitmap":case"RTCCertificate":case"WebAssembly.Module":throwUnpolyfillable(x);default:throwUncloneable(x)}}Y(e,t,i);if(C)switch(x){case"Array":case"Object":d=Q(t);for(l=0,c=S(d);l<c;l++){u=d[l];A(i,u,structuredCloneInternal(t[u],e))}break;case"Map":t.forEach((function(t,n){Y(i,structuredCloneInternal(n,e),structuredCloneInternal(t,e))}));break;case"Set":t.forEach((function(t){J(i,structuredCloneInternal(t,e))}));break;case"Error":_(i,"message",structuredCloneInternal(t.message,e));y(t,"cause")&&_(i,"cause",structuredCloneInternal(t.cause,e));"AggregateError"==r&&(i.errors=structuredCloneInternal(t.errors,e));case"DOMException":P&&_(i,"stack",structuredCloneInternal(t.stack,e))}return i};s({global:!0,enumerable:!0,sham:!T,forced:ct},{structuredClone:function structuredClone(t){var e,n=x(arguments.length,1)>1&&!p(arguments[1])?v(arguments[1]):void 0,r=n?n.transfer:void 0;void 0!==r&&function(t,e){if(!f(t))throw j("Transfer option cannot be converted to a sequence");var n=[];m(t,(function(t){Z(n,v(t))}));var r,i,s,o,l,c,d=0,p=S(n);if(T){o=lt(n,{transfer:n});for(;d<p;)Y(e,n[d],o[d++])}else for(;d<p;){r=n[d++];if(X(e,r))throw new z("Duplicate transferable",st);switch(i=b(r)){case"ImageBitmap":s=a.OffscreenCanvas;u(s)||throwUnpolyfillable(i,ot);try{(c=new s(r.width,r.height)).getContext("bitmaprenderer").transferFromImageBitmap(r);l=c.transferToImageBitmap()}catch(t){}break;case"AudioData":case"VideoFrame":h(r.clone)&&h(r.close)||throwUnpolyfillable(i,ot);try{l=r.clone();r.close()}catch(t){}break;case"ArrayBuffer":h(r.transfer)||throwUnpolyfillable(i,ot);l=r.transfer();break;case"MediaSourceHandle":case"MessagePort":case"OffscreenCanvas":case"ReadableStream":case"TransformStream":case"WritableStream":throwUnpolyfillable(i,ot)}if(void 0===l)throw new z("This object cannot be transferred: "+i,st);Y(e,r,l)}}(r,e=new V);return structuredCloneInternal(t,e)}})},(t,e,n)=>{var r=n(17),i=n(10),s=n(24),a=n(82),o=n(27),l=n(54),noop=function(){},c=[],d=o("Reflect","construct"),h=/^\s*(?:class|function)\b/,u=r(h.exec),p=!h.exec(noop),f=function isConstructor(t){if(!s(t))return!1;try{d(noop,c,t);return!0}catch(t){return!1}},g=function isConstructor(t){if(!s(t))return!1;switch(a(t)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return p||!!u(h,l(t))}catch(t){return!0}};g.sham=!0;t.exports=!d||i((function(){var t;return f(f.call)||!f(Object)||!f((function(){t=!0}))||t}))?g:f},t=>{var e=TypeError;t.exports=function(t,n){if(t<n)throw e("Not enough arguments");return t}},(t,e,n)=>{var r=n(11),i=n(42),s=n(28),a=n(129),o=RegExp.prototype;t.exports=function(t){var e=t.flags;return void 0!==e||"flags"in o||i(t,"flags")||!s(o,t)?e:r(a,t)}},(t,e,n)=>{"use strict";var r=n(50);t.exports=function(){var t=r(this),e="";t.hasIndices&&(e+="d");t.global&&(e+="g");t.ignoreCase&&(e+="i");t.multiline&&(e+="m");t.dotAll&&(e+="s");t.unicode&&(e+="u");t.unicodeSets&&(e+="v");t.sticky&&(e+="y");return e}},(t,e,n)=>{var r=n(17),i=Map.prototype;t.exports={Map:Map,set:r(i.set),get:r(i.get),has:r(i.has),remove:r(i.delete),proto:i}},(t,e,n)=>{var r=n(17),i=Set.prototype;t.exports={Set:Set,add:r(i.add),has:r(i.has),remove:r(i.delete),proto:i}},(t,e,n)=>{var r=n(10),i=n(14);t.exports=!r((function(){var t=Error("a");if(!("stack"in t))return!0;Object.defineProperty(t,"stack",i(1,7));return 7!==t.stack}))},(t,e,n)=>{var r=n(7),i=n(10),s=n(31),a=n(134),o=n(135),l=n(136),c=r.structuredClone;t.exports=!!c&&!i((function(){if(o&&s>92||l&&s>94||a&&s>97)return!1;var t=new ArrayBuffer(8),e=c(t,{transfer:[t]});return 0!=t.byteLength||8!=e.byteLength}))},(t,e,n)=>{var r=n(135),i=n(136);t.exports=!r&&!i&&"object"==typeof window&&"object"==typeof document},t=>{t.exports="object"==typeof Deno&&Deno&&"object"==typeof Deno.version},(t,e,n)=>{var r=n(18);t.exports="undefined"!=typeof process&&"process"==r(process)},(t,e,n)=>{var r=n(7);t.exports=r},(__unused_webpack_module,exports,__w_pdfjs_require__)=>{"use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.build=exports.RenderTask=exports.PDFWorkerUtil=exports.PDFWorker=exports.PDFPageProxy=exports.PDFDocumentProxy=exports.PDFDocumentLoadingTask=exports.PDFDataRangeTransport=exports.LoopbackPort=exports.DefaultStandardFontDataFactory=exports.DefaultFilterFactory=exports.DefaultCanvasFactory=exports.DefaultCMapReaderFactory=void 0;exports.getDocument=getDocument;exports.version=void 0;var _util=__w_pdfjs_require__(1),_annotation_storage=__w_pdfjs_require__(139),_display_utils=__w_pdfjs_require__(142),_font_loader=__w_pdfjs_require__(145),_canvas=__w_pdfjs_require__(146),_worker_options=__w_pdfjs_require__(149),_is_node=__w_pdfjs_require__(3),_message_handler=__w_pdfjs_require__(150),_metadata=__w_pdfjs_require__(151),_optional_content_config=__w_pdfjs_require__(152),_transport_stream=__w_pdfjs_require__(153),_xfa_text=__w_pdfjs_require__(154);const DEFAULT_RANGE_CHUNK_SIZE=65536,RENDERING_CANCELLED_TIMEOUT=100,DELAYED_CLEANUP_TIMEOUT=5e3;let DefaultCanvasFactory=_display_utils.DOMCanvasFactory;exports.DefaultCanvasFactory=DefaultCanvasFactory;let DefaultCMapReaderFactory=_display_utils.DOMCMapReaderFactory;exports.DefaultCMapReaderFactory=DefaultCMapReaderFactory;let DefaultFilterFactory=_display_utils.DOMFilterFactory;exports.DefaultFilterFactory=DefaultFilterFactory;let DefaultStandardFontDataFactory=_display_utils.DOMStandardFontDataFactory,createPDFNetworkStream;exports.DefaultStandardFontDataFactory=DefaultStandardFontDataFactory;if(_is_node.isNodeJS){const{NodeCanvasFactory:t,NodeCMapReaderFactory:e,NodeFilterFactory:n,NodeStandardFontDataFactory:r}=__w_pdfjs_require__(155);exports.DefaultCanvasFactory=DefaultCanvasFactory=t;exports.DefaultCMapReaderFactory=DefaultCMapReaderFactory=e;exports.DefaultFilterFactory=DefaultFilterFactory=n;exports.DefaultStandardFontDataFactory=DefaultStandardFontDataFactory=r}if(_is_node.isNodeJS){const{PDFNodeStream:t}=__w_pdfjs_require__(156);createPDFNetworkStream=e=>new t(e)}else{const{PDFNetworkStream:t}=__w_pdfjs_require__(159),{PDFFetchStream:e}=__w_pdfjs_require__(160);createPDFNetworkStream=n=>(0,_display_utils.isValidFetchUrl)(n.url)?new e(n):new t(n)}function getDocument(t){"string"==typeof t||t instanceof URL?t={url:t}:(0,_util.isArrayBuffer)(t)&&(t={data:t});if("object"!=typeof t)throw new Error("Invalid parameter in getDocument, need parameter object.");if(!t.url&&!t.data&&!t.range)throw new Error("Invalid parameter object: need either .data, .range or .url");const e=new PDFDocumentLoadingTask,{docId:n}=e,r=t.url?getUrlProp(t.url):null,i=t.data?getDataProp(t.data):null,s=t.httpHeaders||null,a=!0===t.withCredentials,o=t.password??null,l=t.range instanceof PDFDataRangeTransport?t.range:null,c=Number.isInteger(t.rangeChunkSize)&&t.rangeChunkSize>0?t.rangeChunkSize:DEFAULT_RANGE_CHUNK_SIZE;let d=t.worker instanceof PDFWorker?t.worker:null;const h=t.verbosity,u="string"!=typeof t.docBaseUrl||(0,_display_utils.isDataScheme)(t.docBaseUrl)?null:t.docBaseUrl,p="string"==typeof t.cMapUrl?t.cMapUrl:null,f=!1!==t.cMapPacked,g=t.CMapReaderFactory||DefaultCMapReaderFactory,m="string"==typeof t.standardFontDataUrl?t.standardFontDataUrl:null,v=t.StandardFontDataFactory||DefaultStandardFontDataFactory,b=!0!==t.stopAtErrors,y=Number.isInteger(t.maxImageSize)&&t.maxImageSize>-1?t.maxImageSize:-1,A=!1!==t.isEvalSupported,_="boolean"==typeof t.isOffscreenCanvasSupported?t.isOffscreenCanvasSupported:!_is_node.isNodeJS,S=Number.isInteger(t.canvasMaxAreaInBytes)?t.canvasMaxAreaInBytes:-1,x="boolean"==typeof t.disableFontFace?t.disableFontFace:_is_node.isNodeJS,E=!0===t.fontExtraProperties,C=!0===t.enableXfa,w=t.ownerDocument||globalThis.document,P=!0===t.disableRange,T=!0===t.disableStream,k=!0===t.disableAutoFetch,M=!0===t.pdfBug,R=l?l.length:t.length??NaN,D="boolean"==typeof t.useSystemFonts?t.useSystemFonts:!_is_node.isNodeJS&&!x,I="boolean"==typeof t.useWorkerFetch?t.useWorkerFetch:g===_display_utils.DOMCMapReaderFactory&&v===_display_utils.DOMStandardFontDataFactory&&(0,_display_utils.isValidFetchUrl)(p,document.baseURI)&&(0,_display_utils.isValidFetchUrl)(m,document.baseURI),O=t.canvasFactory||new DefaultCanvasFactory({ownerDocument:w}),L=t.filterFactory||new DefaultFilterFactory({docId:n,ownerDocument:w});(0,_util.setVerbosityLevel)(h);const N={canvasFactory:O,filterFactory:L};if(!I){N.cMapReaderFactory=new g({baseUrl:p,isCompressed:f});N.standardFontDataFactory=new v({baseUrl:m})}if(!d){const t={verbosity:h,port:_worker_options.GlobalWorkerOptions.workerPort};d=t.port?PDFWorker.fromPort(t):new PDFWorker(t);e._worker=d}const j={docId:n,apiVersion:"3.7.107",data:i,password:o,disableAutoFetch:k,rangeChunkSize:c,length:R,docBaseUrl:u,enableXfa:C,evaluatorOptions:{maxImageSize:y,disableFontFace:x,ignoreErrors:b,isEvalSupported:A,isOffscreenCanvasSupported:_,canvasMaxAreaInBytes:S,fontExtraProperties:E,useSystemFonts:D,cMapUrl:I?p:null,standardFontDataUrl:I?m:null}},B={ignoreErrors:b,isEvalSupported:A,disableFontFace:x,fontExtraProperties:E,enableXfa:C,ownerDocument:w,disableAutoFetch:k,pdfBug:M,styleElement:null};d.promise.then((function(){if(e.destroyed)throw new Error("Loading aborted");const t=_fetchDocument(d,j),o=new Promise((function(t){let e;l?e=new _transport_stream.PDFDataTransportStream({length:R,initialData:l.initialData,progressiveDone:l.progressiveDone,contentDispositionFilename:l.contentDispositionFilename,disableRange:P,disableStream:T},l):i||(e=createPDFNetworkStream({url:r,length:R,httpHeaders:s,withCredentials:a,rangeChunkSize:c,disableRange:P,disableStream:T}));t(e)}));return Promise.all([t,o]).then((function(t){let[r,i]=t;if(e.destroyed)throw new Error("Loading aborted");const s=new _message_handler.MessageHandler(n,r,d.port),a=new WorkerTransport(s,e,i,B,N);e._transport=a;s.send("Ready",null)}))})).catch(e._capability.reject);return e}async function _fetchDocument(t,e){if(t.destroyed)throw new Error("Worker was destroyed");const n=await t.messageHandler.sendWithPromise("GetDocRequest",e,e.data?[e.data.buffer]:null);if(t.destroyed)throw new Error("Worker was destroyed");return n}function getUrlProp(t){if(t instanceof URL)return t.href;try{return new URL(t,window.location).href}catch(e){if(_is_node.isNodeJS&&"string"==typeof t)return t}throw new Error("Invalid PDF url data: either string or URL-object is expected in the url property.")}function getDataProp(t){if(_is_node.isNodeJS&&"undefined"!=typeof Buffer&&t instanceof Buffer){(0,_display_utils.deprecated)("Please provide binary data as `Uint8Array`, rather than `Buffer`.");return new Uint8Array(t)}if(t instanceof Uint8Array&&t.byteLength===t.buffer.byteLength)return t;if("string"==typeof t)return(0,_util.stringToBytes)(t);if("object"==typeof t&&!isNaN(null==t?void 0:t.length)||(0,_util.isArrayBuffer)(t))return new Uint8Array(t);throw new Error("Invalid PDF binary data: either TypedArray, string, or array-like object is expected in the data property.")}class PDFDocumentLoadingTask{static#e=0;constructor(){this._capability=new _util.PromiseCapability;this._transport=null;this._worker=null;this.docId="d"+PDFDocumentLoadingTask.#e++;this.destroyed=!1;this.onPassword=null;this.onProgress=null}get promise(){return this._capability.promise}async destroy(){var t;this.destroyed=!0;await(null===(t=this._transport)||void 0===t?void 0:t.destroy());this._transport=null;if(this._worker){this._worker.destroy();this._worker=null}}}exports.PDFDocumentLoadingTask=PDFDocumentLoadingTask;class PDFDataRangeTransport{constructor(t,e){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;this.length=t;this.initialData=e;this.progressiveDone=n;this.contentDispositionFilename=r;this._rangeListeners=[];this._progressListeners=[];this._progressiveReadListeners=[];this._progressiveDoneListeners=[];this._readyCapability=new _util.PromiseCapability}addRangeListener(t){this._rangeListeners.push(t)}addProgressListener(t){this._progressListeners.push(t)}addProgressiveReadListener(t){this._progressiveReadListeners.push(t)}addProgressiveDoneListener(t){this._progressiveDoneListeners.push(t)}onDataRange(t,e){for(const n of this._rangeListeners)n(t,e)}onDataProgress(t,e){this._readyCapability.promise.then((()=>{for(const n of this._progressListeners)n(t,e)}))}onDataProgressiveRead(t){this._readyCapability.promise.then((()=>{for(const e of this._progressiveReadListeners)e(t)}))}onDataProgressiveDone(){this._readyCapability.promise.then((()=>{for(const t of this._progressiveDoneListeners)t()}))}transportReady(){this._readyCapability.resolve()}requestDataRange(t,e){(0,_util.unreachable)("Abstract method PDFDataRangeTransport.requestDataRange")}abort(){}}exports.PDFDataRangeTransport=PDFDataRangeTransport;class PDFDocumentProxy{constructor(t,e){this._pdfInfo=t;this._transport=e}get annotationStorage(){return this._transport.annotationStorage}get filterFactory(){return this._transport.filterFactory}get numPages(){return this._pdfInfo.numPages}get fingerprints(){return this._pdfInfo.fingerprints}get isPureXfa(){return(0,_util.shadow)(this,"isPureXfa",!!this._transport._htmlForXfa)}get allXfaHtml(){return this._transport._htmlForXfa}getPage(t){return this._transport.getPage(t)}getPageIndex(t){return this._transport.getPageIndex(t)}getDestinations(){return this._transport.getDestinations()}getDestination(t){return this._transport.getDestination(t)}getPageLabels(){return this._transport.getPageLabels()}getPageLayout(){return this._transport.getPageLayout()}getPageMode(){return this._transport.getPageMode()}getViewerPreferences(){return this._transport.getViewerPreferences()}getOpenAction(){return this._transport.getOpenAction()}getAttachments(){return this._transport.getAttachments()}getJavaScript(){return this._transport.getJavaScript()}getJSActions(){return this._transport.getDocJSActions()}getOutline(){return this._transport.getOutline()}getOptionalContentConfig(){return this._transport.getOptionalContentConfig()}getPermissions(){return this._transport.getPermissions()}getMetadata(){return this._transport.getMetadata()}getMarkInfo(){return this._transport.getMarkInfo()}getData(){return this._transport.getData()}saveDocument(){return this._transport.saveDocument()}getDownloadInfo(){return this._transport.downloadInfoCapability.promise}cleanup(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this._transport.startCleanup(t||this.isPureXfa)}destroy(){return this.loadingTask.destroy()}get loadingParams(){return this._transport.loadingParams}get loadingTask(){return this._transport.loadingTask}getFieldObjects(){return this._transport.getFieldObjects()}hasJSActions(){return this._transport.hasJSActions()}getCalculationOrderIds(){return this._transport.getCalculationOrderIds()}}exports.PDFDocumentProxy=PDFDocumentProxy;class PDFPageProxy{#n=null;#r=!1;constructor(t,e,n){let r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];this._pageIndex=t;this._pageInfo=e;this._transport=n;this._stats=r?new _display_utils.StatTimer:null;this._pdfBug=r;this.commonObjs=n.commonObjs;this.objs=new PDFObjects;this._maybeCleanupAfterRender=!1;this._intentStates=new Map;this.destroyed=!1}get pageNumber(){return this._pageIndex+1}get rotate(){return this._pageInfo.rotate}get ref(){return this._pageInfo.ref}get userUnit(){return this._pageInfo.userUnit}get view(){return this._pageInfo.view}getViewport(){let{scale:t,rotation:e=this.rotate,offsetX:n=0,offsetY:r=0,dontFlip:i=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new _display_utils.PageViewport({viewBox:this.view,scale:t,rotation:e,offsetX:n,offsetY:r,dontFlip:i})}getAnnotations(){let{intent:t="display"}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const e=this._transport.getRenderingIntent(t);return this._transport.getAnnotations(this._pageIndex,e.renderingIntent)}getJSActions(){return this._transport.getPageJSActions(this._pageIndex)}get isPureXfa(){return(0,_util.shadow)(this,"isPureXfa",!!this._transport._htmlForXfa)}async getXfa(){var t;return(null===(t=this._transport._htmlForXfa)||void 0===t?void 0:t.children[this._pageIndex])||null}render(t){var e,n;let{canvasContext:r,viewport:i,intent:s="display",annotationMode:a=_util.AnnotationMode.ENABLE,transform:o=null,background:l=null,optionalContentConfigPromise:c=null,annotationCanvasMap:d=null,pageColors:h=null,printAnnotationStorage:u=null}=t;if(null!==(e=arguments[0])&&void 0!==e&&e.canvasFactory)throw new Error("render no longer accepts the `canvasFactory`-option, please pass it to the `getDocument`-function instead.");null===(n=this._stats)||void 0===n||n.time("Overall");const p=this._transport.getRenderingIntent(s,a,u);this.#r=!1;this.#i();c||(c=this._transport.getOptionalContentConfig());let f=this._intentStates.get(p.cacheKey);if(!f){f=Object.create(null);this._intentStates.set(p.cacheKey,f)}if(f.streamReaderCancelTimeout){clearTimeout(f.streamReaderCancelTimeout);f.streamReaderCancelTimeout=null}const g=!!(p.renderingIntent&_util.RenderingIntentFlag.PRINT);if(!f.displayReadyCapability){var m;f.displayReadyCapability=new _util.PromiseCapability;f.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null};null===(m=this._stats)||void 0===m||m.time("Page Request");this._pumpOperatorList(p)}const complete=t=>{var e,n;f.renderTasks.delete(v);(this._maybeCleanupAfterRender||g)&&(this.#r=!0);this.#s(!g);if(t){v.capability.reject(t);this._abortOperatorList({intentState:f,reason:t instanceof Error?t:new Error(t)})}else v.capability.resolve();null===(e=this._stats)||void 0===e||e.timeEnd("Rendering");null===(n=this._stats)||void 0===n||n.timeEnd("Overall")},v=new InternalRenderTask({callback:complete,params:{canvasContext:r,viewport:i,transform:o,background:l},objs:this.objs,commonObjs:this.commonObjs,annotationCanvasMap:d,operatorList:f.operatorList,pageIndex:this._pageIndex,canvasFactory:this._transport.canvasFactory,filterFactory:this._transport.filterFactory,useRequestAnimationFrame:!g,pdfBug:this._pdfBug,pageColors:h});(f.renderTasks||=new Set).add(v);const b=v.task;Promise.all([f.displayReadyCapability.promise,c]).then((t=>{var e;let[n,r]=t;if(this.#r)complete();else{null===(e=this._stats)||void 0===e||e.time("Rendering");v.initializeGraphics({transparency:n,optionalContentConfig:r});v.operatorListChanged()}})).catch(complete);return b}getOperatorList(){let{intent:t="display",annotationMode:e=_util.AnnotationMode.ENABLE,printAnnotationStorage:n=null}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const r=this._transport.getRenderingIntent(t,e,n,!0);let i,s=this._intentStates.get(r.cacheKey);if(!s){s=Object.create(null);this._intentStates.set(r.cacheKey,s)}if(!s.opListReadCapability){var a;i=Object.create(null);i.operatorListChanged=function operatorListChanged(){if(s.operatorList.lastChunk){s.opListReadCapability.resolve(s.operatorList);s.renderTasks.delete(i)}};s.opListReadCapability=new _util.PromiseCapability;(s.renderTasks||=new Set).add(i);s.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null};null===(a=this._stats)||void 0===a||a.time("Page Request");this._pumpOperatorList(r)}return s.opListReadCapability.promise}streamTextContent(){let{includeMarkedContent:t=!1,disableNormalization:e=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this._transport.messageHandler.sendWithStream("GetTextContent",{pageIndex:this._pageIndex,includeMarkedContent:!0===t,disableNormalization:!0===e},{highWaterMark:100,size:t=>t.items.length})}getTextContent(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this._transport._htmlForXfa)return this.getXfa().then((t=>_xfa_text.XfaText.textContent(t)));const e=this.streamTextContent(t);return new Promise((function(t,n){const r=e.getReader(),i={items:[],styles:Object.create(null)};!function pump(){r.read().then((function(e){let{value:n,done:r}=e;if(r)t(i);else{Object.assign(i.styles,n.styles);i.items.push(...n.items);pump()}}),n)}()}))}getStructTree(){return this._transport.getStructTree(this._pageIndex)}_destroy(){this.destroyed=!0;const t=[];for(const e of this._intentStates.values()){this._abortOperatorList({intentState:e,reason:new Error("Page was destroyed."),force:!0});if(!e.opListReadCapability)for(const n of e.renderTasks){t.push(n.completed);n.cancel()}}this.objs.clear();this.#r=!1;this.#i();return Promise.all(t)}cleanup(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.#r=!0;const e=this.#s(!1);t&&e&&(this._stats&&=new _display_utils.StatTimer);return e}#s(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.#i();if(!this.#r)return!1;if(t){this.#n=setTimeout((()=>{this.#n=null;this.#s(!1)}),DELAYED_CLEANUP_TIMEOUT);return!1}for(const{renderTasks:t,operatorList:e}of this._intentStates.values())if(t.size>0||!e.lastChunk)return!1;this._intentStates.clear();this.objs.clear();this.#r=!1;return!0}#i(){if(this.#n){clearTimeout(this.#n);this.#n=null}}_startRenderPage(t,e){var n,r;const i=this._intentStates.get(e);if(i){null===(n=this._stats)||void 0===n||n.timeEnd("Page Request");null===(r=i.displayReadyCapability)||void 0===r||r.resolve(t)}}_renderPageChunk(t,e){for(let n=0,r=t.length;n<r;n++){e.operatorList.fnArray.push(t.fnArray[n]);e.operatorList.argsArray.push(t.argsArray[n])}e.operatorList.lastChunk=t.lastChunk;e.operatorList.separateAnnots=t.separateAnnots;for(const t of e.renderTasks)t.operatorListChanged();t.lastChunk&&this.#s(!0)}_pumpOperatorList(t){let{renderingIntent:e,cacheKey:n,annotationStorageMap:r}=t;const i=this._transport.messageHandler.sendWithStream("GetOperatorList",{pageIndex:this._pageIndex,intent:e,cacheKey:n,annotationStorage:r}).getReader(),s=this._intentStates.get(n);s.streamReader=i;const pump=()=>{i.read().then((t=>{let{value:e,done:n}=t;if(n)s.streamReader=null;else if(!this._transport.destroyed){this._renderPageChunk(e,s);pump()}}),(t=>{s.streamReader=null;if(!this._transport.destroyed){if(s.operatorList){s.operatorList.lastChunk=!0;for(const t of s.renderTasks)t.operatorListChanged();this.#s(!0)}if(s.displayReadyCapability)s.displayReadyCapability.reject(t);else{if(!s.opListReadCapability)throw t;s.opListReadCapability.reject(t)}}}))};pump()}_abortOperatorList(t){let{intentState:e,reason:n,force:r=!1}=t;if(e.streamReader){if(e.streamReaderCancelTimeout){clearTimeout(e.streamReaderCancelTimeout);e.streamReaderCancelTimeout=null}if(!r){if(e.renderTasks.size>0)return;if(n instanceof _display_utils.RenderingCancelledException){let t=RENDERING_CANCELLED_TIMEOUT;n.extraDelay>0&&n.extraDelay<1e3&&(t+=n.extraDelay);e.streamReaderCancelTimeout=setTimeout((()=>{e.streamReaderCancelTimeout=null;this._abortOperatorList({intentState:e,reason:n,force:!0})}),t);return}}e.streamReader.cancel(new _util.AbortException(n.message)).catch((()=>{}));e.streamReader=null;if(!this._transport.destroyed){for(const[t,n]of this._intentStates)if(n===e){this._intentStates.delete(t);break}this.cleanup()}}}get stats(){return this._stats}}exports.PDFPageProxy=PDFPageProxy;class LoopbackPort{#a=new Set;#o=Promise.resolve();postMessage(t,e){const n={data:structuredClone(t,null)};this.#o.then((()=>{for(const t of this.#a)t.call(this,n)}))}addEventListener(t,e){this.#a.add(e)}removeEventListener(t,e){this.#a.delete(e)}terminate(){this.#a.clear()}}exports.LoopbackPort=LoopbackPort;const PDFWorkerUtil={isWorkerDisabled:!1,fallbackWorkerSrc:null,fakeWorkerId:0};exports.PDFWorkerUtil=PDFWorkerUtil;if(_is_node.isNodeJS&&"function"==typeof require){PDFWorkerUtil.isWorkerDisabled=!0;PDFWorkerUtil.fallbackWorkerSrc="./pdf.worker.js"}else if("object"==typeof document){var _document,_document$currentScri;const t=null===(_document=document)||void 0===_document||null===(_document$currentScri=_document.currentScript)||void 0===_document$currentScri?void 0:_document$currentScri.src;t&&(PDFWorkerUtil.fallbackWorkerSrc=t.replace(/(\.(?:min\.)?js)(\?.*)?$/i,".worker$1$2"))}PDFWorkerUtil.isSameOrigin=function(t,e){let n;try{n=new URL(t);if(!n.origin||"null"===n.origin)return!1}catch(t){return!1}const r=new URL(e,n);return n.origin===r.origin};PDFWorkerUtil.createCDNWrapper=function(t){const e=`importScripts("${t}");`;return URL.createObjectURL(new Blob([e]))};class PDFWorker{static#l=new WeakMap;constructor(){let{name:t=null,port:e=null,verbosity:n=(0,_util.getVerbosityLevel)()}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(e&&PDFWorker.#l.has(e))throw new Error("Cannot use more than one PDFWorker per port.");this.name=t;this.destroyed=!1;this.verbosity=n;this._readyCapability=new _util.PromiseCapability;this._port=null;this._webWorker=null;this._messageHandler=null;if(e){PDFWorker.#l.set(e,this);this._initializeFromPort(e)}else this._initialize()}get promise(){return this._readyCapability.promise}get port(){return this._port}get messageHandler(){return this._messageHandler}_initializeFromPort(t){this._port=t;this._messageHandler=new _message_handler.MessageHandler("main","worker",t);this._messageHandler.on("ready",(function(){}));this._readyCapability.resolve();this._messageHandler.send("configure",{verbosity:this.verbosity})}_initialize(){if(!PDFWorkerUtil.isWorkerDisabled&&!PDFWorker._mainThreadWorkerMessageHandler){let{workerSrc:t}=PDFWorker;try{PDFWorkerUtil.isSameOrigin(window.location.href,t)||(t=PDFWorkerUtil.createCDNWrapper(new URL(t,window.location).href));const e=new Worker(t),n=new _message_handler.MessageHandler("main","worker",e),terminateEarly=()=>{e.removeEventListener("error",onWorkerError);n.destroy();e.terminate();this.destroyed?this._readyCapability.reject(new Error("Worker was destroyed")):this._setupFakeWorker()},onWorkerError=()=>{this._webWorker||terminateEarly()};e.addEventListener("error",onWorkerError);n.on("test",(t=>{e.removeEventListener("error",onWorkerError);if(this.destroyed)terminateEarly();else if(t){this._messageHandler=n;this._port=e;this._webWorker=e;this._readyCapability.resolve();n.send("configure",{verbosity:this.verbosity})}else{this._setupFakeWorker();n.destroy();e.terminate()}}));n.on("ready",(t=>{e.removeEventListener("error",onWorkerError);if(this.destroyed)terminateEarly();else try{sendTest()}catch(t){this._setupFakeWorker()}}));const sendTest=()=>{const t=new Uint8Array;n.send("test",t,[t.buffer])};sendTest();return}catch(t){(0,_util.info)("The worker has been disabled.")}}this._setupFakeWorker()}_setupFakeWorker(){if(!PDFWorkerUtil.isWorkerDisabled){(0,_util.warn)("Setting up fake worker.");PDFWorkerUtil.isWorkerDisabled=!0}PDFWorker._setupFakeWorkerGlobal.then((t=>{if(this.destroyed){this._readyCapability.reject(new Error("Worker was destroyed"));return}const e=new LoopbackPort;this._port=e;const n="fake"+PDFWorkerUtil.fakeWorkerId++,r=new _message_handler.MessageHandler(n+"_worker",n,e);t.setup(r,e);const i=new _message_handler.MessageHandler(n,n+"_worker",e);this._messageHandler=i;this._readyCapability.resolve();i.send("configure",{verbosity:this.verbosity})})).catch((t=>{this._readyCapability.reject(new Error(`Setting up fake worker failed: "${t.message}".`))}))}destroy(){this.destroyed=!0;if(this._webWorker){this._webWorker.terminate();this._webWorker=null}PDFWorker.#l.delete(this._port);this._port=null;if(this._messageHandler){this._messageHandler.destroy();this._messageHandler=null}}static fromPort(t){if(null==t||!t.port)throw new Error("PDFWorker.fromPort - invalid method signature.");return this.#l.has(t.port)?this.#l.get(t.port):new PDFWorker(t)}static get workerSrc(){if(_worker_options.GlobalWorkerOptions.workerSrc)return _worker_options.GlobalWorkerOptions.workerSrc;if(null!==PDFWorkerUtil.fallbackWorkerSrc){_is_node.isNodeJS||(0,_display_utils.deprecated)('No "GlobalWorkerOptions.workerSrc" specified.');return PDFWorkerUtil.fallbackWorkerSrc}throw new Error('No "GlobalWorkerOptions.workerSrc" specified.')}static get _mainThreadWorkerMessageHandler(){try{var t;return(null===(t=globalThis.pdfjsWorker)||void 0===t?void 0:t.WorkerMessageHandler)||null}catch(t){return null}}static get _setupFakeWorkerGlobal(){const loader=async()=>{const mainWorkerMessageHandler=this._mainThreadWorkerMessageHandler;if(mainWorkerMessageHandler)return mainWorkerMessageHandler;if(_is_node.isNodeJS&&"function"==typeof require){const worker=eval("require")(this.workerSrc);return worker.WorkerMessageHandler}await(0,_display_utils.loadScript)(this.workerSrc);return window.pdfjsWorker.WorkerMessageHandler};return(0,_util.shadow)(this,"_setupFakeWorkerGlobal",loader())}}exports.PDFWorker=PDFWorker;class WorkerTransport{#c=new Map;#d=new Map;#h=new Map;constructor(t,e,n,r,i){this.messageHandler=t;this.loadingTask=e;this.commonObjs=new PDFObjects;this.fontLoader=new _font_loader.FontLoader({ownerDocument:r.ownerDocument,styleElement:r.styleElement});this._params=r;this.canvasFactory=i.canvasFactory;this.filterFactory=i.filterFactory;this.cMapReaderFactory=i.cMapReaderFactory;this.standardFontDataFactory=i.standardFontDataFactory;this.destroyed=!1;this.destroyCapability=null;this._passwordCapability=null;this._networkStream=n;this._fullReader=null;this._lastProgress=null;this.downloadInfoCapability=new _util.PromiseCapability;this.setupMessageHandler()}#u(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;const n=this.#c.get(t);if(n)return n;const r=this.messageHandler.sendWithPromise(t,e);this.#c.set(t,r);return r}get annotationStorage(){return(0,_util.shadow)(this,"annotationStorage",new _annotation_storage.AnnotationStorage)}getRenderingIntent(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:_util.AnnotationMode.ENABLE,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=arguments.length>3&&void 0!==arguments[3]&&arguments[3],i=_util.RenderingIntentFlag.DISPLAY,s=null;switch(t){case"any":i=_util.RenderingIntentFlag.ANY;break;case"display":break;case"print":i=_util.RenderingIntentFlag.PRINT;break;default:(0,_util.warn)(`getRenderingIntent - invalid intent: ${t}`)}switch(e){case _util.AnnotationMode.DISABLE:i+=_util.RenderingIntentFlag.ANNOTATIONS_DISABLE;break;case _util.AnnotationMode.ENABLE:break;case _util.AnnotationMode.ENABLE_FORMS:i+=_util.RenderingIntentFlag.ANNOTATIONS_FORMS;break;case _util.AnnotationMode.ENABLE_STORAGE:i+=_util.RenderingIntentFlag.ANNOTATIONS_STORAGE;s=(i&_util.RenderingIntentFlag.PRINT&&n instanceof _annotation_storage.PrintAnnotationStorage?n:this.annotationStorage).serializable;break;default:(0,_util.warn)(`getRenderingIntent - invalid annotationMode: ${e}`)}r&&(i+=_util.RenderingIntentFlag.OPLIST);return{renderingIntent:i,cacheKey:`${i}_${_annotation_storage.AnnotationStorage.getHash(s)}`,annotationStorageMap:s}}destroy(){if(this.destroyCapability)return this.destroyCapability.promise;this.destroyed=!0;this.destroyCapability=new _util.PromiseCapability;this._passwordCapability&&this._passwordCapability.reject(new Error("Worker was destroyed during onPassword callback"));const t=[];for(const e of this.#d.values())t.push(e._destroy());this.#d.clear();this.#h.clear();this.hasOwnProperty("annotationStorage")&&this.annotationStorage.resetModified();const e=this.messageHandler.sendWithPromise("Terminate",null);t.push(e);Promise.all(t).then((()=>{this.commonObjs.clear();this.fontLoader.clear();this.#c.clear();this.filterFactory.destroy();this._networkStream&&this._networkStream.cancelAllRequests(new _util.AbortException("Worker was terminated."));if(this.messageHandler){this.messageHandler.destroy();this.messageHandler=null}this.destroyCapability.resolve()}),this.destroyCapability.reject);return this.destroyCapability.promise}setupMessageHandler(){const{messageHandler:t,loadingTask:e}=this;t.on("GetReader",((t,e)=>{(0,_util.assert)(this._networkStream,"GetReader - no `IPDFStream` instance available.");this._fullReader=this._networkStream.getFullReader();this._fullReader.onProgress=t=>{this._lastProgress={loaded:t.loaded,total:t.total}};e.onPull=()=>{this._fullReader.read().then((function(t){let{value:n,done:r}=t;if(r)e.close();else{(0,_util.assert)(n instanceof ArrayBuffer,"GetReader - expected an ArrayBuffer.");e.enqueue(new Uint8Array(n),1,[n])}})).catch((t=>{e.error(t)}))};e.onCancel=t=>{this._fullReader.cancel(t);e.ready.catch((t=>{if(!this.destroyed)throw t}))}}));t.on("ReaderHeadersReady",(t=>{const n=new _util.PromiseCapability,r=this._fullReader;r.headersReady.then((()=>{if(!r.isStreamingSupported||!r.isRangeSupported){if(this._lastProgress){var t;null===(t=e.onProgress)||void 0===t||t.call(e,this._lastProgress)}r.onProgress=t=>{var n;null===(n=e.onProgress)||void 0===n||n.call(e,{loaded:t.loaded,total:t.total})}}n.resolve({isStreamingSupported:r.isStreamingSupported,isRangeSupported:r.isRangeSupported,contentLength:r.contentLength})}),n.reject);return n.promise}));t.on("GetRangeReader",((t,e)=>{(0,_util.assert)(this._networkStream,"GetRangeReader - no `IPDFStream` instance available.");const n=this._networkStream.getRangeReader(t.begin,t.end);if(n){e.onPull=()=>{n.read().then((function(t){let{value:n,done:r}=t;if(r)e.close();else{(0,_util.assert)(n instanceof ArrayBuffer,"GetRangeReader - expected an ArrayBuffer.");e.enqueue(new Uint8Array(n),1,[n])}})).catch((t=>{e.error(t)}))};e.onCancel=t=>{n.cancel(t);e.ready.catch((t=>{if(!this.destroyed)throw t}))}}else e.close()}));t.on("GetDoc",(t=>{let{pdfInfo:n}=t;this._numPages=n.numPages;this._htmlForXfa=n.htmlForXfa;delete n.htmlForXfa;e._capability.resolve(new PDFDocumentProxy(n,this))}));t.on("DocException",(function(t){let n;switch(t.name){case"PasswordException":n=new _util.PasswordException(t.message,t.code);break;case"InvalidPDFException":n=new _util.InvalidPDFException(t.message);break;case"MissingPDFException":n=new _util.MissingPDFException(t.message);break;case"UnexpectedResponseException":n=new _util.UnexpectedResponseException(t.message,t.status);break;case"UnknownErrorException":n=new _util.UnknownErrorException(t.message,t.details);break;default:(0,_util.unreachable)("DocException - expected a valid Error.")}e._capability.reject(n)}));t.on("PasswordRequest",(t=>{this._passwordCapability=new _util.PromiseCapability;if(e.onPassword){const updatePassword=t=>{t instanceof Error?this._passwordCapability.reject(t):this._passwordCapability.resolve({password:t})};try{e.onPassword(updatePassword,t.code)}catch(t){this._passwordCapability.reject(t)}}else this._passwordCapability.reject(new _util.PasswordException(t.message,t.code));return this._passwordCapability.promise}));t.on("DataLoaded",(t=>{var n;null===(n=e.onProgress)||void 0===n||n.call(e,{loaded:t.length,total:t.length});this.downloadInfoCapability.resolve(t)}));t.on("StartRenderPage",(t=>{if(this.destroyed)return;this.#d.get(t.pageIndex)._startRenderPage(t.transparency,t.cacheKey)}));t.on("commonobj",(e=>{var n;let[r,i,s]=e;if(!this.destroyed&&!this.commonObjs.has(r))switch(i){case"Font":const e=this._params;if("error"in s){const t=s.error;(0,_util.warn)(`Error during font loading: ${t}`);this.commonObjs.resolve(r,t);break}const a=e.pdfBug&&null!==(n=globalThis.FontInspector)&&void 0!==n&&n.enabled?(t,e)=>globalThis.FontInspector.fontAdded(t,e):null,o=new _font_loader.FontFaceObject(s,{isEvalSupported:e.isEvalSupported,disableFontFace:e.disableFontFace,ignoreErrors:e.ignoreErrors,inspectFont:a});this.fontLoader.bind(o).catch((e=>t.sendWithPromise("FontFallback",{id:r}))).finally((()=>{!e.fontExtraProperties&&o.data&&(o.data=null);this.commonObjs.resolve(r,o)}));break;case"FontPath":case"Image":case"Pattern":this.commonObjs.resolve(r,s);break;default:throw new Error(`Got unknown common object type ${i}`)}}));t.on("obj",(t=>{let[e,n,r,i]=t;if(this.destroyed)return;const s=this.#d.get(n);if(!s.objs.has(e))switch(r){case"Image":s.objs.resolve(e,i);if(i){let t;if(i.bitmap){const{width:e,height:n}=i;t=e*n*4}else{var a;t=(null===(a=i.data)||void 0===a?void 0:a.length)||0}t>_util.MAX_IMAGE_SIZE_TO_CACHE&&(s._maybeCleanupAfterRender=!0)}break;case"Pattern":s.objs.resolve(e,i);break;default:throw new Error(`Got unknown object type ${r}`)}}));t.on("DocProgress",(t=>{var n;this.destroyed||null===(n=e.onProgress)||void 0===n||n.call(e,{loaded:t.loaded,total:t.total})}));t.on("FetchBuiltInCMap",(t=>this.destroyed?Promise.reject(new Error("Worker was destroyed.")):this.cMapReaderFactory?this.cMapReaderFactory.fetch(t):Promise.reject(new Error("CMapReaderFactory not initialized, see the `useWorkerFetch` parameter."))));t.on("FetchStandardFontData",(t=>this.destroyed?Promise.reject(new Error("Worker was destroyed.")):this.standardFontDataFactory?this.standardFontDataFactory.fetch(t):Promise.reject(new Error("StandardFontDataFactory not initialized, see the `useWorkerFetch` parameter."))))}getData(){return this.messageHandler.sendWithPromise("GetData",null)}saveDocument(){var t;this.annotationStorage.size<=0&&(0,_util.warn)("saveDocument called while `annotationStorage` is empty, please use the getData-method instead.");return this.messageHandler.sendWithPromise("SaveDocument",{isPureXfa:!!this._htmlForXfa,numPages:this._numPages,annotationStorage:this.annotationStorage.serializable,filename:(null===(t=this._fullReader)||void 0===t?void 0:t.filename)??null}).finally((()=>{this.annotationStorage.resetModified()}))}getPage(t){if(!Number.isInteger(t)||t<=0||t>this._numPages)return Promise.reject(new Error("Invalid page request."));const e=t-1,n=this.#h.get(e);if(n)return n;const r=this.messageHandler.sendWithPromise("GetPage",{pageIndex:e}).then((t=>{if(this.destroyed)throw new Error("Transport destroyed");const n=new PDFPageProxy(e,t,this,this._params.pdfBug);this.#d.set(e,n);return n}));this.#h.set(e,r);return r}getPageIndex(t){return"object"!=typeof t||null===t||!Number.isInteger(t.num)||t.num<0||!Number.isInteger(t.gen)||t.gen<0?Promise.reject(new Error("Invalid pageIndex request.")):this.messageHandler.sendWithPromise("GetPageIndex",{num:t.num,gen:t.gen})}getAnnotations(t,e){return this.messageHandler.sendWithPromise("GetAnnotations",{pageIndex:t,intent:e})}getFieldObjects(){return this.#u("GetFieldObjects")}hasJSActions(){return this.#u("HasJSActions")}getCalculationOrderIds(){return this.messageHandler.sendWithPromise("GetCalculationOrderIds",null)}getDestinations(){return this.messageHandler.sendWithPromise("GetDestinations",null)}getDestination(t){return"string"!=typeof t?Promise.reject(new Error("Invalid destination request.")):this.messageHandler.sendWithPromise("GetDestination",{id:t})}getPageLabels(){return this.messageHandler.sendWithPromise("GetPageLabels",null)}getPageLayout(){return this.messageHandler.sendWithPromise("GetPageLayout",null)}getPageMode(){return this.messageHandler.sendWithPromise("GetPageMode",null)}getViewerPreferences(){return this.messageHandler.sendWithPromise("GetViewerPreferences",null)}getOpenAction(){return this.messageHandler.sendWithPromise("GetOpenAction",null)}getAttachments(){return this.messageHandler.sendWithPromise("GetAttachments",null)}getJavaScript(){return this.messageHandler.sendWithPromise("GetJavaScript",null)}getDocJSActions(){return this.messageHandler.sendWithPromise("GetDocJSActions",null)}getPageJSActions(t){return this.messageHandler.sendWithPromise("GetPageJSActions",{pageIndex:t})}getStructTree(t){return this.messageHandler.sendWithPromise("GetStructTree",{pageIndex:t})}getOutline(){return this.messageHandler.sendWithPromise("GetOutline",null)}getOptionalContentConfig(){return this.messageHandler.sendWithPromise("GetOptionalContentConfig",null).then((t=>new _optional_content_config.OptionalContentConfig(t)))}getPermissions(){return this.messageHandler.sendWithPromise("GetPermissions",null)}getMetadata(){const t="GetMetadata",e=this.#c.get(t);if(e)return e;const n=this.messageHandler.sendWithPromise(t,null).then((t=>{var e,n;return{info:t[0],metadata:t[1]?new _metadata.Metadata(t[1]):null,contentDispositionFilename:(null===(e=this._fullReader)||void 0===e?void 0:e.filename)??null,contentLength:(null===(n=this._fullReader)||void 0===n?void 0:n.contentLength)??null}}));this.#c.set(t,n);return n}getMarkInfo(){return this.messageHandler.sendWithPromise("GetMarkInfo",null)}async startCleanup(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!this.destroyed){await this.messageHandler.sendWithPromise("Cleanup",null);for(const t of this.#d.values()){if(!t.cleanup())throw new Error(`startCleanup: Page ${t.pageNumber} is currently rendering.`)}this.commonObjs.clear();t||this.fontLoader.clear();this.#c.clear();this.filterFactory.destroy(!0)}}get loadingParams(){const{disableAutoFetch:t,enableXfa:e}=this._params;return(0,_util.shadow)(this,"loadingParams",{disableAutoFetch:t,enableXfa:e})}}class PDFObjects{#p=Object.create(null);#f(t){const e=this.#p[t];return e||(this.#p[t]={capability:new _util.PromiseCapability,data:null})}get(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(e){const n=this.#f(t);n.capability.promise.then((()=>e(n.data)));return null}const n=this.#p[t];if(null==n||!n.capability.settled)throw new Error(`Requesting object that isn't resolved yet ${t}.`);return n.data}has(t){const e=this.#p[t];return(null==e?void 0:e.capability.settled)||!1}resolve(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;const n=this.#f(t);n.data=e;n.capability.resolve()}clear(){for(const e in this.#p){var t;const{data:n}=this.#p[e];null==n||null===(t=n.bitmap)||void 0===t||t.close()}this.#p=Object.create(null)}}class RenderTask{#g=null;constructor(t){this.#g=t;this.onContinue=null}get promise(){return this.#g.capability.promise}cancel(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;this.#g.cancel(null,t)}get separateAnnots(){const{separateAnnots:t}=this.#g.operatorList;if(!t)return!1;const{annotationCanvasMap:e}=this.#g;return t.form||t.canvas&&(null==e?void 0:e.size)>0}}exports.RenderTask=RenderTask;class InternalRenderTask{static#m=new WeakSet;constructor(t){let{callback:e,params:n,objs:r,commonObjs:i,annotationCanvasMap:s,operatorList:a,pageIndex:o,canvasFactory:l,filterFactory:c,useRequestAnimationFrame:d=!1,pdfBug:h=!1,pageColors:u=null}=t;this.callback=e;this.params=n;this.objs=r;this.commonObjs=i;this.annotationCanvasMap=s;this.operatorListIdx=null;this.operatorList=a;this._pageIndex=o;this.canvasFactory=l;this.filterFactory=c;this._pdfBug=h;this.pageColors=u;this.running=!1;this.graphicsReadyCallback=null;this.graphicsReady=!1;this._useRequestAnimationFrame=!0===d&&"undefined"!=typeof window;this.cancelled=!1;this.capability=new _util.PromiseCapability;this.task=new RenderTask(this);this._cancelBound=this.cancel.bind(this);this._continueBound=this._continue.bind(this);this._scheduleNextBound=this._scheduleNext.bind(this);this._nextBound=this._next.bind(this);this._canvas=n.canvasContext.canvas}get completed(){return this.capability.promise.catch((function(){}))}initializeGraphics(t){var e,n;let{transparency:r=!1,optionalContentConfig:i}=t;if(this.cancelled)return;if(this._canvas){if(InternalRenderTask.#m.has(this._canvas))throw new Error("Cannot use the same canvas during multiple render() operations. Use different canvas or ensure previous operations were cancelled or completed.");InternalRenderTask.#m.add(this._canvas)}if(this._pdfBug&&null!==(e=globalThis.StepperManager)&&void 0!==e&&e.enabled){this.stepper=globalThis.StepperManager.create(this._pageIndex);this.stepper.init(this.operatorList);this.stepper.nextBreakPoint=this.stepper.getNextBreakPoint()}const{canvasContext:s,viewport:a,transform:o,background:l}=this.params;this.gfx=new _canvas.CanvasGraphics(s,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:i},this.annotationCanvasMap,this.pageColors);this.gfx.beginDrawing({transform:o,viewport:a,transparency:r,background:l});this.operatorListIdx=0;this.graphicsReady=!0;null===(n=this.graphicsReadyCallback)||void 0===n||n.call(this)}cancel(){var t;let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;this.running=!1;this.cancelled=!0;null===(t=this.gfx)||void 0===t||t.endDrawing();this._canvas&&InternalRenderTask.#m.delete(this._canvas);this.callback(e||new _display_utils.RenderingCancelledException(`Rendering cancelled, page ${this._pageIndex+1}`,"canvas",n))}operatorListChanged(){var t;if(this.graphicsReady){null===(t=this.stepper)||void 0===t||t.updateOperatorList(this.operatorList);this.running||this._continue()}else this.graphicsReadyCallback||=this._continueBound}_continue(){this.running=!0;this.cancelled||(this.task.onContinue?this.task.onContinue(this._scheduleNextBound):this._scheduleNext())}_scheduleNext(){this._useRequestAnimationFrame?window.requestAnimationFrame((()=>{this._nextBound().catch(this._cancelBound)})):Promise.resolve().then(this._nextBound).catch(this._cancelBound)}async _next(){if(!this.cancelled){this.operatorListIdx=this.gfx.executeOperatorList(this.operatorList,this.operatorListIdx,this._continueBound,this.stepper);if(this.operatorListIdx===this.operatorList.argsArray.length){this.running=!1;if(this.operatorList.lastChunk){this.gfx.endDrawing(this.pageColors);this._canvas&&InternalRenderTask.#m.delete(this._canvas);this.callback()}}}}}const version="3.7.107";exports.version=version;const build="036f855dc";exports.build=build},(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.PrintAnnotationStorage=e.AnnotationStorage=void 0;var r=n(1),i=n(140),s=n(144);class AnnotationStorage{#v=!1;#b=new Map;constructor(){this.onSetModified=null;this.onResetModified=null;this.onAnnotationEditor=null}getValue(t,e){const n=this.#b.get(t);return void 0===n?e:Object.assign(e,n)}getRawValue(t){return this.#b.get(t)}remove(t){this.#b.delete(t);0===this.#b.size&&this.resetModified();if("function"==typeof this.onAnnotationEditor){for(const t of this.#b.values())if(t instanceof i.AnnotationEditor)return;this.onAnnotationEditor(null)}}setValue(t,e){const n=this.#b.get(t);let r=!1;if(void 0!==n){for(const[t,i]of Object.entries(e))if(n[t]!==i){r=!0;n[t]=i}}else{r=!0;this.#b.set(t,e)}r&&this.#y();e instanceof i.AnnotationEditor&&"function"==typeof this.onAnnotationEditor&&this.onAnnotationEditor(e.constructor._type)}has(t){return this.#b.has(t)}getAll(){return this.#b.size>0?(0,r.objectFromMap)(this.#b):null}setAll(t){for(const[e,n]of Object.entries(t))this.setValue(e,n)}get size(){return this.#b.size}#y(){if(!this.#v){this.#v=!0;"function"==typeof this.onSetModified&&this.onSetModified()}}resetModified(){if(this.#v){this.#v=!1;"function"==typeof this.onResetModified&&this.onResetModified()}}get print(){return new PrintAnnotationStorage(this)}get serializable(){if(0===this.#b.size)return null;const t=new Map;for(const[e,n]of this.#b){const r=n instanceof i.AnnotationEditor?n.serialize():n;r&&t.set(e,r)}return t}static getHash(t){if(!t)return"";const e=new s.MurmurHash3_64;for(const[n,r]of t)e.update(`${n}:${JSON.stringify(r)}`);return e.hexdigest()}}e.AnnotationStorage=AnnotationStorage;class PrintAnnotationStorage extends AnnotationStorage{#A=null;constructor(t){super();this.#A=structuredClone(t.serializable)}get print(){(0,r.unreachable)("Should not call PrintAnnotationStorage.print")}get serializable(){return this.#A}}e.PrintAnnotationStorage=PrintAnnotationStorage},(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.AnnotationEditor=void 0;var r=n(141),i=n(1);class AnnotationEditor{#_=this.focusin.bind(this);#S=this.focusout.bind(this);#x=!1;#E=!1;#C=!1;_uiManager=null;#w=AnnotationEditor._zIndex++;static _colorManager=new r.ColorManager;static _zIndex=1;constructor(t){this.constructor===AnnotationEditor&&(0,i.unreachable)("Cannot initialize AnnotationEditor.");this.parent=t.parent;this.id=t.id;this.width=this.height=null;this.pageIndex=t.parent.pageIndex;this.name=t.name;this.div=null;this._uiManager=t.uiManager;const{rotation:e,rawDims:{pageWidth:n,pageHeight:r,pageX:s,pageY:a}}=this.parent.viewport;this.rotation=e;this.pageRotation=(360+e-this._uiManager.viewParameters.rotation)%360;this.pageDimensions=[n,r];this.pageTranslation=[s,a];const[o,l]=this.parentDimensions;this.x=t.x/o;this.y=t.y/l;this.isAttachedToDOM=!1}static get _defaultLineColor(){return(0,i.shadow)(this,"_defaultLineColor",this._colorManager.getHexCode("CanvasText"))}addCommands(t){this._uiManager.addCommands(t)}get currentLayer(){return this._uiManager.currentLayer}setInBackground(){this.div.style.zIndex=0}setInForeground(){this.div.style.zIndex=this.#w}setParent(t){if(null!==t){this.pageIndex=t.pageIndex;this.pageDimensions=t.pageDimensions}this.parent=t}focusin(t){this.#x?this.#x=!1:this.parent.setSelected(this)}focusout(t){var e;if(!this.isAttachedToDOM)return;const n=t.relatedTarget;if(null==n||!n.closest(`#${this.id}`)){t.preventDefault();null!==(e=this.parent)&&void 0!==e&&e.isMultipleSelection||this.commitOrRemove()}}commitOrRemove(){this.isEmpty()?this.remove():this.commit()}commit(){this.addToAnnotationStorage()}addToAnnotationStorage(){this._uiManager.addToAnnotationStorage(this)}dragstart(t){const e=this.parent.div.getBoundingClientRect();this.startX=t.clientX-e.x;this.startY=t.clientY-e.y;t.dataTransfer.setData("text/plain",this.id);t.dataTransfer.effectAllowed="move"}setAt(t,e,n,r){const[i,s]=this.parentDimensions;[n,r]=this.screenToPageTranslation(n,r);this.x=(t+n)/i;this.y=(e+r)/s;this.div.style.left=100*this.x+"%";this.div.style.top=100*this.y+"%"}translate(t,e){const[n,r]=this.parentDimensions;[t,e]=this.screenToPageTranslation(t,e);this.x+=t/n;this.y+=e/r;this.div.style.left=100*this.x+"%";this.div.style.top=100*this.y+"%"}screenToPageTranslation(t,e){switch(this.parentRotation){case 90:return[e,-t];case 180:return[-t,-e];case 270:return[-e,t];default:return[t,e]}}get parentScale(){return this._uiManager.viewParameters.realScale}get parentRotation(){return(this._uiManager.viewParameters.rotation+this.pageRotation)%360}get parentDimensions(){const{realScale:t}=this._uiManager.viewParameters,[e,n]=this.pageDimensions;return[e*t,n*t]}setDims(t,e){const[n,r]=this.parentDimensions;this.div.style.width=100*t/n+"%";this.div.style.height=100*e/r+"%"}fixDims(){const{style:t}=this.div,{height:e,width:n}=t,r=n.endsWith("%"),i=e.endsWith("%");if(r&&i)return;const[s,a]=this.parentDimensions;r||(t.width=100*parseFloat(n)/s+"%");i||(t.height=100*parseFloat(e)/a+"%")}getInitialTranslation(){return[0,0]}render(){this.div=document.createElement("div");this.div.setAttribute("data-editor-rotation",(360-this.rotation)%360);this.div.className=this.name;this.div.setAttribute("id",this.id);this.div.setAttribute("tabIndex",0);this.setInForeground();this.div.addEventListener("focusin",this.#_);this.div.addEventListener("focusout",this.#S);const[t,e]=this.getInitialTranslation();this.translate(t,e);(0,r.bindEvents)(this,this.div,["dragstart","pointerdown"]);return this.div}pointerdown(t){const{isMac:e}=i.FeatureTest.platform;if(0!==t.button||t.ctrlKey&&e)t.preventDefault();else{t.ctrlKey&&!e||t.shiftKey||t.metaKey&&e?this.parent.toggleSelected(this):this.parent.setSelected(this);this.#x=!0}}getRect(t,e){const n=this.parentScale,[r,i]=this.pageDimensions,[s,a]=this.pageTranslation,o=t/n,l=e/n,c=this.x*r,d=this.y*i,h=this.width*r,u=this.height*i;switch(this.rotation){case 0:return[c+o+s,i-d-l-u+a,c+o+h+s,i-d-l+a];case 90:return[c+l+s,i-d+o+a,c+l+u+s,i-d+o+h+a];case 180:return[c-o-h+s,i-d+l+a,c-o+s,i-d+l+u+a];case 270:return[c-l-u+s,i-d-o-h+a,c-l+s,i-d-o+a];default:throw new Error("Invalid rotation")}}getRectInCurrentCoords(t,e){const[n,r,i,s]=t,a=i-n,o=s-r;switch(this.rotation){case 0:return[n,e-s,a,o];case 90:return[n,e-r,o,a];case 180:return[i,e-r,a,o];case 270:return[i,e-s,o,a];default:throw new Error("Invalid rotation")}}onceAdded(){}isEmpty(){return!1}enableEditMode(){this.#C=!0}disableEditMode(){this.#C=!1}isInEditMode(){return this.#C}shouldGetKeyboardEvents(){return!1}needsToBeRebuilt(){return this.div&&!this.isAttachedToDOM}rebuild(){var t;null===(t=this.div)||void 0===t||t.addEventListener("focusin",this.#_)}serialize(){(0,i.unreachable)("An editor must be serializable")}static deserialize(t,e,n){const r=new this.prototype.constructor({parent:e,id:e.getNextId(),uiManager:n});r.rotation=t.rotation;const[i,s]=r.pageDimensions,[a,o,l,c]=r.getRectInCurrentCoords(t.rect,s);r.x=a/i;r.y=o/s;r.width=l/i;r.height=c/s;return r}remove(){this.div.removeEventListener("focusin",this.#_);this.div.removeEventListener("focusout",this.#S);this.isEmpty()||this.commit();this.parent.remove(this)}select(){var t;null===(t=this.div)||void 0===t||t.classList.add("selectedEditor")}unselect(){var t;null===(t=this.div)||void 0===t||t.classList.remove("selectedEditor")}updateParams(t,e){}disableEditing(){}enableEditing(){}get propertiesToUpdate(){return{}}get contentDiv(){return this.div}get isEditing(){return this.#E}set isEditing(t){this.#E=t;if(t){this.parent.setSelected(this);this.parent.setActiveEditor(this)}else this.parent.setActiveEditor(null)}}e.AnnotationEditor=AnnotationEditor},(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.KeyboardManager=e.CommandManager=e.ColorManager=e.AnnotationEditorUIManager=void 0;e.bindEvents=function bindEvents(t,e,n){for(const r of n)e.addEventListener(r,t[r].bind(t))};e.opacityToHex=function opacityToHex(t){return Math.round(Math.min(255,Math.max(1,255*t))).toString(16).padStart(2,"0")};var r=n(1),i=n(142);class IdManager{#P=0;getId(){return`${r.AnnotationEditorPrefix}${this.#P++}`}}class CommandManager{#T=[];#k=!1;#F;#M=-1;constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:128;this.#F=t}add(t){let{cmd:e,undo:n,mustExec:r,type:i=NaN,overwriteIfSameType:s=!1,keepUndo:a=!1}=t;r&&e();if(this.#k)return;const o={cmd:e,undo:n,type:i};if(-1===this.#M){this.#T.length>0&&(this.#T.length=0);this.#M=0;this.#T.push(o);return}if(s&&this.#T[this.#M].type===i){a&&(o.undo=this.#T[this.#M].undo);this.#T[this.#M]=o;return}const l=this.#M+1;if(l===this.#F)this.#T.splice(0,1);else{this.#M=l;l<this.#T.length&&this.#T.splice(l)}this.#T.push(o)}undo(){if(-1!==this.#M){this.#k=!0;this.#T[this.#M].undo();this.#k=!1;this.#M-=1}}redo(){if(this.#M<this.#T.length-1){this.#M+=1;this.#k=!0;this.#T[this.#M].cmd();this.#k=!1}}hasSomethingToUndo(){return-1!==this.#M}hasSomethingToRedo(){return this.#M<this.#T.length-1}destroy(){this.#T=null}}e.CommandManager=CommandManager;class KeyboardManager{constructor(t){this.buffer=[];this.callbacks=new Map;this.allKeys=new Set;const{isMac:e}=r.FeatureTest.platform;for(const[n,r]of t)for(const t of n){const n=t.startsWith("mac+");if(e&&n){this.callbacks.set(t.slice(4),r);this.allKeys.add(t.split("+").at(-1))}else if(!e&&!n){this.callbacks.set(t,r);this.allKeys.add(t.split("+").at(-1))}}}#R(t){t.altKey&&this.buffer.push("alt");t.ctrlKey&&this.buffer.push("ctrl");t.metaKey&&this.buffer.push("meta");t.shiftKey&&this.buffer.push("shift");this.buffer.push(t.key);const e=this.buffer.join("+");this.buffer.length=0;return e}exec(t,e){if(!this.allKeys.has(e.key))return;const n=this.callbacks.get(this.#R(e));if(n){n.bind(t)();e.stopPropagation();e.preventDefault()}}}e.KeyboardManager=KeyboardManager;class ColorManager{static _colorsMapping=new Map([["CanvasText",[0,0,0]],["Canvas",[255,255,255]]]);get _colors(){const t=new Map([["CanvasText",null],["Canvas",null]]);(0,i.getColorValues)(t);return(0,r.shadow)(this,"_colors",t)}convert(t){const e=(0,i.getRGB)(t);if(!window.matchMedia("(forced-colors: active)").matches)return e;for(const[t,n]of this._colors)if(n.every(((t,n)=>t===e[n])))return ColorManager._colorsMapping.get(t);return e}getHexCode(t){const e=this._colors.get(t);return e?r.Util.makeHexColor(...e):t}}e.ColorManager=ColorManager;class AnnotationEditorUIManager{#D=null;#I=new Map;#O=new Map;#L=null;#N=new CommandManager;#j=0;#B=null;#U=new Set;#W=null;#q=new IdManager;#G=!1;#H=r.AnnotationEditorType.NONE;#z=new Set;#V=this.copy.bind(this);#X=this.cut.bind(this);#$=this.paste.bind(this);#Y=this.keydown.bind(this);#K=this.onEditingAction.bind(this);#J=this.onPageChanging.bind(this);#Q=this.onScaleChanging.bind(this);#Z=this.onRotationChanging.bind(this);#tt={isEditing:!1,isEmpty:!0,hasSomethingToUndo:!1,hasSomethingToRedo:!1,hasSelectedEditor:!1};#et=null;static _keyboardManager=new KeyboardManager([[["ctrl+a","mac+meta+a"],AnnotationEditorUIManager.prototype.selectAll],[["ctrl+z","mac+meta+z"],AnnotationEditorUIManager.prototype.undo],[["ctrl+y","ctrl+shift+Z","mac+meta+shift+Z"],AnnotationEditorUIManager.prototype.redo],[["Backspace","alt+Backspace","ctrl+Backspace","shift+Backspace","mac+Backspace","mac+alt+Backspace","mac+ctrl+Backspace","Delete","ctrl+Delete","shift+Delete"],AnnotationEditorUIManager.prototype.delete],[["Escape","mac+Escape"],AnnotationEditorUIManager.prototype.unselectAll]]);constructor(t,e,n){this.#et=t;this.#W=e;this.#W._on("editingaction",this.#K);this.#W._on("pagechanging",this.#J);this.#W._on("scalechanging",this.#Q);this.#W._on("rotationchanging",this.#Z);this.#L=n;this.viewParameters={realScale:i.PixelsPerInch.PDF_TO_CSS_UNITS,rotation:0}}destroy(){this.#nt();this.#W._off("editingaction",this.#K);this.#W._off("pagechanging",this.#J);this.#W._off("scalechanging",this.#Q);this.#W._off("rotationchanging",this.#Z);for(const t of this.#O.values())t.destroy();this.#O.clear();this.#I.clear();this.#U.clear();this.#D=null;this.#z.clear();this.#N.destroy()}onPageChanging(t){let{pageNumber:e}=t;this.#j=e-1}focusMainContainer(){this.#et.focus()}addShouldRescale(t){this.#U.add(t)}removeShouldRescale(t){this.#U.delete(t)}onScaleChanging(t){let{scale:e}=t;this.commitOrRemove();this.viewParameters.realScale=e*i.PixelsPerInch.PDF_TO_CSS_UNITS;for(const t of this.#U)t.onScaleChanging()}onRotationChanging(t){let{pagesRotation:e}=t;this.commitOrRemove();this.viewParameters.rotation=e}addToAnnotationStorage(t){t.isEmpty()||!this.#L||this.#L.has(t.id)||this.#L.setValue(t.id,t)}#rt(){this.#et.addEventListener("keydown",this.#Y)}#nt(){this.#et.removeEventListener("keydown",this.#Y)}#it(){document.addEventListener("copy",this.#V);document.addEventListener("cut",this.#X);document.addEventListener("paste",this.#$)}#st(){document.removeEventListener("copy",this.#V);document.removeEventListener("cut",this.#X);document.removeEventListener("paste",this.#$)}copy(t){t.preventDefault();this.#D&&this.#D.commitOrRemove();if(!this.hasSelection)return;const e=[];for(const t of this.#z)t.isEmpty()||e.push(t.serialize());0!==e.length&&t.clipboardData.setData("application/pdfjs",JSON.stringify(e))}cut(t){this.copy(t);this.delete()}paste(t){t.preventDefault();let e=t.clipboardData.getData("application/pdfjs");if(!e)return;try{e=JSON.parse(e)}catch(t){(0,r.warn)(`paste: "${t.message}".`);return}if(!Array.isArray(e))return;this.unselectAll();const n=this.#O.get(this.#j);try{const t=[];for(const r of e){const e=n.deserialize(r);if(!e)return;t.push(e)}const cmd=()=>{for(const e of t)this.#at(e);this.#ot(t)},undo=()=>{for(const e of t)e.remove()};this.addCommands({cmd:cmd,undo:undo,mustExec:!0})}catch(t){(0,r.warn)(`paste: "${t.message}".`)}}keydown(t){var e;null!==(e=this.getActive())&&void 0!==e&&e.shouldGetKeyboardEvents()||AnnotationEditorUIManager._keyboardManager.exec(this,t)}onEditingAction(t){["undo","redo","delete","selectAll"].includes(t.name)&&this[t.name]()}#lt(t){Object.entries(t).some((t=>{let[e,n]=t;return this.#tt[e]!==n}))&&this.#W.dispatch("annotationeditorstateschanged",{source:this,details:Object.assign(this.#tt,t)})}#ct(t){this.#W.dispatch("annotationeditorparamschanged",{source:this,details:t})}setEditingState(t){if(t){this.#rt();this.#it();this.#lt({isEditing:this.#H!==r.AnnotationEditorType.NONE,isEmpty:this.#dt(),hasSomethingToUndo:this.#N.hasSomethingToUndo(),hasSomethingToRedo:this.#N.hasSomethingToRedo(),hasSelectedEditor:!1})}else{this.#nt();this.#st();this.#lt({isEditing:!1})}}registerEditorTypes(t){if(!this.#B){this.#B=t;for(const t of this.#B)this.#ct(t.defaultPropertiesToUpdate)}}getId(){return this.#q.getId()}get currentLayer(){return this.#O.get(this.#j)}get currentPageIndex(){return this.#j}addLayer(t){this.#O.set(t.pageIndex,t);this.#G?t.enable():t.disable()}removeLayer(t){this.#O.delete(t.pageIndex)}updateMode(t){this.#H=t;if(t===r.AnnotationEditorType.NONE){this.setEditingState(!1);this.#ht()}else{this.setEditingState(!0);this.#ut();for(const e of this.#O.values())e.updateMode(t)}}updateToolbar(t){t!==this.#H&&this.#W.dispatch("switchannotationeditormode",{source:this,mode:t})}updateParams(t,e){if(this.#B){for(const n of this.#z)n.updateParams(t,e);for(const n of this.#B)n.updateDefaultParams(t,e)}}#ut(){if(!this.#G){this.#G=!0;for(const t of this.#O.values())t.enable()}}#ht(){this.unselectAll();if(this.#G){this.#G=!1;for(const t of this.#O.values())t.disable()}}getEditors(t){const e=[];for(const n of this.#I.values())n.pageIndex===t&&e.push(n);return e}getEditor(t){return this.#I.get(t)}addEditor(t){this.#I.set(t.id,t)}removeEditor(t){var e;this.#I.delete(t.id);this.unselect(t);null===(e=this.#L)||void 0===e||e.remove(t.id)}#at(t){const e=this.#O.get(t.pageIndex);e?e.addOrRebuild(t):this.addEditor(t)}setActiveEditor(t){if(this.#D!==t){this.#D=t;t&&this.#ct(t.propertiesToUpdate)}}toggleSelected(t){if(this.#z.has(t)){this.#z.delete(t);t.unselect();this.#lt({hasSelectedEditor:this.hasSelection})}else{this.#z.add(t);t.select();this.#ct(t.propertiesToUpdate);this.#lt({hasSelectedEditor:!0})}}setSelected(t){for(const e of this.#z)e!==t&&e.unselect();this.#z.clear();this.#z.add(t);t.select();this.#ct(t.propertiesToUpdate);this.#lt({hasSelectedEditor:!0})}isSelected(t){return this.#z.has(t)}unselect(t){t.unselect();this.#z.delete(t);this.#lt({hasSelectedEditor:this.hasSelection})}get hasSelection(){return 0!==this.#z.size}undo(){this.#N.undo();this.#lt({hasSomethingToUndo:this.#N.hasSomethingToUndo(),hasSomethingToRedo:!0,isEmpty:this.#dt()})}redo(){this.#N.redo();this.#lt({hasSomethingToUndo:!0,hasSomethingToRedo:this.#N.hasSomethingToRedo(),isEmpty:this.#dt()})}addCommands(t){this.#N.add(t);this.#lt({hasSomethingToUndo:!0,hasSomethingToRedo:!1,isEmpty:this.#dt()})}#dt(){if(0===this.#I.size)return!0;if(1===this.#I.size)for(const t of this.#I.values())return t.isEmpty();return!1}delete(){this.commitOrRemove();if(!this.hasSelection)return;const t=[...this.#z];this.addCommands({cmd:()=>{for(const e of t)e.remove()},undo:()=>{for(const e of t)this.#at(e)},mustExec:!0})}commitOrRemove(){var t;null===(t=this.#D)||void 0===t||t.commitOrRemove()}#ot(t){this.#z.clear();for(const e of t)if(!e.isEmpty()){this.#z.add(e);e.select()}this.#lt({hasSelectedEditor:!0})}selectAll(){for(const t of this.#z)t.commit();this.#ot(this.#I.values())}unselectAll(){if(this.#D)this.#D.commitOrRemove();else if(0!==this.#z.size){for(const t of this.#z)t.unselect();this.#z.clear();this.#lt({hasSelectedEditor:!1})}}isActive(t){return this.#D===t}getActive(){return this.#D}getMode(){return this.#H}}e.AnnotationEditorUIManager=AnnotationEditorUIManager},(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.StatTimer=e.RenderingCancelledException=e.PixelsPerInch=e.PageViewport=e.PDFDateString=e.DOMStandardFontDataFactory=e.DOMSVGFactory=e.DOMFilterFactory=e.DOMCanvasFactory=e.DOMCMapReaderFactory=e.AnnotationPrefix=void 0;e.deprecated=function deprecated(t){console.log("Deprecated API usage: "+t)};e.getColorValues=function getColorValues(t){const e=document.createElement("span");e.style.visibility="hidden";document.body.append(e);for(const n of t.keys()){e.style.color=n;const r=window.getComputedStyle(e).color;t.set(n,getRGB(r))}e.remove()};e.getCurrentTransform=function getCurrentTransform(t){const{a:e,b:n,c:r,d:i,e:s,f:a}=t.getTransform();return[e,n,r,i,s,a]};e.getCurrentTransformInverse=function getCurrentTransformInverse(t){const{a:e,b:n,c:r,d:i,e:s,f:a}=t.getTransform().invertSelf();return[e,n,r,i,s,a]};e.getFilenameFromUrl=function getFilenameFromUrl(t){arguments.length>1&&void 0!==arguments[1]&&arguments[1]||([t]=t.split(/[#?]/,1));return t.substring(t.lastIndexOf("/")+1)};e.getPdfFilenameFromUrl=function getPdfFilenameFromUrl(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"document.pdf";if("string"!=typeof t)return e;if(isDataScheme(t)){(0,i.warn)('getPdfFilenameFromUrl: ignore "data:"-URL for performance reasons.');return e}const n=/[^/?#=]+\.pdf\b(?!.*\.pdf\b)/i,r=/^(?:(?:[^:]+:)?\/\/[^/]+)?([^?#]*)(\?[^#]*)?(#.*)?$/.exec(t);let s=n.exec(r[1])||n.exec(r[2])||n.exec(r[3]);if(s){s=s[0];if(s.includes("%"))try{s=n.exec(decodeURIComponent(s))[0]}catch(t){}}return s||e};e.getRGB=getRGB;e.getXfaPageViewport=function getXfaPageViewport(t,e){let{scale:n=1,rotation:r=0}=e;const{width:i,height:s}=t.attributes.style,a=[0,0,parseInt(i),parseInt(s)];return new PageViewport({viewBox:a,scale:n,rotation:r})};e.isDataScheme=isDataScheme;e.isPdfFile=function isPdfFile(t){return"string"==typeof t&&/\.pdf$/i.test(t)};e.isValidFetchUrl=isValidFetchUrl;e.loadScript=function loadScript(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return new Promise(((n,r)=>{const i=document.createElement("script");i.src=t;i.onload=function(t){e&&i.remove();n(t)};i.onerror=function(){r(new Error(`Cannot load script at: ${i.src}`))};(document.head||document.documentElement).append(i)}))};e.setLayerDimensions=function setLayerDimensions(t,e){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];if(e instanceof PageViewport){const{pageWidth:r,pageHeight:i}=e.rawDims,{style:s}=t,a=`calc(var(--scale-factor) * ${r}px)`,o=`calc(var(--scale-factor) * ${i}px)`;if(n&&e.rotation%180!=0){s.width=o;s.height=a}else{s.width=a;s.height=o}}r&&t.setAttribute("data-main-rotation",e.rotation)};var r=n(143),i=n(1);const s="http://www.w3.org/2000/svg";e.AnnotationPrefix="pdfjs_internal_id_";class PixelsPerInch{static CSS=96;static PDF=72;static PDF_TO_CSS_UNITS=this.CSS/this.PDF}e.PixelsPerInch=PixelsPerInch;class DOMFilterFactory extends r.BaseFilterFactory{#pt;#ft;#e;#gt;#mt;#vt;#bt;#P=0;constructor(){let{docId:t,ownerDocument:e=globalThis.document}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super();this.#e=t;this.#gt=e}get#yt(){return this.#pt||=new Map}get#At(){if(!this.#ft){const t=this.#gt.createElement("div"),{style:e}=t;e.visibility="hidden";e.contain="strict";e.width=e.height=0;e.position="absolute";e.top=e.left=0;e.zIndex=-1;const n=this.#gt.createElementNS(s,"svg");n.setAttribute("width",0);n.setAttribute("height",0);this.#ft=this.#gt.createElementNS(s,"defs");t.append(n);n.append(this.#ft);this.#gt.body.append(t)}return this.#ft}#_t(t,e,n){const r=this.#gt.createElementNS(s,e);r.setAttribute("type","discrete");r.setAttribute("tableValues",n);t.append(r)}addFilter(t){if(!t)return"none";let e,n,r,i,a=this.#yt.get(t);if(a)return a;if(1===t.length){const s=t[0],a=new Array(256);for(let t=0;t<256;t++)a[t]=s[t]/255;i=e=n=r=a.join(",")}else{const[s,a,o]=t,l=new Array(256),c=new Array(256),d=new Array(256);for(let t=0;t<256;t++){l[t]=s[t]/255;c[t]=a[t]/255;d[t]=o[t]/255}e=l.join(",");n=c.join(",");r=d.join(",");i=`${e}${n}${r}`}a=this.#yt.get(i);if(a){this.#yt.set(t,a);return a}const o=`g_${this.#e}_transfer_map_${this.#P++}`,l=`url(#${o})`;this.#yt.set(t,l);this.#yt.set(i,l);const c=this.#gt.createElementNS(s,"filter",s);c.setAttribute("id",o);c.setAttribute("color-interpolation-filters","sRGB");const d=this.#gt.createElementNS(s,"feComponentTransfer");c.append(d);this.#_t(d,"feFuncR",e);this.#_t(d,"feFuncG",n);this.#_t(d,"feFuncB",r);this.#At.append(c);return l}addHCMFilter(t,e){var n;const r=`${t}-${e}`;if(this.#vt===r)return this.#bt;this.#vt=r;this.#bt="none";null===(n=this.#mt)||void 0===n||n.remove();if(!t||!e)return this.#bt;this.#At.style.color=t;const a=getRGB(t=getComputedStyle(this.#At).getPropertyValue("color"));t=i.Util.makeHexColor(...a);this.#At.style.color=e;const o=getRGB(e=getComputedStyle(this.#At).getPropertyValue("color"));e=i.Util.makeHexColor(...o);this.#At.style.color="";if("#000000"===t&&"#ffffff"===e||t===e)return this.#bt;const l=new Array(256);for(let t=0;t<=255;t++){const e=t/255;l[t]=e<=.03928?e/12.92:((e+.055)/1.055)**2.4}const c=l.join(","),d=`g_${this.#e}_hcm_filter`,h=this.#mt=this.#gt.createElementNS(s,"filter",s);h.setAttribute("id",d);h.setAttribute("color-interpolation-filters","sRGB");let u=this.#gt.createElementNS(s,"feComponentTransfer");h.append(u);this.#_t(u,"feFuncR",c);this.#_t(u,"feFuncG",c);this.#_t(u,"feFuncB",c);const p=this.#gt.createElementNS(s,"feColorMatrix");p.setAttribute("type","matrix");p.setAttribute("values","0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0 0 0 1 0");h.append(p);u=this.#gt.createElementNS(s,"feComponentTransfer");h.append(u);const getSteps=(t,e)=>{const n=a[t]/255,r=o[t]/255,i=new Array(e+1);for(let t=0;t<=e;t++)i[t]=n+t/e*(r-n);return i.join(",")};this.#_t(u,"feFuncR",getSteps(0,5));this.#_t(u,"feFuncG",getSteps(1,5));this.#_t(u,"feFuncB",getSteps(2,5));this.#At.append(h);this.#bt=`url(#${d})`;return this.#bt}destroy(){if(!(arguments.length>0&&void 0!==arguments[0]&&arguments[0])||!this.#bt){if(this.#ft){this.#ft.parentNode.parentNode.remove();this.#ft=null}if(this.#pt){this.#pt.clear();this.#pt=null}this.#P=0}}}e.DOMFilterFactory=DOMFilterFactory;class DOMCanvasFactory extends r.BaseCanvasFactory{constructor(){let{ownerDocument:t=globalThis.document}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super();this._document=t}_createCanvas(t,e){const n=this._document.createElement("canvas");n.width=t;n.height=e;return n}}e.DOMCanvasFactory=DOMCanvasFactory;async function fetchData(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(isValidFetchUrl(t,document.baseURI)){const n=await fetch(t);if(!n.ok)throw new Error(n.statusText);return e?new Uint8Array(await n.arrayBuffer()):(0,i.stringToBytes)(await n.text())}return new Promise(((n,r)=>{const s=new XMLHttpRequest;s.open("GET",t,!0);e&&(s.responseType="arraybuffer");s.onreadystatechange=()=>{if(s.readyState===XMLHttpRequest.DONE){if(200===s.status||0===s.status){let t;e&&s.response?t=new Uint8Array(s.response):!e&&s.responseText&&(t=(0,i.stringToBytes)(s.responseText));if(t){n(t);return}}r(new Error(s.statusText))}};s.send(null)}))}class DOMCMapReaderFactory extends r.BaseCMapReaderFactory{_fetchData(t,e){return fetchData(t,this.isCompressed).then((t=>({cMapData:t,compressionType:e})))}}e.DOMCMapReaderFactory=DOMCMapReaderFactory;class DOMStandardFontDataFactory extends r.BaseStandardFontDataFactory{_fetchData(t){return fetchData(t,!0)}}e.DOMStandardFontDataFactory=DOMStandardFontDataFactory;class DOMSVGFactory extends r.BaseSVGFactory{_createSVG(t){return document.createElementNS(s,t)}}e.DOMSVGFactory=DOMSVGFactory;class PageViewport{constructor(t){let{viewBox:e,scale:n,rotation:r,offsetX:i=0,offsetY:s=0,dontFlip:a=!1}=t;this.viewBox=e;this.scale=n;this.rotation=r;this.offsetX=i;this.offsetY=s;const o=(e[2]+e[0])/2,l=(e[3]+e[1])/2;let c,d,h,u,p,f,g,m;r%=360;r<0&&(r+=360);switch(r){case 180:c=-1;d=0;h=0;u=1;break;case 90:c=0;d=1;h=1;u=0;break;case 270:c=0;d=-1;h=-1;u=0;break;case 0:c=1;d=0;h=0;u=-1;break;default:throw new Error("PageViewport: Invalid rotation, must be a multiple of 90 degrees.")}if(a){h=-h;u=-u}if(0===c){p=Math.abs(l-e[1])*n+i;f=Math.abs(o-e[0])*n+s;g=(e[3]-e[1])*n;m=(e[2]-e[0])*n}else{p=Math.abs(o-e[0])*n+i;f=Math.abs(l-e[1])*n+s;g=(e[2]-e[0])*n;m=(e[3]-e[1])*n}this.transform=[c*n,d*n,h*n,u*n,p-c*n*o-h*n*l,f-d*n*o-u*n*l];this.width=g;this.height=m}get rawDims(){const{viewBox:t}=this;return(0,i.shadow)(this,"rawDims",{pageWidth:t[2]-t[0],pageHeight:t[3]-t[1],pageX:t[0],pageY:t[1]})}clone(){let{scale:t=this.scale,rotation:e=this.rotation,offsetX:n=this.offsetX,offsetY:r=this.offsetY,dontFlip:i=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new PageViewport({viewBox:this.viewBox.slice(),scale:t,rotation:e,offsetX:n,offsetY:r,dontFlip:i})}convertToViewportPoint(t,e){return i.Util.applyTransform([t,e],this.transform)}convertToViewportRectangle(t){const e=i.Util.applyTransform([t[0],t[1]],this.transform),n=i.Util.applyTransform([t[2],t[3]],this.transform);return[e[0],e[1],n[0],n[1]]}convertToPdfPoint(t,e){return i.Util.applyInverseTransform([t,e],this.transform)}}e.PageViewport=PageViewport;class RenderingCancelledException extends i.BaseException{constructor(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;super(t,"RenderingCancelledException");this.type=e;this.extraDelay=n}}e.RenderingCancelledException=RenderingCancelledException;function isDataScheme(t){const e=t.length;let n=0;for(;n<e&&""===t[n].trim();)n++;return"data:"===t.substring(n,n+5).toLowerCase()}e.StatTimer=class StatTimer{started=Object.create(null);times=[];time(t){t in this.started&&(0,i.warn)(`Timer is already running for ${t}`);this.started[t]=Date.now()}timeEnd(t){t in this.started||(0,i.warn)(`Timer has not been started for ${t}`);this.times.push({name:t,start:this.started[t],end:Date.now()});delete this.started[t]}toString(){const t=[];let e=0;for(const{name:t}of this.times)e=Math.max(t.length,e);for(const{name:n,start:r,end:i}of this.times)t.push(`${n.padEnd(e)} ${i-r}ms\n`);return t.join("")}};function isValidFetchUrl(t,e){try{const{protocol:n}=e?new URL(t,e):new URL(t);return"http:"===n||"https:"===n}catch(t){return!1}}let a;e.PDFDateString=class PDFDateString{static toDateObject(t){if(!t||"string"!=typeof t)return null;a||=new RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+|-])?(\\d{2})?'?(\\d{2})?'?");const e=a.exec(t);if(!e)return null;const n=parseInt(e[1],10);let r=parseInt(e[2],10);r=r>=1&&r<=12?r-1:0;let i=parseInt(e[3],10);i=i>=1&&i<=31?i:1;let s=parseInt(e[4],10);s=s>=0&&s<=23?s:0;let o=parseInt(e[5],10);o=o>=0&&o<=59?o:0;let l=parseInt(e[6],10);l=l>=0&&l<=59?l:0;const c=e[7]||"Z";let d=parseInt(e[8],10);d=d>=0&&d<=23?d:0;let h=parseInt(e[9],10)||0;h=h>=0&&h<=59?h:0;if("-"===c){s+=d;o+=h}else if("+"===c){s-=d;o-=h}return new Date(Date.UTC(n,r,i,s,o,l))}};function getRGB(t){if(t.startsWith("#")){const e=parseInt(t.slice(1),16);return[(16711680&e)>>16,(65280&e)>>8,255&e]}if(t.startsWith("rgb("))return t.slice(4,-1).split(",").map((t=>parseInt(t)));if(t.startsWith("rgba("))return t.slice(5,-1).split(",").map((t=>parseInt(t))).slice(0,3);(0,i.warn)(`Not a valid color format: "${t}"`);return[0,0,0]}},(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.BaseStandardFontDataFactory=e.BaseSVGFactory=e.BaseFilterFactory=e.BaseCanvasFactory=e.BaseCMapReaderFactory=void 0;var r=n(1);class BaseFilterFactory{constructor(){this.constructor===BaseFilterFactory&&(0,r.unreachable)("Cannot initialize BaseFilterFactory.")}addFilter(t){return"none"}addHCMFilter(t,e){return"none"}destroy(){}}e.BaseFilterFactory=BaseFilterFactory;class BaseCanvasFactory{constructor(){this.constructor===BaseCanvasFactory&&(0,r.unreachable)("Cannot initialize BaseCanvasFactory.")}create(t,e){if(t<=0||e<=0)throw new Error("Invalid canvas size");const n=this._createCanvas(t,e);return{canvas:n,context:n.getContext("2d")}}reset(t,e,n){if(!t.canvas)throw new Error("Canvas is not specified");if(e<=0||n<=0)throw new Error("Invalid canvas size");t.canvas.width=e;t.canvas.height=n}destroy(t){if(!t.canvas)throw new Error("Canvas is not specified");t.canvas.width=0;t.canvas.height=0;t.canvas=null;t.context=null}_createCanvas(t,e){(0,r.unreachable)("Abstract method `_createCanvas` called.")}}e.BaseCanvasFactory=BaseCanvasFactory;class BaseCMapReaderFactory{constructor(t){let{baseUrl:e=null,isCompressed:n=!0}=t;this.constructor===BaseCMapReaderFactory&&(0,r.unreachable)("Cannot initialize BaseCMapReaderFactory.");this.baseUrl=e;this.isCompressed=n}async fetch(t){let{name:e}=t;if(!this.baseUrl)throw new Error('The CMap "baseUrl" parameter must be specified, ensure that the "cMapUrl" and "cMapPacked" API parameters are provided.');if(!e)throw new Error("CMap name must be specified.");const n=this.baseUrl+e+(this.isCompressed?".bcmap":""),i=this.isCompressed?r.CMapCompressionType.BINARY:r.CMapCompressionType.NONE;return this._fetchData(n,i).catch((t=>{throw new Error(`Unable to load ${this.isCompressed?"binary ":""}CMap at: ${n}`)}))}_fetchData(t,e){(0,r.unreachable)("Abstract method `_fetchData` called.")}}e.BaseCMapReaderFactory=BaseCMapReaderFactory;class BaseStandardFontDataFactory{constructor(t){let{baseUrl:e=null}=t;this.constructor===BaseStandardFontDataFactory&&(0,r.unreachable)("Cannot initialize BaseStandardFontDataFactory.");this.baseUrl=e}async fetch(t){let{filename:e}=t;if(!this.baseUrl)throw new Error('The standard font "baseUrl" parameter must be specified, ensure that the "standardFontDataUrl" API parameter is provided.');if(!e)throw new Error("Font filename must be specified.");const n=`${this.baseUrl}${e}`;return this._fetchData(n).catch((t=>{throw new Error(`Unable to load font data at: ${n}`)}))}_fetchData(t){(0,r.unreachable)("Abstract method `_fetchData` called.")}}e.BaseStandardFontDataFactory=BaseStandardFontDataFactory;class BaseSVGFactory{constructor(){this.constructor===BaseSVGFactory&&(0,r.unreachable)("Cannot initialize BaseSVGFactory.")}create(t,e){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(t<=0||e<=0)throw new Error("Invalid SVG dimensions");const r=this._createSVG("svg:svg");r.setAttribute("version","1.1");if(!n){r.setAttribute("width",`${t}px`);r.setAttribute("height",`${e}px`)}r.setAttribute("preserveAspectRatio","none");r.setAttribute("viewBox",`0 0 ${t} ${e}`);return r}createElement(t){if("string"!=typeof t)throw new Error("Invalid SVG element type");return this._createSVG(t)}_createSVG(t){(0,r.unreachable)("Abstract method `_createSVG` called.")}}e.BaseSVGFactory=BaseSVGFactory},(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.MurmurHash3_64=void 0;var r=n(1);const i=3285377520,s=4294901760,a=65535;e.MurmurHash3_64=class MurmurHash3_64{constructor(t){this.h1=t?4294967295&t:i;this.h2=t?4294967295&t:i}update(t){let e,n;if("string"==typeof t){e=new Uint8Array(2*t.length);n=0;for(let r=0,i=t.length;r<i;r++){const i=t.charCodeAt(r);if(i<=255)e[n++]=i;else{e[n++]=i>>>8;e[n++]=255&i}}}else{if(!(0,r.isArrayBuffer)(t))throw new Error("Wrong data format in MurmurHash3_64_update. Input must be a string or array.");e=t.slice();n=e.byteLength}const i=n>>2,o=n-4*i,l=new Uint32Array(e.buffer,0,i);let c=0,d=0,h=this.h1,u=this.h2;const p=3432918353,f=461845907,g=11601,m=13715;for(let t=0;t<i;t++)if(1&t){c=l[t];c=c*p&s|c*g&a;c=c<<15|c>>>17;c=c*f&s|c*m&a;h^=c;h=h<<13|h>>>19;h=5*h+3864292196}else{d=l[t];d=d*p&s|d*g&a;d=d<<15|d>>>17;d=d*f&s|d*m&a;u^=d;u=u<<13|u>>>19;u=5*u+3864292196}c=0;switch(o){case 3:c^=e[4*i+2]<<16;case 2:c^=e[4*i+1]<<8;case 1:c^=e[4*i];c=c*p&s|c*g&a;c=c<<15|c>>>17;c=c*f&s|c*m&a;1&i?h^=c:u^=c}this.h1=h;this.h2=u}hexdigest(){let t=this.h1,e=this.h2;t^=e>>>1;t=3981806797*t&s|36045*t&a;e=4283543511*e&s|(2950163797*(e<<16|t>>>16)&s)>>>16;t^=e>>>1;t=444984403*t&s|60499*t&a;e=3301882366*e&s|(3120437893*(e<<16|t>>>16)&s)>>>16;t^=e>>>1;return(t>>>0).toString(16).padStart(8,"0")+(e>>>0).toString(16).padStart(8,"0")}}},(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.FontLoader=e.FontFaceObject=void 0;var r=n(1),i=n(3);e.FontLoader=class FontLoader{#St=new Set;constructor(t){let{ownerDocument:e=globalThis.document,styleElement:n=null}=t;this._document=e;this.nativeFontFaces=new Set;this.styleElement=null;this.loadingRequests=[];this.loadTestFontId=0}addNativeFontFace(t){this.nativeFontFaces.add(t);this._document.fonts.add(t)}removeNativeFontFace(t){this.nativeFontFaces.delete(t);this._document.fonts.delete(t)}insertRule(t){if(!this.styleElement){this.styleElement=this._document.createElement("style");this._document.documentElement.getElementsByTagName("head")[0].append(this.styleElement)}const e=this.styleElement.sheet;e.insertRule(t,e.cssRules.length)}clear(){for(const t of this.nativeFontFaces)this._document.fonts.delete(t);this.nativeFontFaces.clear();this.#St.clear();if(this.styleElement){this.styleElement.remove();this.styleElement=null}}async loadSystemFont(t){if(t&&!this.#St.has(t.loadedName)){(0,r.assert)(!this.disableFontFace,"loadSystemFont shouldn't be called when `disableFontFace` is set.");if(this.isFontLoadingAPISupported){const{loadedName:e,src:n,style:i}=t,s=new FontFace(e,n,i);this.addNativeFontFace(s);try{await s.load();this.#St.add(e)}catch{(0,r.warn)(`Cannot load system font: ${t.baseFontName}, installing it could help to improve PDF rendering.`);this.removeNativeFontFace(s)}}else(0,r.unreachable)("Not implemented: loadSystemFont without the Font Loading API.")}}async bind(t){if(t.attached||t.missingFile&&!t.systemFontInfo)return;t.attached=!0;if(t.systemFontInfo){await this.loadSystemFont(t.systemFontInfo);return}if(this.isFontLoadingAPISupported){const e=t.createNativeFontFace();if(e){this.addNativeFontFace(e);try{await e.loaded}catch(n){(0,r.warn)(`Failed to load font '${e.family}': '${n}'.`);t.disableFontFace=!0;throw n}}return}const e=t.createFontFaceRule();if(e){this.insertRule(e);if(this.isSyncFontLoadingSupported)return;await new Promise((e=>{const n=this._queueLoadingCallback(e);this._prepareFontLoadEvent(t,n)}))}}get isFontLoadingAPISupported(){var t;const e=!(null===(t=this._document)||void 0===t||!t.fonts);return(0,r.shadow)(this,"isFontLoadingAPISupported",e)}get isSyncFontLoadingSupported(){let t=!1;(i.isNodeJS||"undefined"!=typeof navigator&&/Mozilla\/5.0.*?rv:\d+.*? Gecko/.test(navigator.userAgent))&&(t=!0);return(0,r.shadow)(this,"isSyncFontLoadingSupported",t)}_queueLoadingCallback(t){const{loadingRequests:e}=this,n={done:!1,complete:function completeRequest(){(0,r.assert)(!n.done,"completeRequest() cannot be called twice.");n.done=!0;for(;e.length>0&&e[0].done;){const t=e.shift();setTimeout(t.callback,0)}},callback:t};e.push(n);return n}get _loadTestFont(){const t=atob("T1RUTwALAIAAAwAwQ0ZGIDHtZg4AAAOYAAAAgUZGVE1lkzZwAAAEHAAAABxHREVGABQAFQAABDgAAAAeT1MvMlYNYwkAAAEgAAAAYGNtYXABDQLUAAACNAAAAUJoZWFk/xVFDQAAALwAAAA2aGhlYQdkA+oAAAD0AAAAJGhtdHgD6AAAAAAEWAAAAAZtYXhwAAJQAAAAARgAAAAGbmFtZVjmdH4AAAGAAAAAsXBvc3T/hgAzAAADeAAAACAAAQAAAAEAALZRFsRfDzz1AAsD6AAAAADOBOTLAAAAAM4KHDwAAAAAA+gDIQAAAAgAAgAAAAAAAAABAAADIQAAAFoD6AAAAAAD6AABAAAAAAAAAAAAAAAAAAAAAQAAUAAAAgAAAAQD6AH0AAUAAAKKArwAAACMAooCvAAAAeAAMQECAAACAAYJAAAAAAAAAAAAAQAAAAAAAAAAAAAAAFBmRWQAwAAuAC4DIP84AFoDIQAAAAAAAQAAAAAAAAAAACAAIAABAAAADgCuAAEAAAAAAAAAAQAAAAEAAAAAAAEAAQAAAAEAAAAAAAIAAQAAAAEAAAAAAAMAAQAAAAEAAAAAAAQAAQAAAAEAAAAAAAUAAQAAAAEAAAAAAAYAAQAAAAMAAQQJAAAAAgABAAMAAQQJAAEAAgABAAMAAQQJAAIAAgABAAMAAQQJAAMAAgABAAMAAQQJAAQAAgABAAMAAQQJAAUAAgABAAMAAQQJAAYAAgABWABYAAAAAAAAAwAAAAMAAAAcAAEAAAAAADwAAwABAAAAHAAEACAAAAAEAAQAAQAAAC7//wAAAC7////TAAEAAAAAAAABBgAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAD/gwAyAAAAAQAAAAAAAAAAAAAAAAAAAAABAAQEAAEBAQJYAAEBASH4DwD4GwHEAvgcA/gXBIwMAYuL+nz5tQXkD5j3CBLnEQACAQEBIVhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYAAABAQAADwACAQEEE/t3Dov6fAH6fAT+fPp8+nwHDosMCvm1Cvm1DAz6fBQAAAAAAAABAAAAAMmJbzEAAAAAzgTjFQAAAADOBOQpAAEAAAAAAAAADAAUAAQAAAABAAAAAgABAAAAAAAAAAAD6AAAAAAAAA==");return(0,r.shadow)(this,"_loadTestFont",t)}_prepareFontLoadEvent(t,e){function int32(t,e){return t.charCodeAt(e)<<24|t.charCodeAt(e+1)<<16|t.charCodeAt(e+2)<<8|255&t.charCodeAt(e+3)}function spliceString(t,e,n,r){return t.substring(0,e)+r+t.substring(e+n)}let n,i;const s=this._document.createElement("canvas");s.width=1;s.height=1;const a=s.getContext("2d");let o=0;const l=`lt${Date.now()}${this.loadTestFontId++}`;let c=this._loadTestFont;c=spliceString(c,976,l.length,l);const d=1482184792;let h=int32(c,16);for(n=0,i=l.length-3;n<i;n+=4)h=h-d+int32(l,n)|0;n<l.length&&(h=h-d+int32(l+"XXX",n)|0);c=spliceString(c,16,4,(0,r.string32)(h));const u=`@font-face {font-family:"${l}";src:${`url(data:font/opentype;base64,${btoa(c)});`}}`;this.insertRule(u);const p=this._document.createElement("div");p.style.visibility="hidden";p.style.width=p.style.height="10px";p.style.position="absolute";p.style.top=p.style.left="0px";for(const e of[t.loadedName,l]){const t=this._document.createElement("span");t.textContent="Hi";t.style.fontFamily=e;p.append(t)}this._document.body.append(p);!function isFontReady(t,e){if(++o>30){(0,r.warn)("Load test font never loaded.");e();return}a.font="30px "+t;a.fillText(".",0,20);a.getImageData(0,0,1,1).data[3]>0?e():setTimeout(isFontReady.bind(null,t,e))}(l,(()=>{p.remove();e.complete()}))}};e.FontFaceObject=class FontFaceObject{constructor(t,e){let{isEvalSupported:n=!0,disableFontFace:r=!1,ignoreErrors:i=!1,inspectFont:s=null}=e;this.compiledGlyphs=Object.create(null);for(const e in t)this[e]=t[e];this.isEvalSupported=!1!==n;this.disableFontFace=!0===r;this.ignoreErrors=!0===i;this._inspectFont=s}createNativeFontFace(){var t;if(!this.data||this.disableFontFace)return null;let e;if(this.cssFontInfo){const t={weight:this.cssFontInfo.fontWeight};this.cssFontInfo.italicAngle&&(t.style=`oblique ${this.cssFontInfo.italicAngle}deg`);e=new FontFace(this.cssFontInfo.fontFamily,this.data,t)}else e=new FontFace(this.loadedName,this.data,{});null===(t=this._inspectFont)||void 0===t||t.call(this,this);return e}createFontFaceRule(){var t;if(!this.data||this.disableFontFace)return null;const e=(0,r.bytesToString)(this.data),n=`url(data:${this.mimetype};base64,${btoa(e)});`;let i;if(this.cssFontInfo){let t=`font-weight: ${this.cssFontInfo.fontWeight};`;this.cssFontInfo.italicAngle&&(t+=`font-style: oblique ${this.cssFontInfo.italicAngle}deg;`);i=`@font-face {font-family:"${this.cssFontInfo.fontFamily}";${t}src:${n}}`}else i=`@font-face {font-family:"${this.loadedName}";src:${n}}`;null===(t=this._inspectFont)||void 0===t||t.call(this,this,n);return i}getPathGenerator(t,e){if(void 0!==this.compiledGlyphs[e])return this.compiledGlyphs[e];let n;try{n=t.get(this.loadedName+"_path_"+e)}catch(t){if(!this.ignoreErrors)throw t;(0,r.warn)(`getPathGenerator - ignoring character: "${t}".`);return this.compiledGlyphs[e]=function(t,e){}}if(this.isEvalSupported&&r.FeatureTest.isEvalSupported){const t=[];for(const e of n){const n=void 0!==e.args?e.args.join(","):"";t.push("c.",e.cmd,"(",n,");\n")}return this.compiledGlyphs[e]=new Function("c","size",t.join(""))}return this.compiledGlyphs[e]=function(t,e){for(const r of n){"scale"===r.cmd&&(r.args=[e,-e]);t[r.cmd].apply(t,r.args)}}}}},(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.CanvasGraphics=void 0;var r=n(1),i=n(142),s=n(147),a=n(148),o=n(3);const l=4096,c=16;class CachedCanvases{constructor(t){this.canvasFactory=t;this.cache=Object.create(null)}getCanvas(t,e,n){let r;if(void 0!==this.cache[t]){r=this.cache[t];this.canvasFactory.reset(r,e,n)}else{r=this.canvasFactory.create(e,n);this.cache[t]=r}return r}delete(t){delete this.cache[t]}clear(){for(const t in this.cache){const e=this.cache[t];this.canvasFactory.destroy(e);delete this.cache[t]}}}function drawImageAtIntegerCoords(t,e,n,r,s,a,o,l,c,d){const[h,u,p,f,g,m]=(0,i.getCurrentTransform)(t);if(0===u&&0===p){const i=o*h+g,v=Math.round(i),b=l*f+m,y=Math.round(b),A=(o+c)*h+g,_=Math.abs(Math.round(A)-v)||1,S=(l+d)*f+m,x=Math.abs(Math.round(S)-y)||1;t.setTransform(Math.sign(h),0,0,Math.sign(f),v,y);t.drawImage(e,n,r,s,a,0,0,_,x);t.setTransform(h,u,p,f,g,m);return[_,x]}if(0===h&&0===f){const i=l*p+g,v=Math.round(i),b=o*u+m,y=Math.round(b),A=(l+d)*p+g,_=Math.abs(Math.round(A)-v)||1,S=(o+c)*u+m,x=Math.abs(Math.round(S)-y)||1;t.setTransform(0,Math.sign(u),Math.sign(p),0,v,y);t.drawImage(e,n,r,s,a,0,0,x,_);t.setTransform(h,u,p,f,g,m);return[x,_]}t.drawImage(e,n,r,s,a,o,l,c,d);return[Math.hypot(h,u)*c,Math.hypot(p,f)*d]}class CanvasExtraState{constructor(t,e){this.alphaIsShape=!1;this.fontSize=0;this.fontSizeScale=1;this.textMatrix=r.IDENTITY_MATRIX;this.textMatrixScale=1;this.fontMatrix=r.FONT_IDENTITY_MATRIX;this.leading=0;this.x=0;this.y=0;this.lineX=0;this.lineY=0;this.charSpacing=0;this.wordSpacing=0;this.textHScale=1;this.textRenderingMode=r.TextRenderingMode.FILL;this.textRise=0;this.fillColor="#000000";this.strokeColor="#000000";this.patternFill=!1;this.fillAlpha=1;this.strokeAlpha=1;this.lineWidth=1;this.activeSMask=null;this.transferMaps="none";this.startNewPathAndClipBox([0,0,t,e])}clone(){const t=Object.create(this);t.clipBox=this.clipBox.slice();return t}setCurrentPoint(t,e){this.x=t;this.y=e}updatePathMinMax(t,e,n){[e,n]=r.Util.applyTransform([e,n],t);this.minX=Math.min(this.minX,e);this.minY=Math.min(this.minY,n);this.maxX=Math.max(this.maxX,e);this.maxY=Math.max(this.maxY,n)}updateRectMinMax(t,e){const n=r.Util.applyTransform(e,t),i=r.Util.applyTransform(e.slice(2),t);this.minX=Math.min(this.minX,n[0],i[0]);this.minY=Math.min(this.minY,n[1],i[1]);this.maxX=Math.max(this.maxX,n[0],i[0]);this.maxY=Math.max(this.maxY,n[1],i[1])}updateScalingPathMinMax(t,e){r.Util.scaleMinMax(t,e);this.minX=Math.min(this.minX,e[0]);this.maxX=Math.max(this.maxX,e[1]);this.minY=Math.min(this.minY,e[2]);this.maxY=Math.max(this.maxY,e[3])}updateCurvePathMinMax(t,e,n,i,s,a,o,l,c,d){const h=r.Util.bezierBoundingBox(e,n,i,s,a,o,l,c);if(d){d[0]=Math.min(d[0],h[0],h[2]);d[1]=Math.max(d[1],h[0],h[2]);d[2]=Math.min(d[2],h[1],h[3]);d[3]=Math.max(d[3],h[1],h[3])}else this.updateRectMinMax(t,h)}getPathBoundingBox(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:s.PathType.FILL,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;const n=[this.minX,this.minY,this.maxX,this.maxY];if(t===s.PathType.STROKE){e||(0,r.unreachable)("Stroke bounding box must include transform.");const t=r.Util.singularValueDecompose2dScale(e),i=t[0]*this.lineWidth/2,s=t[1]*this.lineWidth/2;n[0]-=i;n[1]-=s;n[2]+=i;n[3]+=s}return n}updateClipFromPath(){const t=r.Util.intersect(this.clipBox,this.getPathBoundingBox());this.startNewPathAndClipBox(t||[0,0,0,0])}isEmptyClip(){return this.minX===1/0}startNewPathAndClipBox(t){this.clipBox=t;this.minX=1/0;this.minY=1/0;this.maxX=0;this.maxY=0}getClippedPathBoundingBox(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:s.PathType.FILL,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return r.Util.intersect(this.clipBox,this.getPathBoundingBox(t,e))}}function putBinaryImageData(t,e){if("undefined"!=typeof ImageData&&e instanceof ImageData){t.putImageData(e,0,0);return}const n=e.height,i=e.width,s=n%c,a=(n-s)/c,o=0===s?a:a+1,l=t.createImageData(i,c);let d,h=0;const u=e.data,p=l.data;let f,g,m,v;if(e.kind===r.ImageKind.GRAYSCALE_1BPP){const e=u.byteLength,n=new Uint32Array(p.buffer,0,p.byteLength>>2),v=n.length,b=i+7>>3,y=4294967295,A=r.FeatureTest.isLittleEndian?4278190080:255;for(f=0;f<o;f++){m=f<a?c:s;d=0;for(g=0;g<m;g++){const t=e-h;let r=0;const s=t>b?i:8*t-7,a=-8&s;let o=0,l=0;for(;r<a;r+=8){l=u[h++];n[d++]=128&l?y:A;n[d++]=64&l?y:A;n[d++]=32&l?y:A;n[d++]=16&l?y:A;n[d++]=8&l?y:A;n[d++]=4&l?y:A;n[d++]=2&l?y:A;n[d++]=1&l?y:A}for(;r<s;r++){if(0===o){l=u[h++];o=128}n[d++]=l&o?y:A;o>>=1}}for(;d<v;)n[d++]=0;t.putImageData(l,0,f*c)}}else if(e.kind===r.ImageKind.RGBA_32BPP){g=0;v=i*c*4;for(f=0;f<a;f++){p.set(u.subarray(h,h+v));h+=v;t.putImageData(l,0,g);g+=c}if(f<o){v=i*s*4;p.set(u.subarray(h,h+v));t.putImageData(l,0,g)}}else{if(e.kind!==r.ImageKind.RGB_24BPP)throw new Error(`bad image kind: ${e.kind}`);m=c;v=i*m;for(f=0;f<o;f++){if(f>=a){m=s;v=i*m}d=0;for(g=v;g--;){p[d++]=u[h++];p[d++]=u[h++];p[d++]=u[h++];p[d++]=255}t.putImageData(l,0,f*c)}}}function putBinaryImageMask(t,e){if(e.bitmap){t.drawImage(e.bitmap,0,0);return}const n=e.height,r=e.width,i=n%c,s=(n-i)/c,o=0===i?s:s+1,l=t.createImageData(r,c);let d=0;const h=e.data,u=l.data;for(let e=0;e<o;e++){const n=e<s?c:i;({srcPos:d}=(0,a.convertBlackAndWhiteToRGBA)({src:h,srcPos:d,dest:u,width:r,height:n,nonBlackColor:0}));t.putImageData(l,0,e*c)}}function copyCtxState(t,e){const n=["strokeStyle","fillStyle","fillRule","globalAlpha","lineWidth","lineCap","lineJoin","miterLimit","globalCompositeOperation","font","filter"];for(const r of n)void 0!==t[r]&&(e[r]=t[r]);if(void 0!==t.setLineDash){e.setLineDash(t.getLineDash());e.lineDashOffset=t.lineDashOffset}}function resetCtxToDefault(t){t.strokeStyle=t.fillStyle="#000000";t.fillRule="nonzero";t.globalAlpha=1;t.lineWidth=1;t.lineCap="butt";t.lineJoin="miter";t.miterLimit=10;t.globalCompositeOperation="source-over";t.font="10px sans-serif";if(void 0!==t.setLineDash){t.setLineDash([]);t.lineDashOffset=0}o.isNodeJS||(t.filter="none")}function composeSMaskBackdrop(t,e,n,r){const i=t.length;for(let s=3;s<i;s+=4){const i=t[s];if(0===i){t[s-3]=e;t[s-2]=n;t[s-1]=r}else if(i<255){const a=255-i;t[s-3]=t[s-3]*i+e*a>>8;t[s-2]=t[s-2]*i+n*a>>8;t[s-1]=t[s-1]*i+r*a>>8}}}function composeSMaskAlpha(t,e,n){const r=t.length;for(let i=3;i<r;i+=4){const r=n?n[t[i]]:t[i];e[i]=e[i]*r*.00392156862745098|0}}function composeSMaskLuminosity(t,e,n){const r=t.length;for(let i=3;i<r;i+=4){const r=77*t[i-3]+152*t[i-2]+28*t[i-1];e[i]=n?e[i]*n[r>>8]>>8:e[i]*r>>16}}function composeSMask(t,e,n,r){const i=r[0],s=r[1],a=r[2]-i,o=r[3]-s;if(0!==a&&0!==o){!function genericComposeSMask(t,e,n,r,i,s,a,o,l,c,d){const h=!!s,u=h?s[0]:0,p=h?s[1]:0,f=h?s[2]:0;let g;g="Luminosity"===i?composeSMaskLuminosity:composeSMaskAlpha;const m=Math.min(r,Math.ceil(1048576/n));for(let i=0;i<r;i+=m){const s=Math.min(m,r-i),v=t.getImageData(o-c,i+(l-d),n,s),b=e.getImageData(o,i+l,n,s);h&&composeSMaskBackdrop(v.data,u,p,f);g(v.data,b.data,a);e.putImageData(b,o,i+l)}}(e.context,n,a,o,e.subtype,e.backdrop,e.transferMap,i,s,e.offsetX,e.offsetY);t.save();t.globalAlpha=1;t.globalCompositeOperation="source-over";t.setTransform(1,0,0,1,0,0);t.drawImage(n.canvas,0,0);t.restore()}}function getImageSmoothingEnabled(t,e){const n=r.Util.singularValueDecompose2dScale(t);n[0]=Math.fround(n[0]);n[1]=Math.fround(n[1]);const s=Math.fround((globalThis.devicePixelRatio||1)*i.PixelsPerInch.PDF_TO_CSS_UNITS);return void 0!==e?e:n[0]<=s||n[1]<=s}const d=["butt","round","square"],h=["miter","round","bevel"],u={},p={};class CanvasGraphics{constructor(t,e,n,r,i,s,a,o){let{optionalContentConfig:l,markedContentStack:c=null}=s;this.ctx=t;this.current=new CanvasExtraState(this.ctx.canvas.width,this.ctx.canvas.height);this.stateStack=[];this.pendingClip=null;this.pendingEOFill=!1;this.res=null;this.xobjs=null;this.commonObjs=e;this.objs=n;this.canvasFactory=r;this.filterFactory=i;this.groupStack=[];this.processingType3=null;this.baseTransform=null;this.baseTransformStack=[];this.groupLevel=0;this.smaskStack=[];this.smaskCounter=0;this.tempSMask=null;this.suspendedCtx=null;this.contentVisible=!0;this.markedContentStack=c||[];this.optionalContentConfig=l;this.cachedCanvases=new CachedCanvases(this.canvasFactory);this.cachedPatterns=new Map;this.annotationCanvasMap=a;this.viewportScale=1;this.outputScaleX=1;this.outputScaleY=1;this.pageColors=o;this._cachedScaleForStroking=[-1,0];this._cachedGetSinglePixelWidth=null;this._cachedBitmapsMap=new Map}getObject(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return"string"==typeof t?t.startsWith("g_")?this.commonObjs.get(t):this.objs.get(t):e}beginDrawing(t){let{transform:e,viewport:n,transparency:r=!1,background:s=null}=t;const a=this.ctx.canvas.width,o=this.ctx.canvas.height,l=this.ctx.fillStyle;this.ctx.fillStyle=s||"#ffffff";this.ctx.fillRect(0,0,a,o);this.ctx.fillStyle=l;if(r){const t=this.cachedCanvases.getCanvas("transparent",a,o);this.compositeCtx=this.ctx;this.transparentCanvas=t.canvas;this.ctx=t.context;this.ctx.save();this.ctx.transform(...(0,i.getCurrentTransform)(this.compositeCtx))}this.ctx.save();resetCtxToDefault(this.ctx);if(e){this.ctx.transform(...e);this.outputScaleX=e[0];this.outputScaleY=e[0]}this.ctx.transform(...n.transform);this.viewportScale=n.scale;this.baseTransform=(0,i.getCurrentTransform)(this.ctx)}executeOperatorList(t,e,n,i){const s=t.argsArray,a=t.fnArray;let o=e||0;const l=s.length;if(l===o)return o;const c=l-o>10&&"function"==typeof n,d=c?Date.now()+15:0;let h=0;const u=this.commonObjs,p=this.objs;let f;for(;;){if(void 0!==i&&o===i.nextBreakPoint){i.breakIt(o,n);return o}f=a[o];if(f!==r.OPS.dependency)this[f].apply(this,s[o]);else for(const t of s[o]){const e=t.startsWith("g_")?u:p;if(!e.has(t)){e.get(t,n);return o}}o++;if(o===l)return o;if(c&&++h>10){if(Date.now()>d){n();return o}h=0}}}#xt(){for(;this.stateStack.length||this.inSMaskMode;)this.restore();this.ctx.restore();if(this.transparentCanvas){this.ctx=this.compositeCtx;this.ctx.save();this.ctx.setTransform(1,0,0,1,0,0);this.ctx.drawImage(this.transparentCanvas,0,0);this.ctx.restore();this.transparentCanvas=null}}endDrawing(){this.#xt();this.cachedCanvases.clear();this.cachedPatterns.clear();for(const t of this._cachedBitmapsMap.values()){for(const e of t.values())"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement&&(e.width=e.height=0);t.clear()}this._cachedBitmapsMap.clear();this.#Et()}#Et(){if(this.pageColors){const t=this.filterFactory.addHCMFilter(this.pageColors.foreground,this.pageColors.background);if("none"!==t){const e=this.ctx.filter;this.ctx.filter=t;this.ctx.drawImage(this.ctx.canvas,0,0);this.ctx.filter=e}}}_scaleImage(t,e){const n=t.width,r=t.height;let i,s,a=Math.max(Math.hypot(e[0],e[1]),1),o=Math.max(Math.hypot(e[2],e[3]),1),l=n,c=r,d="prescale1";for(;a>2&&l>1||o>2&&c>1;){let e=l,n=c;if(a>2&&l>1){e=l>=16384?Math.floor(l/2)-1||1:Math.ceil(l/2);a/=l/e}if(o>2&&c>1){n=c>=16384?Math.floor(c/2)-1||1:Math.ceil(c)/2;o/=c/n}i=this.cachedCanvases.getCanvas(d,e,n);s=i.context;s.clearRect(0,0,e,n);s.drawImage(t,0,0,l,c,0,0,e,n);t=i.canvas;l=e;c=n;d="prescale1"===d?"prescale2":"prescale1"}return{img:t,paintWidth:l,paintHeight:c}}_createMaskCanvas(t){const e=this.ctx,{width:n,height:a}=t,o=this.current.fillColor,l=this.current.patternFill,c=(0,i.getCurrentTransform)(e);let d,h,u,p;if((t.bitmap||t.data)&&t.count>1){const e=t.bitmap||t.data.buffer;h=JSON.stringify(l?c:[c.slice(0,4),o]);d=this._cachedBitmapsMap.get(e);if(!d){d=new Map;this._cachedBitmapsMap.set(e,d)}const n=d.get(h);if(n&&!l){return{canvas:n,offsetX:Math.round(Math.min(c[0],c[2])+c[4]),offsetY:Math.round(Math.min(c[1],c[3])+c[5])}}u=n}if(!u){p=this.cachedCanvases.getCanvas("maskCanvas",n,a);putBinaryImageMask(p.context,t)}let f=r.Util.transform(c,[1/n,0,0,-1/a,0,0]);f=r.Util.transform(f,[1,0,0,1,0,-a]);const g=r.Util.applyTransform([0,0],f),m=r.Util.applyTransform([n,a],f),v=r.Util.normalizeRect([g[0],g[1],m[0],m[1]]),b=Math.round(v[2]-v[0])||1,y=Math.round(v[3]-v[1])||1,A=this.cachedCanvases.getCanvas("fillCanvas",b,y),_=A.context,S=Math.min(g[0],m[0]),x=Math.min(g[1],m[1]);_.translate(-S,-x);_.transform(...f);if(!u){u=this._scaleImage(p.canvas,(0,i.getCurrentTransformInverse)(_));u=u.img;d&&l&&d.set(h,u)}_.imageSmoothingEnabled=getImageSmoothingEnabled((0,i.getCurrentTransform)(_),t.interpolate);drawImageAtIntegerCoords(_,u,0,0,u.width,u.height,0,0,n,a);_.globalCompositeOperation="source-in";const E=r.Util.transform((0,i.getCurrentTransformInverse)(_),[1,0,0,1,-S,-x]);_.fillStyle=l?o.getPattern(e,this,E,s.PathType.FILL):o;_.fillRect(0,0,n,a);if(d&&!l){this.cachedCanvases.delete("fillCanvas");d.set(h,A.canvas)}return{canvas:A.canvas,offsetX:Math.round(S),offsetY:Math.round(x)}}setLineWidth(t){t!==this.current.lineWidth&&(this._cachedScaleForStroking[0]=-1);this.current.lineWidth=t;this.ctx.lineWidth=t}setLineCap(t){this.ctx.lineCap=d[t]}setLineJoin(t){this.ctx.lineJoin=h[t]}setMiterLimit(t){this.ctx.miterLimit=t}setDash(t,e){const n=this.ctx;if(void 0!==n.setLineDash){n.setLineDash(t);n.lineDashOffset=e}}setRenderingIntent(t){}setFlatness(t){}setGState(t){for(const[e,n]of t)switch(e){case"LW":this.setLineWidth(n);break;case"LC":this.setLineCap(n);break;case"LJ":this.setLineJoin(n);break;case"ML":this.setMiterLimit(n);break;case"D":this.setDash(n[0],n[1]);break;case"RI":this.setRenderingIntent(n);break;case"FL":this.setFlatness(n);break;case"Font":this.setFont(n[0],n[1]);break;case"CA":this.current.strokeAlpha=n;break;case"ca":this.current.fillAlpha=n;this.ctx.globalAlpha=n;break;case"BM":this.ctx.globalCompositeOperation=n;break;case"SMask":this.current.activeSMask=n?this.tempSMask:null;this.tempSMask=null;this.checkSMaskState();break;case"TR":this.ctx.filter=this.current.transferMaps=this.filterFactory.addFilter(n)}}get inSMaskMode(){return!!this.suspendedCtx}checkSMaskState(){const t=this.inSMaskMode;this.current.activeSMask&&!t?this.beginSMaskMode():!this.current.activeSMask&&t&&this.endSMaskMode()}beginSMaskMode(){if(this.inSMaskMode)throw new Error("beginSMaskMode called while already in smask mode");const t=this.ctx.canvas.width,e=this.ctx.canvas.height,n="smaskGroupAt"+this.groupLevel,r=this.cachedCanvases.getCanvas(n,t,e);this.suspendedCtx=this.ctx;this.ctx=r.context;const s=this.ctx;s.setTransform(...(0,i.getCurrentTransform)(this.suspendedCtx));copyCtxState(this.suspendedCtx,s);!function mirrorContextOperations(t,e){if(t._removeMirroring)throw new Error("Context is already forwarding operations.");t.__originalSave=t.save;t.__originalRestore=t.restore;t.__originalRotate=t.rotate;t.__originalScale=t.scale;t.__originalTranslate=t.translate;t.__originalTransform=t.transform;t.__originalSetTransform=t.setTransform;t.__originalResetTransform=t.resetTransform;t.__originalClip=t.clip;t.__originalMoveTo=t.moveTo;t.__originalLineTo=t.lineTo;t.__originalBezierCurveTo=t.bezierCurveTo;t.__originalRect=t.rect;t.__originalClosePath=t.closePath;t.__originalBeginPath=t.beginPath;t._removeMirroring=()=>{t.save=t.__originalSave;t.restore=t.__originalRestore;t.rotate=t.__originalRotate;t.scale=t.__originalScale;t.translate=t.__originalTranslate;t.transform=t.__originalTransform;t.setTransform=t.__originalSetTransform;t.resetTransform=t.__originalResetTransform;t.clip=t.__originalClip;t.moveTo=t.__originalMoveTo;t.lineTo=t.__originalLineTo;t.bezierCurveTo=t.__originalBezierCurveTo;t.rect=t.__originalRect;t.closePath=t.__originalClosePath;t.beginPath=t.__originalBeginPath;delete t._removeMirroring};t.save=function ctxSave(){e.save();this.__originalSave()};t.restore=function ctxRestore(){e.restore();this.__originalRestore()};t.translate=function ctxTranslate(t,n){e.translate(t,n);this.__originalTranslate(t,n)};t.scale=function ctxScale(t,n){e.scale(t,n);this.__originalScale(t,n)};t.transform=function ctxTransform(t,n,r,i,s,a){e.transform(t,n,r,i,s,a);this.__originalTransform(t,n,r,i,s,a)};t.setTransform=function ctxSetTransform(t,n,r,i,s,a){e.setTransform(t,n,r,i,s,a);this.__originalSetTransform(t,n,r,i,s,a)};t.resetTransform=function ctxResetTransform(){e.resetTransform();this.__originalResetTransform()};t.rotate=function ctxRotate(t){e.rotate(t);this.__originalRotate(t)};t.clip=function ctxRotate(t){e.clip(t);this.__originalClip(t)};t.moveTo=function(t,n){e.moveTo(t,n);this.__originalMoveTo(t,n)};t.lineTo=function(t,n){e.lineTo(t,n);this.__originalLineTo(t,n)};t.bezierCurveTo=function(t,n,r,i,s,a){e.bezierCurveTo(t,n,r,i,s,a);this.__originalBezierCurveTo(t,n,r,i,s,a)};t.rect=function(t,n,r,i){e.rect(t,n,r,i);this.__originalRect(t,n,r,i)};t.closePath=function(){e.closePath();this.__originalClosePath()};t.beginPath=function(){e.beginPath();this.__originalBeginPath()}}(s,this.suspendedCtx);this.setGState([["BM","source-over"],["ca",1],["CA",1]])}endSMaskMode(){if(!this.inSMaskMode)throw new Error("endSMaskMode called while not in smask mode");this.ctx._removeMirroring();copyCtxState(this.ctx,this.suspendedCtx);this.ctx=this.suspendedCtx;this.suspendedCtx=null}compose(t){if(!this.current.activeSMask)return;if(t){t[0]=Math.floor(t[0]);t[1]=Math.floor(t[1]);t[2]=Math.ceil(t[2]);t[3]=Math.ceil(t[3])}else t=[0,0,this.ctx.canvas.width,this.ctx.canvas.height];const e=this.current.activeSMask;composeSMask(this.suspendedCtx,e,this.ctx,t);this.ctx.save();this.ctx.setTransform(1,0,0,1,0,0);this.ctx.clearRect(0,0,this.ctx.canvas.width,this.ctx.canvas.height);this.ctx.restore()}save(){if(this.inSMaskMode){copyCtxState(this.ctx,this.suspendedCtx);this.suspendedCtx.save()}else this.ctx.save();const t=this.current;this.stateStack.push(t);this.current=t.clone()}restore(){0===this.stateStack.length&&this.inSMaskMode&&this.endSMaskMode();if(0!==this.stateStack.length){this.current=this.stateStack.pop();if(this.inSMaskMode){this.suspendedCtx.restore();copyCtxState(this.suspendedCtx,this.ctx)}else this.ctx.restore();this.checkSMaskState();this.pendingClip=null;this._cachedScaleForStroking[0]=-1;this._cachedGetSinglePixelWidth=null}}transform(t,e,n,r,i,s){this.ctx.transform(t,e,n,r,i,s);this._cachedScaleForStroking[0]=-1;this._cachedGetSinglePixelWidth=null}constructPath(t,e,n){const s=this.ctx,a=this.current;let o,l,c=a.x,d=a.y;const h=(0,i.getCurrentTransform)(s),u=0===h[0]&&0===h[3]||0===h[1]&&0===h[2],p=u?n.slice(0):null;for(let n=0,i=0,f=t.length;n<f;n++)switch(0|t[n]){case r.OPS.rectangle:c=e[i++];d=e[i++];const t=e[i++],n=e[i++],f=c+t,g=d+n;s.moveTo(c,d);if(0===t||0===n)s.lineTo(f,g);else{s.lineTo(f,d);s.lineTo(f,g);s.lineTo(c,g)}u||a.updateRectMinMax(h,[c,d,f,g]);s.closePath();break;case r.OPS.moveTo:c=e[i++];d=e[i++];s.moveTo(c,d);u||a.updatePathMinMax(h,c,d);break;case r.OPS.lineTo:c=e[i++];d=e[i++];s.lineTo(c,d);u||a.updatePathMinMax(h,c,d);break;case r.OPS.curveTo:o=c;l=d;c=e[i+4];d=e[i+5];s.bezierCurveTo(e[i],e[i+1],e[i+2],e[i+3],c,d);a.updateCurvePathMinMax(h,o,l,e[i],e[i+1],e[i+2],e[i+3],c,d,p);i+=6;break;case r.OPS.curveTo2:o=c;l=d;s.bezierCurveTo(c,d,e[i],e[i+1],e[i+2],e[i+3]);a.updateCurvePathMinMax(h,o,l,c,d,e[i],e[i+1],e[i+2],e[i+3],p);c=e[i+2];d=e[i+3];i+=4;break;case r.OPS.curveTo3:o=c;l=d;c=e[i+2];d=e[i+3];s.bezierCurveTo(e[i],e[i+1],c,d,c,d);a.updateCurvePathMinMax(h,o,l,e[i],e[i+1],c,d,c,d,p);i+=4;break;case r.OPS.closePath:s.closePath()}u&&a.updateScalingPathMinMax(h,p);a.setCurrentPoint(c,d)}closePath(){this.ctx.closePath()}stroke(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const e=this.ctx,n=this.current.strokeColor;e.globalAlpha=this.current.strokeAlpha;if(this.contentVisible)if("object"==typeof n&&null!=n&&n.getPattern){e.save();e.strokeStyle=n.getPattern(e,this,(0,i.getCurrentTransformInverse)(e),s.PathType.STROKE);this.rescaleAndStroke(!1);e.restore()}else this.rescaleAndStroke(!0);t&&this.consumePath(this.current.getClippedPathBoundingBox());e.globalAlpha=this.current.fillAlpha}closeStroke(){this.closePath();this.stroke()}fill(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const e=this.ctx,n=this.current.fillColor;let r=!1;if(this.current.patternFill){e.save();e.fillStyle=n.getPattern(e,this,(0,i.getCurrentTransformInverse)(e),s.PathType.FILL);r=!0}const a=this.current.getClippedPathBoundingBox();if(this.contentVisible&&null!==a)if(this.pendingEOFill){e.fill("evenodd");this.pendingEOFill=!1}else e.fill();r&&e.restore();t&&this.consumePath(a)}eoFill(){this.pendingEOFill=!0;this.fill()}fillStroke(){this.fill(!1);this.stroke(!1);this.consumePath()}eoFillStroke(){this.pendingEOFill=!0;this.fillStroke()}closeFillStroke(){this.closePath();this.fillStroke()}closeEOFillStroke(){this.pendingEOFill=!0;this.closePath();this.fillStroke()}endPath(){this.consumePath()}clip(){this.pendingClip=u}eoClip(){this.pendingClip=p}beginText(){this.current.textMatrix=r.IDENTITY_MATRIX;this.current.textMatrixScale=1;this.current.x=this.current.lineX=0;this.current.y=this.current.lineY=0}endText(){const t=this.pendingTextPaths,e=this.ctx;if(void 0!==t){e.save();e.beginPath();for(const n of t){e.setTransform(...n.transform);e.translate(n.x,n.y);n.addToPath(e,n.fontSize)}e.restore();e.clip();e.beginPath();delete this.pendingTextPaths}else e.beginPath()}setCharSpacing(t){this.current.charSpacing=t}setWordSpacing(t){this.current.wordSpacing=t}setHScale(t){this.current.textHScale=t/100}setLeading(t){this.current.leading=-t}setFont(t,e){var n;const i=this.commonObjs.get(t),s=this.current;if(!i)throw new Error(`Can't find font for ${t}`);s.fontMatrix=i.fontMatrix||r.FONT_IDENTITY_MATRIX;0!==s.fontMatrix[0]&&0!==s.fontMatrix[3]||(0,r.warn)("Invalid font matrix for font "+t);if(e<0){e=-e;s.fontDirection=-1}else s.fontDirection=1;this.current.font=i;this.current.fontSize=e;if(i.isType3Font)return;const a=i.loadedName||"sans-serif",o=(null===(n=i.systemFontInfo)||void 0===n?void 0:n.css)||`"${a}", ${i.fallbackName}`;let l="normal";i.black?l="900":i.bold&&(l="bold");const c=i.italic?"italic":"normal";let d=e;e<16?d=16:e>100&&(d=100);this.current.fontSizeScale=e/d;this.ctx.font=`${c} ${l} ${d}px ${o}`}setTextRenderingMode(t){this.current.textRenderingMode=t}setTextRise(t){this.current.textRise=t}moveText(t,e){this.current.x=this.current.lineX+=t;this.current.y=this.current.lineY+=e}setLeadingMoveText(t,e){this.setLeading(-e);this.moveText(t,e)}setTextMatrix(t,e,n,r,i,s){this.current.textMatrix=[t,e,n,r,i,s];this.current.textMatrixScale=Math.hypot(t,e);this.current.x=this.current.lineX=0;this.current.y=this.current.lineY=0}nextLine(){this.moveText(0,this.current.leading)}paintChar(t,e,n,s){const a=this.ctx,o=this.current,l=o.font,c=o.textRenderingMode,d=o.fontSize/o.fontSizeScale,h=c&r.TextRenderingMode.FILL_STROKE_MASK,u=!!(c&r.TextRenderingMode.ADD_TO_PATH_FLAG),p=o.patternFill&&!l.missingFile;let f;(l.disableFontFace||u||p)&&(f=l.getPathGenerator(this.commonObjs,t));if(l.disableFontFace||p){a.save();a.translate(e,n);a.beginPath();f(a,d);s&&a.setTransform(...s);h!==r.TextRenderingMode.FILL&&h!==r.TextRenderingMode.FILL_STROKE||a.fill();h!==r.TextRenderingMode.STROKE&&h!==r.TextRenderingMode.FILL_STROKE||a.stroke();a.restore()}else{h!==r.TextRenderingMode.FILL&&h!==r.TextRenderingMode.FILL_STROKE||a.fillText(t,e,n);h!==r.TextRenderingMode.STROKE&&h!==r.TextRenderingMode.FILL_STROKE||a.strokeText(t,e,n)}if(u){(this.pendingTextPaths||=[]).push({transform:(0,i.getCurrentTransform)(a),x:e,y:n,fontSize:d,addToPath:f})}}get isFontSubpixelAAEnabled(){const{context:t}=this.cachedCanvases.getCanvas("isFontSubpixelAAEnabled",10,10);t.scale(1.5,1);t.fillText("I",0,10);const e=t.getImageData(0,0,10,10).data;let n=!1;for(let t=3;t<e.length;t+=4)if(e[t]>0&&e[t]<255){n=!0;break}return(0,r.shadow)(this,"isFontSubpixelAAEnabled",n)}showText(t){const e=this.current,n=e.font;if(n.isType3Font)return this.showType3Text(t);const a=e.fontSize;if(0===a)return;const o=this.ctx,l=e.fontSizeScale,c=e.charSpacing,d=e.wordSpacing,h=e.fontDirection,u=e.textHScale*h,p=t.length,f=n.vertical,g=f?1:-1,m=n.defaultVMetrics,v=a*e.fontMatrix[0],b=e.textRenderingMode===r.TextRenderingMode.FILL&&!n.disableFontFace&&!e.patternFill;o.save();o.transform(...e.textMatrix);o.translate(e.x,e.y+e.textRise);h>0?o.scale(u,-1):o.scale(u,1);let y;if(e.patternFill){o.save();const t=e.fillColor.getPattern(o,this,(0,i.getCurrentTransformInverse)(o),s.PathType.FILL);y=(0,i.getCurrentTransform)(o);o.restore();o.fillStyle=t}let A=e.lineWidth;const _=e.textMatrixScale;if(0===_||0===A){const t=e.textRenderingMode&r.TextRenderingMode.FILL_STROKE_MASK;t!==r.TextRenderingMode.STROKE&&t!==r.TextRenderingMode.FILL_STROKE||(A=this.getSinglePixelWidth())}else A/=_;if(1!==l){o.scale(l,l);A/=l}o.lineWidth=A;if(n.isInvalidPDFjsFont){const n=[];let r=0;for(const e of t){n.push(e.unicode);r+=e.width}o.fillText(n.join(""),0,0);e.x+=r*v*u;o.restore();this.compose();return}let S,x=0;for(S=0;S<p;++S){const e=t[S];if("number"==typeof e){x+=g*e*a/1e3;continue}let r=!1;const i=(e.isSpace?d:0)+c,s=e.fontChar,u=e.accent;let p,A,_,E=e.width;if(f){const t=e.vmetric||m,n=-(e.vmetric?t[1]:.5*E)*v,r=t[2]*v;E=t?-t[0]:E;p=n/l;A=(x+r)/l}else{p=x/l;A=0}if(n.remeasure&&E>0){const t=1e3*o.measureText(s).width/a*l;if(E<t&&this.isFontSubpixelAAEnabled){const e=E/t;r=!0;o.save();o.scale(e,1);p/=e}else E!==t&&(p+=(E-t)/2e3*a/l)}if(this.contentVisible&&(e.isInFont||n.missingFile))if(b&&!u)o.fillText(s,p,A);else{this.paintChar(s,p,A,y);if(u){const t=p+a*u.offset.x/l,e=A-a*u.offset.y/l;this.paintChar(u.fontChar,t,e,y)}}_=f?E*v-i*h:E*v+i*h;x+=_;r&&o.restore()}f?e.y-=x:e.x+=x*u;o.restore();this.compose()}showType3Text(t){const e=this.ctx,n=this.current,i=n.font,s=n.fontSize,a=n.fontDirection,o=i.vertical?1:-1,l=n.charSpacing,c=n.wordSpacing,d=n.textHScale*a,h=n.fontMatrix||r.FONT_IDENTITY_MATRIX,u=t.length;let p,f,g,m;if(!(n.textRenderingMode===r.TextRenderingMode.INVISIBLE)&&0!==s){this._cachedScaleForStroking[0]=-1;this._cachedGetSinglePixelWidth=null;e.save();e.transform(...n.textMatrix);e.translate(n.x,n.y);e.scale(d,a);for(p=0;p<u;++p){f=t[p];if("number"==typeof f){m=o*f*s/1e3;this.ctx.translate(m,0);n.x+=m*d;continue}const a=(f.isSpace?c:0)+l,u=i.charProcOperatorList[f.operatorListId];if(!u){(0,r.warn)(`Type3 character "${f.operatorListId}" is not available.`);continue}if(this.contentVisible){this.processingType3=f;this.save();e.scale(s,s);e.transform(...h);this.executeOperatorList(u);this.restore()}g=r.Util.applyTransform([f.width,0],h)[0]*s+a;e.translate(g,0);n.x+=g*d}e.restore();this.processingType3=null}}setCharWidth(t,e){}setCharWidthAndBounds(t,e,n,r,i,s){this.ctx.rect(n,r,i-n,s-r);this.ctx.clip();this.endPath()}getColorN_Pattern(t){let e;if("TilingPattern"===t[0]){const n=t[1],r=this.baseTransform||(0,i.getCurrentTransform)(this.ctx),a={createCanvasGraphics:t=>new CanvasGraphics(t,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:this.optionalContentConfig,markedContentStack:this.markedContentStack})};e=new s.TilingPattern(t,n,this.ctx,a,r)}else e=this._getPattern(t[1],t[2]);return e}setStrokeColorN(){this.current.strokeColor=this.getColorN_Pattern(arguments)}setFillColorN(){this.current.fillColor=this.getColorN_Pattern(arguments);this.current.patternFill=!0}setStrokeRGBColor(t,e,n){const i=r.Util.makeHexColor(t,e,n);this.ctx.strokeStyle=i;this.current.strokeColor=i}setFillRGBColor(t,e,n){const i=r.Util.makeHexColor(t,e,n);this.ctx.fillStyle=i;this.current.fillColor=i;this.current.patternFill=!1}_getPattern(t){let e,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(this.cachedPatterns.has(t))e=this.cachedPatterns.get(t);else{e=(0,s.getShadingPattern)(this.getObject(t));this.cachedPatterns.set(t,e)}n&&(e.matrix=n);return e}shadingFill(t){if(!this.contentVisible)return;const e=this.ctx;this.save();const n=this._getPattern(t);e.fillStyle=n.getPattern(e,this,(0,i.getCurrentTransformInverse)(e),s.PathType.SHADING);const a=(0,i.getCurrentTransformInverse)(e);if(a){const t=e.canvas,n=t.width,i=t.height,s=r.Util.applyTransform([0,0],a),o=r.Util.applyTransform([0,i],a),l=r.Util.applyTransform([n,0],a),c=r.Util.applyTransform([n,i],a),d=Math.min(s[0],o[0],l[0],c[0]),h=Math.min(s[1],o[1],l[1],c[1]),u=Math.max(s[0],o[0],l[0],c[0]),p=Math.max(s[1],o[1],l[1],c[1]);this.ctx.fillRect(d,h,u-d,p-h)}else this.ctx.fillRect(-1e10,-1e10,2e10,2e10);this.compose(this.current.getClippedPathBoundingBox());this.restore()}beginInlineImage(){(0,r.unreachable)("Should not call beginInlineImage")}beginImageData(){(0,r.unreachable)("Should not call beginImageData")}paintFormXObjectBegin(t,e){if(this.contentVisible){this.save();this.baseTransformStack.push(this.baseTransform);Array.isArray(t)&&6===t.length&&this.transform(...t);this.baseTransform=(0,i.getCurrentTransform)(this.ctx);if(e){const t=e[2]-e[0],n=e[3]-e[1];this.ctx.rect(e[0],e[1],t,n);this.current.updateRectMinMax((0,i.getCurrentTransform)(this.ctx),e);this.clip();this.endPath()}}}paintFormXObjectEnd(){if(this.contentVisible){this.restore();this.baseTransform=this.baseTransformStack.pop()}}beginGroup(t){if(!this.contentVisible)return;this.save();if(this.inSMaskMode){this.endSMaskMode();this.current.activeSMask=null}const e=this.ctx;t.isolated||(0,r.info)("TODO: Support non-isolated groups.");t.knockout&&(0,r.warn)("Knockout groups not supported.");const n=(0,i.getCurrentTransform)(e);t.matrix&&e.transform(...t.matrix);if(!t.bbox)throw new Error("Bounding box is required.");let s=r.Util.getAxialAlignedBoundingBox(t.bbox,(0,i.getCurrentTransform)(e));const a=[0,0,e.canvas.width,e.canvas.height];s=r.Util.intersect(s,a)||[0,0,0,0];const o=Math.floor(s[0]),c=Math.floor(s[1]);let d=Math.max(Math.ceil(s[2])-o,1),h=Math.max(Math.ceil(s[3])-c,1),u=1,p=1;if(d>l){u=d/l;d=l}if(h>l){p=h/l;h=l}this.current.startNewPathAndClipBox([0,0,d,h]);let f="groupAt"+this.groupLevel;t.smask&&(f+="_smask_"+this.smaskCounter++%2);const g=this.cachedCanvases.getCanvas(f,d,h),m=g.context;m.scale(1/u,1/p);m.translate(-o,-c);m.transform(...n);if(t.smask)this.smaskStack.push({canvas:g.canvas,context:m,offsetX:o,offsetY:c,scaleX:u,scaleY:p,subtype:t.smask.subtype,backdrop:t.smask.backdrop,transferMap:t.smask.transferMap||null,startTransformInverse:null});else{e.setTransform(1,0,0,1,0,0);e.translate(o,c);e.scale(u,p);e.save()}copyCtxState(e,m);this.ctx=m;this.setGState([["BM","source-over"],["ca",1],["CA",1]]);this.groupStack.push(e);this.groupLevel++}endGroup(t){if(!this.contentVisible)return;this.groupLevel--;const e=this.ctx,n=this.groupStack.pop();this.ctx=n;this.ctx.imageSmoothingEnabled=!1;if(t.smask){this.tempSMask=this.smaskStack.pop();this.restore()}else{this.ctx.restore();const t=(0,i.getCurrentTransform)(this.ctx);this.restore();this.ctx.save();this.ctx.setTransform(...t);const n=r.Util.getAxialAlignedBoundingBox([0,0,e.canvas.width,e.canvas.height],t);this.ctx.drawImage(e.canvas,0,0);this.ctx.restore();this.compose(n)}}beginAnnotation(t,e,n,s,a){this.#xt();resetCtxToDefault(this.ctx);this.ctx.save();this.save();this.baseTransform&&this.ctx.setTransform(...this.baseTransform);if(Array.isArray(e)&&4===e.length){const s=e[2]-e[0],o=e[3]-e[1];if(a&&this.annotationCanvasMap){(n=n.slice())[4]-=e[0];n[5]-=e[1];(e=e.slice())[0]=e[1]=0;e[2]=s;e[3]=o;const[a,l]=r.Util.singularValueDecompose2dScale((0,i.getCurrentTransform)(this.ctx)),{viewportScale:c}=this,d=Math.ceil(s*this.outputScaleX*c),h=Math.ceil(o*this.outputScaleY*c);this.annotationCanvas=this.canvasFactory.create(d,h);const{canvas:u,context:p}=this.annotationCanvas;this.annotationCanvasMap.set(t,u);this.annotationCanvas.savedCtx=this.ctx;this.ctx=p;this.ctx.save();this.ctx.setTransform(a,0,0,-l,0,o*l);resetCtxToDefault(this.ctx)}else{resetCtxToDefault(this.ctx);this.ctx.rect(e[0],e[1],s,o);this.ctx.clip();this.endPath()}}this.current=new CanvasExtraState(this.ctx.canvas.width,this.ctx.canvas.height);this.transform(...n);this.transform(...s)}endAnnotation(){if(this.annotationCanvas){this.ctx.restore();this.#Et();this.ctx=this.annotationCanvas.savedCtx;delete this.annotationCanvas.savedCtx;delete this.annotationCanvas}}paintImageMaskXObject(t){if(!this.contentVisible)return;const e=t.count;(t=this.getObject(t.data,t)).count=e;const n=this.ctx,r=this.processingType3;if(r){void 0===r.compiled&&(r.compiled=function compileType3Glyph(t){const{width:e,height:n}=t;if(e>1e3||n>1e3)return null;const r=new Uint8Array([0,2,4,0,1,0,5,4,8,10,0,8,0,2,1,0]),i=e+1;let s,a,o,l=new Uint8Array(i*(n+1));const c=e+7&-8;let d=new Uint8Array(c*n),h=0;for(const e of t.data){let t=128;for(;t>0;){d[h++]=e&t?0:255;t>>=1}}let u=0;h=0;if(0!==d[h]){l[0]=1;++u}for(a=1;a<e;a++){if(d[h]!==d[h+1]){l[a]=d[h]?2:1;++u}h++}if(0!==d[h]){l[a]=2;++u}for(s=1;s<n;s++){h=s*c;o=s*i;if(d[h-c]!==d[h]){l[o]=d[h]?1:8;++u}let t=(d[h]?4:0)+(d[h-c]?8:0);for(a=1;a<e;a++){t=(t>>2)+(d[h+1]?4:0)+(d[h-c+1]?8:0);if(r[t]){l[o+a]=r[t];++u}h++}if(d[h-c]!==d[h]){l[o+a]=d[h]?2:4;++u}if(u>1e3)return null}h=c*(n-1);o=s*i;if(0!==d[h]){l[o]=8;++u}for(a=1;a<e;a++){if(d[h]!==d[h+1]){l[o+a]=d[h]?4:8;++u}h++}if(0!==d[h]){l[o+a]=4;++u}if(u>1e3)return null;const p=new Int32Array([0,i,-1,0,-i,0,0,0,1]),f=new Path2D;for(s=0;u&&s<=n;s++){let t=s*i;const n=t+e;for(;t<n&&!l[t];)t++;if(t===n)continue;f.moveTo(t%i,s);const r=t;let a=l[t];do{const e=p[a];do{t+=e}while(!l[t]);const n=l[t];if(5!==n&&10!==n){a=n;l[t]=0}else{a=n&51*a>>4;l[t]&=a>>2|a<<2}f.lineTo(t%i,t/i|0);l[t]||--u}while(r!==t);--s}d=null;l=null;return function(t){t.save();t.scale(1/e,-1/n);t.translate(0,-n);t.fill(f);t.beginPath();t.restore()}}(t));if(r.compiled){r.compiled(n);return}}const i=this._createMaskCanvas(t),s=i.canvas;n.save();n.setTransform(1,0,0,1,0,0);n.drawImage(s,i.offsetX,i.offsetY);n.restore();this.compose()}paintImageMaskXObjectRepeat(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,a=arguments.length>4?arguments[4]:void 0,o=arguments.length>5?arguments[5]:void 0;if(!this.contentVisible)return;t=this.getObject(t.data,t);const l=this.ctx;l.save();const c=(0,i.getCurrentTransform)(l);l.transform(e,n,s,a,0,0);const d=this._createMaskCanvas(t);l.setTransform(1,0,0,1,d.offsetX-c[4],d.offsetY-c[5]);for(let t=0,i=o.length;t<i;t+=2){const i=r.Util.transform(c,[e,n,s,a,o[t],o[t+1]]),[h,u]=r.Util.applyTransform([0,0],i);l.drawImage(d.canvas,h,u)}l.restore();this.compose()}paintImageMaskXObjectGroup(t){if(!this.contentVisible)return;const e=this.ctx,n=this.current.fillColor,r=this.current.patternFill;for(const a of t){const{data:t,width:o,height:l,transform:c}=a,d=this.cachedCanvases.getCanvas("maskCanvas",o,l),h=d.context;h.save();putBinaryImageMask(h,this.getObject(t,a));h.globalCompositeOperation="source-in";h.fillStyle=r?n.getPattern(h,this,(0,i.getCurrentTransformInverse)(e),s.PathType.FILL):n;h.fillRect(0,0,o,l);h.restore();e.save();e.transform(...c);e.scale(1,-1);drawImageAtIntegerCoords(e,d.canvas,0,0,o,l,0,-1,1,1);e.restore()}this.compose()}paintImageXObject(t){if(!this.contentVisible)return;const e=this.getObject(t);e?this.paintInlineImageXObject(e):(0,r.warn)("Dependent image isn't ready yet")}paintImageXObjectRepeat(t,e,n,i){if(!this.contentVisible)return;const s=this.getObject(t);if(!s){(0,r.warn)("Dependent image isn't ready yet");return}const a=s.width,o=s.height,l=[];for(let t=0,r=i.length;t<r;t+=2)l.push({transform:[e,0,0,n,i[t],i[t+1]],x:0,y:0,w:a,h:o});this.paintInlineImageXObjectGroup(s,l)}applyTransferMapsToCanvas(t){if("none"!==this.current.transferMaps){t.filter=this.current.transferMaps;t.drawImage(t.canvas,0,0);t.filter="none"}return t.canvas}applyTransferMapsToBitmap(t){if("none"===this.current.transferMaps)return t.bitmap;const{bitmap:e,width:n,height:r}=t,i=this.cachedCanvases.getCanvas("inlineImage",n,r),s=i.context;s.filter=this.current.transferMaps;s.drawImage(e,0,0);s.filter="none";return i.canvas}paintInlineImageXObject(t){if(!this.contentVisible)return;const e=t.width,n=t.height,r=this.ctx;this.save();o.isNodeJS||(r.filter="none");r.scale(1/e,-1/n);let s;if(t.bitmap)s=this.applyTransferMapsToBitmap(t);else if("function"==typeof HTMLElement&&t instanceof HTMLElement||!t.data)s=t;else{const r=this.cachedCanvases.getCanvas("inlineImage",e,n).context;putBinaryImageData(r,t);s=this.applyTransferMapsToCanvas(r)}const a=this._scaleImage(s,(0,i.getCurrentTransformInverse)(r));r.imageSmoothingEnabled=getImageSmoothingEnabled((0,i.getCurrentTransform)(r),t.interpolate);drawImageAtIntegerCoords(r,a.img,0,0,a.paintWidth,a.paintHeight,0,-n,e,n);this.compose();this.restore()}paintInlineImageXObjectGroup(t,e){if(!this.contentVisible)return;const n=this.ctx;let r;if(t.bitmap)r=t.bitmap;else{const e=t.width,n=t.height,i=this.cachedCanvases.getCanvas("inlineImage",e,n).context;putBinaryImageData(i,t);r=this.applyTransferMapsToCanvas(i)}for(const t of e){n.save();n.transform(...t.transform);n.scale(1,-1);drawImageAtIntegerCoords(n,r,t.x,t.y,t.w,t.h,0,-1,1,1);n.restore()}this.compose()}paintSolidColorImageMask(){if(this.contentVisible){this.ctx.fillRect(0,0,1,1);this.compose()}}markPoint(t){}markPointProps(t,e){}beginMarkedContent(t){this.markedContentStack.push({visible:!0})}beginMarkedContentProps(t,e){"OC"===t?this.markedContentStack.push({visible:this.optionalContentConfig.isVisible(e)}):this.markedContentStack.push({visible:!0});this.contentVisible=this.isContentVisible()}endMarkedContent(){this.markedContentStack.pop();this.contentVisible=this.isContentVisible()}beginCompat(){}endCompat(){}consumePath(t){const e=this.current.isEmptyClip();this.pendingClip&&this.current.updateClipFromPath();this.pendingClip||this.compose(t);const n=this.ctx;if(this.pendingClip){e||(this.pendingClip===p?n.clip("evenodd"):n.clip());this.pendingClip=null}this.current.startNewPathAndClipBox(this.current.clipBox);n.beginPath()}getSinglePixelWidth(){if(!this._cachedGetSinglePixelWidth){const t=(0,i.getCurrentTransform)(this.ctx);if(0===t[1]&&0===t[2])this._cachedGetSinglePixelWidth=1/Math.min(Math.abs(t[0]),Math.abs(t[3]));else{const e=Math.abs(t[0]*t[3]-t[2]*t[1]),n=Math.hypot(t[0],t[2]),r=Math.hypot(t[1],t[3]);this._cachedGetSinglePixelWidth=Math.max(n,r)/e}}return this._cachedGetSinglePixelWidth}getScaleForStroking(){if(-1===this._cachedScaleForStroking[0]){const{lineWidth:t}=this.current,{a:e,b:n,c:r,d:i}=this.ctx.getTransform();let s,a;if(0===n&&0===r){const n=Math.abs(e),r=Math.abs(i);if(n===r)if(0===t)s=a=1/n;else{const e=n*t;s=a=e<1?1/e:1}else if(0===t){s=1/n;a=1/r}else{const e=n*t,i=r*t;s=e<1?1/e:1;a=i<1?1/i:1}}else{const o=Math.abs(e*i-n*r),l=Math.hypot(e,n),c=Math.hypot(r,i);if(0===t){s=c/o;a=l/o}else{const e=t*o;s=c>e?c/e:1;a=l>e?l/e:1}}this._cachedScaleForStroking[0]=s;this._cachedScaleForStroking[1]=a}return this._cachedScaleForStroking}rescaleAndStroke(t){const{ctx:e}=this,{lineWidth:n}=this.current,[r,i]=this.getScaleForStroking();e.lineWidth=n||1;if(1===r&&1===i){e.stroke();return}const s=e.getLineDash();t&&e.save();e.scale(r,i);if(s.length>0){const t=Math.max(r,i);e.setLineDash(s.map((e=>e/t)));e.lineDashOffset/=t}e.stroke();t&&e.restore()}isContentVisible(){for(let t=this.markedContentStack.length-1;t>=0;t--)if(!this.markedContentStack[t].visible)return!1;return!0}}e.CanvasGraphics=CanvasGraphics;for(const t in r.OPS)void 0!==CanvasGraphics.prototype[t]&&(CanvasGraphics.prototype[r.OPS[t]]=CanvasGraphics.prototype[t])},(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.TilingPattern=e.PathType=void 0;e.getShadingPattern=function getShadingPattern(t){switch(t[0]){case"RadialAxial":return new RadialAxialShadingPattern(t);case"Mesh":return new MeshShadingPattern(t);case"Dummy":return new DummyShadingPattern}throw new Error(`Unknown IR type: ${t[0]}`)};var r=n(1),i=n(142);const s={FILL:"Fill",STROKE:"Stroke",SHADING:"Shading"};e.PathType=s;function applyBoundingBox(t,e){if(!e)return;const n=e[2]-e[0],r=e[3]-e[1],i=new Path2D;i.rect(e[0],e[1],n,r);t.clip(i)}class BaseShadingPattern{constructor(){this.constructor===BaseShadingPattern&&(0,r.unreachable)("Cannot initialize BaseShadingPattern.")}getPattern(){(0,r.unreachable)("Abstract method `getPattern` called.")}}class RadialAxialShadingPattern extends BaseShadingPattern{constructor(t){super();this._type=t[1];this._bbox=t[2];this._colorStops=t[3];this._p0=t[4];this._p1=t[5];this._r0=t[6];this._r1=t[7];this.matrix=null}_createGradient(t){let e;"axial"===this._type?e=t.createLinearGradient(this._p0[0],this._p0[1],this._p1[0],this._p1[1]):"radial"===this._type&&(e=t.createRadialGradient(this._p0[0],this._p0[1],this._r0,this._p1[0],this._p1[1],this._r1));for(const t of this._colorStops)e.addColorStop(t[0],t[1]);return e}getPattern(t,e,n,a){let o;if(a===s.STROKE||a===s.FILL){const s=e.current.getClippedPathBoundingBox(a,(0,i.getCurrentTransform)(t))||[0,0,0,0],l=Math.ceil(s[2]-s[0])||1,c=Math.ceil(s[3]-s[1])||1,d=e.cachedCanvases.getCanvas("pattern",l,c,!0),h=d.context;h.clearRect(0,0,h.canvas.width,h.canvas.height);h.beginPath();h.rect(0,0,h.canvas.width,h.canvas.height);h.translate(-s[0],-s[1]);n=r.Util.transform(n,[1,0,0,1,s[0],s[1]]);h.transform(...e.baseTransform);this.matrix&&h.transform(...this.matrix);applyBoundingBox(h,this._bbox);h.fillStyle=this._createGradient(h);h.fill();o=t.createPattern(d.canvas,"no-repeat");const u=new DOMMatrix(n);o.setTransform(u)}else{applyBoundingBox(t,this._bbox);o=this._createGradient(t)}return o}}function drawTriangle(t,e,n,r,i,s,a,o){const l=e.coords,c=e.colors,d=t.data,h=4*t.width;let u;if(l[n+1]>l[r+1]){u=n;n=r;r=u;u=s;s=a;a=u}if(l[r+1]>l[i+1]){u=r;r=i;i=u;u=a;a=o;o=u}if(l[n+1]>l[r+1]){u=n;n=r;r=u;u=s;s=a;a=u}const p=(l[n]+e.offsetX)*e.scaleX,f=(l[n+1]+e.offsetY)*e.scaleY,g=(l[r]+e.offsetX)*e.scaleX,m=(l[r+1]+e.offsetY)*e.scaleY,v=(l[i]+e.offsetX)*e.scaleX,b=(l[i+1]+e.offsetY)*e.scaleY;if(f>=b)return;const y=c[s],A=c[s+1],_=c[s+2],S=c[a],x=c[a+1],E=c[a+2],C=c[o],w=c[o+1],P=c[o+2],T=Math.round(f),k=Math.round(b);let M,R,D,I,O,L,N,j;for(let t=T;t<=k;t++){if(t<m){let e;e=t<f?0:(f-t)/(f-m);M=p-(p-g)*e;R=y-(y-S)*e;D=A-(A-x)*e;I=_-(_-E)*e}else{let e;e=t>b?1:m===b?0:(m-t)/(m-b);M=g-(g-v)*e;R=S-(S-C)*e;D=x-(x-w)*e;I=E-(E-P)*e}let e;e=t<f?0:t>b?1:(f-t)/(f-b);O=p-(p-v)*e;L=y-(y-C)*e;N=A-(A-w)*e;j=_-(_-P)*e;const n=Math.round(Math.min(M,O)),r=Math.round(Math.max(M,O));let i=h*t+4*n;for(let t=n;t<=r;t++){e=(M-t)/(M-O);e<0?e=0:e>1&&(e=1);d[i++]=R-(R-L)*e|0;d[i++]=D-(D-N)*e|0;d[i++]=I-(I-j)*e|0;d[i++]=255}}}function drawFigure(t,e,n){const r=e.coords,i=e.colors;let s,a;switch(e.type){case"lattice":const o=e.verticesPerRow,l=Math.floor(r.length/o)-1,c=o-1;for(s=0;s<l;s++){let e=s*o;for(let s=0;s<c;s++,e++){drawTriangle(t,n,r[e],r[e+1],r[e+o],i[e],i[e+1],i[e+o]);drawTriangle(t,n,r[e+o+1],r[e+1],r[e+o],i[e+o+1],i[e+1],i[e+o])}}break;case"triangles":for(s=0,a=r.length;s<a;s+=3)drawTriangle(t,n,r[s],r[s+1],r[s+2],i[s],i[s+1],i[s+2]);break;default:throw new Error("illegal figure")}}class MeshShadingPattern extends BaseShadingPattern{constructor(t){super();this._coords=t[2];this._colors=t[3];this._figures=t[4];this._bounds=t[5];this._bbox=t[7];this._background=t[8];this.matrix=null}_createMeshCanvas(t,e,n){const r=Math.floor(this._bounds[0]),i=Math.floor(this._bounds[1]),s=Math.ceil(this._bounds[2])-r,a=Math.ceil(this._bounds[3])-i,o=Math.min(Math.ceil(Math.abs(s*t[0]*1.1)),3e3),l=Math.min(Math.ceil(Math.abs(a*t[1]*1.1)),3e3),c=s/o,d=a/l,h={coords:this._coords,colors:this._colors,offsetX:-r,offsetY:-i,scaleX:1/c,scaleY:1/d},u=o+4,p=l+4,f=n.getCanvas("mesh",u,p,!1),g=f.context,m=g.createImageData(o,l);if(e){const t=m.data;for(let n=0,r=t.length;n<r;n+=4){t[n]=e[0];t[n+1]=e[1];t[n+2]=e[2];t[n+3]=255}}for(const t of this._figures)drawFigure(m,t,h);g.putImageData(m,2,2);return{canvas:f.canvas,offsetX:r-2*c,offsetY:i-2*d,scaleX:c,scaleY:d}}getPattern(t,e,n,a){applyBoundingBox(t,this._bbox);let o;if(a===s.SHADING)o=r.Util.singularValueDecompose2dScale((0,i.getCurrentTransform)(t));else{o=r.Util.singularValueDecompose2dScale(e.baseTransform);if(this.matrix){const t=r.Util.singularValueDecompose2dScale(this.matrix);o=[o[0]*t[0],o[1]*t[1]]}}const l=this._createMeshCanvas(o,a===s.SHADING?null:this._background,e.cachedCanvases);if(a!==s.SHADING){t.setTransform(...e.baseTransform);this.matrix&&t.transform(...this.matrix)}t.translate(l.offsetX,l.offsetY);t.scale(l.scaleX,l.scaleY);return t.createPattern(l.canvas,"no-repeat")}}class DummyShadingPattern extends BaseShadingPattern{getPattern(){return"hotpink"}}const a=1,o=2;class TilingPattern{static MAX_PATTERN_SIZE=3e3;constructor(t,e,n,r,i){this.operatorList=t[2];this.matrix=t[3]||[1,0,0,1,0,0];this.bbox=t[4];this.xstep=t[5];this.ystep=t[6];this.paintType=t[7];this.tilingType=t[8];this.color=e;this.ctx=n;this.canvasGraphicsFactory=r;this.baseTransform=i}createPatternCanvas(t){const e=this.operatorList,n=this.bbox,s=this.xstep,a=this.ystep,o=this.paintType,l=this.tilingType,c=this.color,d=this.canvasGraphicsFactory;(0,r.info)("TilingType: "+l);const h=n[0],u=n[1],p=n[2],f=n[3],g=r.Util.singularValueDecompose2dScale(this.matrix),m=r.Util.singularValueDecompose2dScale(this.baseTransform),v=[g[0]*m[0],g[1]*m[1]],b=this.getSizeAndScale(s,this.ctx.canvas.width,v[0]),y=this.getSizeAndScale(a,this.ctx.canvas.height,v[1]),A=t.cachedCanvases.getCanvas("pattern",b.size,y.size,!0),_=A.context,S=d.createCanvasGraphics(_);S.groupLevel=t.groupLevel;this.setFillAndStrokeStyleToContext(S,o,c);let x=h,E=u,C=p,w=f;if(h<0){x=0;C+=Math.abs(h)}if(u<0){E=0;w+=Math.abs(u)}_.translate(-b.scale*x,-y.scale*E);S.transform(b.scale,0,0,y.scale,0,0);_.save();this.clipBbox(S,x,E,C,w);S.baseTransform=(0,i.getCurrentTransform)(S.ctx);S.executeOperatorList(e);S.endDrawing();return{canvas:A.canvas,scaleX:b.scale,scaleY:y.scale,offsetX:x,offsetY:E}}getSizeAndScale(t,e,n){t=Math.abs(t);const r=Math.max(TilingPattern.MAX_PATTERN_SIZE,e);let i=Math.ceil(t*n);i>=r?i=r:n=i/t;return{scale:n,size:i}}clipBbox(t,e,n,r,s){const a=r-e,o=s-n;t.ctx.rect(e,n,a,o);t.current.updateRectMinMax((0,i.getCurrentTransform)(t.ctx),[e,n,r,s]);t.clip();t.endPath()}setFillAndStrokeStyleToContext(t,e,n){const i=t.ctx,s=t.current;switch(e){case a:const t=this.ctx;i.fillStyle=t.fillStyle;i.strokeStyle=t.strokeStyle;s.fillColor=t.fillStyle;s.strokeColor=t.strokeStyle;break;case o:const l=r.Util.makeHexColor(n[0],n[1],n[2]);i.fillStyle=l;i.strokeStyle=l;s.fillColor=l;s.strokeColor=l;break;default:throw new r.FormatError(`Unsupported paint type: ${e}`)}}getPattern(t,e,n,i){let a=n;if(i!==s.SHADING){a=r.Util.transform(a,e.baseTransform);this.matrix&&(a=r.Util.transform(a,this.matrix))}const o=this.createPatternCanvas(e);let l=new DOMMatrix(a);l=l.translate(o.offsetX,o.offsetY);l=l.scale(1/o.scaleX,1/o.scaleY);const c=t.createPattern(o.canvas,"repeat");c.setTransform(l);return c}}e.TilingPattern=TilingPattern},(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.convertBlackAndWhiteToRGBA=convertBlackAndWhiteToRGBA;e.convertToRGBA=function convertToRGBA(t){switch(t.kind){case r.ImageKind.GRAYSCALE_1BPP:return convertBlackAndWhiteToRGBA(t);case r.ImageKind.RGB_24BPP:return function convertRGBToRGBA(t){let{src:e,srcPos:n=0,dest:i,destPos:s=0,width:a,height:o}=t,l=0;const c=e.length>>2,d=new Uint32Array(e.buffer,n,c);if(r.FeatureTest.isLittleEndian){for(;l<c-2;l+=3,s+=4){const t=d[l],e=d[l+1],n=d[l+2];i[s]=4278190080|t;i[s+1]=t>>>24|e<<8|4278190080;i[s+2]=e>>>16|n<<16|4278190080;i[s+3]=n>>>8|4278190080}for(let t=4*l,n=e.length;t<n;t+=3)i[s++]=e[t]|e[t+1]<<8|e[t+2]<<16|4278190080}else{for(;l<c-2;l+=3,s+=4){const t=d[l],e=d[l+1],n=d[l+2];i[s]=255|t;i[s+1]=t<<24|e>>>8|255;i[s+2]=e<<16|n>>>16|255;i[s+3]=n<<8|255}for(let t=4*l,n=e.length;t<n;t+=3)i[s++]=e[t]<<24|e[t+1]<<16|e[t+2]<<8|255}return{srcPos:n,destPos:s}}(t)}return null};e.grayToRGBA=function grayToRGBA(t,e){if(r.FeatureTest.isLittleEndian)for(let n=0,r=t.length;n<r;n++)e[n]=65793*t[n]|4278190080;else for(let n=0,r=t.length;n<r;n++)e[n]=16843008*t[n]|255};var r=n(1);function convertBlackAndWhiteToRGBA(t){let{src:e,srcPos:n=0,dest:i,width:s,height:a,nonBlackColor:o=4294967295,inverseDecode:l=!1}=t;const c=r.FeatureTest.isLittleEndian?4278190080:255,[d,h]=l?[o,c]:[c,o],u=s>>3,p=7&s,f=e.length;i=new Uint32Array(i.buffer);let g=0;for(let t=0;t<a;t++){for(const t=n+u;n<t;n++){const t=n<f?e[n]:255;i[g++]=128&t?h:d;i[g++]=64&t?h:d;i[g++]=32&t?h:d;i[g++]=16&t?h:d;i[g++]=8&t?h:d;i[g++]=4&t?h:d;i[g++]=2&t?h:d;i[g++]=1&t?h:d}if(0===p)continue;const t=n<f?e[n++]:255;for(let e=0;e<p;e++)i[g++]=t&1<<7-e?h:d}return{srcPos:n,destPos:g}}},(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.GlobalWorkerOptions=void 0;const n=Object.create(null);e.GlobalWorkerOptions=n;n.workerPort=null;n.workerSrc=""},(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.MessageHandler=void 0;var r=n(1);const i=1,s=2,a=1,o=2,l=3,c=4,d=5,h=6,u=7,p=8;function wrapReason(t){t instanceof Error||"object"==typeof t&&null!==t||(0,r.unreachable)('wrapReason: Expected "reason" to be a (possibly cloned) Error.');switch(t.name){case"AbortException":return new r.AbortException(t.message);case"MissingPDFException":return new r.MissingPDFException(t.message);case"PasswordException":return new r.PasswordException(t.message,t.code);case"UnexpectedResponseException":return new r.UnexpectedResponseException(t.message,t.status);case"UnknownErrorException":return new r.UnknownErrorException(t.message,t.details);default:return new r.UnknownErrorException(t.message,t.toString())}}e.MessageHandler=class MessageHandler{constructor(t,e,n){this.sourceName=t;this.targetName=e;this.comObj=n;this.callbackId=1;this.streamId=1;this.streamSinks=Object.create(null);this.streamControllers=Object.create(null);this.callbackCapabilities=Object.create(null);this.actionHandler=Object.create(null);this._onComObjOnMessage=t=>{const e=t.data;if(e.targetName!==this.sourceName)return;if(e.stream){this.#Ct(e);return}if(e.callback){const t=e.callbackId,n=this.callbackCapabilities[t];if(!n)throw new Error(`Cannot resolve callback ${t}`);delete this.callbackCapabilities[t];if(e.callback===i)n.resolve(e.data);else{if(e.callback!==s)throw new Error("Unexpected callback case");n.reject(wrapReason(e.reason))}return}const r=this.actionHandler[e.action];if(!r)throw new Error(`Unknown action from worker: ${e.action}`);if(e.callbackId){const t=this.sourceName,a=e.sourceName;new Promise((function(t){t(r(e.data))})).then((function(r){n.postMessage({sourceName:t,targetName:a,callback:i,callbackId:e.callbackId,data:r})}),(function(r){n.postMessage({sourceName:t,targetName:a,callback:s,callbackId:e.callbackId,reason:wrapReason(r)})}))}else e.streamId?this.#wt(e):r(e.data)};n.addEventListener("message",this._onComObjOnMessage)}on(t,e){const n=this.actionHandler;if(n[t])throw new Error(`There is already an actionName called "${t}"`);n[t]=e}send(t,e,n){this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:t,data:e},n)}sendWithPromise(t,e,n){const i=this.callbackId++,s=new r.PromiseCapability;this.callbackCapabilities[i]=s;try{this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:t,callbackId:i,data:e},n)}catch(t){s.reject(t)}return s.promise}sendWithStream(t,e,n,i){const s=this.streamId++,o=this.sourceName,l=this.targetName,c=this.comObj;return new ReadableStream({start:n=>{const a=new r.PromiseCapability;this.streamControllers[s]={controller:n,startCall:a,pullCall:null,cancelCall:null,isClosed:!1};c.postMessage({sourceName:o,targetName:l,action:t,streamId:s,data:e,desiredSize:n.desiredSize},i);return a.promise},pull:t=>{const e=new r.PromiseCapability;this.streamControllers[s].pullCall=e;c.postMessage({sourceName:o,targetName:l,stream:h,streamId:s,desiredSize:t.desiredSize});return e.promise},cancel:t=>{(0,r.assert)(t instanceof Error,"cancel must have a valid reason");const e=new r.PromiseCapability;this.streamControllers[s].cancelCall=e;this.streamControllers[s].isClosed=!0;c.postMessage({sourceName:o,targetName:l,stream:a,streamId:s,reason:wrapReason(t)});return e.promise}},n)}#wt(t){const e=t.streamId,n=this.sourceName,i=t.sourceName,s=this.comObj,a=this,o=this.actionHandler[t.action],h={enqueue(t){let a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,o=arguments.length>2?arguments[2]:void 0;if(this.isCancelled)return;const l=this.desiredSize;this.desiredSize-=a;if(l>0&&this.desiredSize<=0){this.sinkCapability=new r.PromiseCapability;this.ready=this.sinkCapability.promise}s.postMessage({sourceName:n,targetName:i,stream:c,streamId:e,chunk:t},o)},close(){if(!this.isCancelled){this.isCancelled=!0;s.postMessage({sourceName:n,targetName:i,stream:l,streamId:e});delete a.streamSinks[e]}},error(t){(0,r.assert)(t instanceof Error,"error must have a valid reason");if(!this.isCancelled){this.isCancelled=!0;s.postMessage({sourceName:n,targetName:i,stream:d,streamId:e,reason:wrapReason(t)})}},sinkCapability:new r.PromiseCapability,onPull:null,onCancel:null,isCancelled:!1,desiredSize:t.desiredSize,ready:null};h.sinkCapability.resolve();h.ready=h.sinkCapability.promise;this.streamSinks[e]=h;new Promise((function(e){e(o(t.data,h))})).then((function(){s.postMessage({sourceName:n,targetName:i,stream:p,streamId:e,success:!0})}),(function(t){s.postMessage({sourceName:n,targetName:i,stream:p,streamId:e,reason:wrapReason(t)})}))}#Ct(t){const e=t.streamId,n=this.sourceName,i=t.sourceName,s=this.comObj,f=this.streamControllers[e],g=this.streamSinks[e];switch(t.stream){case p:t.success?f.startCall.resolve():f.startCall.reject(wrapReason(t.reason));break;case u:t.success?f.pullCall.resolve():f.pullCall.reject(wrapReason(t.reason));break;case h:if(!g){s.postMessage({sourceName:n,targetName:i,stream:u,streamId:e,success:!0});break}g.desiredSize<=0&&t.desiredSize>0&&g.sinkCapability.resolve();g.desiredSize=t.desiredSize;new Promise((function(t){var e;t(null===(e=g.onPull)||void 0===e?void 0:e.call(g))})).then((function(){s.postMessage({sourceName:n,targetName:i,stream:u,streamId:e,success:!0})}),(function(t){s.postMessage({sourceName:n,targetName:i,stream:u,streamId:e,reason:wrapReason(t)})}));break;case c:(0,r.assert)(f,"enqueue should have stream controller");if(f.isClosed)break;f.controller.enqueue(t.chunk);break;case l:(0,r.assert)(f,"close should have stream controller");if(f.isClosed)break;f.isClosed=!0;f.controller.close();this.#Pt(f,e);break;case d:(0,r.assert)(f,"error should have stream controller");f.controller.error(wrapReason(t.reason));this.#Pt(f,e);break;case o:t.success?f.cancelCall.resolve():f.cancelCall.reject(wrapReason(t.reason));this.#Pt(f,e);break;case a:if(!g)break;new Promise((function(e){var n;e(null===(n=g.onCancel)||void 0===n?void 0:n.call(g,wrapReason(t.reason)))})).then((function(){s.postMessage({sourceName:n,targetName:i,stream:o,streamId:e,success:!0})}),(function(t){s.postMessage({sourceName:n,targetName:i,stream:o,streamId:e,reason:wrapReason(t)})}));g.sinkCapability.reject(wrapReason(t.reason));g.isCancelled=!0;delete this.streamSinks[e];break;default:throw new Error("Unexpected stream case")}}async#Pt(t,e){var n,r,i;await Promise.allSettled([null===(n=t.startCall)||void 0===n?void 0:n.promise,null===(r=t.pullCall)||void 0===r?void 0:r.promise,null===(i=t.cancelCall)||void 0===i?void 0:i.promise]);delete this.streamControllers[e]}destroy(){this.comObj.removeEventListener("message",this._onComObjOnMessage)}}},(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.Metadata=void 0;var r=n(1);e.Metadata=class Metadata{#Tt;#kt;constructor(t){let{parsedData:e,rawData:n}=t;this.#Tt=e;this.#kt=n}getRaw(){return this.#kt}get(t){return this.#Tt.get(t)??null}getAll(){return(0,r.objectFromMap)(this.#Tt)}has(t){return this.#Tt.has(t)}}},(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.OptionalContentConfig=void 0;var r=n(1),i=n(144);const s=Symbol("INTERNAL");class OptionalContentGroup{#Ft=!0;constructor(t,e){this.name=t;this.intent=e}get visible(){return this.#Ft}_setVisible(t,e){t!==s&&(0,r.unreachable)("Internal method `_setVisible` called.");this.#Ft=e}}e.OptionalContentConfig=class OptionalContentConfig{#Mt=null;#Rt=new Map;#Dt=null;#It=null;constructor(t){this.name=null;this.creator=null;if(null!==t){this.name=t.name;this.creator=t.creator;this.#It=t.order;for(const e of t.groups)this.#Rt.set(e.id,new OptionalContentGroup(e.name,e.intent));if("OFF"===t.baseState)for(const t of this.#Rt.values())t._setVisible(s,!1);for(const e of t.on)this.#Rt.get(e)._setVisible(s,!0);for(const e of t.off)this.#Rt.get(e)._setVisible(s,!1);this.#Dt=this.getHash()}}#Ot(t){const e=t.length;if(e<2)return!0;const n=t[0];for(let i=1;i<e;i++){const e=t[i];let s;if(Array.isArray(e))s=this.#Ot(e);else{if(!this.#Rt.has(e)){(0,r.warn)(`Optional content group not found: ${e}`);return!0}s=this.#Rt.get(e).visible}switch(n){case"And":if(!s)return!1;break;case"Or":if(s)return!0;break;case"Not":return!s;default:return!0}}return"And"===n}isVisible(t){if(0===this.#Rt.size)return!0;if(!t){(0,r.warn)("Optional content group not defined.");return!0}if("OCG"===t.type){if(!this.#Rt.has(t.id)){(0,r.warn)(`Optional content group not found: ${t.id}`);return!0}return this.#Rt.get(t.id).visible}if("OCMD"===t.type){if(t.expression)return this.#Ot(t.expression);if(!t.policy||"AnyOn"===t.policy){for(const e of t.ids){if(!this.#Rt.has(e)){(0,r.warn)(`Optional content group not found: ${e}`);return!0}if(this.#Rt.get(e).visible)return!0}return!1}if("AllOn"===t.policy){for(const e of t.ids){if(!this.#Rt.has(e)){(0,r.warn)(`Optional content group not found: ${e}`);return!0}if(!this.#Rt.get(e).visible)return!1}return!0}if("AnyOff"===t.policy){for(const e of t.ids){if(!this.#Rt.has(e)){(0,r.warn)(`Optional content group not found: ${e}`);return!0}if(!this.#Rt.get(e).visible)return!0}return!1}if("AllOff"===t.policy){for(const e of t.ids){if(!this.#Rt.has(e)){(0,r.warn)(`Optional content group not found: ${e}`);return!0}if(this.#Rt.get(e).visible)return!1}return!0}(0,r.warn)(`Unknown optional content policy ${t.policy}.`);return!0}(0,r.warn)(`Unknown group type ${t.type}.`);return!0}setVisibility(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(this.#Rt.has(t)){this.#Rt.get(t)._setVisible(s,!!e);this.#Mt=null}else(0,r.warn)(`Optional content group not found: ${t}`)}get hasInitialVisibility(){return this.getHash()===this.#Dt}getOrder(){return this.#Rt.size?this.#It?this.#It.slice():[...this.#Rt.keys()]:null}getGroups(){return this.#Rt.size>0?(0,r.objectFromMap)(this.#Rt):null}getGroup(t){return this.#Rt.get(t)||null}getHash(){if(null!==this.#Mt)return this.#Mt;const t=new i.MurmurHash3_64;for(const[e,n]of this.#Rt)t.update(`${e}:${n.visible}`);return this.#Mt=t.hexdigest()}}},(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.PDFDataTransportStream=void 0;var r=n(1),i=n(142);e.PDFDataTransportStream=class PDFDataTransportStream{constructor(t,e){let{length:n,initialData:i,progressiveDone:s=!1,contentDispositionFilename:a=null,disableRange:o=!1,disableStream:l=!1}=t;(0,r.assert)(e,'PDFDataTransportStream - missing required "pdfDataRangeTransport" argument.');this._queuedChunks=[];this._progressiveDone=s;this._contentDispositionFilename=a;if((null==i?void 0:i.length)>0){const t=i instanceof Uint8Array&&i.byteLength===i.buffer.byteLength?i.buffer:new Uint8Array(i).buffer;this._queuedChunks.push(t)}this._pdfDataRangeTransport=e;this._isStreamingSupported=!l;this._isRangeSupported=!o;this._contentLength=n;this._fullRequestReader=null;this._rangeReaders=[];this._pdfDataRangeTransport.addRangeListener(((t,e)=>{this._onReceiveData({begin:t,chunk:e})}));this._pdfDataRangeTransport.addProgressListener(((t,e)=>{this._onProgress({loaded:t,total:e})}));this._pdfDataRangeTransport.addProgressiveReadListener((t=>{this._onReceiveData({chunk:t})}));this._pdfDataRangeTransport.addProgressiveDoneListener((()=>{this._onProgressiveDone()}));this._pdfDataRangeTransport.transportReady()}_onReceiveData(t){let{begin:e,chunk:n}=t;const i=n instanceof Uint8Array&&n.byteLength===n.buffer.byteLength?n.buffer:new Uint8Array(n).buffer;if(void 0===e)this._fullRequestReader?this._fullRequestReader._enqueue(i):this._queuedChunks.push(i);else{const t=this._rangeReaders.some((function(t){if(t._begin!==e)return!1;t._enqueue(i);return!0}));(0,r.assert)(t,"_onReceiveData - no `PDFDataTransportStreamRangeReader` instance found.")}}get _progressiveDataLength(){var t;return(null===(t=this._fullRequestReader)||void 0===t?void 0:t._loaded)??0}_onProgress(t){if(void 0===t.total){var e,n;null===(e=this._rangeReaders[0])||void 0===e||null===(n=e.onProgress)||void 0===n||n.call(e,{loaded:t.loaded})}else{var r,i;null===(r=this._fullRequestReader)||void 0===r||null===(i=r.onProgress)||void 0===i||i.call(r,{loaded:t.loaded,total:t.total})}}_onProgressiveDone(){var t;null===(t=this._fullRequestReader)||void 0===t||t.progressiveDone();this._progressiveDone=!0}_removeRangeReader(t){const e=this._rangeReaders.indexOf(t);e>=0&&this._rangeReaders.splice(e,1)}getFullReader(){(0,r.assert)(!this._fullRequestReader,"PDFDataTransportStream.getFullReader can only be called once.");const t=this._queuedChunks;this._queuedChunks=null;return new PDFDataTransportStreamReader(this,t,this._progressiveDone,this._contentDispositionFilename)}getRangeReader(t,e){if(e<=this._progressiveDataLength)return null;const n=new PDFDataTransportStreamRangeReader(this,t,e);this._pdfDataRangeTransport.requestDataRange(t,e);this._rangeReaders.push(n);return n}cancelAllRequests(t){var e;null===(e=this._fullRequestReader)||void 0===e||e.cancel(t);for(const e of this._rangeReaders.slice(0))e.cancel(t);this._pdfDataRangeTransport.abort()}};class PDFDataTransportStreamReader{constructor(t,e){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;this._stream=t;this._done=n||!1;this._filename=(0,i.isPdfFile)(r)?r:null;this._queuedChunks=e||[];this._loaded=0;for(const t of this._queuedChunks)this._loaded+=t.byteLength;this._requests=[];this._headersReady=Promise.resolve();t._fullRequestReader=this;this.onProgress=null}_enqueue(t){if(!this._done){if(this._requests.length>0){this._requests.shift().resolve({value:t,done:!1})}else this._queuedChunks.push(t);this._loaded+=t.byteLength}}get headersReady(){return this._headersReady}get filename(){return this._filename}get isRangeSupported(){return this._stream._isRangeSupported}get isStreamingSupported(){return this._stream._isStreamingSupported}get contentLength(){return this._stream._contentLength}async read(){if(this._queuedChunks.length>0){return{value:this._queuedChunks.shift(),done:!1}}if(this._done)return{value:void 0,done:!0};const t=new r.PromiseCapability;this._requests.push(t);return t.promise}cancel(t){this._done=!0;for(const t of this._requests)t.resolve({value:void 0,done:!0});this._requests.length=0}progressiveDone(){this._done||(this._done=!0)}}class PDFDataTransportStreamRangeReader{constructor(t,e,n){this._stream=t;this._begin=e;this._end=n;this._queuedChunk=null;this._requests=[];this._done=!1;this.onProgress=null}_enqueue(t){if(!this._done){if(0===this._requests.length)this._queuedChunk=t;else{this._requests.shift().resolve({value:t,done:!1});for(const t of this._requests)t.resolve({value:void 0,done:!0});this._requests.length=0}this._done=!0;this._stream._removeRangeReader(this)}}get isStreamingSupported(){return!1}async read(){if(this._queuedChunk){const t=this._queuedChunk;this._queuedChunk=null;return{value:t,done:!1}}if(this._done)return{value:void 0,done:!0};const t=new r.PromiseCapability;this._requests.push(t);return t.promise}cancel(t){this._done=!0;for(const t of this._requests)t.resolve({value:void 0,done:!0});this._requests.length=0;this._stream._removeRangeReader(this)}}},(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.XfaText=void 0;class XfaText{static textContent(t){const e=[],n={items:e,styles:Object.create(null)};!function walk(t){var n;if(!t)return;let r=null;const i=t.name;if("#text"===i)r=t.value;else{if(!XfaText.shouldBuildText(i))return;null!=t&&null!==(n=t.attributes)&&void 0!==n&&n.textContent?r=t.attributes.textContent:t.value&&(r=t.value)}null!==r&&e.push({str:r});if(t.children)for(const e of t.children)walk(e)}(t);return n}static shouldBuildText(t){return!("textarea"===t||"input"===t||"option"===t||"select"===t)}}e.XfaText=XfaText},(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.NodeStandardFontDataFactory=e.NodeFilterFactory=e.NodeCanvasFactory=e.NodeCMapReaderFactory=void 0;var r=n(143);const fetchData=function(t){return new Promise(((e,n)=>{require("fs").readFile(t,((t,r)=>{!t&&r?e(new Uint8Array(r)):n(new Error(t))}))}))};class NodeFilterFactory extends r.BaseFilterFactory{}e.NodeFilterFactory=NodeFilterFactory;class NodeCanvasFactory extends r.BaseCanvasFactory{_createCanvas(t,e){return require("canvas").createCanvas(t,e)}}e.NodeCanvasFactory=NodeCanvasFactory;class NodeCMapReaderFactory extends r.BaseCMapReaderFactory{_fetchData(t,e){return fetchData(t).then((t=>({cMapData:t,compressionType:e})))}}e.NodeCMapReaderFactory=NodeCMapReaderFactory;class NodeStandardFontDataFactory extends r.BaseStandardFontDataFactory{_fetchData(t){return fetchData(t)}}e.NodeStandardFontDataFactory=NodeStandardFontDataFactory},(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.PDFNodeStream=void 0;var r=n(1),i=n(157);const s=require("fs"),a=require("http"),o=require("https"),l=require("url"),c=/^file:\/\/\/[a-zA-Z]:\//;e.PDFNodeStream=class PDFNodeStream{constructor(t){this.source=t;this.url=function parseUrl(t){const e=l.parse(t);if("file:"===e.protocol||e.host)return e;if(/^[a-z]:[/\\]/i.test(t))return l.parse(`file:///${t}`);e.host||(e.protocol="file:");return e}(t.url);this.isHttp="http:"===this.url.protocol||"https:"===this.url.protocol;this.isFsUrl="file:"===this.url.protocol;this.httpHeaders=this.isHttp&&t.httpHeaders||{};this._fullRequestReader=null;this._rangeRequestReaders=[]}get _progressiveDataLength(){var t;return(null===(t=this._fullRequestReader)||void 0===t?void 0:t._loaded)??0}getFullReader(){(0,r.assert)(!this._fullRequestReader,"PDFNodeStream.getFullReader can only be called once.");this._fullRequestReader=this.isFsUrl?new PDFNodeStreamFsFullReader(this):new PDFNodeStreamFullReader(this);return this._fullRequestReader}getRangeReader(t,e){if(e<=this._progressiveDataLength)return null;const n=this.isFsUrl?new PDFNodeStreamFsRangeReader(this,t,e):new PDFNodeStreamRangeReader(this,t,e);this._rangeRequestReaders.push(n);return n}cancelAllRequests(t){var e;null===(e=this._fullRequestReader)||void 0===e||e.cancel(t);for(const e of this._rangeRequestReaders.slice(0))e.cancel(t)}};class BaseFullReader{constructor(t){this._url=t.url;this._done=!1;this._storedError=null;this.onProgress=null;const e=t.source;this._contentLength=e.length;this._loaded=0;this._filename=null;this._disableRange=e.disableRange||!1;this._rangeChunkSize=e.rangeChunkSize;this._rangeChunkSize||this._disableRange||(this._disableRange=!0);this._isStreamingSupported=!e.disableStream;this._isRangeSupported=!e.disableRange;this._readableStream=null;this._readCapability=new r.PromiseCapability;this._headersCapability=new r.PromiseCapability}get headersReady(){return this._headersCapability.promise}get filename(){return this._filename}get contentLength(){return this._contentLength}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}async read(){var t;await this._readCapability.promise;if(this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;const e=this._readableStream.read();if(null===e){this._readCapability=new r.PromiseCapability;return this.read()}this._loaded+=e.length;null===(t=this.onProgress)||void 0===t||t.call(this,{loaded:this._loaded,total:this._contentLength});return{value:new Uint8Array(e).buffer,done:!1}}cancel(t){this._readableStream?this._readableStream.destroy(t):this._error(t)}_error(t){this._storedError=t;this._readCapability.resolve()}_setReadableStream(t){this._readableStream=t;t.on("readable",(()=>{this._readCapability.resolve()}));t.on("end",(()=>{t.destroy();this._done=!0;this._readCapability.resolve()}));t.on("error",(t=>{this._error(t)}));!this._isStreamingSupported&&this._isRangeSupported&&this._error(new r.AbortException("streaming is disabled"));this._storedError&&this._readableStream.destroy(this._storedError)}}class BaseRangeReader{constructor(t){this._url=t.url;this._done=!1;this._storedError=null;this.onProgress=null;this._loaded=0;this._readableStream=null;this._readCapability=new r.PromiseCapability;const e=t.source;this._isStreamingSupported=!e.disableStream}get isStreamingSupported(){return this._isStreamingSupported}async read(){var t;await this._readCapability.promise;if(this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;const e=this._readableStream.read();if(null===e){this._readCapability=new r.PromiseCapability;return this.read()}this._loaded+=e.length;null===(t=this.onProgress)||void 0===t||t.call(this,{loaded:this._loaded});return{value:new Uint8Array(e).buffer,done:!1}}cancel(t){this._readableStream?this._readableStream.destroy(t):this._error(t)}_error(t){this._storedError=t;this._readCapability.resolve()}_setReadableStream(t){this._readableStream=t;t.on("readable",(()=>{this._readCapability.resolve()}));t.on("end",(()=>{t.destroy();this._done=!0;this._readCapability.resolve()}));t.on("error",(t=>{this._error(t)}));this._storedError&&this._readableStream.destroy(this._storedError)}}function createRequestOptions(t,e){return{protocol:t.protocol,auth:t.auth,host:t.hostname,port:t.port,path:t.path,method:"GET",headers:e}}class PDFNodeStreamFullReader extends BaseFullReader{constructor(t){super(t);const handleResponse=e=>{if(404===e.statusCode){const t=new r.MissingPDFException(`Missing PDF "${this._url}".`);this._storedError=t;this._headersCapability.reject(t);return}this._headersCapability.resolve();this._setReadableStream(e);const getResponseHeader=t=>this._readableStream.headers[t.toLowerCase()],{allowRangeRequests:n,suggestedLength:s}=(0,i.validateRangeRequestCapabilities)({getResponseHeader:getResponseHeader,isHttp:t.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=n;this._contentLength=s||this._contentLength;this._filename=(0,i.extractFilenameFromHeader)(getResponseHeader)};this._request=null;"http:"===this._url.protocol?this._request=a.request(createRequestOptions(this._url,t.httpHeaders),handleResponse):this._request=o.request(createRequestOptions(this._url,t.httpHeaders),handleResponse);this._request.on("error",(t=>{this._storedError=t;this._headersCapability.reject(t)}));this._request.end()}}class PDFNodeStreamRangeReader extends BaseRangeReader{constructor(t,e,n){super(t);this._httpHeaders={};for(const e in t.httpHeaders){const n=t.httpHeaders[e];void 0!==n&&(this._httpHeaders[e]=n)}this._httpHeaders.Range=`bytes=${e}-${n-1}`;const handleResponse=t=>{if(404!==t.statusCode)this._setReadableStream(t);else{const t=new r.MissingPDFException(`Missing PDF "${this._url}".`);this._storedError=t}};this._request=null;"http:"===this._url.protocol?this._request=a.request(createRequestOptions(this._url,this._httpHeaders),handleResponse):this._request=o.request(createRequestOptions(this._url,this._httpHeaders),handleResponse);this._request.on("error",(t=>{this._storedError=t}));this._request.end()}}class PDFNodeStreamFsFullReader extends BaseFullReader{constructor(t){super(t);let e=decodeURIComponent(this._url.path);c.test(this._url.href)&&(e=e.replace(/^\//,""));s.lstat(e,((t,n)=>{if(t){"ENOENT"===t.code&&(t=new r.MissingPDFException(`Missing PDF "${e}".`));this._storedError=t;this._headersCapability.reject(t)}else{this._contentLength=n.size;this._setReadableStream(s.createReadStream(e));this._headersCapability.resolve()}}))}}class PDFNodeStreamFsRangeReader extends BaseRangeReader{constructor(t,e,n){super(t);let r=decodeURIComponent(this._url.path);c.test(this._url.href)&&(r=r.replace(/^\//,""));this._setReadableStream(s.createReadStream(r,{start:e,end:n-1}))}}},(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.createResponseStatusError=function createResponseStatusError(t,e){if(404===t||0===t&&e.startsWith("file:"))return new r.MissingPDFException('Missing PDF "'+e+'".');return new r.UnexpectedResponseException(`Unexpected server response (${t}) while retrieving PDF "${e}".`,t)};e.extractFilenameFromHeader=function extractFilenameFromHeader(t){const e=t("Content-Disposition");if(e){let t=(0,i.getFilenameFromContentDispositionHeader)(e);if(t.includes("%"))try{t=decodeURIComponent(t)}catch(t){}if((0,s.isPdfFile)(t))return t}return null};e.validateRangeRequestCapabilities=function validateRangeRequestCapabilities(t){let{getResponseHeader:e,isHttp:n,rangeChunkSize:r,disableRange:i}=t;const s={allowRangeRequests:!1,suggestedLength:void 0},a=parseInt(e("Content-Length"),10);if(!Number.isInteger(a))return s;s.suggestedLength=a;if(a<=2*r)return s;if(i||!n)return s;if("bytes"!==e("Accept-Ranges"))return s;if("identity"!==(e("Content-Encoding")||"identity"))return s;s.allowRangeRequests=!0;return s};e.validateResponseStatus=function validateResponseStatus(t){return 200===t||206===t};var r=n(1),i=n(158),s=n(142)},(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.getFilenameFromContentDispositionHeader=function getFilenameFromContentDispositionHeader(t){let e=!0,n=toParamRegExp("filename\\*","i").exec(t);if(n){n=n[1];let t=rfc2616unquote(n);t=unescape(t);t=rfc5987decode(t);t=rfc2047decode(t);return fixupEncoding(t)}n=function rfc2231getparam(t){const e=[];let n;const r=toParamRegExp("filename\\*((?!0\\d)\\d+)(\\*?)","ig");for(;null!==(n=r.exec(t));){let[,t,r,i]=n;t=parseInt(t,10);if(t in e){if(0===t)break}else e[t]=[r,i]}const i=[];for(let t=0;t<e.length&&t in e;++t){let[n,r]=e[t];r=rfc2616unquote(r);if(n){r=unescape(r);0===t&&(r=rfc5987decode(r))}i.push(r)}return i.join("")}(t);if(n){return fixupEncoding(rfc2047decode(n))}n=toParamRegExp("filename","i").exec(t);if(n){n=n[1];let t=rfc2616unquote(n);t=rfc2047decode(t);return fixupEncoding(t)}function toParamRegExp(t,e){return new RegExp("(?:^|;)\\s*"+t+'\\s*=\\s*([^";\\s][^;\\s]*|"(?:[^"\\\\]|\\\\"?)+"?)',e)}function textdecode(t,n){if(t){if(!/^[\x00-\xFF]+$/.test(n))return n;try{const i=new TextDecoder(t,{fatal:!0}),s=(0,r.stringToBytes)(n);n=i.decode(s);e=!1}catch(t){}}return n}function fixupEncoding(t){if(e&&/[\x80-\xff]/.test(t)){t=textdecode("utf-8",t);e&&(t=textdecode("iso-8859-1",t))}return t}function rfc2616unquote(t){if(t.startsWith('"')){const e=t.slice(1).split('\\"');for(let t=0;t<e.length;++t){const n=e[t].indexOf('"');if(-1!==n){e[t]=e[t].slice(0,n);e.length=t+1}e[t]=e[t].replaceAll(/\\(.)/g,"$1")}t=e.join('"')}return t}function rfc5987decode(t){const e=t.indexOf("'");if(-1===e)return t;return textdecode(t.slice(0,e),t.slice(e+1).replace(/^[^']*'/,""))}function rfc2047decode(t){return!t.startsWith("=?")||/[\x00-\x19\x80-\xff]/.test(t)?t:t.replaceAll(/=\?([\w-]*)\?([QqBb])\?((?:[^?]|\?(?!=))*)\?=/g,(function(t,e,n,r){if("q"===n||"Q"===n)return textdecode(e,r=(r=r.replaceAll("_"," ")).replaceAll(/=([0-9a-fA-F]{2})/g,(function(t,e){return String.fromCharCode(parseInt(e,16))})));try{r=atob(r)}catch(t){}return textdecode(e,r)}))}return""};var r=n(1)},(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.PDFNetworkStream=void 0;var r=n(1),i=n(157);class NetworkManager{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.url=t;this.isHttp=/^https?:/i.test(t);this.httpHeaders=this.isHttp&&e.httpHeaders||Object.create(null);this.withCredentials=e.withCredentials||!1;this.currXhrId=0;this.pendingRequests=Object.create(null)}requestRange(t,e,n){const r={begin:t,end:e};for(const t in n)r[t]=n[t];return this.request(r)}requestFull(t){return this.request(t)}request(t){const e=new XMLHttpRequest,n=this.currXhrId++,r=this.pendingRequests[n]={xhr:e};e.open("GET",this.url);e.withCredentials=this.withCredentials;for(const t in this.httpHeaders){const n=this.httpHeaders[t];void 0!==n&&e.setRequestHeader(t,n)}if(this.isHttp&&"begin"in t&&"end"in t){e.setRequestHeader("Range",`bytes=${t.begin}-${t.end-1}`);r.expectedStatus=206}else r.expectedStatus=200;e.responseType="arraybuffer";t.onError&&(e.onerror=function(n){t.onError(e.status)});e.onreadystatechange=this.onStateChange.bind(this,n);e.onprogress=this.onProgress.bind(this,n);r.onHeadersReceived=t.onHeadersReceived;r.onDone=t.onDone;r.onError=t.onError;r.onProgress=t.onProgress;e.send(null);return n}onProgress(t,e){var n;const r=this.pendingRequests[t];r&&(null===(n=r.onProgress)||void 0===n||n.call(r,e))}onStateChange(t,e){const n=this.pendingRequests[t];if(!n)return;const i=n.xhr;if(i.readyState>=2&&n.onHeadersReceived){n.onHeadersReceived();delete n.onHeadersReceived}if(4!==i.readyState)return;if(!(t in this.pendingRequests))return;delete this.pendingRequests[t];if(0===i.status&&this.isHttp){var s;null===(s=n.onError)||void 0===s||s.call(n,i.status);return}const a=i.status||200;if(!(200===a&&206===n.expectedStatus)&&a!==n.expectedStatus){var o;null===(o=n.onError)||void 0===o||o.call(n,i.status);return}const l=function getArrayBuffer(t){const e=t.response;return"string"!=typeof e?e:(0,r.stringToBytes)(e).buffer}(i);if(206===a){const t=i.getResponseHeader("Content-Range"),e=/bytes (\d+)-(\d+)\/(\d+)/.exec(t);n.onDone({begin:parseInt(e[1],10),chunk:l})}else if(l)n.onDone({begin:0,chunk:l});else{var c;null===(c=n.onError)||void 0===c||c.call(n,i.status)}}getRequestXhr(t){return this.pendingRequests[t].xhr}isPendingRequest(t){return t in this.pendingRequests}abortRequest(t){const e=this.pendingRequests[t].xhr;delete this.pendingRequests[t];e.abort()}}e.PDFNetworkStream=class PDFNetworkStream{constructor(t){this._source=t;this._manager=new NetworkManager(t.url,{httpHeaders:t.httpHeaders,withCredentials:t.withCredentials});this._rangeChunkSize=t.rangeChunkSize;this._fullRequestReader=null;this._rangeRequestReaders=[]}_onRangeRequestReaderClosed(t){const e=this._rangeRequestReaders.indexOf(t);e>=0&&this._rangeRequestReaders.splice(e,1)}getFullReader(){(0,r.assert)(!this._fullRequestReader,"PDFNetworkStream.getFullReader can only be called once.");this._fullRequestReader=new PDFNetworkStreamFullRequestReader(this._manager,this._source);return this._fullRequestReader}getRangeReader(t,e){const n=new PDFNetworkStreamRangeRequestReader(this._manager,t,e);n.onClosed=this._onRangeRequestReaderClosed.bind(this);this._rangeRequestReaders.push(n);return n}cancelAllRequests(t){var e;null===(e=this._fullRequestReader)||void 0===e||e.cancel(t);for(const e of this._rangeRequestReaders.slice(0))e.cancel(t)}};class PDFNetworkStreamFullRequestReader{constructor(t,e){this._manager=t;const n={onHeadersReceived:this._onHeadersReceived.bind(this),onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)};this._url=e.url;this._fullRequestId=t.requestFull(n);this._headersReceivedCapability=new r.PromiseCapability;this._disableRange=e.disableRange||!1;this._contentLength=e.length;this._rangeChunkSize=e.rangeChunkSize;this._rangeChunkSize||this._disableRange||(this._disableRange=!0);this._isStreamingSupported=!1;this._isRangeSupported=!1;this._cachedChunks=[];this._requests=[];this._done=!1;this._storedError=void 0;this._filename=null;this.onProgress=null}_onHeadersReceived(){const t=this._fullRequestId,e=this._manager.getRequestXhr(t),getResponseHeader=t=>e.getResponseHeader(t),{allowRangeRequests:n,suggestedLength:r}=(0,i.validateRangeRequestCapabilities)({getResponseHeader:getResponseHeader,isHttp:this._manager.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});n&&(this._isRangeSupported=!0);this._contentLength=r||this._contentLength;this._filename=(0,i.extractFilenameFromHeader)(getResponseHeader);this._isRangeSupported&&this._manager.abortRequest(t);this._headersReceivedCapability.resolve()}_onDone(t){if(t)if(this._requests.length>0){this._requests.shift().resolve({value:t.chunk,done:!1})}else this._cachedChunks.push(t.chunk);this._done=!0;if(!(this._cachedChunks.length>0)){for(const t of this._requests)t.resolve({value:void 0,done:!0});this._requests.length=0}}_onError(t){this._storedError=(0,i.createResponseStatusError)(t,this._url);this._headersReceivedCapability.reject(this._storedError);for(const t of this._requests)t.reject(this._storedError);this._requests.length=0;this._cachedChunks.length=0}_onProgress(t){var e;null===(e=this.onProgress)||void 0===e||e.call(this,{loaded:t.loaded,total:t.lengthComputable?t.total:this._contentLength})}get filename(){return this._filename}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}get contentLength(){return this._contentLength}get headersReady(){return this._headersReceivedCapability.promise}async read(){if(this._storedError)throw this._storedError;if(this._cachedChunks.length>0){return{value:this._cachedChunks.shift(),done:!1}}if(this._done)return{value:void 0,done:!0};const t=new r.PromiseCapability;this._requests.push(t);return t.promise}cancel(t){this._done=!0;this._headersReceivedCapability.reject(t);for(const t of this._requests)t.resolve({value:void 0,done:!0});this._requests.length=0;this._manager.isPendingRequest(this._fullRequestId)&&this._manager.abortRequest(this._fullRequestId);this._fullRequestReader=null}}class PDFNetworkStreamRangeRequestReader{constructor(t,e,n){this._manager=t;const r={onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)};this._url=t.url;this._requestId=t.requestRange(e,n,r);this._requests=[];this._queuedChunk=null;this._done=!1;this._storedError=void 0;this.onProgress=null;this.onClosed=null}_close(){var t;null===(t=this.onClosed)||void 0===t||t.call(this,this)}_onDone(t){const e=t.chunk;if(this._requests.length>0){this._requests.shift().resolve({value:e,done:!1})}else this._queuedChunk=e;this._done=!0;for(const t of this._requests)t.resolve({value:void 0,done:!0});this._requests.length=0;this._close()}_onError(t){this._storedError=(0,i.createResponseStatusError)(t,this._url);for(const t of this._requests)t.reject(this._storedError);this._requests.length=0;this._queuedChunk=null}_onProgress(t){if(!this.isStreamingSupported){var e;null===(e=this.onProgress)||void 0===e||e.call(this,{loaded:t.loaded})}}get isStreamingSupported(){return!1}async read(){if(this._storedError)throw this._storedError;if(null!==this._queuedChunk){const t=this._queuedChunk;this._queuedChunk=null;return{value:t,done:!1}}if(this._done)return{value:void 0,done:!0};const t=new r.PromiseCapability;this._requests.push(t);return t.promise}cancel(t){this._done=!0;for(const t of this._requests)t.resolve({value:void 0,done:!0});this._requests.length=0;this._manager.isPendingRequest(this._requestId)&&this._manager.abortRequest(this._requestId);this._close()}}},(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.PDFFetchStream=void 0;var r=n(1),i=n(157);function createFetchOptions(t,e,n){return{method:"GET",headers:t,signal:n.signal,mode:"cors",credentials:e?"include":"same-origin",redirect:"follow"}}function createHeaders(t){const e=new Headers;for(const n in t){const r=t[n];void 0!==r&&e.append(n,r)}return e}function getArrayBuffer(t){if(t instanceof Uint8Array)return t.buffer;if(t instanceof ArrayBuffer)return t;(0,r.warn)(`getArrayBuffer - unexpected data format: ${t}`);return new Uint8Array(t).buffer}e.PDFFetchStream=class PDFFetchStream{constructor(t){this.source=t;this.isHttp=/^https?:/i.test(t.url);this.httpHeaders=this.isHttp&&t.httpHeaders||{};this._fullRequestReader=null;this._rangeRequestReaders=[]}get _progressiveDataLength(){var t;return(null===(t=this._fullRequestReader)||void 0===t?void 0:t._loaded)??0}getFullReader(){(0,r.assert)(!this._fullRequestReader,"PDFFetchStream.getFullReader can only be called once.");this._fullRequestReader=new PDFFetchStreamReader(this);return this._fullRequestReader}getRangeReader(t,e){if(e<=this._progressiveDataLength)return null;const n=new PDFFetchStreamRangeReader(this,t,e);this._rangeRequestReaders.push(n);return n}cancelAllRequests(t){var e;null===(e=this._fullRequestReader)||void 0===e||e.cancel(t);for(const e of this._rangeRequestReaders.slice(0))e.cancel(t)}};class PDFFetchStreamReader{constructor(t){this._stream=t;this._reader=null;this._loaded=0;this._filename=null;const e=t.source;this._withCredentials=e.withCredentials||!1;this._contentLength=e.length;this._headersCapability=new r.PromiseCapability;this._disableRange=e.disableRange||!1;this._rangeChunkSize=e.rangeChunkSize;this._rangeChunkSize||this._disableRange||(this._disableRange=!0);this._abortController=new AbortController;this._isStreamingSupported=!e.disableStream;this._isRangeSupported=!e.disableRange;this._headers=createHeaders(this._stream.httpHeaders);const n=e.url;fetch(n,createFetchOptions(this._headers,this._withCredentials,this._abortController)).then((t=>{if(!(0,i.validateResponseStatus)(t.status))throw(0,i.createResponseStatusError)(t.status,n);this._reader=t.body.getReader();this._headersCapability.resolve();const getResponseHeader=e=>t.headers.get(e),{allowRangeRequests:e,suggestedLength:s}=(0,i.validateRangeRequestCapabilities)({getResponseHeader:getResponseHeader,isHttp:this._stream.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=e;this._contentLength=s||this._contentLength;this._filename=(0,i.extractFilenameFromHeader)(getResponseHeader);!this._isStreamingSupported&&this._isRangeSupported&&this.cancel(new r.AbortException("Streaming is disabled."))})).catch(this._headersCapability.reject);this.onProgress=null}get headersReady(){return this._headersCapability.promise}get filename(){return this._filename}get contentLength(){return this._contentLength}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}async read(){var t;await this._headersCapability.promise;const{value:e,done:n}=await this._reader.read();if(n)return{value:e,done:n};this._loaded+=e.byteLength;null===(t=this.onProgress)||void 0===t||t.call(this,{loaded:this._loaded,total:this._contentLength});return{value:getArrayBuffer(e),done:!1}}cancel(t){var e;null===(e=this._reader)||void 0===e||e.cancel(t);this._abortController.abort()}}class PDFFetchStreamRangeReader{constructor(t,e,n){this._stream=t;this._reader=null;this._loaded=0;const s=t.source;this._withCredentials=s.withCredentials||!1;this._readCapability=new r.PromiseCapability;this._isStreamingSupported=!s.disableStream;this._abortController=new AbortController;this._headers=createHeaders(this._stream.httpHeaders);this._headers.append("Range",`bytes=${e}-${n-1}`);const a=s.url;fetch(a,createFetchOptions(this._headers,this._withCredentials,this._abortController)).then((t=>{if(!(0,i.validateResponseStatus)(t.status))throw(0,i.createResponseStatusError)(t.status,a);this._readCapability.resolve();this._reader=t.body.getReader()})).catch(this._readCapability.reject);this.onProgress=null}get isStreamingSupported(){return this._isStreamingSupported}async read(){var t;await this._readCapability.promise;const{value:e,done:n}=await this._reader.read();if(n)return{value:e,done:n};this._loaded+=e.byteLength;null===(t=this.onProgress)||void 0===t||t.call(this,{loaded:this._loaded});return{value:getArrayBuffer(e),done:!1}}cancel(t){var e;null===(e=this._reader)||void 0===e||e.cancel(t);this._abortController.abort()}}},(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.TextLayerRenderTask=void 0;e.renderTextLayer=function renderTextLayer(t){if(!t.textContentSource&&(t.textContent||t.textContentStream)){(0,i.deprecated)("The TextLayerRender `textContent`/`textContentStream` parameters will be removed in the future, please use `textContentSource` instead.");t.textContentSource=t.textContent||t.textContentStream}const{container:e,viewport:n}=t,r=getComputedStyle(e),s=r.getPropertyValue("visibility"),a=parseFloat(r.getPropertyValue("--scale-factor"));"visible"===s&&(!a||Math.abs(a-n.scale)>1e-5)&&console.error("The `--scale-factor` CSS-variable must be set, to the same value as `viewport.scale`, either on the `container`-element itself or higher up in the DOM.");const o=new TextLayerRenderTask(t);o._render();return o};e.updateTextLayer=function updateTextLayer(t){let{container:e,viewport:n,textDivs:r,textDivProperties:s,isOffscreenCanvasSupported:a,mustRotate:o=!0,mustRescale:l=!0}=t;o&&(0,i.setLayerDimensions)(e,{rotation:n.rotation});if(l){const t=getCtx(0,a),e={prevFontSize:null,prevFontFamily:null,div:null,scale:n.scale*(globalThis.devicePixelRatio||1),properties:null,ctx:t};for(const t of r){e.properties=s.get(t);e.div=t;layout(e)}}};var r=n(1),i=n(142);const s=30,a=.8,o=new Map;function getCtx(t,e){let n;if(e&&r.FeatureTest.isOffscreenCanvasSupported)n=new OffscreenCanvas(t,t).getContext("2d",{alpha:!1});else{const e=document.createElement("canvas");e.width=e.height=t;n=e.getContext("2d",{alpha:!1})}return n}function appendText(t,e,n){const i=document.createElement("span"),l={angle:0,canvasWidth:0,hasText:""!==e.str,hasEOL:e.hasEOL,fontSize:0};t._textDivs.push(i);const c=r.Util.transform(t._transform,e.transform);let d=Math.atan2(c[1],c[0]);const h=n[e.fontName];h.vertical&&(d+=Math.PI/2);const u=Math.hypot(c[2],c[3]),p=u*function getAscent(t,e){const n=o.get(t);if(n)return n;const r=getCtx(s,e);r.font=`${s}px ${t}`;const i=r.measureText("");let l=i.fontBoundingBoxAscent,c=Math.abs(i.fontBoundingBoxDescent);if(l){const e=l/(l+c);o.set(t,e);r.canvas.width=r.canvas.height=0;return e}r.strokeStyle="red";r.clearRect(0,0,s,s);r.strokeText("g",0,0);let d=r.getImageData(0,0,s,s).data;c=0;for(let t=d.length-1-3;t>=0;t-=4)if(d[t]>0){c=Math.ceil(t/4/s);break}r.clearRect(0,0,s,s);r.strokeText("A",0,s);d=r.getImageData(0,0,s,s).data;l=0;for(let t=0,e=d.length;t<e;t+=4)if(d[t]>0){l=s-Math.floor(t/4/s);break}r.canvas.width=r.canvas.height=0;if(l){const e=l/(l+c);o.set(t,e);return e}o.set(t,a);return a}(h.fontFamily,t._isOffscreenCanvasSupported);let f,g;if(0===d){f=c[4];g=c[5]-p}else{f=c[4]+p*Math.sin(d);g=c[5]-p*Math.cos(d)}const m="calc(var(--scale-factor)*",v=i.style;if(t._container===t._rootContainer){v.left=`${(100*f/t._pageWidth).toFixed(2)}%`;v.top=`${(100*g/t._pageHeight).toFixed(2)}%`}else{v.left=`${m}${f.toFixed(2)}px)`;v.top=`${m}${g.toFixed(2)}px)`}v.fontSize=`${m}${u.toFixed(2)}px)`;v.fontFamily=h.fontFamily;l.fontSize=u;i.setAttribute("role","presentation");i.textContent=e.str;i.dir=e.dir;t._fontInspectorEnabled&&(i.dataset.fontName=e.fontName);0!==d&&(l.angle=d*(180/Math.PI));let b=!1;if(e.str.length>1)b=!0;else if(" "!==e.str&&e.transform[0]!==e.transform[3]){const t=Math.abs(e.transform[0]),n=Math.abs(e.transform[3]);t!==n&&Math.max(t,n)/Math.min(t,n)>1.5&&(b=!0)}b&&(l.canvasWidth=h.vertical?e.height:e.width);t._textDivProperties.set(i,l);t._isReadableStream&&t._layoutText(i)}function layout(t){const{div:e,scale:n,properties:r,ctx:i,prevFontSize:s,prevFontFamily:a}=t,{style:o}=e;let l="";if(0!==r.canvasWidth&&r.hasText){const{fontFamily:c}=o,{canvasWidth:d,fontSize:h}=r;if(s!==h||a!==c){i.font=`${h*n}px ${c}`;t.prevFontSize=h;t.prevFontFamily=c}const{width:u}=i.measureText(e.textContent);u>0&&(l=`scaleX(${d*n/u})`)}0!==r.angle&&(l=`rotate(${r.angle}deg) ${l}`);l.length>0&&(o.transform=l)}class TextLayerRenderTask{constructor(t){var e;let{textContentSource:n,container:s,viewport:a,textDivs:o,textDivProperties:l,textContentItemsStr:c,isOffscreenCanvasSupported:d}=t;this._textContentSource=n;this._isReadableStream=n instanceof ReadableStream;this._container=this._rootContainer=s;this._textDivs=o||[];this._textContentItemsStr=c||[];this._isOffscreenCanvasSupported=d;this._fontInspectorEnabled=!(null===(e=globalThis.FontInspector)||void 0===e||!e.enabled);this._reader=null;this._textDivProperties=l||new WeakMap;this._canceled=!1;this._capability=new r.PromiseCapability;this._layoutTextParams={prevFontSize:null,prevFontFamily:null,div:null,scale:a.scale*(globalThis.devicePixelRatio||1),properties:null,ctx:getCtx(0,d)};const{pageWidth:h,pageHeight:u,pageX:p,pageY:f}=a.rawDims;this._transform=[1,0,0,-1,-p,f+u];this._pageWidth=h;this._pageHeight=u;(0,i.setLayerDimensions)(s,a);this._capability.promise.finally((()=>{this._layoutTextParams=null})).catch((()=>{}))}get promise(){return this._capability.promise}cancel(){this._canceled=!0;if(this._reader){this._reader.cancel(new r.AbortException("TextLayer task cancelled.")).catch((()=>{}));this._reader=null}this._capability.reject(new r.AbortException("TextLayer task cancelled."))}_processItems(t,e){for(const n of t)if(void 0!==n.str){this._textContentItemsStr.push(n.str);appendText(this,n,e)}else if("beginMarkedContentProps"===n.type||"beginMarkedContent"===n.type){const t=this._container;this._container=document.createElement("span");this._container.classList.add("markedContent");null!==n.id&&this._container.setAttribute("id",`${n.id}`);t.append(this._container)}else"endMarkedContent"===n.type&&(this._container=this._container.parentNode)}_layoutText(t){const e=this._layoutTextParams.properties=this._textDivProperties.get(t);this._layoutTextParams.div=t;layout(this._layoutTextParams);e.hasText&&this._container.append(t);if(e.hasEOL){const t=document.createElement("br");t.setAttribute("role","presentation");this._container.append(t)}}_render(){const t=new r.PromiseCapability;let e=Object.create(null);if(this._isReadableStream){const pump=()=>{this._reader.read().then((n=>{let{value:r,done:i}=n;if(i)t.resolve();else{Object.assign(e,r.styles);this._processItems(r.items,e);pump()}}),t.reject)};this._reader=this._textContentSource.getReader();pump()}else{if(!this._textContentSource)throw new Error('No "textContentSource" parameter specified.');{const{items:e,styles:n}=this._textContentSource;this._processItems(e,n);t.resolve()}}t.promise.then((()=>{e=null;!function render(t){if(t._canceled)return;const e=t._textDivs,n=t._capability;if(e.length>1e5)n.resolve();else{if(!t._isReadableStream)for(const n of e)t._layoutText(n);n.resolve()}}(this)}),this._capability.reject)}}e.TextLayerRenderTask=TextLayerRenderTask},(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.AnnotationEditorLayer=void 0;var r=n(1),i=n(141),s=n(163),a=n(164),o=n(142);class AnnotationEditorLayer{#Lt;#Nt=!1;#jt=this.pointerup.bind(this);#Bt=this.pointerdown.bind(this);#Ut=new Map;#Wt=!1;#qt=!1;#Gt;static _initialized=!1;constructor(t){if(!AnnotationEditorLayer._initialized){AnnotationEditorLayer._initialized=!0;s.FreeTextEditor.initialize(t.l10n);a.InkEditor.initialize(t.l10n)}t.uiManager.registerEditorTypes([s.FreeTextEditor,a.InkEditor]);this.#Gt=t.uiManager;this.pageIndex=t.pageIndex;this.div=t.div;this.#Lt=t.accessibilityManager;this.#Gt.addLayer(this)}get isEmpty(){return 0===this.#Ut.size}updateToolbar(t){this.#Gt.updateToolbar(t)}updateMode(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.#Gt.getMode();this.#Ht();if(t===r.AnnotationEditorType.INK){this.addInkEditorIfNeeded(!1);this.disableClick()}else this.enableClick();this.#Gt.unselectAll();if(t!==r.AnnotationEditorType.NONE){this.div.classList.toggle("freeTextEditing",t===r.AnnotationEditorType.FREETEXT);this.div.classList.toggle("inkEditing",t===r.AnnotationEditorType.INK);this.div.hidden=!1}}addInkEditorIfNeeded(t){if(!t&&this.#Gt.getMode()!==r.AnnotationEditorType.INK)return;if(!t)for(const t of this.#Ut.values())if(t.isEmpty()){t.setInBackground();return}this.#zt({offsetX:0,offsetY:0}).setInBackground()}setEditingState(t){this.#Gt.setEditingState(t)}addCommands(t){this.#Gt.addCommands(t)}enable(){this.div.style.pointerEvents="auto";for(const t of this.#Ut.values())t.enableEditing()}disable(){this.div.style.pointerEvents="none";for(const t of this.#Ut.values())t.disableEditing();this.#Ht();this.isEmpty&&(this.div.hidden=!0)}setActiveEditor(t){this.#Gt.getActive()!==t&&this.#Gt.setActiveEditor(t)}enableClick(){this.div.addEventListener("pointerdown",this.#Bt);this.div.addEventListener("pointerup",this.#jt)}disableClick(){this.div.removeEventListener("pointerdown",this.#Bt);this.div.removeEventListener("pointerup",this.#jt)}attach(t){this.#Ut.set(t.id,t)}detach(t){var e;this.#Ut.delete(t.id);null===(e=this.#Lt)||void 0===e||e.removePointerInTextLayer(t.contentDiv)}remove(t){this.#Gt.removeEditor(t);this.detach(t);t.div.style.display="none";setTimeout((()=>{t.div.style.display="";t.div.remove();t.isAttachedToDOM=!1;document.activeElement===document.body&&this.#Gt.focusMainContainer()}),0);this.#qt||this.addInkEditorIfNeeded(!1)}#Vt(t){var e;if(t.parent!==this){this.attach(t);null===(e=t.parent)||void 0===e||e.detach(t);t.setParent(this);if(t.div&&t.isAttachedToDOM){t.div.remove();this.div.append(t.div)}}}add(t){this.#Vt(t);this.#Gt.addEditor(t);this.attach(t);if(!t.isAttachedToDOM){const e=t.render();this.div.append(e);t.isAttachedToDOM=!0}this.moveEditorInDOM(t);t.onceAdded();this.#Gt.addToAnnotationStorage(t)}moveEditorInDOM(t){var e;null===(e=this.#Lt)||void 0===e||e.moveElementInDOM(this.div,t.div,t.contentDiv,!0)}addOrRebuild(t){t.needsToBeRebuilt()?t.rebuild():this.add(t)}addANewEditor(t){this.addCommands({cmd:()=>{this.addOrRebuild(t)},undo:()=>{t.remove()},mustExec:!0})}addUndoableEditor(t){this.addCommands({cmd:()=>{this.addOrRebuild(t)},undo:()=>{t.remove()},mustExec:!1})}getNextId(){return this.#Gt.getId()}#Xt(t){switch(this.#Gt.getMode()){case r.AnnotationEditorType.FREETEXT:return new s.FreeTextEditor(t);case r.AnnotationEditorType.INK:return new a.InkEditor(t)}return null}deserialize(t){switch(t.annotationType){case r.AnnotationEditorType.FREETEXT:return s.FreeTextEditor.deserialize(t,this,this.#Gt);case r.AnnotationEditorType.INK:return a.InkEditor.deserialize(t,this,this.#Gt)}return null}#zt(t){const e=this.getNextId(),n=this.#Xt({parent:this,id:e,x:t.offsetX,y:t.offsetY,uiManager:this.#Gt});n&&this.add(n);return n}setSelected(t){this.#Gt.setSelected(t)}toggleSelected(t){this.#Gt.toggleSelected(t)}isSelected(t){return this.#Gt.isSelected(t)}unselect(t){this.#Gt.unselect(t)}pointerup(t){const{isMac:e}=r.FeatureTest.platform;if(!(0!==t.button||t.ctrlKey&&e)&&t.target===this.div&&this.#Wt){this.#Wt=!1;this.#Nt?this.#zt(t):this.#Nt=!0}}pointerdown(t){const{isMac:e}=r.FeatureTest.platform;if(0!==t.button||t.ctrlKey&&e)return;if(t.target!==this.div)return;this.#Wt=!0;const n=this.#Gt.getActive();this.#Nt=!n||n.isEmpty()}drop(t){const e=t.dataTransfer.getData("text/plain"),n=this.#Gt.getEditor(e);if(!n)return;t.preventDefault();t.dataTransfer.dropEffect="move";this.#Vt(n);const r=this.div.getBoundingClientRect(),i=t.clientX-r.x,s=t.clientY-r.y;n.translate(i-n.startX,s-n.startY);this.moveEditorInDOM(n);n.div.focus()}dragover(t){t.preventDefault()}destroy(){var t;(null===(t=this.#Gt.getActive())||void 0===t?void 0:t.parent)===this&&this.#Gt.setActiveEditor(null);for(const t of this.#Ut.values()){var e;null===(e=this.#Lt)||void 0===e||e.removePointerInTextLayer(t.contentDiv);t.setParent(null);t.isAttachedToDOM=!1;t.div.remove()}this.div=null;this.#Ut.clear();this.#Gt.removeLayer(this)}#Ht(){this.#qt=!0;for(const t of this.#Ut.values())t.isEmpty()&&t.remove();this.#qt=!1}render(t){let{viewport:e}=t;this.viewport=e;(0,o.setLayerDimensions)(this.div,e);(0,i.bindEvents)(this,this.div,["dragover","drop"]);for(const t of this.#Gt.getEditors(this.pageIndex))this.add(t);this.updateMode()}update(t){let{viewport:e}=t;this.#Gt.commitOrRemove();this.viewport=e;(0,o.setLayerDimensions)(this.div,{rotation:e.rotation});this.updateMode()}get pageDimensions(){const{pageWidth:t,pageHeight:e}=this.viewport.rawDims;return[t,e]}}e.AnnotationEditorLayer=AnnotationEditorLayer},(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.FreeTextEditor=void 0;var r=n(1),i=n(141),s=n(140);class FreeTextEditor extends s.AnnotationEditor{#$t=this.editorDivBlur.bind(this);#Yt=this.editorDivFocus.bind(this);#Kt=this.editorDivInput.bind(this);#Jt=this.editorDivKeydown.bind(this);#Qt;#Zt="";#te=`${this.id}-editor`;#ee=!1;#ne;static _freeTextDefaultContent="";static _l10nPromise;static _internalPadding=0;static _defaultColor=null;static _defaultFontSize=10;static _keyboardManager=new i.KeyboardManager([[["ctrl+Enter","mac+meta+Enter","Escape","mac+Escape"],FreeTextEditor.prototype.commitOrRemove]]);static _type="freetext";constructor(t){super({...t,name:"freeTextEditor"});this.#Qt=t.color||FreeTextEditor._defaultColor||s.AnnotationEditor._defaultLineColor;this.#ne=t.fontSize||FreeTextEditor._defaultFontSize}static initialize(t){this._l10nPromise=new Map(["free_text2_default_content","editor_free_text2_aria_label"].map((e=>[e,t.get(e)])));const e=getComputedStyle(document.documentElement);this._internalPadding=parseFloat(e.getPropertyValue("--freetext-padding"))}static updateDefaultParams(t,e){switch(t){case r.AnnotationEditorParamsType.FREETEXT_SIZE:FreeTextEditor._defaultFontSize=e;break;case r.AnnotationEditorParamsType.FREETEXT_COLOR:FreeTextEditor._defaultColor=e}}updateParams(t,e){switch(t){case r.AnnotationEditorParamsType.FREETEXT_SIZE:this.#re(e);break;case r.AnnotationEditorParamsType.FREETEXT_COLOR:this.#ie(e)}}static get defaultPropertiesToUpdate(){return[[r.AnnotationEditorParamsType.FREETEXT_SIZE,FreeTextEditor._defaultFontSize],[r.AnnotationEditorParamsType.FREETEXT_COLOR,FreeTextEditor._defaultColor||s.AnnotationEditor._defaultLineColor]]}get propertiesToUpdate(){return[[r.AnnotationEditorParamsType.FREETEXT_SIZE,this.#ne],[r.AnnotationEditorParamsType.FREETEXT_COLOR,this.#Qt]]}#re(t){const setFontsize=t=>{this.editorDiv.style.fontSize=`calc(${t}px * var(--scale-factor))`;this.translate(0,-(t-this.#ne)*this.parentScale);this.#ne=t;this.#se()},e=this.#ne;this.addCommands({cmd:()=>{setFontsize(t)},undo:()=>{setFontsize(e)},mustExec:!0,type:r.AnnotationEditorParamsType.FREETEXT_SIZE,overwriteIfSameType:!0,keepUndo:!0})}#ie(t){const e=this.#Qt;this.addCommands({cmd:()=>{this.#Qt=this.editorDiv.style.color=t},undo:()=>{this.#Qt=this.editorDiv.style.color=e},mustExec:!0,type:r.AnnotationEditorParamsType.FREETEXT_COLOR,overwriteIfSameType:!0,keepUndo:!0})}getInitialTranslation(){const t=this.parentScale;return[-FreeTextEditor._internalPadding*t,-(FreeTextEditor._internalPadding+this.#ne)*t]}rebuild(){super.rebuild();null!==this.div&&(this.isAttachedToDOM||this.parent.add(this))}enableEditMode(){if(!this.isInEditMode()){this.parent.setEditingState(!1);this.parent.updateToolbar(r.AnnotationEditorType.FREETEXT);super.enableEditMode();this.overlayDiv.classList.remove("enabled");this.editorDiv.contentEditable=!0;this.div.draggable=!1;this.div.removeAttribute("aria-activedescendant");this.editorDiv.addEventListener("keydown",this.#Jt);this.editorDiv.addEventListener("focus",this.#Yt);this.editorDiv.addEventListener("blur",this.#$t);this.editorDiv.addEventListener("input",this.#Kt)}}disableEditMode(){if(this.isInEditMode()){this.parent.setEditingState(!0);super.disableEditMode();this.overlayDiv.classList.add("enabled");this.editorDiv.contentEditable=!1;this.div.setAttribute("aria-activedescendant",this.#te);this.div.draggable=!0;this.editorDiv.removeEventListener("keydown",this.#Jt);this.editorDiv.removeEventListener("focus",this.#Yt);this.editorDiv.removeEventListener("blur",this.#$t);this.editorDiv.removeEventListener("input",this.#Kt);this.div.focus({preventScroll:!0});this.isEditing=!1;this.parent.div.classList.add("freeTextEditing")}}focusin(t){super.focusin(t);t.target!==this.editorDiv&&this.editorDiv.focus()}onceAdded(){if(!this.width){this.enableEditMode();this.editorDiv.focus()}}isEmpty(){return!this.editorDiv||""===this.editorDiv.innerText.trim()}remove(){this.isEditing=!1;this.parent.setEditingState(!0);this.parent.div.classList.add("freeTextEditing");super.remove()}#ae(){const t=this.editorDiv.getElementsByTagName("div");if(0===t.length)return this.editorDiv.innerText;const e=[];for(const n of t)e.push(n.innerText.replace(/\r\n?|\n/,""));return e.join("\n")}#se(){const[t,e]=this.parentDimensions;let n;if(this.isAttachedToDOM)n=this.div.getBoundingClientRect();else{const{currentLayer:t,div:e}=this,r=e.style.display;e.style.display="hidden";t.div.append(this.div);n=e.getBoundingClientRect();e.remove();e.style.display=r}this.width=n.width/t;this.height=n.height/e}commit(){if(this.isInEditMode()){super.commit();if(!this.#ee){this.#ee=!0;this.parent.addUndoableEditor(this)}this.disableEditMode();this.#Zt=this.#ae().trimEnd();this.#se()}}shouldGetKeyboardEvents(){return this.isInEditMode()}dblclick(t){this.enableEditMode();this.editorDiv.focus()}keydown(t){if(t.target===this.div&&"Enter"===t.key){this.enableEditMode();this.editorDiv.focus()}}editorDivKeydown(t){FreeTextEditor._keyboardManager.exec(this,t)}editorDivFocus(t){this.isEditing=!0}editorDivBlur(t){this.isEditing=!1}editorDivInput(t){this.parent.div.classList.toggle("freeTextEditing",this.isEmpty())}disableEditing(){this.editorDiv.setAttribute("role","comment");this.editorDiv.removeAttribute("aria-multiline")}enableEditing(){this.editorDiv.setAttribute("role","textbox");this.editorDiv.setAttribute("aria-multiline",!0)}render(){if(this.div)return this.div;let t,e;if(this.width){t=this.x;e=this.y}super.render();this.editorDiv=document.createElement("div");this.editorDiv.className="internal";this.editorDiv.setAttribute("id",this.#te);this.enableEditing();FreeTextEditor._l10nPromise.get("editor_free_text2_aria_label").then((t=>{var e;return null===(e=this.editorDiv)||void 0===e?void 0:e.setAttribute("aria-label",t)}));FreeTextEditor._l10nPromise.get("free_text2_default_content").then((t=>{var e;return null===(e=this.editorDiv)||void 0===e?void 0:e.setAttribute("default-content",t)}));this.editorDiv.contentEditable=!0;const{style:n}=this.editorDiv;n.fontSize=`calc(${this.#ne}px * var(--scale-factor))`;n.color=this.#Qt;this.div.append(this.editorDiv);this.overlayDiv=document.createElement("div");this.overlayDiv.classList.add("overlay","enabled");this.div.append(this.overlayDiv);(0,i.bindEvents)(this,this.div,["dblclick","keydown"]);if(this.width){const[n,r]=this.parentDimensions;this.setAt(t*n,e*r,this.width*n,this.height*r);for(const t of this.#Zt.split("\n")){const e=document.createElement("div");e.append(t?document.createTextNode(t):document.createElement("br"));this.editorDiv.append(e)}this.div.draggable=!0;this.editorDiv.contentEditable=!1}else{this.div.draggable=!1;this.editorDiv.contentEditable=!0}return this.div}get contentDiv(){return this.editorDiv}static deserialize(t,e,n){const i=super.deserialize(t,e,n);i.#ne=t.fontSize;i.#Qt=r.Util.makeHexColor(...t.color);i.#Zt=t.value;return i}serialize(){if(this.isEmpty())return null;const t=FreeTextEditor._internalPadding*this.parentScale,e=this.getRect(t,t),n=s.AnnotationEditor._colorManager.convert(this.isAttachedToDOM?getComputedStyle(this.editorDiv).color:this.#Qt);return{annotationType:r.AnnotationEditorType.FREETEXT,color:n,fontSize:this.#ne,value:this.#Zt,pageIndex:this.pageIndex,rect:e,rotation:this.rotation}}}e.FreeTextEditor=FreeTextEditor},(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.InkEditor=void 0;var r=n(1),i=n(140),s=n(141);const a=16;class InkEditor extends i.AnnotationEditor{#oe=0;#le=0;#ce=0;#de=this.canvasContextMenu.bind(this);#he=this.canvasPointermove.bind(this);#ue=this.canvasPointerleave.bind(this);#pe=this.canvasPointerup.bind(this);#fe=this.canvasPointerdown.bind(this);#ge=new Path2D;#me=!1;#ve=!1;#be=!1;#ye=null;#Ae=0;#_e=0;#Se=null;static _defaultColor=null;static _defaultOpacity=1;static _defaultThickness=1;static _l10nPromise;static _type="ink";constructor(t){super({...t,name:"inkEditor"});this.color=t.color||null;this.thickness=t.thickness||null;this.opacity=t.opacity||null;this.paths=[];this.bezierPath2D=[];this.allRawPaths=[];this.currentPath=[];this.scaleFactor=1;this.translationX=this.translationY=0;this.x=0;this.y=0}static initialize(t){this._l10nPromise=new Map(["editor_ink_canvas_aria_label","editor_ink2_aria_label"].map((e=>[e,t.get(e)])))}static updateDefaultParams(t,e){switch(t){case r.AnnotationEditorParamsType.INK_THICKNESS:InkEditor._defaultThickness=e;break;case r.AnnotationEditorParamsType.INK_COLOR:InkEditor._defaultColor=e;break;case r.AnnotationEditorParamsType.INK_OPACITY:InkEditor._defaultOpacity=e/100}}updateParams(t,e){switch(t){case r.AnnotationEditorParamsType.INK_THICKNESS:this.#xe(e);break;case r.AnnotationEditorParamsType.INK_COLOR:this.#ie(e);break;case r.AnnotationEditorParamsType.INK_OPACITY:this.#Ee(e)}}static get defaultPropertiesToUpdate(){return[[r.AnnotationEditorParamsType.INK_THICKNESS,InkEditor._defaultThickness],[r.AnnotationEditorParamsType.INK_COLOR,InkEditor._defaultColor||i.AnnotationEditor._defaultLineColor],[r.AnnotationEditorParamsType.INK_OPACITY,Math.round(100*InkEditor._defaultOpacity)]]}get propertiesToUpdate(){return[[r.AnnotationEditorParamsType.INK_THICKNESS,this.thickness||InkEditor._defaultThickness],[r.AnnotationEditorParamsType.INK_COLOR,this.color||InkEditor._defaultColor||i.AnnotationEditor._defaultLineColor],[r.AnnotationEditorParamsType.INK_OPACITY,Math.round(100*(this.opacity??InkEditor._defaultOpacity))]]}#xe(t){const e=this.thickness;this.addCommands({cmd:()=>{this.thickness=t;this.#Ce()},undo:()=>{this.thickness=e;this.#Ce()},mustExec:!0,type:r.AnnotationEditorParamsType.INK_THICKNESS,overwriteIfSameType:!0,keepUndo:!0})}#ie(t){const e=this.color;this.addCommands({cmd:()=>{this.color=t;this.#we()},undo:()=>{this.color=e;this.#we()},mustExec:!0,type:r.AnnotationEditorParamsType.INK_COLOR,overwriteIfSameType:!0,keepUndo:!0})}#Ee(t){t/=100;const e=this.opacity;this.addCommands({cmd:()=>{this.opacity=t;this.#we()},undo:()=>{this.opacity=e;this.#we()},mustExec:!0,type:r.AnnotationEditorParamsType.INK_OPACITY,overwriteIfSameType:!0,keepUndo:!0})}rebuild(){super.rebuild();if(null!==this.div){if(!this.canvas){this.#Pe();this.#Te()}if(!this.isAttachedToDOM){this.parent.add(this);this.#ke()}this.#Ce()}}remove(){if(null!==this.canvas){this.isEmpty()||this.commit();this.canvas.width=this.canvas.height=0;this.canvas.remove();this.canvas=null;this.#ye.disconnect();this.#ye=null;super.remove()}}setParent(t){!this.parent&&t?this._uiManager.removeShouldRescale(this):this.parent&&null===t&&this._uiManager.addShouldRescale(this);super.setParent(t)}onScaleChanging(){const[t,e]=this.parentDimensions,n=this.width*t,r=this.height*e;this.setDimensions(n,r)}enableEditMode(){if(!this.#me&&null!==this.canvas){super.enableEditMode();this.div.draggable=!1;this.canvas.addEventListener("pointerdown",this.#fe)}}disableEditMode(){if(this.isInEditMode()&&null!==this.canvas){super.disableEditMode();this.div.draggable=!this.isEmpty();this.div.classList.remove("editing");this.canvas.removeEventListener("pointerdown",this.#fe)}}onceAdded(){this.div.draggable=!this.isEmpty()}isEmpty(){return 0===this.paths.length||1===this.paths.length&&0===this.paths[0].length}#Fe(){const{parentRotation:t,parentDimensions:[e,n]}=this;switch(t){case 90:return[0,n,n,e];case 180:return[e,n,e,n];case 270:return[e,0,n,e];default:return[0,0,e,n]}}#Me(){const{ctx:t,color:e,opacity:n,thickness:r,parentScale:i,scaleFactor:a}=this;t.lineWidth=r*i/a;t.lineCap="round";t.lineJoin="round";t.miterLimit=10;t.strokeStyle=`${e}${(0,s.opacityToHex)(n)}`}#Re(t,e){this.canvas.addEventListener("contextmenu",this.#de);this.canvas.addEventListener("pointerleave",this.#ue);this.canvas.addEventListener("pointermove",this.#he);this.canvas.addEventListener("pointerup",this.#pe);this.canvas.removeEventListener("pointerdown",this.#fe);this.isEditing=!0;if(!this.#be){this.#be=!0;this.#ke();this.thickness||=InkEditor._defaultThickness;this.color||=InkEditor._defaultColor||i.AnnotationEditor._defaultLineColor;this.opacity??=InkEditor._defaultOpacity}this.currentPath.push([t,e]);this.#ve=!1;this.#Me();this.#Se=()=>{this.#De();this.#Se&&window.requestAnimationFrame(this.#Se)};window.requestAnimationFrame(this.#Se)}#Ie(t,e){const[n,r]=this.currentPath.at(-1);if(this.currentPath.length>1&&t===n&&e===r)return;const i=this.currentPath;let s=this.#ge;i.push([t,e]);this.#ve=!0;if(i.length<=2){s.moveTo(...i[0]);s.lineTo(t,e)}else{if(3===i.length){this.#ge=s=new Path2D;s.moveTo(...i[0])}this.#Oe(s,...i.at(-3),...i.at(-2),t,e)}}#Le(){if(0===this.currentPath.length)return;const t=this.currentPath.at(-1);this.#ge.lineTo(...t)}#Ne(t,e){this.#Se=null;t=Math.min(Math.max(t,0),this.canvas.width);e=Math.min(Math.max(e,0),this.canvas.height);this.#Ie(t,e);this.#Le();let n;if(1!==this.currentPath.length)n=this.#je();else{const r=[t,e];n=[[r,r.slice(),r.slice(),r]]}const r=this.#ge,i=this.currentPath;this.currentPath=[];this.#ge=new Path2D;this.addCommands({cmd:()=>{this.allRawPaths.push(i);this.paths.push(n);this.bezierPath2D.push(r);this.rebuild()},undo:()=>{this.allRawPaths.pop();this.paths.pop();this.bezierPath2D.pop();if(0===this.paths.length)this.remove();else{if(!this.canvas){this.#Pe();this.#Te()}this.#Ce()}},mustExec:!0})}#De(){if(!this.#ve)return;this.#ve=!1;const t=Math.ceil(this.thickness*this.parentScale),e=this.currentPath.slice(-3),n=e.map((t=>t[0])),r=e.map((t=>t[1])),{ctx:i}=(Math.min(...n),Math.max(...n),Math.min(...r),Math.max(...r),this);i.save();i.clearRect(0,0,this.canvas.width,this.canvas.height);for(const t of this.bezierPath2D)i.stroke(t);i.stroke(this.#ge);i.restore()}#Oe(t,e,n,r,i,s,a){const o=(e+r)/2,l=(n+i)/2,c=(r+s)/2,d=(i+a)/2;t.bezierCurveTo(o+2*(r-o)/3,l+2*(i-l)/3,c+2*(r-c)/3,d+2*(i-d)/3,c,d)}#je(){const t=this.currentPath;if(t.length<=2)return[[t[0],t[0],t.at(-1),t.at(-1)]];const e=[];let n,[r,i]=t[0];for(n=1;n<t.length-2;n++){const[s,a]=t[n],[o,l]=t[n+1],c=(s+o)/2,d=(a+l)/2,h=[r+2*(s-r)/3,i+2*(a-i)/3],u=[c+2*(s-c)/3,d+2*(a-d)/3];e.push([[r,i],h,u,[c,d]]);[r,i]=[c,d]}const[s,a]=t[n],[o,l]=t[n+1],c=[r+2*(s-r)/3,i+2*(a-i)/3],d=[o+2*(s-o)/3,l+2*(a-l)/3];e.push([[r,i],c,d,[o,l]]);return e}#we(){if(this.isEmpty()){this.#Be();return}this.#Me();const{canvas:t,ctx:e}=this;e.setTransform(1,0,0,1,0,0);e.clearRect(0,0,t.width,t.height);this.#Be();for(const t of this.bezierPath2D)e.stroke(t)}commit(){if(!this.#me){super.commit();this.isEditing=!1;this.disableEditMode();this.setInForeground();this.#me=!0;this.div.classList.add("disabled");this.#Ce(!0);this.parent.addInkEditorIfNeeded(!0);this.parent.moveEditorInDOM(this);this.div.focus({preventScroll:!0})}}focusin(t){super.focusin(t);this.enableEditMode()}canvasPointerdown(t){if(0===t.button&&this.isInEditMode()&&!this.#me){this.setInForeground();t.preventDefault();"mouse"!==t.type&&this.div.focus();this.#Re(t.offsetX,t.offsetY)}}canvasContextMenu(t){t.preventDefault()}canvasPointermove(t){t.preventDefault();this.#Ie(t.offsetX,t.offsetY)}canvasPointerup(t){t.preventDefault();this.#Ue(t)}canvasPointerleave(t){this.#Ue(t)}#Ue(t){this.canvas.removeEventListener("pointerleave",this.#ue);this.canvas.removeEventListener("pointermove",this.#he);this.canvas.removeEventListener("pointerup",this.#pe);this.canvas.addEventListener("pointerdown",this.#fe);setTimeout((()=>{this.canvas.removeEventListener("contextmenu",this.#de)}),10);this.#Ne(t.offsetX,t.offsetY);this.addToAnnotationStorage();this.setInBackground()}#Pe(){this.canvas=document.createElement("canvas");this.canvas.width=this.canvas.height=0;this.canvas.className="inkEditorCanvas";InkEditor._l10nPromise.get("editor_ink_canvas_aria_label").then((t=>{var e;return null===(e=this.canvas)||void 0===e?void 0:e.setAttribute("aria-label",t)}));this.div.append(this.canvas);this.ctx=this.canvas.getContext("2d")}#Te(){this.#ye=new ResizeObserver((t=>{const e=t[0].contentRect;e.width&&e.height&&this.setDimensions(e.width,e.height)}));this.#ye.observe(this.div)}render(){if(this.div)return this.div;let t,e;if(this.width){t=this.x;e=this.y}super.render();InkEditor._l10nPromise.get("editor_ink2_aria_label").then((t=>{var e;return null===(e=this.div)||void 0===e?void 0:e.setAttribute("aria-label",t)}));const[n,r,i,s]=this.#Fe();this.setAt(n,r,0,0);this.setDims(i,s);this.#Pe();if(this.width){const[n,r]=this.parentDimensions;this.setAt(t*n,e*r,this.width*n,this.height*r);this.#be=!0;this.#ke();this.setDims(this.width*n,this.height*r);this.#we();this.#We();this.div.classList.add("disabled")}else{this.div.classList.add("editing");this.enableEditMode()}this.#Te();return this.div}#ke(){if(!this.#be)return;const[t,e]=this.parentDimensions;this.canvas.width=Math.ceil(this.width*t);this.canvas.height=Math.ceil(this.height*e);this.#Be()}setDimensions(t,e){const n=Math.round(t),r=Math.round(e);if(this.#Ae===n&&this.#_e===r)return;this.#Ae=n;this.#_e=r;this.canvas.style.visibility="hidden";if(this.#oe&&Math.abs(this.#oe-t/e)>.01){e=Math.ceil(t/this.#oe);this.setDims(t,e)}const[i,s]=this.parentDimensions;this.width=t/i;this.height=e/s;this.#me&&this.#qe(t,e);this.#ke();this.#we();this.canvas.style.visibility="visible";this.fixDims()}#qe(t,e){const n=this.#Ge(),r=(t-n)/this.#ce,i=(e-n)/this.#le;this.scaleFactor=Math.min(r,i)}#Be(){const t=this.#Ge()/2;this.ctx.setTransform(this.scaleFactor,0,0,this.scaleFactor,this.translationX*this.scaleFactor+t,this.translationY*this.scaleFactor+t)}static#He(t){const e=new Path2D;for(let n=0,r=t.length;n<r;n++){const[r,i,s,a]=t[n];0===n&&e.moveTo(...r);e.bezierCurveTo(i[0],i[1],s[0],s[1],a[0],a[1])}return e}#ze(t,e,n,r){const i=[],s=this.thickness/2;let a,o;for(const l of this.paths){a=[];o=[];for(let i=0,c=l.length;i<c;i++){const[c,d,h,u]=l[i],p=t*(c[0]+e)+s,f=r-t*(c[1]+n)-s,g=t*(d[0]+e)+s,m=r-t*(d[1]+n)-s,v=t*(h[0]+e)+s,b=r-t*(h[1]+n)-s,y=t*(u[0]+e)+s,A=r-t*(u[1]+n)-s;if(0===i){a.push(p,f);o.push(p,f)}a.push(g,m,v,b,y,A);this.#Ve(p,f,g,m,v,b,y,A,4,o)}i.push({bezier:a,points:o})}return i}#Ve(t,e,n,r,i,s,a,o,l,c){if(this.#Xe(t,e,n,r,i,s,a,o))c.push(a,o);else{for(let d=1;d<l-1;d++){const h=d/l,u=1-h;let p=h*t+u*n,f=h*e+u*r,g=h*n+u*i,m=h*r+u*s;p=h*p+u*g;f=h*f+u*m;g=h*g+u*(h*i+u*a);m=h*m+u*(h*s+u*o);p=h*p+u*g;f=h*f+u*m;c.push(p,f)}c.push(a,o)}}#Xe(t,e,n,r,i,s,a,o){const l=(3*n-2*t-a)**2,c=(3*r-2*e-o)**2,d=(3*i-t-2*a)**2,h=(3*s-e-2*o)**2;return Math.max(l,d)+Math.max(c,h)<=10}#$e(){let t=1/0,e=-1/0,n=1/0,i=-1/0;for(const s of this.paths)for(const[a,o,l,c]of s){const s=r.Util.bezierBoundingBox(...a,...o,...l,...c);t=Math.min(t,s[0]);n=Math.min(n,s[1]);e=Math.max(e,s[2]);i=Math.max(i,s[3])}return[t,n,e,i]}#Ge(){return this.#me?Math.ceil(this.thickness*this.parentScale):0}#Ce(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this.isEmpty())return;if(!this.#me){this.#we();return}const e=this.#$e(),n=this.#Ge();this.#ce=Math.max(a,e[2]-e[0]);this.#le=Math.max(a,e[3]-e[1]);const r=Math.ceil(n+this.#ce*this.scaleFactor),i=Math.ceil(n+this.#le*this.scaleFactor),[s,o]=this.parentDimensions;this.width=r/s;this.height=i/o;this.#oe=r/i;this.#We();const l=this.translationX,c=this.translationY;this.translationX=-e[0];this.translationY=-e[1];this.#ke();this.#we();this.#Ae=r;this.#_e=i;this.setDims(r,i);const d=t?n/this.scaleFactor/2:0;this.translate(l-this.translationX-d,c-this.translationY-d)}#We(){const{style:t}=this.div;if(this.#oe>=1){t.minHeight="16px";t.minWidth=`${Math.round(this.#oe*a)}px`}else{t.minWidth="16px";t.minHeight=`${Math.round(a/this.#oe)}px`}}static deserialize(t,e,n){const i=super.deserialize(t,e,n);i.thickness=t.thickness;i.color=r.Util.makeHexColor(...t.color);i.opacity=t.opacity;const[s,o]=i.pageDimensions,l=i.width*s,c=i.height*o,d=i.parentScale,h=t.thickness/2;i.#oe=l/c;i.#me=!0;i.#Ae=Math.round(l);i.#_e=Math.round(c);for(const{bezier:e}of t.paths){const t=[];i.paths.push(t);let n=d*(e[0]-h),r=d*(c-e[1]-h);for(let i=2,s=e.length;i<s;i+=6){const s=d*(e[i]-h),a=d*(c-e[i+1]-h),o=d*(e[i+2]-h),l=d*(c-e[i+3]-h),u=d*(e[i+4]-h),p=d*(c-e[i+5]-h);t.push([[n,r],[s,a],[o,l],[u,p]]);n=u;r=p}const s=this.#He(t);i.bezierPath2D.push(s)}const u=i.#$e();i.#ce=Math.max(a,u[2]-u[0]);i.#le=Math.max(a,u[3]-u[1]);i.#qe(l,c);return i}serialize(){if(this.isEmpty())return null;const t=this.getRect(0,0),e=this.rotation%180==0?t[3]-t[1]:t[2]-t[0],n=i.AnnotationEditor._colorManager.convert(this.ctx.strokeStyle);return{annotationType:r.AnnotationEditorType.INK,color:n,thickness:this.thickness,opacity:this.opacity,paths:this.#ze(this.scaleFactor/this.parentScale,this.translationX,this.translationY,e),pageIndex:this.pageIndex,rect:t,rotation:this.rotation}}}e.InkEditor=InkEditor},(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.AnnotationLayer=void 0;var r=n(1),i=n(142),s=n(139),a=n(166),o=n(167);const l=1e3,c=new WeakSet;function getRectDims(t){return{width:t[2]-t[0],height:t[3]-t[1]}}class AnnotationElementFactory{static create(t){switch(t.data.annotationType){case r.AnnotationType.LINK:return new LinkAnnotationElement(t);case r.AnnotationType.TEXT:return new TextAnnotationElement(t);case r.AnnotationType.WIDGET:switch(t.data.fieldType){case"Tx":return new TextWidgetAnnotationElement(t);case"Btn":return t.data.radioButton?new RadioButtonWidgetAnnotationElement(t):t.data.checkBox?new CheckboxWidgetAnnotationElement(t):new PushButtonWidgetAnnotationElement(t);case"Ch":return new ChoiceWidgetAnnotationElement(t)}return new WidgetAnnotationElement(t);case r.AnnotationType.POPUP:return new PopupAnnotationElement(t);case r.AnnotationType.FREETEXT:return new FreeTextAnnotationElement(t);case r.AnnotationType.LINE:return new LineAnnotationElement(t);case r.AnnotationType.SQUARE:return new SquareAnnotationElement(t);case r.AnnotationType.CIRCLE:return new CircleAnnotationElement(t);case r.AnnotationType.POLYLINE:return new PolylineAnnotationElement(t);case r.AnnotationType.CARET:return new CaretAnnotationElement(t);case r.AnnotationType.INK:return new InkAnnotationElement(t);case r.AnnotationType.POLYGON:return new PolygonAnnotationElement(t);case r.AnnotationType.HIGHLIGHT:return new HighlightAnnotationElement(t);case r.AnnotationType.UNDERLINE:return new UnderlineAnnotationElement(t);case r.AnnotationType.SQUIGGLY:return new SquigglyAnnotationElement(t);case r.AnnotationType.STRIKEOUT:return new StrikeOutAnnotationElement(t);case r.AnnotationType.STAMP:return new StampAnnotationElement(t);case r.AnnotationType.FILEATTACHMENT:return new FileAttachmentAnnotationElement(t);default:return new AnnotationElement(t)}}}class AnnotationElement{constructor(t){let{isRenderable:e=!1,ignoreBorder:n=!1,createQuadrilaterals:r=!1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.isRenderable=e;this.data=t.data;this.layer=t.layer;this.page=t.page;this.viewport=t.viewport;this.linkService=t.linkService;this.downloadManager=t.downloadManager;this.imageResourcesPath=t.imageResourcesPath;this.renderForms=t.renderForms;this.svgFactory=t.svgFactory;this.annotationStorage=t.annotationStorage;this.enableScripting=t.enableScripting;this.hasJSActions=t.hasJSActions;this._fieldObjects=t.fieldObjects;e&&(this.container=this._createContainer(n));r&&(this.quadrilaterals=this._createQuadrilaterals(n))}_createContainer(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const{data:e,page:n,viewport:i}=this,s=document.createElement("section");s.setAttribute("data-annotation-id",e.id);e.noRotate&&s.classList.add("norotate");const{pageWidth:a,pageHeight:o,pageX:l,pageY:c}=i.rawDims,{width:d,height:h}=getRectDims(e.rect),u=r.Util.normalizeRect([e.rect[0],n.view[3]-e.rect[1]+n.view[1],e.rect[2],n.view[3]-e.rect[3]+n.view[1]]);if(!t&&e.borderStyle.width>0){s.style.borderWidth=`${e.borderStyle.width}px`;const t=e.borderStyle.horizontalCornerRadius,n=e.borderStyle.verticalCornerRadius;if(t>0||n>0){const e=`calc(${t}px * var(--scale-factor)) / calc(${n}px * var(--scale-factor))`;s.style.borderRadius=e}else if(this instanceof RadioButtonWidgetAnnotationElement){const t=`calc(${d}px * var(--scale-factor)) / calc(${h}px * var(--scale-factor))`;s.style.borderRadius=t}switch(e.borderStyle.style){case r.AnnotationBorderStyleType.SOLID:s.style.borderStyle="solid";break;case r.AnnotationBorderStyleType.DASHED:s.style.borderStyle="dashed";break;case r.AnnotationBorderStyleType.BEVELED:(0,r.warn)("Unimplemented border style: beveled");break;case r.AnnotationBorderStyleType.INSET:(0,r.warn)("Unimplemented border style: inset");break;case r.AnnotationBorderStyleType.UNDERLINE:s.style.borderBottomStyle="solid"}const i=e.borderColor||null;i?s.style.borderColor=r.Util.makeHexColor(0|i[0],0|i[1],0|i[2]):s.style.borderWidth=0}s.style.left=100*(u[0]-l)/a+"%";s.style.top=100*(u[1]-c)/o+"%";const{rotation:p}=e;if(e.hasOwnCanvas||0===p){s.style.width=100*d/a+"%";s.style.height=100*h/o+"%"}else this.setRotation(p,s);return s}setRotation(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.container;const{pageWidth:n,pageHeight:r}=this.viewport.rawDims,{width:i,height:s}=getRectDims(this.data.rect);let a,o;if(t%180==0){a=100*i/n;o=100*s/r}else{a=100*s/n;o=100*i/r}e.style.width=`${a}%`;e.style.height=`${o}%`;e.setAttribute("data-main-rotation",(360-t)%360)}get _commonActions(){const setColor=(t,e,n)=>{const r=n.detail[t];n.target.style[e]=a.ColorConverters[`${r[0]}_HTML`](r.slice(1))};return(0,r.shadow)(this,"_commonActions",{display:t=>{const e=t.detail.display%2==1;this.container.style.visibility=e?"hidden":"visible";this.annotationStorage.setValue(this.data.id,{hidden:e,print:0===t.detail.display||3===t.detail.display})},print:t=>{this.annotationStorage.setValue(this.data.id,{print:t.detail.print})},hidden:t=>{this.container.style.visibility=t.detail.hidden?"hidden":"visible";this.annotationStorage.setValue(this.data.id,{hidden:t.detail.hidden})},focus:t=>{setTimeout((()=>t.target.focus({preventScroll:!1})),0)},userName:t=>{t.target.title=t.detail.userName},readonly:t=>{t.detail.readonly?t.target.setAttribute("readonly",""):t.target.removeAttribute("readonly")},required:t=>{this._setRequired(t.target,t.detail.required)},bgColor:t=>{setColor("bgColor","backgroundColor",t)},fillColor:t=>{setColor("fillColor","backgroundColor",t)},fgColor:t=>{setColor("fgColor","color",t)},textColor:t=>{setColor("textColor","color",t)},borderColor:t=>{setColor("borderColor","borderColor",t)},strokeColor:t=>{setColor("strokeColor","borderColor",t)},rotation:t=>{const e=t.detail.rotation;this.setRotation(e);this.annotationStorage.setValue(this.data.id,{rotation:e})}})}_dispatchEventFromSandbox(t,e){const n=this._commonActions;for(const r of Object.keys(e.detail)){const i=t[r]||n[r];null==i||i(e)}}_setDefaultPropertiesFromJS(t){if(!this.enableScripting)return;const e=this.annotationStorage.getRawValue(this.data.id);if(!e)return;const n=this._commonActions;for(const[r,i]of Object.entries(e)){const s=n[r];if(s){s({detail:{[r]:i},target:t});delete e[r]}}}_createQuadrilaterals(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!this.data.quadPoints)return null;const e=[],n=this.data.rect;for(const n of this.data.quadPoints){this.data.rect=[n[2].x,n[2].y,n[1].x,n[1].y];e.push(this._createContainer(t))}this.data.rect=n;return e}_createPopup(t,e){let n=this.container;if(this.quadrilaterals){t||=this.quadrilaterals;n=this.quadrilaterals[0]}if(!t){(t=document.createElement("div")).classList.add("popupTriggerArea");n.append(t)}const r=new PopupElement({container:n,trigger:t,color:e.color,titleObj:e.titleObj,modificationDate:e.modificationDate,contentsObj:e.contentsObj,richText:e.richText,hideWrapper:!0}).render();r.style.left="100%";n.append(r)}_renderQuadrilaterals(t){for(const e of this.quadrilaterals)e.classList.add(t);return this.quadrilaterals}render(){(0,r.unreachable)("Abstract method `AnnotationElement.render` called")}_getElementsByName(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;const n=[];if(this._fieldObjects){const i=this._fieldObjects[t];if(i)for(const{page:t,id:s,exportValues:a}of i){if(-1===t)continue;if(s===e)continue;const i="string"==typeof a?a:null,o=document.querySelector(`[data-element-id="${s}"]`);!o||c.has(o)?n.push({id:s,exportValue:i,domElement:o}):(0,r.warn)(`_getElementsByName - element not allowed: ${s}`)}return n}for(const r of document.getElementsByName(t)){const{exportValue:t}=r,i=r.getAttribute("data-element-id");i!==e&&(c.has(r)&&n.push({id:i,exportValue:t,domElement:r}))}return n}}class LinkAnnotationElement extends AnnotationElement{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;super(t,{isRenderable:!0,ignoreBorder:!(null==e||!e.ignoreBorder),createQuadrilaterals:!0});this.isTooltipOnly=t.data.isTooltipOnly}render(){const{data:t,linkService:e}=this,n=document.createElement("a");n.setAttribute("data-element-id",t.id);let r=!1;if(t.url){e.addLinkAttributes(n,t.url,t.newWindow);r=!0}else if(t.action){this._bindNamedAction(n,t.action);r=!0}else if(t.attachment){this._bindAttachment(n,t.attachment);r=!0}else if(t.setOCGState){this.#Ye(n,t.setOCGState);r=!0}else if(t.dest){this._bindLink(n,t.dest);r=!0}else{if(t.actions&&(t.actions.Action||t.actions["Mouse Up"]||t.actions["Mouse Down"])&&this.enableScripting&&this.hasJSActions){this._bindJSAction(n,t);r=!0}if(t.resetForm){this._bindResetFormAction(n,t.resetForm);r=!0}else if(this.isTooltipOnly&&!r){this._bindLink(n,"");r=!0}}if(this.quadrilaterals)return this._renderQuadrilaterals("linkAnnotation").map(((t,e)=>{const r=0===e?n:n.cloneNode();t.append(r);return t}));this.container.classList.add("linkAnnotation");r&&this.container.append(n);return this.container}#Ke(){this.container.setAttribute("data-internal-link","")}_bindLink(t,e){t.href=this.linkService.getDestinationHash(e);t.onclick=()=>{e&&this.linkService.goToDestination(e);return!1};(e||""===e)&&this.#Ke()}_bindNamedAction(t,e){t.href=this.linkService.getAnchorUrl("");t.onclick=()=>{this.linkService.executeNamedAction(e);return!1};this.#Ke()}_bindAttachment(t,e){t.href=this.linkService.getAnchorUrl("");t.onclick=()=>{var t;null===(t=this.downloadManager)||void 0===t||t.openOrDownloadData(this.container,e.content,e.filename);return!1};this.#Ke()}#Ye(t,e){t.href=this.linkService.getAnchorUrl("");t.onclick=()=>{this.linkService.executeSetOCGState(e);return!1};this.#Ke()}_bindJSAction(t,e){t.href=this.linkService.getAnchorUrl("");const n=new Map([["Action","onclick"],["Mouse Up","onmouseup"],["Mouse Down","onmousedown"]]);for(const r of Object.keys(e.actions)){const i=n.get(r);i&&(t[i]=()=>{var t;null===(t=this.linkService.eventBus)||void 0===t||t.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e.id,name:r}});return!1})}t.onclick||(t.onclick=()=>!1);this.#Ke()}_bindResetFormAction(t,e){const n=t.onclick;n||(t.href=this.linkService.getAnchorUrl(""));this.#Ke();if(this._fieldObjects)t.onclick=()=>{null==n||n();const{fields:t,refs:i,include:s}=e,a=[];if(0!==t.length||0!==i.length){const e=new Set(i);for(const n of t){const t=this._fieldObjects[n]||[];for(const{id:n}of t)e.add(n)}for(const t of Object.values(this._fieldObjects))for(const n of t)e.has(n.id)===s&&a.push(n)}else for(const t of Object.values(this._fieldObjects))a.push(...t);const o=this.annotationStorage,l=[];for(const t of a){const{id:e}=t;l.push(e);switch(t.type){case"text":{const n=t.defaultValue||"";o.setValue(e,{value:n});break}case"checkbox":case"radiobutton":{const n=t.defaultValue===t.exportValues;o.setValue(e,{value:n});break}case"combobox":case"listbox":{const n=t.defaultValue||"";o.setValue(e,{value:n});break}default:continue}const n=document.querySelector(`[data-element-id="${e}"]`);n&&(c.has(n)?n.dispatchEvent(new Event("resetform")):(0,r.warn)(`_bindResetFormAction - element not allowed: ${e}`))}if(this.enableScripting){var d;null===(d=this.linkService.eventBus)||void 0===d||d.dispatch("dispatcheventinsandbox",{source:this,detail:{id:"app",ids:l,name:"ResetForm"}})}return!1};else{(0,r.warn)('_bindResetFormAction - "resetForm" action not supported, ensure that the `fieldObjects` parameter is provided.');n||(t.onclick=()=>!1)}}}class TextAnnotationElement extends AnnotationElement{constructor(t){var e,n,r;super(t,{isRenderable:!!(t.data.hasPopup||null!==(e=t.data.titleObj)&&void 0!==e&&e.str||null!==(n=t.data.contentsObj)&&void 0!==n&&n.str||null!==(r=t.data.richText)&&void 0!==r&&r.str)})}render(){this.container.classList.add("textAnnotation");const t=document.createElement("img");t.src=this.imageResourcesPath+"annotation-"+this.data.name.toLowerCase()+".svg";t.alt="[{{type}} Annotation]";t.dataset.l10nId="text_annotation_type";t.dataset.l10nArgs=JSON.stringify({type:this.data.name});this.data.hasPopup||this._createPopup(t,this.data);this.container.append(t);return this.container}}class WidgetAnnotationElement extends AnnotationElement{render(){this.data.alternativeText&&(this.container.title=this.data.alternativeText);return this.container}showElementAndHideCanvas(t){if(this.data.hasOwnCanvas){var e;"CANVAS"===(null===(e=t.previousSibling)||void 0===e?void 0:e.nodeName)&&(t.previousSibling.hidden=!0);t.hidden=!1}}_getKeyModifier(t){const{isWin:e,isMac:n}=r.FeatureTest.platform;return e&&t.ctrlKey||n&&t.metaKey}_setEventListener(t,e,n,r){e.includes("mouse")?t.addEventListener(e,(t=>{var e;null===(e=this.linkService.eventBus)||void 0===e||e.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:n,value:r(t),shift:t.shiftKey,modifier:this._getKeyModifier(t)}})})):t.addEventListener(e,(t=>{var e;null===(e=this.linkService.eventBus)||void 0===e||e.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:n,value:r(t)}})}))}_setEventListeners(t,e,n){for(const[i,s]of e){var r;("Action"===s||null!==(r=this.data.actions)&&void 0!==r&&r[s])&&this._setEventListener(t,i,s,n)}}_setBackgroundColor(t){const e=this.data.backgroundColor||null;t.style.backgroundColor=null===e?"transparent":r.Util.makeHexColor(e[0],e[1],e[2])}_setTextStyle(t){const e=["left","center","right"],{fontColor:n}=this.data.defaultAppearanceData,i=this.data.defaultAppearanceData.fontSize||9,s=t.style;let a;const roundToOneDecimal=t=>Math.round(10*t)/10;if(this.data.multiLine){const t=Math.abs(this.data.rect[3]-this.data.rect[1]-2),e=t/(Math.round(t/(r.LINE_FACTOR*i))||1);a=Math.min(i,roundToOneDecimal(e/r.LINE_FACTOR))}else{const t=Math.abs(this.data.rect[3]-this.data.rect[1]-2);a=Math.min(i,roundToOneDecimal(t/r.LINE_FACTOR))}s.fontSize=`calc(${a}px * var(--scale-factor))`;s.color=r.Util.makeHexColor(n[0],n[1],n[2]);null!==this.data.textAlignment&&(s.textAlign=e[this.data.textAlignment])}_setRequired(t,e){e?t.setAttribute("required",!0):t.removeAttribute("required");t.setAttribute("aria-required",e)}}class TextWidgetAnnotationElement extends WidgetAnnotationElement{constructor(t){super(t,{isRenderable:t.renderForms||!t.data.hasAppearance&&!!t.data.fieldValue})}setPropertyOnSiblings(t,e,n,r){const i=this.annotationStorage;for(const s of this._getElementsByName(t.name,t.id)){s.domElement&&(s.domElement[e]=n);i.setValue(s.id,{[r]:n})}}render(){const t=this.annotationStorage,e=this.data.id;this.container.classList.add("textWidgetAnnotation");let n=null;if(this.renderForms){var r;const s=t.getValue(e,{value:this.data.fieldValue});let a=s.value||"";const o=t.getValue(e,{charLimit:this.data.maxLen}).charLimit;o&&a.length>o&&(a=a.slice(0,o));let d=s.formattedValue||(null===(r=this.data.textContent)||void 0===r?void 0:r.join("\n"))||null;d&&this.data.comb&&(d=d.replaceAll(/\s+/g,""));const h={userValue:a,formattedValue:d,lastCommittedValue:null,commitKey:1};if(this.data.multiLine){n=document.createElement("textarea");n.textContent=d??a;this.data.doNotScroll&&(n.style.overflowY="hidden")}else{n=document.createElement("input");n.type="text";n.setAttribute("value",d??a);this.data.doNotScroll&&(n.style.overflowX="hidden")}this.data.hasOwnCanvas&&(n.hidden=!0);c.add(n);n.setAttribute("data-element-id",e);n.disabled=this.data.readOnly;n.name=this.data.fieldName;n.tabIndex=l;this._setRequired(n,this.data.required);o&&(n.maxLength=o);n.addEventListener("input",(r=>{t.setValue(e,{value:r.target.value});this.setPropertyOnSiblings(n,"value",r.target.value,"value");h.formattedValue=null}));n.addEventListener("resetform",(t=>{const e=this.data.defaultFieldValue??"";n.value=h.userValue=e;h.formattedValue=null}));let blurListener=t=>{const{formattedValue:e}=h;null!=e&&(t.target.value=e);t.target.scrollLeft=0};if(this.enableScripting&&this.hasJSActions){var i;n.addEventListener("focus",(t=>{const{target:e}=t;h.userValue&&(e.value=h.userValue);h.lastCommittedValue=e.value;h.commitKey=1}));n.addEventListener("updatefromsandbox",(n=>{this.showElementAndHideCanvas(n.target);const r={value(n){h.userValue=n.detail.value??"";t.setValue(e,{value:h.userValue.toString()});n.target.value=h.userValue},formattedValue(n){const{formattedValue:r}=n.detail;h.formattedValue=r;null!=r&&n.target!==document.activeElement&&(n.target.value=r);t.setValue(e,{formattedValue:r})},selRange(t){t.target.setSelectionRange(...t.detail.selRange)},charLimit:n=>{var r;const{charLimit:i}=n.detail,{target:s}=n;if(0===i){s.removeAttribute("maxLength");return}s.setAttribute("maxLength",i);let a=h.userValue;if(a&&!(a.length<=i)){a=a.slice(0,i);s.value=h.userValue=a;t.setValue(e,{value:a});null===(r=this.linkService.eventBus)||void 0===r||r.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:a,willCommit:!0,commitKey:1,selStart:s.selectionStart,selEnd:s.selectionEnd}})}}};this._dispatchEventFromSandbox(r,n)}));n.addEventListener("keydown",(t=>{var n;h.commitKey=1;let r=-1;"Escape"===t.key?r=0:"Enter"!==t.key||this.data.multiLine?"Tab"===t.key&&(h.commitKey=3):r=2;if(-1===r)return;const{value:i}=t.target;if(h.lastCommittedValue!==i){h.lastCommittedValue=i;h.userValue=i;null===(n=this.linkService.eventBus)||void 0===n||n.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:i,willCommit:!0,commitKey:r,selStart:t.target.selectionStart,selEnd:t.target.selectionEnd}})}}));const r=blurListener;blurListener=null;n.addEventListener("blur",(t=>{if(!t.relatedTarget)return;const{value:n}=t.target;h.userValue=n;if(h.lastCommittedValue!==n){var i;null===(i=this.linkService.eventBus)||void 0===i||i.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:n,willCommit:!0,commitKey:h.commitKey,selStart:t.target.selectionStart,selEnd:t.target.selectionEnd}})}r(t)}));null!==(i=this.data.actions)&&void 0!==i&&i.Keystroke&&n.addEventListener("beforeinput",(t=>{var n;h.lastCommittedValue=null;const{data:r,target:i}=t,{value:s,selectionStart:a,selectionEnd:o}=i;let l=a,c=o;switch(t.inputType){case"deleteWordBackward":{const t=s.substring(0,a).match(/\w*[^\w]*$/);t&&(l-=t[0].length);break}case"deleteWordForward":{const t=s.substring(a).match(/^[^\w]*\w*/);t&&(c+=t[0].length);break}case"deleteContentBackward":a===o&&(l-=1);break;case"deleteContentForward":a===o&&(c+=1)}t.preventDefault();null===(n=this.linkService.eventBus)||void 0===n||n.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:s,change:r||"",willCommit:!1,selStart:l,selEnd:c}})}));this._setEventListeners(n,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],(t=>t.target.value))}blurListener&&n.addEventListener("blur",blurListener);if(this.data.comb){const t=(this.data.rect[2]-this.data.rect[0])/o;n.classList.add("comb");n.style.letterSpacing=`calc(${t}px * var(--scale-factor) - 1ch)`}}else{n=document.createElement("div");n.textContent=this.data.fieldValue;n.style.verticalAlign="middle";n.style.display="table-cell"}this._setTextStyle(n);this._setBackgroundColor(n);this._setDefaultPropertiesFromJS(n);this.container.append(n);return this.container}}class CheckboxWidgetAnnotationElement extends WidgetAnnotationElement{constructor(t){super(t,{isRenderable:t.renderForms})}render(){const t=this.annotationStorage,e=this.data,n=e.id;let r=t.getValue(n,{value:e.exportValue===e.fieldValue}).value;if("string"==typeof r){r="Off"!==r;t.setValue(n,{value:r})}this.container.classList.add("buttonWidgetAnnotation","checkBox");const i=document.createElement("input");c.add(i);i.setAttribute("data-element-id",n);i.disabled=e.readOnly;this._setRequired(i,this.data.required);i.type="checkbox";i.name=e.fieldName;r&&i.setAttribute("checked",!0);i.setAttribute("exportValue",e.exportValue);i.tabIndex=l;i.addEventListener("change",(r=>{const{name:i,checked:s}=r.target;for(const r of this._getElementsByName(i,n)){const n=s&&r.exportValue===e.exportValue;r.domElement&&(r.domElement.checked=n);t.setValue(r.id,{value:n})}t.setValue(n,{value:s})}));i.addEventListener("resetform",(t=>{const n=e.defaultFieldValue||"Off";t.target.checked=n===e.exportValue}));if(this.enableScripting&&this.hasJSActions){i.addEventListener("updatefromsandbox",(e=>{const r={value(e){e.target.checked="Off"!==e.detail.value;t.setValue(n,{value:e.target.checked})}};this._dispatchEventFromSandbox(r,e)}));this._setEventListeners(i,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],(t=>t.target.checked))}this._setBackgroundColor(i);this._setDefaultPropertiesFromJS(i);this.container.append(i);return this.container}}class RadioButtonWidgetAnnotationElement extends WidgetAnnotationElement{constructor(t){super(t,{isRenderable:t.renderForms})}render(){this.container.classList.add("buttonWidgetAnnotation","radioButton");const t=this.annotationStorage,e=this.data,n=e.id;let r=t.getValue(n,{value:e.fieldValue===e.buttonValue}).value;if("string"==typeof r){r=r!==e.buttonValue;t.setValue(n,{value:r})}const i=document.createElement("input");c.add(i);i.setAttribute("data-element-id",n);i.disabled=e.readOnly;this._setRequired(i,this.data.required);i.type="radio";i.name=e.fieldName;r&&i.setAttribute("checked",!0);i.tabIndex=l;i.addEventListener("change",(e=>{const{name:r,checked:i}=e.target;for(const e of this._getElementsByName(r,n))t.setValue(e.id,{value:!1});t.setValue(n,{value:i})}));i.addEventListener("resetform",(t=>{const n=e.defaultFieldValue;t.target.checked=null!=n&&n===e.buttonValue}));if(this.enableScripting&&this.hasJSActions){const r=e.buttonValue;i.addEventListener("updatefromsandbox",(e=>{const i={value:e=>{const i=r===e.detail.value;for(const r of this._getElementsByName(e.target.name)){const e=i&&r.id===n;r.domElement&&(r.domElement.checked=e);t.setValue(r.id,{value:e})}}};this._dispatchEventFromSandbox(i,e)}));this._setEventListeners(i,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],(t=>t.target.checked))}this._setBackgroundColor(i);this._setDefaultPropertiesFromJS(i);this.container.append(i);return this.container}}class PushButtonWidgetAnnotationElement extends LinkAnnotationElement{constructor(t){super(t,{ignoreBorder:t.data.hasAppearance})}render(){const t=super.render();t.classList.add("buttonWidgetAnnotation","pushButton");this.data.alternativeText&&(t.title=this.data.alternativeText);const e=t.lastChild;if(this.enableScripting&&this.hasJSActions&&e){this._setDefaultPropertiesFromJS(e);e.addEventListener("updatefromsandbox",(t=>{this._dispatchEventFromSandbox({},t)}))}return t}}class ChoiceWidgetAnnotationElement extends WidgetAnnotationElement{constructor(t){super(t,{isRenderable:t.renderForms})}render(){this.container.classList.add("choiceWidgetAnnotation");const t=this.annotationStorage,e=this.data.id,n=t.getValue(e,{value:this.data.fieldValue}),r=document.createElement("select");c.add(r);r.setAttribute("data-element-id",e);r.disabled=this.data.readOnly;this._setRequired(r,this.data.required);r.name=this.data.fieldName;r.tabIndex=l;let i=this.data.combo&&this.data.options.length>0;if(!this.data.combo){r.size=this.data.options.length;this.data.multiSelect&&(r.multiple=!0)}r.addEventListener("resetform",(t=>{const e=this.data.defaultFieldValue;for(const t of r.options)t.selected=t.value===e}));for(const t of this.data.options){const e=document.createElement("option");e.textContent=t.displayValue;e.value=t.exportValue;if(n.value.includes(t.exportValue)){e.setAttribute("selected",!0);i=!1}r.append(e)}let s=null;if(i){const t=document.createElement("option");t.value=" ";t.setAttribute("hidden",!0);t.setAttribute("selected",!0);r.prepend(t);s=()=>{t.remove();r.removeEventListener("input",s);s=null};r.addEventListener("input",s)}const getValue=t=>{const e=t?"value":"textContent",{options:n,multiple:i}=r;return i?Array.prototype.filter.call(n,(t=>t.selected)).map((t=>t[e])):-1===n.selectedIndex?null:n[n.selectedIndex][e]};let a=getValue(!1);const getItems=t=>{const e=t.target.options;return Array.prototype.map.call(e,(t=>({displayValue:t.textContent,exportValue:t.value})))};if(this.enableScripting&&this.hasJSActions){r.addEventListener("updatefromsandbox",(n=>{const i={value(n){var i;null===(i=s)||void 0===i||i();const o=n.detail.value,l=new Set(Array.isArray(o)?o:[o]);for(const t of r.options)t.selected=l.has(t.value);t.setValue(e,{value:getValue(!0)});a=getValue(!1)},multipleSelection(t){r.multiple=!0},remove(n){const i=r.options,s=n.detail.remove;i[s].selected=!1;r.remove(s);if(i.length>0){-1===Array.prototype.findIndex.call(i,(t=>t.selected))&&(i[0].selected=!0)}t.setValue(e,{value:getValue(!0),items:getItems(n)});a=getValue(!1)},clear(n){for(;0!==r.length;)r.remove(0);t.setValue(e,{value:null,items:[]});a=getValue(!1)},insert(n){const{index:i,displayValue:s,exportValue:o}=n.detail.insert,l=r.children[i],c=document.createElement("option");c.textContent=s;c.value=o;l?l.before(c):r.append(c);t.setValue(e,{value:getValue(!0),items:getItems(n)});a=getValue(!1)},items(n){const{items:i}=n.detail;for(;0!==r.length;)r.remove(0);for(const t of i){const{displayValue:e,exportValue:n}=t,i=document.createElement("option");i.textContent=e;i.value=n;r.append(i)}r.options.length>0&&(r.options[0].selected=!0);t.setValue(e,{value:getValue(!0),items:getItems(n)});a=getValue(!1)},indices(n){const r=new Set(n.detail.indices);for(const t of n.target.options)t.selected=r.has(t.index);t.setValue(e,{value:getValue(!0)});a=getValue(!1)},editable(t){t.target.disabled=!t.detail.editable}};this._dispatchEventFromSandbox(i,n)}));r.addEventListener("input",(n=>{var r;const i=getValue(!0);t.setValue(e,{value:i});n.preventDefault();null===(r=this.linkService.eventBus)||void 0===r||r.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:a,changeEx:i,willCommit:!1,commitKey:1,keyDown:!1}})}));this._setEventListeners(r,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"],["input","Action"],["input","Validate"]],(t=>t.target.value))}else r.addEventListener("input",(function(n){t.setValue(e,{value:getValue(!0)})}));this.data.combo&&this._setTextStyle(r);this._setBackgroundColor(r);this._setDefaultPropertiesFromJS(r);this.container.append(r);return this.container}}class PopupAnnotationElement extends AnnotationElement{static IGNORE_TYPES=new Set(["Line","Square","Circle","PolyLine","Polygon","Ink"]);constructor(t){var e,n,r;const{data:i}=t;super(t,{isRenderable:!PopupAnnotationElement.IGNORE_TYPES.has(i.parentType)&&!!(null!==(e=i.titleObj)&&void 0!==e&&e.str||null!==(n=i.contentsObj)&&void 0!==n&&n.str||null!==(r=i.richText)&&void 0!==r&&r.str)})}render(){this.container.classList.add("popupAnnotation");const t=this.layer.querySelectorAll(`[data-annotation-id="${this.data.parentId}"]`);if(0===t.length)return this.container;const e=new PopupElement({container:this.container,trigger:Array.from(t),color:this.data.color,titleObj:this.data.titleObj,modificationDate:this.data.modificationDate,contentsObj:this.data.contentsObj,richText:this.data.richText}),n=this.page,i=r.Util.normalizeRect([this.data.parentRect[0],n.view[3]-this.data.parentRect[1]+n.view[1],this.data.parentRect[2],n.view[3]-this.data.parentRect[3]+n.view[1]]),s=i[0]+this.data.parentRect[2]-this.data.parentRect[0],a=i[1],{pageWidth:o,pageHeight:l,pageX:c,pageY:d}=this.viewport.rawDims;this.container.style.left=100*(s-c)/o+"%";this.container.style.top=100*(a-d)/l+"%";this.container.append(e.render());return this.container}}class PopupElement{constructor(t){this.container=t.container;this.trigger=t.trigger;this.color=t.color;this.titleObj=t.titleObj;this.modificationDate=t.modificationDate;this.contentsObj=t.contentsObj;this.richText=t.richText;this.hideWrapper=t.hideWrapper||!1;this.pinned=!1}render(){var t,e;const n=document.createElement("div");n.classList.add("popupWrapper");this.hideElement=this.hideWrapper?n:this.container;this.hideElement.hidden=!0;const s=document.createElement("div");s.classList.add("popup");const a=this.color;if(a){const t=.7*(255-a[0])+a[0],e=.7*(255-a[1])+a[1],n=.7*(255-a[2])+a[2];s.style.backgroundColor=r.Util.makeHexColor(0|t,0|e,0|n)}const l=document.createElement("h1");l.dir=this.titleObj.dir;l.textContent=this.titleObj.str;s.append(l);const c=i.PDFDateString.toDateObject(this.modificationDate);if(c){const t=document.createElement("span");t.classList.add("popupDate");t.textContent="{{date}}, {{time}}";t.dataset.l10nId="annotation_date_string";t.dataset.l10nArgs=JSON.stringify({date:c.toLocaleDateString(),time:c.toLocaleTimeString()});s.append(t)}if(null===(t=this.richText)||void 0===t||!t.str||null!==(e=this.contentsObj)&&void 0!==e&&e.str&&this.contentsObj.str!==this.richText.str){const t=this._formatContents(this.contentsObj);s.append(t)}else{o.XfaLayer.render({xfaHtml:this.richText.html,intent:"richText",div:s});s.lastChild.classList.add("richText","popupContent")}Array.isArray(this.trigger)||(this.trigger=[this.trigger]);for(const t of this.trigger){t.addEventListener("click",this._toggle.bind(this));t.addEventListener("mouseover",this._show.bind(this,!1));t.addEventListener("mouseout",this._hide.bind(this,!1))}s.addEventListener("click",this._hide.bind(this,!0));n.append(s);return n}_formatContents(t){let{str:e,dir:n}=t;const r=document.createElement("p");r.classList.add("popupContent");r.dir=n;const i=e.split(/(?:\r\n?|\n)/);for(let t=0,e=i.length;t<e;++t){const n=i[t];r.append(document.createTextNode(n));t<e-1&&r.append(document.createElement("br"))}return r}_toggle(){this.pinned?this._hide(!0):this._show(!0)}_show(){arguments.length>0&&void 0!==arguments[0]&&arguments[0]&&(this.pinned=!0);if(this.hideElement.hidden){this.hideElement.hidden=!1;this.container.style.zIndex=parseInt(this.container.style.zIndex)+1e3}}_hide(){(!(arguments.length>0&&void 0!==arguments[0])||arguments[0])&&(this.pinned=!1);if(!this.hideElement.hidden&&!this.pinned){this.hideElement.hidden=!0;this.container.style.zIndex=parseInt(this.container.style.zIndex)-1e3}}}class FreeTextAnnotationElement extends AnnotationElement{constructor(t){var e,n,r;super(t,{isRenderable:!!(t.data.hasPopup||null!==(e=t.data.titleObj)&&void 0!==e&&e.str||null!==(n=t.data.contentsObj)&&void 0!==n&&n.str||null!==(r=t.data.richText)&&void 0!==r&&r.str),ignoreBorder:!0});this.textContent=t.data.textContent}render(){this.container.classList.add("freeTextAnnotation");if(this.textContent){const t=document.createElement("div");t.classList.add("annotationTextContent");t.setAttribute("role","comment");for(const e of this.textContent){const n=document.createElement("span");n.textContent=e;t.append(n)}this.container.append(t)}this.data.hasPopup||this._createPopup(null,this.data);return this.container}}class LineAnnotationElement extends AnnotationElement{constructor(t){var e,n,r;super(t,{isRenderable:!!(t.data.hasPopup||null!==(e=t.data.titleObj)&&void 0!==e&&e.str||null!==(n=t.data.contentsObj)&&void 0!==n&&n.str||null!==(r=t.data.richText)&&void 0!==r&&r.str),ignoreBorder:!0})}render(){this.container.classList.add("lineAnnotation");const t=this.data,{width:e,height:n}=getRectDims(t.rect),r=this.svgFactory.create(e,n,!0),i=this.svgFactory.createElement("svg:line");i.setAttribute("x1",t.rect[2]-t.lineCoordinates[0]);i.setAttribute("y1",t.rect[3]-t.lineCoordinates[1]);i.setAttribute("x2",t.rect[2]-t.lineCoordinates[2]);i.setAttribute("y2",t.rect[3]-t.lineCoordinates[3]);i.setAttribute("stroke-width",t.borderStyle.width||1);i.setAttribute("stroke","transparent");i.setAttribute("fill","transparent");r.append(i);this.container.append(r);this._createPopup(i,t);return this.container}}class SquareAnnotationElement extends AnnotationElement{constructor(t){var e,n,r;super(t,{isRenderable:!!(t.data.hasPopup||null!==(e=t.data.titleObj)&&void 0!==e&&e.str||null!==(n=t.data.contentsObj)&&void 0!==n&&n.str||null!==(r=t.data.richText)&&void 0!==r&&r.str),ignoreBorder:!0})}render(){this.container.classList.add("squareAnnotation");const t=this.data,{width:e,height:n}=getRectDims(t.rect),r=this.svgFactory.create(e,n,!0),i=t.borderStyle.width,s=this.svgFactory.createElement("svg:rect");s.setAttribute("x",i/2);s.setAttribute("y",i/2);s.setAttribute("width",e-i);s.setAttribute("height",n-i);s.setAttribute("stroke-width",i||1);s.setAttribute("stroke","transparent");s.setAttribute("fill","transparent");r.append(s);this.container.append(r);this._createPopup(s,t);return this.container}}class CircleAnnotationElement extends AnnotationElement{constructor(t){var e,n,r;super(t,{isRenderable:!!(t.data.hasPopup||null!==(e=t.data.titleObj)&&void 0!==e&&e.str||null!==(n=t.data.contentsObj)&&void 0!==n&&n.str||null!==(r=t.data.richText)&&void 0!==r&&r.str),ignoreBorder:!0})}render(){this.container.classList.add("circleAnnotation");const t=this.data,{width:e,height:n}=getRectDims(t.rect),r=this.svgFactory.create(e,n,!0),i=t.borderStyle.width,s=this.svgFactory.createElement("svg:ellipse");s.setAttribute("cx",e/2);s.setAttribute("cy",n/2);s.setAttribute("rx",e/2-i/2);s.setAttribute("ry",n/2-i/2);s.setAttribute("stroke-width",i||1);s.setAttribute("stroke","transparent");s.setAttribute("fill","transparent");r.append(s);this.container.append(r);this._createPopup(s,t);return this.container}}class PolylineAnnotationElement extends AnnotationElement{constructor(t){var e,n,r;super(t,{isRenderable:!!(t.data.hasPopup||null!==(e=t.data.titleObj)&&void 0!==e&&e.str||null!==(n=t.data.contentsObj)&&void 0!==n&&n.str||null!==(r=t.data.richText)&&void 0!==r&&r.str),ignoreBorder:!0});this.containerClassName="polylineAnnotation";this.svgElementName="svg:polyline"}render(){this.container.classList.add(this.containerClassName);const t=this.data,{width:e,height:n}=getRectDims(t.rect),r=this.svgFactory.create(e,n,!0);let i=[];for(const e of t.vertices){const n=e.x-t.rect[0],r=t.rect[3]-e.y;i.push(n+","+r)}i=i.join(" ");const s=this.svgFactory.createElement(this.svgElementName);s.setAttribute("points",i);s.setAttribute("stroke-width",t.borderStyle.width||1);s.setAttribute("stroke","transparent");s.setAttribute("fill","transparent");r.append(s);this.container.append(r);this._createPopup(s,t);return this.container}}class PolygonAnnotationElement extends PolylineAnnotationElement{constructor(t){super(t);this.containerClassName="polygonAnnotation";this.svgElementName="svg:polygon"}}class CaretAnnotationElement extends AnnotationElement{constructor(t){var e,n,r;super(t,{isRenderable:!!(t.data.hasPopup||null!==(e=t.data.titleObj)&&void 0!==e&&e.str||null!==(n=t.data.contentsObj)&&void 0!==n&&n.str||null!==(r=t.data.richText)&&void 0!==r&&r.str),ignoreBorder:!0})}render(){this.container.classList.add("caretAnnotation");this.data.hasPopup||this._createPopup(null,this.data);return this.container}}class InkAnnotationElement extends AnnotationElement{constructor(t){var e,n,r;super(t,{isRenderable:!!(t.data.hasPopup||null!==(e=t.data.titleObj)&&void 0!==e&&e.str||null!==(n=t.data.contentsObj)&&void 0!==n&&n.str||null!==(r=t.data.richText)&&void 0!==r&&r.str),ignoreBorder:!0});this.containerClassName="inkAnnotation";this.svgElementName="svg:polyline"}render(){this.container.classList.add(this.containerClassName);const t=this.data,{width:e,height:n}=getRectDims(t.rect),r=this.svgFactory.create(e,n,!0);for(const e of t.inkLists){let n=[];for(const r of e){const e=r.x-t.rect[0],i=t.rect[3]-r.y;n.push(`${e},${i}`)}n=n.join(" ");const i=this.svgFactory.createElement(this.svgElementName);i.setAttribute("points",n);i.setAttribute("stroke-width",t.borderStyle.width||1);i.setAttribute("stroke","transparent");i.setAttribute("fill","transparent");this._createPopup(i,t);r.append(i)}this.container.append(r);return this.container}}class HighlightAnnotationElement extends AnnotationElement{constructor(t){var e,n,r;super(t,{isRenderable:!!(t.data.hasPopup||null!==(e=t.data.titleObj)&&void 0!==e&&e.str||null!==(n=t.data.contentsObj)&&void 0!==n&&n.str||null!==(r=t.data.richText)&&void 0!==r&&r.str),ignoreBorder:!0,createQuadrilaterals:!0})}render(){this.data.hasPopup||this._createPopup(null,this.data);if(this.quadrilaterals)return this._renderQuadrilaterals("highlightAnnotation");this.container.classList.add("highlightAnnotation");return this.container}}class UnderlineAnnotationElement extends AnnotationElement{constructor(t){var e,n,r;super(t,{isRenderable:!!(t.data.hasPopup||null!==(e=t.data.titleObj)&&void 0!==e&&e.str||null!==(n=t.data.contentsObj)&&void 0!==n&&n.str||null!==(r=t.data.richText)&&void 0!==r&&r.str),ignoreBorder:!0,createQuadrilaterals:!0})}render(){this.data.hasPopup||this._createPopup(null,this.data);if(this.quadrilaterals)return this._renderQuadrilaterals("underlineAnnotation");this.container.classList.add("underlineAnnotation");return this.container}}class SquigglyAnnotationElement extends AnnotationElement{constructor(t){var e,n,r;super(t,{isRenderable:!!(t.data.hasPopup||null!==(e=t.data.titleObj)&&void 0!==e&&e.str||null!==(n=t.data.contentsObj)&&void 0!==n&&n.str||null!==(r=t.data.richText)&&void 0!==r&&r.str),ignoreBorder:!0,createQuadrilaterals:!0})}render(){this.data.hasPopup||this._createPopup(null,this.data);if(this.quadrilaterals)return this._renderQuadrilaterals("squigglyAnnotation");this.container.classList.add("squigglyAnnotation");return this.container}}class StrikeOutAnnotationElement extends AnnotationElement{constructor(t){var e,n,r;super(t,{isRenderable:!!(t.data.hasPopup||null!==(e=t.data.titleObj)&&void 0!==e&&e.str||null!==(n=t.data.contentsObj)&&void 0!==n&&n.str||null!==(r=t.data.richText)&&void 0!==r&&r.str),ignoreBorder:!0,createQuadrilaterals:!0})}render(){this.data.hasPopup||this._createPopup(null,this.data);if(this.quadrilaterals)return this._renderQuadrilaterals("strikeoutAnnotation");this.container.classList.add("strikeoutAnnotation");return this.container}}class StampAnnotationElement extends AnnotationElement{constructor(t){var e,n,r;super(t,{isRenderable:!!(t.data.hasPopup||null!==(e=t.data.titleObj)&&void 0!==e&&e.str||null!==(n=t.data.contentsObj)&&void 0!==n&&n.str||null!==(r=t.data.richText)&&void 0!==r&&r.str),ignoreBorder:!0})}render(){this.container.classList.add("stampAnnotation");this.data.hasPopup||this._createPopup(null,this.data);return this.container}}class FileAttachmentAnnotationElement extends AnnotationElement{constructor(t){var e;super(t,{isRenderable:!0});const{filename:n,content:r}=this.data.file;this.filename=(0,i.getFilenameFromUrl)(n,!0);this.content=r;null===(e=this.linkService.eventBus)||void 0===e||e.dispatch("fileattachmentannotation",{source:this,filename:n,content:r})}render(){var t,e;this.container.classList.add("fileAttachmentAnnotation");let n;if(this.data.hasAppearance)n=document.createElement("div");else{n=document.createElement("img");n.src=`${this.imageResourcesPath}annotation-${/paperclip/i.test(this.data.name)?"paperclip":"pushpin"}.svg`}n.classList.add("popupTriggerArea");n.addEventListener("dblclick",this._download.bind(this));!this.data.hasPopup&&(null!==(t=this.data.titleObj)&&void 0!==t&&t.str||null!==(e=this.data.contentsObj)&&void 0!==e&&e.str||this.data.richText)&&this._createPopup(n,this.data);this.container.append(n);return this.container}_download(){var t;null===(t=this.downloadManager)||void 0===t||t.openOrDownloadData(this.container,this.content,this.filename)}}class AnnotationLayer{static#Je(t,e,n,r){const s=t.firstChild||t;s.id=`${i.AnnotationPrefix}${e}`;n.append(t);null==r||r.moveElementInDOM(n,t,s,!1)}static render(t){const{annotations:e,div:n,viewport:a,accessibilityManager:o}=t;(0,i.setLayerDimensions)(n,a);const l={data:null,layer:n,page:t.page,viewport:a,linkService:t.linkService,downloadManager:t.downloadManager,imageResourcesPath:t.imageResourcesPath||"",renderForms:!1!==t.renderForms,svgFactory:new i.DOMSVGFactory,annotationStorage:t.annotationStorage||new s.AnnotationStorage,enableScripting:!0===t.enableScripting,hasJSActions:t.hasJSActions,fieldObjects:t.fieldObjects};let c=0;for(const t of e){if(t.noHTML)continue;if(t.annotationType!==r.AnnotationType.POPUP){const{width:e,height:n}=getRectDims(t.rect);if(e<=0||n<=0)continue}l.data=t;const e=AnnotationElementFactory.create(l);if(!e.isRenderable)continue;const i=e.render();t.hidden&&(i.style.visibility="hidden");if(Array.isArray(i))for(const e of i){e.style.zIndex=c++;AnnotationLayer.#Je(e,t.id,n,o)}else{i.style.zIndex=c++;e instanceof PopupAnnotationElement?n.prepend(i):AnnotationLayer.#Je(i,t.id,n,o)}}this.#Qe(n,t.annotationCanvasMap)}static update(t){const{annotationCanvasMap:e,div:n,viewport:r}=t;(0,i.setLayerDimensions)(n,{rotation:r.rotation});this.#Qe(n,e);n.hidden=!1}static#Qe(t,e){if(e){for(const[n,r]of e){const e=t.querySelector(`[data-annotation-id="${n}"]`);if(!e)continue;const{firstChild:i}=e;i?"CANVAS"===i.nodeName?i.replaceWith(r):i.before(r):e.append(r)}e.clear()}}}e.AnnotationLayer=AnnotationLayer},(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.ColorConverters=void 0;function makeColorComp(t){return Math.floor(255*Math.max(0,Math.min(1,t))).toString(16).padStart(2,"0")}e.ColorConverters=class ColorConverters{static CMYK_G(t){let[e,n,r,i]=t;return["G",1-Math.min(1,.3*e+.59*r+.11*n+i)]}static G_CMYK(t){let[e]=t;return["CMYK",0,0,0,1-e]}static G_RGB(t){let[e]=t;return["RGB",e,e,e]}static G_HTML(t){let[e]=t;const n=makeColorComp(e);return`#${n}${n}${n}`}static RGB_G(t){let[e,n,r]=t;return["G",.3*e+.59*n+.11*r]}static RGB_HTML(t){let[e,n,r]=t;return`#${makeColorComp(e)}${makeColorComp(n)}${makeColorComp(r)}`}static T_HTML(){return"#00000000"}static CMYK_RGB(t){let[e,n,r,i]=t;return["RGB",1-Math.min(1,e+i),1-Math.min(1,r+i),1-Math.min(1,n+i)]}static CMYK_HTML(t){const e=this.CMYK_RGB(t).slice(1);return this.RGB_HTML(e)}static RGB_CMYK(t){let[e,n,r]=t;const i=1-e,s=1-n,a=1-r;return["CMYK",i,s,a,Math.min(i,s,a)]}}},(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.XfaLayer=void 0;var r=n(154);e.XfaLayer=class XfaLayer{static setupStorage(t,e,n,r,i){const s=r.getValue(e,{value:null});switch(n.name){case"textarea":null!==s.value&&(t.textContent=s.value);if("print"===i)break;t.addEventListener("input",(t=>{r.setValue(e,{value:t.target.value})}));break;case"input":if("radio"===n.attributes.type||"checkbox"===n.attributes.type){s.value===n.attributes.xfaOn?t.setAttribute("checked",!0):s.value===n.attributes.xfaOff&&t.removeAttribute("checked");if("print"===i)break;t.addEventListener("change",(t=>{r.setValue(e,{value:t.target.checked?t.target.getAttribute("xfaOn"):t.target.getAttribute("xfaOff")})}))}else{null!==s.value&&t.setAttribute("value",s.value);if("print"===i)break;t.addEventListener("input",(t=>{r.setValue(e,{value:t.target.value})}))}break;case"select":if(null!==s.value)for(const t of n.children)t.attributes.value===s.value&&(t.attributes.selected=!0);t.addEventListener("input",(t=>{const n=t.target.options,i=-1===n.selectedIndex?"":n[n.selectedIndex].value;r.setValue(e,{value:i})}))}}static setAttributes(t){let{html:e,element:n,storage:r=null,intent:i,linkService:s}=t;const{attributes:a}=n,o=e instanceof HTMLAnchorElement;"radio"===a.type&&(a.name=`${a.name}-${i}`);for(const[t,n]of Object.entries(a))if(null!=n)switch(t){case"class":n.length&&e.setAttribute(t,n.join(" "));break;case"dataId":break;case"id":e.setAttribute("data-element-id",n);break;case"style":Object.assign(e.style,n);break;case"textContent":e.textContent=n;break;default:(!o||"href"!==t&&"newWindow"!==t)&&e.setAttribute(t,n)}o&&s.addLinkAttributes(e,a.href,a.newWindow);r&&a.dataId&&this.setupStorage(e,a.dataId,n,r)}static render(t){const e=t.annotationStorage,n=t.linkService,i=t.xfaHtml,s=t.intent||"display",a=document.createElement(i.name);i.attributes&&this.setAttributes({html:a,element:i,intent:s,linkService:n});const o=[[i,-1,a]],l=t.div;l.append(a);if(t.viewport){const e=`matrix(${t.viewport.transform.join(",")})`;l.style.transform=e}"richText"!==s&&l.setAttribute("class","xfaLayer xfaFont");const c=[];for(;o.length>0;){var d;const[t,i,a]=o.at(-1);if(i+1===t.children.length){o.pop();continue}const l=t.children[++o.at(-1)[1]];if(null===l)continue;const{name:h}=l;if("#text"===h){const t=document.createTextNode(l.value);c.push(t);a.append(t);continue}let u;u=null!=l&&null!==(d=l.attributes)&&void 0!==d&&d.xmlns?document.createElementNS(l.attributes.xmlns,h):document.createElement(h);a.append(u);l.attributes&&this.setAttributes({html:u,element:l,storage:e,intent:s,linkService:n});if(l.children&&l.children.length>0)o.push([l,-1,u]);else if(l.value){const t=document.createTextNode(l.value);r.XfaText.shouldBuildText(h)&&c.push(t);u.append(t)}}for(const t of l.querySelectorAll(".xfaNonInteractive input, .xfaNonInteractive textarea"))t.setAttribute("readOnly",!0);return{textDivs:c}}static update(t){const e=`matrix(${t.viewport.transform.join(",")})`;t.div.style.transform=e;t.div.hidden=!1}}},(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.SVGGraphics=void 0;var r=n(142),i=n(1),s=n(3);let a=class{constructor(){(0,i.unreachable)("Not implemented: SVGGraphics")}};e.SVGGraphics=a;{const o={fontStyle:"normal",fontWeight:"normal",fillColor:"#000000"},l="http://www.w3.org/XML/1998/namespace",c="http://www.w3.org/1999/xlink",d=["butt","round","square"],h=["miter","round","bevel"],createObjectURL=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(URL.createObjectURL&&"undefined"!=typeof Blob&&!n)return URL.createObjectURL(new Blob([t],{type:e}));const r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";let i=`data:${e};base64,`;for(let e=0,n=t.length;e<n;e+=3){const s=255&t[e],a=255&t[e+1],o=255&t[e+2];i+=r[s>>2]+r[(3&s)<<4|a>>4]+r[e+1<n?(15&a)<<2|o>>6:64]+r[e+2<n?63&o:64]}return i},u=function(){const t=new Uint8Array([137,80,78,71,13,10,26,10]),e=new Int32Array(256);for(let t=0;t<256;t++){let n=t;for(let t=0;t<8;t++)n=1&n?3988292384^n>>1&2147483647:n>>1&2147483647;e[t]=n}function writePngChunk(t,n,r,i){let s=i;const a=n.length;r[s]=a>>24&255;r[s+1]=a>>16&255;r[s+2]=a>>8&255;r[s+3]=255&a;s+=4;r[s]=255&t.charCodeAt(0);r[s+1]=255&t.charCodeAt(1);r[s+2]=255&t.charCodeAt(2);r[s+3]=255&t.charCodeAt(3);s+=4;r.set(n,s);s+=n.length;const o=function crc32(t,n,r){let i=-1;for(let s=n;s<r;s++){const n=255&(i^t[s]);i=i>>>8^e[n]}return-1^i}(r,i+4,s);r[s]=o>>24&255;r[s+1]=o>>16&255;r[s+2]=o>>8&255;r[s+3]=255&o}function deflateSyncUncompressed(t){let e=t.length;const n=65535,r=Math.ceil(e/n),i=new Uint8Array(2+e+5*r+4);let s=0;i[s++]=120;i[s++]=156;let a=0;for(;e>n;){i[s++]=0;i[s++]=255;i[s++]=255;i[s++]=0;i[s++]=0;i.set(t.subarray(a,a+n),s);s+=n;a+=n;e-=n}i[s++]=1;i[s++]=255&e;i[s++]=e>>8&255;i[s++]=255&~e;i[s++]=(65535&~e)>>8&255;i.set(t.subarray(a),s);s+=t.length-a;const o=function adler32(t,e,n){let r=1,i=0;for(let s=e;s<n;++s){r=(r+(255&t[s]))%65521;i=(i+r)%65521}return i<<16|r}(t,0,t.length);i[s++]=o>>24&255;i[s++]=o>>16&255;i[s++]=o>>8&255;i[s++]=255&o;return i}function encode(e,n,r,a){const o=e.width,l=e.height;let c,d,h;const u=e.data;switch(n){case i.ImageKind.GRAYSCALE_1BPP:d=0;c=1;h=o+7>>3;break;case i.ImageKind.RGB_24BPP:d=2;c=8;h=3*o;break;case i.ImageKind.RGBA_32BPP:d=6;c=8;h=4*o;break;default:throw new Error("invalid format")}const p=new Uint8Array((1+h)*l);let f=0,g=0;for(let t=0;t<l;++t){p[f++]=0;p.set(u.subarray(g,g+h),f);g+=h;f+=h}if(n===i.ImageKind.GRAYSCALE_1BPP&&a){f=0;for(let t=0;t<l;t++){f++;for(let t=0;t<h;t++)p[f++]^=255}}const m=new Uint8Array([o>>24&255,o>>16&255,o>>8&255,255&o,l>>24&255,l>>16&255,l>>8&255,255&l,c,d,0,0,0]),v=function deflateSync(t){if(!s.isNodeJS)return deflateSyncUncompressed(t);try{let e;e=parseInt(process.versions.node)>=8?t:Buffer.from(t);const n=require("zlib").deflateSync(e,{level:9});return n instanceof Uint8Array?n:new Uint8Array(n)}catch(t){(0,i.warn)("Not compressing PNG because zlib.deflateSync is unavailable: "+t)}return deflateSyncUncompressed(t)}(p),b=t.length+36+m.length+v.length,y=new Uint8Array(b);let A=0;y.set(t,A);A+=t.length;writePngChunk("IHDR",m,y,A);A+=12+m.length;writePngChunk("IDATA",v,y,A);A+=12+v.length;writePngChunk("IEND",new Uint8Array(0),y,A);return createObjectURL(y,"image/png",r)}return function convertImgDataToPng(t,e,n){return encode(t,void 0===t.kind?i.ImageKind.GRAYSCALE_1BPP:t.kind,e,n)}}();class SVGExtraState{constructor(){this.fontSizeScale=1;this.fontWeight=o.fontWeight;this.fontSize=0;this.textMatrix=i.IDENTITY_MATRIX;this.fontMatrix=i.FONT_IDENTITY_MATRIX;this.leading=0;this.textRenderingMode=i.TextRenderingMode.FILL;this.textMatrixScale=1;this.x=0;this.y=0;this.lineX=0;this.lineY=0;this.charSpacing=0;this.wordSpacing=0;this.textHScale=1;this.textRise=0;this.fillColor=o.fillColor;this.strokeColor="#000000";this.fillAlpha=1;this.strokeAlpha=1;this.lineWidth=1;this.lineJoin="";this.lineCap="";this.miterLimit=0;this.dashArray=[];this.dashPhase=0;this.dependencies=[];this.activeClipUrl=null;this.clipGroup=null;this.maskId=""}clone(){return Object.create(this)}setCurrentPoint(t,e){this.x=t;this.y=e}}function opListToTree(t){let e=[];const n=[];for(const r of t)if("save"!==r.fn)"restore"===r.fn?e=n.pop():e.push(r);else{e.push({fnId:92,fn:"group",items:[]});n.push(e);e=e.at(-1).items}return e}function pf(t){if(Number.isInteger(t))return t.toString();const e=t.toFixed(10);let n=e.length-1;if("0"!==e[n])return e;do{n--}while("0"===e[n]);return e.substring(0,"."===e[n]?n:n+1)}function pm(t){if(0===t[4]&&0===t[5]){if(0===t[1]&&0===t[2])return 1===t[0]&&1===t[3]?"":`scale(${pf(t[0])} ${pf(t[3])})`;if(t[0]===t[3]&&t[1]===-t[2]){return`rotate(${pf(180*Math.acos(t[0])/Math.PI)})`}}else if(1===t[0]&&0===t[1]&&0===t[2]&&1===t[3])return`translate(${pf(t[4])} ${pf(t[5])})`;return`matrix(${pf(t[0])} ${pf(t[1])} ${pf(t[2])} ${pf(t[3])} ${pf(t[4])} ${pf(t[5])})`}let p=0,f=0,g=0;e.SVGGraphics=a=class{constructor(t,e){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];(0,r.deprecated)("The SVG back-end is no longer maintained and *may* be removed in the future.");this.svgFactory=new r.DOMSVGFactory;this.current=new SVGExtraState;this.transformMatrix=i.IDENTITY_MATRIX;this.transformStack=[];this.extraStack=[];this.commonObjs=t;this.objs=e;this.pendingClip=null;this.pendingEOFill=!1;this.embedFonts=!1;this.embeddedFonts=Object.create(null);this.cssStyle=null;this.forceDataSchema=!!n;this._operatorIdMapping=[];for(const t in i.OPS)this._operatorIdMapping[i.OPS[t]]=t}getObject(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return"string"==typeof t?t.startsWith("g_")?this.commonObjs.get(t):this.objs.get(t):e}save(){this.transformStack.push(this.transformMatrix);const t=this.current;this.extraStack.push(t);this.current=t.clone()}restore(){this.transformMatrix=this.transformStack.pop();this.current=this.extraStack.pop();this.pendingClip=null;this.tgrp=null}group(t){this.save();this.executeOpTree(t);this.restore()}loadDependencies(t){const e=t.fnArray,n=t.argsArray;for(let t=0,r=e.length;t<r;t++)if(e[t]===i.OPS.dependency)for(const e of n[t]){const t=e.startsWith("g_")?this.commonObjs:this.objs,n=new Promise((n=>{t.get(e,n)}));this.current.dependencies.push(n)}return Promise.all(this.current.dependencies)}transform(t,e,n,r,s,a){const o=[t,e,n,r,s,a];this.transformMatrix=i.Util.transform(this.transformMatrix,o);this.tgrp=null}getSVG(t,e){this.viewport=e;const n=this._initialize(e);return this.loadDependencies(t).then((()=>{this.transformMatrix=i.IDENTITY_MATRIX;this.executeOpTree(this.convertOpList(t));return n}))}convertOpList(t){const e=this._operatorIdMapping,n=t.argsArray,r=t.fnArray,i=[];for(let t=0,s=r.length;t<s;t++){const s=r[t];i.push({fnId:s,fn:e[s],args:n[t]})}return opListToTree(i)}executeOpTree(t){for(const e of t){const t=e.fn,n=e.fnId,r=e.args;switch(0|n){case i.OPS.beginText:this.beginText();break;case i.OPS.dependency:break;case i.OPS.setLeading:this.setLeading(r);break;case i.OPS.setLeadingMoveText:this.setLeadingMoveText(r[0],r[1]);break;case i.OPS.setFont:this.setFont(r);break;case i.OPS.showText:case i.OPS.showSpacedText:this.showText(r[0]);break;case i.OPS.endText:this.endText();break;case i.OPS.moveText:this.moveText(r[0],r[1]);break;case i.OPS.setCharSpacing:this.setCharSpacing(r[0]);break;case i.OPS.setWordSpacing:this.setWordSpacing(r[0]);break;case i.OPS.setHScale:this.setHScale(r[0]);break;case i.OPS.setTextMatrix:this.setTextMatrix(r[0],r[1],r[2],r[3],r[4],r[5]);break;case i.OPS.setTextRise:this.setTextRise(r[0]);break;case i.OPS.setTextRenderingMode:this.setTextRenderingMode(r[0]);break;case i.OPS.setLineWidth:this.setLineWidth(r[0]);break;case i.OPS.setLineJoin:this.setLineJoin(r[0]);break;case i.OPS.setLineCap:this.setLineCap(r[0]);break;case i.OPS.setMiterLimit:this.setMiterLimit(r[0]);break;case i.OPS.setFillRGBColor:this.setFillRGBColor(r[0],r[1],r[2]);break;case i.OPS.setStrokeRGBColor:this.setStrokeRGBColor(r[0],r[1],r[2]);break;case i.OPS.setStrokeColorN:this.setStrokeColorN(r);break;case i.OPS.setFillColorN:this.setFillColorN(r);break;case i.OPS.shadingFill:this.shadingFill(r[0]);break;case i.OPS.setDash:this.setDash(r[0],r[1]);break;case i.OPS.setRenderingIntent:this.setRenderingIntent(r[0]);break;case i.OPS.setFlatness:this.setFlatness(r[0]);break;case i.OPS.setGState:this.setGState(r[0]);break;case i.OPS.fill:this.fill();break;case i.OPS.eoFill:this.eoFill();break;case i.OPS.stroke:this.stroke();break;case i.OPS.fillStroke:this.fillStroke();break;case i.OPS.eoFillStroke:this.eoFillStroke();break;case i.OPS.clip:this.clip("nonzero");break;case i.OPS.eoClip:this.clip("evenodd");break;case i.OPS.paintSolidColorImageMask:this.paintSolidColorImageMask();break;case i.OPS.paintImageXObject:this.paintImageXObject(r[0]);break;case i.OPS.paintInlineImageXObject:this.paintInlineImageXObject(r[0]);break;case i.OPS.paintImageMaskXObject:this.paintImageMaskXObject(r[0]);break;case i.OPS.paintFormXObjectBegin:this.paintFormXObjectBegin(r[0],r[1]);break;case i.OPS.paintFormXObjectEnd:this.paintFormXObjectEnd();break;case i.OPS.closePath:this.closePath();break;case i.OPS.closeStroke:this.closeStroke();break;case i.OPS.closeFillStroke:this.closeFillStroke();break;case i.OPS.closeEOFillStroke:this.closeEOFillStroke();break;case i.OPS.nextLine:this.nextLine();break;case i.OPS.transform:this.transform(r[0],r[1],r[2],r[3],r[4],r[5]);break;case i.OPS.constructPath:this.constructPath(r[0],r[1]);break;case i.OPS.endPath:this.endPath();break;case 92:this.group(e.items);break;default:(0,i.warn)(`Unimplemented operator ${t}`)}}}setWordSpacing(t){this.current.wordSpacing=t}setCharSpacing(t){this.current.charSpacing=t}nextLine(){this.moveText(0,this.current.leading)}setTextMatrix(t,e,n,r,i,s){const a=this.current;a.textMatrix=a.lineMatrix=[t,e,n,r,i,s];a.textMatrixScale=Math.hypot(t,e);a.x=a.lineX=0;a.y=a.lineY=0;a.xcoords=[];a.ycoords=[];a.tspan=this.svgFactory.createElement("svg:tspan");a.tspan.setAttributeNS(null,"font-family",a.fontFamily);a.tspan.setAttributeNS(null,"font-size",`${pf(a.fontSize)}px`);a.tspan.setAttributeNS(null,"y",pf(-a.y));a.txtElement=this.svgFactory.createElement("svg:text");a.txtElement.append(a.tspan)}beginText(){const t=this.current;t.x=t.lineX=0;t.y=t.lineY=0;t.textMatrix=i.IDENTITY_MATRIX;t.lineMatrix=i.IDENTITY_MATRIX;t.textMatrixScale=1;t.tspan=this.svgFactory.createElement("svg:tspan");t.txtElement=this.svgFactory.createElement("svg:text");t.txtgrp=this.svgFactory.createElement("svg:g");t.xcoords=[];t.ycoords=[]}moveText(t,e){const n=this.current;n.x=n.lineX+=t;n.y=n.lineY+=e;n.xcoords=[];n.ycoords=[];n.tspan=this.svgFactory.createElement("svg:tspan");n.tspan.setAttributeNS(null,"font-family",n.fontFamily);n.tspan.setAttributeNS(null,"font-size",`${pf(n.fontSize)}px`);n.tspan.setAttributeNS(null,"y",pf(-n.y))}showText(t){const e=this.current,n=e.font,r=e.fontSize;if(0===r)return;const s=e.fontSizeScale,a=e.charSpacing,c=e.wordSpacing,d=e.fontDirection,h=e.textHScale*d,u=n.vertical,p=u?1:-1,f=n.defaultVMetrics,g=r*e.fontMatrix[0];let m=0;for(const i of t){if(null===i){m+=d*c;continue}if("number"==typeof i){m+=p*i*r/1e3;continue}const t=(i.isSpace?c:0)+a,o=i.fontChar;let l,h,v,b=i.width;if(u){let t;const e=i.vmetric||f;t=i.vmetric?e[1]:.5*b;t=-t*g;const n=e[2]*g;b=e?-e[0]:b;l=t/s;h=(m+n)/s}else{l=m/s;h=0}if(i.isInFont||n.missingFile){e.xcoords.push(e.x+l);u&&e.ycoords.push(-e.y+h);e.tspan.textContent+=o}v=u?b*g-t*d:b*g+t*d;m+=v}e.tspan.setAttributeNS(null,"x",e.xcoords.map(pf).join(" "));u?e.tspan.setAttributeNS(null,"y",e.ycoords.map(pf).join(" ")):e.tspan.setAttributeNS(null,"y",pf(-e.y));u?e.y-=m:e.x+=m*h;e.tspan.setAttributeNS(null,"font-family",e.fontFamily);e.tspan.setAttributeNS(null,"font-size",`${pf(e.fontSize)}px`);e.fontStyle!==o.fontStyle&&e.tspan.setAttributeNS(null,"font-style",e.fontStyle);e.fontWeight!==o.fontWeight&&e.tspan.setAttributeNS(null,"font-weight",e.fontWeight);const v=e.textRenderingMode&i.TextRenderingMode.FILL_STROKE_MASK;if(v===i.TextRenderingMode.FILL||v===i.TextRenderingMode.FILL_STROKE){e.fillColor!==o.fillColor&&e.tspan.setAttributeNS(null,"fill",e.fillColor);e.fillAlpha<1&&e.tspan.setAttributeNS(null,"fill-opacity",e.fillAlpha)}else e.textRenderingMode===i.TextRenderingMode.ADD_TO_PATH?e.tspan.setAttributeNS(null,"fill","transparent"):e.tspan.setAttributeNS(null,"fill","none");if(v===i.TextRenderingMode.STROKE||v===i.TextRenderingMode.FILL_STROKE){const t=1/(e.textMatrixScale||1);this._setStrokeAttributes(e.tspan,t)}let b=e.textMatrix;if(0!==e.textRise){b=b.slice();b[5]+=e.textRise}e.txtElement.setAttributeNS(null,"transform",`${pm(b)} scale(${pf(h)}, -1)`);e.txtElement.setAttributeNS(l,"xml:space","preserve");e.txtElement.append(e.tspan);e.txtgrp.append(e.txtElement);this._ensureTransformGroup().append(e.txtElement)}setLeadingMoveText(t,e){this.setLeading(-e);this.moveText(t,e)}addFontStyle(t){if(!t.data)throw new Error('addFontStyle: No font data available, ensure that the "fontExtraProperties" API parameter is set.');if(!this.cssStyle){this.cssStyle=this.svgFactory.createElement("svg:style");this.cssStyle.setAttributeNS(null,"type","text/css");this.defs.append(this.cssStyle)}const e=createObjectURL(t.data,t.mimetype,this.forceDataSchema);this.cssStyle.textContent+=`@font-face { font-family: "${t.loadedName}"; src: url(${e}); }\n`}setFont(t){const e=this.current,n=this.commonObjs.get(t[0]);let r=t[1];e.font=n;if(this.embedFonts&&!n.missingFile&&!this.embeddedFonts[n.loadedName]){this.addFontStyle(n);this.embeddedFonts[n.loadedName]=n}e.fontMatrix=n.fontMatrix||i.FONT_IDENTITY_MATRIX;let s="normal";n.black?s="900":n.bold&&(s="bold");const a=n.italic?"italic":"normal";if(r<0){r=-r;e.fontDirection=-1}else e.fontDirection=1;e.fontSize=r;e.fontFamily=n.loadedName;e.fontWeight=s;e.fontStyle=a;e.tspan=this.svgFactory.createElement("svg:tspan");e.tspan.setAttributeNS(null,"y",pf(-e.y));e.xcoords=[];e.ycoords=[]}endText(){var t;const e=this.current;if(e.textRenderingMode&i.TextRenderingMode.ADD_TO_PATH_FLAG&&null!==(t=e.txtElement)&&void 0!==t&&t.hasChildNodes()){e.element=e.txtElement;this.clip("nonzero");this.endPath()}}setLineWidth(t){t>0&&(this.current.lineWidth=t)}setLineCap(t){this.current.lineCap=d[t]}setLineJoin(t){this.current.lineJoin=h[t]}setMiterLimit(t){this.current.miterLimit=t}setStrokeAlpha(t){this.current.strokeAlpha=t}setStrokeRGBColor(t,e,n){this.current.strokeColor=i.Util.makeHexColor(t,e,n)}setFillAlpha(t){this.current.fillAlpha=t}setFillRGBColor(t,e,n){this.current.fillColor=i.Util.makeHexColor(t,e,n);this.current.tspan=this.svgFactory.createElement("svg:tspan");this.current.xcoords=[];this.current.ycoords=[]}setStrokeColorN(t){this.current.strokeColor=this._makeColorN_Pattern(t)}setFillColorN(t){this.current.fillColor=this._makeColorN_Pattern(t)}shadingFill(t){const e=this.viewport.width,n=this.viewport.height,r=i.Util.inverseTransform(this.transformMatrix),s=i.Util.applyTransform([0,0],r),a=i.Util.applyTransform([0,n],r),o=i.Util.applyTransform([e,0],r),l=i.Util.applyTransform([e,n],r),c=Math.min(s[0],a[0],o[0],l[0]),d=Math.min(s[1],a[1],o[1],l[1]),h=Math.max(s[0],a[0],o[0],l[0]),u=Math.max(s[1],a[1],o[1],l[1]),p=this.svgFactory.createElement("svg:rect");p.setAttributeNS(null,"x",c);p.setAttributeNS(null,"y",d);p.setAttributeNS(null,"width",h-c);p.setAttributeNS(null,"height",u-d);p.setAttributeNS(null,"fill",this._makeShadingPattern(t));this.current.fillAlpha<1&&p.setAttributeNS(null,"fill-opacity",this.current.fillAlpha);this._ensureTransformGroup().append(p)}_makeColorN_Pattern(t){return"TilingPattern"===t[0]?this._makeTilingPattern(t):this._makeShadingPattern(t)}_makeTilingPattern(t){const e=t[1],n=t[2],r=t[3]||i.IDENTITY_MATRIX,[s,a,o,l]=t[4],c=t[5],d=t[6],h=t[7],u="shading"+g++,[p,f,m,v]=i.Util.normalizeRect([...i.Util.applyTransform([s,a],r),...i.Util.applyTransform([o,l],r)]),[b,y]=i.Util.singularValueDecompose2dScale(r),A=c*b,_=d*y,S=this.svgFactory.createElement("svg:pattern");S.setAttributeNS(null,"id",u);S.setAttributeNS(null,"patternUnits","userSpaceOnUse");S.setAttributeNS(null,"width",A);S.setAttributeNS(null,"height",_);S.setAttributeNS(null,"x",`${p}`);S.setAttributeNS(null,"y",`${f}`);const x=this.svg,E=this.transformMatrix,C=this.current.fillColor,w=this.current.strokeColor,P=this.svgFactory.create(m-p,v-f);this.svg=P;this.transformMatrix=r;if(2===h){const t=i.Util.makeHexColor(...e);this.current.fillColor=t;this.current.strokeColor=t}this.executeOpTree(this.convertOpList(n));this.svg=x;this.transformMatrix=E;this.current.fillColor=C;this.current.strokeColor=w;S.append(P.childNodes[0]);this.defs.append(S);return`url(#${u})`}_makeShadingPattern(t){"string"==typeof t&&(t=this.objs.get(t));switch(t[0]){case"RadialAxial":const e="shading"+g++,n=t[3];let r;switch(t[1]){case"axial":const n=t[4],i=t[5];r=this.svgFactory.createElement("svg:linearGradient");r.setAttributeNS(null,"id",e);r.setAttributeNS(null,"gradientUnits","userSpaceOnUse");r.setAttributeNS(null,"x1",n[0]);r.setAttributeNS(null,"y1",n[1]);r.setAttributeNS(null,"x2",i[0]);r.setAttributeNS(null,"y2",i[1]);break;case"radial":const s=t[4],a=t[5],o=t[6],l=t[7];r=this.svgFactory.createElement("svg:radialGradient");r.setAttributeNS(null,"id",e);r.setAttributeNS(null,"gradientUnits","userSpaceOnUse");r.setAttributeNS(null,"cx",a[0]);r.setAttributeNS(null,"cy",a[1]);r.setAttributeNS(null,"r",l);r.setAttributeNS(null,"fx",s[0]);r.setAttributeNS(null,"fy",s[1]);r.setAttributeNS(null,"fr",o);break;default:throw new Error(`Unknown RadialAxial type: ${t[1]}`)}for(const t of n){const e=this.svgFactory.createElement("svg:stop");e.setAttributeNS(null,"offset",t[0]);e.setAttributeNS(null,"stop-color",t[1]);r.append(e)}this.defs.append(r);return`url(#${e})`;case"Mesh":(0,i.warn)("Unimplemented pattern Mesh");return null;case"Dummy":return"hotpink";default:throw new Error(`Unknown IR type: ${t[0]}`)}}setDash(t,e){this.current.dashArray=t;this.current.dashPhase=e}constructPath(t,e){const n=this.current;let r=n.x,s=n.y,a=[],o=0;for(const n of t)switch(0|n){case i.OPS.rectangle:r=e[o++];s=e[o++];const t=r+e[o++],n=s+e[o++];a.push("M",pf(r),pf(s),"L",pf(t),pf(s),"L",pf(t),pf(n),"L",pf(r),pf(n),"Z");break;case i.OPS.moveTo:r=e[o++];s=e[o++];a.push("M",pf(r),pf(s));break;case i.OPS.lineTo:r=e[o++];s=e[o++];a.push("L",pf(r),pf(s));break;case i.OPS.curveTo:r=e[o+4];s=e[o+5];a.push("C",pf(e[o]),pf(e[o+1]),pf(e[o+2]),pf(e[o+3]),pf(r),pf(s));o+=6;break;case i.OPS.curveTo2:a.push("C",pf(r),pf(s),pf(e[o]),pf(e[o+1]),pf(e[o+2]),pf(e[o+3]));r=e[o+2];s=e[o+3];o+=4;break;case i.OPS.curveTo3:r=e[o+2];s=e[o+3];a.push("C",pf(e[o]),pf(e[o+1]),pf(r),pf(s),pf(r),pf(s));o+=4;break;case i.OPS.closePath:a.push("Z")}a=a.join(" ");if(n.path&&t.length>0&&t[0]!==i.OPS.rectangle&&t[0]!==i.OPS.moveTo)a=n.path.getAttributeNS(null,"d")+a;else{n.path=this.svgFactory.createElement("svg:path");this._ensureTransformGroup().append(n.path)}n.path.setAttributeNS(null,"d",a);n.path.setAttributeNS(null,"fill","none");n.element=n.path;n.setCurrentPoint(r,s)}endPath(){const t=this.current;t.path=null;if(!this.pendingClip)return;if(!t.element){this.pendingClip=null;return}const e="clippath"+p++,n=this.svgFactory.createElement("svg:clipPath");n.setAttributeNS(null,"id",e);n.setAttributeNS(null,"transform",pm(this.transformMatrix));const r=t.element.cloneNode(!0);"evenodd"===this.pendingClip?r.setAttributeNS(null,"clip-rule","evenodd"):r.setAttributeNS(null,"clip-rule","nonzero");this.pendingClip=null;n.append(r);this.defs.append(n);if(t.activeClipUrl){t.clipGroup=null;for(const t of this.extraStack)t.clipGroup=null;n.setAttributeNS(null,"clip-path",t.activeClipUrl)}t.activeClipUrl=`url(#${e})`;this.tgrp=null}clip(t){this.pendingClip=t}closePath(){const t=this.current;if(t.path){const e=`${t.path.getAttributeNS(null,"d")}Z`;t.path.setAttributeNS(null,"d",e)}}setLeading(t){this.current.leading=-t}setTextRise(t){this.current.textRise=t}setTextRenderingMode(t){this.current.textRenderingMode=t}setHScale(t){this.current.textHScale=t/100}setRenderingIntent(t){}setFlatness(t){}setGState(t){for(const[e,n]of t)switch(e){case"LW":this.setLineWidth(n);break;case"LC":this.setLineCap(n);break;case"LJ":this.setLineJoin(n);break;case"ML":this.setMiterLimit(n);break;case"D":this.setDash(n[0],n[1]);break;case"RI":this.setRenderingIntent(n);break;case"FL":this.setFlatness(n);break;case"Font":this.setFont(n);break;case"CA":this.setStrokeAlpha(n);break;case"ca":this.setFillAlpha(n);break;default:(0,i.warn)(`Unimplemented graphic state operator ${e}`)}}fill(){const t=this.current;if(t.element){t.element.setAttributeNS(null,"fill",t.fillColor);t.element.setAttributeNS(null,"fill-opacity",t.fillAlpha);this.endPath()}}stroke(){const t=this.current;if(t.element){this._setStrokeAttributes(t.element);t.element.setAttributeNS(null,"fill","none");this.endPath()}}_setStrokeAttributes(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;const n=this.current;let r=n.dashArray;1!==e&&r.length>0&&(r=r.map((function(t){return e*t})));t.setAttributeNS(null,"stroke",n.strokeColor);t.setAttributeNS(null,"stroke-opacity",n.strokeAlpha);t.setAttributeNS(null,"stroke-miterlimit",pf(n.miterLimit));t.setAttributeNS(null,"stroke-linecap",n.lineCap);t.setAttributeNS(null,"stroke-linejoin",n.lineJoin);t.setAttributeNS(null,"stroke-width",pf(e*n.lineWidth)+"px");t.setAttributeNS(null,"stroke-dasharray",r.map(pf).join(" "));t.setAttributeNS(null,"stroke-dashoffset",pf(e*n.dashPhase)+"px")}eoFill(){var t;null===(t=this.current.element)||void 0===t||t.setAttributeNS(null,"fill-rule","evenodd");this.fill()}fillStroke(){this.stroke();this.fill()}eoFillStroke(){var t;null===(t=this.current.element)||void 0===t||t.setAttributeNS(null,"fill-rule","evenodd");this.fillStroke()}closeStroke(){this.closePath();this.stroke()}closeFillStroke(){this.closePath();this.fillStroke()}closeEOFillStroke(){this.closePath();this.eoFillStroke()}paintSolidColorImageMask(){const t=this.svgFactory.createElement("svg:rect");t.setAttributeNS(null,"x","0");t.setAttributeNS(null,"y","0");t.setAttributeNS(null,"width","1px");t.setAttributeNS(null,"height","1px");t.setAttributeNS(null,"fill",this.current.fillColor);this._ensureTransformGroup().append(t)}paintImageXObject(t){const e=this.getObject(t);e?this.paintInlineImageXObject(e):(0,i.warn)(`Dependent image with object ID ${t} is not ready yet`)}paintInlineImageXObject(t,e){const n=t.width,r=t.height,i=u(t,this.forceDataSchema,!!e),s=this.svgFactory.createElement("svg:rect");s.setAttributeNS(null,"x","0");s.setAttributeNS(null,"y","0");s.setAttributeNS(null,"width",pf(n));s.setAttributeNS(null,"height",pf(r));this.current.element=s;this.clip("nonzero");const a=this.svgFactory.createElement("svg:image");a.setAttributeNS(c,"xlink:href",i);a.setAttributeNS(null,"x","0");a.setAttributeNS(null,"y",pf(-r));a.setAttributeNS(null,"width",pf(n)+"px");a.setAttributeNS(null,"height",pf(r)+"px");a.setAttributeNS(null,"transform",`scale(${pf(1/n)} ${pf(-1/r)})`);e?e.append(a):this._ensureTransformGroup().append(a)}paintImageMaskXObject(t){const e=this.getObject(t.data,t);if(e.bitmap){(0,i.warn)("paintImageMaskXObject: ImageBitmap support is not implemented, ensure that the `isOffscreenCanvasSupported` API parameter is disabled.");return}const n=this.current,r=e.width,s=e.height,a=n.fillColor;n.maskId="mask"+f++;const o=this.svgFactory.createElement("svg:mask");o.setAttributeNS(null,"id",n.maskId);const l=this.svgFactory.createElement("svg:rect");l.setAttributeNS(null,"x","0");l.setAttributeNS(null,"y","0");l.setAttributeNS(null,"width",pf(r));l.setAttributeNS(null,"height",pf(s));l.setAttributeNS(null,"fill",a);l.setAttributeNS(null,"mask",`url(#${n.maskId})`);this.defs.append(o);this._ensureTransformGroup().append(l);this.paintInlineImageXObject(e,o)}paintFormXObjectBegin(t,e){Array.isArray(t)&&6===t.length&&this.transform(t[0],t[1],t[2],t[3],t[4],t[5]);if(e){const t=e[2]-e[0],n=e[3]-e[1],r=this.svgFactory.createElement("svg:rect");r.setAttributeNS(null,"x",e[0]);r.setAttributeNS(null,"y",e[1]);r.setAttributeNS(null,"width",pf(t));r.setAttributeNS(null,"height",pf(n));this.current.element=r;this.clip("nonzero");this.endPath()}}paintFormXObjectEnd(){}_initialize(t){const e=this.svgFactory.create(t.width,t.height),n=this.svgFactory.createElement("svg:defs");e.append(n);this.defs=n;const r=this.svgFactory.createElement("svg:g");r.setAttributeNS(null,"transform",pm(t.transform));e.append(r);this.svg=r;return e}_ensureClipGroup(){if(!this.current.clipGroup){const t=this.svgFactory.createElement("svg:g");t.setAttributeNS(null,"clip-path",this.current.activeClipUrl);this.svg.append(t);this.current.clipGroup=t}return this.current.clipGroup}_ensureTransformGroup(){if(!this.tgrp){this.tgrp=this.svgFactory.createElement("svg:g");this.tgrp.setAttributeNS(null,"transform",pm(this.transformMatrix));this.current.activeClipUrl?this._ensureClipGroup().append(this.tgrp):this.svg.append(this.tgrp)}return this.tgrp}}}}],__webpack_module_cache__={};function __w_pdfjs_require__(t){var e=__webpack_module_cache__[t];if(void 0!==e)return e.exports;var n=__webpack_module_cache__[t]={exports:{}};__webpack_modules__[t].call(n.exports,n,n.exports,__w_pdfjs_require__);return n.exports}var __webpack_exports__={};(()=>{"use strict";var t=__webpack_exports__;Object.defineProperty(t,"__esModule",{value:!0});Object.defineProperty(t,"AbortException",{enumerable:!0,get:function(){return e.AbortException}});Object.defineProperty(t,"AnnotationEditorLayer",{enumerable:!0,get:function(){return s.AnnotationEditorLayer}});Object.defineProperty(t,"AnnotationEditorParamsType",{enumerable:!0,get:function(){return e.AnnotationEditorParamsType}});Object.defineProperty(t,"AnnotationEditorType",{enumerable:!0,get:function(){return e.AnnotationEditorType}});Object.defineProperty(t,"AnnotationEditorUIManager",{enumerable:!0,get:function(){return a.AnnotationEditorUIManager}});Object.defineProperty(t,"AnnotationLayer",{enumerable:!0,get:function(){return o.AnnotationLayer}});Object.defineProperty(t,"AnnotationMode",{enumerable:!0,get:function(){return e.AnnotationMode}});Object.defineProperty(t,"CMapCompressionType",{enumerable:!0,get:function(){return e.CMapCompressionType}});Object.defineProperty(t,"FeatureTest",{enumerable:!0,get:function(){return e.FeatureTest}});Object.defineProperty(t,"GlobalWorkerOptions",{enumerable:!0,get:function(){return l.GlobalWorkerOptions}});Object.defineProperty(t,"InvalidPDFException",{enumerable:!0,get:function(){return e.InvalidPDFException}});Object.defineProperty(t,"MissingPDFException",{enumerable:!0,get:function(){return e.MissingPDFException}});Object.defineProperty(t,"OPS",{enumerable:!0,get:function(){return e.OPS}});Object.defineProperty(t,"PDFDataRangeTransport",{enumerable:!0,get:function(){return n.PDFDataRangeTransport}});Object.defineProperty(t,"PDFDateString",{enumerable:!0,get:function(){return r.PDFDateString}});Object.defineProperty(t,"PDFWorker",{enumerable:!0,get:function(){return n.PDFWorker}});Object.defineProperty(t,"PasswordResponses",{enumerable:!0,get:function(){return e.PasswordResponses}});Object.defineProperty(t,"PermissionFlag",{enumerable:!0,get:function(){return e.PermissionFlag}});Object.defineProperty(t,"PixelsPerInch",{enumerable:!0,get:function(){return r.PixelsPerInch}});Object.defineProperty(t,"PromiseCapability",{enumerable:!0,get:function(){return e.PromiseCapability}});Object.defineProperty(t,"RenderingCancelledException",{enumerable:!0,get:function(){return r.RenderingCancelledException}});Object.defineProperty(t,"SVGGraphics",{enumerable:!0,get:function(){return c.SVGGraphics}});Object.defineProperty(t,"UnexpectedResponseException",{enumerable:!0,get:function(){return e.UnexpectedResponseException}});Object.defineProperty(t,"Util",{enumerable:!0,get:function(){return e.Util}});Object.defineProperty(t,"VerbosityLevel",{enumerable:!0,get:function(){return e.VerbosityLevel}});Object.defineProperty(t,"XfaLayer",{enumerable:!0,get:function(){return d.XfaLayer}});Object.defineProperty(t,"build",{enumerable:!0,get:function(){return n.build}});Object.defineProperty(t,"createValidAbsoluteUrl",{enumerable:!0,get:function(){return e.createValidAbsoluteUrl}});Object.defineProperty(t,"getDocument",{enumerable:!0,get:function(){return n.getDocument}});Object.defineProperty(t,"getFilenameFromUrl",{enumerable:!0,get:function(){return r.getFilenameFromUrl}});Object.defineProperty(t,"getPdfFilenameFromUrl",{enumerable:!0,get:function(){return r.getPdfFilenameFromUrl}});Object.defineProperty(t,"getXfaPageViewport",{enumerable:!0,get:function(){return r.getXfaPageViewport}});Object.defineProperty(t,"isDataScheme",{enumerable:!0,get:function(){return r.isDataScheme}});Object.defineProperty(t,"isPdfFile",{enumerable:!0,get:function(){return r.isPdfFile}});Object.defineProperty(t,"loadScript",{enumerable:!0,get:function(){return r.loadScript}});Object.defineProperty(t,"normalizeUnicode",{enumerable:!0,get:function(){return e.normalizeUnicode}});Object.defineProperty(t,"renderTextLayer",{enumerable:!0,get:function(){return i.renderTextLayer}});Object.defineProperty(t,"setLayerDimensions",{enumerable:!0,get:function(){return r.setLayerDimensions}});Object.defineProperty(t,"shadow",{enumerable:!0,get:function(){return e.shadow}});Object.defineProperty(t,"updateTextLayer",{enumerable:!0,get:function(){return i.updateTextLayer}});Object.defineProperty(t,"version",{enumerable:!0,get:function(){return n.version}});var e=__w_pdfjs_require__(1),n=__w_pdfjs_require__(138),r=__w_pdfjs_require__(142),i=__w_pdfjs_require__(161),s=__w_pdfjs_require__(162),a=__w_pdfjs_require__(141),o=__w_pdfjs_require__(165),l=__w_pdfjs_require__(149),c=__w_pdfjs_require__(168),d=__w_pdfjs_require__(167)})();return __webpack_exports__})())); |