writer 1.25.0__py3-none-any.whl → 1.25.0rc2__py3-none-any.whl

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 (56) hide show
  1. writer/static/assets/BaseMarkdown-BJ1hnpw2.js +1 -0
  2. writer/static/assets/{BlueprintToolbar-CSKyGsgb.js → BlueprintToolbar-DLvLR-JW.js} +1 -1
  3. writer/static/assets/{BuilderApp-CXGhU9Dc.js → BuilderApp-COmcOjFy.js} +3 -3
  4. writer/static/assets/{BuilderApplicationSelect-D4YCpoaq.js → BuilderApplicationSelect-C0hy0sww.js} +2 -2
  5. writer/static/assets/{BuilderBlueprintLibraryPanel-Bviy4WUX.js → BuilderBlueprintLibraryPanel-CgUTN3zl.js} +1 -1
  6. writer/static/assets/{BuilderEmbeddedCodeEditor-eTd4Hh29.js → BuilderEmbeddedCodeEditor-0jgSz3D0.js} +6 -6
  7. writer/static/assets/{BuilderGraphSelect-BSVTkG-Q.js → BuilderGraphSelect-DUkHX6dH.js} +2 -2
  8. writer/static/assets/{BuilderInsertionLabel-BQTfooyn.js → BuilderInsertionLabel-BNWdWeVw.js} +1 -1
  9. writer/static/assets/{BuilderInsertionOverlay-CirmjKch.js → BuilderInsertionOverlay-BgLVZL73.js} +1 -1
  10. writer/static/assets/{BuilderJournal-Do4CUC4U.js → BuilderJournal-Bq5R6zQc.js} +2 -2
  11. writer/static/assets/{BuilderModelSelect-CDg6LxWs.js → BuilderModelSelect-DQItUyE9.js} +2 -2
  12. writer/static/assets/{BuilderSettings-D96bVVVm.js → BuilderSettings-CwIEFHJm.js} +5 -5
  13. writer/static/assets/{BuilderSettingsArtifactAPITriggerDetails-2hONOdPT.js → BuilderSettingsArtifactAPITriggerDetails-DxGsfXnR.js} +1 -1
  14. writer/static/assets/{BuilderSettingsDeploySharedBlueprint-Ct5FVU3z.js → BuilderSettingsDeploySharedBlueprint-CdFuHhAu.js} +1 -1
  15. writer/static/assets/{BuilderSettingsHandlers-wr4bqW4s.js → BuilderSettingsHandlers-CQO3QIBi.js} +1 -1
  16. writer/static/assets/{BuilderSidebarComponentTree-XfwZ-TqP.js → BuilderSidebarComponentTree-C587CSkX.js} +1 -1
  17. writer/static/assets/{BuilderSidebarToolkit-BAq285RS.js → BuilderSidebarToolkit-hZUDgdJi.js} +2 -2
  18. writer/static/assets/{BuilderTemplateEditor-DOyCVTe3.js → BuilderTemplateEditor-Ba-XLRHu.js} +1 -1
  19. writer/static/assets/{BuilderVault-7la3LjZT.js → BuilderVault-BmorQTc0.js} +1 -1
  20. writer/static/assets/{ComponentRenderer-DRTUw3PP.js → ComponentRenderer-BOg4mqwh.js} +1 -1
  21. writer/static/assets/{SharedCopyClipboardButton-BAhxC5LU.js → SharedCopyClipboardButton-CLSRBCgD.js} +1 -1
  22. writer/static/assets/{WdsCheckbox-Bi_HXvVT.js → WdsCheckbox-4hZXXMqp.js} +1 -1
  23. writer/static/assets/{WdsDropdownMenu-BPKaOD8s.js → WdsDropdownMenu-Dxo7fB4X.js} +1 -1
  24. writer/static/assets/{WdsFieldWrapper-CwqGDrlP.js → WdsFieldWrapper-FiIg67Ue.js} +1 -1
  25. writer/static/assets/{WdsTabs-q0kVCXxi.js → WdsTabs-Bu9QXS4M.js} +1 -1
  26. writer/static/assets/{cssMode-BFJ2uFDF.js → cssMode-DOiO9898.js} +1 -1
  27. writer/static/assets/{freemarker2-DrweqdQ1.js → freemarker2-Mh7uzily.js} +1 -1
  28. writer/static/assets/{handlebars-d2aT2S4T.js → handlebars-DWkZomTi.js} +1 -1
  29. writer/static/assets/{html-DkR8jQS-.js → html-CDcMRX7c.js} +1 -1
  30. writer/static/assets/{htmlMode-ChyeBcvP.js → htmlMode-BK56O9H8.js} +1 -1
  31. writer/static/assets/{index-DHZHZi5W.js → index-CJX-1yk2.js} +1 -1
  32. writer/static/assets/{index-Bj5EqtwJ.js → index-DeYzv_Ed.js} +12 -12
  33. writer/static/assets/{index-uhDDPaD2.js → index-F34OOIFZ.js} +1 -1
  34. writer/static/assets/{javascript-DtI3gL80.js → javascript-B1Uskc0G.js} +1 -1
  35. writer/static/assets/{jsonMode-B9CbMObz.js → jsonMode-Umgp54CI.js} +1 -1
  36. writer/static/assets/{liquid-D620qh4W.js → liquid-DlRFGFtF.js} +1 -1
  37. writer/static/assets/{mapbox-gl-IM8CBmd8.js → mapbox-gl-BsYXmwqx.js} +1 -1
  38. writer/static/assets/{mdx-CrO1Zrq5.js → mdx-qQnPUchC.js} +1 -1
  39. writer/static/assets/{pdf-5wahDYbm.js → pdf-DPymwj3U.js} +1 -1
  40. writer/static/assets/{plotly.min-DmBAN9XQ.js → plotly.min-BIzVHqST.js} +1 -1
  41. writer/static/assets/{python-BwZnPvHK.js → python-yQwe0l38.js} +1 -1
  42. writer/static/assets/{razor-DIsRzgu4.js → razor-Dym5JSLw.js} +1 -1
  43. writer/static/assets/{tsMode-CG0rBgC9.js → tsMode-JtUWDO0e.js} +1 -1
  44. writer/static/assets/{typescript-BBvXo7TF.js → typescript-BjFqagE3.js} +1 -1
  45. writer/static/assets/{useBlueprintRun-DQUAcK67.js → useBlueprintRun-Bi4F261R.js} +1 -1
  46. writer/static/assets/{useKeyValueEditor-vhhDzyE2.js → useKeyValueEditor-D0bDqvT4.js} +1 -1
  47. writer/static/assets/{useListResources-DGx8U65A.js → useListResources-CSJzgJIa.js} +1 -1
  48. writer/static/assets/{xml-nERONKOk.js → xml-CZp1RJ1s.js} +1 -1
  49. writer/static/assets/{yaml-B9E-sHku.js → yaml-wYbD_UTn.js} +1 -1
  50. writer/static/index.html +1 -1
  51. {writer-1.25.0.dist-info → writer-1.25.0rc2.dist-info}/METADATA +1 -1
  52. {writer-1.25.0.dist-info → writer-1.25.0rc2.dist-info}/RECORD +55 -55
  53. writer/static/assets/BaseMarkdown-CsWzSrDd.js +0 -1
  54. {writer-1.25.0.dist-info → writer-1.25.0rc2.dist-info}/WHEEL +0 -0
  55. {writer-1.25.0.dist-info → writer-1.25.0rc2.dist-info}/entry_points.txt +0 -0
  56. {writer-1.25.0.dist-info → writer-1.25.0rc2.dist-info}/licenses/LICENSE.txt +0 -0
@@ -1,4 +1,4 @@
1
- var zg=Object.defineProperty;var Ug=(d,t,e)=>t in d?zg(d,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):d[t]=e;var I=(d,t,e)=>(Ug(d,typeof t!="symbol"?t+"":t,e),e),Ud=(d,t,e)=>{if(!t.has(d))throw TypeError("Cannot "+e)};var n=(d,t,e)=>(Ud(d,t,"read from private field"),e?e.call(d):t.get(d)),f=(d,t,e)=>{if(t.has(d))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(d):t.set(d,e)},g=(d,t,e,s)=>(Ud(d,t,"write to private field"),s?s.call(d,e):t.set(d,e),e);var $t=(d,t,e,s)=>({set _(i){g(d,t,i,e)},get _(){return n(d,t,s)}}),b=(d,t,e)=>(Ud(d,t,"access private method"),e);import{Q as Vg}from"./index-Bj5EqtwJ.js";var eo={};eo.d=(d,t)=>{for(var e in t)eo.o(t,e)&&!eo.o(d,e)&&Object.defineProperty(d,e,{enumerable:!0,get:t[e]})};eo.o=(d,t)=>Object.prototype.hasOwnProperty.call(d,t);var O=globalThis.pdfjsLib={};eo.d(O,{AbortException:()=>qn,AnnotationEditorLayer:()=>rf,AnnotationEditorParamsType:()=>z,AnnotationEditorType:()=>H,AnnotationEditorUIManager:()=>jn,AnnotationLayer:()=>Bb,AnnotationMode:()=>qs,ColorPicker:()=>Qh,DOMSVGFactory:()=>_f,DrawLayer:()=>lf,FeatureTest:()=>Wt,GlobalWorkerOptions:()=>Vs,ImageKind:()=>yh,InvalidPDFException:()=>qf,MissingPDFException:()=>dh,OPS:()=>Ce,OutputScale:()=>tu,PDFDataRangeTransport:()=>Up,PDFDateString:()=>gf,PDFWorker:()=>or,PasswordResponses:()=>Xg,PermissionFlag:()=>qg,PixelsPerInch:()=>Ri,RenderingCancelledException:()=>ff,TextLayer:()=>io,UnexpectedResponseException:()=>Nd,Util:()=>M,VerbosityLevel:()=>Dd,XfaLayer:()=>jp,build:()=>_b,createValidAbsoluteUrl:()=>Jg,fetchData:()=>Bd,getDocument:()=>cb,getFilenameFromUrl:()=>om,getPdfFilenameFromUrl:()=>lm,getXfaPageViewport:()=>hm,isDataScheme:()=>$d,isPdfFile:()=>pf,noContextMenu:()=>Ue,normalizeUnicode:()=>nm,setLayerDimensions:()=>Vn,shadow:()=>G,stopEvent:()=>ze,version:()=>Ab});const jt=typeof process=="object"&&process+""=="[object process]"&&!process.versions.nw&&!(process.versions.electron&&process.type&&process.type!=="browser"),Wf=[1,0,0,1,0,0],Kd=[.001,0,0,.001,0,0],jg=1e7,Vd=1.35,ue={ANY:1,DISPLAY:2,PRINT:4,SAVE:8,ANNOTATIONS_FORMS:16,ANNOTATIONS_STORAGE:32,ANNOTATIONS_DISABLE:64,IS_EDITING:128,OPLIST:256},qs={DISABLE:0,ENABLE:1,ENABLE_FORMS:2,ENABLE_STORAGE:3},Wg="pdfjs_internal_editor_",H={DISABLE:-1,NONE:0,FREETEXT:3,HIGHLIGHT:9,STAMP:13,INK:15},z={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,DRAW_STEP:41},qg={PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048},Mt={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},yh={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3},gt={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},Oa={SOLID:1,DASHED:2,BEVELED:3,INSET:4,UNDERLINE:5},Dd={ERRORS:0,WARNINGS:1,INFOS:5},Ce={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,setStrokeTransparent:92,setFillTransparent:93},Xg={NEED_PASSWORD:1,INCORRECT_PASSWORD:2};let Fd=Dd.WARNINGS;function Yg(d){Number.isInteger(d)&&(Fd=d)}function Kg(){return Fd}function Od(d){Fd>=Dd.INFOS&&console.log(`Info: ${d}`)}function B(d){Fd>=Dd.WARNINGS&&console.log(`Warning: ${d}`)}function K(d){throw new Error(d)}function ft(d,t){d||K(t)}function Qg(d){switch(d==null?void 0:d.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":return!0;default:return!1}}function Jg(d,t=null,e=null){if(!d)return null;try{if(e&&typeof d=="string"){if(e.addDefaultProtocol&&d.startsWith("www.")){const i=d.match(/\./g);(i==null?void 0:i.length)>=2&&(d=`http://${d}`)}if(e.tryConvertEncoding)try{d=im(d)}catch{}}const s=t?new URL(d,t):new URL(d);if(Qg(s))return s}catch{}return null}function G(d,t,e,s=!1){return Object.defineProperty(d,t,{value:e,enumerable:!s,configurable:!0,writable:!1}),e}const Pi=function(){function t(e,s){this.message=e,this.name=s}return t.prototype=new Error,t.constructor=t,t}();class Qd extends Pi{constructor(t,e){super(t,"PasswordException"),this.code=e}}class Jd extends Pi{constructor(t,e){super(t,"UnknownErrorException"),this.details=e}}class qf extends Pi{constructor(t){super(t,"InvalidPDFException")}}class dh extends Pi{constructor(t){super(t,"MissingPDFException")}}class Nd extends Pi{constructor(t,e){super(t,"UnexpectedResponseException"),this.status=e}}class Zg extends Pi{constructor(t){super(t,"FormatError")}}class qn extends Pi{constructor(t){super(t,"AbortException")}}function Xf(d){(typeof d!="object"||(d==null?void 0:d.length)===void 0)&&K("Invalid argument for bytesToString");const t=d.length,e=8192;if(t<e)return String.fromCharCode.apply(null,d);const s=[];for(let i=0;i<t;i+=e){const r=Math.min(i+e,t),a=d.subarray(i,r);s.push(String.fromCharCode.apply(null,a))}return s.join("")}function Hd(d){typeof d!="string"&&K("Invalid argument for stringToBytes");const t=d.length,e=new Uint8Array(t);for(let s=0;s<t;++s)e[s]=d.charCodeAt(s)&255;return e}function tm(d){return String.fromCharCode(d>>24&255,d>>16&255,d>>8&255,d&255)}function df(d){const t=Object.create(null);for(const[e,s]of d)t[e]=s;return t}function em(){const d=new Uint8Array(4);return d[0]=1,new Uint32Array(d.buffer,0,1)[0]===1}function sm(){try{return new Function(""),!0}catch{return!1}}class Wt{static get isLittleEndian(){return G(this,"isLittleEndian",em())}static get isEvalSupported(){return G(this,"isEvalSupported",sm())}static get isOffscreenCanvasSupported(){return G(this,"isOffscreenCanvasSupported",typeof OffscreenCanvas<"u")}static get isImageDecoderSupported(){return G(this,"isImageDecoderSupported",typeof ImageDecoder<"u")}static get platform(){return typeof navigator<"u"&&typeof(navigator==null?void 0:navigator.platform)=="string"?G(this,"platform",{isMac:navigator.platform.includes("Mac"),isWindows:navigator.platform.includes("Win"),isFirefox:typeof(navigator==null?void 0:navigator.userAgent)=="string"&&navigator.userAgent.includes("Firefox")}):G(this,"platform",{isMac:!1,isWindows:!1,isFirefox:!1})}static get isCSSRoundSupported(){var t,e;return G(this,"isCSSRoundSupported",(e=(t=globalThis.CSS)==null?void 0:t.supports)==null?void 0:e.call(t,"width: round(1.5px, 1px)"))}}const jd=Array.from(Array(256).keys(),d=>d.toString(16).padStart(2,"0"));var lr,wh,ro,Zd;class M{static makeHexColor(t,e,s){return`#${jd[t]}${jd[e]}${jd[s]}`}static scaleMinMax(t,e){let s;t[0]?(t[0]<0&&(s=e[0],e[0]=e[2],e[2]=s),e[0]*=t[0],e[2]*=t[0],t[3]<0&&(s=e[1],e[1]=e[3],e[3]=s),e[1]*=t[3],e[3]*=t[3]):(s=e[0],e[0]=e[1],e[1]=s,s=e[2],e[2]=e[3],e[3]=s,t[1]<0&&(s=e[1],e[1]=e[3],e[3]=s),e[1]*=t[1],e[3]*=t[1],t[2]<0&&(s=e[0],e[0]=e[2],e[2]=s),e[0]*=t[2],e[2]*=t[2]),e[0]+=t[4],e[1]+=t[5],e[2]+=t[4],e[3]+=t[5]}static transform(t,e){return[t[0]*e[0]+t[2]*e[1],t[1]*e[0]+t[3]*e[1],t[0]*e[2]+t[2]*e[3],t[1]*e[2]+t[3]*e[3],t[0]*e[4]+t[2]*e[5]+t[4],t[1]*e[4]+t[3]*e[5]+t[5]]}static applyTransform(t,e){const s=t[0]*e[0]+t[1]*e[2]+e[4],i=t[0]*e[1]+t[1]*e[3]+e[5];return[s,i]}static applyInverseTransform(t,e){const s=e[0]*e[3]-e[1]*e[2],i=(t[0]*e[3]-t[1]*e[2]+e[2]*e[5]-e[4]*e[3])/s,r=(-t[0]*e[1]+t[1]*e[0]+e[4]*e[1]-e[5]*e[0])/s;return[i,r]}static getAxialAlignedBoundingBox(t,e){const s=this.applyTransform(t,e),i=this.applyTransform(t.slice(2,4),e),r=this.applyTransform([t[0],t[3]],e),a=this.applyTransform([t[2],t[1]],e);return[Math.min(s[0],i[0],r[0],a[0]),Math.min(s[1],i[1],r[1],a[1]),Math.max(s[0],i[0],r[0],a[0]),Math.max(s[1],i[1],r[1],a[1])]}static inverseTransform(t){const e=t[0]*t[3]-t[1]*t[2];return[t[3]/e,-t[1]/e,-t[2]/e,t[0]/e,(t[2]*t[5]-t[4]*t[3])/e,(t[4]*t[1]-t[5]*t[0])/e]}static singularValueDecompose2dScale(t){const e=[t[0],t[2],t[1],t[3]],s=t[0]*e[0]+t[1]*e[2],i=t[0]*e[1]+t[1]*e[3],r=t[2]*e[0]+t[3]*e[2],a=t[2]*e[1]+t[3]*e[3],o=(s+a)/2,l=Math.sqrt((s+a)**2-4*(s*a-r*i))/2,h=o+l||1,c=o-l||1;return[Math.sqrt(h),Math.sqrt(c)]}static normalizeRect(t){const e=t.slice(0);return t[0]>t[2]&&(e[0]=t[2],e[2]=t[0]),t[1]>t[3]&&(e[1]=t[3],e[3]=t[1]),e}static intersect(t,e){const s=Math.max(Math.min(t[0],t[2]),Math.min(e[0],e[2])),i=Math.min(Math.max(t[0],t[2]),Math.max(e[0],e[2]));if(s>i)return null;const r=Math.max(Math.min(t[1],t[3]),Math.min(e[1],e[3])),a=Math.min(Math.max(t[1],t[3]),Math.max(e[1],e[3]));return r>a?null:[s,r,i,a]}static bezierBoundingBox(t,e,s,i,r,a,o,l,h){return h?(h[0]=Math.min(h[0],t,o),h[1]=Math.min(h[1],e,l),h[2]=Math.max(h[2],t,o),h[3]=Math.max(h[3],e,l)):h=[Math.min(t,o),Math.min(e,l),Math.max(t,o),Math.max(e,l)],b(this,ro,Zd).call(this,t,s,r,o,e,i,a,l,3*(-t+3*(s-r)+o),6*(t-2*s+r),3*(s-t),h),b(this,ro,Zd).call(this,t,s,r,o,e,i,a,l,3*(-e+3*(i-a)+l),6*(e-2*i+a),3*(i-e),h),h}}lr=new WeakSet,wh=function(t,e,s,i,r,a,o,l,h,c){if(h<=0||h>=1)return;const u=1-h,p=h*h,m=p*h,A=u*(u*(u*t+3*h*e)+3*p*s)+m*i,_=u*(u*(u*r+3*h*a)+3*p*o)+m*l;c[0]=Math.min(c[0],A),c[1]=Math.min(c[1],_),c[2]=Math.max(c[2],A),c[3]=Math.max(c[3],_)},ro=new WeakSet,Zd=function(t,e,s,i,r,a,o,l,h,c,u,p){if(Math.abs(h)<1e-12){Math.abs(c)>=1e-12&&b(this,lr,wh).call(this,t,e,s,i,r,a,o,l,-u/c,p);return}const m=c**2-4*u*h;if(m<0)return;const A=Math.sqrt(m),_=2*h;b(this,lr,wh).call(this,t,e,s,i,r,a,o,l,(-c+A)/_,p),b(this,lr,wh).call(this,t,e,s,i,r,a,o,l,(-c-A)/_,p)},f(M,lr),f(M,ro);function im(d){return decodeURIComponent(escape(d))}let Wd=null,Tf=null;function nm(d){return Wd||(Wd=/([\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,Tf=new Map([["ſt","ſt"]])),d.replaceAll(Wd,(t,e,s)=>e?e.normalize("NFKC"):Tf.get(s))}function rm(){if(typeof crypto.randomUUID=="function")return crypto.randomUUID();const d=new Uint8Array(32);return crypto.getRandomValues(d),Xf(d)}const uf="pdfjs_internal_id_",fs={BEZIER_CURVE_TO:0,MOVE_TO:1,LINE_TO:2,QUADRATIC_CURVE_TO:3,RESTORE:4,SAVE:5,SCALE:6,TRANSFORM:7,TRANSLATE:8};function am(d){return Uint8Array.prototype.toBase64?d.toBase64():btoa(Xf(d))}const ps="http://www.w3.org/2000/svg",Ii=class Ii{};I(Ii,"CSS",96),I(Ii,"PDF",72),I(Ii,"PDF_TO_CSS_UNITS",Ii.CSS/Ii.PDF);let Ri=Ii;async function Bd(d,t="text"){if(Ba(d,document.baseURI)){const e=await fetch(d);if(!e.ok)throw new Error(e.statusText);switch(t){case"arraybuffer":return e.arrayBuffer();case"blob":return e.blob();case"json":return e.json()}return e.text()}return new Promise((e,s)=>{const i=new XMLHttpRequest;i.open("GET",d,!0),i.responseType=t,i.onreadystatechange=()=>{if(i.readyState===XMLHttpRequest.DONE){if(i.status===200||i.status===0){switch(t){case"arraybuffer":case"blob":case"json":e(i.response);return}e(i.responseText);return}s(new Error(i.statusText))}},i.send(null)})}class uh{constructor({viewBox:t,scale:e,rotation:s,offsetX:i=0,offsetY:r=0,dontFlip:a=!1}){this.viewBox=t,this.scale=e,this.rotation=s,this.offsetX=i,this.offsetY=r;const o=(t[2]+t[0])/2,l=(t[3]+t[1])/2;let h,c,u,p;switch(s%=360,s<0&&(s+=360),s){case 180:h=-1,c=0,u=0,p=1;break;case 90:h=0,c=1,u=1,p=0;break;case 270:h=0,c=-1,u=-1,p=0;break;case 0:h=1,c=0,u=0,p=-1;break;default:throw new Error("PageViewport: Invalid rotation, must be a multiple of 90 degrees.")}a&&(u=-u,p=-p);let m,A,_,w;h===0?(m=Math.abs(l-t[1])*e+i,A=Math.abs(o-t[0])*e+r,_=(t[3]-t[1])*e,w=(t[2]-t[0])*e):(m=Math.abs(o-t[0])*e+i,A=Math.abs(l-t[1])*e+r,_=(t[2]-t[0])*e,w=(t[3]-t[1])*e),this.transform=[h*e,c*e,u*e,p*e,m-h*e*o-u*e*l,A-c*e*o-p*e*l],this.width=_,this.height=w}get rawDims(){const{viewBox:t}=this;return G(this,"rawDims",{pageWidth:t[2]-t[0],pageHeight:t[3]-t[1],pageX:t[0],pageY:t[1]})}clone({scale:t=this.scale,rotation:e=this.rotation,offsetX:s=this.offsetX,offsetY:i=this.offsetY,dontFlip:r=!1}={}){return new uh({viewBox:this.viewBox.slice(),scale:t,rotation:e,offsetX:s,offsetY:i,dontFlip:r})}convertToViewportPoint(t,e){return M.applyTransform([t,e],this.transform)}convertToViewportRectangle(t){const e=M.applyTransform([t[0],t[1]],this.transform),s=M.applyTransform([t[2],t[3]],this.transform);return[e[0],e[1],s[0],s[1]]}convertToPdfPoint(t,e){return M.applyInverseTransform([t,e],this.transform)}}class ff extends Pi{constructor(t,e=0){super(t,"RenderingCancelledException"),this.extraDelay=e}}function $d(d){const t=d.length;let e=0;for(;e<t&&d[e].trim()==="";)e++;return d.substring(e,e+5).toLowerCase()==="data:"}function pf(d){return typeof d=="string"&&/\.pdf$/i.test(d)}function om(d){return[d]=d.split(/[#?]/,1),d.substring(d.lastIndexOf("/")+1)}function lm(d,t="document.pdf"){if(typeof d!="string")return t;if($d(d))return B('getPdfFilenameFromUrl: ignore "data:"-URL for performance reasons.'),t;const e=/^(?:(?:[^:]+:)?\/\/[^/]+)?([^?#]*)(\?[^#]*)?(#.*)?$/,s=/[^/?#=]+\.pdf\b(?!.*\.pdf\b)/i,i=e.exec(d);let r=s.exec(i[1])||s.exec(i[2])||s.exec(i[3]);if(r&&(r=r[0],r.includes("%")))try{r=s.exec(decodeURIComponent(r))[0]}catch{}return r||t}class Rf{constructor(){I(this,"started",Object.create(null));I(this,"times",[])}time(t){t in this.started&&B(`Timer is already running for ${t}`),this.started[t]=Date.now()}timeEnd(t){t in this.started||B(`Timer has not been started for ${t}`),this.times.push({name:t,start:this.started[t],end:Date.now()}),delete this.started[t]}toString(){const t=[];let e=0;for(const{name:s}of this.times)e=Math.max(s.length,e);for(const{name:s,start:i,end:r}of this.times)t.push(`${s.padEnd(e)} ${r-i}ms
1
+ var zg=Object.defineProperty;var Ug=(d,t,e)=>t in d?zg(d,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):d[t]=e;var I=(d,t,e)=>(Ug(d,typeof t!="symbol"?t+"":t,e),e),Ud=(d,t,e)=>{if(!t.has(d))throw TypeError("Cannot "+e)};var n=(d,t,e)=>(Ud(d,t,"read from private field"),e?e.call(d):t.get(d)),f=(d,t,e)=>{if(t.has(d))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(d):t.set(d,e)},g=(d,t,e,s)=>(Ud(d,t,"write to private field"),s?s.call(d,e):t.set(d,e),e);var $t=(d,t,e,s)=>({set _(i){g(d,t,i,e)},get _(){return n(d,t,s)}}),b=(d,t,e)=>(Ud(d,t,"access private method"),e);import{Q as Vg}from"./index-DeYzv_Ed.js";var eo={};eo.d=(d,t)=>{for(var e in t)eo.o(t,e)&&!eo.o(d,e)&&Object.defineProperty(d,e,{enumerable:!0,get:t[e]})};eo.o=(d,t)=>Object.prototype.hasOwnProperty.call(d,t);var O=globalThis.pdfjsLib={};eo.d(O,{AbortException:()=>qn,AnnotationEditorLayer:()=>rf,AnnotationEditorParamsType:()=>z,AnnotationEditorType:()=>H,AnnotationEditorUIManager:()=>jn,AnnotationLayer:()=>Bb,AnnotationMode:()=>qs,ColorPicker:()=>Qh,DOMSVGFactory:()=>_f,DrawLayer:()=>lf,FeatureTest:()=>Wt,GlobalWorkerOptions:()=>Vs,ImageKind:()=>yh,InvalidPDFException:()=>qf,MissingPDFException:()=>dh,OPS:()=>Ce,OutputScale:()=>tu,PDFDataRangeTransport:()=>Up,PDFDateString:()=>gf,PDFWorker:()=>or,PasswordResponses:()=>Xg,PermissionFlag:()=>qg,PixelsPerInch:()=>Ri,RenderingCancelledException:()=>ff,TextLayer:()=>io,UnexpectedResponseException:()=>Nd,Util:()=>M,VerbosityLevel:()=>Dd,XfaLayer:()=>jp,build:()=>_b,createValidAbsoluteUrl:()=>Jg,fetchData:()=>Bd,getDocument:()=>cb,getFilenameFromUrl:()=>om,getPdfFilenameFromUrl:()=>lm,getXfaPageViewport:()=>hm,isDataScheme:()=>$d,isPdfFile:()=>pf,noContextMenu:()=>Ue,normalizeUnicode:()=>nm,setLayerDimensions:()=>Vn,shadow:()=>G,stopEvent:()=>ze,version:()=>Ab});const jt=typeof process=="object"&&process+""=="[object process]"&&!process.versions.nw&&!(process.versions.electron&&process.type&&process.type!=="browser"),Wf=[1,0,0,1,0,0],Kd=[.001,0,0,.001,0,0],jg=1e7,Vd=1.35,ue={ANY:1,DISPLAY:2,PRINT:4,SAVE:8,ANNOTATIONS_FORMS:16,ANNOTATIONS_STORAGE:32,ANNOTATIONS_DISABLE:64,IS_EDITING:128,OPLIST:256},qs={DISABLE:0,ENABLE:1,ENABLE_FORMS:2,ENABLE_STORAGE:3},Wg="pdfjs_internal_editor_",H={DISABLE:-1,NONE:0,FREETEXT:3,HIGHLIGHT:9,STAMP:13,INK:15},z={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,DRAW_STEP:41},qg={PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048},Mt={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},yh={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3},gt={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},Oa={SOLID:1,DASHED:2,BEVELED:3,INSET:4,UNDERLINE:5},Dd={ERRORS:0,WARNINGS:1,INFOS:5},Ce={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,setStrokeTransparent:92,setFillTransparent:93},Xg={NEED_PASSWORD:1,INCORRECT_PASSWORD:2};let Fd=Dd.WARNINGS;function Yg(d){Number.isInteger(d)&&(Fd=d)}function Kg(){return Fd}function Od(d){Fd>=Dd.INFOS&&console.log(`Info: ${d}`)}function B(d){Fd>=Dd.WARNINGS&&console.log(`Warning: ${d}`)}function K(d){throw new Error(d)}function ft(d,t){d||K(t)}function Qg(d){switch(d==null?void 0:d.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":return!0;default:return!1}}function Jg(d,t=null,e=null){if(!d)return null;try{if(e&&typeof d=="string"){if(e.addDefaultProtocol&&d.startsWith("www.")){const i=d.match(/\./g);(i==null?void 0:i.length)>=2&&(d=`http://${d}`)}if(e.tryConvertEncoding)try{d=im(d)}catch{}}const s=t?new URL(d,t):new URL(d);if(Qg(s))return s}catch{}return null}function G(d,t,e,s=!1){return Object.defineProperty(d,t,{value:e,enumerable:!s,configurable:!0,writable:!1}),e}const Pi=function(){function t(e,s){this.message=e,this.name=s}return t.prototype=new Error,t.constructor=t,t}();class Qd extends Pi{constructor(t,e){super(t,"PasswordException"),this.code=e}}class Jd extends Pi{constructor(t,e){super(t,"UnknownErrorException"),this.details=e}}class qf extends Pi{constructor(t){super(t,"InvalidPDFException")}}class dh extends Pi{constructor(t){super(t,"MissingPDFException")}}class Nd extends Pi{constructor(t,e){super(t,"UnexpectedResponseException"),this.status=e}}class Zg extends Pi{constructor(t){super(t,"FormatError")}}class qn extends Pi{constructor(t){super(t,"AbortException")}}function Xf(d){(typeof d!="object"||(d==null?void 0:d.length)===void 0)&&K("Invalid argument for bytesToString");const t=d.length,e=8192;if(t<e)return String.fromCharCode.apply(null,d);const s=[];for(let i=0;i<t;i+=e){const r=Math.min(i+e,t),a=d.subarray(i,r);s.push(String.fromCharCode.apply(null,a))}return s.join("")}function Hd(d){typeof d!="string"&&K("Invalid argument for stringToBytes");const t=d.length,e=new Uint8Array(t);for(let s=0;s<t;++s)e[s]=d.charCodeAt(s)&255;return e}function tm(d){return String.fromCharCode(d>>24&255,d>>16&255,d>>8&255,d&255)}function df(d){const t=Object.create(null);for(const[e,s]of d)t[e]=s;return t}function em(){const d=new Uint8Array(4);return d[0]=1,new Uint32Array(d.buffer,0,1)[0]===1}function sm(){try{return new Function(""),!0}catch{return!1}}class Wt{static get isLittleEndian(){return G(this,"isLittleEndian",em())}static get isEvalSupported(){return G(this,"isEvalSupported",sm())}static get isOffscreenCanvasSupported(){return G(this,"isOffscreenCanvasSupported",typeof OffscreenCanvas<"u")}static get isImageDecoderSupported(){return G(this,"isImageDecoderSupported",typeof ImageDecoder<"u")}static get platform(){return typeof navigator<"u"&&typeof(navigator==null?void 0:navigator.platform)=="string"?G(this,"platform",{isMac:navigator.platform.includes("Mac"),isWindows:navigator.platform.includes("Win"),isFirefox:typeof(navigator==null?void 0:navigator.userAgent)=="string"&&navigator.userAgent.includes("Firefox")}):G(this,"platform",{isMac:!1,isWindows:!1,isFirefox:!1})}static get isCSSRoundSupported(){var t,e;return G(this,"isCSSRoundSupported",(e=(t=globalThis.CSS)==null?void 0:t.supports)==null?void 0:e.call(t,"width: round(1.5px, 1px)"))}}const jd=Array.from(Array(256).keys(),d=>d.toString(16).padStart(2,"0"));var lr,wh,ro,Zd;class M{static makeHexColor(t,e,s){return`#${jd[t]}${jd[e]}${jd[s]}`}static scaleMinMax(t,e){let s;t[0]?(t[0]<0&&(s=e[0],e[0]=e[2],e[2]=s),e[0]*=t[0],e[2]*=t[0],t[3]<0&&(s=e[1],e[1]=e[3],e[3]=s),e[1]*=t[3],e[3]*=t[3]):(s=e[0],e[0]=e[1],e[1]=s,s=e[2],e[2]=e[3],e[3]=s,t[1]<0&&(s=e[1],e[1]=e[3],e[3]=s),e[1]*=t[1],e[3]*=t[1],t[2]<0&&(s=e[0],e[0]=e[2],e[2]=s),e[0]*=t[2],e[2]*=t[2]),e[0]+=t[4],e[1]+=t[5],e[2]+=t[4],e[3]+=t[5]}static transform(t,e){return[t[0]*e[0]+t[2]*e[1],t[1]*e[0]+t[3]*e[1],t[0]*e[2]+t[2]*e[3],t[1]*e[2]+t[3]*e[3],t[0]*e[4]+t[2]*e[5]+t[4],t[1]*e[4]+t[3]*e[5]+t[5]]}static applyTransform(t,e){const s=t[0]*e[0]+t[1]*e[2]+e[4],i=t[0]*e[1]+t[1]*e[3]+e[5];return[s,i]}static applyInverseTransform(t,e){const s=e[0]*e[3]-e[1]*e[2],i=(t[0]*e[3]-t[1]*e[2]+e[2]*e[5]-e[4]*e[3])/s,r=(-t[0]*e[1]+t[1]*e[0]+e[4]*e[1]-e[5]*e[0])/s;return[i,r]}static getAxialAlignedBoundingBox(t,e){const s=this.applyTransform(t,e),i=this.applyTransform(t.slice(2,4),e),r=this.applyTransform([t[0],t[3]],e),a=this.applyTransform([t[2],t[1]],e);return[Math.min(s[0],i[0],r[0],a[0]),Math.min(s[1],i[1],r[1],a[1]),Math.max(s[0],i[0],r[0],a[0]),Math.max(s[1],i[1],r[1],a[1])]}static inverseTransform(t){const e=t[0]*t[3]-t[1]*t[2];return[t[3]/e,-t[1]/e,-t[2]/e,t[0]/e,(t[2]*t[5]-t[4]*t[3])/e,(t[4]*t[1]-t[5]*t[0])/e]}static singularValueDecompose2dScale(t){const e=[t[0],t[2],t[1],t[3]],s=t[0]*e[0]+t[1]*e[2],i=t[0]*e[1]+t[1]*e[3],r=t[2]*e[0]+t[3]*e[2],a=t[2]*e[1]+t[3]*e[3],o=(s+a)/2,l=Math.sqrt((s+a)**2-4*(s*a-r*i))/2,h=o+l||1,c=o-l||1;return[Math.sqrt(h),Math.sqrt(c)]}static normalizeRect(t){const e=t.slice(0);return t[0]>t[2]&&(e[0]=t[2],e[2]=t[0]),t[1]>t[3]&&(e[1]=t[3],e[3]=t[1]),e}static intersect(t,e){const s=Math.max(Math.min(t[0],t[2]),Math.min(e[0],e[2])),i=Math.min(Math.max(t[0],t[2]),Math.max(e[0],e[2]));if(s>i)return null;const r=Math.max(Math.min(t[1],t[3]),Math.min(e[1],e[3])),a=Math.min(Math.max(t[1],t[3]),Math.max(e[1],e[3]));return r>a?null:[s,r,i,a]}static bezierBoundingBox(t,e,s,i,r,a,o,l,h){return h?(h[0]=Math.min(h[0],t,o),h[1]=Math.min(h[1],e,l),h[2]=Math.max(h[2],t,o),h[3]=Math.max(h[3],e,l)):h=[Math.min(t,o),Math.min(e,l),Math.max(t,o),Math.max(e,l)],b(this,ro,Zd).call(this,t,s,r,o,e,i,a,l,3*(-t+3*(s-r)+o),6*(t-2*s+r),3*(s-t),h),b(this,ro,Zd).call(this,t,s,r,o,e,i,a,l,3*(-e+3*(i-a)+l),6*(e-2*i+a),3*(i-e),h),h}}lr=new WeakSet,wh=function(t,e,s,i,r,a,o,l,h,c){if(h<=0||h>=1)return;const u=1-h,p=h*h,m=p*h,A=u*(u*(u*t+3*h*e)+3*p*s)+m*i,_=u*(u*(u*r+3*h*a)+3*p*o)+m*l;c[0]=Math.min(c[0],A),c[1]=Math.min(c[1],_),c[2]=Math.max(c[2],A),c[3]=Math.max(c[3],_)},ro=new WeakSet,Zd=function(t,e,s,i,r,a,o,l,h,c,u,p){if(Math.abs(h)<1e-12){Math.abs(c)>=1e-12&&b(this,lr,wh).call(this,t,e,s,i,r,a,o,l,-u/c,p);return}const m=c**2-4*u*h;if(m<0)return;const A=Math.sqrt(m),_=2*h;b(this,lr,wh).call(this,t,e,s,i,r,a,o,l,(-c+A)/_,p),b(this,lr,wh).call(this,t,e,s,i,r,a,o,l,(-c-A)/_,p)},f(M,lr),f(M,ro);function im(d){return decodeURIComponent(escape(d))}let Wd=null,Tf=null;function nm(d){return Wd||(Wd=/([\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,Tf=new Map([["ſt","ſt"]])),d.replaceAll(Wd,(t,e,s)=>e?e.normalize("NFKC"):Tf.get(s))}function rm(){if(typeof crypto.randomUUID=="function")return crypto.randomUUID();const d=new Uint8Array(32);return crypto.getRandomValues(d),Xf(d)}const uf="pdfjs_internal_id_",fs={BEZIER_CURVE_TO:0,MOVE_TO:1,LINE_TO:2,QUADRATIC_CURVE_TO:3,RESTORE:4,SAVE:5,SCALE:6,TRANSFORM:7,TRANSLATE:8};function am(d){return Uint8Array.prototype.toBase64?d.toBase64():btoa(Xf(d))}const ps="http://www.w3.org/2000/svg",Ii=class Ii{};I(Ii,"CSS",96),I(Ii,"PDF",72),I(Ii,"PDF_TO_CSS_UNITS",Ii.CSS/Ii.PDF);let Ri=Ii;async function Bd(d,t="text"){if(Ba(d,document.baseURI)){const e=await fetch(d);if(!e.ok)throw new Error(e.statusText);switch(t){case"arraybuffer":return e.arrayBuffer();case"blob":return e.blob();case"json":return e.json()}return e.text()}return new Promise((e,s)=>{const i=new XMLHttpRequest;i.open("GET",d,!0),i.responseType=t,i.onreadystatechange=()=>{if(i.readyState===XMLHttpRequest.DONE){if(i.status===200||i.status===0){switch(t){case"arraybuffer":case"blob":case"json":e(i.response);return}e(i.responseText);return}s(new Error(i.statusText))}},i.send(null)})}class uh{constructor({viewBox:t,scale:e,rotation:s,offsetX:i=0,offsetY:r=0,dontFlip:a=!1}){this.viewBox=t,this.scale=e,this.rotation=s,this.offsetX=i,this.offsetY=r;const o=(t[2]+t[0])/2,l=(t[3]+t[1])/2;let h,c,u,p;switch(s%=360,s<0&&(s+=360),s){case 180:h=-1,c=0,u=0,p=1;break;case 90:h=0,c=1,u=1,p=0;break;case 270:h=0,c=-1,u=-1,p=0;break;case 0:h=1,c=0,u=0,p=-1;break;default:throw new Error("PageViewport: Invalid rotation, must be a multiple of 90 degrees.")}a&&(u=-u,p=-p);let m,A,_,w;h===0?(m=Math.abs(l-t[1])*e+i,A=Math.abs(o-t[0])*e+r,_=(t[3]-t[1])*e,w=(t[2]-t[0])*e):(m=Math.abs(o-t[0])*e+i,A=Math.abs(l-t[1])*e+r,_=(t[2]-t[0])*e,w=(t[3]-t[1])*e),this.transform=[h*e,c*e,u*e,p*e,m-h*e*o-u*e*l,A-c*e*o-p*e*l],this.width=_,this.height=w}get rawDims(){const{viewBox:t}=this;return G(this,"rawDims",{pageWidth:t[2]-t[0],pageHeight:t[3]-t[1],pageX:t[0],pageY:t[1]})}clone({scale:t=this.scale,rotation:e=this.rotation,offsetX:s=this.offsetX,offsetY:i=this.offsetY,dontFlip:r=!1}={}){return new uh({viewBox:this.viewBox.slice(),scale:t,rotation:e,offsetX:s,offsetY:i,dontFlip:r})}convertToViewportPoint(t,e){return M.applyTransform([t,e],this.transform)}convertToViewportRectangle(t){const e=M.applyTransform([t[0],t[1]],this.transform),s=M.applyTransform([t[2],t[3]],this.transform);return[e[0],e[1],s[0],s[1]]}convertToPdfPoint(t,e){return M.applyInverseTransform([t,e],this.transform)}}class ff extends Pi{constructor(t,e=0){super(t,"RenderingCancelledException"),this.extraDelay=e}}function $d(d){const t=d.length;let e=0;for(;e<t&&d[e].trim()==="";)e++;return d.substring(e,e+5).toLowerCase()==="data:"}function pf(d){return typeof d=="string"&&/\.pdf$/i.test(d)}function om(d){return[d]=d.split(/[#?]/,1),d.substring(d.lastIndexOf("/")+1)}function lm(d,t="document.pdf"){if(typeof d!="string")return t;if($d(d))return B('getPdfFilenameFromUrl: ignore "data:"-URL for performance reasons.'),t;const e=/^(?:(?:[^:]+:)?\/\/[^/]+)?([^?#]*)(\?[^#]*)?(#.*)?$/,s=/[^/?#=]+\.pdf\b(?!.*\.pdf\b)/i,i=e.exec(d);let r=s.exec(i[1])||s.exec(i[2])||s.exec(i[3]);if(r&&(r=r[0],r.includes("%")))try{r=s.exec(decodeURIComponent(r))[0]}catch{}return r||t}class Rf{constructor(){I(this,"started",Object.create(null));I(this,"times",[])}time(t){t in this.started&&B(`Timer is already running for ${t}`),this.started[t]=Date.now()}timeEnd(t){t in this.started||B(`Timer has not been started for ${t}`),this.times.push({name:t,start:this.started[t],end:Date.now()}),delete this.started[t]}toString(){const t=[];let e=0;for(const{name:s}of this.times)e=Math.max(s.length,e);for(const{name:s,start:i,end:r}of this.times)t.push(`${s.padEnd(e)} ${r-i}ms
2
2
  `);return t.join("")}}function Ba(d,t){try{const{protocol:e}=t?new URL(d,t):new URL(d);return e==="http:"||e==="https:"}catch{return!1}}function Ue(d){d.preventDefault()}function ze(d){d.preventDefault(),d.stopPropagation()}function Pf(d){console.log("Deprecated API usage: "+d)}var ao;class gf{static toDateObject(t){if(!t||typeof t!="string")return null;n(this,ao)||g(this,ao,new RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+|-])?(\\d{2})?'?(\\d{2})?'?"));const e=n(this,ao).exec(t);if(!e)return null;const s=parseInt(e[1],10);let i=parseInt(e[2],10);i=i>=1&&i<=12?i-1:0;let r=parseInt(e[3],10);r=r>=1&&r<=31?r:1;let a=parseInt(e[4],10);a=a>=0&&a<=23?a:0;let o=parseInt(e[5],10);o=o>=0&&o<=59?o:0;let l=parseInt(e[6],10);l=l>=0&&l<=59?l:0;const h=e[7]||"Z";let c=parseInt(e[8],10);c=c>=0&&c<=23?c:0;let u=parseInt(e[9],10)||0;return u=u>=0&&u<=59?u:0,h==="-"?(a+=c,o+=u):h==="+"&&(a-=c,o-=u),new Date(Date.UTC(s,i,r,a,o,l))}}ao=new WeakMap,f(gf,ao,void 0);function hm(d,{scale:t=1,rotation:e=0}){const{width:s,height:i}=d.attributes.style,r=[0,0,parseInt(s),parseInt(i)];return new uh({viewBox:r,scale:t,rotation:e})}function mf(d){if(d.startsWith("#")){const t=parseInt(d.slice(1),16);return[(t&16711680)>>16,(t&65280)>>8,t&255]}return d.startsWith("rgb(")?d.slice(4,-1).split(",").map(t=>parseInt(t)):d.startsWith("rgba(")?d.slice(5,-1).split(",").map(t=>parseInt(t)).slice(0,3):(B(`Not a valid color format: "${d}"`),[0,0,0])}function cm(d){const t=document.createElement("span");t.style.visibility="hidden",document.body.append(t);for(const e of d.keys()){t.style.color=e;const s=window.getComputedStyle(t).color;d.set(e,mf(s))}t.remove()}function et(d){const{a:t,b:e,c:s,d:i,e:r,f:a}=d.getTransform();return[t,e,s,i,r,a]}function je(d){const{a:t,b:e,c:s,d:i,e:r,f:a}=d.getTransform().invertSelf();return[t,e,s,i,r,a]}function Vn(d,t,e=!1,s=!0){if(t instanceof uh){const{pageWidth:i,pageHeight:r}=t.rawDims,{style:a}=d,o=Wt.isCSSRoundSupported,l=`var(--scale-factor) * ${i}px`,h=`var(--scale-factor) * ${r}px`,c=o?`round(down, ${l}, var(--scale-round-x, 1px))`:`calc(${l})`,u=o?`round(down, ${h}, var(--scale-round-y, 1px))`:`calc(${h})`;!e||t.rotation%180===0?(a.width=c,a.height=u):(a.width=u,a.height=c)}s&&d.setAttribute("data-main-rotation",t.rotation)}class tu{constructor(){const t=window.devicePixelRatio||1;this.sx=t,this.sy=t}get scaled(){return this.sx!==1||this.sy!==1}get symmetric(){return this.sx===this.sy}}var Xs,Fi,Te,Oi,oo,lo,tc,Yf,ec,Kf,sc,Qf,hr,vh,ic,Jf,ho,su;const bs=class bs{constructor(t){f(this,ec);f(this,sc);f(this,hr);f(this,ic);f(this,ho);f(this,Xs,null);f(this,Fi,null);f(this,Te,void 0);f(this,Oi,null);f(this,oo,null);g(this,Te,t),n(bs,lo)||g(bs,lo,Object.freeze({freetext:"pdfjs-editor-remove-freetext-button",highlight:"pdfjs-editor-remove-highlight-button",ink:"pdfjs-editor-remove-ink-button",stamp:"pdfjs-editor-remove-stamp-button"}))}render(){const t=g(this,Xs,document.createElement("div"));t.classList.add("editToolbar","hidden"),t.setAttribute("role","toolbar");const e=n(this,Te)._uiManager._signal;t.addEventListener("contextmenu",Ue,{signal:e}),t.addEventListener("pointerdown",b(bs,tc,Yf),{signal:e});const s=g(this,Oi,document.createElement("div"));s.className="buttons",t.append(s);const i=n(this,Te).toolbarPosition;if(i){const{style:r}=t,a=n(this,Te)._uiManager.direction==="ltr"?1-i[0]:i[0];r.insetInlineEnd=`${100*a}%`,r.top=`calc(${100*i[1]}% + var(--editor-toolbar-vert-offset))`}return b(this,ic,Jf).call(this),t}get div(){return n(this,Xs)}hide(){var t;n(this,Xs).classList.add("hidden"),(t=n(this,Fi))==null||t.hideDropdown()}show(){var t;n(this,Xs).classList.remove("hidden"),(t=n(this,oo))==null||t.shown()}async addAltText(t){const e=await t.render();b(this,hr,vh).call(this,e),n(this,Oi).prepend(e,n(this,ho,su)),g(this,oo,t)}addColorPicker(t){g(this,Fi,t);const e=t.renderButton();b(this,hr,vh).call(this,e),n(this,Oi).prepend(e,n(this,ho,su))}remove(){var t;n(this,Xs).remove(),(t=n(this,Fi))==null||t.destroy(),g(this,Fi,null)}};Xs=new WeakMap,Fi=new WeakMap,Te=new WeakMap,Oi=new WeakMap,oo=new WeakMap,lo=new WeakMap,tc=new WeakSet,Yf=function(t){t.stopPropagation()},ec=new WeakSet,Kf=function(t){n(this,Te)._focusEventsAllowed=!1,ze(t)},sc=new WeakSet,Qf=function(t){n(this,Te)._focusEventsAllowed=!0,ze(t)},hr=new WeakSet,vh=function(t){const e=n(this,Te)._uiManager._signal;t.addEventListener("focusin",b(this,ec,Kf).bind(this),{capture:!0,signal:e}),t.addEventListener("focusout",b(this,sc,Qf).bind(this),{capture:!0,signal:e}),t.addEventListener("contextmenu",Ue,{signal:e})},ic=new WeakSet,Jf=function(){const{editorType:t,_uiManager:e}=n(this,Te),s=document.createElement("button");s.className="delete",s.tabIndex=0,s.setAttribute("data-l10n-id",n(bs,lo)[t]),b(this,hr,vh).call(this,s),s.addEventListener("click",i=>{e.delete()},{signal:e._signal}),n(this,Oi).append(s)},ho=new WeakSet,su=function(){const t=document.createElement("div");return t.className="divider",t},f(bs,tc),f(bs,lo,null);let eu=bs;var co,Ni,Hi,nc,Zf,rc,tp,ac,ep;class dm{constructor(t){f(this,nc);f(this,rc);f(this,ac);f(this,co,null);f(this,Ni,null);f(this,Hi,void 0);g(this,Hi,t)}show(t,e,s){const[i,r]=b(this,rc,tp).call(this,e,s),{style:a}=n(this,Ni)||g(this,Ni,b(this,nc,Zf).call(this));t.append(n(this,Ni)),a.insetInlineEnd=`${100*i}%`,a.top=`calc(${100*r}% + var(--editor-toolbar-vert-offset))`}hide(){n(this,Ni).remove()}}co=new WeakMap,Ni=new WeakMap,Hi=new WeakMap,nc=new WeakSet,Zf=function(){const t=g(this,Ni,document.createElement("div"));t.className="editToolbar",t.setAttribute("role","toolbar"),t.addEventListener("contextmenu",Ue,{signal:n(this,Hi)._signal});const e=g(this,co,document.createElement("div"));return e.className="buttons",t.append(e),b(this,ac,ep).call(this),t},rc=new WeakSet,tp=function(t,e){let s=0,i=0;for(const r of t){const a=r.y+r.height;if(a<s)continue;const o=r.x+(e?r.width:0);if(a>s){i=o,s=a;continue}e?o>i&&(i=o):o<i&&(i=o)}return[e?1-i:i,s]},ac=new WeakSet,ep=function(){const t=document.createElement("button");t.className="highlightButton",t.tabIndex=0,t.setAttribute("data-l10n-id","pdfjs-highlight-floating-button1");const e=document.createElement("span");t.append(e),e.className="visuallyHidden",e.setAttribute("data-l10n-id","pdfjs-highlight-floating-button-label");const s=n(this,Hi)._signal;t.addEventListener("contextmenu",Ue,{signal:s}),t.addEventListener("click",()=>{n(this,Hi).highlightSelection("floating_button")},{signal:s}),n(this,co).append(t)};function Xh(d,t,e){for(const s of e)t.addEventListener(s,d[s].bind(d))}var oc;class um{constructor(){f(this,oc,0)}get id(){return`${Wg}${$t(this,oc)._++}`}}oc=new WeakMap;var cr,uo,Dt,dr,Eh;const wf=class wf{constructor(){f(this,dr);f(this,cr,rm());f(this,uo,0);f(this,Dt,null)}static get _isSVGFittingCanvas(){const t='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>',s=new OffscreenCanvas(1,3).getContext("2d",{willReadFrequently:!0}),i=new Image;i.src=t;const r=i.decode().then(()=>(s.drawImage(i,0,0,1,1,0,0,1,3),new Uint32Array(s.getImageData(0,0,1,1).data.buffer)[0]===0));return G(this,"_isSVGFittingCanvas",r)}async getFromFile(t){const{lastModified:e,name:s,size:i,type:r}=t;return b(this,dr,Eh).call(this,`${e}_${s}_${i}_${r}`,t)}async getFromUrl(t){return b(this,dr,Eh).call(this,t,t)}async getFromBlob(t,e){const s=await e;return b(this,dr,Eh).call(this,t,s)}async getFromId(t){n(this,Dt)||g(this,Dt,new Map);const e=n(this,Dt).get(t);if(!e)return null;if(e.bitmap)return e.refCounter+=1,e;if(e.file)return this.getFromFile(e.file);if(e.blobPromise){const{blobPromise:s}=e;return delete e.blobPromise,this.getFromBlob(e.id,s)}return this.getFromUrl(e.url)}getFromCanvas(t,e){n(this,Dt)||g(this,Dt,new Map);let s=n(this,Dt).get(t);if(s!=null&&s.bitmap)return s.refCounter+=1,s;const i=new OffscreenCanvas(e.width,e.height);return i.getContext("2d").drawImage(e,0,0),s={bitmap:i.transferToImageBitmap(),id:`image_${n(this,cr)}_${$t(this,uo)._++}`,refCounter:1,isSvg:!1},n(this,Dt).set(t,s),n(this,Dt).set(s.id,s),s}getSvgUrl(t){const e=n(this,Dt).get(t);return e!=null&&e.isSvg?e.svgUrl:null}deleteId(t){var i;n(this,Dt)||g(this,Dt,new Map);const e=n(this,Dt).get(t);if(!e||(e.refCounter-=1,e.refCounter!==0))return;const{bitmap:s}=e;if(!e.url&&!e.file){const r=new OffscreenCanvas(s.width,s.height);r.getContext("bitmaprenderer").transferFromImageBitmap(s),e.blobPromise=r.convertToBlob()}(i=s.close)==null||i.call(s),e.bitmap=null}isValidId(t){return t.startsWith(`image_${n(this,cr)}_`)}};cr=new WeakMap,uo=new WeakMap,Dt=new WeakMap,dr=new WeakSet,Eh=async function(t,e){n(this,Dt)||g(this,Dt,new Map);let s=n(this,Dt).get(t);if(s===null)return null;if(s!=null&&s.bitmap)return s.refCounter+=1,s;try{s||(s={bitmap:null,id:`image_${n(this,cr)}_${$t(this,uo)._++}`,refCounter:0,isSvg:!1});let i;if(typeof e=="string"?(s.url=e,i=await Bd(e,"blob")):e instanceof File?i=s.file=e:e instanceof Blob&&(i=e),i.type==="image/svg+xml"){const r=wf._isSVGFittingCanvas,a=new FileReader,o=new Image,l=new Promise((h,c)=>{o.onload=()=>{s.bitmap=o,s.isSvg=!0,h()},a.onload=async()=>{const u=s.svgUrl=a.result;o.src=await r?`${u}#svgView(preserveAspectRatio(none))`:u},o.onerror=a.onerror=c});a.readAsDataURL(i),await l}else s.bitmap=await createImageBitmap(i);s.refCounter=1}catch(i){B(i),s=null}return n(this,Dt).set(t,s),s&&n(this,Dt).set(s.id,s),s};let iu=wf;var ht,Ys,fo,st;class fm{constructor(t=128){f(this,ht,[]);f(this,Ys,!1);f(this,fo,void 0);f(this,st,-1);g(this,fo,t)}add({cmd:t,undo:e,post:s,mustExec:i,type:r=NaN,overwriteIfSameType:a=!1,keepUndo:o=!1}){if(i&&t(),n(this,Ys))return;const l={cmd:t,undo:e,post:s,type:r};if(n(this,st)===-1){n(this,ht).length>0&&(n(this,ht).length=0),g(this,st,0),n(this,ht).push(l);return}if(a&&n(this,ht)[n(this,st)].type===r){o&&(l.undo=n(this,ht)[n(this,st)].undo),n(this,ht)[n(this,st)]=l;return}const h=n(this,st)+1;h===n(this,fo)?n(this,ht).splice(0,1):(g(this,st,h),h<n(this,ht).length&&n(this,ht).splice(h)),n(this,ht).push(l)}undo(){if(n(this,st)===-1)return;g(this,Ys,!0);const{undo:t,post:e}=n(this,ht)[n(this,st)];t(),e==null||e(),g(this,Ys,!1),g(this,st,n(this,st)-1)}redo(){if(n(this,st)<n(this,ht).length-1){g(this,st,n(this,st)+1),g(this,Ys,!0);const{cmd:t,post:e}=n(this,ht)[n(this,st)];t(),e==null||e(),g(this,Ys,!1)}}hasSomethingToUndo(){return n(this,st)!==-1}hasSomethingToRedo(){return n(this,st)<n(this,ht).length-1}cleanType(t){if(n(this,st)!==-1){for(let e=n(this,st);e>=0;e--)if(n(this,ht)[e].type!==t){n(this,ht).splice(e+1,n(this,st)-e),g(this,st,e);return}n(this,ht).length=0,g(this,st,-1)}}destroy(){g(this,ht,null)}}ht=new WeakMap,Ys=new WeakMap,fo=new WeakMap,st=new WeakMap;var lc,sp;class fh{constructor(t){f(this,lc);this.buffer=[],this.callbacks=new Map,this.allKeys=new Set;const{isMac:e}=Wt.platform;for(const[s,i,r={}]of t)for(const a of s){const o=a.startsWith("mac+");e&&o?(this.callbacks.set(a.slice(4),{callback:i,options:r}),this.allKeys.add(a.split("+").at(-1))):!e&&!o&&(this.callbacks.set(a,{callback:i,options:r}),this.allKeys.add(a.split("+").at(-1)))}}exec(t,e){if(!this.allKeys.has(e.key))return;const s=this.callbacks.get(b(this,lc,sp).call(this,e));if(!s)return;const{callback:i,options:{bubbles:r=!1,args:a=[],checker:o=null}}=s;o&&!o(t,e)||(i.bind(t,...a,e)(),r||ze(e))}}lc=new WeakSet,sp=function(t){t.altKey&&this.buffer.push("alt"),t.ctrlKey&&this.buffer.push("ctrl"),t.metaKey&&this.buffer.push("meta"),t.shiftKey&&this.buffer.push("shift"),this.buffer.push(t.key);const e=this.buffer.join("+");return this.buffer.length=0,e};const hc=class hc{get _colors(){const t=new Map([["CanvasText",null],["Canvas",null]]);return cm(t),G(this,"_colors",t)}convert(t){const e=mf(t);if(!window.matchMedia("(forced-colors: active)").matches)return e;for(const[s,i]of this._colors)if(i.every((r,a)=>r===e[a]))return hc._colorsMapping.get(s);return e}getHexCode(t){const e=this._colors.get(t);return e?M.makeHexColor(...e):t}};I(hc,"_colorsMapping",new Map([["CanvasText",[0,0,0]],["Canvas",[255,255,255]]]));let nu=hc;var ur,se,mt,St,fr,_s,pr,me,Ks,gr,Bi,Xe,Re,$i,po,go,mr,mo,Ye,Qs,br,Js,Ke,cc,Zs,bo,ti,Gi,Ao,_o,At,X,ys,zi,yo,wo,ei,Qe,ws,vo,be,Ar,Sh,Eo,ru,dc,ip,uc,np,_r,xh,fc,rp,pc,ap,gc,op,So,au,mc,lp,xo,ou,Co,lu,bc,hp,xt,Gt,Pe,gs,Ac,cp,_c,dp,To,hu,yc,up,Ui,$a,Ro,cu;const nr=class nr{constructor(t,e,s,i,r,a,o,l,h,c,u){f(this,Ar);f(this,Eo);f(this,dc);f(this,uc);f(this,_r);f(this,fc);f(this,pc);f(this,gc);f(this,So);f(this,mc);f(this,xo);f(this,Co);f(this,bc);f(this,xt);f(this,Pe);f(this,Ac);f(this,_c);f(this,To);f(this,yc);f(this,Ui);f(this,Ro);f(this,ur,new AbortController);f(this,se,null);f(this,mt,new Map);f(this,St,new Map);f(this,fr,null);f(this,_s,null);f(this,pr,null);f(this,me,new fm);f(this,Ks,null);f(this,gr,0);f(this,Bi,new Set);f(this,Xe,null);f(this,Re,null);f(this,$i,new Set);f(this,po,!1);f(this,go,!1);f(this,mr,!1);f(this,mo,null);f(this,Ye,null);f(this,Qs,null);f(this,br,null);f(this,Js,!1);f(this,Ke,null);f(this,cc,new um);f(this,Zs,!1);f(this,bo,!1);f(this,ti,null);f(this,Gi,null);f(this,Ao,null);f(this,_o,null);f(this,At,H.NONE);f(this,X,new Set);f(this,ys,null);f(this,zi,null);f(this,yo,null);f(this,wo,{isEditing:!1,isEmpty:!0,hasSomethingToUndo:!1,hasSomethingToRedo:!1,hasSelectedEditor:!1,hasSelectedText:!1});f(this,ei,[0,0]);f(this,Qe,null);f(this,ws,null);f(this,vo,null);f(this,be,null);const p=this._signal=n(this,ur).signal;g(this,ws,t),g(this,vo,e),g(this,fr,s),this._eventBus=i,i._on("editingaction",this.onEditingAction.bind(this),{signal:p}),i._on("pagechanging",this.onPageChanging.bind(this),{signal:p}),i._on("scalechanging",this.onScaleChanging.bind(this),{signal:p}),i._on("rotationchanging",this.onRotationChanging.bind(this),{signal:p}),i._on("setpreference",this.onSetPreference.bind(this),{signal:p}),i._on("switchannotationeditorparams",m=>this.updateParams(m.type,m.value),{signal:p}),b(this,fc,rp).call(this),b(this,bc,hp).call(this),b(this,So,au).call(this),g(this,_s,r.annotationStorage),g(this,mo,r.filterFactory),g(this,zi,a),g(this,br,o||null),g(this,po,l),g(this,go,h),g(this,mr,c),g(this,_o,u||null),this.viewParameters={realScale:Ri.PDF_TO_CSS_UNITS,rotation:0},this.isShiftKeyDown=!1}static get _keyboardManager(){const t=nr.prototype,e=a=>n(a,ws).contains(document.activeElement)&&document.activeElement.tagName!=="BUTTON"&&a.hasSomethingToControl(),s=(a,{target:o})=>{if(o instanceof HTMLInputElement){const{type:l}=o;return l!=="text"&&l!=="number"}return!0},i=this.TRANSLATE_SMALL,r=this.TRANSLATE_BIG;return G(this,"_keyboardManager",new fh([[["ctrl+a","mac+meta+a"],t.selectAll,{checker:s}],[["ctrl+z","mac+meta+z"],t.undo,{checker:s}],[["ctrl+y","ctrl+shift+z","mac+meta+shift+z","ctrl+shift+Z","mac+meta+shift+Z"],t.redo,{checker:s}],[["Backspace","alt+Backspace","ctrl+Backspace","shift+Backspace","mac+Backspace","mac+alt+Backspace","mac+ctrl+Backspace","Delete","ctrl+Delete","shift+Delete","mac+Delete"],t.delete,{checker:s}],[["Enter","mac+Enter"],t.addNewEditorFromKeyboard,{checker:(a,{target:o})=>!(o instanceof HTMLButtonElement)&&n(a,ws).contains(o)&&!a.isEnterHandled}],[[" ","mac+ "],t.addNewEditorFromKeyboard,{checker:(a,{target:o})=>!(o instanceof HTMLButtonElement)&&n(a,ws).contains(document.activeElement)}],[["Escape","mac+Escape"],t.unselectAll],[["ArrowLeft","mac+ArrowLeft"],t.translateSelectedEditors,{args:[-i,0],checker:e}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],t.translateSelectedEditors,{args:[-r,0],checker:e}],[["ArrowRight","mac+ArrowRight"],t.translateSelectedEditors,{args:[i,0],checker:e}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],t.translateSelectedEditors,{args:[r,0],checker:e}],[["ArrowUp","mac+ArrowUp"],t.translateSelectedEditors,{args:[0,-i],checker:e}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],t.translateSelectedEditors,{args:[0,-r],checker:e}],[["ArrowDown","mac+ArrowDown"],t.translateSelectedEditors,{args:[0,i],checker:e}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],t.translateSelectedEditors,{args:[0,r],checker:e}]]))}destroy(){var t,e,s,i;(t=n(this,be))==null||t.resolve(),g(this,be,null),(e=n(this,ur))==null||e.abort(),g(this,ur,null),this._signal=null;for(const r of n(this,St).values())r.destroy();n(this,St).clear(),n(this,mt).clear(),n(this,$i).clear(),g(this,se,null),n(this,X).clear(),n(this,me).destroy(),(s=n(this,fr))==null||s.destroy(),(i=n(this,Ke))==null||i.hide(),g(this,Ke,null),n(this,Ye)&&(clearTimeout(n(this,Ye)),g(this,Ye,null)),n(this,Qe)&&(clearTimeout(n(this,Qe)),g(this,Qe,null))}combinedSignal(t){return AbortSignal.any([this._signal,t.signal])}get mlManager(){return n(this,_o)}get useNewAltTextFlow(){return n(this,go)}get useNewAltTextWhenAddingImage(){return n(this,mr)}get hcmFilter(){return G(this,"hcmFilter",n(this,zi)?n(this,mo).addHCMFilter(n(this,zi).foreground,n(this,zi).background):"none")}get direction(){return G(this,"direction",getComputedStyle(n(this,ws)).direction)}get highlightColors(){return G(this,"highlightColors",n(this,br)?new Map(n(this,br).split(",").map(t=>t.split("=").map(e=>e.trim()))):null)}get highlightColorNames(){return G(this,"highlightColorNames",this.highlightColors?new Map(Array.from(this.highlightColors,t=>t.reverse())):null)}setMainHighlightColorPicker(t){g(this,Ao,t)}editAltText(t,e=!1){var s;(s=n(this,fr))==null||s.editAltText(this,t,e)}switchToMode(t,e){this._eventBus.on("annotationeditormodechanged",e,{once:!0,signal:this._signal}),this._eventBus.dispatch("showannotationeditorui",{source:this,mode:t})}setPreference(t,e){this._eventBus.dispatch("setpreference",{source:this,name:t,value:e})}onSetPreference({name:t,value:e}){switch(t){case"enableNewAltTextWhenAddingImage":g(this,mr,e);break}}onPageChanging({pageNumber:t}){g(this,gr,t-1)}focusMainContainer(){n(this,ws).focus()}findParent(t,e){for(const s of n(this,St).values()){const{x:i,y:r,width:a,height:o}=s.div.getBoundingClientRect();if(t>=i&&t<=i+a&&e>=r&&e<=r+o)return s}return null}disableUserSelect(t=!1){n(this,vo).classList.toggle("noUserSelect",t)}addShouldRescale(t){n(this,$i).add(t)}removeShouldRescale(t){n(this,$i).delete(t)}onScaleChanging({scale:t}){var e;this.commitOrRemove(),this.viewParameters.realScale=t*Ri.PDF_TO_CSS_UNITS;for(const s of n(this,$i))s.onScaleChanging();(e=this.currentLayer)==null||e.onScaleChanging()}onRotationChanging({pagesRotation:t}){this.commitOrRemove(),this.viewParameters.rotation=t}highlightSelection(t=""){const e=document.getSelection();if(!e||e.isCollapsed)return;const{anchorNode:s,anchorOffset:i,focusNode:r,focusOffset:a}=e,o=e.toString(),h=b(this,Ar,Sh).call(this,e).closest(".textLayer"),c=this.getSelectionBoxes(h);if(!c)return;e.empty();const u=b(this,Eo,ru).call(this,h),p=n(this,At)===H.NONE,m=()=>{u==null||u.createAndAddNewEditor({x:0,y:0},!1,{methodOfCreation:t,boxes:c,anchorNode:s,anchorOffset:i,focusNode:r,focusOffset:a,text:o}),p&&this.showAllEditors("highlight",!0,!0)};if(p){this.switchToMode(H.HIGHLIGHT,m);return}m()}addToAnnotationStorage(t){!t.isEmpty()&&n(this,_s)&&!n(this,_s).has(t.id)&&n(this,_s).setValue(t.id,t)}blur(){if(this.isShiftKeyDown=!1,n(this,Js)&&(g(this,Js,!1),b(this,_r,xh).call(this,"main_toolbar")),!this.hasSelection)return;const{activeElement:t}=document;for(const e of n(this,X))if(e.div.contains(t)){g(this,Gi,[e,t]),e._focusEventsAllowed=!1;break}}focus(){if(!n(this,Gi))return;const[t,e]=n(this,Gi);g(this,Gi,null),e.addEventListener("focusin",()=>{t._focusEventsAllowed=!0},{once:!0,signal:this._signal}),e.focus()}addEditListeners(){b(this,So,au).call(this),b(this,xo,ou).call(this)}removeEditListeners(){b(this,mc,lp).call(this),b(this,Co,lu).call(this)}dragOver(t){for(const{type:e}of t.dataTransfer.items)for(const s of n(this,Re))if(s.isHandlingMimeForPasting(e)){t.dataTransfer.dropEffect="copy",t.preventDefault();return}}drop(t){for(const e of t.dataTransfer.items)for(const s of n(this,Re))if(s.isHandlingMimeForPasting(e.type)){s.paste(e,this.currentLayer),t.preventDefault();return}}copy(t){var s;if(t.preventDefault(),(s=n(this,se))==null||s.commitOrRemove(),!this.hasSelection)return;const e=[];for(const i of n(this,X)){const r=i.serialize(!0);r&&e.push(r)}e.length!==0&&t.clipboardData.setData("application/pdfjs",JSON.stringify(e))}cut(t){this.copy(t),this.delete()}async paste(t){t.preventDefault();const{clipboardData:e}=t;for(const r of e.items)for(const a of n(this,Re))if(a.isHandlingMimeForPasting(r.type)){a.paste(r,this.currentLayer);return}let s=e.getData("application/pdfjs");if(!s)return;try{s=JSON.parse(s)}catch(r){B(`paste: "${r.message}".`);return}if(!Array.isArray(s))return;this.unselectAll();const i=this.currentLayer;try{const r=[];for(const l of s){const h=await i.deserialize(l);if(!h)return;r.push(h)}const a=()=>{for(const l of r)b(this,To,hu).call(this,l);b(this,Ro,cu).call(this,r)},o=()=>{for(const l of r)l.remove()};this.addCommands({cmd:a,undo:o,mustExec:!0})}catch(r){B(`paste: "${r.message}".`)}}keydown(t){!this.isShiftKeyDown&&t.key==="Shift"&&(this.isShiftKeyDown=!0),n(this,At)!==H.NONE&&!this.isEditorHandlingKeyboard&&nr._keyboardManager.exec(this,t)}keyup(t){this.isShiftKeyDown&&t.key==="Shift"&&(this.isShiftKeyDown=!1,n(this,Js)&&(g(this,Js,!1),b(this,_r,xh).call(this,"main_toolbar")))}onEditingAction({name:t}){switch(t){case"undo":case"redo":case"delete":case"selectAll":this[t]();break;case"highlightSelection":this.highlightSelection("context_menu");break}}setEditingState(t){t?(b(this,pc,ap).call(this),b(this,xo,ou).call(this),b(this,xt,Gt).call(this,{isEditing:n(this,At)!==H.NONE,isEmpty:b(this,Ui,$a).call(this),hasSomethingToUndo:n(this,me).hasSomethingToUndo(),hasSomethingToRedo:n(this,me).hasSomethingToRedo(),hasSelectedEditor:!1})):(b(this,gc,op).call(this),b(this,Co,lu).call(this),b(this,xt,Gt).call(this,{isEditing:!1}),this.disableUserSelect(!1))}registerEditorTypes(t){if(!n(this,Re)){g(this,Re,t);for(const e of n(this,Re))b(this,Pe,gs).call(this,e.defaultPropertiesToUpdate)}}getId(){return n(this,cc).id}get currentLayer(){return n(this,St).get(n(this,gr))}getLayer(t){return n(this,St).get(t)}get currentPageIndex(){return n(this,gr)}addLayer(t){n(this,St).set(t.pageIndex,t),n(this,Zs)?t.enable():t.disable()}removeLayer(t){n(this,St).delete(t.pageIndex)}async updateMode(t,e=null,s=!1){if(n(this,At)!==t&&!(n(this,be)&&(await n(this,be).promise,!n(this,be)))){if(g(this,be,Promise.withResolvers()),g(this,At,t),t===H.NONE){this.setEditingState(!1),b(this,_c,dp).call(this),n(this,be).resolve();return}this.setEditingState(!0),await b(this,Ac,cp).call(this),this.unselectAll();for(const i of n(this,St).values())i.updateMode(t);if(!e){s&&this.addNewEditorFromKeyboard(),n(this,be).resolve();return}for(const i of n(this,mt).values())i.annotationElementId===e?(this.setSelected(i),i.enterInEditMode()):i.unselect();n(this,be).resolve()}}addNewEditorFromKeyboard(){this.currentLayer.canCreateNewEmptyEditor()&&this.currentLayer.addNewEditor()}updateToolbar(t){t!==n(this,At)&&this._eventBus.dispatch("switchannotationeditormode",{source:this,mode:t})}updateParams(t,e){var s;if(n(this,Re)){switch(t){case z.CREATE:this.currentLayer.addNewEditor();return;case z.HIGHLIGHT_DEFAULT_COLOR:(s=n(this,Ao))==null||s.updateColor(e);break;case z.HIGHLIGHT_SHOW_ALL:this._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:{type:"highlight",action:"toggle_visibility"}}}),(n(this,yo)||g(this,yo,new Map)).set(t,e),this.showAllEditors("highlight",e);break}for(const i of n(this,X))i.updateParams(t,e);for(const i of n(this,Re))i.updateDefaultParams(t,e)}}showAllEditors(t,e,s=!1){var r;for(const a of n(this,mt).values())a.editorType===t&&a.show(e);(((r=n(this,yo))==null?void 0:r.get(z.HIGHLIGHT_SHOW_ALL))??!0)!==e&&b(this,Pe,gs).call(this,[[z.HIGHLIGHT_SHOW_ALL,e]])}enableWaiting(t=!1){if(n(this,bo)!==t){g(this,bo,t);for(const e of n(this,St).values())t?e.disableClick():e.enableClick(),e.div.classList.toggle("waiting",t)}}getEditors(t){const e=[];for(const s of n(this,mt).values())s.pageIndex===t&&e.push(s);return e}getEditor(t){return n(this,mt).get(t)}addEditor(t){n(this,mt).set(t.id,t)}removeEditor(t){var e;t.div.contains(document.activeElement)&&(n(this,Ye)&&clearTimeout(n(this,Ye)),g(this,Ye,setTimeout(()=>{this.focusMainContainer(),g(this,Ye,null)},0))),n(this,mt).delete(t.id),this.unselect(t),(!t.annotationElementId||!n(this,Bi).has(t.annotationElementId))&&((e=n(this,_s))==null||e.remove(t.id))}addDeletedAnnotationElement(t){n(this,Bi).add(t.annotationElementId),this.addChangedExistingAnnotation(t),t.deleted=!0}isDeletedAnnotationElement(t){return n(this,Bi).has(t)}removeDeletedAnnotationElement(t){n(this,Bi).delete(t.annotationElementId),this.removeChangedExistingAnnotation(t),t.deleted=!1}setActiveEditor(t){n(this,se)!==t&&(g(this,se,t),t&&b(this,Pe,gs).call(this,t.propertiesToUpdate))}updateUI(t){n(this,yc,up)===t&&b(this,Pe,gs).call(this,t.propertiesToUpdate)}updateUIForDefaultProperties(t){b(this,Pe,gs).call(this,t.defaultPropertiesToUpdate)}toggleSelected(t){if(n(this,X).has(t)){n(this,X).delete(t),t.unselect(),b(this,xt,Gt).call(this,{hasSelectedEditor:this.hasSelection});return}n(this,X).add(t),t.select(),b(this,Pe,gs).call(this,t.propertiesToUpdate),b(this,xt,Gt).call(this,{hasSelectedEditor:!0})}setSelected(t){var e;(e=this.currentLayer)==null||e.commitOrRemove();for(const s of n(this,X))s!==t&&s.unselect();n(this,X).clear(),n(this,X).add(t),t.select(),b(this,Pe,gs).call(this,t.propertiesToUpdate),b(this,xt,Gt).call(this,{hasSelectedEditor:!0})}isSelected(t){return n(this,X).has(t)}get firstSelectedEditor(){return n(this,X).values().next().value}unselect(t){t.unselect(),n(this,X).delete(t),b(this,xt,Gt).call(this,{hasSelectedEditor:this.hasSelection})}get hasSelection(){return n(this,X).size!==0}get isEnterHandled(){return n(this,X).size===1&&this.firstSelectedEditor.isEnterHandled}undo(){n(this,me).undo(),b(this,xt,Gt).call(this,{hasSomethingToUndo:n(this,me).hasSomethingToUndo(),hasSomethingToRedo:!0,isEmpty:b(this,Ui,$a).call(this)})}redo(){n(this,me).redo(),b(this,xt,Gt).call(this,{hasSomethingToUndo:!0,hasSomethingToRedo:n(this,me).hasSomethingToRedo(),isEmpty:b(this,Ui,$a).call(this)})}addCommands(t){n(this,me).add(t),b(this,xt,Gt).call(this,{hasSomethingToUndo:!0,hasSomethingToRedo:!1,isEmpty:b(this,Ui,$a).call(this)})}cleanUndoStack(t){n(this,me).cleanType(t)}delete(){var r;this.commitOrRemove();const t=(r=this.currentLayer)==null?void 0:r.endDrawingSession(!0);if(!this.hasSelection&&!t)return;const e=t?[t]:[...n(this,X)],s=()=>{for(const a of e)a.remove()},i=()=>{for(const a of e)b(this,To,hu).call(this,a)};this.addCommands({cmd:s,undo:i,mustExec:!0})}commitOrRemove(){var t;(t=n(this,se))==null||t.commitOrRemove()}hasSomethingToControl(){return n(this,se)||this.hasSelection}selectAll(){for(const t of n(this,X))t.commit();b(this,Ro,cu).call(this,n(this,mt).values())}unselectAll(){var t;if(!(n(this,se)&&(n(this,se).commitOrRemove(),n(this,At)!==H.NONE))&&!((t=this.currentLayer)!=null&&t.commitOrRemove())&&this.hasSelection){for(const e of n(this,X))e.unselect();n(this,X).clear(),b(this,xt,Gt).call(this,{hasSelectedEditor:!1})}}translateSelectedEditors(t,e,s=!1){if(s||this.commitOrRemove(),!this.hasSelection)return;n(this,ei)[0]+=t,n(this,ei)[1]+=e;const[i,r]=n(this,ei),a=[...n(this,X)],o=1e3;n(this,Qe)&&clearTimeout(n(this,Qe)),g(this,Qe,setTimeout(()=>{g(this,Qe,null),n(this,ei)[0]=n(this,ei)[1]=0,this.addCommands({cmd:()=>{for(const l of a)n(this,mt).has(l.id)&&l.translateInPage(i,r)},undo:()=>{for(const l of a)n(this,mt).has(l.id)&&l.translateInPage(-i,-r)},mustExec:!1})},o));for(const l of a)l.translateInPage(t,e)}setUpDragSession(){if(this.hasSelection){this.disableUserSelect(!0),g(this,Xe,new Map);for(const t of n(this,X))n(this,Xe).set(t,{savedX:t.x,savedY:t.y,savedPageIndex:t.pageIndex,newX:0,newY:0,newPageIndex:-1})}}endDragSession(){if(!n(this,Xe))return!1;this.disableUserSelect(!1);const t=n(this,Xe);g(this,Xe,null);let e=!1;for(const[{x:i,y:r,pageIndex:a},o]of t)o.newX=i,o.newY=r,o.newPageIndex=a,e||(e=i!==o.savedX||r!==o.savedY||a!==o.savedPageIndex);if(!e)return!1;const s=(i,r,a,o)=>{if(n(this,mt).has(i.id)){const l=n(this,St).get(o);l?i._setParentAndPosition(l,r,a):(i.pageIndex=o,i.x=r,i.y=a)}};return this.addCommands({cmd:()=>{for(const[i,{newX:r,newY:a,newPageIndex:o}]of t)s(i,r,a,o)},undo:()=>{for(const[i,{savedX:r,savedY:a,savedPageIndex:o}]of t)s(i,r,a,o)},mustExec:!0}),!0}dragSelectedEditors(t,e){if(n(this,Xe))for(const s of n(this,Xe).keys())s.drag(t,e)}rebuild(t){if(t.parent===null){const e=this.getLayer(t.pageIndex);e?(e.changeParent(t),e.addOrRebuild(t)):(this.addEditor(t),this.addToAnnotationStorage(t),t.rebuild())}else t.parent.addOrRebuild(t)}get isEditorHandlingKeyboard(){var t;return((t=this.getActive())==null?void 0:t.shouldGetKeyboardEvents())||n(this,X).size===1&&this.firstSelectedEditor.shouldGetKeyboardEvents()}isActive(t){return n(this,se)===t}getActive(){return n(this,se)}getMode(){return n(this,At)}get imageManager(){return G(this,"imageManager",new iu)}getSelectionBoxes(t){if(!t)return null;const e=document.getSelection();for(let h=0,c=e.rangeCount;h<c;h++)if(!t.contains(e.getRangeAt(h).commonAncestorContainer))return null;const{x:s,y:i,width:r,height:a}=t.getBoundingClientRect();let o;switch(t.getAttribute("data-main-rotation")){case"90":o=(h,c,u,p)=>({x:(c-i)/a,y:1-(h+u-s)/r,width:p/a,height:u/r});break;case"180":o=(h,c,u,p)=>({x:1-(h+u-s)/r,y:1-(c+p-i)/a,width:u/r,height:p/a});break;case"270":o=(h,c,u,p)=>({x:1-(c+p-i)/a,y:(h-s)/r,width:p/a,height:u/r});break;default:o=(h,c,u,p)=>({x:(h-s)/r,y:(c-i)/a,width:u/r,height:p/a});break}const l=[];for(let h=0,c=e.rangeCount;h<c;h++){const u=e.getRangeAt(h);if(!u.collapsed)for(const{x:p,y:m,width:A,height:_}of u.getClientRects())A===0||_===0||l.push(o(p,m,A,_))}return l.length===0?null:l}addChangedExistingAnnotation({annotationElementId:t,id:e}){(n(this,pr)||g(this,pr,new Map)).set(t,e)}removeChangedExistingAnnotation({annotationElementId:t}){var e;(e=n(this,pr))==null||e.delete(t)}renderAnnotationElement(t){var i;const e=(i=n(this,pr))==null?void 0:i.get(t.data.id);if(!e)return;const s=n(this,_s).getRawValue(e);s&&(n(this,At)===H.NONE&&!s.hasBeenModified||s.renderAnnotationElement(t))}};ur=new WeakMap,se=new WeakMap,mt=new WeakMap,St=new WeakMap,fr=new WeakMap,_s=new WeakMap,pr=new WeakMap,me=new WeakMap,Ks=new WeakMap,gr=new WeakMap,Bi=new WeakMap,Xe=new WeakMap,Re=new WeakMap,$i=new WeakMap,po=new WeakMap,go=new WeakMap,mr=new WeakMap,mo=new WeakMap,Ye=new WeakMap,Qs=new WeakMap,br=new WeakMap,Js=new WeakMap,Ke=new WeakMap,cc=new WeakMap,Zs=new WeakMap,bo=new WeakMap,ti=new WeakMap,Gi=new WeakMap,Ao=new WeakMap,_o=new WeakMap,At=new WeakMap,X=new WeakMap,ys=new WeakMap,zi=new WeakMap,yo=new WeakMap,wo=new WeakMap,ei=new WeakMap,Qe=new WeakMap,ws=new WeakMap,vo=new WeakMap,be=new WeakMap,Ar=new WeakSet,Sh=function({anchorNode:t}){return t.nodeType===Node.TEXT_NODE?t.parentElement:t},Eo=new WeakSet,ru=function(t){const{currentLayer:e}=this;if(e.hasTextLayer(t))return e;for(const s of n(this,St).values())if(s.hasTextLayer(t))return s;return null},dc=new WeakSet,ip=function(){const t=document.getSelection();if(!t||t.isCollapsed)return;const s=b(this,Ar,Sh).call(this,t).closest(".textLayer"),i=this.getSelectionBoxes(s);i&&(n(this,Ke)||g(this,Ke,new dm(this)),n(this,Ke).show(s,i,this.direction==="ltr"))},uc=new WeakSet,np=function(){var r,a,o;const t=document.getSelection();if(!t||t.isCollapsed){n(this,ys)&&((r=n(this,Ke))==null||r.hide(),g(this,ys,null),b(this,xt,Gt).call(this,{hasSelectedText:!1}));return}const{anchorNode:e}=t;if(e===n(this,ys))return;const i=b(this,Ar,Sh).call(this,t).closest(".textLayer");if(!i){n(this,ys)&&((a=n(this,Ke))==null||a.hide(),g(this,ys,null),b(this,xt,Gt).call(this,{hasSelectedText:!1}));return}if((o=n(this,Ke))==null||o.hide(),g(this,ys,e),b(this,xt,Gt).call(this,{hasSelectedText:!0}),!(n(this,At)!==H.HIGHLIGHT&&n(this,At)!==H.NONE)&&(n(this,At)===H.HIGHLIGHT&&this.showAllEditors("highlight",!0,!0),g(this,Js,this.isShiftKeyDown),!this.isShiftKeyDown)){const l=n(this,At)===H.HIGHLIGHT?b(this,Eo,ru).call(this,i):null;l==null||l.toggleDrawing();const h=new AbortController,c=this.combinedSignal(h),u=p=>{p.type==="pointerup"&&p.button!==0||(h.abort(),l==null||l.toggleDrawing(!0),p.type==="pointerup"&&b(this,_r,xh).call(this,"main_toolbar"))};window.addEventListener("pointerup",u,{signal:c}),window.addEventListener("blur",u,{signal:c})}},_r=new WeakSet,xh=function(t=""){n(this,At)===H.HIGHLIGHT?this.highlightSelection(t):n(this,po)&&b(this,dc,ip).call(this)},fc=new WeakSet,rp=function(){document.addEventListener("selectionchange",b(this,uc,np).bind(this),{signal:this._signal})},pc=new WeakSet,ap=function(){if(n(this,Qs))return;g(this,Qs,new AbortController);const t=this.combinedSignal(n(this,Qs));window.addEventListener("focus",this.focus.bind(this),{signal:t}),window.addEventListener("blur",this.blur.bind(this),{signal:t})},gc=new WeakSet,op=function(){var t;(t=n(this,Qs))==null||t.abort(),g(this,Qs,null)},So=new WeakSet,au=function(){if(n(this,ti))return;g(this,ti,new AbortController);const t=this.combinedSignal(n(this,ti));window.addEventListener("keydown",this.keydown.bind(this),{signal:t}),window.addEventListener("keyup",this.keyup.bind(this),{signal:t})},mc=new WeakSet,lp=function(){var t;(t=n(this,ti))==null||t.abort(),g(this,ti,null)},xo=new WeakSet,ou=function(){if(n(this,Ks))return;g(this,Ks,new AbortController);const t=this.combinedSignal(n(this,Ks));document.addEventListener("copy",this.copy.bind(this),{signal:t}),document.addEventListener("cut",this.cut.bind(this),{signal:t}),document.addEventListener("paste",this.paste.bind(this),{signal:t})},Co=new WeakSet,lu=function(){var t;(t=n(this,Ks))==null||t.abort(),g(this,Ks,null)},bc=new WeakSet,hp=function(){const t=this._signal;document.addEventListener("dragover",this.dragOver.bind(this),{signal:t}),document.addEventListener("drop",this.drop.bind(this),{signal:t})},xt=new WeakSet,Gt=function(t){Object.entries(t).some(([s,i])=>n(this,wo)[s]!==i)&&(this._eventBus.dispatch("annotationeditorstateschanged",{source:this,details:Object.assign(n(this,wo),t)}),n(this,At)===H.HIGHLIGHT&&t.hasSelectedEditor===!1&&b(this,Pe,gs).call(this,[[z.HIGHLIGHT_FREE,!0]]))},Pe=new WeakSet,gs=function(t){this._eventBus.dispatch("annotationeditorparamschanged",{source:this,details:t})},Ac=new WeakSet,cp=async function(){if(!n(this,Zs)){g(this,Zs,!0);const t=[];for(const e of n(this,St).values())t.push(e.enable());await Promise.all(t);for(const e of n(this,mt).values())e.enable()}},_c=new WeakSet,dp=function(){if(this.unselectAll(),n(this,Zs)){g(this,Zs,!1);for(const t of n(this,St).values())t.disable();for(const t of n(this,mt).values())t.disable()}},To=new WeakSet,hu=function(t){const e=n(this,St).get(t.pageIndex);e?e.addOrRebuild(t):(this.addEditor(t),this.addToAnnotationStorage(t))},yc=new WeakSet,up=function(){let t=null;for(t of n(this,X));return t},Ui=new WeakSet,$a=function(){if(n(this,mt).size===0)return!0;if(n(this,mt).size===1)for(const t of n(this,mt).values())return t.isEmpty();return!1},Ro=new WeakSet,cu=function(t){for(const e of n(this,X))e.unselect();n(this,X).clear();for(const e of t)e.isEmpty()||(n(this,X).add(e),e.select());b(this,xt,Gt).call(this,{hasSelectedEditor:this.hasSelection})},I(nr,"TRANSLATE_SMALL",1),I(nr,"TRANSLATE_BIG",10);let jn=nr;var _t,Je,ke,yr,Ze,ie,wr,ts,Kt,vs,Vi,es,si,ji,Ga,vr,Ch;const zt=class zt{constructor(t){f(this,ji);f(this,vr);f(this,_t,null);f(this,Je,!1);f(this,ke,null);f(this,yr,null);f(this,Ze,null);f(this,ie,null);f(this,wr,!1);f(this,ts,null);f(this,Kt,null);f(this,vs,null);f(this,Vi,null);f(this,es,!1);g(this,Kt,t),g(this,es,t._uiManager.useNewAltTextFlow),n(zt,si)||g(zt,si,Object.freeze({added:"pdfjs-editor-new-alt-text-added-button","added-label":"pdfjs-editor-new-alt-text-added-button-label",missing:"pdfjs-editor-new-alt-text-missing-button","missing-label":"pdfjs-editor-new-alt-text-missing-button-label",review:"pdfjs-editor-new-alt-text-to-review-button","review-label":"pdfjs-editor-new-alt-text-to-review-button-label"}))}static initialize(t){zt._l10n??(zt._l10n=t)}async render(){const t=g(this,ke,document.createElement("button"));t.className="altText",t.tabIndex="0";const e=g(this,yr,document.createElement("span"));t.append(e),n(this,es)?(t.classList.add("new"),t.setAttribute("data-l10n-id",n(zt,si).missing),e.setAttribute("data-l10n-id",n(zt,si)["missing-label"])):(t.setAttribute("data-l10n-id","pdfjs-editor-alt-text-button"),e.setAttribute("data-l10n-id","pdfjs-editor-alt-text-button-label"));const s=n(this,Kt)._uiManager._signal;t.addEventListener("contextmenu",Ue,{signal:s}),t.addEventListener("pointerdown",r=>r.stopPropagation(),{signal:s});const i=r=>{r.preventDefault(),n(this,Kt)._uiManager.editAltText(n(this,Kt)),n(this,es)&&n(this,Kt)._reportTelemetry({action:"pdfjs.image.alt_text.image_status_label_clicked",data:{label:n(this,ji,Ga)}})};return t.addEventListener("click",i,{capture:!0,signal:s}),t.addEventListener("keydown",r=>{r.target===t&&r.key==="Enter"&&(g(this,wr,!0),i(r))},{signal:s}),await b(this,vr,Ch).call(this),t}finish(){n(this,ke)&&(n(this,ke).focus({focusVisible:n(this,wr)}),g(this,wr,!1))}isEmpty(){return n(this,es)?n(this,_t)===null:!n(this,_t)&&!n(this,Je)}hasData(){return n(this,es)?n(this,_t)!==null||!!n(this,vs):this.isEmpty()}get guessedText(){return n(this,vs)}async setGuessedText(t){n(this,_t)===null&&(g(this,vs,t),g(this,Vi,await zt._l10n.get("pdfjs-editor-new-alt-text-generated-alt-text-with-disclaimer",{generatedAltText:t})),b(this,vr,Ch).call(this))}toggleAltTextBadge(t=!1){var e;if(!n(this,es)||n(this,_t)){(e=n(this,ts))==null||e.remove(),g(this,ts,null);return}if(!n(this,ts)){const s=g(this,ts,document.createElement("div"));s.className="noAltTextBadge",n(this,Kt).div.append(s)}n(this,ts).classList.toggle("hidden",!t)}serialize(t){let e=n(this,_t);return!t&&n(this,vs)===e&&(e=n(this,Vi)),{altText:e,decorative:n(this,Je),guessedText:n(this,vs),textWithDisclaimer:n(this,Vi)}}get data(){return{altText:n(this,_t),decorative:n(this,Je)}}set data({altText:t,decorative:e,guessedText:s,textWithDisclaimer:i,cancel:r=!1}){s&&(g(this,vs,s),g(this,Vi,i)),!(n(this,_t)===t&&n(this,Je)===e)&&(r||(g(this,_t,t),g(this,Je,e)),b(this,vr,Ch).call(this))}toggle(t=!1){n(this,ke)&&(!t&&n(this,ie)&&(clearTimeout(n(this,ie)),g(this,ie,null)),n(this,ke).disabled=!t)}shown(){n(this,Kt)._reportTelemetry({action:"pdfjs.image.alt_text.image_status_label_displayed",data:{label:n(this,ji,Ga)}})}destroy(){var t,e;(t=n(this,ke))==null||t.remove(),g(this,ke,null),g(this,yr,null),g(this,Ze,null),(e=n(this,ts))==null||e.remove(),g(this,ts,null)}};_t=new WeakMap,Je=new WeakMap,ke=new WeakMap,yr=new WeakMap,Ze=new WeakMap,ie=new WeakMap,wr=new WeakMap,ts=new WeakMap,Kt=new WeakMap,vs=new WeakMap,Vi=new WeakMap,es=new WeakMap,si=new WeakMap,ji=new WeakSet,Ga=function(){return n(this,_t)&&"added"||n(this,_t)===null&&this.guessedText&&"review"||"missing"},vr=new WeakSet,Ch=async function(){var i,r,a;const t=n(this,ke);if(!t)return;if(n(this,es)){if(t.classList.toggle("done",!!n(this,_t)),t.setAttribute("data-l10n-id",n(zt,si)[n(this,ji,Ga)]),(i=n(this,yr))==null||i.setAttribute("data-l10n-id",n(zt,si)[`${n(this,ji,Ga)}-label`]),!n(this,_t)){(r=n(this,Ze))==null||r.remove();return}}else{if(!n(this,_t)&&!n(this,Je)){t.classList.remove("done"),(a=n(this,Ze))==null||a.remove();return}t.classList.add("done"),t.setAttribute("data-l10n-id","pdfjs-editor-alt-text-edit-button")}let e=n(this,Ze);if(!e){g(this,Ze,e=document.createElement("span")),e.className="tooltip",e.setAttribute("role","tooltip"),e.id=`alt-text-tooltip-${n(this,Kt).id}`;const o=100,l=n(this,Kt)._uiManager._signal;l.addEventListener("abort",()=>{clearTimeout(n(this,ie)),g(this,ie,null)},{once:!0}),t.addEventListener("mouseenter",()=>{g(this,ie,setTimeout(()=>{g(this,ie,null),n(this,Ze).classList.add("show"),n(this,Kt)._reportTelemetry({action:"alt_text_tooltip"})},o))},{signal:l}),t.addEventListener("mouseleave",()=>{var h;n(this,ie)&&(clearTimeout(n(this,ie)),g(this,ie,null)),(h=n(this,Ze))==null||h.classList.remove("show")},{signal:l})}n(this,Je)?e.setAttribute("data-l10n-id","pdfjs-editor-alt-text-decorative-tooltip"):(e.removeAttribute("data-l10n-id"),e.textContent=n(this,_t)),e.parentNode||t.append(e);const s=n(this,Kt).getImageForAltText();s==null||s.setAttribute("aria-describedby",e.id)},f(zt,si,null),I(zt,"_l10n",null);let Yh=zt;var Wi,Me,it,Er,ii,Po,qi,Ct,Xi,ni,ri,ko,Yi,ai,Mo,Ki,Es,ss,Sr,xr,Ae,Lo,wc,Io,du,Do,uu,Fo,fu,vc,fp,Ec,pp,Oo,pu,No,gu,Ho,mu,Bo,bu,Sc,gp,$o,Au,xc,mp,Cc,bp,Tc,Ap,Go,_u,Qi,za;const W=class W{constructor(t){f(this,Io);f(this,Fo);f(this,vc);f(this,Ec);f(this,Oo);f(this,No);f(this,Ho);f(this,Bo);f(this,Sc);f(this,$o);f(this,xc);f(this,Cc);f(this,Tc);f(this,Go);f(this,Qi);f(this,Wi,null);f(this,Me,null);f(this,it,null);f(this,Er,!1);f(this,ii,null);f(this,Po,"");f(this,qi,!1);f(this,Ct,null);f(this,Xi,null);f(this,ni,null);f(this,ri,null);f(this,ko,"");f(this,Yi,!1);f(this,ai,null);f(this,Mo,!1);f(this,Ki,!1);f(this,Es,!1);f(this,ss,null);f(this,Sr,0);f(this,xr,0);f(this,Ae,null);I(this,"_editToolbar",null);I(this,"_initialOptions",Object.create(null));I(this,"_initialData",null);I(this,"_isVisible",!0);I(this,"_uiManager",null);I(this,"_focusEventsAllowed",!0);f(this,Lo,!1);f(this,wc,W._zIndex++);this.parent=t.parent,this.id=t.id,this.width=this.height=null,this.pageIndex=t.parent.pageIndex,this.name=t.name,this.div=null,this._uiManager=t.uiManager,this.annotationElementId=null,this._willKeepAspectRatio=!1,this._initialOptions.isCentered=t.isCentered,this._structTreeParentId=null;const{rotation:e,rawDims:{pageWidth:s,pageHeight:i,pageX:r,pageY:a}}=this.parent.viewport;this.rotation=e,this.pageRotation=(360+e-this._uiManager.viewParameters.rotation)%360,this.pageDimensions=[s,i],this.pageTranslation=[r,a];const[o,l]=this.parentDimensions;this.x=t.x/o,this.y=t.y/l,this.isAttachedToDOM=!1,this.deleted=!1}static get _resizerKeyboardManager(){const t=W.prototype._resizeWithKeyboard,e=jn.TRANSLATE_SMALL,s=jn.TRANSLATE_BIG;return G(this,"_resizerKeyboardManager",new fh([[["ArrowLeft","mac+ArrowLeft"],t,{args:[-e,0]}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],t,{args:[-s,0]}],[["ArrowRight","mac+ArrowRight"],t,{args:[e,0]}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],t,{args:[s,0]}],[["ArrowUp","mac+ArrowUp"],t,{args:[0,-e]}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],t,{args:[0,-s]}],[["ArrowDown","mac+ArrowDown"],t,{args:[0,e]}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],t,{args:[0,s]}],[["Escape","mac+Escape"],W.prototype._stopResizingWithKeyboard]]))}get editorType(){return Object.getPrototypeOf(this).constructor._type}static get isDrawer(){return!1}static get _defaultLineColor(){return G(this,"_defaultLineColor",this._colorManager.getHexCode("CanvasText"))}static deleteAnnotationElement(t){const e=new pm({id:t.parent.getNextId(),parent:t.parent,uiManager:t._uiManager});e.annotationElementId=t.annotationElementId,e.deleted=!0,e._uiManager.addToAnnotationStorage(e)}static initialize(t,e){if(W._l10n??(W._l10n=t),W._l10nResizer||(W._l10nResizer=Object.freeze({topLeft:"pdfjs-editor-resizer-top-left",topMiddle:"pdfjs-editor-resizer-top-middle",topRight:"pdfjs-editor-resizer-top-right",middleRight:"pdfjs-editor-resizer-middle-right",bottomRight:"pdfjs-editor-resizer-bottom-right",bottomMiddle:"pdfjs-editor-resizer-bottom-middle",bottomLeft:"pdfjs-editor-resizer-bottom-left",middleLeft:"pdfjs-editor-resizer-middle-left"})),W._borderLineWidth!==-1)return;const s=getComputedStyle(document.documentElement);W._borderLineWidth=parseFloat(s.getPropertyValue("--outline-width"))||0}static updateDefaultParams(t,e){}static get defaultPropertiesToUpdate(){return[]}static isHandlingMimeForPasting(t){return!1}static paste(t,e){K("Not implemented")}get propertiesToUpdate(){return[]}get _isDraggable(){return n(this,Lo)}set _isDraggable(t){var e;g(this,Lo,t),(e=this.div)==null||e.classList.toggle("draggable",t)}get isEnterHandled(){return!0}center(){const[t,e]=this.pageDimensions;switch(this.parentRotation){case 90:this.x-=this.height*e/(t*2),this.y+=this.width*t/(e*2);break;case 180:this.x+=this.width/2,this.y+=this.height/2;break;case 270:this.x+=this.height*e/(t*2),this.y-=this.width*t/(e*2);break;default:this.x-=this.width/2,this.y-=this.height/2;break}this.fixAndSetPosition()}addCommands(t){this._uiManager.addCommands(t)}get currentLayer(){return this._uiManager.currentLayer}setInBackground(){this.div.style.zIndex=0}setInForeground(){this.div.style.zIndex=n(this,wc)}setParent(t){t!==null?(this.pageIndex=t.pageIndex,this.pageDimensions=t.pageDimensions):b(this,Qi,za).call(this),this.parent=t}focusin(t){this._focusEventsAllowed&&(n(this,Yi)?g(this,Yi,!1):this.parent.setSelected(this))}focusout(t){var s;if(!this._focusEventsAllowed||!this.isAttachedToDOM)return;const e=t.relatedTarget;e!=null&&e.closest(`#${this.id}`)||(t.preventDefault(),(s=this.parent)!=null&&s.isMultipleSelection||this.commitOrRemove())}commitOrRemove(){this.isEmpty()?this.remove():this.commit()}commit(){this.addToAnnotationStorage()}addToAnnotationStorage(){this._uiManager.addToAnnotationStorage(this)}setAt(t,e,s,i){const[r,a]=this.parentDimensions;[s,i]=this.screenToPageTranslation(s,i),this.x=(t+s)/r,this.y=(e+i)/a,this.fixAndSetPosition()}translate(t,e){b(this,Io,du).call(this,this.parentDimensions,t,e)}translateInPage(t,e){n(this,ai)||g(this,ai,[this.x,this.y]),b(this,Io,du).call(this,this.pageDimensions,t,e),this.div.scrollIntoView({block:"nearest"})}drag(t,e){n(this,ai)||g(this,ai,[this.x,this.y]);const{div:s,parentDimensions:[i,r]}=this;if(this.x+=t/i,this.y+=e/r,this.parent&&(this.x<0||this.x>1||this.y<0||this.y>1)){const{x:u,y:p}=this.div.getBoundingClientRect();this.parent.findNewParent(this,u,p)&&(this.x-=Math.floor(this.x),this.y-=Math.floor(this.y))}let{x:a,y:o}=this;const[l,h]=this.getBaseTranslation();a+=l,o+=h;const{style:c}=s;c.left=`${(100*a).toFixed(2)}%`,c.top=`${(100*o).toFixed(2)}%`,this._onTranslating(a,o),s.scrollIntoView({block:"nearest"})}_onTranslating(t,e){}_onTranslated(t,e){}get _hasBeenMoved(){return!!n(this,ai)&&(n(this,ai)[0]!==this.x||n(this,ai)[1]!==this.y)}getBaseTranslation(){const[t,e]=this.parentDimensions,{_borderLineWidth:s}=W,i=s/t,r=s/e;switch(this.rotation){case 90:return[-i,r];case 180:return[i,r];case 270:return[i,-r];default:return[-i,-r]}}get _mustFixPosition(){return!0}fixAndSetPosition(t=this.rotation){const{div:{style:e},pageDimensions:[s,i]}=this;let{x:r,y:a,width:o,height:l}=this;if(o*=s,l*=i,r*=s,a*=i,this._mustFixPosition)switch(t){case 0:r=Math.max(0,Math.min(s-o,r)),a=Math.max(0,Math.min(i-l,a));break;case 90:r=Math.max(0,Math.min(s-l,r)),a=Math.min(i,Math.max(o,a));break;case 180:r=Math.min(s,Math.max(o,r)),a=Math.min(i,Math.max(l,a));break;case 270:r=Math.min(s,Math.max(l,r)),a=Math.max(0,Math.min(i-o,a));break}this.x=r/=s,this.y=a/=i;const[h,c]=this.getBaseTranslation();r+=h,a+=c,e.left=`${(100*r).toFixed(2)}%`,e.top=`${(100*a).toFixed(2)}%`,this.moveInDOM()}screenToPageTranslation(t,e){var s;return b(s=W,Do,uu).call(s,t,e,this.parentRotation)}pageTranslationToScreen(t,e){var s;return b(s=W,Do,uu).call(s,t,e,360-this.parentRotation)}get parentScale(){return this._uiManager.viewParameters.realScale}get parentRotation(){return(this._uiManager.viewParameters.rotation+this.pageRotation)%360}get parentDimensions(){const{parentScale:t,pageDimensions:[e,s]}=this;return[e*t,s*t]}setDims(t,e){const[s,i]=this.parentDimensions,{style:r}=this.div;r.width=`${(100*t/s).toFixed(2)}%`,n(this,qi)||(r.height=`${(100*e/i).toFixed(2)}%`)}fixDims(){const{style:t}=this.div,{height:e,width:s}=t,i=s.endsWith("%"),r=!n(this,qi)&&e.endsWith("%");if(i&&r)return;const[a,o]=this.parentDimensions;i||(t.width=`${(100*parseFloat(s)/a).toFixed(2)}%`),!n(this,qi)&&!r&&(t.height=`${(100*parseFloat(e)/o).toFixed(2)}%`)}getInitialTranslation(){return[0,0]}_onResized(){}_onResizing(){}altTextFinish(){var t;(t=n(this,it))==null||t.finish()}async addEditToolbar(){return this._editToolbar||n(this,Ki)?this._editToolbar:(this._editToolbar=new eu(this),this.div.append(this._editToolbar.render()),n(this,it)&&await this._editToolbar.addAltText(n(this,it)),this._editToolbar)}removeEditToolbar(){var t;this._editToolbar&&(this._editToolbar.remove(),this._editToolbar=null,(t=n(this,it))==null||t.destroy())}addContainer(t){var s;const e=(s=this._editToolbar)==null?void 0:s.div;e?e.before(t):this.div.append(t)}getClientDimensions(){return this.div.getBoundingClientRect()}async addAltTextButton(){n(this,it)||(Yh.initialize(W._l10n),g(this,it,new Yh(this)),n(this,Wi)&&(n(this,it).data=n(this,Wi),g(this,Wi,null)),await this.addEditToolbar())}get altTextData(){var t;return(t=n(this,it))==null?void 0:t.data}set altTextData(t){n(this,it)&&(n(this,it).data=t)}get guessedAltText(){var t;return(t=n(this,it))==null?void 0:t.guessedText}async setGuessedAltText(t){var e;await((e=n(this,it))==null?void 0:e.setGuessedText(t))}serializeAltText(t){var e;return(e=n(this,it))==null?void 0:e.serialize(t)}hasAltText(){return!!n(this,it)&&!n(this,it).isEmpty()}hasAltTextData(){var t;return((t=n(this,it))==null?void 0:t.hasData())??!1}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=n(this,Er)?-1:0,this._isVisible||this.div.classList.add("hidden"),this.setInForeground(),b(this,$o,Au).call(this);const[t,e]=this.parentDimensions;this.parentRotation%180!==0&&(this.div.style.maxWidth=`${(100*e/t).toFixed(2)}%`,this.div.style.maxHeight=`${(100*t/e).toFixed(2)}%`);const[s,i]=this.getInitialTranslation();return this.translate(s,i),Xh(this,this.div,["pointerdown"]),this.div}pointerdown(t){const{isMac:e}=Wt.platform;if(t.button!==0||t.ctrlKey&&e){t.preventDefault();return}if(g(this,Yi,!0),this._isDraggable){b(this,Sc,gp).call(this,t);return}b(this,Bo,bu).call(this,t)}get isSelected(){return this._uiManager.isSelected(this)}_onStartDragging(){}_onStopDragging(){}moveInDOM(){n(this,ss)&&clearTimeout(n(this,ss)),g(this,ss,setTimeout(()=>{var t;g(this,ss,null),(t=this.parent)==null||t.moveEditorInDOM(this)},0))}_setParentAndPosition(t,e,s){t.changeParent(this),this.x=e,this.y=s,this.fixAndSetPosition(),this._onTranslated()}getRect(t,e,s=this.rotation){const i=this.parentScale,[r,a]=this.pageDimensions,[o,l]=this.pageTranslation,h=t/i,c=e/i,u=this.x*r,p=this.y*a,m=this.width*r,A=this.height*a;switch(s){case 0:return[u+h+o,a-p-c-A+l,u+h+m+o,a-p-c+l];case 90:return[u+c+o,a-p+h+l,u+c+A+o,a-p+h+m+l];case 180:return[u-h-m+o,a-p+c+l,u-h+o,a-p+c+A+l];case 270:return[u-c-A+o,a-p-h-m+l,u-c+o,a-p-h+l];default:throw new Error("Invalid rotation")}}getRectInCurrentCoords(t,e){const[s,i,r,a]=t,o=r-s,l=a-i;switch(this.rotation){case 0:return[s,e-a,o,l];case 90:return[s,e-i,l,o];case 180:return[r,e-i,o,l];case 270:return[r,e-a,l,o];default:throw new Error("Invalid rotation")}}onceAdded(){}isEmpty(){return!1}enableEditMode(){g(this,Ki,!0)}disableEditMode(){g(this,Ki,!1)}isInEditMode(){return n(this,Ki)}shouldGetKeyboardEvents(){return n(this,Es)}needsToBeRebuilt(){return this.div&&!this.isAttachedToDOM}rebuild(){b(this,$o,Au).call(this)}rotate(t){}resize(){}serializeDeleted(){var t;return{id:this.annotationElementId,deleted:!0,pageIndex:this.pageIndex,popupRef:((t=this._initialData)==null?void 0:t.popupRef)||""}}serialize(t=!1,e=null){K("An editor must be serializable")}static async deserialize(t,e,s){const i=new this.prototype.constructor({parent:e,id:e.getNextId(),uiManager:s});i.rotation=t.rotation,g(i,Wi,t.accessibilityData);const[r,a]=i.pageDimensions,[o,l,h,c]=i.getRectInCurrentCoords(t.rect,a);return i.x=o/r,i.y=l/a,i.width=h/r,i.height=c/a,i}get hasBeenModified(){return!!this.annotationElementId&&(this.deleted||this.serialize()!==null)}remove(){var t;if((t=n(this,ri))==null||t.abort(),g(this,ri,null),this.isEmpty()||this.commit(),this.parent?this.parent.remove(this):this._uiManager.removeEditor(this),n(this,ss)&&(clearTimeout(n(this,ss)),g(this,ss,null)),b(this,Qi,za).call(this),this.removeEditToolbar(),n(this,Ae)){for(const e of n(this,Ae).values())clearTimeout(e);g(this,Ae,null)}this.parent=null}get isResizable(){return!1}makeResizable(){this.isResizable&&(b(this,vc,fp).call(this),n(this,Ct).classList.remove("hidden"),Xh(this,this.div,["keydown"]))}get toolbarPosition(){return null}keydown(t){if(!this.isResizable||t.target!==this.div||t.key!=="Enter")return;this._uiManager.setSelected(this),g(this,ni,{savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height});const e=n(this,Ct).children;if(!n(this,Me)){g(this,Me,Array.from(e));const a=b(this,xc,mp).bind(this),o=b(this,Cc,bp).bind(this),l=this._uiManager._signal;for(const h of n(this,Me)){const c=h.getAttribute("data-resizer-name");h.setAttribute("role","spinbutton"),h.addEventListener("keydown",a,{signal:l}),h.addEventListener("blur",o,{signal:l}),h.addEventListener("focus",b(this,Tc,Ap).bind(this,c),{signal:l}),h.setAttribute("data-l10n-id",W._l10nResizer[c])}}const s=n(this,Me)[0];let i=0;for(const a of e){if(a===s)break;i++}const r=(360-this.rotation+this.parentRotation)%360/90*(n(this,Me).length/4);if(r!==i){if(r<i)for(let o=0;o<i-r;o++)n(this,Ct).append(n(this,Ct).firstChild);else if(r>i)for(let o=0;o<r-i;o++)n(this,Ct).firstChild.before(n(this,Ct).lastChild);let a=0;for(const o of e){const h=n(this,Me)[a++].getAttribute("data-resizer-name");o.setAttribute("data-l10n-id",W._l10nResizer[h])}}b(this,Go,_u).call(this,0),g(this,Es,!0),n(this,Ct).firstChild.focus({focusVisible:!0}),t.preventDefault(),t.stopImmediatePropagation()}_resizeWithKeyboard(t,e){n(this,Es)&&b(this,Ho,mu).call(this,n(this,ko),{deltaX:t,deltaY:e,fromKeyboard:!0})}_stopResizingWithKeyboard(){b(this,Qi,za).call(this),this.div.focus()}select(){var t,e,s;if(this.makeResizable(),(t=this.div)==null||t.classList.add("selectedEditor"),!this._editToolbar){this.addEditToolbar().then(()=>{var i,r;(i=this.div)!=null&&i.classList.contains("selectedEditor")&&((r=this._editToolbar)==null||r.show())});return}(e=this._editToolbar)==null||e.show(),(s=n(this,it))==null||s.toggleAltTextBadge(!1)}unselect(){var t,e,s,i,r;(t=n(this,Ct))==null||t.classList.add("hidden"),(e=this.div)==null||e.classList.remove("selectedEditor"),(s=this.div)!=null&&s.contains(document.activeElement)&&this._uiManager.currentLayer.div.focus({preventScroll:!0}),(i=this._editToolbar)==null||i.hide(),(r=n(this,it))==null||r.toggleAltTextBadge(!0)}updateParams(t,e){}disableEditing(){}enableEditing(){}enterInEditMode(){}getImageForAltText(){return null}get contentDiv(){return this.div}get isEditing(){return n(this,Mo)}set isEditing(t){g(this,Mo,t),this.parent&&(t?(this.parent.setSelected(this),this.parent.setActiveEditor(this)):this.parent.setActiveEditor(null))}setAspectRatio(t,e){g(this,qi,!0);const s=t/e,{style:i}=this.div;i.aspectRatio=s,i.height="auto"}static get MIN_SIZE(){return 16}static canCreateNewEmptyEditor(){return!0}get telemetryInitialData(){return{action:"added"}}get telemetryFinalData(){return null}_reportTelemetry(t,e=!1){if(e){n(this,Ae)||g(this,Ae,new Map);const{action:s}=t;let i=n(this,Ae).get(s);i&&clearTimeout(i),i=setTimeout(()=>{this._reportTelemetry(t),n(this,Ae).delete(s),n(this,Ae).size===0&&g(this,Ae,null)},W._telemetryTimeout),n(this,Ae).set(s,i);return}t.type||(t.type=this.editorType),this._uiManager._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:t}})}show(t=this._isVisible){this.div.classList.toggle("hidden",!t),this._isVisible=t}enable(){this.div&&(this.div.tabIndex=0),g(this,Er,!1)}disable(){this.div&&(this.div.tabIndex=-1),g(this,Er,!0)}renderAnnotationElement(t){let e=t.container.querySelector(".annotationContent");if(!e)e=document.createElement("div"),e.classList.add("annotationContent",this.editorType),t.container.prepend(e);else if(e.nodeName==="CANVAS"){const s=e;e=document.createElement("div"),e.classList.add("annotationContent",this.editorType),s.before(e)}return e}resetAnnotationElement(t){const{firstChild:e}=t.container;(e==null?void 0:e.nodeName)==="DIV"&&e.classList.contains("annotationContent")&&e.remove()}};Wi=new WeakMap,Me=new WeakMap,it=new WeakMap,Er=new WeakMap,ii=new WeakMap,Po=new WeakMap,qi=new WeakMap,Ct=new WeakMap,Xi=new WeakMap,ni=new WeakMap,ri=new WeakMap,ko=new WeakMap,Yi=new WeakMap,ai=new WeakMap,Mo=new WeakMap,Ki=new WeakMap,Es=new WeakMap,ss=new WeakMap,Sr=new WeakMap,xr=new WeakMap,Ae=new WeakMap,Lo=new WeakMap,wc=new WeakMap,Io=new WeakSet,du=function([t,e],s,i){[s,i]=this.screenToPageTranslation(s,i),this.x+=s/t,this.y+=i/e,this._onTranslating(this.x,this.y),this.fixAndSetPosition()},Do=new WeakSet,uu=function(t,e,s){switch(s){case 90:return[e,-t];case 180:return[-t,-e];case 270:return[-e,t];default:return[t,e]}},Fo=new WeakSet,fu=function(t){switch(t){case 90:{const[e,s]=this.pageDimensions;return[0,-e/s,s/e,0]}case 180:return[-1,0,0,-1];case 270:{const[e,s]=this.pageDimensions;return[0,e/s,-s/e,0]}default:return[1,0,0,1]}},vc=new WeakSet,fp=function(){if(n(this,Ct))return;g(this,Ct,document.createElement("div")),n(this,Ct).classList.add("resizers");const t=this._willKeepAspectRatio?["topLeft","topRight","bottomRight","bottomLeft"]:["topLeft","topMiddle","topRight","middleRight","bottomRight","bottomMiddle","bottomLeft","middleLeft"],e=this._uiManager._signal;for(const s of t){const i=document.createElement("div");n(this,Ct).append(i),i.classList.add("resizer",s),i.setAttribute("data-resizer-name",s),i.addEventListener("pointerdown",b(this,Ec,pp).bind(this,s),{signal:e}),i.addEventListener("contextmenu",Ue,{signal:e}),i.tabIndex=-1}this.div.prepend(n(this,Ct))},Ec=new WeakSet,pp=function(t,e){var c;e.preventDefault();const{isMac:s}=Wt.platform;if(e.button!==0||e.ctrlKey&&s)return;(c=n(this,it))==null||c.toggle(!1);const i=this._isDraggable;this._isDraggable=!1,g(this,Xi,[e.screenX,e.screenY]);const r=new AbortController,a=this._uiManager.combinedSignal(r);this.parent.togglePointerEvents(!1),window.addEventListener("pointermove",b(this,Ho,mu).bind(this,t),{passive:!0,capture:!0,signal:a}),window.addEventListener("touchmove",ze,{passive:!1,signal:a}),window.addEventListener("contextmenu",Ue,{signal:a}),g(this,ni,{savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height});const o=this.parent.div.style.cursor,l=this.div.style.cursor;this.div.style.cursor=this.parent.div.style.cursor=window.getComputedStyle(e.target).cursor;const h=()=>{var u;r.abort(),this.parent.togglePointerEvents(!0),(u=n(this,it))==null||u.toggle(!0),this._isDraggable=i,this.parent.div.style.cursor=o,this.div.style.cursor=l,b(this,No,gu).call(this)};window.addEventListener("pointerup",h,{signal:a}),window.addEventListener("blur",h,{signal:a})},Oo=new WeakSet,pu=function(t,e,s,i){this.width=s,this.height=i,this.x=t,this.y=e;const[r,a]=this.parentDimensions;this.setDims(r*s,a*i),this.fixAndSetPosition(),this._onResized()},No=new WeakSet,gu=function(){if(!n(this,ni))return;const{savedX:t,savedY:e,savedWidth:s,savedHeight:i}=n(this,ni);g(this,ni,null);const r=this.x,a=this.y,o=this.width,l=this.height;r===t&&a===e&&o===s&&l===i||this.addCommands({cmd:b(this,Oo,pu).bind(this,r,a,o,l),undo:b(this,Oo,pu).bind(this,t,e,s,i),mustExec:!0})},Ho=new WeakSet,mu=function(t,e){const[s,i]=this.parentDimensions,r=this.x,a=this.y,o=this.width,l=this.height,h=W.MIN_SIZE/s,c=W.MIN_SIZE/i,u=L=>Math.round(L*1e4)/1e4,p=b(this,Fo,fu).call(this,this.rotation),m=(L,F)=>[p[0]*L+p[2]*F,p[1]*L+p[3]*F],A=b(this,Fo,fu).call(this,360-this.rotation),_=(L,F)=>[A[0]*L+A[2]*F,A[1]*L+A[3]*F];let w,y,v=!1,S=!1;switch(t){case"topLeft":v=!0,w=(L,F)=>[0,0],y=(L,F)=>[L,F];break;case"topMiddle":w=(L,F)=>[L/2,0],y=(L,F)=>[L/2,F];break;case"topRight":v=!0,w=(L,F)=>[L,0],y=(L,F)=>[0,F];break;case"middleRight":S=!0,w=(L,F)=>[L,F/2],y=(L,F)=>[0,F/2];break;case"bottomRight":v=!0,w=(L,F)=>[L,F],y=(L,F)=>[0,0];break;case"bottomMiddle":w=(L,F)=>[L/2,F],y=(L,F)=>[L/2,0];break;case"bottomLeft":v=!0,w=(L,F)=>[0,F],y=(L,F)=>[L,0];break;case"middleLeft":S=!0,w=(L,F)=>[0,F/2],y=(L,F)=>[L,F/2];break}const E=w(o,l),x=y(o,l);let C=m(...x);const T=u(r+C[0]),k=u(a+C[1]);let D=1,U=1,N,Q;if(e.fromKeyboard)({deltaX:N,deltaY:Q}=e);else{const{screenX:L,screenY:F}=e,[Ve,Se]=n(this,Xi);[N,Q]=this.screenToPageTranslation(L-Ve,F-Se),n(this,Xi)[0]=L,n(this,Xi)[1]=F}if([N,Q]=_(N/s,Q/i),v){const L=Math.hypot(o,l);D=U=Math.max(Math.min(Math.hypot(x[0]-E[0]-N,x[1]-E[1]-Q)/L,1/o,1/l),h/o,c/l)}else S?D=Math.max(h,Math.min(1,Math.abs(x[0]-E[0]-N)))/o:U=Math.max(c,Math.min(1,Math.abs(x[1]-E[1]-Q)))/l;const lt=u(o*D),j=u(l*U);C=m(...y(lt,j));const Bt=T-C[0],q=k-C[1];this.width=lt,this.height=j,this.x=Bt,this.y=q,this.setDims(s*lt,i*j),this.fixAndSetPosition(),this._onResizing()},Bo=new WeakSet,bu=function(t){const{isMac:e}=Wt.platform;t.ctrlKey&&!e||t.shiftKey||t.metaKey&&e?this.parent.toggleSelected(this):this.parent.setSelected(this)},Sc=new WeakSet,gp=function(t){const{isSelected:e}=this;this._uiManager.setUpDragSession();const s=new AbortController,i=this._uiManager.combinedSignal(s),r={capture:!0,passive:!1,signal:i},a=l=>{s.abort(),g(this,ii,null),g(this,Yi,!1),this._uiManager.endDragSession()||b(this,Bo,bu).call(this,l)};e&&(g(this,Sr,t.clientX),g(this,xr,t.clientY),g(this,ii,t.pointerId),g(this,Po,t.pointerType),window.addEventListener("pointermove",l=>{const{clientX:h,clientY:c,pointerId:u}=l;if(u!==n(this,ii)){ze(l);return}const[p,m]=this.screenToPageTranslation(h-n(this,Sr),c-n(this,xr));g(this,Sr,h),g(this,xr,c),this._uiManager.dragSelectedEditors(p,m)},r),window.addEventListener("touchmove",ze,r),window.addEventListener("pointerdown",l=>{l.isPrimary&&l.pointerType===n(this,Po)&&a(l),ze(l)},r)),this._onStartDragging();const o=l=>{if(!n(this,ii)||n(this,ii)===l.pointerId){a(l),this._onStopDragging();return}ze(l)};window.addEventListener("pointerup",o,{signal:i}),window.addEventListener("blur",o,{signal:i})},$o=new WeakSet,Au=function(){if(n(this,ri)||!this.div)return;g(this,ri,new AbortController);const t=this._uiManager.combinedSignal(n(this,ri));this.div.addEventListener("focusin",this.focusin.bind(this),{signal:t}),this.div.addEventListener("focusout",this.focusout.bind(this),{signal:t})},xc=new WeakSet,mp=function(t){W._resizerKeyboardManager.exec(this,t)},Cc=new WeakSet,bp=function(t){var e;n(this,Es)&&((e=t.relatedTarget)==null?void 0:e.parentNode)!==n(this,Ct)&&b(this,Qi,za).call(this)},Tc=new WeakSet,Ap=function(t){g(this,ko,n(this,Es)?t:"")},Go=new WeakSet,_u=function(t){if(n(this,Me))for(const e of n(this,Me))e.tabIndex=t},Qi=new WeakSet,za=function(){g(this,Es,!1),b(this,Go,_u).call(this,-1),b(this,No,gu).call(this)},f(W,Do),I(W,"_l10n",null),I(W,"_l10nResizer",null),I(W,"_borderLineWidth",-1),I(W,"_colorManager",new nu),I(W,"_zIndex",1),I(W,"_telemetryTimeout",1e3);let rt=W;class pm extends rt{constructor(t){super(t),this.annotationElementId=t.annotationElementId,this.deleted=!0}serialize(){return this.serializeDeleted()}}const kf=3285377520,pe=4294901760,We=65535;class _p{constructor(t){this.h1=t?t&4294967295:kf,this.h2=t?t&4294967295:kf}update(t){let e,s;if(typeof t=="string"){e=new Uint8Array(t.length*2),s=0;for(let _=0,w=t.length;_<w;_++){const y=t.charCodeAt(_);y<=255?e[s++]=y:(e[s++]=y>>>8,e[s++]=y&255)}}else if(ArrayBuffer.isView(t))e=t.slice(),s=e.byteLength;else throw new Error("Invalid data format, must be a string or TypedArray.");const i=s>>2,r=s-i*4,a=new Uint32Array(e.buffer,0,i);let o=0,l=0,h=this.h1,c=this.h2;const u=3432918353,p=461845907,m=u&We,A=p&We;for(let _=0;_<i;_++)_&1?(o=a[_],o=o*u&pe|o*m&We,o=o<<15|o>>>17,o=o*p&pe|o*A&We,h^=o,h=h<<13|h>>>19,h=h*5+3864292196):(l=a[_],l=l*u&pe|l*m&We,l=l<<15|l>>>17,l=l*p&pe|l*A&We,c^=l,c=c<<13|c>>>19,c=c*5+3864292196);switch(o=0,r){case 3:o^=e[i*4+2]<<16;case 2:o^=e[i*4+1]<<8;case 1:o^=e[i*4],o=o*u&pe|o*m&We,o=o<<15|o>>>17,o=o*p&pe|o*A&We,i&1?h^=o:c^=o}this.h1=h,this.h2=c}hexdigest(){let t=this.h1,e=this.h2;return t^=e>>>1,t=t*3981806797&pe|t*36045&We,e=e*4283543511&pe|((e<<16|t>>>16)*2950163797&pe)>>>16,t^=e>>>1,t=t*444984403&pe|t*60499&We,e=e*3301882366&pe|((e<<16|t>>>16)*3120437893&pe)>>>16,t^=e>>>1,(t>>>0).toString(16).padStart(8,"0")+(e>>>0).toString(16).padStart(8,"0")}}const yu=Object.freeze({map:null,hash:"",transfer:void 0});var Ji,Zi,yt,Rc,yp;class bf{constructor(){f(this,Rc);f(this,Ji,!1);f(this,Zi,null);f(this,yt,new Map);this.onSetModified=null,this.onResetModified=null,this.onAnnotationEditor=null}getValue(t,e){const s=n(this,yt).get(t);return s===void 0?e:Object.assign(e,s)}getRawValue(t){return n(this,yt).get(t)}remove(t){if(n(this,yt).delete(t),n(this,yt).size===0&&this.resetModified(),typeof this.onAnnotationEditor=="function"){for(const e of n(this,yt).values())if(e instanceof rt)return;this.onAnnotationEditor(null)}}setValue(t,e){const s=n(this,yt).get(t);let i=!1;if(s!==void 0)for(const[r,a]of Object.entries(e))s[r]!==a&&(i=!0,s[r]=a);else i=!0,n(this,yt).set(t,e);i&&b(this,Rc,yp).call(this),e instanceof rt&&typeof this.onAnnotationEditor=="function"&&this.onAnnotationEditor(e.constructor._type)}has(t){return n(this,yt).has(t)}getAll(){return n(this,yt).size>0?df(n(this,yt)):null}setAll(t){for(const[e,s]of Object.entries(t))this.setValue(e,s)}get size(){return n(this,yt).size}resetModified(){n(this,Ji)&&(g(this,Ji,!1),typeof this.onResetModified=="function"&&this.onResetModified())}get print(){return new wp(this)}get serializable(){if(n(this,yt).size===0)return yu;const t=new Map,e=new _p,s=[],i=Object.create(null);let r=!1;for(const[a,o]of n(this,yt)){const l=o instanceof rt?o.serialize(!1,i):o;l&&(t.set(a,l),e.update(`${a}:${JSON.stringify(l)}`),r||(r=!!l.bitmap))}if(r)for(const a of t.values())a.bitmap&&s.push(a.bitmap);return t.size>0?{map:t,hash:e.hexdigest(),transfer:s}:yu}get editorStats(){let t=null;const e=new Map;for(const s of n(this,yt).values()){if(!(s instanceof rt))continue;const i=s.telemetryFinalData;if(!i)continue;const{type:r}=i;e.has(r)||e.set(r,Object.getPrototypeOf(s).constructor),t||(t=Object.create(null));const a=t[r]||(t[r]=new Map);for(const[o,l]of Object.entries(i)){if(o==="type")continue;let h=a.get(o);h||(h=new Map,a.set(o,h));const c=h.get(l)??0;h.set(l,c+1)}}for(const[s,i]of e)t[s]=i.computeTelemetryFinalData(t[s]);return t}resetModifiedIds(){g(this,Zi,null)}get modifiedIds(){if(n(this,Zi))return n(this,Zi);const t=[];for(const e of n(this,yt).values())!(e instanceof rt)||!e.annotationElementId||!e.serialize()||t.push(e.annotationElementId);return g(this,Zi,{ids:new Set(t),hash:t.join(",")})}}Ji=new WeakMap,Zi=new WeakMap,yt=new WeakMap,Rc=new WeakSet,yp=function(){n(this,Ji)||(g(this,Ji,!0),typeof this.onSetModified=="function"&&this.onSetModified())};var zo;class wp extends bf{constructor(e){super();f(this,zo,void 0);const{map:s,hash:i,transfer:r}=e.serializable,a=structuredClone(s,r?{transfer:r}:null);g(this,zo,{map:a,hash:i,transfer:r})}get print(){K("Should not call PrintAnnotationStorage.print")}get serializable(){return n(this,zo)}get modifiedIds(){return G(this,"modifiedIds",{ids:new Set,hash:""})}}zo=new WeakMap;var Cr;class gm{constructor({ownerDocument:t=globalThis.document,styleElement:e=null}){f(this,Cr,new Set);this._document=t,this.nativeFontFaces=new Set,this.styleElement=null,this.loadingRequests=[],this.loadTestFontId=0}addNativeFontFace(t){this.nativeFontFaces.add(t),this._document.fonts.add(t)}removeNativeFontFace(t){this.nativeFontFaces.delete(t),this._document.fonts.delete(t)}insertRule(t){this.styleElement||(this.styleElement=this._document.createElement("style"),this._document.documentElement.getElementsByTagName("head")[0].append(this.styleElement));const e=this.styleElement.sheet;e.insertRule(t,e.cssRules.length)}clear(){for(const t of this.nativeFontFaces)this._document.fonts.delete(t);this.nativeFontFaces.clear(),n(this,Cr).clear(),this.styleElement&&(this.styleElement.remove(),this.styleElement=null)}async loadSystemFont({systemFontInfo:t,_inspectFont:e}){if(!(!t||n(this,Cr).has(t.loadedName))){if(ft(!this.disableFontFace,"loadSystemFont shouldn't be called when `disableFontFace` is set."),this.isFontLoadingAPISupported){const{loadedName:s,src:i,style:r}=t,a=new FontFace(s,i,r);this.addNativeFontFace(a);try{await a.load(),n(this,Cr).add(s),e==null||e(t)}catch{B(`Cannot load system font: ${t.baseFontName}, installing it could help to improve PDF rendering.`),this.removeNativeFontFace(a)}return}K("Not implemented: loadSystemFont without the Font Loading API.")}}async bind(t){if(t.attached||t.missingFile&&!t.systemFontInfo)return;if(t.attached=!0,t.systemFontInfo){await this.loadSystemFont(t);return}if(this.isFontLoadingAPISupported){const s=t.createNativeFontFace();if(s){this.addNativeFontFace(s);try{await s.loaded}catch(i){throw B(`Failed to load font '${s.family}': '${i}'.`),t.disableFontFace=!0,i}}return}const e=t.createFontFaceRule();if(e){if(this.insertRule(e),this.isSyncFontLoadingSupported)return;await new Promise(s=>{const i=this._queueLoadingCallback(s);this._prepareFontLoadEvent(t,i)})}}get isFontLoadingAPISupported(){var e;const t=!!((e=this._document)!=null&&e.fonts);return G(this,"isFontLoadingAPISupported",t)}get isSyncFontLoadingSupported(){let t=!1;return(jt||typeof navigator<"u"&&typeof(navigator==null?void 0:navigator.userAgent)=="string"&&/Mozilla\/5.0.*?rv:\d+.*? Gecko/.test(navigator.userAgent))&&(t=!0),G(this,"isSyncFontLoadingSupported",t)}_queueLoadingCallback(t){function e(){for(ft(!i.done,"completeRequest() cannot be called twice."),i.done=!0;s.length>0&&s[0].done;){const r=s.shift();setTimeout(r.callback,0)}}const{loadingRequests:s}=this,i={done:!1,complete:e,callback:t};return s.push(i),i}get _loadTestFont(){const t=atob("T1RUTwALAIAAAwAwQ0ZGIDHtZg4AAAOYAAAAgUZGVE1lkzZwAAAEHAAAABxHREVGABQAFQAABDgAAAAeT1MvMlYNYwkAAAEgAAAAYGNtYXABDQLUAAACNAAAAUJoZWFk/xVFDQAAALwAAAA2aGhlYQdkA+oAAAD0AAAAJGhtdHgD6AAAAAAEWAAAAAZtYXhwAAJQAAAAARgAAAAGbmFtZVjmdH4AAAGAAAAAsXBvc3T/hgAzAAADeAAAACAAAQAAAAEAALZRFsRfDzz1AAsD6AAAAADOBOTLAAAAAM4KHDwAAAAAA+gDIQAAAAgAAgAAAAAAAAABAAADIQAAAFoD6AAAAAAD6AABAAAAAAAAAAAAAAAAAAAAAQAAUAAAAgAAAAQD6AH0AAUAAAKKArwAAACMAooCvAAAAeAAMQECAAACAAYJAAAAAAAAAAAAAQAAAAAAAAAAAAAAAFBmRWQAwAAuAC4DIP84AFoDIQAAAAAAAQAAAAAAAAAAACAAIAABAAAADgCuAAEAAAAAAAAAAQAAAAEAAAAAAAEAAQAAAAEAAAAAAAIAAQAAAAEAAAAAAAMAAQAAAAEAAAAAAAQAAQAAAAEAAAAAAAUAAQAAAAEAAAAAAAYAAQAAAAMAAQQJAAAAAgABAAMAAQQJAAEAAgABAAMAAQQJAAIAAgABAAMAAQQJAAMAAgABAAMAAQQJAAQAAgABAAMAAQQJAAUAAgABAAMAAQQJAAYAAgABWABYAAAAAAAAAwAAAAMAAAAcAAEAAAAAADwAAwABAAAAHAAEACAAAAAEAAQAAQAAAC7//wAAAC7////TAAEAAAAAAAABBgAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAD/gwAyAAAAAQAAAAAAAAAAAAAAAAAAAAABAAQEAAEBAQJYAAEBASH4DwD4GwHEAvgcA/gXBIwMAYuL+nz5tQXkD5j3CBLnEQACAQEBIVhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYAAABAQAADwACAQEEE/t3Dov6fAH6fAT+fPp8+nwHDosMCvm1Cvm1DAz6fBQAAAAAAAABAAAAAMmJbzEAAAAAzgTjFQAAAADOBOQpAAEAAAAAAAAADAAUAAQAAAABAAAAAgABAAAAAAAAAAAD6AAAAAAAAA==");return G(this,"_loadTestFont",t)}_prepareFontLoadEvent(t,e){function s(E,x){return E.charCodeAt(x)<<24|E.charCodeAt(x+1)<<16|E.charCodeAt(x+2)<<8|E.charCodeAt(x+3)&255}function i(E,x,C,T){const k=E.substring(0,x),D=E.substring(x+C);return k+T+D}let r,a;const o=this._document.createElement("canvas");o.width=1,o.height=1;const l=o.getContext("2d");let h=0;function c(E,x){if(++h>30){B("Load test font never loaded."),x();return}if(l.font="30px "+E,l.fillText(".",0,20),l.getImageData(0,0,1,1).data[3]>0){x();return}setTimeout(c.bind(null,E,x))}const u=`lt${Date.now()}${this.loadTestFontId++}`;let p=this._loadTestFont;p=i(p,976,u.length,u);const A=16,_=1482184792;let w=s(p,A);for(r=0,a=u.length-3;r<a;r+=4)w=w-_+s(u,r)|0;r<u.length&&(w=w-_+s(u+"XXX",r)|0),p=i(p,A,4,tm(w));const y=`url(data:font/opentype;base64,${btoa(p)});`,v=`@font-face {font-family:"${u}";src:${y}}`;this.insertRule(v);const S=this._document.createElement("div");S.style.visibility="hidden",S.style.width=S.style.height="10px",S.style.position="absolute",S.style.top=S.style.left="0px";for(const E of[t.loadedName,u]){const x=this._document.createElement("span");x.textContent="Hi",x.style.fontFamily=E,S.append(x)}this._document.body.append(S),c(u,()=>{S.remove(),e.complete()})}}Cr=new WeakMap;class mm{constructor(t,{disableFontFace:e=!1,inspectFont:s=null}){this.compiledGlyphs=Object.create(null);for(const i in t)this[i]=t[i];this.disableFontFace=e===!0,this._inspectFont=s}createNativeFontFace(){var e;if(!this.data||this.disableFontFace)return null;let t;if(!this.cssFontInfo)t=new FontFace(this.loadedName,this.data,{});else{const s={weight:this.cssFontInfo.fontWeight};this.cssFontInfo.italicAngle&&(s.style=`oblique ${this.cssFontInfo.italicAngle}deg`),t=new FontFace(this.cssFontInfo.fontFamily,this.data,s)}return(e=this._inspectFont)==null||e.call(this,this),t}createFontFaceRule(){var s;if(!this.data||this.disableFontFace)return null;const t=`url(data:${this.mimetype};base64,${am(this.data)});`;let e;if(!this.cssFontInfo)e=`@font-face {font-family:"${this.loadedName}";src:${t}}`;else{let i=`font-weight: ${this.cssFontInfo.fontWeight};`;this.cssFontInfo.italicAngle&&(i+=`font-style: oblique ${this.cssFontInfo.italicAngle}deg;`),e=`@font-face {font-family:"${this.cssFontInfo.fontFamily}";${i}src:${t}}`}return(s=this._inspectFont)==null||s.call(this,this,t),e}getPathGenerator(t,e){if(this.compiledGlyphs[e]!==void 0)return this.compiledGlyphs[e];let s;try{s=t.get(this.loadedName+"_path_"+e)}catch(r){B(`getPathGenerator - ignoring character: "${r}".`)}if(!Array.isArray(s)||s.length===0)return this.compiledGlyphs[e]=function(r,a){};const i=[];for(let r=0,a=s.length;r<a;)switch(s[r++]){case fs.BEZIER_CURVE_TO:{const[o,l,h,c,u,p]=s.slice(r,r+6);i.push(m=>m.bezierCurveTo(o,l,h,c,u,p)),r+=6}break;case fs.MOVE_TO:{const[o,l]=s.slice(r,r+2);i.push(h=>h.moveTo(o,l)),r+=2}break;case fs.LINE_TO:{const[o,l]=s.slice(r,r+2);i.push(h=>h.lineTo(o,l)),r+=2}break;case fs.QUADRATIC_CURVE_TO:{const[o,l,h,c]=s.slice(r,r+4);i.push(u=>u.quadraticCurveTo(o,l,h,c)),r+=4}break;case fs.RESTORE:i.push(o=>o.restore());break;case fs.SAVE:i.push(o=>o.save());break;case fs.SCALE:ft(i.length===2,"Scale command is only valid at the third position.");break;case fs.TRANSFORM:{const[o,l,h,c,u,p]=s.slice(r,r+6);i.push(m=>m.transform(o,l,h,c,u,p)),r+=6}break;case fs.TRANSLATE:{const[o,l]=s.slice(r,r+2);i.push(h=>h.translate(o,l)),r+=2}break}return i.push(r=>r.closePath()),this.compiledGlyphs[e]=function(a,o){i[0](a),i[1](a),a.scale(o,-o);for(let l=2,h=i.length;l<h;l++)i[l](a)}}}var Uo;class vp{constructor({enableHWA:t=!1}){f(this,Uo,!1);g(this,Uo,t)}create(t,e){if(t<=0||e<=0)throw new Error("Invalid canvas size");const s=this._createCanvas(t,e);return{canvas:s,context:s.getContext("2d",{willReadFrequently:!n(this,Uo)})}}reset(t,e,s){if(!t.canvas)throw new Error("Canvas is not specified");if(e<=0||s<=0)throw new Error("Invalid canvas size");t.canvas.width=e,t.canvas.height=s}destroy(t){if(!t.canvas)throw new Error("Canvas is not specified");t.canvas.width=0,t.canvas.height=0,t.canvas=null,t.context=null}_createCanvas(t,e){K("Abstract method `_createCanvas` called.")}}Uo=new WeakMap;class bm extends vp{constructor({ownerDocument:t=globalThis.document,enableHWA:e=!1}){super({enableHWA:e}),this._document=t}_createCanvas(t,e){const s=this._document.createElement("canvas");return s.width=t,s.height=e,s}}class Ep{constructor({baseUrl:t=null,isCompressed:e=!0}){this.baseUrl=t,this.isCompressed=e}async fetch({name:t}){if(!this.baseUrl)throw new Error("Ensure that the `cMapUrl` and `cMapPacked` API parameters are provided.");if(!t)throw new Error("CMap name must be specified.");const e=this.baseUrl+t+(this.isCompressed?".bcmap":"");return this._fetch(e).then(s=>({cMapData:s,isCompressed:this.isCompressed})).catch(s=>{throw new Error(`Unable to load ${this.isCompressed?"binary ":""}CMap at: ${e}`)})}async _fetch(t){K("Abstract method `_fetch` called.")}}class Sp extends Ep{async _fetch(t){const e=await Bd(t,this.isCompressed?"arraybuffer":"text");return e instanceof ArrayBuffer?new Uint8Array(e):Hd(e)}}class xp{addFilter(t){return"none"}addHCMFilter(t,e){return"none"}addAlphaFilter(t){return"none"}addLuminosityFilter(t){return"none"}addHighlightHCMFilter(t,e,s,i,r){return"none"}destroy(t=!1){}}var tn,Tr,Ss,xs,Ft,en,sn,wt,Lt,nn,Ua,oi,Qn,Rr,Th,li,Jn,Pc,Cp,Vo,wu,hi,Zn,rn,Va,an,ja,jo,vu,on,Wa;class Am extends xp{constructor({docId:e,ownerDocument:s=globalThis.document}){super();f(this,wt);f(this,nn);f(this,oi);f(this,Rr);f(this,li);f(this,Pc);f(this,Vo);f(this,hi);f(this,rn);f(this,an);f(this,jo);f(this,on);f(this,tn,void 0);f(this,Tr,void 0);f(this,Ss,void 0);f(this,xs,void 0);f(this,Ft,void 0);f(this,en,void 0);f(this,sn,0);g(this,xs,e),g(this,Ft,s)}addFilter(e){if(!e)return"none";let s=n(this,wt,Lt).get(e);if(s)return s;const[i,r,a]=b(this,Rr,Th).call(this,e),o=e.length===1?i:`${i}${r}${a}`;if(s=n(this,wt,Lt).get(o),s)return n(this,wt,Lt).set(e,s),s;const l=`g_${n(this,xs)}_transfer_map_${$t(this,sn)._++}`,h=b(this,li,Jn).call(this,l);n(this,wt,Lt).set(e,h),n(this,wt,Lt).set(o,h);const c=b(this,hi,Zn).call(this,l);return b(this,an,ja).call(this,i,r,a,c),h}addHCMFilter(e,s){var A;const i=`${e}-${s}`,r="base";let a=n(this,nn,Ua).get(r);if((a==null?void 0:a.key)===i||(a?((A=a.filter)==null||A.remove(),a.key=i,a.url="none",a.filter=null):(a={key:i,url:"none",filter:null},n(this,nn,Ua).set(r,a)),!e||!s))return a.url;const o=b(this,on,Wa).call(this,e);e=M.makeHexColor(...o);const l=b(this,on,Wa).call(this,s);if(s=M.makeHexColor(...l),n(this,oi,Qn).style.color="",e==="#000000"&&s==="#ffffff"||e===s)return a.url;const h=new Array(256);for(let _=0;_<=255;_++){const w=_/255;h[_]=w<=.03928?w/12.92:((w+.055)/1.055)**2.4}const c=h.join(","),u=`g_${n(this,xs)}_hcm_filter`,p=a.filter=b(this,hi,Zn).call(this,u);b(this,an,ja).call(this,c,c,c,p),b(this,Vo,wu).call(this,p);const m=(_,w)=>{const y=o[_]/255,v=l[_]/255,S=new Array(w+1);for(let E=0;E<=w;E++)S[E]=y+E/w*(v-y);return S.join(",")};return b(this,an,ja).call(this,m(0,5),m(1,5),m(2,5),p),a.url=b(this,li,Jn).call(this,u),a.url}addAlphaFilter(e){let s=n(this,wt,Lt).get(e);if(s)return s;const[i]=b(this,Rr,Th).call(this,[e]),r=`alpha_${i}`;if(s=n(this,wt,Lt).get(r),s)return n(this,wt,Lt).set(e,s),s;const a=`g_${n(this,xs)}_alpha_map_${$t(this,sn)._++}`,o=b(this,li,Jn).call(this,a);n(this,wt,Lt).set(e,o),n(this,wt,Lt).set(r,o);const l=b(this,hi,Zn).call(this,a);return b(this,jo,vu).call(this,i,l),o}addLuminosityFilter(e){let s=n(this,wt,Lt).get(e||"luminosity");if(s)return s;let i,r;if(e?([i]=b(this,Rr,Th).call(this,[e]),r=`luminosity_${i}`):r="luminosity",s=n(this,wt,Lt).get(r),s)return n(this,wt,Lt).set(e,s),s;const a=`g_${n(this,xs)}_luminosity_map_${$t(this,sn)._++}`,o=b(this,li,Jn).call(this,a);n(this,wt,Lt).set(e,o),n(this,wt,Lt).set(r,o);const l=b(this,hi,Zn).call(this,a);return b(this,Pc,Cp).call(this,l),e&&b(this,jo,vu).call(this,i,l),o}addHighlightHCMFilter(e,s,i,r,a){var v;const o=`${s}-${i}-${r}-${a}`;let l=n(this,nn,Ua).get(e);if((l==null?void 0:l.key)===o||(l?((v=l.filter)==null||v.remove(),l.key=o,l.url="none",l.filter=null):(l={key:o,url:"none",filter:null},n(this,nn,Ua).set(e,l)),!s||!i))return l.url;const[h,c]=[s,i].map(b(this,on,Wa).bind(this));let u=Math.round(.2126*h[0]+.7152*h[1]+.0722*h[2]),p=Math.round(.2126*c[0]+.7152*c[1]+.0722*c[2]),[m,A]=[r,a].map(b(this,on,Wa).bind(this));p<u&&([u,p,m,A]=[p,u,A,m]),n(this,oi,Qn).style.color="";const _=(S,E,x)=>{const C=new Array(256),T=(p-u)/x,k=S/255,D=(E-S)/(255*x);let U=0;for(let N=0;N<=x;N++){const Q=Math.round(u+N*T),lt=k+N*D;for(let j=U;j<=Q;j++)C[j]=lt;U=Q+1}for(let N=U;N<256;N++)C[N]=C[U-1];return C.join(",")},w=`g_${n(this,xs)}_hcm_${e}_filter`,y=l.filter=b(this,hi,Zn).call(this,w);return b(this,Vo,wu).call(this,y),b(this,an,ja).call(this,_(m[0],A[0],5),_(m[1],A[1],5),_(m[2],A[2],5),y),l.url=b(this,li,Jn).call(this,w),l.url}destroy(e=!1){var s,i,r,a;e&&((s=n(this,en))!=null&&s.size)||((i=n(this,Ss))==null||i.parentNode.parentNode.remove(),g(this,Ss,null),(r=n(this,Tr))==null||r.clear(),g(this,Tr,null),(a=n(this,en))==null||a.clear(),g(this,en,null),g(this,sn,0))}}tn=new WeakMap,Tr=new WeakMap,Ss=new WeakMap,xs=new WeakMap,Ft=new WeakMap,en=new WeakMap,sn=new WeakMap,wt=new WeakSet,Lt=function(){return n(this,Tr)||g(this,Tr,new Map)},nn=new WeakSet,Ua=function(){return n(this,en)||g(this,en,new Map)},oi=new WeakSet,Qn=function(){if(!n(this,Ss)){const e=n(this,Ft).createElement("div"),{style:s}=e;s.visibility="hidden",s.contain="strict",s.width=s.height=0,s.position="absolute",s.top=s.left=0,s.zIndex=-1;const i=n(this,Ft).createElementNS(ps,"svg");i.setAttribute("width",0),i.setAttribute("height",0),g(this,Ss,n(this,Ft).createElementNS(ps,"defs")),e.append(i),i.append(n(this,Ss)),n(this,Ft).body.append(e)}return n(this,Ss)},Rr=new WeakSet,Th=function(e){if(e.length===1){const h=e[0],c=new Array(256);for(let p=0;p<256;p++)c[p]=h[p]/255;const u=c.join(",");return[u,u,u]}const[s,i,r]=e,a=new Array(256),o=new Array(256),l=new Array(256);for(let h=0;h<256;h++)a[h]=s[h]/255,o[h]=i[h]/255,l[h]=r[h]/255;return[a.join(","),o.join(","),l.join(",")]},li=new WeakSet,Jn=function(e){if(n(this,tn)===void 0){g(this,tn,"");const s=n(this,Ft).URL;s!==n(this,Ft).baseURI&&($d(s)?B('#createUrl: ignore "data:"-URL for performance reasons.'):g(this,tn,s.split("#",1)[0]))}return`url(${n(this,tn)}#${e})`},Pc=new WeakSet,Cp=function(e){const s=n(this,Ft).createElementNS(ps,"feColorMatrix");s.setAttribute("type","matrix"),s.setAttribute("values","0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.3 0.59 0.11 0 0"),e.append(s)},Vo=new WeakSet,wu=function(e){const s=n(this,Ft).createElementNS(ps,"feColorMatrix");s.setAttribute("type","matrix"),s.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"),e.append(s)},hi=new WeakSet,Zn=function(e){const s=n(this,Ft).createElementNS(ps,"filter");return s.setAttribute("color-interpolation-filters","sRGB"),s.setAttribute("id",e),n(this,oi,Qn).append(s),s},rn=new WeakSet,Va=function(e,s,i){const r=n(this,Ft).createElementNS(ps,s);r.setAttribute("type","discrete"),r.setAttribute("tableValues",i),e.append(r)},an=new WeakSet,ja=function(e,s,i,r){const a=n(this,Ft).createElementNS(ps,"feComponentTransfer");r.append(a),b(this,rn,Va).call(this,a,"feFuncR",e),b(this,rn,Va).call(this,a,"feFuncG",s),b(this,rn,Va).call(this,a,"feFuncB",i)},jo=new WeakSet,vu=function(e,s){const i=n(this,Ft).createElementNS(ps,"feComponentTransfer");s.append(i),b(this,rn,Va).call(this,i,"feFuncA",e)},on=new WeakSet,Wa=function(e){return n(this,oi,Qn).style.color=e,mf(getComputedStyle(n(this,oi,Qn)).getPropertyValue("color"))};class Tp{constructor({baseUrl:t=null}){this.baseUrl=t}async fetch({filename:t}){if(!this.baseUrl)throw new Error("Ensure that the `standardFontDataUrl` API parameter is provided.");if(!t)throw new Error("Font filename must be specified.");const e=`${this.baseUrl}${t}`;return this._fetch(e).catch(s=>{throw new Error(`Unable to load font data at: ${e}`)})}async _fetch(t){K("Abstract method `_fetch` called.")}}class Rp extends Tp{async _fetch(t){const e=await Bd(t,"arraybuffer");return new Uint8Array(e)}}async function Pp(d){const e=await process.getBuiltinModule("fs").promises.readFile(d);return new Uint8Array(e)}class _m extends xp{}class ym extends vp{_createCanvas(t,e){return process.getBuiltinModule("module").createRequire("file:///home/runner/work/pdf.js/pdf.js/src/display/node_utils.js")("@napi-rs/canvas").createCanvas(t,e)}}class wm extends Ep{async _fetch(t){return Pp(t)}}class vm extends Tp{async _fetch(t){return Pp(t)}}const Ht={FILL:"Fill",STROKE:"Stroke",SHADING:"Shading"};function Eu(d,t){if(!t)return;const e=t[2]-t[0],s=t[3]-t[1],i=new Path2D;i.rect(t[0],t[1],e,s),d.clip(i)}class Af{getPattern(){K("Abstract method `getPattern` called.")}}class Em extends Af{constructor(t){super(),this._type=t[1],this._bbox=t[2],this._colorStops=t[3],this._p0=t[4],this._p1=t[5],this._r0=t[6],this._r1=t[7],this.matrix=null}_createGradient(t){let e;this._type==="axial"?e=t.createLinearGradient(this._p0[0],this._p0[1],this._p1[0],this._p1[1]):this._type==="radial"&&(e=t.createRadialGradient(this._p0[0],this._p0[1],this._r0,this._p1[0],this._p1[1],this._r1));for(const s of this._colorStops)e.addColorStop(s[0],s[1]);return e}getPattern(t,e,s,i){let r;if(i===Ht.STROKE||i===Ht.FILL){const a=e.current.getClippedPathBoundingBox(i,et(t))||[0,0,0,0],o=Math.ceil(a[2]-a[0])||1,l=Math.ceil(a[3]-a[1])||1,h=e.cachedCanvases.getCanvas("pattern",o,l),c=h.context;c.clearRect(0,0,c.canvas.width,c.canvas.height),c.beginPath(),c.rect(0,0,c.canvas.width,c.canvas.height),c.translate(-a[0],-a[1]),s=M.transform(s,[1,0,0,1,a[0],a[1]]),c.transform(...e.baseTransform),this.matrix&&c.transform(...this.matrix),Eu(c,this._bbox),c.fillStyle=this._createGradient(c),c.fill(),r=t.createPattern(h.canvas,"no-repeat");const u=new DOMMatrix(s);r.setTransform(u)}else Eu(t,this._bbox),r=this._createGradient(t);return r}}function qd(d,t,e,s,i,r,a,o){const l=t.coords,h=t.colors,c=d.data,u=d.width*4;let p;l[e+1]>l[s+1]&&(p=e,e=s,s=p,p=r,r=a,a=p),l[s+1]>l[i+1]&&(p=s,s=i,i=p,p=a,a=o,o=p),l[e+1]>l[s+1]&&(p=e,e=s,s=p,p=r,r=a,a=p);const m=(l[e]+t.offsetX)*t.scaleX,A=(l[e+1]+t.offsetY)*t.scaleY,_=(l[s]+t.offsetX)*t.scaleX,w=(l[s+1]+t.offsetY)*t.scaleY,y=(l[i]+t.offsetX)*t.scaleX,v=(l[i+1]+t.offsetY)*t.scaleY;if(A>=v)return;const S=h[r],E=h[r+1],x=h[r+2],C=h[a],T=h[a+1],k=h[a+2],D=h[o],U=h[o+1],N=h[o+2],Q=Math.round(A),lt=Math.round(v);let j,Bt,q,L,F,Ve,Se,fe;for(let kt=Q;kt<=lt;kt++){if(kt<w){const Z=kt<A?0:(A-kt)/(A-w);j=m-(m-_)*Z,Bt=S-(S-C)*Z,q=E-(E-T)*Z,L=x-(x-k)*Z}else{let Z;kt>v?Z=1:w===v?Z=0:Z=(w-kt)/(w-v),j=_-(_-y)*Z,Bt=C-(C-D)*Z,q=T-(T-U)*Z,L=k-(k-N)*Z}let pt;kt<A?pt=0:kt>v?pt=1:pt=(A-kt)/(A-v),F=m-(m-y)*pt,Ve=S-(S-D)*pt,Se=E-(E-U)*pt,fe=x-(x-N)*pt;const Yn=Math.round(Math.min(j,F)),Fa=Math.round(Math.max(j,F));let qt=u*kt+Yn*4;for(let Z=Yn;Z<=Fa;Z++)pt=(j-Z)/(j-F),pt<0?pt=0:pt>1&&(pt=1),c[qt++]=Bt-(Bt-Ve)*pt|0,c[qt++]=q-(q-Se)*pt|0,c[qt++]=L-(L-fe)*pt|0,c[qt++]=255}}function Sm(d,t,e){const s=t.coords,i=t.colors;let r,a;switch(t.type){case"lattice":const o=t.verticesPerRow,l=Math.floor(s.length/o)-1,h=o-1;for(r=0;r<l;r++){let c=r*o;for(let u=0;u<h;u++,c++)qd(d,e,s[c],s[c+1],s[c+o],i[c],i[c+1],i[c+o]),qd(d,e,s[c+o+1],s[c+1],s[c+o],i[c+o+1],i[c+1],i[c+o])}break;case"triangles":for(r=0,a=s.length;r<a;r+=3)qd(d,e,s[r],s[r+1],s[r+2],i[r],i[r+1],i[r+2]);break;default:throw new Error("illegal figure")}}class xm extends Af{constructor(t){super(),this._coords=t[2],this._colors=t[3],this._figures=t[4],this._bounds=t[5],this._bbox=t[7],this._background=t[8],this.matrix=null}_createMeshCanvas(t,e,s){const o=Math.floor(this._bounds[0]),l=Math.floor(this._bounds[1]),h=Math.ceil(this._bounds[2])-o,c=Math.ceil(this._bounds[3])-l,u=Math.min(Math.ceil(Math.abs(h*t[0]*1.1)),3e3),p=Math.min(Math.ceil(Math.abs(c*t[1]*1.1)),3e3),m=h/u,A=c/p,_={coords:this._coords,colors:this._colors,offsetX:-o,offsetY:-l,scaleX:1/m,scaleY:1/A},w=u+2*2,y=p+2*2,v=s.getCanvas("mesh",w,y),S=v.context,E=S.createImageData(u,p);if(e){const C=E.data;for(let T=0,k=C.length;T<k;T+=4)C[T]=e[0],C[T+1]=e[1],C[T+2]=e[2],C[T+3]=255}for(const C of this._figures)Sm(E,C,_);return S.putImageData(E,2,2),{canvas:v.canvas,offsetX:o-2*m,offsetY:l-2*A,scaleX:m,scaleY:A}}getPattern(t,e,s,i){Eu(t,this._bbox);let r;if(i===Ht.SHADING)r=M.singularValueDecompose2dScale(et(t));else if(r=M.singularValueDecompose2dScale(e.baseTransform),this.matrix){const o=M.singularValueDecompose2dScale(this.matrix);r=[r[0]*o[0],r[1]*o[1]]}const a=this._createMeshCanvas(r,i===Ht.SHADING?null:this._background,e.cachedCanvases);return i!==Ht.SHADING&&(t.setTransform(...e.baseTransform),this.matrix&&t.transform(...this.matrix)),t.translate(a.offsetX,a.offsetY),t.scale(a.scaleX,a.scaleY),t.createPattern(a.canvas,"no-repeat")}}class Cm extends Af{getPattern(){return"hotpink"}}function Tm(d){switch(d[0]){case"RadialAxial":return new Em(d);case"Mesh":return new xm(d);case"Dummy":return new Cm}throw new Error(`Unknown IR type: ${d[0]}`)}const Mf={COLORED:1,UNCOLORED:2},kc=class kc{constructor(t,e,s,i,r){this.operatorList=t[2],this.matrix=t[3],this.bbox=t[4],this.xstep=t[5],this.ystep=t[6],this.paintType=t[7],this.tilingType=t[8],this.color=e,this.ctx=s,this.canvasGraphicsFactory=i,this.baseTransform=r}createPatternCanvas(t){const{bbox:e,operatorList:s,paintType:i,tilingType:r,color:a,canvasGraphicsFactory:o}=this;let{xstep:l,ystep:h}=this;l=Math.abs(l),h=Math.abs(h),Od("TilingType: "+r);const c=e[0],u=e[1],p=e[2],m=e[3],A=p-c,_=m-u,w=M.singularValueDecompose2dScale(this.matrix),y=M.singularValueDecompose2dScale(this.baseTransform),v=w[0]*y[0],S=w[1]*y[1];let E=A,x=_,C=!1,T=!1;const k=Math.ceil(l*v),D=Math.ceil(h*S),U=Math.ceil(A*v),N=Math.ceil(_*S);k>=U?E=l:C=!0,D>=N?x=h:T=!0;const Q=this.getSizeAndScale(E,this.ctx.canvas.width,v),lt=this.getSizeAndScale(x,this.ctx.canvas.height,S),j=t.cachedCanvases.getCanvas("pattern",Q.size,lt.size),Bt=j.context,q=o.createCanvasGraphics(Bt);if(q.groupLevel=t.groupLevel,this.setFillAndStrokeStyleToContext(q,i,a),Bt.translate(-Q.scale*c,-lt.scale*u),q.transform(Q.scale,0,0,lt.scale,0,0),Bt.save(),this.clipBbox(q,c,u,p,m),q.baseTransform=et(q.ctx),q.executeOperatorList(s),q.endDrawing(),Bt.restore(),C||T){const L=j.canvas;C&&(E=l),T&&(x=h);const F=this.getSizeAndScale(E,this.ctx.canvas.width,v),Ve=this.getSizeAndScale(x,this.ctx.canvas.height,S),Se=F.size,fe=Ve.size,kt=t.cachedCanvases.getCanvas("pattern-workaround",Se,fe),pt=kt.context,Yn=C?Math.floor(A/l):0,Fa=T?Math.floor(_/h):0;for(let qt=0;qt<=Yn;qt++)for(let Z=0;Z<=Fa;Z++)pt.drawImage(L,Se*qt,fe*Z,Se,fe,0,0,Se,fe);return{canvas:kt.canvas,scaleX:F.scale,scaleY:Ve.scale,offsetX:c,offsetY:u}}return{canvas:j.canvas,scaleX:Q.scale,scaleY:lt.scale,offsetX:c,offsetY:u}}getSizeAndScale(t,e,s){const i=Math.max(kc.MAX_PATTERN_SIZE,e);let r=Math.ceil(t*s);return r>=i?r=i:s=r/t,{scale:s,size:r}}clipBbox(t,e,s,i,r){const a=i-e,o=r-s;t.ctx.rect(e,s,a,o),t.current.updateRectMinMax(et(t.ctx),[e,s,i,r]),t.clip(),t.endPath()}setFillAndStrokeStyleToContext(t,e,s){const i=t.ctx,r=t.current;switch(e){case Mf.COLORED:const a=this.ctx;i.fillStyle=a.fillStyle,i.strokeStyle=a.strokeStyle,r.fillColor=a.fillStyle,r.strokeColor=a.strokeStyle;break;case Mf.UNCOLORED:const o=M.makeHexColor(s[0],s[1],s[2]);i.fillStyle=o,i.strokeStyle=o,r.fillColor=o,r.strokeColor=o;break;default:throw new Zg(`Unsupported paint type: ${e}`)}}getPattern(t,e,s,i){let r=s;i!==Ht.SHADING&&(r=M.transform(r,e.baseTransform),this.matrix&&(r=M.transform(r,this.matrix)));const a=this.createPatternCanvas(e);let o=new DOMMatrix(r);o=o.translate(a.offsetX,a.offsetY),o=o.scale(1/a.scaleX,1/a.scaleY);const l=t.createPattern(a.canvas,"repeat");return l.setTransform(o),l}};I(kc,"MAX_PATTERN_SIZE",3e3);let Su=kc;function Rm({src:d,srcPos:t=0,dest:e,width:s,height:i,nonBlackColor:r=4294967295,inverseDecode:a=!1}){const o=Wt.isLittleEndian?4278190080:255,[l,h]=a?[r,o]:[o,r],c=s>>3,u=s&7,p=d.length;e=new Uint32Array(e.buffer);let m=0;for(let A=0;A<i;A++){for(const w=t+c;t<w;t++){const y=t<p?d[t]:255;e[m++]=y&128?h:l,e[m++]=y&64?h:l,e[m++]=y&32?h:l,e[m++]=y&16?h:l,e[m++]=y&8?h:l,e[m++]=y&4?h:l,e[m++]=y&2?h:l,e[m++]=y&1?h:l}if(u===0)continue;const _=t<p?d[t++]:255;for(let w=0;w<u;w++)e[m++]=_&1<<7-w?h:l}return{srcPos:t,destPos:m}}const Lf=16,If=100,Pm=15,Df=10,Ff=1e3,te=16;function km(d,t){if(d._removeMirroring)throw new Error("Context is already forwarding operations.");d.__originalSave=d.save,d.__originalRestore=d.restore,d.__originalRotate=d.rotate,d.__originalScale=d.scale,d.__originalTranslate=d.translate,d.__originalTransform=d.transform,d.__originalSetTransform=d.setTransform,d.__originalResetTransform=d.resetTransform,d.__originalClip=d.clip,d.__originalMoveTo=d.moveTo,d.__originalLineTo=d.lineTo,d.__originalBezierCurveTo=d.bezierCurveTo,d.__originalRect=d.rect,d.__originalClosePath=d.closePath,d.__originalBeginPath=d.beginPath,d._removeMirroring=()=>{d.save=d.__originalSave,d.restore=d.__originalRestore,d.rotate=d.__originalRotate,d.scale=d.__originalScale,d.translate=d.__originalTranslate,d.transform=d.__originalTransform,d.setTransform=d.__originalSetTransform,d.resetTransform=d.__originalResetTransform,d.clip=d.__originalClip,d.moveTo=d.__originalMoveTo,d.lineTo=d.__originalLineTo,d.bezierCurveTo=d.__originalBezierCurveTo,d.rect=d.__originalRect,d.closePath=d.__originalClosePath,d.beginPath=d.__originalBeginPath,delete d._removeMirroring},d.save=function(){t.save(),this.__originalSave()},d.restore=function(){t.restore(),this.__originalRestore()},d.translate=function(s,i){t.translate(s,i),this.__originalTranslate(s,i)},d.scale=function(s,i){t.scale(s,i),this.__originalScale(s,i)},d.transform=function(s,i,r,a,o,l){t.transform(s,i,r,a,o,l),this.__originalTransform(s,i,r,a,o,l)},d.setTransform=function(s,i,r,a,o,l){t.setTransform(s,i,r,a,o,l),this.__originalSetTransform(s,i,r,a,o,l)},d.resetTransform=function(){t.resetTransform(),this.__originalResetTransform()},d.rotate=function(s){t.rotate(s),this.__originalRotate(s)},d.clip=function(s){t.clip(s),this.__originalClip(s)},d.moveTo=function(e,s){t.moveTo(e,s),this.__originalMoveTo(e,s)},d.lineTo=function(e,s){t.lineTo(e,s),this.__originalLineTo(e,s)},d.bezierCurveTo=function(e,s,i,r,a,o){t.bezierCurveTo(e,s,i,r,a,o),this.__originalBezierCurveTo(e,s,i,r,a,o)},d.rect=function(e,s,i,r){t.rect(e,s,i,r),this.__originalRect(e,s,i,r)},d.closePath=function(){t.closePath(),this.__originalClosePath()},d.beginPath=function(){t.beginPath(),this.__originalBeginPath()}}class Mm{constructor(t){this.canvasFactory=t,this.cache=Object.create(null)}getCanvas(t,e,s){let i;return this.cache[t]!==void 0?(i=this.cache[t],this.canvasFactory.reset(i,e,s)):(i=this.canvasFactory.create(e,s),this.cache[t]=i),i}delete(t){delete this.cache[t]}clear(){for(const t in this.cache){const e=this.cache[t];this.canvasFactory.destroy(e),delete this.cache[t]}}}function gh(d,t,e,s,i,r,a,o,l,h){const[c,u,p,m,A,_]=et(d);if(u===0&&p===0){const v=a*c+A,S=Math.round(v),E=o*m+_,x=Math.round(E),C=(a+l)*c+A,T=Math.abs(Math.round(C)-S)||1,k=(o+h)*m+_,D=Math.abs(Math.round(k)-x)||1;return d.setTransform(Math.sign(c),0,0,Math.sign(m),S,x),d.drawImage(t,e,s,i,r,0,0,T,D),d.setTransform(c,u,p,m,A,_),[T,D]}if(c===0&&m===0){const v=o*p+A,S=Math.round(v),E=a*u+_,x=Math.round(E),C=(o+h)*p+A,T=Math.abs(Math.round(C)-S)||1,k=(a+l)*u+_,D=Math.abs(Math.round(k)-x)||1;return d.setTransform(0,Math.sign(u),Math.sign(p),0,S,x),d.drawImage(t,e,s,i,r,0,0,D,T),d.setTransform(c,u,p,m,A,_),[D,T]}d.drawImage(t,e,s,i,r,a,o,l,h);const w=Math.hypot(c,u),y=Math.hypot(p,m);return[w*l,y*h]}function Lm(d){const{width:t,height:e}=d;if(t>Ff||e>Ff)return null;const s=1e3,i=new Uint8Array([0,2,4,0,1,0,5,4,8,10,0,8,0,2,1,0]),r=t+1;let a=new Uint8Array(r*(e+1)),o,l,h;const c=t+7&-8;let u=new Uint8Array(c*e),p=0;for(const y of d.data){let v=128;for(;v>0;)u[p++]=y&v?0:255,v>>=1}let m=0;for(p=0,u[p]!==0&&(a[0]=1,++m),l=1;l<t;l++)u[p]!==u[p+1]&&(a[l]=u[p]?2:1,++m),p++;for(u[p]!==0&&(a[l]=2,++m),o=1;o<e;o++){p=o*c,h=o*r,u[p-c]!==u[p]&&(a[h]=u[p]?1:8,++m);let y=(u[p]?4:0)+(u[p-c]?8:0);for(l=1;l<t;l++)y=(y>>2)+(u[p+1]?4:0)+(u[p-c+1]?8:0),i[y]&&(a[h+l]=i[y],++m),p++;if(u[p-c]!==u[p]&&(a[h+l]=u[p]?2:4,++m),m>s)return null}for(p=c*(e-1),h=o*r,u[p]!==0&&(a[h]=8,++m),l=1;l<t;l++)u[p]!==u[p+1]&&(a[h+l]=u[p]?4:8,++m),p++;if(u[p]!==0&&(a[h+l]=4,++m),m>s)return null;const A=new Int32Array([0,r,-1,0,-r,0,0,0,1]),_=new Path2D;for(o=0;m&&o<=e;o++){let y=o*r;const v=y+t;for(;y<v&&!a[y];)y++;if(y===v)continue;_.moveTo(y%r,o);const S=y;let E=a[y];do{const x=A[E];do y+=x;while(!a[y]);const C=a[y];C!==5&&C!==10?(E=C,a[y]=0):(E=C&51*E>>4,a[y]&=E>>2|E<<2),_.lineTo(y%r,y/r|0),a[y]||--m}while(S!==y);--o}return u=null,a=null,function(y){y.save(),y.scale(1/t,-1/e),y.translate(0,-e),y.fill(_),y.beginPath(),y.restore()}}class Of{constructor(t,e){this.alphaIsShape=!1,this.fontSize=0,this.fontSizeScale=1,this.textMatrix=Wf,this.textMatrixScale=1,this.fontMatrix=Kd,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=Mt.FILL,this.textRise=0,this.fillColor="#000000",this.strokeColor="#000000",this.patternFill=!1,this.patternStroke=!1,this.fillAlpha=1,this.strokeAlpha=1,this.lineWidth=1,this.activeSMask=null,this.transferMaps="none",this.startNewPathAndClipBox([0,0,t,e])}clone(){const t=Object.create(this);return t.clipBox=this.clipBox.slice(),t}setCurrentPoint(t,e){this.x=t,this.y=e}updatePathMinMax(t,e,s){[e,s]=M.applyTransform([e,s],t),this.minX=Math.min(this.minX,e),this.minY=Math.min(this.minY,s),this.maxX=Math.max(this.maxX,e),this.maxY=Math.max(this.maxY,s)}updateRectMinMax(t,e){const s=M.applyTransform(e,t),i=M.applyTransform(e.slice(2),t),r=M.applyTransform([e[0],e[3]],t),a=M.applyTransform([e[2],e[1]],t);this.minX=Math.min(this.minX,s[0],i[0],r[0],a[0]),this.minY=Math.min(this.minY,s[1],i[1],r[1],a[1]),this.maxX=Math.max(this.maxX,s[0],i[0],r[0],a[0]),this.maxY=Math.max(this.maxY,s[1],i[1],r[1],a[1])}updateScalingPathMinMax(t,e){M.scaleMinMax(t,e),this.minX=Math.min(this.minX,e[0]),this.minY=Math.min(this.minY,e[1]),this.maxX=Math.max(this.maxX,e[2]),this.maxY=Math.max(this.maxY,e[3])}updateCurvePathMinMax(t,e,s,i,r,a,o,l,h,c){const u=M.bezierBoundingBox(e,s,i,r,a,o,l,h,c);c||this.updateRectMinMax(t,u)}getPathBoundingBox(t=Ht.FILL,e=null){const s=[this.minX,this.minY,this.maxX,this.maxY];if(t===Ht.STROKE){e||K("Stroke bounding box must include transform.");const i=M.singularValueDecompose2dScale(e),r=i[0]*this.lineWidth/2,a=i[1]*this.lineWidth/2;s[0]-=r,s[1]-=a,s[2]+=r,s[3]+=a}return s}updateClipFromPath(){const t=M.intersect(this.clipBox,this.getPathBoundingBox());this.startNewPathAndClipBox(t||[0,0,0,0])}isEmptyClip(){return this.minX===1/0}startNewPathAndClipBox(t){this.clipBox=t,this.minX=1/0,this.minY=1/0,this.maxX=0,this.maxY=0}getClippedPathBoundingBox(t=Ht.FILL,e=null){return M.intersect(this.clipBox,this.getPathBoundingBox(t,e))}}function Nf(d,t){if(t instanceof ImageData){d.putImageData(t,0,0);return}const e=t.height,s=t.width,i=e%te,r=(e-i)/te,a=i===0?r:r+1,o=d.createImageData(s,te);let l=0,h;const c=t.data,u=o.data;let p,m,A,_;if(t.kind===yh.GRAYSCALE_1BPP){const w=c.byteLength,y=new Uint32Array(u.buffer,0,u.byteLength>>2),v=y.length,S=s+7>>3,E=4294967295,x=Wt.isLittleEndian?4278190080:255;for(p=0;p<a;p++){for(A=p<r?te:i,h=0,m=0;m<A;m++){const C=w-l;let T=0;const k=C>S?s:C*8-7,D=k&-8;let U=0,N=0;for(;T<D;T+=8)N=c[l++],y[h++]=N&128?E:x,y[h++]=N&64?E:x,y[h++]=N&32?E:x,y[h++]=N&16?E:x,y[h++]=N&8?E:x,y[h++]=N&4?E:x,y[h++]=N&2?E:x,y[h++]=N&1?E:x;for(;T<k;T++)U===0&&(N=c[l++],U=128),y[h++]=N&U?E:x,U>>=1}for(;h<v;)y[h++]=0;d.putImageData(o,0,p*te)}}else if(t.kind===yh.RGBA_32BPP){for(m=0,_=s*te*4,p=0;p<r;p++)u.set(c.subarray(l,l+_)),l+=_,d.putImageData(o,0,m),m+=te;p<a&&(_=s*i*4,u.set(c.subarray(l,l+_)),d.putImageData(o,0,m))}else if(t.kind===yh.RGB_24BPP)for(A=te,_=s*A,p=0;p<a;p++){for(p>=r&&(A=i,_=s*A),h=0,m=_;m--;)u[h++]=c[l++],u[h++]=c[l++],u[h++]=c[l++],u[h++]=255;d.putImageData(o,0,p*te)}else throw new Error(`bad image kind: ${t.kind}`)}function Hf(d,t){if(t.bitmap){d.drawImage(t.bitmap,0,0);return}const e=t.height,s=t.width,i=e%te,r=(e-i)/te,a=i===0?r:r+1,o=d.createImageData(s,te);let l=0;const h=t.data,c=o.data;for(let u=0;u<a;u++){const p=u<r?te:i;({srcPos:l}=Rm({src:h,srcPos:l,dest:c,width:s,height:p,nonBlackColor:0})),d.putImageData(o,0,u*te)}}function Na(d,t){const e=["strokeStyle","fillStyle","fillRule","globalAlpha","lineWidth","lineCap","lineJoin","miterLimit","globalCompositeOperation","font","filter"];for(const s of e)d[s]!==void 0&&(t[s]=d[s]);d.setLineDash!==void 0&&(t.setLineDash(d.getLineDash()),t.lineDashOffset=d.lineDashOffset)}function mh(d){if(d.strokeStyle=d.fillStyle="#000000",d.fillRule="nonzero",d.globalAlpha=1,d.lineWidth=1,d.lineCap="butt",d.lineJoin="miter",d.miterLimit=10,d.globalCompositeOperation="source-over",d.font="10px sans-serif",d.setLineDash!==void 0&&(d.setLineDash([]),d.lineDashOffset=0),!jt){const{filter:t}=d;t!=="none"&&t!==""&&(d.filter="none")}}function Bf(d,t){if(t)return!0;const e=M.singularValueDecompose2dScale(d);e[0]=Math.fround(e[0]),e[1]=Math.fround(e[1]);const s=Math.fround((globalThis.devicePixelRatio||1)*Ri.PDF_TO_CSS_UNITS);return e[0]<=s&&e[1]<=s}const Im=["butt","round","square"],Dm=["miter","round","bevel"],Fm={},$f={};var Wo,xu,qo,Cu;const vf=class vf{constructor(t,e,s,i,r,{optionalContentConfig:a,markedContentStack:o=null},l,h){f(this,Wo);f(this,qo);this.ctx=t,this.current=new Of(this.ctx.canvas.width,this.ctx.canvas.height),this.stateStack=[],this.pendingClip=null,this.pendingEOFill=!1,this.res=null,this.xobjs=null,this.commonObjs=e,this.objs=s,this.canvasFactory=i,this.filterFactory=r,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=o||[],this.optionalContentConfig=a,this.cachedCanvases=new Mm(this.canvasFactory),this.cachedPatterns=new Map,this.annotationCanvasMap=l,this.viewportScale=1,this.outputScaleX=1,this.outputScaleY=1,this.pageColors=h,this._cachedScaleForStroking=[-1,0],this._cachedGetSinglePixelWidth=null,this._cachedBitmapsMap=new Map}getObject(t,e=null){return typeof t=="string"?t.startsWith("g_")?this.commonObjs.get(t):this.objs.get(t):e}beginDrawing({transform:t,viewport:e,transparency:s=!1,background:i=null}){const r=this.ctx.canvas.width,a=this.ctx.canvas.height,o=this.ctx.fillStyle;if(this.ctx.fillStyle=i||"#ffffff",this.ctx.fillRect(0,0,r,a),this.ctx.fillStyle=o,s){const l=this.cachedCanvases.getCanvas("transparent",r,a);this.compositeCtx=this.ctx,this.transparentCanvas=l.canvas,this.ctx=l.context,this.ctx.save(),this.ctx.transform(...et(this.compositeCtx))}this.ctx.save(),mh(this.ctx),t&&(this.ctx.transform(...t),this.outputScaleX=t[0],this.outputScaleY=t[0]),this.ctx.transform(...e.transform),this.viewportScale=e.scale,this.baseTransform=et(this.ctx)}executeOperatorList(t,e,s,i){const r=t.argsArray,a=t.fnArray;let o=e||0;const l=r.length;if(l===o)return o;const h=l-o>Df&&typeof s=="function",c=h?Date.now()+Pm:0;let u=0;const p=this.commonObjs,m=this.objs;let A;for(;;){if(i!==void 0&&o===i.nextBreakPoint)return i.breakIt(o,s),o;if(A=a[o],A!==Ce.dependency)this[A].apply(this,r[o]);else for(const _ of r[o]){const w=_.startsWith("g_")?p:m;if(!w.has(_))return w.get(_,s),o}if(o++,o===l)return o;if(h&&++u>Df){if(Date.now()>c)return s(),o;u=0}}}endDrawing(){b(this,Wo,xu).call(this),this.cachedCanvases.clear(),this.cachedPatterns.clear();for(const t of this._cachedBitmapsMap.values()){for(const e of t.values())typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement&&(e.width=e.height=0);t.clear()}this._cachedBitmapsMap.clear(),b(this,qo,Cu).call(this)}_scaleImage(t,e){const s=t.width??t.displayWidth,i=t.height??t.displayHeight;let r=Math.max(Math.hypot(e[0],e[1]),1),a=Math.max(Math.hypot(e[2],e[3]),1),o=s,l=i,h="prescale1",c,u;for(;r>2&&o>1||a>2&&l>1;){let p=o,m=l;r>2&&o>1&&(p=o>=16384?Math.floor(o/2)-1||1:Math.ceil(o/2),r/=o/p),a>2&&l>1&&(m=l>=16384?Math.floor(l/2)-1||1:Math.ceil(l)/2,a/=l/m),c=this.cachedCanvases.getCanvas(h,p,m),u=c.context,u.clearRect(0,0,p,m),u.drawImage(t,0,0,o,l,0,0,p,m),t=c.canvas,o=p,l=m,h=h==="prescale1"?"prescale2":"prescale1"}return{img:t,paintWidth:o,paintHeight:l}}_createMaskCanvas(t){const e=this.ctx,{width:s,height:i}=t,r=this.current.fillColor,a=this.current.patternFill,o=et(e);let l,h,c,u;if((t.bitmap||t.data)&&t.count>1){const k=t.bitmap||t.data.buffer;h=JSON.stringify(a?o:[o.slice(0,4),r]),l=this._cachedBitmapsMap.get(k),l||(l=new Map,this._cachedBitmapsMap.set(k,l));const D=l.get(h);if(D&&!a){const U=Math.round(Math.min(o[0],o[2])+o[4]),N=Math.round(Math.min(o[1],o[3])+o[5]);return{canvas:D,offsetX:U,offsetY:N}}c=D}c||(u=this.cachedCanvases.getCanvas("maskCanvas",s,i),Hf(u.context,t));let p=M.transform(o,[1/s,0,0,-1/i,0,0]);p=M.transform(p,[1,0,0,1,0,-i]);const[m,A,_,w]=M.getAxialAlignedBoundingBox([0,0,s,i],p),y=Math.round(_-m)||1,v=Math.round(w-A)||1,S=this.cachedCanvases.getCanvas("fillCanvas",y,v),E=S.context,x=m,C=A;E.translate(-x,-C),E.transform(...p),c||(c=this._scaleImage(u.canvas,je(E)),c=c.img,l&&a&&l.set(h,c)),E.imageSmoothingEnabled=Bf(et(E),t.interpolate),gh(E,c,0,0,c.width,c.height,0,0,s,i),E.globalCompositeOperation="source-in";const T=M.transform(je(E),[1,0,0,1,-x,-C]);return E.fillStyle=a?r.getPattern(e,this,T,Ht.FILL):r,E.fillRect(0,0,s,i),l&&!a&&(this.cachedCanvases.delete("fillCanvas"),l.set(h,S.canvas)),{canvas:S.canvas,offsetX:Math.round(x),offsetY:Math.round(C)}}setLineWidth(t){t!==this.current.lineWidth&&(this._cachedScaleForStroking[0]=-1),this.current.lineWidth=t,this.ctx.lineWidth=t}setLineCap(t){this.ctx.lineCap=Im[t]}setLineJoin(t){this.ctx.lineJoin=Dm[t]}setMiterLimit(t){this.ctx.miterLimit=t}setDash(t,e){const s=this.ctx;s.setLineDash!==void 0&&(s.setLineDash(t),s.lineDashOffset=e)}setRenderingIntent(t){}setFlatness(t){}setGState(t){for(const[e,s]of t)switch(e){case"LW":this.setLineWidth(s);break;case"LC":this.setLineCap(s);break;case"LJ":this.setLineJoin(s);break;case"ML":this.setMiterLimit(s);break;case"D":this.setDash(s[0],s[1]);break;case"RI":this.setRenderingIntent(s);break;case"FL":this.setFlatness(s);break;case"Font":this.setFont(s[0],s[1]);break;case"CA":this.current.strokeAlpha=s;break;case"ca":this.current.fillAlpha=s,this.ctx.globalAlpha=s;break;case"BM":this.ctx.globalCompositeOperation=s;break;case"SMask":this.current.activeSMask=s?this.tempSMask:null,this.tempSMask=null,this.checkSMaskState();break;case"TR":this.ctx.filter=this.current.transferMaps=this.filterFactory.addFilter(s);break}}get inSMaskMode(){return!!this.suspendedCtx}checkSMaskState(){const t=this.inSMaskMode;this.current.activeSMask&&!t?this.beginSMaskMode():!this.current.activeSMask&&t&&this.endSMaskMode()}beginSMaskMode(){if(this.inSMaskMode)throw new Error("beginSMaskMode called while already in smask mode");const t=this.ctx.canvas.width,e=this.ctx.canvas.height,s="smaskGroupAt"+this.groupLevel,i=this.cachedCanvases.getCanvas(s,t,e);this.suspendedCtx=this.ctx,this.ctx=i.context;const r=this.ctx;r.setTransform(...et(this.suspendedCtx)),Na(this.suspendedCtx,r),km(r,this.suspendedCtx),this.setGState([["BM","source-over"],["ca",1],["CA",1]])}endSMaskMode(){if(!this.inSMaskMode)throw new Error("endSMaskMode called while not in smask mode");this.ctx._removeMirroring(),Na(this.ctx,this.suspendedCtx),this.ctx=this.suspendedCtx,this.suspendedCtx=null}compose(t){if(!this.current.activeSMask)return;t?(t[0]=Math.floor(t[0]),t[1]=Math.floor(t[1]),t[2]=Math.ceil(t[2]),t[3]=Math.ceil(t[3])):t=[0,0,this.ctx.canvas.width,this.ctx.canvas.height];const e=this.current.activeSMask,s=this.suspendedCtx;this.composeSMask(s,e,this.ctx,t),this.ctx.save(),this.ctx.setTransform(1,0,0,1,0,0),this.ctx.clearRect(0,0,this.ctx.canvas.width,this.ctx.canvas.height),this.ctx.restore()}composeSMask(t,e,s,i){const r=i[0],a=i[1],o=i[2]-r,l=i[3]-a;o===0||l===0||(this.genericComposeSMask(e.context,s,o,l,e.subtype,e.backdrop,e.transferMap,r,a,e.offsetX,e.offsetY),t.save(),t.globalAlpha=1,t.globalCompositeOperation="source-over",t.setTransform(1,0,0,1,0,0),t.drawImage(s.canvas,0,0),t.restore())}genericComposeSMask(t,e,s,i,r,a,o,l,h,c,u){let p=t.canvas,m=l-c,A=h-u;if(a){const w=M.makeHexColor(...a);if(m<0||A<0||m+s>p.width||A+i>p.height){const y=this.cachedCanvases.getCanvas("maskExtension",s,i),v=y.context;v.drawImage(p,-m,-A),v.globalCompositeOperation="destination-atop",v.fillStyle=w,v.fillRect(0,0,s,i),v.globalCompositeOperation="source-over",p=y.canvas,m=A=0}else{t.save(),t.globalAlpha=1,t.setTransform(1,0,0,1,0,0);const y=new Path2D;y.rect(m,A,s,i),t.clip(y),t.globalCompositeOperation="destination-atop",t.fillStyle=w,t.fillRect(m,A,s,i),t.restore()}}e.save(),e.globalAlpha=1,e.setTransform(1,0,0,1,0,0),r==="Alpha"&&o?e.filter=this.filterFactory.addAlphaFilter(o):r==="Luminosity"&&(e.filter=this.filterFactory.addLuminosityFilter(o));const _=new Path2D;_.rect(l,h,s,i),e.clip(_),e.globalCompositeOperation="destination-in",e.drawImage(p,m,A,s,i,l,h,s,i),e.restore()}save(){this.inSMaskMode?(Na(this.ctx,this.suspendedCtx),this.suspendedCtx.save()):this.ctx.save();const t=this.current;this.stateStack.push(t),this.current=t.clone()}restore(){this.stateStack.length===0&&this.inSMaskMode&&this.endSMaskMode(),this.stateStack.length!==0&&(this.current=this.stateStack.pop(),this.inSMaskMode?(this.suspendedCtx.restore(),Na(this.suspendedCtx,this.ctx)):this.ctx.restore(),this.checkSMaskState(),this.pendingClip=null,this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null)}transform(t,e,s,i,r,a){this.ctx.transform(t,e,s,i,r,a),this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null}constructPath(t,e,s){const i=this.ctx,r=this.current;let a=r.x,o=r.y,l,h;const c=et(i),u=c[0]===0&&c[3]===0||c[1]===0&&c[2]===0,p=u?s.slice(0):null;for(let m=0,A=0,_=t.length;m<_;m++)switch(t[m]|0){case Ce.rectangle:a=e[A++],o=e[A++];const w=e[A++],y=e[A++],v=a+w,S=o+y;i.moveTo(a,o),w===0||y===0?i.lineTo(v,S):(i.lineTo(v,o),i.lineTo(v,S),i.lineTo(a,S)),u||r.updateRectMinMax(c,[a,o,v,S]),i.closePath();break;case Ce.moveTo:a=e[A++],o=e[A++],i.moveTo(a,o),u||r.updatePathMinMax(c,a,o);break;case Ce.lineTo:a=e[A++],o=e[A++],i.lineTo(a,o),u||r.updatePathMinMax(c,a,o);break;case Ce.curveTo:l=a,h=o,a=e[A+4],o=e[A+5],i.bezierCurveTo(e[A],e[A+1],e[A+2],e[A+3],a,o),r.updateCurvePathMinMax(c,l,h,e[A],e[A+1],e[A+2],e[A+3],a,o,p),A+=6;break;case Ce.curveTo2:l=a,h=o,i.bezierCurveTo(a,o,e[A],e[A+1],e[A+2],e[A+3]),r.updateCurvePathMinMax(c,l,h,a,o,e[A],e[A+1],e[A+2],e[A+3],p),a=e[A+2],o=e[A+3],A+=4;break;case Ce.curveTo3:l=a,h=o,a=e[A+2],o=e[A+3],i.bezierCurveTo(e[A],e[A+1],a,o,a,o),r.updateCurvePathMinMax(c,l,h,e[A],e[A+1],a,o,a,o,p),A+=4;break;case Ce.closePath:i.closePath();break}u&&r.updateScalingPathMinMax(c,p),r.setCurrentPoint(a,o)}closePath(){this.ctx.closePath()}stroke(t=!0){const e=this.ctx,s=this.current.strokeColor;e.globalAlpha=this.current.strokeAlpha,this.contentVisible&&(typeof s=="object"&&(s!=null&&s.getPattern)?(e.save(),e.strokeStyle=s.getPattern(e,this,je(e),Ht.STROKE),this.rescaleAndStroke(!1),e.restore()):this.rescaleAndStroke(!0)),t&&this.consumePath(this.current.getClippedPathBoundingBox()),e.globalAlpha=this.current.fillAlpha}closeStroke(){this.closePath(),this.stroke()}fill(t=!0){const e=this.ctx,s=this.current.fillColor,i=this.current.patternFill;let r=!1;i&&(e.save(),e.fillStyle=s.getPattern(e,this,je(e),Ht.FILL),r=!0);const a=this.current.getClippedPathBoundingBox();this.contentVisible&&a!==null&&(this.pendingEOFill?(e.fill("evenodd"),this.pendingEOFill=!1):e.fill()),r&&e.restore(),t&&this.consumePath(a)}eoFill(){this.pendingEOFill=!0,this.fill()}fillStroke(){this.fill(!1),this.stroke(!1),this.consumePath()}eoFillStroke(){this.pendingEOFill=!0,this.fillStroke()}closeFillStroke(){this.closePath(),this.fillStroke()}closeEOFillStroke(){this.pendingEOFill=!0,this.closePath(),this.fillStroke()}endPath(){this.consumePath()}clip(){this.pendingClip=Fm}eoClip(){this.pendingClip=$f}beginText(){this.current.textMatrix=Wf,this.current.textMatrixScale=1,this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0}endText(){const t=this.pendingTextPaths,e=this.ctx;if(t===void 0){e.beginPath();return}e.save(),e.beginPath();for(const s of t)e.setTransform(...s.transform),e.translate(s.x,s.y),s.addToPath(e,s.fontSize);e.restore(),e.clip(),e.beginPath(),delete this.pendingTextPaths}setCharSpacing(t){this.current.charSpacing=t}setWordSpacing(t){this.current.wordSpacing=t}setHScale(t){this.current.textHScale=t/100}setLeading(t){this.current.leading=-t}setFont(t,e){var c;const s=this.commonObjs.get(t),i=this.current;if(!s)throw new Error(`Can't find font for ${t}`);if(i.fontMatrix=s.fontMatrix||Kd,(i.fontMatrix[0]===0||i.fontMatrix[3]===0)&&B("Invalid font matrix for font "+t),e<0?(e=-e,i.fontDirection=-1):i.fontDirection=1,this.current.font=s,this.current.fontSize=e,s.isType3Font)return;const r=s.loadedName||"sans-serif",a=((c=s.systemFontInfo)==null?void 0:c.css)||`"${r}", ${s.fallbackName}`;let o="normal";s.black?o="900":s.bold&&(o="bold");const l=s.italic?"italic":"normal";let h=e;e<Lf?h=Lf:e>If&&(h=If),this.current.fontSizeScale=e/h,this.ctx.font=`${l} ${o} ${h}px ${a}`}setTextRenderingMode(t){this.current.textRenderingMode=t}setTextRise(t){this.current.textRise=t}moveText(t,e){this.current.x=this.current.lineX+=t,this.current.y=this.current.lineY+=e}setLeadingMoveText(t,e){this.setLeading(-e),this.moveText(t,e)}setTextMatrix(t,e,s,i,r,a){this.current.textMatrix=[t,e,s,i,r,a],this.current.textMatrixScale=Math.hypot(t,e),this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0}nextLine(){this.moveText(0,this.current.leading)}paintChar(t,e,s,i,r){const a=this.ctx,o=this.current,l=o.font,h=o.textRenderingMode,c=o.fontSize/o.fontSizeScale,u=h&Mt.FILL_STROKE_MASK,p=!!(h&Mt.ADD_TO_PATH_FLAG),m=o.patternFill&&!l.missingFile,A=o.patternStroke&&!l.missingFile;let _;(l.disableFontFace||p||m||A)&&(_=l.getPathGenerator(this.commonObjs,t)),l.disableFontFace||m||A?(a.save(),a.translate(e,s),a.beginPath(),_(a,c),(u===Mt.FILL||u===Mt.FILL_STROKE)&&(i&&a.setTransform(...i),a.fill()),(u===Mt.STROKE||u===Mt.FILL_STROKE)&&(r&&a.setTransform(...r),a.stroke()),a.restore()):((u===Mt.FILL||u===Mt.FILL_STROKE)&&a.fillText(t,e,s),(u===Mt.STROKE||u===Mt.FILL_STROKE)&&a.strokeText(t,e,s)),p&&(this.pendingTextPaths||(this.pendingTextPaths=[])).push({transform:et(a),x:e,y:s,fontSize:c,addToPath:_})}get isFontSubpixelAAEnabled(){const{context:t}=this.cachedCanvases.getCanvas("isFontSubpixelAAEnabled",10,10);t.scale(1.5,1),t.fillText("I",0,10);const e=t.getImageData(0,0,10,10).data;let s=!1;for(let i=3;i<e.length;i+=4)if(e[i]>0&&e[i]<255){s=!0;break}return G(this,"isFontSubpixelAAEnabled",s)}showText(t){const e=this.current,s=e.font;if(s.isType3Font)return this.showType3Text(t);const i=e.fontSize;if(i===0)return;const r=this.ctx,a=e.fontSizeScale,o=e.charSpacing,l=e.wordSpacing,h=e.fontDirection,c=e.textHScale*h,u=t.length,p=s.vertical,m=p?1:-1,A=s.defaultVMetrics,_=i*e.fontMatrix[0],w=e.textRenderingMode===Mt.FILL&&!s.disableFontFace&&!e.patternFill;r.save(),r.transform(...e.textMatrix),r.translate(e.x,e.y+e.textRise),h>0?r.scale(c,-1):r.scale(c,1);let y,v;if(e.patternFill){r.save();const T=e.fillColor.getPattern(r,this,je(r),Ht.FILL);y=et(r),r.restore(),r.fillStyle=T}if(e.patternStroke){r.save();const T=e.strokeColor.getPattern(r,this,je(r),Ht.STROKE);v=et(r),r.restore(),r.strokeStyle=T}let S=e.lineWidth;const E=e.textMatrixScale;if(E===0||S===0){const T=e.textRenderingMode&Mt.FILL_STROKE_MASK;(T===Mt.STROKE||T===Mt.FILL_STROKE)&&(S=this.getSinglePixelWidth())}else S/=E;if(a!==1&&(r.scale(a,a),S/=a),r.lineWidth=S,s.isInvalidPDFjsFont){const T=[];let k=0;for(const D of t)T.push(D.unicode),k+=D.width;r.fillText(T.join(""),0,0),e.x+=k*_*c,r.restore(),this.compose();return}let x=0,C;for(C=0;C<u;++C){const T=t[C];if(typeof T=="number"){x+=m*T*i/1e3;continue}let k=!1;const D=(T.isSpace?l:0)+o,U=T.fontChar,N=T.accent;let Q,lt,j=T.width;if(p){const q=T.vmetric||A,L=-(T.vmetric?q[1]:j*.5)*_,F=q[2]*_;j=q?-q[0]:j,Q=L/a,lt=(x+F)/a}else Q=x/a,lt=0;if(s.remeasure&&j>0){const q=r.measureText(U).width*1e3/i*a;if(j<q&&this.isFontSubpixelAAEnabled){const L=j/q;k=!0,r.save(),r.scale(L,1),Q/=L}else j!==q&&(Q+=(j-q)/2e3*i/a)}if(this.contentVisible&&(T.isInFont||s.missingFile)){if(w&&!N)r.fillText(U,Q,lt);else if(this.paintChar(U,Q,lt,y,v),N){const q=Q+i*N.offset.x/a,L=lt-i*N.offset.y/a;this.paintChar(N.fontChar,q,L,y,v)}}const Bt=p?j*_-D*h:j*_+D*h;x+=Bt,k&&r.restore()}p?e.y-=x:e.x+=x*c,r.restore(),this.compose()}showType3Text(t){const e=this.ctx,s=this.current,i=s.font,r=s.fontSize,a=s.fontDirection,o=i.vertical?1:-1,l=s.charSpacing,h=s.wordSpacing,c=s.textHScale*a,u=s.fontMatrix||Kd,p=t.length,m=s.textRenderingMode===Mt.INVISIBLE;let A,_,w,y;if(!(m||r===0)){for(this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null,e.save(),e.transform(...s.textMatrix),e.translate(s.x,s.y),e.scale(c,a),A=0;A<p;++A){if(_=t[A],typeof _=="number"){y=o*_*r/1e3,this.ctx.translate(y,0),s.x+=y*c;continue}const v=(_.isSpace?h:0)+l,S=i.charProcOperatorList[_.operatorListId];if(!S){B(`Type3 character "${_.operatorListId}" is not available.`);continue}this.contentVisible&&(this.processingType3=_,this.save(),e.scale(r,r),e.transform(...u),this.executeOperatorList(S),this.restore()),w=M.applyTransform([_.width,0],u)[0]*r+v,e.translate(w,0),s.x+=w*c}e.restore(),this.processingType3=null}}setCharWidth(t,e){}setCharWidthAndBounds(t,e,s,i,r,a){this.ctx.rect(s,i,r-s,a-i),this.ctx.clip(),this.endPath()}getColorN_Pattern(t){let e;if(t[0]==="TilingPattern"){const s=t[1],i=this.baseTransform||et(this.ctx),r={createCanvasGraphics:a=>new vf(a,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:this.optionalContentConfig,markedContentStack:this.markedContentStack})};e=new Su(t,s,this.ctx,r,i)}else e=this._getPattern(t[1],t[2]);return e}setStrokeColorN(){this.current.strokeColor=this.getColorN_Pattern(arguments),this.current.patternStroke=!0}setFillColorN(){this.current.fillColor=this.getColorN_Pattern(arguments),this.current.patternFill=!0}setStrokeRGBColor(t,e,s){this.ctx.strokeStyle=this.current.strokeColor=M.makeHexColor(t,e,s),this.current.patternStroke=!1}setStrokeTransparent(){this.ctx.strokeStyle=this.current.strokeColor="transparent",this.current.patternStroke=!1}setFillRGBColor(t,e,s){this.ctx.fillStyle=this.current.fillColor=M.makeHexColor(t,e,s),this.current.patternFill=!1}setFillTransparent(){this.ctx.fillStyle=this.current.fillColor="transparent",this.current.patternFill=!1}_getPattern(t,e=null){let s;return this.cachedPatterns.has(t)?s=this.cachedPatterns.get(t):(s=Tm(this.getObject(t)),this.cachedPatterns.set(t,s)),e&&(s.matrix=e),s}shadingFill(t){if(!this.contentVisible)return;const e=this.ctx;this.save();const s=this._getPattern(t);e.fillStyle=s.getPattern(e,this,je(e),Ht.SHADING);const i=je(e);if(i){const{width:r,height:a}=e.canvas,[o,l,h,c]=M.getAxialAlignedBoundingBox([0,0,r,a],i);this.ctx.fillRect(o,l,h-o,c-l)}else this.ctx.fillRect(-1e10,-1e10,2e10,2e10);this.compose(this.current.getClippedPathBoundingBox()),this.restore()}beginInlineImage(){K("Should not call beginInlineImage")}beginImageData(){K("Should not call beginImageData")}paintFormXObjectBegin(t,e){if(this.contentVisible&&(this.save(),this.baseTransformStack.push(this.baseTransform),t&&this.transform(...t),this.baseTransform=et(this.ctx),e)){const s=e[2]-e[0],i=e[3]-e[1];this.ctx.rect(e[0],e[1],s,i),this.current.updateRectMinMax(et(this.ctx),e),this.clip(),this.endPath()}}paintFormXObjectEnd(){this.contentVisible&&(this.restore(),this.baseTransform=this.baseTransformStack.pop())}beginGroup(t){if(!this.contentVisible)return;this.save(),this.inSMaskMode&&(this.endSMaskMode(),this.current.activeSMask=null);const e=this.ctx;t.isolated||Od("TODO: Support non-isolated groups."),t.knockout&&B("Knockout groups not supported.");const s=et(e);if(t.matrix&&e.transform(...t.matrix),!t.bbox)throw new Error("Bounding box is required.");let i=M.getAxialAlignedBoundingBox(t.bbox,et(e));const r=[0,0,e.canvas.width,e.canvas.height];i=M.intersect(i,r)||[0,0,0,0];const a=Math.floor(i[0]),o=Math.floor(i[1]),l=Math.max(Math.ceil(i[2])-a,1),h=Math.max(Math.ceil(i[3])-o,1);this.current.startNewPathAndClipBox([0,0,l,h]);let c="groupAt"+this.groupLevel;t.smask&&(c+="_smask_"+this.smaskCounter++%2);const u=this.cachedCanvases.getCanvas(c,l,h),p=u.context;p.translate(-a,-o),p.transform(...s),t.smask?this.smaskStack.push({canvas:u.canvas,context:p,offsetX:a,offsetY:o,subtype:t.smask.subtype,backdrop:t.smask.backdrop,transferMap:t.smask.transferMap||null,startTransformInverse:null}):(e.setTransform(1,0,0,1,0,0),e.translate(a,o),e.save()),Na(e,p),this.ctx=p,this.setGState([["BM","source-over"],["ca",1],["CA",1]]),this.groupStack.push(e),this.groupLevel++}endGroup(t){if(!this.contentVisible)return;this.groupLevel--;const e=this.ctx,s=this.groupStack.pop();if(this.ctx=s,this.ctx.imageSmoothingEnabled=!1,t.smask)this.tempSMask=this.smaskStack.pop(),this.restore();else{this.ctx.restore();const i=et(this.ctx);this.restore(),this.ctx.save(),this.ctx.setTransform(...i);const r=M.getAxialAlignedBoundingBox([0,0,e.canvas.width,e.canvas.height],i);this.ctx.drawImage(e.canvas,0,0),this.ctx.restore(),this.compose(r)}}beginAnnotation(t,e,s,i,r){if(b(this,Wo,xu).call(this),mh(this.ctx),this.ctx.save(),this.save(),this.baseTransform&&this.ctx.setTransform(...this.baseTransform),e){const a=e[2]-e[0],o=e[3]-e[1];if(r&&this.annotationCanvasMap){s=s.slice(),s[4]-=e[0],s[5]-=e[1],e=e.slice(),e[0]=e[1]=0,e[2]=a,e[3]=o;const[l,h]=M.singularValueDecompose2dScale(et(this.ctx)),{viewportScale:c}=this,u=Math.ceil(a*this.outputScaleX*c),p=Math.ceil(o*this.outputScaleY*c);this.annotationCanvas=this.canvasFactory.create(u,p);const{canvas:m,context:A}=this.annotationCanvas;this.annotationCanvasMap.set(t,m),this.annotationCanvas.savedCtx=this.ctx,this.ctx=A,this.ctx.save(),this.ctx.setTransform(l,0,0,-h,0,o*h),mh(this.ctx)}else mh(this.ctx),this.endPath(),this.ctx.rect(e[0],e[1],a,o),this.ctx.clip(),this.ctx.beginPath()}this.current=new Of(this.ctx.canvas.width,this.ctx.canvas.height),this.transform(...s),this.transform(...i)}endAnnotation(){this.annotationCanvas&&(this.ctx.restore(),b(this,qo,Cu).call(this),this.ctx=this.annotationCanvas.savedCtx,delete this.annotationCanvas.savedCtx,delete this.annotationCanvas)}paintImageMaskXObject(t){if(!this.contentVisible)return;const e=t.count;t=this.getObject(t.data,t),t.count=e;const s=this.ctx,i=this.processingType3;if(i&&(i.compiled===void 0&&(i.compiled=Lm(t)),i.compiled)){i.compiled(s);return}const r=this._createMaskCanvas(t),a=r.canvas;s.save(),s.setTransform(1,0,0,1,0,0),s.drawImage(a,r.offsetX,r.offsetY),s.restore(),this.compose()}paintImageMaskXObjectRepeat(t,e,s=0,i=0,r,a){if(!this.contentVisible)return;t=this.getObject(t.data,t);const o=this.ctx;o.save();const l=et(o);o.transform(e,s,i,r,0,0);const h=this._createMaskCanvas(t);o.setTransform(1,0,0,1,h.offsetX-l[4],h.offsetY-l[5]);for(let c=0,u=a.length;c<u;c+=2){const p=M.transform(l,[e,s,i,r,a[c],a[c+1]]),[m,A]=M.applyTransform([0,0],p);o.drawImage(h.canvas,m,A)}o.restore(),this.compose()}paintImageMaskXObjectGroup(t){if(!this.contentVisible)return;const e=this.ctx,s=this.current.fillColor,i=this.current.patternFill;for(const r of t){const{data:a,width:o,height:l,transform:h}=r,c=this.cachedCanvases.getCanvas("maskCanvas",o,l),u=c.context;u.save();const p=this.getObject(a,r);Hf(u,p),u.globalCompositeOperation="source-in",u.fillStyle=i?s.getPattern(u,this,je(e),Ht.FILL):s,u.fillRect(0,0,o,l),u.restore(),e.save(),e.transform(...h),e.scale(1,-1),gh(e,c.canvas,0,0,o,l,0,-1,1,1),e.restore()}this.compose()}paintImageXObject(t){if(!this.contentVisible)return;const e=this.getObject(t);if(!e){B("Dependent image isn't ready yet");return}this.paintInlineImageXObject(e)}paintImageXObjectRepeat(t,e,s,i){if(!this.contentVisible)return;const r=this.getObject(t);if(!r){B("Dependent image isn't ready yet");return}const a=r.width,o=r.height,l=[];for(let h=0,c=i.length;h<c;h+=2)l.push({transform:[e,0,0,s,i[h],i[h+1]],x:0,y:0,w:a,h:o});this.paintInlineImageXObjectGroup(r,l)}applyTransferMapsToCanvas(t){return this.current.transferMaps!=="none"&&(t.filter=this.current.transferMaps,t.drawImage(t.canvas,0,0),t.filter="none"),t.canvas}applyTransferMapsToBitmap(t){if(this.current.transferMaps==="none")return t.bitmap;const{bitmap:e,width:s,height:i}=t,r=this.cachedCanvases.getCanvas("inlineImage",s,i),a=r.context;return a.filter=this.current.transferMaps,a.drawImage(e,0,0),a.filter="none",r.canvas}paintInlineImageXObject(t){if(!this.contentVisible)return;const e=t.width,s=t.height,i=this.ctx;if(this.save(),!jt){const{filter:o}=i;o!=="none"&&o!==""&&(i.filter="none")}i.scale(1/e,-1/s);let r;if(t.bitmap)r=this.applyTransferMapsToBitmap(t);else if(typeof HTMLElement=="function"&&t instanceof HTMLElement||!t.data)r=t;else{const l=this.cachedCanvases.getCanvas("inlineImage",e,s).context;Nf(l,t),r=this.applyTransferMapsToCanvas(l)}const a=this._scaleImage(r,je(i));i.imageSmoothingEnabled=Bf(et(i),t.interpolate),gh(i,a.img,0,0,a.paintWidth,a.paintHeight,0,-s,e,s),this.compose(),this.restore()}paintInlineImageXObjectGroup(t,e){if(!this.contentVisible)return;const s=this.ctx;let i;if(t.bitmap)i=t.bitmap;else{const r=t.width,a=t.height,l=this.cachedCanvases.getCanvas("inlineImage",r,a).context;Nf(l,t),i=this.applyTransferMapsToCanvas(l)}for(const r of e)s.save(),s.transform(...r.transform),s.scale(1,-1),gh(s,i,r.x,r.y,r.w,r.h,0,-1,1,1),s.restore();this.compose()}paintSolidColorImageMask(){this.contentVisible&&(this.ctx.fillRect(0,0,1,1),this.compose())}markPoint(t){}markPointProps(t,e){}beginMarkedContent(t){this.markedContentStack.push({visible:!0})}beginMarkedContentProps(t,e){t==="OC"?this.markedContentStack.push({visible:this.optionalContentConfig.isVisible(e)}):this.markedContentStack.push({visible:!0}),this.contentVisible=this.isContentVisible()}endMarkedContent(){this.markedContentStack.pop(),this.contentVisible=this.isContentVisible()}beginCompat(){}endCompat(){}consumePath(t){const e=this.current.isEmptyClip();this.pendingClip&&this.current.updateClipFromPath(),this.pendingClip||this.compose(t);const s=this.ctx;this.pendingClip&&(e||(this.pendingClip===$f?s.clip("evenodd"):s.clip()),this.pendingClip=null),this.current.startNewPathAndClipBox(this.current.clipBox),s.beginPath()}getSinglePixelWidth(){if(!this._cachedGetSinglePixelWidth){const t=et(this.ctx);if(t[1]===0&&t[2]===0)this._cachedGetSinglePixelWidth=1/Math.min(Math.abs(t[0]),Math.abs(t[3]));else{const e=Math.abs(t[0]*t[3]-t[2]*t[1]),s=Math.hypot(t[0],t[2]),i=Math.hypot(t[1],t[3]);this._cachedGetSinglePixelWidth=Math.max(s,i)/e}}return this._cachedGetSinglePixelWidth}getScaleForStroking(){if(this._cachedScaleForStroking[0]===-1){const{lineWidth:t}=this.current,{a:e,b:s,c:i,d:r}=this.ctx.getTransform();let a,o;if(s===0&&i===0){const l=Math.abs(e),h=Math.abs(r);if(l===h)if(t===0)a=o=1/l;else{const c=l*t;a=o=c<1?1/c:1}else if(t===0)a=1/l,o=1/h;else{const c=l*t,u=h*t;a=c<1?1/c:1,o=u<1?1/u:1}}else{const l=Math.abs(e*r-s*i),h=Math.hypot(e,s),c=Math.hypot(i,r);if(t===0)a=c/l,o=h/l;else{const u=t*l;a=c>u?c/u:1,o=h>u?h/u:1}}this._cachedScaleForStroking[0]=a,this._cachedScaleForStroking[1]=o}return this._cachedScaleForStroking}rescaleAndStroke(t){const{ctx:e}=this,{lineWidth:s}=this.current,[i,r]=this.getScaleForStroking();if(e.lineWidth=s||1,i===1&&r===1){e.stroke();return}const a=e.getLineDash();if(t&&e.save(),e.scale(i,r),a.length>0){const o=Math.max(i,r);e.setLineDash(a.map(l=>l/o)),e.lineDashOffset/=o}e.stroke(),t&&e.restore()}isContentVisible(){for(let t=this.markedContentStack.length-1;t>=0;t--)if(!this.markedContentStack[t].visible)return!1;return!0}};Wo=new WeakSet,xu=function(){for(;this.stateStack.length||this.inSMaskMode;)this.restore();this.current.activeSMask=null,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)},qo=new WeakSet,Cu=function(){if(this.pageColors){const t=this.filterFactory.addHCMFilter(this.pageColors.foreground,this.pageColors.background);if(t!=="none"){const e=this.ctx.filter;this.ctx.filter=t,this.ctx.drawImage(this.ctx.canvas,0,0),this.ctx.filter=e}}};let ar=vf;for(const d in Ce)ar.prototype[d]!==void 0&&(ar.prototype[Ce[d]]=ar.prototype[d]);var Xo,Yo;class Vs{static get workerPort(){return n(this,Xo)}static set workerPort(t){if(!(typeof Worker<"u"&&t instanceof Worker)&&t!==null)throw new Error("Invalid `workerPort` type.");g(this,Xo,t)}static get workerSrc(){return n(this,Yo)}static set workerSrc(t){if(typeof t!="string")throw new Error("Invalid `workerSrc` type.");g(this,Yo,t)}}Xo=new WeakMap,Yo=new WeakMap,f(Vs,Xo,null),f(Vs,Yo,"");const bh={UNKNOWN:0,DATA:1,ERROR:2},ut={UNKNOWN:0,CANCEL:1,CANCEL_COMPLETE:2,CLOSE:3,ENQUEUE:4,ERROR:5,PULL:6,PULL_COMPLETE:7,START_COMPLETE:8};function ee(d){switch(d instanceof Error||typeof d=="object"&&d!==null||K('wrapReason: Expected "reason" to be a (possibly cloned) Error.'),d.name){case"AbortException":return new qn(d.message);case"MissingPDFException":return new dh(d.message);case"PasswordException":return new Qd(d.message,d.code);case"UnexpectedResponseException":return new Nd(d.message,d.status);case"UnknownErrorException":return new Jd(d.message,d.details);default:return new Jd(d.message,d.toString())}}var Pr,Mc,kp,Lc,Mp,Ic,Lp,kr,Rh;class qa{constructor(t,e,s){f(this,Mc);f(this,Lc);f(this,Ic);f(this,kr);f(this,Pr,new AbortController);this.sourceName=t,this.targetName=e,this.comObj=s,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),s.addEventListener("message",b(this,Mc,kp).bind(this),{signal:n(this,Pr).signal})}on(t,e){const s=this.actionHandler;if(s[t])throw new Error(`There is already an actionName called "${t}"`);s[t]=e}send(t,e,s){this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:t,data:e},s)}sendWithPromise(t,e,s){const i=this.callbackId++,r=Promise.withResolvers();this.callbackCapabilities[i]=r;try{this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:t,callbackId:i,data:e},s)}catch(a){r.reject(a)}return r.promise}sendWithStream(t,e,s,i){const r=this.streamId++,a=this.sourceName,o=this.targetName,l=this.comObj;return new ReadableStream({start:h=>{const c=Promise.withResolvers();return this.streamControllers[r]={controller:h,startCall:c,pullCall:null,cancelCall:null,isClosed:!1},l.postMessage({sourceName:a,targetName:o,action:t,streamId:r,data:e,desiredSize:h.desiredSize},i),c.promise},pull:h=>{const c=Promise.withResolvers();return this.streamControllers[r].pullCall=c,l.postMessage({sourceName:a,targetName:o,stream:ut.PULL,streamId:r,desiredSize:h.desiredSize}),c.promise},cancel:h=>{ft(h instanceof Error,"cancel must have a valid reason");const c=Promise.withResolvers();return this.streamControllers[r].cancelCall=c,this.streamControllers[r].isClosed=!0,l.postMessage({sourceName:a,targetName:o,stream:ut.CANCEL,streamId:r,reason:ee(h)}),c.promise}},s)}destroy(){var t;(t=n(this,Pr))==null||t.abort(),g(this,Pr,null)}}Pr=new WeakMap,Mc=new WeakSet,kp=function({data:t}){if(t.targetName!==this.sourceName)return;if(t.stream){b(this,Ic,Lp).call(this,t);return}if(t.callback){const s=t.callbackId,i=this.callbackCapabilities[s];if(!i)throw new Error(`Cannot resolve callback ${s}`);if(delete this.callbackCapabilities[s],t.callback===bh.DATA)i.resolve(t.data);else if(t.callback===bh.ERROR)i.reject(ee(t.reason));else throw new Error("Unexpected callback case");return}const e=this.actionHandler[t.action];if(!e)throw new Error(`Unknown action from worker: ${t.action}`);if(t.callbackId){const s=this.sourceName,i=t.sourceName,r=this.comObj;new Promise(function(a){a(e(t.data))}).then(function(a){r.postMessage({sourceName:s,targetName:i,callback:bh.DATA,callbackId:t.callbackId,data:a})},function(a){r.postMessage({sourceName:s,targetName:i,callback:bh.ERROR,callbackId:t.callbackId,reason:ee(a)})});return}if(t.streamId){b(this,Lc,Mp).call(this,t);return}e(t.data)},Lc=new WeakSet,Mp=function(t){const e=t.streamId,s=this.sourceName,i=t.sourceName,r=this.comObj,a=this,o=this.actionHandler[t.action],l={enqueue(h,c=1,u){if(this.isCancelled)return;const p=this.desiredSize;this.desiredSize-=c,p>0&&this.desiredSize<=0&&(this.sinkCapability=Promise.withResolvers(),this.ready=this.sinkCapability.promise),r.postMessage({sourceName:s,targetName:i,stream:ut.ENQUEUE,streamId:e,chunk:h},u)},close(){this.isCancelled||(this.isCancelled=!0,r.postMessage({sourceName:s,targetName:i,stream:ut.CLOSE,streamId:e}),delete a.streamSinks[e])},error(h){ft(h instanceof Error,"error must have a valid reason"),!this.isCancelled&&(this.isCancelled=!0,r.postMessage({sourceName:s,targetName:i,stream:ut.ERROR,streamId:e,reason:ee(h)}))},sinkCapability:Promise.withResolvers(),onPull:null,onCancel:null,isCancelled:!1,desiredSize:t.desiredSize,ready:null};l.sinkCapability.resolve(),l.ready=l.sinkCapability.promise,this.streamSinks[e]=l,new Promise(function(h){h(o(t.data,l))}).then(function(){r.postMessage({sourceName:s,targetName:i,stream:ut.START_COMPLETE,streamId:e,success:!0})},function(h){r.postMessage({sourceName:s,targetName:i,stream:ut.START_COMPLETE,streamId:e,reason:ee(h)})})},Ic=new WeakSet,Lp=function(t){const e=t.streamId,s=this.sourceName,i=t.sourceName,r=this.comObj,a=this.streamControllers[e],o=this.streamSinks[e];switch(t.stream){case ut.START_COMPLETE:t.success?a.startCall.resolve():a.startCall.reject(ee(t.reason));break;case ut.PULL_COMPLETE:t.success?a.pullCall.resolve():a.pullCall.reject(ee(t.reason));break;case ut.PULL:if(!o){r.postMessage({sourceName:s,targetName:i,stream:ut.PULL_COMPLETE,streamId:e,success:!0});break}o.desiredSize<=0&&t.desiredSize>0&&o.sinkCapability.resolve(),o.desiredSize=t.desiredSize,new Promise(function(l){var h;l((h=o.onPull)==null?void 0:h.call(o))}).then(function(){r.postMessage({sourceName:s,targetName:i,stream:ut.PULL_COMPLETE,streamId:e,success:!0})},function(l){r.postMessage({sourceName:s,targetName:i,stream:ut.PULL_COMPLETE,streamId:e,reason:ee(l)})});break;case ut.ENQUEUE:if(ft(a,"enqueue should have stream controller"),a.isClosed)break;a.controller.enqueue(t.chunk);break;case ut.CLOSE:if(ft(a,"close should have stream controller"),a.isClosed)break;a.isClosed=!0,a.controller.close(),b(this,kr,Rh).call(this,a,e);break;case ut.ERROR:ft(a,"error should have stream controller"),a.controller.error(ee(t.reason)),b(this,kr,Rh).call(this,a,e);break;case ut.CANCEL_COMPLETE:t.success?a.cancelCall.resolve():a.cancelCall.reject(ee(t.reason)),b(this,kr,Rh).call(this,a,e);break;case ut.CANCEL:if(!o)break;new Promise(function(l){var h;l((h=o.onCancel)==null?void 0:h.call(o,ee(t.reason)))}).then(function(){r.postMessage({sourceName:s,targetName:i,stream:ut.CANCEL_COMPLETE,streamId:e,success:!0})},function(l){r.postMessage({sourceName:s,targetName:i,stream:ut.CANCEL_COMPLETE,streamId:e,reason:ee(l)})}),o.sinkCapability.reject(ee(t.reason)),o.isCancelled=!0,delete this.streamSinks[e];break;default:throw new Error("Unexpected stream case")}},kr=new WeakSet,Rh=async function(t,e){var s,i,r;await Promise.allSettled([(s=t.startCall)==null?void 0:s.promise,(i=t.pullCall)==null?void 0:i.promise,(r=t.cancelCall)==null?void 0:r.promise]),delete this.streamControllers[e]};var ln,Ko;class Om{constructor({parsedData:t,rawData:e}){f(this,ln,void 0);f(this,Ko,void 0);g(this,ln,t),g(this,Ko,e)}getRaw(){return n(this,Ko)}get(t){return n(this,ln).get(t)??null}getAll(){return df(n(this,ln))}has(t){return n(this,ln).has(t)}}ln=new WeakMap,Ko=new WeakMap;const tr=Symbol("INTERNAL");var Qo,Jo,Zo,Mr;class Nm{constructor(t,{name:e,intent:s,usage:i,rbGroups:r}){f(this,Qo,!1);f(this,Jo,!1);f(this,Zo,!1);f(this,Mr,!0);g(this,Qo,!!(t&ue.DISPLAY)),g(this,Jo,!!(t&ue.PRINT)),this.name=e,this.intent=s,this.usage=i,this.rbGroups=r}get visible(){if(n(this,Zo))return n(this,Mr);if(!n(this,Mr))return!1;const{print:t,view:e}=this.usage;return n(this,Qo)?(e==null?void 0:e.viewState)!=="OFF":n(this,Jo)?(t==null?void 0:t.printState)!=="OFF":!0}_setVisible(t,e,s=!1){t!==tr&&K("Internal method `_setVisible` called."),g(this,Zo,s),g(this,Mr,e)}}Qo=new WeakMap,Jo=new WeakMap,Zo=new WeakMap,Mr=new WeakMap;var ci,Y,Lr,Ir,tl,Tu;class Hm{constructor(t,e=ue.DISPLAY){f(this,tl);f(this,ci,null);f(this,Y,new Map);f(this,Lr,null);f(this,Ir,null);if(this.renderingIntent=e,this.name=null,this.creator=null,t!==null){this.name=t.name,this.creator=t.creator,g(this,Ir,t.order);for(const s of t.groups)n(this,Y).set(s.id,new Nm(e,s));if(t.baseState==="OFF")for(const s of n(this,Y).values())s._setVisible(tr,!1);for(const s of t.on)n(this,Y).get(s)._setVisible(tr,!0);for(const s of t.off)n(this,Y).get(s)._setVisible(tr,!1);g(this,Lr,this.getHash())}}isVisible(t){if(n(this,Y).size===0)return!0;if(!t)return Od("Optional content group not defined."),!0;if(t.type==="OCG")return n(this,Y).has(t.id)?n(this,Y).get(t.id).visible:(B(`Optional content group not found: ${t.id}`),!0);if(t.type==="OCMD"){if(t.expression)return b(this,tl,Tu).call(this,t.expression);if(!t.policy||t.policy==="AnyOn"){for(const e of t.ids){if(!n(this,Y).has(e))return B(`Optional content group not found: ${e}`),!0;if(n(this,Y).get(e).visible)return!0}return!1}else if(t.policy==="AllOn"){for(const e of t.ids){if(!n(this,Y).has(e))return B(`Optional content group not found: ${e}`),!0;if(!n(this,Y).get(e).visible)return!1}return!0}else if(t.policy==="AnyOff"){for(const e of t.ids){if(!n(this,Y).has(e))return B(`Optional content group not found: ${e}`),!0;if(!n(this,Y).get(e).visible)return!0}return!1}else if(t.policy==="AllOff"){for(const e of t.ids){if(!n(this,Y).has(e))return B(`Optional content group not found: ${e}`),!0;if(n(this,Y).get(e).visible)return!1}return!0}return B(`Unknown optional content policy ${t.policy}.`),!0}return B(`Unknown group type ${t.type}.`),!0}setVisibility(t,e=!0,s=!0){var r;const i=n(this,Y).get(t);if(!i){B(`Optional content group not found: ${t}`);return}if(s&&e&&i.rbGroups.length)for(const a of i.rbGroups)for(const o of a)o!==t&&((r=n(this,Y).get(o))==null||r._setVisible(tr,!1,!0));i._setVisible(tr,!!e,!0),g(this,ci,null)}setOCGState({state:t,preserveRB:e}){let s;for(const i of t){switch(i){case"ON":case"OFF":case"Toggle":s=i;continue}const r=n(this,Y).get(i);if(r)switch(s){case"ON":this.setVisibility(i,!0,e);break;case"OFF":this.setVisibility(i,!1,e);break;case"Toggle":this.setVisibility(i,!r.visible,e);break}}g(this,ci,null)}get hasInitialVisibility(){return n(this,Lr)===null||this.getHash()===n(this,Lr)}getOrder(){return n(this,Y).size?n(this,Ir)?n(this,Ir).slice():[...n(this,Y).keys()]:null}getGroups(){return n(this,Y).size>0?df(n(this,Y)):null}getGroup(t){return n(this,Y).get(t)||null}getHash(){if(n(this,ci)!==null)return n(this,ci);const t=new _p;for(const[e,s]of n(this,Y))t.update(`${e}:${s.visible}`);return g(this,ci,t.hexdigest())}}ci=new WeakMap,Y=new WeakMap,Lr=new WeakMap,Ir=new WeakMap,tl=new WeakSet,Tu=function(t){const e=t.length;if(e<2)return!0;const s=t[0];for(let i=1;i<e;i++){const r=t[i];let a;if(Array.isArray(r))a=b(this,tl,Tu).call(this,r);else if(n(this,Y).has(r))a=n(this,Y).get(r).visible;else return B(`Optional content group not found: ${r}`),!0;switch(s){case"And":if(!a)return!1;break;case"Or":if(a)return!0;break;case"Not":return!a;default:return!0}}return s==="And"};class Bm{constructor(t,{disableRange:e=!1,disableStream:s=!1}){ft(t,'PDFDataTransportStream - missing required "pdfDataRangeTransport" argument.');const{length:i,initialData:r,progressiveDone:a,contentDispositionFilename:o}=t;if(this._queuedChunks=[],this._progressiveDone=a,this._contentDispositionFilename=o,(r==null?void 0:r.length)>0){const l=r instanceof Uint8Array&&r.byteLength===r.buffer.byteLength?r.buffer:new Uint8Array(r).buffer;this._queuedChunks.push(l)}this._pdfDataRangeTransport=t,this._isStreamingSupported=!s,this._isRangeSupported=!e,this._contentLength=i,this._fullRequestReader=null,this._rangeReaders=[],t.addRangeListener((l,h)=>{this._onReceiveData({begin:l,chunk:h})}),t.addProgressListener((l,h)=>{this._onProgress({loaded:l,total:h})}),t.addProgressiveReadListener(l=>{this._onReceiveData({chunk:l})}),t.addProgressiveDoneListener(()=>{this._onProgressiveDone()}),t.transportReady()}_onReceiveData({begin:t,chunk:e}){const s=e instanceof Uint8Array&&e.byteLength===e.buffer.byteLength?e.buffer:new Uint8Array(e).buffer;if(t===void 0)this._fullRequestReader?this._fullRequestReader._enqueue(s):this._queuedChunks.push(s);else{const i=this._rangeReaders.some(function(r){return r._begin!==t?!1:(r._enqueue(s),!0)});ft(i,"_onReceiveData - no `PDFDataTransportStreamRangeReader` instance found.")}}get _progressiveDataLength(){var t;return((t=this._fullRequestReader)==null?void 0:t._loaded)??0}_onProgress(t){var e,s,i,r;t.total===void 0?(s=(e=this._rangeReaders[0])==null?void 0:e.onProgress)==null||s.call(e,{loaded:t.loaded}):(r=(i=this._fullRequestReader)==null?void 0:i.onProgress)==null||r.call(i,{loaded:t.loaded,total:t.total})}_onProgressiveDone(){var t;(t=this._fullRequestReader)==null||t.progressiveDone(),this._progressiveDone=!0}_removeRangeReader(t){const e=this._rangeReaders.indexOf(t);e>=0&&this._rangeReaders.splice(e,1)}getFullReader(){ft(!this._fullRequestReader,"PDFDataTransportStream.getFullReader can only be called once.");const t=this._queuedChunks;return this._queuedChunks=null,new $m(this,t,this._progressiveDone,this._contentDispositionFilename)}getRangeReader(t,e){if(e<=this._progressiveDataLength)return null;const s=new Gm(this,t,e);return this._pdfDataRangeTransport.requestDataRange(t,e),this._rangeReaders.push(s),s}cancelAllRequests(t){var e;(e=this._fullRequestReader)==null||e.cancel(t);for(const s of this._rangeReaders.slice(0))s.cancel(t);this._pdfDataRangeTransport.abort()}}class $m{constructor(t,e,s=!1,i=null){this._stream=t,this._done=s||!1,this._filename=pf(i)?i:null,this._queuedChunks=e||[],this._loaded=0;for(const r of this._queuedChunks)this._loaded+=r.byteLength;this._requests=[],this._headersReady=Promise.resolve(),t._fullRequestReader=this,this.onProgress=null}_enqueue(t){this._done||(this._requests.length>0?this._requests.shift().resolve({value:t,done:!1}):this._queuedChunks.push(t),this._loaded+=t.byteLength)}get headersReady(){return this._headersReady}get filename(){return this._filename}get isRangeSupported(){return this._stream._isRangeSupported}get isStreamingSupported(){return this._stream._isStreamingSupported}get contentLength(){return this._stream._contentLength}async read(){if(this._queuedChunks.length>0)return{value:this._queuedChunks.shift(),done:!1};if(this._done)return{value:void 0,done:!0};const t=Promise.withResolvers();return this._requests.push(t),t.promise}cancel(t){this._done=!0;for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0}progressiveDone(){this._done||(this._done=!0)}}class Gm{constructor(t,e,s){this._stream=t,this._begin=e,this._end=s,this._queuedChunk=null,this._requests=[],this._done=!1,this.onProgress=null}_enqueue(t){if(!this._done){if(this._requests.length===0)this._queuedChunk=t;else{this._requests.shift().resolve({value:t,done:!1});for(const s of this._requests)s.resolve({value:void 0,done:!0});this._requests.length=0}this._done=!0,this._stream._removeRangeReader(this)}}get isStreamingSupported(){return!1}async read(){if(this._queuedChunk){const e=this._queuedChunk;return this._queuedChunk=null,{value:e,done:!1}}if(this._done)return{value:void 0,done:!0};const t=Promise.withResolvers();return this._requests.push(t),t.promise}cancel(t){this._done=!0;for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0,this._stream._removeRangeReader(this)}}function zm(d){let t=!0,e=s("filename\\*","i").exec(d);if(e){e=e[1];let c=o(e);return c=unescape(c),c=l(c),c=h(c),r(c)}if(e=a(d),e){const c=h(e);return r(c)}if(e=s("filename","i").exec(d),e){e=e[1];let c=o(e);return c=h(c),r(c)}function s(c,u){return new RegExp("(?:^|;)\\s*"+c+'\\s*=\\s*([^";\\s][^;\\s]*|"(?:[^"\\\\]|\\\\"?)+"?)',u)}function i(c,u){if(c){if(!/^[\x00-\xFF]+$/.test(u))return u;try{const p=new TextDecoder(c,{fatal:!0}),m=Hd(u);u=p.decode(m),t=!1}catch{}}return u}function r(c){return t&&/[\x80-\xff]/.test(c)&&(c=i("utf-8",c),t&&(c=i("iso-8859-1",c))),c}function a(c){const u=[];let p;const m=s("filename\\*((?!0\\d)\\d+)(\\*?)","ig");for(;(p=m.exec(c))!==null;){let[,_,w,y]=p;if(_=parseInt(_,10),_ in u){if(_===0)break;continue}u[_]=[w,y]}const A=[];for(let _=0;_<u.length&&_ in u;++_){let[w,y]=u[_];y=o(y),w&&(y=unescape(y),_===0&&(y=l(y))),A.push(y)}return A.join("")}function o(c){if(c.startsWith('"')){const u=c.slice(1).split('\\"');for(let p=0;p<u.length;++p){const m=u[p].indexOf('"');m!==-1&&(u[p]=u[p].slice(0,m),u.length=p+1),u[p]=u[p].replaceAll(/\\(.)/g,"$1")}c=u.join('"')}return c}function l(c){const u=c.indexOf("'");if(u===-1)return c;const p=c.slice(0,u),A=c.slice(u+1).replace(/^[^']*'/,"");return i(p,A)}function h(c){return!c.startsWith("=?")||/[\x00-\x19\x80-\xff]/.test(c)?c:c.replaceAll(/=\?([\w-]*)\?([QqBb])\?((?:[^?]|\?(?!=))*)\?=/g,function(u,p,m,A){if(m==="q"||m==="Q")return A=A.replaceAll("_"," "),A=A.replaceAll(/=([0-9a-fA-F]{2})/g,function(_,w){return String.fromCharCode(parseInt(w,16))}),i(p,A);try{A=atob(A)}catch{}return i(p,A)})}return""}function Ip(d,t){const e=new Headers;if(!d||!t||typeof t!="object")return e;for(const s in t){const i=t[s];i!==void 0&&e.append(s,i)}return e}function Gd(d){try{return new URL(d).origin}catch{}return null}function Dp({responseHeaders:d,isHttp:t,rangeChunkSize:e,disableRange:s}){const i={allowRangeRequests:!1,suggestedLength:void 0},r=parseInt(d.get("Content-Length"),10);return!Number.isInteger(r)||(i.suggestedLength=r,r<=2*e)||s||!t||d.get("Accept-Ranges")!=="bytes"||(d.get("Content-Encoding")||"identity")!=="identity"||(i.allowRangeRequests=!0),i}function Fp(d){const t=d.get("Content-Disposition");if(t){let e=zm(t);if(e.includes("%"))try{e=decodeURIComponent(e)}catch{}if(pf(e))return e}return null}function zd(d,t){return d===404||d===0&&t.startsWith("file:")?new dh('Missing PDF "'+t+'".'):new Nd(`Unexpected server response (${d}) while retrieving PDF "${t}".`,d)}function Op(d){return d===200||d===206}function Np(d,t,e){return{method:"GET",headers:d,signal:e.signal,mode:"cors",credentials:t?"include":"same-origin",redirect:"follow"}}function Hp(d){return d instanceof Uint8Array?d.buffer:d instanceof ArrayBuffer?d:(B(`getArrayBuffer - unexpected data format: ${d}`),new Uint8Array(d).buffer)}class Gf{constructor(t){I(this,"_responseOrigin",null);this.source=t,this.isHttp=/^https?:/i.test(t.url),this.headers=Ip(this.isHttp,t.httpHeaders),this._fullRequestReader=null,this._rangeRequestReaders=[]}get _progressiveDataLength(){var t;return((t=this._fullRequestReader)==null?void 0:t._loaded)??0}getFullReader(){return ft(!this._fullRequestReader,"PDFFetchStream.getFullReader can only be called once."),this._fullRequestReader=new Um(this),this._fullRequestReader}getRangeReader(t,e){if(e<=this._progressiveDataLength)return null;const s=new Vm(this,t,e);return this._rangeRequestReaders.push(s),s}cancelAllRequests(t){var e;(e=this._fullRequestReader)==null||e.cancel(t);for(const s of this._rangeRequestReaders.slice(0))s.cancel(t)}}class Um{constructor(t){this._stream=t,this._reader=null,this._loaded=0,this._filename=null;const e=t.source;this._withCredentials=e.withCredentials||!1,this._contentLength=e.length,this._headersCapability=Promise.withResolvers(),this._disableRange=e.disableRange||!1,this._rangeChunkSize=e.rangeChunkSize,!this._rangeChunkSize&&!this._disableRange&&(this._disableRange=!0),this._abortController=new AbortController,this._isStreamingSupported=!e.disableStream,this._isRangeSupported=!e.disableRange;const s=new Headers(t.headers),i=e.url;fetch(i,Np(s,this._withCredentials,this._abortController)).then(r=>{if(t._responseOrigin=Gd(r.url),!Op(r.status))throw zd(r.status,i);this._reader=r.body.getReader(),this._headersCapability.resolve();const a=r.headers,{allowRangeRequests:o,suggestedLength:l}=Dp({responseHeaders:a,isHttp:t.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=o,this._contentLength=l||this._contentLength,this._filename=Fp(a),!this._isStreamingSupported&&this._isRangeSupported&&this.cancel(new qn("Streaming is disabled."))}).catch(this._headersCapability.reject),this.onProgress=null}get headersReady(){return this._headersCapability.promise}get filename(){return this._filename}get contentLength(){return this._contentLength}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}async read(){var s;await this._headersCapability.promise;const{value:t,done:e}=await this._reader.read();return e?{value:t,done:e}:(this._loaded+=t.byteLength,(s=this.onProgress)==null||s.call(this,{loaded:this._loaded,total:this._contentLength}),{value:Hp(t),done:!1})}cancel(t){var e;(e=this._reader)==null||e.cancel(t),this._abortController.abort()}}class Vm{constructor(t,e,s){this._stream=t,this._reader=null,this._loaded=0;const i=t.source;this._withCredentials=i.withCredentials||!1,this._readCapability=Promise.withResolvers(),this._isStreamingSupported=!i.disableStream,this._abortController=new AbortController;const r=new Headers(t.headers);r.append("Range",`bytes=${e}-${s-1}`);const a=i.url;fetch(a,Np(r,this._withCredentials,this._abortController)).then(o=>{const l=Gd(o.url);if(l!==t._responseOrigin)throw new Error(`Expected range response-origin "${l}" to match "${t._responseOrigin}".`);if(!Op(o.status))throw zd(o.status,a);this._readCapability.resolve(),this._reader=o.body.getReader()}).catch(this._readCapability.reject),this.onProgress=null}get isStreamingSupported(){return this._isStreamingSupported}async read(){var s;await this._readCapability.promise;const{value:t,done:e}=await this._reader.read();return e?{value:t,done:e}:(this._loaded+=t.byteLength,(s=this.onProgress)==null||s.call(this,{loaded:this._loaded}),{value:Hp(t),done:!1})}cancel(t){var e;(e=this._reader)==null||e.cancel(t),this._abortController.abort()}}const Xd=200,Yd=206;function jm(d){const t=d.response;return typeof t!="string"?t:Hd(t).buffer}class Wm{constructor({url:t,httpHeaders:e,withCredentials:s}){I(this,"_responseOrigin",null);this.url=t,this.isHttp=/^https?:/i.test(t),this.headers=Ip(this.isHttp,e),this.withCredentials=s||!1,this.currXhrId=0,this.pendingRequests=Object.create(null)}requestRange(t,e,s){const i={begin:t,end:e};for(const r in s)i[r]=s[r];return this.request(i)}requestFull(t){return this.request(t)}request(t){const e=new XMLHttpRequest,s=this.currXhrId++,i=this.pendingRequests[s]={xhr:e};e.open("GET",this.url),e.withCredentials=this.withCredentials;for(const[r,a]of this.headers)e.setRequestHeader(r,a);return this.isHttp&&"begin"in t&&"end"in t?(e.setRequestHeader("Range",`bytes=${t.begin}-${t.end-1}`),i.expectedStatus=Yd):i.expectedStatus=Xd,e.responseType="arraybuffer",t.onError&&(e.onerror=function(r){t.onError(e.status)}),e.onreadystatechange=this.onStateChange.bind(this,s),e.onprogress=this.onProgress.bind(this,s),i.onHeadersReceived=t.onHeadersReceived,i.onDone=t.onDone,i.onError=t.onError,i.onProgress=t.onProgress,e.send(null),s}onProgress(t,e){var i;const s=this.pendingRequests[t];s&&((i=s.onProgress)==null||i.call(s,e))}onStateChange(t,e){var l,h,c;const s=this.pendingRequests[t];if(!s)return;const i=s.xhr;if(i.readyState>=2&&s.onHeadersReceived&&(s.onHeadersReceived(),delete s.onHeadersReceived),i.readyState!==4||!(t in this.pendingRequests))return;if(delete this.pendingRequests[t],i.status===0&&this.isHttp){(l=s.onError)==null||l.call(s,i.status);return}const r=i.status||Xd;if(!(r===Xd&&s.expectedStatus===Yd)&&r!==s.expectedStatus){(h=s.onError)==null||h.call(s,i.status);return}const o=jm(i);if(r===Yd){const u=i.getResponseHeader("Content-Range"),p=/bytes (\d+)-(\d+)\/(\d+)/.exec(u);s.onDone({begin:parseInt(p[1],10),chunk:o})}else o?s.onDone({begin:0,chunk:o}):(c=s.onError)==null||c.call(s,i.status)}getRequestXhr(t){return this.pendingRequests[t].xhr}isPendingRequest(t){return t in this.pendingRequests}abortRequest(t){const e=this.pendingRequests[t].xhr;delete this.pendingRequests[t],e.abort()}}class qm{constructor(t){this._source=t,this._manager=new Wm(t),this._rangeChunkSize=t.rangeChunkSize,this._fullRequestReader=null,this._rangeRequestReaders=[]}_onRangeRequestReaderClosed(t){const e=this._rangeRequestReaders.indexOf(t);e>=0&&this._rangeRequestReaders.splice(e,1)}getFullReader(){return ft(!this._fullRequestReader,"PDFNetworkStream.getFullReader can only be called once."),this._fullRequestReader=new Xm(this._manager,this._source),this._fullRequestReader}getRangeReader(t,e){const s=new Ym(this._manager,t,e);return s.onClosed=this._onRangeRequestReaderClosed.bind(this),this._rangeRequestReaders.push(s),s}cancelAllRequests(t){var e;(e=this._fullRequestReader)==null||e.cancel(t);for(const s of this._rangeRequestReaders.slice(0))s.cancel(t)}}class Xm{constructor(t,e){this._manager=t;const s={onHeadersReceived:this._onHeadersReceived.bind(this),onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)};this._url=e.url,this._fullRequestId=t.requestFull(s),this._headersCapability=Promise.withResolvers(),this._disableRange=e.disableRange||!1,this._contentLength=e.length,this._rangeChunkSize=e.rangeChunkSize,!this._rangeChunkSize&&!this._disableRange&&(this._disableRange=!0),this._isStreamingSupported=!1,this._isRangeSupported=!1,this._cachedChunks=[],this._requests=[],this._done=!1,this._storedError=void 0,this._filename=null,this.onProgress=null}_onHeadersReceived(){const t=this._fullRequestId,e=this._manager.getRequestXhr(t);this._manager._responseOrigin=Gd(e.responseURL);const s=e.getAllResponseHeaders(),i=new Headers(s?s.trim().split(/[\r\n]+/).map(o=>{const[l,...h]=o.split(": ");return[l,h.join(": ")]}):[]),{allowRangeRequests:r,suggestedLength:a}=Dp({responseHeaders:i,isHttp:this._manager.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});r&&(this._isRangeSupported=!0),this._contentLength=a||this._contentLength,this._filename=Fp(i),this._isRangeSupported&&this._manager.abortRequest(t),this._headersCapability.resolve()}_onDone(t){if(t&&(this._requests.length>0?this._requests.shift().resolve({value:t.chunk,done:!1}):this._cachedChunks.push(t.chunk)),this._done=!0,!(this._cachedChunks.length>0)){for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0}}_onError(t){this._storedError=zd(t,this._url),this._headersCapability.reject(this._storedError);for(const e of this._requests)e.reject(this._storedError);this._requests.length=0,this._cachedChunks.length=0}_onProgress(t){var e;(e=this.onProgress)==null||e.call(this,{loaded:t.loaded,total:t.lengthComputable?t.total:this._contentLength})}get filename(){return this._filename}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}get contentLength(){return this._contentLength}get headersReady(){return this._headersCapability.promise}async read(){if(await this._headersCapability.promise,this._storedError)throw this._storedError;if(this._cachedChunks.length>0)return{value:this._cachedChunks.shift(),done:!1};if(this._done)return{value:void 0,done:!0};const t=Promise.withResolvers();return this._requests.push(t),t.promise}cancel(t){this._done=!0,this._headersCapability.reject(t);for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._fullRequestId)&&this._manager.abortRequest(this._fullRequestId),this._fullRequestReader=null}}class Ym{constructor(t,e,s){this._manager=t;const i={onHeadersReceived:this._onHeadersReceived.bind(this),onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)};this._url=t.url,this._requestId=t.requestRange(e,s,i),this._requests=[],this._queuedChunk=null,this._done=!1,this._storedError=void 0,this.onProgress=null,this.onClosed=null}_onHeadersReceived(){var e;const t=Gd((e=this._manager.getRequestXhr(this._requestId))==null?void 0:e.responseURL);t!==this._manager._responseOrigin&&(this._storedError=new Error(`Expected range response-origin "${t}" to match "${this._manager._responseOrigin}".`),this._onError(0))}_close(){var t;(t=this.onClosed)==null||t.call(this,this)}_onDone(t){const e=t.chunk;this._requests.length>0?this._requests.shift().resolve({value:e,done:!1}):this._queuedChunk=e,this._done=!0;for(const s of this._requests)s.resolve({value:void 0,done:!0});this._requests.length=0,this._close()}_onError(t){this._storedError??(this._storedError=zd(t,this._url));for(const e of this._requests)e.reject(this._storedError);this._requests.length=0,this._queuedChunk=null}_onProgress(t){var e;this.isStreamingSupported||(e=this.onProgress)==null||e.call(this,{loaded:t.loaded})}get isStreamingSupported(){return!1}async read(){if(this._storedError)throw this._storedError;if(this._queuedChunk!==null){const e=this._queuedChunk;return this._queuedChunk=null,{value:e,done:!1}}if(this._done)return{value:void 0,done:!0};const t=Promise.withResolvers();return this._requests.push(t),t.promise}cancel(t){this._done=!0;for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._requestId)&&this._manager.abortRequest(this._requestId),this._close()}}const Km=/^[a-z][a-z0-9\-+.]+:/i;function Qm(d){if(Km.test(d))return new URL(d);const t=process.getBuiltinModule("url");return new URL(t.pathToFileURL(d))}class Jm{constructor(t){this.source=t,this.url=Qm(t.url),ft(this.url.protocol==="file:","PDFNodeStream only supports file:// URLs."),this._fullRequestReader=null,this._rangeRequestReaders=[]}get _progressiveDataLength(){var t;return((t=this._fullRequestReader)==null?void 0:t._loaded)??0}getFullReader(){return ft(!this._fullRequestReader,"PDFNodeStream.getFullReader can only be called once."),this._fullRequestReader=new Zm(this),this._fullRequestReader}getRangeReader(t,e){if(e<=this._progressiveDataLength)return null;const s=new tb(this,t,e);return this._rangeRequestReaders.push(s),s}cancelAllRequests(t){var e;(e=this._fullRequestReader)==null||e.cancel(t);for(const s of this._rangeRequestReaders.slice(0))s.cancel(t)}}class Zm{constructor(t){this._url=t.url,this._done=!1,this._storedError=null,this.onProgress=null;const e=t.source;this._contentLength=e.length,this._loaded=0,this._filename=null,this._disableRange=e.disableRange||!1,this._rangeChunkSize=e.rangeChunkSize,!this._rangeChunkSize&&!this._disableRange&&(this._disableRange=!0),this._isStreamingSupported=!e.disableStream,this._isRangeSupported=!e.disableRange,this._readableStream=null,this._readCapability=Promise.withResolvers(),this._headersCapability=Promise.withResolvers();const s=process.getBuiltinModule("fs");s.promises.lstat(this._url).then(i=>{this._contentLength=i.size,this._setReadableStream(s.createReadStream(this._url)),this._headersCapability.resolve()},i=>{i.code==="ENOENT"&&(i=new dh(`Missing PDF "${this._url}".`)),this._storedError=i,this._headersCapability.reject(i)})}get headersReady(){return this._headersCapability.promise}get filename(){return this._filename}get contentLength(){return this._contentLength}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}async read(){var s;if(await this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;const t=this._readableStream.read();return t===null?(this._readCapability=Promise.withResolvers(),this.read()):(this._loaded+=t.length,(s=this.onProgress)==null||s.call(this,{loaded:this._loaded,total:this._contentLength}),{value:new Uint8Array(t).buffer,done:!1})}cancel(t){if(!this._readableStream){this._error(t);return}this._readableStream.destroy(t)}_error(t){this._storedError=t,this._readCapability.resolve()}_setReadableStream(t){this._readableStream=t,t.on("readable",()=>{this._readCapability.resolve()}),t.on("end",()=>{t.destroy(),this._done=!0,this._readCapability.resolve()}),t.on("error",e=>{this._error(e)}),!this._isStreamingSupported&&this._isRangeSupported&&this._error(new qn("streaming is disabled")),this._storedError&&this._readableStream.destroy(this._storedError)}}class tb{constructor(t,e,s){this._url=t.url,this._done=!1,this._storedError=null,this.onProgress=null,this._loaded=0,this._readableStream=null,this._readCapability=Promise.withResolvers();const i=t.source;this._isStreamingSupported=!i.disableStream;const r=process.getBuiltinModule("fs");this._setReadableStream(r.createReadStream(this._url,{start:e,end:s-1}))}get isStreamingSupported(){return this._isStreamingSupported}async read(){var s;if(await this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;const t=this._readableStream.read();return t===null?(this._readCapability=Promise.withResolvers(),this.read()):(this._loaded+=t.length,(s=this.onProgress)==null||s.call(this,{loaded:this._loaded}),{value:new Uint8Array(t).buffer,done:!1})}cancel(t){if(!this._readableStream){this._error(t);return}this._readableStream.destroy(t)}_error(t){this._storedError=t,this._readCapability.resolve()}_setReadableStream(t){this._readableStream=t,t.on("readable",()=>{this._readCapability.resolve()}),t.on("end",()=>{t.destroy(),this._done=!0,this._readCapability.resolve()}),t.on("error",e=>{this._error(e)}),this._storedError&&this._readableStream.destroy(this._storedError)}}const eb=1e5,Xt=30,sb=.8;var jf,di,Qt,el,sl,hn,Cs,il,nl,cn,Dr,Fr,ui,Or,rl,Nr,dn,al,ol,un,fn,ll,fi,Hr,Dc,Bp,Fc,$p,hl,Ru,Br,Ph,cl,Pu,Oc,Gp,Nc,zp;const at=class at{constructor({textContentSource:t,container:e,viewport:s}){f(this,Dc);f(this,Fc);f(this,hl);f(this,di,Promise.withResolvers());f(this,Qt,null);f(this,el,!1);f(this,sl,!!((jf=globalThis.FontInspector)!=null&&jf.enabled));f(this,hn,null);f(this,Cs,null);f(this,il,0);f(this,nl,0);f(this,cn,null);f(this,Dr,null);f(this,Fr,0);f(this,ui,0);f(this,Or,Object.create(null));f(this,rl,[]);f(this,Nr,null);f(this,dn,[]);f(this,al,new WeakMap);f(this,ol,null);var l;if(t instanceof ReadableStream)g(this,Nr,t);else if(typeof t=="object")g(this,Nr,new ReadableStream({start(h){h.enqueue(t),h.close()}}));else throw new Error('No "textContentSource" parameter specified.');g(this,Qt,g(this,Dr,e)),g(this,ui,s.scale*(globalThis.devicePixelRatio||1)),g(this,Fr,s.rotation),g(this,Cs,{div:null,properties:null,ctx:null});const{pageWidth:i,pageHeight:r,pageX:a,pageY:o}=s.rawDims;g(this,ol,[1,0,0,-1,-a,o+r]),g(this,nl,i),g(this,il,r),b(l=at,Oc,Gp).call(l),Vn(e,s),n(this,di).promise.finally(()=>{n(at,Hr).delete(this),g(this,Cs,null),g(this,Or,null)}).catch(()=>{})}static get fontFamilyMap(){const{isWindows:t,isFirefox:e}=Wt.platform;return G(this,"fontFamilyMap",new Map([["sans-serif",`${t&&e?"Calibri, ":""}sans-serif`],["monospace",`${t&&e?"Lucida Console, ":""}monospace`]]))}render(){const t=()=>{n(this,cn).read().then(({value:e,done:s})=>{if(s){n(this,di).resolve();return}n(this,hn)??g(this,hn,e.lang),Object.assign(n(this,Or),e.styles),b(this,Dc,Bp).call(this,e.items),t()},n(this,di).reject)};return g(this,cn,n(this,Nr).getReader()),n(at,Hr).add(this),t(),n(this,di).promise}update({viewport:t,onBefore:e=null}){var r;const s=t.scale*(globalThis.devicePixelRatio||1),i=t.rotation;if(i!==n(this,Fr)&&(e==null||e(),g(this,Fr,i),Vn(n(this,Dr),{rotation:i})),s!==n(this,ui)){e==null||e(),g(this,ui,s);const a={div:null,properties:null,ctx:b(r=at,Br,Ph).call(r,n(this,hn))};for(const o of n(this,dn))a.properties=n(this,al).get(o),a.div=o,b(this,hl,Ru).call(this,a)}}cancel(){var e;const t=new qn("TextLayer task cancelled.");(e=n(this,cn))==null||e.cancel(t).catch(()=>{}),g(this,cn,null),n(this,di).reject(t)}get textDivs(){return n(this,dn)}get textContentItemsStr(){return n(this,rl)}static cleanup(){if(!(n(this,Hr).size>0)){n(this,un).clear();for(const{canvas:t}of n(this,fn).values())t.remove();n(this,fn).clear()}}};di=new WeakMap,Qt=new WeakMap,el=new WeakMap,sl=new WeakMap,hn=new WeakMap,Cs=new WeakMap,il=new WeakMap,nl=new WeakMap,cn=new WeakMap,Dr=new WeakMap,Fr=new WeakMap,ui=new WeakMap,Or=new WeakMap,rl=new WeakMap,Nr=new WeakMap,dn=new WeakMap,al=new WeakMap,ol=new WeakMap,un=new WeakMap,fn=new WeakMap,ll=new WeakMap,fi=new WeakMap,Hr=new WeakMap,Dc=new WeakSet,Bp=function(t){var i,r;if(n(this,el))return;(r=n(this,Cs)).ctx??(r.ctx=b(i=at,Br,Ph).call(i,n(this,hn)));const e=n(this,dn),s=n(this,rl);for(const a of t){if(e.length>eb){B("Ignoring additional textDivs for performance reasons."),g(this,el,!0);return}if(a.str===void 0){if(a.type==="beginMarkedContentProps"||a.type==="beginMarkedContent"){const o=n(this,Qt);g(this,Qt,document.createElement("span")),n(this,Qt).classList.add("markedContent"),a.id!==null&&n(this,Qt).setAttribute("id",`${a.id}`),o.append(n(this,Qt))}else a.type==="endMarkedContent"&&g(this,Qt,n(this,Qt).parentNode);continue}s.push(a.str),b(this,Fc,$p).call(this,a)}},Fc=new WeakSet,$p=function(t){var _;const e=document.createElement("span"),s={angle:0,canvasWidth:0,hasText:t.str!=="",hasEOL:t.hasEOL,fontSize:0};n(this,dn).push(e);const i=M.transform(n(this,ol),t.transform);let r=Math.atan2(i[1],i[0]);const a=n(this,Or)[t.fontName];a.vertical&&(r+=Math.PI/2);let o=n(this,sl)&&a.fontSubstitution||a.fontFamily;o=at.fontFamilyMap.get(o)||o;const l=Math.hypot(i[2],i[3]),h=l*b(_=at,Nc,zp).call(_,o,n(this,hn));let c,u;r===0?(c=i[4],u=i[5]-h):(c=i[4]+h*Math.sin(r),u=i[5]-h*Math.cos(r));const p="calc(var(--scale-factor)*",m=e.style;n(this,Qt)===n(this,Dr)?(m.left=`${(100*c/n(this,nl)).toFixed(2)}%`,m.top=`${(100*u/n(this,il)).toFixed(2)}%`):(m.left=`${p}${c.toFixed(2)}px)`,m.top=`${p}${u.toFixed(2)}px)`),m.fontSize=`${p}${(n(at,fi)*l).toFixed(2)}px)`,m.fontFamily=o,s.fontSize=l,e.setAttribute("role","presentation"),e.textContent=t.str,e.dir=t.dir,n(this,sl)&&(e.dataset.fontName=a.fontSubstitutionLoadedName||t.fontName),r!==0&&(s.angle=r*(180/Math.PI));let A=!1;if(t.str.length>1)A=!0;else if(t.str!==" "&&t.transform[0]!==t.transform[3]){const w=Math.abs(t.transform[0]),y=Math.abs(t.transform[3]);w!==y&&Math.max(w,y)/Math.min(w,y)>1.5&&(A=!0)}if(A&&(s.canvasWidth=a.vertical?t.height:t.width),n(this,al).set(e,s),n(this,Cs).div=e,n(this,Cs).properties=s,b(this,hl,Ru).call(this,n(this,Cs)),s.hasText&&n(this,Qt).append(e),s.hasEOL){const w=document.createElement("br");w.setAttribute("role","presentation"),n(this,Qt).append(w)}},hl=new WeakSet,Ru=function(t){var o;const{div:e,properties:s,ctx:i}=t,{style:r}=e;let a="";if(n(at,fi)>1&&(a=`scale(${1/n(at,fi)})`),s.canvasWidth!==0&&s.hasText){const{fontFamily:l}=r,{canvasWidth:h,fontSize:c}=s;b(o=at,cl,Pu).call(o,i,c*n(this,ui),l);const{width:u}=i.measureText(e.textContent);u>0&&(a=`scaleX(${h*n(this,ui)/u}) ${a}`)}s.angle!==0&&(a=`rotate(${s.angle}deg) ${a}`),a.length>0&&(r.transform=a)},Br=new WeakSet,Ph=function(t=null){let e=n(this,fn).get(t||(t=""));if(!e){const s=document.createElement("canvas");s.className="hiddenCanvasElement",s.lang=t,document.body.append(s),e=s.getContext("2d",{alpha:!1,willReadFrequently:!0}),n(this,fn).set(t,e),n(this,ll).set(e,{size:0,family:""})}return e},cl=new WeakSet,Pu=function(t,e,s){const i=n(this,ll).get(t);e===i.size&&s===i.family||(t.font=`${e}px ${s}`,i.size=e,i.family=s)},Oc=new WeakSet,Gp=function(){if(n(this,fi)!==null)return;const t=document.createElement("div");t.style.opacity=0,t.style.lineHeight=1,t.style.fontSize="1px",t.style.position="absolute",t.textContent="X",document.body.append(t),g(this,fi,t.getBoundingClientRect().height),t.remove()},Nc=new WeakSet,zp=function(t,e){const s=n(this,un).get(t);if(s)return s;const i=b(this,Br,Ph).call(this,e);i.canvas.width=i.canvas.height=Xt,b(this,cl,Pu).call(this,i,Xt,t);const r=i.measureText("");let a=r.fontBoundingBoxAscent,o=Math.abs(r.fontBoundingBoxDescent);if(a){const c=a/(a+o);return n(this,un).set(t,c),i.canvas.width=i.canvas.height=0,c}i.strokeStyle="red",i.clearRect(0,0,Xt,Xt),i.strokeText("g",0,0);let l=i.getImageData(0,0,Xt,Xt).data;o=0;for(let c=l.length-1-3;c>=0;c-=4)if(l[c]>0){o=Math.ceil(c/4/Xt);break}i.clearRect(0,0,Xt,Xt),i.strokeText("A",0,Xt),l=i.getImageData(0,0,Xt,Xt).data,a=0;for(let c=0,u=l.length;c<u;c+=4)if(l[c]>0){a=Xt-Math.floor(c/4/Xt);break}i.canvas.width=i.canvas.height=0;const h=a?a/(a+o):sb;return n(this,un).set(t,h),h},f(at,Br),f(at,cl),f(at,Oc),f(at,Nc),f(at,un,new Map),f(at,fn,new Map),f(at,ll,new WeakMap),f(at,fi,null),f(at,Hr,new Set);let io=at;class no{static textContent(t){const e=[],s={items:e,styles:Object.create(null)};function i(r){var l;if(!r)return;let a=null;const o=r.name;if(o==="#text")a=r.value;else if(no.shouldBuildText(o))(l=r==null?void 0:r.attributes)!=null&&l.textContent?a=r.attributes.textContent:r.value&&(a=r.value);else return;if(a!==null&&e.push({str:a}),!!r.children)for(const h of r.children)i(h)}return i(t),s}static shouldBuildText(t){return!(t==="textarea"||t==="input"||t==="option"||t==="select")}}const ib=65536,nb=100,rb=5e3,ab=jt?ym:bm,ob=jt?wm:Sp,lb=jt?_m:Am,hb=jt?vm:Rp;function cb(d={}){typeof d=="string"||d instanceof URL?d={url:d}:(d instanceof ArrayBuffer||ArrayBuffer.isView(d))&&(d={data:d});const t=new ku,{docId:e}=t,s=d.url?db(d.url):null,i=d.data?ub(d.data):null,r=d.httpHeaders||null,a=d.withCredentials===!0,o=d.password??null,l=d.range instanceof Up?d.range:null,h=Number.isInteger(d.rangeChunkSize)&&d.rangeChunkSize>0?d.rangeChunkSize:ib;let c=d.worker instanceof or?d.worker:null;const u=d.verbosity,p=typeof d.docBaseUrl=="string"&&!$d(d.docBaseUrl)?d.docBaseUrl:null,m=typeof d.cMapUrl=="string"?d.cMapUrl:null,A=d.cMapPacked!==!1,_=d.CMapReaderFactory||ob,w=typeof d.standardFontDataUrl=="string"?d.standardFontDataUrl:null,y=d.StandardFontDataFactory||hb,v=d.stopAtErrors!==!0,S=Number.isInteger(d.maxImageSize)&&d.maxImageSize>-1?d.maxImageSize:-1,E=d.isEvalSupported!==!1,x=typeof d.isOffscreenCanvasSupported=="boolean"?d.isOffscreenCanvasSupported:!jt,C=typeof d.isImageDecoderSupported=="boolean"?d.isImageDecoderSupported:!jt&&(Wt.platform.isFirefox||!globalThis.chrome),T=Number.isInteger(d.canvasMaxAreaInBytes)?d.canvasMaxAreaInBytes:-1,k=typeof d.disableFontFace=="boolean"?d.disableFontFace:jt,D=d.fontExtraProperties===!0,U=d.enableXfa===!0,N=d.ownerDocument||globalThis.document,Q=d.disableRange===!0,lt=d.disableStream===!0,j=d.disableAutoFetch===!0,Bt=d.pdfBug===!0,q=d.CanvasFactory||ab,L=d.FilterFactory||lb,F=d.enableHWA===!0,Ve=l?l.length:d.length??NaN,Se=typeof d.useSystemFonts=="boolean"?d.useSystemFonts:!jt&&!k,fe=typeof d.useWorkerFetch=="boolean"?d.useWorkerFetch:_===Sp&&y===Rp&&m&&w&&Ba(m,document.baseURI)&&Ba(w,document.baseURI);d.canvasFactory&&Pf("`canvasFactory`-instance option, please use `CanvasFactory` instead."),d.filterFactory&&Pf("`filterFactory`-instance option, please use `FilterFactory` instead.");const kt=null;Yg(u);const pt={canvasFactory:new q({ownerDocument:N,enableHWA:F}),filterFactory:new L({docId:e,ownerDocument:N}),cMapReaderFactory:fe?null:new _({baseUrl:m,isCompressed:A}),standardFontDataFactory:fe?null:new y({baseUrl:w})};if(!c){const qt={verbosity:u,port:Vs.workerPort};c=qt.port?or.fromPort(qt):new or(qt),t._worker=c}const Yn={docId:e,apiVersion:"4.9.124",data:i,password:o,disableAutoFetch:j,rangeChunkSize:h,length:Ve,docBaseUrl:p,enableXfa:U,evaluatorOptions:{maxImageSize:S,disableFontFace:k,ignoreErrors:v,isEvalSupported:E,isOffscreenCanvasSupported:x,isImageDecoderSupported:C,canvasMaxAreaInBytes:T,fontExtraProperties:D,useSystemFonts:Se,cMapUrl:fe?m:null,standardFontDataUrl:fe?w:null}},Fa={disableFontFace:k,fontExtraProperties:D,ownerDocument:N,pdfBug:Bt,styleElement:kt,loadingParams:{disableAutoFetch:j,enableXfa:U}};return c.promise.then(function(){if(t.destroyed)throw new Error("Loading aborted");if(c.destroyed)throw new Error("Worker was destroyed");const qt=c.messageHandler.sendWithPromise("GetDocRequest",Yn,i?[i.buffer]:null);let Z;if(l)Z=new Bm(l,{disableRange:Q,disableStream:lt});else if(!i){if(!s)throw new Error("getDocument - no `url` parameter provided.");let Kn;if(jt)if(Ba(s)){if(typeof fetch>"u"||typeof Response>"u"||!("body"in Response.prototype))throw new Error("getDocument - the Fetch API was disabled in Node.js, see `--no-experimental-fetch`.");Kn=Gf}else Kn=Jm;else Kn=Ba(s)?Gf:qm;Z=new Kn({url:s,length:Ve,httpHeaders:r,withCredentials:a,rangeChunkSize:h,disableRange:Q,disableStream:lt})}return qt.then(Kn=>{if(t.destroyed)throw new Error("Loading aborted");if(c.destroyed)throw new Error("Worker was destroyed");const Cf=new qa(e,Kn,c.port),Gg=new mb(Cf,t,Z,Fa,pt);t._transport=Gg,Cf.send("Ready",null)})}).catch(t._capability.reject),t}function db(d){if(d instanceof URL)return d.href;try{return new URL(d,window.location).href}catch{if(jt&&typeof d=="string")return d}throw new Error("Invalid PDF url data: either string or URL-object is expected in the url property.")}function ub(d){if(jt&&typeof Buffer<"u"&&d instanceof Buffer)throw new Error("Please provide binary data as `Uint8Array`, rather than `Buffer`.");if(d instanceof Uint8Array&&d.byteLength===d.buffer.byteLength)return d;if(typeof d=="string")return Hd(d);if(d instanceof ArrayBuffer||ArrayBuffer.isView(d)||typeof d=="object"&&!isNaN(d==null?void 0:d.length))return new Uint8Array(d);throw new Error("Invalid PDF binary data: either TypedArray, string, or array-like object is expected in the data property.")}function zf(d){return typeof d=="object"&&Number.isInteger(d==null?void 0:d.num)&&d.num>=0&&Number.isInteger(d==null?void 0:d.gen)&&d.gen>=0}var Hc;const Bc=class Bc{constructor(){this._capability=Promise.withResolvers(),this._transport=null,this._worker=null,this.docId=`d${$t(Bc,Hc)._++}`,this.destroyed=!1,this.onPassword=null,this.onProgress=null}get promise(){return this._capability.promise}async destroy(){var t,e,s,i;this.destroyed=!0;try{(t=this._worker)!=null&&t.port&&(this._worker._pendingDestroy=!0),await((e=this._transport)==null?void 0:e.destroy())}catch(r){throw(s=this._worker)!=null&&s.port&&delete this._worker._pendingDestroy,r}this._transport=null,(i=this._worker)==null||i.destroy(),this._worker=null}};Hc=new WeakMap,f(Bc,Hc,0);let ku=Bc;class Up{constructor(t,e,s=!1,i=null){this.length=t,this.initialData=e,this.progressiveDone=s,this.contentDispositionFilename=i,this._rangeListeners=[],this._progressListeners=[],this._progressiveReadListeners=[],this._progressiveDoneListeners=[],this._readyCapability=Promise.withResolvers()}addRangeListener(t){this._rangeListeners.push(t)}addProgressListener(t){this._progressListeners.push(t)}addProgressiveReadListener(t){this._progressiveReadListeners.push(t)}addProgressiveDoneListener(t){this._progressiveDoneListeners.push(t)}onDataRange(t,e){for(const s of this._rangeListeners)s(t,e)}onDataProgress(t,e){this._readyCapability.promise.then(()=>{for(const s of this._progressListeners)s(t,e)})}onDataProgressiveRead(t){this._readyCapability.promise.then(()=>{for(const e of this._progressiveReadListeners)e(t)})}onDataProgressiveDone(){this._readyCapability.promise.then(()=>{for(const t of this._progressiveDoneListeners)t()})}transportReady(){this._readyCapability.resolve()}requestDataRange(t,e){K("Abstract method PDFDataRangeTransport.requestDataRange")}abort(){}}class fb{constructor(t,e){this._pdfInfo=t,this._transport=e}get annotationStorage(){return this._transport.annotationStorage}get canvasFactory(){return this._transport.canvasFactory}get filterFactory(){return this._transport.filterFactory}get numPages(){return this._pdfInfo.numPages}get fingerprints(){return this._pdfInfo.fingerprints}get isPureXfa(){return G(this,"isPureXfa",!!this._transport._htmlForXfa)}get allXfaHtml(){return this._transport._htmlForXfa}getPage(t){return this._transport.getPage(t)}getPageIndex(t){return this._transport.getPageIndex(t)}getDestinations(){return this._transport.getDestinations()}getDestination(t){return this._transport.getDestination(t)}getPageLabels(){return this._transport.getPageLabels()}getPageLayout(){return this._transport.getPageLayout()}getPageMode(){return this._transport.getPageMode()}getViewerPreferences(){return this._transport.getViewerPreferences()}getOpenAction(){return this._transport.getOpenAction()}getAttachments(){return this._transport.getAttachments()}getJSActions(){return this._transport.getDocJSActions()}getOutline(){return this._transport.getOutline()}getOptionalContentConfig({intent:t="display"}={}){const{renderingIntent:e}=this._transport.getRenderingIntent(t);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(t=!1){return this._transport.startCleanup(t||this.isPureXfa)}destroy(){return this.loadingTask.destroy()}cachedPageNumber(t){return this._transport.cachedPageNumber(t)}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()}}var pi,Ts,gi,er,$r,kh;class pb{constructor(t,e,s,i=!1){f(this,gi);f(this,$r);f(this,pi,null);f(this,Ts,!1);this._pageIndex=t,this._pageInfo=e,this._transport=s,this._stats=i?new Rf:null,this._pdfBug=i,this.commonObjs=s.commonObjs,this.objs=new Vp,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:t,rotation:e=this.rotate,offsetX:s=0,offsetY:i=0,dontFlip:r=!1}={}){return new uh({viewBox:this.view,scale:t,rotation:e,offsetX:s,offsetY:i,dontFlip:r})}getAnnotations({intent:t="display"}={}){const{renderingIntent:e}=this._transport.getRenderingIntent(t);return this._transport.getAnnotations(this._pageIndex,e)}getJSActions(){return this._transport.getPageJSActions(this._pageIndex)}get filterFactory(){return this._transport.filterFactory}get isPureXfa(){return G(this,"isPureXfa",!!this._transport._htmlForXfa)}async getXfa(){var t;return((t=this._transport._htmlForXfa)==null?void 0:t.children[this._pageIndex])||null}render({canvasContext:t,viewport:e,intent:s="display",annotationMode:i=qs.ENABLE,transform:r=null,background:a=null,optionalContentConfigPromise:o=null,annotationCanvasMap:l=null,pageColors:h=null,printAnnotationStorage:c=null,isEditing:u=!1}){var E,x;(E=this._stats)==null||E.time("Overall");const p=this._transport.getRenderingIntent(s,i,c,u),{renderingIntent:m,cacheKey:A}=p;g(this,Ts,!1),b(this,$r,kh).call(this),o||(o=this._transport.getOptionalContentConfig(m));let _=this._intentStates.get(A);_||(_=Object.create(null),this._intentStates.set(A,_)),_.streamReaderCancelTimeout&&(clearTimeout(_.streamReaderCancelTimeout),_.streamReaderCancelTimeout=null);const w=!!(m&ue.PRINT);_.displayReadyCapability||(_.displayReadyCapability=Promise.withResolvers(),_.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},(x=this._stats)==null||x.time("Page Request"),this._pumpOperatorList(p));const y=C=>{var T;_.renderTasks.delete(v),(this._maybeCleanupAfterRender||w)&&g(this,Ts,!0),b(this,gi,er).call(this,!w),C?(v.capability.reject(C),this._abortOperatorList({intentState:_,reason:C instanceof Error?C:new Error(C)})):v.capability.resolve(),this._stats&&(this._stats.timeEnd("Rendering"),this._stats.timeEnd("Overall"),(T=globalThis.Stats)!=null&&T.enabled&&globalThis.Stats.add(this.pageNumber,this._stats))},v=new Lu({callback:y,params:{canvasContext:t,viewport:e,transform:r,background:a},objs:this.objs,commonObjs:this.commonObjs,annotationCanvasMap:l,operatorList:_.operatorList,pageIndex:this._pageIndex,canvasFactory:this._transport.canvasFactory,filterFactory:this._transport.filterFactory,useRequestAnimationFrame:!w,pdfBug:this._pdfBug,pageColors:h});(_.renderTasks||(_.renderTasks=new Set)).add(v);const S=v.task;return Promise.all([_.displayReadyCapability.promise,o]).then(([C,T])=>{var k;if(this.destroyed){y();return}if((k=this._stats)==null||k.time("Rendering"),!(T.renderingIntent&m))throw new Error("Must use the same `intent`-argument when calling the `PDFPageProxy.render` and `PDFDocumentProxy.getOptionalContentConfig` methods.");v.initializeGraphics({transparency:C,optionalContentConfig:T}),v.operatorListChanged()}).catch(y),S}getOperatorList({intent:t="display",annotationMode:e=qs.ENABLE,printAnnotationStorage:s=null,isEditing:i=!1}={}){var h;function r(){o.operatorList.lastChunk&&(o.opListReadCapability.resolve(o.operatorList),o.renderTasks.delete(l))}const a=this._transport.getRenderingIntent(t,e,s,i,!0);let o=this._intentStates.get(a.cacheKey);o||(o=Object.create(null),this._intentStates.set(a.cacheKey,o));let l;return o.opListReadCapability||(l=Object.create(null),l.operatorListChanged=r,o.opListReadCapability=Promise.withResolvers(),(o.renderTasks||(o.renderTasks=new Set)).add(l),o.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},(h=this._stats)==null||h.time("Page Request"),this._pumpOperatorList(a)),o.opListReadCapability.promise}streamTextContent({includeMarkedContent:t=!1,disableNormalization:e=!1}={}){return this._transport.messageHandler.sendWithStream("GetTextContent",{pageIndex:this._pageIndex,includeMarkedContent:t===!0,disableNormalization:e===!0},{highWaterMark:100,size(i){return i.items.length}})}getTextContent(t={}){if(this._transport._htmlForXfa)return this.getXfa().then(s=>no.textContent(s));const e=this.streamTextContent(t);return new Promise(function(s,i){function r(){a.read().then(function({value:l,done:h}){if(h){s(o);return}o.lang??(o.lang=l.lang),Object.assign(o.styles,l.styles),o.items.push(...l.items),r()},i)}const a=e.getReader(),o={items:[],styles:Object.create(null),lang:null};r()})}getStructTree(){return this._transport.getStructTree(this._pageIndex)}_destroy(){this.destroyed=!0;const t=[];for(const e of this._intentStates.values())if(this._abortOperatorList({intentState:e,reason:new Error("Page was destroyed."),force:!0}),!e.opListReadCapability)for(const s of e.renderTasks)t.push(s.completed),s.cancel();return this.objs.clear(),g(this,Ts,!1),b(this,$r,kh).call(this),Promise.all(t)}cleanup(t=!1){g(this,Ts,!0);const e=b(this,gi,er).call(this,!1);return t&&e&&this._stats&&(this._stats=new Rf),e}_startRenderPage(t,e){var i,r;const s=this._intentStates.get(e);s&&((i=this._stats)==null||i.timeEnd("Page Request"),(r=s.displayReadyCapability)==null||r.resolve(t))}_renderPageChunk(t,e){for(let s=0,i=t.length;s<i;s++)e.operatorList.fnArray.push(t.fnArray[s]),e.operatorList.argsArray.push(t.argsArray[s]);e.operatorList.lastChunk=t.lastChunk,e.operatorList.separateAnnots=t.separateAnnots;for(const s of e.renderTasks)s.operatorListChanged();t.lastChunk&&b(this,gi,er).call(this,!0)}_pumpOperatorList({renderingIntent:t,cacheKey:e,annotationStorageSerializable:s,modifiedIds:i}){const{map:r,transfer:a}=s,l=this._transport.messageHandler.sendWithStream("GetOperatorList",{pageIndex:this._pageIndex,intent:t,cacheKey:e,annotationStorage:r,modifiedIds:i},a).getReader(),h=this._intentStates.get(e);h.streamReader=l;const c=()=>{l.read().then(({value:u,done:p})=>{if(p){h.streamReader=null;return}this._transport.destroyed||(this._renderPageChunk(u,h),c())},u=>{if(h.streamReader=null,!this._transport.destroyed){if(h.operatorList){h.operatorList.lastChunk=!0;for(const p of h.renderTasks)p.operatorListChanged();b(this,gi,er).call(this,!0)}if(h.displayReadyCapability)h.displayReadyCapability.reject(u);else if(h.opListReadCapability)h.opListReadCapability.reject(u);else throw u}})};c()}_abortOperatorList({intentState:t,reason:e,force:s=!1}){if(t.streamReader){if(t.streamReaderCancelTimeout&&(clearTimeout(t.streamReaderCancelTimeout),t.streamReaderCancelTimeout=null),!s){if(t.renderTasks.size>0)return;if(e instanceof ff){let i=nb;e.extraDelay>0&&e.extraDelay<1e3&&(i+=e.extraDelay),t.streamReaderCancelTimeout=setTimeout(()=>{t.streamReaderCancelTimeout=null,this._abortOperatorList({intentState:t,reason:e,force:!0})},i);return}}if(t.streamReader.cancel(new qn(e.message)).catch(()=>{}),t.streamReader=null,!this._transport.destroyed){for(const[i,r]of this._intentStates)if(r===t){this._intentStates.delete(i);break}this.cleanup()}}}get stats(){return this._stats}}pi=new WeakMap,Ts=new WeakMap,gi=new WeakSet,er=function(t=!1){if(b(this,$r,kh).call(this),!n(this,Ts)||this.destroyed)return!1;if(t)return g(this,pi,setTimeout(()=>{g(this,pi,null),b(this,gi,er).call(this,!1)},rb)),!1;for(const{renderTasks:e,operatorList:s}of this._intentStates.values())if(e.size>0||!s.lastChunk)return!1;return this._intentStates.clear(),this.objs.clear(),g(this,Ts,!1),!0},$r=new WeakSet,kh=function(){n(this,pi)&&(clearTimeout(n(this,pi)),g(this,pi,null))};var Rs,$c;class gb{constructor(){f(this,Rs,new Map);f(this,$c,Promise.resolve())}postMessage(t,e){const s={data:structuredClone(t,e?{transfer:e}:null)};n(this,$c).then(()=>{for(const[i]of n(this,Rs))i.call(this,s)})}addEventListener(t,e,s=null){let i=null;if((s==null?void 0:s.signal)instanceof AbortSignal){const{signal:r}=s;if(r.aborted){B("LoopbackPort - cannot use an `aborted` signal.");return}const a=()=>this.removeEventListener(t,e);i=()=>r.removeEventListener("abort",a),r.addEventListener("abort",a)}n(this,Rs).set(e,i)}removeEventListener(t,e){const s=n(this,Rs).get(e);s==null||s(),n(this,Rs).delete(e)}terminate(){for(const[,t]of n(this,Rs))t==null||t();n(this,Rs).clear()}}Rs=new WeakMap,$c=new WeakMap;var Gc,pn,gn,Gr,Mh,zr,Lh;const tt=class tt{constructor({name:t=null,port:e=null,verbosity:s=Kg()}={}){f(this,Gr);var i;if(this.name=t,this.destroyed=!1,this.verbosity=s,this._readyCapability=Promise.withResolvers(),this._port=null,this._webWorker=null,this._messageHandler=null,e){if((i=n(tt,gn))!=null&&i.has(e))throw new Error("Cannot use more than one PDFWorker per port.");(n(tt,gn)||g(tt,gn,new WeakMap)).set(e,this),this._initializeFromPort(e);return}this._initialize()}get promise(){return this._readyCapability.promise}get port(){return this._port}get messageHandler(){return this._messageHandler}_initializeFromPort(t){this._port=t,this._messageHandler=new qa("main","worker",t),this._messageHandler.on("ready",function(){}),b(this,Gr,Mh).call(this)}_initialize(){if(n(tt,pn)||n(tt,zr,Lh)){this._setupFakeWorker();return}let{workerSrc:t}=tt;try{tt._isSameOrigin(window.location.href,t)||(t=tt._createCDNWrapper(new URL(t,window.location).href));const e=new Worker(t,{type:"module"}),s=new qa("main","worker",e),i=()=>{r.abort(),s.destroy(),e.terminate(),this.destroyed?this._readyCapability.reject(new Error("Worker was destroyed")):this._setupFakeWorker()},r=new AbortController;e.addEventListener("error",()=>{this._webWorker||i()},{signal:r.signal}),s.on("test",o=>{if(r.abort(),this.destroyed||!o){i();return}this._messageHandler=s,this._port=e,this._webWorker=e,b(this,Gr,Mh).call(this)}),s.on("ready",o=>{if(r.abort(),this.destroyed){i();return}try{a()}catch{this._setupFakeWorker()}});const a=()=>{const o=new Uint8Array;s.send("test",o,[o.buffer])};a();return}catch{Od("The worker has been disabled.")}this._setupFakeWorker()}_setupFakeWorker(){n(tt,pn)||(B("Setting up fake worker."),g(tt,pn,!0)),tt._setupFakeWorkerGlobal.then(t=>{if(this.destroyed){this._readyCapability.reject(new Error("Worker was destroyed"));return}const e=new gb;this._port=e;const s=`fake${$t(tt,Gc)._++}`,i=new qa(s+"_worker",s,e);t.setup(i,e),this._messageHandler=new qa(s,s+"_worker",e),b(this,Gr,Mh).call(this)}).catch(t=>{this._readyCapability.reject(new Error(`Setting up fake worker failed: "${t.message}".`))})}destroy(){var t,e,s;this.destroyed=!0,(t=this._webWorker)==null||t.terminate(),this._webWorker=null,(e=n(tt,gn))==null||e.delete(this._port),this._port=null,(s=this._messageHandler)==null||s.destroy(),this._messageHandler=null}static fromPort(t){var s;if(!(t!=null&&t.port))throw new Error("PDFWorker.fromPort - invalid method signature.");const e=(s=n(this,gn))==null?void 0:s.get(t.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 tt(t)}static get workerSrc(){if(Vs.workerSrc)return Vs.workerSrc;throw new Error('No "GlobalWorkerOptions.workerSrc" specified.')}static get _setupFakeWorkerGlobal(){return G(this,"_setupFakeWorkerGlobal",(async()=>n(this,zr,Lh)?n(this,zr,Lh):(await Vg(()=>import(this.workerSrc),[],import.meta.url)).WorkerMessageHandler)())}};Gc=new WeakMap,pn=new WeakMap,gn=new WeakMap,Gr=new WeakSet,Mh=function(){this._readyCapability.resolve(),this._messageHandler.send("configure",{verbosity:this.verbosity})},zr=new WeakSet,Lh=function(){var t;try{return((t=globalThis.pdfjsWorker)==null?void 0:t.WorkerMessageHandler)||null}catch{return null}},f(tt,zr),f(tt,Gc,0),f(tt,pn,!1),f(tt,gn,void 0),jt&&(g(tt,pn,!0),Vs.workerSrc||(Vs.workerSrc="./pdf.worker.mjs")),tt._isSameOrigin=(t,e)=>{let s;try{if(s=new URL(t),!s.origin||s.origin==="null")return!1}catch{return!1}const i=new URL(e,s);return s.origin===i.origin},tt._createCDNWrapper=t=>{const e=`await import("${t}");`;return URL.createObjectURL(new Blob([e],{type:"text/javascript"}))};let or=tt;var Ps,is,Ur,Vr,ns,mn,Xa;class mb{constructor(t,e,s,i,r){f(this,mn);f(this,Ps,new Map);f(this,is,new Map);f(this,Ur,new Map);f(this,Vr,new Map);f(this,ns,null);this.messageHandler=t,this.loadingTask=e,this.commonObjs=new Vp,this.fontLoader=new gm({ownerDocument:i.ownerDocument,styleElement:i.styleElement}),this.loadingParams=i.loadingParams,this._params=i,this.canvasFactory=r.canvasFactory,this.filterFactory=r.filterFactory,this.cMapReaderFactory=r.cMapReaderFactory,this.standardFontDataFactory=r.standardFontDataFactory,this.destroyed=!1,this.destroyCapability=null,this._networkStream=s,this._fullReader=null,this._lastProgress=null,this.downloadInfoCapability=Promise.withResolvers(),this.setupMessageHandler()}get annotationStorage(){return G(this,"annotationStorage",new bf)}getRenderingIntent(t,e=qs.ENABLE,s=null,i=!1,r=!1){let a=ue.DISPLAY,o=yu;switch(t){case"any":a=ue.ANY;break;case"display":break;case"print":a=ue.PRINT;break;default:B(`getRenderingIntent - invalid intent: ${t}`)}const l=a&ue.PRINT&&s instanceof wp?s:this.annotationStorage;switch(e){case qs.DISABLE:a+=ue.ANNOTATIONS_DISABLE;break;case qs.ENABLE:break;case qs.ENABLE_FORMS:a+=ue.ANNOTATIONS_FORMS;break;case qs.ENABLE_STORAGE:a+=ue.ANNOTATIONS_STORAGE,o=l.serializable;break;default:B(`getRenderingIntent - invalid annotationMode: ${e}`)}i&&(a+=ue.IS_EDITING),r&&(a+=ue.OPLIST);const{ids:h,hash:c}=l.modifiedIds,u=[a,o.hash,c];return{renderingIntent:a,cacheKey:u.join("_"),annotationStorageSerializable:o,modifiedIds:h}}destroy(){var s;if(this.destroyCapability)return this.destroyCapability.promise;this.destroyed=!0,this.destroyCapability=Promise.withResolvers(),(s=n(this,ns))==null||s.reject(new Error("Worker was destroyed during onPassword callback"));const t=[];for(const i of n(this,is).values())t.push(i._destroy());n(this,is).clear(),n(this,Ur).clear(),n(this,Vr).clear(),this.hasOwnProperty("annotationStorage")&&this.annotationStorage.resetModified();const e=this.messageHandler.sendWithPromise("Terminate",null);return t.push(e),Promise.all(t).then(()=>{var i,r;this.commonObjs.clear(),this.fontLoader.clear(),n(this,Ps).clear(),this.filterFactory.destroy(),io.cleanup(),(i=this._networkStream)==null||i.cancelAllRequests(new qn("Worker was terminated.")),(r=this.messageHandler)==null||r.destroy(),this.messageHandler=null,this.destroyCapability.resolve()},this.destroyCapability.reject),this.destroyCapability.promise}setupMessageHandler(){const{messageHandler:t,loadingTask:e}=this;t.on("GetReader",(s,i)=>{ft(this._networkStream,"GetReader - no `IPDFStream` instance available."),this._fullReader=this._networkStream.getFullReader(),this._fullReader.onProgress=r=>{this._lastProgress={loaded:r.loaded,total:r.total}},i.onPull=()=>{this._fullReader.read().then(function({value:r,done:a}){if(a){i.close();return}ft(r instanceof ArrayBuffer,"GetReader - expected an ArrayBuffer."),i.enqueue(new Uint8Array(r),1,[r])}).catch(r=>{i.error(r)})},i.onCancel=r=>{this._fullReader.cancel(r),i.ready.catch(a=>{if(!this.destroyed)throw a})}}),t.on("ReaderHeadersReady",async s=>{var o;await this._fullReader.headersReady;const{isStreamingSupported:i,isRangeSupported:r,contentLength:a}=this._fullReader;return(!i||!r)&&(this._lastProgress&&((o=e.onProgress)==null||o.call(e,this._lastProgress)),this._fullReader.onProgress=l=>{var h;(h=e.onProgress)==null||h.call(e,{loaded:l.loaded,total:l.total})}),{isStreamingSupported:i,isRangeSupported:r,contentLength:a}}),t.on("GetRangeReader",(s,i)=>{ft(this._networkStream,"GetRangeReader - no `IPDFStream` instance available.");const r=this._networkStream.getRangeReader(s.begin,s.end);if(!r){i.close();return}i.onPull=()=>{r.read().then(function({value:a,done:o}){if(o){i.close();return}ft(a instanceof ArrayBuffer,"GetRangeReader - expected an ArrayBuffer."),i.enqueue(new Uint8Array(a),1,[a])}).catch(a=>{i.error(a)})},i.onCancel=a=>{r.cancel(a),i.ready.catch(o=>{if(!this.destroyed)throw o})}}),t.on("GetDoc",({pdfInfo:s})=>{this._numPages=s.numPages,this._htmlForXfa=s.htmlForXfa,delete s.htmlForXfa,e._capability.resolve(new fb(s,this))}),t.on("DocException",function(s){let i;switch(s.name){case"PasswordException":i=new Qd(s.message,s.code);break;case"InvalidPDFException":i=new qf(s.message);break;case"MissingPDFException":i=new dh(s.message);break;case"UnexpectedResponseException":i=new Nd(s.message,s.status);break;case"UnknownErrorException":i=new Jd(s.message,s.details);break;default:K("DocException - expected a valid Error.")}e._capability.reject(i)}),t.on("PasswordRequest",s=>{if(g(this,ns,Promise.withResolvers()),e.onPassword){const i=r=>{r instanceof Error?n(this,ns).reject(r):n(this,ns).resolve({password:r})};try{e.onPassword(i,s.code)}catch(r){n(this,ns).reject(r)}}else n(this,ns).reject(new Qd(s.message,s.code));return n(this,ns).promise}),t.on("DataLoaded",s=>{var i;(i=e.onProgress)==null||i.call(e,{loaded:s.length,total:s.length}),this.downloadInfoCapability.resolve(s)}),t.on("StartRenderPage",s=>{if(this.destroyed)return;n(this,is).get(s.pageIndex)._startRenderPage(s.transparency,s.cacheKey)}),t.on("commonobj",([s,i,r])=>{var a;if(this.destroyed||this.commonObjs.has(s))return null;switch(i){case"Font":const{disableFontFace:o,fontExtraProperties:l,pdfBug:h}=this._params;if("error"in r){const m=r.error;B(`Error during font loading: ${m}`),this.commonObjs.resolve(s,m);break}const c=h&&((a=globalThis.FontInspector)!=null&&a.enabled)?(m,A)=>globalThis.FontInspector.fontAdded(m,A):null,u=new mm(r,{disableFontFace:o,inspectFont:c});this.fontLoader.bind(u).catch(()=>t.sendWithPromise("FontFallback",{id:s})).finally(()=>{!l&&u.data&&(u.data=null),this.commonObjs.resolve(s,u)});break;case"CopyLocalImage":const{imageRef:p}=r;ft(p,"The imageRef must be defined.");for(const m of n(this,is).values())for(const[,A]of m.objs)if((A==null?void 0:A.ref)===p)return A.dataLen?(this.commonObjs.resolve(s,structuredClone(A)),A.dataLen):null;break;case"FontPath":case"Image":case"Pattern":this.commonObjs.resolve(s,r);break;default:throw new Error(`Got unknown common object type ${i}`)}return null}),t.on("obj",([s,i,r,a])=>{var l;if(this.destroyed)return;const o=n(this,is).get(i);if(!o.objs.has(s)){if(o._intentStates.size===0){(l=a==null?void 0:a.bitmap)==null||l.close();return}switch(r){case"Image":o.objs.resolve(s,a),(a==null?void 0:a.dataLen)>jg&&(o._maybeCleanupAfterRender=!0);break;case"Pattern":o.objs.resolve(s,a);break;default:throw new Error(`Got unknown object type ${r}`)}}}),t.on("DocProgress",s=>{var i;this.destroyed||(i=e.onProgress)==null||i.call(e,{loaded:s.loaded,total:s.total})}),t.on("FetchBuiltInCMap",async s=>{if(this.destroyed)throw new Error("Worker was destroyed.");if(!this.cMapReaderFactory)throw new Error("CMapReaderFactory not initialized, see the `useWorkerFetch` parameter.");return this.cMapReaderFactory.fetch(s)}),t.on("FetchStandardFontData",async s=>{if(this.destroyed)throw new Error("Worker was destroyed.");if(!this.standardFontDataFactory)throw new Error("StandardFontDataFactory not initialized, see the `useWorkerFetch` parameter.");return this.standardFontDataFactory.fetch(s)})}getData(){return this.messageHandler.sendWithPromise("GetData",null)}saveDocument(){var s;this.annotationStorage.size<=0&&B("saveDocument called while `annotationStorage` is empty, please use the getData-method instead.");const{map:t,transfer:e}=this.annotationStorage.serializable;return this.messageHandler.sendWithPromise("SaveDocument",{isPureXfa:!!this._htmlForXfa,numPages:this._numPages,annotationStorage:t,filename:((s=this._fullReader)==null?void 0:s.filename)??null},e).finally(()=>{this.annotationStorage.resetModified()})}getPage(t){if(!Number.isInteger(t)||t<=0||t>this._numPages)return Promise.reject(new Error("Invalid page request."));const e=t-1,s=n(this,Ur).get(e);if(s)return s;const i=this.messageHandler.sendWithPromise("GetPage",{pageIndex:e}).then(r=>{if(this.destroyed)throw new Error("Transport destroyed");r.refStr&&n(this,Vr).set(r.refStr,t);const a=new pb(e,r,this,this._params.pdfBug);return n(this,is).set(e,a),a});return n(this,Ur).set(e,i),i}getPageIndex(t){return zf(t)?this.messageHandler.sendWithPromise("GetPageIndex",{num:t.num,gen:t.gen}):Promise.reject(new Error("Invalid pageIndex request."))}getAnnotations(t,e){return this.messageHandler.sendWithPromise("GetAnnotations",{pageIndex:t,intent:e})}getFieldObjects(){return b(this,mn,Xa).call(this,"GetFieldObjects")}hasJSActions(){return b(this,mn,Xa).call(this,"HasJSActions")}getCalculationOrderIds(){return this.messageHandler.sendWithPromise("GetCalculationOrderIds",null)}getDestinations(){return this.messageHandler.sendWithPromise("GetDestinations",null)}getDestination(t){return typeof t!="string"?Promise.reject(new Error("Invalid destination request.")):this.messageHandler.sendWithPromise("GetDestination",{id:t})}getPageLabels(){return this.messageHandler.sendWithPromise("GetPageLabels",null)}getPageLayout(){return this.messageHandler.sendWithPromise("GetPageLayout",null)}getPageMode(){return this.messageHandler.sendWithPromise("GetPageMode",null)}getViewerPreferences(){return this.messageHandler.sendWithPromise("GetViewerPreferences",null)}getOpenAction(){return this.messageHandler.sendWithPromise("GetOpenAction",null)}getAttachments(){return this.messageHandler.sendWithPromise("GetAttachments",null)}getDocJSActions(){return b(this,mn,Xa).call(this,"GetDocJSActions")}getPageJSActions(t){return this.messageHandler.sendWithPromise("GetPageJSActions",{pageIndex:t})}getStructTree(t){return this.messageHandler.sendWithPromise("GetStructTree",{pageIndex:t})}getOutline(){return this.messageHandler.sendWithPromise("GetOutline",null)}getOptionalContentConfig(t){return b(this,mn,Xa).call(this,"GetOptionalContentConfig").then(e=>new Hm(e,t))}getPermissions(){return this.messageHandler.sendWithPromise("GetPermissions",null)}getMetadata(){const t="GetMetadata",e=n(this,Ps).get(t);if(e)return e;const s=this.messageHandler.sendWithPromise(t,null).then(i=>{var r,a;return{info:i[0],metadata:i[1]?new Om(i[1]):null,contentDispositionFilename:((r=this._fullReader)==null?void 0:r.filename)??null,contentLength:((a=this._fullReader)==null?void 0:a.contentLength)??null}});return n(this,Ps).set(t,s),s}getMarkInfo(){return this.messageHandler.sendWithPromise("GetMarkInfo",null)}async startCleanup(t=!1){if(!this.destroyed){await this.messageHandler.sendWithPromise("Cleanup",null);for(const e of n(this,is).values())if(!e.cleanup())throw new Error(`startCleanup: Page ${e.pageNumber} is currently rendering.`);this.commonObjs.clear(),t||this.fontLoader.clear(),n(this,Ps).clear(),this.filterFactory.destroy(!0),io.cleanup()}}cachedPageNumber(t){if(!zf(t))return null;const e=t.gen===0?`${t.num}R`:`${t.num}R${t.gen}`;return n(this,Vr).get(e)??null}}Ps=new WeakMap,is=new WeakMap,Ur=new WeakMap,Vr=new WeakMap,ns=new WeakMap,mn=new WeakSet,Xa=function(t,e=null){const s=n(this,Ps).get(t);if(s)return s;const i=this.messageHandler.sendWithPromise(t,e);return n(this,Ps).set(t,i),i};const Ah=Symbol("INITIAL_DATA");var Le,dl,Mu;class Vp{constructor(){f(this,dl);f(this,Le,Object.create(null))}get(t,e=null){if(e){const i=b(this,dl,Mu).call(this,t);return i.promise.then(()=>e(i.data)),null}const s=n(this,Le)[t];if(!s||s.data===Ah)throw new Error(`Requesting object that isn't resolved yet ${t}.`);return s.data}has(t){const e=n(this,Le)[t];return!!e&&e.data!==Ah}resolve(t,e=null){const s=b(this,dl,Mu).call(this,t);s.data=e,s.resolve()}clear(){var t;for(const e in n(this,Le)){const{data:s}=n(this,Le)[e];(t=s==null?void 0:s.bitmap)==null||t.close()}g(this,Le,Object.create(null))}*[Symbol.iterator](){for(const t in n(this,Le)){const{data:e}=n(this,Le)[t];e!==Ah&&(yield[t,e])}}}Le=new WeakMap,dl=new WeakSet,Mu=function(t){var e;return(e=n(this,Le))[t]||(e[t]={...Promise.withResolvers(),data:Ah})};var mi;class bb{constructor(t){f(this,mi,null);g(this,mi,t),this.onContinue=null}get promise(){return n(this,mi).capability.promise}cancel(t=0){n(this,mi).cancel(null,t)}get separateAnnots(){const{separateAnnots:t}=n(this,mi).operatorList;if(!t)return!1;const{annotationCanvasMap:e}=n(this,mi);return t.form||t.canvas&&(e==null?void 0:e.size)>0}}mi=new WeakMap;var bi,bn;const Di=class Di{constructor({callback:t,params:e,objs:s,commonObjs:i,annotationCanvasMap:r,operatorList:a,pageIndex:o,canvasFactory:l,filterFactory:h,useRequestAnimationFrame:c=!1,pdfBug:u=!1,pageColors:p=null}){f(this,bi,null);this.callback=t,this.params=e,this.objs=s,this.commonObjs=i,this.annotationCanvasMap=r,this.operatorListIdx=null,this.operatorList=a,this._pageIndex=o,this.canvasFactory=l,this.filterFactory=h,this._pdfBug=u,this.pageColors=p,this.running=!1,this.graphicsReadyCallback=null,this.graphicsReady=!1,this._useRequestAnimationFrame=c===!0&&typeof window<"u",this.cancelled=!1,this.capability=Promise.withResolvers(),this.task=new bb(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:t=!1,optionalContentConfig:e}){var o,l;if(this.cancelled)return;if(this._canvas){if(n(Di,bn).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.");n(Di,bn).add(this._canvas)}this._pdfBug&&((o=globalThis.StepperManager)!=null&&o.enabled)&&(this.stepper=globalThis.StepperManager.create(this._pageIndex),this.stepper.init(this.operatorList),this.stepper.nextBreakPoint=this.stepper.getNextBreakPoint());const{canvasContext:s,viewport:i,transform:r,background:a}=this.params;this.gfx=new ar(s,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:e},this.annotationCanvasMap,this.pageColors),this.gfx.beginDrawing({transform:r,viewport:i,transparency:t,background:a}),this.operatorListIdx=0,this.graphicsReady=!0,(l=this.graphicsReadyCallback)==null||l.call(this)}cancel(t=null,e=0){var s;this.running=!1,this.cancelled=!0,(s=this.gfx)==null||s.endDrawing(),n(this,bi)&&(window.cancelAnimationFrame(n(this,bi)),g(this,bi,null)),n(Di,bn).delete(this._canvas),this.callback(t||new ff(`Rendering cancelled, page ${this._pageIndex+1}`,e))}operatorListChanged(){var t;if(!this.graphicsReady){this.graphicsReadyCallback||(this.graphicsReadyCallback=this._continueBound);return}(t=this.stepper)==null||t.updateOperatorList(this.operatorList),!this.running&&this._continue()}_continue(){this.running=!0,!this.cancelled&&(this.task.onContinue?this.task.onContinue(this._scheduleNextBound):this._scheduleNext())}_scheduleNext(){this._useRequestAnimationFrame?g(this,bi,window.requestAnimationFrame(()=>{g(this,bi,null),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(),n(Di,bn).delete(this._canvas),this.callback())))}};bi=new WeakMap,bn=new WeakMap,f(Di,bn,new WeakSet);let Lu=Di;const Ab="4.9.124",_b="867aaf01f";function Uf(d){return Math.floor(Math.max(0,Math.min(1,d))*255).toString(16).padStart(2,"0")}function Ha(d){return Math.max(0,Math.min(255,255*d))}class Vf{static CMYK_G([t,e,s,i]){return["G",1-Math.min(1,.3*t+.59*s+.11*e+i)]}static G_CMYK([t]){return["CMYK",0,0,0,1-t]}static G_RGB([t]){return["RGB",t,t,t]}static G_rgb([t]){return t=Ha(t),[t,t,t]}static G_HTML([t]){const e=Uf(t);return`#${e}${e}${e}`}static RGB_G([t,e,s]){return["G",.3*t+.59*e+.11*s]}static RGB_rgb(t){return t.map(Ha)}static RGB_HTML(t){return`#${t.map(Uf).join("")}`}static T_HTML(){return"#00000000"}static T_rgb(){return[null]}static CMYK_RGB([t,e,s,i]){return["RGB",1-Math.min(1,t+i),1-Math.min(1,s+i),1-Math.min(1,e+i)]}static CMYK_rgb([t,e,s,i]){return[Ha(1-Math.min(1,t+i)),Ha(1-Math.min(1,s+i)),Ha(1-Math.min(1,e+i))]}static CMYK_HTML(t){const e=this.CMYK_RGB(t).slice(1);return this.RGB_HTML(e)}static RGB_CMYK([t,e,s]){const i=1-t,r=1-e,a=1-s,o=Math.min(i,r,a);return["CMYK",i,r,a,o]}}class yb{create(t,e,s=!1){if(t<=0||e<=0)throw new Error("Invalid SVG dimensions");const i=this._createSVG("svg:svg");return i.setAttribute("version","1.1"),s||(i.setAttribute("width",`${t}px`),i.setAttribute("height",`${e}px`)),i.setAttribute("preserveAspectRatio","none"),i.setAttribute("viewBox",`0 0 ${t} ${e}`),i}createElement(t){if(typeof t!="string")throw new Error("Invalid SVG element type");return this._createSVG(t)}_createSVG(t){K("Abstract method `_createSVG` called.")}}class _f extends yb{_createSVG(t){return document.createElementNS(ps,t)}}class jp{static setupStorage(t,e,s,i,r){const a=i.getValue(e,{value:null});switch(s.name){case"textarea":if(a.value!==null&&(t.textContent=a.value),r==="print")break;t.addEventListener("input",o=>{i.setValue(e,{value:o.target.value})});break;case"input":if(s.attributes.type==="radio"||s.attributes.type==="checkbox"){if(a.value===s.attributes.xfaOn?t.setAttribute("checked",!0):a.value===s.attributes.xfaOff&&t.removeAttribute("checked"),r==="print")break;t.addEventListener("change",o=>{i.setValue(e,{value:o.target.checked?o.target.getAttribute("xfaOn"):o.target.getAttribute("xfaOff")})})}else{if(a.value!==null&&t.setAttribute("value",a.value),r==="print")break;t.addEventListener("input",o=>{i.setValue(e,{value:o.target.value})})}break;case"select":if(a.value!==null){t.setAttribute("value",a.value);for(const o of s.children)o.attributes.value===a.value?o.attributes.selected=!0:o.attributes.hasOwnProperty("selected")&&delete o.attributes.selected}t.addEventListener("input",o=>{const l=o.target.options,h=l.selectedIndex===-1?"":l[l.selectedIndex].value;i.setValue(e,{value:h})});break}}static setAttributes({html:t,element:e,storage:s=null,intent:i,linkService:r}){const{attributes:a}=e,o=t instanceof HTMLAnchorElement;a.type==="radio"&&(a.name=`${a.name}-${i}`);for(const[l,h]of Object.entries(a))if(h!=null)switch(l){case"class":h.length&&t.setAttribute(l,h.join(" "));break;case"dataId":break;case"id":t.setAttribute("data-element-id",h);break;case"style":Object.assign(t.style,h);break;case"textContent":t.textContent=h;break;default:(!o||l!=="href"&&l!=="newWindow")&&t.setAttribute(l,h)}o&&r.addLinkAttributes(t,a.href,a.newWindow),s&&a.dataId&&this.setupStorage(t,a.dataId,e,s)}static render(t){var u,p;const e=t.annotationStorage,s=t.linkService,i=t.xfaHtml,r=t.intent||"display",a=document.createElement(i.name);i.attributes&&this.setAttributes({html:a,element:i,intent:r,linkService:s});const o=r!=="richText",l=t.div;if(l.append(a),t.viewport){const m=`matrix(${t.viewport.transform.join(",")})`;l.style.transform=m}o&&l.setAttribute("class","xfaLayer xfaFont");const h=[];if(i.children.length===0){if(i.value){const m=document.createTextNode(i.value);a.append(m),o&&no.shouldBuildText(i.name)&&h.push(m)}return{textDivs:h}}const c=[[i,-1,a]];for(;c.length>0;){const[m,A,_]=c.at(-1);if(A+1===m.children.length){c.pop();continue}const w=m.children[++c.at(-1)[1]];if(w===null)continue;const{name:y}=w;if(y==="#text"){const S=document.createTextNode(w.value);h.push(S),_.append(S);continue}const v=(u=w==null?void 0:w.attributes)!=null&&u.xmlns?document.createElementNS(w.attributes.xmlns,y):document.createElement(y);if(_.append(v),w.attributes&&this.setAttributes({html:v,element:w,storage:e,intent:r,linkService:s}),((p=w.children)==null?void 0:p.length)>0)c.push([w,-1,v]);else if(w.value){const S=document.createTextNode(w.value);o&&no.shouldBuildText(y)&&h.push(S),v.append(S)}}for(const m of l.querySelectorAll(".xfaNonInteractive input, .xfaNonInteractive textarea"))m.setAttribute("readOnly",!0);return{textDivs:h}}static update(t){const e=`matrix(${t.viewport.transform.join(",")})`;t.div.style.transform=e,t.div.hidden=!1}}const ph=1e3,wb=9,Wn=new WeakSet;function js(d){return{width:d[2]-d[0],height:d[3]-d[1]}}class vb{static create(t){switch(t.data.annotationType){case gt.LINK:return new Wp(t);case gt.TEXT:return new Eb(t);case gt.WIDGET:switch(t.data.fieldType){case"Tx":return new Sb(t);case"Btn":return t.data.radioButton?new Yp(t):t.data.checkBox?new Cb(t):new Tb(t);case"Ch":return new Rb(t);case"Sig":return new xb(t)}return new Xn(t);case gt.POPUP:return new Du(t);case gt.FREETEXT:return new tg(t);case gt.LINE:return new kb(t);case gt.SQUARE:return new Mb(t);case gt.CIRCLE:return new Lb(t);case gt.POLYLINE:return new eg(t);case gt.CARET:return new Db(t);case gt.INK:return new yf(t);case gt.POLYGON:return new Ib(t);case gt.HIGHLIGHT:return new sg(t);case gt.UNDERLINE:return new Fb(t);case gt.SQUIGGLY:return new Ob(t);case gt.STRIKEOUT:return new Nb(t);case gt.STAMP:return new ig(t);case gt.FILEATTACHMENT:return new Hb(t);default:return new dt(t)}}}var An,jr,Wr,ul,Iu;const Ef=class Ef{constructor(t,{isRenderable:e=!1,ignoreBorder:s=!1,createQuadrilaterals:i=!1}={}){f(this,ul);f(this,An,null);f(this,jr,!1);f(this,Wr,null);this.isRenderable=e,this.data=t.data,this.layer=t.layer,this.linkService=t.linkService,this.downloadManager=t.downloadManager,this.imageResourcesPath=t.imageResourcesPath,this.renderForms=t.renderForms,this.svgFactory=t.svgFactory,this.annotationStorage=t.annotationStorage,this.enableScripting=t.enableScripting,this.hasJSActions=t.hasJSActions,this._fieldObjects=t.fieldObjects,this.parent=t.parent,e&&(this.container=this._createContainer(s)),i&&this._createQuadrilaterals()}static _hasPopupData({titleObj:t,contentsObj:e,richText:s}){return!!(t!=null&&t.str||e!=null&&e.str||s!=null&&s.str)}get _isEditable(){return this.data.isEditable}get hasPopupData(){return Ef._hasPopupData(this.data)}updateEdited(t){var s;if(!this.container)return;n(this,An)||g(this,An,{rect:this.data.rect.slice(0)});const{rect:e}=t;e&&b(this,ul,Iu).call(this,e),(s=n(this,Wr))==null||s.popup.updateEdited(t)}resetEdited(){var t;n(this,An)&&(b(this,ul,Iu).call(this,n(this,An).rect),(t=n(this,Wr))==null||t.popup.resetEdited(),g(this,An,null))}_createContainer(t){const{data:e,parent:{page:s,viewport:i}}=this,r=document.createElement("section");r.setAttribute("data-annotation-id",e.id),this instanceof Xn||(r.tabIndex=ph);const{style:a}=r;if(a.zIndex=this.parent.zIndex++,e.alternativeText&&(r.title=e.alternativeText),e.noRotate&&r.classList.add("norotate"),!e.rect||this instanceof Du){const{rotation:_}=e;return!e.hasOwnCanvas&&_!==0&&this.setRotation(_,r),r}const{width:o,height:l}=js(e.rect);if(!t&&e.borderStyle.width>0){a.borderWidth=`${e.borderStyle.width}px`;const _=e.borderStyle.horizontalCornerRadius,w=e.borderStyle.verticalCornerRadius;if(_>0||w>0){const v=`calc(${_}px * var(--scale-factor)) / calc(${w}px * var(--scale-factor))`;a.borderRadius=v}else if(this instanceof Yp){const v=`calc(${o}px * var(--scale-factor)) / calc(${l}px * var(--scale-factor))`;a.borderRadius=v}switch(e.borderStyle.style){case Oa.SOLID:a.borderStyle="solid";break;case Oa.DASHED:a.borderStyle="dashed";break;case Oa.BEVELED:B("Unimplemented border style: beveled");break;case Oa.INSET:B("Unimplemented border style: inset");break;case Oa.UNDERLINE:a.borderBottomStyle="solid";break}const y=e.borderColor||null;y?(g(this,jr,!0),a.borderColor=M.makeHexColor(y[0]|0,y[1]|0,y[2]|0)):a.borderWidth=0}const h=M.normalizeRect([e.rect[0],s.view[3]-e.rect[1]+s.view[1],e.rect[2],s.view[3]-e.rect[3]+s.view[1]]),{pageWidth:c,pageHeight:u,pageX:p,pageY:m}=i.rawDims;a.left=`${100*(h[0]-p)/c}%`,a.top=`${100*(h[1]-m)/u}%`;const{rotation:A}=e;return e.hasOwnCanvas||A===0?(a.width=`${100*o/c}%`,a.height=`${100*l/u}%`):this.setRotation(A,r),r}setRotation(t,e=this.container){if(!this.data.rect)return;const{pageWidth:s,pageHeight:i}=this.parent.viewport.rawDims,{width:r,height:a}=js(this.data.rect);let o,l;t%180===0?(o=100*r/s,l=100*a/i):(o=100*a/s,l=100*r/i),e.style.width=`${o}%`,e.style.height=`${l}%`,e.setAttribute("data-main-rotation",(360-t)%360)}get _commonActions(){const t=(e,s,i)=>{const r=i.detail[e],a=r[0],o=r.slice(1);i.target.style[s]=Vf[`${a}_HTML`](o),this.annotationStorage.setValue(this.data.id,{[s]:Vf[`${a}_rgb`](o)})};return G(this,"_commonActions",{display:e=>{const{display:s}=e.detail,i=s%2===1;this.container.style.visibility=i?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noView:i,noPrint:s===1||s===2})},print:e=>{this.annotationStorage.setValue(this.data.id,{noPrint:!e.detail.print})},hidden:e=>{const{hidden:s}=e.detail;this.container.style.visibility=s?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noPrint:s,noView:s})},focus:e=>{setTimeout(()=>e.target.focus({preventScroll:!1}),0)},userName:e=>{e.target.title=e.detail.userName},readonly:e=>{e.target.disabled=e.detail.readonly},required:e=>{this._setRequired(e.target,e.detail.required)},bgColor:e=>{t("bgColor","backgroundColor",e)},fillColor:e=>{t("fillColor","backgroundColor",e)},fgColor:e=>{t("fgColor","color",e)},textColor:e=>{t("textColor","color",e)},borderColor:e=>{t("borderColor","borderColor",e)},strokeColor:e=>{t("strokeColor","borderColor",e)},rotation:e=>{const s=e.detail.rotation;this.setRotation(s),this.annotationStorage.setValue(this.data.id,{rotation:s})}})}_dispatchEventFromSandbox(t,e){const s=this._commonActions;for(const i of Object.keys(e.detail)){const r=t[i]||s[i];r==null||r(e)}}_setDefaultPropertiesFromJS(t){if(!this.enableScripting)return;const e=this.annotationStorage.getRawValue(this.data.id);if(!e)return;const s=this._commonActions;for(const[i,r]of Object.entries(e)){const a=s[i];if(a){const o={detail:{[i]:r},target:t};a(o),delete e[i]}}}_createQuadrilaterals(){if(!this.container)return;const{quadPoints:t}=this.data;if(!t)return;const[e,s,i,r]=this.data.rect.map(_=>Math.fround(_));if(t.length===8){const[_,w,y,v]=t.subarray(2,6);if(i===_&&r===w&&e===y&&s===v)return}const{style:a}=this.container;let o;if(n(this,jr)){const{borderColor:_,borderWidth:w}=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="${_}" stroke-width="${w}">`],this.container.classList.add("hasBorder")}const l=i-e,h=r-s,{svgFactory:c}=this,u=c.createElement("svg");u.classList.add("quadrilateralsContainer"),u.setAttribute("width",0),u.setAttribute("height",0);const p=c.createElement("defs");u.append(p);const m=c.createElement("clipPath"),A=`clippath_${this.data.id}`;m.setAttribute("id",A),m.setAttribute("clipPathUnits","objectBoundingBox"),p.append(m);for(let _=2,w=t.length;_<w;_+=8){const y=t[_],v=t[_+1],S=t[_+2],E=t[_+3],x=c.createElement("rect"),C=(S-e)/l,T=(r-v)/h,k=(y-S)/l,D=(v-E)/h;x.setAttribute("x",C),x.setAttribute("y",T),x.setAttribute("width",k),x.setAttribute("height",D),m.append(x),o==null||o.push(`<rect vector-effect="non-scaling-stroke" x="${C}" y="${T}" width="${k}" height="${D}"/>`)}n(this,jr)&&(o.push("</g></svg>')"),a.backgroundImage=o.join("")),this.container.append(u),this.container.style.clipPath=`url(#${A})`}_createPopup(){const{data:t}=this,e=g(this,Wr,new Du({data:{color:t.color,titleObj:t.titleObj,modificationDate:t.modificationDate,contentsObj:t.contentsObj,richText:t.richText,parentRect:t.rect,borderStyle:0,id:`popup_${t.id}`,rotation:t.rotation},parent:this.parent,elements:[this]}));this.parent.div.append(e.render())}render(){K("Abstract method `AnnotationElement.render` called")}_getElementsByName(t,e=null){const s=[];if(this._fieldObjects){const i=this._fieldObjects[t];if(i)for(const{page:r,id:a,exportValues:o}of i){if(r===-1||a===e)continue;const l=typeof o=="string"?o:null,h=document.querySelector(`[data-element-id="${a}"]`);if(h&&!Wn.has(h)){B(`_getElementsByName - element not allowed: ${a}`);continue}s.push({id:a,exportValue:l,domElement:h})}return s}for(const i of document.getElementsByName(t)){const{exportValue:r}=i,a=i.getAttribute("data-element-id");a!==e&&Wn.has(i)&&s.push({id:a,exportValue:r,domElement:i})}return s}show(){var t;this.container&&(this.container.hidden=!1),(t=this.popup)==null||t.maybeShow()}hide(){var t;this.container&&(this.container.hidden=!0),(t=this.popup)==null||t.forceHide()}getElementsToTriggerPopup(){return this.container}addHighlightArea(){const t=this.getElementsToTriggerPopup();if(Array.isArray(t))for(const e of t)e.classList.add("highlightArea");else t.classList.add("highlightArea")}_editOnDoubleClick(){if(!this._isEditable)return;const{annotationEditorType:t,data:{id:e}}=this;this.container.addEventListener("dblclick",()=>{var s;(s=this.linkService.eventBus)==null||s.dispatch("switchannotationeditormode",{source:this,mode:t,editId:e})})}};An=new WeakMap,jr=new WeakMap,Wr=new WeakMap,ul=new WeakSet,Iu=function(t){const{container:{style:e},data:{rect:s,rotation:i},parent:{viewport:{rawDims:{pageWidth:r,pageHeight:a,pageX:o,pageY:l}}}}=this;s==null||s.splice(0,4,...t);const{width:h,height:c}=js(t);e.left=`${100*(t[0]-o)/r}%`,e.top=`${100*(a-t[3]+l)/a}%`,i===0?(e.width=`${100*h/r}%`,e.height=`${100*c/a}%`):this.setRotation(i)};let dt=Ef;var ks,ki,zc,qp,Uc,Xp;class Wp extends dt{constructor(e,s=null){super(e,{isRenderable:!0,ignoreBorder:!!(s!=null&&s.ignoreBorder),createQuadrilaterals:!0});f(this,ks);f(this,zc);f(this,Uc);this.isTooltipOnly=e.data.isTooltipOnly}render(){const{data:e,linkService:s}=this,i=document.createElement("a");i.setAttribute("data-element-id",e.id);let r=!1;return e.url?(s.addLinkAttributes(i,e.url,e.newWindow),r=!0):e.action?(this._bindNamedAction(i,e.action),r=!0):e.attachment?(b(this,zc,qp).call(this,i,e.attachment,e.attachmentDest),r=!0):e.setOCGState?(b(this,Uc,Xp).call(this,i,e.setOCGState),r=!0):e.dest?(this._bindLink(i,e.dest),r=!0):(e.actions&&(e.actions.Action||e.actions["Mouse Up"]||e.actions["Mouse Down"])&&this.enableScripting&&this.hasJSActions&&(this._bindJSAction(i,e),r=!0),e.resetForm?(this._bindResetFormAction(i,e.resetForm),r=!0):this.isTooltipOnly&&!r&&(this._bindLink(i,""),r=!0)),this.container.classList.add("linkAnnotation"),r&&this.container.append(i),this.container}_bindLink(e,s){e.href=this.linkService.getDestinationHash(s),e.onclick=()=>(s&&this.linkService.goToDestination(s),!1),(s||s==="")&&b(this,ks,ki).call(this)}_bindNamedAction(e,s){e.href=this.linkService.getAnchorUrl(""),e.onclick=()=>(this.linkService.executeNamedAction(s),!1),b(this,ks,ki).call(this)}_bindJSAction(e,s){e.href=this.linkService.getAnchorUrl("");const i=new Map([["Action","onclick"],["Mouse Up","onmouseup"],["Mouse Down","onmousedown"]]);for(const r of Object.keys(s.actions)){const a=i.get(r);a&&(e[a]=()=>{var o;return(o=this.linkService.eventBus)==null||o.dispatch("dispatcheventinsandbox",{source:this,detail:{id:s.id,name:r}}),!1})}e.onclick||(e.onclick=()=>!1),b(this,ks,ki).call(this)}_bindResetFormAction(e,s){const i=e.onclick;if(i||(e.href=this.linkService.getAnchorUrl("")),b(this,ks,ki).call(this),!this._fieldObjects){B('_bindResetFormAction - "resetForm" action not supported, ensure that the `fieldObjects` parameter is provided.'),i||(e.onclick=()=>!1);return}e.onclick=()=>{var u;i==null||i();const{fields:r,refs:a,include:o}=s,l=[];if(r.length!==0||a.length!==0){const p=new Set(a);for(const m of r){const A=this._fieldObjects[m]||[];for(const{id:_}of A)p.add(_)}for(const m of Object.values(this._fieldObjects))for(const A of m)p.has(A.id)===o&&l.push(A)}else for(const p of Object.values(this._fieldObjects))l.push(...p);const h=this.annotationStorage,c=[];for(const p of l){const{id:m}=p;switch(c.push(m),p.type){case"text":{const _=p.defaultValue||"";h.setValue(m,{value:_});break}case"checkbox":case"radiobutton":{const _=p.defaultValue===p.exportValues;h.setValue(m,{value:_});break}case"combobox":case"listbox":{const _=p.defaultValue||"";h.setValue(m,{value:_});break}default:continue}const A=document.querySelector(`[data-element-id="${m}"]`);if(A){if(!Wn.has(A)){B(`_bindResetFormAction - element not allowed: ${m}`);continue}}else continue;A.dispatchEvent(new Event("resetform"))}return this.enableScripting&&((u=this.linkService.eventBus)==null||u.dispatch("dispatcheventinsandbox",{source:this,detail:{id:"app",ids:c,name:"ResetForm"}})),!1}}}ks=new WeakSet,ki=function(){this.container.setAttribute("data-internal-link","")},zc=new WeakSet,qp=function(e,s,i=null){e.href=this.linkService.getAnchorUrl(""),s.description&&(e.title=s.description),e.onclick=()=>{var r;return(r=this.downloadManager)==null||r.openOrDownloadData(s.content,s.filename,i),!1},b(this,ks,ki).call(this)},Uc=new WeakSet,Xp=function(e,s){e.href=this.linkService.getAnchorUrl(""),e.onclick=()=>(this.linkService.executeSetOCGState(s),!1),b(this,ks,ki).call(this)};class Eb extends dt{constructor(t){super(t,{isRenderable:!0})}render(){this.container.classList.add("textAnnotation");const t=document.createElement("img");return t.src=this.imageResourcesPath+"annotation-"+this.data.name.toLowerCase()+".svg",t.setAttribute("data-l10n-id","pdfjs-text-annotation-type"),t.setAttribute("data-l10n-args",JSON.stringify({type:this.data.name})),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.append(t),this.container}}class Xn extends dt{render(){return this.container}showElementAndHideCanvas(t){var e;this.data.hasOwnCanvas&&(((e=t.previousSibling)==null?void 0:e.nodeName)==="CANVAS"&&(t.previousSibling.hidden=!0),t.hidden=!1)}_getKeyModifier(t){return Wt.platform.isMac?t.metaKey:t.ctrlKey}_setEventListener(t,e,s,i,r){s.includes("mouse")?t.addEventListener(s,a=>{var o;(o=this.linkService.eventBus)==null||o.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:i,value:r(a),shift:a.shiftKey,modifier:this._getKeyModifier(a)}})}):t.addEventListener(s,a=>{var o;if(s==="blur"){if(!e.focused||!a.relatedTarget)return;e.focused=!1}else if(s==="focus"){if(e.focused)return;e.focused=!0}r&&((o=this.linkService.eventBus)==null||o.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:i,value:r(a)}}))})}_setEventListeners(t,e,s,i){var r,a,o;for(const[l,h]of s)(h==="Action"||(r=this.data.actions)!=null&&r[h])&&((h==="Focus"||h==="Blur")&&(e||(e={focused:!1})),this._setEventListener(t,e,l,h,i),h==="Focus"&&!((a=this.data.actions)!=null&&a.Blur)?this._setEventListener(t,e,"blur","Blur",null):h==="Blur"&&!((o=this.data.actions)!=null&&o.Focus)&&this._setEventListener(t,e,"focus","Focus",null))}_setBackgroundColor(t){const e=this.data.backgroundColor||null;t.style.backgroundColor=e===null?"transparent":M.makeHexColor(e[0],e[1],e[2])}_setTextStyle(t){const e=["left","center","right"],{fontColor:s}=this.data.defaultAppearanceData,i=this.data.defaultAppearanceData.fontSize||wb,r=t.style;let a;const o=2,l=h=>Math.round(10*h)/10;if(this.data.multiLine){const h=Math.abs(this.data.rect[3]-this.data.rect[1]-o),c=Math.round(h/(Vd*i))||1,u=h/c;a=Math.min(i,l(u/Vd))}else{const h=Math.abs(this.data.rect[3]-this.data.rect[1]-o);a=Math.min(i,l(h/Vd))}r.fontSize=`calc(${a}px * var(--scale-factor))`,r.color=M.makeHexColor(s[0],s[1],s[2]),this.data.textAlignment!==null&&(r.textAlign=e[this.data.textAlignment])}_setRequired(t,e){e?t.setAttribute("required",!0):t.removeAttribute("required"),t.setAttribute("aria-required",e)}}class Sb extends Xn{constructor(t){const e=t.renderForms||t.data.hasOwnCanvas||!t.data.hasAppearance&&!!t.data.fieldValue;super(t,{isRenderable:e})}setPropertyOnSiblings(t,e,s,i){const r=this.annotationStorage;for(const a of this._getElementsByName(t.name,t.id))a.domElement&&(a.domElement[e]=s),r.setValue(a.id,{[i]:s})}render(){var i,r;const t=this.annotationStorage,e=this.data.id;this.container.classList.add("textWidgetAnnotation");let s=null;if(this.renderForms){const a=t.getValue(e,{value:this.data.fieldValue});let o=a.value||"";const l=t.getValue(e,{charLimit:this.data.maxLen}).charLimit;l&&o.length>l&&(o=o.slice(0,l));let h=a.formattedValue||((i=this.data.textContent)==null?void 0:i.join(`
3
3
  `))||null;h&&this.data.comb&&(h=h.replaceAll(/\s+/g,""));const c={userValue:o,formattedValue:h,lastCommittedValue:null,commitKey:1,focused:!1};this.data.multiLine?(s=document.createElement("textarea"),s.textContent=h??o,this.data.doNotScroll&&(s.style.overflowY="hidden")):(s=document.createElement("input"),s.type="text",s.setAttribute("value",h??o),this.data.doNotScroll&&(s.style.overflowX="hidden")),this.data.hasOwnCanvas&&(s.hidden=!0),Wn.add(s),s.setAttribute("data-element-id",e),s.disabled=this.data.readOnly,s.name=this.data.fieldName,s.tabIndex=ph,this._setRequired(s,this.data.required),l&&(s.maxLength=l),s.addEventListener("input",p=>{t.setValue(e,{value:p.target.value}),this.setPropertyOnSiblings(s,"value",p.target.value,"value"),c.formattedValue=null}),s.addEventListener("resetform",p=>{const m=this.data.defaultFieldValue??"";s.value=c.userValue=m,c.formattedValue=null});let u=p=>{const{formattedValue:m}=c;m!=null&&(p.target.value=m),p.target.scrollLeft=0};if(this.enableScripting&&this.hasJSActions){s.addEventListener("focus",m=>{var _;if(c.focused)return;const{target:A}=m;c.userValue&&(A.value=c.userValue),c.lastCommittedValue=A.value,c.commitKey=1,(_=this.data.actions)!=null&&_.Focus||(c.focused=!0)}),s.addEventListener("updatefromsandbox",m=>{this.showElementAndHideCanvas(m.target);const A={value(_){c.userValue=_.detail.value??"",t.setValue(e,{value:c.userValue.toString()}),_.target.value=c.userValue},formattedValue(_){const{formattedValue:w}=_.detail;c.formattedValue=w,w!=null&&_.target!==document.activeElement&&(_.target.value=w),t.setValue(e,{formattedValue:w})},selRange(_){_.target.setSelectionRange(..._.detail.selRange)},charLimit:_=>{var S;const{charLimit:w}=_.detail,{target:y}=_;if(w===0){y.removeAttribute("maxLength");return}y.setAttribute("maxLength",w);let v=c.userValue;!v||v.length<=w||(v=v.slice(0,w),y.value=c.userValue=v,t.setValue(e,{value:v}),(S=this.linkService.eventBus)==null||S.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:v,willCommit:!0,commitKey:1,selStart:y.selectionStart,selEnd:y.selectionEnd}}))}};this._dispatchEventFromSandbox(A,m)}),s.addEventListener("keydown",m=>{var w;c.commitKey=1;let A=-1;if(m.key==="Escape"?A=0:m.key==="Enter"&&!this.data.multiLine?A=2:m.key==="Tab"&&(c.commitKey=3),A===-1)return;const{value:_}=m.target;c.lastCommittedValue!==_&&(c.lastCommittedValue=_,c.userValue=_,(w=this.linkService.eventBus)==null||w.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:_,willCommit:!0,commitKey:A,selStart:m.target.selectionStart,selEnd:m.target.selectionEnd}}))});const p=u;u=null,s.addEventListener("blur",m=>{var _,w;if(!c.focused||!m.relatedTarget)return;(_=this.data.actions)!=null&&_.Blur||(c.focused=!1);const{value:A}=m.target;c.userValue=A,c.lastCommittedValue!==A&&((w=this.linkService.eventBus)==null||w.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:A,willCommit:!0,commitKey:c.commitKey,selStart:m.target.selectionStart,selEnd:m.target.selectionEnd}})),p(m)}),(r=this.data.actions)!=null&&r.Keystroke&&s.addEventListener("beforeinput",m=>{var x;c.lastCommittedValue=null;const{data:A,target:_}=m,{value:w,selectionStart:y,selectionEnd:v}=_;let S=y,E=v;switch(m.inputType){case"deleteWordBackward":{const C=w.substring(0,y).match(/\w*[^\w]*$/);C&&(S-=C[0].length);break}case"deleteWordForward":{const C=w.substring(y).match(/^[^\w]*\w*/);C&&(E+=C[0].length);break}case"deleteContentBackward":y===v&&(S-=1);break;case"deleteContentForward":y===v&&(E+=1);break}m.preventDefault(),(x=this.linkService.eventBus)==null||x.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:w,change:A||"",willCommit:!1,selStart:S,selEnd:E}})}),this._setEventListeners(s,c,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],m=>m.target.value)}if(u&&s.addEventListener("blur",u),this.data.comb){const m=(this.data.rect[2]-this.data.rect[0])/l;s.classList.add("comb"),s.style.letterSpacing=`calc(${m}px * var(--scale-factor) - 1ch)`}}else s=document.createElement("div"),s.textContent=this.data.fieldValue,s.style.verticalAlign="middle",s.style.display="table-cell",this.data.hasOwnCanvas&&(s.hidden=!0);return this._setTextStyle(s),this._setBackgroundColor(s),this._setDefaultPropertiesFromJS(s),this.container.append(s),this.container}}class xb extends Xn{constructor(t){super(t,{isRenderable:!!t.data.hasOwnCanvas})}}class Cb extends Xn{constructor(t){super(t,{isRenderable:t.renderForms})}render(){const t=this.annotationStorage,e=this.data,s=e.id;let i=t.getValue(s,{value:e.exportValue===e.fieldValue}).value;typeof i=="string"&&(i=i!=="Off",t.setValue(s,{value:i})),this.container.classList.add("buttonWidgetAnnotation","checkBox");const r=document.createElement("input");return Wn.add(r),r.setAttribute("data-element-id",s),r.disabled=e.readOnly,this._setRequired(r,this.data.required),r.type="checkbox",r.name=e.fieldName,i&&r.setAttribute("checked",!0),r.setAttribute("exportValue",e.exportValue),r.tabIndex=ph,r.addEventListener("change",a=>{const{name:o,checked:l}=a.target;for(const h of this._getElementsByName(o,s)){const c=l&&h.exportValue===e.exportValue;h.domElement&&(h.domElement.checked=c),t.setValue(h.id,{value:c})}t.setValue(s,{value:l})}),r.addEventListener("resetform",a=>{const o=e.defaultFieldValue||"Off";a.target.checked=o===e.exportValue}),this.enableScripting&&this.hasJSActions&&(r.addEventListener("updatefromsandbox",a=>{const o={value(l){l.target.checked=l.detail.value!=="Off",t.setValue(s,{value:l.target.checked})}};this._dispatchEventFromSandbox(o,a)}),this._setEventListeners(r,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(r),this._setDefaultPropertiesFromJS(r),this.container.append(r),this.container}}class Yp extends Xn{constructor(t){super(t,{isRenderable:t.renderForms})}render(){this.container.classList.add("buttonWidgetAnnotation","radioButton");const t=this.annotationStorage,e=this.data,s=e.id;let i=t.getValue(s,{value:e.fieldValue===e.buttonValue}).value;if(typeof i=="string"&&(i=i!==e.buttonValue,t.setValue(s,{value:i})),i)for(const a of this._getElementsByName(e.fieldName,s))t.setValue(a.id,{value:!1});const r=document.createElement("input");if(Wn.add(r),r.setAttribute("data-element-id",s),r.disabled=e.readOnly,this._setRequired(r,this.data.required),r.type="radio",r.name=e.fieldName,i&&r.setAttribute("checked",!0),r.tabIndex=ph,r.addEventListener("change",a=>{const{name:o,checked:l}=a.target;for(const h of this._getElementsByName(o,s))t.setValue(h.id,{value:!1});t.setValue(s,{value:l})}),r.addEventListener("resetform",a=>{const o=e.defaultFieldValue;a.target.checked=o!=null&&o===e.buttonValue}),this.enableScripting&&this.hasJSActions){const a=e.buttonValue;r.addEventListener("updatefromsandbox",o=>{const l={value:h=>{const c=a===h.detail.value;for(const u of this._getElementsByName(h.target.name)){const p=c&&u.id===s;u.domElement&&(u.domElement.checked=p),t.setValue(u.id,{value:p})}}};this._dispatchEventFromSandbox(l,o)}),this._setEventListeners(r,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(r),this._setDefaultPropertiesFromJS(r),this.container.append(r),this.container}}class Tb extends Wp{constructor(t){super(t,{ignoreBorder:t.data.hasAppearance})}render(){const t=super.render();t.classList.add("buttonWidgetAnnotation","pushButton");const e=t.lastChild;return this.enableScripting&&this.hasJSActions&&e&&(this._setDefaultPropertiesFromJS(e),e.addEventListener("updatefromsandbox",s=>{this._dispatchEventFromSandbox({},s)})),t}}class Rb extends Xn{constructor(t){super(t,{isRenderable:t.renderForms})}render(){this.container.classList.add("choiceWidgetAnnotation");const t=this.annotationStorage,e=this.data.id,s=t.getValue(e,{value:this.data.fieldValue}),i=document.createElement("select");Wn.add(i),i.setAttribute("data-element-id",e),i.disabled=this.data.readOnly,this._setRequired(i,this.data.required),i.name=this.data.fieldName,i.tabIndex=ph;let r=this.data.combo&&this.data.options.length>0;this.data.combo||(i.size=this.data.options.length,this.data.multiSelect&&(i.multiple=!0)),i.addEventListener("resetform",c=>{const u=this.data.defaultFieldValue;for(const p of i.options)p.selected=p.value===u});for(const c of this.data.options){const u=document.createElement("option");u.textContent=c.displayValue,u.value=c.exportValue,s.value.includes(c.exportValue)&&(u.setAttribute("selected",!0),r=!1),i.append(u)}let a=null;if(r){const c=document.createElement("option");c.value=" ",c.setAttribute("hidden",!0),c.setAttribute("selected",!0),i.prepend(c),a=()=>{c.remove(),i.removeEventListener("input",a),a=null},i.addEventListener("input",a)}const o=c=>{const u=c?"value":"textContent",{options:p,multiple:m}=i;return m?Array.prototype.filter.call(p,A=>A.selected).map(A=>A[u]):p.selectedIndex===-1?null:p[p.selectedIndex][u]};let l=o(!1);const h=c=>{const u=c.target.options;return Array.prototype.map.call(u,p=>({displayValue:p.textContent,exportValue:p.value}))};return this.enableScripting&&this.hasJSActions?(i.addEventListener("updatefromsandbox",c=>{const u={value(p){a==null||a();const m=p.detail.value,A=new Set(Array.isArray(m)?m:[m]);for(const _ of i.options)_.selected=A.has(_.value);t.setValue(e,{value:o(!0)}),l=o(!1)},multipleSelection(p){i.multiple=!0},remove(p){const m=i.options,A=p.detail.remove;m[A].selected=!1,i.remove(A),m.length>0&&Array.prototype.findIndex.call(m,w=>w.selected)===-1&&(m[0].selected=!0),t.setValue(e,{value:o(!0),items:h(p)}),l=o(!1)},clear(p){for(;i.length!==0;)i.remove(0);t.setValue(e,{value:null,items:[]}),l=o(!1)},insert(p){const{index:m,displayValue:A,exportValue:_}=p.detail.insert,w=i.children[m],y=document.createElement("option");y.textContent=A,y.value=_,w?w.before(y):i.append(y),t.setValue(e,{value:o(!0),items:h(p)}),l=o(!1)},items(p){const{items:m}=p.detail;for(;i.length!==0;)i.remove(0);for(const A of m){const{displayValue:_,exportValue:w}=A,y=document.createElement("option");y.textContent=_,y.value=w,i.append(y)}i.options.length>0&&(i.options[0].selected=!0),t.setValue(e,{value:o(!0),items:h(p)}),l=o(!1)},indices(p){const m=new Set(p.detail.indices);for(const A of p.target.options)A.selected=m.has(A.index);t.setValue(e,{value:o(!0)}),l=o(!1)},editable(p){p.target.disabled=!p.detail.editable}};this._dispatchEventFromSandbox(u,c)}),i.addEventListener("input",c=>{var m;const u=o(!0),p=o(!1);t.setValue(e,{value:u}),c.preventDefault(),(m=this.linkService.eventBus)==null||m.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:l,change:p,changeEx:u,willCommit:!1,commitKey:1,keyDown:!1}})}),this._setEventListeners(i,null,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"],["input","Action"],["input","Validate"]],c=>c.target.value)):i.addEventListener("input",function(c){t.setValue(e,{value:o(!0)})}),this.data.combo&&this._setTextStyle(i),this._setBackgroundColor(i),this._setDefaultPropertiesFromJS(i),this.container.append(i),this.container}}class Du extends dt{constructor(t){const{data:e,elements:s}=t;super(t,{isRenderable:dt._hasPopupData(e)}),this.elements=s,this.popup=null}render(){this.container.classList.add("popupAnnotation");const t=this.popup=new Pb({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}),e=[];for(const s of this.elements)s.popup=t,s.container.ariaHasPopup="dialog",e.push(s.data.id),s.addHighlightArea();return this.container.setAttribute("aria-controls",e.map(s=>`${uf}${s}`).join(",")),this.container}}var qr,Vc,jc,Xr,_n,ot,Ms,Yr,fl,pl,Kr,Ls,Ie,Is,gl,Ds,ml,yn,wn,Qr,Ih,bl,Fu,Wc,Kp,qc,Qp,Xc,Jp,Yc,Zp,Jr,Dh,Zr,Fh,Al,Ou;class Pb{constructor({container:t,color:e,elements:s,titleObj:i,modificationDate:r,contentsObj:a,richText:o,parent:l,rect:h,parentRect:c,open:u}){f(this,Qr);f(this,bl);f(this,Wc);f(this,qc);f(this,Xc);f(this,Yc);f(this,Jr);f(this,Zr);f(this,Al);f(this,qr,b(this,Xc,Jp).bind(this));f(this,Vc,b(this,Al,Ou).bind(this));f(this,jc,b(this,Zr,Fh).bind(this));f(this,Xr,b(this,Jr,Dh).bind(this));f(this,_n,null);f(this,ot,null);f(this,Ms,null);f(this,Yr,null);f(this,fl,null);f(this,pl,null);f(this,Kr,null);f(this,Ls,!1);f(this,Ie,null);f(this,Is,null);f(this,gl,null);f(this,Ds,null);f(this,ml,null);f(this,yn,null);f(this,wn,!1);var p;g(this,ot,t),g(this,ml,i),g(this,Ms,a),g(this,Ds,o),g(this,pl,l),g(this,_n,e),g(this,gl,h),g(this,Kr,c),g(this,fl,s),g(this,Yr,gf.toDateObject(r)),this.trigger=s.flatMap(m=>m.getElementsToTriggerPopup());for(const m of this.trigger)m.addEventListener("click",n(this,Xr)),m.addEventListener("mouseenter",n(this,jc)),m.addEventListener("mouseleave",n(this,Vc)),m.classList.add("popupTriggerArea");for(const m of s)(p=m.container)==null||p.addEventListener("keydown",n(this,qr));n(this,ot).hidden=!0,u&&b(this,Jr,Dh).call(this)}render(){if(n(this,Ie))return;const t=g(this,Ie,document.createElement("div"));if(t.className="popup",n(this,_n)){const r=t.style.outlineColor=M.makeHexColor(...n(this,_n));CSS.supports("background-color","color-mix(in srgb, red 30%, white)")?t.style.backgroundColor=`color-mix(in srgb, ${r} 30%, white)`:t.style.backgroundColor=M.makeHexColor(...n(this,_n).map(o=>Math.floor(.7*(255-o)+o)))}const e=document.createElement("span");e.className="header";const s=document.createElement("h1");if(e.append(s),{dir:s.dir,str:s.textContent}=n(this,ml),t.append(e),n(this,Yr)){const r=document.createElement("span");r.classList.add("popupDate"),r.setAttribute("data-l10n-id","pdfjs-annotation-date-time-string"),r.setAttribute("data-l10n-args",JSON.stringify({dateObj:n(this,Yr).valueOf()})),e.append(r)}const i=n(this,Qr,Ih);if(i)jp.render({xfaHtml:i,intent:"richText",div:t}),t.lastChild.classList.add("richText","popupContent");else{const r=this._formatContents(n(this,Ms));t.append(r)}n(this,ot).append(t)}_formatContents({str:t,dir:e}){const s=document.createElement("p");s.classList.add("popupContent"),s.dir=e;const i=t.split(/(?:\r\n?|\n)/);for(let r=0,a=i.length;r<a;++r){const o=i[r];s.append(document.createTextNode(o)),r<a-1&&s.append(document.createElement("br"))}return s}updateEdited({rect:t,popupContent:e}){var s;n(this,yn)||g(this,yn,{contentsObj:n(this,Ms),richText:n(this,Ds)}),t&&g(this,Is,null),e&&(g(this,Ds,b(this,qc,Qp).call(this,e)),g(this,Ms,null)),(s=n(this,Ie))==null||s.remove(),g(this,Ie,null)}resetEdited(){var t;n(this,yn)&&({contentsObj:$t(this,Ms)._,richText:$t(this,Ds)._}=n(this,yn),g(this,yn,null),(t=n(this,Ie))==null||t.remove(),g(this,Ie,null),g(this,Is,null))}forceHide(){g(this,wn,this.isVisible),n(this,wn)&&(n(this,ot).hidden=!0)}maybeShow(){n(this,wn)&&(n(this,Ie)||b(this,Zr,Fh).call(this),g(this,wn,!1),n(this,ot).hidden=!1)}get isVisible(){return n(this,ot).hidden===!1}}qr=new WeakMap,Vc=new WeakMap,jc=new WeakMap,Xr=new WeakMap,_n=new WeakMap,ot=new WeakMap,Ms=new WeakMap,Yr=new WeakMap,fl=new WeakMap,pl=new WeakMap,Kr=new WeakMap,Ls=new WeakMap,Ie=new WeakMap,Is=new WeakMap,gl=new WeakMap,Ds=new WeakMap,ml=new WeakMap,yn=new WeakMap,wn=new WeakMap,Qr=new WeakSet,Ih=function(){const t=n(this,Ds),e=n(this,Ms);return t!=null&&t.str&&(!(e!=null&&e.str)||e.str===t.str)&&n(this,Ds).html||null},bl=new WeakSet,Fu=function(){var t,e,s;return((s=(e=(t=n(this,Qr,Ih))==null?void 0:t.attributes)==null?void 0:e.style)==null?void 0:s.fontSize)||0},Wc=new WeakSet,Kp=function(){var t,e,s;return((s=(e=(t=n(this,Qr,Ih))==null?void 0:t.attributes)==null?void 0:e.style)==null?void 0:s.color)||null},qc=new WeakSet,Qp=function(t){const e=[],s={str:t,html:{name:"div",attributes:{dir:"auto"},children:[{name:"p",children:e}]}},i={style:{color:n(this,Wc,Kp),fontSize:n(this,bl,Fu)?`calc(${n(this,bl,Fu)}px * var(--scale-factor))`:""}};for(const r of t.split(`
4
4
  `))e.push({name:"span",value:r,attributes:i});return s},Xc=new WeakSet,Jp=function(t){t.altKey||t.shiftKey||t.ctrlKey||t.metaKey||(t.key==="Enter"||t.key==="Escape"&&n(this,Ls))&&b(this,Jr,Dh).call(this)},Yc=new WeakSet,Zp=function(){if(n(this,Is)!==null)return;const{page:{view:t},viewport:{rawDims:{pageWidth:e,pageHeight:s,pageX:i,pageY:r}}}=n(this,pl);let a=!!n(this,Kr),o=a?n(this,Kr):n(this,gl);for(const A of n(this,fl))if(!o||M.intersect(A.data.rect,o)!==null){o=A.data.rect,a=!0;break}const l=M.normalizeRect([o[0],t[3]-o[1]+t[1],o[2],t[3]-o[3]+t[1]]),c=a?o[2]-o[0]+5:0,u=l[0]+c,p=l[1];g(this,Is,[100*(u-i)/e,100*(p-r)/s]);const{style:m}=n(this,ot);m.left=`${n(this,Is)[0]}%`,m.top=`${n(this,Is)[1]}%`},Jr=new WeakSet,Dh=function(){g(this,Ls,!n(this,Ls)),n(this,Ls)?(b(this,Zr,Fh).call(this),n(this,ot).addEventListener("click",n(this,Xr)),n(this,ot).addEventListener("keydown",n(this,qr))):(b(this,Al,Ou).call(this),n(this,ot).removeEventListener("click",n(this,Xr)),n(this,ot).removeEventListener("keydown",n(this,qr)))},Zr=new WeakSet,Fh=function(){n(this,Ie)||this.render(),this.isVisible?n(this,Ls)&&n(this,ot).classList.add("focused"):(b(this,Yc,Zp).call(this),n(this,ot).hidden=!1,n(this,ot).style.zIndex=parseInt(n(this,ot).style.zIndex)+1e3)},Al=new WeakSet,Ou=function(){n(this,ot).classList.remove("focused"),!(n(this,Ls)||!this.isVisible)&&(n(this,ot).hidden=!0,n(this,ot).style.zIndex=parseInt(n(this,ot).style.zIndex)-1e3)};class tg extends dt{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),this.textContent=t.data.textContent,this.textPosition=t.data.textPosition,this.annotationEditorType=H.FREETEXT}render(){if(this.container.classList.add("freeTextAnnotation"),this.textContent){const t=document.createElement("div");t.classList.add("annotationTextContent"),t.setAttribute("role","comment");for(const e of this.textContent){const s=document.createElement("span");s.textContent=e,t.append(s)}this.container.append(t)}return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this._editOnDoubleClick(),this.container}}var _l;class kb extends dt{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0});f(this,_l,null)}render(){this.container.classList.add("lineAnnotation");const e=this.data,{width:s,height:i}=js(e.rect),r=this.svgFactory.create(s,i,!0),a=g(this,_l,this.svgFactory.createElement("svg:line"));return a.setAttribute("x1",e.rect[2]-e.lineCoordinates[0]),a.setAttribute("y1",e.rect[3]-e.lineCoordinates[1]),a.setAttribute("x2",e.rect[2]-e.lineCoordinates[2]),a.setAttribute("y2",e.rect[3]-e.lineCoordinates[3]),a.setAttribute("stroke-width",e.borderStyle.width||1),a.setAttribute("stroke","transparent"),a.setAttribute("fill","transparent"),r.append(a),this.container.append(r),!e.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return n(this,_l)}addHighlightArea(){this.container.classList.add("highlightArea")}}_l=new WeakMap;var yl;class Mb extends dt{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0});f(this,yl,null)}render(){this.container.classList.add("squareAnnotation");const e=this.data,{width:s,height:i}=js(e.rect),r=this.svgFactory.create(s,i,!0),a=e.borderStyle.width,o=g(this,yl,this.svgFactory.createElement("svg:rect"));return o.setAttribute("x",a/2),o.setAttribute("y",a/2),o.setAttribute("width",s-a),o.setAttribute("height",i-a),o.setAttribute("stroke-width",a||1),o.setAttribute("stroke","transparent"),o.setAttribute("fill","transparent"),r.append(o),this.container.append(r),!e.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return n(this,yl)}addHighlightArea(){this.container.classList.add("highlightArea")}}yl=new WeakMap;var wl;class Lb extends dt{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0});f(this,wl,null)}render(){this.container.classList.add("circleAnnotation");const e=this.data,{width:s,height:i}=js(e.rect),r=this.svgFactory.create(s,i,!0),a=e.borderStyle.width,o=g(this,wl,this.svgFactory.createElement("svg:ellipse"));return o.setAttribute("cx",s/2),o.setAttribute("cy",i/2),o.setAttribute("rx",s/2-a/2),o.setAttribute("ry",i/2-a/2),o.setAttribute("stroke-width",a||1),o.setAttribute("stroke","transparent"),o.setAttribute("fill","transparent"),r.append(o),this.container.append(r),!e.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return n(this,wl)}addHighlightArea(){this.container.classList.add("highlightArea")}}wl=new WeakMap;var vl;class eg extends dt{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0});f(this,vl,null);this.containerClassName="polylineAnnotation",this.svgElementName="svg:polyline"}render(){this.container.classList.add(this.containerClassName);const{data:{rect:e,vertices:s,borderStyle:i,popupRef:r}}=this;if(!s)return this.container;const{width:a,height:o}=js(e),l=this.svgFactory.create(a,o,!0);let h=[];for(let u=0,p=s.length;u<p;u+=2){const m=s[u]-e[0],A=e[3]-s[u+1];h.push(`${m},${A}`)}h=h.join(" ");const c=g(this,vl,this.svgFactory.createElement(this.svgElementName));return c.setAttribute("points",h),c.setAttribute("stroke-width",i.width||1),c.setAttribute("stroke","transparent"),c.setAttribute("fill","transparent"),l.append(c),this.container.append(l),!r&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return n(this,vl)}addHighlightArea(){this.container.classList.add("highlightArea")}}vl=new WeakMap;class Ib extends eg{constructor(t){super(t),this.containerClassName="polygonAnnotation",this.svgElementName="svg:polygon"}}class Db extends dt{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0})}render(){return this.container.classList.add("caretAnnotation"),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container}}var El;class yf extends dt{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0});f(this,El,[]);this.containerClassName="inkAnnotation",this.svgElementName="svg:polyline",this.annotationEditorType=this.data.it==="InkHighlight"?H.HIGHLIGHT:H.INK}render(){this.container.classList.add(this.containerClassName);const{data:{rect:e,inkLists:s,borderStyle:i,popupRef:r}}=this,{width:a,height:o}=js(e),l=this.svgFactory.create(a,o,!0);for(const h of s){let c=[];for(let p=0,m=h.length;p<m;p+=2){const A=h[p]-e[0],_=e[3]-h[p+1];c.push(`${A},${_}`)}c=c.join(" ");const u=this.svgFactory.createElement(this.svgElementName);n(this,El).push(u),u.setAttribute("points",c),u.setAttribute("stroke-width",i.width||1),u.setAttribute("stroke","transparent"),u.setAttribute("fill","transparent"),l.append(u)}return!r&&this.hasPopupData&&this._createPopup(),this.container.append(l),this._editOnDoubleClick(),this.container}getElementsToTriggerPopup(){return n(this,El)}addHighlightArea(){this.container.classList.add("highlightArea")}}El=new WeakMap;class sg extends dt{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0}),this.annotationEditorType=H.HIGHLIGHT}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("highlightAnnotation"),this._editOnDoubleClick(),this.container}}class Fb extends dt{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("underlineAnnotation"),this.container}}class Ob extends dt{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("squigglyAnnotation"),this.container}}class Nb extends dt{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("strikeoutAnnotation"),this.container}}class ig extends dt{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),this.annotationEditorType=H.STAMP}render(){return this.container.classList.add("stampAnnotation"),this.container.setAttribute("role","img"),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this._editOnDoubleClick(),this.container}}var Sl,xl,Nu;class Hb extends dt{constructor(e){var i;super(e,{isRenderable:!0});f(this,xl);f(this,Sl,null);const{file:s}=this.data;this.filename=s.filename,this.content=s.content,(i=this.linkService.eventBus)==null||i.dispatch("fileattachmentannotation",{source:this,...s})}render(){this.container.classList.add("fileAttachmentAnnotation");const{container:e,data:s}=this;let i;s.hasAppearance||s.fillAlpha===0?i=document.createElement("div"):(i=document.createElement("img"),i.src=`${this.imageResourcesPath}annotation-${/paperclip/i.test(s.name)?"paperclip":"pushpin"}.svg`,s.fillAlpha&&s.fillAlpha<1&&(i.style=`filter: opacity(${Math.round(s.fillAlpha*100)}%);`)),i.addEventListener("dblclick",b(this,xl,Nu).bind(this)),g(this,Sl,i);const{isMac:r}=Wt.platform;return e.addEventListener("keydown",a=>{a.key==="Enter"&&(r?a.metaKey:a.ctrlKey)&&b(this,xl,Nu).call(this)}),!s.popupRef&&this.hasPopupData?this._createPopup():i.classList.add("popupTriggerArea"),e.append(i),e}getElementsToTriggerPopup(){return n(this,Sl)}addHighlightArea(){this.container.classList.add("highlightArea")}}Sl=new WeakMap,xl=new WeakSet,Nu=function(){var e;(e=this.downloadManager)==null||e.openOrDownloadData(this.content,this.filename)};var Cl,vn,En,Tl,Kc,ng,Rl,Hu;class Bb{constructor({div:t,accessibilityManager:e,annotationCanvasMap:s,annotationEditorUIManager:i,page:r,viewport:a,structTreeLayer:o}){f(this,Kc);f(this,Rl);f(this,Cl,null);f(this,vn,null);f(this,En,new Map);f(this,Tl,null);this.div=t,g(this,Cl,e),g(this,vn,s),g(this,Tl,o||null),this.page=r,this.viewport=a,this.zIndex=0,this._annotationEditorUIManager=i}hasEditableAnnotations(){return n(this,En).size>0}async render(t){var a;const{annotations:e}=t,s=this.div;Vn(s,this.viewport);const i=new Map,r={data:null,layer:s,linkService:t.linkService,downloadManager:t.downloadManager,imageResourcesPath:t.imageResourcesPath||"",renderForms:t.renderForms!==!1,svgFactory:new _f,annotationStorage:t.annotationStorage||new bf,enableScripting:t.enableScripting===!0,hasJSActions:t.hasJSActions,fieldObjects:t.fieldObjects,parent:this,elements:null};for(const o of e){if(o.noHTML)continue;const l=o.annotationType===gt.POPUP;if(l){const u=i.get(o.id);if(!u)continue;r.elements=u}else{const{width:u,height:p}=js(o.rect);if(u<=0||p<=0)continue}r.data=o;const h=vb.create(r);if(!h.isRenderable)continue;if(!l&&o.popupRef){const u=i.get(o.popupRef);u?u.push(h):i.set(o.popupRef,[h])}const c=h.render();o.hidden&&(c.style.visibility="hidden"),await b(this,Kc,ng).call(this,c,o.id),h._isEditable&&(n(this,En).set(h.data.id,h),(a=this._annotationEditorUIManager)==null||a.renderAnnotationElement(h))}b(this,Rl,Hu).call(this)}update({viewport:t}){const e=this.div;this.viewport=t,Vn(e,{rotation:t.rotation}),b(this,Rl,Hu).call(this),e.hidden=!1}getEditableAnnotations(){return Array.from(n(this,En).values())}getEditableAnnotation(t){return n(this,En).get(t)}}Cl=new WeakMap,vn=new WeakMap,En=new WeakMap,Tl=new WeakMap,Kc=new WeakSet,ng=async function(t,e){var a,o;const s=t.firstChild||t,i=s.id=`${uf}${e}`,r=await((a=n(this,Tl))==null?void 0:a.getAriaAttributes(i));if(r)for(const[l,h]of r)s.setAttribute(l,h);this.div.append(t),(o=n(this,Cl))==null||o.moveElementInDOM(this.div,t,s,!1)},Rl=new WeakSet,Hu=function(){if(!n(this,vn))return;const t=this.div;for(const[e,s]of n(this,vn)){const i=t.querySelector(`[data-annotation-id="${e}"]`);if(!i)continue;s.className="annotationContent";const{firstChild:r}=i;r?r.nodeName==="CANVAS"?r.replaceWith(s):r.classList.contains("annotationContent")?r.after(s):r.before(s):i.append(s)}n(this,vn).clear()};const _h=/\r\n?|\n/g;var De,ne,Pl,Sn,re,Qc,rg,Jc,ag,Zc,og,ta,Oh,ea,Nh,sa,Hh,td,lg,kl,$u,ed,hg;const J=class J extends rt{constructor(e){super({...e,name:"freeTextEditor"});f(this,Qc);f(this,Jc);f(this,Zc);f(this,ta);f(this,sa);f(this,td);f(this,ed);f(this,De,void 0);f(this,ne,"");f(this,Pl,`${this.id}-editor`);f(this,Sn,null);f(this,re,void 0);g(this,De,e.color||J._defaultColor||rt._defaultLineColor),g(this,re,e.fontSize||J._defaultFontSize)}static get _keyboardManager(){const e=J.prototype,s=a=>a.isEmpty(),i=jn.TRANSLATE_SMALL,r=jn.TRANSLATE_BIG;return G(this,"_keyboardManager",new fh([[["ctrl+s","mac+meta+s","ctrl+p","mac+meta+p"],e.commitOrRemove,{bubbles:!0}],[["ctrl+Enter","mac+meta+Enter","Escape","mac+Escape"],e.commitOrRemove],[["ArrowLeft","mac+ArrowLeft"],e._translateEmpty,{args:[-i,0],checker:s}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],e._translateEmpty,{args:[-r,0],checker:s}],[["ArrowRight","mac+ArrowRight"],e._translateEmpty,{args:[i,0],checker:s}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],e._translateEmpty,{args:[r,0],checker:s}],[["ArrowUp","mac+ArrowUp"],e._translateEmpty,{args:[0,-i],checker:s}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],e._translateEmpty,{args:[0,-r],checker:s}],[["ArrowDown","mac+ArrowDown"],e._translateEmpty,{args:[0,i],checker:s}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],e._translateEmpty,{args:[0,r],checker:s}]]))}static initialize(e,s){rt.initialize(e,s);const i=getComputedStyle(document.documentElement);this._internalPadding=parseFloat(i.getPropertyValue("--freetext-padding"))}static updateDefaultParams(e,s){switch(e){case z.FREETEXT_SIZE:J._defaultFontSize=s;break;case z.FREETEXT_COLOR:J._defaultColor=s;break}}updateParams(e,s){switch(e){case z.FREETEXT_SIZE:b(this,Qc,rg).call(this,s);break;case z.FREETEXT_COLOR:b(this,Jc,ag).call(this,s);break}}static get defaultPropertiesToUpdate(){return[[z.FREETEXT_SIZE,J._defaultFontSize],[z.FREETEXT_COLOR,J._defaultColor||rt._defaultLineColor]]}get propertiesToUpdate(){return[[z.FREETEXT_SIZE,n(this,re)],[z.FREETEXT_COLOR,n(this,De)]]}_translateEmpty(e,s){this._uiManager.translateSelectedEditors(e,s,!0)}getInitialTranslation(){const e=this.parentScale;return[-J._internalPadding*e,-(J._internalPadding+n(this,re))*e]}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(this.isAttachedToDOM||this.parent.add(this)))}enableEditMode(){if(this.isInEditMode())return;this.parent.setEditingState(!1),this.parent.updateToolbar(H.FREETEXT),super.enableEditMode(),this.overlayDiv.classList.remove("enabled"),this.editorDiv.contentEditable=!0,this._isDraggable=!1,this.div.removeAttribute("aria-activedescendant"),g(this,Sn,new AbortController);const e=this._uiManager.combinedSignal(n(this,Sn));this.editorDiv.addEventListener("keydown",this.editorDivKeydown.bind(this),{signal:e}),this.editorDiv.addEventListener("focus",this.editorDivFocus.bind(this),{signal:e}),this.editorDiv.addEventListener("blur",this.editorDivBlur.bind(this),{signal:e}),this.editorDiv.addEventListener("input",this.editorDivInput.bind(this),{signal:e}),this.editorDiv.addEventListener("paste",this.editorDivPaste.bind(this),{signal:e})}disableEditMode(){var e;this.isInEditMode()&&(this.parent.setEditingState(!0),super.disableEditMode(),this.overlayDiv.classList.add("enabled"),this.editorDiv.contentEditable=!1,this.div.setAttribute("aria-activedescendant",n(this,Pl)),this._isDraggable=!0,(e=n(this,Sn))==null||e.abort(),g(this,Sn,null),this.div.focus({preventScroll:!0}),this.isEditing=!1,this.parent.div.classList.add("freetextEditing"))}focusin(e){this._focusEventsAllowed&&(super.focusin(e),e.target!==this.editorDiv&&this.editorDiv.focus())}onceAdded(){var e;this.width||(this.enableEditMode(),this.editorDiv.focus(),(e=this._initialOptions)!=null&&e.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()}commit(){if(!this.isInEditMode())return;super.commit(),this.disableEditMode();const e=n(this,ne),s=g(this,ne,b(this,Zc,og).call(this).trimEnd());if(e===s)return;const i=r=>{if(g(this,ne,r),!r){this.remove();return}b(this,sa,Hh).call(this),this._uiManager.rebuild(this),b(this,ta,Oh).call(this)};this.addCommands({cmd:()=>{i(s)},undo:()=>{i(e)},mustExec:!1}),b(this,ta,Oh).call(this)}shouldGetKeyboardEvents(){return this.isInEditMode()}enterInEditMode(){this.enableEditMode(),this.editorDiv.focus()}dblclick(e){this.enterInEditMode()}keydown(e){e.target===this.div&&e.key==="Enter"&&(this.enterInEditMode(),e.preventDefault())}editorDivKeydown(e){J._keyboardManager.exec(this,e)}editorDivFocus(e){this.isEditing=!0}editorDivBlur(e){this.isEditing=!1}editorDivInput(e){this.parent.div.classList.toggle("freetextEditing",this.isEmpty())}disableEditing(){this.editorDiv.setAttribute("role","comment"),this.editorDiv.removeAttribute("aria-multiline")}enableEditing(){this.editorDiv.setAttribute("role","textbox"),this.editorDiv.setAttribute("aria-multiline",!0)}render(){if(this.div)return this.div;let e,s;this.width&&(e=this.x,s=this.y),super.render(),this.editorDiv=document.createElement("div"),this.editorDiv.className="internal",this.editorDiv.setAttribute("id",n(this,Pl)),this.editorDiv.setAttribute("data-l10n-id","pdfjs-free-text2"),this.editorDiv.setAttribute("data-l10n-attrs","default-content"),this.enableEditing(),this.editorDiv.contentEditable=!0;const{style:i}=this.editorDiv;if(i.fontSize=`calc(${n(this,re)}px * var(--scale-factor))`,i.color=n(this,De),this.div.append(this.editorDiv),this.overlayDiv=document.createElement("div"),this.overlayDiv.classList.add("overlay","enabled"),this.div.append(this.overlayDiv),Xh(this,this.div,["dblclick","keydown"]),this.width){const[r,a]=this.parentDimensions;if(this.annotationElementId){const{position:o}=this._initialData;let[l,h]=this.getInitialTranslation();[l,h]=this.pageTranslationToScreen(l,h);const[c,u]=this.pageDimensions,[p,m]=this.pageTranslation;let A,_;switch(this.rotation){case 0:A=e+(o[0]-p)/c,_=s+this.height-(o[1]-m)/u;break;case 90:A=e+(o[0]-p)/c,_=s-(o[1]-m)/u,[l,h]=[h,-l];break;case 180:A=e-this.width+(o[0]-p)/c,_=s-(o[1]-m)/u,[l,h]=[-l,-h];break;case 270:A=e+(o[0]-p-this.height*u)/c,_=s+(o[1]-m-this.width*c)/u,[l,h]=[-h,l];break}this.setAt(A*r,_*a,l,h)}else this.setAt(e*r,s*a,this.width*r,this.height*a);b(this,sa,Hh).call(this),this._isDraggable=!0,this.editorDiv.contentEditable=!1}else this._isDraggable=!1,this.editorDiv.contentEditable=!0;return this.div}editorDivPaste(e){var A,_,w;const s=e.clipboardData||window.clipboardData,{types:i}=s;if(i.length===1&&i[0]==="text/plain")return;e.preventDefault();const r=b(A=J,kl,$u).call(A,s.getData("text")||"").replaceAll(_h,`