@pdfslick/react 1.0.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/dist/esm/PDFSlickThumbnails.d.ts +0 -20
- package/dist/esm/PDFSlickThumbnails.d.ts.map +0 -1
- package/dist/esm/PDFSlickViewer.d.ts +0 -10
- package/dist/esm/PDFSlickViewer.d.ts.map +0 -1
- package/dist/esm/index.d.ts +0 -4
- package/dist/esm/index.d.ts.map +0 -1
- package/dist/esm/index.js +0 -116
- package/dist/esm/usePDFSlick.d.ts +0 -32
- package/dist/esm/usePDFSlick.d.ts.map +0 -1
- package/dist/pdf_viewer.css +0 -2762
- package/dist/umd/PDFSlickThumbnails.d.ts +0 -20
- package/dist/umd/PDFSlickThumbnails.d.ts.map +0 -1
- package/dist/umd/PDFSlickViewer.d.ts +0 -10
- package/dist/umd/PDFSlickViewer.d.ts.map +0 -1
- package/dist/umd/index.d.ts +0 -4
- package/dist/umd/index.d.ts.map +0 -1
- package/dist/umd/index.js +0 -54
- package/dist/umd/usePDFSlick.d.ts +0 -32
- package/dist/umd/usePDFSlick.d.ts.map +0 -1
package/dist/umd/index.js
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("react/jsx-runtime"),require("react-dom")):"function"==typeof define&&define.amd?define(["exports","react","react/jsx-runtime","react-dom"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).PDFSlickReact={},e.React,e.jsxRuntime,e.ReactDOM)}(this,(function(exports,React,jsxRuntime,reactDom){"use strict";const createStoreImpl=e=>{let t;const i=new Set,n=(e,n)=>{const s="function"==typeof e?e(t):e;if(!Object.is(s,t)){const e=t;t=(null!=n?n:"object"!=typeof s)?s:Object.assign({},t,s),i.forEach((i=>i(t,e)))}},s=()=>t,r={setState:n,getState:s,subscribe:e=>(i.add(e),()=>i.delete(e)),destroy:()=>{console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),i.clear()}};return t=e(n,s,r),r},createStore$1=e=>e?createStoreImpl(e):createStoreImpl;function getDefaultExportFromCjs(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function getAugmentedNamespace(e){if(e.__esModule)return e;var t=e.default;if("function"==typeof t){var i=function e(){if(this instanceof e){var i=[null];return i.push.apply(i,arguments),new(Function.bind.apply(t,i))}return t.apply(this,arguments)};i.prototype=t.prototype}else i={};return Object.defineProperty(i,"__esModule",{value:!0}),Object.keys(e).forEach((function(t){var n=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(i,t,n.get?n:{enumerable:!0,get:function(){return e[t]}})})),i}var withSelector={exports:{}},withSelector_production_min={},shim={exports:{}},useSyncExternalStoreShim_production_min={},hasRequiredUseSyncExternalStoreShim_production_min,hasRequiredShim,hasRequiredWithSelector_production_min;function requireUseSyncExternalStoreShim_production_min(){if(hasRequiredUseSyncExternalStoreShim_production_min)return useSyncExternalStoreShim_production_min;hasRequiredUseSyncExternalStoreShim_production_min=1;var e=React;var t="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},i=e.useState,n=e.useEffect,s=e.useLayoutEffect,r=e.useDebugValue;function a(e){var i=e.getSnapshot;e=e.value;try{var n=i();return!t(e,n)}catch(e){return!0}}var o="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(e,t){var o=t(),l=i({inst:{value:o,getSnapshot:t}}),c=l[0].inst,h=l[1];return s((function(){c.value=o,c.getSnapshot=t,a(c)&&h({inst:c})}),[e,o,t]),n((function(){return a(c)&&h({inst:c}),e((function(){a(c)&&h({inst:c})}))}),[e]),r(o),o};return useSyncExternalStoreShim_production_min.useSyncExternalStore=void 0!==e.useSyncExternalStore?e.useSyncExternalStore:o,useSyncExternalStoreShim_production_min}function requireShim(){return hasRequiredShim||(hasRequiredShim=1,shim.exports=requireUseSyncExternalStoreShim_production_min()),shim.exports}
|
|
2
|
-
/**
|
|
3
|
-
* @license React
|
|
4
|
-
* use-sync-external-store-shim/with-selector.production.min.js
|
|
5
|
-
*
|
|
6
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
7
|
-
*
|
|
8
|
-
* This source code is licensed under the MIT license found in the
|
|
9
|
-
* LICENSE file in the root directory of this source tree.
|
|
10
|
-
*/function requireWithSelector_production_min(){if(hasRequiredWithSelector_production_min)return withSelector_production_min;hasRequiredWithSelector_production_min=1;var e=React,t=requireShim();var i="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},n=t.useSyncExternalStore,s=e.useRef,r=e.useEffect,a=e.useMemo,o=e.useDebugValue;return withSelector_production_min.useSyncExternalStoreWithSelector=function(e,t,l,c,h){var d=s(null);if(null===d.current){var u={hasValue:!1,value:null};d.current=u}else u=d.current;d=a((function(){function e(e){if(!r){if(r=!0,n=e,e=c(e),void 0!==h&&u.hasValue){var t=u.value;if(h(t,e))return s=t}return s=e}if(t=s,i(n,e))return t;var a=c(e);return void 0!==h&&h(t,a)?t:(n=e,s=a)}var n,s,r=!1,a=void 0===l?null:l;return[function(){return e(t())},null===a?void 0:function(){return e(a())}]}),[t,l,c,h]);var p=n(e,d[0],d[1]);return r((function(){u.hasValue=!0,u.value=p}),[p]),o(p),p},withSelector_production_min}withSelector.exports=requireWithSelector_production_min();var withSelectorExports=withSelector.exports,useSyncExternalStoreExports=getDefaultExportFromCjs(withSelectorExports);const{useSyncExternalStoreWithSelector:useSyncExternalStoreWithSelector}=useSyncExternalStoreExports;function useStore(e,t=e.getState,i){const n=useSyncExternalStoreWithSelector(e.subscribe,e.getState,e.getServerState||e.getState,t,i);return React.useDebugValue(n),n}function commonjsRequire(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var pdf={exports:{}},_nodeResolve_empty={},_nodeResolve_empty$1=Object.freeze({__proto__:null,default:_nodeResolve_empty}),require$$5=getAugmentedNamespace(_nodeResolve_empty$1);
|
|
11
|
-
/**
|
|
12
|
-
* @licstart The following is the entire license notice for the
|
|
13
|
-
* JavaScript code in this page
|
|
14
|
-
*
|
|
15
|
-
* Copyright 2023 Mozilla Foundation
|
|
16
|
-
*
|
|
17
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
18
|
-
* you may not use this file except in compliance with the License.
|
|
19
|
-
* You may obtain a copy of the License at
|
|
20
|
-
*
|
|
21
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
22
|
-
*
|
|
23
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
24
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
25
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
26
|
-
* See the License for the specific language governing permissions and
|
|
27
|
-
* limitations under the License.
|
|
28
|
-
*
|
|
29
|
-
* @licend The above is the entire license notice for the
|
|
30
|
-
* JavaScript code in this page
|
|
31
|
-
*/
|
|
32
|
-
(function(module,exports){var factory;globalThis,factory=()=>(()=>{var __webpack_modules__=[,(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.VerbosityLevel=t.Util=t.UnknownErrorException=t.UnexpectedResponseException=t.TextRenderingMode=t.RenderingIntentFlag=t.PermissionFlag=t.PasswordResponses=t.PasswordException=t.PageActionEventType=t.OPS=t.MissingPDFException=t.MAX_IMAGE_SIZE_TO_CACHE=t.LINE_FACTOR=t.LINE_DESCENT_FACTOR=t.InvalidPDFException=t.ImageKind=t.IDENTITY_MATRIX=t.FormatError=t.FeatureTest=t.FONT_IDENTITY_MATRIX=t.DocumentActionEventType=t.CMapCompressionType=t.BaseException=t.BASELINE_FACTOR=t.AnnotationType=t.AnnotationStateModelType=t.AnnotationReviewState=t.AnnotationReplyType=t.AnnotationMode=t.AnnotationMarkedState=t.AnnotationFlag=t.AnnotationFieldFlag=t.AnnotationEditorType=t.AnnotationEditorPrefix=t.AnnotationEditorParamsType=t.AnnotationBorderStyleType=t.AnnotationActionEventType=t.AbortException=void 0,t.assert=function(e,t){e||r(t)},t.bytesToString=function(e){"object"==typeof e&&null!==e&&void 0!==e.length||r("Invalid argument for bytesToString");const t=e.length,i=8192;if(t<i)return String.fromCharCode.apply(null,e);const n=[];for(let s=0;s<t;s+=i){const r=Math.min(s+i,t),a=e.subarray(s,r);n.push(String.fromCharCode.apply(null,a))}return n.join("")},t.createPromiseCapability=function(){const e=Object.create(null);let t=!1;return Object.defineProperty(e,"settled",{get:()=>t}),e.promise=new Promise((function(i,n){e.resolve=function(e){t=!0,i(e)},e.reject=function(e){t=!0,n(e)}})),e},t.createValidAbsoluteUrl=function(e,t=null,i=null){if(!e)return null;try{if(i&&"string"==typeof e){if(i.addDefaultProtocol&&e.startsWith("www.")){const t=e.match(/\./g);t&&t.length>=2&&(e=`http://${e}`)}if(i.tryConvertEncoding)try{e=u(e)}catch(e){}}const n=t?new URL(e,t):new URL(e);if(function(e){if(!e)return!1;switch(e.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":return!0;default:return!1}}(n))return n}catch(e){}return null},t.getModificationDate=function(e=new Date){return[e.getUTCFullYear().toString(),(e.getUTCMonth()+1).toString().padStart(2,"0"),e.getUTCDate().toString().padStart(2,"0"),e.getUTCHours().toString().padStart(2,"0"),e.getUTCMinutes().toString().padStart(2,"0"),e.getUTCSeconds().toString().padStart(2,"0")].join("")},t.getVerbosityLevel=function(){return n},t.info=function(e){n>=i.INFOS&&console.log(`Info: ${e}`)},t.isArrayBuffer=function(e){return"object"==typeof e&&null!==e&&void 0!==e.byteLength},t.isArrayEqual=function(e,t){if(e.length!==t.length)return!1;for(let i=0,n=e.length;i<n;i++)if(e[i]!==t[i])return!1;return!0},t.objectFromMap=function(e){const t=Object.create(null);for(const[i,n]of e)t[i]=n;return t},t.objectSize=function(e){return Object.keys(e).length},t.setVerbosityLevel=function(e){Number.isInteger(e)&&(n=e)},t.shadow=a,t.string32=function(e){return String.fromCharCode(e>>24&255,e>>16&255,e>>8&255,255&e)},t.stringToBytes=l,t.stringToPDFString=function(e){if(e[0]>="ï"){let t;if("þ"===e[0]&&"ÿ"===e[1]?t="utf-16be":"ÿ"===e[0]&&"þ"===e[1]?t="utf-16le":"ï"===e[0]&&"»"===e[1]&&"¿"===e[2]&&(t="utf-8"),t)try{const i=new TextDecoder(t,{fatal:!0}),n=l(e);return i.decode(n)}catch(e){s(`stringToPDFString: "${e}".`)}}const t=[];for(let i=0,n=e.length;i<n;i++){const n=d[e.charCodeAt(i)];t.push(n?String.fromCharCode(n):e.charAt(i))}return t.join("")},t.stringToUTF8String=u,t.unreachable=r,t.utf8StringToString=function(e){return unescape(encodeURIComponent(e))},t.warn=s,t.IDENTITY_MATRIX=[1,0,0,1,0,0],t.FONT_IDENTITY_MATRIX=[.001,0,0,.001,0,0],t.MAX_IMAGE_SIZE_TO_CACHE=1e7,t.LINE_FACTOR=1.35,t.LINE_DESCENT_FACTOR=.35,t.BASELINE_FACTOR=.25925925925925924,t.RenderingIntentFlag={ANY:1,DISPLAY:2,PRINT:4,SAVE:8,ANNOTATIONS_FORMS:16,ANNOTATIONS_STORAGE:32,ANNOTATIONS_DISABLE:64,OPLIST:256},t.AnnotationMode={DISABLE:0,ENABLE:1,ENABLE_FORMS:2,ENABLE_STORAGE:3},t.AnnotationEditorPrefix="pdfjs_internal_editor_",t.AnnotationEditorType={DISABLE:-1,NONE:0,FREETEXT:3,INK:15},t.AnnotationEditorParamsType={FREETEXT_SIZE:1,FREETEXT_COLOR:2,FREETEXT_OPACITY:3,INK_COLOR:11,INK_THICKNESS:12,INK_OPACITY:13},t.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},t.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},t.ImageKind={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3},t.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},t.AnnotationStateModelType={MARKED:"Marked",REVIEW:"Review"},t.AnnotationMarkedState={MARKED:"Marked",UNMARKED:"Unmarked"},t.AnnotationReviewState={ACCEPTED:"Accepted",REJECTED:"Rejected",CANCELLED:"Cancelled",COMPLETED:"Completed",NONE:"None"},t.AnnotationReplyType={GROUP:"Group",REPLY:"R"},t.AnnotationFlag={INVISIBLE:1,HIDDEN:2,PRINT:4,NOZOOM:8,NOROTATE:16,NOVIEW:32,READONLY:64,LOCKED:128,TOGGLENOVIEW:256,LOCKEDCONTENTS:512},t.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},t.AnnotationBorderStyleType={SOLID:1,DASHED:2,BEVELED:3,INSET:4,UNDERLINE:5},t.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"},t.DocumentActionEventType={WC:"WillClose",WS:"WillSave",DS:"DidSave",WP:"WillPrint",DP:"DidPrint"},t.PageActionEventType={O:"PageOpen",C:"PageClose"};const i={ERRORS:0,WARNINGS:1,INFOS:5};t.VerbosityLevel=i,t.CMapCompressionType={NONE:0,BINARY:1},t.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},t.PasswordResponses={NEED_PASSWORD:1,INCORRECT_PASSWORD:2};let n=i.WARNINGS;function s(e){n>=i.WARNINGS&&console.log(`Warning: ${e}`)}function r(e){throw new Error(e)}function a(e,t,i,n=!1){return Object.defineProperty(e,t,{value:i,enumerable:!n,configurable:!0,writable:!1}),i}const o=function(){function e(t,i){this.constructor===e&&r("Cannot initialize BaseException."),this.message=t,this.name=i}return e.prototype=new Error,e.constructor=e,e}();function l(e){"string"!=typeof e&&r("Invalid argument for stringToBytes");const t=e.length,i=new Uint8Array(t);for(let n=0;n<t;++n)i[n]=255&e.charCodeAt(n);return i}t.BaseException=o,t.PasswordException=class extends o{constructor(e,t){super(e,"PasswordException"),this.code=t}},t.UnknownErrorException=class extends o{constructor(e,t){super(e,"UnknownErrorException"),this.details=t}},t.InvalidPDFException=class extends o{constructor(e){super(e,"InvalidPDFException")}},t.MissingPDFException=class extends o{constructor(e){super(e,"MissingPDFException")}},t.UnexpectedResponseException=class extends o{constructor(e,t){super(e,"UnexpectedResponseException"),this.status=t}},t.FormatError=class extends o{constructor(e){super(e,"FormatError")}},t.AbortException=class extends o{constructor(e){super(e,"AbortException")}},t.FeatureTest=class{static get isLittleEndian(){return a(this,"isLittleEndian",function(){const e=new Uint8Array(4);return e[0]=1,1===new Uint32Array(e.buffer,0,1)[0]}())}static get isEvalSupported(){return a(this,"isEvalSupported",function(){try{return new Function(""),!0}catch(e){return!1}}())}static get isOffscreenCanvasSupported(){return a(this,"isOffscreenCanvasSupported","undefined"!=typeof OffscreenCanvas)}static get platform(){return"undefined"==typeof navigator?a(this,"platform",{isWin:!1,isMac:!1}):a(this,"platform",{isWin:navigator.platform.includes("Win"),isMac:navigator.platform.includes("Mac")})}};const c=[...Array(256).keys()].map((e=>e.toString(16).padStart(2,"0")));class h{static makeHexColor(e,t,i){return`#${c[e]}${c[t]}${c[i]}`}static scaleMinMax(e,t){let i;e[0]?(e[0]<0&&(i=t[0],t[0]=t[1],t[1]=i),t[0]*=e[0],t[1]*=e[0],e[3]<0&&(i=t[2],t[2]=t[3],t[3]=i),t[2]*=e[3],t[3]*=e[3]):(i=t[0],t[0]=t[2],t[2]=i,i=t[1],t[1]=t[3],t[3]=i,e[1]<0&&(i=t[2],t[2]=t[3],t[3]=i),t[2]*=e[1],t[3]*=e[1],e[2]<0&&(i=t[0],t[0]=t[1],t[1]=i),t[0]*=e[2],t[1]*=e[2]),t[0]+=e[4],t[1]+=e[4],t[2]+=e[5],t[3]+=e[5]}static transform(e,t){return[e[0]*t[0]+e[2]*t[1],e[1]*t[0]+e[3]*t[1],e[0]*t[2]+e[2]*t[3],e[1]*t[2]+e[3]*t[3],e[0]*t[4]+e[2]*t[5]+e[4],e[1]*t[4]+e[3]*t[5]+e[5]]}static applyTransform(e,t){return[e[0]*t[0]+e[1]*t[2]+t[4],e[0]*t[1]+e[1]*t[3]+t[5]]}static applyInverseTransform(e,t){const i=t[0]*t[3]-t[1]*t[2];return[(e[0]*t[3]-e[1]*t[2]+t[2]*t[5]-t[4]*t[3])/i,(-e[0]*t[1]+e[1]*t[0]+t[4]*t[1]-t[5]*t[0])/i]}static getAxialAlignedBoundingBox(e,t){const i=h.applyTransform(e,t),n=h.applyTransform(e.slice(2,4),t),s=h.applyTransform([e[0],e[3]],t),r=h.applyTransform([e[2],e[1]],t);return[Math.min(i[0],n[0],s[0],r[0]),Math.min(i[1],n[1],s[1],r[1]),Math.max(i[0],n[0],s[0],r[0]),Math.max(i[1],n[1],s[1],r[1])]}static inverseTransform(e){const t=e[0]*e[3]-e[1]*e[2];return[e[3]/t,-e[1]/t,-e[2]/t,e[0]/t,(e[2]*e[5]-e[4]*e[3])/t,(e[4]*e[1]-e[5]*e[0])/t]}static singularValueDecompose2dScale(e){const t=[e[0],e[2],e[1],e[3]],i=e[0]*t[0]+e[1]*t[2],n=e[0]*t[1]+e[1]*t[3],s=e[2]*t[0]+e[3]*t[2],r=e[2]*t[1]+e[3]*t[3],a=(i+r)/2,o=Math.sqrt((i+r)**2-4*(i*r-s*n))/2,l=a+o||1,c=a-o||1;return[Math.sqrt(l),Math.sqrt(c)]}static normalizeRect(e){const t=e.slice(0);return e[0]>e[2]&&(t[0]=e[2],t[2]=e[0]),e[1]>e[3]&&(t[1]=e[3],t[3]=e[1]),t}static intersect(e,t){const i=Math.max(Math.min(e[0],e[2]),Math.min(t[0],t[2])),n=Math.min(Math.max(e[0],e[2]),Math.max(t[0],t[2]));if(i>n)return null;const s=Math.max(Math.min(e[1],e[3]),Math.min(t[1],t[3])),r=Math.min(Math.max(e[1],e[3]),Math.max(t[1],t[3]));return s>r?null:[i,s,n,r]}static bezierBoundingBox(e,t,i,n,s,r,a,o){const l=[],c=[[],[]];let h,d,u,p,g,f,m,_;for(let c=0;c<2;++c)if(0===c?(d=6*e-12*i+6*s,h=-3*e+9*i-9*s+3*a,u=3*i-3*e):(d=6*t-12*n+6*r,h=-3*t+9*n-9*r+3*o,u=3*n-3*t),Math.abs(h)<1e-12){if(Math.abs(d)<1e-12)continue;p=-u/d,0<p&&p<1&&l.push(p)}else m=d*d-4*u*h,_=Math.sqrt(m),m<0||(g=(-d+_)/(2*h),0<g&&g<1&&l.push(g),f=(-d-_)/(2*h),0<f&&f<1&&l.push(f));let v,b=l.length;const y=b;for(;b--;)p=l[b],v=1-p,c[0][b]=v*v*v*e+3*v*v*p*i+3*v*p*p*s+p*p*p*a,c[1][b]=v*v*v*t+3*v*v*p*n+3*v*p*p*r+p*p*p*o;return c[0][y]=e,c[1][y]=t,c[0][y+1]=a,c[1][y+1]=o,c[0].length=c[1].length=y+2,[Math.min(...c[0]),Math.min(...c[1]),Math.max(...c[0]),Math.max(...c[1])]}}t.Util=h;const d=[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 u(e){return decodeURIComponent(escape(e))}},(__unused_webpack_module,exports,__w_pdfjs_require__)=>{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__(3),_display_utils=__w_pdfjs_require__(6),_font_loader=__w_pdfjs_require__(9),_canvas=__w_pdfjs_require__(11),_worker_options=__w_pdfjs_require__(14),_is_node=__w_pdfjs_require__(10),_message_handler=__w_pdfjs_require__(15),_metadata=__w_pdfjs_require__(16),_optional_content_config=__w_pdfjs_require__(17),_transport_stream=__w_pdfjs_require__(18),_xfa_text=__w_pdfjs_require__(19);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;if(exports.DefaultStandardFontDataFactory=DefaultStandardFontDataFactory,_is_node.isNodeJS){const{NodeCanvasFactory:e,NodeCMapReaderFactory:t,NodeFilterFactory:i,NodeStandardFontDataFactory:n}=__w_pdfjs_require__(20);exports.DefaultCanvasFactory=DefaultCanvasFactory=e,exports.DefaultCMapReaderFactory=DefaultCMapReaderFactory=t,exports.DefaultFilterFactory=DefaultFilterFactory=i,exports.DefaultStandardFontDataFactory=DefaultStandardFontDataFactory=n}if(_is_node.isNodeJS){const{PDFNodeStream:e}=__w_pdfjs_require__(21);createPDFNetworkStream=t=>new e(t)}else{const{PDFNetworkStream:e}=__w_pdfjs_require__(24),{PDFFetchStream:t}=__w_pdfjs_require__(25);createPDFNetworkStream=i=>(0,_display_utils.isValidFetchUrl)(i.url)?new t(i):new e(i)}function getDocument(e){if("string"==typeof e||e instanceof URL?e={url:e}:(0,_util.isArrayBuffer)(e)&&(e={data:e}),"object"!=typeof e)throw new Error("Invalid parameter in getDocument, need parameter object.");if(!e.url&&!e.data&&!e.range)throw new Error("Invalid parameter object: need either .data, .range or .url");const t=new PDFDocumentLoadingTask,{docId:i}=t,n=e.url?getUrlProp(e.url):null,s=e.data?getDataProp(e.data):null,r=e.httpHeaders||null,a=!0===e.withCredentials,o=e.password??null,l=e.range instanceof PDFDataRangeTransport?e.range:null,c=Number.isInteger(e.rangeChunkSize)&&e.rangeChunkSize>0?e.rangeChunkSize:DEFAULT_RANGE_CHUNK_SIZE;let h=e.worker instanceof PDFWorker?e.worker:null;const d=e.verbosity,u="string"!=typeof e.docBaseUrl||(0,_display_utils.isDataScheme)(e.docBaseUrl)?null:e.docBaseUrl,p="string"==typeof e.cMapUrl?e.cMapUrl:null,g=!1!==e.cMapPacked,f=e.CMapReaderFactory||DefaultCMapReaderFactory,m="string"==typeof e.standardFontDataUrl?e.standardFontDataUrl:null,_=e.StandardFontDataFactory||DefaultStandardFontDataFactory,v=!0!==e.stopAtErrors,b=Number.isInteger(e.maxImageSize)&&e.maxImageSize>-1?e.maxImageSize:-1,y=!1!==e.isEvalSupported,S="boolean"==typeof e.isOffscreenCanvasSupported?e.isOffscreenCanvasSupported:!_is_node.isNodeJS,P=Number.isInteger(e.canvasMaxAreaInBytes)?e.canvasMaxAreaInBytes:-1,A="boolean"==typeof e.disableFontFace?e.disableFontFace:_is_node.isNodeJS,w=!0===e.fontExtraProperties,E=!0===e.enableXfa,C=e.ownerDocument||globalThis.document,x=!0===e.disableRange,M=!0===e.disableStream,T=!0===e.disableAutoFetch,F=!0===e.pdfBug,D=l?l.length:e.length??NaN,k="boolean"==typeof e.useSystemFonts?e.useSystemFonts:!_is_node.isNodeJS&&!A,R="boolean"==typeof e.useWorkerFetch?e.useWorkerFetch:f===_display_utils.DOMCMapReaderFactory&&_===_display_utils.DOMStandardFontDataFactory&&(0,_display_utils.isValidFetchUrl)(p,document.baseURI)&&(0,_display_utils.isValidFetchUrl)(m,document.baseURI),L=e.canvasFactory||new DefaultCanvasFactory({ownerDocument:C}),I=e.filterFactory||new DefaultFilterFactory({docId:i,ownerDocument:C});(0,_util.setVerbosityLevel)(d);const O={canvasFactory:L,filterFactory:I};if(R||(O.cMapReaderFactory=new f({baseUrl:p,isCompressed:g}),O.standardFontDataFactory=new _({baseUrl:m})),!h){const e={verbosity:d,port:_worker_options.GlobalWorkerOptions.workerPort};h=e.port?PDFWorker.fromPort(e):new PDFWorker(e),t._worker=h}const N={docId:i,apiVersion:"3.5.141",data:s,password:o,disableAutoFetch:T,rangeChunkSize:c,length:D,docBaseUrl:u,enableXfa:E,evaluatorOptions:{maxImageSize:b,disableFontFace:A,ignoreErrors:v,isEvalSupported:y,isOffscreenCanvasSupported:S,canvasMaxAreaInBytes:P,fontExtraProperties:w,useSystemFonts:k,cMapUrl:R?p:null,standardFontDataUrl:R?m:null}},V={ignoreErrors:v,isEvalSupported:y,disableFontFace:A,fontExtraProperties:w,enableXfa:E,ownerDocument:C,disableAutoFetch:T,pdfBug:F,styleElement:null};return h.promise.then((function(){if(t.destroyed)throw new Error("Loading aborted");const e=_fetchDocument(h,N),o=new Promise((function(e){let t;l?t=new _transport_stream.PDFDataTransportStream({length:D,initialData:l.initialData,progressiveDone:l.progressiveDone,contentDispositionFilename:l.contentDispositionFilename,disableRange:x,disableStream:M},l):s||(t=createPDFNetworkStream({url:n,length:D,httpHeaders:r,withCredentials:a,rangeChunkSize:c,disableRange:x,disableStream:M})),e(t)}));return Promise.all([e,o]).then((function([e,n]){if(t.destroyed)throw new Error("Loading aborted");const s=new _message_handler.MessageHandler(i,e,h.port),r=new WorkerTransport(s,t,n,V,O);t._transport=r,s.send("Ready",null)}))})).catch(t._capability.reject),t}async function _fetchDocument(e,t){if(e.destroyed)throw new Error("Worker was destroyed");const i=await e.messageHandler.sendWithPromise("GetDocRequest",t,t.data?[t.data.buffer]:null);if(e.destroyed)throw new Error("Worker was destroyed");return i}function getUrlProp(e){if(e instanceof URL)return e.href;try{return new URL(e,window.location).href}catch(t){if(_is_node.isNodeJS&&"string"==typeof e)return e}throw new Error("Invalid PDF url data: either string or URL-object is expected in the url property.")}function getDataProp(e){if(_is_node.isNodeJS&&"undefined"!=typeof Buffer&&e instanceof Buffer)return(0,_display_utils.deprecated)("Please provide binary data as `Uint8Array`, rather than `Buffer`."),new Uint8Array(e);if(e instanceof Uint8Array&&e.byteLength===e.buffer.byteLength)return e;if("string"==typeof e)return(0,_util.stringToBytes)(e);if("object"==typeof e&&!isNaN(e?.length)||(0,_util.isArrayBuffer)(e))return new Uint8Array(e);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=(0,_util.createPromiseCapability)(),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(){this.destroyed=!0,await(this._transport?.destroy()),this._transport=null,this._worker&&(this._worker.destroy(),this._worker=null)}}exports.PDFDocumentLoadingTask=PDFDocumentLoadingTask;class PDFDataRangeTransport{constructor(e,t,i=!1,n=null){this.length=e,this.initialData=t,this.progressiveDone=i,this.contentDispositionFilename=n,this._rangeListeners=[],this._progressListeners=[],this._progressiveReadListeners=[],this._progressiveDoneListeners=[],this._readyCapability=(0,_util.createPromiseCapability)()}addRangeListener(e){this._rangeListeners.push(e)}addProgressListener(e){this._progressListeners.push(e)}addProgressiveReadListener(e){this._progressiveReadListeners.push(e)}addProgressiveDoneListener(e){this._progressiveDoneListeners.push(e)}onDataRange(e,t){for(const i of this._rangeListeners)i(e,t)}onDataProgress(e,t){this._readyCapability.promise.then((()=>{for(const i of this._progressListeners)i(e,t)}))}onDataProgressiveRead(e){this._readyCapability.promise.then((()=>{for(const t of this._progressiveReadListeners)t(e)}))}onDataProgressiveDone(){this._readyCapability.promise.then((()=>{for(const e of this._progressiveDoneListeners)e()}))}transportReady(){this._readyCapability.resolve()}requestDataRange(e,t){(0,_util.unreachable)("Abstract method PDFDataRangeTransport.requestDataRange")}abort(){}}exports.PDFDataRangeTransport=PDFDataRangeTransport;class PDFDocumentProxy{constructor(e,t){this._pdfInfo=e,this._transport=t}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(e){return this._transport.getPage(e)}getPageIndex(e){return this._transport.getPageIndex(e)}getDestinations(){return this._transport.getDestinations()}getDestination(e){return this._transport.getDestination(e)}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(e=!1){return this._transport.startCleanup(e||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{#t=null;#i=!1;constructor(e,t,i,n=!1){this._pageIndex=e,this._pageInfo=t,this._transport=i,this._stats=n?new _display_utils.StatTimer:null,this._pdfBug=n,this.commonObjs=i.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({scale:e,rotation:t=this.rotate,offsetX:i=0,offsetY:n=0,dontFlip:s=!1}={}){return new _display_utils.PageViewport({viewBox:this.view,scale:e,rotation:t,offsetX:i,offsetY:n,dontFlip:s})}getAnnotations({intent:e="display"}={}){const t=this._transport.getRenderingIntent(e);return this._transport.getAnnotations(this._pageIndex,t.renderingIntent)}getJSActions(){return this._transport.getPageJSActions(this._pageIndex)}get isPureXfa(){return(0,_util.shadow)(this,"isPureXfa",!!this._transport._htmlForXfa)}async getXfa(){return this._transport._htmlForXfa?.children[this._pageIndex]||null}render({canvasContext:e,viewport:t,intent:i="display",annotationMode:n=_util.AnnotationMode.ENABLE,transform:s=null,background:r=null,optionalContentConfigPromise:a=null,annotationCanvasMap:o=null,pageColors:l=null,printAnnotationStorage:c=null}){if(arguments[0]?.canvasFactory)throw new Error("render no longer accepts the `canvasFactory`-option, please pass it to the `getDocument`-function instead.");this._stats?.time("Overall");const h=this._transport.getRenderingIntent(i,n,c);this.#i=!1,this.#n(),a||(a=this._transport.getOptionalContentConfig());let d=this._intentStates.get(h.cacheKey);d||(d=Object.create(null),this._intentStates.set(h.cacheKey,d)),d.streamReaderCancelTimeout&&(clearTimeout(d.streamReaderCancelTimeout),d.streamReaderCancelTimeout=null);const u=!!(h.renderingIntent&_util.RenderingIntentFlag.PRINT);d.displayReadyCapability||(d.displayReadyCapability=(0,_util.createPromiseCapability)(),d.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},this._stats?.time("Page Request"),this._pumpOperatorList(h));const p=e=>{d.renderTasks.delete(g),(this._maybeCleanupAfterRender||u)&&(this.#i=!0),this.#s(!u),e?(g.capability.reject(e),this._abortOperatorList({intentState:d,reason:e instanceof Error?e:new Error(e)})):g.capability.resolve(),this._stats?.timeEnd("Rendering"),this._stats?.timeEnd("Overall")},g=new InternalRenderTask({callback:p,params:{canvasContext:e,viewport:t,transform:s,background:r},objs:this.objs,commonObjs:this.commonObjs,annotationCanvasMap:o,operatorList:d.operatorList,pageIndex:this._pageIndex,canvasFactory:this._transport.canvasFactory,filterFactory:this._transport.filterFactory,useRequestAnimationFrame:!u,pdfBug:this._pdfBug,pageColors:l});(d.renderTasks||=new Set).add(g);const f=g.task;return Promise.all([d.displayReadyCapability.promise,a]).then((([e,t])=>{this.#i?p():(this._stats?.time("Rendering"),g.initializeGraphics({transparency:e,optionalContentConfig:t}),g.operatorListChanged())})).catch(p),f}getOperatorList({intent:e="display",annotationMode:t=_util.AnnotationMode.ENABLE,printAnnotationStorage:i=null}={}){const n=this._transport.getRenderingIntent(e,t,i,!0);let s,r=this._intentStates.get(n.cacheKey);return r||(r=Object.create(null),this._intentStates.set(n.cacheKey,r)),r.opListReadCapability||(s=Object.create(null),s.operatorListChanged=function(){r.operatorList.lastChunk&&(r.opListReadCapability.resolve(r.operatorList),r.renderTasks.delete(s))},r.opListReadCapability=(0,_util.createPromiseCapability)(),(r.renderTasks||=new Set).add(s),r.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},this._stats?.time("Page Request"),this._pumpOperatorList(n)),r.opListReadCapability.promise}streamTextContent({includeMarkedContent:e=!1}={}){return this._transport.messageHandler.sendWithStream("GetTextContent",{pageIndex:this._pageIndex,includeMarkedContent:!0===e},{highWaterMark:100,size:e=>e.items.length})}getTextContent(e={}){if(this._transport._htmlForXfa)return this.getXfa().then((e=>_xfa_text.XfaText.textContent(e)));const t=this.streamTextContent(e);return new Promise((function(e,i){const n=t.getReader(),s={items:[],styles:Object.create(null)};!function t(){n.read().then((function({value:i,done:n}){n?e(s):(Object.assign(s.styles,i.styles),s.items.push(...i.items),t())}),i)}()}))}getStructTree(){return this._transport.getStructTree(this._pageIndex)}_destroy(){this.destroyed=!0;const e=[];for(const t of this._intentStates.values())if(this._abortOperatorList({intentState:t,reason:new Error("Page was destroyed."),force:!0}),!t.opListReadCapability)for(const i of t.renderTasks)e.push(i.completed),i.cancel();return this.objs.clear(),this.#i=!1,this.#n(),Promise.all(e)}cleanup(e=!1){this.#i=!0;const t=this.#s(!1);return e&&t&&(this._stats&&=new _display_utils.StatTimer),t}#s(e=!1){if(this.#n(),!this.#i)return!1;if(e)return this.#t=setTimeout((()=>{this.#t=null,this.#s(!1)}),DELAYED_CLEANUP_TIMEOUT),!1;for(const{renderTasks:e,operatorList:t}of this._intentStates.values())if(e.size>0||!t.lastChunk)return!1;return this._intentStates.clear(),this.objs.clear(),this.#i=!1,!0}#n(){this.#t&&(clearTimeout(this.#t),this.#t=null)}_startRenderPage(e,t){const i=this._intentStates.get(t);i&&(this._stats?.timeEnd("Page Request"),i.displayReadyCapability?.resolve(e))}_renderPageChunk(e,t){for(let i=0,n=e.length;i<n;i++)t.operatorList.fnArray.push(e.fnArray[i]),t.operatorList.argsArray.push(e.argsArray[i]);t.operatorList.lastChunk=e.lastChunk,t.operatorList.separateAnnots=e.separateAnnots;for(const e of t.renderTasks)e.operatorListChanged();e.lastChunk&&this.#s(!0)}_pumpOperatorList({renderingIntent:e,cacheKey:t,annotationStorageMap:i}){const n=this._transport.messageHandler.sendWithStream("GetOperatorList",{pageIndex:this._pageIndex,intent:e,cacheKey:t,annotationStorage:i}).getReader(),s=this._intentStates.get(t);s.streamReader=n;const r=()=>{n.read().then((({value:e,done:t})=>{t?s.streamReader=null:this._transport.destroyed||(this._renderPageChunk(e,s),r())}),(e=>{if(s.streamReader=null,!this._transport.destroyed){if(s.operatorList){s.operatorList.lastChunk=!0;for(const e of s.renderTasks)e.operatorListChanged();this.#s(!0)}if(s.displayReadyCapability)s.displayReadyCapability.reject(e);else{if(!s.opListReadCapability)throw e;s.opListReadCapability.reject(e)}}}))};r()}_abortOperatorList({intentState:e,reason:t,force:i=!1}){if(e.streamReader){if(e.streamReaderCancelTimeout&&(clearTimeout(e.streamReaderCancelTimeout),e.streamReaderCancelTimeout=null),!i){if(e.renderTasks.size>0)return;if(t instanceof _display_utils.RenderingCancelledException){let i=RENDERING_CANCELLED_TIMEOUT;return t.extraDelay>0&&t.extraDelay<1e3&&(i+=t.extraDelay),void(e.streamReaderCancelTimeout=setTimeout((()=>{e.streamReaderCancelTimeout=null,this._abortOperatorList({intentState:e,reason:t,force:!0})}),i))}}if(e.streamReader.cancel(new _util.AbortException(t.message)).catch((()=>{})),e.streamReader=null,!this._transport.destroyed){for(const[t,i]of this._intentStates)if(i===e){this._intentStates.delete(t);break}this.cleanup()}}}get stats(){return this._stats}}exports.PDFPageProxy=PDFPageProxy;class LoopbackPort{#r=new Set;#a=Promise.resolve();postMessage(e,t){const i={data:structuredClone(e,t?{transfer:t}:null)};this.#a.then((()=>{for(const e of this.#r)e.call(this,i)}))}addEventListener(e,t){this.#r.add(t)}removeEventListener(e,t){this.#r.delete(t)}terminate(){this.#r.clear()}}exports.LoopbackPort=LoopbackPort;const PDFWorkerUtil={isWorkerDisabled:!1,fallbackWorkerSrc:null,fakeWorkerId:0};if(exports.PDFWorkerUtil=PDFWorkerUtil,_is_node.isNodeJS&&"function"==typeof commonjsRequire)PDFWorkerUtil.isWorkerDisabled=!0,PDFWorkerUtil.fallbackWorkerSrc="./pdf.worker.js";else if("object"==typeof document){const e=document?.currentScript?.src;e&&(PDFWorkerUtil.fallbackWorkerSrc=e.replace(/(\.(?:min\.)?js)(\?.*)?$/i,".worker$1$2"))}PDFWorkerUtil.isSameOrigin=function(e,t){let i;try{if(i=new URL(e),!i.origin||"null"===i.origin)return!1}catch(e){return!1}const n=new URL(t,i);return i.origin===n.origin},PDFWorkerUtil.createCDNWrapper=function(e){const t=`importScripts("${e}");`;return URL.createObjectURL(new Blob([t]))};class PDFWorker{static#o=new WeakMap;constructor({name:e=null,port:t=null,verbosity:i=(0,_util.getVerbosityLevel)()}={}){if(t&&PDFWorker.#o.has(t))throw new Error("Cannot use more than one PDFWorker per port.");if(this.name=e,this.destroyed=!1,this.verbosity=i,this._readyCapability=(0,_util.createPromiseCapability)(),this._port=null,this._webWorker=null,this._messageHandler=null,t)return PDFWorker.#o.set(t,this),void this._initializeFromPort(t);this._initialize()}get promise(){return this._readyCapability.promise}get port(){return this._port}get messageHandler(){return this._messageHandler}_initializeFromPort(e){this._port=e,this._messageHandler=new _message_handler.MessageHandler("main","worker",e),this._messageHandler.on("ready",(function(){})),this._readyCapability.resolve(),this._messageHandler.send("configure",{verbosity:this.verbosity})}_initialize(){if(!PDFWorkerUtil.isWorkerDisabled&&!PDFWorker._mainThreadWorkerMessageHandler){let{workerSrc:e}=PDFWorker;try{PDFWorkerUtil.isSameOrigin(window.location.href,e)||(e=PDFWorkerUtil.createCDNWrapper(new URL(e,window.location).href));const t=new Worker(e),i=new _message_handler.MessageHandler("main","worker",t),n=()=>{t.removeEventListener("error",s),i.destroy(),t.terminate(),this.destroyed?this._readyCapability.reject(new Error("Worker was destroyed")):this._setupFakeWorker()},s=()=>{this._webWorker||n()};t.addEventListener("error",s),i.on("test",(e=>{t.removeEventListener("error",s),this.destroyed?n():e?(this._messageHandler=i,this._port=t,this._webWorker=t,this._readyCapability.resolve(),i.send("configure",{verbosity:this.verbosity})):(this._setupFakeWorker(),i.destroy(),t.terminate())})),i.on("ready",(e=>{if(t.removeEventListener("error",s),this.destroyed)n();else try{r()}catch(e){this._setupFakeWorker()}}));const r=()=>{const e=new Uint8Array;i.send("test",e,[e.buffer])};return void r()}catch(e){(0,_util.info)("The worker has been disabled.")}}this._setupFakeWorker()}_setupFakeWorker(){PDFWorkerUtil.isWorkerDisabled||((0,_util.warn)("Setting up fake worker."),PDFWorkerUtil.isWorkerDisabled=!0),PDFWorker._setupFakeWorkerGlobal.then((e=>{if(this.destroyed)return void this._readyCapability.reject(new Error("Worker was destroyed"));const t=new LoopbackPort;this._port=t;const i="fake"+PDFWorkerUtil.fakeWorkerId++,n=new _message_handler.MessageHandler(i+"_worker",i,t);e.setup(n,t);const s=new _message_handler.MessageHandler(i,i+"_worker",t);this._messageHandler=s,this._readyCapability.resolve(),s.send("configure",{verbosity:this.verbosity})})).catch((e=>{this._readyCapability.reject(new Error(`Setting up fake worker failed: "${e.message}".`))}))}destroy(){this.destroyed=!0,this._webWorker&&(this._webWorker.terminate(),this._webWorker=null),PDFWorker.#o.delete(this._port),this._port=null,this._messageHandler&&(this._messageHandler.destroy(),this._messageHandler=null)}static fromPort(e){if(!e?.port)throw new Error("PDFWorker.fromPort - invalid method signature.");return this.#o.has(e.port)?this.#o.get(e.port):new PDFWorker(e)}static get workerSrc(){if(_worker_options.GlobalWorkerOptions.workerSrc)return _worker_options.GlobalWorkerOptions.workerSrc;if(null!==PDFWorkerUtil.fallbackWorkerSrc)return _is_node.isNodeJS||(0,_display_utils.deprecated)('No "GlobalWorkerOptions.workerSrc" specified.'),PDFWorkerUtil.fallbackWorkerSrc;throw new Error('No "GlobalWorkerOptions.workerSrc" specified.')}static get _mainThreadWorkerMessageHandler(){try{return globalThis.pdfjsWorker?.WorkerMessageHandler||null}catch(e){return null}}static get _setupFakeWorkerGlobal(){const loader=async()=>{const mainWorkerMessageHandler=this._mainThreadWorkerMessageHandler;if(mainWorkerMessageHandler)return mainWorkerMessageHandler;if(_is_node.isNodeJS&&"function"==typeof commonjsRequire){const worker=eval("require")(this.workerSrc);return worker.WorkerMessageHandler}return await(0,_display_utils.loadScript)(this.workerSrc),window.pdfjsWorker.WorkerMessageHandler};return(0,_util.shadow)(this,"_setupFakeWorkerGlobal",loader())}}exports.PDFWorker=PDFWorker;class WorkerTransport{#l=new Map;#c=new Map;#h=new Map;constructor(e,t,i,n,s){this.messageHandler=e,this.loadingTask=t,this.commonObjs=new PDFObjects,this.fontLoader=new _font_loader.FontLoader({ownerDocument:n.ownerDocument,styleElement:n.styleElement}),this._params=n,this.canvasFactory=s.canvasFactory,this.filterFactory=s.filterFactory,this.cMapReaderFactory=s.cMapReaderFactory,this.standardFontDataFactory=s.standardFontDataFactory,this.destroyed=!1,this.destroyCapability=null,this._passwordCapability=null,this._networkStream=i,this._fullReader=null,this._lastProgress=null,this.downloadInfoCapability=(0,_util.createPromiseCapability)(),this.setupMessageHandler()}#d(e,t=null){const i=this.#l.get(e);if(i)return i;const n=this.messageHandler.sendWithPromise(e,t);return this.#l.set(e,n),n}get annotationStorage(){return(0,_util.shadow)(this,"annotationStorage",new _annotation_storage.AnnotationStorage)}getRenderingIntent(e,t=_util.AnnotationMode.ENABLE,i=null,n=!1){let s=_util.RenderingIntentFlag.DISPLAY,r=null;switch(e){case"any":s=_util.RenderingIntentFlag.ANY;break;case"display":break;case"print":s=_util.RenderingIntentFlag.PRINT;break;default:(0,_util.warn)(`getRenderingIntent - invalid intent: ${e}`)}switch(t){case _util.AnnotationMode.DISABLE:s+=_util.RenderingIntentFlag.ANNOTATIONS_DISABLE;break;case _util.AnnotationMode.ENABLE:break;case _util.AnnotationMode.ENABLE_FORMS:s+=_util.RenderingIntentFlag.ANNOTATIONS_FORMS;break;case _util.AnnotationMode.ENABLE_STORAGE:s+=_util.RenderingIntentFlag.ANNOTATIONS_STORAGE,r=(s&_util.RenderingIntentFlag.PRINT&&i instanceof _annotation_storage.PrintAnnotationStorage?i:this.annotationStorage).serializable;break;default:(0,_util.warn)(`getRenderingIntent - invalid annotationMode: ${t}`)}return n&&(s+=_util.RenderingIntentFlag.OPLIST),{renderingIntent:s,cacheKey:`${s}_${_annotation_storage.AnnotationStorage.getHash(r)}`,annotationStorageMap:r}}destroy(){if(this.destroyCapability)return this.destroyCapability.promise;this.destroyed=!0,this.destroyCapability=(0,_util.createPromiseCapability)(),this._passwordCapability&&this._passwordCapability.reject(new Error("Worker was destroyed during onPassword callback"));const e=[];for(const t of this.#c.values())e.push(t._destroy());this.#c.clear(),this.#h.clear(),this.hasOwnProperty("annotationStorage")&&this.annotationStorage.resetModified();const t=this.messageHandler.sendWithPromise("Terminate",null);return e.push(t),Promise.all(e).then((()=>{this.commonObjs.clear(),this.fontLoader.clear(),this.#l.clear(),this.filterFactory.destroy(),this._networkStream&&this._networkStream.cancelAllRequests(new _util.AbortException("Worker was terminated.")),this.messageHandler&&(this.messageHandler.destroy(),this.messageHandler=null),this.destroyCapability.resolve()}),this.destroyCapability.reject),this.destroyCapability.promise}setupMessageHandler(){const{messageHandler:e,loadingTask:t}=this;e.on("GetReader",((e,t)=>{(0,_util.assert)(this._networkStream,"GetReader - no `IPDFStream` instance available."),this._fullReader=this._networkStream.getFullReader(),this._fullReader.onProgress=e=>{this._lastProgress={loaded:e.loaded,total:e.total}},t.onPull=()=>{this._fullReader.read().then((function({value:e,done:i}){i?t.close():((0,_util.assert)(e instanceof ArrayBuffer,"GetReader - expected an ArrayBuffer."),t.enqueue(new Uint8Array(e),1,[e]))})).catch((e=>{t.error(e)}))},t.onCancel=e=>{this._fullReader.cancel(e),t.ready.catch((e=>{if(!this.destroyed)throw e}))}})),e.on("ReaderHeadersReady",(e=>{const i=(0,_util.createPromiseCapability)(),n=this._fullReader;return n.headersReady.then((()=>{n.isStreamingSupported&&n.isRangeSupported||(this._lastProgress&&t.onProgress?.(this._lastProgress),n.onProgress=e=>{t.onProgress?.({loaded:e.loaded,total:e.total})}),i.resolve({isStreamingSupported:n.isStreamingSupported,isRangeSupported:n.isRangeSupported,contentLength:n.contentLength})}),i.reject),i.promise})),e.on("GetRangeReader",((e,t)=>{(0,_util.assert)(this._networkStream,"GetRangeReader - no `IPDFStream` instance available.");const i=this._networkStream.getRangeReader(e.begin,e.end);i?(t.onPull=()=>{i.read().then((function({value:e,done:i}){i?t.close():((0,_util.assert)(e instanceof ArrayBuffer,"GetRangeReader - expected an ArrayBuffer."),t.enqueue(new Uint8Array(e),1,[e]))})).catch((e=>{t.error(e)}))},t.onCancel=e=>{i.cancel(e),t.ready.catch((e=>{if(!this.destroyed)throw e}))}):t.close()})),e.on("GetDoc",(({pdfInfo:e})=>{this._numPages=e.numPages,this._htmlForXfa=e.htmlForXfa,delete e.htmlForXfa,t._capability.resolve(new PDFDocumentProxy(e,this))})),e.on("DocException",(function(e){let i;switch(e.name){case"PasswordException":i=new _util.PasswordException(e.message,e.code);break;case"InvalidPDFException":i=new _util.InvalidPDFException(e.message);break;case"MissingPDFException":i=new _util.MissingPDFException(e.message);break;case"UnexpectedResponseException":i=new _util.UnexpectedResponseException(e.message,e.status);break;case"UnknownErrorException":i=new _util.UnknownErrorException(e.message,e.details);break;default:(0,_util.unreachable)("DocException - expected a valid Error.")}t._capability.reject(i)})),e.on("PasswordRequest",(e=>{if(this._passwordCapability=(0,_util.createPromiseCapability)(),t.onPassword){const i=e=>{e instanceof Error?this._passwordCapability.reject(e):this._passwordCapability.resolve({password:e})};try{t.onPassword(i,e.code)}catch(e){this._passwordCapability.reject(e)}}else this._passwordCapability.reject(new _util.PasswordException(e.message,e.code));return this._passwordCapability.promise})),e.on("DataLoaded",(e=>{t.onProgress?.({loaded:e.length,total:e.length}),this.downloadInfoCapability.resolve(e)})),e.on("StartRenderPage",(e=>{this.destroyed||this.#c.get(e.pageIndex)._startRenderPage(e.transparency,e.cacheKey)})),e.on("commonobj",(([t,i,n])=>{if(!this.destroyed&&!this.commonObjs.has(t))switch(i){case"Font":const s=this._params;if("error"in n){const e=n.error;(0,_util.warn)(`Error during font loading: ${e}`),this.commonObjs.resolve(t,e);break}const r=s.pdfBug&&globalThis.FontInspector?.enabled?(e,t)=>globalThis.FontInspector.fontAdded(e,t):null,a=new _font_loader.FontFaceObject(n,{isEvalSupported:s.isEvalSupported,disableFontFace:s.disableFontFace,ignoreErrors:s.ignoreErrors,inspectFont:r});this.fontLoader.bind(a).catch((i=>e.sendWithPromise("FontFallback",{id:t}))).finally((()=>{!s.fontExtraProperties&&a.data&&(a.data=null),this.commonObjs.resolve(t,a)}));break;case"FontPath":case"Image":case"Pattern":this.commonObjs.resolve(t,n);break;default:throw new Error(`Got unknown common object type ${i}`)}})),e.on("obj",(([e,t,i,n])=>{if(this.destroyed)return;const s=this.#c.get(t);if(!s.objs.has(e))switch(i){case"Image":if(s.objs.resolve(e,n),n){let e;if(n.bitmap){const{width:t,height:i}=n;e=t*i*4}else e=n.data?.length||0;e>_util.MAX_IMAGE_SIZE_TO_CACHE&&(s._maybeCleanupAfterRender=!0)}break;case"Pattern":s.objs.resolve(e,n);break;default:throw new Error(`Got unknown object type ${i}`)}})),e.on("DocProgress",(e=>{this.destroyed||t.onProgress?.({loaded:e.loaded,total:e.total})})),e.on("FetchBuiltInCMap",(e=>this.destroyed?Promise.reject(new Error("Worker was destroyed.")):this.cMapReaderFactory?this.cMapReaderFactory.fetch(e):Promise.reject(new Error("CMapReaderFactory not initialized, see the `useWorkerFetch` parameter.")))),e.on("FetchStandardFontData",(e=>this.destroyed?Promise.reject(new Error("Worker was destroyed.")):this.standardFontDataFactory?this.standardFontDataFactory.fetch(e):Promise.reject(new Error("StandardFontDataFactory not initialized, see the `useWorkerFetch` parameter."))))}getData(){return this.messageHandler.sendWithPromise("GetData",null)}saveDocument(){return this.annotationStorage.size<=0&&(0,_util.warn)("saveDocument called while `annotationStorage` is empty, please use the getData-method instead."),this.messageHandler.sendWithPromise("SaveDocument",{isPureXfa:!!this._htmlForXfa,numPages:this._numPages,annotationStorage:this.annotationStorage.serializable,filename:this._fullReader?.filename??null}).finally((()=>{this.annotationStorage.resetModified()}))}getPage(e){if(!Number.isInteger(e)||e<=0||e>this._numPages)return Promise.reject(new Error("Invalid page request."));const t=e-1,i=this.#h.get(t);if(i)return i;const n=this.messageHandler.sendWithPromise("GetPage",{pageIndex:t}).then((e=>{if(this.destroyed)throw new Error("Transport destroyed");const i=new PDFPageProxy(t,e,this,this._params.pdfBug);return this.#c.set(t,i),i}));return this.#h.set(t,n),n}getPageIndex(e){return"object"!=typeof e||null===e||!Number.isInteger(e.num)||e.num<0||!Number.isInteger(e.gen)||e.gen<0?Promise.reject(new Error("Invalid pageIndex request.")):this.messageHandler.sendWithPromise("GetPageIndex",{num:e.num,gen:e.gen})}getAnnotations(e,t){return this.messageHandler.sendWithPromise("GetAnnotations",{pageIndex:e,intent:t})}getFieldObjects(){return this.#d("GetFieldObjects")}hasJSActions(){return this.#d("HasJSActions")}getCalculationOrderIds(){return this.messageHandler.sendWithPromise("GetCalculationOrderIds",null)}getDestinations(){return this.messageHandler.sendWithPromise("GetDestinations",null)}getDestination(e){return"string"!=typeof e?Promise.reject(new Error("Invalid destination request.")):this.messageHandler.sendWithPromise("GetDestination",{id:e})}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(e){return this.messageHandler.sendWithPromise("GetPageJSActions",{pageIndex:e})}getStructTree(e){return this.messageHandler.sendWithPromise("GetStructTree",{pageIndex:e})}getOutline(){return this.messageHandler.sendWithPromise("GetOutline",null)}getOptionalContentConfig(){return this.messageHandler.sendWithPromise("GetOptionalContentConfig",null).then((e=>new _optional_content_config.OptionalContentConfig(e)))}getPermissions(){return this.messageHandler.sendWithPromise("GetPermissions",null)}getMetadata(){const e="GetMetadata",t=this.#l.get(e);if(t)return t;const i=this.messageHandler.sendWithPromise(e,null).then((e=>({info:e[0],metadata:e[1]?new _metadata.Metadata(e[1]):null,contentDispositionFilename:this._fullReader?.filename??null,contentLength:this._fullReader?.contentLength??null})));return this.#l.set(e,i),i}getMarkInfo(){return this.messageHandler.sendWithPromise("GetMarkInfo",null)}async startCleanup(e=!1){if(!this.destroyed){await this.messageHandler.sendWithPromise("Cleanup",null);for(const e of this.#c.values())if(!e.cleanup())throw new Error(`startCleanup: Page ${e.pageNumber} is currently rendering.`);this.commonObjs.clear(),e||this.fontLoader.clear(),this.#l.clear(),this.filterFactory.destroy(!0)}}get loadingParams(){const{disableAutoFetch:e,enableXfa:t}=this._params;return(0,_util.shadow)(this,"loadingParams",{disableAutoFetch:e,enableXfa:t})}}class PDFObjects{#u=Object.create(null);#p(e){const t=this.#u[e];return t||(this.#u[e]={capability:(0,_util.createPromiseCapability)(),data:null})}get(e,t=null){if(t){const i=this.#p(e);return i.capability.promise.then((()=>t(i.data))),null}const i=this.#u[e];if(!i?.capability.settled)throw new Error(`Requesting object that isn't resolved yet ${e}.`);return i.data}has(e){const t=this.#u[e];return t?.capability.settled||!1}resolve(e,t=null){const i=this.#p(e);i.data=t,i.capability.resolve()}clear(){for(const e in this.#u){const{data:t}=this.#u[e];t?.bitmap?.close()}this.#u=Object.create(null)}}class RenderTask{#g=null;constructor(e){this.#g=e,this.onContinue=null}get promise(){return this.#g.capability.promise}cancel(e=0){this.#g.cancel(null,e)}get separateAnnots(){const{separateAnnots:e}=this.#g.operatorList;if(!e)return!1;const{annotationCanvasMap:t}=this.#g;return e.form||e.canvas&&t?.size>0}}exports.RenderTask=RenderTask;class InternalRenderTask{static#f=new WeakSet;constructor({callback:e,params:t,objs:i,commonObjs:n,annotationCanvasMap:s,operatorList:r,pageIndex:a,canvasFactory:o,filterFactory:l,useRequestAnimationFrame:c=!1,pdfBug:h=!1,pageColors:d=null}){this.callback=e,this.params=t,this.objs=i,this.commonObjs=n,this.annotationCanvasMap=s,this.operatorListIdx=null,this.operatorList=r,this._pageIndex=a,this.canvasFactory=o,this.filterFactory=l,this._pdfBug=h,this.pageColors=d,this.running=!1,this.graphicsReadyCallback=null,this.graphicsReady=!1,this._useRequestAnimationFrame=!0===c&&"undefined"!=typeof window,this.cancelled=!1,this.capability=(0,_util.createPromiseCapability)(),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=t.canvasContext.canvas}get completed(){return this.capability.promise.catch((function(){}))}initializeGraphics({transparency:e=!1,optionalContentConfig:t}){if(this.cancelled)return;if(this._canvas){if(InternalRenderTask.#f.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.#f.add(this._canvas)}this._pdfBug&&globalThis.StepperManager?.enabled&&(this.stepper=globalThis.StepperManager.create(this._pageIndex),this.stepper.init(this.operatorList),this.stepper.nextBreakPoint=this.stepper.getNextBreakPoint());const{canvasContext:i,viewport:n,transform:s,background:r}=this.params;this.gfx=new _canvas.CanvasGraphics(i,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:t},this.annotationCanvasMap),this.gfx.beginDrawing({transform:s,viewport:n,transparency:e,background:r}),this.operatorListIdx=0,this.graphicsReady=!0,this.graphicsReadyCallback?.()}cancel(e=null,t=0){this.running=!1,this.cancelled=!0,this.gfx?.endDrawing(this.pageColors),this._canvas&&InternalRenderTask.#f.delete(this._canvas),this.callback(e||new _display_utils.RenderingCancelledException(`Rendering cancelled, page ${this._pageIndex+1}`,"canvas",t))}operatorListChanged(){this.graphicsReady?(this.stepper?.updateOperatorList(this.operatorList),this.running||this._continue()):this.graphicsReadyCallback||(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(){this.cancelled||(this.operatorListIdx=this.gfx.executeOperatorList(this.operatorList,this.operatorListIdx,this._continueBound,this.stepper),this.operatorListIdx===this.operatorList.argsArray.length&&(this.running=!1,this.operatorList.lastChunk&&(this.gfx.endDrawing(this.pageColors),this._canvas&&InternalRenderTask.#f.delete(this._canvas),this.callback())))}}const version="3.5.141";exports.version=version;const build="be0f6ee08";exports.build=build},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PrintAnnotationStorage=t.AnnotationStorage=void 0;var n=i(1),s=i(4),r=i(8);class a{#m=!1;#_=new Map;constructor(){this.onSetModified=null,this.onResetModified=null,this.onAnnotationEditor=null}getValue(e,t){const i=this.#_.get(e);return void 0===i?t:Object.assign(t,i)}getRawValue(e){return this.#_.get(e)}remove(e){if(this.#_.delete(e),0===this.#_.size&&this.resetModified(),"function"==typeof this.onAnnotationEditor){for(const e of this.#_.values())if(e instanceof s.AnnotationEditor)return;this.onAnnotationEditor(null)}}setValue(e,t){const i=this.#_.get(e);let n=!1;if(void 0!==i)for(const[e,s]of Object.entries(t))i[e]!==s&&(n=!0,i[e]=s);else n=!0,this.#_.set(e,t);n&&this.#v(),t instanceof s.AnnotationEditor&&"function"==typeof this.onAnnotationEditor&&this.onAnnotationEditor(t.constructor._type)}has(e){return this.#_.has(e)}getAll(){return this.#_.size>0?(0,n.objectFromMap)(this.#_):null}setAll(e){for(const[t,i]of Object.entries(e))this.setValue(t,i)}get size(){return this.#_.size}#v(){this.#m||(this.#m=!0,"function"==typeof this.onSetModified&&this.onSetModified())}resetModified(){this.#m&&(this.#m=!1,"function"==typeof this.onResetModified&&this.onResetModified())}get print(){return new o(this)}get serializable(){if(0===this.#_.size)return null;const e=new Map;for(const[t,i]of this.#_){const n=i instanceof s.AnnotationEditor?i.serialize():i;n&&e.set(t,n)}return e}static getHash(e){if(!e)return"";const t=new r.MurmurHash3_64;for(const[i,n]of e)t.update(`${i}:${JSON.stringify(n)}`);return t.hexdigest()}}t.AnnotationStorage=a;class o extends a{#b=null;constructor(e){super(),this.#b=structuredClone(e.serializable)}get print(){(0,n.unreachable)("Should not call PrintAnnotationStorage.print")}get serializable(){return this.#b}}t.PrintAnnotationStorage=o},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.AnnotationEditor=void 0;var n=i(5),s=i(1);class r{#y=this.focusin.bind(this);#S=this.focusout.bind(this);#P=!1;#A=!1;#w=!1;_uiManager=null;#E=r._zIndex++;static _colorManager=new n.ColorManager;static _zIndex=1;constructor(e){this.constructor===r&&(0,s.unreachable)("Cannot initialize AnnotationEditor."),this.parent=e.parent,this.id=e.id,this.width=this.height=null,this.pageIndex=e.parent.pageIndex,this.name=e.name,this.div=null,this._uiManager=e.uiManager;const{rotation:t,rawDims:{pageWidth:i,pageHeight:n,pageX:a,pageY:o}}=this.parent.viewport;this.rotation=t,this.pageDimensions=[i,n],this.pageTranslation=[a,o];const[l,c]=this.parentDimensions;this.x=e.x/l,this.y=e.y/c,this.isAttachedToDOM=!1}static get _defaultLineColor(){return(0,s.shadow)(this,"_defaultLineColor",this._colorManager.getHexCode("CanvasText"))}addCommands(e){this._uiManager.addCommands(e)}get currentLayer(){return this._uiManager.currentLayer}setInBackground(){this.div.style.zIndex=0}setInForeground(){this.div.style.zIndex=this.#E}setParent(e){null!==e&&(this.pageIndex=e.pageIndex,this.pageDimensions=e.pageDimensions),this.parent=e}focusin(e){this.#P?this.#P=!1:this.parent.setSelected(this)}focusout(e){if(!this.isAttachedToDOM)return;const t=e.relatedTarget;t?.closest(`#${this.id}`)||(e.preventDefault(),this.parent?.isMultipleSelection||this.commitOrRemove())}commitOrRemove(){this.isEmpty()?this.remove():this.commit()}commit(){this.addToAnnotationStorage()}addToAnnotationStorage(){this._uiManager.addToAnnotationStorage(this)}dragstart(e){const t=this.parent.div.getBoundingClientRect();this.startX=e.clientX-t.x,this.startY=e.clientY-t.y,e.dataTransfer.setData("text/plain",this.id),e.dataTransfer.effectAllowed="move"}setAt(e,t,i,n){const[s,r]=this.parentDimensions;[i,n]=this.screenToPageTranslation(i,n),this.x=(e+i)/s,this.y=(t+n)/r,this.div.style.left=100*this.x+"%",this.div.style.top=100*this.y+"%"}translate(e,t){const[i,n]=this.parentDimensions;[e,t]=this.screenToPageTranslation(e,t),this.x+=e/i,this.y+=t/n,this.div.style.left=100*this.x+"%",this.div.style.top=100*this.y+"%"}screenToPageTranslation(e,t){switch(this.parentRotation){case 90:return[t,-e];case 180:return[-e,-t];case 270:return[-t,e];default:return[e,t]}}get parentScale(){return this._uiManager.viewParameters.realScale}get parentRotation(){return this._uiManager.viewParameters.rotation}get parentDimensions(){const{realScale:e}=this._uiManager.viewParameters,[t,i]=this.pageDimensions;return[t*e,i*e]}setDims(e,t){const[i,n]=this.parentDimensions;this.div.style.width=100*e/i+"%",this.div.style.height=100*t/n+"%"}fixDims(){const{style:e}=this.div,{height:t,width:i}=e,n=i.endsWith("%"),s=t.endsWith("%");if(n&&s)return;const[r,a]=this.parentDimensions;n||(e.width=100*parseFloat(i)/r+"%"),s||(e.height=100*parseFloat(t)/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.#y),this.div.addEventListener("focusout",this.#S);const[e,t]=this.getInitialTranslation();return this.translate(e,t),(0,n.bindEvents)(this,this.div,["dragstart","pointerdown"]),this.div}pointerdown(e){const{isMac:t}=s.FeatureTest.platform;0!==e.button||e.ctrlKey&&t?e.preventDefault():(e.ctrlKey&&!t||e.shiftKey||e.metaKey&&t?this.parent.toggleSelected(this):this.parent.setSelected(this),this.#P=!0)}getRect(e,t){const i=this.parentScale,[n,s]=this.pageDimensions,[r,a]=this.pageTranslation,o=e/i,l=t/i,c=this.x*n,h=this.y*s,d=this.width*n,u=this.height*s;switch(this.rotation){case 0:return[c+o+r,s-h-l-u+a,c+o+d+r,s-h-l+a];case 90:return[c+l+r,s-h+o+a,c+l+u+r,s-h+o+d+a];case 180:return[c-o-d+r,s-h+l+a,c-o+r,s-h+l+u+a];case 270:return[c-l-u+r,s-h-o-d+a,c-l+r,s-h-o+a];default:throw new Error("Invalid rotation")}}getRectInCurrentCoords(e,t){const[i,n,s,r]=e,a=s-i,o=r-n;switch(this.rotation){case 0:return[i,t-r,a,o];case 90:return[i,t-n,o,a];case 180:return[s,t-n,a,o];case 270:return[s,t-r,o,a];default:throw new Error("Invalid rotation")}}onceAdded(){}isEmpty(){return!1}enableEditMode(){this.#w=!0}disableEditMode(){this.#w=!1}isInEditMode(){return this.#w}shouldGetKeyboardEvents(){return!1}needsToBeRebuilt(){return this.div&&!this.isAttachedToDOM}rebuild(){this.div?.addEventListener("focusin",this.#y)}serialize(){(0,s.unreachable)("An editor must be serializable")}static deserialize(e,t,i){const n=new this.prototype.constructor({parent:t,id:t.getNextId(),uiManager:i});n.rotation=e.rotation;const[s,r]=n.pageDimensions,[a,o,l,c]=n.getRectInCurrentCoords(e.rect,r);return n.x=a/s,n.y=o/r,n.width=l/s,n.height=c/r,n}remove(){this.div.removeEventListener("focusin",this.#y),this.div.removeEventListener("focusout",this.#S),this.isEmpty()||this.commit(),this.parent.remove(this)}select(){this.div?.classList.add("selectedEditor")}unselect(){this.div?.classList.remove("selectedEditor")}updateParams(e,t){}disableEditing(){}enableEditing(){}get propertiesToUpdate(){return{}}get contentDiv(){return this.div}get isEditing(){return this.#A}set isEditing(e){this.#A=e,e?(this.parent.setSelected(this),this.parent.setActiveEditor(this)):this.parent.setActiveEditor(null)}}t.AnnotationEditor=r},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.KeyboardManager=t.CommandManager=t.ColorManager=t.AnnotationEditorUIManager=void 0,t.bindEvents=function(e,t,i){for(const n of i)t.addEventListener(n,e[n].bind(e))},t.opacityToHex=function(e){return Math.round(Math.min(255,Math.max(1,255*e))).toString(16).padStart(2,"0")};var n=i(1),s=i(6);class r{#C=0;getId(){return`${n.AnnotationEditorPrefix}${this.#C++}`}}class a{#x=[];#M=!1;#T;#F=-1;constructor(e=128){this.#T=e}add({cmd:e,undo:t,mustExec:i,type:n=NaN,overwriteIfSameType:s=!1,keepUndo:r=!1}){if(i&&e(),this.#M)return;const a={cmd:e,undo:t,type:n};if(-1===this.#F)return this.#x.length>0&&(this.#x.length=0),this.#F=0,void this.#x.push(a);if(s&&this.#x[this.#F].type===n)return r&&(a.undo=this.#x[this.#F].undo),void(this.#x[this.#F]=a);const o=this.#F+1;o===this.#T?this.#x.splice(0,1):(this.#F=o,o<this.#x.length&&this.#x.splice(o)),this.#x.push(a)}undo(){-1!==this.#F&&(this.#M=!0,this.#x[this.#F].undo(),this.#M=!1,this.#F-=1)}redo(){this.#F<this.#x.length-1&&(this.#F+=1,this.#M=!0,this.#x[this.#F].cmd(),this.#M=!1)}hasSomethingToUndo(){return-1!==this.#F}hasSomethingToRedo(){return this.#F<this.#x.length-1}destroy(){this.#x=null}}t.CommandManager=a;class o{constructor(e){this.buffer=[],this.callbacks=new Map,this.allKeys=new Set;const{isMac:t}=n.FeatureTest.platform;for(const[i,n]of e)for(const e of i){const i=e.startsWith("mac+");t&&i?(this.callbacks.set(e.slice(4),n),this.allKeys.add(e.split("+").at(-1))):t||i||(this.callbacks.set(e,n),this.allKeys.add(e.split("+").at(-1)))}}#D(e){e.altKey&&this.buffer.push("alt"),e.ctrlKey&&this.buffer.push("ctrl"),e.metaKey&&this.buffer.push("meta"),e.shiftKey&&this.buffer.push("shift"),this.buffer.push(e.key);const t=this.buffer.join("+");return this.buffer.length=0,t}exec(e,t){if(!this.allKeys.has(t.key))return;const i=this.callbacks.get(this.#D(t));i&&(i.bind(e)(),t.stopPropagation(),t.preventDefault())}}t.KeyboardManager=o;class l{static _colorsMapping=new Map([["CanvasText",[0,0,0]],["Canvas",[255,255,255]]]);get _colors(){const e=new Map([["CanvasText",null],["Canvas",null]]);return(0,s.getColorValues)(e),(0,n.shadow)(this,"_colors",e)}convert(e){const t=(0,s.getRGB)(e);if(!window.matchMedia("(forced-colors: active)").matches)return t;for(const[e,i]of this._colors)if(i.every(((e,i)=>e===t[i])))return l._colorsMapping.get(e);return t}getHexCode(e){const t=this._colors.get(e);return t?n.Util.makeHexColor(...t):e}}t.ColorManager=l;class c{#k=null;#R=new Map;#L=new Map;#I=null;#O=new a;#N=0;#V=null;#B=new Set;#U=null;#j=new r;#H=!1;#W=n.AnnotationEditorType.NONE;#G=new Set;#z=this.copy.bind(this);#q=this.cut.bind(this);#$=this.paste.bind(this);#X=this.keydown.bind(this);#K=this.onEditingAction.bind(this);#Y=this.onPageChanging.bind(this);#Q=this.onScaleChanging.bind(this);#J=this.onRotationChanging.bind(this);#Z={isEditing:!1,isEmpty:!0,hasSomethingToUndo:!1,hasSomethingToRedo:!1,hasSelectedEditor:!1};#ee=null;static _keyboardManager=new o([[["ctrl+a","mac+meta+a"],c.prototype.selectAll],[["ctrl+z","mac+meta+z"],c.prototype.undo],[["ctrl+y","ctrl+shift+Z","mac+meta+shift+Z"],c.prototype.redo],[["Backspace","alt+Backspace","ctrl+Backspace","shift+Backspace","mac+Backspace","mac+alt+Backspace","mac+ctrl+Backspace","Delete","ctrl+Delete","shift+Delete"],c.prototype.delete],[["Escape","mac+Escape"],c.prototype.unselectAll]]);constructor(e,t,i){this.#ee=e,this.#U=t,this.#U._on("editingaction",this.#K),this.#U._on("pagechanging",this.#Y),this.#U._on("scalechanging",this.#Q),this.#U._on("rotationchanging",this.#J),this.#I=i,this.viewParameters={realScale:s.PixelsPerInch.PDF_TO_CSS_UNITS,rotation:0}}destroy(){this.#te(),this.#U._off("editingaction",this.#K),this.#U._off("pagechanging",this.#Y),this.#U._off("scalechanging",this.#Q),this.#U._off("rotationchanging",this.#J);for(const e of this.#L.values())e.destroy();this.#L.clear(),this.#R.clear(),this.#B.clear(),this.#k=null,this.#G.clear(),this.#O.destroy()}onPageChanging({pageNumber:e}){this.#N=e-1}focusMainContainer(){this.#ee.focus()}addShouldRescale(e){this.#B.add(e)}removeShouldRescale(e){this.#B.delete(e)}onScaleChanging({scale:e}){this.commitOrRemove(),this.viewParameters.realScale=e*s.PixelsPerInch.PDF_TO_CSS_UNITS;for(const e of this.#B)e.onScaleChanging()}onRotationChanging({pagesRotation:e}){this.commitOrRemove(),this.viewParameters.rotation=e}addToAnnotationStorage(e){e.isEmpty()||!this.#I||this.#I.has(e.id)||this.#I.setValue(e.id,e)}#ie(){this.#ee.addEventListener("keydown",this.#X)}#te(){this.#ee.removeEventListener("keydown",this.#X)}#ne(){document.addEventListener("copy",this.#z),document.addEventListener("cut",this.#q),document.addEventListener("paste",this.#$)}#se(){document.removeEventListener("copy",this.#z),document.removeEventListener("cut",this.#q),document.removeEventListener("paste",this.#$)}copy(e){if(e.preventDefault(),this.#k&&this.#k.commitOrRemove(),!this.hasSelection)return;const t=[];for(const e of this.#G)e.isEmpty()||t.push(e.serialize());0!==t.length&&e.clipboardData.setData("application/pdfjs",JSON.stringify(t))}cut(e){this.copy(e),this.delete()}paste(e){e.preventDefault();let t=e.clipboardData.getData("application/pdfjs");if(!t)return;try{t=JSON.parse(t)}catch(e){return void(0,n.warn)(`paste: "${e.message}".`)}if(!Array.isArray(t))return;this.unselectAll();const i=this.#L.get(this.#N);try{const e=[];for(const n of t){const t=i.deserialize(n);if(!t)return;e.push(t)}const n=()=>{for(const t of e)this.#re(t);this.#ae(e)},s=()=>{for(const t of e)t.remove()};this.addCommands({cmd:n,undo:s,mustExec:!0})}catch(e){(0,n.warn)(`paste: "${e.message}".`)}}keydown(e){this.getActive()?.shouldGetKeyboardEvents()||c._keyboardManager.exec(this,e)}onEditingAction(e){["undo","redo","delete","selectAll"].includes(e.name)&&this[e.name]()}#oe(e){Object.entries(e).some((([e,t])=>this.#Z[e]!==t))&&this.#U.dispatch("annotationeditorstateschanged",{source:this,details:Object.assign(this.#Z,e)})}#le(e){this.#U.dispatch("annotationeditorparamschanged",{source:this,details:e})}setEditingState(e){e?(this.#ie(),this.#ne(),this.#oe({isEditing:this.#W!==n.AnnotationEditorType.NONE,isEmpty:this.#ce(),hasSomethingToUndo:this.#O.hasSomethingToUndo(),hasSomethingToRedo:this.#O.hasSomethingToRedo(),hasSelectedEditor:!1})):(this.#te(),this.#se(),this.#oe({isEditing:!1}))}registerEditorTypes(e){if(!this.#V){this.#V=e;for(const e of this.#V)this.#le(e.defaultPropertiesToUpdate)}}getId(){return this.#j.getId()}get currentLayer(){return this.#L.get(this.#N)}get currentPageIndex(){return this.#N}addLayer(e){this.#L.set(e.pageIndex,e),this.#H?e.enable():e.disable()}removeLayer(e){this.#L.delete(e.pageIndex)}updateMode(e){if(this.#W=e,e===n.AnnotationEditorType.NONE)this.setEditingState(!1),this.#he();else{this.setEditingState(!0),this.#de();for(const t of this.#L.values())t.updateMode(e)}}updateToolbar(e){e!==this.#W&&this.#U.dispatch("switchannotationeditormode",{source:this,mode:e})}updateParams(e,t){if(this.#V){for(const i of this.#G)i.updateParams(e,t);for(const i of this.#V)i.updateDefaultParams(e,t)}}#de(){if(!this.#H){this.#H=!0;for(const e of this.#L.values())e.enable()}}#he(){if(this.unselectAll(),this.#H){this.#H=!1;for(const e of this.#L.values())e.disable()}}getEditors(e){const t=[];for(const i of this.#R.values())i.pageIndex===e&&t.push(i);return t}getEditor(e){return this.#R.get(e)}addEditor(e){this.#R.set(e.id,e)}removeEditor(e){this.#R.delete(e.id),this.unselect(e),this.#I?.remove(e.id)}#re(e){const t=this.#L.get(e.pageIndex);t?t.addOrRebuild(e):this.addEditor(e)}setActiveEditor(e){this.#k!==e&&(this.#k=e,e&&this.#le(e.propertiesToUpdate))}toggleSelected(e){if(this.#G.has(e))return this.#G.delete(e),e.unselect(),void this.#oe({hasSelectedEditor:this.hasSelection});this.#G.add(e),e.select(),this.#le(e.propertiesToUpdate),this.#oe({hasSelectedEditor:!0})}setSelected(e){for(const t of this.#G)t!==e&&t.unselect();this.#G.clear(),this.#G.add(e),e.select(),this.#le(e.propertiesToUpdate),this.#oe({hasSelectedEditor:!0})}isSelected(e){return this.#G.has(e)}unselect(e){e.unselect(),this.#G.delete(e),this.#oe({hasSelectedEditor:this.hasSelection})}get hasSelection(){return 0!==this.#G.size}undo(){this.#O.undo(),this.#oe({hasSomethingToUndo:this.#O.hasSomethingToUndo(),hasSomethingToRedo:!0,isEmpty:this.#ce()})}redo(){this.#O.redo(),this.#oe({hasSomethingToUndo:!0,hasSomethingToRedo:this.#O.hasSomethingToRedo(),isEmpty:this.#ce()})}addCommands(e){this.#O.add(e),this.#oe({hasSomethingToUndo:!0,hasSomethingToRedo:!1,isEmpty:this.#ce()})}#ce(){if(0===this.#R.size)return!0;if(1===this.#R.size)for(const e of this.#R.values())return e.isEmpty();return!1}delete(){if(this.commitOrRemove(),!this.hasSelection)return;const e=[...this.#G];this.addCommands({cmd:()=>{for(const t of e)t.remove()},undo:()=>{for(const t of e)this.#re(t)},mustExec:!0})}commitOrRemove(){this.#k?.commitOrRemove()}#ae(e){this.#G.clear();for(const t of e)t.isEmpty()||(this.#G.add(t),t.select());this.#oe({hasSelectedEditor:!0})}selectAll(){for(const e of this.#G)e.commit();this.#ae(this.#R.values())}unselectAll(){if(this.#k)this.#k.commitOrRemove();else if(0!==this.#G.size){for(const e of this.#G)e.unselect();this.#G.clear(),this.#oe({hasSelectedEditor:!1})}}isActive(e){return this.#k===e}getActive(){return this.#k}getMode(){return this.#W}}t.AnnotationEditorUIManager=c},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.StatTimer=t.RenderingCancelledException=t.PixelsPerInch=t.PageViewport=t.PDFDateString=t.DOMStandardFontDataFactory=t.DOMSVGFactory=t.DOMFilterFactory=t.DOMCanvasFactory=t.DOMCMapReaderFactory=t.AnnotationPrefix=void 0,t.deprecated=function(e){console.log("Deprecated API usage: "+e)},t.getColorValues=function(e){const t=document.createElement("span");t.style.visibility="hidden",document.body.append(t);for(const i of e.keys()){t.style.color=i;const n=window.getComputedStyle(t).color;e.set(i,v(n))}t.remove()},t.getCurrentTransform=function(e){const{a:t,b:i,c:n,d:s,e:r,f:a}=e.getTransform();return[t,i,n,s,r,a]},t.getCurrentTransformInverse=function(e){const{a:t,b:i,c:n,d:s,e:r,f:a}=e.getTransform().invertSelf();return[t,i,n,s,r,a]},t.getFilenameFromUrl=function(e,t=!1){return t||([e]=e.split(/[#?]/,1)),e.substring(e.lastIndexOf("/")+1)},t.getPdfFilenameFromUrl=function(e,t="document.pdf"){if("string"!=typeof e)return t;if(f(e))return(0,s.warn)('getPdfFilenameFromUrl: ignore "data:"-URL for performance reasons.'),t;const i=/[^/?#=]+\.pdf\b(?!.*\.pdf\b)/i,n=/^(?:(?:[^:]+:)?\/\/[^/]+)?([^?#]*)(\?[^#]*)?(#.*)?$/.exec(e);let r=i.exec(n[1])||i.exec(n[2])||i.exec(n[3]);if(r&&(r=r[0],r.includes("%")))try{r=i.exec(decodeURIComponent(r))[0]}catch(e){}return r||t},t.getRGB=v,t.getXfaPageViewport=function(e,{scale:t=1,rotation:i=0}){const{width:n,height:s}=e.attributes.style,r=[0,0,parseInt(n),parseInt(s)];return new p({viewBox:r,scale:t,rotation:i})},t.isDataScheme=f,t.isPdfFile=function(e){return"string"==typeof e&&/\.pdf$/i.test(e)},t.isValidFetchUrl=m,t.loadScript=function(e,t=!1){return new Promise(((i,n)=>{const s=document.createElement("script");s.src=e,s.onload=function(e){t&&s.remove(),i(e)},s.onerror=function(){n(new Error(`Cannot load script at: ${s.src}`))},(document.head||document.documentElement).append(s)}))},t.setLayerDimensions=function(e,t,i=!1,n=!0){if(t instanceof p){const{pageWidth:n,pageHeight:s}=t.rawDims,{style:r}=e,a=`calc(var(--scale-factor) * ${n}px)`,o=`calc(var(--scale-factor) * ${s}px)`;i&&t.rotation%180!=0?(r.width=o,r.height=a):(r.width=a,r.height=o)}n&&e.setAttribute("data-main-rotation",t.rotation)};var n=i(7),s=i(1);const r="http://www.w3.org/2000/svg";t.AnnotationPrefix="pdfjs_internal_id_";class a{static CSS=96;static PDF=72;static PDF_TO_CSS_UNITS=this.CSS/this.PDF}t.PixelsPerInch=a;class o extends n.BaseFilterFactory{#ue;#pe;#e;#ge;#fe;#me;#_e;#C=0;constructor({docId:e,ownerDocument:t=globalThis.document}={}){super(),this.#e=e,this.#ge=t}get#ve(){return this.#ue||=new Map}get#be(){if(!this.#pe){const e=this.#ge.createElement("div"),{style:t}=e;t.visibility="hidden",t.contain="strict",t.width=t.height=0,t.position="absolute",t.top=t.left=0,t.zIndex=-1;const i=this.#ge.createElementNS(r,"svg");i.setAttribute("width",0),i.setAttribute("height",0),this.#pe=this.#ge.createElementNS(r,"defs"),e.append(i),i.append(this.#pe),this.#ge.body.append(e)}return this.#pe}#ye(e,t,i){const n=this.#ge.createElementNS(r,t);n.setAttribute("type","discrete"),n.setAttribute("tableValues",i),e.append(n)}addFilter(e){if(!e)return"none";let t,i,n,s,a=this.#ve.get(e);if(a)return a;if(1===e.length){const r=e[0],a=new Array(256);for(let e=0;e<256;e++)a[e]=r[e]/255;s=t=i=n=a.join(",")}else{const[r,a,o]=e,l=new Array(256),c=new Array(256),h=new Array(256);for(let e=0;e<256;e++)l[e]=r[e]/255,c[e]=a[e]/255,h[e]=o[e]/255;t=l.join(","),i=c.join(","),n=h.join(","),s=`${t}${i}${n}`}if(a=this.#ve.get(s),a)return this.#ve.set(e,a),a;const o=`g_${this.#e}_transfer_map_${this.#C++}`,l=`url(#${o})`;this.#ve.set(e,l),this.#ve.set(s,l);const c=this.#ge.createElementNS(r,"filter",r);c.setAttribute("id",o),c.setAttribute("color-interpolation-filters","sRGB");const h=this.#ge.createElementNS(r,"feComponentTransfer");return c.append(h),this.#ye(h,"feFuncR",t),this.#ye(h,"feFuncG",i),this.#ye(h,"feFuncB",n),this.#be.append(c),l}addHCMFilter(e,t){const i=`${e}-${t}`;if(this.#me===i)return this.#_e;if(this.#me=i,this.#_e="none",this.#fe?.remove(),!e||!t)return this.#_e;this.#be.style.color=e;const n=v(e=getComputedStyle(this.#be).getPropertyValue("color"));e=s.Util.makeHexColor(...n),this.#be.style.color=t;const a=v(t=getComputedStyle(this.#be).getPropertyValue("color"));if(t=s.Util.makeHexColor(...a),this.#be.style.color="","#000000"===e&&"#ffffff"===t||e===t)return this.#_e;const o=new Array(256);for(let e=0;e<=255;e++){const t=e/255;o[e]=t<=.03928?t/12.92:((t+.055)/1.055)**2.4}const l=o.join(","),c=`g_${this.#e}_hcm_filter`,h=this.#fe=this.#ge.createElementNS(r,"filter",r);h.setAttribute("id",c),h.setAttribute("color-interpolation-filters","sRGB");let d=this.#ge.createElementNS(r,"feComponentTransfer");h.append(d),this.#ye(d,"feFuncR",l),this.#ye(d,"feFuncG",l),this.#ye(d,"feFuncB",l);const u=this.#ge.createElementNS(r,"feColorMatrix");u.setAttribute("type","matrix"),u.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(u),d=this.#ge.createElementNS(r,"feComponentTransfer"),h.append(d);const p=(e,t)=>{const i=n[e]/255,s=a[e]/255,r=new Array(t+1);for(let e=0;e<=t;e++)r[e]=i+e/t*(s-i);return r.join(",")};return this.#ye(d,"feFuncR",p(0,5)),this.#ye(d,"feFuncG",p(1,5)),this.#ye(d,"feFuncB",p(2,5)),this.#be.append(h),this.#_e=`url(#${c})`,this.#_e}destroy(e=!1){e&&this.#_e||(this.#pe&&(this.#pe.parentNode.parentNode.remove(),this.#pe=null),this.#ue&&(this.#ue.clear(),this.#ue=null),this.#C=0)}}t.DOMFilterFactory=o;class l extends n.BaseCanvasFactory{constructor({ownerDocument:e=globalThis.document}={}){super(),this._document=e}_createCanvas(e,t){const i=this._document.createElement("canvas");return i.width=e,i.height=t,i}}async function c(e,t=!1){if(m(e,document.baseURI)){const i=await fetch(e);if(!i.ok)throw new Error(i.statusText);return t?new Uint8Array(await i.arrayBuffer()):(0,s.stringToBytes)(await i.text())}return new Promise(((i,n)=>{const r=new XMLHttpRequest;r.open("GET",e,!0),t&&(r.responseType="arraybuffer"),r.onreadystatechange=()=>{if(r.readyState===XMLHttpRequest.DONE){if(200===r.status||0===r.status){let e;if(t&&r.response?e=new Uint8Array(r.response):!t&&r.responseText&&(e=(0,s.stringToBytes)(r.responseText)),e)return void i(e)}n(new Error(r.statusText))}},r.send(null)}))}t.DOMCanvasFactory=l;class h extends n.BaseCMapReaderFactory{_fetchData(e,t){return c(e,this.isCompressed).then((e=>({cMapData:e,compressionType:t})))}}t.DOMCMapReaderFactory=h;class d extends n.BaseStandardFontDataFactory{_fetchData(e){return c(e,!0)}}t.DOMStandardFontDataFactory=d;class u extends n.BaseSVGFactory{_createSVG(e){return document.createElementNS(r,e)}}t.DOMSVGFactory=u;class p{constructor({viewBox:e,scale:t,rotation:i,offsetX:n=0,offsetY:s=0,dontFlip:r=!1}){this.viewBox=e,this.scale=t,this.rotation=i,this.offsetX=n,this.offsetY=s;const a=(e[2]+e[0])/2,o=(e[3]+e[1])/2;let l,c,h,d,u,p,g,f;switch((i%=360)<0&&(i+=360),i){case 180:l=-1,c=0,h=0,d=1;break;case 90:l=0,c=1,h=1,d=0;break;case 270:l=0,c=-1,h=-1,d=0;break;case 0:l=1,c=0,h=0,d=-1;break;default:throw new Error("PageViewport: Invalid rotation, must be a multiple of 90 degrees.")}r&&(h=-h,d=-d),0===l?(u=Math.abs(o-e[1])*t+n,p=Math.abs(a-e[0])*t+s,g=(e[3]-e[1])*t,f=(e[2]-e[0])*t):(u=Math.abs(a-e[0])*t+n,p=Math.abs(o-e[1])*t+s,g=(e[2]-e[0])*t,f=(e[3]-e[1])*t),this.transform=[l*t,c*t,h*t,d*t,u-l*t*a-h*t*o,p-c*t*a-d*t*o],this.width=g,this.height=f}get rawDims(){const{viewBox:e}=this;return(0,s.shadow)(this,"rawDims",{pageWidth:e[2]-e[0],pageHeight:e[3]-e[1],pageX:e[0],pageY:e[1]})}clone({scale:e=this.scale,rotation:t=this.rotation,offsetX:i=this.offsetX,offsetY:n=this.offsetY,dontFlip:s=!1}={}){return new p({viewBox:this.viewBox.slice(),scale:e,rotation:t,offsetX:i,offsetY:n,dontFlip:s})}convertToViewportPoint(e,t){return s.Util.applyTransform([e,t],this.transform)}convertToViewportRectangle(e){const t=s.Util.applyTransform([e[0],e[1]],this.transform),i=s.Util.applyTransform([e[2],e[3]],this.transform);return[t[0],t[1],i[0],i[1]]}convertToPdfPoint(e,t){return s.Util.applyInverseTransform([e,t],this.transform)}}t.PageViewport=p;class g extends s.BaseException{constructor(e,t,i=0){super(e,"RenderingCancelledException"),this.type=t,this.extraDelay=i}}function f(e){const t=e.length;let i=0;for(;i<t&&""===e[i].trim();)i++;return"data:"===e.substring(i,i+5).toLowerCase()}function m(e,t){try{const{protocol:i}=t?new URL(e,t):new URL(e);return"http:"===i||"https:"===i}catch(e){return!1}}let _;function v(e){if(e.startsWith("#")){const t=parseInt(e.slice(1),16);return[(16711680&t)>>16,(65280&t)>>8,255&t]}return e.startsWith("rgb(")?e.slice(4,-1).split(",").map((e=>parseInt(e))):e.startsWith("rgba(")?e.slice(5,-1).split(",").map((e=>parseInt(e))).slice(0,3):((0,s.warn)(`Not a valid color format: "${e}"`),[0,0,0])}t.RenderingCancelledException=g,t.StatTimer=class{started=Object.create(null);times=[];time(e){e in this.started&&(0,s.warn)(`Timer is already running for ${e}`),this.started[e]=Date.now()}timeEnd(e){e in this.started||(0,s.warn)(`Timer has not been started for ${e}`),this.times.push({name:e,start:this.started[e],end:Date.now()}),delete this.started[e]}toString(){const e=[];let t=0;for(const{name:e}of this.times)t=Math.max(e.length,t);for(const{name:i,start:n,end:s}of this.times)e.push(`${i.padEnd(t)} ${s-n}ms\n`);return e.join("")}},t.PDFDateString=class{static toDateObject(e){if(!e||"string"!=typeof e)return null;_||(_=new RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+|-])?(\\d{2})?'?(\\d{2})?'?"));const t=_.exec(e);if(!t)return null;const i=parseInt(t[1],10);let n=parseInt(t[2],10);n=n>=1&&n<=12?n-1:0;let s=parseInt(t[3],10);s=s>=1&&s<=31?s:1;let r=parseInt(t[4],10);r=r>=0&&r<=23?r:0;let a=parseInt(t[5],10);a=a>=0&&a<=59?a:0;let o=parseInt(t[6],10);o=o>=0&&o<=59?o:0;const l=t[7]||"Z";let c=parseInt(t[8],10);c=c>=0&&c<=23?c:0;let h=parseInt(t[9],10)||0;return h=h>=0&&h<=59?h:0,"-"===l?(r+=c,a+=h):"+"===l&&(r-=c,a-=h),new Date(Date.UTC(i,n,s,r,a,o))}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BaseStandardFontDataFactory=t.BaseSVGFactory=t.BaseFilterFactory=t.BaseCanvasFactory=t.BaseCMapReaderFactory=void 0;var n=i(1);class s{constructor(){this.constructor===s&&(0,n.unreachable)("Cannot initialize BaseFilterFactory.")}addFilter(e){return"none"}addHCMFilter(e,t){return"none"}destroy(e=!1){}}t.BaseFilterFactory=s;class r{constructor(){this.constructor===r&&(0,n.unreachable)("Cannot initialize BaseCanvasFactory.")}create(e,t){if(e<=0||t<=0)throw new Error("Invalid canvas size");const i=this._createCanvas(e,t);return{canvas:i,context:i.getContext("2d")}}reset(e,t,i){if(!e.canvas)throw new Error("Canvas is not specified");if(t<=0||i<=0)throw new Error("Invalid canvas size");e.canvas.width=t,e.canvas.height=i}destroy(e){if(!e.canvas)throw new Error("Canvas is not specified");e.canvas.width=0,e.canvas.height=0,e.canvas=null,e.context=null}_createCanvas(e,t){(0,n.unreachable)("Abstract method `_createCanvas` called.")}}t.BaseCanvasFactory=r;class a{constructor({baseUrl:e=null,isCompressed:t=!0}){this.constructor===a&&(0,n.unreachable)("Cannot initialize BaseCMapReaderFactory."),this.baseUrl=e,this.isCompressed=t}async fetch({name:e}){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 t=this.baseUrl+e+(this.isCompressed?".bcmap":""),i=this.isCompressed?n.CMapCompressionType.BINARY:n.CMapCompressionType.NONE;return this._fetchData(t,i).catch((e=>{throw new Error(`Unable to load ${this.isCompressed?"binary ":""}CMap at: ${t}`)}))}_fetchData(e,t){(0,n.unreachable)("Abstract method `_fetchData` called.")}}t.BaseCMapReaderFactory=a;class o{constructor({baseUrl:e=null}){this.constructor===o&&(0,n.unreachable)("Cannot initialize BaseStandardFontDataFactory."),this.baseUrl=e}async fetch({filename:e}){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 t=`${this.baseUrl}${e}`;return this._fetchData(t).catch((e=>{throw new Error(`Unable to load font data at: ${t}`)}))}_fetchData(e){(0,n.unreachable)("Abstract method `_fetchData` called.")}}t.BaseStandardFontDataFactory=o;class l{constructor(){this.constructor===l&&(0,n.unreachable)("Cannot initialize BaseSVGFactory.")}create(e,t,i=!1){if(e<=0||t<=0)throw new Error("Invalid SVG dimensions");const n=this._createSVG("svg:svg");return n.setAttribute("version","1.1"),i||(n.setAttribute("width",`${e}px`),n.setAttribute("height",`${t}px`)),n.setAttribute("preserveAspectRatio","none"),n.setAttribute("viewBox",`0 0 ${e} ${t}`),n}createElement(e){if("string"!=typeof e)throw new Error("Invalid SVG element type");return this._createSVG(e)}_createSVG(e){(0,n.unreachable)("Abstract method `_createSVG` called.")}}t.BaseSVGFactory=l},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.MurmurHash3_64=void 0;var n=i(1);const s=3285377520,r=4294901760,a=65535;t.MurmurHash3_64=class{constructor(e){this.h1=e?4294967295&e:s,this.h2=e?4294967295&e:s}update(e){let t,i;if("string"==typeof e){t=new Uint8Array(2*e.length),i=0;for(let n=0,s=e.length;n<s;n++){const s=e.charCodeAt(n);s<=255?t[i++]=s:(t[i++]=s>>>8,t[i++]=255&s)}}else{if(!(0,n.isArrayBuffer)(e))throw new Error("Wrong data format in MurmurHash3_64_update. Input must be a string or array.");t=e.slice(),i=t.byteLength}const s=i>>2,o=i-4*s,l=new Uint32Array(t.buffer,0,s);let c=0,h=0,d=this.h1,u=this.h2;const p=3432918353,g=461845907,f=11601,m=13715;for(let e=0;e<s;e++)1&e?(c=l[e],c=c*p&r|c*f&a,c=c<<15|c>>>17,c=c*g&r|c*m&a,d^=c,d=d<<13|d>>>19,d=5*d+3864292196):(h=l[e],h=h*p&r|h*f&a,h=h<<15|h>>>17,h=h*g&r|h*m&a,u^=h,u=u<<13|u>>>19,u=5*u+3864292196);switch(c=0,o){case 3:c^=t[4*s+2]<<16;case 2:c^=t[4*s+1]<<8;case 1:c^=t[4*s],c=c*p&r|c*f&a,c=c<<15|c>>>17,c=c*g&r|c*m&a,1&s?d^=c:u^=c}this.h1=d,this.h2=u}hexdigest(){let e=this.h1,t=this.h2;return e^=t>>>1,e=3981806797*e&r|36045*e&a,t=4283543511*t&r|(2950163797*(t<<16|e>>>16)&r)>>>16,e^=t>>>1,e=444984403*e&r|60499*e&a,t=3301882366*t&r|(3120437893*(t<<16|e>>>16)&r)>>>16,e^=t>>>1,(e>>>0).toString(16).padStart(8,"0")+(t>>>0).toString(16).padStart(8,"0")}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.FontLoader=t.FontFaceObject=void 0;var n=i(1),s=i(10);t.FontLoader=class{constructor({ownerDocument:e=globalThis.document,styleElement:t=null}){this._document=e,this.nativeFontFaces=[],this.styleElement=null,this.loadingRequests=[],this.loadTestFontId=0}addNativeFontFace(e){this.nativeFontFaces.push(e),this._document.fonts.add(e)}insertRule(e){this.styleElement||(this.styleElement=this._document.createElement("style"),this._document.documentElement.getElementsByTagName("head")[0].append(this.styleElement));const t=this.styleElement.sheet;t.insertRule(e,t.cssRules.length)}clear(){for(const e of this.nativeFontFaces)this._document.fonts.delete(e);this.nativeFontFaces.length=0,this.styleElement&&(this.styleElement.remove(),this.styleElement=null)}async bind(e){if(e.attached||e.missingFile)return;if(e.attached=!0,this.isFontLoadingAPISupported){const t=e.createNativeFontFace();if(t){this.addNativeFontFace(t);try{await t.loaded}catch(i){throw(0,n.warn)(`Failed to load font '${t.family}': '${i}'.`),e.disableFontFace=!0,i}}return}const t=e.createFontFaceRule();if(t){if(this.insertRule(t),this.isSyncFontLoadingSupported)return;await new Promise((t=>{const i=this._queueLoadingCallback(t);this._prepareFontLoadEvent(e,i)}))}}get isFontLoadingAPISupported(){const e=!!this._document?.fonts;return(0,n.shadow)(this,"isFontLoadingAPISupported",e)}get isSyncFontLoadingSupported(){let e=!1;return(s.isNodeJS||"undefined"!=typeof navigator&&/Mozilla\/5.0.*?rv:\d+.*? Gecko/.test(navigator.userAgent))&&(e=!0),(0,n.shadow)(this,"isSyncFontLoadingSupported",e)}_queueLoadingCallback(e){const{loadingRequests:t}=this,i={done:!1,complete:function(){for((0,n.assert)(!i.done,"completeRequest() cannot be called twice."),i.done=!0;t.length>0&&t[0].done;){const e=t.shift();setTimeout(e.callback,0)}},callback:e};return t.push(i),i}get _loadTestFont(){const e=atob("T1RUTwALAIAAAwAwQ0ZGIDHtZg4AAAOYAAAAgUZGVE1lkzZwAAAEHAAAABxHREVGABQAFQAABDgAAAAeT1MvMlYNYwkAAAEgAAAAYGNtYXABDQLUAAACNAAAAUJoZWFk/xVFDQAAALwAAAA2aGhlYQdkA+oAAAD0AAAAJGhtdHgD6AAAAAAEWAAAAAZtYXhwAAJQAAAAARgAAAAGbmFtZVjmdH4AAAGAAAAAsXBvc3T/hgAzAAADeAAAACAAAQAAAAEAALZRFsRfDzz1AAsD6AAAAADOBOTLAAAAAM4KHDwAAAAAA+gDIQAAAAgAAgAAAAAAAAABAAADIQAAAFoD6AAAAAAD6AABAAAAAAAAAAAAAAAAAAAAAQAAUAAAAgAAAAQD6AH0AAUAAAKKArwAAACMAooCvAAAAeAAMQECAAACAAYJAAAAAAAAAAAAAQAAAAAAAAAAAAAAAFBmRWQAwAAuAC4DIP84AFoDIQAAAAAAAQAAAAAAAAAAACAAIAABAAAADgCuAAEAAAAAAAAAAQAAAAEAAAAAAAEAAQAAAAEAAAAAAAIAAQAAAAEAAAAAAAMAAQAAAAEAAAAAAAQAAQAAAAEAAAAAAAUAAQAAAAEAAAAAAAYAAQAAAAMAAQQJAAAAAgABAAMAAQQJAAEAAgABAAMAAQQJAAIAAgABAAMAAQQJAAMAAgABAAMAAQQJAAQAAgABAAMAAQQJAAUAAgABAAMAAQQJAAYAAgABWABYAAAAAAAAAwAAAAMAAAAcAAEAAAAAADwAAwABAAAAHAAEACAAAAAEAAQAAQAAAC7//wAAAC7////TAAEAAAAAAAABBgAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAD/gwAyAAAAAQAAAAAAAAAAAAAAAAAAAAABAAQEAAEBAQJYAAEBASH4DwD4GwHEAvgcA/gXBIwMAYuL+nz5tQXkD5j3CBLnEQACAQEBIVhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYAAABAQAADwACAQEEE/t3Dov6fAH6fAT+fPp8+nwHDosMCvm1Cvm1DAz6fBQAAAAAAAABAAAAAMmJbzEAAAAAzgTjFQAAAADOBOQpAAEAAAAAAAAADAAUAAQAAAABAAAAAgABAAAAAAAAAAAD6AAAAAAAAA==");return(0,n.shadow)(this,"_loadTestFont",e)}_prepareFontLoadEvent(e,t){function i(e,t){return e.charCodeAt(t)<<24|e.charCodeAt(t+1)<<16|e.charCodeAt(t+2)<<8|255&e.charCodeAt(t+3)}function s(e,t,i,n){return e.substring(0,t)+n+e.substring(t+i)}let r,a;const o=this._document.createElement("canvas");o.width=1,o.height=1;const l=o.getContext("2d");let c=0;const h=`lt${Date.now()}${this.loadTestFontId++}`;let d=this._loadTestFont;d=s(d,976,h.length,h);const u=1482184792;let p=i(d,16);for(r=0,a=h.length-3;r<a;r+=4)p=p-u+i(h,r)|0;r<h.length&&(p=p-u+i(h+"XXX",r)|0),d=s(d,16,4,(0,n.string32)(p));const g=`@font-face {font-family:"${h}";src:url(data:font/opentype;base64,${btoa(d)});}`;this.insertRule(g);const f=this._document.createElement("div");f.style.visibility="hidden",f.style.width=f.style.height="10px",f.style.position="absolute",f.style.top=f.style.left="0px";for(const t of[e.loadedName,h]){const e=this._document.createElement("span");e.textContent="Hi",e.style.fontFamily=t,f.append(e)}this._document.body.append(f),function e(t,i){if(++c>30)return(0,n.warn)("Load test font never loaded."),void i();l.font="30px "+t,l.fillText(".",0,20),l.getImageData(0,0,1,1).data[3]>0?i():setTimeout(e.bind(null,t,i))}(h,(()=>{f.remove(),t.complete()}))}},t.FontFaceObject=class{constructor(e,{isEvalSupported:t=!0,disableFontFace:i=!1,ignoreErrors:n=!1,inspectFont:s=null}){this.compiledGlyphs=Object.create(null);for(const t in e)this[t]=e[t];this.isEvalSupported=!1!==t,this.disableFontFace=!0===i,this.ignoreErrors=!0===n,this._inspectFont=s}createNativeFontFace(){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,{});return this._inspectFont?.(this),e}createFontFaceRule(){if(!this.data||this.disableFontFace)return null;const e=(0,n.bytesToString)(this.data),t=`url(data:${this.mimetype};base64,${btoa(e)});`;let i;if(this.cssFontInfo){let e=`font-weight: ${this.cssFontInfo.fontWeight};`;this.cssFontInfo.italicAngle&&(e+=`font-style: oblique ${this.cssFontInfo.italicAngle}deg;`),i=`@font-face {font-family:"${this.cssFontInfo.fontFamily}";${e}src:${t}}`}else i=`@font-face {font-family:"${this.loadedName}";src:${t}}`;return this._inspectFont?.(this,t),i}getPathGenerator(e,t){if(void 0!==this.compiledGlyphs[t])return this.compiledGlyphs[t];let i;try{i=e.get(this.loadedName+"_path_"+t)}catch(e){if(!this.ignoreErrors)throw e;return(0,n.warn)(`getPathGenerator - ignoring character: "${e}".`),this.compiledGlyphs[t]=function(e,t){}}if(this.isEvalSupported&&n.FeatureTest.isEvalSupported){const e=[];for(const t of i){const i=void 0!==t.args?t.args.join(","):"";e.push("c.",t.cmd,"(",i,");\n")}return this.compiledGlyphs[t]=new Function("c","size",e.join(""))}return this.compiledGlyphs[t]=function(e,t){for(const n of i)"scale"===n.cmd&&(n.args=[t,-t]),e[n.cmd].apply(e,n.args)}}}},(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isNodeJS=void 0;const i=!("object"!=typeof process||process+""!="[object process]"||process.versions.nw||process.versions.electron&&process.type&&"browser"!==process.type);t.isNodeJS=i},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CanvasGraphics=void 0;var n=i(1),s=i(6),r=i(12),a=i(13),o=i(10);const l=4096,c=16;class h{constructor(e){this.canvasFactory=e,this.cache=Object.create(null)}getCanvas(e,t,i){let n;return void 0!==this.cache[e]?(n=this.cache[e],this.canvasFactory.reset(n,t,i)):(n=this.canvasFactory.create(t,i),this.cache[e]=n),n}delete(e){delete this.cache[e]}clear(){for(const e in this.cache){const t=this.cache[e];this.canvasFactory.destroy(t),delete this.cache[e]}}}function d(e,t,i,n,r,a,o,l,c,h){const[d,u,p,g,f,m]=(0,s.getCurrentTransform)(e);if(0===u&&0===p){const s=o*d+f,_=Math.round(s),v=l*g+m,b=Math.round(v),y=(o+c)*d+f,S=Math.abs(Math.round(y)-_)||1,P=(l+h)*g+m,A=Math.abs(Math.round(P)-b)||1;return e.setTransform(Math.sign(d),0,0,Math.sign(g),_,b),e.drawImage(t,i,n,r,a,0,0,S,A),e.setTransform(d,u,p,g,f,m),[S,A]}if(0===d&&0===g){const s=l*p+f,_=Math.round(s),v=o*u+m,b=Math.round(v),y=(l+h)*p+f,S=Math.abs(Math.round(y)-_)||1,P=(o+c)*u+m,A=Math.abs(Math.round(P)-b)||1;return e.setTransform(0,Math.sign(u),Math.sign(p),0,_,b),e.drawImage(t,i,n,r,a,0,0,A,S),e.setTransform(d,u,p,g,f,m),[A,S]}return e.drawImage(t,i,n,r,a,o,l,c,h),[Math.hypot(d,u)*c,Math.hypot(p,g)*h]}class u{constructor(e,t){this.alphaIsShape=!1,this.fontSize=0,this.fontSizeScale=1,this.textMatrix=n.IDENTITY_MATRIX,this.textMatrixScale=1,this.fontMatrix=n.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=n.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,e,t])}clone(){const e=Object.create(this);return e.clipBox=this.clipBox.slice(),e}setCurrentPoint(e,t){this.x=e,this.y=t}updatePathMinMax(e,t,i){[t,i]=n.Util.applyTransform([t,i],e),this.minX=Math.min(this.minX,t),this.minY=Math.min(this.minY,i),this.maxX=Math.max(this.maxX,t),this.maxY=Math.max(this.maxY,i)}updateRectMinMax(e,t){const i=n.Util.applyTransform(t,e),s=n.Util.applyTransform(t.slice(2),e);this.minX=Math.min(this.minX,i[0],s[0]),this.minY=Math.min(this.minY,i[1],s[1]),this.maxX=Math.max(this.maxX,i[0],s[0]),this.maxY=Math.max(this.maxY,i[1],s[1])}updateScalingPathMinMax(e,t){n.Util.scaleMinMax(e,t),this.minX=Math.min(this.minX,t[0]),this.maxX=Math.max(this.maxX,t[1]),this.minY=Math.min(this.minY,t[2]),this.maxY=Math.max(this.maxY,t[3])}updateCurvePathMinMax(e,t,i,s,r,a,o,l,c,h){const d=n.Util.bezierBoundingBox(t,i,s,r,a,o,l,c);if(h)return h[0]=Math.min(h[0],d[0],d[2]),h[1]=Math.max(h[1],d[0],d[2]),h[2]=Math.min(h[2],d[1],d[3]),void(h[3]=Math.max(h[3],d[1],d[3]));this.updateRectMinMax(e,d)}getPathBoundingBox(e=r.PathType.FILL,t=null){const i=[this.minX,this.minY,this.maxX,this.maxY];if(e===r.PathType.STROKE){t||(0,n.unreachable)("Stroke bounding box must include transform.");const e=n.Util.singularValueDecompose2dScale(t),s=e[0]*this.lineWidth/2,r=e[1]*this.lineWidth/2;i[0]-=s,i[1]-=r,i[2]+=s,i[3]+=r}return i}updateClipFromPath(){const e=n.Util.intersect(this.clipBox,this.getPathBoundingBox());this.startNewPathAndClipBox(e||[0,0,0,0])}isEmptyClip(){return this.minX===1/0}startNewPathAndClipBox(e){this.clipBox=e,this.minX=1/0,this.minY=1/0,this.maxX=0,this.maxY=0}getClippedPathBoundingBox(e=r.PathType.FILL,t=null){return n.Util.intersect(this.clipBox,this.getPathBoundingBox(e,t))}}function p(e,t){if("undefined"!=typeof ImageData&&t instanceof ImageData)return void e.putImageData(t,0,0);const i=t.height,s=t.width,r=i%c,a=(i-r)/c,o=0===r?a:a+1,l=e.createImageData(s,c);let h,d=0;const u=t.data,p=l.data;let g,f,m,_;if(t.kind===n.ImageKind.GRAYSCALE_1BPP){const t=u.byteLength,i=new Uint32Array(p.buffer,0,p.byteLength>>2),_=i.length,v=s+7>>3,b=4294967295,y=n.FeatureTest.isLittleEndian?4278190080:255;for(g=0;g<o;g++){for(m=g<a?c:r,h=0,f=0;f<m;f++){const e=t-d;let n=0;const r=e>v?s:8*e-7,a=-8&r;let o=0,l=0;for(;n<a;n+=8)l=u[d++],i[h++]=128&l?b:y,i[h++]=64&l?b:y,i[h++]=32&l?b:y,i[h++]=16&l?b:y,i[h++]=8&l?b:y,i[h++]=4&l?b:y,i[h++]=2&l?b:y,i[h++]=1&l?b:y;for(;n<r;n++)0===o&&(l=u[d++],o=128),i[h++]=l&o?b:y,o>>=1}for(;h<_;)i[h++]=0;e.putImageData(l,0,g*c)}}else if(t.kind===n.ImageKind.RGBA_32BPP){for(f=0,_=s*c*4,g=0;g<a;g++)p.set(u.subarray(d,d+_)),d+=_,e.putImageData(l,0,f),f+=c;g<o&&(_=s*r*4,p.set(u.subarray(d,d+_)),e.putImageData(l,0,f))}else{if(t.kind!==n.ImageKind.RGB_24BPP)throw new Error(`bad image kind: ${t.kind}`);for(m=c,_=s*m,g=0;g<o;g++){for(g>=a&&(m=r,_=s*m),h=0,f=_;f--;)p[h++]=u[d++],p[h++]=u[d++],p[h++]=u[d++],p[h++]=255;e.putImageData(l,0,g*c)}}}function g(e,t){if(t.bitmap)return void e.drawImage(t.bitmap,0,0);const i=t.height,n=t.width,s=i%c,r=(i-s)/c,o=0===s?r:r+1,l=e.createImageData(n,c);let h=0;const d=t.data,u=l.data;for(let t=0;t<o;t++){const i=t<r?c:s;({srcPos:h}=(0,a.convertBlackAndWhiteToRGBA)({src:d,srcPos:h,dest:u,width:n,height:i,nonBlackColor:0})),e.putImageData(l,0,t*c)}}function f(e,t){const i=["strokeStyle","fillStyle","fillRule","globalAlpha","lineWidth","lineCap","lineJoin","miterLimit","globalCompositeOperation","font","filter"];for(const n of i)void 0!==e[n]&&(t[n]=e[n]);void 0!==e.setLineDash&&(t.setLineDash(e.getLineDash()),t.lineDashOffset=e.lineDashOffset)}function m(e){e.strokeStyle=e.fillStyle="#000000",e.fillRule="nonzero",e.globalAlpha=1,e.lineWidth=1,e.lineCap="butt",e.lineJoin="miter",e.miterLimit=10,e.globalCompositeOperation="source-over",e.font="10px sans-serif",void 0!==e.setLineDash&&(e.setLineDash([]),e.lineDashOffset=0),o.isNodeJS||(e.filter="none")}function _(e,t,i,n){const s=e.length;for(let r=3;r<s;r+=4){const s=e[r];if(0===s)e[r-3]=t,e[r-2]=i,e[r-1]=n;else if(s<255){const a=255-s;e[r-3]=e[r-3]*s+t*a>>8,e[r-2]=e[r-2]*s+i*a>>8,e[r-1]=e[r-1]*s+n*a>>8}}}function v(e,t,i){const n=e.length;for(let s=3;s<n;s+=4){const n=i?i[e[s]]:e[s];t[s]=t[s]*n*.00392156862745098|0}}function b(e,t,i){const n=e.length;for(let s=3;s<n;s+=4){const n=77*e[s-3]+152*e[s-2]+28*e[s-1];t[s]=i?t[s]*i[n>>8]>>8:t[s]*n>>16}}function y(e,t,i,n){const s=n[0],r=n[1],a=n[2]-s,o=n[3]-r;0!==a&&0!==o&&(function(e,t,i,n,s,r,a,o,l,c,h){const d=!!r,u=d?r[0]:0,p=d?r[1]:0,g=d?r[2]:0;let f;f="Luminosity"===s?b:v;const m=Math.min(n,Math.ceil(1048576/i));for(let s=0;s<n;s+=m){const r=Math.min(m,n-s),v=e.getImageData(o-c,s+(l-h),i,r),b=t.getImageData(o,s+l,i,r);d&&_(v.data,u,p,g),f(v.data,b.data,a),t.putImageData(b,o,s+l)}}(t.context,i,a,o,t.subtype,t.backdrop,t.transferMap,s,r,t.offsetX,t.offsetY),e.save(),e.globalAlpha=1,e.globalCompositeOperation="source-over",e.setTransform(1,0,0,1,0,0),e.drawImage(i.canvas,0,0),e.restore())}function S(e,t){const i=n.Util.singularValueDecompose2dScale(e);i[0]=Math.fround(i[0]),i[1]=Math.fround(i[1]);const r=Math.fround((globalThis.devicePixelRatio||1)*s.PixelsPerInch.PDF_TO_CSS_UNITS);return void 0!==t?t:i[0]<=r||i[1]<=r}const P=["butt","round","square"],A=["miter","round","bevel"],w={},E={};class C{constructor(e,t,i,n,s,{optionalContentConfig:r,markedContentStack:a=null},o){this.ctx=e,this.current=new u(this.ctx.canvas.width,this.ctx.canvas.height),this.stateStack=[],this.pendingClip=null,this.pendingEOFill=!1,this.res=null,this.xobjs=null,this.commonObjs=t,this.objs=i,this.canvasFactory=n,this.filterFactory=s,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=a||[],this.optionalContentConfig=r,this.cachedCanvases=new h(this.canvasFactory),this.cachedPatterns=new Map,this.annotationCanvasMap=o,this.viewportScale=1,this.outputScaleX=1,this.outputScaleY=1,this._cachedScaleForStroking=null,this._cachedGetSinglePixelWidth=null,this._cachedBitmapsMap=new Map}getObject(e,t=null){return"string"==typeof e?e.startsWith("g_")?this.commonObjs.get(e):this.objs.get(e):t}beginDrawing({transform:e,viewport:t,transparency:i=!1,background:n=null}){const r=this.ctx.canvas.width,a=this.ctx.canvas.height,o=this.ctx.fillStyle;if(this.ctx.fillStyle=n||"#ffffff",this.ctx.fillRect(0,0,r,a),this.ctx.fillStyle=o,i){const e=this.cachedCanvases.getCanvas("transparent",r,a);this.compositeCtx=this.ctx,this.transparentCanvas=e.canvas,this.ctx=e.context,this.ctx.save(),this.ctx.transform(...(0,s.getCurrentTransform)(this.compositeCtx))}this.ctx.save(),m(this.ctx),e&&(this.ctx.transform(...e),this.outputScaleX=e[0],this.outputScaleY=e[0]),this.ctx.transform(...t.transform),this.viewportScale=t.scale,this.baseTransform=(0,s.getCurrentTransform)(this.ctx)}executeOperatorList(e,t,i,s){const r=e.argsArray,a=e.fnArray;let o=t||0;const l=r.length;if(l===o)return o;const c=l-o>10&&"function"==typeof i,h=c?Date.now()+15:0;let d=0;const u=this.commonObjs,p=this.objs;let g;for(;;){if(void 0!==s&&o===s.nextBreakPoint)return s.breakIt(o,i),o;if(g=a[o],g!==n.OPS.dependency)this[g].apply(this,r[o]);else for(const e of r[o]){const t=e.startsWith("g_")?u:p;if(!t.has(e))return t.get(e,i),o}if(o++,o===l)return o;if(c&&++d>10){if(Date.now()>h)return i(),o;d=0}}}#Se(){for(;this.stateStack.length||this.inSMaskMode;)this.restore();this.ctx.restore(),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(e=null){this.#Se(),this.cachedCanvases.clear(),this.cachedPatterns.clear();for(const e of this._cachedBitmapsMap.values()){for(const t of e.values())"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement&&(t.width=t.height=0);e.clear()}if(this._cachedBitmapsMap.clear(),e){const t=this.filterFactory.addHCMFilter(e.foreground,e.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(e,t){const i=e.width,n=e.height;let s,r,a=Math.max(Math.hypot(t[0],t[1]),1),o=Math.max(Math.hypot(t[2],t[3]),1),l=i,c=n,h="prescale1";for(;a>2&&l>1||o>2&&c>1;){let t=l,i=c;a>2&&l>1&&(t=l>=16384?Math.floor(l/2)-1||1:Math.ceil(l/2),a/=l/t),o>2&&c>1&&(i=c>=16384?Math.floor(c/2)-1||1:Math.ceil(c)/2,o/=c/i),s=this.cachedCanvases.getCanvas(h,t,i),r=s.context,r.clearRect(0,0,t,i),r.drawImage(e,0,0,l,c,0,0,t,i),e=s.canvas,l=t,c=i,h="prescale1"===h?"prescale2":"prescale1"}return{img:e,paintWidth:l,paintHeight:c}}_createMaskCanvas(e){const t=this.ctx,{width:i,height:a}=e,o=this.current.fillColor,l=this.current.patternFill,c=(0,s.getCurrentTransform)(t);let h,u,p,f;if((e.bitmap||e.data)&&e.count>1){const t=e.bitmap||e.data.buffer;u=JSON.stringify(l?c:[c.slice(0,4),o]),h=this._cachedBitmapsMap.get(t),h||(h=new Map,this._cachedBitmapsMap.set(t,h));const i=h.get(u);if(i&&!l)return{canvas:i,offsetX:Math.round(Math.min(c[0],c[2])+c[4]),offsetY:Math.round(Math.min(c[1],c[3])+c[5])};p=i}p||(f=this.cachedCanvases.getCanvas("maskCanvas",i,a),g(f.context,e));let m=n.Util.transform(c,[1/i,0,0,-1/a,0,0]);m=n.Util.transform(m,[1,0,0,1,0,-a]);const _=n.Util.applyTransform([0,0],m),v=n.Util.applyTransform([i,a],m),b=n.Util.normalizeRect([_[0],_[1],v[0],v[1]]),y=Math.round(b[2]-b[0])||1,P=Math.round(b[3]-b[1])||1,A=this.cachedCanvases.getCanvas("fillCanvas",y,P),w=A.context,E=Math.min(_[0],v[0]),C=Math.min(_[1],v[1]);w.translate(-E,-C),w.transform(...m),p||(p=this._scaleImage(f.canvas,(0,s.getCurrentTransformInverse)(w)),p=p.img,h&&l&&h.set(u,p)),w.imageSmoothingEnabled=S((0,s.getCurrentTransform)(w),e.interpolate),d(w,p,0,0,p.width,p.height,0,0,i,a),w.globalCompositeOperation="source-in";const x=n.Util.transform((0,s.getCurrentTransformInverse)(w),[1,0,0,1,-E,-C]);return w.fillStyle=l?o.getPattern(t,this,x,r.PathType.FILL):o,w.fillRect(0,0,i,a),h&&!l&&(this.cachedCanvases.delete("fillCanvas"),h.set(u,A.canvas)),{canvas:A.canvas,offsetX:Math.round(E),offsetY:Math.round(C)}}setLineWidth(e){e!==this.current.lineWidth&&(this._cachedScaleForStroking=null),this.current.lineWidth=e,this.ctx.lineWidth=e}setLineCap(e){this.ctx.lineCap=P[e]}setLineJoin(e){this.ctx.lineJoin=A[e]}setMiterLimit(e){this.ctx.miterLimit=e}setDash(e,t){const i=this.ctx;void 0!==i.setLineDash&&(i.setLineDash(e),i.lineDashOffset=t)}setRenderingIntent(e){}setFlatness(e){}setGState(e){for(const[t,i]of e)switch(t){case"LW":this.setLineWidth(i);break;case"LC":this.setLineCap(i);break;case"LJ":this.setLineJoin(i);break;case"ML":this.setMiterLimit(i);break;case"D":this.setDash(i[0],i[1]);break;case"RI":this.setRenderingIntent(i);break;case"FL":this.setFlatness(i);break;case"Font":this.setFont(i[0],i[1]);break;case"CA":this.current.strokeAlpha=i;break;case"ca":this.current.fillAlpha=i,this.ctx.globalAlpha=i;break;case"BM":this.ctx.globalCompositeOperation=i;break;case"SMask":this.current.activeSMask=i?this.tempSMask:null,this.tempSMask=null,this.checkSMaskState();break;case"TR":this.ctx.filter=this.current.transferMaps=this.filterFactory.addFilter(i)}}get inSMaskMode(){return!!this.suspendedCtx}checkSMaskState(){const e=this.inSMaskMode;this.current.activeSMask&&!e?this.beginSMaskMode():!this.current.activeSMask&&e&&this.endSMaskMode()}beginSMaskMode(){if(this.inSMaskMode)throw new Error("beginSMaskMode called while already in smask mode");const e=this.ctx.canvas.width,t=this.ctx.canvas.height,i="smaskGroupAt"+this.groupLevel,n=this.cachedCanvases.getCanvas(i,e,t);this.suspendedCtx=this.ctx,this.ctx=n.context;const r=this.ctx;r.setTransform(...(0,s.getCurrentTransform)(this.suspendedCtx)),f(this.suspendedCtx,r),function(e,t){if(e._removeMirroring)throw new Error("Context is already forwarding operations.");e.__originalSave=e.save,e.__originalRestore=e.restore,e.__originalRotate=e.rotate,e.__originalScale=e.scale,e.__originalTranslate=e.translate,e.__originalTransform=e.transform,e.__originalSetTransform=e.setTransform,e.__originalResetTransform=e.resetTransform,e.__originalClip=e.clip,e.__originalMoveTo=e.moveTo,e.__originalLineTo=e.lineTo,e.__originalBezierCurveTo=e.bezierCurveTo,e.__originalRect=e.rect,e.__originalClosePath=e.closePath,e.__originalBeginPath=e.beginPath,e._removeMirroring=()=>{e.save=e.__originalSave,e.restore=e.__originalRestore,e.rotate=e.__originalRotate,e.scale=e.__originalScale,e.translate=e.__originalTranslate,e.transform=e.__originalTransform,e.setTransform=e.__originalSetTransform,e.resetTransform=e.__originalResetTransform,e.clip=e.__originalClip,e.moveTo=e.__originalMoveTo,e.lineTo=e.__originalLineTo,e.bezierCurveTo=e.__originalBezierCurveTo,e.rect=e.__originalRect,e.closePath=e.__originalClosePath,e.beginPath=e.__originalBeginPath,delete e._removeMirroring},e.save=function(){t.save(),this.__originalSave()},e.restore=function(){t.restore(),this.__originalRestore()},e.translate=function(e,i){t.translate(e,i),this.__originalTranslate(e,i)},e.scale=function(e,i){t.scale(e,i),this.__originalScale(e,i)},e.transform=function(e,i,n,s,r,a){t.transform(e,i,n,s,r,a),this.__originalTransform(e,i,n,s,r,a)},e.setTransform=function(e,i,n,s,r,a){t.setTransform(e,i,n,s,r,a),this.__originalSetTransform(e,i,n,s,r,a)},e.resetTransform=function(){t.resetTransform(),this.__originalResetTransform()},e.rotate=function(e){t.rotate(e),this.__originalRotate(e)},e.clip=function(e){t.clip(e),this.__originalClip(e)},e.moveTo=function(e,i){t.moveTo(e,i),this.__originalMoveTo(e,i)},e.lineTo=function(e,i){t.lineTo(e,i),this.__originalLineTo(e,i)},e.bezierCurveTo=function(e,i,n,s,r,a){t.bezierCurveTo(e,i,n,s,r,a),this.__originalBezierCurveTo(e,i,n,s,r,a)},e.rect=function(e,i,n,s){t.rect(e,i,n,s),this.__originalRect(e,i,n,s)},e.closePath=function(){t.closePath(),this.__originalClosePath()},e.beginPath=function(){t.beginPath(),this.__originalBeginPath()}}(r,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(),f(this.ctx,this.suspendedCtx),this.ctx=this.suspendedCtx,this.suspendedCtx=null}compose(e){if(!this.current.activeSMask)return;e?(e[0]=Math.floor(e[0]),e[1]=Math.floor(e[1]),e[2]=Math.ceil(e[2]),e[3]=Math.ceil(e[3])):e=[0,0,this.ctx.canvas.width,this.ctx.canvas.height];const t=this.current.activeSMask;y(this.suspendedCtx,t,this.ctx,e),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(){this.inSMaskMode?(f(this.ctx,this.suspendedCtx),this.suspendedCtx.save()):this.ctx.save();const e=this.current;this.stateStack.push(e),this.current=e.clone()}restore(){0===this.stateStack.length&&this.inSMaskMode&&this.endSMaskMode(),0!==this.stateStack.length&&(this.current=this.stateStack.pop(),this.inSMaskMode?(this.suspendedCtx.restore(),f(this.suspendedCtx,this.ctx)):this.ctx.restore(),this.checkSMaskState(),this.pendingClip=null,this._cachedScaleForStroking=null,this._cachedGetSinglePixelWidth=null)}transform(e,t,i,n,s,r){this.ctx.transform(e,t,i,n,s,r),this._cachedScaleForStroking=null,this._cachedGetSinglePixelWidth=null}constructPath(e,t,i){const r=this.ctx,a=this.current;let o,l,c=a.x,h=a.y;const d=(0,s.getCurrentTransform)(r),u=0===d[0]&&0===d[3]||0===d[1]&&0===d[2],p=u?i.slice(0):null;for(let i=0,s=0,g=e.length;i<g;i++)switch(0|e[i]){case n.OPS.rectangle:c=t[s++],h=t[s++];const e=t[s++],i=t[s++],g=c+e,f=h+i;r.moveTo(c,h),0===e||0===i?r.lineTo(g,f):(r.lineTo(g,h),r.lineTo(g,f),r.lineTo(c,f)),u||a.updateRectMinMax(d,[c,h,g,f]),r.closePath();break;case n.OPS.moveTo:c=t[s++],h=t[s++],r.moveTo(c,h),u||a.updatePathMinMax(d,c,h);break;case n.OPS.lineTo:c=t[s++],h=t[s++],r.lineTo(c,h),u||a.updatePathMinMax(d,c,h);break;case n.OPS.curveTo:o=c,l=h,c=t[s+4],h=t[s+5],r.bezierCurveTo(t[s],t[s+1],t[s+2],t[s+3],c,h),a.updateCurvePathMinMax(d,o,l,t[s],t[s+1],t[s+2],t[s+3],c,h,p),s+=6;break;case n.OPS.curveTo2:o=c,l=h,r.bezierCurveTo(c,h,t[s],t[s+1],t[s+2],t[s+3]),a.updateCurvePathMinMax(d,o,l,c,h,t[s],t[s+1],t[s+2],t[s+3],p),c=t[s+2],h=t[s+3],s+=4;break;case n.OPS.curveTo3:o=c,l=h,c=t[s+2],h=t[s+3],r.bezierCurveTo(t[s],t[s+1],c,h,c,h),a.updateCurvePathMinMax(d,o,l,t[s],t[s+1],c,h,c,h,p),s+=4;break;case n.OPS.closePath:r.closePath()}u&&a.updateScalingPathMinMax(d,p),a.setCurrentPoint(c,h)}closePath(){this.ctx.closePath()}stroke(e=!0){const t=this.ctx,i=this.current.strokeColor;t.globalAlpha=this.current.strokeAlpha,this.contentVisible&&("object"==typeof i&&i?.getPattern?(t.save(),t.strokeStyle=i.getPattern(t,this,(0,s.getCurrentTransformInverse)(t),r.PathType.STROKE),this.rescaleAndStroke(!1),t.restore()):this.rescaleAndStroke(!0)),e&&this.consumePath(this.current.getClippedPathBoundingBox()),t.globalAlpha=this.current.fillAlpha}closeStroke(){this.closePath(),this.stroke()}fill(e=!0){const t=this.ctx,i=this.current.fillColor;let n=!1;this.current.patternFill&&(t.save(),t.fillStyle=i.getPattern(t,this,(0,s.getCurrentTransformInverse)(t),r.PathType.FILL),n=!0);const a=this.current.getClippedPathBoundingBox();this.contentVisible&&null!==a&&(this.pendingEOFill?(t.fill("evenodd"),this.pendingEOFill=!1):t.fill()),n&&t.restore(),e&&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=w}eoClip(){this.pendingClip=E}beginText(){this.current.textMatrix=n.IDENTITY_MATRIX,this.current.textMatrixScale=1,this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0}endText(){const e=this.pendingTextPaths,t=this.ctx;if(void 0!==e){t.save(),t.beginPath();for(const i of e)t.setTransform(...i.transform),t.translate(i.x,i.y),i.addToPath(t,i.fontSize);t.restore(),t.clip(),t.beginPath(),delete this.pendingTextPaths}else t.beginPath()}setCharSpacing(e){this.current.charSpacing=e}setWordSpacing(e){this.current.wordSpacing=e}setHScale(e){this.current.textHScale=e/100}setLeading(e){this.current.leading=-e}setFont(e,t){const i=this.commonObjs.get(e),s=this.current;if(!i)throw new Error(`Can't find font for ${e}`);if(s.fontMatrix=i.fontMatrix||n.FONT_IDENTITY_MATRIX,0!==s.fontMatrix[0]&&0!==s.fontMatrix[3]||(0,n.warn)("Invalid font matrix for font "+e),t<0?(t=-t,s.fontDirection=-1):s.fontDirection=1,this.current.font=i,this.current.fontSize=t,i.isType3Font)return;const r=i.loadedName||"sans-serif";let a="normal";i.black?a="900":i.bold&&(a="bold");const o=i.italic?"italic":"normal",l=`"${r}", ${i.fallbackName}`;let c=t;t<16?c=16:t>100&&(c=100),this.current.fontSizeScale=t/c,this.ctx.font=`${o} ${a} ${c}px ${l}`}setTextRenderingMode(e){this.current.textRenderingMode=e}setTextRise(e){this.current.textRise=e}moveText(e,t){this.current.x=this.current.lineX+=e,this.current.y=this.current.lineY+=t}setLeadingMoveText(e,t){this.setLeading(-t),this.moveText(e,t)}setTextMatrix(e,t,i,n,s,r){this.current.textMatrix=[e,t,i,n,s,r],this.current.textMatrixScale=Math.hypot(e,t),this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0}nextLine(){this.moveText(0,this.current.leading)}paintChar(e,t,i,r){const a=this.ctx,o=this.current,l=o.font,c=o.textRenderingMode,h=o.fontSize/o.fontSizeScale,d=c&n.TextRenderingMode.FILL_STROKE_MASK,u=!!(c&n.TextRenderingMode.ADD_TO_PATH_FLAG),p=o.patternFill&&!l.missingFile;let g;(l.disableFontFace||u||p)&&(g=l.getPathGenerator(this.commonObjs,e)),l.disableFontFace||p?(a.save(),a.translate(t,i),a.beginPath(),g(a,h),r&&a.setTransform(...r),d!==n.TextRenderingMode.FILL&&d!==n.TextRenderingMode.FILL_STROKE||a.fill(),d!==n.TextRenderingMode.STROKE&&d!==n.TextRenderingMode.FILL_STROKE||a.stroke(),a.restore()):(d!==n.TextRenderingMode.FILL&&d!==n.TextRenderingMode.FILL_STROKE||a.fillText(e,t,i),d!==n.TextRenderingMode.STROKE&&d!==n.TextRenderingMode.FILL_STROKE||a.strokeText(e,t,i)),u&&(this.pendingTextPaths||(this.pendingTextPaths=[])).push({transform:(0,s.getCurrentTransform)(a),x:t,y:i,fontSize:h,addToPath:g})}get isFontSubpixelAAEnabled(){const{context:e}=this.cachedCanvases.getCanvas("isFontSubpixelAAEnabled",10,10);e.scale(1.5,1),e.fillText("I",0,10);const t=e.getImageData(0,0,10,10).data;let i=!1;for(let e=3;e<t.length;e+=4)if(t[e]>0&&t[e]<255){i=!0;break}return(0,n.shadow)(this,"isFontSubpixelAAEnabled",i)}showText(e){const t=this.current,i=t.font;if(i.isType3Font)return this.showType3Text(e);const a=t.fontSize;if(0===a)return;const o=this.ctx,l=t.fontSizeScale,c=t.charSpacing,h=t.wordSpacing,d=t.fontDirection,u=t.textHScale*d,p=e.length,g=i.vertical,f=g?1:-1,m=i.defaultVMetrics,_=a*t.fontMatrix[0],v=t.textRenderingMode===n.TextRenderingMode.FILL&&!i.disableFontFace&&!t.patternFill;let b;if(o.save(),o.transform(...t.textMatrix),o.translate(t.x,t.y+t.textRise),d>0?o.scale(u,-1):o.scale(u,1),t.patternFill){o.save();const e=t.fillColor.getPattern(o,this,(0,s.getCurrentTransformInverse)(o),r.PathType.FILL);b=(0,s.getCurrentTransform)(o),o.restore(),o.fillStyle=e}let y=t.lineWidth;const S=t.textMatrixScale;if(0===S||0===y){const e=t.textRenderingMode&n.TextRenderingMode.FILL_STROKE_MASK;e!==n.TextRenderingMode.STROKE&&e!==n.TextRenderingMode.FILL_STROKE||(y=this.getSinglePixelWidth())}else y/=S;if(1!==l&&(o.scale(l,l),y/=l),o.lineWidth=y,i.isInvalidPDFjsFont){const i=[];let n=0;for(const t of e)i.push(t.unicode),n+=t.width;return o.fillText(i.join(""),0,0),t.x+=n*_*u,o.restore(),void this.compose()}let P,A=0;for(P=0;P<p;++P){const t=e[P];if("number"==typeof t){A+=f*t*a/1e3;continue}let n=!1;const s=(t.isSpace?h:0)+c,r=t.fontChar,u=t.accent;let p,y,S,w=t.width;if(g){const e=t.vmetric||m,i=-(t.vmetric?e[1]:.5*w)*_,n=e[2]*_;w=e?-e[0]:w,p=i/l,y=(A+n)/l}else p=A/l,y=0;if(i.remeasure&&w>0){const e=1e3*o.measureText(r).width/a*l;if(w<e&&this.isFontSubpixelAAEnabled){const t=w/e;n=!0,o.save(),o.scale(t,1),p/=t}else w!==e&&(p+=(w-e)/2e3*a/l)}if(this.contentVisible&&(t.isInFont||i.missingFile))if(v&&!u)o.fillText(r,p,y);else if(this.paintChar(r,p,y,b),u){const e=p+a*u.offset.x/l,t=y-a*u.offset.y/l;this.paintChar(u.fontChar,e,t,b)}S=g?w*_-s*d:w*_+s*d,A+=S,n&&o.restore()}g?t.y-=A:t.x+=A*u,o.restore(),this.compose()}showType3Text(e){const t=this.ctx,i=this.current,s=i.font,r=i.fontSize,a=i.fontDirection,o=s.vertical?1:-1,l=i.charSpacing,c=i.wordSpacing,h=i.textHScale*a,d=i.fontMatrix||n.FONT_IDENTITY_MATRIX,u=e.length;let p,g,f,m;if(i.textRenderingMode!==n.TextRenderingMode.INVISIBLE&&0!==r){for(this._cachedScaleForStroking=null,this._cachedGetSinglePixelWidth=null,t.save(),t.transform(...i.textMatrix),t.translate(i.x,i.y),t.scale(h,a),p=0;p<u;++p){if(g=e[p],"number"==typeof g){m=o*g*r/1e3,this.ctx.translate(m,0),i.x+=m*h;continue}const a=(g.isSpace?c:0)+l,u=s.charProcOperatorList[g.operatorListId];u?(this.contentVisible&&(this.processingType3=g,this.save(),t.scale(r,r),t.transform(...d),this.executeOperatorList(u),this.restore()),f=n.Util.applyTransform([g.width,0],d)[0]*r+a,t.translate(f,0),i.x+=f*h):(0,n.warn)(`Type3 character "${g.operatorListId}" is not available.`)}t.restore(),this.processingType3=null}}setCharWidth(e,t){}setCharWidthAndBounds(e,t,i,n,s,r){this.ctx.rect(i,n,s-i,r-n),this.ctx.clip(),this.endPath()}getColorN_Pattern(e){let t;if("TilingPattern"===e[0]){const i=e[1],n=this.baseTransform||(0,s.getCurrentTransform)(this.ctx),a={createCanvasGraphics:e=>new C(e,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:this.optionalContentConfig,markedContentStack:this.markedContentStack})};t=new r.TilingPattern(e,i,this.ctx,a,n)}else t=this._getPattern(e[1],e[2]);return t}setStrokeColorN(){this.current.strokeColor=this.getColorN_Pattern(arguments)}setFillColorN(){this.current.fillColor=this.getColorN_Pattern(arguments),this.current.patternFill=!0}setStrokeRGBColor(e,t,i){const s=n.Util.makeHexColor(e,t,i);this.ctx.strokeStyle=s,this.current.strokeColor=s}setFillRGBColor(e,t,i){const s=n.Util.makeHexColor(e,t,i);this.ctx.fillStyle=s,this.current.fillColor=s,this.current.patternFill=!1}_getPattern(e,t=null){let i;return this.cachedPatterns.has(e)?i=this.cachedPatterns.get(e):(i=(0,r.getShadingPattern)(this.getObject(e)),this.cachedPatterns.set(e,i)),t&&(i.matrix=t),i}shadingFill(e){if(!this.contentVisible)return;const t=this.ctx;this.save();const i=this._getPattern(e);t.fillStyle=i.getPattern(t,this,(0,s.getCurrentTransformInverse)(t),r.PathType.SHADING);const a=(0,s.getCurrentTransformInverse)(t);if(a){const e=t.canvas,i=e.width,s=e.height,r=n.Util.applyTransform([0,0],a),o=n.Util.applyTransform([0,s],a),l=n.Util.applyTransform([i,0],a),c=n.Util.applyTransform([i,s],a),h=Math.min(r[0],o[0],l[0],c[0]),d=Math.min(r[1],o[1],l[1],c[1]),u=Math.max(r[0],o[0],l[0],c[0]),p=Math.max(r[1],o[1],l[1],c[1]);this.ctx.fillRect(h,d,u-h,p-d)}else this.ctx.fillRect(-1e10,-1e10,2e10,2e10);this.compose(this.current.getClippedPathBoundingBox()),this.restore()}beginInlineImage(){(0,n.unreachable)("Should not call beginInlineImage")}beginImageData(){(0,n.unreachable)("Should not call beginImageData")}paintFormXObjectBegin(e,t){if(this.contentVisible&&(this.save(),this.baseTransformStack.push(this.baseTransform),Array.isArray(e)&&6===e.length&&this.transform(...e),this.baseTransform=(0,s.getCurrentTransform)(this.ctx),t)){const e=t[2]-t[0],i=t[3]-t[1];this.ctx.rect(t[0],t[1],e,i),this.current.updateRectMinMax((0,s.getCurrentTransform)(this.ctx),t),this.clip(),this.endPath()}}paintFormXObjectEnd(){this.contentVisible&&(this.restore(),this.baseTransform=this.baseTransformStack.pop())}beginGroup(e){if(!this.contentVisible)return;this.save(),this.inSMaskMode&&(this.endSMaskMode(),this.current.activeSMask=null);const t=this.ctx;e.isolated||(0,n.info)("TODO: Support non-isolated groups."),e.knockout&&(0,n.warn)("Knockout groups not supported.");const i=(0,s.getCurrentTransform)(t);if(e.matrix&&t.transform(...e.matrix),!e.bbox)throw new Error("Bounding box is required.");let r=n.Util.getAxialAlignedBoundingBox(e.bbox,(0,s.getCurrentTransform)(t));const a=[0,0,t.canvas.width,t.canvas.height];r=n.Util.intersect(r,a)||[0,0,0,0];const o=Math.floor(r[0]),c=Math.floor(r[1]);let h=Math.max(Math.ceil(r[2])-o,1),d=Math.max(Math.ceil(r[3])-c,1),u=1,p=1;h>l&&(u=h/l,h=l),d>l&&(p=d/l,d=l),this.current.startNewPathAndClipBox([0,0,h,d]);let g="groupAt"+this.groupLevel;e.smask&&(g+="_smask_"+this.smaskCounter++%2);const m=this.cachedCanvases.getCanvas(g,h,d),_=m.context;_.scale(1/u,1/p),_.translate(-o,-c),_.transform(...i),e.smask?this.smaskStack.push({canvas:m.canvas,context:_,offsetX:o,offsetY:c,scaleX:u,scaleY:p,subtype:e.smask.subtype,backdrop:e.smask.backdrop,transferMap:e.smask.transferMap||null,startTransformInverse:null}):(t.setTransform(1,0,0,1,0,0),t.translate(o,c),t.scale(u,p),t.save()),f(t,_),this.ctx=_,this.setGState([["BM","source-over"],["ca",1],["CA",1]]),this.groupStack.push(t),this.groupLevel++}endGroup(e){if(!this.contentVisible)return;this.groupLevel--;const t=this.ctx,i=this.groupStack.pop();if(this.ctx=i,this.ctx.imageSmoothingEnabled=!1,e.smask)this.tempSMask=this.smaskStack.pop(),this.restore();else{this.ctx.restore();const e=(0,s.getCurrentTransform)(this.ctx);this.restore(),this.ctx.save(),this.ctx.setTransform(...e);const i=n.Util.getAxialAlignedBoundingBox([0,0,t.canvas.width,t.canvas.height],e);this.ctx.drawImage(t.canvas,0,0),this.ctx.restore(),this.compose(i)}}beginAnnotation(e,t,i,r,a){if(this.#Se(),m(this.ctx),this.ctx.save(),this.save(),this.baseTransform&&this.ctx.setTransform(...this.baseTransform),Array.isArray(t)&&4===t.length){const r=t[2]-t[0],o=t[3]-t[1];if(a&&this.annotationCanvasMap){(i=i.slice())[4]-=t[0],i[5]-=t[1],(t=t.slice())[0]=t[1]=0,t[2]=r,t[3]=o;const[a,l]=n.Util.singularValueDecompose2dScale((0,s.getCurrentTransform)(this.ctx)),{viewportScale:c}=this,h=Math.ceil(r*this.outputScaleX*c),d=Math.ceil(o*this.outputScaleY*c);this.annotationCanvas=this.canvasFactory.create(h,d);const{canvas:u,context:p}=this.annotationCanvas;this.annotationCanvasMap.set(e,u),this.annotationCanvas.savedCtx=this.ctx,this.ctx=p,this.ctx.setTransform(a,0,0,-l,0,o*l),m(this.ctx)}else m(this.ctx),this.ctx.rect(t[0],t[1],r,o),this.ctx.clip(),this.endPath()}this.current=new u(this.ctx.canvas.width,this.ctx.canvas.height),this.transform(...i),this.transform(...r)}endAnnotation(){this.annotationCanvas&&(this.ctx=this.annotationCanvas.savedCtx,delete this.annotationCanvas.savedCtx,delete this.annotationCanvas)}paintImageMaskXObject(e){if(!this.contentVisible)return;const t=e.count;(e=this.getObject(e.data,e)).count=t;const i=this.ctx,n=this.processingType3;if(n&&(void 0===n.compiled&&(n.compiled=function(e){const{width:t,height:i}=e;if(t>1e3||i>1e3)return null;const n=new Uint8Array([0,2,4,0,1,0,5,4,8,10,0,8,0,2,1,0]),s=t+1;let r,a,o,l=new Uint8Array(s*(i+1));const c=t+7&-8;let h=new Uint8Array(c*i),d=0;for(const t of e.data){let e=128;for(;e>0;)h[d++]=t&e?0:255,e>>=1}let u=0;for(d=0,0!==h[d]&&(l[0]=1,++u),a=1;a<t;a++)h[d]!==h[d+1]&&(l[a]=h[d]?2:1,++u),d++;for(0!==h[d]&&(l[a]=2,++u),r=1;r<i;r++){d=r*c,o=r*s,h[d-c]!==h[d]&&(l[o]=h[d]?1:8,++u);let e=(h[d]?4:0)+(h[d-c]?8:0);for(a=1;a<t;a++)e=(e>>2)+(h[d+1]?4:0)+(h[d-c+1]?8:0),n[e]&&(l[o+a]=n[e],++u),d++;if(h[d-c]!==h[d]&&(l[o+a]=h[d]?2:4,++u),u>1e3)return null}for(d=c*(i-1),o=r*s,0!==h[d]&&(l[o]=8,++u),a=1;a<t;a++)h[d]!==h[d+1]&&(l[o+a]=h[d]?4:8,++u),d++;if(0!==h[d]&&(l[o+a]=4,++u),u>1e3)return null;const p=new Int32Array([0,s,-1,0,-s,0,0,0,1]),g=new Path2D;for(r=0;u&&r<=i;r++){let e=r*s;const i=e+t;for(;e<i&&!l[e];)e++;if(e===i)continue;g.moveTo(e%s,r);const n=e;let a=l[e];do{const t=p[a];do{e+=t}while(!l[e]);const i=l[e];5!==i&&10!==i?(a=i,l[e]=0):(a=i&51*a>>4,l[e]&=a>>2|a<<2),g.lineTo(e%s,e/s|0),l[e]||--u}while(n!==e);--r}return h=null,l=null,function(e){e.save(),e.scale(1/t,-1/i),e.translate(0,-i),e.fill(g),e.beginPath(),e.restore()}}(e)),n.compiled))return void n.compiled(i);const s=this._createMaskCanvas(e),r=s.canvas;i.save(),i.setTransform(1,0,0,1,0,0),i.drawImage(r,s.offsetX,s.offsetY),i.restore(),this.compose()}paintImageMaskXObjectRepeat(e,t,i=0,r=0,a,o){if(!this.contentVisible)return;e=this.getObject(e.data,e);const l=this.ctx;l.save();const c=(0,s.getCurrentTransform)(l);l.transform(t,i,r,a,0,0);const h=this._createMaskCanvas(e);l.setTransform(1,0,0,1,h.offsetX-c[4],h.offsetY-c[5]);for(let e=0,s=o.length;e<s;e+=2){const s=n.Util.transform(c,[t,i,r,a,o[e],o[e+1]]),[d,u]=n.Util.applyTransform([0,0],s);l.drawImage(h.canvas,d,u)}l.restore(),this.compose()}paintImageMaskXObjectGroup(e){if(!this.contentVisible)return;const t=this.ctx,i=this.current.fillColor,n=this.current.patternFill;for(const a of e){const{data:e,width:o,height:l,transform:c}=a,h=this.cachedCanvases.getCanvas("maskCanvas",o,l),u=h.context;u.save(),g(u,this.getObject(e,a)),u.globalCompositeOperation="source-in",u.fillStyle=n?i.getPattern(u,this,(0,s.getCurrentTransformInverse)(t),r.PathType.FILL):i,u.fillRect(0,0,o,l),u.restore(),t.save(),t.transform(...c),t.scale(1,-1),d(t,h.canvas,0,0,o,l,0,-1,1,1),t.restore()}this.compose()}paintImageXObject(e){if(!this.contentVisible)return;const t=this.getObject(e);t?this.paintInlineImageXObject(t):(0,n.warn)("Dependent image isn't ready yet")}paintImageXObjectRepeat(e,t,i,s){if(!this.contentVisible)return;const r=this.getObject(e);if(!r)return void(0,n.warn)("Dependent image isn't ready yet");const a=r.width,o=r.height,l=[];for(let e=0,n=s.length;e<n;e+=2)l.push({transform:[t,0,0,i,s[e],s[e+1]],x:0,y:0,w:a,h:o});this.paintInlineImageXObjectGroup(r,l)}applyTransferMapsToCanvas(e){return"none"!==this.current.transferMaps&&(e.filter=this.current.transferMaps,e.drawImage(e.canvas,0,0),e.filter="none"),e.canvas}applyTransferMapsToBitmap(e){if("none"===this.current.transferMaps)return e.bitmap;const{bitmap:t,width:i,height:n}=e,s=this.cachedCanvases.getCanvas("inlineImage",i,n),r=s.context;return r.filter=this.current.transferMaps,r.drawImage(t,0,0),r.filter="none",s.canvas}paintInlineImageXObject(e){if(!this.contentVisible)return;const t=e.width,i=e.height,n=this.ctx;let r;if(this.save(),o.isNodeJS||(n.filter="none"),n.scale(1/t,-1/i),e.bitmap)r=this.applyTransferMapsToBitmap(e);else if("function"==typeof HTMLElement&&e instanceof HTMLElement||!e.data)r=e;else{const n=this.cachedCanvases.getCanvas("inlineImage",t,i).context;p(n,e),r=this.applyTransferMapsToCanvas(n)}const a=this._scaleImage(r,(0,s.getCurrentTransformInverse)(n));n.imageSmoothingEnabled=S((0,s.getCurrentTransform)(n),e.interpolate),d(n,a.img,0,0,a.paintWidth,a.paintHeight,0,-i,t,i),this.compose(),this.restore()}paintInlineImageXObjectGroup(e,t){if(!this.contentVisible)return;const i=this.ctx;let n;if(e.bitmap)n=e.bitmap;else{const t=e.width,i=e.height,s=this.cachedCanvases.getCanvas("inlineImage",t,i).context;p(s,e),n=this.applyTransferMapsToCanvas(s)}for(const e of t)i.save(),i.transform(...e.transform),i.scale(1,-1),d(i,n,e.x,e.y,e.w,e.h,0,-1,1,1),i.restore();this.compose()}paintSolidColorImageMask(){this.contentVisible&&(this.ctx.fillRect(0,0,1,1),this.compose())}markPoint(e){}markPointProps(e,t){}beginMarkedContent(e){this.markedContentStack.push({visible:!0})}beginMarkedContentProps(e,t){"OC"===e?this.markedContentStack.push({visible:this.optionalContentConfig.isVisible(t)}):this.markedContentStack.push({visible:!0}),this.contentVisible=this.isContentVisible()}endMarkedContent(){this.markedContentStack.pop(),this.contentVisible=this.isContentVisible()}beginCompat(){}endCompat(){}consumePath(e){const t=this.current.isEmptyClip();this.pendingClip&&this.current.updateClipFromPath(),this.pendingClip||this.compose(e);const i=this.ctx;this.pendingClip&&(t||(this.pendingClip===E?i.clip("evenodd"):i.clip()),this.pendingClip=null),this.current.startNewPathAndClipBox(this.current.clipBox),i.beginPath()}getSinglePixelWidth(){if(!this._cachedGetSinglePixelWidth){const e=(0,s.getCurrentTransform)(this.ctx);if(0===e[1]&&0===e[2])this._cachedGetSinglePixelWidth=1/Math.min(Math.abs(e[0]),Math.abs(e[3]));else{const t=Math.abs(e[0]*e[3]-e[2]*e[1]),i=Math.hypot(e[0],e[2]),n=Math.hypot(e[1],e[3]);this._cachedGetSinglePixelWidth=Math.max(i,n)/t}}return this._cachedGetSinglePixelWidth}getScaleForStroking(){if(!this._cachedScaleForStroking){const{lineWidth:e}=this.current,t=(0,s.getCurrentTransform)(this.ctx);let i,n;if(0===t[1]&&0===t[2]){const s=Math.abs(t[0]),r=Math.abs(t[3]);if(0===e)i=1/s,n=1/r;else{const t=s*e,a=r*e;i=t<1?1/t:1,n=a<1?1/a:1}}else{const s=Math.abs(t[0]*t[3]-t[2]*t[1]),r=Math.hypot(t[0],t[1]),a=Math.hypot(t[2],t[3]);if(0===e)i=a/s,n=r/s;else{const t=e*s;i=a>t?a/t:1,n=r>t?r/t:1}}this._cachedScaleForStroking=[i,n]}return this._cachedScaleForStroking}rescaleAndStroke(e){const{ctx:t}=this,{lineWidth:i}=this.current,[n,r]=this.getScaleForStroking();if(t.lineWidth=i||1,1===n&&1===r)return void t.stroke();let a,o,l;e&&(a=(0,s.getCurrentTransform)(t),o=t.getLineDash().slice(),l=t.lineDashOffset),t.scale(n,r);const c=Math.max(n,r);t.setLineDash(t.getLineDash().map((e=>e/c))),t.lineDashOffset/=c,t.stroke(),e&&(t.setTransform(...a),t.setLineDash(o),t.lineDashOffset=l)}isContentVisible(){for(let e=this.markedContentStack.length-1;e>=0;e--)if(!this.markedContentStack[e].visible)return!1;return!0}}t.CanvasGraphics=C;for(const e in n.OPS)void 0!==C.prototype[e]&&(C.prototype[n.OPS[e]]=C.prototype[e])},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TilingPattern=t.PathType=void 0,t.getShadingPattern=function(e){switch(e[0]){case"RadialAxial":return new l(e);case"Mesh":return new d(e);case"Dummy":return new u}throw new Error(`Unknown IR type: ${e[0]}`)};var n=i(1),s=i(6);const r={FILL:"Fill",STROKE:"Stroke",SHADING:"Shading"};function a(e,t){if(!t)return;const i=t[2]-t[0],n=t[3]-t[1],s=new Path2D;s.rect(t[0],t[1],i,n),e.clip(s)}t.PathType=r;class o{constructor(){this.constructor===o&&(0,n.unreachable)("Cannot initialize BaseShadingPattern.")}getPattern(){(0,n.unreachable)("Abstract method `getPattern` called.")}}class l extends o{constructor(e){super(),this._type=e[1],this._bbox=e[2],this._colorStops=e[3],this._p0=e[4],this._p1=e[5],this._r0=e[6],this._r1=e[7],this.matrix=null}_createGradient(e){let t;"axial"===this._type?t=e.createLinearGradient(this._p0[0],this._p0[1],this._p1[0],this._p1[1]):"radial"===this._type&&(t=e.createRadialGradient(this._p0[0],this._p0[1],this._r0,this._p1[0],this._p1[1],this._r1));for(const e of this._colorStops)t.addColorStop(e[0],e[1]);return t}getPattern(e,t,i,o){let l;if(o===r.STROKE||o===r.FILL){const r=t.current.getClippedPathBoundingBox(o,(0,s.getCurrentTransform)(e))||[0,0,0,0],c=Math.ceil(r[2]-r[0])||1,h=Math.ceil(r[3]-r[1])||1,d=t.cachedCanvases.getCanvas("pattern",c,h,!0),u=d.context;u.clearRect(0,0,u.canvas.width,u.canvas.height),u.beginPath(),u.rect(0,0,u.canvas.width,u.canvas.height),u.translate(-r[0],-r[1]),i=n.Util.transform(i,[1,0,0,1,r[0],r[1]]),u.transform(...t.baseTransform),this.matrix&&u.transform(...this.matrix),a(u,this._bbox),u.fillStyle=this._createGradient(u),u.fill(),l=e.createPattern(d.canvas,"no-repeat");const p=new DOMMatrix(i);l.setTransform(p)}else a(e,this._bbox),l=this._createGradient(e);return l}}function c(e,t,i,n,s,r,a,o){const l=t.coords,c=t.colors,h=e.data,d=4*e.width;let u;l[i+1]>l[n+1]&&(u=i,i=n,n=u,u=r,r=a,a=u),l[n+1]>l[s+1]&&(u=n,n=s,s=u,u=a,a=o,o=u),l[i+1]>l[n+1]&&(u=i,i=n,n=u,u=r,r=a,a=u);const p=(l[i]+t.offsetX)*t.scaleX,g=(l[i+1]+t.offsetY)*t.scaleY,f=(l[n]+t.offsetX)*t.scaleX,m=(l[n+1]+t.offsetY)*t.scaleY,_=(l[s]+t.offsetX)*t.scaleX,v=(l[s+1]+t.offsetY)*t.scaleY;if(g>=v)return;const b=c[r],y=c[r+1],S=c[r+2],P=c[a],A=c[a+1],w=c[a+2],E=c[o],C=c[o+1],x=c[o+2],M=Math.round(g),T=Math.round(v);let F,D,k,R,L,I,O,N;for(let e=M;e<=T;e++){if(e<m){let t;t=e<g?0:(g-e)/(g-m),F=p-(p-f)*t,D=b-(b-P)*t,k=y-(y-A)*t,R=S-(S-w)*t}else{let t;t=e>v?1:m===v?0:(m-e)/(m-v),F=f-(f-_)*t,D=P-(P-E)*t,k=A-(A-C)*t,R=w-(w-x)*t}let t;t=e<g?0:e>v?1:(g-e)/(g-v),L=p-(p-_)*t,I=b-(b-E)*t,O=y-(y-C)*t,N=S-(S-x)*t;const i=Math.round(Math.min(F,L)),n=Math.round(Math.max(F,L));let s=d*e+4*i;for(let e=i;e<=n;e++)t=(F-e)/(F-L),t<0?t=0:t>1&&(t=1),h[s++]=D-(D-I)*t|0,h[s++]=k-(k-O)*t|0,h[s++]=R-(R-N)*t|0,h[s++]=255}}function h(e,t,i){const n=t.coords,s=t.colors;let r,a;switch(t.type){case"lattice":const o=t.verticesPerRow,l=Math.floor(n.length/o)-1,h=o-1;for(r=0;r<l;r++){let t=r*o;for(let r=0;r<h;r++,t++)c(e,i,n[t],n[t+1],n[t+o],s[t],s[t+1],s[t+o]),c(e,i,n[t+o+1],n[t+1],n[t+o],s[t+o+1],s[t+1],s[t+o])}break;case"triangles":for(r=0,a=n.length;r<a;r+=3)c(e,i,n[r],n[r+1],n[r+2],s[r],s[r+1],s[r+2]);break;default:throw new Error("illegal figure")}}class d extends o{constructor(e){super(),this._coords=e[2],this._colors=e[3],this._figures=e[4],this._bounds=e[5],this._bbox=e[7],this._background=e[8],this.matrix=null}_createMeshCanvas(e,t,i){const n=Math.floor(this._bounds[0]),s=Math.floor(this._bounds[1]),r=Math.ceil(this._bounds[2])-n,a=Math.ceil(this._bounds[3])-s,o=Math.min(Math.ceil(Math.abs(r*e[0]*1.1)),3e3),l=Math.min(Math.ceil(Math.abs(a*e[1]*1.1)),3e3),c=r/o,d=a/l,u={coords:this._coords,colors:this._colors,offsetX:-n,offsetY:-s,scaleX:1/c,scaleY:1/d},p=o+4,g=l+4,f=i.getCanvas("mesh",p,g,!1),m=f.context,_=m.createImageData(o,l);if(t){const e=_.data;for(let i=0,n=e.length;i<n;i+=4)e[i]=t[0],e[i+1]=t[1],e[i+2]=t[2],e[i+3]=255}for(const e of this._figures)h(_,e,u);return m.putImageData(_,2,2),{canvas:f.canvas,offsetX:n-2*c,offsetY:s-2*d,scaleX:c,scaleY:d}}getPattern(e,t,i,o){let l;if(a(e,this._bbox),o===r.SHADING)l=n.Util.singularValueDecompose2dScale((0,s.getCurrentTransform)(e));else if(l=n.Util.singularValueDecompose2dScale(t.baseTransform),this.matrix){const e=n.Util.singularValueDecompose2dScale(this.matrix);l=[l[0]*e[0],l[1]*e[1]]}const c=this._createMeshCanvas(l,o===r.SHADING?null:this._background,t.cachedCanvases);return o!==r.SHADING&&(e.setTransform(...t.baseTransform),this.matrix&&e.transform(...this.matrix)),e.translate(c.offsetX,c.offsetY),e.scale(c.scaleX,c.scaleY),e.createPattern(c.canvas,"no-repeat")}}class u extends o{getPattern(){return"hotpink"}}const p=1,g=2;class f{static get MAX_PATTERN_SIZE(){return(0,n.shadow)(this,"MAX_PATTERN_SIZE",3e3)}constructor(e,t,i,n,s){this.operatorList=e[2],this.matrix=e[3]||[1,0,0,1,0,0],this.bbox=e[4],this.xstep=e[5],this.ystep=e[6],this.paintType=e[7],this.tilingType=e[8],this.color=t,this.ctx=i,this.canvasGraphicsFactory=n,this.baseTransform=s}createPatternCanvas(e){const t=this.operatorList,i=this.bbox,r=this.xstep,a=this.ystep,o=this.paintType,l=this.tilingType,c=this.color,h=this.canvasGraphicsFactory;(0,n.info)("TilingType: "+l);const d=i[0],u=i[1],p=i[2],g=i[3],f=n.Util.singularValueDecompose2dScale(this.matrix),m=n.Util.singularValueDecompose2dScale(this.baseTransform),_=[f[0]*m[0],f[1]*m[1]],v=this.getSizeAndScale(r,this.ctx.canvas.width,_[0]),b=this.getSizeAndScale(a,this.ctx.canvas.height,_[1]),y=e.cachedCanvases.getCanvas("pattern",v.size,b.size,!0),S=y.context,P=h.createCanvasGraphics(S);P.groupLevel=e.groupLevel,this.setFillAndStrokeStyleToContext(P,o,c);let A=d,w=u,E=p,C=g;return d<0&&(A=0,E+=Math.abs(d)),u<0&&(w=0,C+=Math.abs(u)),S.translate(-v.scale*A,-b.scale*w),P.transform(v.scale,0,0,b.scale,0,0),S.save(),this.clipBbox(P,A,w,E,C),P.baseTransform=(0,s.getCurrentTransform)(P.ctx),P.executeOperatorList(t),P.endDrawing(),{canvas:y.canvas,scaleX:v.scale,scaleY:b.scale,offsetX:A,offsetY:w}}getSizeAndScale(e,t,i){e=Math.abs(e);const n=Math.max(f.MAX_PATTERN_SIZE,t);let s=Math.ceil(e*i);return s>=n?s=n:i=s/e,{scale:i,size:s}}clipBbox(e,t,i,n,r){const a=n-t,o=r-i;e.ctx.rect(t,i,a,o),e.current.updateRectMinMax((0,s.getCurrentTransform)(e.ctx),[t,i,n,r]),e.clip(),e.endPath()}setFillAndStrokeStyleToContext(e,t,i){const s=e.ctx,r=e.current;switch(t){case p:const e=this.ctx;s.fillStyle=e.fillStyle,s.strokeStyle=e.strokeStyle,r.fillColor=e.fillStyle,r.strokeColor=e.strokeStyle;break;case g:const a=n.Util.makeHexColor(i[0],i[1],i[2]);s.fillStyle=a,s.strokeStyle=a,r.fillColor=a,r.strokeColor=a;break;default:throw new n.FormatError(`Unsupported paint type: ${t}`)}}getPattern(e,t,i,s){let a=i;s!==r.SHADING&&(a=n.Util.transform(a,t.baseTransform),this.matrix&&(a=n.Util.transform(a,this.matrix)));const o=this.createPatternCanvas(t);let l=new DOMMatrix(a);l=l.translate(o.offsetX,o.offsetY),l=l.scale(1/o.scaleX,1/o.scaleY);const c=e.createPattern(o.canvas,"repeat");return c.setTransform(l),c}}t.TilingPattern=f},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.convertBlackAndWhiteToRGBA=s,t.convertToRGBA=function(e){switch(e.kind){case n.ImageKind.GRAYSCALE_1BPP:return s(e);case n.ImageKind.RGB_24BPP:return function({src:e,srcPos:t=0,dest:i,destPos:s=0,width:r,height:a}){let o=0;const l=e.length>>2,c=new Uint32Array(e.buffer,t,l);if(n.FeatureTest.isLittleEndian){for(;o<l-2;o+=3,s+=4){const e=c[o],t=c[o+1],n=c[o+2];i[s]=4278190080|e,i[s+1]=e>>>24|t<<8|4278190080,i[s+2]=t>>>16|n<<16|4278190080,i[s+3]=n>>>8|4278190080}for(let t=4*o,n=e.length;t<n;t+=3)i[s++]=e[t]|e[t+1]<<8|e[t+2]<<16|4278190080}else{for(;o<l-2;o+=3,s+=4){const e=c[o],t=c[o+1],n=c[o+2];i[s]=255|e,i[s+1]=e<<24|t>>>8|255,i[s+2]=t<<16|n>>>16|255,i[s+3]=n<<8|255}for(let t=4*o,n=e.length;t<n;t+=3)i[s++]=e[t]<<24|e[t+1]<<16|e[t+2]<<8|255}return{srcPos:t,destPos:s}}(e)}return null},t.grayToRGBA=function(e,t){if(n.FeatureTest.isLittleEndian)for(let i=0,n=e.length;i<n;i++)t[i]=65793*e[i]|4278190080;else for(let i=0,n=e.length;i<n;i++)t[i]=16843008*e[i]|255};var n=i(1);function s({src:e,srcPos:t=0,dest:i,width:s,height:r,nonBlackColor:a=4294967295,inverseDecode:o=!1}){const l=n.FeatureTest.isLittleEndian?4278190080:255,[c,h]=o?[a,l]:[l,a],d=s>>3,u=7&s,p=e.length;i=new Uint32Array(i.buffer);let g=0;for(let n=0;n<r;n++){for(const n=t+d;t<n;t++){const n=t<p?e[t]:255;i[g++]=128&n?h:c,i[g++]=64&n?h:c,i[g++]=32&n?h:c,i[g++]=16&n?h:c,i[g++]=8&n?h:c,i[g++]=4&n?h:c,i[g++]=2&n?h:c,i[g++]=1&n?h:c}if(0===u)continue;const n=t<p?e[t++]:255;for(let e=0;e<u;e++)i[g++]=n&1<<7-e?h:c}return{srcPos:t,destPos:g}}},(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.GlobalWorkerOptions=void 0;const i=Object.create(null);t.GlobalWorkerOptions=i,i.workerPort=null,i.workerSrc=""},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.MessageHandler=void 0;var n=i(1);const s=1,r=2,a=1,o=2,l=3,c=4,h=5,d=6,u=7,p=8;function g(e){switch(e instanceof Error||"object"==typeof e&&null!==e||(0,n.unreachable)('wrapReason: Expected "reason" to be a (possibly cloned) Error.'),e.name){case"AbortException":return new n.AbortException(e.message);case"MissingPDFException":return new n.MissingPDFException(e.message);case"PasswordException":return new n.PasswordException(e.message,e.code);case"UnexpectedResponseException":return new n.UnexpectedResponseException(e.message,e.status);case"UnknownErrorException":return new n.UnknownErrorException(e.message,e.details);default:return new n.UnknownErrorException(e.message,e.toString())}}t.MessageHandler=class{constructor(e,t,i){this.sourceName=e,this.targetName=t,this.comObj=i,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=e=>{const t=e.data;if(t.targetName!==this.sourceName)return;if(t.stream)return void this._processStreamMessage(t);if(t.callback){const e=t.callbackId,i=this.callbackCapabilities[e];if(!i)throw new Error(`Cannot resolve callback ${e}`);if(delete this.callbackCapabilities[e],t.callback===s)i.resolve(t.data);else{if(t.callback!==r)throw new Error("Unexpected callback case");i.reject(g(t.reason))}return}const n=this.actionHandler[t.action];if(!n)throw new Error(`Unknown action from worker: ${t.action}`);if(t.callbackId){const e=this.sourceName,a=t.sourceName;new Promise((function(e){e(n(t.data))})).then((function(n){i.postMessage({sourceName:e,targetName:a,callback:s,callbackId:t.callbackId,data:n})}),(function(n){i.postMessage({sourceName:e,targetName:a,callback:r,callbackId:t.callbackId,reason:g(n)})}))}else t.streamId?this._createStreamSink(t):n(t.data)},i.addEventListener("message",this._onComObjOnMessage)}on(e,t){const i=this.actionHandler;if(i[e])throw new Error(`There is already an actionName called "${e}"`);i[e]=t}send(e,t,i){this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:e,data:t},i)}sendWithPromise(e,t,i){const s=this.callbackId++,r=(0,n.createPromiseCapability)();this.callbackCapabilities[s]=r;try{this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:e,callbackId:s,data:t},i)}catch(e){r.reject(e)}return r.promise}sendWithStream(e,t,i,s){const r=this.streamId++,o=this.sourceName,l=this.targetName,c=this.comObj;return new ReadableStream({start:i=>{const a=(0,n.createPromiseCapability)();return this.streamControllers[r]={controller:i,startCall:a,pullCall:null,cancelCall:null,isClosed:!1},c.postMessage({sourceName:o,targetName:l,action:e,streamId:r,data:t,desiredSize:i.desiredSize},s),a.promise},pull:e=>{const t=(0,n.createPromiseCapability)();return this.streamControllers[r].pullCall=t,c.postMessage({sourceName:o,targetName:l,stream:d,streamId:r,desiredSize:e.desiredSize}),t.promise},cancel:e=>{(0,n.assert)(e instanceof Error,"cancel must have a valid reason");const t=(0,n.createPromiseCapability)();return this.streamControllers[r].cancelCall=t,this.streamControllers[r].isClosed=!0,c.postMessage({sourceName:o,targetName:l,stream:a,streamId:r,reason:g(e)}),t.promise}},i)}_createStreamSink(e){const t=e.streamId,i=this.sourceName,s=e.sourceName,r=this.comObj,a=this,o=this.actionHandler[e.action],d={enqueue(e,a=1,o){if(this.isCancelled)return;const l=this.desiredSize;this.desiredSize-=a,l>0&&this.desiredSize<=0&&(this.sinkCapability=(0,n.createPromiseCapability)(),this.ready=this.sinkCapability.promise),r.postMessage({sourceName:i,targetName:s,stream:c,streamId:t,chunk:e},o)},close(){this.isCancelled||(this.isCancelled=!0,r.postMessage({sourceName:i,targetName:s,stream:l,streamId:t}),delete a.streamSinks[t])},error(e){(0,n.assert)(e instanceof Error,"error must have a valid reason"),this.isCancelled||(this.isCancelled=!0,r.postMessage({sourceName:i,targetName:s,stream:h,streamId:t,reason:g(e)}))},sinkCapability:(0,n.createPromiseCapability)(),onPull:null,onCancel:null,isCancelled:!1,desiredSize:e.desiredSize,ready:null};d.sinkCapability.resolve(),d.ready=d.sinkCapability.promise,this.streamSinks[t]=d,new Promise((function(t){t(o(e.data,d))})).then((function(){r.postMessage({sourceName:i,targetName:s,stream:p,streamId:t,success:!0})}),(function(e){r.postMessage({sourceName:i,targetName:s,stream:p,streamId:t,reason:g(e)})}))}_processStreamMessage(e){const t=e.streamId,i=this.sourceName,s=e.sourceName,r=this.comObj,f=this.streamControllers[t],m=this.streamSinks[t];switch(e.stream){case p:e.success?f.startCall.resolve():f.startCall.reject(g(e.reason));break;case u:e.success?f.pullCall.resolve():f.pullCall.reject(g(e.reason));break;case d:if(!m){r.postMessage({sourceName:i,targetName:s,stream:u,streamId:t,success:!0});break}m.desiredSize<=0&&e.desiredSize>0&&m.sinkCapability.resolve(),m.desiredSize=e.desiredSize,new Promise((function(e){e(m.onPull&&m.onPull())})).then((function(){r.postMessage({sourceName:i,targetName:s,stream:u,streamId:t,success:!0})}),(function(e){r.postMessage({sourceName:i,targetName:s,stream:u,streamId:t,reason:g(e)})}));break;case c:if((0,n.assert)(f,"enqueue should have stream controller"),f.isClosed)break;f.controller.enqueue(e.chunk);break;case l:if((0,n.assert)(f,"close should have stream controller"),f.isClosed)break;f.isClosed=!0,f.controller.close(),this._deleteStreamController(f,t);break;case h:(0,n.assert)(f,"error should have stream controller"),f.controller.error(g(e.reason)),this._deleteStreamController(f,t);break;case o:e.success?f.cancelCall.resolve():f.cancelCall.reject(g(e.reason)),this._deleteStreamController(f,t);break;case a:if(!m)break;new Promise((function(t){t(m.onCancel&&m.onCancel(g(e.reason)))})).then((function(){r.postMessage({sourceName:i,targetName:s,stream:o,streamId:t,success:!0})}),(function(e){r.postMessage({sourceName:i,targetName:s,stream:o,streamId:t,reason:g(e)})})),m.sinkCapability.reject(g(e.reason)),m.isCancelled=!0,delete this.streamSinks[t];break;default:throw new Error("Unexpected stream case")}}async _deleteStreamController(e,t){await Promise.allSettled([e.startCall&&e.startCall.promise,e.pullCall&&e.pullCall.promise,e.cancelCall&&e.cancelCall.promise]),delete this.streamControllers[t]}destroy(){this.comObj.removeEventListener("message",this._onComObjOnMessage)}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Metadata=void 0;var n=i(1);t.Metadata=class{#Pe;#Ae;constructor({parsedData:e,rawData:t}){this.#Pe=e,this.#Ae=t}getRaw(){return this.#Ae}get(e){return this.#Pe.get(e)??null}getAll(){return(0,n.objectFromMap)(this.#Pe)}has(e){return this.#Pe.has(e)}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.OptionalContentConfig=void 0;var n=i(1),s=i(8);const r=Symbol("INTERNAL");class a{#we=!0;constructor(e,t){this.name=e,this.intent=t}get visible(){return this.#we}_setVisible(e,t){e!==r&&(0,n.unreachable)("Internal method `_setVisible` called."),this.#we=t}}t.OptionalContentConfig=class{#Ee=null;#Ce=new Map;#xe=null;#Me=null;constructor(e){if(this.name=null,this.creator=null,null!==e){this.name=e.name,this.creator=e.creator,this.#Me=e.order;for(const t of e.groups)this.#Ce.set(t.id,new a(t.name,t.intent));if("OFF"===e.baseState)for(const e of this.#Ce.values())e._setVisible(r,!1);for(const t of e.on)this.#Ce.get(t)._setVisible(r,!0);for(const t of e.off)this.#Ce.get(t)._setVisible(r,!1);this.#xe=this.getHash()}}#Te(e){const t=e.length;if(t<2)return!0;const i=e[0];for(let s=1;s<t;s++){const t=e[s];let r;if(Array.isArray(t))r=this.#Te(t);else{if(!this.#Ce.has(t))return(0,n.warn)(`Optional content group not found: ${t}`),!0;r=this.#Ce.get(t).visible}switch(i){case"And":if(!r)return!1;break;case"Or":if(r)return!0;break;case"Not":return!r;default:return!0}}return"And"===i}isVisible(e){if(0===this.#Ce.size)return!0;if(!e)return(0,n.warn)("Optional content group not defined."),!0;if("OCG"===e.type)return this.#Ce.has(e.id)?this.#Ce.get(e.id).visible:((0,n.warn)(`Optional content group not found: ${e.id}`),!0);if("OCMD"===e.type){if(e.expression)return this.#Te(e.expression);if(!e.policy||"AnyOn"===e.policy){for(const t of e.ids){if(!this.#Ce.has(t))return(0,n.warn)(`Optional content group not found: ${t}`),!0;if(this.#Ce.get(t).visible)return!0}return!1}if("AllOn"===e.policy){for(const t of e.ids){if(!this.#Ce.has(t))return(0,n.warn)(`Optional content group not found: ${t}`),!0;if(!this.#Ce.get(t).visible)return!1}return!0}if("AnyOff"===e.policy){for(const t of e.ids){if(!this.#Ce.has(t))return(0,n.warn)(`Optional content group not found: ${t}`),!0;if(!this.#Ce.get(t).visible)return!0}return!1}if("AllOff"===e.policy){for(const t of e.ids){if(!this.#Ce.has(t))return(0,n.warn)(`Optional content group not found: ${t}`),!0;if(this.#Ce.get(t).visible)return!1}return!0}return(0,n.warn)(`Unknown optional content policy ${e.policy}.`),!0}return(0,n.warn)(`Unknown group type ${e.type}.`),!0}setVisibility(e,t=!0){this.#Ce.has(e)?(this.#Ce.get(e)._setVisible(r,!!t),this.#Ee=null):(0,n.warn)(`Optional content group not found: ${e}`)}get hasInitialVisibility(){return this.getHash()===this.#xe}getOrder(){return this.#Ce.size?this.#Me?this.#Me.slice():[...this.#Ce.keys()]:null}getGroups(){return this.#Ce.size>0?(0,n.objectFromMap)(this.#Ce):null}getGroup(e){return this.#Ce.get(e)||null}getHash(){if(null!==this.#Ee)return this.#Ee;const e=new s.MurmurHash3_64;for(const[t,i]of this.#Ce)e.update(`${t}:${i.visible}`);return this.#Ee=e.hexdigest()}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PDFDataTransportStream=void 0;var n=i(1),s=i(6);t.PDFDataTransportStream=class{constructor({length:e,initialData:t,progressiveDone:i=!1,contentDispositionFilename:s=null,disableRange:r=!1,disableStream:a=!1},o){if((0,n.assert)(o,'PDFDataTransportStream - missing required "pdfDataRangeTransport" argument.'),this._queuedChunks=[],this._progressiveDone=i,this._contentDispositionFilename=s,t?.length>0){const e=t instanceof Uint8Array&&t.byteLength===t.buffer.byteLength?t.buffer:new Uint8Array(t).buffer;this._queuedChunks.push(e)}this._pdfDataRangeTransport=o,this._isStreamingSupported=!a,this._isRangeSupported=!r,this._contentLength=e,this._fullRequestReader=null,this._rangeReaders=[],this._pdfDataRangeTransport.addRangeListener(((e,t)=>{this._onReceiveData({begin:e,chunk:t})})),this._pdfDataRangeTransport.addProgressListener(((e,t)=>{this._onProgress({loaded:e,total:t})})),this._pdfDataRangeTransport.addProgressiveReadListener((e=>{this._onReceiveData({chunk:e})})),this._pdfDataRangeTransport.addProgressiveDoneListener((()=>{this._onProgressiveDone()})),this._pdfDataRangeTransport.transportReady()}_onReceiveData({begin:e,chunk:t}){const i=t instanceof Uint8Array&&t.byteLength===t.buffer.byteLength?t.buffer:new Uint8Array(t).buffer;if(void 0===e)this._fullRequestReader?this._fullRequestReader._enqueue(i):this._queuedChunks.push(i);else{const t=this._rangeReaders.some((function(t){return t._begin===e&&(t._enqueue(i),!0)}));(0,n.assert)(t,"_onReceiveData - no `PDFDataTransportStreamRangeReader` instance found.")}}get _progressiveDataLength(){return this._fullRequestReader?._loaded??0}_onProgress(e){void 0===e.total?this._rangeReaders[0]?.onProgress?.({loaded:e.loaded}):this._fullRequestReader?.onProgress?.({loaded:e.loaded,total:e.total})}_onProgressiveDone(){this._fullRequestReader?.progressiveDone(),this._progressiveDone=!0}_removeRangeReader(e){const t=this._rangeReaders.indexOf(e);t>=0&&this._rangeReaders.splice(t,1)}getFullReader(){(0,n.assert)(!this._fullRequestReader,"PDFDataTransportStream.getFullReader can only be called once.");const e=this._queuedChunks;return this._queuedChunks=null,new r(this,e,this._progressiveDone,this._contentDispositionFilename)}getRangeReader(e,t){if(t<=this._progressiveDataLength)return null;const i=new a(this,e,t);return this._pdfDataRangeTransport.requestDataRange(e,t),this._rangeReaders.push(i),i}cancelAllRequests(e){this._fullRequestReader?.cancel(e);for(const t of this._rangeReaders.slice(0))t.cancel(e);this._pdfDataRangeTransport.abort()}};class r{constructor(e,t,i=!1,n=null){this._stream=e,this._done=i||!1,this._filename=(0,s.isPdfFile)(n)?n:null,this._queuedChunks=t||[],this._loaded=0;for(const e of this._queuedChunks)this._loaded+=e.byteLength;this._requests=[],this._headersReady=Promise.resolve(),e._fullRequestReader=this,this.onProgress=null}_enqueue(e){this._done||(this._requests.length>0?this._requests.shift().resolve({value:e,done:!1}):this._queuedChunks.push(e),this._loaded+=e.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 e=(0,n.createPromiseCapability)();return this._requests.push(e),e.promise}cancel(e){this._done=!0;for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0}progressiveDone(){this._done||(this._done=!0)}}class a{constructor(e,t,i){this._stream=e,this._begin=t,this._end=i,this._queuedChunk=null,this._requests=[],this._done=!1,this.onProgress=null}_enqueue(e){if(!this._done){if(0===this._requests.length)this._queuedChunk=e;else{this._requests.shift().resolve({value:e,done:!1});for(const e of this._requests)e.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 e=this._queuedChunk;return this._queuedChunk=null,{value:e,done:!1}}if(this._done)return{value:void 0,done:!0};const e=(0,n.createPromiseCapability)();return this._requests.push(e),e.promise}cancel(e){this._done=!0;for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0,this._stream._removeRangeReader(this)}}},(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.XfaText=void 0;class i{static textContent(e){const t=[],n={items:t,styles:Object.create(null)};return function e(n){if(!n)return;let s=null;const r=n.name;if("#text"===r)s=n.value;else{if(!i.shouldBuildText(r))return;n?.attributes?.textContent?s=n.attributes.textContent:n.value&&(s=n.value)}if(null!==s&&t.push({str:s}),n.children)for(const t of n.children)e(t)}(e),n}static shouldBuildText(e){return!("textarea"===e||"input"===e||"option"===e||"select"===e)}}t.XfaText=i},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.NodeStandardFontDataFactory=t.NodeFilterFactory=t.NodeCanvasFactory=t.NodeCMapReaderFactory=void 0;var n=i(7);const s=function(e){return new Promise(((t,i)=>{require$$5.readFile(e,((e,n)=>{!e&&n?t(new Uint8Array(n)):i(new Error(e))}))}))};class r extends n.BaseFilterFactory{}t.NodeFilterFactory=r;class a extends n.BaseCanvasFactory{_createCanvas(e,t){return require$$5.createCanvas(e,t)}}t.NodeCanvasFactory=a;class o extends n.BaseCMapReaderFactory{_fetchData(e,t){return s(e).then((e=>({cMapData:e,compressionType:t})))}}t.NodeCMapReaderFactory=o;class l extends n.BaseStandardFontDataFactory{_fetchData(e){return s(e)}}t.NodeStandardFontDataFactory=l},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PDFNodeStream=void 0;var n=i(1),s=i(22);const r=require$$5,a=require$$5,o=require$$5,l=require$$5,c=/^file:\/\/\/[a-zA-Z]:\//;t.PDFNodeStream=class{constructor(e){this.source=e,this.url=function(e){const t=l.parse(e);return"file:"===t.protocol||t.host?t:/^[a-z]:[/\\]/i.test(e)?l.parse(`file:///${e}`):(t.host||(t.protocol="file:"),t)}(e.url),this.isHttp="http:"===this.url.protocol||"https:"===this.url.protocol,this.isFsUrl="file:"===this.url.protocol,this.httpHeaders=this.isHttp&&e.httpHeaders||{},this._fullRequestReader=null,this._rangeRequestReaders=[]}get _progressiveDataLength(){return this._fullRequestReader?._loaded??0}getFullReader(){return(0,n.assert)(!this._fullRequestReader,"PDFNodeStream.getFullReader can only be called once."),this._fullRequestReader=this.isFsUrl?new f(this):new p(this),this._fullRequestReader}getRangeReader(e,t){if(t<=this._progressiveDataLength)return null;const i=this.isFsUrl?new m(this,e,t):new g(this,e,t);return this._rangeRequestReaders.push(i),i}cancelAllRequests(e){this._fullRequestReader?.cancel(e);for(const t of this._rangeRequestReaders.slice(0))t.cancel(e)}};class h{constructor(e){this._url=e.url,this._done=!1,this._storedError=null,this.onProgress=null;const t=e.source;this._contentLength=t.length,this._loaded=0,this._filename=null,this._disableRange=t.disableRange||!1,this._rangeChunkSize=t.rangeChunkSize,this._rangeChunkSize||this._disableRange||(this._disableRange=!0),this._isStreamingSupported=!t.disableStream,this._isRangeSupported=!t.disableRange,this._readableStream=null,this._readCapability=(0,n.createPromiseCapability)(),this._headersCapability=(0,n.createPromiseCapability)()}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(){if(await this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;const e=this._readableStream.read();return null===e?(this._readCapability=(0,n.createPromiseCapability)(),this.read()):(this._loaded+=e.length,this.onProgress?.({loaded:this._loaded,total:this._contentLength}),{value:new Uint8Array(e).buffer,done:!1})}cancel(e){this._readableStream?this._readableStream.destroy(e):this._error(e)}_error(e){this._storedError=e,this._readCapability.resolve()}_setReadableStream(e){this._readableStream=e,e.on("readable",(()=>{this._readCapability.resolve()})),e.on("end",(()=>{e.destroy(),this._done=!0,this._readCapability.resolve()})),e.on("error",(e=>{this._error(e)})),!this._isStreamingSupported&&this._isRangeSupported&&this._error(new n.AbortException("streaming is disabled")),this._storedError&&this._readableStream.destroy(this._storedError)}}class d{constructor(e){this._url=e.url,this._done=!1,this._storedError=null,this.onProgress=null,this._loaded=0,this._readableStream=null,this._readCapability=(0,n.createPromiseCapability)();const t=e.source;this._isStreamingSupported=!t.disableStream}get isStreamingSupported(){return this._isStreamingSupported}async read(){if(await this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;const e=this._readableStream.read();return null===e?(this._readCapability=(0,n.createPromiseCapability)(),this.read()):(this._loaded+=e.length,this.onProgress?.({loaded:this._loaded}),{value:new Uint8Array(e).buffer,done:!1})}cancel(e){this._readableStream?this._readableStream.destroy(e):this._error(e)}_error(e){this._storedError=e,this._readCapability.resolve()}_setReadableStream(e){this._readableStream=e,e.on("readable",(()=>{this._readCapability.resolve()})),e.on("end",(()=>{e.destroy(),this._done=!0,this._readCapability.resolve()})),e.on("error",(e=>{this._error(e)})),this._storedError&&this._readableStream.destroy(this._storedError)}}function u(e,t){return{protocol:e.protocol,auth:e.auth,host:e.hostname,port:e.port,path:e.path,method:"GET",headers:t}}class p extends h{constructor(e){super(e);const t=t=>{if(404===t.statusCode){const e=new n.MissingPDFException(`Missing PDF "${this._url}".`);return this._storedError=e,void this._headersCapability.reject(e)}this._headersCapability.resolve(),this._setReadableStream(t);const i=e=>this._readableStream.headers[e.toLowerCase()],{allowRangeRequests:r,suggestedLength:a}=(0,s.validateRangeRequestCapabilities)({getResponseHeader:i,isHttp:e.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=r,this._contentLength=a||this._contentLength,this._filename=(0,s.extractFilenameFromHeader)(i)};this._request=null,"http:"===this._url.protocol?this._request=a.request(u(this._url,e.httpHeaders),t):this._request=o.request(u(this._url,e.httpHeaders),t),this._request.on("error",(e=>{this._storedError=e,this._headersCapability.reject(e)})),this._request.end()}}class g extends d{constructor(e,t,i){super(e),this._httpHeaders={};for(const t in e.httpHeaders){const i=e.httpHeaders[t];void 0!==i&&(this._httpHeaders[t]=i)}this._httpHeaders.Range=`bytes=${t}-${i-1}`;const s=e=>{if(404!==e.statusCode)this._setReadableStream(e);else{const e=new n.MissingPDFException(`Missing PDF "${this._url}".`);this._storedError=e}};this._request=null,"http:"===this._url.protocol?this._request=a.request(u(this._url,this._httpHeaders),s):this._request=o.request(u(this._url,this._httpHeaders),s),this._request.on("error",(e=>{this._storedError=e})),this._request.end()}}class f extends h{constructor(e){super(e);let t=decodeURIComponent(this._url.path);c.test(this._url.href)&&(t=t.replace(/^\//,"")),r.lstat(t,((e,i)=>{if(e)return"ENOENT"===e.code&&(e=new n.MissingPDFException(`Missing PDF "${t}".`)),this._storedError=e,void this._headersCapability.reject(e);this._contentLength=i.size,this._setReadableStream(r.createReadStream(t)),this._headersCapability.resolve()}))}}class m extends d{constructor(e,t,i){super(e);let n=decodeURIComponent(this._url.path);c.test(this._url.href)&&(n=n.replace(/^\//,"")),this._setReadableStream(r.createReadStream(n,{start:t,end:i-1}))}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createResponseStatusError=function(e,t){return 404===e||0===e&&t.startsWith("file:")?new n.MissingPDFException('Missing PDF "'+t+'".'):new n.UnexpectedResponseException(`Unexpected server response (${e}) while retrieving PDF "${t}".`,e)},t.extractFilenameFromHeader=function(e){const t=e("Content-Disposition");if(t){let e=(0,s.getFilenameFromContentDispositionHeader)(t);if(e.includes("%"))try{e=decodeURIComponent(e)}catch(e){}if((0,r.isPdfFile)(e))return e}return null},t.validateRangeRequestCapabilities=function({getResponseHeader:e,isHttp:t,rangeChunkSize:i,disableRange:n}){const s={allowRangeRequests:!1,suggestedLength:void 0},r=parseInt(e("Content-Length"),10);return Number.isInteger(r)?(s.suggestedLength=r,r<=2*i||n||!t||"bytes"!==e("Accept-Ranges")||"identity"!==(e("Content-Encoding")||"identity")||(s.allowRangeRequests=!0),s):s},t.validateResponseStatus=function(e){return 200===e||206===e};var n=i(1),s=i(23),r=i(6)},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getFilenameFromContentDispositionHeader=function(e){let t=!0,i=s("filename\\*","i").exec(e);if(i){i=i[1];let e=o(i);return e=unescape(e),e=l(e),e=c(e),a(e)}if(i=function(e){const t=[];let i;const n=s("filename\\*((?!0\\d)\\d+)(\\*?)","ig");for(;null!==(i=n.exec(e));){let[,e,n,s]=i;if(e=parseInt(e,10),e in t){if(0===e)break}else t[e]=[n,s]}const r=[];for(let e=0;e<t.length&&e in t;++e){let[i,n]=t[e];n=o(n),i&&(n=unescape(n),0===e&&(n=l(n))),r.push(n)}return r.join("")}(e),i)return a(c(i));if(i=s("filename","i").exec(e),i){i=i[1];let e=o(i);return e=c(e),a(e)}function s(e,t){return new RegExp("(?:^|;)\\s*"+e+'\\s*=\\s*([^";\\s][^;\\s]*|"(?:[^"\\\\]|\\\\"?)+"?)',t)}function r(e,i){if(e){if(!/^[\x00-\xFF]+$/.test(i))return i;try{const s=new TextDecoder(e,{fatal:!0}),r=(0,n.stringToBytes)(i);i=s.decode(r),t=!1}catch(e){}}return i}function a(e){return t&&/[\x80-\xff]/.test(e)&&(e=r("utf-8",e),t&&(e=r("iso-8859-1",e))),e}function o(e){if(e.startsWith('"')){const t=e.slice(1).split('\\"');for(let e=0;e<t.length;++e){const i=t[e].indexOf('"');-1!==i&&(t[e]=t[e].slice(0,i),t.length=e+1),t[e]=t[e].replaceAll(/\\(.)/g,"$1")}e=t.join('"')}return e}function l(e){const t=e.indexOf("'");return-1===t?e:r(e.slice(0,t),e.slice(t+1).replace(/^[^']*'/,""))}function c(e){return!e.startsWith("=?")||/[\x00-\x19\x80-\xff]/.test(e)?e:e.replaceAll(/=\?([\w-]*)\?([QqBb])\?((?:[^?]|\?(?!=))*)\?=/g,(function(e,t,i,n){if("q"===i||"Q"===i)return r(t,n=(n=n.replaceAll("_"," ")).replaceAll(/=([0-9a-fA-F]{2})/g,(function(e,t){return String.fromCharCode(parseInt(t,16))})));try{n=atob(n)}catch(e){}return r(t,n)}))}return""};var n=i(1)},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PDFNetworkStream=void 0;var n=i(1),s=i(22);class r{constructor(e,t={}){this.url=e,this.isHttp=/^https?:/i.test(e),this.httpHeaders=this.isHttp&&t.httpHeaders||Object.create(null),this.withCredentials=t.withCredentials||!1,this.getXhr=t.getXhr||function(){return new XMLHttpRequest},this.currXhrId=0,this.pendingRequests=Object.create(null)}requestRange(e,t,i){const n={begin:e,end:t};for(const e in i)n[e]=i[e];return this.request(n)}requestFull(e){return this.request(e)}request(e){const t=this.getXhr(),i=this.currXhrId++,n=this.pendingRequests[i]={xhr:t};t.open("GET",this.url),t.withCredentials=this.withCredentials;for(const e in this.httpHeaders){const i=this.httpHeaders[e];void 0!==i&&t.setRequestHeader(e,i)}return this.isHttp&&"begin"in e&&"end"in e?(t.setRequestHeader("Range",`bytes=${e.begin}-${e.end-1}`),n.expectedStatus=206):n.expectedStatus=200,t.responseType="arraybuffer",e.onError&&(t.onerror=function(i){e.onError(t.status)}),t.onreadystatechange=this.onStateChange.bind(this,i),t.onprogress=this.onProgress.bind(this,i),n.onHeadersReceived=e.onHeadersReceived,n.onDone=e.onDone,n.onError=e.onError,n.onProgress=e.onProgress,t.send(null),i}onProgress(e,t){const i=this.pendingRequests[e];i&&i.onProgress?.(t)}onStateChange(e,t){const i=this.pendingRequests[e];if(!i)return;const s=i.xhr;if(s.readyState>=2&&i.onHeadersReceived&&(i.onHeadersReceived(),delete i.onHeadersReceived),4!==s.readyState)return;if(!(e in this.pendingRequests))return;if(delete this.pendingRequests[e],0===s.status&&this.isHttp)return void i.onError?.(s.status);const r=s.status||200;if((200!==r||206!==i.expectedStatus)&&r!==i.expectedStatus)return void i.onError?.(s.status);const a=function(e){const t=e.response;return"string"!=typeof t?t:(0,n.stringToBytes)(t).buffer}(s);if(206===r){const e=s.getResponseHeader("Content-Range"),t=/bytes (\d+)-(\d+)\/(\d+)/.exec(e);i.onDone({begin:parseInt(t[1],10),chunk:a})}else a?i.onDone({begin:0,chunk:a}):i.onError?.(s.status)}getRequestXhr(e){return this.pendingRequests[e].xhr}isPendingRequest(e){return e in this.pendingRequests}abortRequest(e){const t=this.pendingRequests[e].xhr;delete this.pendingRequests[e],t.abort()}}t.PDFNetworkStream=class{constructor(e){this._source=e,this._manager=new r(e.url,{httpHeaders:e.httpHeaders,withCredentials:e.withCredentials}),this._rangeChunkSize=e.rangeChunkSize,this._fullRequestReader=null,this._rangeRequestReaders=[]}_onRangeRequestReaderClosed(e){const t=this._rangeRequestReaders.indexOf(e);t>=0&&this._rangeRequestReaders.splice(t,1)}getFullReader(){return(0,n.assert)(!this._fullRequestReader,"PDFNetworkStream.getFullReader can only be called once."),this._fullRequestReader=new a(this._manager,this._source),this._fullRequestReader}getRangeReader(e,t){const i=new o(this._manager,e,t);return i.onClosed=this._onRangeRequestReaderClosed.bind(this),this._rangeRequestReaders.push(i),i}cancelAllRequests(e){this._fullRequestReader?.cancel(e);for(const t of this._rangeRequestReaders.slice(0))t.cancel(e)}};class a{constructor(e,t){this._manager=e;const i={onHeadersReceived:this._onHeadersReceived.bind(this),onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)};this._url=t.url,this._fullRequestId=e.requestFull(i),this._headersReceivedCapability=(0,n.createPromiseCapability)(),this._disableRange=t.disableRange||!1,this._contentLength=t.length,this._rangeChunkSize=t.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 e=this._fullRequestId,t=this._manager.getRequestXhr(e),i=e=>t.getResponseHeader(e),{allowRangeRequests:n,suggestedLength:r}=(0,s.validateRangeRequestCapabilities)({getResponseHeader:i,isHttp:this._manager.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});n&&(this._isRangeSupported=!0),this._contentLength=r||this._contentLength,this._filename=(0,s.extractFilenameFromHeader)(i),this._isRangeSupported&&this._manager.abortRequest(e),this._headersReceivedCapability.resolve()}_onDone(e){if(e&&(this._requests.length>0?this._requests.shift().resolve({value:e.chunk,done:!1}):this._cachedChunks.push(e.chunk)),this._done=!0,!(this._cachedChunks.length>0)){for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0}}_onError(e){this._storedError=(0,s.createResponseStatusError)(e,this._url),this._headersReceivedCapability.reject(this._storedError);for(const e of this._requests)e.reject(this._storedError);this._requests.length=0,this._cachedChunks.length=0}_onProgress(e){this.onProgress?.({loaded:e.loaded,total:e.lengthComputable?e.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 e=(0,n.createPromiseCapability)();return this._requests.push(e),e.promise}cancel(e){this._done=!0,this._headersReceivedCapability.reject(e);for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._fullRequestId)&&this._manager.abortRequest(this._fullRequestId),this._fullRequestReader=null}}class o{constructor(e,t,i){this._manager=e;const n={onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)};this._url=e.url,this._requestId=e.requestRange(t,i,n),this._requests=[],this._queuedChunk=null,this._done=!1,this._storedError=void 0,this.onProgress=null,this.onClosed=null}_close(){this.onClosed?.(this)}_onDone(e){const t=e.chunk;this._requests.length>0?this._requests.shift().resolve({value:t,done:!1}):this._queuedChunk=t,this._done=!0;for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0,this._close()}_onError(e){this._storedError=(0,s.createResponseStatusError)(e,this._url);for(const e of this._requests)e.reject(this._storedError);this._requests.length=0,this._queuedChunk=null}_onProgress(e){this.isStreamingSupported||this.onProgress?.({loaded:e.loaded})}get isStreamingSupported(){return!1}async read(){if(this._storedError)throw this._storedError;if(null!==this._queuedChunk){const e=this._queuedChunk;return this._queuedChunk=null,{value:e,done:!1}}if(this._done)return{value:void 0,done:!0};const e=(0,n.createPromiseCapability)();return this._requests.push(e),e.promise}cancel(e){this._done=!0;for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._requestId)&&this._manager.abortRequest(this._requestId),this._close()}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PDFFetchStream=void 0;var n=i(1),s=i(22);function r(e,t,i){return{method:"GET",headers:e,signal:i.signal,mode:"cors",credentials:t?"include":"same-origin",redirect:"follow"}}function a(e){const t=new Headers;for(const i in e){const n=e[i];void 0!==n&&t.append(i,n)}return t}function o(e){return e instanceof Uint8Array?e.buffer:e instanceof ArrayBuffer?e:((0,n.warn)(`getArrayBuffer - unexpected data format: ${e}`),new Uint8Array(e).buffer)}t.PDFFetchStream=class{constructor(e){this.source=e,this.isHttp=/^https?:/i.test(e.url),this.httpHeaders=this.isHttp&&e.httpHeaders||{},this._fullRequestReader=null,this._rangeRequestReaders=[]}get _progressiveDataLength(){return this._fullRequestReader?._loaded??0}getFullReader(){return(0,n.assert)(!this._fullRequestReader,"PDFFetchStream.getFullReader can only be called once."),this._fullRequestReader=new l(this),this._fullRequestReader}getRangeReader(e,t){if(t<=this._progressiveDataLength)return null;const i=new c(this,e,t);return this._rangeRequestReaders.push(i),i}cancelAllRequests(e){this._fullRequestReader?.cancel(e);for(const t of this._rangeRequestReaders.slice(0))t.cancel(e)}};class l{constructor(e){this._stream=e,this._reader=null,this._loaded=0,this._filename=null;const t=e.source;this._withCredentials=t.withCredentials||!1,this._contentLength=t.length,this._headersCapability=(0,n.createPromiseCapability)(),this._disableRange=t.disableRange||!1,this._rangeChunkSize=t.rangeChunkSize,this._rangeChunkSize||this._disableRange||(this._disableRange=!0),this._abortController=new AbortController,this._isStreamingSupported=!t.disableStream,this._isRangeSupported=!t.disableRange,this._headers=a(this._stream.httpHeaders);const i=t.url;fetch(i,r(this._headers,this._withCredentials,this._abortController)).then((e=>{if(!(0,s.validateResponseStatus)(e.status))throw(0,s.createResponseStatusError)(e.status,i);this._reader=e.body.getReader(),this._headersCapability.resolve();const t=t=>e.headers.get(t),{allowRangeRequests:r,suggestedLength:a}=(0,s.validateRangeRequestCapabilities)({getResponseHeader:t,isHttp:this._stream.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=r,this._contentLength=a||this._contentLength,this._filename=(0,s.extractFilenameFromHeader)(t),!this._isStreamingSupported&&this._isRangeSupported&&this.cancel(new n.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(){await this._headersCapability.promise;const{value:e,done:t}=await this._reader.read();return t?{value:e,done:t}:(this._loaded+=e.byteLength,this.onProgress?.({loaded:this._loaded,total:this._contentLength}),{value:o(e),done:!1})}cancel(e){this._reader?.cancel(e),this._abortController.abort()}}class c{constructor(e,t,i){this._stream=e,this._reader=null,this._loaded=0;const o=e.source;this._withCredentials=o.withCredentials||!1,this._readCapability=(0,n.createPromiseCapability)(),this._isStreamingSupported=!o.disableStream,this._abortController=new AbortController,this._headers=a(this._stream.httpHeaders),this._headers.append("Range",`bytes=${t}-${i-1}`);const l=o.url;fetch(l,r(this._headers,this._withCredentials,this._abortController)).then((e=>{if(!(0,s.validateResponseStatus)(e.status))throw(0,s.createResponseStatusError)(e.status,l);this._readCapability.resolve(),this._reader=e.body.getReader()})).catch(this._readCapability.reject),this.onProgress=null}get isStreamingSupported(){return this._isStreamingSupported}async read(){await this._readCapability.promise;const{value:e,done:t}=await this._reader.read();return t?{value:e,done:t}:(this._loaded+=e.byteLength,this.onProgress?.({loaded:this._loaded}),{value:o(e),done:!1})}cancel(e){this._reader?.cancel(e),this._abortController.abort()}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TextLayerRenderTask=void 0,t.renderTextLayer=function(e){e.textContentSource||!e.textContent&&!e.textContentStream||((0,s.deprecated)("The TextLayerRender `textContent`/`textContentStream` parameters will be removed in the future, please use `textContentSource` instead."),e.textContentSource=e.textContent||e.textContentStream);const{container:t,viewport:i}=e,n=getComputedStyle(t),r=n.getPropertyValue("visibility"),a=parseFloat(n.getPropertyValue("--scale-factor"));"visible"===r&&(!a||Math.abs(a-i.scale)>1e-15)&&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 d(e);return o._render(),o},t.updateTextLayer=function({container:e,viewport:t,textDivs:i,textDivProperties:n,isOffscreenCanvasSupported:r,mustRotate:a=!0,mustRescale:o=!0}){if(a&&(0,s.setLayerDimensions)(e,{rotation:t.rotation}),o){const e=l(0,r),s={prevFontSize:null,prevFontFamily:null,div:null,scale:t.scale*(globalThis.devicePixelRatio||1),properties:null,ctx:e};for(const e of i)s.properties=n.get(e),s.div=e,h(s)}};var n=i(1),s=i(6);const r=30,a=.8,o=new Map;function l(e,t){let i;if(t&&n.FeatureTest.isOffscreenCanvasSupported)i=new OffscreenCanvas(e,e).getContext("2d",{alpha:!1});else{const t=document.createElement("canvas");t.width=t.height=e,i=t.getContext("2d",{alpha:!1})}return i}function c(e,t,i){const s=document.createElement("span"),c={angle:0,canvasWidth:0,hasText:""!==t.str,hasEOL:t.hasEOL,fontSize:0};e._textDivs.push(s);const h=n.Util.transform(e._transform,t.transform);let d=Math.atan2(h[1],h[0]);const u=i[t.fontName];u.vertical&&(d+=Math.PI/2);const p=Math.hypot(h[2],h[3]),g=p*function(e,t){const i=o.get(e);if(i)return i;const n=l(r,t);n.font=`${r}px ${e}`;const s=n.measureText("");let c=s.fontBoundingBoxAscent,h=Math.abs(s.fontBoundingBoxDescent);if(c){const t=c/(c+h);return o.set(e,t),n.canvas.width=n.canvas.height=0,t}n.strokeStyle="red",n.clearRect(0,0,r,r),n.strokeText("g",0,0);let d=n.getImageData(0,0,r,r).data;h=0;for(let e=d.length-1-3;e>=0;e-=4)if(d[e]>0){h=Math.ceil(e/4/r);break}n.clearRect(0,0,r,r),n.strokeText("A",0,r),d=n.getImageData(0,0,r,r).data,c=0;for(let e=0,t=d.length;e<t;e+=4)if(d[e]>0){c=r-Math.floor(e/4/r);break}if(n.canvas.width=n.canvas.height=0,c){const t=c/(c+h);return o.set(e,t),t}return o.set(e,a),a}(u.fontFamily,e._isOffscreenCanvasSupported);let f,m;0===d?(f=h[4],m=h[5]-g):(f=h[4]+g*Math.sin(d),m=h[5]-g*Math.cos(d));const _="calc(var(--scale-factor)*",v=s.style;e._container===e._rootContainer?(v.left=`${(100*f/e._pageWidth).toFixed(2)}%`,v.top=`${(100*m/e._pageHeight).toFixed(2)}%`):(v.left=`${_}${f.toFixed(2)}px)`,v.top=`${_}${m.toFixed(2)}px)`),v.fontSize=`${_}${p.toFixed(2)}px)`,v.fontFamily=u.fontFamily,c.fontSize=p,s.setAttribute("role","presentation"),s.textContent=t.str,s.dir=t.dir,e._fontInspectorEnabled&&(s.dataset.fontName=t.fontName),0!==d&&(c.angle=d*(180/Math.PI));let b=!1;if(t.str.length>1)b=!0;else if(" "!==t.str&&t.transform[0]!==t.transform[3]){const e=Math.abs(t.transform[0]),i=Math.abs(t.transform[3]);e!==i&&Math.max(e,i)/Math.min(e,i)>1.5&&(b=!0)}b&&(c.canvasWidth=u.vertical?t.height:t.width),e._textDivProperties.set(s,c),e._isReadableStream&&e._layoutText(s)}function h(e){const{div:t,scale:i,properties:n,ctx:s,prevFontSize:r,prevFontFamily:a}=e,{style:o}=t;let l="";if(0!==n.canvasWidth&&n.hasText){const{fontFamily:c}=o,{canvasWidth:h,fontSize:d}=n;r===d&&a===c||(s.font=`${d*i}px ${c}`,e.prevFontSize=d,e.prevFontFamily=c);const{width:u}=s.measureText(t.textContent);u>0&&(l=`scaleX(${h*i/u})`)}0!==n.angle&&(l=`rotate(${n.angle}deg) ${l}`),l.length>0&&(o.transform=l)}class d{constructor({textContentSource:e,container:t,viewport:i,textDivs:r,textDivProperties:a,textContentItemsStr:o,isOffscreenCanvasSupported:c}){this._textContentSource=e,this._isReadableStream=e instanceof ReadableStream,this._container=this._rootContainer=t,this._textDivs=r||[],this._textContentItemsStr=o||[],this._isOffscreenCanvasSupported=c,this._fontInspectorEnabled=!!globalThis.FontInspector?.enabled,this._reader=null,this._textDivProperties=a||new WeakMap,this._canceled=!1,this._capability=(0,n.createPromiseCapability)(),this._layoutTextParams={prevFontSize:null,prevFontFamily:null,div:null,scale:i.scale*(globalThis.devicePixelRatio||1),properties:null,ctx:l(0,c)};const{pageWidth:h,pageHeight:d,pageX:u,pageY:p}=i.rawDims;this._transform=[1,0,0,-1,-u,p+d],this._pageWidth=h,this._pageHeight=d,(0,s.setLayerDimensions)(t,i),this._capability.promise.finally((()=>{this._layoutTextParams=null})).catch((()=>{}))}get promise(){return this._capability.promise}cancel(){this._canceled=!0,this._reader&&(this._reader.cancel(new n.AbortException("TextLayer task cancelled.")).catch((()=>{})),this._reader=null),this._capability.reject(new n.AbortException("TextLayer task cancelled."))}_processItems(e,t){for(const i of e)if(void 0!==i.str)this._textContentItemsStr.push(i.str),c(this,i,t);else if("beginMarkedContentProps"===i.type||"beginMarkedContent"===i.type){const e=this._container;this._container=document.createElement("span"),this._container.classList.add("markedContent"),null!==i.id&&this._container.setAttribute("id",`${i.id}`),e.append(this._container)}else"endMarkedContent"===i.type&&(this._container=this._container.parentNode)}_layoutText(e){const t=this._layoutTextParams.properties=this._textDivProperties.get(e);if(this._layoutTextParams.div=e,h(this._layoutTextParams),t.hasText&&this._container.append(e),t.hasEOL){const e=document.createElement("br");e.setAttribute("role","presentation"),this._container.append(e)}}_render(){const e=(0,n.createPromiseCapability)();let t=Object.create(null);if(this._isReadableStream){const i=()=>{this._reader.read().then((({value:n,done:s})=>{s?e.resolve():(Object.assign(t,n.styles),this._processItems(n.items,t),i())}),e.reject)};this._reader=this._textContentSource.getReader(),i()}else{if(!this._textContentSource)throw new Error('No "textContentSource" parameter specified.');{const{items:t,styles:i}=this._textContentSource;this._processItems(t,i),e.resolve()}}e.promise.then((()=>{t=null,function(e){if(e._canceled)return;const t=e._textDivs,i=e._capability;if(t.length>1e5)i.resolve();else{if(!e._isReadableStream)for(const i of t)e._layoutText(i);i.resolve()}}(this)}),this._capability.reject)}}t.TextLayerRenderTask=d},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.AnnotationEditorLayer=void 0;var n=i(1),s=i(5),r=i(28),a=i(29),o=i(6);class l{#Fe;#De=!1;#ke=this.pointerup.bind(this);#Re=this.pointerdown.bind(this);#Le=new Map;#Ie=!1;#Oe=!1;#Ne;static _initialized=!1;constructor(e){l._initialized||(l._initialized=!0,r.FreeTextEditor.initialize(e.l10n),a.InkEditor.initialize(e.l10n)),e.uiManager.registerEditorTypes([r.FreeTextEditor,a.InkEditor]),this.#Ne=e.uiManager,this.pageIndex=e.pageIndex,this.div=e.div,this.#Fe=e.accessibilityManager,this.#Ne.addLayer(this)}get isEmpty(){return 0===this.#Le.size}updateToolbar(e){this.#Ne.updateToolbar(e)}updateMode(e=this.#Ne.getMode()){this.#Ve(),e===n.AnnotationEditorType.INK?(this.addInkEditorIfNeeded(!1),this.disableClick()):this.enableClick(),this.#Ne.unselectAll(),e!==n.AnnotationEditorType.NONE&&(this.div.classList.toggle("freeTextEditing",e===n.AnnotationEditorType.FREETEXT),this.div.classList.toggle("inkEditing",e===n.AnnotationEditorType.INK),this.div.hidden=!1)}addInkEditorIfNeeded(e){if(e||this.#Ne.getMode()===n.AnnotationEditorType.INK){if(!e)for(const e of this.#Le.values())if(e.isEmpty())return void e.setInBackground();this.#Be({offsetX:0,offsetY:0}).setInBackground()}}setEditingState(e){this.#Ne.setEditingState(e)}addCommands(e){this.#Ne.addCommands(e)}enable(){this.div.style.pointerEvents="auto";for(const e of this.#Le.values())e.enableEditing()}disable(){this.div.style.pointerEvents="none";for(const e of this.#Le.values())e.disableEditing();this.#Ve(),this.isEmpty&&(this.div.hidden=!0)}setActiveEditor(e){this.#Ne.getActive()!==e&&this.#Ne.setActiveEditor(e)}enableClick(){this.div.addEventListener("pointerdown",this.#Re),this.div.addEventListener("pointerup",this.#ke)}disableClick(){this.div.removeEventListener("pointerdown",this.#Re),this.div.removeEventListener("pointerup",this.#ke)}attach(e){this.#Le.set(e.id,e)}detach(e){this.#Le.delete(e.id),this.#Fe?.removePointerInTextLayer(e.contentDiv)}remove(e){this.#Ne.removeEditor(e),this.detach(e),e.div.style.display="none",setTimeout((()=>{e.div.style.display="",e.div.remove(),e.isAttachedToDOM=!1,document.activeElement===document.body&&this.#Ne.focusMainContainer()}),0),this.#Oe||this.addInkEditorIfNeeded(!1)}#Ue(e){e.parent!==this&&(this.attach(e),e.parent?.detach(e),e.setParent(this),e.div&&e.isAttachedToDOM&&(e.div.remove(),this.div.append(e.div)))}add(e){if(this.#Ue(e),this.#Ne.addEditor(e),this.attach(e),!e.isAttachedToDOM){const t=e.render();this.div.append(t),e.isAttachedToDOM=!0}this.moveEditorInDOM(e),e.onceAdded(),this.#Ne.addToAnnotationStorage(e)}moveEditorInDOM(e){this.#Fe?.moveElementInDOM(this.div,e.div,e.contentDiv,!0)}addOrRebuild(e){e.needsToBeRebuilt()?e.rebuild():this.add(e)}addANewEditor(e){this.addCommands({cmd:()=>{this.addOrRebuild(e)},undo:()=>{e.remove()},mustExec:!0})}addUndoableEditor(e){this.addCommands({cmd:()=>{this.addOrRebuild(e)},undo:()=>{e.remove()},mustExec:!1})}getNextId(){return this.#Ne.getId()}#je(e){switch(this.#Ne.getMode()){case n.AnnotationEditorType.FREETEXT:return new r.FreeTextEditor(e);case n.AnnotationEditorType.INK:return new a.InkEditor(e)}return null}deserialize(e){switch(e.annotationType){case n.AnnotationEditorType.FREETEXT:return r.FreeTextEditor.deserialize(e,this,this.#Ne);case n.AnnotationEditorType.INK:return a.InkEditor.deserialize(e,this,this.#Ne)}return null}#Be(e){const t=this.getNextId(),i=this.#je({parent:this,id:t,x:e.offsetX,y:e.offsetY,uiManager:this.#Ne});return i&&this.add(i),i}setSelected(e){this.#Ne.setSelected(e)}toggleSelected(e){this.#Ne.toggleSelected(e)}isSelected(e){return this.#Ne.isSelected(e)}unselect(e){this.#Ne.unselect(e)}pointerup(e){const{isMac:t}=n.FeatureTest.platform;0!==e.button||e.ctrlKey&&t||e.target===this.div&&this.#Ie&&(this.#Ie=!1,this.#De?this.#Be(e):this.#De=!0)}pointerdown(e){const{isMac:t}=n.FeatureTest.platform;if(0!==e.button||e.ctrlKey&&t)return;if(e.target!==this.div)return;this.#Ie=!0;const i=this.#Ne.getActive();this.#De=!i||i.isEmpty()}drop(e){const t=e.dataTransfer.getData("text/plain"),i=this.#Ne.getEditor(t);if(!i)return;e.preventDefault(),e.dataTransfer.dropEffect="move",this.#Ue(i);const n=this.div.getBoundingClientRect(),s=e.clientX-n.x,r=e.clientY-n.y;i.translate(s-i.startX,r-i.startY),this.moveEditorInDOM(i),i.div.focus()}dragover(e){e.preventDefault()}destroy(){this.#Ne.getActive()?.parent===this&&this.#Ne.setActiveEditor(null);for(const e of this.#Le.values())this.#Fe?.removePointerInTextLayer(e.contentDiv),e.setParent(null),e.isAttachedToDOM=!1,e.div.remove();this.div=null,this.#Le.clear(),this.#Ne.removeLayer(this)}#Ve(){this.#Oe=!0;for(const e of this.#Le.values())e.isEmpty()&&e.remove();this.#Oe=!1}render({viewport:e}){this.viewport=e,(0,o.setLayerDimensions)(this.div,e),(0,s.bindEvents)(this,this.div,["dragover","drop"]);for(const e of this.#Ne.getEditors(this.pageIndex))this.add(e);this.updateMode()}update({viewport:e}){this.#Ne.commitOrRemove(),this.viewport=e,(0,o.setLayerDimensions)(this.div,{rotation:e.rotation}),this.updateMode()}get pageDimensions(){const{pageWidth:e,pageHeight:t}=this.viewport.rawDims;return[e,t]}}t.AnnotationEditorLayer=l},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.FreeTextEditor=void 0;var n=i(1),s=i(5),r=i(4);class a extends r.AnnotationEditor{#He=this.editorDivBlur.bind(this);#We=this.editorDivFocus.bind(this);#Ge=this.editorDivInput.bind(this);#ze=this.editorDivKeydown.bind(this);#qe;#$e="";#Xe=`${this.id}-editor`;#Ke=!1;#Ye;static _freeTextDefaultContent="";static _l10nPromise;static _internalPadding=0;static _defaultColor=null;static _defaultFontSize=10;static _keyboardManager=new s.KeyboardManager([[["ctrl+Enter","mac+meta+Enter","Escape","mac+Escape"],a.prototype.commitOrRemove]]);static _type="freetext";constructor(e){super({...e,name:"freeTextEditor"}),this.#qe=e.color||a._defaultColor||r.AnnotationEditor._defaultLineColor,this.#Ye=e.fontSize||a._defaultFontSize}static initialize(e){this._l10nPromise=new Map(["free_text2_default_content","editor_free_text2_aria_label"].map((t=>[t,e.get(t)])));const t=getComputedStyle(document.documentElement);this._internalPadding=parseFloat(t.getPropertyValue("--freetext-padding"))}static updateDefaultParams(e,t){switch(e){case n.AnnotationEditorParamsType.FREETEXT_SIZE:a._defaultFontSize=t;break;case n.AnnotationEditorParamsType.FREETEXT_COLOR:a._defaultColor=t}}updateParams(e,t){switch(e){case n.AnnotationEditorParamsType.FREETEXT_SIZE:this.#Qe(t);break;case n.AnnotationEditorParamsType.FREETEXT_COLOR:this.#Je(t)}}static get defaultPropertiesToUpdate(){return[[n.AnnotationEditorParamsType.FREETEXT_SIZE,a._defaultFontSize],[n.AnnotationEditorParamsType.FREETEXT_COLOR,a._defaultColor||r.AnnotationEditor._defaultLineColor]]}get propertiesToUpdate(){return[[n.AnnotationEditorParamsType.FREETEXT_SIZE,this.#Ye],[n.AnnotationEditorParamsType.FREETEXT_COLOR,this.#qe]]}#Qe(e){const t=e=>{this.editorDiv.style.fontSize=`calc(${e}px * var(--scale-factor))`,this.translate(0,-(e-this.#Ye)*this.parentScale),this.#Ye=e,this.#Ze()},i=this.#Ye;this.addCommands({cmd:()=>{t(e)},undo:()=>{t(i)},mustExec:!0,type:n.AnnotationEditorParamsType.FREETEXT_SIZE,overwriteIfSameType:!0,keepUndo:!0})}#Je(e){const t=this.#qe;this.addCommands({cmd:()=>{this.#qe=this.editorDiv.style.color=e},undo:()=>{this.#qe=this.editorDiv.style.color=t},mustExec:!0,type:n.AnnotationEditorParamsType.FREETEXT_COLOR,overwriteIfSameType:!0,keepUndo:!0})}getInitialTranslation(){const e=this.parentScale;return[-a._internalPadding*e,-(a._internalPadding+this.#Ye)*e]}rebuild(){super.rebuild(),null!==this.div&&(this.isAttachedToDOM||this.parent.add(this))}enableEditMode(){this.isInEditMode()||(this.parent.setEditingState(!1),this.parent.updateToolbar(n.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.#ze),this.editorDiv.addEventListener("focus",this.#We),this.editorDiv.addEventListener("blur",this.#He),this.editorDiv.addEventListener("input",this.#Ge))}disableEditMode(){this.isInEditMode()&&(this.parent.setEditingState(!0),super.disableEditMode(),this.overlayDiv.classList.add("enabled"),this.editorDiv.contentEditable=!1,this.div.setAttribute("aria-activedescendant",this.#Xe),this.div.draggable=!0,this.editorDiv.removeEventListener("keydown",this.#ze),this.editorDiv.removeEventListener("focus",this.#We),this.editorDiv.removeEventListener("blur",this.#He),this.editorDiv.removeEventListener("input",this.#Ge),this.div.focus({preventScroll:!0}),this.isEditing=!1,this.parent.div.classList.add("freeTextEditing"))}focusin(e){super.focusin(e),e.target!==this.editorDiv&&this.editorDiv.focus()}onceAdded(){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()}#et(){const e=this.editorDiv.getElementsByTagName("div");if(0===e.length)return this.editorDiv.innerText;const t=[];for(const i of e)t.push(i.innerText.replace(/\r\n?|\n/,""));return t.join("\n")}#Ze(){const[e,t]=this.parentDimensions;let i;if(this.isAttachedToDOM)i=this.div.getBoundingClientRect();else{const{currentLayer:e,div:t}=this,n=t.style.display;t.style.display="hidden",e.div.append(this.div),i=t.getBoundingClientRect(),t.remove(),t.style.display=n}this.width=i.width/e,this.height=i.height/t}commit(){this.isInEditMode()&&(super.commit(),this.#Ke||(this.#Ke=!0,this.parent.addUndoableEditor(this)),this.disableEditMode(),this.#$e=this.#et().trimEnd(),this.#Ze())}shouldGetKeyboardEvents(){return this.isInEditMode()}dblclick(e){this.enableEditMode(),this.editorDiv.focus()}keydown(e){e.target===this.div&&"Enter"===e.key&&(this.enableEditMode(),this.editorDiv.focus())}editorDivKeydown(e){a._keyboardManager.exec(this,e)}editorDivFocus(e){this.isEditing=!0}editorDivBlur(e){this.isEditing=!1}editorDivInput(e){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 e,t;this.width&&(e=this.x,t=this.y),super.render(),this.editorDiv=document.createElement("div"),this.editorDiv.className="internal",this.editorDiv.setAttribute("id",this.#Xe),this.enableEditing(),a._l10nPromise.get("editor_free_text2_aria_label").then((e=>this.editorDiv?.setAttribute("aria-label",e))),a._l10nPromise.get("free_text2_default_content").then((e=>this.editorDiv?.setAttribute("default-content",e))),this.editorDiv.contentEditable=!0;const{style:i}=this.editorDiv;if(i.fontSize=`calc(${this.#Ye}px * var(--scale-factor))`,i.color=this.#qe,this.div.append(this.editorDiv),this.overlayDiv=document.createElement("div"),this.overlayDiv.classList.add("overlay","enabled"),this.div.append(this.overlayDiv),(0,s.bindEvents)(this,this.div,["dblclick","keydown"]),this.width){const[i,n]=this.parentDimensions;this.setAt(e*i,t*n,this.width*i,this.height*n);for(const e of this.#$e.split("\n")){const t=document.createElement("div");t.append(e?document.createTextNode(e):document.createElement("br")),this.editorDiv.append(t)}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(e,t,i){const s=super.deserialize(e,t,i);return s.#Ye=e.fontSize,s.#qe=n.Util.makeHexColor(...e.color),s.#$e=e.value,s}serialize(){if(this.isEmpty())return null;const e=a._internalPadding*this.parentScale,t=this.getRect(e,e),i=r.AnnotationEditor._colorManager.convert(this.isAttachedToDOM?getComputedStyle(this.editorDiv).color:this.#qe);return{annotationType:n.AnnotationEditorType.FREETEXT,color:i,fontSize:this.#Ye,value:this.#$e,pageIndex:this.pageIndex,rect:t,rotation:this.rotation}}}t.FreeTextEditor=a},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.InkEditor=void 0,Object.defineProperty(t,"fitCurve",{enumerable:!0,get:function(){return r.fitCurve}});var n=i(1),s=i(4),r=i(30),a=i(5);const o=16;class l extends s.AnnotationEditor{#tt=0;#it=0;#nt=0;#st=this.canvasPointermove.bind(this);#rt=this.canvasPointerleave.bind(this);#at=this.canvasPointerup.bind(this);#ot=this.canvasPointerdown.bind(this);#lt=!1;#ct=!1;#ht=null;#dt=null;#ut=0;#pt=0;#gt=null;static _defaultColor=null;static _defaultOpacity=1;static _defaultThickness=1;static _l10nPromise;static _type="ink";constructor(e){super({...e,name:"inkEditor"}),this.color=e.color||null,this.thickness=e.thickness||null,this.opacity=e.opacity||null,this.paths=[],this.bezierPath2D=[],this.currentPath=[],this.scaleFactor=1,this.translationX=this.translationY=0,this.x=0,this.y=0}static initialize(e){this._l10nPromise=new Map(["editor_ink_canvas_aria_label","editor_ink2_aria_label"].map((t=>[t,e.get(t)])))}static updateDefaultParams(e,t){switch(e){case n.AnnotationEditorParamsType.INK_THICKNESS:l._defaultThickness=t;break;case n.AnnotationEditorParamsType.INK_COLOR:l._defaultColor=t;break;case n.AnnotationEditorParamsType.INK_OPACITY:l._defaultOpacity=t/100}}updateParams(e,t){switch(e){case n.AnnotationEditorParamsType.INK_THICKNESS:this.#ft(t);break;case n.AnnotationEditorParamsType.INK_COLOR:this.#Je(t);break;case n.AnnotationEditorParamsType.INK_OPACITY:this.#mt(t)}}static get defaultPropertiesToUpdate(){return[[n.AnnotationEditorParamsType.INK_THICKNESS,l._defaultThickness],[n.AnnotationEditorParamsType.INK_COLOR,l._defaultColor||s.AnnotationEditor._defaultLineColor],[n.AnnotationEditorParamsType.INK_OPACITY,Math.round(100*l._defaultOpacity)]]}get propertiesToUpdate(){return[[n.AnnotationEditorParamsType.INK_THICKNESS,this.thickness||l._defaultThickness],[n.AnnotationEditorParamsType.INK_COLOR,this.color||l._defaultColor||s.AnnotationEditor._defaultLineColor],[n.AnnotationEditorParamsType.INK_OPACITY,Math.round(100*(this.opacity??l._defaultOpacity))]]}#ft(e){const t=this.thickness;this.addCommands({cmd:()=>{this.thickness=e,this.#_t()},undo:()=>{this.thickness=t,this.#_t()},mustExec:!0,type:n.AnnotationEditorParamsType.INK_THICKNESS,overwriteIfSameType:!0,keepUndo:!0})}#Je(e){const t=this.color;this.addCommands({cmd:()=>{this.color=e,this.#vt()},undo:()=>{this.color=t,this.#vt()},mustExec:!0,type:n.AnnotationEditorParamsType.INK_COLOR,overwriteIfSameType:!0,keepUndo:!0})}#mt(e){e/=100;const t=this.opacity;this.addCommands({cmd:()=>{this.opacity=e,this.#vt()},undo:()=>{this.opacity=t,this.#vt()},mustExec:!0,type:n.AnnotationEditorParamsType.INK_OPACITY,overwriteIfSameType:!0,keepUndo:!0})}rebuild(){super.rebuild(),null!==this.div&&(this.canvas||(this.#bt(),this.#yt()),this.isAttachedToDOM||(this.parent.add(this),this.#St()),this.#_t())}remove(){null!==this.canvas&&(this.isEmpty()||this.commit(),this.canvas.width=this.canvas.height=0,this.canvas.remove(),this.canvas=null,this.#dt.disconnect(),this.#dt=null,super.remove())}setParent(e){!this.parent&&e?this._uiManager.removeShouldRescale(this):this.parent&&null===e&&this._uiManager.addShouldRescale(this),super.setParent(e)}onScaleChanging(){const[e,t]=this.parentDimensions,i=this.width*e,n=this.height*t;this.setDimensions(i,n)}enableEditMode(){this.#lt||null===this.canvas||(super.enableEditMode(),this.div.draggable=!1,this.canvas.addEventListener("pointerdown",this.#ot),this.canvas.addEventListener("pointerup",this.#at))}disableEditMode(){this.isInEditMode()&&null!==this.canvas&&(super.disableEditMode(),this.div.draggable=!this.isEmpty(),this.div.classList.remove("editing"),this.canvas.removeEventListener("pointerdown",this.#ot),this.canvas.removeEventListener("pointerup",this.#at))}onceAdded(){this.div.draggable=!this.isEmpty()}isEmpty(){return 0===this.paths.length||1===this.paths.length&&0===this.paths[0].length}#Pt(){const{parentRotation:e,parentDimensions:[t,i]}=this;switch(e){case 90:return[0,i,i,t];case 180:return[t,i,t,i];case 270:return[t,0,i,t];default:return[0,0,t,i]}}#At(){const{ctx:e,color:t,opacity:i,thickness:n,parentScale:s,scaleFactor:r}=this;e.lineWidth=n*s/r,e.lineCap="round",e.lineJoin="round",e.miterLimit=10,e.strokeStyle=`${t}${(0,a.opacityToHex)(i)}`}#wt(e,t){this.isEditing=!0,this.#ct||(this.#ct=!0,this.#St(),this.thickness||=l._defaultThickness,this.color||=l._defaultColor||s.AnnotationEditor._defaultLineColor,this.opacity??=l._defaultOpacity),this.currentPath.push([e,t]),this.#ht=null,this.#At(),this.ctx.beginPath(),this.ctx.moveTo(e,t),this.#gt=()=>{this.#gt&&(this.#ht&&(this.isEmpty()?(this.ctx.setTransform(1,0,0,1,0,0),this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height)):this.#vt(),this.ctx.lineTo(...this.#ht),this.#ht=null,this.ctx.stroke()),window.requestAnimationFrame(this.#gt))},window.requestAnimationFrame(this.#gt)}#Et(e,t){const[i,n]=this.currentPath.at(-1);e===i&&t===n||(this.currentPath.push([e,t]),this.#ht=[e,t])}#Ct(e,t){this.ctx.closePath(),this.#gt=null,e=Math.min(Math.max(e,0),this.canvas.width),t=Math.min(Math.max(t,0),this.canvas.height);const[i,n]=this.currentPath.at(-1);let s;if(e===i&&t===n||this.currentPath.push([e,t]),1!==this.currentPath.length)s=(0,r.fitCurve)(this.currentPath,30,null);else{const i=[e,t];s=[[i,i.slice(),i.slice(),i]]}const a=l.#xt(s);this.currentPath.length=0,this.addCommands({cmd:()=>{this.paths.push(s),this.bezierPath2D.push(a),this.rebuild()},undo:()=>{this.paths.pop(),this.bezierPath2D.pop(),0===this.paths.length?this.remove():(this.canvas||(this.#bt(),this.#yt()),this.#_t())},mustExec:!0})}#vt(){if(this.isEmpty())return void this.#Mt();this.#At();const{canvas:e,ctx:t}=this;t.setTransform(1,0,0,1,0,0),t.clearRect(0,0,e.width,e.height),this.#Mt();for(const e of this.bezierPath2D)t.stroke(e)}commit(){this.#lt||(super.commit(),this.isEditing=!1,this.disableEditMode(),this.setInForeground(),this.#lt=!0,this.div.classList.add("disabled"),this.#_t(!0),this.parent.addInkEditorIfNeeded(!0),this.parent.moveEditorInDOM(this),this.div.focus({preventScroll:!0}))}focusin(e){super.focusin(e),this.enableEditMode()}canvasPointerdown(e){0===e.button&&this.isInEditMode()&&!this.#lt&&(this.setInForeground(),"mouse"!==e.type&&this.div.focus(),e.stopPropagation(),this.canvas.addEventListener("pointerleave",this.#rt),this.canvas.addEventListener("pointermove",this.#st),this.#wt(e.offsetX,e.offsetY))}canvasPointermove(e){e.stopPropagation(),this.#Et(e.offsetX,e.offsetY)}canvasPointerup(e){0===e.button&&this.isInEditMode()&&0!==this.currentPath.length&&(e.stopPropagation(),this.#Tt(e),this.setInBackground())}canvasPointerleave(e){this.#Tt(e),this.setInBackground()}#Tt(e){this.#Ct(e.offsetX,e.offsetY),this.canvas.removeEventListener("pointerleave",this.#rt),this.canvas.removeEventListener("pointermove",this.#st),this.addToAnnotationStorage()}#bt(){this.canvas=document.createElement("canvas"),this.canvas.width=this.canvas.height=0,this.canvas.className="inkEditorCanvas",l._l10nPromise.get("editor_ink_canvas_aria_label").then((e=>this.canvas?.setAttribute("aria-label",e))),this.div.append(this.canvas),this.ctx=this.canvas.getContext("2d")}#yt(){this.#dt=new ResizeObserver((e=>{const t=e[0].contentRect;t.width&&t.height&&this.setDimensions(t.width,t.height)})),this.#dt.observe(this.div)}render(){if(this.div)return this.div;let e,t;this.width&&(e=this.x,t=this.y),super.render(),l._l10nPromise.get("editor_ink2_aria_label").then((e=>this.div?.setAttribute("aria-label",e)));const[i,n,s,r]=this.#Pt();if(this.setAt(i,n,0,0),this.setDims(s,r),this.#bt(),this.width){const[i,n]=this.parentDimensions;this.setAt(e*i,t*n,this.width*i,this.height*n),this.#ct=!0,this.#St(),this.setDims(this.width*i,this.height*n),this.#vt(),this.#Ft(),this.div.classList.add("disabled")}else this.div.classList.add("editing"),this.enableEditMode();return this.#yt(),this.div}#St(){if(!this.#ct)return;const[e,t]=this.parentDimensions;this.canvas.width=Math.ceil(this.width*e),this.canvas.height=Math.ceil(this.height*t),this.#Mt()}setDimensions(e,t){const i=Math.round(e),n=Math.round(t);if(this.#ut===i&&this.#pt===n)return;this.#ut=i,this.#pt=n,this.canvas.style.visibility="hidden",this.#tt&&Math.abs(this.#tt-e/t)>.01&&(t=Math.ceil(e/this.#tt),this.setDims(e,t));const[s,r]=this.parentDimensions;this.width=e/s,this.height=t/r,this.#lt&&this.#Dt(e,t),this.#St(),this.#vt(),this.canvas.style.visibility="visible",this.fixDims()}#Dt(e,t){const i=this.#kt(),n=(e-i)/this.#nt,s=(t-i)/this.#it;this.scaleFactor=Math.min(n,s)}#Mt(){const e=this.#kt()/2;this.ctx.setTransform(this.scaleFactor,0,0,this.scaleFactor,this.translationX*this.scaleFactor+e,this.translationY*this.scaleFactor+e)}static#xt(e){const t=new Path2D;for(let i=0,n=e.length;i<n;i++){const[n,s,r,a]=e[i];0===i&&t.moveTo(...n),t.bezierCurveTo(s[0],s[1],r[0],r[1],a[0],a[1])}return t}#Rt(e,t,i,n){const s=[],r=this.thickness/2;let a,o;for(const l of this.paths){a=[],o=[];for(let s=0,c=l.length;s<c;s++){const[c,h,d,u]=l[s],p=e*(c[0]+t)+r,g=n-e*(c[1]+i)-r,f=e*(h[0]+t)+r,m=n-e*(h[1]+i)-r,_=e*(d[0]+t)+r,v=n-e*(d[1]+i)-r,b=e*(u[0]+t)+r,y=n-e*(u[1]+i)-r;0===s&&(a.push(p,g),o.push(p,g)),a.push(f,m,_,v,b,y),this.#Lt(p,g,f,m,_,v,b,y,4,o)}s.push({bezier:a,points:o})}return s}#Lt(e,t,i,n,s,r,a,o,l,c){if(this.#It(e,t,i,n,s,r,a,o))c.push(a,o);else{for(let h=1;h<l-1;h++){const d=h/l,u=1-d;let p=d*e+u*i,g=d*t+u*n,f=d*i+u*s,m=d*n+u*r;p=d*p+u*f,g=d*g+u*m,f=d*f+u*(d*s+u*a),m=d*m+u*(d*r+u*o),p=d*p+u*f,g=d*g+u*m,c.push(p,g)}c.push(a,o)}}#It(e,t,i,n,s,r,a,o){const l=(3*i-2*e-a)**2,c=(3*n-2*t-o)**2,h=(3*s-e-2*a)**2,d=(3*r-t-2*o)**2;return Math.max(l,h)+Math.max(c,d)<=10}#Ot(){let e=1/0,t=-1/0,i=1/0,s=-1/0;for(const r of this.paths)for(const[a,o,l,c]of r){const r=n.Util.bezierBoundingBox(...a,...o,...l,...c);e=Math.min(e,r[0]),i=Math.min(i,r[1]),t=Math.max(t,r[2]),s=Math.max(s,r[3])}return[e,i,t,s]}#kt(){return this.#lt?Math.ceil(this.thickness*this.parentScale):0}#_t(e=!1){if(this.isEmpty())return;if(!this.#lt)return void this.#vt();const t=this.#Ot(),i=this.#kt();this.#nt=Math.max(o,t[2]-t[0]),this.#it=Math.max(o,t[3]-t[1]);const n=Math.ceil(i+this.#nt*this.scaleFactor),s=Math.ceil(i+this.#it*this.scaleFactor),[r,a]=this.parentDimensions;this.width=n/r,this.height=s/a,this.#tt=n/s,this.#Ft();const l=this.translationX,c=this.translationY;this.translationX=-t[0],this.translationY=-t[1],this.#St(),this.#vt(),this.#ut=n,this.#pt=s,this.setDims(n,s);const h=e?i/this.scaleFactor/2:0;this.translate(l-this.translationX-h,c-this.translationY-h)}#Ft(){const{style:e}=this.div;this.#tt>=1?(e.minHeight="16px",e.minWidth=`${Math.round(this.#tt*o)}px`):(e.minWidth="16px",e.minHeight=`${Math.round(o/this.#tt)}px`)}static deserialize(e,t,i){const s=super.deserialize(e,t,i);s.thickness=e.thickness,s.color=n.Util.makeHexColor(...e.color),s.opacity=e.opacity;const[r,a]=s.pageDimensions,l=s.width*r,c=s.height*a,h=s.parentScale,d=e.thickness/2;s.#tt=l/c,s.#lt=!0,s.#ut=Math.round(l),s.#pt=Math.round(c);for(const{bezier:t}of e.paths){const e=[];s.paths.push(e);let i=h*(t[0]-d),n=h*(c-t[1]-d);for(let s=2,r=t.length;s<r;s+=6){const r=h*(t[s]-d),a=h*(c-t[s+1]-d),o=h*(t[s+2]-d),l=h*(c-t[s+3]-d),u=h*(t[s+4]-d),p=h*(c-t[s+5]-d);e.push([[i,n],[r,a],[o,l],[u,p]]),i=u,n=p}const r=this.#xt(e);s.bezierPath2D.push(r)}const u=s.#Ot();return s.#nt=Math.max(o,u[2]-u[0]),s.#it=Math.max(o,u[3]-u[1]),s.#Dt(l,c),s}serialize(){if(this.isEmpty())return null;const e=this.getRect(0,0),t=this.rotation%180==0?e[3]-e[1]:e[2]-e[0],i=s.AnnotationEditor._colorManager.convert(this.ctx.strokeStyle);return{annotationType:n.AnnotationEditorType.INK,color:i,thickness:this.thickness,opacity:this.opacity,paths:this.#Rt(this.scaleFactor/this.parentScale,this.translationX,this.translationY,t),pageIndex:this.pageIndex,rect:e,rotation:this.rotation}}}t.InkEditor=l},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.fitCurve=void 0;const n=i(31);t.fitCurve=n},e=>{function t(e,s,r,a,o){var c,h,d,u,p,g,f,m,_,v,b,y,S;if(2===e.length)return y=l.vectorLen(l.subtract(e[0],e[1]))/3,[c=[e[0],l.addArrays(e[0],l.mulItems(s,y)),l.addArrays(e[1],l.mulItems(r,y)),e[1]]];if(h=function(e){var t,i,n,s=[];return e.forEach(((e,r)=>{t=r?i+l.vectorLen(l.subtract(e,n)):0,s.push(t),i=t,n=e})),s=s.map((e=>e/i))}(e),[c,u,g]=i(e,h,h,s,r,o),0===u||u<a)return[c];if(u<a*a)for(d=h,p=u,f=g,S=0;S<20;S++){if(d=n(c,e,d),[c,u,g]=i(e,h,d,s,r,o),u<a)return[c];if(g===f){let e=u/p;if(e>.9999&&e<1.0001)break}p=u,f=g}return b=[],(m=l.subtract(e[g-1],e[g+1])).every((e=>0===e))&&(m=l.subtract(e[g-1],e[g]),[m[0],m[1]]=[-m[1],m[0]]),_=l.normalize(m),v=l.mulItems(_,-1),b=(b=b.concat(t(e.slice(0,g+1),s,_,a,o))).concat(t(e.slice(g),v,r,a,o))}function i(e,t,i,n,s,o){var h,d,u;return h=function(e,t,i,n){var s,r,a,o,h,d,u,p,g,f,m,_,v,b,y,S,P,A=e[0],w=e[e.length-1];for(s=[A,null,null,w],r=l.zeros_Xx2x2(t.length),v=0,b=t.length;v<b;v++)P=1-(S=t[v]),(a=r[v])[0]=l.mulItems(i,3*S*(P*P)),a[1]=l.mulItems(n,3*P*(S*S));for(o=[[0,0],[0,0]],h=[0,0],v=0,b=e.length;v<b;v++)S=t[v],a=r[v],o[0][0]+=l.dot(a[0],a[0]),o[0][1]+=l.dot(a[0],a[1]),o[1][0]+=l.dot(a[0],a[1]),o[1][1]+=l.dot(a[1],a[1]),y=l.subtract(e[v],c.q([A,A,w,w],S)),h[0]+=l.dot(a[0],y),h[1]+=l.dot(a[1],y);return d=o[0][0]*o[1][1]-o[1][0]*o[0][1],u=o[0][0]*h[1]-o[1][0]*h[0],p=h[0]*o[1][1]-h[1]*o[0][1],g=0===d?0:p/d,f=0===d?0:u/d,_=l.vectorLen(l.subtract(A,w)),g<(m=1e-6*_)||f<m?(s[1]=l.addArrays(A,l.mulItems(i,_/3)),s[2]=l.addArrays(w,l.mulItems(n,_/3))):(s[1]=l.addArrays(A,l.mulItems(i,g)),s[2]=l.addArrays(w,l.mulItems(n,f))),s}(e,i,n,s),[d,u]=function(e,t,i){var n,s,o,h,d,u,p,g;s=0,o=Math.floor(e.length/2);const f=r(t,10);for(d=0,u=e.length;d<u;d++)p=e[d],g=a(0,i[d],f,10),(n=(h=l.subtract(c.q(t,g),p))[0]*h[0]+h[1]*h[1])>s&&(s=n,o=d);return[s,o]}(e,h,t),o&&o({bez:h,points:e,params:t,maxErr:d,maxPoint:u}),[h,d,u]}function n(e,t,i){return i.map(((i,n)=>s(e,t[n],i)))}function s(e,t,i){var n=l.subtract(c.q(e,i),t),s=c.qprime(e,i),r=l.mulMatrix(n,s),a=l.sum(l.squareItems(s))+2*l.mulMatrix(n,c.qprimeprime(e,i));return 0===a?i:i-r/a}var r=function(e,t){for(var i,n=[0],s=e[0],r=0,a=1;a<=t;a++)i=c.q(e,a/t),r+=l.vectorLen(l.subtract(i,s)),n.push(r),s=i;return n=n.map((e=>e/r))};function a(e,t,i,n){if(t<0)return 0;if(t>1)return 1;for(var s,r,a,o,l=1;l<=n;l++)if(t<=i[l]){a=(l-1)/n,r=l/n,o=(t-(s=i[l-1]))/(i[l]-s)*(r-a)+a;break}return o}function o(e,t){return l.normalize(l.subtract(e,t))}class l{static zeros_Xx2x2(e){for(var t=[];e--;)t.push([0,0]);return t}static mulItems(e,t){return e.map((e=>e*t))}static mulMatrix(e,t){return e.reduce(((e,i,n)=>e+i*t[n]),0)}static subtract(e,t){return e.map(((e,i)=>e-t[i]))}static addArrays(e,t){return e.map(((e,i)=>e+t[i]))}static addItems(e,t){return e.map((e=>e+t))}static sum(e){return e.reduce(((e,t)=>e+t))}static dot(e,t){return l.mulMatrix(e,t)}static vectorLen(e){return Math.hypot(...e)}static divItems(e,t){return e.map((e=>e/t))}static squareItems(e){return e.map((e=>e*e))}static normalize(e){return this.divItems(e,this.vectorLen(e))}}class c{static q(e,t){var i=1-t,n=l.mulItems(e[0],i*i*i),s=l.mulItems(e[1],3*i*i*t),r=l.mulItems(e[2],3*i*t*t),a=l.mulItems(e[3],t*t*t);return l.addArrays(l.addArrays(n,s),l.addArrays(r,a))}static qprime(e,t){var i=1-t,n=l.mulItems(l.subtract(e[1],e[0]),3*i*i),s=l.mulItems(l.subtract(e[2],e[1]),6*i*t),r=l.mulItems(l.subtract(e[3],e[2]),3*t*t);return l.addArrays(l.addArrays(n,s),r)}static qprimeprime(e,t){return l.addArrays(l.mulItems(l.addArrays(l.subtract(e[2],l.mulItems(e[1],2)),e[0]),6*(1-t)),l.mulItems(l.addArrays(l.subtract(e[3],l.mulItems(e[2],2)),e[1]),6*t))}}e.exports=function(e,i,n){if(!Array.isArray(e))throw new TypeError("First argument should be an array");if(e.forEach((t=>{if(!Array.isArray(t)||t.some((e=>"number"!=typeof e))||t.length!==e[0].length)throw Error("Each point should be an array of numbers. Each point should have the same amount of numbers.")})),(e=e.filter(((t,i)=>0===i||!t.every(((t,n)=>t===e[i-1][n]))))).length<2)return[];const s=e.length,r=o(e[1],e[0]),a=o(e[s-2],e[s-1]);return t(e,r,a,i,n)},e.exports.fitCubic=t,e.exports.createTangent=o},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.AnnotationLayer=void 0;var n=i(1),s=i(6),r=i(3),a=i(33),o=i(34);const l=1e3,c=new WeakSet;function h(e){return{width:e[2]-e[0],height:e[3]-e[1]}}class d{static create(e){switch(e.data.annotationType){case n.AnnotationType.LINK:return new p(e);case n.AnnotationType.TEXT:return new g(e);case n.AnnotationType.WIDGET:switch(e.data.fieldType){case"Tx":return new m(e);case"Btn":return e.data.radioButton?new v(e):e.data.checkBox?new _(e):new b(e);case"Ch":return new y(e)}return new f(e);case n.AnnotationType.POPUP:return new S(e);case n.AnnotationType.FREETEXT:return new A(e);case n.AnnotationType.LINE:return new w(e);case n.AnnotationType.SQUARE:return new E(e);case n.AnnotationType.CIRCLE:return new C(e);case n.AnnotationType.POLYLINE:return new x(e);case n.AnnotationType.CARET:return new T(e);case n.AnnotationType.INK:return new F(e);case n.AnnotationType.POLYGON:return new M(e);case n.AnnotationType.HIGHLIGHT:return new D(e);case n.AnnotationType.UNDERLINE:return new k(e);case n.AnnotationType.SQUIGGLY:return new R(e);case n.AnnotationType.STRIKEOUT:return new L(e);case n.AnnotationType.STAMP:return new I(e);case n.AnnotationType.FILEATTACHMENT:return new O(e);default:return new u(e)}}}class u{constructor(e,{isRenderable:t=!1,ignoreBorder:i=!1,createQuadrilaterals:n=!1}={}){this.isRenderable=t,this.data=e.data,this.layer=e.layer,this.page=e.page,this.viewport=e.viewport,this.linkService=e.linkService,this.downloadManager=e.downloadManager,this.imageResourcesPath=e.imageResourcesPath,this.renderForms=e.renderForms,this.svgFactory=e.svgFactory,this.annotationStorage=e.annotationStorage,this.enableScripting=e.enableScripting,this.hasJSActions=e.hasJSActions,this._fieldObjects=e.fieldObjects,t&&(this.container=this._createContainer(i)),n&&(this.quadrilaterals=this._createQuadrilaterals(i))}_createContainer(e=!1){const{data:t,page:i,viewport:s}=this,r=document.createElement("section");r.setAttribute("data-annotation-id",t.id),t.noRotate&&r.classList.add("norotate");const{pageWidth:a,pageHeight:o,pageX:l,pageY:c}=s.rawDims,{width:d,height:u}=h(t.rect),p=n.Util.normalizeRect([t.rect[0],i.view[3]-t.rect[1]+i.view[1],t.rect[2],i.view[3]-t.rect[3]+i.view[1]]);if(!e&&t.borderStyle.width>0){r.style.borderWidth=`${t.borderStyle.width}px`;const e=t.borderStyle.horizontalCornerRadius,i=t.borderStyle.verticalCornerRadius;if(e>0||i>0){const t=`calc(${e}px * var(--scale-factor)) / calc(${i}px * var(--scale-factor))`;r.style.borderRadius=t}else if(this instanceof v){const e=`calc(${d}px * var(--scale-factor)) / calc(${u}px * var(--scale-factor))`;r.style.borderRadius=e}switch(t.borderStyle.style){case n.AnnotationBorderStyleType.SOLID:r.style.borderStyle="solid";break;case n.AnnotationBorderStyleType.DASHED:r.style.borderStyle="dashed";break;case n.AnnotationBorderStyleType.BEVELED:(0,n.warn)("Unimplemented border style: beveled");break;case n.AnnotationBorderStyleType.INSET:(0,n.warn)("Unimplemented border style: inset");break;case n.AnnotationBorderStyleType.UNDERLINE:r.style.borderBottomStyle="solid"}const s=t.borderColor||null;s?r.style.borderColor=n.Util.makeHexColor(0|s[0],0|s[1],0|s[2]):r.style.borderWidth=0}r.style.left=100*(p[0]-l)/a+"%",r.style.top=100*(p[1]-c)/o+"%";const{rotation:g}=t;return t.hasOwnCanvas||0===g?(r.style.width=100*d/a+"%",r.style.height=100*u/o+"%"):this.setRotation(g,r),r}setRotation(e,t=this.container){const{pageWidth:i,pageHeight:n}=this.viewport.rawDims,{width:s,height:r}=h(this.data.rect);let a,o;e%180==0?(a=100*s/i,o=100*r/n):(a=100*r/i,o=100*s/n),t.style.width=`${a}%`,t.style.height=`${o}%`,t.setAttribute("data-main-rotation",(360-e)%360)}get _commonActions(){const e=(e,t,i)=>{const n=i.detail[e];i.target.style[t]=a.ColorConverters[`${n[0]}_HTML`](n.slice(1))};return(0,n.shadow)(this,"_commonActions",{display:e=>{const t=e.detail.display%2==1;this.container.style.visibility=t?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{hidden:t,print:0===e.detail.display||3===e.detail.display})},print:e=>{this.annotationStorage.setValue(this.data.id,{print:e.detail.print})},hidden:e=>{this.container.style.visibility=e.detail.hidden?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{hidden:e.detail.hidden})},focus:e=>{setTimeout((()=>e.target.focus({preventScroll:!1})),0)},userName:e=>{e.target.title=e.detail.userName},readonly:e=>{e.detail.readonly?e.target.setAttribute("readonly",""):e.target.removeAttribute("readonly")},required:e=>{this._setRequired(e.target,e.detail.required)},bgColor:t=>{e("bgColor","backgroundColor",t)},fillColor:t=>{e("fillColor","backgroundColor",t)},fgColor:t=>{e("fgColor","color",t)},textColor:t=>{e("textColor","color",t)},borderColor:t=>{e("borderColor","borderColor",t)},strokeColor:t=>{e("strokeColor","borderColor",t)},rotation:e=>{const t=e.detail.rotation;this.setRotation(t),this.annotationStorage.setValue(this.data.id,{rotation:t})}})}_dispatchEventFromSandbox(e,t){const i=this._commonActions;for(const n of Object.keys(t.detail)){const s=e[n]||i[n];s?.(t)}}_setDefaultPropertiesFromJS(e){if(!this.enableScripting)return;const t=this.annotationStorage.getRawValue(this.data.id);if(!t)return;const i=this._commonActions;for(const[n,s]of Object.entries(t)){const r=i[n];r&&(r({detail:{[n]:s},target:e}),delete t[n])}}_createQuadrilaterals(e=!1){if(!this.data.quadPoints)return null;const t=[],i=this.data.rect;for(const i of this.data.quadPoints)this.data.rect=[i[2].x,i[2].y,i[1].x,i[1].y],t.push(this._createContainer(e));return this.data.rect=i,t}_createPopup(e,t){let i=this.container;this.quadrilaterals&&(e=e||this.quadrilaterals,i=this.quadrilaterals[0]),e||((e=document.createElement("div")).classList.add("popupTriggerArea"),i.append(e));const n=new P({container:i,trigger:e,color:t.color,titleObj:t.titleObj,modificationDate:t.modificationDate,contentsObj:t.contentsObj,richText:t.richText,hideWrapper:!0}).render();n.style.left="100%",i.append(n)}_renderQuadrilaterals(e){for(const t of this.quadrilaterals)t.classList.add(e);return this.quadrilaterals}render(){(0,n.unreachable)("Abstract method `AnnotationElement.render` called")}_getElementsByName(e,t=null){const i=[];if(this._fieldObjects){const s=this._fieldObjects[e];if(s)for(const{page:e,id:r,exportValues:a}of s){if(-1===e)continue;if(r===t)continue;const s="string"==typeof a?a:null,o=document.querySelector(`[data-element-id="${r}"]`);!o||c.has(o)?i.push({id:r,exportValue:s,domElement:o}):(0,n.warn)(`_getElementsByName - element not allowed: ${r}`)}return i}for(const n of document.getElementsByName(e)){const{exportValue:e}=n,s=n.getAttribute("data-element-id");s!==t&&c.has(n)&&i.push({id:s,exportValue:e,domElement:n})}return i}}class p extends u{constructor(e,t=null){super(e,{isRenderable:!0,ignoreBorder:!!t?.ignoreBorder,createQuadrilaterals:!0}),this.isTooltipOnly=e.data.isTooltipOnly}render(){const{data:e,linkService:t}=this,i=document.createElement("a");i.setAttribute("data-element-id",e.id);let n=!1;return e.url?(t.addLinkAttributes(i,e.url,e.newWindow),n=!0):e.action?(this._bindNamedAction(i,e.action),n=!0):e.attachment?(this._bindAttachment(i,e.attachment),n=!0):e.setOCGState?(this.#Nt(i,e.setOCGState),n=!0):e.dest?(this._bindLink(i,e.dest),n=!0):(e.actions&&(e.actions.Action||e.actions["Mouse Up"]||e.actions["Mouse Down"])&&this.enableScripting&&this.hasJSActions&&(this._bindJSAction(i,e),n=!0),e.resetForm?(this._bindResetFormAction(i,e.resetForm),n=!0):this.isTooltipOnly&&!n&&(this._bindLink(i,""),n=!0)),this.quadrilaterals?this._renderQuadrilaterals("linkAnnotation").map(((e,t)=>{const n=0===t?i:i.cloneNode();return e.append(n),e})):(this.container.classList.add("linkAnnotation"),n&&this.container.append(i),this.container)}#Vt(){this.container.setAttribute("data-internal-link","")}_bindLink(e,t){e.href=this.linkService.getDestinationHash(t),e.onclick=()=>(t&&this.linkService.goToDestination(t),!1),(t||""===t)&&this.#Vt()}_bindNamedAction(e,t){e.href=this.linkService.getAnchorUrl(""),e.onclick=()=>(this.linkService.executeNamedAction(t),!1),this.#Vt()}_bindAttachment(e,t){e.href=this.linkService.getAnchorUrl(""),e.onclick=()=>(this.downloadManager?.openOrDownloadData(this.container,t.content,t.filename),!1),this.#Vt()}#Nt(e,t){e.href=this.linkService.getAnchorUrl(""),e.onclick=()=>(this.linkService.executeSetOCGState(t),!1),this.#Vt()}_bindJSAction(e,t){e.href=this.linkService.getAnchorUrl("");const i=new Map([["Action","onclick"],["Mouse Up","onmouseup"],["Mouse Down","onmousedown"]]);for(const n of Object.keys(t.actions)){const s=i.get(n);s&&(e[s]=()=>(this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t.id,name:n}}),!1))}e.onclick||(e.onclick=()=>!1),this.#Vt()}_bindResetFormAction(e,t){const i=e.onclick;if(i||(e.href=this.linkService.getAnchorUrl("")),this.#Vt(),!this._fieldObjects)return(0,n.warn)('_bindResetFormAction - "resetForm" action not supported, ensure that the `fieldObjects` parameter is provided.'),void(i||(e.onclick=()=>!1));e.onclick=()=>{i?.();const{fields:e,refs:s,include:r}=t,a=[];if(0!==e.length||0!==s.length){const t=new Set(s);for(const i of e){const e=this._fieldObjects[i]||[];for(const{id:i}of e)t.add(i)}for(const e of Object.values(this._fieldObjects))for(const i of e)t.has(i.id)===r&&a.push(i)}else for(const e of Object.values(this._fieldObjects))a.push(...e);const o=this.annotationStorage,l=[];for(const e of a){const{id:t}=e;switch(l.push(t),e.type){case"text":{const i=e.defaultValue||"";o.setValue(t,{value:i});break}case"checkbox":case"radiobutton":{const i=e.defaultValue===e.exportValues;o.setValue(t,{value:i});break}case"combobox":case"listbox":{const i=e.defaultValue||"";o.setValue(t,{value:i});break}default:continue}const i=document.querySelector(`[data-element-id="${t}"]`);i&&(c.has(i)?i.dispatchEvent(new Event("resetform")):(0,n.warn)(`_bindResetFormAction - element not allowed: ${t}`))}return this.enableScripting&&this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:"app",ids:l,name:"ResetForm"}}),!1}}}class g extends u{constructor(e){super(e,{isRenderable:!!(e.data.hasPopup||e.data.titleObj?.str||e.data.contentsObj?.str||e.data.richText?.str)})}render(){this.container.classList.add("textAnnotation");const e=document.createElement("img");return e.src=this.imageResourcesPath+"annotation-"+this.data.name.toLowerCase()+".svg",e.alt="[{{type}} Annotation]",e.dataset.l10nId="text_annotation_type",e.dataset.l10nArgs=JSON.stringify({type:this.data.name}),this.data.hasPopup||this._createPopup(e,this.data),this.container.append(e),this.container}}class f extends u{render(){return this.data.alternativeText&&(this.container.title=this.data.alternativeText),this.container}_getKeyModifier(e){const{isWin:t,isMac:i}=n.FeatureTest.platform;return t&&e.ctrlKey||i&&e.metaKey}_setEventListener(e,t,i,n){t.includes("mouse")?e.addEventListener(t,(e=>{this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:i,value:n(e),shift:e.shiftKey,modifier:this._getKeyModifier(e)}})})):e.addEventListener(t,(e=>{this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:i,value:n(e)}})}))}_setEventListeners(e,t,i){for(const[n,s]of t)("Action"===s||this.data.actions?.[s])&&this._setEventListener(e,n,s,i)}_setBackgroundColor(e){const t=this.data.backgroundColor||null;e.style.backgroundColor=null===t?"transparent":n.Util.makeHexColor(t[0],t[1],t[2])}_setTextStyle(e){const t=["left","center","right"],{fontColor:i}=this.data.defaultAppearanceData,s=this.data.defaultAppearanceData.fontSize||9,r=e.style;let a;const o=e=>Math.round(10*e)/10;if(this.data.multiLine){const e=Math.abs(this.data.rect[3]-this.data.rect[1]-2),t=e/(Math.round(e/(n.LINE_FACTOR*s))||1);a=Math.min(s,o(t/n.LINE_FACTOR))}else{const e=Math.abs(this.data.rect[3]-this.data.rect[1]-2);a=Math.min(s,o(e/n.LINE_FACTOR))}r.fontSize=`calc(${a}px * var(--scale-factor))`,r.color=n.Util.makeHexColor(i[0],i[1],i[2]),null!==this.data.textAlignment&&(r.textAlign=t[this.data.textAlignment])}_setRequired(e,t){t?e.setAttribute("required",!0):e.removeAttribute("required"),e.setAttribute("aria-required",t)}}class m extends f{constructor(e){super(e,{isRenderable:e.renderForms||!e.data.hasAppearance&&!!e.data.fieldValue})}setPropertyOnSiblings(e,t,i,n){const s=this.annotationStorage;for(const r of this._getElementsByName(e.name,e.id))r.domElement&&(r.domElement[t]=i),s.setValue(r.id,{[n]:i})}render(){const e=this.annotationStorage,t=this.data.id;this.container.classList.add("textWidgetAnnotation");let i=null;if(this.renderForms){const n=e.getValue(t,{value:this.data.fieldValue});let s=n.formattedValue||n.value||"";const r=e.getValue(t,{charLimit:this.data.maxLen}).charLimit;r&&s.length>r&&(s=s.slice(0,r));const a={userValue:s,formattedValue:null,lastCommittedValue:null,commitKey:1};this.data.multiLine?(i=document.createElement("textarea"),i.textContent=s,this.data.doNotScroll&&(i.style.overflowY="hidden")):(i=document.createElement("input"),i.type="text",i.setAttribute("value",s),this.data.doNotScroll&&(i.style.overflowX="hidden")),c.add(i),i.setAttribute("data-element-id",t),i.disabled=this.data.readOnly,i.name=this.data.fieldName,i.tabIndex=l,this._setRequired(i,this.data.required),r&&(i.maxLength=r),i.addEventListener("input",(n=>{e.setValue(t,{value:n.target.value}),this.setPropertyOnSiblings(i,"value",n.target.value,"value")})),i.addEventListener("resetform",(e=>{const t=this.data.defaultFieldValue??"";i.value=a.userValue=t,a.formattedValue=null}));let o=e=>{const{formattedValue:t}=a;null!=t&&(e.target.value=t),e.target.scrollLeft=0};if(this.enableScripting&&this.hasJSActions){i.addEventListener("focus",(e=>{const{target:t}=e;a.userValue&&(t.value=a.userValue),a.lastCommittedValue=t.value,a.commitKey=1})),i.addEventListener("updatefromsandbox",(i=>{const n={value(i){a.userValue=i.detail.value??"",e.setValue(t,{value:a.userValue.toString()}),i.target.value=a.userValue},formattedValue(i){const{formattedValue:n}=i.detail;a.formattedValue=n,null!=n&&i.target!==document.activeElement&&(i.target.value=n),e.setValue(t,{formattedValue:n})},selRange(e){e.target.setSelectionRange(...e.detail.selRange)},charLimit:i=>{const{charLimit:n}=i.detail,{target:s}=i;if(0===n)return void s.removeAttribute("maxLength");s.setAttribute("maxLength",n);let r=a.userValue;!r||r.length<=n||(r=r.slice(0,n),s.value=a.userValue=r,e.setValue(t,{value:r}),this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t,name:"Keystroke",value:r,willCommit:!0,commitKey:1,selStart:s.selectionStart,selEnd:s.selectionEnd}}))}};this._dispatchEventFromSandbox(n,i)})),i.addEventListener("keydown",(e=>{a.commitKey=1;let i=-1;if("Escape"===e.key?i=0:"Enter"!==e.key||this.data.multiLine?"Tab"===e.key&&(a.commitKey=3):i=2,-1===i)return;const{value:n}=e.target;a.lastCommittedValue!==n&&(a.lastCommittedValue=n,a.userValue=n,this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t,name:"Keystroke",value:n,willCommit:!0,commitKey:i,selStart:e.target.selectionStart,selEnd:e.target.selectionEnd}}))}));const n=o;o=null,i.addEventListener("blur",(e=>{if(!e.relatedTarget)return;const{value:i}=e.target;a.userValue=i,a.lastCommittedValue!==i&&this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t,name:"Keystroke",value:i,willCommit:!0,commitKey:a.commitKey,selStart:e.target.selectionStart,selEnd:e.target.selectionEnd}}),n(e)})),this.data.actions?.Keystroke&&i.addEventListener("beforeinput",(e=>{a.lastCommittedValue=null;const{data:i,target:n}=e,{value:s,selectionStart:r,selectionEnd:o}=n;let l=r,c=o;switch(e.inputType){case"deleteWordBackward":{const e=s.substring(0,r).match(/\w*[^\w]*$/);e&&(l-=e[0].length);break}case"deleteWordForward":{const e=s.substring(r).match(/^[^\w]*\w*/);e&&(c+=e[0].length);break}case"deleteContentBackward":r===o&&(l-=1);break;case"deleteContentForward":r===o&&(c+=1)}e.preventDefault(),this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t,name:"Keystroke",value:s,change:i||"",willCommit:!1,selStart:l,selEnd:c}})})),this._setEventListeners(i,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],(e=>e.target.value))}if(o&&i.addEventListener("blur",o),this.data.comb){const e=(this.data.rect[2]-this.data.rect[0])/r;i.classList.add("comb"),i.style.letterSpacing=`calc(${e}px * var(--scale-factor) - 1ch)`}}else i=document.createElement("div"),i.textContent=this.data.fieldValue,i.style.verticalAlign="middle",i.style.display="table-cell";return this._setTextStyle(i),this._setBackgroundColor(i),this._setDefaultPropertiesFromJS(i),this.container.append(i),this.container}}class _ extends f{constructor(e){super(e,{isRenderable:e.renderForms})}render(){const e=this.annotationStorage,t=this.data,i=t.id;let n=e.getValue(i,{value:t.exportValue===t.fieldValue}).value;"string"==typeof n&&(n="Off"!==n,e.setValue(i,{value:n})),this.container.classList.add("buttonWidgetAnnotation","checkBox");const s=document.createElement("input");return c.add(s),s.setAttribute("data-element-id",i),s.disabled=t.readOnly,this._setRequired(s,this.data.required),s.type="checkbox",s.name=t.fieldName,n&&s.setAttribute("checked",!0),s.setAttribute("exportValue",t.exportValue),s.tabIndex=l,s.addEventListener("change",(n=>{const{name:s,checked:r}=n.target;for(const n of this._getElementsByName(s,i)){const i=r&&n.exportValue===t.exportValue;n.domElement&&(n.domElement.checked=i),e.setValue(n.id,{value:i})}e.setValue(i,{value:r})})),s.addEventListener("resetform",(e=>{const i=t.defaultFieldValue||"Off";e.target.checked=i===t.exportValue})),this.enableScripting&&this.hasJSActions&&(s.addEventListener("updatefromsandbox",(t=>{const n={value(t){t.target.checked="Off"!==t.detail.value,e.setValue(i,{value:t.target.checked})}};this._dispatchEventFromSandbox(n,t)})),this._setEventListeners(s,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],(e=>e.target.checked))),this._setBackgroundColor(s),this._setDefaultPropertiesFromJS(s),this.container.append(s),this.container}}class v extends f{constructor(e){super(e,{isRenderable:e.renderForms})}render(){this.container.classList.add("buttonWidgetAnnotation","radioButton");const e=this.annotationStorage,t=this.data,i=t.id;let n=e.getValue(i,{value:t.fieldValue===t.buttonValue}).value;"string"==typeof n&&(n=n!==t.buttonValue,e.setValue(i,{value:n}));const s=document.createElement("input");if(c.add(s),s.setAttribute("data-element-id",i),s.disabled=t.readOnly,this._setRequired(s,this.data.required),s.type="radio",s.name=t.fieldName,n&&s.setAttribute("checked",!0),s.tabIndex=l,s.addEventListener("change",(t=>{const{name:n,checked:s}=t.target;for(const t of this._getElementsByName(n,i))e.setValue(t.id,{value:!1});e.setValue(i,{value:s})})),s.addEventListener("resetform",(e=>{const i=t.defaultFieldValue;e.target.checked=null!=i&&i===t.buttonValue})),this.enableScripting&&this.hasJSActions){const n=t.buttonValue;s.addEventListener("updatefromsandbox",(t=>{const s={value:t=>{const s=n===t.detail.value;for(const n of this._getElementsByName(t.target.name)){const t=s&&n.id===i;n.domElement&&(n.domElement.checked=t),e.setValue(n.id,{value:t})}}};this._dispatchEventFromSandbox(s,t)})),this._setEventListeners(s,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],(e=>e.target.checked))}return this._setBackgroundColor(s),this._setDefaultPropertiesFromJS(s),this.container.append(s),this.container}}class b extends p{constructor(e){super(e,{ignoreBorder:e.data.hasAppearance})}render(){const e=super.render();e.classList.add("buttonWidgetAnnotation","pushButton"),this.data.alternativeText&&(e.title=this.data.alternativeText);const t=e.lastChild;return this.enableScripting&&this.hasJSActions&&t&&(this._setDefaultPropertiesFromJS(t),t.addEventListener("updatefromsandbox",(e=>{this._dispatchEventFromSandbox({},e)}))),e}}class y extends f{constructor(e){super(e,{isRenderable:e.renderForms})}render(){this.container.classList.add("choiceWidgetAnnotation");const e=this.annotationStorage,t=this.data.id,i=e.getValue(t,{value:this.data.fieldValue}),n=document.createElement("select");c.add(n),n.setAttribute("data-element-id",t),n.disabled=this.data.readOnly,this._setRequired(n,this.data.required),n.name=this.data.fieldName,n.tabIndex=l;let s=this.data.combo&&this.data.options.length>0;this.data.combo||(n.size=this.data.options.length,this.data.multiSelect&&(n.multiple=!0)),n.addEventListener("resetform",(e=>{const t=this.data.defaultFieldValue;for(const e of n.options)e.selected=e.value===t}));for(const e of this.data.options){const t=document.createElement("option");t.textContent=e.displayValue,t.value=e.exportValue,i.value.includes(e.exportValue)&&(t.setAttribute("selected",!0),s=!1),n.append(t)}let r=null;if(s){const e=document.createElement("option");e.value=" ",e.setAttribute("hidden",!0),e.setAttribute("selected",!0),n.prepend(e),r=()=>{e.remove(),n.removeEventListener("input",r),r=null},n.addEventListener("input",r)}const a=e=>{const t=e?"value":"textContent",{options:i,multiple:s}=n;return s?Array.prototype.filter.call(i,(e=>e.selected)).map((e=>e[t])):-1===i.selectedIndex?null:i[i.selectedIndex][t]};let o=a(!1);const h=e=>{const t=e.target.options;return Array.prototype.map.call(t,(e=>({displayValue:e.textContent,exportValue:e.value})))};return this.enableScripting&&this.hasJSActions?(n.addEventListener("updatefromsandbox",(i=>{const s={value(i){r?.();const s=i.detail.value,l=new Set(Array.isArray(s)?s:[s]);for(const e of n.options)e.selected=l.has(e.value);e.setValue(t,{value:a(!0)}),o=a(!1)},multipleSelection(e){n.multiple=!0},remove(i){const s=n.options,r=i.detail.remove;s[r].selected=!1,n.remove(r),s.length>0&&-1===Array.prototype.findIndex.call(s,(e=>e.selected))&&(s[0].selected=!0),e.setValue(t,{value:a(!0),items:h(i)}),o=a(!1)},clear(i){for(;0!==n.length;)n.remove(0);e.setValue(t,{value:null,items:[]}),o=a(!1)},insert(i){const{index:s,displayValue:r,exportValue:l}=i.detail.insert,c=n.children[s],d=document.createElement("option");d.textContent=r,d.value=l,c?c.before(d):n.append(d),e.setValue(t,{value:a(!0),items:h(i)}),o=a(!1)},items(i){const{items:s}=i.detail;for(;0!==n.length;)n.remove(0);for(const e of s){const{displayValue:t,exportValue:i}=e,s=document.createElement("option");s.textContent=t,s.value=i,n.append(s)}n.options.length>0&&(n.options[0].selected=!0),e.setValue(t,{value:a(!0),items:h(i)}),o=a(!1)},indices(i){const n=new Set(i.detail.indices);for(const e of i.target.options)e.selected=n.has(e.index);e.setValue(t,{value:a(!0)}),o=a(!1)},editable(e){e.target.disabled=!e.detail.editable}};this._dispatchEventFromSandbox(s,i)})),n.addEventListener("input",(i=>{const n=a(!0);e.setValue(t,{value:n}),i.preventDefault(),this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t,name:"Keystroke",value:o,changeEx:n,willCommit:!1,commitKey:1,keyDown:!1}})})),this._setEventListeners(n,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"],["input","Action"],["input","Validate"]],(e=>e.target.value))):n.addEventListener("input",(function(i){e.setValue(t,{value:a(!0)})})),this.data.combo&&this._setTextStyle(n),this._setBackgroundColor(n),this._setDefaultPropertiesFromJS(n),this.container.append(n),this.container}}class S extends u{static IGNORE_TYPES=new Set(["Line","Square","Circle","PolyLine","Polygon","Ink"]);constructor(e){const{data:t}=e;super(e,{isRenderable:!S.IGNORE_TYPES.has(t.parentType)&&!!(t.titleObj?.str||t.contentsObj?.str||t.richText?.str)})}render(){this.container.classList.add("popupAnnotation");const e=this.layer.querySelectorAll(`[data-annotation-id="${this.data.parentId}"]`);if(0===e.length)return this.container;const t=new P({container:this.container,trigger:Array.from(e),color:this.data.color,titleObj:this.data.titleObj,modificationDate:this.data.modificationDate,contentsObj:this.data.contentsObj,richText:this.data.richText}),i=this.page,s=n.Util.normalizeRect([this.data.parentRect[0],i.view[3]-this.data.parentRect[1]+i.view[1],this.data.parentRect[2],i.view[3]-this.data.parentRect[3]+i.view[1]]),r=s[0]+this.data.parentRect[2]-this.data.parentRect[0],a=s[1],{pageWidth:o,pageHeight:l,pageX:c,pageY:h}=this.viewport.rawDims;return this.container.style.left=100*(r-c)/o+"%",this.container.style.top=100*(a-h)/l+"%",this.container.append(t.render()),this.container}}class P{constructor(e){this.container=e.container,this.trigger=e.trigger,this.color=e.color,this.titleObj=e.titleObj,this.modificationDate=e.modificationDate,this.contentsObj=e.contentsObj,this.richText=e.richText,this.hideWrapper=e.hideWrapper||!1,this.pinned=!1}render(){const e=document.createElement("div");e.classList.add("popupWrapper"),this.hideElement=this.hideWrapper?e:this.container,this.hideElement.hidden=!0;const t=document.createElement("div");t.classList.add("popup");const i=this.color;if(i){const e=.7*(255-i[0])+i[0],s=.7*(255-i[1])+i[1],r=.7*(255-i[2])+i[2];t.style.backgroundColor=n.Util.makeHexColor(0|e,0|s,0|r)}const r=document.createElement("h1");r.dir=this.titleObj.dir,r.textContent=this.titleObj.str,t.append(r);const a=s.PDFDateString.toDateObject(this.modificationDate);if(a){const e=document.createElement("span");e.classList.add("popupDate"),e.textContent="{{date}}, {{time}}",e.dataset.l10nId="annotation_date_string",e.dataset.l10nArgs=JSON.stringify({date:a.toLocaleDateString(),time:a.toLocaleTimeString()}),t.append(e)}if(!this.richText?.str||this.contentsObj?.str&&this.contentsObj.str!==this.richText.str){const e=this._formatContents(this.contentsObj);t.append(e)}else o.XfaLayer.render({xfaHtml:this.richText.html,intent:"richText",div:t}),t.lastChild.classList.add("richText","popupContent");Array.isArray(this.trigger)||(this.trigger=[this.trigger]);for(const e of this.trigger)e.addEventListener("click",this._toggle.bind(this)),e.addEventListener("mouseover",this._show.bind(this,!1)),e.addEventListener("mouseout",this._hide.bind(this,!1));return t.addEventListener("click",this._hide.bind(this,!0)),e.append(t),e}_formatContents({str:e,dir:t}){const i=document.createElement("p");i.classList.add("popupContent"),i.dir=t;const n=e.split(/(?:\r\n?|\n)/);for(let e=0,t=n.length;e<t;++e){const s=n[e];i.append(document.createTextNode(s)),e<t-1&&i.append(document.createElement("br"))}return i}_toggle(){this.pinned?this._hide(!0):this._show(!0)}_show(e=!1){e&&(this.pinned=!0),this.hideElement.hidden&&(this.hideElement.hidden=!1,this.container.style.zIndex=parseInt(this.container.style.zIndex)+1e3)}_hide(e=!0){e&&(this.pinned=!1),this.hideElement.hidden||this.pinned||(this.hideElement.hidden=!0,this.container.style.zIndex=parseInt(this.container.style.zIndex)-1e3)}}class A extends u{constructor(e){super(e,{isRenderable:!!(e.data.hasPopup||e.data.titleObj?.str||e.data.contentsObj?.str||e.data.richText?.str),ignoreBorder:!0}),this.textContent=e.data.textContent}render(){if(this.container.classList.add("freeTextAnnotation"),this.textContent){const e=document.createElement("div");e.classList.add("annotationTextContent"),e.setAttribute("role","comment");for(const t of this.textContent){const i=document.createElement("span");i.textContent=t,e.append(i)}this.container.append(e)}return this.data.hasPopup||this._createPopup(null,this.data),this.container}}class w extends u{constructor(e){super(e,{isRenderable:!!(e.data.hasPopup||e.data.titleObj?.str||e.data.contentsObj?.str||e.data.richText?.str),ignoreBorder:!0})}render(){this.container.classList.add("lineAnnotation");const e=this.data,{width:t,height:i}=h(e.rect),n=this.svgFactory.create(t,i,!0),s=this.svgFactory.createElement("svg:line");return s.setAttribute("x1",e.rect[2]-e.lineCoordinates[0]),s.setAttribute("y1",e.rect[3]-e.lineCoordinates[1]),s.setAttribute("x2",e.rect[2]-e.lineCoordinates[2]),s.setAttribute("y2",e.rect[3]-e.lineCoordinates[3]),s.setAttribute("stroke-width",e.borderStyle.width||1),s.setAttribute("stroke","transparent"),s.setAttribute("fill","transparent"),n.append(s),this.container.append(n),this._createPopup(s,e),this.container}}class E extends u{constructor(e){super(e,{isRenderable:!!(e.data.hasPopup||e.data.titleObj?.str||e.data.contentsObj?.str||e.data.richText?.str),ignoreBorder:!0})}render(){this.container.classList.add("squareAnnotation");const e=this.data,{width:t,height:i}=h(e.rect),n=this.svgFactory.create(t,i,!0),s=e.borderStyle.width,r=this.svgFactory.createElement("svg:rect");return r.setAttribute("x",s/2),r.setAttribute("y",s/2),r.setAttribute("width",t-s),r.setAttribute("height",i-s),r.setAttribute("stroke-width",s||1),r.setAttribute("stroke","transparent"),r.setAttribute("fill","transparent"),n.append(r),this.container.append(n),this._createPopup(r,e),this.container}}class C extends u{constructor(e){super(e,{isRenderable:!!(e.data.hasPopup||e.data.titleObj?.str||e.data.contentsObj?.str||e.data.richText?.str),ignoreBorder:!0})}render(){this.container.classList.add("circleAnnotation");const e=this.data,{width:t,height:i}=h(e.rect),n=this.svgFactory.create(t,i,!0),s=e.borderStyle.width,r=this.svgFactory.createElement("svg:ellipse");return r.setAttribute("cx",t/2),r.setAttribute("cy",i/2),r.setAttribute("rx",t/2-s/2),r.setAttribute("ry",i/2-s/2),r.setAttribute("stroke-width",s||1),r.setAttribute("stroke","transparent"),r.setAttribute("fill","transparent"),n.append(r),this.container.append(n),this._createPopup(r,e),this.container}}class x extends u{constructor(e){super(e,{isRenderable:!!(e.data.hasPopup||e.data.titleObj?.str||e.data.contentsObj?.str||e.data.richText?.str),ignoreBorder:!0}),this.containerClassName="polylineAnnotation",this.svgElementName="svg:polyline"}render(){this.container.classList.add(this.containerClassName);const e=this.data,{width:t,height:i}=h(e.rect),n=this.svgFactory.create(t,i,!0);let s=[];for(const t of e.vertices){const i=t.x-e.rect[0],n=e.rect[3]-t.y;s.push(i+","+n)}s=s.join(" ");const r=this.svgFactory.createElement(this.svgElementName);return r.setAttribute("points",s),r.setAttribute("stroke-width",e.borderStyle.width||1),r.setAttribute("stroke","transparent"),r.setAttribute("fill","transparent"),n.append(r),this.container.append(n),this._createPopup(r,e),this.container}}class M extends x{constructor(e){super(e),this.containerClassName="polygonAnnotation",this.svgElementName="svg:polygon"}}class T extends u{constructor(e){super(e,{isRenderable:!!(e.data.hasPopup||e.data.titleObj?.str||e.data.contentsObj?.str||e.data.richText?.str),ignoreBorder:!0})}render(){return this.container.classList.add("caretAnnotation"),this.data.hasPopup||this._createPopup(null,this.data),this.container}}class F extends u{constructor(e){super(e,{isRenderable:!!(e.data.hasPopup||e.data.titleObj?.str||e.data.contentsObj?.str||e.data.richText?.str),ignoreBorder:!0}),this.containerClassName="inkAnnotation",this.svgElementName="svg:polyline"}render(){this.container.classList.add(this.containerClassName);const e=this.data,{width:t,height:i}=h(e.rect),n=this.svgFactory.create(t,i,!0);for(const t of e.inkLists){let i=[];for(const n of t){const t=n.x-e.rect[0],s=e.rect[3]-n.y;i.push(`${t},${s}`)}i=i.join(" ");const s=this.svgFactory.createElement(this.svgElementName);s.setAttribute("points",i),s.setAttribute("stroke-width",e.borderStyle.width||1),s.setAttribute("stroke","transparent"),s.setAttribute("fill","transparent"),this._createPopup(s,e),n.append(s)}return this.container.append(n),this.container}}class D extends u{constructor(e){super(e,{isRenderable:!!(e.data.hasPopup||e.data.titleObj?.str||e.data.contentsObj?.str||e.data.richText?.str),ignoreBorder:!0,createQuadrilaterals:!0})}render(){return this.data.hasPopup||this._createPopup(null,this.data),this.quadrilaterals?this._renderQuadrilaterals("highlightAnnotation"):(this.container.classList.add("highlightAnnotation"),this.container)}}class k extends u{constructor(e){super(e,{isRenderable:!!(e.data.hasPopup||e.data.titleObj?.str||e.data.contentsObj?.str||e.data.richText?.str),ignoreBorder:!0,createQuadrilaterals:!0})}render(){return this.data.hasPopup||this._createPopup(null,this.data),this.quadrilaterals?this._renderQuadrilaterals("underlineAnnotation"):(this.container.classList.add("underlineAnnotation"),this.container)}}class R extends u{constructor(e){super(e,{isRenderable:!!(e.data.hasPopup||e.data.titleObj?.str||e.data.contentsObj?.str||e.data.richText?.str),ignoreBorder:!0,createQuadrilaterals:!0})}render(){return this.data.hasPopup||this._createPopup(null,this.data),this.quadrilaterals?this._renderQuadrilaterals("squigglyAnnotation"):(this.container.classList.add("squigglyAnnotation"),this.container)}}class L extends u{constructor(e){super(e,{isRenderable:!!(e.data.hasPopup||e.data.titleObj?.str||e.data.contentsObj?.str||e.data.richText?.str),ignoreBorder:!0,createQuadrilaterals:!0})}render(){return this.data.hasPopup||this._createPopup(null,this.data),this.quadrilaterals?this._renderQuadrilaterals("strikeoutAnnotation"):(this.container.classList.add("strikeoutAnnotation"),this.container)}}class I extends u{constructor(e){super(e,{isRenderable:!!(e.data.hasPopup||e.data.titleObj?.str||e.data.contentsObj?.str||e.data.richText?.str),ignoreBorder:!0})}render(){return this.container.classList.add("stampAnnotation"),this.data.hasPopup||this._createPopup(null,this.data),this.container}}class O extends u{constructor(e){super(e,{isRenderable:!0});const{filename:t,content:i}=this.data.file;this.filename=(0,s.getFilenameFromUrl)(t,!0),this.content=i,this.linkService.eventBus?.dispatch("fileattachmentannotation",{source:this,filename:t,content:i})}render(){let e;return this.container.classList.add("fileAttachmentAnnotation"),this.data.hasAppearance?e=document.createElement("div"):(e=document.createElement("img"),e.src=`${this.imageResourcesPath}annotation-${/paperclip/i.test(this.data.name)?"paperclip":"pushpin"}.svg`),e.classList.add("popupTriggerArea"),e.addEventListener("dblclick",this._download.bind(this)),!this.data.hasPopup&&(this.data.titleObj?.str||this.data.contentsObj?.str||this.data.richText)&&this._createPopup(e,this.data),this.container.append(e),this.container}_download(){this.downloadManager?.openOrDownloadData(this.container,this.content,this.filename)}}class N{static#Bt(e,t,i,n){const r=e.firstChild||e;r.id=`${s.AnnotationPrefix}${t}`,i.append(e),n?.moveElementInDOM(i,e,r,!1)}static render(e){const{annotations:t,div:i,viewport:a,accessibilityManager:o}=e;(0,s.setLayerDimensions)(i,a);const l={data:null,layer:i,page:e.page,viewport:a,linkService:e.linkService,downloadManager:e.downloadManager,imageResourcesPath:e.imageResourcesPath||"",renderForms:!1!==e.renderForms,svgFactory:new s.DOMSVGFactory,annotationStorage:e.annotationStorage||new r.AnnotationStorage,enableScripting:!0===e.enableScripting,hasJSActions:e.hasJSActions,fieldObjects:e.fieldObjects};let c=0;for(const e of t){if(e.noHTML)continue;if(e.annotationType!==n.AnnotationType.POPUP){const{width:t,height:i}=h(e.rect);if(t<=0||i<=0)continue}l.data=e;const t=d.create(l);if(!t.isRenderable)continue;const s=t.render();if(e.hidden&&(s.style.visibility="hidden"),Array.isArray(s))for(const t of s)t.style.zIndex=c++,N.#Bt(t,e.id,i,o);else s.style.zIndex=c++,t instanceof S?i.prepend(s):N.#Bt(s,e.id,i,o)}this.#Ut(i,e.annotationCanvasMap)}static update(e){const{annotationCanvasMap:t,div:i,viewport:n}=e;(0,s.setLayerDimensions)(i,{rotation:n.rotation}),this.#Ut(i,t),i.hidden=!1}static#Ut(e,t){if(t){for(const[i,n]of t){const t=e.querySelector(`[data-annotation-id="${i}"]`);if(!t)continue;const{firstChild:s}=t;s?"CANVAS"===s.nodeName?s.replaceWith(n):s.before(n):t.append(n)}t.clear()}}}t.AnnotationLayer=N},(e,t)=>{function i(e){return Math.floor(255*Math.max(0,Math.min(1,e))).toString(16).padStart(2,"0")}Object.defineProperty(t,"__esModule",{value:!0}),t.ColorConverters=void 0,t.ColorConverters=class{static CMYK_G([e,t,i,n]){return["G",1-Math.min(1,.3*e+.59*i+.11*t+n)]}static G_CMYK([e]){return["CMYK",0,0,0,1-e]}static G_RGB([e]){return["RGB",e,e,e]}static G_HTML([e]){const t=i(e);return`#${t}${t}${t}`}static RGB_G([e,t,i]){return["G",.3*e+.59*t+.11*i]}static RGB_HTML([e,t,n]){return`#${i(e)}${i(t)}${i(n)}`}static T_HTML(){return"#00000000"}static CMYK_RGB([e,t,i,n]){return["RGB",1-Math.min(1,e+n),1-Math.min(1,i+n),1-Math.min(1,t+n)]}static CMYK_HTML(e){const t=this.CMYK_RGB(e).slice(1);return this.RGB_HTML(t)}static RGB_CMYK([e,t,i]){const n=1-e,s=1-t,r=1-i;return["CMYK",n,s,r,Math.min(n,s,r)]}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.XfaLayer=void 0;var n=i(19);t.XfaLayer=class{static setupStorage(e,t,i,n,s){const r=n.getValue(t,{value:null});switch(i.name){case"textarea":if(null!==r.value&&(e.textContent=r.value),"print"===s)break;e.addEventListener("input",(e=>{n.setValue(t,{value:e.target.value})}));break;case"input":if("radio"===i.attributes.type||"checkbox"===i.attributes.type){if(r.value===i.attributes.xfaOn?e.setAttribute("checked",!0):r.value===i.attributes.xfaOff&&e.removeAttribute("checked"),"print"===s)break;e.addEventListener("change",(e=>{n.setValue(t,{value:e.target.checked?e.target.getAttribute("xfaOn"):e.target.getAttribute("xfaOff")})}))}else{if(null!==r.value&&e.setAttribute("value",r.value),"print"===s)break;e.addEventListener("input",(e=>{n.setValue(t,{value:e.target.value})}))}break;case"select":if(null!==r.value)for(const e of i.children)e.attributes.value===r.value&&(e.attributes.selected=!0);e.addEventListener("input",(e=>{const i=e.target.options,s=-1===i.selectedIndex?"":i[i.selectedIndex].value;n.setValue(t,{value:s})}))}}static setAttributes({html:e,element:t,storage:i=null,intent:n,linkService:s}){const{attributes:r}=t,a=e instanceof HTMLAnchorElement;"radio"===r.type&&(r.name=`${r.name}-${n}`);for(const[t,i]of Object.entries(r))if(null!=i)switch(t){case"class":i.length&&e.setAttribute(t,i.join(" "));break;case"dataId":break;case"id":e.setAttribute("data-element-id",i);break;case"style":Object.assign(e.style,i);break;case"textContent":e.textContent=i;break;default:(!a||"href"!==t&&"newWindow"!==t)&&e.setAttribute(t,i)}a&&s.addLinkAttributes(e,r.href,r.newWindow),i&&r.dataId&&this.setupStorage(e,r.dataId,t,i)}static render(e){const t=e.annotationStorage,i=e.linkService,s=e.xfaHtml,r=e.intent||"display",a=document.createElement(s.name);s.attributes&&this.setAttributes({html:a,element:s,intent:r,linkService:i});const o=[[s,-1,a]],l=e.div;if(l.append(a),e.viewport){const t=`matrix(${e.viewport.transform.join(",")})`;l.style.transform=t}"richText"!==r&&l.setAttribute("class","xfaLayer xfaFont");const c=[];for(;o.length>0;){const[e,s,a]=o.at(-1);if(s+1===e.children.length){o.pop();continue}const l=e.children[++o.at(-1)[1]];if(null===l)continue;const{name:h}=l;if("#text"===h){const e=document.createTextNode(l.value);c.push(e),a.append(e);continue}let d;if(d=l?.attributes?.xmlns?document.createElementNS(l.attributes.xmlns,h):document.createElement(h),a.append(d),l.attributes&&this.setAttributes({html:d,element:l,storage:t,intent:r,linkService:i}),l.children&&l.children.length>0)o.push([l,-1,d]);else if(l.value){const e=document.createTextNode(l.value);n.XfaText.shouldBuildText(h)&&c.push(e),d.append(e)}}for(const e of l.querySelectorAll(".xfaNonInteractive input, .xfaNonInteractive textarea"))e.setAttribute("readOnly",!0);return{textDivs:c}}static update(e){const t=`matrix(${e.viewport.transform.join(",")})`;e.div.style.transform=t,e.div.hidden=!1}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SVGGraphics=void 0;var n=i(6),s=i(1),r=i(10);let a=class{constructor(){(0,s.unreachable)("Not implemented: SVGGraphics")}};t.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",h=["butt","round","square"],d=["miter","round","bevel"],u=function(e,t="",i=!1){if(URL.createObjectURL&&"undefined"!=typeof Blob&&!i)return URL.createObjectURL(new Blob([e],{type:t}));const n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";let s=`data:${t};base64,`;for(let t=0,i=e.length;t<i;t+=3){const r=255&e[t],a=255&e[t+1],o=255&e[t+2];s+=n[r>>2]+n[(3&r)<<4|a>>4]+n[t+1<i?(15&a)<<2|o>>6:64]+n[t+2<i?63&o:64]}return s},p=function(){const e=new Uint8Array([137,80,78,71,13,10,26,10]),t=new Int32Array(256);for(let e=0;e<256;e++){let i=e;for(let e=0;e<8;e++)i=1&i?3988292384^i>>1&2147483647:i>>1&2147483647;t[e]=i}function i(e,i,n,s){let r=s;const a=i.length;n[r]=a>>24&255,n[r+1]=a>>16&255,n[r+2]=a>>8&255,n[r+3]=255&a,r+=4,n[r]=255&e.charCodeAt(0),n[r+1]=255&e.charCodeAt(1),n[r+2]=255&e.charCodeAt(2),n[r+3]=255&e.charCodeAt(3),r+=4,n.set(i,r),r+=i.length;const o=function(e,i,n){let s=-1;for(let r=i;r<n;r++){const i=255&(s^e[r]);s=s>>>8^t[i]}return-1^s}(n,s+4,r);n[r]=o>>24&255,n[r+1]=o>>16&255,n[r+2]=o>>8&255,n[r+3]=255&o}function n(e){let t=e.length;const i=65535,n=Math.ceil(t/i),s=new Uint8Array(2+t+5*n+4);let r=0;s[r++]=120,s[r++]=156;let a=0;for(;t>i;)s[r++]=0,s[r++]=255,s[r++]=255,s[r++]=0,s[r++]=0,s.set(e.subarray(a,a+i),r),r+=i,a+=i,t-=i;s[r++]=1,s[r++]=255&t,s[r++]=t>>8&255,s[r++]=255&~t,s[r++]=(65535&~t)>>8&255,s.set(e.subarray(a),r),r+=e.length-a;const o=function(e,t,i){let n=1,s=0;for(let r=t;r<i;++r)n=(n+(255&e[r]))%65521,s=(s+n)%65521;return s<<16|n}(e,0,e.length);return s[r++]=o>>24&255,s[r++]=o>>16&255,s[r++]=o>>8&255,s[r++]=255&o,s}function a(t,a,o,l){const c=t.width,h=t.height;let d,p,g;const f=t.data;switch(a){case s.ImageKind.GRAYSCALE_1BPP:p=0,d=1,g=c+7>>3;break;case s.ImageKind.RGB_24BPP:p=2,d=8,g=3*c;break;case s.ImageKind.RGBA_32BPP:p=6,d=8,g=4*c;break;default:throw new Error("invalid format")}const m=new Uint8Array((1+g)*h);let _=0,v=0;for(let e=0;e<h;++e)m[_++]=0,m.set(f.subarray(v,v+g),_),v+=g,_+=g;if(a===s.ImageKind.GRAYSCALE_1BPP&&l){_=0;for(let e=0;e<h;e++){_++;for(let e=0;e<g;e++)m[_++]^=255}}const b=new Uint8Array([c>>24&255,c>>16&255,c>>8&255,255&c,h>>24&255,h>>16&255,h>>8&255,255&h,d,p,0,0,0]),y=function(e){if(!r.isNodeJS)return n(e);try{let t;t=parseInt(process.versions.node)>=8?e:Buffer.from(e);const i=require$$5.deflateSync(t,{level:9});return i instanceof Uint8Array?i:new Uint8Array(i)}catch(e){(0,s.warn)("Not compressing PNG because zlib.deflateSync is unavailable: "+e)}return n(e)}(m),S=e.length+36+b.length+y.length,P=new Uint8Array(S);let A=0;return P.set(e,A),A+=e.length,i("IHDR",b,P,A),A+=12+b.length,i("IDATA",y,P,A),A+=12+y.length,i("IEND",new Uint8Array(0),P,A),u(P,"image/png",o)}return function(e,t,i){return a(e,void 0===e.kind?s.ImageKind.GRAYSCALE_1BPP:e.kind,t,i)}}();class g{constructor(){this.fontSizeScale=1,this.fontWeight=o.fontWeight,this.fontSize=0,this.textMatrix=s.IDENTITY_MATRIX,this.fontMatrix=s.FONT_IDENTITY_MATRIX,this.leading=0,this.textRenderingMode=s.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(e,t){this.x=e,this.y=t}}function f(e){let t=[];const i=[];for(const n of e)"save"!==n.fn?"restore"===n.fn?t=i.pop():t.push(n):(t.push({fnId:92,fn:"group",items:[]}),i.push(t),t=t.at(-1).items);return t}function m(e){if(Number.isInteger(e))return e.toString();const t=e.toFixed(10);let i=t.length-1;if("0"!==t[i])return t;do{i--}while("0"===t[i]);return t.substring(0,"."===t[i]?i:i+1)}function _(e){if(0===e[4]&&0===e[5]){if(0===e[1]&&0===e[2])return 1===e[0]&&1===e[3]?"":`scale(${m(e[0])} ${m(e[3])})`;if(e[0]===e[3]&&e[1]===-e[2])return`rotate(${m(180*Math.acos(e[0])/Math.PI)})`}else if(1===e[0]&&0===e[1]&&0===e[2]&&1===e[3])return`translate(${m(e[4])} ${m(e[5])})`;return`matrix(${m(e[0])} ${m(e[1])} ${m(e[2])} ${m(e[3])} ${m(e[4])} ${m(e[5])})`}let v=0,b=0,y=0;t.SVGGraphics=a=class{constructor(e,t,i=!1){(0,n.deprecated)("The SVG back-end is no longer maintained and *may* be removed in the future."),this.svgFactory=new n.DOMSVGFactory,this.current=new g,this.transformMatrix=s.IDENTITY_MATRIX,this.transformStack=[],this.extraStack=[],this.commonObjs=e,this.objs=t,this.pendingClip=null,this.pendingEOFill=!1,this.embedFonts=!1,this.embeddedFonts=Object.create(null),this.cssStyle=null,this.forceDataSchema=!!i,this._operatorIdMapping=[];for(const e in s.OPS)this._operatorIdMapping[s.OPS[e]]=e}getObject(e,t=null){return"string"==typeof e?e.startsWith("g_")?this.commonObjs.get(e):this.objs.get(e):t}save(){this.transformStack.push(this.transformMatrix);const e=this.current;this.extraStack.push(e),this.current=e.clone()}restore(){this.transformMatrix=this.transformStack.pop(),this.current=this.extraStack.pop(),this.pendingClip=null,this.tgrp=null}group(e){this.save(),this.executeOpTree(e),this.restore()}loadDependencies(e){const t=e.fnArray,i=e.argsArray;for(let e=0,n=t.length;e<n;e++)if(t[e]===s.OPS.dependency)for(const t of i[e]){const e=t.startsWith("g_")?this.commonObjs:this.objs,i=new Promise((i=>{e.get(t,i)}));this.current.dependencies.push(i)}return Promise.all(this.current.dependencies)}transform(e,t,i,n,r,a){const o=[e,t,i,n,r,a];this.transformMatrix=s.Util.transform(this.transformMatrix,o),this.tgrp=null}getSVG(e,t){this.viewport=t;const i=this._initialize(t);return this.loadDependencies(e).then((()=>(this.transformMatrix=s.IDENTITY_MATRIX,this.executeOpTree(this.convertOpList(e)),i)))}convertOpList(e){const t=this._operatorIdMapping,i=e.argsArray,n=e.fnArray,s=[];for(let e=0,r=n.length;e<r;e++){const r=n[e];s.push({fnId:r,fn:t[r],args:i[e]})}return f(s)}executeOpTree(e){for(const t of e){const e=t.fn,i=t.fnId,n=t.args;switch(0|i){case s.OPS.beginText:this.beginText();break;case s.OPS.dependency:break;case s.OPS.setLeading:this.setLeading(n);break;case s.OPS.setLeadingMoveText:this.setLeadingMoveText(n[0],n[1]);break;case s.OPS.setFont:this.setFont(n);break;case s.OPS.showText:case s.OPS.showSpacedText:this.showText(n[0]);break;case s.OPS.endText:this.endText();break;case s.OPS.moveText:this.moveText(n[0],n[1]);break;case s.OPS.setCharSpacing:this.setCharSpacing(n[0]);break;case s.OPS.setWordSpacing:this.setWordSpacing(n[0]);break;case s.OPS.setHScale:this.setHScale(n[0]);break;case s.OPS.setTextMatrix:this.setTextMatrix(n[0],n[1],n[2],n[3],n[4],n[5]);break;case s.OPS.setTextRise:this.setTextRise(n[0]);break;case s.OPS.setTextRenderingMode:this.setTextRenderingMode(n[0]);break;case s.OPS.setLineWidth:this.setLineWidth(n[0]);break;case s.OPS.setLineJoin:this.setLineJoin(n[0]);break;case s.OPS.setLineCap:this.setLineCap(n[0]);break;case s.OPS.setMiterLimit:this.setMiterLimit(n[0]);break;case s.OPS.setFillRGBColor:this.setFillRGBColor(n[0],n[1],n[2]);break;case s.OPS.setStrokeRGBColor:this.setStrokeRGBColor(n[0],n[1],n[2]);break;case s.OPS.setStrokeColorN:this.setStrokeColorN(n);break;case s.OPS.setFillColorN:this.setFillColorN(n);break;case s.OPS.shadingFill:this.shadingFill(n[0]);break;case s.OPS.setDash:this.setDash(n[0],n[1]);break;case s.OPS.setRenderingIntent:this.setRenderingIntent(n[0]);break;case s.OPS.setFlatness:this.setFlatness(n[0]);break;case s.OPS.setGState:this.setGState(n[0]);break;case s.OPS.fill:this.fill();break;case s.OPS.eoFill:this.eoFill();break;case s.OPS.stroke:this.stroke();break;case s.OPS.fillStroke:this.fillStroke();break;case s.OPS.eoFillStroke:this.eoFillStroke();break;case s.OPS.clip:this.clip("nonzero");break;case s.OPS.eoClip:this.clip("evenodd");break;case s.OPS.paintSolidColorImageMask:this.paintSolidColorImageMask();break;case s.OPS.paintImageXObject:this.paintImageXObject(n[0]);break;case s.OPS.paintInlineImageXObject:this.paintInlineImageXObject(n[0]);break;case s.OPS.paintImageMaskXObject:this.paintImageMaskXObject(n[0]);break;case s.OPS.paintFormXObjectBegin:this.paintFormXObjectBegin(n[0],n[1]);break;case s.OPS.paintFormXObjectEnd:this.paintFormXObjectEnd();break;case s.OPS.closePath:this.closePath();break;case s.OPS.closeStroke:this.closeStroke();break;case s.OPS.closeFillStroke:this.closeFillStroke();break;case s.OPS.closeEOFillStroke:this.closeEOFillStroke();break;case s.OPS.nextLine:this.nextLine();break;case s.OPS.transform:this.transform(n[0],n[1],n[2],n[3],n[4],n[5]);break;case s.OPS.constructPath:this.constructPath(n[0],n[1]);break;case s.OPS.endPath:this.endPath();break;case 92:this.group(t.items);break;default:(0,s.warn)(`Unimplemented operator ${e}`)}}}setWordSpacing(e){this.current.wordSpacing=e}setCharSpacing(e){this.current.charSpacing=e}nextLine(){this.moveText(0,this.current.leading)}setTextMatrix(e,t,i,n,s,r){const a=this.current;a.textMatrix=a.lineMatrix=[e,t,i,n,s,r],a.textMatrixScale=Math.hypot(e,t),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",`${m(a.fontSize)}px`),a.tspan.setAttributeNS(null,"y",m(-a.y)),a.txtElement=this.svgFactory.createElement("svg:text"),a.txtElement.append(a.tspan)}beginText(){const e=this.current;e.x=e.lineX=0,e.y=e.lineY=0,e.textMatrix=s.IDENTITY_MATRIX,e.lineMatrix=s.IDENTITY_MATRIX,e.textMatrixScale=1,e.tspan=this.svgFactory.createElement("svg:tspan"),e.txtElement=this.svgFactory.createElement("svg:text"),e.txtgrp=this.svgFactory.createElement("svg:g"),e.xcoords=[],e.ycoords=[]}moveText(e,t){const i=this.current;i.x=i.lineX+=e,i.y=i.lineY+=t,i.xcoords=[],i.ycoords=[],i.tspan=this.svgFactory.createElement("svg:tspan"),i.tspan.setAttributeNS(null,"font-family",i.fontFamily),i.tspan.setAttributeNS(null,"font-size",`${m(i.fontSize)}px`),i.tspan.setAttributeNS(null,"y",m(-i.y))}showText(e){const t=this.current,i=t.font,n=t.fontSize;if(0===n)return;const r=t.fontSizeScale,a=t.charSpacing,c=t.wordSpacing,h=t.fontDirection,d=t.textHScale*h,u=i.vertical,p=u?1:-1,g=i.defaultVMetrics,f=n*t.fontMatrix[0];let v=0;for(const s of e){if(null===s){v+=h*c;continue}if("number"==typeof s){v+=p*s*n/1e3;continue}const e=(s.isSpace?c:0)+a,o=s.fontChar;let l,d,m,_=s.width;if(u){let e;const t=s.vmetric||g;e=s.vmetric?t[1]:.5*_,e=-e*f;const i=t[2]*f;_=t?-t[0]:_,l=e/r,d=(v+i)/r}else l=v/r,d=0;(s.isInFont||i.missingFile)&&(t.xcoords.push(t.x+l),u&&t.ycoords.push(-t.y+d),t.tspan.textContent+=o),m=u?_*f-e*h:_*f+e*h,v+=m}t.tspan.setAttributeNS(null,"x",t.xcoords.map(m).join(" ")),u?t.tspan.setAttributeNS(null,"y",t.ycoords.map(m).join(" ")):t.tspan.setAttributeNS(null,"y",m(-t.y)),u?t.y-=v:t.x+=v*d,t.tspan.setAttributeNS(null,"font-family",t.fontFamily),t.tspan.setAttributeNS(null,"font-size",`${m(t.fontSize)}px`),t.fontStyle!==o.fontStyle&&t.tspan.setAttributeNS(null,"font-style",t.fontStyle),t.fontWeight!==o.fontWeight&&t.tspan.setAttributeNS(null,"font-weight",t.fontWeight);const b=t.textRenderingMode&s.TextRenderingMode.FILL_STROKE_MASK;if(b===s.TextRenderingMode.FILL||b===s.TextRenderingMode.FILL_STROKE?(t.fillColor!==o.fillColor&&t.tspan.setAttributeNS(null,"fill",t.fillColor),t.fillAlpha<1&&t.tspan.setAttributeNS(null,"fill-opacity",t.fillAlpha)):t.textRenderingMode===s.TextRenderingMode.ADD_TO_PATH?t.tspan.setAttributeNS(null,"fill","transparent"):t.tspan.setAttributeNS(null,"fill","none"),b===s.TextRenderingMode.STROKE||b===s.TextRenderingMode.FILL_STROKE){const e=1/(t.textMatrixScale||1);this._setStrokeAttributes(t.tspan,e)}let y=t.textMatrix;0!==t.textRise&&(y=y.slice(),y[5]+=t.textRise),t.txtElement.setAttributeNS(null,"transform",`${_(y)} scale(${m(d)}, -1)`),t.txtElement.setAttributeNS(l,"xml:space","preserve"),t.txtElement.append(t.tspan),t.txtgrp.append(t.txtElement),this._ensureTransformGroup().append(t.txtElement)}setLeadingMoveText(e,t){this.setLeading(-t),this.moveText(e,t)}addFontStyle(e){if(!e.data)throw new Error('addFontStyle: No font data available, ensure that the "fontExtraProperties" API parameter is set.');this.cssStyle||(this.cssStyle=this.svgFactory.createElement("svg:style"),this.cssStyle.setAttributeNS(null,"type","text/css"),this.defs.append(this.cssStyle));const t=u(e.data,e.mimetype,this.forceDataSchema);this.cssStyle.textContent+=`@font-face { font-family: "${e.loadedName}"; src: url(${t}); }\n`}setFont(e){const t=this.current,i=this.commonObjs.get(e[0]);let n=e[1];t.font=i,!this.embedFonts||i.missingFile||this.embeddedFonts[i.loadedName]||(this.addFontStyle(i),this.embeddedFonts[i.loadedName]=i),t.fontMatrix=i.fontMatrix||s.FONT_IDENTITY_MATRIX;let r="normal";i.black?r="900":i.bold&&(r="bold");const a=i.italic?"italic":"normal";n<0?(n=-n,t.fontDirection=-1):t.fontDirection=1,t.fontSize=n,t.fontFamily=i.loadedName,t.fontWeight=r,t.fontStyle=a,t.tspan=this.svgFactory.createElement("svg:tspan"),t.tspan.setAttributeNS(null,"y",m(-t.y)),t.xcoords=[],t.ycoords=[]}endText(){const e=this.current;e.textRenderingMode&s.TextRenderingMode.ADD_TO_PATH_FLAG&&e.txtElement?.hasChildNodes()&&(e.element=e.txtElement,this.clip("nonzero"),this.endPath())}setLineWidth(e){e>0&&(this.current.lineWidth=e)}setLineCap(e){this.current.lineCap=h[e]}setLineJoin(e){this.current.lineJoin=d[e]}setMiterLimit(e){this.current.miterLimit=e}setStrokeAlpha(e){this.current.strokeAlpha=e}setStrokeRGBColor(e,t,i){this.current.strokeColor=s.Util.makeHexColor(e,t,i)}setFillAlpha(e){this.current.fillAlpha=e}setFillRGBColor(e,t,i){this.current.fillColor=s.Util.makeHexColor(e,t,i),this.current.tspan=this.svgFactory.createElement("svg:tspan"),this.current.xcoords=[],this.current.ycoords=[]}setStrokeColorN(e){this.current.strokeColor=this._makeColorN_Pattern(e)}setFillColorN(e){this.current.fillColor=this._makeColorN_Pattern(e)}shadingFill(e){const t=this.viewport.width,i=this.viewport.height,n=s.Util.inverseTransform(this.transformMatrix),r=s.Util.applyTransform([0,0],n),a=s.Util.applyTransform([0,i],n),o=s.Util.applyTransform([t,0],n),l=s.Util.applyTransform([t,i],n),c=Math.min(r[0],a[0],o[0],l[0]),h=Math.min(r[1],a[1],o[1],l[1]),d=Math.max(r[0],a[0],o[0],l[0]),u=Math.max(r[1],a[1],o[1],l[1]),p=this.svgFactory.createElement("svg:rect");p.setAttributeNS(null,"x",c),p.setAttributeNS(null,"y",h),p.setAttributeNS(null,"width",d-c),p.setAttributeNS(null,"height",u-h),p.setAttributeNS(null,"fill",this._makeShadingPattern(e)),this.current.fillAlpha<1&&p.setAttributeNS(null,"fill-opacity",this.current.fillAlpha),this._ensureTransformGroup().append(p)}_makeColorN_Pattern(e){return"TilingPattern"===e[0]?this._makeTilingPattern(e):this._makeShadingPattern(e)}_makeTilingPattern(e){const t=e[1],i=e[2],n=e[3]||s.IDENTITY_MATRIX,[r,a,o,l]=e[4],c=e[5],h=e[6],d=e[7],u="shading"+y++,[p,g,f,m]=s.Util.normalizeRect([...s.Util.applyTransform([r,a],n),...s.Util.applyTransform([o,l],n)]),[_,v]=s.Util.singularValueDecompose2dScale(n),b=c*_,S=h*v,P=this.svgFactory.createElement("svg:pattern");P.setAttributeNS(null,"id",u),P.setAttributeNS(null,"patternUnits","userSpaceOnUse"),P.setAttributeNS(null,"width",b),P.setAttributeNS(null,"height",S),P.setAttributeNS(null,"x",`${p}`),P.setAttributeNS(null,"y",`${g}`);const A=this.svg,w=this.transformMatrix,E=this.current.fillColor,C=this.current.strokeColor,x=this.svgFactory.create(f-p,m-g);if(this.svg=x,this.transformMatrix=n,2===d){const e=s.Util.makeHexColor(...t);this.current.fillColor=e,this.current.strokeColor=e}return this.executeOpTree(this.convertOpList(i)),this.svg=A,this.transformMatrix=w,this.current.fillColor=E,this.current.strokeColor=C,P.append(x.childNodes[0]),this.defs.append(P),`url(#${u})`}_makeShadingPattern(e){switch("string"==typeof e&&(e=this.objs.get(e)),e[0]){case"RadialAxial":const t="shading"+y++,i=e[3];let n;switch(e[1]){case"axial":const i=e[4],s=e[5];n=this.svgFactory.createElement("svg:linearGradient"),n.setAttributeNS(null,"id",t),n.setAttributeNS(null,"gradientUnits","userSpaceOnUse"),n.setAttributeNS(null,"x1",i[0]),n.setAttributeNS(null,"y1",i[1]),n.setAttributeNS(null,"x2",s[0]),n.setAttributeNS(null,"y2",s[1]);break;case"radial":const r=e[4],a=e[5],o=e[6],l=e[7];n=this.svgFactory.createElement("svg:radialGradient"),n.setAttributeNS(null,"id",t),n.setAttributeNS(null,"gradientUnits","userSpaceOnUse"),n.setAttributeNS(null,"cx",a[0]),n.setAttributeNS(null,"cy",a[1]),n.setAttributeNS(null,"r",l),n.setAttributeNS(null,"fx",r[0]),n.setAttributeNS(null,"fy",r[1]),n.setAttributeNS(null,"fr",o);break;default:throw new Error(`Unknown RadialAxial type: ${e[1]}`)}for(const e of i){const t=this.svgFactory.createElement("svg:stop");t.setAttributeNS(null,"offset",e[0]),t.setAttributeNS(null,"stop-color",e[1]),n.append(t)}return this.defs.append(n),`url(#${t})`;case"Mesh":return(0,s.warn)("Unimplemented pattern Mesh"),null;case"Dummy":return"hotpink";default:throw new Error(`Unknown IR type: ${e[0]}`)}}setDash(e,t){this.current.dashArray=e,this.current.dashPhase=t}constructPath(e,t){const i=this.current;let n=i.x,r=i.y,a=[],o=0;for(const i of e)switch(0|i){case s.OPS.rectangle:n=t[o++],r=t[o++];const e=n+t[o++],i=r+t[o++];a.push("M",m(n),m(r),"L",m(e),m(r),"L",m(e),m(i),"L",m(n),m(i),"Z");break;case s.OPS.moveTo:n=t[o++],r=t[o++],a.push("M",m(n),m(r));break;case s.OPS.lineTo:n=t[o++],r=t[o++],a.push("L",m(n),m(r));break;case s.OPS.curveTo:n=t[o+4],r=t[o+5],a.push("C",m(t[o]),m(t[o+1]),m(t[o+2]),m(t[o+3]),m(n),m(r)),o+=6;break;case s.OPS.curveTo2:a.push("C",m(n),m(r),m(t[o]),m(t[o+1]),m(t[o+2]),m(t[o+3])),n=t[o+2],r=t[o+3],o+=4;break;case s.OPS.curveTo3:n=t[o+2],r=t[o+3],a.push("C",m(t[o]),m(t[o+1]),m(n),m(r),m(n),m(r)),o+=4;break;case s.OPS.closePath:a.push("Z")}a=a.join(" "),i.path&&e.length>0&&e[0]!==s.OPS.rectangle&&e[0]!==s.OPS.moveTo?a=i.path.getAttributeNS(null,"d")+a:(i.path=this.svgFactory.createElement("svg:path"),this._ensureTransformGroup().append(i.path)),i.path.setAttributeNS(null,"d",a),i.path.setAttributeNS(null,"fill","none"),i.element=i.path,i.setCurrentPoint(n,r)}endPath(){const e=this.current;if(e.path=null,!this.pendingClip)return;if(!e.element)return void(this.pendingClip=null);const t="clippath"+v++,i=this.svgFactory.createElement("svg:clipPath");i.setAttributeNS(null,"id",t),i.setAttributeNS(null,"transform",_(this.transformMatrix));const n=e.element.cloneNode(!0);if("evenodd"===this.pendingClip?n.setAttributeNS(null,"clip-rule","evenodd"):n.setAttributeNS(null,"clip-rule","nonzero"),this.pendingClip=null,i.append(n),this.defs.append(i),e.activeClipUrl){e.clipGroup=null;for(const e of this.extraStack)e.clipGroup=null;i.setAttributeNS(null,"clip-path",e.activeClipUrl)}e.activeClipUrl=`url(#${t})`,this.tgrp=null}clip(e){this.pendingClip=e}closePath(){const e=this.current;if(e.path){const t=`${e.path.getAttributeNS(null,"d")}Z`;e.path.setAttributeNS(null,"d",t)}}setLeading(e){this.current.leading=-e}setTextRise(e){this.current.textRise=e}setTextRenderingMode(e){this.current.textRenderingMode=e}setHScale(e){this.current.textHScale=e/100}setRenderingIntent(e){}setFlatness(e){}setGState(e){for(const[t,i]of e)switch(t){case"LW":this.setLineWidth(i);break;case"LC":this.setLineCap(i);break;case"LJ":this.setLineJoin(i);break;case"ML":this.setMiterLimit(i);break;case"D":this.setDash(i[0],i[1]);break;case"RI":this.setRenderingIntent(i);break;case"FL":this.setFlatness(i);break;case"Font":this.setFont(i);break;case"CA":this.setStrokeAlpha(i);break;case"ca":this.setFillAlpha(i);break;default:(0,s.warn)(`Unimplemented graphic state operator ${t}`)}}fill(){const e=this.current;e.element&&(e.element.setAttributeNS(null,"fill",e.fillColor),e.element.setAttributeNS(null,"fill-opacity",e.fillAlpha),this.endPath())}stroke(){const e=this.current;e.element&&(this._setStrokeAttributes(e.element),e.element.setAttributeNS(null,"fill","none"),this.endPath())}_setStrokeAttributes(e,t=1){const i=this.current;let n=i.dashArray;1!==t&&n.length>0&&(n=n.map((function(e){return t*e}))),e.setAttributeNS(null,"stroke",i.strokeColor),e.setAttributeNS(null,"stroke-opacity",i.strokeAlpha),e.setAttributeNS(null,"stroke-miterlimit",m(i.miterLimit)),e.setAttributeNS(null,"stroke-linecap",i.lineCap),e.setAttributeNS(null,"stroke-linejoin",i.lineJoin),e.setAttributeNS(null,"stroke-width",m(t*i.lineWidth)+"px"),e.setAttributeNS(null,"stroke-dasharray",n.map(m).join(" ")),e.setAttributeNS(null,"stroke-dashoffset",m(t*i.dashPhase)+"px")}eoFill(){this.current.element?.setAttributeNS(null,"fill-rule","evenodd"),this.fill()}fillStroke(){this.stroke(),this.fill()}eoFillStroke(){this.current.element?.setAttributeNS(null,"fill-rule","evenodd"),this.fillStroke()}closeStroke(){this.closePath(),this.stroke()}closeFillStroke(){this.closePath(),this.fillStroke()}closeEOFillStroke(){this.closePath(),this.eoFillStroke()}paintSolidColorImageMask(){const e=this.svgFactory.createElement("svg:rect");e.setAttributeNS(null,"x","0"),e.setAttributeNS(null,"y","0"),e.setAttributeNS(null,"width","1px"),e.setAttributeNS(null,"height","1px"),e.setAttributeNS(null,"fill",this.current.fillColor),this._ensureTransformGroup().append(e)}paintImageXObject(e){const t=this.getObject(e);t?this.paintInlineImageXObject(t):(0,s.warn)(`Dependent image with object ID ${e} is not ready yet`)}paintInlineImageXObject(e,t){const i=e.width,n=e.height,s=p(e,this.forceDataSchema,!!t),r=this.svgFactory.createElement("svg:rect");r.setAttributeNS(null,"x","0"),r.setAttributeNS(null,"y","0"),r.setAttributeNS(null,"width",m(i)),r.setAttributeNS(null,"height",m(n)),this.current.element=r,this.clip("nonzero");const a=this.svgFactory.createElement("svg:image");a.setAttributeNS(c,"xlink:href",s),a.setAttributeNS(null,"x","0"),a.setAttributeNS(null,"y",m(-n)),a.setAttributeNS(null,"width",m(i)+"px"),a.setAttributeNS(null,"height",m(n)+"px"),a.setAttributeNS(null,"transform",`scale(${m(1/i)} ${m(-1/n)})`),t?t.append(a):this._ensureTransformGroup().append(a)}paintImageMaskXObject(e){const t=this.getObject(e.data,e);if(t.bitmap)return void(0,s.warn)("paintImageMaskXObject: ImageBitmap support is not implemented, ensure that the `isOffscreenCanvasSupported` API parameter is disabled.");const i=this.current,n=t.width,r=t.height,a=i.fillColor;i.maskId="mask"+b++;const o=this.svgFactory.createElement("svg:mask");o.setAttributeNS(null,"id",i.maskId);const l=this.svgFactory.createElement("svg:rect");l.setAttributeNS(null,"x","0"),l.setAttributeNS(null,"y","0"),l.setAttributeNS(null,"width",m(n)),l.setAttributeNS(null,"height",m(r)),l.setAttributeNS(null,"fill",a),l.setAttributeNS(null,"mask",`url(#${i.maskId})`),this.defs.append(o),this._ensureTransformGroup().append(l),this.paintInlineImageXObject(t,o)}paintFormXObjectBegin(e,t){if(Array.isArray(e)&&6===e.length&&this.transform(e[0],e[1],e[2],e[3],e[4],e[5]),t){const e=t[2]-t[0],i=t[3]-t[1],n=this.svgFactory.createElement("svg:rect");n.setAttributeNS(null,"x",t[0]),n.setAttributeNS(null,"y",t[1]),n.setAttributeNS(null,"width",m(e)),n.setAttributeNS(null,"height",m(i)),this.current.element=n,this.clip("nonzero"),this.endPath()}}paintFormXObjectEnd(){}_initialize(e){const t=this.svgFactory.create(e.width,e.height),i=this.svgFactory.createElement("svg:defs");t.append(i),this.defs=i;const n=this.svgFactory.createElement("svg:g");return n.setAttributeNS(null,"transform",_(e.transform)),t.append(n),this.svg=n,t}_ensureClipGroup(){if(!this.current.clipGroup){const e=this.svgFactory.createElement("svg:g");e.setAttributeNS(null,"clip-path",this.current.activeClipUrl),this.svg.append(e),this.current.clipGroup=e}return this.current.clipGroup}_ensureTransformGroup(){return this.tgrp||(this.tgrp=this.svgFactory.createElement("svg:g"),this.tgrp.setAttributeNS(null,"transform",_(this.transformMatrix)),this.current.activeClipUrl?this._ensureClipGroup().append(this.tgrp):this.svg.append(this.tgrp)),this.tgrp}}}}],__webpack_module_cache__={};function __w_pdfjs_require__(e){var t=__webpack_module_cache__[e];if(void 0!==t)return t.exports;var i=__webpack_module_cache__[e]={exports:{}};return __webpack_modules__[e](i,i.exports,__w_pdfjs_require__),i.exports}var __webpack_exports__={};return(()=>{var e=__webpack_exports__;Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"AbortException",{enumerable:!0,get:function(){return t.AbortException}}),Object.defineProperty(e,"AnnotationEditorLayer",{enumerable:!0,get:function(){return r.AnnotationEditorLayer}}),Object.defineProperty(e,"AnnotationEditorParamsType",{enumerable:!0,get:function(){return t.AnnotationEditorParamsType}}),Object.defineProperty(e,"AnnotationEditorType",{enumerable:!0,get:function(){return t.AnnotationEditorType}}),Object.defineProperty(e,"AnnotationEditorUIManager",{enumerable:!0,get:function(){return a.AnnotationEditorUIManager}}),Object.defineProperty(e,"AnnotationLayer",{enumerable:!0,get:function(){return o.AnnotationLayer}}),Object.defineProperty(e,"AnnotationMode",{enumerable:!0,get:function(){return t.AnnotationMode}}),Object.defineProperty(e,"CMapCompressionType",{enumerable:!0,get:function(){return t.CMapCompressionType}}),Object.defineProperty(e,"FeatureTest",{enumerable:!0,get:function(){return t.FeatureTest}}),Object.defineProperty(e,"GlobalWorkerOptions",{enumerable:!0,get:function(){return l.GlobalWorkerOptions}}),Object.defineProperty(e,"InvalidPDFException",{enumerable:!0,get:function(){return t.InvalidPDFException}}),Object.defineProperty(e,"MissingPDFException",{enumerable:!0,get:function(){return t.MissingPDFException}}),Object.defineProperty(e,"OPS",{enumerable:!0,get:function(){return t.OPS}}),Object.defineProperty(e,"PDFDataRangeTransport",{enumerable:!0,get:function(){return i.PDFDataRangeTransport}}),Object.defineProperty(e,"PDFDateString",{enumerable:!0,get:function(){return n.PDFDateString}}),Object.defineProperty(e,"PDFWorker",{enumerable:!0,get:function(){return i.PDFWorker}}),Object.defineProperty(e,"PasswordResponses",{enumerable:!0,get:function(){return t.PasswordResponses}}),Object.defineProperty(e,"PermissionFlag",{enumerable:!0,get:function(){return t.PermissionFlag}}),Object.defineProperty(e,"PixelsPerInch",{enumerable:!0,get:function(){return n.PixelsPerInch}}),Object.defineProperty(e,"RenderingCancelledException",{enumerable:!0,get:function(){return n.RenderingCancelledException}}),Object.defineProperty(e,"SVGGraphics",{enumerable:!0,get:function(){return c.SVGGraphics}}),Object.defineProperty(e,"UnexpectedResponseException",{enumerable:!0,get:function(){return t.UnexpectedResponseException}}),Object.defineProperty(e,"Util",{enumerable:!0,get:function(){return t.Util}}),Object.defineProperty(e,"VerbosityLevel",{enumerable:!0,get:function(){return t.VerbosityLevel}}),Object.defineProperty(e,"XfaLayer",{enumerable:!0,get:function(){return h.XfaLayer}}),Object.defineProperty(e,"build",{enumerable:!0,get:function(){return i.build}}),Object.defineProperty(e,"createPromiseCapability",{enumerable:!0,get:function(){return t.createPromiseCapability}}),Object.defineProperty(e,"createValidAbsoluteUrl",{enumerable:!0,get:function(){return t.createValidAbsoluteUrl}}),Object.defineProperty(e,"getDocument",{enumerable:!0,get:function(){return i.getDocument}}),Object.defineProperty(e,"getFilenameFromUrl",{enumerable:!0,get:function(){return n.getFilenameFromUrl}}),Object.defineProperty(e,"getPdfFilenameFromUrl",{enumerable:!0,get:function(){return n.getPdfFilenameFromUrl}}),Object.defineProperty(e,"getXfaPageViewport",{enumerable:!0,get:function(){return n.getXfaPageViewport}}),Object.defineProperty(e,"isDataScheme",{enumerable:!0,get:function(){return n.isDataScheme}}),Object.defineProperty(e,"isPdfFile",{enumerable:!0,get:function(){return n.isPdfFile}}),Object.defineProperty(e,"loadScript",{enumerable:!0,get:function(){return n.loadScript}}),Object.defineProperty(e,"renderTextLayer",{enumerable:!0,get:function(){return s.renderTextLayer}}),Object.defineProperty(e,"setLayerDimensions",{enumerable:!0,get:function(){return n.setLayerDimensions}}),Object.defineProperty(e,"shadow",{enumerable:!0,get:function(){return t.shadow}}),Object.defineProperty(e,"updateTextLayer",{enumerable:!0,get:function(){return s.updateTextLayer}}),Object.defineProperty(e,"version",{enumerable:!0,get:function(){return i.version}});var t=__w_pdfjs_require__(1),i=__w_pdfjs_require__(2),n=__w_pdfjs_require__(6),s=__w_pdfjs_require__(26),r=__w_pdfjs_require__(27),a=__w_pdfjs_require__(5),o=__w_pdfjs_require__(32),l=__w_pdfjs_require__(14),c=__w_pdfjs_require__(35),h=__w_pdfjs_require__(34)})(),__webpack_exports__})(),module.exports=factory()})(pdf);var pdfExports=pdf.exports,pdf_viewer={exports:{}};
|
|
33
|
-
/**
|
|
34
|
-
* @licstart The following is the entire license notice for the
|
|
35
|
-
* JavaScript code in this page
|
|
36
|
-
*
|
|
37
|
-
* Copyright 2023 Mozilla Foundation
|
|
38
|
-
*
|
|
39
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
40
|
-
* you may not use this file except in compliance with the License.
|
|
41
|
-
* You may obtain a copy of the License at
|
|
42
|
-
*
|
|
43
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
44
|
-
*
|
|
45
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
46
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
47
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
48
|
-
* See the License for the specific language governing permissions and
|
|
49
|
-
* limitations under the License.
|
|
50
|
-
*
|
|
51
|
-
* @licend The above is the entire license notice for the
|
|
52
|
-
* JavaScript code in this page
|
|
53
|
-
*/
|
|
54
|
-
!function(e,t){var i;globalThis,i=()=>(()=>{var e=[,(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SimpleLinkService=t.PDFLinkService=t.LinkTarget=void 0;var n=i(2);const s={NONE:0,SELF:1,BLANK:2,PARENT:3,TOP:4};function r(e,{url:t,target:i,rel:r,enabled:a=!0}={}){if(!t||"string"!=typeof t)throw new Error('A valid "url" parameter must provided.');const o=(0,n.removeNullCharacters)(t);a?e.href=e.title=o:(e.href="",e.title=`Disabled: ${o}`,e.onclick=()=>!1);let l="";switch(i){case s.NONE:break;case s.SELF:l="_self";break;case s.BLANK:l="_blank";break;case s.PARENT:l="_parent";break;case s.TOP:l="_top"}e.target=l,e.rel="string"==typeof r?r:"noopener noreferrer nofollow"}t.LinkTarget=s;class a{#jt=new Map;constructor({eventBus:e,externalLinkTarget:t=null,externalLinkRel:i=null,ignoreDestinationZoom:n=!1}={}){this.eventBus=e,this.externalLinkTarget=t,this.externalLinkRel=i,this.externalLinkEnabled=!0,this._ignoreDestinationZoom=n,this.baseUrl=null,this.pdfDocument=null,this.pdfViewer=null,this.pdfHistory=null}setDocument(e,t=null){this.baseUrl=t,this.pdfDocument=e,this.#jt.clear()}setViewer(e){this.pdfViewer=e}setHistory(e){this.pdfHistory=e}get pagesCount(){return this.pdfDocument?this.pdfDocument.numPages:0}get page(){return this.pdfViewer.currentPageNumber}set page(e){this.pdfViewer.currentPageNumber=e}get rotation(){return this.pdfViewer.pagesRotation}set rotation(e){this.pdfViewer.pagesRotation=e}get isInPresentationMode(){return this.pdfViewer.isInPresentationMode}#Ht(e,t=null,i){const n=i[0];let s;if("object"==typeof n&&null!==n){if(s=this._cachedPageNumber(n),!s)return void this.pdfDocument.getPageIndex(n).then((s=>{this.cachePageRef(s+1,n),this.#Ht(e,t,i)})).catch((()=>{console.error(`PDFLinkService.#goToDestinationHelper: "${n}" is not a valid page reference, for dest="${e}".`)}))}else{if(!Number.isInteger(n))return void console.error(`PDFLinkService.#goToDestinationHelper: "${n}" is not a valid destination reference, for dest="${e}".`);s=n+1}!s||s<1||s>this.pagesCount?console.error(`PDFLinkService.#goToDestinationHelper: "${s}" is not a valid page number, for dest="${e}".`):(this.pdfHistory&&(this.pdfHistory.pushCurrentPosition(),this.pdfHistory.push({namedDest:t,explicitDest:i,pageNumber:s})),this.pdfViewer.scrollPageIntoView({pageNumber:s,destArray:i,ignoreDestinationZoom:this._ignoreDestinationZoom}))}async goToDestination(e){if(!this.pdfDocument)return;let t,i;"string"==typeof e?(t=e,i=await this.pdfDocument.getDestination(e)):(t=null,i=await e),Array.isArray(i)?this.#Ht(e,t,i):console.error(`PDFLinkService.goToDestination: "${i}" is not a valid destination array, for dest="${e}".`)}goToPage(e){if(!this.pdfDocument)return;const t="string"==typeof e&&this.pdfViewer.pageLabelToPageNumber(e)||0|e;Number.isInteger(t)&&t>0&&t<=this.pagesCount?(this.pdfHistory&&(this.pdfHistory.pushCurrentPosition(),this.pdfHistory.pushPage(t)),this.pdfViewer.scrollPageIntoView({pageNumber:t})):console.error(`PDFLinkService.goToPage: "${e}" is not a valid page.`)}addLinkAttributes(e,t,i=!1){r(e,{url:t,target:i?s.BLANK:this.externalLinkTarget,rel:this.externalLinkRel,enabled:this.externalLinkEnabled})}getDestinationHash(e){if("string"==typeof e){if(e.length>0)return this.getAnchorUrl("#"+escape(e))}else if(Array.isArray(e)){const t=JSON.stringify(e);if(t.length>0)return this.getAnchorUrl("#"+escape(t))}return this.getAnchorUrl("")}getAnchorUrl(e){return this.baseUrl?this.baseUrl+e:e}setHash(e){if(!this.pdfDocument)return;let t,i;if(e.includes("=")){const s=(0,n.parseQueryString)(e);if(s.has("search")&&this.eventBus.dispatch("findfromurlhash",{source:this,query:s.get("search").replaceAll('"',""),phraseSearch:"true"===s.get("phrase")}),s.has("page")&&(t=0|s.get("page")||1),s.has("zoom")){const e=s.get("zoom").split(","),t=e[0],n=parseFloat(t);t.includes("Fit")?"Fit"===t||"FitB"===t?i=[null,{name:t}]:"FitH"===t||"FitBH"===t||"FitV"===t||"FitBV"===t?i=[null,{name:t},e.length>1?0|e[1]:null]:"FitR"===t?5!==e.length?console.error('PDFLinkService.setHash: Not enough parameters for "FitR".'):i=[null,{name:t},0|e[1],0|e[2],0|e[3],0|e[4]]:console.error(`PDFLinkService.setHash: "${t}" is not a valid zoom value.`):i=[null,{name:"XYZ"},e.length>1?0|e[1]:null,e.length>2?0|e[2]:null,n?n/100:t]}i?this.pdfViewer.scrollPageIntoView({pageNumber:t||this.page,destArray:i,allowNegativeOffset:!0}):t&&(this.page=t),s.has("pagemode")&&this.eventBus.dispatch("pagemode",{source:this,mode:s.get("pagemode")}),s.has("nameddest")&&this.goToDestination(s.get("nameddest"))}else{i=unescape(e);try{i=JSON.parse(i),Array.isArray(i)||(i=i.toString())}catch(e){}if("string"==typeof i||a.#Wt(i))return void this.goToDestination(i);console.error(`PDFLinkService.setHash: "${unescape(e)}" is not a valid destination.`)}}executeNamedAction(e){switch(e){case"GoBack":this.pdfHistory?.back();break;case"GoForward":this.pdfHistory?.forward();break;case"NextPage":this.pdfViewer.nextPage();break;case"PrevPage":this.pdfViewer.previousPage();break;case"LastPage":this.page=this.pagesCount;break;case"FirstPage":this.page=1}this.eventBus.dispatch("namedaction",{source:this,action:e})}async executeSetOCGState(e){const t=this.pdfDocument,i=await this.pdfViewer.optionalContentConfigPromise;if(t!==this.pdfDocument)return;let n;for(const t of e.state){switch(t){case"ON":case"OFF":case"Toggle":n=t;continue}switch(n){case"ON":i.setVisibility(t,!0);break;case"OFF":i.setVisibility(t,!1);break;case"Toggle":const e=i.getGroup(t);e&&i.setVisibility(t,!e.visible)}}this.pdfViewer.optionalContentConfigPromise=Promise.resolve(i)}cachePageRef(e,t){if(!t)return;const i=0===t.gen?`${t.num}R`:`${t.num}R${t.gen}`;this.#jt.set(i,e)}_cachedPageNumber(e){if(!e)return null;const t=0===e.gen?`${e.num}R`:`${e.num}R${e.gen}`;return this.#jt.get(t)||null}isPageVisible(e){return this.pdfViewer.isPageVisible(e)}isPageCached(e){return this.pdfViewer.isPageCached(e)}static#Wt(e){if(!Array.isArray(e))return!1;const t=e.length;if(t<2)return!1;const i=e[0];if(!("object"==typeof i&&Number.isInteger(i.num)&&Number.isInteger(i.gen)||Number.isInteger(i)&&i>=0))return!1;const n=e[1];if("object"!=typeof n||"string"!=typeof n.name)return!1;let s=!0;switch(n.name){case"XYZ":if(5!==t)return!1;break;case"Fit":case"FitB":return 2===t;case"FitH":case"FitBH":case"FitV":case"FitBV":if(3!==t)return!1;break;case"FitR":if(6!==t)return!1;s=!1;break;default:return!1}for(let i=2;i<t;i++){const t=e[i];if(!("number"==typeof t||s&&null===t))return!1}return!0}}t.PDFLinkService=a,t.SimpleLinkService=class{constructor(){this.externalLinkEnabled=!0}get pagesCount(){return 0}get page(){return 0}set page(e){}get rotation(){return 0}set rotation(e){}get isInPresentationMode(){return!1}async goToDestination(e){}goToPage(e){}addLinkAttributes(e,t,i=!1){r(e,{url:t,enabled:this.externalLinkEnabled})}getDestinationHash(e){return"#"}getAnchorUrl(e){return"#"}setHash(e){}executeNamedAction(e){}executeSetOCGState(e){}cachePageRef(e,t){}isPageVisible(e){return!0}isPageCached(e){return!0}}},(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.animationStarted=t.VERTICAL_PADDING=t.UNKNOWN_SCALE=t.TextLayerMode=t.SpreadMode=t.SidebarView=t.ScrollMode=t.SCROLLBAR_PADDING=t.RenderingStates=t.RendererType=t.ProgressBar=t.PresentationModeState=t.OutputScale=t.MIN_SCALE=t.MAX_SCALE=t.MAX_AUTO_SCALE=t.DEFAULT_SCALE_VALUE=t.DEFAULT_SCALE_DELTA=t.DEFAULT_SCALE=t.CursorTool=t.AutoPrintRegExp=void 0,t.apiPageLayoutToViewerModes=function(e){let t=n.VERTICAL,i=s.NONE;switch(e){case"SinglePage":t=n.PAGE;break;case"OneColumn":break;case"TwoPageLeft":t=n.PAGE;case"TwoColumnLeft":i=s.ODD;break;case"TwoPageRight":t=n.PAGE;case"TwoColumnRight":i=s.EVEN}return{scrollMode:t,spreadMode:i}},t.apiPageModeToSidebarView=function(e){switch(e){case"UseNone":return i.NONE;case"UseThumbs":return i.THUMBS;case"UseOutlines":return i.OUTLINE;case"UseAttachments":return i.ATTACHMENTS;case"UseOC":return i.LAYERS}return i.NONE},t.approximateFraction=function(e){if(Math.floor(e)===e)return[e,1];const t=1/e;if(t>8)return[1,8];if(Math.floor(t)===t)return[1,t];const i=e>1?t:e;let n,s=0,r=1,a=1,o=1;for(;;){const e=s+a,t=r+o;if(t>8)break;i<=e/t?(a=e,o=t):(s=e,r=t)}return n=i-s/r<a/o-i?i===e?[s,r]:[r,s]:i===e?[a,o]:[o,a],n},t.backtrackBeforeAllVisibleElements=o,t.binarySearchFirstItem=a,t.docStyle=void 0,t.getActiveOrFocusedElement=function(){let e=document,t=e.activeElement||e.querySelector(":focus");for(;t?.shadowRoot;)e=t.shadowRoot,t=e.activeElement||e.querySelector(":focus");return t},t.getPageSizeInches=function({view:e,userUnit:t,rotate:i}){const[n,s,r,a]=e,o=i%180!=0,l=(r-n)/72*t,c=(a-s)/72*t;return{width:o?c:l,height:o?l:c}},t.getVisibleElements=function({scrollEl:e,views:t,sortByVisibility:i=!1,horizontal:n=!1,rtl:s=!1}){const r=e.scrollTop,l=r+e.clientHeight,c=e.scrollLeft,h=c+e.clientWidth,d=[],u=new Set,p=t.length;let g=a(t,n?function(e){const t=e.div,i=t.offsetLeft+t.clientLeft,n=i+t.clientWidth;return s?i<h:n>c}:function(e){const t=e.div;return t.offsetTop+t.clientTop+t.clientHeight>r});g>0&&g<p&&!n&&(g=o(g,t,r));let f=n?h:-1;for(let e=g;e<p;e++){const i=t[e],s=i.div,a=s.offsetLeft+s.clientLeft,o=s.offsetTop+s.clientTop,p=s.clientWidth,g=s.clientHeight,m=a+p,_=o+g;if(-1===f)_>=l&&(f=_);else if((n?a:o)>f)break;if(_<=r||o>=l||m<=c||a>=h)continue;const v=Math.max(0,r-o)+Math.max(0,_-l),b=(p-(Math.max(0,c-a)+Math.max(0,m-h)))/p,y=(g-v)/g*b*100|0;d.push({id:i.id,x:a,y:o,view:i,percent:y,widthPercent:100*b|0}),u.add(i.id)}const m=d[0],_=d.at(-1);return i&&d.sort((function(e,t){const i=e.percent-t.percent;return Math.abs(i)>.001?-i:e.id-t.id})),{first:m,last:_,views:d,ids:u}},t.isPortraitOrientation=function(e){return e.width<=e.height},t.isValidRotation=function(e){return Number.isInteger(e)&&e%90==0},t.isValidScrollMode=function(e){return Number.isInteger(e)&&Object.values(n).includes(e)&&e!==n.UNKNOWN},t.isValidSpreadMode=function(e){return Number.isInteger(e)&&Object.values(s).includes(e)&&e!==s.UNKNOWN},t.noContextMenuHandler=function(e){e.preventDefault()},t.normalizeWheelEventDelta=function(e){const t=e.deltaMode;let i=l(e);return t===WheelEvent.DOM_DELTA_PIXEL?i/=900:t===WheelEvent.DOM_DELTA_LINE&&(i/=30),i},t.normalizeWheelEventDirection=l,t.parseQueryString=function(e){const t=new Map;for(const[i,n]of new URLSearchParams(e))t.set(i.toLowerCase(),n);return t},t.removeNullCharacters=function(e,t=!1){return"string"!=typeof e?(console.error("The argument must be a string."),e):(t&&(e=e.replaceAll(r," ")),e.replaceAll("\0",""))},t.roundToDivide=function(e,t){const i=e%t;return 0===i?e:Math.round(e-i+t)},t.scrollIntoView=function(e,t,i=!1){let n=e.offsetParent;if(!n)return void console.error("offsetParent is not set -- cannot scroll");let s=e.offsetTop+e.clientTop,r=e.offsetLeft+e.clientLeft;for(;n.clientHeight===n.scrollHeight&&n.clientWidth===n.scrollWidth||i&&(n.classList.contains("markedContent")||"hidden"===getComputedStyle(n).overflow);)if(s+=n.offsetTop,r+=n.offsetLeft,n=n.offsetParent,!n)return;t&&(void 0!==t.top&&(s+=t.top),void 0!==t.left&&(r+=t.left,n.scrollLeft=r)),n.scrollTop=s},t.watchScroll=function(e,t){const i=function(i){s||(s=window.requestAnimationFrame((function(){s=null;const i=e.scrollLeft,r=n.lastX;i!==r&&(n.right=i>r),n.lastX=i;const a=e.scrollTop,o=n.lastY;a!==o&&(n.down=a>o),n.lastY=a,t(n)})))},n={right:!0,down:!0,lastX:e.scrollLeft,lastY:e.scrollTop,_eventHandler:i};let s=null;return e.addEventListener("scroll",i,!0),n},t.DEFAULT_SCALE_VALUE="auto",t.DEFAULT_SCALE=1,t.DEFAULT_SCALE_DELTA=1.1,t.MIN_SCALE=.1,t.MAX_SCALE=10,t.UNKNOWN_SCALE=0,t.MAX_AUTO_SCALE=1.25,t.SCROLLBAR_PADDING=40,t.VERTICAL_PADDING=5,t.RenderingStates={INITIAL:0,RUNNING:1,PAUSED:2,FINISHED:3},t.PresentationModeState={UNKNOWN:0,NORMAL:1,CHANGING:2,FULLSCREEN:3};const i={UNKNOWN:-1,NONE:0,THUMBS:1,OUTLINE:2,ATTACHMENTS:3,LAYERS:4};t.SidebarView=i,t.RendererType={CANVAS:"canvas",SVG:"svg"},t.TextLayerMode={DISABLE:0,ENABLE:1};const n={UNKNOWN:-1,VERTICAL:0,HORIZONTAL:1,WRAPPED:2,PAGE:3};t.ScrollMode=n;const s={UNKNOWN:-1,NONE:0,ODD:1,EVEN:2};t.SpreadMode=s,t.CursorTool={SELECT:0,HAND:1,ZOOM:2},t.AutoPrintRegExp=/\bprint\s*\(/,t.OutputScale=class{constructor(){const e=window.devicePixelRatio||1;this.sx=e,this.sy=e}get scaled(){return 1!==this.sx||1!==this.sy}};const r=/[\x01-\x1F]/g;function a(e,t,i=0){let n=i,s=e.length-1;if(s<0||!t(e[s]))return e.length;if(t(e[n]))return n;for(;n<s;){const i=n+s>>1;t(e[i])?s=i:n=i+1}return n}function o(e,t,i){if(e<2)return e;let n=t[e].div,s=n.offsetTop+n.clientTop;s>=i&&(n=t[e-1].div,s=n.offsetTop+n.clientTop);for(let i=e-2;i>=0&&(n=t[i].div,!(n.offsetTop+n.clientTop+n.clientHeight<=s));--i)e=i;return e}function l(e){let t=Math.hypot(e.deltaX,e.deltaY);const i=Math.atan2(e.deltaY,e.deltaX);return-.25*Math.PI<i&&i<.75*Math.PI&&(t=-t),t}const c=new Promise((function(e){window.requestAnimationFrame(e)}));t.animationStarted=c;const h=document.documentElement.style;t.docStyle=h,t.ProgressBar=class{#Gt=null;#zt=null;#qt=0;#$t=null;#we=!0;constructor(e){this.#Gt=e.classList,this.#$t=e.style}get percent(){return this.#qt}set percent(e){var t,i,n;this.#qt=(t=e,i=0,n=100,Math.min(Math.max(t,i),n)),isNaN(e)?this.#Gt.add("indeterminate"):(this.#Gt.remove("indeterminate"),this.#$t.setProperty("--progressBar-percent",`${this.#qt}%`))}setWidth(e){if(!e)return;const t=e.parentNode.offsetWidth-e.offsetWidth;t>0&&this.#$t.setProperty("--progressBar-end-offset",`${t}px`)}setDisableAutoFetch(e=5e3){isNaN(this.#qt)||(this.#zt&&clearTimeout(this.#zt),this.show(),this.#zt=setTimeout((()=>{this.#zt=null,this.hide()}),e))}hide(){this.#we&&(this.#we=!1,this.#Gt.add("hidden"))}show(){this.#we||(this.#we=!0,this.#Gt.remove("hidden"))}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.AnnotationLayerBuilder=void 0;var n=i(4),s=i(5),r=i(2);t.AnnotationLayerBuilder=class{#Xt=0;#Kt=null;constructor({pageDiv:e,pdfPage:t,linkService:i,downloadManager:n,annotationStorage:r=null,imageResourcesPath:a="",renderForms:o=!0,l10n:l=s.NullL10n,enableScripting:c=!1,hasJSActionsPromise:h=null,fieldObjectsPromise:d=null,annotationCanvasMap:u=null,accessibilityManager:p=null}){this.pageDiv=e,this.pdfPage=t,this.linkService=i,this.downloadManager=n,this.imageResourcesPath=a,this.renderForms=o,this.l10n=l,this.annotationStorage=r,this.enableScripting=c,this._hasJSActionsPromise=h||Promise.resolve(!1),this._fieldObjectsPromise=d||Promise.resolve(null),this._annotationCanvasMap=u,this._accessibilityManager=p,this.div=null,this._cancelled=!1,this._eventBus=i.eventBus}async render(e,t="display"){if(this.div){if(this._cancelled||0===this.#Xt)return;return void n.AnnotationLayer.update({viewport:e.clone({dontFlip:!0}),div:this.div,annotationCanvasMap:this._annotationCanvasMap})}const[i,s,a]=await Promise.all([this.pdfPage.getAnnotations({intent:t}),this._hasJSActionsPromise,this._fieldObjectsPromise]);this._cancelled||(this.#Xt=i.length,this.div=document.createElement("div"),this.div.className="annotationLayer",this.pageDiv.append(this.div),0!==this.#Xt?(n.AnnotationLayer.render({viewport:e.clone({dontFlip:!0}),div:this.div,annotations:i,page:this.pdfPage,imageResourcesPath:this.imageResourcesPath,renderForms:this.renderForms,linkService:this.linkService,downloadManager:this.downloadManager,annotationStorage:this.annotationStorage,enableScripting:this.enableScripting,hasJSActions:s,fieldObjects:a,annotationCanvasMap:this._annotationCanvasMap,accessibilityManager:this._accessibilityManager}),this.l10n.translate(this.div),this.linkService.isInPresentationMode&&this.#Yt(r.PresentationModeState.FULLSCREEN),this.#Kt||(this.#Kt=e=>{this.#Yt(e.state)},this._eventBus?._on("presentationmodechanged",this.#Kt))):this.hide())}cancel(){this._cancelled=!0,this.#Kt&&(this._eventBus?._off("presentationmodechanged",this.#Kt),this.#Kt=null)}hide(){this.div&&(this.div.hidden=!0)}#Yt(e){if(!this.div)return;let t=!1;switch(e){case r.PresentationModeState.FULLSCREEN:t=!0;break;case r.PresentationModeState.NORMAL:break;default:return}for(const e of this.div.childNodes)e.hasAttribute("data-internal-link")||(e.inert=t)}}},e=>{let t;t="undefined"!=typeof window&&window["pdfjs-dist/build/pdf"]?window["pdfjs-dist/build/pdf"]:pdfExports,e.exports=t},(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.NullL10n=void 0,t.fixupLangCode=function(e){return s[e?.toLowerCase()]||e},t.getL10nFallback=n;const i={of_pages:"of {{pagesCount}}",page_of_pages:"({{pageNumber}} of {{pagesCount}})",document_properties_kb:"{{size_kb}} KB ({{size_b}} bytes)",document_properties_mb:"{{size_mb}} MB ({{size_b}} bytes)",document_properties_date_string:"{{date}}, {{time}}",document_properties_page_size_unit_inches:"in",document_properties_page_size_unit_millimeters:"mm",document_properties_page_size_orientation_portrait:"portrait",document_properties_page_size_orientation_landscape:"landscape",document_properties_page_size_name_a3:"A3",document_properties_page_size_name_a4:"A4",document_properties_page_size_name_letter:"Letter",document_properties_page_size_name_legal:"Legal",document_properties_page_size_dimension_string:"{{width}} × {{height}} {{unit}} ({{orientation}})",document_properties_page_size_dimension_name_string:"{{width}} × {{height}} {{unit}} ({{name}}, {{orientation}})",document_properties_linearized_yes:"Yes",document_properties_linearized_no:"No",additional_layers:"Additional Layers",page_landmark:"Page {{page}}",thumb_page_title:"Page {{page}}",thumb_page_canvas:"Thumbnail of Page {{page}}",find_reached_top:"Reached top of document, continued from bottom",find_reached_bottom:"Reached end of document, continued from top","find_match_count[one]":"{{current}} of {{total}} match","find_match_count[other]":"{{current}} of {{total}} matches","find_match_count_limit[one]":"More than {{limit}} match","find_match_count_limit[other]":"More than {{limit}} matches",find_not_found:"Phrase not found",page_scale_width:"Page Width",page_scale_fit:"Page Fit",page_scale_auto:"Automatic Zoom",page_scale_actual:"Actual Size",page_scale_percent:"{{scale}}%",loading_error:"An error occurred while loading the PDF.",invalid_file_error:"Invalid or corrupted PDF file.",missing_file_error:"Missing PDF file.",unexpected_response_error:"Unexpected server response.",rendering_error:"An error occurred while rendering the page.",printing_not_supported:"Warning: Printing is not fully supported by this browser.",printing_not_ready:"Warning: The PDF is not fully loaded for printing.",web_fonts_disabled:"Web fonts are disabled: unable to use embedded PDF fonts.",free_text2_default_content:"Start typing…",editor_free_text2_aria_label:"Text Editor",editor_ink2_aria_label:"Draw Editor",editor_ink_canvas_aria_label:"User-created image"};function n(e,t){switch(e){case"find_match_count":e=`find_match_count[${1===t.total?"one":"other"}]`;break;case"find_match_count_limit":e=`find_match_count_limit[${1===t.limit?"one":"other"}]`}return i[e]||""}i.print_progress_percent="{{progress}}%";const s={en:"en-US",es:"es-ES",fy:"fy-NL",ga:"ga-IE",gu:"gu-IN",hi:"hi-IN",hy:"hy-AM",nb:"nb-NO",ne:"ne-NP",nn:"nn-NO",pa:"pa-IN",pt:"pt-PT",sv:"sv-SE",zh:"zh-CN"},r={getLanguage:async()=>"en-us",getDirection:async()=>"ltr",get:async(e,t=null,i=n(e,t))=>function(e,t){return t?e.replaceAll(/\{\{\s*(\w+)\s*\}\}/g,((e,i)=>i in t?t[i]:"{{"+i+"}}")):e}(i,t),async translate(e){}};t.NullL10n=r},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DownloadManager=void 0;var n=i(4);function s(e,t){const i=document.createElement("a");if(!i.click)throw new Error('DownloadManager: "a.click()" is not supported.');i.href=e,i.target="_parent","download"in i&&(i.download=t),(document.body||document.documentElement).append(i),i.click(),i.remove()}t.DownloadManager=class{#Qt=new WeakMap;downloadUrl(e,t){(0,n.createValidAbsoluteUrl)(e,"http://example.com")?s(e+"#pdfjs.action=download",t):console.error(`downloadUrl - not a valid URL: ${e}`)}downloadData(e,t,i){s(URL.createObjectURL(new Blob([e],{type:i})),t)}openOrDownloadData(e,t,i){const s=(0,n.isPdfFile)(i)?"application/pdf":"";return this.downloadData(t,i,s),!1}download(e,t,i){s(URL.createObjectURL(e),i)}}},(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.WaitOnType=t.EventBus=t.AutomationEventBus=void 0,t.waitOnEventOrTimeout=function({target:e,name:t,delay:s=0}){return new Promise((function(r,a){if("object"!=typeof e||!t||"string"!=typeof t||!(Number.isInteger(s)&&s>=0))throw new Error("waitOnEventOrTimeout - invalid parameters.");function o(i){e instanceof n?e._off(t,l):e.removeEventListener(t,l),h&&clearTimeout(h),r(i)}const l=o.bind(null,i.EVENT);e instanceof n?e._on(t,l):e.addEventListener(t,l);const c=o.bind(null,i.TIMEOUT),h=setTimeout(c,s)}))};const i={EVENT:"event",TIMEOUT:"timeout"};t.WaitOnType=i;class n{#r=Object.create(null);on(e,t,i=null){this._on(e,t,{external:!0,once:i?.once})}off(e,t,i=null){this._off(e,t,{external:!0,once:i?.once})}dispatch(e,t){const i=this.#r[e];if(!i||0===i.length)return;let n;for(const{listener:s,external:r,once:a}of i.slice(0))a&&this._off(e,s),r?(n||=[]).push(s):s(t);if(n){for(const e of n)e(t);n=null}}_on(e,t,i=null){(this.#r[e]||=[]).push({listener:t,external:!0===i?.external,once:!0===i?.once})}_off(e,t,i=null){const n=this.#r[e];if(n)for(let e=0,i=n.length;e<i;e++)if(n[e].listener===t)return void n.splice(e,1)}}t.EventBus=n,t.AutomationEventBus=class extends n{dispatch(e,t){throw new Error("Not implemented: AutomationEventBus.dispatch")}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.GenericL10n=void 0,i(9);var n=i(5);const s=document.webL10n;t.GenericL10n=class{constructor(e){this._lang=e,this._ready=new Promise(((t,i)=>{s.setLanguage((0,n.fixupLangCode)(e),(()=>{t(s)}))}))}async getLanguage(){return(await this._ready).getLanguage()}async getDirection(){return(await this._ready).getDirection()}async get(e,t=null,i=(0,n.getL10nFallback)(e,t)){return(await this._ready).get(e,t,i)}async translate(e){return(await this._ready).translate(e)}}},()=>{document.webL10n=function(e,t,i){var n={},s="",r="textContent",a="",o={},l="loading",c=!0;function h(e,t,i){t=t||function(e){},i=i||function(){};var n=new XMLHttpRequest;n.open("GET",e,c),n.overrideMimeType&&n.overrideMimeType("text/plain; charset=utf-8"),n.onreadystatechange=function(){4==n.readyState&&(200==n.status||0===n.status?t(n.responseText):i())},n.onerror=i,n.ontimeout=i;try{n.send(null)}catch(e){i()}}function d(e,t,i,a){var o=e.replace(/[^\/]*$/,"")||"./";function l(e){return e.lastIndexOf("\\")<0?e:e.replace(/\\\\/g,"\\").replace(/\\n/g,"\n").replace(/\\r/g,"\r").replace(/\\t/g,"\t").replace(/\\b/g,"\b").replace(/\\f/g,"\f").replace(/\\{/g,"{").replace(/\\}/g,"}").replace(/\\"/g,'"').replace(/\\'/g,"'")}h(e,(function(e){s+=e,function(e,i){var n={},s=/^\s*|\s*$/,r=/^\s*#|^\s*$/,a=/^\s*\[(.*)\]\s*$/,c=/^\s*@import\s+url\((.*)\)\s*$/i,d=/^([^=\s]*)\s*=\s*(.+)$/;function u(e,i,h){var u=e.replace(s,"").split(/[\r\n]+/),g="*",f=t.split("-",1)[0],m=!1,_="";!function e(){for(;;){if(!u.length)return void h();var s=u.shift();if(!r.test(s)){if(i){if(_=a.exec(s)){g=_[1].toLowerCase(),m="*"!==g&&g!==t&&g!==f;continue}if(m)continue;if(_=c.exec(s))return void p(o+_[1],e)}var v=s.match(d);v&&3==v.length&&(n[v[1]]=l(v[2]))}}}()}function p(e,t){h(e,(function(e){u(e,!1,t)}),(function(){console.warn(e+" not found."),t()}))}u(e,!0,(function(){i(n)}))}(e,(function(e){for(var t in e){var s,a,o=t.lastIndexOf(".");o>0?(s=t.substring(0,o),a=t.substring(o+1)):(s=t,a=r),n[s]||(n[s]={}),n[s][a]=e[t]}i&&i()}))}),a)}function u(e,i){e&&(e=e.toLowerCase()),i=i||function(){},n={},s="",a="",a=e;var r=t.querySelectorAll('link[type="application/l10n"]'),o=r.length;if(0!==o){var c,h,u=0;h=function(){++u>=o&&(i(),l="complete")};for(var p=0;p<o;p++)new _(r[p]).load(e,h)}else{var g=(c=t.querySelector('script[type="application/l10n"]'))?JSON.parse(c.innerHTML):null;if(g&&g.locales&&g.default_locale){if(console.log("using the embedded JSON directory, early way out"),!(n=g.locales[e])){var f=g.default_locale.toLowerCase();for(var m in g.locales){if((m=m.toLowerCase())===e){n=g.locales[e];break}m===f&&(n=g.locales[f])}}i()}else console.log("no resource to load, early way out");l="complete"}function _(e){var t=e.href;this.load=function(e,i){d(t,e,i,(function(){console.warn(t+" not found."),console.warn('"'+e+'" resource not found'),a="",i()}))}}}function p(e,t,i){var s=n[e];if(!s){if(console.warn("#"+e+" is undefined."),!i)return null;s=i}var r={};for(var a in s){var o=s[a];o=f(o=g(o,t,e,a),t,e),r[a]=o}return r}function g(e,t,i,s){var r=/\{\[\s*([a-zA-Z]+)\(([a-zA-Z]+)\)\s*\]\}/.exec(e);if(!r||!r.length)return e;var a,l=r[1],c=r[2];return t&&c in t?a=t[c]:c in n&&(a=n[c]),l in o&&(e=(0,o[l])(e,a,i,s)),e}function f(e,t,i){return e.replace(/\{\{\s*(.+?)\s*\}\}/g,(function(e,s){return t&&s in t?t[s]:s in n?n[s]:(console.log("argument {{"+s+"}} for #"+i+" is undefined."),e)}))}function m(e){var i=function(e){if(!e)return{};var t=e.getAttribute("data-l10n-id"),i=e.getAttribute("data-l10n-args"),n={};if(i)try{n=JSON.parse(i)}catch(e){console.warn("could not parse arguments for #"+t)}return{id:t,args:n}}(e);if(i.id){var n=p(i.id,i.args);if(n){if(n[r]){if(0===function(e){if(e.children)return e.children.length;if(void 0!==e.childElementCount)return e.childElementCount;for(var t=0,i=0;i<e.childNodes.length;i++)t+=1===e.nodeType?1:0;return t}(e))e[r]=n[r];else{for(var s=e.childNodes,a=!1,o=0,l=s.length;o<l;o++)3===s[o].nodeType&&/\S/.test(s[o].nodeValue)&&(a?s[o].nodeValue="":(s[o].nodeValue=n[r],a=!0));if(!a){var c=t.createTextNode(n[r]);e.prepend(c)}}delete n[r]}for(var h in n)e[h]=n[h]}else console.warn("#"+i.id+" is undefined.")}}return o.plural=function(e,t,i,s){var l=parseFloat(t);if(isNaN(l))return e;if(s!=r)return e;o._pluralRules||(o._pluralRules=function(e){function t(e,t){return-1!==t.indexOf(e)}function i(e,t,i){return t<=e&&e<=i}var n={0:function(e){return"other"},1:function(e){return i(e%100,3,10)?"few":0===e?"zero":i(e%100,11,99)?"many":2==e?"two":1==e?"one":"other"},2:function(e){return 0!==e&&e%10==0?"many":2==e?"two":1==e?"one":"other"},3:function(e){return 1==e?"one":"other"},4:function(e){return i(e,0,1)?"one":"other"},5:function(e){return i(e,0,2)&&2!=e?"one":"other"},6:function(e){return 0===e?"zero":e%10==1&&e%100!=11?"one":"other"},7:function(e){return 2==e?"two":1==e?"one":"other"},8:function(e){return i(e,3,6)?"few":i(e,7,10)?"many":2==e?"two":1==e?"one":"other"},9:function(e){return 0===e||1!=e&&i(e%100,1,19)?"few":1==e?"one":"other"},10:function(e){return i(e%10,2,9)&&!i(e%100,11,19)?"few":e%10!=1||i(e%100,11,19)?"other":"one"},11:function(e){return i(e%10,2,4)&&!i(e%100,12,14)?"few":e%10==0||i(e%10,5,9)||i(e%100,11,14)?"many":e%10==1&&e%100!=11?"one":"other"},12:function(e){return i(e,2,4)?"few":1==e?"one":"other"},13:function(e){return i(e%10,2,4)&&!i(e%100,12,14)?"few":1!=e&&i(e%10,0,1)||i(e%10,5,9)||i(e%100,12,14)?"many":1==e?"one":"other"},14:function(e){return i(e%100,3,4)?"few":e%100==2?"two":e%100==1?"one":"other"},15:function(e){return 0===e||i(e%100,2,10)?"few":i(e%100,11,19)?"many":1==e?"one":"other"},16:function(e){return e%10==1&&11!=e?"one":"other"},17:function(e){return 3==e?"few":0===e?"zero":6==e?"many":2==e?"two":1==e?"one":"other"},18:function(e){return 0===e?"zero":i(e,0,2)&&0!==e&&2!=e?"one":"other"},19:function(e){return i(e,2,10)?"few":i(e,0,1)?"one":"other"},20:function(e){return!i(e%10,3,4)&&e%10!=9||i(e%100,10,19)||i(e%100,70,79)||i(e%100,90,99)?e%1e6==0&&0!==e?"many":e%10!=2||t(e%100,[12,72,92])?e%10!=1||t(e%100,[11,71,91])?"other":"one":"two":"few"},21:function(e){return 0===e?"zero":1==e?"one":"other"},22:function(e){return i(e,0,1)||i(e,11,99)?"one":"other"},23:function(e){return i(e%10,1,2)||e%20==0?"one":"other"},24:function(e){return i(e,3,10)||i(e,13,19)?"few":t(e,[2,12])?"two":t(e,[1,11])?"one":"other"}},s={af:3,ak:4,am:4,ar:1,asa:3,az:0,be:11,bem:3,bez:3,bg:3,bh:4,bm:0,bn:3,bo:0,br:20,brx:3,bs:11,ca:3,cgg:3,chr:3,cs:12,cy:17,da:3,de:3,dv:3,dz:0,ee:3,el:3,en:3,eo:3,es:3,et:3,eu:3,fa:0,ff:5,fi:3,fil:4,fo:3,fr:5,fur:3,fy:3,ga:8,gd:24,gl:3,gsw:3,gu:3,guw:4,gv:23,ha:3,haw:3,he:2,hi:4,hr:11,hu:0,id:0,ig:0,ii:0,is:3,it:3,iu:7,ja:0,jmc:3,jv:0,ka:0,kab:5,kaj:3,kcg:3,kde:0,kea:0,kk:3,kl:3,km:0,kn:0,ko:0,ksb:3,ksh:21,ku:3,kw:7,lag:18,lb:3,lg:3,ln:4,lo:0,lt:10,lv:6,mas:3,mg:4,mk:16,ml:3,mn:3,mo:9,mr:3,ms:0,mt:15,my:0,nah:3,naq:7,nb:3,nd:3,ne:3,nl:3,nn:3,no:3,nr:3,nso:4,ny:3,nyn:3,om:3,or:3,pa:3,pap:3,pl:13,ps:3,pt:3,rm:3,ro:9,rof:3,ru:11,rwk:3,sah:0,saq:3,se:7,seh:3,ses:0,sg:0,sh:11,shi:19,sk:12,sl:14,sma:7,smi:7,smj:7,smn:7,sms:7,sn:3,so:3,sq:3,sr:11,ss:3,ssy:3,st:3,sv:3,sw:3,syr:3,ta:3,te:3,teo:3,th:0,ti:4,tig:3,tk:3,tl:4,tn:3,to:0,tr:0,ts:3,tzm:22,uk:11,ur:3,ve:3,vi:0,vun:3,wa:4,wae:3,wo:0,xh:3,xog:3,yo:0,zh:0,zu:3}[e.replace(/-.*$/,"")];return s in n?n[s]:(console.warn("plural form unknown for ["+e+"]"),function(){return"other"})}(a));var c="["+o._pluralRules(l)+"]";return 0===l&&i+"[zero]"in n?e=n[i+"[zero]"][s]:1==l&&i+"[one]"in n?e=n[i+"[one]"][s]:2==l&&i+"[two]"in n?e=n[i+"[two]"][s]:i+c in n?e=n[i+c][s]:i+"[other]"in n&&(e=n[i+"[other]"][s]),e},{get:function(e,t,i){var n,s=e.lastIndexOf("."),a=r;s>0&&(a=e.substring(s+1),e=e.substring(0,s)),i&&((n={})[a]=i);var o=p(e,t,n);return o&&a in o?o[a]:"{{"+e+"}}"},getData:function(){return n},getText:function(){return s},getLanguage:function(){return a},setLanguage:function(e,t){u(e,(function(){t&&t()}))},getDirection:function(){var e=a.split("-",1)[0];return["ar","he","fa","ps","ur"].indexOf(e)>=0?"rtl":"ltr"},translate:function(e){for(var i=function(e){return e?e.querySelectorAll("*[data-l10n-id]"):[]}(e=e||t.documentElement),n=i.length,s=0;s<n;s++)m(i[s]);m(e)},getReadyState:function(){return l},ready:function(i){i&&("complete"==l||"interactive"==l?e.setTimeout((function(){i()})):t.addEventListener&&t.addEventListener("localized",(function e(){t.removeEventListener("localized",e),i()})))}}}(window,document)},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PDFFindController=t.FindState=void 0;var n=i(2),s=i(4),r=i(11);const a={FOUND:0,NOT_FOUND:1,WRAPPED:2,PENDING:3};t.FindState=a;const o={"‐":"-","‘":"'","’":"'","‚":"'","‛":"'","“":'"',"”":'"',"„":'"',"‟":'"',"¼":"1/4","½":"1/2","¾":"3/4"},l=new Set([12441,12442,2381,2509,2637,2765,2893,3021,3149,3277,3387,3388,3405,3530,3642,3770,3972,4153,4154,5908,5940,6098,6752,6980,7082,7083,7154,7155,11647,43014,43052,43204,43347,43456,43766,44013,3158,3953,3954,3962,3963,3964,3965,3968,3956]);let c;const h=/\p{M}+/gu,d=/([.*+?^${}()|[\]\\])|(\p{P})|(\s+)|(\p{M})|(\p{L})/gu,u=/([^\p{M}])\p{M}*$/u,p=/^\p{M}*([^\p{M}])/u,g=/[\uAC00-\uD7AF\uFA6C\uFACF-\uFAD1\uFAD5-\uFAD7]+/g,f=new Map,m=new Map;let _=null,v=null;function b(e){const t=[];let i,n;for(;null!==(i=g.exec(e));){let{index:e}=i;for(const n of i[0]){let i=f.get(n);i||(i=n.normalize("NFD").length,f.set(n,i)),t.push([i,e++])}}if(0===t.length&&_)n=_;else if(t.length>0&&v)n=v;else{const e=`([${Object.keys(o).join("")}])|([①-⑳Ⓐ-⓿㉄-㊿㋐-㋾-])|((?:゙|゚)\\n)|(\\p{M}+(?:-\\n)?)|(\\S-\\n)|((?:\\p{Ideographic}|[-ヿ])\\n)|(\\n)`;n=0===t.length?_=new RegExp(e+"|(\\u0000)","gum"):v=new RegExp(e+"|([\\u1100-\\u1112\\ud7a4-\\ud7af\\ud84a\\ud84c\\ud850\\ud854\\ud857\\ud85f])","gum")}const s=[];for(;null!==(i=h.exec(e));)s.push([i[0].length,i.index]);let r=e.normalize("NFD");const a=[[0,0]];let l=0,c=0,d=0,u=0,p=0,b=!1;return r=r.replace(n,((e,i,n,r,h,g,f,_,v,y)=>{if(y-=u,i){const e=o[i],t=e.length;for(let e=1;e<t;e++)a.push([y-d+e,d-e]);return d-=t-1,e}if(n){let e=m.get(n);e||(e=n.normalize("NFKC"),m.set(n,e));const t=e.length;for(let e=1;e<t;e++)a.push([y-d+e,d-e]);return d-=t-1,e}if(r)return b=!0,y+p===s[l]?.[1]?++l:(a.push([y-1-d+1,d-1]),d-=1,u+=1),a.push([y-d+1,d]),u+=1,p+=1,r.charAt(0);if(h){const e=h.endsWith("\n"),t=e?h.length-2:h.length;b=!0;let i=t;y+p===s[l]?.[1]&&(i-=s[l][0],++l);for(let e=1;e<=i;e++)a.push([y-1-d+e,d-e]);return d-=i,u+=i,e?(y+=t-1,a.push([y-d+1,1+d]),d+=1,u+=1,p+=1,h.slice(0,t)):h}if(g){const e=g.length-2;return a.push([y-d+e,1+d]),d+=1,u+=1,p+=1,g.slice(0,-2)}if(f){const e=f.length-1;return a.push([y-d+e,d]),u+=1,p+=1,f.slice(0,-1)}if(_)return a.push([y-d+1,d-1]),d-=1,u+=1,p+=1," ";if(y+p===t[c]?.[1]){const e=t[c][0]-1;++c;for(let t=1;t<=e;t++)a.push([y-(d-t),d-t]);d-=e,u+=e}return v})),a.push([r.length,d]),[r,a,b]}function y(e,t,i){if(!e)return[t,i];const s=t,r=t+i;let a=(0,n.binarySearchFirstItem)(e,(e=>e[0]>=s));e[a][0]>s&&--a;let o=(0,n.binarySearchFirstItem)(e,(e=>e[0]>=r),a);return e[o][0]>r&&--o,[s+e[a][1],i+e[o][1]-e[a][1]]}t.PDFFindController=class{#Jt=!0;#Zt=0;constructor({linkService:e,eventBus:t,updateMatchesCountOnProgress:i=!0}){this._linkService=e,this._eventBus=t,this.#Jt=i,this.#ei(),t._on("find",this.#ti.bind(this)),t._on("findbarclose",this.#ii.bind(this))}get highlightMatches(){return this._highlightMatches}get pageMatches(){return this._pageMatches}get pageMatchesLength(){return this._pageMatchesLength}get selected(){return this._selected}get state(){return this._state}setDocument(e){this._pdfDocument&&this.#ei(),e&&(this._pdfDocument=e,this._firstPageCapability.resolve())}#ti(e){if(!e)return;const t=this._pdfDocument,{type:i}=e;(null===this._state||this.#ni(e))&&(this._dirtyMatch=!0),this._state=e,"highlightallchange"!==i&&this.#si(a.PENDING),this._firstPageCapability.promise.then((()=>{if(!this._pdfDocument||t&&this._pdfDocument!==t)return;this.#et();const e=!this._highlightMatches,n=!!this._findTimeout;this._findTimeout&&(clearTimeout(this._findTimeout),this._findTimeout=null),i?this._dirtyMatch?this.#ri():"again"===i?(this.#ri(),e&&this._state.highlightAll&&this.#ai()):"highlightallchange"===i?(n?this.#ri():this._highlightMatches=!0,this.#ai()):this.#ri():this._findTimeout=setTimeout((()=>{this.#ri(),this._findTimeout=null}),250)}))}scrollMatchIntoView({element:e=null,selectedLeft:t=0,pageIndex:i=-1,matchIndex:s=-1}){if(!this._scrollMatches||!e)return;if(-1===s||s!==this._selected.matchIdx)return;if(-1===i||i!==this._selected.pageIdx)return;this._scrollMatches=!1;const r={top:-50,left:t+-400};(0,n.scrollIntoView)(e,r,!0)}#ei(){this._highlightMatches=!1,this._scrollMatches=!1,this._pdfDocument=null,this._pageMatches=[],this._pageMatchesLength=[],this.#Zt=0,this._state=null,this._selected={pageIdx:-1,matchIdx:-1},this._offset={pageIdx:null,matchIdx:null,wrapped:!1},this._extractTextPromises=[],this._pageContents=[],this._pageDiffs=[],this._hasDiacritics=[],this._matchesCountTotal=0,this._pagesToSearch=null,this._pendingFindMatches=new Set,this._resumePageIdx=null,this._dirtyMatch=!1,clearTimeout(this._findTimeout),this._findTimeout=null,this._firstPageCapability=(0,s.createPromiseCapability)()}get#oi(){return this._state.query!==this._rawQuery&&(this._rawQuery=this._state.query,[this._normalizedQuery]=b(this._state.query)),this._normalizedQuery}#ni(e){if(e.query!==this._state.query)return!0;switch(e.type){case"again":const e=this._selected.pageIdx+1,t=this._linkService;return e>=1&&e<=t.pagesCount&&e!==t.page&&!t.isPageVisible(e);case"highlightallchange":return!1}return!0}#li(e,t,i){let n=e.slice(0,t).match(u);if(n){const i=e.charCodeAt(t),s=n[1].charCodeAt(0);if((0,r.getCharacterType)(i)===(0,r.getCharacterType)(s))return!1}if(n=e.slice(t+i).match(p),n){const s=e.charCodeAt(t+i-1),a=n[1].charCodeAt(0);if((0,r.getCharacterType)(s)===(0,r.getCharacterType)(a))return!1}return!0}#ci(e,t,i,n){const s=this._pageMatches[i]=[],r=this._pageMatchesLength[i]=[];if(!e)return;const a=this._pageDiffs[i];let o;for(;null!==(o=e.exec(n));){if(t&&!this.#li(n,o.index,o[0].length))continue;const[e,i]=y(a,o.index,o[0].length);i&&(s.push(e),r.push(i))}}#hi(e,t){const{matchDiacritics:i}=this._state;let n=!1;const s="[ ]*";return(e=e.replaceAll(d,((e,s,r,a,o,c)=>s?`[ ]*\\${s}[ ]*`:r?`[ ]*${r}[ ]*`:a?"[ ]+":i?o||c:o?l.has(o.charCodeAt(0))?o:"":t?(n=!0,`${c}\\p{M}*`):c))).endsWith(s)&&(e=e.slice(0,e.length-4)),i&&t&&(c||=String.fromCharCode(...l),n=!0,e=`${e}(?=[${c}]|[^\\p{M}]|$)`),[n,e]}#di(e){let t=this.#oi;if(!t)return;const{caseSensitive:i,entireWord:n,phraseSearch:s}=this._state,r=this._pageContents[e],a=this._hasDiacritics[e];let o=!1;if(s)[o,t]=this.#hi(t,a);else{const e=t.match(/\S+/g);e&&(t=e.sort().reverse().map((e=>{const[t,i]=this.#hi(e,a);return o||=t,`(${i})`})).join("|"))}t=t?new RegExp(t,`g${o?"u":""}${i?"":"i"}`):null,this.#ci(t,n,e,r),this._state.highlightAll&&this.#ui(e),this._resumePageIdx===e&&(this._resumePageIdx=null,this.#pi());const l=this._pageMatches[e].length;this._matchesCountTotal+=l,this.#Jt?l>0&&this.#gi():++this.#Zt===this._linkService.pagesCount&&this.#gi()}#et(){if(this._extractTextPromises.length>0)return;let e=Promise.resolve();for(let t=0,i=this._linkService.pagesCount;t<i;t++){const i=(0,s.createPromiseCapability)();this._extractTextPromises[t]=i.promise,e=e.then((()=>this._pdfDocument.getPage(t+1).then((e=>e.getTextContent())).then((e=>{const n=[];for(const t of e.items)n.push(t.str),t.hasEOL&&n.push("\n");[this._pageContents[t],this._pageDiffs[t],this._hasDiacritics[t]]=b(n.join("")),i.resolve()}),(e=>{console.error(`Unable to get text content for page ${t+1}`,e),this._pageContents[t]="",this._pageDiffs[t]=null,this._hasDiacritics[t]=!1,i.resolve()}))))}}#ui(e){this._scrollMatches&&this._selected.pageIdx===e&&(this._linkService.page=e+1),this._eventBus.dispatch("updatetextlayermatches",{source:this,pageIndex:e})}#ai(){this._eventBus.dispatch("updatetextlayermatches",{source:this,pageIndex:-1})}#ri(){const e=this._state.findPrevious,t=this._linkService.page-1,i=this._linkService.pagesCount;if(this._highlightMatches=!0,this._dirtyMatch){this._dirtyMatch=!1,this._selected.pageIdx=this._selected.matchIdx=-1,this._offset.pageIdx=t,this._offset.matchIdx=null,this._offset.wrapped=!1,this._resumePageIdx=null,this._pageMatches.length=0,this._pageMatchesLength.length=0,this.#Zt=0,this._matchesCountTotal=0,this.#ai();for(let e=0;e<i;e++)this._pendingFindMatches.has(e)||(this._pendingFindMatches.add(e),this._extractTextPromises[e].then((()=>{this._pendingFindMatches.delete(e),this.#di(e)})))}if(!this.#oi)return void this.#si(a.FOUND);if(this._resumePageIdx)return;const n=this._offset;if(this._pagesToSearch=i,null!==n.matchIdx){const t=this._pageMatches[n.pageIdx].length;if(!e&&n.matchIdx+1<t||e&&n.matchIdx>0)return n.matchIdx=e?n.matchIdx-1:n.matchIdx+1,void this.#fi(!0);this.#mi(e)}this.#pi()}#_i(e){const t=this._offset,i=e.length,n=this._state.findPrevious;return i?(t.matchIdx=n?i-1:0,this.#fi(!0),!0):(this.#mi(n),!!(t.wrapped&&(t.matchIdx=null,this._pagesToSearch<0))&&(this.#fi(!1),!0))}#pi(){null!==this._resumePageIdx&&console.error("There can only be one pending page.");let e=null;do{const t=this._offset.pageIdx;if(e=this._pageMatches[t],!e){this._resumePageIdx=t;break}}while(!this.#_i(e))}#mi(e){const t=this._offset,i=this._linkService.pagesCount;t.pageIdx=e?t.pageIdx-1:t.pageIdx+1,t.matchIdx=null,this._pagesToSearch--,(t.pageIdx>=i||t.pageIdx<0)&&(t.pageIdx=e?i-1:0,t.wrapped=!0)}#fi(e=!1){let t=a.NOT_FOUND;const i=this._offset.wrapped;if(this._offset.wrapped=!1,e){const e=this._selected.pageIdx;this._selected.pageIdx=this._offset.pageIdx,this._selected.matchIdx=this._offset.matchIdx,t=i?a.WRAPPED:a.FOUND,-1!==e&&e!==this._selected.pageIdx&&this.#ui(e)}this.#si(t,this._state.findPrevious),-1!==this._selected.pageIdx&&(this._scrollMatches=!0,this.#ui(this._selected.pageIdx))}#ii(e){const t=this._pdfDocument;this._firstPageCapability.promise.then((()=>{!this._pdfDocument||t&&this._pdfDocument!==t||(this._findTimeout&&(clearTimeout(this._findTimeout),this._findTimeout=null),this._resumePageIdx&&(this._resumePageIdx=null,this._dirtyMatch=!0),this.#si(a.FOUND),this._highlightMatches=!1,this.#ai())}))}#vi(){const{pageIdx:e,matchIdx:t}=this._selected;let i=0,n=this._matchesCountTotal;if(-1!==t){for(let t=0;t<e;t++)i+=this._pageMatches[t]?.length||0;i+=t+1}return(i<1||i>n)&&(i=n=0),{current:i,total:n}}#gi(){this._eventBus.dispatch("updatefindmatchescount",{source:this,matchesCount:this.#vi()})}#si(e,t=!1){(this.#Jt||this.#Zt===this._linkService.pagesCount&&e!==a.PENDING)&&this._eventBus.dispatch("updatefindcontrolstate",{source:this,state:e,previous:t,matchesCount:this.#vi(),rawQuery:this._state?.query??null})}}},(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CharacterType=void 0,t.getCharacterType=function(e){return function(e){return e<11904}(e)?function(e){return 0==(65408&e)}(e)?function(e){return 32===e||9===e||13===e||10===e}(e)?i.SPACE:function(e){return e>=97&&e<=122||e>=65&&e<=90}(e)||function(e){return e>=48&&e<=57}(e)||95===e?i.ALPHA_LETTER:i.PUNCT:function(e){return 3584==(65408&e)}(e)?i.THAI_LETTER:160===e?i.SPACE:i.ALPHA_LETTER:function(e){return e>=13312&&e<=40959||e>=63744&&e<=64255}(e)?i.HAN_LETTER:function(e){return e>=12448&&e<=12543}(e)?i.KATAKANA_LETTER:function(e){return e>=12352&&e<=12447}(e)?i.HIRAGANA_LETTER:function(e){return e>=65376&&e<=65439}(e)?i.HALFWIDTH_KATAKANA_LETTER:i.ALPHA_LETTER};const i={SPACE:0,ALPHA_LETTER:1,PUNCT:2,HAN_LETTER:3,KATAKANA_LETTER:4,HIRAGANA_LETTER:5,HALFWIDTH_KATAKANA_LETTER:6,THAI_LETTER:7};t.CharacterType=i},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PDFHistory=void 0,t.isDestArraysEqual=o,t.isDestHashesEqual=a;var n=i(2),s=i(7);function r(){return document.location.hash}function a(e,t){return"string"==typeof e&&"string"==typeof t&&(e===t||(0,n.parseQueryString)(e).get("nameddest")===t)}function o(e,t){function i(e,t){if(typeof e!=typeof t)return!1;if(Array.isArray(e)||Array.isArray(t))return!1;if(null!==e&&"object"==typeof e&&null!==t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(!i(e[n],t[n]))return!1;return!0}return e===t||Number.isNaN(e)&&Number.isNaN(t)}if(!Array.isArray(e)||!Array.isArray(t))return!1;if(e.length!==t.length)return!1;for(let n=0,s=e.length;n<s;n++)if(!i(e[n],t[n]))return!1;return!0}t.PDFHistory=class{constructor({linkService:e,eventBus:t}){this.linkService=e,this.eventBus=t,this._initialized=!1,this._fingerprint="",this.reset(),this._boundEvents=null,this.eventBus._on("pagesinit",(()=>{this._isPagesLoaded=!1,this.eventBus._on("pagesloaded",(e=>{this._isPagesLoaded=!!e.pagesCount}),{once:!0})}))}initialize({fingerprint:e,resetHistory:t=!1,updateUrl:i=!1}){if(!e||"string"!=typeof e)return void console.error('PDFHistory.initialize: The "fingerprint" must be a non-empty string.');this._initialized&&this.reset();const n=""!==this._fingerprint&&this._fingerprint!==e;this._fingerprint=e,this._updateUrl=!0===i,this._initialized=!0,this._bindEvents();const s=window.history.state;if(this._popStateInProgress=!1,this._blockHashChange=0,this._currentHash=r(),this._numPositionUpdates=0,this._uid=this._maxUid=0,this._destination=null,this._position=null,!this._isValidState(s,!0)||t){const{hash:e,page:i,rotation:s}=this._parseCurrentHash(!0);return!e||n||t?void this._pushOrReplaceState(null,!0):void this._pushOrReplaceState({hash:e,page:i,rotation:s},!0)}const a=s.destination;this._updateInternalState(a,s.uid,!0),void 0!==a.rotation&&(this._initialRotation=a.rotation),a.dest?(this._initialBookmark=JSON.stringify(a.dest),this._destination.page=null):a.hash?this._initialBookmark=a.hash:a.page&&(this._initialBookmark=`page=${a.page}`)}reset(){this._initialized&&(this._pageHide(),this._initialized=!1,this._unbindEvents()),this._updateViewareaTimeout&&(clearTimeout(this._updateViewareaTimeout),this._updateViewareaTimeout=null),this._initialBookmark=null,this._initialRotation=null}push({namedDest:e=null,explicitDest:t,pageNumber:i}){if(!this._initialized)return;if(e&&"string"!=typeof e)return void console.error(`PDFHistory.push: "${e}" is not a valid namedDest parameter.`);if(!Array.isArray(t))return void console.error(`PDFHistory.push: "${t}" is not a valid explicitDest parameter.`);if(!this._isValidPage(i)&&(null!==i||this._destination))return void console.error(`PDFHistory.push: "${i}" is not a valid pageNumber parameter.`);const n=e||JSON.stringify(t);if(!n)return;let s=!1;if(this._destination&&(a(this._destination.hash,n)||o(this._destination.dest,t))){if(this._destination.page)return;s=!0}this._popStateInProgress&&!s||(this._pushOrReplaceState({dest:t,hash:n,page:i,rotation:this.linkService.rotation},s),this._popStateInProgress||(this._popStateInProgress=!0,Promise.resolve().then((()=>{this._popStateInProgress=!1}))))}pushPage(e){this._initialized&&(this._isValidPage(e)?this._destination?.page!==e&&(this._popStateInProgress||(this._pushOrReplaceState({dest:null,hash:`page=${e}`,page:e,rotation:this.linkService.rotation}),this._popStateInProgress||(this._popStateInProgress=!0,Promise.resolve().then((()=>{this._popStateInProgress=!1}))))):console.error(`PDFHistory.pushPage: "${e}" is not a valid page number.`))}pushCurrentPosition(){this._initialized&&!this._popStateInProgress&&this._tryPushCurrentPosition()}back(){if(!this._initialized||this._popStateInProgress)return;const e=window.history.state;this._isValidState(e)&&e.uid>0&&window.history.back()}forward(){if(!this._initialized||this._popStateInProgress)return;const e=window.history.state;this._isValidState(e)&&e.uid<this._maxUid&&window.history.forward()}get popStateInProgress(){return this._initialized&&(this._popStateInProgress||this._blockHashChange>0)}get initialBookmark(){return this._initialized?this._initialBookmark:null}get initialRotation(){return this._initialized?this._initialRotation:null}_pushOrReplaceState(e,t=!1){const i=t||!this._destination,n={fingerprint:this._fingerprint,uid:i?this._uid:this._uid+1,destination:e};let s;if(this._updateInternalState(e,n.uid),this._updateUrl&&e?.hash){const t=document.location.href.split("#")[0];t.startsWith("file://")||(s=`${t}#${e.hash}`)}i?window.history.replaceState(n,"",s):window.history.pushState(n,"",s)}_tryPushCurrentPosition(e=!1){if(!this._position)return;let t=this._position;if(e&&(t=Object.assign(Object.create(null),this._position),t.temporary=!0),!this._destination)return void this._pushOrReplaceState(t);if(this._destination.temporary)return void this._pushOrReplaceState(t,!0);if(this._destination.hash===t.hash)return;if(!this._destination.page&&this._numPositionUpdates<=50)return;let i=!1;if(this._destination.page>=t.first&&this._destination.page<=t.page){if(void 0!==this._destination.dest||!this._destination.first)return;i=!0}this._pushOrReplaceState(t,i)}_isValidPage(e){return Number.isInteger(e)&&e>0&&e<=this.linkService.pagesCount}_isValidState(e,t=!1){if(!e)return!1;if(e.fingerprint!==this._fingerprint){if(!t)return!1;{if("string"!=typeof e.fingerprint||e.fingerprint.length!==this._fingerprint.length)return!1;const[t]=performance.getEntriesByType("navigation");if("reload"!==t?.type)return!1}}return!(!Number.isInteger(e.uid)||e.uid<0)&&null!==e.destination&&"object"==typeof e.destination}_updateInternalState(e,t,i=!1){this._updateViewareaTimeout&&(clearTimeout(this._updateViewareaTimeout),this._updateViewareaTimeout=null),i&&e?.temporary&&delete e.temporary,this._destination=e,this._uid=t,this._maxUid=Math.max(this._maxUid,t),this._numPositionUpdates=0}_parseCurrentHash(e=!1){const t=unescape(r()).substring(1),i=(0,n.parseQueryString)(t),s=i.get("nameddest")||"";let a=0|i.get("page");return(!this._isValidPage(a)||e&&s.length>0)&&(a=null),{hash:t,page:a,rotation:this.linkService.rotation}}_updateViewarea({location:e}){this._updateViewareaTimeout&&(clearTimeout(this._updateViewareaTimeout),this._updateViewareaTimeout=null),this._position={hash:e.pdfOpenParams.substring(1),page:this.linkService.page,first:e.pageNumber,rotation:e.rotation},this._popStateInProgress||(this._isPagesLoaded&&this._destination&&!this._destination.page&&this._numPositionUpdates++,this._updateViewareaTimeout=setTimeout((()=>{this._popStateInProgress||this._tryPushCurrentPosition(!0),this._updateViewareaTimeout=null}),1e3))}_popState({state:e}){const t=r(),i=this._currentHash!==t;if(this._currentHash=t,!e){this._uid++;const{hash:e,page:t,rotation:i}=this._parseCurrentHash();return void this._pushOrReplaceState({hash:e,page:t,rotation:i},!0)}if(!this._isValidState(e))return;this._popStateInProgress=!0,i&&(this._blockHashChange++,(0,s.waitOnEventOrTimeout)({target:window,name:"hashchange",delay:1e3}).then((()=>{this._blockHashChange--})));const a=e.destination;this._updateInternalState(a,e.uid,!0),(0,n.isValidRotation)(a.rotation)&&(this.linkService.rotation=a.rotation),a.dest?this.linkService.goToDestination(a.dest):a.hash?this.linkService.setHash(a.hash):a.page&&(this.linkService.page=a.page),Promise.resolve().then((()=>{this._popStateInProgress=!1}))}_pageHide(){this._destination&&!this._destination.temporary||this._tryPushCurrentPosition()}_bindEvents(){this._boundEvents||(this._boundEvents={updateViewarea:this._updateViewarea.bind(this),popState:this._popState.bind(this),pageHide:this._pageHide.bind(this)},this.eventBus._on("updateviewarea",this._boundEvents.updateViewarea),window.addEventListener("popstate",this._boundEvents.popState),window.addEventListener("pagehide",this._boundEvents.pageHide))}_unbindEvents(){this._boundEvents&&(this.eventBus._off("updateviewarea",this._boundEvents.updateViewarea),window.removeEventListener("popstate",this._boundEvents.popState),window.removeEventListener("pagehide",this._boundEvents.pageHide),this._boundEvents=null)}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PDFPageView=void 0;var n=i(4),s=i(2),r=i(14),a=i(3),o=i(15),l=i(5),c=i(1),h=i(16),d=i(17),u=i(18),p=i(19),g=i(20);const f=o.compatibilityParams.maxCanvasPixels||16777216,m=()=>({annotationEditorUIManager:null,annotationStorage:null,downloadManager:null,enableScripting:!1,fieldObjectsPromise:null,findController:null,hasJSActionsPromise:null,get linkService(){return new c.SimpleLinkService}});t.PDFPageView=class{#bi=n.AnnotationMode.ENABLE_FORMS;#yi=null;#Si=null;#Pi=null;#Ai=s.RenderingStates.INITIAL;#wi={initialOptionalContent:!0,regularAnnotations:!0};constructor(e){const t=e.container,i=e.defaultViewport;this.id=e.id,this.renderingId="page"+this.id,this.#yi=e.layerProperties||m,this.pdfPage=null,this.pageLabel=null,this.rotation=0,this.scale=e.scale||s.DEFAULT_SCALE,this.viewport=i,this.pdfPageRotate=i.rotation,this._optionalContentConfigPromise=e.optionalContentConfigPromise||null,this.hasRestrictedScaling=!1,this.textLayerMode=e.textLayerMode??s.TextLayerMode.ENABLE,this.#bi=e.annotationMode??n.AnnotationMode.ENABLE_FORMS,this.imageResourcesPath=e.imageResourcesPath||"",this.useOnlyCssZoom=e.useOnlyCssZoom||!1,this.isOffscreenCanvasSupported=e.isOffscreenCanvasSupported??!0,this.maxCanvasPixels=e.maxCanvasPixels||f,this.pageColors=e.pageColors||null,this.eventBus=e.eventBus,this.renderingQueue=e.renderingQueue,this.renderer=e.renderer||s.RendererType.CANVAS,this.l10n=e.l10n||l.NullL10n,this.paintTask=null,this.paintedViewportMap=new WeakMap,this.resume=null,this._renderError=null,this._isStandalone=!this.renderingQueue?.hasViewer(),this._annotationCanvasMap=null,this.annotationLayer=null,this.annotationEditorLayer=null,this.textLayer=null,this.zoomLayer=null,this.xfaLayer=null,this.structTreeLayer=null;const r=document.createElement("div");if(r.className="page",r.setAttribute("data-page-number",this.id),r.setAttribute("role","region"),this.l10n.get("page_landmark",{page:this.id}).then((e=>{r.setAttribute("aria-label",e)})),this.div=r,this.#Ei(),t?.append(r),this._isStandalone){t?.style.setProperty("--scale-factor",this.scale*n.PixelsPerInch.PDF_TO_CSS_UNITS);const{optionalContentConfigPromise:i}=e;i&&i.then((e=>{i===this._optionalContentConfigPromise&&(this.#wi.initialOptionalContent=e.hasInitialVisibility)}))}}get renderingState(){return this.#Ai}set renderingState(e){if(e!==this.#Ai)switch(this.#Ai=e,this.#Si&&(clearTimeout(this.#Si),this.#Si=null),e){case s.RenderingStates.PAUSED:this.div.classList.remove("loading");break;case s.RenderingStates.RUNNING:this.div.classList.add("loadingIcon"),this.#Si=setTimeout((()=>{this.div.classList.add("loading"),this.#Si=null}),0);break;case s.RenderingStates.INITIAL:case s.RenderingStates.FINISHED:this.div.classList.remove("loadingIcon","loading")}}#Ei(){const{viewport:e}=this;if(this.pdfPage){if(this.#Pi===e.rotation)return;this.#Pi=e.rotation}(0,n.setLayerDimensions)(this.div,e,!0,!1)}setPdfPage(e){this.pdfPage=e,this.pdfPageRotate=e.rotate;const t=(this.rotation+this.pdfPageRotate)%360;this.viewport=e.getViewport({scale:this.scale*n.PixelsPerInch.PDF_TO_CSS_UNITS,rotation:t}),this.#Ei(),this.reset()}destroy(){this.reset(),this.pdfPage?.cleanup()}get _textHighlighter(){return(0,n.shadow)(this,"_textHighlighter",new u.TextHighlighter({pageIndex:this.id-1,eventBus:this.eventBus,findController:this.#yi().findController}))}async#Ci(){let e=null;try{await this.annotationLayer.render(this.viewport,"display")}catch(t){console.error(`#renderAnnotationLayer: "${t}".`),e=t}finally{this.eventBus.dispatch("annotationlayerrendered",{source:this,pageNumber:this.id,error:e})}}async#xi(){let e=null;try{await this.annotationEditorLayer.render(this.viewport,"display")}catch(t){console.error(`#renderAnnotationEditorLayer: "${t}".`),e=t}finally{this.eventBus.dispatch("annotationeditorlayerrendered",{source:this,pageNumber:this.id,error:e})}}async#Mi(){let e=null;try{const e=await this.xfaLayer.render(this.viewport,"display");e?.textDivs&&this._textHighlighter&&this.#Ti(e.textDivs)}catch(t){console.error(`#renderXfaLayer: "${t}".`),e=t}finally{this.eventBus.dispatch("xfalayerrendered",{source:this,pageNumber:this.id,error:e})}}async#Fi(){const{pdfPage:e,textLayer:t,viewport:i}=this;if(!t)return;let s=null;try{if(!t.renderingDone){const i=e.streamTextContent({includeMarkedContent:!0});t.setTextContentSource(i)}await t.render(i)}catch(e){if(e instanceof n.AbortException)return;console.error(`#renderTextLayer: "${e}".`),s=e}this.eventBus.dispatch("textlayerrendered",{source:this,pageNumber:this.id,numTextDivs:t.numTextDivs,error:s}),this.#Di()}async#Di(){if(!this.textLayer)return;this.structTreeLayer||=new h.StructTreeLayerBuilder;const e=await(this.structTreeLayer.renderingDone?null:this.pdfPage.getStructTree()),t=this.structTreeLayer?.render(e);t&&this.canvas?.append(t),this.structTreeLayer?.show()}async#Ti(e){const t=await this.pdfPage.getTextContent(),i=[];for(const e of t.items)i.push(e.str);this._textHighlighter.setTextMapping(e,i),this._textHighlighter.enable()}_resetZoomLayer(e=!1){if(!this.zoomLayer)return;const t=this.zoomLayer.firstChild;this.paintedViewportMap.delete(t),t.width=0,t.height=0,e&&this.zoomLayer.remove(),this.zoomLayer=null}reset({keepZoomLayer:e=!1,keepAnnotationLayer:t=!1,keepAnnotationEditorLayer:i=!1,keepXfaLayer:n=!1,keepTextLayer:r=!1}={}){this.cancelRendering({keepAnnotationLayer:t,keepAnnotationEditorLayer:i,keepXfaLayer:n,keepTextLayer:r}),this.renderingState=s.RenderingStates.INITIAL;const a=this.div,o=a.childNodes,l=e&&this.zoomLayer||null,c=t&&this.annotationLayer?.div||null,h=i&&this.annotationEditorLayer?.div||null,d=n&&this.xfaLayer?.div||null,u=r&&this.textLayer?.div||null;for(let e=o.length-1;e>=0;e--){const t=o[e];switch(t){case l:case c:case h:case d:case u:continue}t.remove()}a.removeAttribute("data-loaded"),c&&this.annotationLayer.hide(),h&&this.annotationEditorLayer.hide(),d&&this.xfaLayer.hide(),u&&this.textLayer.hide(),this.structTreeLayer?.hide(),l||(this.canvas&&(this.paintedViewportMap.delete(this.canvas),this.canvas.width=0,this.canvas.height=0,delete this.canvas),this._resetZoomLayer()),this.svg&&(this.paintedViewportMap.delete(this.svg),delete this.svg)}update({scale:e=0,rotation:t=null,optionalContentConfigPromise:i=null,drawingDelay:r=-1}){this.scale=e||this.scale,"number"==typeof t&&(this.rotation=t),i instanceof Promise&&(this._optionalContentConfigPromise=i,i.then((e=>{i===this._optionalContentConfigPromise&&(this.#wi.initialOptionalContent=e.hasInitialVisibility)})));const a=(this.rotation+this.pdfPageRotate)%360;if(this.viewport=this.viewport.clone({scale:this.scale*n.PixelsPerInch.PDF_TO_CSS_UNITS,rotation:a}),this.#Ei(),this._isStandalone&&this.div.parentNode?.style.setProperty("--scale-factor",this.viewport.scale),this.svg)return this.cssTransform({target:this.svg,redrawAnnotationLayer:!0,redrawAnnotationEditorLayer:!0,redrawXfaLayer:!0,redrawTextLayer:!0}),void this.eventBus.dispatch("pagerendered",{source:this,pageNumber:this.id,cssTransform:!0,timestamp:performance.now(),error:this._renderError});let o=!1;if(this.canvas&&this.maxCanvasPixels>0){const e=this.outputScale;(Math.floor(this.viewport.width)*e.sx|0)*(Math.floor(this.viewport.height)*e.sy|0)>this.maxCanvasPixels&&(o=!0)}const l=this.useOnlyCssZoom||this.hasRestrictedScaling&&o,c=!l&&r>=0&&r<1e3;if(this.canvas){if(c||l)return c&&this.renderingState!==s.RenderingStates.FINISHED&&(this.cancelRendering({keepZoomLayer:!0,keepAnnotationLayer:!0,keepAnnotationEditorLayer:!0,keepXfaLayer:!0,keepTextLayer:!0,cancelExtraDelay:r}),this.renderingState=s.RenderingStates.FINISHED),this.cssTransform({target:this.canvas,redrawAnnotationLayer:!0,redrawAnnotationEditorLayer:!0,redrawXfaLayer:!0,redrawTextLayer:!c,hideTextLayer:c}),void this.eventBus.dispatch("pagerendered",{source:this,pageNumber:this.id,cssTransform:!0,timestamp:performance.now(),error:this._renderError});this.zoomLayer||this.canvas.hidden||(this.zoomLayer=this.canvas.parentNode,this.zoomLayer.style.position="absolute")}this.zoomLayer&&this.cssTransform({target:this.zoomLayer.firstChild}),this.reset({keepZoomLayer:!0,keepAnnotationLayer:!0,keepAnnotationEditorLayer:!0,keepXfaLayer:!0,keepTextLayer:!0})}cancelRendering({keepAnnotationLayer:e=!1,keepAnnotationEditorLayer:t=!1,keepXfaLayer:i=!1,keepTextLayer:n=!1,cancelExtraDelay:s=0}={}){this.paintTask&&(this.paintTask.cancel(s),this.paintTask=null),this.resume=null,!this.textLayer||n&&this.textLayer.div||(this.textLayer.cancel(),this.textLayer=null),this.structTreeLayer&&!this.textLayer&&(this.structTreeLayer=null),!this.annotationLayer||e&&this.annotationLayer.div||(this.annotationLayer.cancel(),this.annotationLayer=null,this._annotationCanvasMap=null),!this.annotationEditorLayer||t&&this.annotationEditorLayer.div||(this.annotationEditorLayer.cancel(),this.annotationEditorLayer=null),!this.xfaLayer||i&&this.xfaLayer.div||(this.xfaLayer.cancel(),this.xfaLayer=null,this._textHighlighter?.disable())}cssTransform({target:e,redrawAnnotationLayer:t=!1,redrawAnnotationEditorLayer:i=!1,redrawXfaLayer:n=!1,redrawTextLayer:s=!1,hideTextLayer:r=!1}){if(e instanceof HTMLCanvasElement){if(!e.hasAttribute("zooming")){e.setAttribute("zooming",!0);const{style:t}=e;t.width=t.height=""}}else{const t=this.div,{width:i,height:n}=this.viewport;e.style.width=e.parentNode.style.width=t.style.width=Math.floor(i)+"px",e.style.height=e.parentNode.style.height=t.style.height=Math.floor(n)+"px"}const a=this.paintedViewportMap.get(e);if(this.viewport!==a){const t=this.viewport.rotation-a.rotation,i=Math.abs(t);let n=1,s=1;if(90===i||270===i){const{width:e,height:t}=this.viewport;n=t/e,s=e/t}e.style.transform=`rotate(${t}deg) scale(${n}, ${s})`}t&&this.annotationLayer&&this.#Ci(),i&&this.annotationEditorLayer&&this.#xi(),n&&this.xfaLayer&&this.#Mi(),this.textLayer&&(r?(this.textLayer.hide(),this.structTreeLayer?.hide()):s&&this.#Fi())}get width(){return this.viewport.width}get height(){return this.viewport.height}getPagePoint(e,t){return this.viewport.convertToPdfPoint(e,t)}draw(){this.renderingState!==s.RenderingStates.INITIAL&&(console.error("Must be in new state before drawing"),this.reset());const{div:e,pdfPage:t}=this;if(!t)return this.renderingState=s.RenderingStates.FINISHED,Promise.reject(new Error("pdfPage is not loaded"));this.renderingState=s.RenderingStates.RUNNING;const i=document.createElement("div");if(i.classList.add("canvasWrapper"),e.append(i),this.textLayer||this.textLayerMode===s.TextLayerMode.DISABLE||t.isPureXfa||(this._accessibilityManager||=new d.TextAccessibilityManager,this.textLayer=new p.TextLayerBuilder({highlighter:this._textHighlighter,accessibilityManager:this._accessibilityManager,isOffscreenCanvasSupported:this.isOffscreenCanvasSupported}),e.append(this.textLayer.div)),!this.annotationLayer&&this.#bi!==n.AnnotationMode.DISABLE){const{annotationStorage:i,downloadManager:s,enableScripting:r,fieldObjectsPromise:o,hasJSActionsPromise:l,linkService:c}=this.#yi();this._annotationCanvasMap||=new Map,this.annotationLayer=new a.AnnotationLayerBuilder({pageDiv:e,pdfPage:t,annotationStorage:i,imageResourcesPath:this.imageResourcesPath,renderForms:this.#bi===n.AnnotationMode.ENABLE_FORMS,linkService:c,downloadManager:s,l10n:this.l10n,enableScripting:r,hasJSActionsPromise:l,fieldObjectsPromise:o,annotationCanvasMap:this._annotationCanvasMap,accessibilityManager:this._accessibilityManager})}let o=null;this.renderingQueue&&(o=e=>{if(!this.renderingQueue.isHighestPriority(this))return this.renderingState=s.RenderingStates.PAUSED,void(this.resume=()=>{this.renderingState=s.RenderingStates.RUNNING,e()});e()});const l=async(e=null)=>{if(c===this.paintTask&&(this.paintTask=null),e instanceof n.RenderingCancelledException)this._renderError=null;else if(this._renderError=e,this.renderingState=s.RenderingStates.FINISHED,this._resetZoomLayer(!0),this.#wi.regularAnnotations=!c.separateAnnots,this.eventBus.dispatch("pagerendered",{source:this,pageNumber:this.id,cssTransform:!1,timestamp:performance.now(),error:this._renderError}),e)throw e},c=this.renderer===s.RendererType.SVG?this.paintOnSvg(i):this.paintOnCanvas(i);c.onRenderContinue=o,this.paintTask=c;const h=c.promise.then((()=>l(null).then((async()=>{if(this.#Fi(),this.annotationLayer&&await this.#Ci(),!this.annotationEditorLayer){const{annotationEditorUIManager:i}=this.#yi();if(!i)return;this.annotationEditorLayer=new r.AnnotationEditorLayerBuilder({uiManager:i,pageDiv:e,pdfPage:t,l10n:this.l10n,accessibilityManager:this._accessibilityManager})}this.#xi()}))),(function(e){return l(e)}));if(t.isPureXfa){if(this.xfaLayer)this.xfaLayer.div&&e.append(this.xfaLayer.div);else{const{annotationStorage:i,linkService:n}=this.#yi();this.xfaLayer=new g.XfaLayerBuilder({pageDiv:e,pdfPage:t,annotationStorage:i,linkService:n})}this.#Mi()}return e.setAttribute("data-loaded",!0),this.eventBus.dispatch("pagerender",{source:this,pageNumber:this.id}),h}paintOnCanvas(e){const t=(0,n.createPromiseCapability)(),i={promise:t.promise,onRenderContinue(e){e()},cancel(e=0){v.cancel(e)},get separateAnnots(){return v.separateAnnots}},r=this.viewport,{width:a,height:o}=r,l=document.createElement("canvas");l.setAttribute("role","presentation"),l.hidden=!0;let c=!0;const h=!(!this.pageColors?.background||!this.pageColors?.foreground),d=function(e){!c||h&&!e||(l.hidden=!1,c=!1)};e.append(l),this.canvas=l;const u=l.getContext("2d",{alpha:!1}),p=this.outputScale=new s.OutputScale;if(this.useOnlyCssZoom){const e=r.clone({scale:n.PixelsPerInch.PDF_TO_CSS_UNITS});p.sx*=e.width/a,p.sy*=e.height/o}if(this.maxCanvasPixels>0){const e=a*o,t=Math.sqrt(this.maxCanvasPixels/e);p.sx>t||p.sy>t?(p.sx=t,p.sy=t,this.hasRestrictedScaling=!0):this.hasRestrictedScaling=!1}const g=(0,s.approximateFraction)(p.sx),f=(0,s.approximateFraction)(p.sy);l.width=(0,s.roundToDivide)(r.width*p.sx,g[0]),l.height=(0,s.roundToDivide)(r.height*p.sy,f[0]);const{style:m}=l;m.width=(0,s.roundToDivide)(r.width,g[1])+"px",m.height=(0,s.roundToDivide)(r.height,f[1])+"px",this.paintedViewportMap.set(l,r);const _={canvasContext:u,transform:p.scaled?[p.sx,0,0,p.sy,0,0]:null,viewport:r,annotationMode:this.#bi,optionalContentConfigPromise:this._optionalContentConfigPromise,annotationCanvasMap:this._annotationCanvasMap,pageColors:this.pageColors},v=this.pdfPage.render(_);return v.onContinue=function(e){d(!1),i.onRenderContinue?i.onRenderContinue(e):e()},v.promise.then((function(){d(!0),t.resolve()}),(function(e){e instanceof n.RenderingCancelledException||d(!0),t.reject(e)})),i}paintOnSvg(e){let t=!1;const i=()=>{if(t)throw new n.RenderingCancelledException(`Rendering cancelled, page ${this.id}`,"svg")},r=this.pdfPage,a=this.viewport.clone({scale:n.PixelsPerInch.PDF_TO_CSS_UNITS});return{promise:r.getOperatorList({annotationMode:this.#bi}).then((t=>(i(),new n.SVGGraphics(r.commonObjs,r.objs).getSVG(t,a).then((t=>{i(),this.svg=t,this.paintedViewportMap.set(t,a),t.style.width=e.style.width,t.style.height=e.style.height,this.renderingState=s.RenderingStates.FINISHED,e.append(t)}))))),onRenderContinue(e){e()},cancel(){t=!0},get separateAnnots(){return!1}}}setPageLabel(e){this.pageLabel="string"==typeof e?e:null,null!==this.pageLabel?this.div.setAttribute("data-page-label",this.pageLabel):this.div.removeAttribute("data-page-label")}get thumbnailCanvas(){const{initialOptionalContent:e,regularAnnotations:t}=this.#wi;return e&&t?this.canvas:null}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.AnnotationEditorLayerBuilder=void 0;var n=i(4),s=i(5);t.AnnotationEditorLayerBuilder=class{#Ne;constructor(e){this.pageDiv=e.pageDiv,this.pdfPage=e.pdfPage,this.accessibilityManager=e.accessibilityManager,this.l10n=e.l10n||s.NullL10n,this.annotationEditorLayer=null,this.div=null,this._cancelled=!1,this.#Ne=e.uiManager}async render(e,t="display"){if("display"!==t)return;if(this._cancelled)return;const i=e.clone({dontFlip:!0});if(this.div)return this.annotationEditorLayer.update({viewport:i}),void this.show();const s=this.div=document.createElement("div");s.className="annotationEditorLayer",s.tabIndex=0,s.hidden=!0,this.pageDiv.append(s),this.annotationEditorLayer=new n.AnnotationEditorLayer({uiManager:this.#Ne,div:s,accessibilityManager:this.accessibilityManager,pageIndex:this.pdfPage.pageNumber-1,l10n:this.l10n,viewport:i});const r={viewport:i,div:s,annotations:null,intent:t};this.annotationEditorLayer.render(r),this.show()}cancel(){this._cancelled=!0,this.div&&(this.pageDiv=null,this.annotationEditorLayer.destroy(),this.div.remove())}hide(){this.div&&(this.div.hidden=!0)}show(){this.div&&!this.annotationEditorLayer.isEmpty&&(this.div.hidden=!1)}}},(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.compatibilityParams=t.OptionKind=t.AppOptions=void 0;const i=Object.create(null);t.compatibilityParams=i;{const e=navigator.userAgent||"",t=navigator.platform||"",n=navigator.maxTouchPoints||1,s=/Android/.test(e);(/\b(iPad|iPhone|iPod)(?=;)/.test(e)||"MacIntel"===t&&n>1||s)&&(i.maxCanvasPixels=5242880)}const n={VIEWER:2,API:4,WORKER:8,PREFERENCE:128};t.OptionKind=n;const s={annotationEditorMode:{value:0,kind:n.VIEWER+n.PREFERENCE},annotationMode:{value:2,kind:n.VIEWER+n.PREFERENCE},cursorToolOnLoad:{value:0,kind:n.VIEWER+n.PREFERENCE},defaultZoomDelay:{value:400,kind:n.VIEWER+n.PREFERENCE},defaultZoomValue:{value:"",kind:n.VIEWER+n.PREFERENCE},disableHistory:{value:!1,kind:n.VIEWER},disablePageLabels:{value:!1,kind:n.VIEWER+n.PREFERENCE},enablePermissions:{value:!1,kind:n.VIEWER+n.PREFERENCE},enablePrintAutoRotate:{value:!0,kind:n.VIEWER+n.PREFERENCE},enableScripting:{value:!0,kind:n.VIEWER+n.PREFERENCE},externalLinkRel:{value:"noopener noreferrer nofollow",kind:n.VIEWER},externalLinkTarget:{value:0,kind:n.VIEWER+n.PREFERENCE},historyUpdateUrl:{value:!1,kind:n.VIEWER+n.PREFERENCE},ignoreDestinationZoom:{value:!1,kind:n.VIEWER+n.PREFERENCE},imageResourcesPath:{value:"./images/",kind:n.VIEWER},maxCanvasPixels:{value:16777216,kind:n.VIEWER},forcePageColors:{value:!1,kind:n.VIEWER+n.PREFERENCE},pageColorsBackground:{value:"Canvas",kind:n.VIEWER+n.PREFERENCE},pageColorsForeground:{value:"CanvasText",kind:n.VIEWER+n.PREFERENCE},pdfBugEnabled:{value:!1,kind:n.VIEWER+n.PREFERENCE},printResolution:{value:150,kind:n.VIEWER},sidebarViewOnLoad:{value:-1,kind:n.VIEWER+n.PREFERENCE},scrollModeOnLoad:{value:-1,kind:n.VIEWER+n.PREFERENCE},spreadModeOnLoad:{value:-1,kind:n.VIEWER+n.PREFERENCE},textLayerMode:{value:1,kind:n.VIEWER+n.PREFERENCE},useOnlyCssZoom:{value:!1,kind:n.VIEWER+n.PREFERENCE},viewerCssTheme:{value:0,kind:n.VIEWER+n.PREFERENCE},viewOnLoad:{value:0,kind:n.VIEWER+n.PREFERENCE},cMapPacked:{value:!0,kind:n.API},cMapUrl:{value:"../web/cmaps/",kind:n.API},disableAutoFetch:{value:!1,kind:n.API+n.PREFERENCE},disableFontFace:{value:!1,kind:n.API+n.PREFERENCE},disableRange:{value:!1,kind:n.API+n.PREFERENCE},disableStream:{value:!1,kind:n.API+n.PREFERENCE},docBaseUrl:{value:"",kind:n.API},enableXfa:{value:!0,kind:n.API+n.PREFERENCE},fontExtraProperties:{value:!1,kind:n.API},isEvalSupported:{value:!0,kind:n.API},isOffscreenCanvasSupported:{value:!0,kind:n.API},maxImageSize:{value:-1,kind:n.API},pdfBug:{value:!1,kind:n.API},standardFontDataUrl:{value:"../web/standard_fonts/",kind:n.API},verbosity:{value:1,kind:n.API},workerPort:{value:null,kind:n.WORKER},workerSrc:{value:"../build/pdf.worker.js",kind:n.WORKER}};s.defaultUrl={value:"compressed.tracemonkey-pldi-09.pdf",kind:n.VIEWER},s.disablePreferences={value:!1,kind:n.VIEWER},s.locale={value:navigator.language||"en-US",kind:n.VIEWER},s.renderer={value:"canvas",kind:n.VIEWER+n.PREFERENCE},s.sandboxBundleSrc={value:"../build/pdf.sandbox.js",kind:n.VIEWER};const r=Object.create(null);class a{constructor(){throw new Error("Cannot initialize AppOptions.")}static get(e){const t=r[e];if(void 0!==t)return t;const n=s[e];return void 0!==n?i[e]??n.value:void 0}static getAll(e=null){const t=Object.create(null);for(const a in s){const o=s[a];if(e){if(0==(e&o.kind))continue;if(e===n.PREFERENCE){const e=o.value,i=typeof e;if("boolean"===i||"string"===i||"number"===i&&Number.isInteger(e)){t[a]=e;continue}throw new Error(`Invalid type for preference: ${a}`)}}const l=r[a];t[a]=void 0!==l?l:i[a]??o.value}return t}static set(e,t){r[e]=t}static setAll(e){for(const t in e)r[t]=e[t]}static remove(e){delete r[e]}}t.AppOptions=a,a._hasUserOptions=function(){return Object.keys(r).length>0}},(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.StructTreeLayerBuilder=void 0;const i={Document:null,DocumentFragment:null,Part:"group",Sect:"group",Div:"group",Aside:"note",NonStruct:"none",P:null,H:"heading",Title:null,FENote:"note",Sub:"group",Lbl:null,Span:null,Em:null,Strong:null,Link:"link",Annot:"note",Form:"form",Ruby:null,RB:null,RT:null,RP:null,Warichu:null,WT:null,WP:null,L:"list",LI:"listitem",LBody:null,Table:"table",TR:"row",TH:"columnheader",TD:"cell",THead:"columnheader",TBody:null,TFoot:null,Caption:null,Figure:"figure",Formula:null,Artifact:null},n=/^H(\d+)$/;t.StructTreeLayerBuilder=class{#ki=void 0;get renderingDone(){return void 0!==this.#ki}render(e){if(void 0!==this.#ki)return this.#ki;const t=this.#Ri(e);return t?.classList.add("structTree"),this.#ki=t}hide(){this.#ki&&!this.#ki.hidden&&(this.#ki.hidden=!0)}show(){this.#ki?.hidden&&(this.#ki.hidden=!1)}#Li(e,t){void 0!==e.alt&&t.setAttribute("aria-label",e.alt),void 0!==e.id&&t.setAttribute("aria-owns",e.id),void 0!==e.lang&&t.setAttribute("lang",e.lang)}#Ri(e){if(!e)return null;const t=document.createElement("span");if("role"in e){const{role:s}=e,r=s.match(n);r?(t.setAttribute("role","heading"),t.setAttribute("aria-level",r[1])):i[s]&&t.setAttribute("role",i[s])}if(this.#Li(e,t),e.children)if(1===e.children.length&&"id"in e.children[0])this.#Li(e.children[0],t);else for(const i of e.children)t.append(this.#Ri(i));return t}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TextAccessibilityManager=void 0;var n=i(2);class s{#Ii=!1;#Oi=null;#Ni=new Map;#Vi=new Map;setTextMapping(e){this.#Oi=e}static#Bi(e,t){const i=e.getBoundingClientRect(),n=t.getBoundingClientRect();if(0===i.width&&0===i.height)return 1;if(0===n.width&&0===n.height)return-1;const s=i.y,r=i.y+i.height,a=i.y+i.height/2,o=n.y,l=n.y+n.height,c=n.y+n.height/2;return a<=o&&c>=r?-1:c<=s&&a>=l?1:i.x+i.width/2-(n.x+n.width/2)}enable(){if(this.#Ii)throw new Error("TextAccessibilityManager is already enabled.");if(!this.#Oi)throw new Error("Text divs and strings have not been set.");if(this.#Ii=!0,this.#Oi=this.#Oi.slice(),this.#Oi.sort(s.#Bi),this.#Ni.size>0){const e=this.#Oi;for(const[t,i]of this.#Ni)document.getElementById(t)?this.#Ui(t,e[i]):this.#Ni.delete(t)}for(const[e,t]of this.#Vi)this.addPointerInTextLayer(e,t);this.#Vi.clear()}disable(){this.#Ii&&(this.#Vi.clear(),this.#Oi=null,this.#Ii=!1)}removePointerInTextLayer(e){if(!this.#Ii)return void this.#Vi.delete(e);const t=this.#Oi;if(!t||0===t.length)return;const{id:i}=e,n=this.#Ni.get(i);if(void 0===n)return;const s=t[n];this.#Ni.delete(i);let r=s.getAttribute("aria-owns");r?.includes(i)&&(r=r.split(" ").filter((e=>e!==i)).join(" "),r?s.setAttribute("aria-owns",r):(s.removeAttribute("aria-owns"),s.setAttribute("role","presentation")))}#Ui(e,t){const i=t.getAttribute("aria-owns");i?.includes(e)||t.setAttribute("aria-owns",i?`${i} ${e}`:e),t.removeAttribute("role")}addPointerInTextLayer(e,t){const{id:i}=e;if(!i)return;if(!this.#Ii)return void this.#Vi.set(e,t);t&&this.removePointerInTextLayer(e);const r=this.#Oi;if(!r||0===r.length)return;const a=(0,n.binarySearchFirstItem)(r,(t=>s.#Bi(e,t)<0)),o=Math.max(0,a-1);this.#Ui(i,r[o]),this.#Ni.set(i,o)}moveElementInDOM(e,t,i,r){if(this.addPointerInTextLayer(i,r),!e.hasChildNodes())return void e.append(t);const a=Array.from(e.childNodes).filter((e=>e!==t));if(0===a.length)return;const o=i||t,l=(0,n.binarySearchFirstItem)(a,(e=>s.#Bi(o,e)<0));0===l?a[0].before(t):a[l-1].after(t)}}t.TextAccessibilityManager=s},(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TextHighlighter=void 0,t.TextHighlighter=class{constructor({findController:e,eventBus:t,pageIndex:i}){this.findController=e,this.matches=[],this.eventBus=t,this.pageIdx=i,this._onUpdateTextLayerMatches=null,this.textDivs=null,this.textContentItemsStr=null,this.enabled=!1}setTextMapping(e,t){this.textDivs=e,this.textContentItemsStr=t}enable(){if(!this.textDivs||!this.textContentItemsStr)throw new Error("Text divs and strings have not been set.");if(this.enabled)throw new Error("TextHighlighter is already enabled.");this.enabled=!0,this._onUpdateTextLayerMatches||(this._onUpdateTextLayerMatches=e=>{e.pageIndex!==this.pageIdx&&-1!==e.pageIndex||this._updateMatches()},this.eventBus._on("updatetextlayermatches",this._onUpdateTextLayerMatches)),this._updateMatches()}disable(){this.enabled&&(this.enabled=!1,this._onUpdateTextLayerMatches&&(this.eventBus._off("updatetextlayermatches",this._onUpdateTextLayerMatches),this._onUpdateTextLayerMatches=null),this._updateMatches(!0))}_convertMatches(e,t){if(!e)return[];const{textContentItemsStr:i}=this;let n=0,s=0;const r=i.length-1,a=[];for(let o=0,l=e.length;o<l;o++){let l=e[o];for(;n!==r&&l>=s+i[n].length;)s+=i[n].length,n++;n===i.length&&console.error("Could not find a matching mapping");const c={begin:{divIdx:n,offset:l-s}};for(l+=t[o];n!==r&&l>s+i[n].length;)s+=i[n].length,n++;c.end={divIdx:n,offset:l-s},a.push(c)}return a}_renderMatches(e){if(0===e.length)return;const{findController:t,pageIdx:i}=this,{textContentItemsStr:n,textDivs:s}=this,r=i===t.selected.pageIdx,a=t.selected.matchIdx;let o=null;const l={divIdx:-1,offset:void 0};function c(e,t){const i=e.divIdx;return s[i].textContent="",h(i,0,e.offset,t)}function h(e,t,i,r){let a=s[e];if(a.nodeType===Node.TEXT_NODE){const t=document.createElement("span");a.before(t),t.append(a),s[e]=t,a=t}const o=n[e].substring(t,i),l=document.createTextNode(o);if(r){const e=document.createElement("span");return e.className=`${r} appended`,e.append(l),a.append(e),r.includes("selected")?e.offsetLeft:0}return a.append(l),0}let d=a,u=d+1;if(t.state.highlightAll)d=0,u=e.length;else if(!r)return;for(let n=d;n<u;n++){const d=e[n],u=d.begin,p=d.end,g=r&&n===a,f=g?" selected":"";let m=0;if(o&&u.divIdx===o.divIdx?h(o.divIdx,o.offset,u.offset):(null!==o&&h(o.divIdx,o.offset,l.offset),c(u)),u.divIdx===p.divIdx)m=h(u.divIdx,u.offset,p.offset,"highlight"+f);else{m=h(u.divIdx,u.offset,l.offset,"highlight begin"+f);for(let e=u.divIdx+1,t=p.divIdx;e<t;e++)s[e].className="highlight middle"+f;c(p,"highlight end"+f)}o=p,g&&t.scrollMatchIntoView({element:s[u.divIdx],selectedLeft:m,pageIndex:i,matchIndex:a})}o&&h(o.divIdx,o.offset,l.offset)}_updateMatches(e=!1){if(!this.enabled&&!e)return;const{findController:t,matches:i,pageIdx:n}=this,{textContentItemsStr:s,textDivs:r}=this;let a=-1;for(const e of i){for(let t=Math.max(a,e.begin.divIdx),i=e.end.divIdx;t<=i;t++){const e=r[t];e.textContent=s[t],e.className=""}a=e.end.divIdx+1}if(!t?.highlightMatches||e)return;const o=t.pageMatches[n]||null,l=t.pageMatchesLength[n]||null;this.matches=this._convertMatches(o,l),this._renderMatches(this.matches)}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TextLayerBuilder=void 0;var n=i(4);t.TextLayerBuilder=class{#ji=0;#Hi=0;#Wi=null;constructor({highlighter:e=null,accessibilityManager:t=null,isOffscreenCanvasSupported:i=!0}){this.textContentItemsStr=[],this.renderingDone=!1,this.textDivs=[],this.textDivProperties=new WeakMap,this.textLayerRenderTask=null,this.highlighter=e,this.accessibilityManager=t,this.isOffscreenCanvasSupported=i,this.div=document.createElement("div"),this.div.className="textLayer",this.hide()}#Gi(){this.renderingDone=!0;const e=document.createElement("div");e.className="endOfContent",this.div.append(e),this.#zi()}get numTextDivs(){return this.textDivs.length}async render(e){if(!this.#Wi)throw new Error('No "textContentSource" parameter specified.');const t=e.scale*(globalThis.devicePixelRatio||1),{rotation:i}=e;if(this.renderingDone){const s=i!==this.#ji,r=t!==this.#Hi;return(s||r)&&(this.hide(),(0,n.updateTextLayer)({container:this.div,viewport:e,textDivs:this.textDivs,textDivProperties:this.textDivProperties,isOffscreenCanvasSupported:this.isOffscreenCanvasSupported,mustRescale:r,mustRotate:s}),this.#Hi=t,this.#ji=i),void this.show()}this.cancel(),this.highlighter?.setTextMapping(this.textDivs,this.textContentItemsStr),this.accessibilityManager?.setTextMapping(this.textDivs),this.textLayerRenderTask=(0,n.renderTextLayer)({textContentSource:this.#Wi,container:this.div,viewport:e,textDivs:this.textDivs,textDivProperties:this.textDivProperties,textContentItemsStr:this.textContentItemsStr,isOffscreenCanvasSupported:this.isOffscreenCanvasSupported}),await this.textLayerRenderTask.promise,this.#Gi(),this.#Hi=t,this.#ji=i,this.show(),this.accessibilityManager?.enable()}hide(){this.div.hidden||(this.highlighter?.disable(),this.div.hidden=!0)}show(){this.div.hidden&&this.renderingDone&&(this.div.hidden=!1,this.highlighter?.enable())}cancel(){this.textLayerRenderTask&&(this.textLayerRenderTask.cancel(),this.textLayerRenderTask=null),this.highlighter?.disable(),this.accessibilityManager?.disable(),this.textContentItemsStr.length=0,this.textDivs.length=0,this.textDivProperties=new WeakMap}setTextContentSource(e){this.cancel(),this.#Wi=e}#zi(){const{div:e}=this;e.addEventListener("mousedown",(t=>{const i=e.querySelector(".endOfContent");if(!i)return;let n=t.target!==e;if(n&&="none"!==getComputedStyle(i).getPropertyValue("-moz-user-select"),n){const n=e.getBoundingClientRect(),s=Math.max(0,(t.pageY-n.top)/n.height);i.style.top=(100*s).toFixed(2)+"%"}i.classList.add("active")})),e.addEventListener("mouseup",(()=>{const t=e.querySelector(".endOfContent");t&&(t.style.top="",t.classList.remove("active"))}))}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.XfaLayerBuilder=void 0;var n=i(4);t.XfaLayerBuilder=class{constructor({pageDiv:e,pdfPage:t,annotationStorage:i=null,linkService:n,xfaHtml:s=null}){this.pageDiv=e,this.pdfPage=t,this.annotationStorage=i,this.linkService=n,this.xfaHtml=s,this.div=null,this._cancelled=!1}async render(e,t="display"){if("print"===t){const i={viewport:e.clone({dontFlip:!0}),div:this.div,xfaHtml:this.xfaHtml,annotationStorage:this.annotationStorage,linkService:this.linkService,intent:t},s=document.createElement("div");return this.pageDiv.append(s),i.div=s,n.XfaLayer.render(i)}const i=await this.pdfPage.getXfa();if(this._cancelled||!i)return{textDivs:[]};const s={viewport:e.clone({dontFlip:!0}),div:this.div,xfaHtml:i,annotationStorage:this.annotationStorage,linkService:this.linkService,intent:t};return this.div?n.XfaLayer.update(s):(this.div=document.createElement("div"),this.pageDiv.append(this.div),s.div=this.div,n.XfaLayer.render(s))}cancel(){this._cancelled=!0}hide(){this.div&&(this.div.hidden=!0)}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PDFScriptingManager=void 0;var n=i(2),s=i(4);t.PDFScriptingManager=class{constructor({eventBus:e,sandboxBundleSrc:t=null,scriptingFactory:i=null,docPropertiesLookup:n=null}){this._pdfDocument=null,this._pdfViewer=null,this._closeCapability=null,this._destroyCapability=null,this._scripting=null,this._ready=!1,this._eventBus=e,this._sandboxBundleSrc=t,this._scriptingFactory=i,this._docPropertiesLookup=n,this._scriptingFactory||window.addEventListener("updatefromsandbox",(e=>{this._eventBus.dispatch("updatefromsandbox",{source:window,detail:e.detail})}))}setViewer(e){this._pdfViewer=e}async setDocument(e){if(this._pdfDocument&&await this._destroyScripting(),this._pdfDocument=e,!e)return;const[t,i,n]=await Promise.all([e.getFieldObjects(),e.getCalculationOrderIds(),e.getJSActions()]);if(t||n){if(e===this._pdfDocument){try{this._scripting=this._createScripting()}catch(e){return console.error(`PDFScriptingManager.setDocument: "${e?.message}".`),void await this._destroyScripting()}this._internalEvents.set("updatefromsandbox",(e=>{e?.source===window&&this._updateFromSandbox(e.detail)})),this._internalEvents.set("dispatcheventinsandbox",(e=>{this._scripting?.dispatchEventInSandbox(e.detail)})),this._internalEvents.set("pagechanging",(({pageNumber:e,previous:t})=>{e!==t&&(this._dispatchPageClose(t),this._dispatchPageOpen(e))})),this._internalEvents.set("pagerendered",(({pageNumber:e})=>{this._pageOpenPending.has(e)&&e===this._pdfViewer.currentPageNumber&&this._dispatchPageOpen(e)})),this._internalEvents.set("pagesdestroy",(async e=>{await this._dispatchPageClose(this._pdfViewer.currentPageNumber),await(this._scripting?.dispatchEventInSandbox({id:"doc",name:"WillClose"})),this._closeCapability?.resolve()}));for(const[e,t]of this._internalEvents)this._eventBus._on(e,t);try{const s=await this._getDocProperties();if(e!==this._pdfDocument)return;await this._scripting.createSandbox({objects:t,calculationOrder:i,appInfo:{platform:navigator.platform,language:navigator.language},docInfo:{...s,actions:n}}),this._eventBus.dispatch("sandboxcreated",{source:this})}catch(e){return console.error(`PDFScriptingManager.setDocument: "${e?.message}".`),void await this._destroyScripting()}await(this._scripting?.dispatchEventInSandbox({id:"doc",name:"Open"})),await this._dispatchPageOpen(this._pdfViewer.currentPageNumber,!0),Promise.resolve().then((()=>{e===this._pdfDocument&&(this._ready=!0)}))}}else await this._destroyScripting()}async dispatchWillSave(e){return this._scripting?.dispatchEventInSandbox({id:"doc",name:"WillSave"})}async dispatchDidSave(e){return this._scripting?.dispatchEventInSandbox({id:"doc",name:"DidSave"})}async dispatchWillPrint(e){return this._scripting?.dispatchEventInSandbox({id:"doc",name:"WillPrint"})}async dispatchDidPrint(e){return this._scripting?.dispatchEventInSandbox({id:"doc",name:"DidPrint"})}get destroyPromise(){return this._destroyCapability?.promise||null}get ready(){return this._ready}get _internalEvents(){return(0,s.shadow)(this,"_internalEvents",new Map)}get _pageOpenPending(){return(0,s.shadow)(this,"_pageOpenPending",new Set)}get _visitedPages(){return(0,s.shadow)(this,"_visitedPages",new Map)}async _updateFromSandbox(e){const t=this._pdfViewer.isInPresentationMode||this._pdfViewer.isChangingPresentationMode,{id:i,siblings:s,command:r,value:a}=e;if(!i){switch(r){case"clear":console.clear();break;case"error":console.error(a);break;case"layout":{if(t)return;const e=(0,n.apiPageLayoutToViewerModes)(a);this._pdfViewer.spreadMode=e.spreadMode;break}case"page-num":this._pdfViewer.currentPageNumber=a+1;break;case"print":await this._pdfViewer.pagesPromise,this._eventBus.dispatch("print",{source:this});break;case"println":console.log(a);break;case"zoom":if(t)return;this._pdfViewer.currentScaleValue=a;break;case"SaveAs":this._eventBus.dispatch("download",{source:this});break;case"FirstPage":this._pdfViewer.currentPageNumber=1;break;case"LastPage":this._pdfViewer.currentPageNumber=this._pdfViewer.pagesCount;break;case"NextPage":this._pdfViewer.nextPage();break;case"PrevPage":this._pdfViewer.previousPage();break;case"ZoomViewIn":if(t)return;this._pdfViewer.increaseScale();break;case"ZoomViewOut":if(t)return;this._pdfViewer.decreaseScale()}return}if(t&&e.focus)return;delete e.id,delete e.siblings;const o=s?[i,...s]:[i];for(const t of o){const i=document.querySelector(`[data-element-id="${t}"]`);i?i.dispatchEvent(new CustomEvent("updatefromsandbox",{detail:e})):this._pdfDocument?.annotationStorage.setValue(t,e)}}async _dispatchPageOpen(e,t=!1){const i=this._pdfDocument,r=this._visitedPages;if(t&&(this._closeCapability=(0,s.createPromiseCapability)()),!this._closeCapability)return;const a=this._pdfViewer.getPageView(e-1);if(a?.renderingState!==n.RenderingStates.FINISHED)return void this._pageOpenPending.add(e);this._pageOpenPending.delete(e);const o=(async()=>{const t=await(r.has(e)?null:a.pdfPage?.getJSActions());i===this._pdfDocument&&await(this._scripting?.dispatchEventInSandbox({id:"page",name:"PageOpen",pageNumber:e,actions:t}))})();r.set(e,o)}async _dispatchPageClose(e){const t=this._pdfDocument,i=this._visitedPages;if(!this._closeCapability)return;if(this._pageOpenPending.has(e))return;const n=i.get(e);n&&(i.set(e,null),await n,t===this._pdfDocument&&await(this._scripting?.dispatchEventInSandbox({id:"page",name:"PageClose",pageNumber:e})))}async _getDocProperties(){if(this._docPropertiesLookup)return this._docPropertiesLookup(this._pdfDocument);const{docPropertiesLookup:e}=i(22);return e(this._pdfDocument)}_createScripting(){if(this._destroyCapability=(0,s.createPromiseCapability)(),this._scripting)throw new Error("_createScripting: Scripting already exists.");if(this._scriptingFactory)return this._scriptingFactory.createScripting({sandboxBundleSrc:this._sandboxBundleSrc});const{GenericScripting:e}=i(22);return new e(this._sandboxBundleSrc)}async _destroyScripting(){if(!this._scripting)return this._pdfDocument=null,void this._destroyCapability?.resolve();this._closeCapability&&(await Promise.race([this._closeCapability.promise,new Promise((e=>{setTimeout(e,1e3)}))]).catch((e=>{})),this._closeCapability=null),this._pdfDocument=null;try{await this._scripting.destroySandbox()}catch(e){}for(const[e,t]of this._internalEvents)this._eventBus._off(e,t);this._internalEvents.clear(),this._pageOpenPending.clear(),this._visitedPages.clear(),this._scripting=null,this._ready=!1,this._destroyCapability?.resolve()}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.GenericScripting=void 0,t.docPropertiesLookup=async function(e){const t="".split("#")[0];let{info:i,metadata:s,contentDispositionFilename:r,contentLength:a}=await e.getMetadata();if(!a){const{length:t}=await e.getDownloadInfo();a=t}return{...i,baseURL:t,filesize:a,filename:r||(0,n.getPdfFilenameFromUrl)(""),metadata:s?.getRaw(),authors:s?.get("dc:creator"),numPages:e.numPages,URL:""}};var n=i(4);t.GenericScripting=class{constructor(e){this._ready=(0,n.loadScript)(e,!0).then((()=>window.pdfjsSandbox.QuickJSSandbox()))}async createSandbox(e){(await this._ready).create(e)}async dispatchEventInSandbox(e){const t=await this._ready;setTimeout((()=>t.dispatchEvent(e)),0)}async destroySandbox(){(await this._ready).nukeSandbox()}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PDFSinglePageViewer=void 0;var n=i(2),s=i(24);class r extends s.PDFViewer{_resetView(){super._resetView(),this._scrollMode=n.ScrollMode.PAGE,this._spreadMode=n.SpreadMode.NONE}set scrollMode(e){}_updateScrollMode(){}set spreadMode(e){}_updateSpreadMode(){}}t.PDFSinglePageViewer=r},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PagesCountLimit=t.PDFViewer=t.PDFPageViewBuffer=void 0;var n=i(4),s=i(2),r=i(5),a=i(13),o=i(25),l=i(1);const c="enablePermissions",h={FORCE_SCROLL_MODE_PAGE:15e3,FORCE_LAZY_PAGE_INIT:7500,PAUSE_EAGER_PAGE_INIT:250};function d(e){return Object.values(n.AnnotationEditorType).includes(e)&&e!==n.AnnotationEditorType.DISABLE}t.PagesCountLimit=h;class u{#qi=new Set;#$i=0;constructor(e){this.#$i=e}push(e){const t=this.#qi;t.has(e)&&t.delete(e),t.add(e),t.size>this.#$i&&this.#Xi()}resize(e,t=null){this.#$i=e;const i=this.#qi;if(t){const e=i.size;let n=1;for(const s of i)if(t.has(s.id)&&(i.delete(s),i.add(s)),++n>e)break}for(;i.size>this.#$i;)this.#Xi()}has(e){return this.#qi.has(e)}[Symbol.iterator](){return this.#qi.keys()}#Xi(){const e=this.#qi.keys().next().value;e?.destroy(),this.#qi.delete(e)}}t.PDFPageViewBuffer=u,t.PDFViewer=class{#Ki=null;#Yi=n.AnnotationEditorType.NONE;#Qi=null;#bi=n.AnnotationMode.ENABLE_FORMS;#Ji=null;#Zi=!1;#en=0;#tn=new ResizeObserver(this.#in.bind(this));#nn=null;#sn=null;#rn=null;constructor(e){const t="3.5.141";if(n.version!==t)throw new Error(`The API version "${n.version}" does not match the Viewer version "${t}".`);if(this.container=e.container,this.viewer=e.viewer||e.container.firstElementChild,"DIV"!==this.container?.tagName||"DIV"!==this.viewer?.tagName)throw new Error("Invalid `container` and/or `viewer` option.");if(this.container.offsetParent&&"absolute"!==getComputedStyle(this.container).position)throw new Error("The `container` must be absolutely positioned.");this.#tn.observe(this.container),this.eventBus=e.eventBus,this.linkService=e.linkService||new l.SimpleLinkService,this.downloadManager=e.downloadManager||null,this.findController=e.findController||null,this._scriptingManager=e.scriptingManager||null,this.textLayerMode=e.textLayerMode??s.TextLayerMode.ENABLE,this.#bi=e.annotationMode??n.AnnotationMode.ENABLE_FORMS,this.#Yi=e.annotationEditorMode??n.AnnotationEditorType.NONE,this.imageResourcesPath=e.imageResourcesPath||"",this.enablePrintAutoRotate=e.enablePrintAutoRotate||!1,this.removePageBorders=e.removePageBorders||!1,this.renderer=e.renderer||s.RendererType.CANVAS,this.useOnlyCssZoom=e.useOnlyCssZoom||!1,this.isOffscreenCanvasSupported=e.isOffscreenCanvasSupported??!0,this.maxCanvasPixels=e.maxCanvasPixels,this.l10n=e.l10n||r.NullL10n,this.#Zi=e.enablePermissions||!1,this.pageColors=e.pageColors||null,!this.pageColors||CSS.supports("color",this.pageColors.background)&&CSS.supports("color",this.pageColors.foreground)||((this.pageColors.background||this.pageColors.foreground)&&console.warn("PDFViewer: Ignoring `pageColors`-option, since the browser doesn't support the values used."),this.pageColors=null),this.defaultRenderingQueue=!e.renderingQueue,this.defaultRenderingQueue?(this.renderingQueue=new o.PDFRenderingQueue,this.renderingQueue.setViewer(this)):this.renderingQueue=e.renderingQueue,this.scroll=(0,s.watchScroll)(this.container,this._scrollUpdate.bind(this)),this.presentationModeState=s.PresentationModeState.UNKNOWN,this._onBeforeDraw=this._onAfterDraw=null,this._resetView(),this.removePageBorders&&this.viewer.classList.add("removePageBorders"),this.#an()}get pagesCount(){return this._pages.length}getPageView(e){return this._pages[e]}get pageViewsReady(){return!!this._pagesCapability.settled&&this._pages.every((function(e){return e?.pdfPage}))}get renderForms(){return this.#bi===n.AnnotationMode.ENABLE_FORMS}get enableScripting(){return!!this._scriptingManager}get currentPageNumber(){return this._currentPageNumber}set currentPageNumber(e){if(!Number.isInteger(e))throw new Error("Invalid page number.");this.pdfDocument&&(this._setCurrentPageNumber(e,!0)||console.error(`currentPageNumber: "${e}" is not a valid page.`))}_setCurrentPageNumber(e,t=!1){if(this._currentPageNumber===e)return t&&this.#on(),!0;if(!(0<e&&e<=this.pagesCount))return!1;const i=this._currentPageNumber;return this._currentPageNumber=e,this.eventBus.dispatch("pagechanging",{source:this,pageNumber:e,pageLabel:this._pageLabels?.[e-1]??null,previous:i}),t&&this.#on(),!0}get currentPageLabel(){return this._pageLabels?.[this._currentPageNumber-1]??null}set currentPageLabel(e){if(!this.pdfDocument)return;let t=0|e;if(this._pageLabels){const i=this._pageLabels.indexOf(e);i>=0&&(t=i+1)}this._setCurrentPageNumber(t,!0)||console.error(`currentPageLabel: "${e}" is not a valid page.`)}get currentScale(){return this._currentScale!==s.UNKNOWN_SCALE?this._currentScale:s.DEFAULT_SCALE}set currentScale(e){if(isNaN(e))throw new Error("Invalid numeric scale.");this.pdfDocument&&this.#ln(e,{noScroll:!1})}get currentScaleValue(){return this._currentScaleValue}set currentScaleValue(e){this.pdfDocument&&this.#ln(e,{noScroll:!1})}get pagesRotation(){return this._pagesRotation}set pagesRotation(e){if(!(0,s.isValidRotation)(e))throw new Error("Invalid pages rotation angle.");if(!this.pdfDocument)return;if((e%=360)<0&&(e+=360),this._pagesRotation===e)return;this._pagesRotation=e;const t=this._currentPageNumber;this.refresh(!0,{rotation:e}),this._currentScaleValue&&this.#ln(this._currentScaleValue,{noScroll:!0}),this.eventBus.dispatch("rotationchanging",{source:this,pagesRotation:e,pageNumber:t}),this.defaultRenderingQueue&&this.update()}get firstPagePromise(){return this.pdfDocument?this._firstPageCapability.promise:null}get onePageRendered(){return this.pdfDocument?this._onePageRenderedCapability.promise:null}get pagesPromise(){return this.pdfDocument?this._pagesCapability.promise:null}#yi(){const e=this;return{get annotationEditorUIManager(){return e.#Qi},get annotationStorage(){return e.pdfDocument?.annotationStorage},get downloadManager(){return e.downloadManager},get enableScripting(){return!!e._scriptingManager},get fieldObjectsPromise(){return e.pdfDocument?.getFieldObjects()},get findController(){return e.findController},get hasJSActionsPromise(){return e.pdfDocument?.hasJSActions()},get linkService(){return e.linkService}}}#cn(e){const t={annotationEditorMode:this.#Yi,annotationMode:this.#bi,textLayerMode:this.textLayerMode};return e?(e.includes(n.PermissionFlag.COPY)||this.viewer.classList.add(c),e.includes(n.PermissionFlag.MODIFY_CONTENTS)||(t.annotationEditorMode=n.AnnotationEditorType.DISABLE),e.includes(n.PermissionFlag.MODIFY_ANNOTATIONS)||e.includes(n.PermissionFlag.FILL_INTERACTIVE_FORMS)||this.#bi!==n.AnnotationMode.ENABLE_FORMS||(t.annotationMode=n.AnnotationMode.ENABLE),t):t}#hn(){if("hidden"===document.visibilityState||!this.container.offsetParent||0===this._getVisiblePages().views.length)return Promise.resolve();const e=new Promise((e=>{this.#sn=()=>{"hidden"===document.visibilityState&&(e(),document.removeEventListener("visibilitychange",this.#sn),this.#sn=null)},document.addEventListener("visibilitychange",this.#sn)}));return Promise.race([this._onePageRenderedCapability.promise,e])}setDocument(e){if(this.pdfDocument&&(this.eventBus.dispatch("pagesdestroy",{source:this}),this._cancelRendering(),this._resetView(),this.findController?.setDocument(null),this._scriptingManager?.setDocument(null),this.#Qi&&(this.#Qi.destroy(),this.#Qi=null)),this.pdfDocument=e,!e)return;const t=e.numPages,i=e.getPage(1),r=e.getOptionalContentConfig(),o=this.#Zi?e.getPermissions():Promise.resolve();if(t>h.FORCE_SCROLL_MODE_PAGE){console.warn("Forcing PAGE-scrolling for performance reasons, given the length of the document.");const e=this._scrollMode=s.ScrollMode.PAGE;this.eventBus.dispatch("scrollmodechanged",{source:this,mode:e})}this._pagesCapability.promise.then((()=>{this.eventBus.dispatch("pagesloaded",{source:this,pagesCount:t})}),(()=>{})),this._onBeforeDraw=e=>{const t=this._pages[e.pageNumber-1];t&&this.#Ki.push(t)},this.eventBus._on("pagerender",this._onBeforeDraw),this._onAfterDraw=e=>{e.cssTransform||this._onePageRenderedCapability.settled||(this._onePageRenderedCapability.resolve({timestamp:e.timestamp}),this.eventBus._off("pagerendered",this._onAfterDraw),this._onAfterDraw=null,this.#sn&&(document.removeEventListener("visibilitychange",this.#sn),this.#sn=null))},this.eventBus._on("pagerendered",this._onAfterDraw),Promise.all([i,o]).then((([i,o])=>{if(e!==this.pdfDocument)return;this._firstPageCapability.resolve(i),this._optionalContentConfigPromise=r;const{annotationEditorMode:l,annotationMode:c,textLayerMode:u}=this.#cn(o);if(l!==n.AnnotationEditorType.DISABLE){const t=l;e.isPureXfa?console.warn("Warning: XFA-editing is not implemented."):d(t)?(this.#Qi=new n.AnnotationEditorUIManager(this.container,this.eventBus,e?.annotationStorage),t!==n.AnnotationEditorType.NONE&&this.#Qi.updateMode(t)):console.error(`Invalid AnnotationEditor mode: ${t}`)}const p=this.#yi.bind(this),g=this._scrollMode===s.ScrollMode.PAGE?null:this.viewer,f=this.currentScale,m=i.getViewport({scale:f*n.PixelsPerInch.PDF_TO_CSS_UNITS});this.viewer.style.setProperty("--scale-factor",m.scale);for(let e=1;e<=t;++e){const t=new a.PDFPageView({container:g,eventBus:this.eventBus,id:e,scale:f,defaultViewport:m.clone(),optionalContentConfigPromise:r,renderingQueue:this.renderingQueue,textLayerMode:u,annotationMode:c,imageResourcesPath:this.imageResourcesPath,renderer:this.renderer,useOnlyCssZoom:this.useOnlyCssZoom,isOffscreenCanvasSupported:this.isOffscreenCanvasSupported,maxCanvasPixels:this.maxCanvasPixels,pageColors:this.pageColors,l10n:this.l10n,layerProperties:p});this._pages.push(t)}const _=this._pages[0];_&&(_.setPdfPage(i),this.linkService.cachePageRef(1,i.ref)),this._scrollMode===s.ScrollMode.PAGE?this.#dn():this._spreadMode!==s.SpreadMode.NONE&&this._updateSpreadMode(),this.#hn().then((async()=>{if(this.findController?.setDocument(e),this._scriptingManager?.setDocument(e),this.#Qi&&this.eventBus.dispatch("annotationeditormodechanged",{source:this,mode:this.#Yi}),e.loadingParams.disableAutoFetch||t>h.FORCE_LAZY_PAGE_INIT)return void this._pagesCapability.resolve();let i=t-1;if(i<=0)this._pagesCapability.resolve();else for(let n=2;n<=t;++n){const t=e.getPage(n).then((e=>{const t=this._pages[n-1];t.pdfPage||t.setPdfPage(e),this.linkService.cachePageRef(n,e.ref),0==--i&&this._pagesCapability.resolve()}),(e=>{console.error(`Unable to get page ${n} to initialize viewer`,e),0==--i&&this._pagesCapability.resolve()}));n%h.PAUSE_EAGER_PAGE_INIT==0&&await t}})),this.eventBus.dispatch("pagesinit",{source:this}),e.getMetadata().then((({info:t})=>{e===this.pdfDocument&&t.Language&&(this.viewer.lang=t.Language)})),this.defaultRenderingQueue&&this.update()})).catch((e=>{console.error("Unable to initialize viewer",e),this._pagesCapability.reject(e)}))}setPageLabels(e){if(this.pdfDocument){e?Array.isArray(e)&&this.pdfDocument.numPages===e.length?this._pageLabels=e:(this._pageLabels=null,console.error("setPageLabels: Invalid page labels.")):this._pageLabels=null;for(let e=0,t=this._pages.length;e<t;e++)this._pages[e].setPageLabel(this._pageLabels?.[e]??null)}}_resetView(){this._pages=[],this._currentPageNumber=1,this._currentScale=s.UNKNOWN_SCALE,this._currentScaleValue=null,this._pageLabels=null,this.#Ki=new u(10),this._location=null,this._pagesRotation=0,this._optionalContentConfigPromise=null,this._firstPageCapability=(0,n.createPromiseCapability)(),this._onePageRenderedCapability=(0,n.createPromiseCapability)(),this._pagesCapability=(0,n.createPromiseCapability)(),this._scrollMode=s.ScrollMode.VERTICAL,this._previousScrollMode=s.ScrollMode.UNKNOWN,this._spreadMode=s.SpreadMode.NONE,this.#nn={previousPageNumber:1,scrollDown:!0,pages:[]},this._onBeforeDraw&&(this.eventBus._off("pagerender",this._onBeforeDraw),this._onBeforeDraw=null),this._onAfterDraw&&(this.eventBus._off("pagerendered",this._onAfterDraw),this._onAfterDraw=null),this.#sn&&(document.removeEventListener("visibilitychange",this.#sn),this.#sn=null),this.viewer.textContent="",this._updateScrollMode(),this.viewer.removeAttribute("lang"),this.viewer.classList.remove(c)}#dn(){if(this._scrollMode!==s.ScrollMode.PAGE)throw new Error("#ensurePageViewVisible: Invalid scrollMode value.");const e=this._currentPageNumber,t=this.#nn,i=this.viewer;if(i.textContent="",t.pages.length=0,this._spreadMode!==s.SpreadMode.NONE||this.isInPresentationMode){const n=new Set,s=this._spreadMode-1;-1===s?n.add(e-1):e%2!==s?(n.add(e-1),n.add(e)):(n.add(e-2),n.add(e-1));const r=document.createElement("div");if(r.className="spread",this.isInPresentationMode){const e=document.createElement("div");e.className="dummyPage",r.append(e)}for(const e of n){const i=this._pages[e];i&&(r.append(i.div),t.pages.push(i))}i.append(r)}else{const n=this._pages[e-1];i.append(n.div),t.pages.push(n)}t.scrollDown=e>=t.previousPageNumber,t.previousPageNumber=e}_scrollUpdate(){0!==this.pagesCount&&this.update()}#un(e,t=null){const{div:i,id:n}=e;if(this._currentPageNumber!==n&&this._setCurrentPageNumber(n),this._scrollMode===s.ScrollMode.PAGE&&(this.#dn(),this.update()),!t&&!this.isInPresentationMode){const e=i.offsetLeft+i.clientLeft,n=e+i.clientWidth,{scrollLeft:r,clientWidth:a}=this.container;(this._scrollMode===s.ScrollMode.HORIZONTAL||e<r||n>r+a)&&(t={left:0,top:0})}(0,s.scrollIntoView)(i,t),!this._currentScaleValue&&this._location&&(this._location=null)}#pn(e){return e===this._currentScale||Math.abs(e-this._currentScale)<1e-15}#gn(e,t,{noScroll:i=!1,preset:s=!1,drawingDelay:r=-1}){if(this._currentScaleValue=t.toString(),this.#pn(e))return void(s&&this.eventBus.dispatch("scalechanging",{source:this,scale:e,presetValue:t}));this.viewer.style.setProperty("--scale-factor",e*n.PixelsPerInch.PDF_TO_CSS_UNITS);const a=r>=0&&r<1e3;if(this.refresh(!0,{scale:e,drawingDelay:a?r:-1}),a&&(this.#rn=setTimeout((()=>{this.#rn=null,this.refresh()}),r)),this._currentScale=e,!i){let e,t=this._currentPageNumber;!this._location||this.isInPresentationMode||this.isChangingPresentationMode||(t=this._location.pageNumber,e=[null,{name:"XYZ"},this._location.left,this._location.top,null]),this.scrollPageIntoView({pageNumber:t,destArray:e,allowNegativeOffset:!0})}this.eventBus.dispatch("scalechanging",{source:this,scale:e,presetValue:s?t:void 0}),this.defaultRenderingQueue&&this.update()}get#fn(){return this._spreadMode!==s.SpreadMode.NONE&&this._scrollMode!==s.ScrollMode.HORIZONTAL?2:1}#ln(e,t){let i=parseFloat(e);if(i>0)t.preset=!1,this.#gn(i,e,t);else{const n=this._pages[this._currentPageNumber-1];if(!n)return;let r=s.SCROLLBAR_PADDING,a=s.VERTICAL_PADDING;this.isInPresentationMode?(r=a=4,this._spreadMode!==s.SpreadMode.NONE&&(r*=2)):this.removePageBorders?r=a=0:this._scrollMode===s.ScrollMode.HORIZONTAL&&([r,a]=[a,r]);const o=(this.container.clientWidth-r)/n.width*n.scale/this.#fn,l=(this.container.clientHeight-a)/n.height*n.scale;switch(e){case"page-actual":i=1;break;case"page-width":i=o;break;case"page-height":i=l;break;case"page-fit":i=Math.min(o,l);break;case"auto":const t=(0,s.isPortraitOrientation)(n)?o:Math.min(l,o);i=Math.min(s.MAX_AUTO_SCALE,t);break;default:return void console.error(`#setScale: "${e}" is an unknown zoom value.`)}t.preset=!0,this.#gn(i,e,t)}}#on(){const e=this._pages[this._currentPageNumber-1];this.isInPresentationMode&&this.#ln(this._currentScaleValue,{noScroll:!0}),this.#un(e)}pageLabelToPageNumber(e){if(!this._pageLabels)return null;const t=this._pageLabels.indexOf(e);return t<0?null:t+1}scrollPageIntoView({pageNumber:e,destArray:t=null,allowNegativeOffset:i=!1,ignoreDestinationZoom:r=!1}){if(!this.pdfDocument)return;const a=Number.isInteger(e)&&this._pages[e-1];if(!a)return void console.error(`scrollPageIntoView: "${e}" is not a valid pageNumber parameter.`);if(this.isInPresentationMode||!t)return void this._setCurrentPageNumber(e,!0);let o,l,c=0,h=0,d=0,u=0;const p=a.rotation%180!=0,g=(p?a.height:a.width)/a.scale/n.PixelsPerInch.PDF_TO_CSS_UNITS,f=(p?a.width:a.height)/a.scale/n.PixelsPerInch.PDF_TO_CSS_UNITS;let m=0;switch(t[1].name){case"XYZ":c=t[2],h=t[3],m=t[4],c=null!==c?c:0,h=null!==h?h:f;break;case"Fit":case"FitB":m="page-fit";break;case"FitH":case"FitBH":h=t[2],m="page-width",null===h&&this._location?(c=this._location.left,h=this._location.top):("number"!=typeof h||h<0)&&(h=f);break;case"FitV":case"FitBV":c=t[2],d=g,u=f,m="page-height";break;case"FitR":c=t[2],h=t[3],d=t[4]-c,u=t[5]-h;let e=s.SCROLLBAR_PADDING,i=s.VERTICAL_PADDING;this.removePageBorders&&(e=i=0),o=(this.container.clientWidth-e)/d/n.PixelsPerInch.PDF_TO_CSS_UNITS,l=(this.container.clientHeight-i)/u/n.PixelsPerInch.PDF_TO_CSS_UNITS,m=Math.min(Math.abs(o),Math.abs(l));break;default:return void console.error(`scrollPageIntoView: "${t[1].name}" is not a valid destination type.`)}if(r||(m&&m!==this._currentScale?this.currentScaleValue=m:this._currentScale===s.UNKNOWN_SCALE&&(this.currentScaleValue=s.DEFAULT_SCALE_VALUE)),"page-fit"===m&&!t[4])return void this.#un(a);const _=[a.viewport.convertToViewportPoint(c,h),a.viewport.convertToViewportPoint(c+d,h+u)];let v=Math.min(_[0][0],_[1][0]),b=Math.min(_[0][1],_[1][1]);i||(v=Math.max(v,0),b=Math.max(b,0)),this.#un(a,{left:v,top:b})}_updateLocation(e){const t=this._currentScale,i=this._currentScaleValue,n=parseFloat(i)===t?Math.round(1e4*t)/100:i,s=e.id,r=this._pages[s-1],a=this.container,o=r.getPagePoint(a.scrollLeft-e.x,a.scrollTop-e.y),l=Math.round(o[0]),c=Math.round(o[1]);let h=`#page=${s}`;this.isInPresentationMode||(h+=`&zoom=${n},${l},${c}`),this._location={pageNumber:s,scale:n,top:c,left:l,rotation:this._pagesRotation,pdfOpenParams:h}}update(){const e=this._getVisiblePages(),t=e.views,i=t.length;if(0===i)return;const n=Math.max(10,2*i+1);this.#Ki.resize(n,e.ids),this.renderingQueue.renderHighestPriority(e);const r=this._spreadMode===s.SpreadMode.NONE&&(this._scrollMode===s.ScrollMode.PAGE||this._scrollMode===s.ScrollMode.VERTICAL),a=this._currentPageNumber;let o=!1;for(const e of t){if(e.percent<100)break;if(e.id===a&&r){o=!0;break}}this._setCurrentPageNumber(o?a:t[0].id),this._updateLocation(e.first),this.eventBus.dispatch("updateviewarea",{source:this,location:this._location})}containsElement(e){return this.container.contains(e)}focus(){this.container.focus()}get _isContainerRtl(){return"rtl"===getComputedStyle(this.container).direction}get isInPresentationMode(){return this.presentationModeState===s.PresentationModeState.FULLSCREEN}get isChangingPresentationMode(){return this.presentationModeState===s.PresentationModeState.CHANGING}get isHorizontalScrollbarEnabled(){return!this.isInPresentationMode&&this.container.scrollWidth>this.container.clientWidth}get isVerticalScrollbarEnabled(){return!this.isInPresentationMode&&this.container.scrollHeight>this.container.clientHeight}_getVisiblePages(){const e=this._scrollMode===s.ScrollMode.PAGE?this.#nn.pages:this._pages,t=this._scrollMode===s.ScrollMode.HORIZONTAL,i=t&&this._isContainerRtl;return(0,s.getVisibleElements)({scrollEl:this.container,views:e,sortByVisibility:!0,horizontal:t,rtl:i})}isPageVisible(e){return!!this.pdfDocument&&(Number.isInteger(e)&&e>0&&e<=this.pagesCount?this._getVisiblePages().ids.has(e):(console.error(`isPageVisible: "${e}" is not a valid page.`),!1))}isPageCached(e){if(!this.pdfDocument)return!1;if(!(Number.isInteger(e)&&e>0&&e<=this.pagesCount))return console.error(`isPageCached: "${e}" is not a valid page.`),!1;const t=this._pages[e-1];return this.#Ki.has(t)}cleanup(){for(const e of this._pages)e.renderingState!==s.RenderingStates.FINISHED&&e.reset()}_cancelRendering(){for(const e of this._pages)e.cancelRendering()}async#mn(e){if(e.pdfPage)return e.pdfPage;try{const t=await this.pdfDocument.getPage(e.id);return e.pdfPage||e.setPdfPage(t),this.linkService._cachedPageNumber?.(t.ref)||this.linkService.cachePageRef(e.id,t.ref),t}catch(e){return console.error("Unable to get page for page view",e),null}}#_n(e){if(1===e.first?.id)return!0;if(e.last?.id===this.pagesCount)return!1;switch(this._scrollMode){case s.ScrollMode.PAGE:return this.#nn.scrollDown;case s.ScrollMode.HORIZONTAL:return this.scroll.right}return this.scroll.down}forceRendering(e){const t=e||this._getVisiblePages(),i=this.#_n(t),n=this._spreadMode!==s.SpreadMode.NONE&&this._scrollMode!==s.ScrollMode.HORIZONTAL,r=this.renderingQueue.getHighestPriority(t,this._pages,i,n);return!!r&&(this.#mn(r).then((()=>{this.renderingQueue.renderView(r)})),!0)}get hasEqualPageSizes(){const e=this._pages[0];for(let t=1,i=this._pages.length;t<i;++t){const i=this._pages[t];if(i.width!==e.width||i.height!==e.height)return!1}return!0}getPagesOverview(){return this._pages.map((e=>{const t=e.pdfPage.getViewport({scale:1});return!this.enablePrintAutoRotate||(0,s.isPortraitOrientation)(t)?{width:t.width,height:t.height,rotation:t.rotation}:{width:t.height,height:t.width,rotation:(t.rotation-90)%360}}))}get optionalContentConfigPromise(){return this.pdfDocument?this._optionalContentConfigPromise?this._optionalContentConfigPromise:(console.error("optionalContentConfigPromise: Not initialized yet."),this.pdfDocument.getOptionalContentConfig()):Promise.resolve(null)}set optionalContentConfigPromise(e){if(!(e instanceof Promise))throw new Error(`Invalid optionalContentConfigPromise: ${e}`);this.pdfDocument&&this._optionalContentConfigPromise&&(this._optionalContentConfigPromise=e,this.refresh(!1,{optionalContentConfigPromise:e}),this.eventBus.dispatch("optionalcontentconfigchanged",{source:this,promise:e}))}get scrollMode(){return this._scrollMode}set scrollMode(e){if(this._scrollMode!==e){if(!(0,s.isValidScrollMode)(e))throw new Error(`Invalid scroll mode: ${e}`);this.pagesCount>h.FORCE_SCROLL_MODE_PAGE||(this._previousScrollMode=this._scrollMode,this._scrollMode=e,this.eventBus.dispatch("scrollmodechanged",{source:this,mode:e}),this._updateScrollMode(this._currentPageNumber))}}_updateScrollMode(e=null){const t=this._scrollMode,i=this.viewer;i.classList.toggle("scrollHorizontal",t===s.ScrollMode.HORIZONTAL),i.classList.toggle("scrollWrapped",t===s.ScrollMode.WRAPPED),this.pdfDocument&&e&&(t===s.ScrollMode.PAGE?this.#dn():this._previousScrollMode===s.ScrollMode.PAGE&&this._updateSpreadMode(),this._currentScaleValue&&isNaN(this._currentScaleValue)&&this.#ln(this._currentScaleValue,{noScroll:!0}),this._setCurrentPageNumber(e,!0),this.update())}get spreadMode(){return this._spreadMode}set spreadMode(e){if(this._spreadMode!==e){if(!(0,s.isValidSpreadMode)(e))throw new Error(`Invalid spread mode: ${e}`);this._spreadMode=e,this.eventBus.dispatch("spreadmodechanged",{source:this,mode:e}),this._updateSpreadMode(this._currentPageNumber)}}_updateSpreadMode(e=null){if(!this.pdfDocument)return;const t=this.viewer,i=this._pages;if(this._scrollMode===s.ScrollMode.PAGE)this.#dn();else if(t.textContent="",this._spreadMode===s.SpreadMode.NONE)for(const e of this._pages)t.append(e.div);else{const e=this._spreadMode-1;let n=null;for(let s=0,r=i.length;s<r;++s)null===n?(n=document.createElement("div"),n.className="spread",t.append(n)):s%2===e&&(n=n.cloneNode(!1),t.append(n)),n.append(i[s].div)}e&&(this._currentScaleValue&&isNaN(this._currentScaleValue)&&this.#ln(this._currentScaleValue,{noScroll:!0}),this._setCurrentPageNumber(e,!0),this.update())}_getPageAdvance(e,t=!1){switch(this._scrollMode){case s.ScrollMode.WRAPPED:{const{views:i}=this._getVisiblePages(),n=new Map;for(const{id:e,y:t,percent:s,widthPercent:r}of i){if(0===s||r<100)continue;let i=n.get(t);i||n.set(t,i||=[]),i.push(e)}for(const i of n.values()){const n=i.indexOf(e);if(-1===n)continue;const s=i.length;if(1===s)break;if(t)for(let t=n-1,s=0;t>=s;t--){const n=i[t],s=i[t+1]-1;if(n<s)return e-s}else for(let t=n+1,r=s;t<r;t++){const n=i[t],s=i[t-1]+1;if(n>s)return s-e}if(t){const t=i[0];if(t<e)return e-t+1}else{const t=i[s-1];if(t>e)return t-e+1}break}break}case s.ScrollMode.HORIZONTAL:break;case s.ScrollMode.PAGE:case s.ScrollMode.VERTICAL:{if(this._spreadMode===s.SpreadMode.NONE)break;const i=this._spreadMode-1;if(t&&e%2!==i)break;if(!t&&e%2===i)break;const{views:n}=this._getVisiblePages(),r=t?e-1:e+1;for(const{id:e,percent:t,widthPercent:i}of n)if(e===r){if(t>0&&100===i)return 2;break}break}}return 1}nextPage(){const e=this._currentPageNumber,t=this.pagesCount;if(e>=t)return!1;const i=this._getPageAdvance(e,!1)||1;return this.currentPageNumber=Math.min(e+i,t),!0}previousPage(){const e=this._currentPageNumber;if(e<=1)return!1;const t=this._getPageAdvance(e,!0)||1;return this.currentPageNumber=Math.max(e-t,1),!0}increaseScale({drawingDelay:e,scaleFactor:t,steps:i}={}){if(!this.pdfDocument)return;let n=this._currentScale;if(t>1)n=Math.round(n*t*100)/100;else{i??=1;do{n=Math.ceil(10*(n*s.DEFAULT_SCALE_DELTA).toFixed(2))/10}while(--i>0&&n<s.MAX_SCALE)}this.#ln(Math.min(s.MAX_SCALE,n),{noScroll:!1,drawingDelay:e})}decreaseScale({drawingDelay:e,scaleFactor:t,steps:i}={}){if(!this.pdfDocument)return;let n=this._currentScale;if(t>0&&t<1)n=Math.round(n*t*100)/100;else{i??=1;do{n=Math.floor(10*(n/s.DEFAULT_SCALE_DELTA).toFixed(2))/10}while(--i>0&&n>s.MIN_SCALE)}this.#ln(Math.max(s.MIN_SCALE,n),{noScroll:!1,drawingDelay:e})}#an(e=this.container.clientHeight){e!==this.#en&&(this.#en=e,s.docStyle.setProperty("--viewer-container-height",`${e}px`))}#in(e){for(const t of e)if(t.target===this.container){this.#an(Math.floor(t.borderBoxSize[0].blockSize)),this.#Ji=null;break}}get containerTopLeft(){return this.#Ji||=[this.container.offsetTop,this.container.offsetLeft]}get annotationEditorMode(){return this.#Qi?this.#Yi:n.AnnotationEditorType.DISABLE}set annotationEditorMode(e){if(!this.#Qi)throw new Error("The AnnotationEditor is not enabled.");if(this.#Yi!==e){if(!d(e))throw new Error(`Invalid AnnotationEditor mode: ${e}`);this.pdfDocument&&(this.#Yi=e,this.eventBus.dispatch("annotationeditormodechanged",{source:this,mode:e}),this.#Qi.updateMode(e))}}set annotationEditorParams({type:e,value:t}){if(!this.#Qi)throw new Error("The AnnotationEditor is not enabled.");this.#Qi.updateParams(e,t)}refresh(e=!1,t=Object.create(null)){if(this.pdfDocument){for(const e of this._pages)e.update(t);null!==this.#rn&&(clearTimeout(this.#rn),this.#rn=null),e||this.update()}}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PDFRenderingQueue=void 0;var n=i(4),s=i(2);t.PDFRenderingQueue=class{constructor(){this.pdfViewer=null,this.pdfThumbnailViewer=null,this.onIdle=null,this.highestPriorityPage=null,this.idleTimeout=null,this.printing=!1,this.isThumbnailViewEnabled=!1}setViewer(e){this.pdfViewer=e}setThumbnailViewer(e){this.pdfThumbnailViewer=e}isHighestPriority(e){return this.highestPriorityPage===e.renderingId}hasViewer(){return!!this.pdfViewer}renderHighestPriority(e){this.idleTimeout&&(clearTimeout(this.idleTimeout),this.idleTimeout=null),this.pdfViewer.forceRendering(e)||this.isThumbnailViewEnabled&&this.pdfThumbnailViewer?.forceRendering()||this.printing||this.onIdle&&(this.idleTimeout=setTimeout(this.onIdle.bind(this),3e4))}getHighestPriority(e,t,i,n=!1){const s=e.views,r=s.length;if(0===r)return null;for(let e=0;e<r;e++){const t=s[e].view;if(!this.isViewFinished(t))return t}const a=e.first.id,o=e.last.id;if(o-a+1>r){const n=e.ids;for(let e=1,s=o-a;e<s;e++){const s=i?a+e:o-e;if(n.has(s))continue;const r=t[s-1];if(!this.isViewFinished(r))return r}}let l=i?o:a-2,c=t[l];return c&&!this.isViewFinished(c)||n&&(l+=i?1:-1,c=t[l],c&&!this.isViewFinished(c))?c:null}isViewFinished(e){return e.renderingState===s.RenderingStates.FINISHED}renderView(e){switch(e.renderingState){case s.RenderingStates.FINISHED:return!1;case s.RenderingStates.PAUSED:this.highestPriorityPage=e.renderingId,e.resume();break;case s.RenderingStates.RUNNING:this.highestPriorityPage=e.renderingId;break;case s.RenderingStates.INITIAL:this.highestPriorityPage=e.renderingId,e.draw().finally((()=>{this.renderHighestPriority()})).catch((e=>{e instanceof n.RenderingCancelledException||console.error(`renderView: "${e}"`)}))}return!0}}}],t={};function i(n){var s=t[n];if(void 0!==s)return s.exports;var r=t[n]={exports:{}};return e[n](r,r.exports,i),r.exports}var n={};return(()=>{var e=n;Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"AnnotationLayerBuilder",{enumerable:!0,get:function(){return r.AnnotationLayerBuilder}}),e.DefaultXfaLayerFactory=e.DefaultTextLayerFactory=e.DefaultStructTreeLayerFactory=e.DefaultAnnotationLayerFactory=void 0,Object.defineProperty(e,"DownloadManager",{enumerable:!0,get:function(){return a.DownloadManager}}),Object.defineProperty(e,"EventBus",{enumerable:!0,get:function(){return o.EventBus}}),Object.defineProperty(e,"GenericL10n",{enumerable:!0,get:function(){return l.GenericL10n}}),Object.defineProperty(e,"LinkTarget",{enumerable:!0,get:function(){return t.LinkTarget}}),Object.defineProperty(e,"NullL10n",{enumerable:!0,get:function(){return c.NullL10n}}),Object.defineProperty(e,"PDFFindController",{enumerable:!0,get:function(){return h.PDFFindController}}),Object.defineProperty(e,"PDFHistory",{enumerable:!0,get:function(){return d.PDFHistory}}),Object.defineProperty(e,"PDFLinkService",{enumerable:!0,get:function(){return t.PDFLinkService}}),Object.defineProperty(e,"PDFPageView",{enumerable:!0,get:function(){return u.PDFPageView}}),Object.defineProperty(e,"PDFScriptingManager",{enumerable:!0,get:function(){return p.PDFScriptingManager}}),Object.defineProperty(e,"PDFSinglePageViewer",{enumerable:!0,get:function(){return g.PDFSinglePageViewer}}),Object.defineProperty(e,"PDFViewer",{enumerable:!0,get:function(){return f.PDFViewer}}),Object.defineProperty(e,"ProgressBar",{enumerable:!0,get:function(){return s.ProgressBar}}),Object.defineProperty(e,"RenderingStates",{enumerable:!0,get:function(){return s.RenderingStates}}),Object.defineProperty(e,"ScrollMode",{enumerable:!0,get:function(){return s.ScrollMode}}),Object.defineProperty(e,"SimpleLinkService",{enumerable:!0,get:function(){return t.SimpleLinkService}}),Object.defineProperty(e,"SpreadMode",{enumerable:!0,get:function(){return s.SpreadMode}}),Object.defineProperty(e,"StructTreeLayerBuilder",{enumerable:!0,get:function(){return m.StructTreeLayerBuilder}}),Object.defineProperty(e,"TextLayerBuilder",{enumerable:!0,get:function(){return _.TextLayerBuilder}}),Object.defineProperty(e,"XfaLayerBuilder",{enumerable:!0,get:function(){return v.XfaLayerBuilder}}),Object.defineProperty(e,"parseQueryString",{enumerable:!0,get:function(){return s.parseQueryString}});var t=i(1),s=i(2),r=i(3),a=i(6),o=i(7),l=i(8),c=i(5),h=i(10),d=i(12),u=i(13),p=i(21),g=i(23),f=i(24),m=i(16),_=i(19),v=i(20);e.DefaultAnnotationLayerFactory=class{constructor(){throw new Error("The `DefaultAnnotationLayerFactory` has been removed, please use the `annotationMode` option when initializing the `PDFPageView`-instance to control AnnotationLayer rendering.")}},e.DefaultStructTreeLayerFactory=class{constructor(){throw new Error("The `DefaultStructTreeLayerFactory` has been removed, this functionality is automatically enabled when the TextLayer is used.")}},e.DefaultTextLayerFactory=class{constructor(){throw new Error("The `DefaultTextLayerFactory` has been removed, please use the `textLayerMode` option when initializing the `PDFPageView`-instance to control TextLayer rendering.")}},e.DefaultXfaLayerFactory=class{constructor(){throw new Error("The `DefaultXfaLayerFactory` has been removed, please use the `enableXfa` option when calling the `getDocument`-function to control XfaLayer rendering.")}}})(),n})(),e.exports=i()}(pdf_viewer);var pdf_viewerExports=pdf_viewer.exports,_ProgressBar_classList,_ProgressBar_disableAutoFetchTimeout,_ProgressBar_percent,_ProgressBar_style,_ProgressBar_visible;function __awaiter(e,t,i,n){return new(i||(i=Promise))((function(s,r){function a(e){try{l(n.next(e))}catch(e){r(e)}}function o(e){try{l(n.throw(e))}catch(e){r(e)}}function l(e){var t;e.done?s(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(a,o)}l((n=n.apply(e,t||[])).next())}))}function __classPrivateFieldGet(e,t,i,n){if("a"===i&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?n:"a"===i?n.call(e):n?n.value:t.get(e)}function __classPrivateFieldSet(e,t,i,n,s){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!s)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?s.call(e,i):s?s.value=i:t.set(e,i),i}const DEFAULT_SCALE_VALUE="auto",DEFAULT_SCALE=1,DEFAULT_SCALE_DELTA=1.1,MIN_SCALE=.1,MAX_SCALE=10,UNKNOWN_SCALE=0,MAX_AUTO_SCALE=1.25,SCROLLBAR_PADDING=40,VERTICAL_PADDING=5,RenderingStates={INITIAL:0,RUNNING:1,PAUSED:2,FINISHED:3},PresentationModeState={UNKNOWN:0,NORMAL:1,CHANGING:2,FULLSCREEN:3},SidebarView={UNKNOWN:-1,NONE:0,THUMBS:1,OUTLINE:2,ATTACHMENTS:3,LAYERS:4},RendererType={CANVAS:"canvas",SVG:"svg"},TextLayerMode={DISABLE:0,ENABLE:1},ScrollMode={UNKNOWN:-1,VERTICAL:0,HORIZONTAL:1,WRAPPED:2,PAGE:3},SpreadMode={UNKNOWN:-1,NONE:0,ODD:1,EVEN:2},CursorTool={SELECT:0,HAND:1,ZOOM:2},AutoPrintRegExp=/\bprint\s*\(/;class OutputScale{constructor(){const e=window.devicePixelRatio||1;this.sx=e,this.sy=e}get scaled(){return 1!==this.sx||1!==this.sy}}function scrollIntoView(e,t,i=!1){let n=e.offsetParent;if(!n)return void console.error("offsetParent is not set -- cannot scroll");let s=e.offsetTop+e.clientTop,r=e.offsetLeft+e.clientLeft;for(;n.clientHeight===n.scrollHeight&&n.clientWidth===n.scrollWidth||i&&(n.classList.contains("markedContent")||"hidden"===getComputedStyle(n).overflow);)if(s+=n.offsetTop,r+=n.offsetLeft,n=n.offsetParent,!n)return;t&&(void 0!==t.top&&(s+=t.top),void 0!==t.left&&(r+=t.left,n.scrollLeft=r)),n.scrollTop=s,n.scrollLeft=r}function watchScroll(e,t){const i=function(i){s||(s=window.requestAnimationFrame((function(){s=null;const i=e.scrollLeft,r=n.lastX;i!==r&&(n.right=i>r),n.lastX=i;const a=e.scrollTop,o=n.lastY;a!==o&&(n.down=a>o),n.lastY=a,t(n)})))},n={right:!0,down:!0,lastX:e.scrollLeft,lastY:e.scrollTop,_eventHandler:i};let s=null;return e.addEventListener("scroll",i,!0),n}function parseQueryString(e){const t=new Map;for(const[i,n]of new URLSearchParams(e))t.set(i.toLowerCase(),n);return t}const NullCharactersRegExp=/\x00/g,InvisibleCharactersRegExp=/[\x01-\x1F]/g;function removeNullCharacters(e,t=!1){return"string"!=typeof e?(console.error("The argument must be a string."),e):(t&&(e=e.replace(InvisibleCharactersRegExp," ")),e.replace(NullCharactersRegExp,""))}function binarySearchFirstItem(e,t,i=0){let n=i,s=e.length-1;if(s<0||!t(e[s]))return e.length;if(t(e[n]))return n;for(;n<s;){const i=n+s>>1;t(e[i])?s=i:n=i+1}return n}function approximateFraction(e){if(Math.floor(e)===e)return[e,1];const t=1/e;if(t>8)return[1,8];if(Math.floor(t)===t)return[1,t];const i=e>1?t:e;let n,s=0,r=1,a=1,o=1;for(;;){const e=s+a,t=r+o;if(t>8)break;i<=e/t?(a=e,o=t):(s=e,r=t)}return n=i-s/r<a/o-i?i===e?[s,r]:[r,s]:i===e?[a,o]:[o,a],n}function roundToDivide(e,t){const i=e%t;return 0===i?e:Math.round(e-i+t)}function getPageSizeInches({view:e,userUnit:t,rotate:i}){const[n,s,r,a]=e,o=i%180!=0,l=(r-n)/72*t,c=(a-s)/72*t;return{width:o?c:l,height:o?l:c}}function backtrackBeforeAllVisibleElements(e,t,i){if(e<2)return e;let n=t[e].div,s=n.offsetTop+n.clientTop;s>=i&&(n=t[e-1].div,s=n.offsetTop+n.clientTop);for(let i=e-2;i>=0&&(n=t[i].div,!(n.offsetTop+n.clientTop+n.clientHeight<=s));--i)e=i;return e}function getVisibleElements({scrollEl:e,views:t,sortByVisibility:i=!1,horizontal:n=!1,rtl:s=!1}){const r=e.scrollTop,a=r+e.clientHeight,o=e.scrollLeft,l=o+e.clientWidth;const c=[],h=new Set,d=t.length;let u=binarySearchFirstItem(t,n?function(e){const t=e.div,i=t.offsetLeft+t.clientLeft,n=i+t.clientWidth;return s?i<l:n>o}:function(e){const t=e.div;return t.offsetTop+t.clientTop+t.clientHeight>r});u>0&&u<d&&!n&&(u=backtrackBeforeAllVisibleElements(u,t,r));let p=n?l:-1;for(let e=u;e<d;e++){const i=t[e],s=i.div,d=s.offsetLeft+s.clientLeft,u=s.offsetTop+s.clientTop,g=s.clientWidth,f=s.clientHeight,m=d+g,_=u+f;if(-1===p)_>=a&&(p=_);else if((n?d:u)>p)break;if(_<=r||u>=a||m<=o||d>=l)continue;const v=Math.max(0,r-u)+Math.max(0,_-a),b=(g-(Math.max(0,o-d)+Math.max(0,m-l)))/g,y=(f-v)/f*b*100|0;c.push({id:i.id,x:d,y:u,view:i,percent:y,widthPercent:100*b|0}),h.add(i.id)}const g=c[0],f=c.at(-1);return i&&c.sort((function(e,t){const i=e.percent-t.percent;return Math.abs(i)>.001?-i:e.id-t.id})),{first:g,last:f,views:c,ids:h}}function noContextMenuHandler(e){e.preventDefault()}function normalizeWheelEventDirection(e){let t=Math.hypot(e.deltaX,e.deltaY);const i=Math.atan2(e.deltaY,e.deltaX);return-.25*Math.PI<i&&i<.75*Math.PI&&(t=-t),t}function normalizeWheelEventDelta(e){const t=e.deltaMode;let i=normalizeWheelEventDirection(e);return t===WheelEvent.DOM_DELTA_PIXEL?i/=900:t===WheelEvent.DOM_DELTA_LINE&&(i/=30),i}function isValidRotation(e){return Number.isInteger(e)&&e%90==0}function isValidScrollMode(e){return Number.isInteger(e)&&Object.values(ScrollMode).includes(e)&&e!==ScrollMode.UNKNOWN}function isValidSpreadMode(e){return Number.isInteger(e)&&Object.values(SpreadMode).includes(e)&&e!==SpreadMode.UNKNOWN}function isPortraitOrientation(e){return e.width<=e.height}const animationStarted=new Promise((function(e){window.requestAnimationFrame(e)})),docStyle=document.documentElement.style;function clamp(e,t,i){return Math.min(Math.max(e,t),i)}class ProgressBar{constructor(e){_ProgressBar_classList.set(this,null),_ProgressBar_disableAutoFetchTimeout.set(this,null),_ProgressBar_percent.set(this,0),_ProgressBar_style.set(this,null),_ProgressBar_visible.set(this,!0),__classPrivateFieldSet(this,_ProgressBar_classList,e.classList,"f"),__classPrivateFieldSet(this,_ProgressBar_style,e.style,"f")}get percent(){return __classPrivateFieldGet(this,_ProgressBar_percent,"f")}set percent(e){var t,i,n;__classPrivateFieldSet(this,_ProgressBar_percent,clamp(e,0,100),"f"),isNaN(e)?null===(t=__classPrivateFieldGet(this,_ProgressBar_classList,"f"))||void 0===t||t.add("indeterminate"):(null===(i=__classPrivateFieldGet(this,_ProgressBar_classList,"f"))||void 0===i||i.remove("indeterminate"),null===(n=__classPrivateFieldGet(this,_ProgressBar_style,"f"))||void 0===n||n.setProperty("--progressBar-percent",`${__classPrivateFieldGet(this,_ProgressBar_percent,"f")}%`))}setWidth(e){var t;if(!e)return;const i=e.parentNode.offsetWidth-e.offsetWidth;i>0&&(null===(t=__classPrivateFieldGet(this,_ProgressBar_style,"f"))||void 0===t||t.setProperty("--progressBar-end-offset",`${i}px`))}setDisableAutoFetch(e=5e3){isNaN(__classPrivateFieldGet(this,_ProgressBar_percent,"f"))||(__classPrivateFieldGet(this,_ProgressBar_disableAutoFetchTimeout,"f")&&clearTimeout(__classPrivateFieldGet(this,_ProgressBar_disableAutoFetchTimeout,"f")),this.show(),__classPrivateFieldSet(this,_ProgressBar_disableAutoFetchTimeout,setTimeout((()=>{__classPrivateFieldSet(this,_ProgressBar_disableAutoFetchTimeout,null,"f"),this.hide()}),e),"f"))}hide(){var e;__classPrivateFieldGet(this,_ProgressBar_visible,"f")&&(__classPrivateFieldSet(this,_ProgressBar_visible,!1,"f"),null===(e=__classPrivateFieldGet(this,_ProgressBar_classList,"f"))||void 0===e||e.add("hidden"))}show(){var e;__classPrivateFieldGet(this,_ProgressBar_visible,"f")||(__classPrivateFieldSet(this,_ProgressBar_visible,!0,"f"),null===(e=__classPrivateFieldGet(this,_ProgressBar_classList,"f"))||void 0===e||e.remove("hidden"))}}function getActiveOrFocusedElement(){let e=document,t=e.activeElement||e.querySelector(":focus");for(;null==t?void 0:t.shadowRoot;)e=t.shadowRoot,t=e.activeElement||e.querySelector(":focus");return t}function apiPageLayoutToViewerModes(e){let t=ScrollMode.VERTICAL,i=SpreadMode.NONE;switch(e){case"SinglePage":t=ScrollMode.PAGE;break;case"OneColumn":break;case"TwoPageLeft":t=ScrollMode.PAGE;case"TwoColumnLeft":i=SpreadMode.ODD;break;case"TwoPageRight":t=ScrollMode.PAGE;case"TwoColumnRight":i=SpreadMode.EVEN}return{scrollMode:t,spreadMode:i}}function apiPageModeToSidebarView(e){switch(e){case"UseNone":return SidebarView.NONE;case"UseThumbs":return SidebarView.THUMBS;case"UseOutlines":return SidebarView.OUTLINE;case"UseAttachments":return SidebarView.ATTACHMENTS;case"UseOC":return SidebarView.LAYERS}return SidebarView.NONE}_ProgressBar_classList=new WeakMap,_ProgressBar_disableAutoFetchTimeout=new WeakMap,_ProgressBar_percent=new WeakMap,_ProgressBar_style=new WeakMap,_ProgressBar_visible=new WeakMap;const CLEANUP_TIMEOUT=3e4;class PDFRenderingQueue{constructor(){this.pdfViewer=null,this.pdfThumbnailViewer=null,this.onIdle=null,this.highestPriorityPage=null,this.idleTimeout=null,this.printing=!1,this.isThumbnailViewEnabled=!1}setViewer(e){this.pdfViewer=e}setThumbnailViewer(e){this.pdfThumbnailViewer=e}isHighestPriority(e){return this.highestPriorityPage===e.renderingId}hasViewer(){return!!this.pdfViewer}renderHighestPriority(e){var t,i;this.idleTimeout&&(clearTimeout(this.idleTimeout),this.idleTimeout=null),(null===(t=this.pdfViewer)||void 0===t?void 0:t.forceRendering(e))||this.isThumbnailViewEnabled&&(null===(i=this.pdfThumbnailViewer)||void 0===i?void 0:i.forceRendering())||this.printing||this.onIdle&&(this.idleTimeout=setTimeout(this.onIdle.bind(this),CLEANUP_TIMEOUT))}getHighestPriority(e,t,i,n=!1){const s=e.views,r=s.length;if(0===r)return null;for(let e=0;e<r;e++){const t=s[e].view;if(!this.isViewFinished(t))return t}const a=e.first.id,o=e.last.id;if(o-a+1>r){const n=e.ids;for(let e=1,s=o-a;e<s;e++){const s=i?a+e:o-e;if(n.has(s))continue;const r=t[s-1];if(!this.isViewFinished(r))return r}}let l=i?o:a-2,c=t[l];return c&&!this.isViewFinished(c)||n&&(l+=i?1:-1,c=t[l],c&&!this.isViewFinished(c))?c:null}isViewFinished(e){return e.renderingState===RenderingStates.FINISHED}renderView(e){switch(e.renderingState){case RenderingStates.FINISHED:return!1;case RenderingStates.PAUSED:this.highestPriorityPage=e.renderingId,e.resume();break;case RenderingStates.RUNNING:this.highestPriorityPage=e.renderingId;break;case RenderingStates.INITIAL:this.highestPriorityPage=e.renderingId,e.draw().finally((()=>{this.renderHighestPriority()})).catch((e=>{e instanceof pdfExports.RenderingCancelledException||console.error(`renderView: "${e}"`)}))}return!0}}var _a,_TempImageFactory_tempCanvas;const DRAW_UPSCALE_FACTOR=2,MAX_NUM_SCALING_STEPS=3;class TempImageFactory{static getCanvas(e,t){const i=__classPrivateFieldSet(this,_a,__classPrivateFieldGet(this,_a,"f",_TempImageFactory_tempCanvas)||document.createElement("canvas"),"f",_TempImageFactory_tempCanvas);i.width=e,i.height=t;const n=i.getContext("2d",{alpha:!1});n.save(),n.fillStyle="rgb(255, 255, 255)",n.fillRect(0,0,e,t),n.restore();const s=i.getContext("2d");return[i,s]}static destroyCanvas(){const e=__classPrivateFieldGet(this,_a,"f",_TempImageFactory_tempCanvas);e&&(e.width=0,e.height=0),__classPrivateFieldSet(this,_a,null,"f",_TempImageFactory_tempCanvas)}}_a=TempImageFactory,_TempImageFactory_tempCanvas={value:null};class PDFThumbnailView{constructor({container:e,id:t,defaultViewport:i,optionalContentConfigPromise:n,linkService:s,renderingQueue:r,l10n:a,pageColors:o,store:l,thumbnailWidth:c}){this.container=e,this.id=t,this.renderingId="thumbnail"+t,this.pageLabel=null,this.store=l,this.loaded=!1,this.pdfPage=null,this.rotation=0,this.viewport=i,this.pdfPageRotate=i.rotation,this._optionalContentConfigPromise=n||null,this.pageColors=o||null,this.linkService=s,this.renderingQueue=r,this.renderTask=null,this.renderingState=RenderingStates.INITIAL,this.resume=null;const h=this.viewport.width,d=h/this.viewport.height;this.canvasWidth=c,this.canvasHeight=this.canvasWidth/d|0,this.scale=this.canvasWidth/h,this.l10n=a,this.canvas=null,this.src=null;const u=document.createElement("div");u.className="thumbnail pdfSlickThumbHolder",u.setAttribute("data-page-number",this.id.toString()),this.div=u,e.append(u)}setPdfPage(e){this.pdfPage=e,this.pdfPageRotate=e.rotate;const t=(this.rotation+this.pdfPageRotate)%360;this.viewport=e.getViewport({scale:1,rotation:t}),this.reset()}reset(){this.cancelRendering(),this.renderingState=RenderingStates.INITIAL;const e=this.viewport.width,t=e/this.viewport.height;this.canvasHeight=this.canvasWidth/t|0,this.scale=this.canvasWidth/e,this.div.removeAttribute("data-loaded"),this.loaded=!1,this.canvas&&(this.canvas.width=0,this.canvas.height=0,delete this.canvas)}update({rotation:e=null}){"number"==typeof e&&(this.rotation=e);const t=(this.rotation+this.pdfPageRotate)%360;this.viewport=this.viewport.clone({scale:1,rotation:t}),this.reset()}cancelRendering(){this.renderTask&&(this.renderTask.cancel(),this.renderTask=null),this.resume=null}_getPageDrawContext(e=1){const t=document.createElement("canvas"),i=t.getContext("2d",{alpha:!1}),n=new OutputScale;t.width=e*this.canvasWidth*n.sx|0,t.height=e*this.canvasHeight*n.sy|0;return{ctx:i,canvas:t,transform:n.scaled?[n.sx,0,0,n.sy,0,0]:null}}_convertCanvasToImage(e){if(this.renderingState!==RenderingStates.FINISHED)throw new Error("_convertCanvasToImage: Rendering has not finished.");const t=this._reduceImage(e);this.src=t.toDataURL(),this.div.setAttribute("data-loaded","true"),this.loaded=!0,this.store.getState()._setThumbnailView(this.id,this),t.width=0,t.height=0}draw(){if(this.renderingState!==RenderingStates.INITIAL)return console.error("Must be in new state before drawing"),Promise.resolve();const{pdfPage:e}=this;if(!e)return this.renderingState=RenderingStates.FINISHED,Promise.reject(new Error("pdfPage is not loaded"));this.renderingState=RenderingStates.RUNNING;const t=(e=null)=>__awaiter(this,void 0,void 0,(function*(){if(a===this.renderTask&&(this.renderTask=null),!(e instanceof pdfExports.RenderingCancelledException)&&(this.renderingState=RenderingStates.FINISHED,this._convertCanvasToImage(n),e))throw e})),{ctx:i,canvas:n,transform:s}=this._getPageDrawContext(DRAW_UPSCALE_FACTOR),r={canvasContext:i,transform:s,viewport:this.viewport.clone({scale:DRAW_UPSCALE_FACTOR*this.scale}),optionalContentConfigPromise:this._optionalContentConfigPromise,pageColors:this.pageColors},a=this.renderTask=e.render(r);a.onContinue=e=>{if(!this.renderingQueue.isHighestPriority(this))return this.renderingState=RenderingStates.PAUSED,void(this.resume=()=>{this.renderingState=RenderingStates.RUNNING,e()});e()};const o=a.promise.then((function(){return t(null)}),(function(e){return t(e)}));return o.finally((()=>{var e;n.width=0,n.height=0;this.linkService.isPageCached(this.id)||null===(e=this.pdfPage)||void 0===e||e.cleanup()})),o}setImage(e){if(this.renderingState!==RenderingStates.INITIAL)return;const{thumbnailCanvas:t,pdfPage:i,scale:n}=e;t&&(this.pdfPage||this.setPdfPage(i),n<this.scale||(this.renderingState=RenderingStates.FINISHED,this._convertCanvasToImage(t)))}_reduceImage(e){const{ctx:t,canvas:i}=this._getPageDrawContext();if(e.width<=2*i.width)return t.drawImage(e,0,0,e.width,e.height,0,0,i.width,i.height),i;let n=i.width<<MAX_NUM_SCALING_STEPS,s=i.height<<MAX_NUM_SCALING_STEPS;const[r,a]=TempImageFactory.getCanvas(n,s);for(;n>e.width||s>e.height;)n>>=1,s>>=1;for(a.drawImage(e,0,0,e.width,e.height,0,0,n,s);n>2*i.width;)a.drawImage(r,0,0,n,s,0,0,n>>1,s>>1),n>>=1,s>>=1;return t.drawImage(r,0,0,n,s,0,0,i.width,i.height),i}get _thumbPageTitle(){var e;return this.l10n.get("thumb_page_title",{page:null!==(e=this.pageLabel)&&void 0!==e?e:this.id})}get _thumbPageCanvas(){var e;return this.l10n.get("thumb_page_canvas",{page:null!==(e=this.pageLabel)&&void 0!==e?e:this.id})}setPageLabel(e){this.pageLabel="string"==typeof e?e:null}}var _PDFThumbnailViewer_instances,_PDFThumbnailViewer_ensurePdfPageLoaded,_PDFThumbnailViewer_getScrollAhead;const THUMBNAIL_SCROLL_MARGIN=-19,THUMBNAIL_SELECTED_CLASS="selected";class PDFThumbnailViewer{constructor({container:e,linkService:t,renderingQueue:i,l10n:n,pageColors:s,store:r,thumbnailWidth:a}){_PDFThumbnailViewer_instances.add(this),this.container=e,this.linkService=t,this.renderingQueue=i,this.l10n=n,this.pageColors=s||null,this._thumbnails=[],this._currentPageNumber=0,this._pagesRotation=0,this._pageLabels=[],this.pdfDocument=null,this.store=r,this.thumbnailWidth=a,!this.pageColors||CSS.supports("color",this.pageColors.background)&&CSS.supports("color",this.pageColors.foreground)||((this.pageColors.background||this.pageColors.foreground)&&console.warn("PDFThumbnailViewer: Ignoring `pageColors`-option, since the browser doesn't support the values used."),this.pageColors=null),this.scroll=watchScroll(this.container,this._scrollUpdated.bind(this)),this._resetView()}_scrollUpdated(){this.renderingQueue.renderHighestPriority()}getThumbnail(e){return this._thumbnails[e]}_getVisibleThumbs(){return getVisibleElements({scrollEl:this.container,views:this._thumbnails})}scrollThumbnailIntoView(e){if(!this.pdfDocument)return;const t=this._thumbnails[e-1];if(!t)return void console.error('scrollThumbnailIntoView: Invalid "pageNumber" parameter.');if(e!==this._currentPageNumber){this._thumbnails[this._currentPageNumber-1].div.classList.remove(THUMBNAIL_SELECTED_CLASS),t.div.classList.add(THUMBNAIL_SELECTED_CLASS)}const i=this._getVisibleThumbs(),{first:n,last:s,views:r}=i;if(r.length>0){let i=!1;if(e<=n.id||e>=(null==s?void 0:s.id))i=!0;else for(const{id:t,percent:n}of r)if(t===e){i=n<100;break}i&&scrollIntoView(t.div,{top:THUMBNAIL_SCROLL_MARGIN})}this._currentPageNumber=e,this.forceRendering()}get pagesRotation(){return this._pagesRotation}set pagesRotation(e){if(!isValidRotation(e))throw new Error("Invalid thumbnails rotation angle.");if(!this.pdfDocument)return;if(this._pagesRotation===e)return;this._pagesRotation=e;const t={rotation:e};for(const e of this._thumbnails)e.update(t)}cleanup(){for(const e of this._thumbnails)e.renderingState!==RenderingStates.FINISHED&&e.reset();TempImageFactory.destroyCanvas()}_resetView(){this._thumbnails=[],this._currentPageNumber=1,this._pageLabels=[],this._pagesRotation=0,this.container.textContent=""}setDocument(e){if(this.pdfDocument&&(this._cancelRendering(),this._resetView()),this.pdfDocument=e,!e)return;const t=e.getPage(1),i=e.getOptionalContentConfig();t.then((t=>{var n;const s=e.numPages,r=t.getViewport({scale:1});for(let e=1;e<=s;++e){const t=new PDFThumbnailView({container:this.container,id:e,defaultViewport:r.clone(),optionalContentConfigPromise:i,linkService:this.linkService,renderingQueue:this.renderingQueue,l10n:this.l10n,pageColors:this.pageColors,store:this.store,thumbnailWidth:this.thumbnailWidth});this._thumbnails.push(t)}null===(n=this._thumbnails[0])||void 0===n||n.setPdfPage(t);this._thumbnails[this._currentPageNumber-1].div.classList.add(THUMBNAIL_SELECTED_CLASS),this.store.getState()._setThumbnailsViews(this._thumbnails)})).catch((e=>{console.error("Unable to initialize thumbnail viewer",e)}))}_cancelRendering(){for(const e of this._thumbnails)e.cancelRendering()}setPageLabels(e){var t,i;if(this.pdfDocument){e?Array.isArray(e)&&this.pdfDocument.numPages===e.length?this._pageLabels=e:(this._pageLabels=[],console.error("PDFThumbnailViewer_setPageLabels: Invalid page labels.")):this._pageLabels=[];for(let e=0,n=this._thumbnails.length;e<n;e++)this._thumbnails[e].setPageLabel(null!==(i=null===(t=this._pageLabels)||void 0===t?void 0:t[e])&&void 0!==i?i:null)}}forceRendering(){const e=this._getVisibleThumbs(),t=__classPrivateFieldGet(this,_PDFThumbnailViewer_instances,"m",_PDFThumbnailViewer_getScrollAhead).call(this,e),i=this.renderingQueue.getHighestPriority(e,this._thumbnails,t);return!!i&&(__classPrivateFieldGet(this,_PDFThumbnailViewer_instances,"m",_PDFThumbnailViewer_ensurePdfPageLoaded).call(this,i).then((()=>{this.renderingQueue.renderView(i)})),!0)}}var _OverlayManager_overlays,_OverlayManager_active;_PDFThumbnailViewer_instances=new WeakSet,_PDFThumbnailViewer_ensurePdfPageLoaded=function(e){var t;return __awaiter(this,void 0,void 0,(function*(){if(null==e?void 0:e.pdfPage)return e.pdfPage;try{const i=yield null===(t=this.pdfDocument)||void 0===t?void 0:t.getPage(e.id);return(null==e?void 0:e.pdfPage)||e.setPdfPage(i),i}catch(e){return console.error("Unable to get page for thumb view",e),null}}))},_PDFThumbnailViewer_getScrollAhead=function(e){var t,i;return 1===(null===(t=e.first)||void 0===t?void 0:t.id)||(null===(i=e.last)||void 0===i?void 0:i.id)!==this._thumbnails.length&&this.scroll.down};class OverlayManager{constructor(){_OverlayManager_overlays.set(this,new WeakMap),_OverlayManager_active.set(this,null)}get active(){return __classPrivateFieldGet(this,_OverlayManager_active,"f")}register(e,t=!1){return __awaiter(this,void 0,void 0,(function*(){if("object"!=typeof e)throw new Error("Not enough parameters.");if(__classPrivateFieldGet(this,_OverlayManager_overlays,"f").has(e))throw new Error("The overlay is already registered.");__classPrivateFieldGet(this,_OverlayManager_overlays,"f").set(e,{canForceClose:t}),e.addEventListener("cancel",(()=>{__classPrivateFieldSet(this,_OverlayManager_active,null,"f")}))}))}unregister(e){return __awaiter(this,void 0,void 0,(function*(){if(!__classPrivateFieldGet(this,_OverlayManager_overlays,"f").has(e))throw new Error("The overlay does not exist.");if(__classPrivateFieldGet(this,_OverlayManager_active,"f")===e)throw new Error("The overlay cannot be removed while it is active.");__classPrivateFieldGet(this,_OverlayManager_overlays,"f").delete(e)}))}open(e){return __awaiter(this,void 0,void 0,(function*(){if(!__classPrivateFieldGet(this,_OverlayManager_overlays,"f").has(e))throw new Error("The overlay does not exist.");if(__classPrivateFieldGet(this,_OverlayManager_active,"f")){if(__classPrivateFieldGet(this,_OverlayManager_active,"f")===e)throw new Error("The overlay is already active.");if(!__classPrivateFieldGet(this,_OverlayManager_overlays,"f").get(e).canForceClose)throw new Error("Another overlay is currently active.");yield this.close()}__classPrivateFieldSet(this,_OverlayManager_active,e,"f"),e.showModal()}))}close(e=__classPrivateFieldGet(this,_OverlayManager_active,"f")){return __awaiter(this,void 0,void 0,(function*(){if(!e||!__classPrivateFieldGet(this,_OverlayManager_overlays,"f").has(e))throw new Error("The overlay does not exist.");if(!__classPrivateFieldGet(this,_OverlayManager_active,"f"))throw new Error("The overlay is currently not active.");if(__classPrivateFieldGet(this,_OverlayManager_active,"f")!==e)throw new Error("Another overlay is currently active.");e.close(),__classPrivateFieldSet(this,_OverlayManager_active,null,"f")}))}}function getXfaHtmlForPrinting(e,t){const i=t.allXfaHtml,n=new pdf_viewerExports.SimpleLinkService,s=Math.round(100*pdfExports.PixelsPerInch.PDF_TO_CSS_UNITS)/100;for(const r of null==i?void 0:i.children){const i=document.createElement("div");i.className="xfaPrintedPage",e.append(i);const a=new pdf_viewerExports.XfaLayerBuilder({pageDiv:i,pdfPage:null,annotationStorage:t.annotationStorage,linkService:n,xfaHtml:r}),o=pdfExports.getXfaPageViewport(r,{scale:s});a.render(o,"print")}}_OverlayManager_overlays=new WeakMap,_OverlayManager_active=new WeakMap;let activeService=null,dialog=null,overlayManager=new OverlayManager;function renderPage(e,t,i,n,s,r,a){const o=activeService.scratchCanvas,l=s/pdfExports.PixelsPerInch.PDF;o.width=Math.floor(n.width*l),o.height=Math.floor(n.height*l);const c=o.getContext("2d");return c.save(),c.fillStyle="rgb(255, 255, 255)",c.fillRect(0,0,o.width,o.height),c.restore(),Promise.all([t.getPage(i),a]).then((function([e,t]){const i={canvasContext:c,transform:[l,0,0,l,0,0],viewport:e.getViewport({scale:1,rotation:n.rotation}),intent:"print",annotationMode:pdfExports.AnnotationMode.ENABLE_STORAGE,optionalContentConfigPromise:r,printAnnotationStorage:t};return e.render(i).promise}))}class PDFPrintService{constructor(e,t,i,n,s=null,r=null,a){this.pdfDocument=e,this.pagesOverview=t,this.printContainer=i,this._printResolution=n||150,this._optionalContentConfigPromise=s||e.getOptionalContentConfig(),this._printAnnotationStoragePromise=r||Promise.resolve(),this.l10n=a,this.currentPage=-1,this.scratchCanvas=document.createElement("canvas")}layout(){this.throwIfInactive();const e=document.querySelector("body");null==e||e.setAttribute("data-pdfjsprinting","true");this.pagesOverview.every((e=>e.width===this.pagesOverview[0].width&&e.height===this.pagesOverview[0].height),this)||console.warn("Not all pages have the same size. The printed result may be incorrect!"),this.pageStyleSheet=document.createElement("style");const t=this.pagesOverview[0];this.pageStyleSheet.textContent="@page { size: "+t.width+"pt "+t.height+"pt;}",null==e||e.append(this.pageStyleSheet)}destroy(){if(activeService!==this)return;this.printContainer.textContent="";const e=document.querySelector("body");null==e||e.removeAttribute("data-pdfjsprinting"),this.pageStyleSheet&&(this.pageStyleSheet.remove(),this.pageStyleSheet=null),this.scratchCanvas.width=this.scratchCanvas.height=0,this.scratchCanvas=null,activeService=null,ensureOverlay().then((function(){overlayManager.active===dialog&&overlayManager.close(dialog)}))}renderPages(){if(this.pdfDocument.isPureXfa)return getXfaHtmlForPrinting(this.printContainer,this.pdfDocument),Promise.resolve();const e=this.pagesOverview.length,t=(i,n)=>{if(this.throwIfInactive(),++this.currentPage>=e)return renderProgress(e,e,this.l10n),void i();const s=this.currentPage;renderProgress(s,e,this.l10n),renderPage(this,this.pdfDocument,s+1,this.pagesOverview[s],this._printResolution,this._optionalContentConfigPromise,this._printAnnotationStoragePromise).then(this.useRenderedPage.bind(this)).then((function(){t(i,n)}),n)};return new Promise(t)}useRenderedPage(){this.throwIfInactive();const e=document.createElement("img"),t=this.scratchCanvas;"toBlob"in t?t.toBlob((function(t){e.src=URL.createObjectURL(t)})):e.src=t.toDataURL();const i=document.createElement("div");return i.className="printedPage",i.append(e),this.printContainer.append(i),new Promise((function(t,i){e.onload=t,e.onerror=i}))}performPrint(){return this.throwIfInactive(),new Promise((e=>{setTimeout((()=>{this.active?(print.call(window),setTimeout(e,20)):e()}),0)}))}get active(){return this===activeService}throwIfInactive(){if(!this.active)throw new Error("This print request was cancelled or completed.")}}const print=window.print;function dispatchEvent(e){const t=document.createEvent("CustomEvent");t.initCustomEvent(e,!1,!1,"custom"),window.dispatchEvent(t)}function abort(){activeService&&(activeService.destroy(),dispatchEvent("afterprint"))}function renderProgress(e,t,i){dialog||(dialog=document.getElementById("printServiceDialog"));const n=Math.round(100*e/t),s=dialog.querySelector("progress"),r=dialog.querySelector(".relative-progress");s.value=n,i.get("print_progress_percent",{progress:n}).then((e=>{r.textContent=e}))}if(window.print=function(){if(activeService)console.warn("Ignored window.print() because of a pending print job.");else{ensureOverlay().then((function(){activeService&&overlayManager.open(dialog)}));try{dispatchEvent("beforeprint")}finally{if(!activeService)return console.error("Expected print service to be initialized."),void ensureOverlay().then((function(){overlayManager.active===dialog&&overlayManager.close(dialog)}));const e=activeService;activeService.renderPages().then((function(){return e.performPrint()})).catch((function(){})).then((function(){e.active&&abort()}))}}},window.addEventListener("keydown",(function(e){80!==e.keyCode||!e.ctrlKey&&!e.metaKey||e.altKey||e.shiftKey||(window.print(),e.preventDefault(),e.stopImmediatePropagation())}),!0),"onbeforeprint"in window){const e=function(e){"custom"!==e.detail&&e.stopImmediatePropagation()};window.addEventListener("beforeprint",e),window.addEventListener("afterprint",e)}let overlayPromise;function ensureOverlay(){if(!overlayPromise){if(!overlayManager)throw new Error("The overlay manager has not yet been initialized.");dialog||(dialog=document.getElementById("printServiceDialog")),overlayPromise=overlayManager.register(dialog,!0),document.getElementById("printCancel").onclick=abort,dialog.addEventListener("close",abort)}return overlayPromise}const PDFPrintServiceFactory={instance:{supportsPrinting:!0,createPrintService(e,t,i,n,s,r,a){if(activeService)throw new Error("The print service is created and active.");return activeService=new PDFPrintService(e,t,i,n,s,r,a),activeService}}};var _PDFPresentationMode_instances,_PDFPresentationMode_state,_PDFPresentationMode_args,_PDFPresentationMode_mouseWheel,_PDFPresentationMode_notifyStateChange,_PDFPresentationMode_enter,_PDFPresentationMode_exit,_PDFPresentationMode_mouseDown,_PDFPresentationMode_contextMenu,_PDFPresentationMode_showControls,_PDFPresentationMode_hideControls,_PDFPresentationMode_resetMouseScrollState,_PDFPresentationMode_touchSwipe,_PDFPresentationMode_addWindowListeners,_PDFPresentationMode_removeWindowListeners,_PDFPresentationMode_fullscreenChange,_PDFPresentationMode_addFullscreenChangeListeners,_PDFPresentationMode_removeFullscreenChangeListeners;const DELAY_BEFORE_HIDING_CONTROLS=3e3,ACTIVE_SELECTOR="pdfPresentationMode",CONTROLS_SELECTOR="pdfPresentationModeControls",MOUSE_SCROLL_COOLDOWN_TIME=50,PAGE_SWITCH_THRESHOLD=.1,SWIPE_MIN_DISTANCE_THRESHOLD=50,SWIPE_ANGLE_THRESHOLD=Math.PI/6;class PDFPresentationMode{constructor({container:e,pdfViewer:t,eventBus:i}){_PDFPresentationMode_instances.add(this),_PDFPresentationMode_state.set(this,PresentationModeState.UNKNOWN),_PDFPresentationMode_args.set(this,null),this.container=e,this.pdfViewer=t,this.eventBus=i,this.contextMenuOpen=!1,this.mouseScrollTimeStamp=0,this.mouseScrollDelta=0,this.touchSwipeState=null}request(){return __awaiter(this,void 0,void 0,(function*(){const{container:e,pdfViewer:t}=this;if(this.active||!t.pagesCount||!e.requestFullscreen)return!1;__classPrivateFieldGet(this,_PDFPresentationMode_instances,"m",_PDFPresentationMode_addFullscreenChangeListeners).call(this),__classPrivateFieldGet(this,_PDFPresentationMode_instances,"m",_PDFPresentationMode_notifyStateChange).call(this,PresentationModeState.CHANGING);const i=e.requestFullscreen();__classPrivateFieldSet(this,_PDFPresentationMode_args,{pageNumber:t.currentPageNumber,scaleValue:t.currentScaleValue,scrollMode:t.scrollMode,spreadMode:null,annotationEditorMode:null},"f"),t.spreadMode===SpreadMode.NONE||t.pageViewsReady&&t.hasEqualPageSizes||(console.warn("Ignoring Spread modes when entering PresentationMode, since the document may contain varying page sizes."),__classPrivateFieldGet(this,_PDFPresentationMode_args,"f").spreadMode=t.spreadMode),t.annotationEditorMode!==pdfExports.AnnotationEditorType.DISABLE&&(__classPrivateFieldGet(this,_PDFPresentationMode_args,"f").annotationEditorMode=t.annotationEditorMode);try{return yield i,t.focus(),!0}catch(e){__classPrivateFieldGet(this,_PDFPresentationMode_instances,"m",_PDFPresentationMode_removeFullscreenChangeListeners).call(this),__classPrivateFieldGet(this,_PDFPresentationMode_instances,"m",_PDFPresentationMode_notifyStateChange).call(this,PresentationModeState.NORMAL)}return!1}))}get active(){return __classPrivateFieldGet(this,_PDFPresentationMode_state,"f")===PresentationModeState.CHANGING||__classPrivateFieldGet(this,_PDFPresentationMode_state,"f")===PresentationModeState.FULLSCREEN}}_PDFPresentationMode_state=new WeakMap,_PDFPresentationMode_args=new WeakMap,_PDFPresentationMode_instances=new WeakSet,_PDFPresentationMode_mouseWheel=function(e){if(!this.active)return;e.preventDefault();const t=normalizeWheelEventDelta(e),i=Date.now(),n=this.mouseScrollTimeStamp;if(!(i>n&&i-n<MOUSE_SCROLL_COOLDOWN_TIME)&&((this.mouseScrollDelta>0&&t<0||this.mouseScrollDelta<0&&t>0)&&__classPrivateFieldGet(this,_PDFPresentationMode_instances,"m",_PDFPresentationMode_resetMouseScrollState).call(this),this.mouseScrollDelta+=t,Math.abs(this.mouseScrollDelta)>=PAGE_SWITCH_THRESHOLD)){const e=this.mouseScrollDelta;__classPrivateFieldGet(this,_PDFPresentationMode_instances,"m",_PDFPresentationMode_resetMouseScrollState).call(this);(e>0?this.pdfViewer.previousPage():this.pdfViewer.nextPage())&&(this.mouseScrollTimeStamp=i)}},_PDFPresentationMode_notifyStateChange=function(e){__classPrivateFieldSet(this,_PDFPresentationMode_state,e,"f"),this.eventBus.dispatch("presentationmodechanged",{source:this,state:e})},_PDFPresentationMode_enter=function(){var e;__classPrivateFieldGet(this,_PDFPresentationMode_instances,"m",_PDFPresentationMode_notifyStateChange).call(this,PresentationModeState.FULLSCREEN),this.container.classList.add(ACTIVE_SELECTOR),setTimeout((()=>{this.pdfViewer.scrollMode=ScrollMode.PAGE,null!==__classPrivateFieldGet(this,_PDFPresentationMode_args,"f").spreadMode&&(this.pdfViewer.spreadMode=SpreadMode.NONE),this.pdfViewer.currentPageNumber=__classPrivateFieldGet(this,_PDFPresentationMode_args,"f").pageNumber,this.pdfViewer.currentScaleValue="page-fit",null!==__classPrivateFieldGet(this,_PDFPresentationMode_args,"f").annotationEditorMode&&(this.pdfViewer.annotationEditorMode=pdfExports.AnnotationEditorType.NONE)}),0),__classPrivateFieldGet(this,_PDFPresentationMode_instances,"m",_PDFPresentationMode_addWindowListeners).call(this),__classPrivateFieldGet(this,_PDFPresentationMode_instances,"m",_PDFPresentationMode_showControls).call(this),this.contextMenuOpen=!1,null===(e=window.getSelection())||void 0===e||e.removeAllRanges()},_PDFPresentationMode_exit=function(){const e=this.pdfViewer.currentPageNumber;this.container.classList.remove(ACTIVE_SELECTOR),setTimeout((()=>{var t;__classPrivateFieldGet(this,_PDFPresentationMode_instances,"m",_PDFPresentationMode_removeFullscreenChangeListeners).call(this),__classPrivateFieldGet(this,_PDFPresentationMode_instances,"m",_PDFPresentationMode_notifyStateChange).call(this,PresentationModeState.NORMAL),this.pdfViewer.scrollMode=__classPrivateFieldGet(this,_PDFPresentationMode_args,"f").scrollMode,null!==(null===(t=__classPrivateFieldGet(this,_PDFPresentationMode_args,"f"))||void 0===t?void 0:t.spreadMode)&&(this.pdfViewer.spreadMode=__classPrivateFieldGet(this,_PDFPresentationMode_args,"f").spreadMode),this.pdfViewer.currentScaleValue=__classPrivateFieldGet(this,_PDFPresentationMode_args,"f").scaleValue,this.pdfViewer.currentPageNumber=e,null!==__classPrivateFieldGet(this,_PDFPresentationMode_args,"f").annotationEditorMode&&(this.pdfViewer.annotationEditorMode=__classPrivateFieldGet(this,_PDFPresentationMode_args,"f").annotationEditorMode),__classPrivateFieldSet(this,_PDFPresentationMode_args,null,"f")}),0),__classPrivateFieldGet(this,_PDFPresentationMode_instances,"m",_PDFPresentationMode_removeWindowListeners).call(this),__classPrivateFieldGet(this,_PDFPresentationMode_instances,"m",_PDFPresentationMode_hideControls).call(this),__classPrivateFieldGet(this,_PDFPresentationMode_instances,"m",_PDFPresentationMode_resetMouseScrollState).call(this),this.contextMenuOpen=!1},_PDFPresentationMode_mouseDown=function(e){var t;if(this.contextMenuOpen)return this.contextMenuOpen=!1,void e.preventDefault();0===e.button&&(e.target.href&&(null===(t=e.target.parentNode)||void 0===t?void 0:t.hasAttribute("data-internal-link"))||(e.preventDefault(),e.shiftKey?this.pdfViewer.previousPage():this.pdfViewer.nextPage()))},_PDFPresentationMode_contextMenu=function(){this.contextMenuOpen=!0},_PDFPresentationMode_showControls=function(){this.controlsTimeout?clearTimeout(this.controlsTimeout):this.container.classList.add(CONTROLS_SELECTOR),this.controlsTimeout=setTimeout((()=>{this.container.classList.remove(CONTROLS_SELECTOR),delete this.controlsTimeout}),DELAY_BEFORE_HIDING_CONTROLS)},_PDFPresentationMode_hideControls=function(){this.controlsTimeout&&(clearTimeout(this.controlsTimeout),this.container.classList.remove(CONTROLS_SELECTOR),delete this.controlsTimeout)},_PDFPresentationMode_resetMouseScrollState=function(){this.mouseScrollTimeStamp=0,this.mouseScrollDelta=0},_PDFPresentationMode_touchSwipe=function(e){if(this.active)if(e.touches.length>1)this.touchSwipeState=null;else switch(e.type){case"touchstart":this.touchSwipeState={startX:e.touches[0].pageX,startY:e.touches[0].pageY,endX:e.touches[0].pageX,endY:e.touches[0].pageY};break;case"touchmove":if(null===this.touchSwipeState)return;this.touchSwipeState.endX=e.touches[0].pageX,this.touchSwipeState.endY=e.touches[0].pageY,e.preventDefault();break;case"touchend":if(null===this.touchSwipeState)return;let t=0;const i=this.touchSwipeState.endX-this.touchSwipeState.startX,n=this.touchSwipeState.endY-this.touchSwipeState.startY,s=Math.abs(Math.atan2(n,i));Math.abs(i)>SWIPE_MIN_DISTANCE_THRESHOLD&&(s<=SWIPE_ANGLE_THRESHOLD||s>=Math.PI-SWIPE_ANGLE_THRESHOLD)?t=i:Math.abs(n)>SWIPE_MIN_DISTANCE_THRESHOLD&&Math.abs(s-Math.PI/2)<=SWIPE_ANGLE_THRESHOLD&&(t=n),t>0?this.pdfViewer.previousPage():t<0&&this.pdfViewer.nextPage()}},_PDFPresentationMode_addWindowListeners=function(){this.showControlsBind=__classPrivateFieldGet(this,_PDFPresentationMode_instances,"m",_PDFPresentationMode_showControls).bind(this),this.mouseDownBind=__classPrivateFieldGet(this,_PDFPresentationMode_instances,"m",_PDFPresentationMode_mouseDown).bind(this),this.mouseWheelBind=__classPrivateFieldGet(this,_PDFPresentationMode_instances,"m",_PDFPresentationMode_mouseWheel).bind(this),this.resetMouseScrollStateBind=__classPrivateFieldGet(this,_PDFPresentationMode_instances,"m",_PDFPresentationMode_resetMouseScrollState).bind(this),this.contextMenuBind=__classPrivateFieldGet(this,_PDFPresentationMode_instances,"m",_PDFPresentationMode_contextMenu).bind(this),this.touchSwipeBind=__classPrivateFieldGet(this,_PDFPresentationMode_instances,"m",_PDFPresentationMode_touchSwipe).bind(this),window.addEventListener("mousemove",this.showControlsBind),window.addEventListener("mousedown",this.mouseDownBind),window.addEventListener("wheel",this.mouseWheelBind,{passive:!1}),window.addEventListener("keydown",this.resetMouseScrollStateBind),window.addEventListener("contextmenu",this.contextMenuBind),window.addEventListener("touchstart",this.touchSwipeBind),window.addEventListener("touchmove",this.touchSwipeBind),window.addEventListener("touchend",this.touchSwipeBind)},_PDFPresentationMode_removeWindowListeners=function(){window.removeEventListener("mousemove",this.showControlsBind),window.removeEventListener("mousedown",this.mouseDownBind),window.removeEventListener("wheel",this.mouseWheelBind,{passive:!1}),window.removeEventListener("keydown",this.resetMouseScrollStateBind),window.removeEventListener("contextmenu",this.contextMenuBind),window.removeEventListener("touchstart",this.touchSwipeBind),window.removeEventListener("touchmove",this.touchSwipeBind),window.removeEventListener("touchend",this.touchSwipeBind),delete this.showControlsBind,delete this.mouseDownBind,delete this.mouseWheelBind,delete this.resetMouseScrollStateBind,delete this.contextMenuBind,delete this.touchSwipeBind},_PDFPresentationMode_fullscreenChange=function(){document.fullscreenElement?__classPrivateFieldGet(this,_PDFPresentationMode_instances,"m",_PDFPresentationMode_enter).call(this):__classPrivateFieldGet(this,_PDFPresentationMode_instances,"m",_PDFPresentationMode_exit).call(this)},_PDFPresentationMode_addFullscreenChangeListeners=function(){this.fullscreenChangeBind=__classPrivateFieldGet(this,_PDFPresentationMode_instances,"m",_PDFPresentationMode_fullscreenChange).bind(this),window.addEventListener("fullscreenchange",this.fullscreenChangeBind)},_PDFPresentationMode_removeFullscreenChangeListeners=function(){window.removeEventListener("fullscreenchange",this.fullscreenChangeBind),delete this.fullscreenChangeBind};const initialState={isDocumentLoaded:!1,pagesReady:!1,url:null,numPages:0,pageNumber:0,scale:0,scaleValue:"auto",pagesRotation:0,spreadMode:SpreadMode.UNKNOWN,scrollMode:ScrollMode.UNKNOWN,documentOutline:null,attachments:new Map,thumbnails:new Map,thumbnailViews:new Map,annotationEditorMode:pdfExports.AnnotationEditorType.NONE,pdfSlick:null},create=()=>createStore$1(((e,t)=>Object.assign(Object.assign({},initialState),{_setThumbnailView:(i,n)=>{const s=new Map(t().thumbnails),r=new Map(t().thumbnailViews),{canvasWidth:a,canvasHeight:o,scale:l,rotation:c,loaded:h,pageLabel:d,src:u=null}=n;r.set(i,n),s.set(i,{pageNumber:i,width:a,height:o,scale:l,rotation:c,loaded:h,pageLabel:d,src:u}),e({thumbnailViews:r,thumbnails:s})},_setThumbnailsViews:t=>{const i=new Map(t.map((e=>[e.id,e]))),n=new Map(t.map((e=>{const{canvasWidth:t,canvasHeight:i,scale:n,rotation:s,loaded:r,pageLabel:a,src:o=null}=e;return[e.id,{pageNumber:e.id,width:t,height:i,scale:n,rotation:s,loaded:r,pageLabel:a,src:o}]})));e({thumbnailViews:i,thumbnails:n})}})));var _PDFSlick_instances,_PDFSlick_renderingQueue,_PDFSlick_container,_PDFSlick_viewerContainer,_PDFSlick_thumbsContainer,_PDFSlick_annotationMode,_PDFSlick_annotationEditorMode,_PDFSlick_initializePageLabels,_PDFSlick_parseDocumentInfo,_PDFSlick_parsePageSize,_PDFSlick_initInternalEventListeners,_PDFSlick_onDocumentReady,_PDFSlick_onRotationChanging,_PDFSlick_onSwitchSpreadMode,_PDFSlick_onSwitchScrollMode,_PDFSlick_onScaleChanging,_PDFSlick_onPageChanging,_PDFSlick_onPageRendered;pdfExports.GlobalWorkerOptions.workerSrc=`//cdn.jsdelivr.net/npm/pdfjs-dist@${pdfExports.version}/build/pdf.worker.min.js`;const US_PAGE_NAMES={"8.5x11":"Letter","8.5x14":"Legal"},METRIC_PAGE_NAMES={"297x420":"A3","210x297":"A4"};function getPageName(e,t,i){return i[`${t?e.width:e.height}x${t?e.height:e.width}`]}class PDFSlick{constructor({container:e,viewer:t,thumbs:i,store:n=create(),options:s}){var r,a,o,l,c,h,d,u,p,g,f,m,_;_PDFSlick_instances.add(this),_PDFSlick_renderingQueue.set(this,void 0),_PDFSlick_container.set(this,void 0),_PDFSlick_viewerContainer.set(this,void 0),_PDFSlick_thumbsContainer.set(this,void 0),this.downloadManager=null,this.findController=null,this.pdfPresentationMode=null,this.document=null,_PDFSlick_annotationMode.set(this,void 0),_PDFSlick_annotationEditorMode.set(this,void 0),__classPrivateFieldSet(this,_PDFSlick_container,e,"f"),__classPrivateFieldSet(this,_PDFSlick_viewerContainer,t,"f"),__classPrivateFieldSet(this,_PDFSlick_thumbsContainer,i,"f"),this.l10n=null!==(r=null==s?void 0:s.l10n)&&void 0!==r?r:pdf_viewerExports.NullL10n,this.downloadManager=new pdf_viewerExports.DownloadManager,this.textLayerMode=null!==(a=null==s?void 0:s.textLayerMode)&&void 0!==a?a:TextLayerMode.ENABLE,__classPrivateFieldSet(this,_PDFSlick_annotationMode,null!==(o=null==s?void 0:s.annotationMode)&&void 0!==o?o:pdfExports.AnnotationMode.ENABLE_FORMS,"f"),__classPrivateFieldSet(this,_PDFSlick_annotationEditorMode,null!==(l=null==s?void 0:s.annotationEditorMode)&&void 0!==l?l:pdfExports.AnnotationEditorType.NONE,"f"),this.removePageBorders=null!==(c=null==s?void 0:s.removePageBorders)&&void 0!==c&&c,this.singlePageViewer=null!==(h=null==s?void 0:s.singlePageViewer)&&void 0!==h&&h,this.enablePrintAutoRotate=null!==(d=null==s?void 0:s.enablePrintAutoRotate)&&void 0!==d&&d,this.useOnlyCssZoom=null!==(u=null==s?void 0:s.useOnlyCssZoom)&&void 0!==u&&u,this.pageColors=null!==(p=null==s?void 0:s.pageColors)&&void 0!==p?p:null,this.maxCanvasPixels=null!==(g=null==s?void 0:s.maxCanvasPixels)&&void 0!==g?g:16777216,this.printResolution=null!==(f=null==s?void 0:s.printResolution)&&void 0!==f?f:72,this.thumbnailWidth=null!==(m=null==s?void 0:s.thumbnailWidth)&&void 0!==m?m:125,!this.pageColors||CSS.supports("color",this.pageColors.background)&&CSS.supports("color",this.pageColors.foreground)||((this.pageColors.background||this.pageColors.foreground)&&console.warn("PDFViewer: Ignoring `pageColors`-option, since the browser doesn't support the values used."),this.pageColors=null),this.l10n=pdf_viewerExports.NullL10n,this.store=n;const v=new PDFRenderingQueue;v.onIdle=this._cleanup.bind(this),v.isThumbnailViewEnabled=!0,__classPrivateFieldSet(this,_PDFSlick_renderingQueue,v,"f");const b=new pdf_viewerExports.EventBus,y=new pdf_viewerExports.PDFLinkService({eventBus:b,externalLinkTarget:2,externalLinkRel:"noopener noreferrer nofollow",ignoreDestinationZoom:!1}),S=Object.assign(Object.assign({container:e},t&&{viewer:t}),{eventBus:b,linkService:y,renderingQueue:v,defaultRenderingQueue:!0,textLayerMode:this.textLayerMode,l10n:this.l10n,annotationMode:__classPrivateFieldGet(this,_PDFSlick_annotationMode,"f"),annotationEditorMode:__classPrivateFieldGet(this,_PDFSlick_annotationEditorMode,"f"),removePageBorders:this.removePageBorders,imageResourcesPath:"/images/",useOnlyCssZoom:this.useOnlyCssZoom}),P=this.singlePageViewer?new pdf_viewerExports.PDFSinglePageViewer(S):new pdf_viewerExports.PDFViewer(S);v.setViewer(P),i&&(this.thumbnailViewer=new PDFThumbnailViewer({container:i,linkService:y,renderingQueue:v,l10n:this.l10n,pageColors:this.pageColors,store:n,thumbnailWidth:this.thumbnailWidth}),v.setThumbnailViewer(this.thumbnailViewer)),document.fullscreenEnabled&&(this.pdfPresentationMode=new PDFPresentationMode({container:e,pdfViewer:P,eventBus:b})),this.eventBus=b,this.linkService=y,this.viewer=P,this.linkService.setViewer(P);const A=null!==(_=null==s?void 0:s.scaleValue)&&void 0!==_?_:"auto";this.store.setState({scaleValue:A})}loadDocument(e,t){var i,n,s,r,a;return __awaiter(this,void 0,void 0,(function*(){if(this.url)try{URL.revokeObjectURL(this.url.toString())}catch(e){}null===(i=this.document)||void 0===i||i.destroy(),null===(n=this.viewer)||void 0===n||n.cleanup(),this.url=e.toString();const o=null!==(s=null==t?void 0:t.filename)&&void 0!==s?s:pdfExports.getPdfFilenameFromUrl(null===(r=this.url)||void 0===r?void 0:r.toString());this.filename=o;const l=yield pdfExports.getDocument({url:e}).promise;this.document=l,this.viewer.setDocument(this.document),this.linkService.setDocument(this.document),this.thumbnailViewer&&(null===(a=this.thumbnailViewer)||void 0===a||a.setDocument(l)),__classPrivateFieldGet(this,_PDFSlick_instances,"m",_PDFSlick_initInternalEventListeners).call(this),yield __classPrivateFieldGet(this,_PDFSlick_instances,"m",_PDFSlick_initializePageLabels).call(this),this.store.setState({filename:o,numPages:l.numPages,pageNumber:1,isDocumentLoaded:!0,url:e.toString()});const c=yield l.getAttachments(),h=new Map(Object.keys(null!=c?c:{}).sort(((e,t)=>e.toLowerCase().localeCompare(t.toLowerCase()))).map((e=>[e,c[e]])));this.store.setState({attachments:h}),yield __classPrivateFieldGet(this,_PDFSlick_instances,"m",_PDFSlick_parseDocumentInfo).call(this),this.forceRendering()}))}forceRendering(e=!0){__classPrivateFieldGet(this,_PDFSlick_renderingQueue,"f").printing=!!this.printService,__classPrivateFieldGet(this,_PDFSlick_renderingQueue,"f").isThumbnailViewEnabled=e,__classPrivateFieldGet(this,_PDFSlick_renderingQueue,"f").renderHighestPriority()}gotoPage(e){this.linkService.goToPage(e)}openOrDownloadData(e,t,i){var n;null===(n=this.downloadManager)||void 0===n||n.openOrDownloadData(e,t,i)}download(){var e,t;return __awaiter(this,void 0,void 0,(function*(){const i=this.url,{filename:n}=this;try{const t=yield this.document.getData(),s=new Blob([t],{type:"application/pdf"});yield null===(e=this.downloadManager)||void 0===e?void 0:e.download(s,i,n)}catch(e){yield null===(t=this.downloadManager)||void 0===t?void 0:t.downloadUrl(i,n)}}))}save(){var e;return __awaiter(this,void 0,void 0,(function*(){const t=this.url,{filename:i}=this;try{const n=yield this.document.saveDocument(),s=new Blob([n],{type:"application/pdf"});yield null===(e=this.downloadManager)||void 0===e?void 0:e.download(s,t,i)}catch(e){console.error(`Error when saving the document: ${e.message}`),yield this.download()}}))}downloadOrSave(){var e;const{annotationStorage:t}=null!==(e=this.document)&&void 0!==e?e:{};t&&t.size>0?this.save():this.download()}get supportsPrinting(){return PDFPrintServiceFactory.instance.supportsPrinting}beforePrint(){if(this.printService)return;if(!this.supportsPrinting)return;if(!this.viewer.pageViewsReady)return void this.l10n.get("printing_not_ready").then((e=>{window.alert(e)}));const e=this.viewer.getPagesOverview(),t=document.getElementById("printContainer"),i=this.printResolution,n=this.viewer.optionalContentConfigPromise,s=PDFPrintServiceFactory.instance.createPrintService(this.document,e,t,i,n,null,this.l10n);this.printService=s,this.forceRendering(),s.layout()}afterPrint(){var e;this.printService&&(this.printService.destroy(),this.printService=null,null===(e=this.document)||void 0===e||e.annotationStorage.resetModified()),this.forceRendering()}requestPresentationMode(){var e;null===(e=this.pdfPresentationMode)||void 0===e||e.request()}triggerPrinting(){this.supportsPrinting&&window.print()}_cleanup(){var e;if(this.document)try{this.viewer.cleanup(),null===(e=this.thumbnailViewer)||void 0===e||e.cleanup(),this.document.cleanup()}catch(e){console.error("Unable to perform cleanup",e)}}setAnnotationEditorMode(e){this.viewer.annotationEditorMode=e,this.store.setState({annotationEditorMode:e})}setAnnotationEditorParams(e){const t=Array.isArray(e)?e:[e];for(const e of t)this.viewer.annotationEditorParams=e}setSpreadMode(e){isValidSpreadMode(e)&&(this.viewer.spreadMode=e,this.dispatch("switchspreadmode",{mode:e}))}setScrollMode(e){isValidScrollMode(e)&&(this.viewer.scrollMode=e,this.dispatch("switchscrollmode",{mode:e}))}setRotation(e){isValidRotation(e)&&(this.viewer.pagesRotation=e)}getPagesOverview(){var e,t;try{return null!==(t=null===(e=this.viewer)||void 0===e?void 0:e.getPagesOverview())&&void 0!==t?t:[]}catch(e){return[]}}increaseScale(){this.viewer.increaseScale()}decreaseScale(){this.viewer.decreaseScale()}set currentScaleValue(e){this.viewer.currentScaleValue=e}set currentScale(e){this.viewer.currentScale=e}getPageView(e){return this.viewer.getPageView(e)}on(e,t,i){this.eventBus.on(e,t,i)}off(e,t,i){this.eventBus.off(e,t,i)}dispatch(e,t){this.eventBus.dispatch(e,t)}}_PDFSlick_renderingQueue=new WeakMap,_PDFSlick_container=new WeakMap,_PDFSlick_viewerContainer=new WeakMap,_PDFSlick_thumbsContainer=new WeakMap,_PDFSlick_annotationMode=new WeakMap,_PDFSlick_annotationEditorMode=new WeakMap,_PDFSlick_instances=new WeakSet,_PDFSlick_initializePageLabels=function(){var e;return __awaiter(this,void 0,void 0,(function*(){const t=this.document,i=null!==(e=yield t.getPageLabels())&&void 0!==e?e:[],n=i.length;let s=0,r=0;for(let e=0;e<n;e++){const t=i[e];if(t===(e+1).toString())s++;else{if(""!==t)break;r++}}if(s>=n||r>=n)return;const{viewer:a,thumbnailViewer:o}=this;a.setPageLabels(i),null==o||o.setPageLabels(i)}))},_PDFSlick_parseDocumentInfo=function(){return __awaiter(this,void 0,void 0,(function*(){const{info:e,contentLength:t}=yield this.document.getMetadata(),i=yield this.document.getPage(this.store.getState().pageNumber).then((e=>__classPrivateFieldGet(this,_PDFSlick_instances,"m",_PDFSlick_parsePageSize).call(this,getPageSizeInches(e),0)));this.store.setState({filesize:t,title:e.Title,author:e.Author,subject:e.Subject,keywords:e.Keywords,creator:e.Creator,producer:e.Producer,version:e.PDFFormatVersion,creationDate:pdfExports.PDFDateString.toDateObject(e.CreationDate),modificationDate:pdfExports.PDFDateString.toDateObject(e.ModDate),isLinearized:e.IsLinearized,pageSize:i})}))},_PDFSlick_parsePageSize=function(e,t){return __awaiter(this,void 0,void 0,(function*(){if(!e)return;t%180!=0&&(e={width:e.height,height:e.width});const i=isPortraitOrientation(e);let n={width:Math.round(100*e.width)/100,height:Math.round(100*e.height)/100},s={width:Math.round(25.4*e.width*10)/10,height:Math.round(25.4*e.height*10)/10},r=getPageName(n,i,US_PAGE_NAMES)||getPageName(s,i,METRIC_PAGE_NAMES);if(!(r||Number.isInteger(s.width)&&Number.isInteger(s.height))){const t={width:25.4*e.width,height:25.4*e.height},a={width:Math.round(s.width),height:Math.round(s.height)};Math.abs(t.width-a.width)<.1&&Math.abs(t.height-a.height)<.1&&(r=getPageName(a,i,METRIC_PAGE_NAMES),r&&(n={width:Math.round(a.width/25.4*100)/100,height:Math.round(a.height/25.4*100)/100},s=a))}const[{width:a,height:o},l,c,h]=yield Promise.all([n,this.l10n.get("document_properties_page_size_unit_inches"),r&&this.l10n.get(`document_properties_page_size_name_${r.toLowerCase()}`),this.l10n.get("document_properties_page_size_orientation_"+(i?"portrait":"landscape"))]);return{width:a.toLocaleString(),height:o.toLocaleString(),unit:l,name:c,orientation:h}}))},_PDFSlick_initInternalEventListeners=function(){this.eventBus._on("pagesinit",__classPrivateFieldGet(this,_PDFSlick_instances,"m",_PDFSlick_onDocumentReady).bind(this)),this.eventBus._on("scalechanging",__classPrivateFieldGet(this,_PDFSlick_instances,"m",_PDFSlick_onScaleChanging).bind(this)),this.eventBus._on("pagechanging",__classPrivateFieldGet(this,_PDFSlick_instances,"m",_PDFSlick_onPageChanging).bind(this)),this.eventBus._on("pagerendered",__classPrivateFieldGet(this,_PDFSlick_instances,"m",_PDFSlick_onPageRendered).bind(this)),this.eventBus._on("rotationchanging",__classPrivateFieldGet(this,_PDFSlick_instances,"m",_PDFSlick_onRotationChanging).bind(this)),this.eventBus._on("switchspreadmode",__classPrivateFieldGet(this,_PDFSlick_instances,"m",_PDFSlick_onSwitchSpreadMode).bind(this)),this.eventBus._on("switchscrollmode",__classPrivateFieldGet(this,_PDFSlick_instances,"m",_PDFSlick_onSwitchScrollMode).bind(this)),this.eventBus._on("beforeprint",this.beforePrint.bind(this)),this.eventBus._on("afterprint",this.afterPrint.bind(this)),window.onbeforeprint=e=>{this.eventBus.dispatch("beforeprint",{source:window})},window.onafterprint=e=>{this.eventBus.dispatch("afterprint",{source:window})}},_PDFSlick_onDocumentReady=function({source:e}){var t;return __awaiter(this,void 0,void 0,(function*(){const i=yield null===(t=this.document)||void 0===t?void 0:t.getOutline(),n=this.store.getState().scaleValue;e.currentScale=1,e.currentScaleValue="auto",this.store.setState({documentOutline:i,pageNumber:1,scaleValue:n,pagesReady:!0})}))},_PDFSlick_onRotationChanging=function({pagesRotation:e,pageNumber:t}){this.store.setState({pagesRotation:e}),this.thumbnailViewer&&(this.thumbnailViewer.pagesRotation=e),this.forceRendering(),this.viewer.currentPageNumber=t},_PDFSlick_onSwitchSpreadMode=function({mode:e}){this.store.setState({spreadMode:e})},_PDFSlick_onSwitchScrollMode=function({mode:e}){this.store.setState({scrollMode:e})},_PDFSlick_onScaleChanging=function({scale:e,presetValue:t}){this.store.setState({scale:e,scaleValue:t}),this.viewer.update()},_PDFSlick_onPageChanging=function({pageNumber:e}){var t;null===(t=this.thumbnailViewer)||void 0===t||t.scrollThumbnailIntoView(e),this.store.setState({pageNumber:e})},_PDFSlick_onPageRendered=function({pageNumber:e,error:t}){var i;if(__classPrivateFieldGet(this,_PDFSlick_thumbsContainer,"f")){const t=this.viewer.getPageView(e-1),n=null===(i=this.thumbnailViewer)||void 0===i?void 0:i.getThumbnail(e-1);t&&n&&n.setImage(t)}};var noop=function(){},isBrowser="undefined"!=typeof window,useIsomorphicLayoutEffect=isBrowser?React.useLayoutEffect:React.useEffect,useIsomorphicLayoutEffect$1=useIsomorphicLayoutEffect;function useTimeoutFn(e,t){void 0===t&&(t=0);var i=React.useRef(!1),n=React.useRef(),s=React.useRef(e),r=React.useCallback((function(){return i.current}),[]),a=React.useCallback((function(){i.current=!1,n.current&&clearTimeout(n.current),n.current=setTimeout((function(){i.current=!0,s.current()}),t)}),[t]),o=React.useCallback((function(){i.current=null,n.current&&clearTimeout(n.current)}),[]);return React.useEffect((function(){s.current=e}),[e]),React.useEffect((function(){return a(),o}),[t]),[r,o,a]}function useDebounce(e,t,i){void 0===t&&(t=0),void 0===i&&(i=[]);var n=useTimeoutFn(e,t),s=n[0],r=n[1],a=n[2];return React.useEffect(a,i),[s,r]}var defaultState={x:0,y:0,width:0,height:0,top:0,left:0,bottom:0,right:0};function useMeasure(){var e=React.useState(null),t=e[0],i=e[1],n=React.useState(defaultState),s=n[0],r=n[1],a=React.useMemo((function(){return new window.ResizeObserver((function(e){if(e[0]){var t=e[0].contentRect,i=t.x,n=t.y,s=t.width,a=t.height,o=t.top,l=t.left,c=t.bottom,h=t.right;r({x:i,y:n,width:s,height:a,top:o,left:l,bottom:c,right:h})}}))}),[]);return useIsomorphicLayoutEffect$1((function(){if(t)return a.observe(t),function(){a.disconnect()}}),[t]),[i,s]}var useMeasure$1=isBrowser&&void 0!==window.ResizeObserver?useMeasure:function(){return[noop,defaultState]};function PDFSlickViewer({usePDFSlickStore:e,viewerRef:t,className:i}){const n=e((e=>e.pdfSlick)),s=e((e=>e.scaleValue)),[r,{width:a}]=useMeasure$1();return useDebounce((()=>{a&&(!n||"auto"!==s&&"page-fit"!==s&&"page-width"!==s||(n.viewer.currentScaleValue=s),null==n||n.viewer.update())}),0,[a]),jsxRuntime.jsx("div",Object.assign({ref:e=>{t(e),r(e)},id:"viewerContainer",className:`pdfSlickContainer ${null!=i?i:""}`,style:{position:"absolute",inset:0}},{children:jsxRuntime.jsx("div",{id:"viewer",className:"pdfSlickViewer pdfViewer"})}))}function PDFSlickThumbnails({children:e,thumbsRef:t,usePDFSlickStore:i,className:n}){const s=i((e=>e.thumbnailViews)),r=i((e=>e.pdfSlick)),[a,{width:o}]=useMeasure$1();return useDebounce((()=>{o&&(null==r||r.forceRendering())}),0,[o]),jsxRuntime.jsx("div",Object.assign({ref:e=>{t(e),a(e)}},{className:n},{style:{position:"absolute",overflow:"auto",inset:0}},{children:Array.from(s).map((([t,i])=>{var n;return reactDom.createPortal(e({pageNumber:t,width:i.canvasWidth,height:i.canvasHeight,scale:i.scale,src:null!==(n=null==i?void 0:i.src)&&void 0!==n?n:null,rotation:i.rotation,pageLabel:i.pageLabel,loaded:i.loaded}),i.div)}))}))}function createStore(e){return function(t,i){return useStore(e,t,i)}}const usePDFSlick=(e,t)=>{const[i,n]=React.useState(!1),[s,r]=React.useState(null),[a,o]=React.useState(null),l=React.useMemo((()=>create()),[]),c=React.useMemo((()=>createStore(l)),[]),h=React.useCallback((e=>{null!==e&&r(e)}),[]),d=React.useCallback((e=>{null!==e&&o(e)}),[]);return React.useEffect((()=>{if(e&&s){const i=new PDFSlick({container:s,thumbs:a,store:l,options:t});i.loadDocument(e,t).then((()=>n(!0))),l.setState({pdfSlick:i})}return()=>{}}),[e,s]),{isDocumentLoaded:i,viewerRef:h,thumbsRef:d,usePDFSlickStore:c,store:l,PDFSlickViewer:PDFSlickViewer,PDFSlickThumbnails:PDFSlickThumbnails}};exports.AutoPrintRegExp=AutoPrintRegExp,exports.CursorTool=CursorTool,exports.DEFAULT_SCALE=DEFAULT_SCALE,exports.DEFAULT_SCALE_DELTA=DEFAULT_SCALE_DELTA,exports.DEFAULT_SCALE_VALUE=DEFAULT_SCALE_VALUE,exports.MAX_AUTO_SCALE=MAX_AUTO_SCALE,exports.MAX_SCALE=MAX_SCALE,exports.MIN_SCALE=MIN_SCALE,exports.OutputScale=OutputScale,exports.PDFSlick=PDFSlick,exports.PDFSlickThumbnails=PDFSlickThumbnails,exports.PresentationModeState=PresentationModeState,exports.ProgressBar=ProgressBar,exports.RendererType=RendererType,exports.RenderingStates=RenderingStates,exports.SCROLLBAR_PADDING=SCROLLBAR_PADDING,exports.ScrollMode=ScrollMode,exports.SidebarView=SidebarView,exports.SpreadMode=SpreadMode,exports.TextLayerMode=TextLayerMode,exports.UNKNOWN_SCALE=UNKNOWN_SCALE,exports.VERTICAL_PADDING=VERTICAL_PADDING,exports.animationStarted=animationStarted,exports.apiPageLayoutToViewerModes=apiPageLayoutToViewerModes,exports.apiPageModeToSidebarView=apiPageModeToSidebarView,exports.approximateFraction=approximateFraction,exports.backtrackBeforeAllVisibleElements=backtrackBeforeAllVisibleElements,exports.binarySearchFirstItem=binarySearchFirstItem,exports.create=create,exports.createStore=createStore,exports.docStyle=docStyle,exports.getActiveOrFocusedElement=getActiveOrFocusedElement,exports.getPageSizeInches=getPageSizeInches,exports.getVisibleElements=getVisibleElements,exports.initialState=initialState,exports.isPortraitOrientation=isPortraitOrientation,exports.isValidRotation=isValidRotation,exports.isValidScrollMode=isValidScrollMode,exports.isValidSpreadMode=isValidSpreadMode,exports.noContextMenuHandler=noContextMenuHandler,exports.normalizeWheelEventDelta=normalizeWheelEventDelta,exports.normalizeWheelEventDirection=normalizeWheelEventDirection,exports.parseQueryString=parseQueryString,exports.removeNullCharacters=removeNullCharacters,exports.roundToDivide=roundToDivide,exports.scrollIntoView=scrollIntoView,exports.usePDFSlick=usePDFSlick,exports.watchScroll=watchScroll}));
|