showai-reader 0.9.0 → 0.10.0-reader.uevm5c4a
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/chunks/CardGrid-B5ZPO2BI.js +2 -0
- package/chunks/CommandReference-HHKCV753.js +3 -0
- package/chunks/ComparisonMatrix-RIUGQRNA.js +1 -0
- package/chunks/EventTimeline-AEWZDJSH.js +2 -0
- package/chunks/ExperimentTracker-W2H5ZDFY.js +1 -0
- package/chunks/{ExternalDiagram-3BONLRGZ.js → ExternalDiagram-SIOOYLR7.js} +7924 -4810
- package/chunks/Flowchart-6ZTZQZXC.js +12 -0
- package/chunks/{G2Chart-GQH7Q6PL.js → G2Chart-CWQQA4ZV.js} +2 -2
- package/chunks/LayerDiagram-GTULFZZP.js +2 -0
- package/chunks/{Mindmap-UMIFB7CR.js → Mindmap-7GTBDPMC.js} +2 -2
- package/chunks/RichTextEditor-PNTZXV2D.js +155 -0
- package/chunks/Roadmap-7TFBP7BZ.js +2 -0
- package/chunks/{Scene3D-J7TCRL6V.js → Scene3D-YUDPPF42.js} +2 -2
- package/chunks/SequenceDiagram-RWUR35XN.js +2 -0
- package/chunks/StatusTree-VXXL53J4.js +1 -0
- package/chunks/StepGuide-GJ3LBGVS.js +1 -0
- package/chunks/StructureBrowser-LXVTJ4CR.js +3 -0
- package/chunks/Waterfall-T4FNP6RH.js +2 -0
- package/chunks/chunk-2CCUVSMI.js +1 -0
- package/chunks/chunk-2YDDS4TW.js +1 -0
- package/chunks/{chunk-MPVTJQTD.js → chunk-36N4B6F4.js} +2 -2
- package/chunks/chunk-3RZMLHCB.js +1 -0
- package/chunks/{chunk-WDYURK6F.js → chunk-5AW2WUSZ.js} +1 -1
- package/chunks/chunk-7G6RMB6W.js +5 -0
- package/chunks/chunk-AIBH6MTQ.js +1 -0
- package/chunks/chunk-DCANE7XH.js +1 -0
- package/chunks/chunk-DVIFPZLZ.js +2 -0
- package/chunks/chunk-GLP5VV7P.js +1 -0
- package/chunks/chunk-IBO6QHGV.js +4 -0
- package/chunks/chunk-J6IRWTF7.js +1 -0
- package/chunks/chunk-JXKAISUX.js +1 -0
- package/chunks/{chunk-CEJFAFXK.js → chunk-LSZMAKEI.js} +43 -40
- package/chunks/chunk-LWAPR3HQ.js +1 -0
- package/chunks/{chunk-LY26FKQZ.js → chunk-MENLQ7WW.js} +1 -1
- package/chunks/chunk-MGSP3OGB.js +9 -0
- package/chunks/chunk-N2G7RUAJ.js +1 -0
- package/chunks/{chunk-SWLYSV5D.js → chunk-P2CMIXOU.js} +1 -1
- package/chunks/chunk-S4EP5SMX.js +21 -0
- package/chunks/{chunk-4QSHXFHM.js.LEGAL.txt → chunk-S4EP5SMX.js.LEGAL.txt} +24 -8
- package/chunks/{chunk-7GHGKKPY.js → chunk-SNEZ3O5V.js} +1 -1
- package/chunks/{chunk-LAAA5HWB.js → chunk-VRAMSIGC.js} +1 -1
- package/chunks/chunk-XI4I5HQF.js +1 -0
- package/chunks/code-highlighting-F3WJZEML.js +1 -0
- package/chunks/{pdf-engine-PQMJ3BVE.js → pdf-engine-XQHKQXXX.js} +1 -1
- package/index.js +1 -1
- package/manifest.json +6 -5
- package/package.json +1 -1
- package/reader-UEVM5C4A.js +46 -0
- package/chunks/ComparisonMatrix-SYFIP5WP.js +0 -1
- package/chunks/ExperimentTracker-HOUNXCEC.js +0 -1
- package/chunks/Flowchart-72CIZ5IT.js +0 -10
- package/chunks/RichTextEditor-YMFOBGOU.js +0 -155
- package/chunks/StatusTree-MDKGDYK5.js +0 -1
- package/chunks/chunk-4QSHXFHM.js +0 -21
- package/chunks/chunk-6WHB3GS2.js +0 -2
- package/chunks/chunk-DUIGVKKG.js +0 -1
- package/chunks/chunk-M3KEZP5Z.js +0 -1
- package/chunks/chunk-QSELZI5S.js +0 -1
- package/chunks/chunk-YSVZKKKM.js +0 -1
- package/reader-N3YKYCK3.js +0 -40
- /package/chunks/{Flowchart-72CIZ5IT.js.LEGAL.txt → Flowchart-6ZTZQZXC.js.LEGAL.txt} +0 -0
- /package/chunks/{G2Chart-GQH7Q6PL.js.LEGAL.txt → G2Chart-CWQQA4ZV.js.LEGAL.txt} +0 -0
- /package/chunks/{Scene3D-J7TCRL6V.js.LEGAL.txt → Scene3D-YUDPPF42.js.LEGAL.txt} +0 -0
- /package/chunks/{chunk-MPVTJQTD.js.LEGAL.txt → chunk-36N4B6F4.js.LEGAL.txt} +0 -0
- /package/{reader-N3YKYCK3.js.LEGAL.txt → reader-UEVM5C4A.js.LEGAL.txt} +0 -0
|
@@ -47,13 +47,12 @@ lucide-react/dist/esm/Icon.mjs:
|
|
|
47
47
|
lucide-react/dist/esm/createLucideIcon.mjs:
|
|
48
48
|
lucide-react/dist/esm/icons/arrow-down.mjs:
|
|
49
49
|
lucide-react/dist/esm/icons/arrow-up.mjs:
|
|
50
|
-
lucide-react/dist/esm/icons/bold.mjs:
|
|
51
50
|
lucide-react/dist/esm/icons/chart-column.mjs:
|
|
52
51
|
lucide-react/dist/esm/icons/check.mjs:
|
|
53
52
|
lucide-react/dist/esm/icons/chevron-down.mjs:
|
|
54
53
|
lucide-react/dist/esm/icons/chevron-right.mjs:
|
|
54
|
+
lucide-react/dist/esm/icons/chevron-left.mjs:
|
|
55
55
|
lucide-react/dist/esm/icons/code-xml.mjs:
|
|
56
|
-
lucide-react/dist/esm/icons/code.mjs:
|
|
57
56
|
lucide-react/dist/esm/icons/copy.mjs:
|
|
58
57
|
lucide-react/dist/esm/icons/download.mjs:
|
|
59
58
|
lucide-react/dist/esm/icons/expand.mjs:
|
|
@@ -62,9 +61,7 @@ lucide-react/dist/esm/icons/grip-vertical.mjs:
|
|
|
62
61
|
lucide-react/dist/esm/icons/heading-1.mjs:
|
|
63
62
|
lucide-react/dist/esm/icons/heading-2.mjs:
|
|
64
63
|
lucide-react/dist/esm/icons/heading-3.mjs:
|
|
65
|
-
lucide-react/dist/esm/icons/highlighter.mjs:
|
|
66
64
|
lucide-react/dist/esm/icons/image-plus.mjs:
|
|
67
|
-
lucide-react/dist/esm/icons/italic.mjs:
|
|
68
65
|
lucide-react/dist/esm/icons/link-2.mjs:
|
|
69
66
|
lucide-react/dist/esm/icons/list-ordered.mjs:
|
|
70
67
|
lucide-react/dist/esm/icons/list-tree.mjs:
|
|
@@ -79,28 +76,39 @@ lucide-react/dist/esm/icons/plus.mjs:
|
|
|
79
76
|
lucide-react/dist/esm/icons/quote.mjs:
|
|
80
77
|
lucide-react/dist/esm/icons/redo-2.mjs:
|
|
81
78
|
lucide-react/dist/esm/icons/rotate-ccw.mjs:
|
|
79
|
+
lucide-react/dist/esm/icons/sparkles.mjs:
|
|
82
80
|
lucide-react/dist/esm/icons/square-check-big.mjs:
|
|
83
81
|
lucide-react/dist/esm/icons/square.mjs:
|
|
84
|
-
lucide-react/dist/esm/icons/strikethrough.mjs:
|
|
85
82
|
lucide-react/dist/esm/icons/table-2.mjs:
|
|
86
83
|
lucide-react/dist/esm/icons/text-align-center.mjs:
|
|
87
84
|
lucide-react/dist/esm/icons/text-align-end.mjs:
|
|
88
85
|
lucide-react/dist/esm/icons/text-align-start.mjs:
|
|
89
86
|
lucide-react/dist/esm/icons/trash.mjs:
|
|
90
87
|
lucide-react/dist/esm/icons/type.mjs:
|
|
91
|
-
lucide-react/dist/esm/icons/underline.mjs:
|
|
92
88
|
lucide-react/dist/esm/icons/undo-2.mjs:
|
|
93
89
|
lucide-react/dist/esm/icons/upload.mjs:
|
|
94
90
|
lucide-react/dist/esm/icons/x.mjs:
|
|
91
|
+
lucide-react/dist/esm/icons/align-center-horizontal.mjs:
|
|
92
|
+
lucide-react/dist/esm/icons/align-center-vertical.mjs:
|
|
93
|
+
lucide-react/dist/esm/icons/align-end-horizontal.mjs:
|
|
94
|
+
lucide-react/dist/esm/icons/align-end-vertical.mjs:
|
|
95
|
+
lucide-react/dist/esm/icons/align-horizontal-distribute-center.mjs:
|
|
96
|
+
lucide-react/dist/esm/icons/align-start-horizontal.mjs:
|
|
97
|
+
lucide-react/dist/esm/icons/align-start-vertical.mjs:
|
|
98
|
+
lucide-react/dist/esm/icons/align-vertical-distribute-center.mjs:
|
|
95
99
|
lucide-react/dist/esm/icons/arrow-down-right.mjs:
|
|
96
100
|
lucide-react/dist/esm/icons/arrow-left.mjs:
|
|
97
101
|
lucide-react/dist/esm/icons/arrow-up-right.mjs:
|
|
102
|
+
lucide-react/dist/esm/icons/bold.mjs:
|
|
98
103
|
lucide-react/dist/esm/icons/book-open.mjs:
|
|
99
104
|
lucide-react/dist/esm/icons/bookmark-plus.mjs:
|
|
100
105
|
lucide-react/dist/esm/icons/bookmark.mjs:
|
|
106
|
+
lucide-react/dist/esm/icons/bring-to-front.mjs:
|
|
101
107
|
lucide-react/dist/esm/icons/chart-no-axes-combined.mjs:
|
|
102
|
-
lucide-react/dist/esm/icons/chevron-
|
|
108
|
+
lucide-react/dist/esm/icons/chevron-up.mjs:
|
|
103
109
|
lucide-react/dist/esm/icons/circle.mjs:
|
|
110
|
+
lucide-react/dist/esm/icons/clipboard.mjs:
|
|
111
|
+
lucide-react/dist/esm/icons/code.mjs:
|
|
104
112
|
lucide-react/dist/esm/icons/columns-3.mjs:
|
|
105
113
|
lucide-react/dist/esm/icons/database.mjs:
|
|
106
114
|
lucide-react/dist/esm/icons/ellipsis.mjs:
|
|
@@ -115,31 +123,39 @@ lucide-react/dist/esm/icons/funnel.mjs:
|
|
|
115
123
|
lucide-react/dist/esm/icons/gauge.mjs:
|
|
116
124
|
lucide-react/dist/esm/icons/grip-horizontal.mjs:
|
|
117
125
|
lucide-react/dist/esm/icons/hand.mjs:
|
|
126
|
+
lucide-react/dist/esm/icons/highlighter.mjs:
|
|
118
127
|
lucide-react/dist/esm/icons/images.mjs:
|
|
128
|
+
lucide-react/dist/esm/icons/italic.mjs:
|
|
119
129
|
lucide-react/dist/esm/icons/lasso.mjs:
|
|
120
130
|
lucide-react/dist/esm/icons/layout-dashboard.mjs:
|
|
121
131
|
lucide-react/dist/esm/icons/layout-list.mjs:
|
|
122
132
|
lucide-react/dist/esm/icons/lock-keyhole-open.mjs:
|
|
123
133
|
lucide-react/dist/esm/icons/lock-keyhole.mjs:
|
|
134
|
+
lucide-react/dist/esm/icons/map.mjs:
|
|
124
135
|
lucide-react/dist/esm/icons/moon.mjs:
|
|
125
136
|
lucide-react/dist/esm/icons/mouse-pointer-2.mjs:
|
|
126
137
|
lucide-react/dist/esm/icons/music-2.mjs:
|
|
127
|
-
lucide-react/dist/esm/icons/panels-top-left.mjs:
|
|
128
138
|
lucide-react/dist/esm/icons/pencil.mjs:
|
|
129
139
|
lucide-react/dist/esm/icons/pin.mjs:
|
|
130
140
|
lucide-react/dist/esm/icons/printer.mjs:
|
|
131
141
|
lucide-react/dist/esm/icons/puzzle.mjs:
|
|
132
142
|
lucide-react/dist/esm/icons/ruler.mjs:
|
|
143
|
+
lucide-react/dist/esm/icons/scissors.mjs:
|
|
133
144
|
lucide-react/dist/esm/icons/search.mjs:
|
|
145
|
+
lucide-react/dist/esm/icons/send-to-back.mjs:
|
|
134
146
|
lucide-react/dist/esm/icons/settings-2.mjs:
|
|
135
147
|
lucide-react/dist/esm/icons/square-dashed.mjs:
|
|
136
148
|
lucide-react/dist/esm/icons/star.mjs:
|
|
149
|
+
lucide-react/dist/esm/icons/strikethrough.mjs:
|
|
137
150
|
lucide-react/dist/esm/icons/sun.mjs:
|
|
138
151
|
lucide-react/dist/esm/icons/table-cells-merge.mjs:
|
|
139
152
|
lucide-react/dist/esm/icons/table-columns-split.mjs:
|
|
140
153
|
lucide-react/dist/esm/icons/table-cells-split.mjs:
|
|
141
154
|
lucide-react/dist/esm/icons/table-properties.mjs:
|
|
142
155
|
lucide-react/dist/esm/icons/table-rows-split.mjs:
|
|
156
|
+
lucide-react/dist/esm/icons/text-align-justify.mjs:
|
|
157
|
+
lucide-react/dist/esm/icons/underline.mjs:
|
|
158
|
+
lucide-react/dist/esm/icons/ungroup.mjs:
|
|
143
159
|
lucide-react/dist/esm/icons/video.mjs:
|
|
144
160
|
lucide-react/dist/esm/lucide-react.mjs:
|
|
145
161
|
/**
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as h}from"./chunk-
|
|
1
|
+
import{a as h}from"./chunk-5AW2WUSZ.js";import{c as d,f as g}from"./chunk-J6IRWTF7.js";var a=g(h),D=["#120a8f","#5147b8","#8179c2","#4674af","#6b78a8","#898892"],C=(e,r="")=>typeof e=="string"||typeof e=="number"?String(e):r,S=(e,r=0)=>typeof e=="number"&&Number.isFinite(e)?e:r,x=()=>globalThis.crypto?.randomUUID?.()??`row-${Date.now()}-${Math.random().toString(36).slice(2)}`;function w(e){if(typeof e=="string"&&!/^[\u0000-\u0020]|[\u0000-\u001f]/.test(e))try{let r=new URL(e);return["http:","https:"].includes(r.protocol)?r.href:void 0}catch{return}}function L(e){if(typeof e=="string")return/^data:image\/(?:png|jpeg|gif|webp|avif);base64,[a-z\d+/=\s]+$/i.test(e)?e:w(e)}function R(e){let r=JSON.parse(e);if(!r||typeof r!="object")throw new Error(a("chartData.notObject"));let{labels:o,series:n}=r;if(!Array.isArray(o)||!o.every(t=>typeof t=="string"))throw new Error(a("chartData.labels"));if(!Array.isArray(n))throw new Error(a("chartData.series"));if(o.length>500||n.length>20)throw new Error(a("chartData.tooLarge"));for(let t of n){if(!t||typeof t.name!="string"||!Array.isArray(t.values))throw new Error(a("chartData.seriesShape"));if(t.values.length!==o.length)throw new Error(a("chartData.length",{name:t.name}));if(!t.values.every(i=>typeof i=="number"&&Number.isFinite(i)))throw new Error(a("chartData.finite",{name:t.name}));if(t.color!==void 0&&(typeof t.color!="string"||!/^#(?:[a-f\d]{3}|[a-f\d]{4}|[a-f\d]{6}|[a-f\d]{8})$/i.test(t.color)))throw new Error(a("chartData.color",{name:t.name}))}return{labels:o,series:n}}function k(e,r,o,n,t){let i=o.trim().toLocaleLowerCase(),l=e.filter(s=>(!i||r.some(c=>String(s[c.id]??"").toLocaleLowerCase().includes(i)))&&(!n.column||String(s[n.column]??"")===n.value));if(!t)return l;let m=r.find(s=>s.id===t.column);return l.sort((s,c)=>{let u=s[t.column]??"",f=c[t.column]??"",p=m?.type==="number"?Number(u)-Number(f):m?.type==="checkbox"?+!!u-+!!f:String(u).localeCompare(String(f),d(),{numeric:!0});return t.direction==="asc"?p:-p})}function E(e,r){let o=n=>{let t=String(n??"");return`"${(/^[\s]*[=+@-]|^[\t\r\n]/.test(t)&&!/^-?\d+(\.\d+)?$/.test(t)?`'${t}`:t).replaceAll('"','""')}"`};return"\uFEFF"+[e.map(n=>o(n.name)).join(","),...r.map(n=>e.map(t=>o(n[t.id])).join(","))].join(`\r
|
|
2
2
|
`)}function U(e,r,o){let n=URL.createObjectURL(new Blob([e],{type:o})),t=document.createElement("a");t.href=n,t.download=r,t.click(),setTimeout(()=>URL.revokeObjectURL(n),1e3)}export{D as a,C as b,S as c,x as d,w as e,L as f,R as g,k as h,E as i,U as j};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as h}from"./chunk-
|
|
1
|
+
import{a as h}from"./chunk-5AW2WUSZ.js";import{a as y,c as $,hb as E,kb as K,la as x,ma as L}from"./chunk-S4EP5SMX.js";import{f as S}from"./chunk-J6IRWTF7.js";import{c as f}from"./chunk-DCANE7XH.js";var i=f($(),1);y(`.viewport-lock-button{position:absolute;top:8px;right:8px;z-index:30;display:grid;place-items:center;width:30px;height:30px;padding:0;border:1px solid var(--sb-line, var(--line, #e9ece5));border-radius:6px;background:var(--sb-surface, var(--paper, #fff));color:var(--sb-muted, var(--muted, #92968f));cursor:pointer}.viewport-lock-button[aria-pressed=false]{color:var(--accent, #120a8f)}.viewport-lock-button:hover{background:var(--sb-hover, var(--hover, #f0f2ed))}.viewport-lock-button:focus-visible{outline:2px solid var(--accent, #120a8f);outline-offset:2px}.viewport-lock-error{display:none;position:absolute;top:100%;right:0;width:220px;padding:8px;background:var(--paper, #fff);color:var(--text, #343a35);font-size:11px}.viewport-lock-button:hover .viewport-lock-error,.viewport-lock-button:focus-visible .viewport-lock-error{display:block}[data-viewport-locked=true]>.surface-scroll{touch-action:pan-y;overscroll-behavior:auto}.sf-block[data-viewport-locked=true] .react-flow__pane,.sf-block[data-viewport-locked=true] .react-flow__node{touch-action:pan-y;cursor:auto}.sb-header:has(~.viewport-lock-button){right:42px}.sb-header.has-caption:has(~.viewport-lock-button){right:auto;padding-right:42px}.sb-header.has-caption:has(~.viewport-lock-button)>.sb-actions{right:42px}.sb-g2-chart:has(>.viewport-lock-button)>.sb-g2-toolbar{padding-right:42px}@media print{.viewport-lock-button{display:none!important}}
|
|
2
2
|
`);var l=f(E(),1),M=S(h);function z(e,n){let r=e.closest("[data-block-id], [data-surface-id]");return`showai.viewport-lock.v1:${r?.getAttribute("data-block-id")||r?.getAttribute("data-surface-id")||location.pathname}:${n}`}function V(e){return localStorage.getItem(e)!=="unlocked"}function _(e,n){localStorage.setItem(e,n?"locked":"unlocked")}function O(e,n){let r=(0,i.useRef)(null),c=(0,i.useRef)(""),p=(0,i.useRef)(null),[s,d]=(0,i.useState)(!0),[D,g]=(0,i.useState)("");return(0,i.useLayoutEffect)(()=>{let o=r.current,T=[...(o.closest("[data-block-id], [data-surface-id]")||o.ownerDocument.body).querySelectorAll(`[data-viewport-lock-scope="${e}"]`)],w=`${e}:${T.indexOf(o)}`;c.current=n||z(o,w);let b=o.ownerDocument.getElementById("showai-component-data"),u=b?JSON.parse(b.textContent||"{}").channel:void 0;if(u&&window.parent!==window){p.current={channel:u,scope:w};let k=t=>{t.source!==parent||t.data?.channel!==u||t.data?.type!=="showai:viewport-lock-state"||t.data.scope!==w||(typeof t.data.locked=="boolean"&&d(t.data.locked),g(t.data.error||""))},m=t=>{if(o.dataset.viewportLocked==="true"){for(let a=t.target instanceof Element?t.target:null;a&&a!==o;a=a.parentElement){let Y=getComputedStyle(a);if(/auto|scroll/.test(Y.overflowY)&&(t.deltaY>0&&a.scrollTop+a.clientHeight<a.scrollHeight-1||t.deltaY<0&&a.scrollTop>0))return}t.preventDefault(),t.stopPropagation(),parent.postMessage({channel:u,type:"showai:reading-wheel",deltaX:t.deltaX,deltaY:t.deltaY,deltaMode:t.deltaMode,ctrlKey:t.ctrlKey,metaKey:t.metaKey,shiftKey:t.shiftKey},"*")}};return window.addEventListener("message",k),o.addEventListener("wheel",m,{capture:!0,passive:!1}),parent.postMessage({channel:u,type:"showai:viewport-lock-get",scope:w},"*"),()=>{window.removeEventListener("message",k),o.removeEventListener("wheel",m,!0)}}try{d(V(c.current))}catch(k){g(M("viewportLock.readFailed",{error:String(k)}))}},[e,n]),{ref:r,locked:s,toggle:()=>{let o=!s;if(p.current){parent.postMessage({...p.current,type:"showai:viewport-lock-set",locked:o},"*");return}try{_(c.current,o),g("")}catch(v){g(M("viewportLock.saveFailed",{error:String(v)}))}d(o)},error:D}}function X({locked:e,toggle:n,error:r="",label:c,unlockDescription:p}){let s=K(h),d=s(e?"viewportLock.unlock":"viewportLock.lock",{target:c});return(0,l.jsxs)("button",{type:"button",className:"viewport-lock-button","data-surface-ui":!0,"aria-label":d,"aria-pressed":e,title:r||(e?s("viewportLock.unlockTitle",{target:c,description:p??s("viewportLock.unlockDescription")}):s("viewportLock.lockTitle",{target:c})),onClick:n,children:[e?(0,l.jsx)(L,{size:16}):(0,l.jsx)(x,{size:16}),r&&(0,l.jsx)("span",{className:"viewport-lock-error",role:"alert",children:r})]})}export{z as a,V as b,_ as c,O as d,X as e};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Ja as S,c as v,gb as B,hb as d,ib as T,kb as y}from"./chunk-S4EP5SMX.js";import{a as h}from"./chunk-J6IRWTF7.js";import{c as i}from"./chunk-DCANE7XH.js";var u=i(v(),1),N=i(T(),1),R=i(d(),1),g=(0,u.createContext)(null);function x({children:e}){let t=(0,u.useContext)(g);return t?t.selected&&t.target?(0,N.createPortal)(e,t.target):null:e}function H({children:e}){let t=(0,u.useContext)(g);return t?t.target?(0,N.createPortal)((0,R.jsx)("div",{className:"board-component-settings","data-surface-ui":!0,hidden:!t.selected,onKeyDown:s=>{s.key==="Escape"&&t.closeSettings&&(s.preventDefault(),s.stopPropagation(),t.closeSettings(),t.target?.querySelector(".sb-actions > button.sb-icon-button.is-active:last-child")?.focus({preventScroll:!0}))},children:e}),t.target):null:e}var m=i(v(),1);var A=h("blocks",{"zh-CN":{blockActions:"\u7EC4\u4EF6\u64CD\u4F5C",closeSettings:"\u5173\u95ED\u8BBE\u7F6E",editBlock:"\u7F16\u8F91\u533A\u5757"},en:{blockActions:"Block actions",closeSettings:"Close settings",editBlock:"Edit block"}});var o=i(d(),1),C=new Set(["\u6570\u636E\u56FE\u8868|\u6570\u636E\u5E93|\u5173\u952E\u6307\u6807|\u4EA4\u4E92\u8BA1\u7B97|\u56FE\u7247\u753B\u5ECA|\u4EA4\u4E92\u6D41\u7A0B\u56FE|\u601D\u7EF4\u5BFC\u56FE|G2 \u56FE\u8868|\u56FE\u8868","\u67F1\u72B6\u56FE|\u6298\u7EBF\u56FE|\u9762\u79EF\u56FE|\u6563\u70B9\u56FE|\u6C14\u6CE1\u56FE|\u5206\u7EC4\u67F1\u72B6\u56FE|\u53CC\u5411\u6761\u5F62\u56FE|\u96F7\u8FBE\u56FE|\u5F84\u5411\u6761\u5F62\u56FE|\u5E73\u884C\u5750\u6807|\u56DE\u5F52\u66F2\u7EBF","\u997C\u56FE|\u73AF\u56FE|\u5806\u53E0\u67F1\u72B6\u56FE|\u5806\u53E0\u9762\u79EF\u56FE|\u73AB\u7470\u56FE|\u9A6C\u8D5B\u514B\u56FE|\u77E9\u5F62\u6811\u56FE|\u65ED\u65E5\u56FE|\u6F0F\u6597\u56FE","\u76F4\u65B9\u56FE|\u7BB1\u7EBF\u56FE|\u5C0F\u63D0\u7434\u56FE|\u5206\u5E03\u66F2\u7EBF|\u5BC6\u5EA6\u70ED\u529B\u56FE|\u8272\u5757\u56FE|\u7B49\u9AD8\u7EBF\u56FE|\u830E\u53F6\u56FE","\u6851\u57FA\u56FE|\u5F26\u56FE|\u5F27\u56FE|\u5706\u5F62\u6253\u5305\u56FE|\u97E6\u6069\u56FE|\u7518\u7279\u56FE|K \u7EBF\u56FE|Kagi \u8F6C\u5411\u56FE|\u87BA\u65CB\u56FE","\u5206\u7EA7\u8BBE\u8272\u5730\u56FE|\u70B9\u5730\u56FE|\u6C14\u6CE1\u5730\u56FE|\u4EEA\u8868\u76D8|\u5B50\u5F39\u56FE|\u8BCD\u4E91"].join("|").split("|"));function D(e,t){return typeof e=="string"&&e.trim()&&!C.has(e.trim())?e:t}function P({title:e,defaultTitle:t,description:s,editable:c,editing:n,onEdit:l,children:b}){let r=y(A),a=(0,m.useContext)(g);(0,m.useLayoutEffect)(()=>{if(!(!a||!n||!l))return a.closeSettings=l,()=>{a.closeSettings===l&&delete a.closeSettings}},[a,n,l]);let p=e?.trim(),f=p&&p!==t&&!C.has(p)?p:"",k=!!(f||s?.trim());return!k&&!b&&!c?null:(0,o.jsxs)("div",{className:`sb-header${k?" has-caption":""}${n?" is-editing":""}`,children:[k&&(0,o.jsxs)("div",{className:"sb-heading",children:[f&&(0,o.jsx)("div",{className:"sb-title",children:f}),s?.trim()&&(0,o.jsx)("p",{className:"sb-description",children:s})]}),(b||c)&&(0,o.jsx)(x,{children:(0,o.jsxs)("div",{className:"sb-actions",role:"group","aria-label":r("blockActions"),children:[b,c&&(0,o.jsx)("button",{type:"button",className:`sb-icon-button ${n?"is-active":""}`,onClick:l,"aria-label":r(n?"closeSettings":"editBlock"),title:r(n?"closeSettings":"editBlock"),children:n?(0,o.jsx)(B,{size:16}):(0,o.jsx)(S,{size:16})})]})})]})}function q({icon:e,title:t,description:s,action:c}){return(0,o.jsxs)("div",{className:"sb-empty",children:[e,(0,o.jsx)("strong",{children:t}),s&&(0,o.jsx)("p",{children:s}),c]})}function F({label:e,children:t,className:s=""}){return(0,o.jsxs)("label",{className:`sb-field ${s}`,children:[(0,o.jsx)("span",{children:e}),t]})}export{g as a,x as b,H as c,D as d,P as e,q as f,F as g};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a,b,c,d,e}from"./chunk-7G6RMB6W.js";import"./chunk-DCANE7XH.js";export{e as codeHighlighter,a as codeLanguages,d as highlightCode,b as normalizeCodeLanguage,c as supportsCodeLanguage};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as XM}from"./chunk-LY26FKQZ.js";import{i as xM}from"./chunk-DUIGVKKG.js";var yg=typeof process=="object"&&process+""=="[object process]"&&!process.versions.nw&&!(process.versions.electron&&process.type&&process.type!=="browser"),fQ=[1/0,1/0,-1/0,-1/0],xC=new Float32Array(fQ),ww=[.001,0,0,.001,0,0];var Dg="http://www.w3.org/2000/svg",Jg={ANY:1,DISPLAY:2,PRINT:4,SAVE:8,ANNOTATIONS_FORMS:16,ANNOTATIONS_STORAGE:32,ANNOTATIONS_DISABLE:64,IS_EDITING:128,OPLIST:256},sC={DISABLE:0,ENABLE:1,ENABLE_FORMS:2,ENABLE_STORAGE:3},KI="pdfjs_internal_id_",bI="pdfjs_internal_editor_",zA={DISABLE:-1,NONE:0,FREETEXT:3,HIGHLIGHT:9,STAMP:13,INK:15,POPUP:16,SIGNATURE:101,COMMENT:102},sB={RESIZE:1,CREATE:2,FREETEXT_SIZE:11,FREETEXT_COLOR:12,FREETEXT_OPACITY:13,INK_COLOR:21,INK_THICKNESS:22,INK_OPACITY:23,INK_COLOR_AND_OPACITY:24,HIGHLIGHT_COLOR:31,HIGHLIGHT_THICKNESS:32,HIGHLIGHT_FREE:33,HIGHLIGHT_SHOW_ALL:34,DRAW_STEP:41},lk={PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048};var qB={FILL:0,STROKE:1,FILL_STROKE:2,INVISIBLE:3,FILL_ADD_TO_PATH:4,STROKE_ADD_TO_PATH:5,FILL_STROKE_ADD_TO_PATH:6,ADD_TO_PATH:7,FILL_STROKE_MASK:3,ADD_TO_PATH_FLAG:4},Ai={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3},yB={TEXT:1,LINK:2,FREETEXT:3,LINE:4,SQUARE:5,CIRCLE:6,POLYGON:7,POLYLINE:8,HIGHLIGHT:9,UNDERLINE:10,SQUIGGLY:11,STRIKEOUT:12,STAMP:13,CARET:14,INK:15,POPUP:16,FILEATTACHMENT:17,SOUND:18,MOVIE:19,WIDGET:20,SCREEN:21,PRINTERMARK:22,TRAPNET:23,WATERMARK:24,THREED:25,REDACT:26,RICHMEDIA:27};var uI={SOLID:1,DASHED:2,BEVELED:3,INSET:4,UNDERLINE:5};var Ui={ERRORS:0,WARNINGS:1,INFOS:5},MQ={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,rawFillPath:94},mt={moveTo:0,lineTo:1,curveTo:2,quadraticCurveTo:3,closePath:4},Gk={NEED_PASSWORD:1,INCORRECT_PASSWORD:2},ki=Ui.WARNINGS;function Fk(g){Number.isInteger(g)&&(ki=g)}function Mk(){return ki}function Hi(g){ki>=Ui.INFOS&&console.info(`Info: ${g}`)}function AB(g){ki>=Ui.WARNINGS&&console.warn(`Warning: ${g}`)}function cB(g){throw new Error(g)}function bB(g,A){g||cB(A)}function fk(g){switch(g?.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":return!0;default:return!1}}function cf(g,A=null,B=null){if(!g)return null;if(B&&typeof g=="string"&&(B.addDefaultProtocol&&g.startsWith("www.")&&g.match(/\./g)?.length>=2&&(g=`http://${g}`),B.tryConvertEncoding))try{g=Yk(g)}catch{}let Q=A?URL.parse(g,A):URL.parse(g);return fk(Q)?Q:null}function rf(g,A,B=!1){let Q=URL.parse(g);return Q?(Q.hash=A,Q.href):B&&cf(g,"http://example.com")?g.split("#",1)[0]+`${A?`#${A}`:""}`:""}function aw(g){return g.substring(g.lastIndexOf("/")+1)}function pA(g,A,B,Q=!1){return Object.defineProperty(g,A,{value:B,enumerable:!Q,configurable:!0,writable:!1}),B}var OC=(function(){function A(B,Q){this.message=B,this.name=Q}return A.prototype=new Error,A.constructor=A,A})(),Lt=class extends OC{constructor(A,B){super(A,"PasswordException"),this.code=B}},Kt=class extends OC{constructor(A,B){super(A,"UnknownErrorException"),this.details=B}},xt=class extends OC{constructor(A){super(A,"InvalidPDFException")}},NI=class extends OC{constructor(A,B,Q){super(A,"ResponseException"),this.status=B,this.missing=Q}},nw=class extends OC{constructor(A){super(A,"FormatError")}},dQ=class extends OC{constructor(A){super(A,"AbortException")}};function dk(g){(typeof g!="object"||g?.length===void 0)&&cB("Invalid argument for bytesToString");let A=g.length,B=8192;if(A<B)return String.fromCharCode.apply(null,g);let Q=[];for(let C=0;C<A;C+=B){let I=Math.min(C+B,A),E=g.subarray(C,I);Q.push(String.fromCharCode.apply(null,E))}return Q.join("")}function Ri(g){typeof g!="string"&&cB("Invalid argument for stringToBytes");let A=g.length,B=new Uint8Array(A);for(let Q=0;Q<A;++Q)B[Q]=g.charCodeAt(Q)&255;return B}var lB=class{static get isLittleEndian(){let A=new Uint8Array(4);A[0]=1;let B=new Uint32Array(A.buffer,0,1);return pA(this,"isLittleEndian",B[0]===1)}static get isOffscreenCanvasSupported(){return pA(this,"isOffscreenCanvasSupported",typeof OffscreenCanvas<"u")}static get isImageDecoderSupported(){return pA(this,"isImageDecoderSupported",typeof ImageDecoder<"u")}static get isFloat16ArraySupported(){return pA(this,"isFloat16ArraySupported",typeof Float16Array<"u")}static get isSanitizerSupported(){return pA(this,"isSanitizerSupported",typeof Sanitizer<"u")}static get platform(){let{platform:A,userAgent:B}=navigator;return pA(this,"platform",{isAndroid:B.includes("Android"),isLinux:A.includes("Linux"),isMac:A.includes("Mac"),isWindows:A.includes("Win"),isFirefox:B.includes("Firefox")})}static get isCanvasFilterSupported(){let A;return this.isOffscreenCanvasSupported?A=new OffscreenCanvas(1,1).getContext("2d"):typeof document<"u"&&(A=document.createElement("canvas").getContext("2d")),pA(this,"isCanvasFilterSupported",A?.filter!==void 0)}static get isAlphaColorInputSupported(){if(typeof document>"u")return pA(this,"isAlphaColorInputSupported",!1);let A=document.createElement("input");return A.type="color",A.setAttribute("alpha",""),A.value="#ff000080",pA(this,"isAlphaColorInputSupported",A.value!=="#ff0000")}static get isBackdropFilterSupported(){return pA(this,"isBackdropFilterSupported",typeof CSS<"u"&&CSS.supports("backdrop-filter","blur(1px)"))}},RA=class{static get hexNums(){return pA(this,"hexNums",Array.from({length:256},(A,B)=>B.toString(16).padStart(2,"0")))}static makeHexColor(A,B,Q){return`#${this.hexNums[A]}${this.hexNums[B]}${this.hexNums[Q]}`}static transform(A,B){return[A[0]*B[0]+A[2]*B[1],A[1]*B[0]+A[3]*B[1],A[0]*B[2]+A[2]*B[3],A[1]*B[2]+A[3]*B[3],A[0]*B[4]+A[2]*B[5]+A[4],A[1]*B[4]+A[3]*B[5]+A[5]]}static multiplyByDOMMatrix(A,B){return[A[0]*B.a+A[2]*B.b,A[1]*B.a+A[3]*B.b,A[0]*B.c+A[2]*B.d,A[1]*B.c+A[3]*B.d,A[0]*B.e+A[2]*B.f+A[4],A[1]*B.e+A[3]*B.f+A[5]]}static applyTransform(A,B,Q=0){let C=A[Q],I=A[Q+1];A[Q]=C*B[0]+I*B[2]+B[4],A[Q+1]=C*B[1]+I*B[3]+B[5]}static applyTransformToBezier(A,B,Q=0){let C=B[0],I=B[1],E=B[2],t=B[3],e=B[4],i=B[5];for(let s=0;s<6;s+=2){let o=A[Q+s],w=A[Q+s+1];A[Q+s]=o*C+w*E+e,A[Q+s+1]=o*I+w*t+i}}static applyInverseTransform(A,B){let Q=A[0],C=A[1],I=B[0]*B[3]-B[1]*B[2];A[0]=(Q*B[3]-C*B[2]+B[2]*B[5]-B[4]*B[3])/I,A[1]=(-Q*B[1]+C*B[0]+B[4]*B[1]-B[5]*B[0])/I}static axialAlignedBoundingBox(A,B,Q){let C=B[0],I=B[1],E=B[2],t=B[3],e=B[4],i=B[5],s=A[0],o=A[1],w=A[2],a=A[3],c=C*s+e,n=c,r=C*w+e,h=r,D=t*o+i,l=D,G=t*a+i,M=G;if(I!==0||E!==0){let f=I*s,d=I*w,Y=E*o,U=E*a;c+=Y,h+=Y,r+=U,n+=U,D+=f,M+=f,G+=d,l+=d}Q[0]=Math.min(Q[0],c,r,n,h),Q[1]=Math.min(Q[1],D,G,l,M),Q[2]=Math.max(Q[2],c,r,n,h),Q[3]=Math.max(Q[3],D,G,l,M)}static inverseTransform(A){let B=A[0]*A[3]-A[1]*A[2];return[A[3]/B,-A[1]/B,-A[2]/B,A[0]/B,(A[2]*A[5]-A[4]*A[3])/B,(A[4]*A[1]-A[5]*A[0])/B]}static singularValueDecompose2dScale(A,B){let Q=A[0],C=A[1],I=A[2],E=A[3],t=Q**2+C**2,e=Q*I+C*E,i=I**2+E**2,s=(t+i)/2,o=Math.sqrt(s**2-(t*i-e**2));B[0]=Math.sqrt(s+o||1),B[1]=Math.sqrt(s-o||1)}static normalizeRect(A){let B=A.slice(0);return A[0]>A[2]&&(B[0]=A[2],B[2]=A[0]),A[1]>A[3]&&(B[1]=A[3],B[3]=A[1]),B}static intersect(A,B){let Q=Math.max(Math.min(A[0],A[2]),Math.min(B[0],B[2])),C=Math.min(Math.max(A[0],A[2]),Math.max(B[0],B[2]));if(Q>C)return null;let I=Math.max(Math.min(A[1],A[3]),Math.min(B[1],B[3])),E=Math.min(Math.max(A[1],A[3]),Math.max(B[1],B[3]));return I>E?null:[Q,I,C,E]}static pointBoundingBox(A,B,Q){Q[0]=Math.min(Q[0],A),Q[1]=Math.min(Q[1],B),Q[2]=Math.max(Q[2],A),Q[3]=Math.max(Q[3],B)}static rectBoundingBox(A,B,Q,C,I){I[0]=Math.min(I[0],A,Q),I[1]=Math.min(I[1],B,C),I[2]=Math.max(I[2],A,Q),I[3]=Math.max(I[3],B,C)}static#A(A,B,Q,C,I,E,t,e,i,s){if(i<=0||i>=1)return;let o=1-i,w=i*i,a=w*i,c=o*(o*(o*A+3*i*B)+3*w*Q)+a*C,n=o*(o*(o*I+3*i*E)+3*w*t)+a*e;s[0]=Math.min(s[0],c),s[1]=Math.min(s[1],n),s[2]=Math.max(s[2],c),s[3]=Math.max(s[3],n)}static#B(A,B,Q,C,I,E,t,e,i,s,o,w){if(Math.abs(i)<1e-12){Math.abs(s)>=1e-12&&this.#A(A,B,Q,C,I,E,t,e,-o/s,w);return}let a=s**2-4*o*i;if(a<0)return;let c=Math.sqrt(a),n=2*i;this.#A(A,B,Q,C,I,E,t,e,(-s+c)/n,w),this.#A(A,B,Q,C,I,E,t,e,(-s-c)/n,w)}static bezierBoundingBox(A,B,Q,C,I,E,t,e,i){i[0]=Math.min(i[0],A,t),i[1]=Math.min(i[1],B,e),i[2]=Math.max(i[2],A,t),i[3]=Math.max(i[3],B,e),this.#B(A,Q,I,t,B,C,E,e,3*(-A+3*(Q-I)+t),6*(A-2*Q+I),3*(Q-A),i),this.#B(A,Q,I,t,B,C,E,e,3*(-B+3*(C-E)+e),6*(B-2*C+E),3*(C-B),i)}};function Yk(g){return decodeURIComponent(escape(g))}var Ew=null,jM=null;function Uk(g){return Ew||(Ew=/([\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,jM=new Map([["\uFB05","\u017Ft"]])),g.replaceAll(Ew,(A,B,Q)=>B?B.normalize("NFKC"):jM.get(Q))}function hf(){if(typeof crypto.randomUUID=="function")return crypto.randomUUID();let g=new Uint8Array(32);return crypto.getRandomValues(g),dk(g)}function kk(g,A,B){if(!Array.isArray(B)||B.length<2)return!1;let[Q,C,...I]=B;if(!g(Q)&&!Number.isInteger(Q)||!A(C))return!1;let E=I.length,t=!0;switch(C.name){case"XYZ":if(E<2||E>3)return!1;break;case"Fit":case"FitB":return E===0;case"FitH":case"FitBH":case"FitV":case"FitBV":if(E>1)return!1;break;case"FitR":if(E!==4)return!1;t=!1;break;default:return!1}for(let e of I)if(!(typeof e=="number"||t&&e===null))return!1;return!0}var TI=()=>[],gn=()=>new Map,cw=()=>Object.create(null),Hk=()=>new Set;typeof Iterator.prototype.join!="function"&&(Iterator.prototype.join=function(g){return[...this].join(g)});function RB(g,A,B){return Math.min(Math.max(g,A),B)}var Xt=class g{constructor({viewBox:A,userUnit:B,scale:Q,rotation:C,offsetX:I=0,offsetY:E=0,dontFlip:t=!1}){this.viewBox=A,this.userUnit=B,this.scale=Q,this.rotation=C,this.offsetX=I,this.offsetY=E,Q*=B;let e=(A[2]+A[0])/2,i=(A[3]+A[1])/2,s,o,w,a;switch(C%=360,C<0&&(C+=360),C){case 180:s=-1,o=0,w=0,a=1;break;case 90:s=0,o=1,w=1,a=0;break;case 270:s=0,o=-1,w=-1,a=0;break;case 0:s=1,o=0,w=0,a=-1;break;default:throw new Error("PageViewport: Invalid rotation, must be a multiple of 90 degrees.")}t&&(w=-w,a=-a);let c,n,r,h;s===0?(c=Math.abs(i-A[1])*Q+I,n=Math.abs(e-A[0])*Q+E,r=(A[3]-A[1])*Q,h=(A[2]-A[0])*Q):(c=Math.abs(e-A[0])*Q+I,n=Math.abs(i-A[1])*Q+E,r=(A[2]-A[0])*Q,h=(A[3]-A[1])*Q),this.transform=[s*Q,o*Q,w*Q,a*Q,c-s*Q*e-w*Q*i,n-o*Q*e-a*Q*i],this.width=r,this.height=h}get rawDims(){let A=this.viewBox;return pA(this,"rawDims",{pageWidth:A[2]-A[0],pageHeight:A[3]-A[1],pageX:A[0],pageY:A[1]})}clone({scale:A=this.scale,rotation:B=this.rotation,offsetX:Q=this.offsetX,offsetY:C=this.offsetY,dontFlip:I=!1}={}){return new g({viewBox:this.viewBox.slice(),userUnit:this.userUnit,scale:A,rotation:B,offsetX:Q,offsetY:C,dontFlip:I})}convertToViewportPoint(A,B){let Q=[A,B];return RA.applyTransform(Q,this.transform),Q}convertToPdfPoint(A,B){let Q=[A,B];return RA.applyInverseTransform(Q,this.transform),Q}},jt=class g{static textContent(A){let B=[],Q={items:B,styles:Object.create(null)};function C(I){if(!I)return;let E=null,t=I.name;if(t==="#text")E=I.value;else if(g.shouldBuildText(t))I?.attributes?.textContent?E=I.attributes.textContent:I.value&&(E=I.value);else return;if(E!==null&&B.push({str:E}),!!I.children)for(let e of I.children)C(e)}return C(A),Q}static shouldBuildText(A){return!(A==="textarea"||A==="input"||A==="option"||A==="select")}},Rk=/url\(|image-set\(/i,Sk=/^on/i,gi=class{static get _allowedHtmlElements(){return pA(this,"_allowedHtmlElements",new Set(["a","b","br","button","div","i","img","input","label","li","ol","option","p","select","span","sub","sup","textarea","ul"]))}static get _allowedSvgElements(){return pA(this,"_allowedSvgElements",new Set(["ellipse","line","path","rect","svg"]))}static get _allowedRichTextElements(){return pA(this,"_allowedRichTextElements",new Set(["a","b","br","div","i","li","ol","p","span","sub","sup","ul"]))}static get _allowedRichTextAttributes(){return pA(this,"_allowedRichTextAttributes",new Set(["class","dir","style"]))}static get _allowedRichTextStyles(){return pA(this,"_allowedRichTextStyles",new Set(["color","font","fontFamily","fontSize","fontStretch","fontStyle","fontWeight","kerningMode","letterSpacing","lineHeight","margin","marginBottom","marginLeft","marginRight","marginTop","orphans","paddingLeft","paddingRight","breakAfter","breakBefore","breakInside","tabInterval","tabStop","textAlign","textDecoration","textIndent","transform","verticalAlign","widows"]))}static setupStorage(A,B,Q,C,I){let E=C.getValue(B,{value:null});switch(Q.name){case"textarea":if(E.value!==null&&(A.textContent=E.value),I==="print")break;A.addEventListener("input",t=>{C.setValue(B,{value:t.target.value})});break;case"input":if(Q.attributes.type==="radio"||Q.attributes.type==="checkbox"){if(E.value===Q.attributes.xfaOn?A.setAttribute("checked",!0):E.value===Q.attributes.xfaOff&&A.removeAttribute("checked"),I==="print")break;A.addEventListener("change",t=>{C.setValue(B,{value:t.target.checked?t.target.getAttribute("xfaOn"):t.target.getAttribute("xfaOff")})})}else{if(E.value!==null&&A.setAttribute("value",E.value),I==="print")break;A.addEventListener("input",t=>{C.setValue(B,{value:t.target.value})})}break;case"select":if(E.value!==null){A.setAttribute("value",E.value);for(let t of Q.children)t.attributes.value===E.value?t.attributes.selected=!0:Object.hasOwn(t.attributes,"selected")&&delete t.attributes.selected}A.addEventListener("input",t=>{let e=t.target.options,i=e.selectedIndex===-1?"":e[e.selectedIndex].value;C.setValue(B,{value:i})});break}}static setAttributes({html:A,element:B,storage:Q=null,intent:C,linkService:I}){let{attributes:E}=B,t=A instanceof HTMLAnchorElement;E.type==="radio"&&(E.name=`${E.name}-${C}`);for(let[e,i]of Object.entries(E))if(!(i==null||Sk.test(e))&&!(C==="richText"&&!this._allowedRichTextAttributes.has(e)))switch(e){case"class":i.length&&A.setAttribute(e,i.join(" "));break;case"dataId":break;case"id":A.setAttribute("data-element-id",i);break;case"style":if(C==="richText"){let s=this._allowedRichTextStyles;for(let[o,w]of Object.entries(i))s.has(o)&&!Rk.test(w)&&(A.style[o]=w)}else Object.assign(A.style,i);break;case"textContent":A.textContent=i;break;default:(!t||e!=="href"&&e!=="newWindow")&&A.setAttribute(e,i)}t&&I?.addLinkAttributes(A,E.href,E.newWindow),Q&&E.dataId&&this.setupStorage(A,E.dataId,B,Q)}static#A(A,B,Q){return Q==="richText"?!B&&this._allowedRichTextElements.has(A)?document.createElement(A):null:B?B===Dg&&this._allowedSvgElements.has(A)?document.createElementNS(Dg,A):null:this._allowedHtmlElements.has(A)?document.createElement(A):null}static render(A){let B=A.annotationStorage,Q=A.linkService,C=A.xfaHtml,I=A.intent||"display",E=this.#A(C.name,C.attributes?.xmlns,I)??document.createElement("div");C.attributes&&this.setAttributes({html:E,element:C,intent:I,linkService:Q});let t=I!=="richText",e=A.div;if(e.append(E),A.viewport){let o=`matrix(${A.viewport.transform.join(",")})`;e.style.transform=o}t&&e.setAttribute("class","xfaLayer xfaFont");let i=[];if(C.children.length===0){if(C.value){let o=document.createTextNode(C.value);E.append(o),t&&jt.shouldBuildText(C.name)&&i.push(o)}return{textDivs:i}}let s=[[C,-1,E]];for(;s.length>0;){let[o,w,a]=s.at(-1);if(w+1===o.children.length){s.pop();continue}let c=o.children[++s.at(-1)[1]];if(c===null)continue;let{name:n}=c;if(n==="#text"){let h=document.createTextNode(c.value);i.push(h),a.append(h);continue}let r=this.#A(n,c.attributes?.xmlns,I);if(r){if(a.append(r),c.attributes&&this.setAttributes({html:r,element:c,storage:B,intent:I,linkService:Q}),c.children?.length>0)s.push([c,-1,r]);else if(c.value){let h=document.createTextNode(c.value);t&&jt.shouldBuildText(n)&&i.push(h),r.append(h)}}}for(let o of e.querySelectorAll(".xfaNonInteractive input, .xfaNonInteractive textarea"))o.setAttribute("readOnly",!0);return{textDivs:i}}static update(A){let B=`matrix(${A.viewport.transform.join(",")})`;A.div.style.transform=B,A.div.hidden=!1}static getPageViewport(A,{scale:B=1,rotation:Q=0}){let{width:C,height:I}=A.attributes.style;return new Xt({viewBox:[0,0,parseInt(C,10),parseInt(I,10)],userUnit:1,scale:B,rotation:Q})}},wC=class{static CSS=96;static PDF=72;static PDF_TO_CSS_UNITS=this.CSS/this.PDF};async function Qn(g,A="text"){if(Jt(g,document.baseURI)){let B=await fetch(g);if(!B.ok)throw new Error(B.statusText);switch(A){case"blob":return B.blob();case"bytes":return B.bytes();case"json":return B.json()}return B.text()}return new Promise((B,Q)=>{let C=new XMLHttpRequest;C.open("GET",g,!0),C.responseType=A==="bytes"?"arraybuffer":A,C.onreadystatechange=()=>{if(C.readyState===XMLHttpRequest.DONE){if(C.status===200||C.status===0){switch(A){case"bytes":B(new Uint8Array(C.response));return;case"blob":case"json":B(C.response);return}B(C.responseText);return}Q(new Error(C.statusText))}},C.send(null)})}var Tt=class extends OC{constructor(A,B=0){super(A,"RenderingCancelledException"),this.extraDelay=B}};function Si(g){let A=g.length,B=0;for(;B<A&&g[B].trim()==="";)B++;return g.substring(B,B+5).toLowerCase()==="data:"}function Cn(g){return typeof g=="string"&&/\.pdf$/i.test(g)}function mk(g){return[g]=g.split(/[#?]/,1),aw(g)}function uk(g,A="document.pdf"){if(typeof g!="string")return A;if(Si(g))return AB('getPdfFilenameFromUrl: ignore "data:"-URL for performance reasons.'),A;let Q=(t=>{try{return new URL(t)}catch{}try{return new URL(decodeURIComponent(t))}catch{}try{return new URL(t,"https://foo.bar")}catch{}try{return new URL(decodeURIComponent(t),"https://foo.bar")}catch{}return null})(g);if(!Q)return A;let C=t=>{try{let e=decodeURIComponent(t);return e.includes("/")&&(e=aw(e),e.length===4&&I.test(e))?t:e}catch{return t}},I=/\.pdf$/i,E=aw(Q.pathname);if(I.test(E))return C(E);if(Q.searchParams.size>0){let t=i=>[...i].findLast(s=>I.test(s)),e=t(Q.searchParams.values())??t(Q.searchParams.keys());if(e)return C(e)}if(Q.hash){let{hash:t}=Q,e=-1;for(let{index:i}of t.matchAll(/\.pdf\b/gi))e=i;if(e>0){let i=e;for(;i>0&&!"/?#=".includes(t[i-1]);)i--;if(i<e)return C(t.slice(i,e+4))}}return A}var Qi=class{#A=new Map;times=[];time(A){this.#A.has(A)&&AB(`Timer is already running for ${A}`),this.#A.set(A,Date.now())}timeEnd(A){this.#A.has(A)||AB(`Timer has not been started for ${A}`),this.times.push({name:A,start:this.#A.get(A),end:Date.now()}),this.#A.delete(A)}toString(){let A=Math.max(...this.times.map(B=>B.name.length));return this.times.map(B=>`${B.name.padEnd(A)} ${B.end-B.start}ms
|
|
1
|
+
import{a as XM}from"./chunk-MENLQ7WW.js";import{f as xM}from"./chunk-J6IRWTF7.js";import"./chunk-DCANE7XH.js";var yg=typeof process=="object"&&process+""=="[object process]"&&!process.versions.nw&&!(process.versions.electron&&process.type&&process.type!=="browser"),fQ=[1/0,1/0,-1/0,-1/0],xC=new Float32Array(fQ),ww=[.001,0,0,.001,0,0];var Dg="http://www.w3.org/2000/svg",Jg={ANY:1,DISPLAY:2,PRINT:4,SAVE:8,ANNOTATIONS_FORMS:16,ANNOTATIONS_STORAGE:32,ANNOTATIONS_DISABLE:64,IS_EDITING:128,OPLIST:256},sC={DISABLE:0,ENABLE:1,ENABLE_FORMS:2,ENABLE_STORAGE:3},KI="pdfjs_internal_id_",bI="pdfjs_internal_editor_",zA={DISABLE:-1,NONE:0,FREETEXT:3,HIGHLIGHT:9,STAMP:13,INK:15,POPUP:16,SIGNATURE:101,COMMENT:102},sB={RESIZE:1,CREATE:2,FREETEXT_SIZE:11,FREETEXT_COLOR:12,FREETEXT_OPACITY:13,INK_COLOR:21,INK_THICKNESS:22,INK_OPACITY:23,INK_COLOR_AND_OPACITY:24,HIGHLIGHT_COLOR:31,HIGHLIGHT_THICKNESS:32,HIGHLIGHT_FREE:33,HIGHLIGHT_SHOW_ALL:34,DRAW_STEP:41},lk={PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048};var qB={FILL:0,STROKE:1,FILL_STROKE:2,INVISIBLE:3,FILL_ADD_TO_PATH:4,STROKE_ADD_TO_PATH:5,FILL_STROKE_ADD_TO_PATH:6,ADD_TO_PATH:7,FILL_STROKE_MASK:3,ADD_TO_PATH_FLAG:4},Ai={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3},yB={TEXT:1,LINK:2,FREETEXT:3,LINE:4,SQUARE:5,CIRCLE:6,POLYGON:7,POLYLINE:8,HIGHLIGHT:9,UNDERLINE:10,SQUIGGLY:11,STRIKEOUT:12,STAMP:13,CARET:14,INK:15,POPUP:16,FILEATTACHMENT:17,SOUND:18,MOVIE:19,WIDGET:20,SCREEN:21,PRINTERMARK:22,TRAPNET:23,WATERMARK:24,THREED:25,REDACT:26,RICHMEDIA:27};var uI={SOLID:1,DASHED:2,BEVELED:3,INSET:4,UNDERLINE:5};var Ui={ERRORS:0,WARNINGS:1,INFOS:5},MQ={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,rawFillPath:94},mt={moveTo:0,lineTo:1,curveTo:2,quadraticCurveTo:3,closePath:4},Gk={NEED_PASSWORD:1,INCORRECT_PASSWORD:2},ki=Ui.WARNINGS;function Fk(g){Number.isInteger(g)&&(ki=g)}function Mk(){return ki}function Hi(g){ki>=Ui.INFOS&&console.info(`Info: ${g}`)}function AB(g){ki>=Ui.WARNINGS&&console.warn(`Warning: ${g}`)}function cB(g){throw new Error(g)}function bB(g,A){g||cB(A)}function fk(g){switch(g?.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":return!0;default:return!1}}function cf(g,A=null,B=null){if(!g)return null;if(B&&typeof g=="string"&&(B.addDefaultProtocol&&g.startsWith("www.")&&g.match(/\./g)?.length>=2&&(g=`http://${g}`),B.tryConvertEncoding))try{g=Yk(g)}catch{}let Q=A?URL.parse(g,A):URL.parse(g);return fk(Q)?Q:null}function rf(g,A,B=!1){let Q=URL.parse(g);return Q?(Q.hash=A,Q.href):B&&cf(g,"http://example.com")?g.split("#",1)[0]+`${A?`#${A}`:""}`:""}function aw(g){return g.substring(g.lastIndexOf("/")+1)}function pA(g,A,B,Q=!1){return Object.defineProperty(g,A,{value:B,enumerable:!Q,configurable:!0,writable:!1}),B}var OC=(function(){function A(B,Q){this.message=B,this.name=Q}return A.prototype=new Error,A.constructor=A,A})(),Lt=class extends OC{constructor(A,B){super(A,"PasswordException"),this.code=B}},Kt=class extends OC{constructor(A,B){super(A,"UnknownErrorException"),this.details=B}},xt=class extends OC{constructor(A){super(A,"InvalidPDFException")}},NI=class extends OC{constructor(A,B,Q){super(A,"ResponseException"),this.status=B,this.missing=Q}},nw=class extends OC{constructor(A){super(A,"FormatError")}},dQ=class extends OC{constructor(A){super(A,"AbortException")}};function dk(g){(typeof g!="object"||g?.length===void 0)&&cB("Invalid argument for bytesToString");let A=g.length,B=8192;if(A<B)return String.fromCharCode.apply(null,g);let Q=[];for(let C=0;C<A;C+=B){let I=Math.min(C+B,A),E=g.subarray(C,I);Q.push(String.fromCharCode.apply(null,E))}return Q.join("")}function Ri(g){typeof g!="string"&&cB("Invalid argument for stringToBytes");let A=g.length,B=new Uint8Array(A);for(let Q=0;Q<A;++Q)B[Q]=g.charCodeAt(Q)&255;return B}var lB=class{static get isLittleEndian(){let A=new Uint8Array(4);A[0]=1;let B=new Uint32Array(A.buffer,0,1);return pA(this,"isLittleEndian",B[0]===1)}static get isOffscreenCanvasSupported(){return pA(this,"isOffscreenCanvasSupported",typeof OffscreenCanvas<"u")}static get isImageDecoderSupported(){return pA(this,"isImageDecoderSupported",typeof ImageDecoder<"u")}static get isFloat16ArraySupported(){return pA(this,"isFloat16ArraySupported",typeof Float16Array<"u")}static get isSanitizerSupported(){return pA(this,"isSanitizerSupported",typeof Sanitizer<"u")}static get platform(){let{platform:A,userAgent:B}=navigator;return pA(this,"platform",{isAndroid:B.includes("Android"),isLinux:A.includes("Linux"),isMac:A.includes("Mac"),isWindows:A.includes("Win"),isFirefox:B.includes("Firefox")})}static get isCanvasFilterSupported(){let A;return this.isOffscreenCanvasSupported?A=new OffscreenCanvas(1,1).getContext("2d"):typeof document<"u"&&(A=document.createElement("canvas").getContext("2d")),pA(this,"isCanvasFilterSupported",A?.filter!==void 0)}static get isAlphaColorInputSupported(){if(typeof document>"u")return pA(this,"isAlphaColorInputSupported",!1);let A=document.createElement("input");return A.type="color",A.setAttribute("alpha",""),A.value="#ff000080",pA(this,"isAlphaColorInputSupported",A.value!=="#ff0000")}static get isBackdropFilterSupported(){return pA(this,"isBackdropFilterSupported",typeof CSS<"u"&&CSS.supports("backdrop-filter","blur(1px)"))}},RA=class{static get hexNums(){return pA(this,"hexNums",Array.from({length:256},(A,B)=>B.toString(16).padStart(2,"0")))}static makeHexColor(A,B,Q){return`#${this.hexNums[A]}${this.hexNums[B]}${this.hexNums[Q]}`}static transform(A,B){return[A[0]*B[0]+A[2]*B[1],A[1]*B[0]+A[3]*B[1],A[0]*B[2]+A[2]*B[3],A[1]*B[2]+A[3]*B[3],A[0]*B[4]+A[2]*B[5]+A[4],A[1]*B[4]+A[3]*B[5]+A[5]]}static multiplyByDOMMatrix(A,B){return[A[0]*B.a+A[2]*B.b,A[1]*B.a+A[3]*B.b,A[0]*B.c+A[2]*B.d,A[1]*B.c+A[3]*B.d,A[0]*B.e+A[2]*B.f+A[4],A[1]*B.e+A[3]*B.f+A[5]]}static applyTransform(A,B,Q=0){let C=A[Q],I=A[Q+1];A[Q]=C*B[0]+I*B[2]+B[4],A[Q+1]=C*B[1]+I*B[3]+B[5]}static applyTransformToBezier(A,B,Q=0){let C=B[0],I=B[1],E=B[2],t=B[3],e=B[4],i=B[5];for(let s=0;s<6;s+=2){let o=A[Q+s],w=A[Q+s+1];A[Q+s]=o*C+w*E+e,A[Q+s+1]=o*I+w*t+i}}static applyInverseTransform(A,B){let Q=A[0],C=A[1],I=B[0]*B[3]-B[1]*B[2];A[0]=(Q*B[3]-C*B[2]+B[2]*B[5]-B[4]*B[3])/I,A[1]=(-Q*B[1]+C*B[0]+B[4]*B[1]-B[5]*B[0])/I}static axialAlignedBoundingBox(A,B,Q){let C=B[0],I=B[1],E=B[2],t=B[3],e=B[4],i=B[5],s=A[0],o=A[1],w=A[2],a=A[3],c=C*s+e,n=c,r=C*w+e,h=r,D=t*o+i,l=D,G=t*a+i,M=G;if(I!==0||E!==0){let f=I*s,d=I*w,Y=E*o,U=E*a;c+=Y,h+=Y,r+=U,n+=U,D+=f,M+=f,G+=d,l+=d}Q[0]=Math.min(Q[0],c,r,n,h),Q[1]=Math.min(Q[1],D,G,l,M),Q[2]=Math.max(Q[2],c,r,n,h),Q[3]=Math.max(Q[3],D,G,l,M)}static inverseTransform(A){let B=A[0]*A[3]-A[1]*A[2];return[A[3]/B,-A[1]/B,-A[2]/B,A[0]/B,(A[2]*A[5]-A[4]*A[3])/B,(A[4]*A[1]-A[5]*A[0])/B]}static singularValueDecompose2dScale(A,B){let Q=A[0],C=A[1],I=A[2],E=A[3],t=Q**2+C**2,e=Q*I+C*E,i=I**2+E**2,s=(t+i)/2,o=Math.sqrt(s**2-(t*i-e**2));B[0]=Math.sqrt(s+o||1),B[1]=Math.sqrt(s-o||1)}static normalizeRect(A){let B=A.slice(0);return A[0]>A[2]&&(B[0]=A[2],B[2]=A[0]),A[1]>A[3]&&(B[1]=A[3],B[3]=A[1]),B}static intersect(A,B){let Q=Math.max(Math.min(A[0],A[2]),Math.min(B[0],B[2])),C=Math.min(Math.max(A[0],A[2]),Math.max(B[0],B[2]));if(Q>C)return null;let I=Math.max(Math.min(A[1],A[3]),Math.min(B[1],B[3])),E=Math.min(Math.max(A[1],A[3]),Math.max(B[1],B[3]));return I>E?null:[Q,I,C,E]}static pointBoundingBox(A,B,Q){Q[0]=Math.min(Q[0],A),Q[1]=Math.min(Q[1],B),Q[2]=Math.max(Q[2],A),Q[3]=Math.max(Q[3],B)}static rectBoundingBox(A,B,Q,C,I){I[0]=Math.min(I[0],A,Q),I[1]=Math.min(I[1],B,C),I[2]=Math.max(I[2],A,Q),I[3]=Math.max(I[3],B,C)}static#A(A,B,Q,C,I,E,t,e,i,s){if(i<=0||i>=1)return;let o=1-i,w=i*i,a=w*i,c=o*(o*(o*A+3*i*B)+3*w*Q)+a*C,n=o*(o*(o*I+3*i*E)+3*w*t)+a*e;s[0]=Math.min(s[0],c),s[1]=Math.min(s[1],n),s[2]=Math.max(s[2],c),s[3]=Math.max(s[3],n)}static#B(A,B,Q,C,I,E,t,e,i,s,o,w){if(Math.abs(i)<1e-12){Math.abs(s)>=1e-12&&this.#A(A,B,Q,C,I,E,t,e,-o/s,w);return}let a=s**2-4*o*i;if(a<0)return;let c=Math.sqrt(a),n=2*i;this.#A(A,B,Q,C,I,E,t,e,(-s+c)/n,w),this.#A(A,B,Q,C,I,E,t,e,(-s-c)/n,w)}static bezierBoundingBox(A,B,Q,C,I,E,t,e,i){i[0]=Math.min(i[0],A,t),i[1]=Math.min(i[1],B,e),i[2]=Math.max(i[2],A,t),i[3]=Math.max(i[3],B,e),this.#B(A,Q,I,t,B,C,E,e,3*(-A+3*(Q-I)+t),6*(A-2*Q+I),3*(Q-A),i),this.#B(A,Q,I,t,B,C,E,e,3*(-B+3*(C-E)+e),6*(B-2*C+E),3*(C-B),i)}};function Yk(g){return decodeURIComponent(escape(g))}var Ew=null,jM=null;function Uk(g){return Ew||(Ew=/([\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,jM=new Map([["\uFB05","\u017Ft"]])),g.replaceAll(Ew,(A,B,Q)=>B?B.normalize("NFKC"):jM.get(Q))}function hf(){if(typeof crypto.randomUUID=="function")return crypto.randomUUID();let g=new Uint8Array(32);return crypto.getRandomValues(g),dk(g)}function kk(g,A,B){if(!Array.isArray(B)||B.length<2)return!1;let[Q,C,...I]=B;if(!g(Q)&&!Number.isInteger(Q)||!A(C))return!1;let E=I.length,t=!0;switch(C.name){case"XYZ":if(E<2||E>3)return!1;break;case"Fit":case"FitB":return E===0;case"FitH":case"FitBH":case"FitV":case"FitBV":if(E>1)return!1;break;case"FitR":if(E!==4)return!1;t=!1;break;default:return!1}for(let e of I)if(!(typeof e=="number"||t&&e===null))return!1;return!0}var TI=()=>[],gn=()=>new Map,cw=()=>Object.create(null),Hk=()=>new Set;typeof Iterator.prototype.join!="function"&&(Iterator.prototype.join=function(g){return[...this].join(g)});function RB(g,A,B){return Math.min(Math.max(g,A),B)}var Xt=class g{constructor({viewBox:A,userUnit:B,scale:Q,rotation:C,offsetX:I=0,offsetY:E=0,dontFlip:t=!1}){this.viewBox=A,this.userUnit=B,this.scale=Q,this.rotation=C,this.offsetX=I,this.offsetY=E,Q*=B;let e=(A[2]+A[0])/2,i=(A[3]+A[1])/2,s,o,w,a;switch(C%=360,C<0&&(C+=360),C){case 180:s=-1,o=0,w=0,a=1;break;case 90:s=0,o=1,w=1,a=0;break;case 270:s=0,o=-1,w=-1,a=0;break;case 0:s=1,o=0,w=0,a=-1;break;default:throw new Error("PageViewport: Invalid rotation, must be a multiple of 90 degrees.")}t&&(w=-w,a=-a);let c,n,r,h;s===0?(c=Math.abs(i-A[1])*Q+I,n=Math.abs(e-A[0])*Q+E,r=(A[3]-A[1])*Q,h=(A[2]-A[0])*Q):(c=Math.abs(e-A[0])*Q+I,n=Math.abs(i-A[1])*Q+E,r=(A[2]-A[0])*Q,h=(A[3]-A[1])*Q),this.transform=[s*Q,o*Q,w*Q,a*Q,c-s*Q*e-w*Q*i,n-o*Q*e-a*Q*i],this.width=r,this.height=h}get rawDims(){let A=this.viewBox;return pA(this,"rawDims",{pageWidth:A[2]-A[0],pageHeight:A[3]-A[1],pageX:A[0],pageY:A[1]})}clone({scale:A=this.scale,rotation:B=this.rotation,offsetX:Q=this.offsetX,offsetY:C=this.offsetY,dontFlip:I=!1}={}){return new g({viewBox:this.viewBox.slice(),userUnit:this.userUnit,scale:A,rotation:B,offsetX:Q,offsetY:C,dontFlip:I})}convertToViewportPoint(A,B){let Q=[A,B];return RA.applyTransform(Q,this.transform),Q}convertToPdfPoint(A,B){let Q=[A,B];return RA.applyInverseTransform(Q,this.transform),Q}},jt=class g{static textContent(A){let B=[],Q={items:B,styles:Object.create(null)};function C(I){if(!I)return;let E=null,t=I.name;if(t==="#text")E=I.value;else if(g.shouldBuildText(t))I?.attributes?.textContent?E=I.attributes.textContent:I.value&&(E=I.value);else return;if(E!==null&&B.push({str:E}),!!I.children)for(let e of I.children)C(e)}return C(A),Q}static shouldBuildText(A){return!(A==="textarea"||A==="input"||A==="option"||A==="select")}},Rk=/url\(|image-set\(/i,Sk=/^on/i,gi=class{static get _allowedHtmlElements(){return pA(this,"_allowedHtmlElements",new Set(["a","b","br","button","div","i","img","input","label","li","ol","option","p","select","span","sub","sup","textarea","ul"]))}static get _allowedSvgElements(){return pA(this,"_allowedSvgElements",new Set(["ellipse","line","path","rect","svg"]))}static get _allowedRichTextElements(){return pA(this,"_allowedRichTextElements",new Set(["a","b","br","div","i","li","ol","p","span","sub","sup","ul"]))}static get _allowedRichTextAttributes(){return pA(this,"_allowedRichTextAttributes",new Set(["class","dir","style"]))}static get _allowedRichTextStyles(){return pA(this,"_allowedRichTextStyles",new Set(["color","font","fontFamily","fontSize","fontStretch","fontStyle","fontWeight","kerningMode","letterSpacing","lineHeight","margin","marginBottom","marginLeft","marginRight","marginTop","orphans","paddingLeft","paddingRight","breakAfter","breakBefore","breakInside","tabInterval","tabStop","textAlign","textDecoration","textIndent","transform","verticalAlign","widows"]))}static setupStorage(A,B,Q,C,I){let E=C.getValue(B,{value:null});switch(Q.name){case"textarea":if(E.value!==null&&(A.textContent=E.value),I==="print")break;A.addEventListener("input",t=>{C.setValue(B,{value:t.target.value})});break;case"input":if(Q.attributes.type==="radio"||Q.attributes.type==="checkbox"){if(E.value===Q.attributes.xfaOn?A.setAttribute("checked",!0):E.value===Q.attributes.xfaOff&&A.removeAttribute("checked"),I==="print")break;A.addEventListener("change",t=>{C.setValue(B,{value:t.target.checked?t.target.getAttribute("xfaOn"):t.target.getAttribute("xfaOff")})})}else{if(E.value!==null&&A.setAttribute("value",E.value),I==="print")break;A.addEventListener("input",t=>{C.setValue(B,{value:t.target.value})})}break;case"select":if(E.value!==null){A.setAttribute("value",E.value);for(let t of Q.children)t.attributes.value===E.value?t.attributes.selected=!0:Object.hasOwn(t.attributes,"selected")&&delete t.attributes.selected}A.addEventListener("input",t=>{let e=t.target.options,i=e.selectedIndex===-1?"":e[e.selectedIndex].value;C.setValue(B,{value:i})});break}}static setAttributes({html:A,element:B,storage:Q=null,intent:C,linkService:I}){let{attributes:E}=B,t=A instanceof HTMLAnchorElement;E.type==="radio"&&(E.name=`${E.name}-${C}`);for(let[e,i]of Object.entries(E))if(!(i==null||Sk.test(e))&&!(C==="richText"&&!this._allowedRichTextAttributes.has(e)))switch(e){case"class":i.length&&A.setAttribute(e,i.join(" "));break;case"dataId":break;case"id":A.setAttribute("data-element-id",i);break;case"style":if(C==="richText"){let s=this._allowedRichTextStyles;for(let[o,w]of Object.entries(i))s.has(o)&&!Rk.test(w)&&(A.style[o]=w)}else Object.assign(A.style,i);break;case"textContent":A.textContent=i;break;default:(!t||e!=="href"&&e!=="newWindow")&&A.setAttribute(e,i)}t&&I?.addLinkAttributes(A,E.href,E.newWindow),Q&&E.dataId&&this.setupStorage(A,E.dataId,B,Q)}static#A(A,B,Q){return Q==="richText"?!B&&this._allowedRichTextElements.has(A)?document.createElement(A):null:B?B===Dg&&this._allowedSvgElements.has(A)?document.createElementNS(Dg,A):null:this._allowedHtmlElements.has(A)?document.createElement(A):null}static render(A){let B=A.annotationStorage,Q=A.linkService,C=A.xfaHtml,I=A.intent||"display",E=this.#A(C.name,C.attributes?.xmlns,I)??document.createElement("div");C.attributes&&this.setAttributes({html:E,element:C,intent:I,linkService:Q});let t=I!=="richText",e=A.div;if(e.append(E),A.viewport){let o=`matrix(${A.viewport.transform.join(",")})`;e.style.transform=o}t&&e.setAttribute("class","xfaLayer xfaFont");let i=[];if(C.children.length===0){if(C.value){let o=document.createTextNode(C.value);E.append(o),t&&jt.shouldBuildText(C.name)&&i.push(o)}return{textDivs:i}}let s=[[C,-1,E]];for(;s.length>0;){let[o,w,a]=s.at(-1);if(w+1===o.children.length){s.pop();continue}let c=o.children[++s.at(-1)[1]];if(c===null)continue;let{name:n}=c;if(n==="#text"){let h=document.createTextNode(c.value);i.push(h),a.append(h);continue}let r=this.#A(n,c.attributes?.xmlns,I);if(r){if(a.append(r),c.attributes&&this.setAttributes({html:r,element:c,storage:B,intent:I,linkService:Q}),c.children?.length>0)s.push([c,-1,r]);else if(c.value){let h=document.createTextNode(c.value);t&&jt.shouldBuildText(n)&&i.push(h),r.append(h)}}}for(let o of e.querySelectorAll(".xfaNonInteractive input, .xfaNonInteractive textarea"))o.setAttribute("readOnly",!0);return{textDivs:i}}static update(A){let B=`matrix(${A.viewport.transform.join(",")})`;A.div.style.transform=B,A.div.hidden=!1}static getPageViewport(A,{scale:B=1,rotation:Q=0}){let{width:C,height:I}=A.attributes.style;return new Xt({viewBox:[0,0,parseInt(C,10),parseInt(I,10)],userUnit:1,scale:B,rotation:Q})}},wC=class{static CSS=96;static PDF=72;static PDF_TO_CSS_UNITS=this.CSS/this.PDF};async function Qn(g,A="text"){if(Jt(g,document.baseURI)){let B=await fetch(g);if(!B.ok)throw new Error(B.statusText);switch(A){case"blob":return B.blob();case"bytes":return B.bytes();case"json":return B.json()}return B.text()}return new Promise((B,Q)=>{let C=new XMLHttpRequest;C.open("GET",g,!0),C.responseType=A==="bytes"?"arraybuffer":A,C.onreadystatechange=()=>{if(C.readyState===XMLHttpRequest.DONE){if(C.status===200||C.status===0){switch(A){case"bytes":B(new Uint8Array(C.response));return;case"blob":case"json":B(C.response);return}B(C.responseText);return}Q(new Error(C.statusText))}},C.send(null)})}var Tt=class extends OC{constructor(A,B=0){super(A,"RenderingCancelledException"),this.extraDelay=B}};function Si(g){let A=g.length,B=0;for(;B<A&&g[B].trim()==="";)B++;return g.substring(B,B+5).toLowerCase()==="data:"}function Cn(g){return typeof g=="string"&&/\.pdf$/i.test(g)}function mk(g){return[g]=g.split(/[#?]/,1),aw(g)}function uk(g,A="document.pdf"){if(typeof g!="string")return A;if(Si(g))return AB('getPdfFilenameFromUrl: ignore "data:"-URL for performance reasons.'),A;let Q=(t=>{try{return new URL(t)}catch{}try{return new URL(decodeURIComponent(t))}catch{}try{return new URL(t,"https://foo.bar")}catch{}try{return new URL(decodeURIComponent(t),"https://foo.bar")}catch{}return null})(g);if(!Q)return A;let C=t=>{try{let e=decodeURIComponent(t);return e.includes("/")&&(e=aw(e),e.length===4&&I.test(e))?t:e}catch{return t}},I=/\.pdf$/i,E=aw(Q.pathname);if(I.test(E))return C(E);if(Q.searchParams.size>0){let t=i=>[...i].findLast(s=>I.test(s)),e=t(Q.searchParams.values())??t(Q.searchParams.keys());if(e)return C(e)}if(Q.hash){let{hash:t}=Q,e=-1;for(let{index:i}of t.matchAll(/\.pdf\b/gi))e=i;if(e>0){let i=e;for(;i>0&&!"/?#=".includes(t[i-1]);)i--;if(i<e)return C(t.slice(i,e+4))}}return A}var Qi=class{#A=new Map;times=[];time(A){this.#A.has(A)&&AB(`Timer is already running for ${A}`),this.#A.set(A,Date.now())}timeEnd(A){this.#A.has(A)||AB(`Timer has not been started for ${A}`),this.times.push({name:A,start:this.#A.get(A),end:Date.now()}),this.#A.delete(A)}toString(){let A=Math.max(...this.times.map(B=>B.name.length));return this.times.map(B=>`${B.name.padEnd(A)} ${B.end-B.start}ms
|
|
2
2
|
`).join("")}};function Jt(g,A){let B=A?URL.parse(g,A):URL.parse(g);return/https?:/.test(B?.protocol??"")}function tQ(g){g.preventDefault()}function zB(g){g.preventDefault(),g.stopPropagation()}var Vt=class{static#A;static toDateObject(A){if(A instanceof Date)return A;if(!A||typeof A!="string")return null;this.#A||=new RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+\\-])?(\\d{2})?'?(\\d{2})?'?");let B=this.#A.exec(A);if(!B)return null;let Q=parseInt(B[1],10),C=parseInt(B[2],10);C=C>=1&&C<=12?C-1:0;let I=parseInt(B[3],10);I=I>=1&&I<=31?I:1;let E=parseInt(B[4],10);E=E>=0&&E<=23?E:0;let t=parseInt(B[5],10);t=t>=0&&t<=59?t:0;let e=parseInt(B[6],10);e=e>=0&&e<=59?e:0;let i=B[7]||"Z",s=parseInt(B[8],10);s=s>=0&&s<=23?s:0;let o=parseInt(B[9],10)||0;return o=o>=0&&o<=59?o:0,i==="-"?(E+=s,t+=o):i==="+"&&(E-=s,t-=o),new Date(Date.UTC(Q,C,I,E,t,e))}};function VI(g){if(g.startsWith("#")){let B=g.slice(1);return[parseInt(B.slice(0,2),16),parseInt(B.slice(2,4),16),parseInt(B.slice(4,6),16),B.length>=8?parseInt(B.slice(6,8),16)/255:1]}if(g.startsWith("rgb(")){let[B,Q,C]=g.slice(4,-1).split(",").map(I=>parseInt(I,10));return[B,Q,C,1]}if(g.startsWith("rgba(")){let B=g.slice(5,-1).split(",");return[parseInt(B[0],10),parseInt(B[1],10),parseInt(B[2],10),parseFloat(B[3])]}let A=g.match(/^color\(srgb\s+([\d.]+)\s+([\d.]+)\s+([\d.]+)(?:\s*\/\s*([\d.]+|none))?\)$/);return A?[Math.round(parseFloat(A[1])*255),Math.round(parseFloat(A[2])*255),Math.round(parseFloat(A[3])*255),A[4]!==void 0&&A[4]!=="none"?parseFloat(A[4]):1]:null}function EE(g){let A=VI(g);return A?A.slice(0,3):(AB(`Not a valid color format: "${g}"`),[0,0,0])}function pk(g){let A=document.createElement("span");A.style.visibility="hidden",A.style.colorScheme="only light",document.body.append(A);for(let B of g.keys()){A.style.color=B;let Q=window.getComputedStyle(A).color;g.set(B,EE(Q))}A.remove()}function UB(g){let{a:A,b:B,c:Q,d:C,e:I,f:E}=g.getTransform();return[A,B,Q,C,I,E]}function GQ(g){let{a:A,b:B,c:Q,d:C,e:I,f:E}=g.getTransform().invertSelf();return[A,B,Q,C,I,E]}function TC(g,A,B=!1,Q=!0){if(A instanceof Xt){let{pageWidth:C,pageHeight:I}=A.rawDims,{style:E}=g,t=`round(down, var(--total-scale-factor) * ${C}px, var(--scale-round-x))`,e=`round(down, var(--total-scale-factor) * ${I}px, var(--scale-round-y))`;!B||A.rotation%180===0?(E.width=t,E.height=e):(E.width=e,E.height=t)}Q&&g.setAttribute("data-main-rotation",A.rotation)}var IQ=class g{constructor(){let{pixelRatio:A}=g;this.sx=A,this.sy=A}get scaled(){return this.sx!==1||this.sy!==1}get symmetric(){return this.sx===this.sy}limitCanvas(A,B,Q,C,I=-1){let E=1/0,t=1/0,e=1/0;Q=g.capPixels(Q,I),Q>0&&(E=Math.sqrt(Q/(A*B))),C!==-1&&(t=C/A,e=C/B);let i=Math.min(E,t,e);return this.sx>i||this.sy>i?(this.sx=i,this.sy=i,!0):!1}static get pixelRatio(){return globalThis.devicePixelRatio||1}static capPixels(A,B){if(B>=0){let Q=Math.ceil(window.screen.availWidth*window.screen.availHeight*this.pixelRatio**2*(1+B/100));return A>0?Math.min(A,Q):Q}return A}},rw=new Set(["image/apng","image/avif","image/bmp","image/gif","image/jpeg","image/png","image/svg+xml","image/webp","image/x-icon"]),hw=class{static get isDarkMode(){return pA(this,"isDarkMode",!!window?.matchMedia?.("(prefers-color-scheme: dark)").matches)}},Dw=class{static get commentForegroundColor(){let A=document.createElement("span");A.classList.add("comment","sidebar");let{style:B}=A;B.width=B.height="0",B.display="none",B.color="var(--comment-fg-color)",document.body.append(A);let{color:Q}=window.getComputedStyle(A);return A.remove(),pA(this,"commentForegroundColor",EE(Q))}};function Kk(g,A){A=RB(A??1,0,1);let B=255*(1-A);return g.map(Q=>Math.round(Q*A+B))}function TM(g,A){let B=g[0]/255,Q=g[1]/255,C=g[2]/255,I=Math.max(B,Q,C),E=Math.min(B,Q,C),t=(I+E)/2;if(I===E)A[0]=A[1]=0;else{let e=I-E;switch(A[1]=t<.5?e/(I+E):e/(2-I-E),I){case B:A[0]=((Q-C)/e+(Q<C?6:0))*60;break;case Q:A[0]=((C-B)/e+2)*60;break;case C:A[0]=((B-Q)/e+4)*60;break}}A[2]=t}function lw(g,A){let B=g[0],Q=g[1],C=g[2],I=(1-Math.abs(2*C-1))*Q,E=I*(1-Math.abs(B/60%2-1)),t=C-I/2;switch(Math.floor(B/60)){case 0:A[0]=I+t,A[1]=E+t,A[2]=t;break;case 1:A[0]=E+t,A[1]=I+t,A[2]=t;break;case 2:A[0]=t,A[1]=I+t,A[2]=E+t;break;case 3:A[0]=t,A[1]=E+t,A[2]=I+t;break;case 4:A[0]=E+t,A[1]=t,A[2]=I+t;break;case 5:case 6:A[0]=I+t,A[1]=t,A[2]=E+t;break}}function Gw(g){return g<=.03928?g/12.92:((g+.055)/1.055)**2.4}function VM(g,A,B){lw(g,B),B.map(Gw);let Q=.2126*B[0]+.7152*B[1]+.0722*B[2];lw(A,B),B.map(Gw);let C=.2126*B[0]+.7152*B[1]+.0722*B[2];return Q>C?(Q+.05)/(C+.05):(C+.05)/(Q+.05)}var ZM=new Map;function Jk(g,A){let B=g[0]+g[1]*256+g[2]*65536+A[0]*16777216+A[1]*4294967296+A[2]*1099511627776,Q=ZM.get(B);if(Q)return Q;let C=new Float32Array(9),I=C.subarray(0,3),E=C.subarray(3,6);TM(g,E);let t=C.subarray(6,9);TM(A,t);let e=t[2]<.5,i=e?12:4.5;if(E[2]=e?Math.sqrt(E[2]):1-Math.sqrt(1-E[2]),VM(E,t,I)<i){let s,o;e?(s=E[2],o=1):(s=0,o=E[2]);let w=.005;for(;o-s>w;){let a=E[2]=(s+o)/2;e===VM(E,t,I)<i?s=a:o=a}E[2]=e?o:s}return lw(E,I),Q=RA.makeHexColor(Math.round(I[0]*255),Math.round(I[1]*255),Math.round(I[2]*255)),ZM.set(B,Q),Q}function Df({html:g,dir:A,className:B},Q){let C=document.createDocumentFragment();if(typeof g=="string"){let I=document.createElement("p");I.dir=A||"auto";let E=g.split(/\r\n?|\n/);for(let t=0,e=E.length;t<e;++t){let i=E[t];I.append(document.createTextNode(i)),t<e-1&&I.append(document.createElement("br"))}C.append(I)}else gi.render({xfaHtml:g,div:C,intent:"richText"});C.firstElementChild.classList.add("richText",B),Q.append(C)}function lf(g){let A=new Path2D;if(!g)return A;for(let B=0,Q=g.length;B<Q;)switch(g[B++]){case mt.moveTo:A.moveTo(g[B++],g[B++]);break;case mt.lineTo:A.lineTo(g[B++],g[B++]);break;case mt.curveTo:A.bezierCurveTo(g[B++],g[B++],g[B++],g[B++],g[B++],g[B++]);break;case mt.quadraticCurveTo:A.quadraticCurveTo(g[B++],g[B++],g[B++],g[B++]);break;case mt.closePath:A.closePath();break;default:AB(`Unrecognized drawing path operator: ${g[B-1]}`);break}return A}var Fw=class g{#A=null;#B=null;#g;#Q=null;#C=null;#I=null;#t=null;#E=null;static#e=null;constructor(A){this.#g=A,g.#e||=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",signature:"pdfjs-editor-remove-signature-button"})}render(){let A=this.#A=document.createElement("div");A.classList.add("editToolbar","hidden"),A.setAttribute("role","toolbar");let B=this.#g._uiManager._signal;B instanceof AbortSignal&&!B.aborted&&(A.addEventListener("contextmenu",tQ,{signal:B}),A.addEventListener("pointerdown",g.#i,{signal:B}));let Q=this.#Q=document.createElement("div");Q.className="buttons",A.append(Q);let C=this.#g.toolbarPosition;if(C){let{style:I}=A,E=this.#g._uiManager.direction==="ltr"?1-C[0]:C[0];I.insetInlineEnd=`${100*E}%`,I.top=`calc(${100*C[1]}% + var(--editor-toolbar-vert-offset))`}return A}get div(){return this.#A}static#i(A){A.stopPropagation()}#w(A){this.#g._focusEventsAllowed=!1,zB(A)}#s(A){this.#g._focusEventsAllowed=!0,zB(A)}#a(A){let B=this.#g._uiManager._signal;return!(B instanceof AbortSignal)||B.aborted?!1:(A.addEventListener("focusin",this.#w.bind(this),{capture:!0,signal:B}),A.addEventListener("focusout",this.#s.bind(this),{capture:!0,signal:B}),A.addEventListener("contextmenu",tQ,{signal:B}),!0)}hide(){this.#A.classList.add("hidden"),this.#B?.hideDropdown()}show(){this.#A.classList.remove("hidden"),this.#C?.shown(),this.#I?.shown()}addDeleteButton(){let{editorType:A,_uiManager:B}=this.#g,Q=document.createElement("button");Q.classList.add("basic","deleteButton"),Q.tabIndex=0,Q.setAttribute("data-l10n-id",g.#e[A]),this.#a(Q)&&Q.addEventListener("click",C=>{B.delete()},{signal:B._signal}),this.#Q.append(Q)}get#n(){let A=document.createElement("div");return A.className="divider",A}async addAltText(A){let B=await A.render();this.#a(B),this.#Q.append(B,this.#n),this.#C=A}addComment(A,B=null){if(this.#I)return;let Q=A.renderForToolbar();if(!Q)return;this.#a(Q);let C=this.#t=this.#n;B?(this.#Q.insertBefore(Q,B),this.#Q.insertBefore(C,B)):this.#Q.append(Q,C),this.#I=A,A.toolbar=this}addColorPicker(A){if(this.#B)return;this.#B=A;let B=A.renderButton();this.#a(B),this.#Q.append(B,this.#n)}async addEditSignatureButton(A){let B=this.#E=await A.renderEditButton(this.#g);B&&(this.#a(B),this.#Q.append(B,this.#n))}removeButton(A){A==="comment"&&(this.#I?.removeToolbarCommentButton(),this.#I=null,this.#t?.remove(),this.#t=null)}async addButton(A,B){switch(A){case"colorPicker":B&&this.addColorPicker(B);break;case"altText":B&&await this.addAltText(B);break;case"editSignature":B&&await this.addEditSignatureButton(B);break;case"delete":this.addDeleteButton();break;case"comment":B&&this.addComment(B);break}}async addButtonBefore(A,B,Q){if(!B&&A==="comment")return;let C=this.#Q.querySelector(Q);C&&A==="comment"&&this.addComment(B,C)}updateEditSignatureButton(A){this.#E&&(this.#E.title=A)}remove(){this.#A.remove(),this.#B?.destroy(),this.#B=null}},Mw=class{#A=null;#B=null;#g;constructor(A){this.#g=A}#Q(){let A=this.#B=document.createElement("div");A.className="editToolbar",A.setAttribute("role","toolbar"),A.dir=this.#g.direction;let B=this.#g._signal;B instanceof AbortSignal&&!B.aborted&&A.addEventListener("contextmenu",tQ,{signal:B});let Q=this.#A=document.createElement("div");return Q.className="buttons",A.append(Q),this.#g.hasCommentManager()&&this.#I("commentButton","pdfjs-comment-floating-button","pdfjs-comment-floating-button-label",()=>{this.#g.commentSelection("floating_button")}),this.#I("highlightButton","pdfjs-highlight-floating-button1","pdfjs-highlight-floating-button-label",()=>{this.#g.highlightSelection("floating_button")}),A}#C(A,B){let Q=0,C=0;for(let I of A){let E=I.y+I.height;if(E<Q)continue;let t=I.x+(B?I.width:0);if(E>Q){C=t,Q=E;continue}B?t>C&&(C=t):t<C&&(C=t)}return[B?1-C:C,Q]}show(A,B,Q){let[C,I]=this.#C(B,Q),{style:E}=this.#B||=this.#Q();A.append(this.#B),E.insetInlineEnd=`${100*C}%`,E.top=`calc(${100*I}% + var(--editor-toolbar-vert-offset))`}hide(){this.#B.remove()}#I(A,B,Q,C){let I=document.createElement("button");I.classList.add("basic",A),I.tabIndex=0,I.setAttribute("data-l10n-id",B);let E=document.createElement("span");I.append(E),E.className="visuallyHidden",E.setAttribute("data-l10n-id",Q);let t=this.#g._signal;t instanceof AbortSignal&&!t.aborted&&(I.addEventListener("contextmenu",tQ,{signal:t}),I.addEventListener("click",C,{signal:t})),this.#A.append(I)}},yk="2837668c-d334-48d1-ba74-aa7deba483da",ew=Object.freeze({internal:yk});function Gf(g,A,B){for(let Q of B)A.addEventListener(Q,g[Q].bind(g))}var og=class g{static#A=NaN;static#B=null;static#g=NaN;static#Q=null;static initializeAndAddPointerId(A){(g.#B||=new Set).add(A)}static setPointer(A,B){g.#A||=B,g.#Q??=A}static setTimeStamp(A){g.#g=A}static isSamePointerId(A){return g.#A===A}static isSamePointerIdOrRemove(A){return g.#A===A?!0:(g.#B?.delete(A),!1)}static isSamePointerType(A){return g.#Q===A}static isInitializedAndDifferentPointerType(A){return g.#Q!==null&&!g.isSamePointerType(A)}static isSameTimeStamp(A){return g.#g===A}static isUsingMultiplePointers(){return g.#B?.size>=1}static clearPointerType(){g.#Q=null}static clearPointerIds(){g.#A=NaN,g.#B=null}static clearTimeStamp(){g.#g=NaN}},fw=class{#A=0;get id(){return`${bI}${this.#A++}`}},dw=class g{#A=hf();#B=0;#g=null;static get _isSVGFittingCanvas(){let A=`data:image/svg+xml;charset=UTF-8,<svg viewBox="0 0 1 1" width="1" height="1" xmlns="${Dg}"><rect width="1" height="1" style="fill:red;"/></svg>`,Q=new OffscreenCanvas(1,3).getContext("2d",{willReadFrequently:!0}),C=new Image;C.src=A;let I=C.decode().then(()=>(Q.drawImage(C,0,0,1,1,0,0,1,3),new Uint32Array(Q.getImageData(0,0,1,1).data.buffer)[0]===0));return pA(this,"_isSVGFittingCanvas",I)}async#Q(A,B){this.#g||=new Map;let Q=this.#g.get(A);if(Q===null)return null;if(Q?.bitmap)return Q.refCounter+=1,Q;try{Q||={bitmap:null,id:`image_${this.#A}_${this.#B++}`,refCounter:0,isSvg:!1};let C;if(typeof B=="string"?(Q.url=B,C=await Qn(B,"blob")):B instanceof File?C=Q.file=B:B instanceof Blob&&(C=B),C.type==="image/svg+xml"){let I=g._isSVGFittingCanvas,E=new FileReader,t=new Image,e=new Promise((i,s)=>{t.onload=()=>{Q.bitmap=t,Q.isSvg=!0,i()},E.onload=async()=>{let o=Q.svgUrl=E.result;t.src=await I?`${o}#svgView(preserveAspectRatio(none))`:o},t.onerror=E.onerror=s});E.readAsDataURL(C),await e}else Q.bitmap=await createImageBitmap(C);Q.refCounter=1}catch(C){AB(C),Q=null}return this.#g.set(A,Q),Q&&this.#g.set(Q.id,Q),Q}async getFromFile(A){let{lastModified:B,name:Q,size:C,type:I}=A;return this.#Q(`${B}_${Q}_${C}_${I}`,A)}async getFromUrl(A){return this.#Q(A,A)}async getFromBlob(A,B){let Q=await B;return this.#Q(A,Q)}async getFromId(A){this.#g||=new Map;let B=this.#g.get(A);if(!B)return null;if(B.bitmap)return B.refCounter+=1,B;if(B.file)return this.getFromFile(B.file);if(B.blobPromise){let{blobPromise:Q}=B;return delete B.blobPromise,this.getFromBlob(B.id,Q)}return this.getFromUrl(B.url)}getFromCanvas(A,B){this.#g||=new Map;let Q=this.#g.get(A);if(Q?.bitmap)return Q.refCounter+=1,Q;let C=new OffscreenCanvas(B.width,B.height);return C.getContext("2d").drawImage(B,0,0),Q={bitmap:C.transferToImageBitmap(),id:`image_${this.#A}_${this.#B++}`,refCounter:1,isSvg:!1},this.#g.set(A,Q),this.#g.set(Q.id,Q),Q}getSvgUrl(A){let B=this.#g.get(A);return B?.isSvg?B.svgUrl:null}deleteId(A){this.#g||=new Map;let B=this.#g.get(A);if(!B||(B.refCounter-=1,B.refCounter!==0))return;let{bitmap:Q}=B;if(!B.url&&!B.file){let C=new OffscreenCanvas(Q.width,Q.height);C.getContext("bitmaprenderer").transferFromImageBitmap(Q),B.blobPromise=C.convertToBlob()}Q.close?.(),B.bitmap=null}isValidId(A){return A.startsWith(`image_${this.#A}_`)}},Yw=class{#A=[];#B=!1;#g;#Q=-1;constructor(A=128){this.#g=A}add({cmd:A,undo:B,post:Q,mustExec:C,type:I=NaN,overwriteIfSameType:E=!1,keepUndo:t=!1}){if(C&&A(),this.#B)return;let e={cmd:A,undo:B,post:Q,type:I};if(this.#Q===-1){this.#A.length>0&&(this.#A.length=0),this.#Q=0,this.#A.push(e);return}if(E&&this.#A[this.#Q].type===I){t&&(e.undo=this.#A[this.#Q].undo),this.#A[this.#Q]=e;return}let i=this.#Q+1;i===this.#g?this.#A.splice(0,1):(this.#Q=i,i<this.#A.length&&this.#A.splice(i)),this.#A.push(e)}undo(){if(this.#Q===-1)return;this.#B=!0;let{undo:A,post:B}=this.#A[this.#Q];A(),B?.(),this.#B=!1,this.#Q-=1}redo(){if(this.#Q<this.#A.length-1){this.#Q+=1,this.#B=!0;let{cmd:A,post:B}=this.#A[this.#Q];A(),B?.(),this.#B=!1}}hasSomethingToUndo(){return this.#Q!==-1}hasSomethingToRedo(){return this.#Q<this.#A.length-1}cleanType(A){if(this.#Q!==-1){for(let B=this.#Q;B>=0;B--)if(this.#A[B].type!==A){this.#A.splice(B+1,this.#Q-B),this.#Q=B;return}this.#A.length=0,this.#Q=-1}}destroy(){this.#A=null}},VC=class g{static ALT=1;static CTRL=2;static META=4;static SHIFT=8;constructor(A){this.callbacks=new Map;let{isMac:B}=lB.platform;for(let[Q,C,I={}]of A){let E=Q.some(t=>t.startsWith("mac+"));for(let t of Q){let e=t;if(E){let o=t.startsWith("mac+");if(B!==o)continue;o&&(e=t.slice(4))}let[i,s]=g.#A(e);i!==null&&this.callbacks.getOrInsertComputed(i,TI).push({callback:C,options:I,modifiers:s})}}}static#A(A){let B=null,Q=0;for(let C of A.split("+")){if(C=C.trim(),!C)continue;let I=C.toUpperCase(),E=g[I];if(E){Q|=E;continue}if(B!==null){AB(`KeyboardManager: multiple keys in shortcut "${A}"`);break}B=I==="SPACE"?" ":C}return B===null&&AB(`KeyboardManager: no key found in shortcut "${A}"`),[B,Q]}static#B(A){let B=/^(?:Key([A-Z])|(?:Digit|Numpad)(\d))$/.exec(A);return B?B[1]?.toLowerCase()??B[2]:null}exec(A,B){let Q=this.callbacks.get(B.key);if(!Q){if(/^[a-z]$/i.test(B.key))return;let s=g.#B(B.code);if(s===null||s===B.key||(Q=this.callbacks.get(s),!Q))return}let C=(B.altKey?g.ALT:0)|(B.ctrlKey?g.CTRL:0)|(B.metaKey?g.META:0)|(B.shiftKey?g.SHIFT:0),I=Q.find(s=>s.modifiers===C);if(!I)return;let{callback:E,options:{bubbles:t=!1,args:e=[],checker:i=null}}=I;i&&!i(A,B)||(E.bind(A,...e,B)(),t||zB(B))}},Uw=class g{static _colorsMapping=new Map([["CanvasText",[0,0,0]],["Canvas",[255,255,255]]]);get _colors(){let A=new Map([["CanvasText",null],["Canvas",null]]);return pk(A),pA(this,"_colors",A)}convert(A){let B=EE(A);if(!window.matchMedia("(forced-colors: active)").matches)return B;for(let[Q,C]of this._colors)if(C.every((I,E)=>I===B[E]))return g._colorsMapping.get(Q);return B}getHexCode(A){let B=this._colors.get(A);return B?RA.makeHexColor(...B):A}},ZC=class g{#A=new AbortController;#B=null;#g=null;#Q=new Map;#C=new Map;#I=null;#t=null;#E=null;#e=null;#i=null;#w=new Yw;#s=null;#a=null;#n=null;#r=0;#o=new Set;#c=null;#h=null;#D=new Set;_editorUndoBar=null;#l=!1;#G=!1;#F=!1;#f=null;#Y=null;#d=null;#R=null;#H=!1;#k=null;#u=new fw;#S=!1;#p=!1;#J=!1;#m=null;#b=null;#V=null;#N=null;#j=null;#U=zA.NONE;#M=new Set;#L=null;#T=null;#Z=null;#q=null;#x=null;#v={isEditing:!1,isEmpty:!0,hasSomethingToUndo:!1,hasSomethingToRedo:!1,hasSelectedEditor:!1,hasSelectedText:!1};#y=[0,0];#P=null;#W=null;#_=null;#$=null;#X=null;static TRANSLATE_SMALL=1;static TRANSLATE_BIG=10;static get _keyboardManager(){let A=g.prototype,B=E=>E.#W.contains(document.activeElement)&&document.activeElement.tagName!=="BUTTON"&&E.hasSomethingToControl(),Q=(E,{target:t})=>{if(t instanceof HTMLInputElement){let{type:e}=t;return e!=="text"&&e!=="number"}return!0},C=this.TRANSLATE_SMALL,I=this.TRANSLATE_BIG;return pA(this,"_keyboardManager",new VC([[["ctrl+a","mac+meta+a"],A.selectAll,{checker:Q}],[["ctrl+z","mac+meta+z"],A.undo,{checker:Q}],[["ctrl+y","ctrl+shift+z","mac+meta+shift+z","ctrl+shift+Z","mac+meta+shift+Z"],A.redo,{checker:Q}],[["Backspace","alt+Backspace","ctrl+Backspace","shift+Backspace","mac+Backspace","mac+alt+Backspace","mac+ctrl+Backspace","Delete","ctrl+Delete","shift+Delete","mac+Delete"],A.delete,{checker:Q}],[["Enter"],A.addNewEditorFromKeyboard,{checker:(E,{target:t})=>!(t instanceof HTMLButtonElement)&&E.#W.contains(t)&&!E.isEnterHandled}],[["Space"],A.addNewEditorFromKeyboard,{checker:(E,{target:t})=>!(t instanceof HTMLButtonElement)&&E.#W.contains(document.activeElement)}],[["Escape"],A.unselectAll],[["ArrowLeft"],A.translateSelectedEditors,{args:[-C,0],checker:B}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],A.translateSelectedEditors,{args:[-I,0],checker:B}],[["ArrowRight"],A.translateSelectedEditors,{args:[C,0],checker:B}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],A.translateSelectedEditors,{args:[I,0],checker:B}],[["ArrowUp"],A.translateSelectedEditors,{args:[0,-C],checker:B}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],A.translateSelectedEditors,{args:[0,-I],checker:B}],[["ArrowDown"],A.translateSelectedEditors,{args:[0,C],checker:B}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],A.translateSelectedEditors,{args:[0,I],checker:B}]]))}constructor(A,B,Q,C,I,E,t,e,i,s,o,w,a,c,n,r){let h=this._signal=this.#A.signal;this.#W=A,this.#_=B,this.#$=Q,this.#E=C,this.#s=I,this.#T=E,this.#x=e,this._eventBus=t;let D={signal:h,...ew};t.on("editingaction",this.onEditingAction.bind(this),D),t.on("pagechanging",this.onPageChanging.bind(this),D),t.on("scalechanging",this.onScaleChanging.bind(this),D),t.on("rotationchanging",this.onRotationChanging.bind(this),D),t.on("setpreference",this.onSetPreference.bind(this),D),t.on("switchannotationeditorparams",l=>this.updateParams(l.type,l.value),D),window.addEventListener("pointerdown",()=>{this.#p=!0},{capture:!0,signal:h}),window.addEventListener("pointerup",()=>{this.#p=!1},{capture:!0,signal:h}),window.addEventListener("beforeunload",this.endCurrentEditing.bind(this),{capture:!0,signal:h}),this.#eA(),this.#nA(),this.#IA(),this.#e=e.annotationStorage,this.#f=e.filterFactory,this.#Z=i,this.#R=s||null,this.#l=o,this.#G=w,this.#F=a,this.#j=c||null,this.viewParameters={realScale:wC.PDF_TO_CSS_UNITS,rotation:0},this.isShiftKeyDown=!1,this._editorUndoBar=n||null,this._supportsPinchToZoom=r!==!1,I?.setSidebarUiManager(this)}destroy(){this.#X?.resolve(),this.#X=null,this.#A?.abort(),this.#A=null,this._signal=null;for(let A of this.#C.values())A.destroy();this.#C.clear(),this.#Q.clear(),this.#D.clear(),this.#N?.clear(),this.#B=null,this.#M.clear(),this.#w.destroy(),this.#E?.destroy(),this.#s?.destroy(),this.#T?.destroy(),this.#k?.hide(),this.#k=null,this.#V?.destroy(),this.#V=null,this.#g=null,this.#Y&&(clearTimeout(this.#Y),this.#Y=null),this.#P&&(clearTimeout(this.#P),this.#P=null),this._editorUndoBar?.destroy(),this.#x=null}combinedSignal(A){return AbortSignal.any([this._signal,A.signal])}get mlManager(){return this.#j}get useNewAltTextFlow(){return this.#G}get useNewAltTextWhenAddingImage(){return this.#F}get hcmFilter(){return pA(this,"hcmFilter",this.#Z?this.#f.addHCMFilter(this.#Z.foreground,this.#Z.background):"none")}get direction(){return pA(this,"direction",getComputedStyle(this.#W).direction)}get _highlightColors(){return pA(this,"_highlightColors",this.#R?new Map(this.#R.split(",").map(A=>(A=A.split("=").map(B=>B.trim()),A[1]=A[1].toUpperCase(),A))):null)}get highlightColors(){let{_highlightColors:A}=this;if(!A)return pA(this,"highlightColors",null);let B=new Map,Q=!!this.#Z;for(let[C,I]of A){let E=C.endsWith("_HCM");if(Q&&E){B.set(C.replace("_HCM",""),I);continue}!Q&&!E&&B.set(C,I)}return pA(this,"highlightColors",B)}get highlightColorNames(){return pA(this,"highlightColorNames",this.highlightColors?new Map(Array.from(this.highlightColors,A=>A.reverse())):null)}getNonHCMColor(A){if(!this._highlightColors)return A;let B=this.highlightColorNames.get(A);return this._highlightColors.get(B)||A}getNonHCMColorName(A){return this.highlightColorNames.get(A)||A}setCurrentDrawingSession(A){A?(this.unselectAll(),this.disableUserSelect(!0)):this.disableUserSelect(!1),this.#n=A}setMainHighlightColorPicker(A){this.#V=A}editAltText(A,B=!1){this.#E?.editAltText(this,A,B)}hasCommentManager(){return!!this.#s}editComment(A,B,Q,C){this.#s?.showDialog(this,A,B,Q,C)}selectComment(A,B){this.#C.get(A)?.getEditorByUID(B)?.toggleComment(!0,!0)}updateComment(A){this.#s?.updateComment(A.getData())}updatePopupColor(A){this.#s?.updatePopupColor(A)}removeComment(A){this.#s?.removeComments([A.uid])}deleteComment(A,B){let Q=()=>{A.comment=B},C=()=>{this._editorUndoBar?.show(Q,"comment"),this.toggleComment(null),A.comment=null};this.addCommands({cmd:C,undo:Q,mustExec:!0})}toggleComment(A,B,Q=void 0){this.#s?.toggleCommentPopup(A,B,Q)}makeCommentColor(A,B){return A&&this.#s?.makeCommentColor(A,B)||null}getCommentDialogElement(){return this.#s?.dialogElement||null}async waitForEditorsRendered(A){if(this.#C.has(A-1))return;let{resolve:B,promise:Q}=Promise.withResolvers(),C=I=>{I.pageNumber===A&&(this._eventBus.off("editorsrendered",C),B())};this._eventBus.on("editorsrendered",C,ew),await Q}getSignature(A){this.#T?.getSignature({uiManager:this,editor:A})}get signatureManager(){return this.#T}switchToMode(A,B){this._eventBus.on("annotationeditormodechanged",B,{once:!0,signal:this._signal,...ew}),this._eventBus.dispatch("showannotationeditorui",{source:this,mode:A})}setPreference(A,B){this._eventBus.dispatch("setpreference",{source:this,name:A,value:B})}onSetPreference({name:A,value:B}){A==="enableNewAltTextWhenAddingImage"&&(this.#F=B)}onPageChanging({pageNumber:A}){this.#r=A-1}deletePage(A){for(let B of this.getEditors(A))B.remove();this.#C.delete(A),this.#r===A&&(this.#r=0)}focusMainContainer(){this.#W.focus()}findParent(A,B){for(let Q of this.#C.values()){let{x:C,y:I,width:E,height:t}=Q.div.getBoundingClientRect();if(A>=C&&A<=C+E&&B>=I&&B<=I+t)return Q}return null}disableUserSelect(A=!1){this.#_.classList.toggle("noUserSelect",A)}addShouldRescale(A){this.#D.add(A)}removeShouldRescale(A){this.#D.delete(A)}onScaleChanging({scale:A}){this.commitOrRemove(),this.viewParameters.realScale=A*wC.PDF_TO_CSS_UNITS;for(let B of this.#D)B.onScaleChanging();this.#n?.onScaleChanging()}onRotationChanging({pagesRotation:A}){this.commitOrRemove(),this.viewParameters.rotation=A}#z({anchorNode:A}){return A.nodeType===Node.TEXT_NODE?A.parentElement:A}#AA(A){let{currentLayer:B}=this;if(B.hasTextLayer(A))return B;for(let Q of this.#C.values())if(Q.hasTextLayer(A))return Q;return null}highlightSelection(A="",B=!1){let Q=document.getSelection();if(!Q||Q.isCollapsed)return;let{anchorNode:C,anchorOffset:I,focusNode:E,focusOffset:t}=Q,e=Q.toString(),s=this.#z(Q).closest(".textLayer"),o=this.getSelectionBoxes(s);if(!o)return;Q.empty();let w=this.#AA(s),a=this.#U===zA.NONE,c=()=>{let n=w?.createAndAddNewEditor({x:0,y:0},!1,{methodOfCreation:A,boxes:o,anchorNode:C,anchorOffset:I,focusNode:E,focusOffset:t,text:e});a&&this.showAllEditors("highlight",!0,!0),B&&n?.editComment()};if(a){this.switchToMode(zA.HIGHLIGHT,c);return}c()}commentSelection(A=""){this.highlightSelection(A,!0)}endCurrentEditing(){this.commitOrRemove(),this.currentLayer?.endDrawingSession(!1)}#QA(){let A=document.getSelection();if(!A||A.isCollapsed)return;let Q=this.#z(A).closest(".textLayer"),C=this.getSelectionBoxes(Q);C&&(this.#k||=new Mw(this),this.#k.show(Q,C,this.direction==="ltr"))}getAndRemoveDataFromAnnotationStorage(A){if(!this.#e)return null;let B=`${bI}${A}`,Q=this.#e.getRawValue(B);return Q&&this.#e.remove(B),Q}addToAnnotationStorage(A){!A.isEmpty()&&this.#e&&!this.#e.has(A.id)&&this.#e.setValue(A.id,A)}a11yAlert(A,B=null){let Q=this.#$;Q&&(Q.setAttribute("data-l10n-id",A),B?Q.setAttribute("data-l10n-args",JSON.stringify(B)):Q.removeAttribute("data-l10n-args"))}#CA(){let A=document.getSelection();if(!A||A.isCollapsed){this.#L&&(this.#k?.hide(),this.#L=null,this.#K({hasSelectedText:!1}));return}let{anchorNode:B}=A;if(B===this.#L)return;let C=this.#z(A).closest(".textLayer");if(!C){this.#L&&(this.#k?.hide(),this.#L=null,this.#K({hasSelectedText:!1}));return}if(this.#k?.hide(),this.#L=B,this.#K({hasSelectedText:!0}),!(this.#U!==zA.HIGHLIGHT&&this.#U!==zA.NONE)&&(this.#U===zA.HIGHLIGHT&&this.showAllEditors("highlight",!0,!0),this.#H=this.isShiftKeyDown,!this.isShiftKeyDown)){let I=this.#U===zA.HIGHLIGHT?this.#AA(C):null;if(I?.toggleDrawing(),this.#p){let E=new AbortController,t=this.combinedSignal(E),e=i=>{i.type==="pointerup"&&i.button!==0||(E.abort(),I?.toggleDrawing(!0),i.type==="pointerup"&&this.#BA("main_toolbar"))};window.addEventListener("pointerup",e,{signal:t}),window.addEventListener("blur",e,{signal:t})}else I?.toggleDrawing(!0),this.#BA("main_toolbar")}}#BA(A=""){this.#U===zA.HIGHLIGHT?this.highlightSelection(A):this.#l&&this.#QA()}#eA(){document.addEventListener("selectionchange",this.#CA.bind(this),{signal:this._signal})}#iA(){if(this.#d)return;this.#d=new AbortController;let A=this.combinedSignal(this.#d);window.addEventListener("focus",this.focus.bind(this),{signal:A}),window.addEventListener("blur",this.blur.bind(this),{signal:A})}#sA(){this.#d?.abort(),this.#d=null}blur(){if(this.isShiftKeyDown=!1,this.#H&&(this.#H=!1,this.#BA("main_toolbar")),!this.hasSelection)return;let{activeElement:A}=document;for(let B of this.#M)if(B.div.contains(A)){this.#b=[B,A],B._focusEventsAllowed=!1;break}}focus(){if(!this.#b)return;let[A,B]=this.#b;this.#b=null,B.addEventListener("focusin",()=>{A._focusEventsAllowed=!0},{once:!0,signal:this._signal}),B.focus()}#IA(){if(this.#m)return;this.#m=new AbortController;let A=this.combinedSignal(this.#m);window.addEventListener("keydown",this.keydown.bind(this),{signal:A}),window.addEventListener("keyup",this.keyup.bind(this),{signal:A})}#oA(){this.#m?.abort(),this.#m=null}#wA(){if(this.#a)return;this.#a=new AbortController;let A=this.combinedSignal(this.#a);document.addEventListener("copy",this.copy.bind(this),{signal:A}),document.addEventListener("cut",this.cut.bind(this),{signal:A}),document.addEventListener("paste",this.paste.bind(this),{signal:A})}#aA(){this.#a?.abort(),this.#a=null}#nA(){let A=this._signal;document.addEventListener("dragover",this.dragOver.bind(this),{signal:A}),document.addEventListener("drop",this.drop.bind(this),{signal:A})}addEditListeners(){this.#IA(),this.setEditingState(!0)}removeEditListeners(){this.#oA(),this.setEditingState(!1)}dragOver(A){for(let{type:B}of A.dataTransfer.items)for(let Q of this.#h)if(Q.isHandlingMimeForPasting(B)){A.dataTransfer.dropEffect="copy",A.preventDefault();return}}drop(A){for(let B of A.dataTransfer.items)for(let Q of this.#h)if(Q.isHandlingMimeForPasting(B.type)){Q.paste(B,this.currentLayer),A.preventDefault();return}}copy(A){if(A.preventDefault(),this.#B?.commitOrRemove(),!this.hasSelection)return;let B=[];for(let Q of this.#M){let C=Q.serialize(!0);C&&B.push(C)}B.length!==0&&A.clipboardData.setData("application/pdfjs",JSON.stringify(B))}cut(A){this.copy(A),this.delete()}async paste(A){A.preventDefault();let{clipboardData:B}=A;for(let I of B.items)for(let E of this.#h)if(E.isHandlingMimeForPasting(I.type)){E.paste(I,this.currentLayer);return}let Q=B.getData("application/pdfjs");if(!Q)return;try{Q=JSON.parse(Q)}catch(I){AB(`paste: "${I.message}".`);return}if(!Array.isArray(Q))return;this.unselectAll();let C=this.currentLayer;try{let I=[];for(let e of Q){let i=await C.deserialize(e);if(!i)return;I.push(i)}let E=()=>{for(let e of I)this.#tA(e);this.#EA(I)},t=()=>{for(let e of I)e.remove()};this.addCommands({cmd:E,undo:t,mustExec:!0})}catch(I){AB(`paste: "${I.message}".`)}}keydown(A){!this.isShiftKeyDown&&A.key==="Shift"&&(this.isShiftKeyDown=!0),this.#U!==zA.NONE&&!this.isEditorHandlingKeyboard&&g._keyboardManager.exec(this,A)}keyup(A){this.isShiftKeyDown&&A.key==="Shift"&&(this.isShiftKeyDown=!1,this.#H&&(this.#H=!1,this.#BA("main_toolbar")))}onEditingAction({name:A}){switch(A){case"undo":case"redo":case"delete":case"selectAll":this[A]();break;case"highlightSelection":this.highlightSelection("context_menu");break;case"commentSelection":this.commentSelection("context_menu");break}}updatePageIndex(A,B){for(let C of this.#t.get(A)||[])C.pageIndex=B;let Q=this.#I.get(A);Q&&(Q.pageIndex=B,this.#C.set(B,Q),this.#S?Q.enable():Q.disable())}startUpdatePages(){this.#I=new Map(this.#C),this.#C.clear();let A=this.#t=new Map,B=Q=>{A.getOrInsertComputed(Q.pageIndex,TI).push(Q)};for(let Q of this.#Q.values())B(Q);for(let[Q,C]of this.#e)Q.startsWith(bI)&&!this.#Q.has(Q)&&Number.isInteger(C?.pageIndex)&&B(C)}endUpdatePages(){this.#I=null,this.#t=null}clonePage(A,B){for(let Q of this.getEditors(A)){let C=Q.serialize(Q.mode!==zA.HIGHLIGHT);C&&(C.pageIndex=B,C.id=this.getId(),C.isClone=!0,delete C.popupRef,this.#e.setValue(C.id,C))}}findClonesForPage(A){let B=[],{pageIndex:Q}=A;for(let[C,I]of this.#e)I.pageIndex===Q&&I.isClone&&(this.#e.remove(C),B.push(A.deserialize(I).then(E=>{E&&(E.isClone=!0,A.addOrRebuild(E))})));return Promise.all(B)}#K(A){Object.entries(A).some(([Q,C])=>this.#v[Q]!==C)&&(this._eventBus.dispatch("editingstateschanged",{source:this,details:Object.assign(this.#v,A)}),this.#U===zA.HIGHLIGHT&&A.hasSelectedEditor===!1&&this.#O([[sB.HIGHLIGHT_FREE,!0]]))}#O(A){this._eventBus.dispatch("annotationeditorparamschanged",{source:this,details:A})}setEditingState(A){A?(this.#iA(),this.#wA(),this.#K({isEditing:this.#U!==zA.NONE,isEmpty:this.#gA(),hasSomethingToUndo:this.#w.hasSomethingToUndo(),hasSomethingToRedo:this.#w.hasSomethingToRedo(),hasSelectedEditor:!1})):(this.#sA(),this.#aA(),this.#K({isEditing:!1}),this.disableUserSelect(!1))}registerEditorTypes(A){if(!this.#h){this.#h=A;for(let B of this.#h)this.#O(B.defaultPropertiesToUpdate)}}getId(){return this.#u.id}get currentLayer(){return this.#C.get(this.#r)}getLayer(A){return this.#C.get(A)}get currentPageIndex(){return this.#r}addLayer(A){this.#C.set(A.pageIndex,A),this.#S?A.enable():A.disable()}removeLayer(A){this.#C.delete(A.pageIndex)}async updateMode(A,B=null,Q=!1,C=!1,I=!1,E=!1){if(this.#U!==A&&!(this.#X&&(await this.#X.promise,!this.#X))){if(this.#X=Promise.withResolvers(),this.#n?.commitOrRemove(),this.#U===zA.POPUP&&this.#s?.hideSidebar(),this.#s?.destroyPopup(),this.#U=A,A===zA.NONE){this.setEditingState(!1),this.#rA();for(let t of this.#Q.values())t.hideStandaloneCommentButton();this._editorUndoBar?.hide(),this.toggleComment(null),this.#X.resolve();return}for(let t of this.#Q.values())t.addStandaloneCommentButton();A===zA.SIGNATURE&&await this.#T?.loadSignatures(),Q&&og.clearPointerType(),this.setEditingState(!0),await this.#cA(),this.unselectAll();for(let t of this.#C.values())t.updateMode(A);if(A===zA.POPUP){this.#g||=await this.#x.getAnnotationsByType(new Set(this.#h.map(i=>i._editorType)));let t=new Set,e=[];for(let i of this.#Q.values()){let{annotationElementId:s,hasComment:o,deleted:w}=i;s&&t.add(s),o&&!w&&e.push(i.getData())}for(let i of this.#g){let{id:s,popupRef:o,contentsObj:w}=i;o&&w?.str&&!t.has(s)&&!this.#o.has(s)&&e.push(i)}this.#s?.showSidebar(e)}if(!B){C&&this.addNewEditorFromKeyboard(),this.#X.resolve();return}for(let t of this.#Q.values())t.uid===B?(this.setSelected(t),E?t.editComment():I?t.enterInEditMode():t.focus()):t.unselect();this.#X.resolve()}}addNewEditorFromKeyboard(){this.currentLayer.canCreateNewEmptyEditor()&&this.currentLayer.addNewEditor()}updateToolbar(A){A.mode!==this.#U&&this._eventBus.dispatch("switchannotationeditormode",{source:this,...A})}updateParams(A,B){if(this.#h){switch(A){case sB.CREATE:this.currentLayer.addNewEditor(B);return;case sB.HIGHLIGHT_SHOW_ALL:this._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:{type:"highlight",action:"toggle_visibility"}}}),(this.#q||=new Map).set(A,B),this.showAllEditors("highlight",B);break}if(this.hasSelection)for(let Q of this.#M)Q.updateParams(A,B);else for(let Q of this.#h)Q.updateDefaultParams(A,B)}}showAllEditors(A,B,Q=!1){for(let I of this.#Q.values())I.editorType===A&&I.show(B);(this.#q?.get(sB.HIGHLIGHT_SHOW_ALL)??!0)!==B&&this.#O([[sB.HIGHLIGHT_SHOW_ALL,B]])}enableWaiting(A=!1){if(this.#J!==A){this.#J=A;for(let B of this.#C.values())A?B.disableClick():B.enableClick(),B.div.classList.toggle("waiting",A)}}async#cA(){if(!this.#S){this.#S=!0;let A=[];for(let B of this.#C.values())A.push(B.enable());await Promise.all(A);for(let B of this.#Q.values())B.enable()}}#rA(){if(this.unselectAll(),this.#S){this.#S=!1;for(let A of this.#C.values())A.disable();for(let A of this.#Q.values())A.disable()}}*getEditors(A){for(let B of this.#Q.values())B.pageIndex===A&&(yield B)}getEditor(A){return this.#Q.get(A)}addEditor(A){this.#Q.set(A.id,A)}removeEditor(A){A.div.contains(document.activeElement)&&(this.#Y&&clearTimeout(this.#Y),this.#Y=setTimeout(()=>{this.focusMainContainer(),this.#Y=null},0)),this.#Q.delete(A.id),A.annotationElementId&&this.#N?.delete(A.annotationElementId),this.unselect(A),(!A.annotationElementId||!this.#o.has(A.annotationElementId))&&this.#e?.remove(A.id)}addDeletedAnnotationElement(A){this.#o.add(A.annotationElementId),this.addChangedExistingAnnotation(A),A.deleted=!0}isDeletedAnnotationElement(A){return this.#o.has(A)}removeDeletedAnnotationElement(A){this.#o.delete(A.annotationElementId),this.removeChangedExistingAnnotation(A),A.deleted=!1}#tA(A){let B=this.#C.get(A.pageIndex);B?B.addOrRebuild(A):(this.addEditor(A),this.addToAnnotationStorage(A))}setActiveEditor(A){this.#B!==A&&(this.#B=A,A&&this.#O(A.propertiesToUpdate))}get#hA(){let A=null;for(A of this.#M);return A}updateUI(A){this.#hA===A&&this.#O(A.propertiesToUpdate)}updateUIForDefaultProperties(A){this.#O(A.defaultPropertiesToUpdate)}toggleSelected(A){if(this.#M.has(A)){this.#M.delete(A),A.unselect(),this.#K({hasSelectedEditor:this.hasSelection});return}this.#M.add(A),A.select(),this.#O(A.propertiesToUpdate),this.#K({hasSelectedEditor:!0})}setSelected(A){this.updateToolbar({mode:A.mode,editId:A.uid}),this.#n?.commitOrRemove();for(let B of this.#M)B!==A&&B.unselect();this.#s?.destroyPopup(),this.#M.clear(),this.#M.add(A),A.select(),this.#O(A.propertiesToUpdate),this.#K({hasSelectedEditor:!0})}get firstSelectedEditor(){return this.#M.values().next().value}unselect(A){A.unselect(),this.#M.delete(A),this.#K({hasSelectedEditor:this.hasSelection})}get hasSelection(){return this.#M.size!==0}get isEnterHandled(){return this.#M.size===1&&this.firstSelectedEditor.isEnterHandled}undo(){this.#w.undo(),this.#K({hasSomethingToUndo:this.#w.hasSomethingToUndo(),hasSomethingToRedo:!0,isEmpty:this.#gA()}),this._editorUndoBar?.hide()}redo(){this.#w.redo(),this.#K({hasSomethingToUndo:!0,hasSomethingToRedo:this.#w.hasSomethingToRedo(),isEmpty:this.#gA()})}addCommands(A){this.#w.add(A),this.#K({hasSomethingToUndo:!0,hasSomethingToRedo:!1,isEmpty:this.#gA()})}cleanUndoStack(A){this.#w.cleanType(A)}#gA(){if(this.#Q.size===0)return!0;if(this.#Q.size===1)for(let A of this.#Q.values())return A.isEmpty();return!1}delete(){this.commitOrRemove();let A=this.currentLayer?.endDrawingSession(!0);if(!this.hasSelection&&!A)return;let B=A?[A]:[...this.#M],Q=()=>{this._editorUndoBar?.show(C,B.length===1?B[0].editorType:B.length);for(let I of B)I.remove()},C=()=>{for(let I of B)this.#tA(I)};this.addCommands({cmd:Q,undo:C,mustExec:!0})}commitOrRemove(){this.#B?.commitOrRemove()}hasSomethingToControl(){return this.#B||this.hasSelection}#EA(A){for(let B of this.#M)B.unselect();this.#M.clear();for(let B of A)B.isEmpty()||(this.#M.add(B),B.select());this.#K({hasSelectedEditor:this.hasSelection})}selectAll(){for(let A of this.#M)A.commit();this.#EA(this.#Q.values())}unselectAll(){if(!(this.#B&&(this.#B.commitOrRemove(),this.#U!==zA.NONE))&&!this.#n?.commitOrRemove()&&(this.#s?.destroyPopup(),!!this.hasSelection)){for(let A of this.#M)A.unselect();this.#M.clear(),this.#K({hasSelectedEditor:!1})}}translateSelectedEditors(A,B,Q=!1){if(Q||this.commitOrRemove(),!this.hasSelection)return;this.#y[0]+=A,this.#y[1]+=B;let[C,I]=this.#y,E=[...this.#M],t=1e3;this.#P&&clearTimeout(this.#P),this.#P=setTimeout(()=>{this.#P=null,this.#y[0]=this.#y[1]=0,this.addCommands({cmd:()=>{for(let e of E)this.#Q.has(e.id)&&(e.translateInPage(C,I),e.translationDone())},undo:()=>{for(let e of E)this.#Q.has(e.id)&&(e.translateInPage(-C,-I),e.translationDone())},mustExec:!1})},t);for(let e of E)e.translateInPage(A,B),e.translationDone()}setUpDragSession(){if(this.hasSelection){this.disableUserSelect(!0),this.#c=new Map;for(let A of this.#M)this.#c.set(A,{savedX:A.x,savedY:A.y,savedPageIndex:A.pageIndex,newX:0,newY:0,newPageIndex:-1})}}endDragSession(){if(!this.#c)return!1;this.disableUserSelect(!1);let A=this.#c;this.#c=null;let B=!1;for(let[{x:C,y:I,pageIndex:E},t]of A)t.newX=C,t.newY=I,t.newPageIndex=E,B||=C!==t.savedX||I!==t.savedY||E!==t.savedPageIndex;if(!B)return!1;let Q=(C,I,E,t)=>{if(this.#Q.has(C.id)){let e=this.#C.get(t);e?C._setParentAndPosition(e,I,E):(C.pageIndex=t,C.x=I,C.y=E)}};return this.addCommands({cmd:()=>{for(let[C,{newX:I,newY:E,newPageIndex:t}]of A)Q(C,I,E,t)},undo:()=>{for(let[C,{savedX:I,savedY:E,savedPageIndex:t}]of A)Q(C,I,E,t)},mustExec:!0}),!0}dragSelectedEditors(A,B){if(this.#c)for(let Q of this.#c.keys())Q.drag(A,B)}rebuild(A){if(A.parent===null){let B=this.getLayer(A.pageIndex);B?(B.changeParent(A),B.addOrRebuild(A)):(this.addEditor(A),this.addToAnnotationStorage(A),A.rebuild())}else A.parent.addOrRebuild(A)}get isEditorHandlingKeyboard(){return this.getActive()?.shouldGetKeyboardEvents()||this.#M.size===1&&this.firstSelectedEditor.shouldGetKeyboardEvents()}isActive(A){return this.#B===A}getActive(){return this.#B}getMode(){return this.#U}isEditingMode(){return this.#U!==zA.NONE}get imageManager(){return pA(this,"imageManager",new dw)}getSelectionBoxes(A){if(!A)return null;let B=document.getSelection();for(let i=0,s=B.rangeCount;i<s;i++)if(!A.contains(B.getRangeAt(i).commonAncestorContainer))return null;let{x:Q,y:C,width:I,height:E}=A.getBoundingClientRect(),t;switch(A.getAttribute("data-main-rotation")){case"90":t=(i,s,o,w)=>({x:(s-C)/E,y:1-(i+o-Q)/I,width:w/E,height:o/I});break;case"180":t=(i,s,o,w)=>({x:1-(i+o-Q)/I,y:1-(s+w-C)/E,width:o/I,height:w/E});break;case"270":t=(i,s,o,w)=>({x:1-(s+w-C)/E,y:(i-Q)/I,width:w/E,height:o/I});break;default:t=(i,s,o,w)=>({x:(i-Q)/I,y:(s-C)/E,width:o/I,height:w/E});break}let e=[];for(let i=0,s=B.rangeCount;i<s;i++){let o=B.getRangeAt(i);if(!o.collapsed)for(let{x:w,y:a,width:c,height:n}of o.getClientRects())c===0||n===0||e.push(t(w,a,c,n))}return e.length===0?null:e}addChangedExistingAnnotation({annotationElementId:A,id:B}){(this.#i||=new Map).set(A,B)}removeChangedExistingAnnotation({annotationElementId:A}){this.#i?.delete(A)}renderAnnotationElement(A){let B=this.#i?.get(A.data.id);if(!B)return;let Q=this.#e.getRawValue(B);Q&&(this.#U===zA.NONE&&!Q.hasBeenModified||Q.renderAnnotationElement(A))}setMissingCanvas(A,B,Q){let C=this.#N?.get(A);C&&(C.setCanvas(B,Q),this.#N.delete(A))}addMissingCanvas(A,B){(this.#N||=new Map).set(A,B)}},Ci=class g{#A=null;#B=!1;#g=null;#Q=null;#C=null;#I=null;#t=!1;#E=null;#e=null;#i=null;#w=null;#s=!1;static#a=null;static _l10n=null;constructor(A){this.#e=A,this.#s=A._uiManager.useNewAltTextFlow,g.#a||=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(A){g._l10n??=A}async render(){let A=this.#g=document.createElement("button");A.className="altText",A.tabIndex="0";let B=this.#Q=document.createElement("span");A.append(B),this.#s?(A.classList.add("new"),A.setAttribute("data-l10n-id",g.#a.missing),B.setAttribute("data-l10n-id",g.#a["missing-label"])):(A.setAttribute("data-l10n-id","pdfjs-editor-alt-text-button"),B.setAttribute("data-l10n-id","pdfjs-editor-alt-text-button-label"));let Q=this.#e._uiManager._signal;A.addEventListener("contextmenu",tQ,{signal:Q}),A.addEventListener("pointerdown",I=>I.stopPropagation(),{signal:Q});let C=I=>{I.preventDefault(),this.#e._uiManager.editAltText(this.#e),this.#s&&this.#e._reportTelemetry({action:"pdfjs.image.alt_text.image_status_label_clicked",data:{label:this.#n}})};return A.addEventListener("click",C,{capture:!0,signal:Q}),A.addEventListener("keydown",I=>{I.target===A&&I.key==="Enter"&&(this.#t=!0,C(I))},{signal:Q}),await this.#r(),A}get#n(){return this.#A&&"added"||this.#A===null&&this.guessedText&&"review"||"missing"}finish(){this.#g&&(this.#g.focus({focusVisible:this.#t}),this.#t=!1)}isEmpty(){return this.#s?this.#A===null:!this.#A&&!this.#B}hasData(){return this.#s?this.#A!==null||!!this.#i:this.isEmpty()}get guessedText(){return this.#i}async setGuessedText(A){this.#A===null&&(this.#i=A,this.#w=await g._l10n.get("pdfjs-editor-new-alt-text-generated-alt-text-with-disclaimer",{generatedAltText:A}),this.#r())}toggleAltTextBadge(A=!1){if(!this.#s||this.#A){this.#E?.remove(),this.#E=null;return}if(!this.#E){let B=this.#E=document.createElement("div");B.className="noAltTextBadge",this.#e.div.append(B)}this.#E.classList.toggle("hidden",!A)}serialize(A){let B=this.#A;return!A&&this.#i===B&&(B=this.#w),{altText:B,decorative:this.#B,guessedText:this.#i,textWithDisclaimer:this.#w}}get data(){return{altText:this.#A,decorative:this.#B}}set data({altText:A,decorative:B,guessedText:Q,textWithDisclaimer:C,cancel:I=!1}){Q&&(this.#i=Q,this.#w=C),!(this.#A===A&&this.#B===B)&&(I||(this.#A=A,this.#B=B),this.#r())}toggle(A=!1){this.#g&&(!A&&this.#I&&(clearTimeout(this.#I),this.#I=null),this.#g.disabled=!A)}shown(){this.#e._reportTelemetry({action:"pdfjs.image.alt_text.image_status_label_displayed",data:{label:this.#n}})}destroy(){this.#g?.remove(),this.#g=null,this.#Q=null,this.#C=null,this.#E?.remove(),this.#E=null}async#r(){let A=this.#g;if(!A)return;if(this.#s){if(A.classList.toggle("done",!!this.#A),A.setAttribute("data-l10n-id",g.#a[this.#n]),this.#Q?.setAttribute("data-l10n-id",g.#a[`${this.#n}-label`]),!this.#A){this.#C?.remove();return}}else{if(!this.#A&&!this.#B){A.classList.remove("done"),this.#C?.remove();return}A.classList.add("done"),A.setAttribute("data-l10n-id","pdfjs-editor-alt-text-edit-button")}let B=this.#C;if(!B){this.#C=B=document.createElement("span"),B.className="tooltip",B.setAttribute("role","tooltip"),B.id=`alt-text-tooltip-${this.#e.id}`;let C=100,I=this.#e._uiManager._signal;I.addEventListener("abort",()=>{clearTimeout(this.#I),this.#I=null},{once:!0}),A.addEventListener("mouseenter",()=>{this.#I=setTimeout(()=>{this.#I=null,this.#C.classList.add("show"),this.#e._reportTelemetry({action:"alt_text_tooltip"})},C)},{signal:I}),A.addEventListener("mouseleave",()=>{this.#I&&(clearTimeout(this.#I),this.#I=null),this.#C?.classList.remove("show")},{signal:I})}this.#B?B.setAttribute("data-l10n-id","pdfjs-editor-alt-text-decorative-tooltip"):(B.removeAttribute("data-l10n-id"),B.textContent=this.#A),B.parentNode||A.append(B),this.#e.getElementForAltText()?.setAttribute("aria-describedby",B.id)}},JI=class{#A=null;#B=null;#g=!1;#Q=null;#C=null;#I=null;#t=null;#E=null;#e=!1;#i=null;constructor(A){this.#Q=A}renderForToolbar(){let A=this.#B=document.createElement("button");return A.className="comment",this.#w(A,!1)}renderForStandalone(){let A=this.#A=document.createElement("button");A.className="annotationCommentButton";let B=this.#Q.commentButtonPosition;if(B){let{style:Q}=A;Q.insetInlineEnd=`calc(${100*(this.#Q._uiManager.direction==="ltr"?1-B[0]:B[0])}% - var(--comment-button-dim))`,Q.top=`calc(${100*B[1]}% - var(--comment-button-dim))`;let C=this.#Q.commentButtonColor;C&&(Q.backgroundColor=C)}return this.#w(A,!0)}focusButton(){setTimeout(()=>{(this.#A??this.#B)?.focus()},0)}onUpdatedColor(){if(!this.#A)return;let A=this.#Q.commentButtonColor;A&&(this.#A.style.backgroundColor=A),this.#Q._uiManager.updatePopupColor(this.#Q)}get commentButtonWidth(){return(this.#A?.getBoundingClientRect().width??0)/this.#Q.parent.boundingClientRect.width}get commentPopupPositionInLayer(){if(this.#i)return this.#i;if(!this.#A)return null;let{x:A,y:B,height:Q}=this.#A.getBoundingClientRect(),{x:C,y:I,width:E,height:t}=this.#Q.parent.boundingClientRect;return[(A-C)/E,(B+Q-I)/t]}set commentPopupPositionInLayer(A){this.#i=A}hasDefaultPopupPosition(){return this.#i===null}removeStandaloneCommentButton(){this.#A?.remove(),this.#A=null}removeToolbarCommentButton(){this.#B?.remove(),this.#B=null}setCommentButtonStates({selected:A,hasPopup:B}){this.#A&&(this.#A.classList.toggle("selected",A),this.#A.ariaExpanded=B)}#w(A,B){if(!this.#Q._uiManager.hasCommentManager())return null;A.tabIndex="0",A.ariaHasPopup="dialog",B?(A.ariaControls="commentPopup",A.setAttribute("data-l10n-id","pdfjs-show-comment-button")):(A.ariaControlsElements=[this.#Q._uiManager.getCommentDialogElement()],A.setAttribute("data-l10n-id","pdfjs-editor-add-comment-button"));let Q=this.#Q._uiManager._signal;if(!(Q instanceof AbortSignal)||Q.aborted)return A;A.addEventListener("contextmenu",tQ,{signal:Q}),B&&(A.addEventListener("focusin",I=>{this.#Q._focusEventsAllowed=!1,zB(I)},{capture:!0,signal:Q}),A.addEventListener("focusout",I=>{this.#Q._focusEventsAllowed=!0,zB(I)},{capture:!0,signal:Q})),A.addEventListener("pointerdown",I=>I.stopPropagation(),{signal:Q});let C=I=>{I.preventDefault(),A===this.#B?this.edit():this.#Q.toggleComment(!0)};return A.addEventListener("click",C,{capture:!0,signal:Q}),A.addEventListener("keydown",I=>{I.target===A&&I.key==="Enter"&&(this.#g=!0,C(I))},{signal:Q}),A.addEventListener("pointerenter",()=>{this.#Q.toggleComment(!1,!0)},{signal:Q}),A.addEventListener("pointerleave",()=>{this.#Q.toggleComment(!1,!1)},{signal:Q}),A}edit(A){let B=this.commentPopupPositionInLayer,Q,C;if(B)[Q,C]=B;else{[Q,C]=this.#Q.commentButtonPosition;let{width:s,height:o,x:w,y:a}=this.#Q;Q=w+Q*s,C=a+C*o}let I=this.#Q.parent.boundingClientRect,{x:E,y:t,width:e,height:i}=I;this.#Q._uiManager.editComment(this.#Q,E+Q*e,t+C*i,{...A,parentDimensions:I})}finish(){this.#B&&(this.#B.focus({focusVisible:this.#g}),this.#g=!1)}isDeleted(){return this.#e||this.#t===""}isEmpty(){return this.#t===null}hasBeenEdited(){return this.isDeleted()||this.#t!==this.#C}serialize(){return this.data}get data(){return{text:this.#t,richText:this.#I,date:this.#E,deleted:this.isDeleted()}}set data(A){if(A!==this.#t&&(this.#I=null),A===null){this.#t="",this.#e=!0;return}this.#t=A,this.#E=new Date,this.#e=!1}restoreData({text:A,richText:B,date:Q}){this.#t=A,this.#I=B,this.#E=Q,this.#e=!1}setInitialText(A,B=null){this.#C=A,this.data=A,this.#E=null,this.#I=B}shown(){}destroy(){this.#B?.remove(),this.#B=null,this.#A?.remove(),this.#A=null,this.#t="",this.#I=null,this.#E=null,this.#Q=null,this.#g=!1,this.#e=!1}};function PM(g){g.preventDefault()}var WM=1e-4;function iw(g){return g.cancelable?(zB(g),!0):(g.stopPropagation(),!1)}var Ii=class{#A;#B=!1;#g=null;#Q;#C;#I;#t;#E;#e=!1;#i=null;#w;#s=new Set;#a=null;#n;#r=null;#o=0;constructor({container:A,isPinchingDisabled:B=null,isPinchingStopped:Q=null,onPinchStart:C=null,onPinching:I=null,onPinchEnd:E=null,onPanning:t=null,signal:e}){this.#A=A,this.#g=Q,this.#Q=B,this.#C=C,this.#I=I,this.#t=E,this.#E=t,this.#n=new AbortController,this.#w=AbortSignal.any([e,this.#n.signal]),A.addEventListener("touchstart",this.#c.bind(this),{passive:!1,signal:this.#w})}get MIN_TOUCH_DISTANCE_TO_PINCH(){return 35/IQ.pixelRatio}get MIN_TOUCH_DISTANCE_TO_SCALE(){return 4/IQ.pixelRatio}#c(A){if(this.#Q?.())return;this.#D(A);let B=this.#s;for(let{identifier:Q}of A.changedTouches)B.add(Q);if(B.size===1){this.#h();return}if(!this.#r){this.#r=new AbortController;let Q=AbortSignal.any([this.#w,this.#r.signal]),C=this.#A,I={signal:Q,capture:!1,passive:!1};C.addEventListener("touchmove",this.#F.bind(this),I);let E=this.#f.bind(this);C.addEventListener("touchend",E,I),C.addEventListener("touchcancel",E,I),I.capture=!0,C.addEventListener("pointerdown",zB,I),C.addEventListener("pointermove",zB,I),C.addEventListener("pointercancel",PM,I),C.addEventListener("pointerup",PM,I),this.#C?.()}this.#e=iw(A),this.#G(A)}#h(){if(this.#i)return;let A=this.#i=new AbortController,B=AbortSignal.any([this.#w,A.signal]),Q=this.#A,C={capture:!0,signal:B,passive:!1},I=E=>{E.pointerType==="touch"&&(this.#i?.abort(),this.#i=null)};Q.addEventListener("pointerdown",E=>{E.pointerType==="touch"&&(zB(E),I(E))},C),Q.addEventListener("pointerup",I,C),Q.addEventListener("pointercancel",I,C)}#D(A){let B=this.#s;if(B.size===0)return;let Q=this.#s=new Set;for(let{identifier:C}of A.touches)B.has(C)&&Q.add(C)}#l(A){let B=this.#s,Q=[];for(let C of A.touches)B.has(C.identifier)&&Q.push(C);return Q}#G(A){let B=this.#l(A);if(B.length!==2||this.#g?.()){this.#a=null;return}let[Q,C]=B;this.#a={touch0X:Q.screenX,touch0Y:Q.screenY,touch1X:C.screenX,touch1Y:C.screenY,panX:(Q.clientX+C.clientX)/2,panY:(Q.clientY+C.clientY)/2,screenPanX:(Q.screenX+C.screenX)/2,screenPanY:(Q.screenY+C.screenY)/2}}#F(A){if(!this.#a)return;let B=this.#l(A);if(B.length!==2)return;let Q=this.#e;if(this.#e=iw(A),!this.#e)return;if(!Q){this.#G(A);return}let[C,I]=B,{screenX:E,screenY:t}=C,{screenX:e,screenY:i}=I,s=this.#a,{touch0X:o,touch0Y:w,touch1X:a,touch1Y:c,panX:n,panY:r}=s,h=a-o,D=c-w,l=e-E,G=i-t,M=(C.clientX+I.clientX)/2,f=(C.clientY+I.clientY)/2;s.panX=M,s.panY=f;let d=M-n,Y=f-r,U=(E+e)/2,H=(t+i)/2,S=Math.hypot(U-s.screenPanX,H-s.screenPanY);s.screenPanX=U,s.screenPanY=H;let T=Math.hypot(l,G),j=Math.hypot(h,D),x=this.#B?this.MIN_TOUCH_DISTANCE_TO_SCALE:this.MIN_TOUCH_DISTANCE_TO_PINCH+2*S;if(T<WM||j<WM||Math.abs(j-T)<=x){(d||Y)&&this.#E?.(d,Y);return}s.touch0X=E,s.touch0Y=t,s.touch1X=e,s.touch1Y=i;let R=Math.sign(T-j);if(!this.#B){this.#B=!0,this.#o=R,(d||Y)&&this.#E?.(d,Y);return}if(this.#o){let k=this.#o;if(this.#o=0,R!==k&&Math.abs(T-j)<=2*S){this.#B=!1,(d||Y)&&this.#E?.(d,Y);return}}this.#I?.([n,r],j,T,d,Y)}#f(A){if(this.#D(A),this.#s.size>=2){this.#G(A);return}let B=!!this.#a;this.#Y(),this.#s.size===1&&this.#h(),B&&iw(A)}#Y(){this.#a=null,this.#B=!1,this.#o=0,this.#e=!1,this.#r&&(this.#r.abort(),this.#r=null,this.#t?.())}destroy(){this.#Y(),this.#s.clear(),this.#n?.abort(),this.#n=null,this.#i?.abort(),this.#i=null}},MB=class g{#A=null;#B=null;#g=null;#Q=null;#C=null;#I=!1;#t=null;#E="";#e=null;#i=null;#w=null;#s=null;#a=null;#n="";#r=!1;#o=null;#c=!1;#h=!1;#D=!1;#l=null;#G=0;#F=0;#f=null;#Y=null;isSelected=!1;_isCopy=!1;_editToolbar=null;_initialOptions=Object.create(null);_initialData=null;_isVisible=!0;_uiManager=null;_focusEventsAllowed=!0;static _l10n=null;static _l10nAlert=null;static _l10nResizer=null;#d=!1;#R=g._zIndex++;static _borderLineWidth=-1;static _colorManager=new Uw;static _zIndex=1;static _telemetryTimeout=1e3;static get _resizerKeyboardManager(){let A=g.prototype._resizeWithKeyboard,B=ZC.TRANSLATE_SMALL,Q=ZC.TRANSLATE_BIG;return pA(this,"_resizerKeyboardManager",new VC([[["ArrowLeft"],A,{args:[-B,0]}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],A,{args:[-Q,0]}],[["ArrowRight"],A,{args:[B,0]}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],A,{args:[Q,0]}],[["ArrowUp"],A,{args:[0,-B]}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],A,{args:[0,-Q]}],[["ArrowDown"],A,{args:[0,B]}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],A,{args:[0,Q]}],[["Escape"],g.prototype._stopResizingWithKeyboard]]))}constructor(A){this.parent=A.parent,this.id=A.id,this.width=this.height=null,this.pageIndex=A.parent.pageIndex,this.name=A.name,this.div=null,this._uiManager=A.uiManager,this.annotationElementId=null,this._willKeepAspectRatio=!1,this._initialOptions.isCentered=A.isCentered,this._structTreeParentId=null,this.annotationElementId=A.annotationElementId||null,this.creationDate=A.creationDate||new Date,this.modificationDate=A.modificationDate||null,this.canAddComment=!0;let{rotation:B,rawDims:{pageWidth:Q,pageHeight:C,pageX:I,pageY:E}}=this.parent.viewport;this.rotation=B,this.pageRotation=(360+B-this._uiManager.viewParameters.rotation)%360,this.pageDimensions=[Q,C],this.pageTranslation=[I,E];let[t,e]=this.parentDimensions;this.x=A.x/t,this.y=A.y/e,this.isAttachedToDOM=!1,this.deleted=!1}updatePageIndex(A){this.pageIndex=A}get editorType(){return Object.getPrototypeOf(this).constructor._type}get mode(){return Object.getPrototypeOf(this).constructor._editorType}static get isDrawer(){return!1}static get _defaultLineColor(){return pA(this,"_defaultLineColor",this._colorManager.getHexCode("CanvasText"))}static deleteAnnotationElement(A){let B=new kw({id:A._uiManager.getId(),parent:A.parent,uiManager:A._uiManager});B.annotationElementId=A.annotationElementId,B.deleted=!0,B._uiManager.addToAnnotationStorage(B)}static initialize(A,B){if(g._l10n??=A,g._l10nAlert??=Object.freeze({highlight:"pdfjs-editor-highlight-added-alert",freetext:"pdfjs-editor-freetext-added-alert",ink:"pdfjs-editor-ink-added-alert",stamp:"pdfjs-editor-stamp-added-alert",signature:"pdfjs-editor-signature-added-alert"}),g._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"}),g._borderLineWidth!==-1)return;let Q=getComputedStyle(document.documentElement);g._borderLineWidth=parseFloat(Q.getPropertyValue("--outline-width"))||0}static updateDefaultParams(A,B){}static get defaultPropertiesToUpdate(){return[]}static isHandlingMimeForPasting(A){return!1}static paste(A,B){cB("Not implemented")}get propertiesToUpdate(){return[]}get _isDraggable(){return this.#d}set _isDraggable(A){this.#d=A,this.div?.classList.toggle("draggable",A)}get uid(){return this.annotationElementId||this.id}get isEnterHandled(){return!0}center(){let[A,B]=this.pageDimensions;switch(this.parentRotation){case 90:this.x-=this.height*B/(A*2),this.y+=this.width*A/(B*2);break;case 180:this.x+=this.width/2,this.y+=this.height/2;break;case 270:this.x+=this.height*B/(A*2),this.y-=this.width*A/(B*2);break;default:this.x-=this.width/2,this.y-=this.height/2;break}this.fixAndSetPosition()}addCommands(A){this._uiManager.addCommands(A)}get currentLayer(){return this._uiManager.currentLayer}setInBackground(){this.div.style.zIndex=0}setInForeground(){this.div.style.zIndex=this.#R}setParent(A){A!==null?(this.pageIndex=A.pageIndex,this.pageDimensions=A.pageDimensions):(this.#y(),this.#s?.remove(),this.#s=null),this.parent=A}focusin(A){this._focusEventsAllowed&&(this.#r?this.#r=!1:this.parent.setSelected(this))}focusout(A){!this._focusEventsAllowed||!this.isAttachedToDOM||A.relatedTarget?.closest(`#${this.id}`)||(A.preventDefault(),this.parent?.isMultipleSelection||this.commitOrRemove())}commitOrRemove(){this.isEmpty()?this.remove():this.commit()}commit(){this.isInEditMode()&&this.addToAnnotationStorage()}addToAnnotationStorage(){this._uiManager.addToAnnotationStorage(this)}setAt(A,B,Q,C){let[I,E]=this.parentDimensions;[Q,C]=this.screenToPageTranslation(Q,C),this.x=(A+Q)/I,this.y=(B+C)/E,this.fixAndSetPosition()}_moveAfterPaste(A,B){if(this.isClone){delete this.isClone;return}let[Q,C]=this.parentDimensions;this.setAt(A*Q,B*C,this.width*Q,this.height*C),this._onTranslated()}#H([A,B],Q,C){[Q,C]=this.screenToPageTranslation(Q,C),this.x+=Q/A,this.y+=C/B,this._onTranslating(this.x,this.y),this.fixAndSetPosition()}translate(A,B){this.#H(this.parentDimensions,A,B)}translateInPage(A,B){this.#o||=[this.x,this.y,this.width,this.height],this.#H(this.pageDimensions,A,B),this.div.scrollIntoView({block:"nearest"})}translationDone(){this._onTranslated(this.x,this.y)}drag(A,B){this.#o||=[this.x,this.y,this.width,this.height];let{div:Q,parentDimensions:[C,I]}=this;if(this.x+=A/C,this.y+=B/I,this.parent&&(this.x<0||this.x>1||this.y<0||this.y>1)){let{x:o,y:w}=this.div.getBoundingClientRect();this.parent.findNewParent(this,o,w)&&(this.x-=Math.floor(this.x),this.y-=Math.floor(this.y))}let{x:E,y:t}=this,[e,i]=this.getBaseTranslation();E+=e,t+=i;let{style:s}=Q;s.left=`${(100*E).toFixed(2)}%`,s.top=`${(100*t).toFixed(2)}%`,this._onTranslating(E,t)}_onTranslating(A,B){}_onTranslated(A,B){}get _hasBeenMoved(){return!!this.#o&&(this.#o[0]!==this.x||this.#o[1]!==this.y)}get _hasBeenResized(){return!!this.#o&&(this.#o[2]!==this.width||this.#o[3]!==this.height)}getBaseTranslation(){let[A,B]=this.parentDimensions,{_borderLineWidth:Q}=g,C=Q/A,I=Q/B;switch(this.rotation){case 90:return[-C,I];case 180:return[C,I];case 270:return[C,-I];default:return[-C,-I]}}get _mustFixPosition(){return!0}fixAndSetPosition(A=this.rotation){let{div:{style:B},pageDimensions:[Q,C]}=this,{x:I,y:E,width:t,height:e}=this;if(t*=Q,e*=C,I*=Q,E*=C,this._mustFixPosition)switch(A){case 0:I=RB(I,0,Q-t),E=RB(E,0,C-e);break;case 90:I=RB(I,0,Q-e),E=RB(E,t,C);break;case 180:I=RB(I,t,Q),E=RB(E,e,C);break;case 270:I=RB(I,e,Q),E=RB(E,0,C-t);break}this.x=I/=Q,this.y=E/=C;let[i,s]=this.getBaseTranslation();I+=i,E+=s,B.left=`${(100*I).toFixed(2)}%`,B.top=`${(100*E).toFixed(2)}%`,this.moveInDOM()}static#k(A,B,Q){switch(Q){case 90:return[B,-A];case 180:return[-A,-B];case 270:return[-B,A];default:return[A,B]}}screenToPageTranslation(A,B){return g.#k(A,B,this.parentRotation)}pageTranslationToScreen(A,B){return g.#k(A,B,360-this.parentRotation)}#u(A){switch(A){case 90:{let[B,Q]=this.pageDimensions;return[0,-B/Q,Q/B,0]}case 180:return[-1,0,0,-1];case 270:{let[B,Q]=this.pageDimensions;return[0,B/Q,-Q/B,0]}default:return[1,0,0,1]}}get parentScale(){return this._uiManager.viewParameters.realScale}get parentRotation(){return(this._uiManager.viewParameters.rotation+this.pageRotation)%360}get parentDimensions(){let{parentScale:A,pageDimensions:[B,Q]}=this;return[B*A,Q*A]}setDims(){let{div:{style:A},width:B,height:Q}=this;A.width=`${(100*B).toFixed(2)}%`,A.height=`${(100*Q).toFixed(2)}%`}getInitialTranslation(){return[0,0]}#S(){if(this.#e)return;this.#e=document.createElement("div"),this.#e.classList.add("resizers");let A=this._willKeepAspectRatio?["topLeft","topRight","bottomRight","bottomLeft"]:["topLeft","topMiddle","topRight","middleRight","bottomRight","bottomMiddle","bottomLeft","middleLeft"],B=this._uiManager._signal;for(let Q of A){let C=document.createElement("div");this.#e.append(C),C.classList.add("resizer",Q),C.setAttribute("data-resizer-name",Q),C.addEventListener("pointerdown",this.#p.bind(this,Q),{signal:B}),C.addEventListener("contextmenu",tQ,{signal:B}),C.tabIndex=-1}this.div.prepend(this.#e)}#p(A,B){B.preventDefault();let{isMac:Q}=lB.platform;if(B.button!==0||B.ctrlKey&&Q)return;this.#g?.toggle(!1);let C=this._isDraggable;this._isDraggable=!1,this.#i=[B.screenX,B.screenY];let I=new AbortController,E=this._uiManager.combinedSignal(I);this.parent.togglePointerEvents(!1),window.addEventListener("pointermove",this.#b.bind(this,A),{passive:!0,capture:!0,signal:E}),window.addEventListener("touchmove",zB,{passive:!1,signal:E}),window.addEventListener("contextmenu",tQ,{signal:E}),this.#w={savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height};let t=this.parent.div.style.cursor,e=this.div.style.cursor;this.div.style.cursor=this.parent.div.style.cursor=window.getComputedStyle(B.target).cursor;let i=()=>{I.abort(),this.parent.togglePointerEvents(!0),this.#g?.toggle(!0),this._isDraggable=C,this.parent.div.style.cursor=t,this.div.style.cursor=e,this.#m()};window.addEventListener("pointerup",i,{signal:E}),window.addEventListener("blur",i,{signal:E})}#J(A,B,Q,C){this.width=Q,this.height=C,this.x=A,this.y=B,this.setDims(),this.fixAndSetPosition(),this._onResized()}_onResized(){}#m(){if(!this.#w)return;let{savedX:A,savedY:B,savedWidth:Q,savedHeight:C}=this.#w;this.#w=null;let I=this.x,E=this.y,t=this.width,e=this.height;I===A&&E===B&&t===Q&&e===C||this.addCommands({cmd:this.#J.bind(this,I,E,t,e),undo:this.#J.bind(this,A,B,Q,C),mustExec:!0})}static _round(A){return Math.round(A*1e4)/1e4}#b(A,B){let[Q,C]=this.parentDimensions,I=this.x,E=this.y,t=this.width,e=this.height,i=g.MIN_SIZE/Q,s=g.MIN_SIZE/C,o=this.#u(this.rotation),w=(k,J)=>[o[0]*k+o[2]*J,o[1]*k+o[3]*J],a=this.#u(360-this.rotation),c=(k,J)=>[a[0]*k+a[2]*J,a[1]*k+a[3]*J],n,r,h=!1,D=!1;switch(A){case"topLeft":h=!0,n=(k,J)=>[0,0],r=(k,J)=>[k,J];break;case"topMiddle":n=(k,J)=>[k/2,0],r=(k,J)=>[k/2,J];break;case"topRight":h=!0,n=(k,J)=>[k,0],r=(k,J)=>[0,J];break;case"middleRight":D=!0,n=(k,J)=>[k,J/2],r=(k,J)=>[0,J/2];break;case"bottomRight":h=!0,n=(k,J)=>[k,J],r=(k,J)=>[0,0];break;case"bottomMiddle":n=(k,J)=>[k/2,J],r=(k,J)=>[k/2,0];break;case"bottomLeft":h=!0,n=(k,J)=>[0,J],r=(k,J)=>[k,0];break;case"middleLeft":D=!0,n=(k,J)=>[0,J/2],r=(k,J)=>[k,J/2];break}let l=n(t,e),G=r(t,e),M=w(...G),f=g._round(I+M[0]),d=g._round(E+M[1]),Y=1,U=1,H,S;if(B.fromKeyboard)({deltaX:H,deltaY:S}=B);else{let{screenX:k,screenY:J}=B,[u,y]=this.#i;[H,S]=this.screenToPageTranslation(k-u,J-y),this.#i[0]=k,this.#i[1]=J}if([H,S]=c(H/Q,S/C),h){let k=Math.hypot(t,e);Y=U=Math.max(Math.min(Math.hypot(G[0]-l[0]-H,G[1]-l[1]-S)/k,1/t,1/e),i/t,s/e)}else D?Y=RB(Math.abs(G[0]-l[0]-H),i,1)/t:U=RB(Math.abs(G[1]-l[1]-S),s,1)/e;let T=g._round(t*Y),j=g._round(e*U);M=w(...r(T,j));let x=f-M[0],R=d-M[1];this.#o||=[this.x,this.y,this.width,this.height],this.width=T,this.height=j,this.x=x,this.y=R,this.setDims(),this.fixAndSetPosition(),this._onResizing()}_onResizing(){}altTextFinish(){this.#g?.finish()}get toolbarButtons(){return null}async addEditToolbar(){if(this._editToolbar||this.#h)return this._editToolbar;this._editToolbar=new Fw(this),this.div.append(this._editToolbar.render());let{toolbarButtons:A}=this;if(A)for(let[B,Q]of A)await this._editToolbar.addButton(B,Q);return this.hasComment||this._editToolbar.addButton("comment",this.addCommentButton()),this._editToolbar.addButton("delete"),this._editToolbar}addCommentButtonInToolbar(){this._editToolbar?.addButtonBefore("comment",this.addCommentButton(),".deleteButton")}removeCommentButtonFromToolbar(){this._editToolbar?.removeButton("comment")}removeEditToolbar(){this._editToolbar?.remove(),this._editToolbar=null,this.#g?.destroy()}addContainer(A){let B=this._editToolbar?.div;B?B.before(A):this.div.append(A)}getClientDimensions(){return this.div.getBoundingClientRect()}createAltText(){return this.#g||(Ci.initialize(g._l10n),this.#g=new Ci(this),this.#A&&(this.#g.data=this.#A,this.#A=null)),this.#g}get altTextData(){return this.#g?.data}set altTextData(A){this.#g&&(this.#g.data=A)}get guessedAltText(){return this.#g?.guessedText}async setGuessedAltText(A){await this.#g?.setGuessedText(A)}serializeAltText(A){return this.#g?.serialize(A)}hasAltText(){return!!this.#g&&!this.#g.isEmpty()}hasAltTextData(){return this.#g?.hasData()??!1}focusCommentButton(){this.#Q?.focusButton()}addCommentButton(){return this.canAddComment?this.#Q||=new JI(this):null}addStandaloneCommentButton(){if(this._uiManager.hasCommentManager()){if(this.#C){this._uiManager.isEditingMode()&&this.#C.classList.remove("hidden");return}this.hasComment&&(this.#C=this.#Q.renderForStandalone(),this.div.append(this.#C))}}removeStandaloneCommentButton(){this.#Q.removeStandaloneCommentButton(),this.#C=null}hideStandaloneCommentButton(){this.#C?.classList.add("hidden")}get comment(){if(!this.#Q)return null;let{data:{richText:A,text:B,date:Q,deleted:C}}=this.#Q;return{text:B,richText:A,date:Q,deleted:C,color:this.getNonHCMColor(),opacity:this.opacity??1}}set comment(A){this.#Q||=new JI(this),typeof A=="object"&&A!==null?this.#Q.restoreData(A):this.#Q.data=A,this.hasComment?(this.removeCommentButtonFromToolbar(),this.addStandaloneCommentButton(),this._uiManager.updateComment(this)):(this.addCommentButtonInToolbar(),this.removeStandaloneCommentButton(),this._uiManager.removeComment(this))}setCommentData({comment:A,popupRef:B,richText:Q}){if(!B||(this.#Q||=new JI(this),this.#Q.setInitialText(A,Q),!this.annotationElementId))return;let C=this._uiManager.getAndRemoveDataFromAnnotationStorage(this.annotationElementId);C&&this.updateFromAnnotationLayer(C)}get hasEditedComment(){return this.#Q?.hasBeenEdited()}get hasDeletedComment(){return this.#Q?.isDeleted()}get hasComment(){return!!this.#Q&&!this.#Q.isEmpty()&&!this.#Q.isDeleted()}async editComment(A){this.#Q||=new JI(this),this.#Q.edit(A)}toggleComment(A,B=void 0){this.hasComment&&this._uiManager.toggleComment(this,A,B)}setSelectedCommentButton(A){this.#Q.setSelectedButton(A)}addComment(A){if(this.hasEditedComment){let[,,,C]=A.rect,[I]=this.pageDimensions,[E]=this.pageTranslation,t=E+I+1,e=C-100,i=t+180;A.popup={contents:this.comment.text,deleted:this.comment.deleted,rect:[t,e,i,C]}}}updateFromAnnotationLayer({popup:{contents:A,deleted:B}}){this.#Q.data=B?null:A}get parentBoundingClientRect(){return this.parent.boundingClientRect}render(){let A=this.div=document.createElement("div");A.setAttribute("data-editor-rotation",(360-this.rotation)%360),A.className=this.name,A.setAttribute("id",this.id),A.tabIndex=this.#I?-1:0,A.setAttribute("role","application"),this.defaultL10nId&&A.setAttribute("data-l10n-id",this.defaultL10nId),this._isVisible||A.classList.add("hidden"),this.setInForeground(),this.#L();let[B,Q]=this.parentDimensions;this.parentRotation%180!==0&&(A.style.maxWidth=`${(100*Q/B).toFixed(2)}%`,A.style.maxHeight=`${(100*B/Q).toFixed(2)}%`);let[C,I]=this.getInitialTranslation();return this.translate(C,I),Gf(this,A,["keydown","pointerdown","dblclick"]),this.#T(),this.addStandaloneCommentButton(),this._uiManager._editorUndoBar?.hide(),A}#V(){this.#w={savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height},this.#g?.toggle(!1),this.parent.togglePointerEvents(!1)}#N(A,B,Q){let I=.7*(Q/B)+1-.7;if(I===1)return;let E=this.#u(this.rotation),t=(f,d)=>[E[0]*f+E[2]*d,E[1]*f+E[3]*d],[e,i]=this.parentDimensions,s=this.x,o=this.y,w=this.width,a=this.height,c=g.MIN_SIZE/e,n=g.MIN_SIZE/i;I=Math.max(Math.min(I,1/w,1/a),c/w,n/a);let r=g._round(w*I),h=g._round(a*I);if(r===w&&h===a)return;this.#o||=[s,o,w,a];let D=t(w/2,a/2),l=g._round(s+D[0]),G=g._round(o+D[1]),M=t(r/2,h/2);this.x=l-M[0],this.y=G-M[1],this.width=r,this.height=h,this.setDims(),this.fixAndSetPosition(),this._onResizing()}#j(){this.#g?.toggle(!0),this.parent.togglePointerEvents(!0),this.#m()}pointerdown(A){let{isMac:B}=lB.platform;if(A.button!==0||A.ctrlKey&&B){A.preventDefault();return}if(this.#r=!0,this._isDraggable){this.#M(A);return}this.#U(A)}#U(A){let{isMac:B}=lB.platform;A.ctrlKey&&!B||A.shiftKey||A.metaKey&&B?this.parent.toggleSelected(this):this.parent.setSelected(this)}#M(A){let{isSelected:B}=this;this._uiManager.setUpDragSession();let Q=!1,C=new AbortController,I=this._uiManager.combinedSignal(C),E={capture:!0,passive:!1,signal:I},t=i=>{C.abort(),this.#t=null,this.#r=!1,this._uiManager.endDragSession()||this.#U(i),Q&&this._onStopDragging()};B&&(this.#G=A.clientX,this.#F=A.clientY,this.#t=A.pointerId,this.#E=A.pointerType,window.addEventListener("pointermove",i=>{Q||(Q=!0,this._uiManager.toggleComment(this,!0,!1),this._onStartDragging());let{clientX:s,clientY:o,pointerId:w}=i;if(w!==this.#t){zB(i);return}let[a,c]=this.screenToPageTranslation(s-this.#G,o-this.#F);this.#G=s,this.#F=o,this._uiManager.dragSelectedEditors(a,c),this.div.scrollIntoView({block:"nearest"})},E),window.addEventListener("touchmove",zB,E),window.addEventListener("pointerdown",i=>{i.pointerType===this.#E&&(this.#Y||i.isPrimary)&&t(i),zB(i)},E));let e=i=>{if(!this.#t||this.#t===i.pointerId){t(i);return}zB(i)};window.addEventListener("pointerup",e,{signal:I}),window.addEventListener("blur",e,{signal:I})}_onStartDragging(){}_onStopDragging(){}moveInDOM(){this.#l&&clearTimeout(this.#l),this.#l=setTimeout(()=>{this.#l=null,this.parent?.moveEditorInDOM(this)},0)}_setParentAndPosition(A,B,Q){A.changeParent(this),this.x=B,this.y=Q,this.fixAndSetPosition(),this._onTranslated()}getRect(A,B,Q=this.rotation){let C=this.parentScale,[I,E]=this.pageDimensions,[t,e]=this.pageTranslation,i=A/C,s=B/C,o=this.x*I,w=this.y*E,a=this.width*I,c=this.height*E;switch(Q){case 0:return[o+i+t,E-w-s-c+e,o+i+a+t,E-w-s+e];case 90:return[o+s+t,E-w+i+e,o+s+c+t,E-w+i+a+e];case 180:return[o-i-a+t,E-w+s+e,o-i+t,E-w+s+c+e];case 270:return[o-s-c+t,E-w-i-a+e,o-s+t,E-w-i+e];default:throw new Error("Invalid rotation")}}getRectInCurrentCoords(A,B){let[Q,C,I,E]=A,t=I-Q,e=E-C;switch(this.rotation){case 0:return[Q,B-E,t,e];case 90:return[Q,B-C,e,t];case 180:return[I,B-C,t,e];case 270:return[I,B-E,e,t];default:throw new Error("Invalid rotation")}}getPDFRect(){return this.getRect(0,0)}getNonHCMColor(){return this.color&&g._colorManager.convert(this._uiManager.getNonHCMColor(this.color))}onUpdatedColor(){this.#Q?.onUpdatedColor()}getData(){let{comment:{text:A,color:B,date:Q,opacity:C,deleted:I,richText:E},uid:t,pageIndex:e,creationDate:i,modificationDate:s}=this;return{id:t,pageIndex:e,rect:this.getPDFRect(),richText:E,contentsObj:{str:A},creationDate:i,modificationDate:Q||s,popupRef:!I,color:B,opacity:C}}onceAdded(A){}isEmpty(){return!1}enableEditMode(){return this.isInEditMode()?!1:(this.parent.setEditingState(!1),this.#h=!0,!0)}disableEditMode(){return this.isInEditMode()?(this.parent.setEditingState(!0),this.#h=!1,!0):!1}isInEditMode(){return this.#h}shouldGetKeyboardEvents(){return this.#D}needsToBeRebuilt(){return this.div&&!this.isAttachedToDOM}get isOnScreen(){let{top:A,left:B,bottom:Q,right:C}=this.getClientDimensions(),{innerHeight:I,innerWidth:E}=window;return B<E&&C>0&&A<I&&Q>0}#L(){if(this.#a||!this.div)return;this.#a=new AbortController;let A=this._uiManager.combinedSignal(this.#a);this.div.addEventListener("focusin",this.focusin.bind(this),{signal:A}),this.div.addEventListener("focusout",this.focusout.bind(this),{signal:A})}#T(){this.#Y||!this.div||!this.isResizable||!this._uiManager._supportsPinchToZoom||(this.#Y=new Ii({container:this.div,isPinchingDisabled:()=>!this.isSelected,onPinchStart:this.#V.bind(this),onPinching:this.#N.bind(this),onPinchEnd:this.#j.bind(this),signal:this._uiManager._signal}))}rebuild(){this.#L(),this.#T()}rotate(A){}resize(){}serializeDeleted(){return{id:this.annotationElementId,deleted:!0,pageIndex:this.pageIndex,popupRef:this._initialData?.popupRef||""}}serialize(A=!1,B=null){return{annotationType:this.mode,pageIndex:this.pageIndex,rect:this.getPDFRect(),rotation:this.rotation,structTreeParentId:this._structTreeParentId,popupRef:this._initialData?.popupRef||""}}static async deserialize(A,B,Q){let C=new this.prototype.constructor({parent:B,id:Q.getId(),uiManager:Q,annotationElementId:A.annotationElementId,creationDate:A.creationDate,modificationDate:A.modificationDate});C.rotation=A.rotation,C.#A=A.accessibilityData,C._isCopy=A.isCopy||!1;let[I,E]=C.pageDimensions,[t,e,i,s]=C.getRectInCurrentCoords(A.rect,E);return C.x=t/I,C.y=e/E,C.width=i/I,C.height=s/E,C}get hasBeenModified(){return!!this.annotationElementId&&(this.deleted||this.serialize()!==null)}remove(){if(this.#a?.abort(),this.#a=null,this.isEmpty()||this.commit(),this.#Y?.destroy(),this.#Y=null,this.parent?this.parent.remove(this):this._uiManager.removeEditor(this),this.hideCommentPopup(),this.#l&&(clearTimeout(this.#l),this.#l=null),this.#y(),this.removeEditToolbar(),this.#f){for(let A of this.#f.values())clearTimeout(A);this.#f=null}this.parent=null,this.#s?.remove(),this.#s=null}get isResizable(){return!1}makeResizable(){this.isResizable&&(this.#S(),this.#e.classList.remove("hidden"))}get toolbarPosition(){return null}get commentButtonPosition(){return this._uiManager.direction==="ltr"?[1,0]:[0,0]}get commentButtonPositionInPage(){let{commentButtonPosition:[A,B]}=this,[Q,C,I,E]=this.getPDFRect();return[g._round(Q+(I-Q)*A),g._round(C+(E-C)*(1-B))]}get commentButtonColor(){return this._uiManager.makeCommentColor(this.getNonHCMColor(),this.opacity)}get commentPopupPosition(){return this.#Q.commentPopupPositionInLayer}set commentPopupPosition(A){this.#Q.commentPopupPositionInLayer=A}hasDefaultPopupPosition(){return this.#Q.hasDefaultPopupPosition()}get commentButtonWidth(){return this.#Q.commentButtonWidth}get elementBeforePopup(){return this.div}setCommentButtonStates(A){this.#Q?.setCommentButtonStates(A)}keydown(A){if(!this.isResizable||A.target!==this.div||A.key!=="Enter")return;this._uiManager.setSelected(this),this.#w={savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height};let B=this.#e.children;if(!this.#B){this.#B=Array.from(B);let E=this.#Z.bind(this),t=this.#q.bind(this),e=this._uiManager._signal;for(let i of this.#B){let s=i.getAttribute("data-resizer-name");i.setAttribute("role","spinbutton"),i.addEventListener("keydown",E,{signal:e}),i.addEventListener("blur",t,{signal:e}),i.addEventListener("focus",this.#x.bind(this,s),{signal:e}),i.setAttribute("data-l10n-id",g._l10nResizer[s])}}let Q=this.#B[0],C=0;for(let E of B){if(E===Q)break;C++}let I=(360-this.rotation+this.parentRotation)%360/90*(this.#B.length/4);if(I!==C){if(I<C)for(let t=0;t<C-I;t++)this.#e.append(this.#e.firstElementChild);else if(I>C)for(let t=0;t<I-C;t++)this.#e.firstElementChild.before(this.#e.lastElementChild);let E=0;for(let t of B){let i=this.#B[E++].getAttribute("data-resizer-name");t.setAttribute("data-l10n-id",g._l10nResizer[i])}}this.#v(0),this.#D=!0,this.#e.firstElementChild.focus({focusVisible:!0}),A.preventDefault(),A.stopImmediatePropagation()}#Z(A){g._resizerKeyboardManager.exec(this,A)}#q(A){this.#D&&A.relatedTarget?.parentNode!==this.#e&&this.#y()}#x(A){this.#n=this.#D?A:""}#v(A){if(this.#B)for(let B of this.#B)B.tabIndex=A}_resizeWithKeyboard(A,B){this.#D&&this.#b(this.#n,{deltaX:A,deltaY:B,fromKeyboard:!0})}#y(){this.#D=!1,this.#v(-1),this.#m()}_stopResizingWithKeyboard(){this.#y(),this.div.focus()}select(){if(this.isSelected&&this._editToolbar){this._editToolbar.show();return}if(this.isSelected=!0,this.makeResizable(),this.div?.classList.add("selectedEditor"),!this._editToolbar){this.addEditToolbar().then(()=>{this.div?.classList.contains("selectedEditor")&&this._editToolbar?.show()});return}this._editToolbar?.show(),this.#g?.toggleAltTextBadge(!1)}focus(){this.div&&!this.div.contains(document.activeElement)&&setTimeout(()=>this.div?.focus({preventScroll:!0}),0)}unselect(){this.isSelected&&(this.isSelected=!1,this.#e?.classList.add("hidden"),this.div?.classList.remove("selectedEditor"),this.div?.contains(document.activeElement)&&this._uiManager.currentLayer.div.focus({preventScroll:!0}),this._editToolbar?.hide(),this.#g?.toggleAltTextBadge(!0),this.hideCommentPopup())}hideCommentPopup(){this.hasComment&&this._uiManager.toggleComment(null)}updateParams(A,B){}disableEditing(){}enableEditing(){}get canChangeContent(){return!1}enterInEditMode(){this.canChangeContent&&(this.enableEditMode(),this.div.focus())}dblclick(A){A.target.nodeName!=="BUTTON"&&(this.enterInEditMode(),this.parent.updateToolbar({mode:this.constructor._editorType,editId:this.uid}))}getElementForAltText(){return this.div}get contentDiv(){return this.div}get isEditing(){return this.#c}set isEditing(A){this.#c=A,this.parent&&(A?(this.parent.setSelected(this),this.parent.setActiveEditor(this)):this.parent.setActiveEditor(null))}static get MIN_SIZE(){return 16}static canCreateNewEmptyEditor(){return!0}get telemetryInitialData(){return{action:"added"}}get telemetryFinalData(){return null}_reportTelemetry(A,B=!1){if(B){this.#f||=new Map;let{action:Q}=A,C=this.#f.get(Q);C&&clearTimeout(C),C=setTimeout(()=>{this._reportTelemetry(A),this.#f.delete(Q),this.#f.size===0&&(this.#f=null)},g._telemetryTimeout),this.#f.set(Q,C);return}A.type||=this.editorType,this._uiManager._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:A}})}show(A=this._isVisible){this.div.classList.toggle("hidden",!A),this._isVisible=A}enable(){this.div&&(this.div.tabIndex=0),this.#I=!1}disable(){this.div&&(this.div.tabIndex=-1),this.#I=!0}updateFakeAnnotationElement(A){if(!this.#s&&!this.deleted){this.#s=A.addFakeAnnotation(this);return}if(this.deleted){this.#s.remove(),this.#s=null;return}(this.hasEditedComment||this._hasBeenMoved||this._hasBeenResized)&&this.#s.updateEdited({rect:this.getPDFRect(),popup:this.comment})}renderAnnotationElement(A){if(this.deleted)return A.hide(),null;let B=A.container.querySelector(".annotationContent");if(!B)B=document.createElement("div"),B.classList.add("annotationContent",this.editorType),A.container.prepend(B);else if(B.nodeName==="CANVAS"){let Q=B;B=document.createElement("div"),B.classList.add("annotationContent",this.editorType),Q.before(B)}return B}resetAnnotationElement(A){let{firstElementChild:B}=A.container;B?.nodeName==="DIV"&&B.classList.contains("annotationContent")&&B.remove()}},kw=class extends MB{constructor(A){super(A),this.annotationElementId=A.annotationElementId,this.deleted=!0}serialize(){return this.serializeDeleted()}},OM=3285377520,Og=4294901760,FQ=65535,Zt=class{constructor(A){this.h1=A?A&4294967295:OM,this.h2=A?A&4294967295:OM}update(A){let B,Q;if(typeof A=="string"){B=new Uint8Array(A.length*2),Q=0;for(let n=0,r=A.length;n<r;n++){let h=A.charCodeAt(n);h<=255?B[Q++]=h:(B[Q++]=h>>>8,B[Q++]=h&255)}}else if(ArrayBuffer.isView(A))B=A.slice(),Q=B.byteLength;else throw new Error("Invalid data format, must be a string or TypedArray.");let C=Q>>2,I=Q-C*4,E=new Uint32Array(B.buffer,0,C),t=0,e=0,i=this.h1,s=this.h2,o=3432918353,w=461845907,a=o&FQ,c=w&FQ;for(let n=0;n<C;n++)n&1?(t=E[n],t=t*o&Og|t*a&FQ,t=t<<15|t>>>17,t=t*w&Og|t*c&FQ,i^=t,i=i<<13|i>>>19,i=i*5+3864292196):(e=E[n],e=e*o&Og|e*a&FQ,e=e<<15|e>>>17,e=e*w&Og|e*c&FQ,s^=e,s=s<<13|s>>>19,s=s*5+3864292196);switch(t=0,I){case 3:t^=B[C*4+2]<<16;case 2:t^=B[C*4+1]<<8;case 1:t^=B[C*4],t=t*o&Og|t*a&FQ,t=t<<15|t>>>17,t=t*w&Og|t*c&FQ,C&1?i^=t:s^=t}this.h1=i,this.h2=s}hexdigest(){let A=this.h1,B=this.h2;return A^=B>>>1,A=A*3981806797&Og|A*36045&FQ,B=B*4283543511&Og|((B<<16|A>>>16)*2950163797&Og)>>>16,A^=B>>>1,A=A*444984403&Og|A*60499&FQ,B=B*3301882366&Og|((B<<16|A>>>16)*3120437893&Og)>>>16,A^=B>>>1,(A>>>0).toString(16).padStart(8,"0")+(B>>>0).toString(16).padStart(8,"0")}},Pt=Object.freeze({map:null,hash:"",transfer:void 0}),Wt=class{#A=!1;#B=null;#g=null;#Q=new Map;onSetModified=null;onResetModified=null;onAnnotationEditor=null;getValue(A,B){let Q=this.#Q.get(A);return Q===void 0?B:Object.assign(B,Q)}getRawValue(A){return this.#Q.get(A)}remove(A){let B=this.#Q.get(A);B!==void 0&&(B instanceof MB&&this.#g.delete(B.annotationElementId),this.#Q.delete(A),this.#Q.size===0&&this.resetModified(),!this.#Q.values().some(Q=>Q instanceof MB)&&this.onAnnotationEditor?.(null))}setValue(A,B){let Q=this.#Q.get(A),C=!1;if(Q!==void 0)for(let[I,E]of Object.entries(B))Q[I]!==E&&(C=!0,Q[I]=E);else C=!0,this.#Q.set(A,B);C&&this.#C(),B instanceof MB&&((this.#g||=new Map).set(B.annotationElementId,B),this.onAnnotationEditor?.(B.constructor._type))}has(A){return this.#Q.has(A)}get size(){return this.#Q.size}#C(){this.#A||(this.#A=!0,this.onSetModified?.())}resetModified(){this.#A&&(this.#A=!1,this.onResetModified?.())}get print(){return new ti(this)}get serializable(){if(this.#Q.size===0)return Pt;let A=new Map,B=new Zt,Q=[],C=Object.create(null),I=!1;for(let[E,t]of this.#Q){let e=t instanceof MB?t.serialize(!1,C):t;t.page&&(t.pageIndex=t.page._pageIndex,delete t.page),e&&(A.set(E,e),B.update(`${E}:${JSON.stringify(e)}`),I||=!!e.bitmap)}if(I)for(let E of A.values())E.bitmap&&Q.push(E.bitmap);return A.size>0?{map:A,hash:B.hexdigest(),transfer:Q}:Pt}get editorStats(){let A=null,B=new Map,Q=0,C=0;for(let I of this.#Q.values()){if(!(I instanceof MB)){I.popup&&(I.popup.deleted?C+=1:Q+=1);continue}I.isCommentDeleted?C+=1:I.hasEditedComment&&(Q+=1);let E=I.telemetryFinalData;if(!E)continue;let{type:t}=E;B.getOrInsertComputed(t,()=>Object.getPrototypeOf(I).constructor),A||=Object.create(null);let e=A[t]||=new Map;for(let[i,s]of Object.entries(E)){if(i==="type")continue;let o=e.getOrInsertComputed(i,gn);o.set(s,(o.get(s)??0)+1)}}if((C>0||Q>0)&&(A||=Object.create(null),A.comments={deleted:C,edited:Q}),!A)return null;for(let[I,E]of B)A[I]=E.computeTelemetryFinalData(A[I]);return A}resetModifiedIds(){this.#B=null}updateEditor(A,B){let Q=this.#g?.get(A);return Q?(Q.updateFromAnnotationLayer(B),!0):!1}getEditor(A){return this.#g?.get(A)||null}get modifiedIds(){if(this.#B)return this.#B;let A=[];if(this.#g)for(let Q of this.#g.values())Q.serialize()&&A.push(Q.annotationElementId);let B="";if(A.length){let Q=new Zt;Q.update(A.join(",")),B=Q.hexdigest()}return this.#B={ids:new Set(A),hash:B}}[Symbol.iterator](){return this.#Q.entries()}},ti=class extends Wt{#A=Pt;constructor(A){super();let{serializable:B}=A;if(B===Pt)return;let{map:Q,hash:C,transfer:I}=B,E=structuredClone(Q,I?{transfer:I}:null);this.#A={map:E,hash:C,transfer:[]}}get print(){cB("Should not call PrintAnnotationStorage.print")}get serializable(){return this.#A}get modifiedIds(){return pA(this,"modifiedIds",{ids:new Set,hash:""})}},mI="__forcedDependency",{floor:vM,ceil:qM}=Math;function zM(g,A,B,Q,C,I){g[A*4+0]=Math.min(g[A*4+0],B),g[A*4+1]=Math.min(g[A*4+1],Q),g[A*4+2]=Math.max(g[A*4+2],C),g[A*4+3]=Math.max(g[A*4+3],I)}function bk(g,A,B,Q,C){let I;g?(g<0&&(I=C[0],C[0]=C[2],C[2]=I),C[0]*=g,C[2]*=g,A<0&&(I=C[1],C[1]=C[3],C[3]=I),C[1]*=A,C[3]*=A):C.fill(0),C[0]+=B,C[1]+=Q,C[2]+=B,C[3]+=Q}var Hw=new Uint32Array(new Uint8Array([255,255,0,0]).buffer)[0],Rw=class{#A;#B;constructor(A,B){this.#A=A,this.#B=B}get length(){return this.#A.length}isEmpty(A){return this.#A[A]===Hw}minX(A){return this.#B[A*4+0]/256}minY(A){return this.#B[A*4+1]/256}maxX(A){return(this.#B[A*4+2]+1)/256}maxY(A){return(this.#B[A*4+3]+1)/256}},_M=(g,A)=>g?.getOrInsertComputed(A,()=>({dependencies:new Set,isRenderingOperation:!1})),Sw=class{#A=[[1,0,0,1,0,0]];#B=[-1/0,-1/0,1/0,1/0];#g=new Float64Array(fQ);_pendingBBoxIdx=-1;#Q;#C;#I;#t;_savesStack=[];_markedContentStack=[];constructor(A,B){this.#Q=A.width,this.#C=A.height,this.#E(B)}growOperationsCount(A){A>=this.#t.length&&this.#E(A,this.#t)}#E(A,B){let Q=new ArrayBuffer(A*4);this.#I=new Uint8ClampedArray(Q),this.#t=new Uint32Array(Q),B&&B.length>0?(this.#t.set(B),this.#t.fill(Hw,B.length)):this.#t.fill(Hw)}get clipBox(){return this.#B}save(A){return this.#B={__proto__:this.#B},this._savesStack.push(A),this}restore(A,B){let Q=Object.getPrototypeOf(this.#B);if(Q===null)return this;this.#B=Q;let C=this._savesStack.pop();return C!==void 0&&(B?.(C,A),this.#t[A]=this.#t[C]),this}recordOpenMarker(A){return this._savesStack.push(A),this}getOpenMarker(){return this._savesStack.length===0?null:this._savesStack.at(-1)}recordCloseMarker(A,B){let Q=this._savesStack.pop();return Q!==void 0&&(B?.(Q,A),this.#t[A]=this.#t[Q]),this}beginMarkedContent(A){return this._markedContentStack.push(A),this}endMarkedContent(A,B){let Q=this._markedContentStack.pop();return Q!==void 0&&(B?.(Q,A),this.#t[A]=this.#t[Q]),this}pushBaseTransform(A){return this.#A.push(RA.multiplyByDOMMatrix(this.#A.at(-1),A.getTransform())),this}popBaseTransform(){return this.#A.length>1&&this.#A.pop(),this}resetBBox(A){return this._pendingBBoxIdx!==A&&(this._pendingBBoxIdx=A,this.#g.set(fQ,0)),this}recordClipBox(A,B,Q,C,I,E){let t=RA.multiplyByDOMMatrix(this.#A.at(-1),B.getTransform()),e=fQ.slice();RA.axialAlignedBoundingBox([Q,I,C,E],t,e);let i=RA.intersect(this.#B,e);return i?(this.#B[0]=i[0],this.#B[1]=i[1],this.#B[2]=i[2],this.#B[3]=i[3]):(this.#B[0]=this.#B[1]=1/0,this.#B[2]=this.#B[3]=-1/0),this}recordBBox(A,B,Q,C,I,E){let t=this.#B;if(t[0]===1/0)return this;let e=RA.multiplyByDOMMatrix(this.#A.at(-1),B.getTransform());if(t[0]===-1/0)return RA.axialAlignedBoundingBox([Q,I,C,E],e,this.#g),this;let i=fQ.slice();return RA.axialAlignedBoundingBox([Q,I,C,E],e,i),this.#g[0]=RB(i[0],t[0],this.#g[0]),this.#g[1]=RB(i[1],t[1],this.#g[1]),this.#g[2]=RB(i[2],this.#g[2],t[2]),this.#g[3]=RB(i[3],this.#g[3],t[3]),this}recordFullPageBBox(A){return this.#g[0]=Math.max(0,this.#B[0]),this.#g[1]=Math.max(0,this.#B[1]),this.#g[2]=Math.min(this.#Q,this.#B[2]),this.#g[3]=Math.min(this.#C,this.#B[3]),this}recordOperation(A,B=!1,Q){if(this._pendingBBoxIdx!==A)return this;let C=vM(this.#g[0]*256/this.#Q),I=vM(this.#g[1]*256/this.#C),E=qM(this.#g[2]*256/this.#Q),t=qM(this.#g[3]*256/this.#C);if(zM(this.#I,A,C,I,E,t),Q)for(let e of Q)for(let i of e)i!==A&&zM(this.#I,i,C,I,E,t);return B||(this._pendingBBoxIdx=-1),this}bboxToClipBoxDropOperation(A){return this._pendingBBoxIdx===A&&(this._pendingBBoxIdx=-1,this.#B[0]=Math.max(this.#B[0],this.#g[0]),this.#B[1]=Math.max(this.#B[1],this.#g[1]),this.#B[2]=Math.min(this.#B[2],this.#g[2]),this.#B[3]=Math.min(this.#B[3],this.#g[3])),this}take(){return new Rw(this.#t,this.#I)}takeDebugMetadata(){throw new Error("Unreachable")}recordSimpleData(A,B){return this}recordIncrementalData(A,B){return this}resetIncrementalData(A,B){return this}recordNamedData(A,B){return this}recordSimpleDataFromNamed(A,B,Q){return this}recordFutureForcedDependency(A,B){return this}inheritSimpleDataAsFutureForcedDependencies(A){return this}inheritPendingDependenciesAsFutureForcedDependencies(){return this}recordCharacterBBox(A,B,Q,C=1,I=0,E=0,t){return this}getSimpleIndex(A){}recordDependencies(A,B){return this}recordNamedDependency(A,B){return this}recordShowTextOperation(A,B=!1){return this}},mw=class{#A={__proto__:null};#B={__proto__:null,transform:[],moveText:[],sameLineText:[],[mI]:[]};#g=new Map;#Q=new Set;#C=new Map;#I;#t;#E;constructor(A,B=!1){this.#E=A,B&&(this.#I=new Map,this.#t=(Q,C)=>{_M(this.#I,C).dependencies.add(Q)})}get clipBox(){return this.#E.clipBox}growOperationsCount(A){this.#E.growOperationsCount(A)}save(A){return this.#A={__proto__:this.#A},this.#B={__proto__:this.#B,transform:{__proto__:this.#B.transform},moveText:{__proto__:this.#B.moveText},sameLineText:{__proto__:this.#B.sameLineText},[mI]:{__proto__:this.#B[mI]}},this.#E.save(A),this}restore(A){this.#E.restore(A,this.#t);let B=Object.getPrototypeOf(this.#A);return B===null?this:(this.#A=B,this.#B=Object.getPrototypeOf(this.#B),this)}recordOpenMarker(A){return this.#E.recordOpenMarker(A,this.#t),this}getOpenMarker(){return this.#E.getOpenMarker()}recordCloseMarker(A){return this.#E.recordCloseMarker(A,this.#t),this}beginMarkedContent(A){return this.#E.beginMarkedContent(A),this}endMarkedContent(A){return this.#E.endMarkedContent(A,this.#t),this}pushBaseTransform(A){return this.#E.pushBaseTransform(A),this}popBaseTransform(){return this.#E.popBaseTransform(),this}recordSimpleData(A,B){return this.#A[A]=B,this}recordIncrementalData(A,B){return this.#B[A].push(B),this}resetIncrementalData(A,B){return this.#B[A].length=0,this}recordNamedData(A,B){return this.#g.set(A,B),this}recordSimpleDataFromNamed(A,B,Q){this.#A[A]=this.#g.get(B)??Q}recordFutureForcedDependency(A,B){return this.recordIncrementalData(mI,B),this}inheritSimpleDataAsFutureForcedDependencies(A){for(let B of A)B in this.#A&&this.recordFutureForcedDependency(B,this.#A[B]);return this}inheritPendingDependenciesAsFutureForcedDependencies(){for(let A of this.#Q)this.recordFutureForcedDependency(mI,A);return this}resetBBox(A){return this.#E.resetBBox(A),this}recordClipBox(A,B,Q,C,I,E){return this.#E.recordClipBox(A,B,Q,C,I,E),this}recordBBox(A,B,Q,C,I,E){return this.#E.recordBBox(A,B,Q,C,I,E),this}recordCharacterBBox(A,B,Q,C=1,I=0,E=0,t){let e=Q.bbox,i,s;if(e&&(i=e[2]!==e[0]&&e[3]!==e[1]&&this.#C.get(Q),i!==!1&&(s=[0,0,0,0],RA.axialAlignedBoundingBox(e,Q.fontMatrix,s),(C!==1||I!==0||E!==0)&&bk(C,-C,I,E,s),i)))return this.recordBBox(A,B,s[0],s[2],s[1],s[3]);if(!t)return this.recordFullPageBBox(A);let o=t();return e&&s&&i===void 0&&(i=s[0]<=I-o.actualBoundingBoxLeft&&s[2]>=I+o.actualBoundingBoxRight&&s[1]<=E-o.actualBoundingBoxAscent&&s[3]>=E+o.actualBoundingBoxDescent,this.#C.set(Q,i),i)?this.recordBBox(A,B,s[0],s[2],s[1],s[3]):this.recordBBox(A,B,I-o.actualBoundingBoxLeft,I+o.actualBoundingBoxRight,E-o.actualBoundingBoxAscent,E+o.actualBoundingBoxDescent)}recordFullPageBBox(A){return this.#E.recordFullPageBBox(A),this}getSimpleIndex(A){return this.#A[A]}recordDependencies(A,B){let Q=this.#Q,C=this.#A,I=this.#B;for(let E of B)E in this.#A?Q.add(C[E]):E in I&&I[E].forEach(Q.add,Q);return this}recordNamedDependency(A,B){return this.#g.has(B)&&this.#Q.add(this.#g.get(B)),this}recordOperation(A,B=!1){if(this.recordDependencies(A,[mI]),this.#I){let C=_M(this.#I,A),{dependencies:I}=C;this.#Q.forEach(I.add,I),this.#E._savesStack.forEach(I.add,I),this.#E._markedContentStack.forEach(I.add,I),I.delete(A),C.isRenderingOperation=!0}let Q=!B&&A===this.#E._pendingBBoxIdx;return this.#E.recordOperation(A,B,[this.#Q,this.#E._savesStack,this.#E._markedContentStack]),Q&&this.#Q.clear(),this}recordShowTextOperation(A,B=!1){let Q=Array.from(this.#Q);this.recordOperation(A,B),this.recordIncrementalData("sameLineText",A);for(let C of Q)this.recordIncrementalData("sameLineText",C);return this}bboxToClipBoxDropOperation(A,B=!1){let Q=!B&&A===this.#E._pendingBBoxIdx;return this.#E.bboxToClipBoxDropOperation(A),Q&&this.#Q.clear(),this}take(){return this.#C.clear(),this.#E.take()}takeDebugMetadata(){return this.#I}},Ot=class g{#A;#B;#g;#Q=0;#C=0;constructor(A,B,Q){if(A instanceof g&&A.#g===!!Q)return A;this.#A=A,this.#B=B,this.#g=!!Q}get clipBox(){return this.#A.clipBox}growOperationsCount(){throw new Error("Unreachable")}save(A){return this.#C++,this.#A.save(this.#B),this}restore(A){return this.#C>0&&(this.#A.restore(this.#B),this.#C--),this}recordOpenMarker(A){return this.#Q++,this}getOpenMarker(){return this.#Q>0?this.#B:this.#A.getOpenMarker()}recordCloseMarker(A){return this.#Q--,this}beginMarkedContent(A){return this}endMarkedContent(A){return this}pushBaseTransform(A){return this.#A.pushBaseTransform(A),this}popBaseTransform(){return this.#A.popBaseTransform(),this}recordSimpleData(A,B){return this.#A.recordSimpleData(A,this.#B),this}recordIncrementalData(A,B){return this.#A.recordIncrementalData(A,this.#B),this}resetIncrementalData(A,B){return this.#A.resetIncrementalData(A,this.#B),this}recordNamedData(A,B){return this}recordSimpleDataFromNamed(A,B,Q){return this.#A.recordSimpleDataFromNamed(A,B,this.#B),this}recordFutureForcedDependency(A,B){return this.#A.recordFutureForcedDependency(A,this.#B),this}inheritSimpleDataAsFutureForcedDependencies(A){return this.#A.inheritSimpleDataAsFutureForcedDependencies(A),this}inheritPendingDependenciesAsFutureForcedDependencies(){return this.#A.inheritPendingDependenciesAsFutureForcedDependencies(),this}resetBBox(A){return this.#g||this.#A.resetBBox(this.#B),this}recordClipBox(A,B,Q,C,I,E){return this.#g||this.#A.recordClipBox(this.#B,B,Q,C,I,E),this}recordBBox(A,B,Q,C,I,E){return this.#g||this.#A.recordBBox(this.#B,B,Q,C,I,E),this}recordCharacterBBox(A,B,Q,C,I,E,t){return this.#g||this.#A.recordCharacterBBox(this.#B,B,Q,C,I,E,t),this}recordFullPageBBox(A){return this.#g||this.#A.recordFullPageBBox(this.#B),this}getSimpleIndex(A){return this.#A.getSimpleIndex(A)}recordDependencies(A,B){return this.#A.recordDependencies(this.#B,B),this}recordNamedDependency(A,B){return this.#A.recordNamedDependency(this.#B,B),this}recordOperation(A){return this.#A.recordOperation(this.#B,!0),this}recordShowTextOperation(A){return this.#A.recordShowTextOperation(this.#B,!0),this}bboxToClipBoxDropOperation(A){return this.#g||this.#A.bboxToClipBoxDropOperation(this.#B,!0),this}take(){throw new Error("Unreachable")}takeDebugMetadata(){throw new Error("Unreachable")}},vg={stroke:["path","transform","filter","strokeColor","strokeAlpha","lineWidth","lineCap","lineJoin","miterLimit","dash"],fill:["path","transform","filter","fillColor","fillAlpha","globalCompositeOperation","SMask"],imageXObject:["transform","SMask","filter","fillAlpha","strokeAlpha","globalCompositeOperation"],rawFillPath:["filter","fillColor","fillAlpha"],showText:["transform","leading","charSpacing","wordSpacing","hScale","textRise","moveText","textMatrix","font","fontObj","filter","fillColor","textRenderingMode","SMask","fillAlpha","strokeAlpha","globalCompositeOperation","sameLineText"],transform:["transform"],transformAndFill:["transform","filter","fillColor"]},uw=class g{#A;#B;#g=4;#Q=0;#C=new g.#I(this.#g*6);static#I=lB.isFloat16ArraySupported?Float16Array:Float32Array;constructor(A){this.#A=A.width,this.#B=A.height}record(A,B,Q,C){if(this.#Q===this.#g){this.#g*=2;let t=new g.#I(this.#g*6);t.set(this.#C),this.#C=t}let I=UB(A),E;if(C[0]!==1/0){let t=fQ.slice();RA.axialAlignedBoundingBox([0,-Q,B,0],I,t);let e=RA.intersect(C,t);if(!e)return;let[i,s,o,w]=e;if(i!==t[0]||s!==t[1]||o!==t[2]||w!==t[3]){let a=Math.atan2(I[1],I[0]),c=Math.abs(Math.sin(a)),n=Math.abs(Math.cos(a));if(c<1e-6||n<1e-6||Math.abs(c-n)<1e-6)E=[i,s,i,w,o,s];else{let r=o-i,h=w-s,D=c*c,l=n*n,G=n*c,M=l-D,f=(h*l-r*G)/M,d=(h*G-r*D)/M;E=[i+d,s,i,s+f,o,w-f]}}}E||(E=[0,-Q,0,0,B,-Q],RA.applyTransform(E,I,0),RA.applyTransform(E,I,2),RA.applyTransform(E,I,4)),E[0]/=this.#A,E[1]/=this.#B,E[2]/=this.#A,E[3]/=this.#B,E[4]/=this.#A,E[5]/=this.#B,this.#C.set(E,this.#Q*6),this.#Q++}take(){return this.#C.subarray(0,this.#Q*6)}},$M=/\p{Cc}/u;function Nk(g){let A=g[0];if(g.length<2||A!=='"'&&A!=="'"||g.at(-1)!==A)return!1;let B=g.length-1;for(let Q=1;Q<B;Q++){let C=g[Q];if(C===A||$M.test(C)||C==="\\"&&(++Q>=B||$M.test(g[Q])))return!1}return!0}function Af(g){return Nk(g)?g:`"${g.replaceAll(/["\\\p{Cc}]/gu,B=>B==='"'||B==="\\"?`\\${B}`:`\\${B.codePointAt(0).toString(16)} `)}"`}var pw=class{#A=new Set;#B=new Set;#g=null;constructor({ownerDocument:A=globalThis.document,styleElement:B=null}){this._document=A,this.styleElement=null,this.loadingRequests=[],this.loadTestFontId=0}addNativeFontFace(A){this.#A.add(A),this._document.fonts.add(A)}removeNativeFontFace(A){this.#A.delete(A),this._document.fonts.delete(A)}insertRule(A){let B=this.#Q();B.insertRule(A,B.cssRules.length)}#Q(){if(this.#g)return this.#g;let A=this._document.defaultView?.CSSStyleSheet||globalThis.CSSStyleSheet;if(!this.styleElement&&A){let{adoptedStyleSheets:B}=this._document;if(B){let Q=new A;return B.push(Q),this.#g=Q}}return this.styleElement||(this.styleElement=this._document.createElement("style"),this._document.documentElement.getElementsByTagName("head")[0].append(this.styleElement)),this.#g=this.styleElement.sheet}clear(){for(let A of this.#A)this._document.fonts.delete(A);if(this.#A.clear(),this.#B.clear(),this.#g){let{adoptedStyleSheets:A}=this._document;A?.includes(this.#g)&&(this._document.adoptedStyleSheets=A.filter(B=>B!==this.#g)),this.#g=null}this.styleElement?.remove(),this.styleElement=null}async loadSystemFont({systemFontInfo:A,disableFontFace:B,_inspectFont:Q}){if(!(!A||this.#B.has(A.loadedName))){if(bB(!B,"loadSystemFont shouldn't be called when `disableFontFace` is set."),this.isFontLoadingAPISupported){let{loadedName:C,src:I,style:E}=A,t=new FontFace(C,I,E);this.addNativeFontFace(t);try{await t.load(),this.#B.add(C),Q?.(A)}catch{AB(`Cannot load system font: ${A.baseFontName}, installing it could help to improve PDF rendering.`),this.removeNativeFontFace(t)}return}cB("Not implemented: loadSystemFont without the Font Loading API.")}}async bind(A){if(A.attached||A.missingFile&&!A.systemFontInfo)return;if(A.attached=!0,A.systemFontInfo){await this.loadSystemFont(A);return}if(this.isFontLoadingAPISupported){let Q=A.createNativeFontFace();if(Q){this.addNativeFontFace(Q);try{await Q.loaded}catch(C){throw AB(`Failed to load font '${Q.family}': '${C}'.`),A.disableFontFace=!0,C}}return}let B=A.createFontFaceRule();if(B){if(this.insertRule(B),this.isSyncFontLoadingSupported)return;await this.#C(A)}}get isFontLoadingAPISupported(){return pA(this,"isFontLoadingAPISupported",!!this._document?.fonts)}get isSyncFontLoadingSupported(){return pA(this,"isSyncFontLoadingSupported",yg||lB.platform.isFirefox)}#C(A){function B(){for(bB(!E.done,"completeRequest() cannot be called twice."),E.done=!0;Q.length>0&&Q[0].done;){let U=Q.shift();setTimeout(U.resolve,0)}}let{loadingRequests:Q}=this,{promise:C,resolve:I}=Promise.withResolvers(),E={done:!1,resolve:I};Q.push(E),this._loadTestFont??=atob("T1RUTwALAIAAAwAwQ0ZGIDHtZg4AAAOYAAAAgUZGVE1lkzZwAAAEHAAAABxHREVGABQAFQAABDgAAAAeT1MvMlYNYwkAAAEgAAAAYGNtYXABDQLUAAACNAAAAUJoZWFk/xVFDQAAALwAAAA2aGhlYQdkA+oAAAD0AAAAJGhtdHgD6AAAAAAEWAAAAAZtYXhwAAJQAAAAARgAAAAGbmFtZVjmdH4AAAGAAAAAsXBvc3T/hgAzAAADeAAAACAAAQAAAAEAALZRFsRfDzz1AAsD6AAAAADOBOTLAAAAAM4KHDwAAAAAA+gDIQAAAAgAAgAAAAAAAAABAAADIQAAAFoD6AAAAAAD6AABAAAAAAAAAAAAAAAAAAAAAQAAUAAAAgAAAAQD6AH0AAUAAAKKArwAAACMAooCvAAAAeAAMQECAAACAAYJAAAAAAAAAAAAAQAAAAAAAAAAAAAAAFBmRWQAwAAuAC4DIP84AFoDIQAAAAAAAQAAAAAAAAAAACAAIAABAAAADgCuAAEAAAAAAAAAAQAAAAEAAAAAAAEAAQAAAAEAAAAAAAIAAQAAAAEAAAAAAAMAAQAAAAEAAAAAAAQAAQAAAAEAAAAAAAUAAQAAAAEAAAAAAAYAAQAAAAMAAQQJAAAAAgABAAMAAQQJAAEAAgABAAMAAQQJAAIAAgABAAMAAQQJAAMAAgABAAMAAQQJAAQAAgABAAMAAQQJAAUAAgABAAMAAQQJAAYAAgABWABYAAAAAAAAAwAAAAMAAAAcAAEAAAAAADwAAwABAAAAHAAEACAAAAAEAAQAAQAAAC7//wAAAC7////TAAEAAAAAAAABBgAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAD/gwAyAAAAAQAAAAAAAAAAAAAAAAAAAAABAAQEAAEBAQJYAAEBASH4DwD4GwHEAvgcA/gXBIwMAYuL+nz5tQXkD5j3CBLnEQACAQEBIVhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYAAABAQAADwACAQEEE/t3Dov6fAH6fAT+fPp8+nwHDosMCvm1Cvm1DAz6fBQAAAAAAAABAAAAAMmJbzEAAAAAzgTjFQAAAADOBOQpAAEAAAAAAAAADAAUAAQAAAABAAAAAgABAAAAAAAAAAAD6AAAAAAAAA==");function t(U,H){return U.charCodeAt(H)<<24|U.charCodeAt(H+1)<<16|U.charCodeAt(H+2)<<8|U.charCodeAt(H+3)&255}function e(U){return String.fromCharCode(U>>24&255,U>>16&255,U>>8&255,U&255)}function i(U,H,S,T){let j=U.substring(0,H),x=U.substring(H+S);return j+T+x}let s,o,w=this._document.createElement("canvas");w.width=1,w.height=1;let a=w.getContext("2d"),c=0;function n(U,H){if(++c>30){AB("Load test font never loaded."),H();return}if(a.font="30px "+U,a.fillText(".",0,20),a.getImageData(0,0,1,1).data[3]>0){H();return}setTimeout(n.bind(null,U,H))}let r=`lt${Date.now()}${this.loadTestFontId++}`,h=this._loadTestFont;h=i(h,976,r.length,r);let l=16,G=1482184792,M=t(h,l);for(s=0,o=r.length-3;s<o;s+=4)M=M-G+t(r,s)|0;s<r.length&&(M=M-G+t(r+"XXX",s)|0),h=i(h,l,4,e(M));let f=`url(data:font/opentype;base64,${btoa(h)});`,d=`@font-face {font-family:"${r}";src:${f}}`;this.insertRule(d);let Y=this._document.createElement("div");Y.style.visibility="hidden",Y.style.width=Y.style.height="10px",Y.style.position="absolute",Y.style.top=Y.style.left="0px";for(let U of[A.loadedName,r]){let H=this._document.createElement("span");H.textContent="Hi",H.style.fontFamily=U,Y.append(H)}return this._document.body.append(Y),n(r,()=>{Y.remove(),B()}),C}},Kw=class{#A=new Map;#B;constructor(A,B=null,Q,C){this.#B=A,this._inspectFont=B,Q&&(this.charProcOperatorList=Q),C&&Object.assign(this,C)}createNativeFontFace(){let{data:A}=this;if(!A||this.disableFontFace)return null;let B;if(!this.cssFontInfo)B=new FontFace(this.loadedName,A,{});else{let Q={weight:this.cssFontInfo.fontWeight};this.cssFontInfo.italicAngle&&(Q.style=`oblique ${this.cssFontInfo.italicAngle}deg`),B=new FontFace(Af(this.cssFontInfo.fontFamily),A,Q)}return this._inspectFont?.(this),B}createFontFaceRule(){let{data:A}=this;if(!A||this.disableFontFace)return null;let B=`url(data:${this.mimetype};base64,${A.toBase64()});`,Q;if(!this.cssFontInfo)Q=`@font-face {font-family:"${this.loadedName}";src:${B}}`;else{let C=`font-weight: ${this.cssFontInfo.fontWeight};`;this.cssFontInfo.italicAngle&&(C+=`font-style: oblique ${this.cssFontInfo.italicAngle}deg;`),Q=`@font-face {font-family:${Af(this.cssFontInfo.fontFamily)};${C}src:${B}}`}return this._inspectFont?.(this,B),Q}getPathGenerator(A,B){let Q=this.#A.get(B);if(Q)return Q;let C=`${this.loadedName}_path_${B}`,I;try{I=A.get(C)}catch(E){AB(`getPathGenerator - ignoring character: "${E}".`)}return Q=lf(I?.path),this.fontExtraProperties||A.delete(C),this.#A.set(B,Q),Q}get black(){return this.#B.black}get bold(){return this.#B.bold}get disableFontFace(){return this.#B.disableFontFace}set disableFontFace(A){pA(this,"disableFontFace",!!A)}get fontExtraProperties(){return this.#B.fontExtraProperties}get isInvalidPDFjsFont(){return this.#B.isInvalidPDFjsFont}get isType3Font(){return this.#B.isType3Font}get italic(){return this.#B.italic}get missingFile(){return this.#B.missingFile}get remeasure(){return this.#B.remeasure}get vertical(){return this.#B.vertical}get bbox(){return this.#B.bbox}get fontMatrix(){return this.#B.fontMatrix}get fallbackName(){return this.#B.fallbackName}get loadedName(){return this.#B.loadedName}get mimetype(){return this.missingFile?null:"font/opentype"}get data(){return this.#B.data}clearData(){this.#B.clearData()}get cssFontInfo(){return this.#B.cssFontInfo}get systemFontInfo(){return this.#B.systemFontInfo}},Jw=class{static strings=["fontFamily","fontWeight","italicAngle"]},yw=class{static strings=["css","loadedName","baseFontName","src"]},iC=class{static bools=["black","bold","disableFontFace","fontExtraProperties","isInvalidPDFjsFont","isType3Font","italic","missingFile","remeasure","vertical"];static strings=["fallbackName","loadedName"];static OFFSET_BBOX=Math.ceil(this.bools.length*2/8);static OFFSET_FONT_MATRIX=this.OFFSET_BBOX+1+8;static OFFSET_STRINGS=this.OFFSET_FONT_MATRIX+1+48},xQ=class{static KIND=0;static HAS_BBOX=1;static HAS_BACKGROUND=2;static SHADING_TYPE=3;static N_COORD=4;static N_COLOR=8;static N_STOP=12;static N_FIGURES=16},bw=class{static get decoder(){return pA(this,"decoder",new TextDecoder)}static get encoder(){return pA(this,"encoder",new TextEncoder)}};function yt(g,A,B,Q=0){let{decoder:C}=bw;for(let E=0;E<B;E++)Q+=A.getUint32(Q)+4;let I=A.getUint32(Q);return C.decode(new Uint8Array(g,Q+4,I))}var Nw=class{#A;#B;constructor(A){this.#A=A,this.#B=new DataView(A)}#g(A){return bB(A<Jw.strings.length,"Invalid string index"),yt(this.#A,this.#B,A)}get fontFamily(){return pA(this,"fontFamily",this.#g(0))}get fontWeight(){return pA(this,"fontWeight",this.#g(1))}get italicAngle(){return pA(this,"italicAngle",this.#g(2))}},Lw=class{#A;#B;constructor(A){this.#A=A,this.#B=new DataView(A)}#g(A){return bB(A<yw.strings.length,"Invalid string index"),yt(this.#A,this.#B,A,4)}get css(){return pA(this,"css",this.#g(0))}get loadedName(){return pA(this,"loadedName",this.#g(1))}get baseFontName(){return pA(this,"baseFontName",this.#g(2))}get src(){return pA(this,"src",this.#g(3))}get style(){let A=0;A+=4+this.#B.getUint32(A);let B=yt(this.#A,this.#B,0,A),Q=yt(this.#A,this.#B,1,A);return pA(this,"style",{style:B,weight:Q})}},xw=class{#A;#B;constructor(A){this.#A=A,this.#B=new DataView(A)}#g(A){bB(A<iC.bools.length,"Invalid boolean index");let B=Math.floor(A/4),Q=A*2%8,C=this.#B.getUint8(B)>>Q&3;return C===0?void 0:C===2}get black(){return pA(this,"black",this.#g(0))}get bold(){return pA(this,"bold",this.#g(1))}get disableFontFace(){return pA(this,"disableFontFace",this.#g(2))}get fontExtraProperties(){return pA(this,"fontExtraProperties",this.#g(3))}get isInvalidPDFjsFont(){return pA(this,"isInvalidPDFjsFont",this.#g(4))}get isType3Font(){return pA(this,"isType3Font",this.#g(5))}get italic(){return pA(this,"italic",this.#g(6))}get missingFile(){return pA(this,"missingFile",this.#g(7))}get remeasure(){return pA(this,"remeasure",this.#g(8))}get vertical(){return pA(this,"vertical",this.#g(9))}#Q(A,B,Q,C){let I=this.#B.getUint8(A++);if(I===0)return;bB(I===B,"Invalid array length.");let E=new Array(I);for(let t=0;t<I;t++)E[t]=this.#B[Q](A,!0),A+=C;return E}get bbox(){return pA(this,"bbox",this.#Q(iC.OFFSET_BBOX,4,"getInt16",2))}get fontMatrix(){return pA(this,"fontMatrix",this.#Q(iC.OFFSET_FONT_MATRIX,6,"getFloat64",8))}#C(A){return bB(A<iC.strings.length,"Invalid string index"),yt(this.#A,this.#B,A,iC.OFFSET_STRINGS+4)}get fallbackName(){return pA(this,"fallbackName",this.#C(0))}get loadedName(){return pA(this,"loadedName",this.#C(1))}#I(A){let B=iC.OFFSET_STRINGS;for(let C=0;C<=A;C++)B+=4+this.#B.getUint32(B);let Q=this.#B.getUint32(B);return{offset:B,length:Q}}get data(){let{offset:A,length:B}=this.#I(2);return B?new Uint8Array(this.#A,A+4,B):void 0}clearData(){let{offset:A,length:B}=this.#I(2);B&&(this.#B.setUint32(A,0),this.#A=new Uint8Array(this.#A,0,A+4).slice().buffer,this.#B=new DataView(this.#A))}get cssFontInfo(){let{offset:A,length:B}=this.#I(1),Q=null;if(B){let C=new Uint8Array(this.#A,A+4,B).slice();Q=new Nw(C.buffer)}return pA(this,"cssFontInfo",Q)}get systemFontInfo(){let{offset:A,length:B}=this.#I(0),Q=null;if(B){let C=new Uint8Array(this.#A,A+4,B).slice();Q=new Lw(C.buffer)}return pA(this,"systemFontInfo",Q)}},Xw=class{constructor(A){this.buffer=A,this.view=new DataView(A),this.data=new Uint8Array(A)}getIR(){let A=this.view,B=this.data[xQ.KIND],Q=!!this.data[xQ.HAS_BBOX],C=!!this.data[xQ.HAS_BACKGROUND],I=A.getUint32(xQ.N_COORD,!0),E=A.getUint32(xQ.N_COLOR,!0),t=A.getUint32(xQ.N_STOP,!0),e=20,i=new Float32Array(this.buffer,e,I*2);e+=I*8;let s=new Uint8Array(this.buffer,e,E*4);e+=E*4;let o=[];for(let c=0;c<t;++c){let n=A.getFloat32(e,!0);e+=4;let r=A.getUint32(e,!0);e+=4,o.push([n,`#${r.toString(16).padStart(6,"0")}`])}let w=null;if(Q){w=[];for(let c=0;c<4;++c)w.push(A.getFloat32(e,!0)),e+=4}let a=null;if(C&&(a=new Uint8Array(this.buffer,e,3),e+=3),B===1)return["RadialAxial","axial",w,o,[i[0],i[1]],[i[2],i[3]],null,null];if(B===2)return["RadialAxial","radial",w,o,[i[0],i[1]],[i[3],i[4]],i[2],i[5]];if(B===3){let c=this.data[xQ.SHADING_TYPE],n=null;if(i.length>0){n=fQ.slice();for(let r=0,h=i.length;r<h;r+=2)RA.pointBoundingBox(i[r],i[r+1],n)}return["Mesh",c,i,s,I,n,w,a]}throw new Error(`Unsupported pattern kind: ${B}`)}},jw=class{#A;constructor(A){this.#A=A}get path(){return lB.isFloat16ArraySupported?new Float16Array(this.#A):new Float32Array(this.#A)}};function Lk(g){if(g instanceof URL)return g;if(typeof g=="string"){if(yg){if(/^[a-z][a-z0-9\-+.]+:/i.test(g))return new URL(g);let B=process.getBuiltinModule("url");return new URL(B.pathToFileURL(g))}let A=URL.parse(g,window.location);if(A)return A}throw new Error("Invalid PDF url data: either string or URL-object is expected in the url property.")}function xk(g){if(yg&&typeof Buffer<"u"&&g instanceof Buffer)throw new Error("Please provide binary data as `Uint8Array`, rather than `Buffer`.");if(g instanceof Uint8Array&&g.byteLength===g.buffer.byteLength)return g;if(typeof g=="string")return Ri(g);if(g instanceof ArrayBuffer||ArrayBuffer.isView(g)||typeof g=="object"&&!isNaN(g?.length))return new Uint8Array(g);throw new Error("Invalid PDF binary data: either TypedArray, string, or array-like object is expected in the data property.")}function Pe(g){if(typeof g!="string")return null;if(g.endsWith("/"))return g;throw new Error(`Invalid factory url: "${g}" must include trailing slash.`)}var Tw=g=>typeof g=="object"&&Number.isInteger(g?.num)&&g.num>=0&&Number.isInteger(g?.gen)&&g.gen>=0,Xk=g=>typeof g=="object"&&typeof g?.name=="string",jk=kk.bind(null,Tw,Xk),Vw=class{#A=new Map;#B=Promise.resolve();postMessage(A,B){let Q={data:structuredClone(A,B?{transfer:B}:null)};this.#B.then(()=>{for(let[C]of this.#A)C.call(this,Q)})}addEventListener(A,B,Q=null){let C=null;if(Q?.signal instanceof AbortSignal){let{signal:I}=Q;if(I.aborted){AB("LoopbackPort - cannot use an `aborted` signal.");return}let E=()=>this.removeEventListener(A,B);C=()=>I.removeEventListener("abort",E),I.addEventListener("abort",E)}this.#A.set(B,C)}removeEventListener(A,B){this.#A.get(B)?.(),this.#A.delete(B)}terminate(){for(let[,A]of this.#A)A?.();this.#A.clear()}},We={DATA:1,ERROR:2},WB={CANCEL:1,CANCEL_COMPLETE:2,CLOSE:3,ENQUEUE:4,ERROR:5,PULL:6,PULL_COMPLETE:7,START_COMPLETE:8};function Bf(){}function Hg(g){if(g instanceof dQ||g instanceof xt||g instanceof Lt||g instanceof NI||g instanceof Kt)return g;switch(g instanceof Error||typeof g=="object"&&g!==null||cB('wrapReason: Expected "reason" to be a (possibly cloned) Error.'),g.name){case"AbortException":return new dQ(g.message);case"InvalidPDFException":return new xt(g.message);case"PasswordException":return new Lt(g.message,g.code);case"ResponseException":return new NI(g.message,g.status,g.missing);case"UnknownErrorException":return new Kt(g.message,g.details)}return new Kt(g.message,g.toString())}var XC=class{#A=new Map;#B=new Map;#g=1;#Q;#C=new AbortController;#I;#t=new Map;#E=1;#e=new Map;#i;constructor(A,B,Q){this.#I=A,this.#i=B,this.#Q=Q,Q.addEventListener("message",this.#w.bind(this),{signal:this.#C.signal})}#w({data:A}){if(A.targetName!==this.#I)return;if(A.stream){this.#a(A);return}if(A.callback){let{callbackId:Q,callback:C}=A,I=this.#B.get(Q);if(!I)throw new Error(`Cannot resolve callback ${Q}`);if(this.#B.delete(Q),C===We.DATA)I.resolve(A.data);else if(C===We.ERROR)I.reject(Hg(A.reason));else throw new Error("Unexpected callback case");return}let B=this.#A.get(A.action);if(!B)throw new Error(`Unknown action from worker: ${A.action}`);if(A.callbackId){let Q=this.#I,C=A.sourceName,I=this.#Q;Promise.try(B,A.data).then(E=>{I.postMessage({sourceName:Q,targetName:C,callback:We.DATA,callbackId:A.callbackId,data:E})},E=>{I.postMessage({sourceName:Q,targetName:C,callback:We.ERROR,callbackId:A.callbackId,reason:Hg(E)})});return}if(A.streamId){this.#s(A);return}B(A.data)}on(A,B){let Q=this.#A;if(Q.has(A))throw new Error(`There is already a "${A}" handler.`);Q.set(A,B)}send(A,B,Q){this.#Q.postMessage({sourceName:this.#I,targetName:this.#i,action:A,data:B},Q)}sendWithPromise(A,B,Q){let C=this.#g++,I=Promise.withResolvers();this.#B.set(C,I);try{this.#Q.postMessage({sourceName:this.#I,targetName:this.#i,action:A,callbackId:C,data:B},Q)}catch(E){I.reject(E)}return I.promise}sendWithStream(A,B,Q,C){let I=this.#E++,E=this.#I,t=this.#i,e=this.#Q;return new ReadableStream({start:i=>{let s=Promise.withResolvers();return this.#t.set(I,{controller:i,startCall:s,pullCall:null,cancelCall:null,isClosed:!1}),e.postMessage({sourceName:E,targetName:t,action:A,streamId:I,data:B,desiredSize:i.desiredSize},C),s.promise},pull:i=>{let s=Promise.withResolvers();return this.#t.get(I).pullCall=s,e.postMessage({sourceName:E,targetName:t,stream:WB.PULL,streamId:I,desiredSize:i.desiredSize}),s.promise},cancel:i=>{bB(i instanceof Error,"cancel must have a valid reason");let s=Promise.withResolvers();return this.#t.get(I).cancelCall=s,this.#t.get(I).isClosed=!0,e.postMessage({sourceName:E,targetName:t,stream:WB.CANCEL,streamId:I,reason:Hg(i)}),s.promise}},Q)}#s(A){let B=A.streamId,Q=this.#I,C=A.sourceName,I=this.#Q,E=this.#e,t=this.#A.get(A.action),e={enqueue(i,s=1,o){if(this.isCancelled)return;let w=this.desiredSize;this.desiredSize-=s,w>0&&this.desiredSize<=0&&(this.sinkCapability=Promise.withResolvers(),this.ready=this.sinkCapability.promise),I.postMessage({sourceName:Q,targetName:C,stream:WB.ENQUEUE,streamId:B,chunk:i},o)},close(){this.isCancelled||(this.isCancelled=!0,I.postMessage({sourceName:Q,targetName:C,stream:WB.CLOSE,streamId:B}),E.delete(B))},error(i){bB(i instanceof Error,"error must have a valid reason"),!this.isCancelled&&(this.isCancelled=!0,I.postMessage({sourceName:Q,targetName:C,stream:WB.ERROR,streamId:B,reason:Hg(i)}))},sinkCapability:Promise.withResolvers(),onPull:null,onCancel:null,isCancelled:!1,desiredSize:A.desiredSize,ready:null};e.sinkCapability.resolve(),e.ready=e.sinkCapability.promise,E.set(B,e),Promise.try(t,A.data,e).then(()=>{I.postMessage({sourceName:Q,targetName:C,stream:WB.START_COMPLETE,streamId:B,success:!0})},i=>{I.postMessage({sourceName:Q,targetName:C,stream:WB.START_COMPLETE,streamId:B,reason:Hg(i)})})}#a(A){let B=A.streamId,Q=this.#I,C=A.sourceName,I=this.#Q,E=this.#t.get(B),t=this.#e.get(B);switch(A.stream){case WB.START_COMPLETE:A.success?E.startCall.resolve():E.startCall.reject(Hg(A.reason));break;case WB.PULL_COMPLETE:A.success?E.pullCall.resolve():E.pullCall.reject(Hg(A.reason));break;case WB.PULL:if(!t){I.postMessage({sourceName:Q,targetName:C,stream:WB.PULL_COMPLETE,streamId:B,success:!0});break}t.desiredSize<=0&&A.desiredSize>0&&t.sinkCapability.resolve(),t.desiredSize=A.desiredSize,Promise.try(t.onPull||Bf).then(()=>{I.postMessage({sourceName:Q,targetName:C,stream:WB.PULL_COMPLETE,streamId:B,success:!0})},i=>{I.postMessage({sourceName:Q,targetName:C,stream:WB.PULL_COMPLETE,streamId:B,reason:Hg(i)})});break;case WB.ENQUEUE:if(bB(E,"enqueue should have stream controller"),E.isClosed)break;E.controller.enqueue(A.chunk);break;case WB.CLOSE:if(bB(E,"close should have stream controller"),E.isClosed)break;E.isClosed=!0,E.controller.close(),this.#n(E,B);break;case WB.ERROR:bB(E,"error should have stream controller"),E.controller.error(Hg(A.reason)),this.#n(E,B);break;case WB.CANCEL_COMPLETE:A.success?E.cancelCall.resolve():E.cancelCall.reject(Hg(A.reason)),this.#n(E,B);break;case WB.CANCEL:if(!t)break;let e=Hg(A.reason);Promise.try(t.onCancel||Bf,e).then(()=>{I.postMessage({sourceName:Q,targetName:C,stream:WB.CANCEL_COMPLETE,streamId:B,success:!0})},i=>{I.postMessage({sourceName:Q,targetName:C,stream:WB.CANCEL_COMPLETE,streamId:B,reason:Hg(i)})}),t.sinkCapability.reject(e),t.isCancelled=!0,this.#e.delete(B);break;default:throw new Error("Unexpected stream case")}}async#n(A,B){await Promise.allSettled([A.startCall?.promise,A.pullCall?.promise,A.cancelCall?.promise]),this.#t.delete(B)}destroy(){this.#C?.abort(),this.#C=null}},Ei=class{#A=Object.freeze({cMapUrl:"CMap",standardFontDataUrl:"font",wasmUrl:"wasm"});constructor({cMapUrl:A=null,standardFontDataUrl:B=null,wasmUrl:Q=null}){this.cMapUrl=A,this.standardFontDataUrl=B,this.wasmUrl=Q}async fetch({kind:A,filename:B}){switch(A){case"cMapUrl":case"standardFontDataUrl":case"wasmUrl":break;default:cB(`Not implemented: ${A}`)}let Q=this[A];if(!Q)throw new Error(`Ensure that the \`${A}\` API parameter is provided.`);let C=`${Q}${B}`;return this._fetch(C,A).catch(I=>{throw new Error(`Unable to load ${this.#A[A]} data at: ${C}`)})}async _fetch(A,B){cB("Abstract method `_fetch` called.")}},ei=class extends Ei{async _fetch(A,B){let Q=B==="cMapUrl"&&!A.endsWith(".bcmap")?"text":"bytes",C=await Qn(A,Q);return C instanceof Uint8Array?C:Ri(C)}},ii=class{#A=!1;constructor({enableHWA:A=!1}){this.#A=A}create(A,B){if(A<=0||B<=0)throw new Error("Invalid canvas size");let Q=this._createCanvas(A,B);return{canvas:Q,context:Q.getContext("2d",{willReadFrequently:!this.#A})}}reset({canvas:A},B,Q){if(!A)throw new Error("Canvas is not specified");if(B<=0||Q<=0)throw new Error("Invalid canvas size");A.width=B,A.height=Q}destroy(A){let{canvas:B}=A;if(!B)throw new Error("Canvas is not specified");B.width=B.height=0,A.canvas=null,A.context=null}_createCanvas(A,B){cB("Abstract method `_createCanvas` called.")}},Zw=class extends ii{constructor({ownerDocument:A=globalThis.document,enableHWA:B=!1}){super({enableHWA:B}),this._document=A}_createCanvas(A,B){let Q=this._document.createElement("canvas");return Q.width=A,Q.height=B,Q}},si=class{addFilter(A){return"none"}addHCMFilter(A,B){return"none"}addAlphaFilter(A){return"none"}addLuminosityFilter(A){return"none"}addKnockoutFilter(A=0){return"none"}addHighlightHCMFilter(A,B,Q,C,I){return"none"}addSelectionHCMFilter(A,B){return"none"}addSelectionFilter(){return"none"}createSelectionStyle(A=null){return null}destroy(A=!1){}},Pw=class extends si{#A;#B;#g;#Q;#C;#I;#t=0;constructor({docId:A,ownerDocument:B=globalThis.document}){super(),this.#Q=A,this.#C=B}get#E(){return this.#B||=new Map}get#e(){return this.#I||=new Map}get#i(){if(!this.#g){let A=this.#C.createElement("div"),{style:B}=A;B.colorScheme="only light",B.visibility="hidden",B.contain="strict",B.width=B.height=0,B.position="absolute",B.top=B.left=0,B.zIndex=-1;let Q=this.#C.createElementNS(Dg,"svg");Q.setAttribute("width",0),Q.setAttribute("height",0),this.#g=this.#C.createElementNS(Dg,"defs"),A.append(Q),Q.append(this.#g),this.#C.body.append(A)}return this.#g}#w(A){let B=E=>E&&Array.from(E,t=>t/255).join(",");if(A.length===1){let E=B(A[0]);return[E,E,E]}let[Q,C,I]=A;return[B(Q),B(C),B(I)]}#s(A){if(this.#A===void 0){this.#A="";let B=this.#C.URL;B!==this.#C.baseURI&&(Si(B)?AB('#createUrl: ignore "data:"-URL for performance reasons.'):this.#A=rf(B,""))}return`url(${this.#A}#${A})`}addFilter(A){if(!A)return"none";let B=this.#E.get(A);if(B)return B;let[Q,C,I]=this.#w(A),E=A.length===1?Q:`${Q}${C}${I}`;if(B=this.#E.get(E),B)return this.#E.set(A,B),B;let t=`g_${this.#Q}_transfer_map_${this.#t++}`,e=this.#s(t);this.#E.set(A,e),this.#E.set(E,e);let i=this.#r(t);return this.#c(Q,C,I,i),e}addHCMFilter(A,B){let Q=`${A}-${B}`,C="base",I=this.#e.get(C);if(I?.key===Q||(I?(I.filter?.remove(),I.key=Q,I.url="none",I.filter=null):(I={key:Q,url:"none",filter:null},this.#e.set(C,I)),!A||!B))return I.url;let E=this.#D(A);A=RA.makeHexColor(...E);let t=this.#D(B);if(B=RA.makeHexColor(...t),this.#G(),A==="#000000"&&B==="#ffffff"||A===B)return I.url;let i=Array.from({length:256},(a,c)=>Gw(c/255)).join(","),s=`g_${this.#Q}_hcm_filter`,o=I.filter=this.#r(s);this.#c(i,i,i,o),this.#n(o);let w=(a,c)=>{let n=E[a]/255,r=t[a]/255,h=new Array(c+1);for(let D=0;D<=c;D++)h[D]=n+D/c*(r-n);return h.join(",")};return this.#c(w(0,5),w(1,5),w(2,5),o),I.url=this.#s(s),I.url}addSelectionHCMFilter(A,B){return this.addHighlightHCMFilter("selection",A,B,"HighlightText","Highlight")}addSelectionFilter(){return this.addHighlightHCMFilter("selection_default","black","white","HighlightText","Highlight")}createSelectionStyle(A=null){let B=A?this.addSelectionHCMFilter(A.foreground,A.background):this.addSelectionFilter();return B==="none"||!lB.platform.isFirefox?null:{"backdrop-filter":B,"background-color":"transparent"}}addAlphaFilter(A){let B=this.#E.get(A);if(B)return B;let[Q]=this.#w([A]),C=`alpha_${Q}`;if(B=this.#E.get(C),B)return this.#E.set(A,B),B;let I=`g_${this.#Q}_alpha_map_${this.#t++}`,E=this.#s(I);this.#E.set(A,E),this.#E.set(C,E);let t=this.#r(I);return this.#h(Q,t),E}addLuminosityFilter(A){let B=this.#E.get(A||"luminosity");if(B)return B;let Q,C;if(A?([Q]=this.#w([A]),C=`luminosity_${Q}`):C="luminosity",B=this.#E.get(C),B)return this.#E.set(A,B),B;let I=`g_${this.#Q}_luminosity_map_${this.#t++}`,E=this.#s(I);this.#E.set(A,E),this.#E.set(C,E);let t=this.#r(I);return this.#a(t),A&&this.#h(Q,t),E}addKnockoutFilter(A=0){let B=A>0?Math.min(1/A,1e6):1e6,Q=`knockout_${B}`,C=this.#E.get(Q);if(C)return C;let I=`g_${this.#Q}_knockout_filter_${this.#t++}`,E=this.#s(I);this.#E.set(Q,E);let t=this.#r(I),e=this.#C.createElementNS(Dg,"feComponentTransfer");t.append(e);let i=this.#C.createElementNS(Dg,"feFuncA");return i.setAttribute("type","linear"),i.setAttribute("slope",`${B}`),i.setAttribute("intercept","0"),e.append(i),E}addHighlightHCMFilter(A,B,Q,C,I){let E=`${B}-${Q}-${C}-${I}`,t=this.#e.get(A);if(t?.key===E||(t?(t.filter?.remove(),t.key=E,t.url="none",t.filter=null):(t={key:E,url:"none",filter:null},this.#e.set(A,t)),!B||!Q))return t.url;let[e,i]=[B,Q].map(this.#D.bind(this)),s=Math.round(.2126*e[0]+.7152*e[1]+.0722*e[2]),o=Math.round(.2126*i[0]+.7152*i[1]+.0722*i[2]),[w,a]=[C,I].map(this.#F.bind(this));o<s&&([s,o,w,a]=[o,s,a,w]),this.#G();let c=(h,D,l)=>{let G=new Array(256),M=(o-s)/l,f=h/255,d=(D-h)/(255*l),Y=0;for(let U=0;U<=l;U++){let H=Math.round(s+U*M),S=f+U*d;for(let T=Y;T<=H;T++)G[T]=S;Y=H+1}for(let U=Y;U<256;U++)G[U]=G[Y-1];return G.join(",")},n=`g_${this.#Q}_hcm_${A}_filter`,r=t.filter=this.#r(n);return this.#n(r),this.#c(c(w[0],a[0],5),c(w[1],a[1],5),c(w[2],a[2],5),r),t.url=this.#s(n),t.url}destroy(A=!1){A&&this.#I?.size||(this.#g?.parentNode.parentNode.remove(),this.#g=null,this.#B?.clear(),this.#B=null,this.#I?.clear(),this.#I=null,this.#t=0)}#a(A){let B=this.#C.createElementNS(Dg,"feColorMatrix");B.setAttribute("type","matrix"),B.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"),A.append(B)}#n(A){let B=this.#C.createElementNS(Dg,"feColorMatrix");B.setAttribute("type","matrix"),B.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"),A.append(B)}#r(A){let B=this.#C.createElementNS(Dg,"filter");return B.setAttribute("color-interpolation-filters","sRGB"),B.setAttribute("id",A),this.#i.append(B),B}#o(A,B,Q){if(!Q)return;let C=this.#C.createElementNS(Dg,B);C.setAttribute("type","discrete"),C.setAttribute("tableValues",Q),A.append(C)}#c(A,B,Q,C){let I=this.#C.createElementNS(Dg,"feComponentTransfer");C.append(I),this.#o(I,"feFuncR",A),this.#o(I,"feFuncG",B),this.#o(I,"feFuncB",Q)}#h(A,B){let Q=this.#C.createElementNS(Dg,"feComponentTransfer");B.append(Q),this.#o(Q,"feFuncA",A)}#D(A){return this.#i.style.color="CanvasText",this.#i.style.backgroundColor=A,EE(getComputedStyle(this.#i).getPropertyValue("background-color"))}#l(A){return this.#i.style.color="CanvasText",this.#i.style.backgroundColor=A,VI(getComputedStyle(this.#i).getPropertyValue("background-color"))}#G(){this.#i.style.color="",this.#i.style.backgroundColor=""}#F(A){let[B,Q,C,I]=this.#l(A);if(I===1)return[B,Q,C];let[E,t,e]=this.#D("Canvas");return[sw(B,E,I),sw(Q,t,I),sw(C,e,I)]}};function sw(g,A,B){return Math.round(B*g+(1-B)*A)}yg&&AB("Please use the `legacy` build in Node.js environments.");async function Tk(g){let B=await process.getBuiltinModule("fs/promises").readFile(g);return new Uint8Array(B)}var Ww=class extends si{},Ow=class extends ii{_createCanvas(A,B){return process.getBuiltinModule("module").createRequire(import.meta.url)("@napi-rs/canvas").createCanvas(A,B)}},vw=class extends Ei{async _fetch(A,B){return Tk(A)}};function Ff({src:g,srcPos:A=0,dest:B,width:Q,height:C,nonBlackColor:I=4294967295,inverseDecode:E=!1}){let t=lB.isLittleEndian?4278190080:255,[e,i]=E?[I,t]:[t,I],s=Q>>3,o=Q&7,w=e^i,a=g.length;B=new Uint32Array(B.buffer);let c=0;for(let n=0;n<C;++n){for(let h=A+s;A<h;++A,c+=8){let D=g[A];B[c]=e^-(D>>7&1)&w,B[c+1]=e^-(D>>6&1)&w,B[c+2]=e^-(D>>5&1)&w,B[c+3]=e^-(D>>4&1)&w,B[c+4]=e^-(D>>3&1)&w,B[c+5]=e^-(D>>2&1)&w,B[c+6]=e^-(D>>1&1)&w,B[c+7]=e^-(D&1)&w}if(o===0)continue;let r=A<a?g[A++]:255;for(let h=0;h<o;++h,++c)B[c]=e^-(r>>7-h&1)&w}return{srcPos:A,destPos:c}}function Vk({src:g,srcPos:A=0,dest:B,destPos:Q=0,width:C,height:I}){let E=0,t=C*I*3,e=t>>2,i=new Uint32Array(g.buffer,A,e),s=lB.isLittleEndian?4278190080:255;if(lB.isLittleEndian){for(;E<e-2;E+=3,Q+=4){let o=i[E],w=i[E+1],a=i[E+2];B[Q]=o|s,B[Q+1]=o>>>24|w<<8|s,B[Q+2]=w>>>16|a<<16|s,B[Q+3]=a>>>8|s}for(let o=A+E*4,w=A+t;o<w;o+=3)B[Q++]=g[o]|g[o+1]<<8|g[o+2]<<16|s}else{for(;E<e-2;E+=3,Q+=4){let o=i[E],w=i[E+1],a=i[E+2];B[Q]=o|s,B[Q+1]=o<<24|w>>>8|s,B[Q+2]=w<<16|a>>>16|s,B[Q+3]=a<<8|s}for(let o=A+E*4,w=A+t;o<w;o+=3)B[Q++]=g[o]<<24|g[o+1]<<16|g[o+2]<<8|s}return{srcPos:A+t,destPos:Q}}var Zk=`
|
|
3
3
|
struct Uniforms {
|
|
4
4
|
offsetX : f32,
|
package/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from "./reader-
|
|
1
|
+
export * from "./reader-UEVM5C4A.js";
|