@copio/sdk 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (149) hide show
  1. package/README.md +204 -2
  2. package/css/container.css +177 -0
  3. package/css/cropper.css +306 -0
  4. package/css/main.css +139 -0
  5. package/css/reset.css +204 -0
  6. package/css/shoelace.css +485 -0
  7. package/css/utils.css +689 -0
  8. package/dist/adapters/image/canvas2d-adapter.js +2 -0
  9. package/dist/adapters/image/canvas2d-adapter.js.map +7 -0
  10. package/dist/adapters/image/index.js +2 -0
  11. package/dist/adapters/image/index.js.map +7 -0
  12. package/dist/adapters/image/null-image-processor-adapter.js +2 -0
  13. package/dist/adapters/image/null-image-processor-adapter.js.map +7 -0
  14. package/dist/adapters/index.js +2 -0
  15. package/dist/adapters/index.js.map +7 -0
  16. package/dist/adapters/indexeddb-adapter.js +2 -0
  17. package/dist/adapters/indexeddb-adapter.js.map +7 -0
  18. package/dist/adapters/memory-adapter.js +2 -0
  19. package/dist/adapters/memory-adapter.js.map +7 -0
  20. package/dist/adapters/ocr/index.js +2 -0
  21. package/dist/adapters/ocr/index.js.map +7 -0
  22. package/dist/adapters/ocr/null-ocr-adapter.js +2 -0
  23. package/dist/adapters/ocr/null-ocr-adapter.js.map +7 -0
  24. package/dist/adapters/ocr/tesseract-wasm-adapter.js +2 -0
  25. package/dist/adapters/ocr/tesseract-wasm-adapter.js.map +7 -0
  26. package/dist/adapters/pdf/index.js +2 -0
  27. package/dist/adapters/pdf/index.js.map +7 -0
  28. package/dist/adapters/pdf/null-pdf-adapter.js +2 -0
  29. package/dist/adapters/pdf/null-pdf-adapter.js.map +7 -0
  30. package/dist/adapters/pdf/pdfkit-adapter.js +2 -0
  31. package/dist/adapters/pdf/pdfkit-adapter.js.map +7 -0
  32. package/dist/adapters/storage/index.js +2 -0
  33. package/dist/adapters/storage/index.js.map +7 -0
  34. package/dist/adapters/storage/indexeddb-adapter.js +2 -0
  35. package/dist/adapters/storage/indexeddb-adapter.js.map +7 -0
  36. package/dist/adapters/storage/memory-adapter.js +2 -0
  37. package/dist/adapters/storage/memory-adapter.js.map +7 -0
  38. package/dist/adapters/sync/index.js +2 -0
  39. package/dist/adapters/sync/index.js.map +7 -0
  40. package/dist/adapters/sync/null-sync-adapter.js +2 -0
  41. package/dist/adapters/sync/null-sync-adapter.js.map +7 -0
  42. package/dist/adapters/sync/peerjs-adapter.js +2 -0
  43. package/dist/adapters/sync/peerjs-adapter.js.map +7 -0
  44. package/dist/canvas-FAXPLPXN.js +2 -0
  45. package/dist/cdn.js +2770 -0
  46. package/dist/chunk-36F637QU.js +2 -0
  47. package/dist/chunk-4C666HHU.js +2 -0
  48. package/dist/chunk-4GEMGDRU.js +1 -0
  49. package/dist/chunk-4JPEWIT4.js +2 -0
  50. package/dist/chunk-6IBEH4EW.js +2601 -0
  51. package/dist/chunk-A5G52Q2W.js +2 -0
  52. package/dist/chunk-AU7NM25J.js +2 -0
  53. package/dist/chunk-B2EK6INF.js +2 -0
  54. package/dist/chunk-B5BEYYR2.js +8 -0
  55. package/dist/chunk-B7HT2X67.js +2 -0
  56. package/dist/chunk-BKZEOOH4.js +2 -0
  57. package/dist/chunk-CWCS22CQ.js +1 -0
  58. package/dist/chunk-DGGK5KEX.js +2 -0
  59. package/dist/chunk-E7JYVRJA.js +2 -0
  60. package/dist/chunk-G65H4ZTJ.js +2 -0
  61. package/dist/chunk-HN3336JN.js +2 -0
  62. package/dist/chunk-IUBYFIV6.js +12 -0
  63. package/dist/chunk-K6YP7EET.js +8 -0
  64. package/dist/chunk-KIMVF5UG.js +2 -0
  65. package/dist/chunk-LI54F6PA.js +2 -0
  66. package/dist/chunk-N4R55VRR.js +2 -0
  67. package/dist/chunk-N7Q34F2P.js +4 -0
  68. package/dist/chunk-OI4WCW7E.js +2 -0
  69. package/dist/chunk-PUJYN435.js +1 -0
  70. package/dist/chunk-PVNRK4OH.js +2 -0
  71. package/dist/chunk-SH4P4XSZ.js +2 -0
  72. package/dist/chunk-UCV3MQ6I.js +33 -0
  73. package/dist/chunk-V2FP4EEH.js +2 -0
  74. package/dist/chunk-V6E2SSSW.js +1 -0
  75. package/dist/chunk-XEN5VKAV.js +19 -0
  76. package/dist/chunk-YHLOPPXM.js +2 -0
  77. package/dist/core.js +2 -0
  78. package/dist/custom-elements.json +4779 -0
  79. package/dist/export.js +2 -0
  80. package/dist/fs-HJ6WWW73.js +2 -0
  81. package/dist/http-FKJJMT2N.js +2 -0
  82. package/dist/https-MUBFLDZM.js +2 -0
  83. package/dist/index.js +99 -0
  84. package/dist/ocr.js +2 -0
  85. package/dist/path2d-QWN6DFCC.js +2 -0
  86. package/dist/scanner.js +2631 -0
  87. package/dist/sync.js +2 -0
  88. package/dist/types/js/adapters/image/canvas2d-adapter.d.ts +42 -0
  89. package/dist/types/js/adapters/image/image-processor-port.d.ts +41 -0
  90. package/dist/types/js/adapters/image/index.d.ts +3 -0
  91. package/dist/types/js/adapters/image/null-image-processor-adapter.d.ts +13 -0
  92. package/dist/types/js/adapters/ocr/index.d.ts +3 -0
  93. package/dist/types/js/adapters/ocr/null-ocr-adapter.d.ts +39 -0
  94. package/dist/types/js/adapters/ocr/ocr-port.d.ts +139 -0
  95. package/dist/types/js/adapters/ocr/tesseract-wasm-adapter.d.ts +40 -0
  96. package/dist/types/js/adapters/pdf/index.d.ts +3 -0
  97. package/dist/types/js/adapters/pdf/null-pdf-adapter.d.ts +23 -0
  98. package/dist/types/js/adapters/pdf/pdf-port.d.ts +21 -0
  99. package/dist/types/js/adapters/pdf/pdfkit-adapter.d.ts +16 -0
  100. package/dist/types/js/adapters/storage/index.d.ts +22 -0
  101. package/dist/types/js/adapters/storage/indexeddb-adapter.d.ts +109 -0
  102. package/dist/types/js/adapters/storage/memory-adapter.d.ts +101 -0
  103. package/dist/types/js/adapters/storage/storage-port.d.ts +113 -0
  104. package/dist/types/js/adapters/sync/index.d.ts +3 -0
  105. package/dist/types/js/adapters/sync/null-sync-adapter.d.ts +14 -0
  106. package/dist/types/js/adapters/sync/peerjs-adapter.d.ts +16 -0
  107. package/dist/types/js/adapters/sync/sync-port.d.ts +18 -0
  108. package/dist/types/js/components/copio-header.d.ts +19 -0
  109. package/dist/types/js/components/copio-loader.d.ts +6 -0
  110. package/dist/types/js/core/store.d.ts +2 -0
  111. package/dist/types/js/routes/add-edit/copio-add-edit-dialog.d.ts +9 -0
  112. package/dist/types/js/routes/doc/copio-carousel.d.ts +43 -0
  113. package/dist/types/js/routes/doc/copio-images.d.ts +37 -0
  114. package/dist/types/js/routes/home/copio-row.d.ts +49 -0
  115. package/dist/types/js/routes/ocr/copio-doc-ocr-dialog.d.ts +97 -0
  116. package/dist/types/js/routes/sync/copio-sync-dialog.d.ts +13 -0
  117. package/dist/types/js/services/doc-repository.d.ts +233 -0
  118. package/dist/types/js/services/export-utils.d.ts +42 -0
  119. package/dist/types/js/services/ice-servers.d.ts +1 -0
  120. package/dist/types/js/services/notify.d.ts +82 -0
  121. package/dist/types/js/services/ocr-service.d.ts +64 -0
  122. package/dist/types/js/services/sync-service.d.ts +11 -0
  123. package/dist/types/js/styles/cropper-styles.d.ts +5 -0
  124. package/dist/types/js/utils/module-loader.d.ts +76 -0
  125. package/dist/types/js/utils/pdf-utils.d.ts +7 -0
  126. package/dist/types/js/utils/utils.d.ts +54 -0
  127. package/dist/types/sdk/cdn.d.ts +7 -0
  128. package/dist/types/sdk/core.d.ts +310 -0
  129. package/dist/types/sdk/elements.d.ts +25 -0
  130. package/dist/types/sdk/events.d.ts +227 -0
  131. package/dist/types/sdk/index.d.ts +37 -0
  132. package/dist/types/sdk/license.d.ts +12 -0
  133. package/dist/types/sdk/models.d.ts +174 -0
  134. package/dist/types/sdk/scanner.d.ts +68 -0
  135. package/dist/types/sdk/styles.d.ts +21 -0
  136. package/dist/types/sdk/sync.d.ts +7 -0
  137. package/dist/types/sdk/version.d.ts +2 -0
  138. package/dist/url-ABJ6S2Y6.js +2 -0
  139. package/package.json +72 -3
  140. package/sdk/cdn.js +13 -0
  141. package/sdk/core.js +961 -0
  142. package/sdk/events.js +99 -0
  143. package/sdk/index.js +137 -0
  144. package/sdk/license.js +28 -0
  145. package/sdk/models.js +177 -0
  146. package/sdk/scanner.js +1597 -0
  147. package/sdk/styles.js +1236 -0
  148. package/sdk/sync.js +12 -0
  149. package/sdk/version.js +7 -0
@@ -0,0 +1,12 @@
1
+ import{c as Ht}from"./chunk-G65H4ZTJ.js";var Tt,Lt,It,Dt,Xt={976:(ot,it,j)=>{j.d(it,{AnnotationLayer:()=>g,FreeTextAnnotationElement:()=>B,InkAnnotationElement:()=>J,StampAnnotationElement:()=>$});var _=j(292),H=j(419),N=j(792);function W(v){return Math.floor(255*Math.max(0,Math.min(1,v))).toString(16).padStart(2,"0")}function F(v){return Math.max(0,Math.min(255,255*v))}class k{static CMYK_G([e,a,p,u]){return["G",1-Math.min(1,.3*e+.59*p+.11*a+u)]}static G_CMYK([e]){return["CMYK",0,0,0,1-e]}static G_RGB([e]){return["RGB",e,e,e]}static G_rgb([e]){return[e=F(e),e,e]}static G_HTML([e]){let a=W(e);return`#${a}${a}${a}`}static RGB_G([e,a,p]){return["G",.3*e+.59*a+.11*p]}static RGB_rgb(e){return e.map(F)}static RGB_HTML(e){return`#${e.map(W).join("")}`}static T_HTML(){return"#00000000"}static T_rgb(){return[null]}static CMYK_RGB([e,a,p,u]){return["RGB",1-Math.min(1,e+u),1-Math.min(1,p+u),1-Math.min(1,a+u)]}static CMYK_rgb([e,a,p,u]){return[F(1-Math.min(1,e+u)),F(1-Math.min(1,p+u)),F(1-Math.min(1,a+u))]}static CMYK_HTML(e){let a=this.CMYK_RGB(e).slice(1);return this.RGB_HTML(a)}static RGB_CMYK([e,a,p]){let u=1-e,C=1-a,A=1-p;return["CMYK",u,C,A,Math.min(u,C,A)]}}var M=j(284);let f=1e3,i=new WeakSet;function h(v){return{width:v[2]-v[0],height:v[3]-v[1]}}class w{static create(e){switch(e.data.annotationType){case _.AnnotationType.LINK:return new n(e);case _.AnnotationType.TEXT:return new c(e);case _.AnnotationType.WIDGET:switch(e.data.fieldType){case"Tx":return new s(e);case"Btn":return e.data.radioButton?new y(e):e.data.checkBox?new m(e):new b(e);case"Ch":return new R(e);case"Sig":return new r(e)}return new t(e);case _.AnnotationType.POPUP:return new L(e);case _.AnnotationType.FREETEXT:return new B(e);case _.AnnotationType.LINE:return new X(e);case _.AnnotationType.SQUARE:return new Z(e);case _.AnnotationType.CIRCLE:return new nt(e);case _.AnnotationType.POLYLINE:return new G(e);case _.AnnotationType.CARET:return new z(e);case _.AnnotationType.INK:return new J(e);case _.AnnotationType.POLYGON:return new O(e);case _.AnnotationType.HIGHLIGHT:return new st(e);case _.AnnotationType.UNDERLINE:return new et(e);case _.AnnotationType.SQUIGGLY:return new at(e);case _.AnnotationType.STRIKEOUT:return new rt(e);case _.AnnotationType.STAMP:return new $(e);case _.AnnotationType.FILEATTACHMENT:return new l(e);default:return new S(e)}}}class S{#t=!1;constructor(e,{isRenderable:a=!1,ignoreBorder:p=!1,createQuadrilaterals:u=!1}={}){this.isRenderable=a,this.data=e.data,this.layer=e.layer,this.linkService=e.linkService,this.downloadManager=e.downloadManager,this.imageResourcesPath=e.imageResourcesPath,this.renderForms=e.renderForms,this.svgFactory=e.svgFactory,this.annotationStorage=e.annotationStorage,this.enableScripting=e.enableScripting,this.hasJSActions=e.hasJSActions,this._fieldObjects=e.fieldObjects,this.parent=e.parent,a&&(this.container=this._createContainer(p)),u&&this._createQuadrilaterals()}static _hasPopupData({titleObj:e,contentsObj:a,richText:p}){return!!(e?.str||a?.str||p?.str)}get hasPopupData(){return S._hasPopupData(this.data)}_createContainer(e){let{data:a,parent:{page:p,viewport:u}}=this,C=document.createElement("section");C.setAttribute("data-annotation-id",a.id),this instanceof t||(C.tabIndex=f),C.style.zIndex=this.parent.zIndex++,a.popupRef&&C.setAttribute("aria-haspopup","dialog"),a.alternativeText&&(C.title=a.alternativeText),a.noRotate&&C.classList.add("norotate");let{pageWidth:A,pageHeight:o,pageX:E,pageY:P}=u.rawDims;if(!a.rect||this instanceof L){let{rotation:U}=a;return a.hasOwnCanvas||U===0||this.setRotation(U,C),C}let{width:T,height:d}=h(a.rect),x=_.Util.normalizeRect([a.rect[0],p.view[3]-a.rect[1]+p.view[1],a.rect[2],p.view[3]-a.rect[3]+p.view[1]]);if(!e&&a.borderStyle.width>0){C.style.borderWidth=`${a.borderStyle.width}px`;let U=a.borderStyle.horizontalCornerRadius,V=a.borderStyle.verticalCornerRadius;if(U>0||V>0){let K=`calc(${U}px * var(--scale-factor)) / calc(${V}px * var(--scale-factor))`;C.style.borderRadius=K}else if(this instanceof y){let K=`calc(${T}px * var(--scale-factor)) / calc(${d}px * var(--scale-factor))`;C.style.borderRadius=K}switch(a.borderStyle.style){case _.AnnotationBorderStyleType.SOLID:C.style.borderStyle="solid";break;case _.AnnotationBorderStyleType.DASHED:C.style.borderStyle="dashed";break;case _.AnnotationBorderStyleType.BEVELED:(0,_.warn)("Unimplemented border style: beveled");break;case _.AnnotationBorderStyleType.INSET:(0,_.warn)("Unimplemented border style: inset");break;case _.AnnotationBorderStyleType.UNDERLINE:C.style.borderBottomStyle="solid"}let q=a.borderColor||null;q?(this.#t=!0,C.style.borderColor=_.Util.makeHexColor(0|q[0],0|q[1],0|q[2])):C.style.borderWidth=0}C.style.left=100*(x[0]-E)/A+"%",C.style.top=100*(x[1]-P)/o+"%";let{rotation:D}=a;return a.hasOwnCanvas||D===0?(C.style.width=100*T/A+"%",C.style.height=100*d/o+"%"):this.setRotation(D,C),C}setRotation(e,a=this.container){if(!this.data.rect)return;let{pageWidth:p,pageHeight:u}=this.parent.viewport.rawDims,{width:C,height:A}=h(this.data.rect),o,E;e%180==0?(o=100*C/p,E=100*A/u):(o=100*A/p,E=100*C/u),a.style.width=`${o}%`,a.style.height=`${E}%`,a.setAttribute("data-main-rotation",(360-e)%360)}get _commonActions(){let e=(a,p,u)=>{let C=u.detail[a],A=C[0],o=C.slice(1);u.target.style[p]=k[`${A}_HTML`](o),this.annotationStorage.setValue(this.data.id,{[p]:k[`${A}_rgb`](o)})};return(0,_.shadow)(this,"_commonActions",{display:a=>{let{display:p}=a.detail,u=p%2==1;this.container.style.visibility=u?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noView:u,noPrint:p===1||p===2})},print:a=>{this.annotationStorage.setValue(this.data.id,{noPrint:!a.detail.print})},hidden:a=>{let{hidden:p}=a.detail;this.container.style.visibility=p?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noPrint:p,noView:p})},focus:a=>{setTimeout((()=>a.target.focus({preventScroll:!1})),0)},userName:a=>{a.target.title=a.detail.userName},readonly:a=>{a.target.disabled=a.detail.readonly},required:a=>{this._setRequired(a.target,a.detail.required)},bgColor:a=>{e("bgColor","backgroundColor",a)},fillColor:a=>{e("fillColor","backgroundColor",a)},fgColor:a=>{e("fgColor","color",a)},textColor:a=>{e("textColor","color",a)},borderColor:a=>{e("borderColor","borderColor",a)},strokeColor:a=>{e("strokeColor","borderColor",a)},rotation:a=>{let p=a.detail.rotation;this.setRotation(p),this.annotationStorage.setValue(this.data.id,{rotation:p})}})}_dispatchEventFromSandbox(e,a){let p=this._commonActions;for(let u of Object.keys(a.detail))(e[u]||p[u])?.(a)}_setDefaultPropertiesFromJS(e){if(!this.enableScripting)return;let a=this.annotationStorage.getRawValue(this.data.id);if(!a)return;let p=this._commonActions;for(let[u,C]of Object.entries(a)){let A=p[u];A&&(A({detail:{[u]:C},target:e}),delete a[u])}}_createQuadrilaterals(){if(!this.container)return;let{quadPoints:e}=this.data;if(!e)return;let[a,p,u,C]=this.data.rect;if(e.length===1){let[,{x:V,y:q},{x:K,y:tt}]=e[0];if(u===V&&C===q&&a===K&&p===tt)return}let{style:A}=this.container,o;if(this.#t){let{borderColor:V,borderWidth:q}=A;A.borderWidth=0,o=["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="${V}" stroke-width="${q}">`],this.container.classList.add("hasBorder")}let E=u-a,P=C-p,{svgFactory:T}=this,d=T.createElement("svg");d.classList.add("quadrilateralsContainer"),d.setAttribute("width",0),d.setAttribute("height",0);let x=T.createElement("defs");d.append(x);let D=T.createElement("clipPath"),U=`clippath_${this.data.id}`;D.setAttribute("id",U),D.setAttribute("clipPathUnits","objectBoundingBox"),x.append(D);for(let[,{x:V,y:q},{x:K,y:tt}]of e){let Q=T.createElement("rect"),Y=(K-a)/E,ht=(C-q)/P,dt=(V-K)/E,lt=(q-tt)/P;Q.setAttribute("x",Y),Q.setAttribute("y",ht),Q.setAttribute("width",dt),Q.setAttribute("height",lt),D.append(Q),o?.push(`<rect vector-effect="non-scaling-stroke" x="${Y}" y="${ht}" width="${dt}" height="${lt}"/>`)}this.#t&&(o.push("</g></svg>')"),A.backgroundImage=o.join("")),this.container.append(d),this.container.style.clipPath=`url(#${U})`}_createPopup(){let{container:e,data:a}=this;e.setAttribute("aria-haspopup","dialog");let p=new L({data:{color:a.color,titleObj:a.titleObj,modificationDate:a.modificationDate,contentsObj:a.contentsObj,richText:a.richText,parentRect:a.rect,borderStyle:0,id:`popup_${a.id}`,rotation:a.rotation},parent:this.parent,elements:[this]});this.parent.div.append(p.render())}render(){(0,_.unreachable)("Abstract method `AnnotationElement.render` called")}_getElementsByName(e,a=null){let p=[];if(this._fieldObjects){let u=this._fieldObjects[e];if(u)for(let{page:C,id:A,exportValues:o}of u){if(C===-1||A===a)continue;let E=typeof o=="string"?o:null,P=document.querySelector(`[data-element-id="${A}"]`);!P||i.has(P)?p.push({id:A,exportValue:E,domElement:P}):(0,_.warn)(`_getElementsByName - element not allowed: ${A}`)}return p}for(let u of document.getElementsByName(e)){let{exportValue:C}=u,A=u.getAttribute("data-element-id");A!==a&&i.has(u)&&p.push({id:A,exportValue:C,domElement:u})}return p}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(){let e=this.getElementsToTriggerPopup();if(Array.isArray(e))for(let a of e)a.classList.add("highlightArea");else e.classList.add("highlightArea")}get _isEditable(){return!1}_editOnDoubleClick(){if(!this._isEditable)return;let{annotationEditorType:e,data:{id:a}}=this;this.container.addEventListener("dblclick",(()=>{this.linkService.eventBus?.dispatch("switchannotationeditormode",{source:this,mode:e,editId:a})}))}}class n extends S{constructor(e,a=null){super(e,{isRenderable:!0,ignoreBorder:!!a?.ignoreBorder,createQuadrilaterals:!0}),this.isTooltipOnly=e.data.isTooltipOnly}render(){let{data:e,linkService:a}=this,p=document.createElement("a");p.setAttribute("data-element-id",e.id);let u=!1;return e.url?(a.addLinkAttributes(p,e.url,e.newWindow),u=!0):e.action?(this._bindNamedAction(p,e.action),u=!0):e.attachment?(this.#e(p,e.attachment,e.attachmentDest),u=!0):e.setOCGState?(this.#s(p,e.setOCGState),u=!0):e.dest?(this._bindLink(p,e.dest),u=!0):(e.actions&&(e.actions.Action||e.actions["Mouse Up"]||e.actions["Mouse Down"])&&this.enableScripting&&this.hasJSActions&&(this._bindJSAction(p,e),u=!0),e.resetForm?(this._bindResetFormAction(p,e.resetForm),u=!0):this.isTooltipOnly&&!u&&(this._bindLink(p,""),u=!0)),this.container.classList.add("linkAnnotation"),u&&this.container.append(p),this.container}#t(){this.container.setAttribute("data-internal-link","")}_bindLink(e,a){e.href=this.linkService.getDestinationHash(a),e.onclick=()=>(a&&this.linkService.goToDestination(a),!1),(a||a==="")&&this.#t()}_bindNamedAction(e,a){e.href=this.linkService.getAnchorUrl(""),e.onclick=()=>(this.linkService.executeNamedAction(a),!1),this.#t()}#e(e,a,p=null){e.href=this.linkService.getAnchorUrl(""),e.onclick=()=>(this.downloadManager?.openOrDownloadData(a.content,a.filename,p),!1),this.#t()}#s(e,a){e.href=this.linkService.getAnchorUrl(""),e.onclick=()=>(this.linkService.executeSetOCGState(a),!1),this.#t()}_bindJSAction(e,a){e.href=this.linkService.getAnchorUrl("");let p=new Map([["Action","onclick"],["Mouse Up","onmouseup"],["Mouse Down","onmousedown"]]);for(let u of Object.keys(a.actions)){let C=p.get(u);C&&(e[C]=()=>(this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:a.id,name:u}}),!1))}e.onclick||(e.onclick=()=>!1),this.#t()}_bindResetFormAction(e,a){let p=e.onclick;p||(e.href=this.linkService.getAnchorUrl("")),this.#t(),this._fieldObjects?e.onclick=()=>{p?.();let{fields:u,refs:C,include:A}=a,o=[];if(u.length!==0||C.length!==0){let T=new Set(C);for(let d of u){let x=this._fieldObjects[d]||[];for(let{id:D}of x)T.add(D)}for(let d of Object.values(this._fieldObjects))for(let x of d)T.has(x.id)===A&&o.push(x)}else for(let T of Object.values(this._fieldObjects))o.push(...T);let E=this.annotationStorage,P=[];for(let T of o){let{id:d}=T;switch(P.push(d),T.type){case"text":{let D=T.defaultValue||"";E.setValue(d,{value:D});break}case"checkbox":case"radiobutton":{let D=T.defaultValue===T.exportValues;E.setValue(d,{value:D});break}case"combobox":case"listbox":{let D=T.defaultValue||"";E.setValue(d,{value:D});break}default:continue}let x=document.querySelector(`[data-element-id="${d}"]`);x&&(i.has(x)?x.dispatchEvent(new Event("resetform")):(0,_.warn)(`_bindResetFormAction - element not allowed: ${d}`))}return this.enableScripting&&this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:"app",ids:P,name:"ResetForm"}}),!1}:((0,_.warn)('_bindResetFormAction - "resetForm" action not supported, ensure that the `fieldObjects` parameter is provided.'),p||(e.onclick=()=>!1))}}class c extends S{constructor(e){super(e,{isRenderable:!0})}render(){this.container.classList.add("textAnnotation");let e=document.createElement("img");return e.src=this.imageResourcesPath+"annotation-"+this.data.name.toLowerCase()+".svg",e.setAttribute("data-l10n-id","pdfjs-text-annotation-type"),e.setAttribute("data-l10n-args",JSON.stringify({type:this.data.name})),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.append(e),this.container}}class t extends S{render(){return this.container}showElementAndHideCanvas(e){this.data.hasOwnCanvas&&(e.previousSibling?.nodeName==="CANVAS"&&(e.previousSibling.hidden=!0),e.hidden=!1)}_getKeyModifier(e){return _.FeatureTest.platform.isMac?e.metaKey:e.ctrlKey}_setEventListener(e,a,p,u,C){p.includes("mouse")?e.addEventListener(p,(A=>{this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:u,value:C(A),shift:A.shiftKey,modifier:this._getKeyModifier(A)}})})):e.addEventListener(p,(A=>{if(p==="blur"){if(!a.focused||!A.relatedTarget)return;a.focused=!1}else if(p==="focus"){if(a.focused)return;a.focused=!0}C&&this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:u,value:C(A)}})}))}_setEventListeners(e,a,p,u){for(let[C,A]of p)(A==="Action"||this.data.actions?.[A])&&(A!=="Focus"&&A!=="Blur"||(a||={focused:!1}),this._setEventListener(e,a,C,A,u),A!=="Focus"||this.data.actions?.Blur?A!=="Blur"||this.data.actions?.Focus||this._setEventListener(e,a,"focus","Focus",null):this._setEventListener(e,a,"blur","Blur",null))}_setBackgroundColor(e){let a=this.data.backgroundColor||null;e.style.backgroundColor=a===null?"transparent":_.Util.makeHexColor(a[0],a[1],a[2])}_setTextStyle(e){let a=["left","center","right"],{fontColor:p}=this.data.defaultAppearanceData,u=this.data.defaultAppearanceData.fontSize||9,C=e.style,A,o=E=>Math.round(10*E)/10;if(this.data.multiLine){let E=Math.abs(this.data.rect[3]-this.data.rect[1]-2),P=E/(Math.round(E/(_.LINE_FACTOR*u))||1);A=Math.min(u,o(P/_.LINE_FACTOR))}else{let E=Math.abs(this.data.rect[3]-this.data.rect[1]-2);A=Math.min(u,o(E/_.LINE_FACTOR))}C.fontSize=`calc(${A}px * var(--scale-factor))`,C.color=_.Util.makeHexColor(p[0],p[1],p[2]),this.data.textAlignment!==null&&(C.textAlign=a[this.data.textAlignment])}_setRequired(e,a){a?e.setAttribute("required",!0):e.removeAttribute("required"),e.setAttribute("aria-required",a)}}class s extends t{constructor(e){super(e,{isRenderable:e.renderForms||e.data.hasOwnCanvas||!e.data.hasAppearance&&!!e.data.fieldValue})}setPropertyOnSiblings(e,a,p,u){let C=this.annotationStorage;for(let A of this._getElementsByName(e.name,e.id))A.domElement&&(A.domElement[a]=p),C.setValue(A.id,{[u]:p})}render(){let e=this.annotationStorage,a=this.data.id;this.container.classList.add("textWidgetAnnotation");let p=null;if(this.renderForms){let u=e.getValue(a,{value:this.data.fieldValue}),C=u.value||"",A=e.getValue(a,{charLimit:this.data.maxLen}).charLimit;A&&C.length>A&&(C=C.slice(0,A));let o=u.formattedValue||this.data.textContent?.join(`
2
+ `)||null;o&&this.data.comb&&(o=o.replaceAll(/\s+/g,""));let E={userValue:C,formattedValue:o,lastCommittedValue:null,commitKey:1,focused:!1};this.data.multiLine?(p=document.createElement("textarea"),p.textContent=o??C,this.data.doNotScroll&&(p.style.overflowY="hidden")):(p=document.createElement("input"),p.type="text",p.setAttribute("value",o??C),this.data.doNotScroll&&(p.style.overflowX="hidden")),this.data.hasOwnCanvas&&(p.hidden=!0),i.add(p),p.setAttribute("data-element-id",a),p.disabled=this.data.readOnly,p.name=this.data.fieldName,p.tabIndex=f,this._setRequired(p,this.data.required),A&&(p.maxLength=A),p.addEventListener("input",(T=>{e.setValue(a,{value:T.target.value}),this.setPropertyOnSiblings(p,"value",T.target.value,"value"),E.formattedValue=null})),p.addEventListener("resetform",(T=>{let d=this.data.defaultFieldValue??"";p.value=E.userValue=d,E.formattedValue=null}));let P=T=>{let{formattedValue:d}=E;d!=null&&(T.target.value=d),T.target.scrollLeft=0};if(this.enableScripting&&this.hasJSActions){p.addEventListener("focus",(d=>{if(E.focused)return;let{target:x}=d;E.userValue&&(x.value=E.userValue),E.lastCommittedValue=x.value,E.commitKey=1,this.data.actions?.Focus||(E.focused=!0)})),p.addEventListener("updatefromsandbox",(d=>{this.showElementAndHideCanvas(d.target);let x={value(D){E.userValue=D.detail.value??"",e.setValue(a,{value:E.userValue.toString()}),D.target.value=E.userValue},formattedValue(D){let{formattedValue:U}=D.detail;E.formattedValue=U,U!=null&&D.target!==document.activeElement&&(D.target.value=U),e.setValue(a,{formattedValue:U})},selRange(D){D.target.setSelectionRange(...D.detail.selRange)},charLimit:D=>{let{charLimit:U}=D.detail,{target:V}=D;if(U===0){V.removeAttribute("maxLength");return}V.setAttribute("maxLength",U);let q=E.userValue;q&&!(q.length<=U)&&(q=q.slice(0,U),V.value=E.userValue=q,e.setValue(a,{value:q}),this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:a,name:"Keystroke",value:q,willCommit:!0,commitKey:1,selStart:V.selectionStart,selEnd:V.selectionEnd}}))}};this._dispatchEventFromSandbox(x,d)})),p.addEventListener("keydown",(d=>{E.commitKey=1;let x=-1;if(d.key==="Escape"?x=0:d.key!=="Enter"||this.data.multiLine?d.key==="Tab"&&(E.commitKey=3):x=2,x===-1)return;let{value:D}=d.target;E.lastCommittedValue!==D&&(E.lastCommittedValue=D,E.userValue=D,this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:a,name:"Keystroke",value:D,willCommit:!0,commitKey:x,selStart:d.target.selectionStart,selEnd:d.target.selectionEnd}}))}));let T=P;P=null,p.addEventListener("blur",(d=>{if(!E.focused||!d.relatedTarget)return;this.data.actions?.Blur||(E.focused=!1);let{value:x}=d.target;E.userValue=x,E.lastCommittedValue!==x&&this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:a,name:"Keystroke",value:x,willCommit:!0,commitKey:E.commitKey,selStart:d.target.selectionStart,selEnd:d.target.selectionEnd}}),T(d)})),this.data.actions?.Keystroke&&p.addEventListener("beforeinput",(d=>{E.lastCommittedValue=null;let{data:x,target:D}=d,{value:U,selectionStart:V,selectionEnd:q}=D,K=V,tt=q;switch(d.inputType){case"deleteWordBackward":{let Q=U.substring(0,V).match(/\w*[^\w]*$/);Q&&(K-=Q[0].length);break}case"deleteWordForward":{let Q=U.substring(V).match(/^[^\w]*\w*/);Q&&(tt+=Q[0].length);break}case"deleteContentBackward":V===q&&(K-=1);break;case"deleteContentForward":V===q&&(tt+=1)}d.preventDefault(),this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:a,name:"Keystroke",value:U,change:x||"",willCommit:!1,selStart:K,selEnd:tt}})})),this._setEventListeners(p,E,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],(d=>d.target.value))}if(P&&p.addEventListener("blur",P),this.data.comb){let T=(this.data.rect[2]-this.data.rect[0])/A;p.classList.add("comb"),p.style.letterSpacing=`calc(${T}px * var(--scale-factor) - 1ch)`}}else p=document.createElement("div"),p.textContent=this.data.fieldValue,p.style.verticalAlign="middle",p.style.display="table-cell",this.data.hasOwnCanvas&&(p.hidden=!0);return this._setTextStyle(p),this._setBackgroundColor(p),this._setDefaultPropertiesFromJS(p),this.container.append(p),this.container}}class r extends t{constructor(e){super(e,{isRenderable:!!e.data.hasOwnCanvas})}}class m extends t{constructor(e){super(e,{isRenderable:e.renderForms})}render(){let e=this.annotationStorage,a=this.data,p=a.id,u=e.getValue(p,{value:a.exportValue===a.fieldValue}).value;typeof u=="string"&&(u=u!=="Off",e.setValue(p,{value:u})),this.container.classList.add("buttonWidgetAnnotation","checkBox");let C=document.createElement("input");return i.add(C),C.setAttribute("data-element-id",p),C.disabled=a.readOnly,this._setRequired(C,this.data.required),C.type="checkbox",C.name=a.fieldName,u&&C.setAttribute("checked",!0),C.setAttribute("exportValue",a.exportValue),C.tabIndex=f,C.addEventListener("change",(A=>{let{name:o,checked:E}=A.target;for(let P of this._getElementsByName(o,p)){let T=E&&P.exportValue===a.exportValue;P.domElement&&(P.domElement.checked=T),e.setValue(P.id,{value:T})}e.setValue(p,{value:E})})),C.addEventListener("resetform",(A=>{let o=a.defaultFieldValue||"Off";A.target.checked=o===a.exportValue})),this.enableScripting&&this.hasJSActions&&(C.addEventListener("updatefromsandbox",(A=>{let o={value(E){E.target.checked=E.detail.value!=="Off",e.setValue(p,{value:E.target.checked})}};this._dispatchEventFromSandbox(o,A)})),this._setEventListeners(C,null,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],(A=>A.target.checked))),this._setBackgroundColor(C),this._setDefaultPropertiesFromJS(C),this.container.append(C),this.container}}class y extends t{constructor(e){super(e,{isRenderable:e.renderForms})}render(){this.container.classList.add("buttonWidgetAnnotation","radioButton");let e=this.annotationStorage,a=this.data,p=a.id,u=e.getValue(p,{value:a.fieldValue===a.buttonValue}).value;if(typeof u=="string"&&(u=u!==a.buttonValue,e.setValue(p,{value:u})),u)for(let A of this._getElementsByName(a.fieldName,p))e.setValue(A.id,{value:!1});let C=document.createElement("input");if(i.add(C),C.setAttribute("data-element-id",p),C.disabled=a.readOnly,this._setRequired(C,this.data.required),C.type="radio",C.name=a.fieldName,u&&C.setAttribute("checked",!0),C.tabIndex=f,C.addEventListener("change",(A=>{let{name:o,checked:E}=A.target;for(let P of this._getElementsByName(o,p))e.setValue(P.id,{value:!1});e.setValue(p,{value:E})})),C.addEventListener("resetform",(A=>{let o=a.defaultFieldValue;A.target.checked=o!=null&&o===a.buttonValue})),this.enableScripting&&this.hasJSActions){let A=a.buttonValue;C.addEventListener("updatefromsandbox",(o=>{let E={value:P=>{let T=A===P.detail.value;for(let d of this._getElementsByName(P.target.name)){let x=T&&d.id===p;d.domElement&&(d.domElement.checked=x),e.setValue(d.id,{value:x})}}};this._dispatchEventFromSandbox(E,o)})),this._setEventListeners(C,null,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],(o=>o.target.checked))}return this._setBackgroundColor(C),this._setDefaultPropertiesFromJS(C),this.container.append(C),this.container}}class b extends n{constructor(e){super(e,{ignoreBorder:e.data.hasAppearance})}render(){let e=super.render();e.classList.add("buttonWidgetAnnotation","pushButton");let a=e.lastChild;return this.enableScripting&&this.hasJSActions&&a&&(this._setDefaultPropertiesFromJS(a),a.addEventListener("updatefromsandbox",(p=>{this._dispatchEventFromSandbox({},p)}))),e}}class R extends t{constructor(e){super(e,{isRenderable:e.renderForms})}render(){this.container.classList.add("choiceWidgetAnnotation");let e=this.annotationStorage,a=this.data.id,p=e.getValue(a,{value:this.data.fieldValue}),u=document.createElement("select");i.add(u),u.setAttribute("data-element-id",a),u.disabled=this.data.readOnly,this._setRequired(u,this.data.required),u.name=this.data.fieldName,u.tabIndex=f;let C=this.data.combo&&this.data.options.length>0;this.data.combo||(u.size=this.data.options.length,this.data.multiSelect&&(u.multiple=!0)),u.addEventListener("resetform",(T=>{let d=this.data.defaultFieldValue;for(let x of u.options)x.selected=x.value===d}));for(let T of this.data.options){let d=document.createElement("option");d.textContent=T.displayValue,d.value=T.exportValue,p.value.includes(T.exportValue)&&(d.setAttribute("selected",!0),C=!1),u.append(d)}let A=null;if(C){let T=document.createElement("option");T.value=" ",T.setAttribute("hidden",!0),T.setAttribute("selected",!0),u.prepend(T),A=()=>{T.remove(),u.removeEventListener("input",A),A=null},u.addEventListener("input",A)}let o=T=>{let d=T?"value":"textContent",{options:x,multiple:D}=u;return D?Array.prototype.filter.call(x,(U=>U.selected)).map((U=>U[d])):x.selectedIndex===-1?null:x[x.selectedIndex][d]},E=o(!1),P=T=>{let d=T.target.options;return Array.prototype.map.call(d,(x=>({displayValue:x.textContent,exportValue:x.value})))};return this.enableScripting&&this.hasJSActions?(u.addEventListener("updatefromsandbox",(T=>{let d={value(x){A?.();let D=x.detail.value,U=new Set(Array.isArray(D)?D:[D]);for(let V of u.options)V.selected=U.has(V.value);e.setValue(a,{value:o(!0)}),E=o(!1)},multipleSelection(x){u.multiple=!0},remove(x){let D=u.options,U=x.detail.remove;D[U].selected=!1,u.remove(U),D.length>0&&Array.prototype.findIndex.call(D,(V=>V.selected))===-1&&(D[0].selected=!0),e.setValue(a,{value:o(!0),items:P(x)}),E=o(!1)},clear(x){for(;u.length!==0;)u.remove(0);e.setValue(a,{value:null,items:[]}),E=o(!1)},insert(x){let{index:D,displayValue:U,exportValue:V}=x.detail.insert,q=u.children[D],K=document.createElement("option");K.textContent=U,K.value=V,q?q.before(K):u.append(K),e.setValue(a,{value:o(!0),items:P(x)}),E=o(!1)},items(x){let{items:D}=x.detail;for(;u.length!==0;)u.remove(0);for(let U of D){let{displayValue:V,exportValue:q}=U,K=document.createElement("option");K.textContent=V,K.value=q,u.append(K)}u.options.length>0&&(u.options[0].selected=!0),e.setValue(a,{value:o(!0),items:P(x)}),E=o(!1)},indices(x){let D=new Set(x.detail.indices);for(let U of x.target.options)U.selected=D.has(U.index);e.setValue(a,{value:o(!0)}),E=o(!1)},editable(x){x.target.disabled=!x.detail.editable}};this._dispatchEventFromSandbox(d,T)})),u.addEventListener("input",(T=>{let d=o(!0);e.setValue(a,{value:d}),T.preventDefault(),this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:a,name:"Keystroke",value:E,changeEx:d,willCommit:!1,commitKey:1,keyDown:!1}})})),this._setEventListeners(u,null,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"],["input","Action"],["input","Validate"]],(T=>T.target.value))):u.addEventListener("input",(function(T){e.setValue(a,{value:o(!0)})})),this.data.combo&&this._setTextStyle(u),this._setBackgroundColor(u),this._setDefaultPropertiesFromJS(u),this.container.append(u),this.container}}class L extends S{constructor(e){let{data:a,elements:p}=e;super(e,{isRenderable:S._hasPopupData(a)}),this.elements=p}render(){this.container.classList.add("popupAnnotation");let e=new I({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}),a=[];for(let p of this.elements)p.popup=e,a.push(p.data.id),p.addHighlightArea();return this.container.setAttribute("aria-controls",a.map((p=>`${_.AnnotationPrefix}${p}`)).join(",")),this.container}}class I{#t=this.#A.bind(this);#e=this.#E.bind(this);#s=this.#_.bind(this);#n=this.#b.bind(this);#a=null;#i=null;#r=null;#l=null;#h=null;#d=null;#u=null;#c=!1;#o=null;#g=null;#f=null;#p=null;#m=!1;constructor({container:e,color:a,elements:p,titleObj:u,modificationDate:C,contentsObj:A,richText:o,parent:E,rect:P,parentRect:T,open:d}){this.#i=e,this.#p=u,this.#r=A,this.#f=o,this.#d=E,this.#a=a,this.#g=P,this.#u=T,this.#h=p,this.#l=H.PDFDateString.toDateObject(C),this.trigger=p.flatMap((x=>x.getElementsToTriggerPopup()));for(let x of this.trigger)x.addEventListener("click",this.#n),x.addEventListener("mouseenter",this.#s),x.addEventListener("mouseleave",this.#e),x.classList.add("popupTriggerArea");for(let x of p)x.container?.addEventListener("keydown",this.#t);this.#i.hidden=!0,d&&this.#b()}render(){if(this.#o)return;let{page:{view:e},viewport:{rawDims:{pageWidth:a,pageHeight:p,pageX:u,pageY:C}}}=this.#d,A=this.#o=document.createElement("div");if(A.className="popup",this.#a){let tt=A.style.outlineColor=_.Util.makeHexColor(...this.#a);CSS.supports("background-color","color-mix(in srgb, red 30%, white)")?A.style.backgroundColor=`color-mix(in srgb, ${tt} 30%, white)`:A.style.backgroundColor=_.Util.makeHexColor(...this.#a.map((Y=>Math.floor(.7*(255-Y)+Y))))}let o=document.createElement("span");o.className="header";let E=document.createElement("h1");if(o.append(E),{dir:E.dir,str:E.textContent}=this.#p,A.append(o),this.#l){let tt=document.createElement("span");tt.classList.add("popupDate"),tt.setAttribute("data-l10n-id","pdfjs-annotation-date-string"),tt.setAttribute("data-l10n-args",JSON.stringify({date:this.#l.toLocaleDateString(),time:this.#l.toLocaleTimeString()})),o.append(tt)}let P=this.#r,T=this.#f;if(!T?.str||P?.str&&P.str!==T.str){let tt=this._formatContents(P);A.append(tt)}else M.XfaLayer.render({xfaHtml:T.html,intent:"richText",div:A}),A.lastChild.classList.add("richText","popupContent");let d=!!this.#u,x=d?this.#u:this.#g;for(let tt of this.#h)if(!x||_.Util.intersect(tt.data.rect,x)!==null){x=tt.data.rect,d=!0;break}let D=_.Util.normalizeRect([x[0],e[3]-x[1]+e[1],x[2],e[3]-x[3]+e[1]]),U=d?x[2]-x[0]+5:0,V=D[0]+U,q=D[1],{style:K}=this.#i;K.left=100*(V-u)/a+"%",K.top=100*(q-C)/p+"%",this.#i.append(A)}_formatContents({str:e,dir:a}){let p=document.createElement("p");p.classList.add("popupContent"),p.dir=a;let u=e.split(/(?:\r\n?|\n)/);for(let C=0,A=u.length;C<A;++C){let o=u[C];p.append(document.createTextNode(o)),C<A-1&&p.append(document.createElement("br"))}return p}#A(e){e.altKey||e.shiftKey||e.ctrlKey||e.metaKey||(e.key==="Enter"||e.key==="Escape"&&this.#c)&&this.#b()}#b(){this.#c=!this.#c,this.#c?(this.#_(),this.#i.addEventListener("click",this.#n),this.#i.addEventListener("keydown",this.#t)):(this.#E(),this.#i.removeEventListener("click",this.#n),this.#i.removeEventListener("keydown",this.#t))}#_(){this.#o||this.render(),this.isVisible?this.#c&&this.#i.classList.add("focused"):(this.#i.hidden=!1,this.#i.style.zIndex=parseInt(this.#i.style.zIndex)+1e3)}#E(){this.#i.classList.remove("focused"),!this.#c&&this.isVisible&&(this.#i.hidden=!0,this.#i.style.zIndex=parseInt(this.#i.style.zIndex)-1e3)}forceHide(){this.#m=this.isVisible,this.#m&&(this.#i.hidden=!0)}maybeShow(){this.#m&&(this.#m=!1,this.#i.hidden=!1)}get isVisible(){return this.#i.hidden===!1}}class B extends S{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0}),this.textContent=e.data.textContent,this.textPosition=e.data.textPosition,this.annotationEditorType=_.AnnotationEditorType.FREETEXT}render(){if(this.container.classList.add("freeTextAnnotation"),this.textContent){let e=document.createElement("div");e.classList.add("annotationTextContent"),e.setAttribute("role","comment");for(let a of this.textContent){let p=document.createElement("span");p.textContent=a,e.append(p)}this.container.append(e)}return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this._editOnDoubleClick(),this.container}get _isEditable(){return this.data.hasOwnCanvas}}class X extends S{#t=null;constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0})}render(){this.container.classList.add("lineAnnotation");let e=this.data,{width:a,height:p}=h(e.rect),u=this.svgFactory.create(a,p,!0),C=this.#t=this.svgFactory.createElement("svg:line");return C.setAttribute("x1",e.rect[2]-e.lineCoordinates[0]),C.setAttribute("y1",e.rect[3]-e.lineCoordinates[1]),C.setAttribute("x2",e.rect[2]-e.lineCoordinates[2]),C.setAttribute("y2",e.rect[3]-e.lineCoordinates[3]),C.setAttribute("stroke-width",e.borderStyle.width||1),C.setAttribute("stroke","transparent"),C.setAttribute("fill","transparent"),u.append(C),this.container.append(u),!e.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return this.#t}addHighlightArea(){this.container.classList.add("highlightArea")}}class Z extends S{#t=null;constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0})}render(){this.container.classList.add("squareAnnotation");let e=this.data,{width:a,height:p}=h(e.rect),u=this.svgFactory.create(a,p,!0),C=e.borderStyle.width,A=this.#t=this.svgFactory.createElement("svg:rect");return A.setAttribute("x",C/2),A.setAttribute("y",C/2),A.setAttribute("width",a-C),A.setAttribute("height",p-C),A.setAttribute("stroke-width",C||1),A.setAttribute("stroke","transparent"),A.setAttribute("fill","transparent"),u.append(A),this.container.append(u),!e.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return this.#t}addHighlightArea(){this.container.classList.add("highlightArea")}}class nt extends S{#t=null;constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0})}render(){this.container.classList.add("circleAnnotation");let e=this.data,{width:a,height:p}=h(e.rect),u=this.svgFactory.create(a,p,!0),C=e.borderStyle.width,A=this.#t=this.svgFactory.createElement("svg:ellipse");return A.setAttribute("cx",a/2),A.setAttribute("cy",p/2),A.setAttribute("rx",a/2-C/2),A.setAttribute("ry",p/2-C/2),A.setAttribute("stroke-width",C||1),A.setAttribute("stroke","transparent"),A.setAttribute("fill","transparent"),u.append(A),this.container.append(u),!e.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return this.#t}addHighlightArea(){this.container.classList.add("highlightArea")}}class G extends S{#t=null;constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0}),this.containerClassName="polylineAnnotation",this.svgElementName="svg:polyline"}render(){this.container.classList.add(this.containerClassName);let e=this.data,{width:a,height:p}=h(e.rect),u=this.svgFactory.create(a,p,!0),C=[];for(let o of e.vertices){let E=o.x-e.rect[0],P=e.rect[3]-o.y;C.push(E+","+P)}C=C.join(" ");let A=this.#t=this.svgFactory.createElement(this.svgElementName);return A.setAttribute("points",C),A.setAttribute("stroke-width",e.borderStyle.width||1),A.setAttribute("stroke","transparent"),A.setAttribute("fill","transparent"),u.append(A),this.container.append(u),!e.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return this.#t}addHighlightArea(){this.container.classList.add("highlightArea")}}class O extends G{constructor(e){super(e),this.containerClassName="polygonAnnotation",this.svgElementName="svg:polygon"}}class z extends S{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0})}render(){return this.container.classList.add("caretAnnotation"),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container}}class J extends S{#t=[];constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0}),this.containerClassName="inkAnnotation",this.svgElementName="svg:polyline",this.annotationEditorType=_.AnnotationEditorType.INK}render(){this.container.classList.add(this.containerClassName);let e=this.data,{width:a,height:p}=h(e.rect),u=this.svgFactory.create(a,p,!0);for(let C of e.inkLists){let A=[];for(let E of C){let P=E.x-e.rect[0],T=e.rect[3]-E.y;A.push(`${P},${T}`)}A=A.join(" ");let o=this.svgFactory.createElement(this.svgElementName);this.#t.push(o),o.setAttribute("points",A),o.setAttribute("stroke-width",e.borderStyle.width||1),o.setAttribute("stroke","transparent"),o.setAttribute("fill","transparent"),!e.popupRef&&this.hasPopupData&&this._createPopup(),u.append(o)}return this.container.append(u),this.container}getElementsToTriggerPopup(){return this.#t}addHighlightArea(){this.container.classList.add("highlightArea")}}class st extends S{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("highlightAnnotation"),this.container}}class et extends S{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("underlineAnnotation"),this.container}}class at extends S{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("squigglyAnnotation"),this.container}}class rt extends S{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("strikeoutAnnotation"),this.container}}class $ extends S{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0})}render(){return this.container.classList.add("stampAnnotation"),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container}}class l extends S{#t=null;constructor(e){super(e,{isRenderable:!0});let{filename:a,content:p}=this.data.file;this.filename=(0,H.getFilenameFromUrl)(a,!0),this.content=p,this.linkService.eventBus?.dispatch("fileattachmentannotation",{source:this,filename:a,content:p})}render(){this.container.classList.add("fileAttachmentAnnotation");let{container:e,data:a}=this,p;a.hasAppearance||a.fillAlpha===0?p=document.createElement("div"):(p=document.createElement("img"),p.src=`${this.imageResourcesPath}annotation-${/paperclip/i.test(a.name)?"paperclip":"pushpin"}.svg`,a.fillAlpha&&a.fillAlpha<1&&(p.style=`filter: opacity(${Math.round(100*a.fillAlpha)}%);`)),p.addEventListener("dblclick",this.#e.bind(this)),this.#t=p;let{isMac:u}=_.FeatureTest.platform;return e.addEventListener("keydown",(C=>{C.key==="Enter"&&(u?C.metaKey:C.ctrlKey)&&this.#e()})),!a.popupRef&&this.hasPopupData?this._createPopup():p.classList.add("popupTriggerArea"),e.append(p),e}getElementsToTriggerPopup(){return this.#t}addHighlightArea(){this.container.classList.add("highlightArea")}#e(){this.downloadManager?.openOrDownloadData(this.content,this.filename)}}class g{#t=null;#e=null;#s=new Map;constructor({div:e,accessibilityManager:a,annotationCanvasMap:p,page:u,viewport:C}){this.div=e,this.#t=a,this.#e=p,this.page=u,this.viewport=C,this.zIndex=0}#n(e,a){let p=e.firstChild||e;p.id=`${_.AnnotationPrefix}${a}`,this.div.append(e),this.#t?.moveElementInDOM(this.div,e,p,!1)}async render(e){let{annotations:a}=e,p=this.div;(0,H.setLayerDimensions)(p,this.viewport);let u=new Map,C={data:null,layer:p,linkService:e.linkService,downloadManager:e.downloadManager,imageResourcesPath:e.imageResourcesPath||"",renderForms:e.renderForms!==!1,svgFactory:new H.DOMSVGFactory,annotationStorage:e.annotationStorage||new N.AnnotationStorage,enableScripting:e.enableScripting===!0,hasJSActions:e.hasJSActions,fieldObjects:e.fieldObjects,parent:this,elements:null};for(let A of a){if(A.noHTML)continue;let o=A.annotationType===_.AnnotationType.POPUP;if(o){let T=u.get(A.id);if(!T)continue;C.elements=T}else{let{width:T,height:d}=h(A.rect);if(T<=0||d<=0)continue}C.data=A;let E=w.create(C);if(!E.isRenderable)continue;if(!o&&A.popupRef){let T=u.get(A.popupRef);T?T.push(E):u.set(A.popupRef,[E])}E.annotationEditorType>0&&this.#s.set(E.data.id,E);let P=E.render();A.hidden&&(P.style.visibility="hidden"),this.#n(P,A.id)}this.#a()}update({viewport:e}){let a=this.div;this.viewport=e,(0,H.setLayerDimensions)(a,{rotation:e.rotation}),this.#a(),a.hidden=!1}#a(){if(!this.#e)return;let e=this.div;for(let[a,p]of this.#e){let u=e.querySelector(`[data-annotation-id="${a}"]`);if(!u)continue;let{firstChild:C}=u;C?C.nodeName==="CANVAS"?C.replaceWith(p):C.before(p):u.append(p)}this.#e.clear()}getEditableAnnotations(){return Array.from(this.#s.values())}getEditableAnnotation(e){return this.#s.get(e)}}},792:(ot,it,j)=>{j.d(it,{AnnotationStorage:()=>F,PrintAnnotationStorage:()=>k,SerializableEmpty:()=>W});var _=j(292),H=j(310),N=j(651);let W=Object.freeze({map:null,hash:"",transfer:void 0});class F{#t=!1;#e=new Map;constructor(){this.onSetModified=null,this.onResetModified=null,this.onAnnotationEditor=null}getValue(f,i){let h=this.#e.get(f);return h===void 0?i:Object.assign(i,h)}getRawValue(f){return this.#e.get(f)}remove(f){if(this.#e.delete(f),this.#e.size===0&&this.resetModified(),typeof this.onAnnotationEditor=="function"){for(let i of this.#e.values())if(i instanceof H.AnnotationEditor)return;this.onAnnotationEditor(null)}}setValue(f,i){let h=this.#e.get(f),w=!1;if(h!==void 0)for(let[S,n]of Object.entries(i))h[S]!==n&&(w=!0,h[S]=n);else w=!0,this.#e.set(f,i);w&&this.#s(),i instanceof H.AnnotationEditor&&typeof this.onAnnotationEditor=="function"&&this.onAnnotationEditor(i.constructor._type)}has(f){return this.#e.has(f)}getAll(){return this.#e.size>0?(0,_.objectFromMap)(this.#e):null}setAll(f){for(let[i,h]of Object.entries(f))this.setValue(i,h)}get size(){return this.#e.size}#s(){this.#t||(this.#t=!0,typeof this.onSetModified=="function"&&this.onSetModified())}resetModified(){this.#t&&(this.#t=!1,typeof this.onResetModified=="function"&&this.onResetModified())}get print(){return new k(this)}get serializable(){if(this.#e.size===0)return W;let f=new Map,i=new N.MurmurHash3_64,h=[],w=Object.create(null),S=!1;for(let[n,c]of this.#e){let t=c instanceof H.AnnotationEditor?c.serialize(!1,w):c;t&&(f.set(n,t),i.update(`${n}:${JSON.stringify(t)}`),S||=!!t.bitmap)}if(S)for(let n of f.values())n.bitmap&&h.push(n.bitmap);return f.size>0?{map:f,hash:i.hexdigest(),transfer:h}:W}get editorStats(){let f=null,i=new Map;for(let h of this.#e.values()){if(!(h instanceof H.AnnotationEditor))continue;let w=h.telemetryFinalData;if(!w)continue;let{type:S}=w;i.has(S)||i.set(S,Object.getPrototypeOf(h).constructor),f||=Object.create(null);let n=f[S]||=new Map;for(let[c,t]of Object.entries(w)){if(c==="type")continue;let s=n.get(c);s||(s=new Map,n.set(c,s));let r=s.get(t)??0;s.set(t,r+1)}}for(let[h,w]of i)f[h]=w.computeTelemetryFinalData(f[h]);return f}}class k extends F{#t;constructor(f){super();let{map:i,hash:h,transfer:w}=f.serializable,S=structuredClone(i,w?{transfer:w}:null);this.#t={map:S,hash:h,transfer:w}}get print(){(0,_.unreachable)("Should not call PrintAnnotationStorage.print")}get serializable(){return this.#t}}},831:(ot,it,j)=>{j.a(ot,(async(_,H)=>{try{let nt=function(A){if(typeof A=="string"||A instanceof URL?A={url:A}:(A instanceof ArrayBuffer||ArrayBuffer.isView(A))&&(A={data:A}),typeof A!="object")throw new Error("Invalid parameter in getDocument, need parameter object.");if(!A.url&&!A.data&&!A.range)throw new Error("Invalid parameter object: need either .data, .range or .url");let o=new J,{docId:E}=o,P=A.url?O(A.url):null,T=A.data?z(A.data):null,d=A.httpHeaders||null,x=A.withCredentials===!0,D=A.password??null,U=A.range instanceof st?A.range:null,V=Number.isInteger(A.rangeChunkSize)&&A.rangeChunkSize>0?A.rangeChunkSize:b,q=A.worker instanceof l?A.worker:null,K=A.verbosity,tt=typeof A.docBaseUrl!="string"||(0,F.isDataScheme)(A.docBaseUrl)?null:A.docBaseUrl,Q=typeof A.cMapUrl=="string"?A.cMapUrl:null,Y=A.cMapPacked!==!1,ht=A.CMapReaderFactory||B,dt=typeof A.standardFontDataUrl=="string"?A.standardFontDataUrl:null,lt=A.StandardFontDataFactory||Z,ut=A.stopAtErrors!==!0,pt=Number.isInteger(A.maxImageSize)&&A.maxImageSize>-1?A.maxImageSize:-1,gt=A.isEvalSupported!==!1,ft=typeof A.isOffscreenCanvasSupported=="boolean"?A.isOffscreenCanvasSupported:!N.isNodeJS,vt=Number.isInteger(A.canvasMaxAreaInBytes)?A.canvasMaxAreaInBytes:-1,yt=typeof A.disableFontFace=="boolean"?A.disableFontFace:N.isNodeJS,xt=A.fontExtraProperties===!0,Et=A.enableXfa===!0,Ct=A.ownerDocument||globalThis.document,Mt=A.disableRange===!0,Rt=A.disableStream===!0,bt=A.disableAutoFetch===!0,At=A.pdfBug===!0,Pt=U?U.length:A.length??NaN,Nt=typeof A.useSystemFonts=="boolean"?A.useSystemFonts:!N.isNodeJS&&!yt,wt=typeof A.useWorkerFetch=="boolean"?A.useWorkerFetch:ht===F.DOMCMapReaderFactory&&lt===F.DOMStandardFontDataFactory&&Q&&dt&&(0,F.isValidFetchUrl)(Q,document.baseURI)&&(0,F.isValidFetchUrl)(dt,document.baseURI),mt=A.canvasFactory||new I({ownerDocument:Ct}),$t=A.filterFactory||new X({docId:E,ownerDocument:Ct});(0,N.setVerbosityLevel)(K);let Ot={canvasFactory:mt,filterFactory:$t};if(wt||(Ot.cMapReaderFactory=new ht({baseUrl:Q,isCompressed:Y}),Ot.standardFontDataFactory=new lt({baseUrl:dt})),!q){let kt={verbosity:K,port:h.GlobalWorkerOptions.workerPort};q=kt.port?l.fromPort(kt):new l(kt),o._worker=q}let Vt={docId:E,apiVersion:"4.1.392",data:T,password:D,disableAutoFetch:bt,rangeChunkSize:V,length:Pt,docBaseUrl:tt,enableXfa:Et,evaluatorOptions:{maxImageSize:pt,disableFontFace:yt,ignoreErrors:ut,isEvalSupported:gt,isOffscreenCanvasSupported:ft,canvasMaxAreaInBytes:vt,fontExtraProperties:xt,useSystemFonts:Nt,cMapUrl:wt?Q:null,standardFontDataUrl:wt?dt:null}},Gt={ignoreErrors:ut,isEvalSupported:gt,disableFontFace:yt,fontExtraProperties:xt,enableXfa:Et,ownerDocument:Ct,disableAutoFetch:bt,pdfBug:At,styleElement:null};return q.promise.then((function(){if(o.destroyed)throw new Error("Loading aborted");let kt=G(q,Vt),qt=new Promise((function(Bt){let Ft;U?Ft=new c.PDFDataTransportStream(U,{disableRange:Mt,disableStream:Rt}):T||(Ft=(_t=>N.isNodeJS?(function(){return typeof fetch<"u"&&typeof Response<"u"&&"body"in Response.prototype})()&&(0,F.isValidFetchUrl)(_t.url)?new t.PDFFetchStream(_t):new r.PDFNodeStream(_t):(0,F.isValidFetchUrl)(_t.url)?new t.PDFFetchStream(_t):new s.PDFNetworkStream(_t))({url:P,length:Pt,httpHeaders:d,withCredentials:x,rangeChunkSize:V,disableRange:Mt,disableStream:Rt})),Bt(Ft)}));return Promise.all([kt,qt]).then((function([Bt,Ft]){if(o.destroyed)throw new Error("Loading aborted");let _t=new w.MessageHandler(E,Bt,q.port),Wt=new g(_t,o,Ft,Gt,Ot);o._transport=Wt,_t.send("Ready",null)}))})).catch(o._capability.reject),o},O=function(A){if(A instanceof URL)return A.href;try{return new URL(A,window.location).href}catch{if(N.isNodeJS&&typeof A=="string")return A}throw new Error("Invalid PDF url data: either string or URL-object is expected in the url property.")},z=function(A){if(N.isNodeJS&&typeof Buffer<"u"&&A instanceof Buffer)throw new Error("Please provide binary data as `Uint8Array`, rather than `Buffer`.");if(A instanceof Uint8Array&&A.byteLength===A.buffer.byteLength)return A;if(typeof A=="string")return(0,N.stringToBytes)(A);if(A instanceof ArrayBuffer||ArrayBuffer.isView(A)||typeof A=="object"&&!isNaN(A?.length))return new Uint8Array(A);throw new Error("Invalid PDF binary data: either TypedArray, string, or array-like object is expected in the data property.")};j.d(it,{PDFDataRangeTransport:()=>st,PDFWorker:()=>l,build:()=>C,getDocument:()=>nt,version:()=>u});var N=j(292),W=j(792),F=j(419),k=j(10),M=j(573),f=j(923),i=j(814),h=j(164),w=j(178),S=j(62),n=j(626),c=j(585),t=j(94),s=j(457),r=j(786),m=j(50),y=_([M,r]);[M,r]=y.then?(await y)():y;let b=65536,R=100,L=5e3,I=N.isNodeJS?M.NodeCanvasFactory:F.DOMCanvasFactory,B=N.isNodeJS?M.NodeCMapReaderFactory:F.DOMCMapReaderFactory,X=N.isNodeJS?M.NodeFilterFactory:F.DOMFilterFactory,Z=N.isNodeJS?M.NodeStandardFontDataFactory:F.DOMStandardFontDataFactory;async function G(A,o){if(A.destroyed)throw new Error("Worker was destroyed");let E=await A.messageHandler.sendWithPromise("GetDocRequest",o,o.data?[o.data.buffer]:null);if(A.destroyed)throw new Error("Worker was destroyed");return E}class J{static#t=0;constructor(){this._capability=Promise.withResolvers(),this._transport=null,this._worker=null,this.docId="d"+J.#t++,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(o){throw this._worker?.port&&delete this._worker._pendingDestroy,o}this._transport=null,this._worker&&(this._worker.destroy(),this._worker=null)}}class st{constructor(o,E,P=!1,T=null){this.length=o,this.initialData=E,this.progressiveDone=P,this.contentDispositionFilename=T,this._rangeListeners=[],this._progressListeners=[],this._progressiveReadListeners=[],this._progressiveDoneListeners=[],this._readyCapability=Promise.withResolvers()}addRangeListener(o){this._rangeListeners.push(o)}addProgressListener(o){this._progressListeners.push(o)}addProgressiveReadListener(o){this._progressiveReadListeners.push(o)}addProgressiveDoneListener(o){this._progressiveDoneListeners.push(o)}onDataRange(o,E){for(let P of this._rangeListeners)P(o,E)}onDataProgress(o,E){this._readyCapability.promise.then((()=>{for(let P of this._progressListeners)P(o,E)}))}onDataProgressiveRead(o){this._readyCapability.promise.then((()=>{for(let E of this._progressiveReadListeners)E(o)}))}onDataProgressiveDone(){this._readyCapability.promise.then((()=>{for(let o of this._progressiveDoneListeners)o()}))}transportReady(){this._readyCapability.resolve()}requestDataRange(o,E){(0,N.unreachable)("Abstract method PDFDataRangeTransport.requestDataRange")}abort(){}}class et{constructor(o,E){this._pdfInfo=o,this._transport=E}get annotationStorage(){return this._transport.annotationStorage}get filterFactory(){return this._transport.filterFactory}get numPages(){return this._pdfInfo.numPages}get fingerprints(){return this._pdfInfo.fingerprints}get isPureXfa(){return(0,N.shadow)(this,"isPureXfa",!!this._transport._htmlForXfa)}get allXfaHtml(){return this._transport._htmlForXfa}getPage(o){return this._transport.getPage(o)}getPageIndex(o){return this._transport.getPageIndex(o)}getDestinations(){return this._transport.getDestinations()}getDestination(o){return this._transport.getDestination(o)}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({intent:o="display"}={}){let{renderingIntent:E}=this._transport.getRenderingIntent(o);return this._transport.getOptionalContentConfig(E)}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(o=!1){return this._transport.startCleanup(o||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()}}class at{#t=null;#e=!1;constructor(o,E,P,T=!1){this._pageIndex=o,this._pageInfo=E,this._transport=P,this._stats=T?new F.StatTimer:null,this._pdfBug=T,this.commonObjs=P.commonObjs,this.objs=new e,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:o,rotation:E=this.rotate,offsetX:P=0,offsetY:T=0,dontFlip:d=!1}={}){return new F.PageViewport({viewBox:this.view,scale:o,rotation:E,offsetX:P,offsetY:T,dontFlip:d})}getAnnotations({intent:o="display"}={}){let{renderingIntent:E}=this._transport.getRenderingIntent(o);return this._transport.getAnnotations(this._pageIndex,E)}getJSActions(){return this._transport.getPageJSActions(this._pageIndex)}get filterFactory(){return this._transport.filterFactory}get isPureXfa(){return(0,N.shadow)(this,"isPureXfa",!!this._transport._htmlForXfa)}async getXfa(){return this._transport._htmlForXfa?.children[this._pageIndex]||null}render({canvasContext:o,viewport:E,intent:P="display",annotationMode:T=N.AnnotationMode.ENABLE,transform:d=null,background:x=null,optionalContentConfigPromise:D=null,annotationCanvasMap:U=null,pageColors:V=null,printAnnotationStorage:q=null}){this._stats?.time("Overall");let K=this._transport.getRenderingIntent(P,T,q),{renderingIntent:tt,cacheKey:Q}=K;this.#e=!1,this.#n(),D||=this._transport.getOptionalContentConfig(tt);let Y=this._intentStates.get(Q);Y||(Y=Object.create(null),this._intentStates.set(Q,Y)),Y.streamReaderCancelTimeout&&(clearTimeout(Y.streamReaderCancelTimeout),Y.streamReaderCancelTimeout=null);let ht=!!(tt&N.RenderingIntentFlag.PRINT);Y.displayReadyCapability||(Y.displayReadyCapability=Promise.withResolvers(),Y.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},this._stats?.time("Page Request"),this._pumpOperatorList(K));let dt=pt=>{Y.renderTasks.delete(lt),(this._maybeCleanupAfterRender||ht)&&(this.#e=!0),this.#s(!ht),pt?(lt.capability.reject(pt),this._abortOperatorList({intentState:Y,reason:pt instanceof Error?pt:new Error(pt)})):lt.capability.resolve(),this._stats?.timeEnd("Rendering"),this._stats?.timeEnd("Overall")},lt=new p({callback:dt,params:{canvasContext:o,viewport:E,transform:d,background:x},objs:this.objs,commonObjs:this.commonObjs,annotationCanvasMap:U,operatorList:Y.operatorList,pageIndex:this._pageIndex,canvasFactory:this._transport.canvasFactory,filterFactory:this._transport.filterFactory,useRequestAnimationFrame:!ht,pdfBug:this._pdfBug,pageColors:V});(Y.renderTasks||=new Set).add(lt);let ut=lt.task;return Promise.all([Y.displayReadyCapability.promise,D]).then((([pt,gt])=>{if(this.destroyed)dt();else{if(this._stats?.time("Rendering"),!(gt.renderingIntent&tt))throw new Error("Must use the same `intent`-argument when calling the `PDFPageProxy.render` and `PDFDocumentProxy.getOptionalContentConfig` methods.");lt.initializeGraphics({transparency:pt,optionalContentConfig:gt}),lt.operatorListChanged()}})).catch(dt),ut}getOperatorList({intent:o="display",annotationMode:E=N.AnnotationMode.ENABLE,printAnnotationStorage:P=null}={}){let T=this._transport.getRenderingIntent(o,E,P,!0),d,x=this._intentStates.get(T.cacheKey);return x||(x=Object.create(null),this._intentStates.set(T.cacheKey,x)),x.opListReadCapability||(d=Object.create(null),d.operatorListChanged=function(){x.operatorList.lastChunk&&(x.opListReadCapability.resolve(x.operatorList),x.renderTasks.delete(d))},x.opListReadCapability=Promise.withResolvers(),(x.renderTasks||=new Set).add(d),x.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},this._stats?.time("Page Request"),this._pumpOperatorList(T)),x.opListReadCapability.promise}streamTextContent({includeMarkedContent:o=!1,disableNormalization:E=!1}={}){return this._transport.messageHandler.sendWithStream("GetTextContent",{pageIndex:this._pageIndex,includeMarkedContent:o===!0,disableNormalization:E===!0},{highWaterMark:100,size:P=>P.items.length})}getTextContent(o={}){if(this._transport._htmlForXfa)return this.getXfa().then((P=>m.XfaText.textContent(P)));let E=this.streamTextContent(o);return new Promise((function(P,T){let d=E.getReader(),x={items:[],styles:Object.create(null)};(function D(){d.read().then((function({value:U,done:V}){V?P(x):(Object.assign(x.styles,U.styles),x.items.push(...U.items),D())}),T)})()}))}getStructTree(){return this._transport.getStructTree(this._pageIndex)}_destroy(){this.destroyed=!0;let o=[];for(let E of this._intentStates.values())if(this._abortOperatorList({intentState:E,reason:new Error("Page was destroyed."),force:!0}),!E.opListReadCapability)for(let P of E.renderTasks)o.push(P.completed),P.cancel();return this.objs.clear(),this.#e=!1,this.#n(),Promise.all(o)}cleanup(o=!1){this.#e=!0;let E=this.#s(!1);return o&&E&&(this._stats&&=new F.StatTimer),E}#s(o=!1){if(this.#n(),!this.#e||this.destroyed)return!1;if(o)return this.#t=setTimeout((()=>{this.#t=null,this.#s(!1)}),L),!1;for(let{renderTasks:E,operatorList:P}of this._intentStates.values())if(E.size>0||!P.lastChunk)return!1;return this._intentStates.clear(),this.objs.clear(),this.#e=!1,!0}#n(){this.#t&&(clearTimeout(this.#t),this.#t=null)}_startRenderPage(o,E){let P=this._intentStates.get(E);P&&(this._stats?.timeEnd("Page Request"),P.displayReadyCapability?.resolve(o))}_renderPageChunk(o,E){for(let P=0,T=o.length;P<T;P++)E.operatorList.fnArray.push(o.fnArray[P]),E.operatorList.argsArray.push(o.argsArray[P]);E.operatorList.lastChunk=o.lastChunk,E.operatorList.separateAnnots=o.separateAnnots;for(let P of E.renderTasks)P.operatorListChanged();o.lastChunk&&this.#s(!0)}_pumpOperatorList({renderingIntent:o,cacheKey:E,annotationStorageSerializable:P}){let{map:T,transfer:d}=P,x=this._transport.messageHandler.sendWithStream("GetOperatorList",{pageIndex:this._pageIndex,intent:o,cacheKey:E,annotationStorage:T},d).getReader(),D=this._intentStates.get(E);D.streamReader=x;let U=()=>{x.read().then((({value:V,done:q})=>{q?D.streamReader=null:this._transport.destroyed||(this._renderPageChunk(V,D),U())}),(V=>{if(D.streamReader=null,!this._transport.destroyed){if(D.operatorList){D.operatorList.lastChunk=!0;for(let q of D.renderTasks)q.operatorListChanged();this.#s(!0)}if(D.displayReadyCapability)D.displayReadyCapability.reject(V);else{if(!D.opListReadCapability)throw V;D.opListReadCapability.reject(V)}}}))};U()}_abortOperatorList({intentState:o,reason:E,force:P=!1}){if(o.streamReader){if(o.streamReaderCancelTimeout&&(clearTimeout(o.streamReaderCancelTimeout),o.streamReaderCancelTimeout=null),!P){if(o.renderTasks.size>0)return;if(E instanceof F.RenderingCancelledException){let T=R;E.extraDelay>0&&E.extraDelay<1e3&&(T+=E.extraDelay),o.streamReaderCancelTimeout=setTimeout((()=>{o.streamReaderCancelTimeout=null,this._abortOperatorList({intentState:o,reason:E,force:!0})}),T);return}}if(o.streamReader.cancel(new N.AbortException(E.message)).catch((()=>{})),o.streamReader=null,!this._transport.destroyed){for(let[T,d]of this._intentStates)if(d===o){this._intentStates.delete(T);break}this.cleanup()}}}get stats(){return this._stats}}class rt{#t=new Set;#e=Promise.resolve();postMessage(o,E){let P={data:structuredClone(o,E?{transfer:E}:null)};this.#e.then((()=>{for(let T of this.#t)T.call(this,P)}))}addEventListener(o,E){this.#t.add(E)}removeEventListener(o,E){this.#t.delete(E)}terminate(){this.#t.clear()}}let $={isWorkerDisabled:!1,fakeWorkerId:0};N.isNodeJS&&($.isWorkerDisabled=!0,h.GlobalWorkerOptions.workerSrc||="./pdf.worker.mjs"),$.isSameOrigin=function(A,o){let E;try{if(E=new URL(A),!E.origin||E.origin==="null")return!1}catch{return!1}let P=new URL(o,E);return E.origin===P.origin},$.createCDNWrapper=function(A){let o=`await import("${A}");`;return URL.createObjectURL(new Blob([o],{type:"text/javascript"}))};class l{static#t;constructor({name:o=null,port:E=null,verbosity:P=(0,N.getVerbosityLevel)()}={}){if(this.name=o,this.destroyed=!1,this.verbosity=P,this._readyCapability=Promise.withResolvers(),this._port=null,this._webWorker=null,this._messageHandler=null,E){if(l.#t?.has(E))throw new Error("Cannot use more than one PDFWorker per port.");(l.#t||=new WeakMap).set(E,this),this._initializeFromPort(E)}else this._initialize()}get promise(){return this._readyCapability.promise}get port(){return this._port}get messageHandler(){return this._messageHandler}_initializeFromPort(o){this._port=o,this._messageHandler=new w.MessageHandler("main","worker",o),this._messageHandler.on("ready",(function(){})),this._readyCapability.resolve(),this._messageHandler.send("configure",{verbosity:this.verbosity})}_initialize(){if(!$.isWorkerDisabled&&!l.#e){let{workerSrc:o}=l;try{$.isSameOrigin(window.location.href,o)||(o=$.createCDNWrapper(new URL(o,window.location).href));let E=new Worker(o,{type:"module"}),P=new w.MessageHandler("main","worker",E),T=()=>{E.removeEventListener("error",d),P.destroy(),E.terminate(),this.destroyed?this._readyCapability.reject(new Error("Worker was destroyed")):this._setupFakeWorker()},d=()=>{this._webWorker||T()};E.addEventListener("error",d),P.on("test",(D=>{E.removeEventListener("error",d),this.destroyed?T():D?(this._messageHandler=P,this._port=E,this._webWorker=E,this._readyCapability.resolve(),P.send("configure",{verbosity:this.verbosity})):(this._setupFakeWorker(),P.destroy(),E.terminate())})),P.on("ready",(D=>{if(E.removeEventListener("error",d),this.destroyed)T();else try{x()}catch{this._setupFakeWorker()}}));let x=()=>{let D=new Uint8Array;P.send("test",D,[D.buffer])};x();return}catch{(0,N.info)("The worker has been disabled.")}}this._setupFakeWorker()}_setupFakeWorker(){$.isWorkerDisabled||((0,N.warn)("Setting up fake worker."),$.isWorkerDisabled=!0),l._setupFakeWorkerGlobal.then((o=>{if(this.destroyed){this._readyCapability.reject(new Error("Worker was destroyed"));return}let E=new rt;this._port=E;let P="fake"+$.fakeWorkerId++,T=new w.MessageHandler(P+"_worker",P,E);o.setup(T,E);let d=new w.MessageHandler(P,P+"_worker",E);this._messageHandler=d,this._readyCapability.resolve(),d.send("configure",{verbosity:this.verbosity})})).catch((o=>{this._readyCapability.reject(new Error(`Setting up fake worker failed: "${o.message}".`))}))}destroy(){this.destroyed=!0,this._webWorker&&(this._webWorker.terminate(),this._webWorker=null),l.#t?.delete(this._port),this._port=null,this._messageHandler&&(this._messageHandler.destroy(),this._messageHandler=null)}static fromPort(o){if(!o?.port)throw new Error("PDFWorker.fromPort - invalid method signature.");let E=this.#t?.get(o.port);if(E){if(E._pendingDestroy)throw new Error("PDFWorker.fromPort - the worker is being destroyed.\nPlease remember to await `PDFDocumentLoadingTask.destroy()`-calls.");return E}return new l(o)}static get workerSrc(){if(h.GlobalWorkerOptions.workerSrc)return h.GlobalWorkerOptions.workerSrc;throw new Error('No "GlobalWorkerOptions.workerSrc" specified.')}static get#e(){try{return globalThis.pdfjsWorker?.WorkerMessageHandler||null}catch{return null}}static get _setupFakeWorkerGlobal(){return(0,N.shadow)(this,"_setupFakeWorkerGlobal",(async()=>this.#e?this.#e:(await import(this.workerSrc)).WorkerMessageHandler)())}}class g{#t=new Map;#e=new Map;#s=new Map;#n=null;constructor(o,E,P,T,d){this.messageHandler=o,this.loadingTask=E,this.commonObjs=new e,this.fontLoader=new k.FontLoader({ownerDocument:T.ownerDocument,styleElement:T.styleElement}),this._params=T,this.canvasFactory=d.canvasFactory,this.filterFactory=d.filterFactory,this.cMapReaderFactory=d.cMapReaderFactory,this.standardFontDataFactory=d.standardFontDataFactory,this.destroyed=!1,this.destroyCapability=null,this._networkStream=P,this._fullReader=null,this._lastProgress=null,this.downloadInfoCapability=Promise.withResolvers(),this.setupMessageHandler()}#a(o,E=null){let P=this.#t.get(o);if(P)return P;let T=this.messageHandler.sendWithPromise(o,E);return this.#t.set(o,T),T}get annotationStorage(){return(0,N.shadow)(this,"annotationStorage",new W.AnnotationStorage)}getRenderingIntent(o,E=N.AnnotationMode.ENABLE,P=null,T=!1){let d=N.RenderingIntentFlag.DISPLAY,x=W.SerializableEmpty;switch(o){case"any":d=N.RenderingIntentFlag.ANY;break;case"display":break;case"print":d=N.RenderingIntentFlag.PRINT;break;default:(0,N.warn)(`getRenderingIntent - invalid intent: ${o}`)}switch(E){case N.AnnotationMode.DISABLE:d+=N.RenderingIntentFlag.ANNOTATIONS_DISABLE;break;case N.AnnotationMode.ENABLE:break;case N.AnnotationMode.ENABLE_FORMS:d+=N.RenderingIntentFlag.ANNOTATIONS_FORMS;break;case N.AnnotationMode.ENABLE_STORAGE:d+=N.RenderingIntentFlag.ANNOTATIONS_STORAGE,x=(d&N.RenderingIntentFlag.PRINT&&P instanceof W.PrintAnnotationStorage?P:this.annotationStorage).serializable;break;default:(0,N.warn)(`getRenderingIntent - invalid annotationMode: ${E}`)}return T&&(d+=N.RenderingIntentFlag.OPLIST),{renderingIntent:d,cacheKey:`${d}_${x.hash}`,annotationStorageSerializable:x}}destroy(){if(this.destroyCapability)return this.destroyCapability.promise;this.destroyed=!0,this.destroyCapability=Promise.withResolvers(),this.#n?.reject(new Error("Worker was destroyed during onPassword callback"));let o=[];for(let P of this.#e.values())o.push(P._destroy());this.#e.clear(),this.#s.clear(),this.hasOwnProperty("annotationStorage")&&this.annotationStorage.resetModified();let E=this.messageHandler.sendWithPromise("Terminate",null);return o.push(E),Promise.all(o).then((()=>{this.commonObjs.clear(),this.fontLoader.clear(),this.#t.clear(),this.filterFactory.destroy(),(0,i.cleanupTextLayer)(),this._networkStream?.cancelAllRequests(new N.AbortException("Worker was terminated.")),this.messageHandler&&(this.messageHandler.destroy(),this.messageHandler=null),this.destroyCapability.resolve()}),this.destroyCapability.reject),this.destroyCapability.promise}setupMessageHandler(){let{messageHandler:o,loadingTask:E}=this;o.on("GetReader",((P,T)=>{(0,N.assert)(this._networkStream,"GetReader - no `IPDFStream` instance available."),this._fullReader=this._networkStream.getFullReader(),this._fullReader.onProgress=d=>{this._lastProgress={loaded:d.loaded,total:d.total}},T.onPull=()=>{this._fullReader.read().then((function({value:d,done:x}){x?T.close():((0,N.assert)(d instanceof ArrayBuffer,"GetReader - expected an ArrayBuffer."),T.enqueue(new Uint8Array(d),1,[d]))})).catch((d=>{T.error(d)}))},T.onCancel=d=>{this._fullReader.cancel(d),T.ready.catch((x=>{if(!this.destroyed)throw x}))}})),o.on("ReaderHeadersReady",(P=>{let T=Promise.withResolvers(),d=this._fullReader;return d.headersReady.then((()=>{(!d.isStreamingSupported||!d.isRangeSupported)&&(this._lastProgress&&E.onProgress?.(this._lastProgress),d.onProgress=x=>{E.onProgress?.({loaded:x.loaded,total:x.total})}),T.resolve({isStreamingSupported:d.isStreamingSupported,isRangeSupported:d.isRangeSupported,contentLength:d.contentLength})}),T.reject),T.promise})),o.on("GetRangeReader",((P,T)=>{(0,N.assert)(this._networkStream,"GetRangeReader - no `IPDFStream` instance available.");let d=this._networkStream.getRangeReader(P.begin,P.end);d?(T.onPull=()=>{d.read().then((function({value:x,done:D}){D?T.close():((0,N.assert)(x instanceof ArrayBuffer,"GetRangeReader - expected an ArrayBuffer."),T.enqueue(new Uint8Array(x),1,[x]))})).catch((x=>{T.error(x)}))},T.onCancel=x=>{d.cancel(x),T.ready.catch((D=>{if(!this.destroyed)throw D}))}):T.close()})),o.on("GetDoc",(({pdfInfo:P})=>{this._numPages=P.numPages,this._htmlForXfa=P.htmlForXfa,delete P.htmlForXfa,E._capability.resolve(new et(P,this))})),o.on("DocException",(function(P){let T;switch(P.name){case"PasswordException":T=new N.PasswordException(P.message,P.code);break;case"InvalidPDFException":T=new N.InvalidPDFException(P.message);break;case"MissingPDFException":T=new N.MissingPDFException(P.message);break;case"UnexpectedResponseException":T=new N.UnexpectedResponseException(P.message,P.status);break;case"UnknownErrorException":T=new N.UnknownErrorException(P.message,P.details);break;default:(0,N.unreachable)("DocException - expected a valid Error.")}E._capability.reject(T)})),o.on("PasswordRequest",(P=>{if(this.#n=Promise.withResolvers(),E.onPassword){let T=d=>{d instanceof Error?this.#n.reject(d):this.#n.resolve({password:d})};try{E.onPassword(T,P.code)}catch(d){this.#n.reject(d)}}else this.#n.reject(new N.PasswordException(P.message,P.code));return this.#n.promise})),o.on("DataLoaded",(P=>{E.onProgress?.({loaded:P.length,total:P.length}),this.downloadInfoCapability.resolve(P)})),o.on("StartRenderPage",(P=>{this.destroyed||this.#e.get(P.pageIndex)._startRenderPage(P.transparency,P.cacheKey)})),o.on("commonobj",(([P,T,d])=>{if(this.destroyed||this.commonObjs.has(P))return null;switch(T){case"Font":let x=this._params;if("error"in d){let q=d.error;(0,N.warn)(`Error during font loading: ${q}`),this.commonObjs.resolve(P,q);break}let D=x.pdfBug&&globalThis.FontInspector?.enabled?(q,K)=>globalThis.FontInspector.fontAdded(q,K):null,U=new k.FontFaceObject(d,{isEvalSupported:x.isEvalSupported,disableFontFace:x.disableFontFace,ignoreErrors:x.ignoreErrors,inspectFont:D});this.fontLoader.bind(U).catch((()=>o.sendWithPromise("FontFallback",{id:P}))).finally((()=>{!x.fontExtraProperties&&U.data&&(U.data=null),this.commonObjs.resolve(P,U)}));break;case"CopyLocalImage":let{imageRef:V}=d;(0,N.assert)(V,"The imageRef must be defined.");for(let q of this.#e.values())for(let[,K]of q.objs)if(K.ref===V)return K.dataLen?(this.commonObjs.resolve(P,structuredClone(K)),K.dataLen):null;break;case"FontPath":case"Image":case"Pattern":this.commonObjs.resolve(P,d);break;default:throw new Error(`Got unknown common object type ${T}`)}return null})),o.on("obj",(([P,T,d,x])=>{if(this.destroyed)return;let D=this.#e.get(T);if(!D.objs.has(P))if(D._intentStates.size!==0)switch(d){case"Image":D.objs.resolve(P,x),x?.dataLen>N.MAX_IMAGE_SIZE_TO_CACHE&&(D._maybeCleanupAfterRender=!0);break;case"Pattern":D.objs.resolve(P,x);break;default:throw new Error(`Got unknown object type ${d}`)}else x?.bitmap?.close()})),o.on("DocProgress",(P=>{this.destroyed||E.onProgress?.({loaded:P.loaded,total:P.total})})),o.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.")))),o.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,N.warn)("saveDocument called while `annotationStorage` is empty, please use the getData-method instead.");let{map:o,transfer:E}=this.annotationStorage.serializable;return this.messageHandler.sendWithPromise("SaveDocument",{isPureXfa:!!this._htmlForXfa,numPages:this._numPages,annotationStorage:o,filename:this._fullReader?.filename??null},E).finally((()=>{this.annotationStorage.resetModified()}))}getPage(o){if(!Number.isInteger(o)||o<=0||o>this._numPages)return Promise.reject(new Error("Invalid page request."));let E=o-1,P=this.#s.get(E);if(P)return P;let T=this.messageHandler.sendWithPromise("GetPage",{pageIndex:E}).then((d=>{if(this.destroyed)throw new Error("Transport destroyed");let x=new at(E,d,this,this._params.pdfBug);return this.#e.set(E,x),x}));return this.#s.set(E,T),T}getPageIndex(o){return typeof o!="object"||o===null||!Number.isInteger(o.num)||o.num<0||!Number.isInteger(o.gen)||o.gen<0?Promise.reject(new Error("Invalid pageIndex request.")):this.messageHandler.sendWithPromise("GetPageIndex",{num:o.num,gen:o.gen})}getAnnotations(o,E){return this.messageHandler.sendWithPromise("GetAnnotations",{pageIndex:o,intent:E})}getFieldObjects(){return this.#a("GetFieldObjects")}hasJSActions(){return this.#a("HasJSActions")}getCalculationOrderIds(){return this.messageHandler.sendWithPromise("GetCalculationOrderIds",null)}getDestinations(){return this.messageHandler.sendWithPromise("GetDestinations",null)}getDestination(o){return typeof o!="string"?Promise.reject(new Error("Invalid destination request.")):this.messageHandler.sendWithPromise("GetDestination",{id:o})}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.#a("GetDocJSActions")}getPageJSActions(o){return this.messageHandler.sendWithPromise("GetPageJSActions",{pageIndex:o})}getStructTree(o){return this.messageHandler.sendWithPromise("GetStructTree",{pageIndex:o})}getOutline(){return this.messageHandler.sendWithPromise("GetOutline",null)}getOptionalContentConfig(o){return this.#a("GetOptionalContentConfig").then((E=>new n.OptionalContentConfig(E,o)))}getPermissions(){return this.messageHandler.sendWithPromise("GetPermissions",null)}getMetadata(){let o="GetMetadata",E=this.#t.get(o);if(E)return E;let P=this.messageHandler.sendWithPromise(o,null).then((T=>({info:T[0],metadata:T[1]?new S.Metadata(T[1]):null,contentDispositionFilename:this._fullReader?.filename??null,contentLength:this._fullReader?.contentLength??null})));return this.#t.set(o,P),P}getMarkInfo(){return this.messageHandler.sendWithPromise("GetMarkInfo",null)}async startCleanup(o=!1){if(!this.destroyed){await this.messageHandler.sendWithPromise("Cleanup",null);for(let E of this.#e.values())if(!E.cleanup())throw new Error(`startCleanup: Page ${E.pageNumber} is currently rendering.`);this.commonObjs.clear(),o||this.fontLoader.clear(),this.#t.clear(),this.filterFactory.destroy(!0),(0,i.cleanupTextLayer)()}}get loadingParams(){let{disableAutoFetch:o,enableXfa:E}=this._params;return(0,N.shadow)(this,"loadingParams",{disableAutoFetch:o,enableXfa:E})}}let v=Symbol("INITIAL_DATA");class e{#t=Object.create(null);#e(o){return this.#t[o]||={...Promise.withResolvers(),data:v}}get(o,E=null){if(E){let T=this.#e(o);return T.promise.then((()=>E(T.data))),null}let P=this.#t[o];if(!P||P.data===v)throw new Error(`Requesting object that isn't resolved yet ${o}.`);return P.data}has(o){let E=this.#t[o];return!!E&&E.data!==v}resolve(o,E=null){let P=this.#e(o);P.data=E,P.resolve()}clear(){for(let o in this.#t){let{data:E}=this.#t[o];E?.bitmap?.close()}this.#t=Object.create(null)}*[Symbol.iterator](){for(let o in this.#t){let{data:E}=this.#t[o];E!==v&&(yield[o,E])}}}class a{#t=null;constructor(o){this.#t=o,this.onContinue=null}get promise(){return this.#t.capability.promise}cancel(o=0){this.#t.cancel(null,o)}get separateAnnots(){let{separateAnnots:o}=this.#t.operatorList;if(!o)return!1;let{annotationCanvasMap:E}=this.#t;return o.form||o.canvas&&E?.size>0}}class p{static#t=new WeakSet;constructor({callback:o,params:E,objs:P,commonObjs:T,annotationCanvasMap:d,operatorList:x,pageIndex:D,canvasFactory:U,filterFactory:V,useRequestAnimationFrame:q=!1,pdfBug:K=!1,pageColors:tt=null}){this.callback=o,this.params=E,this.objs=P,this.commonObjs=T,this.annotationCanvasMap=d,this.operatorListIdx=null,this.operatorList=x,this._pageIndex=D,this.canvasFactory=U,this.filterFactory=V,this._pdfBug=K,this.pageColors=tt,this.running=!1,this.graphicsReadyCallback=null,this.graphicsReady=!1,this._useRequestAnimationFrame=q===!0&&typeof window<"u",this.cancelled=!1,this.capability=Promise.withResolvers(),this.task=new a(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=E.canvasContext.canvas}get completed(){return this.capability.promise.catch((function(){}))}initializeGraphics({transparency:o=!1,optionalContentConfig:E}){if(this.cancelled)return;if(this._canvas){if(p.#t.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.");p.#t.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());let{canvasContext:P,viewport:T,transform:d,background:x}=this.params;this.gfx=new f.CanvasGraphics(P,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:E},this.annotationCanvasMap,this.pageColors),this.gfx.beginDrawing({transform:d,viewport:T,transparency:o,background:x}),this.operatorListIdx=0,this.graphicsReady=!0,this.graphicsReadyCallback?.()}cancel(o=null,E=0){this.running=!1,this.cancelled=!0,this.gfx?.endDrawing(),p.#t.delete(this._canvas),this.callback(o||new F.RenderingCancelledException(`Rendering cancelled, page ${this._pageIndex+1}`,E))}operatorListChanged(){this.graphicsReady?(this.stepper?.updateOperatorList(this.operatorList),this.running||this._continue()):this.graphicsReadyCallback||=this._continueBound}_continue(){this.running=!0,this.cancelled||(this.task.onContinue?this.task.onContinue(this._scheduleNextBound):this._scheduleNext())}_scheduleNext(){this._useRequestAnimationFrame?window.requestAnimationFrame((()=>{this._nextBound().catch(this._cancelBound)})):Promise.resolve().then(this._nextBound).catch(this._cancelBound)}async _next(){this.cancelled||(this.operatorListIdx=this.gfx.executeOperatorList(this.operatorList,this.operatorListIdx,this._continueBound,this.stepper),this.operatorListIdx===this.operatorList.argsArray.length&&(this.running=!1,this.operatorList.lastChunk&&(this.gfx.endDrawing(),p.#t.delete(this._canvas),this.callback())))}}let u="4.1.392",C="fcb76a78d";H()}catch(b){H(b)}}))},583:(ot,it,j)=>{j.d(it,{BaseCMapReaderFactory:()=>W,BaseCanvasFactory:()=>N,BaseFilterFactory:()=>H,BaseSVGFactory:()=>k,BaseStandardFontDataFactory:()=>F});var _=j(292);class H{constructor(){this.constructor===H&&(0,_.unreachable)("Cannot initialize BaseFilterFactory.")}addFilter(f){return"none"}addHCMFilter(f,i){return"none"}addHighlightHCMFilter(f,i,h,w,S){return"none"}destroy(f=!1){}}class N{constructor(){this.constructor===N&&(0,_.unreachable)("Cannot initialize BaseCanvasFactory.")}create(f,i){if(f<=0||i<=0)throw new Error("Invalid canvas size");let h=this._createCanvas(f,i);return{canvas:h,context:h.getContext("2d")}}reset(f,i,h){if(!f.canvas)throw new Error("Canvas is not specified");if(i<=0||h<=0)throw new Error("Invalid canvas size");f.canvas.width=i,f.canvas.height=h}destroy(f){if(!f.canvas)throw new Error("Canvas is not specified");f.canvas.width=0,f.canvas.height=0,f.canvas=null,f.context=null}_createCanvas(f,i){(0,_.unreachable)("Abstract method `_createCanvas` called.")}}class W{constructor({baseUrl:f=null,isCompressed:i=!0}){this.constructor===W&&(0,_.unreachable)("Cannot initialize BaseCMapReaderFactory."),this.baseUrl=f,this.isCompressed=i}async fetch({name:f}){if(!this.baseUrl)throw new Error('The CMap "baseUrl" parameter must be specified, ensure that the "cMapUrl" and "cMapPacked" API parameters are provided.');if(!f)throw new Error("CMap name must be specified.");let i=this.baseUrl+f+(this.isCompressed?".bcmap":""),h=this.isCompressed?_.CMapCompressionType.BINARY:_.CMapCompressionType.NONE;return this._fetchData(i,h).catch((w=>{throw new Error(`Unable to load ${this.isCompressed?"binary ":""}CMap at: ${i}`)}))}_fetchData(f,i){(0,_.unreachable)("Abstract method `_fetchData` called.")}}class F{constructor({baseUrl:f=null}){this.constructor===F&&(0,_.unreachable)("Cannot initialize BaseStandardFontDataFactory."),this.baseUrl=f}async fetch({filename:f}){if(!this.baseUrl)throw new Error('The standard font "baseUrl" parameter must be specified, ensure that the "standardFontDataUrl" API parameter is provided.');if(!f)throw new Error("Font filename must be specified.");let i=`${this.baseUrl}${f}`;return this._fetchData(i).catch((h=>{throw new Error(`Unable to load font data at: ${i}`)}))}_fetchData(f){(0,_.unreachable)("Abstract method `_fetchData` called.")}}class k{constructor(){this.constructor===k&&(0,_.unreachable)("Cannot initialize BaseSVGFactory.")}create(f,i,h=!1){if(f<=0||i<=0)throw new Error("Invalid SVG dimensions");let w=this._createSVG("svg:svg");return w.setAttribute("version","1.1"),h||(w.setAttribute("width",`${f}px`),w.setAttribute("height",`${i}px`)),w.setAttribute("preserveAspectRatio","none"),w.setAttribute("viewBox",`0 0 ${f} ${i}`),w}createElement(f){if(typeof f!="string")throw new Error("Invalid SVG element type");return this._createSVG(f)}_createSVG(f){(0,_.unreachable)("Abstract method `_createSVG` called.")}}},923:(ot,it,j)=>{j.d(it,{CanvasGraphics:()=>rt});var _=j(292),H=j(419);let N="Fill",W="Stroke",F="Shading";function k($,l){if(!l)return;let g=l[2]-l[0],v=l[3]-l[1],e=new Path2D;e.rect(l[0],l[1],g,v),$.clip(e)}class M{constructor(){this.constructor===M&&(0,_.unreachable)("Cannot initialize BaseShadingPattern.")}getPattern(){(0,_.unreachable)("Abstract method `getPattern` called.")}}class f extends M{constructor(l){super(),this._type=l[1],this._bbox=l[2],this._colorStops=l[3],this._p0=l[4],this._p1=l[5],this._r0=l[6],this._r1=l[7],this.matrix=null}_createGradient(l){let g;this._type==="axial"?g=l.createLinearGradient(this._p0[0],this._p0[1],this._p1[0],this._p1[1]):this._type==="radial"&&(g=l.createRadialGradient(this._p0[0],this._p0[1],this._r0,this._p1[0],this._p1[1],this._r1));for(let v of this._colorStops)g.addColorStop(v[0],v[1]);return g}getPattern(l,g,v,e){let a;if(e===W||e===N){let p=g.current.getClippedPathBoundingBox(e,(0,H.getCurrentTransform)(l))||[0,0,0,0],u=Math.ceil(p[2]-p[0])||1,C=Math.ceil(p[3]-p[1])||1,A=g.cachedCanvases.getCanvas("pattern",u,C,!0),o=A.context;o.clearRect(0,0,o.canvas.width,o.canvas.height),o.beginPath(),o.rect(0,0,o.canvas.width,o.canvas.height),o.translate(-p[0],-p[1]),v=_.Util.transform(v,[1,0,0,1,p[0],p[1]]),o.transform(...g.baseTransform),this.matrix&&o.transform(...this.matrix),k(o,this._bbox),o.fillStyle=this._createGradient(o),o.fill(),a=l.createPattern(A.canvas,"no-repeat");let E=new DOMMatrix(v);a.setTransform(E)}else k(l,this._bbox),a=this._createGradient(l);return a}}function i($,l,g,v,e,a,p,u){let C=l.coords,A=l.colors,o=$.data,E=4*$.width,P;C[g+1]>C[v+1]&&(P=g,g=v,v=P,P=a,a=p,p=P),C[v+1]>C[e+1]&&(P=v,v=e,e=P,P=p,p=u,u=P),C[g+1]>C[v+1]&&(P=g,g=v,v=P,P=a,a=p,p=P);let T=(C[g]+l.offsetX)*l.scaleX,d=(C[g+1]+l.offsetY)*l.scaleY,x=(C[v]+l.offsetX)*l.scaleX,D=(C[v+1]+l.offsetY)*l.scaleY,U=(C[e]+l.offsetX)*l.scaleX,V=(C[e+1]+l.offsetY)*l.scaleY;if(d>=V)return;let q=A[a],K=A[a+1],tt=A[a+2],Q=A[p],Y=A[p+1],ht=A[p+2],dt=A[u],lt=A[u+1],ut=A[u+2],pt=Math.round(d),gt=Math.round(V),ft,vt,yt,xt,Et,Ct,Mt,Rt;for(let bt=pt;bt<=gt;bt++){if(bt<D){let mt=bt<d?0:(d-bt)/(d-D);ft=T-(T-x)*mt,vt=q-(q-Q)*mt,yt=K-(K-Y)*mt,xt=tt-(tt-ht)*mt}else{let mt;mt=bt>V?1:D===V?0:(D-bt)/(D-V),ft=x-(x-U)*mt,vt=Q-(Q-dt)*mt,yt=Y-(Y-lt)*mt,xt=ht-(ht-ut)*mt}let At;At=bt<d?0:bt>V?1:(d-bt)/(d-V),Et=T-(T-U)*At,Ct=q-(q-dt)*At,Mt=K-(K-lt)*At,Rt=tt-(tt-ut)*At;let Pt=Math.round(Math.min(ft,Et)),Nt=Math.round(Math.max(ft,Et)),wt=E*bt+4*Pt;for(let mt=Pt;mt<=Nt;mt++)At=(ft-mt)/(ft-Et),At<0?At=0:At>1&&(At=1),o[wt++]=vt-(vt-Ct)*At|0,o[wt++]=yt-(yt-Mt)*At|0,o[wt++]=xt-(xt-Rt)*At|0,o[wt++]=255}}function h($,l,g){let v=l.coords,e=l.colors,a,p;switch(l.type){case"lattice":let u=l.verticesPerRow,C=Math.floor(v.length/u)-1,A=u-1;for(a=0;a<C;a++){let o=a*u;for(let E=0;E<A;E++,o++)i($,g,v[o],v[o+1],v[o+u],e[o],e[o+1],e[o+u]),i($,g,v[o+u+1],v[o+1],v[o+u],e[o+u+1],e[o+1],e[o+u])}break;case"triangles":for(a=0,p=v.length;a<p;a+=3)i($,g,v[a],v[a+1],v[a+2],e[a],e[a+1],e[a+2]);break;default:throw new Error("illegal figure")}}class w extends M{constructor(l){super(),this._coords=l[2],this._colors=l[3],this._figures=l[4],this._bounds=l[5],this._bbox=l[7],this._background=l[8],this.matrix=null}_createMeshCanvas(l,g,v){let e=Math.floor(this._bounds[0]),a=Math.floor(this._bounds[1]),p=Math.ceil(this._bounds[2])-e,u=Math.ceil(this._bounds[3])-a,C=Math.min(Math.ceil(Math.abs(p*l[0]*1.1)),3e3),A=Math.min(Math.ceil(Math.abs(u*l[1]*1.1)),3e3),o=p/C,E=u/A,P={coords:this._coords,colors:this._colors,offsetX:-e,offsetY:-a,scaleX:1/o,scaleY:1/E},T=C+4,d=A+4,x=v.getCanvas("mesh",T,d,!1),D=x.context,U=D.createImageData(C,A);if(g){let V=U.data;for(let q=0,K=V.length;q<K;q+=4)V[q]=g[0],V[q+1]=g[1],V[q+2]=g[2],V[q+3]=255}for(let V of this._figures)h(U,V,P);return D.putImageData(U,2,2),{canvas:x.canvas,offsetX:e-2*o,offsetY:a-2*E,scaleX:o,scaleY:E}}getPattern(l,g,v,e){k(l,this._bbox);let a;if(e===F)a=_.Util.singularValueDecompose2dScale((0,H.getCurrentTransform)(l));else if(a=_.Util.singularValueDecompose2dScale(g.baseTransform),this.matrix){let u=_.Util.singularValueDecompose2dScale(this.matrix);a=[a[0]*u[0],a[1]*u[1]]}let p=this._createMeshCanvas(a,e===F?null:this._background,g.cachedCanvases);return e!==F&&(l.setTransform(...g.baseTransform),this.matrix&&l.transform(...this.matrix)),l.translate(p.offsetX,p.offsetY),l.scale(p.scaleX,p.scaleY),l.createPattern(p.canvas,"no-repeat")}}class S extends M{getPattern(){return"hotpink"}}let n=1,c=2;class t{static MAX_PATTERN_SIZE=3e3;constructor(l,g,v,e,a){this.operatorList=l[2],this.matrix=l[3]||[1,0,0,1,0,0],this.bbox=l[4],this.xstep=l[5],this.ystep=l[6],this.paintType=l[7],this.tilingType=l[8],this.color=g,this.ctx=v,this.canvasGraphicsFactory=e,this.baseTransform=a}createPatternCanvas(l){let g=this.operatorList,v=this.bbox,e=this.xstep,a=this.ystep,p=this.paintType,u=this.tilingType,C=this.color,A=this.canvasGraphicsFactory;(0,_.info)("TilingType: "+u);let o=v[0],E=v[1],P=v[2],T=v[3],d=_.Util.singularValueDecompose2dScale(this.matrix),x=_.Util.singularValueDecompose2dScale(this.baseTransform),D=[d[0]*x[0],d[1]*x[1]],U=this.getSizeAndScale(e,this.ctx.canvas.width,D[0]),V=this.getSizeAndScale(a,this.ctx.canvas.height,D[1]),q=l.cachedCanvases.getCanvas("pattern",U.size,V.size,!0),K=q.context,tt=A.createCanvasGraphics(K);tt.groupLevel=l.groupLevel,this.setFillAndStrokeStyleToContext(tt,p,C);let Q=o,Y=E,ht=P,dt=T;return o<0&&(Q=0,ht+=Math.abs(o)),E<0&&(Y=0,dt+=Math.abs(E)),K.translate(-U.scale*Q,-V.scale*Y),tt.transform(U.scale,0,0,V.scale,0,0),K.save(),this.clipBbox(tt,Q,Y,ht,dt),tt.baseTransform=(0,H.getCurrentTransform)(tt.ctx),tt.executeOperatorList(g),tt.endDrawing(),{canvas:q.canvas,scaleX:U.scale,scaleY:V.scale,offsetX:Q,offsetY:Y}}getSizeAndScale(l,g,v){l=Math.abs(l);let e=Math.max(t.MAX_PATTERN_SIZE,g),a=Math.ceil(l*v);return a>=e?a=e:v=a/l,{scale:v,size:a}}clipBbox(l,g,v,e,a){let p=e-g,u=a-v;l.ctx.rect(g,v,p,u),l.current.updateRectMinMax((0,H.getCurrentTransform)(l.ctx),[g,v,e,a]),l.clip(),l.endPath()}setFillAndStrokeStyleToContext(l,g,v){let e=l.ctx,a=l.current;switch(g){case n:let p=this.ctx;e.fillStyle=p.fillStyle,e.strokeStyle=p.strokeStyle,a.fillColor=p.fillStyle,a.strokeColor=p.strokeStyle;break;case c:let u=_.Util.makeHexColor(v[0],v[1],v[2]);e.fillStyle=u,e.strokeStyle=u,a.fillColor=u,a.strokeColor=u;break;default:throw new _.FormatError(`Unsupported paint type: ${g}`)}}getPattern(l,g,v,e){let a=v;e!==F&&(a=_.Util.transform(a,g.baseTransform),this.matrix&&(a=_.Util.transform(a,this.matrix)));let p=this.createPatternCanvas(g),u=new DOMMatrix(a);u=u.translate(p.offsetX,p.offsetY),u=u.scale(1/p.scaleX,1/p.scaleY);let C=l.createPattern(p.canvas,"repeat");return C.setTransform(u),C}}function s({src:$,srcPos:l=0,dest:g,width:v,height:e,nonBlackColor:a=4294967295,inverseDecode:p=!1}){let u=_.FeatureTest.isLittleEndian?4278190080:255,[C,A]=p?[a,u]:[u,a],o=v>>3,E=7&v,P=$.length;g=new Uint32Array(g.buffer);let T=0;for(let d=0;d<e;d++){for(let D=l+o;l<D;l++){let U=l<P?$[l]:255;g[T++]=128&U?A:C,g[T++]=64&U?A:C,g[T++]=32&U?A:C,g[T++]=16&U?A:C,g[T++]=8&U?A:C,g[T++]=4&U?A:C,g[T++]=2&U?A:C,g[T++]=1&U?A:C}if(E===0)continue;let x=l<P?$[l++]:255;for(let D=0;D<E;D++)g[T++]=x&1<<7-D?A:C}return{srcPos:l,destPos:T}}let r=4096,m=16;class y{constructor(l){this.canvasFactory=l,this.cache=Object.create(null)}getCanvas(l,g,v){let e;return this.cache[l]!==void 0?(e=this.cache[l],this.canvasFactory.reset(e,g,v)):(e=this.canvasFactory.create(g,v),this.cache[l]=e),e}delete(l){delete this.cache[l]}clear(){for(let l in this.cache){let g=this.cache[l];this.canvasFactory.destroy(g),delete this.cache[l]}}}function b($,l,g,v,e,a,p,u,C,A){let[o,E,P,T,d,x]=(0,H.getCurrentTransform)($);if(E===0&&P===0){let D=p*o+d,U=Math.round(D),V=u*T+x,q=Math.round(V),K=(p+C)*o+d,tt=Math.abs(Math.round(K)-U)||1,Q=(u+A)*T+x,Y=Math.abs(Math.round(Q)-q)||1;return $.setTransform(Math.sign(o),0,0,Math.sign(T),U,q),$.drawImage(l,g,v,e,a,0,0,tt,Y),$.setTransform(o,E,P,T,d,x),[tt,Y]}if(o===0&&T===0){let D=u*P+d,U=Math.round(D),V=p*E+x,q=Math.round(V),K=(u+A)*P+d,tt=Math.abs(Math.round(K)-U)||1,Q=(p+C)*E+x,Y=Math.abs(Math.round(Q)-q)||1;return $.setTransform(0,Math.sign(E),Math.sign(P),0,U,q),$.drawImage(l,g,v,e,a,0,0,Y,tt),$.setTransform(o,E,P,T,d,x),[Y,tt]}return $.drawImage(l,g,v,e,a,p,u,C,A),[Math.hypot(o,E)*C,Math.hypot(P,T)*A]}class R{constructor(l,g){this.alphaIsShape=!1,this.fontSize=0,this.fontSizeScale=1,this.textMatrix=_.IDENTITY_MATRIX,this.textMatrixScale=1,this.fontMatrix=_.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=_.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,l,g])}clone(){let l=Object.create(this);return l.clipBox=this.clipBox.slice(),l}setCurrentPoint(l,g){this.x=l,this.y=g}updatePathMinMax(l,g,v){[g,v]=_.Util.applyTransform([g,v],l),this.minX=Math.min(this.minX,g),this.minY=Math.min(this.minY,v),this.maxX=Math.max(this.maxX,g),this.maxY=Math.max(this.maxY,v)}updateRectMinMax(l,g){let v=_.Util.applyTransform(g,l),e=_.Util.applyTransform(g.slice(2),l),a=_.Util.applyTransform([g[0],g[3]],l),p=_.Util.applyTransform([g[2],g[1]],l);this.minX=Math.min(this.minX,v[0],e[0],a[0],p[0]),this.minY=Math.min(this.minY,v[1],e[1],a[1],p[1]),this.maxX=Math.max(this.maxX,v[0],e[0],a[0],p[0]),this.maxY=Math.max(this.maxY,v[1],e[1],a[1],p[1])}updateScalingPathMinMax(l,g){_.Util.scaleMinMax(l,g),this.minX=Math.min(this.minX,g[0]),this.minY=Math.min(this.minY,g[1]),this.maxX=Math.max(this.maxX,g[2]),this.maxY=Math.max(this.maxY,g[3])}updateCurvePathMinMax(l,g,v,e,a,p,u,C,A,o){let E=_.Util.bezierBoundingBox(g,v,e,a,p,u,C,A,o);o||this.updateRectMinMax(l,E)}getPathBoundingBox(l=N,g=null){let v=[this.minX,this.minY,this.maxX,this.maxY];if(l===W){g||(0,_.unreachable)("Stroke bounding box must include transform.");let e=_.Util.singularValueDecompose2dScale(g),a=e[0]*this.lineWidth/2,p=e[1]*this.lineWidth/2;v[0]-=a,v[1]-=p,v[2]+=a,v[3]+=p}return v}updateClipFromPath(){let l=_.Util.intersect(this.clipBox,this.getPathBoundingBox());this.startNewPathAndClipBox(l||[0,0,0,0])}isEmptyClip(){return this.minX===1/0}startNewPathAndClipBox(l){this.clipBox=l,this.minX=1/0,this.minY=1/0,this.maxX=0,this.maxY=0}getClippedPathBoundingBox(l=N,g=null){return _.Util.intersect(this.clipBox,this.getPathBoundingBox(l,g))}}function L($,l){if(typeof ImageData<"u"&&l instanceof ImageData){$.putImageData(l,0,0);return}let g=l.height,v=l.width,e=g%m,a=(g-e)/m,p=e===0?a:a+1,u=$.createImageData(v,m),C,A=0,o=l.data,E=u.data,P,T,d,x;if(l.kind===_.ImageKind.GRAYSCALE_1BPP){let D=o.byteLength,U=new Uint32Array(E.buffer,0,E.byteLength>>2),V=U.length,q=v+7>>3,K=4294967295,tt=_.FeatureTest.isLittleEndian?4278190080:255;for(P=0;P<p;P++){for(d=P<a?m:e,C=0,T=0;T<d;T++){let Q=D-A,Y=0,ht=Q>q?v:8*Q-7,dt=-8&ht,lt=0,ut=0;for(;Y<dt;Y+=8)ut=o[A++],U[C++]=128&ut?K:tt,U[C++]=64&ut?K:tt,U[C++]=32&ut?K:tt,U[C++]=16&ut?K:tt,U[C++]=8&ut?K:tt,U[C++]=4&ut?K:tt,U[C++]=2&ut?K:tt,U[C++]=1&ut?K:tt;for(;Y<ht;Y++)lt===0&&(ut=o[A++],lt=128),U[C++]=ut&lt?K:tt,lt>>=1}for(;C<V;)U[C++]=0;$.putImageData(u,0,P*m)}}else if(l.kind===_.ImageKind.RGBA_32BPP){for(T=0,x=v*m*4,P=0;P<a;P++)E.set(o.subarray(A,A+x)),A+=x,$.putImageData(u,0,T),T+=m;P<p&&(x=v*e*4,E.set(o.subarray(A,A+x)),$.putImageData(u,0,T))}else{if(l.kind!==_.ImageKind.RGB_24BPP)throw new Error(`bad image kind: ${l.kind}`);for(d=m,x=v*d,P=0;P<p;P++){for(P>=a&&(d=e,x=v*d),C=0,T=x;T--;)E[C++]=o[A++],E[C++]=o[A++],E[C++]=o[A++],E[C++]=255;$.putImageData(u,0,P*m)}}}function I($,l){if(l.bitmap){$.drawImage(l.bitmap,0,0);return}let g=l.height,v=l.width,e=g%m,a=(g-e)/m,p=e===0?a:a+1,u=$.createImageData(v,m),C=0,A=l.data,o=u.data;for(let E=0;E<p;E++){let P=E<a?m:e;({srcPos:C}=s({src:A,srcPos:C,dest:o,width:v,height:P,nonBlackColor:0})),$.putImageData(u,0,E*m)}}function B($,l){let g=["strokeStyle","fillStyle","fillRule","globalAlpha","lineWidth","lineCap","lineJoin","miterLimit","globalCompositeOperation","font","filter"];for(let v of g)$[v]!==void 0&&(l[v]=$[v]);$.setLineDash!==void 0&&(l.setLineDash($.getLineDash()),l.lineDashOffset=$.lineDashOffset)}function X($){if($.strokeStyle=$.fillStyle="#000000",$.fillRule="nonzero",$.globalAlpha=1,$.lineWidth=1,$.lineCap="butt",$.lineJoin="miter",$.miterLimit=10,$.globalCompositeOperation="source-over",$.font="10px sans-serif",$.setLineDash!==void 0&&($.setLineDash([]),$.lineDashOffset=0),!_.isNodeJS){let{filter:l}=$;l!=="none"&&l!==""&&($.filter="none")}}function Z($,l,g,v){let e=$.length;for(let a=3;a<e;a+=4){let p=$[a];if(p===0)$[a-3]=l,$[a-2]=g,$[a-1]=v;else if(p<255){let u=255-p;$[a-3]=$[a-3]*p+l*u>>8,$[a-2]=$[a-2]*p+g*u>>8,$[a-1]=$[a-1]*p+v*u>>8}}}function nt($,l,g){let v=$.length;for(let e=3;e<v;e+=4){let a=g?g[$[e]]:$[e];l[e]=l[e]*a*.00392156862745098|0}}function G($,l,g){let v=$.length;for(let e=3;e<v;e+=4){let a=77*$[e-3]+152*$[e-2]+28*$[e-1];l[e]=g?l[e]*g[a>>8]>>8:l[e]*a>>16}}function O($,l,g,v){let e=v[0],a=v[1],p=v[2]-e,u=v[3]-a;p!==0&&u!==0&&((function(A,o,E,P,T,d,x,D,U,V,q){let K=!!d,tt=K?d[0]:0,Q=K?d[1]:0,Y=K?d[2]:0,ht=T==="Luminosity"?G:nt,dt=Math.min(P,Math.ceil(1048576/E));for(let lt=0;lt<P;lt+=dt){let ut=Math.min(dt,P-lt),pt=A.getImageData(D-V,lt+(U-q),E,ut),gt=o.getImageData(D,lt+U,E,ut);K&&Z(pt.data,tt,Q,Y),ht(pt.data,gt.data,x),o.putImageData(gt,D,lt+U)}})(l.context,g,p,u,l.subtype,l.backdrop,l.transferMap,e,a,l.offsetX,l.offsetY),$.save(),$.globalAlpha=1,$.globalCompositeOperation="source-over",$.setTransform(1,0,0,1,0,0),$.drawImage(g.canvas,0,0),$.restore())}function z($,l){let g=_.Util.singularValueDecompose2dScale($);g[0]=Math.fround(g[0]),g[1]=Math.fround(g[1]);let v=Math.fround((globalThis.devicePixelRatio||1)*H.PixelsPerInch.PDF_TO_CSS_UNITS);return l!==void 0?l:g[0]<=v||g[1]<=v}let J=["butt","round","square"],st=["miter","round","bevel"],et={},at={};class rt{constructor(l,g,v,e,a,{optionalContentConfig:p,markedContentStack:u=null},C,A){this.ctx=l,this.current=new R(this.ctx.canvas.width,this.ctx.canvas.height),this.stateStack=[],this.pendingClip=null,this.pendingEOFill=!1,this.res=null,this.xobjs=null,this.commonObjs=g,this.objs=v,this.canvasFactory=e,this.filterFactory=a,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=u||[],this.optionalContentConfig=p,this.cachedCanvases=new y(this.canvasFactory),this.cachedPatterns=new Map,this.annotationCanvasMap=C,this.viewportScale=1,this.outputScaleX=1,this.outputScaleY=1,this.pageColors=A,this._cachedScaleForStroking=[-1,0],this._cachedGetSinglePixelWidth=null,this._cachedBitmapsMap=new Map}getObject(l,g=null){return typeof l=="string"?l.startsWith("g_")?this.commonObjs.get(l):this.objs.get(l):g}beginDrawing({transform:l,viewport:g,transparency:v=!1,background:e=null}){let a=this.ctx.canvas.width,p=this.ctx.canvas.height,u=this.ctx.fillStyle;if(this.ctx.fillStyle=e||"#ffffff",this.ctx.fillRect(0,0,a,p),this.ctx.fillStyle=u,v){let C=this.cachedCanvases.getCanvas("transparent",a,p);this.compositeCtx=this.ctx,this.transparentCanvas=C.canvas,this.ctx=C.context,this.ctx.save(),this.ctx.transform(...(0,H.getCurrentTransform)(this.compositeCtx))}this.ctx.save(),X(this.ctx),l&&(this.ctx.transform(...l),this.outputScaleX=l[0],this.outputScaleY=l[0]),this.ctx.transform(...g.transform),this.viewportScale=g.scale,this.baseTransform=(0,H.getCurrentTransform)(this.ctx)}executeOperatorList(l,g,v,e){let a=l.argsArray,p=l.fnArray,u=g||0,C=a.length;if(C===u)return u;let A=C-u>10&&typeof v=="function",o=A?Date.now()+15:0,E=0,P=this.commonObjs,T=this.objs,d;for(;;){if(e!==void 0&&u===e.nextBreakPoint)return e.breakIt(u,v),u;if(d=p[u],d!==_.OPS.dependency)this[d].apply(this,a[u]);else for(let x of a[u]){let D=x.startsWith("g_")?P:T;if(!D.has(x))return D.get(x,v),u}if(u++,u===C)return u;if(A&&++E>10){if(Date.now()>o)return v(),u;E=0}}}#t(){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.#t(),this.cachedCanvases.clear(),this.cachedPatterns.clear();for(let l of this._cachedBitmapsMap.values()){for(let g of l.values())typeof HTMLCanvasElement<"u"&&g instanceof HTMLCanvasElement&&(g.width=g.height=0);l.clear()}this._cachedBitmapsMap.clear(),this.#e()}#e(){if(this.pageColors){let l=this.filterFactory.addHCMFilter(this.pageColors.foreground,this.pageColors.background);if(l!=="none"){let g=this.ctx.filter;this.ctx.filter=l,this.ctx.drawImage(this.ctx.canvas,0,0),this.ctx.filter=g}}}_scaleImage(l,g){let v=l.width,e=l.height,a,p,u=Math.max(Math.hypot(g[0],g[1]),1),C=Math.max(Math.hypot(g[2],g[3]),1),A=v,o=e,E="prescale1";for(;u>2&&A>1||C>2&&o>1;){let P=A,T=o;u>2&&A>1&&(P=A>=16384?Math.floor(A/2)-1||1:Math.ceil(A/2),u/=A/P),C>2&&o>1&&(T=o>=16384?Math.floor(o/2)-1||1:Math.ceil(o)/2,C/=o/T),a=this.cachedCanvases.getCanvas(E,P,T),p=a.context,p.clearRect(0,0,P,T),p.drawImage(l,0,0,A,o,0,0,P,T),l=a.canvas,A=P,o=T,E=E==="prescale1"?"prescale2":"prescale1"}return{img:l,paintWidth:A,paintHeight:o}}_createMaskCanvas(l){let g=this.ctx,{width:v,height:e}=l,a=this.current.fillColor,p=this.current.patternFill,u=(0,H.getCurrentTransform)(g),C,A,o,E;if((l.bitmap||l.data)&&l.count>1){let ht=l.bitmap||l.data.buffer;A=JSON.stringify(p?u:[u.slice(0,4),a]),C=this._cachedBitmapsMap.get(ht),C||(C=new Map,this._cachedBitmapsMap.set(ht,C));let dt=C.get(A);if(dt&&!p)return{canvas:dt,offsetX:Math.round(Math.min(u[0],u[2])+u[4]),offsetY:Math.round(Math.min(u[1],u[3])+u[5])};o=dt}o||(E=this.cachedCanvases.getCanvas("maskCanvas",v,e),I(E.context,l));let P=_.Util.transform(u,[1/v,0,0,-1/e,0,0]);P=_.Util.transform(P,[1,0,0,1,0,-e]);let[T,d,x,D]=_.Util.getAxialAlignedBoundingBox([0,0,v,e],P),U=Math.round(x-T)||1,V=Math.round(D-d)||1,q=this.cachedCanvases.getCanvas("fillCanvas",U,V),K=q.context,tt=T,Q=d;K.translate(-tt,-Q),K.transform(...P),o||(o=this._scaleImage(E.canvas,(0,H.getCurrentTransformInverse)(K)),o=o.img,C&&p&&C.set(A,o)),K.imageSmoothingEnabled=z((0,H.getCurrentTransform)(K),l.interpolate),b(K,o,0,0,o.width,o.height,0,0,v,e),K.globalCompositeOperation="source-in";let Y=_.Util.transform((0,H.getCurrentTransformInverse)(K),[1,0,0,1,-tt,-Q]);return K.fillStyle=p?a.getPattern(g,this,Y,N):a,K.fillRect(0,0,v,e),C&&!p&&(this.cachedCanvases.delete("fillCanvas"),C.set(A,q.canvas)),{canvas:q.canvas,offsetX:Math.round(tt),offsetY:Math.round(Q)}}setLineWidth(l){l!==this.current.lineWidth&&(this._cachedScaleForStroking[0]=-1),this.current.lineWidth=l,this.ctx.lineWidth=l}setLineCap(l){this.ctx.lineCap=J[l]}setLineJoin(l){this.ctx.lineJoin=st[l]}setMiterLimit(l){this.ctx.miterLimit=l}setDash(l,g){let v=this.ctx;v.setLineDash!==void 0&&(v.setLineDash(l),v.lineDashOffset=g)}setRenderingIntent(l){}setFlatness(l){}setGState(l){for(let[g,v]of l)switch(g){case"LW":this.setLineWidth(v);break;case"LC":this.setLineCap(v);break;case"LJ":this.setLineJoin(v);break;case"ML":this.setMiterLimit(v);break;case"D":this.setDash(v[0],v[1]);break;case"RI":this.setRenderingIntent(v);break;case"FL":this.setFlatness(v);break;case"Font":this.setFont(v[0],v[1]);break;case"CA":this.current.strokeAlpha=v;break;case"ca":this.current.fillAlpha=v,this.ctx.globalAlpha=v;break;case"BM":this.ctx.globalCompositeOperation=v;break;case"SMask":this.current.activeSMask=v?this.tempSMask:null,this.tempSMask=null,this.checkSMaskState();break;case"TR":this.ctx.filter=this.current.transferMaps=this.filterFactory.addFilter(v)}}get inSMaskMode(){return!!this.suspendedCtx}checkSMaskState(){let l=this.inSMaskMode;this.current.activeSMask&&!l?this.beginSMaskMode():!this.current.activeSMask&&l&&this.endSMaskMode()}beginSMaskMode(){if(this.inSMaskMode)throw new Error("beginSMaskMode called while already in smask mode");let l=this.ctx.canvas.width,g=this.ctx.canvas.height,v="smaskGroupAt"+this.groupLevel,e=this.cachedCanvases.getCanvas(v,l,g);this.suspendedCtx=this.ctx,this.ctx=e.context;let a=this.ctx;a.setTransform(...(0,H.getCurrentTransform)(this.suspendedCtx)),B(this.suspendedCtx,a),(function(u,C){if(u._removeMirroring)throw new Error("Context is already forwarding operations.");u.__originalSave=u.save,u.__originalRestore=u.restore,u.__originalRotate=u.rotate,u.__originalScale=u.scale,u.__originalTranslate=u.translate,u.__originalTransform=u.transform,u.__originalSetTransform=u.setTransform,u.__originalResetTransform=u.resetTransform,u.__originalClip=u.clip,u.__originalMoveTo=u.moveTo,u.__originalLineTo=u.lineTo,u.__originalBezierCurveTo=u.bezierCurveTo,u.__originalRect=u.rect,u.__originalClosePath=u.closePath,u.__originalBeginPath=u.beginPath,u._removeMirroring=()=>{u.save=u.__originalSave,u.restore=u.__originalRestore,u.rotate=u.__originalRotate,u.scale=u.__originalScale,u.translate=u.__originalTranslate,u.transform=u.__originalTransform,u.setTransform=u.__originalSetTransform,u.resetTransform=u.__originalResetTransform,u.clip=u.__originalClip,u.moveTo=u.__originalMoveTo,u.lineTo=u.__originalLineTo,u.bezierCurveTo=u.__originalBezierCurveTo,u.rect=u.__originalRect,u.closePath=u.__originalClosePath,u.beginPath=u.__originalBeginPath,delete u._removeMirroring},u.save=function(){C.save(),this.__originalSave()},u.restore=function(){C.restore(),this.__originalRestore()},u.translate=function(o,E){C.translate(o,E),this.__originalTranslate(o,E)},u.scale=function(o,E){C.scale(o,E),this.__originalScale(o,E)},u.transform=function(o,E,P,T,d,x){C.transform(o,E,P,T,d,x),this.__originalTransform(o,E,P,T,d,x)},u.setTransform=function(o,E,P,T,d,x){C.setTransform(o,E,P,T,d,x),this.__originalSetTransform(o,E,P,T,d,x)},u.resetTransform=function(){C.resetTransform(),this.__originalResetTransform()},u.rotate=function(o){C.rotate(o),this.__originalRotate(o)},u.clip=function(o){C.clip(o),this.__originalClip(o)},u.moveTo=function(A,o){C.moveTo(A,o),this.__originalMoveTo(A,o)},u.lineTo=function(A,o){C.lineTo(A,o),this.__originalLineTo(A,o)},u.bezierCurveTo=function(A,o,E,P,T,d){C.bezierCurveTo(A,o,E,P,T,d),this.__originalBezierCurveTo(A,o,E,P,T,d)},u.rect=function(A,o,E,P){C.rect(A,o,E,P),this.__originalRect(A,o,E,P)},u.closePath=function(){C.closePath(),this.__originalClosePath()},u.beginPath=function(){C.beginPath(),this.__originalBeginPath()}})(a,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(),B(this.ctx,this.suspendedCtx),this.ctx=this.suspendedCtx,this.suspendedCtx=null}compose(l){if(!this.current.activeSMask)return;l?(l[0]=Math.floor(l[0]),l[1]=Math.floor(l[1]),l[2]=Math.ceil(l[2]),l[3]=Math.ceil(l[3])):l=[0,0,this.ctx.canvas.width,this.ctx.canvas.height];let g=this.current.activeSMask;O(this.suspendedCtx,g,this.ctx,l),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?(B(this.ctx,this.suspendedCtx),this.suspendedCtx.save()):this.ctx.save();let l=this.current;this.stateStack.push(l),this.current=l.clone()}restore(){this.stateStack.length===0&&this.inSMaskMode&&this.endSMaskMode(),this.stateStack.length!==0&&(this.current=this.stateStack.pop(),this.inSMaskMode?(this.suspendedCtx.restore(),B(this.suspendedCtx,this.ctx)):this.ctx.restore(),this.checkSMaskState(),this.pendingClip=null,this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null)}transform(l,g,v,e,a,p){this.ctx.transform(l,g,v,e,a,p),this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null}constructPath(l,g,v){let e=this.ctx,a=this.current,p,u,C=a.x,A=a.y,o=(0,H.getCurrentTransform)(e),E=o[0]===0&&o[3]===0||o[1]===0&&o[2]===0,P=E?v.slice(0):null;for(let T=0,d=0,x=l.length;T<x;T++)switch(0|l[T]){case _.OPS.rectangle:C=g[d++],A=g[d++];let D=g[d++],U=g[d++],V=C+D,q=A+U;e.moveTo(C,A),D===0||U===0?e.lineTo(V,q):(e.lineTo(V,A),e.lineTo(V,q),e.lineTo(C,q)),E||a.updateRectMinMax(o,[C,A,V,q]),e.closePath();break;case _.OPS.moveTo:C=g[d++],A=g[d++],e.moveTo(C,A),E||a.updatePathMinMax(o,C,A);break;case _.OPS.lineTo:C=g[d++],A=g[d++],e.lineTo(C,A),E||a.updatePathMinMax(o,C,A);break;case _.OPS.curveTo:p=C,u=A,C=g[d+4],A=g[d+5],e.bezierCurveTo(g[d],g[d+1],g[d+2],g[d+3],C,A),a.updateCurvePathMinMax(o,p,u,g[d],g[d+1],g[d+2],g[d+3],C,A,P),d+=6;break;case _.OPS.curveTo2:p=C,u=A,e.bezierCurveTo(C,A,g[d],g[d+1],g[d+2],g[d+3]),a.updateCurvePathMinMax(o,p,u,C,A,g[d],g[d+1],g[d+2],g[d+3],P),C=g[d+2],A=g[d+3],d+=4;break;case _.OPS.curveTo3:p=C,u=A,C=g[d+2],A=g[d+3],e.bezierCurveTo(g[d],g[d+1],C,A,C,A),a.updateCurvePathMinMax(o,p,u,g[d],g[d+1],C,A,C,A,P),d+=4;break;case _.OPS.closePath:e.closePath()}E&&a.updateScalingPathMinMax(o,P),a.setCurrentPoint(C,A)}closePath(){this.ctx.closePath()}stroke(l=!0){let g=this.ctx,v=this.current.strokeColor;g.globalAlpha=this.current.strokeAlpha,this.contentVisible&&(typeof v=="object"&&v?.getPattern?(g.save(),g.strokeStyle=v.getPattern(g,this,(0,H.getCurrentTransformInverse)(g),W),this.rescaleAndStroke(!1),g.restore()):this.rescaleAndStroke(!0)),l&&this.consumePath(this.current.getClippedPathBoundingBox()),g.globalAlpha=this.current.fillAlpha}closeStroke(){this.closePath(),this.stroke()}fill(l=!0){let g=this.ctx,v=this.current.fillColor,e=!1;this.current.patternFill&&(g.save(),g.fillStyle=v.getPattern(g,this,(0,H.getCurrentTransformInverse)(g),N),e=!0);let a=this.current.getClippedPathBoundingBox();this.contentVisible&&a!==null&&(this.pendingEOFill?(g.fill("evenodd"),this.pendingEOFill=!1):g.fill()),e&&g.restore(),l&&this.consumePath(a)}eoFill(){this.pendingEOFill=!0,this.fill()}fillStroke(){this.fill(!1),this.stroke(!1),this.consumePath()}eoFillStroke(){this.pendingEOFill=!0,this.fillStroke()}closeFillStroke(){this.closePath(),this.fillStroke()}closeEOFillStroke(){this.pendingEOFill=!0,this.closePath(),this.fillStroke()}endPath(){this.consumePath()}clip(){this.pendingClip=et}eoClip(){this.pendingClip=at}beginText(){this.current.textMatrix=_.IDENTITY_MATRIX,this.current.textMatrixScale=1,this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0}endText(){let l=this.pendingTextPaths,g=this.ctx;if(l!==void 0){g.save(),g.beginPath();for(let v of l)g.setTransform(...v.transform),g.translate(v.x,v.y),v.addToPath(g,v.fontSize);g.restore(),g.clip(),g.beginPath(),delete this.pendingTextPaths}else g.beginPath()}setCharSpacing(l){this.current.charSpacing=l}setWordSpacing(l){this.current.wordSpacing=l}setHScale(l){this.current.textHScale=l/100}setLeading(l){this.current.leading=-l}setFont(l,g){let v=this.commonObjs.get(l),e=this.current;if(!v)throw new Error(`Can't find font for ${l}`);if(e.fontMatrix=v.fontMatrix||_.FONT_IDENTITY_MATRIX,e.fontMatrix[0]!==0&&e.fontMatrix[3]!==0||(0,_.warn)("Invalid font matrix for font "+l),g<0?(g=-g,e.fontDirection=-1):e.fontDirection=1,this.current.font=v,this.current.fontSize=g,v.isType3Font)return;let a=v.loadedName||"sans-serif",p=v.systemFontInfo?.css||`"${a}", ${v.fallbackName}`,u="normal";v.black?u="900":v.bold&&(u="bold");let C=v.italic?"italic":"normal",A=g;g<16?A=16:g>100&&(A=100),this.current.fontSizeScale=g/A,this.ctx.font=`${C} ${u} ${A}px ${p}`}setTextRenderingMode(l){this.current.textRenderingMode=l}setTextRise(l){this.current.textRise=l}moveText(l,g){this.current.x=this.current.lineX+=l,this.current.y=this.current.lineY+=g}setLeadingMoveText(l,g){this.setLeading(-g),this.moveText(l,g)}setTextMatrix(l,g,v,e,a,p){this.current.textMatrix=[l,g,v,e,a,p],this.current.textMatrixScale=Math.hypot(l,g),this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0}nextLine(){this.moveText(0,this.current.leading)}paintChar(l,g,v,e){let a=this.ctx,p=this.current,u=p.font,C=p.textRenderingMode,A=p.fontSize/p.fontSizeScale,o=C&_.TextRenderingMode.FILL_STROKE_MASK,E=!!(C&_.TextRenderingMode.ADD_TO_PATH_FLAG),P=p.patternFill&&!u.missingFile,T;(u.disableFontFace||E||P)&&(T=u.getPathGenerator(this.commonObjs,l)),u.disableFontFace||P?(a.save(),a.translate(g,v),a.beginPath(),T(a,A),e&&a.setTransform(...e),o!==_.TextRenderingMode.FILL&&o!==_.TextRenderingMode.FILL_STROKE||a.fill(),o!==_.TextRenderingMode.STROKE&&o!==_.TextRenderingMode.FILL_STROKE||a.stroke(),a.restore()):(o!==_.TextRenderingMode.FILL&&o!==_.TextRenderingMode.FILL_STROKE||a.fillText(l,g,v),o!==_.TextRenderingMode.STROKE&&o!==_.TextRenderingMode.FILL_STROKE||a.strokeText(l,g,v)),E&&(this.pendingTextPaths||=[]).push({transform:(0,H.getCurrentTransform)(a),x:g,y:v,fontSize:A,addToPath:T})}get isFontSubpixelAAEnabled(){let{context:l}=this.cachedCanvases.getCanvas("isFontSubpixelAAEnabled",10,10);l.scale(1.5,1),l.fillText("I",0,10);let g=l.getImageData(0,0,10,10).data,v=!1;for(let e=3;e<g.length;e+=4)if(g[e]>0&&g[e]<255){v=!0;break}return(0,_.shadow)(this,"isFontSubpixelAAEnabled",v)}showText(l){let g=this.current,v=g.font;if(v.isType3Font)return this.showType3Text(l);let e=g.fontSize;if(e===0)return;let a=this.ctx,p=g.fontSizeScale,u=g.charSpacing,C=g.wordSpacing,A=g.fontDirection,o=g.textHScale*A,E=l.length,P=v.vertical,T=P?1:-1,d=v.defaultVMetrics,x=e*g.fontMatrix[0],D=g.textRenderingMode===_.TextRenderingMode.FILL&&!v.disableFontFace&&!g.patternFill;a.save(),a.transform(...g.textMatrix),a.translate(g.x,g.y+g.textRise),A>0?a.scale(o,-1):a.scale(o,1);let U;if(g.patternFill){a.save();let Q=g.fillColor.getPattern(a,this,(0,H.getCurrentTransformInverse)(a),N);U=(0,H.getCurrentTransform)(a),a.restore(),a.fillStyle=Q}let V=g.lineWidth,q=g.textMatrixScale;if(q===0||V===0){let Q=g.textRenderingMode&_.TextRenderingMode.FILL_STROKE_MASK;Q!==_.TextRenderingMode.STROKE&&Q!==_.TextRenderingMode.FILL_STROKE||(V=this.getSinglePixelWidth())}else V/=q;if(p!==1&&(a.scale(p,p),V/=p),a.lineWidth=V,v.isInvalidPDFjsFont){let Q=[],Y=0;for(let ht of l)Q.push(ht.unicode),Y+=ht.width;a.fillText(Q.join(""),0,0),g.x+=Y*x*o,a.restore(),this.compose();return}let K,tt=0;for(K=0;K<E;++K){let Q=l[K];if(typeof Q=="number"){tt+=T*Q*e/1e3;continue}let Y=!1,ht=(Q.isSpace?C:0)+u,dt=Q.fontChar,lt=Q.accent,ut,pt,gt=Q.width;if(P){let ft=Q.vmetric||d,vt=-(Q.vmetric?ft[1]:.5*gt)*x,yt=ft[2]*x;gt=ft?-ft[0]:gt,ut=vt/p,pt=(tt+yt)/p}else ut=tt/p,pt=0;if(v.remeasure&&gt>0){let ft=1e3*a.measureText(dt).width/e*p;if(gt<ft&&this.isFontSubpixelAAEnabled){let vt=gt/ft;Y=!0,a.save(),a.scale(vt,1),ut/=vt}else gt!==ft&&(ut+=(gt-ft)/2e3*e/p)}if(this.contentVisible&&(Q.isInFont||v.missingFile)){if(D&&!lt)a.fillText(dt,ut,pt);else if(this.paintChar(dt,ut,pt,U),lt){let ft=ut+e*lt.offset.x/p,vt=pt-e*lt.offset.y/p;this.paintChar(lt.fontChar,ft,vt,U)}}tt+=P?gt*x-ht*A:gt*x+ht*A,Y&&a.restore()}P?g.y-=tt:g.x+=tt*o,a.restore(),this.compose()}showType3Text(l){let g=this.ctx,v=this.current,e=v.font,a=v.fontSize,p=v.fontDirection,u=e.vertical?1:-1,C=v.charSpacing,A=v.wordSpacing,o=v.textHScale*p,E=v.fontMatrix||_.FONT_IDENTITY_MATRIX,P=l.length,T,d,x,D;if(v.textRenderingMode!==_.TextRenderingMode.INVISIBLE&&a!==0){for(this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null,g.save(),g.transform(...v.textMatrix),g.translate(v.x,v.y),g.scale(o,p),T=0;T<P;++T){if(d=l[T],typeof d=="number"){D=u*d*a/1e3,this.ctx.translate(D,0),v.x+=D*o;continue}let U=(d.isSpace?A:0)+C,V=e.charProcOperatorList[d.operatorListId];if(!V){(0,_.warn)(`Type3 character "${d.operatorListId}" is not available.`);continue}this.contentVisible&&(this.processingType3=d,this.save(),g.scale(a,a),g.transform(...E),this.executeOperatorList(V),this.restore()),x=_.Util.applyTransform([d.width,0],E)[0]*a+U,g.translate(x,0),v.x+=x*o}g.restore(),this.processingType3=null}}setCharWidth(l,g){}setCharWidthAndBounds(l,g,v,e,a,p){this.ctx.rect(v,e,a-v,p-e),this.ctx.clip(),this.endPath()}getColorN_Pattern(l){let g;if(l[0]==="TilingPattern"){let v=l[1],e=this.baseTransform||(0,H.getCurrentTransform)(this.ctx),a={createCanvasGraphics:p=>new rt(p,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:this.optionalContentConfig,markedContentStack:this.markedContentStack})};g=new t(l,v,this.ctx,a,e)}else g=this._getPattern(l[1],l[2]);return g}setStrokeColorN(){this.current.strokeColor=this.getColorN_Pattern(arguments)}setFillColorN(){this.current.fillColor=this.getColorN_Pattern(arguments),this.current.patternFill=!0}setStrokeRGBColor(l,g,v){let e=_.Util.makeHexColor(l,g,v);this.ctx.strokeStyle=e,this.current.strokeColor=e}setFillRGBColor(l,g,v){let e=_.Util.makeHexColor(l,g,v);this.ctx.fillStyle=e,this.current.fillColor=e,this.current.patternFill=!1}_getPattern(l,g=null){let v;return this.cachedPatterns.has(l)?v=this.cachedPatterns.get(l):(v=(function(a){switch(a[0]){case"RadialAxial":return new f(a);case"Mesh":return new w(a);case"Dummy":return new S}throw new Error(`Unknown IR type: ${a[0]}`)})(this.getObject(l)),this.cachedPatterns.set(l,v)),g&&(v.matrix=g),v}shadingFill(l){if(!this.contentVisible)return;let g=this.ctx;this.save();let v=this._getPattern(l);g.fillStyle=v.getPattern(g,this,(0,H.getCurrentTransformInverse)(g),F);let e=(0,H.getCurrentTransformInverse)(g);if(e){let{width:a,height:p}=g.canvas,[u,C,A,o]=_.Util.getAxialAlignedBoundingBox([0,0,a,p],e);this.ctx.fillRect(u,C,A-u,o-C)}else this.ctx.fillRect(-1e10,-1e10,2e10,2e10);this.compose(this.current.getClippedPathBoundingBox()),this.restore()}beginInlineImage(){(0,_.unreachable)("Should not call beginInlineImage")}beginImageData(){(0,_.unreachable)("Should not call beginImageData")}paintFormXObjectBegin(l,g){if(this.contentVisible&&(this.save(),this.baseTransformStack.push(this.baseTransform),Array.isArray(l)&&l.length===6&&this.transform(...l),this.baseTransform=(0,H.getCurrentTransform)(this.ctx),g)){let v=g[2]-g[0],e=g[3]-g[1];this.ctx.rect(g[0],g[1],v,e),this.current.updateRectMinMax((0,H.getCurrentTransform)(this.ctx),g),this.clip(),this.endPath()}}paintFormXObjectEnd(){this.contentVisible&&(this.restore(),this.baseTransform=this.baseTransformStack.pop())}beginGroup(l){if(!this.contentVisible)return;this.save(),this.inSMaskMode&&(this.endSMaskMode(),this.current.activeSMask=null);let g=this.ctx;l.isolated||(0,_.info)("TODO: Support non-isolated groups."),l.knockout&&(0,_.warn)("Knockout groups not supported.");let v=(0,H.getCurrentTransform)(g);if(l.matrix&&g.transform(...l.matrix),!l.bbox)throw new Error("Bounding box is required.");let e=_.Util.getAxialAlignedBoundingBox(l.bbox,(0,H.getCurrentTransform)(g)),a=[0,0,g.canvas.width,g.canvas.height];e=_.Util.intersect(e,a)||[0,0,0,0];let p=Math.floor(e[0]),u=Math.floor(e[1]),C=Math.max(Math.ceil(e[2])-p,1),A=Math.max(Math.ceil(e[3])-u,1),o=1,E=1;C>r&&(o=C/r,C=r),A>r&&(E=A/r,A=r),this.current.startNewPathAndClipBox([0,0,C,A]);let P="groupAt"+this.groupLevel;l.smask&&(P+="_smask_"+this.smaskCounter++%2);let T=this.cachedCanvases.getCanvas(P,C,A),d=T.context;d.scale(1/o,1/E),d.translate(-p,-u),d.transform(...v),l.smask?this.smaskStack.push({canvas:T.canvas,context:d,offsetX:p,offsetY:u,scaleX:o,scaleY:E,subtype:l.smask.subtype,backdrop:l.smask.backdrop,transferMap:l.smask.transferMap||null,startTransformInverse:null}):(g.setTransform(1,0,0,1,0,0),g.translate(p,u),g.scale(o,E),g.save()),B(g,d),this.ctx=d,this.setGState([["BM","source-over"],["ca",1],["CA",1]]),this.groupStack.push(g),this.groupLevel++}endGroup(l){if(!this.contentVisible)return;this.groupLevel--;let g=this.ctx,v=this.groupStack.pop();if(this.ctx=v,this.ctx.imageSmoothingEnabled=!1,l.smask)this.tempSMask=this.smaskStack.pop(),this.restore();else{this.ctx.restore();let e=(0,H.getCurrentTransform)(this.ctx);this.restore(),this.ctx.save(),this.ctx.setTransform(...e);let a=_.Util.getAxialAlignedBoundingBox([0,0,g.canvas.width,g.canvas.height],e);this.ctx.drawImage(g.canvas,0,0),this.ctx.restore(),this.compose(a)}}beginAnnotation(l,g,v,e,a){if(this.#t(),X(this.ctx),this.ctx.save(),this.save(),this.baseTransform&&this.ctx.setTransform(...this.baseTransform),Array.isArray(g)&&g.length===4){let p=g[2]-g[0],u=g[3]-g[1];if(a&&this.annotationCanvasMap){(v=v.slice())[4]-=g[0],v[5]-=g[1],(g=g.slice())[0]=g[1]=0,g[2]=p,g[3]=u;let[C,A]=_.Util.singularValueDecompose2dScale((0,H.getCurrentTransform)(this.ctx)),{viewportScale:o}=this,E=Math.ceil(p*this.outputScaleX*o),P=Math.ceil(u*this.outputScaleY*o);this.annotationCanvas=this.canvasFactory.create(E,P);let{canvas:T,context:d}=this.annotationCanvas;this.annotationCanvasMap.set(l,T),this.annotationCanvas.savedCtx=this.ctx,this.ctx=d,this.ctx.save(),this.ctx.setTransform(C,0,0,-A,0,u*A),X(this.ctx)}else X(this.ctx),this.ctx.rect(g[0],g[1],p,u),this.ctx.clip(),this.endPath()}this.current=new R(this.ctx.canvas.width,this.ctx.canvas.height),this.transform(...v),this.transform(...e)}endAnnotation(){this.annotationCanvas&&(this.ctx.restore(),this.#e(),this.ctx=this.annotationCanvas.savedCtx,delete this.annotationCanvas.savedCtx,delete this.annotationCanvas)}paintImageMaskXObject(l){if(!this.contentVisible)return;let g=l.count;(l=this.getObject(l.data,l)).count=g;let v=this.ctx,e=this.processingType3;if(e&&(e.compiled===void 0&&(e.compiled=(function(C){let{width:A,height:o}=C;if(A>1e3||o>1e3)return null;let E=new Uint8Array([0,2,4,0,1,0,5,4,8,10,0,8,0,2,1,0]),P=A+1,T,d,x,D=new Uint8Array(P*(o+1)),U=A+7&-8,V=new Uint8Array(U*o),q=0;for(let Y of C.data){let ht=128;for(;ht>0;)V[q++]=Y&ht?0:255,ht>>=1}let K=0;for(q=0,V[q]!==0&&(D[0]=1,++K),d=1;d<A;d++)V[q]!==V[q+1]&&(D[d]=V[q]?2:1,++K),q++;for(V[q]!==0&&(D[d]=2,++K),T=1;T<o;T++){q=T*U,x=T*P,V[q-U]!==V[q]&&(D[x]=V[q]?1:8,++K);let Y=(V[q]?4:0)+(V[q-U]?8:0);for(d=1;d<A;d++)Y=(Y>>2)+(V[q+1]?4:0)+(V[q-U+1]?8:0),E[Y]&&(D[x+d]=E[Y],++K),q++;if(V[q-U]!==V[q]&&(D[x+d]=V[q]?2:4,++K),K>1e3)return null}for(q=U*(o-1),x=T*P,V[q]!==0&&(D[x]=8,++K),d=1;d<A;d++)V[q]!==V[q+1]&&(D[x+d]=V[q]?4:8,++K),q++;if(V[q]!==0&&(D[x+d]=4,++K),K>1e3)return null;let tt=new Int32Array([0,P,-1,0,-P,0,0,0,1]),Q=new Path2D;for(T=0;K&&T<=o;T++){let Y=T*P,ht=Y+A;for(;Y<ht&&!D[Y];)Y++;if(Y===ht)continue;Q.moveTo(Y%P,T);let dt=Y,lt=D[Y];do{let ut=tt[lt];do Y+=ut;while(!D[Y]);let pt=D[Y];pt!==5&&pt!==10?(lt=pt,D[Y]=0):(lt=pt&51*lt>>4,D[Y]&=lt>>2|lt<<2),Q.lineTo(Y%P,Y/P|0),D[Y]||--K}while(dt!==Y);--T}return V=null,D=null,function(Y){Y.save(),Y.scale(1/A,-1/o),Y.translate(0,-o),Y.fill(Q),Y.beginPath(),Y.restore()}})(l)),e.compiled)){e.compiled(v);return}let a=this._createMaskCanvas(l),p=a.canvas;v.save(),v.setTransform(1,0,0,1,0,0),v.drawImage(p,a.offsetX,a.offsetY),v.restore(),this.compose()}paintImageMaskXObjectRepeat(l,g,v=0,e=0,a,p){if(!this.contentVisible)return;l=this.getObject(l.data,l);let u=this.ctx;u.save();let C=(0,H.getCurrentTransform)(u);u.transform(g,v,e,a,0,0);let A=this._createMaskCanvas(l);u.setTransform(1,0,0,1,A.offsetX-C[4],A.offsetY-C[5]);for(let o=0,E=p.length;o<E;o+=2){let P=_.Util.transform(C,[g,v,e,a,p[o],p[o+1]]),[T,d]=_.Util.applyTransform([0,0],P);u.drawImage(A.canvas,T,d)}u.restore(),this.compose()}paintImageMaskXObjectGroup(l){if(!this.contentVisible)return;let g=this.ctx,v=this.current.fillColor,e=this.current.patternFill;for(let a of l){let{data:p,width:u,height:C,transform:A}=a,o=this.cachedCanvases.getCanvas("maskCanvas",u,C),E=o.context;E.save(),I(E,this.getObject(p,a)),E.globalCompositeOperation="source-in",E.fillStyle=e?v.getPattern(E,this,(0,H.getCurrentTransformInverse)(g),N):v,E.fillRect(0,0,u,C),E.restore(),g.save(),g.transform(...A),g.scale(1,-1),b(g,o.canvas,0,0,u,C,0,-1,1,1),g.restore()}this.compose()}paintImageXObject(l){if(!this.contentVisible)return;let g=this.getObject(l);g?this.paintInlineImageXObject(g):(0,_.warn)("Dependent image isn't ready yet")}paintImageXObjectRepeat(l,g,v,e){if(!this.contentVisible)return;let a=this.getObject(l);if(!a){(0,_.warn)("Dependent image isn't ready yet");return}let p=a.width,u=a.height,C=[];for(let A=0,o=e.length;A<o;A+=2)C.push({transform:[g,0,0,v,e[A],e[A+1]],x:0,y:0,w:p,h:u});this.paintInlineImageXObjectGroup(a,C)}applyTransferMapsToCanvas(l){return this.current.transferMaps!=="none"&&(l.filter=this.current.transferMaps,l.drawImage(l.canvas,0,0),l.filter="none"),l.canvas}applyTransferMapsToBitmap(l){if(this.current.transferMaps==="none")return l.bitmap;let{bitmap:g,width:v,height:e}=l,a=this.cachedCanvases.getCanvas("inlineImage",v,e),p=a.context;return p.filter=this.current.transferMaps,p.drawImage(g,0,0),p.filter="none",a.canvas}paintInlineImageXObject(l){if(!this.contentVisible)return;let g=l.width,v=l.height,e=this.ctx;if(this.save(),!_.isNodeJS){let{filter:u}=e;u!=="none"&&u!==""&&(e.filter="none")}e.scale(1/g,-1/v);let a;if(l.bitmap)a=this.applyTransferMapsToBitmap(l);else if(typeof HTMLElement=="function"&&l instanceof HTMLElement||!l.data)a=l;else{let u=this.cachedCanvases.getCanvas("inlineImage",g,v).context;L(u,l),a=this.applyTransferMapsToCanvas(u)}let p=this._scaleImage(a,(0,H.getCurrentTransformInverse)(e));e.imageSmoothingEnabled=z((0,H.getCurrentTransform)(e),l.interpolate),b(e,p.img,0,0,p.paintWidth,p.paintHeight,0,-v,g,v),this.compose(),this.restore()}paintInlineImageXObjectGroup(l,g){if(!this.contentVisible)return;let v=this.ctx,e;if(l.bitmap)e=l.bitmap;else{let a=l.width,p=l.height,u=this.cachedCanvases.getCanvas("inlineImage",a,p).context;L(u,l),e=this.applyTransferMapsToCanvas(u)}for(let a of g)v.save(),v.transform(...a.transform),v.scale(1,-1),b(v,e,a.x,a.y,a.w,a.h,0,-1,1,1),v.restore();this.compose()}paintSolidColorImageMask(){this.contentVisible&&(this.ctx.fillRect(0,0,1,1),this.compose())}markPoint(l){}markPointProps(l,g){}beginMarkedContent(l){this.markedContentStack.push({visible:!0})}beginMarkedContentProps(l,g){l==="OC"?this.markedContentStack.push({visible:this.optionalContentConfig.isVisible(g)}):this.markedContentStack.push({visible:!0}),this.contentVisible=this.isContentVisible()}endMarkedContent(){this.markedContentStack.pop(),this.contentVisible=this.isContentVisible()}beginCompat(){}endCompat(){}consumePath(l){let g=this.current.isEmptyClip();this.pendingClip&&this.current.updateClipFromPath(),this.pendingClip||this.compose(l);let v=this.ctx;this.pendingClip&&(g||(this.pendingClip===at?v.clip("evenodd"):v.clip()),this.pendingClip=null),this.current.startNewPathAndClipBox(this.current.clipBox),v.beginPath()}getSinglePixelWidth(){if(!this._cachedGetSinglePixelWidth){let l=(0,H.getCurrentTransform)(this.ctx);if(l[1]===0&&l[2]===0)this._cachedGetSinglePixelWidth=1/Math.min(Math.abs(l[0]),Math.abs(l[3]));else{let g=Math.abs(l[0]*l[3]-l[2]*l[1]),v=Math.hypot(l[0],l[2]),e=Math.hypot(l[1],l[3]);this._cachedGetSinglePixelWidth=Math.max(v,e)/g}}return this._cachedGetSinglePixelWidth}getScaleForStroking(){if(this._cachedScaleForStroking[0]===-1){let{lineWidth:l}=this.current,{a:g,b:v,c:e,d:a}=this.ctx.getTransform(),p,u;if(v===0&&e===0){let C=Math.abs(g),A=Math.abs(a);if(C===A)if(l===0)p=u=1/C;else{let o=C*l;p=u=o<1?1/o:1}else if(l===0)p=1/C,u=1/A;else{let o=C*l,E=A*l;p=o<1?1/o:1,u=E<1?1/E:1}}else{let C=Math.abs(g*a-v*e),A=Math.hypot(g,v),o=Math.hypot(e,a);if(l===0)p=o/C,u=A/C;else{let E=l*C;p=o>E?o/E:1,u=A>E?A/E:1}}this._cachedScaleForStroking[0]=p,this._cachedScaleForStroking[1]=u}return this._cachedScaleForStroking}rescaleAndStroke(l){let{ctx:g}=this,{lineWidth:v}=this.current,[e,a]=this.getScaleForStroking();if(g.lineWidth=v||1,e===1&&a===1){g.stroke();return}let p=g.getLineDash();if(l&&g.save(),g.scale(e,a),p.length>0){let u=Math.max(e,a);g.setLineDash(p.map((C=>C/u))),g.lineDashOffset/=u}g.stroke(),l&&g.restore()}isContentVisible(){for(let l=this.markedContentStack.length-1;l>=0;l--)if(!this.markedContentStack[l].visible)return!1;return!0}}for(let $ in _.OPS)rt.prototype[$]!==void 0&&(rt.prototype[_.OPS[$]]=rt.prototype[$])},419:(ot,it,j)=>{j.d(it,{DOMCMapReaderFactory:()=>f,DOMCanvasFactory:()=>k,DOMFilterFactory:()=>F,DOMSVGFactory:()=>h,DOMStandardFontDataFactory:()=>i,PDFDateString:()=>R,PageViewport:()=>w,PixelsPerInch:()=>W,RenderingCancelledException:()=>S,StatTimer:()=>r,fetchData:()=>M,getColorValues:()=>B,getCurrentTransform:()=>X,getCurrentTransformInverse:()=>Z,getFilenameFromUrl:()=>t,getPdfFilenameFromUrl:()=>s,getRGB:()=>I,getXfaPageViewport:()=>L,isDataScheme:()=>n,isPdfFile:()=>c,isValidFetchUrl:()=>m,noContextMenu:()=>y,setLayerDimensions:()=>nt});var _=j(583),H=j(292);let N="http://www.w3.org/2000/svg";class W{static CSS=96;static PDF=72;static PDF_TO_CSS_UNITS=this.CSS/this.PDF}class F extends _.BaseFilterFactory{#t;#e;#s;#n;#a;#i=0;constructor({docId:O,ownerDocument:z=globalThis.document}={}){super(),this.#s=O,this.#n=z}get#r(){return this.#t||=new Map}get#l(){return this.#a||=new Map}get#h(){if(!this.#e){let O=this.#n.createElement("div"),{style:z}=O;z.visibility="hidden",z.contain="strict",z.width=z.height=0,z.position="absolute",z.top=z.left=0,z.zIndex=-1;let J=this.#n.createElementNS(N,"svg");J.setAttribute("width",0),J.setAttribute("height",0),this.#e=this.#n.createElementNS(N,"defs"),O.append(J),J.append(this.#e),this.#n.body.append(O)}return this.#e}addFilter(O){if(!O)return"none";let z,J,st,et,at=this.#r.get(O);if(at)return at;if(O.length===1){let g=O[0],v=new Array(256);for(let e=0;e<256;e++)v[e]=g[e]/255;et=z=J=st=v.join(",")}else{let[g,v,e]=O,a=new Array(256),p=new Array(256),u=new Array(256);for(let C=0;C<256;C++)a[C]=g[C]/255,p[C]=v[C]/255,u[C]=e[C]/255;z=a.join(","),J=p.join(","),st=u.join(","),et=`${z}${J}${st}`}if(at=this.#r.get(et),at)return this.#r.set(O,at),at;let rt=`g_${this.#s}_transfer_map_${this.#i++}`,$=`url(#${rt})`;this.#r.set(O,$),this.#r.set(et,$);let l=this.#u(rt);return this.#o(z,J,st,l),$}addHCMFilter(O,z){let J=`${O}-${z}`,st="base",et=this.#l.get(st);if(et?.key===J||(et?(et.filter?.remove(),et.key=J,et.url="none",et.filter=null):(et={key:J,url:"none",filter:null},this.#l.set(st,et)),!O||!z))return et.url;let at=this.#g(O);O=H.Util.makeHexColor(...at);let rt=this.#g(z);if(z=H.Util.makeHexColor(...rt),this.#h.style.color="",O==="#000000"&&z==="#ffffff"||O===z)return et.url;let $=new Array(256);for(let a=0;a<=255;a++){let p=a/255;$[a]=p<=.03928?p/12.92:((p+.055)/1.055)**2.4}let l=$.join(","),g=`g_${this.#s}_hcm_filter`,v=et.filter=this.#u(g);this.#o(l,l,l,v),this.#d(v);let e=(a,p)=>{let u=at[a]/255,C=rt[a]/255,A=new Array(p+1);for(let o=0;o<=p;o++)A[o]=u+o/p*(C-u);return A.join(",")};return this.#o(e(0,5),e(1,5),e(2,5),v),et.url=`url(#${g})`,et.url}addHighlightHCMFilter(O,z,J,st,et){let at=`${z}-${J}-${st}-${et}`,rt=this.#l.get(O);if(rt?.key===at||(rt?(rt.filter?.remove(),rt.key=at,rt.url="none",rt.filter=null):(rt={key:at,url:"none",filter:null},this.#l.set(O,rt)),!z||!J))return rt.url;let[$,l]=[z,J].map(this.#g.bind(this)),g=Math.round(.2126*$[0]+.7152*$[1]+.0722*$[2]),v=Math.round(.2126*l[0]+.7152*l[1]+.0722*l[2]),[e,a]=[st,et].map(this.#g.bind(this));v<g&&([g,v,e,a]=[v,g,a,e]),this.#h.style.color="";let p=(A,o,E)=>{let P=new Array(256),T=(v-g)/E,d=A/255,x=(o-A)/(255*E),D=0;for(let U=0;U<=E;U++){let V=Math.round(g+U*T),q=d+U*x;for(let K=D;K<=V;K++)P[K]=q;D=V+1}for(let U=D;U<256;U++)P[U]=P[D-1];return P.join(",")},u=`g_${this.#s}_hcm_${O}_filter`,C=rt.filter=this.#u(u);return this.#d(C),this.#o(p(e[0],a[0],5),p(e[1],a[1],5),p(e[2],a[2],5),C),rt.url=`url(#${u})`,rt.url}destroy(O=!1){(!O||this.#l.size===0)&&(this.#e&&(this.#e.parentNode.parentNode.remove(),this.#e=null),this.#t&&(this.#t.clear(),this.#t=null),this.#i=0)}#d(O){let z=this.#n.createElementNS(N,"feColorMatrix");z.setAttribute("type","matrix"),z.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"),O.append(z)}#u(O){let z=this.#n.createElementNS(N,"filter");return z.setAttribute("color-interpolation-filters","sRGB"),z.setAttribute("id",O),this.#h.append(z),z}#c(O,z,J){let st=this.#n.createElementNS(N,z);st.setAttribute("type","discrete"),st.setAttribute("tableValues",J),O.append(st)}#o(O,z,J,st){let et=this.#n.createElementNS(N,"feComponentTransfer");st.append(et),this.#c(et,"feFuncR",O),this.#c(et,"feFuncG",z),this.#c(et,"feFuncB",J)}#g(O){return this.#h.style.color=O,I(getComputedStyle(this.#h).getPropertyValue("color"))}}class k extends _.BaseCanvasFactory{constructor({ownerDocument:O=globalThis.document}={}){super(),this._document=O}_createCanvas(O,z){let J=this._document.createElement("canvas");return J.width=O,J.height=z,J}}async function M(G,O="text"){if(m(G,document.baseURI)){let z=await fetch(G);if(!z.ok)throw new Error(z.statusText);switch(O){case"arraybuffer":return z.arrayBuffer();case"blob":return z.blob();case"json":return z.json()}return z.text()}return new Promise(((z,J)=>{let st=new XMLHttpRequest;st.open("GET",G,!0),st.responseType=O,st.onreadystatechange=()=>{if(st.readyState===XMLHttpRequest.DONE)if(st.status!==200&&st.status!==0)J(new Error(st.statusText));else{switch(O){case"arraybuffer":case"blob":case"json":z(st.response);return}z(st.responseText)}},st.send(null)}))}class f extends _.BaseCMapReaderFactory{_fetchData(O,z){return M(O,this.isCompressed?"arraybuffer":"text").then((J=>({cMapData:J instanceof ArrayBuffer?new Uint8Array(J):(0,H.stringToBytes)(J),compressionType:z})))}}class i extends _.BaseStandardFontDataFactory{_fetchData(O){return M(O,"arraybuffer").then((z=>new Uint8Array(z)))}}class h extends _.BaseSVGFactory{_createSVG(O){return document.createElementNS(N,O)}}class w{constructor({viewBox:O,scale:z,rotation:J,offsetX:st=0,offsetY:et=0,dontFlip:at=!1}){this.viewBox=O,this.scale=z,this.rotation=J,this.offsetX=st,this.offsetY=et;let rt=(O[2]+O[0])/2,$=(O[3]+O[1])/2,l,g,v,e,a,p,u,C;switch((J%=360)<0&&(J+=360),J){case 180:l=-1,g=0,v=0,e=1;break;case 90:l=0,g=1,v=1,e=0;break;case 270:l=0,g=-1,v=-1,e=0;break;case 0:l=1,g=0,v=0,e=-1;break;default:throw new Error("PageViewport: Invalid rotation, must be a multiple of 90 degrees.")}at&&(v=-v,e=-e),l===0?(a=Math.abs($-O[1])*z+st,p=Math.abs(rt-O[0])*z+et,u=(O[3]-O[1])*z,C=(O[2]-O[0])*z):(a=Math.abs(rt-O[0])*z+st,p=Math.abs($-O[1])*z+et,u=(O[2]-O[0])*z,C=(O[3]-O[1])*z),this.transform=[l*z,g*z,v*z,e*z,a-l*z*rt-v*z*$,p-g*z*rt-e*z*$],this.width=u,this.height=C}get rawDims(){let{viewBox:O}=this;return(0,H.shadow)(this,"rawDims",{pageWidth:O[2]-O[0],pageHeight:O[3]-O[1],pageX:O[0],pageY:O[1]})}clone({scale:O=this.scale,rotation:z=this.rotation,offsetX:J=this.offsetX,offsetY:st=this.offsetY,dontFlip:et=!1}={}){return new w({viewBox:this.viewBox.slice(),scale:O,rotation:z,offsetX:J,offsetY:st,dontFlip:et})}convertToViewportPoint(O,z){return H.Util.applyTransform([O,z],this.transform)}convertToViewportRectangle(O){let z=H.Util.applyTransform([O[0],O[1]],this.transform),J=H.Util.applyTransform([O[2],O[3]],this.transform);return[z[0],z[1],J[0],J[1]]}convertToPdfPoint(O,z){return H.Util.applyInverseTransform([O,z],this.transform)}}class S extends H.BaseException{constructor(O,z=0){super(O,"RenderingCancelledException"),this.extraDelay=z}}function n(G){let O=G.length,z=0;for(;z<O&&G[z].trim()==="";)z++;return G.substring(z,z+5).toLowerCase()==="data:"}function c(G){return typeof G=="string"&&/\.pdf$/i.test(G)}function t(G,O=!1){return O||([G]=G.split(/[#?]/,1)),G.substring(G.lastIndexOf("/")+1)}function s(G,O="document.pdf"){if(typeof G!="string")return O;if(n(G))return(0,H.warn)('getPdfFilenameFromUrl: ignore "data:"-URL for performance reasons.'),O;let z=/[^/?#=]+\.pdf\b(?!.*\.pdf\b)/i,J=/^(?:(?:[^:]+:)?\/\/[^/]+)?([^?#]*)(\?[^#]*)?(#.*)?$/.exec(G),st=z.exec(J[1])||z.exec(J[2])||z.exec(J[3]);if(st&&(st=st[0],st.includes("%")))try{st=z.exec(decodeURIComponent(st))[0]}catch{}return st||O}class r{started=Object.create(null);times=[];time(O){O in this.started&&(0,H.warn)(`Timer is already running for ${O}`),this.started[O]=Date.now()}timeEnd(O){O in this.started||(0,H.warn)(`Timer has not been started for ${O}`),this.times.push({name:O,start:this.started[O],end:Date.now()}),delete this.started[O]}toString(){let O=[],z=0;for(let{name:J}of this.times)z=Math.max(J.length,z);for(let{name:J,start:st,end:et}of this.times)O.push(`${J.padEnd(z)} ${et-st}ms
3
+ `);return O.join("")}}function m(G,O){try{let{protocol:z}=O?new URL(G,O):new URL(G);return z==="http:"||z==="https:"}catch{return!1}}function y(G){G.preventDefault()}let b;class R{static toDateObject(O){if(!O||typeof O!="string")return null;b||=new RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+|-])?(\\d{2})?'?(\\d{2})?'?");let z=b.exec(O);if(!z)return null;let J=parseInt(z[1],10),st=parseInt(z[2],10);st=st>=1&&st<=12?st-1:0;let et=parseInt(z[3],10);et=et>=1&&et<=31?et:1;let at=parseInt(z[4],10);at=at>=0&&at<=23?at:0;let rt=parseInt(z[5],10);rt=rt>=0&&rt<=59?rt:0;let $=parseInt(z[6],10);$=$>=0&&$<=59?$:0;let l=z[7]||"Z",g=parseInt(z[8],10);g=g>=0&&g<=23?g:0;let v=parseInt(z[9],10)||0;return v=v>=0&&v<=59?v:0,l==="-"?(at+=g,rt+=v):l==="+"&&(at-=g,rt-=v),new Date(Date.UTC(J,st,et,at,rt,$))}}function L(G,{scale:O=1,rotation:z=0}){let{width:J,height:st}=G.attributes.style,et=[0,0,parseInt(J),parseInt(st)];return new w({viewBox:et,scale:O,rotation:z})}function I(G){if(G.startsWith("#")){let O=parseInt(G.slice(1),16);return[(16711680&O)>>16,(65280&O)>>8,255&O]}return G.startsWith("rgb(")?G.slice(4,-1).split(",").map((O=>parseInt(O))):G.startsWith("rgba(")?G.slice(5,-1).split(",").map((O=>parseInt(O))).slice(0,3):((0,H.warn)(`Not a valid color format: "${G}"`),[0,0,0])}function B(G){let O=document.createElement("span");O.style.visibility="hidden",document.body.append(O);for(let z of G.keys()){O.style.color=z;let J=window.getComputedStyle(O).color;G.set(z,I(J))}O.remove()}function X(G){let{a:O,b:z,c:J,d:st,e:et,f:at}=G.getTransform();return[O,z,J,st,et,at]}function Z(G){let{a:O,b:z,c:J,d:st,e:et,f:at}=G.getTransform().invertSelf();return[O,z,J,st,et,at]}function nt(G,O,z=!1,J=!0){if(O instanceof w){let{pageWidth:st,pageHeight:et}=O.rawDims,{style:at}=G,rt=H.FeatureTest.isCSSRoundSupported,$=`var(--scale-factor) * ${st}px`,l=`var(--scale-factor) * ${et}px`,g=rt?`round(${$}, 1px)`:`calc(${$})`,v=rt?`round(${l}, 1px)`:`calc(${l})`;z&&O.rotation%180!=0?(at.width=v,at.height=g):(at.width=g,at.height=v)}J&&G.setAttribute("data-main-rotation",O.rotation)}},47:(ot,it,j)=>{j.d(it,{DrawLayer:()=>N});var _=j(419),H=j(292);class N{#t=null;#e=0;#s=new Map;#n=new Map;constructor({pageIndex:F}){this.pageIndex=F}setParent(F){if(this.#t){if(this.#t!==F){if(this.#s.size>0)for(let k of this.#s.values())k.remove(),F.append(k);this.#t=F}}else this.#t=F}static get _svgFactory(){return(0,H.shadow)(this,"_svgFactory",new _.DOMSVGFactory)}static#a(F,{x:k=0,y:M=0,width:f=1,height:i=1}={}){let{style:h}=F;h.top=100*M+"%",h.left=100*k+"%",h.width=100*f+"%",h.height=100*i+"%"}#i(F){let k=N._svgFactory.create(1,1,!0);return this.#t.append(k),k.setAttribute("aria-hidden",!0),N.#a(k,F),k}#r(F,k){let M=N._svgFactory.createElement("clipPath");F.append(M);let f=`clip_${k}`;M.setAttribute("id",f),M.setAttribute("clipPathUnits","objectBoundingBox");let i=N._svgFactory.createElement("use");return M.append(i),i.setAttribute("href",`#${k}`),i.classList.add("clip"),f}highlight(F,k,M,f=!1){let i=this.#e++,h=this.#i(F.box);h.classList.add("highlight"),F.free&&h.classList.add("free");let w=N._svgFactory.createElement("defs");h.append(w);let S=N._svgFactory.createElement("path");w.append(S);let n=`path_p${this.pageIndex}_${i}`;S.setAttribute("id",n),S.setAttribute("d",F.toSVGPath()),f&&this.#n.set(i,S);let c=this.#r(w,n),t=N._svgFactory.createElement("use");return h.append(t),h.setAttribute("fill",k),h.setAttribute("fill-opacity",M),t.setAttribute("href",`#${n}`),this.#s.set(i,h),{id:i,clipPathId:`url(#${c})`}}highlightOutline(F){let k=this.#e++,M=this.#i(F.box);M.classList.add("highlightOutline");let f=N._svgFactory.createElement("defs");M.append(f);let i=N._svgFactory.createElement("path");f.append(i);let h=`path_p${this.pageIndex}_${k}`;i.setAttribute("id",h),i.setAttribute("d",F.toSVGPath()),i.setAttribute("vector-effect","non-scaling-stroke");let w;if(F.free){M.classList.add("free");let c=N._svgFactory.createElement("mask");f.append(c),w=`mask_p${this.pageIndex}_${k}`,c.setAttribute("id",w),c.setAttribute("maskUnits","objectBoundingBox");let t=N._svgFactory.createElement("rect");c.append(t),t.setAttribute("width","1"),t.setAttribute("height","1"),t.setAttribute("fill","white");let s=N._svgFactory.createElement("use");c.append(s),s.setAttribute("href",`#${h}`),s.setAttribute("stroke","none"),s.setAttribute("fill","black"),s.setAttribute("fill-rule","nonzero"),s.classList.add("mask")}let S=N._svgFactory.createElement("use");M.append(S),S.setAttribute("href",`#${h}`),w&&S.setAttribute("mask",`url(#${w})`);let n=S.cloneNode();return M.append(n),S.classList.add("mainOutline"),n.classList.add("secondaryOutline"),this.#s.set(k,M),k}finalizeLine(F,k){let M=this.#n.get(F);this.#n.delete(F),this.updateBox(F,k.box),M.setAttribute("d",k.toSVGPath())}updateLine(F,k){this.#s.get(F).firstChild.firstChild.setAttribute("d",k.toSVGPath())}removeFreeHighlight(F){this.remove(F),this.#n.delete(F)}updatePath(F,k){this.#n.get(F).setAttribute("d",k.toSVGPath())}updateBox(F,k){N.#a(this.#s.get(F),k)}show(F,k){this.#s.get(F).classList.toggle("hidden",!k)}rotate(F,k){this.#s.get(F).setAttribute("data-main-rotation",k)}changeColor(F,k){this.#s.get(F).setAttribute("fill",k)}changeOpacity(F,k){this.#s.get(F).setAttribute("fill-opacity",k)}addClass(F,k){this.#s.get(F).classList.add(k)}removeClass(F,k){this.#s.get(F).classList.remove(k)}remove(F){this.#t!==null&&(this.#s.get(F).remove(),this.#s.delete(F))}destroy(){this.#t=null;for(let F of this.#s.values())F.remove();this.#s.clear()}}},731:(ot,it,j)=>{j.d(it,{AnnotationEditorLayer:()=>n});var _=j(292),H=j(310),N=j(830),W=j(976);let F=/\r\n?|\n/g;class k extends H.AnnotationEditor{#t=this.editorDivBlur.bind(this);#e=this.editorDivFocus.bind(this);#s=this.editorDivInput.bind(this);#n=this.editorDivKeydown.bind(this);#a=this.editorDivPaste.bind(this);#i;#r="";#l=`${this.id}-editor`;#h;#d=null;static _freeTextDefaultContent="";static _internalPadding=0;static _defaultColor=null;static _defaultFontSize=10;static get _keyboardManager(){let t=k.prototype,s=y=>y.isEmpty(),r=N.AnnotationEditorUIManager.TRANSLATE_SMALL,m=N.AnnotationEditorUIManager.TRANSLATE_BIG;return(0,_.shadow)(this,"_keyboardManager",new N.KeyboardManager([[["ctrl+s","mac+meta+s","ctrl+p","mac+meta+p"],t.commitOrRemove,{bubbles:!0}],[["ctrl+Enter","mac+meta+Enter","Escape","mac+Escape"],t.commitOrRemove],[["ArrowLeft","mac+ArrowLeft"],t._translateEmpty,{args:[-r,0],checker:s}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],t._translateEmpty,{args:[-m,0],checker:s}],[["ArrowRight","mac+ArrowRight"],t._translateEmpty,{args:[r,0],checker:s}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],t._translateEmpty,{args:[m,0],checker:s}],[["ArrowUp","mac+ArrowUp"],t._translateEmpty,{args:[0,-r],checker:s}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],t._translateEmpty,{args:[0,-m],checker:s}],[["ArrowDown","mac+ArrowDown"],t._translateEmpty,{args:[0,r],checker:s}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],t._translateEmpty,{args:[0,m],checker:s}]]))}static _type="freetext";static _editorType=_.AnnotationEditorType.FREETEXT;constructor(t){super({...t,name:"freeTextEditor"}),this.#i=t.color||k._defaultColor||H.AnnotationEditor._defaultLineColor,this.#h=t.fontSize||k._defaultFontSize}static initialize(t,s){H.AnnotationEditor.initialize(t,s,{strings:["pdfjs-free-text-default-content"]});let r=getComputedStyle(document.documentElement);this._internalPadding=parseFloat(r.getPropertyValue("--freetext-padding"))}static updateDefaultParams(t,s){switch(t){case _.AnnotationEditorParamsType.FREETEXT_SIZE:k._defaultFontSize=s;break;case _.AnnotationEditorParamsType.FREETEXT_COLOR:k._defaultColor=s}}updateParams(t,s){switch(t){case _.AnnotationEditorParamsType.FREETEXT_SIZE:this.#u(s);break;case _.AnnotationEditorParamsType.FREETEXT_COLOR:this.#c(s)}}static get defaultPropertiesToUpdate(){return[[_.AnnotationEditorParamsType.FREETEXT_SIZE,k._defaultFontSize],[_.AnnotationEditorParamsType.FREETEXT_COLOR,k._defaultColor||H.AnnotationEditor._defaultLineColor]]}get propertiesToUpdate(){return[[_.AnnotationEditorParamsType.FREETEXT_SIZE,this.#h],[_.AnnotationEditorParamsType.FREETEXT_COLOR,this.#i]]}#u(t){let s=m=>{this.editorDiv.style.fontSize=`calc(${m}px * var(--scale-factor))`,this.translate(0,-(m-this.#h)*this.parentScale),this.#h=m,this.#g()},r=this.#h;this.addCommands({cmd:s.bind(this,t),undo:s.bind(this,r),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:_.AnnotationEditorParamsType.FREETEXT_SIZE,overwriteIfSameType:!0,keepUndo:!0})}#c(t){let s=m=>{this.#i=this.editorDiv.style.color=m},r=this.#i;this.addCommands({cmd:s.bind(this,t),undo:s.bind(this,r),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:_.AnnotationEditorParamsType.FREETEXT_COLOR,overwriteIfSameType:!0,keepUndo:!0})}_translateEmpty(t,s){this._uiManager.translateSelectedEditors(t,s,!0)}getInitialTranslation(){let t=this.parentScale;return[-k._internalPadding*t,-(k._internalPadding+this.#h)*t]}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(this.isAttachedToDOM||this.parent.add(this)))}enableEditMode(){this.isInEditMode()||(this.parent.setEditingState(!1),this.parent.updateToolbar(_.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.#n),this.editorDiv.addEventListener("focus",this.#e),this.editorDiv.addEventListener("blur",this.#t),this.editorDiv.addEventListener("input",this.#s),this.editorDiv.addEventListener("paste",this.#a))}disableEditMode(){this.isInEditMode()&&(this.parent.setEditingState(!0),super.disableEditMode(),this.overlayDiv.classList.add("enabled"),this.editorDiv.contentEditable=!1,this.div.setAttribute("aria-activedescendant",this.#l),this._isDraggable=!0,this.editorDiv.removeEventListener("keydown",this.#n),this.editorDiv.removeEventListener("focus",this.#e),this.editorDiv.removeEventListener("blur",this.#t),this.editorDiv.removeEventListener("input",this.#s),this.editorDiv.removeEventListener("paste",this.#a),this.div.focus({preventScroll:!0}),this.isEditing=!1,this.parent.div.classList.add("freetextEditing"))}focusin(t){this._focusEventsAllowed&&(super.focusin(t),t.target!==this.editorDiv&&this.editorDiv.focus())}onceAdded(){this.width||(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()}#o(){let t=[];this.editorDiv.normalize();for(let s of this.editorDiv.childNodes)t.push(k.#f(s));return t.join(`
4
+ `)}#g(){let[t,s]=this.parentDimensions,r;if(this.isAttachedToDOM)r=this.div.getBoundingClientRect();else{let{currentLayer:m,div:y}=this,b=y.style.display;y.style.display="hidden",m.div.append(this.div),r=y.getBoundingClientRect(),y.remove(),y.style.display=b}this.rotation%180==this.parentRotation%180?(this.width=r.width/t,this.height=r.height/s):(this.width=r.height/t,this.height=r.width/s),this.fixAndSetPosition()}commit(){if(!this.isInEditMode())return;super.commit(),this.disableEditMode();let t=this.#r,s=this.#r=this.#o().trimEnd();if(t===s)return;let r=m=>{this.#r=m,m?(this.#p(),this._uiManager.rebuild(this),this.#g()):this.remove()};this.addCommands({cmd:()=>{r(s)},undo:()=>{r(t)},mustExec:!1}),this.#g()}shouldGetKeyboardEvents(){return this.isInEditMode()}enterInEditMode(){this.enableEditMode(),this.editorDiv.focus()}dblclick(t){this.enterInEditMode()}keydown(t){t.target===this.div&&t.key==="Enter"&&(this.enterInEditMode(),t.preventDefault())}editorDivKeydown(t){k._keyboardManager.exec(this,t)}editorDivFocus(t){this.isEditing=!0}editorDivBlur(t){this.isEditing=!1}editorDivInput(t){this.parent.div.classList.toggle("freetextEditing",this.isEmpty())}disableEditing(){this.editorDiv.setAttribute("role","comment"),this.editorDiv.removeAttribute("aria-multiline")}enableEditing(){this.editorDiv.setAttribute("role","textbox"),this.editorDiv.setAttribute("aria-multiline",!0)}render(){if(this.div)return this.div;let t,s;this.width&&(t=this.x,s=this.y),super.render(),this.editorDiv=document.createElement("div"),this.editorDiv.className="internal",this.editorDiv.setAttribute("id",this.#l),this.editorDiv.setAttribute("data-l10n-id","pdfjs-free-text"),this.enableEditing(),H.AnnotationEditor._l10nPromise.get("pdfjs-free-text-default-content").then((m=>this.editorDiv?.setAttribute("default-content",m))),this.editorDiv.contentEditable=!0;let{style:r}=this.editorDiv;if(r.fontSize=`calc(${this.#h}px * var(--scale-factor))`,r.color=this.#i,this.div.append(this.editorDiv),this.overlayDiv=document.createElement("div"),this.overlayDiv.classList.add("overlay","enabled"),this.div.append(this.overlayDiv),(0,N.bindEvents)(this,this.div,["dblclick","keydown"]),this.width){let[m,y]=this.parentDimensions;if(this.annotationElementId){let{position:b}=this.#d,[R,L]=this.getInitialTranslation();[R,L]=this.pageTranslationToScreen(R,L);let[I,B]=this.pageDimensions,[X,Z]=this.pageTranslation,nt,G;switch(this.rotation){case 0:nt=t+(b[0]-X)/I,G=s+this.height-(b[1]-Z)/B;break;case 90:nt=t+(b[0]-X)/I,G=s-(b[1]-Z)/B,[R,L]=[L,-R];break;case 180:nt=t-this.width+(b[0]-X)/I,G=s-(b[1]-Z)/B,[R,L]=[-R,-L];break;case 270:nt=t+(b[0]-X-this.height*B)/I,G=s+(b[1]-Z-this.width*I)/B,[R,L]=[-L,R]}this.setAt(nt*m,G*y,R,L)}else this.setAt(t*m,s*y,this.width*m,this.height*y);this.#p(),this._isDraggable=!0,this.editorDiv.contentEditable=!1}else this._isDraggable=!1,this.editorDiv.contentEditable=!0;return this.div}static#f(t){return(t.nodeType===Node.TEXT_NODE?t.nodeValue:t.innerText).replaceAll(F,"")}editorDivPaste(t){let s=t.clipboardData||window.clipboardData,{types:r}=s;if(r.length===1&&r[0]==="text/plain")return;t.preventDefault();let m=k.#A(s.getData("text")||"").replaceAll(F,`
5
+ `);if(!m)return;let y=window.getSelection();if(!y.rangeCount)return;this.editorDiv.normalize(),y.deleteFromDocument();let b=y.getRangeAt(0);if(!m.includes(`
6
+ `)){b.insertNode(document.createTextNode(m)),this.editorDiv.normalize(),y.collapseToStart();return}let{startContainer:R,startOffset:L}=b,I=[],B=[];if(R.nodeType===Node.TEXT_NODE){let nt=R.parentElement;if(B.push(R.nodeValue.slice(L).replaceAll(F,"")),nt!==this.editorDiv){let G=I;for(let O of this.editorDiv.childNodes)O!==nt?G.push(k.#f(O)):G=B}I.push(R.nodeValue.slice(0,L).replaceAll(F,""))}else if(R===this.editorDiv){let nt=I,G=0;for(let O of this.editorDiv.childNodes)G++===L&&(nt=B),nt.push(k.#f(O))}this.#r=`${I.join(`
7
+ `)}${m}${B.join(`
8
+ `)}`,this.#p();let X=new Range,Z=I.reduce(((nt,G)=>nt+G.length),0);for(let{firstChild:nt}of this.editorDiv.childNodes)if(nt.nodeType===Node.TEXT_NODE){let G=nt.nodeValue.length;if(Z<=G){X.setStart(nt,Z),X.setEnd(nt,Z);break}Z-=G}y.removeAllRanges(),y.addRange(X)}#p(){if(this.editorDiv.replaceChildren(),this.#r)for(let t of this.#r.split(`
9
+ `)){let s=document.createElement("div");s.append(t?document.createTextNode(t):document.createElement("br")),this.editorDiv.append(s)}}#m(){return this.#r.replaceAll("\xA0"," ")}static#A(t){return t.replaceAll(" ","\xA0")}get contentDiv(){return this.editorDiv}static deserialize(t,s,r){let m=null;if(t instanceof W.FreeTextAnnotationElement){let{data:{defaultAppearanceData:{fontSize:b,fontColor:R},rect:L,rotation:I,id:B},textContent:X,textPosition:Z,parent:{page:{pageNumber:nt}}}=t;if(!X||X.length===0)return null;m=t={annotationType:_.AnnotationEditorType.FREETEXT,color:Array.from(R),fontSize:b,value:X.join(`
10
+ `),position:Z,pageIndex:nt-1,rect:L,rotation:I,id:B,deleted:!1}}let y=super.deserialize(t,s,r);return y.#h=t.fontSize,y.#i=_.Util.makeHexColor(...t.color),y.#r=k.#A(t.value),y.annotationElementId=t.id||null,y.#d=m,y}serialize(t=!1){if(this.isEmpty())return null;if(this.deleted)return{pageIndex:this.pageIndex,id:this.annotationElementId,deleted:!0};let s=k._internalPadding*this.parentScale,r=this.getRect(s,s),m=H.AnnotationEditor._colorManager.convert(this.isAttachedToDOM?getComputedStyle(this.editorDiv).color:this.#i),y={annotationType:_.AnnotationEditorType.FREETEXT,color:m,fontSize:this.#h,value:this.#m(),pageIndex:this.pageIndex,rect:r,rotation:this.rotation,structTreeParentId:this._structTreeParentId};return t?y:this.annotationElementId&&!this.#b(y)?null:(y.id=this.annotationElementId,y)}#b(t){let{value:s,fontSize:r,color:m,pageIndex:y}=this.#d;return this._hasBeenMoved||t.value!==s||t.fontSize!==r||t.color.some(((b,R)=>b!==m[R]))||t.pageIndex!==y}}var M=j(61),f=j(259),i=j(419);class h extends H.AnnotationEditor{#t=null;#e=0;#s;#n=null;#a=null;#i=null;#r=null;#l=0;#h=null;#d=null;#u=null;#c=!1;#o=this.#S.bind(this);#g=null;#f;#p=null;#m="";#A;#b="";static _defaultColor=null;static _defaultOpacity=1;static _defaultThickness=12;static _l10nPromise;static _type="highlight";static _editorType=_.AnnotationEditorType.HIGHLIGHT;static _freeHighlightId=-1;static _freeHighlight=null;static _freeHighlightClipId="";static get _keyboardManager(){let t=h.prototype;return(0,_.shadow)(this,"_keyboardManager",new N.KeyboardManager([[["ArrowLeft","mac+ArrowLeft"],t._moveCaret,{args:[0]}],[["ArrowRight","mac+ArrowRight"],t._moveCaret,{args:[1]}],[["ArrowUp","mac+ArrowUp"],t._moveCaret,{args:[2]}],[["ArrowDown","mac+ArrowDown"],t._moveCaret,{args:[3]}]]))}constructor(t){super({...t,name:"highlightEditor"}),this.color=t.color||h._defaultColor,this.#A=t.thickness||h._defaultThickness,this.#f=t.opacity||h._defaultOpacity,this.#s=t.boxes||null,this.#b=t.methodOfCreation||"",this.#m=t.text||"",this._isDraggable=!1,t.highlightId>-1?(this.#c=!0,this.#E(t),this.#w()):(this.#t=t.anchorNode,this.#e=t.anchorOffset,this.#r=t.focusNode,this.#l=t.focusOffset,this.#_(),this.#w(),this.rotate(this.rotation))}get telemetryInitialData(){return{action:"added",type:this.#c?"free_highlight":"highlight",color:this._uiManager.highlightColorNames.get(this.color),thickness:this.#A,methodOfCreation:this.#b}}get telemetryFinalData(){return{type:"highlight",color:this._uiManager.highlightColorNames.get(this.color)}}static computeTelemetryFinalData(t){return{numberOfColors:t.get("color").size}}#_(){let t=new M.Outliner(this.#s,.001);this.#d=t.getOutlines(),{x:this.x,y:this.y,width:this.width,height:this.height}=this.#d.box;let s=new M.Outliner(this.#s,.0025,.001,this._uiManager.direction==="ltr");this.#i=s.getOutlines();let{lastPoint:r}=this.#i.box;this.#g=[(r[0]-this.x)/this.width,(r[1]-this.y)/this.height]}#E({highlightOutlines:t,highlightId:s,clipPathId:r}){if(this.#d=t,this.#i=t.getNewOutline(this.#A/2+1.5,.0025),s>=0)this.#u=s,this.#n=r,this.parent.drawLayer.finalizeLine(s,t),this.#p=this.parent.drawLayer.highlightOutline(this.#i);else if(this.parent){let I=this.parent.viewport.rotation;this.parent.drawLayer.updateLine(this.#u,t),this.parent.drawLayer.updateBox(this.#u,h.#x(this.#d.box,(I-this.rotation+360)%360)),this.parent.drawLayer.updateLine(this.#p,this.#i),this.parent.drawLayer.updateBox(this.#p,h.#x(this.#i.box,I))}let{x:m,y,width:b,height:R}=t.box;switch(this.rotation){case 0:this.x=m,this.y=y,this.width=b,this.height=R;break;case 90:{let[I,B]=this.parentDimensions;this.x=y,this.y=1-m,this.width=b*B/I,this.height=R*I/B;break}case 180:this.x=1-m,this.y=1-y,this.width=b,this.height=R;break;case 270:{let[I,B]=this.parentDimensions;this.x=1-y,this.y=m,this.width=b*B/I,this.height=R*I/B;break}}let{lastPoint:L}=this.#i.box;this.#g=[(L[0]-m)/b,(L[1]-y)/R]}static initialize(t,s){H.AnnotationEditor.initialize(t,s),h._defaultColor||=s.highlightColors?.values().next().value||"#fff066"}static updateDefaultParams(t,s){switch(t){case _.AnnotationEditorParamsType.HIGHLIGHT_DEFAULT_COLOR:h._defaultColor=s;break;case _.AnnotationEditorParamsType.HIGHLIGHT_THICKNESS:h._defaultThickness=s}}translateInPage(t,s){}get toolbarPosition(){return this.#g}updateParams(t,s){switch(t){case _.AnnotationEditorParamsType.HIGHLIGHT_COLOR:this.#k(s);break;case _.AnnotationEditorParamsType.HIGHLIGHT_THICKNESS:this.#F(s)}}static get defaultPropertiesToUpdate(){return[[_.AnnotationEditorParamsType.HIGHLIGHT_DEFAULT_COLOR,h._defaultColor],[_.AnnotationEditorParamsType.HIGHLIGHT_THICKNESS,h._defaultThickness]]}get propertiesToUpdate(){return[[_.AnnotationEditorParamsType.HIGHLIGHT_COLOR,this.color||h._defaultColor],[_.AnnotationEditorParamsType.HIGHLIGHT_THICKNESS,this.#A||h._defaultThickness],[_.AnnotationEditorParamsType.HIGHLIGHT_FREE,this.#c]]}#k(t){let s=m=>{this.color=m,this.parent?.drawLayer.changeColor(this.#u,m),this.#a?.updateColor(m)},r=this.color;this.addCommands({cmd:s.bind(this,t),undo:s.bind(this,r),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:_.AnnotationEditorParamsType.HIGHLIGHT_COLOR,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"color_changed",color:this._uiManager.highlightColorNames.get(t)},!0)}#F(t){let s=this.#A,r=m=>{this.#A=m,this.#y(m)};this.addCommands({cmd:r.bind(this,t),undo:r.bind(this,s),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:_.AnnotationEditorParamsType.INK_THICKNESS,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"thickness_changed",thickness:t},!0)}async addEditToolbar(){let t=await super.addEditToolbar();return t?(this._uiManager.highlightColors&&(this.#a=new f.ColorPicker({editor:this}),t.addColorPicker(this.#a)),t):null}disableEditing(){super.disableEditing(),this.div.classList.toggle("disabled",!0)}enableEditing(){super.enableEditing(),this.div.classList.toggle("disabled",!1)}fixAndSetPosition(){return super.fixAndSetPosition(this.#T())}getBaseTranslation(){return[0,0]}getRect(t,s){return super.getRect(t,s,this.#T())}onceAdded(){this.parent.addUndoableEditor(this),this.div.focus()}remove(){this.#v(),this._reportTelemetry({action:"deleted"}),super.remove()}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(this.#w(),this.isAttachedToDOM||this.parent.add(this)))}setParent(t){let s=!1;this.parent&&!t?this.#v():t&&(this.#w(t),s=!this.parent&&this.div?.classList.contains("selectedEditor")),super.setParent(t),this.show(this._isVisible),s&&this.select()}#y(t){if(!this.#c)return;this.#E({highlightOutlines:this.#d.getNewOutline(t/2)}),this.fixAndSetPosition();let[s,r]=this.parentDimensions;this.setDims(this.width*s,this.height*r)}#v(){this.#u!==null&&this.parent&&(this.parent.drawLayer.remove(this.#u),this.#u=null,this.parent.drawLayer.remove(this.#p),this.#p=null)}#w(t=this.parent){this.#u===null&&({id:this.#u,clipPathId:this.#n}=t.drawLayer.highlight(this.#d,this.color,this.#f),this.#p=t.drawLayer.highlightOutline(this.#i),this.#h&&(this.#h.style.clipPath=this.#n))}static#x({x:t,y:s,width:r,height:m},y){switch(y){case 90:return{x:1-s-m,y:t,width:m,height:r};case 180:return{x:1-t-r,y:1-s-m,width:r,height:m};case 270:return{x:s,y:1-t-r,width:m,height:r}}return{x:t,y:s,width:r,height:m}}rotate(t){let{drawLayer:s}=this.parent,r;this.#c?(t=(t-this.rotation+360)%360,r=h.#x(this.#d.box,t)):r=h.#x(this,t),s.rotate(this.#u,t),s.rotate(this.#p,t),s.updateBox(this.#u,r),s.updateBox(this.#p,h.#x(this.#i.box,t))}render(){if(this.div)return this.div;let t=super.render();this.#m&&(t.setAttribute("aria-label",this.#m),t.setAttribute("role","mark")),this.#c?t.classList.add("free"):this.div.addEventListener("keydown",this.#o);let s=this.#h=document.createElement("div");t.append(s),s.setAttribute("aria-hidden","true"),s.className="internal",s.style.clipPath=this.#n;let[r,m]=this.parentDimensions;return this.setDims(this.width*r,this.height*m),(0,N.bindEvents)(this,this.#h,["pointerover","pointerleave"]),this.enableEditing(),t}pointerover(){this.parent.drawLayer.addClass(this.#p,"hovered")}pointerleave(){this.parent.drawLayer.removeClass(this.#p,"hovered")}#S(t){h._keyboardManager.exec(this,t)}_moveCaret(t){switch(this.parent.unselect(this),t){case 0:case 2:this.#M(!0);break;case 1:case 3:this.#M(!1)}}#M(t){if(!this.#t)return;let s=window.getSelection();t?s.setPosition(this.#t,this.#e):s.setPosition(this.#r,this.#l)}select(){super.select(),this.#p&&(this.parent?.drawLayer.removeClass(this.#p,"hovered"),this.parent?.drawLayer.addClass(this.#p,"selected"))}unselect(){super.unselect(),this.#p&&(this.parent?.drawLayer.removeClass(this.#p,"selected"),this.#c||this.#M(!1))}get _mustFixPosition(){return!this.#c}show(t=this._isVisible){super.show(t),this.parent&&(this.parent.drawLayer.show(this.#u,t),this.parent.drawLayer.show(this.#p,t))}#T(){return this.#c?this.rotation:0}#L(){if(this.#c)return null;let[t,s]=this.pageDimensions,r=this.#s,m=new Array(8*r.length),y=0;for(let{x:b,y:R,width:L,height:I}of r){let B=b*t,X=(1-R-I)*s;m[y]=m[y+4]=B,m[y+1]=m[y+3]=X,m[y+2]=m[y+6]=B+L*t,m[y+5]=m[y+7]=X+I*s,y+=8}return m}#R(t){return this.#d.serialize(t,this.#T())}static startHighlighting(t,s,{target:r,x:m,y}){let{x:b,y:R,width:L,height:I}=r.getBoundingClientRect(),B=G=>{this.#I(t,G)},X={capture:!0,passive:!1},Z=G=>{G.preventDefault(),G.stopPropagation()},nt=G=>{r.removeEventListener("pointermove",B),window.removeEventListener("blur",nt),window.removeEventListener("pointerup",nt),window.removeEventListener("pointerdown",Z,X),window.removeEventListener("contextmenu",i.noContextMenu),this.#P(t,G)};window.addEventListener("blur",nt),window.addEventListener("pointerup",nt),window.addEventListener("pointerdown",Z,X),window.addEventListener("contextmenu",i.noContextMenu),r.addEventListener("pointermove",B),this._freeHighlight=new M.FreeOutliner({x:m,y},[b,R,L,I],t.scale,this._defaultThickness/2,s,.001),{id:this._freeHighlightId,clipPathId:this._freeHighlightClipId}=t.drawLayer.highlight(this._freeHighlight,this._defaultColor,this._defaultOpacity,!0)}static#I(t,s){this._freeHighlight.add(s)&&t.drawLayer.updatePath(this._freeHighlightId,this._freeHighlight)}static#P(t,s){this._freeHighlight.isEmpty()?t.drawLayer.removeFreeHighlight(this._freeHighlightId):t.createAndAddNewEditor(s,!1,{highlightId:this._freeHighlightId,highlightOutlines:this._freeHighlight.getOutlines(),clipPathId:this._freeHighlightClipId,methodOfCreation:"main_toolbar"}),this._freeHighlightId=-1,this._freeHighlight=null,this._freeHighlightClipId=""}static deserialize(t,s,r){let m=super.deserialize(t,s,r),{rect:[y,b,R,L],color:I,quadPoints:B}=t;m.color=_.Util.makeHexColor(...I),m.#f=t.opacity;let[X,Z]=m.pageDimensions;m.width=(R-y)/X,m.height=(L-b)/Z;let nt=m.#s=[];for(let G=0;G<B.length;G+=8)nt.push({x:(B[4]-R)/X,y:(L-(1-B[G+5]))/Z,width:(B[G+2]-B[G])/X,height:(B[G+5]-B[G+1])/Z});return m.#_(),m}serialize(t=!1){if(this.isEmpty()||t)return null;let s=this.getRect(0,0),r=H.AnnotationEditor._colorManager.convert(this.color);return{annotationType:_.AnnotationEditorType.HIGHLIGHT,color:r,opacity:this.#f,thickness:this.#A,quadPoints:this.#L(),outlines:this.#R(s),pageIndex:this.pageIndex,rect:s,rotation:this.#T(),structTreeParentId:this._structTreeParentId}}static canCreateNewEmptyEditor(){return!1}}class w extends H.AnnotationEditor{#t=0;#e=0;#s=this.canvasPointermove.bind(this);#n=this.canvasPointerleave.bind(this);#a=this.canvasPointerup.bind(this);#i=this.canvasPointerdown.bind(this);#r=null;#l=new Path2D;#h=!1;#d=!1;#u=!1;#c=null;#o=0;#g=0;#f=null;static _defaultColor=null;static _defaultOpacity=1;static _defaultThickness=1;static _type="ink";static _editorType=_.AnnotationEditorType.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,s){H.AnnotationEditor.initialize(t,s)}static updateDefaultParams(t,s){switch(t){case _.AnnotationEditorParamsType.INK_THICKNESS:w._defaultThickness=s;break;case _.AnnotationEditorParamsType.INK_COLOR:w._defaultColor=s;break;case _.AnnotationEditorParamsType.INK_OPACITY:w._defaultOpacity=s/100}}updateParams(t,s){switch(t){case _.AnnotationEditorParamsType.INK_THICKNESS:this.#p(s);break;case _.AnnotationEditorParamsType.INK_COLOR:this.#m(s);break;case _.AnnotationEditorParamsType.INK_OPACITY:this.#A(s)}}static get defaultPropertiesToUpdate(){return[[_.AnnotationEditorParamsType.INK_THICKNESS,w._defaultThickness],[_.AnnotationEditorParamsType.INK_COLOR,w._defaultColor||H.AnnotationEditor._defaultLineColor],[_.AnnotationEditorParamsType.INK_OPACITY,Math.round(100*w._defaultOpacity)]]}get propertiesToUpdate(){return[[_.AnnotationEditorParamsType.INK_THICKNESS,this.thickness||w._defaultThickness],[_.AnnotationEditorParamsType.INK_COLOR,this.color||w._defaultColor||H.AnnotationEditor._defaultLineColor],[_.AnnotationEditorParamsType.INK_OPACITY,Math.round(100*(this.opacity??w._defaultOpacity))]]}#p(t){let s=m=>{this.thickness=m,this.#N()},r=this.thickness;this.addCommands({cmd:s.bind(this,t),undo:s.bind(this,r),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:_.AnnotationEditorParamsType.INK_THICKNESS,overwriteIfSameType:!0,keepUndo:!0})}#m(t){let s=m=>{this.color=m,this.#S()},r=this.color;this.addCommands({cmd:s.bind(this,t),undo:s.bind(this,r),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:_.AnnotationEditorParamsType.INK_COLOR,overwriteIfSameType:!0,keepUndo:!0})}#A(t){let s=m=>{this.opacity=m,this.#S()};t/=100;let r=this.opacity;this.addCommands({cmd:s.bind(this,t),undo:s.bind(this,r),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:_.AnnotationEditorParamsType.INK_OPACITY,overwriteIfSameType:!0,keepUndo:!0})}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(this.canvas||(this.#T(),this.#L()),this.isAttachedToDOM||(this.parent.add(this),this.#R()),this.#N()))}remove(){this.canvas!==null&&(this.isEmpty()||this.commit(),this.canvas.width=this.canvas.height=0,this.canvas.remove(),this.canvas=null,this.#r&&(clearTimeout(this.#r),this.#r=null),this.#c.disconnect(),this.#c=null,super.remove())}setParent(t){!this.parent&&t?this._uiManager.removeShouldRescale(this):this.parent&&t===null&&this._uiManager.addShouldRescale(this),super.setParent(t)}onScaleChanging(){let[t,s]=this.parentDimensions,r=this.width*t,m=this.height*s;this.setDimensions(r,m)}enableEditMode(){!this.#h&&this.canvas!==null&&(super.enableEditMode(),this._isDraggable=!1,this.canvas.addEventListener("pointerdown",this.#i))}disableEditMode(){this.isInEditMode()&&this.canvas!==null&&(super.disableEditMode(),this._isDraggable=!this.isEmpty(),this.div.classList.remove("editing"),this.canvas.removeEventListener("pointerdown",this.#i))}onceAdded(){this._isDraggable=!this.isEmpty()}isEmpty(){return this.paths.length===0||this.paths.length===1&&this.paths[0].length===0}#b(){let{parentRotation:t,parentDimensions:[s,r]}=this;switch(t){case 90:return[0,r,r,s];case 180:return[s,r,s,r];case 270:return[s,0,r,s];default:return[0,0,s,r]}}#_(){let{ctx:t,color:s,opacity:r,thickness:m,parentScale:y,scaleFactor:b}=this;t.lineWidth=m*y/b,t.lineCap="round",t.lineJoin="round",t.miterLimit=10,t.strokeStyle=`${s}${(0,N.opacityToHex)(r)}`}#E(t,s){this.canvas.addEventListener("contextmenu",i.noContextMenu),this.canvas.addEventListener("pointerleave",this.#n),this.canvas.addEventListener("pointermove",this.#s),this.canvas.addEventListener("pointerup",this.#a),this.canvas.removeEventListener("pointerdown",this.#i),this.isEditing=!0,this.#u||(this.#u=!0,this.#R(),this.thickness||=w._defaultThickness,this.color||=w._defaultColor||H.AnnotationEditor._defaultLineColor,this.opacity??=w._defaultOpacity),this.currentPath.push([t,s]),this.#d=!1,this.#_(),this.#f=()=>{this.#v(),this.#f&&window.requestAnimationFrame(this.#f)},window.requestAnimationFrame(this.#f)}#k(t,s){let[r,m]=this.currentPath.at(-1);if(this.currentPath.length>1&&t===r&&s===m)return;let y=this.currentPath,b=this.#l;y.push([t,s]),this.#d=!0,y.length<=2?(b.moveTo(...y[0]),b.lineTo(t,s)):(y.length===3&&(this.#l=b=new Path2D,b.moveTo(...y[0])),this.#w(b,...y.at(-3),...y.at(-2),t,s))}#F(){if(this.currentPath.length===0)return;let t=this.currentPath.at(-1);this.#l.lineTo(...t)}#y(t,s){this.#f=null,t=Math.min(Math.max(t,0),this.canvas.width),s=Math.min(Math.max(s,0),this.canvas.height),this.#k(t,s),this.#F();let r;if(this.currentPath.length!==1)r=this.#x();else{let b=[t,s];r=[[b,b.slice(),b.slice(),b]]}let m=this.#l,y=this.currentPath;this.currentPath=[],this.#l=new Path2D,this.addCommands({cmd:()=>{this.allRawPaths.push(y),this.paths.push(r),this.bezierPath2D.push(m),this._uiManager.rebuild(this)},undo:()=>{this.allRawPaths.pop(),this.paths.pop(),this.bezierPath2D.pop(),this.paths.length===0?this.remove():(this.canvas||(this.#T(),this.#L()),this.#N())},mustExec:!0})}#v(){if(!this.#d)return;this.#d=!1;let t=Math.ceil(this.thickness*this.parentScale),s=this.currentPath.slice(-3),r=s.map((b=>b[0])),m=s.map((b=>b[1])),{ctx:y}=(Math.min(...r),Math.max(...r),Math.min(...m),Math.max(...m),this);y.save(),y.clearRect(0,0,this.canvas.width,this.canvas.height);for(let b of this.bezierPath2D)y.stroke(b);y.stroke(this.#l),y.restore()}#w(t,s,r,m,y,b,R){let L=(s+m)/2,I=(r+y)/2,B=(m+b)/2,X=(y+R)/2;t.bezierCurveTo(L+2*(m-L)/3,I+2*(y-I)/3,B+2*(m-B)/3,X+2*(y-X)/3,B,X)}#x(){let t=this.currentPath;if(t.length<=2)return[[t[0],t[0],t.at(-1),t.at(-1)]];let s=[],r,[m,y]=t[0];for(r=1;r<t.length-2;r++){let[Z,nt]=t[r],[G,O]=t[r+1],z=(Z+G)/2,J=(nt+O)/2,st=[m+2*(Z-m)/3,y+2*(nt-y)/3],et=[z+2*(Z-z)/3,J+2*(nt-J)/3];s.push([[m,y],st,et,[z,J]]),[m,y]=[z,J]}let[b,R]=t[r],[L,I]=t[r+1],B=[m+2*(b-m)/3,y+2*(R-y)/3],X=[L+2*(b-L)/3,I+2*(R-I)/3];return s.push([[m,y],B,X,[L,I]]),s}#S(){if(this.isEmpty()){this.#P();return}this.#_();let{canvas:t,ctx:s}=this;s.setTransform(1,0,0,1,0,0),s.clearRect(0,0,t.width,t.height),this.#P();for(let r of this.bezierPath2D)s.stroke(r)}commit(){this.#h||(super.commit(),this.isEditing=!1,this.disableEditMode(),this.setInForeground(),this.#h=!0,this.div.classList.add("disabled"),this.#N(!0),this.select(),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.#h&&(this.setInForeground(),t.preventDefault(),this.div.contains(document.activeElement)||this.div.focus({preventScroll:!0}),this.#E(t.offsetX,t.offsetY))}canvasPointermove(t){t.preventDefault(),this.#k(t.offsetX,t.offsetY)}canvasPointerup(t){t.preventDefault(),this.#M(t)}canvasPointerleave(t){this.#M(t)}#M(t){this.canvas.removeEventListener("pointerleave",this.#n),this.canvas.removeEventListener("pointermove",this.#s),this.canvas.removeEventListener("pointerup",this.#a),this.canvas.addEventListener("pointerdown",this.#i),this.#r&&clearTimeout(this.#r),this.#r=setTimeout((()=>{this.#r=null,this.canvas.removeEventListener("contextmenu",i.noContextMenu)}),10),this.#y(t.offsetX,t.offsetY),this.addToAnnotationStorage(),this.setInBackground()}#T(){this.canvas=document.createElement("canvas"),this.canvas.width=this.canvas.height=0,this.canvas.className="inkEditorCanvas",this.canvas.setAttribute("data-l10n-id","pdfjs-ink-canvas"),this.div.append(this.canvas),this.ctx=this.canvas.getContext("2d")}#L(){this.#c=new ResizeObserver((t=>{let s=t[0].contentRect;s.width&&s.height&&this.setDimensions(s.width,s.height)})),this.#c.observe(this.div)}get isResizable(){return!this.isEmpty()&&this.#h}render(){if(this.div)return this.div;let t,s;this.width&&(t=this.x,s=this.y),super.render(),this.div.setAttribute("data-l10n-id","pdfjs-ink");let[r,m,y,b]=this.#b();if(this.setAt(r,m,0,0),this.setDims(y,b),this.#T(),this.width){let[R,L]=this.parentDimensions;this.setAspectRatio(this.width*R,this.height*L),this.setAt(t*R,s*L,this.width*R,this.height*L),this.#u=!0,this.#R(),this.setDims(this.width*R,this.height*L),this.#S(),this.div.classList.add("disabled")}else this.div.classList.add("editing"),this.enableEditMode();return this.#L(),this.div}#R(){if(!this.#u)return;let[t,s]=this.parentDimensions;this.canvas.width=Math.ceil(this.width*t),this.canvas.height=Math.ceil(this.height*s),this.#P()}setDimensions(t,s){let r=Math.round(t),m=Math.round(s);if(this.#o===r&&this.#g===m)return;this.#o=r,this.#g=m,this.canvas.style.visibility="hidden";let[y,b]=this.parentDimensions;this.width=t/y,this.height=s/b,this.fixAndSetPosition(),this.#h&&this.#I(t,s),this.#R(),this.#S(),this.canvas.style.visibility="visible",this.fixDims()}#I(t,s){let r=this.#H(),m=(t-r)/this.#e,y=(s-r)/this.#t;this.scaleFactor=Math.min(m,y)}#P(){let t=this.#H()/2;this.ctx.setTransform(this.scaleFactor,0,0,this.scaleFactor,this.translationX*this.scaleFactor+t,this.translationY*this.scaleFactor+t)}static#D(t){let s=new Path2D;for(let r=0,m=t.length;r<m;r++){let[y,b,R,L]=t[r];r===0&&s.moveTo(...y),s.bezierCurveTo(b[0],b[1],R[0],R[1],L[0],L[1])}return s}static#j(t,s,r){let[m,y,b,R]=s;switch(r){case 0:for(let L=0,I=t.length;L<I;L+=2)t[L]+=m,t[L+1]=R-t[L+1];break;case 90:for(let L=0,I=t.length;L<I;L+=2){let B=t[L];t[L]=t[L+1]+m,t[L+1]=B+y}break;case 180:for(let L=0,I=t.length;L<I;L+=2)t[L]=b-t[L],t[L+1]+=y;break;case 270:for(let L=0,I=t.length;L<I;L+=2){let B=t[L];t[L]=b-t[L+1],t[L+1]=R-B}break;default:throw new Error("Invalid rotation")}return t}static#V(t,s,r){let[m,y,b,R]=s;switch(r){case 0:for(let L=0,I=t.length;L<I;L+=2)t[L]-=m,t[L+1]=R-t[L+1];break;case 90:for(let L=0,I=t.length;L<I;L+=2){let B=t[L];t[L]=t[L+1]-y,t[L+1]=B-m}break;case 180:for(let L=0,I=t.length;L<I;L+=2)t[L]=b-t[L],t[L+1]-=y;break;case 270:for(let L=0,I=t.length;L<I;L+=2){let B=t[L];t[L]=R-t[L+1],t[L+1]=b-B}break;default:throw new Error("Invalid rotation")}return t}#G(t,s,r,m){let y=[],b=this.thickness/2,R=t*s+b,L=t*r+b;for(let I of this.paths){let B=[],X=[];for(let Z=0,nt=I.length;Z<nt;Z++){let[G,O,z,J]=I[Z];if(G[0]===J[0]&&G[1]===J[1]&&nt===1){let e=t*G[0]+R,a=t*G[1]+L;B.push(e,a),X.push(e,a);break}let st=t*G[0]+R,et=t*G[1]+L,at=t*O[0]+R,rt=t*O[1]+L,$=t*z[0]+R,l=t*z[1]+L,g=t*J[0]+R,v=t*J[1]+L;Z===0&&(B.push(st,et),X.push(st,et)),B.push(at,rt,$,l,g,v),X.push(at,rt),Z===nt-1&&X.push(g,v)}y.push({bezier:w.#j(B,m,this.rotation),points:w.#j(X,m,this.rotation)})}return y}#z(){let t=1/0,s=-1/0,r=1/0,m=-1/0;for(let y of this.paths)for(let[b,R,L,I]of y){let B=_.Util.bezierBoundingBox(...b,...R,...L,...I);t=Math.min(t,B[0]),r=Math.min(r,B[1]),s=Math.max(s,B[2]),m=Math.max(m,B[3])}return[t,r,s,m]}#H(){return this.#h?Math.ceil(this.thickness*this.parentScale):0}#N(t=!1){if(this.isEmpty())return;if(!this.#h){this.#S();return}let s=this.#z(),r=this.#H();this.#e=Math.max(H.AnnotationEditor.MIN_SIZE,s[2]-s[0]),this.#t=Math.max(H.AnnotationEditor.MIN_SIZE,s[3]-s[1]);let m=Math.ceil(r+this.#e*this.scaleFactor),y=Math.ceil(r+this.#t*this.scaleFactor),[b,R]=this.parentDimensions;this.width=m/b,this.height=y/R,this.setAspectRatio(m,y);let L=this.translationX,I=this.translationY;this.translationX=-s[0],this.translationY=-s[1],this.#R(),this.#S(),this.#o=m,this.#g=y,this.setDims(m,y);let B=t?r/this.scaleFactor/2:0;this.translate(L-this.translationX-B,I-this.translationY-B)}static deserialize(t,s,r){if(t instanceof W.InkAnnotationElement)return null;let m=super.deserialize(t,s,r);m.thickness=t.thickness,m.color=_.Util.makeHexColor(...t.color),m.opacity=t.opacity;let[y,b]=m.pageDimensions,R=m.width*y,L=m.height*b,I=m.parentScale,B=t.thickness/2;m.#h=!0,m.#o=Math.round(R),m.#g=Math.round(L);let{paths:X,rect:Z,rotation:nt}=t;for(let{bezier:O}of X){O=w.#V(O,Z,nt);let z=[];m.paths.push(z);let J=I*(O[0]-B),st=I*(O[1]-B);for(let at=2,rt=O.length;at<rt;at+=6){let $=I*(O[at]-B),l=I*(O[at+1]-B),g=I*(O[at+2]-B),v=I*(O[at+3]-B),e=I*(O[at+4]-B),a=I*(O[at+5]-B);z.push([[J,st],[$,l],[g,v],[e,a]]),J=e,st=a}let et=this.#D(z);m.bezierPath2D.push(et)}let G=m.#z();return m.#e=Math.max(H.AnnotationEditor.MIN_SIZE,G[2]-G[0]),m.#t=Math.max(H.AnnotationEditor.MIN_SIZE,G[3]-G[1]),m.#I(R,L),m}serialize(){if(this.isEmpty())return null;let t=this.getRect(0,0),s=H.AnnotationEditor._colorManager.convert(this.ctx.strokeStyle);return{annotationType:_.AnnotationEditorType.INK,color:s,thickness:this.thickness,opacity:this.opacity,paths:this.#G(this.scaleFactor/this.parentScale,this.translationX,this.translationY,t),pageIndex:this.pageIndex,rect:t,rotation:this.rotation,structTreeParentId:this._structTreeParentId}}}class S extends H.AnnotationEditor{#t=null;#e=null;#s=null;#n=null;#a=null;#i="";#r=null;#l=null;#h=null;#d=!1;#u=!1;static _type="stamp";static _editorType=_.AnnotationEditorType.STAMP;constructor(t){super({...t,name:"stampEditor"}),this.#n=t.bitmapUrl,this.#a=t.bitmapFile}static initialize(t,s){H.AnnotationEditor.initialize(t,s)}static get supportedTypes(){return(0,_.shadow)(this,"supportedTypes",["apng","avif","bmp","gif","jpeg","png","svg+xml","webp","x-icon"].map((t=>`image/${t}`)))}static get supportedTypesStr(){return(0,_.shadow)(this,"supportedTypesStr",this.supportedTypes.join(","))}static isHandlingMimeForPasting(t){return this.supportedTypes.includes(t)}static paste(t,s){s.pasteEditor(_.AnnotationEditorType.STAMP,{bitmapFile:t.getAsFile()})}#c(t,s=!1){t?(this.#t=t.bitmap,s||(this.#e=t.id,this.#d=t.isSvg),t.file&&(this.#i=t.file.name),this.#f()):this.remove()}#o(){this.#s=null,this._uiManager.enableWaiting(!1),this.#r&&this.div.focus()}#g(){if(this.#e){this._uiManager.enableWaiting(!0),this._uiManager.imageManager.getFromId(this.#e).then((s=>this.#c(s,!0))).finally((()=>this.#o()));return}if(this.#n){let s=this.#n;this.#n=null,this._uiManager.enableWaiting(!0),this.#s=this._uiManager.imageManager.getFromUrl(s).then((r=>this.#c(r))).finally((()=>this.#o()));return}if(this.#a){let s=this.#a;this.#a=null,this._uiManager.enableWaiting(!0),this.#s=this._uiManager.imageManager.getFromFile(s).then((r=>this.#c(r))).finally((()=>this.#o()));return}let t=document.createElement("input");t.type="file",t.accept=S.supportedTypesStr,this.#s=new Promise((s=>{t.addEventListener("change",(async()=>{if(t.files&&t.files.length!==0){this._uiManager.enableWaiting(!0);let r=await this._uiManager.imageManager.getFromFile(t.files[0]);this.#c(r)}else this.remove();s()})),t.addEventListener("cancel",(()=>{this.remove(),s()}))})).finally((()=>this.#o())),t.click()}remove(){this.#e&&(this.#t=null,this._uiManager.imageManager.deleteId(this.#e),this.#r?.remove(),this.#r=null,this.#l?.disconnect(),this.#l=null,this.#h&&(clearTimeout(this.#h),this.#h=null)),super.remove()}rebuild(){this.parent?(super.rebuild(),this.div!==null&&(this.#e&&this.#r===null&&this.#g(),this.isAttachedToDOM||this.parent.add(this))):this.#e&&this.#g()}onceAdded(){this._isDraggable=!0,this.div.focus()}isEmpty(){return!(this.#s||this.#t||this.#n||this.#a||this.#e)}get isResizable(){return!0}render(){if(this.div)return this.div;let t,s;if(this.width&&(t=this.x,s=this.y),super.render(),this.div.hidden=!0,this.addAltTextButton(),this.#t?this.#f():this.#g(),this.width){let[r,m]=this.parentDimensions;this.setAt(t*r,s*m,this.width*r,this.height*m)}return this.div}#f(){let{div:t}=this,{width:s,height:r}=this.#t,[m,y]=this.pageDimensions,b=.75;if(this.width)s=this.width*m,r=this.height*y;else if(s>b*m||r>b*y){let B=Math.min(b*m/s,b*y/r);s*=B,r*=B}let[R,L]=this.parentDimensions;this.setDims(s*R/m,r*L/y),this._uiManager.enableWaiting(!1);let I=this.#r=document.createElement("canvas");t.append(I),t.hidden=!1,this.#A(s,r),this.#_(),this.#u||(this.parent.addUndoableEditor(this),this.#u=!0),this._reportTelemetry({action:"inserted_image"}),this.#i&&I.setAttribute("aria-label",this.#i)}#p(t,s){let[r,m]=this.parentDimensions;this.width=t/r,this.height=s/m,this.setDims(t,s),this._initialOptions?.isCentered?this.center():this.fixAndSetPosition(),this._initialOptions=null,this.#h!==null&&clearTimeout(this.#h),this.#h=setTimeout((()=>{this.#h=null,this.#A(t,s)}),200)}#m(t,s){let{width:r,height:m}=this.#t,y=r,b=m,R=this.#t;for(;y>2*t||b>2*s;){let L=y,I=b;y>2*t&&(y=y>=16384?Math.floor(y/2)-1:Math.ceil(y/2)),b>2*s&&(b=b>=16384?Math.floor(b/2)-1:Math.ceil(b/2));let B=new OffscreenCanvas(y,b);B.getContext("2d").drawImage(R,0,0,L,I,0,0,y,b),R=B.transferToImageBitmap()}return R}#A(t,s){t=Math.ceil(t),s=Math.ceil(s);let r=this.#r;if(!r||r.width===t&&r.height===s)return;r.width=t,r.height=s;let m=this.#d?this.#t:this.#m(t,s);if(this._uiManager.hasMLManager&&!this.hasAltText()){let b=new OffscreenCanvas(t,s);b.getContext("2d").drawImage(m,0,0,m.width,m.height,0,0,t,s),b.convertToBlob().then((R=>{let L=new FileReader;L.onload=()=>{let I=L.result;this._uiManager.mlGuess({service:"image-to-text",request:{imageData:I}}).then((B=>{let X=B?.output||"";this.parent&&X&&!this.hasAltText()&&(this.altTextData={altText:X,decorative:!1})}))},L.readAsDataURL(R)}))}let y=r.getContext("2d");y.filter=this._uiManager.hcmFilter,y.drawImage(m,0,0,m.width,m.height,0,0,t,s)}getImageForAltText(){return this.#r}#b(t){if(t){if(this.#d){let r=this._uiManager.imageManager.getSvgUrl(this.#e);if(r)return r}let s=document.createElement("canvas");return{width:s.width,height:s.height}=this.#t,s.getContext("2d").drawImage(this.#t,0,0),s.toDataURL()}if(this.#d){let[s,r]=this.pageDimensions,m=Math.round(this.width*s*i.PixelsPerInch.PDF_TO_CSS_UNITS),y=Math.round(this.height*r*i.PixelsPerInch.PDF_TO_CSS_UNITS),b=new OffscreenCanvas(m,y);return b.getContext("2d").drawImage(this.#t,0,0,this.#t.width,this.#t.height,0,0,m,y),b.transferToImageBitmap()}return structuredClone(this.#t)}#_(){this.#l=new ResizeObserver((t=>{let s=t[0].contentRect;s.width&&s.height&&this.#p(s.width,s.height)})),this.#l.observe(this.div)}static deserialize(t,s,r){if(t instanceof W.StampAnnotationElement)return null;let m=super.deserialize(t,s,r),{rect:y,bitmapUrl:b,bitmapId:R,isSvg:L,accessibilityData:I}=t;R&&r.imageManager.isValidId(R)?m.#e=R:m.#n=b,m.#d=L;let[B,X]=m.pageDimensions;return m.width=(y[2]-y[0])/B,m.height=(y[3]-y[1])/X,I&&(m.altTextData=I),m}serialize(t=!1,s=null){if(this.isEmpty())return null;let r={annotationType:_.AnnotationEditorType.STAMP,bitmapId:this.#e,pageIndex:this.pageIndex,rect:this.getRect(0,0),rotation:this.rotation,isSvg:this.#d,structTreeParentId:this._structTreeParentId};if(t)return r.bitmapUrl=this.#b(!0),r.accessibilityData=this.altTextData,r;let{decorative:m,altText:y}=this.altTextData;if(!m&&y&&(r.accessibilityData={type:"Figure",alt:y}),s===null)return r;s.stamps||=new Map;let b=this.#d?(r.rect[2]-r.rect[0])*(r.rect[3]-r.rect[1]):null;if(s.stamps.has(this.#e)){if(this.#d){let R=s.stamps.get(this.#e);b>R.area&&(R.area=b,R.serialized.bitmap.close(),R.serialized.bitmap=this.#b(!1))}}else s.stamps.set(this.#e,{area:b,serialized:r}),r.bitmap=this.#b(!1);return r}}class n{#t;#e=!1;#s=null;#n=null;#a=null;#i=null;#r=null;#l=new Map;#h=!1;#d=!1;#u=!1;#c=null;#o;static _initialized=!1;static#g=new Map([k,w,S,h].map((t=>[t._editorType,t])));constructor({uiManager:t,pageIndex:s,div:r,accessibilityManager:m,annotationLayer:y,drawLayer:b,textLayer:R,viewport:L,l10n:I}){let B=[...n.#g.values()];if(!n._initialized){n._initialized=!0;for(let X of B)X.initialize(I,t)}t.registerEditorTypes(B),this.#o=t,this.pageIndex=s,this.div=r,this.#t=m,this.#s=y,this.viewport=L,this.#c=R,this.drawLayer=b,this.#o.addLayer(this)}get isEmpty(){return this.#l.size===0}get isInvisible(){return this.isEmpty&&this.#o.getMode()===_.AnnotationEditorType.NONE}updateToolbar(t){this.#o.updateToolbar(t)}updateMode(t=this.#o.getMode()){switch(this.#b(),t){case _.AnnotationEditorType.NONE:this.disableTextSelection(),this.togglePointerEvents(!1),this.toggleAnnotationLayerPointerEvents(!0),this.disableClick();return;case _.AnnotationEditorType.INK:this.addInkEditorIfNeeded(!1),this.disableTextSelection(),this.togglePointerEvents(!0),this.disableClick();break;case _.AnnotationEditorType.HIGHLIGHT:this.enableTextSelection(),this.togglePointerEvents(!1),this.disableClick();break;default:this.disableTextSelection(),this.togglePointerEvents(!0),this.enableClick()}this.toggleAnnotationLayerPointerEvents(!1);let{classList:s}=this.div;for(let r of n.#g.values())s.toggle(`${r._type}Editing`,t===r._editorType);this.div.hidden=!1}hasTextLayer(t){return t===this.#c?.div}addInkEditorIfNeeded(t){if(this.#o.getMode()===_.AnnotationEditorType.INK){if(!t){for(let s of this.#l.values())if(s.isEmpty()){s.setInBackground();return}}this.createAndAddNewEditor({offsetX:0,offsetY:0},!1).setInBackground()}}setEditingState(t){this.#o.setEditingState(t)}addCommands(t){this.#o.addCommands(t)}togglePointerEvents(t=!1){this.div.classList.toggle("disabled",!t)}toggleAnnotationLayerPointerEvents(t=!1){this.#s?.div.classList.toggle("disabled",!t)}enable(){this.div.tabIndex=0,this.togglePointerEvents(!0);let t=new Set;for(let r of this.#l.values())r.enableEditing(),r.annotationElementId&&t.add(r.annotationElementId);if(!this.#s)return;let s=this.#s.getEditableAnnotations();for(let r of s){if(r.hide(),this.#o.isDeletedAnnotationElement(r.data.id)||t.has(r.data.id))continue;let m=this.deserialize(r);m&&(this.addOrRebuild(m),m.enableEditing())}}disable(){this.#u=!0,this.div.tabIndex=-1,this.togglePointerEvents(!1);let t=new Set;for(let r of this.#l.values())r.disableEditing(),r.annotationElementId&&r.serialize()===null?(this.getEditableAnnotation(r.annotationElementId)?.show(),r.remove()):t.add(r.annotationElementId);if(this.#s){let r=this.#s.getEditableAnnotations();for(let m of r){let{id:y}=m.data;t.has(y)||this.#o.isDeletedAnnotationElement(y)||m.show()}}this.#b(),this.isEmpty&&(this.div.hidden=!0);let{classList:s}=this.div;for(let r of n.#g.values())s.remove(`${r._type}Editing`);this.disableTextSelection(),this.toggleAnnotationLayerPointerEvents(!0),this.#u=!1}getEditableAnnotation(t){return this.#s?.getEditableAnnotation(t)||null}setActiveEditor(t){this.#o.getActive()!==t&&this.#o.setActiveEditor(t)}enableTextSelection(){this.div.tabIndex=-1,this.#c?.div&&!this.#i&&(this.#i=this.#f.bind(this),this.#c.div.addEventListener("pointerdown",this.#i),this.#c.div.classList.add("highlighting"))}disableTextSelection(){this.div.tabIndex=0,this.#c?.div&&this.#i&&(this.#c.div.removeEventListener("pointerdown",this.#i),this.#i=null,this.#c.div.classList.remove("highlighting"))}#f(t){if(this.#o.unselectAll(),t.target===this.#c.div){let{isMac:s}=_.FeatureTest.platform;if(t.button!==0||t.ctrlKey&&s)return;this.#o.showAllEditors("highlight",!0,!0),this.#c.div.classList.add("free"),h.startHighlighting(this,this.#o.direction==="ltr",t),this.#c.div.addEventListener("pointerup",(()=>{this.#c.div.classList.remove("free")}),{once:!0}),t.preventDefault()}}enableClick(){this.#a||(this.#a=this.pointerdown.bind(this),this.#n=this.pointerup.bind(this),this.div.addEventListener("pointerdown",this.#a),this.div.addEventListener("pointerup",this.#n))}disableClick(){this.#a&&(this.div.removeEventListener("pointerdown",this.#a),this.div.removeEventListener("pointerup",this.#n),this.#a=null,this.#n=null)}attach(t){this.#l.set(t.id,t);let{annotationElementId:s}=t;s&&this.#o.isDeletedAnnotationElement(s)&&this.#o.removeDeletedAnnotationElement(t)}detach(t){this.#l.delete(t.id),this.#t?.removePointerInTextLayer(t.contentDiv),!this.#u&&t.annotationElementId&&this.#o.addDeletedAnnotationElement(t)}remove(t){this.detach(t),this.#o.removeEditor(t),t.div.remove(),t.isAttachedToDOM=!1,this.#d||this.addInkEditorIfNeeded(!1)}changeParent(t){t.parent!==this&&(t.annotationElementId&&(this.#o.addDeletedAnnotationElement(t.annotationElementId),H.AnnotationEditor.deleteAnnotationElement(t),t.annotationElementId=null),this.attach(t),t.parent?.detach(t),t.setParent(this),t.div&&t.isAttachedToDOM&&(t.div.remove(),this.div.append(t.div)))}add(t){if(t.parent!==this||!t.isAttachedToDOM){if(this.changeParent(t),this.#o.addEditor(t),this.attach(t),!t.isAttachedToDOM){let s=t.render();this.div.append(s),t.isAttachedToDOM=!0}t.fixAndSetPosition(),t.onceAdded(),this.#o.addToAnnotationStorage(t),t._reportTelemetry(t.telemetryInitialData)}}moveEditorInDOM(t){if(!t.isAttachedToDOM)return;let{activeElement:s}=document;t.div.contains(s)&&!this.#r&&(t._focusEventsAllowed=!1,this.#r=setTimeout((()=>{this.#r=null,t.div.contains(document.activeElement)?t._focusEventsAllowed=!0:(t.div.addEventListener("focusin",(()=>{t._focusEventsAllowed=!0}),{once:!0}),s.focus())}),0)),t._structTreeParentId=this.#t?.moveElementInDOM(this.div,t.div,t.contentDiv,!0)}addOrRebuild(t){t.needsToBeRebuilt()?(t.parent||=this,t.rebuild(),t.show()):this.add(t)}addUndoableEditor(t){this.addCommands({cmd:()=>t._uiManager.rebuild(t),undo:()=>{t.remove()},mustExec:!1})}getNextId(){return this.#o.getId()}get#p(){return n.#g.get(this.#o.getMode())}#m(t){let s=this.#p;return s?new s.prototype.constructor(t):null}canCreateNewEmptyEditor(){return this.#p?.canCreateNewEmptyEditor()}pasteEditor(t,s){this.#o.updateToolbar(t),this.#o.updateMode(t);let{offsetX:r,offsetY:m}=this.#A(),y=this.getNextId(),b=this.#m({parent:this,id:y,x:r,y:m,uiManager:this.#o,isCentered:!0,...s});b&&this.add(b)}deserialize(t){return n.#g.get(t.annotationType??t.annotationEditorType)?.deserialize(t,this,this.#o)||null}createAndAddNewEditor(t,s,r={}){let m=this.getNextId(),y=this.#m({parent:this,id:m,x:t.offsetX,y:t.offsetY,uiManager:this.#o,isCentered:s,...r});return y&&this.add(y),y}#A(){let{x:t,y:s,width:r,height:m}=this.div.getBoundingClientRect(),y=Math.max(0,t),b=Math.max(0,s),R=(y+Math.min(window.innerWidth,t+r))/2-t,L=(b+Math.min(window.innerHeight,s+m))/2-s,[I,B]=this.viewport.rotation%180==0?[R,L]:[L,R];return{offsetX:I,offsetY:B}}addNewEditor(){this.createAndAddNewEditor(this.#A(),!0)}setSelected(t){this.#o.setSelected(t)}toggleSelected(t){this.#o.toggleSelected(t)}isSelected(t){return this.#o.isSelected(t)}unselect(t){this.#o.unselect(t)}pointerup(t){let{isMac:s}=_.FeatureTest.platform;!(t.button!==0||t.ctrlKey&&s)&&t.target===this.div&&this.#h&&(this.#h=!1,this.#e?this.#o.getMode()!==_.AnnotationEditorType.STAMP?this.createAndAddNewEditor(t,!1):this.#o.unselectAll():this.#e=!0)}pointerdown(t){if(this.#o.getMode()===_.AnnotationEditorType.HIGHLIGHT&&this.enableTextSelection(),this.#h){this.#h=!1;return}let{isMac:s}=_.FeatureTest.platform;if(t.button!==0||t.ctrlKey&&s||t.target!==this.div)return;this.#h=!0;let r=this.#o.getActive();this.#e=!r||r.isEmpty()}findNewParent(t,s,r){let m=this.#o.findParent(s,r);return m===null||m===this?!1:(m.changeParent(t),!0)}destroy(){this.#o.getActive()?.parent===this&&(this.#o.commitOrRemove(),this.#o.setActiveEditor(null)),this.#r&&(clearTimeout(this.#r),this.#r=null);for(let t of this.#l.values())this.#t?.removePointerInTextLayer(t.contentDiv),t.setParent(null),t.isAttachedToDOM=!1,t.div.remove();this.div=null,this.#l.clear(),this.#o.removeLayer(this)}#b(){this.#d=!0;for(let t of this.#l.values())t.isEmpty()&&t.remove();this.#d=!1}render({viewport:t}){this.viewport=t,(0,i.setLayerDimensions)(this.div,t);for(let s of this.#o.getEditors(this.pageIndex))this.add(s),s.rebuild();this.updateMode()}update({viewport:t}){this.#o.commitOrRemove(),this.#b();let s=this.viewport.rotation,r=t.rotation;if(this.viewport=t,(0,i.setLayerDimensions)(this.div,{rotation:r}),s!==r)for(let m of this.#l.values())m.rotate(r);this.addInkEditorIfNeeded(!1)}get pageDimensions(){let{pageWidth:t,pageHeight:s}=this.viewport.rawDims;return[t,s]}get scale(){return this.#o.viewParameters.realScale}}},259:(ot,it,j)=>{j.d(it,{ColorPicker:()=>W});var _=j(292),H=j(830),N=j(419);class W{#t=this.#f.bind(this);#e=this.#m.bind(this);#s=null;#n=null;#a;#i=null;#r=!1;#l=!1;#h=null;#d;#u=null;#c;static get _keyboardManager(){return(0,_.shadow)(this,"_keyboardManager",new H.KeyboardManager([[["Escape","mac+Escape"],W.prototype._hideDropdownFromKeyboard],[[" ","mac+ "],W.prototype._colorSelectFromKeyboard],[["ArrowDown","ArrowRight","mac+ArrowDown","mac+ArrowRight"],W.prototype._moveToNext],[["ArrowUp","ArrowLeft","mac+ArrowUp","mac+ArrowLeft"],W.prototype._moveToPrevious],[["Home","mac+Home"],W.prototype._moveToBeginning],[["End","mac+End"],W.prototype._moveToEnd]]))}constructor({editor:k=null,uiManager:M=null}){k?(this.#l=!1,this.#c=_.AnnotationEditorParamsType.HIGHLIGHT_COLOR,this.#h=k):(this.#l=!0,this.#c=_.AnnotationEditorParamsType.HIGHLIGHT_DEFAULT_COLOR),this.#u=k?._uiManager||M,this.#d=this.#u._eventBus,this.#a=k?.color||this.#u?.highlightColors.values().next().value||"#FFFF98"}renderButton(){let k=this.#s=document.createElement("button");k.className="colorPicker",k.tabIndex="0",k.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-button"),k.setAttribute("aria-haspopup",!0),k.addEventListener("click",this.#p.bind(this)),k.addEventListener("keydown",this.#t);let M=this.#n=document.createElement("span");return M.className="swatch",M.setAttribute("aria-hidden",!0),M.style.backgroundColor=this.#a,k.append(M),k}renderMainDropdown(){let k=this.#i=this.#o();return k.setAttribute("aria-orientation","horizontal"),k.setAttribute("aria-labelledby","highlightColorPickerLabel"),k}#o(){let k=document.createElement("div");k.addEventListener("contextmenu",N.noContextMenu),k.className="dropdown",k.role="listbox",k.setAttribute("aria-multiselectable",!1),k.setAttribute("aria-orientation","vertical"),k.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-dropdown");for(let[M,f]of this.#u.highlightColors){let i=document.createElement("button");i.tabIndex="0",i.role="option",i.setAttribute("data-color",f),i.title=M,i.setAttribute("data-l10n-id",`pdfjs-editor-colorpicker-${M}`);let h=document.createElement("span");i.append(h),h.className="swatch",h.style.backgroundColor=f,i.setAttribute("aria-selected",f===this.#a),i.addEventListener("click",this.#g.bind(this,f)),k.append(i)}return k.addEventListener("keydown",this.#t),k}#g(k,M){M.stopPropagation(),this.#d.dispatch("switchannotationeditorparams",{source:this,type:this.#c,value:k})}_colorSelectFromKeyboard(k){if(k.target===this.#s){this.#p(k);return}let M=k.target.getAttribute("data-color");M&&this.#g(M,k)}_moveToNext(k){this.#A?k.target!==this.#s?k.target.nextSibling?.focus():this.#i.firstChild?.focus():this.#p(k)}_moveToPrevious(k){k.target!==this.#i?.firstChild&&k.target!==this.#s?(this.#A||this.#p(k),k.target.previousSibling?.focus()):this.#A&&this._hideDropdownFromKeyboard()}_moveToBeginning(k){this.#A?this.#i.firstChild?.focus():this.#p(k)}_moveToEnd(k){this.#A?this.#i.lastChild?.focus():this.#p(k)}#f(k){W._keyboardManager.exec(this,k)}#p(k){if(this.#A){this.hideDropdown();return}if(this.#r=k.detail===0,window.addEventListener("pointerdown",this.#e),this.#i){this.#i.classList.remove("hidden");return}let M=this.#i=this.#o();this.#s.append(M)}#m(k){this.#i?.contains(k.target)||this.hideDropdown()}hideDropdown(){this.#i?.classList.add("hidden"),window.removeEventListener("pointerdown",this.#e)}get#A(){return this.#i&&!this.#i.classList.contains("hidden")}_hideDropdownFromKeyboard(){this.#l||(this.#A?(this.hideDropdown(),this.#s.focus({preventScroll:!0,focusVisible:this.#r})):this.#h?.unselect())}updateColor(k){if(this.#n&&(this.#n.style.backgroundColor=k),!this.#i)return;let M=this.#u.highlightColors.values();for(let f of this.#i.children)f.setAttribute("aria-selected",M.next().value===k)}destroy(){this.#s?.remove(),this.#s=null,this.#n=null,this.#i?.remove(),this.#i=null}}},310:(ot,it,j)=>{j.d(it,{AnnotationEditor:()=>k});var _=j(830),H=j(292),N=j(419);class W{#t="";#e=!1;#s=null;#n=null;#a=null;#i=!1;#r=null;static _l10nPromise=null;constructor(i){this.#r=i}static initialize(i){W._l10nPromise||=i}async render(){let i=this.#s=document.createElement("button");i.className="altText";let h=await W._l10nPromise.get("pdfjs-editor-alt-text-button-label");i.textContent=h,i.setAttribute("aria-label",h),i.tabIndex="0",i.addEventListener("contextmenu",N.noContextMenu),i.addEventListener("pointerdown",(S=>S.stopPropagation()));let w=S=>{S.preventDefault(),this.#r._uiManager.editAltText(this.#r)};return i.addEventListener("click",w,{capture:!0}),i.addEventListener("keydown",(S=>{S.target===i&&S.key==="Enter"&&(this.#i=!0,w(S))})),await this.#l(),i}finish(){this.#s&&(this.#s.focus({focusVisible:this.#i}),this.#i=!1)}isEmpty(){return!this.#t&&!this.#e}get data(){return{altText:this.#t,decorative:this.#e}}set data({altText:i,decorative:h}){(this.#t!==i||this.#e!==h)&&(this.#t=i,this.#e=h,this.#l())}toggle(i=!1){this.#s&&(!i&&this.#a&&(clearTimeout(this.#a),this.#a=null),this.#s.disabled=!i)}destroy(){this.#s?.remove(),this.#s=null,this.#n=null}async#l(){let i=this.#s;if(!i)return;if(!this.#t&&!this.#e){i.classList.remove("done"),this.#n?.remove();return}i.classList.add("done"),W._l10nPromise.get("pdfjs-editor-alt-text-edit-button-label").then((S=>{i.setAttribute("aria-label",S)}));let h=this.#n;if(!h){this.#n=h=document.createElement("span"),h.className="tooltip",h.setAttribute("role","tooltip");let S=h.id=`alt-text-tooltip-${this.#r.id}`;i.setAttribute("aria-describedby",S);let n=100;i.addEventListener("mouseenter",(()=>{this.#a=setTimeout((()=>{this.#a=null,this.#n.classList.add("show"),this.#r._reportTelemetry({action:"alt_text_tooltip"})}),n)})),i.addEventListener("mouseleave",(()=>{this.#a&&(clearTimeout(this.#a),this.#a=null),this.#n?.classList.remove("show")}))}h.innerText=this.#e?await W._l10nPromise.get("pdfjs-editor-alt-text-decorative-tooltip"):this.#t,h.parentNode||i.append(h),this.#r.getImageForAltText()?.setAttribute("aria-describedby",h.id)}}var F=j(362);class k{#t=null;#e=null;#s=!1;#n=!1;#a=null;#i=null;#r=this.focusin.bind(this);#l=this.focusout.bind(this);#h=null;#d="";#u=!1;#c=null;#o=!1;#g=!1;#f=!1;#p=null;#m=0;#A=0;#b=null;_initialOptions=Object.create(null);_isVisible=!0;_uiManager=null;_focusEventsAllowed=!0;_l10nPromise=null;#_=!1;#E=k._zIndex++;static _borderLineWidth=-1;static _colorManager=new _.ColorManager;static _zIndex=1;static _telemetryTimeout=1e3;static get _resizerKeyboardManager(){let i=k.prototype._resizeWithKeyboard,h=_.AnnotationEditorUIManager.TRANSLATE_SMALL,w=_.AnnotationEditorUIManager.TRANSLATE_BIG;return(0,H.shadow)(this,"_resizerKeyboardManager",new _.KeyboardManager([[["ArrowLeft","mac+ArrowLeft"],i,{args:[-h,0]}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],i,{args:[-w,0]}],[["ArrowRight","mac+ArrowRight"],i,{args:[h,0]}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],i,{args:[w,0]}],[["ArrowUp","mac+ArrowUp"],i,{args:[0,-h]}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],i,{args:[0,-w]}],[["ArrowDown","mac+ArrowDown"],i,{args:[0,h]}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],i,{args:[0,w]}],[["Escape","mac+Escape"],k.prototype._stopResizingWithKeyboard]]))}constructor(i){this.constructor===k&&(0,H.unreachable)("Cannot initialize AnnotationEditor."),this.parent=i.parent,this.id=i.id,this.width=this.height=null,this.pageIndex=i.parent.pageIndex,this.name=i.name,this.div=null,this._uiManager=i.uiManager,this.annotationElementId=null,this._willKeepAspectRatio=!1,this._initialOptions.isCentered=i.isCentered,this._structTreeParentId=null;let{rotation:h,rawDims:{pageWidth:w,pageHeight:S,pageX:n,pageY:c}}=this.parent.viewport;this.rotation=h,this.pageRotation=(360+h-this._uiManager.viewParameters.rotation)%360,this.pageDimensions=[w,S],this.pageTranslation=[n,c];let[t,s]=this.parentDimensions;this.x=i.x/t,this.y=i.y/s,this.isAttachedToDOM=!1,this.deleted=!1}get editorType(){return Object.getPrototypeOf(this).constructor._type}static get _defaultLineColor(){return(0,H.shadow)(this,"_defaultLineColor",this._colorManager.getHexCode("CanvasText"))}static deleteAnnotationElement(i){let h=new M({id:i.parent.getNextId(),parent:i.parent,uiManager:i._uiManager});h.annotationElementId=i.annotationElementId,h.deleted=!0,h._uiManager.addToAnnotationStorage(h)}static initialize(i,h,w){if(k._l10nPromise||=new Map(["pdfjs-editor-alt-text-button-label","pdfjs-editor-alt-text-edit-button-label","pdfjs-editor-alt-text-decorative-tooltip","pdfjs-editor-resizer-label-topLeft","pdfjs-editor-resizer-label-topMiddle","pdfjs-editor-resizer-label-topRight","pdfjs-editor-resizer-label-middleRight","pdfjs-editor-resizer-label-bottomRight","pdfjs-editor-resizer-label-bottomMiddle","pdfjs-editor-resizer-label-bottomLeft","pdfjs-editor-resizer-label-middleLeft"].map((n=>[n,i.get(n.replaceAll(/([A-Z])/g,(c=>`-${c.toLowerCase()}`)))]))),w?.strings)for(let n of w.strings)k._l10nPromise.set(n,i.get(n));if(k._borderLineWidth!==-1)return;let S=getComputedStyle(document.documentElement);k._borderLineWidth=parseFloat(S.getPropertyValue("--outline-width"))||0}static updateDefaultParams(i,h){}static get defaultPropertiesToUpdate(){return[]}static isHandlingMimeForPasting(i){return!1}static paste(i,h){(0,H.unreachable)("Not implemented")}get propertiesToUpdate(){return[]}get _isDraggable(){return this.#_}set _isDraggable(i){this.#_=i,this.div?.classList.toggle("draggable",i)}get isEnterHandled(){return!0}center(){let[i,h]=this.pageDimensions;switch(this.parentRotation){case 90:this.x-=this.height*h/(2*i),this.y+=this.width*i/(2*h);break;case 180:this.x+=this.width/2,this.y+=this.height/2;break;case 270:this.x+=this.height*h/(2*i),this.y-=this.width*i/(2*h);break;default:this.x-=this.width/2,this.y-=this.height/2}this.fixAndSetPosition()}addCommands(i){this._uiManager.addCommands(i)}get currentLayer(){return this._uiManager.currentLayer}setInBackground(){this.div.style.zIndex=0}setInForeground(){this.div.style.zIndex=this.#E}setParent(i){i!==null?(this.pageIndex=i.pageIndex,this.pageDimensions=i.pageDimensions):this.#D(),this.parent=i}focusin(i){this._focusEventsAllowed&&(this.#u?this.#u=!1:this.parent.setSelected(this))}focusout(i){if(!this._focusEventsAllowed||!this.isAttachedToDOM)return;i.relatedTarget?.closest(`#${this.id}`)||(i.preventDefault(),this.parent?.isMultipleSelection||this.commitOrRemove())}commitOrRemove(){this.isEmpty()?this.remove():this.commit()}commit(){this.addToAnnotationStorage()}addToAnnotationStorage(){this._uiManager.addToAnnotationStorage(this)}setAt(i,h,w,S){let[n,c]=this.parentDimensions;[w,S]=this.screenToPageTranslation(w,S),this.x=(i+w)/n,this.y=(h+S)/c,this.fixAndSetPosition()}#k([i,h],w,S){[w,S]=this.screenToPageTranslation(w,S),this.x+=w/i,this.y+=S/h,this.fixAndSetPosition()}translate(i,h){this.#k(this.parentDimensions,i,h)}translateInPage(i,h){this.#c||=[this.x,this.y],this.#k(this.pageDimensions,i,h),this.div.scrollIntoView({block:"nearest"})}drag(i,h){this.#c||=[this.x,this.y];let[w,S]=this.parentDimensions;if(this.x+=i/w,this.y+=h/S,this.parent&&(this.x<0||this.x>1||this.y<0||this.y>1)){let{x:r,y:m}=this.div.getBoundingClientRect();this.parent.findNewParent(this,r,m)&&(this.x-=Math.floor(this.x),this.y-=Math.floor(this.y))}let{x:n,y:c}=this,[t,s]=this.getBaseTranslation();n+=t,c+=s,this.div.style.left=`${(100*n).toFixed(2)}%`,this.div.style.top=`${(100*c).toFixed(2)}%`,this.div.scrollIntoView({block:"nearest"})}get _hasBeenMoved(){return!!this.#c&&(this.#c[0]!==this.x||this.#c[1]!==this.y)}getBaseTranslation(){let[i,h]=this.parentDimensions,{_borderLineWidth:w}=k,S=w/i,n=w/h;switch(this.rotation){case 90:return[-S,n];case 180:return[S,n];case 270:return[S,-n];default:return[-S,-n]}}get _mustFixPosition(){return!0}fixAndSetPosition(i=this.rotation){let[h,w]=this.pageDimensions,{x:S,y:n,width:c,height:t}=this;if(c*=h,t*=w,S*=h,n*=w,this._mustFixPosition)switch(i){case 0:S=Math.max(0,Math.min(h-c,S)),n=Math.max(0,Math.min(w-t,n));break;case 90:S=Math.max(0,Math.min(h-t,S)),n=Math.min(w,Math.max(c,n));break;case 180:S=Math.min(h,Math.max(c,S)),n=Math.min(w,Math.max(t,n));break;case 270:S=Math.min(h,Math.max(t,S)),n=Math.max(0,Math.min(w-c,n))}this.x=S/=h,this.y=n/=w;let[s,r]=this.getBaseTranslation();S+=s,n+=r;let{style:m}=this.div;m.left=`${(100*S).toFixed(2)}%`,m.top=`${(100*n).toFixed(2)}%`,this.moveInDOM()}static#F(i,h,w){switch(w){case 90:return[h,-i];case 180:return[-i,-h];case 270:return[-h,i];default:return[i,h]}}screenToPageTranslation(i,h){return k.#F(i,h,this.parentRotation)}pageTranslationToScreen(i,h){return k.#F(i,h,360-this.parentRotation)}#y(i){switch(i){case 90:{let[h,w]=this.pageDimensions;return[0,-h/w,w/h,0]}case 180:return[-1,0,0,-1];case 270:{let[h,w]=this.pageDimensions;return[0,h/w,-w/h,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(){let{parentScale:i,pageDimensions:[h,w]}=this,S=h*i,n=w*i;return H.FeatureTest.isCSSRoundSupported?[Math.round(S),Math.round(n)]:[S,n]}setDims(i,h){let[w,S]=this.parentDimensions;this.div.style.width=`${(100*i/w).toFixed(2)}%`,this.#n||(this.div.style.height=`${(100*h/S).toFixed(2)}%`)}fixDims(){let{style:i}=this.div,{height:h,width:w}=i,S=w.endsWith("%"),n=!this.#n&&h.endsWith("%");if(S&&n)return;let[c,t]=this.parentDimensions;S||(i.width=`${(100*parseFloat(w)/c).toFixed(2)}%`),this.#n||n||(i.height=`${(100*parseFloat(h)/t).toFixed(2)}%`)}getInitialTranslation(){return[0,0]}#v(){if(this.#a)return;this.#a=document.createElement("div"),this.#a.classList.add("resizers");let i=this._willKeepAspectRatio?["topLeft","topRight","bottomRight","bottomLeft"]:["topLeft","topMiddle","topRight","middleRight","bottomRight","bottomMiddle","bottomLeft","middleLeft"];for(let h of i){let w=document.createElement("div");this.#a.append(w),w.classList.add("resizer",h),w.setAttribute("data-resizer-name",h),w.addEventListener("pointerdown",this.#w.bind(this,h)),w.addEventListener("contextmenu",N.noContextMenu),w.tabIndex=-1}this.div.prepend(this.#a)}#w(i,h){h.preventDefault();let{isMac:w}=H.FeatureTest.platform;if(h.button!==0||h.ctrlKey&&w)return;this.#e?.toggle(!1);let S=this.#S.bind(this,i),n=this._isDraggable;this._isDraggable=!1;let c={passive:!0,capture:!0};this.parent.togglePointerEvents(!1),window.addEventListener("pointermove",S,c);let t=this.x,s=this.y,r=this.width,m=this.height,y=this.parent.div.style.cursor,b=this.div.style.cursor;this.div.style.cursor=this.parent.div.style.cursor=window.getComputedStyle(h.target).cursor;let R=()=>{this.parent.togglePointerEvents(!0),this.#e?.toggle(!0),this._isDraggable=n,window.removeEventListener("pointerup",R),window.removeEventListener("blur",R),window.removeEventListener("pointermove",S,c),this.parent.div.style.cursor=y,this.div.style.cursor=b,this.#x(t,s,r,m)};window.addEventListener("pointerup",R),window.addEventListener("blur",R)}#x(i,h,w,S){let n=this.x,c=this.y,t=this.width,s=this.height;n===i&&c===h&&t===w&&s===S||this.addCommands({cmd:()=>{this.width=t,this.height=s,this.x=n,this.y=c;let[r,m]=this.parentDimensions;this.setDims(r*t,m*s),this.fixAndSetPosition()},undo:()=>{this.width=w,this.height=S,this.x=i,this.y=h;let[r,m]=this.parentDimensions;this.setDims(r*w,m*S),this.fixAndSetPosition()},mustExec:!0})}#S(i,h){let[w,S]=this.parentDimensions,n=this.x,c=this.y,t=this.width,s=this.height,r=k.MIN_SIZE/w,m=k.MIN_SIZE/S,y=p=>Math.round(1e4*p)/1e4,b=this.#y(this.rotation),R=(p,u)=>[b[0]*p+b[2]*u,b[1]*p+b[3]*u],L=this.#y(360-this.rotation),I,B,X=!1,Z=!1;switch(i){case"topLeft":X=!0,I=(p,u)=>[0,0],B=(p,u)=>[p,u];break;case"topMiddle":I=(p,u)=>[p/2,0],B=(p,u)=>[p/2,u];break;case"topRight":X=!0,I=(p,u)=>[p,0],B=(p,u)=>[0,u];break;case"middleRight":Z=!0,I=(p,u)=>[p,u/2],B=(p,u)=>[0,u/2];break;case"bottomRight":X=!0,I=(p,u)=>[p,u],B=(p,u)=>[0,0];break;case"bottomMiddle":I=(p,u)=>[p/2,u],B=(p,u)=>[p/2,0];break;case"bottomLeft":X=!0,I=(p,u)=>[0,u],B=(p,u)=>[p,0];break;case"middleLeft":Z=!0,I=(p,u)=>[0,u/2],B=(p,u)=>[p,u/2]}let nt=I(t,s),G=B(t,s),O=R(...G),z=y(n+O[0]),J=y(c+O[1]),st=1,et=1,[at,rt]=this.screenToPageTranslation(h.movementX,h.movementY);[at,rt]=($=at/w,l=rt/S,[L[0]*$+L[2]*l,L[1]*$+L[3]*l]);var $,l;if(X){let p=Math.hypot(t,s);st=et=Math.max(Math.min(Math.hypot(G[0]-nt[0]-at,G[1]-nt[1]-rt)/p,1/t,1/s),r/t,m/s)}else Z?st=Math.max(r,Math.min(1,Math.abs(G[0]-nt[0]-at)))/t:et=Math.max(m,Math.min(1,Math.abs(G[1]-nt[1]-rt)))/s;let g=y(t*st),v=y(s*et);O=R(...B(g,v));let e=z-O[0],a=J-O[1];this.width=g,this.height=v,this.x=e,this.y=a,this.setDims(w*g,S*v),this.fixAndSetPosition()}altTextFinish(){this.#e?.finish()}async addEditToolbar(){return this.#h||this.#g?this.#h:(this.#h=new F.EditorToolbar(this),this.div.append(this.#h.render()),this.#e&&this.#h.addAltTextButton(await this.#e.render()),this.#h)}removeEditToolbar(){this.#h&&(this.#h.remove(),this.#h=null,this.#e?.destroy())}getClientDimensions(){return this.div.getBoundingClientRect()}async addAltTextButton(){this.#e||(W.initialize(k._l10nPromise),this.#e=new W(this),await this.addEditToolbar())}get altTextData(){return this.#e?.data}set altTextData(i){this.#e&&(this.#e.data=i)}hasAltText(){return!this.#e?.isEmpty()}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.tabIndex=this.#s?-1:0,this._isVisible||this.div.classList.add("hidden"),this.setInForeground(),this.div.addEventListener("focusin",this.#r),this.div.addEventListener("focusout",this.#l);let[i,h]=this.parentDimensions;this.parentRotation%180!=0&&(this.div.style.maxWidth=`${(100*h/i).toFixed(2)}%`,this.div.style.maxHeight=`${(100*i/h).toFixed(2)}%`);let[w,S]=this.getInitialTranslation();return this.translate(w,S),(0,_.bindEvents)(this,this.div,["pointerdown"]),this.div}pointerdown(i){let{isMac:h}=H.FeatureTest.platform;i.button!==0||i.ctrlKey&&h?i.preventDefault():(this.#u=!0,this._isDraggable?this.#T(i):this.#M(i))}#M(i){let{isMac:h}=H.FeatureTest.platform;i.ctrlKey&&!h||i.shiftKey||i.metaKey&&h?this.parent.toggleSelected(this):this.parent.setSelected(this)}#T(i){let h=this._uiManager.isSelected(this);this._uiManager.setUpDragSession();let w,S;h&&(this.div.classList.add("moving"),w={passive:!0,capture:!0},this.#m=i.clientX,this.#A=i.clientY,S=c=>{let{clientX:t,clientY:s}=c,[r,m]=this.screenToPageTranslation(t-this.#m,s-this.#A);this.#m=t,this.#A=s,this._uiManager.dragSelectedEditors(r,m)},window.addEventListener("pointermove",S,w));let n=()=>{window.removeEventListener("pointerup",n),window.removeEventListener("blur",n),h&&(this.div.classList.remove("moving"),window.removeEventListener("pointermove",S,w)),this.#u=!1,this._uiManager.endDragSession()||this.#M(i)};window.addEventListener("pointerup",n),window.addEventListener("blur",n)}moveInDOM(){this.#p&&clearTimeout(this.#p),this.#p=setTimeout((()=>{this.#p=null,this.parent?.moveEditorInDOM(this)}),0)}_setParentAndPosition(i,h,w){i.changeParent(this),this.x=h,this.y=w,this.fixAndSetPosition()}getRect(i,h,w=this.rotation){let S=this.parentScale,[n,c]=this.pageDimensions,[t,s]=this.pageTranslation,r=i/S,m=h/S,y=this.x*n,b=this.y*c,R=this.width*n,L=this.height*c;switch(w){case 0:return[y+r+t,c-b-m-L+s,y+r+R+t,c-b-m+s];case 90:return[y+m+t,c-b+r+s,y+m+L+t,c-b+r+R+s];case 180:return[y-r-R+t,c-b+m+s,y-r+t,c-b+m+L+s];case 270:return[y-m-L+t,c-b-r-R+s,y-m+t,c-b-r+s];default:throw new Error("Invalid rotation")}}getRectInCurrentCoords(i,h){let[w,S,n,c]=i,t=n-w,s=c-S;switch(this.rotation){case 0:return[w,h-c,t,s];case 90:return[w,h-S,s,t];case 180:return[n,h-S,t,s];case 270:return[n,h-c,s,t];default:throw new Error("Invalid rotation")}}onceAdded(){}isEmpty(){return!1}enableEditMode(){this.#g=!0}disableEditMode(){this.#g=!1}isInEditMode(){return this.#g}shouldGetKeyboardEvents(){return this.#f}needsToBeRebuilt(){return this.div&&!this.isAttachedToDOM}rebuild(){this.div?.addEventListener("focusin",this.#r),this.div?.addEventListener("focusout",this.#l)}rotate(i){}serialize(i=!1,h=null){(0,H.unreachable)("An editor must be serializable")}static deserialize(i,h,w){let S=new this.prototype.constructor({parent:h,id:h.getNextId(),uiManager:w});S.rotation=i.rotation;let[n,c]=S.pageDimensions,[t,s,r,m]=S.getRectInCurrentCoords(i.rect,c);return S.x=t/n,S.y=s/c,S.width=r/n,S.height=m/c,S}remove(){if(this.div.removeEventListener("focusin",this.#r),this.div.removeEventListener("focusout",this.#l),this.isEmpty()||this.commit(),this.parent?this.parent.remove(this):this._uiManager.removeEditor(this),this.#p&&(clearTimeout(this.#p),this.#p=null),this.#D(),this.removeEditToolbar(),this.#b){for(let i of this.#b.values())clearTimeout(i);this.#b=null}this.parent=null}get isResizable(){return!1}makeResizable(){this.isResizable&&(this.#v(),this.#a.classList.remove("hidden"),(0,_.bindEvents)(this,this.div,["keydown"]))}get toolbarPosition(){return null}keydown(i){if(!this.isResizable||i.target!==this.div||i.key!=="Enter")return;this._uiManager.setSelected(this),this.#i={savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height};let h=this.#a.children;if(!this.#t){this.#t=Array.from(h);let c=this.#L.bind(this),t=this.#R.bind(this);for(let s of this.#t){let r=s.getAttribute("data-resizer-name");s.setAttribute("role","spinbutton"),s.addEventListener("keydown",c),s.addEventListener("blur",t),s.addEventListener("focus",this.#I.bind(this,r)),k._l10nPromise.get(`pdfjs-editor-resizer-label-${r}`).then((m=>s.setAttribute("aria-label",m)))}}let w=this.#t[0],S=0;for(let c of h){if(c===w)break;S++}let n=(360-this.rotation+this.parentRotation)%360/90*(this.#t.length/4);if(n!==S){if(n<S)for(let t=0;t<S-n;t++)this.#a.append(this.#a.firstChild);else if(n>S)for(let t=0;t<n-S;t++)this.#a.firstChild.before(this.#a.lastChild);let c=0;for(let t of h){let s=this.#t[c++].getAttribute("data-resizer-name");k._l10nPromise.get(`pdfjs-editor-resizer-label-${s}`).then((r=>t.setAttribute("aria-label",r)))}}this.#P(0),this.#f=!0,this.#a.firstChild.focus({focusVisible:!0}),i.preventDefault(),i.stopImmediatePropagation()}#L(i){k._resizerKeyboardManager.exec(this,i)}#R(i){this.#f&&i.relatedTarget?.parentNode!==this.#a&&this.#D()}#I(i){this.#d=this.#f?i:""}#P(i){if(this.#t)for(let h of this.#t)h.tabIndex=i}_resizeWithKeyboard(i,h){this.#f&&this.#S(this.#d,{movementX:i,movementY:h})}#D(){if(this.#f=!1,this.#P(-1),this.#i){let{savedX:i,savedY:h,savedWidth:w,savedHeight:S}=this.#i;this.#x(i,h,w,S),this.#i=null}}_stopResizingWithKeyboard(){this.#D(),this.div.focus()}select(){this.makeResizable(),this.div?.classList.add("selectedEditor"),this.#h?this.#h?.show():this.addEditToolbar().then((()=>{this.div?.classList.contains("selectedEditor")&&this.#h?.show()}))}unselect(){this.#a?.classList.add("hidden"),this.div?.classList.remove("selectedEditor"),this.div?.contains(document.activeElement)&&this._uiManager.currentLayer.div.focus({preventScroll:!0}),this.#h?.hide()}updateParams(i,h){}disableEditing(){}enableEditing(){}enterInEditMode(){}getImageForAltText(){return null}get contentDiv(){return this.div}get isEditing(){return this.#o}set isEditing(i){this.#o=i,this.parent&&(i?(this.parent.setSelected(this),this.parent.setActiveEditor(this)):this.parent.setActiveEditor(null))}setAspectRatio(i,h){this.#n=!0;let w=i/h,{style:S}=this.div;S.aspectRatio=w,S.height="auto"}static get MIN_SIZE(){return 16}static canCreateNewEmptyEditor(){return!0}get telemetryInitialData(){return{action:"added"}}get telemetryFinalData(){return null}_reportTelemetry(i,h=!1){if(h){this.#b||=new Map;let{action:w}=i,S=this.#b.get(w);S&&clearTimeout(S),S=setTimeout((()=>{this._reportTelemetry(i),this.#b.delete(w),this.#b.size===0&&(this.#b=null)}),k._telemetryTimeout),this.#b.set(w,S)}else i.type||=this.editorType,this._uiManager._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:i}})}show(i=this._isVisible){this.div.classList.toggle("hidden",!i),this._isVisible=i}enable(){this.div&&(this.div.tabIndex=0),this.#s=!1}disable(){this.div&&(this.div.tabIndex=-1),this.#s=!0}}class M extends k{constructor(i){super(i),this.annotationElementId=i.annotationElementId,this.deleted=!0}serialize(){return{id:this.annotationElementId,deleted:!0,pageIndex:this.pageIndex}}}},61:(ot,it,j)=>{j.d(it,{FreeOutliner:()=>F,Outliner:()=>H});var _=j(292);class H{#t;#e=[];#s=[];constructor(f,i=0,h=0,w=!0){let S=1/0,n=-1/0,c=1/0,t=-1/0,s=10**-4;for(let{x:I,y:B,width:X,height:Z}of f){let nt=Math.floor((I-i)/s)*s,G=Math.ceil((I+X+i)/s)*s,O=Math.floor((B-i)/s)*s,z=Math.ceil((B+Z+i)/s)*s,J=[nt,O,z,!0],st=[G,O,z,!1];this.#e.push(J,st),S=Math.min(S,nt),n=Math.max(n,G),c=Math.min(c,O),t=Math.max(t,z)}let r=n-S+2*h,m=t-c+2*h,y=S-h,b=c-h,R=this.#e.at(w?-1:-2),L=[R[0],R[2]];for(let I of this.#e){let[B,X,Z]=I;I[0]=(B-y)/r,I[1]=(X-b)/m,I[2]=(Z-b)/m}this.#t={x:y,y:b,width:r,height:m,lastPoint:L}}getOutlines(){this.#e.sort(((i,h)=>i[0]-h[0]||i[1]-h[1]||i[2]-h[2]));let f=[];for(let i of this.#e)i[3]?(f.push(...this.#l(i)),this.#i(i)):(this.#r(i),f.push(...this.#l(i)));return this.#n(f)}#n(f){let i=[],h=new Set;for(let n of f){let[c,t,s]=n;i.push([c,t,n],[c,s,n])}i.sort(((n,c)=>n[1]-c[1]||n[0]-c[0]));for(let n=0,c=i.length;n<c;n+=2){let t=i[n][2],s=i[n+1][2];t.push(s),s.push(t),h.add(t),h.add(s)}let w=[],S;for(;h.size>0;){let n=h.values().next().value,[c,t,s,r,m]=n;h.delete(n);let y=c,b=t;for(S=[c,s],w.push(S);;){let R;if(h.has(r))R=r;else{if(!h.has(m))break;R=m}h.delete(R),[c,t,s,r,m]=R,y!==c&&(S.push(y,b,c,b===t?t:s),y=c),b=b===t?s:t}S.push(y,b)}return new W(w,this.#t)}#a(f){let i=this.#s,h=0,w=i.length-1;for(;h<=w;){let S=h+w>>1,n=i[S][0];if(n===f)return S;n<f?h=S+1:w=S-1}return w+1}#i([,f,i]){let h=this.#a(f);this.#s.splice(h,0,[f,i])}#r([,f,i]){let h=this.#a(f);for(let w=h;w<this.#s.length;w++){let[S,n]=this.#s[w];if(S!==f)break;if(S===f&&n===i){this.#s.splice(w,1);return}}for(let w=h-1;w>=0;w--){let[S,n]=this.#s[w];if(S!==f)break;if(S===f&&n===i){this.#s.splice(w,1);return}}}#l(f){let[i,h,w]=f,S=[[i,h,w]],n=this.#a(w);for(let c=0;c<n;c++){let[t,s]=this.#s[c];for(let r=0,m=S.length;r<m;r++){let[,y,b]=S[r];if(!(s<=y||b<=t))if(y>=t)if(b>s)S[r][1]=s;else{if(m===1)return[];S.splice(r,1),r--,m--}else S[r][2]=t,b>s&&S.push([i,s,b])}}return S}}class N{toSVGPath(){throw new Error("Abstract method `toSVGPath` must be implemented.")}get box(){throw new Error("Abstract getter `box` must be implemented.")}serialize(f,i){throw new Error("Abstract method `serialize` must be implemented.")}get free(){return this instanceof k}}class W extends N{#t;#e;constructor(f,i){super(),this.#e=f,this.#t=i}toSVGPath(){let f=[];for(let i of this.#e){let[h,w]=i;f.push(`M${h} ${w}`);for(let S=2;S<i.length;S+=2){let n=i[S],c=i[S+1];n===h?(f.push(`V${c}`),w=c):c===w&&(f.push(`H${n}`),h=n)}f.push("Z")}return f.join(" ")}serialize([f,i,h,w],S){let n=[],c=h-f,t=w-i;for(let s of this.#e){let r=new Array(s.length);for(let m=0;m<s.length;m+=2)r[m]=f+s[m]*c,r[m+1]=w-s[m+1]*t;n.push(r)}return n}get box(){return this.#t}}class F{#t;#e=[];#s;#n;#a=[];#i=new Float64Array(18);#r;#l;#h;#d;#u;#c;#o=[];static#g=8;static#f=2;static#p=F.#g+F.#f;constructor({x:f,y:i},h,w,S,n,c=0){this.#t=h,this.#c=S*w,this.#n=n,this.#i.set([NaN,NaN,NaN,NaN,f,i],6),this.#s=c,this.#d=F.#g*w,this.#h=F.#p*w,this.#u=w,this.#o.push(f,i)}get free(){return!0}isEmpty(){return isNaN(this.#i[8])}#m(){let f=this.#i.subarray(4,6),i=this.#i.subarray(16,18),[h,w,S,n]=this.#t;return[(this.#r+(f[0]-i[0])/2-h)/S,(this.#l+(f[1]-i[1])/2-w)/n,(this.#r+(i[0]-f[0])/2-h)/S,(this.#l+(i[1]-f[1])/2-w)/n]}add({x:f,y:i}){this.#r=f,this.#l=i;let[h,w,S,n]=this.#t,[c,t,s,r]=this.#i.subarray(8,12),m=f-s,y=i-r,b=Math.hypot(m,y);if(b<this.#h)return!1;let R=b-this.#d,L=R/b,I=L*m,B=L*y,X=c,Z=t;c=s,t=r,s+=I,r+=B,this.#o?.push(f,i);let nt=I/R,G=-B/R*this.#c,O=nt*this.#c;return this.#i.set(this.#i.subarray(2,8),0),this.#i.set([s+G,r+O],4),this.#i.set(this.#i.subarray(14,18),12),this.#i.set([s-G,r-O],16),isNaN(this.#i[6])?(this.#a.length===0&&(this.#i.set([c+G,t+O],2),this.#a.push(NaN,NaN,NaN,NaN,(c+G-h)/S,(t+O-w)/n),this.#i.set([c-G,t-O],14),this.#e.push(NaN,NaN,NaN,NaN,(c-G-h)/S,(t-O-w)/n)),this.#i.set([X,Z,c,t,s,r],6),!this.isEmpty()):(this.#i.set([X,Z,c,t,s,r],6),Math.abs(Math.atan2(Z-t,X-c)-Math.atan2(B,I))<Math.PI/2?([c,t,s,r]=this.#i.subarray(2,6),this.#a.push(NaN,NaN,NaN,NaN,((c+s)/2-h)/S,((t+r)/2-w)/n),[c,t,X,Z]=this.#i.subarray(14,18),this.#e.push(NaN,NaN,NaN,NaN,((X+c)/2-h)/S,((Z+t)/2-w)/n),!0):([X,Z,c,t,s,r]=this.#i.subarray(0,6),this.#a.push(((X+5*c)/6-h)/S,((Z+5*t)/6-w)/n,((5*c+s)/6-h)/S,((5*t+r)/6-w)/n,((c+s)/2-h)/S,((t+r)/2-w)/n),[s,r,c,t,X,Z]=this.#i.subarray(12,18),this.#e.push(((X+5*c)/6-h)/S,((Z+5*t)/6-w)/n,((5*c+s)/6-h)/S,((5*t+r)/6-w)/n,((c+s)/2-h)/S,((t+r)/2-w)/n),!0))}toSVGPath(){if(this.isEmpty())return"";let f=this.#a,i=this.#e,h=this.#i.subarray(4,6),w=this.#i.subarray(16,18),[S,n,c,t]=this.#t,[s,r,m,y]=this.#m();if(isNaN(this.#i[6])&&!this.isEmpty())return`M${(this.#i[2]-S)/c} ${(this.#i[3]-n)/t} L${(this.#i[4]-S)/c} ${(this.#i[5]-n)/t} L${s} ${r} L${m} ${y} L${(this.#i[16]-S)/c} ${(this.#i[17]-n)/t} L${(this.#i[14]-S)/c} ${(this.#i[15]-n)/t} Z`;let b=[];b.push(`M${f[4]} ${f[5]}`);for(let R=6;R<f.length;R+=6)isNaN(f[R])?b.push(`L${f[R+4]} ${f[R+5]}`):b.push(`C${f[R]} ${f[R+1]} ${f[R+2]} ${f[R+3]} ${f[R+4]} ${f[R+5]}`);b.push(`L${(h[0]-S)/c} ${(h[1]-n)/t} L${s} ${r} L${m} ${y} L${(w[0]-S)/c} ${(w[1]-n)/t}`);for(let R=i.length-6;R>=6;R-=6)isNaN(i[R])?b.push(`L${i[R+4]} ${i[R+5]}`):b.push(`C${i[R]} ${i[R+1]} ${i[R+2]} ${i[R+3]} ${i[R+4]} ${i[R+5]}`);return b.push(`L${i[4]} ${i[5]} Z`),b.join(" ")}getOutlines(){let f=this.#a,i=this.#e,h=this.#i,w=h.subarray(4,6),S=h.subarray(16,18),[n,c,t,s]=this.#t,r=new Float64Array((this.#o?.length??0)+2);for(let B=0,X=r.length-2;B<X;B+=2)r[B]=(this.#o[B]-n)/t,r[B+1]=(this.#o[B+1]-c)/s;r[r.length-2]=(this.#r-n)/t,r[r.length-1]=(this.#l-c)/s;let[m,y,b,R]=this.#m();if(isNaN(h[6])&&!this.isEmpty()){let B=new Float64Array(36);return B.set([NaN,NaN,NaN,NaN,(h[2]-n)/t,(h[3]-c)/s,NaN,NaN,NaN,NaN,(h[4]-n)/t,(h[5]-c)/s,NaN,NaN,NaN,NaN,m,y,NaN,NaN,NaN,NaN,b,R,NaN,NaN,NaN,NaN,(h[16]-n)/t,(h[17]-c)/s,NaN,NaN,NaN,NaN,(h[14]-n)/t,(h[15]-c)/s],0),new k(B,r,this.#t,this.#u,this.#s,this.#n)}let L=new Float64Array(this.#a.length+24+this.#e.length),I=f.length;for(let B=0;B<I;B+=2)isNaN(f[B])?L[B]=L[B+1]=NaN:(L[B]=f[B],L[B+1]=f[B+1]);L.set([NaN,NaN,NaN,NaN,(w[0]-n)/t,(w[1]-c)/s,NaN,NaN,NaN,NaN,m,y,NaN,NaN,NaN,NaN,b,R,NaN,NaN,NaN,NaN,(S[0]-n)/t,(S[1]-c)/s],I),I+=24;for(let B=i.length-6;B>=6;B-=6)for(let X=0;X<6;X+=2)isNaN(i[B+X])?(L[I]=L[I+1]=NaN,I+=2):(L[I]=i[B+X],L[I+1]=i[B+X+1],I+=2);return L.set([NaN,NaN,NaN,NaN,i[4],i[5]],I),new k(L,r,this.#t,this.#u,this.#s,this.#n)}}class k extends N{#t;#e=null;#s;#n;#a;#i;#r;constructor(f,i,h,w,S,n){super(),this.#r=f,this.#a=i,this.#t=h,this.#i=w,this.#s=S,this.#n=n,this.#d(n);let{x:c,y:t,width:s,height:r}=this.#e;for(let m=0,y=f.length;m<y;m+=2)f[m]=(f[m]-c)/s,f[m+1]=(f[m+1]-t)/r;for(let m=0,y=i.length;m<y;m+=2)i[m]=(i[m]-c)/s,i[m+1]=(i[m+1]-t)/r}toSVGPath(){let f=[`M${this.#r[4]} ${this.#r[5]}`];for(let i=6,h=this.#r.length;i<h;i+=6)isNaN(this.#r[i])?f.push(`L${this.#r[i+4]} ${this.#r[i+5]}`):f.push(`C${this.#r[i]} ${this.#r[i+1]} ${this.#r[i+2]} ${this.#r[i+3]} ${this.#r[i+4]} ${this.#r[i+5]}`);return f.push("Z"),f.join(" ")}serialize([f,i,h,w],S){let n=h-f,c=w-i,t,s;switch(S){case 0:t=this.#l(this.#r,f,w,n,-c),s=this.#l(this.#a,f,w,n,-c);break;case 90:t=this.#h(this.#r,f,i,n,c),s=this.#h(this.#a,f,i,n,c);break;case 180:t=this.#l(this.#r,h,i,-n,c),s=this.#l(this.#a,h,i,-n,c);break;case 270:t=this.#h(this.#r,h,w,-n,-c),s=this.#h(this.#a,h,w,-n,-c)}return{outline:Array.from(t),points:[Array.from(s)]}}#l(f,i,h,w,S){let n=new Float64Array(f.length);for(let c=0,t=f.length;c<t;c+=2)n[c]=i+f[c]*w,n[c+1]=h+f[c+1]*S;return n}#h(f,i,h,w,S){let n=new Float64Array(f.length);for(let c=0,t=f.length;c<t;c+=2)n[c]=i+f[c+1]*w,n[c+1]=h+f[c]*S;return n}#d(f){let i=this.#r,h=i[4],w=i[5],S=h,n=w,c=h,t=w,s=h,r=w,m=f?Math.max:Math.min;for(let I=6,B=i.length;I<B;I+=6){if(isNaN(i[I]))S=Math.min(S,i[I+4]),n=Math.min(n,i[I+5]),c=Math.max(c,i[I+4]),t=Math.max(t,i[I+5]),r<i[I+5]?(s=i[I+4],r=i[I+5]):r===i[I+5]&&(s=m(s,i[I+4]));else{let X=_.Util.bezierBoundingBox(h,w,...i.slice(I,I+6));S=Math.min(S,X[0]),n=Math.min(n,X[1]),c=Math.max(c,X[2]),t=Math.max(t,X[3]),r<X[3]?(s=X[2],r=X[3]):r===X[3]&&(s=m(s,X[2]))}h=i[I+4],w=i[I+5]}let y=S-this.#s,b=n-this.#s,R=c-S+2*this.#s,L=t-n+2*this.#s;this.#e={x:y,y:b,width:R,height:L,lastPoint:[s,r]}}get box(){return this.#e}getNewOutline(f,i){let{x:h,y:w,width:S,height:n}=this.#e,[c,t,s,r]=this.#t,m=S*s,y=n*r,b=h*s+c,R=w*r+t,L=new F({x:this.#a[0]*m+b,y:this.#a[1]*y+R},this.#t,this.#i,f,this.#n,i??this.#s);for(let I=2;I<this.#a.length;I+=2)L.add({x:this.#a[I]*m+b,y:this.#a[I+1]*y+R});return L.getOutlines()}}},362:(ot,it,j)=>{j.d(it,{EditorToolbar:()=>H,HighlightToolbar:()=>N});var _=j(419);class H{#t=null;#e=null;#s;#n=null;constructor(F){this.#s=F}render(){let F=this.#t=document.createElement("div");F.className="editToolbar",F.setAttribute("role","toolbar"),F.addEventListener("contextmenu",_.noContextMenu),F.addEventListener("pointerdown",H.#a);let k=this.#n=document.createElement("div");k.className="buttons",F.append(k);let M=this.#s.toolbarPosition;if(M){let{style:f}=F,i=this.#s._uiManager.direction==="ltr"?1-M[0]:M[0];f.insetInlineEnd=100*i+"%",f.top=`calc(${100*M[1]}% + var(--editor-toolbar-vert-offset))`}return this.#h(),F}static#a(F){F.stopPropagation()}#i(F){this.#s._focusEventsAllowed=!1,F.preventDefault(),F.stopPropagation()}#r(F){this.#s._focusEventsAllowed=!0,F.preventDefault(),F.stopPropagation()}#l(F){F.addEventListener("focusin",this.#i.bind(this),{capture:!0}),F.addEventListener("focusout",this.#r.bind(this),{capture:!0}),F.addEventListener("contextmenu",_.noContextMenu)}hide(){this.#t.classList.add("hidden"),this.#e?.hideDropdown()}show(){this.#t.classList.remove("hidden")}#h(){let F=document.createElement("button");F.className="delete",F.tabIndex=0,F.setAttribute("data-l10n-id",`pdfjs-editor-remove-${this.#s.editorType}-button`),this.#l(F),F.addEventListener("click",(k=>{this.#s._uiManager.delete()})),this.#n.append(F)}get#d(){let F=document.createElement("div");return F.className="divider",F}addAltTextButton(F){this.#l(F),this.#n.prepend(F,this.#d)}addColorPicker(F){this.#e=F;let k=F.renderButton();this.#l(k),this.#n.prepend(k,this.#d)}remove(){this.#t.remove(),this.#e?.destroy(),this.#e=null}}class N{#t=null;#e=null;#s;constructor(F){this.#s=F}#n(){let F=this.#e=document.createElement("div");F.className="editToolbar",F.setAttribute("role","toolbar"),F.addEventListener("contextmenu",_.noContextMenu);let k=this.#t=document.createElement("div");return k.className="buttons",F.append(k),this.#i(),F}#a(F,k){let M=0,f=0;for(let i of F){let h=i.y+i.height;if(h<M)continue;let w=i.x+(k?i.width:0);h>M?(f=w,M=h):k?w>f&&(f=w):w<f&&(f=w)}return[k?1-f:f,M]}show(F,k,M){let[f,i]=this.#a(k,M),{style:h}=this.#e||=this.#n();F.append(this.#e),h.insetInlineEnd=100*f+"%",h.top=`calc(${100*i}% + var(--editor-toolbar-vert-offset))`}hide(){this.#e.remove()}#i(){let F=document.createElement("button");F.className="highlightButton",F.tabIndex=0,F.setAttribute("data-l10n-id","pdfjs-highlight-floating-button1");let k=document.createElement("span");F.append(k),k.className="visuallyHidden",k.setAttribute("data-l10n-id","pdfjs-highlight-floating-button-label"),F.addEventListener("contextmenu",_.noContextMenu),F.addEventListener("click",(()=>{this.#s.highlightSelection("floating_button")})),this.#t.append(F)}}},830:(ot,it,j)=>{j.d(it,{AnnotationEditorUIManager:()=>w,ColorManager:()=>h,KeyboardManager:()=>i,bindEvents:()=>W,opacityToHex:()=>F});var _=j(292),H=j(419),N=j(362);function W(S,n,c){for(let t of c)n.addEventListener(t,S[t].bind(S))}function F(S){return Math.round(Math.min(255,Math.max(1,255*S))).toString(16).padStart(2,"0")}class k{#t=0;constructor(){}get id(){return`${_.AnnotationEditorPrefix}${this.#t++}`}}class M{#t=(0,_.getUuid)();#e=0;#s=null;static get _isSVGFittingCanvas(){let n=new OffscreenCanvas(1,3).getContext("2d"),c=new Image;c.src='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>';let t=c.decode().then((()=>(n.drawImage(c,0,0,1,1,0,0,1,3),new Uint32Array(n.getImageData(0,0,1,1).data.buffer)[0]===0)));return(0,_.shadow)(this,"_isSVGFittingCanvas",t)}async#n(n,c){this.#s||=new Map;let t=this.#s.get(n);if(t===null)return null;if(t?.bitmap)return t.refCounter+=1,t;try{t||={bitmap:null,id:`image_${this.#t}_${this.#e++}`,refCounter:0,isSvg:!1};let s;if(typeof c=="string"?(t.url=c,s=await(0,H.fetchData)(c,"blob")):s=t.file=c,s.type==="image/svg+xml"){let r=M._isSVGFittingCanvas,m=new FileReader,y=new Image,b=new Promise(((R,L)=>{y.onload=()=>{t.bitmap=y,t.isSvg=!0,R()},m.onload=async()=>{let I=t.svgUrl=m.result;y.src=await r?`${I}#svgView(preserveAspectRatio(none))`:I},y.onerror=m.onerror=L}));m.readAsDataURL(s),await b}else t.bitmap=await createImageBitmap(s);t.refCounter=1}catch(s){console.error(s),t=null}return this.#s.set(n,t),t&&this.#s.set(t.id,t),t}async getFromFile(n){let{lastModified:c,name:t,size:s,type:r}=n;return this.#n(`${c}_${t}_${s}_${r}`,n)}async getFromUrl(n){return this.#n(n,n)}async getFromId(n){this.#s||=new Map;let c=this.#s.get(n);return c?c.bitmap?(c.refCounter+=1,c):c.file?this.getFromFile(c.file):this.getFromUrl(c.url):null}getSvgUrl(n){let c=this.#s.get(n);return c?.isSvg?c.svgUrl:null}deleteId(n){this.#s||=new Map;let c=this.#s.get(n);c&&(c.refCounter-=1,c.refCounter===0&&(c.bitmap=null))}isValidId(n){return n.startsWith(`image_${this.#t}_`)}}class f{#t=[];#e=!1;#s;#n=-1;constructor(n=128){this.#s=n}add({cmd:n,undo:c,post:t,mustExec:s,type:r=NaN,overwriteIfSameType:m=!1,keepUndo:y=!1}){if(s&&n(),this.#e)return;let b={cmd:n,undo:c,post:t,type:r};if(this.#n===-1){this.#t.length>0&&(this.#t.length=0),this.#n=0,this.#t.push(b);return}if(m&&this.#t[this.#n].type===r){y&&(b.undo=this.#t[this.#n].undo),this.#t[this.#n]=b;return}let R=this.#n+1;R===this.#s?this.#t.splice(0,1):(this.#n=R,R<this.#t.length&&this.#t.splice(R)),this.#t.push(b)}undo(){if(this.#n===-1)return;this.#e=!0;let{undo:n,post:c}=this.#t[this.#n];n(),c?.(),this.#e=!1,this.#n-=1}redo(){if(this.#n<this.#t.length-1){this.#n+=1,this.#e=!0;let{cmd:n,post:c}=this.#t[this.#n];n(),c?.(),this.#e=!1}}hasSomethingToUndo(){return this.#n!==-1}hasSomethingToRedo(){return this.#n<this.#t.length-1}destroy(){this.#t=null}}class i{constructor(n){this.buffer=[],this.callbacks=new Map,this.allKeys=new Set;let{isMac:c}=_.FeatureTest.platform;for(let[t,s,r={}]of n)for(let m of t){let y=m.startsWith("mac+");c&&y?(this.callbacks.set(m.slice(4),{callback:s,options:r}),this.allKeys.add(m.split("+").at(-1))):!c&&!y&&(this.callbacks.set(m,{callback:s,options:r}),this.allKeys.add(m.split("+").at(-1)))}}#t(n){n.altKey&&this.buffer.push("alt"),n.ctrlKey&&this.buffer.push("ctrl"),n.metaKey&&this.buffer.push("meta"),n.shiftKey&&this.buffer.push("shift"),this.buffer.push(n.key);let c=this.buffer.join("+");return this.buffer.length=0,c}exec(n,c){if(!this.allKeys.has(c.key))return;let t=this.callbacks.get(this.#t(c));if(!t)return;let{callback:s,options:{bubbles:r=!1,args:m=[],checker:y=null}}=t;(!y||y(n,c))&&(s.bind(n,...m,c)(),r||(c.stopPropagation(),c.preventDefault()))}}class h{static _colorsMapping=new Map([["CanvasText",[0,0,0]],["Canvas",[255,255,255]]]);get _colors(){let n=new Map([["CanvasText",null],["Canvas",null]]);return(0,H.getColorValues)(n),(0,_.shadow)(this,"_colors",n)}convert(n){let c=(0,H.getRGB)(n);if(!window.matchMedia("(forced-colors: active)").matches)return c;for(let[t,s]of this._colors)if(s.every(((r,m)=>r===c[m])))return h._colorsMapping.get(t);return c}getHexCode(n){let c=this._colors.get(n);return c?_.Util.makeHexColor(...c):n}}class w{#t=null;#e=new Map;#s=new Map;#n=null;#a=null;#i=new f;#r=0;#l=new Set;#h=null;#d=null;#u=new Set;#c=!1;#o=null;#g=null;#f=null;#p=!1;#m=null;#A=new k;#b=!1;#_=!1;#E=null;#k=null;#F=null;#y=_.AnnotationEditorType.NONE;#v=new Set;#w=null;#x=null;#S=null;#M=this.blur.bind(this);#T=this.focus.bind(this);#L=this.copy.bind(this);#R=this.cut.bind(this);#I=this.paste.bind(this);#P=this.keydown.bind(this);#D=this.keyup.bind(this);#j=this.onEditingAction.bind(this);#V=this.onPageChanging.bind(this);#G=this.onScaleChanging.bind(this);#z=this.#nt.bind(this);#H=this.onRotationChanging.bind(this);#N={isEditing:!1,isEmpty:!0,hasSomethingToUndo:!1,hasSomethingToRedo:!1,hasSelectedEditor:!1,hasSelectedText:!1};#$=[0,0];#O=null;#U=null;#K=null;static TRANSLATE_SMALL=1;static TRANSLATE_BIG=10;static get _keyboardManager(){let n=w.prototype,c=m=>m.#U.contains(document.activeElement)&&document.activeElement.tagName!=="BUTTON"&&m.hasSomethingToControl(),t=(m,{target:y})=>{if(y instanceof HTMLInputElement){let{type:b}=y;return b!=="text"&&b!=="number"}return!0},s=this.TRANSLATE_SMALL,r=this.TRANSLATE_BIG;return(0,_.shadow)(this,"_keyboardManager",new i([[["ctrl+a","mac+meta+a"],n.selectAll,{checker:t}],[["ctrl+z","mac+meta+z"],n.undo,{checker:t}],[["ctrl+y","ctrl+shift+z","mac+meta+shift+z","ctrl+shift+Z","mac+meta+shift+Z"],n.redo,{checker:t}],[["Backspace","alt+Backspace","ctrl+Backspace","shift+Backspace","mac+Backspace","mac+alt+Backspace","mac+ctrl+Backspace","Delete","ctrl+Delete","shift+Delete","mac+Delete"],n.delete,{checker:t}],[["Enter","mac+Enter"],n.addNewEditorFromKeyboard,{checker:(m,{target:y})=>!(y instanceof HTMLButtonElement)&&m.#U.contains(y)&&!m.isEnterHandled}],[[" ","mac+ "],n.addNewEditorFromKeyboard,{checker:(m,{target:y})=>!(y instanceof HTMLButtonElement)&&m.#U.contains(document.activeElement)}],[["Escape","mac+Escape"],n.unselectAll],[["ArrowLeft","mac+ArrowLeft"],n.translateSelectedEditors,{args:[-s,0],checker:c}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],n.translateSelectedEditors,{args:[-r,0],checker:c}],[["ArrowRight","mac+ArrowRight"],n.translateSelectedEditors,{args:[s,0],checker:c}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],n.translateSelectedEditors,{args:[r,0],checker:c}],[["ArrowUp","mac+ArrowUp"],n.translateSelectedEditors,{args:[0,-s],checker:c}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],n.translateSelectedEditors,{args:[0,-r],checker:c}],[["ArrowDown","mac+ArrowDown"],n.translateSelectedEditors,{args:[0,s],checker:c}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],n.translateSelectedEditors,{args:[0,r],checker:c}]]))}constructor(n,c,t,s,r,m,y,b,R){this.#U=n,this.#K=c,this.#n=t,this._eventBus=s,this._eventBus._on("editingaction",this.#j),this._eventBus._on("pagechanging",this.#V),this._eventBus._on("scalechanging",this.#G),this._eventBus._on("rotationchanging",this.#H),this.#at(),this.#J(),this.#a=r.annotationStorage,this.#o=r.filterFactory,this.#x=m,this.#f=y||null,this.#c=b,this.#F=R||null,this.viewParameters={realScale:H.PixelsPerInch.PDF_TO_CSS_UNITS,rotation:0},this.isShiftKeyDown=!1}destroy(){this.#Q(),this.#Y(),this._eventBus._off("editingaction",this.#j),this._eventBus._off("pagechanging",this.#V),this._eventBus._off("scalechanging",this.#G),this._eventBus._off("rotationchanging",this.#H);for(let n of this.#s.values())n.destroy();this.#s.clear(),this.#e.clear(),this.#u.clear(),this.#t=null,this.#v.clear(),this.#i.destroy(),this.#n?.destroy(),this.#m?.hide(),this.#m=null,this.#g&&(clearTimeout(this.#g),this.#g=null),this.#O&&(clearTimeout(this.#O),this.#O=null),this.#rt()}async mlGuess(n){return this.#F?.guess(n)||null}get hasMLManager(){return!!this.#F}get hcmFilter(){return(0,_.shadow)(this,"hcmFilter",this.#x?this.#o.addHCMFilter(this.#x.foreground,this.#x.background):"none")}get direction(){return(0,_.shadow)(this,"direction",getComputedStyle(this.#U).direction)}get highlightColors(){return(0,_.shadow)(this,"highlightColors",this.#f?new Map(this.#f.split(",").map((n=>n.split("=").map((c=>c.trim()))))):null)}get highlightColorNames(){return(0,_.shadow)(this,"highlightColorNames",this.highlightColors?new Map(Array.from(this.highlightColors,(n=>n.reverse()))):null)}setMainHighlightColorPicker(n){this.#k=n}editAltText(n){this.#n?.editAltText(this,n)}onPageChanging({pageNumber:n}){this.#r=n-1}focusMainContainer(){this.#U.focus()}findParent(n,c){for(let t of this.#s.values()){let{x:s,y:r,width:m,height:y}=t.div.getBoundingClientRect();if(n>=s&&n<=s+m&&c>=r&&c<=r+y)return t}return null}disableUserSelect(n=!1){this.#K.classList.toggle("noUserSelect",n)}addShouldRescale(n){this.#u.add(n)}removeShouldRescale(n){this.#u.delete(n)}onScaleChanging({scale:n}){this.commitOrRemove(),this.viewParameters.realScale=n*H.PixelsPerInch.PDF_TO_CSS_UNITS;for(let c of this.#u)c.onScaleChanging()}onRotationChanging({pagesRotation:n}){this.commitOrRemove(),this.viewParameters.rotation=n}#W({anchorNode:n}){return n.nodeType===Node.TEXT_NODE?n.parentElement:n}highlightSelection(n=""){let c=document.getSelection();if(!c||c.isCollapsed)return;let{anchorNode:t,anchorOffset:s,focusNode:r,focusOffset:m}=c,y=c.toString(),b=this.#W(c).closest(".textLayer"),R=this.getSelectionBoxes(b);if(R){c.empty(),this.#y===_.AnnotationEditorType.NONE&&(this._eventBus.dispatch("showannotationeditorui",{source:this,mode:_.AnnotationEditorType.HIGHLIGHT}),this.showAllEditors("highlight",!0,!0));for(let L of this.#s.values())if(L.hasTextLayer(b)){L.createAndAddNewEditor({x:0,y:0},!1,{methodOfCreation:n,boxes:R,anchorNode:t,anchorOffset:s,focusNode:r,focusOffset:m,text:y});break}}}#it(){let n=document.getSelection();if(!n||n.isCollapsed)return;let c=this.#W(n).closest(".textLayer"),t=this.getSelectionBoxes(c);t&&(this.#m||=new N.HighlightToolbar(this),this.#m.show(c,t,this.direction==="ltr"))}addToAnnotationStorage(n){n.isEmpty()||!this.#a||this.#a.has(n.id)||this.#a.setValue(n.id,n)}#nt(){let n=document.getSelection();if(!n||n.isCollapsed){this.#w&&(this.#m?.hide(),this.#w=null,this.#C({hasSelectedText:!1}));return}let{anchorNode:c}=n;if(c!==this.#w)if(this.#W(n).closest(".textLayer")){if(this.#m?.hide(),this.#w=c,this.#C({hasSelectedText:!0}),(this.#y===_.AnnotationEditorType.HIGHLIGHT||this.#y===_.AnnotationEditorType.NONE)&&(this.#y===_.AnnotationEditorType.HIGHLIGHT&&this.showAllEditors("highlight",!0,!0),this.#p=this.isShiftKeyDown,!this.isShiftKeyDown)){let t=s=>{(s.type!=="pointerup"||s.button===0)&&(window.removeEventListener("pointerup",t),window.removeEventListener("blur",t),s.type==="pointerup"&&this.#X("main_toolbar"))};window.addEventListener("pointerup",t),window.addEventListener("blur",t)}}else this.#w&&(this.#m?.hide(),this.#w=null,this.#C({hasSelectedText:!1}))}#X(n=""){this.#y===_.AnnotationEditorType.HIGHLIGHT?this.highlightSelection(n):this.#c&&this.#it()}#at(){document.addEventListener("selectionchange",this.#z)}#rt(){document.removeEventListener("selectionchange",this.#z)}#ot(){window.addEventListener("focus",this.#T),window.addEventListener("blur",this.#M)}#Y(){window.removeEventListener("focus",this.#T),window.removeEventListener("blur",this.#M)}blur(){if(this.isShiftKeyDown=!1,this.#p&&(this.#p=!1,this.#X("main_toolbar")),!this.hasSelection)return;let{activeElement:n}=document;for(let c of this.#v)if(c.div.contains(n)){this.#E=[c,n],c._focusEventsAllowed=!1;break}}focus(){if(!this.#E)return;let[n,c]=this.#E;this.#E=null,c.addEventListener("focusin",(()=>{n._focusEventsAllowed=!0}),{once:!0}),c.focus()}#J(){window.addEventListener("keydown",this.#P),window.addEventListener("keyup",this.#D)}#Q(){window.removeEventListener("keydown",this.#P),window.removeEventListener("keyup",this.#D)}#Z(){document.addEventListener("copy",this.#L),document.addEventListener("cut",this.#R),document.addEventListener("paste",this.#I)}#tt(){document.removeEventListener("copy",this.#L),document.removeEventListener("cut",this.#R),document.removeEventListener("paste",this.#I)}addEditListeners(){this.#J(),this.#Z()}removeEditListeners(){this.#Q(),this.#tt()}copy(n){if(n.preventDefault(),this.#t?.commitOrRemove(),!this.hasSelection)return;let c=[];for(let t of this.#v){let s=t.serialize(!0);s&&c.push(s)}c.length!==0&&n.clipboardData.setData("application/pdfjs",JSON.stringify(c))}cut(n){this.copy(n),this.delete()}paste(n){n.preventDefault();let{clipboardData:c}=n;for(let r of c.items)for(let m of this.#d)if(m.isHandlingMimeForPasting(r.type)){m.paste(r,this.currentLayer);return}let t=c.getData("application/pdfjs");if(!t)return;try{t=JSON.parse(t)}catch(r){(0,_.warn)(`paste: "${r.message}".`);return}if(!Array.isArray(t))return;this.unselectAll();let s=this.currentLayer;try{let r=[];for(let b of t){let R=s.deserialize(b);if(!R)return;r.push(R)}let m=()=>{for(let b of r)this.#et(b);this.#st(r)},y=()=>{for(let b of r)b.remove()};this.addCommands({cmd:m,undo:y,mustExec:!0})}catch(r){(0,_.warn)(`paste: "${r.message}".`)}}keydown(n){this.isShiftKeyDown||n.key!=="Shift"||(this.isShiftKeyDown=!0),this.#y===_.AnnotationEditorType.NONE||this.isEditorHandlingKeyboard||w._keyboardManager.exec(this,n)}keyup(n){this.isShiftKeyDown&&n.key==="Shift"&&(this.isShiftKeyDown=!1,this.#p&&(this.#p=!1,this.#X("main_toolbar")))}onEditingAction({name:n}){switch(n){case"undo":case"redo":case"delete":case"selectAll":this[n]();break;case"highlightSelection":this.highlightSelection("context_menu")}}#C(n){Object.entries(n).some((([c,t])=>this.#N[c]!==t))&&(this._eventBus.dispatch("annotationeditorstateschanged",{source:this,details:Object.assign(this.#N,n)}),this.#y===_.AnnotationEditorType.HIGHLIGHT&&n.hasSelectedEditor===!1&&this.#B([[_.AnnotationEditorParamsType.HIGHLIGHT_FREE,!0]]))}#B(n){this._eventBus.dispatch("annotationeditorparamschanged",{source:this,details:n})}setEditingState(n){n?(this.#ot(),this.#Z(),this.#C({isEditing:this.#y!==_.AnnotationEditorType.NONE,isEmpty:this.#q(),hasSomethingToUndo:this.#i.hasSomethingToUndo(),hasSomethingToRedo:this.#i.hasSomethingToRedo(),hasSelectedEditor:!1})):(this.#Y(),this.#tt(),this.#C({isEditing:!1}),this.disableUserSelect(!1))}registerEditorTypes(n){if(!this.#d){this.#d=n;for(let c of this.#d)this.#B(c.defaultPropertiesToUpdate)}}getId(){return this.#A.id}get currentLayer(){return this.#s.get(this.#r)}getLayer(n){return this.#s.get(n)}get currentPageIndex(){return this.#r}addLayer(n){this.#s.set(n.pageIndex,n),this.#b?n.enable():n.disable()}removeLayer(n){this.#s.delete(n.pageIndex)}updateMode(n,c=null,t=!1){if(this.#y!==n)if(this.#y=n,n!==_.AnnotationEditorType.NONE){this.setEditingState(!0),this.#ht(),this.unselectAll();for(let s of this.#s.values())s.updateMode(n);if(c||!t){if(c){for(let s of this.#e.values())if(s.annotationElementId===c){this.setSelected(s),s.enterInEditMode();break}}}else this.addNewEditorFromKeyboard()}else this.setEditingState(!1),this.#lt()}addNewEditorFromKeyboard(){this.currentLayer.canCreateNewEmptyEditor()&&this.currentLayer.addNewEditor()}updateToolbar(n){n!==this.#y&&this._eventBus.dispatch("switchannotationeditormode",{source:this,mode:n})}updateParams(n,c){if(this.#d){switch(n){case _.AnnotationEditorParamsType.CREATE:this.currentLayer.addNewEditor();return;case _.AnnotationEditorParamsType.HIGHLIGHT_DEFAULT_COLOR:this.#k?.updateColor(c);break;case _.AnnotationEditorParamsType.HIGHLIGHT_SHOW_ALL:this._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:{type:"highlight",action:"toggle_visibility"}}}),(this.#S||=new Map).set(n,c),this.showAllEditors("highlight",c)}for(let t of this.#v)t.updateParams(n,c);for(let t of this.#d)t.updateDefaultParams(n,c)}}showAllEditors(n,c,t=!1){for(let s of this.#e.values())s.editorType===n&&s.show(c);(this.#S?.get(_.AnnotationEditorParamsType.HIGHLIGHT_SHOW_ALL)??!0)!==c&&this.#B([[_.AnnotationEditorParamsType.HIGHLIGHT_SHOW_ALL,c]])}enableWaiting(n=!1){if(this.#_!==n){this.#_=n;for(let c of this.#s.values())n?c.disableClick():c.enableClick(),c.div.classList.toggle("waiting",n)}}#ht(){if(!this.#b){this.#b=!0;for(let n of this.#s.values())n.enable();for(let n of this.#e.values())n.enable()}}#lt(){if(this.unselectAll(),this.#b){this.#b=!1;for(let n of this.#s.values())n.disable();for(let n of this.#e.values())n.disable()}}getEditors(n){let c=[];for(let t of this.#e.values())t.pageIndex===n&&c.push(t);return c}getEditor(n){return this.#e.get(n)}addEditor(n){this.#e.set(n.id,n)}removeEditor(n){n.div.contains(document.activeElement)&&(this.#g&&clearTimeout(this.#g),this.#g=setTimeout((()=>{this.focusMainContainer(),this.#g=null}),0)),this.#e.delete(n.id),this.unselect(n),n.annotationElementId&&this.#l.has(n.annotationElementId)||this.#a?.remove(n.id)}addDeletedAnnotationElement(n){this.#l.add(n.annotationElementId),n.deleted=!0}isDeletedAnnotationElement(n){return this.#l.has(n)}removeDeletedAnnotationElement(n){this.#l.delete(n.annotationElementId),n.deleted=!1}#et(n){let c=this.#s.get(n.pageIndex);c?c.addOrRebuild(n):(this.addEditor(n),this.addToAnnotationStorage(n))}setActiveEditor(n){this.#t!==n&&(this.#t=n,n&&this.#B(n.propertiesToUpdate))}get#ct(){let n=null;for(n of this.#v);return n}updateUI(n){this.#ct===n&&this.#B(n.propertiesToUpdate)}toggleSelected(n){this.#v.has(n)?(this.#v.delete(n),n.unselect(),this.#C({hasSelectedEditor:this.hasSelection})):(this.#v.add(n),n.select(),this.#B(n.propertiesToUpdate),this.#C({hasSelectedEditor:!0}))}setSelected(n){for(let c of this.#v)c!==n&&c.unselect();this.#v.clear(),this.#v.add(n),n.select(),this.#B(n.propertiesToUpdate),this.#C({hasSelectedEditor:!0})}isSelected(n){return this.#v.has(n)}get firstSelectedEditor(){return this.#v.values().next().value}unselect(n){n.unselect(),this.#v.delete(n),this.#C({hasSelectedEditor:this.hasSelection})}get hasSelection(){return this.#v.size!==0}get isEnterHandled(){return this.#v.size===1&&this.firstSelectedEditor.isEnterHandled}undo(){this.#i.undo(),this.#C({hasSomethingToUndo:this.#i.hasSomethingToUndo(),hasSomethingToRedo:!0,isEmpty:this.#q()})}redo(){this.#i.redo(),this.#C({hasSomethingToUndo:!0,hasSomethingToRedo:this.#i.hasSomethingToRedo(),isEmpty:this.#q()})}addCommands(n){this.#i.add(n),this.#C({hasSomethingToUndo:!0,hasSomethingToRedo:!1,isEmpty:this.#q()})}#q(){if(this.#e.size===0)return!0;if(this.#e.size===1)for(let n of this.#e.values())return n.isEmpty();return!1}delete(){if(this.commitOrRemove(),!this.hasSelection)return;let n=[...this.#v];this.addCommands({cmd:()=>{for(let c of n)c.remove()},undo:()=>{for(let c of n)this.#et(c)},mustExec:!0})}commitOrRemove(){this.#t?.commitOrRemove()}hasSomethingToControl(){return this.#t||this.hasSelection}#st(n){for(let c of this.#v)c.unselect();this.#v.clear();for(let c of n)c.isEmpty()||(this.#v.add(c),c.select());this.#C({hasSelectedEditor:this.hasSelection})}selectAll(){for(let n of this.#v)n.commit();this.#st(this.#e.values())}unselectAll(){if(!(this.#t&&(this.#t.commitOrRemove(),this.#y!==_.AnnotationEditorType.NONE))&&this.hasSelection){for(let n of this.#v)n.unselect();this.#v.clear(),this.#C({hasSelectedEditor:!1})}}translateSelectedEditors(n,c,t=!1){if(t||this.commitOrRemove(),!this.hasSelection)return;this.#$[0]+=n,this.#$[1]+=c;let[s,r]=this.#$,m=[...this.#v];this.#O&&clearTimeout(this.#O),this.#O=setTimeout((()=>{this.#O=null,this.#$[0]=this.#$[1]=0,this.addCommands({cmd:()=>{for(let y of m)this.#e.has(y.id)&&y.translateInPage(s,r)},undo:()=>{for(let y of m)this.#e.has(y.id)&&y.translateInPage(-s,-r)},mustExec:!1})}),1e3);for(let y of m)y.translateInPage(n,c)}setUpDragSession(){if(this.hasSelection){this.disableUserSelect(!0),this.#h=new Map;for(let n of this.#v)this.#h.set(n,{savedX:n.x,savedY:n.y,savedPageIndex:n.pageIndex,newX:0,newY:0,newPageIndex:-1})}}endDragSession(){if(!this.#h)return!1;this.disableUserSelect(!1);let n=this.#h;this.#h=null;let c=!1;for(let[{x:s,y:r,pageIndex:m},y]of n)y.newX=s,y.newY=r,y.newPageIndex=m,c||=s!==y.savedX||r!==y.savedY||m!==y.savedPageIndex;if(!c)return!1;let t=(s,r,m,y)=>{if(this.#e.has(s.id)){let b=this.#s.get(y);b?s._setParentAndPosition(b,r,m):(s.pageIndex=y,s.x=r,s.y=m)}};return this.addCommands({cmd:()=>{for(let[s,{newX:r,newY:m,newPageIndex:y}]of n)t(s,r,m,y)},undo:()=>{for(let[s,{savedX:r,savedY:m,savedPageIndex:y}]of n)t(s,r,m,y)},mustExec:!0}),!0}dragSelectedEditors(n,c){if(this.#h)for(let t of this.#h.keys())t.drag(n,c)}rebuild(n){if(n.parent===null){let c=this.getLayer(n.pageIndex);c?(c.changeParent(n),c.addOrRebuild(n)):(this.addEditor(n),this.addToAnnotationStorage(n),n.rebuild())}else n.parent.addOrRebuild(n)}get isEditorHandlingKeyboard(){return this.getActive()?.shouldGetKeyboardEvents()||this.#v.size===1&&this.firstSelectedEditor.shouldGetKeyboardEvents()}isActive(n){return this.#t===n}getActive(){return this.#t}getMode(){return this.#y}get imageManager(){return(0,_.shadow)(this,"imageManager",new M)}getSelectionBoxes(n){if(!n)return null;let c=document.getSelection();for(let R=0,L=c.rangeCount;R<L;R++)if(!n.contains(c.getRangeAt(R).commonAncestorContainer))return null;let{x:t,y:s,width:r,height:m}=n.getBoundingClientRect(),y;switch(n.getAttribute("data-main-rotation")){case"90":y=(R,L,I,B)=>({x:(L-s)/m,y:1-(R+I-t)/r,width:B/m,height:I/r});break;case"180":y=(R,L,I,B)=>({x:1-(R+I-t)/r,y:1-(L+B-s)/m,width:I/r,height:B/m});break;case"270":y=(R,L,I,B)=>({x:1-(L+B-s)/m,y:(R-t)/r,width:B/m,height:I/r});break;default:y=(R,L,I,B)=>({x:(R-t)/r,y:(L-s)/m,width:I/r,height:B/m})}let b=[];for(let R=0,L=c.rangeCount;R<L;R++){let I=c.getRangeAt(R);if(!I.collapsed)for(let{x:B,y:X,width:Z,height:nt}of I.getClientRects())Z!==0&&nt!==0&&b.push(y(B,X,Z,nt))}return b.length===0?null:b}}},94:(ot,it,j)=>{j.d(it,{PDFFetchStream:()=>k});var _=j(292),H=j(490);function N(i,h,w){return{method:"GET",headers:i,signal:w.signal,mode:"cors",credentials:h?"include":"same-origin",redirect:"follow"}}function W(i){let h=new Headers;for(let w in i){let S=i[w];S!==void 0&&h.append(w,S)}return h}function F(i){return i instanceof Uint8Array?i.buffer:i instanceof ArrayBuffer?i:((0,_.warn)(`getArrayBuffer - unexpected data format: ${i}`),new Uint8Array(i).buffer)}class k{constructor(h){this.source=h,this.isHttp=/^https?:/i.test(h.url),this.httpHeaders=this.isHttp&&h.httpHeaders||{},this._fullRequestReader=null,this._rangeRequestReaders=[]}get _progressiveDataLength(){return this._fullRequestReader?._loaded??0}getFullReader(){return(0,_.assert)(!this._fullRequestReader,"PDFFetchStream.getFullReader can only be called once."),this._fullRequestReader=new M(this),this._fullRequestReader}getRangeReader(h,w){if(w<=this._progressiveDataLength)return null;let S=new f(this,h,w);return this._rangeRequestReaders.push(S),S}cancelAllRequests(h){this._fullRequestReader?.cancel(h);for(let w of this._rangeRequestReaders.slice(0))w.cancel(h)}}class M{constructor(h){this._stream=h,this._reader=null,this._loaded=0,this._filename=null;let w=h.source;this._withCredentials=w.withCredentials||!1,this._contentLength=w.length,this._headersCapability=Promise.withResolvers(),this._disableRange=w.disableRange||!1,this._rangeChunkSize=w.rangeChunkSize,this._rangeChunkSize||this._disableRange||(this._disableRange=!0),this._abortController=new AbortController,this._isStreamingSupported=!w.disableStream,this._isRangeSupported=!w.disableRange,this._headers=W(this._stream.httpHeaders);let S=w.url;fetch(S,N(this._headers,this._withCredentials,this._abortController)).then((n=>{if(!(0,H.validateResponseStatus)(n.status))throw(0,H.createResponseStatusError)(n.status,S);this._reader=n.body.getReader(),this._headersCapability.resolve();let c=r=>n.headers.get(r),{allowRangeRequests:t,suggestedLength:s}=(0,H.validateRangeRequestCapabilities)({getResponseHeader:c,isHttp:this._stream.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=t,this._contentLength=s||this._contentLength,this._filename=(0,H.extractFilenameFromHeader)(c),!this._isStreamingSupported&&this._isRangeSupported&&this.cancel(new _.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;let{value:h,done:w}=await this._reader.read();return w?{value:h,done:w}:(this._loaded+=h.byteLength,this.onProgress?.({loaded:this._loaded,total:this._contentLength}),{value:F(h),done:!1})}cancel(h){this._reader?.cancel(h),this._abortController.abort()}}class f{constructor(h,w,S){this._stream=h,this._reader=null,this._loaded=0;let n=h.source;this._withCredentials=n.withCredentials||!1,this._readCapability=Promise.withResolvers(),this._isStreamingSupported=!n.disableStream,this._abortController=new AbortController,this._headers=W(this._stream.httpHeaders),this._headers.append("Range",`bytes=${w}-${S-1}`);let c=n.url;fetch(c,N(this._headers,this._withCredentials,this._abortController)).then((t=>{if(!(0,H.validateResponseStatus)(t.status))throw(0,H.createResponseStatusError)(t.status,c);this._readCapability.resolve(),this._reader=t.body.getReader()})).catch(this._readCapability.reject),this.onProgress=null}get isStreamingSupported(){return this._isStreamingSupported}async read(){await this._readCapability.promise;let{value:h,done:w}=await this._reader.read();return w?{value:h,done:w}:(this._loaded+=h.byteLength,this.onProgress?.({loaded:this._loaded}),{value:F(h),done:!1})}cancel(h){this._reader?.cancel(h),this._abortController.abort()}}},10:(ot,it,j)=>{j.d(it,{FontFaceObject:()=>N,FontLoader:()=>H});var _=j(292);class H{#t=new Set;constructor({ownerDocument:F=globalThis.document,styleElement:k=null}){this._document=F,this.nativeFontFaces=new Set,this.styleElement=null,this.loadingRequests=[],this.loadTestFontId=0}addNativeFontFace(F){this.nativeFontFaces.add(F),this._document.fonts.add(F)}removeNativeFontFace(F){this.nativeFontFaces.delete(F),this._document.fonts.delete(F)}insertRule(F){this.styleElement||(this.styleElement=this._document.createElement("style"),this._document.documentElement.getElementsByTagName("head")[0].append(this.styleElement));let k=this.styleElement.sheet;k.insertRule(F,k.cssRules.length)}clear(){for(let F of this.nativeFontFaces)this._document.fonts.delete(F);this.nativeFontFaces.clear(),this.#t.clear(),this.styleElement&&(this.styleElement.remove(),this.styleElement=null)}async loadSystemFont({systemFontInfo:F,_inspectFont:k}){if(F&&!this.#t.has(F.loadedName))if((0,_.assert)(!this.disableFontFace,"loadSystemFont shouldn't be called when `disableFontFace` is set."),this.isFontLoadingAPISupported){let{loadedName:M,src:f,style:i}=F,h=new FontFace(M,f,i);this.addNativeFontFace(h);try{await h.load(),this.#t.add(M),k?.(F)}catch{(0,_.warn)(`Cannot load system font: ${F.baseFontName}, installing it could help to improve PDF rendering.`),this.removeNativeFontFace(h)}}else(0,_.unreachable)("Not implemented: loadSystemFont without the Font Loading API.")}async bind(F){if(F.attached||F.missingFile&&!F.systemFontInfo)return;if(F.attached=!0,F.systemFontInfo){await this.loadSystemFont(F);return}if(this.isFontLoadingAPISupported){let M=F.createNativeFontFace();if(M){this.addNativeFontFace(M);try{await M.loaded}catch(f){throw(0,_.warn)(`Failed to load font '${M.family}': '${f}'.`),F.disableFontFace=!0,f}}return}let k=F.createFontFaceRule();if(k){if(this.insertRule(k),this.isSyncFontLoadingSupported)return;await new Promise((M=>{let f=this._queueLoadingCallback(M);this._prepareFontLoadEvent(F,f)}))}}get isFontLoadingAPISupported(){let F=!!this._document?.fonts;return(0,_.shadow)(this,"isFontLoadingAPISupported",F)}get isSyncFontLoadingSupported(){let F=!1;return(_.isNodeJS||typeof navigator<"u"&&typeof navigator?.userAgent=="string"&&/Mozilla\/5.0.*?rv:\d+.*? Gecko/.test(navigator.userAgent))&&(F=!0),(0,_.shadow)(this,"isSyncFontLoadingSupported",F)}_queueLoadingCallback(F){let{loadingRequests:k}=this,M={done:!1,complete:function(){for((0,_.assert)(!M.done,"completeRequest() cannot be called twice."),M.done=!0;k.length>0&&k[0].done;){let i=k.shift();setTimeout(i.callback,0)}},callback:F};return k.push(M),M}get _loadTestFont(){let F=atob("T1RUTwALAIAAAwAwQ0ZGIDHtZg4AAAOYAAAAgUZGVE1lkzZwAAAEHAAAABxHREVGABQAFQAABDgAAAAeT1MvMlYNYwkAAAEgAAAAYGNtYXABDQLUAAACNAAAAUJoZWFk/xVFDQAAALwAAAA2aGhlYQdkA+oAAAD0AAAAJGhtdHgD6AAAAAAEWAAAAAZtYXhwAAJQAAAAARgAAAAGbmFtZVjmdH4AAAGAAAAAsXBvc3T/hgAzAAADeAAAACAAAQAAAAEAALZRFsRfDzz1AAsD6AAAAADOBOTLAAAAAM4KHDwAAAAAA+gDIQAAAAgAAgAAAAAAAAABAAADIQAAAFoD6AAAAAAD6AABAAAAAAAAAAAAAAAAAAAAAQAAUAAAAgAAAAQD6AH0AAUAAAKKArwAAACMAooCvAAAAeAAMQECAAACAAYJAAAAAAAAAAAAAQAAAAAAAAAAAAAAAFBmRWQAwAAuAC4DIP84AFoDIQAAAAAAAQAAAAAAAAAAACAAIAABAAAADgCuAAEAAAAAAAAAAQAAAAEAAAAAAAEAAQAAAAEAAAAAAAIAAQAAAAEAAAAAAAMAAQAAAAEAAAAAAAQAAQAAAAEAAAAAAAUAAQAAAAEAAAAAAAYAAQAAAAMAAQQJAAAAAgABAAMAAQQJAAEAAgABAAMAAQQJAAIAAgABAAMAAQQJAAMAAgABAAMAAQQJAAQAAgABAAMAAQQJAAUAAgABAAMAAQQJAAYAAgABWABYAAAAAAAAAwAAAAMAAAAcAAEAAAAAADwAAwABAAAAHAAEACAAAAAEAAQAAQAAAC7//wAAAC7////TAAEAAAAAAAABBgAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAD/gwAyAAAAAQAAAAAAAAAAAAAAAAAAAAABAAQEAAEBAQJYAAEBASH4DwD4GwHEAvgcA/gXBIwMAYuL+nz5tQXkD5j3CBLnEQACAQEBIVhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYAAABAQAADwACAQEEE/t3Dov6fAH6fAT+fPp8+nwHDosMCvm1Cvm1DAz6fBQAAAAAAAABAAAAAMmJbzEAAAAAzgTjFQAAAADOBOQpAAEAAAAAAAAADAAUAAQAAAABAAAAAgABAAAAAAAAAAAD6AAAAAAAAA==");return(0,_.shadow)(this,"_loadTestFont",F)}_prepareFontLoadEvent(F,k){function M(b,R){return b.charCodeAt(R)<<24|b.charCodeAt(R+1)<<16|b.charCodeAt(R+2)<<8|255&b.charCodeAt(R+3)}function f(b,R,L,I){return b.substring(0,R)+I+b.substring(R+L)}let i,h,w=this._document.createElement("canvas");w.width=1,w.height=1;let S=w.getContext("2d"),n=0,c=`lt${Date.now()}${this.loadTestFontId++}`,t=this._loadTestFont;t=f(t,976,c.length,c);let s=1482184792,r=M(t,16);for(i=0,h=c.length-3;i<h;i+=4)r=r-s+M(c,i)|0;i<c.length&&(r=r-s+M(c+"XXX",i)|0),t=f(t,16,4,(0,_.string32)(r));let m=`@font-face {font-family:"${c}";src:${`url(data:font/opentype;base64,${btoa(t)});`}}`;this.insertRule(m);let 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(let b of[F.loadedName,c]){let R=this._document.createElement("span");R.textContent="Hi",R.style.fontFamily=b,y.append(R)}this._document.body.append(y),(function b(R,L){if(++n>30){(0,_.warn)("Load test font never loaded."),L();return}S.font="30px "+R,S.fillText(".",0,20),S.getImageData(0,0,1,1).data[3]>0?L():setTimeout(b.bind(null,R,L))})(c,(()=>{y.remove(),k.complete()}))}}class N{constructor(F,{isEvalSupported:k=!0,disableFontFace:M=!1,ignoreErrors:f=!1,inspectFont:i=null}){this.compiledGlyphs=Object.create(null);for(let h in F)this[h]=F[h];this.isEvalSupported=k!==!1,this.disableFontFace=M===!0,this.ignoreErrors=f===!0,this._inspectFont=i}createNativeFontFace(){if(!this.data||this.disableFontFace)return null;let F;if(this.cssFontInfo){let k={weight:this.cssFontInfo.fontWeight};this.cssFontInfo.italicAngle&&(k.style=`oblique ${this.cssFontInfo.italicAngle}deg`),F=new FontFace(this.cssFontInfo.fontFamily,this.data,k)}else F=new FontFace(this.loadedName,this.data,{});return this._inspectFont?.(this),F}createFontFaceRule(){if(!this.data||this.disableFontFace)return null;let F=(0,_.bytesToString)(this.data),k=`url(data:${this.mimetype};base64,${btoa(F)});`,M;if(this.cssFontInfo){let f=`font-weight: ${this.cssFontInfo.fontWeight};`;this.cssFontInfo.italicAngle&&(f+=`font-style: oblique ${this.cssFontInfo.italicAngle}deg;`),M=`@font-face {font-family:"${this.cssFontInfo.fontFamily}";${f}src:${k}}`}else M=`@font-face {font-family:"${this.loadedName}";src:${k}}`;return this._inspectFont?.(this,k),M}getPathGenerator(F,k){if(this.compiledGlyphs[k]!==void 0)return this.compiledGlyphs[k];let M;try{M=F.get(this.loadedName+"_path_"+k)}catch(f){if(!this.ignoreErrors)throw f;return(0,_.warn)(`getPathGenerator - ignoring character: "${f}".`),this.compiledGlyphs[k]=function(i,h){}}if(this.isEvalSupported&&_.FeatureTest.isEvalSupported){let f=[];for(let i of M){let h=i.args!==void 0?i.args.join(","):"";f.push("c.",i.cmd,"(",h,`);
11
+ `)}return this.compiledGlyphs[k]=new Function("c","size",f.join(""))}return this.compiledGlyphs[k]=function(f,i){for(let h of M)h.cmd==="scale"&&(h.args=[i,-i]),f[h.cmd].apply(f,h.args)}}}},62:(ot,it,j)=>{j.d(it,{Metadata:()=>H});var _=j(292);class H{#t;#e;constructor({parsedData:W,rawData:F}){this.#t=W,this.#e=F}getRaw(){return this.#e}get(W){return this.#t.get(W)??null}getAll(){return(0,_.objectFromMap)(this.#t)}has(W){return this.#t.has(W)}}},457:(ot,it,j)=>{j.d(it,{PDFNetworkStream:()=>W});var _=j(292),H=j(490);class N{constructor(f,i={}){this.url=f,this.isHttp=/^https?:/i.test(f),this.httpHeaders=this.isHttp&&i.httpHeaders||Object.create(null),this.withCredentials=i.withCredentials||!1,this.currXhrId=0,this.pendingRequests=Object.create(null)}requestRange(f,i,h){let w={begin:f,end:i};for(let S in h)w[S]=h[S];return this.request(w)}requestFull(f){return this.request(f)}request(f){let i=new XMLHttpRequest,h=this.currXhrId++,w=this.pendingRequests[h]={xhr:i};i.open("GET",this.url),i.withCredentials=this.withCredentials;for(let S in this.httpHeaders){let n=this.httpHeaders[S];n!==void 0&&i.setRequestHeader(S,n)}return this.isHttp&&"begin"in f&&"end"in f?(i.setRequestHeader("Range",`bytes=${f.begin}-${f.end-1}`),w.expectedStatus=206):w.expectedStatus=200,i.responseType="arraybuffer",f.onError&&(i.onerror=function(S){f.onError(i.status)}),i.onreadystatechange=this.onStateChange.bind(this,h),i.onprogress=this.onProgress.bind(this,h),w.onHeadersReceived=f.onHeadersReceived,w.onDone=f.onDone,w.onError=f.onError,w.onProgress=f.onProgress,i.send(null),h}onProgress(f,i){let h=this.pendingRequests[f];h&&h.onProgress?.(i)}onStateChange(f,i){let h=this.pendingRequests[f];if(!h)return;let w=h.xhr;if(w.readyState>=2&&h.onHeadersReceived&&(h.onHeadersReceived(),delete h.onHeadersReceived),w.readyState!==4||!(f in this.pendingRequests))return;if(delete this.pendingRequests[f],w.status===0&&this.isHttp){h.onError?.(w.status);return}let S=w.status||200;if(!(S===200&&h.expectedStatus===206)&&S!==h.expectedStatus){h.onError?.(w.status);return}let n=(function(t){let s=t.response;return typeof s!="string"?s:(0,_.stringToBytes)(s).buffer})(w);if(S===206){let c=w.getResponseHeader("Content-Range"),t=/bytes (\d+)-(\d+)\/(\d+)/.exec(c);h.onDone({begin:parseInt(t[1],10),chunk:n})}else n?h.onDone({begin:0,chunk:n}):h.onError?.(w.status)}getRequestXhr(f){return this.pendingRequests[f].xhr}isPendingRequest(f){return f in this.pendingRequests}abortRequest(f){let i=this.pendingRequests[f].xhr;delete this.pendingRequests[f],i.abort()}}class W{constructor(f){this._source=f,this._manager=new N(f.url,{httpHeaders:f.httpHeaders,withCredentials:f.withCredentials}),this._rangeChunkSize=f.rangeChunkSize,this._fullRequestReader=null,this._rangeRequestReaders=[]}_onRangeRequestReaderClosed(f){let i=this._rangeRequestReaders.indexOf(f);i>=0&&this._rangeRequestReaders.splice(i,1)}getFullReader(){return(0,_.assert)(!this._fullRequestReader,"PDFNetworkStream.getFullReader can only be called once."),this._fullRequestReader=new F(this._manager,this._source),this._fullRequestReader}getRangeReader(f,i){let h=new k(this._manager,f,i);return h.onClosed=this._onRangeRequestReaderClosed.bind(this),this._rangeRequestReaders.push(h),h}cancelAllRequests(f){this._fullRequestReader?.cancel(f);for(let i of this._rangeRequestReaders.slice(0))i.cancel(f)}}class F{constructor(f,i){this._manager=f;let h={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=f.requestFull(h),this._headersReceivedCapability=Promise.withResolvers(),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(){let f=this._fullRequestId,i=this._manager.getRequestXhr(f),h=n=>i.getResponseHeader(n),{allowRangeRequests:w,suggestedLength:S}=(0,H.validateRangeRequestCapabilities)({getResponseHeader:h,isHttp:this._manager.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});w&&(this._isRangeSupported=!0),this._contentLength=S||this._contentLength,this._filename=(0,H.extractFilenameFromHeader)(h),this._isRangeSupported&&this._manager.abortRequest(f),this._headersReceivedCapability.resolve()}_onDone(f){if(f&&(this._requests.length>0?this._requests.shift().resolve({value:f.chunk,done:!1}):this._cachedChunks.push(f.chunk)),this._done=!0,!(this._cachedChunks.length>0)){for(let i of this._requests)i.resolve({value:void 0,done:!0});this._requests.length=0}}_onError(f){this._storedError=(0,H.createResponseStatusError)(f,this._url),this._headersReceivedCapability.reject(this._storedError);for(let i of this._requests)i.reject(this._storedError);this._requests.length=0,this._cachedChunks.length=0}_onProgress(f){this.onProgress?.({loaded:f.loaded,total:f.lengthComputable?f.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};let f=Promise.withResolvers();return this._requests.push(f),f.promise}cancel(f){this._done=!0,this._headersReceivedCapability.reject(f);for(let 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 k{constructor(f,i,h){this._manager=f;let w={onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)};this._url=f.url,this._requestId=f.requestRange(i,h,w),this._requests=[],this._queuedChunk=null,this._done=!1,this._storedError=void 0,this.onProgress=null,this.onClosed=null}_close(){this.onClosed?.(this)}_onDone(f){let i=f.chunk;this._requests.length>0?this._requests.shift().resolve({value:i,done:!1}):this._queuedChunk=i,this._done=!0;for(let h of this._requests)h.resolve({value:void 0,done:!0});this._requests.length=0,this._close()}_onError(f){this._storedError=(0,H.createResponseStatusError)(f,this._url);for(let i of this._requests)i.reject(this._storedError);this._requests.length=0,this._queuedChunk=null}_onProgress(f){this.isStreamingSupported||this.onProgress?.({loaded:f.loaded})}get isStreamingSupported(){return!1}async read(){if(this._storedError)throw this._storedError;if(this._queuedChunk!==null){let i=this._queuedChunk;return this._queuedChunk=null,{value:i,done:!1}}if(this._done)return{value:void 0,done:!0};let f=Promise.withResolvers();return this._requests.push(f),f.promise}cancel(f){this._done=!0;for(let 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()}}},490:(ot,it,j)=>{j.d(it,{createResponseStatusError:()=>F,extractFilenameFromHeader:()=>W,validateRangeRequestCapabilities:()=>N,validateResponseStatus:()=>k});var _=j(292),H=j(419);function N({getResponseHeader:M,isHttp:f,rangeChunkSize:i,disableRange:h}){let w={allowRangeRequests:!1,suggestedLength:void 0},S=parseInt(M("Content-Length"),10);return!Number.isInteger(S)||(w.suggestedLength=S,S<=2*i)||h||!f||M("Accept-Ranges")!=="bytes"||(M("Content-Encoding")||"identity")!=="identity"||(w.allowRangeRequests=!0),w}function W(M){let f=M("Content-Disposition");if(f){let i=(function(w){let S=!0,n=c("filename\\*","i").exec(w);if(n){n=n[1];let b=r(n);return b=unescape(b),b=m(b),b=y(b),s(b)}if(n=(function(R){let L=[],I,B=c("filename\\*((?!0\\d)\\d+)(\\*?)","ig");for(;(I=B.exec(R))!==null;){let[,Z,nt,G]=I;if(Z=parseInt(Z,10),Z in L){if(Z===0)break}else L[Z]=[nt,G]}let X=[];for(let Z=0;Z<L.length&&Z in L;++Z){let[nt,G]=L[Z];G=r(G),nt&&(G=unescape(G),Z===0&&(G=m(G))),X.push(G)}return X.join("")})(w),n)return s(y(n));if(n=c("filename","i").exec(w),n){n=n[1];let b=r(n);return b=y(b),s(b)}function c(b,R){return new RegExp("(?:^|;)\\s*"+b+'\\s*=\\s*([^";\\s][^;\\s]*|"(?:[^"\\\\]|\\\\"?)+"?)',R)}function t(b,R){if(b){if(!/^[\x00-\xFF]+$/.test(R))return R;try{let L=new TextDecoder(b,{fatal:!0}),I=(0,_.stringToBytes)(R);R=L.decode(I),S=!1}catch{}}return R}function s(b){return S&&/[\x80-\xff]/.test(b)&&(b=t("utf-8",b),S&&(b=t("iso-8859-1",b))),b}function r(b){if(b.startsWith('"')){let R=b.slice(1).split('\\"');for(let L=0;L<R.length;++L){let I=R[L].indexOf('"');I!==-1&&(R[L]=R[L].slice(0,I),R.length=L+1),R[L]=R[L].replaceAll(/\\(.)/g,"$1")}b=R.join('"')}return b}function m(b){let R=b.indexOf("'");return R===-1?b:t(b.slice(0,R),b.slice(R+1).replace(/^[^']*'/,""))}function y(b){return!b.startsWith("=?")||/[\x00-\x19\x80-\xff]/.test(b)?b:b.replaceAll(/=\?([\w-]*)\?([QqBb])\?((?:[^?]|\?(?!=))*)\?=/g,(function(R,L,I,B){if(I==="q"||I==="Q")return t(L,B=(B=B.replaceAll("_"," ")).replaceAll(/=([0-9a-fA-F]{2})/g,(function(X,Z){return String.fromCharCode(parseInt(Z,16))})));try{B=atob(B)}catch{}return t(L,B)}))}return""})(f);if(i.includes("%"))try{i=decodeURIComponent(i)}catch{}if((0,H.isPdfFile)(i))return i}return null}function F(M,f){return M===404||M===0&&f.startsWith("file:")?new _.MissingPDFException('Missing PDF "'+f+'".'):new _.UnexpectedResponseException(`Unexpected server response (${M}) while retrieving PDF "${f}".`,M)}function k(M){return M===200||M===206}},786:(ot,it,j)=>{j.a(ot,(async(_,H)=>{try{let h=function(y){let b=f.parse(y);return b.protocol==="file:"||b.host?b:/^[a-z]:[/\\]/i.test(y)?f.parse(`file:///${y}`):(b.host||(b.protocol="file:"),b)},c=function(y,b){return{protocol:y.protocol,auth:y.auth,host:y.hostname,port:y.port,path:y.path,method:"GET",headers:b}};j.d(it,{PDFNodeStream:()=>w});var N=j(292),W=j(490);let F,k,M,f;N.isNodeJS&&(F=await import("./fs-HJ6WWW73.js"),k=await import("./http-FKJJMT2N.js"),M=await import("./https-MUBFLDZM.js"),f=await import("./url-ABJ6S2Y6.js"));let i=/^file:\/\/\/[a-zA-Z]:\//;class w{constructor(b){this.source=b,this.url=h(b.url),this.isHttp=this.url.protocol==="http:"||this.url.protocol==="https:",this.isFsUrl=this.url.protocol==="file:",this.httpHeaders=this.isHttp&&b.httpHeaders||{},this._fullRequestReader=null,this._rangeRequestReaders=[]}get _progressiveDataLength(){return this._fullRequestReader?._loaded??0}getFullReader(){return(0,N.assert)(!this._fullRequestReader,"PDFNodeStream.getFullReader can only be called once."),this._fullRequestReader=this.isFsUrl?new r(this):new t(this),this._fullRequestReader}getRangeReader(b,R){if(R<=this._progressiveDataLength)return null;let L=this.isFsUrl?new m(this,b,R):new s(this,b,R);return this._rangeRequestReaders.push(L),L}cancelAllRequests(b){this._fullRequestReader?.cancel(b);for(let R of this._rangeRequestReaders.slice(0))R.cancel(b)}}class S{constructor(b){this._url=b.url,this._done=!1,this._storedError=null,this.onProgress=null;let R=b.source;this._contentLength=R.length,this._loaded=0,this._filename=null,this._disableRange=R.disableRange||!1,this._rangeChunkSize=R.rangeChunkSize,this._rangeChunkSize||this._disableRange||(this._disableRange=!0),this._isStreamingSupported=!R.disableStream,this._isRangeSupported=!R.disableRange,this._readableStream=null,this._readCapability=Promise.withResolvers(),this._headersCapability=Promise.withResolvers()}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;let b=this._readableStream.read();return b===null?(this._readCapability=Promise.withResolvers(),this.read()):(this._loaded+=b.length,this.onProgress?.({loaded:this._loaded,total:this._contentLength}),{value:new Uint8Array(b).buffer,done:!1})}cancel(b){this._readableStream?this._readableStream.destroy(b):this._error(b)}_error(b){this._storedError=b,this._readCapability.resolve()}_setReadableStream(b){this._readableStream=b,b.on("readable",(()=>{this._readCapability.resolve()})),b.on("end",(()=>{b.destroy(),this._done=!0,this._readCapability.resolve()})),b.on("error",(R=>{this._error(R)})),!this._isStreamingSupported&&this._isRangeSupported&&this._error(new N.AbortException("streaming is disabled")),this._storedError&&this._readableStream.destroy(this._storedError)}}class n{constructor(b){this._url=b.url,this._done=!1,this._storedError=null,this.onProgress=null,this._loaded=0,this._readableStream=null,this._readCapability=Promise.withResolvers();let R=b.source;this._isStreamingSupported=!R.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;let b=this._readableStream.read();return b===null?(this._readCapability=Promise.withResolvers(),this.read()):(this._loaded+=b.length,this.onProgress?.({loaded:this._loaded}),{value:new Uint8Array(b).buffer,done:!1})}cancel(b){this._readableStream?this._readableStream.destroy(b):this._error(b)}_error(b){this._storedError=b,this._readCapability.resolve()}_setReadableStream(b){this._readableStream=b,b.on("readable",(()=>{this._readCapability.resolve()})),b.on("end",(()=>{b.destroy(),this._done=!0,this._readCapability.resolve()})),b.on("error",(R=>{this._error(R)})),this._storedError&&this._readableStream.destroy(this._storedError)}}class t extends S{constructor(b){super(b);let R=L=>{if(L.statusCode===404){let Z=new N.MissingPDFException(`Missing PDF "${this._url}".`);this._storedError=Z,this._headersCapability.reject(Z);return}this._headersCapability.resolve(),this._setReadableStream(L);let I=Z=>this._readableStream.headers[Z.toLowerCase()],{allowRangeRequests:B,suggestedLength:X}=(0,W.validateRangeRequestCapabilities)({getResponseHeader:I,isHttp:b.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=B,this._contentLength=X||this._contentLength,this._filename=(0,W.extractFilenameFromHeader)(I)};this._request=null,this._url.protocol==="http:"?this._request=k.request(c(this._url,b.httpHeaders),R):this._request=M.request(c(this._url,b.httpHeaders),R),this._request.on("error",(L=>{this._storedError=L,this._headersCapability.reject(L)})),this._request.end()}}class s extends n{constructor(b,R,L){super(b),this._httpHeaders={};for(let B in b.httpHeaders){let X=b.httpHeaders[B];X!==void 0&&(this._httpHeaders[B]=X)}this._httpHeaders.Range=`bytes=${R}-${L-1}`;let I=B=>{if(B.statusCode!==404)this._setReadableStream(B);else{let X=new N.MissingPDFException(`Missing PDF "${this._url}".`);this._storedError=X}};this._request=null,this._url.protocol==="http:"?this._request=k.request(c(this._url,this._httpHeaders),I):this._request=M.request(c(this._url,this._httpHeaders),I),this._request.on("error",(B=>{this._storedError=B})),this._request.end()}}class r extends S{constructor(b){super(b);let R=decodeURIComponent(this._url.path);i.test(this._url.href)&&(R=R.replace(/^\//,"")),F.promises.lstat(R).then((L=>{this._contentLength=L.size,this._setReadableStream(F.createReadStream(R)),this._headersCapability.resolve()}),(L=>{L.code==="ENOENT"&&(L=new N.MissingPDFException(`Missing PDF "${R}".`)),this._storedError=L,this._headersCapability.reject(L)}))}}class m extends n{constructor(b,R,L){super(b);let I=decodeURIComponent(this._url.path);i.test(this._url.href)&&(I=I.replace(/^\//,"")),this._setReadableStream(F.createReadStream(I,{start:R,end:L-1}))}}H()}catch(F){H(F)}}),1)},573:(ot,it,j)=>{j.a(ot,(async(_,H)=>{try{j.d(it,{NodeCMapReaderFactory:()=>h,NodeCanvasFactory:()=>i,NodeFilterFactory:()=>f,NodeStandardFontDataFactory:()=>w});var N=j(583);let W,F,k;if(j(292).isNodeJS){W=await import("./fs-HJ6WWW73.js");try{F=await import("./canvas-FAXPLPXN.js")}catch{}try{k=await import("./path2d-QWN6DFCC.js")}catch{}}let M=function(S){return W.promises.readFile(S).then((n=>new Uint8Array(n)))};class f extends N.BaseFilterFactory{}class i extends N.BaseCanvasFactory{_createCanvas(n,c){return F.createCanvas(n,c)}}class h extends N.BaseCMapReaderFactory{_fetchData(n,c){return M(n).then((t=>({cMapData:t,compressionType:c})))}}class w extends N.BaseStandardFontDataFactory{_fetchData(n){return M(n)}}H()}catch(W){H(W)}}),1)},626:(ot,it,j)=>{j.d(it,{OptionalContentConfig:()=>F});var _=j(292),H=j(651);let N=Symbol("INTERNAL");class W{#t=!1;#e=!1;#s=!1;#n=!0;constructor(M,{name:f,intent:i,usage:h}){this.#t=!!(M&_.RenderingIntentFlag.DISPLAY),this.#e=!!(M&_.RenderingIntentFlag.PRINT),this.name=f,this.intent=i,this.usage=h}get visible(){if(this.#s)return this.#n;if(!this.#n)return!1;let{print:M,view:f}=this.usage;return this.#t?f?.viewState!=="OFF":!this.#e||M?.printState!=="OFF"}_setVisible(M,f,i=!1){M!==N&&(0,_.unreachable)("Internal method `_setVisible` called."),this.#s=i,this.#n=f}}class F{#t=null;#e=new Map;#s=null;#n=null;constructor(M,f=_.RenderingIntentFlag.DISPLAY){if(this.renderingIntent=f,this.name=null,this.creator=null,M!==null){this.name=M.name,this.creator=M.creator,this.#n=M.order;for(let i of M.groups)this.#e.set(i.id,new W(f,i));if(M.baseState==="OFF")for(let i of this.#e.values())i._setVisible(N,!1);for(let i of M.on)this.#e.get(i)._setVisible(N,!0);for(let i of M.off)this.#e.get(i)._setVisible(N,!1);this.#s=this.getHash()}}#a(M){let f=M.length;if(f<2)return!0;let i=M[0];for(let h=1;h<f;h++){let w=M[h],S;if(Array.isArray(w))S=this.#a(w);else{if(!this.#e.has(w))return(0,_.warn)(`Optional content group not found: ${w}`),!0;S=this.#e.get(w).visible}switch(i){case"And":if(!S)return!1;break;case"Or":if(S)return!0;break;case"Not":return!S;default:return!0}}return i==="And"}isVisible(M){if(this.#e.size===0)return!0;if(!M)return(0,_.info)("Optional content group not defined."),!0;if(M.type==="OCG")return this.#e.has(M.id)?this.#e.get(M.id).visible:((0,_.warn)(`Optional content group not found: ${M.id}`),!0);if(M.type==="OCMD"){if(M.expression)return this.#a(M.expression);if(!M.policy||M.policy==="AnyOn"){for(let f of M.ids){if(!this.#e.has(f))return(0,_.warn)(`Optional content group not found: ${f}`),!0;if(this.#e.get(f).visible)return!0}return!1}if(M.policy==="AllOn"){for(let f of M.ids){if(!this.#e.has(f))return(0,_.warn)(`Optional content group not found: ${f}`),!0;if(!this.#e.get(f).visible)return!1}return!0}if(M.policy==="AnyOff"){for(let f of M.ids){if(!this.#e.has(f))return(0,_.warn)(`Optional content group not found: ${f}`),!0;if(!this.#e.get(f).visible)return!0}return!1}if(M.policy==="AllOff"){for(let f of M.ids){if(!this.#e.has(f))return(0,_.warn)(`Optional content group not found: ${f}`),!0;if(this.#e.get(f).visible)return!1}return!0}return(0,_.warn)(`Unknown optional content policy ${M.policy}.`),!0}return(0,_.warn)(`Unknown group type ${M.type}.`),!0}setVisibility(M,f=!0){let i=this.#e.get(M);i?(i._setVisible(N,!!f,!0),this.#t=null):(0,_.warn)(`Optional content group not found: ${M}`)}setOCGState({state:M,preserveRB:f}){let i;for(let h of M){switch(h){case"ON":case"OFF":case"Toggle":i=h;continue}let w=this.#e.get(h);if(w)switch(i){case"ON":w._setVisible(N,!0);break;case"OFF":w._setVisible(N,!1);break;case"Toggle":w._setVisible(N,!w.visible)}}this.#t=null}get hasInitialVisibility(){return this.#s===null||this.getHash()===this.#s}getOrder(){return this.#e.size?this.#n?this.#n.slice():[...this.#e.keys()]:null}getGroups(){return this.#e.size>0?(0,_.objectFromMap)(this.#e):null}getGroup(M){return this.#e.get(M)||null}getHash(){if(this.#t!==null)return this.#t;let M=new H.MurmurHash3_64;for(let[f,i]of this.#e)M.update(`${f}:${i.visible}`);return this.#t=M.hexdigest()}}},814:(ot,it,j)=>{j.d(it,{cleanupTextLayer:()=>f,renderTextLayer:()=>S,updateTextLayer:()=>n});var _=j(292),H=j(419);let N=30,W=.8,F=new Map,k=null;function M(){if(!k){let c=document.createElement("canvas");c.className="hiddenCanvasElement",document.body.append(c),k=c.getContext("2d",{alpha:!1})}return k}function f(){k?.canvas.remove(),k=null}function i(c,t,s){let r=document.createElement("span"),m={angle:0,canvasWidth:0,hasText:t.str!=="",hasEOL:t.hasEOL,fontSize:0};c._textDivs.push(r);let y=_.Util.transform(c._transform,t.transform),b=Math.atan2(y[1],y[0]),R=s[t.fontName];R.vertical&&(b+=Math.PI/2);let L=c._fontInspectorEnabled&&R.fontSubstitution||R.fontFamily,I=Math.hypot(y[2],y[3]),B=I*(function(J){let st=F.get(J);if(st)return st;let et=M(),at=et.font;et.canvas.width=et.canvas.height=N,et.font=`${N}px ${J}`;let rt=et.measureText(""),$=rt.fontBoundingBoxAscent,l=Math.abs(rt.fontBoundingBoxDescent);if($){let v=$/($+l);return F.set(J,v),et.canvas.width=et.canvas.height=0,et.font=at,v}et.strokeStyle="red",et.clearRect(0,0,N,N),et.strokeText("g",0,0);let g=et.getImageData(0,0,N,N).data;l=0;for(let v=g.length-1-3;v>=0;v-=4)if(g[v]>0){l=Math.ceil(v/4/N);break}et.clearRect(0,0,N,N),et.strokeText("A",0,N),g=et.getImageData(0,0,N,N).data,$=0;for(let v=0,e=g.length;v<e;v+=4)if(g[v]>0){$=N-Math.floor(v/4/N);break}if(et.canvas.width=et.canvas.height=0,et.font=at,$){let v=$/($+l);return F.set(J,v),v}return F.set(J,W),W})(L),X,Z;b===0?(X=y[4],Z=y[5]-B):(X=y[4]+B*Math.sin(b),Z=y[5]-B*Math.cos(b));let nt="calc(var(--scale-factor)*",G=r.style;c._container===c._rootContainer?(G.left=`${(100*X/c._pageWidth).toFixed(2)}%`,G.top=`${(100*Z/c._pageHeight).toFixed(2)}%`):(G.left=`${nt}${X.toFixed(2)}px)`,G.top=`${nt}${Z.toFixed(2)}px)`),G.fontSize=`${nt}${I.toFixed(2)}px)`,G.fontFamily=L,m.fontSize=I,r.setAttribute("role","presentation"),r.textContent=t.str,r.dir=t.dir,c._fontInspectorEnabled&&(r.dataset.fontName=R.fontSubstitutionLoadedName||t.fontName),b!==0&&(m.angle=b*(180/Math.PI));let O=!1;if(t.str.length>1)O=!0;else if(t.str!==" "&&t.transform[0]!==t.transform[3]){let z=Math.abs(t.transform[0]),J=Math.abs(t.transform[3]);z!==J&&Math.max(z,J)/Math.min(z,J)>1.5&&(O=!0)}O&&(m.canvasWidth=R.vertical?t.height:t.width),c._textDivProperties.set(r,m),c._isReadableStream&&c._layoutText(r)}function h(c){let{div:t,scale:s,properties:r,ctx:m,prevFontSize:y,prevFontFamily:b}=c,{style:R}=t,L="";if(r.canvasWidth!==0&&r.hasText){let{fontFamily:I}=R,{canvasWidth:B,fontSize:X}=r;(y!==X||b!==I)&&(m.font=`${X*s}px ${I}`,c.prevFontSize=X,c.prevFontFamily=I);let{width:Z}=m.measureText(t.textContent);Z>0&&(L=`scaleX(${B*s/Z})`)}r.angle!==0&&(L=`rotate(${r.angle}deg) ${L}`),L.length>0&&(R.transform=L)}class w{constructor({textContentSource:t,container:s,viewport:r,textDivs:m,textDivProperties:y,textContentItemsStr:b}){this._textContentSource=t,this._isReadableStream=t instanceof ReadableStream,this._container=this._rootContainer=s,this._textDivs=m||[],this._textContentItemsStr=b||[],this._fontInspectorEnabled=!!globalThis.FontInspector?.enabled,this._reader=null,this._textDivProperties=y||new WeakMap,this._canceled=!1,this._capability=Promise.withResolvers(),this._layoutTextParams={prevFontSize:null,prevFontFamily:null,div:null,scale:r.scale*(globalThis.devicePixelRatio||1),properties:null,ctx:M()};let{pageWidth:R,pageHeight:L,pageX:I,pageY:B}=r.rawDims;this._transform=[1,0,0,-1,-I,B+L],this._pageWidth=R,this._pageHeight=L,(0,H.setLayerDimensions)(s,r),this._capability.promise.finally((()=>{this._layoutTextParams=null})).catch((()=>{}))}get promise(){return this._capability.promise}cancel(){this._canceled=!0,this._reader&&(this._reader.cancel(new _.AbortException("TextLayer task cancelled.")).catch((()=>{})),this._reader=null),this._capability.reject(new _.AbortException("TextLayer task cancelled."))}_processItems(t,s){for(let r of t)if(r.str!==void 0)this._textContentItemsStr.push(r.str),i(this,r,s);else if(r.type==="beginMarkedContentProps"||r.type==="beginMarkedContent"){let m=this._container;this._container=document.createElement("span"),this._container.classList.add("markedContent"),r.id!==null&&this._container.setAttribute("id",`${r.id}`),m.append(this._container)}else r.type==="endMarkedContent"&&(this._container=this._container.parentNode)}_layoutText(t){let s=this._layoutTextParams.properties=this._textDivProperties.get(t);if(this._layoutTextParams.div=t,h(this._layoutTextParams),s.hasText&&this._container.append(t),s.hasEOL){let r=document.createElement("br");r.setAttribute("role","presentation"),this._container.append(r)}}_render(){let{promise:t,resolve:s,reject:r}=Promise.withResolvers(),m=Object.create(null);if(this._isReadableStream){let y=()=>{this._reader.read().then((({value:b,done:R})=>{R?s():(Object.assign(m,b.styles),this._processItems(b.items,m),y())}),r)};this._reader=this._textContentSource.getReader(),y()}else{if(!this._textContentSource)throw new Error('No "textContentSource" parameter specified.');{let{items:y,styles:b}=this._textContentSource;this._processItems(y,b),s()}}t.then((()=>{m=null,(function(b){if(b._canceled)return;let R=b._textDivs,L=b._capability;if(R.length>1e5)L.resolve();else{if(!b._isReadableStream)for(let I of R)b._layoutText(I);L.resolve()}})(this)}),this._capability.reject)}}function S(c){let t=new w(c);return t._render(),t}function n({container:c,viewport:t,textDivs:s,textDivProperties:r,mustRotate:m=!0,mustRescale:y=!0}){if(m&&(0,H.setLayerDimensions)(c,{rotation:t.rotation}),y){let b=M(),R={prevFontSize:null,prevFontFamily:null,div:null,scale:t.scale*(globalThis.devicePixelRatio||1),properties:null,ctx:b};for(let L of s)R.properties=r.get(L),R.div=L,h(R)}}},585:(ot,it,j)=>{j.d(it,{PDFDataTransportStream:()=>N});var _=j(292),H=j(419);class N{constructor(M,{disableRange:f=!1,disableStream:i=!1}){(0,_.assert)(M,'PDFDataTransportStream - missing required "pdfDataRangeTransport" argument.');let{length:h,initialData:w,progressiveDone:S,contentDispositionFilename:n}=M;if(this._queuedChunks=[],this._progressiveDone=S,this._contentDispositionFilename=n,w?.length>0){let c=w instanceof Uint8Array&&w.byteLength===w.buffer.byteLength?w.buffer:new Uint8Array(w).buffer;this._queuedChunks.push(c)}this._pdfDataRangeTransport=M,this._isStreamingSupported=!i,this._isRangeSupported=!f,this._contentLength=h,this._fullRequestReader=null,this._rangeReaders=[],M.addRangeListener(((c,t)=>{this._onReceiveData({begin:c,chunk:t})})),M.addProgressListener(((c,t)=>{this._onProgress({loaded:c,total:t})})),M.addProgressiveReadListener((c=>{this._onReceiveData({chunk:c})})),M.addProgressiveDoneListener((()=>{this._onProgressiveDone()})),M.transportReady()}_onReceiveData({begin:M,chunk:f}){let i=f instanceof Uint8Array&&f.byteLength===f.buffer.byteLength?f.buffer:new Uint8Array(f).buffer;if(M===void 0)this._fullRequestReader?this._fullRequestReader._enqueue(i):this._queuedChunks.push(i);else{let h=this._rangeReaders.some((function(w){return w._begin!==M?!1:(w._enqueue(i),!0)}));(0,_.assert)(h,"_onReceiveData - no `PDFDataTransportStreamRangeReader` instance found.")}}get _progressiveDataLength(){return this._fullRequestReader?._loaded??0}_onProgress(M){M.total===void 0?this._rangeReaders[0]?.onProgress?.({loaded:M.loaded}):this._fullRequestReader?.onProgress?.({loaded:M.loaded,total:M.total})}_onProgressiveDone(){this._fullRequestReader?.progressiveDone(),this._progressiveDone=!0}_removeRangeReader(M){let f=this._rangeReaders.indexOf(M);f>=0&&this._rangeReaders.splice(f,1)}getFullReader(){(0,_.assert)(!this._fullRequestReader,"PDFDataTransportStream.getFullReader can only be called once.");let M=this._queuedChunks;return this._queuedChunks=null,new W(this,M,this._progressiveDone,this._contentDispositionFilename)}getRangeReader(M,f){if(f<=this._progressiveDataLength)return null;let i=new F(this,M,f);return this._pdfDataRangeTransport.requestDataRange(M,f),this._rangeReaders.push(i),i}cancelAllRequests(M){this._fullRequestReader?.cancel(M);for(let f of this._rangeReaders.slice(0))f.cancel(M);this._pdfDataRangeTransport.abort()}}class W{constructor(M,f,i=!1,h=null){this._stream=M,this._done=i||!1,this._filename=(0,H.isPdfFile)(h)?h:null,this._queuedChunks=f||[],this._loaded=0;for(let w of this._queuedChunks)this._loaded+=w.byteLength;this._requests=[],this._headersReady=Promise.resolve(),M._fullRequestReader=this,this.onProgress=null}_enqueue(M){this._done||(this._requests.length>0?this._requests.shift().resolve({value:M,done:!1}):this._queuedChunks.push(M),this._loaded+=M.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};let M=Promise.withResolvers();return this._requests.push(M),M.promise}cancel(M){this._done=!0;for(let f of this._requests)f.resolve({value:void 0,done:!0});this._requests.length=0}progressiveDone(){this._done||(this._done=!0)}}class F{constructor(M,f,i){this._stream=M,this._begin=f,this._end=i,this._queuedChunk=null,this._requests=[],this._done=!1,this.onProgress=null}_enqueue(M){if(!this._done){if(this._requests.length===0)this._queuedChunk=M;else{this._requests.shift().resolve({value:M,done:!1});for(let f of this._requests)f.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){let f=this._queuedChunk;return this._queuedChunk=null,{value:f,done:!1}}if(this._done)return{value:void 0,done:!0};let M=Promise.withResolvers();return this._requests.push(M),M.promise}cancel(M){this._done=!0;for(let f of this._requests)f.resolve({value:void 0,done:!0});this._requests.length=0,this._stream._removeRangeReader(this)}}},164:(ot,it,j)=>{j.d(it,{GlobalWorkerOptions:()=>_});class _{static#t=null;static#e="";static get workerPort(){return this.#t}static set workerPort(N){if(!(typeof Worker<"u"&&N instanceof Worker)&&N!==null)throw new Error("Invalid `workerPort` type.");this.#t=N}static get workerSrc(){return this.#e}static set workerSrc(N){if(typeof N!="string")throw new Error("Invalid `workerSrc` type.");this.#e=N}}},284:(ot,it,j)=>{j.d(it,{XfaLayer:()=>H});var _=j(50);class H{static setupStorage(W,F,k,M,f){let i=M.getValue(F,{value:null});switch(k.name){case"textarea":if(i.value!==null&&(W.textContent=i.value),f==="print")break;W.addEventListener("input",(h=>{M.setValue(F,{value:h.target.value})}));break;case"input":if(k.attributes.type==="radio"||k.attributes.type==="checkbox"){if(i.value===k.attributes.xfaOn?W.setAttribute("checked",!0):i.value===k.attributes.xfaOff&&W.removeAttribute("checked"),f==="print")break;W.addEventListener("change",(h=>{M.setValue(F,{value:h.target.checked?h.target.getAttribute("xfaOn"):h.target.getAttribute("xfaOff")})}))}else{if(i.value!==null&&W.setAttribute("value",i.value),f==="print")break;W.addEventListener("input",(h=>{M.setValue(F,{value:h.target.value})}))}break;case"select":if(i.value!==null){W.setAttribute("value",i.value);for(let h of k.children)h.attributes.value===i.value?h.attributes.selected=!0:h.attributes.hasOwnProperty("selected")&&delete h.attributes.selected}W.addEventListener("input",(h=>{let w=h.target.options,S=w.selectedIndex===-1?"":w[w.selectedIndex].value;M.setValue(F,{value:S})}))}}static setAttributes({html:W,element:F,storage:k=null,intent:M,linkService:f}){let{attributes:i}=F,h=W instanceof HTMLAnchorElement;i.type==="radio"&&(i.name=`${i.name}-${M}`);for(let[w,S]of Object.entries(i))if(S!=null)switch(w){case"class":S.length&&W.setAttribute(w,S.join(" "));break;case"dataId":break;case"id":W.setAttribute("data-element-id",S);break;case"style":Object.assign(W.style,S);break;case"textContent":W.textContent=S;break;default:(!h||w!=="href"&&w!=="newWindow")&&W.setAttribute(w,S)}h&&f.addLinkAttributes(W,i.href,i.newWindow),k&&i.dataId&&this.setupStorage(W,i.dataId,F,k)}static render(W){let F=W.annotationStorage,k=W.linkService,M=W.xfaHtml,f=W.intent||"display",i=document.createElement(M.name);M.attributes&&this.setAttributes({html:i,element:M,intent:f,linkService:k});let h=f!=="richText",w=W.div;if(w.append(i),W.viewport){let c=`matrix(${W.viewport.transform.join(",")})`;w.style.transform=c}h&&w.setAttribute("class","xfaLayer xfaFont");let S=[];if(M.children.length===0){if(M.value){let c=document.createTextNode(M.value);i.append(c),h&&_.XfaText.shouldBuildText(M.name)&&S.push(c)}return{textDivs:S}}let n=[[M,-1,i]];for(;n.length>0;){let[c,t,s]=n.at(-1);if(t+1===c.children.length){n.pop();continue}let r=c.children[++n.at(-1)[1]];if(r===null)continue;let{name:m}=r;if(m==="#text"){let b=document.createTextNode(r.value);S.push(b),s.append(b);continue}let y=r?.attributes?.xmlns?document.createElementNS(r.attributes.xmlns,m):document.createElement(m);if(s.append(y),r.attributes&&this.setAttributes({html:y,element:r,storage:F,intent:f,linkService:k}),r.children?.length>0)n.push([r,-1,y]);else if(r.value){let b=document.createTextNode(r.value);h&&_.XfaText.shouldBuildText(m)&&S.push(b),y.append(b)}}for(let c of w.querySelectorAll(".xfaNonInteractive input, .xfaNonInteractive textarea"))c.setAttribute("readOnly",!0);return{textDivs:S}}static update(W){let F=`matrix(${W.viewport.transform.join(",")})`;W.div.style.transform=F,W.div.hidden=!1}}},50:(ot,it,j)=>{j.d(it,{XfaText:()=>_});class _{static textContent(N){let W=[],F={items:W,styles:Object.create(null)};return(function k(M){if(!M)return;let f=null,i=M.name;if(i==="#text")f=M.value;else{if(!_.shouldBuildText(i))return;M?.attributes?.textContent?f=M.attributes.textContent:M.value&&(f=M.value)}if(f!==null&&W.push({str:f}),M.children)for(let h of M.children)k(h)})(N),F}static shouldBuildText(N){return!(N==="textarea"||N==="input"||N==="option"||N==="select")}}},228:(ot,it,j)=>{j.a(ot,(async(_,H)=>{try{j.d(it,{AbortException:()=>N.AbortException,AnnotationEditorLayer:()=>M.AnnotationEditorLayer,AnnotationEditorParamsType:()=>N.AnnotationEditorParamsType,AnnotationEditorType:()=>N.AnnotationEditorType,AnnotationEditorUIManager:()=>f.AnnotationEditorUIManager,AnnotationLayer:()=>i.AnnotationLayer,AnnotationMode:()=>N.AnnotationMode,CMapCompressionType:()=>N.CMapCompressionType,ColorPicker:()=>h.ColorPicker,DOMSVGFactory:()=>F.DOMSVGFactory,DrawLayer:()=>w.DrawLayer,FeatureTest:()=>N.FeatureTest,GlobalWorkerOptions:()=>S.GlobalWorkerOptions,ImageKind:()=>N.ImageKind,InvalidPDFException:()=>N.InvalidPDFException,MissingPDFException:()=>N.MissingPDFException,OPS:()=>N.OPS,Outliner:()=>n.Outliner,PDFDataRangeTransport:()=>W.PDFDataRangeTransport,PDFDateString:()=>F.PDFDateString,PDFWorker:()=>W.PDFWorker,PasswordResponses:()=>N.PasswordResponses,PermissionFlag:()=>N.PermissionFlag,PixelsPerInch:()=>F.PixelsPerInch,RenderingCancelledException:()=>F.RenderingCancelledException,UnexpectedResponseException:()=>N.UnexpectedResponseException,Util:()=>N.Util,VerbosityLevel:()=>N.VerbosityLevel,XfaLayer:()=>c.XfaLayer,build:()=>W.build,createValidAbsoluteUrl:()=>N.createValidAbsoluteUrl,fetchData:()=>F.fetchData,getDocument:()=>W.getDocument,getFilenameFromUrl:()=>F.getFilenameFromUrl,getPdfFilenameFromUrl:()=>F.getPdfFilenameFromUrl,getXfaPageViewport:()=>F.getXfaPageViewport,isDataScheme:()=>F.isDataScheme,isPdfFile:()=>F.isPdfFile,noContextMenu:()=>F.noContextMenu,normalizeUnicode:()=>N.normalizeUnicode,renderTextLayer:()=>k.renderTextLayer,setLayerDimensions:()=>F.setLayerDimensions,shadow:()=>N.shadow,updateTextLayer:()=>k.updateTextLayer,version:()=>W.version});var N=j(292),W=j(831),F=j(419),k=j(814),M=j(731),f=j(830),i=j(976),h=j(259),w=j(47),S=j(164),n=j(61),c=j(284),t=_([W]);W=(t.then?(await t)():t)[0],H()}catch(s){H(s)}}))},178:(ot,it,j)=>{j.d(it,{MessageHandler:()=>n});var _=j(292);let H=1,N=2,W=1,F=2,k=3,M=4,f=5,i=6,h=7,w=8;function S(c){switch(c instanceof Error||typeof c=="object"&&c!==null||(0,_.unreachable)('wrapReason: Expected "reason" to be a (possibly cloned) Error.'),c.name){case"AbortException":return new _.AbortException(c.message);case"MissingPDFException":return new _.MissingPDFException(c.message);case"PasswordException":return new _.PasswordException(c.message,c.code);case"UnexpectedResponseException":return new _.UnexpectedResponseException(c.message,c.status);case"UnknownErrorException":return new _.UnknownErrorException(c.message,c.details);default:return new _.UnknownErrorException(c.message,c.toString())}}class n{constructor(t,s,r){this.sourceName=t,this.targetName=s,this.comObj=r,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=m=>{let y=m.data;if(y.targetName!==this.sourceName)return;if(y.stream){this.#e(y);return}if(y.callback){let R=y.callbackId,L=this.callbackCapabilities[R];if(!L)throw new Error(`Cannot resolve callback ${R}`);if(delete this.callbackCapabilities[R],y.callback===H)L.resolve(y.data);else{if(y.callback!==N)throw new Error("Unexpected callback case");L.reject(S(y.reason))}return}let b=this.actionHandler[y.action];if(!b)throw new Error(`Unknown action from worker: ${y.action}`);if(y.callbackId){let R=this.sourceName,L=y.sourceName;new Promise((function(I){I(b(y.data))})).then((function(I){r.postMessage({sourceName:R,targetName:L,callback:H,callbackId:y.callbackId,data:I})}),(function(I){r.postMessage({sourceName:R,targetName:L,callback:N,callbackId:y.callbackId,reason:S(I)})}))}else y.streamId?this.#t(y):b(y.data)},r.addEventListener("message",this._onComObjOnMessage)}on(t,s){let r=this.actionHandler;if(r[t])throw new Error(`There is already an actionName called "${t}"`);r[t]=s}send(t,s,r){this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:t,data:s},r)}sendWithPromise(t,s,r){let m=this.callbackId++,y=Promise.withResolvers();this.callbackCapabilities[m]=y;try{this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:t,callbackId:m,data:s},r)}catch(b){y.reject(b)}return y.promise}sendWithStream(t,s,r,m){let y=this.streamId++,b=this.sourceName,R=this.targetName,L=this.comObj;return new ReadableStream({start:I=>{let B=Promise.withResolvers();return this.streamControllers[y]={controller:I,startCall:B,pullCall:null,cancelCall:null,isClosed:!1},L.postMessage({sourceName:b,targetName:R,action:t,streamId:y,data:s,desiredSize:I.desiredSize},m),B.promise},pull:I=>{let B=Promise.withResolvers();return this.streamControllers[y].pullCall=B,L.postMessage({sourceName:b,targetName:R,stream:i,streamId:y,desiredSize:I.desiredSize}),B.promise},cancel:I=>{(0,_.assert)(I instanceof Error,"cancel must have a valid reason");let B=Promise.withResolvers();return this.streamControllers[y].cancelCall=B,this.streamControllers[y].isClosed=!0,L.postMessage({sourceName:b,targetName:R,stream:W,streamId:y,reason:S(I)}),B.promise}},r)}#t(t){let s=t.streamId,r=this.sourceName,m=t.sourceName,y=this.comObj,b=this,R=this.actionHandler[t.action],L={enqueue(I,B=1,X){if(this.isCancelled)return;let Z=this.desiredSize;this.desiredSize-=B,Z>0&&this.desiredSize<=0&&(this.sinkCapability=Promise.withResolvers(),this.ready=this.sinkCapability.promise),y.postMessage({sourceName:r,targetName:m,stream:M,streamId:s,chunk:I},X)},close(){this.isCancelled||(this.isCancelled=!0,y.postMessage({sourceName:r,targetName:m,stream:k,streamId:s}),delete b.streamSinks[s])},error(I){(0,_.assert)(I instanceof Error,"error must have a valid reason"),this.isCancelled||(this.isCancelled=!0,y.postMessage({sourceName:r,targetName:m,stream:f,streamId:s,reason:S(I)}))},sinkCapability:Promise.withResolvers(),onPull:null,onCancel:null,isCancelled:!1,desiredSize:t.desiredSize,ready:null};L.sinkCapability.resolve(),L.ready=L.sinkCapability.promise,this.streamSinks[s]=L,new Promise((function(I){I(R(t.data,L))})).then((function(){y.postMessage({sourceName:r,targetName:m,stream:w,streamId:s,success:!0})}),(function(I){y.postMessage({sourceName:r,targetName:m,stream:w,streamId:s,reason:S(I)})}))}#e(t){let s=t.streamId,r=this.sourceName,m=t.sourceName,y=this.comObj,b=this.streamControllers[s],R=this.streamSinks[s];switch(t.stream){case w:t.success?b.startCall.resolve():b.startCall.reject(S(t.reason));break;case h:t.success?b.pullCall.resolve():b.pullCall.reject(S(t.reason));break;case i:if(!R){y.postMessage({sourceName:r,targetName:m,stream:h,streamId:s,success:!0});break}R.desiredSize<=0&&t.desiredSize>0&&R.sinkCapability.resolve(),R.desiredSize=t.desiredSize,new Promise((function(L){L(R.onPull?.())})).then((function(){y.postMessage({sourceName:r,targetName:m,stream:h,streamId:s,success:!0})}),(function(L){y.postMessage({sourceName:r,targetName:m,stream:h,streamId:s,reason:S(L)})}));break;case M:if((0,_.assert)(b,"enqueue should have stream controller"),b.isClosed)break;b.controller.enqueue(t.chunk);break;case k:if((0,_.assert)(b,"close should have stream controller"),b.isClosed)break;b.isClosed=!0,b.controller.close(),this.#s(b,s);break;case f:(0,_.assert)(b,"error should have stream controller"),b.controller.error(S(t.reason)),this.#s(b,s);break;case F:t.success?b.cancelCall.resolve():b.cancelCall.reject(S(t.reason)),this.#s(b,s);break;case W:if(!R)break;new Promise((function(L){L(R.onCancel?.(S(t.reason)))})).then((function(){y.postMessage({sourceName:r,targetName:m,stream:F,streamId:s,success:!0})}),(function(L){y.postMessage({sourceName:r,targetName:m,stream:F,streamId:s,reason:S(L)})})),R.sinkCapability.reject(S(t.reason)),R.isCancelled=!0,delete this.streamSinks[s];break;default:throw new Error("Unexpected stream case")}}async#s(t,s){await Promise.allSettled([t.startCall?.promise,t.pullCall?.promise,t.cancelCall?.promise]),delete this.streamControllers[s]}destroy(){this.comObj.removeEventListener("message",this._onComObjOnMessage)}}},651:(ot,it,j)=>{j.d(it,{MurmurHash3_64:()=>W});let _=3285377520,H=4294901760,N=65535;class W{constructor(k){this.h1=k?4294967295&k:_,this.h2=k?4294967295&k:_}update(k){let M,f;if(typeof k=="string"){M=new Uint8Array(2*k.length),f=0;for(let b=0,R=k.length;b<R;b++){let L=k.charCodeAt(b);L<=255?M[f++]=L:(M[f++]=L>>>8,M[f++]=255&L)}}else{if(!ArrayBuffer.isView(k))throw new Error("Invalid data format, must be a string or TypedArray.");M=k.slice(),f=M.byteLength}let i=f>>2,h=f-4*i,w=new Uint32Array(M.buffer,0,i),S=0,n=0,c=this.h1,t=this.h2,s=3432918353,r=461845907,m=11601,y=13715;for(let b=0;b<i;b++)1&b?(S=w[b],S=S*s&H|S*m&N,S=S<<15|S>>>17,S=S*r&H|S*y&N,c^=S,c=c<<13|c>>>19,c=5*c+3864292196):(n=w[b],n=n*s&H|n*m&N,n=n<<15|n>>>17,n=n*r&H|n*y&N,t^=n,t=t<<13|t>>>19,t=5*t+3864292196);switch(S=0,h){case 3:S^=M[4*i+2]<<16;case 2:S^=M[4*i+1]<<8;case 1:S^=M[4*i],S=S*s&H|S*m&N,S=S<<15|S>>>17,S=S*r&H|S*y&N,1&i?c^=S:t^=S}this.h1=c,this.h2=t}hexdigest(){let k=this.h1,M=this.h2;return k^=M>>>1,k=3981806797*k&H|36045*k&N,M=4283543511*M&H|(2950163797*(M<<16|k>>>16)&H)>>>16,k^=M>>>1,k=444984403*k&H|60499*k&N,M=3301882366*M&H|(3120437893*(M<<16|k>>>16)&H)>>>16,k^=M>>>1,(k>>>0).toString(16).padStart(8,"0")+(M>>>0).toString(16).padStart(8,"0")}}},292:(ot,it,j)=>{j.d(it,{AbortException:()=>$,AnnotationBorderStyleType:()=>t,AnnotationEditorParamsType:()=>h,AnnotationEditorPrefix:()=>f,AnnotationEditorType:()=>i,AnnotationMode:()=>M,AnnotationPrefix:()=>P,AnnotationType:()=>c,BaseException:()=>O,CMapCompressionType:()=>r,FONT_IDENTITY_MATRIX:()=>N,FeatureTest:()=>a,FormatError:()=>rt,IDENTITY_MATRIX:()=>H,ImageKind:()=>n,InvalidPDFException:()=>st,LINE_FACTOR:()=>F,MAX_IMAGE_SIZE_TO_CACHE:()=>W,MissingPDFException:()=>et,OPS:()=>m,PasswordException:()=>z,PasswordResponses:()=>y,PermissionFlag:()=>w,RenderingIntentFlag:()=>k,TextRenderingMode:()=>S,UnexpectedResponseException:()=>at,UnknownErrorException:()=>J,Util:()=>u,VerbosityLevel:()=>s,assert:()=>Z,bytesToString:()=>l,createValidAbsoluteUrl:()=>nt,getUuid:()=>E,getVerbosityLevel:()=>L,info:()=>I,isNodeJS:()=>_,normalizeUnicode:()=>o,objectFromMap:()=>e,setVerbosityLevel:()=>R,shadow:()=>G,string32:()=>v,stringToBytes:()=>g,unreachable:()=>X,warn:()=>B});let _=!(typeof process!="object"||process+""!="[object process]"||process.versions.nw||process.versions.electron&&process.type&&process.type!=="browser"),H=[1,0,0,1,0,0],N=[.001,0,0,.001,0,0],W=1e7,F=1.35,k={ANY:1,DISPLAY:2,PRINT:4,SAVE:8,ANNOTATIONS_FORMS:16,ANNOTATIONS_STORAGE:32,ANNOTATIONS_DISABLE:64,OPLIST:256},M={DISABLE:0,ENABLE:1,ENABLE_FORMS:2,ENABLE_STORAGE:3},f="pdfjs_internal_editor_",i={DISABLE:-1,NONE:0,FREETEXT:3,HIGHLIGHT:9,STAMP:13,INK:15},h={RESIZE:1,CREATE:2,FREETEXT_SIZE:11,FREETEXT_COLOR:12,FREETEXT_OPACITY:13,INK_COLOR:21,INK_THICKNESS:22,INK_OPACITY:23,HIGHLIGHT_COLOR:31,HIGHLIGHT_DEFAULT_COLOR:32,HIGHLIGHT_THICKNESS:33,HIGHLIGHT_FREE:34,HIGHLIGHT_SHOW_ALL:35},w={PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048},S={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},n={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3},c={TEXT:1,LINK:2,FREETEXT:3,LINE:4,SQUARE:5,CIRCLE:6,POLYGON:7,POLYLINE:8,HIGHLIGHT:9,UNDERLINE:10,SQUIGGLY:11,STRIKEOUT:12,STAMP:13,CARET:14,INK:15,POPUP:16,FILEATTACHMENT:17,SOUND:18,MOVIE:19,WIDGET:20,SCREEN:21,PRINTERMARK:22,TRAPNET:23,WATERMARK:24,THREED:25,REDACT:26},t={SOLID:1,DASHED:2,BEVELED:3,INSET:4,UNDERLINE:5},s={ERRORS:0,WARNINGS:1,INFOS:5},r={NONE:0,BINARY:1},m={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},y={NEED_PASSWORD:1,INCORRECT_PASSWORD:2},b=s.WARNINGS;function R(T){Number.isInteger(T)&&(b=T)}function L(){return b}function I(T){b>=s.INFOS&&console.log(`Info: ${T}`)}function B(T){b>=s.WARNINGS&&console.log(`Warning: ${T}`)}function X(T){throw new Error(T)}function Z(T,d){T||X(d)}function nt(T,d=null,x=null){if(!T)return null;try{if(x&&typeof T=="string"&&(x.addDefaultProtocol&&T.startsWith("www.")&&T.match(/\./g)?.length>=2&&(T=`http://${T}`),x.tryConvertEncoding))try{T=(function(V){return decodeURIComponent(escape(V))})(T)}catch{}let D=d?new URL(T,d):new URL(T);if((function(V){switch(V?.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":return!0;default:return!1}})(D))return D}catch{}return null}function G(T,d,x,D=!1){return Object.defineProperty(T,d,{value:x,enumerable:!D,configurable:!0,writable:!1}),x}let O=(function(){function d(x,D){this.constructor===d&&X("Cannot initialize BaseException."),this.message=x,this.name=D}return d.prototype=new Error,d.constructor=d,d})();class z extends O{constructor(d,x){super(d,"PasswordException"),this.code=x}}class J extends O{constructor(d,x){super(d,"UnknownErrorException"),this.details=x}}class st extends O{constructor(d){super(d,"InvalidPDFException")}}class et extends O{constructor(d){super(d,"MissingPDFException")}}class at extends O{constructor(d,x){super(d,"UnexpectedResponseException"),this.status=x}}class rt extends O{constructor(d){super(d,"FormatError")}}class $ extends O{constructor(d){super(d,"AbortException")}}function l(T){typeof T=="object"&&T?.length!==void 0||X("Invalid argument for bytesToString");let d=T.length,x=8192;if(d<x)return String.fromCharCode.apply(null,T);let D=[];for(let U=0;U<d;U+=x){let V=Math.min(U+x,d),q=T.subarray(U,V);D.push(String.fromCharCode.apply(null,q))}return D.join("")}function g(T){typeof T!="string"&&X("Invalid argument for stringToBytes");let d=T.length,x=new Uint8Array(d);for(let D=0;D<d;++D)x[D]=255&T.charCodeAt(D);return x}function v(T){return String.fromCharCode(T>>24&255,T>>16&255,T>>8&255,255&T)}function e(T){let d=Object.create(null);for(let[x,D]of T)d[x]=D;return d}class a{static get isLittleEndian(){return G(this,"isLittleEndian",(function(){let x=new Uint8Array(4);return x[0]=1,new Uint32Array(x.buffer,0,1)[0]===1})())}static get isEvalSupported(){return G(this,"isEvalSupported",(function(){try{return new Function(""),!0}catch{return!1}})())}static get isOffscreenCanvasSupported(){return G(this,"isOffscreenCanvasSupported",typeof OffscreenCanvas<"u")}static get platform(){return typeof navigator<"u"&&typeof navigator?.platform=="string"?G(this,"platform",{isMac:navigator.platform.includes("Mac")}):G(this,"platform",{isMac:!1})}static get isCSSRoundSupported(){return G(this,"isCSSRoundSupported",globalThis.CSS?.supports?.("width: round(1.5px, 1px)"))}}let p=Array.from(Array(256).keys(),(T=>T.toString(16).padStart(2,"0")));class u{static makeHexColor(d,x,D){return`#${p[d]}${p[x]}${p[D]}`}static scaleMinMax(d,x){let D;d[0]?(d[0]<0&&(D=x[0],x[0]=x[2],x[2]=D),x[0]*=d[0],x[2]*=d[0],d[3]<0&&(D=x[1],x[1]=x[3],x[3]=D),x[1]*=d[3],x[3]*=d[3]):(D=x[0],x[0]=x[1],x[1]=D,D=x[2],x[2]=x[3],x[3]=D,d[1]<0&&(D=x[1],x[1]=x[3],x[3]=D),x[1]*=d[1],x[3]*=d[1],d[2]<0&&(D=x[0],x[0]=x[2],x[2]=D),x[0]*=d[2],x[2]*=d[2]),x[0]+=d[4],x[1]+=d[5],x[2]+=d[4],x[3]+=d[5]}static transform(d,x){return[d[0]*x[0]+d[2]*x[1],d[1]*x[0]+d[3]*x[1],d[0]*x[2]+d[2]*x[3],d[1]*x[2]+d[3]*x[3],d[0]*x[4]+d[2]*x[5]+d[4],d[1]*x[4]+d[3]*x[5]+d[5]]}static applyTransform(d,x){return[d[0]*x[0]+d[1]*x[2]+x[4],d[0]*x[1]+d[1]*x[3]+x[5]]}static applyInverseTransform(d,x){let D=x[0]*x[3]-x[1]*x[2];return[(d[0]*x[3]-d[1]*x[2]+x[2]*x[5]-x[4]*x[3])/D,(-d[0]*x[1]+d[1]*x[0]+x[4]*x[1]-x[5]*x[0])/D]}static getAxialAlignedBoundingBox(d,x){let D=this.applyTransform(d,x),U=this.applyTransform(d.slice(2,4),x),V=this.applyTransform([d[0],d[3]],x),q=this.applyTransform([d[2],d[1]],x);return[Math.min(D[0],U[0],V[0],q[0]),Math.min(D[1],U[1],V[1],q[1]),Math.max(D[0],U[0],V[0],q[0]),Math.max(D[1],U[1],V[1],q[1])]}static inverseTransform(d){let x=d[0]*d[3]-d[1]*d[2];return[d[3]/x,-d[1]/x,-d[2]/x,d[0]/x,(d[2]*d[5]-d[4]*d[3])/x,(d[4]*d[1]-d[5]*d[0])/x]}static singularValueDecompose2dScale(d){let x=[d[0],d[2],d[1],d[3]],D=d[0]*x[0]+d[1]*x[2],U=d[0]*x[1]+d[1]*x[3],V=d[2]*x[0]+d[3]*x[2],q=d[2]*x[1]+d[3]*x[3],K=(D+q)/2,tt=Math.sqrt((D+q)**2-4*(D*q-V*U))/2,Q=K+tt||1,Y=K-tt||1;return[Math.sqrt(Q),Math.sqrt(Y)]}static normalizeRect(d){let x=d.slice(0);return d[0]>d[2]&&(x[0]=d[2],x[2]=d[0]),d[1]>d[3]&&(x[1]=d[3],x[3]=d[1]),x}static intersect(d,x){let D=Math.max(Math.min(d[0],d[2]),Math.min(x[0],x[2])),U=Math.min(Math.max(d[0],d[2]),Math.max(x[0],x[2]));if(D>U)return null;let V=Math.max(Math.min(d[1],d[3]),Math.min(x[1],x[3])),q=Math.min(Math.max(d[1],d[3]),Math.max(x[1],x[3]));return V>q?null:[D,V,U,q]}static#t(d,x,D,U,V,q,K,tt,Q,Y){if(Q<=0||Q>=1)return;let ht=1-Q,dt=Q*Q,lt=dt*Q,ut=ht*(ht*(ht*d+3*Q*x)+3*dt*D)+lt*U,pt=ht*(ht*(ht*V+3*Q*q)+3*dt*K)+lt*tt;Y[0]=Math.min(Y[0],ut),Y[1]=Math.min(Y[1],pt),Y[2]=Math.max(Y[2],ut),Y[3]=Math.max(Y[3],pt)}static#e(d,x,D,U,V,q,K,tt,Q,Y,ht,dt){if(Math.abs(Q)<1e-12){Math.abs(Y)>=1e-12&&this.#t(d,x,D,U,V,q,K,tt,-ht/Y,dt);return}let lt=Y**2-4*ht*Q;if(lt<0)return;let ut=Math.sqrt(lt),pt=2*Q;this.#t(d,x,D,U,V,q,K,tt,(-Y+ut)/pt,dt),this.#t(d,x,D,U,V,q,K,tt,(-Y-ut)/pt,dt)}static bezierBoundingBox(d,x,D,U,V,q,K,tt,Q){return Q?(Q[0]=Math.min(Q[0],d,K),Q[1]=Math.min(Q[1],x,tt),Q[2]=Math.max(Q[2],d,K),Q[3]=Math.max(Q[3],x,tt)):Q=[Math.min(d,K),Math.min(x,tt),Math.max(d,K),Math.max(x,tt)],this.#e(d,D,V,K,x,U,q,tt,3*(3*(D-V)-d+K),6*(d-2*D+V),3*(D-d),Q),this.#e(d,D,V,K,x,U,q,tt,3*(3*(U-q)-x+tt),6*(x-2*U+q),3*(U-x),Q),Q}}let C=null,A=null;function o(T){return C||(C=/([\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,A=new Map([["\uFB05","\u017Ft"]])),T.replaceAll(C,((d,x,D)=>x?x.normalize("NFKC"):A.get(D)))}function E(){if(typeof crypto<"u"&&typeof crypto?.randomUUID=="function")return crypto.randomUUID();let T=new Uint8Array(32);if(typeof crypto<"u"&&typeof crypto?.getRandomValues=="function")crypto.getRandomValues(T);else for(let d=0;d<32;d++)T[d]=Math.floor(255*Math.random());return l(T)}let P="pdfjs_internal_id_"}},Ut={};function St(ot){var it=Ut[ot];if(it!==void 0)return it.exports;var j=Ut[ot]={exports:{}};return Xt[ot](j,j.exports,St),j.exports}Tt=typeof Symbol=="function"?Symbol("webpack queues"):"__webpack_queues__",Lt=typeof Symbol=="function"?Symbol("webpack exports"):"__webpack_exports__",It=typeof Symbol=="function"?Symbol("webpack error"):"__webpack_error__",Dt=ot=>{ot&&ot.d<1&&(ot.d=1,ot.forEach((it=>it.r--)),ot.forEach((it=>it.r--?it.r++:it())))},St.a=(ot,it,j)=>{var _;j&&((_=[]).d=-1);var H,N,W,F=new Set,k=ot.exports,M=new Promise(((f,i)=>{W=i,N=f}));M[Lt]=k,M[Tt]=f=>(_&&f(_),F.forEach(f),M.catch((i=>{}))),ot.exports=M,it((f=>{H=(S=>S.map((n=>{if(n!==null&&typeof n=="object"){if(n[Tt])return n;if(n.then){var c=[];c.d=0,n.then((r=>{t[Lt]=r,Dt(c)}),(r=>{t[It]=r,Dt(c)}));var t={};return t[Tt]=r=>r(c),t}}var s={};return s[Tt]=r=>{},s[Lt]=n,s})))(f);var i,h=()=>H.map((S=>{if(S[It])throw S[It];return S[Lt]})),w=new Promise((S=>{(i=()=>S(h)).r=0;var n=c=>c!==_&&!F.has(c)&&(F.add(c),c&&!c.d&&(i.r++,c.push(i)));H.map((c=>c[Tt](n)))}));return i.r?w:h()}),(f=>(f?W(M[It]=f):N(k),Dt(_)))),_&&_.d<0&&(_.d=0)};St.d=(ot,it)=>{for(var j in it)St.o(it,j)&&!St.o(ot,j)&&Object.defineProperty(ot,j,{enumerable:!0,get:it[j]})};St.o=(ot,it)=>Object.prototype.hasOwnProperty.call(ot,it);var ct=St(228),Yt=(ct=globalThis.pdfjsLib=await(globalThis.pdfjsLibPromise=ct)).AbortException,Jt=ct.AnnotationEditorLayer,Qt=ct.AnnotationEditorParamsType,Zt=ct.AnnotationEditorType,te=ct.AnnotationEditorUIManager,ee=ct.AnnotationLayer,se=ct.AnnotationMode,ie=ct.CMapCompressionType,ne=ct.ColorPicker,ae=ct.DOMSVGFactory,re=ct.DrawLayer,oe=ct.FeatureTest,jt=ct.GlobalWorkerOptions,he=ct.ImageKind,le=ct.InvalidPDFException,ce=ct.MissingPDFException,de=ct.OPS,ue=ct.Outliner,pe=ct.PDFDataRangeTransport,ge=ct.PDFDateString,fe=ct.PDFWorker,me=ct.PasswordResponses,Ae=ct.PermissionFlag,be=ct.PixelsPerInch,ve=ct.RenderingCancelledException,ye=ct.UnexpectedResponseException,_e=ct.Util,we=ct.VerbosityLevel,xe=ct.XfaLayer,Ee=ct.build,Se=ct.createValidAbsoluteUrl,Ce=ct.fetchData,zt=ct.getDocument,Te=ct.getFilenameFromUrl,Me=ct.getPdfFilenameFromUrl,Re=ct.getXfaPageViewport,Pe=ct.isDataScheme,ke=ct.isPdfFile,Fe=ct.noContextMenu,Le=ct.normalizeUnicode,Ie=ct.renderTextLayer,De=ct.setLayerDimensions,Ne=ct.shadow,Oe=ct.updateTextLayer,Be=ct.version;jt.workerSrc=Ht("js/lib/pdf.worker.min.mjs");async function Ue(ot,it=2){let j=await zt({data:ot}).promise,_=[];for(let H=1;H<=j.numPages;H++){let N=await j.getPage(H),W=N.getViewport({scale:it}),F=document.createElement("canvas"),k=F.getContext("2d");F.width=W.width,F.height=W.height,await N.render({canvasContext:k,viewport:W}).promise,_.push(F.toDataURL("image/jpeg",.82))}return _}export{Ue as a};
12
+ //# sourceMappingURL=chunk-IUBYFIV6.js.map