aitu-app 0.5.14 → 0.5.15
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.
Potentially problematic release.
This version of aitu-app might be problematic. Click here for more details.
- package/README.md +3 -2
- package/assets/{ChatMessagesArea-CkUX81uB.js → ChatMessagesArea-CJPMwgOQ.js} +3 -3
- package/assets/{ToolboxDrawer-By1XMh8B.js → ToolboxDrawer-BZkRey45.js} +1 -1
- package/assets/{ai-analyze-Db-iXol6.js → ai-analyze-CKKkojLn.js} +1 -1
- package/assets/{arc-ajYHRRnk.js → arc-DpZjyIR9.js} +1 -1
- package/assets/{arc-BZXVqUcI.js → arc-amy12ZHI.js} +1 -1
- package/assets/{batch-image-generation-Baqb01Lm.js → batch-image-generation-CqSButZp.js} +1 -1
- package/assets/{blockDiagram-38ab4fdb-BT3H_WVv.js → blockDiagram-38ab4fdb-Bb_sM5Hm.js} +1 -1
- package/assets/{blockDiagram-38ab4fdb-u0xYP3Lt.js → blockDiagram-38ab4fdb-DO5SLxgD.js} +1 -1
- package/assets/{c4Diagram-3d4e48cf-CBvM6zjM.js → c4Diagram-3d4e48cf-D1hzTotE.js} +1 -1
- package/assets/{c4Diagram-3d4e48cf-WOIEVidH.js → c4Diagram-3d4e48cf-IYlxbdWH.js} +1 -1
- package/assets/channel-DuH6cax_.js +1 -0
- package/assets/channel-V941kNNl.js +1 -0
- package/assets/{classDiagram-70f12bd4-Cl9U1r5F.js → classDiagram-70f12bd4-CMCkiBrF.js} +1 -1
- package/assets/{classDiagram-70f12bd4-BMutcvFi.js → classDiagram-70f12bd4-C_DG-_VE.js} +1 -1
- package/assets/{classDiagram-v2-f2320105-C0agtbR4.js → classDiagram-v2-f2320105-DdbTRsFm.js} +1 -1
- package/assets/{classDiagram-v2-f2320105-tCBzATK6.js → classDiagram-v2-f2320105-Y5yPoT7w.js} +1 -1
- package/assets/clone-BoLnjeh7.js +1 -0
- package/assets/clone-DufRhyQM.js +1 -0
- package/assets/{createText-2e5e7dd3-CZ9_fscE.js → createText-2e5e7dd3-DWMoiN14.js} +1 -1
- package/assets/{createText-2e5e7dd3-idrqgJjU.js → createText-2e5e7dd3-Q_TpnKHS.js} +1 -1
- package/assets/{edges-e0da2a9e-C-RyePMV.js → edges-e0da2a9e-Br_hn5Hn.js} +1 -1
- package/assets/{edges-e0da2a9e-DJXAjJSL.js → edges-e0da2a9e-DMfYzMhl.js} +1 -1
- package/assets/{erDiagram-9861fffd-x2Kcy95-.js → erDiagram-9861fffd-8s6fny9G.js} +1 -1
- package/assets/{erDiagram-9861fffd-DWJR_3zL.js → erDiagram-9861fffd-CslzjwB2.js} +1 -1
- package/assets/{flowDb-956e92f1-CF6y18Tn.js → flowDb-956e92f1-BsxQxnaW.js} +1 -1
- package/assets/{flowDb-956e92f1-BgKjOIdz.js → flowDb-956e92f1-Bsz7tEUu.js} +1 -1
- package/assets/{flowDiagram-66a62f08-CSAllSFf.js → flowDiagram-66a62f08-C0iQ7Eg0.js} +1 -1
- package/assets/{flowDiagram-66a62f08-BPPw0wPU.js → flowDiagram-66a62f08-DLXaK0x0.js} +1 -1
- package/assets/flowDiagram-v2-96b9c2cf-Be_fSVIi.js +1 -0
- package/assets/flowDiagram-v2-96b9c2cf-C-_-kXrI.js +1 -0
- package/assets/{flowchart-elk-definition-4a651766-DWFN9DN3.js → flowchart-elk-definition-4a651766-2JQap1Bs.js} +1 -1
- package/assets/{flowchart-elk-definition-4a651766-9XSRJbsr.js → flowchart-elk-definition-4a651766-UQLaW6cl.js} +1 -1
- package/assets/{ganttDiagram-c361ad54-D9tbz9tQ.js → ganttDiagram-c361ad54-Cfdrec1H.js} +1 -1
- package/assets/{ganttDiagram-c361ad54-ot5pUYpT.js → ganttDiagram-c361ad54-hShkYpY_.js} +1 -1
- package/assets/{gitGraphDiagram-72cf32ee-C6qFzgGh.js → gitGraphDiagram-72cf32ee-CJw4loHZ.js} +1 -1
- package/assets/{gitGraphDiagram-72cf32ee-BFV3Mt8C.js → gitGraphDiagram-72cf32ee-D6obWSUI.js} +1 -1
- package/assets/{graph-BxwlF7JS.js → graph-CUK2kA3Q.js} +1 -1
- package/assets/{graph-D-2Ldvxg.js → graph-DvHs9g2k.js} +1 -1
- package/assets/{grid-image-cM9AmYC8.js → grid-image-DioDaenp.js} +1 -1
- package/assets/{has-CgdIPiQG.js → has-C9yYx3eK.js} +1 -1
- package/assets/{hasIn-4iY02rGN.js → hasIn-DZErb2GY.js} +1 -1
- package/assets/{index-3862675e-CVZnpwDN.js → index-3862675e-CmpgM8FI.js} +1 -1
- package/assets/{index-3862675e-DqdI9cab.js → index-3862675e-DIpatAx8.js} +1 -1
- package/assets/{index-DBWqXBIQ.js → index-6dh_xpWk.js} +1 -1
- package/assets/{index-DWUAFoZG.js → index-BBCAc4Al.js} +9 -9
- package/assets/{index-BicRPzXC.js → index-BENzx6Jm.js} +1 -1
- package/assets/{index-BwSGXyRr.js → index-CMnHM-d8.js} +4 -4
- package/assets/{index-e05Rs4M6.js → index-D6IbVyW6.js} +1 -1
- package/assets/{index-CkpXFt8n.js → index-DDjAsbde.js} +1 -1
- package/assets/{index-Dn0YtZ2R.js → index-Dg-P8uA3.js} +1 -1
- package/assets/{index-CrxF9gFe.js → index-JzVvCLEO.js} +1 -1
- package/assets/{infoDiagram-f8f76790-FKC1Sy9Y.js → infoDiagram-f8f76790-DVba3P4U.js} +1 -1
- package/assets/{infoDiagram-f8f76790-CnrpwoOt.js → infoDiagram-f8f76790-n-jV57cF.js} +1 -1
- package/assets/{inspiration-board-B_-BBBHt.js → inspiration-board--PQTKq9U.js} +1 -1
- package/assets/{isEmpty-Dj2GV0v-.js → isEmpty-CRiX5iwN.js} +1 -1
- package/assets/{journeyDiagram-49397b02-B7fP21sU.js → journeyDiagram-49397b02-DxSFNQYs.js} +1 -1
- package/assets/{journeyDiagram-49397b02-Dp3X9XWq.js → journeyDiagram-49397b02-WGL-3jNv.js} +1 -1
- package/assets/{layout-BD3yCK_X.js → layout-25V5jGUW.js} +1 -1
- package/assets/{layout-DHHYqX7p.js → layout-CawIP_cF.js} +1 -1
- package/assets/{line-B3bNrkzn.js → line-D5ZQcCU6.js} +1 -1
- package/assets/{line-B86HLuqu.js → line-DuKdCx_E.js} +1 -1
- package/assets/{linear-wCAlMhOS.js → linear-3V_n7zlW.js} +1 -1
- package/assets/{linear-DU2Ciymb.js → linear-BlVhwFrV.js} +1 -1
- package/assets/{mermaid.core-DfVvnpgz.js → mermaid.core--Np12uGY.js} +4 -4
- package/assets/{mindmap-definition-fc14e90a-D1sxE3xG.js → mindmap-definition-fc14e90a-C96nL64E.js} +1 -1
- package/assets/{mindmap-definition-fc14e90a-YuSOJC7P.js → mindmap-definition-fc14e90a-UZifAYnn.js} +1 -1
- package/assets/{photo-wall-splitter-BVU2e0aS.js → photo-wall-splitter-DZyQuDUg.js} +1 -1
- package/assets/{pick-Cvlwra4g.js → pick-B51S9oWq.js} +1 -1
- package/assets/{pieDiagram-8a3498a8-B6mJUqro.js → pieDiagram-8a3498a8-B_UU-v6b.js} +1 -1
- package/assets/{pieDiagram-8a3498a8-B91bWgo_.js → pieDiagram-8a3498a8-DXEMg8-z.js} +1 -1
- package/assets/{quadrantDiagram-120e2f19-BxS8fQEz.js → quadrantDiagram-120e2f19-BpCIEZWH.js} +1 -1
- package/assets/{quadrantDiagram-120e2f19-DwudONqx.js → quadrantDiagram-120e2f19-THiHerb8.js} +1 -1
- package/assets/{requirementDiagram-deff3bca-DygaMIoy.js → requirementDiagram-deff3bca-BLEvJckC.js} +1 -1
- package/assets/{requirementDiagram-deff3bca-v9xlgfS8.js → requirementDiagram-deff3bca-qJ4hHh6O.js} +1 -1
- package/assets/{sankeyDiagram-04a897e0-BXCiXiyw.js → sankeyDiagram-04a897e0-C5moR6iD.js} +1 -1
- package/assets/{sankeyDiagram-04a897e0-BV23dp4l.js → sankeyDiagram-04a897e0-Clk-gmpQ.js} +1 -1
- package/assets/{sequenceDiagram-704730f1-CObRpNi4.js → sequenceDiagram-704730f1-Ch9GmBP7.js} +1 -1
- package/assets/{sequenceDiagram-704730f1-Ck69A6wI.js → sequenceDiagram-704730f1-DRHB_a_K.js} +1 -1
- package/assets/{settings-dialog-BlCO49C4.js → settings-dialog-Cgmye4jO.js} +1 -1
- package/assets/{stateDiagram-587899a1-J_G6I0oo.js → stateDiagram-587899a1-Bu42pkUv.js} +1 -1
- package/assets/{stateDiagram-587899a1-z-tKclr3.js → stateDiagram-587899a1-bnuzZWVC.js} +1 -1
- package/assets/{stateDiagram-v2-d93cdb3a-DsThtOzP.js → stateDiagram-v2-d93cdb3a-3bX_yI1j.js} +1 -1
- package/assets/{stateDiagram-v2-d93cdb3a-XIvq5t8a.js → stateDiagram-v2-d93cdb3a-DLzO3ON3.js} +1 -1
- package/assets/{styles-6aaf32cf-1fjuNMUk.js → styles-6aaf32cf-CyzTJ9FB.js} +1 -1
- package/assets/{styles-6aaf32cf-DT2rVNfQ.js → styles-6aaf32cf-qL7GgrGp.js} +1 -1
- package/assets/{styles-9a916d00-fLeUSina.js → styles-9a916d00-DYu1WXui.js} +1 -1
- package/assets/{styles-9a916d00-q64Umkis.js → styles-9a916d00-Dv_u24Fv.js} +1 -1
- package/assets/{styles-c10674c1-CtYpjMYU.js → styles-c10674c1-C8mVn82x.js} +1 -1
- package/assets/{styles-c10674c1-BWlxVc3Q.js → styles-c10674c1-CBAvChyC.js} +1 -1
- package/assets/{svgDrawCommon-08f97a94-C_DhKfny.js → svgDrawCommon-08f97a94-Cma2KGuK.js} +1 -1
- package/assets/{svgDrawCommon-08f97a94-DSBqmUv2.js → svgDrawCommon-08f97a94-p3hABH7b.js} +1 -1
- package/assets/{timeline-definition-85554ec2-dTkYwoLF.js → timeline-definition-85554ec2-SwmuytFv.js} +1 -1
- package/assets/{timeline-definition-85554ec2-AKpzwLPN.js → timeline-definition-85554ec2-XppLsb9g.js} +1 -1
- package/assets/{ttd-dialog-CxiaIUuJ.js → ttd-dialog-DeYFjfFN.js} +5 -5
- package/assets/{upload-4sxUU7q_.js → upload-B0RQ9yYL.js} +1 -1
- package/assets/{video-recovery-service-BckHbSyK.js → video-recovery-service-XnlUYAOr.js} +1 -1
- package/assets/{xychartDiagram-e933f94c-DCmvL0ag.js → xychartDiagram-e933f94c-C8xFRDll.js} +1 -1
- package/assets/{xychartDiagram-e933f94c-aqOiXp_u.js → xychartDiagram-e933f94c-CedgK1zZ.js} +1 -1
- package/index.html +2 -2
- package/package.json +1 -1
- package/sw.js +1 -1
- package/version.json +3 -7
- package/versions.html +374 -0
- package/assets/channel-BP25wTsw.js +0 -1
- package/assets/channel-HzrLNFUg.js +0 -1
- package/assets/clone-B69pF7Y_.js +0 -1
- package/assets/clone-oX7o-l4R.js +0 -1
- package/assets/flowDiagram-v2-96b9c2cf-B-UGyXRi.js +0 -1
- package/assets/flowDiagram-v2-96b9c2cf-Cm596kxZ.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
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
|
|
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-BBCAc4Al.js";import{c as bl,_ as $g}from"./ChatMessagesArea-CJPMwgOQ.js";import"./index-DI_5V2-m.js";import"./index.dom-C3-224fz.js";import"./katex-Cu_Erd72.js";import"./index-BENzx6Jm.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
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
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
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,`
|