aitu-app 0.5.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.DS_Store +0 -0
- package/README.md +47 -0
- package/_headers +84 -0
- package/_redirects +2 -0
- package/assets/ChatMessagesArea-CkUX81uB.js +251 -0
- package/assets/ChatMessagesArea-Di0Z80Zh.css +1 -0
- package/assets/KaTeX_AMS-Regular-BQhdFMY1.woff2 +0 -0
- package/assets/KaTeX_AMS-Regular-DMm9YOAa.woff +0 -0
- package/assets/KaTeX_AMS-Regular-DRggAlZN.ttf +0 -0
- package/assets/KaTeX_Caligraphic-Bold-ATXxdsX0.ttf +0 -0
- package/assets/KaTeX_Caligraphic-Bold-BEiXGLvX.woff +0 -0
- package/assets/KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2 +0 -0
- package/assets/KaTeX_Caligraphic-Regular-CTRA-rTL.woff +0 -0
- package/assets/KaTeX_Caligraphic-Regular-Di6jR-x-.woff2 +0 -0
- package/assets/KaTeX_Caligraphic-Regular-wX97UBjC.ttf +0 -0
- package/assets/KaTeX_Fraktur-Bold-BdnERNNW.ttf +0 -0
- package/assets/KaTeX_Fraktur-Bold-BsDP51OF.woff +0 -0
- package/assets/KaTeX_Fraktur-Bold-CL6g_b3V.woff2 +0 -0
- package/assets/KaTeX_Fraktur-Regular-CB_wures.ttf +0 -0
- package/assets/KaTeX_Fraktur-Regular-CTYiF6lA.woff2 +0 -0
- package/assets/KaTeX_Fraktur-Regular-Dxdc4cR9.woff +0 -0
- package/assets/KaTeX_Main-Bold-Cx986IdX.woff2 +0 -0
- package/assets/KaTeX_Main-Bold-Jm3AIy58.woff +0 -0
- package/assets/KaTeX_Main-Bold-waoOVXN0.ttf +0 -0
- package/assets/KaTeX_Main-BoldItalic-DxDJ3AOS.woff2 +0 -0
- package/assets/KaTeX_Main-BoldItalic-DzxPMmG6.ttf +0 -0
- package/assets/KaTeX_Main-BoldItalic-SpSLRI95.woff +0 -0
- package/assets/KaTeX_Main-Italic-3WenGoN9.ttf +0 -0
- package/assets/KaTeX_Main-Italic-BMLOBm91.woff +0 -0
- package/assets/KaTeX_Main-Italic-NWA7e6Wa.woff2 +0 -0
- package/assets/KaTeX_Main-Regular-B22Nviop.woff2 +0 -0
- package/assets/KaTeX_Main-Regular-Dr94JaBh.woff +0 -0
- package/assets/KaTeX_Main-Regular-ypZvNtVU.ttf +0 -0
- package/assets/KaTeX_Math-BoldItalic-B3XSjfu4.ttf +0 -0
- package/assets/KaTeX_Math-BoldItalic-CZnvNsCZ.woff2 +0 -0
- package/assets/KaTeX_Math-BoldItalic-iY-2wyZ7.woff +0 -0
- package/assets/KaTeX_Math-Italic-DA0__PXp.woff +0 -0
- package/assets/KaTeX_Math-Italic-flOr_0UB.ttf +0 -0
- package/assets/KaTeX_Math-Italic-t53AETM-.woff2 +0 -0
- package/assets/KaTeX_SansSerif-Bold-CFMepnvq.ttf +0 -0
- package/assets/KaTeX_SansSerif-Bold-D1sUS0GD.woff2 +0 -0
- package/assets/KaTeX_SansSerif-Bold-DbIhKOiC.woff +0 -0
- package/assets/KaTeX_SansSerif-Italic-C3H0VqGB.woff2 +0 -0
- package/assets/KaTeX_SansSerif-Italic-DN2j7dab.woff +0 -0
- package/assets/KaTeX_SansSerif-Italic-YYjJ1zSn.ttf +0 -0
- package/assets/KaTeX_SansSerif-Regular-BNo7hRIc.ttf +0 -0
- package/assets/KaTeX_SansSerif-Regular-CS6fqUqJ.woff +0 -0
- package/assets/KaTeX_SansSerif-Regular-DDBCnlJ7.woff2 +0 -0
- package/assets/KaTeX_Script-Regular-C5JkGWo-.ttf +0 -0
- package/assets/KaTeX_Script-Regular-D3wIWfF6.woff2 +0 -0
- package/assets/KaTeX_Script-Regular-D5yQViql.woff +0 -0
- package/assets/KaTeX_Size1-Regular-C195tn64.woff +0 -0
- package/assets/KaTeX_Size1-Regular-Dbsnue_I.ttf +0 -0
- package/assets/KaTeX_Size1-Regular-mCD8mA8B.woff2 +0 -0
- package/assets/KaTeX_Size2-Regular-B7gKUWhC.ttf +0 -0
- package/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2 +0 -0
- package/assets/KaTeX_Size2-Regular-oD1tc_U0.woff +0 -0
- package/assets/KaTeX_Size3-Regular-CTq5MqoE.woff +0 -0
- package/assets/KaTeX_Size3-Regular-DgpXs0kz.ttf +0 -0
- package/assets/KaTeX_Size4-Regular-BF-4gkZK.woff +0 -0
- package/assets/KaTeX_Size4-Regular-DWFBv043.ttf +0 -0
- package/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2 +0 -0
- package/assets/KaTeX_Typewriter-Regular-C0xS9mPB.woff +0 -0
- package/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2 +0 -0
- package/assets/KaTeX_Typewriter-Regular-D3Ib7_Hf.ttf +0 -0
- package/assets/Tableau10-B-NsZVaP.js +1 -0
- package/assets/Tableau10-Dnlau_Wv.js +1 -0
- package/assets/ToolboxDrawer-By1XMh8B.js +87 -0
- package/assets/ToolboxDrawer-fPqvDLQE.css +1 -0
- package/assets/__vite-browser-external-BIHI7g3E.js +1 -0
- package/assets/ai-analyze-Db-iXol6.js +1 -0
- package/assets/arc-BZXVqUcI.js +1 -0
- package/assets/arc-ajYHRRnk.js +1 -0
- package/assets/array-B5oSNiGi.js +1 -0
- package/assets/array-BKyUJesY.js +1 -0
- package/assets/batch-image-generation-Baqb01Lm.js +6 -0
- package/assets/batch-image-generation-CbLMWmjk.css +1 -0
- package/assets/blockDiagram-38ab4fdb-BT3H_WVv.js +118 -0
- package/assets/blockDiagram-38ab4fdb-u0xYP3Lt.js +118 -0
- package/assets/c4Diagram-3d4e48cf-CBvM6zjM.js +10 -0
- package/assets/c4Diagram-3d4e48cf-WOIEVidH.js +10 -0
- package/assets/channel-BP25wTsw.js +1 -0
- package/assets/channel-HzrLNFUg.js +1 -0
- package/assets/classDiagram-70f12bd4-BMutcvFi.js +2 -0
- package/assets/classDiagram-70f12bd4-Cl9U1r5F.js +2 -0
- package/assets/classDiagram-v2-f2320105-C0agtbR4.js +2 -0
- package/assets/classDiagram-v2-f2320105-tCBzATK6.js +2 -0
- package/assets/clone-B69pF7Y_.js +1 -0
- package/assets/clone-oX7o-l4R.js +1 -0
- package/assets/createText-2e5e7dd3-CZ9_fscE.js +5 -0
- package/assets/createText-2e5e7dd3-idrqgJjU.js +7 -0
- package/assets/edges-e0da2a9e-C-RyePMV.js +4 -0
- package/assets/edges-e0da2a9e-DJXAjJSL.js +4 -0
- package/assets/erDiagram-9861fffd-DWJR_3zL.js +51 -0
- package/assets/erDiagram-9861fffd-x2Kcy95-.js +51 -0
- package/assets/flowDb-956e92f1-BgKjOIdz.js +10 -0
- package/assets/flowDb-956e92f1-CF6y18Tn.js +10 -0
- package/assets/flowDiagram-66a62f08-BPPw0wPU.js +4 -0
- package/assets/flowDiagram-66a62f08-CSAllSFf.js +4 -0
- package/assets/flowDiagram-v2-96b9c2cf-B-UGyXRi.js +1 -0
- package/assets/flowDiagram-v2-96b9c2cf-Cm596kxZ.js +1 -0
- package/assets/flowchart-elk-definition-4a651766-9XSRJbsr.js +139 -0
- package/assets/flowchart-elk-definition-4a651766-DWFN9DN3.js +139 -0
- package/assets/ganttDiagram-c361ad54-D9tbz9tQ.js +257 -0
- package/assets/ganttDiagram-c361ad54-ot5pUYpT.js +257 -0
- package/assets/gitGraphDiagram-72cf32ee-BFV3Mt8C.js +70 -0
- package/assets/gitGraphDiagram-72cf32ee-C6qFzgGh.js +70 -0
- package/assets/graph-BxwlF7JS.js +1 -0
- package/assets/graph-D-2Ldvxg.js +1 -0
- package/assets/grid-image-cM9AmYC8.js +1 -0
- package/assets/has-CgdIPiQG.js +1 -0
- package/assets/hasIn-4iY02rGN.js +1 -0
- package/assets/index-3862675e-CVZnpwDN.js +1 -0
- package/assets/index-3862675e-DqdI9cab.js +1 -0
- package/assets/index-B2dvADz8.css +1 -0
- package/assets/index-BicRPzXC.js +1 -0
- package/assets/index-Bs7-jmv6.css +1 -0
- package/assets/index-BwSGXyRr.js +99 -0
- package/assets/index-C1XdOOAn.css +1 -0
- package/assets/index-C4AKKbpQ.css +1 -0
- package/assets/index-CkpXFt8n.js +1 -0
- package/assets/index-CrxF9gFe.js +42 -0
- package/assets/index-DBWqXBIQ.js +93 -0
- package/assets/index-DI_5V2-m.js +3 -0
- package/assets/index-DWUAFoZG.js +2064 -0
- package/assets/index-Dn0YtZ2R.js +3 -0
- package/assets/index-e05Rs4M6.js +12 -0
- package/assets/index.dom-C3-224fz.js +1 -0
- package/assets/infoDiagram-f8f76790-CnrpwoOt.js +7 -0
- package/assets/infoDiagram-f8f76790-FKC1Sy9Y.js +7 -0
- package/assets/init-A0kIFD9x.js +1 -0
- package/assets/init-Gi6I4Gst.js +1 -0
- package/assets/inspiration-board-B_-BBBHt.js +1 -0
- package/assets/isEmpty-Dj2GV0v-.js +1 -0
- package/assets/journeyDiagram-49397b02-B7fP21sU.js +139 -0
- package/assets/journeyDiagram-49397b02-Dp3X9XWq.js +139 -0
- package/assets/katex-BbEIqZs1.js +261 -0
- package/assets/katex-Cu_Erd72.js +261 -0
- package/assets/layout-BD3yCK_X.js +1 -0
- package/assets/layout-DHHYqX7p.js +1 -0
- package/assets/line-B3bNrkzn.js +1 -0
- package/assets/line-B86HLuqu.js +1 -0
- package/assets/linear-DU2Ciymb.js +1 -0
- package/assets/linear-wCAlMhOS.js +1 -0
- package/assets/mermaid.core-DfVvnpgz.js +91 -0
- package/assets/mindmap-definition-fc14e90a-D1sxE3xG.js +425 -0
- package/assets/mindmap-definition-fc14e90a-YuSOJC7P.js +425 -0
- package/assets/ordinal-BRr1uYdk.js +1 -0
- package/assets/ordinal-Cboi1Yqb.js +1 -0
- package/assets/path-CY0bYimO.js +1 -0
- package/assets/path-CbwjOpE9.js +1 -0
- package/assets/photo-wall-splitter-BVU2e0aS.js +1 -0
- package/assets/pick-Cvlwra4g.js +1 -0
- package/assets/pieDiagram-8a3498a8-B6mJUqro.js +35 -0
- package/assets/pieDiagram-8a3498a8-B91bWgo_.js +35 -0
- package/assets/quadrantDiagram-120e2f19-BxS8fQEz.js +7 -0
- package/assets/quadrantDiagram-120e2f19-DwudONqx.js +7 -0
- package/assets/requirementDiagram-deff3bca-DygaMIoy.js +52 -0
- package/assets/requirementDiagram-deff3bca-v9xlgfS8.js +52 -0
- package/assets/sankeyDiagram-04a897e0-BV23dp4l.js +8 -0
- package/assets/sankeyDiagram-04a897e0-BXCiXiyw.js +8 -0
- package/assets/sequenceDiagram-704730f1-CObRpNi4.js +122 -0
- package/assets/sequenceDiagram-704730f1-Ck69A6wI.js +122 -0
- package/assets/settings-dialog-BlCO49C4.js +1 -0
- package/assets/settings-dialog-QUxXj54T.css +1 -0
- package/assets/stateDiagram-587899a1-J_G6I0oo.js +1 -0
- package/assets/stateDiagram-587899a1-z-tKclr3.js +1 -0
- package/assets/stateDiagram-v2-d93cdb3a-DsThtOzP.js +1 -0
- package/assets/stateDiagram-v2-d93cdb3a-XIvq5t8a.js +1 -0
- package/assets/styles-6aaf32cf-1fjuNMUk.js +207 -0
- package/assets/styles-6aaf32cf-DT2rVNfQ.js +207 -0
- package/assets/styles-9a916d00-fLeUSina.js +160 -0
- package/assets/styles-9a916d00-q64Umkis.js +160 -0
- package/assets/styles-c10674c1-BWlxVc3Q.js +116 -0
- package/assets/styles-c10674c1-CtYpjMYU.js +116 -0
- package/assets/svgDrawCommon-08f97a94-C_DhKfny.js +1 -0
- package/assets/svgDrawCommon-08f97a94-DSBqmUv2.js +1 -0
- package/assets/timeline-definition-85554ec2-AKpzwLPN.js +61 -0
- package/assets/timeline-definition-85554ec2-dTkYwoLF.js +61 -0
- package/assets/ttd-dialog-CxiaIUuJ.js +47 -0
- package/assets/ttd-dialog-DCapefb6.css +1 -0
- package/assets/upload-4sxUU7q_.js +1 -0
- package/assets/video-recovery-service-BckHbSyK.js +1 -0
- package/assets/web-vitals-DcvjKPr-.js +1 -0
- package/assets/winbox.bundle.min-CoRPjCs5.js +1 -0
- package/assets/xlsx-CkFp8p6R.js +105 -0
- package/assets/xychartDiagram-e933f94c-DCmvL0ag.js +7 -0
- package/assets/xychartDiagram-e933f94c-aqOiXp_u.js +7 -0
- package/batch-image.html +1616 -0
- package/favicon.ico +0 -0
- package/icons/README.md +55 -0
- package/icons/aitu10.png +0 -0
- package/icons/android-chrome-192x192.png +0 -0
- package/icons/android-chrome-512x512.png +0 -0
- package/icons/apple-touch-icon.png +0 -0
- package/icons/favicon-16x16.png +0 -0
- package/icons/favicon-16x16.svg +539 -0
- package/icons/favicon-32x32.png +0 -0
- package/icons/favicon-32x32.svg +539 -0
- package/icons/favicon-new.svg +539 -0
- package/icons/favicon-new.svg.png +0 -0
- package/icons/icon-192x192.svg +539 -0
- package/icons/icon-512x512.svg +539 -0
- package/icons/icon-96x96.png +0 -0
- package/icons/icon-96x96.svg +539 -0
- package/iframe-test.html +340 -0
- package/index.html +105 -0
- package/init.json +6 -0
- package/logo/cardid.jpg +0 -0
- package/logo/group-qr.png +0 -0
- package/logo/logo_drawnix_h.svg +539 -0
- package/logo/logo_drawnix_h_dark.svg +539 -0
- package/logo/logo_drawnix_new.svg +539 -0
- package/manifest.json +52 -0
- package/package.json +31 -0
- package/product_showcase/aitu-01.png +0 -0
- package/product_showcase/aitu-02.png +0 -0
- package/product_showcase/aitu-03.png +0 -0
- package/product_showcase/aitu-04.png +0 -0
- package/product_showcase/aitu-05.png +0 -0
- package/product_showcase/aitu-06.png +0 -0
- package/product_showcase/case-1.png +0 -0
- package/product_showcase/case-2.png +0 -0
- package/robots.txt +13 -0
- package/sitemap.xml +29 -0
- package/sw-debug/app.js +3069 -0
- package/sw-debug/console-entry.js +80 -0
- package/sw-debug/log-entry.js +452 -0
- package/sw-debug/log-panel.js +309 -0
- package/sw-debug/postmessage-entry.js +117 -0
- package/sw-debug/status-panel.js +125 -0
- package/sw-debug/styles.css +2103 -0
- package/sw-debug/sw-communication.js +208 -0
- package/sw-debug/utils.js +112 -0
- package/sw-debug.html +685 -0
- package/sw.js +58 -0
- package/version.json +10 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
var jg=Object.defineProperty;var Qd=l=>{throw TypeError(l)};var zg=(l,t,e)=>t in l?jg(l,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):l[t]=e;var X=(l,t,e)=>zg(l,typeof t!="symbol"?t+"":t,e),Uc=(l,t,e)=>t.has(l)||Qd("Cannot "+e);var a=(l,t,e)=>(Uc(l,t,"read from private field"),e?e.call(l):t.get(l)),v=(l,t,e)=>t.has(l)?Qd("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(l):t.set(l,e),m=(l,t,e,s)=>(Uc(l,t,"write to private field"),s?s.call(l,e):t.set(l,e),e),A=(l,t,e)=>(Uc(l,t,"access private method"),e);var ue=(l,t,e,s)=>({set _(i){m(l,t,i,e)},get _(){return a(l,t,s)}});import{r as P,C as B,aD as Yu,au as xl,aw as Ku,U as Cl}from"./index-DWUAFoZG.js";import{c as bl,_ as $g}from"./ChatMessagesArea-CkUX81uB.js";import"./index-DI_5V2-m.js";import"./index.dom-C3-224fz.js";import"./katex-Cu_Erd72.js";import"./index-BicRPzXC.js";var Jd=Object.prototype.hasOwnProperty;function tu(l,t,e){for(e of l.keys())if(xr(e,t))return e}function xr(l,t){var e,s,i;if(l===t)return!0;if(l&&t&&(e=l.constructor)===t.constructor){if(e===Date)return l.getTime()===t.getTime();if(e===RegExp)return l.toString()===t.toString();if(e===Array){if((s=l.length)===t.length)for(;s--&&xr(l[s],t[s]););return s===-1}if(e===Set){if(l.size!==t.size)return!1;for(s of l)if(i=s,i&&typeof i=="object"&&(i=tu(t,i),!i)||!t.has(i))return!1;return!0}if(e===Map){if(l.size!==t.size)return!1;for(s of l)if(i=s[0],i&&typeof i=="object"&&(i=tu(t,i),!i)||!xr(s[1],t.get(i)))return!1;return!0}if(e===ArrayBuffer)l=new Uint8Array(l),t=new Uint8Array(t);else if(e===DataView){if((s=l.byteLength)===t.byteLength)for(;s--&&l.getInt8(s)===t.getInt8(s););return s===-1}if(ArrayBuffer.isView(l)){if((s=l.byteLength)===t.byteLength)for(;s--&&l[s]===t[s];);return s===-1}if(!e||typeof l=="object"){s=0;for(e in l)if(Jd.call(l,e)&&++s&&!Jd.call(t,e)||!(e in t)||!xr(l[e],t[e]))return!1;return Object.keys(t).length===s}}return l!==l&&t!==t}function eu(l){if(l===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return l}function rh(l,t){return rh=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,s){return e.__proto__=s,e},rh(l,t)}function Wg(l,t){l.prototype=Object.create(t.prototype),l.prototype.constructor=l,rh(l,t)}const Zu=P.createContext(void 0),c_=({children:l})=>{const[t,e]=P.useState({documentId:"",pageNumber:0});return B.jsx(Zu.Provider,{value:{pdfFocusState:t,setPdfFocusState:e},children:l})},Qu=()=>{const l=P.useContext(Zu);if(l===void 0)throw new Error("usePDF must be used within a PDFProvider");return l},pr=["50%","80%","100%","130%","200%","300%","400%"],Gg=2,Ug=l=>{const[t,e]=P.useState(1),[s,i]=P.useState(1),[n,r]=P.useState(1),[o,c]=P.useState(0),[h,d]=P.useState(!1),[u,f]=P.useState(Gg),{pdfFocusState:p}=Qu(),b=Yu.useRef(null),g=L=>{b.current&&b.current.scrollToPage(L)};P.useEffect(()=>{p.documentId===l.id&&p.pageNumber&&g(p.pageNumber-1)},[l,p]);const _=P.useCallback(L=>{e(L)},[]),y=P.useCallback(()=>{const L=u+1;L>=pr.length||C(pr[L]||"100%")},[u,t,b]),w=P.useCallback(()=>{const L=u-1;L<0||C(pr[L]||"100%")},[u,t,b]),E=()=>{g(t+1)},x=()=>{g(t-1)},S=L=>`${100+L*100}%`,C=P.useCallback(L=>{const j=pr.indexOf(L),O=T(L)+n-1;i(O),setTimeout(()=>{g(t)},30),f(j)},[t]);function T(L){return parseInt(L,10)/100}const R=Math.round((s-n)*10)/10,I=S(R);P.useEffect(()=>{i(n)},[n]);const D=u<pr.length-1,M=u>0;return{scrolledIndex:t,setCurrentPageNumber:_,scale:s,setScaleFit:r,numPages:o,setNumPages:c,handleZoomIn:y,handleZoomOut:w,nextPage:E,prevPage:x,scaleText:I,isPdfRendered:h,setIsPdfRendered:d,pdfFocusRef:b,goToPage:g,setZoomLevel:C,zoomInEnabled:D,zoomOutEnabled:M}};function Ju(l,t,e){P.useEffect(function(){if(l)return l.addEventListener(t,e),function(){l.removeEventListener(t,e)}},[l,t,e])}var su=typeof document<"u";function Vg(){var l=P.useState(su?window.innerWidth:null),t=l[0],e=l[1],s=P.useCallback(function(){return e(window.innerWidth)},[]);return Ju(su?window:null,"resize",s),t}var iu=typeof document<"u";function Xg(){var l=P.useState(iu?window.innerHeight:null),t=l[0],e=l[1],s=P.useCallback(function(){return e(window.innerHeight)},[]);return Ju(iu?window:null,"resize",s),t}var Vc,nu;function qg(){if(nu)return Vc;nu=1;var l="Expected a function",t=NaN,e="[object Symbol]",s=/^\s+|\s+$/g,i=/^[-+]0x[0-9a-f]+$/i,n=/^0b[01]+$/i,r=/^0o[0-7]+$/i,o=parseInt,c=typeof xl=="object"&&xl&&xl.Object===Object&&xl,h=typeof self=="object"&&self&&self.Object===Object&&self,d=c||h||Function("return this")(),u=Object.prototype,f=u.toString,p=Math.max,b=Math.min,g=function(){return d.Date.now()};function _(S,C,T){var R,I,D,M,L,j,O=0,U=!1,G=!1,N=!0;if(typeof S!="function")throw new TypeError(l);C=x(C)||0,y(T)&&(U=!!T.leading,G="maxWait"in T,D=G?p(x(T.maxWait)||0,C):D,N="trailing"in T?!!T.trailing:N);function z(V){var Ot=R,Kt=I;return R=I=void 0,O=V,M=S.apply(Kt,Ot),M}function It(V){return O=V,L=setTimeout(ot,C),U?z(V):M}function Mt(V){var Ot=V-j,Kt=V-O,ft=C-Ot;return G?b(ft,D-Kt):ft}function Tt(V){var Ot=V-j,Kt=V-O;return j===void 0||Ot>=C||Ot<0||G&&Kt>=D}function ot(){var V=g();if(Tt(V))return nt(V);L=setTimeout(ot,Mt(V))}function nt(V){return L=void 0,N&&R?z(V):(R=I=void 0,M)}function St(){L!==void 0&&clearTimeout(L),O=0,R=j=I=L=void 0}function se(){return L===void 0?M:nt(g())}function bt(){var V=g(),Ot=Tt(V);if(R=arguments,I=this,j=V,Ot){if(L===void 0)return It(j);if(G)return L=setTimeout(ot,C),z(j)}return L===void 0&&(L=setTimeout(ot,C)),M}return bt.cancel=St,bt.flush=se,bt}function y(S){var C=typeof S;return!!S&&(C=="object"||C=="function")}function w(S){return!!S&&typeof S=="object"}function E(S){return typeof S=="symbol"||w(S)&&f.call(S)==e}function x(S){if(typeof S=="number")return S;if(E(S))return t;if(y(S)){var C=typeof S.valueOf=="function"?S.valueOf():S;S=y(C)?C+"":C}if(typeof S!="string")return S===0?S:+S;S=S.replace(s,"");var T=n.test(S);return T||r.test(S)?o(S.slice(2),T?2:8):i.test(S)?t:+S}return Vc=_,Vc}var Yg=qg();const Kg=Ku(Yg);var ah=new Map,Tl=new WeakMap,ru=0,Zg=void 0;function Qg(l){return l?(Tl.has(l)||(ru+=1,Tl.set(l,ru.toString())),Tl.get(l)):"0"}function Jg(l){return Object.keys(l).sort().filter(t=>l[t]!==void 0).map(t=>`${t}_${t==="root"?Qg(l.root):l[t]}`).toString()}function tm(l){let t=Jg(l),e=ah.get(t);if(!e){const s=new Map;let i;const n=new IntersectionObserver(r=>{r.forEach(o=>{var h;const c=o.isIntersecting&&i.some(d=>o.intersectionRatio>=d);l.trackVisibility&&typeof o.isVisible>"u"&&(o.isVisible=c),(h=s.get(o.target))==null||h.forEach(d=>{d(c,o)})})},l);i=n.thresholds||(Array.isArray(l.threshold)?l.threshold:[l.threshold||0]),e={id:t,observer:n,elements:s},ah.set(t,e)}return e}function em(l,t,e={},s=Zg){if(typeof window.IntersectionObserver>"u"&&s!==void 0){const c=l.getBoundingClientRect();return t(s,{isIntersecting:s,target:l,intersectionRatio:typeof e.threshold=="number"?e.threshold:0,time:0,boundingClientRect:c,intersectionRect:c,rootBounds:c}),()=>{}}const{id:i,observer:n,elements:r}=tm(e);let o=r.get(l)||[];return r.has(l)||r.set(l,o),o.push(t),n.observe(l),function(){o.splice(o.indexOf(t),1),o.length===0&&(r.delete(l),n.unobserve(l)),r.size===0&&(n.disconnect(),ah.delete(i))}}function sm({threshold:l,delay:t,trackVisibility:e,rootMargin:s,root:i,triggerOnce:n,skip:r,initialInView:o,fallbackInView:c,onChange:h}={}){var w;const[d,u]=P.useState(null),f=P.useRef(),[p,b]=P.useState({inView:!!o,entry:void 0});f.current=h,P.useEffect(()=>{if(r||!d)return;let E;return E=em(d,(x,S)=>{b({inView:x,entry:S}),f.current&&f.current(x,S),S.isIntersecting&&n&&E&&(E(),E=void 0)},{root:i,rootMargin:s,threshold:l,trackVisibility:e,delay:t},c),()=>{E&&E()}},[Array.isArray(l)?l.toString():l,d,i,s,n,r,e,c,t]);const g=(w=p.entry)==null?void 0:w.target,_=P.useRef();!d&&g&&!n&&!r&&_.current!==g&&(_.current=g,b({inView:!!o,entry:void 0}));const y=[u,p.inView,p.entry];return y.ref=y[0],y.inView=y[1],y.entry=y[2],y}var Za={};Za.d=(l,t)=>{for(var e in t)Za.o(t,e)&&!Za.o(l,e)&&Object.defineProperty(l,e,{enumerable:!0,get:t[e]})};Za.o=(l,t)=>Object.prototype.hasOwnProperty.call(l,t);var K=globalThis.pdfjsLib={};Za.d(K,{AbortException:()=>cr,AnnotationEditorLayer:()=>Ad,AnnotationEditorParamsType:()=>q,AnnotationEditorType:()=>Q,AnnotationEditorUIManager:()=>ir,AnnotationLayer:()=>tA,AnnotationMode:()=>mi,ColorPicker:()=>fc,DOMSVGFactory:()=>Ud,DrawLayer:()=>wd,FeatureTest:()=>me,GlobalWorkerOptions:()=>oi,ImageKind:()=>Fl,InvalidPDFException:()=>ef,MissingPDFException:()=>lr,OPS:()=>Ze,OutputScale:()=>dh,PDFDataRangeTransport:()=>Qf,PDFDateString:()=>Hd,PDFWorker:()=>Tr,PasswordResponses:()=>am,PermissionFlag:()=>rm,PixelsPerInch:()=>Gi,RenderingCancelledException:()=>Od,TextLayer:()=>Bh,UnexpectedResponseException:()=>Oc,Util:()=>$,VerbosityLevel:()=>Lc,XfaLayer:()=>tp,build:()=>Fb,createValidAbsoluteUrl:()=>hm,fetchData:()=>Hc,getDocument:()=>xb,getFilenameFromUrl:()=>vm,getPdfFilenameFromUrl:()=>ym,getXfaPageViewport:()=>_m,isDataScheme:()=>Bc,isPdfFile:()=>Nd,noContextMenu:()=>Ye,normalizeUnicode:()=>mm,setLayerDimensions:()=>sr,shadow:()=>it,version:()=>Lb});const de=typeof process=="object"&&process+""=="[object process]"&&!process.versions.nw&&!(process.versions.electron&&process.type&&process.type!=="browser"),tf=[1,0,0,1,0,0],oh=[.001,0,0,.001,0,0],im=1e7,Xc=1.35,Oe={ANY:1,DISPLAY:2,PRINT:4,ANNOTATIONS_FORMS:16,ANNOTATIONS_STORAGE:32,ANNOTATIONS_DISABLE:64,IS_EDITING:128,OPLIST:256},mi={DISABLE:0,ENABLE:1,ENABLE_FORMS:2,ENABLE_STORAGE:3},nm="pdfjs_internal_editor_",Q={DISABLE:-1,NONE:0,FREETEXT:3,HIGHLIGHT:9,STAMP:13,INK:15},q={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},rm={PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048},ne={FILL:0,STROKE:1,FILL_STROKE:2,INVISIBLE:3,FILL_STROKE_MASK:3,ADD_TO_PATH_FLAG:4},Fl={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3},Nt={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,WIDGET:20},ka={SOLID:1,DASHED:2,BEVELED:3,INSET:4,UNDERLINE:5},Lc={ERRORS:0,WARNINGS:1,INFOS:5},Ze={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},am={NEED_PASSWORD:1,INCORRECT_PASSWORD:2};let Fc=Lc.WARNINGS;function om(l){Number.isInteger(l)&&(Fc=l)}function lm(){return Fc}function Dc(l){Fc>=Lc.INFOS&&console.log(`Info: ${l}`)}function tt(l){Fc>=Lc.WARNINGS&&console.log(`Warning: ${l}`)}function At(l){throw new Error(l)}function zt(l,t){l||At(t)}function cm(l){switch(l==null?void 0:l.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":return!0;default:return!1}}function hm(l,t=null,e=null){if(!l)return null;try{if(e&&typeof l=="string"){if(e.addDefaultProtocol&&l.startsWith("www.")){const i=l.match(/\./g);(i==null?void 0:i.length)>=2&&(l=`http://${l}`)}if(e.tryConvertEncoding)try{l=gm(l)}catch{}}const s=t?new URL(l,t):new URL(l);if(cm(s))return s}catch{}return null}function it(l,t,e,s=!1){return Object.defineProperty(l,t,{value:e,enumerable:!s,configurable:!0,writable:!1}),e}const qi=(function(){function t(e,s){this.message=e,this.name=s}return t.prototype=new Error,t.constructor=t,t})();class lh extends qi{constructor(t,e){super(t,"PasswordException"),this.code=e}}class ch extends qi{constructor(t,e){super(t,"UnknownErrorException"),this.details=e}}class ef extends qi{constructor(t){super(t,"InvalidPDFException")}}class lr extends qi{constructor(t){super(t,"MissingPDFException")}}class Oc extends qi{constructor(t,e){super(t,"UnexpectedResponseException"),this.status=e}}class dm extends qi{constructor(t){super(t,"FormatError")}}class cr extends qi{constructor(t){super(t,"AbortException")}}function sf(l){(typeof l!="object"||(l==null?void 0:l.length)===void 0)&&At("Invalid argument for bytesToString");const t=l.length,e=8192;if(t<e)return String.fromCharCode.apply(null,l);const s=[];for(let i=0;i<t;i+=e){const n=Math.min(i+e,t),r=l.subarray(i,n);s.push(String.fromCharCode.apply(null,r))}return s.join("")}function Nc(l){typeof l!="string"&&At("Invalid argument for stringToBytes");const t=l.length,e=new Uint8Array(t);for(let s=0;s<t;++s)e[s]=l.charCodeAt(s)&255;return e}function um(l){return String.fromCharCode(l>>24&255,l>>16&255,l>>8&255,l&255)}function Fd(l){const t=Object.create(null);for(const[e,s]of l)t[e]=s;return t}function fm(){const l=new Uint8Array(4);return l[0]=1,new Uint32Array(l.buffer,0,1)[0]===1}function pm(){try{return new Function(""),!0}catch{return!1}}class me{static get isLittleEndian(){return it(this,"isLittleEndian",fm())}static get isEvalSupported(){return it(this,"isEvalSupported",pm())}static get isOffscreenCanvasSupported(){return it(this,"isOffscreenCanvasSupported",typeof OffscreenCanvas<"u")}static get platform(){return typeof navigator<"u"&&typeof(navigator==null?void 0:navigator.platform)=="string"?it(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")}):it(this,"platform",{isMac:!1,isWindows:!1,isFirefox:!1})}static get isCSSRoundSupported(){var t,e;return it(this,"isCSSRoundSupported",(e=(t=globalThis.CSS)==null?void 0:t.supports)==null?void 0:e.call(t,"width: round(1.5px, 1px)"))}}const qc=Array.from(Array(256).keys(),l=>l.toString(16).padStart(2,"0"));var ci,Dl,hh;class ${static makeHexColor(t,e,s){return`#${qc[t]}${qc[e]}${qc[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,n=(-t[0]*e[1]+t[1]*e[0]+e[4]*e[1]-e[5]*e[0])/s;return[i,n]}static getAxialAlignedBoundingBox(t,e){const s=this.applyTransform(t,e),i=this.applyTransform(t.slice(2,4),e),n=this.applyTransform([t[0],t[3]],e),r=this.applyTransform([t[2],t[1]],e);return[Math.min(s[0],i[0],n[0],r[0]),Math.min(s[1],i[1],n[1],r[1]),Math.max(s[0],i[0],n[0],r[0]),Math.max(s[1],i[1],n[1],r[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],n=t[2]*e[0]+t[3]*e[2],r=t[2]*e[1]+t[3]*e[3],o=(s+r)/2,c=Math.sqrt((s+r)**2-4*(s*r-n*i))/2,h=o+c||1,d=o-c||1;return[Math.sqrt(h),Math.sqrt(d)]}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 n=Math.max(Math.min(t[1],t[3]),Math.min(e[1],e[3])),r=Math.min(Math.max(t[1],t[3]),Math.max(e[1],e[3]));return n>r?null:[s,n,i,r]}static bezierBoundingBox(t,e,s,i,n,r,o,c,h){return h?(h[0]=Math.min(h[0],t,o),h[1]=Math.min(h[1],e,c),h[2]=Math.max(h[2],t,o),h[3]=Math.max(h[3],e,c)):h=[Math.min(t,o),Math.min(e,c),Math.max(t,o),Math.max(e,c)],A(this,ci,hh).call(this,t,s,n,o,e,i,r,c,3*(-t+3*(s-n)+o),6*(t-2*s+n),3*(s-t),h),A(this,ci,hh).call(this,t,s,n,o,e,i,r,c,3*(-e+3*(i-r)+c),6*(e-2*i+r),3*(i-e),h),h}}ci=new WeakSet,Dl=function(t,e,s,i,n,r,o,c,h,d){if(h<=0||h>=1)return;const u=1-h,f=h*h,p=f*h,b=u*(u*(u*t+3*h*e)+3*f*s)+p*i,g=u*(u*(u*n+3*h*r)+3*f*o)+p*c;d[0]=Math.min(d[0],b),d[1]=Math.min(d[1],g),d[2]=Math.max(d[2],b),d[3]=Math.max(d[3],g)},hh=function(t,e,s,i,n,r,o,c,h,d,u,f){if(Math.abs(h)<1e-12){Math.abs(d)>=1e-12&&A(this,ci,Dl).call(this,t,e,s,i,n,r,o,c,-u/d,f);return}const p=d**2-4*u*h;if(p<0)return;const b=Math.sqrt(p),g=2*h;A(this,ci,Dl).call(this,t,e,s,i,n,r,o,c,(-d+b)/g,f),A(this,ci,Dl).call(this,t,e,s,i,n,r,o,c,(-d-b)/g,f)},v($,ci);function gm(l){return decodeURIComponent(escape(l))}let Yc=null,au=null;function mm(l){return Yc||(Yc=/([\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,au=new Map([["ſt","ſt"]])),l.replaceAll(Yc,(t,e,s)=>e?e.normalize("NFKC"):au.get(s))}function bm(){if(typeof crypto<"u"&&typeof(crypto==null?void 0:crypto.randomUUID)=="function")return crypto.randomUUID();const l=new Uint8Array(32);if(typeof crypto<"u"&&typeof(crypto==null?void 0:crypto.getRandomValues)=="function")crypto.getRandomValues(l);else for(let t=0;t<32;t++)l[t]=Math.floor(Math.random()*255);return sf(l)}const Dd="pdfjs_internal_id_",ks={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(l){return Uint8Array.prototype.toBase64?l.toBase64():btoa(sf(l))}const Fs="http://www.w3.org/2000/svg",sn=class sn{};X(sn,"CSS",96),X(sn,"PDF",72),X(sn,"PDF_TO_CSS_UNITS",sn.CSS/sn.PDF);let Gi=sn;async function Hc(l,t="text"){if(Da(l,document.baseURI)){const e=await fetch(l);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",l,!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 Al{constructor({viewBox:t,scale:e,rotation:s,offsetX:i=0,offsetY:n=0,dontFlip:r=!1}){this.viewBox=t,this.scale=e,this.rotation=s,this.offsetX=i,this.offsetY=n;const o=(t[2]+t[0])/2,c=(t[3]+t[1])/2;let h,d,u,f;switch(s%=360,s<0&&(s+=360),s){case 180:h=-1,d=0,u=0,f=1;break;case 90:h=0,d=1,u=1,f=0;break;case 270:h=0,d=-1,u=-1,f=0;break;case 0:h=1,d=0,u=0,f=-1;break;default:throw new Error("PageViewport: Invalid rotation, must be a multiple of 90 degrees.")}r&&(u=-u,f=-f);let p,b,g,_;h===0?(p=Math.abs(c-t[1])*e+i,b=Math.abs(o-t[0])*e+n,g=(t[3]-t[1])*e,_=(t[2]-t[0])*e):(p=Math.abs(o-t[0])*e+i,b=Math.abs(c-t[1])*e+n,g=(t[2]-t[0])*e,_=(t[3]-t[1])*e),this.transform=[h*e,d*e,u*e,f*e,p-h*e*o-u*e*c,b-d*e*o-f*e*c],this.width=g,this.height=_}get rawDims(){const{viewBox:t}=this;return it(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:n=!1}={}){return new Al({viewBox:this.viewBox.slice(),scale:t,rotation:e,offsetX:s,offsetY:i,dontFlip:n})}convertToViewportPoint(t,e){return $.applyTransform([t,e],this.transform)}convertToViewportRectangle(t){const e=$.applyTransform([t[0],t[1]],this.transform),s=$.applyTransform([t[2],t[3]],this.transform);return[e[0],e[1],s[0],s[1]]}convertToPdfPoint(t,e){return $.applyInverseTransform([t,e],this.transform)}}class Od extends qi{constructor(t,e=0){super(t,"RenderingCancelledException"),this.extraDelay=e}}function Bc(l){const t=l.length;let e=0;for(;e<t&&l[e].trim()==="";)e++;return l.substring(e,e+5).toLowerCase()==="data:"}function Nd(l){return typeof l=="string"&&/\.pdf$/i.test(l)}function vm(l){return[l]=l.split(/[#?]/,1),l.substring(l.lastIndexOf("/")+1)}function ym(l,t="document.pdf"){if(typeof l!="string")return t;if(Bc(l))return tt('getPdfFilenameFromUrl: ignore "data:"-URL for performance reasons.'),t;const e=/^(?:(?:[^:]+:)?\/\/[^/]+)?([^?#]*)(\?[^#]*)?(#.*)?$/,s=/[^/?#=]+\.pdf\b(?!.*\.pdf\b)/i,i=e.exec(l);let n=s.exec(i[1])||s.exec(i[2])||s.exec(i[3]);if(n&&(n=n[0],n.includes("%")))try{n=s.exec(decodeURIComponent(n))[0]}catch{}return n||t}class ou{constructor(){X(this,"started",Object.create(null));X(this,"times",[])}time(t){t in this.started&&tt(`Timer is already running for ${t}`),this.started[t]=Date.now()}timeEnd(t){t in this.started||tt(`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:n}of this.times)t.push(`${s.padEnd(e)} ${n-i}ms
|
|
2
|
+
`);return t.join("")}}function Da(l,t){try{const{protocol:e}=t?new URL(l,t):new URL(l);return e==="http:"||e==="https:"}catch{return!1}}function Ye(l){l.preventDefault()}function lu(l){console.log("Deprecated API usage: "+l)}var eo;class Hd{static toDateObject(t){if(!t||typeof t!="string")return null;a(this,eo)||m(this,eo,new RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+|-])?(\\d{2})?'?(\\d{2})?'?"));const e=a(this,eo).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 n=parseInt(e[3],10);n=n>=1&&n<=31?n:1;let r=parseInt(e[4],10);r=r>=0&&r<=23?r:0;let o=parseInt(e[5],10);o=o>=0&&o<=59?o:0;let c=parseInt(e[6],10);c=c>=0&&c<=59?c:0;const h=e[7]||"Z";let d=parseInt(e[8],10);d=d>=0&&d<=23?d:0;let u=parseInt(e[9],10)||0;return u=u>=0&&u<=59?u:0,h==="-"?(r+=d,o+=u):h==="+"&&(r-=d,o-=u),new Date(Date.UTC(s,i,n,r,o,c))}}eo=new WeakMap,v(Hd,eo);function _m(l,{scale:t=1,rotation:e=0}){const{width:s,height:i}=l.attributes.style,n=[0,0,parseInt(s),parseInt(i)];return new Al({viewBox:n,scale:t,rotation:e})}function Bd(l){if(l.startsWith("#")){const t=parseInt(l.slice(1),16);return[(t&16711680)>>16,(t&65280)>>8,t&255]}return l.startsWith("rgb(")?l.slice(4,-1).split(",").map(t=>parseInt(t)):l.startsWith("rgba(")?l.slice(5,-1).split(",").map(t=>parseInt(t)).slice(0,3):(tt(`Not a valid color format: "${l}"`),[0,0,0])}function wm(l){const t=document.createElement("span");t.style.visibility="hidden",document.body.append(t);for(const e of l.keys()){t.style.color=e;const s=window.getComputedStyle(t).color;l.set(e,Bd(s))}t.remove()}function Et(l){const{a:t,b:e,c:s,d:i,e:n,f:r}=l.getTransform();return[t,e,s,i,n,r]}function Ls(l){const{a:t,b:e,c:s,d:i,e:n,f:r}=l.getTransform().invertSelf();return[t,e,s,i,n,r]}function sr(l,t,e=!1,s=!0){if(t instanceof Al){const{pageWidth:i,pageHeight:n}=t.rawDims,{style:r}=l,o=me.isCSSRoundSupported,c=`var(--scale-factor) * ${i}px`,h=`var(--scale-factor) * ${n}px`,d=o?`round(down, ${c}, var(--scale-round-x, 1px))`:`calc(${c})`,u=o?`round(down, ${h}, var(--scale-round-y, 1px))`:`calc(${h})`;!e||t.rotation%180===0?(r.width=d,r.height=u):(r.width=u,r.height=d)}s&&l.setAttribute("data-main-rotation",t.rotation)}class dh{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 bi,rn,Qe,an,so,io,mc,nf,be,rf,af,Ol,of,fh;const Ds=class Ds{constructor(t){v(this,be);v(this,bi,null);v(this,rn,null);v(this,Qe);v(this,an,null);v(this,so,null);m(this,Qe,t),a(Ds,io)||m(Ds,io,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=m(this,bi,document.createElement("div"));t.classList.add("editToolbar","hidden"),t.setAttribute("role","toolbar");const e=a(this,Qe)._uiManager._signal;t.addEventListener("contextmenu",Ye,{signal:e}),t.addEventListener("pointerdown",A(Ds,mc,nf),{signal:e});const s=m(this,an,document.createElement("div"));s.className="buttons",t.append(s);const i=a(this,Qe).toolbarPosition;if(i){const{style:n}=t,r=a(this,Qe)._uiManager.direction==="ltr"?1-i[0]:i[0];n.insetInlineEnd=`${100*r}%`,n.top=`calc(${100*i[1]}% + var(--editor-toolbar-vert-offset))`}return A(this,be,of).call(this),t}get div(){return a(this,bi)}hide(){var t;a(this,bi).classList.add("hidden"),(t=a(this,rn))==null||t.hideDropdown()}show(){var t;a(this,bi).classList.remove("hidden"),(t=a(this,so))==null||t.shown()}async addAltText(t){const e=await t.render();A(this,be,Ol).call(this,e),a(this,an).prepend(e,a(this,be,fh)),m(this,so,t)}addColorPicker(t){m(this,rn,t);const e=t.renderButton();A(this,be,Ol).call(this,e),a(this,an).prepend(e,a(this,be,fh))}remove(){var t;a(this,bi).remove(),(t=a(this,rn))==null||t.destroy(),m(this,rn,null)}};bi=new WeakMap,rn=new WeakMap,Qe=new WeakMap,an=new WeakMap,so=new WeakMap,io=new WeakMap,mc=new WeakSet,nf=function(t){t.stopPropagation()},be=new WeakSet,rf=function(t){a(this,Qe)._focusEventsAllowed=!1,t.preventDefault(),t.stopPropagation()},af=function(t){a(this,Qe)._focusEventsAllowed=!0,t.preventDefault(),t.stopPropagation()},Ol=function(t){const e=a(this,Qe)._uiManager._signal;t.addEventListener("focusin",A(this,be,rf).bind(this),{capture:!0,signal:e}),t.addEventListener("focusout",A(this,be,af).bind(this),{capture:!0,signal:e}),t.addEventListener("contextmenu",Ye,{signal:e})},of=function(){const{editorType:t,_uiManager:e}=a(this,Qe),s=document.createElement("button");s.className="delete",s.tabIndex=0,s.setAttribute("data-l10n-id",a(Ds,io)[t]),A(this,be,Ol).call(this,s),s.addEventListener("click",i=>{e.delete()},{signal:e._signal}),a(this,an).append(s)},fh=function(){const t=document.createElement("div");return t.className="divider",t},v(Ds,mc),v(Ds,io,null);let uh=Ds;var no,on,ln,Vi,lf,cf,hf;class Em{constructor(t){v(this,Vi);v(this,no,null);v(this,on,null);v(this,ln);m(this,ln,t)}show(t,e,s){const[i,n]=A(this,Vi,cf).call(this,e,s),{style:r}=a(this,on)||m(this,on,A(this,Vi,lf).call(this));t.append(a(this,on)),r.insetInlineEnd=`${100*i}%`,r.top=`calc(${100*n}% + var(--editor-toolbar-vert-offset))`}hide(){a(this,on).remove()}}no=new WeakMap,on=new WeakMap,ln=new WeakMap,Vi=new WeakSet,lf=function(){const t=m(this,on,document.createElement("div"));t.className="editToolbar",t.setAttribute("role","toolbar"),t.addEventListener("contextmenu",Ye,{signal:a(this,ln)._signal});const e=m(this,no,document.createElement("div"));return e.className="buttons",t.append(e),A(this,Vi,hf).call(this),t},cf=function(t,e){let s=0,i=0;for(const n of t){const r=n.y+n.height;if(r<s)continue;const o=n.x+(e?n.width:0);if(r>s){i=o,s=r;continue}e?o>i&&(i=o):o<i&&(i=o)}return[e?1-i:i,s]},hf=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=a(this,ln)._signal;t.addEventListener("contextmenu",Ye,{signal:s}),t.addEventListener("click",()=>{a(this,ln).highlightSelection("floating_button")},{signal:s}),a(this,no).append(t)};function hc(l,t,e){for(const s of e)t.addEventListener(s,l[s].bind(l))}function Sm(l){return Math.round(Math.min(255,Math.max(1,255*l))).toString(16).padStart(2,"0")}var bc;class xm{constructor(){v(this,bc,0)}get id(){return`${nm}${ue(this,bc)._++}`}}bc=new WeakMap;var Pr,ro,ae,Ir,Nl;const Yd=class Yd{constructor(){v(this,Ir);v(this,Pr,bm());v(this,ro,0);v(this,ae,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 n=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 it(this,"_isSVGFittingCanvas",n)}async getFromFile(t){const{lastModified:e,name:s,size:i,type:n}=t;return A(this,Ir,Nl).call(this,`${e}_${s}_${i}_${n}`,t)}async getFromUrl(t){return A(this,Ir,Nl).call(this,t,t)}async getFromBlob(t,e){const s=await e;return A(this,Ir,Nl).call(this,t,s)}async getFromId(t){a(this,ae)||m(this,ae,new Map);const e=a(this,ae).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){a(this,ae)||m(this,ae,new Map);let s=a(this,ae).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_${a(this,Pr)}_${ue(this,ro)._++}`,refCounter:1,isSvg:!1},a(this,ae).set(t,s),a(this,ae).set(s.id,s),s}getSvgUrl(t){const e=a(this,ae).get(t);return e!=null&&e.isSvg?e.svgUrl:null}deleteId(t){var i;a(this,ae)||m(this,ae,new Map);const e=a(this,ae).get(t);if(!e||(e.refCounter-=1,e.refCounter!==0))return;const{bitmap:s}=e;if(!e.url&&!e.file){const n=new OffscreenCanvas(s.width,s.height);n.getContext("bitmaprenderer").transferFromImageBitmap(s),e.blobPromise=n.convertToBlob()}(i=s.close)==null||i.call(s),e.bitmap=null}isValidId(t){return t.startsWith(`image_${a(this,Pr)}_`)}};Pr=new WeakMap,ro=new WeakMap,ae=new WeakMap,Ir=new WeakSet,Nl=async function(t,e){a(this,ae)||m(this,ae,new Map);let s=a(this,ae).get(t);if(s===null)return null;if(s!=null&&s.bitmap)return s.refCounter+=1,s;try{s||(s={bitmap:null,id:`image_${a(this,Pr)}_${ue(this,ro)._++}`,refCounter:0,isSvg:!1});let i;if(typeof e=="string"?(s.url=e,i=await Hc(e,"blob")):e instanceof File?i=s.file=e:e instanceof Blob&&(i=e),i.type==="image/svg+xml"){const n=Yd._isSVGFittingCanvas,r=new FileReader,o=new Image,c=new Promise((h,d)=>{o.onload=()=>{s.bitmap=o,s.isSvg=!0,h()},r.onload=async()=>{const u=s.svgUrl=r.result;o.src=await n?`${u}#svgView(preserveAspectRatio(none))`:u},o.onerror=r.onerror=d});r.readAsDataURL(i),await c}else s.bitmap=await createImageBitmap(i);s.refCounter=1}catch(i){console.error(i),s=null}return a(this,ae).set(t,s),s&&a(this,ae).set(s.id,s),s};let ph=Yd;var Ut,Ai,ao,Vt;class Cm{constructor(t=128){v(this,Ut,[]);v(this,Ai,!1);v(this,ao);v(this,Vt,-1);m(this,ao,t)}add({cmd:t,undo:e,post:s,mustExec:i,type:n=NaN,overwriteIfSameType:r=!1,keepUndo:o=!1}){if(i&&t(),a(this,Ai))return;const c={cmd:t,undo:e,post:s,type:n};if(a(this,Vt)===-1){a(this,Ut).length>0&&(a(this,Ut).length=0),m(this,Vt,0),a(this,Ut).push(c);return}if(r&&a(this,Ut)[a(this,Vt)].type===n){o&&(c.undo=a(this,Ut)[a(this,Vt)].undo),a(this,Ut)[a(this,Vt)]=c;return}const h=a(this,Vt)+1;h===a(this,ao)?a(this,Ut).splice(0,1):(m(this,Vt,h),h<a(this,Ut).length&&a(this,Ut).splice(h)),a(this,Ut).push(c)}undo(){if(a(this,Vt)===-1)return;m(this,Ai,!0);const{undo:t,post:e}=a(this,Ut)[a(this,Vt)];t(),e==null||e(),m(this,Ai,!1),m(this,Vt,a(this,Vt)-1)}redo(){if(a(this,Vt)<a(this,Ut).length-1){m(this,Vt,a(this,Vt)+1),m(this,Ai,!0);const{cmd:t,post:e}=a(this,Ut)[a(this,Vt)];t(),e==null||e(),m(this,Ai,!1)}}hasSomethingToUndo(){return a(this,Vt)!==-1}hasSomethingToRedo(){return a(this,Vt)<a(this,Ut).length-1}destroy(){m(this,Ut,null)}}Ut=new WeakMap,Ai=new WeakMap,ao=new WeakMap,Vt=new WeakMap;var Ac,df;class vl{constructor(t){v(this,Ac);this.buffer=[],this.callbacks=new Map,this.allKeys=new Set;const{isMac:e}=me.platform;for(const[s,i,n={}]of t)for(const r of s){const o=r.startsWith("mac+");e&&o?(this.callbacks.set(r.slice(4),{callback:i,options:n}),this.allKeys.add(r.split("+").at(-1))):!e&&!o&&(this.callbacks.set(r,{callback:i,options:n}),this.allKeys.add(r.split("+").at(-1)))}}exec(t,e){if(!this.allKeys.has(e.key))return;const s=this.callbacks.get(A(this,Ac,df).call(this,e));if(!s)return;const{callback:i,options:{bubbles:n=!1,args:r=[],checker:o=null}}=s;o&&!o(t,e)||(i.bind(t,...r,e)(),n||(e.stopPropagation(),e.preventDefault()))}}Ac=new WeakSet,df=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 vc=class vc{get _colors(){const t=new Map([["CanvasText",null],["Canvas",null]]);return wm(t),it(this,"_colors",t)}convert(t){const e=Bd(t);if(!window.matchMedia("(forced-colors: active)").matches)return e;for(const[s,i]of this._colors)if(i.every((n,r)=>n===e[r]))return vc._colorsMapping.get(s);return e}getHexCode(t){const e=this._colors.get(t);return e?$.makeHexColor(...e):t}};X(vc,"_colorsMapping",new Map([["CanvasText",[0,0,0]],["Canvas",[255,255,255]]]));let gh=vc;var Mr,Re,Ht,Qt,kr,Ns,Lr,Je,vi,Fr,cn,fs,ts,hn,oo,lo,Dr,co,ps,yi,Or,_i,gs,yc,wi,ho,Ei,dn,uo,fo,Xt,lt,Hs,un,po,go,Si,ms,Bs,mo,ze,F,Hl,mh,uf,ff,Bl,pf,gf,mf,bh,bf,Ah,vh,Af,fe,pi,vf,yf,yh,_f,Oa,_h;const Sr=class Sr{constructor(t,e,s,i,n,r,o,c,h,d,u){v(this,F);v(this,Mr,new AbortController);v(this,Re,null);v(this,Ht,new Map);v(this,Qt,new Map);v(this,kr,null);v(this,Ns,null);v(this,Lr,null);v(this,Je,new Cm);v(this,vi,null);v(this,Fr,0);v(this,cn,new Set);v(this,fs,null);v(this,ts,null);v(this,hn,new Set);v(this,oo,!1);v(this,lo,!1);v(this,Dr,!1);v(this,co,null);v(this,ps,null);v(this,yi,null);v(this,Or,null);v(this,_i,!1);v(this,gs,null);v(this,yc,new xm);v(this,wi,!1);v(this,ho,!1);v(this,Ei,null);v(this,dn,null);v(this,uo,null);v(this,fo,null);v(this,Xt,Q.NONE);v(this,lt,new Set);v(this,Hs,null);v(this,un,null);v(this,po,null);v(this,go,{isEditing:!1,isEmpty:!0,hasSomethingToUndo:!1,hasSomethingToRedo:!1,hasSelectedEditor:!1,hasSelectedText:!1});v(this,Si,[0,0]);v(this,ms,null);v(this,Bs,null);v(this,mo,null);v(this,ze,null);const f=this._signal=a(this,Mr).signal;m(this,Bs,t),m(this,mo,e),m(this,kr,s),this._eventBus=i,i._on("editingaction",this.onEditingAction.bind(this),{signal:f}),i._on("pagechanging",this.onPageChanging.bind(this),{signal:f}),i._on("scalechanging",this.onScaleChanging.bind(this),{signal:f}),i._on("rotationchanging",this.onRotationChanging.bind(this),{signal:f}),i._on("setpreference",this.onSetPreference.bind(this),{signal:f}),i._on("switchannotationeditorparams",p=>this.updateParams(p.type,p.value),{signal:f}),A(this,F,pf).call(this),A(this,F,Af).call(this),A(this,F,bh).call(this),m(this,Ns,n.annotationStorage),m(this,co,n.filterFactory),m(this,un,r),m(this,Or,o||null),m(this,oo,c),m(this,lo,h),m(this,Dr,d),m(this,fo,u||null),this.viewParameters={realScale:Gi.PDF_TO_CSS_UNITS,rotation:0},this.isShiftKeyDown=!1}static get _keyboardManager(){const t=Sr.prototype,e=r=>a(r,Bs).contains(document.activeElement)&&document.activeElement.tagName!=="BUTTON"&&r.hasSomethingToControl(),s=(r,{target:o})=>{if(o instanceof HTMLInputElement){const{type:c}=o;return c!=="text"&&c!=="number"}return!0},i=this.TRANSLATE_SMALL,n=this.TRANSLATE_BIG;return it(this,"_keyboardManager",new vl([[["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:(r,{target:o})=>!(o instanceof HTMLButtonElement)&&a(r,Bs).contains(o)&&!r.isEnterHandled}],[[" ","mac+ "],t.addNewEditorFromKeyboard,{checker:(r,{target:o})=>!(o instanceof HTMLButtonElement)&&a(r,Bs).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:[-n,0],checker:e}],[["ArrowRight","mac+ArrowRight"],t.translateSelectedEditors,{args:[i,0],checker:e}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],t.translateSelectedEditors,{args:[n,0],checker:e}],[["ArrowUp","mac+ArrowUp"],t.translateSelectedEditors,{args:[0,-i],checker:e}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],t.translateSelectedEditors,{args:[0,-n],checker:e}],[["ArrowDown","mac+ArrowDown"],t.translateSelectedEditors,{args:[0,i],checker:e}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],t.translateSelectedEditors,{args:[0,n],checker:e}]]))}destroy(){var t,e,s,i;(t=a(this,ze))==null||t.resolve(),m(this,ze,null),(e=a(this,Mr))==null||e.abort(),m(this,Mr,null),this._signal=null;for(const n of a(this,Qt).values())n.destroy();a(this,Qt).clear(),a(this,Ht).clear(),a(this,hn).clear(),m(this,Re,null),a(this,lt).clear(),a(this,Je).destroy(),(s=a(this,kr))==null||s.destroy(),(i=a(this,gs))==null||i.hide(),m(this,gs,null),a(this,ps)&&(clearTimeout(a(this,ps)),m(this,ps,null)),a(this,ms)&&(clearTimeout(a(this,ms)),m(this,ms,null))}combinedSignal(t){return AbortSignal.any([this._signal,t.signal])}get mlManager(){return a(this,fo)}get useNewAltTextFlow(){return a(this,lo)}get useNewAltTextWhenAddingImage(){return a(this,Dr)}get hcmFilter(){return it(this,"hcmFilter",a(this,un)?a(this,co).addHCMFilter(a(this,un).foreground,a(this,un).background):"none")}get direction(){return it(this,"direction",getComputedStyle(a(this,Bs)).direction)}get highlightColors(){return it(this,"highlightColors",a(this,Or)?new Map(a(this,Or).split(",").map(t=>t.split("=").map(e=>e.trim()))):null)}get highlightColorNames(){return it(this,"highlightColorNames",this.highlightColors?new Map(Array.from(this.highlightColors,t=>t.reverse())):null)}setMainHighlightColorPicker(t){m(this,uo,t)}editAltText(t,e=!1){var s;(s=a(this,kr))==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":m(this,Dr,e);break}}onPageChanging({pageNumber:t}){m(this,Fr,t-1)}focusMainContainer(){a(this,Bs).focus()}findParent(t,e){for(const s of a(this,Qt).values()){const{x:i,y:n,width:r,height:o}=s.div.getBoundingClientRect();if(t>=i&&t<=i+r&&e>=n&&e<=n+o)return s}return null}disableUserSelect(t=!1){a(this,mo).classList.toggle("noUserSelect",t)}addShouldRescale(t){a(this,hn).add(t)}removeShouldRescale(t){a(this,hn).delete(t)}onScaleChanging({scale:t}){this.commitOrRemove(),this.viewParameters.realScale=t*Gi.PDF_TO_CSS_UNITS;for(const e of a(this,hn))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:n,focusOffset:r}=e,o=e.toString(),h=A(this,F,Hl).call(this,e).closest(".textLayer"),d=this.getSelectionBoxes(h);if(!d)return;e.empty();const u=A(this,F,mh).call(this,h),f=a(this,Xt)===Q.NONE,p=()=>{u==null||u.createAndAddNewEditor({x:0,y:0},!1,{methodOfCreation:t,boxes:d,anchorNode:s,anchorOffset:i,focusNode:n,focusOffset:r,text:o}),f&&this.showAllEditors("highlight",!0,!0)};if(f){this.switchToMode(Q.HIGHLIGHT,p);return}p()}addToAnnotationStorage(t){!t.isEmpty()&&a(this,Ns)&&!a(this,Ns).has(t.id)&&a(this,Ns).setValue(t.id,t)}blur(){if(this.isShiftKeyDown=!1,a(this,_i)&&(m(this,_i,!1),A(this,F,Bl).call(this,"main_toolbar")),!this.hasSelection)return;const{activeElement:t}=document;for(const e of a(this,lt))if(e.div.contains(t)){m(this,dn,[e,t]),e._focusEventsAllowed=!1;break}}focus(){if(!a(this,dn))return;const[t,e]=a(this,dn);m(this,dn,null),e.addEventListener("focusin",()=>{t._focusEventsAllowed=!0},{once:!0,signal:this._signal}),e.focus()}addEditListeners(){A(this,F,bh).call(this),A(this,F,Ah).call(this)}removeEditListeners(){A(this,F,bf).call(this),A(this,F,vh).call(this)}dragOver(t){for(const{type:e}of t.dataTransfer.items)for(const s of a(this,ts))if(s.isHandlingMimeForPasting(e)){t.dataTransfer.dropEffect="copy",t.preventDefault();return}}drop(t){for(const e of t.dataTransfer.items)for(const s of a(this,ts))if(s.isHandlingMimeForPasting(e.type)){s.paste(e,this.currentLayer),t.preventDefault();return}}copy(t){var s;if(t.preventDefault(),(s=a(this,Re))==null||s.commitOrRemove(),!this.hasSelection)return;const e=[];for(const i of a(this,lt)){const n=i.serialize(!0);n&&e.push(n)}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 n of e.items)for(const r of a(this,ts))if(r.isHandlingMimeForPasting(n.type)){r.paste(n,this.currentLayer);return}let s=e.getData("application/pdfjs");if(!s)return;try{s=JSON.parse(s)}catch(n){tt(`paste: "${n.message}".`);return}if(!Array.isArray(s))return;this.unselectAll();const i=this.currentLayer;try{const n=[];for(const c of s){const h=await i.deserialize(c);if(!h)return;n.push(h)}const r=()=>{for(const c of n)A(this,F,yh).call(this,c);A(this,F,_h).call(this,n)},o=()=>{for(const c of n)c.remove()};this.addCommands({cmd:r,undo:o,mustExec:!0})}catch(n){tt(`paste: "${n.message}".`)}}keydown(t){!this.isShiftKeyDown&&t.key==="Shift"&&(this.isShiftKeyDown=!0),a(this,Xt)!==Q.NONE&&!this.isEditorHandlingKeyboard&&Sr._keyboardManager.exec(this,t)}keyup(t){this.isShiftKeyDown&&t.key==="Shift"&&(this.isShiftKeyDown=!1,a(this,_i)&&(m(this,_i,!1),A(this,F,Bl).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?(A(this,F,gf).call(this),A(this,F,Ah).call(this),A(this,F,fe).call(this,{isEditing:a(this,Xt)!==Q.NONE,isEmpty:A(this,F,Oa).call(this),hasSomethingToUndo:a(this,Je).hasSomethingToUndo(),hasSomethingToRedo:a(this,Je).hasSomethingToRedo(),hasSelectedEditor:!1})):(A(this,F,mf).call(this),A(this,F,vh).call(this),A(this,F,fe).call(this,{isEditing:!1}),this.disableUserSelect(!1))}registerEditorTypes(t){if(!a(this,ts)){m(this,ts,t);for(const e of a(this,ts))A(this,F,pi).call(this,e.defaultPropertiesToUpdate)}}getId(){return a(this,yc).id}get currentLayer(){return a(this,Qt).get(a(this,Fr))}getLayer(t){return a(this,Qt).get(t)}get currentPageIndex(){return a(this,Fr)}addLayer(t){a(this,Qt).set(t.pageIndex,t),a(this,wi)?t.enable():t.disable()}removeLayer(t){a(this,Qt).delete(t.pageIndex)}async updateMode(t,e=null,s=!1){if(a(this,Xt)!==t&&!(a(this,ze)&&(await a(this,ze).promise,!a(this,ze)))){if(m(this,ze,Promise.withResolvers()),m(this,Xt,t),t===Q.NONE){this.setEditingState(!1),A(this,F,yf).call(this),a(this,ze).resolve();return}this.setEditingState(!0),await A(this,F,vf).call(this),this.unselectAll();for(const i of a(this,Qt).values())i.updateMode(t);if(!e){s&&this.addNewEditorFromKeyboard(),a(this,ze).resolve();return}for(const i of a(this,Ht).values())i.annotationElementId===e?(this.setSelected(i),i.enterInEditMode()):i.unselect();a(this,ze).resolve()}}addNewEditorFromKeyboard(){this.currentLayer.canCreateNewEmptyEditor()&&this.currentLayer.addNewEditor()}updateToolbar(t){t!==a(this,Xt)&&this._eventBus.dispatch("switchannotationeditormode",{source:this,mode:t})}updateParams(t,e){var s;if(a(this,ts)){switch(t){case q.CREATE:this.currentLayer.addNewEditor();return;case q.HIGHLIGHT_DEFAULT_COLOR:(s=a(this,uo))==null||s.updateColor(e);break;case q.HIGHLIGHT_SHOW_ALL:this._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:{type:"highlight",action:"toggle_visibility"}}}),(a(this,po)||m(this,po,new Map)).set(t,e),this.showAllEditors("highlight",e);break}for(const i of a(this,lt))i.updateParams(t,e);for(const i of a(this,ts))i.updateDefaultParams(t,e)}}showAllEditors(t,e,s=!1){var n;for(const r of a(this,Ht).values())r.editorType===t&&r.show(e);(((n=a(this,po))==null?void 0:n.get(q.HIGHLIGHT_SHOW_ALL))??!0)!==e&&A(this,F,pi).call(this,[[q.HIGHLIGHT_SHOW_ALL,e]])}enableWaiting(t=!1){if(a(this,ho)!==t){m(this,ho,t);for(const e of a(this,Qt).values())t?e.disableClick():e.enableClick(),e.div.classList.toggle("waiting",t)}}getEditors(t){const e=[];for(const s of a(this,Ht).values())s.pageIndex===t&&e.push(s);return e}getEditor(t){return a(this,Ht).get(t)}addEditor(t){a(this,Ht).set(t.id,t)}removeEditor(t){var e;t.div.contains(document.activeElement)&&(a(this,ps)&&clearTimeout(a(this,ps)),m(this,ps,setTimeout(()=>{this.focusMainContainer(),m(this,ps,null)},0))),a(this,Ht).delete(t.id),this.unselect(t),(!t.annotationElementId||!a(this,cn).has(t.annotationElementId))&&((e=a(this,Ns))==null||e.remove(t.id))}addDeletedAnnotationElement(t){a(this,cn).add(t.annotationElementId),this.addChangedExistingAnnotation(t),t.deleted=!0}isDeletedAnnotationElement(t){return a(this,cn).has(t)}removeDeletedAnnotationElement(t){a(this,cn).delete(t.annotationElementId),this.removeChangedExistingAnnotation(t),t.deleted=!1}setActiveEditor(t){a(this,Re)!==t&&(m(this,Re,t),t&&A(this,F,pi).call(this,t.propertiesToUpdate))}updateUI(t){a(this,F,_f)===t&&A(this,F,pi).call(this,t.propertiesToUpdate)}toggleSelected(t){if(a(this,lt).has(t)){a(this,lt).delete(t),t.unselect(),A(this,F,fe).call(this,{hasSelectedEditor:this.hasSelection});return}a(this,lt).add(t),t.select(),A(this,F,pi).call(this,t.propertiesToUpdate),A(this,F,fe).call(this,{hasSelectedEditor:!0})}setSelected(t){for(const e of a(this,lt))e!==t&&e.unselect();a(this,lt).clear(),a(this,lt).add(t),t.select(),A(this,F,pi).call(this,t.propertiesToUpdate),A(this,F,fe).call(this,{hasSelectedEditor:!0})}isSelected(t){return a(this,lt).has(t)}get firstSelectedEditor(){return a(this,lt).values().next().value}unselect(t){t.unselect(),a(this,lt).delete(t),A(this,F,fe).call(this,{hasSelectedEditor:this.hasSelection})}get hasSelection(){return a(this,lt).size!==0}get isEnterHandled(){return a(this,lt).size===1&&this.firstSelectedEditor.isEnterHandled}undo(){a(this,Je).undo(),A(this,F,fe).call(this,{hasSomethingToUndo:a(this,Je).hasSomethingToUndo(),hasSomethingToRedo:!0,isEmpty:A(this,F,Oa).call(this)})}redo(){a(this,Je).redo(),A(this,F,fe).call(this,{hasSomethingToUndo:!0,hasSomethingToRedo:a(this,Je).hasSomethingToRedo(),isEmpty:A(this,F,Oa).call(this)})}addCommands(t){a(this,Je).add(t),A(this,F,fe).call(this,{hasSomethingToUndo:!0,hasSomethingToRedo:!1,isEmpty:A(this,F,Oa).call(this)})}delete(){if(this.commitOrRemove(),!this.hasSelection)return;const t=[...a(this,lt)],e=()=>{for(const i of t)i.remove()},s=()=>{for(const i of t)A(this,F,yh).call(this,i)};this.addCommands({cmd:e,undo:s,mustExec:!0})}commitOrRemove(){var t;(t=a(this,Re))==null||t.commitOrRemove()}hasSomethingToControl(){return a(this,Re)||this.hasSelection}selectAll(){for(const t of a(this,lt))t.commit();A(this,F,_h).call(this,a(this,Ht).values())}unselectAll(){if(!(a(this,Re)&&(a(this,Re).commitOrRemove(),a(this,Xt)!==Q.NONE))&&this.hasSelection){for(const t of a(this,lt))t.unselect();a(this,lt).clear(),A(this,F,fe).call(this,{hasSelectedEditor:!1})}}translateSelectedEditors(t,e,s=!1){if(s||this.commitOrRemove(),!this.hasSelection)return;a(this,Si)[0]+=t,a(this,Si)[1]+=e;const[i,n]=a(this,Si),r=[...a(this,lt)],o=1e3;a(this,ms)&&clearTimeout(a(this,ms)),m(this,ms,setTimeout(()=>{m(this,ms,null),a(this,Si)[0]=a(this,Si)[1]=0,this.addCommands({cmd:()=>{for(const c of r)a(this,Ht).has(c.id)&&c.translateInPage(i,n)},undo:()=>{for(const c of r)a(this,Ht).has(c.id)&&c.translateInPage(-i,-n)},mustExec:!1})},o));for(const c of r)c.translateInPage(t,e)}setUpDragSession(){if(this.hasSelection){this.disableUserSelect(!0),m(this,fs,new Map);for(const t of a(this,lt))a(this,fs).set(t,{savedX:t.x,savedY:t.y,savedPageIndex:t.pageIndex,newX:0,newY:0,newPageIndex:-1})}}endDragSession(){if(!a(this,fs))return!1;this.disableUserSelect(!1);const t=a(this,fs);m(this,fs,null);let e=!1;for(const[{x:i,y:n,pageIndex:r},o]of t)o.newX=i,o.newY=n,o.newPageIndex=r,e||(e=i!==o.savedX||n!==o.savedY||r!==o.savedPageIndex);if(!e)return!1;const s=(i,n,r,o)=>{if(a(this,Ht).has(i.id)){const c=a(this,Qt).get(o);c?i._setParentAndPosition(c,n,r):(i.pageIndex=o,i.x=n,i.y=r)}};return this.addCommands({cmd:()=>{for(const[i,{newX:n,newY:r,newPageIndex:o}]of t)s(i,n,r,o)},undo:()=>{for(const[i,{savedX:n,savedY:r,savedPageIndex:o}]of t)s(i,n,r,o)},mustExec:!0}),!0}dragSelectedEditors(t,e){if(a(this,fs))for(const s of a(this,fs).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())||a(this,lt).size===1&&this.firstSelectedEditor.shouldGetKeyboardEvents()}isActive(t){return a(this,Re)===t}getActive(){return a(this,Re)}getMode(){return a(this,Xt)}get imageManager(){return it(this,"imageManager",new ph)}getSelectionBoxes(t){if(!t)return null;const e=document.getSelection();for(let h=0,d=e.rangeCount;h<d;h++)if(!t.contains(e.getRangeAt(h).commonAncestorContainer))return null;const{x:s,y:i,width:n,height:r}=t.getBoundingClientRect();let o;switch(t.getAttribute("data-main-rotation")){case"90":o=(h,d,u,f)=>({x:(d-i)/r,y:1-(h+u-s)/n,width:f/r,height:u/n});break;case"180":o=(h,d,u,f)=>({x:1-(h+u-s)/n,y:1-(d+f-i)/r,width:u/n,height:f/r});break;case"270":o=(h,d,u,f)=>({x:1-(d+f-i)/r,y:(h-s)/n,width:f/r,height:u/n});break;default:o=(h,d,u,f)=>({x:(h-s)/n,y:(d-i)/r,width:u/n,height:f/r});break}const c=[];for(let h=0,d=e.rangeCount;h<d;h++){const u=e.getRangeAt(h);if(!u.collapsed)for(const{x:f,y:p,width:b,height:g}of u.getClientRects())b===0||g===0||c.push(o(f,p,b,g))}return c.length===0?null:c}addChangedExistingAnnotation({annotationElementId:t,id:e}){(a(this,Lr)||m(this,Lr,new Map)).set(t,e)}removeChangedExistingAnnotation({annotationElementId:t}){var e;(e=a(this,Lr))==null||e.delete(t)}renderAnnotationElement(t){var i;const e=(i=a(this,Lr))==null?void 0:i.get(t.data.id);if(!e)return;const s=a(this,Ns).getRawValue(e);s&&(a(this,Xt)===Q.NONE&&!s.hasBeenModified||s.renderAnnotationElement(t))}};Mr=new WeakMap,Re=new WeakMap,Ht=new WeakMap,Qt=new WeakMap,kr=new WeakMap,Ns=new WeakMap,Lr=new WeakMap,Je=new WeakMap,vi=new WeakMap,Fr=new WeakMap,cn=new WeakMap,fs=new WeakMap,ts=new WeakMap,hn=new WeakMap,oo=new WeakMap,lo=new WeakMap,Dr=new WeakMap,co=new WeakMap,ps=new WeakMap,yi=new WeakMap,Or=new WeakMap,_i=new WeakMap,gs=new WeakMap,yc=new WeakMap,wi=new WeakMap,ho=new WeakMap,Ei=new WeakMap,dn=new WeakMap,uo=new WeakMap,fo=new WeakMap,Xt=new WeakMap,lt=new WeakMap,Hs=new WeakMap,un=new WeakMap,po=new WeakMap,go=new WeakMap,Si=new WeakMap,ms=new WeakMap,Bs=new WeakMap,mo=new WeakMap,ze=new WeakMap,F=new WeakSet,Hl=function({anchorNode:t}){return t.nodeType===Node.TEXT_NODE?t.parentElement:t},mh=function(t){const{currentLayer:e}=this;if(e.hasTextLayer(t))return e;for(const s of a(this,Qt).values())if(s.hasTextLayer(t))return s;return null},uf=function(){const t=document.getSelection();if(!t||t.isCollapsed)return;const s=A(this,F,Hl).call(this,t).closest(".textLayer"),i=this.getSelectionBoxes(s);i&&(a(this,gs)||m(this,gs,new Em(this)),a(this,gs).show(s,i,this.direction==="ltr"))},ff=function(){var n,r,o;const t=document.getSelection();if(!t||t.isCollapsed){a(this,Hs)&&((n=a(this,gs))==null||n.hide(),m(this,Hs,null),A(this,F,fe).call(this,{hasSelectedText:!1}));return}const{anchorNode:e}=t;if(e===a(this,Hs))return;const i=A(this,F,Hl).call(this,t).closest(".textLayer");if(!i){a(this,Hs)&&((r=a(this,gs))==null||r.hide(),m(this,Hs,null),A(this,F,fe).call(this,{hasSelectedText:!1}));return}if((o=a(this,gs))==null||o.hide(),m(this,Hs,e),A(this,F,fe).call(this,{hasSelectedText:!0}),!(a(this,Xt)!==Q.HIGHLIGHT&&a(this,Xt)!==Q.NONE)&&(a(this,Xt)===Q.HIGHLIGHT&&this.showAllEditors("highlight",!0,!0),m(this,_i,this.isShiftKeyDown),!this.isShiftKeyDown)){const c=a(this,Xt)===Q.HIGHLIGHT?A(this,F,mh).call(this,i):null;c==null||c.toggleDrawing();const h=new AbortController,d=this.combinedSignal(h),u=f=>{f.type==="pointerup"&&f.button!==0||(h.abort(),c==null||c.toggleDrawing(!0),f.type==="pointerup"&&A(this,F,Bl).call(this,"main_toolbar"))};window.addEventListener("pointerup",u,{signal:d}),window.addEventListener("blur",u,{signal:d})}},Bl=function(t=""){a(this,Xt)===Q.HIGHLIGHT?this.highlightSelection(t):a(this,oo)&&A(this,F,uf).call(this)},pf=function(){document.addEventListener("selectionchange",A(this,F,ff).bind(this),{signal:this._signal})},gf=function(){if(a(this,yi))return;m(this,yi,new AbortController);const t=this.combinedSignal(a(this,yi));window.addEventListener("focus",this.focus.bind(this),{signal:t}),window.addEventListener("blur",this.blur.bind(this),{signal:t})},mf=function(){var t;(t=a(this,yi))==null||t.abort(),m(this,yi,null)},bh=function(){if(a(this,Ei))return;m(this,Ei,new AbortController);const t=this.combinedSignal(a(this,Ei));window.addEventListener("keydown",this.keydown.bind(this),{signal:t}),window.addEventListener("keyup",this.keyup.bind(this),{signal:t})},bf=function(){var t;(t=a(this,Ei))==null||t.abort(),m(this,Ei,null)},Ah=function(){if(a(this,vi))return;m(this,vi,new AbortController);const t=this.combinedSignal(a(this,vi));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})},vh=function(){var t;(t=a(this,vi))==null||t.abort(),m(this,vi,null)},Af=function(){const t=this._signal;document.addEventListener("dragover",this.dragOver.bind(this),{signal:t}),document.addEventListener("drop",this.drop.bind(this),{signal:t})},fe=function(t){Object.entries(t).some(([s,i])=>a(this,go)[s]!==i)&&(this._eventBus.dispatch("annotationeditorstateschanged",{source:this,details:Object.assign(a(this,go),t)}),a(this,Xt)===Q.HIGHLIGHT&&t.hasSelectedEditor===!1&&A(this,F,pi).call(this,[[q.HIGHLIGHT_FREE,!0]]))},pi=function(t){this._eventBus.dispatch("annotationeditorparamschanged",{source:this,details:t})},vf=async function(){if(!a(this,wi)){m(this,wi,!0);const t=[];for(const e of a(this,Qt).values())t.push(e.enable());await Promise.all(t);for(const e of a(this,Ht).values())e.enable()}},yf=function(){if(this.unselectAll(),a(this,wi)){m(this,wi,!1);for(const t of a(this,Qt).values())t.disable();for(const t of a(this,Ht).values())t.disable()}},yh=function(t){const e=a(this,Qt).get(t.pageIndex);e?e.addOrRebuild(t):(this.addEditor(t),this.addToAnnotationStorage(t))},_f=function(){let t=null;for(t of a(this,lt));return t},Oa=function(){if(a(this,Ht).size===0)return!0;if(a(this,Ht).size===1)for(const t of a(this,Ht).values())return t.isEmpty();return!1},_h=function(t){for(const e of a(this,lt))e.unselect();a(this,lt).clear();for(const e of t)e.isEmpty()||(a(this,lt).add(e),e.select());A(this,F,fe).call(this,{hasSelectedEditor:this.hasSelection})},X(Sr,"TRANSLATE_SMALL",1),X(Sr,"TRANSLATE_BIG",10);let ir=Sr;var qt,bs,es,Nr,As,Pe,Hr,vs,_e,js,fn,ys,xi,ds,Na,jl;const pe=class pe{constructor(t){v(this,ds);v(this,qt,null);v(this,bs,!1);v(this,es,null);v(this,Nr,null);v(this,As,null);v(this,Pe,null);v(this,Hr,!1);v(this,vs,null);v(this,_e,null);v(this,js,null);v(this,fn,null);v(this,ys,!1);m(this,_e,t),m(this,ys,t._uiManager.useNewAltTextFlow),a(pe,xi)||m(pe,xi,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){pe._l10n??(pe._l10n=t)}async render(){const t=m(this,es,document.createElement("button"));t.className="altText",t.tabIndex="0";const e=m(this,Nr,document.createElement("span"));t.append(e),a(this,ys)?(t.classList.add("new"),t.setAttribute("data-l10n-id",a(pe,xi).missing),e.setAttribute("data-l10n-id",a(pe,xi)["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=a(this,_e)._uiManager._signal;t.addEventListener("contextmenu",Ye,{signal:s}),t.addEventListener("pointerdown",n=>n.stopPropagation(),{signal:s});const i=n=>{n.preventDefault(),a(this,_e)._uiManager.editAltText(a(this,_e)),a(this,ys)&&a(this,_e)._reportTelemetry({action:"pdfjs.image.alt_text.image_status_label_clicked",data:{label:a(this,ds,Na)}})};return t.addEventListener("click",i,{capture:!0,signal:s}),t.addEventListener("keydown",n=>{n.target===t&&n.key==="Enter"&&(m(this,Hr,!0),i(n))},{signal:s}),await A(this,ds,jl).call(this),t}finish(){a(this,es)&&(a(this,es).focus({focusVisible:a(this,Hr)}),m(this,Hr,!1))}isEmpty(){return a(this,ys)?a(this,qt)===null:!a(this,qt)&&!a(this,bs)}hasData(){return a(this,ys)?a(this,qt)!==null||!!a(this,js):this.isEmpty()}get guessedText(){return a(this,js)}async setGuessedText(t){a(this,qt)===null&&(m(this,js,t),m(this,fn,await pe._l10n.get("pdfjs-editor-new-alt-text-generated-alt-text-with-disclaimer",{generatedAltText:t})),A(this,ds,jl).call(this))}toggleAltTextBadge(t=!1){var e;if(!a(this,ys)||a(this,qt)){(e=a(this,vs))==null||e.remove(),m(this,vs,null);return}if(!a(this,vs)){const s=m(this,vs,document.createElement("div"));s.className="noAltTextBadge",a(this,_e).div.append(s)}a(this,vs).classList.toggle("hidden",!t)}serialize(t){let e=a(this,qt);return!t&&a(this,js)===e&&(e=a(this,fn)),{altText:e,decorative:a(this,bs),guessedText:a(this,js),textWithDisclaimer:a(this,fn)}}get data(){return{altText:a(this,qt),decorative:a(this,bs)}}set data({altText:t,decorative:e,guessedText:s,textWithDisclaimer:i,cancel:n=!1}){s&&(m(this,js,s),m(this,fn,i)),!(a(this,qt)===t&&a(this,bs)===e)&&(n||(m(this,qt,t),m(this,bs,e)),A(this,ds,jl).call(this))}toggle(t=!1){a(this,es)&&(!t&&a(this,Pe)&&(clearTimeout(a(this,Pe)),m(this,Pe,null)),a(this,es).disabled=!t)}shown(){a(this,_e)._reportTelemetry({action:"pdfjs.image.alt_text.image_status_label_displayed",data:{label:a(this,ds,Na)}})}destroy(){var t,e;(t=a(this,es))==null||t.remove(),m(this,es,null),m(this,Nr,null),m(this,As,null),(e=a(this,vs))==null||e.remove(),m(this,vs,null)}};qt=new WeakMap,bs=new WeakMap,es=new WeakMap,Nr=new WeakMap,As=new WeakMap,Pe=new WeakMap,Hr=new WeakMap,vs=new WeakMap,_e=new WeakMap,js=new WeakMap,fn=new WeakMap,ys=new WeakMap,xi=new WeakMap,ds=new WeakSet,Na=function(){return a(this,qt)&&"added"||a(this,qt)===null&&this.guessedText&&"review"||"missing"},jl=async function(){var i,n,r;const t=a(this,es);if(!t)return;if(a(this,ys)){if(t.classList.toggle("done",!!a(this,qt)),t.setAttribute("data-l10n-id",a(pe,xi)[a(this,ds,Na)]),(i=a(this,Nr))==null||i.setAttribute("data-l10n-id",a(pe,xi)[`${a(this,ds,Na)}-label`]),!a(this,qt)){(n=a(this,As))==null||n.remove();return}}else{if(!a(this,qt)&&!a(this,bs)){t.classList.remove("done"),(r=a(this,As))==null||r.remove();return}t.classList.add("done"),t.setAttribute("data-l10n-id","pdfjs-editor-alt-text-edit-button")}let e=a(this,As);if(!e){m(this,As,e=document.createElement("span")),e.className="tooltip",e.setAttribute("role","tooltip"),e.id=`alt-text-tooltip-${a(this,_e).id}`;const o=100,c=a(this,_e)._uiManager._signal;c.addEventListener("abort",()=>{clearTimeout(a(this,Pe)),m(this,Pe,null)},{once:!0}),t.addEventListener("mouseenter",()=>{m(this,Pe,setTimeout(()=>{m(this,Pe,null),a(this,As).classList.add("show"),a(this,_e)._reportTelemetry({action:"alt_text_tooltip"})},o))},{signal:c}),t.addEventListener("mouseleave",()=>{var h;a(this,Pe)&&(clearTimeout(a(this,Pe)),m(this,Pe,null)),(h=a(this,As))==null||h.classList.remove("show")},{signal:c})}a(this,bs)?e.setAttribute("data-l10n-id","pdfjs-editor-alt-text-decorative-tooltip"):(e.removeAttribute("data-l10n-id"),e.textContent=a(this,qt)),e.parentNode||t.append(e);const s=a(this,_e).getImageForAltText();s==null||s.setAttribute("aria-describedby",e.id)},v(pe,xi,null),X(pe,"_l10n",null);let dc=pe;var pn,ss,_t,Br,gn,Jt,mn,Ci,bo,bn,Ti,Ao,An,zs,_s,jr,zr,$e,vo,_c,J,wh,yo,Eh,Sh,wf,Ef,xh,Ch,Th,Sf,Rh,xf,Cf,Tf,Ph,Ha;const at=class at{constructor(t){v(this,J);v(this,pn,null);v(this,ss,null);v(this,_t,null);v(this,Br,!1);v(this,gn,!1);v(this,Jt,null);v(this,mn,null);v(this,Ci,null);v(this,bo,"");v(this,bn,!1);v(this,Ti,null);v(this,Ao,!1);v(this,An,!1);v(this,zs,!1);v(this,_s,null);v(this,jr,0);v(this,zr,0);v(this,$e,null);X(this,"_editToolbar",null);X(this,"_initialOptions",Object.create(null));X(this,"_initialData",null);X(this,"_isVisible",!0);X(this,"_uiManager",null);X(this,"_focusEventsAllowed",!0);v(this,vo,!1);v(this,_c,at._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:n,pageY:r}}=this.parent.viewport;this.rotation=e,this.pageRotation=(360+e-this._uiManager.viewParameters.rotation)%360,this.pageDimensions=[s,i],this.pageTranslation=[n,r];const[o,c]=this.parentDimensions;this.x=t.x/o,this.y=t.y/c,this.isAttachedToDOM=!1,this.deleted=!1}static get _resizerKeyboardManager(){const t=at.prototype._resizeWithKeyboard,e=ir.TRANSLATE_SMALL,s=ir.TRANSLATE_BIG;return it(this,"_resizerKeyboardManager",new vl([[["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"],at.prototype._stopResizingWithKeyboard]]))}get editorType(){return Object.getPrototypeOf(this).constructor._type}static get _defaultLineColor(){return it(this,"_defaultLineColor",this._colorManager.getHexCode("CanvasText"))}static deleteAnnotationElement(t){const e=new Tm({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(at._l10n??(at._l10n=t),at._l10nResizer||(at._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"})),at._borderLineWidth!==-1)return;const s=getComputedStyle(document.documentElement);at._borderLineWidth=parseFloat(s.getPropertyValue("--outline-width"))||0}static updateDefaultParams(t,e){}static get defaultPropertiesToUpdate(){return[]}static isHandlingMimeForPasting(t){return!1}static paste(t,e){At("Not implemented")}get propertiesToUpdate(){return[]}get _isDraggable(){return a(this,vo)}set _isDraggable(t){var e;m(this,vo,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=a(this,_c)}setParent(t){t!==null?(this.pageIndex=t.pageIndex,this.pageDimensions=t.pageDimensions):A(this,J,Ha).call(this),this.parent=t}focusin(t){this._focusEventsAllowed&&(a(this,bn)?m(this,bn,!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[n,r]=this.parentDimensions;[s,i]=this.screenToPageTranslation(s,i),this.x=(t+s)/n,this.y=(e+i)/r,this.fixAndSetPosition()}translate(t,e){A(this,J,wh).call(this,this.parentDimensions,t,e)}translateInPage(t,e){a(this,Ti)||m(this,Ti,[this.x,this.y]),A(this,J,wh).call(this,this.pageDimensions,t,e),this.div.scrollIntoView({block:"nearest"})}drag(t,e){a(this,Ti)||m(this,Ti,[this.x,this.y]);const[s,i]=this.parentDimensions;if(this.x+=t/s,this.y+=e/i,this.parent&&(this.x<0||this.x>1||this.y<0||this.y>1)){const{x:h,y:d}=this.div.getBoundingClientRect();this.parent.findNewParent(this,h,d)&&(this.x-=Math.floor(this.x),this.y-=Math.floor(this.y))}let{x:n,y:r}=this;const[o,c]=this.getBaseTranslation();n+=o,r+=c,this.div.style.left=`${(100*n).toFixed(2)}%`,this.div.style.top=`${(100*r).toFixed(2)}%`,this.div.scrollIntoView({block:"nearest"})}get _hasBeenMoved(){return!!a(this,Ti)&&(a(this,Ti)[0]!==this.x||a(this,Ti)[1]!==this.y)}getBaseTranslation(){const[t,e]=this.parentDimensions,{_borderLineWidth:s}=at,i=s/t,n=s/e;switch(this.rotation){case 90:return[-i,n];case 180:return[i,n];case 270:return[i,-n];default:return[-i,-n]}}get _mustFixPosition(){return!0}fixAndSetPosition(t=this.rotation){const[e,s]=this.pageDimensions;let{x:i,y:n,width:r,height:o}=this;if(r*=e,o*=s,i*=e,n*=s,this._mustFixPosition)switch(t){case 0:i=Math.max(0,Math.min(e-r,i)),n=Math.max(0,Math.min(s-o,n));break;case 90:i=Math.max(0,Math.min(e-o,i)),n=Math.min(s,Math.max(r,n));break;case 180:i=Math.min(e,Math.max(r,i)),n=Math.min(s,Math.max(o,n));break;case 270:i=Math.min(e,Math.max(o,i)),n=Math.max(0,Math.min(s-r,n));break}this.x=i/=e,this.y=n/=s;const[c,h]=this.getBaseTranslation();i+=c,n+=h;const{style:d}=this.div;d.left=`${(100*i).toFixed(2)}%`,d.top=`${(100*n).toFixed(2)}%`,this.moveInDOM()}screenToPageTranslation(t,e){var s;return A(s=at,yo,Eh).call(s,t,e,this.parentRotation)}pageTranslationToScreen(t,e){var s;return A(s=at,yo,Eh).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;this.div.style.width=`${(100*t/s).toFixed(2)}%`,a(this,gn)||(this.div.style.height=`${(100*e/i).toFixed(2)}%`)}fixDims(){const{style:t}=this.div,{height:e,width:s}=t,i=s.endsWith("%"),n=!a(this,gn)&&e.endsWith("%");if(i&&n)return;const[r,o]=this.parentDimensions;i||(t.width=`${(100*parseFloat(s)/r).toFixed(2)}%`),!a(this,gn)&&!n&&(t.height=`${(100*parseFloat(e)/o).toFixed(2)}%`)}getInitialTranslation(){return[0,0]}altTextFinish(){var t;(t=a(this,_t))==null||t.finish()}async addEditToolbar(){return this._editToolbar||a(this,An)?this._editToolbar:(this._editToolbar=new uh(this),this.div.append(this._editToolbar.render()),a(this,_t)&&await this._editToolbar.addAltText(a(this,_t)),this._editToolbar)}removeEditToolbar(){var t;this._editToolbar&&(this._editToolbar.remove(),this._editToolbar=null,(t=a(this,_t))==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(){a(this,_t)||(dc.initialize(at._l10n),m(this,_t,new dc(this)),a(this,pn)&&(a(this,_t).data=a(this,pn),m(this,pn,null)),await this.addEditToolbar())}get altTextData(){var t;return(t=a(this,_t))==null?void 0:t.data}set altTextData(t){a(this,_t)&&(a(this,_t).data=t)}get guessedAltText(){var t;return(t=a(this,_t))==null?void 0:t.guessedText}async setGuessedAltText(t){var e;await((e=a(this,_t))==null?void 0:e.setGuessedText(t))}serializeAltText(t){var e;return(e=a(this,_t))==null?void 0:e.serialize(t)}hasAltText(){return!!a(this,_t)&&!a(this,_t).isEmpty()}hasAltTextData(){var t;return((t=a(this,_t))==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=a(this,Br)?-1:0,this._isVisible||this.div.classList.add("hidden"),this.setInForeground(),A(this,J,Rh).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),hc(this,this.div,["pointerdown"]),this.div}pointerdown(t){const{isMac:e}=me.platform;if(t.button!==0||t.ctrlKey&&e){t.preventDefault();return}if(m(this,bn,!0),this._isDraggable){A(this,J,Sf).call(this,t);return}A(this,J,Th).call(this,t)}get isSelected(){return this._uiManager.isSelected(this)}moveInDOM(){a(this,_s)&&clearTimeout(a(this,_s)),m(this,_s,setTimeout(()=>{var t;m(this,_s,null),(t=this.parent)==null||t.moveEditorInDOM(this)},0))}_setParentAndPosition(t,e,s){t.changeParent(this),this.x=e,this.y=s,this.fixAndSetPosition()}getRect(t,e,s=this.rotation){const i=this.parentScale,[n,r]=this.pageDimensions,[o,c]=this.pageTranslation,h=t/i,d=e/i,u=this.x*n,f=this.y*r,p=this.width*n,b=this.height*r;switch(s){case 0:return[u+h+o,r-f-d-b+c,u+h+p+o,r-f-d+c];case 90:return[u+d+o,r-f+h+c,u+d+b+o,r-f+h+p+c];case 180:return[u-h-p+o,r-f+d+c,u-h+o,r-f+d+b+c];case 270:return[u-d-b+o,r-f-h-p+c,u-d+o,r-f-h+c];default:throw new Error("Invalid rotation")}}getRectInCurrentCoords(t,e){const[s,i,n,r]=t,o=n-s,c=r-i;switch(this.rotation){case 0:return[s,e-r,o,c];case 90:return[s,e-i,c,o];case 180:return[n,e-i,o,c];case 270:return[n,e-r,c,o];default:throw new Error("Invalid rotation")}}onceAdded(){}isEmpty(){return!1}enableEditMode(){m(this,An,!0)}disableEditMode(){m(this,An,!1)}isInEditMode(){return a(this,An)}shouldGetKeyboardEvents(){return a(this,zs)}needsToBeRebuilt(){return this.div&&!this.isAttachedToDOM}rebuild(){A(this,J,Rh).call(this)}rotate(t){}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){At("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,m(i,pn,t.accessibilityData);const[n,r]=i.pageDimensions,[o,c,h,d]=i.getRectInCurrentCoords(t.rect,r);return i.x=o/n,i.y=c/r,i.width=h/n,i.height=d/r,i}get hasBeenModified(){return!!this.annotationElementId&&(this.deleted||this.serialize()!==null)}remove(){var t;if((t=a(this,Ci))==null||t.abort(),m(this,Ci,null),this.isEmpty()||this.commit(),this.parent?this.parent.remove(this):this._uiManager.removeEditor(this),a(this,_s)&&(clearTimeout(a(this,_s)),m(this,_s,null)),A(this,J,Ha).call(this),this.removeEditToolbar(),a(this,$e)){for(const e of a(this,$e).values())clearTimeout(e);m(this,$e,null)}this.parent=null}get isResizable(){return!1}makeResizable(){this.isResizable&&(A(this,J,wf).call(this),a(this,Jt).classList.remove("hidden"),hc(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),m(this,mn,{savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height});const e=a(this,Jt).children;if(!a(this,ss)){m(this,ss,Array.from(e));const r=A(this,J,xf).bind(this),o=A(this,J,Cf).bind(this),c=this._uiManager._signal;for(const h of a(this,ss)){const d=h.getAttribute("data-resizer-name");h.setAttribute("role","spinbutton"),h.addEventListener("keydown",r,{signal:c}),h.addEventListener("blur",o,{signal:c}),h.addEventListener("focus",A(this,J,Tf).bind(this,d),{signal:c}),h.setAttribute("data-l10n-id",at._l10nResizer[d])}}const s=a(this,ss)[0];let i=0;for(const r of e){if(r===s)break;i++}const n=(360-this.rotation+this.parentRotation)%360/90*(a(this,ss).length/4);if(n!==i){if(n<i)for(let o=0;o<i-n;o++)a(this,Jt).append(a(this,Jt).firstChild);else if(n>i)for(let o=0;o<n-i;o++)a(this,Jt).firstChild.before(a(this,Jt).lastChild);let r=0;for(const o of e){const h=a(this,ss)[r++].getAttribute("data-resizer-name");o.setAttribute("data-l10n-id",at._l10nResizer[h])}}A(this,J,Ph).call(this,0),m(this,zs,!0),a(this,Jt).firstChild.focus({focusVisible:!0}),t.preventDefault(),t.stopImmediatePropagation()}_resizeWithKeyboard(t,e){a(this,zs)&&A(this,J,Ch).call(this,a(this,bo),{movementX:t,movementY:e})}_stopResizingWithKeyboard(){A(this,J,Ha).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,n;(i=this.div)!=null&&i.classList.contains("selectedEditor")&&((n=this._editToolbar)==null||n.show())});return}(e=this._editToolbar)==null||e.show(),(s=a(this,_t))==null||s.toggleAltTextBadge(!1)}unselect(){var t,e,s,i,n;(t=a(this,Jt))==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(),(n=a(this,_t))==null||n.toggleAltTextBadge(!0)}updateParams(t,e){}disableEditing(){}enableEditing(){}enterInEditMode(){}getImageForAltText(){return null}get contentDiv(){return this.div}get isEditing(){return a(this,Ao)}set isEditing(t){m(this,Ao,t),this.parent&&(t?(this.parent.setSelected(this),this.parent.setActiveEditor(this)):this.parent.setActiveEditor(null))}setAspectRatio(t,e){m(this,gn,!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){a(this,$e)||m(this,$e,new Map);const{action:s}=t;let i=a(this,$e).get(s);i&&clearTimeout(i),i=setTimeout(()=>{this._reportTelemetry(t),a(this,$e).delete(s),a(this,$e).size===0&&m(this,$e,null)},at._telemetryTimeout),a(this,$e).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),m(this,Br,!1)}disable(){this.div&&(this.div.tabIndex=-1),m(this,Br,!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()}};pn=new WeakMap,ss=new WeakMap,_t=new WeakMap,Br=new WeakMap,gn=new WeakMap,Jt=new WeakMap,mn=new WeakMap,Ci=new WeakMap,bo=new WeakMap,bn=new WeakMap,Ti=new WeakMap,Ao=new WeakMap,An=new WeakMap,zs=new WeakMap,_s=new WeakMap,jr=new WeakMap,zr=new WeakMap,$e=new WeakMap,vo=new WeakMap,_c=new WeakMap,J=new WeakSet,wh=function([t,e],s,i){[s,i]=this.screenToPageTranslation(s,i),this.x+=s/t,this.y+=i/e,this.fixAndSetPosition()},yo=new WeakSet,Eh=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]}},Sh=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]}},wf=function(){if(a(this,Jt))return;m(this,Jt,document.createElement("div")),a(this,Jt).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");a(this,Jt).append(i),i.classList.add("resizer",s),i.setAttribute("data-resizer-name",s),i.addEventListener("pointerdown",A(this,J,Ef).bind(this,s),{signal:e}),i.addEventListener("contextmenu",Ye,{signal:e}),i.tabIndex=-1}this.div.prepend(a(this,Jt))},Ef=function(t,e){var b;e.preventDefault();const{isMac:s}=me.platform;if(e.button!==0||e.ctrlKey&&s)return;(b=a(this,_t))==null||b.toggle(!1);const i=this._isDraggable;this._isDraggable=!1;const n=new AbortController,r=this._uiManager.combinedSignal(n);this.parent.togglePointerEvents(!1),window.addEventListener("pointermove",A(this,J,Ch).bind(this,t),{passive:!0,capture:!0,signal:r}),window.addEventListener("contextmenu",Ye,{signal:r});const o=this.x,c=this.y,h=this.width,d=this.height,u=this.parent.div.style.cursor,f=this.div.style.cursor;this.div.style.cursor=this.parent.div.style.cursor=window.getComputedStyle(e.target).cursor;const p=()=>{var g;n.abort(),this.parent.togglePointerEvents(!0),(g=a(this,_t))==null||g.toggle(!0),this._isDraggable=i,this.parent.div.style.cursor=u,this.div.style.cursor=f,A(this,J,xh).call(this,o,c,h,d)};window.addEventListener("pointerup",p,{signal:r}),window.addEventListener("blur",p,{signal:r})},xh=function(t,e,s,i){const n=this.x,r=this.y,o=this.width,c=this.height;n===t&&r===e&&o===s&&c===i||this.addCommands({cmd:()=>{this.width=o,this.height=c,this.x=n,this.y=r;const[h,d]=this.parentDimensions;this.setDims(h*o,d*c),this.fixAndSetPosition()},undo:()=>{this.width=s,this.height=i,this.x=t,this.y=e;const[h,d]=this.parentDimensions;this.setDims(h*s,d*i),this.fixAndSetPosition()},mustExec:!0})},Ch=function(t,e){const[s,i]=this.parentDimensions,n=this.x,r=this.y,o=this.width,c=this.height,h=at.MIN_SIZE/s,d=at.MIN_SIZE/i,u=N=>Math.round(N*1e4)/1e4,f=A(this,J,Sh).call(this,this.rotation),p=(N,z)=>[f[0]*N+f[2]*z,f[1]*N+f[3]*z],b=A(this,J,Sh).call(this,360-this.rotation),g=(N,z)=>[b[0]*N+b[2]*z,b[1]*N+b[3]*z];let _,y,w=!1,E=!1;switch(t){case"topLeft":w=!0,_=(N,z)=>[0,0],y=(N,z)=>[N,z];break;case"topMiddle":_=(N,z)=>[N/2,0],y=(N,z)=>[N/2,z];break;case"topRight":w=!0,_=(N,z)=>[N,0],y=(N,z)=>[0,z];break;case"middleRight":E=!0,_=(N,z)=>[N,z/2],y=(N,z)=>[0,z/2];break;case"bottomRight":w=!0,_=(N,z)=>[N,z],y=(N,z)=>[0,0];break;case"bottomMiddle":_=(N,z)=>[N/2,z],y=(N,z)=>[N/2,0];break;case"bottomLeft":w=!0,_=(N,z)=>[0,z],y=(N,z)=>[N,0];break;case"middleLeft":E=!0,_=(N,z)=>[0,z/2],y=(N,z)=>[N,z/2];break}const x=_(o,c),S=y(o,c);let C=p(...S);const T=u(n+C[0]),R=u(r+C[1]);let I=1,D=1,[M,L]=this.screenToPageTranslation(e.movementX,e.movementY);if([M,L]=g(M/s,L/i),w){const N=Math.hypot(o,c);I=D=Math.max(Math.min(Math.hypot(S[0]-x[0]-M,S[1]-x[1]-L)/N,1/o,1/c),h/o,d/c)}else E?I=Math.max(h,Math.min(1,Math.abs(S[0]-x[0]-M)))/o:D=Math.max(d,Math.min(1,Math.abs(S[1]-x[1]-L)))/c;const j=u(o*I),O=u(c*D);C=p(...y(j,O));const U=T-C[0],G=R-C[1];this.width=j,this.height=O,this.x=U,this.y=G,this.setDims(s*j,i*O),this.fixAndSetPosition()},Th=function(t){const{isMac:e}=me.platform;t.ctrlKey&&!e||t.shiftKey||t.metaKey&&e?this.parent.toggleSelected(this):this.parent.setSelected(this)},Sf=function(t){const{isSelected:e}=this;this._uiManager.setUpDragSession();const s=new AbortController,i=this._uiManager.combinedSignal(s);if(e){this.div.classList.add("moving"),m(this,jr,t.clientX),m(this,zr,t.clientY);const r=o=>{const{clientX:c,clientY:h}=o,[d,u]=this.screenToPageTranslation(c-a(this,jr),h-a(this,zr));m(this,jr,c),m(this,zr,h),this._uiManager.dragSelectedEditors(d,u)};window.addEventListener("pointermove",r,{passive:!0,capture:!0,signal:i})}const n=()=>{s.abort(),e&&this.div.classList.remove("moving"),m(this,bn,!1),this._uiManager.endDragSession()||A(this,J,Th).call(this,t)};window.addEventListener("pointerup",n,{signal:i}),window.addEventListener("blur",n,{signal:i})},Rh=function(){if(a(this,Ci)||!this.div)return;m(this,Ci,new AbortController);const t=this._uiManager.combinedSignal(a(this,Ci));this.div.addEventListener("focusin",this.focusin.bind(this),{signal:t}),this.div.addEventListener("focusout",this.focusout.bind(this),{signal:t})},xf=function(t){at._resizerKeyboardManager.exec(this,t)},Cf=function(t){var e;a(this,zs)&&((e=t.relatedTarget)==null?void 0:e.parentNode)!==a(this,Jt)&&A(this,J,Ha).call(this)},Tf=function(t){m(this,bo,a(this,zs)?t:"")},Ph=function(t){if(a(this,ss))for(const e of a(this,ss))e.tabIndex=t},Ha=function(){if(m(this,zs,!1),A(this,J,Ph).call(this,-1),a(this,mn)){const{savedX:t,savedY:e,savedWidth:s,savedHeight:i}=a(this,mn);A(this,J,xh).call(this,t,e,s,i),m(this,mn,null)}},v(at,yo),X(at,"_l10n",null),X(at,"_l10nResizer",null),X(at,"_borderLineWidth",-1),X(at,"_colorManager",new gh),X(at,"_zIndex",1),X(at,"_telemetryTimeout",1e3);let ht=at;class Tm extends ht{constructor(t){super(t),this.annotationElementId=t.annotationElementId,this.deleted=!0}serialize(){return this.serializeDeleted()}}const cu=3285377520,je=4294901760,us=65535;class Rf{constructor(t){this.h1=t?t&4294967295:cu,this.h2=t?t&4294967295:cu}update(t){let e,s;if(typeof t=="string"){e=new Uint8Array(t.length*2),s=0;for(let g=0,_=t.length;g<_;g++){const y=t.charCodeAt(g);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,n=s-i*4,r=new Uint32Array(e.buffer,0,i);let o=0,c=0,h=this.h1,d=this.h2;const u=3432918353,f=461845907,p=u&us,b=f&us;for(let g=0;g<i;g++)g&1?(o=r[g],o=o*u&je|o*p&us,o=o<<15|o>>>17,o=o*f&je|o*b&us,h^=o,h=h<<13|h>>>19,h=h*5+3864292196):(c=r[g],c=c*u&je|c*p&us,c=c<<15|c>>>17,c=c*f&je|c*b&us,d^=c,d=d<<13|d>>>19,d=d*5+3864292196);switch(o=0,n){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&je|o*p&us,o=o<<15|o>>>17,o=o*f&je|o*b&us,i&1?h^=o:d^=o}this.h1=h,this.h2=d}hexdigest(){let t=this.h1,e=this.h2;return t^=e>>>1,t=t*3981806797&je|t*36045&us,e=e*4283543511&je|((e<<16|t>>>16)*2950163797&je)>>>16,t^=e>>>1,t=t*444984403&je|t*60499&us,e=e*3301882366&je|((e<<16|t>>>16)*3120437893&je)>>>16,t^=e>>>1,(t>>>0).toString(16).padStart(8,"0")+(e>>>0).toString(16).padStart(8,"0")}}const Ih=Object.freeze({map:null,hash:"",transfer:void 0});var vn,yn,Yt,wc,Pf;class jd{constructor(){v(this,wc);v(this,vn,!1);v(this,yn,null);v(this,Yt,new Map);this.onSetModified=null,this.onResetModified=null,this.onAnnotationEditor=null}getValue(t,e){const s=a(this,Yt).get(t);return s===void 0?e:Object.assign(e,s)}getRawValue(t){return a(this,Yt).get(t)}remove(t){if(a(this,Yt).delete(t),a(this,Yt).size===0&&this.resetModified(),typeof this.onAnnotationEditor=="function"){for(const e of a(this,Yt).values())if(e instanceof ht)return;this.onAnnotationEditor(null)}}setValue(t,e){const s=a(this,Yt).get(t);let i=!1;if(s!==void 0)for(const[n,r]of Object.entries(e))s[n]!==r&&(i=!0,s[n]=r);else i=!0,a(this,Yt).set(t,e);i&&A(this,wc,Pf).call(this),e instanceof ht&&typeof this.onAnnotationEditor=="function"&&this.onAnnotationEditor(e.constructor._type)}has(t){return a(this,Yt).has(t)}getAll(){return a(this,Yt).size>0?Fd(a(this,Yt)):null}setAll(t){for(const[e,s]of Object.entries(t))this.setValue(e,s)}get size(){return a(this,Yt).size}resetModified(){a(this,vn)&&(m(this,vn,!1),typeof this.onResetModified=="function"&&this.onResetModified())}get print(){return new If(this)}get serializable(){if(a(this,Yt).size===0)return Ih;const t=new Map,e=new Rf,s=[],i=Object.create(null);let n=!1;for(const[r,o]of a(this,Yt)){const c=o instanceof ht?o.serialize(!1,i):o;c&&(t.set(r,c),e.update(`${r}:${JSON.stringify(c)}`),n||(n=!!c.bitmap))}if(n)for(const r of t.values())r.bitmap&&s.push(r.bitmap);return t.size>0?{map:t,hash:e.hexdigest(),transfer:s}:Ih}get editorStats(){let t=null;const e=new Map;for(const s of a(this,Yt).values()){if(!(s instanceof ht))continue;const i=s.telemetryFinalData;if(!i)continue;const{type:n}=i;e.has(n)||e.set(n,Object.getPrototypeOf(s).constructor),t||(t=Object.create(null));const r=t[n]||(t[n]=new Map);for(const[o,c]of Object.entries(i)){if(o==="type")continue;let h=r.get(o);h||(h=new Map,r.set(o,h));const d=h.get(c)??0;h.set(c,d+1)}}for(const[s,i]of e)t[s]=i.computeTelemetryFinalData(t[s]);return t}resetModifiedIds(){m(this,yn,null)}get modifiedIds(){if(a(this,yn))return a(this,yn);const t=[];for(const e of a(this,Yt).values())!(e instanceof ht)||!e.annotationElementId||!e.serialize()||t.push(e.annotationElementId);return m(this,yn,{ids:new Set(t),hash:t.join(",")})}}vn=new WeakMap,yn=new WeakMap,Yt=new WeakMap,wc=new WeakSet,Pf=function(){a(this,vn)||(m(this,vn,!0),typeof this.onSetModified=="function"&&this.onSetModified())};var _o;class If extends jd{constructor(e){super();v(this,_o);const{map:s,hash:i,transfer:n}=e.serializable,r=structuredClone(s,n?{transfer:n}:null);m(this,_o,{map:r,hash:i,transfer:n})}get print(){At("Should not call PrintAnnotationStorage.print")}get serializable(){return a(this,_o)}get modifiedIds(){return it(this,"modifiedIds",{ids:new Set,hash:""})}}_o=new WeakMap;var $r;class Rm{constructor({ownerDocument:t=globalThis.document,styleElement:e=null}){v(this,$r,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(),a(this,$r).clear(),this.styleElement&&(this.styleElement.remove(),this.styleElement=null)}async loadSystemFont({systemFontInfo:t,_inspectFont:e}){if(!(!t||a(this,$r).has(t.loadedName))){if(zt(!this.disableFontFace,"loadSystemFont shouldn't be called when `disableFontFace` is set."),this.isFontLoadingAPISupported){const{loadedName:s,src:i,style:n}=t,r=new FontFace(s,i,n);this.addNativeFontFace(r);try{await r.load(),a(this,$r).add(s),e==null||e(t)}catch{tt(`Cannot load system font: ${t.baseFontName}, installing it could help to improve PDF rendering.`),this.removeNativeFontFace(r)}return}At("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 tt(`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 it(this,"isFontLoadingAPISupported",t)}get isSyncFontLoadingSupported(){let t=!1;return(de||typeof navigator<"u"&&typeof(navigator==null?void 0:navigator.userAgent)=="string"&&/Mozilla\/5.0.*?rv:\d+.*? Gecko/.test(navigator.userAgent))&&(t=!0),it(this,"isSyncFontLoadingSupported",t)}_queueLoadingCallback(t){function e(){for(zt(!i.done,"completeRequest() cannot be called twice."),i.done=!0;s.length>0&&s[0].done;){const n=s.shift();setTimeout(n.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 it(this,"_loadTestFont",t)}_prepareFontLoadEvent(t,e){function s(x,S){return x.charCodeAt(S)<<24|x.charCodeAt(S+1)<<16|x.charCodeAt(S+2)<<8|x.charCodeAt(S+3)&255}function i(x,S,C,T){const R=x.substring(0,S),I=x.substring(S+C);return R+T+I}let n,r;const o=this._document.createElement("canvas");o.width=1,o.height=1;const c=o.getContext("2d");let h=0;function d(x,S){if(++h>30){tt("Load test font never loaded."),S();return}if(c.font="30px "+x,c.fillText(".",0,20),c.getImageData(0,0,1,1).data[3]>0){S();return}setTimeout(d.bind(null,x,S))}const u=`lt${Date.now()}${this.loadTestFontId++}`;let f=this._loadTestFont;f=i(f,976,u.length,u);const b=16,g=1482184792;let _=s(f,b);for(n=0,r=u.length-3;n<r;n+=4)_=_-g+s(u,n)|0;n<u.length&&(_=_-g+s(u+"XXX",n)|0),f=i(f,b,4,um(_));const y=`url(data:font/opentype;base64,${btoa(f)});`,w=`@font-face {font-family:"${u}";src:${y}}`;this.insertRule(w);const E=this._document.createElement("div");E.style.visibility="hidden",E.style.width=E.style.height="10px",E.style.position="absolute",E.style.top=E.style.left="0px";for(const x of[t.loadedName,u]){const S=this._document.createElement("span");S.textContent="Hi",S.style.fontFamily=x,E.append(S)}this._document.body.append(E),d(u,()=>{E.remove(),e.complete()})}}$r=new WeakMap;class Pm{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(n){tt(`getPathGenerator - ignoring character: "${n}".`)}if(!Array.isArray(s)||s.length===0)return this.compiledGlyphs[e]=function(n,r){};const i=[];for(let n=0,r=s.length;n<r;)switch(s[n++]){case ks.BEZIER_CURVE_TO:{const[o,c,h,d,u,f]=s.slice(n,n+6);i.push(p=>p.bezierCurveTo(o,c,h,d,u,f)),n+=6}break;case ks.MOVE_TO:{const[o,c]=s.slice(n,n+2);i.push(h=>h.moveTo(o,c)),n+=2}break;case ks.LINE_TO:{const[o,c]=s.slice(n,n+2);i.push(h=>h.lineTo(o,c)),n+=2}break;case ks.QUADRATIC_CURVE_TO:{const[o,c,h,d]=s.slice(n,n+4);i.push(u=>u.quadraticCurveTo(o,c,h,d)),n+=4}break;case ks.RESTORE:i.push(o=>o.restore());break;case ks.SAVE:i.push(o=>o.save());break;case ks.SCALE:zt(i.length===2,"Scale command is only valid at the third position.");break;case ks.TRANSFORM:{const[o,c,h,d,u,f]=s.slice(n,n+6);i.push(p=>p.transform(o,c,h,d,u,f)),n+=6}break;case ks.TRANSLATE:{const[o,c]=s.slice(n,n+2);i.push(h=>h.translate(o,c)),n+=2}break}return this.compiledGlyphs[e]=function(r,o){i[0](r),i[1](r),r.scale(o,-o);for(let c=2,h=i.length;c<h;c++)i[c](r)}}}var wo;class Mf{constructor({enableHWA:t=!1}){v(this,wo,!1);m(this,wo,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:!a(this,wo)})}}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){At("Abstract method `_createCanvas` called.")}}wo=new WeakMap;class Im extends Mf{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 kf{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){At("Abstract method `_fetch` called.")}}class Lf extends kf{async _fetch(t){const e=await Hc(t,this.isCompressed?"arraybuffer":"text");return e instanceof ArrayBuffer?new Uint8Array(e):Nc(e)}}class Ff{addFilter(t){return"none"}addHCMFilter(t,e){return"none"}addAlphaFilter(t){return"none"}addLuminosityFilter(t){return"none"}addHighlightHCMFilter(t,e,s,i,n){return"none"}destroy(t=!1){}}var _n,wn,ws,$s,oe,Ec,En,H,re,gr,mr,zl,br,Df,Mh,Ar,Ba,ja,kh,za;class Mm extends Ff{constructor({docId:e,ownerDocument:s=globalThis.document}){super();v(this,H);v(this,_n);v(this,wn);v(this,ws);v(this,$s);v(this,oe);v(this,Ec);v(this,En,0);m(this,$s,e),m(this,oe,s)}addFilter(e){if(!e)return"none";let s=a(this,H,re).get(e);if(s)return s;const[i,n,r]=A(this,H,zl).call(this,e),o=e.length===1?i:`${i}${n}${r}`;if(s=a(this,H,re).get(o),s)return a(this,H,re).set(e,s),s;const c=`g_${a(this,$s)}_transfer_map_${ue(this,En)._++}`,h=A(this,H,br).call(this,c);a(this,H,re).set(e,h),a(this,H,re).set(o,h);const d=A(this,H,Ar).call(this,c);return A(this,H,ja).call(this,i,n,r,d),h}addHCMFilter(e,s){var b;const i=`${e}-${s}`,n="base";let r=a(this,H,gr).get(n);if((r==null?void 0:r.key)===i||(r?((b=r.filter)==null||b.remove(),r.key=i,r.url="none",r.filter=null):(r={key:i,url:"none",filter:null},a(this,H,gr).set(n,r)),!e||!s))return r.url;const o=A(this,H,za).call(this,e);e=$.makeHexColor(...o);const c=A(this,H,za).call(this,s);if(s=$.makeHexColor(...c),a(this,H,mr).style.color="",e==="#000000"&&s==="#ffffff"||e===s)return r.url;const h=new Array(256);for(let g=0;g<=255;g++){const _=g/255;h[g]=_<=.03928?_/12.92:((_+.055)/1.055)**2.4}const d=h.join(","),u=`g_${a(this,$s)}_hcm_filter`,f=r.filter=A(this,H,Ar).call(this,u);A(this,H,ja).call(this,d,d,d,f),A(this,H,Mh).call(this,f);const p=(g,_)=>{const y=o[g]/255,w=c[g]/255,E=new Array(_+1);for(let x=0;x<=_;x++)E[x]=y+x/_*(w-y);return E.join(",")};return A(this,H,ja).call(this,p(0,5),p(1,5),p(2,5),f),r.url=A(this,H,br).call(this,u),r.url}addAlphaFilter(e){let s=a(this,H,re).get(e);if(s)return s;const[i]=A(this,H,zl).call(this,[e]),n=`alpha_${i}`;if(s=a(this,H,re).get(n),s)return a(this,H,re).set(e,s),s;const r=`g_${a(this,$s)}_alpha_map_${ue(this,En)._++}`,o=A(this,H,br).call(this,r);a(this,H,re).set(e,o),a(this,H,re).set(n,o);const c=A(this,H,Ar).call(this,r);return A(this,H,kh).call(this,i,c),o}addLuminosityFilter(e){let s=a(this,H,re).get(e||"luminosity");if(s)return s;let i,n;if(e?([i]=A(this,H,zl).call(this,[e]),n=`luminosity_${i}`):n="luminosity",s=a(this,H,re).get(n),s)return a(this,H,re).set(e,s),s;const r=`g_${a(this,$s)}_luminosity_map_${ue(this,En)._++}`,o=A(this,H,br).call(this,r);a(this,H,re).set(e,o),a(this,H,re).set(n,o);const c=A(this,H,Ar).call(this,r);return A(this,H,Df).call(this,c),e&&A(this,H,kh).call(this,i,c),o}addHighlightHCMFilter(e,s,i,n,r){var w;const o=`${s}-${i}-${n}-${r}`;let c=a(this,H,gr).get(e);if((c==null?void 0:c.key)===o||(c?((w=c.filter)==null||w.remove(),c.key=o,c.url="none",c.filter=null):(c={key:o,url:"none",filter:null},a(this,H,gr).set(e,c)),!s||!i))return c.url;const[h,d]=[s,i].map(A(this,H,za).bind(this));let u=Math.round(.2126*h[0]+.7152*h[1]+.0722*h[2]),f=Math.round(.2126*d[0]+.7152*d[1]+.0722*d[2]),[p,b]=[n,r].map(A(this,H,za).bind(this));f<u&&([u,f,p,b]=[f,u,b,p]),a(this,H,mr).style.color="";const g=(E,x,S)=>{const C=new Array(256),T=(f-u)/S,R=E/255,I=(x-E)/(255*S);let D=0;for(let M=0;M<=S;M++){const L=Math.round(u+M*T),j=R+M*I;for(let O=D;O<=L;O++)C[O]=j;D=L+1}for(let M=D;M<256;M++)C[M]=C[D-1];return C.join(",")},_=`g_${a(this,$s)}_hcm_${e}_filter`,y=c.filter=A(this,H,Ar).call(this,_);return A(this,H,Mh).call(this,y),A(this,H,ja).call(this,g(p[0],b[0],5),g(p[1],b[1],5),g(p[2],b[2],5),y),c.url=A(this,H,br).call(this,_),c.url}destroy(e=!1){e&&a(this,H,gr).size!==0||(a(this,ws)&&(a(this,ws).parentNode.parentNode.remove(),m(this,ws,null)),a(this,wn)&&(a(this,wn).clear(),m(this,wn,null)),m(this,En,0))}}_n=new WeakMap,wn=new WeakMap,ws=new WeakMap,$s=new WeakMap,oe=new WeakMap,Ec=new WeakMap,En=new WeakMap,H=new WeakSet,re=function(){return a(this,wn)||m(this,wn,new Map)},gr=function(){return a(this,Ec)||m(this,Ec,new Map)},mr=function(){if(!a(this,ws)){const e=a(this,oe).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=a(this,oe).createElementNS(Fs,"svg");i.setAttribute("width",0),i.setAttribute("height",0),m(this,ws,a(this,oe).createElementNS(Fs,"defs")),e.append(i),i.append(a(this,ws)),a(this,oe).body.append(e)}return a(this,ws)},zl=function(e){if(e.length===1){const h=e[0],d=new Array(256);for(let f=0;f<256;f++)d[f]=h[f]/255;const u=d.join(",");return[u,u,u]}const[s,i,n]=e,r=new Array(256),o=new Array(256),c=new Array(256);for(let h=0;h<256;h++)r[h]=s[h]/255,o[h]=i[h]/255,c[h]=n[h]/255;return[r.join(","),o.join(","),c.join(",")]},br=function(e){if(a(this,_n)===void 0){m(this,_n,"");const s=a(this,oe).URL;s!==a(this,oe).baseURI&&(Bc(s)?tt('#createUrl: ignore "data:"-URL for performance reasons.'):m(this,_n,s.split("#",1)[0]))}return`url(${a(this,_n)}#${e})`},Df=function(e){const s=a(this,oe).createElementNS(Fs,"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)},Mh=function(e){const s=a(this,oe).createElementNS(Fs,"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)},Ar=function(e){const s=a(this,oe).createElementNS(Fs,"filter");return s.setAttribute("color-interpolation-filters","sRGB"),s.setAttribute("id",e),a(this,H,mr).append(s),s},Ba=function(e,s,i){const n=a(this,oe).createElementNS(Fs,s);n.setAttribute("type","discrete"),n.setAttribute("tableValues",i),e.append(n)},ja=function(e,s,i,n){const r=a(this,oe).createElementNS(Fs,"feComponentTransfer");n.append(r),A(this,H,Ba).call(this,r,"feFuncR",e),A(this,H,Ba).call(this,r,"feFuncG",s),A(this,H,Ba).call(this,r,"feFuncB",i)},kh=function(e,s){const i=a(this,oe).createElementNS(Fs,"feComponentTransfer");s.append(i),A(this,H,Ba).call(this,i,"feFuncA",e)},za=function(e){return a(this,H,mr).style.color=e,Bd(getComputedStyle(a(this,H,mr)).getPropertyValue("color"))};class Of{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){At("Abstract method `_fetch` called.")}}class Nf extends Of{async _fetch(t){const e=await Hc(t,"arraybuffer");return new Uint8Array(e)}}if(de){var Lh=Promise.withResolvers(),Qa=null;(async()=>{const t=await Cl(()=>import("./__vite-browser-external-BIHI7g3E.js"),[],import.meta.url),e=await Cl(()=>import("./__vite-browser-external-BIHI7g3E.js"),[],import.meta.url),s=await Cl(()=>import("./__vite-browser-external-BIHI7g3E.js"),[],import.meta.url),i=await Cl(()=>import("./__vite-browser-external-BIHI7g3E.js"),[],import.meta.url);let n,r;return new Map(Object.entries({fs:t,http:e,https:s,url:i,canvas:n,path2d:r}))})().then(t=>{Qa=t,Lh.resolve()},t=>{tt(`loadPackages: ${t}`),Qa=new Map,Lh.resolve()})}class Ui{static get promise(){return Lh.promise}static get(t){return Qa==null?void 0:Qa.get(t)}}async function Hf(l){const e=await Ui.get("fs").promises.readFile(l);return new Uint8Array(e)}class km extends Ff{}class Lm extends Mf{_createCanvas(t,e){return Ui.get("canvas").createCanvas(t,e)}}class Fm extends kf{async _fetch(t){return Hf(t)}}class Dm extends Of{async _fetch(t){return Hf(t)}}const ge={FILL:"Fill",STROKE:"Stroke",SHADING:"Shading"};function Fh(l,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),l.clip(i)}class zd{getPattern(){At("Abstract method `getPattern` called.")}}class Om extends zd{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 n;if(i===ge.STROKE||i===ge.FILL){const r=e.current.getClippedPathBoundingBox(i,Et(t))||[0,0,0,0],o=Math.ceil(r[2]-r[0])||1,c=Math.ceil(r[3]-r[1])||1,h=e.cachedCanvases.getCanvas("pattern",o,c),d=h.context;d.clearRect(0,0,d.canvas.width,d.canvas.height),d.beginPath(),d.rect(0,0,d.canvas.width,d.canvas.height),d.translate(-r[0],-r[1]),s=$.transform(s,[1,0,0,1,r[0],r[1]]),d.transform(...e.baseTransform),this.matrix&&d.transform(...this.matrix),Fh(d,this._bbox),d.fillStyle=this._createGradient(d),d.fill(),n=t.createPattern(h.canvas,"no-repeat");const u=new DOMMatrix(s);n.setTransform(u)}else Fh(t,this._bbox),n=this._createGradient(t);return n}}function Kc(l,t,e,s,i,n,r,o){const c=t.coords,h=t.colors,d=l.data,u=l.width*4;let f;c[e+1]>c[s+1]&&(f=e,e=s,s=f,f=n,n=r,r=f),c[s+1]>c[i+1]&&(f=s,s=i,i=f,f=r,r=o,o=f),c[e+1]>c[s+1]&&(f=e,e=s,s=f,f=n,n=r,r=f);const p=(c[e]+t.offsetX)*t.scaleX,b=(c[e+1]+t.offsetY)*t.scaleY,g=(c[s]+t.offsetX)*t.scaleX,_=(c[s+1]+t.offsetY)*t.scaleY,y=(c[i]+t.offsetX)*t.scaleX,w=(c[i+1]+t.offsetY)*t.scaleY;if(b>=w)return;const E=h[n],x=h[n+1],S=h[n+2],C=h[r],T=h[r+1],R=h[r+2],I=h[o],D=h[o+1],M=h[o+2],L=Math.round(b),j=Math.round(w);let O,U,G,N,z,It,Mt,Tt;for(let ot=L;ot<=j;ot++){if(ot<_){const V=ot<b?0:(b-ot)/(b-_);O=p-(p-g)*V,U=E-(E-C)*V,G=x-(x-T)*V,N=S-(S-R)*V}else{let V;ot>w?V=1:_===w?V=0:V=(_-ot)/(_-w),O=g-(g-y)*V,U=C-(C-I)*V,G=T-(T-D)*V,N=R-(R-M)*V}let nt;ot<b?nt=0:ot>w?nt=1:nt=(b-ot)/(b-w),z=p-(p-y)*nt,It=E-(E-I)*nt,Mt=x-(x-D)*nt,Tt=S-(S-M)*nt;const St=Math.round(Math.min(O,z)),se=Math.round(Math.max(O,z));let bt=u*ot+St*4;for(let V=St;V<=se;V++)nt=(O-V)/(O-z),nt<0?nt=0:nt>1&&(nt=1),d[bt++]=U-(U-It)*nt|0,d[bt++]=G-(G-Mt)*nt|0,d[bt++]=N-(N-Tt)*nt|0,d[bt++]=255}}function Nm(l,t,e){const s=t.coords,i=t.colors;let n,r;switch(t.type){case"lattice":const o=t.verticesPerRow,c=Math.floor(s.length/o)-1,h=o-1;for(n=0;n<c;n++){let d=n*o;for(let u=0;u<h;u++,d++)Kc(l,e,s[d],s[d+1],s[d+o],i[d],i[d+1],i[d+o]),Kc(l,e,s[d+o+1],s[d+1],s[d+o],i[d+o+1],i[d+1],i[d+o])}break;case"triangles":for(n=0,r=s.length;n<r;n+=3)Kc(l,e,s[n],s[n+1],s[n+2],i[n],i[n+1],i[n+2]);break;default:throw new Error("illegal figure")}}class Hm extends zd{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]),c=Math.floor(this._bounds[1]),h=Math.ceil(this._bounds[2])-o,d=Math.ceil(this._bounds[3])-c,u=Math.min(Math.ceil(Math.abs(h*t[0]*1.1)),3e3),f=Math.min(Math.ceil(Math.abs(d*t[1]*1.1)),3e3),p=h/u,b=d/f,g={coords:this._coords,colors:this._colors,offsetX:-o,offsetY:-c,scaleX:1/p,scaleY:1/b},_=u+4,y=f+4,w=s.getCanvas("mesh",_,y),E=w.context,x=E.createImageData(u,f);if(e){const C=x.data;for(let T=0,R=C.length;T<R;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)Nm(x,C,g);return E.putImageData(x,2,2),{canvas:w.canvas,offsetX:o-2*p,offsetY:c-2*b,scaleX:p,scaleY:b}}getPattern(t,e,s,i){Fh(t,this._bbox);let n;if(i===ge.SHADING)n=$.singularValueDecompose2dScale(Et(t));else if(n=$.singularValueDecompose2dScale(e.baseTransform),this.matrix){const o=$.singularValueDecompose2dScale(this.matrix);n=[n[0]*o[0],n[1]*o[1]]}const r=this._createMeshCanvas(n,i===ge.SHADING?null:this._background,e.cachedCanvases);return i!==ge.SHADING&&(t.setTransform(...e.baseTransform),this.matrix&&t.transform(...this.matrix)),t.translate(r.offsetX,r.offsetY),t.scale(r.scaleX,r.scaleY),t.createPattern(r.canvas,"no-repeat")}}class Bm extends zd{getPattern(){return"hotpink"}}function jm(l){switch(l[0]){case"RadialAxial":return new Om(l);case"Mesh":return new Hm(l);case"Dummy":return new Bm}throw new Error(`Unknown IR type: ${l[0]}`)}const hu={COLORED:1,UNCOLORED:2},Sc=class Sc{constructor(t,e,s,i,n){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=n}createPatternCanvas(t){const{bbox:e,operatorList:s,paintType:i,tilingType:n,color:r,canvasGraphicsFactory:o}=this;let{xstep:c,ystep:h}=this;c=Math.abs(c),h=Math.abs(h),Dc("TilingType: "+n);const d=e[0],u=e[1],f=e[2],p=e[3],b=f-d,g=p-u,_=$.singularValueDecompose2dScale(this.matrix),y=$.singularValueDecompose2dScale(this.baseTransform),w=_[0]*y[0],E=_[1]*y[1];let x=b,S=g,C=!1,T=!1;const R=Math.ceil(c*w),I=Math.ceil(h*E),D=Math.ceil(b*w),M=Math.ceil(g*E);R>=D?x=c:C=!0,I>=M?S=h:T=!0;const L=this.getSizeAndScale(x,this.ctx.canvas.width,w),j=this.getSizeAndScale(S,this.ctx.canvas.height,E),O=t.cachedCanvases.getCanvas("pattern",L.size,j.size),U=O.context,G=o.createCanvasGraphics(U);if(G.groupLevel=t.groupLevel,this.setFillAndStrokeStyleToContext(G,i,r),U.translate(-L.scale*d,-j.scale*u),G.transform(L.scale,0,0,j.scale,0,0),U.save(),this.clipBbox(G,d,u,f,p),G.baseTransform=Et(G.ctx),G.executeOperatorList(s),G.endDrawing(),U.restore(),C||T){const N=O.canvas;C&&(x=c),T&&(S=h);const z=this.getSizeAndScale(x,this.ctx.canvas.width,w),It=this.getSizeAndScale(S,this.ctx.canvas.height,E),Mt=z.size,Tt=It.size,ot=t.cachedCanvases.getCanvas("pattern-workaround",Mt,Tt),nt=ot.context,St=C?Math.floor(b/c):0,se=T?Math.floor(g/h):0;for(let bt=0;bt<=St;bt++)for(let V=0;V<=se;V++)nt.drawImage(N,Mt*bt,Tt*V,Mt,Tt,0,0,Mt,Tt);return{canvas:ot.canvas,scaleX:z.scale,scaleY:It.scale,offsetX:d,offsetY:u}}return{canvas:O.canvas,scaleX:L.scale,scaleY:j.scale,offsetX:d,offsetY:u}}getSizeAndScale(t,e,s){const i=Math.max(Sc.MAX_PATTERN_SIZE,e);let n=Math.ceil(t*s);return n>=i?n=i:s=n/t,{scale:s,size:n}}clipBbox(t,e,s,i,n){const r=i-e,o=n-s;t.ctx.rect(e,s,r,o),t.current.updateRectMinMax(Et(t.ctx),[e,s,i,n]),t.clip(),t.endPath()}setFillAndStrokeStyleToContext(t,e,s){const i=t.ctx,n=t.current;switch(e){case hu.COLORED:const r=this.ctx;i.fillStyle=r.fillStyle,i.strokeStyle=r.strokeStyle,n.fillColor=r.fillStyle,n.strokeColor=r.strokeStyle;break;case hu.UNCOLORED:const o=$.makeHexColor(s[0],s[1],s[2]);i.fillStyle=o,i.strokeStyle=o,n.fillColor=o,n.strokeColor=o;break;default:throw new dm(`Unsupported paint type: ${e}`)}}getPattern(t,e,s,i){let n=s;i!==ge.SHADING&&(n=$.transform(n,e.baseTransform),this.matrix&&(n=$.transform(n,this.matrix)));const r=this.createPatternCanvas(e);let o=new DOMMatrix(n);o=o.translate(r.offsetX,r.offsetY),o=o.scale(1/r.scaleX,1/r.scaleY);const c=t.createPattern(r.canvas,"repeat");return c.setTransform(o),c}};X(Sc,"MAX_PATTERN_SIZE",3e3);let Dh=Sc;function zm({src:l,srcPos:t=0,dest:e,width:s,height:i,nonBlackColor:n=4294967295,inverseDecode:r=!1}){const o=me.isLittleEndian?4278190080:255,[c,h]=r?[n,o]:[o,n],d=s>>3,u=s&7,f=l.length;e=new Uint32Array(e.buffer);let p=0;for(let b=0;b<i;b++){for(const _=t+d;t<_;t++){const y=t<f?l[t]:255;e[p++]=y&128?h:c,e[p++]=y&64?h:c,e[p++]=y&32?h:c,e[p++]=y&16?h:c,e[p++]=y&8?h:c,e[p++]=y&4?h:c,e[p++]=y&2?h:c,e[p++]=y&1?h:c}if(u===0)continue;const g=t<f?l[t++]:255;for(let _=0;_<u;_++)e[p++]=g&1<<7-_?h:c}return{srcPos:t,destPos:p}}const du=16,uu=100,$m=15,fu=10,pu=1e3,Se=16;function Wm(l,t){if(l._removeMirroring)throw new Error("Context is already forwarding operations.");l.__originalSave=l.save,l.__originalRestore=l.restore,l.__originalRotate=l.rotate,l.__originalScale=l.scale,l.__originalTranslate=l.translate,l.__originalTransform=l.transform,l.__originalSetTransform=l.setTransform,l.__originalResetTransform=l.resetTransform,l.__originalClip=l.clip,l.__originalMoveTo=l.moveTo,l.__originalLineTo=l.lineTo,l.__originalBezierCurveTo=l.bezierCurveTo,l.__originalRect=l.rect,l.__originalClosePath=l.closePath,l.__originalBeginPath=l.beginPath,l._removeMirroring=()=>{l.save=l.__originalSave,l.restore=l.__originalRestore,l.rotate=l.__originalRotate,l.scale=l.__originalScale,l.translate=l.__originalTranslate,l.transform=l.__originalTransform,l.setTransform=l.__originalSetTransform,l.resetTransform=l.__originalResetTransform,l.clip=l.__originalClip,l.moveTo=l.__originalMoveTo,l.lineTo=l.__originalLineTo,l.bezierCurveTo=l.__originalBezierCurveTo,l.rect=l.__originalRect,l.closePath=l.__originalClosePath,l.beginPath=l.__originalBeginPath,delete l._removeMirroring},l.save=function(){t.save(),this.__originalSave()},l.restore=function(){t.restore(),this.__originalRestore()},l.translate=function(s,i){t.translate(s,i),this.__originalTranslate(s,i)},l.scale=function(s,i){t.scale(s,i),this.__originalScale(s,i)},l.transform=function(s,i,n,r,o,c){t.transform(s,i,n,r,o,c),this.__originalTransform(s,i,n,r,o,c)},l.setTransform=function(s,i,n,r,o,c){t.setTransform(s,i,n,r,o,c),this.__originalSetTransform(s,i,n,r,o,c)},l.resetTransform=function(){t.resetTransform(),this.__originalResetTransform()},l.rotate=function(s){t.rotate(s),this.__originalRotate(s)},l.clip=function(s){t.clip(s),this.__originalClip(s)},l.moveTo=function(e,s){t.moveTo(e,s),this.__originalMoveTo(e,s)},l.lineTo=function(e,s){t.lineTo(e,s),this.__originalLineTo(e,s)},l.bezierCurveTo=function(e,s,i,n,r,o){t.bezierCurveTo(e,s,i,n,r,o),this.__originalBezierCurveTo(e,s,i,n,r,o)},l.rect=function(e,s,i,n){t.rect(e,s,i,n),this.__originalRect(e,s,i,n)},l.closePath=function(){t.closePath(),this.__originalClosePath()},l.beginPath=function(){t.beginPath(),this.__originalBeginPath()}}class Gm{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 Rl(l,t,e,s,i,n,r,o,c,h){const[d,u,f,p,b,g]=Et(l);if(u===0&&f===0){const w=r*d+b,E=Math.round(w),x=o*p+g,S=Math.round(x),C=(r+c)*d+b,T=Math.abs(Math.round(C)-E)||1,R=(o+h)*p+g,I=Math.abs(Math.round(R)-S)||1;return l.setTransform(Math.sign(d),0,0,Math.sign(p),E,S),l.drawImage(t,e,s,i,n,0,0,T,I),l.setTransform(d,u,f,p,b,g),[T,I]}if(d===0&&p===0){const w=o*f+b,E=Math.round(w),x=r*u+g,S=Math.round(x),C=(o+h)*f+b,T=Math.abs(Math.round(C)-E)||1,R=(r+c)*u+g,I=Math.abs(Math.round(R)-S)||1;return l.setTransform(0,Math.sign(u),Math.sign(f),0,E,S),l.drawImage(t,e,s,i,n,0,0,I,T),l.setTransform(d,u,f,p,b,g),[I,T]}l.drawImage(t,e,s,i,n,r,o,c,h);const _=Math.hypot(d,u),y=Math.hypot(f,p);return[_*c,y*h]}function Um(l){const{width:t,height:e}=l;if(t>pu||e>pu)return null;const s=1e3,i=new Uint8Array([0,2,4,0,1,0,5,4,8,10,0,8,0,2,1,0]),n=t+1;let r=new Uint8Array(n*(e+1)),o,c,h;const d=t+7&-8;let u=new Uint8Array(d*e),f=0;for(const y of l.data){let w=128;for(;w>0;)u[f++]=y&w?0:255,w>>=1}let p=0;for(f=0,u[f]!==0&&(r[0]=1,++p),c=1;c<t;c++)u[f]!==u[f+1]&&(r[c]=u[f]?2:1,++p),f++;for(u[f]!==0&&(r[c]=2,++p),o=1;o<e;o++){f=o*d,h=o*n,u[f-d]!==u[f]&&(r[h]=u[f]?1:8,++p);let y=(u[f]?4:0)+(u[f-d]?8:0);for(c=1;c<t;c++)y=(y>>2)+(u[f+1]?4:0)+(u[f-d+1]?8:0),i[y]&&(r[h+c]=i[y],++p),f++;if(u[f-d]!==u[f]&&(r[h+c]=u[f]?2:4,++p),p>s)return null}for(f=d*(e-1),h=o*n,u[f]!==0&&(r[h]=8,++p),c=1;c<t;c++)u[f]!==u[f+1]&&(r[h+c]=u[f]?4:8,++p),f++;if(u[f]!==0&&(r[h+c]=4,++p),p>s)return null;const b=new Int32Array([0,n,-1,0,-n,0,0,0,1]),g=new Path2D;for(o=0;p&&o<=e;o++){let y=o*n;const w=y+t;for(;y<w&&!r[y];)y++;if(y===w)continue;g.moveTo(y%n,o);const E=y;let x=r[y];do{const S=b[x];do y+=S;while(!r[y]);const C=r[y];C!==5&&C!==10?(x=C,r[y]=0):(x=C&51*x>>4,r[y]&=x>>2|x<<2),g.lineTo(y%n,y/n|0),r[y]||--p}while(E!==y);--o}return u=null,r=null,function(y){y.save(),y.scale(1/t,-1/e),y.translate(0,-e),y.fill(g),y.beginPath(),y.restore()}}class gu{constructor(t,e){this.alphaIsShape=!1,this.fontSize=0,this.fontSizeScale=1,this.textMatrix=tf,this.textMatrixScale=1,this.fontMatrix=oh,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=ne.FILL,this.textRise=0,this.fillColor="#000000",this.strokeColor="#000000",this.patternFill=!1,this.fillAlpha=1,this.strokeAlpha=1,this.lineWidth=1,this.activeSMask=null,this.transferMaps="none",this.startNewPathAndClipBox([0,0,t,e])}clone(){const t=Object.create(this);return t.clipBox=this.clipBox.slice(),t}setCurrentPoint(t,e){this.x=t,this.y=e}updatePathMinMax(t,e,s){[e,s]=$.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=$.applyTransform(e,t),i=$.applyTransform(e.slice(2),t),n=$.applyTransform([e[0],e[3]],t),r=$.applyTransform([e[2],e[1]],t);this.minX=Math.min(this.minX,s[0],i[0],n[0],r[0]),this.minY=Math.min(this.minY,s[1],i[1],n[1],r[1]),this.maxX=Math.max(this.maxX,s[0],i[0],n[0],r[0]),this.maxY=Math.max(this.maxY,s[1],i[1],n[1],r[1])}updateScalingPathMinMax(t,e){$.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,n,r,o,c,h,d){const u=$.bezierBoundingBox(e,s,i,n,r,o,c,h,d);d||this.updateRectMinMax(t,u)}getPathBoundingBox(t=ge.FILL,e=null){const s=[this.minX,this.minY,this.maxX,this.maxY];if(t===ge.STROKE){e||At("Stroke bounding box must include transform.");const i=$.singularValueDecompose2dScale(e),n=i[0]*this.lineWidth/2,r=i[1]*this.lineWidth/2;s[0]-=n,s[1]-=r,s[2]+=n,s[3]+=r}return s}updateClipFromPath(){const t=$.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=ge.FILL,e=null){return $.intersect(this.clipBox,this.getPathBoundingBox(t,e))}}function mu(l,t){if(typeof ImageData<"u"&&t instanceof ImageData){l.putImageData(t,0,0);return}const e=t.height,s=t.width,i=e%Se,n=(e-i)/Se,r=i===0?n:n+1,o=l.createImageData(s,Se);let c=0,h;const d=t.data,u=o.data;let f,p,b,g;if(t.kind===Fl.GRAYSCALE_1BPP){const _=d.byteLength,y=new Uint32Array(u.buffer,0,u.byteLength>>2),w=y.length,E=s+7>>3,x=4294967295,S=me.isLittleEndian?4278190080:255;for(f=0;f<r;f++){for(b=f<n?Se:i,h=0,p=0;p<b;p++){const C=_-c;let T=0;const R=C>E?s:C*8-7,I=R&-8;let D=0,M=0;for(;T<I;T+=8)M=d[c++],y[h++]=M&128?x:S,y[h++]=M&64?x:S,y[h++]=M&32?x:S,y[h++]=M&16?x:S,y[h++]=M&8?x:S,y[h++]=M&4?x:S,y[h++]=M&2?x:S,y[h++]=M&1?x:S;for(;T<R;T++)D===0&&(M=d[c++],D=128),y[h++]=M&D?x:S,D>>=1}for(;h<w;)y[h++]=0;l.putImageData(o,0,f*Se)}}else if(t.kind===Fl.RGBA_32BPP){for(p=0,g=s*Se*4,f=0;f<n;f++)u.set(d.subarray(c,c+g)),c+=g,l.putImageData(o,0,p),p+=Se;f<r&&(g=s*i*4,u.set(d.subarray(c,c+g)),l.putImageData(o,0,p))}else if(t.kind===Fl.RGB_24BPP)for(b=Se,g=s*b,f=0;f<r;f++){for(f>=n&&(b=i,g=s*b),h=0,p=g;p--;)u[h++]=d[c++],u[h++]=d[c++],u[h++]=d[c++],u[h++]=255;l.putImageData(o,0,f*Se)}else throw new Error(`bad image kind: ${t.kind}`)}function bu(l,t){if(t.bitmap){l.drawImage(t.bitmap,0,0);return}const e=t.height,s=t.width,i=e%Se,n=(e-i)/Se,r=i===0?n:n+1,o=l.createImageData(s,Se);let c=0;const h=t.data,d=o.data;for(let u=0;u<r;u++){const f=u<n?Se:i;({srcPos:c}=zm({src:h,srcPos:c,dest:d,width:s,height:f,nonBlackColor:0})),l.putImageData(o,0,u*Se)}}function La(l,t){const e=["strokeStyle","fillStyle","fillRule","globalAlpha","lineWidth","lineCap","lineJoin","miterLimit","globalCompositeOperation","font","filter"];for(const s of e)l[s]!==void 0&&(t[s]=l[s]);l.setLineDash!==void 0&&(t.setLineDash(l.getLineDash()),t.lineDashOffset=l.lineDashOffset)}function Pl(l){if(l.strokeStyle=l.fillStyle="#000000",l.fillRule="nonzero",l.globalAlpha=1,l.lineWidth=1,l.lineCap="butt",l.lineJoin="miter",l.miterLimit=10,l.globalCompositeOperation="source-over",l.font="10px sans-serif",l.setLineDash!==void 0&&(l.setLineDash([]),l.lineDashOffset=0),!de){const{filter:t}=l;t!=="none"&&t!==""&&(l.filter="none")}}function Au(l,t){if(t)return!0;const e=$.singularValueDecompose2dScale(l);e[0]=Math.fround(e[0]),e[1]=Math.fround(e[1]);const s=Math.fround((globalThis.devicePixelRatio||1)*Gi.PDF_TO_CSS_UNITS);return e[0]<=s&&e[1]<=s}const Vm=["butt","round","square"],Xm=["miter","round","bevel"],qm={},vu={};var Xi,Oh,Nh;const Kd=class Kd{constructor(t,e,s,i,n,{optionalContentConfig:r,markedContentStack:o=null},c,h){v(this,Xi);this.ctx=t,this.current=new gu(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=n,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=r,this.cachedCanvases=new Gm(this.canvasFactory),this.cachedPatterns=new Map,this.annotationCanvasMap=c,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 n=this.ctx.canvas.width,r=this.ctx.canvas.height,o=this.ctx.fillStyle;if(this.ctx.fillStyle=i||"#ffffff",this.ctx.fillRect(0,0,n,r),this.ctx.fillStyle=o,s){const c=this.cachedCanvases.getCanvas("transparent",n,r);this.compositeCtx=this.ctx,this.transparentCanvas=c.canvas,this.ctx=c.context,this.ctx.save(),this.ctx.transform(...Et(this.compositeCtx))}this.ctx.save(),Pl(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 n=t.argsArray,r=t.fnArray;let o=e||0;const c=n.length;if(c===o)return o;const h=c-o>fu&&typeof s=="function",d=h?Date.now()+$m:0;let u=0;const f=this.commonObjs,p=this.objs;let b;for(;;){if(i!==void 0&&o===i.nextBreakPoint)return i.breakIt(o,s),o;if(b=r[o],b!==Ze.dependency)this[b].apply(this,n[o]);else for(const g of n[o]){const _=g.startsWith("g_")?f:p;if(!_.has(g))return _.get(g,s),o}if(o++,o===c)return o;if(h&&++u>fu){if(Date.now()>d)return s(),o;u=0}}}endDrawing(){A(this,Xi,Oh).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(),A(this,Xi,Nh).call(this)}_scaleImage(t,e){const s=t.width??t.displayWidth,i=t.height??t.displayHeight;let n=Math.max(Math.hypot(e[0],e[1]),1),r=Math.max(Math.hypot(e[2],e[3]),1),o=s,c=i,h="prescale1",d,u;for(;n>2&&o>1||r>2&&c>1;){let f=o,p=c;n>2&&o>1&&(f=o>=16384?Math.floor(o/2)-1||1:Math.ceil(o/2),n/=o/f),r>2&&c>1&&(p=c>=16384?Math.floor(c/2)-1||1:Math.ceil(c)/2,r/=c/p),d=this.cachedCanvases.getCanvas(h,f,p),u=d.context,u.clearRect(0,0,f,p),u.drawImage(t,0,0,o,c,0,0,f,p),t=d.canvas,o=f,c=p,h=h==="prescale1"?"prescale2":"prescale1"}return{img:t,paintWidth:o,paintHeight:c}}_createMaskCanvas(t){const e=this.ctx,{width:s,height:i}=t,n=this.current.fillColor,r=this.current.patternFill,o=Et(e);let c,h,d,u;if((t.bitmap||t.data)&&t.count>1){const R=t.bitmap||t.data.buffer;h=JSON.stringify(r?o:[o.slice(0,4),n]),c=this._cachedBitmapsMap.get(R),c||(c=new Map,this._cachedBitmapsMap.set(R,c));const I=c.get(h);if(I&&!r){const D=Math.round(Math.min(o[0],o[2])+o[4]),M=Math.round(Math.min(o[1],o[3])+o[5]);return{canvas:I,offsetX:D,offsetY:M}}d=I}d||(u=this.cachedCanvases.getCanvas("maskCanvas",s,i),bu(u.context,t));let f=$.transform(o,[1/s,0,0,-1/i,0,0]);f=$.transform(f,[1,0,0,1,0,-i]);const[p,b,g,_]=$.getAxialAlignedBoundingBox([0,0,s,i],f),y=Math.round(g-p)||1,w=Math.round(_-b)||1,E=this.cachedCanvases.getCanvas("fillCanvas",y,w),x=E.context,S=p,C=b;x.translate(-S,-C),x.transform(...f),d||(d=this._scaleImage(u.canvas,Ls(x)),d=d.img,c&&r&&c.set(h,d)),x.imageSmoothingEnabled=Au(Et(x),t.interpolate),Rl(x,d,0,0,d.width,d.height,0,0,s,i),x.globalCompositeOperation="source-in";const T=$.transform(Ls(x),[1,0,0,1,-S,-C]);return x.fillStyle=r?n.getPattern(e,this,T,ge.FILL):n,x.fillRect(0,0,s,i),c&&!r&&(this.cachedCanvases.delete("fillCanvas"),c.set(h,E.canvas)),{canvas:E.canvas,offsetX:Math.round(S),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=Vm[t]}setLineJoin(t){this.ctx.lineJoin=Xm[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 n=this.ctx;n.setTransform(...Et(this.suspendedCtx)),La(this.suspendedCtx,n),Wm(n,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(),La(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 n=i[0],r=i[1],o=i[2]-n,c=i[3]-r;o===0||c===0||(this.genericComposeSMask(e.context,s,o,c,e.subtype,e.backdrop,e.transferMap,n,r,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,n,r,o,c,h,d,u){let f=t.canvas,p=c-d,b=h-u;if(r){const _=$.makeHexColor(...r);if(p<0||b<0||p+s>f.width||b+i>f.height){const y=this.cachedCanvases.getCanvas("maskExtension",s,i),w=y.context;w.drawImage(f,-p,-b),w.globalCompositeOperation="destination-atop",w.fillStyle=_,w.fillRect(0,0,s,i),w.globalCompositeOperation="source-over",f=y.canvas,p=b=0}else{t.save(),t.globalAlpha=1,t.setTransform(1,0,0,1,0,0);const y=new Path2D;y.rect(p,b,s,i),t.clip(y),t.globalCompositeOperation="destination-atop",t.fillStyle=_,t.fillRect(p,b,s,i),t.restore()}}e.save(),e.globalAlpha=1,e.setTransform(1,0,0,1,0,0),n==="Alpha"&&o?e.filter=this.filterFactory.addAlphaFilter(o):n==="Luminosity"&&(e.filter=this.filterFactory.addLuminosityFilter(o));const g=new Path2D;g.rect(c,h,s,i),e.clip(g),e.globalCompositeOperation="destination-in",e.drawImage(f,p,b,s,i,c,h,s,i),e.restore()}save(){this.inSMaskMode?(La(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(),La(this.suspendedCtx,this.ctx)):this.ctx.restore(),this.checkSMaskState(),this.pendingClip=null,this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null)}transform(t,e,s,i,n,r){this.ctx.transform(t,e,s,i,n,r),this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null}constructPath(t,e,s){const i=this.ctx,n=this.current;let r=n.x,o=n.y,c,h;const d=Et(i),u=d[0]===0&&d[3]===0||d[1]===0&&d[2]===0,f=u?s.slice(0):null;for(let p=0,b=0,g=t.length;p<g;p++)switch(t[p]|0){case Ze.rectangle:r=e[b++],o=e[b++];const _=e[b++],y=e[b++],w=r+_,E=o+y;i.moveTo(r,o),_===0||y===0?i.lineTo(w,E):(i.lineTo(w,o),i.lineTo(w,E),i.lineTo(r,E)),u||n.updateRectMinMax(d,[r,o,w,E]),i.closePath();break;case Ze.moveTo:r=e[b++],o=e[b++],i.moveTo(r,o),u||n.updatePathMinMax(d,r,o);break;case Ze.lineTo:r=e[b++],o=e[b++],i.lineTo(r,o),u||n.updatePathMinMax(d,r,o);break;case Ze.curveTo:c=r,h=o,r=e[b+4],o=e[b+5],i.bezierCurveTo(e[b],e[b+1],e[b+2],e[b+3],r,o),n.updateCurvePathMinMax(d,c,h,e[b],e[b+1],e[b+2],e[b+3],r,o,f),b+=6;break;case Ze.curveTo2:c=r,h=o,i.bezierCurveTo(r,o,e[b],e[b+1],e[b+2],e[b+3]),n.updateCurvePathMinMax(d,c,h,r,o,e[b],e[b+1],e[b+2],e[b+3],f),r=e[b+2],o=e[b+3],b+=4;break;case Ze.curveTo3:c=r,h=o,r=e[b+2],o=e[b+3],i.bezierCurveTo(e[b],e[b+1],r,o,r,o),n.updateCurvePathMinMax(d,c,h,e[b],e[b+1],r,o,r,o,f),b+=4;break;case Ze.closePath:i.closePath();break}u&&n.updateScalingPathMinMax(d,f),n.setCurrentPoint(r,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,Ls(e),ge.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 n=!1;i&&(e.save(),e.fillStyle=s.getPattern(e,this,Ls(e),ge.FILL),n=!0);const r=this.current.getClippedPathBoundingBox();this.contentVisible&&r!==null&&(this.pendingEOFill?(e.fill("evenodd"),this.pendingEOFill=!1):e.fill()),n&&e.restore(),t&&this.consumePath(r)}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=qm}eoClip(){this.pendingClip=vu}beginText(){this.current.textMatrix=tf,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 d;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||oh,(i.fontMatrix[0]===0||i.fontMatrix[3]===0)&&tt("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 n=s.loadedName||"sans-serif",r=((d=s.systemFontInfo)==null?void 0:d.css)||`"${n}", ${s.fallbackName}`;let o="normal";s.black?o="900":s.bold&&(o="bold");const c=s.italic?"italic":"normal";let h=e;e<du?h=du:e>uu&&(h=uu),this.current.fontSizeScale=e/h,this.ctx.font=`${c} ${o} ${h}px ${r}`}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,n,r){this.current.textMatrix=[t,e,s,i,n,r],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){const n=this.ctx,r=this.current,o=r.font,c=r.textRenderingMode,h=r.fontSize/r.fontSizeScale,d=c&ne.FILL_STROKE_MASK,u=!!(c&ne.ADD_TO_PATH_FLAG),f=r.patternFill&&!o.missingFile;let p;(o.disableFontFace||u||f)&&(p=o.getPathGenerator(this.commonObjs,t)),o.disableFontFace||f?(n.save(),n.translate(e,s),n.beginPath(),p(n,h),i&&n.setTransform(...i),(d===ne.FILL||d===ne.FILL_STROKE)&&n.fill(),(d===ne.STROKE||d===ne.FILL_STROKE)&&n.stroke(),n.restore()):((d===ne.FILL||d===ne.FILL_STROKE)&&n.fillText(t,e,s),(d===ne.STROKE||d===ne.FILL_STROKE)&&n.strokeText(t,e,s)),u&&(this.pendingTextPaths||(this.pendingTextPaths=[])).push({transform:Et(n),x:e,y:s,fontSize:h,addToPath:p})}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 it(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 n=this.ctx,r=e.fontSizeScale,o=e.charSpacing,c=e.wordSpacing,h=e.fontDirection,d=e.textHScale*h,u=t.length,f=s.vertical,p=f?1:-1,b=s.defaultVMetrics,g=i*e.fontMatrix[0],_=e.textRenderingMode===ne.FILL&&!s.disableFontFace&&!e.patternFill;n.save(),n.transform(...e.textMatrix),n.translate(e.x,e.y+e.textRise),h>0?n.scale(d,-1):n.scale(d,1);let y;if(e.patternFill){n.save();const C=e.fillColor.getPattern(n,this,Ls(n),ge.FILL);y=Et(n),n.restore(),n.fillStyle=C}let w=e.lineWidth;const E=e.textMatrixScale;if(E===0||w===0){const C=e.textRenderingMode&ne.FILL_STROKE_MASK;(C===ne.STROKE||C===ne.FILL_STROKE)&&(w=this.getSinglePixelWidth())}else w/=E;if(r!==1&&(n.scale(r,r),w/=r),n.lineWidth=w,s.isInvalidPDFjsFont){const C=[];let T=0;for(const R of t)C.push(R.unicode),T+=R.width;n.fillText(C.join(""),0,0),e.x+=T*g*d,n.restore(),this.compose();return}let x=0,S;for(S=0;S<u;++S){const C=t[S];if(typeof C=="number"){x+=p*C*i/1e3;continue}let T=!1;const R=(C.isSpace?c:0)+o,I=C.fontChar,D=C.accent;let M,L,j=C.width;if(f){const U=C.vmetric||b,G=-(C.vmetric?U[1]:j*.5)*g,N=U[2]*g;j=U?-U[0]:j,M=G/r,L=(x+N)/r}else M=x/r,L=0;if(s.remeasure&&j>0){const U=n.measureText(I).width*1e3/i*r;if(j<U&&this.isFontSubpixelAAEnabled){const G=j/U;T=!0,n.save(),n.scale(G,1),M/=G}else j!==U&&(M+=(j-U)/2e3*i/r)}if(this.contentVisible&&(C.isInFont||s.missingFile)){if(_&&!D)n.fillText(I,M,L);else if(this.paintChar(I,M,L,y),D){const U=M+i*D.offset.x/r,G=L-i*D.offset.y/r;this.paintChar(D.fontChar,U,G,y)}}const O=f?j*g-R*h:j*g+R*h;x+=O,T&&n.restore()}f?e.y-=x:e.x+=x*d,n.restore(),this.compose()}showType3Text(t){const e=this.ctx,s=this.current,i=s.font,n=s.fontSize,r=s.fontDirection,o=i.vertical?1:-1,c=s.charSpacing,h=s.wordSpacing,d=s.textHScale*r,u=s.fontMatrix||oh,f=t.length,p=s.textRenderingMode===ne.INVISIBLE;let b,g,_,y;if(!(p||n===0)){for(this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null,e.save(),e.transform(...s.textMatrix),e.translate(s.x,s.y),e.scale(d,r),b=0;b<f;++b){if(g=t[b],typeof g=="number"){y=o*g*n/1e3,this.ctx.translate(y,0),s.x+=y*d;continue}const w=(g.isSpace?h:0)+c,E=i.charProcOperatorList[g.operatorListId];if(!E){tt(`Type3 character "${g.operatorListId}" is not available.`);continue}this.contentVisible&&(this.processingType3=g,this.save(),e.scale(n,n),e.transform(...u),this.executeOperatorList(E),this.restore()),_=$.applyTransform([g.width,0],u)[0]*n+w,e.translate(_,0),s.x+=_*d}e.restore(),this.processingType3=null}}setCharWidth(t,e){}setCharWidthAndBounds(t,e,s,i,n,r){this.ctx.rect(s,i,n-s,r-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),n={createCanvasGraphics:r=>new Kd(r,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:this.optionalContentConfig,markedContentStack:this.markedContentStack})};e=new Dh(t,s,this.ctx,n,i)}else e=this._getPattern(t[1],t[2]);return e}setStrokeColorN(){this.current.strokeColor=this.getColorN_Pattern(arguments)}setFillColorN(){this.current.fillColor=this.getColorN_Pattern(arguments),this.current.patternFill=!0}setStrokeRGBColor(t,e,s){this.ctx.strokeStyle=this.current.strokeColor=$.makeHexColor(t,e,s)}setStrokeTransparent(){this.ctx.strokeStyle=this.current.strokeColor="transparent"}setFillRGBColor(t,e,s){this.ctx.fillStyle=this.current.fillColor=$.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=jm(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,Ls(e),ge.SHADING);const i=Ls(e);if(i){const{width:n,height:r}=e.canvas,[o,c,h,d]=$.getAxialAlignedBoundingBox([0,0,n,r],i);this.ctx.fillRect(o,c,h-o,d-c)}else this.ctx.fillRect(-1e10,-1e10,2e10,2e10);this.compose(this.current.getClippedPathBoundingBox()),this.restore()}beginInlineImage(){At("Should not call beginInlineImage")}beginImageData(){At("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||Dc("TODO: Support non-isolated groups."),t.knockout&&tt("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=$.getAxialAlignedBoundingBox(t.bbox,Et(e));const n=[0,0,e.canvas.width,e.canvas.height];i=$.intersect(i,n)||[0,0,0,0];const r=Math.floor(i[0]),o=Math.floor(i[1]),c=Math.max(Math.ceil(i[2])-r,1),h=Math.max(Math.ceil(i[3])-o,1);this.current.startNewPathAndClipBox([0,0,c,h]);let d="groupAt"+this.groupLevel;t.smask&&(d+="_smask_"+this.smaskCounter++%2);const u=this.cachedCanvases.getCanvas(d,c,h),f=u.context;f.translate(-r,-o),f.transform(...s),t.smask?this.smaskStack.push({canvas:u.canvas,context:f,offsetX:r,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(r,o),e.save()),La(e,f),this.ctx=f,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 n=$.getAxialAlignedBoundingBox([0,0,e.canvas.width,e.canvas.height],i);this.ctx.drawImage(e.canvas,0,0),this.ctx.restore(),this.compose(n)}}beginAnnotation(t,e,s,i,n){if(A(this,Xi,Oh).call(this),Pl(this.ctx),this.ctx.save(),this.save(),this.baseTransform&&this.ctx.setTransform(...this.baseTransform),e){const r=e[2]-e[0],o=e[3]-e[1];if(n&&this.annotationCanvasMap){s=s.slice(),s[4]-=e[0],s[5]-=e[1],e=e.slice(),e[0]=e[1]=0,e[2]=r,e[3]=o;const[c,h]=$.singularValueDecompose2dScale(Et(this.ctx)),{viewportScale:d}=this,u=Math.ceil(r*this.outputScaleX*d),f=Math.ceil(o*this.outputScaleY*d);this.annotationCanvas=this.canvasFactory.create(u,f);const{canvas:p,context:b}=this.annotationCanvas;this.annotationCanvasMap.set(t,p),this.annotationCanvas.savedCtx=this.ctx,this.ctx=b,this.ctx.save(),this.ctx.setTransform(c,0,0,-h,0,o*h),Pl(this.ctx)}else Pl(this.ctx),this.endPath(),this.ctx.rect(e[0],e[1],r,o),this.ctx.clip(),this.ctx.beginPath()}this.current=new gu(this.ctx.canvas.width,this.ctx.canvas.height),this.transform(...s),this.transform(...i)}endAnnotation(){this.annotationCanvas&&(this.ctx.restore(),A(this,Xi,Nh).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=Um(t)),i.compiled)){i.compiled(s);return}const n=this._createMaskCanvas(t),r=n.canvas;s.save(),s.setTransform(1,0,0,1,0,0),s.drawImage(r,n.offsetX,n.offsetY),s.restore(),this.compose()}paintImageMaskXObjectRepeat(t,e,s=0,i=0,n,r){if(!this.contentVisible)return;t=this.getObject(t.data,t);const o=this.ctx;o.save();const c=Et(o);o.transform(e,s,i,n,0,0);const h=this._createMaskCanvas(t);o.setTransform(1,0,0,1,h.offsetX-c[4],h.offsetY-c[5]);for(let d=0,u=r.length;d<u;d+=2){const f=$.transform(c,[e,s,i,n,r[d],r[d+1]]),[p,b]=$.applyTransform([0,0],f);o.drawImage(h.canvas,p,b)}o.restore(),this.compose()}paintImageMaskXObjectGroup(t){if(!this.contentVisible)return;const e=this.ctx,s=this.current.fillColor,i=this.current.patternFill;for(const n of t){const{data:r,width:o,height:c,transform:h}=n,d=this.cachedCanvases.getCanvas("maskCanvas",o,c),u=d.context;u.save();const f=this.getObject(r,n);bu(u,f),u.globalCompositeOperation="source-in",u.fillStyle=i?s.getPattern(u,this,Ls(e),ge.FILL):s,u.fillRect(0,0,o,c),u.restore(),e.save(),e.transform(...h),e.scale(1,-1),Rl(e,d.canvas,0,0,o,c,0,-1,1,1),e.restore()}this.compose()}paintImageXObject(t){if(!this.contentVisible)return;const e=this.getObject(t);if(!e){tt("Dependent image isn't ready yet");return}this.paintInlineImageXObject(e)}paintImageXObjectRepeat(t,e,s,i){if(!this.contentVisible)return;const n=this.getObject(t);if(!n){tt("Dependent image isn't ready yet");return}const r=n.width,o=n.height,c=[];for(let h=0,d=i.length;h<d;h+=2)c.push({transform:[e,0,0,s,i[h],i[h+1]],x:0,y:0,w:r,h:o});this.paintInlineImageXObjectGroup(n,c)}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,n=this.cachedCanvases.getCanvas("inlineImage",s,i),r=n.context;return r.filter=this.current.transferMaps,r.drawImage(e,0,0),r.filter="none",n.canvas}paintInlineImageXObject(t){if(!this.contentVisible)return;const e=t.width,s=t.height,i=this.ctx;if(this.save(),!de){const{filter:o}=i;o!=="none"&&o!==""&&(i.filter="none")}i.scale(1/e,-1/s);let n;if(t.bitmap)n=this.applyTransferMapsToBitmap(t);else if(typeof HTMLElement=="function"&&t instanceof HTMLElement||!t.data)n=t;else{const c=this.cachedCanvases.getCanvas("inlineImage",e,s).context;mu(c,t),n=this.applyTransferMapsToCanvas(c)}const r=this._scaleImage(n,Ls(i));i.imageSmoothingEnabled=Au(Et(i),t.interpolate),Rl(i,r.img,0,0,r.paintWidth,r.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 n=t.width,r=t.height,c=this.cachedCanvases.getCanvas("inlineImage",n,r).context;mu(c,t),i=this.applyTransferMapsToCanvas(c)}for(const n of e)s.save(),s.transform(...n.transform),s.scale(1,-1),Rl(s,i,n.x,n.y,n.w,n.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===vu?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:n}=this.ctx.getTransform();let r,o;if(s===0&&i===0){const c=Math.abs(e),h=Math.abs(n);if(c===h)if(t===0)r=o=1/c;else{const d=c*t;r=o=d<1?1/d:1}else if(t===0)r=1/c,o=1/h;else{const d=c*t,u=h*t;r=d<1?1/d:1,o=u<1?1/u:1}}else{const c=Math.abs(e*n-s*i),h=Math.hypot(e,s),d=Math.hypot(i,n);if(t===0)r=d/c,o=h/c;else{const u=t*c;r=d>u?d/u:1,o=h>u?h/u:1}}this._cachedScaleForStroking[0]=r,this._cachedScaleForStroking[1]=o}return this._cachedScaleForStroking}rescaleAndStroke(t){const{ctx:e}=this,{lineWidth:s}=this.current,[i,n]=this.getScaleForStroking();if(e.lineWidth=s||1,i===1&&n===1){e.stroke();return}const r=e.getLineDash();if(t&&e.save(),e.scale(i,n),r.length>0){const o=Math.max(i,n);e.setLineDash(r.map(c=>c/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}};Xi=new WeakSet,Oh=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)},Nh=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 Cr=Kd;for(const l in Ze)Cr.prototype[l]!==void 0&&(Cr.prototype[Ze[l]]=Cr.prototype[l]);var Eo,So;class oi{static get workerPort(){return a(this,Eo)}static set workerPort(t){if(!(typeof Worker<"u"&&t instanceof Worker)&&t!==null)throw new Error("Invalid `workerPort` type.");m(this,Eo,t)}static get workerSrc(){return a(this,So)}static set workerSrc(t){if(typeof t!="string")throw new Error("Invalid `workerSrc` type.");m(this,So,t)}}Eo=new WeakMap,So=new WeakMap,v(oi,Eo,null),v(oi,So,"");const Il={DATA:1,ERROR:2},Lt={CANCEL:1,CANCEL_COMPLETE:2,CLOSE:3,ENQUEUE:4,ERROR:5,PULL:6,PULL_COMPLETE:7,START_COMPLETE:8};function Ce(l){switch(l instanceof Error||typeof l=="object"&&l!==null||At('wrapReason: Expected "reason" to be a (possibly cloned) Error.'),l.name){case"AbortException":return new cr(l.message);case"MissingPDFException":return new lr(l.message);case"PasswordException":return new lh(l.message,l.code);case"UnexpectedResponseException":return new Oc(l.message,l.status);case"UnknownErrorException":return new ch(l.message,l.details);default:return new ch(l.message,l.toString())}}var Wr,qe,Bf,jf,zf,$l;class $a{constructor(t,e,s){v(this,qe);v(this,Wr,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",A(this,qe,Bf).bind(this),{signal:a(this,Wr).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++,n=Promise.withResolvers();this.callbackCapabilities[i]=n;try{this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:t,callbackId:i,data:e},s)}catch(r){n.reject(r)}return n.promise}sendWithStream(t,e,s,i){const n=this.streamId++,r=this.sourceName,o=this.targetName,c=this.comObj;return new ReadableStream({start:h=>{const d=Promise.withResolvers();return this.streamControllers[n]={controller:h,startCall:d,pullCall:null,cancelCall:null,isClosed:!1},c.postMessage({sourceName:r,targetName:o,action:t,streamId:n,data:e,desiredSize:h.desiredSize},i),d.promise},pull:h=>{const d=Promise.withResolvers();return this.streamControllers[n].pullCall=d,c.postMessage({sourceName:r,targetName:o,stream:Lt.PULL,streamId:n,desiredSize:h.desiredSize}),d.promise},cancel:h=>{zt(h instanceof Error,"cancel must have a valid reason");const d=Promise.withResolvers();return this.streamControllers[n].cancelCall=d,this.streamControllers[n].isClosed=!0,c.postMessage({sourceName:r,targetName:o,stream:Lt.CANCEL,streamId:n,reason:Ce(h)}),d.promise}},s)}destroy(){var t;(t=a(this,Wr))==null||t.abort(),m(this,Wr,null)}}Wr=new WeakMap,qe=new WeakSet,Bf=function({data:t}){if(t.targetName!==this.sourceName)return;if(t.stream){A(this,qe,zf).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===Il.DATA)i.resolve(t.data);else if(t.callback===Il.ERROR)i.reject(Ce(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,n=this.comObj;new Promise(function(r){r(e(t.data))}).then(function(r){n.postMessage({sourceName:s,targetName:i,callback:Il.DATA,callbackId:t.callbackId,data:r})},function(r){n.postMessage({sourceName:s,targetName:i,callback:Il.ERROR,callbackId:t.callbackId,reason:Ce(r)})});return}if(t.streamId){A(this,qe,jf).call(this,t);return}e(t.data)},jf=function(t){const e=t.streamId,s=this.sourceName,i=t.sourceName,n=this.comObj,r=this,o=this.actionHandler[t.action],c={enqueue(h,d=1,u){if(this.isCancelled)return;const f=this.desiredSize;this.desiredSize-=d,f>0&&this.desiredSize<=0&&(this.sinkCapability=Promise.withResolvers(),this.ready=this.sinkCapability.promise),n.postMessage({sourceName:s,targetName:i,stream:Lt.ENQUEUE,streamId:e,chunk:h},u)},close(){this.isCancelled||(this.isCancelled=!0,n.postMessage({sourceName:s,targetName:i,stream:Lt.CLOSE,streamId:e}),delete r.streamSinks[e])},error(h){zt(h instanceof Error,"error must have a valid reason"),!this.isCancelled&&(this.isCancelled=!0,n.postMessage({sourceName:s,targetName:i,stream:Lt.ERROR,streamId:e,reason:Ce(h)}))},sinkCapability:Promise.withResolvers(),onPull:null,onCancel:null,isCancelled:!1,desiredSize:t.desiredSize,ready:null};c.sinkCapability.resolve(),c.ready=c.sinkCapability.promise,this.streamSinks[e]=c,new Promise(function(h){h(o(t.data,c))}).then(function(){n.postMessage({sourceName:s,targetName:i,stream:Lt.START_COMPLETE,streamId:e,success:!0})},function(h){n.postMessage({sourceName:s,targetName:i,stream:Lt.START_COMPLETE,streamId:e,reason:Ce(h)})})},zf=function(t){const e=t.streamId,s=this.sourceName,i=t.sourceName,n=this.comObj,r=this.streamControllers[e],o=this.streamSinks[e];switch(t.stream){case Lt.START_COMPLETE:t.success?r.startCall.resolve():r.startCall.reject(Ce(t.reason));break;case Lt.PULL_COMPLETE:t.success?r.pullCall.resolve():r.pullCall.reject(Ce(t.reason));break;case Lt.PULL:if(!o){n.postMessage({sourceName:s,targetName:i,stream:Lt.PULL_COMPLETE,streamId:e,success:!0});break}o.desiredSize<=0&&t.desiredSize>0&&o.sinkCapability.resolve(),o.desiredSize=t.desiredSize,new Promise(function(c){var h;c((h=o.onPull)==null?void 0:h.call(o))}).then(function(){n.postMessage({sourceName:s,targetName:i,stream:Lt.PULL_COMPLETE,streamId:e,success:!0})},function(c){n.postMessage({sourceName:s,targetName:i,stream:Lt.PULL_COMPLETE,streamId:e,reason:Ce(c)})});break;case Lt.ENQUEUE:if(zt(r,"enqueue should have stream controller"),r.isClosed)break;r.controller.enqueue(t.chunk);break;case Lt.CLOSE:if(zt(r,"close should have stream controller"),r.isClosed)break;r.isClosed=!0,r.controller.close(),A(this,qe,$l).call(this,r,e);break;case Lt.ERROR:zt(r,"error should have stream controller"),r.controller.error(Ce(t.reason)),A(this,qe,$l).call(this,r,e);break;case Lt.CANCEL_COMPLETE:t.success?r.cancelCall.resolve():r.cancelCall.reject(Ce(t.reason)),A(this,qe,$l).call(this,r,e);break;case Lt.CANCEL:if(!o)break;new Promise(function(c){var h;c((h=o.onCancel)==null?void 0:h.call(o,Ce(t.reason)))}).then(function(){n.postMessage({sourceName:s,targetName:i,stream:Lt.CANCEL_COMPLETE,streamId:e,success:!0})},function(c){n.postMessage({sourceName:s,targetName:i,stream:Lt.CANCEL_COMPLETE,streamId:e,reason:Ce(c)})}),o.sinkCapability.reject(Ce(t.reason)),o.isCancelled=!0,delete this.streamSinks[e];break;default:throw new Error("Unexpected stream case")}},$l=async function(t,e){var s,i,n;await Promise.allSettled([(s=t.startCall)==null?void 0:s.promise,(i=t.pullCall)==null?void 0:i.promise,(n=t.cancelCall)==null?void 0:n.promise]),delete this.streamControllers[e]};var Sn,xo;class Ym{constructor({parsedData:t,rawData:e}){v(this,Sn);v(this,xo);m(this,Sn,t),m(this,xo,e)}getRaw(){return a(this,xo)}get(t){return a(this,Sn).get(t)??null}getAll(){return Fd(a(this,Sn))}has(t){return a(this,Sn).has(t)}}Sn=new WeakMap,xo=new WeakMap;const vr=Symbol("INTERNAL");var Co,To,Ro,Gr;class Km{constructor(t,{name:e,intent:s,usage:i,rbGroups:n}){v(this,Co,!1);v(this,To,!1);v(this,Ro,!1);v(this,Gr,!0);m(this,Co,!!(t&Oe.DISPLAY)),m(this,To,!!(t&Oe.PRINT)),this.name=e,this.intent=s,this.usage=i,this.rbGroups=n}get visible(){if(a(this,Ro))return a(this,Gr);if(!a(this,Gr))return!1;const{print:t,view:e}=this.usage;return a(this,Co)?(e==null?void 0:e.viewState)!=="OFF":a(this,To)?(t==null?void 0:t.printState)!=="OFF":!0}_setVisible(t,e,s=!1){t!==vr&&At("Internal method `_setVisible` called."),m(this,Ro,s),m(this,Gr,e)}}Co=new WeakMap,To=new WeakMap,Ro=new WeakMap,Gr=new WeakMap;var Ri,ct,Ur,Vr,Po,Hh;class Zm{constructor(t,e=Oe.DISPLAY){v(this,Po);v(this,Ri,null);v(this,ct,new Map);v(this,Ur,null);v(this,Vr,null);if(this.renderingIntent=e,this.name=null,this.creator=null,t!==null){this.name=t.name,this.creator=t.creator,m(this,Vr,t.order);for(const s of t.groups)a(this,ct).set(s.id,new Km(e,s));if(t.baseState==="OFF")for(const s of a(this,ct).values())s._setVisible(vr,!1);for(const s of t.on)a(this,ct).get(s)._setVisible(vr,!0);for(const s of t.off)a(this,ct).get(s)._setVisible(vr,!1);m(this,Ur,this.getHash())}}isVisible(t){if(a(this,ct).size===0)return!0;if(!t)return Dc("Optional content group not defined."),!0;if(t.type==="OCG")return a(this,ct).has(t.id)?a(this,ct).get(t.id).visible:(tt(`Optional content group not found: ${t.id}`),!0);if(t.type==="OCMD"){if(t.expression)return A(this,Po,Hh).call(this,t.expression);if(!t.policy||t.policy==="AnyOn"){for(const e of t.ids){if(!a(this,ct).has(e))return tt(`Optional content group not found: ${e}`),!0;if(a(this,ct).get(e).visible)return!0}return!1}else if(t.policy==="AllOn"){for(const e of t.ids){if(!a(this,ct).has(e))return tt(`Optional content group not found: ${e}`),!0;if(!a(this,ct).get(e).visible)return!1}return!0}else if(t.policy==="AnyOff"){for(const e of t.ids){if(!a(this,ct).has(e))return tt(`Optional content group not found: ${e}`),!0;if(!a(this,ct).get(e).visible)return!0}return!1}else if(t.policy==="AllOff"){for(const e of t.ids){if(!a(this,ct).has(e))return tt(`Optional content group not found: ${e}`),!0;if(a(this,ct).get(e).visible)return!1}return!0}return tt(`Unknown optional content policy ${t.policy}.`),!0}return tt(`Unknown group type ${t.type}.`),!0}setVisibility(t,e=!0,s=!0){var n;const i=a(this,ct).get(t);if(!i){tt(`Optional content group not found: ${t}`);return}if(s&&e&&i.rbGroups.length)for(const r of i.rbGroups)for(const o of r)o!==t&&((n=a(this,ct).get(o))==null||n._setVisible(vr,!1,!0));i._setVisible(vr,!!e,!0),m(this,Ri,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 n=a(this,ct).get(i);if(n)switch(s){case"ON":this.setVisibility(i,!0,e);break;case"OFF":this.setVisibility(i,!1,e);break;case"Toggle":this.setVisibility(i,!n.visible,e);break}}m(this,Ri,null)}get hasInitialVisibility(){return a(this,Ur)===null||this.getHash()===a(this,Ur)}getOrder(){return a(this,ct).size?a(this,Vr)?a(this,Vr).slice():[...a(this,ct).keys()]:null}getGroups(){return a(this,ct).size>0?Fd(a(this,ct)):null}getGroup(t){return a(this,ct).get(t)||null}getHash(){if(a(this,Ri)!==null)return a(this,Ri);const t=new Rf;for(const[e,s]of a(this,ct))t.update(`${e}:${s.visible}`);return m(this,Ri,t.hexdigest())}}Ri=new WeakMap,ct=new WeakMap,Ur=new WeakMap,Vr=new WeakMap,Po=new WeakSet,Hh=function(t){const e=t.length;if(e<2)return!0;const s=t[0];for(let i=1;i<e;i++){const n=t[i];let r;if(Array.isArray(n))r=A(this,Po,Hh).call(this,n);else if(a(this,ct).has(n))r=a(this,ct).get(n).visible;else return tt(`Optional content group not found: ${n}`),!0;switch(s){case"And":if(!r)return!1;break;case"Or":if(r)return!0;break;case"Not":return!r;default:return!0}}return s==="And"};class Qm{constructor(t,{disableRange:e=!1,disableStream:s=!1}){zt(t,'PDFDataTransportStream - missing required "pdfDataRangeTransport" argument.');const{length:i,initialData:n,progressiveDone:r,contentDispositionFilename:o}=t;if(this._queuedChunks=[],this._progressiveDone=r,this._contentDispositionFilename=o,(n==null?void 0:n.length)>0){const c=n instanceof Uint8Array&&n.byteLength===n.buffer.byteLength?n.buffer:new Uint8Array(n).buffer;this._queuedChunks.push(c)}this._pdfDataRangeTransport=t,this._isStreamingSupported=!s,this._isRangeSupported=!e,this._contentLength=i,this._fullRequestReader=null,this._rangeReaders=[],t.addRangeListener((c,h)=>{this._onReceiveData({begin:c,chunk:h})}),t.addProgressListener((c,h)=>{this._onProgress({loaded:c,total:h})}),t.addProgressiveReadListener(c=>{this._onReceiveData({chunk:c})}),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(n){return n._begin!==t?!1:(n._enqueue(s),!0)});zt(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,n;t.total===void 0?(s=(e=this._rangeReaders[0])==null?void 0:e.onProgress)==null||s.call(e,{loaded:t.loaded}):(n=(i=this._fullRequestReader)==null?void 0:i.onProgress)==null||n.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(){zt(!this._fullRequestReader,"PDFDataTransportStream.getFullReader can only be called once.");const t=this._queuedChunks;return this._queuedChunks=null,new Jm(this,t,this._progressiveDone,this._contentDispositionFilename)}getRangeReader(t,e){if(e<=this._progressiveDataLength)return null;const s=new tb(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 Jm{constructor(t,e,s=!1,i=null){this._stream=t,this._done=s||!1,this._filename=Nd(i)?i:null,this._queuedChunks=e||[],this._loaded=0;for(const n of this._queuedChunks)this._loaded+=n.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 tb{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 eb(l){let t=!0,e=s("filename\\*","i").exec(l);if(e){e=e[1];let d=o(e);return d=unescape(d),d=c(d),d=h(d),n(d)}if(e=r(l),e){const d=h(e);return n(d)}if(e=s("filename","i").exec(l),e){e=e[1];let d=o(e);return d=h(d),n(d)}function s(d,u){return new RegExp("(?:^|;)\\s*"+d+'\\s*=\\s*([^";\\s][^;\\s]*|"(?:[^"\\\\]|\\\\"?)+"?)',u)}function i(d,u){if(d){if(!/^[\x00-\xFF]+$/.test(u))return u;try{const f=new TextDecoder(d,{fatal:!0}),p=Nc(u);u=f.decode(p),t=!1}catch{}}return u}function n(d){return t&&/[\x80-\xff]/.test(d)&&(d=i("utf-8",d),t&&(d=i("iso-8859-1",d))),d}function r(d){const u=[];let f;const p=s("filename\\*((?!0\\d)\\d+)(\\*?)","ig");for(;(f=p.exec(d))!==null;){let[,g,_,y]=f;if(g=parseInt(g,10),g in u){if(g===0)break;continue}u[g]=[_,y]}const b=[];for(let g=0;g<u.length&&g in u;++g){let[_,y]=u[g];y=o(y),_&&(y=unescape(y),g===0&&(y=c(y))),b.push(y)}return b.join("")}function o(d){if(d.startsWith('"')){const u=d.slice(1).split('\\"');for(let f=0;f<u.length;++f){const p=u[f].indexOf('"');p!==-1&&(u[f]=u[f].slice(0,p),u.length=f+1),u[f]=u[f].replaceAll(/\\(.)/g,"$1")}d=u.join('"')}return d}function c(d){const u=d.indexOf("'");if(u===-1)return d;const f=d.slice(0,u),b=d.slice(u+1).replace(/^[^']*'/,"");return i(f,b)}function h(d){return!d.startsWith("=?")||/[\x00-\x19\x80-\xff]/.test(d)?d:d.replaceAll(/=\?([\w-]*)\?([QqBb])\?((?:[^?]|\?(?!=))*)\?=/g,function(u,f,p,b){if(p==="q"||p==="Q")return b=b.replaceAll("_"," "),b=b.replaceAll(/=([0-9a-fA-F]{2})/g,function(g,_){return String.fromCharCode(parseInt(_,16))}),i(f,b);try{b=atob(b)}catch{}return i(f,b)})}return""}function $d(l,t){const e=new Headers;if(!l||!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 Wd({responseHeaders:l,isHttp:t,rangeChunkSize:e,disableRange:s}){const i={allowRangeRequests:!1,suggestedLength:void 0},n=parseInt(l.get("Content-Length"),10);return!Number.isInteger(n)||(i.suggestedLength=n,n<=2*e)||s||!t||l.get("Accept-Ranges")!=="bytes"||(l.get("Content-Encoding")||"identity")!=="identity"||(i.allowRangeRequests=!0),i}function Gd(l){const t=l.get("Content-Disposition");if(t){let e=eb(t);if(e.includes("%"))try{e=decodeURIComponent(e)}catch{}if(Nd(e))return e}return null}function jc(l,t){return l===404||l===0&&t.startsWith("file:")?new lr('Missing PDF "'+t+'".'):new Oc(`Unexpected server response (${l}) while retrieving PDF "${t}".`,l)}function $f(l){return l===200||l===206}function Wf(l,t,e){return{method:"GET",headers:l,signal:e.signal,mode:"cors",credentials:t?"include":"same-origin",redirect:"follow"}}function Gf(l){return l instanceof Uint8Array?l.buffer:l instanceof ArrayBuffer?l:(tt(`getArrayBuffer - unexpected data format: ${l}`),new Uint8Array(l).buffer)}class yu{constructor(t){this.source=t,this.isHttp=/^https?:/i.test(t.url),this.headers=$d(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 zt(!this._fullRequestReader,"PDFFetchStream.getFullReader can only be called once."),this._fullRequestReader=new sb(this),this._fullRequestReader}getRangeReader(t,e){if(e<=this._progressiveDataLength)return null;const s=new ib(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 sb{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,Wf(s,this._withCredentials,this._abortController)).then(n=>{if(!$f(n.status))throw jc(n.status,i);this._reader=n.body.getReader(),this._headersCapability.resolve();const r=n.headers,{allowRangeRequests:o,suggestedLength:c}=Wd({responseHeaders:r,isHttp:t.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=o,this._contentLength=c||this._contentLength,this._filename=Gd(r),!this._isStreamingSupported&&this._isRangeSupported&&this.cancel(new cr("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:Gf(t),done:!1})}cancel(t){var e;(e=this._reader)==null||e.cancel(t),this._abortController.abort()}}class ib{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 n=new Headers(t.headers);n.append("Range",`bytes=${e}-${s-1}`);const r=i.url;fetch(r,Wf(n,this._withCredentials,this._abortController)).then(o=>{if(!$f(o.status))throw jc(o.status,r);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:Gf(t),done:!1})}cancel(t){var e;(e=this._reader)==null||e.cancel(t),this._abortController.abort()}}const Zc=200,Qc=206;function nb(l){const t=l.response;return typeof t!="string"?t:Nc(t).buffer}class rb{constructor({url:t,httpHeaders:e,withCredentials:s}){this.url=t,this.isHttp=/^https?:/i.test(t),this.headers=$d(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 n in s)i[n]=s[n];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[n,r]of this.headers)e.setRequestHeader(n,r);return this.isHttp&&"begin"in t&&"end"in t?(e.setRequestHeader("Range",`bytes=${t.begin}-${t.end-1}`),i.expectedStatus=Qc):i.expectedStatus=Zc,e.responseType="arraybuffer",t.onError&&(e.onerror=function(n){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 c,h,d;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){(c=s.onError)==null||c.call(s,i.status);return}const n=i.status||Zc;if(!(n===Zc&&s.expectedStatus===Qc)&&n!==s.expectedStatus){(h=s.onError)==null||h.call(s,i.status);return}const o=nb(i);if(n===Qc){const u=i.getResponseHeader("Content-Range"),f=/bytes (\d+)-(\d+)\/(\d+)/.exec(u);s.onDone({begin:parseInt(f[1],10),chunk:o})}else o?s.onDone({begin:0,chunk:o}):(d=s.onError)==null||d.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 ab{constructor(t){this._source=t,this._manager=new rb(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 zt(!this._fullRequestReader,"PDFNetworkStream.getFullReader can only be called once."),this._fullRequestReader=new ob(this._manager,this._source),this._fullRequestReader}getRangeReader(t,e){const s=new lb(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 ob{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),s=new Headers(e.getAllResponseHeaders().trim().split(/[\r\n]+/).map(r=>{const[o,...c]=r.split(": ");return[o,c.join(": ")]})),{allowRangeRequests:i,suggestedLength:n}=Wd({responseHeaders:s,isHttp:this._manager.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});i&&(this._isRangeSupported=!0),this._contentLength=n||this._contentLength,this._filename=Gd(s),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=jc(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(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 lb{constructor(t,e,s){this._manager=t;const i={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}_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=jc(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 cb=/^[a-z][a-z0-9\-+.]+:/i;function hb(l){if(cb.test(l))return new URL(l);const t=Ui.get("url");return new URL(t.pathToFileURL(l))}function Uf(l,t,e){return l.protocol==="http:"?Ui.get("http").request(l,{headers:t},e):Ui.get("https").request(l,{headers:t},e)}class db{constructor(t){this.source=t,this.url=hb(t.url),this.isHttp=this.url.protocol==="http:"||this.url.protocol==="https:",this.isFsUrl=this.url.protocol==="file:",this.headers=$d(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 zt(!this._fullRequestReader,"PDFNodeStream.getFullReader can only be called once."),this._fullRequestReader=this.isFsUrl?new pb(this):new ub(this),this._fullRequestReader}getRangeReader(t,e){if(e<=this._progressiveDataLength)return null;const s=this.isFsUrl?new gb(this,t,e):new fb(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 Vf{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()}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 cr("streaming is disabled")),this._storedError&&this._readableStream.destroy(this._storedError)}}class Xf{constructor(t){this._url=t.url,this._done=!1,this._storedError=null,this.onProgress=null,this._loaded=0,this._readableStream=null,this._readCapability=Promise.withResolvers();const e=t.source;this._isStreamingSupported=!e.disableStream}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)}}class ub extends Vf{constructor(t){super(t);const e=Object.fromEntries(t.headers),s=i=>{if(i.statusCode===404){const c=new lr(`Missing PDF "${this._url}".`);this._storedError=c,this._headersCapability.reject(c);return}this._headersCapability.resolve(),this._setReadableStream(i);const n=new Headers(this._readableStream.headers),{allowRangeRequests:r,suggestedLength:o}=Wd({responseHeaders:n,isHttp:t.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=r,this._contentLength=o||this._contentLength,this._filename=Gd(n)};this._request=Uf(this._url,e,s),this._request.on("error",i=>{this._storedError=i,this._headersCapability.reject(i)}),this._request.end()}}class fb extends Xf{constructor(t,e,s){super(t);const i=Object.fromEntries(t.headers);i.Range=`bytes=${e}-${s-1}`;const n=r=>{if(r.statusCode===404){const o=new lr(`Missing PDF "${this._url}".`);this._storedError=o;return}this._setReadableStream(r)};this._request=Uf(this._url,i,n),this._request.on("error",r=>{this._storedError=r}),this._request.end()}}class pb extends Vf{constructor(t){super(t);const e=Ui.get("fs");e.promises.lstat(this._url).then(s=>{this._contentLength=s.size,this._setReadableStream(e.createReadStream(this._url)),this._headersCapability.resolve()},s=>{s.code==="ENOENT"&&(s=new lr(`Missing PDF "${this._url}".`)),this._storedError=s,this._headersCapability.reject(s)})}}class gb extends Xf{constructor(t,e,s){super(t);const i=Ui.get("fs");this._setReadableStream(i.createReadStream(this._url,{start:e,end:s-1}))}}const mb=1e5,ve=30,bb=.8;var Xu,Pi,we,Io,Mo,xn,Ws,ko,Lo,Cn,Xr,qr,Ii,Yr,Fo,Kr,Tn,Do,Oo,Ct,Rn,Pn,No,Mi,Zr,ui,qf,Yf,jh,Be,Wl,zh,Kf,Zf;let Bh=(Ct=class{constructor({textContentSource:t,container:e,viewport:s}){v(this,ui);v(this,Pi,Promise.withResolvers());v(this,we,null);v(this,Io,!1);v(this,Mo,!!((Xu=globalThis.FontInspector)!=null&&Xu.enabled));v(this,xn,null);v(this,Ws,null);v(this,ko,0);v(this,Lo,0);v(this,Cn,null);v(this,Xr,null);v(this,qr,0);v(this,Ii,0);v(this,Yr,Object.create(null));v(this,Fo,[]);v(this,Kr,null);v(this,Tn,[]);v(this,Do,new WeakMap);v(this,Oo,null);var c;if(t instanceof ReadableStream)m(this,Kr,t);else if(typeof t=="object")m(this,Kr,new ReadableStream({start(h){h.enqueue(t),h.close()}}));else throw new Error('No "textContentSource" parameter specified.');m(this,we,m(this,Xr,e)),m(this,Ii,s.scale*(globalThis.devicePixelRatio||1)),m(this,qr,s.rotation),m(this,Ws,{div:null,properties:null,ctx:null});const{pageWidth:i,pageHeight:n,pageX:r,pageY:o}=s.rawDims;m(this,Oo,[1,0,0,-1,-r,o+n]),m(this,Lo,i),m(this,ko,n),A(c=Ct,Be,Kf).call(c),sr(e,s),a(this,Pi).promise.finally(()=>{a(Ct,Zr).delete(this),m(this,Ws,null),m(this,Yr,null)}).catch(()=>{})}static get fontFamilyMap(){const{isWindows:t,isFirefox:e}=me.platform;return it(this,"fontFamilyMap",new Map([["sans-serif",`${t&&e?"Calibri, ":""}sans-serif`],["monospace",`${t&&e?"Lucida Console, ":""}monospace`]]))}render(){const t=()=>{a(this,Cn).read().then(({value:e,done:s})=>{if(s){a(this,Pi).resolve();return}a(this,xn)??m(this,xn,e.lang),Object.assign(a(this,Yr),e.styles),A(this,ui,qf).call(this,e.items),t()},a(this,Pi).reject)};return m(this,Cn,a(this,Kr).getReader()),a(Ct,Zr).add(this),t(),a(this,Pi).promise}update({viewport:t,onBefore:e=null}){var n;const s=t.scale*(globalThis.devicePixelRatio||1),i=t.rotation;if(i!==a(this,qr)&&(e==null||e(),m(this,qr,i),sr(a(this,Xr),{rotation:i})),s!==a(this,Ii)){e==null||e(),m(this,Ii,s);const r={div:null,properties:null,ctx:A(n=Ct,Be,Wl).call(n,a(this,xn))};for(const o of a(this,Tn))r.properties=a(this,Do).get(o),r.div=o,A(this,ui,jh).call(this,r)}}cancel(){var e;const t=new cr("TextLayer task cancelled.");(e=a(this,Cn))==null||e.cancel(t).catch(()=>{}),m(this,Cn,null),a(this,Pi).reject(t)}get textDivs(){return a(this,Tn)}get textContentItemsStr(){return a(this,Fo)}static cleanup(){if(!(a(this,Zr).size>0)){a(this,Rn).clear();for(const{canvas:t}of a(this,Pn).values())t.remove();a(this,Pn).clear()}}},Pi=new WeakMap,we=new WeakMap,Io=new WeakMap,Mo=new WeakMap,xn=new WeakMap,Ws=new WeakMap,ko=new WeakMap,Lo=new WeakMap,Cn=new WeakMap,Xr=new WeakMap,qr=new WeakMap,Ii=new WeakMap,Yr=new WeakMap,Fo=new WeakMap,Kr=new WeakMap,Tn=new WeakMap,Do=new WeakMap,Oo=new WeakMap,Rn=new WeakMap,Pn=new WeakMap,No=new WeakMap,Mi=new WeakMap,Zr=new WeakMap,ui=new WeakSet,qf=function(t){var i,n;if(a(this,Io))return;(n=a(this,Ws)).ctx??(n.ctx=A(i=Ct,Be,Wl).call(i,a(this,xn)));const e=a(this,Tn),s=a(this,Fo);for(const r of t){if(e.length>mb){tt("Ignoring additional textDivs for performance reasons."),m(this,Io,!0);return}if(r.str===void 0){if(r.type==="beginMarkedContentProps"||r.type==="beginMarkedContent"){const o=a(this,we);m(this,we,document.createElement("span")),a(this,we).classList.add("markedContent"),r.id!==null&&a(this,we).setAttribute("id",`${r.id}`),o.append(a(this,we))}else r.type==="endMarkedContent"&&m(this,we,a(this,we).parentNode);continue}s.push(r.str),A(this,ui,Yf).call(this,r)}},Yf=function(t){var g;const e=document.createElement("span"),s={angle:0,canvasWidth:0,hasText:t.str!=="",hasEOL:t.hasEOL,fontSize:0};a(this,Tn).push(e);const i=$.transform(a(this,Oo),t.transform);let n=Math.atan2(i[1],i[0]);const r=a(this,Yr)[t.fontName];r.vertical&&(n+=Math.PI/2);let o=a(this,Mo)&&r.fontSubstitution||r.fontFamily;o=Ct.fontFamilyMap.get(o)||o;const c=Math.hypot(i[2],i[3]),h=c*A(g=Ct,Be,Zf).call(g,o,a(this,xn));let d,u;n===0?(d=i[4],u=i[5]-h):(d=i[4]+h*Math.sin(n),u=i[5]-h*Math.cos(n));const f="calc(var(--scale-factor)*",p=e.style;a(this,we)===a(this,Xr)?(p.left=`${(100*d/a(this,Lo)).toFixed(2)}%`,p.top=`${(100*u/a(this,ko)).toFixed(2)}%`):(p.left=`${f}${d.toFixed(2)}px)`,p.top=`${f}${u.toFixed(2)}px)`),p.fontSize=`${f}${(a(Ct,Mi)*c).toFixed(2)}px)`,p.fontFamily=o,s.fontSize=c,e.setAttribute("role","presentation"),e.textContent=t.str,e.dir=t.dir,a(this,Mo)&&(e.dataset.fontName=r.fontSubstitutionLoadedName||t.fontName),n!==0&&(s.angle=n*(180/Math.PI));let b=!1;if(t.str.length>1)b=!0;else if(t.str!==" "&&t.transform[0]!==t.transform[3]){const _=Math.abs(t.transform[0]),y=Math.abs(t.transform[3]);_!==y&&Math.max(_,y)/Math.min(_,y)>1.5&&(b=!0)}if(b&&(s.canvasWidth=r.vertical?t.height:t.width),a(this,Do).set(e,s),a(this,Ws).div=e,a(this,Ws).properties=s,A(this,ui,jh).call(this,a(this,Ws)),s.hasText&&a(this,we).append(e),s.hasEOL){const _=document.createElement("br");_.setAttribute("role","presentation"),a(this,we).append(_)}},jh=function(t){var o;const{div:e,properties:s,ctx:i}=t,{style:n}=e;let r="";if(a(Ct,Mi)>1&&(r=`scale(${1/a(Ct,Mi)})`),s.canvasWidth!==0&&s.hasText){const{fontFamily:c}=n,{canvasWidth:h,fontSize:d}=s;A(o=Ct,Be,zh).call(o,i,d*a(this,Ii),c);const{width:u}=i.measureText(e.textContent);u>0&&(r=`scaleX(${h*a(this,Ii)/u}) ${r}`)}s.angle!==0&&(r=`rotate(${s.angle}deg) ${r}`),r.length>0&&(n.transform=r)},Be=new WeakSet,Wl=function(t=null){let e=a(this,Pn).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}),a(this,Pn).set(t,e),a(this,No).set(e,{size:0,family:""})}return e},zh=function(t,e,s){const i=a(this,No).get(t);e===i.size&&s===i.family||(t.font=`${e}px ${s}`,i.size=e,i.family=s)},Kf=function(){if(a(this,Mi)!==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),m(this,Mi,t.getBoundingClientRect().height),t.remove()},Zf=function(t,e){const s=a(this,Rn).get(t);if(s)return s;const i=A(this,Be,Wl).call(this,e);i.canvas.width=i.canvas.height=ve,A(this,Be,zh).call(this,i,ve,t);const n=i.measureText("");let r=n.fontBoundingBoxAscent,o=Math.abs(n.fontBoundingBoxDescent);if(r){const d=r/(r+o);return a(this,Rn).set(t,d),i.canvas.width=i.canvas.height=0,d}i.strokeStyle="red",i.clearRect(0,0,ve,ve),i.strokeText("g",0,0);let c=i.getImageData(0,0,ve,ve).data;o=0;for(let d=c.length-1-3;d>=0;d-=4)if(c[d]>0){o=Math.ceil(d/4/ve);break}i.clearRect(0,0,ve,ve),i.strokeText("A",0,ve),c=i.getImageData(0,0,ve,ve).data,r=0;for(let d=0,u=c.length;d<u;d+=4)if(c[d]>0){r=ve-Math.floor(d/4/ve);break}i.canvas.width=i.canvas.height=0;const h=r?r/(r+o):bb;return a(this,Rn).set(t,h),h},v(Ct,Be),v(Ct,Rn,new Map),v(Ct,Pn,new Map),v(Ct,No,new WeakMap),v(Ct,Mi,null),v(Ct,Zr,new Set),Ct);class to{static textContent(t){const e=[],s={items:e,styles:Object.create(null)};function i(n){var c;if(!n)return;let r=null;const o=n.name;if(o==="#text")r=n.value;else if(to.shouldBuildText(o))(c=n==null?void 0:n.attributes)!=null&&c.textContent?r=n.attributes.textContent:n.value&&(r=n.value);else return;if(r!==null&&e.push({str:r}),!!n.children)for(const h of n.children)i(h)}return i(t),s}static shouldBuildText(t){return!(t==="textarea"||t==="input"||t==="option"||t==="select")}}const Ab=65536,vb=100,yb=5e3,_b=de?Lm:Im,wb=de?Fm:Lf,Eb=de?km:Mm,Sb=de?Dm:Nf;function xb(l={}){typeof l=="string"||l instanceof URL?l={url:l}:(l instanceof ArrayBuffer||ArrayBuffer.isView(l))&&(l={data:l});const t=new $h,{docId:e}=t,s=l.url?Cb(l.url):null,i=l.data?Tb(l.data):null,n=l.httpHeaders||null,r=l.withCredentials===!0,o=l.password??null,c=l.range instanceof Qf?l.range:null,h=Number.isInteger(l.rangeChunkSize)&&l.rangeChunkSize>0?l.rangeChunkSize:Ab;let d=l.worker instanceof Tr?l.worker:null;const u=l.verbosity,f=typeof l.docBaseUrl=="string"&&!Bc(l.docBaseUrl)?l.docBaseUrl:null,p=typeof l.cMapUrl=="string"?l.cMapUrl:null,b=l.cMapPacked!==!1,g=l.CMapReaderFactory||wb,_=typeof l.standardFontDataUrl=="string"?l.standardFontDataUrl:null,y=l.StandardFontDataFactory||Sb,w=l.stopAtErrors!==!0,E=Number.isInteger(l.maxImageSize)&&l.maxImageSize>-1?l.maxImageSize:-1,x=l.isEvalSupported!==!1,S=typeof l.isOffscreenCanvasSupported=="boolean"?l.isOffscreenCanvasSupported:!de,C=typeof l.isChrome=="boolean"?l.isChrome:!me.platform.isFirefox&&typeof window<"u"&&!!(window!=null&&window.chrome),T=Number.isInteger(l.canvasMaxAreaInBytes)?l.canvasMaxAreaInBytes:-1,R=typeof l.disableFontFace=="boolean"?l.disableFontFace:de,I=l.fontExtraProperties===!0,D=l.enableXfa===!0,M=l.ownerDocument||globalThis.document,L=l.disableRange===!0,j=l.disableStream===!0,O=l.disableAutoFetch===!0,U=l.pdfBug===!0,G=l.CanvasFactory||_b,N=l.FilterFactory||Eb,z=l.enableHWA===!0,It=c?c.length:l.length??NaN,Mt=typeof l.useSystemFonts=="boolean"?l.useSystemFonts:!de&&!R,Tt=typeof l.useWorkerFetch=="boolean"?l.useWorkerFetch:g===Lf&&y===Nf&&p&&_&&Da(p,document.baseURI)&&Da(_,document.baseURI);l.canvasFactory&&lu("`canvasFactory`-instance option, please use `CanvasFactory` instead."),l.filterFactory&&lu("`filterFactory`-instance option, please use `FilterFactory` instead.");const ot=null;om(u);const nt={canvasFactory:new G({ownerDocument:M,enableHWA:z}),filterFactory:new N({docId:e,ownerDocument:M}),cMapReaderFactory:Tt?null:new g({baseUrl:p,isCompressed:b}),standardFontDataFactory:Tt?null:new y({baseUrl:_})};if(!d){const bt={verbosity:u,port:oi.workerPort};d=bt.port?Tr.fromPort(bt):new Tr(bt),t._worker=d}const St={docId:e,apiVersion:"4.8.69",data:i,password:o,disableAutoFetch:O,rangeChunkSize:h,length:It,docBaseUrl:f,enableXfa:D,evaluatorOptions:{maxImageSize:E,disableFontFace:R,ignoreErrors:w,isEvalSupported:x,isOffscreenCanvasSupported:S,isChrome:C,canvasMaxAreaInBytes:T,fontExtraProperties:I,useSystemFonts:Mt,cMapUrl:Tt?p:null,standardFontDataUrl:Tt?_:null}},se={disableFontFace:R,fontExtraProperties:I,ownerDocument:M,pdfBug:U,styleElement:ot,loadingParams:{disableAutoFetch:O,enableXfa:D}};return d.promise.then(function(){if(t.destroyed)throw new Error("Loading aborted");if(d.destroyed)throw new Error("Worker was destroyed");const bt=d.messageHandler.sendWithPromise("GetDocRequest",St,i?[i.buffer]:null);let V;if(c)V=new Qm(c,{disableRange:L,disableStream:j});else if(!i){if(!s)throw new Error("getDocument - no `url` parameter provided.");let Ot;de?Ot=typeof fetch<"u"&&typeof Response<"u"&&"body"in Response.prototype&&Da(s)?yu:db:Ot=Da(s)?yu:ab,V=new Ot({url:s,length:It,httpHeaders:n,withCredentials:r,rangeChunkSize:h,disableRange:L,disableStream:j})}return bt.then(Ot=>{if(t.destroyed)throw new Error("Loading aborted");if(d.destroyed)throw new Error("Worker was destroyed");const Kt=new $a(e,Ot,d.port),ft=new Mb(Kt,t,V,se,nt);t._transport=ft,Kt.send("Ready",null)})}).catch(t._capability.reject),t}function Cb(l){if(l instanceof URL)return l.href;try{return new URL(l,window.location).href}catch{if(de&&typeof l=="string")return l}throw new Error("Invalid PDF url data: either string or URL-object is expected in the url property.")}function Tb(l){if(de&&typeof Buffer<"u"&&l instanceof Buffer)throw new Error("Please provide binary data as `Uint8Array`, rather than `Buffer`.");if(l instanceof Uint8Array&&l.byteLength===l.buffer.byteLength)return l;if(typeof l=="string")return Nc(l);if(l instanceof ArrayBuffer||ArrayBuffer.isView(l)||typeof l=="object"&&!isNaN(l==null?void 0:l.length))return new Uint8Array(l);throw new Error("Invalid PDF binary data: either TypedArray, string, or array-like object is expected in the data property.")}function _u(l){return typeof l=="object"&&Number.isInteger(l==null?void 0:l.num)&&l.num>=0&&Number.isInteger(l==null?void 0:l.gen)&&l.gen>=0}var xc;const Cc=class Cc{constructor(){this._capability=Promise.withResolvers(),this._transport=null,this._worker=null,this.docId=`d${ue(Cc,xc)._++}`,this.destroyed=!1,this.onPassword=null,this.onProgress=null}get promise(){return this._capability.promise}async destroy(){var t,e,s;this.destroyed=!0;try{(t=this._worker)!=null&&t.port&&(this._worker._pendingDestroy=!0),await((e=this._transport)==null?void 0:e.destroy())}catch(i){throw(s=this._worker)!=null&&s.port&&delete this._worker._pendingDestroy,i}this._transport=null,this._worker&&(this._worker.destroy(),this._worker=null)}};xc=new WeakMap,v(Cc,xc,0);let $h=Cc,Qf=class{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){At("Abstract method PDFDataRangeTransport.requestDataRange")}abort(){}};class Rb{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 it(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 ki,Gs,Ve,yr,Gl;class Pb{constructor(t,e,s,i=!1){v(this,Ve);v(this,ki,null);v(this,Gs,!1);this._pageIndex=t,this._pageInfo=e,this._transport=s,this._stats=i?new ou:null,this._pdfBug=i,this.commonObjs=s.commonObjs,this.objs=new Jf,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:n=!1}={}){return new Al({viewBox:this.view,scale:t,rotation:e,offsetX:s,offsetY:i,dontFlip:n})}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 it(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=mi.ENABLE,transform:n=null,background:r=null,optionalContentConfigPromise:o=null,annotationCanvasMap:c=null,pageColors:h=null,printAnnotationStorage:d=null,isEditing:u=!1}){var x,S;(x=this._stats)==null||x.time("Overall");const f=this._transport.getRenderingIntent(s,i,d,u),{renderingIntent:p,cacheKey:b}=f;m(this,Gs,!1),A(this,Ve,Gl).call(this),o||(o=this._transport.getOptionalContentConfig(p));let g=this._intentStates.get(b);g||(g=Object.create(null),this._intentStates.set(b,g)),g.streamReaderCancelTimeout&&(clearTimeout(g.streamReaderCancelTimeout),g.streamReaderCancelTimeout=null);const _=!!(p&Oe.PRINT);g.displayReadyCapability||(g.displayReadyCapability=Promise.withResolvers(),g.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},(S=this._stats)==null||S.time("Page Request"),this._pumpOperatorList(f));const y=C=>{var T;g.renderTasks.delete(w),(this._maybeCleanupAfterRender||_)&&m(this,Gs,!0),A(this,Ve,yr).call(this,!_),C?(w.capability.reject(C),this._abortOperatorList({intentState:g,reason:C instanceof Error?C:new Error(C)})):w.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))},w=new Gh({callback:y,params:{canvasContext:t,viewport:e,transform:n,background:r},objs:this.objs,commonObjs:this.commonObjs,annotationCanvasMap:c,operatorList:g.operatorList,pageIndex:this._pageIndex,canvasFactory:this._transport.canvasFactory,filterFactory:this._transport.filterFactory,useRequestAnimationFrame:!_,pdfBug:this._pdfBug,pageColors:h});(g.renderTasks||(g.renderTasks=new Set)).add(w);const E=w.task;return Promise.all([g.displayReadyCapability.promise,o]).then(([C,T])=>{var R;if(this.destroyed){y();return}if((R=this._stats)==null||R.time("Rendering"),!(T.renderingIntent&p))throw new Error("Must use the same `intent`-argument when calling the `PDFPageProxy.render` and `PDFDocumentProxy.getOptionalContentConfig` methods.");w.initializeGraphics({transparency:C,optionalContentConfig:T}),w.operatorListChanged()}).catch(y),E}getOperatorList({intent:t="display",annotationMode:e=mi.ENABLE,printAnnotationStorage:s=null,isEditing:i=!1}={}){var h;function n(){o.operatorList.lastChunk&&(o.opListReadCapability.resolve(o.operatorList),o.renderTasks.delete(c))}const r=this._transport.getRenderingIntent(t,e,s,i,!0);let o=this._intentStates.get(r.cacheKey);o||(o=Object.create(null),this._intentStates.set(r.cacheKey,o));let c;return o.opListReadCapability||(c=Object.create(null),c.operatorListChanged=n,o.opListReadCapability=Promise.withResolvers(),(o.renderTasks||(o.renderTasks=new Set)).add(c),o.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},(h=this._stats)==null||h.time("Page Request"),this._pumpOperatorList(r)),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=>to.textContent(s));const e=this.streamTextContent(t);return new Promise(function(s,i){function n(){r.read().then(function({value:c,done:h}){if(h){s(o);return}o.lang??(o.lang=c.lang),Object.assign(o.styles,c.styles),o.items.push(...c.items),n()},i)}const r=e.getReader(),o={items:[],styles:Object.create(null),lang:null};n()})}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(),m(this,Gs,!1),A(this,Ve,Gl).call(this),Promise.all(t)}cleanup(t=!1){m(this,Gs,!0);const e=A(this,Ve,yr).call(this,!1);return t&&e&&this._stats&&(this._stats=new ou),e}_startRenderPage(t,e){var i,n;const s=this._intentStates.get(e);s&&((i=this._stats)==null||i.timeEnd("Page Request"),(n=s.displayReadyCapability)==null||n.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&&A(this,Ve,yr).call(this,!0)}_pumpOperatorList({renderingIntent:t,cacheKey:e,annotationStorageSerializable:s,modifiedIds:i}){const{map:n,transfer:r}=s,c=this._transport.messageHandler.sendWithStream("GetOperatorList",{pageIndex:this._pageIndex,intent:t,cacheKey:e,annotationStorage:n,modifiedIds:i},r).getReader(),h=this._intentStates.get(e);h.streamReader=c;const d=()=>{c.read().then(({value:u,done:f})=>{if(f){h.streamReader=null;return}this._transport.destroyed||(this._renderPageChunk(u,h),d())},u=>{if(h.streamReader=null,!this._transport.destroyed){if(h.operatorList){h.operatorList.lastChunk=!0;for(const f of h.renderTasks)f.operatorListChanged();A(this,Ve,yr).call(this,!0)}if(h.displayReadyCapability)h.displayReadyCapability.reject(u);else if(h.opListReadCapability)h.opListReadCapability.reject(u);else throw u}})};d()}_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 Od){let i=vb;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 cr(e.message)).catch(()=>{}),t.streamReader=null,!this._transport.destroyed){for(const[i,n]of this._intentStates)if(n===t){this._intentStates.delete(i);break}this.cleanup()}}}get stats(){return this._stats}}ki=new WeakMap,Gs=new WeakMap,Ve=new WeakSet,yr=function(t=!1){if(A(this,Ve,Gl).call(this),!a(this,Gs)||this.destroyed)return!1;if(t)return m(this,ki,setTimeout(()=>{m(this,ki,null),A(this,Ve,yr).call(this,!1)},yb)),!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(),m(this,Gs,!1),!0},Gl=function(){a(this,ki)&&(clearTimeout(a(this,ki)),m(this,ki,null))};var Us,Tc;class Ib{constructor(){v(this,Us,new Map);v(this,Tc,Promise.resolve())}postMessage(t,e){const s={data:structuredClone(t,e?{transfer:e}:null)};a(this,Tc).then(()=>{for(const[i]of a(this,Us))i.call(this,s)})}addEventListener(t,e,s=null){let i=null;if((s==null?void 0:s.signal)instanceof AbortSignal){const{signal:n}=s;if(n.aborted){tt("LoopbackPort - cannot use an `aborted` signal.");return}const r=()=>this.removeEventListener(t,e);i=()=>n.removeEventListener("abort",r),n.addEventListener("abort",r)}a(this,Us).set(e,i)}removeEventListener(t,e){const s=a(this,Us).get(e);s==null||s(),a(this,Us).delete(e)}terminate(){for(const[,t]of a(this,Us))t==null||t();a(this,Us).clear()}}Us=new WeakMap,Tc=new WeakMap;var Rc,In,Mn,Qr,Ul,Jr,Vl;const vt=class vt{constructor({name:t=null,port:e=null,verbosity:s=lm()}={}){v(this,Qr);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=a(vt,Mn))!=null&&i.has(e))throw new Error("Cannot use more than one PDFWorker per port.");(a(vt,Mn)||m(vt,Mn,new WeakMap)).set(e,this),this._initializeFromPort(e);return}this._initialize()}get promise(){return de?Promise.all([Ui.promise,this._readyCapability.promise]):this._readyCapability.promise}get port(){return this._port}get messageHandler(){return this._messageHandler}_initializeFromPort(t){this._port=t,this._messageHandler=new $a("main","worker",t),this._messageHandler.on("ready",function(){}),A(this,Qr,Ul).call(this)}_initialize(){if(a(vt,In)||a(vt,Jr,Vl)){this._setupFakeWorker();return}let{workerSrc:t}=vt;try{vt._isSameOrigin(window.location.href,t)||(t=vt._createCDNWrapper(new URL(t,window.location).href));const e=new Worker(t,{type:"module"}),s=new $a("main","worker",e),i=()=>{n.abort(),s.destroy(),e.terminate(),this.destroyed?this._readyCapability.reject(new Error("Worker was destroyed")):this._setupFakeWorker()},n=new AbortController;e.addEventListener("error",()=>{this._webWorker||i()},{signal:n.signal}),s.on("test",o=>{if(n.abort(),this.destroyed||!o){i();return}this._messageHandler=s,this._port=e,this._webWorker=e,A(this,Qr,Ul).call(this)}),s.on("ready",o=>{if(n.abort(),this.destroyed){i();return}try{r()}catch{this._setupFakeWorker()}});const r=()=>{const o=new Uint8Array;s.send("test",o,[o.buffer])};r();return}catch{Dc("The worker has been disabled.")}this._setupFakeWorker()}_setupFakeWorker(){a(vt,In)||(tt("Setting up fake worker."),m(vt,In,!0)),vt._setupFakeWorkerGlobal.then(t=>{if(this.destroyed){this._readyCapability.reject(new Error("Worker was destroyed"));return}const e=new Ib;this._port=e;const s=`fake${ue(vt,Rc)._++}`,i=new $a(s+"_worker",s,e);t.setup(i,e),this._messageHandler=new $a(s,s+"_worker",e),A(this,Qr,Ul).call(this)}).catch(t=>{this._readyCapability.reject(new Error(`Setting up fake worker failed: "${t.message}".`))})}destroy(){var t;this.destroyed=!0,this._webWorker&&(this._webWorker.terminate(),this._webWorker=null),(t=a(vt,Mn))==null||t.delete(this._port),this._port=null,this._messageHandler&&(this._messageHandler.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=a(this,Mn))==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 vt(t)}static get workerSrc(){if(oi.workerSrc)return oi.workerSrc;throw new Error('No "GlobalWorkerOptions.workerSrc" specified.')}static get _setupFakeWorkerGlobal(){return it(this,"_setupFakeWorkerGlobal",(async()=>a(this,Jr,Vl)?a(this,Jr,Vl):(await import(this.workerSrc)).WorkerMessageHandler)())}};Rc=new WeakMap,In=new WeakMap,Mn=new WeakMap,Qr=new WeakSet,Ul=function(){this._readyCapability.resolve(),this._messageHandler.send("configure",{verbosity:this.verbosity})},Jr=new WeakSet,Vl=function(){var t;try{return((t=globalThis.pdfjsWorker)==null?void 0:t.WorkerMessageHandler)||null}catch{return null}},v(vt,Jr),v(vt,Rc,0),v(vt,In,!1),v(vt,Mn),de&&(m(vt,In,!0),oi.workerSrc||(oi.workerSrc="./pdf.worker.mjs")),vt._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},vt._createCDNWrapper=t=>{const e=`await import("${t}");`;return URL.createObjectURL(new Blob([e],{type:"text/javascript"}))};let Tr=vt;var Vs,Es,ta,ea,Ss,kn,Wa;class Mb{constructor(t,e,s,i,n){v(this,kn);v(this,Vs,new Map);v(this,Es,new Map);v(this,ta,new Map);v(this,ea,new Map);v(this,Ss,null);this.messageHandler=t,this.loadingTask=e,this.commonObjs=new Jf,this.fontLoader=new Rm({ownerDocument:i.ownerDocument,styleElement:i.styleElement}),this.loadingParams=i.loadingParams,this._params=i,this.canvasFactory=n.canvasFactory,this.filterFactory=n.filterFactory,this.cMapReaderFactory=n.cMapReaderFactory,this.standardFontDataFactory=n.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 it(this,"annotationStorage",new jd)}getRenderingIntent(t,e=mi.ENABLE,s=null,i=!1,n=!1){let r=Oe.DISPLAY,o=Ih;switch(t){case"any":r=Oe.ANY;break;case"display":break;case"print":r=Oe.PRINT;break;default:tt(`getRenderingIntent - invalid intent: ${t}`)}const c=r&Oe.PRINT&&s instanceof If?s:this.annotationStorage;switch(e){case mi.DISABLE:r+=Oe.ANNOTATIONS_DISABLE;break;case mi.ENABLE:break;case mi.ENABLE_FORMS:r+=Oe.ANNOTATIONS_FORMS;break;case mi.ENABLE_STORAGE:r+=Oe.ANNOTATIONS_STORAGE,o=c.serializable;break;default:tt(`getRenderingIntent - invalid annotationMode: ${e}`)}i&&(r+=Oe.IS_EDITING),n&&(r+=Oe.OPLIST);const{ids:h,hash:d}=c.modifiedIds,u=[r,o.hash,d];return{renderingIntent:r,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=a(this,Ss))==null||s.reject(new Error("Worker was destroyed during onPassword callback"));const t=[];for(const i of a(this,Es).values())t.push(i._destroy());a(this,Es).clear(),a(this,ta).clear(),a(this,ea).clear(),this.hasOwnProperty("annotationStorage")&&this.annotationStorage.resetModified();const e=this.messageHandler.sendWithPromise("Terminate",null);return t.push(e),Promise.all(t).then(()=>{var i;this.commonObjs.clear(),this.fontLoader.clear(),a(this,Vs).clear(),this.filterFactory.destroy(),Bh.cleanup(),(i=this._networkStream)==null||i.cancelAllRequests(new cr("Worker was terminated.")),this.messageHandler&&(this.messageHandler.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)=>{zt(this._networkStream,"GetReader - no `IPDFStream` instance available."),this._fullReader=this._networkStream.getFullReader(),this._fullReader.onProgress=n=>{this._lastProgress={loaded:n.loaded,total:n.total}},i.onPull=()=>{this._fullReader.read().then(function({value:n,done:r}){if(r){i.close();return}zt(n instanceof ArrayBuffer,"GetReader - expected an ArrayBuffer."),i.enqueue(new Uint8Array(n),1,[n])}).catch(n=>{i.error(n)})},i.onCancel=n=>{this._fullReader.cancel(n),i.ready.catch(r=>{if(!this.destroyed)throw r})}}),t.on("ReaderHeadersReady",async s=>{var o;await this._fullReader.headersReady;const{isStreamingSupported:i,isRangeSupported:n,contentLength:r}=this._fullReader;return(!i||!n)&&(this._lastProgress&&((o=e.onProgress)==null||o.call(e,this._lastProgress)),this._fullReader.onProgress=c=>{var h;(h=e.onProgress)==null||h.call(e,{loaded:c.loaded,total:c.total})}),{isStreamingSupported:i,isRangeSupported:n,contentLength:r}}),t.on("GetRangeReader",(s,i)=>{zt(this._networkStream,"GetRangeReader - no `IPDFStream` instance available.");const n=this._networkStream.getRangeReader(s.begin,s.end);if(!n){i.close();return}i.onPull=()=>{n.read().then(function({value:r,done:o}){if(o){i.close();return}zt(r instanceof ArrayBuffer,"GetRangeReader - expected an ArrayBuffer."),i.enqueue(new Uint8Array(r),1,[r])}).catch(r=>{i.error(r)})},i.onCancel=r=>{n.cancel(r),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 Rb(s,this))}),t.on("DocException",function(s){let i;switch(s.name){case"PasswordException":i=new lh(s.message,s.code);break;case"InvalidPDFException":i=new ef(s.message);break;case"MissingPDFException":i=new lr(s.message);break;case"UnexpectedResponseException":i=new Oc(s.message,s.status);break;case"UnknownErrorException":i=new ch(s.message,s.details);break;default:At("DocException - expected a valid Error.")}e._capability.reject(i)}),t.on("PasswordRequest",s=>{if(m(this,Ss,Promise.withResolvers()),e.onPassword){const i=n=>{n instanceof Error?a(this,Ss).reject(n):a(this,Ss).resolve({password:n})};try{e.onPassword(i,s.code)}catch(n){a(this,Ss).reject(n)}}else a(this,Ss).reject(new lh(s.message,s.code));return a(this,Ss).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;a(this,Es).get(s.pageIndex)._startRenderPage(s.transparency,s.cacheKey)}),t.on("commonobj",([s,i,n])=>{var r;if(this.destroyed||this.commonObjs.has(s))return null;switch(i){case"Font":const{disableFontFace:o,fontExtraProperties:c,pdfBug:h}=this._params;if("error"in n){const p=n.error;tt(`Error during font loading: ${p}`),this.commonObjs.resolve(s,p);break}const d=h&&((r=globalThis.FontInspector)!=null&&r.enabled)?(p,b)=>globalThis.FontInspector.fontAdded(p,b):null,u=new Pm(n,{disableFontFace:o,inspectFont:d});this.fontLoader.bind(u).catch(()=>t.sendWithPromise("FontFallback",{id:s})).finally(()=>{!c&&u.data&&(u.data=null),this.commonObjs.resolve(s,u)});break;case"CopyLocalImage":const{imageRef:f}=n;zt(f,"The imageRef must be defined.");for(const p of a(this,Es).values())for(const[,b]of p.objs)if((b==null?void 0:b.ref)===f)return b.dataLen?(this.commonObjs.resolve(s,structuredClone(b)),b.dataLen):null;break;case"FontPath":case"Image":case"Pattern":this.commonObjs.resolve(s,n);break;default:throw new Error(`Got unknown common object type ${i}`)}return null}),t.on("obj",([s,i,n,r])=>{var c;if(this.destroyed)return;const o=a(this,Es).get(i);if(!o.objs.has(s)){if(o._intentStates.size===0){(c=r==null?void 0:r.bitmap)==null||c.close();return}switch(n){case"Image":o.objs.resolve(s,r),(r==null?void 0:r.dataLen)>im&&(o._maybeCleanupAfterRender=!0);break;case"Pattern":o.objs.resolve(s,r);break;default:throw new Error(`Got unknown object type ${n}`)}}}),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&&tt("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=a(this,ta).get(e);if(s)return s;const i=this.messageHandler.sendWithPromise("GetPage",{pageIndex:e}).then(n=>{if(this.destroyed)throw new Error("Transport destroyed");n.refStr&&a(this,ea).set(n.refStr,t);const r=new Pb(e,n,this,this._params.pdfBug);return a(this,Es).set(e,r),r});return a(this,ta).set(e,i),i}getPageIndex(t){return _u(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 A(this,kn,Wa).call(this,"GetFieldObjects")}hasJSActions(){return A(this,kn,Wa).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 A(this,kn,Wa).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 A(this,kn,Wa).call(this,"GetOptionalContentConfig").then(e=>new Zm(e,t))}getPermissions(){return this.messageHandler.sendWithPromise("GetPermissions",null)}getMetadata(){const t="GetMetadata",e=a(this,Vs).get(t);if(e)return e;const s=this.messageHandler.sendWithPromise(t,null).then(i=>{var n,r;return{info:i[0],metadata:i[1]?new Ym(i[1]):null,contentDispositionFilename:((n=this._fullReader)==null?void 0:n.filename)??null,contentLength:((r=this._fullReader)==null?void 0:r.contentLength)??null}});return a(this,Vs).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 a(this,Es).values())if(!e.cleanup())throw new Error(`startCleanup: Page ${e.pageNumber} is currently rendering.`);this.commonObjs.clear(),t||this.fontLoader.clear(),a(this,Vs).clear(),this.filterFactory.destroy(!0),Bh.cleanup()}}cachedPageNumber(t){if(!_u(t))return null;const e=t.gen===0?`${t.num}R`:`${t.num}R${t.gen}`;return a(this,ea).get(e)??null}}Vs=new WeakMap,Es=new WeakMap,ta=new WeakMap,ea=new WeakMap,Ss=new WeakMap,kn=new WeakSet,Wa=function(t,e=null){const s=a(this,Vs).get(t);if(s)return s;const i=this.messageHandler.sendWithPromise(t,e);return a(this,Vs).set(t,i),i};const Ml=Symbol("INITIAL_DATA");var is,Ho,Wh;class Jf{constructor(){v(this,Ho);v(this,is,Object.create(null))}get(t,e=null){if(e){const i=A(this,Ho,Wh).call(this,t);return i.promise.then(()=>e(i.data)),null}const s=a(this,is)[t];if(!s||s.data===Ml)throw new Error(`Requesting object that isn't resolved yet ${t}.`);return s.data}has(t){const e=a(this,is)[t];return!!e&&e.data!==Ml}resolve(t,e=null){const s=A(this,Ho,Wh).call(this,t);s.data=e,s.resolve()}clear(){var t;for(const e in a(this,is)){const{data:s}=a(this,is)[e];(t=s==null?void 0:s.bitmap)==null||t.close()}m(this,is,Object.create(null))}*[Symbol.iterator](){for(const t in a(this,is)){const{data:e}=a(this,is)[t];e!==Ml&&(yield[t,e])}}}is=new WeakMap,Ho=new WeakSet,Wh=function(t){var e;return(e=a(this,is))[t]||(e[t]={...Promise.withResolvers(),data:Ml})};var Li;class kb{constructor(t){v(this,Li,null);m(this,Li,t),this.onContinue=null}get promise(){return a(this,Li).capability.promise}cancel(t=0){a(this,Li).cancel(null,t)}get separateAnnots(){const{separateAnnots:t}=a(this,Li).operatorList;if(!t)return!1;const{annotationCanvasMap:e}=a(this,Li);return t.form||t.canvas&&(e==null?void 0:e.size)>0}}Li=new WeakMap;var Fi,Ln;const nn=class nn{constructor({callback:t,params:e,objs:s,commonObjs:i,annotationCanvasMap:n,operatorList:r,pageIndex:o,canvasFactory:c,filterFactory:h,useRequestAnimationFrame:d=!1,pdfBug:u=!1,pageColors:f=null}){v(this,Fi,null);this.callback=t,this.params=e,this.objs=s,this.commonObjs=i,this.annotationCanvasMap=n,this.operatorListIdx=null,this.operatorList=r,this._pageIndex=o,this.canvasFactory=c,this.filterFactory=h,this._pdfBug=u,this.pageColors=f,this.running=!1,this.graphicsReadyCallback=null,this.graphicsReady=!1,this._useRequestAnimationFrame=d===!0&&typeof window<"u",this.cancelled=!1,this.capability=Promise.withResolvers(),this.task=new kb(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,c;if(this.cancelled)return;if(this._canvas){if(a(nn,Ln).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.");a(nn,Ln).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:n,background:r}=this.params;this.gfx=new Cr(s,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:e},this.annotationCanvasMap,this.pageColors),this.gfx.beginDrawing({transform:n,viewport:i,transparency:t,background:r}),this.operatorListIdx=0,this.graphicsReady=!0,(c=this.graphicsReadyCallback)==null||c.call(this)}cancel(t=null,e=0){var s;this.running=!1,this.cancelled=!0,(s=this.gfx)==null||s.endDrawing(),a(this,Fi)&&(window.cancelAnimationFrame(a(this,Fi)),m(this,Fi,null)),a(nn,Ln).delete(this._canvas),this.callback(t||new Od(`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?m(this,Fi,window.requestAnimationFrame(()=>{m(this,Fi,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(),a(nn,Ln).delete(this._canvas),this.callback())))}};Fi=new WeakMap,Ln=new WeakMap,v(nn,Ln,new WeakSet);let Gh=nn;const Lb="4.8.69",Fb="3634dab10";function wu(l){return Math.floor(Math.max(0,Math.min(1,l))*255).toString(16).padStart(2,"0")}function Fa(l){return Math.max(0,Math.min(255,255*l))}class Eu{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=Fa(t),[t,t,t]}static G_HTML([t]){const e=wu(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(Fa)}static RGB_HTML(t){return`#${t.map(wu).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[Fa(1-Math.min(1,t+i)),Fa(1-Math.min(1,s+i)),Fa(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,n=1-e,r=1-s,o=Math.min(i,n,r);return["CMYK",i,n,r,o]}}class Db{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){At("Abstract method `_createSVG` called.")}}class Ud extends Db{_createSVG(t){return document.createElementNS(Fs,t)}}class tp{static setupStorage(t,e,s,i,n){const r=i.getValue(e,{value:null});switch(s.name){case"textarea":if(r.value!==null&&(t.textContent=r.value),n==="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(r.value===s.attributes.xfaOn?t.setAttribute("checked",!0):r.value===s.attributes.xfaOff&&t.removeAttribute("checked"),n==="print")break;t.addEventListener("change",o=>{i.setValue(e,{value:o.target.checked?o.target.getAttribute("xfaOn"):o.target.getAttribute("xfaOff")})})}else{if(r.value!==null&&t.setAttribute("value",r.value),n==="print")break;t.addEventListener("input",o=>{i.setValue(e,{value:o.target.value})})}break;case"select":if(r.value!==null){t.setAttribute("value",r.value);for(const o of s.children)o.attributes.value===r.value?o.attributes.selected=!0:o.attributes.hasOwnProperty("selected")&&delete o.attributes.selected}t.addEventListener("input",o=>{const c=o.target.options,h=c.selectedIndex===-1?"":c[c.selectedIndex].value;i.setValue(e,{value:h})});break}}static setAttributes({html:t,element:e,storage:s=null,intent:i,linkService:n}){const{attributes:r}=e,o=t instanceof HTMLAnchorElement;r.type==="radio"&&(r.name=`${r.name}-${i}`);for(const[c,h]of Object.entries(r))if(h!=null)switch(c){case"class":h.length&&t.setAttribute(c,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||c!=="href"&&c!=="newWindow")&&t.setAttribute(c,h)}o&&n.addLinkAttributes(t,r.href,r.newWindow),s&&r.dataId&&this.setupStorage(t,r.dataId,e,s)}static render(t){var u,f;const e=t.annotationStorage,s=t.linkService,i=t.xfaHtml,n=t.intent||"display",r=document.createElement(i.name);i.attributes&&this.setAttributes({html:r,element:i,intent:n,linkService:s});const o=n!=="richText",c=t.div;if(c.append(r),t.viewport){const p=`matrix(${t.viewport.transform.join(",")})`;c.style.transform=p}o&&c.setAttribute("class","xfaLayer xfaFont");const h=[];if(i.children.length===0){if(i.value){const p=document.createTextNode(i.value);r.append(p),o&&to.shouldBuildText(i.name)&&h.push(p)}return{textDivs:h}}const d=[[i,-1,r]];for(;d.length>0;){const[p,b,g]=d.at(-1);if(b+1===p.children.length){d.pop();continue}const _=p.children[++d.at(-1)[1]];if(_===null)continue;const{name:y}=_;if(y==="#text"){const E=document.createTextNode(_.value);h.push(E),g.append(E);continue}const w=(u=_==null?void 0:_.attributes)!=null&&u.xmlns?document.createElementNS(_.attributes.xmlns,y):document.createElement(y);if(g.append(w),_.attributes&&this.setAttributes({html:w,element:_,storage:e,intent:n,linkService:s}),((f=_.children)==null?void 0:f.length)>0)d.push([_,-1,w]);else if(_.value){const E=document.createTextNode(_.value);o&&to.shouldBuildText(y)&&h.push(E),w.append(E)}}for(const p of c.querySelectorAll(".xfaNonInteractive input, .xfaNonInteractive textarea"))p.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 yl=1e3,Ob=9,nr=new WeakSet;function li(l){return{width:l[2]-l[0],height:l[3]-l[1]}}class Nb{static create(t){switch(t.data.annotationType){case Nt.LINK:return new ep(t);case Nt.TEXT:return new Hb(t);case Nt.WIDGET:switch(t.data.fieldType){case"Tx":return new Bb(t);case"Btn":return t.data.radioButton?new np(t):t.data.checkBox?new zb(t):new $b(t);case"Ch":return new Wb(t);case"Sig":return new jb(t)}return new hr(t);case Nt.POPUP:return new Vh(t);case Nt.FREETEXT:return new cp(t);case Nt.LINE:return new Ub(t);case Nt.SQUARE:return new Vb(t);case Nt.CIRCLE:return new Xb(t);case Nt.POLYLINE:return new hp(t);case Nt.CARET:return new Yb(t);case Nt.INK:return new Vd(t);case Nt.POLYGON:return new qb(t);case Nt.HIGHLIGHT:return new dp(t);case Nt.UNDERLINE:return new Kb(t);case Nt.SQUIGGLY:return new Zb(t);case Nt.STRIKEOUT:return new Qb(t);case Nt.STAMP:return new up(t);case Nt.FILEATTACHMENT:return new Jb(t);default:return new Pt(t)}}}var Fn,sa,ia,Bo,Uh;const Zd=class Zd{constructor(t,{isRenderable:e=!1,ignoreBorder:s=!1,createQuadrilaterals:i=!1}={}){v(this,Bo);v(this,Fn,null);v(this,sa,!1);v(this,ia,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 Zd._hasPopupData(this.data)}updateEdited(t){var s;if(!this.container)return;a(this,Fn)||m(this,Fn,{rect:this.data.rect.slice(0)});const{rect:e}=t;e&&A(this,Bo,Uh).call(this,e),(s=a(this,ia))==null||s.popup.updateEdited(t)}resetEdited(){var t;a(this,Fn)&&(A(this,Bo,Uh).call(this,a(this,Fn).rect),(t=a(this,ia))==null||t.popup.resetEdited(),m(this,Fn,null))}_createContainer(t){const{data:e,parent:{page:s,viewport:i}}=this,n=document.createElement("section");n.setAttribute("data-annotation-id",e.id),this instanceof hr||(n.tabIndex=yl);const{style:r}=n;if(r.zIndex=this.parent.zIndex++,e.alternativeText&&(n.title=e.alternativeText),e.noRotate&&n.classList.add("norotate"),!e.rect||this instanceof Vh){const{rotation:g}=e;return!e.hasOwnCanvas&&g!==0&&this.setRotation(g,n),n}const{width:o,height:c}=li(e.rect);if(!t&&e.borderStyle.width>0){r.borderWidth=`${e.borderStyle.width}px`;const g=e.borderStyle.horizontalCornerRadius,_=e.borderStyle.verticalCornerRadius;if(g>0||_>0){const w=`calc(${g}px * var(--scale-factor)) / calc(${_}px * var(--scale-factor))`;r.borderRadius=w}else if(this instanceof np){const w=`calc(${o}px * var(--scale-factor)) / calc(${c}px * var(--scale-factor))`;r.borderRadius=w}switch(e.borderStyle.style){case ka.SOLID:r.borderStyle="solid";break;case ka.DASHED:r.borderStyle="dashed";break;case ka.BEVELED:tt("Unimplemented border style: beveled");break;case ka.INSET:tt("Unimplemented border style: inset");break;case ka.UNDERLINE:r.borderBottomStyle="solid";break}const y=e.borderColor||null;y?(m(this,sa,!0),r.borderColor=$.makeHexColor(y[0]|0,y[1]|0,y[2]|0)):r.borderWidth=0}const h=$.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:d,pageHeight:u,pageX:f,pageY:p}=i.rawDims;r.left=`${100*(h[0]-f)/d}%`,r.top=`${100*(h[1]-p)/u}%`;const{rotation:b}=e;return e.hasOwnCanvas||b===0?(r.width=`${100*o/d}%`,r.height=`${100*c/u}%`):this.setRotation(b,n),n}setRotation(t,e=this.container){if(!this.data.rect)return;const{pageWidth:s,pageHeight:i}=this.parent.viewport.rawDims,{width:n,height:r}=li(this.data.rect);let o,c;t%180===0?(o=100*n/s,c=100*r/i):(o=100*r/s,c=100*n/i),e.style.width=`${o}%`,e.style.height=`${c}%`,e.setAttribute("data-main-rotation",(360-t)%360)}get _commonActions(){const t=(e,s,i)=>{const n=i.detail[e],r=n[0],o=n.slice(1);i.target.style[s]=Eu[`${r}_HTML`](o),this.annotationStorage.setValue(this.data.id,{[s]:Eu[`${r}_rgb`](o)})};return it(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 n=t[i]||s[i];n==null||n(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,n]of Object.entries(e)){const r=s[i];if(r){const o={detail:{[i]:n},target:t};r(o),delete e[i]}}}_createQuadrilaterals(){if(!this.container)return;const{quadPoints:t}=this.data;if(!t)return;const[e,s,i,n]=this.data.rect.map(g=>Math.fround(g));if(t.length===8){const[g,_,y,w]=t.subarray(2,6);if(i===g&&n===_&&e===y&&s===w)return}const{style:r}=this.container;let o;if(a(this,sa)){const{borderColor:g,borderWidth:_}=r;r.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="${g}" stroke-width="${_}">`],this.container.classList.add("hasBorder")}const c=i-e,h=n-s,{svgFactory:d}=this,u=d.createElement("svg");u.classList.add("quadrilateralsContainer"),u.setAttribute("width",0),u.setAttribute("height",0);const f=d.createElement("defs");u.append(f);const p=d.createElement("clipPath"),b=`clippath_${this.data.id}`;p.setAttribute("id",b),p.setAttribute("clipPathUnits","objectBoundingBox"),f.append(p);for(let g=2,_=t.length;g<_;g+=8){const y=t[g],w=t[g+1],E=t[g+2],x=t[g+3],S=d.createElement("rect"),C=(E-e)/c,T=(n-w)/h,R=(y-E)/c,I=(w-x)/h;S.setAttribute("x",C),S.setAttribute("y",T),S.setAttribute("width",R),S.setAttribute("height",I),p.append(S),o==null||o.push(`<rect vector-effect="non-scaling-stroke" x="${C}" y="${T}" width="${R}" height="${I}"/>`)}a(this,sa)&&(o.push("</g></svg>')"),r.backgroundImage=o.join("")),this.container.append(u),this.container.style.clipPath=`url(#${b})`}_createPopup(){const{data:t}=this,e=m(this,ia,new Vh({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(){At("Abstract method `AnnotationElement.render` called")}_getElementsByName(t,e=null){const s=[];if(this._fieldObjects){const i=this._fieldObjects[t];if(i)for(const{page:n,id:r,exportValues:o}of i){if(n===-1||r===e)continue;const c=typeof o=="string"?o:null,h=document.querySelector(`[data-element-id="${r}"]`);if(h&&!nr.has(h)){tt(`_getElementsByName - element not allowed: ${r}`);continue}s.push({id:r,exportValue:c,domElement:h})}return s}for(const i of document.getElementsByName(t)){const{exportValue:n}=i,r=i.getAttribute("data-element-id");r!==e&&nr.has(i)&&s.push({id:r,exportValue:n,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})})}};Fn=new WeakMap,sa=new WeakMap,ia=new WeakMap,Bo=new WeakSet,Uh=function(t){const{container:{style:e},data:{rect:s,rotation:i},parent:{viewport:{rawDims:{pageWidth:n,pageHeight:r,pageX:o,pageY:c}}}}=this;s==null||s.splice(0,4,...t);const{width:h,height:d}=li(t);e.left=`${100*(t[0]-o)/n}%`,e.top=`${100*(r-t[3]+c)/r}%`,i===0?(e.width=`${100*h/n}%`,e.height=`${100*d/r}%`):this.setRotation(i)};let Pt=Zd;var He,Zi,sp,ip;class ep extends Pt{constructor(e,s=null){super(e,{isRenderable:!0,ignoreBorder:!!(s!=null&&s.ignoreBorder),createQuadrilaterals:!0});v(this,He);this.isTooltipOnly=e.data.isTooltipOnly}render(){const{data:e,linkService:s}=this,i=document.createElement("a");i.setAttribute("data-element-id",e.id);let n=!1;return e.url?(s.addLinkAttributes(i,e.url,e.newWindow),n=!0):e.action?(this._bindNamedAction(i,e.action),n=!0):e.attachment?(A(this,He,sp).call(this,i,e.attachment,e.attachmentDest),n=!0):e.setOCGState?(A(this,He,ip).call(this,i,e.setOCGState),n=!0):e.dest?(this._bindLink(i,e.dest),n=!0):(e.actions&&(e.actions.Action||e.actions["Mouse Up"]||e.actions["Mouse Down"])&&this.enableScripting&&this.hasJSActions&&(this._bindJSAction(i,e),n=!0),e.resetForm?(this._bindResetFormAction(i,e.resetForm),n=!0):this.isTooltipOnly&&!n&&(this._bindLink(i,""),n=!0)),this.container.classList.add("linkAnnotation"),n&&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==="")&&A(this,He,Zi).call(this)}_bindNamedAction(e,s){e.href=this.linkService.getAnchorUrl(""),e.onclick=()=>(this.linkService.executeNamedAction(s),!1),A(this,He,Zi).call(this)}_bindJSAction(e,s){e.href=this.linkService.getAnchorUrl("");const i=new Map([["Action","onclick"],["Mouse Up","onmouseup"],["Mouse Down","onmousedown"]]);for(const n of Object.keys(s.actions)){const r=i.get(n);r&&(e[r]=()=>{var o;return(o=this.linkService.eventBus)==null||o.dispatch("dispatcheventinsandbox",{source:this,detail:{id:s.id,name:n}}),!1})}e.onclick||(e.onclick=()=>!1),A(this,He,Zi).call(this)}_bindResetFormAction(e,s){const i=e.onclick;if(i||(e.href=this.linkService.getAnchorUrl("")),A(this,He,Zi).call(this),!this._fieldObjects){tt('_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:n,refs:r,include:o}=s,c=[];if(n.length!==0||r.length!==0){const f=new Set(r);for(const p of n){const b=this._fieldObjects[p]||[];for(const{id:g}of b)f.add(g)}for(const p of Object.values(this._fieldObjects))for(const b of p)f.has(b.id)===o&&c.push(b)}else for(const f of Object.values(this._fieldObjects))c.push(...f);const h=this.annotationStorage,d=[];for(const f of c){const{id:p}=f;switch(d.push(p),f.type){case"text":{const g=f.defaultValue||"";h.setValue(p,{value:g});break}case"checkbox":case"radiobutton":{const g=f.defaultValue===f.exportValues;h.setValue(p,{value:g});break}case"combobox":case"listbox":{const g=f.defaultValue||"";h.setValue(p,{value:g});break}default:continue}const b=document.querySelector(`[data-element-id="${p}"]`);if(b){if(!nr.has(b)){tt(`_bindResetFormAction - element not allowed: ${p}`);continue}}else continue;b.dispatchEvent(new Event("resetform"))}return this.enableScripting&&((u=this.linkService.eventBus)==null||u.dispatch("dispatcheventinsandbox",{source:this,detail:{id:"app",ids:d,name:"ResetForm"}})),!1}}}He=new WeakSet,Zi=function(){this.container.setAttribute("data-internal-link","")},sp=function(e,s,i=null){e.href=this.linkService.getAnchorUrl(""),s.description&&(e.title=s.description),e.onclick=()=>{var n;return(n=this.downloadManager)==null||n.openOrDownloadData(s.content,s.filename,i),!1},A(this,He,Zi).call(this)},ip=function(e,s){e.href=this.linkService.getAnchorUrl(""),e.onclick=()=>(this.linkService.executeSetOCGState(s),!1),A(this,He,Zi).call(this)};class Hb extends Pt{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 hr extends Pt{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 me.platform.isMac?t.metaKey:t.ctrlKey}_setEventListener(t,e,s,i,n){s.includes("mouse")?t.addEventListener(s,r=>{var o;(o=this.linkService.eventBus)==null||o.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:i,value:n(r),shift:r.shiftKey,modifier:this._getKeyModifier(r)}})}):t.addEventListener(s,r=>{var o;if(s==="blur"){if(!e.focused||!r.relatedTarget)return;e.focused=!1}else if(s==="focus"){if(e.focused)return;e.focused=!0}n&&((o=this.linkService.eventBus)==null||o.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:i,value:n(r)}}))})}_setEventListeners(t,e,s,i){var n,r,o;for(const[c,h]of s)(h==="Action"||(n=this.data.actions)!=null&&n[h])&&((h==="Focus"||h==="Blur")&&(e||(e={focused:!1})),this._setEventListener(t,e,c,h,i),h==="Focus"&&!((r=this.data.actions)!=null&&r.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":$.makeHexColor(e[0],e[1],e[2])}_setTextStyle(t){const e=["left","center","right"],{fontColor:s}=this.data.defaultAppearanceData,i=this.data.defaultAppearanceData.fontSize||Ob,n=t.style;let r;const o=2,c=h=>Math.round(10*h)/10;if(this.data.multiLine){const h=Math.abs(this.data.rect[3]-this.data.rect[1]-o),d=Math.round(h/(Xc*i))||1,u=h/d;r=Math.min(i,c(u/Xc))}else{const h=Math.abs(this.data.rect[3]-this.data.rect[1]-o);r=Math.min(i,c(h/Xc))}n.fontSize=`calc(${r}px * var(--scale-factor))`,n.color=$.makeHexColor(s[0],s[1],s[2]),this.data.textAlignment!==null&&(n.textAlign=e[this.data.textAlignment])}_setRequired(t,e){e?t.setAttribute("required",!0):t.removeAttribute("required"),t.setAttribute("aria-required",e)}}class Bb extends hr{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 n=this.annotationStorage;for(const r of this._getElementsByName(t.name,t.id))r.domElement&&(r.domElement[e]=s),n.setValue(r.id,{[i]:s})}render(){var i,n;const t=this.annotationStorage,e=this.data.id;this.container.classList.add("textWidgetAnnotation");let s=null;if(this.renderForms){const r=t.getValue(e,{value:this.data.fieldValue});let o=r.value||"";const c=t.getValue(e,{charLimit:this.data.maxLen}).charLimit;c&&o.length>c&&(o=o.slice(0,c));let h=r.formattedValue||((i=this.data.textContent)==null?void 0:i.join(`
|
|
3
|
+
`))||null;h&&this.data.comb&&(h=h.replaceAll(/\s+/g,""));const d={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),nr.add(s),s.setAttribute("data-element-id",e),s.disabled=this.data.readOnly,s.name=this.data.fieldName,s.tabIndex=yl,this._setRequired(s,this.data.required),c&&(s.maxLength=c),s.addEventListener("input",f=>{t.setValue(e,{value:f.target.value}),this.setPropertyOnSiblings(s,"value",f.target.value,"value"),d.formattedValue=null}),s.addEventListener("resetform",f=>{const p=this.data.defaultFieldValue??"";s.value=d.userValue=p,d.formattedValue=null});let u=f=>{const{formattedValue:p}=d;p!=null&&(f.target.value=p),f.target.scrollLeft=0};if(this.enableScripting&&this.hasJSActions){s.addEventListener("focus",p=>{var g;if(d.focused)return;const{target:b}=p;d.userValue&&(b.value=d.userValue),d.lastCommittedValue=b.value,d.commitKey=1,(g=this.data.actions)!=null&&g.Focus||(d.focused=!0)}),s.addEventListener("updatefromsandbox",p=>{this.showElementAndHideCanvas(p.target);const b={value(g){d.userValue=g.detail.value??"",t.setValue(e,{value:d.userValue.toString()}),g.target.value=d.userValue},formattedValue(g){const{formattedValue:_}=g.detail;d.formattedValue=_,_!=null&&g.target!==document.activeElement&&(g.target.value=_),t.setValue(e,{formattedValue:_})},selRange(g){g.target.setSelectionRange(...g.detail.selRange)},charLimit:g=>{var E;const{charLimit:_}=g.detail,{target:y}=g;if(_===0){y.removeAttribute("maxLength");return}y.setAttribute("maxLength",_);let w=d.userValue;!w||w.length<=_||(w=w.slice(0,_),y.value=d.userValue=w,t.setValue(e,{value:w}),(E=this.linkService.eventBus)==null||E.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:w,willCommit:!0,commitKey:1,selStart:y.selectionStart,selEnd:y.selectionEnd}}))}};this._dispatchEventFromSandbox(b,p)}),s.addEventListener("keydown",p=>{var _;d.commitKey=1;let b=-1;if(p.key==="Escape"?b=0:p.key==="Enter"&&!this.data.multiLine?b=2:p.key==="Tab"&&(d.commitKey=3),b===-1)return;const{value:g}=p.target;d.lastCommittedValue!==g&&(d.lastCommittedValue=g,d.userValue=g,(_=this.linkService.eventBus)==null||_.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:g,willCommit:!0,commitKey:b,selStart:p.target.selectionStart,selEnd:p.target.selectionEnd}}))});const f=u;u=null,s.addEventListener("blur",p=>{var g,_;if(!d.focused||!p.relatedTarget)return;(g=this.data.actions)!=null&&g.Blur||(d.focused=!1);const{value:b}=p.target;d.userValue=b,d.lastCommittedValue!==b&&((_=this.linkService.eventBus)==null||_.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:b,willCommit:!0,commitKey:d.commitKey,selStart:p.target.selectionStart,selEnd:p.target.selectionEnd}})),f(p)}),(n=this.data.actions)!=null&&n.Keystroke&&s.addEventListener("beforeinput",p=>{var S;d.lastCommittedValue=null;const{data:b,target:g}=p,{value:_,selectionStart:y,selectionEnd:w}=g;let E=y,x=w;switch(p.inputType){case"deleteWordBackward":{const C=_.substring(0,y).match(/\w*[^\w]*$/);C&&(E-=C[0].length);break}case"deleteWordForward":{const C=_.substring(y).match(/^[^\w]*\w*/);C&&(x+=C[0].length);break}case"deleteContentBackward":y===w&&(E-=1);break;case"deleteContentForward":y===w&&(x+=1);break}p.preventDefault(),(S=this.linkService.eventBus)==null||S.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:_,change:b||"",willCommit:!1,selStart:E,selEnd:x}})}),this._setEventListeners(s,d,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],p=>p.target.value)}if(u&&s.addEventListener("blur",u),this.data.comb){const p=(this.data.rect[2]-this.data.rect[0])/c;s.classList.add("comb"),s.style.letterSpacing=`calc(${p}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 jb extends hr{constructor(t){super(t,{isRenderable:!!t.data.hasOwnCanvas})}}class zb extends hr{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 n=document.createElement("input");return nr.add(n),n.setAttribute("data-element-id",s),n.disabled=e.readOnly,this._setRequired(n,this.data.required),n.type="checkbox",n.name=e.fieldName,i&&n.setAttribute("checked",!0),n.setAttribute("exportValue",e.exportValue),n.tabIndex=yl,n.addEventListener("change",r=>{const{name:o,checked:c}=r.target;for(const h of this._getElementsByName(o,s)){const d=c&&h.exportValue===e.exportValue;h.domElement&&(h.domElement.checked=d),t.setValue(h.id,{value:d})}t.setValue(s,{value:c})}),n.addEventListener("resetform",r=>{const o=e.defaultFieldValue||"Off";r.target.checked=o===e.exportValue}),this.enableScripting&&this.hasJSActions&&(n.addEventListener("updatefromsandbox",r=>{const o={value(c){c.target.checked=c.detail.value!=="Off",t.setValue(s,{value:c.target.checked})}};this._dispatchEventFromSandbox(o,r)}),this._setEventListeners(n,null,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],r=>r.target.checked)),this._setBackgroundColor(n),this._setDefaultPropertiesFromJS(n),this.container.append(n),this.container}}class np extends hr{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 r of this._getElementsByName(e.fieldName,s))t.setValue(r.id,{value:!1});const n=document.createElement("input");if(nr.add(n),n.setAttribute("data-element-id",s),n.disabled=e.readOnly,this._setRequired(n,this.data.required),n.type="radio",n.name=e.fieldName,i&&n.setAttribute("checked",!0),n.tabIndex=yl,n.addEventListener("change",r=>{const{name:o,checked:c}=r.target;for(const h of this._getElementsByName(o,s))t.setValue(h.id,{value:!1});t.setValue(s,{value:c})}),n.addEventListener("resetform",r=>{const o=e.defaultFieldValue;r.target.checked=o!=null&&o===e.buttonValue}),this.enableScripting&&this.hasJSActions){const r=e.buttonValue;n.addEventListener("updatefromsandbox",o=>{const c={value:h=>{const d=r===h.detail.value;for(const u of this._getElementsByName(h.target.name)){const f=d&&u.id===s;u.domElement&&(u.domElement.checked=f),t.setValue(u.id,{value:f})}}};this._dispatchEventFromSandbox(c,o)}),this._setEventListeners(n,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(n),this._setDefaultPropertiesFromJS(n),this.container.append(n),this.container}}class $b extends ep{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 Wb extends hr{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");nr.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=yl;let n=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",d=>{const u=this.data.defaultFieldValue;for(const f of i.options)f.selected=f.value===u});for(const d of this.data.options){const u=document.createElement("option");u.textContent=d.displayValue,u.value=d.exportValue,s.value.includes(d.exportValue)&&(u.setAttribute("selected",!0),n=!1),i.append(u)}let r=null;if(n){const d=document.createElement("option");d.value=" ",d.setAttribute("hidden",!0),d.setAttribute("selected",!0),i.prepend(d),r=()=>{d.remove(),i.removeEventListener("input",r),r=null},i.addEventListener("input",r)}const o=d=>{const u=d?"value":"textContent",{options:f,multiple:p}=i;return p?Array.prototype.filter.call(f,b=>b.selected).map(b=>b[u]):f.selectedIndex===-1?null:f[f.selectedIndex][u]};let c=o(!1);const h=d=>{const u=d.target.options;return Array.prototype.map.call(u,f=>({displayValue:f.textContent,exportValue:f.value}))};return this.enableScripting&&this.hasJSActions?(i.addEventListener("updatefromsandbox",d=>{const u={value(f){r==null||r();const p=f.detail.value,b=new Set(Array.isArray(p)?p:[p]);for(const g of i.options)g.selected=b.has(g.value);t.setValue(e,{value:o(!0)}),c=o(!1)},multipleSelection(f){i.multiple=!0},remove(f){const p=i.options,b=f.detail.remove;p[b].selected=!1,i.remove(b),p.length>0&&Array.prototype.findIndex.call(p,_=>_.selected)===-1&&(p[0].selected=!0),t.setValue(e,{value:o(!0),items:h(f)}),c=o(!1)},clear(f){for(;i.length!==0;)i.remove(0);t.setValue(e,{value:null,items:[]}),c=o(!1)},insert(f){const{index:p,displayValue:b,exportValue:g}=f.detail.insert,_=i.children[p],y=document.createElement("option");y.textContent=b,y.value=g,_?_.before(y):i.append(y),t.setValue(e,{value:o(!0),items:h(f)}),c=o(!1)},items(f){const{items:p}=f.detail;for(;i.length!==0;)i.remove(0);for(const b of p){const{displayValue:g,exportValue:_}=b,y=document.createElement("option");y.textContent=g,y.value=_,i.append(y)}i.options.length>0&&(i.options[0].selected=!0),t.setValue(e,{value:o(!0),items:h(f)}),c=o(!1)},indices(f){const p=new Set(f.detail.indices);for(const b of f.target.options)b.selected=p.has(b.index);t.setValue(e,{value:o(!0)}),c=o(!1)},editable(f){f.target.disabled=!f.detail.editable}};this._dispatchEventFromSandbox(u,d)}),i.addEventListener("input",d=>{var p;const u=o(!0),f=o(!1);t.setValue(e,{value:u}),d.preventDefault(),(p=this.linkService.eventBus)==null||p.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:c,change:f,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"]],d=>d.target.value)):i.addEventListener("input",function(d){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 Vh extends Pt{constructor(t){const{data:e,elements:s}=t;super(t,{isRenderable:Pt._hasPopupData(e)}),this.elements=s,this.popup=null}render(){this.container.classList.add("popupAnnotation");const t=this.popup=new Gb({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=>`${Dd}${s}`).join(",")),this.container}}var na,Pc,Ic,ra,Dn,xt,Xs,aa,jo,zo,oa,qs,ns,Ys,$o,Ks,Wo,On,Nn,ut,Xl,Xh,rp,ap,op,lp,ql,Yl,qh;class Gb{constructor({container:t,color:e,elements:s,titleObj:i,modificationDate:n,contentsObj:r,richText:o,parent:c,rect:h,parentRect:d,open:u}){v(this,ut);v(this,na,A(this,ut,op).bind(this));v(this,Pc,A(this,ut,qh).bind(this));v(this,Ic,A(this,ut,Yl).bind(this));v(this,ra,A(this,ut,ql).bind(this));v(this,Dn,null);v(this,xt,null);v(this,Xs,null);v(this,aa,null);v(this,jo,null);v(this,zo,null);v(this,oa,null);v(this,qs,!1);v(this,ns,null);v(this,Ys,null);v(this,$o,null);v(this,Ks,null);v(this,Wo,null);v(this,On,null);v(this,Nn,!1);var f;m(this,xt,t),m(this,Wo,i),m(this,Xs,r),m(this,Ks,o),m(this,zo,c),m(this,Dn,e),m(this,$o,h),m(this,oa,d),m(this,jo,s),m(this,aa,Hd.toDateObject(n)),this.trigger=s.flatMap(p=>p.getElementsToTriggerPopup());for(const p of this.trigger)p.addEventListener("click",a(this,ra)),p.addEventListener("mouseenter",a(this,Ic)),p.addEventListener("mouseleave",a(this,Pc)),p.classList.add("popupTriggerArea");for(const p of s)(f=p.container)==null||f.addEventListener("keydown",a(this,na));a(this,xt).hidden=!0,u&&A(this,ut,ql).call(this)}render(){if(a(this,ns))return;const t=m(this,ns,document.createElement("div"));if(t.className="popup",a(this,Dn)){const n=t.style.outlineColor=$.makeHexColor(...a(this,Dn));CSS.supports("background-color","color-mix(in srgb, red 30%, white)")?t.style.backgroundColor=`color-mix(in srgb, ${n} 30%, white)`:t.style.backgroundColor=$.makeHexColor(...a(this,Dn).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}=a(this,Wo),t.append(e),a(this,aa)){const n=document.createElement("span");n.classList.add("popupDate"),n.setAttribute("data-l10n-id","pdfjs-annotation-date-time-string"),n.setAttribute("data-l10n-args",JSON.stringify({dateObj:a(this,aa).valueOf()})),e.append(n)}const i=a(this,ut,Xl);if(i)tp.render({xfaHtml:i,intent:"richText",div:t}),t.lastChild.classList.add("richText","popupContent");else{const n=this._formatContents(a(this,Xs));t.append(n)}a(this,xt).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 n=0,r=i.length;n<r;++n){const o=i[n];s.append(document.createTextNode(o)),n<r-1&&s.append(document.createElement("br"))}return s}updateEdited({rect:t,popupContent:e}){var s;a(this,On)||m(this,On,{contentsObj:a(this,Xs),richText:a(this,Ks)}),t&&m(this,Ys,null),e&&(m(this,Ks,A(this,ut,ap).call(this,e)),m(this,Xs,null)),(s=a(this,ns))==null||s.remove(),m(this,ns,null)}resetEdited(){var t;a(this,On)&&({contentsObj:ue(this,Xs)._,richText:ue(this,Ks)._}=a(this,On),m(this,On,null),(t=a(this,ns))==null||t.remove(),m(this,ns,null),m(this,Ys,null))}forceHide(){m(this,Nn,this.isVisible),a(this,Nn)&&(a(this,xt).hidden=!0)}maybeShow(){a(this,Nn)&&(a(this,ns)||A(this,ut,Yl).call(this),m(this,Nn,!1),a(this,xt).hidden=!1)}get isVisible(){return a(this,xt).hidden===!1}}na=new WeakMap,Pc=new WeakMap,Ic=new WeakMap,ra=new WeakMap,Dn=new WeakMap,xt=new WeakMap,Xs=new WeakMap,aa=new WeakMap,jo=new WeakMap,zo=new WeakMap,oa=new WeakMap,qs=new WeakMap,ns=new WeakMap,Ys=new WeakMap,$o=new WeakMap,Ks=new WeakMap,Wo=new WeakMap,On=new WeakMap,Nn=new WeakMap,ut=new WeakSet,Xl=function(){const t=a(this,Ks),e=a(this,Xs);return t!=null&&t.str&&(!(e!=null&&e.str)||e.str===t.str)&&a(this,Ks).html||null},Xh=function(){var t,e,s;return((s=(e=(t=a(this,ut,Xl))==null?void 0:t.attributes)==null?void 0:e.style)==null?void 0:s.fontSize)||0},rp=function(){var t,e,s;return((s=(e=(t=a(this,ut,Xl))==null?void 0:t.attributes)==null?void 0:e.style)==null?void 0:s.color)||null},ap=function(t){const e=[],s={str:t,html:{name:"div",attributes:{dir:"auto"},children:[{name:"p",children:e}]}},i={style:{color:a(this,ut,rp),fontSize:a(this,ut,Xh)?`calc(${a(this,ut,Xh)}px * var(--scale-factor))`:""}};for(const n of t.split(`
|
|
4
|
+
`))e.push({name:"span",value:n,attributes:i});return s},op=function(t){t.altKey||t.shiftKey||t.ctrlKey||t.metaKey||(t.key==="Enter"||t.key==="Escape"&&a(this,qs))&&A(this,ut,ql).call(this)},lp=function(){if(a(this,Ys)!==null)return;const{page:{view:t},viewport:{rawDims:{pageWidth:e,pageHeight:s,pageX:i,pageY:n}}}=a(this,zo);let r=!!a(this,oa),o=r?a(this,oa):a(this,$o);for(const b of a(this,jo))if(!o||$.intersect(b.data.rect,o)!==null){o=b.data.rect,r=!0;break}const c=$.normalizeRect([o[0],t[3]-o[1]+t[1],o[2],t[3]-o[3]+t[1]]),d=r?o[2]-o[0]+5:0,u=c[0]+d,f=c[1];m(this,Ys,[100*(u-i)/e,100*(f-n)/s]);const{style:p}=a(this,xt);p.left=`${a(this,Ys)[0]}%`,p.top=`${a(this,Ys)[1]}%`},ql=function(){m(this,qs,!a(this,qs)),a(this,qs)?(A(this,ut,Yl).call(this),a(this,xt).addEventListener("click",a(this,ra)),a(this,xt).addEventListener("keydown",a(this,na))):(A(this,ut,qh).call(this),a(this,xt).removeEventListener("click",a(this,ra)),a(this,xt).removeEventListener("keydown",a(this,na)))},Yl=function(){a(this,ns)||this.render(),this.isVisible?a(this,qs)&&a(this,xt).classList.add("focused"):(A(this,ut,lp).call(this),a(this,xt).hidden=!1,a(this,xt).style.zIndex=parseInt(a(this,xt).style.zIndex)+1e3)},qh=function(){a(this,xt).classList.remove("focused"),!(a(this,qs)||!this.isVisible)&&(a(this,xt).hidden=!0,a(this,xt).style.zIndex=parseInt(a(this,xt).style.zIndex)-1e3)};class cp extends Pt{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),this.textContent=t.data.textContent,this.textPosition=t.data.textPosition,this.annotationEditorType=Q.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 Go;class Ub extends Pt{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0});v(this,Go,null)}render(){this.container.classList.add("lineAnnotation");const e=this.data,{width:s,height:i}=li(e.rect),n=this.svgFactory.create(s,i,!0),r=m(this,Go,this.svgFactory.createElement("svg:line"));return r.setAttribute("x1",e.rect[2]-e.lineCoordinates[0]),r.setAttribute("y1",e.rect[3]-e.lineCoordinates[1]),r.setAttribute("x2",e.rect[2]-e.lineCoordinates[2]),r.setAttribute("y2",e.rect[3]-e.lineCoordinates[3]),r.setAttribute("stroke-width",e.borderStyle.width||1),r.setAttribute("stroke","transparent"),r.setAttribute("fill","transparent"),n.append(r),this.container.append(n),!e.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return a(this,Go)}addHighlightArea(){this.container.classList.add("highlightArea")}}Go=new WeakMap;var Uo;class Vb extends Pt{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0});v(this,Uo,null)}render(){this.container.classList.add("squareAnnotation");const e=this.data,{width:s,height:i}=li(e.rect),n=this.svgFactory.create(s,i,!0),r=e.borderStyle.width,o=m(this,Uo,this.svgFactory.createElement("svg:rect"));return o.setAttribute("x",r/2),o.setAttribute("y",r/2),o.setAttribute("width",s-r),o.setAttribute("height",i-r),o.setAttribute("stroke-width",r||1),o.setAttribute("stroke","transparent"),o.setAttribute("fill","transparent"),n.append(o),this.container.append(n),!e.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return a(this,Uo)}addHighlightArea(){this.container.classList.add("highlightArea")}}Uo=new WeakMap;var Vo;class Xb extends Pt{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0});v(this,Vo,null)}render(){this.container.classList.add("circleAnnotation");const e=this.data,{width:s,height:i}=li(e.rect),n=this.svgFactory.create(s,i,!0),r=e.borderStyle.width,o=m(this,Vo,this.svgFactory.createElement("svg:ellipse"));return o.setAttribute("cx",s/2),o.setAttribute("cy",i/2),o.setAttribute("rx",s/2-r/2),o.setAttribute("ry",i/2-r/2),o.setAttribute("stroke-width",r||1),o.setAttribute("stroke","transparent"),o.setAttribute("fill","transparent"),n.append(o),this.container.append(n),!e.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return a(this,Vo)}addHighlightArea(){this.container.classList.add("highlightArea")}}Vo=new WeakMap;var Xo;class hp extends Pt{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0});v(this,Xo,null);this.containerClassName="polylineAnnotation",this.svgElementName="svg:polyline"}render(){this.container.classList.add(this.containerClassName);const{data:{rect:e,vertices:s,borderStyle:i,popupRef:n}}=this;if(!s)return this.container;const{width:r,height:o}=li(e),c=this.svgFactory.create(r,o,!0);let h=[];for(let u=0,f=s.length;u<f;u+=2){const p=s[u]-e[0],b=e[3]-s[u+1];h.push(`${p},${b}`)}h=h.join(" ");const d=m(this,Xo,this.svgFactory.createElement(this.svgElementName));return d.setAttribute("points",h),d.setAttribute("stroke-width",i.width||1),d.setAttribute("stroke","transparent"),d.setAttribute("fill","transparent"),c.append(d),this.container.append(c),!n&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return a(this,Xo)}addHighlightArea(){this.container.classList.add("highlightArea")}}Xo=new WeakMap;class qb extends hp{constructor(t){super(t),this.containerClassName="polygonAnnotation",this.svgElementName="svg:polygon"}}class Yb extends Pt{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 qo;class Vd extends Pt{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0});v(this,qo,[]);this.containerClassName="inkAnnotation",this.svgElementName="svg:polyline",this.annotationEditorType=this.data.it==="InkHighlight"?Q.HIGHLIGHT:Q.INK}render(){this.container.classList.add(this.containerClassName);const{data:{rect:e,inkLists:s,borderStyle:i,popupRef:n}}=this,{width:r,height:o}=li(e),c=this.svgFactory.create(r,o,!0);for(const h of s){let d=[];for(let f=0,p=h.length;f<p;f+=2){const b=h[f]-e[0],g=e[3]-h[f+1];d.push(`${b},${g}`)}d=d.join(" ");const u=this.svgFactory.createElement(this.svgElementName);a(this,qo).push(u),u.setAttribute("points",d),u.setAttribute("stroke-width",i.width||1),u.setAttribute("stroke","transparent"),u.setAttribute("fill","transparent"),c.append(u)}return!n&&this.hasPopupData&&this._createPopup(),this.container.append(c),this._editOnDoubleClick(),this.container}getElementsToTriggerPopup(){return a(this,qo)}addHighlightArea(){this.container.classList.add("highlightArea")}}qo=new WeakMap;class dp extends Pt{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0}),this.annotationEditorType=Q.HIGHLIGHT}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("highlightAnnotation"),this._editOnDoubleClick(),this.container}}class Kb extends Pt{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 Zb extends Pt{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 Qb extends Pt{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 up extends Pt{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),this.annotationEditorType=Q.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 Yo,Ko,Yh;class Jb extends Pt{constructor(e){var i;super(e,{isRenderable:!0});v(this,Ko);v(this,Yo,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",A(this,Ko,Yh).bind(this)),m(this,Yo,i);const{isMac:n}=me.platform;return e.addEventListener("keydown",r=>{r.key==="Enter"&&(n?r.metaKey:r.ctrlKey)&&A(this,Ko,Yh).call(this)}),!s.popupRef&&this.hasPopupData?this._createPopup():i.classList.add("popupTriggerArea"),e.append(i),e}getElementsToTriggerPopup(){return a(this,Yo)}addHighlightArea(){this.container.classList.add("highlightArea")}}Yo=new WeakMap,Ko=new WeakSet,Yh=function(){var e;(e=this.downloadManager)==null||e.openOrDownloadData(this.content,this.filename)};var Zo,Hn,Bn,Qo,ar,fp,Kh,qu;let tA=(qu=class{constructor({div:t,accessibilityManager:e,annotationCanvasMap:s,annotationEditorUIManager:i,page:n,viewport:r,structTreeLayer:o}){v(this,ar);v(this,Zo,null);v(this,Hn,null);v(this,Bn,new Map);v(this,Qo,null);this.div=t,m(this,Zo,e),m(this,Hn,s),m(this,Qo,o||null),this.page=n,this.viewport=r,this.zIndex=0,this._annotationEditorUIManager=i}hasEditableAnnotations(){return a(this,Bn).size>0}async render(t){var r;const{annotations:e}=t,s=this.div;sr(s,this.viewport);const i=new Map,n={data:null,layer:s,linkService:t.linkService,downloadManager:t.downloadManager,imageResourcesPath:t.imageResourcesPath||"",renderForms:t.renderForms!==!1,svgFactory:new Ud,annotationStorage:t.annotationStorage||new jd,enableScripting:t.enableScripting===!0,hasJSActions:t.hasJSActions,fieldObjects:t.fieldObjects,parent:this,elements:null};for(const o of e){if(o.noHTML)continue;const c=o.annotationType===Nt.POPUP;if(c){const u=i.get(o.id);if(!u)continue;n.elements=u}else{const{width:u,height:f}=li(o.rect);if(u<=0||f<=0)continue}n.data=o;const h=Nb.create(n);if(!h.isRenderable)continue;if(!c&&o.popupRef){const u=i.get(o.popupRef);u?u.push(h):i.set(o.popupRef,[h])}const d=h.render();o.hidden&&(d.style.visibility="hidden"),await A(this,ar,fp).call(this,d,o.id),h._isEditable&&(a(this,Bn).set(h.data.id,h),(r=this._annotationEditorUIManager)==null||r.renderAnnotationElement(h))}A(this,ar,Kh).call(this)}update({viewport:t}){const e=this.div;this.viewport=t,sr(e,{rotation:t.rotation}),A(this,ar,Kh).call(this),e.hidden=!1}getEditableAnnotations(){return Array.from(a(this,Bn).values())}getEditableAnnotation(t){return a(this,Bn).get(t)}},Zo=new WeakMap,Hn=new WeakMap,Bn=new WeakMap,Qo=new WeakMap,ar=new WeakSet,fp=async function(t,e){var r,o;const s=t.firstChild||t,i=s.id=`${Dd}${e}`,n=await((r=a(this,Qo))==null?void 0:r.getAriaAttributes(i));if(n)for(const[c,h]of n)s.setAttribute(c,h);this.div.append(t),(o=a(this,Zo))==null||o.moveElementInDOM(this.div,t,s,!1)},Kh=function(){if(!a(this,Hn))return;const t=this.div;for(const[e,s]of a(this,Hn)){const i=t.querySelector(`[data-annotation-id="${e}"]`);if(!i)continue;s.className="annotationContent";const{firstChild:n}=i;n?n.nodeName==="CANVAS"?n.replaceWith(s):n.classList.contains("annotationContent")?n.after(s):n.before(s):i.append(s)}a(this,Hn).clear()},qu);const kl=/\r\n?|\n/g;var rs,Ie,Jo,jn,Me,Dt,pp,gp,mp,Kl,hi,Zl,Ql,bp,Qh,Ap;const mt=class mt extends ht{constructor(e){super({...e,name:"freeTextEditor"});v(this,Dt);v(this,rs);v(this,Ie,"");v(this,Jo,`${this.id}-editor`);v(this,jn,null);v(this,Me);m(this,rs,e.color||mt._defaultColor||ht._defaultLineColor),m(this,Me,e.fontSize||mt._defaultFontSize)}static get _keyboardManager(){const e=mt.prototype,s=r=>r.isEmpty(),i=ir.TRANSLATE_SMALL,n=ir.TRANSLATE_BIG;return it(this,"_keyboardManager",new vl([[["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:[-n,0],checker:s}],[["ArrowRight","mac+ArrowRight"],e._translateEmpty,{args:[i,0],checker:s}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],e._translateEmpty,{args:[n,0],checker:s}],[["ArrowUp","mac+ArrowUp"],e._translateEmpty,{args:[0,-i],checker:s}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],e._translateEmpty,{args:[0,-n],checker:s}],[["ArrowDown","mac+ArrowDown"],e._translateEmpty,{args:[0,i],checker:s}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],e._translateEmpty,{args:[0,n],checker:s}]]))}static initialize(e,s){ht.initialize(e,s);const i=getComputedStyle(document.documentElement);this._internalPadding=parseFloat(i.getPropertyValue("--freetext-padding"))}static updateDefaultParams(e,s){switch(e){case q.FREETEXT_SIZE:mt._defaultFontSize=s;break;case q.FREETEXT_COLOR:mt._defaultColor=s;break}}updateParams(e,s){switch(e){case q.FREETEXT_SIZE:A(this,Dt,pp).call(this,s);break;case q.FREETEXT_COLOR:A(this,Dt,gp).call(this,s);break}}static get defaultPropertiesToUpdate(){return[[q.FREETEXT_SIZE,mt._defaultFontSize],[q.FREETEXT_COLOR,mt._defaultColor||ht._defaultLineColor]]}get propertiesToUpdate(){return[[q.FREETEXT_SIZE,a(this,Me)],[q.FREETEXT_COLOR,a(this,rs)]]}_translateEmpty(e,s){this._uiManager.translateSelectedEditors(e,s,!0)}getInitialTranslation(){const e=this.parentScale;return[-mt._internalPadding*e,-(mt._internalPadding+a(this,Me))*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(Q.FREETEXT),super.enableEditMode(),this.overlayDiv.classList.remove("enabled"),this.editorDiv.contentEditable=!0,this._isDraggable=!1,this.div.removeAttribute("aria-activedescendant"),m(this,jn,new AbortController);const e=this._uiManager.combinedSignal(a(this,jn));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",a(this,Jo)),this._isDraggable=!0,(e=a(this,jn))==null||e.abort(),m(this,jn,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=a(this,Ie),s=m(this,Ie,A(this,Dt,mp).call(this).trimEnd());if(e===s)return;const i=n=>{if(m(this,Ie,n),!n){this.remove();return}A(this,Dt,Ql).call(this),this._uiManager.rebuild(this),A(this,Dt,Kl).call(this)};this.addCommands({cmd:()=>{i(s)},undo:()=>{i(e)},mustExec:!1}),A(this,Dt,Kl).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){mt._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",a(this,Jo)),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(${a(this,Me)}px * var(--scale-factor))`,i.color=a(this,rs),this.div.append(this.editorDiv),this.overlayDiv=document.createElement("div"),this.overlayDiv.classList.add("overlay","enabled"),this.div.append(this.overlayDiv),hc(this,this.div,["dblclick","keydown"]),this.width){const[n,r]=this.parentDimensions;if(this.annotationElementId){const{position:o}=this._initialData;let[c,h]=this.getInitialTranslation();[c,h]=this.pageTranslationToScreen(c,h);const[d,u]=this.pageDimensions,[f,p]=this.pageTranslation;let b,g;switch(this.rotation){case 0:b=e+(o[0]-f)/d,g=s+this.height-(o[1]-p)/u;break;case 90:b=e+(o[0]-f)/d,g=s-(o[1]-p)/u,[c,h]=[h,-c];break;case 180:b=e-this.width+(o[0]-f)/d,g=s-(o[1]-p)/u,[c,h]=[-c,-h];break;case 270:b=e+(o[0]-f-this.height*u)/d,g=s+(o[1]-p-this.width*d)/u,[c,h]=[-h,c];break}this.setAt(b*n,g*r,c,h)}else this.setAt(e*n,s*r,this.width*n,this.height*r);A(this,Dt,Ql).call(this),this._isDraggable=!0,this.editorDiv.contentEditable=!1}else this._isDraggable=!1,this.editorDiv.contentEditable=!0;return this.div}editorDivPaste(e){var b,g,_;const s=e.clipboardData||window.clipboardData,{types:i}=s;if(i.length===1&&i[0]==="text/plain")return;e.preventDefault();const n=A(b=mt,hi,Qh).call(b,s.getData("text")||"").replaceAll(kl,`
|
|
5
|
+
`);if(!n)return;const r=window.getSelection();if(!r.rangeCount)return;this.editorDiv.normalize(),r.deleteFromDocument();const o=r.getRangeAt(0);if(!n.includes(`
|
|
6
|
+
`)){o.insertNode(document.createTextNode(n)),this.editorDiv.normalize(),r.collapseToStart();return}const{startContainer:c,startOffset:h}=o,d=[],u=[];if(c.nodeType===Node.TEXT_NODE){const y=c.parentElement;if(u.push(c.nodeValue.slice(h).replaceAll(kl,"")),y!==this.editorDiv){let w=d;for(const E of this.editorDiv.childNodes){if(E===y){w=u;continue}w.push(A(g=mt,hi,Zl).call(g,E))}}d.push(c.nodeValue.slice(0,h).replaceAll(kl,""))}else if(c===this.editorDiv){let y=d,w=0;for(const E of this.editorDiv.childNodes)w++===h&&(y=u),y.push(A(_=mt,hi,Zl).call(_,E))}m(this,Ie,`${d.join(`
|
|
7
|
+
`)}${n}${u.join(`
|
|
8
|
+
`)}`),A(this,Dt,Ql).call(this);const f=new Range;let p=d.reduce((y,w)=>y+w.length,0);for(const{firstChild:y}of this.editorDiv.childNodes)if(y.nodeType===Node.TEXT_NODE){const w=y.nodeValue.length;if(p<=w){f.setStart(y,p),f.setEnd(y,p);break}p-=w}r.removeAllRanges(),r.addRange(f)}get contentDiv(){return this.editorDiv}static async deserialize(e,s,i){var o;let n=null;if(e instanceof cp){const{data:{defaultAppearanceData:{fontSize:c,fontColor:h},rect:d,rotation:u,id:f,popupRef:p},textContent:b,textPosition:g,parent:{page:{pageNumber:_}}}=e;if(!b||b.length===0)return null;n=e={annotationType:Q.FREETEXT,color:Array.from(h),fontSize:c,value:b.join(`
|
|
9
|
+
`),position:g,pageIndex:_-1,rect:d.slice(0),rotation:u,id:f,deleted:!1,popupRef:p}}const r=await super.deserialize(e,s,i);return m(r,Me,e.fontSize),m(r,rs,$.makeHexColor(...e.color)),m(r,Ie,A(o=mt,hi,Qh).call(o,e.value)),r.annotationElementId=e.id||null,r._initialData=n,r}serialize(e=!1){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();const s=mt._internalPadding*this.parentScale,i=this.getRect(s,s),n=ht._colorManager.convert(this.isAttachedToDOM?getComputedStyle(this.editorDiv).color:a(this,rs)),r={annotationType:Q.FREETEXT,color:n,fontSize:a(this,Me),value:A(this,Dt,bp).call(this),pageIndex:this.pageIndex,rect:i,rotation:this.rotation,structTreeParentId:this._structTreeParentId};return e?r:this.annotationElementId&&!A(this,Dt,Ap).call(this,r)?null:(r.id=this.annotationElementId,r)}renderAnnotationElement(e){const s=super.renderAnnotationElement(e);if(this.deleted)return s;const{style:i}=s;i.fontSize=`calc(${a(this,Me)}px * var(--scale-factor))`,i.color=a(this,rs),s.replaceChildren();for(const r of a(this,Ie).split(`
|
|
10
|
+
`)){const o=document.createElement("div");o.append(r?document.createTextNode(r):document.createElement("br")),s.append(o)}const n=mt._internalPadding*this.parentScale;return e.updateEdited({rect:this.getRect(n,n),popupContent:a(this,Ie)}),s}resetAnnotationElement(e){super.resetAnnotationElement(e),e.resetEdited()}};rs=new WeakMap,Ie=new WeakMap,Jo=new WeakMap,jn=new WeakMap,Me=new WeakMap,Dt=new WeakSet,pp=function(e){const s=n=>{this.editorDiv.style.fontSize=`calc(${n}px * var(--scale-factor))`,this.translate(0,-(n-a(this,Me))*this.parentScale),m(this,Me,n),A(this,Dt,Kl).call(this)},i=a(this,Me);this.addCommands({cmd:s.bind(this,e),undo:s.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:q.FREETEXT_SIZE,overwriteIfSameType:!0,keepUndo:!0})},gp=function(e){const s=n=>{m(this,rs,this.editorDiv.style.color=n)},i=a(this,rs);this.addCommands({cmd:s.bind(this,e),undo:s.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:q.FREETEXT_COLOR,overwriteIfSameType:!0,keepUndo:!0})},mp=function(){var i;const e=[];this.editorDiv.normalize();let s=null;for(const n of this.editorDiv.childNodes)(s==null?void 0:s.nodeType)===Node.TEXT_NODE&&n.nodeName==="BR"||(e.push(A(i=mt,hi,Zl).call(i,n)),s=n);return e.join(`
|
|
11
|
+
`)},Kl=function(){const[e,s]=this.parentDimensions;let i;if(this.isAttachedToDOM)i=this.div.getBoundingClientRect();else{const{currentLayer:n,div:r}=this,o=r.style.display,c=r.classList.contains("hidden");r.classList.remove("hidden"),r.style.display="hidden",n.div.append(this.div),i=r.getBoundingClientRect(),r.remove(),r.style.display=o,r.classList.toggle("hidden",c)}this.rotation%180===this.parentRotation%180?(this.width=i.width/e,this.height=i.height/s):(this.width=i.height/e,this.height=i.width/s),this.fixAndSetPosition()},hi=new WeakSet,Zl=function(e){return(e.nodeType===Node.TEXT_NODE?e.nodeValue:e.innerText).replaceAll(kl,"")},Ql=function(){if(this.editorDiv.replaceChildren(),!!a(this,Ie))for(const e of a(this,Ie).split(`
|
|
12
|
+
`)){const s=document.createElement("div");s.append(e?document.createTextNode(e):document.createElement("br")),this.editorDiv.append(s)}},bp=function(){return a(this,Ie).replaceAll(" "," ")},Qh=function(e){return e.replaceAll(" "," ")},Ap=function(e){const{value:s,fontSize:i,color:n,pageIndex:r}=this._initialData;return this._hasBeenMoved||e.value!==s||e.fontSize!==i||e.color.some((o,c)=>o!==n[c])||e.pageIndex!==r},v(mt,hi),X(mt,"_freeTextDefaultContent",""),X(mt,"_internalPadding",0),X(mt,"_defaultColor",null),X(mt,"_defaultFontSize",10),X(mt,"_type","freetext"),X(mt,"_editorType",Q.FREETEXT);let Zh=mt;class vp{toSVGPath(){At("Abstract method `toSVGPath` must be implemented.")}get box(){At("Abstract getter `box` must be implemented.")}serialize(t,e){At("Abstract method `serialize` must be implemented.")}get classNamesForDrawing(){At("Abstract getter `classNamesForDrawing` must be implemented.")}get classNamesForOutlining(){At("Abstract getter `classNamesForOutlining` must be implemented.")}get mustRemoveSelfIntersections(){return!1}}var ke,as,la,ca,xs,et,zn,$n,tl,el,ha,da,Di,sl,Mc,kc,$t,Ga,yp,_p,wp,Ep,Sp,xp;const Os=class Os{constructor({x:t,y:e},s,i,n,r,o=0){v(this,$t);v(this,ke);v(this,as,[]);v(this,la);v(this,ca);v(this,xs,[]);v(this,et,new Float64Array(18));v(this,zn);v(this,$n);v(this,tl);v(this,el);v(this,ha);v(this,da);v(this,Di,[]);m(this,ke,s),m(this,da,n*i),m(this,ca,r),a(this,et).set([NaN,NaN,NaN,NaN,t,e],6),m(this,la,o),m(this,el,a(Os,sl)*i),m(this,tl,a(Os,kc)*i),m(this,ha,i),a(this,Di).push(t,e)}isEmpty(){return isNaN(a(this,et)[8])}add({x:t,y:e}){var I;m(this,zn,t),m(this,$n,e);const[s,i,n,r]=a(this,ke);let[o,c,h,d]=a(this,et).subarray(8,12);const u=t-h,f=e-d,p=Math.hypot(u,f);if(p<a(this,tl))return!1;const b=p-a(this,el),g=b/p,_=g*u,y=g*f;let w=o,E=c;o=h,c=d,h+=_,d+=y,(I=a(this,Di))==null||I.push(t,e);const x=-y/b,S=_/b,C=x*a(this,da),T=S*a(this,da);return a(this,et).set(a(this,et).subarray(2,8),0),a(this,et).set([h+C,d+T],4),a(this,et).set(a(this,et).subarray(14,18),12),a(this,et).set([h-C,d-T],16),isNaN(a(this,et)[6])?(a(this,xs).length===0&&(a(this,et).set([o+C,c+T],2),a(this,xs).push(NaN,NaN,NaN,NaN,(o+C-s)/n,(c+T-i)/r),a(this,et).set([o-C,c-T],14),a(this,as).push(NaN,NaN,NaN,NaN,(o-C-s)/n,(c-T-i)/r)),a(this,et).set([w,E,o,c,h,d],6),!this.isEmpty()):(a(this,et).set([w,E,o,c,h,d],6),Math.abs(Math.atan2(E-c,w-o)-Math.atan2(y,_))<Math.PI/2?([o,c,h,d]=a(this,et).subarray(2,6),a(this,xs).push(NaN,NaN,NaN,NaN,((o+h)/2-s)/n,((c+d)/2-i)/r),[o,c,w,E]=a(this,et).subarray(14,18),a(this,as).push(NaN,NaN,NaN,NaN,((w+o)/2-s)/n,((E+c)/2-i)/r),!0):([w,E,o,c,h,d]=a(this,et).subarray(0,6),a(this,xs).push(((w+5*o)/6-s)/n,((E+5*c)/6-i)/r,((5*o+h)/6-s)/n,((5*c+d)/6-i)/r,((o+h)/2-s)/n,((c+d)/2-i)/r),[h,d,o,c,w,E]=a(this,et).subarray(12,18),a(this,as).push(((w+5*o)/6-s)/n,((E+5*c)/6-i)/r,((5*o+h)/6-s)/n,((5*c+d)/6-i)/r,((o+h)/2-s)/n,((c+d)/2-i)/r),!0))}toSVGPath(){if(this.isEmpty())return"";const t=a(this,xs),e=a(this,as);if(isNaN(a(this,et)[6])&&!this.isEmpty())return A(this,$t,yp).call(this);const s=[];s.push(`M${t[4]} ${t[5]}`);for(let i=6;i<t.length;i+=6)isNaN(t[i])?s.push(`L${t[i+4]} ${t[i+5]}`):s.push(`C${t[i]} ${t[i+1]} ${t[i+2]} ${t[i+3]} ${t[i+4]} ${t[i+5]}`);A(this,$t,wp).call(this,s);for(let i=e.length-6;i>=6;i-=6)isNaN(e[i])?s.push(`L${e[i+4]} ${e[i+5]}`):s.push(`C${e[i]} ${e[i+1]} ${e[i+2]} ${e[i+3]} ${e[i+4]} ${e[i+5]}`);return A(this,$t,_p).call(this,s),s.join(" ")}newFreeDrawOutline(t,e,s,i,n,r){return new Cp(t,e,s,i,n,r)}getOutlines(){var u;const t=a(this,xs),e=a(this,as),s=a(this,et),[i,n,r,o]=a(this,ke),c=new Float64Array((((u=a(this,Di))==null?void 0:u.length)??0)+2);for(let f=0,p=c.length-2;f<p;f+=2)c[f]=(a(this,Di)[f]-i)/r,c[f+1]=(a(this,Di)[f+1]-n)/o;if(c[c.length-2]=(a(this,zn)-i)/r,c[c.length-1]=(a(this,$n)-n)/o,isNaN(s[6])&&!this.isEmpty())return A(this,$t,Ep).call(this,c);const h=new Float64Array(a(this,xs).length+24+a(this,as).length);let d=t.length;for(let f=0;f<d;f+=2){if(isNaN(t[f])){h[f]=h[f+1]=NaN;continue}h[f]=t[f],h[f+1]=t[f+1]}d=A(this,$t,xp).call(this,h,d);for(let f=e.length-6;f>=6;f-=6)for(let p=0;p<6;p+=2){if(isNaN(e[f+p])){h[d]=h[d+1]=NaN,d+=2;continue}h[d]=e[f+p],h[d+1]=e[f+p+1],d+=2}return A(this,$t,Sp).call(this,h,d),this.newFreeDrawOutline(h,c,a(this,ke),a(this,ha),a(this,la),a(this,ca))}};ke=new WeakMap,as=new WeakMap,la=new WeakMap,ca=new WeakMap,xs=new WeakMap,et=new WeakMap,zn=new WeakMap,$n=new WeakMap,tl=new WeakMap,el=new WeakMap,ha=new WeakMap,da=new WeakMap,Di=new WeakMap,sl=new WeakMap,Mc=new WeakMap,kc=new WeakMap,$t=new WeakSet,Ga=function(){const t=a(this,et).subarray(4,6),e=a(this,et).subarray(16,18),[s,i,n,r]=a(this,ke);return[(a(this,zn)+(t[0]-e[0])/2-s)/n,(a(this,$n)+(t[1]-e[1])/2-i)/r,(a(this,zn)+(e[0]-t[0])/2-s)/n,(a(this,$n)+(e[1]-t[1])/2-i)/r]},yp=function(){const[t,e,s,i]=a(this,ke),[n,r,o,c]=A(this,$t,Ga).call(this);return`M${(a(this,et)[2]-t)/s} ${(a(this,et)[3]-e)/i} L${(a(this,et)[4]-t)/s} ${(a(this,et)[5]-e)/i} L${n} ${r} L${o} ${c} L${(a(this,et)[16]-t)/s} ${(a(this,et)[17]-e)/i} L${(a(this,et)[14]-t)/s} ${(a(this,et)[15]-e)/i} Z`},_p=function(t){const e=a(this,as);t.push(`L${e[4]} ${e[5]} Z`)},wp=function(t){const[e,s,i,n]=a(this,ke),r=a(this,et).subarray(4,6),o=a(this,et).subarray(16,18),[c,h,d,u]=A(this,$t,Ga).call(this);t.push(`L${(r[0]-e)/i} ${(r[1]-s)/n} L${c} ${h} L${d} ${u} L${(o[0]-e)/i} ${(o[1]-s)/n}`)},Ep=function(t){const e=a(this,et),[s,i,n,r]=a(this,ke),[o,c,h,d]=A(this,$t,Ga).call(this),u=new Float64Array(36);return u.set([NaN,NaN,NaN,NaN,(e[2]-s)/n,(e[3]-i)/r,NaN,NaN,NaN,NaN,(e[4]-s)/n,(e[5]-i)/r,NaN,NaN,NaN,NaN,o,c,NaN,NaN,NaN,NaN,h,d,NaN,NaN,NaN,NaN,(e[16]-s)/n,(e[17]-i)/r,NaN,NaN,NaN,NaN,(e[14]-s)/n,(e[15]-i)/r],0),this.newFreeDrawOutline(u,t,a(this,ke),a(this,ha),a(this,la),a(this,ca))},Sp=function(t,e){const s=a(this,as);return t.set([NaN,NaN,NaN,NaN,s[4],s[5]],e),e+=6},xp=function(t,e){const s=a(this,et).subarray(4,6),i=a(this,et).subarray(16,18),[n,r,o,c]=a(this,ke),[h,d,u,f]=A(this,$t,Ga).call(this);return t.set([NaN,NaN,NaN,NaN,(s[0]-n)/o,(s[1]-r)/c,NaN,NaN,NaN,NaN,h,d,NaN,NaN,NaN,NaN,u,f,NaN,NaN,NaN,NaN,(i[0]-n)/o,(i[1]-r)/c],e),e+=24},v(Os,sl,8),v(Os,Mc,2),v(Os,kc,a(Os,sl)+a(Os,Mc));let uc=Os;var ua,Wn,Zs,il,Le,nl,Rt,xe,Ua,Va,Tp;class Cp extends vp{constructor(e,s,i,n,r,o){super();v(this,xe);v(this,ua);v(this,Wn,null);v(this,Zs);v(this,il);v(this,Le);v(this,nl);v(this,Rt);m(this,Rt,e),m(this,Le,s),m(this,ua,i),m(this,nl,n),m(this,Zs,r),m(this,il,o),A(this,xe,Tp).call(this,o);const{x:c,y:h,width:d,height:u}=a(this,Wn);for(let f=0,p=e.length;f<p;f+=2)e[f]=(e[f]-c)/d,e[f+1]=(e[f+1]-h)/u;for(let f=0,p=s.length;f<p;f+=2)s[f]=(s[f]-c)/d,s[f+1]=(s[f+1]-h)/u}toSVGPath(){const e=[`M${a(this,Rt)[4]} ${a(this,Rt)[5]}`];for(let s=6,i=a(this,Rt).length;s<i;s+=6){if(isNaN(a(this,Rt)[s])){e.push(`L${a(this,Rt)[s+4]} ${a(this,Rt)[s+5]}`);continue}e.push(`C${a(this,Rt)[s]} ${a(this,Rt)[s+1]} ${a(this,Rt)[s+2]} ${a(this,Rt)[s+3]} ${a(this,Rt)[s+4]} ${a(this,Rt)[s+5]}`)}return e.push("Z"),e.join(" ")}serialize([e,s,i,n],r){const o=i-e,c=n-s;let h,d;switch(r){case 0:h=A(this,xe,Ua).call(this,a(this,Rt),e,n,o,-c),d=A(this,xe,Ua).call(this,a(this,Le),e,n,o,-c);break;case 90:h=A(this,xe,Va).call(this,a(this,Rt),e,s,o,c),d=A(this,xe,Va).call(this,a(this,Le),e,s,o,c);break;case 180:h=A(this,xe,Ua).call(this,a(this,Rt),i,s,-o,c),d=A(this,xe,Ua).call(this,a(this,Le),i,s,-o,c);break;case 270:h=A(this,xe,Va).call(this,a(this,Rt),i,n,-o,-c),d=A(this,xe,Va).call(this,a(this,Le),i,n,-o,-c);break}return{outline:Array.from(h),points:[Array.from(d)]}}get box(){return a(this,Wn)}newOutliner(e,s,i,n,r,o=0){return new uc(e,s,i,n,r,o)}getNewOutline(e,s){const{x:i,y:n,width:r,height:o}=a(this,Wn),[c,h,d,u]=a(this,ua),f=r*d,p=o*u,b=i*d+c,g=n*u+h,_=this.newOutliner({x:a(this,Le)[0]*f+b,y:a(this,Le)[1]*p+g},a(this,ua),a(this,nl),e,a(this,il),s??a(this,Zs));for(let y=2;y<a(this,Le).length;y+=2)_.add({x:a(this,Le)[y]*f+b,y:a(this,Le)[y+1]*p+g});return _.getOutlines()}get mustRemoveSelfIntersections(){return!0}}ua=new WeakMap,Wn=new WeakMap,Zs=new WeakMap,il=new WeakMap,Le=new WeakMap,nl=new WeakMap,Rt=new WeakMap,xe=new WeakSet,Ua=function(e,s,i,n,r){const o=new Float64Array(e.length);for(let c=0,h=e.length;c<h;c+=2)o[c]=s+e[c]*n,o[c+1]=i+e[c+1]*r;return o},Va=function(e,s,i,n,r){const o=new Float64Array(e.length);for(let c=0,h=e.length;c<h;c+=2)o[c]=s+e[c+1]*n,o[c+1]=i+e[c]*r;return o},Tp=function(e){const s=a(this,Rt);let i=s[4],n=s[5],r=i,o=n,c=i,h=n,d=i,u=n;const f=e?Math.max:Math.min;for(let y=6,w=s.length;y<w;y+=6){if(isNaN(s[y]))r=Math.min(r,s[y+4]),o=Math.min(o,s[y+5]),c=Math.max(c,s[y+4]),h=Math.max(h,s[y+5]),u<s[y+5]?(d=s[y+4],u=s[y+5]):u===s[y+5]&&(d=f(d,s[y+4]));else{const E=$.bezierBoundingBox(i,n,...s.slice(y,y+6));r=Math.min(r,E[0]),o=Math.min(o,E[1]),c=Math.max(c,E[2]),h=Math.max(h,E[3]),u<E[3]?(d=E[2],u=E[3]):u===E[3]&&(d=f(d,E[2]))}i=s[y+4],n=s[y+5]}const p=r-a(this,Zs),b=o-a(this,Zs),g=c-r+2*a(this,Zs),_=h-o+2*a(this,Zs);m(this,Wn,{x:p,y:b,width:g,height:_,lastPoint:[d,u]})};var rl,Oi,os,Ae,Rp,Jl,Pp,Ip,Jh;class Su{constructor(t,e=0,s=0,i=!0){v(this,Ae);v(this,rl);v(this,Oi,[]);v(this,os,[]);let n=1/0,r=-1/0,o=1/0,c=-1/0;const h=10**-4;for(const{x:_,y,width:w,height:E}of t){const x=Math.floor((_-e)/h)*h,S=Math.ceil((_+w+e)/h)*h,C=Math.floor((y-e)/h)*h,T=Math.ceil((y+E+e)/h)*h,R=[x,C,T,!0],I=[S,C,T,!1];a(this,Oi).push(R,I),n=Math.min(n,x),r=Math.max(r,S),o=Math.min(o,C),c=Math.max(c,T)}const d=r-n+2*s,u=c-o+2*s,f=n-s,p=o-s,b=a(this,Oi).at(i?-1:-2),g=[b[0],b[2]];for(const _ of a(this,Oi)){const[y,w,E]=_;_[0]=(y-f)/d,_[1]=(w-p)/u,_[2]=(E-p)/u}m(this,rl,{x:f,y:p,width:d,height:u,lastPoint:g})}getOutlines(){a(this,Oi).sort((e,s)=>e[0]-s[0]||e[1]-s[1]||e[2]-s[2]);const t=[];for(const e of a(this,Oi))e[3]?(t.push(...A(this,Ae,Jh).call(this,e)),A(this,Ae,Pp).call(this,e)):(A(this,Ae,Ip).call(this,e),t.push(...A(this,Ae,Jh).call(this,e)));return A(this,Ae,Rp).call(this,t)}}rl=new WeakMap,Oi=new WeakMap,os=new WeakMap,Ae=new WeakSet,Rp=function(t){const e=[],s=new Set;for(const r of t){const[o,c,h]=r;e.push([o,c,r],[o,h,r])}e.sort((r,o)=>r[1]-o[1]||r[0]-o[0]);for(let r=0,o=e.length;r<o;r+=2){const c=e[r][2],h=e[r+1][2];c.push(h),h.push(c),s.add(c),s.add(h)}const i=[];let n;for(;s.size>0;){const r=s.values().next().value;let[o,c,h,d,u]=r;s.delete(r);let f=o,p=c;for(n=[o,h],i.push(n);;){let b;if(s.has(d))b=d;else if(s.has(u))b=u;else break;s.delete(b),[o,c,h,d,u]=b,f!==o&&(n.push(f,p,o,p===c?c:h),f=o),p=p===c?h:c}n.push(f,p)}return new eA(i,a(this,rl))},Jl=function(t){const e=a(this,os);let s=0,i=e.length-1;for(;s<=i;){const n=s+i>>1,r=e[n][0];if(r===t)return n;r<t?s=n+1:i=n-1}return i+1},Pp=function([,t,e]){const s=A(this,Ae,Jl).call(this,t);a(this,os).splice(s,0,[t,e])},Ip=function([,t,e]){const s=A(this,Ae,Jl).call(this,t);for(let i=s;i<a(this,os).length;i++){const[n,r]=a(this,os)[i];if(n!==t)break;if(n===t&&r===e){a(this,os).splice(i,1);return}}for(let i=s-1;i>=0;i--){const[n,r]=a(this,os)[i];if(n!==t)break;if(n===t&&r===e){a(this,os).splice(i,1);return}}},Jh=function(t){const[e,s,i]=t,n=[[e,s,i]],r=A(this,Ae,Jl).call(this,i);for(let o=0;o<r;o++){const[c,h]=a(this,os)[o];for(let d=0,u=n.length;d<u;d++){const[,f,p]=n[d];if(!(h<=f||p<=c)){if(f>=c){if(p>h)n[d][1]=h;else{if(u===1)return[];n.splice(d,1),d--,u--}continue}n[d][2]=c,p>h&&n.push([e,h,p])}}}return n};var al,fa;class eA extends vp{constructor(e,s){super();v(this,al);v(this,fa);m(this,fa,e),m(this,al,s)}toSVGPath(){const e=[];for(const s of a(this,fa)){let[i,n]=s;e.push(`M${i} ${n}`);for(let r=2;r<s.length;r+=2){const o=s[r],c=s[r+1];o===i?(e.push(`V${c}`),n=c):c===n&&(e.push(`H${o}`),i=o)}e.push("Z")}return e.join(" ")}serialize([e,s,i,n],r){const o=[],c=i-e,h=n-s;for(const d of a(this,fa)){const u=new Array(d.length);for(let f=0;f<d.length;f+=2)u[f]=e+d[f]*c,u[f+1]=n-d[f+1]*h;o.push(u)}return o}get box(){return a(this,al)}get classNamesForDrawing(){return["highlight"]}get classNamesForOutlining(){return["highlightOutline"]}}al=new WeakMap,fa=new WeakMap;class td extends uc{newFreeDrawOutline(t,e,s,i,n,r){return new sA(t,e,s,i,n,r)}get classNamesForDrawing(){return["highlight","free"]}}class sA extends Cp{get classNamesForDrawing(){return["highlight","free"]}get classNamesForOutlining(){return["highlightOutline","free"]}newOutliner(t,e,s,i,n,r=0){return new td(t,e,s,i,n,r)}}var ls,Gn,pa,Bt,ol,ga,ll,cl,Ni,cs,ma,hl,dt,ed,sd,id,Qi,Mp,gi;const ye=class ye{constructor({editor:t=null,uiManager:e=null}){v(this,dt);v(this,ls,null);v(this,Gn,null);v(this,pa);v(this,Bt,null);v(this,ol,!1);v(this,ga,!1);v(this,ll,null);v(this,cl);v(this,Ni,null);v(this,cs,null);v(this,ma);var s;t?(m(this,ga,!1),m(this,ma,q.HIGHLIGHT_COLOR),m(this,ll,t)):(m(this,ga,!0),m(this,ma,q.HIGHLIGHT_DEFAULT_COLOR)),m(this,cs,(t==null?void 0:t._uiManager)||e),m(this,cl,a(this,cs)._eventBus),m(this,pa,(t==null?void 0:t.color)||((s=a(this,cs))==null?void 0:s.highlightColors.values().next().value)||"#FFFF98"),a(ye,hl)||m(ye,hl,Object.freeze({blue:"pdfjs-editor-colorpicker-blue",green:"pdfjs-editor-colorpicker-green",pink:"pdfjs-editor-colorpicker-pink",red:"pdfjs-editor-colorpicker-red",yellow:"pdfjs-editor-colorpicker-yellow"}))}static get _keyboardManager(){return it(this,"_keyboardManager",new vl([[["Escape","mac+Escape"],ye.prototype._hideDropdownFromKeyboard],[[" ","mac+ "],ye.prototype._colorSelectFromKeyboard],[["ArrowDown","ArrowRight","mac+ArrowDown","mac+ArrowRight"],ye.prototype._moveToNext],[["ArrowUp","ArrowLeft","mac+ArrowUp","mac+ArrowLeft"],ye.prototype._moveToPrevious],[["Home","mac+Home"],ye.prototype._moveToBeginning],[["End","mac+End"],ye.prototype._moveToEnd]]))}renderButton(){const t=m(this,ls,document.createElement("button"));t.className="colorPicker",t.tabIndex="0",t.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-button"),t.setAttribute("aria-haspopup",!0);const e=a(this,cs)._signal;t.addEventListener("click",A(this,dt,Qi).bind(this),{signal:e}),t.addEventListener("keydown",A(this,dt,id).bind(this),{signal:e});const s=m(this,Gn,document.createElement("span"));return s.className="swatch",s.setAttribute("aria-hidden",!0),s.style.backgroundColor=a(this,pa),t.append(s),t}renderMainDropdown(){const t=m(this,Bt,A(this,dt,ed).call(this));return t.setAttribute("aria-orientation","horizontal"),t.setAttribute("aria-labelledby","highlightColorPickerLabel"),t}_colorSelectFromKeyboard(t){if(t.target===a(this,ls)){A(this,dt,Qi).call(this,t);return}const e=t.target.getAttribute("data-color");e&&A(this,dt,sd).call(this,e,t)}_moveToNext(t){var e,s;if(!a(this,dt,gi)){A(this,dt,Qi).call(this,t);return}if(t.target===a(this,ls)){(e=a(this,Bt).firstChild)==null||e.focus();return}(s=t.target.nextSibling)==null||s.focus()}_moveToPrevious(t){var e,s;if(t.target===((e=a(this,Bt))==null?void 0:e.firstChild)||t.target===a(this,ls)){a(this,dt,gi)&&this._hideDropdownFromKeyboard();return}a(this,dt,gi)||A(this,dt,Qi).call(this,t),(s=t.target.previousSibling)==null||s.focus()}_moveToBeginning(t){var e;if(!a(this,dt,gi)){A(this,dt,Qi).call(this,t);return}(e=a(this,Bt).firstChild)==null||e.focus()}_moveToEnd(t){var e;if(!a(this,dt,gi)){A(this,dt,Qi).call(this,t);return}(e=a(this,Bt).lastChild)==null||e.focus()}hideDropdown(){var t,e;(t=a(this,Bt))==null||t.classList.add("hidden"),(e=a(this,Ni))==null||e.abort(),m(this,Ni,null)}_hideDropdownFromKeyboard(){var t;if(!a(this,ga)){if(!a(this,dt,gi)){(t=a(this,ll))==null||t.unselect();return}this.hideDropdown(),a(this,ls).focus({preventScroll:!0,focusVisible:a(this,ol)})}}updateColor(t){if(a(this,Gn)&&(a(this,Gn).style.backgroundColor=t),!a(this,Bt))return;const e=a(this,cs).highlightColors.values();for(const s of a(this,Bt).children)s.setAttribute("aria-selected",e.next().value===t)}destroy(){var t,e;(t=a(this,ls))==null||t.remove(),m(this,ls,null),m(this,Gn,null),(e=a(this,Bt))==null||e.remove(),m(this,Bt,null)}};ls=new WeakMap,Gn=new WeakMap,pa=new WeakMap,Bt=new WeakMap,ol=new WeakMap,ga=new WeakMap,ll=new WeakMap,cl=new WeakMap,Ni=new WeakMap,cs=new WeakMap,ma=new WeakMap,hl=new WeakMap,dt=new WeakSet,ed=function(){const t=document.createElement("div"),e=a(this,cs)._signal;t.addEventListener("contextmenu",Ye,{signal:e}),t.className="dropdown",t.role="listbox",t.setAttribute("aria-multiselectable",!1),t.setAttribute("aria-orientation","vertical"),t.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-dropdown");for(const[s,i]of a(this,cs).highlightColors){const n=document.createElement("button");n.tabIndex="0",n.role="option",n.setAttribute("data-color",i),n.title=s,n.setAttribute("data-l10n-id",a(ye,hl)[s]);const r=document.createElement("span");n.append(r),r.className="swatch",r.style.backgroundColor=i,n.setAttribute("aria-selected",i===a(this,pa)),n.addEventListener("click",A(this,dt,sd).bind(this,i),{signal:e}),t.append(n)}return t.addEventListener("keydown",A(this,dt,id).bind(this),{signal:e}),t},sd=function(t,e){e.stopPropagation(),a(this,cl).dispatch("switchannotationeditorparams",{source:this,type:a(this,ma),value:t})},id=function(t){ye._keyboardManager.exec(this,t)},Qi=function(t){if(a(this,dt,gi)){this.hideDropdown();return}if(m(this,ol,t.detail===0),a(this,Ni)||(m(this,Ni,new AbortController),window.addEventListener("pointerdown",A(this,dt,Mp).bind(this),{signal:a(this,cs).combinedSignal(a(this,Ni))})),a(this,Bt)){a(this,Bt).classList.remove("hidden");return}const e=m(this,Bt,A(this,dt,ed).call(this));a(this,ls).append(e)},Mp=function(t){var e;(e=a(this,Bt))!=null&&e.contains(t.target)||this.hideDropdown()},gi=function(){return a(this,Bt)&&!a(this,Bt).classList.contains("hidden")},v(ye,hl,null);let fc=ye;var ba,dl,Qs,Un,Aa,We,ul,fl,Vn,hs,le,Ee,va,Js,jt,ya,Ge,pl,Z,nd,tc,kp,Lp,Fp,rd,Ji,Xe,_r,Dp,ec,Xa,Op,Np,Hp,Bp,jp;const rt=class rt extends ht{constructor(e){super({...e,name:"highlightEditor"});v(this,Z);v(this,ba,null);v(this,dl,0);v(this,Qs);v(this,Un,null);v(this,Aa,null);v(this,We,null);v(this,ul,null);v(this,fl,0);v(this,Vn,null);v(this,hs,null);v(this,le,null);v(this,Ee,!1);v(this,va,null);v(this,Js);v(this,jt,null);v(this,ya,"");v(this,Ge);v(this,pl,"");this.color=e.color||rt._defaultColor,m(this,Ge,e.thickness||rt._defaultThickness),m(this,Js,e.opacity||rt._defaultOpacity),m(this,Qs,e.boxes||null),m(this,pl,e.methodOfCreation||""),m(this,ya,e.text||""),this._isDraggable=!1,e.highlightId>-1?(m(this,Ee,!0),A(this,Z,tc).call(this,e),A(this,Z,Ji).call(this)):a(this,Qs)&&(m(this,ba,e.anchorNode),m(this,dl,e.anchorOffset),m(this,ul,e.focusNode),m(this,fl,e.focusOffset),A(this,Z,nd).call(this),A(this,Z,Ji).call(this),this.rotate(this.rotation))}static get _keyboardManager(){const e=rt.prototype;return it(this,"_keyboardManager",new vl([[["ArrowLeft","mac+ArrowLeft"],e._moveCaret,{args:[0]}],[["ArrowRight","mac+ArrowRight"],e._moveCaret,{args:[1]}],[["ArrowUp","mac+ArrowUp"],e._moveCaret,{args:[2]}],[["ArrowDown","mac+ArrowDown"],e._moveCaret,{args:[3]}]]))}get telemetryInitialData(){return{action:"added",type:a(this,Ee)?"free_highlight":"highlight",color:this._uiManager.highlightColorNames.get(this.color),thickness:a(this,Ge),methodOfCreation:a(this,pl)}}get telemetryFinalData(){return{type:"highlight",color:this._uiManager.highlightColorNames.get(this.color)}}static computeTelemetryFinalData(e){return{numberOfColors:e.get("color").size}}static initialize(e,s){var i;ht.initialize(e,s),rt._defaultColor||(rt._defaultColor=((i=s.highlightColors)==null?void 0:i.values().next().value)||"#fff066")}static updateDefaultParams(e,s){switch(e){case q.HIGHLIGHT_DEFAULT_COLOR:rt._defaultColor=s;break;case q.HIGHLIGHT_THICKNESS:rt._defaultThickness=s;break}}translateInPage(e,s){}get toolbarPosition(){return a(this,va)}updateParams(e,s){switch(e){case q.HIGHLIGHT_COLOR:A(this,Z,kp).call(this,s);break;case q.HIGHLIGHT_THICKNESS:A(this,Z,Lp).call(this,s);break}}static get defaultPropertiesToUpdate(){return[[q.HIGHLIGHT_DEFAULT_COLOR,rt._defaultColor],[q.HIGHLIGHT_THICKNESS,rt._defaultThickness]]}get propertiesToUpdate(){return[[q.HIGHLIGHT_COLOR,this.color||rt._defaultColor],[q.HIGHLIGHT_THICKNESS,a(this,Ge)||rt._defaultThickness],[q.HIGHLIGHT_FREE,a(this,Ee)]]}async addEditToolbar(){const e=await super.addEditToolbar();return e?(this._uiManager.highlightColors&&(m(this,Aa,new fc({editor:this})),e.addColorPicker(a(this,Aa))),e):null}disableEditing(){super.disableEditing(),this.div.classList.toggle("disabled",!0)}enableEditing(){super.enableEditing(),this.div.classList.toggle("disabled",!1)}fixAndSetPosition(){return super.fixAndSetPosition(A(this,Z,Xa).call(this))}getBaseTranslation(){return[0,0]}getRect(e,s){return super.getRect(e,s,A(this,Z,Xa).call(this))}onceAdded(){this.annotationElementId||this.parent.addUndoableEditor(this),this.div.focus()}remove(){A(this,Z,rd).call(this),this._reportTelemetry({action:"deleted"}),super.remove()}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(A(this,Z,Ji).call(this),this.isAttachedToDOM||this.parent.add(this)))}setParent(e){var i;let s=!1;this.parent&&!e?A(this,Z,rd).call(this):e&&(A(this,Z,Ji).call(this,e),s=!this.parent&&((i=this.div)==null?void 0:i.classList.contains("selectedEditor"))),super.setParent(e),this.show(this._isVisible),s&&this.select()}rotate(e){var n,r,o;const{drawLayer:s}=this.parent;let i;a(this,Ee)?(e=(e-this.rotation+360)%360,i=A(n=rt,Xe,_r).call(n,a(this,hs).box,e)):i=A(r=rt,Xe,_r).call(r,this,e),s.rotate(a(this,le),e),s.rotate(a(this,jt),e),s.updateBox(a(this,le),i),s.updateBox(a(this,jt),A(o=rt,Xe,_r).call(o,a(this,We).box,e))}render(){if(this.div)return this.div;const e=super.render();a(this,ya)&&(e.setAttribute("aria-label",a(this,ya)),e.setAttribute("role","mark")),a(this,Ee)?e.classList.add("free"):this.div.addEventListener("keydown",A(this,Z,Dp).bind(this),{signal:this._uiManager._signal});const s=m(this,Vn,document.createElement("div"));e.append(s),s.setAttribute("aria-hidden","true"),s.className="internal",s.style.clipPath=a(this,Un);const[i,n]=this.parentDimensions;return this.setDims(this.width*i,this.height*n),hc(this,a(this,Vn),["pointerover","pointerleave"]),this.enableEditing(),e}pointerover(){this.isSelected||this.parent.drawLayer.addClass(a(this,jt),"hovered")}pointerleave(){this.isSelected||this.parent.drawLayer.removeClass(a(this,jt),"hovered")}_moveCaret(e){switch(this.parent.unselect(this),e){case 0:case 2:A(this,Z,ec).call(this,!0);break;case 1:case 3:A(this,Z,ec).call(this,!1);break}}select(){var e,s;super.select(),a(this,jt)&&((e=this.parent)==null||e.drawLayer.removeClass(a(this,jt),"hovered"),(s=this.parent)==null||s.drawLayer.addClass(a(this,jt),"selected"))}unselect(){var e;super.unselect(),a(this,jt)&&((e=this.parent)==null||e.drawLayer.removeClass(a(this,jt),"selected"),a(this,Ee)||A(this,Z,ec).call(this,!1))}get _mustFixPosition(){return!a(this,Ee)}show(e=this._isVisible){super.show(e),this.parent&&(this.parent.drawLayer.show(a(this,le),e),this.parent.drawLayer.show(a(this,jt),e))}static startHighlighting(e,s,{target:i,x:n,y:r}){const{x:o,y:c,width:h,height:d}=i.getBoundingClientRect(),u=new AbortController,f=e.combinedSignal(u),p=g=>{g.preventDefault(),g.stopPropagation()},b=g=>{u.abort(),A(this,Xe,Bp).call(this,e,g)};window.addEventListener("blur",b,{signal:f}),window.addEventListener("pointerup",b,{signal:f}),window.addEventListener("pointerdown",p,{capture:!0,passive:!1,signal:f}),window.addEventListener("contextmenu",Ye,{signal:f}),i.addEventListener("pointermove",A(this,Xe,Hp).bind(this,e),{signal:f}),this._freeHighlight=new td({x:n,y:r},[o,c,h,d],e.scale,this._defaultThickness/2,s,.001),{id:this._freeHighlightId,clipPathId:this._freeHighlightClipId}=e.drawLayer.draw(this._freeHighlight,this._defaultColor,this._defaultOpacity,!0)}static async deserialize(e,s,i){var g,_,y,w;let n=null;if(e instanceof dp){const{data:{quadPoints:E,rect:x,rotation:S,id:C,color:T,opacity:R,popupRef:I},parent:{page:{pageNumber:D}}}=e;n=e={annotationType:Q.HIGHLIGHT,color:Array.from(T),opacity:R,quadPoints:E,boxes:null,pageIndex:D-1,rect:x.slice(0),rotation:S,id:C,deleted:!1,popupRef:I}}else if(e instanceof Vd){const{data:{inkLists:E,rect:x,rotation:S,id:C,color:T,borderStyle:{rawWidth:R},popupRef:I},parent:{page:{pageNumber:D}}}=e;n=e={annotationType:Q.HIGHLIGHT,color:Array.from(T),thickness:R,inkLists:E,boxes:null,pageIndex:D-1,rect:x.slice(0),rotation:S,id:C,deleted:!1,popupRef:I}}const{color:r,quadPoints:o,inkLists:c,opacity:h}=e,d=await super.deserialize(e,s,i);d.color=$.makeHexColor(...r),m(d,Js,h||1),c&&m(d,Ge,e.thickness),d.annotationElementId=e.id||null,d._initialData=n;const[u,f]=d.pageDimensions,[p,b]=d.pageTranslation;if(o){const E=m(d,Qs,[]);for(let x=0;x<o.length;x+=8)E.push({x:(o[x]-p)/u,y:1-(o[x+1]-b)/f,width:(o[x+2]-o[x])/u,height:(o[x+1]-o[x+5])/f});A(g=d,Z,nd).call(g),A(_=d,Z,Ji).call(_),d.rotate(d.rotation)}else if(c){m(d,Ee,!0);const E=c[0],x={x:E[0]-p,y:f-(E[1]-b)},S=new td(x,[0,0,u,f],1,a(d,Ge)/2,!0,.001);for(let R=0,I=E.length;R<I;R+=2)x.x=E[R]-p,x.y=f-(E[R+1]-b),S.add(x);const{id:C,clipPathId:T}=s.drawLayer.draw(S,d.color,d._defaultOpacity,!0);A(y=d,Z,tc).call(y,{highlightOutlines:S.getOutlines(),highlightId:C,clipPathId:T}),A(w=d,Z,Ji).call(w)}return d}serialize(e=!1){if(this.isEmpty()||e)return null;if(this.deleted)return this.serializeDeleted();const s=this.getRect(0,0),i=ht._colorManager.convert(this.color),n={annotationType:Q.HIGHLIGHT,color:i,opacity:a(this,Js),thickness:a(this,Ge),quadPoints:A(this,Z,Op).call(this),outlines:A(this,Z,Np).call(this,s),pageIndex:this.pageIndex,rect:s,rotation:A(this,Z,Xa).call(this),structTreeParentId:this._structTreeParentId};return this.annotationElementId&&!A(this,Z,jp).call(this,n)?null:(n.id=this.annotationElementId,n)}renderAnnotationElement(e){return e.updateEdited({rect:this.getRect(0,0)}),null}static canCreateNewEmptyEditor(){return!1}};ba=new WeakMap,dl=new WeakMap,Qs=new WeakMap,Un=new WeakMap,Aa=new WeakMap,We=new WeakMap,ul=new WeakMap,fl=new WeakMap,Vn=new WeakMap,hs=new WeakMap,le=new WeakMap,Ee=new WeakMap,va=new WeakMap,Js=new WeakMap,jt=new WeakMap,ya=new WeakMap,Ge=new WeakMap,pl=new WeakMap,Z=new WeakSet,nd=function(){const e=new Su(a(this,Qs),.001);m(this,hs,e.getOutlines()),{x:this.x,y:this.y,width:this.width,height:this.height}=a(this,hs).box;const s=new Su(a(this,Qs),.0025,.001,this._uiManager.direction==="ltr");m(this,We,s.getOutlines());const{lastPoint:i}=a(this,We).box;m(this,va,[(i[0]-this.x)/this.width,(i[1]-this.y)/this.height])},tc=function({highlightOutlines:e,highlightId:s,clipPathId:i}){var u,f;if(m(this,hs,e),m(this,We,e.getNewOutline(a(this,Ge)/2+1.5,.0025)),s>=0)m(this,le,s),m(this,Un,i),this.parent.drawLayer.finalizeLine(s,e),m(this,jt,this.parent.drawLayer.drawOutline(a(this,We)));else if(this.parent){const p=this.parent.viewport.rotation;this.parent.drawLayer.updateLine(a(this,le),e),this.parent.drawLayer.updateBox(a(this,le),A(u=rt,Xe,_r).call(u,a(this,hs).box,(p-this.rotation+360)%360)),this.parent.drawLayer.updateLine(a(this,jt),a(this,We)),this.parent.drawLayer.updateBox(a(this,jt),A(f=rt,Xe,_r).call(f,a(this,We).box,p))}const{x:r,y:o,width:c,height:h}=e.box;switch(this.rotation){case 0:this.x=r,this.y=o,this.width=c,this.height=h;break;case 90:{const[p,b]=this.parentDimensions;this.x=o,this.y=1-r,this.width=c*b/p,this.height=h*p/b;break}case 180:this.x=1-r,this.y=1-o,this.width=c,this.height=h;break;case 270:{const[p,b]=this.parentDimensions;this.x=1-o,this.y=r,this.width=c*b/p,this.height=h*p/b;break}}const{lastPoint:d}=a(this,We).box;m(this,va,[(d[0]-r)/c,(d[1]-o)/h])},kp=function(e){const s=(r,o)=>{var c,h,d;this.color=r,(c=this.parent)==null||c.drawLayer.changeColor(a(this,le),r),(h=a(this,Aa))==null||h.updateColor(r),m(this,Js,o),(d=this.parent)==null||d.drawLayer.changeOpacity(a(this,le),o)},i=this.color,n=a(this,Js);this.addCommands({cmd:s.bind(this,e,rt._defaultOpacity),undo:s.bind(this,i,n),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:q.HIGHLIGHT_COLOR,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"color_changed",color:this._uiManager.highlightColorNames.get(e)},!0)},Lp=function(e){const s=a(this,Ge),i=n=>{m(this,Ge,n),A(this,Z,Fp).call(this,n)};this.addCommands({cmd:i.bind(this,e),undo:i.bind(this,s),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:q.INK_THICKNESS,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"thickness_changed",thickness:e},!0)},Fp=function(e){if(!a(this,Ee))return;A(this,Z,tc).call(this,{highlightOutlines:a(this,hs).getNewOutline(e/2)}),this.fixAndSetPosition();const[s,i]=this.parentDimensions;this.setDims(this.width*s,this.height*i)},rd=function(){a(this,le)===null||!this.parent||(this.parent.drawLayer.remove(a(this,le)),m(this,le,null),this.parent.drawLayer.remove(a(this,jt)),m(this,jt,null))},Ji=function(e=this.parent){a(this,le)===null&&({id:ue(this,le)._,clipPathId:ue(this,Un)._}=e.drawLayer.draw(a(this,hs),this.color,a(this,Js)),m(this,jt,e.drawLayer.drawOutline(a(this,We))),a(this,Vn)&&(a(this,Vn).style.clipPath=a(this,Un)))},Xe=new WeakSet,_r=function({x:e,y:s,width:i,height:n},r){switch(r){case 90:return{x:1-s-n,y:e,width:n,height:i};case 180:return{x:1-e-i,y:1-s-n,width:i,height:n};case 270:return{x:s,y:1-e-i,width:n,height:i}}return{x:e,y:s,width:i,height:n}},Dp=function(e){rt._keyboardManager.exec(this,e)},ec=function(e){if(!a(this,ba))return;const s=window.getSelection();e?s.setPosition(a(this,ba),a(this,dl)):s.setPosition(a(this,ul),a(this,fl))},Xa=function(){return a(this,Ee)?this.rotation:0},Op=function(){if(a(this,Ee))return null;const[e,s]=this.pageDimensions,[i,n]=this.pageTranslation,r=a(this,Qs),o=new Float32Array(r.length*8);let c=0;for(const{x:h,y:d,width:u,height:f}of r){const p=h*e+i,b=(1-d-f)*s+n;o[c]=o[c+4]=p,o[c+1]=o[c+3]=b,o[c+2]=o[c+6]=p+u*e,o[c+5]=o[c+7]=b+f*s,c+=8}return o},Np=function(e){return a(this,hs).serialize(e,A(this,Z,Xa).call(this))},Hp=function(e,s){this._freeHighlight.add(s)&&e.drawLayer.updatePath(this._freeHighlightId,this._freeHighlight)},Bp=function(e,s){this._freeHighlight.isEmpty()?e.drawLayer.remove(this._freeHighlightId):e.createAndAddNewEditor(s,!1,{highlightId:this._freeHighlightId,highlightOutlines:this._freeHighlight.getOutlines(),clipPathId:this._freeHighlightClipId,methodOfCreation:"main_toolbar"}),this._freeHighlightId=-1,this._freeHighlight=null,this._freeHighlightClipId=""},jp=function(e){const{color:s}=this._initialData;return e.color.some((i,n)=>i!==s[n])},v(rt,Xe),X(rt,"_defaultColor",null),X(rt,"_defaultOpacity",1),X(rt,"_defaultThickness",12),X(rt,"_type","highlight"),X(rt,"_editorType",Q.HIGHLIGHT),X(rt,"_freeHighlightId",-1),X(rt,"_freeHighlight",null),X(rt,"_freeHighlightClipId","");let pc=rt;var Xn,qn,Cs,ti,Ue,Yn,Kn,Zn,ei,_a,Qn,Jn,Hi,k,zp,$p,Wp,Gp,od,Up,ld,Vp,Xp,qp,Yp,Kp,tn,cd,hd,dd,sc,ic,wr,ud,nc,fi,Zp,fd,Qp,Jp,pd,rc,qa;const yt=class yt extends ht{constructor(e){super({...e,name:"inkEditor"});v(this,k);v(this,Xn,0);v(this,qn,0);v(this,Cs,null);v(this,ti,new Path2D);v(this,Ue,!1);v(this,Yn,null);v(this,Kn,!1);v(this,Zn,!1);v(this,ei,null);v(this,_a,null);v(this,Qn,0);v(this,Jn,0);v(this,Hi,null);this.color=e.color||null,this.thickness=e.thickness||null,this.opacity=e.opacity||null,this.paths=[],this.bezierPath2D=[],this.allRawPaths=[],this.currentPath=[],this.scaleFactor=1,this.translationX=this.translationY=0,this.x=0,this.y=0,this._willKeepAspectRatio=!0}static initialize(e,s){ht.initialize(e,s)}static updateDefaultParams(e,s){switch(e){case q.INK_THICKNESS:yt._defaultThickness=s;break;case q.INK_COLOR:yt._defaultColor=s;break;case q.INK_OPACITY:yt._defaultOpacity=s/100;break}}updateParams(e,s){switch(e){case q.INK_THICKNESS:A(this,k,zp).call(this,s);break;case q.INK_COLOR:A(this,k,$p).call(this,s);break;case q.INK_OPACITY:A(this,k,Wp).call(this,s);break}}static get defaultPropertiesToUpdate(){return[[q.INK_THICKNESS,yt._defaultThickness],[q.INK_COLOR,yt._defaultColor||ht._defaultLineColor],[q.INK_OPACITY,Math.round(yt._defaultOpacity*100)]]}get propertiesToUpdate(){return[[q.INK_THICKNESS,this.thickness||yt._defaultThickness],[q.INK_COLOR,this.color||yt._defaultColor||ht._defaultLineColor],[q.INK_OPACITY,Math.round(100*(this.opacity??yt._defaultOpacity))]]}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(this.canvas||(A(this,k,sc).call(this),A(this,k,ic).call(this)),this.isAttachedToDOM||(this.parent.add(this),A(this,k,wr).call(this)),A(this,k,qa).call(this)))}remove(){var e;this.canvas!==null&&(this.isEmpty()||this.commit(),this.canvas.width=this.canvas.height=0,this.canvas.remove(),this.canvas=null,a(this,Cs)&&(clearTimeout(a(this,Cs)),m(this,Cs,null)),(e=a(this,ei))==null||e.disconnect(),m(this,ei,null),super.remove())}setParent(e){!this.parent&&e?this._uiManager.removeShouldRescale(this):this.parent&&e===null&&this._uiManager.addShouldRescale(this),super.setParent(e)}onScaleChanging(){const[e,s]=this.parentDimensions,i=this.width*e,n=this.height*s;this.setDimensions(i,n)}enableEditMode(){a(this,Ue)||this.canvas===null||(super.enableEditMode(),this._isDraggable=!1,A(this,k,cd).call(this))}disableEditMode(){!this.isInEditMode()||this.canvas===null||(super.disableEditMode(),this._isDraggable=!this.isEmpty(),this.div.classList.remove("editing"),A(this,k,hd).call(this))}onceAdded(){this._isDraggable=!this.isEmpty()}isEmpty(){return this.paths.length===0||this.paths.length===1&&this.paths[0].length===0}commit(){a(this,Ue)||(super.commit(),this.isEditing=!1,this.disableEditMode(),this.setInForeground(),m(this,Ue,!0),this.div.classList.add("disabled"),A(this,k,qa).call(this,!0),this.select(),this.parent.addInkEditorIfNeeded(!0),this.moveInDOM(),this.div.focus({preventScroll:!0}))}focusin(e){this._focusEventsAllowed&&(super.focusin(e),this.enableEditMode())}canvasPointerdown(e){e.button!==0||!this.isInEditMode()||a(this,Ue)||(this.setInForeground(),e.preventDefault(),this.div.contains(document.activeElement)||this.div.focus({preventScroll:!0}),A(this,k,Up).call(this,e.offsetX,e.offsetY))}canvasPointermove(e){e.preventDefault(),A(this,k,ld).call(this,e.offsetX,e.offsetY)}canvasPointerup(e){e.preventDefault(),A(this,k,dd).call(this,e)}canvasPointerleave(e){A(this,k,dd).call(this,e)}get isResizable(){return!this.isEmpty()&&a(this,Ue)}render(){if(this.div)return this.div;let e,s;this.width&&(e=this.x,s=this.y),super.render(),this.div.setAttribute("data-l10n-id","pdfjs-ink");const[i,n,r,o]=A(this,k,Gp).call(this);if(this.setAt(i,n,0,0),this.setDims(r,o),A(this,k,sc).call(this),this.width){const[c,h]=this.parentDimensions;this.setAspectRatio(this.width*c,this.height*h),this.setAt(e*c,s*h,this.width*c,this.height*h),m(this,Zn,!0),A(this,k,wr).call(this),this.setDims(this.width*c,this.height*h),A(this,k,tn).call(this),this.div.classList.add("disabled")}else this.div.classList.add("editing"),this.enableEditMode();return A(this,k,ic).call(this),this.div}setDimensions(e,s){const i=Math.round(e),n=Math.round(s);if(a(this,Qn)===i&&a(this,Jn)===n)return;m(this,Qn,i),m(this,Jn,n),this.canvas.style.visibility="hidden";const[r,o]=this.parentDimensions;this.width=e/r,this.height=s/o,this.fixAndSetPosition(),a(this,Ue)&&A(this,k,ud).call(this,e,s),A(this,k,wr).call(this),A(this,k,tn).call(this),this.canvas.style.visibility="visible",this.fixDims()}static async deserialize(e,s,i){var _,y,w;if(e instanceof Vd)return null;const n=await super.deserialize(e,s,i);n.thickness=e.thickness,n.color=$.makeHexColor(...e.color),n.opacity=e.opacity;const[r,o]=n.pageDimensions,c=n.width*r,h=n.height*o,d=n.parentScale,u=e.thickness/2;m(n,Ue,!0),m(n,Qn,Math.round(c)),m(n,Jn,Math.round(h));const{paths:f,rect:p,rotation:b}=e;for(let{bezier:E}of f){E=A(_=yt,fi,Qp).call(_,E,p,b);const x=[];n.paths.push(x);let S=d*(E[0]-u),C=d*(E[1]-u);for(let R=2,I=E.length;R<I;R+=6){const D=d*(E[R]-u),M=d*(E[R+1]-u),L=d*(E[R+2]-u),j=d*(E[R+3]-u),O=d*(E[R+4]-u),U=d*(E[R+5]-u);x.push([[S,C],[D,M],[L,j],[O,U]]),S=O,C=U}const T=A(this,fi,Zp).call(this,x);n.bezierPath2D.push(T)}const g=A(y=n,k,pd).call(y);return m(n,qn,Math.max(ht.MIN_SIZE,g[2]-g[0])),m(n,Xn,Math.max(ht.MIN_SIZE,g[3]-g[1])),A(w=n,k,ud).call(w,c,h),n}serialize(){if(this.isEmpty())return null;const e=this.getRect(0,0),s=ht._colorManager.convert(this.ctx.strokeStyle);return{annotationType:Q.INK,color:s,thickness:this.thickness,opacity:this.opacity,paths:A(this,k,Jp).call(this,this.scaleFactor/this.parentScale,this.translationX,this.translationY,e),pageIndex:this.pageIndex,rect:e,rotation:this.rotation,structTreeParentId:this._structTreeParentId}}};Xn=new WeakMap,qn=new WeakMap,Cs=new WeakMap,ti=new WeakMap,Ue=new WeakMap,Yn=new WeakMap,Kn=new WeakMap,Zn=new WeakMap,ei=new WeakMap,_a=new WeakMap,Qn=new WeakMap,Jn=new WeakMap,Hi=new WeakMap,k=new WeakSet,zp=function(e){const s=n=>{this.thickness=n,A(this,k,qa).call(this)},i=this.thickness;this.addCommands({cmd:s.bind(this,e),undo:s.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:q.INK_THICKNESS,overwriteIfSameType:!0,keepUndo:!0})},$p=function(e){const s=n=>{this.color=n,A(this,k,tn).call(this)},i=this.color;this.addCommands({cmd:s.bind(this,e),undo:s.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:q.INK_COLOR,overwriteIfSameType:!0,keepUndo:!0})},Wp=function(e){const s=n=>{this.opacity=n,A(this,k,tn).call(this)};e/=100;const i=this.opacity;this.addCommands({cmd:s.bind(this,e),undo:s.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:q.INK_OPACITY,overwriteIfSameType:!0,keepUndo:!0})},Gp=function(){const{parentRotation:e,parentDimensions:[s,i]}=this;switch(e){case 90:return[0,i,i,s];case 180:return[s,i,s,i];case 270:return[s,0,i,s];default:return[0,0,s,i]}},od=function(){const{ctx:e,color:s,opacity:i,thickness:n,parentScale:r,scaleFactor:o}=this;e.lineWidth=n*r/o,e.lineCap="round",e.lineJoin="round",e.miterLimit=10,e.strokeStyle=`${s}${Sm(i)}`},Up=function(e,s){this.canvas.addEventListener("contextmenu",Ye,{signal:this._uiManager._signal}),A(this,k,hd).call(this),m(this,Yn,new AbortController);const i=this._uiManager.combinedSignal(a(this,Yn));this.canvas.addEventListener("pointerleave",this.canvasPointerleave.bind(this),{signal:i}),this.canvas.addEventListener("pointermove",this.canvasPointermove.bind(this),{signal:i}),this.canvas.addEventListener("pointerup",this.canvasPointerup.bind(this),{signal:i}),this.isEditing=!0,a(this,Zn)||(m(this,Zn,!0),A(this,k,wr).call(this),this.thickness||(this.thickness=yt._defaultThickness),this.color||(this.color=yt._defaultColor||ht._defaultLineColor),this.opacity??(this.opacity=yt._defaultOpacity)),this.currentPath.push([e,s]),m(this,Kn,!1),A(this,k,od).call(this),m(this,Hi,()=>{A(this,k,qp).call(this),a(this,Hi)&&window.requestAnimationFrame(a(this,Hi))}),window.requestAnimationFrame(a(this,Hi))},ld=function(e,s){const[i,n]=this.currentPath.at(-1);if(this.currentPath.length>1&&e===i&&s===n)return;const r=this.currentPath;let o=a(this,ti);if(r.push([e,s]),m(this,Kn,!0),r.length<=2){o.moveTo(...r[0]),o.lineTo(e,s);return}r.length===3&&(m(this,ti,o=new Path2D),o.moveTo(...r[0])),A(this,k,Yp).call(this,o,...r.at(-3),...r.at(-2),e,s)},Vp=function(){if(this.currentPath.length===0)return;const e=this.currentPath.at(-1);a(this,ti).lineTo(...e)},Xp=function(e,s){m(this,Hi,null),e=Math.min(Math.max(e,0),this.canvas.width),s=Math.min(Math.max(s,0),this.canvas.height),A(this,k,ld).call(this,e,s),A(this,k,Vp).call(this);let i;if(this.currentPath.length!==1)i=A(this,k,Kp).call(this);else{const h=[e,s];i=[[h,h.slice(),h.slice(),h]]}const n=a(this,ti),r=this.currentPath;this.currentPath=[],m(this,ti,new Path2D);const o=()=>{this.allRawPaths.push(r),this.paths.push(i),this.bezierPath2D.push(n),this._uiManager.rebuild(this)},c=()=>{this.allRawPaths.pop(),this.paths.pop(),this.bezierPath2D.pop(),this.paths.length===0?this.remove():(this.canvas||(A(this,k,sc).call(this),A(this,k,ic).call(this)),A(this,k,qa).call(this))};this.addCommands({cmd:o,undo:c,mustExec:!0})},qp=function(){if(!a(this,Kn))return;m(this,Kn,!1);const e=Math.ceil(this.thickness*this.parentScale),s=this.currentPath.slice(-3),i=s.map(o=>o[0]),n=s.map(o=>o[1]);Math.min(...i)-e,Math.max(...i)+e,Math.min(...n)-e,Math.max(...n)+e;const{ctx:r}=this;r.save(),r.clearRect(0,0,this.canvas.width,this.canvas.height);for(const o of this.bezierPath2D)r.stroke(o);r.stroke(a(this,ti)),r.restore()},Yp=function(e,s,i,n,r,o,c){const h=(s+n)/2,d=(i+r)/2,u=(n+o)/2,f=(r+c)/2;e.bezierCurveTo(h+2*(n-h)/3,d+2*(r-d)/3,u+2*(n-u)/3,f+2*(r-f)/3,u,f)},Kp=function(){const e=this.currentPath;if(e.length<=2)return[[e[0],e[0],e.at(-1),e.at(-1)]];const s=[];let i,[n,r]=e[0];for(i=1;i<e.length-2;i++){const[p,b]=e[i],[g,_]=e[i+1],y=(p+g)/2,w=(b+_)/2,E=[n+2*(p-n)/3,r+2*(b-r)/3],x=[y+2*(p-y)/3,w+2*(b-w)/3];s.push([[n,r],E,x,[y,w]]),[n,r]=[y,w]}const[o,c]=e[i],[h,d]=e[i+1],u=[n+2*(o-n)/3,r+2*(c-r)/3],f=[h+2*(o-h)/3,d+2*(c-d)/3];return s.push([[n,r],u,f,[h,d]]),s},tn=function(){if(this.isEmpty()){A(this,k,nc).call(this);return}A(this,k,od).call(this);const{canvas:e,ctx:s}=this;s.setTransform(1,0,0,1,0,0),s.clearRect(0,0,e.width,e.height),A(this,k,nc).call(this);for(const i of this.bezierPath2D)s.stroke(i)},cd=function(){if(a(this,_a))return;m(this,_a,new AbortController);const e=this._uiManager.combinedSignal(a(this,_a));this.canvas.addEventListener("pointerdown",this.canvasPointerdown.bind(this),{signal:e})},hd=function(){var e;(e=this.pointerdownAC)==null||e.abort(),this.pointerdownAC=null},dd=function(e){var s;(s=a(this,Yn))==null||s.abort(),m(this,Yn,null),A(this,k,cd).call(this),a(this,Cs)&&clearTimeout(a(this,Cs)),m(this,Cs,setTimeout(()=>{m(this,Cs,null),this.canvas.removeEventListener("contextmenu",Ye)},10)),A(this,k,Xp).call(this,e.offsetX,e.offsetY),this.addToAnnotationStorage(),this.setInBackground()},sc=function(){this.canvas=document.createElement("canvas"),this.canvas.width=this.canvas.height=0,this.canvas.className="inkEditorCanvas",this.canvas.setAttribute("data-l10n-id","pdfjs-ink-canvas"),this.div.append(this.canvas),this.ctx=this.canvas.getContext("2d")},ic=function(){m(this,ei,new ResizeObserver(e=>{const s=e[0].contentRect;s.width&&s.height&&this.setDimensions(s.width,s.height)})),a(this,ei).observe(this.div),this._uiManager._signal.addEventListener("abort",()=>{var e;(e=a(this,ei))==null||e.disconnect(),m(this,ei,null)},{once:!0})},wr=function(){if(!a(this,Zn))return;const[e,s]=this.parentDimensions;this.canvas.width=Math.ceil(this.width*e),this.canvas.height=Math.ceil(this.height*s),A(this,k,nc).call(this)},ud=function(e,s){const i=A(this,k,rc).call(this),n=(e-i)/a(this,qn),r=(s-i)/a(this,Xn);this.scaleFactor=Math.min(n,r)},nc=function(){const e=A(this,k,rc).call(this)/2;this.ctx.setTransform(this.scaleFactor,0,0,this.scaleFactor,this.translationX*this.scaleFactor+e,this.translationY*this.scaleFactor+e)},fi=new WeakSet,Zp=function(e){const s=new Path2D;for(let i=0,n=e.length;i<n;i++){const[r,o,c,h]=e[i];i===0&&s.moveTo(...r),s.bezierCurveTo(o[0],o[1],c[0],c[1],h[0],h[1])}return s},fd=function(e,s,i){const[n,r,o,c]=s;switch(i){case 0:for(let h=0,d=e.length;h<d;h+=2)e[h]+=n,e[h+1]=c-e[h+1];break;case 90:for(let h=0,d=e.length;h<d;h+=2){const u=e[h];e[h]=e[h+1]+n,e[h+1]=u+r}break;case 180:for(let h=0,d=e.length;h<d;h+=2)e[h]=o-e[h],e[h+1]+=r;break;case 270:for(let h=0,d=e.length;h<d;h+=2){const u=e[h];e[h]=o-e[h+1],e[h+1]=c-u}break;default:throw new Error("Invalid rotation")}return e},Qp=function(e,s,i){const[n,r,o,c]=s;switch(i){case 0:for(let h=0,d=e.length;h<d;h+=2)e[h]-=n,e[h+1]=c-e[h+1];break;case 90:for(let h=0,d=e.length;h<d;h+=2){const u=e[h];e[h]=e[h+1]-r,e[h+1]=u-n}break;case 180:for(let h=0,d=e.length;h<d;h+=2)e[h]=o-e[h],e[h+1]-=r;break;case 270:for(let h=0,d=e.length;h<d;h+=2){const u=e[h];e[h]=c-e[h+1],e[h+1]=o-u}break;default:throw new Error("Invalid rotation")}return e},Jp=function(e,s,i,n){var d,u;const r=[],o=this.thickness/2,c=e*s+o,h=e*i+o;for(const f of this.paths){const p=[],b=[];for(let g=0,_=f.length;g<_;g++){const[y,w,E,x]=f[g];if(y[0]===x[0]&&y[1]===x[1]&&_===1){const j=e*y[0]+c,O=e*y[1]+h;p.push(j,O),b.push(j,O);break}const S=e*y[0]+c,C=e*y[1]+h,T=e*w[0]+c,R=e*w[1]+h,I=e*E[0]+c,D=e*E[1]+h,M=e*x[0]+c,L=e*x[1]+h;g===0&&(p.push(S,C),b.push(S,C)),p.push(T,R,I,D,M,L),b.push(T,R),g===_-1&&b.push(M,L)}r.push({bezier:A(d=yt,fi,fd).call(d,p,n,this.rotation),points:A(u=yt,fi,fd).call(u,b,n,this.rotation)})}return r},pd=function(){let e=1/0,s=-1/0,i=1/0,n=-1/0;for(const r of this.paths)for(const[o,c,h,d]of r){const u=$.bezierBoundingBox(...o,...c,...h,...d);e=Math.min(e,u[0]),i=Math.min(i,u[1]),s=Math.max(s,u[2]),n=Math.max(n,u[3])}return[e,i,s,n]},rc=function(){return a(this,Ue)?Math.ceil(this.thickness*this.parentScale):0},qa=function(e=!1){if(this.isEmpty())return;if(!a(this,Ue)){A(this,k,tn).call(this);return}const s=A(this,k,pd).call(this),i=A(this,k,rc).call(this);m(this,qn,Math.max(ht.MIN_SIZE,s[2]-s[0])),m(this,Xn,Math.max(ht.MIN_SIZE,s[3]-s[1]));const n=Math.ceil(i+a(this,qn)*this.scaleFactor),r=Math.ceil(i+a(this,Xn)*this.scaleFactor),[o,c]=this.parentDimensions;this.width=n/o,this.height=r/c,this.setAspectRatio(n,r);const h=this.translationX,d=this.translationY;this.translationX=-s[0],this.translationY=-s[1],A(this,k,wr).call(this),A(this,k,tn).call(this),m(this,Qn,n),m(this,Jn,r),this.setDims(n,r);const u=e?i/this.scaleFactor/2:0;this.translate(h-this.translationX-u,d-this.translationY-u)},v(yt,fi),X(yt,"_defaultColor",null),X(yt,"_defaultOpacity",1),X(yt,"_defaultThickness",1),X(yt,"_type","ink"),X(yt,"_editorType",Q.INK);let ad=yt;var wt,te,Bi,si,ji,wa,Ts,ii,Rs,Fe,Ea,st,Ya,Ka,ac,md,tg,oc,bd,lc,eg,sg;const Ja=class Ja extends ht{constructor(e){super({...e,name:"stampEditor"});v(this,st);v(this,wt,null);v(this,te,null);v(this,Bi,null);v(this,si,null);v(this,ji,null);v(this,wa,"");v(this,Ts,null);v(this,ii,null);v(this,Rs,null);v(this,Fe,!1);v(this,Ea,!1);m(this,si,e.bitmapUrl),m(this,ji,e.bitmapFile)}static initialize(e,s){ht.initialize(e,s)}static get supportedTypes(){return it(this,"supportedTypes",["apng","avif","bmp","gif","jpeg","png","svg+xml","webp","x-icon"].map(s=>`image/${s}`))}static get supportedTypesStr(){return it(this,"supportedTypesStr",this.supportedTypes.join(","))}static isHandlingMimeForPasting(e){return this.supportedTypes.includes(e)}static paste(e,s){s.pasteEditor(Q.STAMP,{bitmapFile:e.getAsFile()})}altTextFinish(){this._uiManager.useNewAltTextFlow&&(this.div.hidden=!1),super.altTextFinish()}get telemetryFinalData(){var e;return{type:"stamp",hasAltText:!!((e=this.altTextData)!=null&&e.altText)}}static computeTelemetryFinalData(e){const s=e.get("hasAltText");return{hasAltText:s.get(!0)??0,hasNoAltText:s.get(!1)??0}}async mlGuessAltText(e=null,s=!0){if(this.hasAltTextData())return null;const{mlManager:i}=this._uiManager;if(!i)throw new Error("No ML.");if(!await i.isEnabledFor("altText"))throw new Error("ML isn't enabled for alt text.");const{data:n,width:r,height:o}=e||this.copyCanvas(null,null,!0).imageData,c=await i.guess({name:"altText",request:{data:n,width:r,height:o,channels:n.length/(r*o)}});if(!c)throw new Error("No response from the AI service.");if(c.error)throw new Error("Error from the AI service.");if(c.cancel)return null;if(!c.output)throw new Error("No valid response from the AI service.");const h=c.output;return await this.setGuessedAltText(h),s&&!this.hasAltTextData()&&(this.altTextData={alt:h,decorative:!1}),h}remove(){var e,s;a(this,te)&&(m(this,wt,null),this._uiManager.imageManager.deleteId(a(this,te)),(e=a(this,Ts))==null||e.remove(),m(this,Ts,null),(s=a(this,ii))==null||s.disconnect(),m(this,ii,null),a(this,Rs)&&(clearTimeout(a(this,Rs)),m(this,Rs,null))),super.remove()}rebuild(){if(!this.parent){a(this,te)&&A(this,st,ac).call(this);return}super.rebuild(),this.div!==null&&(a(this,te)&&a(this,Ts)===null&&A(this,st,ac).call(this),this.isAttachedToDOM||this.parent.add(this))}onceAdded(){this._isDraggable=!0,this.div.focus()}isEmpty(){return!(a(this,Bi)||a(this,wt)||a(this,si)||a(this,ji)||a(this,te))}get isResizable(){return!0}render(){if(this.div)return this.div;let e,s;if(this.width&&(e=this.x,s=this.y),super.render(),this.div.hidden=!0,this.div.setAttribute("role","figure"),this.addAltTextButton(),a(this,wt)?A(this,st,md).call(this):A(this,st,ac).call(this),this.width&&!this.annotationElementId){const[i,n]=this.parentDimensions;this.setAt(e*i,s*n,this.width*i,this.height*n)}return this.div}copyCanvas(e,s,i=!1){var p;e||(e=224);const{width:n,height:r}=a(this,wt),o=new dh;let c=a(this,wt),h=n,d=r,u=null;if(s){if(n>s||r>s){const R=Math.min(s/n,s/r);h=Math.floor(n*R),d=Math.floor(r*R)}u=document.createElement("canvas");const b=u.width=Math.ceil(h*o.sx),g=u.height=Math.ceil(d*o.sy);a(this,Fe)||(c=A(this,st,oc).call(this,b,g));const _=u.getContext("2d");_.filter=this._uiManager.hcmFilter;let y="white",w="#cfcfd8";this._uiManager.hcmFilter!=="none"?w="black":(p=window.matchMedia)!=null&&p.call(window,"(prefers-color-scheme: dark)").matches&&(y="#8f8f9d",w="#42414d");const E=15,x=E*o.sx,S=E*o.sy,C=new OffscreenCanvas(x*2,S*2),T=C.getContext("2d");T.fillStyle=y,T.fillRect(0,0,x*2,S*2),T.fillStyle=w,T.fillRect(0,0,x,S),T.fillRect(x,S,x,S),_.fillStyle=_.createPattern(C,"repeat"),_.fillRect(0,0,b,g),_.drawImage(c,0,0,c.width,c.height,0,0,b,g)}let f=null;if(i){let b,g;if(o.symmetric&&c.width<e&&c.height<e)b=c.width,g=c.height;else if(c=a(this,wt),n>e||r>e){const w=Math.min(e/n,e/r);b=Math.floor(n*w),g=Math.floor(r*w),a(this,Fe)||(c=A(this,st,oc).call(this,b,g))}const y=new OffscreenCanvas(b,g).getContext("2d",{willReadFrequently:!0});y.drawImage(c,0,0,c.width,c.height,0,0,b,g),f={width:b,height:g,data:y.getImageData(0,0,b,g).data}}return{canvas:u,width:h,height:d,imageData:f}}getImageForAltText(){return a(this,Ts)}static async deserialize(e,s,i){var g;let n=null;if(e instanceof up){const{data:{rect:_,rotation:y,id:w,structParent:E,popupRef:x},container:S,parent:{page:{pageNumber:C}}}=e,T=S.querySelector("canvas"),R=i.imageManager.getFromCanvas(S.id,T);T.remove();const I=((g=await s._structTree.getAriaAttributes(`${Dd}${w}`))==null?void 0:g.get("aria-label"))||"";n=e={annotationType:Q.STAMP,bitmapId:R.id,bitmap:R.bitmap,pageIndex:C-1,rect:_.slice(0),rotation:y,id:w,deleted:!1,accessibilityData:{decorative:!1,altText:I},isSvg:!1,structParent:E,popupRef:x}}const r=await super.deserialize(e,s,i),{rect:o,bitmap:c,bitmapUrl:h,bitmapId:d,isSvg:u,accessibilityData:f}=e;d&&i.imageManager.isValidId(d)?(m(r,te,d),c&&m(r,wt,c)):m(r,si,h),m(r,Fe,u);const[p,b]=r.pageDimensions;return r.width=(o[2]-o[0])/p,r.height=(o[3]-o[1])/b,r.annotationElementId=e.id||null,f&&(r.altTextData=f),r._initialData=n,m(r,Ea,!!n),r}serialize(e=!1,s=null){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();const i={annotationType:Q.STAMP,bitmapId:a(this,te),pageIndex:this.pageIndex,rect:this.getRect(0,0),rotation:this.rotation,isSvg:a(this,Fe),structTreeParentId:this._structTreeParentId};if(e)return i.bitmapUrl=A(this,st,lc).call(this,!0),i.accessibilityData=this.serializeAltText(!0),i;const{decorative:n,altText:r}=this.serializeAltText(!1);if(!n&&r&&(i.accessibilityData={type:"Figure",alt:r}),this.annotationElementId){const c=A(this,st,sg).call(this,i);if(c.isSame)return null;c.isSameAltText?delete i.accessibilityData:i.accessibilityData.structParent=this._initialData.structParent??-1}if(i.id=this.annotationElementId,s===null)return i;s.stamps||(s.stamps=new Map);const o=a(this,Fe)?(i.rect[2]-i.rect[0])*(i.rect[3]-i.rect[1]):null;if(!s.stamps.has(a(this,te)))s.stamps.set(a(this,te),{area:o,serialized:i}),i.bitmap=A(this,st,lc).call(this,!1);else if(a(this,Fe)){const c=s.stamps.get(a(this,te));o>c.area&&(c.area=o,c.serialized.bitmap.close(),c.serialized.bitmap=A(this,st,lc).call(this,!1))}return i}renderAnnotationElement(e){return e.updateEdited({rect:this.getRect(0,0)}),null}};wt=new WeakMap,te=new WeakMap,Bi=new WeakMap,si=new WeakMap,ji=new WeakMap,wa=new WeakMap,Ts=new WeakMap,ii=new WeakMap,Rs=new WeakMap,Fe=new WeakMap,Ea=new WeakMap,st=new WeakSet,Ya=function(e,s=!1){if(!e){this.remove();return}m(this,wt,e.bitmap),s||(m(this,te,e.id),m(this,Fe,e.isSvg)),e.file&&m(this,wa,e.file.name),A(this,st,md).call(this)},Ka=function(){if(m(this,Bi,null),this._uiManager.enableWaiting(!1),!!a(this,Ts)){if(this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&a(this,wt)){this._editToolbar.hide(),this._uiManager.editAltText(this,!0);return}if(!this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&a(this,wt)){this._reportTelemetry({action:"pdfjs.image.image_added",data:{alt_text_modal:!1,alt_text_type:"empty"}});try{this.mlGuessAltText()}catch{}}this.div.focus()}},ac=function(){if(a(this,te)){this._uiManager.enableWaiting(!0),this._uiManager.imageManager.getFromId(a(this,te)).then(i=>A(this,st,Ya).call(this,i,!0)).finally(()=>A(this,st,Ka).call(this));return}if(a(this,si)){const i=a(this,si);m(this,si,null),this._uiManager.enableWaiting(!0),m(this,Bi,this._uiManager.imageManager.getFromUrl(i).then(n=>A(this,st,Ya).call(this,n)).finally(()=>A(this,st,Ka).call(this)));return}if(a(this,ji)){const i=a(this,ji);m(this,ji,null),this._uiManager.enableWaiting(!0),m(this,Bi,this._uiManager.imageManager.getFromFile(i).then(n=>A(this,st,Ya).call(this,n)).finally(()=>A(this,st,Ka).call(this)));return}const e=document.createElement("input");e.type="file",e.accept=Ja.supportedTypesStr;const s=this._uiManager._signal;m(this,Bi,new Promise(i=>{e.addEventListener("change",async()=>{if(!e.files||e.files.length===0)this.remove();else{this._uiManager.enableWaiting(!0);const n=await this._uiManager.imageManager.getFromFile(e.files[0]);this._reportTelemetry({action:"pdfjs.image.image_selected",data:{alt_text_modal:this._uiManager.useNewAltTextFlow}}),A(this,st,Ya).call(this,n)}i()},{signal:s}),e.addEventListener("cancel",()=>{this.remove(),i()},{signal:s})}).finally(()=>A(this,st,Ka).call(this))),e.click()},md=function(){const{div:e}=this;let{width:s,height:i}=a(this,wt);const[n,r]=this.pageDimensions,o=.75;if(this.width)s=this.width*n,i=this.height*r;else if(s>o*n||i>o*r){const u=Math.min(o*n/s,o*r/i);s*=u,i*=u}const[c,h]=this.parentDimensions;this.setDims(s*c/n,i*h/r),this._uiManager.enableWaiting(!1);const d=m(this,Ts,document.createElement("canvas"));d.setAttribute("role","img"),this.addContainer(d),(!this._uiManager.useNewAltTextWhenAddingImage||!this._uiManager.useNewAltTextFlow||this.annotationElementId)&&(e.hidden=!1),A(this,st,bd).call(this,s,i),A(this,st,eg).call(this),a(this,Ea)||(this.parent.addUndoableEditor(this),m(this,Ea,!0)),this._reportTelemetry({action:"inserted_image"}),a(this,wa)&&d.setAttribute("aria-label",a(this,wa))},tg=function(e,s){var o;const[i,n]=this.parentDimensions;this.width=e/i,this.height=s/n,(o=this._initialOptions)!=null&&o.isCentered?this.center():this.fixAndSetPosition(),this._initialOptions=null,a(this,Rs)!==null&&clearTimeout(a(this,Rs)),m(this,Rs,setTimeout(()=>{m(this,Rs,null),A(this,st,bd).call(this,e,s)},200))},oc=function(e,s){const{width:i,height:n}=a(this,wt);let r=i,o=n,c=a(this,wt);for(;r>2*e||o>2*s;){const h=r,d=o;r>2*e&&(r=r>=16384?Math.floor(r/2)-1:Math.ceil(r/2)),o>2*s&&(o=o>=16384?Math.floor(o/2)-1:Math.ceil(o/2));const u=new OffscreenCanvas(r,o);u.getContext("2d").drawImage(c,0,0,h,d,0,0,r,o),c=u.transferToImageBitmap()}return c},bd=function(e,s){const i=new dh,n=Math.ceil(e*i.sx),r=Math.ceil(s*i.sy),o=a(this,Ts);if(!o||o.width===n&&o.height===r)return;o.width=n,o.height=r;const c=a(this,Fe)?a(this,wt):A(this,st,oc).call(this,n,r),h=o.getContext("2d");h.filter=this._uiManager.hcmFilter,h.drawImage(c,0,0,c.width,c.height,0,0,n,r)},lc=function(e){if(e){if(a(this,Fe)){const n=this._uiManager.imageManager.getSvgUrl(a(this,te));if(n)return n}const s=document.createElement("canvas");return{width:s.width,height:s.height}=a(this,wt),s.getContext("2d").drawImage(a(this,wt),0,0),s.toDataURL()}if(a(this,Fe)){const[s,i]=this.pageDimensions,n=Math.round(this.width*s*Gi.PDF_TO_CSS_UNITS),r=Math.round(this.height*i*Gi.PDF_TO_CSS_UNITS),o=new OffscreenCanvas(n,r);return o.getContext("2d").drawImage(a(this,wt),0,0,a(this,wt).width,a(this,wt).height,0,0,n,r),o.transferToImageBitmap()}return structuredClone(a(this,wt))},eg=function(){this._uiManager._signal&&(m(this,ii,new ResizeObserver(e=>{const s=e[0].contentRect;s.width&&s.height&&A(this,st,tg).call(this,s.width,s.height)})),a(this,ii).observe(this.div),this._uiManager._signal.addEventListener("abort",()=>{var e;(e=a(this,ii))==null||e.disconnect(),m(this,ii,null)},{once:!0}))},sg=function(e){var h;const{rect:s,pageIndex:i,accessibilityData:{altText:n}}=this._initialData,r=e.rect.every((d,u)=>Math.abs(d-s[u])<1),o=e.pageIndex===i,c=(((h=e.accessibilityData)==null?void 0:h.alt)||"")===n;return{isSame:r&&o&&c,isSameAltText:c}},X(Ja,"_type","stamp"),X(Ja,"_editorType",Q.STAMP);let gd=Ja;var tr,Sa,Ps,zi,ni,De,$i,xa,Ca,ce,ri,W,Wi,ee,ig,vd,yd,_d,cc;const Ke=class Ke{constructor({uiManager:t,pageIndex:e,div:s,structTreeLayer:i,accessibilityManager:n,annotationLayer:r,drawLayer:o,textLayer:c,viewport:h,l10n:d}){v(this,ee);v(this,tr);v(this,Sa,!1);v(this,Ps,null);v(this,zi,null);v(this,ni,null);v(this,De,new Map);v(this,$i,!1);v(this,xa,!1);v(this,Ca,!1);v(this,ce,null);v(this,ri,null);v(this,W);const u=[...a(Ke,Wi).values()];if(!Ke._initialized){Ke._initialized=!0;for(const f of u)f.initialize(d,t)}t.registerEditorTypes(u),m(this,W,t),this.pageIndex=e,this.div=s,m(this,tr,n),m(this,Ps,r),this.viewport=h,m(this,ce,c),this.drawLayer=o,this._structTree=i,a(this,W).addLayer(this)}get isEmpty(){return a(this,De).size===0}get isInvisible(){return this.isEmpty&&a(this,W).getMode()===Q.NONE}updateToolbar(t){a(this,W).updateToolbar(t)}updateMode(t=a(this,W).getMode()){switch(A(this,ee,cc).call(this),t){case Q.NONE:this.disableTextSelection(),this.togglePointerEvents(!1),this.toggleAnnotationLayerPointerEvents(!0),this.disableClick();return;case Q.INK:this.addInkEditorIfNeeded(!1),this.disableTextSelection(),this.togglePointerEvents(!0),this.disableClick();break;case Q.HIGHLIGHT:this.enableTextSelection(),this.togglePointerEvents(!1),this.disableClick();break;default:this.disableTextSelection(),this.togglePointerEvents(!0),this.enableClick()}this.toggleAnnotationLayerPointerEvents(!1);const{classList:e}=this.div;for(const s of a(Ke,Wi).values())e.toggle(`${s._type}Editing`,t===s._editorType);this.div.hidden=!1}hasTextLayer(t){var e;return t===((e=a(this,ce))==null?void 0:e.div)}addInkEditorIfNeeded(t){if(a(this,W).getMode()!==Q.INK)return;if(!t){for(const s of a(this,De).values())if(s.isEmpty()){s.setInBackground();return}}this.createAndAddNewEditor({offsetX:0,offsetY:0},!1).setInBackground()}setEditingState(t){a(this,W).setEditingState(t)}addCommands(t){a(this,W).addCommands(t)}toggleDrawing(t=!1){this.div.classList.toggle("drawing",!t)}togglePointerEvents(t=!1){this.div.classList.toggle("disabled",!t)}toggleAnnotationLayerPointerEvents(t=!1){var e;(e=a(this,Ps))==null||e.div.classList.toggle("disabled",!t)}async enable(){this.div.tabIndex=0,this.togglePointerEvents(!0);const t=new Set;for(const s of a(this,De).values())s.enableEditing(),s.show(!0),s.annotationElementId&&(a(this,W).removeChangedExistingAnnotation(s),t.add(s.annotationElementId));if(!a(this,Ps))return;const e=a(this,Ps).getEditableAnnotations();for(const s of e){if(s.hide(),a(this,W).isDeletedAnnotationElement(s.data.id)||t.has(s.data.id))continue;const i=await this.deserialize(s);i&&(this.addOrRebuild(i),i.enableEditing())}}disable(){var i;m(this,Ca,!0),this.div.tabIndex=-1,this.togglePointerEvents(!1);const t=new Map,e=new Map;for(const n of a(this,De).values())if(n.disableEditing(),!!n.annotationElementId){if(n.serialize()!==null){t.set(n.annotationElementId,n);continue}else e.set(n.annotationElementId,n);(i=this.getEditableAnnotation(n.annotationElementId))==null||i.show(),n.remove()}if(a(this,Ps)){const n=a(this,Ps).getEditableAnnotations();for(const r of n){const{id:o}=r.data;if(a(this,W).isDeletedAnnotationElement(o))continue;let c=e.get(o);if(c){c.resetAnnotationElement(r),c.show(!1),r.show();continue}c=t.get(o),c&&(a(this,W).addChangedExistingAnnotation(c),c.renderAnnotationElement(r)&&c.show(!1)),r.show()}}A(this,ee,cc).call(this),this.isEmpty&&(this.div.hidden=!0);const{classList:s}=this.div;for(const n of a(Ke,Wi).values())s.remove(`${n._type}Editing`);this.disableTextSelection(),this.toggleAnnotationLayerPointerEvents(!0),m(this,Ca,!1)}getEditableAnnotation(t){var e;return((e=a(this,Ps))==null?void 0:e.getEditableAnnotation(t))||null}setActiveEditor(t){a(this,W).getActive()!==t&&a(this,W).setActiveEditor(t)}enableTextSelection(){var t;if(this.div.tabIndex=-1,(t=a(this,ce))!=null&&t.div&&!a(this,ri)){m(this,ri,new AbortController);const e=a(this,W).combinedSignal(a(this,ri));a(this,ce).div.addEventListener("pointerdown",A(this,ee,ig).bind(this),{signal:e}),a(this,ce).div.classList.add("highlighting")}}disableTextSelection(){var t;this.div.tabIndex=0,(t=a(this,ce))!=null&&t.div&&a(this,ri)&&(a(this,ri).abort(),m(this,ri,null),a(this,ce).div.classList.remove("highlighting"))}enableClick(){if(a(this,zi))return;m(this,zi,new AbortController);const t=a(this,W).combinedSignal(a(this,zi));this.div.addEventListener("pointerdown",this.pointerdown.bind(this),{signal:t}),this.div.addEventListener("pointerup",this.pointerup.bind(this),{signal:t})}disableClick(){var t;(t=a(this,zi))==null||t.abort(),m(this,zi,null)}attach(t){a(this,De).set(t.id,t);const{annotationElementId:e}=t;e&&a(this,W).isDeletedAnnotationElement(e)&&a(this,W).removeDeletedAnnotationElement(t)}detach(t){var e;a(this,De).delete(t.id),(e=a(this,tr))==null||e.removePointerInTextLayer(t.contentDiv),!a(this,Ca)&&t.annotationElementId&&a(this,W).addDeletedAnnotationElement(t)}remove(t){this.detach(t),a(this,W).removeEditor(t),t.div.remove(),t.isAttachedToDOM=!1,a(this,xa)||this.addInkEditorIfNeeded(!1)}changeParent(t){var e;t.parent!==this&&(t.parent&&t.annotationElementId&&(a(this,W).addDeletedAnnotationElement(t.annotationElementId),ht.deleteAnnotationElement(t),t.annotationElementId=null),this.attach(t),(e=t.parent)==null||e.detach(t),t.setParent(this),t.div&&t.isAttachedToDOM&&(t.div.remove(),this.div.append(t.div)))}add(t){if(!(t.parent===this&&t.isAttachedToDOM)){if(this.changeParent(t),a(this,W).addEditor(t),this.attach(t),!t.isAttachedToDOM){const e=t.render();this.div.append(e),t.isAttachedToDOM=!0}t.fixAndSetPosition(),t.onceAdded(),a(this,W).addToAnnotationStorage(t),t._reportTelemetry(t.telemetryInitialData)}}moveEditorInDOM(t){var s;if(!t.isAttachedToDOM)return;const{activeElement:e}=document;t.div.contains(e)&&!a(this,ni)&&(t._focusEventsAllowed=!1,m(this,ni,setTimeout(()=>{m(this,ni,null),t.div.contains(document.activeElement)?t._focusEventsAllowed=!0:(t.div.addEventListener("focusin",()=>{t._focusEventsAllowed=!0},{once:!0,signal:a(this,W)._signal}),e.focus())},0))),t._structTreeParentId=(s=a(this,tr))==null?void 0:s.moveElementInDOM(this.div,t.div,t.contentDiv,!0)}addOrRebuild(t){t.needsToBeRebuilt()?(t.parent||(t.parent=this),t.rebuild(),t.show()):this.add(t)}addUndoableEditor(t){const e=()=>t._uiManager.rebuild(t),s=()=>{t.remove()};this.addCommands({cmd:e,undo:s,mustExec:!1})}getNextId(){return a(this,W).getId()}combinedSignal(t){return a(this,W).combinedSignal(t)}canCreateNewEmptyEditor(){var t;return(t=a(this,ee,vd))==null?void 0:t.canCreateNewEmptyEditor()}pasteEditor(t,e){a(this,W).updateToolbar(t),a(this,W).updateMode(t);const{offsetX:s,offsetY:i}=A(this,ee,_d).call(this),n=this.getNextId(),r=A(this,ee,yd).call(this,{parent:this,id:n,x:s,y:i,uiManager:a(this,W),isCentered:!0,...e});r&&this.add(r)}async deserialize(t){var e;return await((e=a(Ke,Wi).get(t.annotationType??t.annotationEditorType))==null?void 0:e.deserialize(t,this,a(this,W)))||null}createAndAddNewEditor(t,e,s={}){const i=this.getNextId(),n=A(this,ee,yd).call(this,{parent:this,id:i,x:t.offsetX,y:t.offsetY,uiManager:a(this,W),isCentered:e,...s});return n&&this.add(n),n}addNewEditor(){this.createAndAddNewEditor(A(this,ee,_d).call(this),!0)}setSelected(t){a(this,W).setSelected(t)}toggleSelected(t){a(this,W).toggleSelected(t)}unselect(t){a(this,W).unselect(t)}pointerup(t){const{isMac:e}=me.platform;if(!(t.button!==0||t.ctrlKey&&e)&&t.target===this.div&&a(this,$i)){if(m(this,$i,!1),!a(this,Sa)){m(this,Sa,!0);return}if(a(this,W).getMode()===Q.STAMP){a(this,W).unselectAll();return}this.createAndAddNewEditor(t,!1)}}pointerdown(t){if(a(this,W).getMode()===Q.HIGHLIGHT&&this.enableTextSelection(),a(this,$i)){m(this,$i,!1);return}const{isMac:e}=me.platform;if(t.button!==0||t.ctrlKey&&e||t.target!==this.div)return;m(this,$i,!0);const s=a(this,W).getActive();m(this,Sa,!s||s.isEmpty())}findNewParent(t,e,s){const i=a(this,W).findParent(e,s);return i===null||i===this?!1:(i.changeParent(t),!0)}destroy(){var t,e;((t=a(this,W).getActive())==null?void 0:t.parent)===this&&(a(this,W).commitOrRemove(),a(this,W).setActiveEditor(null)),a(this,ni)&&(clearTimeout(a(this,ni)),m(this,ni,null));for(const s of a(this,De).values())(e=a(this,tr))==null||e.removePointerInTextLayer(s.contentDiv),s.setParent(null),s.isAttachedToDOM=!1,s.div.remove();this.div=null,a(this,De).clear(),a(this,W).removeLayer(this)}render({viewport:t}){this.viewport=t,sr(this.div,t);for(const e of a(this,W).getEditors(this.pageIndex))this.add(e),e.rebuild();this.updateMode()}update({viewport:t}){a(this,W).commitOrRemove(),A(this,ee,cc).call(this);const e=this.viewport.rotation,s=t.rotation;if(this.viewport=t,sr(this.div,{rotation:s}),e!==s)for(const i of a(this,De).values())i.rotate(s);this.addInkEditorIfNeeded(!1)}get pageDimensions(){const{pageWidth:t,pageHeight:e}=this.viewport.rawDims;return[t,e]}get scale(){return a(this,W).viewParameters.realScale}};tr=new WeakMap,Sa=new WeakMap,Ps=new WeakMap,zi=new WeakMap,ni=new WeakMap,De=new WeakMap,$i=new WeakMap,xa=new WeakMap,Ca=new WeakMap,ce=new WeakMap,ri=new WeakMap,W=new WeakMap,Wi=new WeakMap,ee=new WeakSet,ig=function(t){a(this,W).unselectAll();const{target:e}=t;if(e===a(this,ce).div||(e.getAttribute("role")==="img"||e.classList.contains("endOfContent"))&&a(this,ce).div.contains(e)){const{isMac:s}=me.platform;if(t.button!==0||t.ctrlKey&&s)return;a(this,W).showAllEditors("highlight",!0,!0),a(this,ce).div.classList.add("free"),this.toggleDrawing(),pc.startHighlighting(this,a(this,W).direction==="ltr",{target:a(this,ce).div,x:t.x,y:t.y}),a(this,ce).div.addEventListener("pointerup",()=>{a(this,ce).div.classList.remove("free"),this.toggleDrawing(!0)},{once:!0,signal:a(this,W)._signal}),t.preventDefault()}},vd=function(){return a(Ke,Wi).get(a(this,W).getMode())},yd=function(t){const e=a(this,ee,vd);return e?new e.prototype.constructor(t):null},_d=function(){const{x:t,y:e,width:s,height:i}=this.div.getBoundingClientRect(),n=Math.max(0,t),r=Math.max(0,e),o=Math.min(window.innerWidth,t+s),c=Math.min(window.innerHeight,e+i),h=(n+o)/2-t,d=(r+c)/2-e,[u,f]=this.viewport.rotation%180===0?[h,d]:[d,h];return{offsetX:u,offsetY:f}},cc=function(){m(this,xa,!0);for(const t of a(this,De).values())t.isEmpty()&&t.remove();m(this,xa,!1)},X(Ke,"_initialized",!1),v(Ke,Wi,new Map([Zh,ad,gd,pc].map(t=>[t._editorType,t])));let Ad=Ke;var Is,gl,Ft,ai,ml,Ed,or,Sd,ng;const Zt=class Zt{constructor({pageIndex:t}){v(this,or);v(this,Is,null);v(this,gl,0);v(this,Ft,new Map);v(this,ai,new Map);this.pageIndex=t}setParent(t){if(!a(this,Is)){m(this,Is,t);return}if(a(this,Is)!==t){if(a(this,Ft).size>0)for(const e of a(this,Ft).values())e.remove(),t.append(e);m(this,Is,t)}}static get _svgFactory(){return it(this,"_svgFactory",new Ud)}draw(t,e,s,i=!1){const n=ue(this,gl)._++,r=A(this,or,Sd).call(this,t.box);r.classList.add(...t.classNamesForDrawing);const o=Zt._svgFactory.createElement("defs");r.append(o);const c=Zt._svgFactory.createElement("path");o.append(c);const h=`path_p${this.pageIndex}_${n}`;c.setAttribute("id",h),c.setAttribute("d",t.toSVGPath()),i&&a(this,ai).set(n,c);const d=A(this,or,ng).call(this,o,h),u=Zt._svgFactory.createElement("use");return r.append(u),r.setAttribute("fill",e),r.setAttribute("fill-opacity",s),u.setAttribute("href",`#${h}`),a(this,Ft).set(n,r),{id:n,clipPathId:`url(#${d})`}}drawOutline(t){const e=ue(this,gl)._++,s=A(this,or,Sd).call(this,t.box);s.classList.add(...t.classNamesForOutlining);const i=Zt._svgFactory.createElement("defs");s.append(i);const n=Zt._svgFactory.createElement("path");i.append(n);const r=`path_p${this.pageIndex}_${e}`;n.setAttribute("id",r),n.setAttribute("d",t.toSVGPath()),n.setAttribute("vector-effect","non-scaling-stroke");let o;if(t.mustRemoveSelfIntersections){const d=Zt._svgFactory.createElement("mask");i.append(d),o=`mask_p${this.pageIndex}_${e}`,d.setAttribute("id",o),d.setAttribute("maskUnits","objectBoundingBox");const u=Zt._svgFactory.createElement("rect");d.append(u),u.setAttribute("width","1"),u.setAttribute("height","1"),u.setAttribute("fill","white");const f=Zt._svgFactory.createElement("use");d.append(f),f.setAttribute("href",`#${r}`),f.setAttribute("stroke","none"),f.setAttribute("fill","black"),f.setAttribute("fill-rule","nonzero"),f.classList.add("mask")}const c=Zt._svgFactory.createElement("use");s.append(c),c.setAttribute("href",`#${r}`),o&&c.setAttribute("mask",`url(#${o})`);const h=c.cloneNode();return s.append(h),c.classList.add("mainOutline"),h.classList.add("secondaryOutline"),a(this,Ft).set(e,s),e}finalizeLine(t,e){const s=a(this,ai).get(t);a(this,ai).delete(t),this.updateBox(t,e.box),s.setAttribute("d",e.toSVGPath())}updateLine(t,e){a(this,Ft).get(t).firstChild.firstChild.setAttribute("d",e.toSVGPath())}updatePath(t,e){a(this,ai).get(t).setAttribute("d",e.toSVGPath())}updateBox(t,e){var s;A(s=Zt,ml,Ed).call(s,a(this,Ft).get(t),e)}show(t,e){a(this,Ft).get(t).classList.toggle("hidden",!e)}rotate(t,e){a(this,Ft).get(t).setAttribute("data-main-rotation",e)}changeColor(t,e){a(this,Ft).get(t).setAttribute("fill",e)}changeOpacity(t,e){a(this,Ft).get(t).setAttribute("fill-opacity",e)}addClass(t,e){a(this,Ft).get(t).classList.add(e)}removeClass(t,e){a(this,Ft).get(t).classList.remove(e)}getSVGRoot(t){return a(this,Ft).get(t)}remove(t){a(this,ai).delete(t),a(this,Is)!==null&&(a(this,Ft).get(t).remove(),a(this,Ft).delete(t))}destroy(){m(this,Is,null);for(const t of a(this,Ft).values())t.remove();a(this,Ft).clear(),a(this,ai).clear()}};Is=new WeakMap,gl=new WeakMap,Ft=new WeakMap,ai=new WeakMap,ml=new WeakSet,Ed=function(t,{x:e=0,y:s=0,width:i=1,height:n=1}={}){const{style:r}=t;r.top=`${100*s}%`,r.left=`${100*e}%`,r.width=`${100*i}%`,r.height=`${100*n}%`},or=new WeakSet,Sd=function(t){var s;const e=Zt._svgFactory.create(1,1,!0);return a(this,Is).append(e),e.setAttribute("aria-hidden",!0),A(s=Zt,ml,Ed).call(s,e,t),e},ng=function(t,e){const s=Zt._svgFactory.createElement("clipPath");t.append(s);const i=`clip_${e}`;s.setAttribute("id",i),s.setAttribute("clipPathUnits","objectBoundingBox");const n=Zt._svgFactory.createElement("use");return s.append(n),n.setAttribute("href",`#${e}`),n.classList.add("clip"),i},v(Zt,ml);let wd=Zt;var iA=K.AbortException,nA=K.AnnotationEditorLayer,rA=K.AnnotationEditorParamsType,aA=K.AnnotationEditorType,oA=K.AnnotationEditorUIManager,rg=K.AnnotationLayer,ag=K.AnnotationMode,lA=K.ColorPicker,cA=K.DOMSVGFactory,hA=K.DrawLayer,dA=K.FeatureTest,Xd=K.GlobalWorkerOptions,uA=K.ImageKind,fA=K.InvalidPDFException,pA=K.MissingPDFException,gA=K.OPS,mA=K.OutputScale,bA=K.PDFDataRangeTransport,AA=K.PDFDateString,vA=K.PDFWorker,yA=K.PasswordResponses,_A=K.PermissionFlag,wA=K.PixelsPerInch,EA=K.RenderingCancelledException,og=K.TextLayer,SA=K.UnexpectedResponseException,xA=K.Util,CA=K.VerbosityLevel,TA=K.XfaLayer,RA=K.build,PA=K.createValidAbsoluteUrl,IA=K.fetchData,lg=K.getDocument,MA=K.getFilenameFromUrl,kA=K.getPdfFilenameFromUrl,LA=K.getXfaPageViewport,FA=K.isDataScheme,DA=K.isPdfFile,OA=K.noContextMenu,NA=K.normalizeUnicode,HA=K.setLayerDimensions,BA=K.shadow,cg=K.version;const jA=Object.freeze(Object.defineProperty({__proto__:null,AbortException:iA,AnnotationEditorLayer:nA,AnnotationEditorParamsType:rA,AnnotationEditorType:aA,AnnotationEditorUIManager:oA,AnnotationLayer:rg,AnnotationMode:ag,ColorPicker:lA,DOMSVGFactory:cA,DrawLayer:hA,FeatureTest:dA,GlobalWorkerOptions:Xd,ImageKind:uA,InvalidPDFException:fA,MissingPDFException:pA,OPS:gA,OutputScale:mA,PDFDataRangeTransport:bA,PDFDateString:AA,PDFWorker:vA,PasswordResponses:yA,PermissionFlag:_A,PixelsPerInch:wA,RenderingCancelledException:EA,TextLayer:og,UnexpectedResponseException:SA,Util:xA,VerbosityLevel:CA,XfaLayer:TA,build:RA,createValidAbsoluteUrl:PA,fetchData:IA,getDocument:lg,getFilenameFromUrl:MA,getPdfFilenameFromUrl:kA,getXfaPageViewport:LA,isDataScheme:FA,isPdfFile:DA,noContextMenu:OA,normalizeUnicode:NA,setLayerDimensions:HA,shadow:BA,version:cg},Symbol.toStringTag,{value:"Module"}));var Gt=function(l,t,e){if(e||arguments.length===2)for(var s=0,i=t.length,n;s<i;s++)(n||!(s in t))&&(n||(n=Array.prototype.slice.call(t,0,s)),n[s]=t[s]);return l.concat(n||Array.prototype.slice.call(t))},zA=["onCopy","onCut","onPaste"],$A=["onCompositionEnd","onCompositionStart","onCompositionUpdate"],WA=["onFocus","onBlur"],GA=["onInput","onInvalid","onReset","onSubmit"],UA=["onLoad","onError"],VA=["onKeyDown","onKeyPress","onKeyUp"],XA=["onAbort","onCanPlay","onCanPlayThrough","onDurationChange","onEmptied","onEncrypted","onEnded","onError","onLoadedData","onLoadedMetadata","onLoadStart","onPause","onPlay","onPlaying","onProgress","onRateChange","onSeeked","onSeeking","onStalled","onSuspend","onTimeUpdate","onVolumeChange","onWaiting"],qA=["onClick","onContextMenu","onDoubleClick","onMouseDown","onMouseEnter","onMouseLeave","onMouseMove","onMouseOut","onMouseOver","onMouseUp"],YA=["onDrag","onDragEnd","onDragEnter","onDragExit","onDragLeave","onDragOver","onDragStart","onDrop"],KA=["onSelect"],ZA=["onTouchCancel","onTouchEnd","onTouchMove","onTouchStart"],QA=["onPointerDown","onPointerMove","onPointerUp","onPointerCancel","onGotPointerCapture","onLostPointerCapture","onPointerEnter","onPointerLeave","onPointerOver","onPointerOut"],JA=["onScroll"],tv=["onWheel"],ev=["onAnimationStart","onAnimationEnd","onAnimationIteration"],sv=["onTransitionEnd"],iv=["onToggle"],nv=["onChange"],rv=Gt(Gt(Gt(Gt(Gt(Gt(Gt(Gt(Gt(Gt(Gt(Gt(Gt(Gt(Gt(Gt(Gt(Gt([],zA,!0),$A,!0),WA,!0),GA,!0),UA,!0),VA,!0),XA,!0),qA,!0),YA,!0),KA,!0),ZA,!0),QA,!0),JA,!0),tv,!0),ev,!0),sv,!0),nv,!0),iv,!0);function hg(l,t){var e={};return rv.forEach(function(s){var i=l[s];i&&(t?e[s]=(function(n){return i(n,t(s))}):e[s]=i)}),e}function _l(l){var t=!1,e=new Promise(function(s,i){l.then(function(n){return!t&&s(n)}).catch(function(n){return!t&&i(n)})});return{promise:e,cancel:function(){t=!0}}}var av="Invariant failed";function pt(l,t){if(!l)throw new Error(av)}var Jc,xu;function ov(){if(xu)return Jc;xu=1;var l=function(){};return Jc=l,Jc}var lv=ov();const he=Ku(lv),dg=P.createContext(null);function Rr({children:l,type:t}){return B.jsx("div",{className:`react-pdf__message react-pdf__message--${t}`,children:l})}const cv="noopener noreferrer nofollow";class hv{constructor(){this.externalLinkEnabled=!0,this.externalLinkRel=void 0,this.externalLinkTarget=void 0,this.isInPresentationMode=!1,this.pdfDocument=void 0,this.pdfViewer=void 0}setDocument(t){this.pdfDocument=t}setViewer(t){this.pdfViewer=t}setExternalLinkRel(t){this.externalLinkRel=t}setExternalLinkTarget(t){this.externalLinkTarget=t}setHistory(){}get pagesCount(){return this.pdfDocument?this.pdfDocument.numPages:0}get page(){return pt(this.pdfViewer),this.pdfViewer.currentPageNumber||0}set page(t){pt(this.pdfViewer),this.pdfViewer.currentPageNumber=t}get rotation(){return 0}set rotation(t){}goToDestination(t){return new Promise(e=>{pt(this.pdfDocument),pt(t),typeof t=="string"?this.pdfDocument.getDestination(t).then(e):Array.isArray(t)?e(t):t.then(e)}).then(e=>{pt(Array.isArray(e));const s=e[0];new Promise(i=>{pt(this.pdfDocument),s instanceof Object?this.pdfDocument.getPageIndex(s).then(n=>{i(n)}).catch(()=>{pt(!1)}):typeof s=="number"?i(s):pt(!1)}).then(i=>{const n=i+1;pt(this.pdfViewer),pt(n>=1&&n<=this.pagesCount),this.pdfViewer.scrollPageIntoView({dest:e,pageIndex:i,pageNumber:n})})})}navigateTo(t){this.goToDestination(t)}goToPage(t){const e=t-1;pt(this.pdfViewer),pt(t>=1&&t<=this.pagesCount),this.pdfViewer.scrollPageIntoView({pageIndex:e,pageNumber:t})}addLinkAttributes(t,e,s){t.href=e,t.rel=this.externalLinkRel||cv,t.target=s?"_blank":this.externalLinkTarget||""}getDestinationHash(){return"#"}getAnchorUrl(){return"#"}setHash(){}executeNamedAction(){}cachePageRef(){}isPageVisible(){return!0}isPageCached(){return!0}executeSetOCGState(){}}const Cu={NEED_PASSWORD:1,INCORRECT_PASSWORD:2},zc=typeof window<"u",ug=zc&&window.location.protocol==="file:";function dv(l){return typeof l<"u"}function Ki(l){return dv(l)&&l!==null}function uv(l){return typeof l=="string"}function fv(l){return l instanceof ArrayBuffer}function pv(l){return pt(zc),l instanceof Blob}function xd(l){return uv(l)&&/^data:/.test(l)}function Tu(l){pt(xd(l));const[t="",e=""]=l.split(",");return t.split(";").indexOf("base64")!==-1?atob(e):unescape(e)}function gv(){return zc&&window.devicePixelRatio||1}const fg="On Chromium based browsers, you can use --allow-file-access-from-files flag for debugging purposes.";function Ru(){he(!ug,`Loading PDF as base64 strings/URLs may not work on protocols other than HTTP/HTTPS. ${fg}`)}function mv(){he(!ug,`Loading PDF.js worker may not work on protocols other than HTTP/HTTPS. ${fg}`)}function rr(l){l!=null&&l.cancel&&l.cancel()}function Cd(l,t){return Object.defineProperty(l,"width",{get(){return this.view[2]*t},configurable:!0}),Object.defineProperty(l,"height",{get(){return this.view[3]*t},configurable:!0}),Object.defineProperty(l,"originalWidth",{get(){return this.view[2]},configurable:!0}),Object.defineProperty(l,"originalHeight",{get(){return this.view[3]},configurable:!0}),l}function bv(l){return l.name==="RenderingCancelledException"}function Av(l){return new Promise((t,e)=>{const s=new FileReader;s.onload=()=>{if(!s.result)return e(new Error("Error while reading a file."));t(s.result)},s.onerror=i=>{if(!i.target)return e(new Error("Error while reading a file."));const{error:n}=i.target;if(!n)return e(new Error("Error while reading a file."));switch(n.code){case n.NOT_FOUND_ERR:return e(new Error("Error while reading a file: File not found."));case n.SECURITY_ERR:return e(new Error("Error while reading a file: Security error."));case n.ABORT_ERR:return e(new Error("Error while reading a file: Aborted."));default:return e(new Error("Error while reading a file."))}},s.readAsArrayBuffer(l)})}function vv(l,t){switch(t.type){case"RESOLVE":return{value:t.value,error:void 0};case"REJECT":return{value:!1,error:t.error};case"RESET":return{value:void 0,error:void 0};default:return l}}function Ta(){return P.useReducer(vv,{value:void 0,error:void 0})}var yv=function(l,t,e,s){function i(n){return n instanceof e?n:new e(function(r){r(n)})}return new(e||(e=Promise))(function(n,r){function o(d){try{h(s.next(d))}catch(u){r(u)}}function c(d){try{h(s.throw(d))}catch(u){r(u)}}function h(d){d.done?n(d.value):i(d.value).then(o,c)}h((s=s.apply(l,t||[])).next())})},Pu=function(l,t){var e={};for(var s in l)Object.prototype.hasOwnProperty.call(l,s)&&t.indexOf(s)<0&&(e[s]=l[s]);if(l!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,s=Object.getOwnPropertySymbols(l);i<s.length;i++)t.indexOf(s[i])<0&&Object.prototype.propertyIsEnumerable.call(l,s[i])&&(e[s[i]]=l[s[i]]);return e};const{PDFDataRangeTransport:_v}=jA,wv=(l,t)=>{switch(t){case Cu.NEED_PASSWORD:{const e=prompt("Enter the password to open this PDF file.");l(e);break}case Cu.INCORRECT_PASSWORD:{const e=prompt("Invalid password. Please try again.");l(e);break}}};function Iu(l){return typeof l=="object"&&l!==null&&("data"in l||"range"in l||"url"in l)}const Ev=P.forwardRef(function(t,e){var{children:s,className:i,error:n="Failed to load PDF file.",externalLinkRel:r,externalLinkTarget:o,file:c,inputRef:h,imageResourcesPath:d,loading:u="Loading PDF…",noData:f="No PDF file specified.",onItemClick:p,onLoadError:b,onLoadProgress:g,onLoadSuccess:_,onPassword:y=wv,onSourceError:w,onSourceSuccess:E,options:x,renderMode:S,rotate:C}=t,T=Pu(t,["children","className","error","externalLinkRel","externalLinkTarget","file","inputRef","imageResourcesPath","loading","noData","onItemClick","onLoadError","onLoadProgress","onLoadSuccess","onPassword","onSourceError","onSourceSuccess","options","renderMode","rotate"]);const[R,I]=Ta(),{value:D,error:M}=R,[L,j]=Ta(),{value:O,error:U}=L,G=P.useRef(new hv),N=P.useRef([]),z=P.useRef(void 0),It=P.useRef(void 0);c&&c!==z.current&&Iu(c)&&(he(!xr(c,z.current),`File prop passed to <Document /> changed, but it's equal to previous one. This might result in unnecessary reloads. Consider memoizing the value passed to "file" prop.`),z.current=c),x&&x!==It.current&&(he(!xr(x,It.current),`Options prop passed to <Document /> changed, but it's equal to previous one. This might result in unnecessary reloads. Consider memoizing the value passed to "options" prop.`),It.current=x);const Mt=P.useRef({scrollPageIntoView:gt=>{const{dest:kt,pageNumber:ie,pageIndex:Wt=ie-1}=gt;if(p){p({dest:kt,pageIndex:Wt,pageNumber:ie});return}const dr=N.current[Wt];if(dr){dr.scrollIntoView();return}he(!1,`An internal link leading to page ${ie} was clicked, but neither <Document> was provided with onItemClick nor it was able to find the page within itself. Either provide onItemClick to <Document> and handle navigating by yourself or ensure that all pages are rendered within <Document>.`)}});P.useImperativeHandle(e,()=>({linkService:G,pages:N,viewer:Mt}),[]);function Tt(){E&&E()}function ot(){M&&(he(!1,M.toString()),w&&w(M))}function nt(){I({type:"RESET"})}P.useEffect(nt,[c,I]);const St=P.useCallback(()=>yv(this,void 0,void 0,function*(){if(!c)return null;if(typeof c=="string")return xd(c)?{data:Tu(c)}:(Ru(),{url:c});if(c instanceof _v)return{range:c};if(fv(c))return{data:c};if(zc&&pv(c))return{data:yield Av(c)};if(pt(typeof c=="object"),pt(Iu(c)),"url"in c&&typeof c.url=="string"){if(xd(c.url)){const{url:gt}=c,kt=Pu(c,["url"]),ie=Tu(gt);return Object.assign({data:ie},kt)}Ru()}return c}),[c]);P.useEffect(()=>{const gt=_l(St());return gt.promise.then(kt=>{I({type:"RESOLVE",value:kt})}).catch(kt=>{I({type:"REJECT",error:kt})}),()=>{rr(gt)}},[St,I]),P.useEffect(()=>{if(!(typeof D>"u")){if(D===!1){ot();return}Tt()}},[D]);function se(){O&&(_&&_(O),N.current=new Array(O.numPages),G.current.setDocument(O))}function bt(){U&&(he(!1,U.toString()),b&&b(U))}P.useEffect(function(){j({type:"RESET"})},[j,D]),P.useEffect(function(){if(!D)return;const kt=x?Object.assign(Object.assign({},D),x):D,ie=lg(kt);g&&(ie.onProgress=g),y&&(ie.onPassword=y);const Wt=ie,dr=Wt.promise.then(Ma=>{j({type:"RESOLVE",value:Ma})}).catch(Ma=>{Wt.destroyed||j({type:"REJECT",error:Ma})});return()=>{dr.finally(()=>Wt.destroy())}},[x,j,D]),P.useEffect(()=>{if(!(typeof O>"u")){if(O===!1){bt();return}se()}},[O]),P.useEffect(function(){G.current.setViewer(Mt.current),G.current.setExternalLinkRel(r),G.current.setExternalLinkTarget(o)},[r,o]);const V=P.useCallback((gt,kt)=>{N.current[gt]=kt},[]),Ot=P.useCallback(gt=>{delete N.current[gt]},[]),Kt=P.useMemo(()=>({imageResourcesPath:d,linkService:G.current,onItemClick:p,pdf:O,registerPage:V,renderMode:S,rotate:C,unregisterPage:Ot}),[d,p,O,V,S,C,Ot]),ft=P.useMemo(()=>hg(T,()=>O),[T,O]);function Pa(){return B.jsx(dg.Provider,{value:Kt,children:s})}function Ia(){return c?O==null?B.jsx(Rr,{type:"loading",children:typeof u=="function"?u():u}):O===!1?B.jsx(Rr,{type:"error",children:typeof n=="function"?n():n}):Pa():B.jsx(Rr,{type:"no-data",children:typeof f=="function"?f():f})}return B.jsx("div",Object.assign({className:bl("react-pdf__Document",i),ref:h,style:{"--scale-factor":"1"}},ft,{children:Ia()}))});function pg(){return P.useContext(dg)}function gg(){for(var l=[],t=0;t<arguments.length;t++)l[t]=arguments[t];var e=l.filter(Boolean);if(e.length<=1){var s=e[0];return s||null}return function(n){e.forEach(function(r){typeof r=="function"?r(n):r&&(r.current=n)})}}const mg=P.createContext(null),bg={Document:null,DocumentFragment:null,Part:"group",Sect:"group",Div:"group",Aside:"note",NonStruct:"none",P:null,H:"heading",Title:null,FENote:"note",Sub:"group",Lbl:null,Span:null,Em:null,Strong:null,Link:"link",Annot:"note",Form:"form",Ruby:null,RB:null,RT:null,RP:null,Warichu:null,WT:null,WP:null,L:"list",LI:"listitem",LBody:null,Table:"table",TR:"row",TH:"columnheader",TD:"cell",THead:"columnheader",TBody:null,TFoot:null,Caption:null,Figure:"figure",Formula:null,Artifact:null},Sv=/^H(\d+)$/;function xv(l){return l in bg}function $c(l){return"children"in l}function Ag(l){return $c(l)?l.children.length===1&&0 in l.children&&"id"in l.children[0]:!1}function Cv(l){const t={};if($c(l)){const{role:e}=l,s=e.match(Sv);if(s)t.role="heading",t["aria-level"]=Number(s[1]);else if(xv(e)){const i=bg[e];i&&(t.role=i)}}return t}function vg(l){const t={};if($c(l)){if(l.alt!==void 0&&(t["aria-label"]=l.alt),l.lang!==void 0&&(t.lang=l.lang),Ag(l)){const[e]=l.children;if(e){const s=vg(e);return Object.assign(Object.assign({},t),s)}}}else"id"in l&&(t["aria-owns"]=l.id);return t}function Tv(l){return l?Object.assign(Object.assign({},Cv(l)),vg(l)):null}function yg({className:l,node:t}){const e=P.useMemo(()=>Tv(t),[t]),s=P.useMemo(()=>!$c(t)||Ag(t)?null:t.children.map((i,n)=>B.jsx(yg,{node:i},n)),[t]);return B.jsx("span",Object.assign({className:l},e,{children:s}))}function Wc(){return P.useContext(mg)}function Rv(){const l=Wc();pt(l);const{onGetStructTreeError:t,onGetStructTreeSuccess:e}=l,[s,i]=Ta(),{value:n,error:r}=s,{customTextRenderer:o,page:c}=l;function h(){n&&e&&e(n)}function d(){r&&(he(!1,r.toString()),t&&t(r))}return P.useEffect(function(){i({type:"RESET"})},[i,c]),P.useEffect(function(){if(o||!c)return;const f=_l(c.getStructTree()),p=f;return f.promise.then(b=>{i({type:"RESOLVE",value:b})}).catch(b=>{i({type:"REJECT",error:b})}),()=>rr(p)},[o,c,i]),P.useEffect(()=>{if(n!==void 0){if(n===!1){d();return}h()}},[n]),n?B.jsx(yg,{className:"react-pdf__Page__structTree structTree",node:n}):null}const Mu=ag;function Pv(l){const t=Wc();pt(t);const e=Object.assign(Object.assign({},t),l),{_className:s,canvasBackground:i,devicePixelRatio:n=gv(),onRenderError:r,onRenderSuccess:o,page:c,renderForms:h,renderTextLayer:d,rotate:u,scale:f}=e,{canvasRef:p}=l;pt(c);const b=P.useRef(null);function g(){c&&o&&o(Cd(c,f))}function _(x){bv(x)||(he(!1,x.toString()),r&&r(x))}const y=P.useMemo(()=>c.getViewport({scale:f*n,rotation:u}),[n,c,u,f]),w=P.useMemo(()=>c.getViewport({scale:f,rotation:u}),[c,u,f]);P.useEffect(function(){if(!c)return;c.cleanup();const{current:S}=b;if(!S)return;S.width=y.width,S.height=y.height,S.style.width=`${Math.floor(w.width)}px`,S.style.height=`${Math.floor(w.height)}px`,S.style.visibility="hidden";const C={annotationMode:h?Mu.ENABLE_FORMS:Mu.ENABLE,canvasContext:S.getContext("2d",{alpha:!1}),viewport:y};i&&(C.background=i);const T=c.render(C),R=T;return T.promise.then(()=>{S.style.visibility="",g()}).catch(_),()=>rr(R)},[i,c,h,y,w]);const E=P.useCallback(()=>{const{current:x}=b;x&&(x.width=0,x.height=0)},[]);return P.useEffect(()=>E,[E]),B.jsx("canvas",{className:`${s}__canvas`,dir:"ltr",ref:gg(p,b),style:{display:"block",userSelect:"none"},children:d?B.jsx(Rv,{}):null})}function Iv(l){return"str"in l}function Mv(){const l=Wc();pt(l);const{customTextRenderer:t,onGetTextError:e,onGetTextSuccess:s,onRenderTextLayerError:i,onRenderTextLayerSuccess:n,page:r,pageIndex:o,pageNumber:c,rotate:h,scale:d}=l;pt(r);const[u,f]=Ta(),{value:p,error:b}=u,g=P.useRef(null);he(Number.parseInt(window.getComputedStyle(document.body).getPropertyValue("--react-pdf-text-layer"),10)===1,"TextLayer styles not found. Read more: https://github.com/wojtekmaj/react-pdf#support-for-text-layer");function _(){p&&s&&s(p)}function y(){b&&(he(!1,b.toString()),e&&e(b))}P.useEffect(function(){f({type:"RESET"})},[r,f]),P.useEffect(function(){if(!r)return;const R=_l(r.getTextContent()),I=R;return R.promise.then(D=>{f({type:"RESOLVE",value:D})}).catch(D=>{f({type:"REJECT",error:D})}),()=>rr(I)},[r,f]),P.useEffect(()=>{if(p!==void 0){if(p===!1){y();return}_()}},[p]);const w=P.useCallback(()=>{n&&n()},[n]),E=P.useCallback(T=>{he(!1,T.toString()),i&&i(T)},[i]);function x(){const T=g.current;T&&T.classList.add("selecting")}function S(){const T=g.current;T&&T.classList.remove("selecting")}const C=P.useMemo(()=>r.getViewport({scale:d,rotation:h}),[r,h,d]);return P.useLayoutEffect(function(){if(!r||!p)return;const{current:R}=g;if(!R)return;R.innerHTML="";const I=r.streamTextContent({includeMarkedContent:!0}),D={container:R,textContentSource:I,viewport:C},M=new og(D),L=M;return M.render().then(()=>{const j=document.createElement("div");j.className="endOfContent",R.append(j);const O=R.querySelectorAll('[role="presentation"]');if(t){let U=0;p.items.forEach((G,N)=>{if(!Iv(G))return;const z=O[U];if(!z)return;const It=t(Object.assign({pageIndex:o,pageNumber:c,itemIndex:N},G));z.innerHTML=It,U+=G.str&&G.hasEOL?2:1})}w()}).catch(E),()=>rr(L)},[t,E,w,r,o,c,p,C]),B.jsx("div",{className:bl("react-pdf__Page__textContent","textLayer"),onMouseUp:S,onMouseDown:x,ref:g})}function kv(){const l=pg(),t=Wc();pt(t);const e=Object.assign(Object.assign({},l),t),{imageResourcesPath:s,linkService:i,onGetAnnotationsError:n,onGetAnnotationsSuccess:r,onRenderAnnotationLayerError:o,onRenderAnnotationLayerSuccess:c,page:h,pdf:d,renderForms:u,rotate:f,scale:p=1}=e;pt(d),pt(h),pt(i);const[b,g]=Ta(),{value:_,error:y}=b,w=P.useRef(null);he(Number.parseInt(window.getComputedStyle(document.body).getPropertyValue("--react-pdf-annotation-layer"),10)===1,"AnnotationLayer styles not found. Read more: https://github.com/wojtekmaj/react-pdf#support-for-annotations");function E(){_&&r&&r(_)}function x(){y&&(he(!1,y.toString()),n&&n(y))}P.useEffect(function(){g({type:"RESET"})},[g,h]),P.useEffect(function(){if(!h)return;const I=_l(h.getAnnotations()),D=I;return I.promise.then(M=>{g({type:"RESOLVE",value:M})}).catch(M=>{g({type:"REJECT",error:M})}),()=>{rr(D)}},[g,h]),P.useEffect(()=>{if(_!==void 0){if(_===!1){x();return}E()}},[_]);function S(){c&&c()}function C(R){he(!1,`${R}`),o&&o(R)}const T=P.useMemo(()=>h.getViewport({scale:p,rotation:f}),[h,f,p]);return P.useEffect(function(){if(!d||!h||!i||!_)return;const{current:I}=w;if(!I)return;const D=T.clone({dontFlip:!0}),M={accessibilityManager:null,annotationCanvasMap:null,annotationEditorUIManager:null,div:I,l10n:null,page:h,structTreeLayer:null,viewport:D},L={annotations:_,annotationStorage:d.annotationStorage,div:I,imageResourcesPath:s,linkService:i,page:h,renderForms:u,viewport:D};I.innerHTML="";try{new rg(M).render(L),S()}catch(j){C(j)}return()=>{}},[_,s,i,h,d,u,T]),B.jsx("div",{className:bl("react-pdf__Page__annotations","annotationLayer"),ref:w})}var Lv=function(l,t){var e={};for(var s in l)Object.prototype.hasOwnProperty.call(l,s)&&t.indexOf(s)<0&&(e[s]=l[s]);if(l!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,s=Object.getOwnPropertySymbols(l);i<s.length;i++)t.indexOf(s[i])<0&&Object.prototype.propertyIsEnumerable.call(l,s[i])&&(e[s[i]]=l[s[i]]);return e};const ku=1;function Fv(l){const t=pg(),e=Object.assign(Object.assign({},t),l),{_className:s="react-pdf__Page",_enableRegisterUnregisterPage:i=!0,canvasBackground:n,canvasRef:r,children:o,className:c,customRenderer:h,customTextRenderer:d,devicePixelRatio:u,error:f="Failed to load the page.",height:p,inputRef:b,loading:g="Loading page…",noData:_="No page specified.",onGetAnnotationsError:y,onGetAnnotationsSuccess:w,onGetStructTreeError:E,onGetStructTreeSuccess:x,onGetTextError:S,onGetTextSuccess:C,onLoadError:T,onLoadSuccess:R,onRenderAnnotationLayerError:I,onRenderAnnotationLayerSuccess:D,onRenderError:M,onRenderSuccess:L,onRenderTextLayerError:j,onRenderTextLayerSuccess:O,pageIndex:U,pageNumber:G,pdf:N,registerPage:z,renderAnnotationLayer:It=!0,renderForms:Mt=!1,renderMode:Tt="canvas",renderTextLayer:ot=!0,rotate:nt,scale:St=ku,unregisterPage:se,width:bt}=e,V=Lv(e,["_className","_enableRegisterUnregisterPage","canvasBackground","canvasRef","children","className","customRenderer","customTextRenderer","devicePixelRatio","error","height","inputRef","loading","noData","onGetAnnotationsError","onGetAnnotationsSuccess","onGetStructTreeError","onGetStructTreeSuccess","onGetTextError","onGetTextSuccess","onLoadError","onLoadSuccess","onRenderAnnotationLayerError","onRenderAnnotationLayerSuccess","onRenderError","onRenderSuccess","onRenderTextLayerError","onRenderTextLayerSuccess","pageIndex","pageNumber","pdf","registerPage","renderAnnotationLayer","renderForms","renderMode","renderTextLayer","rotate","scale","unregisterPage","width"]),[Ot,Kt]=Ta(),{value:ft,error:Pa}=Ot,Ia=P.useRef(null);pt(N);const gt=Ki(G)?G-1:U??null,kt=G??(Ki(U)?U+1:null),ie=nt??(ft?ft.rotate:null),Wt=P.useMemo(()=>{if(!ft)return null;let ur=1;const El=St??ku;if(bt||p){const Sl=ft.getViewport({scale:1,rotation:ie});bt?ur=bt/Sl.width:p&&(ur=p/Sl.height)}return El*ur},[p,ft,ie,St,bt]);P.useEffect(function(){return()=>{Ki(gt)&&i&&se&&se(gt)}},[i,N,gt,se]);function dr(){if(R){if(!ft||!Wt)return;R(Cd(ft,Wt))}if(i&&z){if(!Ki(gt)||!Ia.current)return;z(gt,Ia.current)}}function Ma(){Pa&&(he(!1,Pa.toString()),T&&T(Pa))}P.useEffect(function(){Kt({type:"RESET"})},[Kt,N,gt]),P.useEffect(function(){if(!N||!kt)return;const El=_l(N.getPage(kt)),Sl=El;return El.promise.then(Gc=>{Kt({type:"RESOLVE",value:Gc})}).catch(Gc=>{Kt({type:"REJECT",error:Gc})}),()=>rr(Sl)},[Kt,N,kt]),P.useEffect(()=>{if(ft!==void 0){if(ft===!1){Ma();return}dr()}},[ft,Wt]);const Lg=P.useMemo(()=>ft&&Ki(gt)&&kt&&Ki(ie)&&Ki(Wt)?{_className:s,canvasBackground:n,customTextRenderer:d,devicePixelRatio:u,onGetAnnotationsError:y,onGetAnnotationsSuccess:w,onGetStructTreeError:E,onGetStructTreeSuccess:x,onGetTextError:S,onGetTextSuccess:C,onRenderAnnotationLayerError:I,onRenderAnnotationLayerSuccess:D,onRenderError:M,onRenderSuccess:L,onRenderTextLayerError:j,onRenderTextLayerSuccess:O,page:ft,pageIndex:gt,pageNumber:kt,renderForms:Mt,renderTextLayer:ot,rotate:ie,scale:Wt}:null,[s,n,d,u,y,w,E,x,S,C,I,D,M,L,j,O,ft,gt,kt,Mt,ot,ie,Wt]),Fg=P.useMemo(()=>hg(V,()=>ft&&(Wt?Cd(ft,Wt):void 0)),[V,ft,Wt]),wl=`${gt}@${Wt}/${ie}`;function Dg(){switch(Tt){case"custom":return pt(h),B.jsx(h,{},`${wl}_custom`);case"none":return null;case"canvas":default:return B.jsx(Pv,{canvasRef:r},`${wl}_canvas`)}}function Og(){return ot?B.jsx(Mv,{},`${wl}_text`):null}function Ng(){return It?B.jsx(kv,{},`${wl}_annotations`):null}function Hg(){return B.jsxs(mg.Provider,{value:Lg,children:[Dg(),Og(),Ng(),o]})}function Bg(){return kt?N===null||ft===void 0||ft===null?B.jsx(Rr,{type:"loading",children:typeof g=="function"?g():g}):N===!1||ft===!1?B.jsx(Rr,{type:"error",children:typeof f=="function"?f():f}):Hg():B.jsx(Rr,{type:"no-data",children:typeof _=="function"?_():_})}return B.jsx("div",Object.assign({className:bl(s,c),"data-page-number":kt,ref:gg(b,Ia),style:{"--scale-factor":`${Wt}`,backgroundColor:n||"white",position:"relative",minWidth:"min-content",minHeight:"min-content"}},Fg,{children:Bg()}))}mv();Xd.workerSrc="pdf.worker.mjs";var Lu=Number.isNaN||function(t){return typeof t=="number"&&t!==t};function Dv(l,t){return!!(l===t||Lu(l)&&Lu(t))}function Ov(l,t){if(l.length!==t.length)return!1;for(var e=0;e<l.length;e++)if(!Dv(l[e],t[e]))return!1;return!0}function th(l,t){t===void 0&&(t=Ov);var e,s=[],i,n=!1;function r(){for(var o=[],c=0;c<arguments.length;c++)o[c]=arguments[c];return n&&e===this&&t(o,s)||(i=l.apply(this,o),n=!0,e=this,s=o),i}return r}var Nv=typeof performance=="object"&&typeof performance.now=="function",Fu=Nv?function(){return performance.now()}:function(){return Date.now()};function Du(l){cancelAnimationFrame(l.id)}function Hv(l,t){var e=Fu();function s(){Fu()-e>=t?l.call(null):i.id=requestAnimationFrame(s)}var i={id:requestAnimationFrame(s)};return i}var eh=-1;function Ou(l){if(l===void 0&&(l=!1),eh===-1||l){var t=document.createElement("div"),e=t.style;e.width="50px",e.height="50px",e.overflow="scroll",document.body.appendChild(t),eh=t.offsetWidth-t.clientWidth,document.body.removeChild(t)}return eh}var fr=null;function Nu(l){if(l===void 0&&(l=!1),fr===null||l){var t=document.createElement("div"),e=t.style;e.width="50px",e.height="50px",e.overflow="scroll",e.direction="rtl";var s=document.createElement("div"),i=s.style;return i.width="100px",i.height="100px",t.appendChild(s),document.body.appendChild(t),t.scrollLeft>0?fr="positive-descending":(t.scrollLeft=1,t.scrollLeft===0?fr="negative":fr="positive-ascending"),document.body.removeChild(t),fr}return fr}var Bv=150,jv=function(t,e){return t};function zv(l){var t,e=l.getItemOffset,s=l.getEstimatedTotalSize,i=l.getItemSize,n=l.getOffsetForIndexAndAlignment,r=l.getStartIndexForOffset,o=l.getStopIndexForStartIndex,c=l.initInstanceProps,h=l.shouldResetStyleCacheOnItemSizeChange,d=l.validateProps;return t=(function(u){Wg(f,u);function f(b){var g;return g=u.call(this,b)||this,g._instanceProps=c(g.props,eu(g)),g._outerRef=void 0,g._resetIsScrollingTimeoutId=null,g.state={instance:eu(g),isScrolling:!1,scrollDirection:"forward",scrollOffset:typeof g.props.initialScrollOffset=="number"?g.props.initialScrollOffset:0,scrollUpdateWasRequested:!1},g._callOnItemsRendered=void 0,g._callOnItemsRendered=th(function(_,y,w,E){return g.props.onItemsRendered({overscanStartIndex:_,overscanStopIndex:y,visibleStartIndex:w,visibleStopIndex:E})}),g._callOnScroll=void 0,g._callOnScroll=th(function(_,y,w){return g.props.onScroll({scrollDirection:_,scrollOffset:y,scrollUpdateWasRequested:w})}),g._getItemStyle=void 0,g._getItemStyle=function(_){var y=g.props,w=y.direction,E=y.itemSize,x=y.layout,S=g._getItemStyleCache(h&&E,h&&x,h&&w),C;if(S.hasOwnProperty(_))C=S[_];else{var T=e(g.props,_,g._instanceProps),R=i(g.props,_,g._instanceProps),I=w==="horizontal"||x==="horizontal",D=w==="rtl",M=I?T:0;S[_]=C={position:"absolute",left:D?void 0:M,right:D?M:void 0,top:I?0:T,height:I?"100%":R,width:I?R:"100%"}}return C},g._getItemStyleCache=void 0,g._getItemStyleCache=th(function(_,y,w){return{}}),g._onScrollHorizontal=function(_){var y=_.currentTarget,w=y.clientWidth,E=y.scrollLeft,x=y.scrollWidth;g.setState(function(S){if(S.scrollOffset===E)return null;var C=g.props.direction,T=E;if(C==="rtl")switch(Nu()){case"negative":T=-E;break;case"positive-descending":T=x-w-E;break}return T=Math.max(0,Math.min(T,x-w)),{isScrolling:!0,scrollDirection:S.scrollOffset<E?"forward":"backward",scrollOffset:T,scrollUpdateWasRequested:!1}},g._resetIsScrollingDebounced)},g._onScrollVertical=function(_){var y=_.currentTarget,w=y.clientHeight,E=y.scrollHeight,x=y.scrollTop;g.setState(function(S){if(S.scrollOffset===x)return null;var C=Math.max(0,Math.min(x,E-w));return{isScrolling:!0,scrollDirection:S.scrollOffset<C?"forward":"backward",scrollOffset:C,scrollUpdateWasRequested:!1}},g._resetIsScrollingDebounced)},g._outerRefSetter=function(_){var y=g.props.outerRef;g._outerRef=_,typeof y=="function"?y(_):y!=null&&typeof y=="object"&&y.hasOwnProperty("current")&&(y.current=_)},g._resetIsScrollingDebounced=function(){g._resetIsScrollingTimeoutId!==null&&Du(g._resetIsScrollingTimeoutId),g._resetIsScrollingTimeoutId=Hv(g._resetIsScrolling,Bv)},g._resetIsScrolling=function(){g._resetIsScrollingTimeoutId=null,g.setState({isScrolling:!1},function(){g._getItemStyleCache(-1,null)})},g}f.getDerivedStateFromProps=function(g,_){return $v(g,_),d(g),null};var p=f.prototype;return p.scrollTo=function(g){g=Math.max(0,g),this.setState(function(_){return _.scrollOffset===g?null:{scrollDirection:_.scrollOffset<g?"forward":"backward",scrollOffset:g,scrollUpdateWasRequested:!0}},this._resetIsScrollingDebounced)},p.scrollToItem=function(g,_){_===void 0&&(_="auto");var y=this.props,w=y.itemCount,E=y.layout,x=this.state.scrollOffset;g=Math.max(0,Math.min(g,w-1));var S=0;if(this._outerRef){var C=this._outerRef;E==="vertical"?S=C.scrollWidth>C.clientWidth?Ou():0:S=C.scrollHeight>C.clientHeight?Ou():0}this.scrollTo(n(this.props,g,_,x,this._instanceProps,S))},p.componentDidMount=function(){var g=this.props,_=g.direction,y=g.initialScrollOffset,w=g.layout;if(typeof y=="number"&&this._outerRef!=null){var E=this._outerRef;_==="horizontal"||w==="horizontal"?E.scrollLeft=y:E.scrollTop=y}this._callPropsCallbacks()},p.componentDidUpdate=function(){var g=this.props,_=g.direction,y=g.layout,w=this.state,E=w.scrollOffset,x=w.scrollUpdateWasRequested;if(x&&this._outerRef!=null){var S=this._outerRef;if(_==="horizontal"||y==="horizontal")if(_==="rtl")switch(Nu()){case"negative":S.scrollLeft=-E;break;case"positive-ascending":S.scrollLeft=E;break;default:var C=S.clientWidth,T=S.scrollWidth;S.scrollLeft=T-C-E;break}else S.scrollLeft=E;else S.scrollTop=E}this._callPropsCallbacks()},p.componentWillUnmount=function(){this._resetIsScrollingTimeoutId!==null&&Du(this._resetIsScrollingTimeoutId)},p.render=function(){var g=this.props,_=g.children,y=g.className,w=g.direction,E=g.height,x=g.innerRef,S=g.innerElementType,C=g.innerTagName,T=g.itemCount,R=g.itemData,I=g.itemKey,D=I===void 0?jv:I,M=g.layout,L=g.outerElementType,j=g.outerTagName,O=g.style,U=g.useIsScrolling,G=g.width,N=this.state.isScrolling,z=w==="horizontal"||M==="horizontal",It=z?this._onScrollHorizontal:this._onScrollVertical,Mt=this._getRangeToRender(),Tt=Mt[0],ot=Mt[1],nt=[];if(T>0)for(var St=Tt;St<=ot;St++)nt.push(P.createElement(_,{data:R,key:D(St,R),index:St,isScrolling:U?N:void 0,style:this._getItemStyle(St)}));var se=s(this.props,this._instanceProps);return P.createElement(L||j||"div",{className:y,onScroll:It,ref:this._outerRefSetter,style:$g({position:"relative",height:E,width:G,overflow:"auto",WebkitOverflowScrolling:"touch",willChange:"transform",direction:w},O)},P.createElement(S||C||"div",{children:nt,ref:x,style:{height:z?"100%":se,pointerEvents:N?"none":void 0,width:z?se:"100%"}}))},p._callPropsCallbacks=function(){if(typeof this.props.onItemsRendered=="function"){var g=this.props.itemCount;if(g>0){var _=this._getRangeToRender(),y=_[0],w=_[1],E=_[2],x=_[3];this._callOnItemsRendered(y,w,E,x)}}if(typeof this.props.onScroll=="function"){var S=this.state,C=S.scrollDirection,T=S.scrollOffset,R=S.scrollUpdateWasRequested;this._callOnScroll(C,T,R)}},p._getRangeToRender=function(){var g=this.props,_=g.itemCount,y=g.overscanCount,w=this.state,E=w.isScrolling,x=w.scrollDirection,S=w.scrollOffset;if(_===0)return[0,0,0,0];var C=r(this.props,S,this._instanceProps),T=o(this.props,C,S,this._instanceProps),R=!E||x==="backward"?Math.max(1,y):1,I=!E||x==="forward"?Math.max(1,y):1;return[Math.max(0,C-R),Math.max(0,Math.min(_-1,T+I)),C,T]},f})(P.PureComponent),t.defaultProps={direction:"ltr",itemData:void 0,layout:"vertical",overscanCount:2,useIsScrolling:!1},t}var $v=function(t,e){t.children,t.direction,t.height,t.layout,t.innerTagName,t.outerTagName,t.width,e.instance},Wv=50,Er=function(t,e,s){var i=t,n=i.itemSize,r=s.itemMetadataMap,o=s.lastMeasuredIndex;if(e>o){var c=0;if(o>=0){var h=r[o];c=h.offset+h.size}for(var d=o+1;d<=e;d++){var u=n(d);r[d]={offset:c,size:u},c+=u}s.lastMeasuredIndex=e}return r[e]},Gv=function(t,e,s){var i=e.itemMetadataMap,n=e.lastMeasuredIndex,r=n>0?i[n].offset:0;return r>=s?_g(t,e,n,0,s):Uv(t,e,Math.max(0,n),s)},_g=function(t,e,s,i,n){for(;i<=s;){var r=i+Math.floor((s-i)/2),o=Er(t,r,e).offset;if(o===n)return r;o<n?i=r+1:o>n&&(s=r-1)}return i>0?i-1:0},Uv=function(t,e,s,i){for(var n=t.itemCount,r=1;s<n&&Er(t,s,e).offset<i;)s+=r,r*=2;return _g(t,e,Math.min(s,n-1),Math.floor(s/2),i)},Hu=function(t,e){var s=t.itemCount,i=e.itemMetadataMap,n=e.estimatedItemSize,r=e.lastMeasuredIndex,o=0;if(r>=s&&(r=s-1),r>=0){var c=i[r];o=c.offset+c.size}var h=s-r-1,d=h*n;return o+d},Vv=zv({getItemOffset:function(t,e,s){return Er(t,e,s).offset},getItemSize:function(t,e,s){return s.itemMetadataMap[e].size},getEstimatedTotalSize:Hu,getOffsetForIndexAndAlignment:function(t,e,s,i,n,r){var o=t.direction,c=t.height,h=t.layout,d=t.width,u=o==="horizontal"||h==="horizontal",f=u?d:c,p=Er(t,e,n),b=Hu(t,n),g=Math.max(0,Math.min(b-f,p.offset)),_=Math.max(0,p.offset-f+p.size+r);switch(s==="smart"&&(i>=_-f&&i<=g+f?s="auto":s="center"),s){case"start":return g;case"end":return _;case"center":return Math.round(_+(g-_)/2);case"auto":default:return i>=_&&i<=g?i:i<_?_:g}},getStartIndexForOffset:function(t,e,s){return Gv(t,s,e)},getStopIndexForStartIndex:function(t,e,s,i){for(var n=t.direction,r=t.height,o=t.itemCount,c=t.layout,h=t.width,d=n==="horizontal"||c==="horizontal",u=d?h:r,f=Er(t,e,i),p=s+u,b=f.offset+f.size,g=e;g<o-1&&b<p;)g++,b+=Er(t,g,i).size;return g},initInstanceProps:function(t,e){var s=t,i=s.estimatedItemSize,n={itemMetadataMap:{},estimatedItemSize:i||Wv,lastMeasuredIndex:-1};return e.resetAfterIndex=function(r,o){o===void 0&&(o=!0),n.lastMeasuredIndex=Math.min(n.lastMeasuredIndex,r-1),e._getItemStyleCache(-1),o&&e.forceUpdate()},n},shouldResetStyleCacheOnItemSizeChange:!1,validateProps:function(t){t.itemSize}});function di(l){return Array.isArray?Array.isArray(l):Sg(l)==="[object Array]"}function Xv(l){if(typeof l=="string")return l;let t=l+"";return t=="0"&&1/l==-1/0?"-0":t}function qv(l){return l==null?"":Xv(l)}function Ms(l){return typeof l=="string"}function wg(l){return typeof l=="number"}function Yv(l){return l===!0||l===!1||Kv(l)&&Sg(l)=="[object Boolean]"}function Eg(l){return typeof l=="object"}function Kv(l){return Eg(l)&&l!==null}function Ne(l){return l!=null}function sh(l){return!l.trim().length}function Sg(l){return l==null?l===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(l)}const Zv="Incorrect 'index' type",Qv=l=>`Invalid value for key ${l}`,Jv=l=>`Pattern length exceeds max of ${l}.`,ty=l=>`Missing ${l} property in key`,ey=l=>`Property 'weight' in key '${l}' must be a positive integer`,Bu=Object.prototype.hasOwnProperty;class sy{constructor(t){this._keys=[],this._keyMap={};let e=0;t.forEach(s=>{let i=xg(s);e+=i.weight,this._keys.push(i),this._keyMap[i.id]=i,e+=i.weight}),this._keys.forEach(s=>{s.weight/=e})}get(t){return this._keyMap[t]}keys(){return this._keys}toJSON(){return JSON.stringify(this._keys)}}function xg(l){let t=null,e=null,s=null,i=1,n=null;if(Ms(l)||di(l))s=l,t=ju(l),e=Td(l);else{if(!Bu.call(l,"name"))throw new Error(ty("name"));const r=l.name;if(s=r,Bu.call(l,"weight")&&(i=l.weight,i<=0))throw new Error(ey(r));t=ju(r),e=Td(r),n=l.getFn}return{path:t,id:e,weight:i,src:s,getFn:n}}function ju(l){return di(l)?l:l.split(".")}function Td(l){return di(l)?l.join("."):l}function iy(l,t){let e=[],s=!1;const i=(n,r,o)=>{if(Ne(n))if(!r[o])e.push(n);else{let c=r[o];const h=n[c];if(!Ne(h))return;if(o===r.length-1&&(Ms(h)||wg(h)||Yv(h)))e.push(qv(h));else if(di(h)){s=!0;for(let d=0,u=h.length;d<u;d+=1)i(h[d],r,o+1)}else r.length&&i(h,r,o+1)}};return i(l,Ms(t)?t.split("."):t,0),s?e:e[0]}const ny={includeMatches:!1,findAllMatches:!1,minMatchCharLength:1},ry={isCaseSensitive:!1,includeScore:!1,keys:[],shouldSort:!0,sortFn:(l,t)=>l.score===t.score?l.idx<t.idx?-1:1:l.score<t.score?-1:1},ay={location:0,threshold:.6,distance:100},oy={useExtendedSearch:!1,getFn:iy,ignoreLocation:!1,ignoreFieldNorm:!1,fieldNormWeight:1};var Y={...ry,...ny,...ay,...oy};const ly=/[^ ]+/g;function cy(l=1,t=3){const e=new Map,s=Math.pow(10,t);return{get(i){const n=i.match(ly).length;if(e.has(n))return e.get(n);const r=1/Math.pow(n,.5*l),o=parseFloat(Math.round(r*s)/s);return e.set(n,o),o},clear(){e.clear()}}}class qd{constructor({getFn:t=Y.getFn,fieldNormWeight:e=Y.fieldNormWeight}={}){this.norm=cy(e,3),this.getFn=t,this.isCreated=!1,this.setIndexRecords()}setSources(t=[]){this.docs=t}setIndexRecords(t=[]){this.records=t}setKeys(t=[]){this.keys=t,this._keysMap={},t.forEach((e,s)=>{this._keysMap[e.id]=s})}create(){this.isCreated||!this.docs.length||(this.isCreated=!0,Ms(this.docs[0])?this.docs.forEach((t,e)=>{this._addString(t,e)}):this.docs.forEach((t,e)=>{this._addObject(t,e)}),this.norm.clear())}add(t){const e=this.size();Ms(t)?this._addString(t,e):this._addObject(t,e)}removeAt(t){this.records.splice(t,1);for(let e=t,s=this.size();e<s;e+=1)this.records[e].i-=1}getValueForItemAtKeyId(t,e){return t[this._keysMap[e]]}size(){return this.records.length}_addString(t,e){if(!Ne(t)||sh(t))return;let s={v:t,i:e,n:this.norm.get(t)};this.records.push(s)}_addObject(t,e){let s={i:e,$:{}};this.keys.forEach((i,n)=>{let r=i.getFn?i.getFn(t):this.getFn(t,i.path);if(Ne(r)){if(di(r)){let o=[];const c=[{nestedArrIndex:-1,value:r}];for(;c.length;){const{nestedArrIndex:h,value:d}=c.pop();if(Ne(d))if(Ms(d)&&!sh(d)){let u={v:d,i:h,n:this.norm.get(d)};o.push(u)}else di(d)&&d.forEach((u,f)=>{c.push({nestedArrIndex:f,value:u})})}s.$[n]=o}else if(Ms(r)&&!sh(r)){let o={v:r,n:this.norm.get(r)};s.$[n]=o}}}),this.records.push(s)}toJSON(){return{keys:this.keys,records:this.records}}}function Cg(l,t,{getFn:e=Y.getFn,fieldNormWeight:s=Y.fieldNormWeight}={}){const i=new qd({getFn:e,fieldNormWeight:s});return i.setKeys(l.map(xg)),i.setSources(t),i.create(),i}function hy(l,{getFn:t=Y.getFn,fieldNormWeight:e=Y.fieldNormWeight}={}){const{keys:s,records:i}=l,n=new qd({getFn:t,fieldNormWeight:e});return n.setKeys(s),n.setIndexRecords(i),n}function Ll(l,{errors:t=0,currentLocation:e=0,expectedLocation:s=0,distance:i=Y.distance,ignoreLocation:n=Y.ignoreLocation}={}){const r=t/l.length;if(n)return r;const o=Math.abs(s-e);return i?r+o/i:o?1:r}function dy(l=[],t=Y.minMatchCharLength){let e=[],s=-1,i=-1,n=0;for(let r=l.length;n<r;n+=1){let o=l[n];o&&s===-1?s=n:!o&&s!==-1&&(i=n-1,i-s+1>=t&&e.push([s,i]),s=-1)}return l[n-1]&&n-s>=t&&e.push([s,n-1]),e}const en=32;function uy(l,t,e,{location:s=Y.location,distance:i=Y.distance,threshold:n=Y.threshold,findAllMatches:r=Y.findAllMatches,minMatchCharLength:o=Y.minMatchCharLength,includeMatches:c=Y.includeMatches,ignoreLocation:h=Y.ignoreLocation}={}){if(t.length>en)throw new Error(Jv(en));const d=t.length,u=l.length,f=Math.max(0,Math.min(s,u));let p=n,b=f;const g=o>1||c,_=g?Array(u):[];let y;for(;(y=l.indexOf(t,b))>-1;){let T=Ll(t,{currentLocation:y,expectedLocation:f,distance:i,ignoreLocation:h});if(p=Math.min(T,p),b=y+d,g){let R=0;for(;R<d;)_[y+R]=1,R+=1}}b=-1;let w=[],E=1,x=d+u;const S=1<<d-1;for(let T=0;T<d;T+=1){let R=0,I=x;for(;R<I;)Ll(t,{errors:T,currentLocation:f+I,expectedLocation:f,distance:i,ignoreLocation:h})<=p?R=I:x=I,I=Math.floor((x-R)/2+R);x=I;let D=Math.max(1,f-I+1),M=r?u:Math.min(f+I,u)+d,L=Array(M+2);L[M+1]=(1<<T)-1;for(let O=M;O>=D;O-=1){let U=O-1,G=e[l.charAt(U)];if(g&&(_[U]=+!!G),L[O]=(L[O+1]<<1|1)&G,T&&(L[O]|=(w[O+1]|w[O])<<1|1|w[O+1]),L[O]&S&&(E=Ll(t,{errors:T,currentLocation:U,expectedLocation:f,distance:i,ignoreLocation:h}),E<=p)){if(p=E,b=U,b<=f)break;D=Math.max(1,2*f-b)}}if(Ll(t,{errors:T+1,currentLocation:f,expectedLocation:f,distance:i,ignoreLocation:h})>p)break;w=L}const C={isMatch:b>=0,score:Math.max(.001,E)};if(g){const T=dy(_,o);T.length?c&&(C.indices=T):C.isMatch=!1}return C}function fy(l){let t={};for(let e=0,s=l.length;e<s;e+=1){const i=l.charAt(e);t[i]=(t[i]||0)|1<<s-e-1}return t}class Tg{constructor(t,{location:e=Y.location,threshold:s=Y.threshold,distance:i=Y.distance,includeMatches:n=Y.includeMatches,findAllMatches:r=Y.findAllMatches,minMatchCharLength:o=Y.minMatchCharLength,isCaseSensitive:c=Y.isCaseSensitive,ignoreLocation:h=Y.ignoreLocation}={}){if(this.options={location:e,threshold:s,distance:i,includeMatches:n,findAllMatches:r,minMatchCharLength:o,isCaseSensitive:c,ignoreLocation:h},this.pattern=c?t:t.toLowerCase(),this.chunks=[],!this.pattern.length)return;const d=(f,p)=>{this.chunks.push({pattern:f,alphabet:fy(f),startIndex:p})},u=this.pattern.length;if(u>en){let f=0;const p=u%en,b=u-p;for(;f<b;)d(this.pattern.substr(f,en),f),f+=en;if(p){const g=u-en;d(this.pattern.substr(g),g)}}else d(this.pattern,0)}searchIn(t){const{isCaseSensitive:e,includeMatches:s}=this.options;if(e||(t=t.toLowerCase()),this.pattern===t){let b={isMatch:!0,score:0};return s&&(b.indices=[[0,t.length-1]]),b}const{location:i,distance:n,threshold:r,findAllMatches:o,minMatchCharLength:c,ignoreLocation:h}=this.options;let d=[],u=0,f=!1;this.chunks.forEach(({pattern:b,alphabet:g,startIndex:_})=>{const{isMatch:y,score:w,indices:E}=uy(t,b,g,{location:i+_,distance:n,threshold:r,findAllMatches:o,minMatchCharLength:c,includeMatches:s,ignoreLocation:h});y&&(f=!0),u+=w,y&&E&&(d=[...d,...E])});let p={isMatch:f,score:f?u/this.chunks.length:1};return f&&s&&(p.indices=d),p}}class Yi{constructor(t){this.pattern=t}static isMultiMatch(t){return zu(t,this.multiRegex)}static isSingleMatch(t){return zu(t,this.singleRegex)}search(){}}function zu(l,t){const e=l.match(t);return e?e[1]:null}class py extends Yi{constructor(t){super(t)}static get type(){return"exact"}static get multiRegex(){return/^="(.*)"$/}static get singleRegex(){return/^=(.*)$/}search(t){const e=t===this.pattern;return{isMatch:e,score:e?0:1,indices:[0,this.pattern.length-1]}}}class gy extends Yi{constructor(t){super(t)}static get type(){return"inverse-exact"}static get multiRegex(){return/^!"(.*)"$/}static get singleRegex(){return/^!(.*)$/}search(t){const s=t.indexOf(this.pattern)===-1;return{isMatch:s,score:s?0:1,indices:[0,t.length-1]}}}class my extends Yi{constructor(t){super(t)}static get type(){return"prefix-exact"}static get multiRegex(){return/^\^"(.*)"$/}static get singleRegex(){return/^\^(.*)$/}search(t){const e=t.startsWith(this.pattern);return{isMatch:e,score:e?0:1,indices:[0,this.pattern.length-1]}}}class by extends Yi{constructor(t){super(t)}static get type(){return"inverse-prefix-exact"}static get multiRegex(){return/^!\^"(.*)"$/}static get singleRegex(){return/^!\^(.*)$/}search(t){const e=!t.startsWith(this.pattern);return{isMatch:e,score:e?0:1,indices:[0,t.length-1]}}}class Ay extends Yi{constructor(t){super(t)}static get type(){return"suffix-exact"}static get multiRegex(){return/^"(.*)"\$$/}static get singleRegex(){return/^(.*)\$$/}search(t){const e=t.endsWith(this.pattern);return{isMatch:e,score:e?0:1,indices:[t.length-this.pattern.length,t.length-1]}}}class vy extends Yi{constructor(t){super(t)}static get type(){return"inverse-suffix-exact"}static get multiRegex(){return/^!"(.*)"\$$/}static get singleRegex(){return/^!(.*)\$$/}search(t){const e=!t.endsWith(this.pattern);return{isMatch:e,score:e?0:1,indices:[0,t.length-1]}}}class Rg extends Yi{constructor(t,{location:e=Y.location,threshold:s=Y.threshold,distance:i=Y.distance,includeMatches:n=Y.includeMatches,findAllMatches:r=Y.findAllMatches,minMatchCharLength:o=Y.minMatchCharLength,isCaseSensitive:c=Y.isCaseSensitive,ignoreLocation:h=Y.ignoreLocation}={}){super(t),this._bitapSearch=new Tg(t,{location:e,threshold:s,distance:i,includeMatches:n,findAllMatches:r,minMatchCharLength:o,isCaseSensitive:c,ignoreLocation:h})}static get type(){return"fuzzy"}static get multiRegex(){return/^"(.*)"$/}static get singleRegex(){return/^(.*)$/}search(t){return this._bitapSearch.searchIn(t)}}class Pg extends Yi{constructor(t){super(t)}static get type(){return"include"}static get multiRegex(){return/^'"(.*)"$/}static get singleRegex(){return/^'(.*)$/}search(t){let e=0,s;const i=[],n=this.pattern.length;for(;(s=t.indexOf(this.pattern,e))>-1;)e=s+n,i.push([s,e-1]);const r=!!i.length;return{isMatch:r,score:r?0:1,indices:i}}}const Rd=[py,Pg,my,by,vy,Ay,gy,Rg],$u=Rd.length,yy=/ +(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/,_y="|";function wy(l,t={}){return l.split(_y).map(e=>{let s=e.trim().split(yy).filter(n=>n&&!!n.trim()),i=[];for(let n=0,r=s.length;n<r;n+=1){const o=s[n];let c=!1,h=-1;for(;!c&&++h<$u;){const d=Rd[h];let u=d.isMultiMatch(o);u&&(i.push(new d(u,t)),c=!0)}if(!c)for(h=-1;++h<$u;){const d=Rd[h];let u=d.isSingleMatch(o);if(u){i.push(new d(u,t));break}}}return i})}const Ey=new Set([Rg.type,Pg.type]);class Sy{constructor(t,{isCaseSensitive:e=Y.isCaseSensitive,includeMatches:s=Y.includeMatches,minMatchCharLength:i=Y.minMatchCharLength,ignoreLocation:n=Y.ignoreLocation,findAllMatches:r=Y.findAllMatches,location:o=Y.location,threshold:c=Y.threshold,distance:h=Y.distance}={}){this.query=null,this.options={isCaseSensitive:e,includeMatches:s,minMatchCharLength:i,findAllMatches:r,ignoreLocation:n,location:o,threshold:c,distance:h},this.pattern=e?t:t.toLowerCase(),this.query=wy(this.pattern,this.options)}static condition(t,e){return e.useExtendedSearch}searchIn(t){const e=this.query;if(!e)return{isMatch:!1,score:1};const{includeMatches:s,isCaseSensitive:i}=this.options;t=i?t:t.toLowerCase();let n=0,r=[],o=0;for(let c=0,h=e.length;c<h;c+=1){const d=e[c];r.length=0,n=0;for(let u=0,f=d.length;u<f;u+=1){const p=d[u],{isMatch:b,indices:g,score:_}=p.search(t);if(b){if(n+=1,o+=_,s){const y=p.constructor.type;Ey.has(y)?r=[...r,...g]:r.push(g)}}else{o=0,n=0,r.length=0;break}}if(n){let u={isMatch:!0,score:o/n};return s&&(u.indices=r),u}}return{isMatch:!1,score:1}}}const Pd=[];function xy(...l){Pd.push(...l)}function Id(l,t){for(let e=0,s=Pd.length;e<s;e+=1){let i=Pd[e];if(i.condition(l,t))return new i(l,t)}return new Tg(l,t)}const gc={AND:"$and",OR:"$or"},Md={PATH:"$path",PATTERN:"$val"},kd=l=>!!(l[gc.AND]||l[gc.OR]),Cy=l=>!!l[Md.PATH],Ty=l=>!di(l)&&Eg(l)&&!kd(l),Wu=l=>({[gc.AND]:Object.keys(l).map(t=>({[t]:l[t]}))});function Ig(l,t,{auto:e=!0}={}){const s=i=>{let n=Object.keys(i);const r=Cy(i);if(!r&&n.length>1&&!kd(i))return s(Wu(i));if(Ty(i)){const c=r?i[Md.PATH]:n[0],h=r?i[Md.PATTERN]:i[c];if(!Ms(h))throw new Error(Qv(c));const d={keyId:Td(c),pattern:h};return e&&(d.searcher=Id(h,t)),d}let o={children:[],operator:n[0]};return n.forEach(c=>{const h=i[c];di(h)&&h.forEach(d=>{o.children.push(s(d))})}),o};return kd(l)||(l=Wu(l)),s(l)}function Ry(l,{ignoreFieldNorm:t=Y.ignoreFieldNorm}){l.forEach(e=>{let s=1;e.matches.forEach(({key:i,norm:n,score:r})=>{const o=i?i.weight:null;s*=Math.pow(r===0&&o?Number.EPSILON:r,(o||1)*(t?1:n))}),e.score=s})}function Py(l,t){const e=l.matches;t.matches=[],Ne(e)&&e.forEach(s=>{if(!Ne(s.indices)||!s.indices.length)return;const{indices:i,value:n}=s;let r={indices:i,value:n};s.key&&(r.key=s.key.src),s.idx>-1&&(r.refIndex=s.idx),t.matches.push(r)})}function Iy(l,t){t.score=l.score}function My(l,t,{includeMatches:e=Y.includeMatches,includeScore:s=Y.includeScore}={}){const i=[];return e&&i.push(Py),s&&i.push(Iy),l.map(n=>{const{idx:r}=n,o={item:t[r],refIndex:r};return i.length&&i.forEach(c=>{c(n,o)}),o})}class Ra{constructor(t,e={},s){this.options={...Y,...e},this.options.useExtendedSearch,this._keyStore=new sy(this.options.keys),this.setCollection(t,s)}setCollection(t,e){if(this._docs=t,e&&!(e instanceof qd))throw new Error(Zv);this._myIndex=e||Cg(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight})}add(t){Ne(t)&&(this._docs.push(t),this._myIndex.add(t))}remove(t=()=>!1){const e=[];for(let s=0,i=this._docs.length;s<i;s+=1){const n=this._docs[s];t(n,s)&&(this.removeAt(s),s-=1,i-=1,e.push(n))}return e}removeAt(t){this._docs.splice(t,1),this._myIndex.removeAt(t)}getIndex(){return this._myIndex}search(t,{limit:e=-1}={}){const{includeMatches:s,includeScore:i,shouldSort:n,sortFn:r,ignoreFieldNorm:o}=this.options;let c=Ms(t)?Ms(this._docs[0])?this._searchStringList(t):this._searchObjectList(t):this._searchLogical(t);return Ry(c,{ignoreFieldNorm:o}),n&&c.sort(r),wg(e)&&e>-1&&(c=c.slice(0,e)),My(c,this._docs,{includeMatches:s,includeScore:i})}_searchStringList(t){const e=Id(t,this.options),{records:s}=this._myIndex,i=[];return s.forEach(({v:n,i:r,n:o})=>{if(!Ne(n))return;const{isMatch:c,score:h,indices:d}=e.searchIn(n);c&&i.push({item:n,idx:r,matches:[{score:h,value:n,norm:o,indices:d}]})}),i}_searchLogical(t){const e=Ig(t,this.options),s=(o,c,h)=>{if(!o.children){const{keyId:u,searcher:f}=o,p=this._findMatches({key:this._keyStore.get(u),value:this._myIndex.getValueForItemAtKeyId(c,u),searcher:f});return p&&p.length?[{idx:h,item:c,matches:p}]:[]}const d=[];for(let u=0,f=o.children.length;u<f;u+=1){const p=o.children[u],b=s(p,c,h);if(b.length)d.push(...b);else if(o.operator===gc.AND)return[]}return d},i=this._myIndex.records,n={},r=[];return i.forEach(({$:o,i:c})=>{if(Ne(o)){let h=s(e,o,c);h.length&&(n[c]||(n[c]={idx:c,item:o,matches:[]},r.push(n[c])),h.forEach(({matches:d})=>{n[c].matches.push(...d)}))}}),r}_searchObjectList(t){const e=Id(t,this.options),{keys:s,records:i}=this._myIndex,n=[];return i.forEach(({$:r,i:o})=>{if(!Ne(r))return;let c=[];s.forEach((h,d)=>{c.push(...this._findMatches({key:h,value:r[d],searcher:e}))}),c.length&&n.push({idx:o,item:r,matches:c})}),n}_findMatches({key:t,value:e,searcher:s}){if(!Ne(e))return[];let i=[];if(di(e))e.forEach(({v:n,i:r,n:o})=>{if(!Ne(n))return;const{isMatch:c,score:h,indices:d}=s.searchIn(n);c&&i.push({score:h,key:t,value:n,idx:r,norm:o,indices:d})});else{const{v:n,n:r}=e,{isMatch:o,score:c,indices:h}=s.searchIn(n);o&&i.push({score:c,key:t,value:n,norm:r,indices:h})}return i}}Ra.version="6.6.2";Ra.createIndex=Cg;Ra.parseIndex=hy;Ra.config=Y;Ra.parseQuery=Ig;xy(Sy);var Te;(function(l){l.purple="llama-purple",l.magenta="llama-magenta",l.red="llama-red",l.orange="llama-orange",l.yellow="llama-yellow",l.lime="llama-lime",l.teal="llama-teal",l.cyan="llama-cyan",l.blue="llama-blue",l.indigo="llama-indigo"})(Te||(Te={}));const ky={[Te.purple]:"bg-llama-purple-light",[Te.magenta]:"bg-llama-magenta-light",[Te.red]:"bg-llama-red-light",[Te.indigo]:"bg-llama-indigo-light",[Te.lime]:"bg-llama-lime-light",[Te.orange]:"bg-llama-orange-light",[Te.blue]:"bg-llama-blue-light",[Te.yellow]:"bg-llama-yellow-light",[Te.teal]:"bg-llama-teal-light",[Te.cyan]:"bg-llama-cyan-light"},Ly=(l,t,e=Te.yellow)=>{var s;const i=ky[e],n=document.querySelectorAll(`div[data-page-number='${t+1}'] .react-pdf__Page__textContent.textLayer span`),r=[];n.forEach((g,_)=>{(g.textContent||"").split(" ").map((E,x)=>{r.push({text:E,spanIdx:_,wordIdx:x})})});let o=l;o=o.replace(/\s{2,}/g," "),o=o.replace(/\t/g," "),o=o.toString().trim().replace(/(\r\n|\n|\r)/g,"");const c=o.split(" "),h=c.length;if(!h)return;const d=c[0];if(!d)return;const u=Fy(d,r,h),f={includeScore:!0,threshold:.1,minMatchCharLength:10,shouldSort:!0,findAllMatches:!0,includeMatches:!0,keys:["text"]},b=new Ra(u,f).search(o);if(b.length>0){const g=(s=b[0])===null||s===void 0?void 0:s.item,_=(g==null?void 0:g.startSpan)||0,y=(g==null?void 0:g.endSpan)||0,w=(g==null?void 0:g.startWordIdx)||0,E=(g==null?void 0:g.endWordIdx)||0;for(let x=_;x<y+1;x++){const S=n[x];if(x==_)w===0?Gu(S,i):Uu(w,S,er.START);else if(x==y){if(E===0)return;Uu(E,S,er.END)}else Gu(S,i)}}return!0},Ld="opacity-40 saturate-[3] highlighted-by-llama ",Gu=(l,t)=>{const e=l.textContent||"",s=document.createElement("span");s.className=Ld+t,s.innerText=e,l.innerText="",l.appendChild(s)};var er;(function(l){l[l.START=0]="START",l[l.END=1]="END"})(er||(er={}));const Uu=(l,t,e=er.START)=>{const s=t.textContent;if(!s)return;const i=s.split(" ")[l-1]||"",n=i;t.textContent="",s.split(n).forEach((o,c)=>{if(e===er.START)if(c==0)t.appendChild(document.createTextNode(o));else{t.appendChild(document.createTextNode(i));const h=document.createElement("span");h.className=Ld,h.textContent=o,t.appendChild(h)}if(e===er.END)if(c==0){const h=document.createElement("span");h.className=Ld,h.textContent=o,t.appendChild(h),t.appendChild(document.createTextNode(o))}else t.appendChild(document.createTextNode(i)),t.appendChild(document.createTextNode(o))})};function Fy(l,t,e){var s,i,n,r,o;const c=[];for(let h=0;h<=t.length-e;h++)if(((s=t[h])===null||s===void 0?void 0:s.text)===l){const d=t.slice(h,h+e).reduce((g,_)=>g+" "+_.text,""),u=((i=t[h])===null||i===void 0?void 0:i.spanIdx)||0,f=((n=t[h+e])===null||n===void 0?void 0:n.spanIdx)||0,p=((r=t[h])===null||r===void 0?void 0:r.wordIdx)||0,b=((o=t[h+e])===null||o===void 0?void 0:o.wordIdx)||0;c.push({text:d,startSpan:u,endSpan:f,startWordIdx:p,endWordIdx:b})}return c}const Dy=20,Oy=20,Ny=792,Hy=56,By=.4,jy=44,zy=80,$y={VERTICAL_GUTTER_SIZE_PX:Dy,HORIZONTAL_GUTTER_SIZE_PX:Oy,PAGE_HEIGHT:Ny,PDF_WIDTH_PERCENTAGE:Hy,OBSERVER_THRESHOLD_PERCENTAGE:By,PDF_HEADER_SIZE_PX:jy,PDF_SIDEBAR_SIZE_PX:zy};var Wy=function(l,t,e,s){function i(n){return n instanceof e?n:new e(function(r){r(n)})}return new(e||(e=Promise))(function(n,r){function o(d){try{h(s.next(d))}catch(u){r(u)}}function c(d){try{h(s.throw(d))}catch(u){r(u)}}function h(d){d.done?n(d.value):i(d.value).then(o,c)}h((s=s.apply(l,t||[])).next())})};const Gy=Xd,Uy=cg;Gy.workerSrc="//unpkg.com/pdfjs-dist@"+String(Uy)+"/legacy/build/pdf.worker.min.mjs";const{HORIZONTAL_GUTTER_SIZE_PX:Vu,OBSERVER_THRESHOLD_PERCENTAGE:Vy,PAGE_HEIGHT:ih,PDF_HEADER_SIZE_PX:Xy,PDF_SIDEBAR_SIZE_PX:qy,PDF_WIDTH_PERCENTAGE:Yy,VERTICAL_GUTTER_SIZE_PX:nh}=$y,Ky=({file:l,pageNumber:t,style:e,scale:s,listWidth:i,setPageInView:n})=>{var r;const{pdfFocusState:o}=Qu(),[c,h]=P.useState(!1),[d,u]=P.useState(!1),{ref:f,inView:p}=sm({threshold:Vy*Math.min(1/s,1)}),b=P.useRef(null),g=P.useCallback(T=>{b.current=T,f(T)},[f]);P.useEffect(()=>{p&&n(t)},[p,t,n,f]);const _=P.useCallback(()=>{if(b.current){const T=b.current.querySelector("canvas");T&&(T.style.visibility="hidden")}},[b]),y=P.useCallback(()=>{if(b.current){const T=b.current.querySelector("canvas");T&&(T.style.visibility="visible")}},[b]),w=P.useCallback(()=>{_()},[_]),E=P.useCallback(()=>{y()},[y]),x=P.useCallback(T=>{y(),C(),i>T.width?h(!0):h(!1)},[y,i]),S=o.documentId===l.id;P.useEffect(()=>{C()},[S,p]);const C=P.useCallback(Kg(()=>{var T;S&&((T=o.citation)===null||T===void 0?void 0:T.pageNumber)===t+1&&!d&&(Ly(o.citation.snippet,t,o.citation.color),u(!0))},50),[(r=o.citation)===null||r===void 0?void 0:r.snippet,t,d]);return B.jsx("div",{ref:g,style:Object.assign(Object.assign({},e),{padding:"10px",backgroundColor:"WhiteSmoke",display:`${c?"flex":""}`,justifyContent:"center"}),children:B.jsx(Fv,{scale:s,onRenderSuccess:x,onLoadSuccess:w,onRenderError:E,pageIndex:t,renderAnnotationLayer:!0})},`${l.url}-${t}`)},Zy=P.forwardRef(({file:l,scale:t,setIndex:e,setScaleFit:s,setNumPages:i},n)=>{const r=Vg(),c=(Xg()||0)-Xy,h=Yy*.01*(r||0)-qy-Vu,[d,u]=P.useState(null),f=P.useRef(null);P.useEffect(()=>{f.current&&f.current.resetAfterIndex(0)},[t]);function p(_){u(_)}function b(){return(ih+nh)*t}P.useEffect(()=>{if(!d)return;function _(){return Wy(this,void 0,void 0,function*(){d&&(yield d.getPage(1).then(y=>{const E=y.getViewport({scale:1}).width,x=h/E;s(x)}))})}_().catch(()=>console.log("page load error")),i(d.numPages)},[d,i,s,h]),Yu.useImperativeHandle(n,()=>({scrollToPage:_=>{g({pageNumber:_})}}));const g=({pageNumber:_})=>{const y=_*(ih+nh)*t;f.current&&f.current.scrollTo(y)};return B.jsx("div",{className:"pdfDocument",children:B.jsx(Ev,{onItemClick:g,file:l.url,onLoadSuccess:p,loading:"Loading...",children:d?B.jsx(Vv,{ref:f,width:h+Vu,height:c,itemCount:d.numPages,itemSize:b,estimatedItemSize:(ih+nh)*t,children:({index:_,style:y})=>B.jsx(Ky,{file:l,pageNumber:_,style:y,scale:t,listWidth:h,setPageInView:e},`page-${_}`)}):null},l.url)})}),Mg=P.memo(Zy);Mg.displayName="VirtualizedPDF";const Qy=l=>B.jsx("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},l,{children:B.jsx("path",{d:"m6 9 6 6 6-6"})})),Jy=l=>B.jsx("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},l,{children:B.jsx("path",{d:"m18 15-6-6-6 6"})})),t_=l=>B.jsxs("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},l,{children:[B.jsx("circle",{cx:"11",cy:"11",r:"8"}),B.jsx("line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65"}),B.jsx("line",{x1:"8",x2:"14",y1:"11",y2:"11"})]})),e_=l=>B.jsxs("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},l,{children:[B.jsx("circle",{cx:"11",cy:"11",r:"8"}),B.jsx("line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65"}),B.jsx("line",{x1:"11",x2:"11",y1:"8",y2:"14"}),B.jsx("line",{x1:"8",x2:"14",y1:"11",y2:"11"})]})),kg=({file:l,scrolledIndex:t,numPages:e,scaleText:s,nextPage:i,prevPage:n,handleZoomIn:r,handleZoomOut:o,goToPage:c,setZoomLevel:h,zoomInEnabled:d,zoomOutEnabled:u})=>{const[f,p]=P.useState(`${t+1}`);P.useEffect(()=>{p(`${t+1}`)},[t]);const b=w=>{h(w)},g=w=>{p(w.target.value)},_=w=>{if(w.key==="Enter"){const E=parseInt(f,10);!isNaN(E)&&E>0&&y(E-1)}},y=w=>{c(w)};return B.jsxs("div",{className:"optionBar",children:[B.jsxs("div",{className:"title truncate",children:["File ID: ",l.id]}),B.jsxs("div",{className:"control",children:[B.jsxs("div",{className:"pageControl",children:[B.jsx("button",{className:"pageUp",onClick:n,disabled:t===0,children:B.jsx(Jy,{})}),B.jsx("input",{className:"pageInput",value:f,onChange:g,onKeyDown:_}),B.jsx("button",{className:"pageDown",onClick:i,disabled:t===e-1,children:B.jsx(Qy,{})})]}),B.jsxs("div",{className:"zoomControl",children:[B.jsx("button",{className:"zoomOut",onClick:o,disabled:!u,children:B.jsx(t_,{})}),B.jsx("select",{className:"zoomSelect",value:s,onChange:w=>b(w.target.value),children:pr.map((w,E)=>B.jsx("option",{value:w,children:w},E))}),B.jsx("button",{className:"zoomIn",onClick:r,disabled:!d,children:B.jsx(e_,{})})]})]})]})};kg.displayName="PDFOptionsBar";const u_=({file:l,hideOptionBar:t,containerClassName:e})=>{const{scrolledIndex:s,setCurrentPageNumber:i,scale:n,setScaleFit:r,numPages:o,setNumPages:c,handleZoomIn:h,handleZoomOut:d,nextPage:u,prevPage:f,scaleText:p,pdfFocusRef:b,goToPage:g,setZoomLevel:_,zoomInEnabled:y,zoomOutEnabled:w}=Ug(l);return B.jsxs("div",{className:bl("pdf-viewer-container",e),children:[!t&&B.jsx(kg,{file:l,scrolledIndex:s,numPages:o,scaleText:p,nextPage:u,prevPage:f,handleZoomIn:h,handleZoomOut:d,goToPage:g,setZoomLevel:_,zoomInEnabled:y,zoomOutEnabled:w}),B.jsx(Mg,{ref:b,file:l,setIndex:i,scale:n,setScaleFit:r,setNumPages:c},`${l.id}`)]})};export{Mg as MemoizedVirtualizedPDF,kg as PDFOptionsBar,u_ as PDFViewer,c_ as PdfFocusProvider};
|