@fundly.ai/payment-sdk 1.2.2-beta.6 → 1.2.2-beta.7
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/dist/components/fundlyPayDrawer.d.ts +2 -2
- package/dist/components/fundlyPayDrawer.d.ts.map +1 -1
- package/dist/embed.css +1 -1
- package/dist/embed.js +298 -124
- package/dist/index-B1UsUFgS.cjs +16 -0
- package/dist/index-C0cby8dt.js +26 -0
- package/dist/index-CnrwE_qz.js +7368 -0
- package/dist/index-D3ipyfs-.cjs +241 -0
- package/dist/index-DDyNgF3v.cjs +675 -0
- package/dist/index-DR1BS4Vd.js +19940 -0
- package/dist/index-Dhw5E-XJ.cjs +1 -0
- package/dist/index-Fy_yZp3i.js +16874 -0
- package/dist/index.js +1 -686
- package/dist/index.mjs +14 -38347
- package/dist/payment-sdk.css +1 -1
- package/package.json +3 -2
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";const require$$1=require("react"),index=require("./index-DDyNgF3v.cjs");var lib={exports:{}},core_min={};function commonjsRequire(r){throw new Error('Could not dynamically require "'+r+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var pdf={exports:{}},hasRequiredPdf;function requirePdf(){return hasRequiredPdf||(hasRequiredPdf=1,(function(module,exports){(function(c,q){module.exports=c.pdfjsLib=q()})(globalThis,()=>(()=>{var __webpack_modules__=[,((r,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.VerbosityLevel=c.Util=c.UnknownErrorException=c.UnexpectedResponseException=c.TextRenderingMode=c.RenderingIntentFlag=c.PromiseCapability=c.PermissionFlag=c.PasswordResponses=c.PasswordException=c.PageActionEventType=c.OPS=c.MissingPDFException=c.MAX_IMAGE_SIZE_TO_CACHE=c.LINE_FACTOR=c.LINE_DESCENT_FACTOR=c.InvalidPDFException=c.ImageKind=c.IDENTITY_MATRIX=c.FormatError=c.FeatureTest=c.FONT_IDENTITY_MATRIX=c.DocumentActionEventType=c.CMapCompressionType=c.BaseException=c.BASELINE_FACTOR=c.AnnotationType=c.AnnotationReplyType=c.AnnotationPrefix=c.AnnotationMode=c.AnnotationFlag=c.AnnotationFieldFlag=c.AnnotationEditorType=c.AnnotationEditorPrefix=c.AnnotationEditorParamsType=c.AnnotationBorderStyleType=c.AnnotationActionEventType=c.AbortException=void 0,c.assert=m,c.bytesToString=Z,c.createValidAbsoluteUrl=C,c.getModificationDate=hn,c.getUuid=lr,c.getVerbosityLevel=Ve,c.info=Ee,c.isArrayBuffer=Ft,c.isArrayEqual=vn,c.isNodeJS=void 0,c.normalizeUnicode=Kn,c.objectFromMap=ve,c.objectSize=We,c.setVerbosityLevel=Oe,c.shadow=V,c.string32=me,c.stringToBytes=re,c.stringToPDFString=lt,c.stringToUTF8String=vt,c.unreachable=A,c.utf8StringToString=bt,c.warn=G;const q=typeof process=="object"&&process+""=="[object process]"&&!process.versions.nw&&!(process.versions.electron&&process.type&&process.type!=="browser");c.isNodeJS=q;const p=[1,0,0,1,0,0];c.IDENTITY_MATRIX=p;const e=[.001,0,0,.001,0,0];c.FONT_IDENTITY_MATRIX=e;const s=1e7;c.MAX_IMAGE_SIZE_TO_CACHE=s;const N=1.35;c.LINE_FACTOR=N;const ee=.35;c.LINE_DESCENT_FACTOR=ee;const U=ee/N;c.BASELINE_FACTOR=U;const o={ANY:1,DISPLAY:2,PRINT:4,SAVE:8,ANNOTATIONS_FORMS:16,ANNOTATIONS_STORAGE:32,ANNOTATIONS_DISABLE:64,OPLIST:256};c.RenderingIntentFlag=o;const t={DISABLE:0,ENABLE:1,ENABLE_FORMS:2,ENABLE_STORAGE:3};c.AnnotationMode=t;const a="pdfjs_internal_editor_";c.AnnotationEditorPrefix=a;const g={DISABLE:-1,NONE:0,FREETEXT:3,STAMP:13,INK:15};c.AnnotationEditorType=g;const d={RESIZE:1,CREATE:2,FREETEXT_SIZE:11,FREETEXT_COLOR:12,FREETEXT_OPACITY:13,INK_COLOR:21,INK_THICKNESS:22,INK_OPACITY:23};c.AnnotationEditorParamsType=d;const i={PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048};c.PermissionFlag=i;const b={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};c.TextRenderingMode=b;const y={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3};c.ImageKind=y;const f={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};c.AnnotationType=f;const T={GROUP:"Group",REPLY:"R"};c.AnnotationReplyType=T;const H={INVISIBLE:1,HIDDEN:2,PRINT:4,NOZOOM:8,NOROTATE:16,NOVIEW:32,READONLY:64,LOCKED:128,TOGGLENOVIEW:256,LOCKEDCONTENTS:512};c.AnnotationFlag=H;const I={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};c.AnnotationFieldFlag=I;const _={SOLID:1,DASHED:2,BEVELED:3,INSET:4,UNDERLINE:5};c.AnnotationBorderStyleType=_;const M={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"};c.AnnotationActionEventType=M;const te={WC:"WillClose",WS:"WillSave",DS:"DidSave",WP:"WillPrint",DP:"DidPrint"};c.DocumentActionEventType=te;const ie={O:"PageOpen",C:"PageClose"};c.PageActionEventType=ie;const Y={ERRORS:0,WARNINGS:1,INFOS:5};c.VerbosityLevel=Y;const he={NONE:0,BINARY:1};c.CMapCompressionType=he;const ge={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};c.OPS=ge;const Ne={NEED_PASSWORD:1,INCORRECT_PASSWORD:2};c.PasswordResponses=Ne;let ke=Y.WARNINGS;function Oe(De){Number.isInteger(De)&&(ke=De)}function Ve(){return ke}function Ee(De){ke>=Y.INFOS&&console.log(`Info: ${De}`)}function G(De){ke>=Y.WARNINGS&&console.log(`Warning: ${De}`)}function A(De){throw new Error(De)}function m(De,fe){De||A(fe)}function v(De){switch(De?.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":return!0;default:return!1}}function C(De,fe=null,ue=null){if(!De)return null;try{if(ue&&typeof De=="string"&&(ue.addDefaultProtocol&&De.startsWith("www.")&&De.match(/\./g)?.length>=2&&(De=`http://${De}`),ue.tryConvertEncoding))try{De=vt(De)}catch{}const He=fe?new URL(De,fe):new URL(De);if(v(He))return He}catch{}return null}function V(De,fe,ue,He=!1){return Object.defineProperty(De,fe,{value:ue,enumerable:!He,configurable:!0,writable:!1}),ue}const W=(function(){function fe(ue,He){this.constructor===fe&&A("Cannot initialize BaseException."),this.message=ue,this.name=He}return fe.prototype=new Error,fe.constructor=fe,fe})();c.BaseException=W;class K extends W{constructor(fe,ue){super(fe,"PasswordException"),this.code=ue}}c.PasswordException=K;class L extends W{constructor(fe,ue){super(fe,"UnknownErrorException"),this.details=ue}}c.UnknownErrorException=L;class l extends W{constructor(fe){super(fe,"InvalidPDFException")}}c.InvalidPDFException=l;class S extends W{constructor(fe){super(fe,"MissingPDFException")}}c.MissingPDFException=S;class R extends W{constructor(fe,ue){super(fe,"UnexpectedResponseException"),this.status=ue}}c.UnexpectedResponseException=R;class O extends W{constructor(fe){super(fe,"FormatError")}}c.FormatError=O;class B extends W{constructor(fe){super(fe,"AbortException")}}c.AbortException=B;function Z(De){(typeof De!="object"||De?.length===void 0)&&A("Invalid argument for bytesToString");const fe=De.length,ue=8192;if(fe<ue)return String.fromCharCode.apply(null,De);const He=[];for(let Dt=0;Dt<fe;Dt+=ue){const pt=Math.min(Dt+ue,fe),kt=De.subarray(Dt,pt);He.push(String.fromCharCode.apply(null,kt))}return He.join("")}function re(De){typeof De!="string"&&A("Invalid argument for stringToBytes");const fe=De.length,ue=new Uint8Array(fe);for(let He=0;He<fe;++He)ue[He]=De.charCodeAt(He)&255;return ue}function me(De){return String.fromCharCode(De>>24&255,De>>16&255,De>>8&255,De&255)}function We(De){return Object.keys(De).length}function ve(De){const fe=Object.create(null);for(const[ue,He]of De)fe[ue]=He;return fe}function ye(){const De=new Uint8Array(4);return De[0]=1,new Uint32Array(De.buffer,0,1)[0]===1}function Ce(){try{return new Function(""),!0}catch{return!1}}class Re{static get isLittleEndian(){return V(this,"isLittleEndian",ye())}static get isEvalSupported(){return V(this,"isEvalSupported",Ce())}static get isOffscreenCanvasSupported(){return V(this,"isOffscreenCanvasSupported",typeof OffscreenCanvas<"u")}static get platform(){return typeof navigator>"u"?V(this,"platform",{isWin:!1,isMac:!1}):V(this,"platform",{isWin:navigator.platform.includes("Win"),isMac:navigator.platform.includes("Mac")})}static get isCSSRoundSupported(){return V(this,"isCSSRoundSupported",globalThis.CSS?.supports?.("width: round(1.5px, 1px)"))}}c.FeatureTest=Re;const xe=[...Array(256).keys()].map(De=>De.toString(16).padStart(2,"0"));class qe{static makeHexColor(fe,ue,He){return`#${xe[fe]}${xe[ue]}${xe[He]}`}static scaleMinMax(fe,ue){let He;fe[0]?(fe[0]<0&&(He=ue[0],ue[0]=ue[1],ue[1]=He),ue[0]*=fe[0],ue[1]*=fe[0],fe[3]<0&&(He=ue[2],ue[2]=ue[3],ue[3]=He),ue[2]*=fe[3],ue[3]*=fe[3]):(He=ue[0],ue[0]=ue[2],ue[2]=He,He=ue[1],ue[1]=ue[3],ue[3]=He,fe[1]<0&&(He=ue[2],ue[2]=ue[3],ue[3]=He),ue[2]*=fe[1],ue[3]*=fe[1],fe[2]<0&&(He=ue[0],ue[0]=ue[1],ue[1]=He),ue[0]*=fe[2],ue[1]*=fe[2]),ue[0]+=fe[4],ue[1]+=fe[4],ue[2]+=fe[5],ue[3]+=fe[5]}static transform(fe,ue){return[fe[0]*ue[0]+fe[2]*ue[1],fe[1]*ue[0]+fe[3]*ue[1],fe[0]*ue[2]+fe[2]*ue[3],fe[1]*ue[2]+fe[3]*ue[3],fe[0]*ue[4]+fe[2]*ue[5]+fe[4],fe[1]*ue[4]+fe[3]*ue[5]+fe[5]]}static applyTransform(fe,ue){const He=fe[0]*ue[0]+fe[1]*ue[2]+ue[4],Dt=fe[0]*ue[1]+fe[1]*ue[3]+ue[5];return[He,Dt]}static applyInverseTransform(fe,ue){const He=ue[0]*ue[3]-ue[1]*ue[2],Dt=(fe[0]*ue[3]-fe[1]*ue[2]+ue[2]*ue[5]-ue[4]*ue[3])/He,pt=(-fe[0]*ue[1]+fe[1]*ue[0]+ue[4]*ue[1]-ue[5]*ue[0])/He;return[Dt,pt]}static getAxialAlignedBoundingBox(fe,ue){const He=this.applyTransform(fe,ue),Dt=this.applyTransform(fe.slice(2,4),ue),pt=this.applyTransform([fe[0],fe[3]],ue),kt=this.applyTransform([fe[2],fe[1]],ue);return[Math.min(He[0],Dt[0],pt[0],kt[0]),Math.min(He[1],Dt[1],pt[1],kt[1]),Math.max(He[0],Dt[0],pt[0],kt[0]),Math.max(He[1],Dt[1],pt[1],kt[1])]}static inverseTransform(fe){const ue=fe[0]*fe[3]-fe[1]*fe[2];return[fe[3]/ue,-fe[1]/ue,-fe[2]/ue,fe[0]/ue,(fe[2]*fe[5]-fe[4]*fe[3])/ue,(fe[4]*fe[1]-fe[5]*fe[0])/ue]}static singularValueDecompose2dScale(fe){const ue=[fe[0],fe[2],fe[1],fe[3]],He=fe[0]*ue[0]+fe[1]*ue[2],Dt=fe[0]*ue[1]+fe[1]*ue[3],pt=fe[2]*ue[0]+fe[3]*ue[2],kt=fe[2]*ue[1]+fe[3]*ue[3],Jn=(He+kt)/2,Bn=Math.sqrt((He+kt)**2-4*(He*kt-pt*Dt))/2,Hn=Jn+Bn||1,yn=Jn-Bn||1;return[Math.sqrt(Hn),Math.sqrt(yn)]}static normalizeRect(fe){const ue=fe.slice(0);return fe[0]>fe[2]&&(ue[0]=fe[2],ue[2]=fe[0]),fe[1]>fe[3]&&(ue[1]=fe[3],ue[3]=fe[1]),ue}static intersect(fe,ue){const He=Math.max(Math.min(fe[0],fe[2]),Math.min(ue[0],ue[2])),Dt=Math.min(Math.max(fe[0],fe[2]),Math.max(ue[0],ue[2]));if(He>Dt)return null;const pt=Math.max(Math.min(fe[1],fe[3]),Math.min(ue[1],ue[3])),kt=Math.min(Math.max(fe[1],fe[3]),Math.max(ue[1],ue[3]));return pt>kt?null:[He,pt,Dt,kt]}static bezierBoundingBox(fe,ue,He,Dt,pt,kt,Jn,Bn){const Hn=[],yn=[[],[]];let Un,mn,nr,Xt,rr,an,ln,ir;for(let cr=0;cr<2;++cr){if(cr===0?(mn=6*fe-12*He+6*pt,Un=-3*fe+9*He-9*pt+3*Jn,nr=3*He-3*fe):(mn=6*ue-12*Dt+6*kt,Un=-3*ue+9*Dt-9*kt+3*Bn,nr=3*Dt-3*ue),Math.abs(Un)<1e-12){if(Math.abs(mn)<1e-12)continue;Xt=-nr/mn,0<Xt&&Xt<1&&Hn.push(Xt);continue}ln=mn*mn-4*nr*Un,ir=Math.sqrt(ln),!(ln<0)&&(rr=(-mn+ir)/(2*Un),0<rr&&rr<1&&Hn.push(rr),an=(-mn-ir)/(2*Un),0<an&&an<1&&Hn.push(an))}let An=Hn.length,Pn;const tn=An;for(;An--;)Xt=Hn[An],Pn=1-Xt,yn[0][An]=Pn*Pn*Pn*fe+3*Pn*Pn*Xt*He+3*Pn*Xt*Xt*pt+Xt*Xt*Xt*Jn,yn[1][An]=Pn*Pn*Pn*ue+3*Pn*Pn*Xt*Dt+3*Pn*Xt*Xt*kt+Xt*Xt*Xt*Bn;return yn[0][tn]=fe,yn[1][tn]=ue,yn[0][tn+1]=Jn,yn[1][tn+1]=Bn,yn[0].length=yn[1].length=tn+2,[Math.min(...yn[0]),Math.min(...yn[1]),Math.max(...yn[0]),Math.max(...yn[1])]}}c.Util=qe;const tt=[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 lt(De){if(De[0]>="ï"){let ue;if(De[0]==="þ"&&De[1]==="ÿ"?ue="utf-16be":De[0]==="ÿ"&&De[1]==="þ"?ue="utf-16le":De[0]==="ï"&&De[1]==="»"&&De[2]==="¿"&&(ue="utf-8"),ue)try{const He=new TextDecoder(ue,{fatal:!0}),Dt=re(De);return He.decode(Dt)}catch(He){G(`stringToPDFString: "${He}".`)}}const fe=[];for(let ue=0,He=De.length;ue<He;ue++){const Dt=tt[De.charCodeAt(ue)];fe.push(Dt?String.fromCharCode(Dt):De.charAt(ue))}return fe.join("")}function vt(De){return decodeURIComponent(escape(De))}function bt(De){return unescape(encodeURIComponent(De))}function Ft(De){return typeof De=="object"&&De?.byteLength!==void 0}function vn(De,fe){if(De.length!==fe.length)return!1;for(let ue=0,He=De.length;ue<He;ue++)if(De[ue]!==fe[ue])return!1;return!0}function hn(De=new Date){return[De.getUTCFullYear().toString(),(De.getUTCMonth()+1).toString().padStart(2,"0"),De.getUTCDate().toString().padStart(2,"0"),De.getUTCHours().toString().padStart(2,"0"),De.getUTCMinutes().toString().padStart(2,"0"),De.getUTCSeconds().toString().padStart(2,"0")].join("")}class jn{#e=!1;constructor(){this.promise=new Promise((fe,ue)=>{this.resolve=He=>{this.#e=!0,fe(He)},this.reject=He=>{this.#e=!0,ue(He)}})}get settled(){return this.#e}}c.PromiseCapability=jn;let gn=null,Fn=null;function Kn(De){return gn||(gn=/([\u00a0\u00b5\u037e\u0eb3\u2000-\u200a\u202f\u2126\ufb00-\ufb04\ufb06\ufb20-\ufb36\ufb38-\ufb3c\ufb3e\ufb40-\ufb41\ufb43-\ufb44\ufb46-\ufba1\ufba4-\ufba9\ufbae-\ufbb1\ufbd3-\ufbdc\ufbde-\ufbe7\ufbea-\ufbf8\ufbfc-\ufbfd\ufc00-\ufc5d\ufc64-\ufcf1\ufcf5-\ufd3d\ufd88\ufdf4\ufdfa-\ufdfb\ufe71\ufe77\ufe79\ufe7b\ufe7d]+)|(\ufb05+)/gu,Fn=new Map([["ſt","ſt"]])),De.replaceAll(gn,(fe,ue,He)=>ue?ue.normalize("NFKC"):Fn.get(He))}function lr(){if(typeof crypto<"u"&&typeof crypto?.randomUUID=="function")return crypto.randomUUID();const De=new Uint8Array(32);if(typeof crypto<"u"&&typeof crypto?.getRandomValues=="function")crypto.getRandomValues(De);else for(let fe=0;fe<32;fe++)De[fe]=Math.floor(Math.random()*255);return Z(De)}const _n="pdfjs_internal_id_";c.AnnotationPrefix=_n}),((__unused_webpack_module,exports,__w_pdfjs_require__)=>{Object.defineProperty(exports,"__esModule",{value:!0}),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,Object.defineProperty(exports,"SVGGraphics",{enumerable:!0,get:function(){return _displaySvg.SVGGraphics}}),exports.build=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),_displayNode_utils=__w_pdfjs_require__(10),_canvas=__w_pdfjs_require__(11),_worker_options=__w_pdfjs_require__(14),_message_handler=__w_pdfjs_require__(15),_metadata=__w_pdfjs_require__(16),_optional_content_config=__w_pdfjs_require__(17),_transport_stream=__w_pdfjs_require__(18),_displayFetch_stream=__w_pdfjs_require__(19),_displayNetwork=__w_pdfjs_require__(22),_displayNode_stream=__w_pdfjs_require__(23),_displaySvg=__w_pdfjs_require__(24),_xfa_text=__w_pdfjs_require__(25);const DEFAULT_RANGE_CHUNK_SIZE=65536,RENDERING_CANCELLED_TIMEOUT=100,DELAYED_CLEANUP_TIMEOUT=5e3,DefaultCanvasFactory=_util.isNodeJS?_displayNode_utils.NodeCanvasFactory:_display_utils.DOMCanvasFactory;exports.DefaultCanvasFactory=DefaultCanvasFactory;const DefaultCMapReaderFactory=_util.isNodeJS?_displayNode_utils.NodeCMapReaderFactory:_display_utils.DOMCMapReaderFactory;exports.DefaultCMapReaderFactory=DefaultCMapReaderFactory;const DefaultFilterFactory=_util.isNodeJS?_displayNode_utils.NodeFilterFactory:_display_utils.DOMFilterFactory;exports.DefaultFilterFactory=DefaultFilterFactory;const DefaultStandardFontDataFactory=_util.isNodeJS?_displayNode_utils.NodeStandardFontDataFactory:_display_utils.DOMStandardFontDataFactory;exports.DefaultStandardFontDataFactory=DefaultStandardFontDataFactory;function getDocument(r){if(typeof r=="string"||r instanceof URL?r={url:r}:(0,_util.isArrayBuffer)(r)&&(r={data:r}),typeof r!="object")throw new Error("Invalid parameter in getDocument, need parameter object.");if(!r.url&&!r.data&&!r.range)throw new Error("Invalid parameter object: need either .data, .range or .url");const c=new PDFDocumentLoadingTask,{docId:q}=c,p=r.url?getUrlProp(r.url):null,e=r.data?getDataProp(r.data):null,s=r.httpHeaders||null,N=r.withCredentials===!0,ee=r.password??null,U=r.range instanceof PDFDataRangeTransport?r.range:null,o=Number.isInteger(r.rangeChunkSize)&&r.rangeChunkSize>0?r.rangeChunkSize:DEFAULT_RANGE_CHUNK_SIZE;let t=r.worker instanceof PDFWorker?r.worker:null;const a=r.verbosity,g=typeof r.docBaseUrl=="string"&&!(0,_display_utils.isDataScheme)(r.docBaseUrl)?r.docBaseUrl:null,d=typeof r.cMapUrl=="string"?r.cMapUrl:null,i=r.cMapPacked!==!1,b=r.CMapReaderFactory||DefaultCMapReaderFactory,y=typeof r.standardFontDataUrl=="string"?r.standardFontDataUrl:null,f=r.StandardFontDataFactory||DefaultStandardFontDataFactory,T=r.stopAtErrors!==!0,H=Number.isInteger(r.maxImageSize)&&r.maxImageSize>-1?r.maxImageSize:-1,I=r.isEvalSupported!==!1,_=typeof r.isOffscreenCanvasSupported=="boolean"?r.isOffscreenCanvasSupported:!_util.isNodeJS,M=Number.isInteger(r.canvasMaxAreaInBytes)?r.canvasMaxAreaInBytes:-1,te=typeof r.disableFontFace=="boolean"?r.disableFontFace:_util.isNodeJS,ie=r.fontExtraProperties===!0,Y=r.enableXfa===!0,he=r.ownerDocument||globalThis.document,ge=r.disableRange===!0,Ne=r.disableStream===!0,ke=r.disableAutoFetch===!0,Oe=r.pdfBug===!0,Ve=U?U.length:r.length??NaN,Ee=typeof r.useSystemFonts=="boolean"?r.useSystemFonts:!_util.isNodeJS&&!te,G=typeof r.useWorkerFetch=="boolean"?r.useWorkerFetch:b===_display_utils.DOMCMapReaderFactory&&f===_display_utils.DOMStandardFontDataFactory&&d&&y&&(0,_display_utils.isValidFetchUrl)(d,document.baseURI)&&(0,_display_utils.isValidFetchUrl)(y,document.baseURI),A=r.canvasFactory||new DefaultCanvasFactory({ownerDocument:he}),m=r.filterFactory||new DefaultFilterFactory({docId:q,ownerDocument:he}),v=null;(0,_util.setVerbosityLevel)(a);const C={canvasFactory:A,filterFactory:m};if(G||(C.cMapReaderFactory=new b({baseUrl:d,isCompressed:i}),C.standardFontDataFactory=new f({baseUrl:y})),!t){const K={verbosity:a,port:_worker_options.GlobalWorkerOptions.workerPort};t=K.port?PDFWorker.fromPort(K):new PDFWorker(K),c._worker=t}const V={docId:q,apiVersion:"3.11.174",data:e,password:ee,disableAutoFetch:ke,rangeChunkSize:o,length:Ve,docBaseUrl:g,enableXfa:Y,evaluatorOptions:{maxImageSize:H,disableFontFace:te,ignoreErrors:T,isEvalSupported:I,isOffscreenCanvasSupported:_,canvasMaxAreaInBytes:M,fontExtraProperties:ie,useSystemFonts:Ee,cMapUrl:G?d:null,standardFontDataUrl:G?y:null}},W={ignoreErrors:T,isEvalSupported:I,disableFontFace:te,fontExtraProperties:ie,enableXfa:Y,ownerDocument:he,disableAutoFetch:ke,pdfBug:Oe,styleElement:v};return t.promise.then(function(){if(c.destroyed)throw new Error("Loading aborted");const K=_fetchDocument(t,V),L=new Promise(function(l){let S;U?S=new _transport_stream.PDFDataTransportStream({length:Ve,initialData:U.initialData,progressiveDone:U.progressiveDone,contentDispositionFilename:U.contentDispositionFilename,disableRange:ge,disableStream:Ne},U):e||(S=(O=>_util.isNodeJS?new _displayNode_stream.PDFNodeStream(O):(0,_display_utils.isValidFetchUrl)(O.url)?new _displayFetch_stream.PDFFetchStream(O):new _displayNetwork.PDFNetworkStream(O))({url:p,length:Ve,httpHeaders:s,withCredentials:N,rangeChunkSize:o,disableRange:ge,disableStream:Ne})),l(S)});return Promise.all([K,L]).then(function([l,S]){if(c.destroyed)throw new Error("Loading aborted");const R=new _message_handler.MessageHandler(q,l,t.port),O=new WorkerTransport(R,c,S,W,C);c._transport=O,R.send("Ready",null)})}).catch(c._capability.reject),c}async function _fetchDocument(r,c){if(r.destroyed)throw new Error("Worker was destroyed");const q=await r.messageHandler.sendWithPromise("GetDocRequest",c,c.data?[c.data.buffer]:null);if(r.destroyed)throw new Error("Worker was destroyed");return q}function getUrlProp(r){if(r instanceof URL)return r.href;try{return new URL(r,window.location).href}catch{if(_util.isNodeJS&&typeof r=="string")return r}throw new Error("Invalid PDF url data: either string or URL-object is expected in the url property.")}function getDataProp(r){if(_util.isNodeJS&&typeof Buffer<"u"&&r instanceof Buffer)throw new Error("Please provide binary data as `Uint8Array`, rather than `Buffer`.");if(r instanceof Uint8Array&&r.byteLength===r.buffer.byteLength)return r;if(typeof r=="string")return(0,_util.stringToBytes)(r);if(typeof r=="object"&&!isNaN(r?.length)||(0,_util.isArrayBuffer)(r))return new Uint8Array(r);throw new Error("Invalid PDF binary data: either TypedArray, string, or array-like object is expected in the data property.")}class PDFDocumentLoadingTask{static#e=0;constructor(){this._capability=new _util.PromiseCapability,this._transport=null,this._worker=null,this.docId=`d${PDFDocumentLoadingTask.#e++}`,this.destroyed=!1,this.onPassword=null,this.onProgress=null}get promise(){return this._capability.promise}async destroy(){this.destroyed=!0;try{this._worker?.port&&(this._worker._pendingDestroy=!0),await this._transport?.destroy()}catch(c){throw this._worker?.port&&delete this._worker._pendingDestroy,c}this._transport=null,this._worker&&(this._worker.destroy(),this._worker=null)}}exports.PDFDocumentLoadingTask=PDFDocumentLoadingTask;class PDFDataRangeTransport{constructor(c,q,p=!1,e=null){this.length=c,this.initialData=q,this.progressiveDone=p,this.contentDispositionFilename=e,this._rangeListeners=[],this._progressListeners=[],this._progressiveReadListeners=[],this._progressiveDoneListeners=[],this._readyCapability=new _util.PromiseCapability}addRangeListener(c){this._rangeListeners.push(c)}addProgressListener(c){this._progressListeners.push(c)}addProgressiveReadListener(c){this._progressiveReadListeners.push(c)}addProgressiveDoneListener(c){this._progressiveDoneListeners.push(c)}onDataRange(c,q){for(const p of this._rangeListeners)p(c,q)}onDataProgress(c,q){this._readyCapability.promise.then(()=>{for(const p of this._progressListeners)p(c,q)})}onDataProgressiveRead(c){this._readyCapability.promise.then(()=>{for(const q of this._progressiveReadListeners)q(c)})}onDataProgressiveDone(){this._readyCapability.promise.then(()=>{for(const c of this._progressiveDoneListeners)c()})}transportReady(){this._readyCapability.resolve()}requestDataRange(c,q){(0,_util.unreachable)("Abstract method PDFDataRangeTransport.requestDataRange")}abort(){}}exports.PDFDataRangeTransport=PDFDataRangeTransport;class PDFDocumentProxy{constructor(c,q){this._pdfInfo=c,this._transport=q,Object.defineProperty(this,"getJavaScript",{value:()=>((0,_display_utils.deprecated)("`PDFDocumentProxy.getJavaScript`, please use `PDFDocumentProxy.getJSActions` instead."),this.getJSActions().then(p=>{if(!p)return p;const e=[];for(const s in p)e.push(...p[s]);return e}))})}get annotationStorage(){return this._transport.annotationStorage}get filterFactory(){return this._transport.filterFactory}get numPages(){return this._pdfInfo.numPages}get fingerprints(){return this._pdfInfo.fingerprints}get isPureXfa(){return(0,_util.shadow)(this,"isPureXfa",!!this._transport._htmlForXfa)}get allXfaHtml(){return this._transport._htmlForXfa}getPage(c){return this._transport.getPage(c)}getPageIndex(c){return this._transport.getPageIndex(c)}getDestinations(){return this._transport.getDestinations()}getDestination(c){return this._transport.getDestination(c)}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()}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(c=!1){return this._transport.startCleanup(c||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{#e=null;#t=!1;constructor(c,q,p,e=!1){this._pageIndex=c,this._pageInfo=q,this._transport=p,this._stats=e?new _display_utils.StatTimer:null,this._pdfBug=e,this.commonObjs=p.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:c,rotation:q=this.rotate,offsetX:p=0,offsetY:e=0,dontFlip:s=!1}={}){return new _display_utils.PageViewport({viewBox:this.view,scale:c,rotation:q,offsetX:p,offsetY:e,dontFlip:s})}getAnnotations({intent:c="display"}={}){const q=this._transport.getRenderingIntent(c);return this._transport.getAnnotations(this._pageIndex,q.renderingIntent)}getJSActions(){return this._transport.getPageJSActions(this._pageIndex)}get filterFactory(){return this._transport.filterFactory}get isPureXfa(){return(0,_util.shadow)(this,"isPureXfa",!!this._transport._htmlForXfa)}async getXfa(){return this._transport._htmlForXfa?.children[this._pageIndex]||null}render({canvasContext:c,viewport:q,intent:p="display",annotationMode:e=_util.AnnotationMode.ENABLE,transform:s=null,background:N=null,optionalContentConfigPromise:ee=null,annotationCanvasMap:U=null,pageColors:o=null,printAnnotationStorage:t=null}){this._stats?.time("Overall");const a=this._transport.getRenderingIntent(p,e,t);this.#t=!1,this.#r(),ee||(ee=this._transport.getOptionalContentConfig());let g=this._intentStates.get(a.cacheKey);g||(g=Object.create(null),this._intentStates.set(a.cacheKey,g)),g.streamReaderCancelTimeout&&(clearTimeout(g.streamReaderCancelTimeout),g.streamReaderCancelTimeout=null);const d=!!(a.renderingIntent&_util.RenderingIntentFlag.PRINT);g.displayReadyCapability||(g.displayReadyCapability=new _util.PromiseCapability,g.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},this._stats?.time("Page Request"),this._pumpOperatorList(a));const i=f=>{g.renderTasks.delete(b),(this._maybeCleanupAfterRender||d)&&(this.#t=!0),this.#n(!d),f?(b.capability.reject(f),this._abortOperatorList({intentState:g,reason:f instanceof Error?f:new Error(f)})):b.capability.resolve(),this._stats?.timeEnd("Rendering"),this._stats?.timeEnd("Overall")},b=new InternalRenderTask({callback:i,params:{canvasContext:c,viewport:q,transform:s,background:N},objs:this.objs,commonObjs:this.commonObjs,annotationCanvasMap:U,operatorList:g.operatorList,pageIndex:this._pageIndex,canvasFactory:this._transport.canvasFactory,filterFactory:this._transport.filterFactory,useRequestAnimationFrame:!d,pdfBug:this._pdfBug,pageColors:o});(g.renderTasks||=new Set).add(b);const y=b.task;return Promise.all([g.displayReadyCapability.promise,ee]).then(([f,T])=>{if(this.destroyed){i();return}this._stats?.time("Rendering"),b.initializeGraphics({transparency:f,optionalContentConfig:T}),b.operatorListChanged()}).catch(i),y}getOperatorList({intent:c="display",annotationMode:q=_util.AnnotationMode.ENABLE,printAnnotationStorage:p=null}={}){function e(){N.operatorList.lastChunk&&(N.opListReadCapability.resolve(N.operatorList),N.renderTasks.delete(ee))}const s=this._transport.getRenderingIntent(c,q,p,!0);let N=this._intentStates.get(s.cacheKey);N||(N=Object.create(null),this._intentStates.set(s.cacheKey,N));let ee;return N.opListReadCapability||(ee=Object.create(null),ee.operatorListChanged=e,N.opListReadCapability=new _util.PromiseCapability,(N.renderTasks||=new Set).add(ee),N.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},this._stats?.time("Page Request"),this._pumpOperatorList(s)),N.opListReadCapability.promise}streamTextContent({includeMarkedContent:c=!1,disableNormalization:q=!1}={}){return this._transport.messageHandler.sendWithStream("GetTextContent",{pageIndex:this._pageIndex,includeMarkedContent:c===!0,disableNormalization:q===!0},{highWaterMark:100,size(e){return e.items.length}})}getTextContent(c={}){if(this._transport._htmlForXfa)return this.getXfa().then(p=>_xfa_text.XfaText.textContent(p));const q=this.streamTextContent(c);return new Promise(function(p,e){function s(){N.read().then(function({value:U,done:o}){if(o){p(ee);return}Object.assign(ee.styles,U.styles),ee.items.push(...U.items),s()},e)}const N=q.getReader(),ee={items:[],styles:Object.create(null)};s()})}getStructTree(){return this._transport.getStructTree(this._pageIndex)}_destroy(){this.destroyed=!0;const c=[];for(const q of this._intentStates.values())if(this._abortOperatorList({intentState:q,reason:new Error("Page was destroyed."),force:!0}),!q.opListReadCapability)for(const p of q.renderTasks)c.push(p.completed),p.cancel();return this.objs.clear(),this.#t=!1,this.#r(),Promise.all(c)}cleanup(c=!1){this.#t=!0;const q=this.#n(!1);return c&&q&&(this._stats&&=new _display_utils.StatTimer),q}#n(c=!1){if(this.#r(),!this.#t||this.destroyed)return!1;if(c)return this.#e=setTimeout(()=>{this.#e=null,this.#n(!1)},DELAYED_CLEANUP_TIMEOUT),!1;for(const{renderTasks:q,operatorList:p}of this._intentStates.values())if(q.size>0||!p.lastChunk)return!1;return this._intentStates.clear(),this.objs.clear(),this.#t=!1,!0}#r(){this.#e&&(clearTimeout(this.#e),this.#e=null)}_startRenderPage(c,q){const p=this._intentStates.get(q);p&&(this._stats?.timeEnd("Page Request"),p.displayReadyCapability?.resolve(c))}_renderPageChunk(c,q){for(let p=0,e=c.length;p<e;p++)q.operatorList.fnArray.push(c.fnArray[p]),q.operatorList.argsArray.push(c.argsArray[p]);q.operatorList.lastChunk=c.lastChunk,q.operatorList.separateAnnots=c.separateAnnots;for(const p of q.renderTasks)p.operatorListChanged();c.lastChunk&&this.#n(!0)}_pumpOperatorList({renderingIntent:c,cacheKey:q,annotationStorageSerializable:p}){const{map:e,transfers:s}=p,ee=this._transport.messageHandler.sendWithStream("GetOperatorList",{pageIndex:this._pageIndex,intent:c,cacheKey:q,annotationStorage:e},s).getReader(),U=this._intentStates.get(q);U.streamReader=ee;const o=()=>{ee.read().then(({value:t,done:a})=>{if(a){U.streamReader=null;return}this._transport.destroyed||(this._renderPageChunk(t,U),o())},t=>{if(U.streamReader=null,!this._transport.destroyed){if(U.operatorList){U.operatorList.lastChunk=!0;for(const a of U.renderTasks)a.operatorListChanged();this.#n(!0)}if(U.displayReadyCapability)U.displayReadyCapability.reject(t);else if(U.opListReadCapability)U.opListReadCapability.reject(t);else throw t}})};o()}_abortOperatorList({intentState:c,reason:q,force:p=!1}){if(c.streamReader){if(c.streamReaderCancelTimeout&&(clearTimeout(c.streamReaderCancelTimeout),c.streamReaderCancelTimeout=null),!p){if(c.renderTasks.size>0)return;if(q instanceof _display_utils.RenderingCancelledException){let e=RENDERING_CANCELLED_TIMEOUT;q.extraDelay>0&&q.extraDelay<1e3&&(e+=q.extraDelay),c.streamReaderCancelTimeout=setTimeout(()=>{c.streamReaderCancelTimeout=null,this._abortOperatorList({intentState:c,reason:q,force:!0})},e);return}}if(c.streamReader.cancel(new _util.AbortException(q.message)).catch(()=>{}),c.streamReader=null,!this._transport.destroyed){for(const[e,s]of this._intentStates)if(s===c){this._intentStates.delete(e);break}this.cleanup()}}}get stats(){return this._stats}}exports.PDFPageProxy=PDFPageProxy;class LoopbackPort{#e=new Set;#t=Promise.resolve();postMessage(c,q){const p={data:structuredClone(c,q?{transfer:q}:null)};this.#t.then(()=>{for(const e of this.#e)e.call(this,p)})}addEventListener(c,q){this.#e.add(q)}removeEventListener(c,q){this.#e.delete(q)}terminate(){this.#e.clear()}}exports.LoopbackPort=LoopbackPort;const PDFWorkerUtil={isWorkerDisabled:!1,fallbackWorkerSrc:null,fakeWorkerId:0};exports.PDFWorkerUtil=PDFWorkerUtil;{if(_util.isNodeJS&&typeof commonjsRequire=="function")PDFWorkerUtil.isWorkerDisabled=!0,PDFWorkerUtil.fallbackWorkerSrc="./pdf.worker.js";else if(typeof document=="object"){const r=document?.currentScript?.src;r&&(PDFWorkerUtil.fallbackWorkerSrc=r.replace(/(\.(?:min\.)?js)(\?.*)?$/i,".worker$1$2"))}PDFWorkerUtil.isSameOrigin=function(r,c){let q;try{if(q=new URL(r),!q.origin||q.origin==="null")return!1}catch{return!1}const p=new URL(c,q);return q.origin===p.origin},PDFWorkerUtil.createCDNWrapper=function(r){const c=`importScripts("${r}");`;return URL.createObjectURL(new Blob([c]))}}class PDFWorker{static#workerPorts;constructor({name:r=null,port:c=null,verbosity:q=(0,_util.getVerbosityLevel)()}={}){if(this.name=r,this.destroyed=!1,this.verbosity=q,this._readyCapability=new _util.PromiseCapability,this._port=null,this._webWorker=null,this._messageHandler=null,c){if(PDFWorker.#workerPorts?.has(c))throw new Error("Cannot use more than one PDFWorker per port.");(PDFWorker.#workerPorts||=new WeakMap).set(c,this),this._initializeFromPort(c);return}this._initialize()}get promise(){return this._readyCapability.promise}get port(){return this._port}get messageHandler(){return this._messageHandler}_initializeFromPort(r){this._port=r,this._messageHandler=new _message_handler.MessageHandler("main","worker",r),this._messageHandler.on("ready",function(){}),this._readyCapability.resolve(),this._messageHandler.send("configure",{verbosity:this.verbosity})}_initialize(){if(!PDFWorkerUtil.isWorkerDisabled&&!PDFWorker._mainThreadWorkerMessageHandler){let{workerSrc:r}=PDFWorker;try{PDFWorkerUtil.isSameOrigin(window.location.href,r)||(r=PDFWorkerUtil.createCDNWrapper(new URL(r,window.location).href));const c=new Worker(r),q=new _message_handler.MessageHandler("main","worker",c),p=()=>{c.removeEventListener("error",e),q.destroy(),c.terminate(),this.destroyed?this._readyCapability.reject(new Error("Worker was destroyed")):this._setupFakeWorker()},e=()=>{this._webWorker||p()};c.addEventListener("error",e),q.on("test",N=>{if(c.removeEventListener("error",e),this.destroyed){p();return}N?(this._messageHandler=q,this._port=c,this._webWorker=c,this._readyCapability.resolve(),q.send("configure",{verbosity:this.verbosity})):(this._setupFakeWorker(),q.destroy(),c.terminate())}),q.on("ready",N=>{if(c.removeEventListener("error",e),this.destroyed){p();return}try{s()}catch{this._setupFakeWorker()}});const s=()=>{const N=new Uint8Array;q.send("test",N,[N.buffer])};s();return}catch{(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(r=>{if(this.destroyed){this._readyCapability.reject(new Error("Worker was destroyed"));return}const c=new LoopbackPort;this._port=c;const q=`fake${PDFWorkerUtil.fakeWorkerId++}`,p=new _message_handler.MessageHandler(q+"_worker",q,c);r.setup(p,c);const e=new _message_handler.MessageHandler(q,q+"_worker",c);this._messageHandler=e,this._readyCapability.resolve(),e.send("configure",{verbosity:this.verbosity})}).catch(r=>{this._readyCapability.reject(new Error(`Setting up fake worker failed: "${r.message}".`))})}destroy(){this.destroyed=!0,this._webWorker&&(this._webWorker.terminate(),this._webWorker=null),PDFWorker.#workerPorts?.delete(this._port),this._port=null,this._messageHandler&&(this._messageHandler.destroy(),this._messageHandler=null)}static fromPort(r){if(!r?.port)throw new Error("PDFWorker.fromPort - invalid method signature.");const c=this.#workerPorts?.get(r.port);if(c){if(c._pendingDestroy)throw new Error("PDFWorker.fromPort - the worker is being destroyed.\nPlease remember to await `PDFDocumentLoadingTask.destroy()`-calls.");return c}return new PDFWorker(r)}static get workerSrc(){if(_worker_options.GlobalWorkerOptions.workerSrc)return _worker_options.GlobalWorkerOptions.workerSrc;if(PDFWorkerUtil.fallbackWorkerSrc!==null)return _util.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{return null}}static get _setupFakeWorkerGlobal(){const loader=async()=>{const mainWorkerMessageHandler=this._mainThreadWorkerMessageHandler;if(mainWorkerMessageHandler)return mainWorkerMessageHandler;if(_util.isNodeJS&&typeof commonjsRequire=="function"){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{#e=new Map;#t=new Map;#n=new Map;#r=null;constructor(c,q,p,e,s){this.messageHandler=c,this.loadingTask=q,this.commonObjs=new PDFObjects,this.fontLoader=new _font_loader.FontLoader({ownerDocument:e.ownerDocument,styleElement:e.styleElement}),this._params=e,this.canvasFactory=s.canvasFactory,this.filterFactory=s.filterFactory,this.cMapReaderFactory=s.cMapReaderFactory,this.standardFontDataFactory=s.standardFontDataFactory,this.destroyed=!1,this.destroyCapability=null,this._networkStream=p,this._fullReader=null,this._lastProgress=null,this.downloadInfoCapability=new _util.PromiseCapability,this.setupMessageHandler()}#o(c,q=null){const p=this.#e.get(c);if(p)return p;const e=this.messageHandler.sendWithPromise(c,q);return this.#e.set(c,e),e}get annotationStorage(){return(0,_util.shadow)(this,"annotationStorage",new _annotation_storage.AnnotationStorage)}getRenderingIntent(c,q=_util.AnnotationMode.ENABLE,p=null,e=!1){let s=_util.RenderingIntentFlag.DISPLAY,N=_annotation_storage.SerializableEmpty;switch(c){case"any":s=_util.RenderingIntentFlag.ANY;break;case"display":break;case"print":s=_util.RenderingIntentFlag.PRINT;break;default:(0,_util.warn)(`getRenderingIntent - invalid intent: ${c}`)}switch(q){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,N=(s&_util.RenderingIntentFlag.PRINT&&p instanceof _annotation_storage.PrintAnnotationStorage?p:this.annotationStorage).serializable;break;default:(0,_util.warn)(`getRenderingIntent - invalid annotationMode: ${q}`)}return e&&(s+=_util.RenderingIntentFlag.OPLIST),{renderingIntent:s,cacheKey:`${s}_${N.hash}`,annotationStorageSerializable:N}}destroy(){if(this.destroyCapability)return this.destroyCapability.promise;this.destroyed=!0,this.destroyCapability=new _util.PromiseCapability,this.#r?.reject(new Error("Worker was destroyed during onPassword callback"));const c=[];for(const p of this.#t.values())c.push(p._destroy());this.#t.clear(),this.#n.clear(),this.hasOwnProperty("annotationStorage")&&this.annotationStorage.resetModified();const q=this.messageHandler.sendWithPromise("Terminate",null);return c.push(q),Promise.all(c).then(()=>{this.commonObjs.clear(),this.fontLoader.clear(),this.#e.clear(),this.filterFactory.destroy(),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:c,loadingTask:q}=this;c.on("GetReader",(p,e)=>{(0,_util.assert)(this._networkStream,"GetReader - no `IPDFStream` instance available."),this._fullReader=this._networkStream.getFullReader(),this._fullReader.onProgress=s=>{this._lastProgress={loaded:s.loaded,total:s.total}},e.onPull=()=>{this._fullReader.read().then(function({value:s,done:N}){if(N){e.close();return}(0,_util.assert)(s instanceof ArrayBuffer,"GetReader - expected an ArrayBuffer."),e.enqueue(new Uint8Array(s),1,[s])}).catch(s=>{e.error(s)})},e.onCancel=s=>{this._fullReader.cancel(s),e.ready.catch(N=>{if(!this.destroyed)throw N})}}),c.on("ReaderHeadersReady",p=>{const e=new _util.PromiseCapability,s=this._fullReader;return s.headersReady.then(()=>{(!s.isStreamingSupported||!s.isRangeSupported)&&(this._lastProgress&&q.onProgress?.(this._lastProgress),s.onProgress=N=>{q.onProgress?.({loaded:N.loaded,total:N.total})}),e.resolve({isStreamingSupported:s.isStreamingSupported,isRangeSupported:s.isRangeSupported,contentLength:s.contentLength})},e.reject),e.promise}),c.on("GetRangeReader",(p,e)=>{(0,_util.assert)(this._networkStream,"GetRangeReader - no `IPDFStream` instance available.");const s=this._networkStream.getRangeReader(p.begin,p.end);if(!s){e.close();return}e.onPull=()=>{s.read().then(function({value:N,done:ee}){if(ee){e.close();return}(0,_util.assert)(N instanceof ArrayBuffer,"GetRangeReader - expected an ArrayBuffer."),e.enqueue(new Uint8Array(N),1,[N])}).catch(N=>{e.error(N)})},e.onCancel=N=>{s.cancel(N),e.ready.catch(ee=>{if(!this.destroyed)throw ee})}}),c.on("GetDoc",({pdfInfo:p})=>{this._numPages=p.numPages,this._htmlForXfa=p.htmlForXfa,delete p.htmlForXfa,q._capability.resolve(new PDFDocumentProxy(p,this))}),c.on("DocException",function(p){let e;switch(p.name){case"PasswordException":e=new _util.PasswordException(p.message,p.code);break;case"InvalidPDFException":e=new _util.InvalidPDFException(p.message);break;case"MissingPDFException":e=new _util.MissingPDFException(p.message);break;case"UnexpectedResponseException":e=new _util.UnexpectedResponseException(p.message,p.status);break;case"UnknownErrorException":e=new _util.UnknownErrorException(p.message,p.details);break;default:(0,_util.unreachable)("DocException - expected a valid Error.")}q._capability.reject(e)}),c.on("PasswordRequest",p=>{if(this.#r=new _util.PromiseCapability,q.onPassword){const e=s=>{s instanceof Error?this.#r.reject(s):this.#r.resolve({password:s})};try{q.onPassword(e,p.code)}catch(s){this.#r.reject(s)}}else this.#r.reject(new _util.PasswordException(p.message,p.code));return this.#r.promise}),c.on("DataLoaded",p=>{q.onProgress?.({loaded:p.length,total:p.length}),this.downloadInfoCapability.resolve(p)}),c.on("StartRenderPage",p=>{if(this.destroyed)return;this.#t.get(p.pageIndex)._startRenderPage(p.transparency,p.cacheKey)}),c.on("commonobj",([p,e,s])=>{if(!this.destroyed&&!this.commonObjs.has(p))switch(e){case"Font":const N=this._params;if("error"in s){const o=s.error;(0,_util.warn)(`Error during font loading: ${o}`),this.commonObjs.resolve(p,o);break}const ee=N.pdfBug&&globalThis.FontInspector?.enabled?(o,t)=>globalThis.FontInspector.fontAdded(o,t):null,U=new _font_loader.FontFaceObject(s,{isEvalSupported:N.isEvalSupported,disableFontFace:N.disableFontFace,ignoreErrors:N.ignoreErrors,inspectFont:ee});this.fontLoader.bind(U).catch(o=>c.sendWithPromise("FontFallback",{id:p})).finally(()=>{!N.fontExtraProperties&&U.data&&(U.data=null),this.commonObjs.resolve(p,U)});break;case"FontPath":case"Image":case"Pattern":this.commonObjs.resolve(p,s);break;default:throw new Error(`Got unknown common object type ${e}`)}}),c.on("obj",([p,e,s,N])=>{if(this.destroyed)return;const ee=this.#t.get(e);if(!ee.objs.has(p))switch(s){case"Image":if(ee.objs.resolve(p,N),N){let U;if(N.bitmap){const{width:o,height:t}=N;U=o*t*4}else U=N.data?.length||0;U>_util.MAX_IMAGE_SIZE_TO_CACHE&&(ee._maybeCleanupAfterRender=!0)}break;case"Pattern":ee.objs.resolve(p,N);break;default:throw new Error(`Got unknown object type ${s}`)}}),c.on("DocProgress",p=>{this.destroyed||q.onProgress?.({loaded:p.loaded,total:p.total})}),c.on("FetchBuiltInCMap",p=>this.destroyed?Promise.reject(new Error("Worker was destroyed.")):this.cMapReaderFactory?this.cMapReaderFactory.fetch(p):Promise.reject(new Error("CMapReaderFactory not initialized, see the `useWorkerFetch` parameter."))),c.on("FetchStandardFontData",p=>this.destroyed?Promise.reject(new Error("Worker was destroyed.")):this.standardFontDataFactory?this.standardFontDataFactory.fetch(p):Promise.reject(new Error("StandardFontDataFactory not initialized, see the `useWorkerFetch` parameter.")))}getData(){return this.messageHandler.sendWithPromise("GetData",null)}saveDocument(){this.annotationStorage.size<=0&&(0,_util.warn)("saveDocument called while `annotationStorage` is empty, please use the getData-method instead.");const{map:c,transfers:q}=this.annotationStorage.serializable;return this.messageHandler.sendWithPromise("SaveDocument",{isPureXfa:!!this._htmlForXfa,numPages:this._numPages,annotationStorage:c,filename:this._fullReader?.filename??null},q).finally(()=>{this.annotationStorage.resetModified()})}getPage(c){if(!Number.isInteger(c)||c<=0||c>this._numPages)return Promise.reject(new Error("Invalid page request."));const q=c-1,p=this.#n.get(q);if(p)return p;const e=this.messageHandler.sendWithPromise("GetPage",{pageIndex:q}).then(s=>{if(this.destroyed)throw new Error("Transport destroyed");const N=new PDFPageProxy(q,s,this,this._params.pdfBug);return this.#t.set(q,N),N});return this.#n.set(q,e),e}getPageIndex(c){return typeof c!="object"||c===null||!Number.isInteger(c.num)||c.num<0||!Number.isInteger(c.gen)||c.gen<0?Promise.reject(new Error("Invalid pageIndex request.")):this.messageHandler.sendWithPromise("GetPageIndex",{num:c.num,gen:c.gen})}getAnnotations(c,q){return this.messageHandler.sendWithPromise("GetAnnotations",{pageIndex:c,intent:q})}getFieldObjects(){return this.#o("GetFieldObjects")}hasJSActions(){return this.#o("HasJSActions")}getCalculationOrderIds(){return this.messageHandler.sendWithPromise("GetCalculationOrderIds",null)}getDestinations(){return this.messageHandler.sendWithPromise("GetDestinations",null)}getDestination(c){return typeof c!="string"?Promise.reject(new Error("Invalid destination request.")):this.messageHandler.sendWithPromise("GetDestination",{id:c})}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)}getDocJSActions(){return this.#o("GetDocJSActions")}getPageJSActions(c){return this.messageHandler.sendWithPromise("GetPageJSActions",{pageIndex:c})}getStructTree(c){return this.messageHandler.sendWithPromise("GetStructTree",{pageIndex:c})}getOutline(){return this.messageHandler.sendWithPromise("GetOutline",null)}getOptionalContentConfig(){return this.messageHandler.sendWithPromise("GetOptionalContentConfig",null).then(c=>new _optional_content_config.OptionalContentConfig(c))}getPermissions(){return this.messageHandler.sendWithPromise("GetPermissions",null)}getMetadata(){const c="GetMetadata",q=this.#e.get(c);if(q)return q;const p=this.messageHandler.sendWithPromise(c,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.#e.set(c,p),p}getMarkInfo(){return this.messageHandler.sendWithPromise("GetMarkInfo",null)}async startCleanup(c=!1){if(!this.destroyed){await this.messageHandler.sendWithPromise("Cleanup",null);for(const q of this.#t.values())if(!q.cleanup())throw new Error(`startCleanup: Page ${q.pageNumber} is currently rendering.`);this.commonObjs.clear(),c||this.fontLoader.clear(),this.#e.clear(),this.filterFactory.destroy(!0)}}get loadingParams(){const{disableAutoFetch:c,enableXfa:q}=this._params;return(0,_util.shadow)(this,"loadingParams",{disableAutoFetch:c,enableXfa:q})}}class PDFObjects{#e=Object.create(null);#t(c){return this.#e[c]||={capability:new _util.PromiseCapability,data:null}}get(c,q=null){if(q){const e=this.#t(c);return e.capability.promise.then(()=>q(e.data)),null}const p=this.#e[c];if(!p?.capability.settled)throw new Error(`Requesting object that isn't resolved yet ${c}.`);return p.data}has(c){return this.#e[c]?.capability.settled||!1}resolve(c,q=null){const p=this.#t(c);p.data=q,p.capability.resolve()}clear(){for(const c in this.#e){const{data:q}=this.#e[c];q?.bitmap?.close()}this.#e=Object.create(null)}}class RenderTask{#e=null;constructor(c){this.#e=c,this.onContinue=null}get promise(){return this.#e.capability.promise}cancel(c=0){this.#e.cancel(null,c)}get separateAnnots(){const{separateAnnots:c}=this.#e.operatorList;if(!c)return!1;const{annotationCanvasMap:q}=this.#e;return c.form||c.canvas&&q?.size>0}}exports.RenderTask=RenderTask;class InternalRenderTask{static#e=new WeakSet;constructor({callback:c,params:q,objs:p,commonObjs:e,annotationCanvasMap:s,operatorList:N,pageIndex:ee,canvasFactory:U,filterFactory:o,useRequestAnimationFrame:t=!1,pdfBug:a=!1,pageColors:g=null}){this.callback=c,this.params=q,this.objs=p,this.commonObjs=e,this.annotationCanvasMap=s,this.operatorListIdx=null,this.operatorList=N,this._pageIndex=ee,this.canvasFactory=U,this.filterFactory=o,this._pdfBug=a,this.pageColors=g,this.running=!1,this.graphicsReadyCallback=null,this.graphicsReady=!1,this._useRequestAnimationFrame=t===!0&&typeof window<"u",this.cancelled=!1,this.capability=new _util.PromiseCapability,this.task=new RenderTask(this),this._cancelBound=this.cancel.bind(this),this._continueBound=this._continue.bind(this),this._scheduleNextBound=this._scheduleNext.bind(this),this._nextBound=this._next.bind(this),this._canvas=q.canvasContext.canvas}get completed(){return this.capability.promise.catch(function(){})}initializeGraphics({transparency:c=!1,optionalContentConfig:q}){if(this.cancelled)return;if(this._canvas){if(InternalRenderTask.#e.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.#e.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:p,viewport:e,transform:s,background:N}=this.params;this.gfx=new _canvas.CanvasGraphics(p,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:q},this.annotationCanvasMap,this.pageColors),this.gfx.beginDrawing({transform:s,viewport:e,transparency:c,background:N}),this.operatorListIdx=0,this.graphicsReady=!0,this.graphicsReadyCallback?.()}cancel(c=null,q=0){this.running=!1,this.cancelled=!0,this.gfx?.endDrawing(),InternalRenderTask.#e.delete(this._canvas),this.callback(c||new _display_utils.RenderingCancelledException(`Rendering cancelled, page ${this._pageIndex+1}`,q))}operatorListChanged(){if(!this.graphicsReady){this.graphicsReadyCallback||=this._continueBound;return}this.stepper?.updateOperatorList(this.operatorList),!this.running&&this._continue()}_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(),InternalRenderTask.#e.delete(this._canvas),this.callback())))}}const version="3.11.174";exports.version=version;const build="ce8716743";exports.build=build}),((r,c,q)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.SerializableEmpty=c.PrintAnnotationStorage=c.AnnotationStorage=void 0;var p=q(1),e=q(4),s=q(8);const N=Object.freeze({map:null,hash:"",transfers:void 0});c.SerializableEmpty=N;class ee{#e=!1;#t=new Map;constructor(){this.onSetModified=null,this.onResetModified=null,this.onAnnotationEditor=null}getValue(t,a){const g=this.#t.get(t);return g===void 0?a:Object.assign(a,g)}getRawValue(t){return this.#t.get(t)}remove(t){if(this.#t.delete(t),this.#t.size===0&&this.resetModified(),typeof this.onAnnotationEditor=="function"){for(const a of this.#t.values())if(a instanceof e.AnnotationEditor)return;this.onAnnotationEditor(null)}}setValue(t,a){const g=this.#t.get(t);let d=!1;if(g!==void 0)for(const[i,b]of Object.entries(a))g[i]!==b&&(d=!0,g[i]=b);else d=!0,this.#t.set(t,a);d&&this.#n(),a instanceof e.AnnotationEditor&&typeof this.onAnnotationEditor=="function"&&this.onAnnotationEditor(a.constructor._type)}has(t){return this.#t.has(t)}getAll(){return this.#t.size>0?(0,p.objectFromMap)(this.#t):null}setAll(t){for(const[a,g]of Object.entries(t))this.setValue(a,g)}get size(){return this.#t.size}#n(){this.#e||(this.#e=!0,typeof this.onSetModified=="function"&&this.onSetModified())}resetModified(){this.#e&&(this.#e=!1,typeof this.onResetModified=="function"&&this.onResetModified())}get print(){return new U(this)}get serializable(){if(this.#t.size===0)return N;const t=new Map,a=new s.MurmurHash3_64,g=[],d=Object.create(null);let i=!1;for(const[b,y]of this.#t){const f=y instanceof e.AnnotationEditor?y.serialize(!1,d):y;f&&(t.set(b,f),a.update(`${b}:${JSON.stringify(f)}`),i||=!!f.bitmap)}if(i)for(const b of t.values())b.bitmap&&g.push(b.bitmap);return t.size>0?{map:t,hash:a.hexdigest(),transfers:g}:N}}c.AnnotationStorage=ee;class U extends ee{#e;constructor(t){super();const{map:a,hash:g,transfers:d}=t.serializable,i=structuredClone(a,d?{transfer:d}:null);this.#e={map:i,hash:g,transfers:d}}get print(){(0,p.unreachable)("Should not call PrintAnnotationStorage.print")}get serializable(){return this.#e}}c.PrintAnnotationStorage=U}),((r,c,q)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.AnnotationEditor=void 0;var p=q(5),e=q(1),s=q(6);class N{#e="";#t=!1;#n=null;#r=null;#o=null;#s=!1;#a=null;#l=this.focusin.bind(this);#c=this.focusout.bind(this);#i=!1;#f=!1;#d=!1;_initialOptions=Object.create(null);_uiManager=null;_focusEventsAllowed=!0;_l10nPromise=null;#h=!1;#p=N._zIndex++;static _borderLineWidth=-1;static _colorManager=new p.ColorManager;static _zIndex=1;static SMALL_EDITOR_SIZE=0;constructor(o){this.constructor===N&&(0,e.unreachable)("Cannot initialize AnnotationEditor."),this.parent=o.parent,this.id=o.id,this.width=this.height=null,this.pageIndex=o.parent.pageIndex,this.name=o.name,this.div=null,this._uiManager=o.uiManager,this.annotationElementId=null,this._willKeepAspectRatio=!1,this._initialOptions.isCentered=o.isCentered,this._structTreeParentId=null;const{rotation:t,rawDims:{pageWidth:a,pageHeight:g,pageX:d,pageY:i}}=this.parent.viewport;this.rotation=t,this.pageRotation=(360+t-this._uiManager.viewParameters.rotation)%360,this.pageDimensions=[a,g],this.pageTranslation=[d,i];const[b,y]=this.parentDimensions;this.x=o.x/b,this.y=o.y/y,this.isAttachedToDOM=!1,this.deleted=!1}get editorType(){return Object.getPrototypeOf(this).constructor._type}static get _defaultLineColor(){return(0,e.shadow)(this,"_defaultLineColor",this._colorManager.getHexCode("CanvasText"))}static deleteAnnotationElement(o){const t=new ee({id:o.parent.getNextId(),parent:o.parent,uiManager:o._uiManager});t.annotationElementId=o.annotationElementId,t.deleted=!0,t._uiManager.addToAnnotationStorage(t)}static initialize(o,t=null){if(N._l10nPromise||=new Map(["editor_alt_text_button_label","editor_alt_text_edit_button_label","editor_alt_text_decorative_tooltip"].map(g=>[g,o.get(g)])),t?.strings)for(const g of t.strings)N._l10nPromise.set(g,o.get(g));if(N._borderLineWidth!==-1)return;const a=getComputedStyle(document.documentElement);N._borderLineWidth=parseFloat(a.getPropertyValue("--outline-width"))||0}static updateDefaultParams(o,t){}static get defaultPropertiesToUpdate(){return[]}static isHandlingMimeForPasting(o){return!1}static paste(o,t){(0,e.unreachable)("Not implemented")}get propertiesToUpdate(){return[]}get _isDraggable(){return this.#h}set _isDraggable(o){this.#h=o,this.div?.classList.toggle("draggable",o)}center(){const[o,t]=this.pageDimensions;switch(this.parentRotation){case 90:this.x-=this.height*t/(o*2),this.y+=this.width*o/(t*2);break;case 180:this.x+=this.width/2,this.y+=this.height/2;break;case 270:this.x+=this.height*t/(o*2),this.y-=this.width*o/(t*2);break;default:this.x-=this.width/2,this.y-=this.height/2;break}this.fixAndSetPosition()}addCommands(o){this._uiManager.addCommands(o)}get currentLayer(){return this._uiManager.currentLayer}setInBackground(){this.div.style.zIndex=0}setInForeground(){this.div.style.zIndex=this.#p}setParent(o){o!==null&&(this.pageIndex=o.pageIndex,this.pageDimensions=o.pageDimensions),this.parent=o}focusin(o){this._focusEventsAllowed&&(this.#i?this.#i=!1:this.parent.setSelected(this))}focusout(o){!this._focusEventsAllowed||!this.isAttachedToDOM||o.relatedTarget?.closest(`#${this.id}`)||(o.preventDefault(),this.parent?.isMultipleSelection||this.commitOrRemove())}commitOrRemove(){this.isEmpty()?this.remove():this.commit()}commit(){this.addToAnnotationStorage()}addToAnnotationStorage(){this._uiManager.addToAnnotationStorage(this)}setAt(o,t,a,g){const[d,i]=this.parentDimensions;[a,g]=this.screenToPageTranslation(a,g),this.x=(o+a)/d,this.y=(t+g)/i,this.fixAndSetPosition()}#v([o,t],a,g){[a,g]=this.screenToPageTranslation(a,g),this.x+=a/o,this.y+=g/t,this.fixAndSetPosition()}translate(o,t){this.#v(this.parentDimensions,o,t)}translateInPage(o,t){this.#v(this.pageDimensions,o,t),this.div.scrollIntoView({block:"nearest"})}drag(o,t){const[a,g]=this.parentDimensions;if(this.x+=o/a,this.y+=t/g,this.parent&&(this.x<0||this.x>1||this.y<0||this.y>1)){const{x:f,y:T}=this.div.getBoundingClientRect();this.parent.findNewParent(this,f,T)&&(this.x-=Math.floor(this.x),this.y-=Math.floor(this.y))}let{x:d,y:i}=this;const[b,y]=this.#m();d+=b,i+=y,this.div.style.left=`${(100*d).toFixed(2)}%`,this.div.style.top=`${(100*i).toFixed(2)}%`,this.div.scrollIntoView({block:"nearest"})}#m(){const[o,t]=this.parentDimensions,{_borderLineWidth:a}=N,g=a/o,d=a/t;switch(this.rotation){case 90:return[-g,d];case 180:return[g,d];case 270:return[g,-d];default:return[-g,-d]}}fixAndSetPosition(){const[o,t]=this.pageDimensions;let{x:a,y:g,width:d,height:i}=this;switch(d*=o,i*=t,a*=o,g*=t,this.rotation){case 0:a=Math.max(0,Math.min(o-d,a)),g=Math.max(0,Math.min(t-i,g));break;case 90:a=Math.max(0,Math.min(o-i,a)),g=Math.min(t,Math.max(d,g));break;case 180:a=Math.min(o,Math.max(d,a)),g=Math.min(t,Math.max(i,g));break;case 270:a=Math.min(o,Math.max(i,a)),g=Math.max(0,Math.min(t-d,g));break}this.x=a/=o,this.y=g/=t;const[b,y]=this.#m();a+=b,g+=y;const{style:f}=this.div;f.left=`${(100*a).toFixed(2)}%`,f.top=`${(100*g).toFixed(2)}%`,this.moveInDOM()}static#g(o,t,a){switch(a){case 90:return[t,-o];case 180:return[-o,-t];case 270:return[-t,o];default:return[o,t]}}screenToPageTranslation(o,t){return N.#g(o,t,this.parentRotation)}pageTranslationToScreen(o,t){return N.#g(o,t,360-this.parentRotation)}#u(o){switch(o){case 90:{const[t,a]=this.pageDimensions;return[0,-t/a,a/t,0]}case 180:return[-1,0,0,-1];case 270:{const[t,a]=this.pageDimensions;return[0,t/a,-a/t,0]}default:return[1,0,0,1]}}get parentScale(){return this._uiManager.viewParameters.realScale}get parentRotation(){return(this._uiManager.viewParameters.rotation+this.pageRotation)%360}get parentDimensions(){const{parentScale:o,pageDimensions:[t,a]}=this,g=t*o,d=a*o;return e.FeatureTest.isCSSRoundSupported?[Math.round(g),Math.round(d)]:[g,d]}setDims(o,t){const[a,g]=this.parentDimensions;this.div.style.width=`${(100*o/a).toFixed(2)}%`,this.#s||(this.div.style.height=`${(100*t/g).toFixed(2)}%`),this.#n?.classList.toggle("small",o<N.SMALL_EDITOR_SIZE||t<N.SMALL_EDITOR_SIZE)}fixDims(){const{style:o}=this.div,{height:t,width:a}=o,g=a.endsWith("%"),d=!this.#s&&t.endsWith("%");if(g&&d)return;const[i,b]=this.parentDimensions;g||(o.width=`${(100*parseFloat(a)/i).toFixed(2)}%`),!this.#s&&!d&&(o.height=`${(100*parseFloat(t)/b).toFixed(2)}%`)}getInitialTranslation(){return[0,0]}#b(){if(this.#a)return;this.#a=document.createElement("div"),this.#a.classList.add("resizers");const o=["topLeft","topRight","bottomRight","bottomLeft"];this._willKeepAspectRatio||o.push("topMiddle","middleRight","bottomMiddle","middleLeft");for(const t of o){const a=document.createElement("div");this.#a.append(a),a.classList.add("resizer",t),a.addEventListener("pointerdown",this.#E.bind(this,t)),a.addEventListener("contextmenu",s.noContextMenu)}this.div.prepend(this.#a)}#E(o,t){t.preventDefault();const{isMac:a}=e.FeatureTest.platform;if(t.button!==0||t.ctrlKey&&a)return;const g=this.#w.bind(this,o),d=this._isDraggable;this._isDraggable=!1;const i={passive:!0,capture:!0};window.addEventListener("pointermove",g,i);const b=this.x,y=this.y,f=this.width,T=this.height,H=this.parent.div.style.cursor,I=this.div.style.cursor;this.div.style.cursor=this.parent.div.style.cursor=window.getComputedStyle(t.target).cursor;const _=()=>{this._isDraggable=d,window.removeEventListener("pointerup",_),window.removeEventListener("blur",_),window.removeEventListener("pointermove",g,i),this.parent.div.style.cursor=H,this.div.style.cursor=I;const M=this.x,te=this.y,ie=this.width,Y=this.height;M===b&&te===y&&ie===f&&Y===T||this.addCommands({cmd:()=>{this.width=ie,this.height=Y,this.x=M,this.y=te;const[he,ge]=this.parentDimensions;this.setDims(he*ie,ge*Y),this.fixAndSetPosition()},undo:()=>{this.width=f,this.height=T,this.x=b,this.y=y;const[he,ge]=this.parentDimensions;this.setDims(he*f,ge*T),this.fixAndSetPosition()},mustExec:!0})};window.addEventListener("pointerup",_),window.addEventListener("blur",_)}#w(o,t){const[a,g]=this.parentDimensions,d=this.x,i=this.y,b=this.width,y=this.height,f=N.MIN_SIZE/a,T=N.MIN_SIZE/g,H=L=>Math.round(L*1e4)/1e4,I=this.#u(this.rotation),_=(L,l)=>[I[0]*L+I[2]*l,I[1]*L+I[3]*l],M=this.#u(360-this.rotation),te=(L,l)=>[M[0]*L+M[2]*l,M[1]*L+M[3]*l];let ie,Y,he=!1,ge=!1;switch(o){case"topLeft":he=!0,ie=(L,l)=>[0,0],Y=(L,l)=>[L,l];break;case"topMiddle":ie=(L,l)=>[L/2,0],Y=(L,l)=>[L/2,l];break;case"topRight":he=!0,ie=(L,l)=>[L,0],Y=(L,l)=>[0,l];break;case"middleRight":ge=!0,ie=(L,l)=>[L,l/2],Y=(L,l)=>[0,l/2];break;case"bottomRight":he=!0,ie=(L,l)=>[L,l],Y=(L,l)=>[0,0];break;case"bottomMiddle":ie=(L,l)=>[L/2,l],Y=(L,l)=>[L/2,0];break;case"bottomLeft":he=!0,ie=(L,l)=>[0,l],Y=(L,l)=>[L,0];break;case"middleLeft":ge=!0,ie=(L,l)=>[0,l/2],Y=(L,l)=>[L,l/2];break}const Ne=ie(b,y),ke=Y(b,y);let Oe=_(...ke);const Ve=H(d+Oe[0]),Ee=H(i+Oe[1]);let G=1,A=1,[m,v]=this.screenToPageTranslation(t.movementX,t.movementY);if([m,v]=te(m/a,v/g),he){const L=Math.hypot(b,y);G=A=Math.max(Math.min(Math.hypot(ke[0]-Ne[0]-m,ke[1]-Ne[1]-v)/L,1/b,1/y),f/b,T/y)}else ge?G=Math.max(f,Math.min(1,Math.abs(ke[0]-Ne[0]-m)))/b:A=Math.max(T,Math.min(1,Math.abs(ke[1]-Ne[1]-v)))/y;const C=H(b*G),V=H(y*A);Oe=_(...Y(C,V));const W=Ve-Oe[0],K=Ee-Oe[1];this.width=C,this.height=V,this.x=W,this.y=K,this.setDims(a*C,g*V),this.fixAndSetPosition()}async addAltTextButton(){if(this.#n)return;const o=this.#n=document.createElement("button");o.className="altText";const t=await N._l10nPromise.get("editor_alt_text_button_label");o.textContent=t,o.setAttribute("aria-label",t),o.tabIndex="0",o.addEventListener("contextmenu",s.noContextMenu),o.addEventListener("pointerdown",a=>a.stopPropagation()),o.addEventListener("click",a=>{a.preventDefault(),this._uiManager.editAltText(this)},{capture:!0}),o.addEventListener("keydown",a=>{a.target===o&&a.key==="Enter"&&(a.preventDefault(),this._uiManager.editAltText(this))}),this.#C(),this.div.append(o),N.SMALL_EDITOR_SIZE||(N.SMALL_EDITOR_SIZE=Math.min(128,Math.round(o.getBoundingClientRect().width*1.4)))}async#C(){const o=this.#n;if(!o)return;if(!this.#e&&!this.#t){o.classList.remove("done"),this.#r?.remove();return}N._l10nPromise.get("editor_alt_text_edit_button_label").then(a=>{o.setAttribute("aria-label",a)});let t=this.#r;if(!t){this.#r=t=document.createElement("span"),t.className="tooltip",t.setAttribute("role","tooltip");const a=t.id=`alt-text-tooltip-${this.id}`;o.setAttribute("aria-describedby",a);const g=100;o.addEventListener("mouseenter",()=>{this.#o=setTimeout(()=>{this.#o=null,this.#r.classList.add("show"),this._uiManager._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",subtype:this.editorType,data:{action:"alt_text_tooltip"}}})},g)}),o.addEventListener("mouseleave",()=>{clearTimeout(this.#o),this.#o=null,this.#r?.classList.remove("show")})}o.classList.add("done"),t.innerText=this.#t?await N._l10nPromise.get("editor_alt_text_decorative_tooltip"):this.#e,t.parentNode||o.append(t)}getClientDimensions(){return this.div.getBoundingClientRect()}get altTextData(){return{altText:this.#e,decorative:this.#t}}set altTextData({altText:o,decorative:t}){this.#e===o&&this.#t===t||(this.#e=o,this.#t=t,this.#C())}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.#l),this.div.addEventListener("focusout",this.#c);const[o,t]=this.parentDimensions;this.parentRotation%180!==0&&(this.div.style.maxWidth=`${(100*t/o).toFixed(2)}%`,this.div.style.maxHeight=`${(100*o/t).toFixed(2)}%`);const[a,g]=this.getInitialTranslation();return this.translate(a,g),(0,p.bindEvents)(this,this.div,["pointerdown"]),this.div}pointerdown(o){const{isMac:t}=e.FeatureTest.platform;if(o.button!==0||o.ctrlKey&&t){o.preventDefault();return}this.#i=!0,this.#T(o)}#T(o){if(!this._isDraggable)return;const t=this._uiManager.isSelected(this);this._uiManager.setUpDragSession();let a,g;t&&(a={passive:!0,capture:!0},g=i=>{const[b,y]=this.screenToPageTranslation(i.movementX,i.movementY);this._uiManager.dragSelectedEditors(b,y)},window.addEventListener("pointermove",g,a));const d=()=>{if(window.removeEventListener("pointerup",d),window.removeEventListener("blur",d),t&&window.removeEventListener("pointermove",g,a),this.#i=!1,!this._uiManager.endDragSession()){const{isMac:i}=e.FeatureTest.platform;o.ctrlKey&&!i||o.shiftKey||o.metaKey&&i?this.parent.toggleSelected(this):this.parent.setSelected(this)}};window.addEventListener("pointerup",d),window.addEventListener("blur",d)}moveInDOM(){this.parent?.moveEditorInDOM(this)}_setParentAndPosition(o,t,a){o.changeParent(this),this.x=t,this.y=a,this.fixAndSetPosition()}getRect(o,t){const a=this.parentScale,[g,d]=this.pageDimensions,[i,b]=this.pageTranslation,y=o/a,f=t/a,T=this.x*g,H=this.y*d,I=this.width*g,_=this.height*d;switch(this.rotation){case 0:return[T+y+i,d-H-f-_+b,T+y+I+i,d-H-f+b];case 90:return[T+f+i,d-H+y+b,T+f+_+i,d-H+y+I+b];case 180:return[T-y-I+i,d-H+f+b,T-y+i,d-H+f+_+b];case 270:return[T-f-_+i,d-H-y-I+b,T-f+i,d-H-y+b];default:throw new Error("Invalid rotation")}}getRectInCurrentCoords(o,t){const[a,g,d,i]=o,b=d-a,y=i-g;switch(this.rotation){case 0:return[a,t-i,b,y];case 90:return[a,t-g,y,b];case 180:return[d,t-g,b,y];case 270:return[d,t-i,y,b];default:throw new Error("Invalid rotation")}}onceAdded(){}isEmpty(){return!1}enableEditMode(){this.#d=!0}disableEditMode(){this.#d=!1}isInEditMode(){return this.#d}shouldGetKeyboardEvents(){return!1}needsToBeRebuilt(){return this.div&&!this.isAttachedToDOM}rebuild(){this.div?.addEventListener("focusin",this.#l),this.div?.addEventListener("focusout",this.#c)}serialize(o=!1,t=null){(0,e.unreachable)("An editor must be serializable")}static deserialize(o,t,a){const g=new this.prototype.constructor({parent:t,id:t.getNextId(),uiManager:a});g.rotation=o.rotation;const[d,i]=g.pageDimensions,[b,y,f,T]=g.getRectInCurrentCoords(o.rect,i);return g.x=b/d,g.y=y/i,g.width=f/d,g.height=T/i,g}remove(){this.div.removeEventListener("focusin",this.#l),this.div.removeEventListener("focusout",this.#c),this.isEmpty()||this.commit(),this.parent?this.parent.remove(this):this._uiManager.removeEditor(this),this.#n?.remove(),this.#n=null,this.#r=null}get isResizable(){return!1}makeResizable(){this.isResizable&&(this.#b(),this.#a.classList.remove("hidden"))}select(){this.makeResizable(),this.div?.classList.add("selectedEditor")}unselect(){this.#a?.classList.add("hidden"),this.div?.classList.remove("selectedEditor"),this.div?.contains(document.activeElement)&&this._uiManager.currentLayer.div.focus()}updateParams(o,t){}disableEditing(){this.#n&&(this.#n.hidden=!0)}enableEditing(){this.#n&&(this.#n.hidden=!1)}enterInEditMode(){}get contentDiv(){return this.div}get isEditing(){return this.#f}set isEditing(o){this.#f=o,this.parent&&(o?(this.parent.setSelected(this),this.parent.setActiveEditor(this)):this.parent.setActiveEditor(null))}setAspectRatio(o,t){this.#s=!0;const a=o/t,{style:g}=this.div;g.aspectRatio=a,g.height="auto"}static get MIN_SIZE(){return 16}}c.AnnotationEditor=N;class ee extends N{constructor(o){super(o),this.annotationElementId=o.annotationElementId,this.deleted=!0}serialize(){return{id:this.annotationElementId,deleted:!0,pageIndex:this.pageIndex}}}}),((r,c,q)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.KeyboardManager=c.CommandManager=c.ColorManager=c.AnnotationEditorUIManager=void 0,c.bindEvents=s,c.opacityToHex=N;var p=q(1),e=q(6);function s(d,i,b){for(const y of b)i.addEventListener(y,d[y].bind(d))}function N(d){return Math.round(Math.min(255,Math.max(1,255*d))).toString(16).padStart(2,"0")}class ee{#e=0;getId(){return`${p.AnnotationEditorPrefix}${this.#e++}`}}class U{#e=(0,p.getUuid)();#t=0;#n=null;static get _isSVGFittingCanvas(){const i='data:image/svg+xml;charset=UTF-8,<svg viewBox="0 0 1 1" width="1" height="1" xmlns="http://www.w3.org/2000/svg"><rect width="1" height="1" style="fill:red;"/></svg>',y=new OffscreenCanvas(1,3).getContext("2d"),f=new Image;f.src=i;const T=f.decode().then(()=>(y.drawImage(f,0,0,1,1,0,0,1,3),new Uint32Array(y.getImageData(0,0,1,1).data.buffer)[0]===0));return(0,p.shadow)(this,"_isSVGFittingCanvas",T)}async#r(i,b){this.#n||=new Map;let y=this.#n.get(i);if(y===null)return null;if(y?.bitmap)return y.refCounter+=1,y;try{y||={bitmap:null,id:`image_${this.#e}_${this.#t++}`,refCounter:0,isSvg:!1};let f;if(typeof b=="string"){y.url=b;const T=await fetch(b);if(!T.ok)throw new Error(T.statusText);f=await T.blob()}else f=y.file=b;if(f.type==="image/svg+xml"){const T=U._isSVGFittingCanvas,H=new FileReader,I=new Image,_=new Promise((M,te)=>{I.onload=()=>{y.bitmap=I,y.isSvg=!0,M()},H.onload=async()=>{const ie=y.svgUrl=H.result;I.src=await T?`${ie}#svgView(preserveAspectRatio(none))`:ie},I.onerror=H.onerror=te});H.readAsDataURL(f),await _}else y.bitmap=await createImageBitmap(f);y.refCounter=1}catch(f){console.error(f),y=null}return this.#n.set(i,y),y&&this.#n.set(y.id,y),y}async getFromFile(i){const{lastModified:b,name:y,size:f,type:T}=i;return this.#r(`${b}_${y}_${f}_${T}`,i)}async getFromUrl(i){return this.#r(i,i)}async getFromId(i){this.#n||=new Map;const b=this.#n.get(i);return b?b.bitmap?(b.refCounter+=1,b):b.file?this.getFromFile(b.file):this.getFromUrl(b.url):null}getSvgUrl(i){const b=this.#n.get(i);return b?.isSvg?b.svgUrl:null}deleteId(i){this.#n||=new Map;const b=this.#n.get(i);b&&(b.refCounter-=1,b.refCounter===0&&(b.bitmap=null))}isValidId(i){return i.startsWith(`image_${this.#e}_`)}}class o{#e=[];#t=!1;#n;#r=-1;constructor(i=128){this.#n=i}add({cmd:i,undo:b,mustExec:y,type:f=NaN,overwriteIfSameType:T=!1,keepUndo:H=!1}){if(y&&i(),this.#t)return;const I={cmd:i,undo:b,type:f};if(this.#r===-1){this.#e.length>0&&(this.#e.length=0),this.#r=0,this.#e.push(I);return}if(T&&this.#e[this.#r].type===f){H&&(I.undo=this.#e[this.#r].undo),this.#e[this.#r]=I;return}const _=this.#r+1;_===this.#n?this.#e.splice(0,1):(this.#r=_,_<this.#e.length&&this.#e.splice(_)),this.#e.push(I)}undo(){this.#r!==-1&&(this.#t=!0,this.#e[this.#r].undo(),this.#t=!1,this.#r-=1)}redo(){this.#r<this.#e.length-1&&(this.#r+=1,this.#t=!0,this.#e[this.#r].cmd(),this.#t=!1)}hasSomethingToUndo(){return this.#r!==-1}hasSomethingToRedo(){return this.#r<this.#e.length-1}destroy(){this.#e=null}}c.CommandManager=o;class t{constructor(i){this.buffer=[],this.callbacks=new Map,this.allKeys=new Set;const{isMac:b}=p.FeatureTest.platform;for(const[y,f,T={}]of i)for(const H of y){const I=H.startsWith("mac+");b&&I?(this.callbacks.set(H.slice(4),{callback:f,options:T}),this.allKeys.add(H.split("+").at(-1))):!b&&!I&&(this.callbacks.set(H,{callback:f,options:T}),this.allKeys.add(H.split("+").at(-1)))}}#e(i){i.altKey&&this.buffer.push("alt"),i.ctrlKey&&this.buffer.push("ctrl"),i.metaKey&&this.buffer.push("meta"),i.shiftKey&&this.buffer.push("shift"),this.buffer.push(i.key);const b=this.buffer.join("+");return this.buffer.length=0,b}exec(i,b){if(!this.allKeys.has(b.key))return;const y=this.callbacks.get(this.#e(b));if(!y)return;const{callback:f,options:{bubbles:T=!1,args:H=[],checker:I=null}}=y;I&&!I(i,b)||(f.bind(i,...H)(),T||(b.stopPropagation(),b.preventDefault()))}}c.KeyboardManager=t;class a{static _colorsMapping=new Map([["CanvasText",[0,0,0]],["Canvas",[255,255,255]]]);get _colors(){const i=new Map([["CanvasText",null],["Canvas",null]]);return(0,e.getColorValues)(i),(0,p.shadow)(this,"_colors",i)}convert(i){const b=(0,e.getRGB)(i);if(!window.matchMedia("(forced-colors: active)").matches)return b;for(const[y,f]of this._colors)if(f.every((T,H)=>T===b[H]))return a._colorsMapping.get(y);return b}getHexCode(i){const b=this._colors.get(i);return b?p.Util.makeHexColor(...b):i}}c.ColorManager=a;class g{#e=null;#t=new Map;#n=new Map;#r=null;#o=null;#s=new o;#a=0;#l=new Set;#c=null;#i=null;#f=new Set;#d=null;#h=new ee;#p=!1;#v=!1;#m=null;#g=p.AnnotationEditorType.NONE;#u=new Set;#b=null;#E=this.blur.bind(this);#w=this.focus.bind(this);#C=this.copy.bind(this);#T=this.cut.bind(this);#O=this.paste.bind(this);#D=this.keydown.bind(this);#I=this.onEditingAction.bind(this);#_=this.onPageChanging.bind(this);#L=this.onScaleChanging.bind(this);#k=this.onRotationChanging.bind(this);#M={isEditing:!1,isEmpty:!0,hasSomethingToUndo:!1,hasSomethingToRedo:!1,hasSelectedEditor:!1};#y=[0,0];#R=null;#A=null;#N=null;static TRANSLATE_SMALL=1;static TRANSLATE_BIG=10;static get _keyboardManager(){const i=g.prototype,b=T=>{const{activeElement:H}=document;return H&&T.#A.contains(H)&&T.hasSomethingToControl()},y=this.TRANSLATE_SMALL,f=this.TRANSLATE_BIG;return(0,p.shadow)(this,"_keyboardManager",new t([[["ctrl+a","mac+meta+a"],i.selectAll],[["ctrl+z","mac+meta+z"],i.undo],[["ctrl+y","ctrl+shift+z","mac+meta+shift+z","ctrl+shift+Z","mac+meta+shift+Z"],i.redo],[["Backspace","alt+Backspace","ctrl+Backspace","shift+Backspace","mac+Backspace","mac+alt+Backspace","mac+ctrl+Backspace","Delete","ctrl+Delete","shift+Delete","mac+Delete"],i.delete],[["Escape","mac+Escape"],i.unselectAll],[["ArrowLeft","mac+ArrowLeft"],i.translateSelectedEditors,{args:[-y,0],checker:b}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],i.translateSelectedEditors,{args:[-f,0],checker:b}],[["ArrowRight","mac+ArrowRight"],i.translateSelectedEditors,{args:[y,0],checker:b}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],i.translateSelectedEditors,{args:[f,0],checker:b}],[["ArrowUp","mac+ArrowUp"],i.translateSelectedEditors,{args:[0,-y],checker:b}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],i.translateSelectedEditors,{args:[0,-f],checker:b}],[["ArrowDown","mac+ArrowDown"],i.translateSelectedEditors,{args:[0,y],checker:b}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],i.translateSelectedEditors,{args:[0,f],checker:b}]]))}constructor(i,b,y,f,T,H){this.#A=i,this.#N=b,this.#r=y,this._eventBus=f,this._eventBus._on("editingaction",this.#I),this._eventBus._on("pagechanging",this.#_),this._eventBus._on("scalechanging",this.#L),this._eventBus._on("rotationchanging",this.#k),this.#o=T.annotationStorage,this.#d=T.filterFactory,this.#b=H,this.viewParameters={realScale:e.PixelsPerInch.PDF_TO_CSS_UNITS,rotation:0}}destroy(){this.#x(),this.#H(),this._eventBus._off("editingaction",this.#I),this._eventBus._off("pagechanging",this.#_),this._eventBus._off("scalechanging",this.#L),this._eventBus._off("rotationchanging",this.#k);for(const i of this.#n.values())i.destroy();this.#n.clear(),this.#t.clear(),this.#f.clear(),this.#e=null,this.#u.clear(),this.#s.destroy(),this.#r.destroy()}get hcmFilter(){return(0,p.shadow)(this,"hcmFilter",this.#b?this.#d.addHCMFilter(this.#b.foreground,this.#b.background):"none")}get direction(){return(0,p.shadow)(this,"direction",getComputedStyle(this.#A).direction)}editAltText(i){this.#r?.editAltText(this,i)}onPageChanging({pageNumber:i}){this.#a=i-1}focusMainContainer(){this.#A.focus()}findParent(i,b){for(const y of this.#n.values()){const{x:f,y:T,width:H,height:I}=y.div.getBoundingClientRect();if(i>=f&&i<=f+H&&b>=T&&b<=T+I)return y}return null}disableUserSelect(i=!1){this.#N.classList.toggle("noUserSelect",i)}addShouldRescale(i){this.#f.add(i)}removeShouldRescale(i){this.#f.delete(i)}onScaleChanging({scale:i}){this.commitOrRemove(),this.viewParameters.realScale=i*e.PixelsPerInch.PDF_TO_CSS_UNITS;for(const b of this.#f)b.onScaleChanging()}onRotationChanging({pagesRotation:i}){this.commitOrRemove(),this.viewParameters.rotation=i}addToAnnotationStorage(i){!i.isEmpty()&&this.#o&&!this.#o.has(i.id)&&this.#o.setValue(i.id,i)}#B(){window.addEventListener("focus",this.#w),window.addEventListener("blur",this.#E)}#H(){window.removeEventListener("focus",this.#w),window.removeEventListener("blur",this.#E)}blur(){if(!this.hasSelection)return;const{activeElement:i}=document;for(const b of this.#u)if(b.div.contains(i)){this.#m=[b,i],b._focusEventsAllowed=!1;break}}focus(){if(!this.#m)return;const[i,b]=this.#m;this.#m=null,b.addEventListener("focusin",()=>{i._focusEventsAllowed=!0},{once:!0}),b.focus()}#V(){window.addEventListener("keydown",this.#D,{capture:!0})}#x(){window.removeEventListener("keydown",this.#D,{capture:!0})}#F(){document.addEventListener("copy",this.#C),document.addEventListener("cut",this.#T),document.addEventListener("paste",this.#O)}#P(){document.removeEventListener("copy",this.#C),document.removeEventListener("cut",this.#T),document.removeEventListener("paste",this.#O)}addEditListeners(){this.#V(),this.#F()}removeEditListeners(){this.#x(),this.#P()}copy(i){if(i.preventDefault(),this.#e?.commitOrRemove(),!this.hasSelection)return;const b=[];for(const y of this.#u){const f=y.serialize(!0);f&&b.push(f)}b.length!==0&&i.clipboardData.setData("application/pdfjs",JSON.stringify(b))}cut(i){this.copy(i),this.delete()}paste(i){i.preventDefault();const{clipboardData:b}=i;for(const T of b.items)for(const H of this.#i)if(H.isHandlingMimeForPasting(T.type)){H.paste(T,this.currentLayer);return}let y=b.getData("application/pdfjs");if(!y)return;try{y=JSON.parse(y)}catch(T){(0,p.warn)(`paste: "${T.message}".`);return}if(!Array.isArray(y))return;this.unselectAll();const f=this.currentLayer;try{const T=[];for(const _ of y){const M=f.deserialize(_);if(!M)return;T.push(M)}const H=()=>{for(const _ of T)this.#U(_);this.#z(T)},I=()=>{for(const _ of T)_.remove()};this.addCommands({cmd:H,undo:I,mustExec:!0})}catch(T){(0,p.warn)(`paste: "${T.message}".`)}}keydown(i){this.getActive()?.shouldGetKeyboardEvents()||g._keyboardManager.exec(this,i)}onEditingAction(i){["undo","redo","delete","selectAll"].includes(i.name)&&this[i.name]()}#S(i){Object.entries(i).some(([y,f])=>this.#M[y]!==f)&&this._eventBus.dispatch("annotationeditorstateschanged",{source:this,details:Object.assign(this.#M,i)})}#W(i){this._eventBus.dispatch("annotationeditorparamschanged",{source:this,details:i})}setEditingState(i){i?(this.#B(),this.#V(),this.#F(),this.#S({isEditing:this.#g!==p.AnnotationEditorType.NONE,isEmpty:this.#j(),hasSomethingToUndo:this.#s.hasSomethingToUndo(),hasSomethingToRedo:this.#s.hasSomethingToRedo(),hasSelectedEditor:!1})):(this.#H(),this.#x(),this.#P(),this.#S({isEditing:!1}),this.disableUserSelect(!1))}registerEditorTypes(i){if(!this.#i){this.#i=i;for(const b of this.#i)this.#W(b.defaultPropertiesToUpdate)}}getId(){return this.#h.getId()}get currentLayer(){return this.#n.get(this.#a)}getLayer(i){return this.#n.get(i)}get currentPageIndex(){return this.#a}addLayer(i){this.#n.set(i.pageIndex,i),this.#p?i.enable():i.disable()}removeLayer(i){this.#n.delete(i.pageIndex)}updateMode(i,b=null){if(this.#g!==i){if(this.#g=i,i===p.AnnotationEditorType.NONE){this.setEditingState(!1),this.#G();return}this.setEditingState(!0),this.#q(),this.unselectAll();for(const y of this.#n.values())y.updateMode(i);if(b){for(const y of this.#t.values())if(y.annotationElementId===b){this.setSelected(y),y.enterInEditMode();break}}}}updateToolbar(i){i!==this.#g&&this._eventBus.dispatch("switchannotationeditormode",{source:this,mode:i})}updateParams(i,b){if(this.#i){if(i===p.AnnotationEditorParamsType.CREATE){this.currentLayer.addNewEditor(i);return}for(const y of this.#u)y.updateParams(i,b);for(const y of this.#i)y.updateDefaultParams(i,b)}}enableWaiting(i=!1){if(this.#v!==i){this.#v=i;for(const b of this.#n.values())i?b.disableClick():b.enableClick(),b.div.classList.toggle("waiting",i)}}#q(){if(!this.#p){this.#p=!0;for(const i of this.#n.values())i.enable()}}#G(){if(this.unselectAll(),this.#p){this.#p=!1;for(const i of this.#n.values())i.disable()}}getEditors(i){const b=[];for(const y of this.#t.values())y.pageIndex===i&&b.push(y);return b}getEditor(i){return this.#t.get(i)}addEditor(i){this.#t.set(i.id,i)}removeEditor(i){this.#t.delete(i.id),this.unselect(i),(!i.annotationElementId||!this.#l.has(i.annotationElementId))&&this.#o?.remove(i.id)}addDeletedAnnotationElement(i){this.#l.add(i.annotationElementId),i.deleted=!0}isDeletedAnnotationElement(i){return this.#l.has(i)}removeDeletedAnnotationElement(i){this.#l.delete(i.annotationElementId),i.deleted=!1}#U(i){const b=this.#n.get(i.pageIndex);b?b.addOrRebuild(i):this.addEditor(i)}setActiveEditor(i){this.#e!==i&&(this.#e=i,i&&this.#W(i.propertiesToUpdate))}toggleSelected(i){if(this.#u.has(i)){this.#u.delete(i),i.unselect(),this.#S({hasSelectedEditor:this.hasSelection});return}this.#u.add(i),i.select(),this.#W(i.propertiesToUpdate),this.#S({hasSelectedEditor:!0})}setSelected(i){for(const b of this.#u)b!==i&&b.unselect();this.#u.clear(),this.#u.add(i),i.select(),this.#W(i.propertiesToUpdate),this.#S({hasSelectedEditor:!0})}isSelected(i){return this.#u.has(i)}unselect(i){i.unselect(),this.#u.delete(i),this.#S({hasSelectedEditor:this.hasSelection})}get hasSelection(){return this.#u.size!==0}undo(){this.#s.undo(),this.#S({hasSomethingToUndo:this.#s.hasSomethingToUndo(),hasSomethingToRedo:!0,isEmpty:this.#j()})}redo(){this.#s.redo(),this.#S({hasSomethingToUndo:!0,hasSomethingToRedo:this.#s.hasSomethingToRedo(),isEmpty:this.#j()})}addCommands(i){this.#s.add(i),this.#S({hasSomethingToUndo:!0,hasSomethingToRedo:!1,isEmpty:this.#j()})}#j(){if(this.#t.size===0)return!0;if(this.#t.size===1)for(const i of this.#t.values())return i.isEmpty();return!1}delete(){if(this.commitOrRemove(),!this.hasSelection)return;const i=[...this.#u],b=()=>{for(const f of i)f.remove()},y=()=>{for(const f of i)this.#U(f)};this.addCommands({cmd:b,undo:y,mustExec:!0})}commitOrRemove(){this.#e?.commitOrRemove()}hasSomethingToControl(){return this.#e||this.hasSelection}#z(i){this.#u.clear();for(const b of i)b.isEmpty()||(this.#u.add(b),b.select());this.#S({hasSelectedEditor:!0})}selectAll(){for(const i of this.#u)i.commit();this.#z(this.#t.values())}unselectAll(){if(this.#e){this.#e.commitOrRemove();return}if(this.hasSelection){for(const i of this.#u)i.unselect();this.#u.clear(),this.#S({hasSelectedEditor:!1})}}translateSelectedEditors(i,b,y=!1){if(y||this.commitOrRemove(),!this.hasSelection)return;this.#y[0]+=i,this.#y[1]+=b;const[f,T]=this.#y,H=[...this.#u],I=1e3;this.#R&&clearTimeout(this.#R),this.#R=setTimeout(()=>{this.#R=null,this.#y[0]=this.#y[1]=0,this.addCommands({cmd:()=>{for(const _ of H)this.#t.has(_.id)&&_.translateInPage(f,T)},undo:()=>{for(const _ of H)this.#t.has(_.id)&&_.translateInPage(-f,-T)},mustExec:!1})},I);for(const _ of H)_.translateInPage(i,b)}setUpDragSession(){if(this.hasSelection){this.disableUserSelect(!0),this.#c=new Map;for(const i of this.#u)this.#c.set(i,{savedX:i.x,savedY:i.y,savedPageIndex:i.pageIndex,newX:0,newY:0,newPageIndex:-1})}}endDragSession(){if(!this.#c)return!1;this.disableUserSelect(!1);const i=this.#c;this.#c=null;let b=!1;for(const[{x:f,y:T,pageIndex:H},I]of i)I.newX=f,I.newY=T,I.newPageIndex=H,b||=f!==I.savedX||T!==I.savedY||H!==I.savedPageIndex;if(!b)return!1;const y=(f,T,H,I)=>{if(this.#t.has(f.id)){const _=this.#n.get(I);_?f._setParentAndPosition(_,T,H):(f.pageIndex=I,f.x=T,f.y=H)}};return this.addCommands({cmd:()=>{for(const[f,{newX:T,newY:H,newPageIndex:I}]of i)y(f,T,H,I)},undo:()=>{for(const[f,{savedX:T,savedY:H,savedPageIndex:I}]of i)y(f,T,H,I)},mustExec:!0}),!0}dragSelectedEditors(i,b){if(this.#c)for(const y of this.#c.keys())y.drag(i,b)}rebuild(i){if(i.parent===null){const b=this.getLayer(i.pageIndex);b?(b.changeParent(i),b.addOrRebuild(i)):(this.addEditor(i),this.addToAnnotationStorage(i),i.rebuild())}else i.parent.addOrRebuild(i)}isActive(i){return this.#e===i}getActive(){return this.#e}getMode(){return this.#g}get imageManager(){return(0,p.shadow)(this,"imageManager",new U)}}c.AnnotationEditorUIManager=g}),((r,c,q)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.StatTimer=c.RenderingCancelledException=c.PixelsPerInch=c.PageViewport=c.PDFDateString=c.DOMStandardFontDataFactory=c.DOMSVGFactory=c.DOMFilterFactory=c.DOMCanvasFactory=c.DOMCMapReaderFactory=void 0,c.deprecated=te,c.getColorValues=Ne,c.getCurrentTransform=ke,c.getCurrentTransformInverse=Oe,c.getFilenameFromUrl=f,c.getPdfFilenameFromUrl=T,c.getRGB=ge,c.getXfaPageViewport=he,c.isDataScheme=b,c.isPdfFile=y,c.isValidFetchUrl=I,c.loadScript=M,c.noContextMenu=_,c.setLayerDimensions=Ve;var p=q(7),e=q(1);const s="http://www.w3.org/2000/svg";class N{static CSS=96;static PDF=72;static PDF_TO_CSS_UNITS=this.CSS/this.PDF}c.PixelsPerInch=N;class ee extends p.BaseFilterFactory{#e;#t;#n;#r;#o;#s;#a;#l;#c;#i;#f=0;constructor({docId:G,ownerDocument:A=globalThis.document}={}){super(),this.#n=G,this.#r=A}get#d(){return this.#e||=new Map}get#h(){if(!this.#t){const G=this.#r.createElement("div"),{style:A}=G;A.visibility="hidden",A.contain="strict",A.width=A.height=0,A.position="absolute",A.top=A.left=0,A.zIndex=-1;const m=this.#r.createElementNS(s,"svg");m.setAttribute("width",0),m.setAttribute("height",0),this.#t=this.#r.createElementNS(s,"defs"),G.append(m),m.append(this.#t),this.#r.body.append(G)}return this.#t}addFilter(G){if(!G)return"none";let A=this.#d.get(G);if(A)return A;let m,v,C,V;if(G.length===1){const l=G[0],S=new Array(256);for(let R=0;R<256;R++)S[R]=l[R]/255;V=m=v=C=S.join(",")}else{const[l,S,R]=G,O=new Array(256),B=new Array(256),Z=new Array(256);for(let re=0;re<256;re++)O[re]=l[re]/255,B[re]=S[re]/255,Z[re]=R[re]/255;m=O.join(","),v=B.join(","),C=Z.join(","),V=`${m}${v}${C}`}if(A=this.#d.get(V),A)return this.#d.set(G,A),A;const W=`g_${this.#n}_transfer_map_${this.#f++}`,K=`url(#${W})`;this.#d.set(G,K),this.#d.set(V,K);const L=this.#v(W);return this.#g(m,v,C,L),K}addHCMFilter(G,A){const m=`${G}-${A}`;if(this.#s===m)return this.#a;if(this.#s=m,this.#a="none",this.#o?.remove(),!G||!A)return this.#a;const v=this.#u(G);G=e.Util.makeHexColor(...v);const C=this.#u(A);if(A=e.Util.makeHexColor(...C),this.#h.style.color="",G==="#000000"&&A==="#ffffff"||G===A)return this.#a;const V=new Array(256);for(let S=0;S<=255;S++){const R=S/255;V[S]=R<=.03928?R/12.92:((R+.055)/1.055)**2.4}const W=V.join(","),K=`g_${this.#n}_hcm_filter`,L=this.#l=this.#v(K);this.#g(W,W,W,L),this.#p(L);const l=(S,R)=>{const O=v[S]/255,B=C[S]/255,Z=new Array(R+1);for(let re=0;re<=R;re++)Z[re]=O+re/R*(B-O);return Z.join(",")};return this.#g(l(0,5),l(1,5),l(2,5),L),this.#a=`url(#${K})`,this.#a}addHighlightHCMFilter(G,A,m,v){const C=`${G}-${A}-${m}-${v}`;if(this.#c===C)return this.#i;if(this.#c=C,this.#i="none",this.#l?.remove(),!G||!A)return this.#i;const[V,W]=[G,A].map(this.#u.bind(this));let K=Math.round(.2126*V[0]+.7152*V[1]+.0722*V[2]),L=Math.round(.2126*W[0]+.7152*W[1]+.0722*W[2]),[l,S]=[m,v].map(this.#u.bind(this));L<K&&([K,L,l,S]=[L,K,S,l]),this.#h.style.color="";const R=(Z,re,me)=>{const We=new Array(256),ve=(L-K)/me,ye=Z/255,Ce=(re-Z)/(255*me);let Re=0;for(let xe=0;xe<=me;xe++){const qe=Math.round(K+xe*ve),tt=ye+xe*Ce;for(let lt=Re;lt<=qe;lt++)We[lt]=tt;Re=qe+1}for(let xe=Re;xe<256;xe++)We[xe]=We[Re-1];return We.join(",")},O=`g_${this.#n}_hcm_highlight_filter`,B=this.#l=this.#v(O);return this.#p(B),this.#g(R(l[0],S[0],5),R(l[1],S[1],5),R(l[2],S[2],5),B),this.#i=`url(#${O})`,this.#i}destroy(G=!1){G&&(this.#a||this.#i)||(this.#t&&(this.#t.parentNode.parentNode.remove(),this.#t=null),this.#e&&(this.#e.clear(),this.#e=null),this.#f=0)}#p(G){const A=this.#r.createElementNS(s,"feColorMatrix");A.setAttribute("type","matrix"),A.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"),G.append(A)}#v(G){const A=this.#r.createElementNS(s,"filter");return A.setAttribute("color-interpolation-filters","sRGB"),A.setAttribute("id",G),this.#h.append(A),A}#m(G,A,m){const v=this.#r.createElementNS(s,A);v.setAttribute("type","discrete"),v.setAttribute("tableValues",m),G.append(v)}#g(G,A,m,v){const C=this.#r.createElementNS(s,"feComponentTransfer");v.append(C),this.#m(C,"feFuncR",G),this.#m(C,"feFuncG",A),this.#m(C,"feFuncB",m)}#u(G){return this.#h.style.color=G,ge(getComputedStyle(this.#h).getPropertyValue("color"))}}c.DOMFilterFactory=ee;class U extends p.BaseCanvasFactory{constructor({ownerDocument:G=globalThis.document}={}){super(),this._document=G}_createCanvas(G,A){const m=this._document.createElement("canvas");return m.width=G,m.height=A,m}}c.DOMCanvasFactory=U;async function o(Ee,G=!1){if(I(Ee,document.baseURI)){const A=await fetch(Ee);if(!A.ok)throw new Error(A.statusText);return G?new Uint8Array(await A.arrayBuffer()):(0,e.stringToBytes)(await A.text())}return new Promise((A,m)=>{const v=new XMLHttpRequest;v.open("GET",Ee,!0),G&&(v.responseType="arraybuffer"),v.onreadystatechange=()=>{if(v.readyState===XMLHttpRequest.DONE){if(v.status===200||v.status===0){let C;if(G&&v.response?C=new Uint8Array(v.response):!G&&v.responseText&&(C=(0,e.stringToBytes)(v.responseText)),C){A(C);return}}m(new Error(v.statusText))}},v.send(null)})}class t extends p.BaseCMapReaderFactory{_fetchData(G,A){return o(G,this.isCompressed).then(m=>({cMapData:m,compressionType:A}))}}c.DOMCMapReaderFactory=t;class a extends p.BaseStandardFontDataFactory{_fetchData(G){return o(G,!0)}}c.DOMStandardFontDataFactory=a;class g extends p.BaseSVGFactory{_createSVG(G){return document.createElementNS(s,G)}}c.DOMSVGFactory=g;class d{constructor({viewBox:G,scale:A,rotation:m,offsetX:v=0,offsetY:C=0,dontFlip:V=!1}){this.viewBox=G,this.scale=A,this.rotation=m,this.offsetX=v,this.offsetY=C;const W=(G[2]+G[0])/2,K=(G[3]+G[1])/2;let L,l,S,R;switch(m%=360,m<0&&(m+=360),m){case 180:L=-1,l=0,S=0,R=1;break;case 90:L=0,l=1,S=1,R=0;break;case 270:L=0,l=-1,S=-1,R=0;break;case 0:L=1,l=0,S=0,R=-1;break;default:throw new Error("PageViewport: Invalid rotation, must be a multiple of 90 degrees.")}V&&(S=-S,R=-R);let O,B,Z,re;L===0?(O=Math.abs(K-G[1])*A+v,B=Math.abs(W-G[0])*A+C,Z=(G[3]-G[1])*A,re=(G[2]-G[0])*A):(O=Math.abs(W-G[0])*A+v,B=Math.abs(K-G[1])*A+C,Z=(G[2]-G[0])*A,re=(G[3]-G[1])*A),this.transform=[L*A,l*A,S*A,R*A,O-L*A*W-S*A*K,B-l*A*W-R*A*K],this.width=Z,this.height=re}get rawDims(){const{viewBox:G}=this;return(0,e.shadow)(this,"rawDims",{pageWidth:G[2]-G[0],pageHeight:G[3]-G[1],pageX:G[0],pageY:G[1]})}clone({scale:G=this.scale,rotation:A=this.rotation,offsetX:m=this.offsetX,offsetY:v=this.offsetY,dontFlip:C=!1}={}){return new d({viewBox:this.viewBox.slice(),scale:G,rotation:A,offsetX:m,offsetY:v,dontFlip:C})}convertToViewportPoint(G,A){return e.Util.applyTransform([G,A],this.transform)}convertToViewportRectangle(G){const A=e.Util.applyTransform([G[0],G[1]],this.transform),m=e.Util.applyTransform([G[2],G[3]],this.transform);return[A[0],A[1],m[0],m[1]]}convertToPdfPoint(G,A){return e.Util.applyInverseTransform([G,A],this.transform)}}c.PageViewport=d;class i extends e.BaseException{constructor(G,A=0){super(G,"RenderingCancelledException"),this.extraDelay=A}}c.RenderingCancelledException=i;function b(Ee){const G=Ee.length;let A=0;for(;A<G&&Ee[A].trim()==="";)A++;return Ee.substring(A,A+5).toLowerCase()==="data:"}function y(Ee){return typeof Ee=="string"&&/\.pdf$/i.test(Ee)}function f(Ee,G=!1){return G||([Ee]=Ee.split(/[#?]/,1)),Ee.substring(Ee.lastIndexOf("/")+1)}function T(Ee,G="document.pdf"){if(typeof Ee!="string")return G;if(b(Ee))return(0,e.warn)('getPdfFilenameFromUrl: ignore "data:"-URL for performance reasons.'),G;const A=/^(?:(?:[^:]+:)?\/\/[^/]+)?([^?#]*)(\?[^#]*)?(#.*)?$/,m=/[^/?#=]+\.pdf\b(?!.*\.pdf\b)/i,v=A.exec(Ee);let C=m.exec(v[1])||m.exec(v[2])||m.exec(v[3]);if(C&&(C=C[0],C.includes("%")))try{C=m.exec(decodeURIComponent(C))[0]}catch{}return C||G}class H{started=Object.create(null);times=[];time(G){G in this.started&&(0,e.warn)(`Timer is already running for ${G}`),this.started[G]=Date.now()}timeEnd(G){G in this.started||(0,e.warn)(`Timer has not been started for ${G}`),this.times.push({name:G,start:this.started[G],end:Date.now()}),delete this.started[G]}toString(){const G=[];let A=0;for(const{name:m}of this.times)A=Math.max(m.length,A);for(const{name:m,start:v,end:C}of this.times)G.push(`${m.padEnd(A)} ${C-v}ms
|
|
2
|
+
`);return G.join("")}}c.StatTimer=H;function I(Ee,G){try{const{protocol:A}=G?new URL(Ee,G):new URL(Ee);return A==="http:"||A==="https:"}catch{return!1}}function _(Ee){Ee.preventDefault()}function M(Ee,G=!1){return new Promise((A,m)=>{const v=document.createElement("script");v.src=Ee,v.onload=function(C){G&&v.remove(),A(C)},v.onerror=function(){m(new Error(`Cannot load script at: ${v.src}`))},(document.head||document.documentElement).append(v)})}function te(Ee){console.log("Deprecated API usage: "+Ee)}let ie;class Y{static toDateObject(G){if(!G||typeof G!="string")return null;ie||=new RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+|-])?(\\d{2})?'?(\\d{2})?'?");const A=ie.exec(G);if(!A)return null;const m=parseInt(A[1],10);let v=parseInt(A[2],10);v=v>=1&&v<=12?v-1:0;let C=parseInt(A[3],10);C=C>=1&&C<=31?C:1;let V=parseInt(A[4],10);V=V>=0&&V<=23?V:0;let W=parseInt(A[5],10);W=W>=0&&W<=59?W:0;let K=parseInt(A[6],10);K=K>=0&&K<=59?K:0;const L=A[7]||"Z";let l=parseInt(A[8],10);l=l>=0&&l<=23?l:0;let S=parseInt(A[9],10)||0;return S=S>=0&&S<=59?S:0,L==="-"?(V+=l,W+=S):L==="+"&&(V-=l,W-=S),new Date(Date.UTC(m,v,C,V,W,K))}}c.PDFDateString=Y;function he(Ee,{scale:G=1,rotation:A=0}){const{width:m,height:v}=Ee.attributes.style,C=[0,0,parseInt(m),parseInt(v)];return new d({viewBox:C,scale:G,rotation:A})}function ge(Ee){if(Ee.startsWith("#")){const G=parseInt(Ee.slice(1),16);return[(G&16711680)>>16,(G&65280)>>8,G&255]}return Ee.startsWith("rgb(")?Ee.slice(4,-1).split(",").map(G=>parseInt(G)):Ee.startsWith("rgba(")?Ee.slice(5,-1).split(",").map(G=>parseInt(G)).slice(0,3):((0,e.warn)(`Not a valid color format: "${Ee}"`),[0,0,0])}function Ne(Ee){const G=document.createElement("span");G.style.visibility="hidden",document.body.append(G);for(const A of Ee.keys()){G.style.color=A;const m=window.getComputedStyle(G).color;Ee.set(A,ge(m))}G.remove()}function ke(Ee){const{a:G,b:A,c:m,d:v,e:C,f:V}=Ee.getTransform();return[G,A,m,v,C,V]}function Oe(Ee){const{a:G,b:A,c:m,d:v,e:C,f:V}=Ee.getTransform().invertSelf();return[G,A,m,v,C,V]}function Ve(Ee,G,A=!1,m=!0){if(G instanceof d){const{pageWidth:v,pageHeight:C}=G.rawDims,{style:V}=Ee,W=e.FeatureTest.isCSSRoundSupported,K=`var(--scale-factor) * ${v}px`,L=`var(--scale-factor) * ${C}px`,l=W?`round(${K}, 1px)`:`calc(${K})`,S=W?`round(${L}, 1px)`:`calc(${L})`;!A||G.rotation%180===0?(V.width=l,V.height=S):(V.width=S,V.height=l)}m&&Ee.setAttribute("data-main-rotation",G.rotation)}}),((r,c,q)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.BaseStandardFontDataFactory=c.BaseSVGFactory=c.BaseFilterFactory=c.BaseCanvasFactory=c.BaseCMapReaderFactory=void 0;var p=q(1);class e{constructor(){this.constructor===e&&(0,p.unreachable)("Cannot initialize BaseFilterFactory.")}addFilter(t){return"none"}addHCMFilter(t,a){return"none"}addHighlightHCMFilter(t,a,g,d){return"none"}destroy(t=!1){}}c.BaseFilterFactory=e;class s{constructor(){this.constructor===s&&(0,p.unreachable)("Cannot initialize BaseCanvasFactory.")}create(t,a){if(t<=0||a<=0)throw new Error("Invalid canvas size");const g=this._createCanvas(t,a);return{canvas:g,context:g.getContext("2d")}}reset(t,a,g){if(!t.canvas)throw new Error("Canvas is not specified");if(a<=0||g<=0)throw new Error("Invalid canvas size");t.canvas.width=a,t.canvas.height=g}destroy(t){if(!t.canvas)throw new Error("Canvas is not specified");t.canvas.width=0,t.canvas.height=0,t.canvas=null,t.context=null}_createCanvas(t,a){(0,p.unreachable)("Abstract method `_createCanvas` called.")}}c.BaseCanvasFactory=s;class N{constructor({baseUrl:t=null,isCompressed:a=!0}){this.constructor===N&&(0,p.unreachable)("Cannot initialize BaseCMapReaderFactory."),this.baseUrl=t,this.isCompressed=a}async fetch({name:t}){if(!this.baseUrl)throw new Error('The CMap "baseUrl" parameter must be specified, ensure that the "cMapUrl" and "cMapPacked" API parameters are provided.');if(!t)throw new Error("CMap name must be specified.");const a=this.baseUrl+t+(this.isCompressed?".bcmap":""),g=this.isCompressed?p.CMapCompressionType.BINARY:p.CMapCompressionType.NONE;return this._fetchData(a,g).catch(d=>{throw new Error(`Unable to load ${this.isCompressed?"binary ":""}CMap at: ${a}`)})}_fetchData(t,a){(0,p.unreachable)("Abstract method `_fetchData` called.")}}c.BaseCMapReaderFactory=N;class ee{constructor({baseUrl:t=null}){this.constructor===ee&&(0,p.unreachable)("Cannot initialize BaseStandardFontDataFactory."),this.baseUrl=t}async fetch({filename:t}){if(!this.baseUrl)throw new Error('The standard font "baseUrl" parameter must be specified, ensure that the "standardFontDataUrl" API parameter is provided.');if(!t)throw new Error("Font filename must be specified.");const a=`${this.baseUrl}${t}`;return this._fetchData(a).catch(g=>{throw new Error(`Unable to load font data at: ${a}`)})}_fetchData(t){(0,p.unreachable)("Abstract method `_fetchData` called.")}}c.BaseStandardFontDataFactory=ee;class U{constructor(){this.constructor===U&&(0,p.unreachable)("Cannot initialize BaseSVGFactory.")}create(t,a,g=!1){if(t<=0||a<=0)throw new Error("Invalid SVG dimensions");const d=this._createSVG("svg:svg");return d.setAttribute("version","1.1"),g||(d.setAttribute("width",`${t}px`),d.setAttribute("height",`${a}px`)),d.setAttribute("preserveAspectRatio","none"),d.setAttribute("viewBox",`0 0 ${t} ${a}`),d}createElement(t){if(typeof t!="string")throw new Error("Invalid SVG element type");return this._createSVG(t)}_createSVG(t){(0,p.unreachable)("Abstract method `_createSVG` called.")}}c.BaseSVGFactory=U}),((r,c,q)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.MurmurHash3_64=void 0;var p=q(1);const e=3285377520,s=4294901760,N=65535;class ee{constructor(o){this.h1=o?o&4294967295:e,this.h2=o?o&4294967295:e}update(o){let t,a;if(typeof o=="string"){t=new Uint8Array(o.length*2),a=0;for(let te=0,ie=o.length;te<ie;te++){const Y=o.charCodeAt(te);Y<=255?t[a++]=Y:(t[a++]=Y>>>8,t[a++]=Y&255)}}else if((0,p.isArrayBuffer)(o))t=o.slice(),a=t.byteLength;else throw new Error("Wrong data format in MurmurHash3_64_update. Input must be a string or array.");const g=a>>2,d=a-g*4,i=new Uint32Array(t.buffer,0,g);let b=0,y=0,f=this.h1,T=this.h2;const H=3432918353,I=461845907,_=H&N,M=I&N;for(let te=0;te<g;te++)te&1?(b=i[te],b=b*H&s|b*_&N,b=b<<15|b>>>17,b=b*I&s|b*M&N,f^=b,f=f<<13|f>>>19,f=f*5+3864292196):(y=i[te],y=y*H&s|y*_&N,y=y<<15|y>>>17,y=y*I&s|y*M&N,T^=y,T=T<<13|T>>>19,T=T*5+3864292196);switch(b=0,d){case 3:b^=t[g*4+2]<<16;case 2:b^=t[g*4+1]<<8;case 1:b^=t[g*4],b=b*H&s|b*_&N,b=b<<15|b>>>17,b=b*I&s|b*M&N,g&1?f^=b:T^=b}this.h1=f,this.h2=T}hexdigest(){let o=this.h1,t=this.h2;return o^=t>>>1,o=o*3981806797&s|o*36045&N,t=t*4283543511&s|((t<<16|o>>>16)*2950163797&s)>>>16,o^=t>>>1,o=o*444984403&s|o*60499&N,t=t*3301882366&s|((t<<16|o>>>16)*3120437893&s)>>>16,o^=t>>>1,(o>>>0).toString(16).padStart(8,"0")+(t>>>0).toString(16).padStart(8,"0")}}c.MurmurHash3_64=ee}),((r,c,q)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.FontLoader=c.FontFaceObject=void 0;var p=q(1);class e{#e=new Set;constructor({ownerDocument:ee=globalThis.document,styleElement:U=null}){this._document=ee,this.nativeFontFaces=new Set,this.styleElement=null,this.loadingRequests=[],this.loadTestFontId=0}addNativeFontFace(ee){this.nativeFontFaces.add(ee),this._document.fonts.add(ee)}removeNativeFontFace(ee){this.nativeFontFaces.delete(ee),this._document.fonts.delete(ee)}insertRule(ee){this.styleElement||(this.styleElement=this._document.createElement("style"),this._document.documentElement.getElementsByTagName("head")[0].append(this.styleElement));const U=this.styleElement.sheet;U.insertRule(ee,U.cssRules.length)}clear(){for(const ee of this.nativeFontFaces)this._document.fonts.delete(ee);this.nativeFontFaces.clear(),this.#e.clear(),this.styleElement&&(this.styleElement.remove(),this.styleElement=null)}async loadSystemFont(ee){if(!(!ee||this.#e.has(ee.loadedName))){if((0,p.assert)(!this.disableFontFace,"loadSystemFont shouldn't be called when `disableFontFace` is set."),this.isFontLoadingAPISupported){const{loadedName:U,src:o,style:t}=ee,a=new FontFace(U,o,t);this.addNativeFontFace(a);try{await a.load(),this.#e.add(U)}catch{(0,p.warn)(`Cannot load system font: ${ee.baseFontName}, installing it could help to improve PDF rendering.`),this.removeNativeFontFace(a)}return}(0,p.unreachable)("Not implemented: loadSystemFont without the Font Loading API.")}}async bind(ee){if(ee.attached||ee.missingFile&&!ee.systemFontInfo)return;if(ee.attached=!0,ee.systemFontInfo){await this.loadSystemFont(ee.systemFontInfo);return}if(this.isFontLoadingAPISupported){const o=ee.createNativeFontFace();if(o){this.addNativeFontFace(o);try{await o.loaded}catch(t){throw(0,p.warn)(`Failed to load font '${o.family}': '${t}'.`),ee.disableFontFace=!0,t}}return}const U=ee.createFontFaceRule();if(U){if(this.insertRule(U),this.isSyncFontLoadingSupported)return;await new Promise(o=>{const t=this._queueLoadingCallback(o);this._prepareFontLoadEvent(ee,t)})}}get isFontLoadingAPISupported(){const ee=!!this._document?.fonts;return(0,p.shadow)(this,"isFontLoadingAPISupported",ee)}get isSyncFontLoadingSupported(){let ee=!1;return(p.isNodeJS||typeof navigator<"u"&&/Mozilla\/5.0.*?rv:\d+.*? Gecko/.test(navigator.userAgent))&&(ee=!0),(0,p.shadow)(this,"isSyncFontLoadingSupported",ee)}_queueLoadingCallback(ee){function U(){for((0,p.assert)(!t.done,"completeRequest() cannot be called twice."),t.done=!0;o.length>0&&o[0].done;){const a=o.shift();setTimeout(a.callback,0)}}const{loadingRequests:o}=this,t={done:!1,complete:U,callback:ee};return o.push(t),t}get _loadTestFont(){const ee=atob("T1RUTwALAIAAAwAwQ0ZGIDHtZg4AAAOYAAAAgUZGVE1lkzZwAAAEHAAAABxHREVGABQAFQAABDgAAAAeT1MvMlYNYwkAAAEgAAAAYGNtYXABDQLUAAACNAAAAUJoZWFk/xVFDQAAALwAAAA2aGhlYQdkA+oAAAD0AAAAJGhtdHgD6AAAAAAEWAAAAAZtYXhwAAJQAAAAARgAAAAGbmFtZVjmdH4AAAGAAAAAsXBvc3T/hgAzAAADeAAAACAAAQAAAAEAALZRFsRfDzz1AAsD6AAAAADOBOTLAAAAAM4KHDwAAAAAA+gDIQAAAAgAAgAAAAAAAAABAAADIQAAAFoD6AAAAAAD6AABAAAAAAAAAAAAAAAAAAAAAQAAUAAAAgAAAAQD6AH0AAUAAAKKArwAAACMAooCvAAAAeAAMQECAAACAAYJAAAAAAAAAAAAAQAAAAAAAAAAAAAAAFBmRWQAwAAuAC4DIP84AFoDIQAAAAAAAQAAAAAAAAAAACAAIAABAAAADgCuAAEAAAAAAAAAAQAAAAEAAAAAAAEAAQAAAAEAAAAAAAIAAQAAAAEAAAAAAAMAAQAAAAEAAAAAAAQAAQAAAAEAAAAAAAUAAQAAAAEAAAAAAAYAAQAAAAMAAQQJAAAAAgABAAMAAQQJAAEAAgABAAMAAQQJAAIAAgABAAMAAQQJAAMAAgABAAMAAQQJAAQAAgABAAMAAQQJAAUAAgABAAMAAQQJAAYAAgABWABYAAAAAAAAAwAAAAMAAAAcAAEAAAAAADwAAwABAAAAHAAEACAAAAAEAAQAAQAAAC7//wAAAC7////TAAEAAAAAAAABBgAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAD/gwAyAAAAAQAAAAAAAAAAAAAAAAAAAAABAAQEAAEBAQJYAAEBASH4DwD4GwHEAvgcA/gXBIwMAYuL+nz5tQXkD5j3CBLnEQACAQEBIVhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYAAABAQAADwACAQEEE/t3Dov6fAH6fAT+fPp8+nwHDosMCvm1Cvm1DAz6fBQAAAAAAAABAAAAAMmJbzEAAAAAzgTjFQAAAADOBOQpAAEAAAAAAAAADAAUAAQAAAABAAAAAgABAAAAAAAAAAAD6AAAAAAAAA==");return(0,p.shadow)(this,"_loadTestFont",ee)}_prepareFontLoadEvent(ee,U){function o(he,ge){return he.charCodeAt(ge)<<24|he.charCodeAt(ge+1)<<16|he.charCodeAt(ge+2)<<8|he.charCodeAt(ge+3)&255}function t(he,ge,Ne,ke){const Oe=he.substring(0,ge),Ve=he.substring(ge+Ne);return Oe+ke+Ve}let a,g;const d=this._document.createElement("canvas");d.width=1,d.height=1;const i=d.getContext("2d");let b=0;function y(he,ge){if(++b>30){(0,p.warn)("Load test font never loaded."),ge();return}if(i.font="30px "+he,i.fillText(".",0,20),i.getImageData(0,0,1,1).data[3]>0){ge();return}setTimeout(y.bind(null,he,ge))}const f=`lt${Date.now()}${this.loadTestFontId++}`;let T=this._loadTestFont;T=t(T,976,f.length,f);const I=16,_=1482184792;let M=o(T,I);for(a=0,g=f.length-3;a<g;a+=4)M=M-_+o(f,a)|0;a<f.length&&(M=M-_+o(f+"XXX",a)|0),T=t(T,I,4,(0,p.string32)(M));const te=`url(data:font/opentype;base64,${btoa(T)});`,ie=`@font-face {font-family:"${f}";src:${te}}`;this.insertRule(ie);const Y=this._document.createElement("div");Y.style.visibility="hidden",Y.style.width=Y.style.height="10px",Y.style.position="absolute",Y.style.top=Y.style.left="0px";for(const he of[ee.loadedName,f]){const ge=this._document.createElement("span");ge.textContent="Hi",ge.style.fontFamily=he,Y.append(ge)}this._document.body.append(Y),y(f,()=>{Y.remove(),U.complete()})}}c.FontLoader=e;class s{constructor(ee,{isEvalSupported:U=!0,disableFontFace:o=!1,ignoreErrors:t=!1,inspectFont:a=null}){this.compiledGlyphs=Object.create(null);for(const g in ee)this[g]=ee[g];this.isEvalSupported=U!==!1,this.disableFontFace=o===!0,this.ignoreErrors=t===!0,this._inspectFont=a}createNativeFontFace(){if(!this.data||this.disableFontFace)return null;let ee;if(!this.cssFontInfo)ee=new FontFace(this.loadedName,this.data,{});else{const U={weight:this.cssFontInfo.fontWeight};this.cssFontInfo.italicAngle&&(U.style=`oblique ${this.cssFontInfo.italicAngle}deg`),ee=new FontFace(this.cssFontInfo.fontFamily,this.data,U)}return this._inspectFont?.(this),ee}createFontFaceRule(){if(!this.data||this.disableFontFace)return null;const ee=(0,p.bytesToString)(this.data),U=`url(data:${this.mimetype};base64,${btoa(ee)});`;let o;if(!this.cssFontInfo)o=`@font-face {font-family:"${this.loadedName}";src:${U}}`;else{let t=`font-weight: ${this.cssFontInfo.fontWeight};`;this.cssFontInfo.italicAngle&&(t+=`font-style: oblique ${this.cssFontInfo.italicAngle}deg;`),o=`@font-face {font-family:"${this.cssFontInfo.fontFamily}";${t}src:${U}}`}return this._inspectFont?.(this,U),o}getPathGenerator(ee,U){if(this.compiledGlyphs[U]!==void 0)return this.compiledGlyphs[U];let o;try{o=ee.get(this.loadedName+"_path_"+U)}catch(t){if(!this.ignoreErrors)throw t;return(0,p.warn)(`getPathGenerator - ignoring character: "${t}".`),this.compiledGlyphs[U]=function(a,g){}}if(this.isEvalSupported&&p.FeatureTest.isEvalSupported){const t=[];for(const a of o){const g=a.args!==void 0?a.args.join(","):"";t.push("c.",a.cmd,"(",g,`);
|
|
3
|
+
`)}return this.compiledGlyphs[U]=new Function("c","size",t.join(""))}return this.compiledGlyphs[U]=function(t,a){for(const g of o)g.cmd==="scale"&&(g.args=[a,-a]),t[g.cmd].apply(t,g.args)}}}c.FontFaceObject=s}),((r,c,q)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.NodeStandardFontDataFactory=c.NodeFilterFactory=c.NodeCanvasFactory=c.NodeCMapReaderFactory=void 0;var p=q(7);q(1);const e=function(o){return new Promise((t,a)=>{index.require$$5.readFile(o,(d,i)=>{if(d||!i){a(new Error(d));return}t(new Uint8Array(i))})})};class s extends p.BaseFilterFactory{}c.NodeFilterFactory=s;class N extends p.BaseCanvasFactory{_createCanvas(t,a){return index.require$$5.createCanvas(t,a)}}c.NodeCanvasFactory=N;class ee extends p.BaseCMapReaderFactory{_fetchData(t,a){return e(t).then(g=>({cMapData:g,compressionType:a}))}}c.NodeCMapReaderFactory=ee;class U extends p.BaseStandardFontDataFactory{_fetchData(t){return e(t)}}c.NodeStandardFontDataFactory=U}),((r,c,q)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.CanvasGraphics=void 0;var p=q(1),e=q(6),s=q(12),N=q(13);const ee=16,U=100,o=4096,t=15,a=10,g=1e3,d=16;function i(A,m){if(A._removeMirroring)throw new Error("Context is already forwarding operations.");A.__originalSave=A.save,A.__originalRestore=A.restore,A.__originalRotate=A.rotate,A.__originalScale=A.scale,A.__originalTranslate=A.translate,A.__originalTransform=A.transform,A.__originalSetTransform=A.setTransform,A.__originalResetTransform=A.resetTransform,A.__originalClip=A.clip,A.__originalMoveTo=A.moveTo,A.__originalLineTo=A.lineTo,A.__originalBezierCurveTo=A.bezierCurveTo,A.__originalRect=A.rect,A.__originalClosePath=A.closePath,A.__originalBeginPath=A.beginPath,A._removeMirroring=()=>{A.save=A.__originalSave,A.restore=A.__originalRestore,A.rotate=A.__originalRotate,A.scale=A.__originalScale,A.translate=A.__originalTranslate,A.transform=A.__originalTransform,A.setTransform=A.__originalSetTransform,A.resetTransform=A.__originalResetTransform,A.clip=A.__originalClip,A.moveTo=A.__originalMoveTo,A.lineTo=A.__originalLineTo,A.bezierCurveTo=A.__originalBezierCurveTo,A.rect=A.__originalRect,A.closePath=A.__originalClosePath,A.beginPath=A.__originalBeginPath,delete A._removeMirroring},A.save=function(){m.save(),this.__originalSave()},A.restore=function(){m.restore(),this.__originalRestore()},A.translate=function(C,V){m.translate(C,V),this.__originalTranslate(C,V)},A.scale=function(C,V){m.scale(C,V),this.__originalScale(C,V)},A.transform=function(C,V,W,K,L,l){m.transform(C,V,W,K,L,l),this.__originalTransform(C,V,W,K,L,l)},A.setTransform=function(C,V,W,K,L,l){m.setTransform(C,V,W,K,L,l),this.__originalSetTransform(C,V,W,K,L,l)},A.resetTransform=function(){m.resetTransform(),this.__originalResetTransform()},A.rotate=function(C){m.rotate(C),this.__originalRotate(C)},A.clip=function(C){m.clip(C),this.__originalClip(C)},A.moveTo=function(v,C){m.moveTo(v,C),this.__originalMoveTo(v,C)},A.lineTo=function(v,C){m.lineTo(v,C),this.__originalLineTo(v,C)},A.bezierCurveTo=function(v,C,V,W,K,L){m.bezierCurveTo(v,C,V,W,K,L),this.__originalBezierCurveTo(v,C,V,W,K,L)},A.rect=function(v,C,V,W){m.rect(v,C,V,W),this.__originalRect(v,C,V,W)},A.closePath=function(){m.closePath(),this.__originalClosePath()},A.beginPath=function(){m.beginPath(),this.__originalBeginPath()}}class b{constructor(m){this.canvasFactory=m,this.cache=Object.create(null)}getCanvas(m,v,C){let V;return this.cache[m]!==void 0?(V=this.cache[m],this.canvasFactory.reset(V,v,C)):(V=this.canvasFactory.create(v,C),this.cache[m]=V),V}delete(m){delete this.cache[m]}clear(){for(const m in this.cache){const v=this.cache[m];this.canvasFactory.destroy(v),delete this.cache[m]}}}function y(A,m,v,C,V,W,K,L,l,S){const[R,O,B,Z,re,me]=(0,e.getCurrentTransform)(A);if(O===0&&B===0){const ye=K*R+re,Ce=Math.round(ye),Re=L*Z+me,xe=Math.round(Re),qe=(K+l)*R+re,tt=Math.abs(Math.round(qe)-Ce)||1,lt=(L+S)*Z+me,vt=Math.abs(Math.round(lt)-xe)||1;return A.setTransform(Math.sign(R),0,0,Math.sign(Z),Ce,xe),A.drawImage(m,v,C,V,W,0,0,tt,vt),A.setTransform(R,O,B,Z,re,me),[tt,vt]}if(R===0&&Z===0){const ye=L*B+re,Ce=Math.round(ye),Re=K*O+me,xe=Math.round(Re),qe=(L+S)*B+re,tt=Math.abs(Math.round(qe)-Ce)||1,lt=(K+l)*O+me,vt=Math.abs(Math.round(lt)-xe)||1;return A.setTransform(0,Math.sign(O),Math.sign(B),0,Ce,xe),A.drawImage(m,v,C,V,W,0,0,vt,tt),A.setTransform(R,O,B,Z,re,me),[vt,tt]}A.drawImage(m,v,C,V,W,K,L,l,S);const We=Math.hypot(R,O),ve=Math.hypot(B,Z);return[We*l,ve*S]}function f(A){const{width:m,height:v}=A;if(m>g||v>g)return null;const C=1e3,V=new Uint8Array([0,2,4,0,1,0,5,4,8,10,0,8,0,2,1,0]),W=m+1;let K=new Uint8Array(W*(v+1)),L,l,S;const R=m+7&-8;let O=new Uint8Array(R*v),B=0;for(const ve of A.data){let ye=128;for(;ye>0;)O[B++]=ve&ye?0:255,ye>>=1}let Z=0;for(B=0,O[B]!==0&&(K[0]=1,++Z),l=1;l<m;l++)O[B]!==O[B+1]&&(K[l]=O[B]?2:1,++Z),B++;for(O[B]!==0&&(K[l]=2,++Z),L=1;L<v;L++){B=L*R,S=L*W,O[B-R]!==O[B]&&(K[S]=O[B]?1:8,++Z);let ve=(O[B]?4:0)+(O[B-R]?8:0);for(l=1;l<m;l++)ve=(ve>>2)+(O[B+1]?4:0)+(O[B-R+1]?8:0),V[ve]&&(K[S+l]=V[ve],++Z),B++;if(O[B-R]!==O[B]&&(K[S+l]=O[B]?2:4,++Z),Z>C)return null}for(B=R*(v-1),S=L*W,O[B]!==0&&(K[S]=8,++Z),l=1;l<m;l++)O[B]!==O[B+1]&&(K[S+l]=O[B]?4:8,++Z),B++;if(O[B]!==0&&(K[S+l]=4,++Z),Z>C)return null;const re=new Int32Array([0,W,-1,0,-W,0,0,0,1]),me=new Path2D;for(L=0;Z&&L<=v;L++){let ve=L*W;const ye=ve+m;for(;ve<ye&&!K[ve];)ve++;if(ve===ye)continue;me.moveTo(ve%W,L);const Ce=ve;let Re=K[ve];do{const xe=re[Re];do ve+=xe;while(!K[ve]);const qe=K[ve];qe!==5&&qe!==10?(Re=qe,K[ve]=0):(Re=qe&51*Re>>4,K[ve]&=Re>>2|Re<<2),me.lineTo(ve%W,ve/W|0),K[ve]||--Z}while(Ce!==ve);--L}return O=null,K=null,function(ve){ve.save(),ve.scale(1/m,-1/v),ve.translate(0,-v),ve.fill(me),ve.beginPath(),ve.restore()}}class T{constructor(m,v){this.alphaIsShape=!1,this.fontSize=0,this.fontSizeScale=1,this.textMatrix=p.IDENTITY_MATRIX,this.textMatrixScale=1,this.fontMatrix=p.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=p.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,m,v])}clone(){const m=Object.create(this);return m.clipBox=this.clipBox.slice(),m}setCurrentPoint(m,v){this.x=m,this.y=v}updatePathMinMax(m,v,C){[v,C]=p.Util.applyTransform([v,C],m),this.minX=Math.min(this.minX,v),this.minY=Math.min(this.minY,C),this.maxX=Math.max(this.maxX,v),this.maxY=Math.max(this.maxY,C)}updateRectMinMax(m,v){const C=p.Util.applyTransform(v,m),V=p.Util.applyTransform(v.slice(2),m);this.minX=Math.min(this.minX,C[0],V[0]),this.minY=Math.min(this.minY,C[1],V[1]),this.maxX=Math.max(this.maxX,C[0],V[0]),this.maxY=Math.max(this.maxY,C[1],V[1])}updateScalingPathMinMax(m,v){p.Util.scaleMinMax(m,v),this.minX=Math.min(this.minX,v[0]),this.maxX=Math.max(this.maxX,v[1]),this.minY=Math.min(this.minY,v[2]),this.maxY=Math.max(this.maxY,v[3])}updateCurvePathMinMax(m,v,C,V,W,K,L,l,S,R){const O=p.Util.bezierBoundingBox(v,C,V,W,K,L,l,S);if(R){R[0]=Math.min(R[0],O[0],O[2]),R[1]=Math.max(R[1],O[0],O[2]),R[2]=Math.min(R[2],O[1],O[3]),R[3]=Math.max(R[3],O[1],O[3]);return}this.updateRectMinMax(m,O)}getPathBoundingBox(m=s.PathType.FILL,v=null){const C=[this.minX,this.minY,this.maxX,this.maxY];if(m===s.PathType.STROKE){v||(0,p.unreachable)("Stroke bounding box must include transform.");const V=p.Util.singularValueDecompose2dScale(v),W=V[0]*this.lineWidth/2,K=V[1]*this.lineWidth/2;C[0]-=W,C[1]-=K,C[2]+=W,C[3]+=K}return C}updateClipFromPath(){const m=p.Util.intersect(this.clipBox,this.getPathBoundingBox());this.startNewPathAndClipBox(m||[0,0,0,0])}isEmptyClip(){return this.minX===1/0}startNewPathAndClipBox(m){this.clipBox=m,this.minX=1/0,this.minY=1/0,this.maxX=0,this.maxY=0}getClippedPathBoundingBox(m=s.PathType.FILL,v=null){return p.Util.intersect(this.clipBox,this.getPathBoundingBox(m,v))}}function H(A,m){if(typeof ImageData<"u"&&m instanceof ImageData){A.putImageData(m,0,0);return}const v=m.height,C=m.width,V=v%d,W=(v-V)/d,K=V===0?W:W+1,L=A.createImageData(C,d);let l=0,S;const R=m.data,O=L.data;let B,Z,re,me;if(m.kind===p.ImageKind.GRAYSCALE_1BPP){const We=R.byteLength,ve=new Uint32Array(O.buffer,0,O.byteLength>>2),ye=ve.length,Ce=C+7>>3,Re=4294967295,xe=p.FeatureTest.isLittleEndian?4278190080:255;for(B=0;B<K;B++){for(re=B<W?d:V,S=0,Z=0;Z<re;Z++){const qe=We-l;let tt=0;const lt=qe>Ce?C:qe*8-7,vt=lt&-8;let bt=0,Ft=0;for(;tt<vt;tt+=8)Ft=R[l++],ve[S++]=Ft&128?Re:xe,ve[S++]=Ft&64?Re:xe,ve[S++]=Ft&32?Re:xe,ve[S++]=Ft&16?Re:xe,ve[S++]=Ft&8?Re:xe,ve[S++]=Ft&4?Re:xe,ve[S++]=Ft&2?Re:xe,ve[S++]=Ft&1?Re:xe;for(;tt<lt;tt++)bt===0&&(Ft=R[l++],bt=128),ve[S++]=Ft&bt?Re:xe,bt>>=1}for(;S<ye;)ve[S++]=0;A.putImageData(L,0,B*d)}}else if(m.kind===p.ImageKind.RGBA_32BPP){for(Z=0,me=C*d*4,B=0;B<W;B++)O.set(R.subarray(l,l+me)),l+=me,A.putImageData(L,0,Z),Z+=d;B<K&&(me=C*V*4,O.set(R.subarray(l,l+me)),A.putImageData(L,0,Z))}else if(m.kind===p.ImageKind.RGB_24BPP)for(re=d,me=C*re,B=0;B<K;B++){for(B>=W&&(re=V,me=C*re),S=0,Z=me;Z--;)O[S++]=R[l++],O[S++]=R[l++],O[S++]=R[l++],O[S++]=255;A.putImageData(L,0,B*d)}else throw new Error(`bad image kind: ${m.kind}`)}function I(A,m){if(m.bitmap){A.drawImage(m.bitmap,0,0);return}const v=m.height,C=m.width,V=v%d,W=(v-V)/d,K=V===0?W:W+1,L=A.createImageData(C,d);let l=0;const S=m.data,R=L.data;for(let O=0;O<K;O++){const B=O<W?d:V;({srcPos:l}=(0,N.convertBlackAndWhiteToRGBA)({src:S,srcPos:l,dest:R,width:C,height:B,nonBlackColor:0})),A.putImageData(L,0,O*d)}}function _(A,m){const v=["strokeStyle","fillStyle","fillRule","globalAlpha","lineWidth","lineCap","lineJoin","miterLimit","globalCompositeOperation","font","filter"];for(const C of v)A[C]!==void 0&&(m[C]=A[C]);A.setLineDash!==void 0&&(m.setLineDash(A.getLineDash()),m.lineDashOffset=A.lineDashOffset)}function M(A){if(A.strokeStyle=A.fillStyle="#000000",A.fillRule="nonzero",A.globalAlpha=1,A.lineWidth=1,A.lineCap="butt",A.lineJoin="miter",A.miterLimit=10,A.globalCompositeOperation="source-over",A.font="10px sans-serif",A.setLineDash!==void 0&&(A.setLineDash([]),A.lineDashOffset=0),!p.isNodeJS){const{filter:m}=A;m!=="none"&&m!==""&&(A.filter="none")}}function te(A,m,v,C){const V=A.length;for(let W=3;W<V;W+=4){const K=A[W];if(K===0)A[W-3]=m,A[W-2]=v,A[W-1]=C;else if(K<255){const L=255-K;A[W-3]=A[W-3]*K+m*L>>8,A[W-2]=A[W-2]*K+v*L>>8,A[W-1]=A[W-1]*K+C*L>>8}}}function ie(A,m,v){const C=A.length,V=1/255;for(let W=3;W<C;W+=4){const K=v?v[A[W]]:A[W];m[W]=m[W]*K*V|0}}function Y(A,m,v){const C=A.length;for(let V=3;V<C;V+=4){const W=A[V-3]*77+A[V-2]*152+A[V-1]*28;m[V]=v?m[V]*v[W>>8]>>8:m[V]*W>>16}}function he(A,m,v,C,V,W,K,L,l,S,R){const O=!!W,B=O?W[0]:0,Z=O?W[1]:0,re=O?W[2]:0,me=V==="Luminosity"?Y:ie,ve=Math.min(C,Math.ceil(1048576/v));for(let ye=0;ye<C;ye+=ve){const Ce=Math.min(ve,C-ye),Re=A.getImageData(L-S,ye+(l-R),v,Ce),xe=m.getImageData(L,ye+l,v,Ce);O&&te(Re.data,B,Z,re),me(Re.data,xe.data,K),m.putImageData(xe,L,ye+l)}}function ge(A,m,v,C){const V=C[0],W=C[1],K=C[2]-V,L=C[3]-W;K===0||L===0||(he(m.context,v,K,L,m.subtype,m.backdrop,m.transferMap,V,W,m.offsetX,m.offsetY),A.save(),A.globalAlpha=1,A.globalCompositeOperation="source-over",A.setTransform(1,0,0,1,0,0),A.drawImage(v.canvas,0,0),A.restore())}function Ne(A,m){const v=p.Util.singularValueDecompose2dScale(A);v[0]=Math.fround(v[0]),v[1]=Math.fround(v[1]);const C=Math.fround((globalThis.devicePixelRatio||1)*e.PixelsPerInch.PDF_TO_CSS_UNITS);return m!==void 0?m:v[0]<=C||v[1]<=C}const ke=["butt","round","square"],Oe=["miter","round","bevel"],Ve={},Ee={};class G{constructor(m,v,C,V,W,{optionalContentConfig:K,markedContentStack:L=null},l,S){this.ctx=m,this.current=new T(this.ctx.canvas.width,this.ctx.canvas.height),this.stateStack=[],this.pendingClip=null,this.pendingEOFill=!1,this.res=null,this.xobjs=null,this.commonObjs=v,this.objs=C,this.canvasFactory=V,this.filterFactory=W,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=L||[],this.optionalContentConfig=K,this.cachedCanvases=new b(this.canvasFactory),this.cachedPatterns=new Map,this.annotationCanvasMap=l,this.viewportScale=1,this.outputScaleX=1,this.outputScaleY=1,this.pageColors=S,this._cachedScaleForStroking=[-1,0],this._cachedGetSinglePixelWidth=null,this._cachedBitmapsMap=new Map}getObject(m,v=null){return typeof m=="string"?m.startsWith("g_")?this.commonObjs.get(m):this.objs.get(m):v}beginDrawing({transform:m,viewport:v,transparency:C=!1,background:V=null}){const W=this.ctx.canvas.width,K=this.ctx.canvas.height,L=this.ctx.fillStyle;if(this.ctx.fillStyle=V||"#ffffff",this.ctx.fillRect(0,0,W,K),this.ctx.fillStyle=L,C){const l=this.cachedCanvases.getCanvas("transparent",W,K);this.compositeCtx=this.ctx,this.transparentCanvas=l.canvas,this.ctx=l.context,this.ctx.save(),this.ctx.transform(...(0,e.getCurrentTransform)(this.compositeCtx))}this.ctx.save(),M(this.ctx),m&&(this.ctx.transform(...m),this.outputScaleX=m[0],this.outputScaleY=m[0]),this.ctx.transform(...v.transform),this.viewportScale=v.scale,this.baseTransform=(0,e.getCurrentTransform)(this.ctx)}executeOperatorList(m,v,C,V){const W=m.argsArray,K=m.fnArray;let L=v||0;const l=W.length;if(l===L)return L;const S=l-L>a&&typeof C=="function",R=S?Date.now()+t:0;let O=0;const B=this.commonObjs,Z=this.objs;let re;for(;;){if(V!==void 0&&L===V.nextBreakPoint)return V.breakIt(L,C),L;if(re=K[L],re!==p.OPS.dependency)this[re].apply(this,W[L]);else for(const me of W[L]){const We=me.startsWith("g_")?B:Z;if(!We.has(me))return We.get(me,C),L}if(L++,L===l)return L;if(S&&++O>a){if(Date.now()>R)return C(),L;O=0}}}#e(){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(){this.#e(),this.cachedCanvases.clear(),this.cachedPatterns.clear();for(const m of this._cachedBitmapsMap.values()){for(const v of m.values())typeof HTMLCanvasElement<"u"&&v instanceof HTMLCanvasElement&&(v.width=v.height=0);m.clear()}this._cachedBitmapsMap.clear(),this.#t()}#t(){if(this.pageColors){const m=this.filterFactory.addHCMFilter(this.pageColors.foreground,this.pageColors.background);if(m!=="none"){const v=this.ctx.filter;this.ctx.filter=m,this.ctx.drawImage(this.ctx.canvas,0,0),this.ctx.filter=v}}}_scaleImage(m,v){const C=m.width,V=m.height;let W=Math.max(Math.hypot(v[0],v[1]),1),K=Math.max(Math.hypot(v[2],v[3]),1),L=C,l=V,S="prescale1",R,O;for(;W>2&&L>1||K>2&&l>1;){let B=L,Z=l;W>2&&L>1&&(B=L>=16384?Math.floor(L/2)-1||1:Math.ceil(L/2),W/=L/B),K>2&&l>1&&(Z=l>=16384?Math.floor(l/2)-1||1:Math.ceil(l)/2,K/=l/Z),R=this.cachedCanvases.getCanvas(S,B,Z),O=R.context,O.clearRect(0,0,B,Z),O.drawImage(m,0,0,L,l,0,0,B,Z),m=R.canvas,L=B,l=Z,S=S==="prescale1"?"prescale2":"prescale1"}return{img:m,paintWidth:L,paintHeight:l}}_createMaskCanvas(m){const v=this.ctx,{width:C,height:V}=m,W=this.current.fillColor,K=this.current.patternFill,L=(0,e.getCurrentTransform)(v);let l,S,R,O;if((m.bitmap||m.data)&&m.count>1){const tt=m.bitmap||m.data.buffer;S=JSON.stringify(K?L:[L.slice(0,4),W]),l=this._cachedBitmapsMap.get(tt),l||(l=new Map,this._cachedBitmapsMap.set(tt,l));const lt=l.get(S);if(lt&&!K){const vt=Math.round(Math.min(L[0],L[2])+L[4]),bt=Math.round(Math.min(L[1],L[3])+L[5]);return{canvas:lt,offsetX:vt,offsetY:bt}}R=lt}R||(O=this.cachedCanvases.getCanvas("maskCanvas",C,V),I(O.context,m));let B=p.Util.transform(L,[1/C,0,0,-1/V,0,0]);B=p.Util.transform(B,[1,0,0,1,0,-V]);const Z=p.Util.applyTransform([0,0],B),re=p.Util.applyTransform([C,V],B),me=p.Util.normalizeRect([Z[0],Z[1],re[0],re[1]]),We=Math.round(me[2]-me[0])||1,ve=Math.round(me[3]-me[1])||1,ye=this.cachedCanvases.getCanvas("fillCanvas",We,ve),Ce=ye.context,Re=Math.min(Z[0],re[0]),xe=Math.min(Z[1],re[1]);Ce.translate(-Re,-xe),Ce.transform(...B),R||(R=this._scaleImage(O.canvas,(0,e.getCurrentTransformInverse)(Ce)),R=R.img,l&&K&&l.set(S,R)),Ce.imageSmoothingEnabled=Ne((0,e.getCurrentTransform)(Ce),m.interpolate),y(Ce,R,0,0,R.width,R.height,0,0,C,V),Ce.globalCompositeOperation="source-in";const qe=p.Util.transform((0,e.getCurrentTransformInverse)(Ce),[1,0,0,1,-Re,-xe]);return Ce.fillStyle=K?W.getPattern(v,this,qe,s.PathType.FILL):W,Ce.fillRect(0,0,C,V),l&&!K&&(this.cachedCanvases.delete("fillCanvas"),l.set(S,ye.canvas)),{canvas:ye.canvas,offsetX:Math.round(Re),offsetY:Math.round(xe)}}setLineWidth(m){m!==this.current.lineWidth&&(this._cachedScaleForStroking[0]=-1),this.current.lineWidth=m,this.ctx.lineWidth=m}setLineCap(m){this.ctx.lineCap=ke[m]}setLineJoin(m){this.ctx.lineJoin=Oe[m]}setMiterLimit(m){this.ctx.miterLimit=m}setDash(m,v){const C=this.ctx;C.setLineDash!==void 0&&(C.setLineDash(m),C.lineDashOffset=v)}setRenderingIntent(m){}setFlatness(m){}setGState(m){for(const[v,C]of m)switch(v){case"LW":this.setLineWidth(C);break;case"LC":this.setLineCap(C);break;case"LJ":this.setLineJoin(C);break;case"ML":this.setMiterLimit(C);break;case"D":this.setDash(C[0],C[1]);break;case"RI":this.setRenderingIntent(C);break;case"FL":this.setFlatness(C);break;case"Font":this.setFont(C[0],C[1]);break;case"CA":this.current.strokeAlpha=C;break;case"ca":this.current.fillAlpha=C,this.ctx.globalAlpha=C;break;case"BM":this.ctx.globalCompositeOperation=C;break;case"SMask":this.current.activeSMask=C?this.tempSMask:null,this.tempSMask=null,this.checkSMaskState();break;case"TR":this.ctx.filter=this.current.transferMaps=this.filterFactory.addFilter(C);break}}get inSMaskMode(){return!!this.suspendedCtx}checkSMaskState(){const m=this.inSMaskMode;this.current.activeSMask&&!m?this.beginSMaskMode():!this.current.activeSMask&&m&&this.endSMaskMode()}beginSMaskMode(){if(this.inSMaskMode)throw new Error("beginSMaskMode called while already in smask mode");const m=this.ctx.canvas.width,v=this.ctx.canvas.height,C="smaskGroupAt"+this.groupLevel,V=this.cachedCanvases.getCanvas(C,m,v);this.suspendedCtx=this.ctx,this.ctx=V.context;const W=this.ctx;W.setTransform(...(0,e.getCurrentTransform)(this.suspendedCtx)),_(this.suspendedCtx,W),i(W,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(),_(this.ctx,this.suspendedCtx),this.ctx=this.suspendedCtx,this.suspendedCtx=null}compose(m){if(!this.current.activeSMask)return;m?(m[0]=Math.floor(m[0]),m[1]=Math.floor(m[1]),m[2]=Math.ceil(m[2]),m[3]=Math.ceil(m[3])):m=[0,0,this.ctx.canvas.width,this.ctx.canvas.height];const v=this.current.activeSMask,C=this.suspendedCtx;ge(C,v,this.ctx,m),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?(_(this.ctx,this.suspendedCtx),this.suspendedCtx.save()):this.ctx.save();const m=this.current;this.stateStack.push(m),this.current=m.clone()}restore(){this.stateStack.length===0&&this.inSMaskMode&&this.endSMaskMode(),this.stateStack.length!==0&&(this.current=this.stateStack.pop(),this.inSMaskMode?(this.suspendedCtx.restore(),_(this.suspendedCtx,this.ctx)):this.ctx.restore(),this.checkSMaskState(),this.pendingClip=null,this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null)}transform(m,v,C,V,W,K){this.ctx.transform(m,v,C,V,W,K),this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null}constructPath(m,v,C){const V=this.ctx,W=this.current;let K=W.x,L=W.y,l,S;const R=(0,e.getCurrentTransform)(V),O=R[0]===0&&R[3]===0||R[1]===0&&R[2]===0,B=O?C.slice(0):null;for(let Z=0,re=0,me=m.length;Z<me;Z++)switch(m[Z]|0){case p.OPS.rectangle:K=v[re++],L=v[re++];const We=v[re++],ve=v[re++],ye=K+We,Ce=L+ve;V.moveTo(K,L),We===0||ve===0?V.lineTo(ye,Ce):(V.lineTo(ye,L),V.lineTo(ye,Ce),V.lineTo(K,Ce)),O||W.updateRectMinMax(R,[K,L,ye,Ce]),V.closePath();break;case p.OPS.moveTo:K=v[re++],L=v[re++],V.moveTo(K,L),O||W.updatePathMinMax(R,K,L);break;case p.OPS.lineTo:K=v[re++],L=v[re++],V.lineTo(K,L),O||W.updatePathMinMax(R,K,L);break;case p.OPS.curveTo:l=K,S=L,K=v[re+4],L=v[re+5],V.bezierCurveTo(v[re],v[re+1],v[re+2],v[re+3],K,L),W.updateCurvePathMinMax(R,l,S,v[re],v[re+1],v[re+2],v[re+3],K,L,B),re+=6;break;case p.OPS.curveTo2:l=K,S=L,V.bezierCurveTo(K,L,v[re],v[re+1],v[re+2],v[re+3]),W.updateCurvePathMinMax(R,l,S,K,L,v[re],v[re+1],v[re+2],v[re+3],B),K=v[re+2],L=v[re+3],re+=4;break;case p.OPS.curveTo3:l=K,S=L,K=v[re+2],L=v[re+3],V.bezierCurveTo(v[re],v[re+1],K,L,K,L),W.updateCurvePathMinMax(R,l,S,v[re],v[re+1],K,L,K,L,B),re+=4;break;case p.OPS.closePath:V.closePath();break}O&&W.updateScalingPathMinMax(R,B),W.setCurrentPoint(K,L)}closePath(){this.ctx.closePath()}stroke(m=!0){const v=this.ctx,C=this.current.strokeColor;v.globalAlpha=this.current.strokeAlpha,this.contentVisible&&(typeof C=="object"&&C?.getPattern?(v.save(),v.strokeStyle=C.getPattern(v,this,(0,e.getCurrentTransformInverse)(v),s.PathType.STROKE),this.rescaleAndStroke(!1),v.restore()):this.rescaleAndStroke(!0)),m&&this.consumePath(this.current.getClippedPathBoundingBox()),v.globalAlpha=this.current.fillAlpha}closeStroke(){this.closePath(),this.stroke()}fill(m=!0){const v=this.ctx,C=this.current.fillColor,V=this.current.patternFill;let W=!1;V&&(v.save(),v.fillStyle=C.getPattern(v,this,(0,e.getCurrentTransformInverse)(v),s.PathType.FILL),W=!0);const K=this.current.getClippedPathBoundingBox();this.contentVisible&&K!==null&&(this.pendingEOFill?(v.fill("evenodd"),this.pendingEOFill=!1):v.fill()),W&&v.restore(),m&&this.consumePath(K)}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=Ve}eoClip(){this.pendingClip=Ee}beginText(){this.current.textMatrix=p.IDENTITY_MATRIX,this.current.textMatrixScale=1,this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0}endText(){const m=this.pendingTextPaths,v=this.ctx;if(m===void 0){v.beginPath();return}v.save(),v.beginPath();for(const C of m)v.setTransform(...C.transform),v.translate(C.x,C.y),C.addToPath(v,C.fontSize);v.restore(),v.clip(),v.beginPath(),delete this.pendingTextPaths}setCharSpacing(m){this.current.charSpacing=m}setWordSpacing(m){this.current.wordSpacing=m}setHScale(m){this.current.textHScale=m/100}setLeading(m){this.current.leading=-m}setFont(m,v){const C=this.commonObjs.get(m),V=this.current;if(!C)throw new Error(`Can't find font for ${m}`);if(V.fontMatrix=C.fontMatrix||p.FONT_IDENTITY_MATRIX,(V.fontMatrix[0]===0||V.fontMatrix[3]===0)&&(0,p.warn)("Invalid font matrix for font "+m),v<0?(v=-v,V.fontDirection=-1):V.fontDirection=1,this.current.font=C,this.current.fontSize=v,C.isType3Font)return;const W=C.loadedName||"sans-serif",K=C.systemFontInfo?.css||`"${W}", ${C.fallbackName}`;let L="normal";C.black?L="900":C.bold&&(L="bold");const l=C.italic?"italic":"normal";let S=v;v<ee?S=ee:v>U&&(S=U),this.current.fontSizeScale=v/S,this.ctx.font=`${l} ${L} ${S}px ${K}`}setTextRenderingMode(m){this.current.textRenderingMode=m}setTextRise(m){this.current.textRise=m}moveText(m,v){this.current.x=this.current.lineX+=m,this.current.y=this.current.lineY+=v}setLeadingMoveText(m,v){this.setLeading(-v),this.moveText(m,v)}setTextMatrix(m,v,C,V,W,K){this.current.textMatrix=[m,v,C,V,W,K],this.current.textMatrixScale=Math.hypot(m,v),this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0}nextLine(){this.moveText(0,this.current.leading)}paintChar(m,v,C,V){const W=this.ctx,K=this.current,L=K.font,l=K.textRenderingMode,S=K.fontSize/K.fontSizeScale,R=l&p.TextRenderingMode.FILL_STROKE_MASK,O=!!(l&p.TextRenderingMode.ADD_TO_PATH_FLAG),B=K.patternFill&&!L.missingFile;let Z;(L.disableFontFace||O||B)&&(Z=L.getPathGenerator(this.commonObjs,m)),L.disableFontFace||B?(W.save(),W.translate(v,C),W.beginPath(),Z(W,S),V&&W.setTransform(...V),(R===p.TextRenderingMode.FILL||R===p.TextRenderingMode.FILL_STROKE)&&W.fill(),(R===p.TextRenderingMode.STROKE||R===p.TextRenderingMode.FILL_STROKE)&&W.stroke(),W.restore()):((R===p.TextRenderingMode.FILL||R===p.TextRenderingMode.FILL_STROKE)&&W.fillText(m,v,C),(R===p.TextRenderingMode.STROKE||R===p.TextRenderingMode.FILL_STROKE)&&W.strokeText(m,v,C)),O&&(this.pendingTextPaths||=[]).push({transform:(0,e.getCurrentTransform)(W),x:v,y:C,fontSize:S,addToPath:Z})}get isFontSubpixelAAEnabled(){const{context:m}=this.cachedCanvases.getCanvas("isFontSubpixelAAEnabled",10,10);m.scale(1.5,1),m.fillText("I",0,10);const v=m.getImageData(0,0,10,10).data;let C=!1;for(let V=3;V<v.length;V+=4)if(v[V]>0&&v[V]<255){C=!0;break}return(0,p.shadow)(this,"isFontSubpixelAAEnabled",C)}showText(m){const v=this.current,C=v.font;if(C.isType3Font)return this.showType3Text(m);const V=v.fontSize;if(V===0)return;const W=this.ctx,K=v.fontSizeScale,L=v.charSpacing,l=v.wordSpacing,S=v.fontDirection,R=v.textHScale*S,O=m.length,B=C.vertical,Z=B?1:-1,re=C.defaultVMetrics,me=V*v.fontMatrix[0],We=v.textRenderingMode===p.TextRenderingMode.FILL&&!C.disableFontFace&&!v.patternFill;W.save(),W.transform(...v.textMatrix),W.translate(v.x,v.y+v.textRise),S>0?W.scale(R,-1):W.scale(R,1);let ve;if(v.patternFill){W.save();const qe=v.fillColor.getPattern(W,this,(0,e.getCurrentTransformInverse)(W),s.PathType.FILL);ve=(0,e.getCurrentTransform)(W),W.restore(),W.fillStyle=qe}let ye=v.lineWidth;const Ce=v.textMatrixScale;if(Ce===0||ye===0){const qe=v.textRenderingMode&p.TextRenderingMode.FILL_STROKE_MASK;(qe===p.TextRenderingMode.STROKE||qe===p.TextRenderingMode.FILL_STROKE)&&(ye=this.getSinglePixelWidth())}else ye/=Ce;if(K!==1&&(W.scale(K,K),ye/=K),W.lineWidth=ye,C.isInvalidPDFjsFont){const qe=[];let tt=0;for(const lt of m)qe.push(lt.unicode),tt+=lt.width;W.fillText(qe.join(""),0,0),v.x+=tt*me*R,W.restore(),this.compose();return}let Re=0,xe;for(xe=0;xe<O;++xe){const qe=m[xe];if(typeof qe=="number"){Re+=Z*qe*V/1e3;continue}let tt=!1;const lt=(qe.isSpace?l:0)+L,vt=qe.fontChar,bt=qe.accent;let Ft,vn,hn=qe.width;if(B){const gn=qe.vmetric||re,Fn=-(qe.vmetric?gn[1]:hn*.5)*me,Kn=gn[2]*me;hn=gn?-gn[0]:hn,Ft=Fn/K,vn=(Re+Kn)/K}else Ft=Re/K,vn=0;if(C.remeasure&&hn>0){const gn=W.measureText(vt).width*1e3/V*K;if(hn<gn&&this.isFontSubpixelAAEnabled){const Fn=hn/gn;tt=!0,W.save(),W.scale(Fn,1),Ft/=Fn}else hn!==gn&&(Ft+=(hn-gn)/2e3*V/K)}if(this.contentVisible&&(qe.isInFont||C.missingFile)){if(We&&!bt)W.fillText(vt,Ft,vn);else if(this.paintChar(vt,Ft,vn,ve),bt){const gn=Ft+V*bt.offset.x/K,Fn=vn-V*bt.offset.y/K;this.paintChar(bt.fontChar,gn,Fn,ve)}}const jn=B?hn*me-lt*S:hn*me+lt*S;Re+=jn,tt&&W.restore()}B?v.y-=Re:v.x+=Re*R,W.restore(),this.compose()}showType3Text(m){const v=this.ctx,C=this.current,V=C.font,W=C.fontSize,K=C.fontDirection,L=V.vertical?1:-1,l=C.charSpacing,S=C.wordSpacing,R=C.textHScale*K,O=C.fontMatrix||p.FONT_IDENTITY_MATRIX,B=m.length,Z=C.textRenderingMode===p.TextRenderingMode.INVISIBLE;let re,me,We,ve;if(!(Z||W===0)){for(this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null,v.save(),v.transform(...C.textMatrix),v.translate(C.x,C.y),v.scale(R,K),re=0;re<B;++re){if(me=m[re],typeof me=="number"){ve=L*me*W/1e3,this.ctx.translate(ve,0),C.x+=ve*R;continue}const ye=(me.isSpace?S:0)+l,Ce=V.charProcOperatorList[me.operatorListId];if(!Ce){(0,p.warn)(`Type3 character "${me.operatorListId}" is not available.`);continue}this.contentVisible&&(this.processingType3=me,this.save(),v.scale(W,W),v.transform(...O),this.executeOperatorList(Ce),this.restore()),We=p.Util.applyTransform([me.width,0],O)[0]*W+ye,v.translate(We,0),C.x+=We*R}v.restore(),this.processingType3=null}}setCharWidth(m,v){}setCharWidthAndBounds(m,v,C,V,W,K){this.ctx.rect(C,V,W-C,K-V),this.ctx.clip(),this.endPath()}getColorN_Pattern(m){let v;if(m[0]==="TilingPattern"){const C=m[1],V=this.baseTransform||(0,e.getCurrentTransform)(this.ctx),W={createCanvasGraphics:K=>new G(K,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:this.optionalContentConfig,markedContentStack:this.markedContentStack})};v=new s.TilingPattern(m,C,this.ctx,W,V)}else v=this._getPattern(m[1],m[2]);return v}setStrokeColorN(){this.current.strokeColor=this.getColorN_Pattern(arguments)}setFillColorN(){this.current.fillColor=this.getColorN_Pattern(arguments),this.current.patternFill=!0}setStrokeRGBColor(m,v,C){const V=p.Util.makeHexColor(m,v,C);this.ctx.strokeStyle=V,this.current.strokeColor=V}setFillRGBColor(m,v,C){const V=p.Util.makeHexColor(m,v,C);this.ctx.fillStyle=V,this.current.fillColor=V,this.current.patternFill=!1}_getPattern(m,v=null){let C;return this.cachedPatterns.has(m)?C=this.cachedPatterns.get(m):(C=(0,s.getShadingPattern)(this.getObject(m)),this.cachedPatterns.set(m,C)),v&&(C.matrix=v),C}shadingFill(m){if(!this.contentVisible)return;const v=this.ctx;this.save();const C=this._getPattern(m);v.fillStyle=C.getPattern(v,this,(0,e.getCurrentTransformInverse)(v),s.PathType.SHADING);const V=(0,e.getCurrentTransformInverse)(v);if(V){const{width:W,height:K}=v.canvas,[L,l,S,R]=p.Util.getAxialAlignedBoundingBox([0,0,W,K],V);this.ctx.fillRect(L,l,S-L,R-l)}else this.ctx.fillRect(-1e10,-1e10,2e10,2e10);this.compose(this.current.getClippedPathBoundingBox()),this.restore()}beginInlineImage(){(0,p.unreachable)("Should not call beginInlineImage")}beginImageData(){(0,p.unreachable)("Should not call beginImageData")}paintFormXObjectBegin(m,v){if(this.contentVisible&&(this.save(),this.baseTransformStack.push(this.baseTransform),Array.isArray(m)&&m.length===6&&this.transform(...m),this.baseTransform=(0,e.getCurrentTransform)(this.ctx),v)){const C=v[2]-v[0],V=v[3]-v[1];this.ctx.rect(v[0],v[1],C,V),this.current.updateRectMinMax((0,e.getCurrentTransform)(this.ctx),v),this.clip(),this.endPath()}}paintFormXObjectEnd(){this.contentVisible&&(this.restore(),this.baseTransform=this.baseTransformStack.pop())}beginGroup(m){if(!this.contentVisible)return;this.save(),this.inSMaskMode&&(this.endSMaskMode(),this.current.activeSMask=null);const v=this.ctx;m.isolated||(0,p.info)("TODO: Support non-isolated groups."),m.knockout&&(0,p.warn)("Knockout groups not supported.");const C=(0,e.getCurrentTransform)(v);if(m.matrix&&v.transform(...m.matrix),!m.bbox)throw new Error("Bounding box is required.");let V=p.Util.getAxialAlignedBoundingBox(m.bbox,(0,e.getCurrentTransform)(v));const W=[0,0,v.canvas.width,v.canvas.height];V=p.Util.intersect(V,W)||[0,0,0,0];const K=Math.floor(V[0]),L=Math.floor(V[1]);let l=Math.max(Math.ceil(V[2])-K,1),S=Math.max(Math.ceil(V[3])-L,1),R=1,O=1;l>o&&(R=l/o,l=o),S>o&&(O=S/o,S=o),this.current.startNewPathAndClipBox([0,0,l,S]);let B="groupAt"+this.groupLevel;m.smask&&(B+="_smask_"+this.smaskCounter++%2);const Z=this.cachedCanvases.getCanvas(B,l,S),re=Z.context;re.scale(1/R,1/O),re.translate(-K,-L),re.transform(...C),m.smask?this.smaskStack.push({canvas:Z.canvas,context:re,offsetX:K,offsetY:L,scaleX:R,scaleY:O,subtype:m.smask.subtype,backdrop:m.smask.backdrop,transferMap:m.smask.transferMap||null,startTransformInverse:null}):(v.setTransform(1,0,0,1,0,0),v.translate(K,L),v.scale(R,O),v.save()),_(v,re),this.ctx=re,this.setGState([["BM","source-over"],["ca",1],["CA",1]]),this.groupStack.push(v),this.groupLevel++}endGroup(m){if(!this.contentVisible)return;this.groupLevel--;const v=this.ctx,C=this.groupStack.pop();if(this.ctx=C,this.ctx.imageSmoothingEnabled=!1,m.smask)this.tempSMask=this.smaskStack.pop(),this.restore();else{this.ctx.restore();const V=(0,e.getCurrentTransform)(this.ctx);this.restore(),this.ctx.save(),this.ctx.setTransform(...V);const W=p.Util.getAxialAlignedBoundingBox([0,0,v.canvas.width,v.canvas.height],V);this.ctx.drawImage(v.canvas,0,0),this.ctx.restore(),this.compose(W)}}beginAnnotation(m,v,C,V,W){if(this.#e(),M(this.ctx),this.ctx.save(),this.save(),this.baseTransform&&this.ctx.setTransform(...this.baseTransform),Array.isArray(v)&&v.length===4){const K=v[2]-v[0],L=v[3]-v[1];if(W&&this.annotationCanvasMap){C=C.slice(),C[4]-=v[0],C[5]-=v[1],v=v.slice(),v[0]=v[1]=0,v[2]=K,v[3]=L;const[l,S]=p.Util.singularValueDecompose2dScale((0,e.getCurrentTransform)(this.ctx)),{viewportScale:R}=this,O=Math.ceil(K*this.outputScaleX*R),B=Math.ceil(L*this.outputScaleY*R);this.annotationCanvas=this.canvasFactory.create(O,B);const{canvas:Z,context:re}=this.annotationCanvas;this.annotationCanvasMap.set(m,Z),this.annotationCanvas.savedCtx=this.ctx,this.ctx=re,this.ctx.save(),this.ctx.setTransform(l,0,0,-S,0,L*S),M(this.ctx)}else M(this.ctx),this.ctx.rect(v[0],v[1],K,L),this.ctx.clip(),this.endPath()}this.current=new T(this.ctx.canvas.width,this.ctx.canvas.height),this.transform(...C),this.transform(...V)}endAnnotation(){this.annotationCanvas&&(this.ctx.restore(),this.#t(),this.ctx=this.annotationCanvas.savedCtx,delete this.annotationCanvas.savedCtx,delete this.annotationCanvas)}paintImageMaskXObject(m){if(!this.contentVisible)return;const v=m.count;m=this.getObject(m.data,m),m.count=v;const C=this.ctx,V=this.processingType3;if(V&&(V.compiled===void 0&&(V.compiled=f(m)),V.compiled)){V.compiled(C);return}const W=this._createMaskCanvas(m),K=W.canvas;C.save(),C.setTransform(1,0,0,1,0,0),C.drawImage(K,W.offsetX,W.offsetY),C.restore(),this.compose()}paintImageMaskXObjectRepeat(m,v,C=0,V=0,W,K){if(!this.contentVisible)return;m=this.getObject(m.data,m);const L=this.ctx;L.save();const l=(0,e.getCurrentTransform)(L);L.transform(v,C,V,W,0,0);const S=this._createMaskCanvas(m);L.setTransform(1,0,0,1,S.offsetX-l[4],S.offsetY-l[5]);for(let R=0,O=K.length;R<O;R+=2){const B=p.Util.transform(l,[v,C,V,W,K[R],K[R+1]]),[Z,re]=p.Util.applyTransform([0,0],B);L.drawImage(S.canvas,Z,re)}L.restore(),this.compose()}paintImageMaskXObjectGroup(m){if(!this.contentVisible)return;const v=this.ctx,C=this.current.fillColor,V=this.current.patternFill;for(const W of m){const{data:K,width:L,height:l,transform:S}=W,R=this.cachedCanvases.getCanvas("maskCanvas",L,l),O=R.context;O.save();const B=this.getObject(K,W);I(O,B),O.globalCompositeOperation="source-in",O.fillStyle=V?C.getPattern(O,this,(0,e.getCurrentTransformInverse)(v),s.PathType.FILL):C,O.fillRect(0,0,L,l),O.restore(),v.save(),v.transform(...S),v.scale(1,-1),y(v,R.canvas,0,0,L,l,0,-1,1,1),v.restore()}this.compose()}paintImageXObject(m){if(!this.contentVisible)return;const v=this.getObject(m);if(!v){(0,p.warn)("Dependent image isn't ready yet");return}this.paintInlineImageXObject(v)}paintImageXObjectRepeat(m,v,C,V){if(!this.contentVisible)return;const W=this.getObject(m);if(!W){(0,p.warn)("Dependent image isn't ready yet");return}const K=W.width,L=W.height,l=[];for(let S=0,R=V.length;S<R;S+=2)l.push({transform:[v,0,0,C,V[S],V[S+1]],x:0,y:0,w:K,h:L});this.paintInlineImageXObjectGroup(W,l)}applyTransferMapsToCanvas(m){return this.current.transferMaps!=="none"&&(m.filter=this.current.transferMaps,m.drawImage(m.canvas,0,0),m.filter="none"),m.canvas}applyTransferMapsToBitmap(m){if(this.current.transferMaps==="none")return m.bitmap;const{bitmap:v,width:C,height:V}=m,W=this.cachedCanvases.getCanvas("inlineImage",C,V),K=W.context;return K.filter=this.current.transferMaps,K.drawImage(v,0,0),K.filter="none",W.canvas}paintInlineImageXObject(m){if(!this.contentVisible)return;const v=m.width,C=m.height,V=this.ctx;if(this.save(),!p.isNodeJS){const{filter:L}=V;L!=="none"&&L!==""&&(V.filter="none")}V.scale(1/v,-1/C);let W;if(m.bitmap)W=this.applyTransferMapsToBitmap(m);else if(typeof HTMLElement=="function"&&m instanceof HTMLElement||!m.data)W=m;else{const l=this.cachedCanvases.getCanvas("inlineImage",v,C).context;H(l,m),W=this.applyTransferMapsToCanvas(l)}const K=this._scaleImage(W,(0,e.getCurrentTransformInverse)(V));V.imageSmoothingEnabled=Ne((0,e.getCurrentTransform)(V),m.interpolate),y(V,K.img,0,0,K.paintWidth,K.paintHeight,0,-C,v,C),this.compose(),this.restore()}paintInlineImageXObjectGroup(m,v){if(!this.contentVisible)return;const C=this.ctx;let V;if(m.bitmap)V=m.bitmap;else{const W=m.width,K=m.height,l=this.cachedCanvases.getCanvas("inlineImage",W,K).context;H(l,m),V=this.applyTransferMapsToCanvas(l)}for(const W of v)C.save(),C.transform(...W.transform),C.scale(1,-1),y(C,V,W.x,W.y,W.w,W.h,0,-1,1,1),C.restore();this.compose()}paintSolidColorImageMask(){this.contentVisible&&(this.ctx.fillRect(0,0,1,1),this.compose())}markPoint(m){}markPointProps(m,v){}beginMarkedContent(m){this.markedContentStack.push({visible:!0})}beginMarkedContentProps(m,v){m==="OC"?this.markedContentStack.push({visible:this.optionalContentConfig.isVisible(v)}):this.markedContentStack.push({visible:!0}),this.contentVisible=this.isContentVisible()}endMarkedContent(){this.markedContentStack.pop(),this.contentVisible=this.isContentVisible()}beginCompat(){}endCompat(){}consumePath(m){const v=this.current.isEmptyClip();this.pendingClip&&this.current.updateClipFromPath(),this.pendingClip||this.compose(m);const C=this.ctx;this.pendingClip&&(v||(this.pendingClip===Ee?C.clip("evenodd"):C.clip()),this.pendingClip=null),this.current.startNewPathAndClipBox(this.current.clipBox),C.beginPath()}getSinglePixelWidth(){if(!this._cachedGetSinglePixelWidth){const m=(0,e.getCurrentTransform)(this.ctx);if(m[1]===0&&m[2]===0)this._cachedGetSinglePixelWidth=1/Math.min(Math.abs(m[0]),Math.abs(m[3]));else{const v=Math.abs(m[0]*m[3]-m[2]*m[1]),C=Math.hypot(m[0],m[2]),V=Math.hypot(m[1],m[3]);this._cachedGetSinglePixelWidth=Math.max(C,V)/v}}return this._cachedGetSinglePixelWidth}getScaleForStroking(){if(this._cachedScaleForStroking[0]===-1){const{lineWidth:m}=this.current,{a:v,b:C,c:V,d:W}=this.ctx.getTransform();let K,L;if(C===0&&V===0){const l=Math.abs(v),S=Math.abs(W);if(l===S)if(m===0)K=L=1/l;else{const R=l*m;K=L=R<1?1/R:1}else if(m===0)K=1/l,L=1/S;else{const R=l*m,O=S*m;K=R<1?1/R:1,L=O<1?1/O:1}}else{const l=Math.abs(v*W-C*V),S=Math.hypot(v,C),R=Math.hypot(V,W);if(m===0)K=R/l,L=S/l;else{const O=m*l;K=R>O?R/O:1,L=S>O?S/O:1}}this._cachedScaleForStroking[0]=K,this._cachedScaleForStroking[1]=L}return this._cachedScaleForStroking}rescaleAndStroke(m){const{ctx:v}=this,{lineWidth:C}=this.current,[V,W]=this.getScaleForStroking();if(v.lineWidth=C||1,V===1&&W===1){v.stroke();return}const K=v.getLineDash();if(m&&v.save(),v.scale(V,W),K.length>0){const L=Math.max(V,W);v.setLineDash(K.map(l=>l/L)),v.lineDashOffset/=L}v.stroke(),m&&v.restore()}isContentVisible(){for(let m=this.markedContentStack.length-1;m>=0;m--)if(!this.markedContentStack[m].visible)return!1;return!0}}c.CanvasGraphics=G;for(const A in p.OPS)G.prototype[A]!==void 0&&(G.prototype[p.OPS[A]]=G.prototype[A])}),((r,c,q)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.TilingPattern=c.PathType=void 0,c.getShadingPattern=d;var p=q(1),e=q(6);const s={FILL:"Fill",STROKE:"Stroke",SHADING:"Shading"};c.PathType=s;function N(y,f){if(!f)return;const T=f[2]-f[0],H=f[3]-f[1],I=new Path2D;I.rect(f[0],f[1],T,H),y.clip(I)}class ee{constructor(){this.constructor===ee&&(0,p.unreachable)("Cannot initialize BaseShadingPattern.")}getPattern(){(0,p.unreachable)("Abstract method `getPattern` called.")}}class U extends ee{constructor(f){super(),this._type=f[1],this._bbox=f[2],this._colorStops=f[3],this._p0=f[4],this._p1=f[5],this._r0=f[6],this._r1=f[7],this.matrix=null}_createGradient(f){let T;this._type==="axial"?T=f.createLinearGradient(this._p0[0],this._p0[1],this._p1[0],this._p1[1]):this._type==="radial"&&(T=f.createRadialGradient(this._p0[0],this._p0[1],this._r0,this._p1[0],this._p1[1],this._r1));for(const H of this._colorStops)T.addColorStop(H[0],H[1]);return T}getPattern(f,T,H,I){let _;if(I===s.STROKE||I===s.FILL){const M=T.current.getClippedPathBoundingBox(I,(0,e.getCurrentTransform)(f))||[0,0,0,0],te=Math.ceil(M[2]-M[0])||1,ie=Math.ceil(M[3]-M[1])||1,Y=T.cachedCanvases.getCanvas("pattern",te,ie,!0),he=Y.context;he.clearRect(0,0,he.canvas.width,he.canvas.height),he.beginPath(),he.rect(0,0,he.canvas.width,he.canvas.height),he.translate(-M[0],-M[1]),H=p.Util.transform(H,[1,0,0,1,M[0],M[1]]),he.transform(...T.baseTransform),this.matrix&&he.transform(...this.matrix),N(he,this._bbox),he.fillStyle=this._createGradient(he),he.fill(),_=f.createPattern(Y.canvas,"no-repeat");const ge=new DOMMatrix(H);_.setTransform(ge)}else N(f,this._bbox),_=this._createGradient(f);return _}}function o(y,f,T,H,I,_,M,te){const ie=f.coords,Y=f.colors,he=y.data,ge=y.width*4;let Ne;ie[T+1]>ie[H+1]&&(Ne=T,T=H,H=Ne,Ne=_,_=M,M=Ne),ie[H+1]>ie[I+1]&&(Ne=H,H=I,I=Ne,Ne=M,M=te,te=Ne),ie[T+1]>ie[H+1]&&(Ne=T,T=H,H=Ne,Ne=_,_=M,M=Ne);const ke=(ie[T]+f.offsetX)*f.scaleX,Oe=(ie[T+1]+f.offsetY)*f.scaleY,Ve=(ie[H]+f.offsetX)*f.scaleX,Ee=(ie[H+1]+f.offsetY)*f.scaleY,G=(ie[I]+f.offsetX)*f.scaleX,A=(ie[I+1]+f.offsetY)*f.scaleY;if(Oe>=A)return;const m=Y[_],v=Y[_+1],C=Y[_+2],V=Y[M],W=Y[M+1],K=Y[M+2],L=Y[te],l=Y[te+1],S=Y[te+2],R=Math.round(Oe),O=Math.round(A);let B,Z,re,me,We,ve,ye,Ce;for(let Re=R;Re<=O;Re++){if(Re<Ee){const vt=Re<Oe?0:(Oe-Re)/(Oe-Ee);B=ke-(ke-Ve)*vt,Z=m-(m-V)*vt,re=v-(v-W)*vt,me=C-(C-K)*vt}else{let vt;Re>A?vt=1:Ee===A?vt=0:vt=(Ee-Re)/(Ee-A),B=Ve-(Ve-G)*vt,Z=V-(V-L)*vt,re=W-(W-l)*vt,me=K-(K-S)*vt}let xe;Re<Oe?xe=0:Re>A?xe=1:xe=(Oe-Re)/(Oe-A),We=ke-(ke-G)*xe,ve=m-(m-L)*xe,ye=v-(v-l)*xe,Ce=C-(C-S)*xe;const qe=Math.round(Math.min(B,We)),tt=Math.round(Math.max(B,We));let lt=ge*Re+qe*4;for(let vt=qe;vt<=tt;vt++)xe=(B-vt)/(B-We),xe<0?xe=0:xe>1&&(xe=1),he[lt++]=Z-(Z-ve)*xe|0,he[lt++]=re-(re-ye)*xe|0,he[lt++]=me-(me-Ce)*xe|0,he[lt++]=255}}function t(y,f,T){const H=f.coords,I=f.colors;let _,M;switch(f.type){case"lattice":const te=f.verticesPerRow,ie=Math.floor(H.length/te)-1,Y=te-1;for(_=0;_<ie;_++){let he=_*te;for(let ge=0;ge<Y;ge++,he++)o(y,T,H[he],H[he+1],H[he+te],I[he],I[he+1],I[he+te]),o(y,T,H[he+te+1],H[he+1],H[he+te],I[he+te+1],I[he+1],I[he+te])}break;case"triangles":for(_=0,M=H.length;_<M;_+=3)o(y,T,H[_],H[_+1],H[_+2],I[_],I[_+1],I[_+2]);break;default:throw new Error("illegal figure")}}class a extends ee{constructor(f){super(),this._coords=f[2],this._colors=f[3],this._figures=f[4],this._bounds=f[5],this._bbox=f[7],this._background=f[8],this.matrix=null}_createMeshCanvas(f,T,H){const te=Math.floor(this._bounds[0]),ie=Math.floor(this._bounds[1]),Y=Math.ceil(this._bounds[2])-te,he=Math.ceil(this._bounds[3])-ie,ge=Math.min(Math.ceil(Math.abs(Y*f[0]*1.1)),3e3),Ne=Math.min(Math.ceil(Math.abs(he*f[1]*1.1)),3e3),ke=Y/ge,Oe=he/Ne,Ve={coords:this._coords,colors:this._colors,offsetX:-te,offsetY:-ie,scaleX:1/ke,scaleY:1/Oe},Ee=ge+4,G=Ne+4,A=H.getCanvas("mesh",Ee,G,!1),m=A.context,v=m.createImageData(ge,Ne);if(T){const V=v.data;for(let W=0,K=V.length;W<K;W+=4)V[W]=T[0],V[W+1]=T[1],V[W+2]=T[2],V[W+3]=255}for(const V of this._figures)t(v,V,Ve);return m.putImageData(v,2,2),{canvas:A.canvas,offsetX:te-2*ke,offsetY:ie-2*Oe,scaleX:ke,scaleY:Oe}}getPattern(f,T,H,I){N(f,this._bbox);let _;if(I===s.SHADING)_=p.Util.singularValueDecompose2dScale((0,e.getCurrentTransform)(f));else if(_=p.Util.singularValueDecompose2dScale(T.baseTransform),this.matrix){const te=p.Util.singularValueDecompose2dScale(this.matrix);_=[_[0]*te[0],_[1]*te[1]]}const M=this._createMeshCanvas(_,I===s.SHADING?null:this._background,T.cachedCanvases);return I!==s.SHADING&&(f.setTransform(...T.baseTransform),this.matrix&&f.transform(...this.matrix)),f.translate(M.offsetX,M.offsetY),f.scale(M.scaleX,M.scaleY),f.createPattern(M.canvas,"no-repeat")}}class g extends ee{getPattern(){return"hotpink"}}function d(y){switch(y[0]){case"RadialAxial":return new U(y);case"Mesh":return new a(y);case"Dummy":return new g}throw new Error(`Unknown IR type: ${y[0]}`)}const i={COLORED:1,UNCOLORED:2};class b{static MAX_PATTERN_SIZE=3e3;constructor(f,T,H,I,_){this.operatorList=f[2],this.matrix=f[3]||[1,0,0,1,0,0],this.bbox=f[4],this.xstep=f[5],this.ystep=f[6],this.paintType=f[7],this.tilingType=f[8],this.color=T,this.ctx=H,this.canvasGraphicsFactory=I,this.baseTransform=_}createPatternCanvas(f){const T=this.operatorList,H=this.bbox,I=this.xstep,_=this.ystep,M=this.paintType,te=this.tilingType,ie=this.color,Y=this.canvasGraphicsFactory;(0,p.info)("TilingType: "+te);const he=H[0],ge=H[1],Ne=H[2],ke=H[3],Oe=p.Util.singularValueDecompose2dScale(this.matrix),Ve=p.Util.singularValueDecompose2dScale(this.baseTransform),Ee=[Oe[0]*Ve[0],Oe[1]*Ve[1]],G=this.getSizeAndScale(I,this.ctx.canvas.width,Ee[0]),A=this.getSizeAndScale(_,this.ctx.canvas.height,Ee[1]),m=f.cachedCanvases.getCanvas("pattern",G.size,A.size,!0),v=m.context,C=Y.createCanvasGraphics(v);C.groupLevel=f.groupLevel,this.setFillAndStrokeStyleToContext(C,M,ie);let V=he,W=ge,K=Ne,L=ke;return he<0&&(V=0,K+=Math.abs(he)),ge<0&&(W=0,L+=Math.abs(ge)),v.translate(-(G.scale*V),-(A.scale*W)),C.transform(G.scale,0,0,A.scale,0,0),v.save(),this.clipBbox(C,V,W,K,L),C.baseTransform=(0,e.getCurrentTransform)(C.ctx),C.executeOperatorList(T),C.endDrawing(),{canvas:m.canvas,scaleX:G.scale,scaleY:A.scale,offsetX:V,offsetY:W}}getSizeAndScale(f,T,H){f=Math.abs(f);const I=Math.max(b.MAX_PATTERN_SIZE,T);let _=Math.ceil(f*H);return _>=I?_=I:H=_/f,{scale:H,size:_}}clipBbox(f,T,H,I,_){const M=I-T,te=_-H;f.ctx.rect(T,H,M,te),f.current.updateRectMinMax((0,e.getCurrentTransform)(f.ctx),[T,H,I,_]),f.clip(),f.endPath()}setFillAndStrokeStyleToContext(f,T,H){const I=f.ctx,_=f.current;switch(T){case i.COLORED:const M=this.ctx;I.fillStyle=M.fillStyle,I.strokeStyle=M.strokeStyle,_.fillColor=M.fillStyle,_.strokeColor=M.strokeStyle;break;case i.UNCOLORED:const te=p.Util.makeHexColor(H[0],H[1],H[2]);I.fillStyle=te,I.strokeStyle=te,_.fillColor=te,_.strokeColor=te;break;default:throw new p.FormatError(`Unsupported paint type: ${T}`)}}getPattern(f,T,H,I){let _=H;I!==s.SHADING&&(_=p.Util.transform(_,T.baseTransform),this.matrix&&(_=p.Util.transform(_,this.matrix)));const M=this.createPatternCanvas(T);let te=new DOMMatrix(_);te=te.translate(M.offsetX,M.offsetY),te=te.scale(1/M.scaleX,1/M.scaleY);const ie=f.createPattern(M.canvas,"repeat");return ie.setTransform(te),ie}}c.TilingPattern=b}),((r,c,q)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.convertBlackAndWhiteToRGBA=s,c.convertToRGBA=e,c.grayToRGBA=ee;var p=q(1);function e(U){switch(U.kind){case p.ImageKind.GRAYSCALE_1BPP:return s(U);case p.ImageKind.RGB_24BPP:return N(U)}return null}function s({src:U,srcPos:o=0,dest:t,width:a,height:g,nonBlackColor:d=4294967295,inverseDecode:i=!1}){const b=p.FeatureTest.isLittleEndian?4278190080:255,[y,f]=i?[d,b]:[b,d],T=a>>3,H=a&7,I=U.length;t=new Uint32Array(t.buffer);let _=0;for(let M=0;M<g;M++){for(const ie=o+T;o<ie;o++){const Y=o<I?U[o]:255;t[_++]=Y&128?f:y,t[_++]=Y&64?f:y,t[_++]=Y&32?f:y,t[_++]=Y&16?f:y,t[_++]=Y&8?f:y,t[_++]=Y&4?f:y,t[_++]=Y&2?f:y,t[_++]=Y&1?f:y}if(H===0)continue;const te=o<I?U[o++]:255;for(let ie=0;ie<H;ie++)t[_++]=te&1<<7-ie?f:y}return{srcPos:o,destPos:_}}function N({src:U,srcPos:o=0,dest:t,destPos:a=0,width:g,height:d}){let i=0;const b=U.length>>2,y=new Uint32Array(U.buffer,o,b);if(p.FeatureTest.isLittleEndian){for(;i<b-2;i+=3,a+=4){const f=y[i],T=y[i+1],H=y[i+2];t[a]=f|4278190080,t[a+1]=f>>>24|T<<8|4278190080,t[a+2]=T>>>16|H<<16|4278190080,t[a+3]=H>>>8|4278190080}for(let f=i*4,T=U.length;f<T;f+=3)t[a++]=U[f]|U[f+1]<<8|U[f+2]<<16|4278190080}else{for(;i<b-2;i+=3,a+=4){const f=y[i],T=y[i+1],H=y[i+2];t[a]=f|255,t[a+1]=f<<24|T>>>8|255,t[a+2]=T<<16|H>>>16|255,t[a+3]=H<<8|255}for(let f=i*4,T=U.length;f<T;f+=3)t[a++]=U[f]<<24|U[f+1]<<16|U[f+2]<<8|255}return{srcPos:o,destPos:a}}function ee(U,o){if(p.FeatureTest.isLittleEndian)for(let t=0,a=U.length;t<a;t++)o[t]=U[t]*65793|4278190080;else for(let t=0,a=U.length;t<a;t++)o[t]=U[t]*16843008|255}}),((r,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.GlobalWorkerOptions=void 0;const q=Object.create(null);c.GlobalWorkerOptions=q,q.workerPort=null,q.workerSrc=""}),((r,c,q)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.MessageHandler=void 0;var p=q(1);const e={DATA:1,ERROR:2},s={CANCEL:1,CANCEL_COMPLETE:2,CLOSE:3,ENQUEUE:4,ERROR:5,PULL:6,PULL_COMPLETE:7,START_COMPLETE:8};function N(U){switch(U instanceof Error||typeof U=="object"&&U!==null||(0,p.unreachable)('wrapReason: Expected "reason" to be a (possibly cloned) Error.'),U.name){case"AbortException":return new p.AbortException(U.message);case"MissingPDFException":return new p.MissingPDFException(U.message);case"PasswordException":return new p.PasswordException(U.message,U.code);case"UnexpectedResponseException":return new p.UnexpectedResponseException(U.message,U.status);case"UnknownErrorException":return new p.UnknownErrorException(U.message,U.details);default:return new p.UnknownErrorException(U.message,U.toString())}}class ee{constructor(o,t,a){this.sourceName=o,this.targetName=t,this.comObj=a,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=g=>{const d=g.data;if(d.targetName!==this.sourceName)return;if(d.stream){this.#t(d);return}if(d.callback){const b=d.callbackId,y=this.callbackCapabilities[b];if(!y)throw new Error(`Cannot resolve callback ${b}`);if(delete this.callbackCapabilities[b],d.callback===e.DATA)y.resolve(d.data);else if(d.callback===e.ERROR)y.reject(N(d.reason));else throw new Error("Unexpected callback case");return}const i=this.actionHandler[d.action];if(!i)throw new Error(`Unknown action from worker: ${d.action}`);if(d.callbackId){const b=this.sourceName,y=d.sourceName;new Promise(function(f){f(i(d.data))}).then(function(f){a.postMessage({sourceName:b,targetName:y,callback:e.DATA,callbackId:d.callbackId,data:f})},function(f){a.postMessage({sourceName:b,targetName:y,callback:e.ERROR,callbackId:d.callbackId,reason:N(f)})});return}if(d.streamId){this.#e(d);return}i(d.data)},a.addEventListener("message",this._onComObjOnMessage)}on(o,t){const a=this.actionHandler;if(a[o])throw new Error(`There is already an actionName called "${o}"`);a[o]=t}send(o,t,a){this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:o,data:t},a)}sendWithPromise(o,t,a){const g=this.callbackId++,d=new p.PromiseCapability;this.callbackCapabilities[g]=d;try{this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:o,callbackId:g,data:t},a)}catch(i){d.reject(i)}return d.promise}sendWithStream(o,t,a,g){const d=this.streamId++,i=this.sourceName,b=this.targetName,y=this.comObj;return new ReadableStream({start:f=>{const T=new p.PromiseCapability;return this.streamControllers[d]={controller:f,startCall:T,pullCall:null,cancelCall:null,isClosed:!1},y.postMessage({sourceName:i,targetName:b,action:o,streamId:d,data:t,desiredSize:f.desiredSize},g),T.promise},pull:f=>{const T=new p.PromiseCapability;return this.streamControllers[d].pullCall=T,y.postMessage({sourceName:i,targetName:b,stream:s.PULL,streamId:d,desiredSize:f.desiredSize}),T.promise},cancel:f=>{(0,p.assert)(f instanceof Error,"cancel must have a valid reason");const T=new p.PromiseCapability;return this.streamControllers[d].cancelCall=T,this.streamControllers[d].isClosed=!0,y.postMessage({sourceName:i,targetName:b,stream:s.CANCEL,streamId:d,reason:N(f)}),T.promise}},a)}#e(o){const t=o.streamId,a=this.sourceName,g=o.sourceName,d=this.comObj,i=this,b=this.actionHandler[o.action],y={enqueue(f,T=1,H){if(this.isCancelled)return;const I=this.desiredSize;this.desiredSize-=T,I>0&&this.desiredSize<=0&&(this.sinkCapability=new p.PromiseCapability,this.ready=this.sinkCapability.promise),d.postMessage({sourceName:a,targetName:g,stream:s.ENQUEUE,streamId:t,chunk:f},H)},close(){this.isCancelled||(this.isCancelled=!0,d.postMessage({sourceName:a,targetName:g,stream:s.CLOSE,streamId:t}),delete i.streamSinks[t])},error(f){(0,p.assert)(f instanceof Error,"error must have a valid reason"),!this.isCancelled&&(this.isCancelled=!0,d.postMessage({sourceName:a,targetName:g,stream:s.ERROR,streamId:t,reason:N(f)}))},sinkCapability:new p.PromiseCapability,onPull:null,onCancel:null,isCancelled:!1,desiredSize:o.desiredSize,ready:null};y.sinkCapability.resolve(),y.ready=y.sinkCapability.promise,this.streamSinks[t]=y,new Promise(function(f){f(b(o.data,y))}).then(function(){d.postMessage({sourceName:a,targetName:g,stream:s.START_COMPLETE,streamId:t,success:!0})},function(f){d.postMessage({sourceName:a,targetName:g,stream:s.START_COMPLETE,streamId:t,reason:N(f)})})}#t(o){const t=o.streamId,a=this.sourceName,g=o.sourceName,d=this.comObj,i=this.streamControllers[t],b=this.streamSinks[t];switch(o.stream){case s.START_COMPLETE:o.success?i.startCall.resolve():i.startCall.reject(N(o.reason));break;case s.PULL_COMPLETE:o.success?i.pullCall.resolve():i.pullCall.reject(N(o.reason));break;case s.PULL:if(!b){d.postMessage({sourceName:a,targetName:g,stream:s.PULL_COMPLETE,streamId:t,success:!0});break}b.desiredSize<=0&&o.desiredSize>0&&b.sinkCapability.resolve(),b.desiredSize=o.desiredSize,new Promise(function(y){y(b.onPull?.())}).then(function(){d.postMessage({sourceName:a,targetName:g,stream:s.PULL_COMPLETE,streamId:t,success:!0})},function(y){d.postMessage({sourceName:a,targetName:g,stream:s.PULL_COMPLETE,streamId:t,reason:N(y)})});break;case s.ENQUEUE:if((0,p.assert)(i,"enqueue should have stream controller"),i.isClosed)break;i.controller.enqueue(o.chunk);break;case s.CLOSE:if((0,p.assert)(i,"close should have stream controller"),i.isClosed)break;i.isClosed=!0,i.controller.close(),this.#n(i,t);break;case s.ERROR:(0,p.assert)(i,"error should have stream controller"),i.controller.error(N(o.reason)),this.#n(i,t);break;case s.CANCEL_COMPLETE:o.success?i.cancelCall.resolve():i.cancelCall.reject(N(o.reason)),this.#n(i,t);break;case s.CANCEL:if(!b)break;new Promise(function(y){y(b.onCancel?.(N(o.reason)))}).then(function(){d.postMessage({sourceName:a,targetName:g,stream:s.CANCEL_COMPLETE,streamId:t,success:!0})},function(y){d.postMessage({sourceName:a,targetName:g,stream:s.CANCEL_COMPLETE,streamId:t,reason:N(y)})}),b.sinkCapability.reject(N(o.reason)),b.isCancelled=!0,delete this.streamSinks[t];break;default:throw new Error("Unexpected stream case")}}async#n(o,t){await Promise.allSettled([o.startCall?.promise,o.pullCall?.promise,o.cancelCall?.promise]),delete this.streamControllers[t]}destroy(){this.comObj.removeEventListener("message",this._onComObjOnMessage)}}c.MessageHandler=ee}),((r,c,q)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.Metadata=void 0;var p=q(1);class e{#e;#t;constructor({parsedData:N,rawData:ee}){this.#e=N,this.#t=ee}getRaw(){return this.#t}get(N){return this.#e.get(N)??null}getAll(){return(0,p.objectFromMap)(this.#e)}has(N){return this.#e.has(N)}}c.Metadata=e}),((r,c,q)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.OptionalContentConfig=void 0;var p=q(1),e=q(8);const s=Symbol("INTERNAL");class N{#e=!0;constructor(o,t){this.name=o,this.intent=t}get visible(){return this.#e}_setVisible(o,t){o!==s&&(0,p.unreachable)("Internal method `_setVisible` called."),this.#e=t}}class ee{#e=null;#t=new Map;#n=null;#r=null;constructor(o){if(this.name=null,this.creator=null,o!==null){this.name=o.name,this.creator=o.creator,this.#r=o.order;for(const t of o.groups)this.#t.set(t.id,new N(t.name,t.intent));if(o.baseState==="OFF")for(const t of this.#t.values())t._setVisible(s,!1);for(const t of o.on)this.#t.get(t)._setVisible(s,!0);for(const t of o.off)this.#t.get(t)._setVisible(s,!1);this.#n=this.getHash()}}#o(o){const t=o.length;if(t<2)return!0;const a=o[0];for(let g=1;g<t;g++){const d=o[g];let i;if(Array.isArray(d))i=this.#o(d);else if(this.#t.has(d))i=this.#t.get(d).visible;else return(0,p.warn)(`Optional content group not found: ${d}`),!0;switch(a){case"And":if(!i)return!1;break;case"Or":if(i)return!0;break;case"Not":return!i;default:return!0}}return a==="And"}isVisible(o){if(this.#t.size===0)return!0;if(!o)return(0,p.warn)("Optional content group not defined."),!0;if(o.type==="OCG")return this.#t.has(o.id)?this.#t.get(o.id).visible:((0,p.warn)(`Optional content group not found: ${o.id}`),!0);if(o.type==="OCMD"){if(o.expression)return this.#o(o.expression);if(!o.policy||o.policy==="AnyOn"){for(const t of o.ids){if(!this.#t.has(t))return(0,p.warn)(`Optional content group not found: ${t}`),!0;if(this.#t.get(t).visible)return!0}return!1}else if(o.policy==="AllOn"){for(const t of o.ids){if(!this.#t.has(t))return(0,p.warn)(`Optional content group not found: ${t}`),!0;if(!this.#t.get(t).visible)return!1}return!0}else if(o.policy==="AnyOff"){for(const t of o.ids){if(!this.#t.has(t))return(0,p.warn)(`Optional content group not found: ${t}`),!0;if(!this.#t.get(t).visible)return!0}return!1}else if(o.policy==="AllOff"){for(const t of o.ids){if(!this.#t.has(t))return(0,p.warn)(`Optional content group not found: ${t}`),!0;if(this.#t.get(t).visible)return!1}return!0}return(0,p.warn)(`Unknown optional content policy ${o.policy}.`),!0}return(0,p.warn)(`Unknown group type ${o.type}.`),!0}setVisibility(o,t=!0){if(!this.#t.has(o)){(0,p.warn)(`Optional content group not found: ${o}`);return}this.#t.get(o)._setVisible(s,!!t),this.#e=null}get hasInitialVisibility(){return this.#n===null||this.getHash()===this.#n}getOrder(){return this.#t.size?this.#r?this.#r.slice():[...this.#t.keys()]:null}getGroups(){return this.#t.size>0?(0,p.objectFromMap)(this.#t):null}getGroup(o){return this.#t.get(o)||null}getHash(){if(this.#e!==null)return this.#e;const o=new e.MurmurHash3_64;for(const[t,a]of this.#t)o.update(`${t}:${a.visible}`);return this.#e=o.hexdigest()}}c.OptionalContentConfig=ee}),((r,c,q)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.PDFDataTransportStream=void 0;var p=q(1),e=q(6);class s{constructor({length:o,initialData:t,progressiveDone:a=!1,contentDispositionFilename:g=null,disableRange:d=!1,disableStream:i=!1},b){if((0,p.assert)(b,'PDFDataTransportStream - missing required "pdfDataRangeTransport" argument.'),this._queuedChunks=[],this._progressiveDone=a,this._contentDispositionFilename=g,t?.length>0){const y=t instanceof Uint8Array&&t.byteLength===t.buffer.byteLength?t.buffer:new Uint8Array(t).buffer;this._queuedChunks.push(y)}this._pdfDataRangeTransport=b,this._isStreamingSupported=!i,this._isRangeSupported=!d,this._contentLength=o,this._fullRequestReader=null,this._rangeReaders=[],this._pdfDataRangeTransport.addRangeListener((y,f)=>{this._onReceiveData({begin:y,chunk:f})}),this._pdfDataRangeTransport.addProgressListener((y,f)=>{this._onProgress({loaded:y,total:f})}),this._pdfDataRangeTransport.addProgressiveReadListener(y=>{this._onReceiveData({chunk:y})}),this._pdfDataRangeTransport.addProgressiveDoneListener(()=>{this._onProgressiveDone()}),this._pdfDataRangeTransport.transportReady()}_onReceiveData({begin:o,chunk:t}){const a=t instanceof Uint8Array&&t.byteLength===t.buffer.byteLength?t.buffer:new Uint8Array(t).buffer;if(o===void 0)this._fullRequestReader?this._fullRequestReader._enqueue(a):this._queuedChunks.push(a);else{const g=this._rangeReaders.some(function(d){return d._begin!==o?!1:(d._enqueue(a),!0)});(0,p.assert)(g,"_onReceiveData - no `PDFDataTransportStreamRangeReader` instance found.")}}get _progressiveDataLength(){return this._fullRequestReader?._loaded??0}_onProgress(o){o.total===void 0?this._rangeReaders[0]?.onProgress?.({loaded:o.loaded}):this._fullRequestReader?.onProgress?.({loaded:o.loaded,total:o.total})}_onProgressiveDone(){this._fullRequestReader?.progressiveDone(),this._progressiveDone=!0}_removeRangeReader(o){const t=this._rangeReaders.indexOf(o);t>=0&&this._rangeReaders.splice(t,1)}getFullReader(){(0,p.assert)(!this._fullRequestReader,"PDFDataTransportStream.getFullReader can only be called once.");const o=this._queuedChunks;return this._queuedChunks=null,new N(this,o,this._progressiveDone,this._contentDispositionFilename)}getRangeReader(o,t){if(t<=this._progressiveDataLength)return null;const a=new ee(this,o,t);return this._pdfDataRangeTransport.requestDataRange(o,t),this._rangeReaders.push(a),a}cancelAllRequests(o){this._fullRequestReader?.cancel(o);for(const t of this._rangeReaders.slice(0))t.cancel(o);this._pdfDataRangeTransport.abort()}}c.PDFDataTransportStream=s;class N{constructor(o,t,a=!1,g=null){this._stream=o,this._done=a||!1,this._filename=(0,e.isPdfFile)(g)?g:null,this._queuedChunks=t||[],this._loaded=0;for(const d of this._queuedChunks)this._loaded+=d.byteLength;this._requests=[],this._headersReady=Promise.resolve(),o._fullRequestReader=this,this.onProgress=null}_enqueue(o){this._done||(this._requests.length>0?this._requests.shift().resolve({value:o,done:!1}):this._queuedChunks.push(o),this._loaded+=o.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 o=new p.PromiseCapability;return this._requests.push(o),o.promise}cancel(o){this._done=!0;for(const t of this._requests)t.resolve({value:void 0,done:!0});this._requests.length=0}progressiveDone(){this._done||(this._done=!0)}}class ee{constructor(o,t,a){this._stream=o,this._begin=t,this._end=a,this._queuedChunk=null,this._requests=[],this._done=!1,this.onProgress=null}_enqueue(o){if(!this._done){if(this._requests.length===0)this._queuedChunk=o;else{this._requests.shift().resolve({value:o,done:!1});for(const a of this._requests)a.resolve({value:void 0,done:!0});this._requests.length=0}this._done=!0,this._stream._removeRangeReader(this)}}get isStreamingSupported(){return!1}async read(){if(this._queuedChunk){const t=this._queuedChunk;return this._queuedChunk=null,{value:t,done:!1}}if(this._done)return{value:void 0,done:!0};const o=new p.PromiseCapability;return this._requests.push(o),o.promise}cancel(o){this._done=!0;for(const t of this._requests)t.resolve({value:void 0,done:!0});this._requests.length=0,this._stream._removeRangeReader(this)}}}),((r,c,q)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.PDFFetchStream=void 0;var p=q(1),e=q(20);function s(a,g,d){return{method:"GET",headers:a,signal:d.signal,mode:"cors",credentials:g?"include":"same-origin",redirect:"follow"}}function N(a){const g=new Headers;for(const d in a){const i=a[d];i!==void 0&&g.append(d,i)}return g}function ee(a){return a instanceof Uint8Array?a.buffer:a instanceof ArrayBuffer?a:((0,p.warn)(`getArrayBuffer - unexpected data format: ${a}`),new Uint8Array(a).buffer)}class U{constructor(g){this.source=g,this.isHttp=/^https?:/i.test(g.url),this.httpHeaders=this.isHttp&&g.httpHeaders||{},this._fullRequestReader=null,this._rangeRequestReaders=[]}get _progressiveDataLength(){return this._fullRequestReader?._loaded??0}getFullReader(){return(0,p.assert)(!this._fullRequestReader,"PDFFetchStream.getFullReader can only be called once."),this._fullRequestReader=new o(this),this._fullRequestReader}getRangeReader(g,d){if(d<=this._progressiveDataLength)return null;const i=new t(this,g,d);return this._rangeRequestReaders.push(i),i}cancelAllRequests(g){this._fullRequestReader?.cancel(g);for(const d of this._rangeRequestReaders.slice(0))d.cancel(g)}}c.PDFFetchStream=U;class o{constructor(g){this._stream=g,this._reader=null,this._loaded=0,this._filename=null;const d=g.source;this._withCredentials=d.withCredentials||!1,this._contentLength=d.length,this._headersCapability=new p.PromiseCapability,this._disableRange=d.disableRange||!1,this._rangeChunkSize=d.rangeChunkSize,!this._rangeChunkSize&&!this._disableRange&&(this._disableRange=!0),this._abortController=new AbortController,this._isStreamingSupported=!d.disableStream,this._isRangeSupported=!d.disableRange,this._headers=N(this._stream.httpHeaders);const i=d.url;fetch(i,s(this._headers,this._withCredentials,this._abortController)).then(b=>{if(!(0,e.validateResponseStatus)(b.status))throw(0,e.createResponseStatusError)(b.status,i);this._reader=b.body.getReader(),this._headersCapability.resolve();const y=H=>b.headers.get(H),{allowRangeRequests:f,suggestedLength:T}=(0,e.validateRangeRequestCapabilities)({getResponseHeader:y,isHttp:this._stream.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=f,this._contentLength=T||this._contentLength,this._filename=(0,e.extractFilenameFromHeader)(y),!this._isStreamingSupported&&this._isRangeSupported&&this.cancel(new p.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:g,done:d}=await this._reader.read();return d?{value:g,done:d}:(this._loaded+=g.byteLength,this.onProgress?.({loaded:this._loaded,total:this._contentLength}),{value:ee(g),done:!1})}cancel(g){this._reader?.cancel(g),this._abortController.abort()}}class t{constructor(g,d,i){this._stream=g,this._reader=null,this._loaded=0;const b=g.source;this._withCredentials=b.withCredentials||!1,this._readCapability=new p.PromiseCapability,this._isStreamingSupported=!b.disableStream,this._abortController=new AbortController,this._headers=N(this._stream.httpHeaders),this._headers.append("Range",`bytes=${d}-${i-1}`);const y=b.url;fetch(y,s(this._headers,this._withCredentials,this._abortController)).then(f=>{if(!(0,e.validateResponseStatus)(f.status))throw(0,e.createResponseStatusError)(f.status,y);this._readCapability.resolve(),this._reader=f.body.getReader()}).catch(this._readCapability.reject),this.onProgress=null}get isStreamingSupported(){return this._isStreamingSupported}async read(){await this._readCapability.promise;const{value:g,done:d}=await this._reader.read();return d?{value:g,done:d}:(this._loaded+=g.byteLength,this.onProgress?.({loaded:this._loaded}),{value:ee(g),done:!1})}cancel(g){this._reader?.cancel(g),this._abortController.abort()}}}),((r,c,q)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.createResponseStatusError=U,c.extractFilenameFromHeader=ee,c.validateRangeRequestCapabilities=N,c.validateResponseStatus=o;var p=q(1),e=q(21),s=q(6);function N({getResponseHeader:t,isHttp:a,rangeChunkSize:g,disableRange:d}){const i={allowRangeRequests:!1,suggestedLength:void 0},b=parseInt(t("Content-Length"),10);return!Number.isInteger(b)||(i.suggestedLength=b,b<=2*g)||d||!a||t("Accept-Ranges")!=="bytes"||(t("Content-Encoding")||"identity")!=="identity"||(i.allowRangeRequests=!0),i}function ee(t){const a=t("Content-Disposition");if(a){let g=(0,e.getFilenameFromContentDispositionHeader)(a);if(g.includes("%"))try{g=decodeURIComponent(g)}catch{}if((0,s.isPdfFile)(g))return g}return null}function U(t,a){return t===404||t===0&&a.startsWith("file:")?new p.MissingPDFException('Missing PDF "'+a+'".'):new p.UnexpectedResponseException(`Unexpected server response (${t}) while retrieving PDF "${a}".`,t)}function o(t){return t===200||t===206}}),((r,c,q)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.getFilenameFromContentDispositionHeader=e;var p=q(1);function e(s){let N=!0,ee=U("filename\\*","i").exec(s);if(ee){ee=ee[1];let b=g(ee);return b=unescape(b),b=d(b),b=i(b),t(b)}if(ee=a(s),ee){const b=i(ee);return t(b)}if(ee=U("filename","i").exec(s),ee){ee=ee[1];let b=g(ee);return b=i(b),t(b)}function U(b,y){return new RegExp("(?:^|;)\\s*"+b+'\\s*=\\s*([^";\\s][^;\\s]*|"(?:[^"\\\\]|\\\\"?)+"?)',y)}function o(b,y){if(b){if(!/^[\x00-\xFF]+$/.test(y))return y;try{const f=new TextDecoder(b,{fatal:!0}),T=(0,p.stringToBytes)(y);y=f.decode(T),N=!1}catch{}}return y}function t(b){return N&&/[\x80-\xff]/.test(b)&&(b=o("utf-8",b),N&&(b=o("iso-8859-1",b))),b}function a(b){const y=[];let f;const T=U("filename\\*((?!0\\d)\\d+)(\\*?)","ig");for(;(f=T.exec(b))!==null;){let[,I,_,M]=f;if(I=parseInt(I,10),I in y){if(I===0)break;continue}y[I]=[_,M]}const H=[];for(let I=0;I<y.length&&I in y;++I){let[_,M]=y[I];M=g(M),_&&(M=unescape(M),I===0&&(M=d(M))),H.push(M)}return H.join("")}function g(b){if(b.startsWith('"')){const y=b.slice(1).split('\\"');for(let f=0;f<y.length;++f){const T=y[f].indexOf('"');T!==-1&&(y[f]=y[f].slice(0,T),y.length=f+1),y[f]=y[f].replaceAll(/\\(.)/g,"$1")}b=y.join('"')}return b}function d(b){const y=b.indexOf("'");if(y===-1)return b;const f=b.slice(0,y),H=b.slice(y+1).replace(/^[^']*'/,"");return o(f,H)}function i(b){return!b.startsWith("=?")||/[\x00-\x19\x80-\xff]/.test(b)?b:b.replaceAll(/=\?([\w-]*)\?([QqBb])\?((?:[^?]|\?(?!=))*)\?=/g,function(y,f,T,H){if(T==="q"||T==="Q")return H=H.replaceAll("_"," "),H=H.replaceAll(/=([0-9a-fA-F]{2})/g,function(I,_){return String.fromCharCode(parseInt(_,16))}),o(f,H);try{H=atob(H)}catch{}return o(f,H)})}return""}}),((r,c,q)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.PDFNetworkStream=void 0;var p=q(1),e=q(20);const s=200,N=206;function ee(g){const d=g.response;return typeof d!="string"?d:(0,p.stringToBytes)(d).buffer}class U{constructor(d,i={}){this.url=d,this.isHttp=/^https?:/i.test(d),this.httpHeaders=this.isHttp&&i.httpHeaders||Object.create(null),this.withCredentials=i.withCredentials||!1,this.currXhrId=0,this.pendingRequests=Object.create(null)}requestRange(d,i,b){const y={begin:d,end:i};for(const f in b)y[f]=b[f];return this.request(y)}requestFull(d){return this.request(d)}request(d){const i=new XMLHttpRequest,b=this.currXhrId++,y=this.pendingRequests[b]={xhr:i};i.open("GET",this.url),i.withCredentials=this.withCredentials;for(const f in this.httpHeaders){const T=this.httpHeaders[f];T!==void 0&&i.setRequestHeader(f,T)}return this.isHttp&&"begin"in d&&"end"in d?(i.setRequestHeader("Range",`bytes=${d.begin}-${d.end-1}`),y.expectedStatus=N):y.expectedStatus=s,i.responseType="arraybuffer",d.onError&&(i.onerror=function(f){d.onError(i.status)}),i.onreadystatechange=this.onStateChange.bind(this,b),i.onprogress=this.onProgress.bind(this,b),y.onHeadersReceived=d.onHeadersReceived,y.onDone=d.onDone,y.onError=d.onError,y.onProgress=d.onProgress,i.send(null),b}onProgress(d,i){const b=this.pendingRequests[d];b&&b.onProgress?.(i)}onStateChange(d,i){const b=this.pendingRequests[d];if(!b)return;const y=b.xhr;if(y.readyState>=2&&b.onHeadersReceived&&(b.onHeadersReceived(),delete b.onHeadersReceived),y.readyState!==4||!(d in this.pendingRequests))return;if(delete this.pendingRequests[d],y.status===0&&this.isHttp){b.onError?.(y.status);return}const f=y.status||s;if(!(f===s&&b.expectedStatus===N)&&f!==b.expectedStatus){b.onError?.(y.status);return}const H=ee(y);if(f===N){const I=y.getResponseHeader("Content-Range"),_=/bytes (\d+)-(\d+)\/(\d+)/.exec(I);b.onDone({begin:parseInt(_[1],10),chunk:H})}else H?b.onDone({begin:0,chunk:H}):b.onError?.(y.status)}getRequestXhr(d){return this.pendingRequests[d].xhr}isPendingRequest(d){return d in this.pendingRequests}abortRequest(d){const i=this.pendingRequests[d].xhr;delete this.pendingRequests[d],i.abort()}}class o{constructor(d){this._source=d,this._manager=new U(d.url,{httpHeaders:d.httpHeaders,withCredentials:d.withCredentials}),this._rangeChunkSize=d.rangeChunkSize,this._fullRequestReader=null,this._rangeRequestReaders=[]}_onRangeRequestReaderClosed(d){const i=this._rangeRequestReaders.indexOf(d);i>=0&&this._rangeRequestReaders.splice(i,1)}getFullReader(){return(0,p.assert)(!this._fullRequestReader,"PDFNetworkStream.getFullReader can only be called once."),this._fullRequestReader=new t(this._manager,this._source),this._fullRequestReader}getRangeReader(d,i){const b=new a(this._manager,d,i);return b.onClosed=this._onRangeRequestReaderClosed.bind(this),this._rangeRequestReaders.push(b),b}cancelAllRequests(d){this._fullRequestReader?.cancel(d);for(const i of this._rangeRequestReaders.slice(0))i.cancel(d)}}c.PDFNetworkStream=o;class t{constructor(d,i){this._manager=d;const b={onHeadersReceived:this._onHeadersReceived.bind(this),onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)};this._url=i.url,this._fullRequestId=d.requestFull(b),this._headersReceivedCapability=new p.PromiseCapability,this._disableRange=i.disableRange||!1,this._contentLength=i.length,this._rangeChunkSize=i.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 d=this._fullRequestId,i=this._manager.getRequestXhr(d),b=T=>i.getResponseHeader(T),{allowRangeRequests:y,suggestedLength:f}=(0,e.validateRangeRequestCapabilities)({getResponseHeader:b,isHttp:this._manager.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});y&&(this._isRangeSupported=!0),this._contentLength=f||this._contentLength,this._filename=(0,e.extractFilenameFromHeader)(b),this._isRangeSupported&&this._manager.abortRequest(d),this._headersReceivedCapability.resolve()}_onDone(d){if(d&&(this._requests.length>0?this._requests.shift().resolve({value:d.chunk,done:!1}):this._cachedChunks.push(d.chunk)),this._done=!0,!(this._cachedChunks.length>0)){for(const i of this._requests)i.resolve({value:void 0,done:!0});this._requests.length=0}}_onError(d){this._storedError=(0,e.createResponseStatusError)(d,this._url),this._headersReceivedCapability.reject(this._storedError);for(const i of this._requests)i.reject(this._storedError);this._requests.length=0,this._cachedChunks.length=0}_onProgress(d){this.onProgress?.({loaded:d.loaded,total:d.lengthComputable?d.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 d=new p.PromiseCapability;return this._requests.push(d),d.promise}cancel(d){this._done=!0,this._headersReceivedCapability.reject(d);for(const i of this._requests)i.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._fullRequestId)&&this._manager.abortRequest(this._fullRequestId),this._fullRequestReader=null}}class a{constructor(d,i,b){this._manager=d;const y={onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)};this._url=d.url,this._requestId=d.requestRange(i,b,y),this._requests=[],this._queuedChunk=null,this._done=!1,this._storedError=void 0,this.onProgress=null,this.onClosed=null}_close(){this.onClosed?.(this)}_onDone(d){const i=d.chunk;this._requests.length>0?this._requests.shift().resolve({value:i,done:!1}):this._queuedChunk=i,this._done=!0;for(const b of this._requests)b.resolve({value:void 0,done:!0});this._requests.length=0,this._close()}_onError(d){this._storedError=(0,e.createResponseStatusError)(d,this._url);for(const i of this._requests)i.reject(this._storedError);this._requests.length=0,this._queuedChunk=null}_onProgress(d){this.isStreamingSupported||this.onProgress?.({loaded:d.loaded})}get isStreamingSupported(){return!1}async read(){if(this._storedError)throw this._storedError;if(this._queuedChunk!==null){const i=this._queuedChunk;return this._queuedChunk=null,{value:i,done:!1}}if(this._done)return{value:void 0,done:!0};const d=new p.PromiseCapability;return this._requests.push(d),d.promise}cancel(d){this._done=!0;for(const i of this._requests)i.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._requestId)&&this._manager.abortRequest(this._requestId),this._close()}}}),((r,c,q)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.PDFNodeStream=void 0;var p=q(1),e=q(20);const s=/^file:\/\/\/[a-zA-Z]:\//;function N(b){const y=index.require$$5,f=y.parse(b);return f.protocol==="file:"||f.host?f:/^[a-z]:[/\\]/i.test(b)?y.parse(`file:///${b}`):(f.host||(f.protocol="file:"),f)}class ee{constructor(y){this.source=y,this.url=N(y.url),this.isHttp=this.url.protocol==="http:"||this.url.protocol==="https:",this.isFsUrl=this.url.protocol==="file:",this.httpHeaders=this.isHttp&&y.httpHeaders||{},this._fullRequestReader=null,this._rangeRequestReaders=[]}get _progressiveDataLength(){return this._fullRequestReader?._loaded??0}getFullReader(){return(0,p.assert)(!this._fullRequestReader,"PDFNodeStream.getFullReader can only be called once."),this._fullRequestReader=this.isFsUrl?new d(this):new a(this),this._fullRequestReader}getRangeReader(y,f){if(f<=this._progressiveDataLength)return null;const T=this.isFsUrl?new i(this,y,f):new g(this,y,f);return this._rangeRequestReaders.push(T),T}cancelAllRequests(y){this._fullRequestReader?.cancel(y);for(const f of this._rangeRequestReaders.slice(0))f.cancel(y)}}c.PDFNodeStream=ee;class U{constructor(y){this._url=y.url,this._done=!1,this._storedError=null,this.onProgress=null;const f=y.source;this._contentLength=f.length,this._loaded=0,this._filename=null,this._disableRange=f.disableRange||!1,this._rangeChunkSize=f.rangeChunkSize,!this._rangeChunkSize&&!this._disableRange&&(this._disableRange=!0),this._isStreamingSupported=!f.disableStream,this._isRangeSupported=!f.disableRange,this._readableStream=null,this._readCapability=new p.PromiseCapability,this._headersCapability=new p.PromiseCapability}get headersReady(){return this._headersCapability.promise}get filename(){return this._filename}get contentLength(){return this._contentLength}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}async read(){if(await this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;const y=this._readableStream.read();return y===null?(this._readCapability=new p.PromiseCapability,this.read()):(this._loaded+=y.length,this.onProgress?.({loaded:this._loaded,total:this._contentLength}),{value:new Uint8Array(y).buffer,done:!1})}cancel(y){if(!this._readableStream){this._error(y);return}this._readableStream.destroy(y)}_error(y){this._storedError=y,this._readCapability.resolve()}_setReadableStream(y){this._readableStream=y,y.on("readable",()=>{this._readCapability.resolve()}),y.on("end",()=>{y.destroy(),this._done=!0,this._readCapability.resolve()}),y.on("error",f=>{this._error(f)}),!this._isStreamingSupported&&this._isRangeSupported&&this._error(new p.AbortException("streaming is disabled")),this._storedError&&this._readableStream.destroy(this._storedError)}}class o{constructor(y){this._url=y.url,this._done=!1,this._storedError=null,this.onProgress=null,this._loaded=0,this._readableStream=null,this._readCapability=new p.PromiseCapability;const f=y.source;this._isStreamingSupported=!f.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 y=this._readableStream.read();return y===null?(this._readCapability=new p.PromiseCapability,this.read()):(this._loaded+=y.length,this.onProgress?.({loaded:this._loaded}),{value:new Uint8Array(y).buffer,done:!1})}cancel(y){if(!this._readableStream){this._error(y);return}this._readableStream.destroy(y)}_error(y){this._storedError=y,this._readCapability.resolve()}_setReadableStream(y){this._readableStream=y,y.on("readable",()=>{this._readCapability.resolve()}),y.on("end",()=>{y.destroy(),this._done=!0,this._readCapability.resolve()}),y.on("error",f=>{this._error(f)}),this._storedError&&this._readableStream.destroy(this._storedError)}}function t(b,y){return{protocol:b.protocol,auth:b.auth,host:b.hostname,port:b.port,path:b.path,method:"GET",headers:y}}class a extends U{constructor(y){super(y);const f=T=>{if(T.statusCode===404){const M=new p.MissingPDFException(`Missing PDF "${this._url}".`);this._storedError=M,this._headersCapability.reject(M);return}this._headersCapability.resolve(),this._setReadableStream(T);const H=M=>this._readableStream.headers[M.toLowerCase()],{allowRangeRequests:I,suggestedLength:_}=(0,e.validateRangeRequestCapabilities)({getResponseHeader:H,isHttp:y.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=I,this._contentLength=_||this._contentLength,this._filename=(0,e.extractFilenameFromHeader)(H)};if(this._request=null,this._url.protocol==="http:"){const T=index.require$$5;this._request=T.request(t(this._url,y.httpHeaders),f)}else{const T=index.require$$5;this._request=T.request(t(this._url,y.httpHeaders),f)}this._request.on("error",T=>{this._storedError=T,this._headersCapability.reject(T)}),this._request.end()}}class g extends o{constructor(y,f,T){super(y),this._httpHeaders={};for(const I in y.httpHeaders){const _=y.httpHeaders[I];_!==void 0&&(this._httpHeaders[I]=_)}this._httpHeaders.Range=`bytes=${f}-${T-1}`;const H=I=>{if(I.statusCode===404){const _=new p.MissingPDFException(`Missing PDF "${this._url}".`);this._storedError=_;return}this._setReadableStream(I)};if(this._request=null,this._url.protocol==="http:"){const I=index.require$$5;this._request=I.request(t(this._url,this._httpHeaders),H)}else{const I=index.require$$5;this._request=I.request(t(this._url,this._httpHeaders),H)}this._request.on("error",I=>{this._storedError=I}),this._request.end()}}class d extends U{constructor(y){super(y);let f=decodeURIComponent(this._url.path);s.test(this._url.href)&&(f=f.replace(/^\//,""));const T=index.require$$5;T.lstat(f,(H,I)=>{if(H){H.code==="ENOENT"&&(H=new p.MissingPDFException(`Missing PDF "${f}".`)),this._storedError=H,this._headersCapability.reject(H);return}this._contentLength=I.size,this._setReadableStream(T.createReadStream(f)),this._headersCapability.resolve()})}}class i extends o{constructor(y,f,T){super(y);let H=decodeURIComponent(this._url.path);s.test(this._url.href)&&(H=H.replace(/^\//,""));const I=index.require$$5;this._setReadableStream(I.createReadStream(H,{start:f,end:T-1}))}}}),((r,c,q)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.SVGGraphics=void 0;var p=q(6),e=q(1);const s={fontStyle:"normal",fontWeight:"normal",fillColor:"#000000"},N="http://www.w3.org/XML/1998/namespace",ee="http://www.w3.org/1999/xlink",U=["butt","round","square"],o=["miter","round","bevel"],t=function(I,_="",M=!1){if(URL.createObjectURL&&typeof Blob<"u"&&!M)return URL.createObjectURL(new Blob([I],{type:_}));const te="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";let ie=`data:${_};base64,`;for(let Y=0,he=I.length;Y<he;Y+=3){const ge=I[Y]&255,Ne=I[Y+1]&255,ke=I[Y+2]&255,Oe=ge>>2,Ve=(ge&3)<<4|Ne>>4,Ee=Y+1<he?(Ne&15)<<2|ke>>6:64,G=Y+2<he?ke&63:64;ie+=te[Oe]+te[Ve]+te[Ee]+te[G]}return ie},a=(function(){const I=new Uint8Array([137,80,78,71,13,10,26,10]),_=12,M=new Int32Array(256);for(let ke=0;ke<256;ke++){let Oe=ke;for(let Ve=0;Ve<8;Ve++)Oe=Oe&1?3988292384^Oe>>1&2147483647:Oe>>1&2147483647;M[ke]=Oe}function te(ke,Oe,Ve){let Ee=-1;for(let G=Oe;G<Ve;G++){const A=(Ee^ke[G])&255,m=M[A];Ee=Ee>>>8^m}return Ee^-1}function ie(ke,Oe,Ve,Ee){let G=Ee;const A=Oe.length;Ve[G]=A>>24&255,Ve[G+1]=A>>16&255,Ve[G+2]=A>>8&255,Ve[G+3]=A&255,G+=4,Ve[G]=ke.charCodeAt(0)&255,Ve[G+1]=ke.charCodeAt(1)&255,Ve[G+2]=ke.charCodeAt(2)&255,Ve[G+3]=ke.charCodeAt(3)&255,G+=4,Ve.set(Oe,G),G+=Oe.length;const m=te(Ve,Ee+4,G);Ve[G]=m>>24&255,Ve[G+1]=m>>16&255,Ve[G+2]=m>>8&255,Ve[G+3]=m&255}function Y(ke,Oe,Ve){let Ee=1,G=0;for(let A=Oe;A<Ve;++A)Ee=(Ee+(ke[A]&255))%65521,G=(G+Ee)%65521;return G<<16|Ee}function he(ke){if(!e.isNodeJS)return ge(ke);try{const Oe=parseInt(process.versions.node)>=8?ke:Buffer.from(ke),Ve=index.require$$5.deflateSync(Oe,{level:9});return Ve instanceof Uint8Array?Ve:new Uint8Array(Ve)}catch(Oe){(0,e.warn)("Not compressing PNG because zlib.deflateSync is unavailable: "+Oe)}return ge(ke)}function ge(ke){let Oe=ke.length;const Ve=65535,Ee=Math.ceil(Oe/Ve),G=new Uint8Array(2+Oe+Ee*5+4);let A=0;G[A++]=120,G[A++]=156;let m=0;for(;Oe>Ve;)G[A++]=0,G[A++]=255,G[A++]=255,G[A++]=0,G[A++]=0,G.set(ke.subarray(m,m+Ve),A),A+=Ve,m+=Ve,Oe-=Ve;G[A++]=1,G[A++]=Oe&255,G[A++]=Oe>>8&255,G[A++]=~Oe&65535&255,G[A++]=(~Oe&65535)>>8&255,G.set(ke.subarray(m),A),A+=ke.length-m;const v=Y(ke,0,ke.length);return G[A++]=v>>24&255,G[A++]=v>>16&255,G[A++]=v>>8&255,G[A++]=v&255,G}function Ne(ke,Oe,Ve,Ee){const G=ke.width,A=ke.height;let m,v,C;const V=ke.data;switch(Oe){case e.ImageKind.GRAYSCALE_1BPP:v=0,m=1,C=G+7>>3;break;case e.ImageKind.RGB_24BPP:v=2,m=8,C=G*3;break;case e.ImageKind.RGBA_32BPP:v=6,m=8,C=G*4;break;default:throw new Error("invalid format")}const W=new Uint8Array((1+C)*A);let K=0,L=0;for(let Z=0;Z<A;++Z)W[K++]=0,W.set(V.subarray(L,L+C),K),L+=C,K+=C;if(Oe===e.ImageKind.GRAYSCALE_1BPP&&Ee){K=0;for(let Z=0;Z<A;Z++){K++;for(let re=0;re<C;re++)W[K++]^=255}}const l=new Uint8Array([G>>24&255,G>>16&255,G>>8&255,G&255,A>>24&255,A>>16&255,A>>8&255,A&255,m,v,0,0,0]),S=he(W),R=I.length+_*3+l.length+S.length,O=new Uint8Array(R);let B=0;return O.set(I,B),B+=I.length,ie("IHDR",l,O,B),B+=_+l.length,ie("IDATA",S,O,B),B+=_+S.length,ie("IEND",new Uint8Array(0),O,B),t(O,"image/png",Ve)}return function(Oe,Ve,Ee){const G=Oe.kind===void 0?e.ImageKind.GRAYSCALE_1BPP:Oe.kind;return Ne(Oe,G,Ve,Ee)}})();class g{constructor(){this.fontSizeScale=1,this.fontWeight=s.fontWeight,this.fontSize=0,this.textMatrix=e.IDENTITY_MATRIX,this.fontMatrix=e.FONT_IDENTITY_MATRIX,this.leading=0,this.textRenderingMode=e.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=s.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(_,M){this.x=_,this.y=M}}function d(I){let _=[];const M=[];for(const te of I){if(te.fn==="save"){_.push({fnId:92,fn:"group",items:[]}),M.push(_),_=_.at(-1).items;continue}te.fn==="restore"?_=M.pop():_.push(te)}return _}function i(I){if(Number.isInteger(I))return I.toString();const _=I.toFixed(10);let M=_.length-1;if(_[M]!=="0")return _;do M--;while(_[M]==="0");return _.substring(0,_[M]==="."?M:M+1)}function b(I){if(I[4]===0&&I[5]===0){if(I[1]===0&&I[2]===0)return I[0]===1&&I[3]===1?"":`scale(${i(I[0])} ${i(I[3])})`;if(I[0]===I[3]&&I[1]===-I[2]){const _=Math.acos(I[0])*180/Math.PI;return`rotate(${i(_)})`}}else if(I[0]===1&&I[1]===0&&I[2]===0&&I[3]===1)return`translate(${i(I[4])} ${i(I[5])})`;return`matrix(${i(I[0])} ${i(I[1])} ${i(I[2])} ${i(I[3])} ${i(I[4])} ${i(I[5])})`}let y=0,f=0,T=0;class H{constructor(_,M,te=!1){(0,p.deprecated)("The SVG back-end is no longer maintained and *may* be removed in the future."),this.svgFactory=new p.DOMSVGFactory,this.current=new g,this.transformMatrix=e.IDENTITY_MATRIX,this.transformStack=[],this.extraStack=[],this.commonObjs=_,this.objs=M,this.pendingClip=null,this.pendingEOFill=!1,this.embedFonts=!1,this.embeddedFonts=Object.create(null),this.cssStyle=null,this.forceDataSchema=!!te,this._operatorIdMapping=[];for(const ie in e.OPS)this._operatorIdMapping[e.OPS[ie]]=ie}getObject(_,M=null){return typeof _=="string"?_.startsWith("g_")?this.commonObjs.get(_):this.objs.get(_):M}save(){this.transformStack.push(this.transformMatrix);const _=this.current;this.extraStack.push(_),this.current=_.clone()}restore(){this.transformMatrix=this.transformStack.pop(),this.current=this.extraStack.pop(),this.pendingClip=null,this.tgrp=null}group(_){this.save(),this.executeOpTree(_),this.restore()}loadDependencies(_){const M=_.fnArray,te=_.argsArray;for(let ie=0,Y=M.length;ie<Y;ie++)if(M[ie]===e.OPS.dependency)for(const he of te[ie]){const ge=he.startsWith("g_")?this.commonObjs:this.objs,Ne=new Promise(ke=>{ge.get(he,ke)});this.current.dependencies.push(Ne)}return Promise.all(this.current.dependencies)}transform(_,M,te,ie,Y,he){const ge=[_,M,te,ie,Y,he];this.transformMatrix=e.Util.transform(this.transformMatrix,ge),this.tgrp=null}getSVG(_,M){this.viewport=M;const te=this._initialize(M);return this.loadDependencies(_).then(()=>(this.transformMatrix=e.IDENTITY_MATRIX,this.executeOpTree(this.convertOpList(_)),te))}convertOpList(_){const M=this._operatorIdMapping,te=_.argsArray,ie=_.fnArray,Y=[];for(let he=0,ge=ie.length;he<ge;he++){const Ne=ie[he];Y.push({fnId:Ne,fn:M[Ne],args:te[he]})}return d(Y)}executeOpTree(_){for(const M of _){const te=M.fn,ie=M.fnId,Y=M.args;switch(ie|0){case e.OPS.beginText:this.beginText();break;case e.OPS.dependency:break;case e.OPS.setLeading:this.setLeading(Y);break;case e.OPS.setLeadingMoveText:this.setLeadingMoveText(Y[0],Y[1]);break;case e.OPS.setFont:this.setFont(Y);break;case e.OPS.showText:this.showText(Y[0]);break;case e.OPS.showSpacedText:this.showText(Y[0]);break;case e.OPS.endText:this.endText();break;case e.OPS.moveText:this.moveText(Y[0],Y[1]);break;case e.OPS.setCharSpacing:this.setCharSpacing(Y[0]);break;case e.OPS.setWordSpacing:this.setWordSpacing(Y[0]);break;case e.OPS.setHScale:this.setHScale(Y[0]);break;case e.OPS.setTextMatrix:this.setTextMatrix(Y[0],Y[1],Y[2],Y[3],Y[4],Y[5]);break;case e.OPS.setTextRise:this.setTextRise(Y[0]);break;case e.OPS.setTextRenderingMode:this.setTextRenderingMode(Y[0]);break;case e.OPS.setLineWidth:this.setLineWidth(Y[0]);break;case e.OPS.setLineJoin:this.setLineJoin(Y[0]);break;case e.OPS.setLineCap:this.setLineCap(Y[0]);break;case e.OPS.setMiterLimit:this.setMiterLimit(Y[0]);break;case e.OPS.setFillRGBColor:this.setFillRGBColor(Y[0],Y[1],Y[2]);break;case e.OPS.setStrokeRGBColor:this.setStrokeRGBColor(Y[0],Y[1],Y[2]);break;case e.OPS.setStrokeColorN:this.setStrokeColorN(Y);break;case e.OPS.setFillColorN:this.setFillColorN(Y);break;case e.OPS.shadingFill:this.shadingFill(Y[0]);break;case e.OPS.setDash:this.setDash(Y[0],Y[1]);break;case e.OPS.setRenderingIntent:this.setRenderingIntent(Y[0]);break;case e.OPS.setFlatness:this.setFlatness(Y[0]);break;case e.OPS.setGState:this.setGState(Y[0]);break;case e.OPS.fill:this.fill();break;case e.OPS.eoFill:this.eoFill();break;case e.OPS.stroke:this.stroke();break;case e.OPS.fillStroke:this.fillStroke();break;case e.OPS.eoFillStroke:this.eoFillStroke();break;case e.OPS.clip:this.clip("nonzero");break;case e.OPS.eoClip:this.clip("evenodd");break;case e.OPS.paintSolidColorImageMask:this.paintSolidColorImageMask();break;case e.OPS.paintImageXObject:this.paintImageXObject(Y[0]);break;case e.OPS.paintInlineImageXObject:this.paintInlineImageXObject(Y[0]);break;case e.OPS.paintImageMaskXObject:this.paintImageMaskXObject(Y[0]);break;case e.OPS.paintFormXObjectBegin:this.paintFormXObjectBegin(Y[0],Y[1]);break;case e.OPS.paintFormXObjectEnd:this.paintFormXObjectEnd();break;case e.OPS.closePath:this.closePath();break;case e.OPS.closeStroke:this.closeStroke();break;case e.OPS.closeFillStroke:this.closeFillStroke();break;case e.OPS.closeEOFillStroke:this.closeEOFillStroke();break;case e.OPS.nextLine:this.nextLine();break;case e.OPS.transform:this.transform(Y[0],Y[1],Y[2],Y[3],Y[4],Y[5]);break;case e.OPS.constructPath:this.constructPath(Y[0],Y[1]);break;case e.OPS.endPath:this.endPath();break;case 92:this.group(M.items);break;default:(0,e.warn)(`Unimplemented operator ${te}`);break}}}setWordSpacing(_){this.current.wordSpacing=_}setCharSpacing(_){this.current.charSpacing=_}nextLine(){this.moveText(0,this.current.leading)}setTextMatrix(_,M,te,ie,Y,he){const ge=this.current;ge.textMatrix=ge.lineMatrix=[_,M,te,ie,Y,he],ge.textMatrixScale=Math.hypot(_,M),ge.x=ge.lineX=0,ge.y=ge.lineY=0,ge.xcoords=[],ge.ycoords=[],ge.tspan=this.svgFactory.createElement("svg:tspan"),ge.tspan.setAttributeNS(null,"font-family",ge.fontFamily),ge.tspan.setAttributeNS(null,"font-size",`${i(ge.fontSize)}px`),ge.tspan.setAttributeNS(null,"y",i(-ge.y)),ge.txtElement=this.svgFactory.createElement("svg:text"),ge.txtElement.append(ge.tspan)}beginText(){const _=this.current;_.x=_.lineX=0,_.y=_.lineY=0,_.textMatrix=e.IDENTITY_MATRIX,_.lineMatrix=e.IDENTITY_MATRIX,_.textMatrixScale=1,_.tspan=this.svgFactory.createElement("svg:tspan"),_.txtElement=this.svgFactory.createElement("svg:text"),_.txtgrp=this.svgFactory.createElement("svg:g"),_.xcoords=[],_.ycoords=[]}moveText(_,M){const te=this.current;te.x=te.lineX+=_,te.y=te.lineY+=M,te.xcoords=[],te.ycoords=[],te.tspan=this.svgFactory.createElement("svg:tspan"),te.tspan.setAttributeNS(null,"font-family",te.fontFamily),te.tspan.setAttributeNS(null,"font-size",`${i(te.fontSize)}px`),te.tspan.setAttributeNS(null,"y",i(-te.y))}showText(_){const M=this.current,te=M.font,ie=M.fontSize;if(ie===0)return;const Y=M.fontSizeScale,he=M.charSpacing,ge=M.wordSpacing,Ne=M.fontDirection,ke=M.textHScale*Ne,Oe=te.vertical,Ve=Oe?1:-1,Ee=te.defaultVMetrics,G=ie*M.fontMatrix[0];let A=0;for(const C of _){if(C===null){A+=Ne*ge;continue}else if(typeof C=="number"){A+=Ve*C*ie/1e3;continue}const V=(C.isSpace?ge:0)+he,W=C.fontChar;let K,L,l=C.width;if(Oe){let R;const O=C.vmetric||Ee;R=C.vmetric?O[1]:l*.5,R=-R*G;const B=O[2]*G;l=O?-O[0]:l,K=R/Y,L=(A+B)/Y}else K=A/Y,L=0;(C.isInFont||te.missingFile)&&(M.xcoords.push(M.x+K),Oe&&M.ycoords.push(-M.y+L),M.tspan.textContent+=W);const S=Oe?l*G-V*Ne:l*G+V*Ne;A+=S}M.tspan.setAttributeNS(null,"x",M.xcoords.map(i).join(" ")),Oe?M.tspan.setAttributeNS(null,"y",M.ycoords.map(i).join(" ")):M.tspan.setAttributeNS(null,"y",i(-M.y)),Oe?M.y-=A:M.x+=A*ke,M.tspan.setAttributeNS(null,"font-family",M.fontFamily),M.tspan.setAttributeNS(null,"font-size",`${i(M.fontSize)}px`),M.fontStyle!==s.fontStyle&&M.tspan.setAttributeNS(null,"font-style",M.fontStyle),M.fontWeight!==s.fontWeight&&M.tspan.setAttributeNS(null,"font-weight",M.fontWeight);const m=M.textRenderingMode&e.TextRenderingMode.FILL_STROKE_MASK;if(m===e.TextRenderingMode.FILL||m===e.TextRenderingMode.FILL_STROKE?(M.fillColor!==s.fillColor&&M.tspan.setAttributeNS(null,"fill",M.fillColor),M.fillAlpha<1&&M.tspan.setAttributeNS(null,"fill-opacity",M.fillAlpha)):M.textRenderingMode===e.TextRenderingMode.ADD_TO_PATH?M.tspan.setAttributeNS(null,"fill","transparent"):M.tspan.setAttributeNS(null,"fill","none"),m===e.TextRenderingMode.STROKE||m===e.TextRenderingMode.FILL_STROKE){const C=1/(M.textMatrixScale||1);this._setStrokeAttributes(M.tspan,C)}let v=M.textMatrix;M.textRise!==0&&(v=v.slice(),v[5]+=M.textRise),M.txtElement.setAttributeNS(null,"transform",`${b(v)} scale(${i(ke)}, -1)`),M.txtElement.setAttributeNS(N,"xml:space","preserve"),M.txtElement.append(M.tspan),M.txtgrp.append(M.txtElement),this._ensureTransformGroup().append(M.txtElement)}setLeadingMoveText(_,M){this.setLeading(-M),this.moveText(_,M)}addFontStyle(_){if(!_.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 M=t(_.data,_.mimetype,this.forceDataSchema);this.cssStyle.textContent+=`@font-face { font-family: "${_.loadedName}"; src: url(${M}); }
|
|
4
|
+
`}setFont(_){const M=this.current,te=this.commonObjs.get(_[0]);let ie=_[1];M.font=te,this.embedFonts&&!te.missingFile&&!this.embeddedFonts[te.loadedName]&&(this.addFontStyle(te),this.embeddedFonts[te.loadedName]=te),M.fontMatrix=te.fontMatrix||e.FONT_IDENTITY_MATRIX;let Y="normal";te.black?Y="900":te.bold&&(Y="bold");const he=te.italic?"italic":"normal";ie<0?(ie=-ie,M.fontDirection=-1):M.fontDirection=1,M.fontSize=ie,M.fontFamily=te.loadedName,M.fontWeight=Y,M.fontStyle=he,M.tspan=this.svgFactory.createElement("svg:tspan"),M.tspan.setAttributeNS(null,"y",i(-M.y)),M.xcoords=[],M.ycoords=[]}endText(){const _=this.current;_.textRenderingMode&e.TextRenderingMode.ADD_TO_PATH_FLAG&&_.txtElement?.hasChildNodes()&&(_.element=_.txtElement,this.clip("nonzero"),this.endPath())}setLineWidth(_){_>0&&(this.current.lineWidth=_)}setLineCap(_){this.current.lineCap=U[_]}setLineJoin(_){this.current.lineJoin=o[_]}setMiterLimit(_){this.current.miterLimit=_}setStrokeAlpha(_){this.current.strokeAlpha=_}setStrokeRGBColor(_,M,te){this.current.strokeColor=e.Util.makeHexColor(_,M,te)}setFillAlpha(_){this.current.fillAlpha=_}setFillRGBColor(_,M,te){this.current.fillColor=e.Util.makeHexColor(_,M,te),this.current.tspan=this.svgFactory.createElement("svg:tspan"),this.current.xcoords=[],this.current.ycoords=[]}setStrokeColorN(_){this.current.strokeColor=this._makeColorN_Pattern(_)}setFillColorN(_){this.current.fillColor=this._makeColorN_Pattern(_)}shadingFill(_){const{width:M,height:te}=this.viewport,ie=e.Util.inverseTransform(this.transformMatrix),[Y,he,ge,Ne]=e.Util.getAxialAlignedBoundingBox([0,0,M,te],ie),ke=this.svgFactory.createElement("svg:rect");ke.setAttributeNS(null,"x",Y),ke.setAttributeNS(null,"y",he),ke.setAttributeNS(null,"width",ge-Y),ke.setAttributeNS(null,"height",Ne-he),ke.setAttributeNS(null,"fill",this._makeShadingPattern(_)),this.current.fillAlpha<1&&ke.setAttributeNS(null,"fill-opacity",this.current.fillAlpha),this._ensureTransformGroup().append(ke)}_makeColorN_Pattern(_){return _[0]==="TilingPattern"?this._makeTilingPattern(_):this._makeShadingPattern(_)}_makeTilingPattern(_){const M=_[1],te=_[2],ie=_[3]||e.IDENTITY_MATRIX,[Y,he,ge,Ne]=_[4],ke=_[5],Oe=_[6],Ve=_[7],Ee=`shading${T++}`,[G,A,m,v]=e.Util.normalizeRect([...e.Util.applyTransform([Y,he],ie),...e.Util.applyTransform([ge,Ne],ie)]),[C,V]=e.Util.singularValueDecompose2dScale(ie),W=ke*C,K=Oe*V,L=this.svgFactory.createElement("svg:pattern");L.setAttributeNS(null,"id",Ee),L.setAttributeNS(null,"patternUnits","userSpaceOnUse"),L.setAttributeNS(null,"width",W),L.setAttributeNS(null,"height",K),L.setAttributeNS(null,"x",`${G}`),L.setAttributeNS(null,"y",`${A}`);const l=this.svg,S=this.transformMatrix,R=this.current.fillColor,O=this.current.strokeColor,B=this.svgFactory.create(m-G,v-A);if(this.svg=B,this.transformMatrix=ie,Ve===2){const Z=e.Util.makeHexColor(...M);this.current.fillColor=Z,this.current.strokeColor=Z}return this.executeOpTree(this.convertOpList(te)),this.svg=l,this.transformMatrix=S,this.current.fillColor=R,this.current.strokeColor=O,L.append(B.childNodes[0]),this.defs.append(L),`url(#${Ee})`}_makeShadingPattern(_){switch(typeof _=="string"&&(_=this.objs.get(_)),_[0]){case"RadialAxial":const M=`shading${T++}`,te=_[3];let ie;switch(_[1]){case"axial":const Y=_[4],he=_[5];ie=this.svgFactory.createElement("svg:linearGradient"),ie.setAttributeNS(null,"id",M),ie.setAttributeNS(null,"gradientUnits","userSpaceOnUse"),ie.setAttributeNS(null,"x1",Y[0]),ie.setAttributeNS(null,"y1",Y[1]),ie.setAttributeNS(null,"x2",he[0]),ie.setAttributeNS(null,"y2",he[1]);break;case"radial":const ge=_[4],Ne=_[5],ke=_[6],Oe=_[7];ie=this.svgFactory.createElement("svg:radialGradient"),ie.setAttributeNS(null,"id",M),ie.setAttributeNS(null,"gradientUnits","userSpaceOnUse"),ie.setAttributeNS(null,"cx",Ne[0]),ie.setAttributeNS(null,"cy",Ne[1]),ie.setAttributeNS(null,"r",Oe),ie.setAttributeNS(null,"fx",ge[0]),ie.setAttributeNS(null,"fy",ge[1]),ie.setAttributeNS(null,"fr",ke);break;default:throw new Error(`Unknown RadialAxial type: ${_[1]}`)}for(const Y of te){const he=this.svgFactory.createElement("svg:stop");he.setAttributeNS(null,"offset",Y[0]),he.setAttributeNS(null,"stop-color",Y[1]),ie.append(he)}return this.defs.append(ie),`url(#${M})`;case"Mesh":return(0,e.warn)("Unimplemented pattern Mesh"),null;case"Dummy":return"hotpink";default:throw new Error(`Unknown IR type: ${_[0]}`)}}setDash(_,M){this.current.dashArray=_,this.current.dashPhase=M}constructPath(_,M){const te=this.current;let ie=te.x,Y=te.y,he=[],ge=0;for(const Ne of _)switch(Ne|0){case e.OPS.rectangle:ie=M[ge++],Y=M[ge++];const ke=M[ge++],Oe=M[ge++],Ve=ie+ke,Ee=Y+Oe;he.push("M",i(ie),i(Y),"L",i(Ve),i(Y),"L",i(Ve),i(Ee),"L",i(ie),i(Ee),"Z");break;case e.OPS.moveTo:ie=M[ge++],Y=M[ge++],he.push("M",i(ie),i(Y));break;case e.OPS.lineTo:ie=M[ge++],Y=M[ge++],he.push("L",i(ie),i(Y));break;case e.OPS.curveTo:ie=M[ge+4],Y=M[ge+5],he.push("C",i(M[ge]),i(M[ge+1]),i(M[ge+2]),i(M[ge+3]),i(ie),i(Y)),ge+=6;break;case e.OPS.curveTo2:he.push("C",i(ie),i(Y),i(M[ge]),i(M[ge+1]),i(M[ge+2]),i(M[ge+3])),ie=M[ge+2],Y=M[ge+3],ge+=4;break;case e.OPS.curveTo3:ie=M[ge+2],Y=M[ge+3],he.push("C",i(M[ge]),i(M[ge+1]),i(ie),i(Y),i(ie),i(Y)),ge+=4;break;case e.OPS.closePath:he.push("Z");break}he=he.join(" "),te.path&&_.length>0&&_[0]!==e.OPS.rectangle&&_[0]!==e.OPS.moveTo?he=te.path.getAttributeNS(null,"d")+he:(te.path=this.svgFactory.createElement("svg:path"),this._ensureTransformGroup().append(te.path)),te.path.setAttributeNS(null,"d",he),te.path.setAttributeNS(null,"fill","none"),te.element=te.path,te.setCurrentPoint(ie,Y)}endPath(){const _=this.current;if(_.path=null,!this.pendingClip)return;if(!_.element){this.pendingClip=null;return}const M=`clippath${y++}`,te=this.svgFactory.createElement("svg:clipPath");te.setAttributeNS(null,"id",M),te.setAttributeNS(null,"transform",b(this.transformMatrix));const ie=_.element.cloneNode(!0);if(this.pendingClip==="evenodd"?ie.setAttributeNS(null,"clip-rule","evenodd"):ie.setAttributeNS(null,"clip-rule","nonzero"),this.pendingClip=null,te.append(ie),this.defs.append(te),_.activeClipUrl){_.clipGroup=null;for(const Y of this.extraStack)Y.clipGroup=null;te.setAttributeNS(null,"clip-path",_.activeClipUrl)}_.activeClipUrl=`url(#${M})`,this.tgrp=null}clip(_){this.pendingClip=_}closePath(){const _=this.current;if(_.path){const M=`${_.path.getAttributeNS(null,"d")}Z`;_.path.setAttributeNS(null,"d",M)}}setLeading(_){this.current.leading=-_}setTextRise(_){this.current.textRise=_}setTextRenderingMode(_){this.current.textRenderingMode=_}setHScale(_){this.current.textHScale=_/100}setRenderingIntent(_){}setFlatness(_){}setGState(_){for(const[M,te]of _)switch(M){case"LW":this.setLineWidth(te);break;case"LC":this.setLineCap(te);break;case"LJ":this.setLineJoin(te);break;case"ML":this.setMiterLimit(te);break;case"D":this.setDash(te[0],te[1]);break;case"RI":this.setRenderingIntent(te);break;case"FL":this.setFlatness(te);break;case"Font":this.setFont(te);break;case"CA":this.setStrokeAlpha(te);break;case"ca":this.setFillAlpha(te);break;default:(0,e.warn)(`Unimplemented graphic state operator ${M}`);break}}fill(){const _=this.current;_.element&&(_.element.setAttributeNS(null,"fill",_.fillColor),_.element.setAttributeNS(null,"fill-opacity",_.fillAlpha),this.endPath())}stroke(){const _=this.current;_.element&&(this._setStrokeAttributes(_.element),_.element.setAttributeNS(null,"fill","none"),this.endPath())}_setStrokeAttributes(_,M=1){const te=this.current;let ie=te.dashArray;M!==1&&ie.length>0&&(ie=ie.map(function(Y){return M*Y})),_.setAttributeNS(null,"stroke",te.strokeColor),_.setAttributeNS(null,"stroke-opacity",te.strokeAlpha),_.setAttributeNS(null,"stroke-miterlimit",i(te.miterLimit)),_.setAttributeNS(null,"stroke-linecap",te.lineCap),_.setAttributeNS(null,"stroke-linejoin",te.lineJoin),_.setAttributeNS(null,"stroke-width",i(M*te.lineWidth)+"px"),_.setAttributeNS(null,"stroke-dasharray",ie.map(i).join(" ")),_.setAttributeNS(null,"stroke-dashoffset",i(M*te.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 _=this.svgFactory.createElement("svg:rect");_.setAttributeNS(null,"x","0"),_.setAttributeNS(null,"y","0"),_.setAttributeNS(null,"width","1px"),_.setAttributeNS(null,"height","1px"),_.setAttributeNS(null,"fill",this.current.fillColor),this._ensureTransformGroup().append(_)}paintImageXObject(_){const M=this.getObject(_);if(!M){(0,e.warn)(`Dependent image with object ID ${_} is not ready yet`);return}this.paintInlineImageXObject(M)}paintInlineImageXObject(_,M){const te=_.width,ie=_.height,Y=a(_,this.forceDataSchema,!!M),he=this.svgFactory.createElement("svg:rect");he.setAttributeNS(null,"x","0"),he.setAttributeNS(null,"y","0"),he.setAttributeNS(null,"width",i(te)),he.setAttributeNS(null,"height",i(ie)),this.current.element=he,this.clip("nonzero");const ge=this.svgFactory.createElement("svg:image");ge.setAttributeNS(ee,"xlink:href",Y),ge.setAttributeNS(null,"x","0"),ge.setAttributeNS(null,"y",i(-ie)),ge.setAttributeNS(null,"width",i(te)+"px"),ge.setAttributeNS(null,"height",i(ie)+"px"),ge.setAttributeNS(null,"transform",`scale(${i(1/te)} ${i(-1/ie)})`),M?M.append(ge):this._ensureTransformGroup().append(ge)}paintImageMaskXObject(_){const M=this.getObject(_.data,_);if(M.bitmap){(0,e.warn)("paintImageMaskXObject: ImageBitmap support is not implemented, ensure that the `isOffscreenCanvasSupported` API parameter is disabled.");return}const te=this.current,ie=M.width,Y=M.height,he=te.fillColor;te.maskId=`mask${f++}`;const ge=this.svgFactory.createElement("svg:mask");ge.setAttributeNS(null,"id",te.maskId);const Ne=this.svgFactory.createElement("svg:rect");Ne.setAttributeNS(null,"x","0"),Ne.setAttributeNS(null,"y","0"),Ne.setAttributeNS(null,"width",i(ie)),Ne.setAttributeNS(null,"height",i(Y)),Ne.setAttributeNS(null,"fill",he),Ne.setAttributeNS(null,"mask",`url(#${te.maskId})`),this.defs.append(ge),this._ensureTransformGroup().append(Ne),this.paintInlineImageXObject(M,ge)}paintFormXObjectBegin(_,M){if(Array.isArray(_)&&_.length===6&&this.transform(_[0],_[1],_[2],_[3],_[4],_[5]),M){const te=M[2]-M[0],ie=M[3]-M[1],Y=this.svgFactory.createElement("svg:rect");Y.setAttributeNS(null,"x",M[0]),Y.setAttributeNS(null,"y",M[1]),Y.setAttributeNS(null,"width",i(te)),Y.setAttributeNS(null,"height",i(ie)),this.current.element=Y,this.clip("nonzero"),this.endPath()}}paintFormXObjectEnd(){}_initialize(_){const M=this.svgFactory.create(_.width,_.height),te=this.svgFactory.createElement("svg:defs");M.append(te),this.defs=te;const ie=this.svgFactory.createElement("svg:g");return ie.setAttributeNS(null,"transform",b(_.transform)),M.append(ie),this.svg=ie,M}_ensureClipGroup(){if(!this.current.clipGroup){const _=this.svgFactory.createElement("svg:g");_.setAttributeNS(null,"clip-path",this.current.activeClipUrl),this.svg.append(_),this.current.clipGroup=_}return this.current.clipGroup}_ensureTransformGroup(){return this.tgrp||(this.tgrp=this.svgFactory.createElement("svg:g"),this.tgrp.setAttributeNS(null,"transform",b(this.transformMatrix)),this.current.activeClipUrl?this._ensureClipGroup().append(this.tgrp):this.svg.append(this.tgrp)),this.tgrp}}c.SVGGraphics=H}),((r,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.XfaText=void 0;class q{static textContent(e){const s=[],N={items:s,styles:Object.create(null)};function ee(U){if(!U)return;let o=null;const t=U.name;if(t==="#text")o=U.value;else if(q.shouldBuildText(t))U?.attributes?.textContent?o=U.attributes.textContent:U.value&&(o=U.value);else return;if(o!==null&&s.push({str:o}),!!U.children)for(const a of U.children)ee(a)}return ee(e),N}static shouldBuildText(e){return!(e==="textarea"||e==="input"||e==="option"||e==="select")}}c.XfaText=q}),((r,c,q)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.TextLayerRenderTask=void 0,c.renderTextLayer=b,c.updateTextLayer=y;var p=q(1),e=q(6);const s=1e5,N=30,ee=.8,U=new Map;function o(f,T){let H;if(T&&p.FeatureTest.isOffscreenCanvasSupported)H=new OffscreenCanvas(f,f).getContext("2d",{alpha:!1});else{const I=document.createElement("canvas");I.width=I.height=f,H=I.getContext("2d",{alpha:!1})}return H}function t(f,T){const H=U.get(f);if(H)return H;const I=o(N,T);I.font=`${N}px ${f}`;const _=I.measureText("");let M=_.fontBoundingBoxAscent,te=Math.abs(_.fontBoundingBoxDescent);if(M){const Y=M/(M+te);return U.set(f,Y),I.canvas.width=I.canvas.height=0,Y}I.strokeStyle="red",I.clearRect(0,0,N,N),I.strokeText("g",0,0);let ie=I.getImageData(0,0,N,N).data;te=0;for(let Y=ie.length-1-3;Y>=0;Y-=4)if(ie[Y]>0){te=Math.ceil(Y/4/N);break}I.clearRect(0,0,N,N),I.strokeText("A",0,N),ie=I.getImageData(0,0,N,N).data,M=0;for(let Y=0,he=ie.length;Y<he;Y+=4)if(ie[Y]>0){M=N-Math.floor(Y/4/N);break}if(I.canvas.width=I.canvas.height=0,M){const Y=M/(M+te);return U.set(f,Y),Y}return U.set(f,ee),ee}function a(f,T,H){const I=document.createElement("span"),_={angle:0,canvasWidth:0,hasText:T.str!=="",hasEOL:T.hasEOL,fontSize:0};f._textDivs.push(I);const M=p.Util.transform(f._transform,T.transform);let te=Math.atan2(M[1],M[0]);const ie=H[T.fontName];ie.vertical&&(te+=Math.PI/2);const Y=Math.hypot(M[2],M[3]),he=Y*t(ie.fontFamily,f._isOffscreenCanvasSupported);let ge,Ne;te===0?(ge=M[4],Ne=M[5]-he):(ge=M[4]+he*Math.sin(te),Ne=M[5]-he*Math.cos(te));const ke="calc(var(--scale-factor)*",Oe=I.style;f._container===f._rootContainer?(Oe.left=`${(100*ge/f._pageWidth).toFixed(2)}%`,Oe.top=`${(100*Ne/f._pageHeight).toFixed(2)}%`):(Oe.left=`${ke}${ge.toFixed(2)}px)`,Oe.top=`${ke}${Ne.toFixed(2)}px)`),Oe.fontSize=`${ke}${Y.toFixed(2)}px)`,Oe.fontFamily=ie.fontFamily,_.fontSize=Y,I.setAttribute("role","presentation"),I.textContent=T.str,I.dir=T.dir,f._fontInspectorEnabled&&(I.dataset.fontName=T.fontName),te!==0&&(_.angle=te*(180/Math.PI));let Ve=!1;if(T.str.length>1)Ve=!0;else if(T.str!==" "&&T.transform[0]!==T.transform[3]){const Ee=Math.abs(T.transform[0]),G=Math.abs(T.transform[3]);Ee!==G&&Math.max(Ee,G)/Math.min(Ee,G)>1.5&&(Ve=!0)}Ve&&(_.canvasWidth=ie.vertical?T.height:T.width),f._textDivProperties.set(I,_),f._isReadableStream&&f._layoutText(I)}function g(f){const{div:T,scale:H,properties:I,ctx:_,prevFontSize:M,prevFontFamily:te}=f,{style:ie}=T;let Y="";if(I.canvasWidth!==0&&I.hasText){const{fontFamily:he}=ie,{canvasWidth:ge,fontSize:Ne}=I;(M!==Ne||te!==he)&&(_.font=`${Ne*H}px ${he}`,f.prevFontSize=Ne,f.prevFontFamily=he);const{width:ke}=_.measureText(T.textContent);ke>0&&(Y=`scaleX(${ge*H/ke})`)}I.angle!==0&&(Y=`rotate(${I.angle}deg) ${Y}`),Y.length>0&&(ie.transform=Y)}function d(f){if(f._canceled)return;const T=f._textDivs,H=f._capability;if(T.length>s){H.resolve();return}if(!f._isReadableStream)for(const _ of T)f._layoutText(_);H.resolve()}class i{constructor({textContentSource:T,container:H,viewport:I,textDivs:_,textDivProperties:M,textContentItemsStr:te,isOffscreenCanvasSupported:ie}){this._textContentSource=T,this._isReadableStream=T instanceof ReadableStream,this._container=this._rootContainer=H,this._textDivs=_||[],this._textContentItemsStr=te||[],this._isOffscreenCanvasSupported=ie,this._fontInspectorEnabled=!!globalThis.FontInspector?.enabled,this._reader=null,this._textDivProperties=M||new WeakMap,this._canceled=!1,this._capability=new p.PromiseCapability,this._layoutTextParams={prevFontSize:null,prevFontFamily:null,div:null,scale:I.scale*(globalThis.devicePixelRatio||1),properties:null,ctx:o(0,ie)};const{pageWidth:Y,pageHeight:he,pageX:ge,pageY:Ne}=I.rawDims;this._transform=[1,0,0,-1,-ge,Ne+he],this._pageWidth=Y,this._pageHeight=he,(0,e.setLayerDimensions)(H,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 p.AbortException("TextLayer task cancelled.")).catch(()=>{}),this._reader=null),this._capability.reject(new p.AbortException("TextLayer task cancelled."))}_processItems(T,H){for(const I of T){if(I.str===void 0){if(I.type==="beginMarkedContentProps"||I.type==="beginMarkedContent"){const _=this._container;this._container=document.createElement("span"),this._container.classList.add("markedContent"),I.id!==null&&this._container.setAttribute("id",`${I.id}`),_.append(this._container)}else I.type==="endMarkedContent"&&(this._container=this._container.parentNode);continue}this._textContentItemsStr.push(I.str),a(this,I,H)}}_layoutText(T){const H=this._layoutTextParams.properties=this._textDivProperties.get(T);if(this._layoutTextParams.div=T,g(this._layoutTextParams),H.hasText&&this._container.append(T),H.hasEOL){const I=document.createElement("br");I.setAttribute("role","presentation"),this._container.append(I)}}_render(){const T=new p.PromiseCapability;let H=Object.create(null);if(this._isReadableStream){const I=()=>{this._reader.read().then(({value:_,done:M})=>{if(M){T.resolve();return}Object.assign(H,_.styles),this._processItems(_.items,H),I()},T.reject)};this._reader=this._textContentSource.getReader(),I()}else if(this._textContentSource){const{items:I,styles:_}=this._textContentSource;this._processItems(I,_),T.resolve()}else throw new Error('No "textContentSource" parameter specified.');T.promise.then(()=>{H=null,d(this)},this._capability.reject)}}c.TextLayerRenderTask=i;function b(f){!f.textContentSource&&(f.textContent||f.textContentStream)&&((0,e.deprecated)("The TextLayerRender `textContent`/`textContentStream` parameters will be removed in the future, please use `textContentSource` instead."),f.textContentSource=f.textContent||f.textContentStream);const{container:T,viewport:H}=f,I=getComputedStyle(T),_=I.getPropertyValue("visibility"),M=parseFloat(I.getPropertyValue("--scale-factor"));_==="visible"&&(!M||Math.abs(M-H.scale)>1e-5)&&console.error("The `--scale-factor` CSS-variable must be set, to the same value as `viewport.scale`, either on the `container`-element itself or higher up in the DOM.");const te=new i(f);return te._render(),te}function y({container:f,viewport:T,textDivs:H,textDivProperties:I,isOffscreenCanvasSupported:_,mustRotate:M=!0,mustRescale:te=!0}){if(M&&(0,e.setLayerDimensions)(f,{rotation:T.rotation}),te){const ie=o(0,_),he={prevFontSize:null,prevFontFamily:null,div:null,scale:T.scale*(globalThis.devicePixelRatio||1),properties:null,ctx:ie};for(const ge of H)he.properties=I.get(ge),he.div=ge,g(he)}}}),((r,c,q)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.AnnotationEditorLayer=void 0;var p=q(1),e=q(4),s=q(28),N=q(33),ee=q(6),U=q(34);class o{#e;#t=!1;#n=null;#r=this.pointerup.bind(this);#o=this.pointerdown.bind(this);#s=new Map;#a=!1;#l=!1;#c=!1;#i;static _initialized=!1;constructor({uiManager:a,pageIndex:g,div:d,accessibilityManager:i,annotationLayer:b,viewport:y,l10n:f}){const T=[s.FreeTextEditor,N.InkEditor,U.StampEditor];if(!o._initialized){o._initialized=!0;for(const H of T)H.initialize(f)}a.registerEditorTypes(T),this.#i=a,this.pageIndex=g,this.div=d,this.#e=i,this.#n=b,this.viewport=y,this.#i.addLayer(this)}get isEmpty(){return this.#s.size===0}updateToolbar(a){this.#i.updateToolbar(a)}updateMode(a=this.#i.getMode()){this.#p(),a===p.AnnotationEditorType.INK?(this.addInkEditorIfNeeded(!1),this.disableClick()):this.enableClick(),a!==p.AnnotationEditorType.NONE&&(this.div.classList.toggle("freeTextEditing",a===p.AnnotationEditorType.FREETEXT),this.div.classList.toggle("inkEditing",a===p.AnnotationEditorType.INK),this.div.classList.toggle("stampEditing",a===p.AnnotationEditorType.STAMP),this.div.hidden=!1)}addInkEditorIfNeeded(a){if(!a&&this.#i.getMode()!==p.AnnotationEditorType.INK)return;if(!a){for(const d of this.#s.values())if(d.isEmpty()){d.setInBackground();return}}this.#d({offsetX:0,offsetY:0},!1).setInBackground()}setEditingState(a){this.#i.setEditingState(a)}addCommands(a){this.#i.addCommands(a)}enable(){this.div.style.pointerEvents="auto";const a=new Set;for(const d of this.#s.values())d.enableEditing(),d.annotationElementId&&a.add(d.annotationElementId);if(!this.#n)return;const g=this.#n.getEditableAnnotations();for(const d of g){if(d.hide(),this.#i.isDeletedAnnotationElement(d.data.id)||a.has(d.data.id))continue;const i=this.deserialize(d);i&&(this.addOrRebuild(i),i.enableEditing())}}disable(){this.#c=!0,this.div.style.pointerEvents="none";const a=new Set;for(const g of this.#s.values()){if(g.disableEditing(),!g.annotationElementId||g.serialize()!==null){a.add(g.annotationElementId);continue}this.getEditableAnnotation(g.annotationElementId)?.show(),g.remove()}if(this.#n){const g=this.#n.getEditableAnnotations();for(const d of g){const{id:i}=d.data;a.has(i)||this.#i.isDeletedAnnotationElement(i)||d.show()}}this.#p(),this.isEmpty&&(this.div.hidden=!0),this.#c=!1}getEditableAnnotation(a){return this.#n?.getEditableAnnotation(a)||null}setActiveEditor(a){this.#i.getActive()!==a&&this.#i.setActiveEditor(a)}enableClick(){this.div.addEventListener("pointerdown",this.#o),this.div.addEventListener("pointerup",this.#r)}disableClick(){this.div.removeEventListener("pointerdown",this.#o),this.div.removeEventListener("pointerup",this.#r)}attach(a){this.#s.set(a.id,a);const{annotationElementId:g}=a;g&&this.#i.isDeletedAnnotationElement(g)&&this.#i.removeDeletedAnnotationElement(a)}detach(a){this.#s.delete(a.id),this.#e?.removePointerInTextLayer(a.contentDiv),!this.#c&&a.annotationElementId&&this.#i.addDeletedAnnotationElement(a)}remove(a){this.detach(a),this.#i.removeEditor(a),a.div.contains(document.activeElement)&&setTimeout(()=>{this.#i.focusMainContainer()},0),a.div.remove(),a.isAttachedToDOM=!1,this.#l||this.addInkEditorIfNeeded(!1)}changeParent(a){a.parent!==this&&(a.annotationElementId&&(this.#i.addDeletedAnnotationElement(a.annotationElementId),e.AnnotationEditor.deleteAnnotationElement(a),a.annotationElementId=null),this.attach(a),a.parent?.detach(a),a.setParent(this),a.div&&a.isAttachedToDOM&&(a.div.remove(),this.div.append(a.div)))}add(a){if(this.changeParent(a),this.#i.addEditor(a),this.attach(a),!a.isAttachedToDOM){const g=a.render();this.div.append(g),a.isAttachedToDOM=!0}a.fixAndSetPosition(),a.onceAdded(),this.#i.addToAnnotationStorage(a)}moveEditorInDOM(a){if(!a.isAttachedToDOM)return;const{activeElement:g}=document;a.div.contains(g)&&(a._focusEventsAllowed=!1,setTimeout(()=>{a.div.contains(document.activeElement)?a._focusEventsAllowed=!0:(a.div.addEventListener("focusin",()=>{a._focusEventsAllowed=!0},{once:!0}),g.focus())},0)),a._structTreeParentId=this.#e?.moveElementInDOM(this.div,a.div,a.contentDiv,!0)}addOrRebuild(a){a.needsToBeRebuilt()?a.rebuild():this.add(a)}addUndoableEditor(a){const g=()=>a._uiManager.rebuild(a),d=()=>{a.remove()};this.addCommands({cmd:g,undo:d,mustExec:!1})}getNextId(){return this.#i.getId()}#f(a){switch(this.#i.getMode()){case p.AnnotationEditorType.FREETEXT:return new s.FreeTextEditor(a);case p.AnnotationEditorType.INK:return new N.InkEditor(a);case p.AnnotationEditorType.STAMP:return new U.StampEditor(a)}return null}pasteEditor(a,g){this.#i.updateToolbar(a),this.#i.updateMode(a);const{offsetX:d,offsetY:i}=this.#h(),b=this.getNextId(),y=this.#f({parent:this,id:b,x:d,y:i,uiManager:this.#i,isCentered:!0,...g});y&&this.add(y)}deserialize(a){switch(a.annotationType??a.annotationEditorType){case p.AnnotationEditorType.FREETEXT:return s.FreeTextEditor.deserialize(a,this,this.#i);case p.AnnotationEditorType.INK:return N.InkEditor.deserialize(a,this,this.#i);case p.AnnotationEditorType.STAMP:return U.StampEditor.deserialize(a,this,this.#i)}return null}#d(a,g){const d=this.getNextId(),i=this.#f({parent:this,id:d,x:a.offsetX,y:a.offsetY,uiManager:this.#i,isCentered:g});return i&&this.add(i),i}#h(){const{x:a,y:g,width:d,height:i}=this.div.getBoundingClientRect(),b=Math.max(0,a),y=Math.max(0,g),f=Math.min(window.innerWidth,a+d),T=Math.min(window.innerHeight,g+i),H=(b+f)/2-a,I=(y+T)/2-g,[_,M]=this.viewport.rotation%180===0?[H,I]:[I,H];return{offsetX:_,offsetY:M}}addNewEditor(){this.#d(this.#h(),!0)}setSelected(a){this.#i.setSelected(a)}toggleSelected(a){this.#i.toggleSelected(a)}isSelected(a){return this.#i.isSelected(a)}unselect(a){this.#i.unselect(a)}pointerup(a){const{isMac:g}=p.FeatureTest.platform;if(!(a.button!==0||a.ctrlKey&&g)&&a.target===this.div&&this.#a){if(this.#a=!1,!this.#t){this.#t=!0;return}if(this.#i.getMode()===p.AnnotationEditorType.STAMP){this.#i.unselectAll();return}this.#d(a,!1)}}pointerdown(a){if(this.#a){this.#a=!1;return}const{isMac:g}=p.FeatureTest.platform;if(a.button!==0||a.ctrlKey&&g||a.target!==this.div)return;this.#a=!0;const d=this.#i.getActive();this.#t=!d||d.isEmpty()}findNewParent(a,g,d){const i=this.#i.findParent(g,d);return i===null||i===this?!1:(i.changeParent(a),!0)}destroy(){this.#i.getActive()?.parent===this&&(this.#i.commitOrRemove(),this.#i.setActiveEditor(null));for(const a of this.#s.values())this.#e?.removePointerInTextLayer(a.contentDiv),a.setParent(null),a.isAttachedToDOM=!1,a.div.remove();this.div=null,this.#s.clear(),this.#i.removeLayer(this)}#p(){this.#l=!0;for(const a of this.#s.values())a.isEmpty()&&a.remove();this.#l=!1}render({viewport:a}){this.viewport=a,(0,ee.setLayerDimensions)(this.div,a);for(const g of this.#i.getEditors(this.pageIndex))this.add(g);this.updateMode()}update({viewport:a}){this.#i.commitOrRemove(),this.viewport=a,(0,ee.setLayerDimensions)(this.div,{rotation:a.rotation}),this.updateMode()}get pageDimensions(){const{pageWidth:a,pageHeight:g}=this.viewport.rawDims;return[a,g]}}c.AnnotationEditorLayer=o}),((r,c,q)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.FreeTextEditor=void 0;var p=q(1),e=q(5),s=q(4),N=q(29);class ee extends s.AnnotationEditor{#e=this.editorDivBlur.bind(this);#t=this.editorDivFocus.bind(this);#n=this.editorDivInput.bind(this);#r=this.editorDivKeydown.bind(this);#o;#s="";#a=`${this.id}-editor`;#l;#c=null;static _freeTextDefaultContent="";static _internalPadding=0;static _defaultColor=null;static _defaultFontSize=10;static get _keyboardManager(){const o=ee.prototype,t=d=>d.isEmpty(),a=e.AnnotationEditorUIManager.TRANSLATE_SMALL,g=e.AnnotationEditorUIManager.TRANSLATE_BIG;return(0,p.shadow)(this,"_keyboardManager",new e.KeyboardManager([[["ctrl+s","mac+meta+s","ctrl+p","mac+meta+p"],o.commitOrRemove,{bubbles:!0}],[["ctrl+Enter","mac+meta+Enter","Escape","mac+Escape"],o.commitOrRemove],[["ArrowLeft","mac+ArrowLeft"],o._translateEmpty,{args:[-a,0],checker:t}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],o._translateEmpty,{args:[-g,0],checker:t}],[["ArrowRight","mac+ArrowRight"],o._translateEmpty,{args:[a,0],checker:t}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],o._translateEmpty,{args:[g,0],checker:t}],[["ArrowUp","mac+ArrowUp"],o._translateEmpty,{args:[0,-a],checker:t}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],o._translateEmpty,{args:[0,-g],checker:t}],[["ArrowDown","mac+ArrowDown"],o._translateEmpty,{args:[0,a],checker:t}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],o._translateEmpty,{args:[0,g],checker:t}]]))}static _type="freetext";constructor(o){super({...o,name:"freeTextEditor"}),this.#o=o.color||ee._defaultColor||s.AnnotationEditor._defaultLineColor,this.#l=o.fontSize||ee._defaultFontSize}static initialize(o){s.AnnotationEditor.initialize(o,{strings:["free_text2_default_content","editor_free_text2_aria_label"]});const t=getComputedStyle(document.documentElement);this._internalPadding=parseFloat(t.getPropertyValue("--freetext-padding"))}static updateDefaultParams(o,t){switch(o){case p.AnnotationEditorParamsType.FREETEXT_SIZE:ee._defaultFontSize=t;break;case p.AnnotationEditorParamsType.FREETEXT_COLOR:ee._defaultColor=t;break}}updateParams(o,t){switch(o){case p.AnnotationEditorParamsType.FREETEXT_SIZE:this.#i(t);break;case p.AnnotationEditorParamsType.FREETEXT_COLOR:this.#f(t);break}}static get defaultPropertiesToUpdate(){return[[p.AnnotationEditorParamsType.FREETEXT_SIZE,ee._defaultFontSize],[p.AnnotationEditorParamsType.FREETEXT_COLOR,ee._defaultColor||s.AnnotationEditor._defaultLineColor]]}get propertiesToUpdate(){return[[p.AnnotationEditorParamsType.FREETEXT_SIZE,this.#l],[p.AnnotationEditorParamsType.FREETEXT_COLOR,this.#o]]}#i(o){const t=g=>{this.editorDiv.style.fontSize=`calc(${g}px * var(--scale-factor))`,this.translate(0,-(g-this.#l)*this.parentScale),this.#l=g,this.#h()},a=this.#l;this.addCommands({cmd:()=>{t(o)},undo:()=>{t(a)},mustExec:!0,type:p.AnnotationEditorParamsType.FREETEXT_SIZE,overwriteIfSameType:!0,keepUndo:!0})}#f(o){const t=this.#o;this.addCommands({cmd:()=>{this.#o=this.editorDiv.style.color=o},undo:()=>{this.#o=this.editorDiv.style.color=t},mustExec:!0,type:p.AnnotationEditorParamsType.FREETEXT_COLOR,overwriteIfSameType:!0,keepUndo:!0})}_translateEmpty(o,t){this._uiManager.translateSelectedEditors(o,t,!0)}getInitialTranslation(){const o=this.parentScale;return[-ee._internalPadding*o,-(ee._internalPadding+this.#l)*o]}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(this.isAttachedToDOM||this.parent.add(this)))}enableEditMode(){this.isInEditMode()||(this.parent.setEditingState(!1),this.parent.updateToolbar(p.AnnotationEditorType.FREETEXT),super.enableEditMode(),this.overlayDiv.classList.remove("enabled"),this.editorDiv.contentEditable=!0,this._isDraggable=!1,this.div.removeAttribute("aria-activedescendant"),this.editorDiv.addEventListener("keydown",this.#r),this.editorDiv.addEventListener("focus",this.#t),this.editorDiv.addEventListener("blur",this.#e),this.editorDiv.addEventListener("input",this.#n))}disableEditMode(){this.isInEditMode()&&(this.parent.setEditingState(!0),super.disableEditMode(),this.overlayDiv.classList.add("enabled"),this.editorDiv.contentEditable=!1,this.div.setAttribute("aria-activedescendant",this.#a),this._isDraggable=!0,this.editorDiv.removeEventListener("keydown",this.#r),this.editorDiv.removeEventListener("focus",this.#t),this.editorDiv.removeEventListener("blur",this.#e),this.editorDiv.removeEventListener("input",this.#n),this.div.focus({preventScroll:!0}),this.isEditing=!1,this.parent.div.classList.add("freeTextEditing"))}focusin(o){this._focusEventsAllowed&&(super.focusin(o),o.target!==this.editorDiv&&this.editorDiv.focus())}onceAdded(){if(this.width){this.#m();return}this.enableEditMode(),this.editorDiv.focus(),this._initialOptions?.isCentered&&this.center(),this._initialOptions=null}isEmpty(){return!this.editorDiv||this.editorDiv.innerText.trim()===""}remove(){this.isEditing=!1,this.parent&&(this.parent.setEditingState(!0),this.parent.div.classList.add("freeTextEditing")),super.remove()}#d(){const o=this.editorDiv.getElementsByTagName("div");if(o.length===0)return this.editorDiv.innerText;const t=[];for(const a of o)t.push(a.innerText.replace(/\r\n?|\n/,""));return t.join(`
|
|
5
|
+
`)}#h(){const[o,t]=this.parentDimensions;let a;if(this.isAttachedToDOM)a=this.div.getBoundingClientRect();else{const{currentLayer:g,div:d}=this,i=d.style.display;d.style.display="hidden",g.div.append(this.div),a=d.getBoundingClientRect(),d.remove(),d.style.display=i}this.rotation%180===this.parentRotation%180?(this.width=a.width/o,this.height=a.height/t):(this.width=a.height/o,this.height=a.width/t),this.fixAndSetPosition()}commit(){if(!this.isInEditMode())return;super.commit(),this.disableEditMode();const o=this.#s,t=this.#s=this.#d().trimEnd();if(o===t)return;const a=g=>{if(this.#s=g,!g){this.remove();return}this.#p(),this._uiManager.rebuild(this),this.#h()};this.addCommands({cmd:()=>{a(t)},undo:()=>{a(o)},mustExec:!1}),this.#h()}shouldGetKeyboardEvents(){return this.isInEditMode()}enterInEditMode(){this.enableEditMode(),this.editorDiv.focus()}dblclick(o){this.enterInEditMode()}keydown(o){o.target===this.div&&o.key==="Enter"&&(this.enterInEditMode(),o.preventDefault())}editorDivKeydown(o){ee._keyboardManager.exec(this,o)}editorDivFocus(o){this.isEditing=!0}editorDivBlur(o){this.isEditing=!1}editorDivInput(o){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 o,t;this.width&&(o=this.x,t=this.y),super.render(),this.editorDiv=document.createElement("div"),this.editorDiv.className="internal",this.editorDiv.setAttribute("id",this.#a),this.enableEditing(),s.AnnotationEditor._l10nPromise.get("editor_free_text2_aria_label").then(g=>this.editorDiv?.setAttribute("aria-label",g)),s.AnnotationEditor._l10nPromise.get("free_text2_default_content").then(g=>this.editorDiv?.setAttribute("default-content",g)),this.editorDiv.contentEditable=!0;const{style:a}=this.editorDiv;if(a.fontSize=`calc(${this.#l}px * var(--scale-factor))`,a.color=this.#o,this.div.append(this.editorDiv),this.overlayDiv=document.createElement("div"),this.overlayDiv.classList.add("overlay","enabled"),this.div.append(this.overlayDiv),(0,e.bindEvents)(this,this.div,["dblclick","keydown"]),this.width){const[g,d]=this.parentDimensions;if(this.annotationElementId){const{position:i}=this.#c;let[b,y]=this.getInitialTranslation();[b,y]=this.pageTranslationToScreen(b,y);const[f,T]=this.pageDimensions,[H,I]=this.pageTranslation;let _,M;switch(this.rotation){case 0:_=o+(i[0]-H)/f,M=t+this.height-(i[1]-I)/T;break;case 90:_=o+(i[0]-H)/f,M=t-(i[1]-I)/T,[b,y]=[y,-b];break;case 180:_=o-this.width+(i[0]-H)/f,M=t-(i[1]-I)/T,[b,y]=[-b,-y];break;case 270:_=o+(i[0]-H-this.height*T)/f,M=t+(i[1]-I-this.width*f)/T,[b,y]=[-y,b];break}this.setAt(_*g,M*d,b,y)}else this.setAt(o*g,t*d,this.width*g,this.height*d);this.#p(),this._isDraggable=!0,this.editorDiv.contentEditable=!1}else this._isDraggable=!1,this.editorDiv.contentEditable=!0;return this.div}#p(){if(this.editorDiv.replaceChildren(),!!this.#s)for(const o of this.#s.split(`
|
|
6
|
+
`)){const t=document.createElement("div");t.append(o?document.createTextNode(o):document.createElement("br")),this.editorDiv.append(t)}}get contentDiv(){return this.editorDiv}static deserialize(o,t,a){let g=null;if(o instanceof N.FreeTextAnnotationElement){const{data:{defaultAppearanceData:{fontSize:i,fontColor:b},rect:y,rotation:f,id:T},textContent:H,textPosition:I,parent:{page:{pageNumber:_}}}=o;if(!H||H.length===0)return null;g=o={annotationType:p.AnnotationEditorType.FREETEXT,color:Array.from(b),fontSize:i,value:H.join(`
|
|
7
|
+
`),position:I,pageIndex:_-1,rect:y,rotation:f,id:T,deleted:!1}}const d=super.deserialize(o,t,a);return d.#l=o.fontSize,d.#o=p.Util.makeHexColor(...o.color),d.#s=o.value,d.annotationElementId=o.id||null,d.#c=g,d}serialize(o=!1){if(this.isEmpty())return null;if(this.deleted)return{pageIndex:this.pageIndex,id:this.annotationElementId,deleted:!0};const t=ee._internalPadding*this.parentScale,a=this.getRect(t,t),g=s.AnnotationEditor._colorManager.convert(this.isAttachedToDOM?getComputedStyle(this.editorDiv).color:this.#o),d={annotationType:p.AnnotationEditorType.FREETEXT,color:g,fontSize:this.#l,value:this.#s,pageIndex:this.pageIndex,rect:a,rotation:this.rotation,structTreeParentId:this._structTreeParentId};return o?d:this.annotationElementId&&!this.#v(d)?null:(d.id=this.annotationElementId,d)}#v(o){const{value:t,fontSize:a,color:g,rect:d,pageIndex:i}=this.#c;return o.value!==t||o.fontSize!==a||o.rect.some((b,y)=>Math.abs(b-d[y])>=1)||o.color.some((b,y)=>b!==g[y])||o.pageIndex!==i}#m(o=!1){if(!this.annotationElementId)return;if(this.#h(),!o&&(this.width===0||this.height===0)){setTimeout(()=>this.#m(!0),0);return}const t=ee._internalPadding*this.parentScale;this.#c.rect=this.getRect(t,t)}}c.FreeTextEditor=ee}),((r,c,q)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.StampAnnotationElement=c.InkAnnotationElement=c.FreeTextAnnotationElement=c.AnnotationLayer=void 0;var p=q(1),e=q(6),s=q(3),N=q(30),ee=q(31),U=q(32);const o=1e3,t=9,a=new WeakSet;function g(L){return{width:L[2]-L[0],height:L[3]-L[1]}}class d{static create(l){switch(l.data.annotationType){case p.AnnotationType.LINK:return new b(l);case p.AnnotationType.TEXT:return new y(l);case p.AnnotationType.WIDGET:switch(l.data.fieldType){case"Tx":return new T(l);case"Btn":return l.data.radioButton?new _(l):l.data.checkBox?new I(l):new M(l);case"Ch":return new te(l);case"Sig":return new H(l)}return new f(l);case p.AnnotationType.POPUP:return new ie(l);case p.AnnotationType.FREETEXT:return new he(l);case p.AnnotationType.LINE:return new ge(l);case p.AnnotationType.SQUARE:return new Ne(l);case p.AnnotationType.CIRCLE:return new ke(l);case p.AnnotationType.POLYLINE:return new Oe(l);case p.AnnotationType.CARET:return new Ee(l);case p.AnnotationType.INK:return new G(l);case p.AnnotationType.POLYGON:return new Ve(l);case p.AnnotationType.HIGHLIGHT:return new A(l);case p.AnnotationType.UNDERLINE:return new m(l);case p.AnnotationType.SQUIGGLY:return new v(l);case p.AnnotationType.STRIKEOUT:return new C(l);case p.AnnotationType.STAMP:return new V(l);case p.AnnotationType.FILEATTACHMENT:return new W(l);default:return new i(l)}}}class i{#e=!1;constructor(l,{isRenderable:S=!1,ignoreBorder:R=!1,createQuadrilaterals:O=!1}={}){this.isRenderable=S,this.data=l.data,this.layer=l.layer,this.linkService=l.linkService,this.downloadManager=l.downloadManager,this.imageResourcesPath=l.imageResourcesPath,this.renderForms=l.renderForms,this.svgFactory=l.svgFactory,this.annotationStorage=l.annotationStorage,this.enableScripting=l.enableScripting,this.hasJSActions=l.hasJSActions,this._fieldObjects=l.fieldObjects,this.parent=l.parent,S&&(this.container=this._createContainer(R)),O&&this._createQuadrilaterals()}static _hasPopupData({titleObj:l,contentsObj:S,richText:R}){return!!(l?.str||S?.str||R?.str)}get hasPopupData(){return i._hasPopupData(this.data)}_createContainer(l){const{data:S,parent:{page:R,viewport:O}}=this,B=document.createElement("section");B.setAttribute("data-annotation-id",S.id),this instanceof f||(B.tabIndex=o),B.style.zIndex=this.parent.zIndex++,this.data.popupRef&&B.setAttribute("aria-haspopup","dialog"),S.noRotate&&B.classList.add("norotate");const{pageWidth:Z,pageHeight:re,pageX:me,pageY:We}=O.rawDims;if(!S.rect||this instanceof ie){const{rotation:xe}=S;return!S.hasOwnCanvas&&xe!==0&&this.setRotation(xe,B),B}const{width:ve,height:ye}=g(S.rect),Ce=p.Util.normalizeRect([S.rect[0],R.view[3]-S.rect[1]+R.view[1],S.rect[2],R.view[3]-S.rect[3]+R.view[1]]);if(!l&&S.borderStyle.width>0){B.style.borderWidth=`${S.borderStyle.width}px`;const xe=S.borderStyle.horizontalCornerRadius,qe=S.borderStyle.verticalCornerRadius;if(xe>0||qe>0){const lt=`calc(${xe}px * var(--scale-factor)) / calc(${qe}px * var(--scale-factor))`;B.style.borderRadius=lt}else if(this instanceof _){const lt=`calc(${ve}px * var(--scale-factor)) / calc(${ye}px * var(--scale-factor))`;B.style.borderRadius=lt}switch(S.borderStyle.style){case p.AnnotationBorderStyleType.SOLID:B.style.borderStyle="solid";break;case p.AnnotationBorderStyleType.DASHED:B.style.borderStyle="dashed";break;case p.AnnotationBorderStyleType.BEVELED:(0,p.warn)("Unimplemented border style: beveled");break;case p.AnnotationBorderStyleType.INSET:(0,p.warn)("Unimplemented border style: inset");break;case p.AnnotationBorderStyleType.UNDERLINE:B.style.borderBottomStyle="solid";break}const tt=S.borderColor||null;tt?(this.#e=!0,B.style.borderColor=p.Util.makeHexColor(tt[0]|0,tt[1]|0,tt[2]|0)):B.style.borderWidth=0}B.style.left=`${100*(Ce[0]-me)/Z}%`,B.style.top=`${100*(Ce[1]-We)/re}%`;const{rotation:Re}=S;return S.hasOwnCanvas||Re===0?(B.style.width=`${100*ve/Z}%`,B.style.height=`${100*ye/re}%`):this.setRotation(Re,B),B}setRotation(l,S=this.container){if(!this.data.rect)return;const{pageWidth:R,pageHeight:O}=this.parent.viewport.rawDims,{width:B,height:Z}=g(this.data.rect);let re,me;l%180===0?(re=100*B/R,me=100*Z/O):(re=100*Z/R,me=100*B/O),S.style.width=`${re}%`,S.style.height=`${me}%`,S.setAttribute("data-main-rotation",(360-l)%360)}get _commonActions(){const l=(S,R,O)=>{const B=O.detail[S],Z=B[0],re=B.slice(1);O.target.style[R]=N.ColorConverters[`${Z}_HTML`](re),this.annotationStorage.setValue(this.data.id,{[R]:N.ColorConverters[`${Z}_rgb`](re)})};return(0,p.shadow)(this,"_commonActions",{display:S=>{const{display:R}=S.detail,O=R%2===1;this.container.style.visibility=O?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noView:O,noPrint:R===1||R===2})},print:S=>{this.annotationStorage.setValue(this.data.id,{noPrint:!S.detail.print})},hidden:S=>{const{hidden:R}=S.detail;this.container.style.visibility=R?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noPrint:R,noView:R})},focus:S=>{setTimeout(()=>S.target.focus({preventScroll:!1}),0)},userName:S=>{S.target.title=S.detail.userName},readonly:S=>{S.target.disabled=S.detail.readonly},required:S=>{this._setRequired(S.target,S.detail.required)},bgColor:S=>{l("bgColor","backgroundColor",S)},fillColor:S=>{l("fillColor","backgroundColor",S)},fgColor:S=>{l("fgColor","color",S)},textColor:S=>{l("textColor","color",S)},borderColor:S=>{l("borderColor","borderColor",S)},strokeColor:S=>{l("strokeColor","borderColor",S)},rotation:S=>{const R=S.detail.rotation;this.setRotation(R),this.annotationStorage.setValue(this.data.id,{rotation:R})}})}_dispatchEventFromSandbox(l,S){const R=this._commonActions;for(const O of Object.keys(S.detail))(l[O]||R[O])?.(S)}_setDefaultPropertiesFromJS(l){if(!this.enableScripting)return;const S=this.annotationStorage.getRawValue(this.data.id);if(!S)return;const R=this._commonActions;for(const[O,B]of Object.entries(S)){const Z=R[O];if(Z){const re={detail:{[O]:B},target:l};Z(re),delete S[O]}}}_createQuadrilaterals(){if(!this.container)return;const{quadPoints:l}=this.data;if(!l)return;const[S,R,O,B]=this.data.rect;if(l.length===1){const[,{x:qe,y:tt},{x:lt,y:vt}]=l[0];if(O===qe&&B===tt&&S===lt&&R===vt)return}const{style:Z}=this.container;let re;if(this.#e){const{borderColor:qe,borderWidth:tt}=Z;Z.borderWidth=0,re=["url('data:image/svg+xml;utf8,",'<svg xmlns="http://www.w3.org/2000/svg"',' preserveAspectRatio="none" viewBox="0 0 1 1">',`<g fill="transparent" stroke="${qe}" stroke-width="${tt}">`],this.container.classList.add("hasBorder")}const me=O-S,We=B-R,{svgFactory:ve}=this,ye=ve.createElement("svg");ye.classList.add("quadrilateralsContainer"),ye.setAttribute("width",0),ye.setAttribute("height",0);const Ce=ve.createElement("defs");ye.append(Ce);const Re=ve.createElement("clipPath"),xe=`clippath_${this.data.id}`;Re.setAttribute("id",xe),Re.setAttribute("clipPathUnits","objectBoundingBox"),Ce.append(Re);for(const[,{x:qe,y:tt},{x:lt,y:vt}]of l){const bt=ve.createElement("rect"),Ft=(lt-S)/me,vn=(B-tt)/We,hn=(qe-lt)/me,jn=(tt-vt)/We;bt.setAttribute("x",Ft),bt.setAttribute("y",vn),bt.setAttribute("width",hn),bt.setAttribute("height",jn),Re.append(bt),re?.push(`<rect vector-effect="non-scaling-stroke" x="${Ft}" y="${vn}" width="${hn}" height="${jn}"/>`)}this.#e&&(re.push("</g></svg>')"),Z.backgroundImage=re.join("")),this.container.append(ye),this.container.style.clipPath=`url(#${xe})`}_createPopup(){const{container:l,data:S}=this;l.setAttribute("aria-haspopup","dialog");const R=new ie({data:{color:S.color,titleObj:S.titleObj,modificationDate:S.modificationDate,contentsObj:S.contentsObj,richText:S.richText,parentRect:S.rect,borderStyle:0,id:`popup_${S.id}`,rotation:S.rotation},parent:this.parent,elements:[this]});this.parent.div.append(R.render())}render(){(0,p.unreachable)("Abstract method `AnnotationElement.render` called")}_getElementsByName(l,S=null){const R=[];if(this._fieldObjects){const O=this._fieldObjects[l];if(O)for(const{page:B,id:Z,exportValues:re}of O){if(B===-1||Z===S)continue;const me=typeof re=="string"?re:null,We=document.querySelector(`[data-element-id="${Z}"]`);if(We&&!a.has(We)){(0,p.warn)(`_getElementsByName - element not allowed: ${Z}`);continue}R.push({id:Z,exportValue:me,domElement:We})}return R}for(const O of document.getElementsByName(l)){const{exportValue:B}=O,Z=O.getAttribute("data-element-id");Z!==S&&a.has(O)&&R.push({id:Z,exportValue:B,domElement:O})}return R}show(){this.container&&(this.container.hidden=!1),this.popup?.maybeShow()}hide(){this.container&&(this.container.hidden=!0),this.popup?.forceHide()}getElementsToTriggerPopup(){return this.container}addHighlightArea(){const l=this.getElementsToTriggerPopup();if(Array.isArray(l))for(const S of l)S.classList.add("highlightArea");else l.classList.add("highlightArea")}_editOnDoubleClick(){const{annotationEditorType:l,data:{id:S}}=this;this.container.addEventListener("dblclick",()=>{this.linkService.eventBus?.dispatch("switchannotationeditormode",{source:this,mode:l,editId:S})})}}class b extends i{constructor(l,S=null){super(l,{isRenderable:!0,ignoreBorder:!!S?.ignoreBorder,createQuadrilaterals:!0}),this.isTooltipOnly=l.data.isTooltipOnly}render(){const{data:l,linkService:S}=this,R=document.createElement("a");R.setAttribute("data-element-id",l.id);let O=!1;return l.url?(S.addLinkAttributes(R,l.url,l.newWindow),O=!0):l.action?(this._bindNamedAction(R,l.action),O=!0):l.attachment?(this._bindAttachment(R,l.attachment),O=!0):l.setOCGState?(this.#t(R,l.setOCGState),O=!0):l.dest?(this._bindLink(R,l.dest),O=!0):(l.actions&&(l.actions.Action||l.actions["Mouse Up"]||l.actions["Mouse Down"])&&this.enableScripting&&this.hasJSActions&&(this._bindJSAction(R,l),O=!0),l.resetForm?(this._bindResetFormAction(R,l.resetForm),O=!0):this.isTooltipOnly&&!O&&(this._bindLink(R,""),O=!0)),this.container.classList.add("linkAnnotation"),O&&this.container.append(R),this.container}#e(){this.container.setAttribute("data-internal-link","")}_bindLink(l,S){l.href=this.linkService.getDestinationHash(S),l.onclick=()=>(S&&this.linkService.goToDestination(S),!1),(S||S==="")&&this.#e()}_bindNamedAction(l,S){l.href=this.linkService.getAnchorUrl(""),l.onclick=()=>(this.linkService.executeNamedAction(S),!1),this.#e()}_bindAttachment(l,S){l.href=this.linkService.getAnchorUrl(""),l.onclick=()=>(this.downloadManager?.openOrDownloadData(this.container,S.content,S.filename),!1),this.#e()}#t(l,S){l.href=this.linkService.getAnchorUrl(""),l.onclick=()=>(this.linkService.executeSetOCGState(S),!1),this.#e()}_bindJSAction(l,S){l.href=this.linkService.getAnchorUrl("");const R=new Map([["Action","onclick"],["Mouse Up","onmouseup"],["Mouse Down","onmousedown"]]);for(const O of Object.keys(S.actions)){const B=R.get(O);B&&(l[B]=()=>(this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:S.id,name:O}}),!1))}l.onclick||(l.onclick=()=>!1),this.#e()}_bindResetFormAction(l,S){const R=l.onclick;if(R||(l.href=this.linkService.getAnchorUrl("")),this.#e(),!this._fieldObjects){(0,p.warn)('_bindResetFormAction - "resetForm" action not supported, ensure that the `fieldObjects` parameter is provided.'),R||(l.onclick=()=>!1);return}l.onclick=()=>{R?.();const{fields:O,refs:B,include:Z}=S,re=[];if(O.length!==0||B.length!==0){const ve=new Set(B);for(const ye of O){const Ce=this._fieldObjects[ye]||[];for(const{id:Re}of Ce)ve.add(Re)}for(const ye of Object.values(this._fieldObjects))for(const Ce of ye)ve.has(Ce.id)===Z&&re.push(Ce)}else for(const ve of Object.values(this._fieldObjects))re.push(...ve);const me=this.annotationStorage,We=[];for(const ve of re){const{id:ye}=ve;switch(We.push(ye),ve.type){case"text":{const Re=ve.defaultValue||"";me.setValue(ye,{value:Re});break}case"checkbox":case"radiobutton":{const Re=ve.defaultValue===ve.exportValues;me.setValue(ye,{value:Re});break}case"combobox":case"listbox":{const Re=ve.defaultValue||"";me.setValue(ye,{value:Re});break}default:continue}const Ce=document.querySelector(`[data-element-id="${ye}"]`);if(Ce){if(!a.has(Ce)){(0,p.warn)(`_bindResetFormAction - element not allowed: ${ye}`);continue}}else continue;Ce.dispatchEvent(new Event("resetform"))}return this.enableScripting&&this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:"app",ids:We,name:"ResetForm"}}),!1}}}class y extends i{constructor(l){super(l,{isRenderable:!0})}render(){this.container.classList.add("textAnnotation");const l=document.createElement("img");return l.src=this.imageResourcesPath+"annotation-"+this.data.name.toLowerCase()+".svg",l.alt="[{{type}} Annotation]",l.dataset.l10nId="text_annotation_type",l.dataset.l10nArgs=JSON.stringify({type:this.data.name}),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.append(l),this.container}}class f extends i{render(){return this.data.alternativeText&&(this.container.title=this.data.alternativeText),this.container}showElementAndHideCanvas(l){this.data.hasOwnCanvas&&(l.previousSibling?.nodeName==="CANVAS"&&(l.previousSibling.hidden=!0),l.hidden=!1)}_getKeyModifier(l){const{isWin:S,isMac:R}=p.FeatureTest.platform;return S&&l.ctrlKey||R&&l.metaKey}_setEventListener(l,S,R,O,B){R.includes("mouse")?l.addEventListener(R,Z=>{this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:O,value:B(Z),shift:Z.shiftKey,modifier:this._getKeyModifier(Z)}})}):l.addEventListener(R,Z=>{if(R==="blur"){if(!S.focused||!Z.relatedTarget)return;S.focused=!1}else if(R==="focus"){if(S.focused)return;S.focused=!0}B&&this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:O,value:B(Z)}})})}_setEventListeners(l,S,R,O){for(const[B,Z]of R)(Z==="Action"||this.data.actions?.[Z])&&((Z==="Focus"||Z==="Blur")&&(S||={focused:!1}),this._setEventListener(l,S,B,Z,O),Z==="Focus"&&!this.data.actions?.Blur?this._setEventListener(l,S,"blur","Blur",null):Z==="Blur"&&!this.data.actions?.Focus&&this._setEventListener(l,S,"focus","Focus",null))}_setBackgroundColor(l){const S=this.data.backgroundColor||null;l.style.backgroundColor=S===null?"transparent":p.Util.makeHexColor(S[0],S[1],S[2])}_setTextStyle(l){const S=["left","center","right"],{fontColor:R}=this.data.defaultAppearanceData,O=this.data.defaultAppearanceData.fontSize||t,B=l.style;let Z;const re=2,me=We=>Math.round(10*We)/10;if(this.data.multiLine){const We=Math.abs(this.data.rect[3]-this.data.rect[1]-re),ve=Math.round(We/(p.LINE_FACTOR*O))||1,ye=We/ve;Z=Math.min(O,me(ye/p.LINE_FACTOR))}else{const We=Math.abs(this.data.rect[3]-this.data.rect[1]-re);Z=Math.min(O,me(We/p.LINE_FACTOR))}B.fontSize=`calc(${Z}px * var(--scale-factor))`,B.color=p.Util.makeHexColor(R[0],R[1],R[2]),this.data.textAlignment!==null&&(B.textAlign=S[this.data.textAlignment])}_setRequired(l,S){S?l.setAttribute("required",!0):l.removeAttribute("required"),l.setAttribute("aria-required",S)}}class T extends f{constructor(l){const S=l.renderForms||!l.data.hasAppearance&&!!l.data.fieldValue;super(l,{isRenderable:S})}setPropertyOnSiblings(l,S,R,O){const B=this.annotationStorage;for(const Z of this._getElementsByName(l.name,l.id))Z.domElement&&(Z.domElement[S]=R),B.setValue(Z.id,{[O]:R})}render(){const l=this.annotationStorage,S=this.data.id;this.container.classList.add("textWidgetAnnotation");let R=null;if(this.renderForms){const O=l.getValue(S,{value:this.data.fieldValue});let B=O.value||"";const Z=l.getValue(S,{charLimit:this.data.maxLen}).charLimit;Z&&B.length>Z&&(B=B.slice(0,Z));let re=O.formattedValue||this.data.textContent?.join(`
|
|
8
|
+
`)||null;re&&this.data.comb&&(re=re.replaceAll(/\s+/g,""));const me={userValue:B,formattedValue:re,lastCommittedValue:null,commitKey:1,focused:!1};this.data.multiLine?(R=document.createElement("textarea"),R.textContent=re??B,this.data.doNotScroll&&(R.style.overflowY="hidden")):(R=document.createElement("input"),R.type="text",R.setAttribute("value",re??B),this.data.doNotScroll&&(R.style.overflowX="hidden")),this.data.hasOwnCanvas&&(R.hidden=!0),a.add(R),R.setAttribute("data-element-id",S),R.disabled=this.data.readOnly,R.name=this.data.fieldName,R.tabIndex=o,this._setRequired(R,this.data.required),Z&&(R.maxLength=Z),R.addEventListener("input",ve=>{l.setValue(S,{value:ve.target.value}),this.setPropertyOnSiblings(R,"value",ve.target.value,"value"),me.formattedValue=null}),R.addEventListener("resetform",ve=>{const ye=this.data.defaultFieldValue??"";R.value=me.userValue=ye,me.formattedValue=null});let We=ve=>{const{formattedValue:ye}=me;ye!=null&&(ve.target.value=ye),ve.target.scrollLeft=0};if(this.enableScripting&&this.hasJSActions){R.addEventListener("focus",ye=>{if(me.focused)return;const{target:Ce}=ye;me.userValue&&(Ce.value=me.userValue),me.lastCommittedValue=Ce.value,me.commitKey=1,me.focused=!0}),R.addEventListener("updatefromsandbox",ye=>{this.showElementAndHideCanvas(ye.target);const Ce={value(Re){me.userValue=Re.detail.value??"",l.setValue(S,{value:me.userValue.toString()}),Re.target.value=me.userValue},formattedValue(Re){const{formattedValue:xe}=Re.detail;me.formattedValue=xe,xe!=null&&Re.target!==document.activeElement&&(Re.target.value=xe),l.setValue(S,{formattedValue:xe})},selRange(Re){Re.target.setSelectionRange(...Re.detail.selRange)},charLimit:Re=>{const{charLimit:xe}=Re.detail,{target:qe}=Re;if(xe===0){qe.removeAttribute("maxLength");return}qe.setAttribute("maxLength",xe);let tt=me.userValue;!tt||tt.length<=xe||(tt=tt.slice(0,xe),qe.value=me.userValue=tt,l.setValue(S,{value:tt}),this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:S,name:"Keystroke",value:tt,willCommit:!0,commitKey:1,selStart:qe.selectionStart,selEnd:qe.selectionEnd}}))}};this._dispatchEventFromSandbox(Ce,ye)}),R.addEventListener("keydown",ye=>{me.commitKey=1;let Ce=-1;if(ye.key==="Escape"?Ce=0:ye.key==="Enter"&&!this.data.multiLine?Ce=2:ye.key==="Tab"&&(me.commitKey=3),Ce===-1)return;const{value:Re}=ye.target;me.lastCommittedValue!==Re&&(me.lastCommittedValue=Re,me.userValue=Re,this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:S,name:"Keystroke",value:Re,willCommit:!0,commitKey:Ce,selStart:ye.target.selectionStart,selEnd:ye.target.selectionEnd}}))});const ve=We;We=null,R.addEventListener("blur",ye=>{if(!me.focused||!ye.relatedTarget)return;me.focused=!1;const{value:Ce}=ye.target;me.userValue=Ce,me.lastCommittedValue!==Ce&&this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:S,name:"Keystroke",value:Ce,willCommit:!0,commitKey:me.commitKey,selStart:ye.target.selectionStart,selEnd:ye.target.selectionEnd}}),ve(ye)}),this.data.actions?.Keystroke&&R.addEventListener("beforeinput",ye=>{me.lastCommittedValue=null;const{data:Ce,target:Re}=ye,{value:xe,selectionStart:qe,selectionEnd:tt}=Re;let lt=qe,vt=tt;switch(ye.inputType){case"deleteWordBackward":{const bt=xe.substring(0,qe).match(/\w*[^\w]*$/);bt&&(lt-=bt[0].length);break}case"deleteWordForward":{const bt=xe.substring(qe).match(/^[^\w]*\w*/);bt&&(vt+=bt[0].length);break}case"deleteContentBackward":qe===tt&&(lt-=1);break;case"deleteContentForward":qe===tt&&(vt+=1);break}ye.preventDefault(),this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:S,name:"Keystroke",value:xe,change:Ce||"",willCommit:!1,selStart:lt,selEnd:vt}})}),this._setEventListeners(R,me,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],ye=>ye.target.value)}if(We&&R.addEventListener("blur",We),this.data.comb){const ye=(this.data.rect[2]-this.data.rect[0])/Z;R.classList.add("comb"),R.style.letterSpacing=`calc(${ye}px * var(--scale-factor) - 1ch)`}}else R=document.createElement("div"),R.textContent=this.data.fieldValue,R.style.verticalAlign="middle",R.style.display="table-cell";return this._setTextStyle(R),this._setBackgroundColor(R),this._setDefaultPropertiesFromJS(R),this.container.append(R),this.container}}class H extends f{constructor(l){super(l,{isRenderable:!!l.data.hasOwnCanvas})}}class I extends f{constructor(l){super(l,{isRenderable:l.renderForms})}render(){const l=this.annotationStorage,S=this.data,R=S.id;let O=l.getValue(R,{value:S.exportValue===S.fieldValue}).value;typeof O=="string"&&(O=O!=="Off",l.setValue(R,{value:O})),this.container.classList.add("buttonWidgetAnnotation","checkBox");const B=document.createElement("input");return a.add(B),B.setAttribute("data-element-id",R),B.disabled=S.readOnly,this._setRequired(B,this.data.required),B.type="checkbox",B.name=S.fieldName,O&&B.setAttribute("checked",!0),B.setAttribute("exportValue",S.exportValue),B.tabIndex=o,B.addEventListener("change",Z=>{const{name:re,checked:me}=Z.target;for(const We of this._getElementsByName(re,R)){const ve=me&&We.exportValue===S.exportValue;We.domElement&&(We.domElement.checked=ve),l.setValue(We.id,{value:ve})}l.setValue(R,{value:me})}),B.addEventListener("resetform",Z=>{const re=S.defaultFieldValue||"Off";Z.target.checked=re===S.exportValue}),this.enableScripting&&this.hasJSActions&&(B.addEventListener("updatefromsandbox",Z=>{const re={value(me){me.target.checked=me.detail.value!=="Off",l.setValue(R,{value:me.target.checked})}};this._dispatchEventFromSandbox(re,Z)}),this._setEventListeners(B,null,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],Z=>Z.target.checked)),this._setBackgroundColor(B),this._setDefaultPropertiesFromJS(B),this.container.append(B),this.container}}class _ extends f{constructor(l){super(l,{isRenderable:l.renderForms})}render(){this.container.classList.add("buttonWidgetAnnotation","radioButton");const l=this.annotationStorage,S=this.data,R=S.id;let O=l.getValue(R,{value:S.fieldValue===S.buttonValue}).value;typeof O=="string"&&(O=O!==S.buttonValue,l.setValue(R,{value:O}));const B=document.createElement("input");if(a.add(B),B.setAttribute("data-element-id",R),B.disabled=S.readOnly,this._setRequired(B,this.data.required),B.type="radio",B.name=S.fieldName,O&&B.setAttribute("checked",!0),B.tabIndex=o,B.addEventListener("change",Z=>{const{name:re,checked:me}=Z.target;for(const We of this._getElementsByName(re,R))l.setValue(We.id,{value:!1});l.setValue(R,{value:me})}),B.addEventListener("resetform",Z=>{const re=S.defaultFieldValue;Z.target.checked=re!=null&&re===S.buttonValue}),this.enableScripting&&this.hasJSActions){const Z=S.buttonValue;B.addEventListener("updatefromsandbox",re=>{const me={value:We=>{const ve=Z===We.detail.value;for(const ye of this._getElementsByName(We.target.name)){const Ce=ve&&ye.id===R;ye.domElement&&(ye.domElement.checked=Ce),l.setValue(ye.id,{value:Ce})}}};this._dispatchEventFromSandbox(me,re)}),this._setEventListeners(B,null,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],re=>re.target.checked)}return this._setBackgroundColor(B),this._setDefaultPropertiesFromJS(B),this.container.append(B),this.container}}class M extends b{constructor(l){super(l,{ignoreBorder:l.data.hasAppearance})}render(){const l=super.render();l.classList.add("buttonWidgetAnnotation","pushButton"),this.data.alternativeText&&(l.title=this.data.alternativeText);const S=l.lastChild;return this.enableScripting&&this.hasJSActions&&S&&(this._setDefaultPropertiesFromJS(S),S.addEventListener("updatefromsandbox",R=>{this._dispatchEventFromSandbox({},R)})),l}}class te extends f{constructor(l){super(l,{isRenderable:l.renderForms})}render(){this.container.classList.add("choiceWidgetAnnotation");const l=this.annotationStorage,S=this.data.id,R=l.getValue(S,{value:this.data.fieldValue}),O=document.createElement("select");a.add(O),O.setAttribute("data-element-id",S),O.disabled=this.data.readOnly,this._setRequired(O,this.data.required),O.name=this.data.fieldName,O.tabIndex=o;let B=this.data.combo&&this.data.options.length>0;this.data.combo||(O.size=this.data.options.length,this.data.multiSelect&&(O.multiple=!0)),O.addEventListener("resetform",ve=>{const ye=this.data.defaultFieldValue;for(const Ce of O.options)Ce.selected=Ce.value===ye});for(const ve of this.data.options){const ye=document.createElement("option");ye.textContent=ve.displayValue,ye.value=ve.exportValue,R.value.includes(ve.exportValue)&&(ye.setAttribute("selected",!0),B=!1),O.append(ye)}let Z=null;if(B){const ve=document.createElement("option");ve.value=" ",ve.setAttribute("hidden",!0),ve.setAttribute("selected",!0),O.prepend(ve),Z=()=>{ve.remove(),O.removeEventListener("input",Z),Z=null},O.addEventListener("input",Z)}const re=ve=>{const ye=ve?"value":"textContent",{options:Ce,multiple:Re}=O;return Re?Array.prototype.filter.call(Ce,xe=>xe.selected).map(xe=>xe[ye]):Ce.selectedIndex===-1?null:Ce[Ce.selectedIndex][ye]};let me=re(!1);const We=ve=>{const ye=ve.target.options;return Array.prototype.map.call(ye,Ce=>({displayValue:Ce.textContent,exportValue:Ce.value}))};return this.enableScripting&&this.hasJSActions?(O.addEventListener("updatefromsandbox",ve=>{const ye={value(Ce){Z?.();const Re=Ce.detail.value,xe=new Set(Array.isArray(Re)?Re:[Re]);for(const qe of O.options)qe.selected=xe.has(qe.value);l.setValue(S,{value:re(!0)}),me=re(!1)},multipleSelection(Ce){O.multiple=!0},remove(Ce){const Re=O.options,xe=Ce.detail.remove;Re[xe].selected=!1,O.remove(xe),Re.length>0&&Array.prototype.findIndex.call(Re,tt=>tt.selected)===-1&&(Re[0].selected=!0),l.setValue(S,{value:re(!0),items:We(Ce)}),me=re(!1)},clear(Ce){for(;O.length!==0;)O.remove(0);l.setValue(S,{value:null,items:[]}),me=re(!1)},insert(Ce){const{index:Re,displayValue:xe,exportValue:qe}=Ce.detail.insert,tt=O.children[Re],lt=document.createElement("option");lt.textContent=xe,lt.value=qe,tt?tt.before(lt):O.append(lt),l.setValue(S,{value:re(!0),items:We(Ce)}),me=re(!1)},items(Ce){const{items:Re}=Ce.detail;for(;O.length!==0;)O.remove(0);for(const xe of Re){const{displayValue:qe,exportValue:tt}=xe,lt=document.createElement("option");lt.textContent=qe,lt.value=tt,O.append(lt)}O.options.length>0&&(O.options[0].selected=!0),l.setValue(S,{value:re(!0),items:We(Ce)}),me=re(!1)},indices(Ce){const Re=new Set(Ce.detail.indices);for(const xe of Ce.target.options)xe.selected=Re.has(xe.index);l.setValue(S,{value:re(!0)}),me=re(!1)},editable(Ce){Ce.target.disabled=!Ce.detail.editable}};this._dispatchEventFromSandbox(ye,ve)}),O.addEventListener("input",ve=>{const ye=re(!0);l.setValue(S,{value:ye}),ve.preventDefault(),this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:S,name:"Keystroke",value:me,changeEx:ye,willCommit:!1,commitKey:1,keyDown:!1}})}),this._setEventListeners(O,null,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"],["input","Action"],["input","Validate"]],ve=>ve.target.value)):O.addEventListener("input",function(ve){l.setValue(S,{value:re(!0)})}),this.data.combo&&this._setTextStyle(O),this._setBackgroundColor(O),this._setDefaultPropertiesFromJS(O),this.container.append(O),this.container}}class ie extends i{constructor(l){const{data:S,elements:R}=l;super(l,{isRenderable:i._hasPopupData(S)}),this.elements=R}render(){this.container.classList.add("popupAnnotation");const l=new Y({container:this.container,color:this.data.color,titleObj:this.data.titleObj,modificationDate:this.data.modificationDate,contentsObj:this.data.contentsObj,richText:this.data.richText,rect:this.data.rect,parentRect:this.data.parentRect||null,parent:this.parent,elements:this.elements,open:this.data.open}),S=[];for(const R of this.elements)R.popup=l,S.push(R.data.id),R.addHighlightArea();return this.container.setAttribute("aria-controls",S.map(R=>`${p.AnnotationPrefix}${R}`).join(",")),this.container}}class Y{#e=null;#t=this.#u.bind(this);#n=this.#w.bind(this);#r=this.#E.bind(this);#o=this.#b.bind(this);#s=null;#a=null;#l=null;#c=null;#i=null;#f=null;#d=!1;#h=null;#p=null;#v=null;#m=null;#g=!1;constructor({container:l,color:S,elements:R,titleObj:O,modificationDate:B,contentsObj:Z,richText:re,parent:me,rect:We,parentRect:ve,open:ye}){this.#a=l,this.#m=O,this.#l=Z,this.#v=re,this.#i=me,this.#s=S,this.#p=We,this.#f=ve,this.#c=R;const Ce=e.PDFDateString.toDateObject(B);Ce&&(this.#e=me.l10n.get("annotation_date_string",{date:Ce.toLocaleDateString(),time:Ce.toLocaleTimeString()})),this.trigger=R.flatMap(Re=>Re.getElementsToTriggerPopup());for(const Re of this.trigger)Re.addEventListener("click",this.#o),Re.addEventListener("mouseenter",this.#r),Re.addEventListener("mouseleave",this.#n),Re.classList.add("popupTriggerArea");for(const Re of R)Re.container?.addEventListener("keydown",this.#t);this.#a.hidden=!0,ye&&this.#b()}render(){if(this.#h)return;const{page:{view:l},viewport:{rawDims:{pageWidth:S,pageHeight:R,pageX:O,pageY:B}}}=this.#i,Z=this.#h=document.createElement("div");if(Z.className="popup",this.#s){const bt=Z.style.outlineColor=p.Util.makeHexColor(...this.#s);CSS.supports("background-color","color-mix(in srgb, red 30%, white)")?Z.style.backgroundColor=`color-mix(in srgb, ${bt} 30%, white)`:Z.style.backgroundColor=p.Util.makeHexColor(...this.#s.map(vn=>Math.floor(.7*(255-vn)+vn)))}const re=document.createElement("span");re.className="header";const me=document.createElement("h1");if(re.append(me),{dir:me.dir,str:me.textContent}=this.#m,Z.append(re),this.#e){const bt=document.createElement("span");bt.classList.add("popupDate"),this.#e.then(Ft=>{bt.textContent=Ft}),re.append(bt)}const We=this.#l,ve=this.#v;if(ve?.str&&(!We?.str||We.str===ve.str))U.XfaLayer.render({xfaHtml:ve.html,intent:"richText",div:Z}),Z.lastChild.classList.add("richText","popupContent");else{const bt=this._formatContents(We);Z.append(bt)}let ye=!!this.#f,Ce=ye?this.#f:this.#p;for(const bt of this.#c)if(!Ce||p.Util.intersect(bt.data.rect,Ce)!==null){Ce=bt.data.rect,ye=!0;break}const Re=p.Util.normalizeRect([Ce[0],l[3]-Ce[1]+l[1],Ce[2],l[3]-Ce[3]+l[1]]),qe=ye?Ce[2]-Ce[0]+5:0,tt=Re[0]+qe,lt=Re[1],{style:vt}=this.#a;vt.left=`${100*(tt-O)/S}%`,vt.top=`${100*(lt-B)/R}%`,this.#a.append(Z)}_formatContents({str:l,dir:S}){const R=document.createElement("p");R.classList.add("popupContent"),R.dir=S;const O=l.split(/(?:\r\n?|\n)/);for(let B=0,Z=O.length;B<Z;++B){const re=O[B];R.append(document.createTextNode(re)),B<Z-1&&R.append(document.createElement("br"))}return R}#u(l){l.altKey||l.shiftKey||l.ctrlKey||l.metaKey||(l.key==="Enter"||l.key==="Escape"&&this.#d)&&this.#b()}#b(){this.#d=!this.#d,this.#d?(this.#E(),this.#a.addEventListener("click",this.#o),this.#a.addEventListener("keydown",this.#t)):(this.#w(),this.#a.removeEventListener("click",this.#o),this.#a.removeEventListener("keydown",this.#t))}#E(){this.#h||this.render(),this.isVisible?this.#d&&this.#a.classList.add("focused"):(this.#a.hidden=!1,this.#a.style.zIndex=parseInt(this.#a.style.zIndex)+1e3)}#w(){this.#a.classList.remove("focused"),!(this.#d||!this.isVisible)&&(this.#a.hidden=!0,this.#a.style.zIndex=parseInt(this.#a.style.zIndex)-1e3)}forceHide(){this.#g=this.isVisible,this.#g&&(this.#a.hidden=!0)}maybeShow(){this.#g&&(this.#g=!1,this.#a.hidden=!1)}get isVisible(){return this.#a.hidden===!1}}class he extends i{constructor(l){super(l,{isRenderable:!0,ignoreBorder:!0}),this.textContent=l.data.textContent,this.textPosition=l.data.textPosition,this.annotationEditorType=p.AnnotationEditorType.FREETEXT}render(){if(this.container.classList.add("freeTextAnnotation"),this.textContent){const l=document.createElement("div");l.classList.add("annotationTextContent"),l.setAttribute("role","comment");for(const S of this.textContent){const R=document.createElement("span");R.textContent=S,l.append(R)}this.container.append(l)}return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this._editOnDoubleClick(),this.container}}c.FreeTextAnnotationElement=he;class ge extends i{#e=null;constructor(l){super(l,{isRenderable:!0,ignoreBorder:!0})}render(){this.container.classList.add("lineAnnotation");const l=this.data,{width:S,height:R}=g(l.rect),O=this.svgFactory.create(S,R,!0),B=this.#e=this.svgFactory.createElement("svg:line");return B.setAttribute("x1",l.rect[2]-l.lineCoordinates[0]),B.setAttribute("y1",l.rect[3]-l.lineCoordinates[1]),B.setAttribute("x2",l.rect[2]-l.lineCoordinates[2]),B.setAttribute("y2",l.rect[3]-l.lineCoordinates[3]),B.setAttribute("stroke-width",l.borderStyle.width||1),B.setAttribute("stroke","transparent"),B.setAttribute("fill","transparent"),O.append(B),this.container.append(O),!l.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return this.#e}addHighlightArea(){this.container.classList.add("highlightArea")}}class Ne extends i{#e=null;constructor(l){super(l,{isRenderable:!0,ignoreBorder:!0})}render(){this.container.classList.add("squareAnnotation");const l=this.data,{width:S,height:R}=g(l.rect),O=this.svgFactory.create(S,R,!0),B=l.borderStyle.width,Z=this.#e=this.svgFactory.createElement("svg:rect");return Z.setAttribute("x",B/2),Z.setAttribute("y",B/2),Z.setAttribute("width",S-B),Z.setAttribute("height",R-B),Z.setAttribute("stroke-width",B||1),Z.setAttribute("stroke","transparent"),Z.setAttribute("fill","transparent"),O.append(Z),this.container.append(O),!l.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return this.#e}addHighlightArea(){this.container.classList.add("highlightArea")}}class ke extends i{#e=null;constructor(l){super(l,{isRenderable:!0,ignoreBorder:!0})}render(){this.container.classList.add("circleAnnotation");const l=this.data,{width:S,height:R}=g(l.rect),O=this.svgFactory.create(S,R,!0),B=l.borderStyle.width,Z=this.#e=this.svgFactory.createElement("svg:ellipse");return Z.setAttribute("cx",S/2),Z.setAttribute("cy",R/2),Z.setAttribute("rx",S/2-B/2),Z.setAttribute("ry",R/2-B/2),Z.setAttribute("stroke-width",B||1),Z.setAttribute("stroke","transparent"),Z.setAttribute("fill","transparent"),O.append(Z),this.container.append(O),!l.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return this.#e}addHighlightArea(){this.container.classList.add("highlightArea")}}class Oe extends i{#e=null;constructor(l){super(l,{isRenderable:!0,ignoreBorder:!0}),this.containerClassName="polylineAnnotation",this.svgElementName="svg:polyline"}render(){this.container.classList.add(this.containerClassName);const l=this.data,{width:S,height:R}=g(l.rect),O=this.svgFactory.create(S,R,!0);let B=[];for(const re of l.vertices){const me=re.x-l.rect[0],We=l.rect[3]-re.y;B.push(me+","+We)}B=B.join(" ");const Z=this.#e=this.svgFactory.createElement(this.svgElementName);return Z.setAttribute("points",B),Z.setAttribute("stroke-width",l.borderStyle.width||1),Z.setAttribute("stroke","transparent"),Z.setAttribute("fill","transparent"),O.append(Z),this.container.append(O),!l.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return this.#e}addHighlightArea(){this.container.classList.add("highlightArea")}}class Ve extends Oe{constructor(l){super(l),this.containerClassName="polygonAnnotation",this.svgElementName="svg:polygon"}}class Ee extends i{constructor(l){super(l,{isRenderable:!0,ignoreBorder:!0})}render(){return this.container.classList.add("caretAnnotation"),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container}}class G extends i{#e=[];constructor(l){super(l,{isRenderable:!0,ignoreBorder:!0}),this.containerClassName="inkAnnotation",this.svgElementName="svg:polyline",this.annotationEditorType=p.AnnotationEditorType.INK}render(){this.container.classList.add(this.containerClassName);const l=this.data,{width:S,height:R}=g(l.rect),O=this.svgFactory.create(S,R,!0);for(const B of l.inkLists){let Z=[];for(const me of B){const We=me.x-l.rect[0],ve=l.rect[3]-me.y;Z.push(`${We},${ve}`)}Z=Z.join(" ");const re=this.svgFactory.createElement(this.svgElementName);this.#e.push(re),re.setAttribute("points",Z),re.setAttribute("stroke-width",l.borderStyle.width||1),re.setAttribute("stroke","transparent"),re.setAttribute("fill","transparent"),!l.popupRef&&this.hasPopupData&&this._createPopup(),O.append(re)}return this.container.append(O),this.container}getElementsToTriggerPopup(){return this.#e}addHighlightArea(){this.container.classList.add("highlightArea")}}c.InkAnnotationElement=G;class A extends i{constructor(l){super(l,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("highlightAnnotation"),this.container}}class m extends i{constructor(l){super(l,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("underlineAnnotation"),this.container}}class v extends i{constructor(l){super(l,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("squigglyAnnotation"),this.container}}class C extends i{constructor(l){super(l,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("strikeoutAnnotation"),this.container}}class V extends i{constructor(l){super(l,{isRenderable:!0,ignoreBorder:!0})}render(){return this.container.classList.add("stampAnnotation"),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container}}c.StampAnnotationElement=V;class W extends i{#e=null;constructor(l){super(l,{isRenderable:!0});const{filename:S,content:R}=this.data.file;this.filename=(0,e.getFilenameFromUrl)(S,!0),this.content=R,this.linkService.eventBus?.dispatch("fileattachmentannotation",{source:this,filename:S,content:R})}render(){this.container.classList.add("fileAttachmentAnnotation");const{container:l,data:S}=this;let R;S.hasAppearance||S.fillAlpha===0?R=document.createElement("div"):(R=document.createElement("img"),R.src=`${this.imageResourcesPath}annotation-${/paperclip/i.test(S.name)?"paperclip":"pushpin"}.svg`,S.fillAlpha&&S.fillAlpha<1&&(R.style=`filter: opacity(${Math.round(S.fillAlpha*100)}%);`)),R.addEventListener("dblclick",this.#t.bind(this)),this.#e=R;const{isMac:O}=p.FeatureTest.platform;return l.addEventListener("keydown",B=>{B.key==="Enter"&&(O?B.metaKey:B.ctrlKey)&&this.#t()}),!S.popupRef&&this.hasPopupData?this._createPopup():R.classList.add("popupTriggerArea"),l.append(R),l}getElementsToTriggerPopup(){return this.#e}addHighlightArea(){this.container.classList.add("highlightArea")}#t(){this.downloadManager?.openOrDownloadData(this.container,this.content,this.filename)}}class K{#e=null;#t=null;#n=new Map;constructor({div:l,accessibilityManager:S,annotationCanvasMap:R,l10n:O,page:B,viewport:Z}){this.div=l,this.#e=S,this.#t=R,this.l10n=O,this.page=B,this.viewport=Z,this.zIndex=0,this.l10n||=ee.NullL10n}#r(l,S){const R=l.firstChild||l;R.id=`${p.AnnotationPrefix}${S}`,this.div.append(l),this.#e?.moveElementInDOM(this.div,l,R,!1)}async render(l){const{annotations:S}=l,R=this.div;(0,e.setLayerDimensions)(R,this.viewport);const O=new Map,B={data:null,layer:R,linkService:l.linkService,downloadManager:l.downloadManager,imageResourcesPath:l.imageResourcesPath||"",renderForms:l.renderForms!==!1,svgFactory:new e.DOMSVGFactory,annotationStorage:l.annotationStorage||new s.AnnotationStorage,enableScripting:l.enableScripting===!0,hasJSActions:l.hasJSActions,fieldObjects:l.fieldObjects,parent:this,elements:null};for(const Z of S){if(Z.noHTML)continue;const re=Z.annotationType===p.AnnotationType.POPUP;if(re){const ve=O.get(Z.id);if(!ve)continue;B.elements=ve}else{const{width:ve,height:ye}=g(Z.rect);if(ve<=0||ye<=0)continue}B.data=Z;const me=d.create(B);if(!me.isRenderable)continue;if(!re&&Z.popupRef){const ve=O.get(Z.popupRef);ve?ve.push(me):O.set(Z.popupRef,[me])}me.annotationEditorType>0&&this.#n.set(me.data.id,me);const We=me.render();Z.hidden&&(We.style.visibility="hidden"),this.#r(We,Z.id)}this.#o(),await this.l10n.translate(R)}update({viewport:l}){const S=this.div;this.viewport=l,(0,e.setLayerDimensions)(S,{rotation:l.rotation}),this.#o(),S.hidden=!1}#o(){if(!this.#t)return;const l=this.div;for(const[S,R]of this.#t){const O=l.querySelector(`[data-annotation-id="${S}"]`);if(!O)continue;const{firstChild:B}=O;B?B.nodeName==="CANVAS"?B.replaceWith(R):B.before(R):O.append(R)}this.#t.clear()}getEditableAnnotations(){return Array.from(this.#n.values())}getEditableAnnotation(l){return this.#n.get(l)}}c.AnnotationLayer=K}),((r,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.ColorConverters=void 0;function q(s){return Math.floor(Math.max(0,Math.min(1,s))*255).toString(16).padStart(2,"0")}function p(s){return Math.max(0,Math.min(255,255*s))}class e{static CMYK_G([N,ee,U,o]){return["G",1-Math.min(1,.3*N+.59*U+.11*ee+o)]}static G_CMYK([N]){return["CMYK",0,0,0,1-N]}static G_RGB([N]){return["RGB",N,N,N]}static G_rgb([N]){return N=p(N),[N,N,N]}static G_HTML([N]){const ee=q(N);return`#${ee}${ee}${ee}`}static RGB_G([N,ee,U]){return["G",.3*N+.59*ee+.11*U]}static RGB_rgb(N){return N.map(p)}static RGB_HTML(N){return`#${N.map(q).join("")}`}static T_HTML(){return"#00000000"}static T_rgb(){return[null]}static CMYK_RGB([N,ee,U,o]){return["RGB",1-Math.min(1,N+o),1-Math.min(1,U+o),1-Math.min(1,ee+o)]}static CMYK_rgb([N,ee,U,o]){return[p(1-Math.min(1,N+o)),p(1-Math.min(1,U+o)),p(1-Math.min(1,ee+o))]}static CMYK_HTML(N){const ee=this.CMYK_RGB(N).slice(1);return this.RGB_HTML(ee)}static RGB_CMYK([N,ee,U]){const o=1-N,t=1-ee,a=1-U,g=Math.min(o,t,a);return["CMYK",o,t,a,g]}}c.ColorConverters=e}),((r,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.NullL10n=void 0,c.getL10nFallback=p;const q={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.",annotation_date_string:"{{date}}, {{time}}",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",editor_alt_text_button_label:"Alt text",editor_alt_text_edit_button_label:"Edit alt text",editor_alt_text_decorative_tooltip:"Marked as decorative"};q.print_progress_percent="{{progress}}%";function p(N,ee){switch(N){case"find_match_count":N=`find_match_count[${ee.total===1?"one":"other"}]`;break;case"find_match_count_limit":N=`find_match_count_limit[${ee.limit===1?"one":"other"}]`;break}return q[N]||""}function e(N,ee){return ee?N.replaceAll(/\{\{\s*(\w+)\s*\}\}/g,(U,o)=>o in ee?ee[o]:"{{"+o+"}}"):N}const s={async getLanguage(){return"en-us"},async getDirection(){return"ltr"},async get(N,ee=null,U=p(N,ee)){return e(U,ee)},async translate(N){}};c.NullL10n=s}),((r,c,q)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.XfaLayer=void 0;var p=q(25);class e{static setupStorage(N,ee,U,o,t){const a=o.getValue(ee,{value:null});switch(U.name){case"textarea":if(a.value!==null&&(N.textContent=a.value),t==="print")break;N.addEventListener("input",g=>{o.setValue(ee,{value:g.target.value})});break;case"input":if(U.attributes.type==="radio"||U.attributes.type==="checkbox"){if(a.value===U.attributes.xfaOn?N.setAttribute("checked",!0):a.value===U.attributes.xfaOff&&N.removeAttribute("checked"),t==="print")break;N.addEventListener("change",g=>{o.setValue(ee,{value:g.target.checked?g.target.getAttribute("xfaOn"):g.target.getAttribute("xfaOff")})})}else{if(a.value!==null&&N.setAttribute("value",a.value),t==="print")break;N.addEventListener("input",g=>{o.setValue(ee,{value:g.target.value})})}break;case"select":if(a.value!==null){N.setAttribute("value",a.value);for(const g of U.children)g.attributes.value===a.value?g.attributes.selected=!0:g.attributes.hasOwnProperty("selected")&&delete g.attributes.selected}N.addEventListener("input",g=>{const d=g.target.options,i=d.selectedIndex===-1?"":d[d.selectedIndex].value;o.setValue(ee,{value:i})});break}}static setAttributes({html:N,element:ee,storage:U=null,intent:o,linkService:t}){const{attributes:a}=ee,g=N instanceof HTMLAnchorElement;a.type==="radio"&&(a.name=`${a.name}-${o}`);for(const[d,i]of Object.entries(a))if(i!=null)switch(d){case"class":i.length&&N.setAttribute(d,i.join(" "));break;case"dataId":break;case"id":N.setAttribute("data-element-id",i);break;case"style":Object.assign(N.style,i);break;case"textContent":N.textContent=i;break;default:(!g||d!=="href"&&d!=="newWindow")&&N.setAttribute(d,i)}g&&t.addLinkAttributes(N,a.href,a.newWindow),U&&a.dataId&&this.setupStorage(N,a.dataId,ee,U)}static render(N){const ee=N.annotationStorage,U=N.linkService,o=N.xfaHtml,t=N.intent||"display",a=document.createElement(o.name);o.attributes&&this.setAttributes({html:a,element:o,intent:t,linkService:U});const g=[[o,-1,a]],d=N.div;if(d.append(a),N.viewport){const b=`matrix(${N.viewport.transform.join(",")})`;d.style.transform=b}t!=="richText"&&d.setAttribute("class","xfaLayer xfaFont");const i=[];for(;g.length>0;){const[b,y,f]=g.at(-1);if(y+1===b.children.length){g.pop();continue}const T=b.children[++g.at(-1)[1]];if(T===null)continue;const{name:H}=T;if(H==="#text"){const _=document.createTextNode(T.value);i.push(_),f.append(_);continue}const I=T?.attributes?.xmlns?document.createElementNS(T.attributes.xmlns,H):document.createElement(H);if(f.append(I),T.attributes&&this.setAttributes({html:I,element:T,storage:ee,intent:t,linkService:U}),T.children&&T.children.length>0)g.push([T,-1,I]);else if(T.value){const _=document.createTextNode(T.value);p.XfaText.shouldBuildText(H)&&i.push(_),I.append(_)}}for(const b of d.querySelectorAll(".xfaNonInteractive input, .xfaNonInteractive textarea"))b.setAttribute("readOnly",!0);return{textDivs:i}}static update(N){const ee=`matrix(${N.viewport.transform.join(",")})`;N.div.style.transform=ee,N.div.hidden=!1}}c.XfaLayer=e}),((r,c,q)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.InkEditor=void 0;var p=q(1),e=q(4),s=q(29),N=q(6),ee=q(5);class U extends e.AnnotationEditor{#e=0;#t=0;#n=this.canvasPointermove.bind(this);#r=this.canvasPointerleave.bind(this);#o=this.canvasPointerup.bind(this);#s=this.canvasPointerdown.bind(this);#a=new Path2D;#l=!1;#c=!1;#i=!1;#f=null;#d=0;#h=0;#p=null;static _defaultColor=null;static _defaultOpacity=1;static _defaultThickness=1;static _type="ink";constructor(t){super({...t,name:"inkEditor"}),this.color=t.color||null,this.thickness=t.thickness||null,this.opacity=t.opacity||null,this.paths=[],this.bezierPath2D=[],this.allRawPaths=[],this.currentPath=[],this.scaleFactor=1,this.translationX=this.translationY=0,this.x=0,this.y=0,this._willKeepAspectRatio=!0}static initialize(t){e.AnnotationEditor.initialize(t,{strings:["editor_ink_canvas_aria_label","editor_ink2_aria_label"]})}static updateDefaultParams(t,a){switch(t){case p.AnnotationEditorParamsType.INK_THICKNESS:U._defaultThickness=a;break;case p.AnnotationEditorParamsType.INK_COLOR:U._defaultColor=a;break;case p.AnnotationEditorParamsType.INK_OPACITY:U._defaultOpacity=a/100;break}}updateParams(t,a){switch(t){case p.AnnotationEditorParamsType.INK_THICKNESS:this.#v(a);break;case p.AnnotationEditorParamsType.INK_COLOR:this.#m(a);break;case p.AnnotationEditorParamsType.INK_OPACITY:this.#g(a);break}}static get defaultPropertiesToUpdate(){return[[p.AnnotationEditorParamsType.INK_THICKNESS,U._defaultThickness],[p.AnnotationEditorParamsType.INK_COLOR,U._defaultColor||e.AnnotationEditor._defaultLineColor],[p.AnnotationEditorParamsType.INK_OPACITY,Math.round(U._defaultOpacity*100)]]}get propertiesToUpdate(){return[[p.AnnotationEditorParamsType.INK_THICKNESS,this.thickness||U._defaultThickness],[p.AnnotationEditorParamsType.INK_COLOR,this.color||U._defaultColor||e.AnnotationEditor._defaultLineColor],[p.AnnotationEditorParamsType.INK_OPACITY,Math.round(100*(this.opacity??U._defaultOpacity))]]}#v(t){const a=this.thickness;this.addCommands({cmd:()=>{this.thickness=t,this.#P()},undo:()=>{this.thickness=a,this.#P()},mustExec:!0,type:p.AnnotationEditorParamsType.INK_THICKNESS,overwriteIfSameType:!0,keepUndo:!0})}#m(t){const a=this.color;this.addCommands({cmd:()=>{this.color=t,this.#_()},undo:()=>{this.color=a,this.#_()},mustExec:!0,type:p.AnnotationEditorParamsType.INK_COLOR,overwriteIfSameType:!0,keepUndo:!0})}#g(t){t/=100;const a=this.opacity;this.addCommands({cmd:()=>{this.opacity=t,this.#_()},undo:()=>{this.opacity=a,this.#_()},mustExec:!0,type:p.AnnotationEditorParamsType.INK_OPACITY,overwriteIfSameType:!0,keepUndo:!0})}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(this.canvas||(this.#k(),this.#M()),this.isAttachedToDOM||(this.parent.add(this),this.#y()),this.#P()))}remove(){this.canvas!==null&&(this.isEmpty()||this.commit(),this.canvas.width=this.canvas.height=0,this.canvas.remove(),this.canvas=null,this.#f.disconnect(),this.#f=null,super.remove())}setParent(t){!this.parent&&t?this._uiManager.removeShouldRescale(this):this.parent&&t===null&&this._uiManager.addShouldRescale(this),super.setParent(t)}onScaleChanging(){const[t,a]=this.parentDimensions,g=this.width*t,d=this.height*a;this.setDimensions(g,d)}enableEditMode(){this.#l||this.canvas===null||(super.enableEditMode(),this._isDraggable=!1,this.canvas.addEventListener("pointerdown",this.#s))}disableEditMode(){!this.isInEditMode()||this.canvas===null||(super.disableEditMode(),this._isDraggable=!this.isEmpty(),this.div.classList.remove("editing"),this.canvas.removeEventListener("pointerdown",this.#s))}onceAdded(){this._isDraggable=!this.isEmpty()}isEmpty(){return this.paths.length===0||this.paths.length===1&&this.paths[0].length===0}#u(){const{parentRotation:t,parentDimensions:[a,g]}=this;switch(t){case 90:return[0,g,g,a];case 180:return[a,g,a,g];case 270:return[a,0,g,a];default:return[0,0,a,g]}}#b(){const{ctx:t,color:a,opacity:g,thickness:d,parentScale:i,scaleFactor:b}=this;t.lineWidth=d*i/b,t.lineCap="round",t.lineJoin="round",t.miterLimit=10,t.strokeStyle=`${a}${(0,ee.opacityToHex)(g)}`}#E(t,a){this.canvas.addEventListener("contextmenu",N.noContextMenu),this.canvas.addEventListener("pointerleave",this.#r),this.canvas.addEventListener("pointermove",this.#n),this.canvas.addEventListener("pointerup",this.#o),this.canvas.removeEventListener("pointerdown",this.#s),this.isEditing=!0,this.#i||(this.#i=!0,this.#y(),this.thickness||=U._defaultThickness,this.color||=U._defaultColor||e.AnnotationEditor._defaultLineColor,this.opacity??=U._defaultOpacity),this.currentPath.push([t,a]),this.#c=!1,this.#b(),this.#p=()=>{this.#O(),this.#p&&window.requestAnimationFrame(this.#p)},window.requestAnimationFrame(this.#p)}#w(t,a){const[g,d]=this.currentPath.at(-1);if(this.currentPath.length>1&&t===g&&a===d)return;const i=this.currentPath;let b=this.#a;if(i.push([t,a]),this.#c=!0,i.length<=2){b.moveTo(...i[0]),b.lineTo(t,a);return}i.length===3&&(this.#a=b=new Path2D,b.moveTo(...i[0])),this.#D(b,...i.at(-3),...i.at(-2),t,a)}#C(){if(this.currentPath.length===0)return;const t=this.currentPath.at(-1);this.#a.lineTo(...t)}#T(t,a){this.#p=null,t=Math.min(Math.max(t,0),this.canvas.width),a=Math.min(Math.max(a,0),this.canvas.height),this.#w(t,a),this.#C();let g;if(this.currentPath.length!==1)g=this.#I();else{const f=[t,a];g=[[f,f.slice(),f.slice(),f]]}const d=this.#a,i=this.currentPath;this.currentPath=[],this.#a=new Path2D;const b=()=>{this.allRawPaths.push(i),this.paths.push(g),this.bezierPath2D.push(d),this.rebuild()},y=()=>{this.allRawPaths.pop(),this.paths.pop(),this.bezierPath2D.pop(),this.paths.length===0?this.remove():(this.canvas||(this.#k(),this.#M()),this.#P())};this.addCommands({cmd:b,undo:y,mustExec:!0})}#O(){if(!this.#c)return;this.#c=!1;const t=Math.ceil(this.thickness*this.parentScale),a=this.currentPath.slice(-3),g=a.map(b=>b[0]),d=a.map(b=>b[1]);Math.min(...g)-t,Math.max(...g)+t,Math.min(...d)-t,Math.max(...d)+t;const{ctx:i}=this;i.save(),i.clearRect(0,0,this.canvas.width,this.canvas.height);for(const b of this.bezierPath2D)i.stroke(b);i.stroke(this.#a),i.restore()}#D(t,a,g,d,i,b,y){const f=(a+d)/2,T=(g+i)/2,H=(d+b)/2,I=(i+y)/2;t.bezierCurveTo(f+2*(d-f)/3,T+2*(i-T)/3,H+2*(d-H)/3,I+2*(i-I)/3,H,I)}#I(){const t=this.currentPath;if(t.length<=2)return[[t[0],t[0],t.at(-1),t.at(-1)]];const a=[];let g,[d,i]=t[0];for(g=1;g<t.length-2;g++){const[_,M]=t[g],[te,ie]=t[g+1],Y=(_+te)/2,he=(M+ie)/2,ge=[d+2*(_-d)/3,i+2*(M-i)/3],Ne=[Y+2*(_-Y)/3,he+2*(M-he)/3];a.push([[d,i],ge,Ne,[Y,he]]),[d,i]=[Y,he]}const[b,y]=t[g],[f,T]=t[g+1],H=[d+2*(b-d)/3,i+2*(y-i)/3],I=[f+2*(b-f)/3,T+2*(y-T)/3];return a.push([[d,i],H,I,[f,T]]),a}#_(){if(this.isEmpty()){this.#A();return}this.#b();const{canvas:t,ctx:a}=this;a.setTransform(1,0,0,1,0,0),a.clearRect(0,0,t.width,t.height),this.#A();for(const g of this.bezierPath2D)a.stroke(g)}commit(){this.#l||(super.commit(),this.isEditing=!1,this.disableEditMode(),this.setInForeground(),this.#l=!0,this.div.classList.add("disabled"),this.#P(!0),this.makeResizable(),this.parent.addInkEditorIfNeeded(!0),this.moveInDOM(),this.div.focus({preventScroll:!0}))}focusin(t){this._focusEventsAllowed&&(super.focusin(t),this.enableEditMode())}canvasPointerdown(t){t.button!==0||!this.isInEditMode()||this.#l||(this.setInForeground(),t.preventDefault(),t.type!=="mouse"&&this.div.focus(),this.#E(t.offsetX,t.offsetY))}canvasPointermove(t){t.preventDefault(),this.#w(t.offsetX,t.offsetY)}canvasPointerup(t){t.preventDefault(),this.#L(t)}canvasPointerleave(t){this.#L(t)}#L(t){this.canvas.removeEventListener("pointerleave",this.#r),this.canvas.removeEventListener("pointermove",this.#n),this.canvas.removeEventListener("pointerup",this.#o),this.canvas.addEventListener("pointerdown",this.#s),setTimeout(()=>{this.canvas.removeEventListener("contextmenu",N.noContextMenu)},10),this.#T(t.offsetX,t.offsetY),this.addToAnnotationStorage(),this.setInBackground()}#k(){this.canvas=document.createElement("canvas"),this.canvas.width=this.canvas.height=0,this.canvas.className="inkEditorCanvas",e.AnnotationEditor._l10nPromise.get("editor_ink_canvas_aria_label").then(t=>this.canvas?.setAttribute("aria-label",t)),this.div.append(this.canvas),this.ctx=this.canvas.getContext("2d")}#M(){this.#f=new ResizeObserver(t=>{const a=t[0].contentRect;a.width&&a.height&&this.setDimensions(a.width,a.height)}),this.#f.observe(this.div)}get isResizable(){return!this.isEmpty()&&this.#l}render(){if(this.div)return this.div;let t,a;this.width&&(t=this.x,a=this.y),super.render(),e.AnnotationEditor._l10nPromise.get("editor_ink2_aria_label").then(y=>this.div?.setAttribute("aria-label",y));const[g,d,i,b]=this.#u();if(this.setAt(g,d,0,0),this.setDims(i,b),this.#k(),this.width){const[y,f]=this.parentDimensions;this.setAspectRatio(this.width*y,this.height*f),this.setAt(t*y,a*f,this.width*y,this.height*f),this.#i=!0,this.#y(),this.setDims(this.width*y,this.height*f),this.#_(),this.div.classList.add("disabled")}else this.div.classList.add("editing"),this.enableEditMode();return this.#M(),this.div}#y(){if(!this.#i)return;const[t,a]=this.parentDimensions;this.canvas.width=Math.ceil(this.width*t),this.canvas.height=Math.ceil(this.height*a),this.#A()}setDimensions(t,a){const g=Math.round(t),d=Math.round(a);if(this.#d===g&&this.#h===d)return;this.#d=g,this.#h=d,this.canvas.style.visibility="hidden";const[i,b]=this.parentDimensions;this.width=t/i,this.height=a/b,this.fixAndSetPosition(),this.#l&&this.#R(t,a),this.#y(),this.#_(),this.canvas.style.visibility="visible",this.fixDims()}#R(t,a){const g=this.#F(),d=(t-g)/this.#t,i=(a-g)/this.#e;this.scaleFactor=Math.min(d,i)}#A(){const t=this.#F()/2;this.ctx.setTransform(this.scaleFactor,0,0,this.scaleFactor,this.translationX*this.scaleFactor+t,this.translationY*this.scaleFactor+t)}static#N(t){const a=new Path2D;for(let g=0,d=t.length;g<d;g++){const[i,b,y,f]=t[g];g===0&&a.moveTo(...i),a.bezierCurveTo(b[0],b[1],y[0],y[1],f[0],f[1])}return a}static#B(t,a,g){const[d,i,b,y]=a;switch(g){case 0:for(let f=0,T=t.length;f<T;f+=2)t[f]+=d,t[f+1]=y-t[f+1];break;case 90:for(let f=0,T=t.length;f<T;f+=2){const H=t[f];t[f]=t[f+1]+d,t[f+1]=H+i}break;case 180:for(let f=0,T=t.length;f<T;f+=2)t[f]=b-t[f],t[f+1]+=i;break;case 270:for(let f=0,T=t.length;f<T;f+=2){const H=t[f];t[f]=b-t[f+1],t[f+1]=y-H}break;default:throw new Error("Invalid rotation")}return t}static#H(t,a,g){const[d,i,b,y]=a;switch(g){case 0:for(let f=0,T=t.length;f<T;f+=2)t[f]-=d,t[f+1]=y-t[f+1];break;case 90:for(let f=0,T=t.length;f<T;f+=2){const H=t[f];t[f]=t[f+1]-i,t[f+1]=H-d}break;case 180:for(let f=0,T=t.length;f<T;f+=2)t[f]=b-t[f],t[f+1]-=i;break;case 270:for(let f=0,T=t.length;f<T;f+=2){const H=t[f];t[f]=y-t[f+1],t[f+1]=b-H}break;default:throw new Error("Invalid rotation")}return t}#V(t,a,g,d){const i=[],b=this.thickness/2,y=t*a+b,f=t*g+b;for(const T of this.paths){const H=[],I=[];for(let _=0,M=T.length;_<M;_++){const[te,ie,Y,he]=T[_],ge=t*te[0]+y,Ne=t*te[1]+f,ke=t*ie[0]+y,Oe=t*ie[1]+f,Ve=t*Y[0]+y,Ee=t*Y[1]+f,G=t*he[0]+y,A=t*he[1]+f;_===0&&(H.push(ge,Ne),I.push(ge,Ne)),H.push(ke,Oe,Ve,Ee,G,A),I.push(ke,Oe),_===M-1&&I.push(G,A)}i.push({bezier:U.#B(H,d,this.rotation),points:U.#B(I,d,this.rotation)})}return i}#x(){let t=1/0,a=-1/0,g=1/0,d=-1/0;for(const i of this.paths)for(const[b,y,f,T]of i){const H=p.Util.bezierBoundingBox(...b,...y,...f,...T);t=Math.min(t,H[0]),g=Math.min(g,H[1]),a=Math.max(a,H[2]),d=Math.max(d,H[3])}return[t,g,a,d]}#F(){return this.#l?Math.ceil(this.thickness*this.parentScale):0}#P(t=!1){if(this.isEmpty())return;if(!this.#l){this.#_();return}const a=this.#x(),g=this.#F();this.#t=Math.max(e.AnnotationEditor.MIN_SIZE,a[2]-a[0]),this.#e=Math.max(e.AnnotationEditor.MIN_SIZE,a[3]-a[1]);const d=Math.ceil(g+this.#t*this.scaleFactor),i=Math.ceil(g+this.#e*this.scaleFactor),[b,y]=this.parentDimensions;this.width=d/b,this.height=i/y,this.setAspectRatio(d,i);const f=this.translationX,T=this.translationY;this.translationX=-a[0],this.translationY=-a[1],this.#y(),this.#_(),this.#d=d,this.#h=i,this.setDims(d,i);const H=t?g/this.scaleFactor/2:0;this.translate(f-this.translationX-H,T-this.translationY-H)}static deserialize(t,a,g){if(t instanceof s.InkAnnotationElement)return null;const d=super.deserialize(t,a,g);d.thickness=t.thickness,d.color=p.Util.makeHexColor(...t.color),d.opacity=t.opacity;const[i,b]=d.pageDimensions,y=d.width*i,f=d.height*b,T=d.parentScale,H=t.thickness/2;d.#l=!0,d.#d=Math.round(y),d.#h=Math.round(f);const{paths:I,rect:_,rotation:M}=t;for(let{bezier:ie}of I){ie=U.#H(ie,_,M);const Y=[];d.paths.push(Y);let he=T*(ie[0]-H),ge=T*(ie[1]-H);for(let ke=2,Oe=ie.length;ke<Oe;ke+=6){const Ve=T*(ie[ke]-H),Ee=T*(ie[ke+1]-H),G=T*(ie[ke+2]-H),A=T*(ie[ke+3]-H),m=T*(ie[ke+4]-H),v=T*(ie[ke+5]-H);Y.push([[he,ge],[Ve,Ee],[G,A],[m,v]]),he=m,ge=v}const Ne=this.#N(Y);d.bezierPath2D.push(Ne)}const te=d.#x();return d.#t=Math.max(e.AnnotationEditor.MIN_SIZE,te[2]-te[0]),d.#e=Math.max(e.AnnotationEditor.MIN_SIZE,te[3]-te[1]),d.#R(y,f),d}serialize(){if(this.isEmpty())return null;const t=this.getRect(0,0),a=e.AnnotationEditor._colorManager.convert(this.ctx.strokeStyle);return{annotationType:p.AnnotationEditorType.INK,color:a,thickness:this.thickness,opacity:this.opacity,paths:this.#V(this.scaleFactor/this.parentScale,this.translationX,this.translationY,t),pageIndex:this.pageIndex,rect:t,rotation:this.rotation,structTreeParentId:this._structTreeParentId}}}c.InkEditor=U}),((r,c,q)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.StampEditor=void 0;var p=q(1),e=q(4),s=q(6),N=q(29);class ee extends e.AnnotationEditor{#e=null;#t=null;#n=null;#r=null;#o=null;#s=null;#a=null;#l=null;#c=!1;#i=!1;static _type="stamp";constructor(o){super({...o,name:"stampEditor"}),this.#r=o.bitmapUrl,this.#o=o.bitmapFile}static initialize(o){e.AnnotationEditor.initialize(o)}static get supportedTypes(){const o=["apng","avif","bmp","gif","jpeg","png","svg+xml","webp","x-icon"];return(0,p.shadow)(this,"supportedTypes",o.map(t=>`image/${t}`))}static get supportedTypesStr(){return(0,p.shadow)(this,"supportedTypesStr",this.supportedTypes.join(","))}static isHandlingMimeForPasting(o){return this.supportedTypes.includes(o)}static paste(o,t){t.pasteEditor(p.AnnotationEditorType.STAMP,{bitmapFile:o.getAsFile()})}#f(o,t=!1){if(!o){this.remove();return}this.#e=o.bitmap,t||(this.#t=o.id,this.#c=o.isSvg),this.#p()}#d(){this.#n=null,this._uiManager.enableWaiting(!1),this.#s&&this.div.focus()}#h(){if(this.#t){this._uiManager.enableWaiting(!0),this._uiManager.imageManager.getFromId(this.#t).then(t=>this.#f(t,!0)).finally(()=>this.#d());return}if(this.#r){const t=this.#r;this.#r=null,this._uiManager.enableWaiting(!0),this.#n=this._uiManager.imageManager.getFromUrl(t).then(a=>this.#f(a)).finally(()=>this.#d());return}if(this.#o){const t=this.#o;this.#o=null,this._uiManager.enableWaiting(!0),this.#n=this._uiManager.imageManager.getFromFile(t).then(a=>this.#f(a)).finally(()=>this.#d());return}const o=document.createElement("input");o.type="file",o.accept=ee.supportedTypesStr,this.#n=new Promise(t=>{o.addEventListener("change",async()=>{if(!o.files||o.files.length===0)this.remove();else{this._uiManager.enableWaiting(!0);const a=await this._uiManager.imageManager.getFromFile(o.files[0]);this.#f(a)}t()}),o.addEventListener("cancel",()=>{this.remove(),t()})}).finally(()=>this.#d()),o.click()}remove(){this.#t&&(this.#e=null,this._uiManager.imageManager.deleteId(this.#t),this.#s?.remove(),this.#s=null,this.#a?.disconnect(),this.#a=null),super.remove()}rebuild(){if(!this.parent){this.#t&&this.#h();return}super.rebuild(),this.div!==null&&(this.#t&&this.#h(),this.isAttachedToDOM||this.parent.add(this))}onceAdded(){this._isDraggable=!0,this.div.focus()}isEmpty(){return!(this.#n||this.#e||this.#r||this.#o)}get isResizable(){return!0}render(){if(this.div)return this.div;let o,t;if(this.width&&(o=this.x,t=this.y),super.render(),this.div.hidden=!0,this.#e?this.#p():this.#h(),this.width){const[a,g]=this.parentDimensions;this.setAt(o*a,t*g,this.width*a,this.height*g)}return this.div}#p(){const{div:o}=this;let{width:t,height:a}=this.#e;const[g,d]=this.pageDimensions,i=.75;if(this.width)t=this.width*g,a=this.height*d;else if(t>i*g||a>i*d){const T=Math.min(i*g/t,i*d/a);t*=T,a*=T}const[b,y]=this.parentDimensions;this.setDims(t*b/g,a*y/d),this._uiManager.enableWaiting(!1);const f=this.#s=document.createElement("canvas");o.append(f),o.hidden=!1,this.#g(t,a),this.#b(),this.#i||(this.parent.addUndoableEditor(this),this.#i=!0),this._uiManager._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",subtype:this.editorType,data:{action:"inserted_image"}}}),this.addAltTextButton()}#v(o,t){const[a,g]=this.parentDimensions;this.width=o/a,this.height=t/g,this.setDims(o,t),this._initialOptions?.isCentered?this.center():this.fixAndSetPosition(),this._initialOptions=null,this.#l!==null&&clearTimeout(this.#l);const d=200;this.#l=setTimeout(()=>{this.#l=null,this.#g(o,t)},d)}#m(o,t){const{width:a,height:g}=this.#e;let d=a,i=g,b=this.#e;for(;d>2*o||i>2*t;){const y=d,f=i;d>2*o&&(d=d>=16384?Math.floor(d/2)-1:Math.ceil(d/2)),i>2*t&&(i=i>=16384?Math.floor(i/2)-1:Math.ceil(i/2));const T=new OffscreenCanvas(d,i);T.getContext("2d").drawImage(b,0,0,y,f,0,0,d,i),b=T.transferToImageBitmap()}return b}#g(o,t){o=Math.ceil(o),t=Math.ceil(t);const a=this.#s;if(!a||a.width===o&&a.height===t)return;a.width=o,a.height=t;const g=this.#c?this.#e:this.#m(o,t),d=a.getContext("2d");d.filter=this._uiManager.hcmFilter,d.drawImage(g,0,0,g.width,g.height,0,0,o,t)}#u(o){if(o){if(this.#c){const g=this._uiManager.imageManager.getSvgUrl(this.#t);if(g)return g}const t=document.createElement("canvas");return{width:t.width,height:t.height}=this.#e,t.getContext("2d").drawImage(this.#e,0,0),t.toDataURL()}if(this.#c){const[t,a]=this.pageDimensions,g=Math.round(this.width*t*s.PixelsPerInch.PDF_TO_CSS_UNITS),d=Math.round(this.height*a*s.PixelsPerInch.PDF_TO_CSS_UNITS),i=new OffscreenCanvas(g,d);return i.getContext("2d").drawImage(this.#e,0,0,this.#e.width,this.#e.height,0,0,g,d),i.transferToImageBitmap()}return structuredClone(this.#e)}#b(){this.#a=new ResizeObserver(o=>{const t=o[0].contentRect;t.width&&t.height&&this.#v(t.width,t.height)}),this.#a.observe(this.div)}static deserialize(o,t,a){if(o instanceof N.StampAnnotationElement)return null;const g=super.deserialize(o,t,a),{rect:d,bitmapUrl:i,bitmapId:b,isSvg:y,accessibilityData:f}=o;b&&a.imageManager.isValidId(b)?g.#t=b:g.#r=i,g.#c=y;const[T,H]=g.pageDimensions;return g.width=(d[2]-d[0])/T,g.height=(d[3]-d[1])/H,f&&(g.altTextData=f),g}serialize(o=!1,t=null){if(this.isEmpty())return null;const a={annotationType:p.AnnotationEditorType.STAMP,bitmapId:this.#t,pageIndex:this.pageIndex,rect:this.getRect(0,0),rotation:this.rotation,isSvg:this.#c,structTreeParentId:this._structTreeParentId};if(o)return a.bitmapUrl=this.#u(!0),a.accessibilityData=this.altTextData,a;const{decorative:g,altText:d}=this.altTextData;if(!g&&d&&(a.accessibilityData={type:"Figure",alt:d}),t===null)return a;t.stamps||=new Map;const i=this.#c?(a.rect[2]-a.rect[0])*(a.rect[3]-a.rect[1]):null;if(!t.stamps.has(this.#t))t.stamps.set(this.#t,{area:i,serialized:a}),a.bitmap=this.#u(!1);else if(this.#c){const b=t.stamps.get(this.#t);i>b.area&&(b.area=i,b.serialized.bitmap.close(),b.serialized.bitmap=this.#u(!1))}return a}}c.StampEditor=ee})],__webpack_module_cache__={};function __w_pdfjs_require__(r){var c=__webpack_module_cache__[r];if(c!==void 0)return c.exports;var q=__webpack_module_cache__[r]={exports:{}};return __webpack_modules__[r](q,q.exports,__w_pdfjs_require__),q.exports}var __webpack_exports__={};return(()=>{var r=__webpack_exports__;Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"AbortException",{enumerable:!0,get:function(){return c.AbortException}}),Object.defineProperty(r,"AnnotationEditorLayer",{enumerable:!0,get:function(){return s.AnnotationEditorLayer}}),Object.defineProperty(r,"AnnotationEditorParamsType",{enumerable:!0,get:function(){return c.AnnotationEditorParamsType}}),Object.defineProperty(r,"AnnotationEditorType",{enumerable:!0,get:function(){return c.AnnotationEditorType}}),Object.defineProperty(r,"AnnotationEditorUIManager",{enumerable:!0,get:function(){return N.AnnotationEditorUIManager}}),Object.defineProperty(r,"AnnotationLayer",{enumerable:!0,get:function(){return ee.AnnotationLayer}}),Object.defineProperty(r,"AnnotationMode",{enumerable:!0,get:function(){return c.AnnotationMode}}),Object.defineProperty(r,"CMapCompressionType",{enumerable:!0,get:function(){return c.CMapCompressionType}}),Object.defineProperty(r,"DOMSVGFactory",{enumerable:!0,get:function(){return p.DOMSVGFactory}}),Object.defineProperty(r,"FeatureTest",{enumerable:!0,get:function(){return c.FeatureTest}}),Object.defineProperty(r,"GlobalWorkerOptions",{enumerable:!0,get:function(){return U.GlobalWorkerOptions}}),Object.defineProperty(r,"ImageKind",{enumerable:!0,get:function(){return c.ImageKind}}),Object.defineProperty(r,"InvalidPDFException",{enumerable:!0,get:function(){return c.InvalidPDFException}}),Object.defineProperty(r,"MissingPDFException",{enumerable:!0,get:function(){return c.MissingPDFException}}),Object.defineProperty(r,"OPS",{enumerable:!0,get:function(){return c.OPS}}),Object.defineProperty(r,"PDFDataRangeTransport",{enumerable:!0,get:function(){return q.PDFDataRangeTransport}}),Object.defineProperty(r,"PDFDateString",{enumerable:!0,get:function(){return p.PDFDateString}}),Object.defineProperty(r,"PDFWorker",{enumerable:!0,get:function(){return q.PDFWorker}}),Object.defineProperty(r,"PasswordResponses",{enumerable:!0,get:function(){return c.PasswordResponses}}),Object.defineProperty(r,"PermissionFlag",{enumerable:!0,get:function(){return c.PermissionFlag}}),Object.defineProperty(r,"PixelsPerInch",{enumerable:!0,get:function(){return p.PixelsPerInch}}),Object.defineProperty(r,"PromiseCapability",{enumerable:!0,get:function(){return c.PromiseCapability}}),Object.defineProperty(r,"RenderingCancelledException",{enumerable:!0,get:function(){return p.RenderingCancelledException}}),Object.defineProperty(r,"SVGGraphics",{enumerable:!0,get:function(){return q.SVGGraphics}}),Object.defineProperty(r,"UnexpectedResponseException",{enumerable:!0,get:function(){return c.UnexpectedResponseException}}),Object.defineProperty(r,"Util",{enumerable:!0,get:function(){return c.Util}}),Object.defineProperty(r,"VerbosityLevel",{enumerable:!0,get:function(){return c.VerbosityLevel}}),Object.defineProperty(r,"XfaLayer",{enumerable:!0,get:function(){return o.XfaLayer}}),Object.defineProperty(r,"build",{enumerable:!0,get:function(){return q.build}}),Object.defineProperty(r,"createValidAbsoluteUrl",{enumerable:!0,get:function(){return c.createValidAbsoluteUrl}}),Object.defineProperty(r,"getDocument",{enumerable:!0,get:function(){return q.getDocument}}),Object.defineProperty(r,"getFilenameFromUrl",{enumerable:!0,get:function(){return p.getFilenameFromUrl}}),Object.defineProperty(r,"getPdfFilenameFromUrl",{enumerable:!0,get:function(){return p.getPdfFilenameFromUrl}}),Object.defineProperty(r,"getXfaPageViewport",{enumerable:!0,get:function(){return p.getXfaPageViewport}}),Object.defineProperty(r,"isDataScheme",{enumerable:!0,get:function(){return p.isDataScheme}}),Object.defineProperty(r,"isPdfFile",{enumerable:!0,get:function(){return p.isPdfFile}}),Object.defineProperty(r,"loadScript",{enumerable:!0,get:function(){return p.loadScript}}),Object.defineProperty(r,"noContextMenu",{enumerable:!0,get:function(){return p.noContextMenu}}),Object.defineProperty(r,"normalizeUnicode",{enumerable:!0,get:function(){return c.normalizeUnicode}}),Object.defineProperty(r,"renderTextLayer",{enumerable:!0,get:function(){return e.renderTextLayer}}),Object.defineProperty(r,"setLayerDimensions",{enumerable:!0,get:function(){return p.setLayerDimensions}}),Object.defineProperty(r,"shadow",{enumerable:!0,get:function(){return c.shadow}}),Object.defineProperty(r,"updateTextLayer",{enumerable:!0,get:function(){return e.updateTextLayer}}),Object.defineProperty(r,"version",{enumerable:!0,get:function(){return q.version}});var c=__w_pdfjs_require__(1),q=__w_pdfjs_require__(2),p=__w_pdfjs_require__(6),e=__w_pdfjs_require__(26),s=__w_pdfjs_require__(27),N=__w_pdfjs_require__(5),ee=__w_pdfjs_require__(29),U=__w_pdfjs_require__(14),o=__w_pdfjs_require__(32)})(),__webpack_exports__})())})(pdf)),pdf.exports}var hasRequiredCore_min;function requireCore_min(){return hasRequiredCore_min||(hasRequiredCore_min=1,(function(r){var c=require$$1,q=requirePdf();function p(h){var w=Object.create(null);return h&&Object.keys(h).forEach((function(j){if(j!=="default"){var X=Object.getOwnPropertyDescriptor(h,j);Object.defineProperty(w,j,X.get?X:{enumerable:!0,get:function(){return h[j]}})}})),w.default=h,Object.freeze(w)}var e,s=p(c),N=p(q);r.AnnotationType=void 0,(e=r.AnnotationType||(r.AnnotationType={}))[e.Text=1]="Text",e[e.Link=2]="Link",e[e.FreeText=3]="FreeText",e[e.Line=4]="Line",e[e.Square=5]="Square",e[e.Circle=6]="Circle",e[e.Polygon=7]="Polygon",e[e.Polyline=8]="Polyline",e[e.Highlight=9]="Highlight",e[e.Underline=10]="Underline",e[e.Squiggly=11]="Squiggly",e[e.StrikeOut=12]="StrikeOut",e[e.Stamp=13]="Stamp",e[e.Caret=14]="Caret",e[e.Ink=15]="Ink",e[e.Popup=16]="Popup",e[e.FileAttachment=17]="FileAttachment";var ee=function(h,w){return ee=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(j,X){j.__proto__=X}||function(j,X){for(var Q in X)Object.prototype.hasOwnProperty.call(X,Q)&&(j[Q]=X[Q])},ee(h,w)};function U(h,w){if(typeof w!="function"&&w!==null)throw new TypeError("Class extends value "+String(w)+" is not a constructor or null");function j(){this.constructor=h}ee(h,w),h.prototype=w===null?Object.create(w):(j.prototype=w.prototype,new j)}var o,t=function(){return t=Object.assign||function(h){for(var w,j=1,X=arguments.length;j<X;j++)for(var Q in w=arguments[j])Object.prototype.hasOwnProperty.call(w,Q)&&(h[Q]=w[Q]);return h},t.apply(this,arguments)};r.TextDirection=void 0,(o=r.TextDirection||(r.TextDirection={})).RightToLeft="RTL",o.LeftToRight="LTR";var a,g=s.createContext({currentTheme:"light",direction:r.TextDirection.LeftToRight,setCurrentTheme:function(){}}),d=function(h){var w=[];return Object.keys(h).forEach((function(j){j&&h[j]&&w.push(j)})),w.join(" ")},i=typeof window<"u"?s.useLayoutEffect:s.useEffect,b=function(h){var w=s.useRef(null),j=h.once,X=h.threshold,Q=h.onVisibilityChanged;return i((function(){var ne=w.current;if(ne){var ce=new IntersectionObserver((function(ae){ae.forEach((function($){var oe=$.isIntersecting,se=$.intersectionRatio;Q({isVisible:oe,ratio:se}),oe&&j&&(ce.unobserve(ne),ce.disconnect())}))}),{threshold:X||0});return ce.observe(ne),function(){ce.unobserve(ne),ce.disconnect()}}}),[]),w},y=function(h){var w=h.children,j=h.ignoreDirection,X=j!==void 0&&j,Q=h.size,ne=Q===void 0?24:Q,ce=s.useContext(g).direction,ae=!X&&ce===r.TextDirection.RightToLeft,$="".concat(ne||24,"px");return s.createElement("svg",{"aria-hidden":"true",className:d({"rpv-core__icon":!0,"rpv-core__icon--rtl":ae}),focusable:"false",height:$,viewBox:"0 0 24 24",width:$},w)},f=function(){return s.createElement(y,{size:16},s.createElement("path",{d:"M23.5,0.499l-16.5,23l-6.5-6.5"}))},T=function(h){var w=h.children,j=h.testId,X=h.onClick,Q=s.useContext(g).direction===r.TextDirection.RightToLeft,ne=j?{"data-testid":j}:{};return s.createElement("button",t({className:d({"rpv-core__primary-button":!0,"rpv-core__primary-button--rtl":Q}),type:"button",onClick:X},ne),w)},H=function(h){var w=h.size,j=w===void 0?"4rem":w,X=h.testId,Q=s.useState(!1),ne=Q[0],ce=Q[1],ae=X?{"data-testid":X}:{},$=b({onVisibilityChanged:function(oe){ce(oe.isVisible)}});return s.createElement("div",t({},ae,{className:d({"rpv-core__spinner":!0,"rpv-core__spinner--animating":ne}),ref:$,style:{height:j,width:j}}))},I=function(h){var w=h.ariaLabel,j=w===void 0?"":w,X=h.autoFocus,Q=X!==void 0&&X,ne=h.placeholder,ce=ne===void 0?"":ne,ae=h.testId,$=h.type,oe=$===void 0?"text":$,se=h.value,Pe=se===void 0?"":se,Ae=h.onChange,Se=h.onKeyDown,Be=Se===void 0?function(){}:Se,Le=s.useContext(g).direction,Me=s.useRef(),mt=Le===r.TextDirection.RightToLeft,Qe={ref:Me,"data-testid":"","aria-label":j,className:d({"rpv-core__textbox":!0,"rpv-core__textbox--rtl":mt}),placeholder:ce,value:Pe,onChange:function(nt){return Ae(nt.target.value)},onKeyDown:Be};return ae&&(Qe["data-testid"]=ae),i((function(){if(Q){var nt=Me.current;if(nt){var ot=window.scrollX,Ge=window.scrollY;nt.focus(),window.scrollTo(ot,Ge)}}}),[]),oe==="text"?s.createElement("input",t({type:"text"},Qe)):s.createElement("input",t({type:"password"},Qe))};(function(h){h[h.ExitFullScreen=0]="ExitFullScreen",h[h.FullScreenChange=1]="FullScreenChange",h[h.FullScreenElement=2]="FullScreenElement",h[h.FullScreenEnabled=3]="FullScreenEnabled",h[h.RequestFullScreen=4]="RequestFullScreen"})(a||(a={}));var _,M={ExitFullScreen:"exitFullscreen",FullScreenChange:"fullscreenchange",FullScreenElement:"fullscreenElement",FullScreenEnabled:"fullscreenEnabled",RequestFullScreen:"requestFullscreen"},te={ExitFullScreen:"webkitExitFullscreen",FullScreenChange:"webkitfullscreenchange",FullScreenElement:"webkitFullscreenElement",FullScreenEnabled:"webkitFullscreenEnabled",RequestFullScreen:"webkitRequestFullscreen"},ie={ExitFullScreen:"msExitFullscreen",FullScreenChange:"msFullscreenChange",FullScreenElement:"msFullscreenElement",FullScreenEnabled:"msFullscreenEnabled",RequestFullScreen:"msRequestFullscreen"},Y=typeof window<"u",he=Y&&(a.FullScreenEnabled in document&&M||te.FullScreenEnabled in document&&te||ie.FullScreenEnabled in document&&ie)||M,ge=function(){return Y&&he.FullScreenEnabled in document&&document[he.FullScreenEnabled]===!0},Ne=function(h){return Y?h[he.ExitFullScreen]():Promise.resolve({})},ke=function(){return Y?document[he.FullScreenElement]:null},Oe=function(h,w){var j=s.useRef(),X=function(){j.current&&clearTimeout(j.current)};return s.useEffect((function(){return function(){return X()}}),[]),s.useCallback((function(){for(var Q=[],ne=0;ne<arguments.length;ne++)Q[ne]=arguments[ne];X(),j.current=setTimeout((function(){h.apply(void 0,Q)}),w)}),[h,w])},Ve=function(){var h=s.useRef(!1);return s.useEffect((function(){return h.current=!0,function(){h.current=!1}}),[]),h},Ee=function(h){var w=s.useRef(h);return s.useEffect((function(){w.current=h}),[h]),w.current};(function(h){h.NotRenderedYet="NotRenderedYet",h.Rendering="Rendering",h.Rendered="Rendered"})(_||(_={}));var G,A=-9999,m=function(h){var w=h.doc,j=w.numPages,X=w.loadingTask.docId,Q=s.useMemo((function(){return Array(j).fill(null).map((function(ae,$){return{pageIndex:$,renderStatus:_.NotRenderedYet,visibility:A}}))}),[X]),ne=s.useRef({currentRenderingPage:-1,startRange:0,endRange:j-1,visibilities:Q}),ce=function(ae,$){ne.current.visibilities[ae].visibility=$};return{getHighestPriorityPage:function(){var ae=ne.current.visibilities.slice(ne.current.startRange,ne.current.endRange+1).filter((function(Ae){return Ae.visibility>A}));if(!ae.length)return-1;for(var $=ae[0].pageIndex,oe=ae[ae.length-1].pageIndex,se=ae.length,Pe=0;Pe<se;Pe++){if(ae[Pe].renderStatus===_.Rendering)return-1;if(ae[Pe].renderStatus===_.NotRenderedYet)return ae[Pe].pageIndex}return oe+1<j&&ne.current.visibilities[oe+1].renderStatus!==_.Rendered?oe+1:$-1>=0&&ne.current.visibilities[$-1].renderStatus!==_.Rendered?$-1:-1},isInRange:function(ae){return ae>=ne.current.startRange&&ae<=ne.current.endRange},markNotRendered:function(){for(var ae=0;ae<j;ae++)ne.current.visibilities[ae].renderStatus=_.NotRenderedYet},markRendered:function(ae){ne.current.visibilities[ae].renderStatus=_.Rendered},markRendering:function(ae){ne.current.currentRenderingPage!==-1&&ne.current.currentRenderingPage!==ae&&ne.current.visibilities[ne.current.currentRenderingPage].renderStatus===_.Rendering&&(ne.current.visibilities[ne.current.currentRenderingPage].renderStatus=_.NotRenderedYet),ne.current.visibilities[ae].renderStatus=_.Rendering,ne.current.currentRenderingPage=ae},setOutOfRange:function(ae){ce(ae,A)},setRange:function(ae,$){ne.current.startRange=ae,ne.current.endRange=$;for(var oe=0;oe<j;oe++)(oe<ae||oe>$)&&(ne.current.visibilities[oe].visibility=A,ne.current.visibilities[oe].renderStatus=_.NotRenderedYet)},setVisibility:ce}},v={core:{askingPassword:{requirePasswordToOpen:"This document requires a password to open",submit:"Submit"},wrongPassword:{tryAgain:"The password is wrong. Please try again"},pageLabel:"Page {{pageIndex}}"}},C=s.createContext({l10n:v,setL10n:function(){}}),V=0,W=function(){return V++},K=function(h,w,j){var X=function(Q){var ne=w.current;if(ne){var ce=Q.target;if(ce instanceof Element&&ce.shadowRoot){var ae=Q.composedPath();ae.length>0&&!ne.contains(ae[0])&&j()}else ne.contains(ce)||j()}};s.useEffect((function(){if(h){var Q={capture:!0};return document.addEventListener("click",X,Q),function(){document.removeEventListener("click",X,Q)}}}),[])},L=function(h){var w=function(j){j.key==="Escape"&&h()};s.useEffect((function(){return document.addEventListener("keyup",w),function(){document.removeEventListener("keyup",w)}}),[])},l=function(h){var w=h.ariaControlsSuffix,j=h.children,X=h.closeOnClickOutside,Q=h.closeOnEscape,ne=h.onToggle,ce=s.useRef(),ae=s.useContext(g).direction===r.TextDirection.RightToLeft;return s.useEffect((function(){var $=window.getComputedStyle(document.body).overflow;return document.body.style.overflow="hidden",function(){document.body.style.overflow=$}}),[]),L((function(){ce.current&&Q&&ne()})),K(X,ce,ne),i((function(){var $=ce.current;if($){var oe=.75*document.body.clientHeight;$.getBoundingClientRect().height>=oe&&($.style.overflow="auto",$.style.maxHeight="".concat(oe,"px"))}}),[]),s.createElement("div",{"aria-modal":"true",className:d({"rpv-core__modal-body":!0,"rpv-core__modal-body--rtl":ae}),id:"rpv-core__modal-body-".concat(w),ref:ce,role:"dialog",tabIndex:-1},j)},S=function(h){var w=h.children;return s.createElement("div",{className:"rpv-core__modal-overlay"},w)};r.ToggleStatus=void 0,(G=r.ToggleStatus||(r.ToggleStatus={})).Close="Close",G.Open="Open",G.Toggle="Toggle";var R,O=function(h){var w=s.useState(h),j=w[0],X=w[1];return{opened:j,toggle:function(Q){switch(Q){case r.ToggleStatus.Close:X(!1);break;case r.ToggleStatus.Open:X(!0);break;case r.ToggleStatus.Toggle:default:X((function(ne){return!ne}))}}}},B=function(h){var w=h.content,j=h.isOpened,X=j!==void 0&&j,Q=h.target,ne=O(X),ce=ne.opened,ae=ne.toggle;return s.createElement(s.Fragment,null,Q&&Q(ae,ce),ce&&w(ae))};r.Position=void 0,(R=r.Position||(r.Position={})).TopLeft="TOP_LEFT",R.TopCenter="TOP_CENTER",R.TopRight="TOP_RIGHT",R.RightTop="RIGHT_TOP",R.RightCenter="RIGHT_CENTER",R.RightBottom="RIGHT_BOTTOM",R.BottomLeft="BOTTOM_LEFT",R.BottomCenter="BOTTOM_CENTER",R.BottomRight="BOTTOM_RIGHT",R.LeftTop="LEFT_TOP",R.LeftCenter="LEFT_CENTER",R.LeftBottom="LEFT_BOTTOM";var Z,re,me,We,ve,ye,Ce,Re,xe=function(h,w,j,X,Q){i((function(){var ne=w.current,ce=h.current,ae=j.current;if(ce&&ne&&ae){var $=ae.getBoundingClientRect(),oe=(function(Ae,Se,Be,Le){var Me=Se.getBoundingClientRect(),mt=Ae.getBoundingClientRect(),Qe=mt.height,nt=mt.width,ot=0,Ge=0;switch(Be){case r.Position.TopLeft:ot=Me.top-Qe,Ge=Me.left;break;case r.Position.TopCenter:ot=Me.top-Qe,Ge=Me.left+Me.width/2-nt/2;break;case r.Position.TopRight:ot=Me.top-Qe,Ge=Me.left+Me.width-nt;break;case r.Position.RightTop:ot=Me.top,Ge=Me.left+Me.width;break;case r.Position.RightCenter:ot=Me.top+Me.height/2-Qe/2,Ge=Me.left+Me.width;break;case r.Position.RightBottom:ot=Me.top+Me.height-Qe,Ge=Me.left+Me.width;break;case r.Position.BottomLeft:ot=Me.top+Me.height,Ge=Me.left;break;case r.Position.BottomCenter:ot=Me.top+Me.height,Ge=Me.left+Me.width/2-nt/2;break;case r.Position.BottomRight:ot=Me.top+Me.height,Ge=Me.left+Me.width-nt;break;case r.Position.LeftTop:ot=Me.top,Ge=Me.left-nt;break;case r.Position.LeftCenter:ot=Me.top+Me.height/2-Qe/2,Ge=Me.left-nt;break;case r.Position.LeftBottom:ot=Me.top+Me.height-Qe,Ge=Me.left-nt}return{left:Ge+(Le.left||0),top:ot+(Le.top||0)}})(ce,ne,X,Q),se=oe.top,Pe=oe.left;ce.style.top="".concat(se-$.top,"px"),ce.style.left="".concat(Pe-$.left,"px")}}),[])},qe=function(h){var w,j=h.customClassName,X=h.position;return s.createElement("div",{className:d((w={"rpv-core__arrow":!0,"rpv-core__arrow--tl":X===r.Position.TopLeft,"rpv-core__arrow--tc":X===r.Position.TopCenter,"rpv-core__arrow--tr":X===r.Position.TopRight,"rpv-core__arrow--rt":X===r.Position.RightTop,"rpv-core__arrow--rc":X===r.Position.RightCenter,"rpv-core__arrow--rb":X===r.Position.RightBottom,"rpv-core__arrow--bl":X===r.Position.BottomLeft,"rpv-core__arrow--bc":X===r.Position.BottomCenter,"rpv-core__arrow--br":X===r.Position.BottomRight,"rpv-core__arrow--lt":X===r.Position.LeftTop,"rpv-core__arrow--lc":X===r.Position.LeftCenter,"rpv-core__arrow--lb":X===r.Position.LeftBottom},w["".concat(j)]=j!=="",w))})},tt=function(h){var w=h.ariaControlsSuffix,j=h.children,X=h.closeOnClickOutside,Q=h.offset,ne=h.position,ce=h.targetRef,ae=h.onClose,$=s.useRef(),oe=s.useRef(),se=s.useRef(),Pe=s.useContext(g).direction===r.TextDirection.RightToLeft;K(X,$,ae),xe($,ce,se,ne,Q),i((function(){var Se=oe.current;if(Se){var Be=.75*document.body.clientHeight;Se.getBoundingClientRect().height>=Be&&(Se.style.overflow="auto",Se.style.maxHeight="".concat(Be,"px"))}}),[]);var Ae="rpv-core__popover-body-inner-".concat(w);return s.createElement(s.Fragment,null,s.createElement("div",{ref:se,style:{left:0,position:"absolute",top:0}}),s.createElement("div",{"aria-describedby":Ae,className:d({"rpv-core__popover-body":!0,"rpv-core__popover-body--rtl":Pe}),id:"rpv-core__popover-body-".concat(w),ref:$,role:"dialog",tabIndex:-1},s.createElement(qe,{customClassName:"rpv-core__popover-body-arrow",position:ne}),s.createElement("div",{id:Ae,ref:oe},j)))},lt=function(h){var w=h.closeOnEscape,j=h.onClose,X=s.useRef();return L((function(){X.current&&w&&j()})),s.createElement("div",{className:"rpv-core__popover-overlay",ref:X})},vt=function(h){var w=h.ariaControlsSuffix,j=h.children,X=h.contentRef,Q=h.offset,ne=h.position,ce=h.targetRef,ae=s.useRef(),$=s.useContext(g).direction===r.TextDirection.RightToLeft;return xe(X,ce,ae,ne,Q),s.createElement(s.Fragment,null,s.createElement("div",{ref:ae,style:{left:0,position:"absolute",top:0}}),s.createElement("div",{className:d({"rpv-core__tooltip-body":!0,"rpv-core__tooltip-body--rtl":$}),id:"rpv-core__tooltip-body-".concat(w),ref:X,role:"tooltip"},s.createElement(qe,{customClassName:"rpv-core__tooltip-body-arrow",position:ne}),s.createElement("div",{className:"rpv-core__tooltip-body-content"},j)))};r.FullScreenMode=void 0,(Z=r.FullScreenMode||(r.FullScreenMode={})).Normal="Normal",Z.Entering="Entering",Z.Entered="Entered",Z.EnteredCompletely="EnteredCompletely",Z.Exitting="Exitting",Z.Exited="Exited",r.LayerRenderStatus=void 0,(re=r.LayerRenderStatus||(r.LayerRenderStatus={}))[re.PreRender=0]="PreRender",re[re.DidRender=1]="DidRender",r.PageMode=void 0,(me=r.PageMode||(r.PageMode={})).Attachments="UseAttachments",me.Bookmarks="UseOutlines",me.ContentGroup="UseOC",me.Default="UserNone",me.FullScreen="FullScreen",me.Thumbnails="UseThumbs",r.PasswordStatus=void 0,(We=r.PasswordStatus||(r.PasswordStatus={})).RequiredPassword="RequiredPassword",We.WrongPassword="WrongPassword",r.RotateDirection=void 0,(ve=r.RotateDirection||(r.RotateDirection={})).Backward="Backward",ve.Forward="Forward",r.ScrollMode=void 0,(ye=r.ScrollMode||(r.ScrollMode={})).Page="Page",ye.Horizontal="Horizontal",ye.Vertical="Vertical",ye.Wrapped="Wrapped",r.SpecialZoomLevel=void 0,(Ce=r.SpecialZoomLevel||(r.SpecialZoomLevel={})).ActualSize="ActualSize",Ce.PageFit="PageFit",Ce.PageWidth="PageWidth",r.ViewMode=void 0,(Re=r.ViewMode||(r.ViewMode={})).DualPage="DualPage",Re.DualPageWithCover="DualPageWithCover",Re.SinglePage="SinglePage";var bt,Ft=function(h,w){return h.reduce((function(j,X,Q){return Q%w?j[j.length-1].push(X):j.push([X]),j}),[])},vn=function(h,w){switch(w[1].name){case"XYZ":return{bottomOffset:function(j,X){return w[3]===null?X:w[3]},leftOffset:function(j,X){return w[2]===null?0:w[2]},pageIndex:h,scaleTo:w[4]};case"Fit":case"FitB":return{bottomOffset:0,leftOffset:0,pageIndex:h,scaleTo:r.SpecialZoomLevel.PageFit};case"FitH":case"FitBH":return{bottomOffset:w[2],leftOffset:0,pageIndex:h,scaleTo:r.SpecialZoomLevel.PageWidth};default:return{bottomOffset:0,leftOffset:0,pageIndex:h,scaleTo:1}}},hn=new Map,jn=new Map,gn=function(h,w){return"".concat(h.loadingTask.docId,"___").concat(w.num,"R").concat(w.gen===0?"":w.gen)},Fn=function(h,w,j){hn.set(gn(h,w),j)},Kn=function(h,w){if(!h)return Promise.reject("The document is not loaded yet");var j="".concat(h.loadingTask.docId,"___").concat(w),X=jn.get(j);return X?Promise.resolve(X):new Promise((function(Q,ne){h.getPage(w+1).then((function(ce){jn.set(j,ce),ce.ref&&Fn(h,ce.ref,w),Q(ce)}))}))},lr=function(h,w){return new Promise((function(j){new Promise((function(X){typeof w=="string"?h.getDestination(w).then((function(Q){X(Q)})):X(w)})).then((function(X){if(typeof X[0]=="object"&&X[0]!==null){var Q=X[0],ne=(function(ae,$){var oe=gn(ae,$);return hn.has(oe)?hn.get(oe):null})(h,Q);ne===null?h.getPageIndex(Q).then((function(ae){Fn(h,Q,ae),lr(h,w).then((function($){return j($)}))})):j(vn(ne,X))}else{var ce=vn(X[0],X);j(ce)}}))}))};(function(h){h[h.Solid=1]="Solid",h[h.Dashed=2]="Dashed",h[h.Beveled=3]="Beveled",h[h.Inset=4]="Inset",h[h.Underline=5]="Underline"})(bt||(bt={}));var _n,De=new RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+|-])?(\\d{2})?'?(\\d{2})?'?"),fe=function(h,w,j,X){var Q=parseInt(h,10);return Q>=w&&Q<=j?Q:X},ue=function(h){return h.contentsObj?h.contentsObj.str:h.contents||""},He=function(h){return h.titleObj?h.titleObj.str:h.title||""},Dt=function(h){var w=h.annotation,j=s.useContext(g).direction,X=He(w),Q=ue(w),ne=j===r.TextDirection.RightToLeft,ce=s.useRef(),ae="";if(w.modificationDate){var $=(function(oe){var se=De.exec(oe);if(!se)return null;var Pe=parseInt(se[1],10),Ae=fe(se[2],1,12,1)-1,Se=fe(se[3],1,31,1),Be=fe(se[4],0,23,0),Le=fe(se[5],0,59,0),Me=fe(se[6],0,59,0),mt=se[7]||"Z",Qe=fe(se[8],0,23,0),nt=fe(se[9],0,59,0);switch(mt){case"-":Be+=Qe,Le+=nt;break;case"+":Be-=Qe,Le-=nt}return new Date(Date.UTC(Pe,Ae,Se,Be,Le,Me))})(w.modificationDate);ae=$?"".concat($.toLocaleDateString(),", ").concat($.toLocaleTimeString()):""}return s.useLayoutEffect((function(){if(ce.current){var oe=document.querySelector('[data-annotation-id="'.concat(w.id,'"]'));if(oe){var se=oe;return se.style.zIndex+=1,function(){se.style.zIndex="".concat(parseInt(se.style.zIndex,10)-1)}}}}),[]),s.createElement("div",{ref:ce,className:d({"rpv-core__annotation-popup-wrapper":!0,"rpv-core__annotation-popup-wrapper--rtl":ne}),style:{top:w.annotationType===r.AnnotationType.Popup?"":"100%"}},X&&s.createElement(s.Fragment,null,s.createElement("div",{className:d({"rpv-core__annotation-popup-title":!0,"rpv-core__annotation-popup-title--ltr":!ne,"rpv-core__annotation-popup-title--rtl":ne})},X),s.createElement("div",{className:"rpv-core__annotation-popup-date"},ae)),Q&&s.createElement("div",{className:"rpv-core__annotation-popup-content"},Q.split(`
|
|
9
|
+
`).map((function(oe,se){return s.createElement(s.Fragment,{key:se},oe,s.createElement("br",null))}))))};(function(h){h.Click="Click",h.Hover="Hover"})(_n||(_n={}));var pt,kt=function(h){var w,j=h.annotation,X=h.children,Q=h.ignoreBorder,ne=h.hasPopup,ce=h.isRenderable,ae=h.page,$=h.viewport,oe=j.rect,se=(function(){var st=O(!1),Mt=st.opened,Ct=st.toggle,xt=s.useState(_n.Hover),Ot=xt[0],It=xt[1];return{opened:Mt,closeOnHover:function(){Ot===_n.Hover&&Ct(r.ToggleStatus.Close)},openOnHover:function(){Ot===_n.Hover&&Ct(r.ToggleStatus.Open)},toggleOnClick:function(){switch(Ot){case _n.Click:Mt&&It(_n.Hover),Ct(r.ToggleStatus.Toggle);break;case _n.Hover:It(_n.Click),Ct(r.ToggleStatus.Open)}}}})(),Pe=se.closeOnHover,Ae=se.opened,Se=se.openOnHover,Be=se.toggleOnClick,Le=(w=[oe[0],ae.view[3]+ae.view[1]-oe[1],oe[2],ae.view[3]+ae.view[1]-oe[3]],[Math.min(w[0],w[2]),Math.min(w[1],w[3]),Math.max(w[0],w[2]),Math.max(w[1],w[3])]),Me=oe[2]-oe[0],mt=oe[3]-oe[1],Qe={borderColor:"",borderRadius:"",borderStyle:"",borderWidth:""};if(!Q&&j.borderStyle.width>0){switch(j.borderStyle.style){case bt.Dashed:Qe.borderStyle="dashed";break;case bt.Solid:Qe.borderStyle="solid";break;case bt.Underline:Qe=Object.assign({borderBottomStyle:"solid"},Qe);case bt.Beveled:case bt.Inset:}var nt=j.borderStyle.width;Qe.borderWidth="".concat(nt,"px"),j.borderStyle.style!==bt.Underline&&(Me-=2*nt,mt-=2*nt);var ot=j.borderStyle,Ge=ot.horizontalCornerRadius,ct=ot.verticalCornerRadius;(Ge>0||ct>0)&&(Qe.borderRadius="".concat(Ge,"px / ").concat(ct,"px")),j.color?Qe.borderColor="rgb(".concat(0|j.color[0],", ").concat(0|j.color[1],", ").concat(0|j.color[2],")"):Qe.borderWidth="0"}return s.createElement(s.Fragment,null,ce&&X({popup:{opened:Ae,closeOnHover:Pe,openOnHover:Se,toggleOnClick:Be},slot:{attrs:{style:Object.assign({height:"".concat(mt,"px"),left:"".concat(Le[0],"px"),top:"".concat(Le[1],"px"),transform:"matrix(".concat($.transform.join(","),")"),transformOrigin:"-".concat(Le[0],"px -").concat(Le[1],"px"),width:"".concat(Me,"px")},Qe)},children:s.createElement(s.Fragment,null,ne&&Ae&&s.createElement(Dt,{annotation:j}))}}))},Jn=function(h){var w=h.annotation,j=h.page,X=h.viewport,Q=w.hasPopup===!1,ne=He(w),ce=ue(w),ae=!!(w.hasPopup||ne||ce);return s.createElement(kt,{annotation:w,hasPopup:Q,ignoreBorder:!0,isRenderable:ae,page:j,viewport:X},(function($){return s.createElement("div",t({},$.slot.attrs,{className:"rpv-core__annotation rpv-core__annotation--caret","data-annotation-id":w.id,onClick:$.popup.toggleOnClick,onMouseEnter:$.popup.openOnHover,onMouseLeave:$.popup.closeOnHover}),$.slot.children)}))},Bn=function(h){var w=h.annotation,j=h.page,X=h.viewport,Q=w.hasPopup===!1,ne=He(w),ce=ue(w),ae=!!(w.hasPopup||ne||ce),$=w.rect,oe=$[2]-$[0],se=$[3]-$[1],Pe=w.borderStyle.width;return s.createElement(kt,{annotation:w,hasPopup:Q,ignoreBorder:!0,isRenderable:ae,page:j,viewport:X},(function(Ae){return s.createElement("div",t({},Ae.slot.attrs,{className:"rpv-core__annotation rpv-core__annotation--circle","data-annotation-id":w.id,onClick:Ae.popup.toggleOnClick,onMouseEnter:Ae.popup.openOnHover,onMouseLeave:Ae.popup.closeOnHover}),s.createElement("svg",{height:"".concat(se,"px"),preserveAspectRatio:"none",version:"1.1",viewBox:"0 0 ".concat(oe," ").concat(se),width:"".concat(oe,"px")},s.createElement("circle",{cy:se/2,fill:"none",rx:oe/2-Pe/2,ry:se/2-Pe/2,stroke:"transparent",strokeWidth:Pe||1})),Ae.slot.children)}))},Hn=function(h){var w=h.annotation,j=h.page,X=h.viewport,Q=He(w),ne=ue(w),ce=!(w.hasPopup!==!1||!Q&&!ne),ae=function(){var $,oe,se,Pe,Ae=w.file;Ae&&($=Ae.filename,oe=Ae.content,se=typeof oe=="string"?"":URL.createObjectURL(new Blob([oe],{type:""})),(Pe=document.createElement("a")).style.display="none",Pe.href=se||$,Pe.setAttribute("download",(function(Se){var Be=Se.split("/").pop();return Be?Be.split("#")[0].split("?")[0]:Se})($)),document.body.appendChild(Pe),Pe.click(),document.body.removeChild(Pe),se&&URL.revokeObjectURL(se))};return s.createElement(kt,{annotation:w,hasPopup:ce,ignoreBorder:!0,isRenderable:!0,page:j,viewport:X},(function($){return s.createElement("div",t({},$.slot.attrs,{className:"rpv-core__annotation rpv-core__annotation--file-attachment","data-annotation-id":w.id,onClick:$.popup.toggleOnClick,onDoubleClick:ae,onMouseEnter:$.popup.openOnHover,onMouseLeave:$.popup.closeOnHover}),$.slot.children)}))},yn=function(h){var w=h.annotation,j=h.page,X=h.viewport,Q=w.hasPopup===!1,ne=He(w),ce=ue(w),ae=!!(w.hasPopup||ne||ce);return s.createElement(kt,{annotation:w,hasPopup:Q,ignoreBorder:!0,isRenderable:ae,page:j,viewport:X},(function($){return s.createElement("div",t({},$.slot.attrs,{className:"rpv-core__annotation rpv-core__annotation--free-text","data-annotation-id":w.id,onClick:$.popup.toggleOnClick,onMouseEnter:$.popup.openOnHover,onMouseLeave:$.popup.closeOnHover}),$.slot.children)}))},Un=function(h){var w=h.annotation,j=h.page,X=h.viewport,Q=He(w),ne=ue(w),ce=!(!Q&&!ne),ae=!w.parentType||["Circle","Ink","Line","Polygon","PolyLine","Square"].indexOf(w.parentType)!==-1;return i((function(){if(w.parentId){var $=document.querySelector('[data-annotation-id="'.concat(w.parentId,'"]')),oe=document.querySelector('[data-annotation-id="'.concat(w.id,'"]'));if($&&oe){var se=parseFloat($.style.left),Pe=parseFloat($.style.top)+parseFloat($.style.height);oe.style.left="".concat(se,"px"),oe.style.top="".concat(Pe,"px"),oe.style.transformOrigin="-".concat(se,"px -").concat(Pe,"px")}}}),[]),s.createElement(kt,{annotation:w,hasPopup:ae,ignoreBorder:!1,isRenderable:ce,page:j,viewport:X},(function($){return s.createElement("div",t({},$.slot.attrs,{className:"rpv-core__annotation rpv-core__annotation--popup","data-annotation-id":w.id}),s.createElement(Dt,{annotation:w}))}))},mn=function(h){var w=h.annotation,j=h.childAnnotation,X=h.page,Q=h.viewport,ne=w.hasPopup===!1,ce=He(w),ae=ue(w),$=!!(w.hasPopup||ce||ae);if(w.quadPoints&&w.quadPoints.length>0){var oe=w.quadPoints.map((function(se){return Object.assign({},w,{rect:[se[2].x,se[2].y,se[1].x,se[1].y],quadPoints:[]})}));return s.createElement(s.Fragment,null,oe.map((function(se,Pe){return s.createElement(mn,{key:Pe,annotation:se,childAnnotation:j,page:X,viewport:Q})})))}return s.createElement(kt,{annotation:w,hasPopup:ne,ignoreBorder:!0,isRenderable:$,page:X,viewport:Q},(function(se){return s.createElement(s.Fragment,null,s.createElement("div",t({},se.slot.attrs,{className:"rpv-core__annotation rpv-core__annotation--highlight","data-annotation-id":w.id,onClick:se.popup.toggleOnClick,onMouseEnter:se.popup.openOnHover,onMouseLeave:se.popup.closeOnHover}),se.slot.children),j&&j.annotationType===r.AnnotationType.Popup&&se.popup.opened&&s.createElement(Un,{annotation:j,page:X,viewport:Q}))}))},nr=function(h){var w=h.annotation,j=h.page,X=h.viewport,Q=w.hasPopup===!1,ne=He(w),ce=ue(w),ae=!!(w.hasPopup||ne||ce),$=w.rect,oe=$[2]-$[0],se=$[3]-$[1],Pe=w.borderStyle.width;return s.createElement(kt,{annotation:w,hasPopup:Q,ignoreBorder:!0,isRenderable:ae,page:j,viewport:X},(function(Ae){return s.createElement("div",t({},Ae.slot.attrs,{className:"rpv-core__annotation rpv-core__annotation--ink","data-annotation-id":w.id,onClick:Ae.popup.toggleOnClick,onMouseEnter:Ae.popup.openOnHover,onMouseLeave:Ae.popup.closeOnHover}),w.inkLists&&w.inkLists.length&&s.createElement("svg",{height:"".concat(se,"px"),preserveAspectRatio:"none",version:"1.1",viewBox:"0 0 ".concat(oe," ").concat(se),width:"".concat(oe,"px")},w.inkLists.map((function(Se,Be){return s.createElement("polyline",{key:Be,fill:"none",stroke:"transparent",strokeWidth:Pe||1,points:Se.map((function(Le){return"".concat(Le.x-$[0],",").concat($[3]-Le.y)})).join(" ")})}))),Ae.slot.children)}))},Xt=function(h){var w=h.annotation,j=h.page,X=h.viewport,Q=w.hasPopup===!1,ne=He(w),ce=ue(w),ae=!!(w.hasPopup||ne||ce),$=w.rect,oe=$[2]-$[0],se=$[3]-$[1],Pe=w.borderStyle.width;return s.createElement(kt,{annotation:w,hasPopup:Q,ignoreBorder:!0,isRenderable:ae,page:j,viewport:X},(function(Ae){return s.createElement("div",t({},Ae.slot.attrs,{className:"rpv-core__annotation rpv-core__annotation--line","data-annotation-id":w.id,onClick:Ae.popup.toggleOnClick,onMouseEnter:Ae.popup.openOnHover,onMouseLeave:Ae.popup.closeOnHover}),s.createElement("svg",{height:"".concat(se,"px"),preserveAspectRatio:"none",version:"1.1",viewBox:"0 0 ".concat(oe," ").concat(se),width:"".concat(oe,"px")},s.createElement("line",{stroke:"transparent",strokeWidth:Pe||1,x1:$[2]-w.lineCoordinates[0],x2:$[2]-w.lineCoordinates[2],y1:$[3]-w.lineCoordinates[1],y2:$[3]-w.lineCoordinates[3]})),Ae.slot.children)}))},rr=/^([^\w]*)(javascript|data|vbscript)/im,an=/&#(\w+)(^\w|;)?/g,ln=/[\u0000-\u001F\u007F-\u009F\u2000-\u200D\uFEFF]/gim,ir=/^([^:]+):/gm,An=function(h,w){var j,X=(j=h||"",j.replace(an,(function(ae,$){return String.fromCharCode($)}))).replace(ln,"").trim();if(!X)return w;var Q=X[0];if(Q==="."||Q==="/")return X;var ne=X.match(ir);if(!ne)return X;var ce=ne[0];return rr.test(ce)?w:X},Pn=function(h){var w,j=h.annotation,X=h.annotationContainerRef,Q=h.doc,ne=h.outlines,ce=h.page,ae=h.pageIndex,$=h.scale,oe=h.viewport,se=h.onExecuteNamedAction,Pe=h.onJumpFromLinkAnnotation,Ae=h.onJumpToDest,Se=s.useRef(),Be=ne&&ne.length&&j.dest&&typeof j.dest=="string"?(w=ne.find((function(Qe){return Qe.dest===j.dest})))===null||w===void 0?void 0:w.title:"",Le=!!(j.url||j.dest||j.action||j.unsafeUrl),Me={};if(j.url||j.unsafeUrl){var mt=An(j.url||j.unsafeUrl,"");mt?Me={"data-target":"external",href:mt,rel:"noopener noreferrer nofollow",target:j.newWindow?"_blank":"",title:mt}:Le=!1}else Me={href:"","data-annotation-link":j.id,onClick:function(Qe){Qe.preventDefault(),j.action?se(j.action):lr(Q,j.dest).then((function(nt){var ot=Se.current,Ge=X.current;if(ot&&Ge){var ct=ot.getBoundingClientRect();Ge.style.setProperty("height","100%"),Ge.style.setProperty("width","100%");var st=Ge.getBoundingClientRect();Ge.style.removeProperty("height"),Ge.style.removeProperty("width");var Mt=(ct.left-st.left)/$,Ct=(st.bottom-ct.bottom+ct.height)/$;Pe({bottomOffset:Ct,label:Be,leftOffset:Mt,pageIndex:ae})}Ae(nt)}))}};return Be&&(Me=Object.assign({},Me,{title:Be,"aria-label":Be})),s.createElement(kt,{annotation:j,hasPopup:!1,ignoreBorder:!1,isRenderable:Le,page:ce,viewport:oe},(function(Qe){return s.createElement("div",t({},Qe.slot.attrs,{className:"rpv-core__annotation rpv-core__annotation--link","data-annotation-id":j.id,"data-testid":"core__annotation--link-".concat(j.id)}),s.createElement("a",t({ref:Se},Me)))}))},tn=function(h){var w=h.annotation,j=h.page,X=h.viewport,Q=w.hasPopup===!1,ne=He(w),ce=ue(w),ae=!!(w.hasPopup||ne||ce),$=w.rect,oe=$[2]-$[0],se=$[3]-$[1],Pe=w.borderStyle.width;return s.createElement(kt,{annotation:w,hasPopup:Q,ignoreBorder:!0,isRenderable:ae,page:j,viewport:X},(function(Ae){return s.createElement("div",t({},Ae.slot.attrs,{className:"rpv-core__annotation rpv-core__annotation--polygon","data-annotation-id":w.id,onClick:Ae.popup.toggleOnClick,onMouseEnter:Ae.popup.openOnHover,onMouseLeave:Ae.popup.closeOnHover}),w.vertices&&w.vertices.length&&s.createElement("svg",{height:"".concat(se,"px"),preserveAspectRatio:"none",version:"1.1",viewBox:"0 0 ".concat(oe," ").concat(se),width:"".concat(oe,"px")},s.createElement("polygon",{fill:"none",stroke:"transparent",strokeWidth:Pe||1,points:w.vertices.map((function(Se){return"".concat(Se.x-$[0],",").concat($[3]-Se.y)})).join(" ")})),Ae.slot.children)}))},cr=function(h){var w=h.annotation,j=h.page,X=h.viewport,Q=w.hasPopup===!1,ne=He(w),ce=ue(w),ae=!!(w.hasPopup||ne||ce),$=w.rect,oe=$[2]-$[0],se=$[3]-$[1],Pe=w.borderStyle.width;return s.createElement(kt,{annotation:w,hasPopup:Q,ignoreBorder:!0,isRenderable:ae,page:j,viewport:X},(function(Ae){return s.createElement("div",t({},Ae.slot.attrs,{className:"rpv-core__annotation rpv-core__annotation--polyline","data-annotation-id":w.id,onClick:Ae.popup.toggleOnClick,onMouseEnter:Ae.popup.openOnHover,onMouseLeave:Ae.popup.closeOnHover}),w.vertices&&w.vertices.length&&s.createElement("svg",{height:"".concat(se,"px"),preserveAspectRatio:"none",version:"1.1",viewBox:"0 0 ".concat(oe," ").concat(se),width:"".concat(oe,"px")},s.createElement("polyline",{fill:"none",stroke:"transparent",strokeWidth:Pe||1,points:w.vertices.map((function(Se){return"".concat(Se.x-$[0],",").concat($[3]-Se.y)})).join(" ")})),Ae.slot.children)}))},Nr=function(h){var w=h.annotation,j=h.page,X=h.viewport,Q=w.hasPopup===!1,ne=He(w),ce=ue(w),ae=!!(w.hasPopup||ne||ce),$=w.rect,oe=$[2]-$[0],se=$[3]-$[1],Pe=w.borderStyle.width;return s.createElement(kt,{annotation:w,hasPopup:Q,ignoreBorder:!0,isRenderable:ae,page:j,viewport:X},(function(Ae){return s.createElement("div",t({},Ae.slot.attrs,{className:"rpv-core__annotation rpv-core__annotation--square","data-annotation-id":w.id,onClick:Ae.popup.toggleOnClick,onMouseEnter:Ae.popup.openOnHover,onMouseLeave:Ae.popup.closeOnHover}),s.createElement("svg",{height:"".concat(se,"px"),preserveAspectRatio:"none",version:"1.1",viewBox:"0 0 ".concat(oe," ").concat(se),width:"".concat(oe,"px")},s.createElement("rect",{height:se-Pe,fill:"none",stroke:"transparent",strokeWidth:Pe||1,x:Pe/2,y:Pe/2,width:oe-Pe})),Ae.slot.children)}))},Br=function(h){var w=h.annotation,j=h.page,X=h.viewport,Q=w.hasPopup===!1,ne=He(w),ce=ue(w),ae=!!(w.hasPopup||ne||ce);return s.createElement(kt,{annotation:w,hasPopup:Q,ignoreBorder:!0,isRenderable:ae,page:j,viewport:X},(function($){return s.createElement("div",t({},$.slot.attrs,{className:"rpv-core__annotation rpv-core__annotation--squiggly","data-annotation-id":w.id,onClick:$.popup.toggleOnClick,onMouseEnter:$.popup.openOnHover,onMouseLeave:$.popup.closeOnHover}),$.slot.children)}))},Hr=function(h){var w=h.annotation,j=h.page,X=h.viewport,Q=w.hasPopup===!1,ne=He(w),ce=ue(w),ae=!!(w.hasPopup||ne||ce);return s.createElement(kt,{annotation:w,hasPopup:Q,ignoreBorder:!0,isRenderable:ae,page:j,viewport:X},(function($){return s.createElement("div",t({},$.slot.attrs,{className:"rpv-core__annotation rpv-core__annotation--stamp","data-annotation-id":w.id,onClick:$.popup.toggleOnClick,onMouseEnter:$.popup.openOnHover,onMouseLeave:$.popup.closeOnHover}),$.slot.children)}))},Vr=function(h){var w=h.annotation,j=h.page,X=h.viewport,Q=w.hasPopup===!1,ne=He(w),ce=ue(w),ae=!!(w.hasPopup||ne||ce);return s.createElement(kt,{annotation:w,hasPopup:Q,ignoreBorder:!0,isRenderable:ae,page:j,viewport:X},(function($){return s.createElement("div",t({},$.slot.attrs,{className:"rpv-core__annotation rpv-core__annotation--strike-out","data-annotation-id":w.id,onClick:$.popup.toggleOnClick,onMouseEnter:$.popup.openOnHover,onMouseLeave:$.popup.closeOnHover}),$.slot.children)}))},Wr=function(){return s.createElement(y,{size:16},s.createElement("path",{d:"M.5,16.5a1,1,0,0,0,1,1h2v4l4-4h15a1,1,0,0,0,1-1V3.5a1,1,0,0,0-1-1H1.5a1,1,0,0,0-1,1Z"}),s.createElement("path",{d:"M7.25,9.75A.25.25,0,1,1,7,10a.25.25,0,0,1,.25-.25"}),s.createElement("path",{d:"M12,9.75a.25.25,0,1,1-.25.25A.25.25,0,0,1,12,9.75"}),s.createElement("path",{d:"M16.75,9.75a.25.25,0,1,1-.25.25.25.25,0,0,1,.25-.25"}))},_r=function(){return s.createElement(y,{size:16},s.createElement("path",{d:"M0.500 12.001 A11.500 11.500 0 1 0 23.500 12.001 A11.500 11.500 0 1 0 0.500 12.001 Z"}),s.createElement("path",{d:"M6.000 12.001 A6.000 6.000 0 1 0 18.000 12.001 A6.000 6.000 0 1 0 6.000 12.001 Z"}),s.createElement("path",{d:"M21.423 5.406L17.415 9.414"}),s.createElement("path",{d:"M14.587 6.585L18.607 2.565"}),s.createElement("path",{d:"M5.405 21.424L9.413 17.416"}),s.createElement("path",{d:"M6.585 14.588L2.577 18.596"}),s.createElement("path",{d:"M18.602 21.419L14.595 17.412"}),s.createElement("path",{d:"M17.419 14.58L21.428 18.589"}),s.createElement("path",{d:"M2.582 5.399L6.588 9.406"}),s.createElement("path",{d:"M9.421 6.581L5.412 2.572"}))},Cr=function(){return s.createElement(y,{size:16},s.createElement("path",{d:"M4.000 18.500 A1.500 1.500 0 1 0 7.000 18.500 A1.500 1.500 0 1 0 4.000 18.500 Z"}),s.createElement("path",{d:"M20.5.5l-9.782,9.783a7,7,0,1,0,3,3L17,10h1.5V8.5L19,8h1.5V6.5L21,6h1.5V4.5l1-1V.5Z"}))},jr=function(){return s.createElement(y,{size:16},s.createElement("path",{d:"M2.000 2.500 L22.000 2.500 L22.000 23.500 L2.000 23.500 Z"}),s.createElement("path",{d:"M6 4.5L6 0.5"}),s.createElement("path",{d:"M18 4.5L18 0.5"}),s.createElement("path",{d:"M10 4.5L10 0.5"}),s.createElement("path",{d:"M14 4.5L14 0.5"}))},Ur=function(){return s.createElement(y,{size:16},s.createElement("path",{d:"M17.5 0.498L17.5 23.498"}),s.createElement("path",{d:"M10.5 0.498L10.5 23.498"}),s.createElement("path",{d:"M23.5.5H6.5a6,6,0,0,0,0,12h4"}))},zr=function(){return s.createElement(y,{size:16},s.createElement("path",{d:"M2.5 22.995L12 6.005 21.5 22.995 2.5 22.995z"}))},qr=function(h){var w=h.annotation,j=h.childAnnotation,X=h.page,Q=h.viewport,ne=w.hasPopup===!1,ce=He(w),ae=ue(w),$=!!(w.hasPopup||ce||ae),oe=w.name?w.name.toLowerCase():"";return s.createElement(kt,{annotation:w,hasPopup:ne,ignoreBorder:!1,isRenderable:$,page:X,viewport:Q},(function(se){return s.createElement(s.Fragment,null,s.createElement("div",t({},se.slot.attrs,{className:"rpv-core__annotation rpv-core__annotation--text","data-annotation-id":w.id,onClick:se.popup.toggleOnClick,onMouseEnter:se.popup.openOnHover,onMouseLeave:se.popup.closeOnHover}),oe&&s.createElement("div",{className:"rpv-core__annotation-text-icon"},oe==="check"&&s.createElement(f,null),oe==="comment"&&s.createElement(Wr,null),oe==="help"&&s.createElement(_r,null),oe==="insert"&&s.createElement(zr,null),oe==="key"&&s.createElement(Cr,null),oe==="note"&&s.createElement(jr,null),(oe==="newparagraph"||oe==="paragraph")&&s.createElement(Ur,null)),se.slot.children),j&&j.annotationType===r.AnnotationType.Popup&&se.popup.opened&&s.createElement(Un,{annotation:j,page:X,viewport:Q}))}))},Gr=function(h){var w=h.annotation,j=h.page,X=h.viewport,Q=w.hasPopup===!1,ne=He(w),ce=ue(w),ae=!!(w.hasPopup||ne||ce);return s.createElement(kt,{annotation:w,hasPopup:Q,ignoreBorder:!0,isRenderable:ae,page:j,viewport:X},(function($){return s.createElement("div",t({},$.slot.attrs,{className:"rpv-core__annotation rpv-core__annotation--underline","data-annotation-id":w.id,onClick:$.popup.toggleOnClick,onMouseEnter:$.popup.openOnHover,onMouseLeave:$.popup.closeOnHover}),$.slot.children)}))},Xr=function(h){var w=h.annotations,j=h.doc,X=h.outlines,Q=h.page,ne=h.pageIndex,ce=h.plugins,ae=h.rotation,$=h.scale,oe=h.onExecuteNamedAction,se=h.onJumpFromLinkAnnotation,Pe=h.onJumpToDest,Ae=s.useRef(),Se=Q.getViewport({rotation:ae,scale:$}).clone({dontFlip:!0}),Be=w.filter((function(Le){return!Le.parentId}));return i((function(){var Le=Ae.current;Le&&ce.forEach((function(Me){Me.onAnnotationLayerRender&&Me.onAnnotationLayerRender({annotations:Be,container:Le,pageIndex:ne,rotation:ae,scale:$})}))}),[]),s.createElement("div",{ref:Ae,className:"rpv-core__annotation-layer","data-testid":"core__annotation-layer-".concat(ne)},Be.map((function(Le){var Me=w.find((function(mt){return mt.parentId===Le.id}));switch(Le.annotationType){case r.AnnotationType.Caret:return s.createElement(Jn,{key:Le.id,annotation:Le,page:Q,viewport:Se});case r.AnnotationType.Circle:return s.createElement(Bn,{key:Le.id,annotation:Le,page:Q,viewport:Se});case r.AnnotationType.FileAttachment:return s.createElement(Hn,{key:Le.id,annotation:Le,page:Q,viewport:Se});case r.AnnotationType.FreeText:return s.createElement(yn,{key:Le.id,annotation:Le,page:Q,viewport:Se});case r.AnnotationType.Highlight:return s.createElement(mn,{key:Le.id,annotation:Le,childAnnotation:Me,page:Q,viewport:Se});case r.AnnotationType.Ink:return s.createElement(nr,{key:Le.id,annotation:Le,page:Q,viewport:Se});case r.AnnotationType.Line:return s.createElement(Xt,{key:Le.id,annotation:Le,page:Q,viewport:Se});case r.AnnotationType.Link:return s.createElement(Pn,{key:Le.id,annotation:Le,annotationContainerRef:Ae,doc:j,outlines:X,page:Q,pageIndex:ne,scale:$,viewport:Se,onExecuteNamedAction:oe,onJumpFromLinkAnnotation:se,onJumpToDest:Pe});case r.AnnotationType.Polygon:return s.createElement(tn,{key:Le.id,annotation:Le,page:Q,viewport:Se});case r.AnnotationType.Polyline:return s.createElement(cr,{key:Le.id,annotation:Le,page:Q,viewport:Se});case r.AnnotationType.Popup:return s.createElement(Un,{key:Le.id,annotation:Le,page:Q,viewport:Se});case r.AnnotationType.Square:return s.createElement(Nr,{key:Le.id,annotation:Le,page:Q,viewport:Se});case r.AnnotationType.Squiggly:return s.createElement(Br,{key:Le.id,annotation:Le,page:Q,viewport:Se});case r.AnnotationType.Stamp:return s.createElement(Hr,{key:Le.id,annotation:Le,page:Q,viewport:Se});case r.AnnotationType.StrikeOut:return s.createElement(Vr,{key:Le.id,annotation:Le,page:Q,viewport:Se});case r.AnnotationType.Text:return s.createElement(qr,{key:Le.id,annotation:Le,childAnnotation:Me,page:Q,viewport:Se});case r.AnnotationType.Underline:return s.createElement(Gr,{key:Le.id,annotation:Le,page:Q,viewport:Se});default:return s.createElement(s.Fragment,{key:Le.id})}})))},$r=function(h){var w=h.page,j=h.renderAnnotations,X=Ve(),Q=s.useState({loading:!0,annotations:[]}),ne=Q[0],ce=Q[1];return s.useEffect((function(){w.getAnnotations({intent:"display"}).then((function(ae){X.current&&ce({loading:!1,annotations:ae})}))}),[]),ne.loading?s.createElement(s.Fragment,null):j(ne.annotations)},Yr=function(h){var w=h.doc,j=h.outlines,X=h.page,Q=h.pageIndex,ne=h.plugins,ce=h.rotation,ae=h.scale,$=h.onExecuteNamedAction,oe=h.onJumpFromLinkAnnotation,se=h.onJumpToDest;return s.createElement($r,{page:X,renderAnnotations:function(Pe){return s.createElement(Xr,{annotations:Pe,doc:w,outlines:j,page:X,pageIndex:Q,plugins:ne,rotation:ce,scale:ae,onExecuteNamedAction:$,onJumpFromLinkAnnotation:oe,onJumpToDest:se})}})},pr=function(h,w){var j=h%w;return j===0?h:Math.floor(h-j)},Kr=function(h){var w=h.canvasLayerRef,j=h.height,X=h.page,Q=h.pageIndex,ne=h.plugins,ce=h.rotation,ae=h.scale,$=h.width,oe=h.onRenderCanvasCompleted,se=s.useRef();return i((function(){var Pe=se.current;Pe&&Pe.cancel();var Ae=w.current;Ae.removeAttribute("data-testid"),ne.forEach((function(st){st.onCanvasLayerRender&&st.onCanvasLayerRender({ele:Ae,pageIndex:Q,rotation:ce,scale:ae,status:r.LayerRenderStatus.PreRender})}));var Se=X.getViewport({rotation:ce,scale:ae}),Be=window.devicePixelRatio||1,Le=Math.sqrt(16777216/(Se.width*Se.height)),Me=Be>Le;Me?Ae.style.transform="scale(1, 1)":Ae.style.removeProperty("transform");var mt=Math.min(Le,Be),Qe=(function(st,Mt){var Ct,xt;if(Math.floor(st)===st)return[st,1];var Ot=1/st;if(Ot>Mt)return[1,Mt];if(Math.floor(Ot)===Ot)return[1,Ot];for(var It=st>1?Ot:st,Yt=0,qt=1,cn=1,Ut=1;;){var nn=Yt+cn,Kt=qt+Ut;if(Kt>Mt)break;It<=nn/Kt?(cn=(Ct=[nn,Kt])[0],Ut=Ct[1]):(Yt=(xt=[nn,Kt])[0],qt=xt[1])}return It<(Yt/qt+cn/Ut)/2?It===st?[Yt,qt]:[qt,Yt]:It===st?[cn,Ut]:[Ut,cn]})(mt,8),nt=Qe[0],ot=Qe[1];Ae.width=pr(Se.width*mt,nt),Ae.height=pr(Se.height*mt,nt),Ae.style.width="".concat(pr(Se.width,ot),"px"),Ae.style.height="".concat(pr(Se.height,ot),"px"),Ae.hidden=!0;var Ge=Ae.getContext("2d",{alpha:!1}),ct=Me||Be!==1?[mt,0,0,mt,0,0]:null;return se.current=X.render({canvasContext:Ge,transform:ct,viewport:Se}),se.current.promise.then((function(){Ae.hidden=!1,Ae.setAttribute("data-testid","core__canvas-layer-".concat(Q)),ne.forEach((function(st){st.onCanvasLayerRender&&st.onCanvasLayerRender({ele:Ae,pageIndex:Q,rotation:ce,scale:ae,status:r.LayerRenderStatus.DidRender})})),oe()}),(function(){oe()})),function(){Ae&&(Ae.width=0,Ae.height=0)}}),[]),s.createElement("div",{className:"rpv-core__canvas-layer",style:{height:"".concat(j,"px"),width:"".concat($,"px")}},s.createElement("canvas",{ref:w}))},Jr=function(h){var w=h.height,j=h.page,X=h.rotation,Q=h.scale,ne=h.width,ce=s.useRef();return i((function(){var ae=ce.current,$=j.getViewport({rotation:X,scale:Q});j.getOperatorList().then((function(oe){(function(){var se=ce.current;se&&(se.innerHTML="")})(),new N.SVGGraphics(j.commonObjs,j.objs).getSVG(oe,$).then((function(se){se.style.height="".concat(w,"px"),se.style.width="".concat(ne,"px"),ae.appendChild(se)}))}))}),[]),s.createElement("div",{className:"rpv-core__svg-layer",ref:ce})},Zr=function(h){var w=h.containerRef,j=h.page,X=h.pageIndex,Q=h.plugins,ne=h.rotation,ce=h.scale,ae=h.onRenderTextCompleted,$=s.useRef(),oe=function(){var se=w.current;se&&([].slice.call(se.querySelectorAll(".rpv-core__text-layer-text")).forEach((function(Pe){return se.removeChild(Pe)})),[].slice.call(se.querySelectorAll('br[role="presentation"]')).forEach((function(Pe){return se.removeChild(Pe)})))};return i((function(){var se=$.current;se&&se.cancel();var Pe=w.current;if(Pe){Pe.removeAttribute("data-testid");var Ae=j.getViewport({rotation:ne,scale:ce});return Q.forEach((function(Se){Se.onTextLayerRender&&Se.onTextLayerRender({ele:Pe,pageIndex:X,scale:ce,status:r.LayerRenderStatus.PreRender})})),j.getTextContent().then((function(Se){oe(),$.current=N.renderTextLayer({container:Pe,textContent:Se,textContentSource:Se,viewport:Ae}),$.current.promise.then((function(){Pe.setAttribute("data-testid","core__text-layer-".concat(X)),[].slice.call(Pe.children).forEach((function(Be){Be.classList.contains("rpv-core__text-layer-text--not")||Be.classList.add("rpv-core__text-layer-text")})),Q.forEach((function(Be){Be.onTextLayerRender&&Be.onTextLayerRender({ele:Pe,pageIndex:X,scale:ce,status:r.LayerRenderStatus.DidRender})})),ae()}),(function(){Pe.removeAttribute("data-testid"),ae()}))})),function(){var Se;oe(),(Se=$.current)===null||Se===void 0||Se.cancel()}}}),[]),s.createElement("div",{className:"rpv-core__text-layer",ref:w})},Qr=function(h){var w=h.doc,j=h.measureRef,X=h.outlines,Q=h.pageIndex,ne=h.pageRotation,ce=h.pageSize,ae=h.plugins,$=h.renderPage,oe=h.renderQueueKey,se=h.rotation,Pe=h.scale,Ae=h.shouldRender,Se=h.viewMode,Be=h.onExecuteNamedAction,Le=h.onJumpFromLinkAnnotation,Me=h.onJumpToDest,mt=h.onRenderCompleted,Qe=h.onRotatePage,nt=Ve(),ot=s.useState(null),Ge=ot[0],ct=ot[1],st=s.useState(!1),Mt=st[0],Ct=st[1],xt=s.useState(!1),Ot=xt[0],It=xt[1],Yt=s.useRef(),qt=s.useRef(),cn=Math.abs(se+ne)%180==0,Ut=ce.pageWidth*Pe,nn=ce.pageHeight*Pe,Kt=cn?Ut:nn,Jt=cn?nn:Ut,bn=(ce.rotation+se+ne)%360,zn=s.useRef(0),Vn=$||function(sn){return s.createElement(s.Fragment,null,sn.canvasLayer.children,sn.textLayer.children,sn.annotationLayer.children)};return s.useEffect((function(){ct(null),Ct(!1),It(!1)}),[ne,se,Pe]),s.useEffect((function(){Ae&&nt.current&&!Ge&&Kn(w,Q).then((function(sn){nt.current&&(zn.current=oe,ct(sn))}))}),[Ae,Ge]),s.useEffect((function(){Mt&&Ot&&(oe!==zn.current?(ct(null),Ct(!1),It(!1)):mt(Q))}),[Mt,Ot]),s.createElement("div",{className:d({"rpv-core__page-layer":!0,"rpv-core__page-layer--dual":Se===r.ViewMode.DualPage,"rpv-core__page-layer--dual-cover":Se===r.ViewMode.DualPageWithCover,"rpv-core__page-layer--single":Se===r.ViewMode.SinglePage}),"data-testid":"core__page-layer-".concat(Q),ref:j,style:{height:"".concat(Jt,"px"),width:"".concat(Kt,"px")}},Ge?s.createElement(s.Fragment,null,Vn({annotationLayer:{attrs:{},children:s.createElement(Yr,{doc:w,outlines:X,page:Ge,pageIndex:Q,plugins:ae,rotation:bn,scale:Pe,onExecuteNamedAction:Be,onJumpFromLinkAnnotation:Le,onJumpToDest:Me})},canvasLayer:{attrs:{},children:s.createElement(Kr,{canvasLayerRef:Yt,height:Jt,page:Ge,pageIndex:Q,plugins:ae,rotation:bn,scale:Pe,width:Kt,onRenderCanvasCompleted:function(){nt.current&&Ct(!0)}})},canvasLayerRendered:Mt,doc:w,height:Jt,pageIndex:Q,rotation:bn,scale:Pe,svgLayer:{attrs:{},children:s.createElement(Jr,{height:Jt,page:Ge,rotation:bn,scale:Pe,width:Kt})},textLayer:{attrs:{},children:s.createElement(Zr,{containerRef:qt,page:Ge,pageIndex:Q,plugins:ae,rotation:bn,scale:Pe,onRenderTextCompleted:function(){nt.current&&It(!0)}})},textLayerRendered:Ot,width:Kt,markRendered:mt,onRotatePage:function(sn){return Qe(Q,sn)}}),ae.map((function(sn,Sn){return sn.renderPageLayer?s.createElement(s.Fragment,{key:Sn},sn.renderPageLayer({canvasLayerRef:Yt,canvasLayerRendered:Mt,doc:w,height:Jt,pageIndex:Q,rotation:bn,scale:Pe,textLayerRef:qt,textLayerRendered:Ot,width:Kt})):s.createElement(s.Fragment,{key:Sn})}))):s.createElement(H,{testId:"core__page-layer-loading-".concat(Q)}))},ei=function(h,w){var j=w.rect;return h.height!==j.height||h.width!==j.width?j:h};(function(h){h.Horizontal="Horizontal",h.Vertical="Vertical",h.Both="Both"})(pt||(pt={}));var ti=function(h){return 1-Math.pow(1-h,4)},gr=1e-4,Rr={left:0,top:0},Tr={capture:!1,passive:!0},ni=function(h){var w=h.elementRef,j=h.enableSmoothScroll,X=h.isRtl,Q=h.scrollDirection,ne=h.onSmoothScroll,ce=s.useState(Rr),ae=ce[0],$=ce[1],oe=s.useState(w.current),se=oe[0],Pe=oe[1],Ae=X?-1:1,Se=s.useRef(Q);Se.current=Q;var Be=s.useRef(Rr),Le=s.useRef(!0),Me=s.useCallback((function(){Le.current=!0,j&&$(Be.current),ne(!1)}),[]),mt=s.useCallback((function(){if(se){switch(Se.current){case pt.Horizontal:Be.current={left:Ae*se.scrollLeft,top:0};break;case pt.Both:Be.current={left:Ae*se.scrollLeft,top:se.scrollTop};break;case pt.Vertical:default:Be.current={left:0,top:se.scrollTop}}j&&!Le.current||$(Be.current)}}),[se]);i((function(){Pe(w.current)})),i((function(){if(se)return se.addEventListener("scroll",mt,Tr),function(){se.removeEventListener("scroll",mt,Tr)}}),[se]);var Qe=s.useCallback((function(nt,ot){var Ge=w.current;if(!Ge)return Promise.resolve();var ct={left:0,top:0};switch(Se.current){case pt.Horizontal:ct.left=Ae*nt.left;break;case pt.Both:ct.left=Ae*nt.left,ct.top=nt.top;break;case pt.Vertical:default:ct.top=nt.top}return ot?(Le.current=!1,ne(!0),new Promise((function(st,Mt){(function(Ct,xt,Ot,It,Yt,qt){Yt===void 0&&(Yt=function(Sn){return Sn}),qt===void 0&&(qt=function(){});var cn=0,Ut=0,nn=!1;switch(xt){case pt.Horizontal:Ut=Ct.scrollLeft,cn=0;case pt.Both:Ut=Ct.scrollLeft,cn=Ct.scrollTop;break;case pt.Vertical:default:Ut=0,cn=Ct.scrollTop}var Kt=function(){nn||(nn=!0,Ct.scrollLeft=Ot.left,Ct.scrollTop=Ot.top,qt())};if(Math.abs(cn-Ot.top)<=gr&&xt===pt.Vertical)Kt();else if(Math.abs(Ut-Ot.left)<=gr&&xt===pt.Horizontal)Kt();else{var Jt,bn=-1,zn=Ut-Ot.left,Vn=cn-Ot.top,sn=function(Sn){bn===-1&&(bn=Sn);var $n=Sn-bn,at=Math.min($n/It,1),rt=Yt(at),Xe={left:Ut-zn*rt,top:cn-Vn*rt};switch(xt){case pt.Horizontal:Ct.scrollLeft=Xe.left;break;case pt.Both:Ct.scrollLeft=Xe.left,Ct.scrollTop=Xe.top;break;case pt.Vertical:default:Ct.scrollTop=Xe.top}Math.abs(Xe.top-Ot.top)<=gr&&Math.abs(Xe.left-Ot.left)<=gr&&!nn&&(window.cancelAnimationFrame(Jt),Kt()),$n<It?Jt=window.requestAnimationFrame(sn):window.cancelAnimationFrame(Jt)};Jt=window.requestAnimationFrame(sn)}})(Ge,Se.current,ct,400,ti,(function(){Me(),st()}))}))):new Promise((function(st,Mt){switch(Se.current){case pt.Horizontal:Ge.scrollLeft=ct.left;break;case pt.Both:Ge.scrollLeft=ct.left,Ge.scrollTop=ct.top;break;case pt.Vertical:default:Ge.scrollTop=ct.top}st()}))}),[w]);return{scrollOffset:ae,scrollTo:Qe}},ur=function(h,w,j){return Math.max(h,Math.min(j,w))},ri=function(h,w){if(w!==r.ViewMode.DualPageWithCover)return 0;if(!(function(Q){var ne=Q.length;if(ne===1)return!1;for(var ce=1;ce<ne;ce++)if(Q[ce].height!==Q[0].height||Q[ce].width!==Q[0].width)return!0;return!1})(h))return 2*h[0].width;var j=Ft(h.slice(1),2).map((function(Q){return Q.length===2?Q[0].width+Q[1].width:Q[0].width})),X=[h[0].width].concat(j);return Math.max.apply(Math,X)},ii={left:0,top:0},ai={left:0,top:0},yr={left:0,top:0},si={left:0,top:0},oi={height:0,width:0},kr={left:0,top:0},dr="data-virtual-index",li=[0,.1,.2,.3,.4,.5,.6,.7,.8,.9,1],ci=function(h){var w=h.enableSmoothScroll,j=h.isRtl,X=h.numberOfItems,Q=h.parentRef,ne=h.setRenderRange,ce=h.sizes,ae=h.scrollMode,$=h.viewMode,oe=s.useState(!1),se=oe[0],Pe=oe[1],Ae=s.useCallback((function(at){return Pe(at)}),[]),Se=s.useRef(ae);Se.current=ae;var Be=s.useRef($);Be.current=$;var Le=ae===r.ScrollMode.Wrapped||$===r.ViewMode.DualPageWithCover||$===r.ViewMode.DualPage?pt.Both:ae===r.ScrollMode.Horizontal?pt.Horizontal:pt.Vertical,Me=ni({elementRef:Q,enableSmoothScroll:w,isRtl:j,scrollDirection:Le,onSmoothScroll:Ae}),mt=Me.scrollOffset,Qe=Me.scrollTo,nt=(function(at){var rt=at.elementRef,Xe=s.useState(rt.current),Je=Xe[0],$e=Xe[1],ut=s.useRef(!1),dt=s.useReducer(ei,{height:0,width:0}),Ke=dt[0],Ue=dt[1];return i((function(){rt.current!==Je&&$e(rt.current)})),i((function(){if(Je&&!ut.current){ut.current=!0;var gt=Je.getBoundingClientRect(),wt=gt.height,n=gt.width;Ue({rect:{height:wt,width:n}})}}),[Je]),s.useEffect((function(){if(Je){var gt=new ResizeObserver((function(wt,n){wt.forEach((function(u){if(u.target===Je){var E=u.contentRect,k=E.height,P=E.width;Ue({rect:{height:k,width:P}})}}))}));return gt.observe(Je),function(){gt.unobserve(Je)}}}),[Je]),Ke})({elementRef:Q}),ot=s.useRef({scrollOffset:kr,measurements:[]});ot.current.scrollOffset=mt;var Ge=s.useMemo((function(){return Array(X).fill(-1)}),[]),ct=s.useState(Ge),st=ct[0],Mt=ct[1],Ct=s.useMemo((function(){var at=new IntersectionObserver((function(rt){rt.forEach((function(Xe){var Je=Xe.isIntersecting?Xe.intersectionRatio:-1,$e=Xe.target.getAttribute(dr);if($e){var ut=parseInt($e,10);0<=ut&&ut<X&&Mt((function(dt){return dt[ut]=Je,(function(Ke,Ue,gt){for(var wt,n=0,u=Ue.length;n<u;n++)!wt&&n in Ue||(wt||(wt=Array.prototype.slice.call(Ue,0,n)),wt[n]=Ue[n]);return Ke.concat(wt||Array.prototype.slice.call(Ue))})([],dt)}))}}))}),{threshold:li});return at}),[]),xt=s.useMemo((function(){return ae===r.ScrollMode.Page&&$===r.ViewMode.SinglePage?(function(at,rt,Xe){for(var Je=[],$e=0;$e<at;$e++){var ut={height:Math.max(rt.height,Xe[$e].height),width:Math.max(rt.width,Xe[$e].width)},dt=$e===0?si:Je[$e-1].end,Ke={left:dt.left+ut.width,top:dt.top+ut.height};Je[$e]={index:$e,start:dt,size:ut,end:Ke,visibility:-1}}return Je})(X,nt,ce):$===r.ViewMode.DualPageWithCover?(function(at,rt,Xe,Je){for(var $e=[],ut=0,dt=0,Ke=yr,Ue=0;Ue<at;Ue++){var gt=Ue===0?{height:Je===r.ScrollMode.Page?Math.max(rt.height,Xe[Ue].height):Xe[Ue].height,width:Je===r.ScrollMode.Page?Math.max(rt.width,Xe[Ue].width):Xe[Ue].width}:{height:Je===r.ScrollMode.Page?Math.max(rt.height,Xe[Ue].height):Xe[Ue].height,width:Math.max(rt.width/2,Xe[Ue].width)};Je===r.ScrollMode.Page?Ke=Ue===0?yr:{left:Ue%2==0?gt.width:0,top:Math.floor((Ue-1)/2)*gt.height+$e[0].end.top}:Ue===0?(Ke=yr,ut=Xe[0].height,dt=0):Ue%2==1?(Ke={left:0,top:ut+=dt},dt=Ue===at-1?Xe[Ue].height:Math.max(Xe[Ue].height,Xe[Ue+1].height)):Ke={left:$e[Ue-1].end.left,top:ut};var wt={left:Ke.left+gt.width,top:Ke.top+gt.height};$e[Ue]={index:Ue,start:Ke,size:gt,end:wt,visibility:-1}}return $e})(X,nt,ce,ae):$===r.ViewMode.DualPage?(function(at,rt,Xe,Je){for(var $e=[],ut=0,dt=0,Ke=ai,Ue=0;Ue<at;Ue++){var gt={height:Je===r.ScrollMode.Page?Math.max(rt.height,Xe[Ue].height):Xe[Ue].height,width:Math.max(rt.width/2,Xe[Ue].width)};Je===r.ScrollMode.Page?Ke={left:Ue%2==0?0:gt.width,top:Math.floor(Ue/2)*gt.height}:Ue%2==0?(Ke={left:0,top:ut+=dt},dt=Ue===at-1?Xe[Ue].height:Math.max(Xe[Ue].height,Xe[Ue+1].height)):Ke={left:$e[Ue-1].end.left,top:ut};var wt={left:Ke.left+gt.width,top:Ke.top+gt.height};$e[Ue]={index:Ue,start:Ke,size:gt,end:wt,visibility:-1}}return $e})(X,nt,ce,ae):(function(at,rt,Xe,Je){for(var $e=[],ut=0,dt={left:0,top:0},Ke=0,Ue=ii,gt=0;gt<at;gt++){var wt=Xe[gt];if(gt===0)ut=wt.width,dt={left:0,top:0},Ke=wt.height;else switch(Je){case r.ScrollMode.Wrapped:(ut+=wt.width)<rt.width?(Ue={left:$e[gt-1].end.left,top:dt.top},Ke=Math.max(Ke,wt.height)):(ut=wt.width,dt={left:(Ue={left:dt.left,top:dt.top+Ke}).left,top:Ue.top},Ke=wt.height);break;case r.ScrollMode.Horizontal:case r.ScrollMode.Vertical:default:Ue=$e[gt-1].end}var n={left:Ue.left+wt.width,top:Ue.top+wt.height};$e[gt]={index:gt,start:Ue,size:wt,end:n,visibility:-1}}return $e})(X,nt,ce,ae)}),[ae,ce,$,nt]),Ot=xt[X-1]?{height:xt[X-1].end.top,width:xt[X-1].end.left}:oi;ot.current.measurements=xt;var It=s.useMemo((function(){var at=(function(gt,wt,n,u){var E=0;switch(gt){case pt.Horizontal:E=u.left;break;case pt.Vertical:default:E=u.top}var k=wt.length-1,P=(function(J,le,de,pe){for(;J<=le;){var Te=(J+le)/2|0,_e=pe(Te);if(_e<de)J=Te+1;else{if(!(_e>de))return Te;le=Te-1}}return J>0?J-1:0})(0,k,E,(function(J){switch(gt){case pt.Horizontal:return wt[J].start.left;case pt.Both:case pt.Vertical:default:return wt[J].start.top}}));if(gt===pt.Both)for(var F=wt[P].start.top;P-1>=0&&wt[P-1].start.top===F&&wt[P-1].start.left>=u.left;)P--;for(var D=P;D<=k;){var z={top:wt[D].start.top-u.top,left:wt[D].start.left-u.left},x={height:n.height-z.top,width:n.width-z.left};if(gt===pt.Horizontal&&x.width<0||gt===pt.Vertical&&x.height<0||gt===pt.Both&&(x.width<0||x.height<0))break;D++}return{start:P,end:D}})(Le,xt,nt,mt),rt=at.start,Xe=at.end,Je=st.slice(ur(0,X,rt),ur(0,X,Xe)),$e=rt+Je.reduce((function(gt,wt,n,u){return wt>u[gt]?n:gt}),0),ut=$e=ur(0,X-1,$e),dt=ne({endPage:Xe,numPages:X,startPage:rt}),Ke=dt.startPage,Ue=dt.endPage;switch(Ke=Math.max(Ke,0),Ue=Math.min(Ue,X-1),$){case r.ViewMode.DualPageWithCover:$e>0&&(ut=$e%2==1?$e:$e-1),Ke=Ke===0?0:Ke%2==1?Ke:Ke-1,X-(Ue=Ue%2==1?Ue-1:Ue)<=2&&(Ue=X-1);break;case r.ViewMode.DualPage:ut=$e%2==0?$e:$e-1,Ke=Ke%2==0?Ke:Ke-1,Ue=Ue%2==1?Ue:Ue-1;break;case r.ViewMode.SinglePage:default:ut=$e}return{startPage:Ke,endPage:Ue,maxVisbilityIndex:ut}}),[xt,nt,mt,$,st]),Yt=It.startPage,qt=It.endPage,cn=It.maxVisbilityIndex,Ut=s.useMemo((function(){for(var at=[],rt=function(Je){var $e=xt[Je],ut=t(t({},$e),{visibility:st[Je]!==void 0?st[Je]:-1,measureRef:function(dt){dt&&(dt.setAttribute(dr,"".concat(Je)),Ct.observe(dt))}});at.push(ut)},Xe=Yt;Xe<=qt;Xe++)rt(Xe);return at}),[Yt,qt,st,xt]),nn=s.useCallback((function(at,rt){var Xe=ot.current.measurements[ur(0,X-1,at)],Je=Se.current===r.ScrollMode.Page?kr:rt;return Xe?Qe({left:Je.left+Xe.start.left,top:Je.top+Xe.start.top},w):Promise.resolve()}),[Qe,w]),Kt=s.useCallback((function(at,rt){var Xe=ot.current.measurements,Je=Xe[at].start,$e=Xe.find((function(dt){return dt.start.top-Je.top>1e-12}));if(!$e)return Promise.resolve();var ut=$e.index;switch(Be.current){case r.ViewMode.DualPage:ut=ut%2==0?ut:ut+1;break;case r.ViewMode.DualPageWithCover:ut=ut%2==1?ut:ut+1}return nn(ut,rt)}),[]),Jt=s.useCallback((function(at,rt){for(var Xe=ot.current.measurements,Je=Xe[at].start,$e=at,ut=!1,dt=X-1;dt>=0;dt--)if(Je.top-Xe[dt].start.top>1e-12){ut=!0,$e=Xe[dt].index;break}if(!ut)return Promise.resolve();switch(Be.current){case r.ViewMode.DualPage:$e=$e%2==0?$e:$e-1;break;case r.ViewMode.DualPageWithCover:$e=$e%2==0?$e-1:$e}return $e===at&&($e=at-1),nn($e,rt)}),[]),bn=s.useCallback((function(at,rt){if(Be.current===r.ViewMode.DualPageWithCover||Be.current===r.ViewMode.DualPage)return Kt(at,rt);switch(Se.current){case r.ScrollMode.Wrapped:return Kt(at,rt);case r.ScrollMode.Horizontal:case r.ScrollMode.Vertical:default:return nn(at+1,rt)}}),[]),zn=s.useCallback((function(at,rt){if(Be.current===r.ViewMode.DualPageWithCover||Be.current===r.ViewMode.DualPage)return Jt(at,rt);switch(Se.current){case r.ScrollMode.Wrapped:return Jt(at,rt);case r.ScrollMode.Horizontal:case r.ScrollMode.Vertical:default:return nn(at-1,rt)}}),[]),Vn=s.useCallback((function(){return(function(at,rt){switch(rt){case r.ScrollMode.Horizontal:return{position:"relative",height:"100%",width:"".concat(at.width,"px")};case r.ScrollMode.Vertical:default:return{position:"relative",height:"".concat(at.height,"px"),width:"100%"}}})(Ot,Se.current)}),[Ot]),sn=s.useCallback((function(at){return(function(rt,Xe,Je){return Je!==r.ScrollMode.Page?{}:{height:"".concat(Xe.height,"px"),width:"100%",position:"absolute",top:0,transform:"translateY(".concat(rt.start.top,"px)")}})(at,nt,Se.current)}),[nt]),Sn=s.useCallback((function(at){return(function(rt,Xe,Je,$e,ut){var dt,Ke,Ue,gt,wt,n,u,E=Xe?"right":"left",k=Xe?-1:1,P=Je.length,F=rt.start.left*k,D=rt.size,z=D.height,x=D.width;if($e===r.ViewMode.DualPageWithCover){var J=ut===r.ScrollMode.Page?0:rt.start.top;return rt.index===0||P%2==0&&rt.index===P-1?((dt={height:"".concat(z,"px"),minWidth:"".concat(ri(Je,$e),"px"),width:"100%"})[E]=0,dt.position="absolute",dt.top=0,dt.transform="translate(".concat(F,"px, ").concat(J,"px)"),dt):((Ke={height:"".concat(z,"px"),width:"".concat(x,"px")})[E]=0,Ke.position="absolute",Ke.top=0,Ke.transform="translate(".concat(F,"px, ").concat(J,"px)"),Ke)}if($e===r.ViewMode.DualPage)return(Ue={height:"".concat(z,"px"),width:"".concat(x,"px")})[E]=0,Ue.position="absolute",Ue.top=0,Ue.transform="translate(".concat(F,"px, ").concat(ut===r.ScrollMode.Page?0:rt.start.top,"px)"),Ue;switch(ut){case r.ScrollMode.Horizontal:return(gt={height:"100%",width:"".concat(x,"px")})[E]=0,gt.position="absolute",gt.top=0,gt.transform="translateX(".concat(F,"px)"),gt;case r.ScrollMode.Page:return(wt={height:"".concat(z,"px"),width:"".concat(x,"px")})[E]=0,wt.position="absolute",wt.top=0,wt;case r.ScrollMode.Wrapped:return(n={height:"".concat(z,"px"),width:"".concat(x,"px")})[E]=0,n.position="absolute",n.top=0,n.transform="translate(".concat(F,"px, ").concat(rt.start.top,"px)"),n;case r.ScrollMode.Vertical:default:return(u={height:"".concat(z,"px"),width:"100%"})[E]=0,u.position="absolute",u.top=0,u.transform="translateY(".concat(rt.start.top,"px)"),u}})(at,j,ce,Be.current,Se.current)}),[j,ce]),$n=s.useCallback((function(at,rt){var Xe=ot.current,Je=Xe.measurements,$e=Xe.scrollOffset,ut=Je[ur(0,X-1,rt)];if(ut){var dt=Se.current===r.ScrollMode.Page?{left:ut.start.left,top:ut.start.top}:{left:$e.left*at,top:$e.top*at};return Qe(dt,!1)}return Promise.resolve()}),[]);return s.useEffect((function(){return function(){Ct.disconnect()}}),[]),{boundingClientRect:nt,isSmoothScrolling:se,startPage:Yt,endPage:qt,maxVisbilityIndex:cn,virtualItems:Ut,getContainerStyles:Vn,getItemContainerStyles:sn,getItemStyles:Sn,scrollToItem:nn,scrollToNextItem:bn,scrollToPreviousItem:zn,zoom:$n}},Sr=function(h,w,j,X,Q,ne){var ce=j;switch(!0){case(Q===r.ViewMode.DualPageWithCover&&ne>=3):case(Q===r.ViewMode.DualPage&&ne>=3):ce=2*j;break;default:ce=j}switch(X){case r.SpecialZoomLevel.ActualSize:return 1;case r.SpecialZoomLevel.PageFit:return Math.min((h.clientWidth-17)/ce,(h.clientHeight-16)/w);case r.SpecialZoomLevel.PageWidth:return(h.clientWidth-17)/ce}},ui=function(h){var w,j,X=h.getCurrentPage,Q=(w=50,j=s.useRef([]),s.useEffect((function(){return function(){j.current=[]}}),[]),{push:function(oe){var se=j.current;se.length+1>w&&se.shift(),se.push(oe),j.current=se},map:function(oe){return j.current.map((function(se){return oe(se)}))},pop:function(){var oe=j.current;if(oe.length===0)return null;var se=oe.pop();return j.current=oe,se}}),ne=(function(oe){var se=s.useRef([]);return s.useEffect((function(){return function(){se.current=[]}}),[]),{dequeue:function(){var Pe=se.current;if(Pe.length===0)return null;var Ae=Pe.shift();return se.current=Pe,Ae||null},enqueue:function(Pe){var Ae=se.current;Ae.length+1>oe&&Ae.pop(),se.current=[Pe].concat(Ae)},map:function(Pe){return se.current.map((function(Ae){return Pe(Ae)}))}}})(50),ce=function(){var oe=ne.dequeue();return oe&&Q.push(oe),oe&&oe.pageIndex===X()?ce():oe},ae=function(){var oe=Q.pop();return oe&&ne.enqueue(oe),oe&&oe.pageIndex===X()?ae():oe},$=s.useCallback((function(oe){Q.push(oe)}),[]);return{getNextDestination:ce,getPreviousDestination:ae,markVisitedDestination:$}},Mr=function(h){var w=[];return h.map((function(j){w=w.concat(j).concat((function(X){var Q=[];return X.items&&X.items.length>0&&(Q=Q.concat(Mr(X.items))),Q})(j))})),w},xr={capture:!1,passive:!0},di={height:0,width:0},wr={height:0,width:0},Ht=function(h){var w=h.getCurrentPage,j=h.getCurrentScrollMode,X=h.jumpToPage,Q=h.targetRef,ne=s.useState(r.FullScreenMode.Normal),ce=ne[0],ae=ne[1],$=(function(){var st=s.useState(di),Mt=st[0],Ct=st[1],xt=Oe((function(){Ct({height:window.innerHeight,width:window.innerWidth})}),100);return i((function(){return window.addEventListener("resize",xt,xr),function(){window.removeEventListener("resize",xt,xr)}}),[]),Mt})(),oe=s.useState(wr),se=oe[0],Pe=oe[1],Ae=s.useRef(wr),Se=s.useRef(w()),Be=s.useRef(wr),Le=s.useState(Q.current),Me=Le[0],mt=Le[1],Qe=s.useRef();i((function(){Q.current!==Me&&mt(Q.current)}),[]),i((function(){if(Me){var st=new ResizeObserver((function(Mt){Mt.forEach((function(Ct){var xt=Ct.target.getBoundingClientRect(),Ot=xt.height,It=xt.width;Pe({height:Ot,width:It})}))}));return st.observe(Me),function(){st.unobserve(Me),st.disconnect()}}}),[Me]);var nt=s.useCallback((function(st){var Mt=ke();return Mt&&Mt!==st?(ae(r.FullScreenMode.Normal),Ne(Mt)):Promise.resolve()}),[]),ot=s.useCallback((function(st){st&&ge()&&(mt(st),nt(st).then((function(){Qe.current=st,ae(r.FullScreenMode.Entering),(function(Mt){Y&&Mt[he.RequestFullScreen]()})(st)})))}),[]),Ge=s.useCallback((function(){ke()&&(ae(r.FullScreenMode.Exitting),Ne(document))}),[]),ct=s.useCallback((function(){Me&&ke()!==Me&&ae(r.FullScreenMode.Exitting)}),[Me]);return s.useEffect((function(){switch(ce){case r.FullScreenMode.Entering:Qe.current&&(Qe.current.style.backgroundColor="var(--rpv-core__full-screen-target-background-color)"),Se.current=w(),Ae.current={height:window.innerHeight,width:window.innerWidth};break;case r.FullScreenMode.Entered:j()===r.ScrollMode.Page?X(Se.current).then((function(){ae(r.FullScreenMode.EnteredCompletely)})):ae(r.FullScreenMode.EnteredCompletely);break;case r.FullScreenMode.Exitting:Qe.current&&(Qe.current.style.backgroundColor="",Qe.current=null),Se.current=w();break;case r.FullScreenMode.Exited:ae(r.FullScreenMode.Normal),j()===r.ScrollMode.Page&&X(Se.current)}}),[ce]),s.useEffect((function(){if(ce!==r.FullScreenMode.Normal)return ce===r.FullScreenMode.Entering&&$.height===se.height&&$.width===se.width&&$.height>0&&$.width>0&&(Be.current.height===0||$.height==Be.current.height)?(Be.current={height:window.innerHeight,width:window.innerWidth},void ae(r.FullScreenMode.Entered)):void(ce===r.FullScreenMode.Exitting&&Ae.current.height===$.height&&Ae.current.width===$.width&&$.height>0&&$.width>0&&ae(r.FullScreenMode.Exited))}),[ce,$,se]),s.useEffect((function(){var st;return st=ct,Y&&document.addEventListener(he.FullScreenChange,st),function(){(function(Mt){Y&&document.removeEventListener(he.FullScreenChange,Mt)})(ct)}}),[Me]),{enterFullScreenMode:ot,exitFullScreenMode:Ge,fullScreenMode:ce}},hi={buildPageStyles:function(){return{}},transformSize:function(h){return h.size}},Xn={left:0,top:0},fi=function(h){var w=h.currentFile,j=h.defaultScale,X=h.doc,Q=h.enableSmoothScroll,ne=h.initialPage,ce=h.initialRotation,ae=h.initialScale,$=h.pageLayout,oe=h.pageSizes,se=h.plugins,Pe=h.renderPage,Ae=h.scrollMode,Se=h.setRenderRange,Be=h.viewMode,Le=h.viewerState,Me=h.onDocumentLoad,mt=h.onOpenFile,Qe=h.onPageChange,nt=h.onRotate,ot=h.onRotatePage,Ge=h.onZoom,ct=X.numPages,st=X.loadingTask.docId,Mt=s.useContext(C).l10n,Ct=s.useContext(g),xt=Ct.direction===r.TextDirection.RightToLeft,Ot=s.useRef(),It=s.useRef(),Yt=s.useState(ne),qt=Yt[0],cn=Yt[1],Ut=s.useRef(null),nn=ui({getCurrentPage:function(){return P.current.pageIndex}}),Kt=s.useState(ce),Jt=Kt[0],bn=Kt[1],zn=Ee(Jt),Vn=s.useState(!1),sn=Vn[0],Sn=Vn[1],$n=s.useState(new Map),at=$n[0],rt=$n[1],Xe=s.useState(Ae),Je=Xe[0],$e=Xe[1],ut=Ee(Je),dt=s.useState(Be),Ke=dt[0],Ue=dt[1],gt=Ee(Ke),wt=(function(be){var Ze=Ve(),Et=s.useState([]),Lt=Et[0],Tt=Et[1];return s.useEffect((function(){be.getOutline().then((function(ft){if(Ze.current&&ft!==null){var rn=Mr(ft);Tt(rn)}}))}),[]),Lt})(X),n=s.useState(ae),u=n[0],E=n[1],k=Ee(u),P=s.useRef(Le),F=s.useRef(typeof j=="string"?j:null),D=s.useRef(-1),z=s.useRef(-1),x=s.useRef(ne),J=Ht({getCurrentPage:function(){return P.current.pageIndex},getCurrentScrollMode:function(){return P.current.scrollMode},jumpToPage:function(be){return Qt(be)},targetRef:It}),le=s.useState(-1),de=le[0],pe=le[1],Te=s.useState(0),_e=Te[0],Ie=Te[1],we=m({doc:X});s.useEffect((function(){return function(){hn.clear(),jn.clear()}}),[st]);var Ye=s.useMemo((function(){return Object.assign({},hi,$)}),[]),ze=s.useMemo((function(){return Array(ct).fill(0).map((function(be,Ze){var Et=[oe[Ze].pageHeight,oe[Ze].pageWidth],Lt=Math.abs(Jt)%180==0?{height:Et[0],width:Et[1]}:{height:Et[1],width:Et[0]},Tt={height:Lt.height*u,width:Lt.width*u};return Ye.transformSize({numPages:ct,pageIndex:Ze,size:Tt})}))}),[Jt,u]),je=ci({enableSmoothScroll:Q,isRtl:xt,numberOfItems:ct,parentRef:It,scrollMode:Je,setRenderRange:Se,sizes:ze,viewMode:Ke}),Nt=Oe((function(){!F.current||P.current.fullScreenMode!==r.FullScreenMode.Normal||ne>0&&x.current===ne||xn(F.current)}),200);(function(be){var Ze=be.targetRef,Et=be.onResize;i((function(){var Lt=new ResizeObserver((function(ft){ft.forEach((function(rn){Et(rn.target)}))})),Tt=Ze.current;if(Tt)return Lt.observe(Tt),function(){Lt.unobserve(Tt)}}),[])})({targetRef:It,onResize:Nt});var ht=function(be){var Ze=be;se.forEach((function(Et){Et.onViewerStateChange&&(Ze=Et.onViewerStateChange(Ze))})),P.current=Ze},et=function(){return It.current},it=function(){return P.current},$t=s.useCallback((function(be){nn.markVisitedDestination(be)}),[]),fn=s.useCallback((function(be){var Ze=be.pageIndex,Et=be.bottomOffset,Lt=be.leftOffset,Tt=be.scaleTo,ft=It.current,rn=P.current;return ft&&rn?new Promise((function(Dn,Pt){Kn(X,Ze).then((function(In){var Rn=In.getViewport({scale:1}),Tn=0,Nn=(typeof Et=="function"?Et(Rn.width,Rn.height):Et)||0,un=(typeof Lt=="function"?Lt(Rn.width,Rn.height):Lt)||0,tr=rn.scale;switch(Tt){case r.SpecialZoomLevel.PageFit:Tn=0,un=0,xn(r.SpecialZoomLevel.PageFit);break;case r.SpecialZoomLevel.PageWidth:tr=Sr(ft,oe[Ze].pageHeight,oe[Ze].pageWidth,r.SpecialZoomLevel.PageWidth,Be,ct),Tn=(Rn.height-Nn)*tr,un*=tr,xn(tr);break;default:Tn=(Rn.height-Nn)*tr,un*=tr}switch(rn.scrollMode){case r.ScrollMode.Horizontal:je.scrollToItem(Ze,{left:un,top:0}).then((function(){Dn()}));break;case r.ScrollMode.Vertical:default:je.scrollToItem(Ze,{left:0,top:Tn}).then((function(){Dn()}))}}))})):Promise.resolve()}),[]),Zt=s.useCallback((function(be){return nn.markVisitedDestination(be),fn(be)}),[]),Cn=s.useCallback((function(){var be=nn.getNextDestination();return be?fn(be):Promise.resolve()}),[]),on=s.useCallback((function(){var be=nn.getPreviousDestination();return be?fn(be):Promise.resolve()}),[]),Ln=s.useCallback((function(){return je.scrollToNextItem(P.current.pageIndex,Xn)}),[]),Qt=s.useCallback((function(be){return 0<=be&&be<ct?je.scrollToItem(be,Xn):Promise.resolve()}),[]),Zn=s.useCallback((function(){return je.scrollToPreviousItem(P.current.pageIndex,Xn)}),[]),On=s.useCallback((function(be){var Ze,Et;(Ze=be.name,Et=Ze.split(/\./).pop(),Et?Et.toLowerCase():"").toLowerCase()==="pdf"&&new Promise((function(Lt){var Tt=new FileReader;Tt.readAsArrayBuffer(be),Tt.onload=function(){var ft=new Uint8Array(Tt.result);Lt(ft)}})).then((function(Lt){mt(be.name,Lt)}))}),[mt]),wn=s.useCallback((function(be){var Ze=be===r.RotateDirection.Backward?-90:90,Et=P.current.rotation,Lt=Et===360||Et===-360?Ze:Et+Ze;we.markNotRendered(),bn(Lt),ht(t(t({},P.current),{rotation:Lt})),nt({direction:be,doc:X,rotation:Lt})}),[]),En=s.useCallback((function(be,Ze){var Et=Ze===r.RotateDirection.Backward?-90:90,Lt=P.current.pagesRotation,Tt=(Lt.has(be)?Lt.get(be):ce)+Et,ft=Lt.set(be,Tt);rt(ft),Sn((function(rn){return!rn})),ht(t(t({},P.current),{pagesRotation:ft,rotatedPage:be})),ot({direction:Ze,doc:X,pageIndex:be,rotation:Tt}),we.markRendering(be),pe(be)}),[]),pn=s.useCallback((function(be){ht(t(t({},P.current),{scrollMode:be})),$e(be)}),[]),Mn=s.useCallback((function(be){ht(t(t({},P.current),{viewMode:be})),Ue(be)}),[]),xn=s.useCallback((function(be){var Ze=It.current,Et=P.current.pageIndex;if(!(Et<0||Et>=ct)){var Lt=oe[Et].pageHeight,Tt=oe[Et].pageWidth,ft=Ze?typeof be=="string"?Sr(Ze,Lt,Tt,be,P.current.viewMode,ct):be:1;F.current=typeof be=="string"?be:null,ft!==P.current.scale&&(Ie((function(rn){return rn+1})),we.markNotRendered(),E(ft),Ge({doc:X,scale:ft}),ht(t(t({},P.current),{scale:ft})))}}),[]),Yn=s.useCallback((function(be){J.enterFullScreenMode(be)}),[]),er=s.useCallback((function(){J.exitFullScreenMode()}),[]);s.useEffect((function(){ht(t(t({},P.current),{fullScreenMode:J.fullScreenMode}))}),[J.fullScreenMode]),s.useEffect((function(){var be={enterFullScreenMode:Yn,exitFullScreenMode:er,getPagesContainer:et,getViewerState:it,jumpToDestination:Zt,jumpToNextDestination:Cn,jumpToPreviousDestination:on,jumpToNextPage:Ln,jumpToPreviousPage:Zn,jumpToPage:Qt,openFile:On,rotate:wn,rotatePage:En,setViewerState:ht,switchScrollMode:pn,switchViewMode:Mn,zoom:xn};return se.forEach((function(Ze){Ze.install&&Ze.install(be)})),function(){se.forEach((function(Ze){Ze.uninstall&&Ze.uninstall(be)}))}}),[st]),s.useEffect((function(){Me({doc:X,file:w}),se.forEach((function(be){be.onDocumentLoad&&be.onDocumentLoad({doc:X,file:w})}))}),[st]);var qn,Gn,_t,At=je.boundingClientRect;qn=function(){ne&&Qt(ne)},Gn=At.height>0&&At.width>0,_t=s.useRef(!1),i((function(){Gn&&!_t.current&&(_t.current=!0,qn())}),[qn,Gn]),i((function(){var be=P.current.pageIndex;be>-1&&ut!==Je&&je.scrollToItem(be,Xn).then((function(){J.fullScreenMode===r.FullScreenMode.EnteredCompletely&&(Q||we.markNotRendered(),D.current=-1)}))}),[Je]),i((function(){var be=P.current.pageIndex;be>-1&&zn!==Jt&&je.scrollToItem(be,Xn)}),[Jt]),i((function(){k!=0&&k!=P.current.scale&&je.zoom(P.current.scale/k,P.current.pageIndex).then((function(){J.fullScreenMode===r.FullScreenMode.EnteredCompletely&&(z.current=-1)}))}),[u]),i((function(){if(gt!==P.current.viewMode){var be=je.startPage,Ze=je.endPage,Et=je.virtualItems;we.markNotRendered(),we.setRange(be,Ze);for(var Lt=function(ft){var rn=Et.find((function(Dn){return Dn.index===ft}));rn&&we.setVisibility(ft,rn.visibility)},Tt=be;Tt<=Ze;Tt++)Lt(Tt);Rt()}}),[Ke]),i((function(){var be=P.current.pageIndex;be>-1&>!==Ke&&je.scrollToItem(be,Xn)}),[Ke]),i((function(){var be=P.current.pageIndex;be>0&&be===ne&&x.current===ne&&F.current&&(x.current=-1,xn(F.current))}),[qt]),s.useEffect((function(){je.isSmoothScrolling||Ut.current!==null&&Ut.current===qt||(Ut.current=qt,Qe({currentPage:qt,doc:X}))}),[qt,je.isSmoothScrolling]),s.useEffect((function(){J.fullScreenMode===r.FullScreenMode.Entering&&P.current.scrollMode===r.ScrollMode.Page&&(D.current=P.current.pageIndex),J.fullScreenMode===r.FullScreenMode.EnteredCompletely&&P.current.scrollMode===r.ScrollMode.Page&&Q&&(D.current=-1),J.fullScreenMode===r.FullScreenMode.EnteredCompletely&&F.current&&(z.current=P.current.pageIndex,xn(F.current))}),[J.fullScreenMode]),s.useEffect((function(){if(J.fullScreenMode!==r.FullScreenMode.Entering&&J.fullScreenMode!==r.FullScreenMode.Exitting&&!je.isSmoothScrolling){var be=je.startPage,Ze=je.endPage,Et=je.maxVisbilityIndex,Lt=je.virtualItems,Tt=Et,ft=J.fullScreenMode===r.FullScreenMode.Entered||J.fullScreenMode===r.FullScreenMode.EnteredCompletely;if(!(ft&&Tt!==D.current&&D.current>-1||ft&&Tt!==z.current&&z.current>-1)){cn(Tt),ht(t(t({},P.current),{pageIndex:Tt})),we.setRange(be,Ze);for(var rn=function(Pt){var In=Lt.find((function(Rn){return Rn.index===Pt}));In&&we.setVisibility(Pt,In.visibility)},Dn=be;Dn<=Ze;Dn++)rn(Dn);Rt()}}}),[je.startPage,je.endPage,je.isSmoothScrolling,je.maxVisbilityIndex,J.fullScreenMode,sn,Jt,u]);var Vt=s.useCallback((function(be){we.markRendered(be),Rt()}),[_e]),Rt=function(){var be=we.getHighestPriorityPage();be>-1&&we.isInRange(be)&&(we.markRendering(be),pe(be))},yt=function(be){var Ze=qt-1,Et=qt+1;switch(be){case"FirstPage":Qt(0);break;case"LastPage":Qt(ct-1);break;case"NextPage":Et<ct&&Qt(Et);break;case"PrevPage":Ze>=0&&Qt(Ze)}},Wt=s.useCallback((function(){var be=je.virtualItems,Ze=[];switch(Ke){case r.ViewMode.DualPage:Ze=Ft(be,2);break;case r.ViewMode.DualPageWithCover:be.length&&(Ze=be[0].index===0?[[be[0]]].concat(Ft(be.slice(1),2)):Ft(be,2));break;case r.ViewMode.SinglePage:default:Ze=Ft(be,1)}var Et=Mt&&Mt.core?Mt.core.pageLabel:"Page {{pageIndex}}",Lt={attrs:{className:"rpv-core__inner-container","data-testid":"core__inner-container",ref:Ot,style:{height:"100%"}},children:s.createElement(s.Fragment,null),subSlot:{attrs:{"data-testid":"core__inner-pages",className:d({"rpv-core__inner-pages":!0,"rpv-core__inner-pages--horizontal":Je===r.ScrollMode.Horizontal,"rpv-core__inner-pages--rtl":xt,"rpv-core__inner-pages--single":Je===r.ScrollMode.Page,"rpv-core__inner-pages--vertical":Je===r.ScrollMode.Vertical,"rpv-core__inner-pages--wrapped":Je===r.ScrollMode.Wrapped}),ref:It,style:{height:"100%",position:"relative"}},children:s.createElement("div",{"data-testid":"core__inner-current-page-".concat(qt),style:Object.assign({"--scale-factor":u},je.getContainerStyles())},Ze.map((function(Tt){return s.createElement("div",{className:d({"rpv-core__inner-page-container":!0,"rpv-core__inner-page-container--single":Je===r.ScrollMode.Page}),style:je.getItemContainerStyles(Tt[0]),key:"".concat(Tt[0].index,"-").concat(Ke)},Tt.map((function(ft){var rn=Ke===r.ViewMode.DualPageWithCover&&(ft.index===0||ct%2==0&&ft.index===ct-1);return s.createElement("div",{"aria-label":Et.replace("{{pageIndex}}","".concat(ft.index+1)),className:d({"rpv-core__inner-page":!0,"rpv-core__inner-page--dual-even":Ke===r.ViewMode.DualPage&&ft.index%2==0,"rpv-core__inner-page--dual-odd":Ke===r.ViewMode.DualPage&&ft.index%2==1,"rpv-core__inner-page--dual-cover":rn,"rpv-core__inner-page--dual-cover-even":Ke===r.ViewMode.DualPageWithCover&&!rn&&ft.index%2==0,"rpv-core__inner-page--dual-cover-odd":Ke===r.ViewMode.DualPageWithCover&&!rn&&ft.index%2==1,"rpv-core__inner-page--single":Ke===r.ViewMode.SinglePage&&Je===r.ScrollMode.Page}),role:"region",key:"".concat(ft.index,"-").concat(Ke),style:Object.assign({},je.getItemStyles(ft),Ye.buildPageStyles({numPages:ct,pageIndex:ft.index,scrollMode:Je,viewMode:Ke}))},s.createElement(Qr,{doc:X,measureRef:ft.measureRef,outlines:wt,pageIndex:ft.index,pageRotation:at.has(ft.index)?at.get(ft.index):0,pageSize:oe[ft.index],plugins:se,renderPage:Pe,renderQueueKey:_e,rotation:Jt,scale:u,shouldRender:de===ft.index,viewMode:Ke,onExecuteNamedAction:yt,onJumpFromLinkAnnotation:$t,onJumpToDest:Zt,onRenderCompleted:Vt,onRotatePage:En}))})))})))}};return se.forEach((function(Tt){Tt.renderViewer&&(Lt=Tt.renderViewer({containerRef:Ot,doc:X,pagesContainerRef:It,pagesRotation:at,pageSizes:oe,rotation:Jt,slot:Lt,themeContext:Ct,jumpToPage:Qt,openFile:On,rotate:wn,rotatePage:En,switchScrollMode:pn,switchViewMode:Mn,zoom:xn}))})),Lt}),[se,je]),zt=s.useCallback((function(be){return s.createElement("div",t({},be.attrs,{style:be.attrs&&be.attrs.style?be.attrs.style:{}}),be.children,be.subSlot&&zt(be.subSlot))}),[]);return zt(Wt())},Er=[.1,.2,.3,.4,.5,.6,.7,.8,.9,1,1.1,1.3,1.5,1.7,1.9,2.1,2.4,2.7,3,3.3,3.7,4.1,4.6,5.1,5.7,6.3,7,7.7,8.5,9.4,10],Fr=function(h){var w=h.defaultScale,j=h.doc,X=h.render,Q=h.scrollMode,ne=h.viewMode,ce=s.useRef(),ae=s.useState({pageSizes:[],scale:0}),$=ae[0],oe=ae[1];return s.useLayoutEffect((function(){var se=Array(j.numPages).fill(0).map((function(Pe,Ae){return new Promise((function(Se,Be){Kn(j,Ae).then((function(Le){var Me=Le.getViewport({scale:1});Se({pageHeight:Me.height,pageWidth:Me.width,rotation:Me.rotation})}))}))}));Promise.all(se).then((function(Pe){var Ae=ce.current;if(Ae&&Pe.length!==0){var Se=Pe[0].pageWidth,Be=Pe[0].pageHeight,Le=Ae.parentElement,Me=(Le.clientWidth-45)/Se,mt=(Le.clientHeight-45)/Be,Qe=Me;switch(Q){case r.ScrollMode.Horizontal:Qe=Math.min(Me,mt);break;case r.ScrollMode.Vertical:default:Qe=Me}var nt,ot,Ge=w?typeof w=="string"?Sr(Le,Be,Se,w,ne,j.numPages):w:(nt=Qe,(ot=Er.findIndex((function(ct){return ct>=nt})))===-1||ot===0?nt:Er[ot-1]);oe({pageSizes:Pe,scale:Ge})}}))}),[j.loadingTask.docId]),$.pageSizes.length===0||$.scale===0?s.createElement("div",{className:"rpv-core__page-size-calculator","data-testid":"core__page-size-calculating",ref:ce},s.createElement(H,null)):X($.pageSizes,$.scale)},mr=function(){},Ar=(function(h){function w(j,X){var Q=h.call(this)||this;return Q.verifyPassword=j,Q.passwordStatus=X,Q}return U(w,h),w})(mr),hr=function(h){var w=h.passwordStatus,j=h.renderProtectedView,X=h.verifyPassword,Q=h.onDocumentAskPassword,ne=s.useContext(C).l10n,ce=s.useState(""),ae=ce[0],$=ce[1],oe=s.useContext(g).direction===r.TextDirection.RightToLeft,se=function(){return X(ae)};return s.useEffect((function(){Q&&Q({verifyPassword:X})}),[]),j?j({passwordStatus:w,verifyPassword:X}):s.createElement("div",{className:"rpv-core__asking-password-wrapper"},s.createElement("div",{className:d({"rpv-core__asking-password":!0,"rpv-core__asking-password--rtl":oe})},s.createElement("div",{className:"rpv-core__asking-password-message"},w===r.PasswordStatus.RequiredPassword&&ne.core.askingPassword.requirePasswordToOpen,w===r.PasswordStatus.WrongPassword&&ne.core.wrongPassword.tryAgain),s.createElement("div",{className:"rpv-core__asking-password-body"},s.createElement("div",{className:d({"rpv-core__asking-password-input":!0,"rpv-core__asking-password-input--ltr":!oe,"rpv-core__asking-password-input--rtl":oe})},s.createElement(I,{testId:"core__asking-password-input",type:"password",value:ae,onChange:$,onKeyDown:function(Pe){Pe.key==="Enter"&&se()}})),s.createElement(T,{onClick:se},ne.core.askingPassword.submit))))},Lr=(function(h){function w(j){var X=h.call(this)||this;return X.doc=j,X}return U(w,h),w})(mr),Or=(function(h){function w(j){var X=h.call(this)||this;return X.error=j,X}return U(w,h),w})(mr),Pr=(function(h){function w(j){var X=h.call(this)||this;return X.percentages=j,X}return U(w,h),w})(mr),pi=function(h){var w=h.characterMap,j=h.file,X=h.httpHeaders,Q=h.render,ne=h.renderError,ce=h.renderLoader,ae=h.renderProtectedView,$=h.transformGetDocumentParams,oe=h.withCredentials,se=h.onDocumentAskPassword,Pe=s.useContext(g).direction===r.TextDirection.RightToLeft,Ae=s.useState(new Pr(0)),Se=Ae[0],Be=Ae[1],Le=s.useRef(""),Me=Ve();return s.useEffect((function(){Le.current="",Be(new Pr(0));var mt=new N.PDFWorker({name:"PDFWorker_".concat(Date.now())}),Qe=Object.assign({httpHeaders:X,withCredentials:oe,worker:mt},typeof j=="string"?{url:j}:{data:j},w?{cMapUrl:w.url,cMapPacked:w.isCompressed}:{}),nt=$?$(Qe):Qe,ot=N.getDocument(nt);return ot.onPassword=function(Ge,ct){switch(ct){case N.PasswordResponses.NEED_PASSWORD:Me.current&&Be(new Ar(Ge,r.PasswordStatus.RequiredPassword));break;case N.PasswordResponses.INCORRECT_PASSWORD:Me.current&&Be(new Ar(Ge,r.PasswordStatus.WrongPassword))}},ot.onProgress=function(Ge){var ct=Ge.total>0?Math.min(100,100*Ge.loaded/Ge.total):100;Me.current&&Le.current===""&&Be(new Pr(ct))},ot.promise.then((function(Ge){Le.current=Ge.loadingTask.docId,Me.current&&Be(new Lr(Ge))}),(function(Ge){return Me.current&&!mt.destroyed&&Be(new Or({message:Ge.message||"Cannot load document",name:Ge.name}))})),function(){ot.destroy(),mt.destroy()}}),[j]),Se instanceof Ar?s.createElement(hr,{passwordStatus:Se.passwordStatus,renderProtectedView:ae,verifyPassword:Se.verifyPassword,onDocumentAskPassword:se}):Se instanceof Lr?Q(Se.doc):Se instanceof Or?ne?ne(Se.error):s.createElement("div",{className:d({"rpv-core__doc-error":!0,"rpv-core__doc-error--rtl":Pe})},s.createElement("div",{className:"rpv-core__doc-error-text"},Se.error.message)):s.createElement("div",{"data-testid":"core__doc-loading",className:d({"rpv-core__doc-loading":!0,"rpv-core__doc-loading--rtl":Pe})},ce?ce(Se.percentages):s.createElement(H,null))},gi=function(h,w){var j=s.useMemo((function(){return h==="auto"?typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":h}),[]),X=s.useState(j),Q=X[0],ne=X[1],ce=Ee(Q);return s.useEffect((function(){if(h==="auto"){var ae=window.matchMedia("(prefers-color-scheme: dark)"),$=function(oe){ne(oe.matches?"dark":"light")};return ae.addEventListener("change",$),function(){return ae.removeEventListener("change",$)}}}),[]),s.useEffect((function(){Q!==ce&&w&&w(Q)}),[Q]),s.useEffect((function(){h!==Q&&ne(h)}),[h]),{currentTheme:Q,setCurrentTheme:ne}},mi=function(h){return{startPage:h.startPage-3,endPage:h.endPage+3}};r.Button=function(h){var w=h.children,j=h.testId,X=h.onClick,Q=s.useContext(g).direction===r.TextDirection.RightToLeft,ne=j?{"data-testid":j}:{};return s.createElement("button",t({className:d({"rpv-core__button":!0,"rpv-core__button--rtl":Q}),type:"button",onClick:X},ne),w)},r.Icon=y,r.LazyRender=function(h){var w=h.attrs,j=h.children,X=h.testId,Q=s.useState(!1),ne=Q[0],ce=Q[1],ae=X?t(t({},w),{"data-testid":X}):w,$=b({once:!0,onVisibilityChanged:function(oe){oe.isVisible&&ce(!0)}});return s.createElement("div",t({ref:$},ae),ne&&j)},r.LocalizationContext=C,r.Menu=function(h){var w=h.children,j=s.useRef(),X=s.useRef([]),Q=s.useContext(g).direction===r.TextDirection.RightToLeft,ne=function(ae){if(j.current)switch(ae.key){case"Tab":ae.preventDefault();break;case"ArrowDown":ae.preventDefault(),ce((function($,oe){return oe+1}));break;case"ArrowUp":ae.preventDefault(),ce((function($,oe){return oe-1}));break;case"End":ae.preventDefault(),ce((function($,oe){return $.length-1}));break;case"Home":ae.preventDefault(),ce((function($,oe){return 0}))}},ce=function(ae){if(j.current){var $=X.current,oe=$.findIndex((function(Pe){return Pe.getAttribute("tabindex")==="0"})),se=Math.min($.length-1,Math.max(0,ae($,oe)));oe>=0&&oe<=$.length-1&&$[oe].setAttribute("tabindex","-1"),$[se].setAttribute("tabindex","0"),$[se].focus()}};return i((function(){var ae=j.current;if(ae){var $=(function(oe){var se=[];return oe.querySelectorAll('.rpv-core__menu-item[role="menuitem"]').forEach((function(Pe){if(Pe instanceof HTMLElement){var Ae=Pe.parentElement;(Ae===oe||window.getComputedStyle(Ae).display!=="none")&&se.push(Pe)}})),se})(ae);X.current=$}}),[]),i((function(){return document.addEventListener("keydown",ne),function(){document.removeEventListener("keydown",ne)}}),[]),s.createElement("div",{ref:j,"aria-orientation":"vertical",className:d({"rpv-core__menu":!0,"rpv-core__menu--rtl":Q}),role:"menu",tabIndex:0},w)},r.MenuDivider=function(){return s.createElement("div",{"aria-orientation":"horizontal",className:"rpv-core__menu-divider",role:"separator"})},r.MenuItem=function(h){var w=h.checked,j=w!==void 0&&w,X=h.children,Q=h.icon,ne=Q===void 0?null:Q,ce=h.isDisabled,ae=ce!==void 0&&ce,$=h.testId,oe=h.onClick,se=s.useContext(g).direction===r.TextDirection.RightToLeft,Pe=$?{"data-testid":$}:{};return s.createElement("button",t({className:d({"rpv-core__menu-item":!0,"rpv-core__menu-item--disabled":ae,"rpv-core__menu-item--ltr":!se,"rpv-core__menu-item--rtl":se}),role:"menuitem",tabIndex:-1,type:"button",onClick:oe},Pe),s.createElement("div",{className:d({"rpv-core__menu-item-icon":!0,"rpv-core__menu-item-icon--ltr":!se,"rpv-core__menu-item-icon--rtl":se})},ne),s.createElement("div",{className:d({"rpv-core__menu-item-label":!0,"rpv-core__menu-item-label--ltr":!se,"rpv-core__menu-item-label--rtl":se})},X),s.createElement("div",{className:d({"rpv-core__menu-item-check":!0,"rpv-core__menu-item-check--ltr":!se,"rpv-core__menu-item-check--rtl":se})},j&&s.createElement(f,null)))},r.MinimalButton=function(h){var w=h.ariaLabel,j=w===void 0?"":w,X=h.ariaKeyShortcuts,Q=X===void 0?"":X,ne=h.children,ce=h.isDisabled,ae=ce!==void 0&&ce,$=h.isSelected,oe=$!==void 0&&$,se=h.testId,Pe=h.onClick,Ae=s.useContext(g).direction===r.TextDirection.RightToLeft,Se=se?{"data-testid":se}:{};return s.createElement("button",t({"aria-label":j},Q&&{"aria-keyshortcuts":Q},ae&&{"aria-disabled":!0},{className:d({"rpv-core__minimal-button":!0,"rpv-core__minimal-button--disabled":ae,"rpv-core__minimal-button--rtl":Ae,"rpv-core__minimal-button--selected":oe}),type:"button",onClick:Pe},Se),ne)},r.Modal=function(h){var w=h.ariaControlsSuffix,j=h.closeOnClickOutside,X=h.closeOnEscape,Q=h.content,ne=h.isOpened,ce=ne!==void 0&&ne,ae=h.target,$=w||"".concat(W());return s.createElement(B,{target:ae?function(oe,se){return s.createElement("div",{"aria-expanded":se?"true":"false","aria-haspopup":"dialog","aria-controls":"rpv-core__modal-body-".concat($)},ae(oe,se))}:null,content:function(oe){return s.createElement(S,null,s.createElement(l,{ariaControlsSuffix:$,closeOnClickOutside:j,closeOnEscape:X,onToggle:oe},Q(oe)))},isOpened:ce})},r.Popover=function(h){var w=h.ariaHasPopup,j=w===void 0?"dialog":w,X=h.ariaControlsSuffix,Q=h.closeOnClickOutside,ne=h.closeOnEscape,ce=h.content,ae=h.lockScroll,$=ae===void 0||ae,oe=h.offset,se=h.position,Pe=h.target,Ae=O(!1),Se=Ae.opened,Be=Ae.toggle,Le=s.useRef(),Me=s.useMemo((function(){return X||"".concat(W())}),[]);return s.createElement("div",{ref:Le,"aria-expanded":Se?"true":"false","aria-haspopup":j,"aria-controls":"rpv-core__popver-body-".concat(Me)},Pe(Be,Se),Se&&s.createElement(s.Fragment,null,$&&s.createElement(lt,{closeOnEscape:ne,onClose:Be}),s.createElement(tt,{ariaControlsSuffix:Me,closeOnClickOutside:Q,offset:oe,position:se,targetRef:Le,onClose:Be},ce(Be))))},r.PrimaryButton=T,r.ProgressBar=function(h){var w=h.progress,j=s.useContext(g).direction===r.TextDirection.RightToLeft;return s.createElement("div",{className:d({"rpv-core__progress-bar":!0,"rpv-core__progress-bar--rtl":j})},s.createElement("div",{className:"rpv-core__progress-bar-progress",style:{width:"".concat(w,"%")}},w,"%"))},r.Separator=function(){return s.createElement("div",{className:"rpv-core__separator"})},r.Spinner=H,r.Splitter=function(h){var w=h.constrain,j=s.useContext(g).direction===r.TextDirection.RightToLeft,X=s.useRef(),Q=s.useRef(),ne=s.useRef(),ce=s.useRef(0),ae=s.useRef(0),$=s.useRef(0),oe=s.useRef(0),se={capture:!0},Pe=function(Se){var Be=X.current,Le=Q.current,Me=ne.current;if(Be&&Le&&Me){var mt=oe.current,Qe=Se.clientX-ce.current,nt=$.current+(j?-Qe:Qe),ot=Be.parentElement.getBoundingClientRect().width,Ge=100*nt/ot;if(Be.classList.add("rpv-core__splitter--resizing"),w){var ct=ot-nt-mt;if(!w({firstHalfPercentage:Ge,firstHalfSize:nt,secondHalfPercentage:100*ct/ot,secondHalfSize:ct}))return}Le.style.width="".concat(Ge,"%"),document.body.classList.add("rpv-core__splitter-body--resizing"),Le.classList.add("rpv-core__splitter-sibling--resizing"),Me.classList.add("rpv-core__splitter-sibling--resizing")}},Ae=function(Se){var Be=X.current,Le=Q.current,Me=ne.current;Be&&Le&&Me&&(document.body.classList.remove("rpv-core__splitter-body--resizing"),Be.classList.remove("rpv-core__splitter--resizing"),Le.classList.remove("rpv-core__splitter-sibling--resizing"),Me.classList.remove("rpv-core__splitter-sibling--resizing"),document.removeEventListener("mousemove",Pe,se),document.removeEventListener("mouseup",Ae,se))};return s.useEffect((function(){var Se=X.current;Se&&(oe.current=Se.getBoundingClientRect().width,Q.current=Se.previousElementSibling,ne.current=Se.nextElementSibling)}),[]),s.createElement("div",{ref:X,className:"rpv-core__splitter",onMouseDown:function(Se){var Be=Q.current;Be&&(ce.current=Se.clientX,ae.current=Se.clientY,$.current=Be.getBoundingClientRect().width,document.addEventListener("mousemove",Pe,se),document.addEventListener("mouseup",Ae,se))}})},r.TextBox=I,r.ThemeContext=g,r.Tooltip=function(h){var w=h.ariaControlsSuffix,j=h.content,X=h.offset,Q=h.position,ne=h.target,ce=O(!1),ae=ce.opened,$=ce.toggle,oe=s.useRef(),se=s.useRef(),Pe=s.useMemo((function(){return w||"".concat(W())}),[]);L((function(){oe.current&&document.activeElement&&oe.current.contains(document.activeElement)&&Se()}));var Ae=function(){$(r.ToggleStatus.Open)},Se=function(){$(r.ToggleStatus.Close)};return s.createElement(s.Fragment,null,s.createElement("div",{ref:oe,"aria-describedby":"rpv-core__tooltip-body-".concat(Pe),onBlur:function(Be){Be.relatedTarget instanceof HTMLElement&&Be.currentTarget.parentElement&&Be.currentTarget.parentElement.contains(Be.relatedTarget)?se.current&&(se.current.style.display="none"):Se()},onFocus:Ae,onMouseEnter:Ae,onMouseLeave:Se},ne),ae&&s.createElement(vt,{ariaControlsSuffix:Pe,contentRef:se,offset:X,position:Q,targetRef:oe},j()))},r.Viewer=function(h){var w=h.characterMap,j=h.defaultScale,X=h.enableSmoothScroll,Q=X===void 0||X,ne=h.fileUrl,ce=h.httpHeaders,ae=ce===void 0?{}:ce,$=h.initialPage,oe=$===void 0?0:$,se=h.pageLayout,Pe=h.initialRotation,Ae=Pe===void 0?0:Pe,Se=h.localization,Be=h.plugins,Le=Be===void 0?[]:Be,Me=h.renderError,mt=h.renderLoader,Qe=h.renderPage,nt=h.renderProtectedView,ot=h.scrollMode,Ge=ot===void 0?r.ScrollMode.Vertical:ot,ct=h.setRenderRange,st=ct===void 0?mi:ct,Mt=h.transformGetDocumentParams,Ct=h.theme,xt=Ct===void 0?{direction:r.TextDirection.LeftToRight,theme:"light"}:Ct,Ot=h.viewMode,It=Ot===void 0?r.ViewMode.SinglePage:Ot,Yt=h.withCredentials,qt=Yt!==void 0&&Yt,cn=h.onDocumentAskPassword,Ut=h.onDocumentLoad,nn=Ut===void 0?function(){}:Ut,Kt=h.onPageChange,Jt=Kt===void 0?function(){}:Kt,bn=h.onRotate,zn=bn===void 0?function(){}:bn,Vn=h.onRotatePage,sn=Vn===void 0?function(){}:Vn,Sn=h.onSwitchTheme,$n=Sn===void 0?function(){}:Sn,at=h.onZoom,rt=at===void 0?function(){}:at,Xe=s.useState({data:ne,name:typeof ne=="string"?ne:"",shouldLoad:!1}),Je=Xe[0],$e=Xe[1],ut=function(D,z){$e({data:z,name:D,shouldLoad:!0})},dt=s.useState(!1),Ke=dt[0],Ue=dt[1],gt=Ee(Je);s.useEffect((function(){var D,z,x,J;D=gt.data,J=typeof(z=ne),(x=typeof D)=="string"&&J==="string"&&D===z||x==="object"&&J==="object"&&D.length===z.length&&D.every((function(le,de){return le===z[de]}))||$e({data:ne,name:typeof ne=="string"?ne:"",shouldLoad:Ke})}),[ne,Ke]);var wt=b({onVisibilityChanged:function(D){Ue(D.isVisible),D.isVisible&&$e((function(z){return Object.assign({},z,{shouldLoad:!0})}))}}),n=typeof xt=="string"?{direction:r.TextDirection.LeftToRight,theme:xt}:xt,u=s.useState(Se||v),E=u[0],k=u[1],P={l10n:E,setL10n:k},F=Object.assign({},{direction:n.direction},gi(n.theme||"light",$n));return s.useEffect((function(){Se&&k(Se)}),[Se]),s.createElement(C.Provider,{value:P},s.createElement(g.Provider,{value:F},s.createElement("div",{ref:wt,className:"rpv-core__viewer rpv-core__viewer--".concat(F.currentTheme),"data-testid":"core__viewer",style:{height:"100%",width:"100%"}},Je.shouldLoad&&s.createElement(pi,{characterMap:w,file:Je.data,httpHeaders:ae,render:function(D){return s.createElement(Fr,{defaultScale:j,doc:D,render:function(z,x){return s.createElement(fi,{currentFile:{data:Je.data,name:Je.name},defaultScale:j,doc:D,enableSmoothScroll:Q,initialPage:oe,initialRotation:Ae,initialScale:x,pageLayout:se,pageSizes:z,plugins:Le,renderPage:Qe,scrollMode:Ge,setRenderRange:st,viewMode:It,viewerState:{file:Je,fullScreenMode:r.FullScreenMode.Normal,pageIndex:-1,pageHeight:z[0].pageHeight,pageWidth:z[0].pageWidth,pagesRotation:new Map,rotation:Ae,scale:x,scrollMode:Ge,viewMode:It},onDocumentLoad:nn,onOpenFile:ut,onPageChange:Jt,onRotate:zn,onRotatePage:sn,onZoom:rt})},scrollMode:Ge,viewMode:It})},renderError:Me,renderLoader:mt,renderProtectedView:nt,transformGetDocumentParams:Mt,withCredentials:qt,onDocumentAskPassword:cn}))))},r.Worker=function(h){var w=h.children,j=h.workerUrl;return N.GlobalWorkerOptions.workerSrc=j,s.createElement(s.Fragment,null,w)},r.chunk=Ft,r.classNames=d,r.createStore=function(h){var w=h||{},j={},X=function(ne,ce){var ae;w=t(t({},w),((ae={})[ne]=ce,ae)),(j[ne]||[]).forEach((function($){return $(w[ne])}))},Q=function(ne){return w[ne]};return{subscribe:function(ne,ce){j[ne]=(j[ne]||[]).concat(ce)},unsubscribe:function(ne,ce){j[ne]=(j[ne]||[]).filter((function(ae){return ae!==ce}))},update:function(ne,ce){X(ne,ce)},updateCurrentValue:function(ne,ce){var ae=Q(ne);ae!==void 0&&X(ne,ce(ae))},get:function(ne){return Q(ne)}}},r.getDestination=lr,r.getPage=Kn,r.isFullScreenEnabled=ge,r.isMac=function(){return typeof window<"u"&&/(Mac|iPhone|iPod|iPad)/i.test(navigator.platform)},r.useDebounceCallback=Oe,r.useIntersectionObserver=b,r.useIsMounted=Ve,r.useIsomorphicLayoutEffect=i,r.usePrevious=Ee,r.useRenderQueue=m})(core_min)),core_min}var core={},hasRequiredCore;function requireCore(){return hasRequiredCore||(hasRequiredCore=1,(function(r){var c=require$$1,q=requirePdf();function p(n){var u=Object.create(null);return n&&Object.keys(n).forEach(function(E){if(E!=="default"){var k=Object.getOwnPropertyDescriptor(n,E);Object.defineProperty(u,E,k.get?k:{enumerable:!0,get:function(){return n[E]}})}}),u.default=n,Object.freeze(u)}var e=p(c),s=p(q);r.AnnotationType=void 0,(function(n){n[n.Text=1]="Text",n[n.Link=2]="Link",n[n.FreeText=3]="FreeText",n[n.Line=4]="Line",n[n.Square=5]="Square",n[n.Circle=6]="Circle",n[n.Polygon=7]="Polygon",n[n.Polyline=8]="Polyline",n[n.Highlight=9]="Highlight",n[n.Underline=10]="Underline",n[n.Squiggly=11]="Squiggly",n[n.StrikeOut=12]="StrikeOut",n[n.Stamp=13]="Stamp",n[n.Caret=14]="Caret",n[n.Ink=15]="Ink",n[n.Popup=16]="Popup",n[n.FileAttachment=17]="FileAttachment"})(r.AnnotationType||(r.AnnotationType={}));var N=function(n,u){return N=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(E,k){E.__proto__=k}||function(E,k){for(var P in k)Object.prototype.hasOwnProperty.call(k,P)&&(E[P]=k[P])},N(n,u)};function ee(n,u){if(typeof u!="function"&&u!==null)throw new TypeError("Class extends value "+String(u)+" is not a constructor or null");N(n,u);function E(){this.constructor=n}n.prototype=u===null?Object.create(u):(E.prototype=u.prototype,new E)}var U=function(){return U=Object.assign||function(u){for(var E,k=1,P=arguments.length;k<P;k++){E=arguments[k];for(var F in E)Object.prototype.hasOwnProperty.call(E,F)&&(u[F]=E[F])}return u},U.apply(this,arguments)};function o(n,u,E){for(var k=0,P=u.length,F;k<P;k++)(F||!(k in u))&&(F||(F=Array.prototype.slice.call(u,0,k)),F[k]=u[k]);return n.concat(F||Array.prototype.slice.call(u))}r.TextDirection=void 0,(function(n){n.RightToLeft="RTL",n.LeftToRight="LTR"})(r.TextDirection||(r.TextDirection={}));var t=e.createContext({currentTheme:"light",direction:r.TextDirection.LeftToRight,setCurrentTheme:function(){}}),a=function(n){var u=[];return Object.keys(n).forEach(function(E){E&&n[E]&&u.push(E)}),u.join(" ")},g=function(n){var u=n.children,E=n.testId,k=n.onClick,P=e.useContext(t).direction,F=P===r.TextDirection.RightToLeft,D=E?{"data-testid":E}:{};return e.createElement("button",U({className:a({"rpv-core__button":!0,"rpv-core__button--rtl":F}),type:"button",onClick:k},D),u)},d=typeof window<"u"?e.useLayoutEffect:e.useEffect,i=function(n){var u=e.useRef(null),E=n.once,k=n.threshold,P=n.onVisibilityChanged;return d(function(){var F=u.current;if(F){var D=new IntersectionObserver(function(z){z.forEach(function(x){var J=x.isIntersecting,le=x.intersectionRatio;P({isVisible:J,ratio:le}),J&&E&&(D.unobserve(F),D.disconnect())})},{threshold:k||0});return D.observe(F),function(){D.unobserve(F),D.disconnect()}}},[]),u},b=function(n){var u=n.attrs,E=n.children,k=n.testId,P=e.useState(!1),F=P[0],D=P[1],z=k?U(U({},u),{"data-testid":k}):u,x=function(le){le.isVisible&&D(!0)},J=i({once:!0,onVisibilityChanged:x});return e.createElement("div",U({ref:J},z),F&&E)},y=function(n){var u=n.children,E=e.useRef(),k=e.useRef([]),P=e.useContext(t).direction,F=P===r.TextDirection.RightToLeft,D=function(J){var le=E.current;if(le)switch(J.key){case"Tab":J.preventDefault();break;case"ArrowDown":J.preventDefault(),z(function(de,pe){return pe+1});break;case"ArrowUp":J.preventDefault(),z(function(de,pe){return pe-1});break;case"End":J.preventDefault(),z(function(de,pe){return de.length-1});break;case"Home":J.preventDefault(),z(function(de,pe){return 0});break}},z=function(J){var le=E.current;if(le){var de=k.current,pe=de.findIndex(function(_e){return _e.getAttribute("tabindex")==="0"}),Te=Math.min(de.length-1,Math.max(0,J(de,pe)));pe>=0&&pe<=de.length-1&&de[pe].setAttribute("tabindex","-1"),de[Te].setAttribute("tabindex","0"),de[Te].focus()}},x=function(J){var le=[];return J.querySelectorAll('.rpv-core__menu-item[role="menuitem"]').forEach(function(de){if(de instanceof HTMLElement){var pe=de.parentElement;(pe===J||window.getComputedStyle(pe).display!=="none")&&le.push(de)}}),le};return d(function(){var J=E.current;if(J){var le=x(J);k.current=le}},[]),d(function(){return document.addEventListener("keydown",D),function(){document.removeEventListener("keydown",D)}},[]),e.createElement("div",{ref:E,"aria-orientation":"vertical",className:a({"rpv-core__menu":!0,"rpv-core__menu--rtl":F}),role:"menu",tabIndex:0},u)},f=function(){return e.createElement("div",{"aria-orientation":"horizontal",className:"rpv-core__menu-divider",role:"separator"})},T=function(n){var u=n.children,E=n.ignoreDirection,k=E===void 0?!1:E,P=n.size,F=P===void 0?24:P,D=e.useContext(t).direction,z=!k&&D===r.TextDirection.RightToLeft,x="".concat(F||24,"px");return e.createElement("svg",{"aria-hidden":"true",className:a({"rpv-core__icon":!0,"rpv-core__icon--rtl":z}),focusable:"false",height:x,viewBox:"0 0 24 24",width:x},u)},H=function(){return e.createElement(T,{size:16},e.createElement("path",{d:"M23.5,0.499l-16.5,23l-6.5-6.5"}))},I=function(n){var u=n.checked,E=u===void 0?!1:u,k=n.children,P=n.icon,F=P===void 0?null:P,D=n.isDisabled,z=D===void 0?!1:D,x=n.testId,J=n.onClick,le=e.useContext(t).direction,de=le===r.TextDirection.RightToLeft,pe=x?{"data-testid":x}:{};return e.createElement("button",U({className:a({"rpv-core__menu-item":!0,"rpv-core__menu-item--disabled":z,"rpv-core__menu-item--ltr":!de,"rpv-core__menu-item--rtl":de}),role:"menuitem",tabIndex:-1,type:"button",onClick:J},pe),e.createElement("div",{className:a({"rpv-core__menu-item-icon":!0,"rpv-core__menu-item-icon--ltr":!de,"rpv-core__menu-item-icon--rtl":de})},F),e.createElement("div",{className:a({"rpv-core__menu-item-label":!0,"rpv-core__menu-item-label--ltr":!de,"rpv-core__menu-item-label--rtl":de})},k),e.createElement("div",{className:a({"rpv-core__menu-item-check":!0,"rpv-core__menu-item-check--ltr":!de,"rpv-core__menu-item-check--rtl":de})},E&&e.createElement(H,null)))},_=function(n){var u=n.ariaLabel,E=u===void 0?"":u,k=n.ariaKeyShortcuts,P=k===void 0?"":k,F=n.children,D=n.isDisabled,z=D===void 0?!1:D,x=n.isSelected,J=x===void 0?!1:x,le=n.testId,de=n.onClick,pe=e.useContext(t).direction,Te=pe===r.TextDirection.RightToLeft,_e=le?{"data-testid":le}:{};return e.createElement("button",U({"aria-label":E},P&&{"aria-keyshortcuts":P},z&&{"aria-disabled":!0},{className:a({"rpv-core__minimal-button":!0,"rpv-core__minimal-button--disabled":z,"rpv-core__minimal-button--rtl":Te,"rpv-core__minimal-button--selected":J}),type:"button",onClick:de},_e),F)},M=function(n){var u=n.children,E=n.testId,k=n.onClick,P=e.useContext(t).direction,F=P===r.TextDirection.RightToLeft,D=E?{"data-testid":E}:{};return e.createElement("button",U({className:a({"rpv-core__primary-button":!0,"rpv-core__primary-button--rtl":F}),type:"button",onClick:k},D),u)},te=function(n){var u=n.progress,E=e.useContext(t).direction,k=E===r.TextDirection.RightToLeft;return e.createElement("div",{className:a({"rpv-core__progress-bar":!0,"rpv-core__progress-bar--rtl":k})},e.createElement("div",{className:"rpv-core__progress-bar-progress",style:{width:"".concat(u,"%")}},u,"%"))},ie=function(){return e.createElement("div",{className:"rpv-core__separator"})},Y=function(n){var u=n.size,E=u===void 0?"4rem":u,k=n.testId,P=e.useState(!1),F=P[0],D=P[1],z=k?{"data-testid":k}:{},x=function(le){D(le.isVisible)},J=i({onVisibilityChanged:x});return e.createElement("div",U({},z,{className:a({"rpv-core__spinner":!0,"rpv-core__spinner--animating":F}),ref:J,style:{height:E,width:E}}))},he=function(n){var u=n.constrain,E=e.useContext(t).direction,k=E===r.TextDirection.RightToLeft,P=e.useRef(),F=e.useRef(),D=e.useRef(),z=e.useRef(0),x=e.useRef(0),J=e.useRef(0),le=e.useRef(0),de={capture:!0},pe=function(Ie){var we=P.current,Ye=F.current,ze=D.current;if(!(!we||!Ye||!ze)){var je=le.current,Nt=Ie.clientX-z.current,ht=J.current+(k?-Nt:Nt),et=we.parentElement.getBoundingClientRect().width,it=ht*100/et;if(we.classList.add("rpv-core__splitter--resizing"),u){var $t=et-ht-je,fn=$t*100/et;if(!u({firstHalfPercentage:it,firstHalfSize:ht,secondHalfPercentage:fn,secondHalfSize:$t}))return}Ye.style.width="".concat(it,"%"),document.body.classList.add("rpv-core__splitter-body--resizing"),Ye.classList.add("rpv-core__splitter-sibling--resizing"),ze.classList.add("rpv-core__splitter-sibling--resizing")}},Te=function(Ie){var we=P.current,Ye=F.current,ze=D.current;!we||!Ye||!ze||(document.body.classList.remove("rpv-core__splitter-body--resizing"),we.classList.remove("rpv-core__splitter--resizing"),Ye.classList.remove("rpv-core__splitter-sibling--resizing"),ze.classList.remove("rpv-core__splitter-sibling--resizing"),document.removeEventListener("mousemove",pe,de),document.removeEventListener("mouseup",Te,de))},_e=function(Ie){var we=F.current;we&&(z.current=Ie.clientX,x.current=Ie.clientY,J.current=we.getBoundingClientRect().width,document.addEventListener("mousemove",pe,de),document.addEventListener("mouseup",Te,de))};return e.useEffect(function(){var Ie=P.current;Ie&&(le.current=Ie.getBoundingClientRect().width,F.current=Ie.previousElementSibling,D.current=Ie.nextElementSibling)},[]),e.createElement("div",{ref:P,className:"rpv-core__splitter",onMouseDown:_e})},ge=function(n){var u=n.ariaLabel,E=u===void 0?"":u,k=n.autoFocus,P=k===void 0?!1:k,F=n.placeholder,D=F===void 0?"":F,z=n.testId,x=n.type,J=x===void 0?"text":x,le=n.value,de=le===void 0?"":le,pe=n.onChange,Te=n.onKeyDown,_e=Te===void 0?function(){}:Te,Ie=e.useContext(t).direction,we=e.useRef(),Ye=Ie===r.TextDirection.RightToLeft,ze={ref:we,"data-testid":"","aria-label":E,className:a({"rpv-core__textbox":!0,"rpv-core__textbox--rtl":Ye}),placeholder:D,value:de,onChange:function(je){return pe(je.target.value)},onKeyDown:_e};return z&&(ze["data-testid"]=z),d(function(){if(P){var je=we.current;if(je){var Nt=window.scrollX,ht=window.scrollY;je.focus(),window.scrollTo(Nt,ht)}}},[]),J==="text"?e.createElement("input",U({type:"text"},ze)):e.createElement("input",U({type:"password"},ze))},Ne;(function(n){n[n.ExitFullScreen=0]="ExitFullScreen",n[n.FullScreenChange=1]="FullScreenChange",n[n.FullScreenElement=2]="FullScreenElement",n[n.FullScreenEnabled=3]="FullScreenEnabled",n[n.RequestFullScreen=4]="RequestFullScreen"})(Ne||(Ne={}));var ke={ExitFullScreen:"exitFullscreen",FullScreenChange:"fullscreenchange",FullScreenElement:"fullscreenElement",FullScreenEnabled:"fullscreenEnabled",RequestFullScreen:"requestFullscreen"},Oe={ExitFullScreen:"webkitExitFullscreen",FullScreenChange:"webkitfullscreenchange",FullScreenElement:"webkitFullscreenElement",FullScreenEnabled:"webkitFullscreenEnabled",RequestFullScreen:"webkitRequestFullscreen"},Ve={ExitFullScreen:"msExitFullscreen",FullScreenChange:"msFullscreenChange",FullScreenElement:"msFullscreenElement",FullScreenEnabled:"msFullscreenEnabled",RequestFullScreen:"msRequestFullscreen"},Ee=typeof window<"u",G=Ee&&(Ne.FullScreenEnabled in document&&ke||Oe.FullScreenEnabled in document&&Oe||Ve.FullScreenEnabled in document&&Ve)||ke,A=function(){return Ee&&G.FullScreenEnabled in document&&document[G.FullScreenEnabled]===!0},m=function(n){Ee&&document.addEventListener(G.FullScreenChange,n)},v=function(n){Ee&&document.removeEventListener(G.FullScreenChange,n)},C=function(n){return Ee?n[G.ExitFullScreen]():Promise.resolve({})},V=function(){return Ee?document[G.FullScreenElement]:null},W=function(n){Ee&&n[G.RequestFullScreen]()},K=function(n,u){var E=e.useRef(),k=function(){E.current&&clearTimeout(E.current)};return e.useEffect(function(){return function(){return k()}},[]),e.useCallback(function(){for(var P=[],F=0;F<arguments.length;F++)P[F]=arguments[F];k(),E.current=setTimeout(function(){n.apply(void 0,P)},u)},[n,u])},L=function(){var n=e.useRef(!1);return e.useEffect(function(){return n.current=!0,function(){n.current=!1}},[]),n},l=function(n){var u=e.useRef(n);return e.useEffect(function(){u.current=n},[n]),u.current},S;(function(n){n.NotRenderedYet="NotRenderedYet",n.Rendering="Rendering",n.Rendered="Rendered"})(S||(S={}));var R=-9999,O=function(n){var u=n.doc,E=u.numPages,k=u.loadingTask.docId,P=e.useMemo(function(){return Array(E).fill(null).map(function(_e,Ie){return{pageIndex:Ie,renderStatus:S.NotRenderedYet,visibility:R}})},[k]),F=e.useRef({currentRenderingPage:-1,startRange:0,endRange:E-1,visibilities:P}),D=function(){for(var _e=0;_e<E;_e++)F.current.visibilities[_e].renderStatus=S.NotRenderedYet},z=function(_e){F.current.visibilities[_e].renderStatus=S.Rendered},x=function(_e){F.current.currentRenderingPage!==-1&&F.current.currentRenderingPage!==_e&&F.current.visibilities[F.current.currentRenderingPage].renderStatus===S.Rendering&&(F.current.visibilities[F.current.currentRenderingPage].renderStatus=S.NotRenderedYet),F.current.visibilities[_e].renderStatus=S.Rendering,F.current.currentRenderingPage=_e},J=function(_e,Ie){F.current.startRange=_e,F.current.endRange=Ie;for(var we=0;we<E;we++)(we<_e||we>Ie)&&(F.current.visibilities[we].visibility=R,F.current.visibilities[we].renderStatus=S.NotRenderedYet)},le=function(_e){de(_e,R)},de=function(_e,Ie){F.current.visibilities[_e].visibility=Ie},pe=function(){var _e=F.current.visibilities.slice(F.current.startRange,F.current.endRange+1).filter(function(je){return je.visibility>R});if(!_e.length)return-1;for(var Ie=_e[0].pageIndex,we=_e[_e.length-1].pageIndex,Ye=_e.length,ze=0;ze<Ye;ze++){if(_e[ze].renderStatus===S.Rendering)return-1;if(_e[ze].renderStatus===S.NotRenderedYet)return _e[ze].pageIndex}return we+1<E&&F.current.visibilities[we+1].renderStatus!==S.Rendered?we+1:Ie-1>=0&&F.current.visibilities[Ie-1].renderStatus!==S.Rendered?Ie-1:-1},Te=function(_e){return _e>=F.current.startRange&&_e<=F.current.endRange};return{getHighestPriorityPage:pe,isInRange:Te,markNotRendered:D,markRendered:z,markRendering:x,setOutOfRange:le,setRange:J,setVisibility:de}},B={askingPassword:{requirePasswordToOpen:"This document requires a password to open",submit:"Submit"},wrongPassword:{tryAgain:"The password is wrong. Please try again"},pageLabel:"Page {{pageIndex}}"},Z={core:B},re=Z,me=e.createContext({l10n:re,setL10n:function(){}}),We=0,ve=function(){return We++},ye=function(n,u,E){var k=function(P){var F=u.current;if(F){var D=P.target;if(D instanceof Element&&D.shadowRoot){var z=P.composedPath();z.length>0&&!F.contains(z[0])&&E()}else F.contains(D)||E()}};e.useEffect(function(){if(n){var P={capture:!0};return document.addEventListener("click",k,P),function(){document.removeEventListener("click",k,P)}}},[])},Ce=function(n){var u=function(E){E.key==="Escape"&&n()};e.useEffect(function(){return document.addEventListener("keyup",u),function(){document.removeEventListener("keyup",u)}},[])},Re=function(){e.useEffect(function(){var n=window.getComputedStyle(document.body).overflow;return document.body.style.overflow="hidden",function(){document.body.style.overflow=n}},[])},xe=function(n){var u=n.ariaControlsSuffix,E=n.children,k=n.closeOnClickOutside,P=n.closeOnEscape,F=n.onToggle,D=e.useRef(),z=e.useContext(t).direction,x=z===r.TextDirection.RightToLeft;return Re(),Ce(function(){D.current&&P&&F()}),ye(k,D,F),d(function(){var J=D.current;if(J){var le=document.body.clientHeight*.75;J.getBoundingClientRect().height>=le&&(J.style.overflow="auto",J.style.maxHeight="".concat(le,"px"))}},[]),e.createElement("div",{"aria-modal":"true",className:a({"rpv-core__modal-body":!0,"rpv-core__modal-body--rtl":x}),id:"rpv-core__modal-body-".concat(u),ref:D,role:"dialog",tabIndex:-1},E)},qe=function(n){var u=n.children;return e.createElement("div",{className:"rpv-core__modal-overlay"},u)};r.ToggleStatus=void 0,(function(n){n.Close="Close",n.Open="Open",n.Toggle="Toggle"})(r.ToggleStatus||(r.ToggleStatus={}));var tt=function(n){var u=e.useState(n),E=u[0],k=u[1],P=function(F){switch(F){case r.ToggleStatus.Close:k(!1);break;case r.ToggleStatus.Open:k(!0);break;case r.ToggleStatus.Toggle:default:k(function(D){return!D});break}};return{opened:E,toggle:P}},lt=function(n){var u=n.content,E=n.isOpened,k=E===void 0?!1:E,P=n.target,F=tt(k),D=F.opened,z=F.toggle;return e.createElement(e.Fragment,null,P&&P(z,D),D&&u(z))},vt=function(n){var u=n.ariaControlsSuffix,E=n.closeOnClickOutside,k=n.closeOnEscape,P=n.content,F=n.isOpened,D=F===void 0?!1:F,z=n.target,x=u||"".concat(ve()),J=function(de,pe){return e.createElement("div",{"aria-expanded":pe?"true":"false","aria-haspopup":"dialog","aria-controls":"rpv-core__modal-body-".concat(x)},z(de,pe))},le=function(de){return e.createElement(qe,null,e.createElement(xe,{ariaControlsSuffix:x,closeOnClickOutside:E,closeOnEscape:k,onToggle:de},P(de)))};return e.createElement(lt,{target:z?J:null,content:le,isOpened:D})};r.Position=void 0,(function(n){n.TopLeft="TOP_LEFT",n.TopCenter="TOP_CENTER",n.TopRight="TOP_RIGHT",n.RightTop="RIGHT_TOP",n.RightCenter="RIGHT_CENTER",n.RightBottom="RIGHT_BOTTOM",n.BottomLeft="BOTTOM_LEFT",n.BottomCenter="BOTTOM_CENTER",n.BottomRight="BOTTOM_RIGHT",n.LeftTop="LEFT_TOP",n.LeftCenter="LEFT_CENTER",n.LeftBottom="LEFT_BOTTOM"})(r.Position||(r.Position={}));var bt=function(n,u,E,k){var P=u.getBoundingClientRect(),F=n.getBoundingClientRect(),D=F.height,z=F.width,x=0,J=0;switch(E){case r.Position.TopLeft:x=P.top-D,J=P.left;break;case r.Position.TopCenter:x=P.top-D,J=P.left+P.width/2-z/2;break;case r.Position.TopRight:x=P.top-D,J=P.left+P.width-z;break;case r.Position.RightTop:x=P.top,J=P.left+P.width;break;case r.Position.RightCenter:x=P.top+P.height/2-D/2,J=P.left+P.width;break;case r.Position.RightBottom:x=P.top+P.height-D,J=P.left+P.width;break;case r.Position.BottomLeft:x=P.top+P.height,J=P.left;break;case r.Position.BottomCenter:x=P.top+P.height,J=P.left+P.width/2-z/2;break;case r.Position.BottomRight:x=P.top+P.height,J=P.left+P.width-z;break;case r.Position.LeftTop:x=P.top,J=P.left-z;break;case r.Position.LeftCenter:x=P.top+P.height/2-D/2,J=P.left-z;break;case r.Position.LeftBottom:x=P.top+P.height-D,J=P.left-z;break}return{left:J+(k.left||0),top:x+(k.top||0)}},Ft=function(n,u,E,k,P){d(function(){var F=u.current,D=n.current,z=E.current;if(!(!D||!F||!z)){var x=z.getBoundingClientRect(),J=bt(D,F,k,P),le=J.top,de=J.left;D.style.top="".concat(le-x.top,"px"),D.style.left="".concat(de-x.left,"px")}},[])},vn=function(n){var u,E=n.customClassName,k=n.position;return e.createElement("div",{className:a((u={"rpv-core__arrow":!0,"rpv-core__arrow--tl":k===r.Position.TopLeft,"rpv-core__arrow--tc":k===r.Position.TopCenter,"rpv-core__arrow--tr":k===r.Position.TopRight,"rpv-core__arrow--rt":k===r.Position.RightTop,"rpv-core__arrow--rc":k===r.Position.RightCenter,"rpv-core__arrow--rb":k===r.Position.RightBottom,"rpv-core__arrow--bl":k===r.Position.BottomLeft,"rpv-core__arrow--bc":k===r.Position.BottomCenter,"rpv-core__arrow--br":k===r.Position.BottomRight,"rpv-core__arrow--lt":k===r.Position.LeftTop,"rpv-core__arrow--lc":k===r.Position.LeftCenter,"rpv-core__arrow--lb":k===r.Position.LeftBottom},u["".concat(E)]=E!=="",u))})},hn=function(n){var u=n.ariaControlsSuffix,E=n.children,k=n.closeOnClickOutside,P=n.offset,F=n.position,D=n.targetRef,z=n.onClose,x=e.useRef(),J=e.useRef(),le=e.useRef(),de=e.useContext(t).direction,pe=de===r.TextDirection.RightToLeft;ye(k,x,z),Ft(x,D,le,F,P),d(function(){var _e=J.current;if(_e){var Ie=document.body.clientHeight*.75;_e.getBoundingClientRect().height>=Ie&&(_e.style.overflow="auto",_e.style.maxHeight="".concat(Ie,"px"))}},[]);var Te="rpv-core__popover-body-inner-".concat(u);return e.createElement(e.Fragment,null,e.createElement("div",{ref:le,style:{left:0,position:"absolute",top:0}}),e.createElement("div",{"aria-describedby":Te,className:a({"rpv-core__popover-body":!0,"rpv-core__popover-body--rtl":pe}),id:"rpv-core__popover-body-".concat(u),ref:x,role:"dialog",tabIndex:-1},e.createElement(vn,{customClassName:"rpv-core__popover-body-arrow",position:F}),e.createElement("div",{id:Te,ref:J},E)))},jn=function(n){var u=n.closeOnEscape,E=n.onClose,k=e.useRef();return Ce(function(){k.current&&u&&E()}),e.createElement("div",{className:"rpv-core__popover-overlay",ref:k})},gn=function(n){var u=n.ariaHasPopup,E=u===void 0?"dialog":u,k=n.ariaControlsSuffix,P=n.closeOnClickOutside,F=n.closeOnEscape,D=n.content,z=n.lockScroll,x=z===void 0?!0:z,J=n.offset,le=n.position,de=n.target,pe=tt(!1),Te=pe.opened,_e=pe.toggle,Ie=e.useRef(),we=e.useMemo(function(){return k||"".concat(ve())},[]);return e.createElement("div",{ref:Ie,"aria-expanded":Te?"true":"false","aria-haspopup":E,"aria-controls":"rpv-core__popver-body-".concat(we)},de(_e,Te),Te&&e.createElement(e.Fragment,null,x&&e.createElement(jn,{closeOnEscape:F,onClose:_e}),e.createElement(hn,{ariaControlsSuffix:we,closeOnClickOutside:P,offset:J,position:le,targetRef:Ie,onClose:_e},D(_e))))},Fn=function(n){var u=n.ariaControlsSuffix,E=n.children,k=n.contentRef,P=n.offset,F=n.position,D=n.targetRef,z=e.useRef(),x=e.useContext(t).direction,J=x===r.TextDirection.RightToLeft;return Ft(k,D,z,F,P),e.createElement(e.Fragment,null,e.createElement("div",{ref:z,style:{left:0,position:"absolute",top:0}}),e.createElement("div",{className:a({"rpv-core__tooltip-body":!0,"rpv-core__tooltip-body--rtl":J}),id:"rpv-core__tooltip-body-".concat(u),ref:k,role:"tooltip"},e.createElement(vn,{customClassName:"rpv-core__tooltip-body-arrow",position:F}),e.createElement("div",{className:"rpv-core__tooltip-body-content"},E)))},Kn=function(n){var u=n.ariaControlsSuffix,E=n.content,k=n.offset,P=n.position,F=n.target,D=tt(!1),z=D.opened,x=D.toggle,J=e.useRef(),le=e.useRef(),de=e.useMemo(function(){return u||"".concat(ve())},[]);Ce(function(){J.current&&document.activeElement&&J.current.contains(document.activeElement)&&Te()});var pe=function(){x(r.ToggleStatus.Open)},Te=function(){x(r.ToggleStatus.Close)},_e=function(Ie){var we=Ie.relatedTarget instanceof HTMLElement&&Ie.currentTarget.parentElement&&Ie.currentTarget.parentElement.contains(Ie.relatedTarget);we?le.current&&(le.current.style.display="none"):Te()};return e.createElement(e.Fragment,null,e.createElement("div",{ref:J,"aria-describedby":"rpv-core__tooltip-body-".concat(de),onBlur:_e,onFocus:pe,onMouseEnter:pe,onMouseLeave:Te},F),z&&e.createElement(Fn,{ariaControlsSuffix:de,contentRef:le,offset:k,position:P,targetRef:J},E()))};function lr(n){var u=n||{},E={},k=function(F,D){var z;u=U(U({},u),(z={},z[F]=D,z)),(E[F]||[]).forEach(function(x){return x(u[F])})},P=function(F){return u[F]};return{subscribe:function(F,D){E[F]=(E[F]||[]).concat(D)},unsubscribe:function(F,D){E[F]=(E[F]||[]).filter(function(z){return z!==D})},update:function(F,D){k(F,D)},updateCurrentValue:function(F,D){var z=P(F);z!==void 0&&k(F,D(z))},get:function(F){return P(F)}}}r.FullScreenMode=void 0,(function(n){n.Normal="Normal",n.Entering="Entering",n.Entered="Entered",n.EnteredCompletely="EnteredCompletely",n.Exitting="Exitting",n.Exited="Exited"})(r.FullScreenMode||(r.FullScreenMode={})),r.LayerRenderStatus=void 0,(function(n){n[n.PreRender=0]="PreRender",n[n.DidRender=1]="DidRender"})(r.LayerRenderStatus||(r.LayerRenderStatus={})),r.PageMode=void 0,(function(n){n.Attachments="UseAttachments",n.Bookmarks="UseOutlines",n.ContentGroup="UseOC",n.Default="UserNone",n.FullScreen="FullScreen",n.Thumbnails="UseThumbs"})(r.PageMode||(r.PageMode={})),r.PasswordStatus=void 0,(function(n){n.RequiredPassword="RequiredPassword",n.WrongPassword="WrongPassword"})(r.PasswordStatus||(r.PasswordStatus={})),r.RotateDirection=void 0,(function(n){n.Backward="Backward",n.Forward="Forward"})(r.RotateDirection||(r.RotateDirection={})),r.ScrollMode=void 0,(function(n){n.Page="Page",n.Horizontal="Horizontal",n.Vertical="Vertical",n.Wrapped="Wrapped"})(r.ScrollMode||(r.ScrollMode={})),r.SpecialZoomLevel=void 0,(function(n){n.ActualSize="ActualSize",n.PageFit="PageFit",n.PageWidth="PageWidth"})(r.SpecialZoomLevel||(r.SpecialZoomLevel={})),r.ViewMode=void 0,(function(n){n.DualPage="DualPage",n.DualPageWithCover="DualPageWithCover",n.SinglePage="SinglePage"})(r.ViewMode||(r.ViewMode={}));var _n=function(n,u){return n.reduce(function(E,k,P){return P%u?E[E.length-1].push(k):E.push([k]),E},[])},De=function(){return typeof window<"u"?/(Mac|iPhone|iPod|iPad)/i.test(navigator.platform):!1},fe=function(n,u){switch(u[1].name){case"XYZ":return{bottomOffset:function(E,k){return u[3]===null?k:u[3]},leftOffset:function(E,k){return u[2]===null?0:u[2]},pageIndex:n,scaleTo:u[4]};case"Fit":case"FitB":return{bottomOffset:0,leftOffset:0,pageIndex:n,scaleTo:r.SpecialZoomLevel.PageFit};case"FitH":case"FitBH":return{bottomOffset:u[2],leftOffset:0,pageIndex:n,scaleTo:r.SpecialZoomLevel.PageWidth};default:return{bottomOffset:0,leftOffset:0,pageIndex:n,scaleTo:1}}},ue=new Map,He=new Map,Dt=function(n,u){return"".concat(n.loadingTask.docId,"___").concat(u.num,"R").concat(u.gen===0?"":u.gen)},pt=function(n,u){var E=Dt(n,u);return ue.has(E)?ue.get(E):null},kt=function(n,u,E){ue.set(Dt(n,u),E)},Jn=function(){ue.clear(),He.clear()},Bn=function(n,u){if(!n)return Promise.reject("The document is not loaded yet");var E="".concat(n.loadingTask.docId,"___").concat(u),k=He.get(E);return k?Promise.resolve(k):new Promise(function(P,F){n.getPage(u+1).then(function(D){He.set(E,D),D.ref&&kt(n,D.ref,u),P(D)})})},Hn=function(n,u){return new Promise(function(E){new Promise(function(k){typeof u=="string"?n.getDestination(u).then(function(P){k(P)}):k(u)}).then(function(k){if(typeof k[0]=="object"&&k[0]!==null){var P=k[0],F=pt(n,P);F===null?n.getPageIndex(P).then(function(z){kt(n,P,z),Hn(n,u).then(function(x){return E(x)})}):E(fe(F,k))}else{var D=fe(k[0],k);E(D)}})})},yn=function(n,u){var E=e.useRef(!1);d(function(){u&&!E.current&&(E.current=!0,n())},[n,u])},Un=function(n){var u=n.targetRef,E=n.onResize;d(function(){var k=new ResizeObserver(function(F){F.forEach(function(D){E(D.target)})}),P=u.current;if(P)return k.observe(P),function(){k.unobserve(P)}},[])},mn;(function(n){n[n.Solid=1]="Solid",n[n.Dashed=2]="Dashed",n[n.Beveled=3]="Beveled",n[n.Inset=4]="Inset",n[n.Underline=5]="Underline"})(mn||(mn={}));var nr=new RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+|-])?(\\d{2})?'?(\\d{2})?'?"),Xt=function(n,u,E,k){var P=parseInt(n,10);return P>=u&&P<=E?P:k},rr=function(n){var u=nr.exec(n);if(!u)return null;var E=parseInt(u[1],10),k=Xt(u[2],1,12,1)-1,P=Xt(u[3],1,31,1),F=Xt(u[4],0,23,0),D=Xt(u[5],0,59,0),z=Xt(u[6],0,59,0),x=u[7]||"Z",J=Xt(u[8],0,23,0),le=Xt(u[9],0,59,0);switch(x){case"-":F+=J,D+=le;break;case"+":F-=J,D-=le;break}return new Date(Date.UTC(E,k,P,F,D,z))},an=function(n){return n.contentsObj?n.contentsObj.str:n.contents||""},ln=function(n){return n.titleObj?n.titleObj.str:n.title||""},ir=function(n){var u=n.annotation,E=e.useContext(t).direction,k=ln(u),P=an(u),F=E===r.TextDirection.RightToLeft,D=e.useRef(),z="";if(u.modificationDate){var x=rr(u.modificationDate);z=x?"".concat(x.toLocaleDateString(),", ").concat(x.toLocaleTimeString()):""}return e.useLayoutEffect(function(){var J=D.current;if(J){var le=document.querySelector('[data-annotation-id="'.concat(u.id,'"]'));if(le){var de=le;return de.style.zIndex+=1,function(){de.style.zIndex="".concat(parseInt(de.style.zIndex,10)-1)}}}},[]),e.createElement("div",{ref:D,className:a({"rpv-core__annotation-popup-wrapper":!0,"rpv-core__annotation-popup-wrapper--rtl":F}),style:{top:u.annotationType===r.AnnotationType.Popup?"":"100%"}},k&&e.createElement(e.Fragment,null,e.createElement("div",{className:a({"rpv-core__annotation-popup-title":!0,"rpv-core__annotation-popup-title--ltr":!F,"rpv-core__annotation-popup-title--rtl":F})},k),e.createElement("div",{className:"rpv-core__annotation-popup-date"},z)),P&&e.createElement("div",{className:"rpv-core__annotation-popup-content"},P.split(`
|
|
10
|
+
`).map(function(J,le){return e.createElement(e.Fragment,{key:le},J,e.createElement("br",null))})))},An;(function(n){n.Click="Click",n.Hover="Hover"})(An||(An={}));var Pn=function(){var n=tt(!1),u=n.opened,E=n.toggle,k=e.useState(An.Hover),P=k[0],F=k[1],D=function(){switch(P){case An.Click:u&&F(An.Hover),E(r.ToggleStatus.Toggle);break;case An.Hover:F(An.Click),E(r.ToggleStatus.Open);break}},z=function(){P===An.Hover&&E(r.ToggleStatus.Open)},x=function(){P===An.Hover&&E(r.ToggleStatus.Close)};return{opened:u,closeOnHover:x,openOnHover:z,toggleOnClick:D}},tn=function(n){var u=n.annotation,E=n.children,k=n.ignoreBorder,P=n.hasPopup,F=n.isRenderable,D=n.page,z=n.viewport,x=u.rect,J=Pn(),le=J.closeOnHover,de=J.opened,pe=J.openOnHover,Te=J.toggleOnClick,_e=function(it){return[Math.min(it[0],it[2]),Math.min(it[1],it[3]),Math.max(it[0],it[2]),Math.max(it[1],it[3])]},Ie=_e([x[0],D.view[3]+D.view[1]-x[1],x[2],D.view[3]+D.view[1]-x[3]]),we=x[2]-x[0],Ye=x[3]-x[1],ze={borderColor:"",borderRadius:"",borderStyle:"",borderWidth:""};if(!k&&u.borderStyle.width>0){switch(u.borderStyle.style){case mn.Dashed:ze.borderStyle="dashed";break;case mn.Solid:ze.borderStyle="solid";break;case mn.Underline:ze=Object.assign({borderBottomStyle:"solid"},ze);break;case mn.Beveled:case mn.Inset:}var je=u.borderStyle.width;ze.borderWidth="".concat(je,"px"),u.borderStyle.style!==mn.Underline&&(we=we-2*je,Ye=Ye-2*je);var Nt=u.borderStyle,ht=Nt.horizontalCornerRadius,et=Nt.verticalCornerRadius;(ht>0||et>0)&&(ze.borderRadius="".concat(ht,"px / ").concat(et,"px")),u.color?ze.borderColor="rgb(".concat(u.color[0]|0,", ").concat(u.color[1]|0,", ").concat(u.color[2]|0,")"):ze.borderWidth="0"}return e.createElement(e.Fragment,null,F&&E({popup:{opened:de,closeOnHover:le,openOnHover:pe,toggleOnClick:Te},slot:{attrs:{style:Object.assign({height:"".concat(Ye,"px"),left:"".concat(Ie[0],"px"),top:"".concat(Ie[1],"px"),transform:"matrix(".concat(z.transform.join(","),")"),transformOrigin:"-".concat(Ie[0],"px -").concat(Ie[1],"px"),width:"".concat(we,"px")},ze)},children:e.createElement(e.Fragment,null,P&&de&&e.createElement(ir,{annotation:u}))}}))},cr=function(n){var u=n.annotation,E=n.page,k=n.viewport,P=u.hasPopup===!1,F=ln(u),D=an(u),z=!!(u.hasPopup||F||D);return e.createElement(tn,{annotation:u,hasPopup:P,ignoreBorder:!0,isRenderable:z,page:E,viewport:k},function(x){return e.createElement("div",U({},x.slot.attrs,{className:"rpv-core__annotation rpv-core__annotation--caret","data-annotation-id":u.id,onClick:x.popup.toggleOnClick,onMouseEnter:x.popup.openOnHover,onMouseLeave:x.popup.closeOnHover}),x.slot.children)})},Nr=function(n){var u=n.annotation,E=n.page,k=n.viewport,P=u.hasPopup===!1,F=ln(u),D=an(u),z=!!(u.hasPopup||F||D),x=u.rect,J=x[2]-x[0],le=x[3]-x[1],de=u.borderStyle.width;return e.createElement(tn,{annotation:u,hasPopup:P,ignoreBorder:!0,isRenderable:z,page:E,viewport:k},function(pe){return e.createElement("div",U({},pe.slot.attrs,{className:"rpv-core__annotation rpv-core__annotation--circle","data-annotation-id":u.id,onClick:pe.popup.toggleOnClick,onMouseEnter:pe.popup.openOnHover,onMouseLeave:pe.popup.closeOnHover}),e.createElement("svg",{height:"".concat(le,"px"),preserveAspectRatio:"none",version:"1.1",viewBox:"0 0 ".concat(J," ").concat(le),width:"".concat(J,"px")},e.createElement("circle",{cy:le/2,fill:"none",rx:J/2-de/2,ry:le/2-de/2,stroke:"transparent",strokeWidth:de||1})),pe.slot.children)})},Br=function(n){var u=n.split("/").pop();return u?u.split("#")[0].split("?")[0]:n},Hr=function(n,u){var E=typeof u=="string"?"":URL.createObjectURL(new Blob([u],{type:""})),k=document.createElement("a");k.style.display="none",k.href=E||n,k.setAttribute("download",Br(n)),document.body.appendChild(k),k.click(),document.body.removeChild(k),E&&URL.revokeObjectURL(E)},Vr=function(n){var u=n.annotation,E=n.page,k=n.viewport,P=ln(u),F=an(u),D=u.hasPopup===!1&&(!!P||!!F),z=function(){var x=u.file;x&&Hr(x.filename,x.content)};return e.createElement(tn,{annotation:u,hasPopup:D,ignoreBorder:!0,isRenderable:!0,page:E,viewport:k},function(x){return e.createElement("div",U({},x.slot.attrs,{className:"rpv-core__annotation rpv-core__annotation--file-attachment","data-annotation-id":u.id,onClick:x.popup.toggleOnClick,onDoubleClick:z,onMouseEnter:x.popup.openOnHover,onMouseLeave:x.popup.closeOnHover}),x.slot.children)})},Wr=function(n){var u=n.annotation,E=n.page,k=n.viewport,P=u.hasPopup===!1,F=ln(u),D=an(u),z=!!(u.hasPopup||F||D);return e.createElement(tn,{annotation:u,hasPopup:P,ignoreBorder:!0,isRenderable:z,page:E,viewport:k},function(x){return e.createElement("div",U({},x.slot.attrs,{className:"rpv-core__annotation rpv-core__annotation--free-text","data-annotation-id":u.id,onClick:x.popup.toggleOnClick,onMouseEnter:x.popup.openOnHover,onMouseLeave:x.popup.closeOnHover}),x.slot.children)})},_r=function(n){var u=n.annotation,E=n.page,k=n.viewport,P=ln(u),F=an(u),D=!!(P||F),z=["Circle","Ink","Line","Polygon","PolyLine","Square"],x=!u.parentType||z.indexOf(u.parentType)!==-1;return d(function(){if(u.parentId){var J=document.querySelector('[data-annotation-id="'.concat(u.parentId,'"]')),le=document.querySelector('[data-annotation-id="'.concat(u.id,'"]'));if(!(!J||!le)){var de=parseFloat(J.style.left),pe=parseFloat(J.style.top)+parseFloat(J.style.height);le.style.left="".concat(de,"px"),le.style.top="".concat(pe,"px"),le.style.transformOrigin="-".concat(de,"px -").concat(pe,"px")}}},[]),e.createElement(tn,{annotation:u,hasPopup:x,ignoreBorder:!1,isRenderable:D,page:E,viewport:k},function(J){return e.createElement("div",U({},J.slot.attrs,{className:"rpv-core__annotation rpv-core__annotation--popup","data-annotation-id":u.id}),e.createElement(ir,{annotation:u}))})},Cr=function(n){var u=n.annotation,E=n.childAnnotation,k=n.page,P=n.viewport,F=u.hasPopup===!1,D=ln(u),z=an(u),x=!!(u.hasPopup||D||z),J=u.quadPoints&&u.quadPoints.length>0;if(J){var le=u.quadPoints.map(function(de){return Object.assign({},u,{rect:[de[2].x,de[2].y,de[1].x,de[1].y],quadPoints:[]})});return e.createElement(e.Fragment,null,le.map(function(de,pe){return e.createElement(Cr,{key:pe,annotation:de,childAnnotation:E,page:k,viewport:P})}))}return e.createElement(tn,{annotation:u,hasPopup:F,ignoreBorder:!0,isRenderable:x,page:k,viewport:P},function(de){return e.createElement(e.Fragment,null,e.createElement("div",U({},de.slot.attrs,{className:"rpv-core__annotation rpv-core__annotation--highlight","data-annotation-id":u.id,onClick:de.popup.toggleOnClick,onMouseEnter:de.popup.openOnHover,onMouseLeave:de.popup.closeOnHover}),de.slot.children),E&&E.annotationType===r.AnnotationType.Popup&&de.popup.opened&&e.createElement(_r,{annotation:E,page:k,viewport:P}))})},jr=function(n){var u=n.annotation,E=n.page,k=n.viewport,P=u.hasPopup===!1,F=ln(u),D=an(u),z=!!(u.hasPopup||F||D),x=u.rect,J=x[2]-x[0],le=x[3]-x[1],de=u.borderStyle.width;return e.createElement(tn,{annotation:u,hasPopup:P,ignoreBorder:!0,isRenderable:z,page:E,viewport:k},function(pe){return e.createElement("div",U({},pe.slot.attrs,{className:"rpv-core__annotation rpv-core__annotation--ink","data-annotation-id":u.id,onClick:pe.popup.toggleOnClick,onMouseEnter:pe.popup.openOnHover,onMouseLeave:pe.popup.closeOnHover}),u.inkLists&&u.inkLists.length&&e.createElement("svg",{height:"".concat(le,"px"),preserveAspectRatio:"none",version:"1.1",viewBox:"0 0 ".concat(J," ").concat(le),width:"".concat(J,"px")},u.inkLists.map(function(Te,_e){return e.createElement("polyline",{key:_e,fill:"none",stroke:"transparent",strokeWidth:de||1,points:Te.map(function(Ie){return"".concat(Ie.x-x[0],",").concat(x[3]-Ie.y)}).join(" ")})})),pe.slot.children)})},Ur=function(n){var u=n.annotation,E=n.page,k=n.viewport,P=u.hasPopup===!1,F=ln(u),D=an(u),z=!!(u.hasPopup||F||D),x=u.rect,J=x[2]-x[0],le=x[3]-x[1],de=u.borderStyle.width;return e.createElement(tn,{annotation:u,hasPopup:P,ignoreBorder:!0,isRenderable:z,page:E,viewport:k},function(pe){return e.createElement("div",U({},pe.slot.attrs,{className:"rpv-core__annotation rpv-core__annotation--line","data-annotation-id":u.id,onClick:pe.popup.toggleOnClick,onMouseEnter:pe.popup.openOnHover,onMouseLeave:pe.popup.closeOnHover}),e.createElement("svg",{height:"".concat(le,"px"),preserveAspectRatio:"none",version:"1.1",viewBox:"0 0 ".concat(J," ").concat(le),width:"".concat(J,"px")},e.createElement("line",{stroke:"transparent",strokeWidth:de||1,x1:x[2]-u.lineCoordinates[0],x2:x[2]-u.lineCoordinates[2],y1:x[3]-u.lineCoordinates[1],y2:x[3]-u.lineCoordinates[3]})),pe.slot.children)})},zr=/^([^\w]*)(javascript|data|vbscript)/im,qr=/&#(\w+)(^\w|;)?/g,Gr=/[\u0000-\u001F\u007F-\u009F\u2000-\u200D\uFEFF]/gim,Xr=/^([^:]+):/gm,$r=function(n){return n.replace(qr,function(u,E){return String.fromCharCode(E)})},Yr=function(n,u){var E=$r(n||"").replace(Gr,"").trim();if(!E)return u;var k=E[0];if(k==="."||k==="/")return E;var P=E.match(Xr);if(!P)return E;var F=P[0];return zr.test(F)?u:E},pr=function(n){var u,E=n.annotation,k=n.annotationContainerRef,P=n.doc,F=n.outlines,D=n.page,z=n.pageIndex,x=n.scale,J=n.viewport,le=n.onExecuteNamedAction,de=n.onJumpFromLinkAnnotation,pe=n.onJumpToDest,Te=e.useRef(),_e=F&&F.length&&E.dest&&typeof E.dest=="string"?(u=F.find(function(je){return je.dest===E.dest}))===null||u===void 0?void 0:u.title:"",Ie=function(je){je.preventDefault(),E.action?le(E.action):Hn(P,E.dest).then(function(Nt){var ht=Te.current,et=k.current;if(ht&&et){var it=ht.getBoundingClientRect();et.style.setProperty("height","100%"),et.style.setProperty("width","100%");var $t=et.getBoundingClientRect();et.style.removeProperty("height"),et.style.removeProperty("width");var fn=(it.left-$t.left)/x,Zt=($t.bottom-it.bottom+it.height)/x;de({bottomOffset:Zt,label:_e,leftOffset:fn,pageIndex:z})}pe(Nt)})},we=!!(E.url||E.dest||E.action||E.unsafeUrl),Ye={};if(E.url||E.unsafeUrl){var ze=Yr(E.url||E.unsafeUrl,"");ze?Ye={"data-target":"external",href:ze,rel:"noopener noreferrer nofollow",target:E.newWindow?"_blank":"",title:ze}:we=!1}else Ye={href:"","data-annotation-link":E.id,onClick:Ie};return _e&&(Ye=Object.assign({},Ye,{title:_e,"aria-label":_e})),e.createElement(tn,{annotation:E,hasPopup:!1,ignoreBorder:!1,isRenderable:we,page:D,viewport:J},function(je){return e.createElement("div",U({},je.slot.attrs,{className:"rpv-core__annotation rpv-core__annotation--link","data-annotation-id":E.id,"data-testid":"core__annotation--link-".concat(E.id)}),e.createElement("a",U({ref:Te},Ye)))})},Kr=function(n){var u=n.annotation,E=n.page,k=n.viewport,P=u.hasPopup===!1,F=ln(u),D=an(u),z=!!(u.hasPopup||F||D),x=u.rect,J=x[2]-x[0],le=x[3]-x[1],de=u.borderStyle.width;return e.createElement(tn,{annotation:u,hasPopup:P,ignoreBorder:!0,isRenderable:z,page:E,viewport:k},function(pe){return e.createElement("div",U({},pe.slot.attrs,{className:"rpv-core__annotation rpv-core__annotation--polygon","data-annotation-id":u.id,onClick:pe.popup.toggleOnClick,onMouseEnter:pe.popup.openOnHover,onMouseLeave:pe.popup.closeOnHover}),u.vertices&&u.vertices.length&&e.createElement("svg",{height:"".concat(le,"px"),preserveAspectRatio:"none",version:"1.1",viewBox:"0 0 ".concat(J," ").concat(le),width:"".concat(J,"px")},e.createElement("polygon",{fill:"none",stroke:"transparent",strokeWidth:de||1,points:u.vertices.map(function(Te){return"".concat(Te.x-x[0],",").concat(x[3]-Te.y)}).join(" ")})),pe.slot.children)})},Jr=function(n){var u=n.annotation,E=n.page,k=n.viewport,P=u.hasPopup===!1,F=ln(u),D=an(u),z=!!(u.hasPopup||F||D),x=u.rect,J=x[2]-x[0],le=x[3]-x[1],de=u.borderStyle.width;return e.createElement(tn,{annotation:u,hasPopup:P,ignoreBorder:!0,isRenderable:z,page:E,viewport:k},function(pe){return e.createElement("div",U({},pe.slot.attrs,{className:"rpv-core__annotation rpv-core__annotation--polyline","data-annotation-id":u.id,onClick:pe.popup.toggleOnClick,onMouseEnter:pe.popup.openOnHover,onMouseLeave:pe.popup.closeOnHover}),u.vertices&&u.vertices.length&&e.createElement("svg",{height:"".concat(le,"px"),preserveAspectRatio:"none",version:"1.1",viewBox:"0 0 ".concat(J," ").concat(le),width:"".concat(J,"px")},e.createElement("polyline",{fill:"none",stroke:"transparent",strokeWidth:de||1,points:u.vertices.map(function(Te){return"".concat(Te.x-x[0],",").concat(x[3]-Te.y)}).join(" ")})),pe.slot.children)})},Zr=function(n){var u=n.annotation,E=n.page,k=n.viewport,P=u.hasPopup===!1,F=ln(u),D=an(u),z=!!(u.hasPopup||F||D),x=u.rect,J=x[2]-x[0],le=x[3]-x[1],de=u.borderStyle.width;return e.createElement(tn,{annotation:u,hasPopup:P,ignoreBorder:!0,isRenderable:z,page:E,viewport:k},function(pe){return e.createElement("div",U({},pe.slot.attrs,{className:"rpv-core__annotation rpv-core__annotation--square","data-annotation-id":u.id,onClick:pe.popup.toggleOnClick,onMouseEnter:pe.popup.openOnHover,onMouseLeave:pe.popup.closeOnHover}),e.createElement("svg",{height:"".concat(le,"px"),preserveAspectRatio:"none",version:"1.1",viewBox:"0 0 ".concat(J," ").concat(le),width:"".concat(J,"px")},e.createElement("rect",{height:le-de,fill:"none",stroke:"transparent",strokeWidth:de||1,x:de/2,y:de/2,width:J-de})),pe.slot.children)})},Qr=function(n){var u=n.annotation,E=n.page,k=n.viewport,P=u.hasPopup===!1,F=ln(u),D=an(u),z=!!(u.hasPopup||F||D);return e.createElement(tn,{annotation:u,hasPopup:P,ignoreBorder:!0,isRenderable:z,page:E,viewport:k},function(x){return e.createElement("div",U({},x.slot.attrs,{className:"rpv-core__annotation rpv-core__annotation--squiggly","data-annotation-id":u.id,onClick:x.popup.toggleOnClick,onMouseEnter:x.popup.openOnHover,onMouseLeave:x.popup.closeOnHover}),x.slot.children)})},ei=function(n){var u=n.annotation,E=n.page,k=n.viewport,P=u.hasPopup===!1,F=ln(u),D=an(u),z=!!(u.hasPopup||F||D);return e.createElement(tn,{annotation:u,hasPopup:P,ignoreBorder:!0,isRenderable:z,page:E,viewport:k},function(x){return e.createElement("div",U({},x.slot.attrs,{className:"rpv-core__annotation rpv-core__annotation--stamp","data-annotation-id":u.id,onClick:x.popup.toggleOnClick,onMouseEnter:x.popup.openOnHover,onMouseLeave:x.popup.closeOnHover}),x.slot.children)})},ti=function(n){var u=n.annotation,E=n.page,k=n.viewport,P=u.hasPopup===!1,F=ln(u),D=an(u),z=!!(u.hasPopup||F||D);return e.createElement(tn,{annotation:u,hasPopup:P,ignoreBorder:!0,isRenderable:z,page:E,viewport:k},function(x){return e.createElement("div",U({},x.slot.attrs,{className:"rpv-core__annotation rpv-core__annotation--strike-out","data-annotation-id":u.id,onClick:x.popup.toggleOnClick,onMouseEnter:x.popup.openOnHover,onMouseLeave:x.popup.closeOnHover}),x.slot.children)})},gr=function(){return e.createElement(T,{size:16},e.createElement("path",{d:"M.5,16.5a1,1,0,0,0,1,1h2v4l4-4h15a1,1,0,0,0,1-1V3.5a1,1,0,0,0-1-1H1.5a1,1,0,0,0-1,1Z"}),e.createElement("path",{d:"M7.25,9.75A.25.25,0,1,1,7,10a.25.25,0,0,1,.25-.25"}),e.createElement("path",{d:"M12,9.75a.25.25,0,1,1-.25.25A.25.25,0,0,1,12,9.75"}),e.createElement("path",{d:"M16.75,9.75a.25.25,0,1,1-.25.25.25.25,0,0,1,.25-.25"}))},Rr=function(){return e.createElement(T,{size:16},e.createElement("path",{d:"M0.500 12.001 A11.500 11.500 0 1 0 23.500 12.001 A11.500 11.500 0 1 0 0.500 12.001 Z"}),e.createElement("path",{d:"M6.000 12.001 A6.000 6.000 0 1 0 18.000 12.001 A6.000 6.000 0 1 0 6.000 12.001 Z"}),e.createElement("path",{d:"M21.423 5.406L17.415 9.414"}),e.createElement("path",{d:"M14.587 6.585L18.607 2.565"}),e.createElement("path",{d:"M5.405 21.424L9.413 17.416"}),e.createElement("path",{d:"M6.585 14.588L2.577 18.596"}),e.createElement("path",{d:"M18.602 21.419L14.595 17.412"}),e.createElement("path",{d:"M17.419 14.58L21.428 18.589"}),e.createElement("path",{d:"M2.582 5.399L6.588 9.406"}),e.createElement("path",{d:"M9.421 6.581L5.412 2.572"}))},Tr=function(){return e.createElement(T,{size:16},e.createElement("path",{d:"M4.000 18.500 A1.500 1.500 0 1 0 7.000 18.500 A1.500 1.500 0 1 0 4.000 18.500 Z"}),e.createElement("path",{d:"M20.5.5l-9.782,9.783a7,7,0,1,0,3,3L17,10h1.5V8.5L19,8h1.5V6.5L21,6h1.5V4.5l1-1V.5Z"}))},ni=function(){return e.createElement(T,{size:16},e.createElement("path",{d:"M2.000 2.500 L22.000 2.500 L22.000 23.500 L2.000 23.500 Z"}),e.createElement("path",{d:"M6 4.5L6 0.5"}),e.createElement("path",{d:"M18 4.5L18 0.5"}),e.createElement("path",{d:"M10 4.5L10 0.5"}),e.createElement("path",{d:"M14 4.5L14 0.5"}))},ur=function(){return e.createElement(T,{size:16},e.createElement("path",{d:"M17.5 0.498L17.5 23.498"}),e.createElement("path",{d:"M10.5 0.498L10.5 23.498"}),e.createElement("path",{d:"M23.5.5H6.5a6,6,0,0,0,0,12h4"}))},ri=function(){return e.createElement(T,{size:16},e.createElement("path",{d:"M2.5 22.995L12 6.005 21.5 22.995 2.5 22.995z"}))},ii=function(n){var u=n.annotation,E=n.childAnnotation,k=n.page,P=n.viewport,F=u.hasPopup===!1,D=ln(u),z=an(u),x=!!(u.hasPopup||D||z),J=u.name?u.name.toLowerCase():"";return e.createElement(tn,{annotation:u,hasPopup:F,ignoreBorder:!1,isRenderable:x,page:k,viewport:P},function(le){return e.createElement(e.Fragment,null,e.createElement("div",U({},le.slot.attrs,{className:"rpv-core__annotation rpv-core__annotation--text","data-annotation-id":u.id,onClick:le.popup.toggleOnClick,onMouseEnter:le.popup.openOnHover,onMouseLeave:le.popup.closeOnHover}),J&&e.createElement("div",{className:"rpv-core__annotation-text-icon"},J==="check"&&e.createElement(H,null),J==="comment"&&e.createElement(gr,null),J==="help"&&e.createElement(Rr,null),J==="insert"&&e.createElement(ri,null),J==="key"&&e.createElement(Tr,null),J==="note"&&e.createElement(ni,null),(J==="newparagraph"||J==="paragraph")&&e.createElement(ur,null)),le.slot.children),E&&E.annotationType===r.AnnotationType.Popup&&le.popup.opened&&e.createElement(_r,{annotation:E,page:k,viewport:P}))})},ai=function(n){var u=n.annotation,E=n.page,k=n.viewport,P=u.hasPopup===!1,F=ln(u),D=an(u),z=!!(u.hasPopup||F||D);return e.createElement(tn,{annotation:u,hasPopup:P,ignoreBorder:!0,isRenderable:z,page:E,viewport:k},function(x){return e.createElement("div",U({},x.slot.attrs,{className:"rpv-core__annotation rpv-core__annotation--underline","data-annotation-id":u.id,onClick:x.popup.toggleOnClick,onMouseEnter:x.popup.openOnHover,onMouseLeave:x.popup.closeOnHover}),x.slot.children)})},yr=function(n){var u=n.annotations,E=n.doc,k=n.outlines,P=n.page,F=n.pageIndex,D=n.plugins,z=n.rotation,x=n.scale,J=n.onExecuteNamedAction,le=n.onJumpFromLinkAnnotation,de=n.onJumpToDest,pe=e.useRef(),Te=P.getViewport({rotation:z,scale:x}),_e=Te.clone({dontFlip:!0}),Ie=u.filter(function(we){return!we.parentId});return d(function(){var we=pe.current;we&&D.forEach(function(Ye){Ye.onAnnotationLayerRender&&Ye.onAnnotationLayerRender({annotations:Ie,container:we,pageIndex:F,rotation:z,scale:x})})},[]),e.createElement("div",{ref:pe,className:"rpv-core__annotation-layer","data-testid":"core__annotation-layer-".concat(F)},Ie.map(function(we){var Ye=u.find(function(ze){return ze.parentId===we.id});switch(we.annotationType){case r.AnnotationType.Caret:return e.createElement(cr,{key:we.id,annotation:we,page:P,viewport:_e});case r.AnnotationType.Circle:return e.createElement(Nr,{key:we.id,annotation:we,page:P,viewport:_e});case r.AnnotationType.FileAttachment:return e.createElement(Vr,{key:we.id,annotation:we,page:P,viewport:_e});case r.AnnotationType.FreeText:return e.createElement(Wr,{key:we.id,annotation:we,page:P,viewport:_e});case r.AnnotationType.Highlight:return e.createElement(Cr,{key:we.id,annotation:we,childAnnotation:Ye,page:P,viewport:_e});case r.AnnotationType.Ink:return e.createElement(jr,{key:we.id,annotation:we,page:P,viewport:_e});case r.AnnotationType.Line:return e.createElement(Ur,{key:we.id,annotation:we,page:P,viewport:_e});case r.AnnotationType.Link:return e.createElement(pr,{key:we.id,annotation:we,annotationContainerRef:pe,doc:E,outlines:k,page:P,pageIndex:F,scale:x,viewport:_e,onExecuteNamedAction:J,onJumpFromLinkAnnotation:le,onJumpToDest:de});case r.AnnotationType.Polygon:return e.createElement(Kr,{key:we.id,annotation:we,page:P,viewport:_e});case r.AnnotationType.Polyline:return e.createElement(Jr,{key:we.id,annotation:we,page:P,viewport:_e});case r.AnnotationType.Popup:return e.createElement(_r,{key:we.id,annotation:we,page:P,viewport:_e});case r.AnnotationType.Square:return e.createElement(Zr,{key:we.id,annotation:we,page:P,viewport:_e});case r.AnnotationType.Squiggly:return e.createElement(Qr,{key:we.id,annotation:we,page:P,viewport:_e});case r.AnnotationType.Stamp:return e.createElement(ei,{key:we.id,annotation:we,page:P,viewport:_e});case r.AnnotationType.StrikeOut:return e.createElement(ti,{key:we.id,annotation:we,page:P,viewport:_e});case r.AnnotationType.Text:return e.createElement(ii,{key:we.id,annotation:we,childAnnotation:Ye,page:P,viewport:_e});case r.AnnotationType.Underline:return e.createElement(ai,{key:we.id,annotation:we,page:P,viewport:_e});default:return e.createElement(e.Fragment,{key:we.id})}}))},si=function(n){var u=n.page,E=n.renderAnnotations,k=L(),P=e.useState({loading:!0,annotations:[]}),F=P[0],D=P[1];return e.useEffect(function(){u.getAnnotations({intent:"display"}).then(function(z){k.current&&D({loading:!1,annotations:z})})},[]),F.loading?e.createElement(e.Fragment,null):E(F.annotations)},oi=function(n){var u=n.doc,E=n.outlines,k=n.page,P=n.pageIndex,F=n.plugins,D=n.rotation,z=n.scale,x=n.onExecuteNamedAction,J=n.onJumpFromLinkAnnotation,le=n.onJumpToDest,de=function(pe){return e.createElement(yr,{annotations:pe,doc:u,outlines:E,page:k,pageIndex:P,plugins:F,rotation:D,scale:z,onExecuteNamedAction:x,onJumpFromLinkAnnotation:J,onJumpToDest:le})};return e.createElement(si,{page:k,renderAnnotations:de})},kr=function(n,u){var E,k;if(Math.floor(n)===n)return[n,1];var P=1/n;if(P>u)return[1,u];if(Math.floor(P)===P)return[1,P];for(var F=n>1?P:n,D=0,z=1,x=1,J=1;;){var le=D+x,de=z+J;if(de>u)break;F<=le/de?(E=[le,de],x=E[0],J=E[1]):(k=[le,de],D=k[0],z=k[1])}var pe=(D/z+x/J)/2;return F<pe?F===n?[D,z]:[z,D]:F===n?[x,J]:[J,x]},dr=function(n,u){var E=n%u;return E===0?n:Math.floor(n-E)},li=4096*4096,ci=function(n){var u=n.canvasLayerRef,E=n.height,k=n.page,P=n.pageIndex,F=n.plugins,D=n.rotation,z=n.scale,x=n.width,J=n.onRenderCanvasCompleted,le=e.useRef();return d(function(){var de=le.current;de&&de.cancel();var pe=u.current;pe.removeAttribute("data-testid"),F.forEach(function(it){it.onCanvasLayerRender&&it.onCanvasLayerRender({ele:pe,pageIndex:P,rotation:D,scale:z,status:r.LayerRenderStatus.PreRender})});var Te=k.getViewport({rotation:D,scale:z}),_e=window.devicePixelRatio||1,Ie=Math.sqrt(li/(Te.width*Te.height)),we=_e>Ie;we?pe.style.transform="scale(1, 1)":pe.style.removeProperty("transform");var Ye=Math.min(Ie,_e),ze=kr(Ye,8),je=ze[0],Nt=ze[1];pe.width=dr(Te.width*Ye,je),pe.height=dr(Te.height*Ye,je),pe.style.width="".concat(dr(Te.width,Nt),"px"),pe.style.height="".concat(dr(Te.height,Nt),"px"),pe.hidden=!0;var ht=pe.getContext("2d",{alpha:!1}),et=we||_e!==1?[Ye,0,0,Ye,0,0]:null;return le.current=k.render({canvasContext:ht,transform:et,viewport:Te}),le.current.promise.then(function(){pe.hidden=!1,pe.setAttribute("data-testid","core__canvas-layer-".concat(P)),F.forEach(function(it){it.onCanvasLayerRender&&it.onCanvasLayerRender({ele:pe,pageIndex:P,rotation:D,scale:z,status:r.LayerRenderStatus.DidRender})}),J()},function(){J()}),function(){pe&&(pe.width=0,pe.height=0)}},[]),e.createElement("div",{className:"rpv-core__canvas-layer",style:{height:"".concat(E,"px"),width:"".concat(x,"px")}},e.createElement("canvas",{ref:u}))},Sr=function(n){var u=n.height,E=n.page,k=n.rotation,P=n.scale,F=n.width,D=e.useRef(),z=function(){var x=D.current;x&&(x.innerHTML="")};return d(function(){var x=D.current,J=E.getViewport({rotation:k,scale:P});E.getOperatorList().then(function(le){z();var de=new s.SVGGraphics(E.commonObjs,E.objs);de.getSVG(le,J).then(function(pe){pe.style.height="".concat(u,"px"),pe.style.width="".concat(F,"px"),x.appendChild(pe)})})},[]),e.createElement("div",{className:"rpv-core__svg-layer",ref:D})},ui=function(n){var u=n.containerRef,E=n.page,k=n.pageIndex,P=n.plugins,F=n.rotation,D=n.scale,z=n.onRenderTextCompleted,x=e.useRef(),J=function(){var le=u.current;if(le){var de=[].slice.call(le.querySelectorAll(".rpv-core__text-layer-text"));de.forEach(function(Te){return le.removeChild(Te)});var pe=[].slice.call(le.querySelectorAll('br[role="presentation"]'));pe.forEach(function(Te){return le.removeChild(Te)})}};return d(function(){var le=x.current;le&&le.cancel();var de=u.current;if(de){de.removeAttribute("data-testid");var pe=E.getViewport({rotation:F,scale:D});return P.forEach(function(Te){Te.onTextLayerRender&&Te.onTextLayerRender({ele:de,pageIndex:k,scale:D,status:r.LayerRenderStatus.PreRender})}),E.getTextContent().then(function(Te){J(),x.current=s.renderTextLayer({container:de,textContent:Te,textContentSource:Te,viewport:pe}),x.current.promise.then(function(){de.setAttribute("data-testid","core__text-layer-".concat(k));var _e=[].slice.call(de.children);_e.forEach(function(Ie){Ie.classList.contains("rpv-core__text-layer-text--not")||Ie.classList.add("rpv-core__text-layer-text")}),P.forEach(function(Ie){Ie.onTextLayerRender&&Ie.onTextLayerRender({ele:de,pageIndex:k,scale:D,status:r.LayerRenderStatus.DidRender})}),z()},function(){de.removeAttribute("data-testid"),z()})}),function(){var Te;J(),(Te=x.current)===null||Te===void 0||Te.cancel()}}},[]),e.createElement("div",{className:"rpv-core__text-layer",ref:u})},Mr=function(n){var u=n.doc,E=n.measureRef,k=n.outlines,P=n.pageIndex,F=n.pageRotation,D=n.pageSize,z=n.plugins,x=n.renderPage,J=n.renderQueueKey,le=n.rotation,de=n.scale,pe=n.shouldRender,Te=n.viewMode,_e=n.onExecuteNamedAction,Ie=n.onJumpFromLinkAnnotation,we=n.onJumpToDest,Ye=n.onRenderCompleted,ze=n.onRotatePage,je=L(),Nt=e.useState(null),ht=Nt[0],et=Nt[1],it=e.useState(!1),$t=it[0],fn=it[1],Zt=e.useState(!1),Cn=Zt[0],on=Zt[1],Ln=e.useRef(),Qt=e.useRef(),Zn=Math.abs(le+F)%180===0,On=D.pageWidth*de,wn=D.pageHeight*de,En=Zn?On:wn,pn=Zn?wn:On,Mn=(D.rotation+le+F)%360,xn=e.useRef(0),Yn=function(){Bn(u,P).then(function(At){je.current&&(xn.current=J,et(At))})},er=function(At){return e.createElement(e.Fragment,null,At.canvasLayer.children,At.textLayer.children,At.annotationLayer.children)},qn=x||er,Gn=function(){je.current&&fn(!0)},_t=function(){je.current&&on(!0)};return e.useEffect(function(){et(null),fn(!1),on(!1)},[F,le,de]),e.useEffect(function(){pe&&je.current&&!ht&&Yn()},[pe,ht]),e.useEffect(function(){$t&&Cn&&(J!==xn.current?(et(null),fn(!1),on(!1)):Ye(P))},[$t,Cn]),e.createElement("div",{className:a({"rpv-core__page-layer":!0,"rpv-core__page-layer--dual":Te===r.ViewMode.DualPage,"rpv-core__page-layer--dual-cover":Te===r.ViewMode.DualPageWithCover,"rpv-core__page-layer--single":Te===r.ViewMode.SinglePage}),"data-testid":"core__page-layer-".concat(P),ref:E,style:{height:"".concat(pn,"px"),width:"".concat(En,"px")}},ht?e.createElement(e.Fragment,null,qn({annotationLayer:{attrs:{},children:e.createElement(oi,{doc:u,outlines:k,page:ht,pageIndex:P,plugins:z,rotation:Mn,scale:de,onExecuteNamedAction:_e,onJumpFromLinkAnnotation:Ie,onJumpToDest:we})},canvasLayer:{attrs:{},children:e.createElement(ci,{canvasLayerRef:Ln,height:pn,page:ht,pageIndex:P,plugins:z,rotation:Mn,scale:de,width:En,onRenderCanvasCompleted:Gn})},canvasLayerRendered:$t,doc:u,height:pn,pageIndex:P,rotation:Mn,scale:de,svgLayer:{attrs:{},children:e.createElement(Sr,{height:pn,page:ht,rotation:Mn,scale:de,width:En})},textLayer:{attrs:{},children:e.createElement(ui,{containerRef:Qt,page:ht,pageIndex:P,plugins:z,rotation:Mn,scale:de,onRenderTextCompleted:_t})},textLayerRendered:Cn,width:En,markRendered:Ye,onRotatePage:function(At){return ze(P,At)}}),z.map(function(At,Vt){return At.renderPageLayer?e.createElement(e.Fragment,{key:Vt},At.renderPageLayer({canvasLayerRef:Ln,canvasLayerRendered:$t,doc:u,height:pn,pageIndex:P,rotation:Mn,scale:de,textLayerRef:Qt,textLayerRendered:Cn,width:En})):e.createElement(e.Fragment,{key:Vt})})):e.createElement(Y,{testId:"core__page-layer-loading-".concat(P)}))},xr=function(n){var u=n.split(/\./).pop();return u?u.toLowerCase():""},di=function(n,u){var E=u.rect;return n.height!==E.height||n.width!==E.width?E:n},wr=function(n){var u=n.elementRef,E=e.useState(u.current),k=E[0],P=E[1],F=e.useRef(!1),D=e.useReducer(di,{height:0,width:0}),z=D[0],x=D[1];return d(function(){u.current!==k&&P(u.current)}),d(function(){if(k&&!F.current){F.current=!0;var J=k.getBoundingClientRect(),le=J.height,de=J.width;x({rect:{height:le,width:de}})}},[k]),e.useEffect(function(){if(k){var J=new ResizeObserver(function(le,de){le.forEach(function(pe){if(pe.target===k){var Te=pe.contentRect,_e=Te.height,Ie=Te.width;x({rect:{height:_e,width:Ie}})}})});return J.observe(k),function(){J.unobserve(k)}}},[k]),z},Ht;(function(n){n.Horizontal="Horizontal",n.Vertical="Vertical",n.Both="Both"})(Ht||(Ht={}));var hi=function(n){return 1-Math.pow(1-n,4)},Xn=1e-4,fi=function(n,u,E,k,P,F){P===void 0&&(P=function(_e){return _e}),F===void 0&&(F=function(){});var D=0,z=0,x=!1;switch(u){case Ht.Horizontal:z=n.scrollLeft,D=0;case Ht.Both:z=n.scrollLeft,D=n.scrollTop;break;case Ht.Vertical:default:z=0,D=n.scrollTop;break}var J=function(){x||(x=!0,n.scrollLeft=E.left,n.scrollTop=E.top,F())};if(Math.abs(D-E.top)<=Xn&&u===Ht.Vertical){J();return}if(Math.abs(z-E.left)<=Xn&&u===Ht.Horizontal){J();return}var le=-1,de,pe={left:z-E.left,top:D-E.top},Te=function(_e){le===-1&&(le=_e);var Ie=_e-le,we=Math.min(Ie/k,1),Ye=P(we),ze={left:z-pe.left*Ye,top:D-pe.top*Ye};switch(u){case Ht.Horizontal:n.scrollLeft=ze.left;break;case Ht.Both:n.scrollLeft=ze.left,n.scrollTop=ze.top;break;case Ht.Vertical:default:n.scrollTop=ze.top;break}Math.abs(ze.top-E.top)<=Xn&&Math.abs(ze.left-E.left)<=Xn&&!x&&(window.cancelAnimationFrame(de),J()),Ie<k?de=window.requestAnimationFrame(Te):window.cancelAnimationFrame(de)};de=window.requestAnimationFrame(Te)},Er={left:0,top:0},Fr={capture:!1,passive:!0},mr=400,Ar=function(n){var u=n.elementRef,E=n.enableSmoothScroll,k=n.isRtl,P=n.scrollDirection,F=n.onSmoothScroll,D=e.useState(Er),z=D[0],x=D[1],J=e.useState(u.current),le=J[0],de=J[1],pe=k?-1:1,Te=e.useRef(P);Te.current=P;var _e=e.useRef(Er),Ie=e.useRef(!0),we=e.useCallback(function(){Ie.current=!0,E&&x(_e.current),F(!1)},[]),Ye=e.useCallback(function(){if(le){switch(Te.current){case Ht.Horizontal:_e.current={left:pe*le.scrollLeft,top:0};break;case Ht.Both:_e.current={left:pe*le.scrollLeft,top:le.scrollTop};break;case Ht.Vertical:default:_e.current={left:0,top:le.scrollTop};break}(!E||Ie.current)&&x(_e.current)}},[le]);d(function(){de(u.current)}),d(function(){if(le)return le.addEventListener("scroll",Ye,Fr),function(){le.removeEventListener("scroll",Ye,Fr)}},[le]);var ze=e.useCallback(function(je,Nt){var ht=u.current;if(!ht)return Promise.resolve();var et={left:0,top:0};switch(Te.current){case Ht.Horizontal:et.left=pe*je.left;break;case Ht.Both:et.left=pe*je.left,et.top=je.top;break;case Ht.Vertical:default:et.top=je.top;break}return Nt?(Ie.current=!1,F(!0),new Promise(function(it,$t){fi(ht,Te.current,et,mr,hi,function(){we(),it()})})):new Promise(function(it,$t){switch(Te.current){case Ht.Horizontal:ht.scrollLeft=et.left;break;case Ht.Both:ht.scrollLeft=et.left,ht.scrollTop=et.top;break;case Ht.Vertical:default:ht.scrollTop=et.top;break}it()})},[u]);return{scrollOffset:z,scrollTo:ze}},hr=function(n,u,E){return Math.max(n,Math.min(E,u))},Lr=function(n){return n.reduce(function(u,E,k,P){return E>P[u]?k:u},0)},Or=function(n,u){switch(u){case r.ScrollMode.Horizontal:return{position:"relative",height:"100%",width:"".concat(n.width,"px")};case r.ScrollMode.Vertical:default:return{position:"relative",height:"".concat(n.height,"px"),width:"100%"}}},Pr=function(n,u,E){return E!==r.ScrollMode.Page?{}:{height:"".concat(u.height,"px"),width:"100%",position:"absolute",top:0,transform:"translateY(".concat(n.start.top,"px)")}},pi=function(n){var u=n.length;if(u===1)return!1;for(var E=1;E<u;E++)if(n[E].height!==n[0].height||n[E].width!==n[0].width)return!0;return!1},gi=function(n,u){if(u!==r.ViewMode.DualPageWithCover)return 0;if(!pi(n))return 2*n[0].width;var E=_n(n.slice(1),2).map(function(P){return P.length===2?P[0].width+P[1].width:P[0].width}),k=[n[0].width].concat(E);return Math.max.apply(Math,k)},mi=function(n,u,E,k,P){var F,D,z,x,J,le,de,pe=u?"right":"left",Te=u?-1:1,_e=E.length,Ie=n.start.left*Te,we=n.size,Ye=we.height,ze=we.width;if(k===r.ViewMode.DualPageWithCover){var je=P===r.ScrollMode.Page?0:n.start.top;return n.index===0||_e%2===0&&n.index===_e-1?(F={height:"".concat(Ye,"px"),minWidth:"".concat(gi(E,k),"px"),width:"100%"},F[pe]=0,F.position="absolute",F.top=0,F.transform="translate(".concat(Ie,"px, ").concat(je,"px)"),F):(D={height:"".concat(Ye,"px"),width:"".concat(ze,"px")},D[pe]=0,D.position="absolute",D.top=0,D.transform="translate(".concat(Ie,"px, ").concat(je,"px)"),D)}if(k===r.ViewMode.DualPage)return z={height:"".concat(Ye,"px"),width:"".concat(ze,"px")},z[pe]=0,z.position="absolute",z.top=0,z.transform="translate(".concat(Ie,"px, ").concat(P===r.ScrollMode.Page?0:n.start.top,"px)"),z;switch(P){case r.ScrollMode.Horizontal:return x={height:"100%",width:"".concat(ze,"px")},x[pe]=0,x.position="absolute",x.top=0,x.transform="translateX(".concat(Ie,"px)"),x;case r.ScrollMode.Page:return J={height:"".concat(Ye,"px"),width:"".concat(ze,"px")},J[pe]=0,J.position="absolute",J.top=0,J;case r.ScrollMode.Wrapped:return le={height:"".concat(Ye,"px"),width:"".concat(ze,"px")},le[pe]=0,le.position="absolute",le.top=0,le.transform="translate(".concat(Ie,"px, ").concat(n.start.top,"px)"),le;case r.ScrollMode.Vertical:default:return de={height:"".concat(Ye,"px"),width:"100%"},de[pe]=0,de.position="absolute",de.top=0,de.transform="translateY(".concat(n.start.top,"px)"),de}},h=function(n,u,E,k){for(;n<=u;){var P=(n+u)/2|0,F=k(P);if(F<E)n=P+1;else if(F>E)u=P-1;else return P}return n>0?n-1:0},w=function(n,u,E,k){var P=0;switch(n){case Ht.Horizontal:P=k.left;break;case Ht.Vertical:default:P=k.top;break}var F=u.length-1,D=function(pe){switch(n){case Ht.Horizontal:return u[pe].start.left;case Ht.Both:case Ht.Vertical:default:return u[pe].start.top}},z=h(0,F,P,D);if(n===Ht.Both)for(var x=u[z].start.top;z-1>=0&&u[z-1].start.top===x&&u[z-1].start.left>=k.left;)z--;for(var J=z;J<=F;){var le={top:u[J].start.top-k.top,left:u[J].start.left-k.left},de={height:E.height-le.top,width:E.width-le.left};if(n===Ht.Horizontal&&de.width<0||n===Ht.Vertical&&de.height<0||n===Ht.Both&&(de.width<0||de.height<0))break;J++}return{start:z,end:J}},j={left:0,top:0},X=function(n,u,E,k){for(var P=[],F=0,D={left:0,top:0},z=0,x=j,J=0;J<n;J++){var le=E[J];if(J===0)F=le.width,D={left:0,top:0},z=le.height;else switch(k){case r.ScrollMode.Wrapped:F+=le.width,F<u.width?(x={left:P[J-1].end.left,top:D.top},z=Math.max(z,le.height)):(F=le.width,x={left:D.left,top:D.top+z},D={left:x.left,top:x.top},z=le.height);break;case r.ScrollMode.Horizontal:case r.ScrollMode.Vertical:default:x=P[J-1].end;break}var de={left:x.left+le.width,top:x.top+le.height};P[J]={index:J,start:x,size:le,end:de,visibility:-1}}return P},Q={left:0,top:0},ne=function(n,u,E,k){for(var P=[],F=0,D=0,z=Q,x=0;x<n;x++){var J={height:k===r.ScrollMode.Page?Math.max(u.height,E[x].height):E[x].height,width:Math.max(u.width/2,E[x].width)};k===r.ScrollMode.Page?z={left:x%2===0?0:J.width,top:Math.floor(x/2)*J.height}:x%2===0?(F=F+D,z={left:0,top:F},D=x===n-1?E[x].height:Math.max(E[x].height,E[x+1].height)):z={left:P[x-1].end.left,top:F};var le={left:z.left+J.width,top:z.top+J.height};P[x]={index:x,start:z,size:J,end:le,visibility:-1}}return P},ce={left:0,top:0},ae=function(n,u,E,k){for(var P=[],F=0,D=0,z=ce,x=0;x<n;x++){var J=x===0?{height:k===r.ScrollMode.Page?Math.max(u.height,E[x].height):E[x].height,width:k===r.ScrollMode.Page?Math.max(u.width,E[x].width):E[x].width}:{height:k===r.ScrollMode.Page?Math.max(u.height,E[x].height):E[x].height,width:Math.max(u.width/2,E[x].width)};k===r.ScrollMode.Page?z=x===0?ce:{left:x%2===0?J.width:0,top:Math.floor((x-1)/2)*J.height+P[0].end.top}:x===0?(z=ce,F=E[0].height,D=0):x%2===1?(F=F+D,z={left:0,top:F},D=x===n-1?E[x].height:Math.max(E[x].height,E[x+1].height)):z={left:P[x-1].end.left,top:F};var le={left:z.left+J.width,top:z.top+J.height};P[x]={index:x,start:z,size:J,end:le,visibility:-1}}return P},$={left:0,top:0},oe=function(n,u,E){for(var k=[],P=0;P<n;P++){var F={height:Math.max(u.height,E[P].height),width:Math.max(u.width,E[P].width)},D=P===0?$:k[P-1].end,z={left:D.left+F.width,top:D.top+F.height};k[P]={index:P,start:D,size:F,end:z,visibility:-1}}return k},se={height:0,width:0},Pe={left:0,top:0},Ae=1e-12,Se="data-virtual-index",Be=[0,.1,.2,.3,.4,.5,.6,.7,.8,.9,1],Le=function(n){var u=n.enableSmoothScroll,E=n.isRtl,k=n.numberOfItems,P=n.parentRef,F=n.setRenderRange,D=n.sizes,z=n.scrollMode,x=n.viewMode,J=e.useState(!1),le=J[0],de=J[1],pe=e.useCallback(function(_t){return de(_t)},[]),Te=e.useRef(z);Te.current=z;var _e=e.useRef(x);_e.current=x;var Ie=z===r.ScrollMode.Wrapped||x===r.ViewMode.DualPageWithCover||x===r.ViewMode.DualPage?Ht.Both:z===r.ScrollMode.Horizontal?Ht.Horizontal:Ht.Vertical,we=Ar({elementRef:P,enableSmoothScroll:u,isRtl:E,scrollDirection:Ie,onSmoothScroll:pe}),Ye=we.scrollOffset,ze=we.scrollTo,je=wr({elementRef:P}),Nt=e.useRef({scrollOffset:Pe,measurements:[]});Nt.current.scrollOffset=Ye;var ht=e.useMemo(function(){return Array(k).fill(-1)},[]),et=e.useState(ht),it=et[0],$t=et[1],fn=e.useMemo(function(){var _t=new IntersectionObserver(function(At){At.forEach(function(Vt){var Rt=Vt.isIntersecting?Vt.intersectionRatio:-1,yt=Vt.target,Wt=yt.getAttribute(Se);if(Wt){var zt=parseInt(Wt,10);0<=zt&&zt<k&&$t(function(be){return be[zt]=Rt,o([],be)})}})},{threshold:Be});return _t},[]),Zt=e.useMemo(function(){return z===r.ScrollMode.Page&&x===r.ViewMode.SinglePage?oe(k,je,D):x===r.ViewMode.DualPageWithCover?ae(k,je,D,z):x===r.ViewMode.DualPage?ne(k,je,D,z):X(k,je,D,z)},[z,D,x,je]),Cn=Zt[k-1]?{height:Zt[k-1].end.top,width:Zt[k-1].end.left}:se;Nt.current.measurements=Zt;var on=e.useMemo(function(){var _t=w(Ie,Zt,je,Ye),At=_t.start,Vt=_t.end,Rt=it.slice(hr(0,k,At),hr(0,k,Vt)),yt=At+Lr(Rt);yt=hr(0,k-1,yt);var Wt=yt,zt=F({endPage:Vt,numPages:k,startPage:At}),be=zt.startPage,Ze=zt.endPage;switch(be=Math.max(be,0),Ze=Math.min(Ze,k-1),x){case r.ViewMode.DualPageWithCover:yt>0&&(Wt=yt%2===1?yt:yt-1),be=be===0?0:be%2===1?be:be-1,Ze=Ze%2===1?Ze-1:Ze,k-Ze<=2&&(Ze=k-1);break;case r.ViewMode.DualPage:Wt=yt%2===0?yt:yt-1,be=be%2===0?be:be-1,Ze=Ze%2===1?Ze:Ze-1;break;case r.ViewMode.SinglePage:default:Wt=yt;break}return{startPage:be,endPage:Ze,maxVisbilityIndex:Wt}},[Zt,je,Ye,x,it]),Ln=on.startPage,Qt=on.endPage,Zn=on.maxVisbilityIndex,On=e.useMemo(function(){for(var _t=[],At=function(Rt){var yt=Zt[Rt],Wt=U(U({},yt),{visibility:it[Rt]!==void 0?it[Rt]:-1,measureRef:function(zt){zt&&(zt.setAttribute(Se,"".concat(Rt)),fn.observe(zt))}});_t.push(Wt)},Vt=Ln;Vt<=Qt;Vt++)At(Vt);return _t},[Ln,Qt,it,Zt]),wn=e.useCallback(function(_t,At){var Vt=Nt.current.measurements,Rt=hr(0,k-1,_t),yt=Vt[Rt],Wt=Te.current===r.ScrollMode.Page?Pe:At;return yt?ze({left:Wt.left+yt.start.left,top:Wt.top+yt.start.top},u):Promise.resolve()},[ze,u]),En=e.useCallback(function(_t,At){var Vt=Nt.current.measurements,Rt=Vt[_t].start,yt=Vt.find(function(zt){return zt.start.top-Rt.top>Ae});if(!yt)return Promise.resolve();var Wt=yt.index;switch(_e.current){case r.ViewMode.DualPage:Wt=Wt%2===0?Wt:Wt+1;break;case r.ViewMode.DualPageWithCover:Wt=Wt%2===1?Wt:Wt+1;break}return wn(Wt,At)},[]),pn=e.useCallback(function(_t,At){for(var Vt=Nt.current.measurements,Rt=Vt[_t].start,yt=_t,Wt=!1,zt=k-1;zt>=0;zt--)if(Rt.top-Vt[zt].start.top>Ae){Wt=!0,yt=Vt[zt].index;break}if(!Wt)return Promise.resolve();switch(_e.current){case r.ViewMode.DualPage:yt=yt%2===0?yt:yt-1;break;case r.ViewMode.DualPageWithCover:yt=yt%2===0?yt-1:yt;break}return yt===_t&&(yt=_t-1),wn(yt,At)},[]),Mn=e.useCallback(function(_t,At){if(_e.current===r.ViewMode.DualPageWithCover||_e.current===r.ViewMode.DualPage)return En(_t,At);switch(Te.current){case r.ScrollMode.Wrapped:return En(_t,At);case r.ScrollMode.Horizontal:case r.ScrollMode.Vertical:default:return wn(_t+1,At)}},[]),xn=e.useCallback(function(_t,At){if(_e.current===r.ViewMode.DualPageWithCover||_e.current===r.ViewMode.DualPage)return pn(_t,At);switch(Te.current){case r.ScrollMode.Wrapped:return pn(_t,At);case r.ScrollMode.Horizontal:case r.ScrollMode.Vertical:default:return wn(_t-1,At)}},[]),Yn=e.useCallback(function(){return Or(Cn,Te.current)},[Cn]),er=e.useCallback(function(_t){return Pr(_t,je,Te.current)},[je]),qn=e.useCallback(function(_t){return mi(_t,E,D,_e.current,Te.current)},[E,D]),Gn=e.useCallback(function(_t,At){var Vt=Nt.current,Rt=Vt.measurements,yt=Vt.scrollOffset,Wt=hr(0,k-1,At),zt=Rt[Wt];if(zt){var be=Te.current===r.ScrollMode.Page?{left:zt.start.left,top:zt.start.top}:{left:yt.left*_t,top:yt.top*_t};return ze(be,!1)}return Promise.resolve()},[]);return e.useEffect(function(){return function(){fn.disconnect()}},[]),{boundingClientRect:je,isSmoothScrolling:le,startPage:Ln,endPage:Qt,maxVisbilityIndex:Zn,virtualItems:On,getContainerStyles:Yn,getItemContainerStyles:er,getItemStyles:qn,scrollToItem:wn,scrollToNextItem:Mn,scrollToPreviousItem:xn,zoom:Gn}},Me=17,mt=8,Qe=function(n,u,E,k,P,F){var D=E;switch(!0){case(P===r.ViewMode.DualPageWithCover&&F>=3):case(P===r.ViewMode.DualPage&&F>=3):D=2*E;break;default:D=E;break}switch(k){case r.SpecialZoomLevel.ActualSize:return 1;case r.SpecialZoomLevel.PageFit:return Math.min((n.clientWidth-Me)/D,(n.clientHeight-2*mt)/u);case r.SpecialZoomLevel.PageWidth:return(n.clientWidth-Me)/D}},nt=function(n){var u=e.useRef([]),E=function(F){return u.current.map(function(D){return F(D)})},k=function(){var F=u.current,D=F.length;if(D===0)return null;var z=F.pop();return u.current=F,z},P=function(F){var D=u.current;D.length+1>n&&D.shift(),D.push(F),u.current=D};return e.useEffect(function(){return function(){u.current=[]}},[]),{push:P,map:E,pop:k}},ot=function(n){var u=e.useRef([]),E=function(){var F=u.current,D=F.length;if(D===0)return null;var z=F.shift();return u.current=F,z||null},k=function(F){var D=u.current;D.length+1>n&&D.pop(),u.current=[F].concat(D)},P=function(F){return u.current.map(function(D){return F(D)})};return e.useEffect(function(){return function(){u.current=[]}},[]),{dequeue:E,enqueue:k,map:P}},Ge=50,ct=function(n){var u=n.getCurrentPage,E=nt(Ge),k=ot(Ge),P=function(){var z=k.dequeue();return z&&E.push(z),z&&z.pageIndex===u()?P():z},F=function(){var z=E.pop();return z&&k.enqueue(z),z&&z.pageIndex===u()?F():z},D=e.useCallback(function(z){E.push(z)},[]);return{getNextDestination:P,getPreviousDestination:F,markVisitedDestination:D}},st=function(n){var u=[];return n.items&&n.items.length>0&&(u=u.concat(Mt(n.items))),u},Mt=function(n){var u=[];return n.map(function(E){u=u.concat(E).concat(st(E))}),u},Ct=function(n){var u=L(),E=e.useState([]),k=E[0],P=E[1];return e.useEffect(function(){n.getOutline().then(function(F){if(u.current&&F!==null){var D=Mt(F);P(D)}})},[]),k},xt={capture:!1,passive:!0},Ot={height:0,width:0},It=function(){var n=e.useState(Ot),u=n[0],E=n[1],k=K(function(){E({height:window.innerHeight,width:window.innerWidth})},100);return d(function(){return window.addEventListener("resize",k,xt),function(){window.removeEventListener("resize",k,xt)}},[]),u},Yt={height:0,width:0},qt=function(n){var u=n.getCurrentPage,E=n.getCurrentScrollMode,k=n.jumpToPage,P=n.targetRef,F=e.useState(r.FullScreenMode.Normal),D=F[0],z=F[1],x=It(),J=e.useState(Yt),le=J[0],de=J[1],pe=e.useRef(Yt),Te=e.useRef(u()),_e=e.useRef(Yt),Ie=e.useState(P.current),we=Ie[0],Ye=Ie[1],ze=e.useRef();d(function(){P.current!==we&&Ye(P.current)},[]),d(function(){if(we){var it=new ResizeObserver(function($t){$t.forEach(function(fn){var Zt=fn.target.getBoundingClientRect(),Cn=Zt.height,on=Zt.width;de({height:Cn,width:on})})});return it.observe(we),function(){it.unobserve(we),it.disconnect()}}},[we]);var je=e.useCallback(function(it){var $t=V();return $t&&$t!==it?(z(r.FullScreenMode.Normal),C($t)):Promise.resolve()},[]),Nt=e.useCallback(function(it){!it||!A()||(Ye(it),je(it).then(function(){ze.current=it,z(r.FullScreenMode.Entering),W(it)}))},[]),ht=e.useCallback(function(){var it=V();it&&(z(r.FullScreenMode.Exitting),C(document))},[]),et=e.useCallback(function(){if(we){var it=V();it!==we&&z(r.FullScreenMode.Exitting)}},[we]);return e.useEffect(function(){switch(D){case r.FullScreenMode.Entering:ze.current&&(ze.current.style.backgroundColor="var(--rpv-core__full-screen-target-background-color)"),Te.current=u(),pe.current={height:window.innerHeight,width:window.innerWidth};break;case r.FullScreenMode.Entered:E()===r.ScrollMode.Page?k(Te.current).then(function(){z(r.FullScreenMode.EnteredCompletely)}):z(r.FullScreenMode.EnteredCompletely);break;case r.FullScreenMode.Exitting:ze.current&&(ze.current.style.backgroundColor="",ze.current=null),Te.current=u();break;case r.FullScreenMode.Exited:z(r.FullScreenMode.Normal),E()===r.ScrollMode.Page&&k(Te.current);break}},[D]),e.useEffect(function(){if(D!==r.FullScreenMode.Normal){if(D===r.FullScreenMode.Entering&&x.height===le.height&&x.width===le.width&&x.height>0&&x.width>0&&(_e.current.height===0||x.height==_e.current.height)){_e.current={height:window.innerHeight,width:window.innerWidth},z(r.FullScreenMode.Entered);return}D===r.FullScreenMode.Exitting&&pe.current.height===x.height&&pe.current.width===x.width&&x.height>0&&x.width>0&&z(r.FullScreenMode.Exited)}},[D,x,le]),e.useEffect(function(){return m(et),function(){v(et)}},[we]),{enterFullScreenMode:Nt,exitFullScreenMode:ht,fullScreenMode:D}},cn={buildPageStyles:function(){return{}},transformSize:function(n){var u=n.size;return u}},Ut={left:0,top:0},nn=function(n){var u=n.currentFile,E=n.defaultScale,k=n.doc,P=n.enableSmoothScroll,F=n.initialPage,D=n.initialRotation,z=n.initialScale,x=n.pageLayout,J=n.pageSizes,le=n.plugins,de=n.renderPage,pe=n.scrollMode,Te=n.setRenderRange,_e=n.viewMode,Ie=n.viewerState,we=n.onDocumentLoad,Ye=n.onOpenFile,ze=n.onPageChange,je=n.onRotate,Nt=n.onRotatePage,ht=n.onZoom,et=k.numPages,it=k.loadingTask.docId,$t=e.useContext(me).l10n,fn=e.useContext(t),Zt=fn.direction===r.TextDirection.RightToLeft,Cn=e.useRef(),on=e.useRef(),Ln=e.useState(F),Qt=Ln[0],Zn=Ln[1],On=e.useRef(null),wn=ct({getCurrentPage:function(){return Pt.current.pageIndex}}),En=e.useState(D),pn=En[0],Mn=En[1],xn=l(pn),Yn=e.useState(!1),er=Yn[0],qn=Yn[1],Gn=e.useState(new Map),_t=Gn[0],At=Gn[1],Vt=e.useState(pe),Rt=Vt[0],yt=Vt[1],Wt=l(Rt),zt=e.useState(_e),be=zt[0],Ze=zt[1],Et=l(be),Lt=Ct(k),Tt=e.useState(z),ft=Tt[0],rn=Tt[1],Dn=l(ft),Pt=e.useRef(Ie),In=e.useRef(typeof E=="string"?E:null),Rn=e.useRef(-1),Tn=e.useRef(-1),Nn=e.useRef(F),un=qt({getCurrentPage:function(){return Pt.current.pageIndex},getCurrentScrollMode:function(){return Pt.current.scrollMode},jumpToPage:function(Fe){return sr(Fe)},targetRef:on}),tr=e.useState(-1),Li=tr[0],Si=tr[1],wi=e.useState(0),Ei=wi[0],Oi=wi[1],Wn=O({doc:k});e.useEffect(function(){return function(){Jn()}},[it]);var Ai=e.useMemo(function(){return Object.assign({},cn,x)},[]),Di=e.useMemo(function(){return Array(et).fill(0).map(function(Fe,St){var Bt=[J[St].pageHeight,J[St].pageWidth],en=Math.abs(pn)%180===0?{height:Bt[0],width:Bt[1]}:{height:Bt[1],width:Bt[0]},dn={height:en.height*ft,width:en.width*ft};return Ai.transformSize({numPages:et,pageIndex:St,size:dn})})},[pn,ft]),Gt=Le({enableSmoothScroll:P,isRtl:Zt,numberOfItems:et,parentRef:on,scrollMode:Rt,setRenderRange:Te,sizes:Di,viewMode:be}),Ii=K(function(){!In.current||Pt.current.fullScreenMode!==r.FullScreenMode.Normal||F>0&&Nn.current===F||fr(In.current)},200);Un({targetRef:on,onResize:Ii});var ar=function(Fe){var St=Fe;le.forEach(function(Bt){Bt.onViewerStateChange&&(St=Bt.onViewerStateChange(St))}),Pt.current=St},Ni=function(){return on.current},Bi=function(){return Pt.current},Hi=e.useCallback(function(Fe){wn.markVisitedDestination(Fe)},[]),vi=e.useCallback(function(Fe){var St=Fe.pageIndex,Bt=Fe.bottomOffset,en=Fe.leftOffset,dn=Fe.scaleTo,jt=on.current,kn=Pt.current;return!jt||!kn?Promise.resolve():new Promise(function(Qn,yi){Bn(k,St).then(function(Dr){var or=Dr.getViewport({scale:1}),Ir=0,Fi=(typeof Bt=="function"?Bt(or.width,or.height):Bt)||0,vr=(typeof en=="function"?en(or.width,or.height):en)||0,br=kn.scale;switch(dn){case r.SpecialZoomLevel.PageFit:Ir=0,vr=0,fr(r.SpecialZoomLevel.PageFit);break;case r.SpecialZoomLevel.PageWidth:br=Qe(jt,J[St].pageHeight,J[St].pageWidth,r.SpecialZoomLevel.PageWidth,_e,et),Ir=(or.height-Fi)*br,vr=vr*br,fr(br);break;default:Ir=(or.height-Fi)*br,vr=vr*br;break}switch(kn.scrollMode){case r.ScrollMode.Horizontal:Gt.scrollToItem(St,{left:vr,top:0}).then(function(){Qn()});break;case r.ScrollMode.Vertical:default:Gt.scrollToItem(St,{left:0,top:Ir}).then(function(){Qn()});break}})})},[]),Pi=e.useCallback(function(Fe){return wn.markVisitedDestination(Fe),vi(Fe)},[]),Vi=e.useCallback(function(){var Fe=wn.getNextDestination();return Fe?vi(Fe):Promise.resolve()},[]),Wi=e.useCallback(function(){var Fe=wn.getPreviousDestination();return Fe?vi(Fe):Promise.resolve()},[]),ji=e.useCallback(function(){return Gt.scrollToNextItem(Pt.current.pageIndex,Ut)},[]),sr=e.useCallback(function(Fe){return 0<=Fe&&Fe<et?Gt.scrollToItem(Fe,Ut):Promise.resolve()},[]),Ui=e.useCallback(function(){return Gt.scrollToPreviousItem(Pt.current.pageIndex,Ut)},[]),Ci=e.useCallback(function(Fe){xr(Fe.name).toLowerCase()==="pdf"&&new Promise(function(St){var Bt=new FileReader;Bt.readAsArrayBuffer(Fe),Bt.onload=function(){var en=new Uint8Array(Bt.result);St(en)}}).then(function(St){Ye(Fe.name,St)})},[Ye]),Ri=e.useCallback(function(Fe){var St=Fe===r.RotateDirection.Backward?-90:90,Bt=Pt.current.rotation,en=Bt===360||Bt===-360?St:Bt+St;Wn.markNotRendered(),Mn(en),ar(U(U({},Pt.current),{rotation:en})),je({direction:Fe,doc:k,rotation:en})},[]),bi=e.useCallback(function(Fe,St){var Bt=St===r.RotateDirection.Backward?-90:90,en=Pt.current.pagesRotation,dn=en.has(Fe)?en.get(Fe):D,jt=dn+Bt,kn=en.set(Fe,jt);At(kn),qn(function(Qn){return!Qn}),ar(U(U({},Pt.current),{pagesRotation:kn,rotatedPage:Fe})),Nt({direction:St,doc:k,pageIndex:Fe,rotation:jt}),Wn.markRendering(Fe),Si(Fe)},[]),Ti=e.useCallback(function(Fe){ar(U(U({},Pt.current),{scrollMode:Fe})),yt(Fe)},[]),ki=e.useCallback(function(Fe){ar(U(U({},Pt.current),{viewMode:Fe})),Ze(Fe)},[]),fr=e.useCallback(function(Fe){var St=on.current,Bt=Pt.current.pageIndex;if(!(Bt<0||Bt>=et)){var en=J[Bt].pageHeight,dn=J[Bt].pageWidth,jt=St?typeof Fe=="string"?Qe(St,en,dn,Fe,Pt.current.viewMode,et):Fe:1;In.current=typeof Fe=="string"?Fe:null,jt!==Pt.current.scale&&(Oi(function(kn){return kn+1}),Wn.markNotRendered(),rn(jt),ht({doc:k,scale:jt}),ar(U(U({},Pt.current),{scale:jt})))}},[]),zi=e.useCallback(function(Fe){un.enterFullScreenMode(Fe)},[]),qi=e.useCallback(function(){un.exitFullScreenMode()},[]);e.useEffect(function(){ar(U(U({},Pt.current),{fullScreenMode:un.fullScreenMode}))},[un.fullScreenMode]),e.useEffect(function(){var Fe={enterFullScreenMode:zi,exitFullScreenMode:qi,getPagesContainer:Ni,getViewerState:Bi,jumpToDestination:Pi,jumpToNextDestination:Vi,jumpToPreviousDestination:Wi,jumpToNextPage:ji,jumpToPreviousPage:Ui,jumpToPage:sr,openFile:Ci,rotate:Ri,rotatePage:bi,setViewerState:ar,switchScrollMode:Ti,switchViewMode:ki,zoom:fr};return le.forEach(function(St){St.install&&St.install(Fe)}),function(){le.forEach(function(St){St.uninstall&&St.uninstall(Fe)})}},[it]),e.useEffect(function(){we({doc:k,file:u}),le.forEach(function(Fe){Fe.onDocumentLoad&&Fe.onDocumentLoad({doc:k,file:u})})},[it]);var Mi=Gt.boundingClientRect;yn(function(){F&&sr(F)},Mi.height>0&&Mi.width>0),d(function(){var Fe=Pt.current.pageIndex;Fe>-1&&Wt!==Rt&&Gt.scrollToItem(Fe,Ut).then(function(){un.fullScreenMode===r.FullScreenMode.EnteredCompletely&&(P||Wn.markNotRendered(),Rn.current=-1)})},[Rt]),d(function(){var Fe=Pt.current.pageIndex;Fe>-1&&xn!==pn&&Gt.scrollToItem(Fe,Ut)},[pn]),d(function(){Dn!=0&&Dn!=Pt.current.scale&&Gt.zoom(Pt.current.scale/Dn,Pt.current.pageIndex).then(function(){un.fullScreenMode===r.FullScreenMode.EnteredCompletely&&(Tn.current=-1)})},[ft]),d(function(){if(Et!==Pt.current.viewMode){var Fe=Gt.startPage,St=Gt.endPage,Bt=Gt.virtualItems;Wn.markNotRendered(),Wn.setRange(Fe,St);for(var en=function(jt){var kn=Bt.find(function(Qn){return Qn.index===jt});kn&&Wn.setVisibility(jt,kn.visibility)},dn=Fe;dn<=St;dn++)en(dn);_i()}},[be]),d(function(){var Fe=Pt.current.pageIndex;Fe>-1&&Et!==be&&Gt.scrollToItem(Fe,Ut)},[be]),d(function(){var Fe=Pt.current.pageIndex;Fe>0&&Fe===F&&Nn.current===F&&In.current&&(Nn.current=-1,fr(In.current))},[Qt]),e.useEffect(function(){var Fe=Gt.isSmoothScrolling;Fe||(On.current===null||On.current!==Qt)&&(On.current=Qt,ze({currentPage:Qt,doc:k}))},[Qt,Gt.isSmoothScrolling]),e.useEffect(function(){un.fullScreenMode===r.FullScreenMode.Entering&&Pt.current.scrollMode===r.ScrollMode.Page&&(Rn.current=Pt.current.pageIndex),un.fullScreenMode===r.FullScreenMode.EnteredCompletely&&Pt.current.scrollMode===r.ScrollMode.Page&&P&&(Rn.current=-1),un.fullScreenMode===r.FullScreenMode.EnteredCompletely&&In.current&&(Tn.current=Pt.current.pageIndex,fr(In.current))},[un.fullScreenMode]),e.useEffect(function(){if(!(un.fullScreenMode===r.FullScreenMode.Entering||un.fullScreenMode===r.FullScreenMode.Exitting||Gt.isSmoothScrolling)){var Fe=Gt.startPage,St=Gt.endPage,Bt=Gt.maxVisbilityIndex,en=Gt.virtualItems,dn=Bt,jt=un.fullScreenMode===r.FullScreenMode.Entered||un.fullScreenMode===r.FullScreenMode.EnteredCompletely;if(!(jt&&dn!==Rn.current&&Rn.current>-1)&&!(jt&&dn!==Tn.current&&Tn.current>-1)){Zn(dn),ar(U(U({},Pt.current),{pageIndex:dn})),Wn.setRange(Fe,St);for(var kn=function(yi){var Dr=en.find(function(or){return or.index===yi});Dr&&Wn.setVisibility(yi,Dr.visibility)},Qn=Fe;Qn<=St;Qn++)kn(Qn);_i()}}},[Gt.startPage,Gt.endPage,Gt.isSmoothScrolling,Gt.maxVisbilityIndex,un.fullScreenMode,er,pn,ft]);var Gi=e.useCallback(function(Fe){Wn.markRendered(Fe),_i()},[Ei]),_i=function(){var Fe=Wn.getHighestPriorityPage();Fe>-1&&Wn.isInRange(Fe)&&(Wn.markRendering(Fe),Si(Fe))},Xi=function(Fe){var St=Qt-1,Bt=Qt+1;switch(Fe){case"FirstPage":sr(0);break;case"LastPage":sr(et-1);break;case"NextPage":Bt<et&&sr(Bt);break;case"PrevPage":St>=0&&sr(St);break}},$i=e.useCallback(function(){var Fe=Gt.virtualItems,St=[];switch(be){case r.ViewMode.DualPage:St=_n(Fe,2);break;case r.ViewMode.DualPageWithCover:Fe.length&&(St=Fe[0].index===0?[[Fe[0]]].concat(_n(Fe.slice(1),2)):_n(Fe,2));break;case r.ViewMode.SinglePage:default:St=_n(Fe,1);break}var Bt=$t&&$t.core?$t.core.pageLabel:"Page {{pageIndex}}",en={attrs:{className:"rpv-core__inner-container","data-testid":"core__inner-container",ref:Cn,style:{height:"100%"}},children:e.createElement(e.Fragment,null),subSlot:{attrs:{"data-testid":"core__inner-pages",className:a({"rpv-core__inner-pages":!0,"rpv-core__inner-pages--horizontal":Rt===r.ScrollMode.Horizontal,"rpv-core__inner-pages--rtl":Zt,"rpv-core__inner-pages--single":Rt===r.ScrollMode.Page,"rpv-core__inner-pages--vertical":Rt===r.ScrollMode.Vertical,"rpv-core__inner-pages--wrapped":Rt===r.ScrollMode.Wrapped}),ref:on,style:{height:"100%",position:"relative"}},children:e.createElement("div",{"data-testid":"core__inner-current-page-".concat(Qt),style:Object.assign({"--scale-factor":ft},Gt.getContainerStyles())},St.map(function(dn){return e.createElement("div",{className:a({"rpv-core__inner-page-container":!0,"rpv-core__inner-page-container--single":Rt===r.ScrollMode.Page}),style:Gt.getItemContainerStyles(dn[0]),key:"".concat(dn[0].index,"-").concat(be)},dn.map(function(jt){var kn=be===r.ViewMode.DualPageWithCover&&(jt.index===0||et%2===0&&jt.index===et-1);return e.createElement("div",{"aria-label":Bt.replace("{{pageIndex}}","".concat(jt.index+1)),className:a({"rpv-core__inner-page":!0,"rpv-core__inner-page--dual-even":be===r.ViewMode.DualPage&&jt.index%2===0,"rpv-core__inner-page--dual-odd":be===r.ViewMode.DualPage&&jt.index%2===1,"rpv-core__inner-page--dual-cover":kn,"rpv-core__inner-page--dual-cover-even":be===r.ViewMode.DualPageWithCover&&!kn&&jt.index%2===0,"rpv-core__inner-page--dual-cover-odd":be===r.ViewMode.DualPageWithCover&&!kn&&jt.index%2===1,"rpv-core__inner-page--single":be===r.ViewMode.SinglePage&&Rt===r.ScrollMode.Page}),role:"region",key:"".concat(jt.index,"-").concat(be),style:Object.assign({},Gt.getItemStyles(jt),Ai.buildPageStyles({numPages:et,pageIndex:jt.index,scrollMode:Rt,viewMode:be}))},e.createElement(Mr,{doc:k,measureRef:jt.measureRef,outlines:Lt,pageIndex:jt.index,pageRotation:_t.has(jt.index)?_t.get(jt.index):0,pageSize:J[jt.index],plugins:le,renderPage:de,renderQueueKey:Ei,rotation:pn,scale:ft,shouldRender:Li===jt.index,viewMode:be,onExecuteNamedAction:Xi,onJumpFromLinkAnnotation:Hi,onJumpToDest:Pi,onRenderCompleted:Gi,onRotatePage:bi}))}))}))}};return le.forEach(function(dn){dn.renderViewer&&(en=dn.renderViewer({containerRef:Cn,doc:k,pagesContainerRef:on,pagesRotation:_t,pageSizes:J,rotation:pn,slot:en,themeContext:fn,jumpToPage:sr,openFile:Ci,rotate:Ri,rotatePage:bi,switchScrollMode:Ti,switchViewMode:ki,zoom:fr}))}),en},[le,Gt]),xi=e.useCallback(function(Fe){return e.createElement("div",U({},Fe.attrs,{style:Fe.attrs&&Fe.attrs.style?Fe.attrs.style:{}}),Fe.children,Fe.subSlot&&xi(Fe.subSlot))},[]);return xi($i())},Kt=[.1,.2,.3,.4,.5,.6,.7,.8,.9,1,1.1,1.3,1.5,1.7,1.9,2.1,2.4,2.7,3,3.3,3.7,4.1,4.6,5.1,5.7,6.3,7,7.7,8.5,9.4,10],Jt=function(n){var u=Kt.findIndex(function(E){return E>=n});return u===-1||u===0?n:Kt[u-1]},bn=45,zn=45,Vn=function(n){var u=n.defaultScale,E=n.doc,k=n.render,P=n.scrollMode,F=n.viewMode,D=e.useRef(),z=e.useState({pageSizes:[],scale:0}),x=z[0],J=z[1];return e.useLayoutEffect(function(){var le=Array(E.numPages).fill(0).map(function(de,pe){return new Promise(function(Te,_e){Bn(E,pe).then(function(Ie){var we=Ie.getViewport({scale:1});Te({pageHeight:we.height,pageWidth:we.width,rotation:we.rotation})})})});Promise.all(le).then(function(de){var pe=D.current;if(!(!pe||de.length===0)){var Te=de[0].pageWidth,_e=de[0].pageHeight,Ie=pe.parentElement,we=(Ie.clientWidth-zn)/Te,Ye=(Ie.clientHeight-bn)/_e,ze=we;switch(P){case r.ScrollMode.Horizontal:ze=Math.min(we,Ye);break;case r.ScrollMode.Vertical:default:ze=we;break}var je=u?typeof u=="string"?Qe(Ie,_e,Te,u,F,E.numPages):u:Jt(ze);J({pageSizes:de,scale:je})}})},[E.loadingTask.docId]),x.pageSizes.length===0||x.scale===0?e.createElement("div",{className:"rpv-core__page-size-calculator","data-testid":"core__page-size-calculating",ref:D},e.createElement(Y,null)):k(x.pageSizes,x.scale)},sn=(function(){function n(){}return n})(),Sn=(function(n){ee(u,n);function u(E,k){var P=n.call(this)||this;return P.verifyPassword=E,P.passwordStatus=k,P}return u})(sn),$n=function(n){var u=n.passwordStatus,E=n.renderProtectedView,k=n.verifyPassword,P=n.onDocumentAskPassword,F=e.useContext(me).l10n,D=e.useState(""),z=D[0],x=D[1],J=e.useContext(t).direction,le=J===r.TextDirection.RightToLeft,de=function(){return k(z)},pe=function(Te){Te.key==="Enter"&&de()};return e.useEffect(function(){P&&P({verifyPassword:k})},[]),E?E({passwordStatus:u,verifyPassword:k}):e.createElement("div",{className:"rpv-core__asking-password-wrapper"},e.createElement("div",{className:a({"rpv-core__asking-password":!0,"rpv-core__asking-password--rtl":le})},e.createElement("div",{className:"rpv-core__asking-password-message"},u===r.PasswordStatus.RequiredPassword&&F.core.askingPassword.requirePasswordToOpen,u===r.PasswordStatus.WrongPassword&&F.core.wrongPassword.tryAgain),e.createElement("div",{className:"rpv-core__asking-password-body"},e.createElement("div",{className:a({"rpv-core__asking-password-input":!0,"rpv-core__asking-password-input--ltr":!le,"rpv-core__asking-password-input--rtl":le})},e.createElement(ge,{testId:"core__asking-password-input",type:"password",value:z,onChange:x,onKeyDown:pe})),e.createElement(M,{onClick:de},F.core.askingPassword.submit))))},at=(function(n){ee(u,n);function u(E){var k=n.call(this)||this;return k.doc=E,k}return u})(sn),rt=(function(n){ee(u,n);function u(E){var k=n.call(this)||this;return k.error=E,k}return u})(sn),Xe=(function(n){ee(u,n);function u(E){var k=n.call(this)||this;return k.percentages=E,k}return u})(sn),Je=function(n){var u=n.characterMap,E=n.file,k=n.httpHeaders,P=n.render,F=n.renderError,D=n.renderLoader,z=n.renderProtectedView,x=n.transformGetDocumentParams,J=n.withCredentials,le=n.onDocumentAskPassword,de=e.useContext(t).direction,pe=de===r.TextDirection.RightToLeft,Te=e.useState(new Xe(0)),_e=Te[0],Ie=Te[1],we=e.useRef(""),Ye=L();return e.useEffect(function(){we.current="",Ie(new Xe(0));var ze=new s.PDFWorker({name:"PDFWorker_".concat(Date.now())}),je=Object.assign({httpHeaders:k,withCredentials:J,worker:ze},typeof E=="string"?{url:E}:{data:E},u?{cMapUrl:u.url,cMapPacked:u.isCompressed}:{}),Nt=x?x(je):je,ht=s.getDocument(Nt);return ht.onPassword=function(et,it){switch(it){case s.PasswordResponses.NEED_PASSWORD:Ye.current&&Ie(new Sn(et,r.PasswordStatus.RequiredPassword));break;case s.PasswordResponses.INCORRECT_PASSWORD:Ye.current&&Ie(new Sn(et,r.PasswordStatus.WrongPassword));break}},ht.onProgress=function(et){var it=et.total>0?Math.min(100,100*et.loaded/et.total):100;Ye.current&&we.current===""&&Ie(new Xe(it))},ht.promise.then(function(et){we.current=et.loadingTask.docId,Ye.current&&Ie(new at(et))},function(et){return Ye.current&&!ze.destroyed&&Ie(new rt({message:et.message||"Cannot load document",name:et.name}))}),function(){ht.destroy(),ze.destroy()}},[E]),_e instanceof Sn?e.createElement($n,{passwordStatus:_e.passwordStatus,renderProtectedView:z,verifyPassword:_e.verifyPassword,onDocumentAskPassword:le}):_e instanceof at?P(_e.doc):_e instanceof rt?F?F(_e.error):e.createElement("div",{className:a({"rpv-core__doc-error":!0,"rpv-core__doc-error--rtl":pe})},e.createElement("div",{className:"rpv-core__doc-error-text"},_e.error.message)):e.createElement("div",{"data-testid":"core__doc-loading",className:a({"rpv-core__doc-loading":!0,"rpv-core__doc-loading--rtl":pe})},D?D(_e.percentages):e.createElement(Y,null))},$e=function(){return typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches},ut=function(n,u){var E=e.useMemo(function(){return n==="auto"?$e()?"dark":"light":n},[]),k=e.useState(E),P=k[0],F=k[1],D=l(P);return e.useEffect(function(){if(n==="auto"){var z=window.matchMedia("(prefers-color-scheme: dark)"),x=function(J){F(J.matches?"dark":"light")};return z.addEventListener("change",x),function(){return z.removeEventListener("change",x)}}},[]),e.useEffect(function(){P!==D&&u&&u(P)},[P]),e.useEffect(function(){n!==P&&F(n)},[n]),{currentTheme:P,setCurrentTheme:F}},dt=function(n,u){var E=typeof n,k=typeof u;return E==="string"&&k==="string"&&n===u?!0:E==="object"&&k==="object"?n.length===u.length&&n.every(function(P,F){return P===u[F]}):!1},Ke=3,Ue=function(n){return{startPage:n.startPage-Ke,endPage:n.endPage+Ke}},gt=function(n){var u=n.characterMap,E=n.defaultScale,k=n.enableSmoothScroll,P=k===void 0?!0:k,F=n.fileUrl,D=n.httpHeaders,z=D===void 0?{}:D,x=n.initialPage,J=x===void 0?0:x,le=n.pageLayout,de=n.initialRotation,pe=de===void 0?0:de,Te=n.localization,_e=n.plugins,Ie=_e===void 0?[]:_e,we=n.renderError,Ye=n.renderLoader,ze=n.renderPage,je=n.renderProtectedView,Nt=n.scrollMode,ht=Nt===void 0?r.ScrollMode.Vertical:Nt,et=n.setRenderRange,it=et===void 0?Ue:et,$t=n.transformGetDocumentParams,fn=n.theme,Zt=fn===void 0?{direction:r.TextDirection.LeftToRight,theme:"light"}:fn,Cn=n.viewMode,on=Cn===void 0?r.ViewMode.SinglePage:Cn,Ln=n.withCredentials,Qt=Ln===void 0?!1:Ln,Zn=n.onDocumentAskPassword,On=n.onDocumentLoad,wn=On===void 0?function(){}:On,En=n.onPageChange,pn=En===void 0?function(){}:En,Mn=n.onRotate,xn=Mn===void 0?function(){}:Mn,Yn=n.onRotatePage,er=Yn===void 0?function(){}:Yn,qn=n.onSwitchTheme,Gn=qn===void 0?function(){}:qn,_t=n.onZoom,At=_t===void 0?function(){}:_t,Vt=e.useState({data:F,name:typeof F=="string"?F:"",shouldLoad:!1}),Rt=Vt[0],yt=Vt[1],Wt=function(Tn,Nn){yt({data:Nn,name:Tn,shouldLoad:!0})},zt=e.useState(!1),be=zt[0],Ze=zt[1],Et=l(Rt);e.useEffect(function(){dt(Et.data,F)||yt({data:F,name:typeof F=="string"?F:"",shouldLoad:be})},[F,be]);var Lt=function(Tn){Ze(Tn.isVisible),Tn.isVisible&&yt(function(Nn){return Object.assign({},Nn,{shouldLoad:!0})})},Tt=i({onVisibilityChanged:Lt}),ft=typeof Zt=="string"?{direction:r.TextDirection.LeftToRight,theme:Zt}:Zt,rn=e.useState(Te||re),Dn=rn[0],Pt=rn[1],In={l10n:Dn,setL10n:Pt},Rn=Object.assign({},{direction:ft.direction},ut(ft.theme||"light",Gn));return e.useEffect(function(){Te&&Pt(Te)},[Te]),e.createElement(me.Provider,{value:In},e.createElement(t.Provider,{value:Rn},e.createElement("div",{ref:Tt,className:"rpv-core__viewer rpv-core__viewer--".concat(Rn.currentTheme),"data-testid":"core__viewer",style:{height:"100%",width:"100%"}},Rt.shouldLoad&&e.createElement(Je,{characterMap:u,file:Rt.data,httpHeaders:z,render:function(Tn){return e.createElement(Vn,{defaultScale:E,doc:Tn,render:function(Nn,un){return e.createElement(nn,{currentFile:{data:Rt.data,name:Rt.name},defaultScale:E,doc:Tn,enableSmoothScroll:P,initialPage:J,initialRotation:pe,initialScale:un,pageLayout:le,pageSizes:Nn,plugins:Ie,renderPage:ze,scrollMode:ht,setRenderRange:it,viewMode:on,viewerState:{file:Rt,fullScreenMode:r.FullScreenMode.Normal,pageIndex:-1,pageHeight:Nn[0].pageHeight,pageWidth:Nn[0].pageWidth,pagesRotation:new Map,rotation:pe,scale:un,scrollMode:ht,viewMode:on},onDocumentLoad:wn,onOpenFile:Wt,onPageChange:pn,onRotate:xn,onRotatePage:er,onZoom:At})},scrollMode:ht,viewMode:on})},renderError:we,renderLoader:Ye,renderProtectedView:je,transformGetDocumentParams:$t,withCredentials:Qt,onDocumentAskPassword:Zn}))))},wt=function(n){var u=n.children,E=n.workerUrl;return s.GlobalWorkerOptions.workerSrc=E,e.createElement(e.Fragment,null,u)};r.Button=g,r.Icon=T,r.LazyRender=b,r.LocalizationContext=me,r.Menu=y,r.MenuDivider=f,r.MenuItem=I,r.MinimalButton=_,r.Modal=vt,r.Popover=gn,r.PrimaryButton=M,r.ProgressBar=te,r.Separator=ie,r.Spinner=Y,r.Splitter=he,r.TextBox=ge,r.ThemeContext=t,r.Tooltip=Kn,r.Viewer=gt,r.Worker=wt,r.chunk=_n,r.classNames=a,r.createStore=lr,r.getDestination=Hn,r.getPage=Bn,r.isFullScreenEnabled=A,r.isMac=De,r.useDebounceCallback=K,r.useIntersectionObserver=i,r.useIsMounted=L,r.useIsomorphicLayoutEffect=d,r.usePrevious=l,r.useRenderQueue=O})(core)),core}/**
|
|
11
|
+
* A React component to view a PDF document
|
|
12
|
+
*
|
|
13
|
+
* @see https://react-pdf-viewer.dev
|
|
14
|
+
* @license https://react-pdf-viewer.dev/license
|
|
15
|
+
* @copyright 2019-2023 Nguyen Huu Phuoc <me@phuoc.ng>
|
|
16
|
+
*/var hasRequiredLib;function requireLib(){return hasRequiredLib||(hasRequiredLib=1,process.env.NODE_ENV==="production"?lib.exports=requireCore_min():lib.exports=requireCore()),lib.exports}exports.requireLib=requireLib;
|