pdfcedar 0.0.0-stage → 0.1.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +47 -0
- package/README.md +223 -3
- package/bin/pdfcedar-assets.mjs +25 -0
- package/dist/THIRD_PARTY_NOTICES.md +411 -0
- package/dist/chunks/errors-Bd8CCmBG.js +185 -0
- package/dist/chunks/src-GGqFXcUj.js +3695 -0
- package/dist/chunks/src-xAKLPCPU.js +12023 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +23198 -0
- package/dist/index.umd.cjs +991 -0
- package/dist/pdfjs/LICENSE +177 -0
- package/dist/pdfjs/cmaps/78-EUC-H.bcmap +0 -0
- package/dist/pdfjs/cmaps/78-EUC-V.bcmap +0 -0
- package/dist/pdfjs/cmaps/78-H.bcmap +0 -0
- package/dist/pdfjs/cmaps/78-RKSJ-H.bcmap +0 -0
- package/dist/pdfjs/cmaps/78-RKSJ-V.bcmap +0 -0
- package/dist/pdfjs/cmaps/78-V.bcmap +0 -0
- package/dist/pdfjs/cmaps/78ms-RKSJ-H.bcmap +0 -0
- package/dist/pdfjs/cmaps/78ms-RKSJ-V.bcmap +0 -0
- package/dist/pdfjs/cmaps/83pv-RKSJ-H.bcmap +0 -0
- package/dist/pdfjs/cmaps/90ms-RKSJ-H.bcmap +0 -0
- package/dist/pdfjs/cmaps/90ms-RKSJ-V.bcmap +0 -0
- package/dist/pdfjs/cmaps/90msp-RKSJ-H.bcmap +0 -0
- package/dist/pdfjs/cmaps/90msp-RKSJ-V.bcmap +0 -0
- package/dist/pdfjs/cmaps/90pv-RKSJ-H.bcmap +0 -0
- package/dist/pdfjs/cmaps/90pv-RKSJ-V.bcmap +0 -0
- package/dist/pdfjs/cmaps/Add-H.bcmap +0 -0
- package/dist/pdfjs/cmaps/Add-RKSJ-H.bcmap +0 -0
- package/dist/pdfjs/cmaps/Add-RKSJ-V.bcmap +0 -0
- package/dist/pdfjs/cmaps/Add-V.bcmap +0 -0
- package/dist/pdfjs/cmaps/Adobe-CNS1-0.bcmap +0 -0
- package/dist/pdfjs/cmaps/Adobe-CNS1-1.bcmap +0 -0
- package/dist/pdfjs/cmaps/Adobe-CNS1-2.bcmap +0 -0
- package/dist/pdfjs/cmaps/Adobe-CNS1-3.bcmap +0 -0
- package/dist/pdfjs/cmaps/Adobe-CNS1-4.bcmap +0 -0
- package/dist/pdfjs/cmaps/Adobe-CNS1-5.bcmap +0 -0
- package/dist/pdfjs/cmaps/Adobe-CNS1-6.bcmap +0 -0
- package/dist/pdfjs/cmaps/Adobe-CNS1-UCS2.bcmap +0 -0
- package/dist/pdfjs/cmaps/Adobe-GB1-0.bcmap +0 -0
- package/dist/pdfjs/cmaps/Adobe-GB1-1.bcmap +0 -0
- package/dist/pdfjs/cmaps/Adobe-GB1-2.bcmap +0 -0
- package/dist/pdfjs/cmaps/Adobe-GB1-3.bcmap +0 -0
- package/dist/pdfjs/cmaps/Adobe-GB1-4.bcmap +0 -0
- package/dist/pdfjs/cmaps/Adobe-GB1-5.bcmap +0 -0
- package/dist/pdfjs/cmaps/Adobe-GB1-UCS2.bcmap +0 -0
- package/dist/pdfjs/cmaps/Adobe-Japan1-0.bcmap +0 -0
- package/dist/pdfjs/cmaps/Adobe-Japan1-1.bcmap +0 -0
- package/dist/pdfjs/cmaps/Adobe-Japan1-2.bcmap +0 -0
- package/dist/pdfjs/cmaps/Adobe-Japan1-3.bcmap +0 -0
- package/dist/pdfjs/cmaps/Adobe-Japan1-4.bcmap +0 -0
- package/dist/pdfjs/cmaps/Adobe-Japan1-5.bcmap +0 -0
- package/dist/pdfjs/cmaps/Adobe-Japan1-6.bcmap +0 -0
- package/dist/pdfjs/cmaps/Adobe-Japan1-UCS2.bcmap +0 -0
- package/dist/pdfjs/cmaps/Adobe-Korea1-0.bcmap +0 -0
- package/dist/pdfjs/cmaps/Adobe-Korea1-1.bcmap +0 -0
- package/dist/pdfjs/cmaps/Adobe-Korea1-2.bcmap +0 -0
- package/dist/pdfjs/cmaps/Adobe-Korea1-UCS2.bcmap +0 -0
- package/dist/pdfjs/cmaps/B5-H.bcmap +0 -0
- package/dist/pdfjs/cmaps/B5-V.bcmap +0 -0
- package/dist/pdfjs/cmaps/B5pc-H.bcmap +0 -0
- package/dist/pdfjs/cmaps/B5pc-V.bcmap +0 -0
- package/dist/pdfjs/cmaps/CNS-EUC-H.bcmap +0 -0
- package/dist/pdfjs/cmaps/CNS-EUC-V.bcmap +0 -0
- package/dist/pdfjs/cmaps/CNS1-H.bcmap +0 -0
- package/dist/pdfjs/cmaps/CNS1-V.bcmap +0 -0
- package/dist/pdfjs/cmaps/CNS2-H.bcmap +0 -0
- package/dist/pdfjs/cmaps/CNS2-V.bcmap +3 -0
- package/dist/pdfjs/cmaps/ETHK-B5-H.bcmap +0 -0
- package/dist/pdfjs/cmaps/ETHK-B5-V.bcmap +0 -0
- package/dist/pdfjs/cmaps/ETen-B5-H.bcmap +0 -0
- package/dist/pdfjs/cmaps/ETen-B5-V.bcmap +0 -0
- package/dist/pdfjs/cmaps/ETenms-B5-H.bcmap +3 -0
- package/dist/pdfjs/cmaps/ETenms-B5-V.bcmap +0 -0
- package/dist/pdfjs/cmaps/EUC-H.bcmap +0 -0
- package/dist/pdfjs/cmaps/EUC-V.bcmap +0 -0
- package/dist/pdfjs/cmaps/Ext-H.bcmap +0 -0
- package/dist/pdfjs/cmaps/Ext-RKSJ-H.bcmap +0 -0
- package/dist/pdfjs/cmaps/Ext-RKSJ-V.bcmap +0 -0
- package/dist/pdfjs/cmaps/Ext-V.bcmap +0 -0
- package/dist/pdfjs/cmaps/GB-EUC-H.bcmap +0 -0
- package/dist/pdfjs/cmaps/GB-EUC-V.bcmap +0 -0
- package/dist/pdfjs/cmaps/GB-H.bcmap +4 -0
- package/dist/pdfjs/cmaps/GB-V.bcmap +0 -0
- package/dist/pdfjs/cmaps/GBK-EUC-H.bcmap +0 -0
- package/dist/pdfjs/cmaps/GBK-EUC-V.bcmap +0 -0
- package/dist/pdfjs/cmaps/GBK2K-H.bcmap +0 -0
- package/dist/pdfjs/cmaps/GBK2K-V.bcmap +0 -0
- package/dist/pdfjs/cmaps/GBKp-EUC-H.bcmap +0 -0
- package/dist/pdfjs/cmaps/GBKp-EUC-V.bcmap +0 -0
- package/dist/pdfjs/cmaps/GBT-EUC-H.bcmap +0 -0
- package/dist/pdfjs/cmaps/GBT-EUC-V.bcmap +0 -0
- package/dist/pdfjs/cmaps/GBT-H.bcmap +0 -0
- package/dist/pdfjs/cmaps/GBT-V.bcmap +0 -0
- package/dist/pdfjs/cmaps/GBTpc-EUC-H.bcmap +0 -0
- package/dist/pdfjs/cmaps/GBTpc-EUC-V.bcmap +0 -0
- package/dist/pdfjs/cmaps/GBpc-EUC-H.bcmap +0 -0
- package/dist/pdfjs/cmaps/GBpc-EUC-V.bcmap +0 -0
- package/dist/pdfjs/cmaps/H.bcmap +0 -0
- package/dist/pdfjs/cmaps/HKdla-B5-H.bcmap +0 -0
- package/dist/pdfjs/cmaps/HKdla-B5-V.bcmap +0 -0
- package/dist/pdfjs/cmaps/HKdlb-B5-H.bcmap +0 -0
- package/dist/pdfjs/cmaps/HKdlb-B5-V.bcmap +0 -0
- package/dist/pdfjs/cmaps/HKgccs-B5-H.bcmap +0 -0
- package/dist/pdfjs/cmaps/HKgccs-B5-V.bcmap +0 -0
- package/dist/pdfjs/cmaps/HKm314-B5-H.bcmap +0 -0
- package/dist/pdfjs/cmaps/HKm314-B5-V.bcmap +0 -0
- package/dist/pdfjs/cmaps/HKm471-B5-H.bcmap +0 -0
- package/dist/pdfjs/cmaps/HKm471-B5-V.bcmap +0 -0
- package/dist/pdfjs/cmaps/HKscs-B5-H.bcmap +0 -0
- package/dist/pdfjs/cmaps/HKscs-B5-V.bcmap +0 -0
- package/dist/pdfjs/cmaps/Hankaku.bcmap +0 -0
- package/dist/pdfjs/cmaps/Hiragana.bcmap +0 -0
- package/dist/pdfjs/cmaps/KSC-EUC-H.bcmap +0 -0
- package/dist/pdfjs/cmaps/KSC-EUC-V.bcmap +0 -0
- package/dist/pdfjs/cmaps/KSC-H.bcmap +0 -0
- package/dist/pdfjs/cmaps/KSC-Johab-H.bcmap +0 -0
- package/dist/pdfjs/cmaps/KSC-Johab-V.bcmap +0 -0
- package/dist/pdfjs/cmaps/KSC-V.bcmap +0 -0
- package/dist/pdfjs/cmaps/KSCms-UHC-H.bcmap +0 -0
- package/dist/pdfjs/cmaps/KSCms-UHC-HW-H.bcmap +0 -0
- package/dist/pdfjs/cmaps/KSCms-UHC-HW-V.bcmap +0 -0
- package/dist/pdfjs/cmaps/KSCms-UHC-V.bcmap +0 -0
- package/dist/pdfjs/cmaps/KSCpc-EUC-H.bcmap +0 -0
- package/dist/pdfjs/cmaps/KSCpc-EUC-V.bcmap +0 -0
- package/dist/pdfjs/cmaps/Katakana.bcmap +0 -0
- package/dist/pdfjs/cmaps/LICENSE +36 -0
- package/dist/pdfjs/cmaps/NWP-H.bcmap +0 -0
- package/dist/pdfjs/cmaps/NWP-V.bcmap +0 -0
- package/dist/pdfjs/cmaps/RKSJ-H.bcmap +0 -0
- package/dist/pdfjs/cmaps/RKSJ-V.bcmap +0 -0
- package/dist/pdfjs/cmaps/Roman.bcmap +0 -0
- package/dist/pdfjs/cmaps/UniCNS-UCS2-H.bcmap +0 -0
- package/dist/pdfjs/cmaps/UniCNS-UCS2-V.bcmap +0 -0
- package/dist/pdfjs/cmaps/UniCNS-UTF16-H.bcmap +0 -0
- package/dist/pdfjs/cmaps/UniCNS-UTF16-V.bcmap +0 -0
- package/dist/pdfjs/cmaps/UniCNS-UTF32-H.bcmap +0 -0
- package/dist/pdfjs/cmaps/UniCNS-UTF32-V.bcmap +0 -0
- package/dist/pdfjs/cmaps/UniCNS-UTF8-H.bcmap +0 -0
- package/dist/pdfjs/cmaps/UniCNS-UTF8-V.bcmap +0 -0
- package/dist/pdfjs/cmaps/UniGB-UCS2-H.bcmap +0 -0
- package/dist/pdfjs/cmaps/UniGB-UCS2-V.bcmap +0 -0
- package/dist/pdfjs/cmaps/UniGB-UTF16-H.bcmap +0 -0
- package/dist/pdfjs/cmaps/UniGB-UTF16-V.bcmap +0 -0
- package/dist/pdfjs/cmaps/UniGB-UTF32-H.bcmap +0 -0
- package/dist/pdfjs/cmaps/UniGB-UTF32-V.bcmap +0 -0
- package/dist/pdfjs/cmaps/UniGB-UTF8-H.bcmap +0 -0
- package/dist/pdfjs/cmaps/UniGB-UTF8-V.bcmap +0 -0
- package/dist/pdfjs/cmaps/UniJIS-UCS2-H.bcmap +0 -0
- package/dist/pdfjs/cmaps/UniJIS-UCS2-HW-H.bcmap +0 -0
- package/dist/pdfjs/cmaps/UniJIS-UCS2-HW-V.bcmap +0 -0
- package/dist/pdfjs/cmaps/UniJIS-UCS2-V.bcmap +0 -0
- package/dist/pdfjs/cmaps/UniJIS-UTF16-H.bcmap +0 -0
- package/dist/pdfjs/cmaps/UniJIS-UTF16-V.bcmap +0 -0
- package/dist/pdfjs/cmaps/UniJIS-UTF32-H.bcmap +0 -0
- package/dist/pdfjs/cmaps/UniJIS-UTF32-V.bcmap +0 -0
- package/dist/pdfjs/cmaps/UniJIS-UTF8-H.bcmap +0 -0
- package/dist/pdfjs/cmaps/UniJIS-UTF8-V.bcmap +0 -0
- package/dist/pdfjs/cmaps/UniJIS2004-UTF16-H.bcmap +0 -0
- package/dist/pdfjs/cmaps/UniJIS2004-UTF16-V.bcmap +0 -0
- package/dist/pdfjs/cmaps/UniJIS2004-UTF32-H.bcmap +0 -0
- package/dist/pdfjs/cmaps/UniJIS2004-UTF32-V.bcmap +0 -0
- package/dist/pdfjs/cmaps/UniJIS2004-UTF8-H.bcmap +0 -0
- package/dist/pdfjs/cmaps/UniJIS2004-UTF8-V.bcmap +0 -0
- package/dist/pdfjs/cmaps/UniJISPro-UCS2-HW-V.bcmap +0 -0
- package/dist/pdfjs/cmaps/UniJISPro-UCS2-V.bcmap +0 -0
- package/dist/pdfjs/cmaps/UniJISPro-UTF8-V.bcmap +0 -0
- package/dist/pdfjs/cmaps/UniJISX0213-UTF32-H.bcmap +0 -0
- package/dist/pdfjs/cmaps/UniJISX0213-UTF32-V.bcmap +0 -0
- package/dist/pdfjs/cmaps/UniJISX02132004-UTF32-H.bcmap +0 -0
- package/dist/pdfjs/cmaps/UniJISX02132004-UTF32-V.bcmap +0 -0
- package/dist/pdfjs/cmaps/UniKS-UCS2-H.bcmap +0 -0
- package/dist/pdfjs/cmaps/UniKS-UCS2-V.bcmap +0 -0
- package/dist/pdfjs/cmaps/UniKS-UTF16-H.bcmap +0 -0
- package/dist/pdfjs/cmaps/UniKS-UTF16-V.bcmap +0 -0
- package/dist/pdfjs/cmaps/UniKS-UTF32-H.bcmap +0 -0
- package/dist/pdfjs/cmaps/UniKS-UTF32-V.bcmap +0 -0
- package/dist/pdfjs/cmaps/UniKS-UTF8-H.bcmap +0 -0
- package/dist/pdfjs/cmaps/UniKS-UTF8-V.bcmap +0 -0
- package/dist/pdfjs/cmaps/V.bcmap +0 -0
- package/dist/pdfjs/cmaps/WP-Symbol.bcmap +0 -0
- package/dist/pdfjs/iccs/CGATS001Compat-v2-micro.icc +0 -0
- package/dist/pdfjs/iccs/LICENSE +116 -0
- package/dist/pdfjs/pdf.worker.min.mjs +27 -0
- package/dist/pdfjs/standard_fonts/FoxitDingbats.pfb +0 -0
- package/dist/pdfjs/standard_fonts/FoxitFixed.pfb +0 -0
- package/dist/pdfjs/standard_fonts/FoxitFixedBold.pfb +0 -0
- package/dist/pdfjs/standard_fonts/FoxitFixedBoldItalic.pfb +0 -0
- package/dist/pdfjs/standard_fonts/FoxitFixedItalic.pfb +0 -0
- package/dist/pdfjs/standard_fonts/FoxitSerif.pfb +0 -0
- package/dist/pdfjs/standard_fonts/FoxitSerifBold.pfb +0 -0
- package/dist/pdfjs/standard_fonts/FoxitSerifBoldItalic.pfb +0 -0
- package/dist/pdfjs/standard_fonts/FoxitSerifItalic.pfb +0 -0
- package/dist/pdfjs/standard_fonts/FoxitSymbol.pfb +0 -0
- package/dist/pdfjs/standard_fonts/LICENSE_FOXIT +27 -0
- package/dist/pdfjs/standard_fonts/LICENSE_LIBERATION +363 -0
- package/dist/pdfjs/standard_fonts/LiberationSans-Bold.ttf +0 -0
- package/dist/pdfjs/standard_fonts/LiberationSans-BoldItalic.ttf +0 -0
- package/dist/pdfjs/standard_fonts/LiberationSans-Italic.ttf +0 -0
- package/dist/pdfjs/standard_fonts/LiberationSans-Regular.ttf +0 -0
- package/dist/pdfjs/wasm/LICENSE_JBIG2 +196 -0
- package/dist/pdfjs/wasm/LICENSE_OPENJPEG +39 -0
- package/dist/pdfjs/wasm/LICENSE_PDFJS_JBIG2 +13 -0
- package/dist/pdfjs/wasm/LICENSE_PDFJS_OPENJPEG +22 -0
- package/dist/pdfjs/wasm/LICENSE_PDFJS_QCMS +19 -0
- package/dist/pdfjs/wasm/LICENSE_QCMS +21 -0
- package/dist/pdfjs/wasm/jbig2.wasm +0 -0
- package/dist/pdfjs/wasm/jbig2_nowasm_fallback.js +15 -0
- package/dist/pdfjs/wasm/openjpeg.wasm +0 -0
- package/dist/pdfjs/wasm/openjpeg_nowasm_fallback.js +17 -0
- package/dist/pdfjs/wasm/qcms_bg.wasm +0 -0
- package/dist/types/core/annotation-geometry.d.ts +36 -0
- package/dist/types/core/annotation-manager.d.ts +97 -0
- package/dist/types/core/annotations.d.ts +106 -0
- package/dist/types/core/errors.d.ts +8 -0
- package/dist/types/core/events.d.ts +10 -0
- package/dist/types/core/forms.d.ts +109 -0
- package/dist/types/core/index.d.ts +9 -0
- package/dist/types/core/types.d.ts +94 -0
- package/dist/types/core/undo.d.ts +47 -0
- package/dist/types/core/validate.d.ts +22 -0
- package/dist/viewer.d.ts +96 -0
- package/package.json +50 -3
|
@@ -0,0 +1,991 @@
|
|
|
1
|
+
(function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports):typeof define==`function`&&define.amd?define([`exports`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.PDFCedar={}))})(this,function(e){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=Object.create,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,a=Object.getPrototypeOf,o=Object.prototype.hasOwnProperty,s=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(e){throw n=[e],e}},c=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t,t.exports),e=null),t.exports),l=(e,t)=>{let r={};for(var i in e)n(r,i,{get:e[i],enumerable:!0});return t||n(r,Symbol.toStringTag,{value:`Module`}),r},u=(e,t,a,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var c=i(t),l=0,u=c.length,d;l<u;l++)d=c[l],!o.call(e,d)&&d!==a&&n(e,d,{get:(e=>t[e]).bind(null,d),enumerable:!(s=r(t,d))||s.enumerable});return e},d=(e,r,i)=>(i=e==null?{}:t(a(e)),u(r||!e||!e.__esModule||!o.call(e,`default`)?n(i,`default`,{value:e,enumerable:!0}):i,e)),f,p=s((()=>{f=class{handlers=new Map;on(e,t){let n=this.handlers.get(e);n||(n=new Set,this.handlers.set(e,n)),n.add(t)}off(e,t){this.handlers.get(e)?.delete(t)}emit(e,t){let n=this.handlers.get(e);if(n)for(let r of[...n])try{r(t)}catch(t){console.error(`[pdfcedar] "${String(e)}" handler threw`,t)}}clear(){this.handlers.clear()}}})),m,h,g,_=s((()=>{m=[`highlight`,`underline`,`strikeout`,`note`,`reply`,`ink`,`rectangle`,`ellipse`,`line`,`arrow`,`freeText`,`signature`,`redaction`],h={highlight:`#ffd400`,underline:`#2563eb`,strikeout:`#e11d48`,note:`#ffd400`,reply:`#ffd400`,ink:`#e11d48`,rectangle:`#e11d48`,ellipse:`#e11d48`,line:`#e11d48`,arrow:`#e11d48`,freeText:`#111827`,signature:`#000000`,redaction:`#e11d48`},g=new Set([`Highlight`,`Underline`,`StrikeOut`,`Text`,`Ink`,`Square`,`Circle`,`Line`,`FreeText`,`Redact`])}));function v(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function y(e,t){throw new P(e,t)}function b(e,t,n=-1/0,r=1/0){return typeof t==`number`&&Number.isFinite(t)||y(e,`expected a finite number, got ${JSON.stringify(t)}`),(t<n||t>r)&&y(e,`expected a number from ${n} to ${r}, got ${t}`),t}function x(e,t){return typeof t!=`string`&&y(e,`expected a string, got ${JSON.stringify(t)}`),t}function S(e,t){return typeof t!=`boolean`&&y(e,`expected true or false, got ${JSON.stringify(t)}`),t}function C(e,t){let n=x(e,t).trim(),r=/^#([0-9a-f])([0-9a-f])([0-9a-f])$/i.exec(n);return r?`#${r[1]}${r[1]}${r[2]}${r[2]}${r[3]}${r[3]}`.toLowerCase():/^#[0-9a-f]{6}$/i.test(n)?n.toLowerCase():y(e,`expected a color like "#ff8800", got ${JSON.stringify(t)}`)}function w(e,t){return t===null?null:C(e,t)}function T(e,t){return v(t)||y(e,`expected { x, y }`),{x:b(`${e}.x`,t.x),y:b(`${e}.y`,t.y)}}function E(e,t){return v(t)||y(e,`expected { x, y, width, height }`),{x:b(`${e}.x`,t.x),y:b(`${e}.y`,t.y),width:b(`${e}.width`,t.width,0),height:b(`${e}.height`,t.height,0)}}function D(e,t){return Array.isArray(t)&&t.length===8||y(e,`expected 8 numbers [x1, y1, x2, y2, x3, y3, x4, y4]`),t.map((t,n)=>b(`${e}[${n}]`,t))}function O(e,t){return Array.isArray(t)&&t.length!==0||y(e,`expected a non-empty array`),t}function k(e,t){let n=x(e,t);return Number.isNaN(Date.parse(n))&&y(e,`expected an ISO 8601 date, got ${JSON.stringify(t)}`),n}function A(e,t){let n=e.map(e=>e.x),r=e.map(e=>e.y),i=Math.min(...n)-t,a=Math.min(...r)-t;return{x:i,y:a,width:Math.max(...n)+t-i,height:Math.max(...r)+t-a}}function j(e,t,n=`annotation`){v(e)||y(n,`expected an object`);let r=e.type;m.includes(r)||y(`${n}.type`,`expected one of ${m.join(`, `)}, got ${JSON.stringify(e.type)}`);let i=new Set([...ee,...te[r]]);for(let t of Object.keys(e))!i.has(t)&&e[t]!==void 0&&y(`${n}.${t}`,`unknown field for a ${r} annotation (allowed: ${[...i].join(`, `)})`);let a=e=>`${n}.${e}`,o=b(a(`page`),e.page,1,t.pageCount??1/0);Number.isInteger(o)||y(a(`page`),`expected a whole page number, got ${o}`);let s=t.now(),c=e.id===void 0?t.newId():x(a(`id`),e.id);c.trim()===``&&y(a(`id`),`must not be empty`);let l=()=>e.strokeWidth===void 0?2:b(a(`strokeWidth`),e.strokeWidth,0,100),u={id:c,page:o,color:e.color===void 0?h[r]:C(a(`color`),e.color),opacity:e.opacity===void 0?1:b(a(`opacity`),e.opacity,0,1),contents:e.contents===void 0?``:x(a(`contents`),e.contents),author:e.author===void 0?t.user?.name??``:x(a(`author`),e.author),authorId:e.authorId===void 0?t.user?.id??``:x(a(`authorId`),e.authorId),createdAt:e.createdAt===void 0?s:k(a(`createdAt`),e.createdAt),modifiedAt:e.modifiedAt===void 0?s:k(a(`modifiedAt`),e.modifiedAt),locked:e.locked!==void 0&&S(a(`locked`),e.locked)},d=()=>E(a(`rect`),e.rect);switch(r){case`highlight`:case`underline`:case`strikeout`:{let t=O(a(`quads`),e.quads).map((e,t)=>D(`${a(`quads`)}[${t}]`,e)),n=t.flatMap(e=>[0,2,4,6].map(t=>({x:e[t],y:e[t+1]})));return{...u,type:r,quads:t,rect:A(n,0)}}case`note`:return{...u,type:r,rect:d()};case`reply`:{let t=x(a(`inReplyTo`),e.inReplyTo);return{...u,type:r,inReplyTo:t,rect:e.rect===void 0?{x:0,y:0,width:0,height:0}:d()}}case`ink`:{let t=l(),n=O(a(`paths`),e.paths).map((e,t)=>O(`${a(`paths`)}[${t}]`,e).map((e,n)=>T(`${a(`paths`)}[${t}][${n}]`,e)));return{...u,type:r,paths:n,strokeWidth:t,rect:A(n.flat(),t/2)}}case`rectangle`:case`ellipse`:return{...u,type:r,rect:d(),strokeWidth:l(),fillColor:e.fillColor===void 0?null:w(a(`fillColor`),e.fillColor)};case`line`:case`arrow`:{let t=l(),n=T(a(`start`),e.start),i=T(a(`end`),e.end);return{...u,type:r,start:n,end:i,strokeWidth:t,rect:A([n,i],r===`arrow`?t*3:t/2)}}case`freeText`:return{...u,type:r,rect:d(),fontSize:e.fontSize===void 0?14:b(a(`fontSize`),e.fontSize,1,400),backgroundColor:e.backgroundColor===void 0?null:w(a(`backgroundColor`),e.backgroundColor),borderColor:e.borderColor===void 0?null:w(a(`borderColor`),e.borderColor)};case`signature`:return{...u,type:r,rect:d(),image:M(a(`image`),e.image)};case`redaction`:return{...u,type:r,rect:d(),applied:e.applied!==void 0&&S(a(`applied`),e.applied)}}}function M(e,t){let n=x(e,t);return/^data:image\/(png|jpeg);base64,[A-Za-z0-9+/]+={0,2}$/.test(n)||y(e,`expected a PNG or JPEG data URL (data:image/png;base64,…); signatures.add() converts other images`),n.length>ne&&y(e,`image is too large (over 4 MB as a data URL)`),n}function N(){let e=globalThis.crypto;if(typeof e?.randomUUID==`function`)return e.randomUUID();let t=new Uint8Array(16);e.getRandomValues(t),t[6]=t[6]&15|64,t[8]=t[8]&63|128;let n=[...t].map(e=>e.toString(16).padStart(2,`0`)).join(``);return`${n.slice(0,8)}-${n.slice(8,12)}-${n.slice(12,16)}-${n.slice(16,20)}-${n.slice(20)}`}var P,ee,te,ne,re=s((()=>{_(),P=class extends TypeError{path;constructor(e,t){super(`${e}: ${t}`),this.path=e,this.name=`AnnotationValidationError`}},ee=[`id`,`type`,`page`,`rect`,`color`,`opacity`,`contents`,`author`,`authorId`,`createdAt`,`modifiedAt`,`locked`],te={highlight:[`quads`],underline:[`quads`],strikeout:[`quads`],note:[],reply:[`inReplyTo`],ink:[`paths`,`strokeWidth`],rectangle:[`strokeWidth`,`fillColor`],ellipse:[`strokeWidth`,`fillColor`],line:[`start`,`end`,`strokeWidth`],arrow:[`start`,`end`,`strokeWidth`],freeText:[`fontSize`,`backgroundColor`,`borderColor`],signature:[`image`],redaction:[`applied`]},ne=4194304}));function ie(e){if(typeof e==`object`&&e&&!Object.isFrozen(e)){Object.freeze(e);for(let t of Object.values(e))ie(t)}return e}function ae(e,t){let n=new Set(t),r=new Map,i=[],a=e=>{i.push(e),n.add(e.id);for(let t of r.get(e.id)??[])a(t);r.delete(e.id)};for(let t of e)t.type===`reply`&&!n.has(t.inReplyTo)?r.set(t.inReplyTo,[...r.get(t.inReplyTo)??[],t]):a(t);return i}function oe(e,t){return JSON.stringify({...e,modifiedAt:``})===JSON.stringify({...t,modifiedAt:``})}var se,F,ce,le,ue,de,fe=s((()=>{re(),se={highlight:`highlight`,underline:`underline`,strikeout:`strikeout`,note:`note`,reply:`reply`,ink:`drawing`,rectangle:`rectangle`,ellipse:`ellipse`,line:`line`,arrow:`arrow`,freeText:`text box`,signature:`signature`,redaction:`redaction mark`},F=`redactions are applied with redaction.apply(), not by setting applied`,ce=`an applied redaction is final: it can't be changed, removed or replaced`,le=e=>e?.type===`redaction`&&e.applied,ue=e=>structuredClone(e),de=class{options;items=[];byId=new Map;constructor(e){this.options=e}get(e){let t=this.byId.get(e);return t&&ue(t)}list(e={}){return this.items.filter(t=>(e.page===void 0||t.page===e.page)&&(e.type===void 0||t.type===e.type)).map(ue)}replies(e){return this.items.filter(t=>t.type===`reply`&&t.inReplyTo===e).map(ue)}add(e,t=`api`){let n=this.prepare(e,`annotation`);if(le(n))throw new P(`annotation.applied`,F);if(this.byId.has(n.id))throw new P(`annotation.id`,`an annotation with id "${n.id}" already exists`);return this.insert(n,this.items.length,t),this.options.undo.record({label:`Add ${se[n.type]}`,undo:()=>this.detach(n.id,this.sourceOf(`undo`)),redo:()=>this.insert(n,this.items.length,this.sourceOf(`redo`))}),ue(n)}update(e,t,n=`api`){let r=this.require(e);if(typeof t!=`object`||!t)throw TypeError("update: `patch` must be an object.");if(le(r)&&Object.keys(t).some(e=>e!==`page`&&e!==`modifiedAt`))throw new P(`annotation`,ce);for(let e of[`id`,`type`])if(e in t&&t[e]!==r[e])throw new P(`patch.${e}`,`can't be changed (it is ${JSON.stringify(r[e])})`);let i={...r,...t,modifiedAt:t.modifiedAt??this.now()};r.type===`reply`&&`inReplyTo`in t&&this.requireParent(i,`patch`);let a=ie(j(i,this.context(),`patch`));if(le(a)&&!le(r))throw new P(`patch.applied`,F);return oe(r,a)?ue(r):this.options.undo.transaction(`Edit ${se[a.type]}`,()=>{if(this.replace(r,a,n),this.options.undo.record({label:`Edit ${se[a.type]}`,undo:()=>this.replace(a,r,this.sourceOf(`undo`)),redo:()=>this.replace(r,a,this.sourceOf(`redo`))}),r.page!==a.page||JSON.stringify(r.rect)!==JSON.stringify(a.rect))for(let t of this.items.filter(t=>t.type===`reply`&&t.inReplyTo===e))this.update(t.id,{page:a.page,rect:a.rect,modifiedAt:t.modifiedAt},n);return ue(a)})}remove(e,t=`api`,{withPage:n=!1}={}){let r=this.require(e);if(le(r)&&!n)throw new P(`annotation`,ce);this.options.undo.transaction(`Delete ${se[r.type]}`,()=>{for(let n of this.items.filter(t=>t.type===`reply`&&t.inReplyTo===e))this.remove(n.id,t);let n=this.items.indexOf(r);this.detach(e,t),this.options.undo.record({label:`Delete ${se[r.type]}`,undo:()=>this.insert(r,n,this.sourceOf(`undo`)),redo:()=>this.detach(e,this.sourceOf(`redo`))})})}markApplied(e,t=`api`){this.options.undo.untracked(()=>{for(let n of e){let e=this.require(n);e.type!==`redaction`||e.applied||this.replace(e,ie({...e,applied:!0,locked:!0,modifiedAt:this.now()}),t)}})}applyRemote(e){let t=[];return this.options.undo.untracked(()=>{for(let t of e.remove??[])if(this.byId.has(t)){for(let e of this.items.filter(e=>e.type===`reply`&&e.inReplyTo===t))this.detach(e.id,`remote`);this.detach(t,`remote`)}let n=[];for(let r of e.upsert??[])try{n.push(ie(j(r,this.context(),`remote`)))}catch{t.push(r)}for(let e of[...n].sort((e,t)=>Number(e.type===`reply`)-Number(t.type===`reply`))){if(e.type===`reply`&&!this.byId.has(e.inReplyTo)){t.push(e);continue}let n=this.byId.get(e.id);n?oe(n,e)&&n.modifiedAt===e.modifiedAt||this.replace(n,e,`remote`):this.insert(e,this.items.length,`remote`)}}),{rejected:t}}export(){return this.list()}import(e,t={},n=`api`){if(!Array.isArray(e))throw new P(`annotations`,`expected an array`);let r=e.map((e,t)=>ie(j(e,this.context(),`annotations[${t}]`))),i=new Set;for(let[e,t]of r.entries()){if(i.has(t.id))throw new P(`annotations[${e}].id`,`duplicate id "${t.id}"`);i.add(t.id)}for(let[e,t]of r.entries()){if(le(t))throw new P(`annotations[${e}].applied`,F);if(le(this.byId.get(t.id)))throw new P(`annotations[${e}].id`,ce)}if(t.replace&&this.items.some(le))throw new P(`annotations`,ce);let a=t.replace?new Set:new Set(this.byId.keys()),o=new Map([...r.map(e=>[e.id,e]),...[...a].map(e=>[e,this.byId.get(e)])]);for(let[e,t]of r.entries())if(t.type===`reply`&&!o.has(t.inReplyTo))throw new P(`annotations[${e}].inReplyTo`,`no annotation with id "${t.inReplyTo}"`);let s=ae(r,a);return this.options.undo.transaction(`Import annotations`,()=>{if(t.replace)for(let e of[...this.items].reverse())this.byId.has(e.id)&&this.remove(e.id,n);for(let e of s)this.byId.has(e.id)?this.update(e.id,e,n):this.add(e,n)}),r.map(ue)}prepare(e,t){let n=e;if(typeof e==`object`&&e&&e.type===`reply`){let t=this.byId.get(String(e.inReplyTo));t&&(n={page:t.page,...e,rect:t.rect})}let r=ie(j(n,this.context(),t));return r.type===`reply`&&this.requireParent(r,t),r}requireParent(e,t){if(e.type!==`reply`)return;let n=this.byId.get(e.inReplyTo);if(!n)throw new P(`${t}.inReplyTo`,`no annotation with id "${e.inReplyTo}"`);if(n.page!==e.page)throw new P(`${t}.page`,`a reply must be on its parent's page (${n.page})`)}require(e){let t=this.byId.get(e);if(!t)throw RangeError(`No annotation with id "${e}".`);return t}insert(e,t,n){this.items.splice(Math.min(t,this.items.length),0,e),this.byId.set(e.id,e),this.options.emit(`annotationAdded`,{annotation:ue(e),source:n})}detach(e,t){let n=this.require(e);this.items.splice(this.items.indexOf(n),1),this.byId.delete(e),this.options.emit(`annotationRemoved`,{annotation:ue(n),source:t})}replace(e,t,n){this.items[this.items.indexOf(this.require(e.id))]=t,this.byId.set(t.id,t),this.options.emit(`annotationChanged`,{annotation:ue(t),previous:ue(e),source:n})}sourceOf(e){return this.options.undo.replayKind??e}now(){if(this.options.now)return this.options.now();let e=new Date;return e.setMilliseconds(0),e.toISOString()}context(){return{now:()=>this.now(),newId:this.options.newId??N,user:this.options.user?.(),pageCount:this.options.pageCount?.()}}}}));function pe(e,t){return{x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),width:Math.abs(t.x-e.x),height:Math.abs(t.y-e.y)}}function me(e,t,n){let r={...e.rect,x:e.rect.x+t,y:e.rect.y+n};switch(e.type){case`highlight`:case`underline`:case`strikeout`:return{quads:e.quads.map(e=>e.map((e,r)=>e+(r%2==0?t:n)))};case`ink`:return{paths:e.paths.map(e=>e.map(e=>Se(e,t,n)))};case`line`:case`arrow`:return{start:Se(e.start,t,n),end:Se(e.end,t,n)};default:return{rect:r}}}function he(e){return e.type===`rectangle`||e.type===`ellipse`||e.type===`freeText`||e.type===`ink`||e.type===`signature`||e.type===`redaction`}function ge(e){return e.type===`signature`?[`nw`,`ne`,`se`,`sw`]:[`nw`,`n`,`ne`,`e`,`se`,`s`,`sw`,`w`]}function I(e,t,n){if(e.width<=0||e.height<=0)return t;let r=Math.max(t.width/e.width,t.height/e.height),i=e.width*r,a=e.height*r,o=e.x+e.width,s=e.y+e.height;return{x:n.includes(`w`)?o-i:e.x,y:n.includes(`s`)?s-a:e.y,width:i,height:a}}function _e(e){return e.type!==`reply`&&e.type!==`highlight`&&e.type!==`underline`&&e.type!==`strikeout`}function ve(e,t){if(e.type!==`ink`)return{rect:t};let n=e.strokeWidth/2,r={x:e.rect.x+n,y:e.rect.y+n,width:e.rect.width-2*n,height:e.rect.height-2*n},i={x:t.x+n,y:t.y+n,width:Math.max(0,t.width-2*n),height:Math.max(0,t.height-2*n)},a=r.width>0?i.width/r.width:1,o=r.height>0?i.height/r.height:1;return{paths:e.paths.map(e=>e.map(e=>({x:i.x+(e.x-r.x)*a,y:i.y+(e.y-r.y)*o})))}}function ye(e,t,n,r,i=4){let a=e.x,o=e.x+e.width,s=e.y,c=e.y+e.height;return t.includes(`w`)&&(a=Math.min(a+n,o-i)),t.includes(`e`)&&(o=Math.max(o+n,a+i)),t.includes(`n`)&&(c=Math.max(c+r,s+i)),t.includes(`s`)&&(s=Math.min(s+r,c-i)),{x:a,y:s,width:o-a,height:c-s}}function be(e){let t=e.y+e.height,n=e.x+e.width;return[e.x,t,n,t,e.x,e.y,n,e.y]}function xe(e){let t=e.filter(e=>e.width>.5&&e.height>.5).sort((e,t)=>t.y+t.height-(e.y+e.height)||e.x-t.x),n=[];for(let e of t){let t=n.find(t=>{let n=Math.min(t.y+t.height,e.y+e.height)-Math.max(t.y,e.y),r=Math.max(t.x,e.x)-Math.min(t.x+t.width,e.x+e.width);return n>=Math.min(t.height,e.height)/2&&r<Math.max(t.height,e.height)});if(!t){n.push({...e});continue}let r=Math.min(t.x,e.x),i=Math.min(t.y,e.y);t.width=Math.max(t.x+t.width,e.x+e.width)-r,t.height=Math.max(t.y+t.height,e.y+e.height)-i,t.x=r,t.y=i}return n}function L(e,t,n){let r=Math.max(n*3,6),i=Math.atan2(t.y-e.y,t.x-e.x),a=Math.PI/7;return[{x:t.x-r*Math.cos(i-a),y:t.y-r*Math.sin(i-a)},{x:t.x-r*Math.cos(i+a),y:t.y-r*Math.sin(i+a)}]}var Se,R=s((()=>{Se=(e,t,n)=>({x:e.x+t,y:e.y+n})})),z,Ce,we=s((()=>{z=200,Ce=class{limit;undoStack=[];redoStack=[];pending=null;depth=0;replaying=null;untrackedDepth=0;listeners=new Set;constructor(e=z){this.limit=e}get replayKind(){return this.replaying}get state(){let e=this.undoStack.at(-1),t=this.redoStack.at(-1);return{canUndo:!!e,canRedo:!!t,undoLabel:e?.label??null,redoLabel:t?.label??null}}record(e){this.replaying||this.untrackedDepth>0||(this.pending?this.pending.push(e):(this.undoStack.push(e),this.undoStack.length>this.limit&&this.undoStack.shift(),this.redoStack=[],this.notify()))}transaction(e,t){let n=this.pending,r=[];this.pending=r,this.depth++;let i;try{i=t()}catch(e){throw this.pending=n,this.depth--,this.replay(`undo`,()=>[...r].reverse().forEach(e=>e.undo())),e}return this.pending=n,this.depth--,r.length>0&&this.record({label:e,undo:()=>[...r].reverse().forEach(e=>e.undo()),redo:()=>r.forEach(e=>e.redo())}),i}untracked(e){this.untrackedDepth++;try{return e()}finally{this.untrackedDepth--}}undo(){if(this.depth>0)throw Error(`undo() cannot run inside a transaction.`);let e=this.undoStack.pop();return e?(this.replay(`undo`,()=>e.undo()),this.redoStack.push(e),this.notify(),!0):!1}redo(){if(this.depth>0)throw Error(`redo() cannot run inside a transaction.`);let e=this.redoStack.pop();return e?(this.replay(`redo`,()=>e.redo()),this.undoStack.push(e),this.notify(),!0):!1}clear(){this.undoStack.length=0,this.redoStack=[],this.notify()}onChange(e){return this.listeners.add(e),()=>this.listeners.delete(e)}replay(e,t){let n=this.replaying;this.replaying=e;try{t()}finally{this.replaying=n}}notify(){let e=this.state;for(let t of this.listeners)t(e)}}})),Te,Ee,B=s((()=>{Te=class extends Error{constructor(e,t){super(`${e} is not implemented yet (planned for Milestone ${t}).`),this.name=`NotImplementedError`}},Ee=class extends Error{constructor(){super(`Saving password-protected (encrypted) PDFs is not supported yet.`),this.name=`EncryptedDocumentError`}}}));function De(e,t){let n=t=>{throw new Oe(e.name,t)},r=()=>(e.options??[]).map(e=>e.value);switch(e.type){case`text`:{typeof t!=`string`&&n(`a text field takes a string.`);let r=t;return!e.multiline&&/[\r\n]/.test(r)&&n(`this field is single-line; remove line breaks.`),e.maxLength&&[...r].length>e.maxLength&&n(`at most ${e.maxLength} characters.`),r}case`checkbox`:return typeof t!=`boolean`&&n(`a checkbox takes true or false.`),t;case`radio`:{let r=[...new Set(e.widgets.map(e=>e.exportValue).filter(e=>!!e))];return t===``||typeof t==`string`&&r.includes(t)||n(`expected one of ${r.map(e=>JSON.stringify(e)).join(`, `)}, or '' for none.`),t}case`dropdown`:return typeof t!=`string`&&n(`a dropdown takes a string.`),t!==``&&!e.editable&&!r().includes(t)&&n(`expected one of ${r().map(e=>JSON.stringify(e)).join(`, `)}.`),t;case`listbox`:{let i=typeof t==`string`?t===``?[]:[t]:t;(!Array.isArray(i)||i.some(e=>typeof e!=`string`))&&n(`a list box takes a string or an array of strings.`);let a=i,o=a.find(e=>!r().includes(e));o!==void 0&&n(`${JSON.stringify(o)} is not an option.`),!e.multiSelect&&a.length>1&&n(`this list box allows one selection.`);let s=r().filter(e=>a.includes(e));return e.multiSelect?s:s[0]??``}}}var Oe,ke,Ae,je=s((()=>{Oe=class extends TypeError{field;constructor(e,t){super(`${e}: ${t}`),this.field=e,this.name=`FormValueError`}},ke=(e,t)=>Array.isArray(e)&&Array.isArray(t)?e.length===t.length&&e.every((e,n)=>e===t[n]):e===t,Ae=class{o;byName=new Map;current=new Map;flattenedState=!1;listeners=new Set;constructor(e){this.o=e}load(e){for(let t of e)this.byName.set(t.name,t),this.current.set(t.name,t.value);this.notify(e.map(e=>e.name))}get fields(){return[...this.byName.values()].filter(e=>this.isAvailable(e))}field(e){let t=this.byName.get(e);return t&&this.isAvailable(t)?t:void 0}isAvailable(e){return this.o.available?.(e)??!0}get flattened(){return this.flattenedState}value(e){return this.current.get(e)}values(){return this.flattenedState?{}:Object.fromEntries(this.fields.map(({name:e})=>{let t=this.current.get(e);return[e,Array.isArray(t)?[...t]:t]}))}changed(){let e={};for(let[t,n]of this.current)ke(n,this.byName.get(t).value)||(e[t]=n);return e}setValues(e,t=`api`){if(this.flattenedState)throw new Oe(`form`,`the form has been flattened; its fields no longer exist.`);if(typeof e!=`object`||!e||Array.isArray(e))throw new Oe(`values`,`expected an object of field names to values.`);let n=new Map;for(let[t,r]of Object.entries(e)){let e=this.field(t);if(!e)throw new Oe(t,`no such field in this document.`);n.set(t,De(e,r))}let r=new Map;for(let[e,t]of n)ke(t,this.current.get(e))?n.delete(e):r.set(e,this.current.get(e));n.size!==0&&(this.apply(n,t),this.o.undo.record({label:n.size===1?`Fill field`:`Fill form`,undo:()=>this.apply(r,this.o.undo.replayKind??`undo`),redo:()=>this.apply(n,this.o.undo.replayKind??`redo`)}))}applyRemote(e){let t=new Map;for(let[n,r]of Object.entries(e)){let e=this.byName.get(n);if(e)try{let i=De(e,r);ke(i,this.current.get(n))||t.set(n,i)}catch{}}t.size&&this.apply(t,`remote`)}flatten(){this.flattenedState||this.byName.size===0||(this.setFlattened(!0),this.o.undo.record({label:`Flatten form`,undo:()=>this.setFlattened(!1),redo:()=>this.setFlattened(!0)}))}onChange(e){return this.listeners.add(e),()=>this.listeners.delete(e)}setFlattened(e){this.flattenedState=e,this.notify([...this.byName.keys()])}apply(e,t){for(let[t,n]of e)this.current.set(t,n);this.notify([...e.keys()]);for(let[n,r]of e)this.o.emit({name:n,value:Array.isArray(r)?[...r]:r,source:t})}notify(e){for(let t of this.listeners)t(e)}}})),Me=s((()=>{p(),_(),fe(),R(),we(),re(),B(),je()}));Me();var Ne={463(e){var t=TypeError;e.exports=function(e){if(typeof e==`string`)return e;throw new t(`Argument is not a string`)}},804(e){var t=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789`,n=t+`+/`,r=t+`-_`,i=function(e){for(var t={},n=0;n<64;n++)t[e.charAt(n)]=n;return t};e.exports={i2c:n,c2i:i(n),i2cUrl:r,c2iUrl:i(r)}},529(e){e.exports=function(e,t){return{value:e,done:t}}},837(e){var t=TypeError,n=9007199254740991;e.exports=function(e){if(e>n)throw new t(`Maximum allowed index exceeded`);return e}},2(e){e.exports={IndexSizeError:{s:`INDEX_SIZE_ERR`,c:1,m:1},DOMStringSizeError:{s:`DOMSTRING_SIZE_ERR`,c:2,m:0},HierarchyRequestError:{s:`HIERARCHY_REQUEST_ERR`,c:3,m:1},WrongDocumentError:{s:`WRONG_DOCUMENT_ERR`,c:4,m:1},InvalidCharacterError:{s:`INVALID_CHARACTER_ERR`,c:5,m:1},NoDataAllowedError:{s:`NO_DATA_ALLOWED_ERR`,c:6,m:0},NoModificationAllowedError:{s:`NO_MODIFICATION_ALLOWED_ERR`,c:7,m:1},NotFoundError:{s:`NOT_FOUND_ERR`,c:8,m:1},NotSupportedError:{s:`NOT_SUPPORTED_ERR`,c:9,m:1},InUseAttributeError:{s:`INUSE_ATTRIBUTE_ERR`,c:10,m:1},InvalidStateError:{s:`INVALID_STATE_ERR`,c:11,m:1},SyntaxError:{s:`SYNTAX_ERR`,c:12,m:1},InvalidModificationError:{s:`INVALID_MODIFICATION_ERR`,c:13,m:1},NamespaceError:{s:`NAMESPACE_ERR`,c:14,m:1},InvalidAccessError:{s:`INVALID_ACCESS_ERR`,c:15,m:1},ValidationError:{s:`VALIDATION_ERR`,c:16,m:0},TypeMismatchError:{s:`TYPE_MISMATCH_ERR`,c:17,m:1},SecurityError:{s:`SECURITY_ERR`,c:18,m:1},NetworkError:{s:`NETWORK_ERR`,c:19,m:1},AbortError:{s:`ABORT_ERR`,c:20,m:1},URLMismatchError:{s:`URL_MISMATCH_ERR`,c:21,m:1},QuotaExceededError:{s:`QUOTA_EXCEEDED_ERR`,c:22,m:1},TimeoutError:{s:`TIMEOUT_ERR`,c:23,m:1},InvalidNodeTypeError:{s:`INVALID_NODE_TYPE_ERR`,c:24,m:1},DataCloneError:{s:`DATA_CLONE_ERR`,c:25,m:1}}},944(e){var t=TypeError;e.exports=function(e){var n=e&&e.alphabet;if(n===void 0||n===`base64`||n===`base64url`)return n||`base64`;throw new t("Incorrect `alphabet` option")}},767(e){e.exports=function(e){return{iterator:e,next:e.next,done:!1}}},117(e){e.exports=function(e){return e==null}},859(e){e.exports=function(e){e.iterator=e.next=e.nextHandler=e.mapper=e.predicate=e.inner=e.iterables=e.iters=e.openIters=e.padding=e.finishResults=e.buffer=null}},684(e){e.exports=function(e,t){var n=typeof Iterator==`function`&&Iterator.prototype[e];if(n)try{n.call({next:null},t).next()}catch{return!0}}},269(e){e.exports=Object.create?Object.create(null):{}},741(e){var t=Math.ceil,n=Math.floor;e.exports=Math.trunc||function(e){var r=+e;return(r>0?n:t)(r)}},149(e){var t=RangeError;e.exports=function(e){if(e===e)return e;throw new t(`NaN is not allowed`)}},717(e,t){t.f=Object.getOwnPropertySymbols},103(e){e.exports=function(e){try{return{error:!1,value:e()}}catch(e){return{error:!0,value:e}}}},750(e,t,n){var r=n(117),i=TypeError;e.exports=function(e){if(r(e))throw new i(`Can't call method on `+e);return e}},835(e){e.exports=function(e){try{var t=new Set,n=t[e]({size:0,has:function(){return!0},keys:function(){return Object.defineProperty({},"next",{get:function(){return t.clear(),t.add(4),function(){return{done:!0}}}})}});return n.size===1&&n.values().next().value===4}catch{return!1}}},291(e,t,n){var r=n(741);e.exports=function(e){var t=+e;return t!==t||t===0?0:r(t)}},14(e,t,n){var r=n(291),i=Math.min;e.exports=function(e){var t=r(e);return t>0?i(t,9007199254740991):0}},981(e,t,n){var r=n(750),i=Object;e.exports=function(e){return i(r(e))}},590(e,t,n){var r=n(291),i=RangeError;e.exports=function(e){var t=r(e);if(t<0)throw new i(`The argument can't be less than 0`);return t}},812(e){var t=TypeError;e.exports=function(e,n){if(e<n)throw new t(`Not enough arguments`);return e}}},Pe={};function V(e){let t=Pe[e];if(t!==void 0)return t.exports;let n=Pe[e]={exports:{}};return Ne[e](n,n.exports,V),n.exports}V.cw=e=>{var t;return()=>{if(e){var n=e;e=0,t={exports:{}},n.call(t.exports,t,t.exports)}return t.exports}},V.d=(e,t)=>{for(var n in t)V.o(t,n)&&!V.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},V.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var Fe=V.cw(function(e,t){var n=$t(),r=vr(),i=TypeError;e.exports=function(e){if(n(e))return e;throw new i(r(e)+` is not a function`)}}),Ie=V.cw(function(e,t){var n=rn(),r=String,i=TypeError;e.exports=function(e){if(n(e))return e;throw new i(`Can't set `+r(e)+` as a prototype`)}}),Le=V.cw(function(e,t){var n=Gn().has;e.exports=function(e){return n(e),e}}),Re=()=>V(463),ze=V.cw(function(e,t){var n=Dr(),r=new n.WeakMap,i=n.set,a=n.remove;e.exports=function(e){return i(r,e,1),a(r,e),e}}),Be=V.cw(function(e,t){var n=Dr().has;e.exports=function(e){return n(e),e}}),Ve=V.cw(function(e,t){var n=Or(),r=Tn(),i=Dn().f,a=n(`unscopables`),o=Array.prototype;o[a]===void 0&&i(o,a,{configurable:!0,value:r(null)}),e.exports=function(e){o[a][e]=!0}}),He=V.cw(function(e,t){var n=Mn(),r=TypeError;e.exports=function(e,t){if(n(t,e))return e;throw new r(`Incorrect invocation`)}}),Ue=V.cw(function(e,t){var n=nn(),r=String,i=TypeError;e.exports=function(e){if(e===void 0||n(e))return e;throw new i(r(e)+` is not an object or undefined`)}}),We=V.cw(function(e,t){var n=nn(),r=String,i=TypeError;e.exports=function(e){if(n(e))return e;throw new i(r(e)+` is not an object`)}}),Ge=V.cw(function(e,t){var n=it(),r=TypeError;e.exports=function(e){if(n(e)===`Uint8Array`)return e;throw new r(`Argument is not an Uint8Array`)}}),Ke=V.cw(function(e,t){e.exports=typeof ArrayBuffer<`u`&&typeof DataView<`u`}),qe=V.cw(function(e,t){var n=Vt(),r=At(),i=rt(),a=n.ArrayBuffer,o=n.TypeError;e.exports=a&&r(a.prototype,`byteLength`,`get`)||function(e){if(i(e)!==`ArrayBuffer`)throw new o(`ArrayBuffer expected`);return e.byteLength}}),Je=V.cw(function(e,t){var n=Vt(),r=Ke(),i=qe(),a=n.DataView;e.exports=function(e){if(!r||i(e)!==0)return!1;try{return new a(e),!1}catch{return!0}}}),Ye=V.cw(function(e,t){var n=Je(),r=TypeError;e.exports=function(e){if(n(e))throw new r(`ArrayBuffer is detached`);return e}}),Xe=V.cw(function(e,t){var n=Ke(),r=ht(),i=Vt(),a=$t(),o=nn(),s=Ht(),c=it(),l=vr(),u=ct(),d=ft(),f=dt(),p=Mn(),m=jn(),h=In(),g=Or(),_=yr(),v=Yt(),y=v.enforce,b=v.get,x=i.Int8Array,S=x&&x.prototype,C=i.Uint8ClampedArray,w=C&&C.prototype,T=x&&m(x),E=S&&m(S),D=Object.prototype,O=i.TypeError,k=g(`toStringTag`),A=_(`TYPED_ARRAY_TAG`),j=`TypedArrayConstructor`,M=n&&!!h&&c(i.opera)!==`Opera`,N=!1,P,ee,te,ne={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8},re={BigInt64Array:8,BigUint64Array:8},ie=function(e){if(!o(e))return!1;var t=c(e);return t===`DataView`||s(ne,t)||s(re,t)},ae=function(e){var t=m(e);if(o(t)){var n=b(t);return n&&s(n,j)?n[j]:ae(t)}},oe=function(e){if(!o(e))return!1;var t=c(e);return s(ne,t)||s(re,t)},se=function(e){if(oe(e))return e;throw new O(`Target is not a typed array`)},F=function(e){if(a(e)&&(!h||p(T,e)))return e;throw new O(l(e)+` is not a typed array constructor`)},ce=function(e,t,n,a){if(r){if(n)for(var o in ne){var c=i[o];if(c&&s(c.prototype,e))try{delete c.prototype[e]}catch{try{c.prototype[e]=t}catch{}}}(!E[e]||n)&&d(E,e,n?t:M&&S[e]||t,a)}},le=function(e,t,n){var a,o;if(r){if(h){if(n){for(a in ne)if(o=i[a],o&&s(o,e))try{delete o[e]}catch{}}if(!T[e]||n)try{return d(T,e,n?t:M&&T[e]||t)}catch{}else return}for(a in ne)o=i[a],o&&(!o[e]||n)&&d(o,e,t)}};for(P in ne)ee=i[P],te=ee&&ee.prototype,te?y(te)[j]=ee:M=!1;for(P in re)ee=i[P],te=ee&&ee.prototype,te&&(y(te)[j]=ee);if((!M||!a(T)||T===Function.prototype)&&(T=function(){throw new O(`Incorrect invocation`)},M))for(P in ne)i[P]&&h(i[P],T);if((!M||!E||E===D)&&(E=T.prototype,M))for(P in ne)i[P]&&h(i[P].prototype,E);if(M&&m(w)!==E&&h(w,E),r&&!s(E,k))for(P in N=!0,f(E,k,{configurable:!0,get:function(){return o(this)?this[A]:void 0}}),ne)i[P]&&u(i[P].prototype,A,P);e.exports={NATIVE_ARRAY_BUFFER_VIEWS:M,TYPED_ARRAY_TAG:N&&A,aTypedArray:se,aTypedArrayConstructor:F,exportTypedArrayMethod:ce,exportTypedArrayStaticMethod:le,getTypedArrayConstructor:ae,isView:ie,isTypedArray:oe,TypedArray:T,TypedArrayPrototype:E}}),Ze=V.cw(function(e,t){var n=vn();e.exports=function(e,t,r){for(var i=0,a=arguments.length>2?r:n(t),o=new e(a);a>i;)o[i]=t[i++];return o}}),Qe=V.cw(function(e,t){var n=lr(),r=sr(),i=vn(),a=function(e){return function(t,a,o){var s=n(t),c=i(s);if(c===0)return!e&&-1;var l=r(o,c),u;if(e&&a!==a){for(;c>l;)if(u=s[l++],u!==u)return!0}else for(;c>l;l++)if((e||l in s)&&s[l]===a)return e||l||0;return!e&&-1}};e.exports={includes:a(!0),indexOf:a(!1)}}),$e=V.cw(function(e,t){var n=ht(),r=Zt(),i=TypeError,a=Object.getOwnPropertyDescriptor;e.exports=n&&!function(){if(this!==void 0)return!0;try{Object.defineProperty([],"length",{writable:!1}).length=1}catch(e){return e instanceof TypeError}}()?function(e,t){if(r(e)&&!a(e,`length`).writable)throw new i(`Cannot set read only .length`);return e.length=t}:function(e,t){return e.length=t}}),et=V.cw(function(e,t){e.exports=Mt()([].slice)}),tt=()=>V(804),nt=V.cw(function(e,t){var n=We(),r=fn();e.exports=function(e,t,i,a){try{return a?t(n(i)[0],i[1]):t(i)}catch(t){r(e,`throw`,t)}}}),rt=V.cw(function(e,t){var n=Mt(),r=n({}.toString),i=n(``.slice);e.exports=function(e){return i(r(e),8,-1)}}),it=V.cw(function(e,t){var n=gr(),r=$t(),i=rt(),a=Or()(`toStringTag`),o=Object,s=i(function(){return arguments}())===`Arguments`,c=function(e,t){try{return e[t]}catch{}};e.exports=n?i:function(e){var t,n,l;return e===void 0?`Undefined`:e===null?`Null`:typeof(n=c(t=o(e),a))==`string`?n:s?i(t):(l=i(t))===`Object`&&r(t.callee)?`Arguments`:l}}),at=V.cw(function(e,t){var n=Ht(),r=Rn(),i=On(),a=Dn();e.exports=function(e,t,o){for(var s=r(t),c=a.f,l=i.f,u=0;u<s.length;u++){var d=s[u];!n(e,d)&&!(o&&n(o,d))&&c(e,d,l(t,d))}}}),ot=V.cw(function(e,t){e.exports=!wt()(function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype})}),st=()=>V(529),ct=V.cw(function(e,t){var n=ht(),r=Dn(),i=lt();e.exports=n?function(e,t,n){return r.f(e,t,i(1,n))}:function(e,t,n){return e[t]=n,e}}),lt=V.cw(function(e,t){e.exports=function(e,t){return{enumerable:!(e&1),configurable:!(e&2),writable:!(e&4),value:t}}}),ut=V.cw(function(e,t){var n=ht(),r=Dn(),i=lt();e.exports=function(e,t,a){n?r.f(e,t,i(0,a)):e[t]=a}}),dt=V.cw(function(e,t){var n=yn(),r=Dn();e.exports=function(e,t,i){return i.get&&n(i.get,t,{getter:!0}),i.set&&n(i.set,t,{setter:!0}),r.f(e,t,i)}}),ft=V.cw(function(e,t){var n=$t(),r=Dn(),i=yn(),a=mt();e.exports=function(e,t,o,s){s||={};var c=s.enumerable,l=s.name===void 0?t:s.name;if(n(o)&&i(o,l,s),s.global)c?e[t]=o:a(t,o);else{try{s.unsafe?e[t]&&(c=!0):delete e[t]}catch{}c?e[t]=o:r.f(e,t,{value:o,enumerable:!1,configurable:!s.nonConfigurable,writable:!s.nonWritable})}return e}}),pt=V.cw(function(e,t){var n=ft();e.exports=function(e,t,r){for(var i in t)n(e,i,t[i],r);return e}}),mt=V.cw(function(e,t){var n=Vt(),r=Object.defineProperty;e.exports=function(e,t){try{r(n,e,{value:t,configurable:!0,writable:!0})}catch{n[e]=t}return t}}),ht=V.cw(function(e,t){e.exports=!wt()(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!==7})}),gt=V.cw(function(e,t){var n=Vt(),r=nn(),i=n.document,a=r(i)&&r(i.createElement);e.exports=function(e){return a?i.createElement(e):{}}}),_t=()=>V(837),vt=()=>V(2),yt=V.cw(function(e,t){e.exports=[`constructor`,`hasOwnProperty`,`isPrototypeOf`,`propertyIsEnumerable`,`toLocaleString`,`toString`,`valueOf`]}),bt=V.cw(function(e,t){var n=Vt().navigator,r=n&&n.userAgent;e.exports=r?String(r):``}),xt=V.cw(function(e,t){var n=Vt(),r=bt(),i=n.process,a=n.Deno,o=i&&i.versions||a&&a.version,s=o&&o.v8,c,l;s&&(c=s.split(`.`),l=c[0]>0&&c[0]<4?1:+(c[0]+c[1])),!l&&r&&(c=r.match(/Edge\/(\d+)/),(!c||c[1]>=74)&&(c=r.match(/Chrome\/(\d+)/),c&&(l=+c[1]))),e.exports=l}),St=V.cw(function(e,t){var n=Mt(),r=Error,i=n(``.replace),a=(function(e){return String(new r(e).stack)})(`zxcasd`),o=/\n\s*at [^:]*:[^\n]*/,s=o.test(a);e.exports=function(e,t){if(s&&typeof e==`string`&&!r.prepareStackTrace)for(;t--;)e=i(e,o,``);return e}}),Ct=V.cw(function(e,t){var n=Vt(),r=On().f,i=ct(),a=ft(),o=mt(),s=at(),c=en();e.exports=function(e,t){var l=e.target,u=e.global,d=e.stat,f,p=u?n:d?n[l]||o(l,{}):n[l]&&n[l].prototype,m,h,g,_;if(p)for(m in t){if(g=t[m],e.dontCallGetSet?(_=r(p,m),h=_&&_.value):h=p[m],f=c(u?m:l+(d?`.`:`#`)+m,e.forced),!f&&h!==void 0){if(typeof g==typeof h)continue;s(g,h)}(e.sham||h&&h.sham)&&i(g,`sham`,!0),a(p,m,g,e)}}}),wt=V.cw(function(e,t){e.exports=function(e){try{return!!e()}catch{return!0}}}),Tt=V.cw(function(e,t){var n=Dt(),r=Function.prototype,i=r.apply,a=r.call;e.exports=typeof Reflect==`object`&&Reflect.apply||(n?a.bind(i):function(){return a.apply(i,arguments)})}),Et=V.cw(function(e,t){var n=jt(),r=Fe(),i=Dt(),a=n(n.bind);e.exports=function(e,t){return r(e),t===void 0?e:i?a(e,t):function(){return e.apply(t,arguments)}}}),Dt=V.cw(function(e,t){e.exports=!wt()(function(){var e=function(){}.bind();return typeof e!=`function`||e.hasOwnProperty(`prototype`)})}),Ot=V.cw(function(e,t){var n=Dt(),r=Function.prototype.call;e.exports=n?r.bind(r):function(){return r.apply(r,arguments)}}),kt=V.cw(function(e,t){var n=ht(),r=Ht(),i=Function.prototype,a=n&&Object.getOwnPropertyDescriptor,o=r(i,`name`);o&&function(){}.name,e.exports={CONFIGURABLE:o&&(!n||n&&a(i,`name`).configurable)}}),At=V.cw(function(e,t){var n=Mt(),r=Fe();e.exports=function(e,t,i){try{return n(r(Object.getOwnPropertyDescriptor(e,t)[i]))}catch{}}}),jt=V.cw(function(e,t){var n=rt(),r=Mt();e.exports=function(e){if(n(e)===`Function`)return r(e)}}),Mt=V.cw(function(e,t){var n=Dt(),r=Function.prototype,i=r.call,a=n&&r.bind.bind(i,i);e.exports=n?a:function(e){return function(){return i.apply(e,arguments)}}}),Nt=()=>V(944),Pt=V.cw(function(e,t){var n=Vt(),r=$t(),i=function(e){return r(e)?e:void 0};e.exports=function(e,t){return arguments.length<2?i(n[e]):n[e]&&n[e][t]}}),Ft=()=>V(767),It=V.cw(function(e,t){var n=Ot(),r=We(),i=Ft(),a=Rt();e.exports=function(e,t){t&&typeof e==`string`||r(e);var o=a(e);return i(r(o===void 0?e:n(o,e)))}}),Lt=V.cw(function(e,t){var n=Ot(),r=$t(),i=We(),a=vr(),o=Rt(),s=TypeError;e.exports=function(e,t){var c=arguments.length<2?o(e):t;if(r(c))return i(n(c,e));throw new s(a(e)+` is not iterable`)}}),Rt=V.cw(function(e,t){var n=rt(),r=tn(),i=zt(),a=Or()(`iterator`),o=Array.prototype;e.exports=function(e){if(!r(e))return i(e,a)||i(e,`@@iterator`)||(n(e)===`Arguments`?o[a]:void 0)}}),zt=V.cw(function(e,t){var n=Fe(),r=tn();e.exports=function(e,t){var i=e[t];return r(i)?void 0:n(i)}}),Bt=V.cw(function(e,t){var n=Fe(),r=We(),i=Ot(),a=ur(),o=Ft(),s=`Invalid size`,c=RangeError,l=TypeError,u=Math.max,d=function(e,t){this.set=e,this.size=u(t,0),this.has=n(e.has),this.keys=n(e.keys)};d.prototype={getIterator:function(){return o(r(i(this.keys,this.set)))},includes:function(e){return i(this.has,this.set,e)}},e.exports=function(e){r(e);var t=+e.size;if(t!==t)throw new l(s);var n=a(t);if(n<0)throw new c(s);return new d(e,n)}}),Vt=V.cw(function(e,t){var n=function(e){return e&&e.Math===Math&&e};e.exports=n(typeof globalThis==`object`&&globalThis)||n(typeof window==`object`&&window)||n(typeof self==`object`&&self)||n(typeof global==`object`&&global)||n(typeof this==`object`&&this)||(function(){return this})()||Function(`return this`)()}),Ht=V.cw(function(e,t){var n=Mt(),r=fr(),i=n({}.hasOwnProperty);e.exports=Object.hasOwn||function(e,t){return i(r(e),t)}}),Ut=V.cw(function(e,t){e.exports={}}),Wt=V.cw(function(e,t){e.exports=Pt()(`document`,`documentElement`)}),Gt=V.cw(function(e,t){var n=ht(),r=wt(),i=gt();e.exports=!n&&!r(function(){return Object.defineProperty(i(`div`),"a",{get:function(){return 7}}).a!==7})}),Kt=V.cw(function(e,t){var n=Mt(),r=wt(),i=rt(),a=Object,o=n(``.split);e.exports=r(function(){return!a(`z`).propertyIsEnumerable(0)})?function(e){return i(e)===`String`?o(e,``):a(e)}:a}),qt=V.cw(function(e,t){var n=$t(),r=nn(),i=In();e.exports=function(e,t,a){var o,s;return i&&n(o=t.constructor)&&o!==a&&r(s=o.prototype)&&s!==a.prototype&&i(e,s),e}}),Jt=V.cw(function(e,t){var n=Mt(),r=$t(),i=rr(),a=n(Function.toString);r(i.inspectSource)||(i.inspectSource=function(e){return a(e)}),e.exports=i.inspectSource}),Yt=V.cw(function(e,t){var n=Er(),r=Vt(),i=nn(),a=ct(),o=Ht(),s=rr(),c=nr(),l=Ut(),u=`Object already initialized`,d=r.TypeError,f=r.WeakMap,p,m,h,g=function(e){return h(e)?m(e):p(e,{})},_=function(e){return function(t){var n;if(!i(t)||(n=m(t)).type!==e)throw new d(`Incompatible receiver, `+e+` required`);return n}};if(n||s.state){var v=s.state||=new f;v.get=v.get,v.has=v.has,v.set=v.set,p=function(e,t){if(v.has(e))throw new d(u);return t.facade=e,v.set(e,t),t},m=function(e){return v.get(e)||{}},h=function(e){return v.has(e)}}else{var y=c(`state`);l[y]=!0,p=function(e,t){if(o(e,y))throw new d(u);return t.facade=e,a(e,y,t),t},m=function(e){return o(e,y)?e[y]:{}},h=function(e){return o(e,y)}}e.exports={set:p,get:m,has:h,enforce:g,getterFor:_}}),Xt=V.cw(function(e,t){var n=Or(),r=_n(),i=n(`iterator`),a=Array.prototype;e.exports=function(e){return e!==void 0&&(r.Array===e||a[i]===e)}}),Zt=V.cw(function(e,t){var n=rt();e.exports=Array.isArray||function(e){return n(e)===`Array`}}),Qt=V.cw(function(e,t){var n=it();e.exports=function(e){var t=n(e);return t===`BigInt64Array`||t===`BigUint64Array`}}),$t=V.cw(function(e,t){var n=typeof document==`object`&&document.all;e.exports=n===void 0&&n!==void 0?function(e){return typeof e==`function`||e===n}:function(e){return typeof e==`function`}}),en=V.cw(function(e,t){var n=wt(),r=$t(),i=/#|\.prototype\./,a=function(e,t){var i=s[o(e)];return i===l?!0:i===c?!1:r(t)?n(t):!!t},o=a.normalize=function(e){return String(e).replace(i,`.`).toLowerCase()},s=a.data={},c=a.NATIVE=`N`,l=a.POLYFILL=`P`;e.exports=a}),tn=()=>V(117),nn=V.cw(function(e,t){var n=$t();e.exports=function(e){return typeof e==`object`?e!==null:n(e)}}),rn=V.cw(function(e,t){var n=nn();e.exports=function(e){return n(e)||e===null}}),an=V.cw(function(e,t){e.exports=!1}),on=V.cw(function(e,t){var n=nn(),r=Yt().get;e.exports=function(e){if(!n(e))return!1;var t=r(e);return!!t&&t.type===`RawJSON`}}),sn=V.cw(function(e,t){var n=Pt(),r=$t(),i=Mn(),a=Cr(),o=Object;e.exports=a?function(e){return typeof e==`symbol`}:function(e){var t=n(`Symbol`);return r(t)&&i(t.prototype,o(e))}}),cn=V.cw(function(e,t){var n=Ot();e.exports=function(e,t,r){for(var i=r?e:e.iterator,a=e.next,o,s;!(o=n(a,i)).done;)if(s=t(o.value),s!==void 0)return s}}),ln=V.cw(function(e,t){var n=Et(),r=Ot(),i=We(),a=vr(),o=Xt(),s=vn(),c=Mn(),l=Lt(),u=Rt(),d=fn(),f=TypeError,p=function(e,t){this.stopped=e,this.result=t},m=p.prototype;e.exports=function(e,t,h){var g=h&&h.that,_=!!(h&&h.AS_ENTRIES),v=!!(h&&h.IS_RECORD),y=!!(h&&h.IS_ITERATOR),b=!!(h&&h.INTERRUPTED),x=n(t,g),S,C,w,T,E,D,O,k=function(e){var t=S;return S=void 0,t&&d(t,`normal`),new p(!0,e)},A=function(e){return _?(i(e),b?x(e[0],e[1],k):x(e[0],e[1])):b?x(e,k):x(e)};if(v)S=e.iterator;else if(y)S=e;else{if(C=u(e),!C)throw new f(a(e)+` is not iterable`);if(o(C)){for(w=0,T=s(e);T>w;w++)if(E=A(e[w]),E&&c(m,E))return E;return new p(!1)}S=l(e,C)}for(D=v?e.next:S.next;!(O=r(D,S)).done;){var j=O.value;try{E=A(j)}catch(e){if(S)d(S,`throw`,e);else throw e}if(typeof E==`object`&&E&&c(m,E))return E}return new p(!1)}}),un=()=>V(859),dn=V.cw(function(e,t){var n=fn();e.exports=function(e,t,r){for(var i=e.length-1;i>=0;i--)if(e[i]!==void 0)try{r=n(e[i].iterator,t,r)}catch(e){t=`throw`,r=e}if(t===`throw`)throw r;return r}}),fn=V.cw(function(e,t){var n=Ot(),r=We(),i=zt();e.exports=function(e,t,a){var o,s;r(e);try{if(o=i(e,`return`),!o){if(t===`throw`)throw a;return a}o=n(o,e)}catch(e){s=!0,o=e}if(t===`throw`)throw a;if(s)throw o;return r(o),a}}),pn=V.cw(function(e,t){var n=Ot(),r=Tn(),i=ct(),a=pt(),o=Or(),s=Yt(),c=zt(),l=gn().IteratorPrototype,u=st(),d=fn(),f=dn(),p=un(),m=o(`toStringTag`),h=`IteratorHelper`,g=`WrapForValidIterator`,_=`normal`,v=`throw`,y=s.set,b=function(e){var t=s.getterFor(e?g:h);return a(r(l),{next:function(){var n=t(this);if(e)return n.nextHandler();if(n.done)return u(void 0,!0);try{var r=n.nextHandler();return n.done&&p(n),n.returnHandlerResult?r:u(r,n.done)}catch(e){throw n.done=!0,p(n),e}},return:function(){var r=t(this),i=r.iterator,a=r.inner,o=r.openIters,s=r.done;if(r.done=!0,e){var l=c(i,`return`);return l?n(l,i):u(void 0,!0)}if(p(r),s)return u(void 0,!0);if(a)try{d(a.iterator,_)}catch(e){return d(i,v,e)}if(o)try{f(o,_)}catch(e){if(i)return d(i,v,e);throw e}return i&&d(i,_),u(void 0,!0)}})},x=b(!0),S=b(!1);i(S,m,`Iterator Helper`),e.exports=function(e,t,n){var r=function(r,i){i?(i.iterator=r.iterator,i.next=r.next):i=r,i.type=t?g:h,i.returnHandlerResult=!!n,i.nextHandler=e,i.counter=0,i.done=!1,y(this,i)};return r.prototype=t?x:S,r}}),mn=()=>V(684),hn=V.cw(function(e,t){var n=Vt();e.exports=function(e,t){var r=n.Iterator,i=r&&r.prototype,a=i&&i[e],o=!1;if(a)try{a.call({next:function(){return{done:!0}},return:function(){o=!0}},-1)}catch(e){e instanceof t||(o=!1)}if(!o)return a}}),gn=V.cw(function(e,t){var n=wt(),r=$t(),i=nn(),a=Tn(),o=jn(),s=ft(),c=Or(),l=an(),u=c(`iterator`),d,f,p;[].keys&&(p=[].keys(),`next`in p&&(f=o(o(p)),f!==Object.prototype&&(d=f))),!i(d)||n(function(){var e={};return d[u].call(e)!==e})?d={}:l&&(d=a(d)),r(d[u])||s(d,u,function(){return this}),e.exports={IteratorPrototype:d}}),_n=()=>V(269),vn=V.cw(function(e,t){var n=dr();e.exports=function(e){return n(e.length)}}),yn=V.cw(function(e,t){var n=Mt(),r=wt(),i=$t(),a=Ht(),o=ht(),s=kt().CONFIGURABLE,c=Jt(),l=Yt(),u=l.enforce,d=l.get,f=String,p=Object.defineProperty,m=n(``.slice),h=n(``.replace),g=n([].join),_=o&&!r(function(){return p(function(){},`length`,{value:8}).length!==8}),v=String(String).split(`String`),y=e.exports=function(e,t,n){m(f(t),0,7)===`Symbol(`&&(t=`[`+h(f(t),/^Symbol\(([^)]*)\).*$/,`$1`)+`]`),n&&n.getter&&(t=`get `+t),n&&n.setter&&(t=`set `+t),(!a(e,`name`)||s&&e.name!==t)&&(o?p(e,`name`,{value:t,configurable:!0}):e.name=t),_&&n&&a(n,`arity`)&&e.length!==n.arity&&p(e,`length`,{value:n.arity});try{n&&a(n,`constructor`)&&n.constructor?o&&p(e,`prototype`,{writable:!1}):e.prototype&&=void 0}catch{}var r=u(e);return a(r,`source`)||(r.source=g(v,typeof t==`string`?t:``)),e};Function.prototype.toString=y(function(){return i(this)&&d(this).source||c(this)},`toString`)}),bn=V.cw(function(e,t){var n=Mt(),r=Map.prototype;e.exports={Map,set:n(r.set),get:n(r.get),has:n(r.has),remove:n(r.delete),proto:r}}),xn=V.cw(function(e,t){e.exports=!wt()(function(){var e=`9007199254740993`,t=JSON.rawJSON(e);return!JSON.isRawJSON(t)||JSON.stringify(t)!==e})}),Sn=V.cw(function(e,t){var n=Fe(),r=TypeError,i=function(e){var t,i;this.promise=new e(function(e,n){if(t!==void 0||i!==void 0)throw new r(`Bad Promise constructor`);t=e,i=n}),this.resolve=n(t),this.reject=n(i)};e.exports.f=function(e){return new i(e)}}),Cn=V.cw(function(e,t){var n=_r();e.exports=function(e,t){return e===void 0?arguments.length<2?``:t:n(e)}}),wn=()=>V(149),Tn=V.cw(function(e,t){var n=We(),r=En(),i=yt(),a=Ut(),o=Wt(),s=gt(),c=nr(),l=`>`,u=`<`,d=`prototype`,f=`script`,p=c(`IE_PROTO`),m=function(){},h=function(e){return u+f+l+e+u+`/`+f+l},g=function(e){e.write(h(``)),e.close();var t=e.parentWindow.Object;return e=null,t},_=function(){var e=s(`iframe`),t=`java`+f+`:`,n;return e.style.display=`none`,o.appendChild(e),e.src=String(t),n=e.contentWindow.document,n.open(),n.write(h(`document.F=Object`)),n.close(),n.F},v,y=function(){try{v=new ActiveXObject(`htmlfile`)}catch{}y=typeof document<`u`?document.domain&&v?g(v):_():g(v);for(var e=i.length;e--;)delete y[d][i[e]];return y()};a[p]=!0,e.exports=Object.create||function(e,t){var i;return e===null?i=y():(m[d]=n(e),i=new m,m[d]=null,i[p]=e),t===void 0?i:r.f(i,t)}}),En=V.cw(function(e,t){var n=ht(),r=wr(),i=Dn(),a=We(),o=lr(),s=Pn();t.f=n&&!r?Object.defineProperties:function(e,t){a(e);for(var n=o(t),r=s(t),c=r.length,l=0,u;c>l;)i.f(e,u=r[l++],n[u]);return e}}),Dn=V.cw(function(e,t){var n=ht(),r=Gt(),i=wr(),a=We(),o=hr(),s=TypeError,c=Object.defineProperty,l=Object.getOwnPropertyDescriptor,u=`enumerable`,d=`configurable`,f=`writable`;t.f=n?i?function(e,t,n){if(a(e),t=o(t),a(n),typeof e==`function`&&t===`prototype`&&`value`in n&&f in n&&!n[f]){var r=l(e,t);r&&r[f]&&(e[t]=n.value,n={configurable:d in n?n[d]:r[d],enumerable:u in n?n[u]:r[u],writable:!1})}return c(e,t,n)}:c:function(e,t,n){if(a(e),t=o(t),a(n),r)try{return c(e,t,n)}catch{}if(`get`in n||`set`in n)throw new s(`Accessors not supported`);return`value`in n&&(e[t]=n.value),e}}),On=V.cw(function(e,t){var n=ht(),r=Ot(),i=Fn(),a=lt(),o=lr(),s=hr(),c=Ht(),l=Gt(),u=Object.getOwnPropertyDescriptor;t.f=n?u:function(e,t){if(e=o(e),t=s(t),l)try{return u(e,t)}catch{}if(c(e,t))return a(!r(i.f,e,t),e[t])}}),kn=V.cw(function(e,t){var n=Nn(),r=yt().concat(`length`,`prototype`);t.f=Object.getOwnPropertyNames||function(e){return n(e,r)}}),An=()=>V(717),jn=V.cw(function(e,t){var n=Ht(),r=$t(),i=fr(),a=nr(),o=ot(),s=a(`IE_PROTO`),c=Object,l=c.prototype;e.exports=o?c.getPrototypeOf:function(e){var t=i(e);if(n(t,s))return t[s];var a=t.constructor;return r(a)&&t instanceof a?a.prototype:t instanceof c?l:null}}),Mn=V.cw(function(e,t){e.exports=Mt()({}.isPrototypeOf)}),Nn=V.cw(function(e,t){var n=Mt(),r=Ht(),i=lr(),a=Qe().indexOf,o=Ut(),s=n([].push);e.exports=function(e,t){var n=i(e),c=0,l=[],u;for(u in n)!r(o,u)&&r(n,u)&&s(l,u);for(;t.length>c;)r(n,u=t[c++])&&(~a(l,u)||s(l,u));return l}}),Pn=V.cw(function(e,t){var n=Nn(),r=yt();e.exports=Object.keys||function(e){return n(e,r)}}),Fn=V.cw(function(e,t){var n={}.propertyIsEnumerable,r=Object.getOwnPropertyDescriptor;t.f=r&&!n.call({1:2},1)?function(e){var t=r(this,e);return!!t&&t.enumerable}:n}),In=V.cw(function(e,t){var n=At(),r=nn(),i=Hn(),a=Ie();e.exports=Object.setPrototypeOf||(`__proto__`in{}?function(){var e=!1,t={},o;try{o=n(Object.prototype,`__proto__`,`set`),o(t,[]),e=t instanceof Array}catch{}return function(t,n){return i(t),a(n),r(t)&&(e?o(t,n):t.__proto__=n),t}}():void 0)}),Ln=V.cw(function(e,t){var n=Ot(),r=$t(),i=nn(),a=TypeError;e.exports=function(e,t){var o,s;if(t===`string`&&r(o=e.toString)&&!i(s=n(o,e))||r(o=e.valueOf)&&!i(s=n(o,e))||t!==`string`&&r(o=e.toString)&&!i(s=n(o,e)))return s;throw new a(`Can't convert object to primitive value`)}}),Rn=V.cw(function(e,t){var n=Pt(),r=Mt(),i=kn(),a=An(),o=We(),s=r([].concat);e.exports=n(`Reflect`,`ownKeys`)||function(e){var t=i.f(o(e)),n=a.f;return n?s(t,n(e)):t}}),zn=V.cw(function(e,t){var n=Mt(),r=Ht(),i=SyntaxError,a=parseInt,o=String.fromCharCode,s=n(``.charAt),c=n(``.slice),l=n(/./.exec),u={'\\"':`"`,"\\\\":`\\`,"\\/":`/`,"\\b":`\b`,"\\f":`\f`,"\\n":`
|
|
2
|
+
`,"\\r":`\r`,"\\t":` `},d=/^[\da-f]{4}$/i,f=/^[\u0000-\u001F]$/;e.exports=function(e,t){for(var n=!0,p=``;t<e.length;){var m=s(e,t);if(m===`\\`){var h=c(e,t,t+2);if(r(u,h))p+=u[h],t+=2;else if(h===`\\u`){t+=2;var g=c(e,t,t+4);if(!l(d,g))throw new i(`Bad Unicode escape at: `+t);p+=o(a(g,16)),t+=4}else throw new i(`Unknown escape sequence: "`+h+`"`)}else if(m===`"`){n=!1,t++;break}else{if(l(f,m))throw new i(`Bad control character in string literal at: `+t);p+=m,t++}}if(n)throw new i(`Unterminated string at: `+t);return{value:p,end:t}}}),Bn=()=>V(103),Vn=V.cw(function(e,t){var n=We(),r=nn(),i=Sn();e.exports=function(e,t){if(n(e),r(t)&&t.constructor===e)return t;var a=i.f(e),o=a.resolve;return o(t),a.promise}}),Hn=()=>V(750),Un=V.cw(function(e,t){var n=Gn(),r=Xn(),i=n.Set,a=n.add;e.exports=function(e){var t=new i;return r(e,function(e){a(t,e)}),t}}),Wn=V.cw(function(e,t){var n=Le(),r=Gn(),i=Un(),a=$n(),o=Bt(),s=Xn(),c=cn(),l=r.has,u=r.remove;e.exports=function(e){var t=n(this),r=o(e),d=i(t);return a(d)<=r.size?s(d,function(e){r.includes(e)&&u(d,e)}):c(r.getIterator(),function(e){l(d,e)&&u(d,e)}),d}}),Gn=V.cw(function(e,t){var n=Mt(),r=Set.prototype;e.exports={Set,add:n(r.add),has:n(r.has),remove:n(r.delete),proto:r}}),Kn=V.cw(function(e,t){var n=Le(),r=Gn(),i=$n(),a=Bt(),o=Xn(),s=cn(),c=r.Set,l=r.add,u=r.has;e.exports=function(e){var t=n(this),r=a(e),d=new c;return i(t)>r.size?s(r.getIterator(),function(e){u(t,e)&&l(d,e)}):o(t,function(e){r.includes(e)&&l(d,e)}),d}}),qn=V.cw(function(e,t){var n=Le(),r=Gn().has,i=$n(),a=Bt(),o=Xn(),s=cn(),c=fn();e.exports=function(e){var t=n(this),l=a(e);if(i(t)<=l.size)return o(t,function(e){if(l.includes(e))return!1},!0)!==!1;var u=l.getIterator();return s(u,function(e){if(r(t,e))return c(u.iterator,`normal`,!1)})!==!1}}),Jn=V.cw(function(e,t){var n=Le(),r=$n(),i=Xn(),a=Bt();e.exports=function(e){var t=n(this),o=a(e);return r(t)>o.size?!1:i(t,function(e){if(!o.includes(e))return!1},!0)!==!1}}),Yn=V.cw(function(e,t){var n=Le(),r=Gn().has,i=$n(),a=Bt(),o=cn(),s=fn();e.exports=function(e){var t=n(this),c=a(e);if(i(t)<c.size)return!1;var l=c.getIterator();return o(l,function(e){if(!r(t,e))return s(l.iterator,`normal`,!1)})!==!1}}),Xn=V.cw(function(e,t){var n=Mt(),r=cn(),i=Gn(),a=i.Set,o=i.proto,s=n(o.forEach),c=n(o.keys),l=c(new a).next;e.exports=function(e,t,n){return n?r({iterator:c(e),next:l},t):s(e,t)}}),Zn=V.cw(function(e,t){var n=Pt(),r=function(e){return{size:e,has:function(){return!1},keys:function(){return{next:function(){return{done:!0}}}}}},i=function(e){return{size:e,has:function(){return!0},keys:function(){throw Error(`e`)}}};e.exports=function(e,t){var a=n(`Set`);try{new a()[e](r(0));try{return new a()[e](r(-1)),!1}catch{if(!t)return!0;try{return new a()[e](i(-1/0)),!1}catch{return t(new a([1,2])[e](i(1/0)))}}}catch{return!1}}}),Qn=()=>V(835),$n=V.cw(function(e,t){e.exports=At()(Gn().proto,`size`,`get`)||function(e){return e.size}}),er=V.cw(function(e,t){var n=Le(),r=Gn(),i=Un(),a=Bt(),o=cn(),s=r.add,c=r.has,l=r.remove;e.exports=function(e){var t=n(this),r=a(e).getIterator(),u=i(t);return o(r,function(e){c(t,e)?l(u,e):s(u,e)}),u}}),tr=V.cw(function(e,t){var n=Le(),r=Gn().add,i=Un(),a=Bt(),o=cn();e.exports=function(e){var t=n(this),s=a(e).getIterator(),c=i(t);return o(s,function(e){r(c,e)}),c}}),nr=V.cw(function(e,t){var n=ir(),r=yr(),i=n(`keys`);e.exports=function(e){return i[e]||(i[e]=r(e))}}),rr=V.cw(function(e,t){var n=an(),r=Vt(),i=mt(),a=`__core-js_shared__`,o=e.exports=r[a]||i(a,{});(o.versions||=[]).push({version:`3.50.0`,mode:n?`pure`:`global`,copyright:`© 2013–2025 Denis Pushkarev (zloirock.ru), 2025–2026 CoreJS Company (core-js.io). All rights reserved.`,license:`https://github.com/zloirock/core-js/blob/v3.50.0/LICENSE`,source:`https://github.com/zloirock/core-js`})}),ir=V.cw(function(e,t){var n=rr(),r=Object.create||Object;e.exports=function(e,t){return n[e]||(n[e]=t||r(null))}}),ar=V.cw(function(e,t){var n=xt(),r=wt(),i=Vt().String;e.exports=!!Object.getOwnPropertySymbols&&!r(function(){var e=Symbol(`symbol detection`);return!i(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&n&&n<41})}),or=V.cw(function(e,t){e.exports=Mt()(1.1.valueOf)}),sr=V.cw(function(e,t){var n=ur(),r=Math.max,i=Math.min;e.exports=function(e,t){var a=n(e);return a<0?r(a+t,0):i(a,t)}}),cr=V.cw(function(e,t){var n=mr(),r=TypeError;e.exports=function(e){var t=n(e,`number`);if(typeof t==`number`)throw new r(`Can't convert number to bigint`);return BigInt(t)}}),lr=V.cw(function(e,t){var n=Kt(),r=Hn();e.exports=function(e){return n(r(e))}}),ur=()=>V(291),dr=()=>V(14),fr=()=>V(981),pr=()=>V(590),mr=V.cw(function(e,t){var n=Ot(),r=nn(),i=sn(),a=zt(),o=Ln(),s=Or(),c=TypeError,l=s(`toPrimitive`);e.exports=function(e,t){if(!r(e)||i(e))return e;var s=a(e,l),u;if(s){if(t===void 0&&(t=`default`),u=n(s,e,t),!r(u)||i(u))return u;throw new c(`Can't convert object to primitive value`)}return t===void 0&&(t=`number`),o(e,t)}}),hr=V.cw(function(e,t){var n=mr(),r=sn();e.exports=function(e){var t=n(e,`string`);return r(t)?t:t+``}}),gr=V.cw(function(e,t){var n=Or()(`toStringTag`),r={};r[n]=`z`,e.exports=String(r)===`[object z]`}),_r=V.cw(function(e,t){var n=it(),r=String;e.exports=function(e){if(n(e)===`Symbol`)throw TypeError(`Cannot convert a Symbol value to a string`);return r(e)}}),vr=V.cw(function(e,t){var n=String;e.exports=function(e){try{return n(e)}catch{return`Object`}}}),yr=V.cw(function(e,t){var n=Mt(),r=0,i=Math.random(),a=n(1.1.toString);e.exports=function(e){return`Symbol(`+(e===void 0?``:e)+`)_`+a(++r+i,36)}}),br=V.cw(function(e,t){var n=Vt(),r=Mt(),i=Ue(),a=Re(),o=Ht(),s=tt(),c=Nt(),l=Ye(),u=s.c2i,d=s.c2iUrl,f=n.SyntaxError,p=n.TypeError,m=n.Array,h=r(``.charAt),g=Math.floor,_=function(e,t){for(var n=e.length;t<n;t++){var r=h(e,t);if(r!==` `&&r!==` `&&r!==`
|
|
3
|
+
`&&r!==`\f`&&r!==`\r`)break}return t},v=function(e,t,n){var r=e.length;r<4&&(e+=r===2?`AA`:`A`);var i=(t[h(e,0)]<<18)+(t[h(e,1)]<<12)+(t[h(e,2)]<<6)+t[h(e,3)],a=[i>>16&255,i>>8&255,i&255];if(r===2){if(n&&a[1]!==0)throw new f(`Extra bits`);return[a[0]]}if(r===3){if(n&&a[2]!==0)throw new f(`Extra bits`);return[a[0],a[1]]}return a},y=function(e,t,n){for(var r=t.length,i=0;i<r;i++)e[n+i]=t[i];return n+r};e.exports=function(e,t,n,r){a(e),i(t);var s=c(t)===`base64`?u:d,b=t?t.lastChunkHandling:void 0;if(b===void 0&&(b=`loose`),b!==`loose`&&b!==`strict`&&b!==`stop-before-partial`)throw new p("Incorrect `lastChunkHandling` option");n&&l(n.buffer);var x=e.length,S=n||m(g(x*3/4)),C=0,w=0,T=``,E=0;if(r)for(;;){if(E=_(e,E),E===x){if(T.length>0){if(b===`stop-before-partial`)break;if(b===`loose`){if(T.length===1)throw new f(`Malformed padding: exactly one additional character`);C=y(S,v(T,s,!1),C)}else throw new f(`Missing padding`)}w=x;break}var D=h(e,E);if(++E,D===`=`){if(T.length<2)throw new f(`Padding is too early`);if(E=_(e,E),T.length===2){if(E===x){if(b===`stop-before-partial`)break;throw new f(`Malformed padding: only one =`)}h(e,E)===`=`&&(++E,E=_(e,E))}if(E<x)throw new f(`Unexpected character after padding`);C=y(S,v(T,s,b===`strict`),C),w=x;break}if(!o(s,D))throw new f(`Unexpected character`);var O=r-C;if(O===1&&T.length===2||O===2&&T.length===3||(T+=D,T.length===4&&(C=y(S,v(T,s,!1),C),T=``,w=E,C===r)))break}return n||(S.length=C),{bytes:S,read:w,written:C}}}),xr=V.cw(function(e,t){var n=Vt(),r=Mt(),i=n.Uint8Array,a=n.SyntaxError,o=Math.min,s=r(``.match);e.exports=function(e,t){var n=e.length;if(n%2!=0)throw new a(`String should be an even number of characters`);for(var r=t?o(t.length,n/2):n/2,c=t||new i(r),l=s(e,/[\S\s]{2}/g),u=0;u<r;u++){var d=+(`0x`+l[u]+`0`);if(d!==d)throw new a(`String should only contain hex characters`);c[u]=d>>4}return{bytes:c,read:u<<1}}}),Sr=V.cw(function(e,t){var n=wt(),r=Or(),i=ht(),a=an(),o=r(`iterator`);e.exports=!n(function(){var e=new URL(`b?a=1&b=2&c=3`,`https://a`),t=e.searchParams,n=new URLSearchParams(`a=1&a=2&b=3`),r=``;return e.pathname=`c%20d`,t.forEach(function(e,n){t.delete(`b`),r+=n+e}),n.delete(`a`,2),n.delete(`b`,void 0),a&&(!e.toJSON||!n.has(`a`,1)||n.has(`a`,2)||!n.has(`a`,void 0)||n.has(`b`))||!t.size&&(a||!i)||!t.sort||e.href!==`https://a/c%20d?a=1&c=3`||t.get(`c`)!==`3`||String(new URLSearchParams(`?a=1`))!==`a=1`||!t[o]||new URL(`https://a@b`).username!==`a`||new URLSearchParams(new URLSearchParams(`a=b`)).get(`a`)!==`b`||new URL(`https://тест`).host!==`xn--e1aybc`||new URL(`https://a#б`).hash!==`#%D0%B1`||r!==`a1c3`||new URL(`https://x`,void 0).host!==`x`})}),Cr=V.cw(function(e,t){e.exports=ar()&&!Symbol.sham&&typeof Symbol.iterator==`symbol`}),wr=V.cw(function(e,t){var n=ht(),r=wt();e.exports=n&&r(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!==42})}),Tr=()=>V(812),Er=V.cw(function(e,t){var n=Vt(),r=$t(),i=n.WeakMap;e.exports=r(i)&&/native code/.test(String(i))}),Dr=V.cw(function(e,t){var n=Mt(),r=WeakMap.prototype;e.exports={WeakMap,set:n(r.set),get:n(r.get),has:n(r.has),remove:n(r.delete)}}),Or=V.cw(function(e,t){var n=Vt(),r=ir(),i=Ht(),a=yr(),o=ar(),s=Cr(),c=n.Symbol,l=r(`wks`),u=s?c.for||c:c&&c.withoutSetter||a;e.exports=function(e){return i(l,e)||(l[e]=o&&i(c,e)?c[e]:u(`Symbol.`+e)),l[e]}}),kr=V.cw(function(e,t){var n=Ct(),r=Qe().includes,i=wt(),a=Ve(),o=i(function(){return![,].includes()}),s=i(function(){return[,1].includes(void 0,1)});n({target:`Array`,proto:!0,forced:o||s},{includes:function(e){return r(this,e,arguments.length>1?arguments[1]:void 0)}}),a(`includes`)}),Ar=V.cw(function(e,t){var n=Ct(),r=fr(),i=vn(),a=$e(),o=_t();n({target:`Array`,proto:!0,arity:1,forced:wt()(function(){return[].push.call({length:4294967296},1)!==4294967297})||!function(){try{Object.defineProperty([],"length",{writable:!1}).push()}catch(e){return e instanceof TypeError}}()},{push:function(e){var t=r(this),n=i(t),s=arguments.length;o(n+s);for(var c=0;c<s;c++)t[n]=arguments[c],n++;return a(t,n),n}})}),jr=V.cw(function(e,t){var n=Ct(),r=Vt(),i=He(),a=We(),o=$t(),s=jn(),c=dt(),l=ut(),u=wt(),d=Ht(),f=Or(),p=gn().IteratorPrototype,m=ht(),h=an(),g=`constructor`,_=`Iterator`,v=f(`toStringTag`),y=TypeError,b=r[_],x=h||!o(b)||b.prototype!==p||!u(function(){b({})}),S=function(){if(i(this,p),s(this)===p)throw new y(`Abstract class Iterator not directly constructable`)},C=function(e,t){m?c(p,e,{configurable:!0,get:function(){return t},set:function(t){if(a(this),this===p)throw new y(`You can't redefine this property`);d(this,e)?this[e]=t:l(this,e,t)}}):p[e]=t};d(p,v)||C(v,_),(x||!d(p,g)||p[g]===Object)&&C(g,S),S.prototype=p,n({global:!0,constructor:!0,forced:x},{Iterator:S})}),Mr=V.cw(function(e,t){var n=Ct(),r=Ot(),i=We(),a=Ft(),o=wn(),s=pr(),c=fn(),l=pn(),u=mn(),d=hn(),f=an(),p=RangeError,m=1/0,h=!f&&!u(`drop`,0),g=!f&&!h&&d(`drop`,RangeError),_=f||h||g||!function(){try{Iterator.prototype.drop.call({next:function(){return{done:!0}}},9007199254740992)}catch(e){return e instanceof p}}(),v=l(function(){for(var e=this.iterator,t=this.next,n,a;this.remaining;)if(this.remaining--,n=i(r(t,e)),a=this.done=!!n.done,a)return;if(n=i(r(t,e)),a=this.done=!!n.done,!a)return n.value});n({target:`Iterator`,proto:!0,real:!0,forced:_},{drop:function(e){i(this);var t;try{if(t=s(o(+e)),t>9007199254740991&&t!==m)throw new p(`The argument should be a safe integer`)}catch(e){c(this,`throw`,e)}return g?r(g,this,t):new v(a(this),{remaining:t})}})}),Nr=V.cw(function(e,t){var n=Ct(),r=Ot(),i=ln(),a=Fe(),o=We(),s=Ft(),c=fn(),l=hn()(`every`,TypeError);n({target:`Iterator`,proto:!0,real:!0,forced:l},{every:function(e){o(this);try{a(e)}catch(e){c(this,`throw`,e)}if(l)return r(l,this,e);var t=s(this),n=0;return!i(t,function(t,r){if(!e(t,n++))return r()},{IS_RECORD:!0,INTERRUPTED:!0}).stopped}})}),Pr=V.cw(function(e,t){var n=Ct(),r=Ot(),i=Fe(),a=We(),o=Ft(),s=pn(),c=nt(),l=an(),u=fn(),d=mn(),f=hn(),p=!l&&!d(`filter`,function(){}),m=!l&&!p&&f(`filter`,TypeError),h=l||p||m,g=s(function(){for(var e=this.iterator,t=this.predicate,n=this.next,i,o,s;;){if(i=a(r(n,e)),o=this.done=!!i.done,o)return;if(s=i.value,c(e,t,[s,this.counter++],!0))return s}});n({target:`Iterator`,proto:!0,real:!0,forced:h},{filter:function(e){a(this);try{i(e)}catch(e){u(this,`throw`,e)}return m?r(m,this,e):new g(o(this),{predicate:e})}})}),Fr=V.cw(function(e,t){var n=Ct(),r=Ot(),i=ln(),a=Fe(),o=We(),s=Ft(),c=fn(),l=hn()(`find`,TypeError);n({target:`Iterator`,proto:!0,real:!0,forced:l},{find:function(e){o(this);try{a(e)}catch(e){c(this,`throw`,e)}if(l)return r(l,this,e);var t=s(this),n=0;return i(t,function(t,r){if(e(t,n++))return r(t)},{IS_RECORD:!0,INTERRUPTED:!0}).result}})}),Ir=V.cw(function(e,t){var n=Ct(),r=Ot(),i=Fe(),a=We(),o=Ft(),s=It(),c=pn(),l=fn(),u=wt(),d=an(),f=mn(),p=hn(),m=!d&&u(function(){return[1].values().flatMap(function(){return[1]}).find(function(){return!0})!==1}),h=!d&&!m&&!f(`flatMap`,function(){}),g=!d&&!m&&!h&&p(`flatMap`,TypeError),_=d||m||h||g,v=c(function(){for(var e=this.iterator,t=this.mapper,n,i;;){if(i=this.inner)try{if(n=a(r(i.next,i.iterator)),!n.done)return n.value;this.inner=null}catch(t){l(e,`throw`,t)}if(n=a(r(this.next,e)),this.done=!!n.done)return;try{this.inner=s(t(n.value,this.counter++),!1)}catch(t){l(e,`throw`,t)}}});n({target:`Iterator`,proto:!0,real:!0,forced:_},{flatMap:function(e){a(this);try{i(e)}catch(e){l(this,`throw`,e)}return g?r(g,this,e):new v(o(this),{mapper:e,inner:null})}})}),Lr=V.cw(function(e,t){var n=Ct(),r=Ot(),i=ln(),a=Fe(),o=We(),s=Ft(),c=fn(),l=hn()(`forEach`,TypeError);n({target:`Iterator`,proto:!0,real:!0,forced:l},{forEach:function(e){o(this);try{a(e)}catch(e){c(this,`throw`,e)}if(l)return r(l,this,e);var t=s(this),n=0;i(t,function(t){e(t,n++)},{IS_RECORD:!0})}})}),Rr=V.cw(function(e,t){var n=Ct(),r=Ot(),i=Fe(),a=We(),o=Ft(),s=pn(),c=nt(),l=fn(),u=mn(),d=hn(),f=an(),p=!f&&!u(`map`,function(){}),m=!f&&!p&&d(`map`,TypeError),h=f||p||m,g=s(function(){var e=this.iterator,t=a(r(this.next,e));if(!(this.done=!!t.done))return c(e,this.mapper,[t.value,this.counter++],!0)});n({target:`Iterator`,proto:!0,real:!0,forced:h},{map:function(e){a(this);try{i(e)}catch(e){l(this,`throw`,e)}return m?r(m,this,e):new g(o(this),{mapper:e})}})}),zr=V.cw(function(e,t){var n=Ct(),r=Ot(),i=ln(),a=Fe(),o=We(),s=Ft(),c=fn(),l=hn()(`some`,TypeError);n({target:`Iterator`,proto:!0,real:!0,forced:l},{some:function(e){o(this);try{a(e)}catch(e){c(this,`throw`,e)}if(l)return r(l,this,e);var t=s(this),n=0;return i(t,function(t,r){if(e(t,n++))return r()},{IS_RECORD:!0,INTERRUPTED:!0}).stopped}})}),Br=V.cw(function(e,t){var n=Ct(),r=Ot(),i=We(),a=Ft(),o=wn(),s=pr(),c=pn(),l=fn(),u=mn(),d=hn(),f=an(),p=RangeError,m=1/0,h=!f&&!u(`take`,1),g=!f&&!h&&d(`take`,RangeError),_=f||h||g||!function(){try{Iterator.prototype.take.call({next:function(){return{done:!0}}},9007199254740992)}catch(e){return e instanceof p}}(),v=c(function(){var e=this.iterator;if(!this.remaining--)return this.done=!0,l(e,`normal`,void 0);var t=i(r(this.next,e));if(!(this.done=!!t.done))return t.value});n({target:`Iterator`,proto:!0,real:!0,forced:_},{take:function(e){i(this);var t;try{if(t=s(o(+e)),t>9007199254740991&&t!==m)throw new p(`The argument should be a safe integer`)}catch(e){l(this,`throw`,e)}return g?r(g,this,t):new v(a(this),{remaining:t})}})}),Vr=V.cw(function(e,t){var n=Ct(),r=We(),i=ut(),a=ln(),o=Ft();n({target:`Iterator`,proto:!0,real:!0},{toArray:function(){var e=[],t=0;return a(o(r(this)),function(n){i(e,t++,n)},{IS_RECORD:!0}),e}})}),Hr=V.cw(function(e,t){var n=Ct(),r=ht(),i=Vt(),a=Pt(),o=Mt(),s=Ot(),c=$t(),l=nn(),u=Zt(),d=Ht(),f=_r(),p=vn(),m=ut(),h=wt(),g=zn(),_=ar(),v=i.JSON,y=i.Number,b=i.SyntaxError,x=v&&v.parse,S=a(`Object`,`keys`),C=Object.getOwnPropertyDescriptor,w=o(``.charAt),T=o(``.slice),E=o(/./.exec),D=o([].push),O=/^\d$/,k=/^[1-9]$/,A=/^[\d-]$/,j=/^[\t\n\r ]$/,M=0,N=1,P=function(e,t){e=f(e);var n=new re(e,0),r=n.parse(),i=r.value,a=n.skip(j,r.end);if(a<e.length)throw new b(`Unexpected extra character: "`+w(e,a)+`" after the parsed data at: `+a);return c(t)?ee({"":i},``,t,r):i},ee=function(e,t,n,r){var i=e[t],a=r&&i===r.value,o=a&&typeof r.source==`string`?{source:r.source}:{},c,f,m,h,g;if(l(i)){var _=u(i),v=a?r.nodes:_?[]:{};if(_)for(c=v.length,m=p(i),h=0;h<m;h++)te(i,h,ee(i,``+h,n,h<c?v[h]:void 0));else for(f=S(i),m=p(f),h=0;h<m;h++)g=f[h],te(i,g,ee(i,g,n,d(v,g)?v[g]:void 0))}return s(n,e,t,i,o)},te=function(e,t,n){if(r){var i=C(e,t);if(i&&!i.configurable)return}n===void 0?delete e[t]:m(e,t,n)},ne=function(e,t,n,r){this.value=e,this.end=t,this.source=n,this.nodes=r},re=function(e,t){this.source=e,this.index=t};re.prototype={fork:function(e){return new re(this.source,e)},parse:function(){var e=this.source,t=this.skip(j,this.index),n=this.fork(t),r=w(e,t);if(E(A,r))return n.number();switch(r){case`{`:return n.object();case`[`:return n.array();case`"`:return n.string();case`t`:return n.keyword(!0);case`f`:return n.keyword(!1);case`n`:return n.keyword(null)}throw new b(`Unexpected character: "`+r+`" at: `+t)},node:function(e,t,n,r,i){return new ne(t,r,e?null:T(this.source,n,r),i)},object:function(){for(var e=this.source,t=this.index+1,n=!1,r={},i={},a=!1;t<e.length;){if(t=this.until([`"`,`}`],t),w(e,t)===`}`&&!n){t++,a=!0;break}var o=this.fork(t).string(),s=o.value;t=o.end,t=this.until([`:`],t)+1,t=this.skip(j,t),o=this.fork(t).parse(),m(i,s,o),m(r,s,o.value),t=this.until([`,`,`}`],o.end);var c=w(e,t);if(c===`,`)n=!0,t++;else if(c===`}`){t++,a=!0;break}}if(!a)throw new b(`Unterminated object at: `+t);return this.node(N,r,this.index,t,i)},array:function(){for(var e=this.source,t=this.index+1,n=!1,r=[],i=[],a=!1;t<e.length;){if(t=this.skip(j,t),w(e,t)===`]`&&!n){t++,a=!0;break}var o=this.fork(t).parse();if(D(i,o),D(r,o.value),t=this.until([`,`,`]`],o.end),w(e,t)===`,`)n=!0,t++;else if(w(e,t)===`]`){t++,a=!0;break}}if(!a)throw new b(`Unterminated array at: `+t);return this.node(N,r,this.index,t,i)},string:function(){var e=this.index,t=g(this.source,this.index+1);return this.node(M,t.value,e,t.end)},number:function(){var e=this.source,t=this.index,n=t;if(w(e,n)===`-`&&n++,w(e,n)===`0`)n++;else if(E(k,w(e,n)))n=this.skip(O,n+1);else throw new b(`Failed to parse number at: `+n);if(w(e,n)===`.`){var r=n+1;if(n=this.skip(O,r),r===n)throw new b(`Failed to parse number's fraction at: `+n)}if(w(e,n)===`e`||w(e,n)===`E`){n++,(w(e,n)===`+`||w(e,n)===`-`)&&n++;var i=n;if(n=this.skip(O,n),i===n)throw new b(`Failed to parse number's exponent value at: `+n)}return this.node(M,y(T(e,t,n)),t,n)},keyword:function(e){var t=``+e,n=this.index,r=n+t.length;if(T(this.source,n,r)!==t)throw new b(`Failed to parse value at: `+n);return this.node(M,e,n,r)},skip:function(e,t){for(var n=this.source;t<n.length&&E(e,w(n,t));t++);return t},until:function(e,t){t=this.skip(j,t);for(var n=w(this.source,t),r=0;r<e.length;r++)if(e[r]===n)return t;throw new b(`Unexpected character: "`+n+`" at: `+t)}};var ie=h(function(){var e=`9007199254740993`,t;return x(e,function(e,n,r){t=r.source}),t!==e}),ae=_&&!h(function(){return 1/x(`-0 `)!=-1/0});n({target:`JSON`,stat:!0,forced:ie},{parse:function(e,t){return ae&&!c(t)?x(e):P(e,t)}})}),Ur=V.cw(function(e,t){var n=Ct(),r=Pt(),i=Ot(),a=Mt(),o=wt(),s=Zt(),c=$t(),l=nn(),u=Tn(),d=on(),f=sn(),p=rt(),m=or(),h=Qe().includes,g=Ht(),_=_r(),v=zn(),y=yr(),b=ar(),x=xn(),S=String,C=TypeError,w=r(`JSON`,`stringify`),T=r(`BigInt`),E=a(``.valueOf),D=a((!0).valueOf),O=T&&a(T.prototype.valueOf),k=a(/./.exec),A=a(``.charAt),j=a(``.charCodeAt),M=a(``.replace),N=a(``.slice),P=a([].push),ee=a([].pop),te=a(1.1.toString),ne=/[\uD800-\uDFFF]/g,re=/^[\uD800-\uDBFF]$/,ie=/^[\uDC00-\uDFFF]$/,ae=/^\d+$/,oe=y(),se=y(),F=y(),ce=oe.length,le=se.length,ue=!b||o(function(){var e=r(`Symbol`)(`stringify detection`);return w([e])!==`[null]`||w({a:e})!==`{}`||w(Object(e))!==`{}`}),de=o(function(){return w(`\udf06\ud834`)!==`"\\udf06\\ud834"`||w(`\udead`)!==`"\\udead"`}),fe=x?r(`JSON`,`isRawJSON`):d,pe=ue?function(e,t,n){return w(e,function(e,n){var r=i(t,this,e,n);if(!f(r))return r},n)}:w,me=function(e,t,n){var r=A(n,t-1),i=A(n,t+1);return k(re,e)&&!k(ie,i)||k(ie,e)&&!k(re,r)?`\\u`+te(j(e,0),16):e},he=function(e){if(s(e)){for(var t=e.length,n=[],r=u(null),i=0;i<t;i++){var a=e[i],o;if(typeof a==`string`)o=a;else if(typeof a==`number`||p(a)===`Number`||p(a)===`String`)o=_(a);else continue;g(r,o)||(r[o]=!0,P(n,o))}return n}},ge=function(e,t){try{return e(t),!0}catch{return!1}},I=function(e){var t=p(e);return t===`Number`&&ge(m,e)||t===`String`&&ge(E,e)||t===`Boolean`&&ge(D,e)||!!O&&t===`BigInt`&&ge(O,e)},_e=function(e){if(!l(e)||c(e)||s(e))return!1;try{return!I(e)}catch{return!0}},ve=function(e,t){return{toJSON:function(){var n=e[t];if(l(n)||typeof n==`bigint`){var r=n.toJSON;c(r)&&(n=i(r,n,t))}return n}}},ye=function(e){for(var t=0,n=e.length;t<n;t++)if(k(ae,e[t]))return se;return``},be=function(e,t,n){for(var r=u(null),i=0,a=t.length;i<a;i++){var o=t[i];r[n+o]=ve(e,o)}return r[F]=null,r};w&&n({target:`JSON`,stat:!0,arity:3,forced:ue||de||!x},{stringify:function(e,t,n){var r=c(t)?t:void 0,a=r?void 0:he(t),o=a&&ye(a),l=[],u=[],d=[],f,p=!1,m=!0,g=pe(e,function(e,t){if(e=S(e),a){if(e===F){ee(u),f=ee(d);return}if(m)m=!1;else if(this!==f&&!s(this)&&!h(a,e))return}else r&&(t=i(r,this,e,t));if(fe(t))return x?t:(p=!0,oe+(P(l,t.rawJSON)-1));if(a&&_e(t)){if(h(u,t))throw new C(`Converting circular structure to JSON`);var n=be(t,a,o);return P(u,t),P(d,f),f=n,o&&(p=!0),n}return t},n);if(typeof g!=`string`||(de&&(g=M(g,ne,me)),!p))return g;for(var _=``,y=g.length,b=0;b<y;b++){var w=A(g,b);if(w===`"`){var T=v(g,++b).end-1,E=N(g,b,T);N(E,0,ce)===oe?_+=l[N(E,ce)]:N(E,0,le)===se?_+=`"`+N(E,le)+`"`:_+=`"`+E+`"`,b=T}else _+=w}return _}})}),Wr=V.cw(function(e,t){var n=Ct(),r=Fe(),i=bn(),a=an(),o=i.get,s=i.has,c=i.set;n({target:`Map`,proto:!0,real:!0,forced:a},{getOrInsertComputed:function(e,t){var n=s(this,e);if(r(t),n)return o(this,e);e===0&&1/e==-1/0&&(e=0);var i=t(e);return c(this,e,i),i}})}),Gr=V.cw(function(e,t){var n=Ct(),r=bn(),i=an(),a=r.get,o=r.has,s=r.set;n({target:`Map`,proto:!0,real:!0,forced:i},{getOrInsert:function(e,t){return o(this,e)?a(this,e):(s(this,e,t),t)}})}),Kr=V.cw(function(e,t){var n=Ct(),r=Mt(),i=ln(),a=RangeError,o=TypeError,s=1/0,c=NaN,l=Math.abs,u=Math.pow,d=r([].push),f=u(2,1023),p=u(2,53)-1,m=Number.MAX_VALUE,h=u(2,971),g={},_={},v={},y={},b={},x=function(e,t){var n=e+t;return{hi:n,lo:t-(n-e)}};n({target:`Math`,stat:!0},{sumPrecise:function(e){var t=[],n=0,r=y;switch(i(e,function(e){if(++n>p)throw new a(`Maximum allowed index exceeded`);if(typeof e!=`number`)throw new o(`Value is not a number`);r!==g&&(e===e?e===s?r=r===_?g:v:e===-s?r=r===v?g:_:e===0&&1/e!==s||r!==y&&r!==b||(r=b,d(t,e)):r=g)}),r){case g:return c;case _:return-s;case v:return s;case y:return-0}for(var u=[],S=0,C,w,T,E,D,O,k=0;k<t.length;k++){C=t[k];for(var A=0,j=0;j<u.length;j++){if(w=u[j],l(C)<l(w)&&(O=C,C=w,w=O),T=x(C,w),E=T.hi,D=T.lo,l(E)===s){var M=E===s?1:-1;S+=M,C=C-M*f-M*f,l(C)<l(w)&&(O=C,C=w,w=O),T=x(C,w),E=T.hi,D=T.lo}D!==0&&(u[A++]=D),C=E}u.length=A,C!==0&&d(u,C)}var N=u.length-1;if(E=0,D=0,S!==0){var P=N>=0?u[N]:0;if(N--,l(S)>1||S>0&&P>0||S<0&&P<0)return S>0?s:-s;if(T=x(S*f,P/2),E=T.hi,D=T.lo,D*=2,l(2*E)===s)return E>0?E===f&&D===-(h/2)&&N>=0&&u[N]<0?m:s:E===-f&&D===h/2&&N>=0&&u[N]>0?-m:-s;D!==0&&(u[++N]=D,D=0),E*=2}for(;N>=0&&(T=x(E,u[N--]),E=T.hi,D=T.lo,D===0););return N>=0&&(D<0&&u[N]<0||D>0&&u[N]>0)&&(w=D*2,C=E+w,w===C-E&&(E=C)),E}})}),qr=V.cw(function(e,t){var n=Ct(),r=Vt(),i=Tt(),a=et(),o=Vn(),s=Sn(),c=Fe(),l=Bn(),u=wt(),d=r.Promise,f=!1;n({target:`Promise`,stat:!0,forced:!d||!d.try||u(function(){var e=d.resolve();return d.try(function(t){return f=t===8,e},8)!==e})||!f},{try:function(e){var t=arguments.length>1?a(arguments,1):[],n=l(function(){return i(c(e),void 0,t)});if(!n.error)return o(this,n.value);var r=s.f(this),u=r.reject;return u(n.value),r.promise}})}),Jr=V.cw(function(e,t){var n=Ct(),r=Wn(),i=wt();n({target:`Set`,proto:!0,real:!0,forced:!Zn()(`difference`,function(e){return e.size===0})||i(function(){var e={size:1,has:function(){return!0},keys:function(){var e=0;return{next:function(){var n=e++>1;return t.has(1)&&t.clear(),{done:n,value:2}}}}},t=new Set([1,2,3,4]);return t.difference(e).size!==3})},{difference:r})}),Yr=V.cw(function(e,t){var n=Ct(),r=wt(),i=Kn();n({target:`Set`,proto:!0,real:!0,forced:!Zn()(`intersection`,function(e){return e.size===2&&e.has(1)&&e.has(2)})||r(function(){return String(Array.from(new Set([1,2,3]).intersection(new Set([3,2]))))!==`3,2`})},{intersection:i})}),Xr=V.cw(function(e,t){var n=Ct(),r=qn();n({target:`Set`,proto:!0,real:!0,forced:!Zn()(`isDisjointFrom`,function(e){return!e})},{isDisjointFrom:r})}),Zr=V.cw(function(e,t){var n=Ct(),r=Jn();n({target:`Set`,proto:!0,real:!0,forced:!Zn()(`isSubsetOf`,function(e){return e})},{isSubsetOf:r})}),Qr=V.cw(function(e,t){var n=Ct(),r=Yn();n({target:`Set`,proto:!0,real:!0,forced:!Zn()(`isSupersetOf`,function(e){return!e})},{isSupersetOf:r})}),$r=V.cw(function(e,t){var n=Ct(),r=er(),i=Qn();n({target:`Set`,proto:!0,real:!0,forced:!Zn()(`symmetricDifference`)||!i(`symmetricDifference`)},{symmetricDifference:r})}),ei=V.cw(function(e,t){var n=Ct(),r=tr(),i=Qn();n({target:`Set`,proto:!0,real:!0,forced:!Zn()(`union`)||!i(`union`)},{union:r})}),ti=V.cw(function(e,t){var n=Xe(),r=Qt(),i=vn(),a=ur(),o=cr(),s=n.aTypedArray,c=n.getTypedArrayConstructor,l=n.exportTypedArrayMethod,u=RangeError,d=function(){try{new Int8Array(1).with(2,{valueOf:function(){throw 8}})}catch(e){return e===8}}(),f=d&&function(){try{new Int8Array(1).with(-.5,1)}catch{return!0}}();l(`with`,{with:function(e,t){var n=s(this),l=i(n),d=a(e),f=d<0?l+d:d,p=r(n)?o(t):+t;if(f>=l||f<0)throw new u(`Incorrect index`);for(var m=new(c(n))(l),h=0;h<l;h++)m[h]=h===f?p:n[h];return m}}.with,!d||f)}),ni=V.cw(function(e,t){var n=Ct(),r=Vt(),i=Ze(),a=br(),o=r.Uint8Array,s=!o||!o.fromBase64||!function(){try{o.fromBase64(`a`);return}catch{}try{o.fromBase64(``,null)}catch{return!0}}();o&&n({target:`Uint8Array`,stat:!0,forced:s},{fromBase64:function(e){return i(o,a(e,arguments.length>1?arguments[1]:void 0,null,9007199254740991).bytes)}})}),ri=V.cw(function(e,t){var n=Ct(),r=Vt(),i=br(),a=Ge(),o=r.Uint8Array,s=!o||!o.prototype.setFromBase64||!function(){var e=new o([255,255,255,255,255]);try{e.setFromBase64(``,null);return}catch{}try{e.setFromBase64(`a`);return}catch{}try{e.setFromBase64(`MjYyZg===`)}catch{return e[0]===50&&e[1]===54&&e[2]===50&&e[3]===255&&e[4]===255}}();o&&n({target:`Uint8Array`,proto:!0,forced:s},{setFromBase64:function(e){a(this);var t=i(e,arguments.length>1?arguments[1]:void 0,this,this.length);return{read:t.read,written:t.written}}})}),ii=V.cw(function(e,t){var n=Ct(),r=Vt(),i=Re(),a=Ge(),o=Ye(),s=xr();function c(){try{new Uint8Array(new ArrayBuffer(16,{maxByteLength:1024})).setFromHex(`cafed00d`)}catch{return!0}}r.Uint8Array&&n({target:`Uint8Array`,proto:!0,forced:c()},{setFromHex:function(e){a(this),i(e),o(this.buffer);var t=s(e,this).read;return{read:t,written:t/2}}})}),ai=V.cw(function(e,t){var n=Ct(),r=Vt(),i=Mt(),a=Ue(),o=Ge(),s=Ye(),c=tt(),l=Nt(),u=c.i2c,d=c.i2cUrl,f=Math.floor,p=Math.ceil,m=i(``.charAt),h=r.Uint8Array,g=r.Array,_=i([].join),v=!h||!h.prototype.toBase64||!function(){try{new h().toBase64(null)}catch{return!0}}();h&&n({target:`Uint8Array`,proto:!0,forced:v},{toBase64:function(){var e=o(this),t=arguments.length?a(arguments[0]):void 0,n=l(t)===`base64`?u:d,r=!!t&&!!t.omitPadding;s(this.buffer);for(var i=0,c=e.length,h=g(r?f(c/3)*4+(c%3?c%3+1:0):p(c/3)*4),v=0,y,b=function(e){return m(n,y>>6*e&63)};i+2<c;i+=3)y=(e[i]<<16)+(e[i+1]<<8)+e[i+2],h[v++]=b(3),h[v++]=b(2),h[v++]=b(1),h[v++]=b(0);return i+2===c?(y=(e[i]<<16)+(e[i+1]<<8),h[v++]=b(3),h[v++]=b(2),h[v++]=b(1),r||(h[v++]=`=`)):i+1===c&&(y=e[i]<<16,h[v++]=b(3),h[v++]=b(2),r||(h[v++]=`=`,h[v++]=`=`)),_(h,``)}})}),oi=V.cw(function(e,t){var n=Ct(),r=Vt(),i=Mt(),a=Ge(),o=Ye(),s=i(1.1.toString),c=i([].join),l=Array,u=r.Uint8Array,d=!u||!u.prototype.toHex||!(function(){try{return new u([255,255,255,255,255,255,255,255]).toHex()===`ffffffffffffffff`}catch{return!1}})();u&&n({target:`Uint8Array`,proto:!0,forced:d},{toHex:function(){a(this),o(this.buffer);for(var e=l(this.length),t=0,n=this.length;t<n;t++){var r=s(this[t],16);e[t]=r.length===1?`0`+r:r}return c(e,``)}})}),si=V.cw(function(e,t){var n=Ct(),r=Fe(),i=Be(),a=ze(),o=Dr(),s=an(),c=o.get,l=o.has,u=o.set;n({target:`WeakMap`,proto:!0,real:!0,forced:s||!function(){try{WeakMap.prototype.getOrInsertComputed&&new WeakMap().getOrInsertComputed(1,function(){throw 1})}catch(e){return e instanceof TypeError}}()},{getOrInsertComputed:function(e,t){if(s||i(this),a(e),r(t),l(this,e))return c(this,e);var n=t(e);return u(this,e,n),n}})}),ci=V.cw(function(e,t){var n=Ct(),r=Dr(),i=an(),a=r.get,o=r.has,s=r.set;n({target:`WeakMap`,proto:!0,real:!0,forced:i},{getOrInsert:function(e,t){return o(this,e)?a(this,e):(s(this,e,t),t)}})}),li=V.cw(function(e,t){var n=Ct(),r=Vt(),i=Pt(),a=lt(),o=Dn().f,s=Ht(),c=He(),l=qt(),u=Cn(),d=vt(),f=St(),p=ht(),m=an(),h=`DOMException`,g=i(`Error`),_=i(h),v=function(){c(this,y);var e=arguments.length,t=u(e<1?void 0:arguments[0]),n=new _(t,u(e<2?void 0:arguments[1],`Error`)),r=new g(t);return r.name=h,o(n,`stack`,a(1,f(r.stack,1))),l(n,this,v),n},y=v.prototype=_.prototype,b=`stack`in new g(h),x=`stack`in new _(1,2),S=_&&p&&Object.getOwnPropertyDescriptor(r,h),C=!!S&&!(S.writable&&S.configurable),w=b&&!C&&!x;n({global:!0,constructor:!0,forced:m||w},{DOMException:w?v:_});var T=i(h),E=T.prototype;if(E.constructor!==T){for(var D in m||o(E,`constructor`,a(1,T)),d)if(s(d,D)){var O=d[D],k=O.s;s(T,k)||o(T,k,a(6,O.c))}}}),ui=V.cw(function(e,t){var n=Ct(),r=Pt(),i=Tr(),a=_r(),o=Sr(),s=r(`URL`);n({target:`URL`,stat:!0,forced:!o},{parse:function(e){var t=i(arguments.length,1),n=a(e),r=t<2||arguments[1]===void 0?void 0:a(arguments[1]);try{return new s(n,r)}catch{return null}}})});kr(),Ar(),jr(),Pr(),Gr(),Wr(),Jr(),Yr(),Xr(),Zr(),Qr(),$r(),ei(),ti(),ri(),ii(),ai(),oi(),ui();var di=typeof process==`object`&&process+``==`[object process]`&&!process.versions.nw&&!(process.versions.electron&&process.type&&process.type!==`browser`),fi=[1/0,1/0,-1/0,-1/0],pi=new Float32Array(fi),mi=[.001,0,0,.001,0,0],hi=`http://www.w3.org/2000/svg`,gi={ANY:1,DISPLAY:2,PRINT:4,SAVE:8,ANNOTATIONS_FORMS:16,ANNOTATIONS_STORAGE:32,ANNOTATIONS_DISABLE:64,IS_EDITING:128,OPLIST:256},_i={DISABLE:0,ENABLE:1,ENABLE_FORMS:2,ENABLE_STORAGE:3},vi=`pdfjs_internal_id_`,yi=`pdfjs_internal_editor_`,bi={DISABLE:-1,NONE:0,FREETEXT:3,HIGHLIGHT:9,STAMP:13,INK:15,POPUP:16,SIGNATURE:101,COMMENT:102},xi={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},Si={PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048},Ci={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},wi={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3},Ti={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},Ei={SOLID:1,DASHED:2,BEVELED:3,INSET:4,UNDERLINE:5},Di={ERRORS:0,WARNINGS:1,INFOS:5},Oi={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},ki={moveTo:0,lineTo:1,curveTo:2,quadraticCurveTo:3,closePath:4},Ai={NEED_PASSWORD:1,INCORRECT_PASSWORD:2},ji=Di.WARNINGS;function Mi(e){Number.isInteger(e)&&(ji=e)}function Ni(){return ji}function Pi(e){ji>=Di.INFOS&&console.info(`Info: ${e}`)}function Fi(e){ji>=Di.WARNINGS&&console.warn(`Warning: ${e}`)}function Ii(e){throw Error(e)}function Li(e,t){e||Ii(t)}function Ri(e){switch(e?.protocol){case`http:`:case`https:`:case`ftp:`:case`mailto:`:case`tel:`:return!0;default:return!1}}function zi(e,t=null,n=null){if(!e)return null;if(n&&typeof e==`string`&&(n.addDefaultProtocol&&e.startsWith(`www.`)&&e.match(/\./g)?.length>=2&&(e=`http://${e}`),n.tryConvertEncoding))try{e=Qi(e)}catch{}let r=t?URL.parse(e,t):URL.parse(e);return Ri(r)?r:null}function Bi(e,t,n=!1){let r=URL.parse(e);return r?(r.hash=t,r.href):n&&zi(e,`http://example.com`)?e.split(`#`,1)[0]+`${t?`#${t}`:``}`:``}function Vi(e){return e.substring(e.lastIndexOf(`/`)+1)}function H(e,t,n,r=!1){return Object.defineProperty(e,t,{value:n,enumerable:!r,configurable:!0,writable:!1}),n}var Hi=function(){function e(e,t){this.message=e,this.name=t}return e.prototype=Error(),e.constructor=e,e}(),Ui=class extends Hi{constructor(e,t){super(e,`PasswordException`),this.code=t}},Wi=class extends Hi{constructor(e,t){super(e,`UnknownErrorException`),this.details=t}},Gi=class extends Hi{constructor(e){super(e,`InvalidPDFException`)}},Ki=class extends Hi{constructor(e,t,n){super(e,`ResponseException`),this.status=t,this.missing=n}},qi=class extends Hi{constructor(e){super(e,`FormatError`)}},Ji=class extends Hi{constructor(e){super(e,`AbortException`)}};function Yi(e){(typeof e!=`object`||e?.length===void 0)&&Ii(`Invalid argument for bytesToString`);let t=e.length,n=8192;if(t<n)return String.fromCharCode.apply(null,e);let r=[];for(let i=0;i<t;i+=n){let a=Math.min(i+n,t),o=e.subarray(i,a);r.push(String.fromCharCode.apply(null,o))}return r.join(``)}function Xi(e){typeof e!=`string`&&Ii(`Invalid argument for stringToBytes`);let t=e.length,n=new Uint8Array(t);for(let r=0;r<t;++r)n[r]=e.charCodeAt(r)&255;return n}var Zi=class{static get isLittleEndian(){let e=new Uint8Array(4);e[0]=1;let t=new Uint32Array(e.buffer,0,1);return H(this,`isLittleEndian`,t[0]===1)}static get isOffscreenCanvasSupported(){return H(this,`isOffscreenCanvasSupported`,typeof OffscreenCanvas<`u`)}static get isImageDecoderSupported(){return H(this,`isImageDecoderSupported`,typeof ImageDecoder<`u`)}static get isFloat16ArraySupported(){return H(this,`isFloat16ArraySupported`,typeof Float16Array<`u`)}static get isSanitizerSupported(){return H(this,`isSanitizerSupported`,typeof Sanitizer<`u`)}static get platform(){let{platform:e,userAgent:t}=navigator;return H(this,`platform`,{isAndroid:t.includes(`Android`),isLinux:e.includes(`Linux`),isMac:e.includes(`Mac`),isWindows:e.includes(`Win`),isFirefox:t.includes(`Firefox`)})}static get isCanvasFilterSupported(){let e;return this.isOffscreenCanvasSupported?e=new OffscreenCanvas(1,1).getContext(`2d`):typeof document<`u`&&(e=document.createElement(`canvas`).getContext(`2d`)),H(this,`isCanvasFilterSupported`,e?.filter!==void 0)}static get isAlphaColorInputSupported(){if(typeof document>`u`)return H(this,`isAlphaColorInputSupported`,!1);let e=document.createElement(`input`);return e.type=`color`,e.setAttribute(`alpha`,``),e.value=`#ff000080`,H(this,`isAlphaColorInputSupported`,e.value!==`#ff0000`)}static get isBackdropFilterSupported(){return H(this,`isBackdropFilterSupported`,typeof CSS<`u`&&CSS.supports(`backdrop-filter`,`blur(1px)`))}},U=class{static get hexNums(){return H(this,`hexNums`,Array.from({length:256},(e,t)=>t.toString(16).padStart(2,`0`)))}static makeHexColor(e,t,n){return`#${this.hexNums[e]}${this.hexNums[t]}${this.hexNums[n]}`}static transform(e,t){return[e[0]*t[0]+e[2]*t[1],e[1]*t[0]+e[3]*t[1],e[0]*t[2]+e[2]*t[3],e[1]*t[2]+e[3]*t[3],e[0]*t[4]+e[2]*t[5]+e[4],e[1]*t[4]+e[3]*t[5]+e[5]]}static multiplyByDOMMatrix(e,t){return[e[0]*t.a+e[2]*t.b,e[1]*t.a+e[3]*t.b,e[0]*t.c+e[2]*t.d,e[1]*t.c+e[3]*t.d,e[0]*t.e+e[2]*t.f+e[4],e[1]*t.e+e[3]*t.f+e[5]]}static applyTransform(e,t,n=0){let r=e[n],i=e[n+1];e[n]=r*t[0]+i*t[2]+t[4],e[n+1]=r*t[1]+i*t[3]+t[5]}static applyTransformToBezier(e,t,n=0){let r=t[0],i=t[1],a=t[2],o=t[3],s=t[4],c=t[5];for(let t=0;t<6;t+=2){let l=e[n+t],u=e[n+t+1];e[n+t]=l*r+u*a+s,e[n+t+1]=l*i+u*o+c}}static applyInverseTransform(e,t){let n=e[0],r=e[1],i=t[0]*t[3]-t[1]*t[2];e[0]=(n*t[3]-r*t[2]+t[2]*t[5]-t[4]*t[3])/i,e[1]=(-n*t[1]+r*t[0]+t[4]*t[1]-t[5]*t[0])/i}static axialAlignedBoundingBox(e,t,n){let r=t[0],i=t[1],a=t[2],o=t[3],s=t[4],c=t[5],l=e[0],u=e[1],d=e[2],f=e[3],p=r*l+s,m=p,h=r*d+s,g=h,_=o*u+c,v=_,y=o*f+c,b=y;if(i!==0||a!==0){let e=i*l,t=i*d,n=a*u,r=a*f;p+=n,g+=n,h+=r,m+=r,_+=e,b+=e,y+=t,v+=t}n[0]=Math.min(n[0],p,h,m,g),n[1]=Math.min(n[1],_,y,v,b),n[2]=Math.max(n[2],p,h,m,g),n[3]=Math.max(n[3],_,y,v,b)}static inverseTransform(e){let t=e[0]*e[3]-e[1]*e[2];return[e[3]/t,-e[1]/t,-e[2]/t,e[0]/t,(e[2]*e[5]-e[4]*e[3])/t,(e[4]*e[1]-e[5]*e[0])/t]}static singularValueDecompose2dScale(e,t){let n=e[0],r=e[1],i=e[2],a=e[3],o=n**2+r**2,s=n*i+r*a,c=i**2+a**2,l=(o+c)/2,u=Math.sqrt(l**2-(o*c-s**2));t[0]=Math.sqrt(l+u||1),t[1]=Math.sqrt(l-u||1)}static normalizeRect(e){let t=e.slice(0);return e[0]>e[2]&&(t[0]=e[2],t[2]=e[0]),e[1]>e[3]&&(t[1]=e[3],t[3]=e[1]),t}static intersect(e,t){let n=Math.max(Math.min(e[0],e[2]),Math.min(t[0],t[2])),r=Math.min(Math.max(e[0],e[2]),Math.max(t[0],t[2]));if(n>r)return null;let i=Math.max(Math.min(e[1],e[3]),Math.min(t[1],t[3])),a=Math.min(Math.max(e[1],e[3]),Math.max(t[1],t[3]));return i>a?null:[n,i,r,a]}static pointBoundingBox(e,t,n){n[0]=Math.min(n[0],e),n[1]=Math.min(n[1],t),n[2]=Math.max(n[2],e),n[3]=Math.max(n[3],t)}static rectBoundingBox(e,t,n,r,i){i[0]=Math.min(i[0],e,n),i[1]=Math.min(i[1],t,r),i[2]=Math.max(i[2],e,n),i[3]=Math.max(i[3],t,r)}static#e(e,t,n,r,i,a,o,s,c,l){if(c<=0||c>=1)return;let u=1-c,d=c*c,f=d*c,p=u*(u*(u*e+3*c*t)+3*d*n)+f*r,m=u*(u*(u*i+3*c*a)+3*d*o)+f*s;l[0]=Math.min(l[0],p),l[1]=Math.min(l[1],m),l[2]=Math.max(l[2],p),l[3]=Math.max(l[3],m)}static#t(e,t,n,r,i,a,o,s,c,l,u,d){if(Math.abs(c)<1e-12){Math.abs(l)>=1e-12&&this.#e(e,t,n,r,i,a,o,s,-u/l,d);return}let f=l**2-4*u*c;if(f<0)return;let p=Math.sqrt(f),m=2*c;this.#e(e,t,n,r,i,a,o,s,(-l+p)/m,d),this.#e(e,t,n,r,i,a,o,s,(-l-p)/m,d)}static bezierBoundingBox(e,t,n,r,i,a,o,s,c){c[0]=Math.min(c[0],e,o),c[1]=Math.min(c[1],t,s),c[2]=Math.max(c[2],e,o),c[3]=Math.max(c[3],t,s),this.#t(e,n,i,o,t,r,a,s,3*(-e+3*(n-i)+o),6*(e-2*n+i),3*(n-e),c),this.#t(e,n,i,o,t,r,a,s,3*(-t+3*(r-a)+s),6*(t-2*r+a),3*(r-t),c)}};function Qi(e){return decodeURIComponent(escape(e))}var $i=null,ea=null;function ta(e){return $i||($i=/([\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,ea=new Map([[`ſt`,`ſt`]])),e.replaceAll($i,(e,t,n)=>t?t.normalize(`NFKC`):ea.get(n))}function na(){if(typeof crypto.randomUUID==`function`)return crypto.randomUUID();let e=new Uint8Array(32);return crypto.getRandomValues(e),Yi(e)}function ra(e,t,n){if(!Array.isArray(n)||n.length<2)return!1;let[r,i,...a]=n;if(!e(r)&&!Number.isInteger(r)||!t(i))return!1;let o=a.length,s=!0;switch(i.name){case`XYZ`:if(o<2||o>3)return!1;break;case`Fit`:case`FitB`:return o===0;case`FitH`:case`FitBH`:case`FitV`:case`FitBV`:if(o>1)return!1;break;case`FitR`:if(o!==4)return!1;s=!1;break;default:return!1}for(let e of a)if(!(typeof e==`number`||s&&e===null))return!1;return!0}var ia=()=>[],aa=()=>new Map,oa=()=>Object.create(null),sa=()=>new Set;typeof Blob.prototype.bytes!=`function`&&(Blob.prototype.bytes=async function(){return new Uint8Array(await this.arrayBuffer())}),typeof Response.prototype.bytes!=`function`&&(Response.prototype.bytes=async function(){return new Uint8Array(await this.arrayBuffer())}),typeof Iterator.prototype.join!=`function`&&(Iterator.prototype.join=function(e){return[...this].join(e)}),Rr();function ca(e,t,n){return Math.min(Math.max(e,t),n)}var la=class e{constructor({viewBox:e,userUnit:t,scale:n,rotation:r,offsetX:i=0,offsetY:a=0,dontFlip:o=!1}){this.viewBox=e,this.userUnit=t,this.scale=n,this.rotation=r,this.offsetX=i,this.offsetY=a,n*=t;let s=(e[2]+e[0])/2,c=(e[3]+e[1])/2,l,u,d,f;switch(r%=360,r<0&&(r+=360),r){case 180:l=-1,u=0,d=0,f=1;break;case 90:l=0,u=1,d=1,f=0;break;case 270:l=0,u=-1,d=-1,f=0;break;case 0:l=1,u=0,d=0,f=-1;break;default:throw Error(`PageViewport: Invalid rotation, must be a multiple of 90 degrees.`)}o&&(d=-d,f=-f);let p,m,h,g;l===0?(p=Math.abs(c-e[1])*n+i,m=Math.abs(s-e[0])*n+a,h=(e[3]-e[1])*n,g=(e[2]-e[0])*n):(p=Math.abs(s-e[0])*n+i,m=Math.abs(c-e[1])*n+a,h=(e[2]-e[0])*n,g=(e[3]-e[1])*n),this.transform=[l*n,u*n,d*n,f*n,p-l*n*s-d*n*c,m-u*n*s-f*n*c],this.width=h,this.height=g}get rawDims(){let e=this.viewBox;return H(this,`rawDims`,{pageWidth:e[2]-e[0],pageHeight:e[3]-e[1],pageX:e[0],pageY:e[1]})}clone({scale:t=this.scale,rotation:n=this.rotation,offsetX:r=this.offsetX,offsetY:i=this.offsetY,dontFlip:a=!1}={}){return new e({viewBox:this.viewBox.slice(),userUnit:this.userUnit,scale:t,rotation:n,offsetX:r,offsetY:i,dontFlip:a})}convertToViewportPoint(e,t){let n=[e,t];return U.applyTransform(n,this.transform),n}convertToPdfPoint(e,t){let n=[e,t];return U.applyInverseTransform(n,this.transform),n}},ua=class e{static textContent(t){let n=[],r={items:n,styles:Object.create(null)};function i(t){if(!t)return;let r=null,a=t.name;if(a===`#text`)r=t.value;else if(e.shouldBuildText(a))t?.attributes?.textContent?r=t.attributes.textContent:t.value&&(r=t.value);else return;if(r!==null&&n.push({str:r}),t.children)for(let e of t.children)i(e)}return i(t),r}static shouldBuildText(e){return e!==`textarea`&&e!==`input`&&e!==`option`&&e!==`select`}},da=/url\(|image-set\(/i,fa=/^on/i,pa=class{static get _allowedHtmlElements(){return H(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 H(this,`_allowedSvgElements`,new Set([`ellipse`,`line`,`path`,`rect`,`svg`]))}static get _allowedRichTextElements(){return H(this,`_allowedRichTextElements`,new Set([`a`,`b`,`br`,`div`,`i`,`li`,`ol`,`p`,`span`,`sub`,`sup`,`ul`]))}static get _allowedRichTextAttributes(){return H(this,`_allowedRichTextAttributes`,new Set([`class`,`dir`,`style`]))}static get _allowedRichTextStyles(){return H(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`.split(`.`)))}static setupStorage(e,t,n,r,i){let a=r.getValue(t,{value:null});switch(n.name){case`textarea`:if(a.value!==null&&(e.textContent=a.value),i===`print`)break;e.addEventListener(`input`,e=>{r.setValue(t,{value:e.target.value})});break;case`input`:if(n.attributes.type===`radio`||n.attributes.type===`checkbox`){if(a.value===n.attributes.xfaOn?e.setAttribute(`checked`,!0):a.value===n.attributes.xfaOff&&e.removeAttribute(`checked`),i===`print`)break;e.addEventListener(`change`,e=>{r.setValue(t,{value:e.target.checked?e.target.getAttribute(`xfaOn`):e.target.getAttribute(`xfaOff`)})})}else{if(a.value!==null&&e.setAttribute(`value`,a.value),i===`print`)break;e.addEventListener(`input`,e=>{r.setValue(t,{value:e.target.value})})}break;case`select`:if(a.value!==null){e.setAttribute(`value`,a.value);for(let e of n.children)e.attributes.value===a.value?e.attributes.selected=!0:Object.hasOwn(e.attributes,`selected`)&&delete e.attributes.selected}e.addEventListener(`input`,e=>{let n=e.target.options,i=n.selectedIndex===-1?``:n[n.selectedIndex].value;r.setValue(t,{value:i})})}}static setAttributes({html:e,element:t,storage:n=null,intent:r,linkService:i}){let{attributes:a}=t,o=e instanceof HTMLAnchorElement;a.type===`radio`&&(a.name=`${a.name}-${r}`);for(let[t,n]of Object.entries(a))if(!(n==null||fa.test(t))&&(r!==`richText`||this._allowedRichTextAttributes.has(t)))switch(t){case`class`:n.length&&e.setAttribute(t,n.join(` `));break;case`dataId`:break;case`id`:e.setAttribute(`data-element-id`,n);break;case`style`:if(r===`richText`){let t=this._allowedRichTextStyles;for(let[r,i]of Object.entries(n))t.has(r)&&!da.test(i)&&(e.style[r]=i)}else Object.assign(e.style,n);break;case`textContent`:e.textContent=n;break;default:(!o||t!==`href`&&t!==`newWindow`)&&e.setAttribute(t,n)}o&&i?.addLinkAttributes(e,a.href,a.newWindow),n&&a.dataId&&this.setupStorage(e,a.dataId,t,n)}static#e(e,t,n){return n===`richText`?!t&&this._allowedRichTextElements.has(e)?document.createElement(e):null:t?t===hi&&this._allowedSvgElements.has(e)?document.createElementNS(hi,e):null:this._allowedHtmlElements.has(e)?document.createElement(e):null}static render(e){let t=e.annotationStorage,n=e.linkService,r=e.xfaHtml,i=e.intent||`display`,a=this.#e(r.name,r.attributes?.xmlns,i)??document.createElement(`div`);r.attributes&&this.setAttributes({html:a,element:r,intent:i,linkService:n});let o=i!==`richText`,s=e.div;if(s.append(a),e.viewport){let t=`matrix(${e.viewport.transform.join(`,`)})`;s.style.transform=t}o&&s.setAttribute(`class`,`xfaLayer xfaFont`);let c=[];if(r.children.length===0){if(r.value){let e=document.createTextNode(r.value);a.append(e),o&&ua.shouldBuildText(r.name)&&c.push(e)}return{textDivs:c}}let l=[[r,-1,a]];for(;l.length>0;){let[e,r,a]=l.at(-1);if(r+1===e.children.length){l.pop();continue}let s=e.children[++l.at(-1)[1]];if(s===null)continue;let{name:u}=s;if(u===`#text`){let e=document.createTextNode(s.value);c.push(e),a.append(e);continue}let d=this.#e(u,s.attributes?.xmlns,i);if(d){if(a.append(d),s.attributes&&this.setAttributes({html:d,element:s,storage:t,intent:i,linkService:n}),s.children?.length>0)l.push([s,-1,d]);else if(s.value){let e=document.createTextNode(s.value);o&&ua.shouldBuildText(u)&&c.push(e),d.append(e)}}}for(let e of s.querySelectorAll(`.xfaNonInteractive input, .xfaNonInteractive textarea`))e.setAttribute(`readOnly`,!0);return{textDivs:c}}static update(e){let t=`matrix(${e.viewport.transform.join(`,`)})`;e.div.style.transform=t,e.div.hidden=!1}static getPageViewport(e,{scale:t=1,rotation:n=0}){let{width:r,height:i}=e.attributes.style;return new la({viewBox:[0,0,parseInt(r,10),parseInt(i,10)],userUnit:1,scale:t,rotation:n})}},ma=class{static CSS=96;static PDF=72;static PDF_TO_CSS_UNITS=this.CSS/this.PDF};async function ha(e,t=`text`){if(Sa(e,document.baseURI)){let n=await fetch(e);if(!n.ok)throw Error(n.statusText);switch(t){case`blob`:return n.blob();case`bytes`:return n.bytes();case`json`:return n.json()}return n.text()}return new Promise((n,r)=>{let i=new XMLHttpRequest;i.open(`GET`,e,!0),i.responseType=t===`bytes`?`arraybuffer`:t,i.onreadystatechange=()=>{if(i.readyState===XMLHttpRequest.DONE){if(i.status===200||i.status===0){switch(t){case`bytes`:n(new Uint8Array(i.response));return;case`blob`:case`json`:n(i.response);return}n(i.responseText)}else r(Error(i.statusText))}},i.send(null)})}var ga=class extends Hi{constructor(e,t=0){super(e,`RenderingCancelledException`),this.extraDelay=t}};function _a(e){let t=e.length,n=0;for(;n<t&&e[n].trim()===``;)n++;return e.substring(n,n+5).toLowerCase()===`data:`}function va(e){return typeof e==`string`&&/\.pdf$/i.test(e)}function ya(e){return[e]=e.split(/[#?]/,1),Vi(e)}function ba(e,t=`document.pdf`){if(typeof e!=`string`)return t;if(_a(e))return Fi(`getPdfFilenameFromUrl: ignore "data:"-URL for performance reasons.`),t;let n=(e=>{try{return new URL(e)}catch{}try{return new URL(decodeURIComponent(e))}catch{}try{return new URL(e,`https://foo.bar`)}catch{}try{return new URL(decodeURIComponent(e),`https://foo.bar`)}catch{}return null})(e);if(!n)return t;let r=e=>{try{let t=decodeURIComponent(e);return t.includes(`/`)&&(t=Vi(t),t.length===4&&i.test(t))?e:t}catch{return e}},i=/\.pdf$/i,a=Vi(n.pathname);if(i.test(a))return r(a);if(n.searchParams.size>0){let e=e=>[...e].findLast(e=>i.test(e)),t=e(n.searchParams.values())??e(n.searchParams.keys());if(t)return r(t)}if(n.hash){let{hash:e}=n,t=-1;for(let{index:n}of e.matchAll(/\.pdf\b/gi))t=n;if(t>0){let n=t;for(;n>0&&!`/?#=`.includes(e[n-1]);)n--;if(n<t)return r(e.slice(n,t+4))}}return t}var xa=class{#e=new Map;times=[];time(e){this.#e.has(e)&&Fi(`Timer is already running for ${e}`),this.#e.set(e,Date.now())}timeEnd(e){this.#e.has(e)||Fi(`Timer has not been started for ${e}`),this.times.push({name:e,start:this.#e.get(e),end:Date.now()}),this.#e.delete(e)}toString(){let e=Math.max(...this.times.map(e=>e.name.length));return this.times.map(t=>`${t.name.padEnd(e)} ${t.end-t.start}ms\n`).join(``)}};function Sa(e,t){let n=t?URL.parse(e,t):URL.parse(e);return/https?:/.test(n?.protocol??``)}function Ca(e){e.preventDefault()}function wa(e){e.preventDefault(),e.stopPropagation()}var Ta=class{static#e;static toDateObject(e){if(e instanceof Date)return e;if(!e||typeof e!=`string`)return null;this.#e||=RegExp(`^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+\\-])?(\\d{2})?'?(\\d{2})?'?`);let t=this.#e.exec(e);if(!t)return null;let n=parseInt(t[1],10),r=parseInt(t[2],10);r=r>=1&&r<=12?r-1:0;let i=parseInt(t[3],10);i=i>=1&&i<=31?i:1;let a=parseInt(t[4],10);a=a>=0&&a<=23?a:0;let o=parseInt(t[5],10);o=o>=0&&o<=59?o:0;let s=parseInt(t[6],10);s=s>=0&&s<=59?s:0;let c=t[7]||`Z`,l=parseInt(t[8],10);l=l>=0&&l<=23?l:0;let u=parseInt(t[9],10)||0;return u=u>=0&&u<=59?u:0,c===`-`?(a+=l,o+=u):c===`+`&&(a-=l,o-=u),new Date(Date.UTC(n,r,i,a,o,s))}};function Ea(e){if(e.startsWith(`#`)){let t=e.slice(1);return[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16),t.length>=8?parseInt(t.slice(6,8),16)/255:1]}if(e.startsWith(`rgb(`)){let[t,n,r]=e.slice(4,-1).split(`,`).map(e=>parseInt(e,10));return[t,n,r,1]}if(e.startsWith(`rgba(`)){let t=e.slice(5,-1).split(`,`);return[parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10),parseFloat(t[3])]}let t=e.match(/^color\(srgb\s+([\d.]+)\s+([\d.]+)\s+([\d.]+)(?:\s*\/\s*([\d.]+|none))?\)$/);return t?[Math.round(parseFloat(t[1])*255),Math.round(parseFloat(t[2])*255),Math.round(parseFloat(t[3])*255),t[4]!==void 0&&t[4]!==`none`?parseFloat(t[4]):1]:null}function Da(e){let t=Ea(e);return t?t.slice(0,3):(Fi(`Not a valid color format: "${e}"`),[0,0,0])}function Oa(e){let t=document.createElement(`span`);t.style.visibility=`hidden`,t.style.colorScheme=`only light`,document.body.append(t);for(let n of e.keys()){t.style.color=n;let r=window.getComputedStyle(t).color;e.set(n,Da(r))}t.remove()}function ka(e){let{a:t,b:n,c:r,d:i,e:a,f:o}=e.getTransform();return[t,n,r,i,a,o]}function Aa(e){let{a:t,b:n,c:r,d:i,e:a,f:o}=e.getTransform().invertSelf();return[t,n,r,i,a,o]}function ja(e,t,n=!1,r=!0){if(t instanceof la){let{pageWidth:r,pageHeight:i}=t.rawDims,{style:a}=e,o=`round(down, var(--total-scale-factor) * ${r}px, var(--scale-round-x))`,s=`round(down, var(--total-scale-factor) * ${i}px, var(--scale-round-y))`;!n||t.rotation%180==0?(a.width=o,a.height=s):(a.width=s,a.height=o)}r&&e.setAttribute(`data-main-rotation`,t.rotation)}var Ma=class e{constructor(){let{pixelRatio:t}=e;this.sx=t,this.sy=t}get scaled(){return this.sx!==1||this.sy!==1}get symmetric(){return this.sx===this.sy}limitCanvas(t,n,r,i,a=-1){let o=1/0,s=1/0,c=1/0;r=e.capPixels(r,a),r>0&&(o=Math.sqrt(r/(t*n))),i!==-1&&(s=i/t,c=i/n);let l=Math.min(o,s,c);return this.sx>l||this.sy>l?(this.sx=l,this.sy=l,!0):!1}static get pixelRatio(){return globalThis.devicePixelRatio||1}static capPixels(e,t){if(t>=0){let n=Math.ceil(window.screen.availWidth*window.screen.availHeight*this.pixelRatio**2*(1+t/100));return e>0?Math.min(e,n):n}return e}},Na=new Set([`image/apng`,`image/avif`,`image/bmp`,`image/gif`,`image/jpeg`,`image/png`,`image/svg+xml`,`image/webp`,`image/x-icon`]),Pa=class{static get isDarkMode(){return H(this,`isDarkMode`,!!window?.matchMedia?.(`(prefers-color-scheme: dark)`).matches)}},Fa=class{static get commentForegroundColor(){let e=document.createElement(`span`);e.classList.add(`comment`,`sidebar`);let{style:t}=e;t.width=t.height=`0`,t.display=`none`,t.color=`var(--comment-fg-color)`,document.body.append(e);let{color:n}=window.getComputedStyle(e);return e.remove(),H(this,`commentForegroundColor`,Da(n))}};function Ia(e,t){t=ca(t??1,0,1);let n=255*(1-t);return e.map(e=>Math.round(e*t+n))}function La(e,t){let n=e[0]/255,r=e[1]/255,i=e[2]/255,a=Math.max(n,r,i),o=Math.min(n,r,i),s=(a+o)/2;if(a===o)t[0]=t[1]=0;else{let e=a-o;switch(t[1]=s<.5?e/(a+o):e/(2-a-o),a){case n:t[0]=((r-i)/e+(r<i?6:0))*60;break;case r:t[0]=((i-n)/e+2)*60;break;case i:t[0]=((n-r)/e+4)*60}}t[2]=s}function Ra(e,t){let n=e[0],r=e[1],i=e[2],a=(1-Math.abs(2*i-1))*r,o=a*(1-Math.abs(n/60%2-1)),s=i-a/2;switch(Math.floor(n/60)){case 0:t[0]=a+s,t[1]=o+s,t[2]=s;break;case 1:t[0]=o+s,t[1]=a+s,t[2]=s;break;case 2:t[0]=s,t[1]=a+s,t[2]=o+s;break;case 3:t[0]=s,t[1]=o+s,t[2]=a+s;break;case 4:t[0]=o+s,t[1]=s,t[2]=a+s;break;case 5:case 6:t[0]=a+s,t[1]=s,t[2]=o+s}}function za(e){return e<=.03928?e/12.92:((e+.055)/1.055)**2.4}function Ba(e,t,n){Ra(e,n),n.map(za);let r=.2126*n[0]+.7152*n[1]+.0722*n[2];Ra(t,n),n.map(za);let i=.2126*n[0]+.7152*n[1]+.0722*n[2];return r>i?(r+.05)/(i+.05):(i+.05)/(r+.05)}var Va=new Map;function Ha(e,t){let n=e[0]+e[1]*256+e[2]*65536+t[0]*16777216+t[1]*4294967296+t[2]*1099511627776,r=Va.get(n);if(r)return r;let i=new Float32Array(9),a=i.subarray(0,3),o=i.subarray(3,6);La(e,o);let s=i.subarray(6,9);La(t,s);let c=s[2]<.5,l=c?12:4.5;if(o[2]=c?Math.sqrt(o[2]):1-Math.sqrt(1-o[2]),Ba(o,s,a)<l){let e,t;for(c?(e=o[2],t=1):(e=0,t=o[2]);t-e>.005;){let n=o[2]=(e+t)/2;c===Ba(o,s,a)<l?e=n:t=n}o[2]=c?t:e}return Ra(o,a),r=U.makeHexColor(Math.round(a[0]*255),Math.round(a[1]*255),Math.round(a[2]*255)),Va.set(n,r),r}function Ua({html:e,dir:t,className:n},r){let i=document.createDocumentFragment();if(typeof e==`string`){let n=document.createElement(`p`);n.dir=t||`auto`;let r=e.split(/\r\n?|\n/);for(let e=0,t=r.length;e<t;++e){let i=r[e];n.append(document.createTextNode(i)),e<t-1&&n.append(document.createElement(`br`))}i.append(n)}else pa.render({xfaHtml:e,div:i,intent:`richText`});i.firstElementChild.classList.add(`richText`,n),r.append(i)}function Wa(e){let t=new Path2D;if(!e)return t;for(let n=0,r=e.length;n<r;)switch(e[n++]){case ki.moveTo:t.moveTo(e[n++],e[n++]);break;case ki.lineTo:t.lineTo(e[n++],e[n++]);break;case ki.curveTo:t.bezierCurveTo(e[n++],e[n++],e[n++],e[n++],e[n++],e[n++]);break;case ki.quadraticCurveTo:t.quadraticCurveTo(e[n++],e[n++],e[n++],e[n++]);break;case ki.closePath:t.closePath();break;default:Fi(`Unrecognized drawing path operator: ${e[n-1]}`)}return t}Br(),ci(),si(),li(),zr(),Ur(),Mr(),Nr(),Fr(),Hr();var Ga=class e{#e=null;#t=null;#n;#r=null;#i=null;#a=null;#o=null;#s=null;static#c=null;constructor(t){this.#n=t,e.#c||=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 t=this.#e=document.createElement(`div`);t.classList.add(`editToolbar`,`hidden`),t.setAttribute(`role`,`toolbar`);let n=this.#n._uiManager._signal;n instanceof AbortSignal&&!n.aborted&&(t.addEventListener(`contextmenu`,Ca,{signal:n}),t.addEventListener(`pointerdown`,e.#l,{signal:n}));let r=this.#r=document.createElement(`div`);r.className=`buttons`,t.append(r);let i=this.#n.toolbarPosition;if(i){let{style:e}=t;e.insetInlineEnd=`${100*(this.#n._uiManager.direction===`ltr`?1-i[0]:i[0])}%`,e.top=`calc(${100*i[1]}% + var(--editor-toolbar-vert-offset))`}return t}get div(){return this.#e}static#l(e){e.stopPropagation()}#u(e){this.#n._focusEventsAllowed=!1,wa(e)}#d(e){this.#n._focusEventsAllowed=!0,wa(e)}#f(e){let t=this.#n._uiManager._signal;return!(t instanceof AbortSignal)||t.aborted?!1:(e.addEventListener(`focusin`,this.#u.bind(this),{capture:!0,signal:t}),e.addEventListener(`focusout`,this.#d.bind(this),{capture:!0,signal:t}),e.addEventListener(`contextmenu`,Ca,{signal:t}),!0)}hide(){this.#e.classList.add(`hidden`),this.#t?.hideDropdown()}show(){this.#e.classList.remove(`hidden`),this.#i?.shown(),this.#a?.shown()}addDeleteButton(){let{editorType:t,_uiManager:n}=this.#n,r=document.createElement(`button`);r.classList.add(`basic`,`deleteButton`),r.tabIndex=0,r.setAttribute(`data-l10n-id`,e.#c[t]),this.#f(r)&&r.addEventListener(`click`,e=>{n.delete()},{signal:n._signal}),this.#r.append(r)}get#p(){let e=document.createElement(`div`);return e.className=`divider`,e}async addAltText(e){let t=await e.render();this.#f(t),this.#r.append(t,this.#p),this.#i=e}addComment(e,t=null){if(this.#a)return;let n=e.renderForToolbar();if(!n)return;this.#f(n);let r=this.#o=this.#p;t?(this.#r.insertBefore(n,t),this.#r.insertBefore(r,t)):this.#r.append(n,r),this.#a=e,e.toolbar=this}addColorPicker(e){if(this.#t)return;this.#t=e;let t=e.renderButton();this.#f(t),this.#r.append(t,this.#p)}async addEditSignatureButton(e){let t=this.#s=await e.renderEditButton(this.#n);t&&(this.#f(t),this.#r.append(t,this.#p))}removeButton(e){e===`comment`&&(this.#a?.removeToolbarCommentButton(),this.#a=null,this.#o?.remove(),this.#o=null)}async addButton(e,t){switch(e){case`colorPicker`:t&&this.addColorPicker(t);break;case`altText`:t&&await this.addAltText(t);break;case`editSignature`:t&&await this.addEditSignatureButton(t);break;case`delete`:this.addDeleteButton();break;case`comment`:t&&this.addComment(t)}}async addButtonBefore(e,t,n){if(!t&&e===`comment`)return;let r=this.#r.querySelector(n);r&&e===`comment`&&this.addComment(t,r)}updateEditSignatureButton(e){this.#s&&(this.#s.title=e)}remove(){this.#e.remove(),this.#t?.destroy(),this.#t=null}},Ka=class{#e=null;#t=null;#n;constructor(e){this.#n=e}#r(){let e=this.#t=document.createElement(`div`);e.className=`editToolbar`,e.setAttribute(`role`,`toolbar`),e.dir=this.#n.direction;let t=this.#n._signal;t instanceof AbortSignal&&!t.aborted&&e.addEventListener(`contextmenu`,Ca,{signal:t});let n=this.#e=document.createElement(`div`);return n.className=`buttons`,e.append(n),this.#n.hasCommentManager()&&this.#a(`commentButton`,`pdfjs-comment-floating-button`,`pdfjs-comment-floating-button-label`,()=>{this.#n.commentSelection(`floating_button`)}),this.#a(`highlightButton`,`pdfjs-highlight-floating-button1`,`pdfjs-highlight-floating-button-label`,()=>{this.#n.highlightSelection(`floating_button`)}),e}#i(e,t){let n=0,r=0;for(let i of e){let e=i.y+i.height;if(e<n)continue;let a=i.x+(t?i.width:0);e>n?(r=a,n=e):t?a>r&&(r=a):a<r&&(r=a)}return[t?1-r:r,n]}show(e,t,n){let[r,i]=this.#i(t,n),{style:a}=this.#t||=this.#r();e.append(this.#t),a.insetInlineEnd=`${100*r}%`,a.top=`calc(${100*i}% + var(--editor-toolbar-vert-offset))`}hide(){this.#t.remove()}#a(e,t,n,r){let i=document.createElement(`button`);i.classList.add(`basic`,e),i.tabIndex=0,i.setAttribute(`data-l10n-id`,t);let a=document.createElement(`span`);i.append(a),a.className=`visuallyHidden`,a.setAttribute(`data-l10n-id`,n);let o=this.#n._signal;o instanceof AbortSignal&&!o.aborted&&(i.addEventListener(`contextmenu`,Ca,{signal:o}),i.addEventListener(`click`,r,{signal:o})),this.#e.append(i)}},qa=Object.freeze({internal:`2837668c-d334-48d1-ba74-aa7deba483da`});function Ja(e,t,n){for(let r of n)t.addEventListener(r,e[r].bind(e))}var Ya=class e{static#e=NaN;static#t=null;static#n=NaN;static#r=null;static initializeAndAddPointerId(t){(e.#t||=new Set).add(t)}static setPointer(t,n){e.#e||=n,e.#r??=t}static setTimeStamp(t){e.#n=t}static isSamePointerId(t){return e.#e===t}static isSamePointerIdOrRemove(t){return e.#e===t||(e.#t?.delete(t),!1)}static isSamePointerType(t){return e.#r===t}static isInitializedAndDifferentPointerType(t){return e.#r!==null&&!e.isSamePointerType(t)}static isSameTimeStamp(t){return e.#n===t}static isUsingMultiplePointers(){return e.#t?.size>=1}static clearPointerType(){e.#r=null}static clearPointerIds(){e.#e=NaN,e.#t=null}static clearTimeStamp(){e.#n=NaN}},Xa=class{#e=0;get id(){return`${yi}${this.#e++}`}},Za=class e{#e=na();#t=0;#n=null;static get _isSVGFittingCanvas(){let e=`data:image/svg+xml;charset=UTF-8,<svg viewBox="0 0 1 1" width="1" height="1" xmlns="${hi}"><rect width="1" height="1" style="fill:red;"/></svg>`,t=new OffscreenCanvas(1,3).getContext(`2d`,{willReadFrequently:!0}),n=new Image;n.src=e;let r=n.decode().then(()=>(t.drawImage(n,0,0,1,1,0,0,1,3),new Uint32Array(t.getImageData(0,0,1,1).data.buffer)[0]===0));return H(this,`_isSVGFittingCanvas`,r)}async#r(t,n){this.#n||=new Map;let r=this.#n.get(t);if(r===null)return null;if(r?.bitmap)return r.refCounter+=1,r;try{r||={bitmap:null,id:`image_${this.#e}_${this.#t++}`,refCounter:0,isSvg:!1};let t;if(typeof n==`string`?(r.url=n,t=await ha(n,`blob`)):n instanceof File?t=r.file=n:n instanceof Blob&&(t=n),t.type===`image/svg+xml`){let n=e._isSVGFittingCanvas,i=new FileReader,a=new Image,o=new Promise((e,t)=>{a.onload=()=>{r.bitmap=a,r.isSvg=!0,e()},i.onload=async()=>{let e=r.svgUrl=i.result;a.src=await n?`${e}#svgView(preserveAspectRatio(none))`:e},a.onerror=i.onerror=t});i.readAsDataURL(t),await o}else r.bitmap=await createImageBitmap(t);r.refCounter=1}catch(e){Fi(e),r=null}return this.#n.set(t,r),r&&this.#n.set(r.id,r),r}async getFromFile(e){let{lastModified:t,name:n,size:r,type:i}=e;return this.#r(`${t}_${n}_${r}_${i}`,e)}async getFromUrl(e){return this.#r(e,e)}async getFromBlob(e,t){let n=await t;return this.#r(e,n)}async getFromId(e){this.#n||=new Map;let t=this.#n.get(e);if(!t)return null;if(t.bitmap)return t.refCounter+=1,t;if(t.file)return this.getFromFile(t.file);if(t.blobPromise){let{blobPromise:e}=t;return delete t.blobPromise,this.getFromBlob(t.id,e)}return this.getFromUrl(t.url)}getFromCanvas(e,t){this.#n||=new Map;let n=this.#n.get(e);if(n?.bitmap)return n.refCounter+=1,n;let r=new OffscreenCanvas(t.width,t.height);return r.getContext(`2d`).drawImage(t,0,0),n={bitmap:r.transferToImageBitmap(),id:`image_${this.#e}_${this.#t++}`,refCounter:1,isSvg:!1},this.#n.set(e,n),this.#n.set(n.id,n),n}getSvgUrl(e){let t=this.#n.get(e);return t?.isSvg?t.svgUrl:null}deleteId(e){this.#n||=new Map;let t=this.#n.get(e);if(!t||(--t.refCounter,t.refCounter!==0))return;let{bitmap:n}=t;if(!t.url&&!t.file){let e=new OffscreenCanvas(n.width,n.height);e.getContext(`bitmaprenderer`).transferFromImageBitmap(n),t.blobPromise=e.convertToBlob()}n.close?.(),t.bitmap=null}isValidId(e){return e.startsWith(`image_${this.#e}_`)}},Qa=class{#e=[];#t=!1;#n;#r=-1;constructor(e=128){this.#n=e}add({cmd:e,undo:t,post:n,mustExec:r,type:i=NaN,overwriteIfSameType:a=!1,keepUndo:o=!1}){if(r&&e(),this.#t)return;let s={cmd:e,undo:t,post:n,type:i};if(this.#r===-1){this.#e.length>0&&(this.#e.length=0),this.#r=0,this.#e.push(s);return}if(a&&this.#e[this.#r].type===i){o&&(s.undo=this.#e[this.#r].undo),this.#e[this.#r]=s;return}let c=this.#r+1;c===this.#n?this.#e.splice(0,1):(this.#r=c,c<this.#e.length&&this.#e.splice(c)),this.#e.push(s)}undo(){if(this.#r===-1)return;this.#t=!0;let{undo:e,post:t}=this.#e[this.#r];e(),t?.(),this.#t=!1,--this.#r}redo(){if(this.#r<this.#e.length-1){this.#r+=1,this.#t=!0;let{cmd:e,post:t}=this.#e[this.#r];e(),t?.(),this.#t=!1}}hasSomethingToUndo(){return this.#r!==-1}hasSomethingToRedo(){return this.#r<this.#e.length-1}cleanType(e){if(this.#r!==-1){for(let t=this.#r;t>=0;t--)if(this.#e[t].type!==e){this.#e.splice(t+1,this.#r-t),this.#r=t;return}this.#e.length=0,this.#r=-1}}destroy(){this.#e=null}},$a=class e{static ALT=1;static CTRL=2;static META=4;static SHIFT=8;constructor(t){this.callbacks=new Map;let{isMac:n}=Zi.platform;for(let[r,i,a={}]of t){let t=r.some(e=>e.startsWith(`mac+`));for(let o of r){let r=o;if(t){let e=o.startsWith(`mac+`);if(n!==e)continue;e&&(r=o.slice(4))}let[s,c]=e.#e(r);s!==null&&this.callbacks.getOrInsertComputed(s,ia).push({callback:i,options:a,modifiers:c})}}}static#e(t){let n=null,r=0;for(let i of t.split(`+`)){if(i=i.trim(),!i)continue;let a=i.toUpperCase(),o=e[a];if(o)r|=o;else{if(n!==null){Fi(`KeyboardManager: multiple keys in shortcut "${t}"`);break}n=a===`SPACE`?` `:i}}return n===null&&Fi(`KeyboardManager: no key found in shortcut "${t}"`),[n,r]}static#t(e){let t=/^(?:Key([A-Z])|(?:Digit|Numpad)(\d))$/.exec(e);return t?t[1]?.toLowerCase()??t[2]:null}exec(t,n){let r=this.callbacks.get(n.key);if(!r){if(/^[a-z]$/i.test(n.key))return;let t=e.#t(n.code);if(t===null||t===n.key||(r=this.callbacks.get(t),!r))return}let i=(n.altKey?e.ALT:0)|(n.ctrlKey?e.CTRL:0)|(n.metaKey?e.META:0)|(n.shiftKey?e.SHIFT:0),a=r.find(e=>e.modifiers===i);if(!a)return;let{callback:o,options:{bubbles:s=!1,args:c=[],checker:l=null}}=a;(!l||l(t,n))&&(o.bind(t,...c,n)(),s||wa(n))}},eo=class e{static _colorsMapping=new Map([[`CanvasText`,[0,0,0]],[`Canvas`,[255,255,255]]]);get _colors(){let e=new Map([[`CanvasText`,null],[`Canvas`,null]]);return Oa(e),H(this,`_colors`,e)}convert(t){let n=Da(t);if(!window.matchMedia(`(forced-colors: active)`).matches)return n;for(let[t,r]of this._colors)if(r.every((e,t)=>e===n[t]))return e._colorsMapping.get(t);return n}getHexCode(e){let t=this._colors.get(e);return t?U.makeHexColor(...t):e}},to=class e{#e=new AbortController;#t=null;#n=null;#r=new Map;#i=new Map;#a=null;#o=null;#s=null;#c=null;#l=null;#u=new Qa;#d=null;#f=null;#p=null;#m=0;#h=new Set;#g=null;#_=null;#v=new Set;_editorUndoBar=null;#y=!1;#b=!1;#x=!1;#S=null;#C=null;#w=null;#T=null;#E=!1;#D=null;#O=new Xa;#k=!1;#A=!1;#j=!1;#M=null;#N=null;#P=null;#F=null;#I=null;#L=bi.NONE;#R=new Set;#z=null;#B=null;#V=null;#H=null;#U=null;#W={isEditing:!1,isEmpty:!0,hasSomethingToUndo:!1,hasSomethingToRedo:!1,hasSelectedEditor:!1,hasSelectedText:!1};#G=[0,0];#K=null;#q=null;#J=null;#Y=null;#X=null;static TRANSLATE_SMALL=1;static TRANSLATE_BIG=10;static get _keyboardManager(){let t=e.prototype,n=e=>e.#q.contains(document.activeElement)&&document.activeElement.tagName!==`BUTTON`&&e.hasSomethingToControl(),r=(e,{target:t})=>{if(t instanceof HTMLInputElement){let{type:e}=t;return e!==`text`&&e!==`number`}return!0},i=this.TRANSLATE_SMALL,a=this.TRANSLATE_BIG;return H(this,`_keyboardManager`,new $a([[[`ctrl+a`,`mac+meta+a`],t.selectAll,{checker:r}],[[`ctrl+z`,`mac+meta+z`],t.undo,{checker:r}],[[`ctrl+y`,`ctrl+shift+z`,`mac+meta+shift+z`,`ctrl+shift+Z`,`mac+meta+shift+Z`],t.redo,{checker:r}],[[`Backspace`,`alt+Backspace`,`ctrl+Backspace`,`shift+Backspace`,`mac+Backspace`,`mac+alt+Backspace`,`mac+ctrl+Backspace`,`Delete`,`ctrl+Delete`,`shift+Delete`,`mac+Delete`],t.delete,{checker:r}],[[`Enter`],t.addNewEditorFromKeyboard,{checker:(e,{target:t})=>!(t instanceof HTMLButtonElement)&&e.#q.contains(t)&&!e.isEnterHandled}],[[`Space`],t.addNewEditorFromKeyboard,{checker:(e,{target:t})=>!(t instanceof HTMLButtonElement)&&e.#q.contains(document.activeElement)}],[[`Escape`],t.unselectAll],[[`ArrowLeft`],t.translateSelectedEditors,{args:[-i,0],checker:n}],[[`ctrl+ArrowLeft`,`mac+shift+ArrowLeft`],t.translateSelectedEditors,{args:[-a,0],checker:n}],[[`ArrowRight`],t.translateSelectedEditors,{args:[i,0],checker:n}],[[`ctrl+ArrowRight`,`mac+shift+ArrowRight`],t.translateSelectedEditors,{args:[a,0],checker:n}],[[`ArrowUp`],t.translateSelectedEditors,{args:[0,-i],checker:n}],[[`ctrl+ArrowUp`,`mac+shift+ArrowUp`],t.translateSelectedEditors,{args:[0,-a],checker:n}],[[`ArrowDown`],t.translateSelectedEditors,{args:[0,i],checker:n}],[[`ctrl+ArrowDown`,`mac+shift+ArrowDown`],t.translateSelectedEditors,{args:[0,a],checker:n}]]))}constructor(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h){let g=this._signal=this.#e.signal;this.#q=e,this.#J=t,this.#Y=n,this.#s=r,this.#d=i,this.#B=a,this.#U=s,this._eventBus=o;let _={signal:g,...qa};o.on(`editingaction`,this.onEditingAction.bind(this),_),o.on(`pagechanging`,this.onPageChanging.bind(this),_),o.on(`scalechanging`,this.onScaleChanging.bind(this),_),o.on(`rotationchanging`,this.onRotationChanging.bind(this),_),o.on(`setpreference`,this.onSetPreference.bind(this),_),o.on(`switchannotationeditorparams`,e=>this.updateParams(e.type,e.value),_),window.addEventListener(`pointerdown`,()=>{this.#A=!0},{capture:!0,signal:g}),window.addEventListener(`pointerup`,()=>{this.#A=!1},{capture:!0,signal:g}),window.addEventListener(`beforeunload`,this.endCurrentEditing.bind(this),{capture:!0,signal:g}),this.#ne(),this.#le(),this.#ae(),this.#c=s.annotationStorage,this.#S=s.filterFactory,this.#V=c,this.#T=l||null,this.#y=u,this.#b=d,this.#x=f,this.#I=p||null,this.viewParameters={realScale:ma.PDF_TO_CSS_UNITS,rotation:0},this.isShiftKeyDown=!1,this._editorUndoBar=m||null,this._supportsPinchToZoom=h!==!1,i?.setSidebarUiManager(this)}destroy(){this.#X?.resolve(),this.#X=null,this.#e?.abort(),this.#e=null,this._signal=null;for(let e of this.#i.values())e.destroy();this.#i.clear(),this.#r.clear(),this.#v.clear(),this.#F?.clear(),this.#t=null,this.#R.clear(),this.#u.destroy(),this.#s?.destroy(),this.#d?.destroy(),this.#B?.destroy(),this.#D?.hide(),this.#D=null,this.#P?.destroy(),this.#P=null,this.#n=null,this.#C&&=(clearTimeout(this.#C),null),this.#K&&=(clearTimeout(this.#K),null),this._editorUndoBar?.destroy(),this.#U=null}combinedSignal(e){return AbortSignal.any([this._signal,e.signal])}get mlManager(){return this.#I}get useNewAltTextFlow(){return this.#b}get useNewAltTextWhenAddingImage(){return this.#x}get hcmFilter(){return H(this,`hcmFilter`,this.#V?this.#S.addHCMFilter(this.#V.foreground,this.#V.background):`none`)}get direction(){return H(this,`direction`,getComputedStyle(this.#q).direction)}get _highlightColors(){return H(this,`_highlightColors`,this.#T?new Map(this.#T.split(`,`).map(e=>(e=e.split(`=`).map(e=>e.trim()),e[1]=e[1].toUpperCase(),e))):null)}get highlightColors(){let{_highlightColors:e}=this;if(!e)return H(this,`highlightColors`,null);let t=new Map,n=!!this.#V;for(let[r,i]of e){let e=r.endsWith(`_HCM`);n&&e?t.set(r.replace(`_HCM`,``),i):!n&&!e&&t.set(r,i)}return H(this,`highlightColors`,t)}get highlightColorNames(){return H(this,`highlightColorNames`,this.highlightColors?new Map(Array.from(this.highlightColors,e=>e.reverse())):null)}getNonHCMColor(e){if(!this._highlightColors)return e;let t=this.highlightColorNames.get(e);return this._highlightColors.get(t)||e}getNonHCMColorName(e){return this.highlightColorNames.get(e)||e}setCurrentDrawingSession(e){e?(this.unselectAll(),this.disableUserSelect(!0)):this.disableUserSelect(!1),this.#p=e}setMainHighlightColorPicker(e){this.#P=e}editAltText(e,t=!1){this.#s?.editAltText(this,e,t)}hasCommentManager(){return!!this.#d}editComment(e,t,n,r){this.#d?.showDialog(this,e,t,n,r)}selectComment(e,t){(this.#i.get(e)?.getEditorByUID(t))?.toggleComment(!0,!0)}updateComment(e){this.#d?.updateComment(e.getData())}updatePopupColor(e){this.#d?.updatePopupColor(e)}removeComment(e){this.#d?.removeComments([e.uid])}deleteComment(e,t){let n=()=>{e.comment=t};this.addCommands({cmd:()=>{this._editorUndoBar?.show(n,`comment`),this.toggleComment(null),e.comment=null},undo:n,mustExec:!0})}toggleComment(e,t,n=void 0){this.#d?.toggleCommentPopup(e,t,n)}makeCommentColor(e,t){return e&&this.#d?.makeCommentColor(e,t)||null}getCommentDialogElement(){return this.#d?.dialogElement||null}async waitForEditorsRendered(e){if(this.#i.has(e-1))return;let{resolve:t,promise:n}=Promise.withResolvers(),r=n=>{n.pageNumber===e&&(this._eventBus.off(`editorsrendered`,r),t())};this._eventBus.on(`editorsrendered`,r,qa),await n}getSignature(e){this.#B?.getSignature({uiManager:this,editor:e})}get signatureManager(){return this.#B}switchToMode(e,t){this._eventBus.on(`annotationeditormodechanged`,t,{once:!0,signal:this._signal,...qa}),this._eventBus.dispatch(`showannotationeditorui`,{source:this,mode:e})}setPreference(e,t){this._eventBus.dispatch(`setpreference`,{source:this,name:e,value:t})}onSetPreference({name:e,value:t}){e===`enableNewAltTextWhenAddingImage`&&(this.#x=t)}onPageChanging({pageNumber:e}){this.#m=e-1}deletePage(e){for(let t of this.getEditors(e))t.remove();this.#i.delete(e),this.#m===e&&(this.#m=0)}focusMainContainer(){this.#q.focus()}findParent(e,t){for(let n of this.#i.values()){let{x:r,y:i,width:a,height:o}=n.div.getBoundingClientRect();if(e>=r&&e<=r+a&&t>=i&&t<=i+o)return n}return null}disableUserSelect(e=!1){this.#J.classList.toggle(`noUserSelect`,e)}addShouldRescale(e){this.#v.add(e)}removeShouldRescale(e){this.#v.delete(e)}onScaleChanging({scale:e}){this.commitOrRemove(),this.viewParameters.realScale=e*ma.PDF_TO_CSS_UNITS;for(let e of this.#v)e.onScaleChanging();this.#p?.onScaleChanging()}onRotationChanging({pagesRotation:e}){this.commitOrRemove(),this.viewParameters.rotation=e}#Z({anchorNode:e}){return e.nodeType===Node.TEXT_NODE?e.parentElement:e}#Q(e){let{currentLayer:t}=this;if(t.hasTextLayer(e))return t;for(let t of this.#i.values())if(t.hasTextLayer(e))return t;return null}highlightSelection(e=``,t=!1){let n=document.getSelection();if(!n||n.isCollapsed)return;let{anchorNode:r,anchorOffset:i,focusNode:a,focusOffset:o}=n,s=n.toString(),c=this.#Z(n).closest(`.textLayer`),l=this.getSelectionBoxes(c);if(!l)return;n.empty();let u=this.#Q(c),d=this.#L===bi.NONE,f=()=>{let n=u?.createAndAddNewEditor({x:0,y:0},!1,{methodOfCreation:e,boxes:l,anchorNode:r,anchorOffset:i,focusNode:a,focusOffset:o,text:s});d&&this.showAllEditors(`highlight`,!0,!0),t&&n?.editComment()};d?this.switchToMode(bi.HIGHLIGHT,f):f()}commentSelection(e=``){this.highlightSelection(e,!0)}endCurrentEditing(){this.commitOrRemove(),this.currentLayer?.endDrawingSession(!1)}#$(){let e=document.getSelection();if(!e||e.isCollapsed)return;let t=this.#Z(e).closest(`.textLayer`),n=this.getSelectionBoxes(t);n&&(this.#D||=new Ka(this),this.#D.show(t,n,this.direction===`ltr`))}getAndRemoveDataFromAnnotationStorage(e){if(!this.#c)return null;let t=`${yi}${e}`,n=this.#c.getRawValue(t);return n&&this.#c.remove(t),n}addToAnnotationStorage(e){!e.isEmpty()&&this.#c&&!this.#c.has(e.id)&&this.#c.setValue(e.id,e)}a11yAlert(e,t=null){let n=this.#Y;n&&(n.setAttribute(`data-l10n-id`,e),t?n.setAttribute(`data-l10n-args`,JSON.stringify(t)):n.removeAttribute(`data-l10n-args`))}#ee(){let e=document.getSelection();if(!e||e.isCollapsed){this.#z&&(this.#D?.hide(),this.#z=null,this.#ue({hasSelectedText:!1}));return}let{anchorNode:t}=e;if(t===this.#z)return;let n=this.#Z(e).closest(`.textLayer`);if(!n)this.#z&&(this.#D?.hide(),this.#z=null,this.#ue({hasSelectedText:!1}));else if(this.#D?.hide(),this.#z=t,this.#ue({hasSelectedText:!0}),(this.#L===bi.HIGHLIGHT||this.#L===bi.NONE)&&(this.#L===bi.HIGHLIGHT&&this.showAllEditors(`highlight`,!0,!0),this.#E=this.isShiftKeyDown,!this.isShiftKeyDown)){let e=this.#L===bi.HIGHLIGHT?this.#Q(n):null;if(e?.toggleDrawing(),this.#A){let t=new AbortController,n=this.combinedSignal(t),r=n=>{(n.type!==`pointerup`||n.button===0)&&(t.abort(),e?.toggleDrawing(!0),n.type===`pointerup`&&this.#te(`main_toolbar`))};window.addEventListener(`pointerup`,r,{signal:n}),window.addEventListener(`blur`,r,{signal:n})}else e?.toggleDrawing(!0),this.#te(`main_toolbar`)}}#te(e=``){this.#L===bi.HIGHLIGHT?this.highlightSelection(e):this.#y&&this.#$()}#ne(){document.addEventListener(`selectionchange`,this.#ee.bind(this),{signal:this._signal})}#re(){if(this.#w)return;this.#w=new AbortController;let e=this.combinedSignal(this.#w);window.addEventListener(`focus`,this.focus.bind(this),{signal:e}),window.addEventListener(`blur`,this.blur.bind(this),{signal:e})}#ie(){this.#w?.abort(),this.#w=null}blur(){if(this.isShiftKeyDown=!1,this.#E&&(this.#E=!1,this.#te(`main_toolbar`)),!this.hasSelection)return;let{activeElement:e}=document;for(let t of this.#R)if(t.div.contains(e)){this.#N=[t,e],t._focusEventsAllowed=!1;break}}focus(){if(!this.#N)return;let[e,t]=this.#N;this.#N=null,t.addEventListener(`focusin`,()=>{e._focusEventsAllowed=!0},{once:!0,signal:this._signal}),t.focus()}#ae(){if(this.#M)return;this.#M=new AbortController;let e=this.combinedSignal(this.#M);window.addEventListener(`keydown`,this.keydown.bind(this),{signal:e}),window.addEventListener(`keyup`,this.keyup.bind(this),{signal:e})}#oe(){this.#M?.abort(),this.#M=null}#se(){if(this.#f)return;this.#f=new AbortController;let e=this.combinedSignal(this.#f);document.addEventListener(`copy`,this.copy.bind(this),{signal:e}),document.addEventListener(`cut`,this.cut.bind(this),{signal:e}),document.addEventListener(`paste`,this.paste.bind(this),{signal:e})}#ce(){this.#f?.abort(),this.#f=null}#le(){let e=this._signal;document.addEventListener(`dragover`,this.dragOver.bind(this),{signal:e}),document.addEventListener(`drop`,this.drop.bind(this),{signal:e})}addEditListeners(){this.#ae(),this.setEditingState(!0)}removeEditListeners(){this.#oe(),this.setEditingState(!1)}dragOver(e){for(let{type:t}of e.dataTransfer.items)for(let n of this.#_)if(n.isHandlingMimeForPasting(t)){e.dataTransfer.dropEffect=`copy`,e.preventDefault();return}}drop(e){for(let t of e.dataTransfer.items)for(let n of this.#_)if(n.isHandlingMimeForPasting(t.type)){n.paste(t,this.currentLayer),e.preventDefault();return}}copy(e){if(e.preventDefault(),this.#t?.commitOrRemove(),!this.hasSelection)return;let t=[];for(let e of this.#R){let n=e.serialize(!0);n&&t.push(n)}t.length!==0&&e.clipboardData.setData(`application/pdfjs`,JSON.stringify(t))}cut(e){this.copy(e),this.delete()}async paste(e){e.preventDefault();let{clipboardData:t}=e;for(let e of t.items)for(let t of this.#_)if(t.isHandlingMimeForPasting(e.type)){t.paste(e,this.currentLayer);return}let n=t.getData(`application/pdfjs`);if(!n)return;try{n=JSON.parse(n)}catch(e){Fi(`paste: "${e.message}".`);return}if(!Array.isArray(n))return;this.unselectAll();let r=this.currentLayer;try{let e=[];for(let t of n){let n=await r.deserialize(t);if(!n)return;e.push(n)}this.addCommands({cmd:()=>{for(let t of e)this.#me(t);this.#_e(e)},undo:()=>{for(let t of e)t.remove()},mustExec:!0})}catch(e){Fi(`paste: "${e.message}".`)}}keydown(t){!this.isShiftKeyDown&&t.key===`Shift`&&(this.isShiftKeyDown=!0),this.#L!==bi.NONE&&!this.isEditorHandlingKeyboard&&e._keyboardManager.exec(this,t)}keyup(e){this.isShiftKeyDown&&e.key===`Shift`&&(this.isShiftKeyDown=!1,this.#E&&(this.#E=!1,this.#te(`main_toolbar`)))}onEditingAction({name:e}){switch(e){case`undo`:case`redo`:case`delete`:case`selectAll`:this[e]();break;case`highlightSelection`:this.highlightSelection(`context_menu`);break;case`commentSelection`:this.commentSelection(`context_menu`)}}updatePageIndex(e,t){for(let n of this.#o.get(e)||[])n.pageIndex=t;let n=this.#a.get(e);n&&(n.pageIndex=t,this.#i.set(t,n),this.#k?n.enable():n.disable())}startUpdatePages(){this.#a=new Map(this.#i),this.#i.clear();let e=this.#o=new Map,t=t=>{e.getOrInsertComputed(t.pageIndex,ia).push(t)};for(let e of this.#r.values())t(e);for(let[e,n]of this.#c)e.startsWith(yi)&&!this.#r.has(e)&&Number.isInteger(n?.pageIndex)&&t(n)}endUpdatePages(){this.#a=null,this.#o=null}clonePage(e,t){for(let n of this.getEditors(e)){let e=n.serialize(n.mode!==bi.HIGHLIGHT);e&&(e.pageIndex=t,e.id=this.getId(),e.isClone=!0,delete e.popupRef,this.#c.setValue(e.id,e))}}findClonesForPage(e){let t=[],{pageIndex:n}=e;for(let[r,i]of this.#c)i.pageIndex===n&&i.isClone&&(this.#c.remove(r),t.push(e.deserialize(i).then(t=>{t&&(t.isClone=!0,e.addOrRebuild(t))})));return Promise.all(t)}#ue(e){Object.entries(e).some(([e,t])=>this.#W[e]!==t)&&(this._eventBus.dispatch(`editingstateschanged`,{source:this,details:Object.assign(this.#W,e)}),this.#L===bi.HIGHLIGHT&&e.hasSelectedEditor===!1&&this.#de([[xi.HIGHLIGHT_FREE,!0]]))}#de(e){this._eventBus.dispatch(`annotationeditorparamschanged`,{source:this,details:e})}setEditingState(e){e?(this.#re(),this.#se(),this.#ue({isEditing:this.#L!==bi.NONE,isEmpty:this.#ge(),hasSomethingToUndo:this.#u.hasSomethingToUndo(),hasSomethingToRedo:this.#u.hasSomethingToRedo(),hasSelectedEditor:!1})):(this.#ie(),this.#ce(),this.#ue({isEditing:!1}),this.disableUserSelect(!1))}registerEditorTypes(e){if(!this.#_){this.#_=e;for(let e of this.#_)this.#de(e.defaultPropertiesToUpdate)}}getId(){return this.#O.id}get currentLayer(){return this.#i.get(this.#m)}getLayer(e){return this.#i.get(e)}get currentPageIndex(){return this.#m}addLayer(e){this.#i.set(e.pageIndex,e),this.#k?e.enable():e.disable()}removeLayer(e){this.#i.delete(e.pageIndex)}async updateMode(e,t=null,n=!1,r=!1,i=!1,a=!1){if(this.#L!==e&&!(this.#X&&(await this.#X.promise,!this.#X))){if(this.#X=Promise.withResolvers(),this.#p?.commitOrRemove(),this.#L===bi.POPUP&&this.#d?.hideSidebar(),this.#d?.destroyPopup(),this.#L=e,e===bi.NONE){this.setEditingState(!1),this.#pe();for(let e of this.#r.values())e.hideStandaloneCommentButton();this._editorUndoBar?.hide(),this.toggleComment(null),this.#X.resolve()}else{for(let e of this.#r.values())e.addStandaloneCommentButton();e===bi.SIGNATURE&&await this.#B?.loadSignatures(),n&&Ya.clearPointerType(),this.setEditingState(!0),await this.#fe(),this.unselectAll();for(let t of this.#i.values())t.updateMode(e);if(e===bi.POPUP){this.#n||=await this.#U.getAnnotationsByType(new Set(this.#_.map(e=>e._editorType)));let e=new Set,t=[];for(let n of this.#r.values()){let{annotationElementId:r,hasComment:i,deleted:a}=n;r&&e.add(r),i&&!a&&t.push(n.getData())}for(let n of this.#n){let{id:r,popupRef:i,contentsObj:a}=n;i&&a?.str&&!e.has(r)&&!this.#h.has(r)&&t.push(n)}this.#d?.showSidebar(t)}if(!t)r&&this.addNewEditorFromKeyboard(),this.#X.resolve();else{for(let e of this.#r.values())e.uid===t?(this.setSelected(e),a?e.editComment():i?e.enterInEditMode():e.focus()):e.unselect();this.#X.resolve()}}}}addNewEditorFromKeyboard(){this.currentLayer.canCreateNewEmptyEditor()&&this.currentLayer.addNewEditor()}updateToolbar(e){e.mode!==this.#L&&this._eventBus.dispatch(`switchannotationeditormode`,{source:this,...e})}updateParams(e,t){if(this.#_){switch(e){case xi.CREATE:this.currentLayer.addNewEditor(t);return;case xi.HIGHLIGHT_SHOW_ALL:this._eventBus.dispatch(`reporttelemetry`,{source:this,details:{type:`editing`,data:{type:`highlight`,action:`toggle_visibility`}}}),(this.#H||=new Map).set(e,t),this.showAllEditors(`highlight`,t)}if(this.hasSelection)for(let n of this.#R)n.updateParams(e,t);else for(let n of this.#_)n.updateDefaultParams(e,t)}}showAllEditors(e,t,n=!1){for(let n of this.#r.values())n.editorType===e&&n.show(t);(this.#H?.get(xi.HIGHLIGHT_SHOW_ALL)??!0)!==t&&this.#de([[xi.HIGHLIGHT_SHOW_ALL,t]])}enableWaiting(e=!1){if(this.#j!==e){this.#j=e;for(let t of this.#i.values())e?t.disableClick():t.enableClick(),t.div.classList.toggle(`waiting`,e)}}async#fe(){if(!this.#k){this.#k=!0;let e=[];for(let t of this.#i.values())e.push(t.enable());await Promise.all(e);for(let e of this.#r.values())e.enable()}}#pe(){if(this.unselectAll(),this.#k){this.#k=!1;for(let e of this.#i.values())e.disable();for(let e of this.#r.values())e.disable()}}*getEditors(e){for(let t of this.#r.values())t.pageIndex===e&&(yield t)}getEditor(e){return this.#r.get(e)}addEditor(e){this.#r.set(e.id,e)}removeEditor(e){e.div.contains(document.activeElement)&&(this.#C&&clearTimeout(this.#C),this.#C=setTimeout(()=>{this.focusMainContainer(),this.#C=null},0)),this.#r.delete(e.id),e.annotationElementId&&this.#F?.delete(e.annotationElementId),this.unselect(e),e.annotationElementId&&this.#h.has(e.annotationElementId)||this.#c?.remove(e.id)}addDeletedAnnotationElement(e){this.#h.add(e.annotationElementId),this.addChangedExistingAnnotation(e),e.deleted=!0}isDeletedAnnotationElement(e){return this.#h.has(e)}removeDeletedAnnotationElement(e){this.#h.delete(e.annotationElementId),this.removeChangedExistingAnnotation(e),e.deleted=!1}#me(e){let t=this.#i.get(e.pageIndex);t?t.addOrRebuild(e):(this.addEditor(e),this.addToAnnotationStorage(e))}setActiveEditor(e){this.#t!==e&&(this.#t=e,e&&this.#de(e.propertiesToUpdate))}get#he(){let e=null;for(e of this.#R);return e}updateUI(e){this.#he===e&&this.#de(e.propertiesToUpdate)}updateUIForDefaultProperties(e){this.#de(e.defaultPropertiesToUpdate)}toggleSelected(e){this.#R.has(e)?(this.#R.delete(e),e.unselect(),this.#ue({hasSelectedEditor:this.hasSelection})):(this.#R.add(e),e.select(),this.#de(e.propertiesToUpdate),this.#ue({hasSelectedEditor:!0}))}setSelected(e){this.updateToolbar({mode:e.mode,editId:e.uid}),this.#p?.commitOrRemove();for(let t of this.#R)t!==e&&t.unselect();this.#d?.destroyPopup(),this.#R.clear(),this.#R.add(e),e.select(),this.#de(e.propertiesToUpdate),this.#ue({hasSelectedEditor:!0})}get firstSelectedEditor(){return this.#R.values().next().value}unselect(e){e.unselect(),this.#R.delete(e),this.#ue({hasSelectedEditor:this.hasSelection})}get hasSelection(){return this.#R.size!==0}get isEnterHandled(){return this.#R.size===1&&this.firstSelectedEditor.isEnterHandled}undo(){this.#u.undo(),this.#ue({hasSomethingToUndo:this.#u.hasSomethingToUndo(),hasSomethingToRedo:!0,isEmpty:this.#ge()}),this._editorUndoBar?.hide()}redo(){this.#u.redo(),this.#ue({hasSomethingToUndo:!0,hasSomethingToRedo:this.#u.hasSomethingToRedo(),isEmpty:this.#ge()})}addCommands(e){this.#u.add(e),this.#ue({hasSomethingToUndo:!0,hasSomethingToRedo:!1,isEmpty:this.#ge()})}cleanUndoStack(e){this.#u.cleanType(e)}#ge(){if(this.#r.size===0)return!0;if(this.#r.size===1)for(let e of this.#r.values())return e.isEmpty();return!1}delete(){this.commitOrRemove();let e=this.currentLayer?.endDrawingSession(!0);if(!this.hasSelection&&!e)return;let t=e?[e]:[...this.#R],n=()=>{this._editorUndoBar?.show(r,t.length===1?t[0].editorType:t.length);for(let e of t)e.remove()},r=()=>{for(let e of t)this.#me(e)};this.addCommands({cmd:n,undo:r,mustExec:!0})}commitOrRemove(){this.#t?.commitOrRemove()}hasSomethingToControl(){return this.#t||this.hasSelection}#_e(e){for(let e of this.#R)e.unselect();this.#R.clear();for(let t of e)t.isEmpty()||(this.#R.add(t),t.select());this.#ue({hasSelectedEditor:this.hasSelection})}selectAll(){for(let e of this.#R)e.commit();this.#_e(this.#r.values())}unselectAll(){if(!(this.#t&&(this.#t.commitOrRemove(),this.#L!==bi.NONE))&&!this.#p?.commitOrRemove()&&(this.#d?.destroyPopup(),this.hasSelection)){for(let e of this.#R)e.unselect();this.#R.clear(),this.#ue({hasSelectedEditor:!1})}}translateSelectedEditors(e,t,n=!1){if(n||this.commitOrRemove(),!this.hasSelection)return;this.#G[0]+=e,this.#G[1]+=t;let[r,i]=this.#G,a=[...this.#R];this.#K&&clearTimeout(this.#K),this.#K=setTimeout(()=>{this.#K=null,this.#G[0]=this.#G[1]=0,this.addCommands({cmd:()=>{for(let e of a)this.#r.has(e.id)&&(e.translateInPage(r,i),e.translationDone())},undo:()=>{for(let e of a)this.#r.has(e.id)&&(e.translateInPage(-r,-i),e.translationDone())},mustExec:!1})},1e3);for(let n of a)n.translateInPage(e,t),n.translationDone()}setUpDragSession(){if(this.hasSelection){this.disableUserSelect(!0),this.#g=new Map;for(let e of this.#R)this.#g.set(e,{savedX:e.x,savedY:e.y,savedPageIndex:e.pageIndex,newX:0,newY:0,newPageIndex:-1})}}endDragSession(){if(!this.#g)return!1;this.disableUserSelect(!1);let e=this.#g;this.#g=null;let t=!1;for(let[{x:n,y:r,pageIndex:i},a]of e)a.newX=n,a.newY=r,a.newPageIndex=i,t||=n!==a.savedX||r!==a.savedY||i!==a.savedPageIndex;if(!t)return!1;let n=(e,t,n,r)=>{if(this.#r.has(e.id)){let i=this.#i.get(r);i?e._setParentAndPosition(i,t,n):(e.pageIndex=r,e.x=t,e.y=n)}};return this.addCommands({cmd:()=>{for(let[t,{newX:r,newY:i,newPageIndex:a}]of e)n(t,r,i,a)},undo:()=>{for(let[t,{savedX:r,savedY:i,savedPageIndex:a}]of e)n(t,r,i,a)},mustExec:!0}),!0}dragSelectedEditors(e,t){if(this.#g)for(let n of this.#g.keys())n.drag(e,t)}rebuild(e){if(e.parent===null){let t=this.getLayer(e.pageIndex);t?(t.changeParent(e),t.addOrRebuild(e)):(this.addEditor(e),this.addToAnnotationStorage(e),e.rebuild())}else e.parent.addOrRebuild(e)}get isEditorHandlingKeyboard(){return this.getActive()?.shouldGetKeyboardEvents()||this.#R.size===1&&this.firstSelectedEditor.shouldGetKeyboardEvents()}isActive(e){return this.#t===e}getActive(){return this.#t}getMode(){return this.#L}isEditingMode(){return this.#L!==bi.NONE}get imageManager(){return H(this,`imageManager`,new Za)}getSelectionBoxes(e){if(!e)return null;let t=document.getSelection();for(let n=0,r=t.rangeCount;n<r;n++)if(!e.contains(t.getRangeAt(n).commonAncestorContainer))return null;let{x:n,y:r,width:i,height:a}=e.getBoundingClientRect(),o;switch(e.getAttribute(`data-main-rotation`)){case`90`:o=(e,t,o,s)=>({x:(t-r)/a,y:1-(e+o-n)/i,width:s/a,height:o/i});break;case`180`:o=(e,t,o,s)=>({x:1-(e+o-n)/i,y:1-(t+s-r)/a,width:o/i,height:s/a});break;case`270`:o=(e,t,o,s)=>({x:1-(t+s-r)/a,y:(e-n)/i,width:s/a,height:o/i});break;default:o=(e,t,o,s)=>({x:(e-n)/i,y:(t-r)/a,width:o/i,height:s/a})}let s=[];for(let e=0,n=t.rangeCount;e<n;e++){let n=t.getRangeAt(e);if(!n.collapsed)for(let{x:e,y:t,width:r,height:i}of n.getClientRects())r!==0&&i!==0&&s.push(o(e,t,r,i))}return s.length===0?null:s}addChangedExistingAnnotation({annotationElementId:e,id:t}){(this.#l||=new Map).set(e,t)}removeChangedExistingAnnotation({annotationElementId:e}){this.#l?.delete(e)}renderAnnotationElement(e){let t=this.#l?.get(e.data.id);if(!t)return;let n=this.#c.getRawValue(t);n&&(this.#L!==bi.NONE||n.hasBeenModified)&&n.renderAnnotationElement(e)}setMissingCanvas(e,t,n){let r=this.#F?.get(e);r&&(r.setCanvas(t,n),this.#F.delete(e))}addMissingCanvas(e,t){(this.#F||=new Map).set(e,t)}},no=class e{#e=null;#t=!1;#n=null;#r=null;#i=null;#a=null;#o=!1;#s=null;#c=null;#l=null;#u=null;#d=!1;static#f=null;static _l10n=null;constructor(t){this.#c=t,this.#d=t._uiManager.useNewAltTextFlow,e.#f||=Object.freeze({added:`pdfjs-editor-new-alt-text-added-button`,"added-label":`pdfjs-editor-new-alt-text-added-button-label`,missing:`pdfjs-editor-new-alt-text-missing-button`,"missing-label":`pdfjs-editor-new-alt-text-missing-button-label`,review:`pdfjs-editor-new-alt-text-to-review-button`,"review-label":`pdfjs-editor-new-alt-text-to-review-button-label`})}static initialize(t){e._l10n??=t}async render(){let t=this.#n=document.createElement(`button`);t.className=`altText`,t.tabIndex=`0`;let n=this.#r=document.createElement(`span`);t.append(n),this.#d?(t.classList.add(`new`),t.setAttribute(`data-l10n-id`,e.#f.missing),n.setAttribute(`data-l10n-id`,e.#f[`missing-label`])):(t.setAttribute(`data-l10n-id`,`pdfjs-editor-alt-text-button`),n.setAttribute(`data-l10n-id`,`pdfjs-editor-alt-text-button-label`));let r=this.#c._uiManager._signal;t.addEventListener(`contextmenu`,Ca,{signal:r}),t.addEventListener(`pointerdown`,e=>e.stopPropagation(),{signal:r});let i=e=>{e.preventDefault(),this.#c._uiManager.editAltText(this.#c),this.#d&&this.#c._reportTelemetry({action:`pdfjs.image.alt_text.image_status_label_clicked`,data:{label:this.#p}})};return t.addEventListener(`click`,i,{capture:!0,signal:r}),t.addEventListener(`keydown`,e=>{e.target===t&&e.key===`Enter`&&(this.#o=!0,i(e))},{signal:r}),await this.#m(),t}get#p(){return this.#e&&`added`||this.#e===null&&this.guessedText&&`review`||`missing`}finish(){this.#n&&(this.#n.focus({focusVisible:this.#o}),this.#o=!1)}isEmpty(){return this.#d?this.#e===null:!this.#e&&!this.#t}hasData(){return this.#d?this.#e!==null||!!this.#l:this.isEmpty()}get guessedText(){return this.#l}async setGuessedText(t){this.#e===null&&(this.#l=t,this.#u=await e._l10n.get(`pdfjs-editor-new-alt-text-generated-alt-text-with-disclaimer`,{generatedAltText:t}),this.#m())}toggleAltTextBadge(e=!1){if(!this.#d||this.#e)this.#s?.remove(),this.#s=null;else{if(!this.#s){let e=this.#s=document.createElement(`div`);e.className=`noAltTextBadge`,this.#c.div.append(e)}this.#s.classList.toggle(`hidden`,!e)}}serialize(e){let t=this.#e;return!e&&this.#l===t&&(t=this.#u),{altText:t,decorative:this.#t,guessedText:this.#l,textWithDisclaimer:this.#u}}get data(){return{altText:this.#e,decorative:this.#t}}set data({altText:e,decorative:t,guessedText:n,textWithDisclaimer:r,cancel:i=!1}){n&&(this.#l=n,this.#u=r),(this.#e!==e||this.#t!==t)&&(i||(this.#e=e,this.#t=t),this.#m())}toggle(e=!1){this.#n&&(!e&&this.#a&&(clearTimeout(this.#a),this.#a=null),this.#n.disabled=!e)}shown(){this.#c._reportTelemetry({action:`pdfjs.image.alt_text.image_status_label_displayed`,data:{label:this.#p}})}destroy(){this.#n?.remove(),this.#n=null,this.#r=null,this.#i=null,this.#s?.remove(),this.#s=null}async#m(){let t=this.#n;if(!t)return;if(this.#d){if(t.classList.toggle(`done`,!!this.#e),t.setAttribute(`data-l10n-id`,e.#f[this.#p]),this.#r?.setAttribute(`data-l10n-id`,e.#f[`${this.#p}-label`]),!this.#e){this.#i?.remove();return}}else{if(!this.#e&&!this.#t){t.classList.remove(`done`),this.#i?.remove();return}t.classList.add(`done`),t.setAttribute(`data-l10n-id`,`pdfjs-editor-alt-text-edit-button`)}let n=this.#i;if(!n){this.#i=n=document.createElement(`span`),n.className=`tooltip`,n.setAttribute(`role`,`tooltip`),n.id=`alt-text-tooltip-${this.#c.id}`;let e=this.#c._uiManager._signal;e.addEventListener(`abort`,()=>{clearTimeout(this.#a),this.#a=null},{once:!0}),t.addEventListener(`mouseenter`,()=>{this.#a=setTimeout(()=>{this.#a=null,this.#i.classList.add(`show`),this.#c._reportTelemetry({action:`alt_text_tooltip`})},100)},{signal:e}),t.addEventListener(`mouseleave`,()=>{this.#a&&=(clearTimeout(this.#a),null),this.#i?.classList.remove(`show`)},{signal:e})}this.#t?n.setAttribute(`data-l10n-id`,`pdfjs-editor-alt-text-decorative-tooltip`):(n.removeAttribute(`data-l10n-id`),n.textContent=this.#e),n.parentNode||t.append(n),this.#c.getElementForAltText()?.setAttribute(`aria-describedby`,n.id)}},ro=class{#e=null;#t=null;#n=!1;#r=null;#i=null;#a=null;#o=null;#s=null;#c=!1;#l=null;constructor(e){this.#r=e}renderForToolbar(){let e=this.#t=document.createElement(`button`);return e.className=`comment`,this.#u(e,!1)}renderForStandalone(){let e=this.#e=document.createElement(`button`);e.className=`annotationCommentButton`;let t=this.#r.commentButtonPosition;if(t){let{style:n}=e;n.insetInlineEnd=`calc(${100*(this.#r._uiManager.direction===`ltr`?1-t[0]:t[0])}% - var(--comment-button-dim))`,n.top=`calc(${100*t[1]}% - var(--comment-button-dim))`;let r=this.#r.commentButtonColor;r&&(n.backgroundColor=r)}return this.#u(e,!0)}focusButton(){setTimeout(()=>{(this.#e??this.#t)?.focus()},0)}onUpdatedColor(){if(!this.#e)return;let e=this.#r.commentButtonColor;e&&(this.#e.style.backgroundColor=e),this.#r._uiManager.updatePopupColor(this.#r)}get commentButtonWidth(){return(this.#e?.getBoundingClientRect().width??0)/this.#r.parent.boundingClientRect.width}get commentPopupPositionInLayer(){if(this.#l)return this.#l;if(!this.#e)return null;let{x:e,y:t,height:n}=this.#e.getBoundingClientRect(),{x:r,y:i,width:a,height:o}=this.#r.parent.boundingClientRect;return[(e-r)/a,(t+n-i)/o]}set commentPopupPositionInLayer(e){this.#l=e}hasDefaultPopupPosition(){return this.#l===null}removeStandaloneCommentButton(){this.#e?.remove(),this.#e=null}removeToolbarCommentButton(){this.#t?.remove(),this.#t=null}setCommentButtonStates({selected:e,hasPopup:t}){this.#e&&(this.#e.classList.toggle(`selected`,e),this.#e.ariaExpanded=t)}#u(e,t){if(!this.#r._uiManager.hasCommentManager())return null;e.tabIndex=`0`,e.ariaHasPopup=`dialog`,t?(e.ariaControls=`commentPopup`,e.setAttribute(`data-l10n-id`,`pdfjs-show-comment-button`)):(e.ariaControlsElements=[this.#r._uiManager.getCommentDialogElement()],e.setAttribute(`data-l10n-id`,`pdfjs-editor-add-comment-button`));let n=this.#r._uiManager._signal;if(!(n instanceof AbortSignal)||n.aborted)return e;e.addEventListener(`contextmenu`,Ca,{signal:n}),t&&(e.addEventListener(`focusin`,e=>{this.#r._focusEventsAllowed=!1,wa(e)},{capture:!0,signal:n}),e.addEventListener(`focusout`,e=>{this.#r._focusEventsAllowed=!0,wa(e)},{capture:!0,signal:n})),e.addEventListener(`pointerdown`,e=>e.stopPropagation(),{signal:n});let r=t=>{t.preventDefault(),e===this.#t?this.edit():this.#r.toggleComment(!0)};return e.addEventListener(`click`,r,{capture:!0,signal:n}),e.addEventListener(`keydown`,t=>{t.target===e&&t.key===`Enter`&&(this.#n=!0,r(t))},{signal:n}),e.addEventListener(`pointerenter`,()=>{this.#r.toggleComment(!1,!0)},{signal:n}),e.addEventListener(`pointerleave`,()=>{this.#r.toggleComment(!1,!1)},{signal:n}),e}edit(e){let t=this.commentPopupPositionInLayer,n,r;if(t)[n,r]=t;else{[n,r]=this.#r.commentButtonPosition;let{width:e,height:t,x:i,y:a}=this.#r;n=i+n*e,r=a+r*t}let i=this.#r.parent.boundingClientRect,{x:a,y:o,width:s,height:c}=i;this.#r._uiManager.editComment(this.#r,a+n*s,o+r*c,{...e,parentDimensions:i})}finish(){this.#t&&(this.#t.focus({focusVisible:this.#n}),this.#n=!1)}isDeleted(){return this.#c||this.#o===``}isEmpty(){return this.#o===null}hasBeenEdited(){return this.isDeleted()||this.#o!==this.#i}serialize(){return this.data}get data(){return{text:this.#o,richText:this.#a,date:this.#s,deleted:this.isDeleted()}}set data(e){e!==this.#o&&(this.#a=null),e===null?(this.#o=``,this.#c=!0):(this.#o=e,this.#s=new Date,this.#c=!1)}restoreData({text:e,richText:t,date:n}){this.#o=e,this.#a=t,this.#s=n,this.#c=!1}setInitialText(e,t=null){this.#i=e,this.data=e,this.#s=null,this.#a=t}shown(){}destroy(){this.#t?.remove(),this.#t=null,this.#e?.remove(),this.#e=null,this.#o=``,this.#a=null,this.#s=null,this.#r=null,this.#n=!1,this.#c=!1}};function io(e){e.preventDefault()}var ao=1e-4;function oo(e){return e.cancelable?(wa(e),!0):(e.stopPropagation(),!1)}var so=class{#e;#t=!1;#n=null;#r;#i;#a;#o;#s;#c=!1;#l=null;#u;#d=new Set;#f=null;#p;#m=null;#h=0;constructor({container:e,isPinchingDisabled:t=null,isPinchingStopped:n=null,onPinchStart:r=null,onPinching:i=null,onPinchEnd:a=null,onPanning:o=null,signal:s}){this.#e=e,this.#n=n,this.#r=t,this.#i=r,this.#a=i,this.#o=a,this.#s=o,this.#p=new AbortController,this.#u=AbortSignal.any([s,this.#p.signal]),e.addEventListener(`touchstart`,this.#g.bind(this),{passive:!1,signal:this.#u})}get MIN_TOUCH_DISTANCE_TO_PINCH(){return 35/Ma.pixelRatio}get MIN_TOUCH_DISTANCE_TO_SCALE(){return 4/Ma.pixelRatio}#g(e){if(this.#r?.())return;this.#v(e);let t=this.#d;for(let{identifier:n}of e.changedTouches)t.add(n);if(t.size===1)this.#_();else{if(!this.#m){this.#m=new AbortController;let e=AbortSignal.any([this.#u,this.#m.signal]),t=this.#e,n={signal:e,capture:!1,passive:!1};t.addEventListener(`touchmove`,this.#x.bind(this),n);let r=this.#S.bind(this);t.addEventListener(`touchend`,r,n),t.addEventListener(`touchcancel`,r,n),n.capture=!0,t.addEventListener(`pointerdown`,wa,n),t.addEventListener(`pointermove`,wa,n),t.addEventListener(`pointercancel`,io,n),t.addEventListener(`pointerup`,io,n),this.#i?.()}this.#c=oo(e),this.#b(e)}}#_(){if(this.#l)return;let e=this.#l=new AbortController,t=AbortSignal.any([this.#u,e.signal]),n=this.#e,r={capture:!0,signal:t,passive:!1},i=e=>{e.pointerType===`touch`&&(this.#l?.abort(),this.#l=null)};n.addEventListener(`pointerdown`,e=>{e.pointerType===`touch`&&(wa(e),i(e))},r),n.addEventListener(`pointerup`,i,r),n.addEventListener(`pointercancel`,i,r)}#v(e){let t=this.#d;if(t.size===0)return;let n=this.#d=new Set;for(let{identifier:r}of e.touches)t.has(r)&&n.add(r)}#y(e){let t=this.#d,n=[];for(let r of e.touches)t.has(r.identifier)&&n.push(r);return n}#b(e){let t=this.#y(e);if(t.length!==2||this.#n?.()){this.#f=null;return}let[n,r]=t;this.#f={touch0X:n.screenX,touch0Y:n.screenY,touch1X:r.screenX,touch1Y:r.screenY,panX:(n.clientX+r.clientX)/2,panY:(n.clientY+r.clientY)/2,screenPanX:(n.screenX+r.screenX)/2,screenPanY:(n.screenY+r.screenY)/2}}#x(e){if(!this.#f)return;let t=this.#y(e);if(t.length!==2)return;let n=this.#c;if(this.#c=oo(e),!this.#c)return;if(!n){this.#b(e);return}let[r,i]=t,{screenX:a,screenY:o}=r,{screenX:s,screenY:c}=i,l=this.#f,{touch0X:u,touch0Y:d,touch1X:f,touch1Y:p,panX:m,panY:h}=l,g=f-u,_=p-d,v=s-a,y=c-o,b=(r.clientX+i.clientX)/2,x=(r.clientY+i.clientY)/2;l.panX=b,l.panY=x;let S=b-m,C=x-h,w=(a+s)/2,T=(o+c)/2,E=Math.hypot(w-l.screenPanX,T-l.screenPanY);l.screenPanX=w,l.screenPanY=T;let D=Math.hypot(v,y),O=Math.hypot(g,_),k=this.#t?this.MIN_TOUCH_DISTANCE_TO_SCALE:this.MIN_TOUCH_DISTANCE_TO_PINCH+2*E;if(D<ao||O<ao||Math.abs(O-D)<=k){(S||C)&&this.#s?.(S,C);return}l.touch0X=a,l.touch0Y=o,l.touch1X=s,l.touch1Y=c;let A=Math.sign(D-O);if(!this.#t)this.#t=!0,this.#h=A,(S||C)&&this.#s?.(S,C);else{if(this.#h){let e=this.#h;if(this.#h=0,A!==e&&Math.abs(D-O)<=2*E){this.#t=!1,(S||C)&&this.#s?.(S,C);return}}this.#a?.([m,h],O,D,S,C)}}#S(e){if(this.#v(e),this.#d.size>=2){this.#b(e);return}let t=!!this.#f;this.#C(),this.#d.size===1&&this.#_(),t&&oo(e)}#C(){this.#f=null,this.#t=!1,this.#h=0,this.#c=!1,this.#m&&(this.#m.abort(),this.#m=null,this.#o?.())}destroy(){this.#C(),this.#d.clear(),this.#p?.abort(),this.#p=null,this.#l?.abort(),this.#l=null}},co=class e{#e=null;#t=null;#n=null;#r=null;#i=null;#a=!1;#o=null;#s=``;#c=null;#l=null;#u=null;#d=null;#f=null;#p=``;#m=!1;#h=null;#g=!1;#_=!1;#v=!1;#y=null;#b=0;#x=0;#S=null;#C=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;#w=!1;#T=e._zIndex++;static _borderLineWidth=-1;static _colorManager=new eo;static _zIndex=1;static _telemetryTimeout=1e3;static get _resizerKeyboardManager(){let t=e.prototype._resizeWithKeyboard,n=to.TRANSLATE_SMALL,r=to.TRANSLATE_BIG;return H(this,`_resizerKeyboardManager`,new $a([[[`ArrowLeft`],t,{args:[-n,0]}],[[`ctrl+ArrowLeft`,`mac+shift+ArrowLeft`],t,{args:[-r,0]}],[[`ArrowRight`],t,{args:[n,0]}],[[`ctrl+ArrowRight`,`mac+shift+ArrowRight`],t,{args:[r,0]}],[[`ArrowUp`],t,{args:[0,-n]}],[[`ctrl+ArrowUp`,`mac+shift+ArrowUp`],t,{args:[0,-r]}],[[`ArrowDown`],t,{args:[0,n]}],[[`ctrl+ArrowDown`,`mac+shift+ArrowDown`],t,{args:[0,r]}],[[`Escape`],e.prototype._stopResizingWithKeyboard]]))}constructor(e){this.parent=e.parent,this.id=e.id,this.width=this.height=null,this.pageIndex=e.parent.pageIndex,this.name=e.name,this.div=null,this._uiManager=e.uiManager,this.annotationElementId=null,this._willKeepAspectRatio=!1,this._initialOptions.isCentered=e.isCentered,this._structTreeParentId=null,this.annotationElementId=e.annotationElementId||null,this.creationDate=e.creationDate||new Date,this.modificationDate=e.modificationDate||null,this.canAddComment=!0;let{rotation:t,rawDims:{pageWidth:n,pageHeight:r,pageX:i,pageY:a}}=this.parent.viewport;this.rotation=t,this.pageRotation=(360+t-this._uiManager.viewParameters.rotation)%360,this.pageDimensions=[n,r],this.pageTranslation=[i,a];let[o,s]=this.parentDimensions;this.x=e.x/o,this.y=e.y/s,this.isAttachedToDOM=!1,this.deleted=!1}updatePageIndex(e){this.pageIndex=e}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 H(this,`_defaultLineColor`,this._colorManager.getHexCode(`CanvasText`))}static deleteAnnotationElement(e){let t=new lo({id:e._uiManager.getId(),parent:e.parent,uiManager:e._uiManager});t.annotationElementId=e.annotationElementId,t.deleted=!0,t._uiManager.addToAnnotationStorage(t)}static initialize(t,n){if(e._l10n??=t,e._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`}),e._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`}),e._borderLineWidth!==-1)return;let r=getComputedStyle(document.documentElement);e._borderLineWidth=parseFloat(r.getPropertyValue(`--outline-width`))||0}static updateDefaultParams(e,t){}static get defaultPropertiesToUpdate(){return[]}static isHandlingMimeForPasting(e){return!1}static paste(e,t){Ii(`Not implemented`)}get propertiesToUpdate(){return[]}get _isDraggable(){return this.#w}set _isDraggable(e){this.#w=e,this.div?.classList.toggle(`draggable`,e)}get uid(){return this.annotationElementId||this.id}get isEnterHandled(){return!0}center(){let[e,t]=this.pageDimensions;switch(this.parentRotation){case 90:this.x-=this.height*t/(e*2),this.y+=this.width*e/(t*2);break;case 180:this.x+=this.width/2,this.y+=this.height/2;break;case 270:this.x+=this.height*t/(e*2),this.y-=this.width*e/(t*2);break;default:this.x-=this.width/2,this.y-=this.height/2}this.fixAndSetPosition()}addCommands(e){this._uiManager.addCommands(e)}get currentLayer(){return this._uiManager.currentLayer}setInBackground(){this.div.style.zIndex=0}setInForeground(){this.div.style.zIndex=this.#T}setParent(e){e===null?(this.#G(),this.#d?.remove(),this.#d=null):(this.pageIndex=e.pageIndex,this.pageDimensions=e.pageDimensions),this.parent=e}focusin(e){this._focusEventsAllowed&&(this.#m?this.#m=!1:this.parent.setSelected(this))}focusout(e){this._focusEventsAllowed&&this.isAttachedToDOM&&(e.relatedTarget?.closest(`#${this.id}`)||(e.preventDefault(),this.parent?.isMultipleSelection||this.commitOrRemove()))}commitOrRemove(){this.isEmpty()?this.remove():this.commit()}commit(){this.isInEditMode()&&this.addToAnnotationStorage()}addToAnnotationStorage(){this._uiManager.addToAnnotationStorage(this)}setAt(e,t,n,r){let[i,a]=this.parentDimensions;[n,r]=this.screenToPageTranslation(n,r),this.x=(e+n)/i,this.y=(t+r)/a,this.fixAndSetPosition()}_moveAfterPaste(e,t){if(this.isClone){delete this.isClone;return}let[n,r]=this.parentDimensions;this.setAt(e*n,t*r,this.width*n,this.height*r),this._onTranslated()}#E([e,t],n,r){[n,r]=this.screenToPageTranslation(n,r),this.x+=n/e,this.y+=r/t,this._onTranslating(this.x,this.y),this.fixAndSetPosition()}translate(e,t){this.#E(this.parentDimensions,e,t)}translateInPage(e,t){this.#h||=[this.x,this.y,this.width,this.height],this.#E(this.pageDimensions,e,t),this.div.scrollIntoView({block:`nearest`})}translationDone(){this._onTranslated(this.x,this.y)}drag(e,t){this.#h||=[this.x,this.y,this.width,this.height];let{div:n,parentDimensions:[r,i]}=this;if(this.x+=e/r,this.y+=t/i,this.parent&&(this.x<0||this.x>1||this.y<0||this.y>1)){let{x:e,y:t}=this.div.getBoundingClientRect();this.parent.findNewParent(this,e,t)&&(this.x-=Math.floor(this.x),this.y-=Math.floor(this.y))}let{x:a,y:o}=this,[s,c]=this.getBaseTranslation();a+=s,o+=c;let{style:l}=n;l.left=`${(100*a).toFixed(2)}%`,l.top=`${(100*o).toFixed(2)}%`,this._onTranslating(a,o)}_onTranslating(e,t){}_onTranslated(e,t){}get _hasBeenMoved(){return!!this.#h&&(this.#h[0]!==this.x||this.#h[1]!==this.y)}get _hasBeenResized(){return!!this.#h&&(this.#h[2]!==this.width||this.#h[3]!==this.height)}getBaseTranslation(){let[t,n]=this.parentDimensions,{_borderLineWidth:r}=e,i=r/t,a=r/n;switch(this.rotation){case 90:return[-i,a];case 180:return[i,a];case 270:return[i,-a];default:return[-i,-a]}}get _mustFixPosition(){return!0}fixAndSetPosition(e=this.rotation){let{div:{style:t},pageDimensions:[n,r]}=this,{x:i,y:a,width:o,height:s}=this;if(o*=n,s*=r,i*=n,a*=r,this._mustFixPosition)switch(e){case 0:i=ca(i,0,n-o),a=ca(a,0,r-s);break;case 90:i=ca(i,0,n-s),a=ca(a,o,r);break;case 180:i=ca(i,o,n),a=ca(a,s,r);break;case 270:i=ca(i,s,n),a=ca(a,0,r-o)}this.x=i/=n,this.y=a/=r;let[c,l]=this.getBaseTranslation();i+=c,a+=l,t.left=`${(100*i).toFixed(2)}%`,t.top=`${(100*a).toFixed(2)}%`,this.moveInDOM()}static#D(e,t,n){switch(n){case 90:return[t,-e];case 180:return[-e,-t];case 270:return[-t,e];default:return[e,t]}}screenToPageTranslation(t,n){return e.#D(t,n,this.parentRotation)}pageTranslationToScreen(t,n){return e.#D(t,n,360-this.parentRotation)}#O(e){switch(e){case 90:{let[e,t]=this.pageDimensions;return[0,-e/t,t/e,0]}case 180:return[-1,0,0,-1];case 270:{let[e,t]=this.pageDimensions;return[0,e/t,-t/e,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:e,pageDimensions:[t,n]}=this;return[t*e,n*e]}setDims(){let{div:{style:e},width:t,height:n}=this;e.width=`${(100*t).toFixed(2)}%`,e.height=`${(100*n).toFixed(2)}%`}getInitialTranslation(){return[0,0]}#k(){if(this.#c)return;this.#c=document.createElement(`div`),this.#c.classList.add(`resizers`);let e=this._willKeepAspectRatio?[`topLeft`,`topRight`,`bottomRight`,`bottomLeft`]:[`topLeft`,`topMiddle`,`topRight`,`middleRight`,`bottomRight`,`bottomMiddle`,`bottomLeft`,`middleLeft`],t=this._uiManager._signal;for(let n of e){let e=document.createElement(`div`);this.#c.append(e),e.classList.add(`resizer`,n),e.setAttribute(`data-resizer-name`,n),e.addEventListener(`pointerdown`,this.#A.bind(this,n),{signal:t}),e.addEventListener(`contextmenu`,Ca,{signal:t}),e.tabIndex=-1}this.div.prepend(this.#c)}#A(e,t){t.preventDefault();let{isMac:n}=Zi.platform;if(t.button!==0||t.ctrlKey&&n)return;this.#n?.toggle(!1);let r=this._isDraggable;this._isDraggable=!1,this.#l=[t.screenX,t.screenY];let i=new AbortController,a=this._uiManager.combinedSignal(i);this.parent.togglePointerEvents(!1),window.addEventListener(`pointermove`,this.#N.bind(this,e),{passive:!0,capture:!0,signal:a}),window.addEventListener(`touchmove`,wa,{passive:!1,signal:a}),window.addEventListener(`contextmenu`,Ca,{signal:a}),this.#u={savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height};let o=this.parent.div.style.cursor,s=this.div.style.cursor;this.div.style.cursor=this.parent.div.style.cursor=window.getComputedStyle(t.target).cursor;let c=()=>{i.abort(),this.parent.togglePointerEvents(!0),this.#n?.toggle(!0),this._isDraggable=r,this.parent.div.style.cursor=o,this.div.style.cursor=s,this.#M()};window.addEventListener(`pointerup`,c,{signal:a}),window.addEventListener(`blur`,c,{signal:a})}#j(e,t,n,r){this.width=n,this.height=r,this.x=e,this.y=t,this.setDims(),this.fixAndSetPosition(),this._onResized()}_onResized(){}#M(){if(!this.#u)return;let{savedX:e,savedY:t,savedWidth:n,savedHeight:r}=this.#u;this.#u=null;let i=this.x,a=this.y,o=this.width,s=this.height;(i!==e||a!==t||o!==n||s!==r)&&this.addCommands({cmd:this.#j.bind(this,i,a,o,s),undo:this.#j.bind(this,e,t,n,r),mustExec:!0})}static _round(e){return Math.round(e*1e4)/1e4}#N(t,n){let[r,i]=this.parentDimensions,a=this.x,o=this.y,s=this.width,c=this.height,l=e.MIN_SIZE/r,u=e.MIN_SIZE/i,d=this.#O(this.rotation),f=(e,t)=>[d[0]*e+d[2]*t,d[1]*e+d[3]*t],p=this.#O(360-this.rotation),m=(e,t)=>[p[0]*e+p[2]*t,p[1]*e+p[3]*t],h,g,_=!1,v=!1;switch(t){case`topLeft`:_=!0,h=(e,t)=>[0,0],g=(e,t)=>[e,t];break;case`topMiddle`:h=(e,t)=>[e/2,0],g=(e,t)=>[e/2,t];break;case`topRight`:_=!0,h=(e,t)=>[e,0],g=(e,t)=>[0,t];break;case`middleRight`:v=!0,h=(e,t)=>[e,t/2],g=(e,t)=>[0,t/2];break;case`bottomRight`:_=!0,h=(e,t)=>[e,t],g=(e,t)=>[0,0];break;case`bottomMiddle`:h=(e,t)=>[e/2,t],g=(e,t)=>[e/2,0];break;case`bottomLeft`:_=!0,h=(e,t)=>[0,t],g=(e,t)=>[e,0];break;case`middleLeft`:v=!0,h=(e,t)=>[0,t/2],g=(e,t)=>[e,t/2]}let y=h(s,c),b=g(s,c),x=f(...b),S=e._round(a+x[0]),C=e._round(o+x[1]),w=1,T=1,E,D;if(n.fromKeyboard)({deltaX:E,deltaY:D}=n);else{let{screenX:e,screenY:t}=n,[r,i]=this.#l;[E,D]=this.screenToPageTranslation(e-r,t-i),this.#l[0]=e,this.#l[1]=t}if([E,D]=m(E/r,D/i),_){let e=Math.hypot(s,c);w=T=Math.max(Math.min(Math.hypot(b[0]-y[0]-E,b[1]-y[1]-D)/e,1/s,1/c),l/s,u/c)}else v?w=ca(Math.abs(b[0]-y[0]-E),l,1)/s:T=ca(Math.abs(b[1]-y[1]-D),u,1)/c;let O=e._round(s*w),k=e._round(c*T);x=f(...g(O,k));let A=S-x[0],j=C-x[1];this.#h||=[this.x,this.y,this.width,this.height],this.width=O,this.height=k,this.x=A,this.y=j,this.setDims(),this.fixAndSetPosition(),this._onResizing()}_onResizing(){}altTextFinish(){this.#n?.finish()}get toolbarButtons(){return null}async addEditToolbar(){if(this._editToolbar||this.#_)return this._editToolbar;this._editToolbar=new Ga(this),this.div.append(this._editToolbar.render());let{toolbarButtons:e}=this;if(e)for(let[t,n]of e)await this._editToolbar.addButton(t,n);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.#n?.destroy()}addContainer(e){let t=this._editToolbar?.div;t?t.before(e):this.div.append(e)}getClientDimensions(){return this.div.getBoundingClientRect()}createAltText(){return this.#n||(no.initialize(e._l10n),this.#n=new no(this),this.#e&&=(this.#n.data=this.#e,null)),this.#n}get altTextData(){return this.#n?.data}set altTextData(e){this.#n&&(this.#n.data=e)}get guessedAltText(){return this.#n?.guessedText}async setGuessedAltText(e){await this.#n?.setGuessedText(e)}serializeAltText(e){return this.#n?.serialize(e)}hasAltText(){return!!this.#n&&!this.#n.isEmpty()}hasAltTextData(){return this.#n?.hasData()??!1}focusCommentButton(){this.#r?.focusButton()}addCommentButton(){return this.canAddComment?this.#r||=new ro(this):null}addStandaloneCommentButton(){this._uiManager.hasCommentManager()&&(this.#i?this._uiManager.isEditingMode()&&this.#i.classList.remove(`hidden`):this.hasComment&&(this.#i=this.#r.renderForStandalone(),this.div.append(this.#i)))}removeStandaloneCommentButton(){this.#r.removeStandaloneCommentButton(),this.#i=null}hideStandaloneCommentButton(){this.#i?.classList.add(`hidden`)}get comment(){if(!this.#r)return null;let{data:{richText:e,text:t,date:n,deleted:r}}=this.#r;return{text:t,richText:e,date:n,deleted:r,color:this.getNonHCMColor(),opacity:this.opacity??1}}set comment(e){this.#r||=new ro(this),typeof e==`object`&&e?this.#r.restoreData(e):this.#r.data=e,this.hasComment?(this.removeCommentButtonFromToolbar(),this.addStandaloneCommentButton(),this._uiManager.updateComment(this)):(this.addCommentButtonInToolbar(),this.removeStandaloneCommentButton(),this._uiManager.removeComment(this))}setCommentData({comment:e,popupRef:t,richText:n}){if(!t||(this.#r||=new ro(this),this.#r.setInitialText(e,n),!this.annotationElementId))return;let r=this._uiManager.getAndRemoveDataFromAnnotationStorage(this.annotationElementId);r&&this.updateFromAnnotationLayer(r)}get hasEditedComment(){return this.#r?.hasBeenEdited()}get hasDeletedComment(){return this.#r?.isDeleted()}get hasComment(){return!!this.#r&&!this.#r.isEmpty()&&!this.#r.isDeleted()}async editComment(e){this.#r||=new ro(this),this.#r.edit(e)}toggleComment(e,t=void 0){this.hasComment&&this._uiManager.toggleComment(this,e,t)}setSelectedCommentButton(e){this.#r.setSelectedButton(e)}addComment(e){if(this.hasEditedComment){let[,,,t]=e.rect,[n]=this.pageDimensions,[r]=this.pageTranslation,i=r+n+1,a=t-100,o=i+180;e.popup={contents:this.comment.text,deleted:this.comment.deleted,rect:[i,a,o,t]}}}updateFromAnnotationLayer({popup:{contents:e,deleted:t}}){this.#r.data=t?null:e}get parentBoundingClientRect(){return this.parent.boundingClientRect}render(){let e=this.div=document.createElement(`div`);e.setAttribute(`data-editor-rotation`,(360-this.rotation)%360),e.className=this.name,e.setAttribute(`id`,this.id),e.tabIndex=this.#a?-1:0,e.setAttribute(`role`,`application`),this.defaultL10nId&&e.setAttribute(`data-l10n-id`,this.defaultL10nId),this._isVisible||e.classList.add(`hidden`),this.setInForeground(),this.#z();let[t,n]=this.parentDimensions;this.parentRotation%180!=0&&(e.style.maxWidth=`${(100*n/t).toFixed(2)}%`,e.style.maxHeight=`${(100*t/n).toFixed(2)}%`);let[r,i]=this.getInitialTranslation();return this.translate(r,i),Ja(this,e,[`keydown`,`pointerdown`,`dblclick`]),this.#B(),this.addStandaloneCommentButton(),this._uiManager._editorUndoBar?.hide(),e}#P(){this.#u={savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height},this.#n?.toggle(!1),this.parent.togglePointerEvents(!1)}#F(t,n,r){let i=.7,a=r/n*i+1-i;if(a===1)return;let o=this.#O(this.rotation),s=(e,t)=>[o[0]*e+o[2]*t,o[1]*e+o[3]*t],[c,l]=this.parentDimensions,u=this.x,d=this.y,f=this.width,p=this.height,m=e.MIN_SIZE/c,h=e.MIN_SIZE/l;a=Math.max(Math.min(a,1/f,1/p),m/f,h/p);let g=e._round(f*a),_=e._round(p*a);if(g===f&&_===p)return;this.#h||=[u,d,f,p];let v=s(f/2,p/2),y=e._round(u+v[0]),b=e._round(d+v[1]),x=s(g/2,_/2);this.x=y-x[0],this.y=b-x[1],this.width=g,this.height=_,this.setDims(),this.fixAndSetPosition(),this._onResizing()}#I(){this.#n?.toggle(!0),this.parent.togglePointerEvents(!0),this.#M()}pointerdown(e){let{isMac:t}=Zi.platform;e.button!==0||e.ctrlKey&&t?e.preventDefault():(this.#m=!0,this._isDraggable?this.#R(e):this.#L(e))}#L(e){let{isMac:t}=Zi.platform;e.ctrlKey&&!t||e.shiftKey||e.metaKey&&t?this.parent.toggleSelected(this):this.parent.setSelected(this)}#R(e){let{isSelected:t}=this;this._uiManager.setUpDragSession();let n=!1,r=new AbortController,i=this._uiManager.combinedSignal(r),a={capture:!0,passive:!1,signal:i},o=e=>{r.abort(),this.#o=null,this.#m=!1,this._uiManager.endDragSession()||this.#L(e),n&&this._onStopDragging()};t&&(this.#b=e.clientX,this.#x=e.clientY,this.#o=e.pointerId,this.#s=e.pointerType,window.addEventListener(`pointermove`,e=>{n||(n=!0,this._uiManager.toggleComment(this,!0,!1),this._onStartDragging());let{clientX:t,clientY:r,pointerId:i}=e;if(i!==this.#o){wa(e);return}let[a,o]=this.screenToPageTranslation(t-this.#b,r-this.#x);this.#b=t,this.#x=r,this._uiManager.dragSelectedEditors(a,o),this.div.scrollIntoView({block:`nearest`})},a),window.addEventListener(`touchmove`,wa,a),window.addEventListener(`pointerdown`,e=>{e.pointerType===this.#s&&(this.#C||e.isPrimary)&&o(e),wa(e)},a));let s=e=>{!this.#o||this.#o===e.pointerId?o(e):wa(e)};window.addEventListener(`pointerup`,s,{signal:i}),window.addEventListener(`blur`,s,{signal:i})}_onStartDragging(){}_onStopDragging(){}moveInDOM(){this.#y&&clearTimeout(this.#y),this.#y=setTimeout(()=>{this.#y=null,this.parent?.moveEditorInDOM(this)},0)}_setParentAndPosition(e,t,n){e.changeParent(this),this.x=t,this.y=n,this.fixAndSetPosition(),this._onTranslated()}getRect(e,t,n=this.rotation){let r=this.parentScale,[i,a]=this.pageDimensions,[o,s]=this.pageTranslation,c=e/r,l=t/r,u=this.x*i,d=this.y*a,f=this.width*i,p=this.height*a;switch(n){case 0:return[u+c+o,a-d-l-p+s,u+c+f+o,a-d-l+s];case 90:return[u+l+o,a-d+c+s,u+l+p+o,a-d+c+f+s];case 180:return[u-c-f+o,a-d+l+s,u-c+o,a-d+l+p+s];case 270:return[u-l-p+o,a-d-c-f+s,u-l+o,a-d-c+s];default:throw Error(`Invalid rotation`)}}getRectInCurrentCoords(e,t){let[n,r,i,a]=e,o=i-n,s=a-r;switch(this.rotation){case 0:return[n,t-a,o,s];case 90:return[n,t-r,s,o];case 180:return[i,t-r,o,s];case 270:return[i,t-a,s,o];default:throw Error(`Invalid rotation`)}}getPDFRect(){return this.getRect(0,0)}getNonHCMColor(){return this.color&&e._colorManager.convert(this._uiManager.getNonHCMColor(this.color))}onUpdatedColor(){this.#r?.onUpdatedColor()}getData(){let{comment:{text:e,color:t,date:n,opacity:r,deleted:i,richText:a},uid:o,pageIndex:s,creationDate:c,modificationDate:l}=this;return{id:o,pageIndex:s,rect:this.getPDFRect(),richText:a,contentsObj:{str:e},creationDate:c,modificationDate:n||l,popupRef:!i,color:t,opacity:r}}onceAdded(e){}isEmpty(){return!1}enableEditMode(){return!this.isInEditMode()&&(this.parent.setEditingState(!1),this.#_=!0,!0)}disableEditMode(){return this.isInEditMode()?(this.parent.setEditingState(!0),this.#_=!1,!0):!1}isInEditMode(){return this.#_}shouldGetKeyboardEvents(){return this.#v}needsToBeRebuilt(){return this.div&&!this.isAttachedToDOM}get isOnScreen(){let{top:e,left:t,bottom:n,right:r}=this.getClientDimensions(),{innerHeight:i,innerWidth:a}=window;return t<a&&r>0&&e<i&&n>0}#z(){if(this.#f||!this.div)return;this.#f=new AbortController;let e=this._uiManager.combinedSignal(this.#f);this.div.addEventListener(`focusin`,this.focusin.bind(this),{signal:e}),this.div.addEventListener(`focusout`,this.focusout.bind(this),{signal:e})}#B(){this.#C||!this.div||!this.isResizable||!this._uiManager._supportsPinchToZoom||(this.#C=new so({container:this.div,isPinchingDisabled:()=>!this.isSelected,onPinchStart:this.#P.bind(this),onPinching:this.#F.bind(this),onPinchEnd:this.#I.bind(this),signal:this._uiManager._signal}))}rebuild(){this.#z(),this.#B()}rotate(e){}resize(){}serializeDeleted(){return{id:this.annotationElementId,deleted:!0,pageIndex:this.pageIndex,popupRef:this._initialData?.popupRef||``}}serialize(e=!1,t=null){return{annotationType:this.mode,pageIndex:this.pageIndex,rect:this.getPDFRect(),rotation:this.rotation,structTreeParentId:this._structTreeParentId,popupRef:this._initialData?.popupRef||``}}static async deserialize(e,t,n){let r=new this.prototype.constructor({parent:t,id:n.getId(),uiManager:n,annotationElementId:e.annotationElementId,creationDate:e.creationDate,modificationDate:e.modificationDate});r.rotation=e.rotation,r.#e=e.accessibilityData,r._isCopy=e.isCopy||!1;let[i,a]=r.pageDimensions,[o,s,c,l]=r.getRectInCurrentCoords(e.rect,a);return r.x=o/i,r.y=s/a,r.width=c/i,r.height=l/a,r}get hasBeenModified(){return!!this.annotationElementId&&(this.deleted||this.serialize()!==null)}remove(){if(this.#f?.abort(),this.#f=null,this.isEmpty()||this.commit(),this.#C?.destroy(),this.#C=null,this.parent?this.parent.remove(this):this._uiManager.removeEditor(this),this.hideCommentPopup(),this.#y&&=(clearTimeout(this.#y),null),this.#G(),this.removeEditToolbar(),this.#S){for(let e of this.#S.values())clearTimeout(e);this.#S=null}this.parent=null,this.#d?.remove(),this.#d=null}get isResizable(){return!1}makeResizable(){this.isResizable&&(this.#k(),this.#c.classList.remove(`hidden`))}get toolbarPosition(){return null}get commentButtonPosition(){return this._uiManager.direction===`ltr`?[1,0]:[0,0]}get commentButtonPositionInPage(){let{commentButtonPosition:[t,n]}=this,[r,i,a,o]=this.getPDFRect();return[e._round(r+(a-r)*t),e._round(i+(o-i)*(1-n))]}get commentButtonColor(){return this._uiManager.makeCommentColor(this.getNonHCMColor(),this.opacity)}get commentPopupPosition(){return this.#r.commentPopupPositionInLayer}set commentPopupPosition(e){this.#r.commentPopupPositionInLayer=e}hasDefaultPopupPosition(){return this.#r.hasDefaultPopupPosition()}get commentButtonWidth(){return this.#r.commentButtonWidth}get elementBeforePopup(){return this.div}setCommentButtonStates(e){this.#r?.setCommentButtonStates(e)}keydown(t){if(!this.isResizable||t.target!==this.div||t.key!==`Enter`)return;this._uiManager.setSelected(this),this.#u={savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height};let n=this.#c.children;if(!this.#t){this.#t=Array.from(n);let t=this.#V.bind(this),r=this.#H.bind(this),i=this._uiManager._signal;for(let n of this.#t){let a=n.getAttribute(`data-resizer-name`);n.setAttribute(`role`,`spinbutton`),n.addEventListener(`keydown`,t,{signal:i}),n.addEventListener(`blur`,r,{signal:i}),n.addEventListener(`focus`,this.#U.bind(this,a),{signal:i}),n.setAttribute(`data-l10n-id`,e._l10nResizer[a])}}let r=this.#t[0],i=0;for(let e of n){if(e===r)break;i++}let a=(360-this.rotation+this.parentRotation)%360/90*(this.#t.length/4);if(a!==i){if(a<i)for(let e=0;e<i-a;e++)this.#c.append(this.#c.firstElementChild);else if(a>i)for(let e=0;e<a-i;e++)this.#c.firstElementChild.before(this.#c.lastElementChild);let t=0;for(let r of n){let n=this.#t[t++].getAttribute(`data-resizer-name`);r.setAttribute(`data-l10n-id`,e._l10nResizer[n])}}this.#W(0),this.#v=!0,this.#c.firstElementChild.focus({focusVisible:!0}),t.preventDefault(),t.stopImmediatePropagation()}#V(t){e._resizerKeyboardManager.exec(this,t)}#H(e){this.#v&&e.relatedTarget?.parentNode!==this.#c&&this.#G()}#U(e){this.#p=this.#v?e:``}#W(e){if(this.#t)for(let t of this.#t)t.tabIndex=e}_resizeWithKeyboard(e,t){this.#v&&this.#N(this.#p,{deltaX:e,deltaY:t,fromKeyboard:!0})}#G(){this.#v=!1,this.#W(-1),this.#M()}_stopResizingWithKeyboard(){this.#G(),this.div.focus()}select(){this.isSelected&&this._editToolbar?this._editToolbar.show():(this.isSelected=!0,this.makeResizable(),this.div?.classList.add(`selectedEditor`),this._editToolbar?(this._editToolbar?.show(),this.#n?.toggleAltTextBadge(!1)):this.addEditToolbar().then(()=>{this.div?.classList.contains(`selectedEditor`)&&this._editToolbar?.show()}))}focus(){this.div&&!this.div.contains(document.activeElement)&&setTimeout(()=>this.div?.focus({preventScroll:!0}),0)}unselect(){this.isSelected&&(this.isSelected=!1,this.#c?.classList.add(`hidden`),this.div?.classList.remove(`selectedEditor`),this.div?.contains(document.activeElement)&&this._uiManager.currentLayer.div.focus({preventScroll:!0}),this._editToolbar?.hide(),this.#n?.toggleAltTextBadge(!0),this.hideCommentPopup())}hideCommentPopup(){this.hasComment&&this._uiManager.toggleComment(null)}updateParams(e,t){}disableEditing(){}enableEditing(){}get canChangeContent(){return!1}enterInEditMode(){this.canChangeContent&&(this.enableEditMode(),this.div.focus())}dblclick(e){e.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.#g}set isEditing(e){this.#g=e,this.parent&&(e?(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(t,n=!1){if(n){this.#S||=new Map;let{action:n}=t,r=this.#S.get(n);r&&clearTimeout(r),r=setTimeout(()=>{this._reportTelemetry(t),this.#S.delete(n),this.#S.size===0&&(this.#S=null)},e._telemetryTimeout),this.#S.set(n,r)}else t.type||=this.editorType,this._uiManager._eventBus.dispatch(`reporttelemetry`,{source:this,details:{type:`editing`,data:t}})}show(e=this._isVisible){this.div.classList.toggle(`hidden`,!e),this._isVisible=e}enable(){this.div&&(this.div.tabIndex=0),this.#a=!1}disable(){this.div&&(this.div.tabIndex=-1),this.#a=!0}updateFakeAnnotationElement(e){!this.#d&&!this.deleted?this.#d=e.addFakeAnnotation(this):this.deleted?(this.#d.remove(),this.#d=null):(this.hasEditedComment||this._hasBeenMoved||this._hasBeenResized)&&this.#d.updateEdited({rect:this.getPDFRect(),popup:this.comment})}renderAnnotationElement(e){if(this.deleted)return e.hide(),null;let t=e.container.querySelector(`.annotationContent`);if(!t)t=document.createElement(`div`),t.classList.add(`annotationContent`,this.editorType),e.container.prepend(t);else if(t.nodeName===`CANVAS`){let e=t;t=document.createElement(`div`),t.classList.add(`annotationContent`,this.editorType),e.before(t)}return t}resetAnnotationElement(e){let{firstElementChild:t}=e.container;t?.nodeName===`DIV`&&t.classList.contains(`annotationContent`)&&t.remove()}},lo=class extends co{constructor(e){super(e),this.annotationElementId=e.annotationElementId,this.deleted=!0}serialize(){return this.serializeDeleted()}},uo=3285377520,fo=4294901760,po=65535,mo=class{constructor(e){this.h1=e?e|0:uo,this.h2=e?e|0:uo}update(e){let t,n;if(typeof e==`string`){t=new Uint8Array(e.length*2),n=0;for(let r=0,i=e.length;r<i;r++){let i=e.charCodeAt(r);i<=255?t[n++]=i:(t[n++]=i>>>8,t[n++]=i&255)}}else if(ArrayBuffer.isView(e))t=e.slice(),n=t.byteLength;else throw Error(`Invalid data format, must be a string or TypedArray.`);let r=n>>2,i=n-r*4,a=new Uint32Array(t.buffer,0,r),o=0,s=0,c=this.h1,l=this.h2,u=3432918353,d=461845907,f=11601,p=13715;for(let e=0;e<r;e++)e&1?(o=a[e],o=o*u&fo|o*f&po,o=o<<15|o>>>17,o=o*d&fo|o*p&po,c^=o,c=c<<13|c>>>19,c=c*5+3864292196):(s=a[e],s=s*u&fo|s*f&po,s=s<<15|s>>>17,s=s*d&fo|s*p&po,l^=s,l=l<<13|l>>>19,l=l*5+3864292196);switch(o=0,i){case 3:o^=t[r*4+2]<<16;case 2:o^=t[r*4+1]<<8;case 1:o^=t[r*4],o=o*u&fo|o*f&po,o=o<<15|o>>>17,o=o*d&fo|o*p&po,r&1?c^=o:l^=o}this.h1=c,this.h2=l}hexdigest(){let e=this.h1,t=this.h2;return e^=t>>>1,e=e*3981806797&fo|e*36045&po,t=t*4283543511&fo|((t<<16|e>>>16)*2950163797&fo)>>>16,e^=t>>>1,e=e*444984403&fo|e*60499&po,t=t*3301882366&fo|((t<<16|e>>>16)*3120437893&fo)>>>16,e^=t>>>1,(e>>>0).toString(16).padStart(8,`0`)+(t>>>0).toString(16).padStart(8,`0`)}},ho=Object.freeze({map:null,hash:``,transfer:void 0}),go=class{#e=!1;#t=null;#n=null;#r=new Map;onSetModified=null;onResetModified=null;onAnnotationEditor=null;getValue(e,t){let n=this.#r.get(e);return n===void 0?t:Object.assign(t,n)}getRawValue(e){return this.#r.get(e)}remove(e){let t=this.#r.get(e);t!==void 0&&(t instanceof co&&this.#n.delete(t.annotationElementId),this.#r.delete(e),this.#r.size===0&&this.resetModified(),!this.#r.values().some(e=>e instanceof co)&&this.onAnnotationEditor?.(null))}setValue(e,t){let n=this.#r.get(e),r=!1;if(n!==void 0)for(let[e,i]of Object.entries(t))n[e]!==i&&(r=!0,n[e]=i);else r=!0,this.#r.set(e,t);r&&this.#i(),t instanceof co&&((this.#n||=new Map).set(t.annotationElementId,t),this.onAnnotationEditor?.(t.constructor._type))}has(e){return this.#r.has(e)}get size(){return this.#r.size}#i(){this.#e||(this.#e=!0,this.onSetModified?.())}resetModified(){this.#e&&(this.#e=!1,this.onResetModified?.())}get print(){return new _o(this)}get serializable(){if(this.#r.size===0)return ho;let e=new Map,t=new mo,n=[],r=Object.create(null),i=!1;for(let[n,a]of this.#r){let o=a instanceof co?a.serialize(!1,r):a;a.page&&(a.pageIndex=a.page._pageIndex,delete a.page),o&&(e.set(n,o),t.update(`${n}:${JSON.stringify(o)}`),i||=!!o.bitmap)}if(i)for(let t of e.values())t.bitmap&&n.push(t.bitmap);return e.size>0?{map:e,hash:t.hexdigest(),transfer:n}:ho}get editorStats(){let e=null,t=new Map,n=0,r=0;for(let i of this.#r.values()){if(!(i instanceof co)){i.popup&&(i.popup.deleted?r+=1:n+=1);continue}i.isCommentDeleted?r+=1:i.hasEditedComment&&(n+=1);let a=i.telemetryFinalData;if(!a)continue;let{type:o}=a;t.getOrInsertComputed(o,()=>Object.getPrototypeOf(i).constructor),e||=Object.create(null);let s=e[o]||=new Map;for(let[e,t]of Object.entries(a)){if(e===`type`)continue;let n=s.getOrInsertComputed(e,aa);n.set(t,(n.get(t)??0)+1)}}if((r>0||n>0)&&(e||=Object.create(null),e.comments={deleted:r,edited:n}),!e)return null;for(let[n,r]of t)e[n]=r.computeTelemetryFinalData(e[n]);return e}resetModifiedIds(){this.#t=null}updateEditor(e,t){let n=this.#n?.get(e);return n?(n.updateFromAnnotationLayer(t),!0):!1}getEditor(e){return this.#n?.get(e)||null}get modifiedIds(){if(this.#t)return this.#t;let e=[];if(this.#n)for(let t of this.#n.values())t.serialize()&&e.push(t.annotationElementId);let t=``;if(e.length){let n=new mo;n.update(e.join(`,`)),t=n.hexdigest()}return this.#t={ids:new Set(e),hash:t}}[Symbol.iterator](){return this.#r.entries()}},_o=class extends go{#e=ho;constructor(e){super();let{serializable:t}=e;if(t===ho)return;let{map:n,hash:r,transfer:i}=t,a=structuredClone(n,i?{transfer:i}:null);this.#e={map:a,hash:r,transfer:[]}}get print(){Ii(`Should not call PrintAnnotationStorage.print`)}get serializable(){return this.#e}get modifiedIds(){return H(this,`modifiedIds`,{ids:new Set,hash:``})}};Lr();var vo=`__forcedDependency`,{floor:yo,ceil:bo}=Math;function xo(e,t,n,r,i,a){e[t*4+0]=Math.min(e[t*4+0],n),e[t*4+1]=Math.min(e[t*4+1],r),e[t*4+2]=Math.max(e[t*4+2],i),e[t*4+3]=Math.max(e[t*4+3],a)}function So(e,t,n,r,i){let a;e?(e<0&&(a=i[0],i[0]=i[2],i[2]=a),i[0]*=e,i[2]*=e,t<0&&(a=i[1],i[1]=i[3],i[3]=a),i[1]*=t,i[3]*=t):i.fill(0),i[0]+=n,i[1]+=r,i[2]+=n,i[3]+=r}var Co=new Uint32Array(new Uint8Array([255,255,0,0]).buffer)[0],wo=class{#e;#t;constructor(e,t){this.#e=e,this.#t=t}get length(){return this.#e.length}isEmpty(e){return this.#e[e]===Co}minX(e){return this.#t[e*4+0]/256}minY(e){return this.#t[e*4+1]/256}maxX(e){return(this.#t[e*4+2]+1)/256}maxY(e){return(this.#t[e*4+3]+1)/256}},To=(e,t)=>e?.getOrInsertComputed(t,()=>({dependencies:new Set,isRenderingOperation:!1})),Eo=class{#e=[[1,0,0,1,0,0]];#t=[-1/0,-1/0,1/0,1/0];#n=new Float64Array(fi);_pendingBBoxIdx=-1;#r;#i;#a;#o;_savesStack=[];_markedContentStack=[];constructor(e,t){this.#r=e.width,this.#i=e.height,this.#s(t)}growOperationsCount(e){e>=this.#o.length&&this.#s(e,this.#o)}#s(e,t){let n=new ArrayBuffer(e*4);this.#a=new Uint8ClampedArray(n),this.#o=new Uint32Array(n),t&&t.length>0?(this.#o.set(t),this.#o.fill(Co,t.length)):this.#o.fill(Co)}get clipBox(){return this.#t}save(e){return this.#t={__proto__:this.#t},this._savesStack.push(e),this}restore(e,t){let n=Object.getPrototypeOf(this.#t);if(n===null)return this;this.#t=n;let r=this._savesStack.pop();return r!==void 0&&(t?.(r,e),this.#o[e]=this.#o[r]),this}recordOpenMarker(e){return this._savesStack.push(e),this}getOpenMarker(){return this._savesStack.length===0?null:this._savesStack.at(-1)}recordCloseMarker(e,t){let n=this._savesStack.pop();return n!==void 0&&(t?.(n,e),this.#o[e]=this.#o[n]),this}beginMarkedContent(e){return this._markedContentStack.push(e),this}endMarkedContent(e,t){let n=this._markedContentStack.pop();return n!==void 0&&(t?.(n,e),this.#o[e]=this.#o[n]),this}pushBaseTransform(e){return this.#e.push(U.multiplyByDOMMatrix(this.#e.at(-1),e.getTransform())),this}popBaseTransform(){return this.#e.length>1&&this.#e.pop(),this}resetBBox(e){return this._pendingBBoxIdx!==e&&(this._pendingBBoxIdx=e,this.#n.set(fi,0)),this}recordClipBox(e,t,n,r,i,a){let o=U.multiplyByDOMMatrix(this.#e.at(-1),t.getTransform()),s=fi.slice();U.axialAlignedBoundingBox([n,i,r,a],o,s);let c=U.intersect(this.#t,s);return c?(this.#t[0]=c[0],this.#t[1]=c[1],this.#t[2]=c[2],this.#t[3]=c[3]):(this.#t[0]=this.#t[1]=1/0,this.#t[2]=this.#t[3]=-1/0),this}recordBBox(e,t,n,r,i,a){let o=this.#t;if(o[0]===1/0)return this;let s=U.multiplyByDOMMatrix(this.#e.at(-1),t.getTransform());if(o[0]===-1/0)return U.axialAlignedBoundingBox([n,i,r,a],s,this.#n),this;let c=fi.slice();return U.axialAlignedBoundingBox([n,i,r,a],s,c),this.#n[0]=ca(c[0],o[0],this.#n[0]),this.#n[1]=ca(c[1],o[1],this.#n[1]),this.#n[2]=ca(c[2],this.#n[2],o[2]),this.#n[3]=ca(c[3],this.#n[3],o[3]),this}recordFullPageBBox(e){return this.#n[0]=Math.max(0,this.#t[0]),this.#n[1]=Math.max(0,this.#t[1]),this.#n[2]=Math.min(this.#r,this.#t[2]),this.#n[3]=Math.min(this.#i,this.#t[3]),this}recordOperation(e,t=!1,n){if(this._pendingBBoxIdx!==e)return this;let r=yo(this.#n[0]*256/this.#r),i=yo(this.#n[1]*256/this.#i),a=bo(this.#n[2]*256/this.#r),o=bo(this.#n[3]*256/this.#i);if(xo(this.#a,e,r,i,a,o),n)for(let t of n)for(let n of t)n!==e&&xo(this.#a,n,r,i,a,o);return t||(this._pendingBBoxIdx=-1),this}bboxToClipBoxDropOperation(e){return this._pendingBBoxIdx===e&&(this._pendingBBoxIdx=-1,this.#t[0]=Math.max(this.#t[0],this.#n[0]),this.#t[1]=Math.max(this.#t[1],this.#n[1]),this.#t[2]=Math.min(this.#t[2],this.#n[2]),this.#t[3]=Math.min(this.#t[3],this.#n[3])),this}take(){return new wo(this.#o,this.#a)}takeDebugMetadata(){throw Error(`Unreachable`)}recordSimpleData(e,t){return this}recordIncrementalData(e,t){return this}resetIncrementalData(e,t){return this}recordNamedData(e,t){return this}recordSimpleDataFromNamed(e,t,n){return this}recordFutureForcedDependency(e,t){return this}inheritSimpleDataAsFutureForcedDependencies(e){return this}inheritPendingDependenciesAsFutureForcedDependencies(){return this}recordCharacterBBox(e,t,n,r=1,i=0,a=0,o){return this}getSimpleIndex(e){}recordDependencies(e,t){return this}recordNamedDependency(e,t){return this}recordShowTextOperation(e,t=!1){return this}},Do=class{#e={__proto__:null};#t={__proto__:null,transform:[],moveText:[],sameLineText:[],[vo]:[]};#n=new Map;#r=new Set;#i=new Map;#a;#o;#s;constructor(e,t=!1){this.#s=e,t&&(this.#a=new Map,this.#o=(e,t)=>{To(this.#a,t).dependencies.add(e)})}get clipBox(){return this.#s.clipBox}growOperationsCount(e){this.#s.growOperationsCount(e)}save(e){return this.#e={__proto__:this.#e},this.#t={__proto__:this.#t,transform:{__proto__:this.#t.transform},moveText:{__proto__:this.#t.moveText},sameLineText:{__proto__:this.#t.sameLineText},[vo]:{__proto__:this.#t[vo]}},this.#s.save(e),this}restore(e){this.#s.restore(e,this.#o);let t=Object.getPrototypeOf(this.#e);return t===null||(this.#e=t,this.#t=Object.getPrototypeOf(this.#t)),this}recordOpenMarker(e){return this.#s.recordOpenMarker(e,this.#o),this}getOpenMarker(){return this.#s.getOpenMarker()}recordCloseMarker(e){return this.#s.recordCloseMarker(e,this.#o),this}beginMarkedContent(e){return this.#s.beginMarkedContent(e),this}endMarkedContent(e){return this.#s.endMarkedContent(e,this.#o),this}pushBaseTransform(e){return this.#s.pushBaseTransform(e),this}popBaseTransform(){return this.#s.popBaseTransform(),this}recordSimpleData(e,t){return this.#e[e]=t,this}recordIncrementalData(e,t){return this.#t[e].push(t),this}resetIncrementalData(e,t){return this.#t[e].length=0,this}recordNamedData(e,t){return this.#n.set(e,t),this}recordSimpleDataFromNamed(e,t,n){this.#e[e]=this.#n.get(t)??n}recordFutureForcedDependency(e,t){return this.recordIncrementalData(vo,t),this}inheritSimpleDataAsFutureForcedDependencies(e){for(let t of e)t in this.#e&&this.recordFutureForcedDependency(t,this.#e[t]);return this}inheritPendingDependenciesAsFutureForcedDependencies(){for(let e of this.#r)this.recordFutureForcedDependency(vo,e);return this}resetBBox(e){return this.#s.resetBBox(e),this}recordClipBox(e,t,n,r,i,a){return this.#s.recordClipBox(e,t,n,r,i,a),this}recordBBox(e,t,n,r,i,a){return this.#s.recordBBox(e,t,n,r,i,a),this}recordCharacterBBox(e,t,n,r=1,i=0,a=0,o){let s=n.bbox,c,l;if(s&&(c=s[2]!==s[0]&&s[3]!==s[1]&&this.#i.get(n),c!==!1&&(l=[0,0,0,0],U.axialAlignedBoundingBox(s,n.fontMatrix,l),(r!==1||i!==0||a!==0)&&So(r,-r,i,a,l),c)))return this.recordBBox(e,t,l[0],l[2],l[1],l[3]);if(!o)return this.recordFullPageBBox(e);let u=o();return s&&l&&c===void 0&&(c=l[0]<=i-u.actualBoundingBoxLeft&&l[2]>=i+u.actualBoundingBoxRight&&l[1]<=a-u.actualBoundingBoxAscent&&l[3]>=a+u.actualBoundingBoxDescent,this.#i.set(n,c),c)?this.recordBBox(e,t,l[0],l[2],l[1],l[3]):this.recordBBox(e,t,i-u.actualBoundingBoxLeft,i+u.actualBoundingBoxRight,a-u.actualBoundingBoxAscent,a+u.actualBoundingBoxDescent)}recordFullPageBBox(e){return this.#s.recordFullPageBBox(e),this}getSimpleIndex(e){return this.#e[e]}recordDependencies(e,t){let n=this.#r,r=this.#e,i=this.#t;for(let e of t)e in this.#e?n.add(r[e]):e in i&&i[e].forEach(n.add,n);return this}recordNamedDependency(e,t){return this.#n.has(t)&&this.#r.add(this.#n.get(t)),this}recordOperation(e,t=!1){if(this.recordDependencies(e,[vo]),this.#a){let t=To(this.#a,e),{dependencies:n}=t;this.#r.forEach(n.add,n),this.#s._savesStack.forEach(n.add,n),this.#s._markedContentStack.forEach(n.add,n),n.delete(e),t.isRenderingOperation=!0}let n=!t&&e===this.#s._pendingBBoxIdx;return this.#s.recordOperation(e,t,[this.#r,this.#s._savesStack,this.#s._markedContentStack]),n&&this.#r.clear(),this}recordShowTextOperation(e,t=!1){let n=Array.from(this.#r);this.recordOperation(e,t),this.recordIncrementalData(`sameLineText`,e);for(let e of n)this.recordIncrementalData(`sameLineText`,e);return this}bboxToClipBoxDropOperation(e,t=!1){let n=!t&&e===this.#s._pendingBBoxIdx;return this.#s.bboxToClipBoxDropOperation(e),n&&this.#r.clear(),this}take(){return this.#i.clear(),this.#s.take()}takeDebugMetadata(){return this.#a}},Oo=class e{#e;#t;#n;#r=0;#i=0;constructor(t,n,r){if(t instanceof e&&t.#n===!!r)return t;this.#e=t,this.#t=n,this.#n=!!r}get clipBox(){return this.#e.clipBox}growOperationsCount(){throw Error(`Unreachable`)}save(e){return this.#i++,this.#e.save(this.#t),this}restore(e){return this.#i>0&&(this.#e.restore(this.#t),this.#i--),this}recordOpenMarker(e){return this.#r++,this}getOpenMarker(){return this.#r>0?this.#t:this.#e.getOpenMarker()}recordCloseMarker(e){return this.#r--,this}beginMarkedContent(e){return this}endMarkedContent(e){return this}pushBaseTransform(e){return this.#e.pushBaseTransform(e),this}popBaseTransform(){return this.#e.popBaseTransform(),this}recordSimpleData(e,t){return this.#e.recordSimpleData(e,this.#t),this}recordIncrementalData(e,t){return this.#e.recordIncrementalData(e,this.#t),this}resetIncrementalData(e,t){return this.#e.resetIncrementalData(e,this.#t),this}recordNamedData(e,t){return this}recordSimpleDataFromNamed(e,t,n){return this.#e.recordSimpleDataFromNamed(e,t,this.#t),this}recordFutureForcedDependency(e,t){return this.#e.recordFutureForcedDependency(e,this.#t),this}inheritSimpleDataAsFutureForcedDependencies(e){return this.#e.inheritSimpleDataAsFutureForcedDependencies(e),this}inheritPendingDependenciesAsFutureForcedDependencies(){return this.#e.inheritPendingDependenciesAsFutureForcedDependencies(),this}resetBBox(e){return this.#n||this.#e.resetBBox(this.#t),this}recordClipBox(e,t,n,r,i,a){return this.#n||this.#e.recordClipBox(this.#t,t,n,r,i,a),this}recordBBox(e,t,n,r,i,a){return this.#n||this.#e.recordBBox(this.#t,t,n,r,i,a),this}recordCharacterBBox(e,t,n,r,i,a,o){return this.#n||this.#e.recordCharacterBBox(this.#t,t,n,r,i,a,o),this}recordFullPageBBox(e){return this.#n||this.#e.recordFullPageBBox(this.#t),this}getSimpleIndex(e){return this.#e.getSimpleIndex(e)}recordDependencies(e,t){return this.#e.recordDependencies(this.#t,t),this}recordNamedDependency(e,t){return this.#e.recordNamedDependency(this.#t,t),this}recordOperation(e){return this.#e.recordOperation(this.#t,!0),this}recordShowTextOperation(e){return this.#e.recordShowTextOperation(this.#t,!0),this}bboxToClipBoxDropOperation(e){return this.#n||this.#e.bboxToClipBoxDropOperation(this.#t,!0),this}take(){throw Error(`Unreachable`)}takeDebugMetadata(){throw Error(`Unreachable`)}},ko={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`]},Ao=class e{#e;#t;#n=4;#r=0;#i=new e.#a(this.#n*6);static#a=Zi.isFloat16ArraySupported?Float16Array:Float32Array;constructor(e){this.#e=e.width,this.#t=e.height}record(t,n,r,i){if(this.#r===this.#n){this.#n*=2;let t=new e.#a(this.#n*6);t.set(this.#i),this.#i=t}let a=ka(t),o;if(i[0]!==1/0){let e=fi.slice();U.axialAlignedBoundingBox([0,-r,n,0],a,e);let t=U.intersect(i,e);if(!t)return;let[s,c,l,u]=t;if(s!==e[0]||c!==e[1]||l!==e[2]||u!==e[3]){let e=Math.atan2(a[1],a[0]),t=Math.abs(Math.sin(e)),n=Math.abs(Math.cos(e));if(t<1e-6||n<1e-6||Math.abs(t-n)<1e-6)o=[s,c,s,u,l,c];else{let e=l-s,r=u-c,i=t*t,a=n*n,d=n*t,f=a-i,p=(r*a-e*d)/f;o=[s+(r*d-e*i)/f,c,s,c+p,l,u-p]}}}o||(o=[0,-r,0,0,n,-r],U.applyTransform(o,a,0),U.applyTransform(o,a,2),U.applyTransform(o,a,4)),o[0]/=this.#e,o[1]/=this.#t,o[2]/=this.#e,o[3]/=this.#t,o[4]/=this.#e,o[5]/=this.#t,this.#i.set(o,this.#r*6),this.#r++}take(){return this.#i.subarray(0,this.#r*6)}},jo=/\p{Cc}/u;function Mo(e){let t=e[0];if(e.length<2||t!==`"`&&t!==`'`||e.at(-1)!==t)return!1;let n=e.length-1;for(let r=1;r<n;r++){let i=e[r];if(i===t||jo.test(i)||i===`\\`&&(++r>=n||jo.test(e[r])))return!1}return!0}function No(e){return Mo(e)?e:`"${e.replaceAll(/["\\\p{Cc}]/gu,e=>e===`"`||e===`\\`?`\\${e}`:`\\${e.codePointAt(0).toString(16)} `)}"`}var Po=class{#e=new Set;#t=new Set;#n=null;constructor({ownerDocument:e=globalThis.document,styleElement:t=null}){this._document=e,this.styleElement=null,this.loadingRequests=[],this.loadTestFontId=0}addNativeFontFace(e){this.#e.add(e),this._document.fonts.add(e)}removeNativeFontFace(e){this.#e.delete(e),this._document.fonts.delete(e)}insertRule(e){let t=this.#r();t.insertRule(e,t.cssRules.length)}#r(){if(this.#n)return this.#n;let e=this._document.defaultView?.CSSStyleSheet||globalThis.CSSStyleSheet;if(!this.styleElement&&e){let{adoptedStyleSheets:t}=this._document;if(t){let n=new e;return t.push(n),this.#n=n}}return this.styleElement||(this.styleElement=this._document.createElement(`style`),this._document.documentElement.getElementsByTagName(`head`)[0].append(this.styleElement)),this.#n=this.styleElement.sheet}clear(){for(let e of this.#e)this._document.fonts.delete(e);if(this.#e.clear(),this.#t.clear(),this.#n){let{adoptedStyleSheets:e}=this._document;e?.includes(this.#n)&&(this._document.adoptedStyleSheets=e.filter(e=>e!==this.#n)),this.#n=null}this.styleElement?.remove(),this.styleElement=null}async loadSystemFont({systemFontInfo:e,disableFontFace:t,_inspectFont:n}){if(e&&!this.#t.has(e.loadedName)){if(Li(!t,"loadSystemFont shouldn't be called when `disableFontFace` is set."),this.isFontLoadingAPISupported){let{loadedName:t,src:r,style:i}=e,a=new FontFace(t,r,i);this.addNativeFontFace(a);try{await a.load(),this.#t.add(t),n?.(e)}catch{Fi(`Cannot load system font: ${e.baseFontName}, installing it could help to improve PDF rendering.`),this.removeNativeFontFace(a)}}else Ii(`Not implemented: loadSystemFont without the Font Loading API.`)}}async bind(e){if(e.attached||e.missingFile&&!e.systemFontInfo)return;if(e.attached=!0,e.systemFontInfo){await this.loadSystemFont(e);return}if(this.isFontLoadingAPISupported){let t=e.createNativeFontFace();if(t){this.addNativeFontFace(t);try{await t.loaded}catch(n){throw Fi(`Failed to load font '${t.family}': '${n}'.`),e.disableFontFace=!0,n}}return}let t=e.createFontFaceRule();if(t){if(this.insertRule(t),this.isSyncFontLoadingSupported)return;await this.#i(e)}}get isFontLoadingAPISupported(){return H(this,`isFontLoadingAPISupported`,!!this._document?.fonts)}get isSyncFontLoadingSupported(){return H(this,`isSyncFontLoadingSupported`,di||Zi.platform.isFirefox)}#i(e){function t(){for(Li(!a.done,`completeRequest() cannot be called twice.`),a.done=!0;n.length>0&&n[0].done;){let e=n.shift();setTimeout(e.resolve,0)}}let{loadingRequests:n}=this,{promise:r,resolve:i}=Promise.withResolvers(),a={done:!1,resolve:i};n.push(a),this._loadTestFont??=atob(`T1RUTwALAIAAAwAwQ0ZGIDHtZg4AAAOYAAAAgUZGVE1lkzZwAAAEHAAAABxHREVGABQAFQAABDgAAAAeT1MvMlYNYwkAAAEgAAAAYGNtYXABDQLUAAACNAAAAUJoZWFk/xVFDQAAALwAAAA2aGhlYQdkA+oAAAD0AAAAJGhtdHgD6AAAAAAEWAAAAAZtYXhwAAJQAAAAARgAAAAGbmFtZVjmdH4AAAGAAAAAsXBvc3T/hgAzAAADeAAAACAAAQAAAAEAALZRFsRfDzz1AAsD6AAAAADOBOTLAAAAAM4KHDwAAAAAA+gDIQAAAAgAAgAAAAAAAAABAAADIQAAAFoD6AAAAAAD6AABAAAAAAAAAAAAAAAAAAAAAQAAUAAAAgAAAAQD6AH0AAUAAAKKArwAAACMAooCvAAAAeAAMQECAAACAAYJAAAAAAAAAAAAAQAAAAAAAAAAAAAAAFBmRWQAwAAuAC4DIP84AFoDIQAAAAAAAQAAAAAAAAAAACAAIAABAAAADgCuAAEAAAAAAAAAAQAAAAEAAAAAAAEAAQAAAAEAAAAAAAIAAQAAAAEAAAAAAAMAAQAAAAEAAAAAAAQAAQAAAAEAAAAAAAUAAQAAAAEAAAAAAAYAAQAAAAMAAQQJAAAAAgABAAMAAQQJAAEAAgABAAMAAQQJAAIAAgABAAMAAQQJAAMAAgABAAMAAQQJAAQAAgABAAMAAQQJAAUAAgABAAMAAQQJAAYAAgABWABYAAAAAAAAAwAAAAMAAAAcAAEAAAAAADwAAwABAAAAHAAEACAAAAAEAAQAAQAAAC7//wAAAC7////TAAEAAAAAAAABBgAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAD/gwAyAAAAAQAAAAAAAAAAAAAAAAAAAAABAAQEAAEBAQJYAAEBASH4DwD4GwHEAvgcA/gXBIwMAYuL+nz5tQXkD5j3CBLnEQACAQEBIVhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYAAABAQAADwACAQEEE/t3Dov6fAH6fAT+fPp8+nwHDosMCvm1Cvm1DAz6fBQAAAAAAAABAAAAAMmJbzEAAAAAzgTjFQAAAADOBOQpAAEAAAAAAAAADAAUAAQAAAABAAAAAgABAAAAAAAAAAAD6AAAAAAAAA==`);function o(e,t){return e.charCodeAt(t)<<24|e.charCodeAt(t+1)<<16|e.charCodeAt(t+2)<<8|e.charCodeAt(t+3)&255}function s(e){return String.fromCharCode(e>>24&255,e>>16&255,e>>8&255,e&255)}function c(e,t,n,r){let i=e.substring(0,t),a=e.substring(t+n);return i+r+a}let l,u,d=this._document.createElement(`canvas`);d.width=1,d.height=1;let f=d.getContext(`2d`),p=0;function m(e,t){++p>30?(Fi(`Load test font never loaded.`),t()):(f.font=`30px `+e,f.fillText(`.`,0,20),f.getImageData(0,0,1,1).data[3]>0?t():setTimeout(m.bind(null,e,t)))}let h=`lt${Date.now()}${this.loadTestFontId++}`,g=this._loadTestFont;g=c(g,976,h.length,h);let _=1482184792,v=o(g,16);for(l=0,u=h.length-3;l<u;l+=4)v=v-_+o(h,l)|0;l<h.length&&(v=v-_+o(h+`XXX`,l)|0),g=c(g,16,4,s(v));let y=`@font-face {font-family:"${h}";src:${`url(data:font/opentype;base64,${btoa(g)});`}}`;this.insertRule(y);let b=this._document.createElement(`div`);b.style.visibility=`hidden`,b.style.width=b.style.height=`10px`,b.style.position=`absolute`,b.style.top=b.style.left=`0px`;for(let t of[e.loadedName,h]){let e=this._document.createElement(`span`);e.textContent=`Hi`,e.style.fontFamily=t,b.append(e)}return this._document.body.append(b),m(h,()=>{b.remove(),t()}),r}},Fo=class{#e=new Map;#t;constructor(e,t=null,n,r){this.#t=e,this._inspectFont=t,n&&(this.charProcOperatorList=n),r&&Object.assign(this,r)}createNativeFontFace(){let{data:e}=this;if(!e||this.disableFontFace)return null;let t;if(!this.cssFontInfo)t=new FontFace(this.loadedName,e,{});else{let n={weight:this.cssFontInfo.fontWeight};this.cssFontInfo.italicAngle&&(n.style=`oblique ${this.cssFontInfo.italicAngle}deg`),t=new FontFace(No(this.cssFontInfo.fontFamily),e,n)}return this._inspectFont?.(this),t}createFontFaceRule(){let{data:e}=this;if(!e||this.disableFontFace)return null;let t=`url(data:${this.mimetype};base64,${e.toBase64()});`,n;if(!this.cssFontInfo)n=`@font-face {font-family:"${this.loadedName}";src:${t}}`;else{let e=`font-weight: ${this.cssFontInfo.fontWeight};`;this.cssFontInfo.italicAngle&&(e+=`font-style: oblique ${this.cssFontInfo.italicAngle}deg;`),n=`@font-face {font-family:${No(this.cssFontInfo.fontFamily)};${e}src:${t}}`}return this._inspectFont?.(this,t),n}getPathGenerator(e,t){let n=this.#e.get(t);if(n)return n;let r=`${this.loadedName}_path_${t}`,i;try{i=e.get(r)}catch(e){Fi(`getPathGenerator - ignoring character: "${e}".`)}return n=Wa(i?.path),this.fontExtraProperties||e.delete(r),this.#e.set(t,n),n}get black(){return this.#t.black}get bold(){return this.#t.bold}get disableFontFace(){return this.#t.disableFontFace}set disableFontFace(e){H(this,`disableFontFace`,!!e)}get fontExtraProperties(){return this.#t.fontExtraProperties}get isInvalidPDFjsFont(){return this.#t.isInvalidPDFjsFont}get isType3Font(){return this.#t.isType3Font}get italic(){return this.#t.italic}get missingFile(){return this.#t.missingFile}get remeasure(){return this.#t.remeasure}get vertical(){return this.#t.vertical}get bbox(){return this.#t.bbox}get fontMatrix(){return this.#t.fontMatrix}get fallbackName(){return this.#t.fallbackName}get loadedName(){return this.#t.loadedName}get mimetype(){return this.missingFile?null:`font/opentype`}get data(){return this.#t.data}clearData(){this.#t.clearData()}get cssFontInfo(){return this.#t.cssFontInfo}get systemFontInfo(){return this.#t.systemFontInfo}},Io=class{static strings=[`fontFamily`,`fontWeight`,`italicAngle`]},Lo=class{static strings=[`css`,`loadedName`,`baseFontName`,`src`]},Ro=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},zo=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},Bo=class{static get decoder(){return H(this,`decoder`,new TextDecoder)}static get encoder(){return H(this,`encoder`,new TextEncoder)}};function Vo(e,t,n,r=0){let{decoder:i}=Bo;for(let e=0;e<n;e++)r+=t.getUint32(r)+4;let a=t.getUint32(r);return i.decode(new Uint8Array(e,r+4,a))}var Ho=class{#e;#t;constructor(e){this.#e=e,this.#t=new DataView(e)}#n(e){return Li(e<Io.strings.length,`Invalid string index`),Vo(this.#e,this.#t,e)}get fontFamily(){return H(this,`fontFamily`,this.#n(0))}get fontWeight(){return H(this,`fontWeight`,this.#n(1))}get italicAngle(){return H(this,`italicAngle`,this.#n(2))}},Uo=class{#e;#t;constructor(e){this.#e=e,this.#t=new DataView(e)}#n(e){return Li(e<Lo.strings.length,`Invalid string index`),Vo(this.#e,this.#t,e,4)}get css(){return H(this,`css`,this.#n(0))}get loadedName(){return H(this,`loadedName`,this.#n(1))}get baseFontName(){return H(this,`baseFontName`,this.#n(2))}get src(){return H(this,`src`,this.#n(3))}get style(){let e=0;e+=4+this.#t.getUint32(e);let t=Vo(this.#e,this.#t,0,e),n=Vo(this.#e,this.#t,1,e);return H(this,`style`,{style:t,weight:n})}},Wo=class{#e;#t;constructor(e){this.#e=e,this.#t=new DataView(e)}#n(e){Li(e<Ro.bools.length,`Invalid boolean index`);let t=Math.floor(e/4),n=e*2%8,r=this.#t.getUint8(t)>>n&3;return r===0?void 0:r===2}get black(){return H(this,`black`,this.#n(0))}get bold(){return H(this,`bold`,this.#n(1))}get disableFontFace(){return H(this,`disableFontFace`,this.#n(2))}get fontExtraProperties(){return H(this,`fontExtraProperties`,this.#n(3))}get isInvalidPDFjsFont(){return H(this,`isInvalidPDFjsFont`,this.#n(4))}get isType3Font(){return H(this,`isType3Font`,this.#n(5))}get italic(){return H(this,`italic`,this.#n(6))}get missingFile(){return H(this,`missingFile`,this.#n(7))}get remeasure(){return H(this,`remeasure`,this.#n(8))}get vertical(){return H(this,`vertical`,this.#n(9))}#r(e,t,n,r){let i=this.#t.getUint8(e++);if(i===0)return;Li(i===t,`Invalid array length.`);let a=Array(i);for(let t=0;t<i;t++)a[t]=this.#t[n](e,!0),e+=r;return a}get bbox(){return H(this,`bbox`,this.#r(Ro.OFFSET_BBOX,4,`getInt16`,2))}get fontMatrix(){return H(this,`fontMatrix`,this.#r(Ro.OFFSET_FONT_MATRIX,6,`getFloat64`,8))}#i(e){return Li(e<Ro.strings.length,`Invalid string index`),Vo(this.#e,this.#t,e,Ro.OFFSET_STRINGS+4)}get fallbackName(){return H(this,`fallbackName`,this.#i(0))}get loadedName(){return H(this,`loadedName`,this.#i(1))}#a(e){let t=Ro.OFFSET_STRINGS;for(let n=0;n<=e;n++)t+=4+this.#t.getUint32(t);let n=this.#t.getUint32(t);return{offset:t,length:n}}get data(){let{offset:e,length:t}=this.#a(2);return t?new Uint8Array(this.#e,e+4,t):void 0}clearData(){let{offset:e,length:t}=this.#a(2);t&&(this.#t.setUint32(e,0),this.#e=new Uint8Array(this.#e,0,e+4).slice().buffer,this.#t=new DataView(this.#e))}get cssFontInfo(){let{offset:e,length:t}=this.#a(1),n=null;return t&&(n=new Ho(new Uint8Array(this.#e,e+4,t).slice().buffer)),H(this,`cssFontInfo`,n)}get systemFontInfo(){let{offset:e,length:t}=this.#a(0),n=null;return t&&(n=new Uo(new Uint8Array(this.#e,e+4,t).slice().buffer)),H(this,`systemFontInfo`,n)}},Go=class{constructor(e){this.buffer=e,this.view=new DataView(e),this.data=new Uint8Array(e)}getIR(){let e=this.view,t=this.data[zo.KIND],n=!!this.data[zo.HAS_BBOX],r=!!this.data[zo.HAS_BACKGROUND],i=e.getUint32(zo.N_COORD,!0),a=e.getUint32(zo.N_COLOR,!0),o=e.getUint32(zo.N_STOP,!0),s=20,c=new Float32Array(this.buffer,s,i*2);s+=i*8;let l=new Uint8Array(this.buffer,s,a*4);s+=a*4;let u=[];for(let t=0;t<o;++t){let t=e.getFloat32(s,!0);s+=4;let n=e.getUint32(s,!0);s+=4,u.push([t,`#${n.toString(16).padStart(6,`0`)}`])}let d=null;if(n){d=[];for(let t=0;t<4;++t)d.push(e.getFloat32(s,!0)),s+=4}let f=null;if(r&&(f=new Uint8Array(this.buffer,s,3),s+=3),t===1)return[`RadialAxial`,`axial`,d,u,[c[0],c[1]],[c[2],c[3]],null,null];if(t===2)return[`RadialAxial`,`radial`,d,u,[c[0],c[1]],[c[3],c[4]],c[2],c[5]];if(t===3){let e=this.data[zo.SHADING_TYPE],t=null;if(c.length>0){t=fi.slice();for(let e=0,n=c.length;e<n;e+=2)U.pointBoundingBox(c[e],c[e+1],t)}return[`Mesh`,e,c,l,i,t,d,f]}throw Error(`Unsupported pattern kind: ${t}`)}},Ko=class{#e;constructor(e){this.#e=e}get path(){return Zi.isFloat16ArraySupported?new Float16Array(this.#e):new Float32Array(this.#e)}};function qo(e){if(e instanceof URL)return e;if(typeof e==`string`){if(di){if(/^[a-z][a-z0-9\-+.]+:/i.test(e))return new URL(e);let t=process.getBuiltinModule(`url`);return new URL(t.pathToFileURL(e))}let t=URL.parse(e,window.location);if(t)return t}throw Error(`Invalid PDF url data: either string or URL-object is expected in the url property.`)}function Jo(e){if(di&&typeof Buffer<`u`&&e instanceof Buffer)throw Error("Please provide binary data as `Uint8Array`, rather than `Buffer`.");if(e instanceof Uint8Array&&e.byteLength===e.buffer.byteLength)return e;if(typeof e==`string`)return Xi(e);if(e instanceof ArrayBuffer||ArrayBuffer.isView(e)||typeof e==`object`&&!isNaN(e?.length))return new Uint8Array(e);throw Error(`Invalid PDF binary data: either TypedArray, string, or array-like object is expected in the data property.`)}function Yo(e){if(typeof e!=`string`)return null;if(e.endsWith(`/`))return e;throw Error(`Invalid factory url: "${e}" must include trailing slash.`)}var Xo=e=>typeof e==`object`&&Number.isInteger(e?.num)&&e.num>=0&&Number.isInteger(e?.gen)&&e.gen>=0,Zo=ra.bind(null,Xo,e=>typeof e==`object`&&typeof e?.name==`string`),Qo=class{#e=new Map;#t=Promise.resolve();postMessage(e,t){let n={data:structuredClone(e,t?{transfer:t}:null)};this.#t.then(()=>{for(let[e]of this.#e)e.call(this,n)})}addEventListener(e,t,n=null){let r=null;if(n?.signal instanceof AbortSignal){let{signal:i}=n;if(i.aborted){Fi("LoopbackPort - cannot use an `aborted` signal.");return}let a=()=>this.removeEventListener(e,t);r=()=>i.removeEventListener(`abort`,a),i.addEventListener(`abort`,a)}this.#e.set(t,r)}removeEventListener(e,t){this.#e.get(t)?.(),this.#e.delete(t)}terminate(){for(let[,e]of this.#e)e?.();this.#e.clear()}};qr();var $o={DATA:1,ERROR:2},es={CANCEL:1,CANCEL_COMPLETE:2,CLOSE:3,ENQUEUE:4,ERROR:5,PULL:6,PULL_COMPLETE:7,START_COMPLETE:8};function ts(){}function ns(e){if(e instanceof Ji||e instanceof Gi||e instanceof Ui||e instanceof Ki||e instanceof Wi)return e;switch(e instanceof Error||typeof e==`object`&&e||Ii(`wrapReason: Expected "reason" to be a (possibly cloned) Error.`),e.name){case`AbortException`:return new Ji(e.message);case`InvalidPDFException`:return new Gi(e.message);case`PasswordException`:return new Ui(e.message,e.code);case`ResponseException`:return new Ki(e.message,e.status,e.missing);case`UnknownErrorException`:return new Wi(e.message,e.details)}return new Wi(e.message,e.toString())}var rs=class{#e=new Map;#t=new Map;#n=1;#r;#i=new AbortController;#a;#o=new Map;#s=1;#c=new Map;#l;constructor(e,t,n){this.#a=e,this.#l=t,this.#r=n,n.addEventListener(`message`,this.#u.bind(this),{signal:this.#i.signal})}#u({data:e}){if(e.targetName!==this.#a)return;if(e.stream){this.#f(e);return}if(e.callback){let{callbackId:t,callback:n}=e,r=this.#t.get(t);if(!r)throw Error(`Cannot resolve callback ${t}`);if(this.#t.delete(t),n===$o.DATA)r.resolve(e.data);else if(n===$o.ERROR)r.reject(ns(e.reason));else throw Error(`Unexpected callback case`);return}let t=this.#e.get(e.action);if(!t)throw Error(`Unknown action from worker: ${e.action}`);if(e.callbackId){let n=this.#a,r=e.sourceName,i=this.#r;Promise.try(t,e.data).then(t=>{i.postMessage({sourceName:n,targetName:r,callback:$o.DATA,callbackId:e.callbackId,data:t})},t=>{i.postMessage({sourceName:n,targetName:r,callback:$o.ERROR,callbackId:e.callbackId,reason:ns(t)})})}else e.streamId?this.#d(e):t(e.data)}on(e,t){let n=this.#e;if(n.has(e))throw Error(`There is already a "${e}" handler.`);n.set(e,t)}send(e,t,n){this.#r.postMessage({sourceName:this.#a,targetName:this.#l,action:e,data:t},n)}sendWithPromise(e,t,n){let r=this.#n++,i=Promise.withResolvers();this.#t.set(r,i);try{this.#r.postMessage({sourceName:this.#a,targetName:this.#l,action:e,callbackId:r,data:t},n)}catch(e){i.reject(e)}return i.promise}sendWithStream(e,t,n,r){let i=this.#s++,a=this.#a,o=this.#l,s=this.#r;return new ReadableStream({start:n=>{let c=Promise.withResolvers();return this.#o.set(i,{controller:n,startCall:c,pullCall:null,cancelCall:null,isClosed:!1}),s.postMessage({sourceName:a,targetName:o,action:e,streamId:i,data:t,desiredSize:n.desiredSize},r),c.promise},pull:e=>{let t=Promise.withResolvers();return this.#o.get(i).pullCall=t,s.postMessage({sourceName:a,targetName:o,stream:es.PULL,streamId:i,desiredSize:e.desiredSize}),t.promise},cancel:e=>{Li(e instanceof Error,`cancel must have a valid reason`);let t=Promise.withResolvers();return this.#o.get(i).cancelCall=t,this.#o.get(i).isClosed=!0,s.postMessage({sourceName:a,targetName:o,stream:es.CANCEL,streamId:i,reason:ns(e)}),t.promise}},n)}#d(e){let t=e.streamId,n=this.#a,r=e.sourceName,i=this.#r,a=this.#c,o=this.#e.get(e.action),s={enqueue(e,a=1,o){if(this.isCancelled)return;let s=this.desiredSize;this.desiredSize-=a,s>0&&this.desiredSize<=0&&(this.sinkCapability=Promise.withResolvers(),this.ready=this.sinkCapability.promise),i.postMessage({sourceName:n,targetName:r,stream:es.ENQUEUE,streamId:t,chunk:e},o)},close(){this.isCancelled||(this.isCancelled=!0,i.postMessage({sourceName:n,targetName:r,stream:es.CLOSE,streamId:t}),a.delete(t))},error(e){Li(e instanceof Error,`error must have a valid reason`),!this.isCancelled&&(this.isCancelled=!0,i.postMessage({sourceName:n,targetName:r,stream:es.ERROR,streamId:t,reason:ns(e)}))},sinkCapability:Promise.withResolvers(),onPull:null,onCancel:null,isCancelled:!1,desiredSize:e.desiredSize,ready:null};s.sinkCapability.resolve(),s.ready=s.sinkCapability.promise,a.set(t,s),Promise.try(o,e.data,s).then(()=>{i.postMessage({sourceName:n,targetName:r,stream:es.START_COMPLETE,streamId:t,success:!0})},e=>{i.postMessage({sourceName:n,targetName:r,stream:es.START_COMPLETE,streamId:t,reason:ns(e)})})}#f(e){let t=e.streamId,n=this.#a,r=e.sourceName,i=this.#r,a=this.#o.get(t),o=this.#c.get(t);switch(e.stream){case es.START_COMPLETE:e.success?a.startCall.resolve():a.startCall.reject(ns(e.reason));break;case es.PULL_COMPLETE:e.success?a.pullCall.resolve():a.pullCall.reject(ns(e.reason));break;case es.PULL:if(!o){i.postMessage({sourceName:n,targetName:r,stream:es.PULL_COMPLETE,streamId:t,success:!0});break}o.desiredSize<=0&&e.desiredSize>0&&o.sinkCapability.resolve(),o.desiredSize=e.desiredSize,Promise.try(o.onPull||ts).then(()=>{i.postMessage({sourceName:n,targetName:r,stream:es.PULL_COMPLETE,streamId:t,success:!0})},e=>{i.postMessage({sourceName:n,targetName:r,stream:es.PULL_COMPLETE,streamId:t,reason:ns(e)})});break;case es.ENQUEUE:if(Li(a,`enqueue should have stream controller`),a.isClosed)break;a.controller.enqueue(e.chunk);break;case es.CLOSE:if(Li(a,`close should have stream controller`),a.isClosed)break;a.isClosed=!0,a.controller.close(),this.#p(a,t);break;case es.ERROR:Li(a,`error should have stream controller`),a.controller.error(ns(e.reason)),this.#p(a,t);break;case es.CANCEL_COMPLETE:e.success?a.cancelCall.resolve():a.cancelCall.reject(ns(e.reason)),this.#p(a,t);break;case es.CANCEL:if(!o)break;let s=ns(e.reason);Promise.try(o.onCancel||ts,s).then(()=>{i.postMessage({sourceName:n,targetName:r,stream:es.CANCEL_COMPLETE,streamId:t,success:!0})},e=>{i.postMessage({sourceName:n,targetName:r,stream:es.CANCEL_COMPLETE,streamId:t,reason:ns(e)})}),o.sinkCapability.reject(s),o.isCancelled=!0,this.#c.delete(t);break;default:throw Error(`Unexpected stream case`)}}async#p(e,t){await Promise.allSettled([e.startCall?.promise,e.pullCall?.promise,e.cancelCall?.promise]),this.#o.delete(t)}destroy(){this.#i?.abort(),this.#i=null}},is=class{#e=Object.freeze({cMapUrl:`CMap`,standardFontDataUrl:`font`,wasmUrl:`wasm`});constructor({cMapUrl:e=null,standardFontDataUrl:t=null,wasmUrl:n=null}){this.cMapUrl=e,this.standardFontDataUrl=t,this.wasmUrl=n}async fetch({kind:e,filename:t}){switch(e){case`cMapUrl`:case`standardFontDataUrl`:case`wasmUrl`:break;default:Ii(`Not implemented: ${e}`)}let n=this[e];if(!n)throw Error(`Ensure that the \`${e}\` API parameter is provided.`);let r=`${n}${t}`;return this._fetch(r,e).catch(t=>{throw Error(`Unable to load ${this.#e[e]} data at: ${r}`)})}async _fetch(e,t){Ii("Abstract method `_fetch` called.")}},as=class extends is{async _fetch(e,t){let n=await ha(e,t===`cMapUrl`&&!e.endsWith(`.bcmap`)?`text`:`bytes`);return n instanceof Uint8Array?n:Xi(n)}},os=class{#e=!1;constructor({enableHWA:e=!1}){this.#e=e}create(e,t){if(e<=0||t<=0)throw Error(`Invalid canvas size`);let n=this._createCanvas(e,t);return{canvas:n,context:n.getContext(`2d`,{willReadFrequently:!this.#e})}}reset({canvas:e},t,n){if(!e)throw Error(`Canvas is not specified`);if(t<=0||n<=0)throw Error(`Invalid canvas size`);e.width=t,e.height=n}destroy(e){let{canvas:t}=e;if(!t)throw Error(`Canvas is not specified`);t.width=t.height=0,e.canvas=null,e.context=null}_createCanvas(e,t){Ii("Abstract method `_createCanvas` called.")}},ss=class extends os{constructor({ownerDocument:e=globalThis.document,enableHWA:t=!1}){super({enableHWA:t}),this._document=e}_createCanvas(e,t){let n=this._document.createElement(`canvas`);return n.width=e,n.height=t,n}},cs=class{addFilter(e){return`none`}addHCMFilter(e,t){return`none`}addAlphaFilter(e){return`none`}addLuminosityFilter(e){return`none`}addKnockoutFilter(e=0){return`none`}addHighlightHCMFilter(e,t,n,r,i){return`none`}addSelectionHCMFilter(e,t){return`none`}addSelectionFilter(){return`none`}createSelectionStyle(e=null){return null}destroy(e=!1){}},ls=class extends cs{#e;#t;#n;#r;#i;#a;#o=0;constructor({docId:e,ownerDocument:t=globalThis.document}){super(),this.#r=e,this.#i=t}get#s(){return this.#t||=new Map}get#c(){return this.#a||=new Map}get#l(){if(!this.#n){let e=this.#i.createElement(`div`),{style:t}=e;t.colorScheme=`only light`,t.visibility=`hidden`,t.contain=`strict`,t.width=t.height=0,t.position=`absolute`,t.top=t.left=0,t.zIndex=-1;let n=this.#i.createElementNS(hi,`svg`);n.setAttribute(`width`,0),n.setAttribute(`height`,0),this.#n=this.#i.createElementNS(hi,`defs`),e.append(n),n.append(this.#n),this.#i.body.append(e)}return this.#n}#u(e){let t=e=>e&&Array.from(e,e=>e/255).join(`,`);if(e.length===1){let n=t(e[0]);return[n,n,n]}let[n,r,i]=e;return[t(n),t(r),t(i)]}#d(e){if(this.#e===void 0){this.#e=``;let e=this.#i.URL;e!==this.#i.baseURI&&(_a(e)?Fi(`#createUrl: ignore "data:"-URL for performance reasons.`):this.#e=Bi(e,``))}return`url(${this.#e}#${e})`}addFilter(e){if(!e)return`none`;let t=this.#s.get(e);if(t)return t;let[n,r,i]=this.#u(e),a=e.length===1?n:`${n}${r}${i}`;if(t=this.#s.get(a),t)return this.#s.set(e,t),t;let o=`g_${this.#r}_transfer_map_${this.#o++}`,s=this.#d(o);this.#s.set(e,s),this.#s.set(a,s);let c=this.#m(o);return this.#g(n,r,i,c),s}addHCMFilter(e,t){let n=`${e}-${t}`,r=`base`,i=this.#c.get(r);if(i?.key===n||(i?(i.filter?.remove(),i.key=n,i.url=`none`,i.filter=null):(i={key:n,url:`none`,filter:null},this.#c.set(r,i)),!e||!t))return i.url;let a=this.#v(e);e=U.makeHexColor(...a);let o=this.#v(t);if(t=U.makeHexColor(...o),this.#b(),e===`#000000`&&t===`#ffffff`||e===t)return i.url;let s=Array.from({length:256},(e,t)=>za(t/255)).join(`,`),c=`g_${this.#r}_hcm_filter`,l=i.filter=this.#m(c);this.#g(s,s,s,l),this.#p(l);let u=(e,t)=>{let n=a[e]/255,r=o[e]/255,i=Array(t+1);for(let e=0;e<=t;e++)i[e]=n+e/t*(r-n);return i.join(`,`)};return this.#g(u(0,5),u(1,5),u(2,5),l),i.url=this.#d(c),i.url}addSelectionHCMFilter(e,t){return this.addHighlightHCMFilter(`selection`,e,t,`HighlightText`,`Highlight`)}addSelectionFilter(){return this.addHighlightHCMFilter(`selection_default`,`black`,`white`,`HighlightText`,`Highlight`)}createSelectionStyle(e=null){let t=e?this.addSelectionHCMFilter(e.foreground,e.background):this.addSelectionFilter();return t===`none`||!Zi.platform.isFirefox?null:{"backdrop-filter":t,"background-color":`transparent`}}addAlphaFilter(e){let t=this.#s.get(e);if(t)return t;let[n]=this.#u([e]),r=`alpha_${n}`;if(t=this.#s.get(r),t)return this.#s.set(e,t),t;let i=`g_${this.#r}_alpha_map_${this.#o++}`,a=this.#d(i);this.#s.set(e,a),this.#s.set(r,a);let o=this.#m(i);return this.#_(n,o),a}addLuminosityFilter(e){let t=this.#s.get(e||`luminosity`);if(t)return t;let n,r;if(e?([n]=this.#u([e]),r=`luminosity_${n}`):r=`luminosity`,t=this.#s.get(r),t)return this.#s.set(e,t),t;let i=`g_${this.#r}_luminosity_map_${this.#o++}`,a=this.#d(i);this.#s.set(e,a),this.#s.set(r,a);let o=this.#m(i);return this.#f(o),e&&this.#_(n,o),a}addKnockoutFilter(e=0){let t=e>0?Math.min(1/e,1e6):1e6,n=`knockout_${t}`,r=this.#s.get(n);if(r)return r;let i=`g_${this.#r}_knockout_filter_${this.#o++}`,a=this.#d(i);this.#s.set(n,a);let o=this.#m(i),s=this.#i.createElementNS(hi,`feComponentTransfer`);o.append(s);let c=this.#i.createElementNS(hi,`feFuncA`);return c.setAttribute(`type`,`linear`),c.setAttribute(`slope`,`${t}`),c.setAttribute(`intercept`,`0`),s.append(c),a}addHighlightHCMFilter(e,t,n,r,i){let a=`${t}-${n}-${r}-${i}`,o=this.#c.get(e);if(o?.key===a||(o?(o.filter?.remove(),o.key=a,o.url=`none`,o.filter=null):(o={key:a,url:`none`,filter:null},this.#c.set(e,o)),!t||!n))return o.url;let[s,c]=[t,n].map(this.#v.bind(this)),l=Math.round(.2126*s[0]+.7152*s[1]+.0722*s[2]),u=Math.round(.2126*c[0]+.7152*c[1]+.0722*c[2]),[d,f]=[r,i].map(this.#x.bind(this));u<l&&([l,u,d,f]=[u,l,f,d]),this.#b();let p=(e,t,n)=>{let r=Array(256),i=(u-l)/n,a=e/255,o=(t-e)/(255*n),s=0;for(let e=0;e<=n;e++){let t=Math.round(l+e*i),n=a+e*o;for(let e=s;e<=t;e++)r[e]=n;s=t+1}for(let e=s;e<256;e++)r[e]=r[s-1];return r.join(`,`)},m=`g_${this.#r}_hcm_${e}_filter`,h=o.filter=this.#m(m);return this.#p(h),this.#g(p(d[0],f[0],5),p(d[1],f[1],5),p(d[2],f[2],5),h),o.url=this.#d(m),o.url}destroy(e=!1){e&&this.#a?.size||(this.#n?.parentNode.parentNode.remove(),this.#n=null,this.#t?.clear(),this.#t=null,this.#a?.clear(),this.#a=null,this.#o=0)}#f(e){let t=this.#i.createElementNS(hi,`feColorMatrix`);t.setAttribute(`type`,`matrix`),t.setAttribute(`values`,`0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.3 0.59 0.11 0 0`),e.append(t)}#p(e){let t=this.#i.createElementNS(hi,`feColorMatrix`);t.setAttribute(`type`,`matrix`),t.setAttribute(`values`,`0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0 0 0 1 0`),e.append(t)}#m(e){let t=this.#i.createElementNS(hi,`filter`);return t.setAttribute(`color-interpolation-filters`,`sRGB`),t.setAttribute(`id`,e),this.#l.append(t),t}#h(e,t,n){if(!n)return;let r=this.#i.createElementNS(hi,t);r.setAttribute(`type`,`discrete`),r.setAttribute(`tableValues`,n),e.append(r)}#g(e,t,n,r){let i=this.#i.createElementNS(hi,`feComponentTransfer`);r.append(i),this.#h(i,`feFuncR`,e),this.#h(i,`feFuncG`,t),this.#h(i,`feFuncB`,n)}#_(e,t){let n=this.#i.createElementNS(hi,`feComponentTransfer`);t.append(n),this.#h(n,`feFuncA`,e)}#v(e){return this.#l.style.color=`CanvasText`,this.#l.style.backgroundColor=e,Da(getComputedStyle(this.#l).getPropertyValue(`background-color`))}#y(e){return this.#l.style.color=`CanvasText`,this.#l.style.backgroundColor=e,Ea(getComputedStyle(this.#l).getPropertyValue(`background-color`))}#b(){this.#l.style.color=``,this.#l.style.backgroundColor=``}#x(e){let[t,n,r,i]=this.#y(e);if(i===1)return[t,n,r];let[a,o,s]=this.#v(`Canvas`);return[us(t,a,i),us(n,o,i),us(r,s,i)]}};function us(e,t,n){return Math.round(n*e+(1-n)*t)}if(di){let e;try{let t=process.getBuiltinModule(`module`).createRequire({}.url);try{e=t("@napi-rs/canvas")}catch(e){Fi(`Cannot load "@napi-rs/canvas" package: "${e}".`)}}catch(e){Fi(`Cannot access the \`require\` function: "${e}".`)}globalThis.DOMMatrix||(e?.DOMMatrix?globalThis.DOMMatrix=e.DOMMatrix:Fi("Cannot polyfill `DOMMatrix`, rendering may be broken.")),globalThis.Path2D||(e?.Path2D?globalThis.Path2D=e.Path2D:Fi("Cannot polyfill `Path2D`, rendering may be broken.")),globalThis.navigator?.language||(globalThis.navigator={language:`en-US`,platform:``,userAgent:``})}async function ds(e){let t=await process.getBuiltinModule(`fs/promises`).readFile(e);return new Uint8Array(t)}var fs=class extends cs{},ps=class extends os{_createCanvas(e,t){return process.getBuiltinModule(`module`).createRequire({}.url)(`@napi-rs/canvas`).createCanvas(e,t)}},ms=class extends is{async _fetch(e,t){return ds(e)}};function hs({src:e,srcPos:t=0,dest:n,width:r,height:i,nonBlackColor:a=4294967295,inverseDecode:o=!1}){let s=Zi.isLittleEndian?4278190080:255,[c,l]=o?[a,s]:[s,a],u=r>>3,d=r&7,f=c^l,p=e.length;n=new Uint32Array(n.buffer);let m=0;for(let r=0;r<i;++r){for(let r=t+u;t<r;++t,m+=8){let r=e[t];n[m]=c^-(r>>7&1)&f,n[m+1]=c^-(r>>6&1)&f,n[m+2]=c^-(r>>5&1)&f,n[m+3]=c^-(r>>4&1)&f,n[m+4]=c^-(r>>3&1)&f,n[m+5]=c^-(r>>2&1)&f,n[m+6]=c^-(r>>1&1)&f,n[m+7]=c^-(r&1)&f}if(d===0)continue;let r=t<p?e[t++]:255;for(let e=0;e<d;++e,++m)n[m]=c^-(r>>7-e&1)&f}return{srcPos:t,destPos:m}}function gs({src:e,srcPos:t=0,dest:n,destPos:r=0,width:i,height:a}){let o=0,s=i*a*3,c=s>>2,l=new Uint32Array(e.buffer,t,c),u=Zi.isLittleEndian?4278190080:255;if(Zi.isLittleEndian){for(;o<c-2;o+=3,r+=4){let e=l[o],t=l[o+1],i=l[o+2];n[r]=e|u,n[r+1]=e>>>24|t<<8|u,n[r+2]=t>>>16|i<<16|u,n[r+3]=i>>>8|u}for(let i=t+o*4,a=t+s;i<a;i+=3)n[r++]=e[i]|e[i+1]<<8|e[i+2]<<16|u}else{for(;o<c-2;o+=3,r+=4){let e=l[o],t=l[o+1],i=l[o+2];n[r]=e|u,n[r+1]=e<<24|t>>>8|u,n[r+2]=t<<16|i>>>16|u,n[r+3]=i<<8|u}for(let i=t+o*4,a=t+s;i<a;i+=3)n[r++]=e[i]<<24|e[i+1]<<16|e[i+2]<<8|u}return{srcPos:t+s,destPos:r}}var _s=`
|
|
4
|
+
struct Uniforms {
|
|
5
|
+
offsetX : f32,
|
|
6
|
+
offsetY : f32,
|
|
7
|
+
scaleX : f32,
|
|
8
|
+
scaleY : f32,
|
|
9
|
+
paddedWidth : f32,
|
|
10
|
+
paddedHeight : f32,
|
|
11
|
+
borderSize : f32,
|
|
12
|
+
_pad : f32,
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
@group(0) @binding(0) var<uniform> u : Uniforms;
|
|
16
|
+
|
|
17
|
+
struct VertexInput {
|
|
18
|
+
@location(0) position : vec2<f32>,
|
|
19
|
+
@location(1) color : vec4<f32>,
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
struct VertexOutput {
|
|
23
|
+
@builtin(position) position : vec4<f32>,
|
|
24
|
+
@location(0) color : vec3<f32>,
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
@vertex
|
|
28
|
+
fn vs_main(in : VertexInput) -> VertexOutput {
|
|
29
|
+
var out : VertexOutput;
|
|
30
|
+
let cx = (in.position.x + u.offsetX) * u.scaleX;
|
|
31
|
+
let cy = (in.position.y + u.offsetY) * u.scaleY;
|
|
32
|
+
out.position = vec4<f32>(
|
|
33
|
+
((cx + u.borderSize) / u.paddedWidth) * 2.0 - 1.0,
|
|
34
|
+
1.0 - ((cy + u.borderSize) / u.paddedHeight) * 2.0,
|
|
35
|
+
0.0,
|
|
36
|
+
1.0
|
|
37
|
+
);
|
|
38
|
+
out.color = in.color.rgb;
|
|
39
|
+
return out;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
@fragment
|
|
43
|
+
fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
44
|
+
return vec4<f32>(in.color, 1.0);
|
|
45
|
+
}
|
|
46
|
+
`,vs=new class{#e=null;#t=null;#n=null;#r=null;async#i(){if(!globalThis.navigator?.gpu)return!1;try{let e=await navigator.gpu.requestAdapter();return e?(this.#r=navigator.gpu.getPreferredCanvasFormat(),this.#t=await e.requestDevice(),!0):!1}catch{return!1}}init(){return this.#e||=this.#i()}get isReady(){return this.#t!==null}loadMeshShader(){if(!this.#t||this.#n)return;let e=this.#t.createShaderModule({code:_s});this.#n=this.#t.createRenderPipeline({layout:`auto`,vertex:{module:e,entryPoint:`vs_main`,buffers:[{arrayStride:8,attributes:[{shaderLocation:0,offset:0,format:`float32x2`}]},{arrayStride:4,attributes:[{shaderLocation:1,offset:0,format:`unorm8x4`}]}]},fragment:{module:e,entryPoint:`fs_main`,targets:[{format:this.#r}]},primitive:{topology:`triangle-list`}})}draw(e,t,n,r,i,a,o,s){this.loadMeshShader();let c=this.#t,{offsetX:l,offsetY:u,scaleX:d,scaleY:f}=r,p=c.createBuffer({size:Math.max(e.byteLength,4),usage:GPUBufferUsage.VERTEX|GPUBufferUsage.COPY_DST});e.byteLength>0&&c.queue.writeBuffer(p,0,e);let m=c.createBuffer({size:Math.max(t.byteLength,4),usage:GPUBufferUsage.VERTEX|GPUBufferUsage.COPY_DST});t.byteLength>0&&c.queue.writeBuffer(m,0,t);let h=c.createBuffer({size:32,usage:GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST});c.queue.writeBuffer(h,0,new Float32Array([l,u,d,f,a,o,s,0]));let g=c.createBindGroup({layout:this.#n.getBindGroupLayout(0),entries:[{binding:0,resource:{buffer:h}}]}),_=new OffscreenCanvas(a,o),v=_.getContext(`webgpu`);v.configure({device:c,format:this.#r,alphaMode:i?`opaque`:`premultiplied`});let y=i?{r:i[0]/255,g:i[1]/255,b:i[2]/255,a:1}:{r:0,g:0,b:0,a:0},b=c.createCommandEncoder(),x=b.beginRenderPass({colorAttachments:[{view:v.getCurrentTexture().createView(),clearValue:y,loadOp:`clear`,storeOp:`store`}]});return n>0&&(x.setPipeline(this.#n),x.setBindGroup(0,g),x.setVertexBuffer(0,p),x.setVertexBuffer(1,m),x.draw(n)),x.end(),c.queue.submit([b.finish()]),p.destroy(),m.destroy(),h.destroy(),_.transferToImageBitmap()}};function ys(){return vs.init()}function bs(){return vs.isReady}function xs(){vs.loadMeshShader()}function Ss(e,t,n,r,i,a,o,s){return vs.draw(e,t,n,r,i,a,o,s)}var Cs={FILL:`Fill`,STROKE:`Stroke`,SHADING:`Shading`};function ws(e,t){if(!t)return;let n=t[2]-t[0],r=t[3]-t[1],i=new Path2D;i.rect(t[0],t[1],n,r),e.clip(i)}var Ts=class{matrix=null;isModifyingCurrentTransform(){return!1}getPattern(){Ii("Abstract method `getPattern` called.")}},Es=class extends Ts{constructor(e){super(),this._type=e[1],this._bbox=e[2],this._colorStops=e[3],this._p0=e[4],this._p1=e[5],this._r0=e[6],this._r1=e[7]}isOriginBased(){return this._p0[0]===0&&this._p0[1]===0&&(!this.isRadial()||this._p1[0]===0&&this._p1[1]===0)}isRadial(){return this._type===`radial`}areConic(){if(!this.isRadial())return!1;let e=Math.hypot(this._p0[0]-this._p1[0],this._p0[1]-this._p1[1]);return e+this._r1>this._r0&&e+this._r0>this._r1}_createGradient(e,t=null){let n,r=this._p0,i=this._p1;if(t&&(r=r.slice(),i=i.slice(),U.applyTransform(r,t),U.applyTransform(i,t)),this._type===`axial`)n=e.createLinearGradient(r[0],r[1],i[0],i[1]);else if(this._type===`radial`){let a=this._r0,o=this._r1;if(t){let e=new Float32Array(2);U.singularValueDecompose2dScale(t,e),a*=e[0],o*=e[0]}n=e.createRadialGradient(r[0],r[1],a,i[0],i[1],o)}for(let e of this._colorStops)n.addColorStop(e[0],e[1]);return n}_createReversedGradient(e,t=null){let n=this._p1,r=this._p0;t&&(n=n.slice(),r=r.slice(),U.applyTransform(n,t),U.applyTransform(r,t));let i=this._r1,a=this._r0;if(t){let e=new Float32Array(2);U.singularValueDecompose2dScale(t,e),i*=e[0],a*=e[0]}let o=e.createRadialGradient(n[0],n[1],i,r[0],r[1],a),s=this._colorStops.map(([e,t])=>[1-e,t]).reverse();for(let[e,t]of s)o.addColorStop(e,t);return o}_createRasterPattern(e,t,n,r,i,a){let o=Math.ceil(r[2]-r[0])||1,s=Math.ceil(r[3]-r[1])||1,c=t.canvasFactory.create(o,s),l=c.context;l.clearRect(0,0,o,s),l.beginPath(),l.rect(0,0,o,s),l.translate(-r[0],-r[1]),n=U.transform(n,[1,0,0,1,r[0],r[1]]),l.transform(...i),ws(l,this._bbox),this.areConic()&&(l.fillStyle=this._createReversedGradient(l),l.fill()),l.fillStyle=this._createGradient(l),l.fill(),a?.applyToCanvas(l);let u=e.createPattern(c.canvas,`no-repeat`);return t.canvasFactory.destroy(c),u.setTransform(new DOMMatrix(n)),u}getPattern(e,t,n,r){let i=t.current.transferMapsFallback;if(r===Cs.STROKE||r===Cs.FILL){if(this.isOriginBased()&&!i){let r=U.transform(n,t.baseTransform);this.matrix&&(r=U.transform(r,this.matrix));let i=.001,a=Math.hypot(r[0],r[1]),o=Math.hypot(r[2],r[3]),s=(r[0]*r[2]+r[1]*r[3])/(a*o);if(Math.abs(s)<i){if(this.isRadial()){if(Math.abs(a-o)<i)return this._createGradient(e,r)}else return this._createGradient(e,r)}}let a=t.current.getClippedPathBoundingBox(r,ka(e))||[0,0,0,0],o=this.matrix?U.transform(t.baseTransform,this.matrix):t.baseTransform;return this._createRasterPattern(e,t,n,a,o,i)}return i&&n?this._createRasterPattern(e,t,n,t.current.clipBox,ka(e),i):(this.areConic()&&(e.save(),ws(e,this._bbox),e.fillStyle=this._createReversedGradient(e),e.fillRect(-1e10,-1e10,2e10,2e10),e.restore()),ws(e,this._bbox),this._createGradient(e))}};function Ds(e,t,n,r,i,a,o,s){let c=t.coords,l=t.colors,u=e.data,d=e.width*4,f;c[n*2+1]>c[r*2+1]&&(f=n,n=r,r=f,f=a,a=o,o=f),c[r*2+1]>c[i*2+1]&&(f=r,r=i,i=f,f=o,o=s,s=f),c[n*2+1]>c[r*2+1]&&(f=n,n=r,r=f,f=a,a=o,o=f);let p=(c[n*2]+t.offsetX)*t.scaleX,m=(c[n*2+1]+t.offsetY)*t.scaleY,h=(c[r*2]+t.offsetX)*t.scaleX,g=(c[r*2+1]+t.offsetY)*t.scaleY,_=(c[i*2]+t.offsetX)*t.scaleX,v=(c[i*2+1]+t.offsetY)*t.scaleY;if(m>=v)return;let y=l[a*4],b=l[a*4+1],x=l[a*4+2],S=l[o*4],C=l[o*4+1],w=l[o*4+2],T=l[s*4],E=l[s*4+1],D=l[s*4+2],O=Math.round(m),k=Math.round(v),A,j,M,N,P,ee,te,ne;for(let e=O;e<=k;e++){if(e<g){let t=e<m?0:(m-e)/(m-g);A=p-(p-h)*t,j=y-(y-S)*t,M=b-(b-C)*t,N=x-(x-w)*t}else{let t;t=e>v?1:g===v?0:(g-e)/(g-v),A=h-(h-_)*t,j=S-(S-T)*t,M=C-(C-E)*t,N=w-(w-D)*t}let t;t=e<m?0:e>v?1:(m-e)/(m-v),P=p-(p-_)*t,ee=y-(y-T)*t,te=b-(b-E)*t,ne=x-(x-D)*t;let n=Math.round(Math.min(A,P)),r=Math.round(Math.max(A,P)),i=d*e+n*4;for(let e=n;e<=r;e++)t=(A-e)/(A-P),t<0?t=0:t>1&&(t=1),u[i++]=j-(j-ee)*t|0,u[i++]=M-(M-te)*t|0,u[i++]=N-(N-ne)*t|0,u[i++]=255}}var Os=class extends Ts{constructor(e){super(),this._posData=e[2],this._colData=e[3],this._vertexCount=e[4],this._bounds=e[5],this._bbox=e[6],this._background=e[7],xs()}_createMeshCanvas(e,t,n,r=null){let i=1.1,a=3e3,o=Math.floor(this._bounds[0]),s=Math.floor(this._bounds[1]),c=Math.ceil(this._bounds[2])-o,l=Math.ceil(this._bounds[3])-s,u=Math.min(Math.ceil(Math.abs(c*e[0]*i)),a)||1,d=Math.min(Math.ceil(Math.abs(l*e[1]*i)),a)||1,f=c?c/u:1,p=l?l/d:1,m={coords:this._posData,colors:this._colData,offsetX:-o,offsetY:-s,scaleX:1/f,scaleY:1/p},h=u+4,g=d+4,_=n.create(h,g);if(bs()&&this._vertexCount>48)_.context.drawImage(Ss(this._posData,this._colData,this._vertexCount,m,t,h,g,2),0,0);else{let e=_.context.createImageData(u,d);if(t){let n=e.data;for(let e=0,r=n.length;e<r;e+=4)n[e]=t[0],n[e+1]=t[1],n[e+2]=t[2],n[e+3]=255}for(let t=0,n=this._vertexCount;t<n;t+=3)Ds(e,m,t,t+1,t+2,t,t+1,t+2);_.context.putImageData(e,2,2)}return r?.applyToCanvas(_.context),{canvas:_.canvas,offsetX:o-2*f,offsetY:s-2*p,scaleX:f,scaleY:p}}isModifyingCurrentTransform(){return!0}getPattern(e,t,n,r){ws(e,this._bbox);let i=new Float32Array(2);if(r===Cs.SHADING)U.singularValueDecompose2dScale(ka(e),i);else if(this.matrix){U.singularValueDecompose2dScale(this.matrix,i);let[e,n]=i;U.singularValueDecompose2dScale(t.baseTransform,i),i[0]*=e,i[1]*=n}else U.singularValueDecompose2dScale(t.baseTransform,i);let a=this._createMeshCanvas(i,r===Cs.SHADING?null:this._background,t.canvasFactory,t.current.transferMapsFallback);r!==Cs.SHADING&&(e.setTransform(...t.baseTransform),this.matrix&&e.transform(...this.matrix)),e.translate(a.offsetX,a.offsetY),e.scale(a.scaleX,a.scaleY);let o=e.createPattern(a.canvas,`no-repeat`);return t.canvasFactory.destroy(a),o}},ks=class extends Ts{getPattern(){return`hotpink`}};function As(e){switch(e[0]){case`RadialAxial`:return new Es(e);case`Mesh`:return new Os(e);case`Dummy`:return new ks}throw Error(`Unknown IR type: ${e[0]}`)}var js={COLORED:1,UNCOLORED:2},Ms=class e{static MAX_PATTERN_SIZE=3e3;constructor(e,t,n,r){this.color=e[1],this.operatorList=e[2],this.matrix=e[3],this.bbox=e[4],this.xstep=e[5],this.ystep=e[6],this.paintType=e[7],this.tilingType=e[8],this.needsIsolation=e[9]??!0,this.ctx=t,this.canvasGraphicsFactory=n,this.baseTransform=r,this.patternBaseMatrix=this.matrix?U.transform(r,this.matrix):r}canSkipPatternCanvas([e,t,n,r]){let[i,a,o,s]=this.bbox,c=Math.abs(this.xstep),l=Math.abs(this.ystep);if(e>c+1e-6||t>l+1e-6)return null;let u=Math.floor((n-o)/c)+1,d=Math.ceil((n+e-i)/c)-1,f=Math.floor((r-s)/l)+1,p=Math.ceil((r+t-a)/l)-1;return d<=u&&p<=f?[u,f]:null}updatePatternDims(e,t){let n=fi.slice();U.axialAlignedBoundingBox(e,U.inverseTransform(this.patternBaseMatrix),n),t[0]=n[2]-n[0],t[1]=n[3]-n[1],t[2]=n[0],t[3]=n[1]}_renderTileCanvas(e,t,n,r){let[i,a,o,s]=this.bbox,c=e.canvasFactory.create(n.size,r.size),l=c.context,u=this.canvasGraphicsFactory.createCanvasGraphics(l,t);return u.groupLevel=e.groupLevel,u.current.transferMapsFallback=e.current.transferMapsFallback,this.setFillAndStrokeStyleToContext(u,this.paintType,this.color),l.translate(-n.scale*i,-r.scale*a),u.transform(0,n.scale,0,0,r.scale,0,0),l.save(),u.dependencyTracker?.save(),this.clipBbox(u,i,a,o,s),u.baseTransform=ka(u.ctx),u.executeOperatorList(this.operatorList),u.endDrawing(),u.dependencyTracker?.restore(),l.restore(),c}_getCombinedScales(){let e=new Float32Array(2);U.singularValueDecompose2dScale(this.matrix,e);let[t,n]=e;return U.singularValueDecompose2dScale(this.baseTransform,e),[t*e[0],n*e[1]]}drawPattern(e,t,n=!1,[r,i],a){let[o,s,c,l]=this.bbox,u=e.dependencyTracker;if(u&&(e.dependencyTracker=new Oo(u,a)),e.save(),n?e.ctx.clip(t,`evenodd`):e.ctx.clip(t),e.ctx.setTransform(...this.patternBaseMatrix),e.ctx.translate(r*this.xstep,i*this.ystep),this.needsIsolation||e.ctx.globalAlpha!==1||e.ctx.globalCompositeOperation!==`source-over`||e.inSMaskMode){let t=c-o,n=l-s,[r,i]=this._getCombinedScales(),u=this.getSizeAndScale(t,this.ctx.canvas.width,r),d=this.getSizeAndScale(n,this.ctx.canvas.height,i),f=this._renderTileCanvas(e,a,u,d);e.ctx.drawImage(f.canvas,o,s,t,n),e.canvasFactory.destroy(f)}else this.setFillAndStrokeStyleToContext(e,this.paintType,this.color),this.clipBbox(e,o,s,c,l),e.baseTransformStack.push(e.baseTransform),e.baseTransform=ka(e.ctx),e.executeOperatorList(this.operatorList),e.baseTransform=e.baseTransformStack.pop();e.restore(),u&&(e.dependencyTracker=u)}createPatternCanvas(e,t){let[n,r,i,a]=this.bbox,o=i-n,s=a-r,{xstep:c,ystep:l}=this;c=Math.abs(c),l=Math.abs(l),Pi(`TilingType: `+this.tilingType);let[u,d]=this._getCombinedScales(),f=o,p=s,m=!1,h=!1;Math.ceil(c*u)>=Math.ceil(o*u)?f=c:m=!0,Math.ceil(l*d)>=Math.ceil(s*d)?p=l:h=!0;let g=this.getSizeAndScale(f,this.ctx.canvas.width,u),_=this.getSizeAndScale(p,this.ctx.canvas.height,d),v=this._renderTileCanvas(e,t,g,_);if(m||h){let t=v.canvas;m&&(f=c),h&&(p=l);let i=this.getSizeAndScale(f,this.ctx.canvas.width,u),a=this.getSizeAndScale(p,this.ctx.canvas.height,d),g=i.size,_=a.size,y=e.canvasFactory.create(g,_),b=y.context,x=m?Math.min(Math.floor(o/c),Math.ceil(t.width/g)):0,S=h?Math.min(Math.floor(s/l),Math.ceil(t.height/_)):0,C=t,w=null;if(h){w=e.canvasFactory.create(t.width,_);let n=w.context;for(let e=S;e>=0;e--)n.drawImage(t,0,_*e,t.width,_,0,0,t.width,_);C=w.canvas}for(let e=x;e>=0;e--)b.drawImage(C,g*e,0,g,_,0,0,g,_);return w&&e.canvasFactory.destroy(w),e.canvasFactory.destroy(v),{canvas:y.canvas,canvasEntry:y,scaleX:i.scale,scaleY:a.scale,offsetX:n,offsetY:r}}return{canvas:v.canvas,canvasEntry:v,scaleX:g.scale,scaleY:_.scale,offsetX:n,offsetY:r}}getSizeAndScale(t,n,r){let i=Math.max(e.MAX_PATTERN_SIZE,n),a=Math.ceil(t*r);return a>=i?a=i:r=a/t,{scale:r,size:a}}clipBbox(e,t,n,r,i){let a=r-t,o=i-n,s=new Path2D;s.rect(t,n,a,o),U.axialAlignedBoundingBox([t,n,r,i],ka(e.ctx),e.current.minMax),e.ctx.clip(s),e.current.updateClipFromPath()}setFillAndStrokeStyleToContext(e,t,n){switch(t){case js.COLORED:n=`#000000`;break;case js.UNCOLORED:break;default:throw new qi(`Unsupported paint type: ${t}`)}let{ctx:r,current:i}=e;i.patternFill=i.patternStroke=!1,r.fillStyle=r.strokeStyle=i.transferMapsFallback?.applyToColor(n)??n,i.fillColor=i.strokeColor=n}isModifyingCurrentTransform(){return!1}getPattern(e,t,n,r,i){let a=r===Cs.SHADING?n:U.transform(n,this.patternBaseMatrix),o=this.createPatternCanvas(t,i),s=new DOMMatrix(a);s=s.translate(o.offsetX,o.offsetY),s=s.scale(1/o.scaleX,1/o.scaleY);let c=e.createPattern(o.canvas,`repeat`);return t.canvasFactory.destroy(o.canvasEntry),c.setTransform(s),c}},Ns=16,Ps=100,Fs=15,Is=10,Ls=16,Rs=new Float32Array(2);function zs(e,t){if(e._removeMirroring)throw Error(`Context is already forwarding operations.`);let n=new Map;for(let r of[`save`,`restore`,`rotate`,`scale`,`translate`,`transform`,`setTransform`,`resetTransform`,`clip`,`moveTo`,`lineTo`,`bezierCurveTo`,`quadraticCurveTo`,`arc`,`arcTo`,`ellipse`,`rect`,`roundRect`,`closePath`,`beginPath`]){let i=e[r];typeof i==`function`&&typeof t[r]==`function`&&(n.set(r,i),e[r]=function(...e){return t[r](...e),i.apply(this,e)})}e._removeMirroring=()=>{for(let[t,r]of n)e[t]=r;delete e._removeMirroring}}function Bs(e,t,n,r,i,a,o,s,c,l){let[u,d,f,p,m,h]=ka(e);if(d===0&&f===0){let g=o*u+m,_=Math.round(g),v=s*p+h,y=Math.round(v),b=(o+c)*u+m,x=Math.abs(Math.round(b)-_)||1,S=(s+l)*p+h,C=Math.abs(Math.round(S)-y)||1;return e.setTransform(Math.sign(u),0,0,Math.sign(p),_,y),e.drawImage(t,n,r,i,a,0,0,x,C),e.setTransform(u,d,f,p,m,h),[x,C]}if(u===0&&p===0){let g=s*f+m,_=Math.round(g),v=o*d+h,y=Math.round(v),b=(s+l)*f+m,x=Math.abs(Math.round(b)-_)||1,S=(o+c)*d+h,C=Math.abs(Math.round(S)-y)||1;return e.setTransform(0,Math.sign(d),Math.sign(f),0,_,y),e.drawImage(t,n,r,i,a,0,0,C,x),e.setTransform(u,d,f,p,m,h),[C,x]}e.drawImage(t,n,r,i,a,o,s,c,l);let g=Math.hypot(u,d),_=Math.hypot(f,p);return[g*c,_*l]}var Vs=class{alphaIsShape=!1;fontSize=0;fontSizeScale=1;textMatrix=null;textMatrixScale=1;fontMatrix=mi;leading=0;x=0;y=0;lineX=0;lineY=0;charSpacing=0;wordSpacing=0;textHScale=1;textRenderingMode=Ci.FILL;textRise=0;fillColor=`#000000`;strokeColor=`#000000`;tilingPatternDims=null;patternFill=!1;patternStroke=!1;fillAlpha=1;strokeAlpha=1;lineWidth=1;activeSMask=null;transferMaps=`none`;transferMapsFallback=null;minMax=pi.slice();constructor(e,t){this.clipBox=new Float32Array([0,0,e,t])}clone(){let e=Object.create(this);return e.clipBox=this.clipBox.slice(),e.minMax=this.minMax.slice(),e.tilingPatternDims=this.tilingPatternDims?.slice(),e}getPathBoundingBox(e=Cs.FILL,t=null){let n=this.minMax.slice();if(e===Cs.STROKE){t||Ii(`Stroke bounding box must include transform.`),U.singularValueDecompose2dScale(t,Rs);let e=Rs[0]*this.lineWidth/2,r=Rs[1]*this.lineWidth/2;n[0]-=e,n[1]-=r,n[2]+=e,n[3]+=r}return n}updateClipFromPath(){let e=U.intersect(this.clipBox,this.getPathBoundingBox());this.startNewPathAndClipBox(e||[0,0,0,0])}isEmptyClip(){return this.minMax[0]===1/0}startNewPathAndClipBox(e){this.clipBox.set(e,0),this.minMax.set(pi,0)}getClippedPathBoundingBox(e=Cs.FILL,t=null){return U.intersect(this.clipBox,this.getPathBoundingBox(e,t))}};function Hs(e,t){let{width:n,height:r,kind:i}=t,a=r%Ls,o=(r-a)/Ls,s=a===0?o:o+1,c=e.createImageData(n,Ls),l=0,u=t.data,d=c.data,f;if(i===wi.GRAYSCALE_1BPP)for(f=0;f<s;f++)({srcPos:l}=hs({src:u,srcPos:l,dest:d,width:n,height:f<o?Ls:a})),e.putImageData(c,0,f*Ls);else if(i===wi.RGBA_32BPP){let t=0,r=n*Ls*4;for(f=0;f<o;f++)d.set(u.subarray(l,l+r)),l+=r,e.putImageData(c,0,t),t+=Ls;f<s&&(r=n*a*4,d.set(u.subarray(l,l+r)),e.putImageData(c,0,t))}else if(i===wi.RGB_24BPP)for(f=0;f<s;f++)({srcPos:l}=gs({src:u,srcPos:l,dest:new Uint32Array(d.buffer),width:n,height:f<o?Ls:a})),e.putImageData(c,0,f*Ls);else throw Error(`bad image kind: ${i}`)}function Us(e,t){if(t.bitmap){e.drawImage(t.bitmap,0,0);return}let{width:n,height:r}=t,i=r%Ls,a=(r-i)/Ls,o=i===0?a:a+1,s=e.createImageData(n,Ls),c=0,l=t.data,u=s.data;for(let t=0;t<o;t++)({srcPos:c}=hs({src:l,srcPos:c,dest:u,width:n,height:t<a?Ls:i,nonBlackColor:0})),e.putImageData(s,0,t*Ls)}function Ws(e,t){for(let n of[`strokeStyle`,`fillStyle`,`fillRule`,`globalAlpha`,`lineWidth`,`lineCap`,`lineJoin`,`miterLimit`,`globalCompositeOperation`,`font`,`filter`])e[n]!==void 0&&(t[n]=e[n]);e.setLineDash!==void 0&&(t.setLineDash(e.getLineDash()),t.lineDashOffset=e.lineDashOffset)}function Gs(e){e.strokeStyle=e.fillStyle=`#000000`,e.fillRule=`nonzero`,e.globalAlpha=1,e.lineWidth=1,e.lineCap=`butt`,e.lineJoin=`miter`,e.miterLimit=10,e.globalCompositeOperation=`source-over`,e.font=`10px sans-serif`,e.setLineDash!==void 0&&(e.setLineDash([]),e.lineDashOffset=0);let{filter:t}=e;t!==`none`&&t!==``&&(e.filter=`none`)}var Ks=class e{#e;constructor(t){let[n,r=n,i=n]=t,{identityMap:a}=e;this.#e=[n||a,r||a,i||a]}static get identityMap(){return H(this,`identityMap`,Uint8Array.from({length:256},(e,t)=>t))}applyToColor(e){if(typeof e!=`string`||!e.startsWith(`#`))return e;let[t,n,r]=Ea(e),[i,a,o]=this.#e;return U.makeHexColor(i[t],a[n],o[r])}applyToImageData({data:e}){let[t,n,r]=this.#e;for(let i=0,a=e.length;i<a;i+=4)e[i]=t[e[i]],e[i+1]=n[e[i+1]],e[i+2]=r[e[i+2]]}applyToCanvas(e){let{width:t,height:n}=e.canvas,r=e.getImageData(0,0,t,n);this.applyToImageData(r),e.putImageData(r,0,0)}};function qs(e,t){if(t)return!0;U.singularValueDecompose2dScale(e,Rs);let n=Math.fround(Ma.pixelRatio*ma.PDF_TO_CSS_UNITS);return Rs[0]<=n&&Rs[1]<=n}var Js=[`butt`,`round`,`square`],Ys=[`miter`,`round`,`bevel`],Xs={},Zs={},Qs=class e{static#e=null;#t=0;#n=0;#r=null;#i=null;#a=null;#o=null;#s=1;#c;#l=null;#u=[];constructor(e,t,n,r,i,{optionalContentConfig:a,markedContentStack:o=null},s,c,l,u){this.ctx=e,this.current=new Vs(this.ctx.canvas.width,this.ctx.canvas.height),this.stateStack=[],this.pendingClip=null,this.pendingEOFill=!1,this.commonObjs=t,this.objs=n,this.canvasFactory=r,this.filterFactory=i,this.groupStack=[],this.baseTransform=null,this.baseTransformStack=[],this.groupLevel=0,this.smaskStack=[],this.tempSMask=null,this.smaskGroupCanvases=[],this.smaskPreparedEntry=null,this.smaskPreparedFor=null,this.smaskPreparedOffsetX=0,this.smaskPreparedOffsetY=0,this.smaskPreparedOOBAlpha=null,this.suspendedCtx=null,this.contentVisible=!0,this.markedContentStack=o||[],this.optionalContentConfig=a,this.cachedPatterns=new Map,this.annotationCanvasMap=s,this.viewportScale=1,this.outputScaleX=1,this.outputScaleY=1,this.pageColors=c,this._cachedScaleForStroking=[-1,0],this._cachedBitmapsMap=new Map,this.dependencyTracker=l??null,this.imagesTracker=u??null}getObject(e,t,n=null){return typeof t==`string`?(this.dependencyTracker?.recordNamedDependency(e,t),t.startsWith(`g_`)?this.commonObjs.get(t):this.objs.get(t)):n}beginDrawing({transform:e,viewport:t,transparency:n=!1,background:r=null}){let i=this.ctx.canvas.width,a=this.ctx.canvas.height,o=this.ctx.fillStyle;if(this.ctx.fillStyle=r||`#ffffff`,this.ctx.fillRect(0,0,i,a),this.ctx.fillStyle=o,n){let e=this.transparentCanvasEntry=this.canvasFactory.create(i,a);this.compositeCtx=this.ctx,{canvas:this.transparentCanvas,context:this.ctx}=e,this.ctx.save(),this.ctx.transform(...ka(this.compositeCtx))}this.ctx.save(),Gs(this.ctx),e&&(this.ctx.transform(...e),this.outputScaleX=e[0],this.outputScaleY=e[3]),this.ctx.transform(...t.transform),this.viewportScale=t.scale,this.baseTransform=ka(this.ctx)}executeOperatorList(e,t,n,r,i){let a=e.argsArray,o=e.fnArray,s=t||0,c=a.length;if(c===s)return s;let l=c-s>Is&&typeof n==`function`,u=l?Date.now()+Fs:0,d=0,f=this.commonObjs,p=this.objs,m,h;for(;;){if(r!==void 0){if(s===r.nextBreakPoint)return r.breakIt(s,n),s;if(r.shouldSkip(s)){if(++s===c)return s;continue}}if(!i||i(s,e)){if(m=o[s],h=a[s]??null,m!==Oi.dependency)h===null?this[m](s):this[m](s,...h);else for(let e of h){this.dependencyTracker?.recordNamedData(e,s);let t=e.startsWith(`g_`)?f:p;if(!t.has(e))return t.get(e,n),s}}if(s++,s===c)return s;if(l&&++d>Is){if(Date.now()>u)return n(),s;d=0}}}#d(){for(;this.stateStack.length||this.inSMaskMode;)this.restore();this.current.activeSMask=null,this.ctx.restore(),this.transparentCanvas&&(this.ctx=this.compositeCtx,this.ctx.save(),this.ctx.setTransform(1,0,0,1,0,0),this.ctx.drawImage(this.transparentCanvas,0,0),this.ctx.restore(),this.canvasFactory.destroy(this.transparentCanvasEntry),this.transparentCanvas=null,this.transparentCanvasEntry=null)}endDrawing(){this.#d();for(let e of this.smaskGroupCanvases)this.canvasFactory.destroy(e);this.smaskGroupCanvases.length=0,this._clearPreparedSMask(),this.tempSMask=null,this.smaskStack.length=0;for(let e of this.#u)this.#x(e);this.#u.length=0,this.#r=null,this.#i=null,this.#a=null,this.#o=null,this.#s=1,this.#l=null,this.#n=0,this.#t=0,this.cachedPatterns.clear();for(let e of this._cachedBitmapsMap.values()){for(let t of e.values())typeof HTMLCanvasElement<`u`&&t instanceof HTMLCanvasElement&&(t.width=t.height=0);e.clear()}this._cachedBitmapsMap.clear(),this.#f()}#f(){if(this.pageColors){let e=this.filterFactory.addHCMFilter(this.pageColors.foreground,this.pageColors.background);if(e!==`none`){let t=this.ctx.filter;this.ctx.filter=e,this.ctx.drawImage(this.ctx.canvas,0,0),this.ctx.filter=t}}}_scaleImage(e,t){let n=e.width??e.displayWidth,r=e.height??e.displayHeight,i=Math.max(Math.hypot(t[0],t[1]),1),a=Math.max(Math.hypot(t[2],t[3]),1),o=[],s=i,c=a,l=n,u=r;for(;s>2&&l>1||c>2&&u>1;){let e=l,t=u;s>2&&l>1&&(e=Math.ceil(l/2),s/=l/e),c>2&&u>1&&(t=Math.ceil(u/2),c/=u/t),o.push({newWidth:e,newHeight:t}),l=e,u=t}if(o.length===0)return{img:e,paintWidth:n,paintHeight:r,tmpCanvas:null};if(o.length===1){let{newWidth:t,newHeight:i}=o[0],a=this.canvasFactory.create(t,i);return a.context.drawImage(e,0,0,n,r,0,0,t,i),{img:a.canvas,paintWidth:t,paintHeight:i,tmpCanvas:a}}let d=this.canvasFactory.create(1,1),f=this.canvasFactory.create(1,1),p=n,m=r,h=e;for(let{newWidth:e,newHeight:t}of o)this.canvasFactory.reset(f,e,t),f.context.drawImage(h,0,0,p,m,0,0,e,t),[d,f]=[f,d],h=d.canvas,p=e,m=t;return this.canvasFactory.destroy(f),{img:d.canvas,paintWidth:p,paintHeight:m,tmpCanvas:d}}_createMaskCanvas(e,t){let n=this.ctx,{width:r,height:i}=t,a=this.current.patternFill,o=a?this.current.fillColor:n.fillStyle,s=ka(n),c,l,u,d;if((t.bitmap||t.data)&&t.count>1){let n=t.bitmap||t.data.buffer;l=JSON.stringify(a?s:[s.slice(0,4),o]),c=this._cachedBitmapsMap.getOrInsertComputed(n,aa);let r=c.get(l);if(r&&!a){let t=Math.round(Math.min(s[0],s[2])+s[4]),n=Math.round(Math.min(s[1],s[3])+s[5]);return this.dependencyTracker?.recordDependencies(e,ko.transformAndFill),{canvas:r,offsetX:t,offsetY:n}}u=r}u||(d=this.canvasFactory.create(r,i),Us(d.context,t));let f=U.transform(s,[1/r,0,0,-1/i,0,0]);f=U.transform(f,[1,0,0,1,0,-i]);let p=pi.slice();U.axialAlignedBoundingBox([0,0,r,i],f,p);let[m,h,g,_]=p,v=Math.round(g-m)||1,y=Math.round(_-h)||1,b=this.canvasFactory.create(v,y),x=b.context,S=m,C=h;x.translate(-S,-C),x.transform(...f);let w=null;if(!u){let e=this._scaleImage(d.canvas,Aa(x));u=e.img,w=e.tmpCanvas,u!==d.canvas&&(this.canvasFactory.destroy(d),d=null),c&&a&&(c.set(l,u),w=null,d=null)}x.imageSmoothingEnabled=qs(ka(x),t.interpolate),Bs(x,u,0,0,u.width,u.height,0,0,r,i),w&&this.canvasFactory.destroy(w),d&&this.canvasFactory.destroy(d),x.globalCompositeOperation=`source-in`;let T=U.transform(Aa(x),[1,0,0,1,-S,-C]);return x.fillStyle=a?o.getPattern(n,this,T,Cs.FILL,e):o,x.fillRect(0,0,r,i),c&&!a&&c.set(l,b.canvas),this.dependencyTracker?.recordDependencies(e,ko.transformAndFill),{canvas:b.canvas,canvasEntry:c&&!a?null:b,offsetX:Math.round(S),offsetY:Math.round(C)}}setLineWidth(e,t){this.dependencyTracker?.recordSimpleData(`lineWidth`,e),t!==this.current.lineWidth&&(this._cachedScaleForStroking[0]=-1),this.current.lineWidth=t,this.ctx.lineWidth=t}setLineCap(e,t){this.dependencyTracker?.recordSimpleData(`lineCap`,e),this.ctx.lineCap=Js[t]}setLineJoin(e,t){this.dependencyTracker?.recordSimpleData(`lineJoin`,e),this.ctx.lineJoin=Ys[t]}setMiterLimit(e,t){this.dependencyTracker?.recordSimpleData(`miterLimit`,e),this.ctx.miterLimit=t}setDash(e,t,n){this.dependencyTracker?.recordSimpleData(`dash`,e);let r=this.ctx;r.setLineDash!==void 0&&(r.setLineDash(t),r.lineDashOffset=n)}setRenderingIntent(e,t){}setFlatness(e,t){}setGState(e,t){for(let[n,r]of t)switch(n){case`LW`:this.setLineWidth(e,r);break;case`LC`:this.setLineCap(e,r);break;case`LJ`:this.setLineJoin(e,r);break;case`ML`:this.setMiterLimit(e,r);break;case`D`:this.setDash(e,r[0],r[1]);break;case`RI`:this.setRenderingIntent(e,r);break;case`FL`:this.setFlatness(e,r);break;case`Font`:this.setFont(e,r[0],r[1]);break;case`CA`:this.dependencyTracker?.recordSimpleData(`strokeAlpha`,e),this.current.strokeAlpha=r;break;case`ca`:this.dependencyTracker?.recordSimpleData(`fillAlpha`,e),this.ctx.globalAlpha=this.current.fillAlpha=r;break;case`BM`:this.dependencyTracker?.recordSimpleData(`globalCompositeOperation`,e),this.ctx.globalCompositeOperation=r;break;case`SMask`:this.dependencyTracker?.recordSimpleData(`SMask`,e),this.current.activeSMask=r?this.tempSMask:null,this.current.activeSMask&&(this.current.activeSMask.blendMode=this.ctx.globalCompositeOperation),this.tempSMask=null,this.checkSMaskState(e);break;case`TR`:{this.dependencyTracker?.recordSimpleData(`filter`,e);let t=this.filterFactory.addFilter(r);this.ctx.filter=t;let n=null;r&&(t===`none`||!Zi.isCanvasFilterSupported||this.ctx.filter===`none`||this.ctx.filter===``)&&(this.ctx.filter=t=`none`,n=new Ks(r)),this.current.transferMaps=t,(n||this.current.transferMapsFallback)&&(this.current.transferMapsFallback=n,this.current.patternFill||(this.ctx.fillStyle=this.#y(this.current.fillColor)),this.current.patternStroke||(this.ctx.strokeStyle=this.#y(this.current.strokeColor)));break}}}get inSMaskMode(){return!!this.suspendedCtx}_clearPreparedSMask(){this.smaskPreparedEntry&&=(this.canvasFactory.destroy(this.smaskPreparedEntry),null),this.smaskPreparedFor=null,this.smaskPreparedOffsetX=0,this.smaskPreparedOffsetY=0,this.smaskPreparedOOBAlpha=null}_ensurePreparedSMask(e){e!==this.smaskPreparedFor&&(this._clearPreparedSMask(),this._prepareSMaskCanvas(e))}checkSMaskState(e){let t=this.inSMaskMode;this.current.activeSMask&&!t?this.beginSMaskMode(e):!this.current.activeSMask&&t?this.endSMaskMode():this.current.activeSMask&&t&&this._ensurePreparedSMask(this.current.activeSMask)}_prepareSMaskCanvas(e){let{canvas:t,subtype:n,backdrop:r,transferMap:i}=e,a=n===`Luminosity`||n===`Alpha`&&i;if(!a&&!(n===`Luminosity`&&r)){this.smaskPreparedFor=e;return}let o;if(n===`Luminosity`&&r){let[e,t,n]=Ea(r),a=Math.round(.3*e+.59*t+.11*n);o=i?.[a]??a}else o=i?.[0]??0;let{width:s,height:c}=this.ctx.canvas,l=t.width*t.height,u=s*c<4*l,d=a?{url:n===`Alpha`?this.filterFactory.addAlphaFilter(i):this.filterFactory.addLuminosityFilter(i),subtype:n,transferMap:i}:null,f=n===`Luminosity`?r:null,p,m,h;u?(p=this._bakeSMaskCanvas(t,e.offsetX,e.offsetY,s,c,f,d),m=0,h=0):(p=this._bakeSMaskCanvas(t,0,0,t.width,t.height,f,d),m=e.offsetX,h=e.offsetY),this.smaskPreparedEntry=p,this.smaskPreparedFor=e,this.smaskPreparedOffsetX=m,this.smaskPreparedOffsetY=h,this.smaskPreparedOOBAlpha=!u&&o!==0?o:null}_bakeSMaskCanvas(e,t,n,r,i,a,o){!a&&!o&&Ii(`_bakeSMaskCanvas with neither backdrop nor filter`);let s=this.canvasFactory.create(r,i),c=s.context;if(c.drawImage(e,t,n),a&&(c.globalCompositeOperation=`destination-atop`,c.fillStyle=a,c.fillRect(0,0,r,i)),!o)return s;let l=this.canvasFactory.create(r,i),u=l.context;u.filter=o.url;let d=Zi.isCanvasFilterSupported&&u.filter!==`none`&&u.filter!==``;if(u.drawImage(s.canvas,0,0),Zi.isCanvasFilterSupported&&(u.filter=`none`),!d){let e=u.getImageData(0,0,r,i),{data:t}=e,{transferMap:n}=o;if(o.subtype===`Luminosity`)for(let e=0,r=t.length;e<r;e+=4){let r=.3*t[e]+.59*t[e+1]+.11*t[e+2]+.5|0;t[e]=t[e+1]=t[e+2]=0,t[e+3]=n?.[r]??r}else for(let e=3,r=t.length;e<r;e+=4)t[e]=n[t[e]];u.putImageData(e,0,0)}return this.canvasFactory.destroy(s),l}beginSMaskMode(e){if(this.inSMaskMode)throw Error(`beginSMaskMode called while already in smask mode`);let{width:t,height:n}=this.ctx.canvas,r=this.canvasFactory.create(t,n);this.smaskScratchCanvas=r,this.suspendedCtx=this.ctx;let i=this.ctx=r.context;i.setTransform(this.suspendedCtx.getTransform()),Ws(this.suspendedCtx,i),zs(i,this.suspendedCtx),this._ensurePreparedSMask(this.current.activeSMask),this.setGState(e,[[`BM`,`source-over`]])}endSMaskMode(){if(!this.inSMaskMode)throw Error(`endSMaskMode called while not in smask mode`);this.ctx._removeMirroring(),Ws(this.ctx,this.suspendedCtx),this.ctx=this.suspendedCtx,this.suspendedCtx=null,this.canvasFactory.destroy(this.smaskScratchCanvas),this.smaskScratchCanvas=null,this._clearPreparedSMask()}#p(e,t=null,n=1){let{width:r,height:i}=e,a=t??this.canvasFactory.create(r,i),o=a.context;n=Math.round(n*255)/255;let s=n<1;s&&this.#c===void 0&&(this.#c=Zi.isCanvasFilterSupported?new Map:`none`);let c=`none`;if(s&&this.#c instanceof Map&&(c=this.#c.getOrInsertComputed(n,()=>this.filterFactory.addKnockoutFilter(n))),!s||c!==`none`)return t&&(o.save(),o.setTransform(1,0,0,1,0,0),o.clearRect(0,0,r,i),o.restore()),o.filter=c,o.drawImage(e,0,0),o.filter=`none`,a;let l=e.getContext(`2d`,{willReadFrequently:!0}).getImageData(0,0,r,i),u=o.createImageData(r,i),d=l.data,f=u.data,p=n>0?1/n:1e6;for(let e=3,t=d.length;e<t;e+=4)f[e]=Math.min(Math.round(d[e]*p),255);return o.putImageData(u,0,0),a}#m(e,t,n,r){let i=e?.[t]??null;if(i&&(i.canvas.width!==n||i.canvas.height!==r)&&(this.canvasFactory.destroy(i),i=null),!i)return i=this.canvasFactory.create(n,r),e&&(e[t]=i),i;let a=i.context;return a.save(),a.setTransform(1,0,0,1,0,0),a.clearRect(0,0,n,r),a.restore(),i}#h(e,t,n={}){let{backdropCanvas:r=null,destTransform:i=[1,0,0,1,0,0],backdropOffset:a=[0,0],reuseMaskEntry:o=null,poolMeta:s=null,sourceAlpha:c=1,sourceFilter:l=`none`,knockoutAlpha:u=1}=n,{width:d,height:f}=t,p=this.#p(t,o,u),m=e.globalCompositeOperation;if(e.save(),e.setTransform(...i),e.globalAlpha=1,Zi.isCanvasFilterSupported&&(e.filter=`none`),e.globalCompositeOperation=`destination-out`,e.drawImage(p.canvas,0,0),r){let[t,n]=a,i=this.#m(s,`knockoutBackdropEntry`,d,f),o=i.context;o.drawImage(r,t,n,d,f,0,0,d,f),o.globalCompositeOperation=`destination-in`,o.drawImage(p.canvas,0,0),o.globalCompositeOperation=`source-over`,e.globalCompositeOperation=`destination-over`,e.drawImage(i.canvas,0,0),s||this.canvasFactory.destroy(i)}e.globalCompositeOperation=m,e.globalAlpha=c,Zi.isCanvasFilterSupported&&(e.filter=l??`none`),e.drawImage(t,0,0),e.restore(),o||this.canvasFactory.destroy(p)}#g(e=1){if(this.#t===0||this.#n>0||!this.contentVisible)return!1;this.#n++,this.#s=e;let t=this.#u.at(-1),{canvas:n}=this.ctx,r=this.#m(t,`knockoutTempEntry`,n.width,n.height);this.#r=r;let i=r.context;return i.save(),i.setTransform(this.ctx.getTransform()),Ws(this.ctx,i),this.#o=i.globalCompositeOperation,i.globalCompositeOperation=`source-over`,zs(i,this.ctx),this.#l=t,this.#i=this.ctx,this.#a=this.suspendedCtx,this.ctx=i,this.inSMaskMode&&(this.suspendedCtx=i),!0}#_(e){if(!e)return;let t=this.#r,n=this.#i,r=this.#a,i=t.context;this.#r=null,this.#i=null,this.#a=null,this.inSMaskMode&&this.suspendedCtx===i&&this.ctx!==i&&this.endSMaskMode(),this.inSMaskMode&&(this.suspendedCtx=r),this.ctx._removeMirroring(),this.ctx.globalCompositeOperation=this.#o,this.#o=null,Ws(this.ctx,n),this.ctx=n;let a=this.#l;this.#l=null;let o=this.#s;this.#s=1;try{this.#h(r??n,t.canvas,{backdropCanvas:a?.backdropCtx?.canvas??null,backdropOffset:a?.backdropCtx?[a.offsetX,a.offsetY]:[0,0],reuseMaskEntry:a?.knockoutMaskEntry??null,poolMeta:a,knockoutAlpha:o})}finally{i.restore(),this.#n--,a||this.canvasFactory.destroy(t)}}compose(e){if(!this.current.activeSMask)return;e=e?[Math.floor(e[0]),Math.floor(e[1]),Math.ceil(e[2]),Math.ceil(e[3])]:[0,0,this.ctx.canvas.width,this.ctx.canvas.height];let t=this.current.activeSMask,n=this.suspendedCtx,r=this.#n>0&&n===this.ctx;this.composeSMask(r?null:n,t,this.ctx,e),!r&&(this.ctx.save(),this.ctx.setTransform(1,0,0,1,0,0),this.ctx.clearRect(0,0,this.ctx.canvas.width,this.ctx.canvas.height),this.ctx.restore())}composeSMask(e,t,n,r){let i=r[0],a=r[1],o=r[2]-i,s=r[3]-a;if(o===0||s===0)return;let c=this.smaskPreparedEntry;if(c){let e=i,r=a,l=o,u=s,d=this.smaskPreparedOOBAlpha,f=d!==null;if(f){e=Math.max(i,t.offsetX),r=Math.max(a,t.offsetY);let n=Math.min(i+o,t.offsetX+t.canvas.width),c=Math.min(a+s,t.offsetY+t.canvas.height);l=n-e,u=c-r}if(l>0&&u>0){let t=e-this.smaskPreparedOffsetX,i=r-this.smaskPreparedOffsetY;n.save(),n.globalAlpha=1,n.setTransform(1,0,0,1,0,0);let a=new Path2D;a.rect(e,r,l,u),n.clip(a),n.globalCompositeOperation=`destination-in`,n.drawImage(c.canvas,t,i,l,u,e,r,l,u),n.restore()}f&&d<255&&this._applySMaskOOBAlpha(n,i,a,o,s,e,r,e+l,r+u,d)}else this.genericComposeSMask(t,n,o,s,i,a);e&&(e.save(),e.globalAlpha=1,e.globalCompositeOperation=t.blendMode||`source-over`,e.setTransform(1,0,0,1,0,0),e.drawImage(n.canvas,i,a,o,s,i,a,o,s),e.restore())}_applySMaskOOBAlpha(e,t,n,r,i,a,o,s,c,l){let u=a<s&&o<c;if(u&&a===t&&o===n&&s===t+r&&c===n+i)return;let d=new Path2D;d.rect(t,n,r,i),u&&d.rect(a,o,s-a,c-o),e.save(),e.globalAlpha=l/255,e.setTransform(1,0,0,1,0,0),e.clip(d,`evenodd`),e.globalCompositeOperation=`destination-in`,e.fillStyle=`#000000`,e.fillRect(t,n,r,i),e.restore()}genericComposeSMask(e,t,n,r,i,a){let{context:o,offsetX:s,offsetY:c}=e;t.save(),t.globalAlpha=1,t.setTransform(1,0,0,1,0,0);let l=new Path2D;l.rect(i,a,n,r),t.clip(l),t.globalCompositeOperation=`destination-in`,t.drawImage(o.canvas,i-s,a-c,n,r,i,a,n,r),t.restore()}save(e){this.inSMaskMode&&Ws(this.ctx,this.suspendedCtx),this.ctx.save();let t=this.current;this.stateStack.push(t),this.current=t.clone(),this.dependencyTracker?.save(e)}restore(e){this.dependencyTracker?.restore(e),this.stateStack.length===0?this.inSMaskMode&&this.endSMaskMode():(this.current=this.stateStack.pop(),this.ctx.restore(),this.inSMaskMode&&(Ws(this.suspendedCtx,this.ctx),this.ctx.setTransform(this.suspendedCtx.getTransform())),this.checkSMaskState(e),this.pendingClip=null,this._cachedScaleForStroking[0]=-1)}transform(e,t,n,r,i,a,o){this.dependencyTracker?.recordIncrementalData(`transform`,e),this.ctx.transform(t,n,r,i,a,o),this._cachedScaleForStroking[0]=-1}constructPath(e,t,n,r){let[i]=n;if(!r){i||=n[0]=new Path2D,t!==Oi.stroke&&t!==Oi.closeStroke&&(this.current.tilingPatternDims=null),this[t](e,i);return}if(this.dependencyTracker!==null){let n=t===Oi.stroke?this.current.lineWidth/2:0;this.dependencyTracker.resetBBox(e).recordBBox(e,this.ctx,r[0]-n,r[2]+n,r[1]-n,r[3]+n).recordDependencies(e,[`transform`])}i instanceof Path2D||(i=n[0]=Wa(i)),U.axialAlignedBoundingBox(r,ka(this.ctx),this.current.minMax);let a=this.current.tilingPatternDims;if(a&&t!==Oi.stroke&&t!==Oi.closeStroke&&this.current.fillColor instanceof Ms){let e=U.intersect(this.current.clipBox,this.current.minMax);e?this.current.fillColor.updatePatternDims(e,a):this.current.tilingPatternDims=null}this[t](e,i),this._pathStartIdx=e}closePath(e){this.ctx.closePath()}stroke(e,t,n=!0){let r=n&&this.#g(this.current.strokeAlpha),i=this.ctx,a=this.current.strokeColor;if(i.globalAlpha=this.current.strokeAlpha,this.contentVisible){if(typeof a==`object`&&a?.getPattern){let n=a.isModifyingCurrentTransform()?i.getTransform():null;if(i.save(),i.strokeStyle=a.getPattern(i,this,Aa(i),Cs.STROKE,e),n){let e=new Path2D;e.addPath(t,i.getTransform().invertSelf().multiplySelf(n)),t=e}this.rescaleAndStroke(t,!1),i.restore()}else this.rescaleAndStroke(t,!0)}this.dependencyTracker?.recordDependencies(e,ko.stroke),n&&this.consumePath(e,t,this.current.getClippedPathBoundingBox(Cs.STROKE,ka(this.ctx))),i.globalAlpha=this.current.fillAlpha,this.#_(r)}closeStroke(e,t){this.stroke(e,t)}fill(e,t,n=!0){let r=n&&this.#g(this.current.fillAlpha),i=this.ctx,a=this.current.fillColor,o=this.current.patternFill,s=!1,c=this.current.getClippedPathBoundingBox();if(this.dependencyTracker?.recordDependencies(e,ko.fill),o){let o=this.current.tilingPatternDims,l=o&&a.canSkipPatternCanvas(o);if(l){a.drawPattern(this,t,this.pendingEOFill,l,e),this.pendingEOFill=!1,n&&this.consumePath(e,t,c),this.current.tilingPatternDims=null,this.#_(r);return}let u=a.isModifyingCurrentTransform()?i.getTransform():null;if(this.dependencyTracker?.save(e),i.save(),i.fillStyle=a.getPattern(i,this,Aa(i),Cs.FILL,e),u){let e=new Path2D;e.addPath(t,i.getTransform().invertSelf().multiplySelf(u)),t=e}s=!0}this.contentVisible&&c!==null&&(this.pendingEOFill?(i.fill(t,`evenodd`),this.pendingEOFill=!1):i.fill(t)),s&&(i.restore(),this.dependencyTracker?.restore(e)),n&&this.consumePath(e,t,c),this.#_(r)}eoFill(e,t){this.pendingEOFill=!0,this.fill(e,t)}fillStroke(e,t){let n=this.#g(Math.min(this.current.fillAlpha,this.current.strokeAlpha));this.fill(e,t,!1),this.stroke(e,t,!1),this.consumePath(e,t),this.#_(n)}eoFillStroke(e,t){this.pendingEOFill=!0,this.fillStroke(e,t)}closeFillStroke(e,t){this.fillStroke(e,t)}closeEOFillStroke(e,t){this.pendingEOFill=!0,this.fillStroke(e,t)}endPath(e,t){this.consumePath(e,t)}rawFillPath(e,t){let n=this.#g(this.current.fillAlpha);this.ctx.fill(t),this.dependencyTracker?.recordDependencies(e,ko.rawFillPath).recordOperation(e),this.#_(n)}clip(e){this.dependencyTracker?.recordFutureForcedDependency(`clipMode`,e),this.pendingClip=Xs}eoClip(e){this.dependencyTracker?.recordFutureForcedDependency(`clipMode`,e),this.pendingClip=Zs}beginText(e){this.current.textMatrix=null,this.current.textMatrixScale=1,this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0,this.dependencyTracker?.recordOpenMarker(e).resetIncrementalData(`sameLineText`).resetIncrementalData(`moveText`,e)}endText(e){let t=this.pendingTextPaths,n=this.ctx;if(this.dependencyTracker){let{dependencyTracker:n}=this;t!==void 0&&n.recordFutureForcedDependency(`textClip`,n.getOpenMarker()).recordFutureForcedDependency(`textClip`,e),n.recordCloseMarker(e)}if(t!==void 0){let e=new Path2D,r=n.getTransform().invertSelf();for(let{transform:n,x:i,y:a,fontSize:o,path:s}of t)s&&e.addPath(s,new DOMMatrix(n).preMultiplySelf(r).translate(i,a).scale(o,-o));n.clip(e)}delete this.pendingTextPaths}setCharSpacing(e,t){this.dependencyTracker?.recordSimpleData(`charSpacing`,e),this.current.charSpacing=t}setWordSpacing(e,t){this.dependencyTracker?.recordSimpleData(`wordSpacing`,e),this.current.wordSpacing=t}setHScale(e,t){this.dependencyTracker?.recordSimpleData(`hScale`,e),this.current.textHScale=t/100}setLeading(e,t){this.dependencyTracker?.recordSimpleData(`leading`,e),this.current.leading=-t}setFont(e,t,n){this.dependencyTracker?.recordSimpleData(`font`,e).recordSimpleDataFromNamed(`fontObj`,t,e);let r=this.commonObjs.get(t),i=this.current;if(!r)throw Error(`Can't find font for ${t}`);if(i.fontMatrix=r.fontMatrix||mi,(i.fontMatrix[0]===0||i.fontMatrix[3]===0)&&Fi(`Invalid font matrix for font `+t),n<0?(n=-n,i.fontDirection=-1):i.fontDirection=1,this.current.font=r,this.current.fontSize=n,r.isType3Font)return;let a=r.loadedName||`sans-serif`,o=r.systemFontInfo?.css||`"${a}", ${r.fallbackName}`,s=`normal`;r.black?s=`900`:r.bold&&(s=`bold`);let c=r.italic?`italic`:`normal`,l=ca(n,Ns,Ps);this.current.fontSizeScale=n/l,this.ctx.font=`${c} ${s} ${l}px ${o}`}setTextRenderingMode(e,t){this.dependencyTracker?.recordSimpleData(`textRenderingMode`,e),this.current.textRenderingMode=t}setTextRise(e,t){this.dependencyTracker?.recordSimpleData(`textRise`,e),this.current.textRise=t}moveText(e,t,n){this.dependencyTracker?.resetIncrementalData(`sameLineText`).recordIncrementalData(`moveText`,e),this.current.x=this.current.lineX+=t,this.current.y=this.current.lineY+=n}setLeadingMoveText(e,t,n){this.setLeading(e,-n),this.moveText(e,t,n)}setTextMatrix(e,t){this.dependencyTracker?.resetIncrementalData(`sameLineText`).recordSimpleData(`textMatrix`,e);let{current:n}=this;n.textMatrix=t,n.textMatrixScale=Math.hypot(t[0],t[1]),n.x=n.lineX=0,n.y=n.lineY=0}nextLine(e){this.moveText(e,0,this.current.leading),this.dependencyTracker?.recordIncrementalData(`moveText`,this.dependencyTracker.getSimpleIndex(`leading`)??e)}#v(e,t,n){let r=new Path2D;return r.addPath(e,new DOMMatrix(n).invertSelf().multiplySelf(t)),r}paintChar(e,t,n,r,i,a){let o=this.ctx,s=this.current,c=s.font,l=s.textRenderingMode,u=s.fontSize/s.fontSizeScale,d=l&Ci.FILL_STROKE_MASK,f=!!(l&Ci.ADD_TO_PATH_FLAG),p=s.patternFill&&!c.missingFile,m=s.patternStroke&&!c.missingFile,h;if((c.disableFontFace||f||p||m)&&!c.missingFile&&(h=c.getPathGenerator(this.commonObjs,t)),h&&(c.disableFontFace||p||m)){o.save(),o.translate(n,r),o.scale(u,-u),this.dependencyTracker?.recordCharacterBBox(e,o,c);let t;if(d===Ci.FILL||d===Ci.FILL_STROKE){if(i){t=o.getTransform(),o.setTransform(...i);let e=this.#v(h,t,i);o.fill(e)}else o.fill(h)}if(d===Ci.STROKE||d===Ci.FILL_STROKE){if(a){t||=o.getTransform(),o.setTransform(...a);let{a:e,b:n,c:r,d:i}=t,s=U.inverseTransform(a),c=U.transform([e,n,r,i,0,0],s);U.singularValueDecompose2dScale(c,Rs),o.lineWidth*=Math.max(Rs[0],Rs[1])/u,o.stroke(this.#v(h,t,a))}else o.lineWidth/=u,o.stroke(h)}o.restore()}else(d===Ci.FILL||d===Ci.FILL_STROKE)&&(o.fillText(t,n,r),this.dependencyTracker?.recordCharacterBBox(e,o,c,u,n,r,()=>o.measureText(t))),(d===Ci.STROKE||d===Ci.FILL_STROKE)&&(this.dependencyTracker&&this.dependencyTracker?.recordCharacterBBox(e,o,c,u,n,r,()=>o.measureText(t)).recordDependencies(e,ko.stroke),o.strokeText(t,n,r));f&&((this.pendingTextPaths||=[]).push({transform:ka(o),x:n,y:r,fontSize:u,path:h}),this.dependencyTracker?.recordCharacterBBox(e,o,c,u,n,r))}get isFontSubpixelAAEnabled(){let e=this.canvasFactory.create(10,10),t=e.context;t.scale(1.5,1),t.fillText(`I`,0,10);let n=t.getImageData(0,0,10,10).data;this.canvasFactory.destroy(e);let r=!1;for(let e=3;e<n.length;e+=4)if(n[e]>0&&n[e]<255){r=!0;break}return H(this,`isFontSubpixelAAEnabled`,r)}showText(e,t){this.dependencyTracker&&(this.dependencyTracker.recordDependencies(e,ko.showText).resetBBox(e),this.current.textRenderingMode&Ci.ADD_TO_PATH_FLAG&&this.dependencyTracker.recordFutureForcedDependency(`textClip`,e).inheritPendingDependenciesAsFutureForcedDependencies());let n=this.current,r=n.font;if(r.isType3Font){let r=this.#g(n.fillAlpha);this.showType3Text(e,t),this.dependencyTracker?.recordShowTextOperation(e),this.#_(r);return}let i=n.fontSize;if(i===0){this.dependencyTracker?.recordOperation(e);return}let a=this.#g(n.fillAlpha),o=this.ctx,s=n.fontSizeScale,c=n.charSpacing,l=n.wordSpacing,u=n.fontDirection,d=n.textHScale*u,f=t.length,p=r.vertical,m=p?1:-1,h=i*n.fontMatrix[0],g=n.textRenderingMode===Ci.FILL&&!r.disableFontFace&&!n.patternFill;o.save(),n.textMatrix&&o.transform(...n.textMatrix),o.translate(n.x,n.y+n.textRise),u>0?o.scale(d,-1):o.scale(d,1);let _,v,y=n.textRenderingMode&Ci.FILL_STROKE_MASK,b=y===Ci.FILL||y===Ci.FILL_STROKE,x=y===Ci.STROKE||y===Ci.FILL_STROKE,S=n.lineWidth,C=n.textMatrixScale;if(C===0||S===0?x&&(S=this.getSinglePixelWidth()):S/=C,s!==1&&(o.scale(s,s),S/=s),o.lineWidth=S,b&&n.patternFill){o.save();let t=n.fillColor.getPattern(o,this,Aa(o),Cs.FILL,e);_=ka(o),o.restore(),o.fillStyle=t}if(x&&n.patternStroke){o.save();let t=n.strokeColor.getPattern(o,this,Aa(o),Cs.STROKE,e);v=ka(o),o.restore(),o.strokeStyle=t}if(r.isInvalidPDFjsFont){let r=[],i=0;for(let e of t)r.push(e.unicode),i+=e.width;let s=r.join(``);if(o.fillText(s,0,0),this.dependencyTracker!==null){let t=o.measureText(s);this.dependencyTracker.recordBBox(e,this.ctx,-t.actualBoundingBoxLeft,t.actualBoundingBoxRight,-t.actualBoundingBoxAscent,t.actualBoundingBoxDescent).recordShowTextOperation(e)}n.x+=i*h*d,o.restore(),this.compose(),this.#_(a);return}let w=0,T=0;for(;T<f;++T){let n=t[T];if(typeof n==`number`){w+=m*n*i/1e3;continue}let a=!1,d=(n.isSpace?l:0)+c,f=n.fontChar,y=n.accent,b,x,S=n.width;if(p){let e=n.vmetric,t=-e[1]*h,r=e[2]*h;S=-e[0],b=t/s,x=(w+r)/s}else b=w/s,x=0;let C;if(r.remeasure&&S>0){C=o.measureText(f);let e=C.width*1e3/i*s;if(S<e&&this.isFontSubpixelAAEnabled){let t=S/e;a=!0,o.save(),o.scale(t,1),b/=t}else S!==e&&(b+=(S-e)/2e3*i/s)}if(this.contentVisible&&(n.isInFont||r.missingFile)){if(g&&!y)o.fillText(f,b,x),this.dependencyTracker?.recordCharacterBBox(e,o,C?{bbox:null}:r,i/s,b,x,()=>C??o.measureText(f));else if(this.paintChar(e,f,b,x,_,v),y){let t=b+i*y.offset.x/s,n=x-i*y.offset.y/s;this.paintChar(e,y.fontChar,t,n,_,v)}}let E=p?S*h-d*u:S*h+d*u;w+=E,a&&o.restore()}p?n.y-=w:n.x+=w*d,o.restore(),this.compose(),this.dependencyTracker?.recordShowTextOperation(e),this.#_(a)}showType3Text(e,t){let n=this.ctx,r=this.current,i=r.font,a=r.fontSize,o=r.fontDirection,s=i.vertical?1:-1,c=r.charSpacing,l=r.wordSpacing,u=r.textHScale*o,d=r.fontMatrix||mi,f=t.length,p=r.textRenderingMode===Ci.INVISIBLE,m,h,g,_;if(p||a===0)return;this._cachedScaleForStroking[0]=-1,n.save(),r.textMatrix&&n.transform(...r.textMatrix),n.translate(r.x,r.y+r.textRise),n.scale(u,o);let v=this.dependencyTracker;for(this.dependencyTracker=v?new Oo(v,e):null,m=0;m<f;++m){if(h=t[m],typeof h==`number`){_=s*h*a/1e3,this.ctx.translate(_,0),r.x+=_*u;continue}let e=(h.isSpace?l:0)+c,o=i.charProcOperatorList.get(h.operatorListId);o?this.contentVisible&&(this.save(),o.fnArray[0]===Oi.setCharWidth&&(r.fillAlpha=r.strokeAlpha=1,n.globalAlpha=1),n.scale(a,a),n.transform(...d),this.executeOperatorList(o),this.restore()):Fi(`Type3 character "${h.operatorListId}" is not available.`);let f=[h.width,0];U.applyTransform(f,d),g=f[0]*a+e,n.translate(g,0),r.x+=g*u}n.restore(),v&&(this.dependencyTracker=v)}setCharWidth(e,t,n){}setCharWidthAndBounds(e,t,n,r,i,a,o){let s=new Path2D;s.rect(r,i,a-r,o-i),this.ctx.clip(s),this.dependencyTracker?.recordBBox(e,this.ctx,r,a,i,o).recordClipBox(e,this.ctx,r,a,i,o),this.endPath(e)}getColorN_Pattern(t,n){let r;if(n[0]===`TilingPattern`){let t=this.baseTransform||ka(this.ctx);r=new Ms(n,this.ctx,{createCanvasGraphics:(t,n)=>new e(t,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:this.optionalContentConfig,markedContentStack:this.markedContentStack},void 0,void 0,this.dependencyTracker?new Oo(this.dependencyTracker,n,!0):null)},t)}else r=this._getPattern(t,n[1],n[2]);return r}setStrokeColorN(e,...t){this.dependencyTracker?.recordSimpleData(`strokeColor`,e),this.current.strokeColor=this.getColorN_Pattern(e,t),this.current.patternStroke=!0}setFillColorN(e,...t){this.dependencyTracker?.recordSimpleData(`fillColor`,e);let n=this.current.fillColor=this.getColorN_Pattern(e,t);this.current.patternFill=!0,this.current.tilingPatternDims=n instanceof Ms?[0,0,0,0]:null}#y(e){return this.current.transferMapsFallback?.applyToColor(e)??e}setStrokeRGBColor(e,t){this.dependencyTracker?.recordSimpleData(`strokeColor`,e),this.current.strokeColor=t,this.ctx.strokeStyle=this.#y(t),this.current.patternStroke=!1}setStrokeTransparent(e){this.dependencyTracker?.recordSimpleData(`strokeColor`,e),this.ctx.strokeStyle=this.current.strokeColor=`transparent`,this.current.patternStroke=!1}setFillRGBColor(e,t){this.dependencyTracker?.recordSimpleData(`fillColor`,e),this.current.fillColor=t,this.ctx.fillStyle=this.#y(t),this.current.patternFill=!1,this.current.tilingPatternDims=null}setFillTransparent(e){this.dependencyTracker?.recordSimpleData(`fillColor`,e),this.ctx.fillStyle=this.current.fillColor=`transparent`,this.current.patternFill=!1,this.current.tilingPatternDims=null}_getPattern(e,t,n=null){let r=this.cachedPatterns.getOrInsertComputed(t,()=>As(this.getObject(e,t)));return n&&(r.matrix=n),r}shadingFill(e,t){if(!this.contentVisible)return;let n=this.#g(this.current.fillAlpha),r=this.ctx;this.save(e),r.fillStyle=this._getPattern(e,t).getPattern(r,this,Aa(r),Cs.SHADING,e);let i=Aa(r);if(i){let{width:e,height:t}=r.canvas,n=pi.slice();U.axialAlignedBoundingBox([0,0,e,t],i,n);let[a,o,s,c]=n;this.ctx.fillRect(a,o,s-a,c-o)}else this.ctx.fillRect(-1e10,-1e10,2e10,2e10);this.dependencyTracker?.resetBBox(e).recordFullPageBBox(e).recordDependencies(e,ko.transform).recordDependencies(e,ko.fill).recordOperation(e),this.compose(this.current.getClippedPathBoundingBox()),this.restore(e),this.#_(n)}beginInlineImage(){Ii(`Should not call beginInlineImage`)}beginImageData(){Ii(`Should not call beginImageData`)}paintFormXObjectBegin(e,t,n){if(this.contentVisible&&(this.save(e),this.baseTransformStack.push(this.baseTransform),t&&this.transform(e,...t),this.baseTransform=ka(this.ctx),n)){U.axialAlignedBoundingBox(n,this.baseTransform,this.current.minMax);let[t,r,i,a]=n,o=new Path2D;o.rect(t,r,i-t,a-r),this.ctx.clip(o),this.dependencyTracker?.recordClipBox(e,this.ctx,t,i,r,a),this.endPath(e)}}paintFormXObjectEnd(e){this.contentVisible&&(this.restore(e),this.baseTransform=this.baseTransformStack.pop())}beginGroup(e,t){if(!this.contentVisible)return;this.save(e);let{inSMaskMode:n}=this;n&&(this.endSMaskMode(),this.current.activeSMask=null);let r=this.ctx;if((!t.needsIsolation||!t.isolated&&!t.hasSoftMask)&&!t.knockout&&!t.isGray&&this.#t===0&&r.globalAlpha===1&&r.globalCompositeOperation===`source-over`&&!n){if(t.bbox){let e=new Path2D,[n,i,a,o]=t.bbox;if(e.rect(n,i,a-n,o-i),t.matrix){let n=new Path2D;n.addPath(e,new DOMMatrix(t.matrix)),e=n}r.clip(e)}this.groupStack.push(null),this.#u.push(null),this.groupLevel++;return}!t.isolated&&!t.knockout&&this.#t===0&&Pi(`TODO: Fully support non-isolated non-knockout groups.`);let i=ka(r);t.matrix&&r.transform(...t.matrix);let a=[0,0,r.canvas.width,r.canvas.height],o;t.bbox?(o=pi.slice(),U.axialAlignedBoundingBox(t.bbox,ka(r),o),o=U.intersect(o,a)||[0,0,0,0]):o=a;let s=Math.floor(o[0]),c=Math.floor(o[1]),l=Math.max(Math.ceil(o[2])-s,1),u=Math.max(Math.ceil(o[3])-c,1);this.current.startNewPathAndClipBox([0,0,l,u]);let d=this.canvasFactory.create(l,u);t.smask&&this.smaskGroupCanvases.push(d);let f=d.context,p=t.knockout&&!t.isolated?r:null,m=!t.isolated&&!t.knockout&&!t.smask&&t.needsIsolation&&this.#t>0,h=t.knockout?this.canvasFactory.create(l,u):null,g=this.#t;t.knockout?this.#t++:this.#t=0,f.translate(-s,-c),f.transform(...i);let _=!t.isolated&&!t.smask&&t.needsIsolation,v=_&&!n&&g===0&&!t.knockout&&!t.isGray&&t.hasSoftMask&&r.globalAlpha===1&&r.globalCompositeOperation===`source-over`&&this.current.transferMaps===`none`&&!this.current.transferMapsFallback;if(_&&(n||v)&&(f.save(),f.setTransform(1,0,0,1,0,0),f.drawImage(r.canvas,-s,-c),f.restore()),t.bbox){let e=new Path2D,[n,r,i,a]=t.bbox;if(e.rect(n,r,i-n,a-r),t.matrix){let n=new Path2D;n.addPath(e,new DOMMatrix(t.matrix)),e=n}f.clip(e)}t.smask&&this.smaskStack.push({canvas:d.canvas,context:f,offsetX:s,offsetY:c,subtype:t.smask.subtype,backdrop:t.smask.backdrop,transferMap:t.smask.transferMap||null}),(!t.smask||this.dependencyTracker)&&(r.setTransform(1,0,0,1,0,0),r.translate(s,c),r.save()),Ws(r,f),this.ctx=f,this.dependencyTracker?.inheritSimpleDataAsFutureForcedDependencies([`fillAlpha`,`strokeAlpha`,`globalCompositeOperation`]).pushBaseTransform(r),this.setGState(e,[[`BM`,`source-over`],[`ca`,1],[`CA`,1],[`TR`,null]]),this.groupStack.push(r),this.#u.push({backdropCtx:p,savedKnockoutLevel:g,offsetX:s,offsetY:c,hasInnerBackdrop:m,replaceBackdrop:v,knockoutMaskEntry:h,knockoutTempEntry:null,knockoutBackdropEntry:null}),this.groupLevel++}endGroup(e,t){if(!this.contentVisible)return;this.groupLevel--;let n=this.ctx,r=this.groupStack.pop(),i=this.#u.pop();if(i&&(this.#t=i.savedKnockoutLevel),r===null)this.restore(e);else if(t.isGray&&this.#b(n),this.ctx=r,this.ctx.imageSmoothingEnabled=!1,this.dependencyTracker?.popBaseTransform(),t.smask)this.tempSMask=this.smaskStack.pop(),this.restore(e),this.dependencyTracker&&(this.ctx.restore(),this.inSMaskMode&&this.ctx.setTransform(this.suspendedCtx.getTransform())),this.#x(i);else{this.ctx.restore();let t=ka(this.ctx);this.restore(e),this.current.transferMapsFallback?.applyToCanvas(n),this.ctx.save(),this.ctx.setTransform(...t);let a=pi.slice();U.axialAlignedBoundingBox([0,0,n.canvas.width,n.canvas.height],t,a);let o=this.#u.at(-1);if(this.#t>0){if(i.hasInnerBackdrop){let{width:e,height:a}=n.canvas,o=this.canvasFactory.create(e,a),s=o.context;s.drawImage(r.canvas,i.offsetX,i.offsetY,e,a,0,0,e,a),s.globalCompositeOperation=`source-over`,s.drawImage(n.canvas,0,0);let c=this.#p(n.canvas);s.globalCompositeOperation=`destination-in`,s.drawImage(c.canvas,0,0);let l=this.ctx.globalCompositeOperation,u=this.ctx.globalAlpha,d=this.ctx.filter;this.ctx.save(),this.ctx.setTransform(...t),this.ctx.globalAlpha=1,Zi.isCanvasFilterSupported&&(this.ctx.filter=`none`),this.ctx.globalCompositeOperation=`destination-out`,this.ctx.drawImage(c.canvas,0,0),this.ctx.globalCompositeOperation=l,this.ctx.globalAlpha=u,Zi.isCanvasFilterSupported&&(this.ctx.filter=d??`none`),this.ctx.drawImage(o.canvas,0,0),this.ctx.restore(),this.canvasFactory.destroy(c),this.canvasFactory.destroy(o)}else{let e=o?.backdropCtx??null;this.#h(this.ctx,n.canvas,{backdropCanvas:e?.canvas??null,destTransform:t,backdropOffset:e?[o.offsetX+i.offsetX,o.offsetY+i.offsetY]:[0,0],sourceAlpha:this.ctx.globalAlpha,sourceFilter:this.ctx.filter})}}else{if(i.replaceBackdrop){let e=new Path2D;e.rect(0,0,n.canvas.width,n.canvas.height),this.ctx.clip(e),this.ctx.globalCompositeOperation=`copy`}this.ctx.drawImage(n.canvas,0,0)}this.ctx.restore(),this.canvasFactory.destroy({canvas:n.canvas,context:n}),this.#x(i),this.compose(a)}}#b(e){let{canvas:t}=e,{width:n,height:r}=t;if(Zi.isCanvasFilterSupported){e.save(),e.setTransform(1,0,0,1,0,0),e.filter=`grayscale(1)`,e.globalAlpha=1,e.globalCompositeOperation=`copy`,e.drawImage(t,0,0),e.restore();return}let i=e.getImageData(0,0,n,r),{data:a}=i;for(let e=0,t=a.length;e<t;e+=4){let t=a[e]*.2126+a[e+1]*.7152+a[e+2]*.0722+.5|0;a[e]=a[e+1]=a[e+2]=t}e.putImageData(i,0,0)}#x(e){e&&(e.knockoutMaskEntry&&=(this.canvasFactory.destroy(e.knockoutMaskEntry),null),e.knockoutTempEntry&&=(this.canvasFactory.destroy(e.knockoutTempEntry),null),e.knockoutBackdropEntry&&=(this.canvasFactory.destroy(e.knockoutBackdropEntry),null))}beginAnnotation(e,t,n,r,i,a,o){if(this.#d(),Gs(this.ctx),this.ctx.save(),this.save(e),this.baseTransform&&this.ctx.setTransform(...this.baseTransform),n){let i=n[2]-n[0],s=n[3]-n[1];if(a&&this.annotationCanvasMap){r=r.slice(),r[4]-=n[0],r[5]-=n[1],U.singularValueDecompose2dScale(ka(this.ctx),Rs);let{viewportScale:e}=this,a=Math.ceil(i*this.outputScaleX*e),c=Math.ceil(s*this.outputScaleY*e);this.annotationCanvas=this.canvasFactory.create(a,c);let{canvas:l,context:u}=this.annotationCanvas;if(o){let e=this.annotationCanvasMap.getOrInsertComputed(t,ia);l.setAttribute(`data-canvas-name`,o);let n=e.findIndex(e=>e.getAttribute(`data-canvas-name`)===o);n===-1?e.push(l):e[n]=l}else this.annotationCanvasMap.set(t,l);this.annotationCanvas.savedCtx=this.ctx,this.ctx=u,this.ctx.save(),this.ctx.setTransform(Rs[0],0,0,-Rs[1],0,s*Rs[1]),Gs(this.ctx)}else{Gs(this.ctx),this.endPath(e);let t=new Path2D;t.rect(n[0],n[1],i,s),this.ctx.clip(t)}}this.current=new Vs(this.ctx.canvas.width,this.ctx.canvas.height),this.baseTransformStack.push(this.baseTransform),this.transform(e,...r),this.transform(e,...i),this.baseTransform=ka(this.ctx)}endAnnotation(e){this.annotationCanvas&&(this.ctx.restore(),this.#f(),this.ctx=this.annotationCanvas.savedCtx,delete this.annotationCanvas.savedCtx,delete this.annotationCanvas),this.baseTransform=this.baseTransformStack.pop()}paintImageMaskXObject(e,t){if(!this.contentVisible)return;let n=t.count;t=this.getObject(e,t.data,t),t.count=n;let r=this.#g(this.current.fillAlpha),i=this.ctx,a=this._createMaskCanvas(e,t),o=a.canvas;i.save(),i.setTransform(1,0,0,1,0,0),i.drawImage(o,a.offsetX,a.offsetY),this.dependencyTracker?.resetBBox(e).recordBBox(e,this.ctx,a.offsetX,a.offsetX+o.width,a.offsetY,a.offsetY+o.height).recordOperation(e),i.restore(),a.canvasEntry&&this.canvasFactory.destroy(a.canvasEntry),this.compose(),this.#_(r)}paintImageMaskXObjectRepeat(e,t,n,r=0,i=0,a,o){if(!this.contentVisible)return;t=this.getObject(e,t.data,t);let s=this.#g(this.current.fillAlpha),c=this.ctx;c.save();let l=ka(c);c.transform(n,r,i,a,0,0);let u=this._createMaskCanvas(e,t);c.setTransform(1,0,0,1,u.offsetX-l[4],u.offsetY-l[5]),this.dependencyTracker?.resetBBox(e);for(let t=0,s=o.length;t<s;t+=2){let s=U.transform(l,[n,r,i,a,o[t],o[t+1]]);c.drawImage(u.canvas,s[4],s[5]),this.dependencyTracker?.recordBBox(e,this.ctx,s[4],s[4]+u.canvas.width,s[5],s[5]+u.canvas.height)}c.restore(),u.canvasEntry&&this.canvasFactory.destroy(u.canvasEntry),this.compose(),this.dependencyTracker?.recordOperation(e),this.#_(s)}paintImageMaskXObjectGroup(e,t){if(!this.contentVisible)return;let n=this.#g(this.current.fillAlpha),r=this.ctx,i=this.current.patternFill,a=i?this.current.fillColor:r.fillStyle;this.dependencyTracker?.resetBBox(e).recordDependencies(e,ko.transformAndFill);for(let n of t){let{data:t,width:o,height:s,transform:c}=n,l=this.canvasFactory.create(o,s),u=l.context;u.save(),Us(u,this.getObject(e,t,n)),u.globalCompositeOperation=`source-in`,u.fillStyle=i?a.getPattern(u,this,Aa(r),Cs.FILL,e):a,u.fillRect(0,0,o,s),u.restore(),r.save(),r.transform(...c),r.scale(1,-1),Bs(r,l.canvas,0,0,o,s,0,-1,1,1),this.canvasFactory.destroy(l),this.dependencyTracker?.recordBBox(e,r,0,o,0,s),r.restore()}this.compose(),this.dependencyTracker?.recordOperation(e),this.#_(n)}paintImageXObject(e,t){if(!this.contentVisible)return;let n=this.getObject(e,t);n?this.paintInlineImageXObject(e,n):Fi(`Dependent image isn't ready yet`)}paintImageXObjectRepeat(e,t,n,r,i){if(!this.contentVisible)return;let a=this.getObject(e,t);if(!a){Fi(`Dependent image isn't ready yet`);return}let o=a.width,s=a.height,c=[];for(let e=0,t=i.length;e<t;e+=2)c.push({transform:[n,0,0,r,i[e],i[e+1]],x:0,y:0,w:o,h:s});this.paintInlineImageXObjectGroup(e,a,c)}applyTransferMapsToCanvas(e){return this.current.transferMaps===`none`?this.current.transferMapsFallback?.applyToCanvas(e):(e.filter=this.current.transferMaps,e.drawImage(e.canvas,0,0),e.filter=`none`),e.canvas}applyTransferMapsToBitmap(e){let{transferMaps:t,transferMapsFallback:n}=this.current;if(t===`none`&&!n)return{img:e.bitmap,canvasEntry:null};let{bitmap:r,width:i,height:a}=e,o=this.canvasFactory.create(i,a),s=o.context;return s.filter=t,s.drawImage(r,0,0),s.filter=`none`,n?.applyToCanvas(s),{img:o.canvas,canvasEntry:o}}paintInlineImageXObject(e,t){if(!this.contentVisible)return;let n=t.width,r=t.height,i=this.#g(this.current.fillAlpha),a=this.ctx;this.save(e);let{filter:o}=a;o!==`none`&&o!==``&&(a.filter=`none`),a.scale(1/n,-1/r);let s,c=null;if(t.bitmap){let e=this.applyTransferMapsToBitmap(t);s=e.img,c=e.canvasEntry}else{let e=this.canvasFactory.create(n,r);Hs(e.context,t),s=this.applyTransferMapsToCanvas(e.context),c=e}let l=this._scaleImage(s,Aa(a));a.imageSmoothingEnabled=qs(ka(a),t.interpolate),this.dependencyTracker&&(this.dependencyTracker.resetBBox(e).recordBBox(e,a,0,n,-r,0).recordDependencies(e,ko.imageXObject).recordOperation(e),this.imagesTracker?.record(a,n,r,this.dependencyTracker.clipBox)),Bs(a,l.img,0,0,l.paintWidth,l.paintHeight,0,-r,n,r),l.tmpCanvas&&this.canvasFactory.destroy(l.tmpCanvas),c&&this.canvasFactory.destroy(c),this.compose(),this.restore(e),this.#_(i)}paintInlineImageXObjectGroup(e,t,n){if(!this.contentVisible)return;let r=this.#g(this.current.fillAlpha),i=this.ctx,a,o=null;if(t.bitmap&&!this.current.transferMapsFallback)a=t.bitmap;else if(t.bitmap)({img:a,canvasEntry:o}=this.applyTransferMapsToBitmap(t));else{let e=t.width,n=t.height,r=this.canvasFactory.create(e,n);Hs(r.context,t),a=this.applyTransferMapsToCanvas(r.context),o=r}this.dependencyTracker?.resetBBox(e);for(let t of n)i.save(),i.transform(...t.transform),i.scale(1,-1),Bs(i,a,t.x,t.y,t.w,t.h,0,-1,1,1),this.dependencyTracker?.recordBBox(e,i,0,1,-1,0),i.restore();o&&this.canvasFactory.destroy(o),this.dependencyTracker?.recordOperation(e),this.compose(),this.#_(r)}paintSolidColorImageMask(e){if(!this.contentVisible)return;let t=this.#g(this.current.fillAlpha);this.dependencyTracker?.resetBBox(e).recordBBox(e,this.ctx,0,1,0,1).recordDependencies(e,ko.fill).recordOperation(e),this.ctx.fillRect(0,0,1,1),this.compose(),this.#_(t)}markPoint(e,t){}markPointProps(e,t,n){}beginMarkedContent(e,t){this.dependencyTracker?.beginMarkedContent(e),this.markedContentStack.push({visible:!0})}beginMarkedContentProps(e,t,n){this.dependencyTracker?.beginMarkedContent(e),t===`OC`?this.markedContentStack.push({visible:this.optionalContentConfig.isVisible(n)}):this.markedContentStack.push({visible:!0}),this.contentVisible=this.isContentVisible()}endMarkedContent(e){this.dependencyTracker?.endMarkedContent(e),this.markedContentStack.pop(),this.contentVisible=this.isContentVisible()}beginCompat(e){}endCompat(e){}consumePath(e,t,n){let r=this.current.isEmptyClip();this.pendingClip&&this.current.updateClipFromPath(),this.pendingClip||this.compose(n);let i=this.ctx;this.pendingClip?(r||(this.pendingClip===Zs?i.clip(t,`evenodd`):i.clip(t)),this.pendingClip=null,this.dependencyTracker?.bboxToClipBoxDropOperation(e).recordFutureForcedDependency(`clipPath`,e)):this.dependencyTracker?.recordOperation(e),this.current.startNewPathAndClipBox(this.current.clipBox)}getSinglePixelWidth(){let e=ka(this.ctx);if(e[1]===0&&e[2]===0)return 1/Math.min(Math.abs(e[0]),Math.abs(e[3]));let t=Math.abs(e[0]*e[3]-e[2]*e[1]),n=Math.hypot(e[0],e[2]),r=Math.hypot(e[1],e[3]);return Math.max(n,r)/t}getScaleForStroking(){if(this._cachedScaleForStroking[0]===-1){let{lineWidth:e}=this.current,{a:t,b:n,c:r,d:i}=this.ctx.getTransform(),a,o;if(n===0&&r===0){let n=Math.abs(t),r=Math.abs(i);if(n===r){if(e===0)a=o=1/n;else{let t=n*e;a=o=t<1?1/t:1}}else if(e===0)a=1/n,o=1/r;else{let t=n*e,i=r*e;a=t<1?1/t:1,o=i<1?1/i:1}}else{let s=Math.abs(t*i-n*r),c=Math.hypot(t,n),l=Math.hypot(r,i);if(e===0)a=l/s,o=c/s;else{let t=e*s;a=l>t?l/t:1,o=c>t?c/t:1}}this._cachedScaleForStroking[0]=a,this._cachedScaleForStroking[1]=o}return this._cachedScaleForStroking}rescaleAndStroke(t,n){let{ctx:r,current:{lineWidth:i}}=this,[a,o]=this.getScaleForStroking();if(a===o){r.lineWidth=(i||1)*a,r.stroke(t);return}let s=e.#e??=new DOMMatrix,c=r.getLineDash();n&&r.save(),r.scale(a,o),s.a=1/a,s.d=1/o;let l=new Path2D;if(l.addPath(t,s),c.length>0){let e=Math.max(a,o);r.setLineDash(c.map(t=>t/e)),r.lineDashOffset/=e}r.lineWidth=i||1,r.stroke(l),n&&r.restore()}isContentVisible(){for(let e=this.markedContentStack.length-1;e>=0;e--)if(!this.markedContentStack[e].visible)return!1;return!0}};for(let e in Oi)Qs.prototype[e]!==void 0&&(Qs.prototype[Oi[e]]=Qs.prototype[e]);var $s=class{#e=null;#t=null;_fullReader=null;_rangeReaders=new Set;_source=null;constructor(e,t,n){this._source=e,this.#e=t,this.#t=n}get _progressiveDataLength(){return this._fullReader?._loaded??0}getFullReader(){return Li(!this._fullReader,`BasePDFStream.getFullReader can only be called once.`),this._fullReader=new this.#e(this)}getRangeReader(e,t){if(t<=this._progressiveDataLength)return null;let n=new this.#t(this,e,t);return this._rangeReaders.add(n),n}cancelAllRequests(e){this._fullReader?.cancel(e);for(let t of new Set(this._rangeReaders))t.cancel(e)}},ec=class{onProgress=null;_contentLength=0;_filename=null;_headersCapability=Promise.withResolvers();_isRangeSupported=!1;_isStreamingSupported=!1;_loaded=0;_stream=null;constructor(e){this._stream=e}_callOnProgress(){this.onProgress?.({loaded:this._loaded,total:this._contentLength})}get headersReady(){return this._headersCapability.promise}get filename(){return this._filename}get contentLength(){return this._contentLength}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}async read(){Ii("Abstract method `read` called")}cancel(e){Ii("Abstract method `cancel` called")}},tc=class{_stream=null;constructor(e,t,n){this._stream=e}async read(){Ii("Abstract method `read` called")}cancel(e){Ii("Abstract method `cancel` called")}};function nc(e){let t=!0,n=r(`filename\\*`,`i`).exec(e);if(n){n=n[1];let e=s(n);return e=unescape(e),e=c(e),e=l(e),a(e)}if(n=o(e),n)return a(l(n));if(n=r(`filename`,`i`).exec(e),n){n=n[1];let e=s(n);return e=l(e),a(e)}function r(e,t){return RegExp(`(?:^|;)\\s*`+e+`\\s*=\\s*([^";\\s][^;\\s]*|"(?:[^"\\\\]|\\\\"?)+"?)`,t)}function i(e,n){if(e){if(!/^[\x00-\xFF]+$/.test(n))return n;try{let r=new TextDecoder(e,{fatal:!0}),i=Xi(n);n=r.decode(i),t=!1}catch{}}return n}function a(e){return t&&/[\x80-\xff]/.test(e)&&(e=i(`utf-8`,e),t&&(e=i(`iso-8859-1`,e))),e}function o(e){let t=[],n,i=r(`filename\\*((?!0\\d)\\d+)(\\*?)`,`ig`);for(;(n=i.exec(e))!==null;){let[,e,r,i]=n;if(e=parseInt(e,10),e in t){if(e===0)break}else t[e]=[r,i]}let a=[];for(let e=0;e<t.length&&e in t;++e){let[n,r]=t[e];r=s(r),n&&(r=unescape(r),e===0&&(r=c(r))),a.push(r)}return a.join(``)}function s(e){if(e.startsWith(`"`)){let t=e.slice(1).split(`\\"`);for(let e=0;e<t.length;++e){let n=t[e].indexOf(`"`);n!==-1&&(t[e]=t[e].slice(0,n),t.length=e+1),t[e]=t[e].replaceAll(/\\(.)/g,`$1`)}e=t.join(`"`)}return e}function c(e){let t=e.indexOf(`'`);return t===-1?e:i(e.slice(0,t),e.slice(t+1).replace(/^[^']*'/,``))}function l(e){return!e.startsWith(`=?`)||/[\x00-\x19\x80-\xff]/.test(e)?e:e.replaceAll(/=\?([\w-]*)\?([QB])\?((?:[^?]|\?(?!=))*)\?=/gi,function(e,t,n,r){if(n===`q`||n===`Q`)return r=r.replaceAll(`_`,` `).replaceAll(/=([0-9a-f]{2})/gi,(e,t)=>String.fromCharCode(parseInt(t,16))),i(t,r);try{r=atob(r)}catch{}return i(t,r)})}return``}function rc(e,t){let n=new Headers;if(!e||!t||typeof t!=`object`)return n;for(let e in t){let r=t[e];r!==void 0&&n.append(e,r)}return n}function ic(e){let t=e.length;for(;t>0&&e[t-1]!==` `&&/\s/.test(e[t-1]);)t--;return e.slice(0,t)}function ac(e){return URL.parse(e)?.origin??null}function oc({responseHeaders:e,isHttp:t,rangeChunkSize:n,disableRange:r}){let i={contentLength:0,isRangeSupported:!1},a=parseInt(e.get(`Content-Length`),10);return!Number.isInteger(a)||(i.contentLength=a,a<=2*n)||r||!t||e.get(`Accept-Ranges`)!==`bytes`||(e.get(`Content-Encoding`)||`identity`)===`identity`&&(i.isRangeSupported=!0),i}function sc(e){let t=e.get(`Content-Disposition`);if(t){let e=nc(t);if(e.includes(`%`))try{e=decodeURIComponent(e)}catch{}if(va(e))return e}return null}function cc(e,t){return new Ki(`Unexpected server response (${e}) while retrieving PDF "${t.href}".`,e,e===404||e===0&&t.protocol===`file:`)}function lc(e,t){if(e!==t)throw Error(`Expected range response-origin "${e}" to match "${t}".`)}function uc(e,t,n,r){return fetch(e,{method:`GET`,headers:t,signal:r.signal,mode:`cors`,credentials:n?`include`:`same-origin`,redirect:`follow`})}function dc(e,t){if(e!==200&&e!==206)throw cc(e,t)}function fc(e){if(e instanceof Uint8Array)return e.buffer;if(e instanceof ArrayBuffer)return e;throw Error(`getArrayBuffer - unexpected data: ${e}`)}var pc=class extends $s{_responseOrigin=null;constructor(e){super(e,mc,hc);let{httpHeaders:t,url:n}=e;Li(/https?:/.test(n.protocol),`PDFFetchStream only supports http(s):// URLs.`),this.headers=rc(!0,t)}},mc=class extends ec{_abortController=new AbortController;_reader=null;constructor(e){super(e);let{disableRange:t,disableStream:n,rangeChunkSize:r,url:i,withCredentials:a}=e._source;this._isStreamingSupported=!n,uc(i,new Headers(e.headers),a,this._abortController).then(n=>{e._responseOrigin=ac(n.url),dc(n.status,i),this._reader=n.body.getReader();let a=n.headers,{contentLength:o,isRangeSupported:s}=oc({responseHeaders:a,isHttp:!0,rangeChunkSize:r,disableRange:t});this._contentLength=o,this._isRangeSupported=s,this._filename=sc(a),!this._isStreamingSupported&&this._isRangeSupported&&this.cancel(new Ji(`Streaming is disabled.`)),this._headersCapability.resolve()}).catch(this._headersCapability.reject)}async read(){await this._headersCapability.promise;let{value:e,done:t}=await this._reader.read();return t?{value:e,done:t}:(this._loaded+=e.byteLength,this._callOnProgress(),{value:fc(e),done:!1})}cancel(e){this._reader?.cancel(e),this._abortController.abort()}},hc=class extends tc{_abortController=new AbortController;_readCapability=Promise.withResolvers();_reader=null;constructor(e,t,n){super(e,t,n);let{url:r,withCredentials:i}=e._source,a=new Headers(e.headers);a.append(`Range`,`bytes=${t}-${n-1}`),uc(r,a,i,this._abortController).then(t=>{lc(ac(t.url),e._responseOrigin),dc(t.status,r),this._reader=t.body.getReader(),this._readCapability.resolve()}).catch(this._readCapability.reject)}async read(){await this._readCapability.promise;let{value:e,done:t}=await this._reader.read();return t?{value:e,done:t}:{value:fc(e),done:!1}}cancel(e){this._reader?.cancel(e),this._abortController.abort()}};function gc(e){return e instanceof Uint8Array&&e.byteLength===e.buffer.byteLength?e.buffer:new Uint8Array(e).buffer}function _c(){for(let e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0}var vc=class extends $s{_progressiveDone=!1;_queuedChunks=[];constructor(e){super(e,yc,bc);let{pdfDataRangeTransport:t}=e,{initialData:n,progressiveDone:r}=t;if(n?.length>0){let e=gc(n);this._queuedChunks.push(e)}this._progressiveDone=r,t.transportReady(e=>{switch(e.type){case`range`:case`progressiveRead`:this.#e(e.begin,e.chunk);break;case`progressiveDone`:this._fullReader?.progressiveDone(),this._progressiveDone=!0}})}#e(e,t){let n=gc(t);if(e===void 0)this._fullReader?this._fullReader._enqueue(n):this._queuedChunks.push(n);else{let t=this._rangeReaders.keys().find(t=>t._begin===e);Li(t,"#onReceiveData - no `PDFDataTransportStreamRangeReader` instance found."),t._enqueue(n)}}getFullReader(){let e=super.getFullReader();return this._queuedChunks=null,e}getRangeReader(e,t){let n=super.getRangeReader(e,t);return n&&(n.onDone=()=>this._rangeReaders.delete(n),this._source.pdfDataRangeTransport.requestDataRange(e,t)),n}cancelAllRequests(e){super.cancelAllRequests(e),this._source.pdfDataRangeTransport.abort()}},yc=class extends ec{#e=_c.bind(this);_done=!1;_queuedChunks=null;_requests=[];constructor(e){super(e);let{pdfDataRangeTransport:t,disableRange:n,disableStream:r}=e._source,{length:i,contentDispositionFilename:a}=t;this._queuedChunks=e._queuedChunks||[];for(let e of this._queuedChunks)this._loaded+=e.byteLength;this._done=e._progressiveDone,this._contentLength=i,this._isStreamingSupported=!r,this._isRangeSupported=!n,va(a)&&(this._filename=a),this._headersCapability.resolve();let o=this._loaded;Promise.resolve().then(()=>{o>0&&this._loaded===o&&this._callOnProgress()})}_enqueue(e){this._done||(this._requests.length>0?this._requests.shift().resolve({value:e,done:!1}):this._queuedChunks.push(e),this._loaded+=e.byteLength,this._callOnProgress())}async read(){if(this._queuedChunks.length>0)return{value:this._queuedChunks.shift(),done:!1};if(this._done)return{value:void 0,done:!0};let e=Promise.withResolvers();return this._requests.push(e),e.promise}cancel(e){this._done=!0,this.#e()}progressiveDone(){this._done||=!0,this._queuedChunks.length===0&&this.#e()}},bc=class extends tc{#e=_c.bind(this);onDone=null;_begin=-1;_done=!1;_queuedChunk=null;_requests=[];constructor(e,t,n){super(e,t,n),this._begin=t}_enqueue(e){this._done||(this._requests.length===0?this._queuedChunk=e:(this._requests.shift().resolve({value:e,done:!1}),this.#e()),this._done=!0,this.onDone?.())}async read(){if(this._queuedChunk){let e=this._queuedChunk;return this._queuedChunk=null,{value:e,done:!1}}if(this._done)return{value:void 0,done:!0};let e=Promise.withResolvers();return this._requests.push(e),e.promise}cancel(e){this._done=!0,this.#e(),this.onDone?.()}},xc=200,Sc=206;function Cc(e){return typeof e==`string`?Xi(e).buffer:e}var wc=class extends $s{#e=new WeakMap;_responseOrigin=null;constructor(e){super(e,Tc,Ec);let{httpHeaders:t,url:n}=e;this.url=n,this.isHttp=/https?:/.test(n.protocol),this.headers=rc(this.isHttp,t)}_request(e){let t=new XMLHttpRequest,n={validateStatus:null,onHeadersReceived:e.onHeadersReceived,onDone:e.onDone,onError:e.onError,onProgress:e.onProgress};this.#e.set(t,n),t.open(`GET`,this.url),t.withCredentials=this._source.withCredentials;for(let[e,n]of this.headers)t.setRequestHeader(e,n);return this.isHttp&&`begin`in e&&`end`in e?(t.setRequestHeader(`Range`,`bytes=${e.begin}-${e.end-1}`),n.validateStatus=e=>e===Sc||e===xc):n.validateStatus=e=>e===xc,t.responseType=`arraybuffer`,Li(e.onError,"Expected `onError` callback to be provided."),t.onerror=()=>e.onError(t.status),t.onreadystatechange=this.#n.bind(this,t),t.onprogress=this.#t.bind(this,t),t.send(null),t}#t(e,t){this.#e.get(e)?.onProgress?.(t)}#n(e,t){let n=this.#e.get(e);if(!n||(e.readyState>=2&&n.onHeadersReceived&&(n.onHeadersReceived(),delete n.onHeadersReceived),e.readyState!==4)||!this.#e.has(e))return;if(this.#e.delete(e),e.status===0&&this.isHttp){n.onError(e.status);return}let r=e.status||xc;if(!n.validateStatus(r)){n.onError(e.status);return}let i=Cc(e.response);if(r===Sc){let t=e.getResponseHeader(`Content-Range`);/bytes \d+-\d+\/\d+/.test(t)?n.onDone(i):(Fi(`Missing or invalid "Content-Range" header.`),n.onError(0))}else i?n.onDone(i):n.onError(e.status)}_abortRequest(e){this.#e.has(e)&&(this.#e.delete(e),e.abort())}getRangeReader(e,t){let n=super.getRangeReader(e,t);return n&&(n.onClosed=()=>this._rangeReaders.delete(n)),n}},Tc=class extends ec{#e=_c.bind(this);_cachedChunks=[];_done=!1;_requests=[];_storedError=null;constructor(e){super(e),this._fullRequestXhr=e._request({onHeadersReceived:this.#t.bind(this),onDone:this.#n.bind(this),onError:this.#r.bind(this),onProgress:this.#i.bind(this)})}#t(){let e=this._stream,{disableRange:t,rangeChunkSize:n}=e._source,r=this._fullRequestXhr;e._responseOrigin=ac(r.responseURL);let i=r.getAllResponseHeaders(),a=new Headers(i?ic(i.trimStart()).split(/[\r\n]+/).map(e=>{let[t,...n]=e.split(`: `);return[t,n.join(`: `)]}):[]),{contentLength:o,isRangeSupported:s}=oc({responseHeaders:a,isHttp:e.isHttp,rangeChunkSize:n,disableRange:t});this._contentLength=o,this._isRangeSupported=s,this._filename=sc(a),this._isRangeSupported&&e._abortRequest(r),this._headersCapability.resolve()}#n(e){this._requests.length>0?this._requests.shift().resolve({value:e,done:!1}):this._cachedChunks.push(e),this._done=!0,this._cachedChunks.length===0&&this.#e()}#r(e){this._storedError=cc(e,this._stream.url),this._headersCapability.reject(this._storedError);for(let e of this._requests)e.reject(this._storedError);this._requests.length=0,this._cachedChunks.length=0}#i(e){this.onProgress?.({loaded:e.loaded,total:e.lengthComputable?e.total:this._contentLength})}async read(){if(await this._headersCapability.promise,this._storedError)throw this._storedError;if(this._cachedChunks.length>0)return{value:this._cachedChunks.shift(),done:!1};if(this._done)return{value:void 0,done:!0};let e=Promise.withResolvers();return this._requests.push(e),e.promise}cancel(e){this._done=!0,this._headersCapability.reject(e),this.#e(),this._stream._abortRequest(this._fullRequestXhr),this._fullRequestXhr=null}},Ec=class extends tc{#e=_c.bind(this);onClosed=null;_done=!1;_queuedChunk=null;_requests=[];_storedError=null;constructor(e,t,n){super(e,t,n),this._requestXhr=e._request({begin:t,end:n,onHeadersReceived:this.#t.bind(this),onDone:this.#n.bind(this),onError:this.#r.bind(this),onProgress:null})}#t(){let e=ac(this._requestXhr?.responseURL);try{lc(e,this._stream._responseOrigin)}catch(e){this._storedError=e,this.#r(0)}}#n(e){this._requests.length>0?this._requests.shift().resolve({value:e,done:!1}):this._queuedChunk=e,this._done=!0,this.#e(),this.onClosed?.()}#r(e){this._storedError??=cc(e,this._stream.url);for(let e of this._requests)e.reject(this._storedError);this._requests.length=0,this._queuedChunk=null}async read(){if(this._storedError)throw this._storedError;if(this._queuedChunk!==null){let e=this._queuedChunk;return this._queuedChunk=null,{value:e,done:!1}}if(this._done)return{value:void 0,done:!0};let e=Promise.withResolvers();return this._requests.push(e),e.promise}cancel(e){this._done=!0,this.#e(),this._stream._abortRequest(this._requestXhr),this.onClosed?.()}};function Dc(e,t=null){let n=process.getBuiltinModule(`fs`),{Readable:r}=process.getBuiltinModule(`stream`),i=n.createReadStream(e,t);return r.toWeb(i)}var Oc=class extends $s{constructor(e){super(e,kc,Ac);let{url:t}=e;Li(t.protocol===`file:`,`PDFNodeStream only supports file:// URLs.`)}},kc=class extends ec{_reader=null;constructor(e){super(e);let{disableRange:t,disableStream:n,rangeChunkSize:r,url:i}=e._source;this._isStreamingSupported=!n,process.getBuiltinModule(`fs/promises`).lstat(i).then(e=>{let n=Dc(i);this._reader=n.getReader();let{size:a}=e;this._contentLength=a,this._isRangeSupported=!t&&a>2*r,!this._isStreamingSupported&&this._isRangeSupported&&this.cancel(new Ji(`Streaming is disabled.`)),this._headersCapability.resolve()}).catch(e=>{e.code===`ENOENT`&&(e=cc(0,i)),this._headersCapability.reject(e)})}async read(){await this._headersCapability.promise;let{value:e,done:t}=await this._reader.read();return t?{value:e,done:t}:(this._loaded+=e.byteLength,this._callOnProgress(),{value:fc(e),done:!1})}cancel(e){this._reader?.cancel(e)}},Ac=class extends tc{_readCapability=Promise.withResolvers();_reader=null;constructor(e,t,n){super(e,t,n);let{url:r}=e._source;try{let e=Dc(r,{start:t,end:n-1});this._reader=e.getReader(),this._readCapability.resolve()}catch(e){this._readCapability.reject(e)}}async read(){await this._readCapability.promise;let{value:e,done:t}=await this._reader.read();return t?{value:e,done:t}:{value:fc(e),done:!1}}cancel(e){this._reader?.cancel(e)}};function jc(e){return Sa(e)?pc:di?Oc:wc}var Mc=class{static#e=null;static#t=``;static get workerPort(){return this.#e}static set workerPort(e){if(!(typeof Worker<`u`&&e instanceof Worker)&&e!==null)throw Error("Invalid `workerPort` type.");this.#e=e}static get workerSrc(){return this.#t}static set workerSrc(e){if(typeof e!=`string`)throw Error("Invalid `workerSrc` type.");this.#t=e}},Nc=class{#e;#t;constructor({parsedData:e,rawData:t}){this.#e=e,this.#t=t}getRaw(){return this.#t}get(e){return this.#e.get(e)??null}[Symbol.iterator](){return this.#e.entries()}},Pc=Symbol(`INTERNAL`),Fc=class{#e=!1;#t=!1;#n=!1;#r=!0;constructor(e,{name:t,intent:n,usage:r,rbGroups:i}){this.#e=!!(e&gi.DISPLAY),this.#t=!!(e&gi.PRINT),this.name=t,this.intent=n,this.usage=r,this.rbGroups=i}get visible(){if(this.#n)return this.#r;if(!this.#r)return!1;let{print:e,view:t}=this.usage;return this.#e?t?.viewState!==`OFF`:!this.#t||e?.printState!==`OFF`}_setVisible(e,t,n=!1){e!==Pc&&Ii("Internal method `_setVisible` called."),this.#n=n,this.#r=t}get serializable(){return{userSet:this.#n,visible:this.#r}}},Ic=class e{#e=null;#t=new Map;#n=null;#r=null;#i;creator=null;name=null;constructor(e,t=gi.DISPLAY,n=null){if(this.#i=e,this.renderingIntent=t,e!==null){this.name=e.name,this.creator=e.creator,this.#r=e.order;for(let n of e.groups)this.#t.set(n.id,new Fc(t,n));if(n){n.size!==this.#t.size&&Ii(`Incorrect serialized groupState.`);for(let[e,t]of n)this.#t.get(e)._setVisible(Pc,t.visible,t.userSet)}else{if(e.baseState===`OFF`)for(let e of this.#t.values())e._setVisible(Pc,!1);for(let t of e.on)this.#t.get(t)._setVisible(Pc,!0);for(let t of e.off)this.#t.get(t)._setVisible(Pc,!1)}this.#n=this.getHash()}}#a(e){let t=e.length;if(t<2)return!0;let n=e[0];for(let r=1;r<t;r++){let t=e[r],i;if(Array.isArray(t))i=this.#a(t);else if(this.#t.has(t))i=this.#t.get(t).visible;else return Fi(`Optional content group not found: ${t}`),!0;switch(n){case`And`:if(!i)return!1;break;case`Or`:if(i)return!0;break;case`Not`:return!i;default:return!0}}return n===`And`}isVisible(e){if(this.#t.size===0)return!0;if(!e)return Pi(`Optional content group not defined.`),!0;if(e.type===`OCG`)return this.#t.has(e.id)?this.#t.get(e.id).visible:(Fi(`Optional content group not found: ${e.id}`),!0);if(e.type===`OCMD`){if(e.expression)return this.#a(e.expression);if(!e.policy||e.policy===`AnyOn`){for(let t of e.ids){if(!this.#t.has(t))return Fi(`Optional content group not found: ${t}`),!0;if(this.#t.get(t).visible)return!0}return!1}if(e.policy===`AllOn`){for(let t of e.ids){if(!this.#t.has(t))return Fi(`Optional content group not found: ${t}`),!0;if(!this.#t.get(t).visible)return!1}return!0}if(e.policy===`AnyOff`){for(let t of e.ids){if(!this.#t.has(t))return Fi(`Optional content group not found: ${t}`),!0;if(!this.#t.get(t).visible)return!0}return!1}if(e.policy===`AllOff`){for(let t of e.ids){if(!this.#t.has(t))return Fi(`Optional content group not found: ${t}`),!0;if(this.#t.get(t).visible)return!1}return!0}return Fi(`Unknown optional content policy ${e.policy}.`),!0}return Fi(`Unknown group type ${e.type}.`),!0}setVisibility(e,t=!0,n=!0){let r=this.#t.get(e);if(!r)Fi(`Optional content group not found: ${e}`);else{if(n&&t&&r.rbGroups.length)for(let t of r.rbGroups)for(let n of t)n!==e&&this.#t.get(n)?._setVisible(Pc,!1,!0);r._setVisible(Pc,!!t,!0),this.#e=null}}setOCGState({state:e,preserveRB:t}){let n;for(let r of e){switch(r){case`ON`:case`OFF`:case`Toggle`:n=r;continue}let e=this.#t.get(r);if(e)switch(n){case`ON`:this.setVisibility(r,!0,t);break;case`OFF`:this.setVisibility(r,!1,t);break;case`Toggle`:this.setVisibility(r,!e.visible,t)}}this.#e=null}get hasInitialVisibility(){return this.#n===null||this.getHash()===this.#n}getOrder(){return this.#t.size?this.#r?this.#r.slice():[...this.#t.keys()]:null}getGroup(e){return this.#t.get(e)||null}getHash(){if(this.#e!==null)return this.#e;let e=new mo;for(let[t,n]of this.#t)e.update(`${t}:${n.visible}`);return this.#e=e.hexdigest()}[Symbol.iterator](){return this.#t.entries()}get serializable(){let e=new Map;for(let[t,n]of this.#t)e.set(t,n.serializable);return{data:this.#i,renderingIntent:this.renderingIntent,groupState:e}}static fromSerializable({data:t,renderingIntent:n,groupState:r}){return new e(t,n,r)}},Lc=class{#e=null;#t=null;#n=0;#r=null;#i=null;get pagesNumber(){return this.#n}set pagesNumber(e){this.#n!==e&&(this.#n=e,this.#e=null,this.#t=null)}#a(){if(this.#e)return;let e=this.#n,t=this.#e=new Uint32Array(e);for(let n=0;n<e;n++)t[n]=n+1;this.#t=new Int32Array(t)}#o(){let e=new Map,t=this.#e;for(let n=0,r=this.#n;n<r;n++){let r=t[n],i=e.get(r);i?i.push(n+1):e.set(r,[n+1])}return e}movePages(e,t,n){this.#a();let r=this.#e,i=t.length,a=new Uint32Array(i),o=0;for(let e=0;e<i;e++){let i=t[e]-1;a[e]=r[i],i<n&&o++}let s=this.#n,c=s-i,l=new Int32Array(s),u=ca(n-o,0,c);for(let t=0,n=0;t<s;t++)e.has(t+1)||(r[n]=r[t],l[n++]=t+1);r.copyWithin(u+i,u,c),r.set(a,u),l.copyWithin(u+i,u,c),l.set(t,u),this.#t=l,r.every((e,t)=>e===t+1)&&(this.#e=null)}deletePages(e){this.#a();let t=this.#e,n=this.#o();this.#i={pageNumberToId:t.slice(),pagesNumber:this.#n,prevPageNumbers:this.#t.slice()};let r=this.#n-e.length;this.#n=r;let i=this.#e=new Uint32Array(r);this.#t=new Int32Array(r);let a=0,o=0;for(let n of e){let e=n-1;e!==a&&(i.set(t.subarray(a,e),o),o+=e-a),a=e+1}a<t.length&&i.set(t.subarray(a),o),this.#s(n,new Set(e))}cancelDelete(){this.#i&&=(this.#e=this.#i.pageNumberToId,this.#n=this.#i.pagesNumber,this.#t=this.#i.prevPageNumbers,null)}cleanSavedData(){this.#i=null}copyPages(e){this.#a(),this.#r={pageNumbers:e,pageIds:e.map(e=>this.#e[e-1])}}cancelCopy(){this.#r=null}pastePages(e){this.#a();let t=this.#e,n=this.#o(),{pageNumbers:r,pageIds:i}=this.#r,a=this.#n+r.length;this.#n=a;let o=this.#e=new Uint32Array(a);this.#t=new Int32Array(a),o.set(t.subarray(0,e),0),o.set(i,e),o.set(t.subarray(e),e+r.length),this.#s(n,null,e,r),this.#r=null}#s(e,t=null,n=-1,r=null){let i=this.#t,a=this.#e,o=n+(r?.length??0),s=new Map;for(let c=0,l=this.#n;c<l;c++){if(c>=n&&c<o){i[c]=-r[c-n];continue}let l=a[c],u=e.get(l),d=s.get(l)||0;if(t&&u)for(;d<u.length&&t.has(u[d]);)d++;i[c]=u?.[d],s.set(l,d+1)}}hasBeenAltered(){return this.#e!==null}#c(e=null){if(!this.#e)return null;let t=new Int32Array(this.#n).fill(-1),n=new Map;if(e)for(let r of e){let e=this.getPageId(r),i=n.get(e)??0;n.set(e,i+1),t[r-1]=i}else for(let e=0,r=this.#n;e<r;e++){let r=this.#e[e],i=n.get(r)??0;n.set(r,i+1),t[e]=i}return t}getPageMappingForSaving(e=null,t=this.#c()){e??=this.#o();let n=0;for(let t of e.values())n=Math.max(n,t.length);let r=Array(n);for(let e=0;e<n;e++)r[e]={document:null,pageIndices:[],includePages:[]};for(let[t,n]of e)for(let e=0,i=n.length;e<i;e++)r[e].includePages.push([t-1,n[e]-1]);for(let{includePages:e,pageIndices:t}of r){e.sort((e,t)=>e[0]-t[0]);for(let n=0,r=e.length;n<r;n++)t.push(e[n][1]),e[n]=e[n][0]}return{pageInfos:r,copyLevels:t}}extractPages(e){e=Array.from(e).sort((e,t)=>e-t);let t=new Map;for(let n=0,r=e.length;n<r;n++){let r=this.getPageId(e[n]);t.getOrInsertComputed(r,ia).push(n+1)}return this.getPageMappingForSaving(t,this.#c(e))}getPrevPageNumber(e){return this.#t?.[e-1]??0}getPageNumber(e){if(!this.#e)return e;let t=this.#e;for(let n=0,r=this.#n;n<r;n++)if(t[n]===e)return n+1;return 0}getPageId(e){return this.#e?.[e-1]??e}getMapping(){return this.#e?.subarray(0,this.pagesNumber)}},Rc=Symbol(`INITIAL_DATA`),zc=()=>({...Promise.withResolvers(),data:Rc}),Bc=class{#e=new Map;get(e,t=null){if(t){let n=this.#e.getOrInsertComputed(e,zc);return n.promise.then(()=>t(n.data)),null}let n=this.#e.get(e);if(!n||n.data===Rc)throw Error(`Requesting object that isn't resolved yet ${e}.`);return n.data}has(e){let t=this.#e.get(e);return!!t&&t.data!==Rc}delete(e){let t=this.#e.get(e);return!t||t.data===Rc?!1:(this.#e.delete(e),!0)}resolve(e,t=null){let n=this.#e.getOrInsertComputed(e,zc);if(n.data!==Rc)throw Error(`Object already resolved ${e}.`);n.data=t,n.resolve()}clear(){for(let{data:e}of this.#e.values())e?.bitmap?.close();this.#e.clear()}*[Symbol.iterator](){for(let[e,{data:t}]of this.#e)t!==Rc&&(yield[e,t])}},Vc=1e5,Hc=30,Uc=class e{#e=Promise.withResolvers();#t=null;#n=!1;#r=!!globalThis.FontInspector?.enabled;#i=null;#a=null;#o=null;#s=0;#c=0;#l=Ma.pixelRatio;#u=null;#d=null;#f=0;#p=0;#m=Object.create(null);#h=[];#g=null;#_=[];#v=new WeakMap;#y=null;static#b=new Map;static#x=new Map;static#S=new WeakMap;static#C=null;static#w=new Set;constructor({textContentSource:t,images:n,container:r,viewport:i}){if(t instanceof ReadableStream)this.#g=t;else if(typeof t==`object`)this.#g=new ReadableStream({start(e){e.enqueue(t),e.close()}});else throw Error(`No "textContentSource" parameter specified.`);this.#t=this.#d=r,this.#i=n,this.#p=i.scale*this.#l,this.#f=i.rotation,this.#o={div:null,properties:null,ctx:null};let{pageWidth:a,pageHeight:o,pageX:s,pageY:c}=i.rawDims;this.#y=[1,0,0,-1,-s,c+o],this.#c=a,this.#s=o,e.#j(),r.style.setProperty(`--min-font-size`,e.#C),ja(r,i),this.#e.promise.finally(()=>{e.#w.delete(this),this.#o=null,this.#m=null}).catch(()=>{})}static get fontFamilyMap(){let{isWindows:e,isFirefox:t}=Zi.platform;return H(this,`fontFamilyMap`,new Map([[`sans-serif`,`${e&&t?`Calibri, `:``}sans-serif`],[`monospace`,`${e&&t?`Lucida Console, `:``}monospace`]]))}render(){this.#i&&this.#t.append(this.#i.render());let t=()=>{this.#u.read().then(({value:e,done:n})=>{n?this.#e.resolve():(this.#a??=e.lang,Object.assign(this.#m,e.styles),this.#T(e.items),t())},this.#e.reject)};return this.#u=this.#g.getReader(),e.#w.add(this),t(),this.#e.promise}update({viewport:t,onBefore:n=null}){let r=t.scale*Ma.pixelRatio,i=t.rotation;if(i!==this.#f&&(n?.(),this.#f=i,ja(this.#d,{rotation:i})),r!==this.#p){n?.(),this.#p=r,this.#l=Ma.pixelRatio;let t={div:null,properties:null,ctx:e.#O(this.#a)};for(let e of this.#_)t.properties=this.#v.get(e),t.div=e,this.#D(t)}}cancel(){let e=new Ji(`TextLayer task cancelled.`);this.#u?.cancel(e).catch(()=>{}),this.#u=null,this.#e.reject(e)}get textDivs(){return this.#_}get textContentItemsStr(){return this.#h}#T(t){if(this.#n)return;this.#o.ctx??=e.#O(this.#a);let n=this.#_,r=this.#h;for(let e of t){if(n.length>Vc){Fi(`Ignoring additional textDivs for performance reasons.`),this.#n=!0;return}if(e.str===void 0){if(e.type===`beginMarkedContentProps`||e.type===`beginMarkedContent`){let t=this.#t;this.#t=document.createElement(`span`),this.#t.classList.add(`markedContent`),e.id&&this.#t.setAttribute(`id`,e.id),e.tag===`Artifact`&&(this.#t.ariaHidden=!0),t.append(this.#t)}else e.type===`endMarkedContent`&&(this.#t=this.#t.parentNode)}else r.push(e.str),this.#E(e)}}#E(t){let n=document.createElement(`span`),r={angle:0,canvasWidth:0,hasText:t.str!==``,hasEOL:t.hasEOL,fontSize:0};this.#_.push(n);let i=U.transform(this.#y,t.transform),a=Math.atan2(i[1],i[0]),o=this.#m[t.fontName];o.vertical&&(a+=Math.PI/2);let s=this.#r&&o.fontSubstitution||o.fontFamily;s=e.fontFamilyMap.get(s)||s;let c=Math.hypot(i[2],i[3]),l=c*e.#M(s,o,this.#a),u,d;a===0?(u=i[4],d=i[5]-l):(u=i[4]+l*Math.sin(a),d=i[5]-l*Math.cos(a));let f=n.style;f.left=`${(100*u/this.#c).toFixed(2)}%`,f.top=`${(100*d/this.#s).toFixed(2)}%`;let p=Math.round(c*100)/100;f.setProperty(`--font-height`,`${p}px`),f.fontFamily=s,r.fontSize=p,n.setAttribute(`role`,`presentation`),n.textContent=t.str,n.dir=t.dir,this.#r&&(n.dataset.fontName=o.fontSubstitutionLoadedName||t.fontName),a!==0&&(r.angle=180/Math.PI*a);let m=!1;if(t.str.length>1)m=!0;else if(t.str!==` `&&t.transform[0]!==t.transform[3]){let e=Math.abs(t.transform[0]),n=Math.abs(t.transform[3]);e!==n&&Math.max(e,n)/Math.min(e,n)>1.5&&(m=!0)}if(m&&(r.canvasWidth=o.vertical?t.height:t.width),this.#v.set(n,r),this.#o.div=n,this.#o.properties=r,this.#D(this.#o),r.hasText&&this.#t.append(n),r.hasEOL){let e=document.createElement(`br`);e.setAttribute(`role`,`presentation`),this.#t.append(e)}}#D(t){let{div:n,properties:r,ctx:i}=t,{style:a}=n,{canvasWidth:o,fontSize:s}=r;if(o!==0&&s!==0&&r.hasText){let{fontFamily:t}=a,r=this.#l,c=e.#k(s*this.#p/r)*r;e.#A(i,c,t);let{width:l}=i.measureText(n.textContent);l>0&&a.setProperty(`--scale-x`,o*c/(l*s))}r.angle!==0&&a.setProperty(`--rotate`,`${r.angle}deg`)}static cleanup(){if(!(this.#w.size>0)){this.#b.clear();for(let{canvas:e}of this.#x.values())e.remove();this.#x.clear()}}static#O(e=null){let t=this.#x.get(e||=``);if(!t){let n=document.createElement(`canvas`);n.style.cssText=`position:absolute;top:0;left:0;width:0;height:0;display:none;letter-spacing:normal;word-spacing:normal`,n.lang=e,document.body.append(n),t=n.getContext(`2d`,{alpha:!1,willReadFrequently:!0}),this.#x.set(e,t),this.#S.set(t,{size:0,family:``})}return t}static#k(e){e=Math.fround(e);let t=Math.fround(e*131073);return Math.fround(t-Math.fround(t-e))}static#A(e,t,n){let r=this.#S.get(e);(t!==r.size||n!==r.family)&&(e.font=`${t}px ${n}`,r.size=t,r.family=n)}static#j(){if(this.#C!==null)return;let e=document.createElement(`div`);e.style.opacity=0,e.style.lineHeight=1,e.style.fontSize=`1px`,e.style.position=`absolute`,e.textContent=`X`,document.body.append(e),this.#C=e.getBoundingClientRect().height,e.remove()}static#M(e,t,n){let r=this.#b.get(e);if(r)return r;let i=this.#O(n);this.#A(i,Hc,e);let a=i.measureText(``),o=a.fontBoundingBoxAscent,s=Math.abs(a.fontBoundingBoxDescent),c=.8;return o?c=o/(o+s):(Zi.platform.isFirefox&&Fi("Enable the `dom.textMetrics.fontBoundingBox.enabled` preference in `about:config` to improve TextLayer rendering."),t.ascent?c=t.ascent:t.descent&&(c=1+t.descent)),this.#b.set(e,c),c}},Wc=100;function Gc(e={}){let t=new Kc,{docId:n}=t,r=e.url?qo(e.url):null,i=e.data?Jo(e.data):null,a=e.httpHeaders||null,o=e.withCredentials===!0,s=e.password??null,c=e.range instanceof qc?e.range:null,l=Number.isInteger(e.rangeChunkSize)&&e.rangeChunkSize>0?e.rangeChunkSize:2**16,u=e.worker instanceof Xc?e.worker:null,d=e.verbosity,f=typeof e.docBaseUrl==`string`&&!_a(e.docBaseUrl)?e.docBaseUrl:null,p=Yo(e.cMapUrl),m=e.cMapPacked!==!1,h=Yo(e.iccUrl),g=Yo(e.standardFontDataUrl),_=Yo(e.wasmUrl),v=e.stopAtErrors!==!0,y=Number.isInteger(e.maxImageSize)&&e.maxImageSize>-1?e.maxImageSize:-1,b=typeof e.isOffscreenCanvasSupported==`boolean`?e.isOffscreenCanvasSupported:!di,x=typeof e.isImageDecoderSupported==`boolean`?e.isImageDecoderSupported:!di,S=Number.isInteger(e.canvasMaxAreaInBytes)?e.canvasMaxAreaInBytes:-1,C=typeof e.disableFontFace==`boolean`?e.disableFontFace:di,w=e.fontExtraProperties===!0,T=e.enableXfa===!0,E=e.ownerDocument||globalThis.document,D=e.disableRange===!0,O=e.disableStream===!0,k=e.disableAutoFetch===!0,A=e.pdfBug===!0,j=e.CanvasFactory||(di?ps:ss),M=e.FilterFactory||(di?fs:ls),N=e.BinaryDataFactory||(di?ms:as),P=e.enableHWA===!0,ee=e.enableWebGPU===!0?ys():Promise.resolve(!1),te=e.useWasm!==!1,ne=e.pagesMapper||new Lc,re=typeof e.useSystemFonts==`boolean`?e.useSystemFonts:!di&&!C,ie=typeof e.useWorkerFetch==`boolean`?e.useWorkerFetch:!!(N===as&&p&&m&&g&&_&&Sa(p,document.baseURI)&&Sa(g,document.baseURI)&&Sa(_,document.baseURI));Mi(d);let ae={canvasFactory:new j({ownerDocument:E,enableHWA:P}),filterFactory:new M({docId:n,ownerDocument:E}),binaryDataFactory:ie?null:new N({cMapUrl:p,standardFontDataUrl:g,wasmUrl:_})};u||(u=Xc.create({verbosity:d,port:Mc.workerPort}),t._worker=u);let oe={docId:n,apiVersion:`6.4.299`,data:i,password:s,disableAutoFetch:k,rangeChunkSize:l,docBaseUrl:f,enableXfa:T,evaluatorOptions:{maxImageSize:y,disableFontFace:C,ignoreErrors:v,isOffscreenCanvasSupported:b,isImageDecoderSupported:x,canvasMaxAreaInBytes:S,fontExtraProperties:w,useSystemFonts:re,useWasm:te,useWorkerFetch:ie,cMapUrl:p,cMapPacked:m,iccUrl:h,standardFontDataUrl:g,wasmUrl:_,hasGPU:!1}},se={ownerDocument:E,pdfBug:A,styleElement:null,enableHWA:P,loadingParams:{disableAutoFetch:k,enableXfa:T}};return Promise.all([u.promise,ee]).then(function([,e]){if(u.destroyed)throw Error(`Worker was destroyed`);oe.evaluatorOptions.hasGPU=e;let s=u.messageHandler.sendWithPromise(`GetDocRequest`,oe,i?[i.buffer]:null),d;if(!i){if(c)d=new vc({pdfDataRangeTransport:c,disableRange:D,disableStream:O});else if(r)d=new(jc(r))({url:r,httpHeaders:a,withCredentials:o,rangeChunkSize:l,disableRange:D,disableStream:O});else throw Error("getDocument - expected either `data`, `range`, or `url` parameter.")}return s.then(e=>{if(u.destroyed)throw Error(`Worker was destroyed`);let r=new rs(n,e,u.port),i=new Zc(r,t,d,se,ae,ne);if(t._transport=i,t.destroyed)throw Error(`Loading aborted`);r.send(`Ready`,null)})}).catch(t._capability.reject).finally(t._setupCapability.resolve),t}var Kc=class e{static#e=0;_capability=Promise.withResolvers();_setupCapability=Promise.withResolvers();_transport=null;_worker=null;docId=`d${e.#e++}`;destroyed=!1;onPassword=null;onProgress=null;get promise(){return this._capability.promise}async destroy(){this.destroyed=!0,this._capability.promise.catch(()=>{});try{this._worker?.port&&(this._worker._pendingDestroy=!0),await this._setupCapability.promise,await this._transport?.destroy()}catch(e){throw this._worker?.port&&delete this._worker._pendingDestroy,e}this._transport=null,this._worker?.destroy(),this._worker=null}async getData(){return this._transport.getData()}},qc=class{#e=Promise.withResolvers();#t=null;constructor(e,t,n=!1,r=null){this.length=e,this.initialData=t,this.progressiveDone=n,this.contentDispositionFilename=r}onDataRange(e,t){this.#t({type:`range`,begin:e,chunk:t})}onDataProgressiveRead(e){this.#e.promise.then(()=>{this.#t({type:`progressiveRead`,chunk:e})})}onDataProgressiveDone(){this.#e.promise.then(()=>{this.#t({type:`progressiveDone`})})}transportReady(e){this.#t=e,this.#e.resolve()}requestDataRange(e,t){Ii(`Abstract method PDFDataRangeTransport.requestDataRange`)}abort(){}},Jc=class{constructor(e,t){this._pdfInfo=e,this._transport=t}get pagesMapper(){return this._transport.pagesMapper}get annotationStorage(){return this._transport.annotationStorage}get canvasFactory(){return this._transport.canvasFactory}get filterFactory(){return this._transport.filterFactory}get numPages(){return this._pdfInfo.numPages}get fingerprints(){return this._pdfInfo.fingerprints}get isPureXfa(){return H(this,`isPureXfa`,!!this._transport._htmlForXfa)}get allXfaHtml(){return this._transport._htmlForXfa}getPage(e){return this._transport.getPage(e)}getPageIndex(e){return this._transport.getPageIndex(e)}getDestinations(){return this._transport.getDestinations()}getDestination(e){return this._transport.getDestination(e)}getPageLabels(){return this._transport.getPageLabels()}getPageLayout(){return this._transport.getPageLayout()}getPageMode(){return this._transport.getPageMode()}getViewerPreferences(){return this._transport.getViewerPreferences()}getOpenAction(){return this._transport.getOpenAction()}getAttachments(){return this._transport.getAttachments()}getAttachmentContent(e){return this._transport.getAttachmentContent(e)}getAnnotationsByType(e,t){return this._transport.getAnnotationsByType(e,t)}getJSActions(){return this._transport.getDocJSActions()}getOutline(){return this._transport.getOutline()}getOptionalContentConfig({intent:e=`display`}={}){let{renderingIntent:t}=this._transport.getRenderingIntent(e);return this._transport.getOptionalContentConfig(t)}getPermissions(){return this._transport.getPermissions()}getMetadata(){return this._transport.getMetadata()}getMarkInfo(){return this._transport.getMarkInfo()}getData(){return this._transport.getData()}saveDocument(e){return this._transport.saveDocument(e)}extractPages(e,t=null){return this._transport.extractPages(e,t)}getDownloadInfo(){return this._transport.downloadInfoCapability.promise}cleanup(e=!1){return this._transport.startCleanup(e||this.isPureXfa)}cachedPageNumber(e){return this._transport.cachedPageNumber(e)}get loadingParams(){return this._transport.loadingParams}get loadingTask(){return this._transport.loadingTask}getFieldObjects(){return this._transport.getFieldObjects()}getSignatures(){return this._transport.getSignatures()}getSignatureData(e){return this._transport.getSignatureData(e)}hasJSActions(){return this._transport.hasJSActions()}getCalculationOrderIds(){return this._transport.getCalculationOrderIds()}},Yc=class e{#e=!1;#t=null;static#n=0;constructor(t,n,r,i,a=!1){this._pageIndex=t,this._id=e.#n++,this._pageInfo=n,this._transport=r,this._stats=a?new xa:null,this._pdfBug=a,this.commonObjs=r.commonObjs,this.objs=new Bc,this._intentStates=new Map,this.destroyed=!1,this.recordedBBoxes=null,this.#t=i,this.imageCoordinates=null}clone(t){let n=new e(t,this._pageInfo,this._transport,this.#t,this._pdfBug);return n.clonedFromIndex=this.clonedFromIndex??this._pageIndex,this._transport.updatePage(n),n}get pageNumber(){return this._pageIndex+1}set pageNumber(e){this._pageIndex=e-1,this._transport.updatePage(this)}get rotate(){return this._pageInfo.rotate}get ref(){return this._pageInfo.ref}get userUnit(){return this._pageInfo.userUnit}get view(){return this._pageInfo.view}getViewport({scale:e,rotation:t=this.rotate,offsetX:n=0,offsetY:r=0,dontFlip:i=!1}={}){return new la({viewBox:this.view,userUnit:this.userUnit,scale:e,rotation:t,offsetX:n,offsetY:r,dontFlip:i})}getAnnotations({intent:e=`display`}={}){let{renderingIntent:t}=this._transport.getRenderingIntent(e);return this._transport.getAnnotations(this._pageIndex,t)}getJSActions(){return this._transport.getPageJSActions(this._pageIndex)}get filterFactory(){return this._transport.filterFactory}get isPureXfa(){return H(this,`isPureXfa`,!!this._transport._htmlForXfa)}async getXfa(){return this._transport._htmlForXfa?.children[this._pageIndex]||null}render({canvasContext:e,canvas:t=e.canvas,viewport:n,intent:r=`display`,annotationMode:i=_i.ENABLE,transform:a=null,background:o=null,optionalContentConfigPromise:s=null,annotationCanvasMap:c=null,pageColors:l=null,printAnnotationStorage:u=null,isEditing:d=!1,recordImages:f=!1,recordOperations:p=!1,operationsFilter:m=null}){this._stats?.time(`Overall`);let h=this._transport.getRenderingIntent(r,i,u,d),{renderingIntent:g,cacheKey:_}=h;this.#e=!1,s||=this._transport.getOptionalContentConfig(g);let v=this._intentStates.getOrInsertComputed(_,oa);v.streamReaderCancelTimeout&&=(clearTimeout(v.streamReaderCancelTimeout),null);let y=!!(g&gi.PRINT);v.displayReadyCapability||(v.displayReadyCapability=Promise.withResolvers(),v.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},this._stats?.time(`Page Request`),this._pumpOperatorList(h));let b=!!(this._pdfBug&&globalThis.StepperManager?.enabled),x=!!t&&!this.recordedBBoxes&&(p||b),S=!!t&&!this.imageCoordinates&&f,C=e=>{if(v.renderTasks.delete(E),x){let e=E.gfx?.dependencyTracker.take();e&&(E.stepper?.setOperatorBBoxes(e,E.gfx.dependencyTracker.takeDebugMetadata()),p&&(this.recordedBBoxes=e))}S&&!e&&(this.imageCoordinates=E.gfx?.imagesTracker.take()),y&&(this.#e=!0),this.#r(),e?(E.capability.reject(e),this._abortOperatorList({intentState:v,reason:e instanceof Error?e:Error(e)})):E.capability.resolve(),this._stats&&(this._stats.timeEnd(`Rendering`),this._stats.timeEnd(`Overall`),globalThis.Stats?.enabled&&globalThis.Stats.add(this.pageNumber,this._stats))},w=null,T=null;(x||S)&&(T=new Eo(t,v.operatorList.length)),x&&(w=new Do(T,b));let E=new $c({callback:C,params:{canvas:t,canvasContext:e,dependencyTracker:w??T,imagesTracker:S?new Ao(t):null,viewport:n,transform:a,background:o},objs:this.objs,commonObjs:this.commonObjs,annotationCanvasMap:c,operatorList:v.operatorList,pageIndex:this._pageIndex,canvasFactory:this._transport.canvasFactory,filterFactory:this._transport.filterFactory,useRequestAnimationFrame:!y,pdfBug:this._pdfBug,pageColors:l,enableHWA:this._transport.enableHWA,operationsFilter:m});(v.renderTasks||=new Set).add(E);let D=E.task;return Promise.all([v.displayReadyCapability.promise,s]).then(([e,t])=>{if(this.destroyed)C();else{if(this._stats?.time(`Rendering`),!(t.renderingIntent&g))throw Error("Must use the same `intent`-argument when calling the `PDFPageProxy.render` and `PDFDocumentProxy.getOptionalContentConfig` methods.");E.initializeGraphics({transparency:e,optionalContentConfig:t}),E.operatorListChanged()}}).catch(C),D}getOperatorList({intent:e=`display`,annotationMode:t=_i.ENABLE,printAnnotationStorage:n=null,isEditing:r=!1}={}){function i(){o.operatorList.lastChunk&&(o.opListReadCapability.resolve(o.operatorList),o.renderTasks.delete(s))}let a=this._transport.getRenderingIntent(e,t,n,r,!0),o=this._intentStates.getOrInsertComputed(a.cacheKey,oa),s;return o.opListReadCapability||(s=Object.create(null),s.operatorListChanged=i,o.opListReadCapability=Promise.withResolvers(),(o.renderTasks||=new Set).add(s),o.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},this._stats?.time(`Page Request`),this._pumpOperatorList(a)),o.opListReadCapability.promise}streamTextContent({includeMarkedContent:e=!1,disableNormalization:t=!1}={}){return this._transport.messageHandler.sendWithStream(`GetTextContent`,{pageId:this.#t.getPageId(this._pageIndex+1)-1,pageIndex:this._pageIndex,includeMarkedContent:e===!0,disableNormalization:t===!0},{highWaterMark:100,size:e=>e.items.length})}async getTextContent(e={}){if(this._transport._htmlForXfa)return this.getXfa().then(e=>ua.textContent(e));let t=this.streamTextContent(e),n={items:[],styles:Object.create(null),lang:null};for await(let e of t)n.lang??=e.lang,Object.assign(n.styles,e.styles),n.items.push(...e.items);return n}getStructTree(){return this._transport.getStructTree(this._pageIndex)}_destroy(){this.destroyed=!0;let e=[];for(let t of this._intentStates.values())if(this._abortOperatorList({intentState:t,reason:Error(`Page was destroyed.`),force:!0}),!t.opListReadCapability)for(let n of t.renderTasks)e.push(n.completed),n.cancel();return this.objs.clear(),this.#e=!1,Promise.all(e)}cleanup(e=!1){this.#e=!0;let t=this.#r();return e&&t&&(this._stats&&=new xa),t}#r(){if(!this.#e||this.destroyed)return!1;for(let{renderTasks:e,operatorList:t}of this._intentStates.values())if(e.size>0||!t.lastChunk)return!1;return this._intentStates.clear(),this.objs.clear(),this.#e=!1,!0}_startRenderPage(e,t){let n=this._intentStates.get(t);n&&(this._stats?.timeEnd(`Page Request`),n.displayReadyCapability?.resolve(e))}_renderPageChunk(e,t){for(let n=0,r=e.length;n<r;n++)t.operatorList.fnArray.push(e.fnArray[n]),t.operatorList.argsArray.push(e.argsArray[n]);t.operatorList.lastChunk=e.lastChunk,t.operatorList.separateAnnots=e.separateAnnots;for(let e of t.renderTasks)e.operatorListChanged();e.lastChunk&&this.#r()}_pumpOperatorList({renderingIntent:e,cacheKey:t,annotationStorageSerializable:n,modifiedIds:r}){let{map:i,transfer:a}=n,o=this._transport.messageHandler.sendWithStream(`GetOperatorList`,{pageId:this.#t.getPageId(this._pageIndex+1)-1,pageIndex:this._pageIndex,pageProxyId:this._id,intent:e,cacheKey:t,annotationStorage:i,modifiedIds:r},void 0,a).getReader(),s=this._intentStates.get(t);s.streamReader=o;let c=()=>{o.read().then(({value:e,done:t})=>{t?s.streamReader=null:this._transport.destroyed||(this._renderPageChunk(e,s),c())},e=>{if(s.streamReader=null,!this._transport.destroyed){if(s.operatorList){s.operatorList.lastChunk=!0;for(let e of s.renderTasks)e.operatorListChanged();this.#r()}if(s.displayReadyCapability)s.displayReadyCapability.reject(e);else if(s.opListReadCapability)s.opListReadCapability.reject(e);else throw e}})};c()}_abortOperatorList({intentState:e,reason:t,force:n=!1}){if(e.streamReader){if(e.streamReaderCancelTimeout&&=(clearTimeout(e.streamReaderCancelTimeout),null),!n){if(e.renderTasks.size>0)return;if(t instanceof ga){let n=Wc;t.extraDelay>0&&t.extraDelay<1e3&&(n+=t.extraDelay),e.streamReaderCancelTimeout=setTimeout(()=>{e.streamReaderCancelTimeout=null,this._abortOperatorList({intentState:e,reason:t,force:!0})},n);return}}if(e.streamReader.cancel(new Ji(t.message)).catch(()=>{}),e.streamReader=null,!this._transport.destroyed){for(let[t,n]of this._intentStates)if(n===e){this._intentStates.delete(t);break}this.cleanup()}}}get stats(){return this._stats}},Xc=class e{#e=Promise.withResolvers();#t=null;#n=null;#r=null;static#i=0;static#a=!1;static#o=new WeakMap;static{di&&(this.#a=!0,Mc.workerSrc||=`./pdf.worker.mjs`),this._isSameOrigin=(e,t)=>{let n=URL.parse(e);if(!n?.origin||n.origin===`null`)return!1;let r=new URL(t,n);return n.origin===r.origin},this._createCDNWrapper=e=>{let t=`await import("${e}");`;return URL.createObjectURL(new Blob([t],{type:`text/javascript`}))}}constructor({name:t=null,port:n=null,verbosity:r=Ni()}={}){if(this.name=t,this.destroyed=!1,this.verbosity=r,n){if(e.#o.has(n))throw Error(`Cannot use more than one PDFWorker per port.`);e.#o.set(n,this),this.#c(n)}else this.#l()}get promise(){return this.#e.promise}#s(){this.#e.resolve(),this.#t.send(`configure`,{verbosity:this.verbosity})}get port(){return this.#n}get messageHandler(){return this.#t}#c(e){this.#n=e,this.#t=new rs(`main`,`worker`,e),this.#t.on(`ready`,()=>{}),this.#s()}#l(){if(e.#a||e.#d){this.#u();return}let{workerSrc:t}=e;try{e._isSameOrigin(window.location,t)||(t=e._createCDNWrapper(new URL(t,window.location).href));let n=new Worker(t,{type:`module`}),r=new rs(`main`,`worker`,n),i=()=>{a.abort(),r.destroy(),n.terminate(),this.destroyed?this.#e.reject(Error(`Worker was destroyed`)):this.#u()},a=new AbortController;n.addEventListener(`error`,()=>{this.#r||i()},{signal:a.signal}),r.on(`ready`,e=>{a.abort(),this.destroyed||!(e instanceof Uint8Array)?i():(this.#t=r,this.#n=n,this.#r=n,this.#s())})}catch{Pi(`The worker has been disabled.`),this.#u()}}#u(){e.#a||=(Fi(`Setting up fake worker.`),!0),e._setupFakeWorkerGlobal.then(t=>{if(this.destroyed){this.#e.reject(Error(`Worker was destroyed`));return}let n=new Qo;this.#n=n;let r=`fake${e.#i++}`,i=new rs(r+`_worker`,r,n);t.setup(i,n),this.#t=new rs(r,r+`_worker`,n),this.#s()}).catch(e=>{this.#e.reject(Error(`Setting up fake worker failed: "${e.message}".`))})}destroy(){this.destroyed=!0,this.#r?.terminate(),this.#r=null,e.#o.delete(this.#n),this.#n=null,this.#t?.destroy(),this.#t=null}static create(t){let n=this.#o.get(t?.port);if(n){if(n._pendingDestroy)throw Error("PDFWorker.create - the worker is being destroyed.\nPlease remember to await `PDFDocumentLoadingTask.destroy()`-calls.");return n}return new e(t)}static get workerSrc(){if(Mc.workerSrc)return Mc.workerSrc;throw Error(`No "GlobalWorkerOptions.workerSrc" specified.`)}static get#d(){try{return globalThis.pdfjsWorker?.WorkerMessageHandler||null}catch{return null}}static get _setupFakeWorkerGlobal(){return H(this,`_setupFakeWorkerGlobal`,(async()=>this.#d?this.#d:(await import(this.workerSrc)).WorkerMessageHandler)())}},Zc=class{downloadInfoCapability=Promise.withResolvers();#e=null;#t=new Map;#n=null;#r=new Map;#i=new Map;#a=new Map;#o=null;#s=null;constructor(e,t,n,r,i,a){this.messageHandler=e,this.loadingTask=t,this.#n=n,this.commonObjs=new Bc,this.fontLoader=new Po({ownerDocument:r.ownerDocument,styleElement:r.styleElement}),this.enableHWA=r.enableHWA,this.loadingParams=r.loadingParams,this._params=r,this.canvasFactory=i.canvasFactory,this.filterFactory=i.filterFactory,this.binaryDataFactory=i.binaryDataFactory,this.pagesMapper=a,this.destroyed=!1,this.destroyCapability=null,this.setupMessageHandler()}updatePage(e){this.#r.set(e._id,e),this.#i.set(e._pageIndex,Promise.resolve(e))}#c(e,t=null){return this.#t.getOrInsertComputed(e,()=>this.messageHandler.sendWithPromise(e,t))}#l({loaded:e,total:t}){this.loadingTask.onProgress?.({loaded:e,total:t,percent:t?ca(Math.round(e/t*100),0,100):NaN})}get annotationStorage(){return H(this,`annotationStorage`,new go)}getRenderingIntent(e,t=_i.ENABLE,n=null,r=!1,i=!1){let a=gi.DISPLAY,o=ho;switch(e){case`any`:a=gi.ANY;break;case`display`:break;case`print`:a=gi.PRINT;break;default:Fi(`getRenderingIntent - invalid intent: ${e}`)}let s=a&gi.PRINT&&n instanceof _o?n:this.annotationStorage;switch(t){case _i.DISABLE:a+=gi.ANNOTATIONS_DISABLE;break;case _i.ENABLE:break;case _i.ENABLE_FORMS:a+=gi.ANNOTATIONS_FORMS;break;case _i.ENABLE_STORAGE:a+=gi.ANNOTATIONS_STORAGE,o=s.serializable;break;default:Fi(`getRenderingIntent - invalid annotationMode: ${t}`)}r&&(a+=gi.IS_EDITING),i&&(a+=gi.OPLIST);let{ids:c,hash:l}=s.modifiedIds,u=[a,o.hash,l];return{renderingIntent:a,cacheKey:u.join(`_`),annotationStorageSerializable:o,modifiedIds:c}}destroy(){if(this.destroyCapability)return this.destroyCapability.promise;this.destroyed=!0,this.destroyCapability=Promise.withResolvers(),this.#o?.reject(Error(`Worker was destroyed during onPassword callback`));let e=[];for(let t of this.#r.values())e.push(t._destroy());this.#r.clear(),this.#i.clear(),this.#a.clear(),Object.hasOwn(this,`annotationStorage`)&&this.annotationStorage.resetModified();let t=this.messageHandler.sendWithPromise(`Terminate`,null);return e.push(t),Promise.all(e).then(()=>{this.commonObjs.clear(),this.fontLoader.clear(),this.#t.clear(),this.filterFactory.destroy(),Uc.cleanup(),this.#n?.cancelAllRequests(new Ji(`Worker was terminated.`)),this.messageHandler?.destroy(),this.messageHandler=null,this.destroyCapability.resolve()},this.destroyCapability.reject),this.destroyCapability.promise}setupMessageHandler(){let{messageHandler:e,loadingTask:t}=this;e.on(`GetReader`,(e,t)=>{Li(this.#n,"GetReader - no `BasePDFStream` instance available."),this.#e=this.#n.getFullReader(),this.#e.onProgress=e=>this.#l(e),t.onPull=()=>{this.#e.read().then(function({value:e,done:n}){n?t.close():(Li(e instanceof ArrayBuffer,`GetReader - expected an ArrayBuffer.`),t.enqueue(new Uint8Array(e),1,[e]))}).catch(e=>{t.error(e)})},t.onCancel=e=>{this.#e.cancel(e),t.ready.catch(e=>{if(!this.destroyed)throw e})}}),e.on(`ReaderHeadersReady`,async e=>{await this.#e.headersReady;let{isStreamingSupported:t,isRangeSupported:n,contentLength:r}=this.#e;return t&&n&&(this.#e.onProgress=null),{isStreamingSupported:t,isRangeSupported:n,contentLength:r}}),e.on(`GetRangeReader`,(e,t)=>{Li(this.#n,"GetRangeReader - no `BasePDFStream` instance available.");let n=this.#n.getRangeReader(e.begin,e.end);n?(t.onPull=()=>{n.read().then(function({value:e,done:n}){n?t.close():(Li(e instanceof ArrayBuffer,`GetRangeReader - expected an ArrayBuffer.`),t.enqueue(new Uint8Array(e),1,[e]))}).catch(e=>{t.error(e)})},t.onCancel=e=>{n.cancel(e),t.ready.catch(e=>{if(!this.destroyed)throw e})}):t.close()}),e.on(`GetDoc`,({pdfInfo:e})=>{this.pagesMapper.pagesNumber=e.numPages,this._numPages=e.numPages,this._htmlForXfa=e.htmlForXfa,delete e.htmlForXfa,t._capability.resolve(new Jc(e,this))}),e.on(`DocException`,e=>{t._capability.reject(ns(e))}),e.on(`PasswordRequest`,e=>{this.#o=Promise.withResolvers();try{if(!t.onPassword)throw ns(e);t.onPassword(e=>{e instanceof Error?this.#o.reject(e):this.#o.resolve({password:e})},e.code)}catch(e){this.#o.reject(e)}return this.#o.promise}),e.on(`DataLoaded`,e=>{this.#l({loaded:e.length,total:e.length}),this.downloadInfoCapability.resolve(e)}),e.on(`StartRenderPage`,e=>{this.destroyed||this.#r.get(e.pageProxyId)._startRenderPage(e.transparency,e.cacheKey)}),e.on(`commonobj`,([t,n,r])=>{if(this.destroyed||this.commonObjs.has(t))return null;switch(n){case`Font`:if(`error`in r){let e=r.error;Fi(`Error during font loading: ${e}`),this.commonObjs.resolve(t,e);break}let i=new Fo(new Wo(r.buffer),this._params.pdfBug&&globalThis.FontInspector?.enabled?(e,t)=>globalThis.FontInspector.fontAdded(e,t):null,r.charProcOperatorList,r.extra);this.fontLoader.bind(i).catch(()=>e.sendWithPromise(`FontFallback`,{id:t})).finally(()=>{i.fontExtraProperties||i.clearData(),this.commonObjs.resolve(t,i)});break;case`CopyLocalImage`:let{imageRef:a}=r;Li(a,`The imageRef must be defined.`);for(let e of this.#r.values())for(let[,n]of e.objs){if(n?.ref!==a)continue;if(!n.dataLen)return null;let e=structuredClone(n);return this.commonObjs.resolve(t,e),n.dataLen}break;case`FontPath`:this.commonObjs.resolve(t,new Ko(r));break;case`Image`:this.commonObjs.resolve(t,r);break;case`Pattern`:let o=new Go(r);this.commonObjs.resolve(t,o.getIR());break;default:throw Error(`Got unknown common object type ${n}`)}return null}),e.on(`obj`,([e,t,n,r])=>{if(this.destroyed)return;let i=this.#r.get(t);if(!i.objs.has(e)){if(i._intentStates.size===0)r?.bitmap?.close();else switch(n){case`Image`:case`Pattern`:i.objs.resolve(e,r);break;default:throw Error(`Got unknown object type ${n}`)}}}),e.on(`DocProgress`,e=>{this.destroyed||this.#l(e)}),e.on(`FetchBinaryData`,async e=>{if(this.destroyed)throw Error(`Worker was destroyed.`);if(!this.binaryDataFactory)throw Error("`BinaryDataFactory` not initialized, see the `useWorkerFetch` parameter.");return this.binaryDataFactory.fetch(e)})}getData(){return this.messageHandler.sendWithPromise(`GetData`,null)}saveDocument(e=null){this.annotationStorage.size<=0&&Fi("saveDocument called while `annotationStorage` is empty, please use the getData-method instead.");let{map:t,transfer:n}=this.annotationStorage.serializable;return this.messageHandler.sendWithPromise(`SaveDocument`,{isPureXfa:!!this._htmlForXfa,numPages:this._numPages,annotationStorage:t,supportsPrintToPDF:this.#s!==null,filename:this.#e?.filename??null},n).finally(()=>{this.#s=null,this.annotationStorage.resetModified()})}extractPages(e,t=null){let n={pageInfos:e},r,i=globalThis.ImageBitmap;if(typeof i==`function`){let t=Array.isArray(e)?e:[e];for(let e of t)e?.image instanceof i&&(r||=[]).push(e.image)}if(this.annotationStorage.size>0){let e=this.annotationStorage.serializable,{map:i}=e;e.transfer?.length&&(r?r.push(...e.transfer):r=e.transfer);let a=this.pagesMapper.getMapping();if(a){let e=new Map;for(let[n,r]of i){if(r?.pageIndex!==void 0&&r.pageIndex>=0&&r.pageIndex<a.length){let i=t?.[r.pageIndex]??0,o=a[r.pageIndex]-1;if(o!==r.pageIndex||i!==0){e.set(n,{...r,pageIndex:o,copyLevel:i});continue}}e.set(n,r)}i=e}n.annotationStorage=i}return this.messageHandler.sendWithPromise(`ExtractPages`,n,r).finally(()=>{this.annotationStorage.resetModified()})}getPage(e){if(!Number.isInteger(e)||e<=0||e>this.pagesMapper.pagesNumber)return Promise.reject(Error(`Invalid page request.`));let t=e-1,n=this.pagesMapper.getPageId(e)-1,r=this.#i.get(t);if(r)return r;let i=this.messageHandler.sendWithPromise(`GetPage`,{pageIndex:n}).then(e=>{if(this.destroyed)throw Error(`Transport destroyed`);e.refStr&&this.#a.set(e.refStr,n);let r=new Yc(t,e,this,this.pagesMapper,this._params.pdfBug);return this.#r.set(r._id,r),r});return this.#i.set(t,i),i}async getPageIndex(e){if(!Xo(e))throw Error(`Invalid pageIndex request.`);let t=await this.messageHandler.sendWithPromise(`GetPageIndex`,{num:e.num,gen:e.gen}),n=this.pagesMapper.getPageNumber(t+1);if(n===0)throw Error(`GetPageIndex: page has been removed.`);return n-1}getAnnotations(e,t){return this.messageHandler.sendWithPromise(`GetAnnotations`,{pageIndex:this.pagesMapper.getPageId(e+1)-1,intent:t})}getFieldObjects(){return this.#c(`GetFieldObjects`)}getSignatures(){return this.#c(`GetSignatures`)}getSignatureData(e){return this.messageHandler.sendWithPromise(`GetSignatureData`,e)}hasJSActions(){return this.#c(`HasJSActions`)}getCalculationOrderIds(){return this.messageHandler.sendWithPromise(`GetCalculationOrderIds`,null)}getDestinations(){return this.messageHandler.sendWithPromise(`GetDestinations`,null)}getDestination(e){return typeof e==`string`?this.messageHandler.sendWithPromise(`GetDestination`,{id:e}):Promise.reject(Error(`Invalid destination request.`))}getPageLabels(){return this.messageHandler.sendWithPromise(`GetPageLabels`,null)}getPageLayout(){return this.messageHandler.sendWithPromise(`GetPageLayout`,null)}getPageMode(){return this.messageHandler.sendWithPromise(`GetPageMode`,null)}getViewerPreferences(){return this.messageHandler.sendWithPromise(`GetViewerPreferences`,null)}getOpenAction(){return this.messageHandler.sendWithPromise(`GetOpenAction`,null)}getAttachments(){return this.messageHandler.sendWithPromise(`GetAttachments`,null)}getAttachmentContent(e){return this.messageHandler.sendWithPromise(`GetAttachmentContent`,e)}getAnnotationsByType(e,t){return this.messageHandler.sendWithPromise(`GetAnnotationsByType`,{types:e,pageIndexesToSkip:t})}getDocJSActions(){return this.#c(`GetDocJSActions`)}getPageJSActions(e){return this.messageHandler.sendWithPromise(`GetPageJSActions`,{pageIndex:this.pagesMapper.getPageId(e+1)-1})}getStructTree(e){return this.messageHandler.sendWithPromise(`GetStructTree`,{pageIndex:this.pagesMapper.getPageId(e+1)-1})}getOutline(){return this.messageHandler.sendWithPromise(`GetOutline`,null)}getOptionalContentConfig(e){return this.#c(`GetOptionalContentConfig`).then(t=>new Ic(t,e))}getPermissions(){return this.messageHandler.sendWithPromise(`GetPermissions`,null)}getMetadata(){let e=`GetMetadata`;return this.#t.getOrInsertComputed(e,()=>this.messageHandler.sendWithPromise(e,null).then(e=>({info:e[0],metadata:e[1]?new Nc(e[1]):null,contentDispositionFilename:this.#e?.filename??null,contentLength:this.#e?.contentLength??null,hasStructTree:e[2]})))}getMarkInfo(){return this.messageHandler.sendWithPromise(`GetMarkInfo`,null)}async startCleanup(e=!1){if(!this.destroyed){await this.messageHandler.sendWithPromise(`Cleanup`,null);for(let e of this.#r.values())if(!e.cleanup())throw Error(`startCleanup: Page ${e.pageNumber} is currently rendering.`);this.commonObjs.clear(),e||this.fontLoader.clear(),this.#t.clear(),this.filterFactory.destroy(!0),Uc.cleanup()}}cachedPageNumber(e){if(!Xo(e))return null;let t=e.gen===0?`${e.num}R`:`${e.num}R${e.gen}`,n=this.#a.get(t);if(n>=0){let e=this.pagesMapper.getPageNumber(n+1);if(e!==0)return e}return null}},Qc=class{_internalRenderTask=null;onContinue=null;onError=null;constructor(e){this._internalRenderTask=e}get promise(){return this._internalRenderTask.capability.promise}cancel(e=0){this._internalRenderTask.cancel(null,e)}get separateAnnots(){let{separateAnnots:e}=this._internalRenderTask.operatorList;if(!e)return!1;let{annotationCanvasMap:t}=this._internalRenderTask;return e.form||e.canvas&&t?.size>0}get imageCoordinates(){return this._internalRenderTask.imageCoordinates||null}},$c=class e{#e=null;static#t=new WeakSet;constructor({callback:e,params:t,objs:n,commonObjs:r,annotationCanvasMap:i,operatorList:a,pageIndex:o,canvasFactory:s,filterFactory:c,useRequestAnimationFrame:l=!1,pdfBug:u=!1,pageColors:d=null,enableHWA:f=!1,operationsFilter:p=null}){this.callback=e,this.params=t,this.objs=n,this.commonObjs=r,this.annotationCanvasMap=i,this.operatorListIdx=null,this.operatorList=a,this._pageIndex=o,this.canvasFactory=s,this.filterFactory=c,this._pdfBug=u,this.pageColors=d,this.running=!1,this.graphicsReadyCallback=null,this.graphicsReady=!1,this._useRequestAnimationFrame=l===!0&&typeof window<`u`,this.cancelled=!1,this.capability=Promise.withResolvers(),this.task=new Qc(this),this._cancelBound=this.cancel.bind(this),this._continueBound=this._continue.bind(this),this._scheduleNextBound=this._scheduleNext.bind(this),this._nextBound=this._next.bind(this),this._canvas=t.canvas,this._canvasContext=t.canvas?null:t.canvasContext,this._enableHWA=f,this._dependencyTracker=t.dependencyTracker,this._imagesTracker=t.imagesTracker,this._operationsFilter=p}get completed(){return this.capability.promise.catch(()=>{})}initializeGraphics({transparency:t=!1,optionalContentConfig:n}){if(this.cancelled)return;if(this._canvas){if(e.#t.has(this._canvas))throw Error(`Cannot use the same canvas during multiple render() operations. Use different canvas or ensure previous operations were cancelled or completed.`);e.#t.add(this._canvas)}this._pdfBug&&globalThis.StepperManager?.enabled&&(this.stepper=globalThis.StepperManager.create(this._pageIndex),this.stepper.init(this.operatorList),this.stepper.nextBreakPoint=this.stepper.getNextBreakPoint());let{viewport:r,transform:i,background:a,dependencyTracker:o,imagesTracker:s}=this.params,c=this._canvasContext||this._canvas.getContext(`2d`,{alpha:!1,willReadFrequently:!this._enableHWA});this.gfx=new Qs(c,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:n},this.annotationCanvasMap,this.pageColors,o,s),this.gfx.beginDrawing({transform:i,viewport:r,transparency:t,background:a}),this.operatorListIdx=0,this.graphicsReady=!0,this.graphicsReadyCallback?.()}cancel(t=null,n=0){this.running=!1,this.cancelled=!0,this.gfx?.endDrawing(),this.#e&&=(window.cancelAnimationFrame(this.#e),null),e.#t.delete(this._canvas),t||=new ga(`Rendering cancelled, page ${this._pageIndex+1}`,n),this.callback(t),this.task.onError?.(t)}operatorListChanged(){this.graphicsReady?(this.gfx.dependencyTracker?.growOperationsCount(this.operatorList.fnArray.length),this.stepper?.updateOperatorList(this.operatorList),!this.running&&this._continue()):this.graphicsReadyCallback||=this._continueBound}_continue(){this.running=!0,!this.cancelled&&(this.task.onContinue?this.task.onContinue(this._scheduleNextBound):this._scheduleNext())}_scheduleNext(){this._useRequestAnimationFrame?this.#e=window.requestAnimationFrame(()=>{this.#e=null,this._nextBound().catch(this._cancelBound)}):Promise.resolve().then(this._nextBound).catch(this._cancelBound)}async _next(){this.cancelled||(this.operatorListIdx=this.gfx.executeOperatorList(this.operatorList,this.operatorListIdx,this._continueBound,this.stepper,this._operationsFilter),this.operatorListIdx===this.operatorList.argsArray.length&&(this.running=!1,this.operatorList.lastChunk&&(this.gfx.endDrawing(),e.#t.delete(this._canvas),this.callback())))}},el=`6.4.299`,tl=`d0991a0d5`;Kr();var nl=class e{#e=null;#t=null;#n;#r=null;#i=!1;#a=!1;#o=null;#s;#c=null;#l=null;static#u=null;static get _keyboardManager(){return H(this,`_keyboardManager`,new $a([[[`Escape`],e.prototype._hideDropdownFromKeyboard],[[`Space`],e.prototype._colorSelectFromKeyboard],[[`ArrowDown`,`ArrowRight`],e.prototype._moveToNext],[[`ArrowUp`,`ArrowLeft`],e.prototype._moveToPrevious],[[`Home`],e.prototype._moveToBeginning],[[`End`],e.prototype._moveToEnd]]))}constructor({editor:t=null,uiManager:n=null}){t?(this.#a=!1,this.#o=t):this.#a=!0,this.#l=t?._uiManager||n,this.#s=this.#l._eventBus,this.#n=t?.color?.toUpperCase()||this.#l?.highlightColors.values().next().value||`#FFFF98`,e.#u||=Object.freeze({blue:`pdfjs-editor-colorpicker-blue`,green:`pdfjs-editor-colorpicker-green`,pink:`pdfjs-editor-colorpicker-pink`,red:`pdfjs-editor-colorpicker-red`,yellow:`pdfjs-editor-colorpicker-yellow`})}renderButton(){let e=this.#e=document.createElement(`button`);e.className=`colorPicker`,e.tabIndex=`0`,e.setAttribute(`data-l10n-id`,`pdfjs-editor-colorpicker-button`),e.ariaHasPopup=`true`,this.#o&&(e.ariaControls=`${this.#o.id}_colorpicker_dropdown`);let t=this.#l._signal;e.addEventListener(`click`,this.#m.bind(this),{signal:t}),e.addEventListener(`keydown`,this.#p.bind(this),{signal:t});let n=this.#t=document.createElement(`span`);return n.className=`swatch`,n.ariaHidden=`true`,n.style.backgroundColor=this.#n,e.append(n),e}renderMainDropdown(){let e=this.#r=this.#d();return e.ariaOrientation=`horizontal`,e.ariaLabelledBy=`highlightColorPickerLabel`,e}#d(){let t=document.createElement(`div`),n=this.#l._signal;t.addEventListener(`contextmenu`,Ca,{signal:n}),t.className=`dropdown`,t.role=`listbox`,t.ariaMultiSelectable=`false`,t.ariaOrientation=`vertical`,t.setAttribute(`data-l10n-id`,`pdfjs-editor-colorpicker-dropdown`),this.#o&&(t.id=`${this.#o.id}_colorpicker_dropdown`);for(let[r,i]of this.#l.highlightColors){let a=document.createElement(`button`);a.tabIndex=`0`,a.role=`option`,a.setAttribute(`data-color`,i),a.title=r,a.setAttribute(`data-l10n-id`,e.#u[r]);let o=document.createElement(`span`);a.append(o),o.className=`swatch`,o.style.backgroundColor=i,a.ariaSelected=i===this.#n,a.addEventListener(`click`,this.#f.bind(this,i),{signal:n}),t.append(a)}return t.addEventListener(`keydown`,this.#p.bind(this),{signal:n}),t}#f(e,t){t.stopPropagation(),this.#s.dispatch(`switchannotationeditorparams`,{source:this,type:xi.HIGHLIGHT_COLOR,value:e}),this.update(e)}_colorSelectFromKeyboard(e){if(e.target===this.#e){this.#m(e);return}let t=e.target.getAttribute(`data-color`);t&&this.#f(t,e)}_moveToNext(e){this.#g?e.target===this.#e?this.#r.firstElementChild?.focus():e.target.nextSibling?.focus():this.#m(e)}_moveToPrevious(e){e.target===this.#r?.firstElementChild||e.target===this.#e?this.#g&&this._hideDropdownFromKeyboard():(this.#g||this.#m(e),e.target.previousSibling?.focus())}_moveToBeginning(e){this.#g?this.#r.firstElementChild?.focus():this.#m(e)}_moveToEnd(e){this.#g?this.#r.lastElementChild?.focus():this.#m(e)}#p(t){e._keyboardManager.exec(this,t)}#m(e){if(this.#g){this.hideDropdown();return}if(this.#i=e.detail===0,this.#c||(this.#c=new AbortController,window.addEventListener(`pointerdown`,this.#h.bind(this),{signal:this.#l.combinedSignal(this.#c)})),this.#e.ariaExpanded=`true`,this.#r){this.#r.classList.remove(`hidden`);return}let t=this.#r=this.#d();this.#e.append(t)}#h(e){this.#r?.contains(e.target)||this.hideDropdown()}hideDropdown(){this.#r?.classList.add(`hidden`),this.#e.ariaExpanded=`false`,this.#c?.abort(),this.#c=null}get#g(){return this.#r&&!this.#r.classList.contains(`hidden`)}_hideDropdownFromKeyboard(){this.#a||(this.#g?(this.hideDropdown(),this.#e.focus({preventScroll:!0,focusVisible:this.#i})):this.#o?.unselect())}update(e){if(this.#t&&(this.#t.style.backgroundColor=e),!this.#r)return;let t=this.#l.highlightColors.values();for(let n of this.#r.children)n.ariaSelected=t.next().value===e.toUpperCase()}destroy(){this.#e?.remove(),this.#e=null,this.#t=null,this.#r?.remove(),this.#r=null}},rl=class e{#e=null;#t=!1;#n=null;#r=null;static#i=null;constructor(t){this.#n=t,this.#r=t._uiManager,e.#i||=Object.freeze({freetext:`pdfjs-editor-color-picker-free-text-input`,ink:`pdfjs-editor-color-picker-ink-input`})}renderButton(){if(this.#e)return this.#e;let{editorType:t,colorType:n,colorAndOpacityType:r,opacityType:i,color:a,opacity:o}=this.#n,s=this.#t=Zi.isAlphaColorInputSupported&&i!==void 0,c=this.#e=document.createElement(`input`);if(c.type=`color`,s){c.setAttribute(`alpha`,``);let e=U.hexNums[Math.round((o??1)*255)];c.value=(a||`#000000`)+e}else c.value=a||`#000000`;return c.className=`basicColorPicker`,c.tabIndex=0,c.setAttribute(`data-l10n-id`,e.#i[t]),c.addEventListener(`input`,()=>{if(s){let e=Ea(c.value);if(!e)return;let[t,a,o,s]=e,l=U.makeHexColor(t,a,o);r===void 0?(this.#r.updateParams(n,l),this.#r.updateParams(i,s)):this.#r.updateParams(r,{color:l,opacity:s})}else this.#r.updateParams(n,c.value)},{signal:this.#r._signal}),c}update(e){if(this.#e){if(this.#t){let t=U.hexNums[Math.round(this.#n.opacity*255)];this.#e.value=e+t}else this.#e.value=e}}updateOpacity(e){if(!this.#e||!this.#t)return;let t=U.hexNums[Math.round(e*255)];this.#e.value=this.#n.color+t}destroy(){this.#e?.remove(),this.#e=null}hideDropdown(){}};Ir();function il(e){return Math.floor(ca(e,0,1)*255).toString(16).padStart(2,`0`)}function al(e){return ca(e,0,1)*255}var ol=class{static CMYK_G([e,t,n,r]){return[`G`,1-Math.min(1,.3*e+.59*n+.11*t+r)]}static G_CMYK([e]){return[`CMYK`,0,0,0,1-e]}static G_RGB([e]){return[`RGB`,e,e,e]}static G_rgb([e]){return e=al(e),[e,e,e]}static G_HTML([e]){let t=il(e);return`#${t}${t}${t}`}static RGB_G([e,t,n]){return[`G`,.3*e+.59*t+.11*n]}static RGB_rgb(e){return e.map(al)}static RGB_HTML(e){return`#${e.map(il).join(``)}`}static T_HTML(){return`#00000000`}static T_rgb(){return[null]}static CMYK_RGB([e,t,n,r]){return[`RGB`,1-Math.min(1,e+r),1-Math.min(1,n+r),1-Math.min(1,t+r)]}static CMYK_rgb([e,t,n,r]){return[al(1-Math.min(1,e+r)),al(1-Math.min(1,n+r)),al(1-Math.min(1,t+r))]}static CMYK_HTML(e){let t=this.CMYK_RGB(e).slice(1);return this.RGB_HTML(t)}static RGB_CMYK([e,t,n]){let r=1-e,i=1-t,a=1-n;return[`CMYK`,r,i,a,Math.min(r,i,a)]}},sl=class{create(e,t,n=!1){if(e<=0||t<=0)throw Error(`Invalid SVG dimensions`);let r=this._createSVG(`svg:svg`);return r.setAttribute(`version`,`1.1`),n||(r.setAttribute(`width`,`${e}px`),r.setAttribute(`height`,`${t}px`)),r.setAttribute(`preserveAspectRatio`,`none`),r.setAttribute(`viewBox`,`0 0 ${e} ${t}`),r}createElement(e){if(typeof e!=`string`)throw Error(`Invalid SVG element type`);return this._createSVG(e)}_createSVG(e){Ii("Abstract method `_createSVG` called.")}},cl=class extends sl{_createSVG(e){return document.createElementNS(hi,e)}},ll=9,ul=new WeakSet,dl=new Date().getTimezoneOffset()*60*1e3,fl=class{static create(e){switch(e.data.annotationType){case Ti.LINK:return new hl(e);case Ti.TEXT:return new gl(e);case Ti.WIDGET:switch(e.data.fieldType){case`Tx`:return new vl(e);case`Btn`:return e.data.radioButton?new xl(e):e.data.checkBox?new bl(e):new Sl(e);case`Ch`:return new Cl(e);case`Sig`:return new yl(e)}return new _l(e);case Ti.POPUP:return new wl(e);case Ti.FREETEXT:return new El(e);case Ti.LINE:return new Dl(e);case Ti.SQUARE:return new Ol(e);case Ti.CIRCLE:return new kl(e);case Ti.POLYLINE:return new Al(e);case Ti.CARET:return new Ml(e);case Ti.INK:return new Nl(e);case Ti.POLYGON:return new jl(e);case Ti.HIGHLIGHT:return new Pl(e);case Ti.UNDERLINE:return new Fl(e);case Ti.SQUIGGLY:return new Il(e);case Ti.STRIKEOUT:return new Ll(e);case Ti.STAMP:return new Rl(e);case Ti.FILEATTACHMENT:return new zl(e);case Ti.RICHMEDIA:case Ti.SCREEN:case Ti.SOUND:return new Bl(e);default:return new pl(e)}}},pl=class e{#e=null;#t=!1;#n=null;constructor(e,{isRenderable:t=!1,ignoreBorder:n=!1,createQuadrilaterals:r=!1}={}){this.isRenderable=t,this.data=e.data,this.layer=e.layer,this.linkService=e.linkService,this.downloadManager=e.downloadManager,this.imageResourcesPath=e.imageResourcesPath,this.renderForms=e.renderForms,this.svgFactory=e.svgFactory,this.annotationStorage=e.annotationStorage,this.enableComment=e.enableComment,this.enableScripting=e.enableScripting,this.hasJSActions=e.hasJSActions,this._fieldObjects=e.fieldObjects,this.parent=e.parent,this.hasOwnCommentButton=!1,t&&(this.contentElement=this.container=this._createContainer(n)),r&&this._createQuadrilaterals()}static _hasPopupData({contentsObj:e,richText:t}){return!!(e?.str||t?.str)}get _isEditable(){return this.data.isEditable}get hasPopupData(){return e._hasPopupData(this.data)||this.enableComment&&!!this.commentText}get commentData(){let{data:e}=this,t=this.annotationStorage?.getEditor(e.id);return t?t.getData():e}get hasCommentButton(){return this.enableComment&&this.hasPopupElement}get commentButtonPosition(){let e=this.annotationStorage?.getEditor(this.data.id);if(e)return e.commentButtonPositionInPage;let{quadPoints:t,inkLists:n,rect:r}=this.data,i=-1/0,a=-1/0;if(t?.length>=8){for(let e=0;e<t.length;e+=8)t[e+1]>a?(a=t[e+1],i=t[e+2]):t[e+1]===a&&(i=Math.max(i,t[e+2]));return[i,a]}if(n?.length>=1){for(let e of n)for(let t=0,n=e.length;t<n;t+=2)e[t+1]>a?(a=e[t+1],i=e[t]):e[t+1]===a&&(i=Math.max(i,e[t]));if(i!==1/0)return[i,a]}return r?[r[2],r[3]]:null}_normalizePoint(e){let{page:{view:t},viewport:{rawDims:{pageWidth:n,pageHeight:r,pageX:i,pageY:a}}}=this.parent;return e[1]=t[3]-e[1]+t[1],e[0]=100*(e[0]-i)/n,e[1]=100*(e[1]-a)/r,e}get commentText(){let{data:e}=this;return this.annotationStorage.getRawValue(`${yi}${e.id}`)?.popup?.contents||e.contentsObj?.str||``}set commentText(e){let{data:t}=this,n={deleted:!e,contents:e||``};this.annotationStorage.updateEditor(t.id,{popup:n})||this.annotationStorage.setValue(`${yi}${t.id}`,{id:t.id,annotationType:t.annotationType,page:this.parent.page,popup:n,popupRef:t.popupRef,modificationDate:new Date}),e||this.removePopup()}removePopup(){(this.#n?.popup||this.popup)?.remove(),this.#n=this.popup=null}updateEdited(e){if(!this.container)return;e.rect&&(this.#e||={rect:this.data.rect.slice(0)});let{rect:t,popup:n}=e;t&&this.#r(t);let r=this.#n?.popup||this.popup;!r&&n?.text&&(this._createPopup(n),r=this.#n.popup),r&&(r.updateEdited(e),n?.deleted&&(r.remove(),this.#n=null,this.popup=null))}resetEdited(){this.#e&&=(this.#r(this.#e.rect),this.#n?.popup.resetEdited(),null)}#r(e){let{container:{style:t},data:{rect:n,rotation:r},parent:{viewport:{rawDims:{pageWidth:i,pageHeight:a,pageX:o,pageY:s}}}}=this;n?.splice(0,4,...e),t.left=`${100*(e[0]-o)/i}%`,t.top=`${100*(a-e[3]+s)/a}%`,r===0?(t.width=`${100*(e[2]-e[0])/i}%`,t.height=`${100*(e[3]-e[1])/a}%`):this.setRotation(r)}_createContainer(e){let{data:t,parent:{page:n,viewport:r}}=this,i=document.createElement(`section`);i.setAttribute(`data-annotation-id`,t.id),this instanceof _l||this instanceof hl||this instanceof Bl||(i.tabIndex=0);let{style:a}=i;if(a.zIndex=this.parent.zIndex,this.parent.zIndex+=2,t.alternativeText&&(i.title=t.alternativeText),t.noRotate&&i.classList.add(`norotate`),!t.rect||this instanceof wl){let{rotation:e}=t;return!t.hasOwnCanvas&&e!==0&&this.setRotation(e,i),i}let{width:o,height:s}=this;if(!e&&t.borderStyle.width>0){a.borderWidth=`${t.borderStyle.width}px`;let e=t.borderStyle.horizontalCornerRadius,n=t.borderStyle.verticalCornerRadius;switch((e>0||n>0)&&(a.borderRadius=`calc(${e}px * var(--total-scale-factor)) / calc(${n}px * var(--total-scale-factor))`),t.borderStyle.style){case Ei.SOLID:a.borderStyle=`solid`;break;case Ei.DASHED:a.borderStyle=`dashed`;break;case Ei.BEVELED:Fi(`Unimplemented border style: beveled`);break;case Ei.INSET:Fi(`Unimplemented border style: inset`);break;case Ei.UNDERLINE:a.borderBottomStyle=`solid`}let r=t.borderColor||null;r?(this.#t=!0,a.borderColor=U.makeHexColor(...r)):a.borderWidth=0}let c=U.normalizeRect([t.rect[0],n.view[3]-t.rect[1]+n.view[1],t.rect[2],n.view[3]-t.rect[3]+n.view[1]]),{pageWidth:l,pageHeight:u,pageX:d,pageY:f}=r.rawDims;a.left=`${100*(c[0]-d)/l}%`,a.top=`${100*(c[1]-f)/u}%`;let{rotation:p}=t;return t.hasOwnCanvas||p===0?(a.width=`${100*o/l}%`,a.height=`${100*s/u}%`):this.setRotation(p,i),i}setRotation(e,t=this.container){if(!this.data.rect)return;let{pageWidth:n,pageHeight:r}=this.parent.viewport.rawDims,{width:i,height:a}=this;e%180!=0&&([i,a]=[a,i]),t.style.width=`${100*i/n}%`,t.style.height=`${100*a/r}%`,t.setAttribute(`data-main-rotation`,(360-e)%360)}get _commonActions(){let e=(e,t,n)=>{let r=n.detail[e],i=r[0],a=r.slice(1);n.target.style[t]=ol[`${i}_HTML`](a),this.annotationStorage.setValue(this.data.id,{[t]:ol[`${i}_rgb`](a)})};return H(this,`_commonActions`,{display:e=>{let{display:t}=e.detail,n=t%2==1;this.container.style.visibility=n?`hidden`:`visible`,this.annotationStorage.setValue(this.data.id,{noView:n,noPrint:t===1||t===2})},print:e=>{this.annotationStorage.setValue(this.data.id,{noPrint:!e.detail.print})},hidden:e=>{let{hidden:t}=e.detail;this.container.style.visibility=t?`hidden`:`visible`,this.annotationStorage.setValue(this.data.id,{noPrint:t,noView:t})},focus:e=>{setTimeout(()=>e.target.focus({preventScroll:!1}),0)},userName:e=>{e.target.title=e.detail.userName},readonly:e=>{e.target.disabled=e.detail.readonly},required:e=>{this._setRequired(e.target,e.detail.required)},bgColor:t=>{e(`bgColor`,`backgroundColor`,t)},fillColor:t=>{e(`fillColor`,`backgroundColor`,t)},fgColor:t=>{e(`fgColor`,`color`,t)},textColor:t=>{e(`textColor`,`color`,t)},borderColor:t=>{e(`borderColor`,`borderColor`,t)},strokeColor:t=>{e(`strokeColor`,`borderColor`,t)},rotation:e=>{let t=e.detail.rotation;this.setRotation(t),this.annotationStorage.setValue(this.data.id,{rotation:t})}})}_dispatchEventFromSandbox(e,t){let n=this._commonActions;for(let r of Object.keys(t.detail))(e[r]||n[r])?.(t)}_setDefaultPropertiesFromJS(e){if(!this.enableScripting)return;let t=this.annotationStorage.getRawValue(this.data.id);if(!t)return;let n=this._commonActions;for(let[r,i]of Object.entries(t)){let a=n[r];a&&(a({detail:{[r]:i},target:e}),delete t[r])}}_createQuadrilaterals(){if(!this.container)return;let{quadPoints:e}=this.data;if(!e)return;let[t,n,r,i]=this.data.rect.map(Math.fround);if(e.length===8){let[a,o,s,c]=e.subarray(2,6);if(r===a&&i===o&&t===s&&n===c)return}let{style:a}=this.container,o;if(this.#t){let{borderColor:e,borderWidth:t}=a;a.borderWidth=0,o=[`url('data:image/svg+xml;utf8,`,`<svg xmlns="${hi}" preserveAspectRatio="none" viewBox="0 0 1 1">`,`<g fill="transparent" stroke="${e}" stroke-width="${t}">`],this.container.classList.add(`hasBorder`)}let s=r-t,c=i-n,{svgFactory:l}=this,u=l.createElement(`svg`);u.classList.add(`quadrilateralsContainer`),u.setAttribute(`width`,0),u.setAttribute(`height`,0),u.role=`none`;let d=l.createElement(`defs`);u.append(d);let f=l.createElement(`clipPath`),p=`clippath_${this.data.id}`;f.setAttribute(`id`,p),f.setAttribute(`clipPathUnits`,`objectBoundingBox`),d.append(f);for(let n=2,r=e.length;n<r;n+=8){let r=e[n],a=e[n+1],u=e[n+2],d=e[n+3],p=l.createElement(`rect`),m=(u-t)/s,h=(i-a)/c,g=(r-u)/s,_=(a-d)/c;p.setAttribute(`x`,m),p.setAttribute(`y`,h),p.setAttribute(`width`,g),p.setAttribute(`height`,_),f.append(p),o?.push(`<rect vector-effect="non-scaling-stroke" x="${m}" y="${h}" width="${g}" height="${_}"/>`)}this.#t&&(o.push(`</g></svg>')`),a.backgroundImage=o.join(``)),this.container.append(u),this.container.style.clipPath=`url(#${p})`}_createPopup(e=null){let{data:t}=this,n,r;e?(n={str:e.text},r=e.date):(n=t.contentsObj,r=t.modificationDate),this.#n=new wl({data:{color:t.color,titleObj:t.titleObj,modificationDate:r,contentsObj:n,richText:t.richText,parentRect:t.rect,borderStyle:0,id:`popup_${t.id}`,rotation:t.rotation,noRotate:!0},linkService:this.linkService,parent:this.parent,elements:[this]})}get hasPopupElement(){return!!(this.#n||this.popup||this.data.popupRef)}get extraPopupElement(){return this.#n}render(){Ii("Abstract method `AnnotationElement.render` called")}_getElementsByName(e,t=null){let n=[];if(this._fieldObjects){let r=this._fieldObjects.get(e)||[];for(let{page:e,id:i,exportValues:a}of r){if(e===-1||i===t)continue;let r=typeof a==`string`?a:null,o=document.querySelector(`[data-element-id="${i}"]`);o&&!ul.has(o)?Fi(`_getElementsByName - element not allowed: ${i}`):n.push({id:i,exportValue:r,domElement:o})}return n}for(let r of document.getElementsByName(e)){let{exportValue:e}=r,i=r.getAttribute(`data-element-id`);i!==t&&ul.has(r)&&n.push({id:i,exportValue:e,domElement:r})}return n}show(){this.container&&(this.container.hidden=!1),this.popup?.maybeShow()}hide(){this.container&&(this.container.hidden=!0),this.popup?.forceHide()}getElementsToTriggerPopup(){return this.container}addHighlightArea(){let e=this.getElementsToTriggerPopup();if(Array.isArray(e))for(let t of e)t.classList.add(`highlightArea`);else e.classList.add(`highlightArea`)}_editOnDoubleClick(){if(!this._isEditable)return;let{annotationEditorType:e,data:{id:t}}=this;this.container.addEventListener(`dblclick`,()=>{this.linkService.eventBus?.dispatch(`switchannotationeditormode`,{source:this,mode:e,editId:t,mustEnterInEditMode:!0})})}updateOC(e){this.data.oc&&e&&(e.isVisible(this.data.oc)?this.show():this.hide())}get width(){return this.data.rect[2]-this.data.rect[0]}get height(){return this.data.rect[3]-this.data.rect[1]}_setBackgroundColor(e){let t=this.data.backgroundColor||null;e.style.backgroundColor=t===null?`transparent`:U.makeHexColor(...t)}},ml=class extends pl{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0}),this.editor=e.editor}render(){return this.container.className=`editorAnnotation`,this.container}createOrUpdatePopup(){let{editor:e}=this;e.hasComment&&this._createPopup(e.comment)}get hasCommentButton(){return this.enableComment&&this.editor.hasComment}get commentButtonPosition(){return this.editor.commentButtonPositionInPage}get commentText(){return this.editor.comment.text}set commentText(e){this.editor.comment=e,e||this.removePopup()}get commentData(){return this.editor.getData()}remove(){this.parent.removeAnnotation(this.data.id),this.container.remove(),this.container=null,this.removePopup()}},hl=class extends pl{constructor(e,t=null){super(e,{isRenderable:!0,ignoreBorder:!!t?.ignoreBorder,createQuadrilaterals:!0}),this.isTooltipOnly=e.data.isTooltipOnly}render(){let{data:e,linkService:t}=this,n=document.createElement(`a`);n.setAttribute(`data-element-id`,e.id);let r=!1;return e.url?(t.addLinkAttributes(n,e.url,e.newWindow),r=!0):e.action?(this._bindNamedAction(n,e.action,e.overlaidText),r=!0):e.attachment?(this.#t(n,e.attachmentId,e.attachment,e.overlaidText,e.attachmentDest),r=!0):e.setOCGState?(this.#n(n,e.setOCGState,e.overlaidText),r=!0):e.dest?(this._bindLink(n,e.dest,e.overlaidText),r=!0):(e.actions&&(e.actions.has(`Action`)||e.actions.has(`Mouse Up`)||e.actions.has(`Mouse Down`))&&this.enableScripting&&this.hasJSActions&&(this._bindJSAction(n,e),r=!0),e.resetForm?(this._bindResetFormAction(n,e.resetForm),r=!0):this.isTooltipOnly&&!r&&(this._bindLink(n,``),r=!0)),this.container.classList.add(`linkAnnotation`),r&&(this.contentElement=n,this.container.append(n)),this.container}#e(){this.container.setAttribute(`data-internal-link`,``)}_bindLink(e,t,n=``){e.href=this.linkService.getDestinationHash(t),e.onclick=()=>(t&&this.linkService.goToDestination(t),!1),(t||t===``)&&this.#e(),n&&(e.title=n)}_bindNamedAction(e,t,n=``){e.href=this.linkService.getAnchorUrl(``),e.onclick=()=>(this.linkService.executeNamedAction(t),!1),n&&(e.title=n),this.#e()}#t(e,t,n,r=``,i=null){e.href=this.linkService.getAnchorUrl(``),n.description?e.title=n.description:r&&(e.title=r);let a=async()=>{let e=await this.linkService.getAttachmentContent(t);e&&this.downloadManager?.openOrDownloadData(e,n.filename,i)};e.onclick=()=>(a(),!1),this.#e()}#n(e,t,n=``){e.href=this.linkService.getAnchorUrl(``),e.onclick=()=>(this.linkService.executeSetOCGState(t),!1),n&&(e.title=n),this.#e()}_bindJSAction(e,{actions:t,id:n,overlaidText:r}){e.href=this.linkService.getAnchorUrl(``);let i=new Map([[`Action`,`onclick`],[`Mouse Up`,`onmouseup`],[`Mouse Down`,`onmousedown`]]);for(let r of t.keys()){let t=i.get(r);t&&(e[t]=()=>(this.linkService.eventBus?.dispatch(`dispatcheventinsandbox`,{source:this,detail:{id:n,name:r}}),!1))}r&&(e.title=r),e.onclick||=()=>!1,this.#e()}_bindResetFormAction(e,t){let n=e.onclick;n||(e.href=this.linkService.getAnchorUrl(``)),this.#e(),this._fieldObjects?e.onclick=()=>{n?.();let{fields:e,refs:r,include:i}=t,a=[];if(e.length!==0||r.length!==0){let t=new Set(r);for(let n of e){let e=this._fieldObjects.get(n)||[];for(let{id:n}of e)t.add(n)}let n=new Map;for(let e of this._fieldObjects.values())for(let{id:t,kidIds:r}of e)r&&n.set(t,r);for(let e of t)for(let r of n.get(e)||[])t.add(r);for(let e of this._fieldObjects.values())for(let n of e)t.has(n.id)===i&&a.push(n)}else for(let e of this._fieldObjects.values())a.push(...e);let o=this.annotationStorage,s=[];for(let e of a){let{id:t}=e;switch(s.push(t),e.type){case`text`:{let n=e.defaultValue||``;o.setValue(t,{value:n});break}case`checkbox`:case`radiobutton`:{let n=e.defaultValue===e.exportValues;o.setValue(t,{value:n});break}case`combobox`:case`listbox`:{let n=e.defaultValue||``;o.setValue(t,{value:n});break}default:continue}let n=document.querySelector(`[data-element-id="${t}"]`);n&&(ul.has(n)?n.dispatchEvent(new Event(`resetform`)):Fi(`_bindResetFormAction - element not allowed: ${t}`))}return this.enableScripting&&this.linkService.eventBus?.dispatch(`dispatcheventinsandbox`,{source:this,detail:{id:`app`,ids:s,name:`ResetForm`}}),!1}:(Fi('_bindResetFormAction - "resetForm" action not supported, ensure that the `fieldObjects` parameter is provided.'),n||(e.onclick=()=>!1))}},gl=class extends pl{constructor(e){super(e,{isRenderable:!0})}render(){this.container.classList.add(`textAnnotation`);let e=document.createElement(`img`);return e.src=this.imageResourcesPath+`annotation-`+this.data.name.toLowerCase()+`.svg`,e.setAttribute(`data-l10n-id`,`pdfjs-text-annotation-type`),e.setAttribute(`data-l10n-args`,JSON.stringify({type:this.data.name})),!this.data.popupRef&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container.append(e),this.container}},_l=class extends pl{render(){return this.container}_getKeyModifier(e){return Zi.platform.isMac?e.metaKey:e.ctrlKey}_setEventListener(e,t,n,r,i){n.includes(`mouse`)?e.addEventListener(n,e=>{this.linkService.eventBus?.dispatch(`dispatcheventinsandbox`,{source:this,detail:{id:this.data.id,name:r,value:i(e),shift:e.shiftKey,modifier:this._getKeyModifier(e)}})}):e.addEventListener(n,e=>{if(n===`blur`){if(!t.focused||!e.relatedTarget)return;t.focused=!1}else if(n===`focus`){if(t.focused)return;t.focused=!0}i&&this.linkService.eventBus?.dispatch(`dispatcheventinsandbox`,{source:this,detail:{id:this.data.id,name:r,value:i(e)}})})}_setEventListeners(e,t,n,r){let{actions:i}=this.data;for(let[a,o]of n)(o===`Action`||i?.has(o))&&((o===`Focus`||o===`Blur`)&&(t||={focused:!1}),this._setEventListener(e,t,a,o,r),o===`Focus`&&!i?.has(`Blur`)?this._setEventListener(e,t,`blur`,`Blur`,null):o===`Blur`&&!i?.has(`Focus`)&&this._setEventListener(e,t,`focus`,`Focus`,null))}_setTextStyle(e){let t=[`left`,`center`,`right`],{fontColor:n}=this.data.defaultAppearanceData,r=this.data.defaultAppearanceData.fontSize||ll,i=e.style,a,o=e=>Math.round(10*e)/10;if(this.data.multiLine){let e=Math.abs(this.data.rect[3]-this.data.rect[1]-2),t=e/(Math.round(e/(1.35*r))||1);a=Math.min(r,o(t/1.35))}else{let e=Math.abs(this.data.rect[3]-this.data.rect[1]-2);a=Math.min(r,o(e/1.35))}i.fontSize=`calc(${a}px * var(--total-scale-factor))`,i.color=U.makeHexColor(...n),this.data.textAlignment!==null&&!this.data.comb&&(i.textAlign=t[this.data.textAlignment])}_setRequired(e,t){t?e.setAttribute(`required`,!0):e.removeAttribute(`required`),e.setAttribute(`aria-required`,t)}},vl=class extends _l{constructor(e){let t=e.renderForms||e.data.hasOwnCanvas||!e.data.hasAppearance&&!!e.data.fieldValue;super(e,{isRenderable:t})}setPropertyOnSiblings(e,t,n,r){let i=this.annotationStorage;for(let a of this._getElementsByName(e.name,e.id))a.domElement&&(a.domElement[t]=n),i.setValue(a.id,{[r]:n})}render(){let e=this.annotationStorage,t=this.data.id;this.container.classList.add(`textWidgetAnnotation`);let n=null;if(this.renderForms){let r=e.getValue(t,{value:this.data.fieldValue}),i=r.value||``,a=e.getValue(t,{charLimit:this.data.maxLen}).charLimit;a&&i.length>a&&(i=i.slice(0,a));let o=r.formattedValue||this.data.textContent?.join(`
|
|
47
|
+
`)||null;o&&this.data.comb&&(o=o.replaceAll(/\s+/g,``));let s={userValue:i,formattedValue:o,lastCommittedValue:null,commitKey:1,focused:!1};this.data.multiLine?(n=document.createElement(`textarea`),n.textContent=o??i,this.data.doNotScroll&&(n.style.overflowY=`hidden`)):(n=document.createElement(`input`),n.type=this.data.password?`password`:`text`,n.setAttribute(`value`,o??i),this.data.doNotScroll&&(n.style.overflowX=`hidden`)),this.data.hasOwnCanvas&&(this.container.classList.add(`hasOwnCanvas`),e.has(t)&&this.container.classList.add(`sandboxModified`)),ul.add(n),this.contentElement=n,n.setAttribute(`data-element-id`,t),n.disabled=this.data.readOnly,n.name=this.data.fieldName,n.tabIndex=0;let{datetimeFormat:c,datetimeType:l,timeStep:u}=this.data,d=!!l&&this.enableScripting;c&&(n.title=c),this._setRequired(n,this.data.required),a&&(n.maxLength=a),n.addEventListener(`input`,r=>{e.setValue(t,{value:r.target.value}),this.setPropertyOnSiblings(n,`value`,r.target.value,`value`),s.formattedValue=null}),n.addEventListener(`resetform`,e=>{let t=this.data.defaultFieldValue??``;n.value=s.userValue=t,s.formattedValue=null});let f=e=>{let{formattedValue:t}=s;t!=null&&(e.target.value=t),e.target.scrollLeft=0};if(this.enableScripting&&this.hasJSActions){n.addEventListener(`focus`,e=>{if(s.focused)return;let{target:t}=e;if(d&&(t.type=l,u&&(t.step=u)),s.userValue){let e=s.userValue;if(d){if(l===`time`){let n=new Date(e);t.value=[n.getHours(),n.getMinutes(),n.getSeconds()].map(e=>e.toString().padStart(2,`0`)).join(`:`)}else t.value=new Date(e-dl).toISOString().split(l===`date`?`T`:`.`,1)[0]}else t.value=e}s.lastCommittedValue=t.value,s.commitKey=1,this.data.actions?.has(`Focus`)||(s.focused=!0)}),n.addEventListener(`updatefromsandbox`,n=>{this.container.classList.add(`sandboxModified`),this._dispatchEventFromSandbox({value(n){s.userValue=n.detail.value??``,d||e.setValue(t,{value:s.userValue.toString()}),n.target.value=s.userValue},formattedValue(n){let{formattedValue:r}=n.detail;s.formattedValue=r,r!=null&&n.target!==document.activeElement&&(n.target.value=r);let i={formattedValue:r};d&&(i.value=r),e.setValue(t,i)},selRange(e){e.target.setSelectionRange(...e.detail.selRange)},charLimit:n=>{let{charLimit:r}=n.detail,{target:i}=n;if(r===0){i.removeAttribute(`maxLength`);return}i.setAttribute(`maxLength`,r);let a=s.userValue;!a||a.length<=r||(a=a.slice(0,r),i.value=s.userValue=a,e.setValue(t,{value:a}),this.linkService.eventBus?.dispatch(`dispatcheventinsandbox`,{source:this,detail:{id:t,name:`Keystroke`,value:a,willCommit:!0,commitKey:1,selStart:i.selectionStart,selEnd:i.selectionEnd}}))}},n)}),n.addEventListener(`keydown`,e=>{s.commitKey=1;let n=-1;if(e.key===`Escape`?n=0:e.key===`Enter`&&!this.data.multiLine?n=2:e.key===`Tab`&&(s.commitKey=3),n===-1)return;let{value:r}=e.target;s.lastCommittedValue!==r&&(s.lastCommittedValue=r,s.userValue=r,this.linkService.eventBus?.dispatch(`dispatcheventinsandbox`,{source:this,detail:{id:t,name:`Keystroke`,value:r,willCommit:!0,commitKey:n,selStart:e.target.selectionStart,selEnd:e.target.selectionEnd}}))});let r=f;f=null,n.addEventListener(`blur`,e=>{if(!s.focused||!e.relatedTarget)return;this.data.actions?.has(`Blur`)||(s.focused=!1);let{target:n}=e,{value:i}=n;if(d){if(i&&l===`time`){let e=i.split(`:`).map(e=>parseInt(e,10));i=new Date(2e3,0,1,e[0],e[1],e[2]||0).valueOf(),n.step=``}else i.includes(`T`)||(i=`${i}T00:00`),i=new Date(i).valueOf();n.type=`text`}s.userValue=i,s.lastCommittedValue!==i&&this.linkService.eventBus?.dispatch(`dispatcheventinsandbox`,{source:this,detail:{id:t,name:`Keystroke`,value:i,willCommit:!0,commitKey:s.commitKey,selStart:e.target.selectionStart,selEnd:e.target.selectionEnd}}),r(e)}),this.data.actions?.has(`Keystroke`)&&n.addEventListener(`beforeinput`,e=>{s.lastCommittedValue=null;let{data:n,target:r}=e,{value:i,selectionStart:a,selectionEnd:o}=r,c=a,l=o;switch(e.inputType){case`deleteWordBackward`:{let e=/\w/;for(;c>0&&!e.test(i[c-1]);)c--;for(;c>0&&e.test(i[c-1]);)c--;break}case`deleteWordForward`:{let e=i.substring(a).match(/^\W*\w*/);e&&(l+=e[0].length);break}case`deleteContentBackward`:a===o&&--c;break;case`deleteContentForward`:a===o&&(l+=1)}e.preventDefault(),this.linkService.eventBus?.dispatch(`dispatcheventinsandbox`,{source:this,detail:{id:t,name:`Keystroke`,value:i,change:n||``,willCommit:!1,selStart:c,selEnd:l}})}),this._setEventListeners(n,s,[[`focus`,`Focus`],[`blur`,`Blur`],[`mousedown`,`Mouse Down`],[`mouseenter`,`Mouse Enter`],[`mouseleave`,`Mouse Exit`],[`mouseup`,`Mouse Up`]],e=>e.target.value)}if(f&&n.addEventListener(`blur`,f),this.data.comb){let e=(this.data.rect[2]-this.data.rect[0])/a;n.classList.add(`comb`),n.style.setProperty(`--comb-width`,`calc(${e}px * var(--total-scale-factor))`);let t=this.data.textAlignment;if(t===1||t===2){let e=()=>{let e=a-n.value.length;n.style.setProperty(`--comb-offset`,`${t===1?e>>1:e}`)};e();for(let t of[`input`,`blur`,`resetform`,`updatefromsandbox`])n.addEventListener(t,e)}}}else n=document.createElement(`div`),n.textContent=this.data.fieldValue,n.style.verticalAlign=`middle`,n.style.display=`table-cell`,this.data.hasOwnCanvas&&(n.hidden=!0);return this._setTextStyle(n),this._setBackgroundColor(n),this._setDefaultPropertiesFromJS(n),this.container.append(n),this.container}},yl=class extends _l{constructor(e){super(e,{isRenderable:!!e.data.hasOwnCanvas})}},bl=class extends _l{constructor(e){super(e,{isRenderable:e.renderForms})}render(){let e=this.annotationStorage,t=this.data,n=t.id,r=e.getValue(n,{value:t.exportValue===t.fieldValue}).value;typeof r==`string`&&(r=r!==`Off`,e.setValue(n,{value:r})),this.container.classList.add(`buttonWidgetAnnotation`,`checkBox`);let i=document.createElement(`input`);return ul.add(i),i.setAttribute(`data-element-id`,n),i.disabled=t.readOnly,this._setRequired(i,this.data.required),i.type=`checkbox`,i.name=t.fieldName,r&&i.setAttribute(`checked`,!0),i.setAttribute(`exportValue`,t.exportValue),i.tabIndex=0,i.addEventListener(`change`,r=>{let{name:i,checked:a}=r.target;for(let r of this._getElementsByName(i,n)){let n=a&&r.exportValue===t.exportValue;r.domElement&&(r.domElement.checked=n),e.setValue(r.id,{value:n})}e.setValue(n,{value:a})}),i.addEventListener(`resetform`,e=>{let n=t.defaultFieldValue||`Off`;e.target.checked=n===t.exportValue}),this.enableScripting&&this.hasJSActions&&(i.addEventListener(`updatefromsandbox`,t=>{this._dispatchEventFromSandbox({value(t){t.target.checked=t.detail.value!==`Off`,e.setValue(n,{value:t.target.checked})}},t)}),this._setEventListeners(i,null,[[`change`,`Validate`],[`change`,`Action`],[`focus`,`Focus`],[`blur`,`Blur`],[`mousedown`,`Mouse Down`],[`mouseenter`,`Mouse Enter`],[`mouseleave`,`Mouse Exit`],[`mouseup`,`Mouse Up`]],e=>e.target.checked)),this._setDefaultPropertiesFromJS(i),this.container.append(i),this.container}},xl=class extends _l{constructor(e){super(e,{isRenderable:e.renderForms})}render(){this.container.classList.add(`buttonWidgetAnnotation`,`radioButton`);let e=this.annotationStorage,t=this.data,n=t.id,r=e.getValue(n,{value:t.buttonValue!==null&&t.fieldValue===t.buttonValue}).value;if(typeof r==`string`&&(r=r!==t.buttonValue,e.setValue(n,{value:r})),r)for(let r of this._getElementsByName(t.fieldName,n))e.setValue(r.id,{value:!1});let i=document.createElement(`input`);if(ul.add(i),i.setAttribute(`data-element-id`,n),i.disabled=t.readOnly,this._setRequired(i,this.data.required),i.type=`radio`,i.name=t.fieldName,r&&i.setAttribute(`checked`,!0),i.tabIndex=0,i.addEventListener(`change`,t=>{let{name:r,checked:i}=t.target;for(let t of this._getElementsByName(r,n))e.setValue(t.id,{value:!1});e.setValue(n,{value:i})}),i.addEventListener(`resetform`,e=>{let n=t.defaultFieldValue;e.target.checked=n!=null&&n===t.buttonValue}),this.enableScripting&&this.hasJSActions){let r=t.buttonValue;i.addEventListener(`updatefromsandbox`,t=>{this._dispatchEventFromSandbox({value:t=>{let i=r===t.detail.value;for(let r of this._getElementsByName(t.target.name)){let t=i&&r.id===n;r.domElement&&(r.domElement.checked=t),e.setValue(r.id,{value:t})}}},t)}),this._setEventListeners(i,null,[[`change`,`Validate`],[`change`,`Action`],[`focus`,`Focus`],[`blur`,`Blur`],[`mousedown`,`Mouse Down`],[`mouseenter`,`Mouse Enter`],[`mouseleave`,`Mouse Exit`],[`mouseup`,`Mouse Up`]],e=>e.target.checked)}return this._setDefaultPropertiesFromJS(i),this.container.append(i),this.container}},Sl=class extends hl{constructor(e){super(e,{ignoreBorder:e.data.hasAppearance})}render(){let e=super.render();e.classList.add(`buttonWidgetAnnotation`,`pushButton`);let t=e.lastChild;return this.enableScripting&&this.hasJSActions&&t&&(this._setDefaultPropertiesFromJS(t),t.addEventListener(`updatefromsandbox`,e=>{this._dispatchEventFromSandbox({},e)})),e}},Cl=class extends _l{constructor(e){super(e,{isRenderable:e.renderForms})}render(){this.container.classList.add(`choiceWidgetAnnotation`);let e=this.annotationStorage,t=this.data.id,n=e.getValue(t,{value:this.data.fieldValue}),r=document.createElement(`select`);ul.add(r),r.setAttribute(`data-element-id`,t),r.disabled=this.data.readOnly,this._setRequired(r,this.data.required),r.name=this.data.fieldName,r.tabIndex=0;let i=this.data.combo&&this.data.options.length>0;this.data.combo||(r.size=this.data.options.length,this.data.multiSelect&&(r.multiple=!0)),r.addEventListener(`resetform`,e=>{let t=this.data.defaultFieldValue;for(let e of r.options)e.selected=e.value===t});let a=(e,t)=>{let n=t.replaceAll(` `,`\xA0`);e.textContent=n,n!==t&&e.setAttribute(`display-value`,t)};for(let e of this.data.options){let t=document.createElement(`option`);a(t,e.displayValue),t.value=e.exportValue,n.value.includes(e.exportValue)&&(t.setAttribute(`selected`,!0),i=!1),r.append(t)}let o=null;if(i){let e=document.createElement(`option`);e.value=` `,e.setAttribute(`hidden`,!0),e.setAttribute(`selected`,!0),r.prepend(e),o=()=>{e.remove(),r.removeEventListener(`input`,o),o=null},r.addEventListener(`input`,o)}let s=e=>{let t=e?`value`:`textContent`,{options:n,multiple:i}=r;return i?Array.prototype.filter.call(n,e=>e.selected).map(e=>e[t]):n.selectedIndex===-1?null:n[n.selectedIndex][t]},c=s(!1),l=e=>{let t=e.target.options;return Array.prototype.map.call(t,e=>({displayValue:e.getAttribute(`display-value`)||e.textContent,exportValue:e.value}))};return this.enableScripting&&this.hasJSActions?(r.addEventListener(`updatefromsandbox`,n=>{this._dispatchEventFromSandbox({value(n){o?.();let i=n.detail.value,a=new Set(Array.isArray(i)?i:[i]);for(let e of r.options)e.selected=a.has(e.value);e.setValue(t,{value:s(!0)}),c=s(!1)},multipleSelection(e){r.multiple=!0},remove(n){let i=r.options,a=n.detail.remove;i[a].selected=!1,r.remove(a),i.length>0&&Array.prototype.findIndex.call(i,e=>e.selected)===-1&&(i[0].selected=!0),e.setValue(t,{value:s(!0),items:l(n)}),c=s(!1)},clear(n){for(;r.length!==0;)r.remove(0);e.setValue(t,{value:null,items:[]}),c=s(!1)},insert(n){let{index:i,displayValue:o,exportValue:u}=n.detail.insert,d=r.children[i],f=document.createElement(`option`);a(f,o),f.value=u,d?d.before(f):r.append(f),e.setValue(t,{value:s(!0),items:l(n)}),c=s(!1)},items(n){let{items:i}=n.detail;for(;r.length!==0;)r.remove(0);for(let e of i){let{displayValue:t,exportValue:n}=e,i=document.createElement(`option`);a(i,t),i.value=n,r.append(i)}r.options.length>0&&(r.options[0].selected=!0),e.setValue(t,{value:s(!0),items:l(n)}),c=s(!1)},indices(n){let r=new Set(n.detail.indices);for(let e of n.target.options)e.selected=r.has(e.index);e.setValue(t,{value:s(!0)}),c=s(!1)},editable(e){e.target.disabled=!e.detail.editable}},n)}),r.addEventListener(`input`,n=>{let r=s(!0),i=s(!1);e.setValue(t,{value:r}),n.preventDefault(),this.linkService.eventBus?.dispatch(`dispatcheventinsandbox`,{source:this,detail:{id:t,name:`Keystroke`,value:c,change:i,changeEx:r,willCommit:!1,commitKey:1,keyDown:!1}})}),this._setEventListeners(r,null,[[`focus`,`Focus`],[`blur`,`Blur`],[`mousedown`,`Mouse Down`],[`mouseenter`,`Mouse Enter`],[`mouseleave`,`Mouse Exit`],[`mouseup`,`Mouse Up`],[`input`,`Action`],[`input`,`Validate`]],e=>e.target.value)):r.addEventListener(`input`,function(n){e.setValue(t,{value:s(!0)})}),this.data.combo&&this._setTextStyle(r),this._setBackgroundColor(r),this._setDefaultPropertiesFromJS(r),this.container.append(r),this.container}},wl=class extends pl{constructor(e){let{data:t,elements:n,parent:r}=e,i=!!r._commentManager;if(super(e,{isRenderable:!i&&pl._hasPopupData(t)}),this.elements=n,i&&pl._hasPopupData(t)){let e=this.popup=this.#e();for(let t of n)t.popup=e}else this.popup=null}#e(){return new Tl({container:this.container,color:this.data.color,titleObj:this.data.titleObj,modificationDate:this.data.modificationDate||this.data.creationDate,contentsObj:this.data.contentsObj,richText:this.data.richText,rect:this.data.rect,parentRect:this.data.parentRect||null,parent:this.parent,elements:this.elements,open:this.data.open,commentManager:this.parent._commentManager})}render(){let{container:e}=this;e.classList.add(`popupAnnotation`),e.role=`comment`;let t=this.popup=this.#e(),n=[];for(let e of this.elements)e.popup=t,e.container.ariaHasPopup=`dialog`,n.push(e.data.id),e.addHighlightArea();return this.container.setAttribute(`aria-controls`,n.map(e=>`${vi}${e}`).join(`,`)),this.container}},Tl=class{#e=null;#t=this.#P.bind(this);#n=this.#R.bind(this);#r=this.#L.bind(this);#i=this.#I.bind(this);#a=null;#o=null;#s=null;#c=null;#l=null;#u=null;#d=null;#f=!1;#p=null;#m=null;#h=null;#g=null;#_=null;#v=null;#y=null;#b=null;#x=null;#S=null;#C=!1;#w=null;#T=null;constructor({container:e,color:t,elements:n,titleObj:r,modificationDate:i,contentsObj:a,richText:o,parent:s,rect:c,parentRect:l,open:u,commentManager:d=null}){this.#o=e,this.#x=r,this.#s=a,this.#b=o,this.#u=s,this.#a=t,this.#y=c,this.#d=l,this.#l=n,this.#e=d,this.#w=n[0],this.#c=Ta.toDateObject(i),this.trigger=n.flatMap(e=>e.getElementsToTriggerPopup()),d||(this.#E(),this.#o.hidden=!0,u&&this.#I())}#E(){if(this.#m)return;this.#m=new AbortController;let{signal:e}=this.#m;for(let t of this.trigger)t.addEventListener(`click`,this.#i,{signal:e}),t.addEventListener(`pointerenter`,this.#r,{signal:e}),t.addEventListener(`pointerleave`,this.#n,{signal:e}),t.classList.add(`popupTriggerArea`);for(let t of this.#l)t.container?.addEventListener(`keydown`,this.#t,{signal:e})}#D(){let e=this.#l.find(e=>e.hasCommentButton);e&&(this.#_=e._normalizePoint(e.commentButtonPosition))}renderCommentButton(){if(this.#g){this.#g.parentNode||this.#w.container.after(this.#g);return}if(this.#_||this.#D(),!this.#_)return;let{signal:e}=this.#m=new AbortController,t=this.#w.hasOwnCommentButton,n=()=>{this.#e.toggleCommentPopup(this,!0,void 0,!t)},r=()=>{this.#e.toggleCommentPopup(this,!1,!0,!t)},i=()=>{this.#e.toggleCommentPopup(this,!1,!1)};if(t){this.#g=this.#w.container;for(let t of this.trigger)t.ariaHasPopup=`dialog`,t.ariaControls=`commentPopup`,t.addEventListener(`keydown`,this.#t,{signal:e}),t.addEventListener(`click`,n,{signal:e}),t.addEventListener(`pointerenter`,r,{signal:e}),t.addEventListener(`pointerleave`,i,{signal:e}),t.classList.add(`popupTriggerArea`)}else{let t=this.#g=document.createElement(`button`);t.className=`annotationCommentButton`;let a=this.#w.container;t.style.zIndex=parseInt(a.style.zIndex,10)+1,t.tabIndex=0,t.ariaHasPopup=`dialog`,t.ariaControls=`commentPopup`,t.setAttribute(`data-l10n-id`,`pdfjs-show-comment-button`),this.#k(),this.#O(),t.addEventListener(`keydown`,this.#t,{signal:e}),t.addEventListener(`click`,n,{signal:e}),t.addEventListener(`pointerenter`,r,{signal:e}),t.addEventListener(`pointerleave`,i,{signal:e}),a.after(t)}}#O(){if(this.#w.extraPopupElement&&!this.#w.editor)return;this.#g||this.renderCommentButton();let[e,t]=this.#_,{style:n}=this.#g;n.left=`calc(${e}%)`,n.top=`calc(${t}% - var(--comment-button-dim))`}#k(){this.#w.extraPopupElement||(this.#g||this.renderCommentButton(),this.#g.style.backgroundColor=this.commentButtonColor||``)}get commentButtonColor(){let{color:e,opacity:t}=this.#w.commentData;return e?this.#u._commentManager.makeCommentColor(e,t):null}focusCommentButton(){setTimeout(()=>{this.#g?.focus()},0)}getData(){let{richText:e,color:t,opacity:n,creationDate:r,modificationDate:i}=this.#w.commentData;return{contentsObj:{str:this.comment},richText:e,color:t,opacity:n,creationDate:r,modificationDate:i}}get elementBeforePopup(){return this.#g}get comment(){return this.#T||=this.#w.commentText,this.#T}set comment(e){e!==this.comment&&(this.#w.commentText=this.#T=e)}focus(){this.#w.container?.focus()}get parentBoundingClientRect(){return this.#w.layer.getBoundingClientRect()}setCommentButtonStates({selected:e,hasPopup:t}){this.#g&&(this.#g.classList.toggle(`selected`,e),this.#g.ariaExpanded=t)}setSelectedCommentButton(e){this.#g.classList.toggle(`selected`,e)}get commentPopupPosition(){if(this.#v)return this.#v;let{x:e,y:t,height:n}=this.#g.getBoundingClientRect(),{x:r,y:i,width:a,height:o}=this.#w.layer.getBoundingClientRect();return[(e-r)/a,(t+n-i)/o]}set commentPopupPosition(e){this.#v=e}hasDefaultPopupPosition(){return this.#v===null}get commentButtonPosition(){return this.#_}get commentButtonWidth(){return this.#g.getBoundingClientRect().width/this.parentBoundingClientRect.width}editComment(e){let[t,n]=this.#v||this.commentButtonPosition.map(e=>e/100),r=this.parentBoundingClientRect,{x:i,y:a,width:o,height:s}=r;this.#e.showDialog(null,this,i+t*o,a+n*s,{...e,parentDimensions:r})}render(){if(this.#p)return;let e=this.#p=document.createElement(`div`);if(e.className=`popup`,this.#a){let t=e.style.outlineColor=U.makeHexColor(...this.#a);e.style.backgroundColor=`color-mix(in srgb, ${t} 30%, white)`}let t=document.createElement(`span`);if(t.className=`header`,this.#x?.str){let e=document.createElement(`span`);e.className=`title`,t.append(e),{dir:e.dir,str:e.textContent}=this.#x}if(e.append(t),this.#c){let e=document.createElement(`time`);e.className=`popupDate`,e.setAttribute(`data-l10n-id`,`pdfjs-annotation-date-time-string`),e.setAttribute(`data-l10n-args`,JSON.stringify({dateObj:this.#c.valueOf()})),e.dateTime=this.#c.toISOString(),t.append(e)}Ua({html:this.#A||this.#s.str,dir:this.#s?.dir,className:`popupContent`},e),this.#o.append(e)}get#A(){let e=this.#b,t=this.#s;return e?.str&&(!t?.str||t.str===e.str)&&this.#b.html||null}get#j(){return this.#A?.attributes?.style?.fontSize||0}get#M(){return this.#A?.attributes?.style?.color||null}#N(e){let t=[],n={str:e,html:{name:`div`,attributes:{dir:`auto`},children:[{name:`p`,children:t}]}},r={style:{color:this.#M,fontSize:this.#j?`calc(${this.#j}px * var(--total-scale-factor))`:``}};for(let n of e.split(`
|
|
48
|
+
`))t.push({name:`span`,value:n,attributes:r});return n}#P(e){e.altKey||e.shiftKey||e.ctrlKey||e.metaKey||(e.key===`Enter`||e.key===`Escape`&&this.#f)&&this.#I()}updateEdited({rect:e,popup:t,deleted:n}){this.#e?(n?(this.remove(),this.#T=null):t&&(t.deleted?this.remove():(this.#k(),this.#T=t.text)),e&&(this.#_=null,this.#D(),this.#O())):n||t?.deleted?this.remove():(this.#E(),this.#S||={contentsObj:this.#s,richText:this.#b},e&&(this.#h=null),t&&t.text&&(this.#b=this.#N(t.text),this.#c=Ta.toDateObject(t.date),this.#s=null),this.#p?.remove(),this.#p=null)}resetEdited(){this.#S&&({contentsObj:this.#s,richText:this.#b}=this.#S,this.#S=null,this.#p?.remove(),this.#p=null,this.#h=null)}remove(){if(this.#m?.abort(),this.#m=null,this.#p?.remove(),this.#p=null,this.#C=!1,this.#f=!1,this.#g?.remove(),this.#g=null,this.trigger)for(let e of this.trigger)e.classList.remove(`popupTriggerArea`)}#F(){if(this.#h!==null)return;let{page:{view:e},viewport:{rawDims:{pageWidth:t,pageHeight:n,pageX:r,pageY:i}}}=this.#u,a=!!this.#d,o=a?this.#d:this.#y;for(let e of this.#l)if(!o||U.intersect(e.data.rect,o)!==null){o=e.data.rect,a=!0;break}let s=U.normalizeRect([o[0],e[3]-o[1]+e[1],o[2],e[3]-o[3]+e[1]]),c=a?o[2]-o[0]+5:0,l=s[0]+c,u=s[1];this.#h=[100*(l-r)/t,100*(u-i)/n];let{style:d}=this.#o;d.left=`${this.#h[0]}%`,d.top=`${this.#h[1]}%`}#I(){this.#e?this.#e.toggleCommentPopup(this,!1):(this.#f=!this.#f,this.#f?(this.#L(),this.#o.addEventListener(`click`,this.#i),this.#o.addEventListener(`keydown`,this.#t)):(this.#R(),this.#o.removeEventListener(`click`,this.#i),this.#o.removeEventListener(`keydown`,this.#t)))}#L(){this.#p||this.render(),this.isVisible?this.#f&&this.#o.classList.add(`focused`):(this.#F(),this.#o.hidden=!1,this.#o.style.zIndex=parseInt(this.#o.style.zIndex,10)+1e3)}#R(){this.#o.classList.remove(`focused`),!(this.#f||!this.isVisible)&&(this.#o.hidden=!0,this.#o.style.zIndex=parseInt(this.#o.style.zIndex,10)-1e3)}forceHide(){this.#C=this.isVisible,this.#C&&(this.#o.hidden=!0)}maybeShow(){this.#e||(this.#E(),this.#C&&(this.#p||this.#L(),this.#C=!1,this.#o.hidden=!1))}get isVisible(){return!this.#e&&this.#o.hidden===!1}},El=class extends pl{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0}),this.textContent=e.data.textContent,this.textPosition=e.data.textPosition,this.annotationEditorType=bi.FREETEXT}render(){if(this.container.classList.add(`freeTextAnnotation`),this.textContent){let e=this.contentElement=document.createElement(`div`);e.classList.add(`annotationTextContent`),e.setAttribute(`role`,`comment`);for(let t of this.textContent){let n=document.createElement(`span`);n.textContent=t,e.append(n)}this.container.append(e)}return!this.data.popupRef&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this._editOnDoubleClick(),this.container}},Dl=class extends pl{#e=null;constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0})}render(){this.container.classList.add(`lineAnnotation`);let{data:e,width:t,height:n}=this,r=this.svgFactory.create(t,n,!0),i=this.#e=this.svgFactory.createElement(`svg:line`);return i.setAttribute(`x1`,e.rect[2]-e.lineCoordinates[0]),i.setAttribute(`y1`,e.rect[3]-e.lineCoordinates[1]),i.setAttribute(`x2`,e.rect[2]-e.lineCoordinates[2]),i.setAttribute(`y2`,e.rect[3]-e.lineCoordinates[3]),i.setAttribute(`stroke-width`,e.borderStyle.width||1),i.setAttribute(`stroke`,`transparent`),i.setAttribute(`fill`,`transparent`),r.append(i),this.container.append(r),!e.popupRef&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container}getElementsToTriggerPopup(){return this.#e}addHighlightArea(){this.container.classList.add(`highlightArea`)}},Ol=class extends pl{#e=null;constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0})}render(){this.container.classList.add(`squareAnnotation`);let{data:e,width:t,height:n}=this,r=this.svgFactory.create(t,n,!0),i=e.borderStyle.width,a=this.#e=this.svgFactory.createElement(`svg:rect`);return a.setAttribute(`x`,i/2),a.setAttribute(`y`,i/2),a.setAttribute(`width`,t-i),a.setAttribute(`height`,n-i),a.setAttribute(`stroke-width`,i||1),a.setAttribute(`stroke`,`transparent`),a.setAttribute(`fill`,`transparent`),r.append(a),this.container.append(r),!e.popupRef&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container}getElementsToTriggerPopup(){return this.#e}addHighlightArea(){this.container.classList.add(`highlightArea`)}},kl=class extends pl{#e=null;constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0})}render(){this.container.classList.add(`circleAnnotation`);let{data:e,width:t,height:n}=this,r=this.svgFactory.create(t,n,!0),i=e.borderStyle.width,a=this.#e=this.svgFactory.createElement(`svg:ellipse`);return a.setAttribute(`cx`,t/2),a.setAttribute(`cy`,n/2),a.setAttribute(`rx`,t/2-i/2),a.setAttribute(`ry`,n/2-i/2),a.setAttribute(`stroke-width`,i||1),a.setAttribute(`stroke`,`transparent`),a.setAttribute(`fill`,`transparent`),r.append(a),this.container.append(r),!e.popupRef&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container}getElementsToTriggerPopup(){return this.#e}addHighlightArea(){this.container.classList.add(`highlightArea`)}},Al=class extends pl{#e=null;constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0}),this.containerClassName=`polylineAnnotation`,this.svgElementName=`svg:polyline`}render(){this.container.classList.add(this.containerClassName);let{data:{rect:e,vertices:t,borderStyle:n,popupRef:r},width:i,height:a}=this;if(!t)return this.container;let o=this.svgFactory.create(i,a,!0),s=[];for(let n=0,r=t.length;n<r;n+=2){let r=t[n]-e[0],i=e[3]-t[n+1];s.push(`${r},${i}`)}s=s.join(` `);let c=this.#e=this.svgFactory.createElement(this.svgElementName);return c.setAttribute(`points`,s),c.setAttribute(`stroke-width`,n.width||1),c.setAttribute(`stroke`,`transparent`),c.setAttribute(`fill`,`transparent`),o.append(c),this.container.append(o),!r&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container}getElementsToTriggerPopup(){return this.#e}addHighlightArea(){this.container.classList.add(`highlightArea`)}},jl=class extends Al{constructor(e){super(e),this.containerClassName=`polygonAnnotation`,this.svgElementName=`svg:polygon`}},Ml=class extends pl{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0})}render(){return this.container.classList.add(`caretAnnotation`),!this.data.popupRef&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container}},Nl=class extends pl{#e=null;#t=[];constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0}),this.containerClassName=`inkAnnotation`,this.svgElementName=`svg:polyline`,this.annotationEditorType=this.data.it===`InkHighlight`?bi.HIGHLIGHT:bi.INK}#n(e,t){switch(e){case 90:return{transform:`rotate(90) translate(${-t[0]},${t[1]}) scale(1,-1)`,width:t[3]-t[1],height:t[2]-t[0]};case 180:return{transform:`rotate(180) translate(${-t[2]},${t[1]}) scale(1,-1)`,width:t[2]-t[0],height:t[3]-t[1]};case 270:return{transform:`rotate(270) translate(${-t[2]},${t[3]}) scale(1,-1)`,width:t[3]-t[1],height:t[2]-t[0]};default:return{transform:`translate(${-t[0]},${t[3]}) scale(1,-1)`,width:t[2]-t[0],height:t[3]-t[1]}}}render(){this.container.classList.add(this.containerClassName);let{data:{rect:e,rotation:t,inkLists:n,borderStyle:r,popupRef:i}}=this,{transform:a,width:o,height:s}=this.#n(t,e),c=this.svgFactory.create(o,s,!0),l=this.#e=this.svgFactory.createElement(`svg:g`);c.append(l),l.setAttribute(`stroke-width`,r.width||1),l.setAttribute(`stroke-linecap`,`round`),l.setAttribute(`stroke-linejoin`,`round`),l.setAttribute(`stroke-miterlimit`,10),l.setAttribute(`stroke`,`transparent`),l.setAttribute(`fill`,`transparent`),l.setAttribute(`transform`,a);for(let e of n){let t=this.svgFactory.createElement(this.svgElementName);this.#t.push(t),t.setAttribute(`points`,e.join(`,`)),l.append(t)}return!i&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container.append(c),this._editOnDoubleClick(),this.container}updateEdited(e){super.updateEdited(e);let{thickness:t,points:n,rect:r}=e,i=this.#e;if(t>=0&&i.setAttribute(`stroke-width`,t||1),n)for(let e=0,t=this.#t.length;e<t;e++)this.#t[e].setAttribute(`points`,n[e].join(`,`));if(r){let{transform:e,width:t,height:n}=this.#n(this.data.rotation,r);i.parentElement.setAttribute(`viewBox`,`0 0 ${t} ${n}`),i.setAttribute(`transform`,e)}}getElementsToTriggerPopup(){return this.#t}addHighlightArea(){this.container.classList.add(`highlightArea`)}},Pl=class extends pl{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0}),this.annotationEditorType=bi.HIGHLIGHT}render(){let{data:{overlaidText:e,popupRef:t}}=this;if(!t&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container.classList.add(`highlightAnnotation`),this._editOnDoubleClick(),e){let t=document.createElement(`mark`);t.classList.add(`overlaidText`),t.textContent=e,this.container.append(t)}return this.container}},Fl=class extends pl{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){let{data:{overlaidText:e,popupRef:t}}=this;if(!t&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container.classList.add(`underlineAnnotation`),e){let t=document.createElement(`u`);t.classList.add(`overlaidText`),t.textContent=e,this.container.append(t)}return this.container}},Il=class extends pl{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){let{data:{overlaidText:e,popupRef:t}}=this;if(!t&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container.classList.add(`squigglyAnnotation`),e){let t=document.createElement(`u`);t.classList.add(`overlaidText`),t.textContent=e,this.container.append(t)}return this.container}},Ll=class extends pl{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){let{data:{overlaidText:e,popupRef:t}}=this;if(!t&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container.classList.add(`strikeoutAnnotation`),e){let t=document.createElement(`s`);t.classList.add(`overlaidText`),t.textContent=e,this.container.append(t)}return this.container}},Rl=class extends pl{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0}),this.annotationEditorType=bi.STAMP}render(){return this.container.classList.add(`stampAnnotation`),this.container.setAttribute(`role`,`img`),!this.data.popupRef&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this._editOnDoubleClick(),this.container}},zl=class extends pl{#e=null;constructor(e){super(e,{isRenderable:!0});let{fileId:t,file:n}=this.data;this.filename=n.filename,this.content=n.content,this.fileId=t,this.linkService.eventBus?.dispatch(`fileattachmentannotation`,{source:this,attachmentId:this.fileId,...n})}render(){this.container.classList.add(`fileAttachmentAnnotation`);let{container:e,data:t}=this,n;t.hasAppearance||t.fillAlpha===0?n=document.createElement(`div`):(n=document.createElement(`img`),n.src=`${this.imageResourcesPath}annotation-${/paperclip/i.test(t.name)?`paperclip`:`pushpin`}.svg`,t.fillAlpha&&t.fillAlpha<1&&(n.style=`filter: opacity(${Math.round(t.fillAlpha*100)}%);`)),n.addEventListener(`dblclick`,this.#t.bind(this)),this.#e=n;let{isMac:r}=Zi.platform;return e.addEventListener(`keydown`,e=>{e.key===`Enter`&&(r?e.metaKey:e.ctrlKey)&&this.#t()}),!t.popupRef&&this.hasPopupData?(this.hasOwnCommentButton=!0,this._createPopup()):n.classList.add(`popupTriggerArea`),e.append(n),e}getElementsToTriggerPopup(){return this.#e}addHighlightArea(){this.container.classList.add(`highlightArea`)}async#t(){let{fileId:e,filename:t,content:n}=this,r=await this.linkService.getAttachmentContent(e)||n;r&&this.downloadManager?.openOrDownloadData(r,t)}},Bl=class extends pl{#e=new AbortController;#t=null;#n=null;constructor(e){super(e,{isRenderable:!!e.data.richMedia})}render(){this.container.classList.add(`mediaAnnotation`);let{filename:e}=this.data.richMedia,t=document.createElement(`button`);return t.className=`mediaPlayButton`,t.type=`button`,t.title=t.ariaLabel=e,t.addEventListener(`click`,()=>this.#r(t),{signal:this.#e.signal}),this.container.append(t),this.container}async#r(e){let{fileId:t,filename:n,contentType:r}=this.data.richMedia;e.disabled=!0;let i;try{i=await this.linkService.getAttachmentContent(t)}catch{return}finally{e.disabled=!1}if(!i||!e.isConnected)return;let{signal:a}=this.#e,o=new Blob([i],{type:r});if(!/^(?:video|audio)\//.test(o.type))return;let s=URL.createObjectURL(o);this.#t=s;let c=o.type.startsWith(`audio/`),l=document.createElement(c?`audio`:`video`);if(this.#n=l,l.className=`mediaContent`,this._setBackgroundColor(l),l.src=s,l.title=n,l.controls=!0,l.autoplay=!0,l.tabIndex=0,c){let e=!1,t=!1,n=()=>{l.controls=e||t};this.container.addEventListener(`pointerenter`,()=>{e=!0,n()},{signal:a}),this.container.addEventListener(`pointerleave`,()=>{e=!1,n()},{signal:a}),this.container.addEventListener(`focusin`,()=>{t=!0,n()},{signal:a}),this.container.addEventListener(`focusout`,()=>{t=!1,n()},{signal:a})}l.addEventListener(`emptied`,()=>this.#i(s),{once:!0,signal:a}),e.replaceWith(l),l.play().catch(()=>{})}#i(e=this.#t){e&&e===this.#t&&(URL.revokeObjectURL(e),this.#t=null)}destroy(){this.#e.abort(),this.#n&&=(this.#n.pause(),this.#n.removeAttribute(`src`),this.#n.load(),null),this.#i()}},Vl=class e{#e=null;#t=null;#n=null;#r=new Map;#i=null;#a=null;#o=[];#s=!1;zIndex=0;constructor({div:e,accessibilityManager:t,annotationCanvasMap:n,annotationEditorUIManager:r,page:i,viewport:a,structTreeLayer:o,commentManager:s,linkService:c,annotationStorage:l}){this.div=e,this.#e=t,this.#t=n,this.#i=o||null,this.#a=c||null,this.#n=l||new go,this.page=i,this.viewport=a,this._annotationEditorUIManager=r,this._commentManager=s||null}hasEditableAnnotations(){return this.#r.size>0}async render(e){let{annotations:t,optionalContentConfig:n}=e,r=this.div;ja(r,this.viewport);let i=new Map,a=[],o={data:null,layer:r,linkService:this.#a,downloadManager:e.downloadManager,imageResourcesPath:e.imageResourcesPath||``,renderForms:e.renderForms!==!1,svgFactory:new cl,annotationStorage:this.#n,enableComment:e.enableComment===!0,enableScripting:e.enableScripting===!0,hasJSActions:e.hasJSActions,fieldObjects:e.fieldObjects,parent:this,elements:null};for(let e of t){if(e.noHTML)continue;let t=e.annotationType===Ti.POPUP;if(t){let t=i.get(e.id);if(!t)continue;if(!this._commentManager){a.push(e);continue}o.elements=t}else if(e.rect[2]===e.rect[0]||e.rect[3]===e.rect[1])continue;o.data=e;let r=fl.create(o);if(!r.isRenderable)continue;t||(this.#o.push(r),e.popupRef&&i.getOrInsertComputed(e.popupRef,ia).push(r));let s=r.render();e.hidden&&(s.style.visibility=`hidden`),r.updateOC(n),r._isEditable&&(this.#r.set(r.data.id,r),this._annotationEditorUIManager?.renderAnnotationElement(r))}await this.#c();for(let e of a){let t=o.elements=i.get(e.id);o.data=e;let n=fl.create(o);if(!n.isRenderable)continue;let r=n.render();n.contentElement.id=`${vi}${e.id}`,e.hidden&&(r.style.visibility=`hidden`),t.at(-1).container.after(r)}this.#l()}async#c(){if(this.#o.length===0)return;this.div.replaceChildren();let e=[];if(!this.#s){this.#s=!0;for(let{contentElement:t,data:{hidden:n,id:r,oc:i}}of this.#o){let a=t.id=`${vi}${r}`,o=t.localName===`a`&&!n&&!i;e.push(this.#i?.getAriaAttributes(a,{enableLinkOwnership:o}).then(e=>{if(e)for(let[n,r]of e)t.setAttribute(n,r)}))}}this.#o.sort(({data:{rect:[e,t,n,r]}},{data:{rect:[i,a,o,s]}})=>{if(e===n&&t===r)return 1;if(i===o&&a===s)return-1;let c=r,l=t,u=(t+r)/2,d=s,f=a,p=(a+s)/2;return u>=d&&p<=l?-1:p>=c&&u<=f?1:(e+n)/2-(i+o)/2});let t=document.createDocumentFragment();for(let e of this.#o)t.append(e.container),this._commentManager?(e.extraPopupElement?.popup||e.popup)?.renderCommentButton():e.extraPopupElement&&t.append(e.extraPopupElement.render());if(this.div.append(t),await Promise.all(e),this.#e){let e=await this.#i?.getAnnotationIds();for(let{contentElement:t}of this.#o)e?.has(t.id)||this.#e.addPointerInTextLayer(t,!1)}}async addLinkAnnotations(t){let n={data:null,layer:this.div,linkService:this.#a,svgFactory:new cl,parent:this};for(let r of t){r.borderStyle||=e._defaultBorderStyle,n.data=r;let t=fl.create(n);t.isRenderable&&(t.render(),t.contentElement.id=`${vi}${r.id}`,this.#o.push(t))}await this.#c()}update({viewport:e,optionalContentConfig:t}){let n=this.div;this.viewport=e,ja(n,{rotation:e.rotation});for(let e of this.#o)e.updateOC(t);this.#l(),n.hidden=!1}destroy(){for(let e of this.#o)e.destroy?.(),this.#e?.removePointerInTextLayer(e.contentElement);this.#o.length=0,this.#r.clear(),this.div.replaceChildren()}#l(){if(!this.#t)return;let e=this.div;for(let[t,n]of this.#t){let r=e.querySelector(`[data-annotation-id="${t}"]`);if(!r)continue;if(Array.isArray(n))for(let e of n)e.className=`annotationContent`,e.ariaHidden=!0;else n.className=`annotationContent`,n.ariaHidden=!0;let i=[];for(let e of r.children)e.nodeName===`CANVAS`&&i.push(e);for(let e of i)e.remove();let a=Array.isArray(n)?n[0]:n,{firstChild:o}=r;if(o?o.classList.contains(`annotationContent`)?o.after(a):o.before(a):r.append(a),Array.isArray(n)){let e=a;for(let t=1,r=n.length;t<r;t++)e.after(n[t]),e=n[t]}this.#t.delete(t);let s=this.#r.get(t);s&&(s._hasNoCanvas?(this._annotationEditorUIManager?.setMissingCanvas(t,r.id,n),s._hasNoCanvas=!1):s.canvas=n)}}refreshCanvases(){this.#l()}getEditableAnnotations(){return this.#r.values()}getEditableAnnotation(e){return this.#r.get(e)}addFakeAnnotation(e){let{div:t}=this,{id:n,rotation:r}=e,i=new ml({data:{id:n,rect:e.getPDFRect(),rotation:r},editor:e,layer:t,parent:this,enableComment:!!this._commentManager,linkService:this.#a,annotationStorage:this.#n});return i.render(),i.contentElement.id=`${vi}${n}`,i.createOrUpdatePopup(),this.#o.push(i),i}removeAnnotation(e){let t=this.#o.findIndex(t=>t.data.id===e);if(t<0)return;let[n]=this.#o.splice(t,1);this.#e?.removePointerInTextLayer(n.contentElement)}updateFakeAnnotations(e){if(e.length!==0){for(let t of e)t.updateFakeAnnotationElement(this);this.#c()}}togglePointerEvents(e=!1){this.div.classList.toggle(`disabled`,!e)}static get _defaultBorderStyle(){return H(this,`_defaultBorderStyle`,Object.freeze({width:1,rawWidth:1,style:Ei.SOLID,dashArray:[3],horizontalCornerRadius:0,verticalCornerRadius:0}))}},Hl=/\r\n?|\n/g,Ul=class e extends co{#e=``;#t=`${this.id}-editor`;#n=null;#r;_colorPicker=null;static _freeTextDefaultContent=``;static _internalPadding=0;static _defaultColor=null;static _defaultFontSize=10;static get _keyboardManager(){let t=e.prototype,n=e=>e.isEmpty(),r=to.TRANSLATE_SMALL,i=to.TRANSLATE_BIG;return H(this,`_keyboardManager`,new $a([[[`ctrl+s`,`mac+meta+s`,`ctrl+p`,`mac+meta+p`],t.commitOrRemove,{bubbles:!0}],[[`ctrl+Enter`,`mac+meta+Enter`],t.commitOrRemove],[[`Escape`],t.commitOrRemove],[[`ArrowLeft`],t._translateEmpty,{args:[-r,0],checker:n}],[[`ctrl+ArrowLeft`,`mac+shift+ArrowLeft`],t._translateEmpty,{args:[-i,0],checker:n}],[[`ArrowRight`],t._translateEmpty,{args:[r,0],checker:n}],[[`ctrl+ArrowRight`,`mac+shift+ArrowRight`],t._translateEmpty,{args:[i,0],checker:n}],[[`ArrowUp`],t._translateEmpty,{args:[0,-r],checker:n}],[[`ctrl+ArrowUp`,`mac+shift+ArrowUp`],t._translateEmpty,{args:[0,-i],checker:n}],[[`ArrowDown`],t._translateEmpty,{args:[0,r],checker:n}],[[`ctrl+ArrowDown`,`mac+shift+ArrowDown`],t._translateEmpty,{args:[0,i],checker:n}]]))}static _type=`freetext`;static _editorType=bi.FREETEXT;constructor(t){super({...t,name:`freeTextEditor`}),this.color=t.color||e._defaultColor||co._defaultLineColor,this.#r=t.fontSize||e._defaultFontSize,this.annotationElementId||this._uiManager.a11yAlert(co._l10nAlert.freetext),this.canAddComment=!1}static initialize(e,t){co.initialize(e,t);let n=getComputedStyle(document.documentElement);this._internalPadding=parseFloat(n.getPropertyValue(`--freetext-padding`))}static updateDefaultParams(t,n){switch(t){case xi.FREETEXT_SIZE:e._defaultFontSize=n;break;case xi.FREETEXT_COLOR:e._defaultColor=n}}updateParams(e,t){switch(e){case xi.FREETEXT_SIZE:this.#i(t);break;case xi.FREETEXT_COLOR:this.#a(t)}}static get defaultPropertiesToUpdate(){return[[xi.FREETEXT_SIZE,e._defaultFontSize],[xi.FREETEXT_COLOR,e._defaultColor||co._defaultLineColor]]}get propertiesToUpdate(){return[[xi.FREETEXT_SIZE,this.#r],[xi.FREETEXT_COLOR,this.color]]}get toolbarButtons(){return this._colorPicker||=new rl(this),[[`colorPicker`,this._colorPicker]]}get colorType(){return xi.FREETEXT_COLOR}#i(e){let t=e=>{this.editorDiv.style.fontSize=`calc(${e}px * var(--total-scale-factor))`,this.translate(0,-(e-this.#r)*this.parentScale),this.#r=e,this.#s()},n=this.#r;this.addCommands({cmd:t.bind(this,e),undo:t.bind(this,n),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:xi.FREETEXT_SIZE,overwriteIfSameType:!0,keepUndo:!0})}onUpdatedColor(){this.editorDiv.style.color=this.color,this._colorPicker?.update(this.color),super.onUpdatedColor()}#a(e){let t=e=>{this.color=e,this.onUpdatedColor()},n=this.color;this.addCommands({cmd:t.bind(this,e),undo:t.bind(this,n),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:xi.FREETEXT_COLOR,overwriteIfSameType:!0,keepUndo:!0})}_translateEmpty(e,t){this._uiManager.translateSelectedEditors(e,t,!0)}getInitialTranslation(){let t=this.parentScale;return[-e._internalPadding*t,-(e._internalPadding+this.#r)*t]}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(this.isAttachedToDOM||this.parent.add(this)))}enableEditMode(){if(!super.enableEditMode())return!1;this.overlayDiv.classList.remove(`enabled`),this.editorDiv.contentEditable=!0,this._isDraggable=!1,this.div.removeAttribute(`aria-activedescendant`),this.#n=new AbortController;let e=this._uiManager.combinedSignal(this.#n);return this.editorDiv.addEventListener(`keydown`,this.editorDivKeydown.bind(this),{signal:e}),this.editorDiv.addEventListener(`focus`,this.editorDivFocus.bind(this),{signal:e}),this.editorDiv.addEventListener(`blur`,this.editorDivBlur.bind(this),{signal:e}),this.editorDiv.addEventListener(`input`,this.editorDivInput.bind(this),{signal:e}),this.editorDiv.addEventListener(`paste`,this.editorDivPaste.bind(this),{signal:e}),!0}disableEditMode(){return super.disableEditMode()?(this.overlayDiv.classList.add(`enabled`),this.editorDiv.contentEditable=!1,this.div.setAttribute(`aria-activedescendant`,this.#t),this._isDraggable=!0,this.#n?.abort(),this.#n=null,this.div.focus({preventScroll:!0}),this.isEditing=!1,this.parent.div.classList.add(`freetextEditing`),!0):!1}focusin(e){this._focusEventsAllowed&&(super.focusin(e),e.target!==this.editorDiv&&this.editorDiv.focus())}onceAdded(e){this.width||(this.enableEditMode(),e&&this.editorDiv.focus(),this._initialOptions?.isCentered&&this.center(),this._initialOptions=null)}isEmpty(){return!this.editorDiv||this.editorDiv.innerText.trim()===``}remove(){this.isEditing=!1,this.parent&&(this.parent.setEditingState(!0),this.parent.div.classList.add(`freetextEditing`)),super.remove()}#o(){let t=[];this.editorDiv.normalize();let n=null;for(let r of this.editorDiv.childNodes)(n?.nodeType!==Node.TEXT_NODE||r.nodeName!==`BR`)&&(t.push(e.#c(r)),n=r);return t.join(`
|
|
49
|
+
`)}#s(){let[e,t]=this.parentDimensions,n;if(this.isAttachedToDOM)n=this.div.getBoundingClientRect();else{let{currentLayer:e,div:t}=this,r=t.style.display,i=t.classList.contains(`hidden`);t.classList.remove(`hidden`),t.style.display=`hidden`,e.div.append(this.div),n=t.getBoundingClientRect(),t.remove(),t.style.display=r,t.classList.toggle(`hidden`,i)}this.rotation%180==this.parentRotation%180?(this.width=n.width/e,this.height=n.height/t):(this.width=n.height/e,this.height=n.width/t),this.fixAndSetPosition()}commit(){if(!this.isInEditMode())return;super.commit(),this.disableEditMode();let e=this.#e,t=this.#e=this.#o().trimEnd();if(e===t)return;let n=e=>{this.#e=e,e?(this.#l(),this._uiManager.rebuild(this),this.#s()):this.remove()};this.addCommands({cmd:()=>{n(t)},undo:()=>{n(e)},mustExec:!1}),this.#s()}shouldGetKeyboardEvents(){return this.isInEditMode()}enterInEditMode(){this.enableEditMode(),this.editorDiv.focus()}keydown(e){e.target===this.div&&e.key===`Enter`&&(this.enterInEditMode(),e.preventDefault())}editorDivKeydown(t){e._keyboardManager.exec(this,t)}editorDivFocus(e){this.isEditing=!0}editorDivBlur(e){this.isEditing=!1}editorDivInput(e){this.parent.div.classList.toggle(`freetextEditing`,this.isEmpty())}disableEditing(){this.editorDiv.setAttribute(`role`,`comment`),this.editorDiv.removeAttribute(`aria-multiline`)}enableEditing(){this.editorDiv.setAttribute(`role`,`textbox`),this.editorDiv.setAttribute(`aria-multiline`,!0)}get canChangeContent(){return!0}render(){if(this.div)return this.div;let e,t;(this._isCopy||this.annotationElementId)&&(e=this.x,t=this.y),super.render(),this.editorDiv=document.createElement(`div`),this.editorDiv.className=`internal`,this.editorDiv.setAttribute(`id`,this.#t),this.editorDiv.setAttribute(`data-l10n-id`,`pdfjs-free-text2`),this.editorDiv.setAttribute(`data-l10n-attrs`,`default-content`),this.enableEditing(),this.editorDiv.contentEditable=!0;let{style:n}=this.editorDiv;if(n.fontSize=`calc(${this.#r}px * var(--total-scale-factor))`,n.color=this.color,this.div.append(this.editorDiv),this.overlayDiv=document.createElement(`div`),this.overlayDiv.classList.add(`overlay`,`enabled`),this.div.append(this.overlayDiv),this._isCopy||this.annotationElementId){let[n,r]=this.parentDimensions;if(this.annotationElementId){let{position:i}=this._initialData,[a,o]=this.getInitialTranslation();[a,o]=this.pageTranslationToScreen(a,o);let[s,c]=this.pageDimensions,[l,u]=this.pageTranslation,d,f;switch(this.rotation){case 0:d=e+(i[0]-l)/s,f=t+this.height-(i[1]-u)/c;break;case 90:d=e+(i[0]-l)/s,f=t-(i[1]-u)/c,[a,o]=[o,-a];break;case 180:d=e-this.width+(i[0]-l)/s,f=t-(i[1]-u)/c,[a,o]=[-a,-o];break;case 270:d=e+(i[0]-l-this.height*c)/s,f=t+(i[1]-u-this.width*s)/c,[a,o]=[-o,a]}this.setAt(d*n,f*r,a,o)}else this._moveAfterPaste(e,t);this.#l(),this._isDraggable=!0,this.editorDiv.contentEditable=!1}else this._isDraggable=!1,this.editorDiv.contentEditable=!0;return this.div}static#c(e){return(e.nodeType===Node.TEXT_NODE?e.nodeValue:e.innerText).replaceAll(Hl,``)}editorDivPaste(t){let n=t.clipboardData||window.clipboardData,{types:r}=n;if(r.length===1&&r[0]===`text/plain`)return;t.preventDefault();let i=e.#d(n.getData(`text`)||``).replaceAll(Hl,`
|
|
50
|
+
`);if(!i)return;let a=window.getSelection();if(!a.rangeCount)return;this.editorDiv.normalize(),a.deleteFromDocument();let o=a.getRangeAt(0);if(!i.includes(`
|
|
51
|
+
`)){o.insertNode(document.createTextNode(i)),this.editorDiv.normalize(),a.collapseToStart();return}let{startContainer:s,startOffset:c}=o,l=[],u=[];if(s.nodeType===Node.TEXT_NODE){let t=s.parentElement;if(u.push(s.nodeValue.slice(c).replaceAll(Hl,``)),t!==this.editorDiv){let n=l;for(let r of this.editorDiv.childNodes)r===t?n=u:n.push(e.#c(r))}l.push(s.nodeValue.slice(0,c).replaceAll(Hl,``))}else if(s===this.editorDiv){let t=l,n=0;for(let r of this.editorDiv.childNodes)n++===c&&(t=u),t.push(e.#c(r))}this.#e=`${l.join(`
|
|
52
|
+
`)}${i}${u.join(`
|
|
53
|
+
`)}`,this.#l();let d=new Range,f=Math.sumPrecise(l.map(e=>e.length));for(let{firstChild:e}of this.editorDiv.childNodes)if(e.nodeType===Node.TEXT_NODE){let t=e.nodeValue.length;if(f<=t){d.setStart(e,f),d.setEnd(e,f);break}f-=t}a.removeAllRanges(),a.addRange(d)}#l(){if(this.editorDiv.replaceChildren(),this.#e)for(let e of this.#e.split(`
|
|
54
|
+
`)){let t=document.createElement(`div`);t.append(e?document.createTextNode(e):document.createElement(`br`)),this.editorDiv.append(t)}}#u(){return this.#e.replaceAll(`\xA0`,` `)}static#d(e){return e.replaceAll(` `,`\xA0`)}get contentDiv(){return this.editorDiv}getPDFRect(){let t=e._internalPadding*this.parentScale;return this.getRect(t,t)}static async deserialize(t,n,r){let i=null;if(t instanceof El){let{data:{defaultAppearanceData:{fontSize:e,fontColor:n},rect:r,rotation:a,id:o,popupRef:s,richText:c,contentsObj:l,creationDate:u,modificationDate:d},textContent:f,textPosition:p,parent:{page:{pageNumber:m}}}=t;if(!f?.length)return null;i=t={annotationType:bi.FREETEXT,color:Array.from(n),fontSize:e,value:f.join(`
|
|
55
|
+
`),position:p,pageIndex:m-1,rect:r.slice(0),rotation:a,annotationElementId:o,id:o,deleted:!1,popupRef:s,comment:l?.str||null,richText:c,creationDate:u,modificationDate:d}}let a=await super.deserialize(t,n,r);return a.#r=t.fontSize,a.color=U.makeHexColor(...t.color),a.#e=e.#d(t.value),a._initialData=i,t.comment&&a.setCommentData(t),a}serialize(e=!1){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();let t=co._colorManager.convert(this.isAttachedToDOM?getComputedStyle(this.editorDiv).color:this.color),n=Object.assign(super.serialize(e),{color:t,fontSize:this.#r,value:this.#u()});return this.addComment(n),e?(n.isCopy=!0,n):this.annotationElementId&&!this.#f(n)?null:(n.id=this.annotationElementId,n)}#f(e){let{value:t,fontSize:n,color:r,pageIndex:i}=this._initialData;return this.hasEditedComment||this._hasBeenMoved||e.value!==t||e.fontSize!==n||e.color.some((e,t)=>e!==r[t])||e.pageIndex!==i}renderAnnotationElement(e){let t=super.renderAnnotationElement(e);if(!t)return null;let{style:n}=t;n.fontSize=`calc(${this.#r}px * var(--total-scale-factor))`,n.color=this.color,t.replaceChildren();for(let e of this.#e.split(`
|
|
56
|
+
`)){let n=document.createElement(`div`);n.append(e?document.createTextNode(e):document.createElement(`br`)),t.append(n)}return e.updateEdited({rect:this.getPDFRect(),popup:this._uiManager.hasCommentManager()||this.hasEditedComment?this.comment:{text:this.#e}}),t}resetAnnotationElement(e){super.resetAnnotationElement(e),e.resetEdited()}},Wl=class{#e=Object.create(null);updateProperty(e,t){this[e]=t,this.updateSVGProperty(e,t)}updateProperties(e){if(e)for(let[t,n]of Object.entries(e))t.startsWith(`_`)||this.updateProperty(t,n)}updateSVGProperty(e,t){this.#e[e]=t}toSVGProperties(){let e=this.#e;return this.#e=Object.create(null),{root:e}}reset(){this.#e=Object.create(null)}updateAll(e=this){this.updateProperties(e)}clone(){Ii(`Not implemented`)}},Gl=class e extends co{#e=null;#t;_clipPathId=null;_colorPicker=null;_drawId=null;_drawOutlines=null;_focusDrawId=null;static _currentDrawId=-1;static _currentParent=null;static#n=null;static#r=null;static#i=null;static#a=null;static _INNER_MARGIN=3;constructor(e){super(e),this.#t=e.mustBeCommitted||!1,this._addOutlines(e)}onUpdatedColor(){this._colorPicker?.update(this.color),super.onUpdatedColor()}onUpdatedOpacity(){this._colorPicker?.updateOpacity?.(this.opacity)}_addOutlines(e){e.drawOutlines&&(this.#o(e),this.#m())}#o({drawOutlines:e,drawId:t,drawingOptions:n,clipPathId:r}){this._drawOutlines=e,this._drawingOptions||=n,this.annotationElementId||this._uiManager.a11yAlert(co._l10nAlert[this.editorType]),t>=0?(this._drawId=t,this._clipPathId=r??null,this.parent.drawLayer.finalizeDraw(t,e.defaultProperties),this.#c(this.parent)):this._drawId=this.#s(e,this.parent),this.#_(e.box)}#s(t,n){let{id:r,clipPathId:i}=n.drawLayer.draw(e._mergeSVGProperties(this._drawingOptions.toSVGProperties(),t.defaultSVGProperties),!1,this.constructor._hasClipPath);return this.constructor._hasClipPath&&(this._clipPathId=i),this.#c(n),r}#c(e){let t=this._drawOutlines.getFocusSVGProperties(this.#f);t&&(this._focusDrawId=e.drawLayer.drawOutline(t,this._drawOutlines.focusMustRemoveSelfIntersections))}#l(e=this.#f){this._focusDrawId!==null&&this.parent?.drawLayer.updateProperties(this._focusDrawId,this._drawOutlines.getFocusSVGProperties(e))}#u(e){this._focusDrawId!==null&&this.parent?.drawLayer.updateProperties(this._focusDrawId,{rootClass:e})}#d(){let{parent:e,_drawId:t,_focusDrawId:n,_isVisible:r}=this;if(!e||t===null)return;let i={hidden:!r};e.drawLayer.updateProperties(t,{rootClass:i}),n!==null&&e.drawLayer.updateProperties(n,{rootClass:i})}static _mergeSVGProperties(e,t){let n=new Set(Object.keys(e));for(let[r,i]of Object.entries(t))n.has(r)?Object.assign(e[r],i):e[r]=i;return e}static getDefaultDrawingOptions(e){Ii(`Not implemented`)}static get typesMap(){Ii(`Not implemented`)}static get isDrawer(){return!0}static get _hasClipPath(){return!1}static get _hasDrawClass(){return!0}static get supportMultipleDrawings(){return!1}get _drawRotation(){return this.rotation}get _opacityName(){return this.constructor.typesMap.get(this.opacityType)}get#f(){return(this.parentRotation-this._drawRotation+360)%360}static updateDefaultParams(t,n){let r=this.typesMap.get(t);r&&this._defaultDrawingOptions.updateProperty(r,n),this._currentParent&&(e.#n.updateProperty(r,n),this._currentParent.drawLayer.updateProperties(this._currentDrawId,this._defaultDrawingOptions.toSVGProperties()))}updateParams(e,t){let n=this.constructor.typesMap.get(e);n&&this._updateProperty(e,n,t)}static get defaultPropertiesToUpdate(){let e=[],t=this._defaultDrawingOptions;for(let[n,r]of this.typesMap)e.push([n,t[r]]);return e}get propertiesToUpdate(){let e=[],{_drawingOptions:t}=this;for(let[n,r]of this.constructor.typesMap)e.push([n,t[r]]);return e}_updateProperty(e,t,n){let r=this._drawingOptions,i=r[t],a=n=>{r.updateProperty(t,n);let i=this._drawOutlines.updateProperty(t,n);i&&this.#_(i),this.parent?.drawLayer.updateProperties(this._drawId,r.toSVGProperties()),e===this.colorType?this.onUpdatedColor():e===this.opacityType&&this.onUpdatedOpacity()};this.addCommands({cmd:a.bind(this,n),undo:a.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:e,overwriteIfSameType:!0,keepUndo:!0})}_updateColorAndOpacity(e,t,n=this.colorAndOpacityType){let r=this.constructor.typesMap.get(this.colorType),i=this._opacityName,a=this._drawingOptions,o=a[r],s=a[i],c=(e,t)=>{a.updateProperty(r,e),a.updateProperty(i,t),this._drawOutlines.updateProperty(r,e),this._drawOutlines.updateProperty(i,t),this.parent?.drawLayer.updateProperties(this._drawId,a.toSVGProperties()),this.onUpdatedColor(),this.onUpdatedOpacity()};this.addCommands({cmd:c.bind(this,e,t),undo:c.bind(this,o,s),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:n,overwriteIfSameType:!0,keepUndo:!0})}_onResizing(){this.parent?.drawLayer.updateProperties(this._drawId,e._mergeSVGProperties(this._drawOutlines.getPathResizingSVGProperties(this.#g()),{bbox:this.#v()}))}_onResized(){this.parent?.drawLayer.updateProperties(this._drawId,e._mergeSVGProperties(this._drawOutlines.getPathResizedSVGProperties(this.#g()),{bbox:this.#v()})),this.#l()}_onTranslating(e,t){this.parent?.drawLayer.updateProperties(this._drawId,{bbox:this.#v()})}_onTranslated(){this.parent?.drawLayer.updateProperties(this._drawId,e._mergeSVGProperties(this._drawOutlines.getPathTranslatedSVGProperties(this.#g(),this.parentDimensions),{bbox:this.#v()}))}_onStartDragging(){this.parent?.drawLayer.updateProperties(this._drawId,{rootClass:{moving:!0}})}_onStopDragging(){this.parent?.drawLayer.updateProperties(this._drawId,{rootClass:{moving:!1}})}get _mustBeDisabledOnCommit(){return!0}commit(){super.commit(),this._mustBeDisabledOnCommit&&(this.disableEditMode(),this.disableEditing())}disableEditing(){super.disableEditing(),this.div.classList.toggle(`disabled`,!0)}enableEditing(){super.enableEditing(),this.div.classList.toggle(`disabled`,!1)}getBaseTranslation(){return[0,0]}get isResizable(){return!0}onceAdded(e){this.annotationElementId||this.parent.addUndoableEditor(this),this._isDraggable=!0,this.#t&&(this.#t=!1,this.commit(),this.parent.setSelected(this),e&&this.isOnScreen&&this.div.focus())}remove(){this._uiManager.removeShouldRescale(this),this.#p(),super.remove()}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(this.#m(),this.#_(this._drawOutlines.box),this.isAttachedToDOM||this.parent.add(this)))}setParent(e){let t=!1;this.parent&&!e?(this._uiManager.removeShouldRescale(this),this.#p()):e&&(this._uiManager.addShouldRescale(this),this.#m(e),t=!this.parent&&this.div?.classList.contains(`selectedEditor`)),super.setParent(e),this.#d(),t&&this.select()}#p(){if(this._drawId===null||!this.parent)return;let{drawLayer:e}=this.parent;e.remove(this._drawId),this._drawId=null,this._focusDrawId!==null&&(e.remove(this._focusDrawId),this._focusDrawId=null),this._drawingOptions.reset()}#m(e=this.parent){if(this._drawId===null||this.parent!==e){if(this._drawId!==null){let{drawLayer:t}=this.parent;t.updateParent(this._drawId,e.drawLayer),this._focusDrawId!==null&&t.updateParent(this._focusDrawId,e.drawLayer)}else this._drawingOptions.updateAll(),this._drawId=this.#s(this._drawOutlines,e),this._clipPathId&&this.#e&&(this.#e.style.clipPath=this._clipPathId)}}#h([e,t,n,r]){let{parentDimensions:[i,a],_drawRotation:o}=this;switch(o){case 90:return[t,1-e,a/i*n,i/a*r];case 180:return[1-e,1-t,n,r];case 270:return[1-t,e,a/i*n,i/a*r];default:return[e,t,n,r]}}#g(){let{x:e,y:t,width:n,height:r,parentDimensions:[i,a],_drawRotation:o}=this;switch(o){case 90:return[1-t,e,i/a*n,a/i*r];case 180:return[1-e,1-t,n,r];case 270:return[t,1-e,i/a*n,a/i*r];default:return[e,t,n,r]}}#_(e){[this.x,this.y,this.width,this.height]=this.#h(e),this.div&&(this.fixAndSetPosition(),this.setDims()),this._onResized()}#v(e=this.parentRotation){let{x:t,y:n,width:r,height:i,_drawRotation:a,parentDimensions:[o,s]}=this;switch((a*4+e)/90){case 1:return[1-n-i,t,i,r];case 2:return[1-t-r,1-n-i,r,i];case 3:return[n,1-t-r,i,r];case 4:return[t,n-o/s*r,s/o*i,o/s*r];case 5:return[1-n,t,o/s*r,s/o*i];case 6:return[1-t-s/o*i,1-n,s/o*i,o/s*r];case 7:return[n-o/s*r,1-t-s/o*i,o/s*r,s/o*i];case 8:return[t-r,n-i,r,i];case 9:return[1-n,t-r,i,r];case 10:return[1-t,1-n,r,i];case 11:return[n-i,1-t,i,r];case 12:return[t-s/o*i,n,s/o*i,o/s*r];case 13:return[1-n-o/s*r,t-s/o*i,o/s*r,s/o*i];case 14:return[1-t,1-n-o/s*r,s/o*i,o/s*r];case 15:return[n,1-t,o/s*r,s/o*i];default:return[t,n,r,i]}}rotate(t=this.parentRotation){if(!this.parent||this._drawId===null)return;let n=(t-this._drawRotation+360)%360;this.parent.drawLayer.updateProperties(this._drawId,e._mergeSVGProperties({bbox:this.#v(t)},this._drawOutlines.updateRotation(n))),this.#l(n)}show(e=this._isVisible){super.show(e),this.#d()}select(){super.select(),this.#u({hovered:!1,selected:!0})}unselect(){super.unselect(),this.#u({selected:!1})}pointerover(){this.isSelected||this.#u({hovered:!0})}pointerleave(){this.isSelected||this.#u({hovered:!1})}onScaleChanging(){if(!this.parent)return;let e=this._drawOutlines.updateParentDimensions(this.parentDimensions,this.parent.scale);e&&this.#_(e)}static onScaleChangingWhenDrawing(){}render(){if(this.div)return this.div;let e,t;this._isCopy&&(e=this.x,t=this.y);let n=super.render();this.constructor._hasDrawClass&&n.classList.add(`draw`);let r=this.#e=document.createElement(`div`);return n.append(r),r.setAttribute(`aria-hidden`,`true`),r.className=`internal`,this._clipPathId&&(r.style.clipPath=this._clipPathId),Ja(this,r,[`pointerover`,`pointerleave`]),this.setDims(),this._uiManager.addShouldRescale(this),this.disableEditing(),this._isCopy&&this._moveAfterPaste(e,t),n}static createDrawerInstance(e){Ii(`Not implemented`)}static _getDrawingTarget(e,{target:t}){return t}static _getPointerCoords({offsetX:e,offsetY:t,clientX:n,clientY:r},i=null){if(!i)return[e,t];let a=n-i.clientX,o=r-i.clientY;switch(this._currentParent.viewport.rotation){case 90:[a,o]=[o,-a];break;case 180:[a,o]=[-a,-o];break;case 270:[a,o]=[-o,a]}return[i.offsetX+a,i.offsetY+o]}static _addDrawingListeners(e,t){}static _endDrawingSession(e=!1){return this._currentParent.endDrawingSession(e)}static startDrawing(t,n,r,i){let{pointerId:a,pointerType:o}=i;if(Ya.isInitializedAndDifferentPointerType(o))return;let s=this._getDrawingTarget(t,i),[c,l]=this._getPointerCoords(i),{viewport:{rotation:u}}=t,{x:d,y:f,width:p,height:m}=s.getBoundingClientRect(),h=e.#r=new AbortController,g=t.combinedSignal(h);if(Ya.setPointer(o,a),window.addEventListener(`pointerup`,e=>{Ya.isSamePointerIdOrRemove(e.pointerId)&&this._endDraw(e)},{signal:g}),window.addEventListener(`pointercancel`,e=>{Ya.isSamePointerIdOrRemove(e.pointerId)&&this._endDrawingSession()},{signal:g}),window.addEventListener(`pointerdown`,t=>{Ya.isSamePointerType(t.pointerType)&&(Ya.initializeAndAddPointerId(t.pointerId),e.#n.isCancellable()&&(e.#n.removeLastElement(),e.#n.isEmpty()?this._endDrawingSession(!0):this._endDraw(null)))},{capture:!0,passive:!1,signal:g}),window.addEventListener(`contextmenu`,Ca,{signal:g}),s.addEventListener(`pointermove`,this._drawMove.bind(this),{signal:g}),s.addEventListener(`touchmove`,e=>{Ya.isSameTimeStamp(e.timeStamp)&&wa(e)},{signal:g}),this._addDrawingListeners(s,g),t.toggleDrawing(),n._editorUndoBar?.hide(),e.#n){t.drawLayer.updateProperties(this._currentDrawId,e.#n.startNew(c,l,p,m,u));return}n.updateUIForDefaultProperties(this),e.#n=this.createDrawerInstance({x:c,y:l,box:[d,f,p,m],rotation:u,parent:t,isLTR:r}),e.#i=this.getDefaultDrawingOptions(),this._currentParent=t;let{id:_,clipPathId:v}=t.drawLayer.draw(this._mergeSVGProperties(e.#i.toSVGProperties(),e.#n.defaultSVGProperties),!0,this._hasClipPath);this._currentDrawId=_,e.#a=this._hasClipPath?v:null}static _drawMove(t){if(Ya.isSameTimeStamp(t.timeStamp),!e.#n||!Ya.isSamePointerId(t.pointerId))return;if(Ya.isUsingMultiplePointers()){this._endDraw(t);return}let n,r=t.getCoalescedEvents?.();if(r?.length){let i=[];for(let e of r)i.push(...this._getPointerCoords(e,t));n=e.#n.addPoints(i)}else n=e.#n.add(...this._getPointerCoords(t));this._currentParent.drawLayer.updateProperties(this._currentDrawId,n),Ya.setTimeStamp(t.timeStamp),wa(t)}static _cleanup(t){t&&(this._currentDrawId=-1,this._currentParent=null,e.#n=null,e.#i=null,e.#a=null,Ya.clearTimeStamp()),e.#r&&(e.#r.abort(),e.#r=null,Ya.clearPointerIds())}static _endDraw(t){let n=this._currentParent;if(n){if(n.toggleDrawing(!0),this._cleanup(!1),n.drawLayer.updateProperties(this._currentDrawId,t?.target===n.div?e.#n.end(...this._getPointerCoords(t)):e.#n.end()),this.supportMultipleDrawings){let t=e.#n,r=this._currentDrawId,i=t.getLastElement();n.addCommands({cmd:()=>{n.drawLayer.updateProperties(r,t.setLastElement(i))},undo:()=>{n.drawLayer.updateProperties(r,t.removeLastElement())},mustExec:!1,type:xi.DRAW_STEP})}else this.endDrawing(!1)}}static endDrawing(t){let n=this._currentParent;if(!n)return null;if(n.toggleDrawing(!0),n.cleanUndoStack(xi.DRAW_STEP),!e.#n.isEmpty()){let{pageDimensions:[r,i],scale:a}=n,o=n.createAndAddNewEditor({offsetX:0,offsetY:0},!1,{drawId:this._currentDrawId,clipPathId:e.#a,drawOutlines:e.#n.getOutlines(r*a,i*a,a,this._INNER_MARGIN),drawingOptions:e.#i,mustBeCommitted:!t});return this._cleanup(!0),o}return n.drawLayer.remove(this._currentDrawId),this._cleanup(!0),null}createDrawingOptions(e){}static deserializeDraw(e,t,n,r,i,a,o){Ii(`Not implemented`)}static async deserialize(e,t,n){let{rawDims:{pageWidth:r,pageHeight:i,pageX:a,pageY:o}}=t.viewport,s=this.deserializeDraw(a,o,r,i,this._INNER_MARGIN,e,n),c=await super.deserialize(e,t,n);return c.createDrawingOptions(e),c.#o({drawOutlines:s}),c.#m(),c.onScaleChanging(),c.rotate(),c}serializeDraw(e){let[t,n]=this.pageTranslation,[r,i]=this.pageDimensions;return this._drawOutlines.serialize([t,n,r,i],e)}renderAnnotationElement(e){return e.updateEdited({rect:this.getPDFRect()}),null}static canCreateNewEmptyEditor(){return!1}},W=class{static PRECISION=1e-4;focusOutline=null;toSVGPath(){Ii("Abstract method `toSVGPath` must be implemented.")}get box(){Ii("Abstract getter `box` must be implemented.")}serialize(e,t){Ii("Abstract method `serialize` must be implemented.")}get defaultSVGProperties(){Ii("Abstract getter `defaultSVGProperties` must be implemented.")}get defaultProperties(){return this.defaultSVGProperties}getFocusSVGProperties(e){return null}get focusMustRemoveSelfIntersections(){return!1}updateProperty(e,t){return null}updateParentDimensions(e,t){return null}serializeQuadPoints(e,t){return null}updateRotation(e){return{}}getPathResizingSVGProperties(e){return{}}getPathResizedSVGProperties(e){return{}}getPathTranslatedSVGProperties(e,t){return{}}static _rotateBox([e,t,n,r],i){switch(i){case 90:return[1-t-r,e,r,n];case 180:return[1-e-n,1-t-r,n,r];case 270:return[t,1-e-n,r,n]}return[e,t,n,r]}static _rescale(e,t,n,r,i,a){a||=new Float32Array(e.length);for(let o=0,s=e.length;o<s;o+=2)a[o]=t+e[o]*r,a[o+1]=n+e[o+1]*i;return a}static _rescaleAndSwap(e,t,n,r,i,a){a||=new Float32Array(e.length);for(let o=0,s=e.length;o<s;o+=2)a[o]=t+e[o+1]*r,a[o+1]=n+e[o]*i;return a}static _translate(e,t,n,r){r||=new Float32Array(e.length);for(let i=0,a=e.length;i<a;i+=2)r[i]=t+e[i],r[i+1]=n+e[i+1];return r}static svgRound(e){return Math.round(e*1e4)}static _normalizePoint(e,t,n,r,i){switch(i){case 90:return[1-t/n,e/r];case 180:return[1-e/n,1-t/r];case 270:return[t/n,1-e/r];default:return[e/n,t/r]}}static createBezierPoints(e,t,n,r,i,a){return[(e+5*n)/6,(t+5*r)/6,(5*n+i)/6,(5*r+a)/6,(n+i)/2,(r+a)/2]}},Kl=class e{#e;#t=[];#n;#r;#i=[];#a=new Float32Array(18);#o;#s;#c;#l;#u;#d;#f=[];static#p=8;static#m=2;static#h=e.#p+e.#m;constructor(t,n,r,i,a,o,s=0){this.#e=r,this.#d=a*i,this.#r=o,this.#a.set([NaN,NaN,NaN,NaN,t,n],6),this.#n=s,this.#l=e.#p*i,this.#c=e.#h*i,this.#u=i,this.#f.push(t,n)}isEmpty(){return isNaN(this.#a[8])}isCancellable(){return this.#f.length<=10}removeLastElement(){return this.#a.fill(NaN),this.#i.length=this.#t.length=this.#f.length=0,{path:{d:``}}}#g(){let e=this.#a.subarray(4,6),t=this.#a.subarray(16,18),[n,r,i,a]=this.#e;return[(this.#o+(e[0]-t[0])/2-n)/i,(this.#s+(e[1]-t[1])/2-r)/a,(this.#o+(t[0]-e[0])/2-n)/i,(this.#s+(t[1]-e[1])/2-r)/a]}add(e,t){this.#o=e,this.#s=t;let[n,r,i,a]=this.#e,[o,s,c,l]=this.#a.subarray(8,12),u=e-c,d=t-l,f=Math.hypot(u,d);if(f<this.#c)return!1;let p=f-this.#l,m=p/f,h=m*u,g=m*d,_=o,v=s;o=c,s=l,c+=h,l+=g,this.#f?.push(e,t);let y=-g/p,b=h/p,x=y*this.#d,S=b*this.#d;return this.#a.set(this.#a.subarray(2,8),0),this.#a.set([c+x,l+S],4),this.#a.set(this.#a.subarray(14,18),12),this.#a.set([c-x,l-S],16),isNaN(this.#a[6])?(this.#i.length===0&&(this.#a.set([o+x,s+S],2),this.#i.push(NaN,NaN,NaN,NaN,(o+x-n)/i,(s+S-r)/a),this.#a.set([o-x,s-S],14),this.#t.push(NaN,NaN,NaN,NaN,(o-x-n)/i,(s-S-r)/a)),this.#a.set([_,v,o,s,c,l],6),!this.isEmpty()):(this.#a.set([_,v,o,s,c,l],6),Math.abs(Math.atan2(v-s,_-o)-Math.atan2(g,h))<Math.PI/2?([o,s,c,l]=this.#a.subarray(2,6),this.#i.push(NaN,NaN,NaN,NaN,((o+c)/2-n)/i,((s+l)/2-r)/a),[o,s,_,v]=this.#a.subarray(14,18),this.#t.push(NaN,NaN,NaN,NaN,((_+o)/2-n)/i,((v+s)/2-r)/a),!0):([_,v,o,s,c,l]=this.#a.subarray(0,6),this.#i.push(((_+5*o)/6-n)/i,((v+5*s)/6-r)/a,((5*o+c)/6-n)/i,((5*s+l)/6-r)/a,((o+c)/2-n)/i,((s+l)/2-r)/a),[c,l,o,s,_,v]=this.#a.subarray(12,18),this.#t.push(((_+5*o)/6-n)/i,((v+5*s)/6-r)/a,((5*o+c)/6-n)/i,((5*s+l)/6-r)/a,((o+c)/2-n)/i,((s+l)/2-r)/a),!0))}toSVGPath(){if(this.isEmpty())return``;let e=this.#i,t=this.#t;if(isNaN(this.#a[6])&&!this.isEmpty())return this.#_();let n=[];n.push(`M${e[4]} ${e[5]}`);for(let t=6;t<e.length;t+=6)isNaN(e[t])?n.push(`L${e[t+4]} ${e[t+5]}`):n.push(`C${e[t]} ${e[t+1]} ${e[t+2]} ${e[t+3]} ${e[t+4]} ${e[t+5]}`);this.#y(n);for(let e=t.length-6;e>=6;e-=6)isNaN(t[e])?n.push(`L${t[e+4]} ${t[e+5]}`):n.push(`C${t[e]} ${t[e+1]} ${t[e+2]} ${t[e+3]} ${t[e+4]} ${t[e+5]}`);return this.#v(n),n.join(` `)}#_(){let[e,t,n,r]=this.#e,[i,a,o,s]=this.#g();return`M${(this.#a[2]-e)/n} ${(this.#a[3]-t)/r} L${(this.#a[4]-e)/n} ${(this.#a[5]-t)/r} L${i} ${a} L${o} ${s} L${(this.#a[16]-e)/n} ${(this.#a[17]-t)/r} L${(this.#a[14]-e)/n} ${(this.#a[15]-t)/r} Z`}#v(e){let t=this.#t;e.push(`L${t[4]} ${t[5]} Z`)}#y(e){let[t,n,r,i]=this.#e,a=this.#a.subarray(4,6),o=this.#a.subarray(16,18),[s,c,l,u]=this.#g();e.push(`L${(a[0]-t)/r} ${(a[1]-n)/i} L${s} ${c} L${l} ${u} L${(o[0]-t)/r} ${(o[1]-n)/i}`)}newFreeDrawOutline(e,t,n,r,i,a){return new ql(e,t,n,r,i,a)}getOutlines(){let e=this.#i,t=this.#t,n=this.#a,[r,i,a,o]=this.#e,s=new Float32Array((this.#f?.length??0)+2);for(let e=0,t=s.length-2;e<t;e+=2)s[e]=(this.#f[e]-r)/a,s[e+1]=(this.#f[e+1]-i)/o;if(s[s.length-2]=(this.#o-r)/a,s[s.length-1]=(this.#s-i)/o,isNaN(n[6])&&!this.isEmpty())return this.#b(s);let c=new Float32Array(this.#i.length+24+this.#t.length),l=e.length;for(let t=0;t<l;t+=2)isNaN(e[t])?c[t]=c[t+1]=NaN:(c[t]=e[t],c[t+1]=e[t+1]);l=this.#S(c,l);for(let e=t.length-6;e>=6;e-=6)for(let n=0;n<6;n+=2)isNaN(t[e+n])?(c[l]=c[l+1]=NaN,l+=2):(c[l]=t[e+n],c[l+1]=t[e+n+1],l+=2);return this.#x(c,l),this.newFreeDrawOutline(c,s,this.#e,this.#u,this.#n,this.#r)}#b(e){let t=this.#a,[n,r,i,a]=this.#e,[o,s,c,l]=this.#g(),u=new Float32Array(36);return u.set([NaN,NaN,NaN,NaN,(t[2]-n)/i,(t[3]-r)/a,NaN,NaN,NaN,NaN,(t[4]-n)/i,(t[5]-r)/a,NaN,NaN,NaN,NaN,o,s,NaN,NaN,NaN,NaN,c,l,NaN,NaN,NaN,NaN,(t[16]-n)/i,(t[17]-r)/a,NaN,NaN,NaN,NaN,(t[14]-n)/i,(t[15]-r)/a],0),this.newFreeDrawOutline(u,e,this.#e,this.#u,this.#n,this.#r)}#x(e,t){let n=this.#t;return e.set([NaN,NaN,NaN,NaN,n[4],n[5]],t),t+=6}#S(e,t){let n=this.#a.subarray(4,6),r=this.#a.subarray(16,18),[i,a,o,s]=this.#e,[c,l,u,d]=this.#g();return e.set([NaN,NaN,NaN,NaN,(n[0]-i)/o,(n[1]-a)/s,NaN,NaN,NaN,NaN,c,l,NaN,NaN,NaN,NaN,u,d,NaN,NaN,NaN,NaN,(r[0]-i)/o,(r[1]-a)/s],t),t+=24}},ql=class extends W{#e;#t=new Float32Array(4);#n;#r;#i;#a;#o;constructor(e,t,n,r,i,a){super(),this.#o=e,this.#i=t,this.#e=n,this.#a=r,this.#n=i,this.#r=a,this.firstPoint=[NaN,NaN],this.lastPoint=[NaN,NaN],this.#s(a);let[o,s,c,l]=this.#t;for(let t=0,n=e.length;t<n;t+=2)e[t]=(e[t]-o)/c,e[t+1]=(e[t+1]-s)/l;for(let e=0,n=t.length;e<n;e+=2)t[e]=(t[e]-o)/c,t[e+1]=(t[e+1]-s)/l}toSVGPath(){let e=[`M${this.#o[4]} ${this.#o[5]}`];for(let t=6,n=this.#o.length;t<n;t+=6)isNaN(this.#o[t])?e.push(`L${this.#o[t+4]} ${this.#o[t+5]}`):e.push(`C${this.#o[t]} ${this.#o[t+1]} ${this.#o[t+2]} ${this.#o[t+3]} ${this.#o[t+4]} ${this.#o[t+5]}`);return e.push(`Z`),e.join(` `)}serialize([e,t,n,r],i){let a=n-e,o=r-t,s,c;switch(i){case 0:s=W._rescale(this.#o,e,r,a,-o),c=W._rescale(this.#i,e,r,a,-o);break;case 90:s=W._rescaleAndSwap(this.#o,e,t,a,o),c=W._rescaleAndSwap(this.#i,e,t,a,o);break;case 180:s=W._rescale(this.#o,n,t,-a,o),c=W._rescale(this.#i,n,t,-a,o);break;case 270:s=W._rescaleAndSwap(this.#o,n,r,-a,-o),c=W._rescaleAndSwap(this.#i,n,r,-a,-o)}return{outline:Array.from(s),points:[Array.from(c)]}}#s(e){let t=this.#o,n=t[4],r=t[5],i=[n,r,n,r],a=n,o=r,s=n,c=r,l=e?Math.max:Math.min,u=new Float32Array(4);for(let e=6,d=t.length;e<d;e+=6){let d=t[e+4],f=t[e+5];isNaN(t[e])?(U.pointBoundingBox(d,f,i),o>f?(a=d,o=f):o===f&&(a=l(a,d)),c<f?(s=d,c=f):c===f&&(s=l(s,d))):(u.set(fi,0),U.bezierBoundingBox(n,r,...t.slice(e,e+6),u),U.rectBoundingBox(...u,i),o>u[1]?(a=u[0],o=u[1]):o===u[1]&&(a=l(a,u[0])),c<u[3]?(s=u[2],c=u[3]):c===u[3]&&(s=l(s,u[2]))),n=d,r=f}let d=this.#t;d[0]=i[0]-this.#n,d[1]=i[1]-this.#n,d[2]=i[2]-i[0]+2*this.#n,d[3]=i[3]-i[1]+2*this.#n,this.firstPoint=[a,o],this.lastPoint=[s,c]}get box(){return this.#t}newOutliner(e,t,n,r,i,a,o=0){return new Kl(e,t,n,r,i,a,o)}updateThickness(e){let t=this.getNewOutline(e);return this.#o=t.#o,this.#i=t.#i,this.#t.set(t.#t),this.firstPoint=t.firstPoint,this.lastPoint=t.lastPoint,this.#t}getNewOutline(e,t){let[n,r,i,a]=this.#t,[o,s,c,l]=this.#e,u=i*c,d=a*l,f=n*c+o,p=r*l+s,m=this.#i,h=this.newOutliner(m[0]*u+f,m[1]*d+p,this.#e,this.#a,e,this.#r,t??this.#n);for(let e=2,t=m.length;e<t;e+=2)h.add(m[e]*u+f,m[e+1]*d+p);return h.getOutlines()}};function Jl(e){return{bbox:e.box,root:{viewBox:`0 0 1 1`},rootClass:{highlight:!0,free:e.isFree},path:{d:e.toSVGPath()}}}function Yl(e,t){let{focusOutline:n}=e;return{bbox:W._rotateBox(n.box,t),root:{"data-main-rotation":t},rootClass:{highlightOutline:!0,free:e.isFree},path:{d:n.toSVGPath()}}}var Xl=class{#e;#t;#n;#r=[];#i=[];constructor(e,t=0,n=0,r=!0){let i=fi.slice(),a=10**-4;for(let{x:n,y:r,width:o,height:s}of e){let e=Math.floor((n-t)/a)*a,c=Math.ceil((n+o+t)/a)*a,l=Math.floor((r-t)/a)*a,u=Math.ceil((r+s+t)/a)*a,d=[e,l,u,!0],f=[c,l,u,!1];this.#r.push(d,f),U.rectBoundingBox(e,l,c,u,i)}let o=i[2]-i[0]+2*n,s=i[3]-i[1]+2*n,c=i[0]-n,l=i[1]-n,u=r?-1/0:1/0,d=1/0,f=this.#r.at(r?-1:-2),p=[f[0],f[2]];for(let e of this.#r){let[t,n,i,a]=e;!a&&r?n<d?(d=n,u=t):n===d&&(u=Math.max(u,t)):a&&!r&&(n<d?(d=n,u=t):n===d&&(u=Math.min(u,t))),e[0]=(t-c)/o,e[1]=(n-l)/s,e[2]=(i-l)/s}this.#e=new Float32Array([c,l,o,s]),this.#t=[u,d],this.#n=p}getOutlines(){this.#r.sort((e,t)=>e[0]-t[0]||e[1]-t[1]||e[2]-t[2]);let e=[];for(let t of this.#r)t[3]?(e.push(...this.#l(t)),this.#s(t)):(this.#c(t),e.push(...this.#l(t)));return this.#a(e)}#a(e){let t=[],n=new Set;for(let n of e){let[e,r,i]=n;t.push([e,r,n],[e,i,n])}t.sort((e,t)=>e[1]-t[1]||e[0]-t[0]);for(let e=0,r=t.length;e<r;e+=2){let r=t[e][2],i=t[e+1][2];r.push(i),i.push(r),n.add(r),n.add(i)}let r=[];for(;n.size>0;){let e=n.values().next().value,[t,i,a,o,s]=e;n.delete(e);let c=t,l=i,u=[t,a];for(r.push(u);;){let e;if(n.has(o))e=o;else if(n.has(s))e=s;else break;n.delete(e),[t,i,a,o,s]=e,c!==t&&(u.push(c,l,t,l===i?i:a),c=t),l=l===i?a:i}u.push(c,l)}return new Zl(r,this.#e,this.#t,this.#n)}#o(e){let t=this.#i,n=0,r=t.length-1;for(;n<=r;){let i=n+r>>1,a=t[i][0];if(a===e)return i;a<e?n=i+1:r=i-1}return r+1}#s([,e,t]){let n=this.#o(e);this.#i.splice(n,0,[e,t])}#c([,e,t]){let n=this.#o(e);for(let r=n;r<this.#i.length;r++){let[n,i]=this.#i[r];if(n!==e)break;if(n===e&&i===t){this.#i.splice(r,1);return}}for(let r=n-1;r>=0;r--){let[n,i]=this.#i[r];if(n!==e)break;if(n===e&&i===t){this.#i.splice(r,1);return}}}#l(e){let[t,n,r]=e,i=[[t,n,r]],a=this.#o(r);for(let e=0;e<a;e++){let[n,r]=this.#i[e];for(let e=0,a=i.length;e<a;e++){let[,o,s]=i[e];if(!(r<=o||s<=n)){if(o>=n){if(s>r)i[e][1]=r;else{if(a===1)return[];i.splice(e,1),e--,a--}}else i[e][2]=n,s>r&&i.push([t,r,s])}}}return i}},Zl=class extends W{#e;#t=null;#n;constructor(e,t,n,r){super(),this.#n=e,this.#e=t,this.firstPoint=n,this.lastPoint=r}static build(e,t){let n=new Xl(e,.001).getOutlines();return n.#t=e,n.focusOutline=new Xl(e,.0025,.001,t).getOutlines(),n}get isFree(){return!1}get defaultSVGProperties(){return Jl(this)}getFocusSVGProperties(e){return Yl(this,e)}updateRotation(e){return{root:{"data-main-rotation":e}}}serializeQuadPoints([e,t],[n,r]){let i=this.#t,a=new Float32Array(i.length*8),o=0;for(let{x:s,y:c,width:l,height:u}of i){let i=s*n+e,d=(1-c)*r+t;a[o]=a[o+4]=i,a[o+1]=a[o+3]=d,a[o+2]=a[o+6]=i+l*n,a[o+5]=a[o+7]=d-u*r,o+=8}return a}toSVGPath(){let e=[];for(let t of this.#n){let[n,r]=t;e.push(`M${n} ${r}`);for(let i=2;i<t.length;i+=2){let a=t[i],o=t[i+1];a===n?(e.push(`V${o}`),r=o):o===r&&(e.push(`H${a}`),n=a)}e.push(`Z`)}return e.join(` `)}serialize([e,t,n,r],i){let a=[],o=n-e,s=r-t;for(let t of this.#n){let n=Array(t.length);for(let i=0;i<t.length;i+=2)n[i]=e+t[i]*o,n[i+1]=r-t[i+1]*s;a.push(n)}return a}get box(){return this.#e}},Ql=class extends Kl{newFreeDrawOutline(e,t,n,r,i,a){return new eu(e,t,n,r,i,a)}},$l=class{#e;#t;constructor(e,t,n,r,i,a,o){this.#e=new Ql(e,t,n,r,i,a,o),this.#t=i}add(e,t){return this.#e.add(e,t)?{path:{d:this.#e.toSVGPath()}}:null}addPoints(e){let t=!1;for(let n=0,r=e.length;n<r;n+=2)t=this.#e.add(e[n],e[n+1])||t;return t?{path:{d:this.#e.toSVGPath()}}:null}end(e,t){return e===void 0?null:this.add(e,t)}isEmpty(){return this.#e.isEmpty()}isCancellable(){return this.#e.isCancellable()}removeLastElement(){return this.#e.removeLastElement()}updateProperty(e,t){return null}getOutlines(){let e=this.#e.getOutlines();return e.buildFocusOutline(2*this.#t),e}get defaultSVGProperties(){return{bbox:[0,0,1,1],root:{viewBox:`0 0 1 1`},rootClass:{highlight:!0,free:!0},path:{d:this.#e.toSVGPath()}}}},eu=class e extends ql{static#e=1.5;newOutliner(e,t,n,r,i,a,o=0){return new Ql(e,t,n,r,i,a,o)}get isFree(){return!0}buildFocusOutline(t){this.focusOutline=this.getNewOutline(t/2+e.#e,.0025)}get defaultSVGProperties(){return Jl(this)}getFocusSVGProperties(e){return Yl(this,e)}get focusMustRemoveSelfIntersections(){return!0}updateRotation(e){return{root:{"data-main-rotation":e}}}updateProperty(e,t){if(e!==`thickness`)return null;let n=this.updateThickness(t/2);return this.buildFocusOutline(t),n}getPathResizedSVGProperties(){return{path:{d:this.toSVGPath()}}}},tu=class e extends Wl{constructor(e=null){super(),super.updateProperties(e)}updateSVGProperty(e,t){e!==`thickness`&&super.updateSVGProperty(e,t)}clone(){let t=new e;return t.updateAll(this),t}},nu=class e extends Gl{#e=null;#t=0;#n=null;#r=0;#i=``;#a=``;static _DEFAULT_OPACITY=1;static _DEFAULT_THICKNESS=12;static _defaultDrawingOptions=null;static _type=`highlight`;static _editorType=bi.HIGHLIGHT;static get _keyboardManager(){let t=e.prototype;return H(this,`_keyboardManager`,new $a([[[`ArrowLeft`],t._moveCaret,{args:[0]}],[[`ArrowRight`],t._moveCaret,{args:[1]}],[[`ArrowUp`],t._moveCaret,{args:[2]}],[[`ArrowDown`],t._moveCaret,{args:[3]}]]))}constructor(e){super({...e,name:`highlightEditor`}),this.#e=e.anchorNode||null,this.#t=e.anchorOffset||0,this.#n=e.focusNode||null,this.#r=e.focusOffset||0,this.#i=e.methodOfCreation||(this._drawOutlines?.isFree?`main_toolbar`:``),this.#a=e.text||``,this._isDraggable=!1,this.defaultL10nId=`pdfjs-editor-highlight-editor`,this.rotate()}static initialize(t,n){co.initialize(t,n),this._defaultDrawingOptions||=new tu({fill:n.highlightColors?.values().next().value||`#fff066`,"fill-opacity":e._DEFAULT_OPACITY,thickness:e._DEFAULT_THICKNESS})}static getDefaultDrawingOptions(e){let t=this._defaultDrawingOptions.clone();return t.updateProperties(e),t}static get typesMap(){return H(this,`typesMap`,new Map([[xi.HIGHLIGHT_COLOR,`fill`],[xi.HIGHLIGHT_THICKNESS,`thickness`]]))}static get isDrawer(){return!1}static get _hasClipPath(){return!0}static get _hasDrawClass(){return!1}_addOutlines(t){let{boxes:n,drawOutlines:r}=t;(n||r)&&(this._drawingOptions||=t.drawingOptions||e.getDefaultDrawingOptions(),n&&(t={...t,drawOutlines:Zl.build(n,this._uiManager.direction===`ltr`)}),super._addOutlines(t))}get colorType(){return xi.HIGHLIGHT_COLOR}get color(){return this._drawingOptions.fill}get opacity(){return this._drawingOptions[`fill-opacity`]}get _opacityName(){return`fill-opacity`}get _drawRotation(){return this._drawOutlines?.isFree?this.rotation:0}get isResizable(){return!1}get _mustBeDisabledOnCommit(){return!1}get _mustFixPosition(){return!this._drawOutlines?.isFree}get telemetryInitialData(){return{action:`added`,type:this._drawOutlines.isFree?`free_highlight`:`highlight`,color:this._uiManager.getNonHCMColorName(this.color),thickness:this._drawingOptions.thickness,methodOfCreation:this.#i}}get telemetryFinalData(){return{type:`highlight`,color:this._uiManager.getNonHCMColorName(this.color)}}static computeTelemetryFinalData(e){return{numberOfColors:e.get(`color`).size}}translateInPage(e,t){}get toolbarPosition(){return this.#o(this._drawOutlines.focusOutline.lastPoint)}get commentButtonPosition(){return this.#o(this._drawOutlines.firstPoint)}#o([e,t]){let[n,r,i,a]=this._drawOutlines.box;return[(e-n)/i,(t-r)/a]}updateParams(t,n){switch(t){case xi.HIGHLIGHT_COLOR:this._updateColorAndOpacity(n,e._DEFAULT_OPACITY,t),this._reportTelemetry({action:`color_changed`,color:this._uiManager.getNonHCMColorName(n)},!0);break;case xi.HIGHLIGHT_THICKNESS:super.updateParams(t,n),this._reportTelemetry({action:`thickness_changed`,thickness:n},!0)}}get propertiesToUpdate(){let e=super.propertiesToUpdate;return e.push([xi.HIGHLIGHT_FREE,this._drawOutlines.isFree]),e}get toolbarButtons(){return this._uiManager.highlightColors?(this._colorPicker=new nl({editor:this}),[[`colorPicker`,this._colorPicker]]):super.toolbarButtons}fixAndSetPosition(){return super.fixAndSetPosition(this._drawRotation)}getRect(e,t){return super.getRect(e,t,this._drawRotation)}onceAdded(e){this.annotationElementId||this.parent.addUndoableEditor(this),e&&this.div.focus()}remove(){this._reportTelemetry({action:`deleted`}),super.remove()}render(){if(this.div)return this.div;let e=super.render();return this.#a&&(e.setAttribute(`aria-label`,this.#a),e.setAttribute(`role`,`mark`)),this._drawOutlines.isFree?e.classList.add(`free`):e.addEventListener(`keydown`,this.#s.bind(this),{signal:this._uiManager._signal}),this.enableEditing(),e}#s(t){e._keyboardManager.exec(this,t)}_moveCaret(e){switch(this.parent.unselect(this),e){case 0:case 2:this.#c(!0);break;case 1:case 3:this.#c(!1)}}#c(e){if(!this.#e)return;let t=window.getSelection();e?t.setPosition(this.#e,this.#t):t.setPosition(this.#n,this.#r)}unselect(){super.unselect(),this._drawOutlines.isFree||this.#c(!1)}static createDrawerInstance({x:e,y:t,box:n,parent:r,isLTR:i}){return new $l(e,t,n,r.scale,this._defaultDrawingOptions.thickness/2,i,.001)}static _getDrawingTarget(e,{target:t}){return t.closest(`.textLayer`)}static _getPointerCoords({x:e,y:t}){return[e,t]}static _addDrawingListeners(e,t){e.classList.add(`free`),t.addEventListener(`abort`,()=>e.classList.remove(`free`),{once:!0}),window.addEventListener(`blur`,()=>this._endDraw(null),{signal:t}),window.addEventListener(`pointerdown`,wa,{capture:!0,passive:!1,signal:t})}static _endDrawingSession(e=!1){return this.endDrawing(e)}createDrawingOptions({color:t,opacity:n,thickness:r}){let{_defaultDrawingOptions:i,_DEFAULT_OPACITY:a}=e;this._drawingOptions=e.getDefaultDrawingOptions({fill:U.makeHexColor(...t),"fill-opacity":n||a,thickness:r||i.thickness})}static deserializeDraw(e,t,n,r,i,a,o){let{quadPoints:s}=a;if(s){let i=[];for(let a=0,o=s.length;a<o;a+=8)i.push({x:(s[a]-e)/n,y:1-(s[a+1]-t)/r,width:(s[a+2]-s[a])/n,height:(s[a+1]-s[a+5])/r});return Zl.build(i,o.direction===`ltr`)}let c=a.thickness||this._defaultDrawingOptions.thickness,l=(a.inkLists||a.outlines.points)[0],u=new Ql(l[0]-e,r-(l[1]-t),[0,0,n,r],1,c/2,!0,.001);for(let n=0,i=l.length;n<i;n+=2)u.add(l[n]-e,r-(l[n+1]-t));let d=u.getOutlines();return d.buildFocusOutline(c),d}static async deserialize(e,t,n){let r=null;if(e instanceof Pl){let{data:{quadPoints:t,rect:n,rotation:i,id:a,color:o,opacity:s,popupRef:c,richText:l,contentsObj:u,creationDate:d,modificationDate:f},parent:{page:{pageNumber:p}}}=e;r=e={annotationType:bi.HIGHLIGHT,color:Array.from(o),opacity:s,quadPoints:t,pageIndex:p-1,rect:n.slice(0),rotation:i,annotationElementId:a,id:a,deleted:!1,popupRef:c,richText:l,comment:u?.str||null,creationDate:d,modificationDate:f}}else if(e instanceof Nl){let{data:{inkLists:t,rect:n,rotation:i,id:a,color:o,borderStyle:{rawWidth:s},popupRef:c,richText:l,contentsObj:u,creationDate:d,modificationDate:f},parent:{page:{pageNumber:p}}}=e;r=e={annotationType:bi.HIGHLIGHT,color:Array.from(o),thickness:s,inkLists:t,pageIndex:p-1,rect:n.slice(0),rotation:i,annotationElementId:a,id:a,deleted:!1,popupRef:c,richText:l,comment:u?.str||null,creationDate:d,modificationDate:f}}let i=await super.deserialize(e,t,n);return i._initialData=r,e.comment&&i.setCommentData(e),i}serialize(e=!1){if(this.isEmpty()||e)return null;if(this.deleted)return this.serializeDeleted();let t=super.serialize(e);return Object.assign(t,{color:co._colorManager.convert(this._uiManager.getNonHCMColor(this.color)),opacity:this.opacity,thickness:this._drawingOptions.thickness,quadPoints:this._drawOutlines.serializeQuadPoints(this.pageTranslation,this.pageDimensions),outlines:this._drawOutlines.serialize(t.rect,this._drawRotation)}),this.addComment(t),this.annotationElementId&&!this.#l(t)?null:(t.id=this.annotationElementId,t)}#l(e){let{color:t}=this._initialData;return this.hasEditedComment||e.color.some((e,n)=>e!==t[n])}renderAnnotationElement(e){return this.deleted?(e.hide(),null):(e.updateEdited({rect:this.getPDFRect(),popup:this.comment}),null)}},ru=class{#e=new Float64Array(6);#t=new Float64Array(2);#n;#r;#i;#a;#o;#s=``;#c=0;#l=new iu;#u;#d;constructor(e,t,n,r,i,a){this.#u=n,this.#d=r,this.#i=i,this.#a=a,[e,t]=this.#f(e,t);let o=this.#n=[NaN,NaN,NaN,NaN,e,t];this.#o=[e,t],this.#r=[{line:o,points:this.#o}],this.#e.set(o,0),this.#t.set([e,t],0)}updateProperty(e,t){e===`stroke-width`&&(this.#a=t)}#f(e,t){return W._normalizePoint(e,t,this.#u,this.#d,this.#i)}isEmpty(){return!this.#r?.length}isCancellable(){return this.#o.length<=10}add(e,t){return this.#p(e,t)&&this.toSVGPath(),{path:{d:this.#m()}}}addPoints(e){let t=!1;for(let n=0,r=e.length;n<r;n+=2)this.#p(e[n],e[n+1])&&(t=!0,this.#o.length<=6&&(this.toSVGPath(),t=!1));return t&&this.toSVGPath(),{path:{d:this.#m()}}}#p(e,t){[e,t]=this.#f(e,t),this.#t.set([e,t],0);let[n,r,i,a]=this.#e.subarray(2,6),o=e-i,s=t-a;return Math.hypot(this.#u*o,this.#d*s)<=2?!1:(this.#o.push(e,t),isNaN(n)?(this.#e.set([i,a,e,t],2),this.#n.push(NaN,NaN,NaN,NaN,e,t),!0):(isNaN(this.#e[0])&&this.#n.splice(6,6),this.#e.set([n,r,i,a,e,t],0),this.#n.push(...W.createBezierPoints(n,r,i,a,e,t)),!0))}end(e,t){return e!==void 0&&this.#p(e,t)||this.#o.length===2?{path:{d:this.toSVGPath()}}:{path:{d:this.#s}}}startNew(e,t,n,r,i){this.#u=n,this.#d=r,this.#i=i,[e,t]=this.#f(e,t);let a=this.#n=[NaN,NaN,NaN,NaN,e,t];this.#o=[e,t],this.#t.set([e,t],0);let o=this.#r.at(-1);return o&&(o.line=new Float32Array(o.line),o.points=new Float32Array(o.points)),this.#r.push({line:a,points:this.#o}),this.#e.set(a,0),this.#c=0,this.toSVGPath(),null}getLastElement(){return this.#r.at(-1)}setLastElement(e){return this.#r?(this.#r.push(e),this.#n=e.line,this.#o=e.points,this.#c=0,{path:{d:this.toSVGPath()}}):this.#l.setLastElement(e)}removeLastElement(){if(!this.#r)return this.#l.removeLastElement();this.#r.pop(),this.#s=``;for(let e=0,t=this.#r.length;e<t;e++){let{line:t,points:n}=this.#r[e];this.#n=t,this.#o=n,this.#c=0,this.toSVGPath()}return{path:{d:this.#s}}}#m(){let e=W.svgRound(this.#t[0]),t=W.svgRound(this.#t[1]);if(this.#o.length===2){let n=W.svgRound(this.#n[4]),r=W.svgRound(this.#n[5]);return`${this.#s} M ${n} ${r} L ${e} ${t}`}return`${this.#s} L ${e} ${t}`}toSVGPath(){let e=W.svgRound(this.#n[4]),t=W.svgRound(this.#n[5]);if(this.#o.length===2)return this.#s=`${this.#s} M ${e} ${t} Z`,this.#s;if(this.#o.length<=6){let n=this.#s.lastIndexOf(`M`);this.#s=`${this.#s.slice(0,n)} M ${e} ${t}`,this.#c=6}if(this.#o.length===4){let e=W.svgRound(this.#n[10]),t=W.svgRound(this.#n[11]);return this.#s=`${this.#s} L ${e} ${t}`,this.#c=12,this.#s}let n=[];this.#c===0&&(n.push(`M ${e} ${t}`),this.#c=6);for(let e=this.#c,t=this.#n.length;e<t;e+=6){let[t,r,i,a,o,s]=this.#n.slice(e,e+6).map(W.svgRound);n.push(`C${t} ${r} ${i} ${a} ${o} ${s}`)}return this.#s+=n.join(` `),this.#c=this.#n.length,this.#s}getOutlines(e,t,n,r){let i=this.#r.at(-1);return i.line=new Float32Array(i.line),i.points=new Float32Array(i.points),this.#l.build(this.#r,e,t,n,this.#i,this.#a,r),this.#e=null,this.#n=null,this.#r=null,this.#s=null,this.#l}get defaultSVGProperties(){return{root:{viewBox:`0 0 10000 10000`},rootClass:{draw:!0},bbox:[0,0,1,1]}}},iu=class extends W{#e;#t=0;#n;#r;#i;#a;#o;#s;#c;build(e,t,n,r,i,a,o){this.#i=t,this.#a=n,this.#o=r,this.#s=i,this.#c=a,this.#n=o??0,this.#r=e,this.#d()}get thickness(){return this.#c}setLastElement(e){return this.#r.push(e),{path:{d:this.toSVGPath()}}}removeLastElement(){return this.#r.pop(),{path:{d:this.toSVGPath()}}}toSVGPath(){let e=[];for(let{line:t}of this.#r)if(e.push(`M${W.svgRound(t[4])} ${W.svgRound(t[5])}`),t.length===6)e.push(`Z`);else if(t.length===12&&isNaN(t[6]))e.push(`L${W.svgRound(t[10])} ${W.svgRound(t[11])}`);else for(let n=6,r=t.length;n<r;n+=6){let[r,i,a,o,s,c]=t.subarray(n,n+6).map(W.svgRound);e.push(`C${r} ${i} ${a} ${o} ${s} ${c}`)}return e.join(``)}serialize([e,t,n,r],i){let a=[],o=[],[s,c,l,u]=this.#u(),d,f,p,m,h,g,_,v,y;switch(this.#s){case 0:y=W._rescale,d=e,f=t+r,p=n,m=-r,h=e+s*n,g=t+(1-c-u)*r,_=e+(s+l)*n,v=t+(1-c)*r;break;case 90:y=W._rescaleAndSwap,d=e,f=t,p=n,m=r,h=e+c*n,g=t+s*r,_=e+(c+u)*n,v=t+(s+l)*r;break;case 180:y=W._rescale,d=e+n,f=t,p=-n,m=r,h=e+(1-s-l)*n,g=t+c*r,_=e+(1-s)*n,v=t+(c+u)*r;break;case 270:y=W._rescaleAndSwap,d=e+n,f=t+r,p=-n,m=-r,h=e+(1-c-u)*n,g=t+(1-s-l)*r,_=e+(1-c)*n,v=t+(1-s)*r}for(let{line:e,points:t}of this.#r)a.push(y(e,d,f,p,m,i?Array(e.length):null)),o.push(y(t,d,f,p,m,i?Array(t.length):null));return{lines:a,points:o,rect:[h,g,_,v]}}static deserialize(e,t,n,r,i,{paths:{lines:a,points:o},rotation:s,thickness:c}){let l=[],u,d,f,p,m;switch(s){case 0:m=W._rescale,u=-e/n,d=t/r+1,f=1/n,p=-1/r;break;case 90:m=W._rescaleAndSwap,u=-t/r,d=-e/n,f=1/r,p=1/n;break;case 180:m=W._rescale,u=e/n+1,d=-t/r,f=-1/n,p=1/r;break;case 270:m=W._rescaleAndSwap,u=t/r+1,d=e/n+1,f=-1/r,p=-1/n}if(!a){a=[];for(let e of o){let t=e.length;if(t===2){a.push(new Float32Array([NaN,NaN,NaN,NaN,e[0],e[1]]));continue}if(t===4){a.push(new Float32Array([NaN,NaN,NaN,NaN,e[0],e[1],NaN,NaN,NaN,NaN,e[2],e[3]]));continue}let n=new Float32Array(3*(t-2));a.push(n);let[r,i,o,s]=e.subarray(0,4);n.set([NaN,NaN,NaN,NaN,r,i],0);for(let a=4;a<t;a+=2){let t=e[a],c=e[a+1];n.set(W.createBezierPoints(r,i,o,s,t,c),(a-2)*3),[r,i,o,s]=[o,s,t,c]}}}for(let e=0,t=a.length;e<t;e++)l.push({line:m(a[e].map(e=>e??NaN),u,d,f,p),points:m(o[e].map(e=>e??NaN),u,d,f,p)});let h=new this.prototype.constructor;return h.build(l,n,r,1,s,c,i),h}#l(e=this.#c){let t=this.#n+e/2*this.#o;return this.#s%180==0?[t/this.#i,t/this.#a]:[t/this.#a,t/this.#i]}#u(){let[e,t,n,r]=this.#e,[i,a]=this.#l(0);return[e+i,t+a,n-2*i,r-2*a]}#d(){let e=this.#e=pi.slice();for(let{line:t}of this.#r){if(t.length<=12){for(let n=4,r=t.length;n<r;n+=6)U.pointBoundingBox(t[n],t[n+1],e);continue}let n=t[4],r=t[5];for(let i=6,a=t.length;i<a;i+=6){let[a,o,s,c,l,u]=t.subarray(i,i+6);U.bezierBoundingBox(n,r,a,o,s,c,l,u,e),n=l,r=u}}let[t,n]=this.#l();e[0]=ca(e[0]-t,0,1),e[1]=ca(e[1]-n,0,1),e[2]=ca(e[2]+t,0,1),e[3]=ca(e[3]+n,0,1),e[2]-=e[0],e[3]-=e[1]}get box(){return this.#e}updateProperty(e,t){return e===`stroke-width`?this.#f(t):null}#f(e){let[t,n]=this.#l();this.#c=e;let[r,i]=this.#l(),[a,o]=[r-t,i-n],s=this.#e;return s[0]-=a,s[1]-=o,s[2]+=2*a,s[3]+=2*o,s}updateParentDimensions([e,t],n){let[r,i]=this.#l();this.#i=e,this.#a=t,this.#o=n;let[a,o]=this.#l(),s=a-r,c=o-i,l=this.#e;return l[0]-=s,l[1]-=c,l[2]+=2*s,l[3]+=2*c,l}updateRotation(e){return this.#t=e,{path:{transform:this.rotationTransform}}}get viewBox(){return this.#e.map(W.svgRound).join(` `)}get defaultProperties(){let[e,t]=this.#e;return{root:{viewBox:this.viewBox},path:{"transform-origin":`${W.svgRound(e)} ${W.svgRound(t)}`}}}get rotationTransform(){let[,,e,t]=this.#e,n=0,r=0,i=0,a=0,o=0,s=0;switch(this.#t){case 90:r=t/e,i=-e/t,o=e;break;case 180:n=-1,a=-1,o=e,s=t;break;case 270:r=-t/e,i=e/t,s=t;break;default:return``}return`matrix(${n} ${r} ${i} ${a} ${W.svgRound(o)} ${W.svgRound(s)})`}getPathResizingSVGProperties([e,t,n,r]){let[i,a]=this.#l(),[o,s,c,l]=this.#e;if(Math.abs(c-i)<=W.PRECISION||Math.abs(l-a)<=W.PRECISION){let i=e+n/2-(o+c/2),a=t+r/2-(s+l/2);return{path:{"transform-origin":`${W.svgRound(e)} ${W.svgRound(t)}`,transform:`${this.rotationTransform} translate(${i} ${a})`}}}let u=(n-2*i)/(c-2*i),d=(r-2*a)/(l-2*a),f=c/n,p=l/r;return{path:{"transform-origin":`${W.svgRound(o)} ${W.svgRound(s)}`,transform:`${this.rotationTransform} scale(${f} ${p}) translate(${W.svgRound(i)} ${W.svgRound(a)}) scale(${u} ${d}) translate(${W.svgRound(-i)} ${W.svgRound(-a)})`}}}getPathResizedSVGProperties([e,t,n,r]){let[i,a]=this.#l(),o=this.#e,[s,c,l,u]=o;if(o[0]=e,o[1]=t,o[2]=n,o[3]=r,Math.abs(l-i)<=W.PRECISION||Math.abs(u-a)<=W.PRECISION){let i=e+n/2-(s+l/2),a=t+r/2-(c+u/2);for(let{line:e,points:t}of this.#r)W._translate(e,i,a,e),W._translate(t,i,a,t);return{root:{viewBox:this.viewBox},path:{"transform-origin":`${W.svgRound(e)} ${W.svgRound(t)}`,transform:this.rotationTransform||null,d:this.toSVGPath()}}}let d=(n-2*i)/(l-2*i),f=(r-2*a)/(u-2*a),p=-d*(s+i)+e+i,m=-f*(c+a)+t+a;if(d!==1||f!==1||p!==0||m!==0)for(let{line:e,points:t}of this.#r)W._rescale(e,p,m,d,f,e),W._rescale(t,p,m,d,f,t);return{root:{viewBox:this.viewBox},path:{"transform-origin":`${W.svgRound(e)} ${W.svgRound(t)}`,transform:this.rotationTransform||null,d:this.toSVGPath()}}}getPathTranslatedSVGProperties([e,t],n){let[r,i]=n,a=this.#e,o=e-a[0],s=t-a[1];if(this.#i===r&&this.#a===i)for(let{line:e,points:t}of this.#r)W._translate(e,o,s,e),W._translate(t,o,s,t);else{let e=this.#i/r,t=this.#a/i;this.#i=r,this.#a=i;for(let{line:n,points:r}of this.#r)W._rescale(n,o,s,e,t,n),W._rescale(r,o,s,e,t,r);a[2]*=e,a[3]*=t}return a[0]=e,a[1]=t,{root:{viewBox:this.viewBox},path:{d:this.toSVGPath(),"transform-origin":`${W.svgRound(e)} ${W.svgRound(t)}`}}}get defaultSVGProperties(){let e=this.#e;return{root:{viewBox:this.viewBox},rootClass:{draw:!0},path:{d:this.toSVGPath(),"transform-origin":`${W.svgRound(e[0])} ${W.svgRound(e[1])}`,transform:this.rotationTransform||null},bbox:e}}},au=class e extends Wl{constructor(e){super(),this._viewParameters=e,super.updateProperties({fill:`none`,stroke:co._defaultLineColor,"stroke-opacity":1,"stroke-width":1,"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-miterlimit":10})}updateSVGProperty(e,t){e===`stroke-width`&&(t??=this[`stroke-width`],t*=this._viewParameters.realScale),super.updateSVGProperty(e,t)}clone(){let t=new e(this._viewParameters);return t.updateAll(this),t}},ou=class e extends Gl{static _type=`ink`;static _editorType=bi.INK;static _defaultDrawingOptions=null;constructor(e){super({...e,name:`inkEditor`}),this._willKeepAspectRatio=!0,this.defaultL10nId=`pdfjs-editor-ink-editor`}static initialize(e,t){co.initialize(e,t),this._defaultDrawingOptions=new au(t.viewParameters)}static getDefaultDrawingOptions(e){let t=this._defaultDrawingOptions.clone();return t.updateProperties(e),t}static get supportMultipleDrawings(){return!0}static get typesMap(){return H(this,`typesMap`,new Map([[xi.INK_THICKNESS,`stroke-width`],[xi.INK_COLOR,`stroke`],[xi.INK_OPACITY,`stroke-opacity`]]))}static createDrawerInstance({x:e,y:t,box:[,,n,r],rotation:i}){return new ru(e,t,n,r,i,this._defaultDrawingOptions[`stroke-width`])}static deserializeDraw(e,t,n,r,i,a){return iu.deserialize(e,t,n,r,i,a)}static async deserialize(e,t,n){let r=null;if(e instanceof Nl){let{data:{inkLists:t,rect:n,rotation:i,id:a,color:o,opacity:s,borderStyle:{rawWidth:c},popupRef:l,richText:u,contentsObj:d,creationDate:f,modificationDate:p},parent:{page:{pageNumber:m}}}=e;r=e={annotationType:bi.INK,color:Array.from(o),thickness:c,opacity:s,paths:{points:t},boxes:null,pageIndex:m-1,rect:n.slice(0),rotation:i,annotationElementId:a,id:a,deleted:!1,popupRef:l,richText:u,comment:d?.str||null,creationDate:f,modificationDate:p}}let i=await super.deserialize(e,t,n);return i._initialData=r,e.comment&&i.setCommentData(e),i}get toolbarButtons(){return this._colorPicker||=new rl(this),[[`colorPicker`,this._colorPicker]]}get colorType(){return xi.INK_COLOR}get colorAndOpacityType(){return xi.INK_COLOR_AND_OPACITY}get opacityType(){return xi.INK_OPACITY}updateParams(e,t){e===xi.INK_COLOR_AND_OPACITY?this._updateColorAndOpacity(t.color,t.opacity):super.updateParams(e,t)}static updateDefaultParams(e,t){e===xi.INK_COLOR_AND_OPACITY?(super.updateDefaultParams(xi.INK_COLOR,t.color),super.updateDefaultParams(xi.INK_OPACITY,t.opacity)):super.updateDefaultParams(e,t)}get color(){return this._drawingOptions.stroke}get opacity(){return this._drawingOptions[`stroke-opacity`]}onScaleChanging(){if(!this.parent)return;super.onScaleChanging();let{_drawId:e,_drawingOptions:t,parent:n}=this;t.updateSVGProperty(`stroke-width`),n.drawLayer.updateProperties(e,t.toSVGProperties())}static onScaleChangingWhenDrawing(){let e=this._currentParent;e&&(super.onScaleChangingWhenDrawing(),this._defaultDrawingOptions.updateSVGProperty(`stroke-width`),e.drawLayer.updateProperties(this._currentDrawId,this._defaultDrawingOptions.toSVGProperties()))}createDrawingOptions({color:t,thickness:n,opacity:r}){this._drawingOptions=e.getDefaultDrawingOptions({stroke:U.makeHexColor(...t),"stroke-width":n,"stroke-opacity":r})}serialize(e=!1){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();let{lines:t,points:n}=this.serializeDraw(e),{_drawingOptions:{stroke:r,"stroke-opacity":i,"stroke-width":a}}=this,o=Object.assign(super.serialize(e),{color:co._colorManager.convert(r),opacity:i,thickness:a,paths:{lines:t,points:n}});return this.addComment(o),e?(o.isCopy=!0,o):this.annotationElementId&&!this.#e(o)?null:(o.id=this.annotationElementId,o)}#e(e){let{color:t,thickness:n,opacity:r,pageIndex:i}=this._initialData;return this.hasEditedComment||this._hasBeenMoved||this._hasBeenResized||e.color.some((e,n)=>e!==t[n])||e.thickness!==n||e.opacity!==r||e.pageIndex!==i}renderAnnotationElement(e){if(this.deleted)return e.hide(),null;let{points:t,rect:n}=this.serializeDraw(!1);return e.updateEdited({rect:n,thickness:this._drawingOptions[`stroke-width`],points:t,popup:this.comment}),null}},su=class extends iu{toSVGPath(){let e=super.toSVGPath();return e.endsWith(`Z`)||(e+=`Z`),e}};ni();var cu=8,lu=3,uu=class{static#e={maxDim:512,sigmaSFactor:.02,sigmaR:25,kernelSize:16};static#t(e,t,n,r){return n-=e,r-=t,n===0?r>0?0:4:n===1?r+6:2-r}static#n=new Int32Array([0,1,-1,1,-1,0,-1,-1,0,-1,1,-1,1,0,1,1]);static#r(e,t,n,r,i,a,o){let s=this.#t(n,r,i,a);for(let i=0;i<8;i++){let a=(-i+s-o+16)%8,c=this.#n[2*a],l=this.#n[2*a+1];if(e[(n+c)*t+(r+l)]!==0)return a}return-1}static#i(e,t,n,r,i,a,o){let s=this.#t(n,r,i,a);for(let i=0;i<8;i++){let a=(i+s+o+16)%8,c=this.#n[2*a],l=this.#n[2*a+1];if(e[(n+c)*t+(r+l)]!==0)return a}return-1}static#a(e,t,n,r){let i=e.length,a=new Int32Array(i);for(let t=0;t<i;t++)a[t]=+(e[t]<=r);for(let e=1;e<n-1;e++)a[e*t]=a[e*t+t-1]=0;for(let e=0;e<t;e++)a[e]=a[t*n-1-e]=0;let o=1,s,c=[];for(let e=1;e<n-1;e++){s=1;for(let n=1;n<t-1;n++){let r=e*t+n,i=a[r];if(i===0)continue;let l=e,u=n;if(i===1&&a[r-1]===0)o+=1,--u;else if(i>=1&&a[r+1]===0)o+=1,u+=1,i>1&&(s=i);else{i!==1&&(s=Math.abs(i));continue}let d=[n,e],f=u===n+1,p={isHole:f,points:d,id:o,parent:0};c.push(p);let m;for(let e of c)if(e.id===s){m=e;break}p.parent=m?m.isHole?f?m.parent:s:f?s:m.parent:f?s:0;let h=this.#r(a,t,e,n,l,u,0);if(h===-1){a[r]=-o,a[r]!==1&&(s=Math.abs(a[r]));continue}let g=this.#n[2*h],_=this.#n[2*h+1],v=e+g,y=n+_;l=v,u=y;let b=e,x=n;for(;;){let i=this.#i(a,t,b,x,l,u,1);g=this.#n[2*i],_=this.#n[2*i+1];let c=b+g,f=x+_;d.push(f,c);let p=b*t+x;if(a[p+1]===0?a[p]=-o:a[p]===1&&(a[p]=o),c===e&&f===n&&b===v&&x===y){a[r]!==1&&(s=Math.abs(a[r]));break}l=b,u=x,b=c,x=f}}}return c}static#o(e,t,n,r){if(n-t<=4){for(let i=t;i<n-2;i+=2)r.push(e[i],e[i+1]);return}let i=e[t],a=e[t+1],o=e[n-4]-i,s=e[n-3]-a,c=Math.hypot(o,s),l=o/c,u=s/c,d=l*a-u*i,f=s/o,p=1/c,m=Math.atan(f),h=Math.cos(m),g=Math.sin(m),_=p*(Math.abs(h)+Math.abs(g)),v=p*(1-_+_**2),y=Math.max(Math.atan(Math.abs(g+h)*v),Math.atan(Math.abs(g-h)*v)),b=0,x=t;for(let r=t+2;r<n-2;r+=2){let t=Math.abs(d-l*e[r+1]+u*e[r]);t>b&&(x=r,b=t)}b>(c*y)**2?(this.#o(e,t,x+2,r),this.#o(e,x,n,r)):r.push(i,a)}static#s(e){let t=[],n=e.length;return this.#o(e,0,n,t),t.push(e[n-2],e[n-1]),t.length<=4?null:t}static#c(e,t,n,r,i,a){let o=new Float32Array(a**2),s=-2*r**2,c=a>>1;for(let e=0;e<a;e++){let t=(e-c)**2;for(let n=0;n<a;n++)o[e*a+n]=Math.exp((t+(n-c)**2)/s)}let l=new Float32Array(256),u=-2*i**2;for(let e=0;e<256;e++)l[e]=Math.exp(e**2/u);let d=e.length,f=new Uint8Array(d),p=new Uint32Array(256);for(let r=0;r<n;r++)for(let i=0;i<t;i++){let s=r*t+i,u=e[s],d=0,m=0;for(let s=0;s<a;s++){let f=r+s-c;if(!(f<0||f>=n))for(let n=0;n<a;n++){let r=i+n-c;if(r<0||r>=t)continue;let p=e[f*t+r],h=o[s*a+n]*l[Math.abs(p-u)];d+=p*h,m+=h}}let h=f[s]=Math.round(d/m);p[h]++}return[f,p]}static#l(e){let t=new Uint32Array(256);for(let n of e)t[n]++;return t}static#u(e){let t=e.length,n=new Uint8ClampedArray(t>>2),r=-1/0,i=1/0;for(let t=0,a=n.length;t<a;t++){let a=n[t]=e[t<<2];r=Math.max(r,a),i=Math.min(i,a)}let a=255/(r-i);for(let e=0,t=n.length;e<t;e++)n[e]=(n[e]-i)*a;return n}static#d(e){let t,n=-1/0,r=-1/0,i=e.findIndex(e=>e!==0),a=i,o=i;for(t=i;t<256;t++){let i=e[t];i>n&&(t-a>r&&(r=t-a,o=t-1),n=i,a=t)}for(t=o-1;t>=0&&!(e[t]>e[t+1]);t--);return t}static#f(e){let t=e,{width:n,height:r}=e,{maxDim:i}=this.#e,a=n,o=r;if(n>i||r>i){let s=n,c=r,l=Math.log2(Math.max(n,r)/i),u=Math.floor(l);l=l===u?u-1:u;for(let n=0;n<l;n++){a=Math.ceil(s/2),o=Math.ceil(c/2);let n=new OffscreenCanvas(a,o);n.getContext(`2d`).drawImage(e,0,0,s,c,0,0,a,o),s=a,c=o,e!==t&&e.close(),e=n.transferToImageBitmap()}let d=Math.min(i/a,i/o);a=Math.round(a*d),o=Math.round(o*d)}let s=new OffscreenCanvas(a,o).getContext(`2d`,{willReadFrequently:!0});s.fillStyle=`white`,s.fillRect(0,0,a,o),s.filter=`grayscale(1)`,s.drawImage(e,0,0,e.width,e.height,0,0,a,o);let c=s.getImageData(0,0,a,o).data;return[this.#u(c),a,o]}static extractContoursFromText(e,{fontFamily:t,fontStyle:n,fontWeight:r},i,a,o,s){let c=new OffscreenCanvas(1,1),l=c.getContext(`2d`,{alpha:!1}),u=l.font=`${n} ${r} 200px ${t}`,{actualBoundingBoxLeft:d,actualBoundingBoxRight:f,actualBoundingBoxAscent:p,actualBoundingBoxDescent:m,fontBoundingBoxAscent:h,fontBoundingBoxDescent:g,width:_}=l.measureText(e),v=1.5,y=Math.ceil(Math.max(Math.abs(d)+Math.abs(f)||0,_)*v),b=Math.ceil(Math.max(Math.abs(p)+Math.abs(m)||200,Math.abs(h)+Math.abs(g)||200)*v);c=new OffscreenCanvas(y,b),l=c.getContext(`2d`,{alpha:!0,willReadFrequently:!0}),l.font=u,l.filter=`grayscale(1)`,l.fillStyle=`white`,l.fillRect(0,0,y,b),l.fillStyle=`black`,l.fillText(e,y*.5/2,b*1.5/2);let x=this.#u(l.getImageData(0,0,y,b).data),S=this.#l(x),C=this.#d(S),w=this.#a(x,y,b,C);return this.processDrawnLines({lines:{curves:w,width:y,height:b},pageWidth:i,pageHeight:a,rotation:o,innerMargin:s,mustSmooth:!0,areContours:!0})}static process(e,t,n,r,i){let[a,o,s]=this.#f(e),[c,l]=this.#c(a,o,s,Math.hypot(o,s)*this.#e.sigmaSFactor,this.#e.sigmaR,this.#e.kernelSize),u=this.#d(l),d=this.#a(c,o,s,u);return this.processDrawnLines({lines:{curves:d,width:o,height:s},pageWidth:t,pageHeight:n,rotation:r,innerMargin:i,mustSmooth:!0,areContours:!0})}static processDrawnLines({lines:e,pageWidth:t,pageHeight:n,rotation:r,innerMargin:i,mustSmooth:a,areContours:o}){r%180!=0&&([t,n]=[n,t]);let{curves:s,width:c,height:l}=e,u=e.thickness??0,d=[],f=Math.min(t/c,n/l),p=f/t,m=f/n,h=[];for(let{points:e}of s){let t=a?this.#s(e):e;if(!t)continue;h.push(t);let n=t.length,r=new Float32Array(n),i=new Float32Array(3*(n===2?2:n-2));if(d.push({line:i,points:r}),n===2){r[0]=t[0]*p,r[1]=t[1]*m,i.set([NaN,NaN,NaN,NaN,r[0],r[1]],0);continue}let[o,s,c,l]=t;o*=p,s*=m,c*=p,l*=m,r.set([o,s,c,l],0),i.set([NaN,NaN,NaN,NaN,o,s],0);for(let e=4;e<n;e+=2){let n=r[e]=t[e]*p,a=r[e+1]=t[e+1]*m;i.set(W.createBezierPoints(o,s,c,l,n,a),(e-2)*3),[o,s,c,l]=[c,l,n,a]}}if(d.length===0)return null;let g=o?new su:new iu;return g.build(d,t,n,1,r,o?0:u,i),{outline:g,newCurves:h,areContours:o,thickness:u,width:c,height:l}}static async compressSignature({outlines:e,areContours:t,thickness:n,width:r,height:i}){let a=1/0,o=-1/0,s=0;for(let t of e){s+=t.length;for(let e=2,n=t.length;e<n;e++){let n=t[e]-t[e-2];a=Math.min(a,n),o=Math.max(o,n)}}let c;c=a>=-128&&o<=127?Int8Array:a>=-32768&&o<=32767?Int16Array:Int32Array;let l=e.length,u=cu+lu*l,d=new Uint32Array(u),f=0;d[f++]=u*Uint32Array.BYTES_PER_ELEMENT+(s-2*l)*c.BYTES_PER_ELEMENT,d[f++]=0,d[f++]=r,d[f++]=i,d[f++]=+!t,d[f++]=Math.max(0,Math.floor(n??0)),d[f++]=l,d[f++]=c.BYTES_PER_ELEMENT;for(let t of e)d[f++]=t.length-2,d[f++]=t[0],d[f++]=t[1];let p=new CompressionStream(`deflate-raw`),m=p.writable.getWriter();await m.ready,m.write(d);let h=c.prototype.constructor;for(let t of e){let e=new h(t.length-2);for(let n=2,r=t.length;n<r;n++)e[n-2]=t[n]-t[n-2];m.write(e)}return m.close(),(await new Response(p.readable).bytes()).toBase64()}static async decompressSignature(e){try{let t=Uint8Array.fromBase64(e),{readable:n,writable:r}=new DecompressionStream(`deflate-raw`),i=r.getWriter();await i.ready,i.write(t).then(async()=>{await i.ready,await i.close()}).catch(()=>{});let a=null,o=0;for await(let e of n)a||=new Uint8Array(new Uint32Array(e.buffer,0,4)[0]),a.set(e,o),o+=e.length;let s=new Uint32Array(a.buffer,0,a.length>>2),c=s[1];if(c!==0)throw Error(`Invalid version: ${c}`);let l=s[2],u=s[3],d=s[4]===0,f=s[5],p=s[6],m=s[7],h=[],g=(cu+lu*p)*Uint32Array.BYTES_PER_ELEMENT,_;switch(m){case Int8Array.BYTES_PER_ELEMENT:_=new Int8Array(a.buffer,g);break;case Int16Array.BYTES_PER_ELEMENT:_=new Int16Array(a.buffer,g);break;case Int32Array.BYTES_PER_ELEMENT:_=new Int32Array(a.buffer,g)}o=0;for(let e=0;e<p;e++){let t=s[lu*e+cu],n=new Float32Array(t+2);h.push(n);for(let t=0;t<2;t++)n[t]=s[lu*e+cu+t+1];for(let e=0;e<t;e++)n[e+2]=n[e]+_[o++]}return{areContours:d,thickness:f,outlines:h,width:l,height:u}}catch(e){return Fi(`decompressSignature: ${e}`),null}}},du=class e extends Wl{constructor(){super(),super.updateProperties({fill:co._defaultLineColor,"stroke-width":0})}clone(){let t=new e;return t.updateAll(this),t}},fu=class e extends au{constructor(e){super(e),super.updateProperties({stroke:co._defaultLineColor,"stroke-width":1})}clone(){let t=new e(this._viewParameters);return t.updateAll(this),t}},pu=class e extends Gl{#e=!1;#t=null;#n=null;#r=null;static _type=`signature`;static _editorType=bi.SIGNATURE;static _defaultDrawingOptions=null;constructor(e){super({...e,mustBeCommitted:!0,name:`signatureEditor`}),this._willKeepAspectRatio=!0,this.#n=e.signatureData||null,this.#t=null,this.defaultL10nId=`pdfjs-editor-signature-editor1`}static initialize(e,t){co.initialize(e,t),this._defaultDrawingOptions=new du,this._defaultDrawnSignatureOptions=new fu(t.viewParameters)}static getDefaultDrawingOptions(e){let t=this._defaultDrawingOptions.clone();return t.updateProperties(e),t}static get supportMultipleDrawings(){return!1}static get typesMap(){return H(this,`typesMap`,new Map)}static get isDrawer(){return!1}get telemetryFinalData(){return{type:`signature`,hasDescription:!!this.#t}}static computeTelemetryFinalData(e){let t=e.get(`hasDescription`);return{hasAltText:t.get(!0)??0,hasNoAltText:t.get(!1)??0}}get isResizable(){return!0}onScaleChanging(){this._drawId!==null&&super.onScaleChanging()}render(){if(this.div)return this.div;let t,n,{_isCopy:r}=this;if(r&&(this._isCopy=!1,t=this.x,n=this.y),super.render(),this._drawId===null){if(this.#n){let{lines:t,mustSmooth:n,areContours:r,description:i,uuid:a,heightInPage:o}=this.#n,{rawDims:{pageWidth:s,pageHeight:c},rotation:l}=this.parent.viewport,u=uu.processDrawnLines({lines:t,pageWidth:s,pageHeight:c,rotation:l,innerMargin:e._INNER_MARGIN,mustSmooth:n,areContours:r});this.addSignature(u,o,i,a)}else this.div.setAttribute(`data-l10n-args`,JSON.stringify({description:``})),this.div.hidden=!0,this._uiManager.getSignature(this)}else this.div.setAttribute(`data-l10n-args`,JSON.stringify({description:this.#t||``}));return r&&(this._isCopy=!0,this._moveAfterPaste(t,n)),this.div}setUuid(e){this.#r=e,this.addEditToolbar()}getUuid(){return this.#r}get description(){return this.#t}set description(e){this.#t=e,this.div&&(this.div.setAttribute(`data-l10n-args`,JSON.stringify({description:e})),super.addEditToolbar().then(t=>{t?.updateEditSignatureButton(e)}))}getSignaturePreview(){let{newCurves:e,areContours:t,thickness:n,width:r,height:i}=this.#n,a=Math.max(r,i);return{areContours:t,outline:uu.processDrawnLines({lines:{curves:e.map(e=>({points:e})),thickness:n,width:r,height:i},pageWidth:a,pageHeight:a,rotation:0,innerMargin:0,mustSmooth:!1,areContours:t}).outline}}get toolbarButtons(){return this._uiManager.signatureManager?[[`editSignature`,this._uiManager.signatureManager]]:super.toolbarButtons}addSignature(t,n,r,i){let{x:a,y:o}=this,{outline:s}=this.#n=t;this.#e=s instanceof su,this.description=r;let c;this.#e?c=e.getDefaultDrawingOptions():(c=e._defaultDrawnSignatureOptions.clone(),c.updateProperties({"stroke-width":s.thickness})),this._addOutlines({drawOutlines:s,drawingOptions:c});let[,l]=this.pageDimensions,u=n/l;u=u>=1?.5:u,this.width*=u/this.height,this.width>=1&&(u*=.9/this.width,this.width=.9),this.height=u,this.setDims(),this.x=a,this.y=o,this.center(),this._onResized(),this.onScaleChanging(),this.rotate(),this._uiManager.addToAnnotationStorage(this),this.setUuid(i),this._reportTelemetry({action:`pdfjs.signature.inserted`,data:{hasBeenSaved:!!i,hasDescription:!!r}}),this.div.hidden=!1}getFromImage(t){let{rawDims:{pageWidth:n,pageHeight:r},rotation:i}=this.parent.viewport;return uu.process(t,n,r,i,e._INNER_MARGIN)}getFromText(t,n){let{rawDims:{pageWidth:r,pageHeight:i},rotation:a}=this.parent.viewport;return uu.extractContoursFromText(t,n,r,i,a,e._INNER_MARGIN)}getDrawnSignature(t){let{rawDims:{pageWidth:n,pageHeight:r},rotation:i}=this.parent.viewport;return uu.processDrawnLines({lines:t,pageWidth:n,pageHeight:r,rotation:i,innerMargin:e._INNER_MARGIN,mustSmooth:!1,areContours:!1})}createDrawingOptions({areContours:t,thickness:n}){t?this._drawingOptions=e.getDefaultDrawingOptions():(this._drawingOptions=e._defaultDrawnSignatureOptions.clone(),this._drawingOptions.updateProperties({"stroke-width":n}))}serialize(e=!1){if(this.isEmpty())return null;let{lines:t,points:n}=this.serializeDraw(e),{_drawingOptions:{"stroke-width":r}}=this,i=Object.assign(super.serialize(e),{isSignature:!0,areContours:this.#e,color:[0,0,0],thickness:this.#e?0:r});return this.addComment(i),e?(i.paths={lines:t,points:n},i.uuid=this.#r,i.isCopy=!0):i.lines=t,this.#t&&(i.accessibilityData={type:`Figure`,alt:this.#t}),i}static deserializeDraw(e,t,n,r,i,a){return a.areContours?su.deserialize(e,t,n,r,i,a):iu.deserialize(e,t,n,r,i,a)}static async deserialize(e,t,n){let r=await super.deserialize(e,t,n);return r.#e=e.areContours,r.description=e.accessibilityData?.alt||``,r.#r=e.uuid,r}},mu=class extends co{#e=null;#t=null;#n=null;#r=null;#i=null;#a=``;#o=null;#s=!1;#c=null;#l=!1;#u=!1;static _type=`stamp`;static _editorType=bi.STAMP;constructor(e){super({...e,name:`stampEditor`}),this.#r=e.bitmapUrl,this.#i=e.bitmapFile,this.defaultL10nId=`pdfjs-editor-stamp-editor`}static initialize(e,t){co.initialize(e,t)}static isHandlingMimeForPasting(e){return Na.has(e)}static paste(e,t){t.pasteEditor({mode:bi.STAMP},{bitmapFile:e.getAsFile()})}altTextFinish(){this._uiManager.useNewAltTextFlow&&(this.div.hidden=!1),super.altTextFinish()}get telemetryFinalData(){return{type:`stamp`,hasAltText:!!this.altTextData?.altText}}static computeTelemetryFinalData(e){let t=e.get(`hasAltText`);return{hasAltText:t.get(!0)??0,hasNoAltText:t.get(!1)??0}}#d(e,t=!1){e?(this.#e=e.bitmap,t||(this.#t=e.id,this.#l=e.isSvg),e.file&&(this.#a=e.file.name),this.#m()):this.remove()}#f(){if(this.#n=null,this._uiManager.enableWaiting(!1),this.#o){if(this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&this.#e)this.addEditToolbar().then(()=>{this._editToolbar.hide(),this._uiManager.editAltText(this,!0)});else{if(!this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&this.#e){this._reportTelemetry({action:`pdfjs.image.image_added`,data:{alt_text_modal:!1,alt_text_type:`empty`}});try{this.mlGuessAltText()}catch{}}this.div.focus()}}}async mlGuessAltText(e=null,t=!0){if(this.hasAltTextData())return null;let{mlManager:n}=this._uiManager;if(!n)throw Error(`No ML.`);if(!await n.isEnabledFor(`altText`))throw Error(`ML isn't enabled for alt text.`);let{data:r,width:i,height:a}=e||this.copyCanvas(null,null,!0).imageData,o=await n.guess({name:`altText`,request:{data:r,width:i,height:a,channels:r.length/(i*a)}});if(!o)throw Error(`No response from the AI service.`);if(o.error)throw Error(`Error from the AI service.`);if(o.cancel)return null;if(!o.output)throw Error(`No valid response from the AI service.`);let s=o.output;return await this.setGuessedAltText(s),t&&!this.hasAltTextData()&&(this.altTextData={alt:s,decorative:!1}),s}#p(){if(this.#t){this._uiManager.enableWaiting(!0),this._uiManager.imageManager.getFromId(this.#t).then(e=>this.#d(e,!0)).finally(()=>this.#f());return}if(this.#r){let e=this.#r;this.#r=null,this._uiManager.enableWaiting(!0),this.#n=this._uiManager.imageManager.getFromUrl(e).then(e=>this.#d(e)).finally(()=>this.#f());return}if(this.#i){let e=this.#i;this.#i=null,this._uiManager.enableWaiting(!0),this.#n=this._uiManager.imageManager.getFromFile(e).then(e=>this.#d(e)).finally(()=>this.#f());return}let e=document.createElement(`input`);e.type=`file`,e.accept=Na.keys().join(`,`);let t=this._uiManager._signal;this.#n=new Promise(n=>{e.addEventListener(`change`,async()=>{if(!e.files||e.files.length===0)this.remove();else{this._uiManager.enableWaiting(!0);let t=await this._uiManager.imageManager.getFromFile(e.files[0]);this._reportTelemetry({action:`pdfjs.image.image_selected`,data:{alt_text_modal:this._uiManager.useNewAltTextFlow}}),this.#d(t)}n()},{signal:t}),e.addEventListener(`cancel`,()=>{this.remove(),n()},{signal:t})}).finally(()=>this.#f()),e.click()}remove(){this.#t&&(this.#e=null,this._uiManager.imageManager.deleteId(this.#t),this.#o?.remove(),this.#o=null,this.#c&&=(clearTimeout(this.#c),null)),super.remove()}rebuild(){this.parent?(super.rebuild(),this.div!==null&&(this.#t&&this.#o===null&&this.#p(),this.isAttachedToDOM||this.parent.add(this))):this.#t&&this.#p()}onceAdded(e){this._isDraggable=!0,e&&this.div.focus()}isEmpty(){return!(this.#n||this.#e||this.#r||this.#i||this.#t||this.#s)}get toolbarButtons(){return[[`altText`,this.createAltText()]]}get isResizable(){return!0}render(){if(this.div)return this.div;let e,t;return this._isCopy&&(e=this.x,t=this.y),super.render(),this.div.hidden=!0,this.createAltText(),this.#s||(this.#e?this.#m():this.#p()),this._isCopy&&this._moveAfterPaste(e,t),this._uiManager.addShouldRescale(this),this.div}setCanvas(e,t){let{id:n,bitmap:r}=this._uiManager.imageManager.getFromCanvas(e,t);t.remove(),n&&this._uiManager.imageManager.isValidId(n)&&(this.#t=n,r&&(this.#e=r),this.#s=!1,this.#m())}_onResized(){this.onScaleChanging()}onScaleChanging(){this.parent&&(this.#c!==null&&clearTimeout(this.#c),this.#c=setTimeout(()=>{this.#c=null,this.#g()},200))}#m(){let{div:e}=this,{width:t,height:n}=this.#e,[r,i]=this.pageDimensions,a=.75;if(this.width)t=this.width*r,n=this.height*i;else if(t>a*r||n>a*i){let e=Math.min(a*r/t,a*i/n);t*=e,n*=e}this._uiManager.enableWaiting(!1);let o=this.#o=document.createElement(`canvas`);o.setAttribute(`role`,`img`),this.addContainer(o),this.width=t/r,this.height=n/i,this.setDims(),this._initialOptions?.isCentered?this.center():this.fixAndSetPosition(),this._initialOptions=null,this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&!this.annotationElementId||(e.hidden=!1),this.#g(),this.#u||=(this.parent.addUndoableEditor(this),!0),this._reportTelemetry({action:`inserted_image`}),this.#a&&this.div.setAttribute(`aria-description`,this.#a),this.annotationElementId||this._uiManager.a11yAlert(co._l10nAlert.stamp)}copyCanvas(e,t,n=!1){e||=224;let{width:r,height:i}=this.#e,a=new Ma,o=this.#e,s=r,c=i,l=null;if(t){if(r>t||i>t){let e=Math.min(t/r,t/i);s=Math.floor(r*e),c=Math.floor(i*e)}l=document.createElement(`canvas`);let e=l.width=Math.ceil(s*a.sx),n=l.height=Math.ceil(c*a.sy);this.#l||(o=this.#h(e,n));let u=l.getContext(`2d`);u.filter=this._uiManager.hcmFilter;let d=`white`,f=`#cfcfd8`;this._uiManager.hcmFilter===`none`?Pa.isDarkMode&&(d=`#8f8f9d`,f=`#42414d`):f=`black`;let p=15*a.sx,m=15*a.sy,h=new OffscreenCanvas(p*2,m*2),g=h.getContext(`2d`);g.fillStyle=d,g.fillRect(0,0,p*2,m*2),g.fillStyle=f,g.fillRect(0,0,p,m),g.fillRect(p,m,p,m),u.fillStyle=u.createPattern(h,`repeat`),u.fillRect(0,0,e,n),u.drawImage(o,0,0,o.width,o.height,0,0,e,n)}let u=null;if(n){let t,n;if(a.symmetric&&o.width<e&&o.height<e)t=o.width,n=o.height;else if(o=this.#e,r>e||i>e){let a=Math.min(e/r,e/i);t=Math.floor(r*a),n=Math.floor(i*a),this.#l||(o=this.#h(t,n))}let s=new OffscreenCanvas(t,n).getContext(`2d`,{willReadFrequently:!0});s.drawImage(o,0,0,o.width,o.height,0,0,t,n),u={width:t,height:n,data:s.getImageData(0,0,t,n).data}}return{canvas:l,width:s,height:c,imageData:u}}#h(e,t){let{width:n,height:r}=this.#e,i=n,a=r,o=this.#e;for(;i>2*e||a>2*t;){let n=i,r=a;i>2*e&&(i=Math.ceil(i/2)),a>2*t&&(a=Math.ceil(a/2));let s=new OffscreenCanvas(i,a);s.getContext(`2d`).drawImage(o,0,0,n,r,0,0,i,a),o=s.transferToImageBitmap()}return o}#g(){let[e,t]=this.parentDimensions,{width:n,height:r}=this,i=new Ma,a=Math.ceil(n*e*i.sx),o=Math.ceil(r*t*i.sy),s=this.#o;if(!s||s.width===a&&s.height===o)return;s.width=a,s.height=o;let c=this.#l?this.#e:this.#h(a,o),l=s.getContext(`2d`);l.filter=this._uiManager.hcmFilter,l.drawImage(c,0,0,c.width,c.height,0,0,a,o)}#_(e){if(e){if(this.#l){let e=this._uiManager.imageManager.getSvgUrl(this.#t);if(e)return e}let e=document.createElement(`canvas`);return{width:e.width,height:e.height}=this.#e,e.getContext(`2d`).drawImage(this.#e,0,0),e.toDataURL()}if(this.#l){let[e,t]=this.pageDimensions,n=Math.round(this.width*e*ma.PDF_TO_CSS_UNITS),r=Math.round(this.height*t*ma.PDF_TO_CSS_UNITS),i=new OffscreenCanvas(n,r);return i.getContext(`2d`).drawImage(this.#e,0,0,this.#e.width,this.#e.height,0,0,n,r),i.transferToImageBitmap()}return structuredClone(this.#e)}static async deserialize(e,t,n){let r=null,i=!1;if(e instanceof Rl){let{data:{rect:a,rotation:o,id:s,structParent:c,popupRef:l,richText:u,contentsObj:d,creationDate:f,modificationDate:p},container:m,parent:{page:{pageNumber:h}},canvas:g}=e,_,v;g?(delete e.canvas,{id:_,bitmap:v}=n.imageManager.getFromCanvas(m.id,g),g.remove()):(i=!0,e._hasNoCanvas=!0);let y=(await t._structTree.getAriaAttributes(`${vi}${s}`))?.get(`aria-label`)||``;r=e={annotationType:bi.STAMP,bitmapId:_,bitmap:v,pageIndex:h-1,rect:a.slice(0),rotation:o,annotationElementId:s,id:s,deleted:!1,accessibilityData:{decorative:!1,altText:y},isSvg:!1,structParent:c,popupRef:l,richText:u,comment:d?.str||null,creationDate:f,modificationDate:p}}let a=await super.deserialize(e,t,n),{rect:o,bitmap:s,bitmapUrl:c,bitmapId:l,isSvg:u,accessibilityData:d}=e;i?(n.addMissingCanvas(e.id,a),a.#s=!0):l&&n.imageManager.isValidId(l)?(a.#t=l,s&&(a.#e=s)):a.#r=c,a.#l=u;let[f,p]=a.pageDimensions;return a.width=(o[2]-o[0])/f,a.height=(o[3]-o[1])/p,d&&(a.altTextData=d),a._initialData=r,e.comment&&a.setCommentData(e),a.#u=!!r,a}serialize(e=!1,t=null){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();let n=Object.assign(super.serialize(e),{bitmapId:this.#t,isSvg:this.#l});if(this.addComment(n),e)return n.bitmapUrl=this.#_(!0),n.accessibilityData=this.serializeAltText(!0),n.isCopy=!0,n;let{decorative:r,altText:i}=this.serializeAltText(!1);if(!r&&i&&(n.accessibilityData={type:`Figure`,alt:i}),this.annotationElementId){let e=this.#v(n);return e.isSame?null:(e.isSameAltText?delete n.accessibilityData:n.accessibilityData.structParent=this._initialData.structParent??-1,n.id=this.annotationElementId,delete n.bitmapId,n)}if(t===null)return n;t.stamps||=new Map;let a=this.#l?(n.rect[2]-n.rect[0])*(n.rect[3]-n.rect[1]):null;if(!t.stamps.has(this.#t))t.stamps.set(this.#t,{area:a,serialized:n}),n.bitmap=this.#_(!1);else if(this.#l){let e=t.stamps.get(this.#t);a>e.area&&(e.area=a,e.serialized.bitmap.close(),e.serialized.bitmap=this.#_(!1))}return n}#v(e){let{pageIndex:t,accessibilityData:{altText:n}}=this._initialData,r=e.pageIndex===t,i=(e.accessibilityData?.alt||``)===n;return{isSame:!this.hasEditedComment&&!this._hasBeenMoved&&!this._hasBeenResized&&r&&i,isSameAltText:i}}renderAnnotationElement(e){return this.deleted?(e.hide(),null):(e.updateEdited({rect:this.getPDFRect(),popup:this.comment}),null)}},hu=class e{#e;#t=!1;#n=null;#r=null;#i=null;#a=new Map;#o=!1;#s=!1;#c=!1;#l=null;#u=null;#d=null;#f=null;#p=null;#m=-1;#h;static _initialized=!1;static#g=new Map([Ul,ou,mu,nu,pu].map(e=>[e._editorType,e]));constructor({uiManager:t,pageIndex:n,div:r,structTreeLayer:i,accessibilityManager:a,annotationLayer:o,drawLayer:s,textLayer:c,viewport:l,l10n:u}){let d=[...e.#g.values()];if(!e._initialized){e._initialized=!0;for(let e of d)e.initialize(u,t)}t.registerEditorTypes(d),this.#h=t,this.pageIndex=n,this.div=r,this.#e=a,this.#n=o,this.viewport=l,this.#d=c,this.drawLayer=s,this._structTree=i,this.#h.addLayer(this)}get isEmpty(){return this.#a.size===0}get isInvisible(){return this.isEmpty&&this.#h.getMode()===bi.NONE}updateToolbar(e){this.#h.updateToolbar(e)}updateMode(t=this.#h.getMode()){switch(this.#S(),t){case bi.NONE:this.div.classList.toggle(`nonEditing`,!0),this.disableTextSelection(),this.togglePointerEvents(!1),this.toggleAnnotationLayerPointerEvents(!0),this.disableClick();return;case bi.INK:this.disableTextSelection(),this.togglePointerEvents(!0),this.enableClick();break;case bi.HIGHLIGHT:this.enableTextSelection(),this.togglePointerEvents(!1),this.disableClick();break;default:this.disableTextSelection(),this.togglePointerEvents(!0),this.enableClick()}this.toggleAnnotationLayerPointerEvents(!1);let{classList:n}=this.div;if(n.toggle(`nonEditing`,!1),t===bi.POPUP)n.toggle(`commentEditing`,!0);else{n.toggle(`commentEditing`,!1);for(let r of e.#g.values())n.toggle(`${r._type}Editing`,t===r._editorType)}this.div.hidden=!1}hasTextLayer(e){return e===this.#d?.div}setEditingState(e){this.#h.setEditingState(e)}addCommands(e){this.#h.addCommands(e)}cleanUndoStack(e){this.#h.cleanUndoStack(e)}toggleDrawing(e=!1){this.div.classList.toggle(`drawing`,!e)}togglePointerEvents(e=!1){this.div.classList.toggle(`disabled`,!e)}toggleAnnotationLayerPointerEvents(e=!1){this.#n?.togglePointerEvents(e)}get#_(){return this.#a.size===0?this.#h.getEditors(this.pageIndex):this.#a.values()}async enable(){this.#c=!0,this.div.tabIndex=0,this.togglePointerEvents(!0),this.div.classList.toggle(`nonEditing`,!1),this.#p?.abort(),this.#p=null;let e=new Set;for(let t of this.#_)t.enableEditing(),t.show(!0),t.annotationElementId&&(this.#h.removeChangedExistingAnnotation(t),e.add(t.annotationElementId));let t=this.#n;if(t)for(let n of t.getEditableAnnotations()){if(n.hide(),this.#h.isDeletedAnnotationElement(n.data.id)||e.has(n.data.id))continue;let t=await this.deserialize(n);t&&(this.addOrRebuild(t),t.enableEditing())}this.#c=!1,this.#h._eventBus.dispatch(`editorsrendered`,{source:this,pageNumber:this.pageIndex+1})}disable(){if(this.#s=!0,this.div.tabIndex=-1,this.togglePointerEvents(!1),this.div.classList.toggle(`nonEditing`,!0),this.#d&&!this.#p){this.#p=new AbortController;let e=this.#h.combinedSignal(this.#p);this.#d.div.addEventListener(`pointerdown`,e=>{let{clientX:t,clientY:n,timeStamp:r}=e;if(r-this.#m>500){this.#m=r;return}this.#m=-1;let{classList:i}=this.div;i.toggle(`getElements`,!0);let a=document.elementsFromPoint(t,n);if(i.toggle(`getElements`,!1),!this.div.contains(a[0]))return;let o,s=RegExp(`^${yi}[0-9]+$`);for(let e of a)if(s.test(e.id)){o=e.id;break}if(!o)return;let c=this.#a.get(o);c?.annotationElementId===null&&(wa(e),c.dblclick(e))},{signal:e,capture:!0})}let t=this.#n,n=[];if(t){let e=new Map,r=new Map;for(let t of this.#_)t.disableEditing(),t.annotationElementId?t.serialize()===null?(r.set(t.annotationElementId,t),this.getEditableAnnotation(t.annotationElementId)?.show(),t.remove()):e.set(t.annotationElementId,t):n.push(t);for(let n of t.getEditableAnnotations()){let{id:t}=n.data;if(this.#h.isDeletedAnnotationElement(t)){n.updateEdited({deleted:!0});continue}let i=r.get(t);i?(i.resetAnnotationElement(n),i.show(!1),n.show()):(i=e.get(t),i&&(this.#h.addChangedExistingAnnotation(i),i.renderAnnotationElement(n)&&i.show(!1)),n.show())}}this.#S(),this.isEmpty&&(this.div.hidden=!0);let{classList:r}=this.div;for(let t of e.#g.values())r.remove(`${t._type}Editing`);this.disableTextSelection(),this.toggleAnnotationLayerPointerEvents(!0),t?.updateFakeAnnotations(n),this.#s=!1}getEditableAnnotation(e){return this.#n?.getEditableAnnotation(e)||null}setActiveEditor(e){this.#h.getActive()!==e&&this.#h.setActiveEditor(e)}enableTextSelection(){if(this.div.tabIndex=-1,this.#d?.div&&!this.#f){this.#f=new AbortController;let e=this.#h.combinedSignal(this.#f);this.#d.div.addEventListener(`pointerdown`,this.#v.bind(this),{signal:e}),this.#d.div.classList.add(`highlighting`)}}disableTextSelection(){this.div.tabIndex=0,this.#d?.div&&this.#f&&(this.#f.abort(),this.#f=null,this.#d.div.classList.remove(`highlighting`))}#v(e){this.#h.unselectAll();let{target:t}=e;if(t===this.#d.div||(t.getAttribute(`role`)===`img`||t.classList.contains(`endOfContent`)||t.classList.contains(`textLayerImages`)||t.classList.contains(`textLayerImagePlaceholder`))&&this.#d.div.contains(t)){let{isMac:t}=Zi.platform;if(e.button!==0||e.ctrlKey&&t)return;this.#h.showAllEditors(`highlight`,!0,!0),nu.startDrawing(this,this.#h,this.#h.direction===`ltr`,e),e.preventDefault()}}enableClick(){if(this.#r)return;this.#r=new AbortController;let e=this.#h.combinedSignal(this.#r);this.div.addEventListener(`pointerdown`,this.pointerdown.bind(this),{signal:e});let t=this.pointerup.bind(this);this.div.addEventListener(`pointerup`,t,{signal:e}),this.div.addEventListener(`pointercancel`,t,{signal:e})}disableClick(){this.#r?.abort(),this.#r=null}attach(e){this.#a.set(e.id,e);let{annotationElementId:t}=e;t&&this.#h.isDeletedAnnotationElement(t)&&this.#h.removeDeletedAnnotationElement(e)}detach(e){this.#a.delete(e.id),this.#e?.removePointerInTextLayer(e.contentDiv),!this.#s&&e.annotationElementId&&this.#h.addDeletedAnnotationElement(e)}remove(e){this.detach(e),this.#h.removeEditor(e),e.div.remove(),e.isAttachedToDOM=!1}changeParent(e){e.parent!==this&&(e.parent&&e.annotationElementId&&(this.#h.addDeletedAnnotationElement(e),co.deleteAnnotationElement(e),e.annotationElementId=null),this.attach(e),e.parent?.detach(e),e.setParent(this),e.div&&e.isAttachedToDOM&&(e.div.remove(),this.div.append(e.div)))}add(e){if(!(e.parent===this&&e.isAttachedToDOM)){if(this.changeParent(e),this.#h.addEditor(e),this.attach(e),!e.isAttachedToDOM){let t=e.render();this.div.append(t),e.isAttachedToDOM=!0}e.fixAndSetPosition(),e.onceAdded(!this.#c),this.#h.addToAnnotationStorage(e),e._reportTelemetry(e.telemetryInitialData)}}moveEditorInDOM(e){if(!e.isAttachedToDOM)return;let{activeElement:t}=document;e.div.contains(t)&&!this.#i&&(e._focusEventsAllowed=!1,this.#i=setTimeout(()=>{this.#i=null,e.div.contains(document.activeElement)?e._focusEventsAllowed=!0:(e.div.addEventListener(`focusin`,()=>{e._focusEventsAllowed=!0},{once:!0,signal:this.#h._signal}),t.focus())},0)),e._structTreeParentId=this.#e?.moveElementInDOM(this.div,e.div,e.contentDiv,!0)}addOrRebuild(e){e.needsToBeRebuilt()?(e.parent||=this,e.rebuild(),e.show()):this.add(e)}addUndoableEditor(e){this.addCommands({cmd:()=>e._uiManager.rebuild(e),undo:()=>{e.remove()},mustExec:!1})}getEditorByUID(e){for(let t of this.#a.values())if(t.uid===e)return t;return null}get#y(){return e.#g.get(this.#h.getMode())}combinedSignal(e){return this.#h.combinedSignal(e)}#b(e){let t=this.#y;return t?new t.prototype.constructor(e):null}canCreateNewEmptyEditor(){return this.#y?.canCreateNewEmptyEditor()}async pasteEditor(e,t){this.updateToolbar(e),await this.#h.updateMode(e.mode);let{offsetX:n,offsetY:r}=this.#x(),i=this.#h.getId(),a=this.#b({parent:this,id:i,x:n,y:r,uiManager:this.#h,isCentered:!0,...t});a&&this.add(a)}async deserialize(t){return await e.#g.get(t.annotationType??t.annotationEditorType)?.deserialize(t,this,this.#h)||null}createAndAddNewEditor(e,t,n={}){let r=this.#h.getId(),i=this.#b({parent:this,id:r,x:e.offsetX,y:e.offsetY,uiManager:this.#h,isCentered:t,...n});return i&&this.add(i),i}get boundingClientRect(){return this.div.getBoundingClientRect()}#x(){let{x:e,y:t,width:n,height:r}=this.boundingClientRect,i=Math.max(0,e),a=Math.max(0,t),o=Math.min(window.innerWidth,e+n),s=Math.min(window.innerHeight,t+r),c=(i+o)/2-e,l=(a+s)/2-t,[u,d]=this.viewport.rotation%180==0?[c,l]:[l,c];return{offsetX:u,offsetY:d}}addNewEditor(e={}){this.createAndAddNewEditor(this.#x(),!0,e)}setSelected(e){this.#h.setSelected(e)}toggleSelected(e){this.#h.toggleSelected(e)}unselect(e){this.#h.unselect(e)}pointerup(e){let{isMac:t}=Zi.platform;if(e.button!==0||e.ctrlKey&&t||e.target!==this.div||!this.#o||(this.#o=!1,this.#y?.isDrawer&&this.#y.supportMultipleDrawings))return;if(!this.#t){this.#t=!0;return}let n=this.#h.getMode();n===bi.STAMP||n===bi.POPUP||n===bi.SIGNATURE?this.#h.unselectAll():this.createAndAddNewEditor(e,!1)}pointerdown(e){if(this.#h.getMode()===bi.HIGHLIGHT&&this.enableTextSelection(),this.#o){this.#o=!1;return}let{isMac:t}=Zi.platform;if(e.button!==0||e.ctrlKey&&t||e.target!==this.div)return;if(this.#o=!0,this.#y?.isDrawer){this.startDrawingSession(e);return}let n=this.#h.getActive();this.#t=!n||n.isEmpty()}startDrawingSession(e){if(this.div.focus({preventScroll:!0}),this.#l){this.#y.startDrawing(this,this.#h,!1,e);return}this.#h.setCurrentDrawingSession(this),this.#l=new AbortController;let t=this.#h.combinedSignal(this.#l);this.div.addEventListener(`blur`,({relatedTarget:e})=>{e&&!this.div.contains(e)&&(this.#u=null,this.commitOrRemove())},{signal:t}),this.#y.startDrawing(this,this.#h,!1,e)}pause(e){if(e){let{activeElement:e}=document;this.div.contains(e)&&(this.#u=e)}else this.#u&&setTimeout(()=>{this.#u?.focus(),this.#u=null},0)}endDrawingSession(e=!1){return this.#l?(this.#h.setCurrentDrawingSession(null),this.#l.abort(),this.#l=null,this.#u=null,this.#y.endDrawing(e)):null}findNewParent(e,t,n){let r=this.#h.findParent(t,n);return r===null||r===this?!1:(r.changeParent(e),!0)}commitOrRemove(){return this.#l?(this.endDrawingSession(),!0):!1}onScaleChanging(){this.#l&&this.#y.onScaleChangingWhenDrawing(this)}destroy(){this.commitOrRemove(),this.#h.getActive()?.parent===this&&(this.#h.commitOrRemove(),this.#h.setActiveEditor(null)),this.#i&&=(clearTimeout(this.#i),null);for(let e of this.#a.values())this.#e?.removePointerInTextLayer(e.contentDiv),e.setParent(null),e.isAttachedToDOM=!1,e.div.remove();this.div=null,this.#a.clear(),this.#h.removeLayer(this)}#S(){for(let e of this.#a.values())e.isEmpty()&&e.remove()}async render({viewport:e}){this.viewport=e,ja(this.div,e);for(let e of this.#h.getEditors(this.pageIndex))this.add(e),e.rebuild();await this.#h.findClonesForPage(this),this.div.hidden=this.isEmpty,this.updateMode()}update({viewport:e}){this.#h.commitOrRemove(),this.#S();let t=this.viewport.rotation,n=e.rotation;if(this.viewport=e,ja(this.div,{rotation:n}),t!==n)for(let e of this.#a.values())e.rotate(n)}get pageDimensions(){let{pageWidth:e,pageHeight:t}=this.viewport.rawDims;return[e,t]}get scale(){return this.#h.viewParameters.realScale}};Vr();function gu(e,t){return e===t?0:e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1}function _u(e){return e?e.nodeType===Node.ELEMENT_NODE?e.closest(`.textLayer`):e.parentElement?.closest(`.textLayer`)||null:null}function vu(e,t,n,r){if(e===n)return t<=r;let i=e.compareDocumentPosition(n);return i&Node.DOCUMENT_POSITION_FOLLOWING?!0:i&Node.DOCUMENT_POSITION_PRECEDING?!1:null}function yu(e,t,n){if(e.nodeType!==Node.ELEMENT_NODE||!e.classList.contains(`textLayer`)||t!==e.childNodes.length)return{container:e,offset:t};let r=e.lastChild;return r?.nodeType===Node.ELEMENT_NODE&&r.classList.contains(`endOfContent`)&&(r=r.previousSibling),!r||!n.contains(r)?null:r.nodeType===Node.TEXT_NODE?{container:r,offset:r.textContent.length}:{container:r,offset:r.childNodes.length}}var bu=class e{#e=null;#t=new Map;#n=null;#r=null;#i=null;#a=null;#o=new Map;static#s=0;static#c=0;static#l=null;static#u=new Set;static#d=!1;static#f=new Set;static#p=new WeakMap;constructor({filterFactory:t=null,pageColors:n=null,pageIndex:r,textLayer:i=null}){if(this.pageIndex=r,this.#r=t,this.#i=n,i){let t=e.#p.get(i);if(t?.selectionDiv&&(t.selectionDiv.remove(),e.#u.delete(t.selectionDiv)),e.#p.set(i,{drawLayer:this}),e.#f.add(i),this.#n=i,this.#a=new MutationObserver(t=>{if(this.#e&&this.#n?.isConnected&&e.#h()){for(let{addedNodes:n}of t)for(let t of n)if(t.nodeType===Node.ELEMENT_NODE&&t.classList.contains(`endOfContent`)){e.#_();return}}}),this.#a.observe(i,{childList:!0}),e.#l===null){e.#l=new AbortController;let{signal:t}=e.#l;document.addEventListener(`selectionchange`,e.#_.bind(e),{signal:t}),document.addEventListener(`pointerdown`,()=>{e.#d=!0},{signal:t}),document.addEventListener(`pointerup`,()=>{e.#d=!1},{signal:t}),window.addEventListener(`blur`,()=>{e.#d=!1},{signal:t})}}}setParent(t){if(!this.#e)this.#e=t,this.#n?.isConnected&&e.#h()&&e.#_();else if(this.#e!==t){if(this.#t.size>0)for(let e of this.#t.values())e.remove(),t.append(e);this.#e=t}}static#m(e){let t=this.#p.get(e);t?.selectionDiv&&(t.selectionDiv.remove(),this.#u.delete(t.selectionDiv),t.selectionDiv=null,t.path=null)}static#h(){let e=document.getSelection();return!!e&&!e.isCollapsed}static#g(){return this.#f.keys().filter(e=>e.isConnected).toArray().sort(gu)}static#_(){let t=document.getSelection();if(!t||t.isCollapsed){for(let e of this.#u)e.remove();this.#u.clear();return}let n=new WeakMap,r=this.#g(),i=[];for(let e=0,n=t.rangeCount;e<n;e++){let n=t.getRangeAt(e);if(n.collapsed)continue;let{startContainer:a,startOffset:o,endContainer:s,endOffset:c}=n,l=_u(a),u=_u(s),d=l===null,f=u===null;if(this.#d&&d!==f)return;if(t.rangeCount===1){let{anchorNode:e,anchorOffset:n,focusNode:r,focusOffset:i}=t,d=_u(e),f=_u(r),p=vu(e,n,r,i);d&&f&&p!==null&&(p?(a=e,o=n,l=d,s=r,c=i,u=f):(a=r,o=i,l=f,s=e,c=n,u=d))}let p=r.filter(e=>n.intersectsNode(e));if(p.length===0)continue;let m=!1;if(l||(l=p[0],a=l,o=0,m=!0),u||(u=p.at(-1),s=u,c=u.childNodes.length,m=!0),s.nodeType===Node.ELEMENT_NODE){if(s.classList.contains(`endOfContent`)){let e=s.previousSibling;if(!e)continue;s=e,c=e.nodeType===Node.TEXT_NODE?e.textContent.length:e.childNodes.length}else if(s.classList.contains(`textLayer`)&&s.childNodes.length===c){let e=yu(s,c,u);if(!e)continue;s=e.container,c=e.offset}}if(a.nodeType===Node.ELEMENT_NODE){let e=yu(a,o,l);if(!e)continue;a=e.container,o=e.offset}if(l===u&&!m&&p.includes(l))i.push([n,l]);else for(let e of p){let t=e.firstChild;if(!t)continue;let n=document.createRange();if(e===l?n.setStart(a,o):n.setStartBefore(t),e===u)n.setEnd(s,c);else{let t=e.lastChild;if(!t)continue;if(t.nodeType===Node.ELEMENT_NODE&&t.classList.contains(`endOfContent`)){let e=t.previousSibling;if(!e)continue;n.setEndAfter(e)}else n.setEndAfter(t)}n.collapsed||i.push([n,e])}}let a=new Set(i.map(e=>e[1]));for(let e of this.#f)a.has(e)||this.#m(e);for(let[t,r]of i){let i=e.#p.get(r);if(!i)continue;let a=n.get(r);if(!a){let e=r.getBoundingClientRect();a=(t,n,r,i)=>({x:(t-e.x)/e.width,y:(n-e.y)/e.height,width:r/e.width,height:i/e.height}),n.set(r,a)}let o=[];for(let{x:e,y:n,width:r,height:i}of t.getClientRects())r!==0&&i!==0&&({x:e,y:n,width:r,height:i}=a(e,n,r,i),(r!==1||i!==1)&&o.push(`M${e} ${n} h${r} v${i} h-${r} Z`));if(o.length===0)continue;let s=i.drawLayer,c=i.selectionDiv,l=i.path;if(!c){let t=`clip_selection_${e.#c++}`;c=document.createElement(`div`),c.className=`selection`,c.style.clipPath=`url(#${t})`;let n=s.#r?.createSelectionStyle(s.#i);if(n)for(let[e,t]of Object.entries(n))c.style.setProperty(e,t);let r=e._svgFactory.create(1,1,!0);r.setAttribute(`aria-hidden`,`true`),r.setAttribute(`width`,`100%`),r.setAttribute(`height`,`100%`);let a=e._svgFactory.createElement(`clipPath`);a.setAttribute(`id`,t),a.setAttribute(`clipPathUnits`,`objectBoundingBox`),l=e._svgFactory.createElement(`path`),a.append(l),r.append(a),c.append(r),i.path=l,i.selectionDiv=c}s.#e&&c.parentNode!==s.#e&&(s.#e.append(c),this.#u.add(c)),l.setAttribute(`d`,o.join(` `))}}static get _svgFactory(){return H(this,`_svgFactory`,new cl)}static#v(e,[t,n,r,i]){let{style:a}=e;a.top=`${100*n}%`,a.left=`${100*t}%`,a.width=`${100*r}%`,a.height=`${100*i}%`}#y(){let t=e._svgFactory.create(1,1,!0);return this.#e.append(t),t.setAttribute(`aria-hidden`,`true`),t}#b(t,n){let r=e._svgFactory.createElement(`clipPath`);t.append(r);let i=`clip_${n}`;r.setAttribute(`id`,i),r.setAttribute(`clipPathUnits`,`objectBoundingBox`);let a=e._svgFactory.createElement(`use`);return r.append(a),a.setAttribute(`href`,`#${n}`),a.classList.add(`clip`),i}#x(e,t){for(let[n,r]of Object.entries(t))r===null?e.removeAttribute(n):e.setAttribute(n,r)}draw(t,n=!1,r=!1){let i=e.#s++,a=this.#y(),o=e._svgFactory.createElement(`defs`);a.append(o);let s=e._svgFactory.createElement(`path`);o.append(s);let c=`path_${i}`;s.setAttribute(`id`,c),s.setAttribute(`vector-effect`,`non-scaling-stroke`),n&&this.#o.set(i,s);let l=r?this.#b(o,c):null,u=e._svgFactory.createElement(`use`);return a.append(u),u.setAttribute(`href`,`#${c}`),this.updateProperties(a,t),this.#t.set(i,a),{id:i,clipPathId:`url(#${l})`}}drawOutline(t,n){let r=e.#s++,i=this.#y(),a=e._svgFactory.createElement(`defs`);i.append(a);let o=e._svgFactory.createElement(`path`);a.append(o);let s=`path_${r}`;o.setAttribute(`id`,s),o.setAttribute(`vector-effect`,`non-scaling-stroke`);let c;if(n){let t=e._svgFactory.createElement(`mask`);a.append(t),c=`mask_${r}`,t.setAttribute(`id`,c),t.setAttribute(`maskUnits`,`objectBoundingBox`);let n=e._svgFactory.createElement(`rect`);t.append(n),n.setAttribute(`width`,`1`),n.setAttribute(`height`,`1`),n.setAttribute(`fill`,`white`);let i=e._svgFactory.createElement(`use`);t.append(i),i.setAttribute(`href`,`#${s}`),i.setAttribute(`stroke`,`none`),i.setAttribute(`fill`,`black`),i.setAttribute(`fill-rule`,`nonzero`),i.classList.add(`mask`)}let l=e._svgFactory.createElement(`use`);i.append(l),l.setAttribute(`href`,`#${s}`),c&&l.setAttribute(`mask`,`url(#${c})`);let u=l.cloneNode();return i.append(u),l.classList.add(`mainOutline`),u.classList.add(`secondaryOutline`),this.updateProperties(i,t),this.#t.set(r,i),r}finalizeDraw(e,t){this.#o.delete(e),this.updateProperties(e,t)}updateProperties(t,n){if(!n)return;let{root:r,bbox:i,rootClass:a,path:o}=n,s=typeof t==`number`?this.#t.get(t):t;if(s){if(r&&this.#x(s,r),i&&e.#v(s,i),a){let{classList:e}=s;for(let[t,n]of Object.entries(a))e.toggle(t,n)}if(o){let e=s.firstElementChild.firstElementChild;this.#x(e,o)}}}updateParent(e,t){if(t===this)return;let n=this.#t.get(e);n&&(t.#e.append(n),this.#t.delete(e),t.#t.set(e,n))}remove(e){this.#o.delete(e),this.#e!==null&&(this.#t.get(e).remove(),this.#t.delete(e))}destroy(){this.#e=null;for(let e of this.#t.values())e.remove();this.#t.clear(),this.#o.clear(),this.#a?.disconnect(),this.#a=null,this.#n&&=(e.#p.get(this.#n)?.drawLayer===this&&(e.#m(this.#n),e.#p.delete(this.#n),e.#f.delete(this.#n),e.#f.size===0&&(e.#l?.abort(),e.#l=null,e.#d=!1)),null)}};function xu(e){return`${(e*100).toFixed(2)}%`}var Su=class e{#e=[];#t=new Map;#n=null;#r=0;#i=0;#a=0;static#o=null;constructor(e,t,n,r){this.#r=e,this.#e=t,this.#i=n.rawDims.pageWidth,this.#a=n.rawDims.pageHeight,this.#n=r}render(){let t=document.createElement(`div`);t.className=`textLayerImages`;for(let e=0;e<this.#e.length;e+=6){let n=this.#s(this.#e.subarray(e,e+6));n&&t.append(n)}return t.addEventListener(`contextmenu`,t=>{if(!(t.target instanceof HTMLCanvasElement))return;let n=t.target,r=this.#t.get(n);if(!r)return;let i=e.#o?.deref();if(i===n)return;i&&(i.width=0,i.height=0),e.#o=new WeakRef(n);let{inverseTransform:a,x1:o,y1:s,width:c,height:l}=r,u=this.#n(),d=Math.ceil(o*u.width),f=Math.ceil(s*u.height),p=Math.floor((o+c/this.#i)*u.width),m=Math.floor((s+l/this.#a)*u.height);n.width=p-d,n.height=m-f;let h=n.getContext(`2d`);h.setTransform(...a),h.translate(-d,-f),h.drawImage(u,0,0)}),t}#s([e,t,n,r,i,a]){let o=Math.hypot((i-e)*this.#i,(a-t)*this.#a),s=Math.hypot((n-e)*this.#i,(r-t)*this.#a);if(o<this.#r||s<this.#r)return null;let c=[(i-e)*this.#i/o,(a-t)*this.#a/o,(n-e)*this.#i/s,(r-t)*this.#a/s,0,0],l=U.inverseTransform(c),u=document.createElement(`canvas`);return u.className=`textLayerImagePlaceholder`,u.width=0,u.height=0,Object.assign(u.style,{opacity:0,position:`absolute`,left:xu(e),top:xu(t),width:xu(o/this.#i),height:xu(s/this.#a),transformOrigin:`0% 0%`,transform:`matrix(${c.join(`,`)})`}),this.#t.set(u,{inverseTransform:l,width:o,height:s,x1:e,y1:t}),u}};globalThis._pdfjsTestingUtils={HighlightOutliner:Xl},globalThis.pdfjsLib={AbortException:Ji,AnnotationEditorLayer:hu,AnnotationEditorParamsType:xi,AnnotationEditorType:bi,AnnotationEditorUIManager:to,AnnotationLayer:Vl,AnnotationMode:_i,AnnotationType:Ti,applyOpacity:Ia,build:tl,ColorPicker:nl,createValidAbsoluteUrl:zi,CSSConstants:Fa,DOMSVGFactory:cl,DrawLayer:bu,FeatureTest:Zi,fetchData:ha,findContrastColor:Ha,getDocument:Gc,getFilenameFromUrl:ya,getPdfFilenameFromUrl:ba,getRGB:Da,getRGBA:Ea,getUuid:na,GlobalWorkerOptions:Mc,ImageKind:wi,InvalidPDFException:Gi,isDataScheme:_a,isPdfFile:va,isValidExplicitDest:Zo,makeArr:ia,makeMap:aa,makeObj:oa,makeSet:sa,MathClamp:ca,noContextMenu:Ca,normalizeUnicode:ta,OPS:Oi,OutputScale:Ma,PasswordException:Ui,PasswordResponses:Ai,PDFDataRangeTransport:qc,PDFDateString:Ta,PDFWorker:Xc,PermissionFlag:Si,PixelsPerInch:ma,RenderingCancelledException:ga,renderRichText:Ua,ResponseException:Ki,setLayerDimensions:ja,shadow:H,SignatureExtractor:uu,stopEvent:wa,SupportedImageMimeTypes:Na,TextLayer:Uc,TextLayerImages:Su,TouchManager:so,updateUrlHash:Bi,Util:U,VerbosityLevel:Di,version:el,XfaLayer:pa};var Cu=1<<18,wu=e=>e&&e.length===3?`#${Array.from(e,e=>Math.round(e).toString(16).padStart(2,`0`)).join(``)}`:null;function Tu(e){switch(e.fieldType){case`Tx`:return`text`;case`Btn`:return e.checkBox?`checkbox`:e.radioButton?`radio`:null;case`Ch`:return e.combo?`dropdown`:`listbox`;default:return null}}function Eu(e){return e.subtype===`Widget`&&!!e.fieldName&&Tu(e)!==null}function Du(e,t){let[n=0,r=0,i=0,a=0]=e.rect,o=e.textAlignment===1?`center`:e.textAlignment===2?`right`:`left`,s=e.checkBox?e.exportValue:e.radioButton?e.buttonValue:void 0,c=((e.rotation??0)%360+360)%360;return{id:e.id,pageIndex:t,rect:{x:Math.min(n,i),y:Math.min(r,a),width:Math.abs(i-n),height:Math.abs(a-r)},...s?{exportValue:s}:{},fontSize:e.defaultAppearanceData?.fontSize??0,color:wu(e.defaultAppearanceData?.fontColor)??`#000000`,align:o,background:wu(e.backgroundColor),border:wu(e.borderColor),hidden:!!e.hidden,rotation:c===90||c===180||c===270?c:0}}function Ou(e,t,n){let r=t.fieldValue;switch(e){case`text`:return typeof r==`string`?r:``;case`checkbox`:return typeof r==`string`&&r!==`Off`&&n.some(e=>e.exportValue===r);case`radio`:return typeof r==`string`&&n.some(e=>e.exportValue===r)?r:``;case`dropdown`:return Array.isArray(r)?r[0]??``:r??``;case`listbox`:{let e=Array.isArray(r)?r:r?[r]:[];return t.multiSelect?e:e[0]??``}}}function ku(e){let t=new Map;for(let{pageIndex:n,widgets:r}of e)for(let e of r){if(!Eu(e))continue;let r=e.fieldName,i=Tu(e),a=t.get(r);if(!a){let n={name:r,type:i,readOnly:!!e.readOnly,required:!!e.required,widgets:[],value:``};i===`text`&&(n.multiline=!!e.multiLine,n.password=!!e.password,n.maxLength=e.maxLen??0,n.comb=!!e.comb),(i===`dropdown`||i===`listbox`)&&(n.options=(e.options??[]).map(e=>({value:e.exportValue,label:e.displayValue})),i===`listbox`?n.multiSelect=!!e.multiSelect:n.editable=((e.fieldFlags??0)&Cu)!==0),a={field:n,first:e},t.set(r,a)}a.field.widgets.push(Du(e,n))}return[...t.values()].map(({field:e,first:t})=>({...e,value:Ou(e.type,t,e.widgets)}))}function Au(e){return(Math.round(e/90)*90%360+360)%360}function ju(e,t){let[n,r,i,a]=t.view,o=i-n,s=a-r,c=(e.x-n)/o,l=(e.x+e.width-n)/o,u=(a-(e.y+e.height))/s,d=(a-e.y)/s;switch(t.rotation){case 90:return{left:1-d,top:c,width:d-u,height:l-c};case 180:return{left:1-l,top:1-d,width:l-c,height:d-u};case 270:return{left:u,top:1-l,width:d-u,height:l-c};default:return{left:c,top:u,width:l-c,height:d-u}}}function Mu(e,t){let[n,r,i,a]=t.view,o=(e.x-n)/(i-n),s=(a-e.y)/(a-r);switch(t.rotation){case 90:return{x:1-s,y:o};case 180:return{x:1-o,y:1-s};case 270:return{x:s,y:1-o};default:return{x:o,y:s}}}function Nu(e,t){let n,r;switch(t.rotation){case 90:[n,r]=[e.y,1-e.x];break;case 180:[n,r]=[1-e.x,1-e.y];break;case 270:[n,r]=[1-e.y,e.x];break;default:[n,r]=[e.x,e.y]}let[i,a,o,s]=t.view;return{x:i+n*(o-i),y:s-r*(s-a)}}function Pu(e){let t=Mu({x:0,y:0},e),n=Mu({x:1,y:0},e),r=Mu({x:0,y:1},e);return[n.x-t.x,n.y-t.y,r.x-t.x,r.y-t.y,t.x,t.y]}async function Fu(e){if(typeof e==`string`){if(e.trim()===``)throw TypeError(`Document URL is empty.`);return{url:e}}if(e instanceof ArrayBuffer)return{data:new Uint8Array(e.slice(0))};if(ArrayBuffer.isView(e)){let t=e;return{data:new Uint8Array(t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength))}}if(typeof Blob<`u`&&e instanceof Blob)return{data:new Uint8Array(await e.arrayBuffer())};throw TypeError(`Unsupported document source: expected a URL string, File, Blob or ArrayBuffer.`)}var Iu=`pdfjs_internal_editor_`,Lu=`./pdfjs/`,Ru,zu=typeof document<`u`&&document.currentScript instanceof HTMLScriptElement?document.currentScript.src:void 0;function Bu(){return{}.url??zu??document.baseURI}function Vu(e){Ru=e.endsWith(`/`)?e:`${e}/`,Mc.workerSrc=`${Ru}pdf.worker.min.mjs`}function Hu(){return Ru||Vu(new URL(Lu,Bu()).href),Ru}var Uu=0,Wu=class e{task;proxy;id=++Uu;constructor(e,t){this.task=e,this.proxy=t}static async open(t){let n=Hu(),r=Gc({...await Fu(t),cMapUrl:`${n}cmaps/`,cMapPacked:!0,standardFontDataUrl:`${n}standard_fonts/`,wasmUrl:`${n}wasm/`,iccUrl:`${n}iccs/`});try{return new e(r,await r.promise)}catch(e){throw e instanceof Error&&/fake worker/i.test(e.message)?Error(`PDFCedar could not load its PDF engine from ${n}. Run "npx pdfcedar-assets public/pdfcedar" (or copy node_modules/pdfcedar/dist/pdfjs/ to any folder your app serves) and pass \`assetBaseUrl: "/pdfcedar/"\`.`,{cause:e}):e}}get pageCount(){return this.proxy.numPages}getPage(e){return this.proxy.getPage(e+1)}getData(){return this.proxy.getData()}async scanAnnotations(e,t=20){let n=new Map,r=[];for(let i=0;i<this.pageCount;i+=t){let a=Array.from({length:Math.min(t,this.pageCount-i)},(e,t)=>i+t),o=await Promise.all(a.map(async e=>[e,await(await this.getPage(e)).getAnnotations()]));for(let[t,i]of o){let a=[];for(let r of i)r.id&&r.subtype&&e.has(r.subtype)?n.set(r.id,{pageIndex:t,popupRef:r.popupRef??null}):Eu(r)&&a.push(r);a.length>0&&r.push({pageIndex:t,widgets:a})}}return{annotations:n,widgets:r}}hideAnnotations(e){for(let[t,{pageIndex:n,popupRef:r}]of e)this.proxy.annotationStorage.setValue(`${Iu}pdfcedar-hidden-${t}`,{deleted:!0,id:t,popupRef:r,pageIndex:n})}async pageGeometry(e){let t=await this.getPage(e),{width:n,height:r}=t.getViewport({scale:1}),[i=0,a=0,o=n,s=r]=t.view;return{width:n,height:r,view:[i,a,o,s],rotation:Au(t.rotate)}}async destroy(){await this.task.destroy()}};function Gu(e,t,n){let r=[],i=n,a=0;for(let o of e){let e=Math.round(o.width*t),s=Math.round(o.height*t);r.push({top:i,width:e,height:s}),i+=s+n,a=Math.max(a,e)}return{pages:r,totalHeight:i,maxWidth:a}}function Ku(e,t){let{pages:n}=e,r=0,i=n.length-1;for(;r<i;){let e=r+i+1>>1;n[e].top<=t?r=e:i=e-1}return r}function qu(e,t,n){if(e.pages.length===0)return[0,-1];let r=Ku(e,t),i=e.pages[r];i.top+i.height<t&&r<e.pages.length-1&&r++;let a=Ku(e,t+n);return[r,Math.max(r,a)]}function Ju(e,t,n){return e.pages.length===0?0:Ku(e,t+n/3)}function Yu(e,t){let n=Au(e.rotation+t),r=Au(t)%180!=0;return{...e,rotation:n,width:r?e.height:e.width,height:r?e.width:e.height}}var Xu=class e{entries;constructor(e){this.entries=e}static of(t){return new e(Array.from({length:t.pageCount},(e,n)=>({key:`${t.id}:${n}`,doc:t,index:n,rotation:0})))}static fromEntries(t){return new e([...t])}get count(){return this.entries.length}at(e){let t=this.entries[e];if(!t)throw RangeError(`Page ${e+1} does not exist (document has ${this.count} pages).`);return t}async page(e){let t=this.at(e),n=await t.doc.getPage(t.index);return{proxy:n,rotation:Au(n.rotate+t.rotation)}}async geometry(e){let t=this.at(e);return Yu(await t.doc.pageGeometry(t.index),t.rotation)}rotated(t,n){let r=[...this.entries],i=this.at(t);return r[t]={...i,rotation:Au(i.rotation+n)},new e(r)}without(t){if(this.at(t),this.count===1)throw RangeError(`The last page cannot be deleted.`);return new e(this.entries.filter((e,n)=>n!==t))}moved(t,n){let r=this.at(t);this.at(n);let i=this.entries.filter((e,n)=>n!==t);return i.splice(n,0,r),new e(i)}withDocument(t){return new e([...this.entries,...e.of(t).entries])}},Zu=`http://www.w3.org/2000/svg`;function Qu(e,t={}){let n=document.createElementNS(Zu,e);for(let[e,r]of Object.entries(t))n.setAttribute(e,String(r));return n}var $u=e=>`${e*100}%`;function ed(e,t,n){let r=ju(t,n);Object.assign(e.style,{left:$u(r.left),top:$u(r.top),width:$u(r.width),height:$u(r.height)})}var td=e=>`${e[0]},${e[1]} ${e[2]},${e[3]} ${e[6]},${e[7]} ${e[4]},${e[5]}`;function nd(e){if(e.length===1){let t=e[0];return`M${t.x} ${t.y}L${t.x+.01} ${t.y}`}return e.map((e,t)=>`${t===0?`M`:`L`}${e.x} ${e.y}`).join(``)}function rd(e,t,n){let[r,i]=L(e,t,n);return`M${r.x} ${r.y}L${t.x} ${t.y}L${i.x} ${i.y}`}var id=`<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M4 4h16a1 1 0 0 1 1 1v11a1 1 0 0 1-1 1H9l-5 4v-4H4a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1z" fill="currentColor" stroke="rgb(0 0 0 / 0.55)" stroke-width="1.2" stroke-linejoin="round"/><path d="M7 9h10M7 12.5h7" stroke="rgb(0 0 0 / 0.55)" stroke-width="1.4" stroke-linecap="round"/></svg>`;function ad(e){let t=(t,n)=>(t.setAttribute(`stroke`,e.color),t.setAttribute(`stroke-width`,String(n)),t.setAttribute(`fill`,`none`),t.setAttribute(`stroke-linecap`,`round`),t.setAttribute(`stroke-linejoin`,`round`),t);switch(e.type){case`highlight`:return e.quads.map(t=>Qu(`polygon`,{points:td(t),fill:e.color,class:`pl-markup`}));case`underline`:case`strikeout`:return e.quads.flatMap(n=>{let r=Math.hypot(n[0]-n[4],n[1]-n[5]),i=e.type===`underline`?.08:.45,a=Qu(`line`,{x1:n[4]+(n[0]-n[4])*i,y1:n[5]+(n[1]-n[5])*i,x2:n[6]+(n[2]-n[6])*i,y2:n[7]+(n[3]-n[7])*i});return[Qu(`polygon`,{points:td(n),fill:`transparent`,class:`pl-hit-area`}),t(a,Math.max(.6,r*.07))]});case`ink`:return e.paths.map(n=>t(Qu(`path`,{d:nd(n)}),e.strokeWidth));case`rectangle`:case`ellipse`:{let n=e.strokeWidth,{x:r,y:i,width:a,height:o}=e.rect,s={x:r+n/2,y:i+n/2,w:Math.max(0,a-n),h:Math.max(0,o-n)},c=e.type===`rectangle`?Qu(`rect`,{x:s.x,y:s.y,width:s.w,height:s.h}):Qu(`ellipse`,{cx:s.x+s.w/2,cy:s.y+s.h/2,rx:s.w/2,ry:s.h/2});return t(c,n),e.fillColor&&c.setAttribute(`fill`,e.fillColor),[c]}case`redaction`:{let{x:n,y:r,width:i,height:a}=e.rect,o=Qu(`rect`,{x:n,y:r,width:i,height:a,class:e.applied?`pl-redaction pl-redaction-applied`:`pl-redaction`});return e.applied?o.setAttribute(`fill`,`#000`):(t(o,1.5),o.setAttribute(`fill`,e.color),o.setAttribute(`fill-opacity`,`0.15`)),[o]}case`line`:case`arrow`:{let n=[t(Qu(`line`,{x1:e.start.x,y1:e.start.y,x2:e.end.x,y2:e.end.y}),e.strokeWidth)];return e.type===`arrow`&&n.push(t(Qu(`path`,{d:rd(e.start,e.end,e.strokeWidth)}),e.strokeWidth)),n}default:return[]}}function od(e){let t=e.cloneNode();return t.setAttribute(`stroke`,`transparent`),t.setAttribute(`stroke-width`,`12`),t.setAttribute(`vector-effect`,`non-scaling-stroke`),t.setAttribute(`fill`,`none`),t.setAttribute(`class`,`pl-hit`),t}var sd=class{svg;html;group;previewGroup;selection=null;constructor(e){this.svg=Qu(`svg`,{class:`pl-annotations`,viewBox:`0 0 1 1`,preserveAspectRatio:`none`}),this.group=Qu(`g`),this.previewGroup=Qu(`g`,{class:`pl-preview`}),this.svg.append(this.group,this.previewGroup),this.html=document.createElement(`div`),this.html.className=`pl-annotations-html`,e.append(this.svg,this.html)}render(e,t,n={}){let r=`matrix(${Pu(t).join(` `)})`;this.group.setAttribute(`transform`,r),this.previewGroup.setAttribute(`transform`,r);let i=n.editingId?this.html.querySelector(`[data-annotation-id="${CSS.escape(n.editingId)}"]`):null;this.group.replaceChildren();for(let e of[...this.html.children])e!==i&&e!==this.selection&&e.remove();for(let r of e){if(r.type===`reply`)continue;if(r.type===`note`||r.type===`freeText`||r.type===`signature`){if(r.id===n.editingId&&i)continue;this.html.insertBefore(this.drawHtml(r,t,n.replyCounts?.get(r.id)??0),this.selection);continue}let e=Qu(`g`,{class:`pl-annot`,"data-annotation-id":r.id,"data-type":r.type,opacity:r.opacity}),a=ad(r);if(e.append(...a),r.type!==`highlight`&&r.type!==`underline`&&r.type!==`strikeout`)for(let t of a)e.append(od(t));this.group.append(e)}this.renderSelection(e.find(e=>e.id===n.selectedId)??null,t)}preview(e,t){if(this.previewGroup.replaceChildren(),this.html.querySelector(`.pl-preview-html`)?.remove(),!e)return;if(e.type===`note`||e.type===`freeText`||e.type===`signature`){let n=this.drawHtml(e,t,0);n.classList.add(`pl-preview-html`),n.removeAttribute(`data-annotation-id`),this.html.append(n);return}this.previewGroup.setAttribute(`transform`,`matrix(${Pu(t).join(` `)})`);let n=Qu(`g`,{opacity:e.opacity});n.append(...ad(e)),this.previewGroup.append(n)}element(e){return this.svg.querySelector(`[data-annotation-id="${CSS.escape(e)}"]`)??this.html.querySelector(`[data-annotation-id="${CSS.escape(e)}"]`)}drawHtml(e,t,n){let r=document.createElement(`div`);if(r.dataset.annotationId=e.id,r.dataset.type=e.type,r.style.opacity=String(e.opacity),ed(r,e.rect,t),e.type===`note`){if(r.className=`pl-annot pl-note`,r.style.color=e.color,r.innerHTML=id,r.setAttribute(`role`,`button`),r.setAttribute(`aria-label`,`Comment by ${e.author||`unknown`}${e.contents?`: ${e.contents}`:``}`),n>0){let e=document.createElement(`span`);e.className=`pl-note-badge`,e.textContent=String(n),r.append(e)}}else if(e.type===`freeText`)r.className=`pl-annot pl-freetext`,Object.assign(r.style,{color:e.color,fontSize:`calc(var(--total-scale-factor) * ${e.fontSize}px)`,background:e.backgroundColor??`transparent`,borderColor:e.borderColor??`transparent`}),r.textContent=e.contents;else if(e.type===`signature`){r.className=`pl-annot pl-signature`;let t=document.createElement(`img`);t.src=e.image,t.alt=`Signature${e.author?` by ${e.author}`:``}`,t.draggable=!1,r.append(t)}return r}renderSelection(e,t){if(this.selection?.remove(),this.selection=null,!e||e.type===`reply`)return;let n=document.createElement(`div`);if(n.className=`pl-selection`,n.dataset.selectionFor=e.id,ed(n,e.rect,t),e.type===`line`||e.type===`arrow`){n.classList.add(`pl-selection-line`);for(let[r,i]of[[`start`,e.start],[`end`,e.end]]){let a=Mu(i,t),o=ju(e.rect,t),s=document.createElement(`div`);s.className=`pl-handle`,s.dataset.handle=r,s.style.left=$u(o.width?(a.x-o.left)/o.width:.5),s.style.top=$u(o.height?(a.y-o.top)/o.height:.5),n.append(s)}}else if(he(e)&&!e.locked)for(let t of ge(e)){let e=document.createElement(`div`);e.className=`pl-handle`,e.dataset.handle=t,n.append(e)}this.html.append(n),this.selection=n}},cd=16777216;function ld(e,t){let n=globalThis.devicePixelRatio||1,r=Math.sqrt(cd/Math.max(1,e*t));return Math.min(n,r)}function ud(e){return e instanceof Error&&e.name===`RenderingCancelledException`}async function dd(e,t,n,r=e.rotate){let i=e.getViewport({scale:t,rotation:r}),a=e.getViewport({scale:t*ld(i.width,i.height),rotation:r}),o=document.createElement(`canvas`);o.width=Math.floor(a.width),o.height=Math.floor(a.height);let s=e.render({canvas:o,viewport:a,annotationMode:_i.ENABLE_STORAGE});n?.(s);try{return await s.promise,o}catch(e){if(fd(o),ud(e))return null;throw e}}function fd(e){e.width=0,e.height=0,e.remove()}var pd=class{index;key;el;canvas=null;task=null;textLayer=null;textDiv=null;highlightDiv=null;highlights=new Map;currentHighlight=null;annotationLayer=null;formLayer=null;textMask=[];renderedScale=0;rendering=!1;renderedRotation=null;constructor(e,t){this.index=e,this.key=t,this.el=document.createElement(`div`),this.el.className=`pl-page`,this.setIndex(e)}setIndex(e){this.index=e,this.el.dataset.pageNumber=String(e+1)}isRenderedAt(e,t){return this.renderedScale===e&&this.renderedRotation===t}get forms(){return this.formLayer||(this.formLayer=document.createElement(`div`),this.formLayer.className=`pl-forms`,this.el.insertBefore(this.formLayer,this.el.querySelector(`.pl-annotations`))),this.formLayer}get annotations(){return this.annotationLayer??=new sd(this.el),this.annotationLayer}place(e,t){let{style:n}=this.el;n.setProperty(`--total-scale-factor`,String(t)),n.top=`${e.top}px`,n.width=`${e.width}px`,n.height=`${e.height}px`,n.left=`calc(50% - ${e.width/2}px)`}async render(e,t,n=e.rotate,r){this.cancel(),this.rendering=!0,this.renderedRotation!==null&&this.renderedRotation!==n&&this.dropTextLayer();try{let i=await dd(e,t,e=>this.task=e,n);if(!i)return;r?.(i),i.className=`pl-page-canvas`,this.canvas?(this.canvas.replaceWith(i),fd(this.canvas)):this.el.prepend(i),this.canvas=i,this.renderedScale=t,this.renderedRotation=n,this.el.dataset.rendered=`true`}finally{this.task=null,this.rendering=!1}await this.renderText(e,t,n)}async renderText(e,t,n){let r=e.getViewport({scale:t,rotation:n});if(this.textLayer){this.textLayer.update({viewport:r});return}let i=document.createElement(`div`);i.className=`textLayer`;let a=new Uc({textContentSource:e.streamTextContent({includeMarkedContent:!0,disableNormalization:!0}),container:i,viewport:r});this.textLayer=a;try{await a.render()}catch(e){if(this.textLayer===a&&(this.textLayer=null),ud(e)||e instanceof Error&&e.name===`AbortException`)return;throw e}if(this.textLayer!==a)return;let o=document.createElement(`div`);o.className=`endOfContent`,i.append(o),this.el.append(i),this.textDiv=i,this.applyTextMask(),this.el.dataset.textLayer=`true`}setTextMask(e){this.textMask=e,this.applyTextMask()}applyTextMask(){if(!this.textDiv||this.textMask.length===0)return;let e=this.el.getBoundingClientRect();if(e.width&&e.height)for(let t of this.textDiv.querySelectorAll(`span`)){let n=t.getBoundingClientRect();if(!n.width||!n.height)continue;let r=(n.left-e.left)/e.width,i=(n.top-e.top)/e.height,a=r+n.width/e.width,o=i+n.height/e.height;this.textMask.some(e=>r<e.left+e.width&&e.left<a&&i<e.top+e.height&&e.top<o)&&t.remove()}}addHighlight(e,t){this.removeHighlight(e),this.highlightDiv||(this.highlightDiv=document.createElement(`div`),this.highlightDiv.className=`pl-highlights`,this.el.insertBefore(this.highlightDiv,this.textDiv));let n=t.map(t=>{let n=document.createElement(`div`);return n.className=`pl-search-hit`,n.dataset.highlightId=e,Object.assign(n.style,{left:`${t.left*100}%`,top:`${t.top*100}%`,width:`${t.width*100}%`,height:`${t.height*100}%`}),e===this.currentHighlight&&n.classList.add(`pl-current`),n});this.highlightDiv.append(...n),this.highlights.set(e,n)}removeHighlight(e){for(let t of this.highlights.get(e)??[])t.remove();this.highlights.delete(e)}clearHighlights(){this.highlightDiv?.remove(),this.highlightDiv=null,this.highlights.clear(),this.currentHighlight=null}setCurrentHighlight(e){for(let e of this.highlights.get(this.currentHighlight??``)??[])e.classList.remove(`pl-current`);this.currentHighlight=e;for(let t of this.highlights.get(e??``)??[])t.classList.add(`pl-current`)}cancel(){this.task?.cancel(),this.task=null}release(){this.cancel(),this.canvas&&fd(this.canvas),this.canvas=null,this.renderedScale=0,this.renderedRotation=null,delete this.el.dataset.rendered,this.dropTextLayer()}dropTextLayer(){this.textLayer?.cancel(),this.textLayer=null,this.textDiv?.remove(),this.textDiv=null,delete this.el.dataset.textLayer}},md=.1,hd=96/72;function gd(e){if(!Number.isFinite(e))throw RangeError(`Zoom must be a finite number, got ${e}.`);return Math.min(8,Math.max(md,e))}function _d(e,t,n,r,i){let a=(n-2*i)/(t.width*hd);if(e===`width`)return gd(a);let o=(r-2*i)/(t.height*hd);return gd(Math.min(a,o))}var vd=12,yd=1,bd=3,xd=2,Sd=150,Cd=20,wd=1.25,Td=class e{pages;callbacks;scroller;spacer;views;sizes;known=new Map;generation=0;layout;zoom=1;zoomMode=`auto`;current=0;pinned=null;frame=0;rerenderTimer;rerenderBlockedUntil=0;activeRenders=0;destroyed=!1;resizeObserver;constructor(e,t,n,r){this.pages=t,this.callbacks=r,this.scroller=document.createElement(`div`),this.scroller.className=`pl-scroller`,this.scroller.tabIndex=0,this.spacer=document.createElement(`div`),this.spacer.className=`pl-pages`,this.scroller.append(this.spacer),e.append(this.scroller),t.at(0).rotation===0&&this.known.set(t.at(0).key,n),this.sizes=Array.from({length:t.count},()=>({...n})),this.views=t.entries.map((e,t)=>new pd(t,e.key)),this.spacer.append(...this.views.map(e=>e.el)),this.zoom=this.zoomFor(`auto`),this.layout=this.relayout(),this.scroller.addEventListener(`scroll`,this.onScroll,{passive:!0}),this.resizeObserver=new ResizeObserver(()=>this.onResize()),this.resizeObserver.observe(this.scroller)}static async create(t,n,r={}){let i=new e(t,n,await n.geometry(0),r);return i.update(),i.loadPageSizes(),i}get pageCount(){return this.views.length}get currentIndex(){return this.current}get currentZoom(){return this.zoom}get fitMode(){return this.zoomMode===`width`||this.zoomMode===`page`?this.zoomMode:null}pageSize(e){return this.sizes[e]}decorateCanvas=null;setTextMask(e,t){this.views[e]?.setTextMask(t)}formLayer(e){return this.views[e]?.forms}annotationLayer(e){return this.views[e]?.annotations}pageElement(e){return this.views[e]?.el}pageIndexOf(e){let t=e instanceof Element?e.closest(`.pl-page`):null;return t&&this.spacer.contains(t)?Number(t.dataset.pageNumber)-1:-1}addHighlight(e,t,n){this.views[e]?.addHighlight(t,n)}setCurrentHighlight(e,t){for(let n of this.views)n.setCurrentHighlight(n.index===e?t:null)}clearHighlights(){for(let e of this.views)e.clearHighlights()}scrollToRect(e,t){let n=this.layout.pages[e];if(!n)return;let{scroller:r}=this,i=n.top+t.top*n.height,a=i+t.height*n.height;(i<r.scrollTop||a>r.scrollTop+r.clientHeight)&&(r.scrollTop=i-r.clientHeight/3);let o=Math.max(vd,(this.spacer.offsetWidth-n.width)/2)+t.left*n.width,s=o+t.width*n.width;(o<r.scrollLeft||s>r.scrollLeft+r.clientWidth)&&(r.scrollLeft=o-r.clientWidth/3),this.pinned={index:e,scrollTop:r.scrollTop},this.update()}goToPage(e){let t=this.layout.pages[e];if(!t)throw RangeError(`Page ${e+1} does not exist (document has ${this.pageCount} pages).`);this.scroller.scrollTop=t.top-vd,this.pinned={index:e,scrollTop:this.scroller.scrollTop},this.update()}setZoom(e){this.zoomMode=null,this.applyZoom(gd(e))}zoomAt(e,t,n){let r=this.scroller.getBoundingClientRect();this.zoomMode=null,this.applyZoom(gd(e),{x:t-r.left,y:n-r.top})}get zoomLevel(){return this.zoom}fit(e){if(e!==`width`&&e!==`page`)throw TypeError(`fit() expects 'width' or 'page', got ${String(e)}.`);this.zoomMode=e,this.applyZoom(this.zoomFor(e))}get pageList(){return this.pages}setPages(e){let t=this.views[Ku(this.layout,this.scroller.scrollTop+this.scroller.clientHeight/2)]?.key,n=new Map(this.views.map(e=>[e.key,e])),r=this.sizes[0];this.views=e.entries.map((e,t)=>{let r=n.get(e.key)??new pd(t,e.key);return n.delete(e.key),r.setIndex(t),r});for(let e of n.values())e.release(),e.el.remove();this.pages=e,this.sizes=e.entries.map(e=>{let t=this.known.get(e.key);return t?Yu(t,e.rotation):{...r}}),this.spacer.replaceChildren(...this.views.map(e=>e.el)),this.current=Math.min(this.current,e.count-1),this.relayout();let i=this.views.findIndex(e=>e.key===t);i>=0&&(this.scroller.scrollTop=this.layout.pages[i].top-vd),this.callbacks.onSizesChange?.(),this.generation++,this.loadPageSizes(),this.update()}rerenderPages(e){for(let t of e)this.views[t]?.release();this.update()}destroy(){if(!this.destroyed){this.destroyed=!0,cancelAnimationFrame(this.frame),clearTimeout(this.rerenderTimer),this.resizeObserver.disconnect(),this.scroller.removeEventListener(`scroll`,this.onScroll);for(let e of this.views)e.release();this.scroller.remove()}}get cssScale(){return this.zoom*hd}zoomFor(e){let t=this.sizes[this.current]??this.sizes[0],n=this.scroller.clientWidth||800,r=this.scroller.clientHeight||600;return e===`auto`?Math.min(_d(`width`,t,n,r,vd),wd):_d(e,t,n,r,vd)}relayout(){let e=Gu(this.sizes,this.cssScale,vd);this.spacer.style.height=`${e.totalHeight}px`,this.spacer.style.minWidth=`${e.maxWidth+24}px`;let t=this.cssScale;return e.pages.forEach((e,n)=>this.views[n].place(e,t)),this.layout=e,e}relayoutAnchored(e){let{scrollTop:t,scrollLeft:n,clientHeight:r,clientWidth:i}=this.scroller,a=e?.x??i/2,o=e?.y??r/2,s=t+o,c=Ku(this.layout,s),l=this.layout.pages[c],u=(s-l.top)/l.height,d=this.pageLeft(l.width),f=l.width>0?(n+a-d)/l.width:.5,p=this.relayout().pages[c];this.scroller.scrollTop=p.top+u*p.height-o,this.scroller.scrollLeft=this.pageLeft(p.width)+f*p.width-a,this.pinned&&={index:this.pinned.index,scrollTop:this.scroller.scrollTop}}pageLeft(e){return Math.max(this.scroller.clientWidth,this.layout.maxWidth+24)/2-e/2}applyZoom(e,t){e!==this.zoom&&(this.zoom=e,this.relayoutAnchored(t),this.rerenderBlockedUntil=performance.now()+Sd,clearTimeout(this.rerenderTimer),this.rerenderTimer=setTimeout(()=>this.update(),Sd),this.callbacks.onZoomChange?.(e),this.update())}onScroll=()=>{this.frame||=requestAnimationFrame(()=>{this.frame=0,this.update()})};onResize(){this.destroyed||(this.zoomMode&&this.applyZoom(this.zoomFor(this.zoomMode)),this.update())}update(){if(this.destroyed||this.views.length===0)return;let{scrollTop:e,clientHeight:t}=this.scroller;this.pinned&&Math.abs(e-this.pinned.scrollTop)>1&&(this.pinned=null);let n=this.pinned?.index??Ju(this.layout,e,t);if(n!==this.current){let e=this.current;this.current=n,this.callbacks.onPageChange?.(n,e)}let[r,i]=qu(this.layout,e,t),a=r-bd,o=i+bd;for(let e of this.views)(e.renderedScale||e.rendering)&&(e.index<a||e.index>o)&&e.release();if(performance.now()<this.rerenderBlockedUntil)return;let s=[];for(let e=r;e<=i;e++)s.push(e);s.sort((e,t)=>Math.abs(e-n)-Math.abs(t-n));for(let e=1;e<=yd;e++)s.push(i+e,r-e);for(let e of s){if(this.activeRenders>=xd)break;let t=this.views[e];!t||t.rendering||t.isRenderedAt(this.cssScale,this.sizes[e].rotation)||this.renderPage(t)}}async renderPage(e){this.activeRenders++;try{let{proxy:t,rotation:n}=await this.pages.page(e.index);!this.destroyed&&this.views[e.index]===e&&await e.render(t,this.cssScale,n,t=>this.decorateCanvas?.(e.index,t))}catch(t){this.destroyed||console.error(`[pdfcedar] failed to render page ${e.index+1}`,t)}finally{this.activeRenders--,this.destroyed||this.update()}}async loadPageSizes(){let e=this.generation,t=this.pages.entries.map((e,t)=>[e,t]).filter(([e])=>!this.known.has(e.key));for(let n=0;n<t.length&&!this.destroyed;n+=Cd){let r=t.slice(n,n+Cd),i=await Promise.all(r.map(([e])=>e.doc.pageGeometry(e.index)));if(this.destroyed||e!==this.generation)return;let a=!1;i.forEach((e,t)=>{let[n,i]=r[t];this.known.set(n.key,e);let o=Yu(e,n.rotation),s=this.sizes[i],c=s.width===o.width&&s.height===o.height;this.sizes[i]=o,c||(this.views[i].release(),a=!0)}),a&&(this.relayoutAnchored(),this.callbacks.onSizesChange?.(),this.update())}}},Ed=e=>e.length;function Dd(e){let t=``,n=[];for(let r of e)typeof r.str==`string`&&r.transform&&(n.push({str:r.str,transform:r.transform,width:r.width??0,height:r.height??0,hasEOL:r.hasEOL??!1,start:t.length}),t+=r.str,r.hasEOL&&(t+=`
|
|
57
|
+
`));return{text:t,runs:n}}function Od(e){let t=e.trim().split(/\s+/).filter(Boolean);if(t.length===0)return null;let n=t.map(e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`));return new RegExp(n.join(`\\s+`),`giu`)}function kd(e,t){let n=[];t.lastIndex=0;for(let r of e.matchAll(t))n.push({start:r.index,end:r.index+r[0].length});return n}function Ad(e,t,n=Ed){let r=[];for(let i of e.runs){let e=i.start+i.str.length;if(e<=t.start||i.start>=t.end)continue;let a=Math.max(t.start,i.start)-i.start,o=Math.min(t.end,e)-i.start;a>=o||r.push(jd(i,a,o,n))}return r}function jd(e,t,n,r){let[i=1,a=0,o=0,s=1,c=0,l=0]=e.transform,u=r(e.str),d=t=>u>0?r(e.str.slice(0,t))/u:t/e.str.length,f=d(t)*e.width,p=d(n)*e.width,m=Math.hypot(o,s)||e.height,h=m*.8,g=m*.2,_=Math.atan2(a,i),[v,y]=[Math.cos(_),Math.sin(_)],[b,x]=[-y,v],S=[[c+v*f-b*g,l+y*f-x*g],[c+v*p-b*g,l+y*p-x*g],[c+v*p+b*h,l+y*p+x*h],[c+v*f+b*h,l+y*f+x*h]],C=S.map(e=>e[0]),w=S.map(e=>e[1]),T=Math.min(...C),E=Math.min(...w);return{x:T,y:E,width:Math.max(...C)-T,height:Math.max(...w)-E}}function Md(e){return e.replace(/[\0]/g,``).replace(/ /g,` `).normalize(`NFKC`)}var Nd=8;function Pd(){let e=typeof document<`u`?document.createElement(`canvas`).getContext(`2d`):null;return e?(e.font=`10px sans-serif`,t=>e.measureText(t).width):Ed}var Fd=class{viewport;onChange;texts=new Map;measure=Pd();hits=[];current=-1;query=``;searching=!1;generation=0;hidden=null;constructor(e,t=()=>{}){this.viewport=e,this.onChange=t}get state(){return{query:this.query,total:this.hits.length,current:this.current,searching:this.searching}}async search(e){let t=++this.generation;this.reset();let n=Od(e);if(this.query=e,!n)return this.emit(),[];this.searching=!0,this.emit();let r=[],i=this.viewport.pageList;for(let e=0;e<i.count;e++){for(let t=1;t<=Nd&&e+t<i.count;t++)this.pageText(i,e+t).catch(()=>{});let a=await this.pageText(i,e),o=kd(a.text,n);if(o.length===0)continue;let s=await i.geometry(e);if(i!==this.viewport.pageList)return r;let c=o.flatMap((n,i)=>{let o=Ad(a,n,this.measure);if(this.hidden?.(e,o))return[];let c={page:e+1,index:n.start,text:a.text.slice(n.start,n.end),rects:o};return r.push(c),[{result:c,pageIndex:e,id:`search-${t}-${e}-${i}`,fractions:o.map(e=>ju(e,s))}]});if(c.length!==0&&t===this.generation){for(let e of c)this.viewport.addHighlight(e.pageIndex,e.id,e.fractions);this.hits.push(...c),this.current===-1?this.select(0):this.emit()}}return t===this.generation&&(this.searching=!1,this.emit()),r}next(){this.hits.length>0&&this.select((this.current+1)%this.hits.length)}previous(){this.hits.length>0&&this.select((this.current-1+this.hits.length)%this.hits.length)}clear(){this.generation++,this.reset(),this.query=``,this.emit()}select(e){let t=this.hits[e];if(!t)return;this.current=e,this.viewport.setCurrentHighlight(t.pageIndex,t.id);let n=t.fractions[0];n&&this.viewport.scrollToRect(t.pageIndex,n),this.emit()}reset(){this.viewport.clearHighlights(),this.hits=[],this.current=-1,this.searching=!1}pageText(e,t){let n=e.at(t),r=this.texts.get(n.key);return r||(r=n.doc.getPage(n.index).then(e=>e.getTextContent()).then(e=>Dd(e.items)),r.catch(()=>this.texts.delete(n.key)),this.texts.set(n.key,r)),r}emit(){this.onChange(this.state)}};async function Id(e,t,n,r){let{proxy:i,rotation:a}=await e.page(t);return r?.aborted?null:dd(i,n/i.getViewport({scale:1,rotation:a}).width,e=>r?.addEventListener(`abort`,()=>e.cancel(),{once:!0}),a)}var Ld=150,Rd=16777216,zd=6e4,Bd=`
|
|
58
|
+
@media screen { .pl-print-root { display: none !important; } }
|
|
59
|
+
@media print {
|
|
60
|
+
@page { margin: 0; }
|
|
61
|
+
html, body { margin: 0 !important; padding: 0 !important; height: auto !important; overflow: visible !important; }
|
|
62
|
+
body > *:not(.pl-print-root) { display: none !important; }
|
|
63
|
+
.pl-print-root { display: block !important; }
|
|
64
|
+
.pl-print-page { break-after: page; page-break-after: always; display: flex; justify-content: center; }
|
|
65
|
+
.pl-print-page:last-child { break-after: auto; page-break-after: auto; }
|
|
66
|
+
.pl-print-page img { display: block; width: 100%; height: auto; }
|
|
67
|
+
}`,Vd=!1;async function Hd(e,t){if(Vd)return;Vd=!0;let n=null,r=document.createElement(`div`);r.className=`pl-print-root`,r.setAttribute(`aria-hidden`,`true`);let i=document.createElement(`style`);i.textContent=Bd;let a=[];try{n=await Wu.open(e.slice().buffer);for(let e=0;e<n.pageCount;e++){let i=await n.getPage(e),o=i.getViewport({scale:1}),s=Math.min(Ld/72,Math.sqrt(Rd/(o.width*o.height))),c=i.getViewport({scale:s}),l=document.createElement(`canvas`);l.width=Math.floor(c.width),l.height=Math.floor(c.height),await i.render({canvas:l,viewport:c,intent:`print`,annotationMode:_i.ENABLE}).promise;let u=await new Promise(e=>l.toBlob(e,`image/png`));if(fd(l),!u)throw Error(`Could not render page ${e+1} for printing.`);let d=URL.createObjectURL(u);a.push(d);let f=document.createElement(`div`);f.className=`pl-print-page`;let p=new Image;p.alt=`Page ${e+1}`,p.src=d,f.append(p),r.append(f),t?.(e+1,n.pageCount)}document.head.append(i),document.body.append(r),await Promise.all([...r.querySelectorAll(`img`)].map(e=>e.decode().catch(()=>void 0))),await new Promise(e=>{let t=()=>{clearTimeout(n),window.removeEventListener(`afterprint`,t),e()},n=setTimeout(t,zd);window.addEventListener(`afterprint`,t),window.print()})}finally{r.remove(),i.remove();for(let e of a)URL.revokeObjectURL(e);await n?.destroy(),Vd=!1}}function Ud(e,t={}){let n=e.scroller,r=new AbortController,{signal:i}=r,a=null,o=0,s=null,c=()=>{if(o=0,!s)return;let{zoom:t,mid:r,pan:i}=s;s=null,n.scrollLeft-=i.x,n.scrollTop-=i.y,e.zoomAt(t,r.x,r.y)},l=(e,t,n)=>{s=s?{zoom:e,mid:t,pan:{x:s.pan.x+n.x,y:s.pan.y+n.y}}:{zoom:e,mid:t,pan:n},o||=requestAnimationFrame(c)},u=e=>{let[t,n]=[e[0],e[1]];return{distance:Math.hypot(t.clientX-n.clientX,t.clientY-n.clientY),mid:{x:(t.clientX+n.clientX)/2,y:(t.clientY+n.clientY)/2}}};n.addEventListener(`touchstart`,n=>{if(n.touches.length!==2)return;let{distance:r,mid:i}=u(n.touches);r<1||(a={startDistance:r,startZoom:e.zoomLevel,mid:i},t.onPinchStart?.())},{signal:i,passive:!0}),n.addEventListener(`touchmove`,e=>{if(!a||e.touches.length<2)return;e.preventDefault();let{distance:t,mid:n}=u(e.touches),r={x:n.x-a.mid.x,y:n.y-a.mid.y};a.mid=n,l(a.startZoom*(t/a.startDistance),n,r)},{signal:i,passive:!1});let d=e=>{a&&e.touches.length<2&&(a=null)};n.addEventListener(`touchend`,d,{signal:i}),n.addEventListener(`touchcancel`,d,{signal:i}),n.addEventListener(`wheel`,t=>{if(!t.ctrlKey&&!t.metaKey)return;t.preventDefault();let n=t.deltaMode===1?t.deltaY*16:t.deltaY,r=Math.exp(-Math.max(-100,Math.min(100,n))*.01);l((s?.zoom??e.zoomLevel)*r,{x:t.clientX,y:t.clientY},{x:0,y:0})},{signal:i,passive:!1});let f=1;return n.addEventListener(`gesturestart`,t=>{t.preventDefault(),f=e.zoomLevel},{signal:i,passive:!1}),n.addEventListener(`gesturechange`,e=>{if(e.preventDefault(),a)return;let t=e;l(f*t.scale,{x:t.clientX,y:t.clientY},{x:0,y:0})},{signal:i,passive:!1}),()=>{r.abort(),cancelAnimationFrame(o)}}var Wd=`pdfcedar-styles`,Gd=`
|
|
68
|
+
.pdfcedar-viewer {
|
|
69
|
+
--pl-bg: #e7e9ee;
|
|
70
|
+
--pl-surface: #ffffff;
|
|
71
|
+
--pl-text: #1f2430;
|
|
72
|
+
--pl-muted: #6b7280;
|
|
73
|
+
--pl-border: #d4d7de;
|
|
74
|
+
--pl-accent: #2563eb;
|
|
75
|
+
--pl-page-shadow: 0 1px 3px rgb(0 0 0 / 0.18), 0 1px 2px rgb(0 0 0 / 0.1);
|
|
76
|
+
--pl-sidebar-width: 220px;
|
|
77
|
+
--pl-font: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
|
|
78
|
+
|
|
79
|
+
position: relative;
|
|
80
|
+
display: flex;
|
|
81
|
+
flex-direction: column;
|
|
82
|
+
width: 100%;
|
|
83
|
+
height: 100%;
|
|
84
|
+
min-height: 0;
|
|
85
|
+
overflow: hidden;
|
|
86
|
+
background: var(--pl-bg);
|
|
87
|
+
color: var(--pl-text);
|
|
88
|
+
font-family: var(--pl-font);
|
|
89
|
+
box-sizing: border-box;
|
|
90
|
+
}
|
|
91
|
+
.pdfcedar-viewer[data-theme='dark'] {
|
|
92
|
+
--pl-bg: #1b1e24;
|
|
93
|
+
--pl-surface: #262a32;
|
|
94
|
+
--pl-text: #e6e8ec;
|
|
95
|
+
--pl-muted: #9aa1ad;
|
|
96
|
+
--pl-border: #3a3f4a;
|
|
97
|
+
--pl-accent: #60a5fa;
|
|
98
|
+
--pl-page-shadow: 0 1px 4px rgb(0 0 0 / 0.6);
|
|
99
|
+
}
|
|
100
|
+
.pdfcedar-viewer *, .pdfcedar-viewer *::before, .pdfcedar-viewer *::after { box-sizing: inherit; }
|
|
101
|
+
.pdfcedar-viewer pl-main-toolbar { flex: none; }
|
|
102
|
+
.pdfcedar-viewer .pl-body { flex: 1; min-height: 0; display: flex; }
|
|
103
|
+
.pdfcedar-viewer .pl-main { position: relative; flex: 1; min-width: 0; display: flex; }
|
|
104
|
+
.pdfcedar-viewer .pl-trial-badge {
|
|
105
|
+
position: absolute; right: 12px; bottom: 12px; z-index: 5; pointer-events: auto; cursor: help;
|
|
106
|
+
padding: 2px 8px; border-radius: 999px; font: 600 11px/18px system-ui, sans-serif; letter-spacing: 0.04em;
|
|
107
|
+
text-transform: uppercase; color: #fff; background: rgb(220 38 38 / 0.85);
|
|
108
|
+
}
|
|
109
|
+
.pdfcedar-viewer .pl-scroller {
|
|
110
|
+
flex: 1;
|
|
111
|
+
overflow: auto;
|
|
112
|
+
outline: none;
|
|
113
|
+
overscroll-behavior: contain;
|
|
114
|
+
/* One finger scrolls natively; pinching is the viewer's own zoom (attachZoomGestures), not the page's. */
|
|
115
|
+
touch-action: pan-x pan-y;
|
|
116
|
+
-webkit-overflow-scrolling: touch;
|
|
117
|
+
}
|
|
118
|
+
.pdfcedar-viewer .pl-pages { position: relative; }
|
|
119
|
+
.pdfcedar-viewer .pl-page {
|
|
120
|
+
position: absolute;
|
|
121
|
+
background: #fff;
|
|
122
|
+
box-shadow: var(--pl-page-shadow);
|
|
123
|
+
overflow: hidden;
|
|
124
|
+
}
|
|
125
|
+
.pdfcedar-viewer .pl-page-canvas { display: block; width: 100%; height: 100%; }
|
|
126
|
+
/* Compact layout (narrow viewers): the sidebar is a drawer over the pages, and the annotation tools scroll
|
|
127
|
+
sideways in one row instead of wrapping. */
|
|
128
|
+
.pdfcedar-viewer[data-compact] .pl-body { position: relative; }
|
|
129
|
+
.pdfcedar-viewer[data-compact] pl-sidebar {
|
|
130
|
+
position: absolute;
|
|
131
|
+
inset: 0 auto 0 0;
|
|
132
|
+
z-index: 20;
|
|
133
|
+
width: min(var(--pl-sidebar-width), 80%);
|
|
134
|
+
box-shadow: 4px 0 16px rgb(0 0 0 / 0.2);
|
|
135
|
+
}
|
|
136
|
+
.pdfcedar-viewer[data-compact] pl-annotation-toolbar {
|
|
137
|
+
flex-wrap: nowrap;
|
|
138
|
+
overflow-x: auto;
|
|
139
|
+
overscroll-behavior-x: contain;
|
|
140
|
+
scrollbar-width: none;
|
|
141
|
+
border-bottom: 0;
|
|
142
|
+
}
|
|
143
|
+
/* Fixed width: min-width 0 stops long comment text from widening the sidebar. */
|
|
144
|
+
.pdfcedar-viewer pl-sidebar { flex: 0 0 var(--pl-sidebar-width); width: var(--pl-sidebar-width); min-width: 0; }
|
|
145
|
+
.pdfcedar-viewer .pl-page { --scale-round-x: 1px; --scale-round-y: 1px; }
|
|
146
|
+
.pdfcedar-viewer .pl-highlights { position: absolute; inset: 0; pointer-events: none; }
|
|
147
|
+
.pdfcedar-viewer .pl-search-hit {
|
|
148
|
+
position: absolute;
|
|
149
|
+
border-radius: 2px;
|
|
150
|
+
background: var(--pl-search-hit, rgb(255 200 0 / 0.4));
|
|
151
|
+
mix-blend-mode: multiply;
|
|
152
|
+
}
|
|
153
|
+
.pdfcedar-viewer .pl-search-hit.pl-current {
|
|
154
|
+
background: var(--pl-search-current, rgb(255 120 0 / 0.55));
|
|
155
|
+
outline: 2px solid var(--pl-search-current-outline, rgb(230 90 0));
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/* Text layer, adapted from pdf.js web/pdf_viewer.css (Apache-2.0, Mozilla Foundation). */
|
|
159
|
+
.pdfcedar-viewer .textLayer {
|
|
160
|
+
position: absolute;
|
|
161
|
+
inset: 0;
|
|
162
|
+
overflow: clip;
|
|
163
|
+
line-height: 1;
|
|
164
|
+
text-align: initial;
|
|
165
|
+
letter-spacing: normal;
|
|
166
|
+
word-spacing: normal;
|
|
167
|
+
text-size-adjust: none;
|
|
168
|
+
-webkit-text-size-adjust: none;
|
|
169
|
+
forced-color-adjust: none;
|
|
170
|
+
transform-origin: 0 0;
|
|
171
|
+
caret-color: CanvasText;
|
|
172
|
+
z-index: 0;
|
|
173
|
+
--min-font-size: 1;
|
|
174
|
+
--text-scale-factor: calc(var(--total-scale-factor) * var(--min-font-size));
|
|
175
|
+
--min-font-size-inv: calc(1 / var(--min-font-size));
|
|
176
|
+
}
|
|
177
|
+
.pdfcedar-viewer .textLayer :is(span, br) {
|
|
178
|
+
color: transparent;
|
|
179
|
+
position: absolute;
|
|
180
|
+
white-space: pre;
|
|
181
|
+
cursor: text;
|
|
182
|
+
transform-origin: 0% 0%;
|
|
183
|
+
user-select: text;
|
|
184
|
+
-webkit-user-select: text;
|
|
185
|
+
}
|
|
186
|
+
.pdfcedar-viewer .textLayer > :not(.markedContent),
|
|
187
|
+
.pdfcedar-viewer .textLayer .markedContent span:not(.markedContent) {
|
|
188
|
+
z-index: 1;
|
|
189
|
+
--font-height: 0;
|
|
190
|
+
font-size: calc(var(--text-scale-factor) * var(--font-height));
|
|
191
|
+
--scale-x: 1;
|
|
192
|
+
--rotate: 0deg;
|
|
193
|
+
transform: rotate(var(--rotate)) scaleX(var(--scale-x)) scale(var(--min-font-size-inv));
|
|
194
|
+
}
|
|
195
|
+
.pdfcedar-viewer .textLayer .markedContent { display: contents; }
|
|
196
|
+
.pdfcedar-viewer .textLayer span[role='img'] { user-select: none; -webkit-user-select: none; cursor: default; }
|
|
197
|
+
.pdfcedar-viewer .textLayer ::selection { background: rgb(0 90 255 / 0.3); color: transparent; }
|
|
198
|
+
.pdfcedar-viewer .textLayer br::selection { background: transparent; }
|
|
199
|
+
.pdfcedar-viewer .textLayer .endOfContent {
|
|
200
|
+
display: block;
|
|
201
|
+
position: absolute;
|
|
202
|
+
inset: 100% 0 0;
|
|
203
|
+
z-index: 0;
|
|
204
|
+
cursor: default;
|
|
205
|
+
user-select: none;
|
|
206
|
+
-webkit-user-select: none;
|
|
207
|
+
}
|
|
208
|
+
.pdfcedar-viewer .textLayer.selecting .endOfContent { top: 0; }
|
|
209
|
+
.pdfcedar-viewer [data-main-rotation='90'] { transform: rotate(90deg) translateY(-100%); }
|
|
210
|
+
.pdfcedar-viewer [data-main-rotation='180'] { transform: rotate(180deg) translate(-100%, -100%); }
|
|
211
|
+
.pdfcedar-viewer [data-main-rotation='270'] { transform: rotate(270deg) translateX(-100%); }
|
|
212
|
+
|
|
213
|
+
/* Annotations. Layers stack: canvas, search hits, text layer, vector annotations, HTML annotations. */
|
|
214
|
+
.pdfcedar-viewer .pl-annotations {
|
|
215
|
+
position: absolute;
|
|
216
|
+
inset: 0;
|
|
217
|
+
width: 100%;
|
|
218
|
+
height: 100%;
|
|
219
|
+
overflow: visible;
|
|
220
|
+
z-index: 2;
|
|
221
|
+
pointer-events: none;
|
|
222
|
+
/* On the layer itself, so it blends with the page canvas below (a highlight darkens text, never hides
|
|
223
|
+
it). Inside the SVG it would only blend with the SVG's own empty backdrop. */
|
|
224
|
+
mix-blend-mode: multiply;
|
|
225
|
+
}
|
|
226
|
+
.pdfcedar-viewer .pl-annotations-html { position: absolute; inset: 0; z-index: 3; pointer-events: none; }
|
|
227
|
+
.pdfcedar-viewer .pl-annotations-html > * { position: absolute; box-sizing: border-box; }
|
|
228
|
+
|
|
229
|
+
/* Form fields: above the text layer, under annotations (the form layer comes first in the page). */
|
|
230
|
+
.pdfcedar-viewer .pl-forms { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
|
|
231
|
+
.pdfcedar-viewer .pl-field {
|
|
232
|
+
position: absolute;
|
|
233
|
+
box-sizing: border-box;
|
|
234
|
+
margin: 0;
|
|
235
|
+
padding: 0 calc(var(--total-scale-factor) * 2px);
|
|
236
|
+
pointer-events: auto;
|
|
237
|
+
font-family: Helvetica, Arial, sans-serif;
|
|
238
|
+
line-height: 1.15;
|
|
239
|
+
border: 1px solid var(--pl-field-border, transparent);
|
|
240
|
+
border-radius: 0;
|
|
241
|
+
/* Fillable fields get Acrobat's familiar tint over their own background. */
|
|
242
|
+
--pl-field-tint: rgb(204 215 255 / 0.55);
|
|
243
|
+
background: linear-gradient(var(--pl-field-tint), var(--pl-field-tint)), var(--pl-field-bg, transparent);
|
|
244
|
+
color: #000;
|
|
245
|
+
outline: none;
|
|
246
|
+
appearance: none;
|
|
247
|
+
-webkit-appearance: none;
|
|
248
|
+
}
|
|
249
|
+
.pdfcedar-viewer .pl-field:hover { --pl-field-tint: rgb(170 188 255 / 0.6); }
|
|
250
|
+
.pdfcedar-viewer .pl-field:focus { box-shadow: 0 0 0 2px var(--pl-accent); }
|
|
251
|
+
.pdfcedar-viewer textarea.pl-field { resize: none; padding-top: calc(var(--total-scale-factor) * 2px); overflow: auto; }
|
|
252
|
+
.pdfcedar-viewer select.pl-field-dropdown {
|
|
253
|
+
/* A small caret, since appearance: none removes the native one. */
|
|
254
|
+
background:
|
|
255
|
+
linear-gradient(45deg, transparent 50%, currentColor 50%) no-repeat right calc(var(--total-scale-factor) * 9px) center / calc(var(--total-scale-factor) * 4px) calc(var(--total-scale-factor) * 4px),
|
|
256
|
+
linear-gradient(-45deg, transparent 50%, currentColor 50%) no-repeat right calc(var(--total-scale-factor) * 5px) center / calc(var(--total-scale-factor) * 4px) calc(var(--total-scale-factor) * 4px),
|
|
257
|
+
linear-gradient(var(--pl-field-tint), var(--pl-field-tint)),
|
|
258
|
+
var(--pl-field-bg, transparent);
|
|
259
|
+
}
|
|
260
|
+
.pdfcedar-viewer .pl-field-checkbox,
|
|
261
|
+
.pdfcedar-viewer .pl-field-radio { display: grid; place-content: center; cursor: pointer; padding: 0; }
|
|
262
|
+
.pdfcedar-viewer .pl-field-radio { border-radius: 50%; }
|
|
263
|
+
.pdfcedar-viewer .pl-field-checkbox::before,
|
|
264
|
+
.pdfcedar-viewer .pl-field-radio::before {
|
|
265
|
+
content: '';
|
|
266
|
+
width: calc(var(--total-scale-factor) * 9px);
|
|
267
|
+
height: calc(var(--total-scale-factor) * 9px);
|
|
268
|
+
background: currentColor;
|
|
269
|
+
transform: scale(0);
|
|
270
|
+
}
|
|
271
|
+
.pdfcedar-viewer .pl-field-checkbox::before { clip-path: polygon(12% 52%, 0 66%, 38% 100%, 100% 18%, 86% 4%, 38% 72%); }
|
|
272
|
+
.pdfcedar-viewer .pl-field-radio::before { border-radius: 50%; }
|
|
273
|
+
.pdfcedar-viewer .pl-field-checkbox:checked::before,
|
|
274
|
+
.pdfcedar-viewer .pl-field-radio:checked::before { transform: scale(1); }
|
|
275
|
+
/* Read-only and flattened fields look like the printed page. */
|
|
276
|
+
.pdfcedar-viewer .pl-field:disabled { --pl-field-tint: transparent; opacity: 1; cursor: default; -webkit-text-fill-color: currentColor; }
|
|
277
|
+
.pdfcedar-viewer .pl-field-flattened { border-color: transparent; }
|
|
278
|
+
/* While drawing, fields let the pointer through to the page. */
|
|
279
|
+
.pdfcedar-viewer:is([data-tool='note'], [data-tool='ink'], [data-tool='rectangle'], [data-tool='ellipse'], [data-tool='line'], [data-tool='arrow'], [data-tool='freeText'], [data-tool='signature'], [data-tool='redaction']) .pl-field {
|
|
280
|
+
pointer-events: none;
|
|
281
|
+
}
|
|
282
|
+
.pdfcedar-viewer[data-tool='select'] .pl-annot,
|
|
283
|
+
.pdfcedar-viewer[data-tool='select'] .pl-annot .pl-hit,
|
|
284
|
+
.pdfcedar-viewer[data-tool='select'] .pl-annot .pl-hit-area,
|
|
285
|
+
.pdfcedar-viewer[data-tool='select'] .pl-annot .pl-markup { pointer-events: auto; cursor: pointer; }
|
|
286
|
+
.pdfcedar-viewer[data-tool='select'] .pl-annot :is(rect, ellipse, line, path, polygon):not([fill='none']) { pointer-events: auto; }
|
|
287
|
+
.pdfcedar-viewer .pl-note { display: grid; place-items: center; }
|
|
288
|
+
.pdfcedar-viewer .pl-note svg { width: 100%; height: 100%; filter: drop-shadow(0 1px 1px rgb(0 0 0 / 0.25)); }
|
|
289
|
+
.pdfcedar-viewer .pl-note-badge {
|
|
290
|
+
position: absolute;
|
|
291
|
+
right: -6px;
|
|
292
|
+
top: -6px;
|
|
293
|
+
min-width: 14px;
|
|
294
|
+
padding: 0 3px;
|
|
295
|
+
border-radius: 7px;
|
|
296
|
+
background: var(--pl-accent);
|
|
297
|
+
color: #fff;
|
|
298
|
+
font: 600 10px/14px var(--pl-font);
|
|
299
|
+
text-align: center;
|
|
300
|
+
}
|
|
301
|
+
/* Signatures: the image fills its box exactly (its proportions are kept by placement and resizing). */
|
|
302
|
+
.pdfcedar-viewer .pl-signature img { display: block; width: 100%; height: 100%; user-select: none; -webkit-user-select: none; pointer-events: none; }
|
|
303
|
+
.pdfcedar-viewer .pl-freetext {
|
|
304
|
+
padding: 0.15em 0.25em;
|
|
305
|
+
border: 1px solid transparent;
|
|
306
|
+
font-family: Helvetica, Arial, sans-serif;
|
|
307
|
+
line-height: 1.2;
|
|
308
|
+
white-space: pre-wrap;
|
|
309
|
+
overflow-wrap: anywhere;
|
|
310
|
+
overflow: hidden;
|
|
311
|
+
}
|
|
312
|
+
.pdfcedar-viewer .pl-freetext[contenteditable='true'] {
|
|
313
|
+
overflow: visible;
|
|
314
|
+
outline: 2px solid var(--pl-accent);
|
|
315
|
+
cursor: text;
|
|
316
|
+
pointer-events: auto;
|
|
317
|
+
background: color-mix(in srgb, #fff 85%, transparent);
|
|
318
|
+
}
|
|
319
|
+
.pdfcedar-viewer .pl-selection {
|
|
320
|
+
outline: 1.5px solid var(--pl-accent);
|
|
321
|
+
outline-offset: 2px;
|
|
322
|
+
pointer-events: none;
|
|
323
|
+
}
|
|
324
|
+
.pdfcedar-viewer .pl-selection-line { outline: 1px dashed color-mix(in srgb, var(--pl-accent) 60%, transparent); }
|
|
325
|
+
.pdfcedar-viewer .pl-handle {
|
|
326
|
+
position: absolute;
|
|
327
|
+
width: 10px;
|
|
328
|
+
height: 10px;
|
|
329
|
+
margin: -5px 0 0 -5px;
|
|
330
|
+
background: #fff;
|
|
331
|
+
border: 1.5px solid var(--pl-accent);
|
|
332
|
+
border-radius: 2px;
|
|
333
|
+
pointer-events: auto;
|
|
334
|
+
touch-action: none;
|
|
335
|
+
}
|
|
336
|
+
/* Touch screens: finger-sized handles, and the selected annotation drags by its selection box. */
|
|
337
|
+
@media (pointer: coarse) {
|
|
338
|
+
.pdfcedar-viewer .pl-handle { width: 22px; height: 22px; margin: -11px 0 0 -11px; border-radius: 50%; }
|
|
339
|
+
.pdfcedar-viewer .pl-selection:not(.pl-selection-line) { pointer-events: auto; touch-action: none; }
|
|
340
|
+
}
|
|
341
|
+
.pdfcedar-viewer .pl-handle[data-handle='nw'] { left: 0; top: 0; cursor: nwse-resize; }
|
|
342
|
+
.pdfcedar-viewer .pl-handle[data-handle='n'] { left: 50%; top: 0; cursor: ns-resize; }
|
|
343
|
+
.pdfcedar-viewer .pl-handle[data-handle='ne'] { left: 100%; top: 0; cursor: nesw-resize; }
|
|
344
|
+
.pdfcedar-viewer .pl-handle[data-handle='e'] { left: 100%; top: 50%; cursor: ew-resize; }
|
|
345
|
+
.pdfcedar-viewer .pl-handle[data-handle='se'] { left: 100%; top: 100%; cursor: nwse-resize; }
|
|
346
|
+
.pdfcedar-viewer .pl-handle[data-handle='s'] { left: 50%; top: 100%; cursor: ns-resize; }
|
|
347
|
+
.pdfcedar-viewer .pl-handle[data-handle='sw'] { left: 0; top: 100%; cursor: nesw-resize; }
|
|
348
|
+
.pdfcedar-viewer .pl-handle[data-handle='w'] { left: 0; top: 50%; cursor: ew-resize; }
|
|
349
|
+
.pdfcedar-viewer .pl-handle:is([data-handle='start'], [data-handle='end']) { border-radius: 50%; cursor: move; }
|
|
350
|
+
.pdfcedar-viewer .pl-annot.pl-dragging { cursor: grabbing; }
|
|
351
|
+
/* Drawing tools: the page itself takes the pointer, and text can't be selected by accident. */
|
|
352
|
+
.pdfcedar-viewer:is([data-tool='note'], [data-tool='ink'], [data-tool='rectangle'], [data-tool='ellipse'], [data-tool='line'], [data-tool='arrow'], [data-tool='freeText'], [data-tool='signature'], [data-tool='redaction']) .pl-page {
|
|
353
|
+
cursor: crosshair;
|
|
354
|
+
touch-action: none;
|
|
355
|
+
}
|
|
356
|
+
.pdfcedar-viewer:is([data-tool='note'], [data-tool='ink'], [data-tool='rectangle'], [data-tool='ellipse'], [data-tool='line'], [data-tool='arrow'], [data-tool='freeText'], [data-tool='signature'], [data-tool='redaction']) .textLayer {
|
|
357
|
+
pointer-events: none;
|
|
358
|
+
user-select: none;
|
|
359
|
+
-webkit-user-select: none;
|
|
360
|
+
}
|
|
361
|
+
.pdfcedar-viewer[data-tool='freeText'] .pl-page { cursor: text; }
|
|
362
|
+
/* The annotation tools sit inside the main toolbar, so they lose their own bar styling. */
|
|
363
|
+
.pdfcedar-viewer pl-annotation-toolbar { --pl-annotation-toolbar-border: none; }
|
|
364
|
+
|
|
365
|
+
.pdfcedar-viewer .pl-message {
|
|
366
|
+
margin: auto;
|
|
367
|
+
padding: 24px;
|
|
368
|
+
max-width: 480px;
|
|
369
|
+
text-align: center;
|
|
370
|
+
color: var(--pl-muted);
|
|
371
|
+
}
|
|
372
|
+
`;function Kd(e=document){if(e.getElementById(Wd))return;let t=e.createElement(`style`);t.id=Wd,t.textContent=Gd,e.head.append(t)}function qd(e,t){if(t===void 0||typeof t==`string`)e.dataset.theme=t??`light`;else{e.dataset.theme=`custom`;for(let[n,r]of Object.entries(t))e.style.setProperty(n,r)}}var Jd=`pl-thumbnails`,Yd=112,Xd=`
|
|
373
|
+
:host { display: flex; flex-direction: column; min-height: 0; font: 12px var(--pl-font); }
|
|
374
|
+
:host([hidden]) { display: none; }
|
|
375
|
+
.scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
|
|
376
|
+
ol { list-style: none; margin: 0; padding: 12px 0; }
|
|
377
|
+
li { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 6px 0; position: relative; }
|
|
378
|
+
.thumb { position: relative; }
|
|
379
|
+
.page {
|
|
380
|
+
all: unset;
|
|
381
|
+
cursor: pointer;
|
|
382
|
+
display: block;
|
|
383
|
+
background: #fff;
|
|
384
|
+
box-shadow: var(--pl-page-shadow);
|
|
385
|
+
outline: 2px solid transparent;
|
|
386
|
+
outline-offset: 2px;
|
|
387
|
+
border-radius: 2px;
|
|
388
|
+
overflow: hidden;
|
|
389
|
+
touch-action: none;
|
|
390
|
+
}
|
|
391
|
+
.page:focus-visible { outline-color: var(--pl-accent); }
|
|
392
|
+
li[aria-current='page'] .page { outline-color: var(--pl-accent); }
|
|
393
|
+
canvas { display: block; width: 100%; height: 100%; }
|
|
394
|
+
.num { color: var(--pl-muted); }
|
|
395
|
+
li[aria-current='page'] .num { color: var(--pl-accent); font-weight: 600; }
|
|
396
|
+
.tools { position: absolute; top: 4px; right: 4px; display: none; gap: 2px; }
|
|
397
|
+
:host([data-page-tools]) li:is(:hover, :focus-within) .tools { display: flex; }
|
|
398
|
+
.tool {
|
|
399
|
+
all: unset;
|
|
400
|
+
display: grid;
|
|
401
|
+
place-items: center;
|
|
402
|
+
width: 24px;
|
|
403
|
+
height: 24px;
|
|
404
|
+
border-radius: 6px;
|
|
405
|
+
cursor: pointer;
|
|
406
|
+
background: var(--pl-surface);
|
|
407
|
+
color: var(--pl-text);
|
|
408
|
+
box-shadow: 0 1px 3px rgb(0 0 0 / 0.25);
|
|
409
|
+
}
|
|
410
|
+
.tool:hover { color: var(--pl-accent); }
|
|
411
|
+
.tool:focus-visible { outline: 2px solid var(--pl-accent); }
|
|
412
|
+
.tool svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
|
|
413
|
+
li.dragging { opacity: 0.4; }
|
|
414
|
+
li.drop-before::before, li.drop-after::after {
|
|
415
|
+
content: '';
|
|
416
|
+
position: absolute;
|
|
417
|
+
left: 16px;
|
|
418
|
+
right: 16px;
|
|
419
|
+
height: 3px;
|
|
420
|
+
border-radius: 2px;
|
|
421
|
+
background: var(--pl-accent);
|
|
422
|
+
}
|
|
423
|
+
li.drop-before::before { top: -2px; }
|
|
424
|
+
li.drop-after::after { bottom: -2px; }
|
|
425
|
+
footer { flex: none; padding: 8px; border-top: 1px solid var(--pl-border); display: none; }
|
|
426
|
+
:host([data-page-tools]) footer { display: block; }
|
|
427
|
+
footer button {
|
|
428
|
+
width: 100%;
|
|
429
|
+
font: inherit;
|
|
430
|
+
padding: 6px;
|
|
431
|
+
border: 1px dashed var(--pl-border);
|
|
432
|
+
border-radius: 6px;
|
|
433
|
+
background: transparent;
|
|
434
|
+
color: var(--pl-text);
|
|
435
|
+
cursor: pointer;
|
|
436
|
+
}
|
|
437
|
+
footer button:hover { border-color: var(--pl-accent); color: var(--pl-accent); }
|
|
438
|
+
`,Zd=`<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M20 11a8 8 0 1 1-2.3-5.6M20 4v5h-5"/></svg>`,Qd=`<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M4 7h16M9 7V4h6v3M6 7l1 13h10l1-13"/></svg>`,$d=6;function ef(){if(customElements.get(`pl-thumbnails`))return;class e extends HTMLElement{onSelect=null;onRotate=null;onDelete=null;onMove=null;onMerge=null;source=null;pageTools=!1;suppressClick=!1;scroller;items=[];list;observer=null;queue=new Set;rendered=new Set;abort=new AbortController;busy=!1;current=0;constructor(){super();let e=this.attachShadow({mode:`open`}),t=document.createElement(`style`);t.textContent=Xd,this.list=document.createElement(`ol`),this.list.setAttribute(`aria-label`,`Pages`),this.scroller=document.createElement(`div`),this.scroller.className=`scroll`,this.scroller.append(this.list);let n=document.createElement(`footer`);n.innerHTML=`<button type="button">Add pages from a PDF…</button><input type="file" accept="application/pdf,.pdf" hidden />`,e.append(t,this.scroller,n);let r=n.querySelector(`input`);n.querySelector(`button`).addEventListener(`click`,()=>r.click()),r.addEventListener(`change`,()=>{let e=r.files?.[0];r.value=``,e&&this.onMerge?.(e)}),this.list.addEventListener(`click`,e=>{let t=e.target,n=t.closest(`li`);if(!n||this.suppressClick)return;let r=Number(n.dataset.index),i=t.closest(`.tool`)?.dataset.tool;i===`rotate`?this.onRotate?.(r):i===`delete`?this.onDelete?.(r):this.onSelect?.(r)}),this.list.addEventListener(`keydown`,e=>{if(!this.pageTools||!e.altKey||e.key!==`ArrowUp`&&e.key!==`ArrowDown`)return;let t=e.target.closest(`li`);if(!t)return;e.preventDefault();let n=Number(t.dataset.index),r=n+(e.key===`ArrowUp`?-1:1);r>=0&&r<this.items.length&&(this.onMove?.(n,r),requestAnimationFrame(()=>this.items[r]?.querySelector(`.page`)?.focus()))}),this.list.addEventListener(`pointerdown`,e=>this.startDrag(e))}setPageTools(e){this.pageTools=e,this.toggleAttribute(`data-page-tools`,e)}startDrag(e){let t=e.target.closest(`li`);if(!this.pageTools||!t||e.button!==0||e.target.closest(`.tool`))return;let n=Number(t.dataset.index),r=e.clientY,i=!1,a=n,o=()=>this.items.forEach(e=>e.classList.remove(`drop-before`,`drop-after`,`dragging`)),s=e=>{if(!i&&Math.abs(e.clientY-r)<$d)return;i=!0,o(),t.classList.add(`dragging`);let s=this.items.filter((e,t)=>t!==n);a=s.filter(t=>{let n=t.getBoundingClientRect();return n.top+n.height/2<e.clientY}).length,a<s.length?s[a].classList.add(`drop-before`):s.at(-1)?.classList.add(`drop-after`);let c=this.scroller.getBoundingClientRect();e.clientY<c.top+30?this.scroller.scrollTop-=12:e.clientY>c.bottom-30&&(this.scroller.scrollTop+=12)},c=()=>{document.removeEventListener(`pointermove`,s),document.removeEventListener(`pointerup`,c),document.removeEventListener(`pointercancel`,c),o(),i&&(this.suppressClick=!0,setTimeout(()=>this.suppressClick=!1,0),a!==n&&this.onMove?.(n,a))};document.addEventListener(`pointermove`,s),document.addEventListener(`pointerup`,c),document.addEventListener(`pointercancel`,c)}disconnectedCallback(){this.observer?.disconnect(),this.abort.abort()}setSource(e){this.observer?.disconnect(),this.abort.abort(),this.abort=new AbortController,this.queue.clear(),this.rendered.clear(),this.source=e,this.items=Array.from({length:e.pageCount},(e,t)=>{let n=document.createElement(`li`);n.dataset.index=String(t);let r=document.createElement(`div`);r.className=`thumb`;let i=document.createElement(`button`);i.type=`button`,i.className=`page`,i.setAttribute(`aria-label`,`Page ${t+1}`);let a=document.createElement(`div`);a.className=`tools`,a.innerHTML=`<button type="button" class="tool" data-tool="rotate" aria-label="Rotate page ${t+1}" title="Rotate clockwise">${Zd}</button><button type="button" class="tool" data-tool="delete" aria-label="Delete page ${t+1}" title="Delete page">${Qd}</button>`,r.append(i,a);let o=document.createElement(`span`);return o.className=`num`,o.textContent=String(t+1),n.append(r,o),n}),this.list.replaceChildren(...this.items),this.refreshSizes(),this.observer=new IntersectionObserver(e=>this.onIntersect(e),{root:this.scroller,rootMargin:`300px 0px`});for(let e of this.items)this.observer.observe(e);this.setCurrentPage(this.current<e.pageCount?this.current:0)}refreshSizes(){this.source&&(this.items.forEach((e,t)=>{let n=this.source.pageSize(t);if(!n)return;let r=e.querySelector(`.page`),i=Math.round(Yd*n.height/n.width);r.style.height!==`${i}px`&&this.rendered.has(t)&&(this.rendered.delete(t),r.replaceChildren(),this.queue.add(t)),r.style.width=`${Yd}px`,r.style.height=`${i}px`}),this.drain())}invalidate(e){for(let t of e)this.rendered.delete(t)&&this.queue.add(t);this.drain()}setCurrentPage(e){this.items[this.current]?.removeAttribute(`aria-current`),this.current=e;let t=this.items[e];if(!t)return;t.setAttribute(`aria-current`,`page`);let{scroller:n}=this,r=t.offsetTop,i=r+t.offsetHeight;r<n.scrollTop?n.scrollTop=r-8:i>n.scrollTop+n.clientHeight&&(n.scrollTop=i-n.clientHeight+8)}onIntersect(e){for(let t of e){let e=Number(t.target.dataset.index);t.isIntersecting&&!this.rendered.has(e)?this.queue.add(e):this.queue.delete(e)}this.drain()}async drain(){if(this.busy||!this.source)return;this.busy=!0;let{signal:e}=this.abort;try{for(;this.queue.size>0&&!e.aborted;){let t=[...this.queue].sort((e,t)=>Math.abs(e-this.current)-Math.abs(t-this.current))[0];this.queue.delete(t);let n=await this.source.render(t,Yd,e).catch(e=>(console.error(`[pdfcedar] thumbnail ${t+1} failed`,e),null));n&&!e.aborted&&(this.items[t]?.querySelector(`.page`)?.replaceChildren(n),this.rendered.add(t))}}finally{this.busy=!1,this.queue.size>0&&!this.abort.signal.aborted&&this.drain()}}}customElements.define(Jd,e)}function tf(){return ef(),document.createElement(Jd)}var nf=`pl-search-bar`,rf=200,af=`
|
|
439
|
+
:host {
|
|
440
|
+
position: absolute;
|
|
441
|
+
top: 8px;
|
|
442
|
+
right: 20px;
|
|
443
|
+
z-index: 10;
|
|
444
|
+
display: flex;
|
|
445
|
+
align-items: center;
|
|
446
|
+
gap: 4px;
|
|
447
|
+
padding: 4px 4px 4px 8px;
|
|
448
|
+
background: var(--pl-surface);
|
|
449
|
+
color: var(--pl-text);
|
|
450
|
+
border: 1px solid var(--pl-border);
|
|
451
|
+
border-radius: 8px;
|
|
452
|
+
box-shadow: 0 4px 12px rgb(0 0 0 / 0.15);
|
|
453
|
+
font: 13px var(--pl-font);
|
|
454
|
+
}
|
|
455
|
+
:host(:not([open])) { display: none; }
|
|
456
|
+
input {
|
|
457
|
+
width: 180px;
|
|
458
|
+
border: none;
|
|
459
|
+
outline: none;
|
|
460
|
+
background: transparent;
|
|
461
|
+
color: inherit;
|
|
462
|
+
font: inherit;
|
|
463
|
+
}
|
|
464
|
+
input::-webkit-search-cancel-button { display: none; } /* we have our own close button */
|
|
465
|
+
output { min-width: 56px; text-align: right; color: var(--pl-muted); font-variant-numeric: tabular-nums; }
|
|
466
|
+
button {
|
|
467
|
+
all: unset;
|
|
468
|
+
display: grid;
|
|
469
|
+
place-items: center;
|
|
470
|
+
width: 26px;
|
|
471
|
+
height: 26px;
|
|
472
|
+
border-radius: 6px;
|
|
473
|
+
cursor: pointer;
|
|
474
|
+
color: var(--pl-text);
|
|
475
|
+
}
|
|
476
|
+
button:hover { background: color-mix(in srgb, var(--pl-text) 10%, transparent); }
|
|
477
|
+
button:focus-visible { outline: 2px solid var(--pl-accent); }
|
|
478
|
+
button:disabled { opacity: 0.35; cursor: default; background: none; }
|
|
479
|
+
svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
|
|
480
|
+
`,of=e=>`<svg viewBox="0 0 24 24" aria-hidden="true"><path d="${e}"/></svg>`;function sf(){if(customElements.get(`pl-search-bar`))return;class e extends HTMLElement{onQuery=null;onNext=null;onPrevious=null;onClose=null;input;output;prev;next;timer;lastQuery=``;constructor(){super();let e=this.attachShadow({mode:`open`});e.innerHTML=`
|
|
481
|
+
<style>${af}</style>
|
|
482
|
+
<input type="search" placeholder="Find in document" aria-label="Find in document" autocomplete="off" spellcheck="false" />
|
|
483
|
+
<output aria-live="polite"></output>
|
|
484
|
+
<button type="button" data-action="previous" aria-label="Previous match" title="Previous (Shift+Enter)">${of(`M18 15l-6-6-6 6`)}</button>
|
|
485
|
+
<button type="button" data-action="next" aria-label="Next match" title="Next (Enter)">${of(`M6 9l6 6 6-6`)}</button>
|
|
486
|
+
<button type="button" data-action="close" aria-label="Close search" title="Close (Esc)">${of(`M18 6L6 18M6 6l12 12`)}</button>`,this.input=e.querySelector(`input`),this.output=e.querySelector(`output`),this.prev=e.querySelector(`[data-action="previous"]`),this.next=e.querySelector(`[data-action="next"]`),this.input.addEventListener(`input`,()=>{clearTimeout(this.timer),this.timer=setTimeout(()=>this.submit(),rf)}),this.input.addEventListener(`keydown`,e=>{e.key===`Enter`?(e.preventDefault(),this.input.value===this.lastQuery?e.shiftKey?this.onPrevious?.():this.onNext?.():this.submit()):e.key===`Escape`&&(e.preventDefault(),this.close())}),e.addEventListener(`click`,e=>{let t=e.target.closest(`button`)?.dataset.action;t===`next`?this.onNext?.():t===`previous`?this.onPrevious?.():t===`close`&&this.close()})}connectedCallback(){this.setAttribute(`role`,`search`)}get isOpen(){return this.hasAttribute(`open`)}open(e){this.setAttribute(`open`,``),e!==void 0&&(this.input.value=e,this.lastQuery=e),this.input.focus(),this.input.select()}close(){this.isOpen&&(clearTimeout(this.timer),this.removeAttribute(`open`),this.lastQuery=``,this.onClose?.())}setStatus({total:e,current:t,searching:n}){let r=this.input.value.trim()!==``;this.output.textContent=r?e===0?n?`…`:`No results`:`${t+1} / ${e}${n?`+`:``}`:``,this.prev.disabled=e===0,this.next.disabled=e===0}submit(){clearTimeout(this.timer),this.lastQuery=this.input.value,this.onQuery?.(this.input.value)}}customElements.define(nf,e)}function cf(){return sf(),document.createElement(nf)}var lf=`pl-annotation-toolbar`,uf=[`select`,`highlight`,`underline`,`strikeout`,`note`,`ink`,`rectangle`,`ellipse`,`line`,`arrow`,`freeText`,`signature`,`redaction`];function df(e,t){let n=0,r=0;for(let e of t){if(e instanceof HTMLStyleElement)continue;let t=getComputedStyle(e);t.display!==`none`&&t.position!==`absolute`&&(n+=e.getBoundingClientRect().width+parseFloat(t.marginLeft)+parseFloat(t.marginRight),r++)}let i=parseFloat(getComputedStyle(e).columnGap)||0;return n+i*Math.max(0,r-1)}var ff=[`#ffd400`,`#f97316`,`#e11d48`,`#a855f7`,`#2563eb`,`#16a34a`,`#111827`],pf=[1,2,4,8],mf={select:`Select`,highlight:`Highlight`,underline:`Underline`,strikeout:`Strikeout`,note:`Note`,ink:`Draw`,rectangle:`Rectangle`,ellipse:`Ellipse`,line:`Line`,arrow:`Arrow`,freeText:`Text box`,signature:`Signature`,redaction:`Redact`},hf={select:`M5 3l14 8-6 1.5L10 19z`,highlight:`M4 20h16M7 15l7-11 4 3-7 11H7z`,underline:`M7 4v7a5 5 0 0 0 10 0V4M5 20h14`,strikeout:`M5 12h14M16 6.5C15 5 13.6 4.5 12 4.5c-2.5 0-4 1.3-4 3 0 4 8 2.8 8 7.5 0 2-1.8 3.5-4.2 3.5-1.8 0-3.3-.7-4.3-2`,note:`M4 4h16v12H9l-5 4z`,ink:`M3 17c3-6 5 4 8-2s5-8 10-6`,rectangle:`M4 6h16v12H4z`,ellipse:`M12 6c4.4 0 8 2.7 8 6s-3.6 6-8 6-8-2.7-8-6 3.6-6 8-6z`,line:`M5 19L19 5`,arrow:`M5 19L19 5M10 5h9v9`,freeText:`M5 6V4h14v2M12 4v16M9 20h6`,signature:`M3 17c2.5 0 3.5-9 6-9s1 8 3.5 8 2-4 4-4 1.5 3 4.5 3M3 21h18`,redaction:`M4 6h16v5H4zM4 14h7v4H4zM14 15h6`,comment:`M4 5h16v11H9l-5 4zM8 9h8M8 12h5`,delete:`M4 7h16M9 7V4h6v3M6 7l1 13h10l1-13`,undo:`M9 14L4 9l5-5M4 9h10a6 6 0 0 1 0 12h-3`,redo:`M15 14l5-5-5-5M20 9H10a6 6 0 0 0 0 12h3`},gf=new Set([`ink`,`rectangle`,`ellipse`,`line`,`arrow`]);function _f(e){return gf.has(e)}var vf=e=>`<svg viewBox="0 0 24 24" aria-hidden="true"><path d="${hf[e]}"/></svg>`,yf=`
|
|
487
|
+
:host {
|
|
488
|
+
display: flex;
|
|
489
|
+
flex-wrap: wrap;
|
|
490
|
+
align-items: center;
|
|
491
|
+
gap: 2px;
|
|
492
|
+
padding: 0;
|
|
493
|
+
background: transparent;
|
|
494
|
+
border-bottom: var(--pl-annotation-toolbar-border, 1px solid var(--pl-border));
|
|
495
|
+
font: 13px var(--pl-font);
|
|
496
|
+
color: var(--pl-text);
|
|
497
|
+
}
|
|
498
|
+
.group { display: flex; align-items: center; gap: 2px; }
|
|
499
|
+
.sep { width: 1px; align-self: stretch; margin: 4px 6px; background: var(--pl-border); }
|
|
500
|
+
button {
|
|
501
|
+
all: unset;
|
|
502
|
+
box-sizing: border-box;
|
|
503
|
+
display: grid;
|
|
504
|
+
place-items: center;
|
|
505
|
+
width: 30px;
|
|
506
|
+
height: 30px;
|
|
507
|
+
border-radius: 6px;
|
|
508
|
+
cursor: pointer;
|
|
509
|
+
}
|
|
510
|
+
button:hover:not(:disabled) { background: color-mix(in srgb, var(--pl-text) 9%, transparent); }
|
|
511
|
+
button:focus-visible { outline: 2px solid var(--pl-accent); outline-offset: -2px; }
|
|
512
|
+
button[aria-pressed='true'] { background: color-mix(in srgb, var(--pl-accent) 18%, transparent); color: var(--pl-accent); }
|
|
513
|
+
button:disabled { opacity: 0.35; cursor: default; }
|
|
514
|
+
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
|
|
515
|
+
.swatch { width: 22px; height: 22px; border-radius: 50%; }
|
|
516
|
+
.swatch span { width: 16px; height: 16px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgb(0 0 0 / 0.2); }
|
|
517
|
+
.swatch[aria-pressed='true'] { background: none; box-shadow: 0 0 0 2px var(--pl-accent); }
|
|
518
|
+
select {
|
|
519
|
+
height: 28px;
|
|
520
|
+
border: 1px solid var(--pl-border);
|
|
521
|
+
border-radius: 6px;
|
|
522
|
+
background: var(--pl-surface);
|
|
523
|
+
color: inherit;
|
|
524
|
+
font: inherit;
|
|
525
|
+
padding: 0 4px;
|
|
526
|
+
}
|
|
527
|
+
select:disabled { opacity: 0.35; }
|
|
528
|
+
button.apply { width: auto; padding: 0 10px; margin-left: 6px; border-radius: 6px; background: #b91c1c; color: #fff; font-weight: 600; white-space: nowrap; }
|
|
529
|
+
button.apply:hover { background: #991b1b; }
|
|
530
|
+
[hidden] { display: none !important; }
|
|
531
|
+
`;function bf(){if(customElements.get(`pl-annotation-toolbar`))return;class e extends HTMLElement{onTool=null;onColor=null;onStrokeWidth=null;onComment=null;onDelete=null;onUndo=null;onRedo=null;onApplyRedactions=null;root;constructor(){super(),this.root=this.attachShadow({mode:`open`});let e=uf.map(e=>`<button type="button" data-tool="${e}" aria-label="${mf[e]}" title="${mf[e]}" aria-pressed="false">${vf(e)}</button>`).join(``),t=ff.map(e=>`<button type="button" class="swatch" data-color="${e}" aria-label="Color ${e}" title="${e}" aria-pressed="false"><span style="background:${e}"></span></button>`).join(``),n=pf.map(e=>`<option value="${e}">${e} pt</option>`).join(``);this.root.innerHTML=`
|
|
532
|
+
<style>${yf}</style>
|
|
533
|
+
<div class="group" role="toolbar" aria-label="Annotation tools">${e}</div>
|
|
534
|
+
<div class="sep edit"></div>
|
|
535
|
+
<div class="group edit" role="group" aria-label="Color">${t}</div>
|
|
536
|
+
<select class="edit" aria-label="Line width" title="Line width">${n}</select>
|
|
537
|
+
<div class="sep edit"></div>
|
|
538
|
+
<div class="group edit">
|
|
539
|
+
<button type="button" data-action="comment" aria-label="Comment" title="Comment">${vf(`comment`)}</button>
|
|
540
|
+
<button type="button" data-action="delete" aria-label="Delete" title="Delete (Del)">${vf(`delete`)}</button>
|
|
541
|
+
</div>
|
|
542
|
+
<div class="sep edit"></div>
|
|
543
|
+
<div class="group edit">
|
|
544
|
+
<button type="button" data-action="undo" aria-label="Undo" title="Undo (Ctrl+Z)">${vf(`undo`)}</button>
|
|
545
|
+
<button type="button" data-action="redo" aria-label="Redo" title="Redo (Ctrl+Shift+Z)">${vf(`redo`)}</button>
|
|
546
|
+
</div>
|
|
547
|
+
<button type="button" class="apply" data-action="apply-redactions" hidden></button>`,this.root.addEventListener(`click`,e=>{let t=e.target.closest(`button`);if(!t||t.disabled)return;let{tool:n,color:r,action:i}=t.dataset;n?this.onTool?.(n):r?this.onColor?.(r):i===`comment`?this.onComment?.():i===`delete`?this.onDelete?.():i===`undo`?this.onUndo?.():i===`redo`?this.onRedo?.():i===`apply-redactions`&&this.onApplyRedactions?.()}),this.root.querySelector(`select`).addEventListener(`change`,e=>{this.onStrokeWidth?.(Number(e.target.value))}),this.root.addEventListener(`mousedown`,e=>{e.target.closest(`button`)&&e.preventDefault()})}setTools(e){for(let t of this.root.querySelectorAll(`[data-tool]`))t.hidden=!e.includes(t.dataset.tool)}setState(e){for(let t of this.root.querySelectorAll(`[data-tool]`))t.setAttribute(`aria-pressed`,String(t.dataset.tool===e.tool)),e.readOnly&&t.dataset.tool!==`select`&&(t.hidden=!0);for(let t of this.root.querySelectorAll(`[data-color]`))t.setAttribute(`aria-pressed`,String(t.dataset.color===e.color));let t=this.root.querySelector(`select`);if(t.querySelector(`[data-custom]`)?.remove(),!pf.includes(e.strokeWidth)){let n=new Option(`${e.strokeWidth} pt`,String(e.strokeWidth));n.dataset.custom=``;let r=[...t.options].find(t=>Number(t.value)>e.strokeWidth)??null;t.add(n,r)}t.value=String(e.strokeWidth),t.disabled=!e.strokeEnabled,this.root.querySelector(`[data-action="comment"]`).disabled=!e.hasSelection,this.root.querySelector(`[data-action="delete"]`).disabled=!e.hasSelection,this.root.querySelector(`[data-action="undo"]`).disabled=!e.canUndo,this.root.querySelector(`[data-action="redo"]`).disabled=!e.canRedo;for(let t of this.root.querySelectorAll(`.edit`))t.hidden=e.readOnly;let n=this.root.querySelector(`.apply`),r=n.hidden;n.hidden=e.readOnly||e.pendingRedactions===0,n.textContent=`Apply ${e.pendingRedactions} redaction${e.pendingRedactions===1?``:`s`}`,(n.hidden!==r||e.readOnly)&&this.dispatchEvent(new Event(`pl-resize`,{bubbles:!0}))}naturalWidth(){return df(this,this.root.children)}}customElements.define(lf,e)}function xf(){return bf(),document.createElement(lf)}var Sf=`pl-comment-thread`,Cf=400,wf=`
|
|
548
|
+
:host {
|
|
549
|
+
position: absolute;
|
|
550
|
+
z-index: 20;
|
|
551
|
+
width: 280px;
|
|
552
|
+
max-height: min(420px, 70%);
|
|
553
|
+
display: flex;
|
|
554
|
+
flex-direction: column;
|
|
555
|
+
background: var(--pl-surface);
|
|
556
|
+
color: var(--pl-text);
|
|
557
|
+
border: 1px solid var(--pl-border);
|
|
558
|
+
border-radius: 10px;
|
|
559
|
+
box-shadow: 0 10px 30px rgb(0 0 0 / 0.2);
|
|
560
|
+
font: 13px/1.4 var(--pl-font);
|
|
561
|
+
}
|
|
562
|
+
:host(:not([open])) { display: none; }
|
|
563
|
+
header { display: flex; align-items: center; gap: 8px; padding: 10px 12px 6px; }
|
|
564
|
+
header strong { flex: 1; }
|
|
565
|
+
.meta { color: var(--pl-muted); font-size: 12px; }
|
|
566
|
+
.body { overflow: auto; padding: 0 12px 8px; }
|
|
567
|
+
textarea {
|
|
568
|
+
box-sizing: border-box;
|
|
569
|
+
width: 100%;
|
|
570
|
+
min-height: 54px;
|
|
571
|
+
resize: vertical;
|
|
572
|
+
border: 1px solid var(--pl-border);
|
|
573
|
+
border-radius: 6px;
|
|
574
|
+
padding: 6px 8px;
|
|
575
|
+
background: transparent;
|
|
576
|
+
color: inherit;
|
|
577
|
+
font: inherit;
|
|
578
|
+
}
|
|
579
|
+
textarea:focus { outline: 2px solid var(--pl-accent); outline-offset: -1px; border-color: transparent; }
|
|
580
|
+
textarea[readonly] { border-color: transparent; padding: 0; resize: none; min-height: 0; }
|
|
581
|
+
ol { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
|
|
582
|
+
li { border-top: 1px solid var(--pl-border); padding-top: 8px; }
|
|
583
|
+
li .who { display: flex; align-items: baseline; gap: 6px; }
|
|
584
|
+
li .who b { font-weight: 600; }
|
|
585
|
+
li .who .meta { flex: 1; }
|
|
586
|
+
li p { margin: 2px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
|
|
587
|
+
footer { display: flex; gap: 6px; align-items: flex-end; padding: 8px 12px 10px; border-top: 1px solid var(--pl-border); }
|
|
588
|
+
footer textarea { min-height: 32px; flex: 1; }
|
|
589
|
+
button {
|
|
590
|
+
font: inherit;
|
|
591
|
+
border: 1px solid var(--pl-border);
|
|
592
|
+
border-radius: 6px;
|
|
593
|
+
background: var(--pl-surface);
|
|
594
|
+
color: inherit;
|
|
595
|
+
padding: 4px 10px;
|
|
596
|
+
cursor: pointer;
|
|
597
|
+
}
|
|
598
|
+
button.primary { background: var(--pl-accent); border-color: var(--pl-accent); color: #fff; }
|
|
599
|
+
button.icon { border: none; background: none; padding: 2px 6px; color: var(--pl-muted); }
|
|
600
|
+
button.icon:hover { color: var(--pl-text); }
|
|
601
|
+
button:disabled { opacity: 0.4; cursor: default; }
|
|
602
|
+
[hidden] { display: none !important; }
|
|
603
|
+
`,Tf=new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`short`});function Ef(e){let t=new Date(e);return`<time datetime="${e}">${Number.isNaN(t.getTime())?``:Tf.format(t)}</time>`}function Df(e){return e.replace(/[&<>"']/g,e=>`&#${e.charCodeAt(0)};`)}function Of(){if(customElements.get(`pl-comment-thread`))return;class e extends HTMLElement{onContents=null;onReply=null;onDeleteReply=null;onDelete=null;onClose=null;root;data=null;timer;constructor(){super(),this.root=this.attachShadow({mode:`open`}),this.root.innerHTML=`
|
|
604
|
+
<style>${wf}</style>
|
|
605
|
+
<header>
|
|
606
|
+
<strong data-part="label"></strong>
|
|
607
|
+
<button type="button" class="icon" data-action="close" aria-label="Close comment">✕</button>
|
|
608
|
+
</header>
|
|
609
|
+
<div class="body">
|
|
610
|
+
<div class="meta" data-part="meta"></div>
|
|
611
|
+
<textarea data-part="contents" aria-label="Comment" placeholder="Add a comment…"></textarea>
|
|
612
|
+
<ol data-part="replies" aria-label="Replies"></ol>
|
|
613
|
+
</div>
|
|
614
|
+
<footer data-part="footer">
|
|
615
|
+
<textarea data-part="reply" aria-label="Reply" placeholder="Reply…"></textarea>
|
|
616
|
+
<button type="button" class="primary" data-action="reply">Reply</button>
|
|
617
|
+
</footer>
|
|
618
|
+
<footer data-part="danger">
|
|
619
|
+
<button type="button" data-action="delete">Delete</button>
|
|
620
|
+
</footer>`;let e=this.$(`contents`);e.addEventListener(`input`,()=>{clearTimeout(this.timer),this.timer=setTimeout(()=>this.flush(),Cf)}),e.addEventListener(`blur`,()=>this.flush()),this.$(`reply`).addEventListener(`keydown`,e=>{e.key===`Enter`&&(e.ctrlKey||e.metaKey)&&(e.preventDefault(),this.submitReply())}),this.root.addEventListener(`keydown`,e=>{e.key===`Escape`&&(e.stopPropagation(),this.close()),e.stopPropagation()}),this.root.addEventListener(`click`,e=>{let t=e.target.closest(`button`);if(!t)return;let{action:n,replyId:r}=t.dataset;n===`close`?this.close():n===`reply`?this.submitReply():n===`delete`?this.onDelete?.():r&&this.onDeleteReply?.(r)}),this.addEventListener(`pointerdown`,e=>e.stopPropagation())}get isOpen(){return this.hasAttribute(`open`)}get threadId(){return this.isOpen?this.data?.root.id??null:null}open(e,t,n,r=null){this.isOpen&&this.data?.root.id!==e.root.id&&this.flush(),this.setAttribute(`open`,``),this.setAttribute(`role`,`dialog`),this.setAttribute(`aria-label`,`${e.root.label} comment thread`),this.style.left=`${t}px`,this.style.top=`${n}px`,this.$(`contents`).value=e.root.contents,this.$(`reply`).value=``,this.update(e),r&&this.$(r).focus()}update(e){this.data=e,this.$(`label`).textContent=e.root.label,this.$(`meta`).innerHTML=`${Df(e.root.author||`Unknown`)} · ${Ef(e.root.modifiedAt)}`;let t=this.$(`contents`);this.root.activeElement!==t&&(t.value=e.root.contents),t.readOnly=e.readOnly,t.hidden=e.readOnly&&e.root.contents===``,this.$(`replies`).innerHTML=e.replies.map(t=>`<li data-reply="${Df(t.id)}">
|
|
621
|
+
<div class="who"><b>${Df(t.author||`Unknown`)}</b><span class="meta">${Ef(t.modifiedAt)}</span>
|
|
622
|
+
${e.readOnly?``:`<button type="button" class="icon" data-reply-id="${Df(t.id)}" aria-label="Delete reply">✕</button>`}</div>
|
|
623
|
+
<p>${Df(t.contents)}</p>
|
|
624
|
+
</li>`).join(``),this.$(`footer`).hidden=e.readOnly,this.$(`danger`).hidden=e.readOnly}close(){this.isOpen&&(this.flush(),this.removeAttribute(`open`),this.onClose?.())}flush(){clearTimeout(this.timer);let e=this.$(`contents`).value;this.data&&!this.data.readOnly&&e!==this.data.root.contents&&(this.data={...this.data,root:{...this.data.root,contents:e}},this.onContents?.(e))}submitReply(){let e=this.$(`reply`),t=e.value.trim();t&&(e.value=``,this.onReply?.(t))}$(e){return this.root.querySelector(`[data-part="${e}"]`)}}customElements.define(Sf,e)}function kf(){return Of(),document.createElement(Sf)}var Af=`pl-main-toolbar`,jf=[.5,.75,1,1.25,1.5,2,3,4];function Mf(e,t){let n=.001;return t>0?jf.find(t=>t>e+n)??jf.at(-1):[...jf].reverse().find(t=>t<e-n)??jf[0]}var Nf={sidebar:`M4 5h16v14H4zM9 5v14`,prev:`M15 18l-6-6 6-6`,next:`M9 18l6-6-6-6`,zoomOut:`M5 12h14`,zoomIn:`M12 5v14M5 12h14`,search:`M11 4a7 7 0 1 1 0 14 7 7 0 0 1 0-14zM20 20l-4-4`,download:`M12 4v11M7 10l5 5 5-5M5 20h14`,print:`M7 9V4h10v5M7 17H5a1 1 0 0 1-1-1v-6a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v6a1 1 0 0 1-1 1h-2M7 14h10v6H7z`,annotate:`M4 20h4L19 9l-4-4L4 16zM13.5 6.5l4 4`,more:`M5 12h.01M12 12h.01M19 12h.01`},Pf=e=>`<svg viewBox="0 0 24 24" aria-hidden="true"><path d="${Nf[e]}"/></svg>`,Ff=`
|
|
625
|
+
:host {
|
|
626
|
+
display: flex;
|
|
627
|
+
align-items: center;
|
|
628
|
+
gap: 4px;
|
|
629
|
+
flex-wrap: wrap;
|
|
630
|
+
padding: 4px 8px;
|
|
631
|
+
min-height: 44px;
|
|
632
|
+
box-sizing: border-box;
|
|
633
|
+
background: var(--pl-surface);
|
|
634
|
+
color: var(--pl-text);
|
|
635
|
+
border-bottom: 1px solid var(--pl-border);
|
|
636
|
+
font: 13px var(--pl-font);
|
|
637
|
+
}
|
|
638
|
+
.group { display: flex; align-items: center; gap: 2px; }
|
|
639
|
+
.sep { width: 1px; align-self: stretch; margin: 6px 4px; background: var(--pl-border); }
|
|
640
|
+
.spacer { flex: 1; }
|
|
641
|
+
button {
|
|
642
|
+
all: unset;
|
|
643
|
+
box-sizing: border-box;
|
|
644
|
+
display: grid;
|
|
645
|
+
place-items: center;
|
|
646
|
+
width: 30px;
|
|
647
|
+
height: 30px;
|
|
648
|
+
border-radius: 6px;
|
|
649
|
+
cursor: pointer;
|
|
650
|
+
}
|
|
651
|
+
button:hover:not(:disabled) { background: color-mix(in srgb, var(--pl-text) 9%, transparent); }
|
|
652
|
+
button:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--pl-accent); outline-offset: -2px; }
|
|
653
|
+
button[aria-pressed='true'] { color: var(--pl-accent); background: color-mix(in srgb, var(--pl-accent) 15%, transparent); }
|
|
654
|
+
button:disabled { opacity: 0.35; cursor: default; }
|
|
655
|
+
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
|
|
656
|
+
input {
|
|
657
|
+
width: 3.2em;
|
|
658
|
+
height: 26px;
|
|
659
|
+
box-sizing: border-box;
|
|
660
|
+
text-align: center;
|
|
661
|
+
border: 1px solid var(--pl-border);
|
|
662
|
+
border-radius: 6px;
|
|
663
|
+
background: transparent;
|
|
664
|
+
color: inherit;
|
|
665
|
+
font: inherit;
|
|
666
|
+
-moz-appearance: textfield;
|
|
667
|
+
}
|
|
668
|
+
input::-webkit-inner-spin-button { display: none; }
|
|
669
|
+
.total { color: var(--pl-muted); padding: 0 4px; white-space: nowrap; font-variant-numeric: tabular-nums; }
|
|
670
|
+
select {
|
|
671
|
+
height: 28px;
|
|
672
|
+
border: 1px solid var(--pl-border);
|
|
673
|
+
border-radius: 6px;
|
|
674
|
+
background: var(--pl-surface);
|
|
675
|
+
color: inherit;
|
|
676
|
+
font: inherit;
|
|
677
|
+
padding: 0 4px;
|
|
678
|
+
}
|
|
679
|
+
::slotted(*) { flex: 0 1 auto; }
|
|
680
|
+
[hidden] { display: none !important; }
|
|
681
|
+
|
|
682
|
+
/* Compact (narrow viewers, e.g. phones): pinch replaces the zoom controls, the annotation tools fold into a second
|
|
683
|
+
row behind "Annotate", and search/download/print move into a "More" menu. */
|
|
684
|
+
.compact-only { display: none; }
|
|
685
|
+
:host([compact]) .compact-only { display: grid; }
|
|
686
|
+
:host([compact]) .wide-only,
|
|
687
|
+
:host([compact]) .sep { display: none; }
|
|
688
|
+
:host([compact]) ::slotted([slot='tools']) { display: none; }
|
|
689
|
+
/* Too narrow for one row: the annotation tools get a row of their own, so search/download/print stay top right. */
|
|
690
|
+
:host([split]:not([compact])) ::slotted([slot='tools']) { order: 10; flex: 1 0 100%; min-width: 0; }
|
|
691
|
+
:host([compact][tools-open]) ::slotted([slot='tools']) { display: flex; order: 10; flex: 1 0 100%; min-width: 0; }
|
|
692
|
+
:host([compact]) button { width: 36px; height: 36px; }
|
|
693
|
+
.more { position: relative; }
|
|
694
|
+
.menu {
|
|
695
|
+
position: absolute;
|
|
696
|
+
right: 0;
|
|
697
|
+
top: calc(100% + 4px);
|
|
698
|
+
z-index: 30;
|
|
699
|
+
min-width: 160px;
|
|
700
|
+
padding: 4px;
|
|
701
|
+
display: grid;
|
|
702
|
+
background: var(--pl-surface);
|
|
703
|
+
border: 1px solid var(--pl-border);
|
|
704
|
+
border-radius: 8px;
|
|
705
|
+
box-shadow: 0 8px 24px rgb(0 0 0 / 0.18);
|
|
706
|
+
}
|
|
707
|
+
.menu button { width: auto; height: 36px; display: flex; align-items: center; gap: 10px; justify-content: flex-start; padding: 0 10px; white-space: nowrap; }
|
|
708
|
+
.menu svg { flex: none; }
|
|
709
|
+
`;function If(){if(customElements.get(`pl-main-toolbar`))return;class e extends HTMLElement{onSidebarToggle=null;onPage=null;onZoom=null;onSearch=null;onDownload=null;onPrint=null;root;state={page:1,pageCount:1,zoom:1,fit:null,sidebarOpen:!0};constructor(){super(),this.root=this.attachShadow({mode:`open`});let e=jf.map(e=>`<option value="${e}">${Math.round(e*100)}%</option>`).join(``);this.root.innerHTML=`
|
|
710
|
+
<style>${Ff}</style>
|
|
711
|
+
<button type="button" data-action="sidebar" aria-label="Toggle sidebar" title="Sidebar">${Pf(`sidebar`)}</button>
|
|
712
|
+
<div class="sep"></div>
|
|
713
|
+
<div class="group" role="group" aria-label="Page navigation">
|
|
714
|
+
<button type="button" class="wide-only" data-action="prev" aria-label="Previous page" title="Previous page">${Pf(`prev`)}</button>
|
|
715
|
+
<input type="number" min="1" inputmode="numeric" aria-label="Page number" />
|
|
716
|
+
<span class="total"></span>
|
|
717
|
+
<button type="button" class="wide-only" data-action="next" aria-label="Next page" title="Next page">${Pf(`next`)}</button>
|
|
718
|
+
</div>
|
|
719
|
+
<div class="sep" data-feature="zoom"></div>
|
|
720
|
+
<div class="group wide-only" role="group" aria-label="Zoom" data-feature="zoom">
|
|
721
|
+
<button type="button" data-action="zoom-out" aria-label="Zoom out" title="Zoom out">${Pf(`zoomOut`)}</button>
|
|
722
|
+
<select aria-label="Zoom level">
|
|
723
|
+
<option value="width">Fit width</option>
|
|
724
|
+
<option value="page">Fit page</option>
|
|
725
|
+
${e}
|
|
726
|
+
<option value="custom" hidden></option>
|
|
727
|
+
</select>
|
|
728
|
+
<button type="button" data-action="zoom-in" aria-label="Zoom in" title="Zoom in">${Pf(`zoomIn`)}</button>
|
|
729
|
+
</div>
|
|
730
|
+
<div class="sep"></div>
|
|
731
|
+
<slot name="tools"></slot>
|
|
732
|
+
<div class="spacer"></div>
|
|
733
|
+
<slot name="presence"></slot>
|
|
734
|
+
<button type="button" class="compact-only" data-action="tools" aria-label="Annotate" title="Annotate" aria-pressed="false">${Pf(`annotate`)}</button>
|
|
735
|
+
<div class="more compact-only">
|
|
736
|
+
<button type="button" data-action="more" aria-label="More" title="More" aria-haspopup="menu" aria-expanded="false">${Pf(`more`)}</button>
|
|
737
|
+
<div class="menu" role="menu" hidden>
|
|
738
|
+
<button type="button" role="menuitem" data-action="search" data-feature="search">${Pf(`search`)}Search</button>
|
|
739
|
+
<button type="button" role="menuitem" data-action="download" data-feature="download">${Pf(`download`)}Download</button>
|
|
740
|
+
<button type="button" role="menuitem" data-action="print" data-feature="print">${Pf(`print`)}Print</button>
|
|
741
|
+
</div>
|
|
742
|
+
</div>
|
|
743
|
+
<div class="group wide-only">
|
|
744
|
+
<button type="button" data-action="search" data-feature="search" aria-label="Search" title="Search (Ctrl+F)">${Pf(`search`)}</button>
|
|
745
|
+
<button type="button" data-action="download" data-feature="download" aria-label="Download" title="Download">${Pf(`download`)}</button>
|
|
746
|
+
<button type="button" data-action="print" data-feature="print" aria-label="Print" title="Print">${Pf(`print`)}</button>
|
|
747
|
+
</div>`,this.root.addEventListener(`click`,e=>{let t=e.target.closest(`button`)?.dataset.action,{page:n,zoom:r}=this.state;if(t!==`more`&&this.setMenu(!1),t===`tools`){let e=!this.hasAttribute(`tools-open`);this.toggleAttribute(`tools-open`,e),this.button(`tools`).setAttribute(`aria-pressed`,String(e))}else t===`more`?this.setMenu(this.root.querySelector(`.menu`).hidden===!0):t===`sidebar`?this.onSidebarToggle?.():t===`prev`?this.onPage?.(n-1):t===`next`?this.onPage?.(n+1):t===`zoom-in`?this.onZoom?.(Mf(r,1)):t===`zoom-out`?this.onZoom?.(Mf(r,-1)):t===`search`?this.onSearch?.():t===`download`?this.onDownload?.():t===`print`&&this.onPrint?.()});let t=this.root.querySelector(`input`),n=()=>{let e=Number(t.value);Number.isInteger(e)&&e>=1&&e<=this.state.pageCount?this.onPage?.(e):t.value=String(this.state.page)};t.addEventListener(`change`,n),t.addEventListener(`keydown`,e=>{e.key===`Enter`&&(e.preventDefault(),n(),t.select())}),this.root.querySelector(`select`).addEventListener(`change`,e=>{let t=e.target.value;t===`width`||t===`page`?this.onZoom?.(t):t!==`custom`&&this.onZoom?.(Number(t))})}setCompact(e){this.toggleAttribute(`compact`,e),e||this.setMenu(!1),this.scheduleLayout()}resizeObserver=null;layoutFrame=0;connectedCallback(){this.resizeObserver??=new ResizeObserver(()=>this.scheduleLayout()),this.resizeObserver.observe(this),this.root.addEventListener(`slotchange`,this.scheduleLayout),this.addEventListener(`pl-resize`,this.scheduleLayout),this.scheduleLayout()}disconnectedCallback(){this.resizeObserver?.disconnect(),this.root.removeEventListener(`slotchange`,this.scheduleLayout),this.removeEventListener(`pl-resize`,this.scheduleLayout),cancelAnimationFrame(this.layoutFrame)}scheduleLayout=()=>{cancelAnimationFrame(this.layoutFrame),this.layoutFrame=requestAnimationFrame(()=>this.layout())};layout(){let e=this.querySelector(`[slot="tools"]`);if(!e||this.hasAttribute(`compact`))return void this.toggleAttribute(`split`,!1);let t=[...this.root.children].filter(e=>!(e instanceof HTMLSlotElement)&&!e.classList.contains(`spacer`)),n=[...this.querySelectorAll(`[slot="presence"]`)],r=parseFloat(getComputedStyle(this).columnGap)||0,i=getComputedStyle(this),a=this.clientWidth-parseFloat(i.paddingLeft)-parseFloat(i.paddingRight),o=df(this,[...t,...n])+r+(e.naturalWidth?.()??e.scrollWidth);this.toggleAttribute(`split`,o>a)}setMenu(e){let t=this.root.querySelector(`.menu`);if(t.hidden!==!e&&(t.hidden=!e,this.button(`more`).setAttribute(`aria-expanded`,String(e)),e)){let e=t=>{t instanceof KeyboardEvent&&t.key!==`Escape`||t.type===`pointerdown`&&t.composedPath().includes(this.root.querySelector(`.more`))||(this.setMenu(!1),document.removeEventListener(`pointerdown`,e,!0),document.removeEventListener(`keydown`,e,!0))};document.addEventListener(`pointerdown`,e,!0),document.addEventListener(`keydown`,e,!0),t.querySelector(`button:not([hidden])`)?.focus()}}setFeatures(e){for(let t of this.root.querySelectorAll(`[data-feature]`))t.hidden=!e[t.dataset.feature]}setState(e){this.state=e;let t=this.root.querySelector(`input`);this.root.activeElement!==t&&(t.value=String(e.page)),t.max=String(e.pageCount),this.root.querySelector(`.total`).textContent=`/ ${e.pageCount}`,this.button(`prev`).disabled=e.page<=1,this.button(`next`).disabled=e.page>=e.pageCount,this.button(`sidebar`).setAttribute(`aria-pressed`,String(e.sidebarOpen)),this.button(`zoom-in`).disabled=e.zoom>=jf.at(-1)-.001,this.button(`zoom-out`).disabled=e.zoom<=jf[0]+.001;let n=this.root.querySelector(`select`),r=jf.find(t=>Math.abs(t-e.zoom)<.001),i=n.querySelector(`option[value="custom"]`);i.textContent=`${Math.round(e.zoom*100)}%`,n.value=e.fit??(r===void 0?`custom`:String(r))}button(e){return this.root.querySelector(`[data-action="${e}"]`)}}customElements.define(Af,e)}function Lf(){return If(),document.createElement(Af)}var Rf=`pl-sidebar`,zf=`
|
|
748
|
+
:host {
|
|
749
|
+
display: flex;
|
|
750
|
+
flex-direction: column;
|
|
751
|
+
min-height: 0;
|
|
752
|
+
background: var(--pl-surface);
|
|
753
|
+
color: var(--pl-text);
|
|
754
|
+
border-right: 1px solid var(--pl-border);
|
|
755
|
+
font: 13px var(--pl-font);
|
|
756
|
+
}
|
|
757
|
+
:host([hidden]) { display: none; }
|
|
758
|
+
[role='tablist'] { display: flex; border-bottom: 1px solid var(--pl-border); flex: none; }
|
|
759
|
+
[role='tab'] {
|
|
760
|
+
all: unset;
|
|
761
|
+
flex: 1;
|
|
762
|
+
padding: 8px 4px;
|
|
763
|
+
text-align: center;
|
|
764
|
+
cursor: pointer;
|
|
765
|
+
color: var(--pl-muted);
|
|
766
|
+
border-bottom: 2px solid transparent;
|
|
767
|
+
}
|
|
768
|
+
[role='tab'][aria-selected='true'] { color: var(--pl-text); border-bottom-color: var(--pl-accent); font-weight: 600; }
|
|
769
|
+
[role='tab']:focus-visible { outline: 2px solid var(--pl-accent); outline-offset: -2px; }
|
|
770
|
+
.panels { flex: 1; min-height: 0; display: flex; }
|
|
771
|
+
::slotted(*) { flex: 1; min-height: 0; }
|
|
772
|
+
::slotted([hidden]) { display: none !important; }
|
|
773
|
+
`;function Bf(){if(customElements.get(`pl-sidebar`))return;class e extends HTMLElement{onTabChange=null;current=`pages`;root;constructor(){super(),this.root=this.attachShadow({mode:`open`}),this.root.innerHTML=`
|
|
774
|
+
<style>${zf}</style>
|
|
775
|
+
<div role="tablist" aria-label="Sidebar">
|
|
776
|
+
<button role="tab" id="tab-pages" data-tab="pages" aria-controls="pages">Pages</button>
|
|
777
|
+
<button role="tab" id="tab-comments" data-tab="comments" aria-controls="comments">Comments</button>
|
|
778
|
+
</div>
|
|
779
|
+
<div class="panels"><slot name="pages"></slot><slot name="comments"></slot></div>`,this.root.addEventListener(`click`,e=>{let t=e.target.closest(`[role="tab"]`)?.dataset.tab;t&&this.showTab(t)}),this.root.querySelector(`[role="tablist"]`).addEventListener(`keydown`,e=>{let t=e.key;(t===`ArrowLeft`||t===`ArrowRight`)&&(this.showTab(this.current===`pages`?`comments`:`pages`),this.root.querySelector(`[data-tab="${this.current}"]`).focus())})}connectedCallback(){this.showTab(this.current)}get tab(){return this.current}showTab(e){let t=e!==this.current;this.current=e;for(let t of this.root.querySelectorAll(`[role="tab"]`)){let n=t.dataset.tab===e;t.setAttribute(`aria-selected`,String(n)),t.tabIndex=n?0:-1}for(let t of this.children){let n=t.getAttribute(`slot`);(n===`pages`||n===`comments`)&&(t.hidden=n!==e,t.setAttribute(`role`,`tabpanel`))}t&&this.onTabChange?.(e)}}customElements.define(Rf,e)}function Vf(){return Bf(),document.createElement(Rf)}var Hf=`pl-comments-panel`,Uf=`
|
|
780
|
+
:host { display: block; overflow-y: auto; overscroll-behavior: contain; font: 13px/1.35 var(--pl-font); color: var(--pl-text); }
|
|
781
|
+
:host([hidden]) { display: none; }
|
|
782
|
+
.empty { padding: 24px 12px; text-align: center; color: var(--pl-muted); }
|
|
783
|
+
h3 { margin: 0; padding: 10px 12px 4px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--pl-muted); }
|
|
784
|
+
ul { list-style: none; margin: 0; padding: 0 6px 6px; }
|
|
785
|
+
button {
|
|
786
|
+
all: unset;
|
|
787
|
+
box-sizing: border-box;
|
|
788
|
+
display: block;
|
|
789
|
+
width: 100%;
|
|
790
|
+
padding: 8px;
|
|
791
|
+
border-radius: 8px;
|
|
792
|
+
cursor: pointer;
|
|
793
|
+
}
|
|
794
|
+
button:hover { background: color-mix(in srgb, var(--pl-text) 6%, transparent); }
|
|
795
|
+
button:focus-visible { outline: 2px solid var(--pl-accent); outline-offset: -2px; }
|
|
796
|
+
button[aria-current='true'] { background: color-mix(in srgb, var(--pl-accent) 14%, transparent); }
|
|
797
|
+
.head { display: flex; align-items: center; gap: 4px 6px; flex-wrap: wrap; }
|
|
798
|
+
.dot { width: 10px; height: 10px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgb(0 0 0 / 0.2); flex: none; }
|
|
799
|
+
.label { font-weight: 600; }
|
|
800
|
+
.meta { color: var(--pl-muted); font-size: 12px; flex-basis: 100%; }
|
|
801
|
+
.text { margin-top: 3px; color: var(--pl-text); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
|
|
802
|
+
.text:empty { display: none; }
|
|
803
|
+
.foot { margin-top: 3px; color: var(--pl-muted); font-size: 12px; }
|
|
804
|
+
`,Wf=new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`short`}),Gf=e=>e.replace(/[&<>"']/g,e=>`&#${e.charCodeAt(0)};`);function Kf(){if(customElements.get(`pl-comments-panel`))return;class e extends HTMLElement{onSelect=null;root;selected=null;constructor(){super(),this.root=this.attachShadow({mode:`open`}),this.root.innerHTML=`<style>${Uf}</style><div class="list"></div>`,this.root.addEventListener(`click`,e=>{let t=e.target.closest(`button[data-id]`)?.dataset.id;t&&this.onSelect?.(t)})}setItems(e){let t=this.root.querySelector(`.list`);if(e.length===0){t.innerHTML=`<p class="empty">No comments or markup yet.</p>`;return}let n=new Map;for(let t of e)n.set(t.page,[...n.get(t.page)??[],t]);t.innerHTML=[...n].sort(([e],[t])=>e-t).map(([e,t])=>`<h3>Page ${e}</h3><ul>${t.map(e=>`<li><button type="button" data-id="${Gf(e.id)}" aria-current="${e.id===this.selected}">
|
|
805
|
+
<div class="head"><span class="dot" style="background:${Gf(e.color)}"></span>
|
|
806
|
+
<span class="label">${Gf(e.label)}</span>
|
|
807
|
+
<span class="meta">${Gf(e.author||`Unknown`)} · <time datetime="${Gf(e.modifiedAt)}">${Gf(Wf.format(new Date(e.modifiedAt)))}</time></span></div>
|
|
808
|
+
<div class="text">${Gf(e.contents)}</div>
|
|
809
|
+
${e.replies?`<div class="foot">${e.replies} ${e.replies===1?`reply`:`replies`}</div>`:``}
|
|
810
|
+
</button></li>`).join(``)}</ul>`).join(``)}setSelected(e){this.selected=e;for(let t of this.root.querySelectorAll(`button[data-id]`))t.setAttribute(`aria-current`,String(t.dataset.id===e))}}customElements.define(Hf,e)}function qf(){return Kf(),document.createElement(Hf)}var Jf=`pl-signature-dialog`,Yf=[{label:`Script`,css:`'Segoe Script', 'Snell Roundhand', 'Brush Script MT', 'URW Chancery L', cursive`},{label:`Hand`,css:`'Ink Free', 'Bradley Hand', 'Segoe Print', 'Comic Sans MS', cursive`},{label:`Formal`,css:`'Lucida Handwriting', 'Apple Chancery', 'Palatino Linotype', 'URW Palladio L', serif`}],Xf=[`#111827`,`#1d4ed8`],Zf=`
|
|
811
|
+
dialog {
|
|
812
|
+
width: min(520px, calc(100vw - 32px));
|
|
813
|
+
box-sizing: border-box;
|
|
814
|
+
padding: 0;
|
|
815
|
+
border: 1px solid var(--pl-border);
|
|
816
|
+
border-radius: 12px;
|
|
817
|
+
background: var(--pl-surface);
|
|
818
|
+
color: var(--pl-text);
|
|
819
|
+
font: 14px/1.4 var(--pl-font);
|
|
820
|
+
box-shadow: 0 20px 50px rgb(0 0 0 / 0.25);
|
|
821
|
+
}
|
|
822
|
+
dialog::backdrop { background: rgb(0 0 0 / 0.35); }
|
|
823
|
+
header, footer { display: flex; align-items: center; gap: 8px; padding: 12px 16px; }
|
|
824
|
+
header { border-bottom: 1px solid var(--pl-border); }
|
|
825
|
+
h2 { margin: 0; font-size: 16px; flex: 1; }
|
|
826
|
+
footer { border-top: 1px solid var(--pl-border); justify-content: flex-end; }
|
|
827
|
+
footer label { margin-right: auto; display: flex; gap: 6px; align-items: center; color: var(--pl-muted); }
|
|
828
|
+
.body { padding: 12px 16px 16px; display: grid; gap: 12px; }
|
|
829
|
+
.saved { display: flex; gap: 8px; flex-wrap: wrap; }
|
|
830
|
+
.saved:empty { display: none; }
|
|
831
|
+
.saved-item { position: relative; }
|
|
832
|
+
.saved-item button.use-saved { width: 120px; height: 52px; display: grid; place-items: center; background: #fff; border: 1px solid var(--pl-border); border-radius: 8px; padding: 4px; }
|
|
833
|
+
.saved-item img { max-width: 100%; max-height: 100%; }
|
|
834
|
+
.saved-item button.remove { position: absolute; top: -6px; right: -6px; width: 20px; height: 20px; border-radius: 50%; font-size: 12px; line-height: 1; padding: 0; background: var(--pl-surface); border: 1px solid var(--pl-border); }
|
|
835
|
+
[role='tablist'] { display: flex; gap: 4px; border-bottom: 1px solid var(--pl-border); }
|
|
836
|
+
[role='tab'] { border: 0; background: none; padding: 8px 12px; border-bottom: 2px solid transparent; color: var(--pl-muted); }
|
|
837
|
+
[role='tab'][aria-selected='true'] { color: var(--pl-accent); border-bottom-color: var(--pl-accent); font-weight: 600; }
|
|
838
|
+
[role='tabpanel'][hidden] { display: none; }
|
|
839
|
+
.pad { position: relative; height: 180px; border: 1px dashed var(--pl-border); border-radius: 8px; background: #fff; touch-action: none; cursor: crosshair; }
|
|
840
|
+
.pad canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
|
|
841
|
+
.pad .hint { position: absolute; inset: auto 0 12px; text-align: center; color: #9ca3af; pointer-events: none; }
|
|
842
|
+
.pad-tools { display: flex; gap: 8px; align-items: center; margin-top: 8px; }
|
|
843
|
+
.ink { width: 22px; height: 22px; border-radius: 50%; border: 2px solid transparent; padding: 0; }
|
|
844
|
+
.ink[aria-pressed='true'] { outline: 2px solid var(--pl-accent); outline-offset: 1px; }
|
|
845
|
+
input[type='text'] { width: 100%; box-sizing: border-box; padding: 8px 10px; font: inherit; border: 1px solid var(--pl-border); border-radius: 8px; background: var(--pl-surface); color: inherit; }
|
|
846
|
+
.fonts { display: grid; gap: 6px; margin-top: 8px; }
|
|
847
|
+
.fonts button { text-align: left; padding: 6px 12px; font-size: 28px; background: #fff; color: #111827; border: 1px solid var(--pl-border); border-radius: 8px; min-height: 52px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
|
|
848
|
+
.fonts button[aria-pressed='true'] { border-color: var(--pl-accent); box-shadow: 0 0 0 1px var(--pl-accent); }
|
|
849
|
+
.drop { display: grid; place-items: center; gap: 8px; height: 180px; border: 1px dashed var(--pl-border); border-radius: 8px; background: #fff; color: #4b5563; text-align: center; padding: 8px; }
|
|
850
|
+
.drop.over { border-color: var(--pl-accent); }
|
|
851
|
+
.drop img { max-width: 100%; max-height: 120px; }
|
|
852
|
+
button { font: inherit; cursor: pointer; color: inherit; border-radius: 8px; }
|
|
853
|
+
footer button, .pad-tools button.clear, .drop button { padding: 7px 14px; border: 1px solid var(--pl-border); background: var(--pl-surface); }
|
|
854
|
+
footer button.primary { background: var(--pl-accent); border-color: var(--pl-accent); color: #fff; }
|
|
855
|
+
button:disabled { opacity: 0.45; cursor: default; }
|
|
856
|
+
button:focus-visible, input:focus-visible { outline: 2px solid var(--pl-accent); outline-offset: 1px; }
|
|
857
|
+
.error { color: #b91c1c; margin: 0; }
|
|
858
|
+
.error:empty { display: none; }
|
|
859
|
+
`;function Qf(e,t=8){let n=e.getContext(`2d`),{width:r,height:i}=e,{data:a}=n.getImageData(0,0,r,i),[o,s,c,l]=[r,i,-1,-1];for(let e=0;e<i;e++)for(let t=0;t<r;t++)a[(e*r+t)*4+3]>8&&(t<o&&(o=t),t>c&&(c=t),e<s&&(s=e),e>l&&(l=e));if(c<0)return null;let u=Math.max(0,o-t),d=Math.max(0,s-t),f=Math.min(r,c+t+1)-u,p=Math.min(i,l+t+1)-d,m=document.createElement(`canvas`);return m.width=f,m.height=p,m.getContext(`2d`).drawImage(e,u,d,f,p,0,0,f,p),m.toDataURL(`image/png`)}function $f(e,t,n=Xf[0]){let r=document.createElement(`canvas`),i=r.getContext(`2d`);i.font=`96px ${t}`;let a=Math.ceil(i.measureText(e).width)+96;return r.width=Math.min(a,4e3),r.height=173,i.font=`96px ${t}`,i.fillStyle=n,i.textBaseline=`middle`,i.fillText(e,48,r.height/2),Qf(r)}function ep(){if(customElements.get(`pl-signature-dialog`))return;class e extends HTMLElement{root;dialog;mode=`draw`;ink=Xf[0];font=0;drawn=!1;upload=null;finish=null;onRemove=()=>{};constructor(){super(),this.root=this.attachShadow({mode:`open`}),this.root.innerHTML=`<style>${Zf}</style>
|
|
860
|
+
<dialog aria-labelledby="pl-sig-title">
|
|
861
|
+
<header><h2 id="pl-sig-title">Add signature</h2></header>
|
|
862
|
+
<div class="body">
|
|
863
|
+
<div class="saved" role="list" aria-label="Saved signatures"></div>
|
|
864
|
+
<div role="tablist" aria-label="How to sign">
|
|
865
|
+
<button type="button" role="tab" data-mode="draw" aria-selected="true">Draw</button>
|
|
866
|
+
<button type="button" role="tab" data-mode="type" aria-selected="false" tabindex="-1">Type</button>
|
|
867
|
+
<button type="button" role="tab" data-mode="upload" aria-selected="false" tabindex="-1">Upload</button>
|
|
868
|
+
</div>
|
|
869
|
+
<div role="tabpanel" data-panel="draw" aria-label="Draw">
|
|
870
|
+
<div class="pad"><canvas aria-label="Signature pad: draw with the mouse, a finger or a pen" role="img"></canvas><span class="hint">Sign here</span></div>
|
|
871
|
+
<div class="pad-tools">
|
|
872
|
+
${Xf.map((e,t)=>`<button type="button" class="ink" data-ink="${e}" style="background:${e}" aria-label="Ink ${t===0?`black`:`blue`}" aria-pressed="${t===0}"></button>`).join(``)}
|
|
873
|
+
<button type="button" class="clear">Clear</button>
|
|
874
|
+
</div>
|
|
875
|
+
</div>
|
|
876
|
+
<div role="tabpanel" data-panel="type" aria-label="Type" hidden>
|
|
877
|
+
<input type="text" aria-label="Your name" placeholder="Type your name" maxlength="80" autocomplete="name" />
|
|
878
|
+
<div class="fonts" role="group" aria-label="Style">
|
|
879
|
+
${Yf.map((e,t)=>`<button type="button" data-font="${t}" aria-pressed="${t===0}" aria-label="${e.label} style" style="font-family:${e.css.replace(/"/g,`"`)}">Your name</button>`).join(``)}
|
|
880
|
+
</div>
|
|
881
|
+
</div>
|
|
882
|
+
<div role="tabpanel" data-panel="upload" aria-label="Upload" hidden>
|
|
883
|
+
<div class="drop">
|
|
884
|
+
<span class="drop-text">Drop an image of your signature here<br />PNG, JPEG, WebP or SVG</span>
|
|
885
|
+
<button type="button" class="pick">Choose image…</button>
|
|
886
|
+
<input type="file" accept="image/*" hidden />
|
|
887
|
+
</div>
|
|
888
|
+
</div>
|
|
889
|
+
<p class="error" role="alert"></p>
|
|
890
|
+
</div>
|
|
891
|
+
<footer>
|
|
892
|
+
<label><input type="checkbox" class="remember" checked /> Save for reuse</label>
|
|
893
|
+
<button type="button" class="cancel">Cancel</button>
|
|
894
|
+
<button type="button" class="primary use" disabled>Use signature</button>
|
|
895
|
+
</footer>
|
|
896
|
+
</dialog>`,this.dialog=this.root.querySelector(`dialog`),this.wire()}choose(e,t){return this.finish?.(null),this.onRemove=t,this.renderSaved(e),this.reset(),this.dialog.showModal(),this.sizePad(),new Promise(e=>this.finish=e)}$(e){return this.root.querySelector(e)}close(e){let t=this.finish;this.finish=null,this.dialog.open&&this.dialog.close(),t?.(e)}wire(){this.dialog.addEventListener(`close`,()=>this.close(null)),this.$(`.cancel`).addEventListener(`click`,()=>this.close(null)),this.$(`.use`).addEventListener(`click`,()=>void this.use());let e=[...this.root.querySelectorAll(`[role="tab"]`)];for(let t of e)t.addEventListener(`click`,()=>this.setMode(t.dataset.mode));this.$(`[role="tablist"]`).addEventListener(`keydown`,t=>{let n=t;if(n.key!==`ArrowRight`&&n.key!==`ArrowLeft`)return;let r=e.findIndex(e=>e.dataset.mode===this.mode),i=e[(r+(n.key===`ArrowRight`?1:e.length-1))%e.length];this.setMode(i.dataset.mode),i.focus()}),this.wirePad();let t=this.$(`input[type="text"]`);t.addEventListener(`input`,()=>{for(let e of this.root.querySelectorAll(`[data-font]`))e.textContent=t.value||`Your name`;this.updateUse()});for(let e of this.root.querySelectorAll(`[data-font]`))e.addEventListener(`click`,()=>{this.font=Number(e.dataset.font);for(let t of this.root.querySelectorAll(`[data-font]`))t.setAttribute(`aria-pressed`,String(t===e))});let n=this.$(`input[type="file"]`),r=this.$(`.drop`);this.$(`.pick`).addEventListener(`click`,()=>n.click()),n.addEventListener(`change`,()=>n.files?.[0]&&this.setUpload(n.files[0])),r.addEventListener(`dragover`,e=>{e.preventDefault(),r.classList.add(`over`)}),r.addEventListener(`dragleave`,()=>r.classList.remove(`over`)),r.addEventListener(`drop`,e=>{e.preventDefault(),r.classList.remove(`over`);let t=e.dataTransfer?.files[0];t&&this.setUpload(t)})}wirePad(){let e=this.$(`.pad canvas`),t=()=>e.getContext(`2d`),n=null,r=null,i=t=>{let n=e.getBoundingClientRect();return{x:(t.clientX-n.left)/n.width*e.width,y:(t.clientY-n.top)/n.height*e.height}};e.addEventListener(`pointerdown`,a=>{e.setPointerCapture(a.pointerId),n=i(a),r=n;let o=t();o.fillStyle=this.ink,o.beginPath(),o.arc(n.x,n.y,o.lineWidth/2,0,Math.PI*2),o.fill(),this.markDrawn()}),e.addEventListener(`pointermove`,e=>{if(!n||!r)return;let a=i(e),o={x:(n.x+a.x)/2,y:(n.y+a.y)/2},s=t();s.strokeStyle=this.ink,s.beginPath(),s.moveTo(r.x,r.y),s.quadraticCurveTo(n.x,n.y,o.x,o.y),s.stroke(),n=a,r=o});let a=()=>{n=null,r=null};e.addEventListener(`pointerup`,a),e.addEventListener(`pointercancel`,a),this.$(`.clear`).addEventListener(`click`,()=>{t().clearRect(0,0,e.width,e.height),this.drawn=!1,this.$(`.hint`).hidden=!1,this.updateUse()});for(let e of this.root.querySelectorAll(`[data-ink]`))e.addEventListener(`click`,()=>{this.ink=e.dataset.ink;for(let t of this.root.querySelectorAll(`[data-ink]`))t.setAttribute(`aria-pressed`,String(t===e))})}markDrawn(){this.drawn=!0,this.$(`.hint`).hidden=!0,this.updateUse()}sizePad(){let e=this.$(`.pad canvas`),{width:t,height:n}=e.getBoundingClientRect(),r=Math.max(2,window.devicePixelRatio||1);e.width=Math.round(t*r),e.height=Math.round(n*r);let i=e.getContext(`2d`);i.lineWidth=2.5*r,i.lineCap=`round`,i.lineJoin=`round`}reset(){this.drawn=!1,this.upload=null,this.$(`.hint`).hidden=!1,this.$(`input[type="text"]`).value=``;for(let e of this.root.querySelectorAll(`[data-font]`))e.textContent=`Your name`;this.$(`input[type="file"]`).value=``,this.$(`.drop`).querySelector(`img`)?.remove(),this.$(`.error`).textContent=``,this.$(`.remember`).checked=!0,this.setMode(`draw`)}setMode(e){this.mode=e;for(let t of this.root.querySelectorAll(`[role="tab"]`)){let n=t.dataset.mode===e;t.setAttribute(`aria-selected`,String(n)),t.tabIndex=n?0:-1}for(let t of this.root.querySelectorAll(`[role="tabpanel"]`))t.hidden=t.dataset.panel!==e;e===`draw`&&this.sizePad(),this.updateUse()}setUpload(e){let t=this.$(`.error`);if(!e.type.startsWith(`image/`)){t.textContent=`That file is not an image.`;return}t.textContent=``,this.upload=e;let n=this.$(`.drop`);n.querySelector(`img`)?.remove();let r=document.createElement(`img`);r.alt=`Uploaded signature`,r.src=URL.createObjectURL(e),r.onload=()=>URL.revokeObjectURL(r.src),n.prepend(r),this.updateUse()}updateUse(){let e=this.mode===`draw`?this.drawn:this.mode===`type`?this.$(`input[type="text"]`).value.trim()!==``:!!this.upload;this.$(`.use`).disabled=!e}async use(){let e=null;e=this.mode===`draw`?Qf(this.$(`.pad canvas`)):this.mode===`type`?$f(this.$(`input[type="text"]`).value.trim(),Yf[this.font].css,this.ink):this.upload,e&&this.close({image:e,remember:this.$(`.remember`).checked})}renderSaved(e){this.$(`.saved`).replaceChildren(...e.map((e,t)=>{let n=document.createElement(`div`);n.className=`saved-item`,n.setAttribute(`role`,`listitem`);let r=document.createElement(`button`);r.type=`button`,r.className=`use-saved`,r.setAttribute(`aria-label`,`Use saved signature ${t+1}`);let i=document.createElement(`img`);i.src=e.image,i.alt=``,r.append(i),r.addEventListener(`click`,()=>this.close({image:e.image,remember:!1}));let a=document.createElement(`button`);return a.type=`button`,a.className=`remove`,a.textContent=`×`,a.setAttribute(`aria-label`,`Remove saved signature ${t+1}`),a.addEventListener(`click`,()=>{n.remove(),this.onRemove(e.id)}),n.append(r,a),n}))}}customElements.define(Jf,e)}function tp(){return ep(),document.createElement(Jf)}var np=`pl-confirm-dialog`,rp=`
|
|
897
|
+
dialog {
|
|
898
|
+
width: min(420px, calc(100vw - 32px));
|
|
899
|
+
box-sizing: border-box;
|
|
900
|
+
padding: 20px;
|
|
901
|
+
border: 1px solid var(--pl-border);
|
|
902
|
+
border-radius: 12px;
|
|
903
|
+
background: var(--pl-surface);
|
|
904
|
+
color: var(--pl-text);
|
|
905
|
+
font: 14px/1.45 var(--pl-font);
|
|
906
|
+
box-shadow: 0 20px 50px rgb(0 0 0 / 0.25);
|
|
907
|
+
}
|
|
908
|
+
dialog::backdrop { background: rgb(0 0 0 / 0.35); }
|
|
909
|
+
h2 { margin: 0 0 8px; font-size: 16px; }
|
|
910
|
+
p { margin: 0 0 20px; color: var(--pl-muted); white-space: pre-line; }
|
|
911
|
+
.actions { display: flex; justify-content: flex-end; gap: 8px; }
|
|
912
|
+
button { font: inherit; padding: 7px 14px; border-radius: 8px; border: 1px solid var(--pl-border); background: var(--pl-surface); color: inherit; cursor: pointer; }
|
|
913
|
+
button.confirm { background: var(--pl-accent); border-color: var(--pl-accent); color: #fff; }
|
|
914
|
+
button.confirm.danger { background: #b91c1c; border-color: #b91c1c; }
|
|
915
|
+
button:focus-visible { outline: 2px solid var(--pl-accent); outline-offset: 1px; }
|
|
916
|
+
`;function ip(){if(customElements.get(`pl-confirm-dialog`))return;class e extends HTMLElement{dialog;resolve=null;constructor(){super();let e=this.attachShadow({mode:`open`});e.innerHTML=`<style>${rp}</style>
|
|
917
|
+
<dialog role="alertdialog" aria-labelledby="t" aria-describedby="m">
|
|
918
|
+
<h2 id="t"></h2><p id="m"></p>
|
|
919
|
+
<div class="actions"><button type="button" class="cancel">Cancel</button><button type="button" class="confirm"></button></div>
|
|
920
|
+
</dialog>`,this.dialog=e.querySelector(`dialog`),e.querySelector(`.cancel`).addEventListener(`click`,()=>this.finish(!1)),e.querySelector(`.confirm`).addEventListener(`click`,()=>this.finish(!0)),this.dialog.addEventListener(`close`,()=>this.finish(!1))}ask(e){this.finish(!1);let t=this.shadowRoot;t.querySelector(`h2`).textContent=e.title,t.querySelector(`p`).textContent=e.message;let n=t.querySelector(`.confirm`);return n.textContent=e.confirmLabel,n.classList.toggle(`danger`,!!e.danger),this.dialog.showModal(),t.querySelector(`.cancel`).focus(),new Promise(e=>this.resolve=e)}finish(e){let t=this.resolve;this.resolve=null,this.dialog.open&&this.dialog.close(),t?.(e)}}customElements.define(np,e)}function ap(){return ip(),document.createElement(np)}var op=`pl-presence`,sp=4,cp={connecting:`Connecting…`,connected:`Live: changes are shared`,disconnected:`Offline: changes will sync when the connection is back`},lp=`
|
|
921
|
+
:host { display: flex; align-items: center; gap: 6px; padding: 0 4px; font: 12px var(--pl-font); color: var(--pl-text); }
|
|
922
|
+
:host([hidden]) { display: none; }
|
|
923
|
+
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: #9ca3af; }
|
|
924
|
+
.dot[data-status='connected'] { background: #16a34a; }
|
|
925
|
+
.dot[data-status='connecting'] { background: #f59e0b; animation: pulse 1.2s ease-in-out infinite; }
|
|
926
|
+
@keyframes pulse { 50% { opacity: 0.35; } }
|
|
927
|
+
.avatars { display: flex; }
|
|
928
|
+
.avatar {
|
|
929
|
+
width: 26px;
|
|
930
|
+
height: 26px;
|
|
931
|
+
margin-left: -6px;
|
|
932
|
+
border-radius: 50%;
|
|
933
|
+
display: grid;
|
|
934
|
+
place-items: center;
|
|
935
|
+
color: #fff;
|
|
936
|
+
font-weight: 600;
|
|
937
|
+
font-size: 11px;
|
|
938
|
+
box-shadow: 0 0 0 2px var(--pl-surface);
|
|
939
|
+
cursor: default;
|
|
940
|
+
user-select: none;
|
|
941
|
+
}
|
|
942
|
+
.avatar:first-child { margin-left: 0; }
|
|
943
|
+
.avatar.self { outline: 2px solid var(--pl-accent); outline-offset: 1px; }
|
|
944
|
+
.more { background: var(--pl-muted); }
|
|
945
|
+
@media (prefers-reduced-motion: reduce) { .dot { animation: none !important; } }
|
|
946
|
+
`,up=e=>e.trim().split(/\s+/).slice(0,2).map(e=>[...e][0]?.toUpperCase()??``).join(``)||`?`;function dp(){if(customElements.get(`pl-presence`))return;class e extends HTMLElement{root;constructor(){super(),this.root=this.attachShadow({mode:`open`}),this.root.innerHTML=`<style>${lp}</style><span class="dot" role="status"></span><div class="avatars" role="list"></div>`,this.setStatus(`connecting`)}setStatus(e){let t=this.root.querySelector(`.dot`);t.dataset.status=e,t.title=cp[e],t.setAttribute(`aria-label`,cp[e])}setPeers(e){let t=this.root.querySelector(`.avatars`),n=e=>e.self?`${e.name} (you)`:e.name;if(t.replaceChildren(...e.slice(0,sp).map(e=>{let t=document.createElement(`span`);return t.className=e.self?`avatar self`:`avatar`,t.setAttribute(`role`,`listitem`),t.style.background=e.color,t.textContent=up(e.name),t.title=n(e),t.setAttribute(`aria-label`,n(e)),t})),e.length>sp){let r=document.createElement(`span`);r.className=`avatar more`,r.setAttribute(`role`,`listitem`),r.textContent=`+${e.length-sp}`,r.title=e.slice(sp).map(n).join(`, `),t.append(r)}this.setAttribute(`aria-label`,`${e.length} ${e.length===1?`person`:`people`} here: ${e.map(n).join(`, `)}`)}}customElements.define(op,e)}function fp(){return dp(),document.createElement(op)}Me();var pp=new Set([`highlight`,`underline`,`strikeout`]),mp={highlight:`Highlight`,underline:`Underline`,strikeout:`Strikeout`,note:`Note`,reply:`Reply`,ink:`Drawing`,rectangle:`Rectangle`,ellipse:`Ellipse`,line:`Line`,arrow:`Arrow`,freeText:`Text box`,signature:`Signature`,redaction:`Redaction`},hp=24,gp={width:200,height:28},_p=150,vp=3,yp=2,bp=class{o;toolbar;thread;onSelectionChange=null;tool=`select`;selectedId=null;editingId=null;strokeWidth=2;toolColors=new Map;gesture=null;stopGesture=null;dirtyPages=new Set;flushQueued=!1;abort=new AbortController;pendingSignature=null;constructor(e){this.o=e,this.toolbar=xf(),this.thread=kf(),e.main.append(this.thread),this.toolbar.setTools(e.tools),this.wireToolbar(),this.wireThread(),this.wireEvents(),this.setTool(`select`)}get currentTool(){return this.tool}setTool(e){this.o.readOnly&&e!==`select`||(this.finishEditing(),this.tool=e,this.o.root.dataset.tool=e,e!==`select`&&this.select(null),e===`signature`?this.armSignature():this.pendingSignature=null,(pp.has(e)||e===`redaction`)&&this.applyMarkupToSelection(),this.syncToolbar())}focusAnnotation(e){let t=this.o.manager.get(e);if(!t)return;this.tool!==`select`&&this.setTool(`select`);let n=t.page-1;this.o.viewport.scrollToRect(n,ju(t.rect,this.o.viewport.pageSize(n))),this.select(e),requestAnimationFrame(()=>this.openThread(e))}refreshAll(){for(let e of this.o.manager.list())this.markDirty(e.page-1)}destroy(){this.gesture?.cancel(),this.abort.abort(),this.toolbar.remove(),this.thread.remove()}markDirty(e){this.dirtyPages.add(e),!this.flushQueued&&(this.flushQueued=!0,queueMicrotask(()=>{this.flushQueued=!1;for(let e of this.dirtyPages)this.renderPage(e);this.dirtyPages.clear()}))}renderPage(e){let t=this.o.viewport.annotationLayer(e);if(!t)return;let n=this.o.manager.list({page:e+1}),r=new Map;for(let e of n)e.type===`reply`&&r.set(e.inReplyTo,(r.get(e.inReplyTo)??0)+1);t.render(n,this.o.viewport.pageSize(e),{selectedId:this.selectedId,replyCounts:r,editingId:this.editingId})}select(e){if(e===this.selectedId)return;let t=this.selectedId&&this.o.manager.get(this.selectedId);this.selectedId=e,e?this.o.root.dataset.selected=e:delete this.o.root.dataset.selected,t&&this.markDirty(t.page-1);let n=e&&this.o.manager.get(e);n&&this.markDirty(n.page-1),this.thread.threadId&&this.thread.threadId!==e&&this.thread.close(),this.syncToolbar(),this.onSelectionChange?.(e)}selected(){return this.selectedId?this.o.manager.get(this.selectedId):void 0}toolColor(e){return this.toolColors.get(e)??h[e===`select`?`note`:e]}syncToolbar(){let e=this.selected(),t=e&&`strokeWidth`in e;this.toolbar.setState({tool:this.tool,color:e?e.color:this.toolColor(this.tool),strokeWidth:t?e.strokeWidth:this.strokeWidth,strokeEnabled:!this.o.readOnly&&(t||_f(this.tool)),hasSelection:!!e&&!this.o.readOnly,canUndo:this.o.history.state.canUndo,canRedo:this.o.history.state.canRedo,readOnly:this.o.readOnly,pendingRedactions:this.o.tools.includes(`redaction`)?this.o.manager.list({type:`redaction`}).filter(e=>e.type===`redaction`&&!e.applied).length:0})}wireToolbar(){let{toolbar:e}=this;e.onTool=e=>this.setTool(e),e.onApplyRedactions=()=>this.o.applyRedactions?.(),e.onColor=e=>{let t=this.selected();t&&!this.o.readOnly?(this.o.manager.update(t.id,{color:e},`user`),this.toolColors.set(t.type,e)):(this.toolColors.set(this.tool,e),pp.has(this.tool)&&this.applyMarkupToSelection()),this.syncToolbar()},e.onStrokeWidth=e=>{let t=this.selected();t&&`strokeWidth`in t&&!this.o.readOnly&&this.o.manager.update(t.id,{strokeWidth:e},`user`),this.strokeWidth=e,this.syncToolbar()},e.onDelete=()=>this.deleteSelected(),e.onComment=()=>this.selectedId&&this.openThread(this.selectedId,`contents`),e.onUndo=()=>this.o.history.undo(),e.onRedo=()=>this.o.history.redo(),this.o.history.onChange(()=>this.syncToolbar())}threadData(e){let t=this.o.manager.get(e);return t?{root:{...t,label:mp[t.type]},replies:this.o.manager.replies(e),readOnly:this.o.readOnly}:null}openThread(e,t=null){let n=this.threadData(e),r=this.threadPosition(e);n&&r&&this.thread.open(n,r.x,r.y,this.o.readOnly?null:t)}threadPosition(e){let t=this.o.manager.get(e),n=t&&this.o.viewport.annotationLayer(t.page-1)?.element(e);if(!n)return null;let r=n.getBoundingClientRect(),i=this.o.main.getBoundingClientRect(),a=r.right-i.left+8;a+280>i.width-8&&(a=Math.max(8,r.left-i.left-280-8));let o=Math.min(Math.max(56,r.top-i.top),Math.max(56,i.height-200));return{x:a,y:o}}wireThread(){let{thread:e,o:t}=this;e.onContents=n=>e.threadId&&t.manager.get(e.threadId)&&t.manager.update(e.threadId,{contents:n},`user`),e.onReply=n=>{e.threadId&&t.manager.add({type:`reply`,inReplyTo:e.threadId,contents:n},`user`)},e.onDeleteReply=e=>t.manager.remove(e,`user`),e.onDelete=()=>{let n=e.threadId;e.close(),n&&t.manager.remove(n,`user`)}}wireEvents(){let{o:e}=this,t=this.abort.signal;e.events.on(`annotationAdded`,({annotation:e})=>this.onChanged(e)),e.events.on(`annotationChanged`,({annotation:e,previous:t})=>{t.page!==e.page&&this.markDirty(t.page-1),this.onChanged(e)}),e.events.on(`annotationRemoved`,({annotation:e})=>{e.id===this.selectedId&&this.select(null),e.id===this.thread.threadId&&this.thread.close(),this.onChanged(e)}),e.viewport.scroller.addEventListener(`pointerdown`,e=>this.onPointerDown(e),{signal:t}),e.viewport.scroller.addEventListener(`dblclick`,e=>this.onDoubleClick(e),{signal:t}),e.viewport.scroller.addEventListener(`scroll`,()=>{let e=this.thread.threadId,t=e&&this.threadPosition(e);t&&Object.assign(this.thread.style,{left:`${t.x}px`,top:`${t.y}px`})},{passive:!0,signal:t}),document.addEventListener(`pointerup`,()=>{pp.has(this.tool)&&setTimeout(()=>this.applyMarkupToSelection(),0)},{signal:t}),e.root.addEventListener(`keydown`,e=>this.onKeyDown(e),{signal:t})}onChanged(e){this.markDirty(e.page-1);let t=this.thread.threadId;if(t&&(e.id===t||e.type===`reply`&&e.inReplyTo===t)){let e=this.threadData(t);e&&this.thread.update(e)}e.id===this.selectedId&&this.syncToolbar()}onKeyDown(e){let t=e.composedPath()[0];t instanceof HTMLElement&&(t.isContentEditable||/^(INPUT|TEXTAREA|SELECT)$/.test(t.tagName))||((e.key===`Delete`||e.key===`Backspace`)&&this.selectedId?(e.preventDefault(),this.deleteSelected()):e.key===`Escape`&&(this.gesture?(this.gesture.cancel(),this.gesture=null):this.selectedId?this.select(null):this.tool!==`select`&&this.setTool(`select`)))}deleteSelected(){let e=this.selected();!e||this.o.readOnly||e.locked||this.o.manager.remove(e.id,`user`)}toPdf(e,t){let n=this.o.viewport.pageElement(e).getBoundingClientRect();return Nu({x:Math.min(1,Math.max(0,(t.clientX-n.left)/n.width)),y:Math.min(1,Math.max(0,(t.clientY-n.top)/n.height))},this.o.viewport.pageSize(e))}startGesture(e,t){this.gesture?.cancel(),this.gesture=t;let n=new AbortController;this.abort.signal.addEventListener(`abort`,()=>n.abort(),{once:!0});let r=()=>{n.abort(),this.gesture===t&&(this.gesture=null,this.stopGesture=null)};this.stopGesture=()=>{r(),t.cancel()};let i={signal:n.signal};document.addEventListener(`pointermove`,n=>n.pointerId===e.pointerId&&t.move(n),i),document.addEventListener(`pointerup`,n=>{n.pointerId===e.pointerId&&(r(),t.end(n))},i),document.addEventListener(`pointercancel`,n=>{n.pointerId===e.pointerId&&(r(),t.cancel())},i)}cancelGesture(){this.stopGesture?.()}onPointerDown(e){if(e.button!==0||e.pointerType===`touch`&&!e.isPrimary)return;let t=e.target;if(this.editingId&&t.closest(`[contenteditable="true"]`))return;this.finishEditing();let n=this.o.viewport.pageIndexOf(t);this.o.viewport.scroller.focus({preventScroll:!0});let r=t.closest(`.pl-handle`);if(r&&this.selectedId&&!this.o.readOnly){e.preventDefault(),this.startResize(e,this.selectedId,r.dataset.handle);return}if(this.tool===`select`){let r=t.closest(`[data-annotation-id]`)?.getAttribute(`data-annotation-id`)??t.closest(`.pl-selection`)?.getAttribute(`data-selection-for`);if(!r){this.select(null);return}e.preventDefault(),this.select(r);let i=this.o.manager.get(r);i.type===`note`&&this.openThread(r),_e(i)&&!i.locked&&!this.o.readOnly&&n>=0&&this.startMove(e,i,n);return}if(pp.has(this.tool)||this.o.readOnly||n<0)return;e.preventDefault();let i=this.toPdf(n,e);switch(this.tool){case`note`:return this.placeNote(n,i);case`freeText`:return this.startFreeText(e,n,i);case`ink`:return this.startInk(e,n,i);case`signature`:return this.placeSignature(n,i);default:return this.startShape(e,n,i)}}onDoubleClick(e){if(this.tool!==`select`)return;let t=e.target,n=t.closest(`[data-annotation-id]`)?.getAttribute(`data-annotation-id`)??t.closest(`.pl-selection`)?.getAttribute(`data-selection-for`),r=n&&this.o.manager.get(n);r&&(r.type===`freeText`&&!this.o.readOnly&&!r.locked?this.editFreeText(r):this.openThread(r.id,`contents`))}draft(e){return j(e,{now:()=>``,newId:()=>`draft`})}style(e){return{color:this.toolColor(e),..._f(e)?{strokeWidth:this.strokeWidth}:{}}}armSignature(){this.pendingSignature=null;let e=this.o.chooseSignature;if(!e)return this.setTool(`select`);e().then(e=>{this.tool===`signature`&&(e?this.pendingSignature=e:this.setTool(`select`))},e=>{console.warn(`[pdfcedar] could not use that signature image.`,e),this.tool===`signature`&&this.setTool(`select`)})}placeSignature(e,t){let n=this.pendingSignature;if(!n)return;let r=this.o.viewport.pageSize(e),i=r.rotation===90||r.rotation===270,a=Math.min(_p,(i?r.height:r.width)*.8),o=a*n.height/n.width,[s,c]=i?[o,a]:[a,o],[l,u,d,f]=r.view,p=Math.min(Math.max(t.x-s/2,l),d-s),m=Math.min(Math.max(t.y-c/2,u),f-c),h=this.o.manager.add({type:`signature`,page:e+1,rect:{x:p,y:m,width:s,height:c},image:n.image},`user`);this.setTool(`select`),this.select(h.id)}placeNote(e,t){let n={x:t.x-hp/2,y:t.y-hp/2,width:hp,height:hp},r=this.o.manager.add({type:`note`,page:e+1,rect:n,color:this.toolColor(`note`)},`user`);this.setTool(`select`),this.select(r.id),queueMicrotask(()=>queueMicrotask(()=>this.openThread(r.id,`contents`)))}startInk(e,t,n){let r=this.o.viewport.annotationLayer(t),i=this.o.viewport.pageSize(t),a=[n],o={x:e.clientX,y:e.clientY},s=()=>({type:`ink`,page:t+1,paths:[a],...this.style(`ink`)});r.preview(this.draft(s()),i),this.startGesture(e,{move:e=>{let n=e.getCoalescedEvents?.();for(let r of n?.length?n:[e])Math.hypot(r.clientX-o.x,r.clientY-o.y)<yp||(o={x:r.clientX,y:r.clientY},a.push(this.toPdf(t,r)));r.preview(this.draft(s()),i)},end:()=>{r.preview(null,i),this.o.manager.add(s(),`user`)},cancel:()=>r.preview(null,i)})}startShape(e,t,n){let r=this.tool,i=this.o.viewport.annotationLayer(t),a=this.o.viewport.pageSize(t),o=n,s=()=>r===`line`||r===`arrow`?{type:r,page:t+1,start:n,end:o,...this.style(r)}:{type:r,page:t+1,rect:pe(n,o),...this.style(r)};this.startGesture(e,{move:e=>{o=this.toPdf(t,e),i.preview(this.draft(s()),a)},end:()=>{i.preview(null,a),(r===`line`||r===`arrow`?Math.hypot(o.x-n.x,o.y-n.y)>=vp:Math.abs(o.x-n.x)>=vp&&Math.abs(o.y-n.y)>=vp)&&this.o.manager.add(s(),`user`)},cancel:()=>i.preview(null,a)})}startMove(e,t,n){let r=this.o.viewport.annotationLayer(n),i=this.o.viewport.pageSize(n),a=this.toPdf(n,e),o={x:0,y:0},s=r.element(t.id);this.startGesture(e,{move:e=>{let c=this.toPdf(n,e);o={x:c.x-a.x,y:c.y-a.y},s&&(s.style.visibility=`hidden`),r.preview(this.draft({...t,...me(t,o.x,o.y)}),i)},end:()=>{r.preview(null,i),s&&(s.style.visibility=``),Math.hypot(o.x,o.y)>=.5&&this.o.manager.update(t.id,me(t,o.x,o.y),`user`)},cancel:()=>{r.preview(null,i),s&&(s.style.visibility=``)}})}startResize(e,t,n){let r=this.o.manager.get(t);if(!r||r.locked)return;let i=r.page-1,a=this.o.viewport.annotationLayer(i),o=this.o.viewport.pageSize(i),s=this.o.viewport.pageElement(i).getBoundingClientRect(),c=a.element(t),l=null,u=t=>{if((r.type===`line`||r.type===`arrow`)&&(n===`start`||n===`end`))return{[n]:this.toPdf(i,t)};if(!he(r))return null;let a=ju(r.rect,o),c={x:a.left,y:-(a.top+a.height),width:a.width,height:a.height},l=ye(c,n,(t.clientX-e.clientX)/s.width,-(t.clientY-e.clientY)/s.height,4/s.width),u=r.type===`signature`?I(c,l,n):l,d=-(u.y+u.height),f=[Nu({x:u.x,y:d},o),Nu({x:u.x+u.width,y:d+u.height},o)];return ve(r,pe(f[0],f[1]))};this.startGesture(e,{move:e=>{l=u(e),l&&(c&&(c.style.visibility=`hidden`),a.preview(this.draft({...r,...l}),o))},end:()=>{a.preview(null,o),c&&(c.style.visibility=``),l&&this.o.manager.update(t,l,`user`)},cancel:()=>{a.preview(null,o),c&&(c.style.visibility=``)}})}startFreeText(e,t,n){let r=this.o.viewport.annotationLayer(t),i=this.o.viewport.pageSize(t),a=n;this.startGesture(e,{move:e=>{a=this.toPdf(t,e),r.preview(this.draft({type:`freeText`,page:t+1,rect:pe(n,a),color:this.toolColor(`freeText`)}),i)},end:()=>{r.preview(null,i);let e=Math.abs(a.x-n.x)>=9&&Math.abs(a.y-n.y)>=9,o=Mu(n,i),s=e?pe(n,a):this.defaultTextRect(o,t);this.setTool(`select`),this.editFreeText(this.draft({type:`freeText`,page:t+1,rect:s,color:this.toolColor(`freeText`)}),!0)},cancel:()=>r.preview(null,i)})}defaultTextRect(e,t){let n=this.o.viewport.pageSize(t),r=gp.width/n.width,i=gp.height/n.height,a=Math.min(e.x,1-r),o=Math.min(e.y,1-i);return pe(Nu({x:a,y:o},n),Nu({x:a+r,y:o+i},n))}editFreeText(e,t=!1){if(e.type!==`freeText`)return;let n=e.page-1,r=this.o.viewport.annotationLayer(n),i=this.o.viewport.pageSize(n),a;if(t?(r.preview(e,i),a=r.html.querySelector(`.pl-preview-html`)):(a=r.element(e.id),this.editingId=e.id,this.select(e.id)),!a)return;a.contentEditable=`true`,a.dataset.editing=`true`,a.setAttribute(`role`,`textbox`),a.setAttribute(`aria-label`,`Text box`),a.focus();let o=document.createRange();o.selectNodeContents(a),o.collapse(!1),document.getSelection()?.removeAllRanges(),document.getSelection()?.addRange(o);let s=()=>{a.removeEventListener(`blur`,s),a.removeEventListener(`keydown`,c);let o=a.innerText.replace(/\n$/,``);if(this.editingId=null,a.contentEditable=`false`,delete a.dataset.editing,t){if(r.preview(null,i),o.trim()){let t=this.o.manager.add({...e,id:void 0,contents:o,author:void 0,authorId:void 0,createdAt:void 0,modifiedAt:void 0},`user`);this.select(t.id)}}else o===e.contents?this.markDirty(n):this.o.manager.update(e.id,{contents:o},`user`)},c=e=>{e.stopPropagation(),(e.key===`Escape`||e.key===`Enter`&&(e.ctrlKey||e.metaKey))&&(e.preventDefault(),a.blur())};a.addEventListener(`blur`,s),a.addEventListener(`keydown`,c),this.finishEditing=()=>{this.finishEditing=()=>{},a.isContentEditable&&a.blur()}}finishEditing=()=>{};applyMarkupToSelection(){if(!pp.has(this.tool)&&this.tool!==`redaction`||this.o.readOnly)return;let e=document.getSelection();if(!e||e.isCollapsed||e.rangeCount===0)return;let t=e.getRangeAt(0),n=new Map,r=document.createTreeWalker(this.o.viewport.scroller,NodeFilter.SHOW_TEXT,{acceptNode:e=>t.intersectsNode(e)&&e.parentElement?.closest(`.textLayer`)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_REJECT});for(let e=r.nextNode();e;e=r.nextNode()){let r=this.o.viewport.pageIndexOf(e.parentElement);if(r<0)continue;let i=document.createRange();if(i.selectNodeContents(e),e===t.startContainer&&i.setStart(e,t.startOffset),e===t.endContainer&&i.setEnd(e,t.endOffset),i.collapsed||!i.toString().trim())continue;let a=this.o.viewport.pageElement(r).getBoundingClientRect(),o=this.o.viewport.pageSize(r);for(let e of i.getClientRects()){let t=Nu({x:(e.left-a.left)/a.width,y:(e.top-a.top)/a.height},o),i=Nu({x:(e.right-a.left)/a.width,y:(e.bottom-a.top)/a.height},o),s=n.get(r)??[];s.push(pe(t,i)),n.set(r,s)}}if(n.size===0)return;if(this.tool===`redaction`){this.o.history.transaction(`Mark for redaction`,()=>{for(let[e,t]of n)for(let n of xe(t)){let t={x:n.x-1,y:n.y-1,width:n.width+2,height:n.height+2};this.o.manager.add({type:`redaction`,page:e+1,rect:t,color:this.toolColor(`redaction`)},`user`)}}),e.removeAllRanges();return}let i=this.tool;this.o.history.transaction(`Add ${i}`,()=>{for(let[e,t]of n){let n=xe(t).map(be);n.length>0&&this.o.manager.add({type:i,page:e+1,quads:n,color:this.toolColor(i)},`user`)}}),e.removeAllRanges()}},xp=e=>`${e*100}%`,Sp=(e,t)=>e.multiline?12:Math.min(Math.max((t-3)/1.25,6),16),Cp=0,wp=class{o;controls=new Map;radioPrefix=`pl-${++Cp}-`;unsubscribe;masked=null;constructor(e){this.o=e,this.unsubscribe=e.manager.onChange(e=>this.sync(e))}build(){for(let e of this.o.manager.fields)for(let t of e.widgets)t.hidden||this.controls.has(t.id)||this.controls.set(t.id,{field:e,widget:t,el:this.createControl(e,t)});this.layout(),this.sync(this.o.manager.fields.map(e=>e.name))}layout(){let e=new Map;this.o.viewport.pageList.entries.forEach((t,n)=>t.doc===this.o.doc&&e.set(t.index,n));for(let{widget:t,el:n}of this.controls.values()){let r=e.get(t.pageIndex);if(r===void 0||this.masked?.(t,r)){n.remove();continue}let i=this.o.viewport.formLayer(r);n.parentElement!==i&&i.append(n),this.place(n,t,r)}}commitPending(){let e=document.activeElement;for(let{el:t}of this.controls.values())t===e&&t.dispatchEvent(new Event(`change`))}destroy(){this.unsubscribe();for(let{el:e}of this.controls.values())e.remove();this.controls.clear()}place(e,t,n){let r=this.o.viewport.pageSize(n),i=ju(t.rect,r),[a,o]=t.rotation===90||t.rotation===270?[t.rect.height,t.rect.width]:[t.rect.width,t.rect.height];Object.assign(e.style,{left:xp(i.left+i.width/2),top:xp(i.top+i.height/2),width:`calc(var(--total-scale-factor) * ${a}px)`,height:`calc(var(--total-scale-factor) * ${o}px)`,transform:`translate(-50%, -50%) rotate(${r.rotation-t.rotation}deg)`})}createControl(e,t){let n;switch(e.type){case`text`:e.multiline?n=document.createElement(`textarea`):(n=document.createElement(`input`),n.type=e.password?`password`:`text`),e.maxLength&&(n.maxLength=e.maxLength),n.spellcheck=!1;break;case`checkbox`:case`radio`:n=document.createElement(`input`),n.type=e.type,e.type===`radio`&&(n.name=this.radioPrefix+e.name);break;case`dropdown`:case`listbox`:n=document.createElement(`select`),n.multiple=e.type===`listbox`&&!!e.multiSelect,e.type===`listbox`?n.size=Math.max(2,e.options?.length??2):n.add(new Option(``,``));for(let t of e.options??[])n.add(new Option(t.label,t.value))}if(n.className=`pl-field pl-field-${e.type}`,n.dataset.field=e.name,n.dataset.widget=t.id,e.required&&(n.required=!0),n.setAttribute(`aria-label`,e.name),e.type===`text`||e.type===`dropdown`||e.type===`listbox`){let r=t.fontSize||Sp(e,t.rect.height);Object.assign(n.style,{fontSize:`calc(var(--total-scale-factor) * ${r}px)`,color:t.color,textAlign:t.align})}return t.background&&n.style.setProperty(`--pl-field-bg`,t.background),t.border&&n.style.setProperty(`--pl-field-border`,t.border),n.addEventListener(`change`,()=>this.commit(e,t,n)),n.addEventListener(`pointerdown`,e=>e.stopPropagation()),n}commit(e,t,n){let{manager:r}=this.o,i;i=n instanceof HTMLSelectElement?n.multiple?[...n.selectedOptions].map(e=>e.value):n.value:n instanceof HTMLInputElement&&n.type===`checkbox`?n.checked:n instanceof HTMLInputElement&&n.type===`radio`?n.checked?t.exportValue:r.value(e.name):n.value;try{r.setValues({[e.name]:i},`user`)}catch(t){console.warn(`[pdfcedar] form value rejected`,t),this.sync([e.name])}}sync(e){let{manager:t}=this.o,n=new Set(e),r=this.o.readOnly||t.flattened;for(let{field:e,widget:i,el:a}of this.controls.values()){if(!n.has(e.name))continue;let o=t.value(e.name);if(a instanceof HTMLSelectElement){let e=new Set(Array.isArray(o)?o:[o]);for(let t of a.options)t.selected=e.has(t.value);!a.multiple&&typeof o==`string`&&o!==``&&a.value!==o&&(a.add(new Option(o,o)),a.value=o)}else a instanceof HTMLInputElement&&a.type===`checkbox`?a.checked=o===!0:a instanceof HTMLInputElement&&a.type===`radio`?a.checked=o===i.exportValue:a.value!==o&&(a.value=String(o??``));a.disabled=r||e.readOnly,a.classList.toggle(`pl-field-flattened`,t.flattened)}}};Me();var Tp=1600,Ep=4194304;function Dp(e){return new Promise((t,n)=>{let r=new FileReader;r.onload=()=>t(r.result),r.onerror=()=>n(r.error??Error(`Could not read the image.`)),r.readAsDataURL(e)})}function Op(e){let t=URL.createObjectURL(e);return new Promise((e,n)=>{let r=new Image;r.onload=()=>e(r),r.onerror=()=>n(TypeError("signatures.add: `image` is not an image the browser can read.")),r.src=t}).finally(()=>URL.revokeObjectURL(t))}async function kp(e){let t;if(e instanceof Blob)t=e;else if(typeof e==`string`&&e.startsWith(`data:`))t=Ap(e);else if(typeof e==`string`&&e!==``){let n=await fetch(e).catch(e=>{throw TypeError(`signatures.add: could not load the image (${e.message}).`)});if(!n.ok)throw TypeError(`signatures.add: could not load the image (HTTP ${n.status}).`);t=await n.blob()}else throw TypeError("signatures.add: `image` must be a data URL, an image URL or a Blob.");let n=await Op(t),{naturalWidth:r,naturalHeight:i}=n;if(!r||!i)throw TypeError(`signatures.add: the image has no size.`);let a=(t.type===`image/png`||t.type===`image/jpeg`)&&Math.max(r,i)<=Tp,o;if(a)o=await Dp(t);else{let e=Math.min(1,Tp/Math.max(r,i)),a=document.createElement(`canvas`);a.width=Math.round(r*e),a.height=Math.round(i*e),a.getContext(`2d`).drawImage(n,0,0,a.width,a.height),o=t.type===`image/jpeg`?a.toDataURL(`image/jpeg`,.9):a.toDataURL(`image/png`)}if(o.length>Ep)throw TypeError(`signatures.add: the image is too large (over 4 MB).`);return o}function Ap(e){let t=/^data:([^;,]*)(;base64)?,(.*)$/s.exec(e);if(!t)throw TypeError("signatures.add: `image` is not a valid data URL.");let[,n=``,r,i=``]=t;if(!r)return new Blob([decodeURIComponent(i)],{type:n});let a=atob(i),o=new Uint8Array(a.length);for(let e=0;e<a.length;e++)o[e]=a.charCodeAt(e);return new Blob([o],{type:n})}async function jp(e){let t=await Op(Ap(e));return{width:t.naturalWidth,height:t.naturalHeight}}var Mp=new Map,Np=class{store;userId;list=null;loading=null;constructor(e,t){this.store=e,this.userId=t}async all(){return this.list?this.list:(this.loading??=(async()=>{try{let e=this.store?await this.store.load():Mp.get(this.userId)??[];this.list=Array.isArray(e)?e.filter(e=>typeof e?.image==`string`&&typeof e.id==`string`):[]}catch(e){console.warn(`[pdfcedar] signatureStore.load failed; starting with no saved signatures.`,e),this.list=[]}return this.list})(),this.loading)}async add(e){let t=await this.all();t.some(t=>t.image===e)||await this.persist([{id:N(),image:e,createdAt:new Date().toISOString()},...t])}async remove(e){await this.persist((await this.all()).filter(t=>t.id!==e))}async persist(e){if(this.list=e,!this.store)Mp.set(this.userId,e);else try{await this.store.save(e)}catch(e){console.warn(`[pdfcedar] signatureStore.save failed.`,e)}}},Pp={async decodeJpeg(e){try{let t=await createImageBitmap(new Blob([e],{type:`image/jpeg`}),{colorSpaceConversion:`none`}),n=document.createElement(`canvas`);n.width=t.width,n.height=t.height;let r=n.getContext(`2d`,{willReadFrequently:!0});r.drawImage(t,0,0),t.close();let{data:i}=r.getImageData(0,0,n.width,n.height);return{width:n.width,height:n.height,data:i}}catch{return null}},async encodeJpeg(e,t,n){let r=document.createElement(`canvas`);r.width=t,r.height=n,r.getContext(`2d`).putImageData(new ImageData(new Uint8ClampedArray(e),t,n),0,0);let i=await new Promise(e=>r.toBlob(e,`image/jpeg`,.92));if(!i)throw Error(`Could not encode the redacted image.`);return new Uint8Array(await i.arrayBuffer())}},Fp=new Set([90,180,270]),Ip=class{o;merged=[];constructor(e){this.o=e}get list(){return this.o.viewport.pageList}rotate(e,t,n=`api`){let r=this.index(`rotate`,e);if(!Fp.has(t))throw RangeError(`pages.rotate: expected 90, 180 or 270 degrees, got ${t}.`);this.commit(`Rotate page`,this.list.rotated(r,t))}delete(e,t=`api`){let n=this.index(`delete`,e),r=this.list.without(n),{manager:i,history:a}=this.o;a.transaction(`Delete page`,()=>{for(let n of i.list({page:e}))n.type!==`reply`&&i.remove(n.id,t,{withPage:!0});for(let n of i.list())n.type!==`reply`&&n.page>e&&i.update(n.id,{page:n.page-1},t);this.commit(`Delete page`,r)})}move(e,t,n=`api`){let r=this.index(`move`,e),i=this.index(`move`,t);if(r===i)return;let a=this.list,o=a.moved(r,i),s=new Map(o.entries.map((e,t)=>[e.key,t])),{manager:c,history:l}=this.o;l.transaction(`Move page`,()=>{for(let e of c.list()){if(e.type===`reply`)continue;let t=s.get(a.at(e.page-1).key)+1;t!==e.page&&c.update(e.id,{page:t},n)}this.commit(`Move page`,o)})}async merge(e){let t=await Wu.open(e);this.merged.push(t),this.commit(`Insert pages`,this.list.withDocument(t))}plan(){let e=[];return{pages:this.list.entries.map(t=>{let n=0;return t.doc!==this.o.original&&(n=e.indexOf(t.doc)+1||e.push(t.doc)),{doc:n,index:t.index,rotation:t.rotation}}),documents:e}}get unchanged(){let{entries:e}=this.list;return e.length===this.o.original.pageCount&&e.every((e,t)=>e.doc===this.o.original&&e.index===t&&e.rotation===0)}destroy(){for(let e of this.merged)e.destroy()}index(e,t){if(!Number.isInteger(t)||t<1||t>this.list.count)throw RangeError(`pages.${e}: expected a page from 1 to ${this.list.count}, got ${t}.`);return t-1}commit(e,t){let n=this.list;this.apply(t),this.o.history.record({label:e,undo:()=>this.apply(n),redo:()=>this.apply(t)})}apply(e){this.o.viewport.setPages(e),this.o.onChange(e)}},Lp=`428a2f98d728ae22.7137449123ef65cd.b5c0fbcfec4d3b2f.e9b5dba58189dbbc.3956c25bf348b538.59f111f1b605d019.923f82a4af194f9b.ab1c5ed5da6d8118.d807aa98a3030242.12835b0145706fbe.243185be4ee4b28c.550c7dc3d5ffb4e2.72be5d74f27b896f.80deb1fe3b1696b1.9bdc06a725c71235.c19bf174cf692694.e49b69c19ef14ad2.efbe4786384f25e3.0fc19dc68b8cd5b5.240ca1cc77ac9c65.2de92c6f592b0275.4a7484aa6ea6e483.5cb0a9dcbd41fbd4.76f988da831153b5.983e5152ee66dfab.a831c66d2db43210.b00327c898fb213f.bf597fc7beef0ee4.c6e00bf33da88fc2.d5a79147930aa725.06ca6351e003826f.142929670a0e6e70.27b70a8546d22ffc.2e1b21385c26c926.4d2c6dfc5ac42aed.53380d139d95b3df.650a73548baf63de.766a0abb3c77b2a8.81c2c92e47edaee6.92722c851482353b.a2bfe8a14cf10364.a81a664bbc423001.c24b8b70d0f89791.c76c51a30654be30.d192e819d6ef5218.d69906245565a910.f40e35855771202a.106aa07032bbd1b8.19a4c116b8d2d0c8.1e376c085141ab53.2748774cdf8eeb99.34b0bcb5e19b48a8.391c0cb3c5c95a63.4ed8aa4ae3418acb.5b9cca4f7763e373.682e6ff3d6b2b8a3.748f82ee5defb2fc.78a5636f43172f60.84c87814a1f0ab72.8cc702081a6439ec.90befffa23631e28.a4506cebde82bde9.bef9a3f7b2c67915.c67178f2e372532b.ca273eceea26619c.d186b8c721c0c207.eada7dd6cde0eb1e.f57d4f7fee6ed178.06f067aa72176fba.0a637dc5a2c898a6.113f9804bef90dae.1b710b35131c471b.28db77f523047d84.32caab7b40c72493.3c9ebe0a15c9bebc.431d67c49c100d4c.4cc5d4becb3e42b6.597f299cfc657e2a.5fcb6fab3ad6faec.6c44198c4a475817`.split(`.`).map(e=>BigInt(`0x${e}`)),Rp=[`6a09e667f3bcc908`,`bb67ae8584caa73b`,`3c6ef372fe94f82b`,`a54ff53a5f1d36f1`,`510e527fade682d1`,`9b05688c2b3e6c1f`,`1f83d9abfb41bd6b`,`5be0cd19137e2179`].map(e=>BigInt(`0x${e}`)),zp=(1n<<64n)-1n,Bp=(e,t)=>(e>>t|e<<64n-t)&zp;function Vp(e){let t=e.length,n=new Uint8Array(Math.ceil((t+17)/128)*128);n.set(e),n[t]=128;let r=new DataView(n.buffer);r.setBigUint64(n.length-8,BigInt(t)*8n);let i=[...Rp],a=Array(80);for(let e=0;e<n.length;e+=128){for(let t=0;t<16;t++)a[t]=r.getBigUint64(e+t*8);for(let e=16;e<80;e++){let t=Bp(a[e-15],1n)^Bp(a[e-15],8n)^a[e-15]>>7n,n=Bp(a[e-2],19n)^Bp(a[e-2],61n)^a[e-2]>>6n;a[e]=a[e-16]+t+a[e-7]+n&zp}let[t,n,o,s,c,l,u,d]=i;for(let e=0;e<80;e++){let r=Bp(c,14n)^Bp(c,18n)^Bp(c,41n),i=c&l^~c&zp&u,f=d+r+i+Lp[e]+a[e]&zp,p=(Bp(t,28n)^Bp(t,34n)^Bp(t,39n))+(t&n^t&o^n&o)&zp;d=u,u=l,l=c,c=s+f&zp,s=o,o=n,n=t,t=f+p&zp}let f=[t,n,o,s,c,l,u,d];for(let e=0;e<8;e++)i[e]=i[e]+f[e]&zp}let o=new Uint8Array(64),s=new DataView(o.buffer);return i.forEach((e,t)=>s.setBigUint64(t*8,e)),o}var Hp=2n**255n-19n,Up=2n**252n+27742317777372353535851937790883648493n,Wp=(e,t=Hp)=>(e%t+t)%t;function Gp(e,t){let n=1n;for(e=Wp(e);t>0n;)t&1n&&(n=Wp(n*e)),e=Wp(e*e),t>>=1n;return n}var Kp=e=>Gp(e,Hp-2n),qp=Wp(-121665n*Kp(121666n)),Jp=Gp(2n,(Hp-1n)/4n),Yp=[0n,1n,1n,0n],Xp=Wp(4n*Kp(5n)),Zp=15112221349535400772501151409588531511454012693041857206046113283949847762202n,Qp=[Zp,Xp,1n,Wp(Zp*Xp)];function $p([e,t,n,r],[i,a,o,s]){let c=Wp((t-e)*(a-i)),l=Wp((t+e)*(a+i)),u=Wp(r*2n*qp*s),d=Wp(n*2n*o),f=l-c,p=d-u,m=d+u,h=l+c;return[Wp(f*p),Wp(m*h),Wp(p*m),Wp(f*h)]}function em(e,t){let n=Yp;for(let r=e;t>0n;t>>=1n,r=$p(r,r))t&1n&&(n=$p(n,r));return n}var tm=([e,t,n],[r,i,a])=>Wp(e*a-r*n)===0n&&Wp(t*a-i*n)===0n,nm=e=>e.reduceRight((e,t)=>e<<8n|BigInt(t),0n);function rm(e){let t=nm(e),n=t&(1n<<255n)-1n,r=t>>255n;if(n>=Hp)return null;let i=Wp(n*n-1n),a=Wp(qp*n*n+1n),o=Wp(i*Gp(a,3n)*Gp(i*Gp(a,7n),(Hp-5n)/8n)),s=Wp(a*o*o);if(s===Wp(-i))o=Wp(o*Jp);else if(s!==i)return null;return o===0n&&r===1n?null:((o&1n)!==r&&(o=Hp-o),[o,n,1n,Wp(o*n)])}function im(e,t,n){if(e.length!==32||t.length!==64)return!1;let r=rm(e),i=rm(t.subarray(0,32)),a=nm(t.subarray(32));if(!r||!i||a>=Up)return!1;let o=new Uint8Array(64+n.length);o.set(t.subarray(0,32)),o.set(e,32),o.set(n,64);let s=Wp(nm(Vp(o)),Up);return tm(em(Qp,a),$p(i,em(r,s)))}async function am(e,t,n){let r=globalThis.crypto?.subtle;if(r)try{let i=await r.importKey(`raw`,e,{name:`Ed25519`},!1,[`verify`]);return await r.verify({name:`Ed25519`},i,t,n)}catch{}try{return im(e,t,n)}catch{return!1}}var om={pl1:{publicKey:`4mBfwMSTGjAgOv62c7Uf77mQY0RqnnIj9l0cc9dIgqg`},dev:{publicKey:`WSP-wWkxZG4imEW6mmmpKlFYnIX8qMXy-bNncfqHfJk`,loopbackOnly:!0}};function sm(e){if(!/^[A-Za-z0-9_-]*$/.test(e))return null;try{let t=atob(e.replace(/-/g,`+`).replace(/_/g,`/`));return Uint8Array.from(t,e=>e.charCodeAt(0))}catch{return null}}function cm(e){let t=e.toLowerCase().replace(/\.$/,``);return t===`localhost`||t.endsWith(`.localhost`)||/^127(\.\d{1,3}){3}$/.test(t)||t===`[::1]`||t===`::1`}function lm(e,t){let n=t.toLowerCase().replace(/\.$/,``);return e.some(e=>{let t=e.toLowerCase();return t===`*`?!0:t.startsWith(`*.`)?n.endsWith(t.slice(1))&&n.length>t.length-1:n===t})}function um(e){if(typeof e!=`object`||!e)return null;let t=e,n=e=>typeof e==`string`&&/^\d{4}-\d{2}-\d{2}$/.test(e);return t.v!==1||typeof t.kid!=`string`||typeof t.id!=`string`||typeof t.licensee!=`string`||typeof t.plan!=`string`||!Array.isArray(t.domains)||!t.domains.every(e=>typeof e==`string`)||!n(t.issued)||t.expires!==void 0&&!n(t.expires)?null:{kid:t.kid,id:t.id,licensee:t.licensee,plan:t.plan,domains:t.domains,issued:t.issued,...t.expires?{expires:t.expires}:{}}}async function dm(e,t={}){if(e==null||e.trim()===``)return{valid:!1,reason:`missing`};if(typeof e!=`string`)return{valid:!1,reason:`malformed`};let n=e.trim().split(`.`);if(n.length!==3||n[0]!==`PL1`)return{valid:!1,reason:`malformed`};let r=sm(n[1]),i=sm(n[2]);if(!r||!i)return{valid:!1,reason:`malformed`};let a;try{a=um(JSON.parse(new TextDecoder(`utf-8`,{fatal:!0}).decode(r)))}catch{a=null}if(!a)return{valid:!1,reason:`malformed`};let{kid:o,...s}=a,c=t.keyring??om,l=Object.hasOwn(c,o)?c[o]:void 0;if(!l)return{valid:!1,reason:`unknown-signer`,details:s};let u=sm(l.publicKey);if(!u||!await am(u,i,r))return{valid:!1,reason:`bad-signature`};let d=t.now??new Date;if(s.expires&&d.getTime()>Date.parse(`${s.expires}T23:59:59.999-12:00`))return{valid:!1,reason:`expired`,details:s};let f=t.hostname??globalThis.location?.hostname??``;return(l.loopbackOnly?cm(f):cm(f)||lm(s.domains,f))?{valid:!0,details:s}:{valid:!1,reason:`domain`,details:s}}var fm={missing:`no licence key was given`,malformed:`the licence key isn't in the right format (copy it again in full)`,"unknown-signer":`the licence key wasn't issued for this version of PDFCedar`,"bad-signature":`the licence key has been altered or is not genuine`,expired:`the licence key has expired`,domain:`the licence key isn't issued for this domain`},pm=`PDFCedar trial`;function mm(e){let t=e.getContext(`2d`);if(!t)return;let{width:n,height:r}=e,i=Math.max(10,Math.round(Math.min(n,r)/14));t.save(),t.font=`600 ${i}px system-ui, sans-serif`,t.fillStyle=`rgba(220, 38, 38, 0.18)`,t.textAlign=`center`,t.textBaseline=`middle`,t.translate(n/2,r/2),t.rotate(-Math.atan2(r,n));let a=Math.hypot(n,r),o=i*4;for(let e=-a/2;e<=a/2;e+=o){let n=Math.round(e/o)%2*t.measureText(pm).width*.6;for(let r=-a/2+n;r<=a/2;r+=t.measureText(pm).width*1.6)t.fillText(pm,r,e)}t.restore()}function G(e,t){ym(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}function hm(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function gm(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})}function _m(e,t){var n={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},r,i,a,o={next:s(0),throw:s(1),return:s(2)};return typeof Symbol==`function`&&(o[Symbol.iterator]=function(){return this}),o;function s(e){return function(t){return c([e,t])}}function c(o){if(r)throw TypeError(`Generator is already executing.`);for(;n;)try{if(r=1,i&&(a=o[0]&2?i.return:o[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,o[1])).done)return a;switch(i=0,a&&(o=[o[0]&2,a.value]),o[0]){case 0:case 1:a=o;break;case 4:return n.label++,{value:o[1],done:!1};case 5:n.label++,i=o[1],o=[0];continue;case 7:o=n.ops.pop(),n.trys.pop();continue;default:if(a=n.trys,!(a=a.length>0&&a[a.length-1])&&(o[0]===6||o[0]===2)){n=0;continue}if(o[0]===3&&(!a||o[1]>a[0]&&o[1]<a[3])){n.label=o[1];break}if(o[0]===6&&n.label<a[1]){n.label=a[1],a=o;break}if(a&&n.label<a[2]){n.label=a[2],n.ops.push(o);break}a[2]&&n.ops.pop(),n.trys.pop();continue}o=t.call(e,n)}catch(e){o=[6,e],i=0}finally{r=a=0}if(o[0]&5)throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}}function vm(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;for(var r=Array(e),i=0,t=0;t<n;t++)for(var a=arguments[t],o=0,s=a.length;o<s;o++,i++)r[i]=a[o];return r}var ym,bm,K=s((()=>{ym=function(e,t){return ym=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},ym(e,t)},bm=function(){return bm=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},bm.apply(this,arguments)}})),xm,Sm,Cm,wm,Tm,Em,Dm,Om=s((()=>{for(xm=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,Sm=new Uint8Array(256),Cm=0;Cm<xm.length;Cm++)Sm[xm.charCodeAt(Cm)]=Cm;wm=function(e){for(var t=``,n=e.length,r=0;r<n;r+=3)t+=xm[e[r]>>2],t+=xm[(e[r]&3)<<4|e[r+1]>>4],t+=xm[(e[r+1]&15)<<2|e[r+2]>>6],t+=xm[e[r+2]&63];return n%3==2?t=t.substring(0,t.length-1)+`=`:n%3==1&&(t=t.substring(0,t.length-2)+`==`),t},Tm=function(e){var t=e.length*.75,n=e.length,r,i=0,a,o,s,c;e[e.length-1]===`=`&&(t--,e[e.length-2]===`=`&&t--);var l=new Uint8Array(t);for(r=0;r<n;r+=4)a=Sm[e.charCodeAt(r)],o=Sm[e.charCodeAt(r+1)],s=Sm[e.charCodeAt(r+2)],c=Sm[e.charCodeAt(r+3)],l[i++]=a<<2|o>>4,l[i++]=(o&15)<<4|s>>2,l[i++]=(s&3)<<6|c&63;return l},Em=/^(data)?:?([\w\/\+]+)?;?(charset=[\w-]+|base64)?.*,/i,Dm=function(e){var t=e.trim(),n=t.substring(0,100).match(Em);if(!n)return Tm(t);var r=n[0];return Tm(t.substring(r.length))}})),km,Am,jm,Mm,Nm,Pm,Fm,Im,Lm,Rm,zm,Bm,Vm,Hm,Um,Wm,Gm,Km,qm,Jm,Ym,Xm=s((()=>{km=function(e){return e.charCodeAt(0)},Am=function(e){return e.codePointAt(0)},jm=function(e,t){return Fm(e.toString(16),t,`0`).toUpperCase()},Mm=function(e){return jm(e,2)},Nm=function(e){return String.fromCharCode(e)},Pm=function(e){return Nm(parseInt(e,16))},Fm=function(e,t,n){for(var r=``,i=0,a=t-e.length;i<a;i++)r+=n;return r+e},Im=function(e,t,n){for(var r=e.length,i=0;i<r;i++)t[n++]=e.charCodeAt(i);return r},Lm=function(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)},Rm=function(e){return e.replace(/\t|\u0085|\u2028|\u2029/g,` `).replace(/[\b\v]/g,``)},zm=[`\\n`,`\\f`,`\\r`,`\\u000B`],Bm=function(e){return/^[\n\f\r\u000B]$/.test(e)},Vm=function(e){return e.split(/[\n\f\r\u000B]/)},Hm=function(e){return e.replace(/[\n\f\r\u000B]/g,` `)},Um=function(e,t){var n=e.charCodeAt(t),r,i=t+1,a=1;return n>=55296&&n<=56319&&e.length>i&&(r=e.charCodeAt(i),r>=56320&&r<=57343&&(a=2)),[e.slice(t,t+a),a]},Wm=function(e){for(var t=[],n=0,r=e.length;n<r;){var i=Um(e,n),a=i[0],o=i[1];t.push(a),n+=o}return t},Gm=function(e){for(var t=zm.join(`|`),n=[`$`],r=0,i=e.length;r<i;r++){var a=e[r];if(Bm(a))throw TypeError("`wordBreak` must not include "+t);n.push(a===``?`.`:Lm(a))}var o=n.join(`|`);return RegExp(`(`+t+`)|((.*?)(`+o+`))`,`gm`)},Km=function(e,t,n,r){for(var i=Gm(t),a=Rm(e).match(i),o=``,s=0,c=[],l=function(){o!==``&&c.push(o),o=``,s=0},u=0,d=a.length;u<d;u++){var f=a[u];if(Bm(f))l();else{var p=r(f);s+p>n&&l(),o+=f,s+=p}}return l(),c},qm=/^D:(\d\d\d\d)(\d\d)?(\d\d)?(\d\d)?(\d\d)?(\d\d)?([+\-Z])?(\d\d)?'?(\d\d)?'?$/,Jm=function(e){var t=e.match(qm);if(t){var n=t[1],r=t[2],i=r===void 0?`01`:r,a=t[3],o=a===void 0?`01`:a,s=t[4],c=s===void 0?`00`:s,l=t[5],u=l===void 0?`00`:l,d=t[6],f=d===void 0?`00`:d,p=t[7],m=p===void 0?`Z`:p,h=t[8],g=h===void 0?`00`:h,_=t[9],v=_===void 0?`00`:_,y=m===`Z`?`Z`:``+m+g+`:`+v;return new Date(n+`-`+i+`-`+o+`T`+c+`:`+u+`:`+f+y)}},Ym=function(e,t){for(var n=0,r;n<e.length;){var i=e.substring(n).match(t);if(!i)return{match:r,pos:n};r=i,n+=(i.index??0)+i[0].length}return{match:r,pos:n}}})),Zm,Qm,$m,eh,th,nh,rh,ih,ah,oh,sh,ch,lh,uh=s((()=>{Om(),Xm(),Zm=function(e){return e[e.length-1]},Qm=function(e){if(e instanceof Uint8Array)return e;for(var t=e.length,n=new Uint8Array(t),r=0;r<t;r++)n[r]=e.charCodeAt(r);return n},$m=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];for(var n=e.length,r=[],i=0;i<n;i++){var a=e[i];r[i]=a instanceof Uint8Array?a:Qm(a)}for(var o=0,i=0;i<n;i++)o+=e[i].length;for(var s=new Uint8Array(o),c=0,l=0;l<n;l++)for(var u=r[l],d=0,f=u.length;d<f;d++)s[c++]=u[d];return s},eh=function(e){for(var t=0,n=0,r=e.length;n<r;n++)t+=e[n].length;for(var i=new Uint8Array(t),a=0,n=0,r=e.length;n<r;n++){var o=e[n];i.set(o,a),a+=o.length}return i},th=function(e){for(var t=``,n=0,r=e.length;n<r;n++)t+=Nm(e[n]);return t},nh=function(e,t){return e.id-t.id},rh=function(e,t){for(var n=[],r=0,i=e.length;r<i;r++){var a=e[r],o=e[r-1];(r===0||t(a)!==t(o))&&n.push(a)}return n},ih=function(e){for(var t=e.length,n=0,r=Math.floor(t/2);n<r;n++){var i=n,a=t-n-1,o=e[n];e[i]=e[a],e[a]=o}return e},ah=function(e){for(var t=0,n=0,r=e.length;n<r;n++)t+=e[n];return t},oh=function(e,t){for(var n=Array(t-e),r=0,i=n.length;r<i;r++)n[r]=e+r;return n},sh=function(e,t){for(var n=Array(t.length),r=0,i=t.length;r<i;r++)n[r]=e[t[r]];return n},ch=function(e){return e instanceof Uint8Array||e instanceof ArrayBuffer||typeof e==`string`},lh=function(e){if(typeof e==`string`)return Dm(e);if(e instanceof ArrayBuffer)return new Uint8Array(e);if(e instanceof Uint8Array)return e;throw TypeError("`input` must be one of `string | ArrayBuffer | Uint8Array`")}})),dh,fh=s((()=>{dh=function(){return new Promise(function(e){setTimeout(function(){return e()},0)})}})),ph,mh,hh,gh,_h,vh,yh,bh,xh,Sh,Ch,wh,Th,Eh,Dh,Oh=s((()=>{Xm(),ph=function(e,t){t===void 0&&(t=!0);var n=[];t&&n.push(65279);for(var r=0,i=e.length;r<i;){var a=e.codePointAt(r);if(a<65536)n.push(a),r+=1;else if(a<1114112)n.push(gh(a),_h(a)),r+=2;else throw Error(`Invalid code point: 0x`+Mm(a))}return new Uint16Array(n)},mh=function(e){return e>=0&&e<=65535},hh=function(e){return e>=65536&&e<=1114111},gh=function(e){return Math.floor((e-65536)/1024)+55296},_h=function(e){return(e-65536)%1024+56320},(function(e){e.BigEndian=`BigEndian`,e.LittleEndian=`LittleEndian`})(vh||={}),yh=`�`.codePointAt(0),bh=function(e,t){if(t===void 0&&(t=!0),e.length<=1)return String.fromCodePoint(yh);for(var n=t?wh(e):vh.BigEndian,r=t?2:0,i=[];e.length-r>=2;){var a=Ch(e[r++],e[r++],n);if(xh(a)){if(e.length-r<2)i.push(yh);else{var o=Ch(e[r++],e[r++],n);Sh(o)?i.push(a,o):i.push(yh)}}else Sh(a)?(r+=2,i.push(yh)):i.push(a)}return r<e.length&&i.push(yh),String.fromCodePoint.apply(String,i)},xh=function(e){return e>=55296&&e<=56319},Sh=function(e){return e>=56320&&e<=57343},Ch=function(e,t,n){if(n===vh.LittleEndian)return t<<8|e;if(n===vh.BigEndian)return e<<8|t;throw Error(`Invalid byteOrder: `+n)},wh=function(e){return Th(e)?vh.BigEndian:Eh(e)?vh.LittleEndian:vh.BigEndian},Th=function(e){return e[0]===254&&e[1]===255},Eh=function(e){return e[0]===255&&e[1]===254},Dh=function(e){return Th(e)||Eh(e)}})),kh,Ah,jh,Mh=s((()=>{kh=function(e){var t=String(e);if(Math.abs(e)<1){var n=parseInt(e.toString().split(`e-`)[1]);if(n){var r=e<0;r&&(e*=-1),e*=10**(n-1),t=`0.`+Array(n).join(`0`)+e.toString().substring(2),r&&(t=`-`+t)}}else{var n=parseInt(e.toString().split(`+`)[1]);n>20&&(n-=20,e/=10**n,t=e.toString()+Array(n+1).join(`0`))}return t},Ah=function(e){return Math.ceil(e.toString(2).length/8)},jh=function(e){for(var t=new Uint8Array(Ah(e)),n=1;n<=t.length;n++)t[n-1]=e>>(t.length-n)*8;return t}})),Nh,Ph=s((()=>{Nh=function(e){throw Error(e)}})),Fh=c((e=>{var t=typeof Uint8Array<`u`&&typeof Uint16Array<`u`&&typeof Int32Array<`u`;function n(e,t){return Object.prototype.hasOwnProperty.call(e,t)}e.assign=function(e){for(var t=Array.prototype.slice.call(arguments,1);t.length;){var r=t.shift();if(r){if(typeof r!=`object`)throw TypeError(r+`must be non-object`);for(var i in r)n(r,i)&&(e[i]=r[i])}}return e},e.shrinkBuf=function(e,t){return e.length===t?e:e.subarray?e.subarray(0,t):(e.length=t,e)};var r={arraySet:function(e,t,n,r,i){if(t.subarray&&e.subarray)e.set(t.subarray(n,n+r),i);else for(var a=0;a<r;a++)e[i+a]=t[n+a]},flattenChunks:function(e){var t,n,r=0,i,a,o;for(t=0,n=e.length;t<n;t++)r+=e[t].length;for(o=new Uint8Array(r),i=0,t=0,n=e.length;t<n;t++)a=e[t],o.set(a,i),i+=a.length;return o}},i={arraySet:function(e,t,n,r,i){for(var a=0;a<r;a++)e[i+a]=t[n+a]},flattenChunks:function(e){return[].concat.apply([],e)}};e.setTyped=function(t){t?(e.Buf8=Uint8Array,e.Buf16=Uint16Array,e.Buf32=Int32Array,e.assign(e,r)):(e.Buf8=Array,e.Buf16=Array,e.Buf32=Array,e.assign(e,i))},e.setTyped(t)})),Ih=c((e=>{var t=Fh(),n=4,r=0,i=1,a=2;function o(e){for(var t=e.length;--t>=0;)e[t]=0}var s=0,c=1,l=2,u=3,d=258,f=29,p=256,m=p+1+f,h=30,g=19,_=2*m+1,v=15,y=16,b=7,x=256,S=16,C=17,w=18,T=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],E=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],D=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],O=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],k=512,A=Array((m+2)*2);o(A);var j=Array(h*2);o(j);var M=Array(k);o(M);var N=Array(d-u+1);o(N);var P=Array(f);o(P);var ee=Array(h);o(ee);function te(e,t,n,r,i){this.static_tree=e,this.extra_bits=t,this.extra_base=n,this.elems=r,this.max_length=i,this.has_stree=e&&e.length}var ne,re,ie;function ae(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function oe(e){return e<256?M[e]:M[256+(e>>>7)]}function se(e,t){e.pending_buf[e.pending++]=t&255,e.pending_buf[e.pending++]=t>>>8&255}function F(e,t,n){e.bi_valid>y-n?(e.bi_buf|=t<<e.bi_valid&65535,se(e,e.bi_buf),e.bi_buf=t>>y-e.bi_valid,e.bi_valid+=n-y):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=n)}function ce(e,t,n){F(e,n[t*2],n[t*2+1])}function le(e,t){var n=0;do n|=e&1,e>>>=1,n<<=1;while(--t>0);return n>>>1}function ue(e){e.bi_valid===16?(se(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=e.bi_buf&255,e.bi_buf>>=8,e.bi_valid-=8)}function de(e,t){var n=t.dyn_tree,r=t.max_code,i=t.stat_desc.static_tree,a=t.stat_desc.has_stree,o=t.stat_desc.extra_bits,s=t.stat_desc.extra_base,c=t.stat_desc.max_length,l,u,d,f,p,m,h=0;for(f=0;f<=v;f++)e.bl_count[f]=0;for(n[e.heap[e.heap_max]*2+1]=0,l=e.heap_max+1;l<_;l++)u=e.heap[l],f=n[n[u*2+1]*2+1]+1,f>c&&(f=c,h++),n[u*2+1]=f,!(u>r)&&(e.bl_count[f]++,p=0,u>=s&&(p=o[u-s]),m=n[u*2],e.opt_len+=m*(f+p),a&&(e.static_len+=m*(i[u*2+1]+p)));if(h!==0){do{for(f=c-1;e.bl_count[f]===0;)f--;e.bl_count[f]--,e.bl_count[f+1]+=2,e.bl_count[c]--,h-=2}while(h>0);for(f=c;f!==0;f--)for(u=e.bl_count[f];u!==0;)d=e.heap[--l],!(d>r)&&(n[d*2+1]!==f&&(e.opt_len+=(f-n[d*2+1])*n[d*2],n[d*2+1]=f),u--)}}function fe(e,t,n){for(var r=Array(v+1),i=0,a=1,o;a<=v;a++)r[a]=i=i+n[a-1]<<1;for(o=0;o<=t;o++){var s=e[o*2+1];s!==0&&(e[o*2]=le(r[s]++,s))}}function pe(){var e,t,n,r,i,a=Array(v+1);for(n=0,r=0;r<f-1;r++)for(P[r]=n,e=0;e<1<<T[r];e++)N[n++]=r;for(N[n-1]=r,i=0,r=0;r<16;r++)for(ee[r]=i,e=0;e<1<<E[r];e++)M[i++]=r;for(i>>=7;r<h;r++)for(ee[r]=i<<7,e=0;e<1<<E[r]-7;e++)M[256+i++]=r;for(t=0;t<=v;t++)a[t]=0;for(e=0;e<=143;)A[e*2+1]=8,e++,a[8]++;for(;e<=255;)A[e*2+1]=9,e++,a[9]++;for(;e<=279;)A[e*2+1]=7,e++,a[7]++;for(;e<=287;)A[e*2+1]=8,e++,a[8]++;for(fe(A,m+1,a),e=0;e<h;e++)j[e*2+1]=5,j[e*2]=le(e,5);ne=new te(A,T,p+1,m,v),re=new te(j,E,0,h,v),ie=new te([],D,0,g,b)}function me(e){for(var t=0;t<m;t++)e.dyn_ltree[t*2]=0;for(t=0;t<h;t++)e.dyn_dtree[t*2]=0;for(t=0;t<g;t++)e.bl_tree[t*2]=0;e.dyn_ltree[x*2]=1,e.opt_len=e.static_len=0,e.last_lit=e.matches=0}function he(e){e.bi_valid>8?se(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0}function ge(e,n,r,i){he(e),i&&(se(e,r),se(e,~r)),t.arraySet(e.pending_buf,e.window,n,r,e.pending),e.pending+=r}function I(e,t,n,r){var i=t*2,a=n*2;return e[i]<e[a]||e[i]===e[a]&&r[t]<=r[n]}function _e(e,t,n){for(var r=e.heap[n],i=n<<1;i<=e.heap_len&&(i<e.heap_len&&I(t,e.heap[i+1],e.heap[i],e.depth)&&i++,!I(t,r,e.heap[i],e.depth));)e.heap[n]=e.heap[i],n=i,i<<=1;e.heap[n]=r}function ve(e,t,n){var r,i,a=0,o,s;if(e.last_lit!==0)do r=e.pending_buf[e.d_buf+a*2]<<8|e.pending_buf[e.d_buf+a*2+1],i=e.pending_buf[e.l_buf+a],a++,r===0?ce(e,i,t):(o=N[i],ce(e,o+p+1,t),s=T[o],s!==0&&(i-=P[o],F(e,i,s)),r--,o=oe(r),ce(e,o,n),s=E[o],s!==0&&(r-=ee[o],F(e,r,s)));while(a<e.last_lit);ce(e,x,t)}function ye(e,t){var n=t.dyn_tree,r=t.stat_desc.static_tree,i=t.stat_desc.has_stree,a=t.stat_desc.elems,o,s,c=-1,l;for(e.heap_len=0,e.heap_max=_,o=0;o<a;o++)n[o*2]===0?n[o*2+1]=0:(e.heap[++e.heap_len]=c=o,e.depth[o]=0);for(;e.heap_len<2;)l=e.heap[++e.heap_len]=c<2?++c:0,n[l*2]=1,e.depth[l]=0,e.opt_len--,i&&(e.static_len-=r[l*2+1]);for(t.max_code=c,o=e.heap_len>>1;o>=1;o--)_e(e,n,o);l=a;do o=e.heap[1],e.heap[1]=e.heap[e.heap_len--],_e(e,n,1),s=e.heap[1],e.heap[--e.heap_max]=o,e.heap[--e.heap_max]=s,n[l*2]=n[o*2]+n[s*2],e.depth[l]=(e.depth[o]>=e.depth[s]?e.depth[o]:e.depth[s])+1,n[o*2+1]=n[s*2+1]=l,e.heap[1]=l++,_e(e,n,1);while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],de(e,t),fe(n,c,e.bl_count)}function be(e,t,n){var r,i=-1,a,o=t[1],s=0,c=7,l=4;for(o===0&&(c=138,l=3),t[(n+1)*2+1]=65535,r=0;r<=n;r++)a=o,o=t[(r+1)*2+1],!(++s<c&&a===o)&&(s<l?e.bl_tree[a*2]+=s:a===0?s<=10?e.bl_tree[C*2]++:e.bl_tree[w*2]++:(a!==i&&e.bl_tree[a*2]++,e.bl_tree[S*2]++),s=0,i=a,o===0?(c=138,l=3):a===o?(c=6,l=3):(c=7,l=4))}function xe(e,t,n){var r,i=-1,a,o=t[1],s=0,c=7,l=4;for(o===0&&(c=138,l=3),r=0;r<=n;r++)if(a=o,o=t[(r+1)*2+1],!(++s<c&&a===o)){if(s<l)do ce(e,a,e.bl_tree);while(--s!==0);else a===0?s<=10?(ce(e,C,e.bl_tree),F(e,s-3,3)):(ce(e,w,e.bl_tree),F(e,s-11,7)):(a!==i&&(ce(e,a,e.bl_tree),s--),ce(e,S,e.bl_tree),F(e,s-3,2));s=0,i=a,o===0?(c=138,l=3):a===o?(c=6,l=3):(c=7,l=4)}}function L(e){var t;for(be(e,e.dyn_ltree,e.l_desc.max_code),be(e,e.dyn_dtree,e.d_desc.max_code),ye(e,e.bl_desc),t=g-1;t>=3&&e.bl_tree[O[t]*2+1]===0;t--);return e.opt_len+=3*(t+1)+5+5+4,t}function Se(e,t,n,r){var i;for(F(e,t-257,5),F(e,n-1,5),F(e,r-4,4),i=0;i<r;i++)F(e,e.bl_tree[O[i]*2+1],3);xe(e,e.dyn_ltree,t-1),xe(e,e.dyn_dtree,n-1)}function R(e){for(var t=4093624447,n=0;n<=31;n++,t>>>=1)if(t&1&&e.dyn_ltree[n*2]!==0)return r;if(e.dyn_ltree[18]!==0||e.dyn_ltree[20]!==0||e.dyn_ltree[26]!==0)return i;for(n=32;n<p;n++)if(e.dyn_ltree[n*2]!==0)return i;return r}var z=!1;function Ce(e){z||=(pe(),!0),e.l_desc=new ae(e.dyn_ltree,ne),e.d_desc=new ae(e.dyn_dtree,re),e.bl_desc=new ae(e.bl_tree,ie),e.bi_buf=0,e.bi_valid=0,me(e)}function we(e,t,n,r){F(e,(s<<1)+ +!!r,3),ge(e,t,n,!0)}function Te(e){F(e,c<<1,3),ce(e,x,A),ue(e)}function Ee(e,t,r,i){var o,s,u=0;e.level>0?(e.strm.data_type===a&&(e.strm.data_type=R(e)),ye(e,e.l_desc),ye(e,e.d_desc),u=L(e),o=e.opt_len+3+7>>>3,s=e.static_len+3+7>>>3,s<=o&&(o=s)):o=s=r+5,r+4<=o&&t!==-1?we(e,t,r,i):e.strategy===n||s===o?(F(e,(c<<1)+ +!!i,3),ve(e,A,j)):(F(e,(l<<1)+ +!!i,3),Se(e,e.l_desc.max_code+1,e.d_desc.max_code+1,u+1),ve(e,e.dyn_ltree,e.dyn_dtree)),me(e),i&&he(e)}function B(e,t,n){return e.pending_buf[e.d_buf+e.last_lit*2]=t>>>8&255,e.pending_buf[e.d_buf+e.last_lit*2+1]=t&255,e.pending_buf[e.l_buf+e.last_lit]=n&255,e.last_lit++,t===0?e.dyn_ltree[n*2]++:(e.matches++,t--,e.dyn_ltree[(N[n]+p+1)*2]++,e.dyn_dtree[oe(t)*2]++),e.last_lit===e.lit_bufsize-1}e._tr_init=Ce,e._tr_stored_block=we,e._tr_flush_block=Ee,e._tr_tally=B,e._tr_align=Te})),Lh=c(((e,t)=>{function n(e,t,n,r){for(var i=e&65535,a=e>>>16&65535,o=0;n!==0;){o=n>2e3?2e3:n,n-=o;do i=i+t[r++]|0,a=a+i|0;while(--o);i%=65521,a%=65521}return i|a<<16}t.exports=n})),Rh=c(((e,t)=>{function n(){for(var e,t=[],n=0;n<256;n++){e=n;for(var r=0;r<8;r++)e=e&1?3988292384^e>>>1:e>>>1;t[n]=e}return t}var r=n();function i(e,t,n,i){var a=r,o=i+n;e^=-1;for(var s=i;s<o;s++)e=e>>>8^a[(e^t[s])&255];return e^-1}t.exports=i})),zh=c(((e,t)=>{t.exports={2:`need dictionary`,1:`stream end`,0:``,"-1":`file error`,"-2":`stream error`,"-3":`data error`,"-4":`insufficient memory`,"-5":`buffer error`,"-6":`incompatible version`}})),Bh=c((e=>{var t=Fh(),n=Ih(),r=Lh(),i=Rh(),a=zh(),o=0,s=1,c=3,l=4,u=5,d=0,f=1,p=-2,m=-3,h=-5,g=-1,_=1,v=2,y=3,b=4,x=0,S=2,C=8,w=9,T=15,E=8,D=286,O=30,k=19,A=2*D+1,j=15,M=3,N=258,P=N+M+1,ee=32,te=42,ne=69,re=73,ie=91,ae=103,oe=113,se=666,F=1,ce=2,le=3,ue=4,de=3;function fe(e,t){return e.msg=a[t],t}function pe(e){return(e<<1)-(e>4?9:0)}function me(e){for(var t=e.length;--t>=0;)e[t]=0}function he(e){var n=e.state,r=n.pending;r>e.avail_out&&(r=e.avail_out),r!==0&&(t.arraySet(e.output,n.pending_buf,n.pending_out,r,e.next_out),e.next_out+=r,n.pending_out+=r,e.total_out+=r,e.avail_out-=r,n.pending-=r,n.pending===0&&(n.pending_out=0))}function ge(e,t){n._tr_flush_block(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,he(e.strm)}function I(e,t){e.pending_buf[e.pending++]=t}function _e(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=t&255}function ve(e,n,a,o){var s=e.avail_in;return s>o&&(s=o),s===0?0:(e.avail_in-=s,t.arraySet(n,e.input,e.next_in,s,a),e.state.wrap===1?e.adler=r(e.adler,n,s,a):e.state.wrap===2&&(e.adler=i(e.adler,n,s,a)),e.next_in+=s,e.total_in+=s,s)}function ye(e,t){var n=e.max_chain_length,r=e.strstart,i,a,o=e.prev_length,s=e.nice_match,c=e.strstart>e.w_size-P?e.strstart-(e.w_size-P):0,l=e.window,u=e.w_mask,d=e.prev,f=e.strstart+N,p=l[r+o-1],m=l[r+o];e.prev_length>=e.good_match&&(n>>=2),s>e.lookahead&&(s=e.lookahead);do if(i=t,l[i+o]===m&&l[i+o-1]===p&&l[i]===l[r]&&l[++i]===l[r+1]){r+=2,i++;do;while(l[++r]===l[++i]&&l[++r]===l[++i]&&l[++r]===l[++i]&&l[++r]===l[++i]&&l[++r]===l[++i]&&l[++r]===l[++i]&&l[++r]===l[++i]&&l[++r]===l[++i]&&r<f);if(a=N-(f-r),r=f-N,a>o){if(e.match_start=t,o=a,a>=s)break;p=l[r+o-1],m=l[r+o]}}while((t=d[t&u])>c&&--n!==0);return o<=e.lookahead?o:e.lookahead}function be(e){var n=e.w_size,r,i,a,o,s;do{if(o=e.window_size-e.lookahead-e.strstart,e.strstart>=n+(n-P)){t.arraySet(e.window,e.window,n,n,0),e.match_start-=n,e.strstart-=n,e.block_start-=n,i=e.hash_size,r=i;do a=e.head[--r],e.head[r]=a>=n?a-n:0;while(--i);i=n,r=i;do a=e.prev[--r],e.prev[r]=a>=n?a-n:0;while(--i);o+=n}if(e.strm.avail_in===0)break;if(i=ve(e.strm,e.window,e.strstart+e.lookahead,o),e.lookahead+=i,e.lookahead+e.insert>=M)for(s=e.strstart-e.insert,e.ins_h=e.window[s],e.ins_h=(e.ins_h<<e.hash_shift^e.window[s+1])&e.hash_mask;e.insert&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[s+M-1])&e.hash_mask,e.prev[s&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=s,s++,e.insert--,!(e.lookahead+e.insert<M)););}while(e.lookahead<P&&e.strm.avail_in!==0)}function xe(e,t){var n=65535;for(n>e.pending_buf_size-5&&(n=e.pending_buf_size-5);;){if(e.lookahead<=1){if(be(e),e.lookahead===0&&t===o)return F;if(e.lookahead===0)break}e.strstart+=e.lookahead,e.lookahead=0;var r=e.block_start+n;if((e.strstart===0||e.strstart>=r)&&(e.lookahead=e.strstart-r,e.strstart=r,ge(e,!1),e.strm.avail_out===0)||e.strstart-e.block_start>=e.w_size-P&&(ge(e,!1),e.strm.avail_out===0))return F}return e.insert=0,t===l?(ge(e,!0),e.strm.avail_out===0?le:ue):(e.strstart>e.block_start&&(ge(e,!1),e.strm.avail_out),F)}function L(e,t){for(var r,i;;){if(e.lookahead<P){if(be(e),e.lookahead<P&&t===o)return F;if(e.lookahead===0)break}if(r=0,e.lookahead>=M&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+M-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),r!==0&&e.strstart-r<=e.w_size-P&&(e.match_length=ye(e,r)),e.match_length>=M){if(i=n._tr_tally(e,e.strstart-e.match_start,e.match_length-M),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=M){e.match_length--;do e.strstart++,e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+M-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart;while(--e.match_length!==0);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+1])&e.hash_mask}else i=n._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(i&&(ge(e,!1),e.strm.avail_out===0))return F}return e.insert=e.strstart<M-1?e.strstart:M-1,t===l?(ge(e,!0),e.strm.avail_out===0?le:ue):e.last_lit&&(ge(e,!1),e.strm.avail_out===0)?F:ce}function Se(e,t){for(var r,i,a;;){if(e.lookahead<P){if(be(e),e.lookahead<P&&t===o)return F;if(e.lookahead===0)break}if(r=0,e.lookahead>=M&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+M-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=M-1,r!==0&&e.prev_length<e.max_lazy_match&&e.strstart-r<=e.w_size-P&&(e.match_length=ye(e,r),e.match_length<=5&&(e.strategy===_||e.match_length===M&&e.strstart-e.match_start>4096)&&(e.match_length=M-1)),e.prev_length>=M&&e.match_length<=e.prev_length){a=e.strstart+e.lookahead-M,i=n._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-M),e.lookahead-=e.prev_length-1,e.prev_length-=2;do++e.strstart<=a&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+M-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart);while(--e.prev_length!==0);if(e.match_available=0,e.match_length=M-1,e.strstart++,i&&(ge(e,!1),e.strm.avail_out===0))return F}else if(e.match_available){if(i=n._tr_tally(e,0,e.window[e.strstart-1]),i&&ge(e,!1),e.strstart++,e.lookahead--,e.strm.avail_out===0)return F}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&=(i=n._tr_tally(e,0,e.window[e.strstart-1]),0),e.insert=e.strstart<M-1?e.strstart:M-1,t===l?(ge(e,!0),e.strm.avail_out===0?le:ue):e.last_lit&&(ge(e,!1),e.strm.avail_out===0)?F:ce}function R(e,t){for(var r,i,a,s,c=e.window;;){if(e.lookahead<=N){if(be(e),e.lookahead<=N&&t===o)return F;if(e.lookahead===0)break}if(e.match_length=0,e.lookahead>=M&&e.strstart>0&&(a=e.strstart-1,i=c[a],i===c[++a]&&i===c[++a]&&i===c[++a])){s=e.strstart+N;do;while(i===c[++a]&&i===c[++a]&&i===c[++a]&&i===c[++a]&&i===c[++a]&&i===c[++a]&&i===c[++a]&&i===c[++a]&&a<s);e.match_length=N-(s-a),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=M?(r=n._tr_tally(e,1,e.match_length-M),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(r=n._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),r&&(ge(e,!1),e.strm.avail_out===0))return F}return e.insert=0,t===l?(ge(e,!0),e.strm.avail_out===0?le:ue):e.last_lit&&(ge(e,!1),e.strm.avail_out===0)?F:ce}function z(e,t){for(var r;;){if(e.lookahead===0&&(be(e),e.lookahead===0)){if(t===o)return F;break}if(e.match_length=0,r=n._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,r&&(ge(e,!1),e.strm.avail_out===0))return F}return e.insert=0,t===l?(ge(e,!0),e.strm.avail_out===0?le:ue):e.last_lit&&(ge(e,!1),e.strm.avail_out===0)?F:ce}function Ce(e,t,n,r,i){this.good_length=e,this.max_lazy=t,this.nice_length=n,this.max_chain=r,this.func=i}var we=[new Ce(0,0,0,0,xe),new Ce(4,4,8,4,L),new Ce(4,5,16,8,L),new Ce(4,6,32,32,L),new Ce(4,4,16,16,Se),new Ce(8,16,32,32,Se),new Ce(8,16,128,128,Se),new Ce(8,32,128,256,Se),new Ce(32,128,258,1024,Se),new Ce(32,258,258,4096,Se)];function Te(e){e.window_size=2*e.w_size,me(e.head),e.max_lazy_match=we[e.level].max_lazy,e.good_match=we[e.level].good_length,e.nice_match=we[e.level].nice_length,e.max_chain_length=we[e.level].max_chain,e.strstart=0,e.block_start=0,e.lookahead=0,e.insert=0,e.match_length=e.prev_length=M-1,e.match_available=0,e.ins_h=0}function Ee(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=C,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new t.Buf16(A*2),this.dyn_dtree=new t.Buf16((2*O+1)*2),this.bl_tree=new t.Buf16((2*k+1)*2),me(this.dyn_ltree),me(this.dyn_dtree),me(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new t.Buf16(j+1),this.heap=new t.Buf16(2*D+1),me(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new t.Buf16(2*D+1),me(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function B(e){var t;return!e||!e.state?fe(e,p):(e.total_in=e.total_out=0,e.data_type=S,t=e.state,t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap?te:oe,e.adler=t.wrap===2?0:1,t.last_flush=o,n._tr_init(t),d)}function De(e){var t=B(e);return t===d&&Te(e.state),t}function Oe(e,t){return!e||!e.state||e.state.wrap!==2?p:(e.state.gzhead=t,d)}function ke(e,n,r,i,a,o){if(!e)return p;var s=1;if(n===g&&(n=6),i<0?(s=0,i=-i):i>15&&(s=2,i-=16),a<1||a>w||r!==C||i<8||i>15||n<0||n>9||o<0||o>b)return fe(e,p);i===8&&(i=9);var c=new Ee;return e.state=c,c.strm=e,c.wrap=s,c.gzhead=null,c.w_bits=i,c.w_size=1<<c.w_bits,c.w_mask=c.w_size-1,c.hash_bits=a+7,c.hash_size=1<<c.hash_bits,c.hash_mask=c.hash_size-1,c.hash_shift=~~((c.hash_bits+M-1)/M),c.window=new t.Buf8(c.w_size*2),c.head=new t.Buf16(c.hash_size),c.prev=new t.Buf16(c.w_size),c.lit_bufsize=1<<a+6,c.pending_buf_size=c.lit_bufsize*4,c.pending_buf=new t.Buf8(c.pending_buf_size),c.d_buf=1*c.lit_bufsize,c.l_buf=3*c.lit_bufsize,c.level=n,c.strategy=o,c.method=r,De(e)}function Ae(e,t){return ke(e,t,C,T,E,x)}function je(e,t){var r,a,m,g;if(!e||!e.state||t>u||t<0)return e?fe(e,p):p;if(a=e.state,!e.output||!e.input&&e.avail_in!==0||a.status===se&&t!==l)return fe(e,e.avail_out===0?h:p);if(a.strm=e,r=a.last_flush,a.last_flush=t,a.status===te){if(a.wrap===2)e.adler=0,I(a,31),I(a,139),I(a,8),a.gzhead?(I(a,+!!a.gzhead.text+(a.gzhead.hcrc?2:0)+(a.gzhead.extra?4:0)+(a.gzhead.name?8:0)+(a.gzhead.comment?16:0)),I(a,a.gzhead.time&255),I(a,a.gzhead.time>>8&255),I(a,a.gzhead.time>>16&255),I(a,a.gzhead.time>>24&255),I(a,a.level===9?2:a.strategy>=v||a.level<2?4:0),I(a,a.gzhead.os&255),a.gzhead.extra&&a.gzhead.extra.length&&(I(a,a.gzhead.extra.length&255),I(a,a.gzhead.extra.length>>8&255)),a.gzhead.hcrc&&(e.adler=i(e.adler,a.pending_buf,a.pending,0)),a.gzindex=0,a.status=ne):(I(a,0),I(a,0),I(a,0),I(a,0),I(a,0),I(a,a.level===9?2:a.strategy>=v||a.level<2?4:0),I(a,de),a.status=oe);else{var _=C+(a.w_bits-8<<4)<<8,b=-1;b=a.strategy>=v||a.level<2?0:a.level<6?1:a.level===6?2:3,_|=b<<6,a.strstart!==0&&(_|=ee),_+=31-_%31,a.status=oe,_e(a,_),a.strstart!==0&&(_e(a,e.adler>>>16),_e(a,e.adler&65535)),e.adler=1}}if(a.status===ne){if(a.gzhead.extra){for(m=a.pending;a.gzindex<(a.gzhead.extra.length&65535)&&!(a.pending===a.pending_buf_size&&(a.gzhead.hcrc&&a.pending>m&&(e.adler=i(e.adler,a.pending_buf,a.pending-m,m)),he(e),m=a.pending,a.pending===a.pending_buf_size));)I(a,a.gzhead.extra[a.gzindex]&255),a.gzindex++;a.gzhead.hcrc&&a.pending>m&&(e.adler=i(e.adler,a.pending_buf,a.pending-m,m)),a.gzindex===a.gzhead.extra.length&&(a.gzindex=0,a.status=re)}else a.status=re}if(a.status===re){if(a.gzhead.name){m=a.pending;do{if(a.pending===a.pending_buf_size&&(a.gzhead.hcrc&&a.pending>m&&(e.adler=i(e.adler,a.pending_buf,a.pending-m,m)),he(e),m=a.pending,a.pending===a.pending_buf_size)){g=1;break}g=a.gzindex<a.gzhead.name.length?a.gzhead.name.charCodeAt(a.gzindex++)&255:0,I(a,g)}while(g!==0);a.gzhead.hcrc&&a.pending>m&&(e.adler=i(e.adler,a.pending_buf,a.pending-m,m)),g===0&&(a.gzindex=0,a.status=ie)}else a.status=ie}if(a.status===ie){if(a.gzhead.comment){m=a.pending;do{if(a.pending===a.pending_buf_size&&(a.gzhead.hcrc&&a.pending>m&&(e.adler=i(e.adler,a.pending_buf,a.pending-m,m)),he(e),m=a.pending,a.pending===a.pending_buf_size)){g=1;break}g=a.gzindex<a.gzhead.comment.length?a.gzhead.comment.charCodeAt(a.gzindex++)&255:0,I(a,g)}while(g!==0);a.gzhead.hcrc&&a.pending>m&&(e.adler=i(e.adler,a.pending_buf,a.pending-m,m)),g===0&&(a.status=ae)}else a.status=ae}if(a.status===ae&&(a.gzhead.hcrc?(a.pending+2>a.pending_buf_size&&he(e),a.pending+2<=a.pending_buf_size&&(I(a,e.adler&255),I(a,e.adler>>8&255),e.adler=0,a.status=oe)):a.status=oe),a.pending!==0){if(he(e),e.avail_out===0)return a.last_flush=-1,d}else if(e.avail_in===0&&pe(t)<=pe(r)&&t!==l)return fe(e,h);if(a.status===se&&e.avail_in!==0)return fe(e,h);if(e.avail_in!==0||a.lookahead!==0||t!==o&&a.status!==se){var x=a.strategy===v?z(a,t):a.strategy===y?R(a,t):we[a.level].func(a,t);if((x===le||x===ue)&&(a.status=se),x===F||x===le)return e.avail_out===0&&(a.last_flush=-1),d;if(x===ce&&(t===s?n._tr_align(a):t!==u&&(n._tr_stored_block(a,0,0,!1),t===c&&(me(a.head),a.lookahead===0&&(a.strstart=0,a.block_start=0,a.insert=0))),he(e),e.avail_out===0))return a.last_flush=-1,d}return t===l?a.wrap<=0?f:(a.wrap===2?(I(a,e.adler&255),I(a,e.adler>>8&255),I(a,e.adler>>16&255),I(a,e.adler>>24&255),I(a,e.total_in&255),I(a,e.total_in>>8&255),I(a,e.total_in>>16&255),I(a,e.total_in>>24&255)):(_e(a,e.adler>>>16),_e(a,e.adler&65535)),he(e),a.wrap>0&&(a.wrap=-a.wrap),a.pending===0?f:d):d}function Me(e){var t;return!e||!e.state?p:(t=e.state.status,t!==te&&t!==ne&&t!==re&&t!==ie&&t!==ae&&t!==oe&&t!==se?fe(e,p):(e.state=null,t===oe?fe(e,m):d))}function Ne(e,n){var i=n.length,a,o,s,c,l,u,f,m;if(!e||!e.state||(a=e.state,c=a.wrap,c===2||c===1&&a.status!==te||a.lookahead))return p;for(c===1&&(e.adler=r(e.adler,n,i,0)),a.wrap=0,i>=a.w_size&&(c===0&&(me(a.head),a.strstart=0,a.block_start=0,a.insert=0),m=new t.Buf8(a.w_size),t.arraySet(m,n,i-a.w_size,a.w_size,0),n=m,i=a.w_size),l=e.avail_in,u=e.next_in,f=e.input,e.avail_in=i,e.next_in=0,e.input=n,be(a);a.lookahead>=M;){o=a.strstart,s=a.lookahead-(M-1);do a.ins_h=(a.ins_h<<a.hash_shift^a.window[o+M-1])&a.hash_mask,a.prev[o&a.w_mask]=a.head[a.ins_h],a.head[a.ins_h]=o,o++;while(--s);a.strstart=o,a.lookahead=M-1,be(a)}return a.strstart+=a.lookahead,a.block_start=a.strstart,a.insert=a.lookahead,a.lookahead=0,a.match_length=a.prev_length=M-1,a.match_available=0,e.next_in=u,e.input=f,e.avail_in=l,a.wrap=c,d}e.deflateInit=Ae,e.deflateInit2=ke,e.deflateReset=De,e.deflateResetKeep=B,e.deflateSetHeader=Oe,e.deflate=je,e.deflateEnd=Me,e.deflateSetDictionary=Ne,e.deflateInfo=`pako deflate (from Nodeca project)`})),Vh=c((e=>{var t=Fh(),n=!0,r=!0;try{String.fromCharCode.apply(null,[0])}catch{n=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{r=!1}for(var i=new t.Buf8(256),a=0;a<256;a++)i[a]=a>=252?6:a>=248?5:a>=240?4:a>=224?3:a>=192?2:1;i[254]=i[254]=1,e.string2buf=function(e){var n,r,i,a,o,s=e.length,c=0;for(a=0;a<s;a++)r=e.charCodeAt(a),(r&64512)==55296&&a+1<s&&(i=e.charCodeAt(a+1),(i&64512)==56320&&(r=65536+(r-55296<<10)+(i-56320),a++)),c+=r<128?1:r<2048?2:r<65536?3:4;for(n=new t.Buf8(c),o=0,a=0;o<c;a++)r=e.charCodeAt(a),(r&64512)==55296&&a+1<s&&(i=e.charCodeAt(a+1),(i&64512)==56320&&(r=65536+(r-55296<<10)+(i-56320),a++)),r<128?n[o++]=r:r<2048?(n[o++]=192|r>>>6,n[o++]=128|r&63):r<65536?(n[o++]=224|r>>>12,n[o++]=128|r>>>6&63,n[o++]=128|r&63):(n[o++]=240|r>>>18,n[o++]=128|r>>>12&63,n[o++]=128|r>>>6&63,n[o++]=128|r&63);return n};function o(e,i){if(i<65534&&(e.subarray&&r||!e.subarray&&n))return String.fromCharCode.apply(null,t.shrinkBuf(e,i));for(var a=``,o=0;o<i;o++)a+=String.fromCharCode(e[o]);return a}e.buf2binstring=function(e){return o(e,e.length)},e.binstring2buf=function(e){for(var n=new t.Buf8(e.length),r=0,i=n.length;r<i;r++)n[r]=e.charCodeAt(r);return n},e.buf2string=function(e,t){var n,r,a,s,c=t||e.length,l=Array(c*2);for(r=0,n=0;n<c;)if(a=e[n++],a<128)l[r++]=a;else if(s=i[a],s>4)l[r++]=65533,n+=s-1;else{for(a&=s===2?31:s===3?15:7;s>1&&n<c;)a=a<<6|e[n++]&63,s--;s>1?l[r++]=65533:a<65536?l[r++]=a:(a-=65536,l[r++]=55296|a>>10&1023,l[r++]=56320|a&1023)}return o(l,r)},e.utf8border=function(e,t){var n;for(t||=e.length,t>e.length&&(t=e.length),n=t-1;n>=0&&(e[n]&192)==128;)n--;return n<0||n===0?t:n+i[e[n]]>t?n:t}})),Hh=c(((e,t)=>{function n(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg=``,this.state=null,this.data_type=2,this.adler=0}t.exports=n})),Uh=c((e=>{var t=Bh(),n=Fh(),r=Vh(),i=zh(),a=Hh(),o=Object.prototype.toString,s=0,c=4,l=0,u=1,d=2,f=-1,p=0,m=8;function h(e){if(!(this instanceof h))return new h(e);this.options=n.assign({level:f,method:m,chunkSize:16384,windowBits:15,memLevel:8,strategy:p,to:``},e||{});var s=this.options;s.raw&&s.windowBits>0?s.windowBits=-s.windowBits:s.gzip&&s.windowBits>0&&s.windowBits<16&&(s.windowBits+=16),this.err=0,this.msg=``,this.ended=!1,this.chunks=[],this.strm=new a,this.strm.avail_out=0;var c=t.deflateInit2(this.strm,s.level,s.method,s.windowBits,s.memLevel,s.strategy);if(c!==l)throw Error(i[c]);if(s.header&&t.deflateSetHeader(this.strm,s.header),s.dictionary){var u=typeof s.dictionary==`string`?r.string2buf(s.dictionary):o.call(s.dictionary)===`[object ArrayBuffer]`?new Uint8Array(s.dictionary):s.dictionary;if(c=t.deflateSetDictionary(this.strm,u),c!==l)throw Error(i[c]);this._dict_set=!0}}h.prototype.push=function(e,i){var a=this.strm,f=this.options.chunkSize,p,m;if(this.ended)return!1;m=i===~~i?i:i===!0?c:s,a.input=typeof e==`string`?r.string2buf(e):o.call(e)===`[object ArrayBuffer]`?new Uint8Array(e):e,a.next_in=0,a.avail_in=a.input.length;do{if(a.avail_out===0&&(a.output=new n.Buf8(f),a.next_out=0,a.avail_out=f),p=t.deflate(a,m),p!==u&&p!==l)return this.onEnd(p),this.ended=!0,!1;(a.avail_out===0||a.avail_in===0&&(m===c||m===d))&&(this.options.to===`string`?this.onData(r.buf2binstring(n.shrinkBuf(a.output,a.next_out))):this.onData(n.shrinkBuf(a.output,a.next_out)))}while((a.avail_in>0||a.avail_out===0)&&p!==u);return m===c?(p=t.deflateEnd(this.strm),this.onEnd(p),this.ended=!0,p===l):(m===d&&(this.onEnd(l),a.avail_out=0),!0)},h.prototype.onData=function(e){this.chunks.push(e)},h.prototype.onEnd=function(e){e===l&&(this.result=this.options.to===`string`?this.chunks.join(``):n.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function g(e,t){var n=new h(t);if(n.push(e,!0),n.err)throw n.msg||i[n.err];return n.result}function _(e,t){return t||={},t.raw=!0,g(e,t)}function v(e,t){return t||={},t.gzip=!0,g(e,t)}e.Deflate=h,e.deflate=g,e.deflateRaw=_,e.gzip=v})),Wh=c(((e,t)=>{t.exports=function(e,t){var n=e.state,r=e.next_in,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b,x,S,C,w,T=e.input,E;i=r+(e.avail_in-5),a=e.next_out,E=e.output,o=a-(t-e.avail_out),s=a+(e.avail_out-257),c=n.dmax,l=n.wsize,u=n.whave,d=n.wnext,f=n.window,p=n.hold,m=n.bits,h=n.lencode,g=n.distcode,_=(1<<n.lenbits)-1,v=(1<<n.distbits)-1;top:do{m<15&&(p+=T[r++]<<m,m+=8,p+=T[r++]<<m,m+=8),y=h[p&_];dolen:for(;;){if(b=y>>>24,p>>>=b,m-=b,b=y>>>16&255,b===0)E[a++]=y&65535;else if(b&16){x=y&65535,b&=15,b&&(m<b&&(p+=T[r++]<<m,m+=8),x+=p&(1<<b)-1,p>>>=b,m-=b),m<15&&(p+=T[r++]<<m,m+=8,p+=T[r++]<<m,m+=8),y=g[p&v];dodist:for(;;){if(b=y>>>24,p>>>=b,m-=b,b=y>>>16&255,b&16){if(S=y&65535,b&=15,m<b&&(p+=T[r++]<<m,m+=8,m<b&&(p+=T[r++]<<m,m+=8)),S+=p&(1<<b)-1,S>c){e.msg=`invalid distance too far back`,n.mode=30;break top}if(p>>>=b,m-=b,b=a-o,S>b){if(b=S-b,b>u&&n.sane){e.msg=`invalid distance too far back`,n.mode=30;break top}if(C=0,w=f,d===0){if(C+=l-b,b<x){x-=b;do E[a++]=f[C++];while(--b);C=a-S,w=E}}else if(d<b){if(C+=l+d-b,b-=d,b<x){x-=b;do E[a++]=f[C++];while(--b);if(C=0,d<x){b=d,x-=b;do E[a++]=f[C++];while(--b);C=a-S,w=E}}}else if(C+=d-b,b<x){x-=b;do E[a++]=f[C++];while(--b);C=a-S,w=E}for(;x>2;)E[a++]=w[C++],E[a++]=w[C++],E[a++]=w[C++],x-=3;x&&(E[a++]=w[C++],x>1&&(E[a++]=w[C++]))}else{C=a-S;do E[a++]=E[C++],E[a++]=E[C++],E[a++]=E[C++],x-=3;while(x>2);x&&(E[a++]=E[C++],x>1&&(E[a++]=E[C++]))}}else if(b&64){e.msg=`invalid distance code`,n.mode=30;break top}else{y=g[(y&65535)+(p&(1<<b)-1)];continue dodist}break}}else if(!(b&64)){y=h[(y&65535)+(p&(1<<b)-1)];continue dolen}else if(b&32){n.mode=12;break top}else{e.msg=`invalid literal/length code`,n.mode=30;break top}break}}while(r<i&&a<s);x=m>>3,r-=x,m-=x<<3,p&=(1<<m)-1,e.next_in=r,e.next_out=a,e.avail_in=r<i?5+(i-r):5-(r-i),e.avail_out=a<s?257+(s-a):257-(a-s),n.hold=p,n.bits=m}})),Gh=c(((e,t)=>{var n=Fh(),r=15,i=852,a=592,o=0,s=1,c=2,l=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],u=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],d=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],f=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];t.exports=function(e,t,p,m,h,g,_,v){var y=v.bits,b=0,x=0,S=0,C=0,w=0,T=0,E=0,D=0,O=0,k=0,A,j,M,N,P,ee=null,te=0,ne,re=new n.Buf16(r+1),ie=new n.Buf16(r+1),ae=null,oe=0,se,F,ce;for(b=0;b<=r;b++)re[b]=0;for(x=0;x<m;x++)re[t[p+x]]++;for(w=y,C=r;C>=1&&re[C]===0;C--);if(w>C&&(w=C),C===0)return h[g++]=20971520,h[g++]=20971520,v.bits=1,0;for(S=1;S<C&&re[S]===0;S++);for(w<S&&(w=S),D=1,b=1;b<=r;b++)if(D<<=1,D-=re[b],D<0)return-1;if(D>0&&(e===o||C!==1))return-1;for(ie[1]=0,b=1;b<r;b++)ie[b+1]=ie[b]+re[b];for(x=0;x<m;x++)t[p+x]!==0&&(_[ie[t[p+x]]++]=x);if(e===o?(ee=ae=_,ne=19):e===s?(ee=l,te-=257,ae=u,oe-=257,ne=256):(ee=d,ae=f,ne=-1),k=0,x=0,b=S,P=g,T=w,E=0,M=-1,O=1<<w,N=O-1,e===s&&O>i||e===c&&O>a)return 1;for(;;){se=b-E,_[x]<ne?(F=0,ce=_[x]):_[x]>ne?(F=ae[oe+_[x]],ce=ee[te+_[x]]):(F=96,ce=0),A=1<<b-E,j=1<<T,S=j;do j-=A,h[P+(k>>E)+j]=se<<24|F<<16|ce;while(j!==0);for(A=1<<b-1;k&A;)A>>=1;if(A===0?k=0:(k&=A-1,k+=A),x++,--re[b]===0){if(b===C)break;b=t[p+_[x]]}if(b>w&&(k&N)!==M){for(E===0&&(E=w),P+=S,T=b-E,D=1<<T;T+E<C&&(D-=re[T+E],!(D<=0));)T++,D<<=1;if(O+=1<<T,e===s&&O>i||e===c&&O>a)return 1;M=k&N,h[M]=w<<24|T<<16|P-g}}return k!==0&&(h[P+k]=b-E<<24|4194304),v.bits=w,0}})),Kh=c((e=>{var t=Fh(),n=Lh(),r=Rh(),i=Wh(),a=Gh(),o=0,s=1,c=2,l=4,u=5,d=6,f=0,p=1,m=2,h=-2,g=-3,_=-4,v=-5,y=8,b=1,x=2,S=3,C=4,w=5,T=6,E=7,D=8,O=9,k=10,A=11,j=12,M=13,N=14,P=15,ee=16,te=17,ne=18,re=19,ie=20,ae=21,oe=22,se=23,F=24,ce=25,le=26,ue=27,de=28,fe=29,pe=30,me=31,he=32,ge=852,I=592,_e=15;function ve(e){return(e>>>24&255)+(e>>>8&65280)+((e&65280)<<8)+((e&255)<<24)}function ye(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new t.Buf16(320),this.work=new t.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function be(e){var n;return!e||!e.state?h:(n=e.state,e.total_in=e.total_out=n.total=0,e.msg=``,n.wrap&&(e.adler=n.wrap&1),n.mode=b,n.last=0,n.havedict=0,n.dmax=32768,n.head=null,n.hold=0,n.bits=0,n.lencode=n.lendyn=new t.Buf32(ge),n.distcode=n.distdyn=new t.Buf32(I),n.sane=1,n.back=-1,f)}function xe(e){var t;return!e||!e.state?h:(t=e.state,t.wsize=0,t.whave=0,t.wnext=0,be(e))}function L(e,t){var n,r;return!e||!e.state||(r=e.state,t<0?(n=0,t=-t):(n=(t>>4)+1,t<48&&(t&=15)),t&&(t<8||t>15))?h:(r.window!==null&&r.wbits!==t&&(r.window=null),r.wrap=n,r.wbits=t,xe(e))}function Se(e,t){var n,r;return e?(r=new ye,e.state=r,r.window=null,n=L(e,t),n!==f&&(e.state=null),n):h}function R(e){return Se(e,_e)}var z=!0,Ce,we;function Te(e){if(z){var n;for(Ce=new t.Buf32(512),we=new t.Buf32(32),n=0;n<144;)e.lens[n++]=8;for(;n<256;)e.lens[n++]=9;for(;n<280;)e.lens[n++]=7;for(;n<288;)e.lens[n++]=8;for(a(s,e.lens,0,288,Ce,0,e.work,{bits:9}),n=0;n<32;)e.lens[n++]=5;a(c,e.lens,0,32,we,0,e.work,{bits:5}),z=!1}e.lencode=Ce,e.lenbits=9,e.distcode=we,e.distbits=5}function Ee(e,n,r,i){var a,o=e.state;return o.window===null&&(o.wsize=1<<o.wbits,o.wnext=0,o.whave=0,o.window=new t.Buf8(o.wsize)),i>=o.wsize?(t.arraySet(o.window,n,r-o.wsize,o.wsize,0),o.wnext=0,o.whave=o.wsize):(a=o.wsize-o.wnext,a>i&&(a=i),t.arraySet(o.window,n,r-i,a,o.wnext),i-=a,i?(t.arraySet(o.window,n,r-i,i,0),o.wnext=i,o.whave=o.wsize):(o.wnext+=a,o.wnext===o.wsize&&(o.wnext=0),o.whave<o.wsize&&(o.whave+=a))),0}function B(e,ge){var I,_e,ye,be,xe,L,Se,R,z,Ce,we,B,De,Oe,ke=0,Ae,je,Me,Ne,Pe,V,Fe,Ie,Le=new t.Buf8(4),Re,ze,Be=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!e||!e.state||!e.output||!e.input&&e.avail_in!==0)return h;I=e.state,I.mode===j&&(I.mode=M),xe=e.next_out,ye=e.output,Se=e.avail_out,be=e.next_in,_e=e.input,L=e.avail_in,R=I.hold,z=I.bits,Ce=L,we=Se,Ie=f;inf_leave:for(;;)switch(I.mode){case b:if(I.wrap===0){I.mode=M;break}for(;z<16;){if(L===0)break inf_leave;L--,R+=_e[be++]<<z,z+=8}if(I.wrap&2&&R===35615){I.check=0,Le[0]=R&255,Le[1]=R>>>8&255,I.check=r(I.check,Le,2,0),R=0,z=0,I.mode=x;break}if(I.flags=0,I.head&&(I.head.done=!1),!(I.wrap&1)||(((R&255)<<8)+(R>>8))%31){e.msg=`incorrect header check`,I.mode=pe;break}if((R&15)!==y){e.msg=`unknown compression method`,I.mode=pe;break}if(R>>>=4,z-=4,Fe=(R&15)+8,I.wbits===0)I.wbits=Fe;else if(Fe>I.wbits){e.msg=`invalid window size`,I.mode=pe;break}I.dmax=1<<Fe,e.adler=I.check=1,I.mode=R&512?k:j,R=0,z=0;break;case x:for(;z<16;){if(L===0)break inf_leave;L--,R+=_e[be++]<<z,z+=8}if(I.flags=R,(I.flags&255)!==y){e.msg=`unknown compression method`,I.mode=pe;break}if(I.flags&57344){e.msg=`unknown header flags set`,I.mode=pe;break}I.head&&(I.head.text=R>>8&1),I.flags&512&&(Le[0]=R&255,Le[1]=R>>>8&255,I.check=r(I.check,Le,2,0)),R=0,z=0,I.mode=S;case S:for(;z<32;){if(L===0)break inf_leave;L--,R+=_e[be++]<<z,z+=8}I.head&&(I.head.time=R),I.flags&512&&(Le[0]=R&255,Le[1]=R>>>8&255,Le[2]=R>>>16&255,Le[3]=R>>>24&255,I.check=r(I.check,Le,4,0)),R=0,z=0,I.mode=C;case C:for(;z<16;){if(L===0)break inf_leave;L--,R+=_e[be++]<<z,z+=8}I.head&&(I.head.xflags=R&255,I.head.os=R>>8),I.flags&512&&(Le[0]=R&255,Le[1]=R>>>8&255,I.check=r(I.check,Le,2,0)),R=0,z=0,I.mode=w;case w:if(I.flags&1024){for(;z<16;){if(L===0)break inf_leave;L--,R+=_e[be++]<<z,z+=8}I.length=R,I.head&&(I.head.extra_len=R),I.flags&512&&(Le[0]=R&255,Le[1]=R>>>8&255,I.check=r(I.check,Le,2,0)),R=0,z=0}else I.head&&(I.head.extra=null);I.mode=T;case T:if(I.flags&1024&&(B=I.length,B>L&&(B=L),B&&(I.head&&(Fe=I.head.extra_len-I.length,I.head.extra||(I.head.extra=Array(I.head.extra_len)),t.arraySet(I.head.extra,_e,be,B,Fe)),I.flags&512&&(I.check=r(I.check,_e,B,be)),L-=B,be+=B,I.length-=B),I.length))break inf_leave;I.length=0,I.mode=E;case E:if(I.flags&2048){if(L===0)break inf_leave;B=0;do Fe=_e[be+B++],I.head&&Fe&&I.length<65536&&(I.head.name+=String.fromCharCode(Fe));while(Fe&&B<L);if(I.flags&512&&(I.check=r(I.check,_e,B,be)),L-=B,be+=B,Fe)break inf_leave}else I.head&&(I.head.name=null);I.length=0,I.mode=D;case D:if(I.flags&4096){if(L===0)break inf_leave;B=0;do Fe=_e[be+B++],I.head&&Fe&&I.length<65536&&(I.head.comment+=String.fromCharCode(Fe));while(Fe&&B<L);if(I.flags&512&&(I.check=r(I.check,_e,B,be)),L-=B,be+=B,Fe)break inf_leave}else I.head&&(I.head.comment=null);I.mode=O;case O:if(I.flags&512){for(;z<16;){if(L===0)break inf_leave;L--,R+=_e[be++]<<z,z+=8}if(R!==(I.check&65535)){e.msg=`header crc mismatch`,I.mode=pe;break}R=0,z=0}I.head&&(I.head.hcrc=I.flags>>9&1,I.head.done=!0),e.adler=I.check=0,I.mode=j;break;case k:for(;z<32;){if(L===0)break inf_leave;L--,R+=_e[be++]<<z,z+=8}e.adler=I.check=ve(R),R=0,z=0,I.mode=A;case A:if(I.havedict===0)return e.next_out=xe,e.avail_out=Se,e.next_in=be,e.avail_in=L,I.hold=R,I.bits=z,m;e.adler=I.check=1,I.mode=j;case j:if(ge===u||ge===d)break inf_leave;case M:if(I.last){R>>>=z&7,z-=z&7,I.mode=ue;break}for(;z<3;){if(L===0)break inf_leave;L--,R+=_e[be++]<<z,z+=8}switch(I.last=R&1,R>>>=1,--z,R&3){case 0:I.mode=N;break;case 1:if(Te(I),I.mode=ie,ge===d){R>>>=2,z-=2;break inf_leave}break;case 2:I.mode=te;break;case 3:e.msg=`invalid block type`,I.mode=pe}R>>>=2,z-=2;break;case N:for(R>>>=z&7,z-=z&7;z<32;){if(L===0)break inf_leave;L--,R+=_e[be++]<<z,z+=8}if((R&65535)!=(R>>>16^65535)){e.msg=`invalid stored block lengths`,I.mode=pe;break}if(I.length=R&65535,R=0,z=0,I.mode=P,ge===d)break inf_leave;case P:I.mode=ee;case ee:if(B=I.length,B){if(B>L&&(B=L),B>Se&&(B=Se),B===0)break inf_leave;t.arraySet(ye,_e,be,B,xe),L-=B,be+=B,Se-=B,xe+=B,I.length-=B;break}I.mode=j;break;case te:for(;z<14;){if(L===0)break inf_leave;L--,R+=_e[be++]<<z,z+=8}if(I.nlen=(R&31)+257,R>>>=5,z-=5,I.ndist=(R&31)+1,R>>>=5,z-=5,I.ncode=(R&15)+4,R>>>=4,z-=4,I.nlen>286||I.ndist>30){e.msg=`too many length or distance symbols`,I.mode=pe;break}I.have=0,I.mode=ne;case ne:for(;I.have<I.ncode;){for(;z<3;){if(L===0)break inf_leave;L--,R+=_e[be++]<<z,z+=8}I.lens[Be[I.have++]]=R&7,R>>>=3,z-=3}for(;I.have<19;)I.lens[Be[I.have++]]=0;if(I.lencode=I.lendyn,I.lenbits=7,Re={bits:I.lenbits},Ie=a(o,I.lens,0,19,I.lencode,0,I.work,Re),I.lenbits=Re.bits,Ie){e.msg=`invalid code lengths set`,I.mode=pe;break}I.have=0,I.mode=re;case re:for(;I.have<I.nlen+I.ndist;){for(;ke=I.lencode[R&(1<<I.lenbits)-1],Ae=ke>>>24,je=ke>>>16&255,Me=ke&65535,!(Ae<=z);){if(L===0)break inf_leave;L--,R+=_e[be++]<<z,z+=8}if(Me<16)R>>>=Ae,z-=Ae,I.lens[I.have++]=Me;else{if(Me===16){for(ze=Ae+2;z<ze;){if(L===0)break inf_leave;L--,R+=_e[be++]<<z,z+=8}if(R>>>=Ae,z-=Ae,I.have===0){e.msg=`invalid bit length repeat`,I.mode=pe;break}Fe=I.lens[I.have-1],B=3+(R&3),R>>>=2,z-=2}else if(Me===17){for(ze=Ae+3;z<ze;){if(L===0)break inf_leave;L--,R+=_e[be++]<<z,z+=8}R>>>=Ae,z-=Ae,Fe=0,B=3+(R&7),R>>>=3,z-=3}else{for(ze=Ae+7;z<ze;){if(L===0)break inf_leave;L--,R+=_e[be++]<<z,z+=8}R>>>=Ae,z-=Ae,Fe=0,B=11+(R&127),R>>>=7,z-=7}if(I.have+B>I.nlen+I.ndist){e.msg=`invalid bit length repeat`,I.mode=pe;break}for(;B--;)I.lens[I.have++]=Fe}}if(I.mode===pe)break;if(I.lens[256]===0){e.msg=`invalid code -- missing end-of-block`,I.mode=pe;break}if(I.lenbits=9,Re={bits:I.lenbits},Ie=a(s,I.lens,0,I.nlen,I.lencode,0,I.work,Re),I.lenbits=Re.bits,Ie){e.msg=`invalid literal/lengths set`,I.mode=pe;break}if(I.distbits=6,I.distcode=I.distdyn,Re={bits:I.distbits},Ie=a(c,I.lens,I.nlen,I.ndist,I.distcode,0,I.work,Re),I.distbits=Re.bits,Ie){e.msg=`invalid distances set`,I.mode=pe;break}if(I.mode=ie,ge===d)break inf_leave;case ie:I.mode=ae;case ae:if(L>=6&&Se>=258){e.next_out=xe,e.avail_out=Se,e.next_in=be,e.avail_in=L,I.hold=R,I.bits=z,i(e,we),xe=e.next_out,ye=e.output,Se=e.avail_out,be=e.next_in,_e=e.input,L=e.avail_in,R=I.hold,z=I.bits,I.mode===j&&(I.back=-1);break}for(I.back=0;ke=I.lencode[R&(1<<I.lenbits)-1],Ae=ke>>>24,je=ke>>>16&255,Me=ke&65535,!(Ae<=z);){if(L===0)break inf_leave;L--,R+=_e[be++]<<z,z+=8}if(je&&!(je&240)){for(Ne=Ae,Pe=je,V=Me;ke=I.lencode[V+((R&(1<<Ne+Pe)-1)>>Ne)],Ae=ke>>>24,je=ke>>>16&255,Me=ke&65535,!(Ne+Ae<=z);){if(L===0)break inf_leave;L--,R+=_e[be++]<<z,z+=8}R>>>=Ne,z-=Ne,I.back+=Ne}if(R>>>=Ae,z-=Ae,I.back+=Ae,I.length=Me,je===0){I.mode=le;break}if(je&32){I.back=-1,I.mode=j;break}if(je&64){e.msg=`invalid literal/length code`,I.mode=pe;break}I.extra=je&15,I.mode=oe;case oe:if(I.extra){for(ze=I.extra;z<ze;){if(L===0)break inf_leave;L--,R+=_e[be++]<<z,z+=8}I.length+=R&(1<<I.extra)-1,R>>>=I.extra,z-=I.extra,I.back+=I.extra}I.was=I.length,I.mode=se;case se:for(;ke=I.distcode[R&(1<<I.distbits)-1],Ae=ke>>>24,je=ke>>>16&255,Me=ke&65535,!(Ae<=z);){if(L===0)break inf_leave;L--,R+=_e[be++]<<z,z+=8}if(!(je&240)){for(Ne=Ae,Pe=je,V=Me;ke=I.distcode[V+((R&(1<<Ne+Pe)-1)>>Ne)],Ae=ke>>>24,je=ke>>>16&255,Me=ke&65535,!(Ne+Ae<=z);){if(L===0)break inf_leave;L--,R+=_e[be++]<<z,z+=8}R>>>=Ne,z-=Ne,I.back+=Ne}if(R>>>=Ae,z-=Ae,I.back+=Ae,je&64){e.msg=`invalid distance code`,I.mode=pe;break}I.offset=Me,I.extra=je&15,I.mode=F;case F:if(I.extra){for(ze=I.extra;z<ze;){if(L===0)break inf_leave;L--,R+=_e[be++]<<z,z+=8}I.offset+=R&(1<<I.extra)-1,R>>>=I.extra,z-=I.extra,I.back+=I.extra}if(I.offset>I.dmax){e.msg=`invalid distance too far back`,I.mode=pe;break}I.mode=ce;case ce:if(Se===0)break inf_leave;if(B=we-Se,I.offset>B){if(B=I.offset-B,B>I.whave&&I.sane){e.msg=`invalid distance too far back`,I.mode=pe;break}B>I.wnext?(B-=I.wnext,De=I.wsize-B):De=I.wnext-B,B>I.length&&(B=I.length),Oe=I.window}else Oe=ye,De=xe-I.offset,B=I.length;B>Se&&(B=Se),Se-=B,I.length-=B;do ye[xe++]=Oe[De++];while(--B);I.length===0&&(I.mode=ae);break;case le:if(Se===0)break inf_leave;ye[xe++]=I.length,Se--,I.mode=ae;break;case ue:if(I.wrap){for(;z<32;){if(L===0)break inf_leave;L--,R|=_e[be++]<<z,z+=8}if(we-=Se,e.total_out+=we,I.total+=we,we&&(e.adler=I.check=I.flags?r(I.check,ye,we,xe-we):n(I.check,ye,we,xe-we)),we=Se,(I.flags?R:ve(R))!==I.check){e.msg=`incorrect data check`,I.mode=pe;break}R=0,z=0}I.mode=de;case de:if(I.wrap&&I.flags){for(;z<32;){if(L===0)break inf_leave;L--,R+=_e[be++]<<z,z+=8}if(R!==(I.total|0)){e.msg=`incorrect length check`,I.mode=pe;break}R=0,z=0}I.mode=fe;case fe:Ie=p;break inf_leave;case pe:Ie=g;break inf_leave;case me:return _;case he:default:return h}return e.next_out=xe,e.avail_out=Se,e.next_in=be,e.avail_in=L,I.hold=R,I.bits=z,(I.wsize||we!==e.avail_out&&I.mode<pe&&(I.mode<ue||ge!==l))&&Ee(e,e.output,e.next_out,we-e.avail_out)?(I.mode=me,_):(Ce-=e.avail_in,we-=e.avail_out,e.total_in+=Ce,e.total_out+=we,I.total+=we,I.wrap&&we&&(e.adler=I.check=I.flags?r(I.check,ye,we,e.next_out-we):n(I.check,ye,we,e.next_out-we)),e.data_type=I.bits+(I.last?64:0)+(I.mode===j?128:0)+(I.mode===ie||I.mode===P?256:0),(Ce===0&&we===0||ge===l)&&Ie===f&&(Ie=v),Ie)}function De(e){if(!e||!e.state)return h;var t=e.state;return t.window&&=null,e.state=null,f}function Oe(e,t){var n;return!e||!e.state||(n=e.state,!(n.wrap&2))?h:(n.head=t,t.done=!1,f)}function ke(e,t){var r=t.length,i,a,o;return!e||!e.state||(i=e.state,i.wrap!==0&&i.mode!==A)?h:i.mode===A&&(a=1,a=n(a,t,r,0),a!==i.check)?g:(o=Ee(e,t,r,r),o?(i.mode=me,_):(i.havedict=1,f))}e.inflateReset=xe,e.inflateReset2=L,e.inflateResetKeep=be,e.inflateInit=R,e.inflateInit2=Se,e.inflate=B,e.inflateEnd=De,e.inflateGetHeader=Oe,e.inflateSetDictionary=ke,e.inflateInfo=`pako inflate (from Nodeca project)`})),qh=c(((e,t)=>{t.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}})),Jh=c(((e,t)=>{function n(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name=``,this.comment=``,this.hcrc=0,this.done=!1}t.exports=n})),Yh=c((e=>{var t=Kh(),n=Fh(),r=Vh(),i=qh(),a=zh(),o=Hh(),s=Jh(),c=Object.prototype.toString;function l(e){if(!(this instanceof l))return new l(e);this.options=n.assign({chunkSize:16384,windowBits:0,to:``},e||{});var u=this.options;u.raw&&u.windowBits>=0&&u.windowBits<16&&(u.windowBits=-u.windowBits,u.windowBits===0&&(u.windowBits=-15)),u.windowBits>=0&&u.windowBits<16&&!(e&&e.windowBits)&&(u.windowBits+=32),u.windowBits>15&&u.windowBits<48&&(u.windowBits&15||(u.windowBits|=15)),this.err=0,this.msg=``,this.ended=!1,this.chunks=[],this.strm=new o,this.strm.avail_out=0;var d=t.inflateInit2(this.strm,u.windowBits);if(d!==i.Z_OK||(this.header=new s,t.inflateGetHeader(this.strm,this.header),u.dictionary&&(typeof u.dictionary==`string`?u.dictionary=r.string2buf(u.dictionary):c.call(u.dictionary)===`[object ArrayBuffer]`&&(u.dictionary=new Uint8Array(u.dictionary)),u.raw&&(d=t.inflateSetDictionary(this.strm,u.dictionary),d!==i.Z_OK))))throw Error(a[d])}l.prototype.push=function(e,a){var o=this.strm,s=this.options.chunkSize,l=this.options.dictionary,u,d,f,p,m,h=!1;if(this.ended)return!1;d=a===~~a?a:a===!0?i.Z_FINISH:i.Z_NO_FLUSH,o.input=typeof e==`string`?r.binstring2buf(e):c.call(e)===`[object ArrayBuffer]`?new Uint8Array(e):e,o.next_in=0,o.avail_in=o.input.length;do{if(o.avail_out===0&&(o.output=new n.Buf8(s),o.next_out=0,o.avail_out=s),u=t.inflate(o,i.Z_NO_FLUSH),u===i.Z_NEED_DICT&&l&&(u=t.inflateSetDictionary(this.strm,l)),u===i.Z_BUF_ERROR&&h===!0&&(u=i.Z_OK,h=!1),u!==i.Z_STREAM_END&&u!==i.Z_OK)return this.onEnd(u),this.ended=!0,!1;o.next_out&&(o.avail_out===0||u===i.Z_STREAM_END||o.avail_in===0&&(d===i.Z_FINISH||d===i.Z_SYNC_FLUSH))&&(this.options.to===`string`?(f=r.utf8border(o.output,o.next_out),p=o.next_out-f,m=r.buf2string(o.output,f),o.next_out=p,o.avail_out=s-p,p&&n.arraySet(o.output,o.output,f,p,0),this.onData(m)):this.onData(n.shrinkBuf(o.output,o.next_out))),o.avail_in===0&&o.avail_out===0&&(h=!0)}while((o.avail_in>0||o.avail_out===0)&&u!==i.Z_STREAM_END);return u===i.Z_STREAM_END&&(d=i.Z_FINISH),d===i.Z_FINISH?(u=t.inflateEnd(this.strm),this.onEnd(u),this.ended=!0,u===i.Z_OK):(d===i.Z_SYNC_FLUSH&&(this.onEnd(i.Z_OK),o.avail_out=0),!0)},l.prototype.onData=function(e){this.chunks.push(e)},l.prototype.onEnd=function(e){e===i.Z_OK&&(this.result=this.options.to===`string`?this.chunks.join(``):n.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function u(e,t){var n=new l(t);if(n.push(e,!0),n.err)throw n.msg||a[n.err];return n.result}function d(e,t){return t||={},t.raw=!0,u(e,t)}e.Inflate=l,e.inflate=u,e.inflateRaw=d,e.ungzip=u})),Xh=c(((e,t)=>{var n=Fh().assign,r=Uh(),i=Yh(),a=qh(),o={};n(o,r,i,a),t.exports=o})),Zh,Qh,$h,eg,tg,ng,rg,ig,ag=s((()=>{for(Zh=d(Xh()),Qh=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,$h=new Uint8Array(256),eg=0;eg<Qh.length;eg++)$h[Qh.charCodeAt(eg)]=eg;tg=function(e){var t=e.length*.75,n=e.length,r,i=0,a,o,s,c;e[e.length-1]===`=`&&(t--,e[e.length-2]===`=`&&t--);var l=new Uint8Array(t);for(r=0;r<n;r+=4)a=$h[e.charCodeAt(r)],o=$h[e.charCodeAt(r+1)],s=$h[e.charCodeAt(r+2)],c=$h[e.charCodeAt(r+3)],l[i++]=a<<2|o>>4,l[i++]=(o&15)<<4|s>>2,l[i++]=(s&3)<<6|c&63;return l},ng=function(e){for(var t=``,n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return t},rg=function(e){return ng(Zh.default.inflate(tg(e)))},ig=function(e,t,n){for(var r=``,i=0,a=t-e.length;i<a;i++)r+=n;return r+e}})),og,sg=s((()=>{og=`eJyFWdtyGjkQ/RVqnnar8Bb4lpg3jEnCxgEvGDtxKg9iphm01oyILrZxKv++mrGd3az6KC8UnNa0+nrUGr5lI11VVLtskF198FaU1Dns9w9OOkf7/ePDrJu90bWbiorCgpH2RpLZO9WqaCReqZ8lnReJqKTa/SwL8DXJctPs9Lxs4oSS+bAuVVjXC7/tG/lAxYV0+SYbOOOpm402wojckVlQ8+T4wVFdUDHXlaifrTs91Q/Z4PNeMLu7t3/U6746POm+7vW/dLNlWGuUrOlCW+mkrrPBXr/X+4/gciPz25qszQbhyeyKjG2XZb3ewR+9Xi/sMdVO5k+ebHemcaHzW/57p3/y+qQbPk967We//TxoP191hoVeUWexs44q25nUuTZbbYSj4o9OZ6hUZ97osZ05WTJ3AQ37jMOqQtblIt9QG7lWycKJuhCmeJGGhSOxffccyqPj/W728eXX4cFJNxvavAmRyQbH++HnGf34vdc/etXNFq54d50NXh+2X6/C137v+CnQH8gZmYdQfP6WXX8MCppQTYMlditCBL53/wfTQ65EFeNfvQ6erlQsqX21akJc1rGs0EoJE+NbMnlToZFAVEFkQ3iABW2uGH3CUK1ojUTgMWEbjfaWeUp5G6N5aCwRw5vddkOM98EVqRlPrBJ2E8OPZHSM6prJkrtnVrqNIWbtOjQrg8o7Zq2VDwxId5x3xMe0lpzBuVaa0WGpkkCkmgaON/3qBVODpaHQiIybXz3ZliTi3DO2D2PoNIZGMXQWQ+MYehNDb2PoXQxNYujPGHofQ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GoJYzglndSLDMPg1sTPJpQJHJigw0QrGERqD9YhyTOgONQDUyuF1zaxuokc/BW2ztXCMrGZ9WMW1oQZHIXWNBkSCfRZEL5BMUiZw6CzVSFCfUSGZFNjIldoKDkonTKQiJIGzWmFd3BizJJ9SINoLDriOfUCOZS+zg+KGD1qGiLNMLxtJD1/ns00ON6EzyUCM6vbxhoBKaqbG3DFQCNiL1iHccBPV0DHhQH/JW8EW90dkyFKGywCJU0WkVSvSGeiSUODWFFD0HYdPQVoiRgfPMA+/nnRgiAyNYSjpWNQcNSMrtFCUH4ZIRpSCWocFCSuhCEY6hoUClc0WC52BJlCYYLQdhN+hygRRRlo5BKRRLS6oihSqh+ZzzRGG1Mo4Iz1LoP0qsxDGFzk0JE42ji0jCPejomJKCuwil4m5CiRMEUMVSzVLDUstSx1Juc0oVWMpqY295qVltmtWmWW2a1aZZbZrVplltmtWmWW2G1WZYbYbVZlhthtVmWG2G1WZYbYbVZlhtltVmWW2W1WZZbZbVZlltltVmWW2W1QYjQCh7E2aAQHeGhCFgPoNoy8KNb2wxBhmGKBxoUZXlLGsLI6AsftEDHV0wIURVbANLcTKlGGBIKPOAxCmhePCKUwFzAmpDFRQvjA9R06Hq8TONvshgKDCuRAZTXigUxjxNFfKRo3CLhnIJBMFRvMZpqpNBMlQJzGT5WFQMVQI/AikPMIhEU1aDjqJvQwmjSHB05cC9jbYwc5UtAHNLhDw41ha+lEqF4JaH3gmB61SYcqInxTDmQK8v08vjqv4zDf1N0w3Lf4A8/vwPpfK11w==`})),Pg,Fg,Ig,Lg,Rg=s((()=>{ag(),sg(),lg(),dg(),pg(),hg(),_g(),yg(),xg(),Cg(),Tg(),Dg(),kg(),jg(),Ng(),Pg={Courier:fg,"Courier-Bold":og,"Courier-Oblique":ug,"Courier-BoldOblique":cg,Helvetica:bg,"Helvetica-Bold":mg,"Helvetica-Oblique":vg,"Helvetica-BoldOblique":gg,"Times-Roman":Og,"Times-Bold":Sg,"Times-Italic":Eg,"Times-BoldItalic":wg,Symbol:Ag,ZapfDingbats:Mg},(function(e){e.Courier=`Courier`,e.CourierBold=`Courier-Bold`,e.CourierOblique=`Courier-Oblique`,e.CourierBoldOblique=`Courier-BoldOblique`,e.Helvetica=`Helvetica`,e.HelveticaBold=`Helvetica-Bold`,e.HelveticaOblique=`Helvetica-Oblique`,e.HelveticaBoldOblique=`Helvetica-BoldOblique`,e.TimesRoman=`Times-Roman`,e.TimesRomanBold=`Times-Bold`,e.TimesRomanItalic=`Times-Italic`,e.TimesRomanBoldItalic=`Times-BoldItalic`,e.Symbol=`Symbol`,e.ZapfDingbats=`ZapfDingbats`})(Fg||={}),Ig={},Lg=function(){function e(){var e=this;this.getWidthOfGlyph=function(t){return e.CharWidths[t]},this.getXAxisKerningForPair=function(t,n){return(e.KernPairXAmounts[t]||{})[n]}}return e.load=function(t){var n=Ig[t];if(n)return n;var r=rg(Pg[t]),i=Object.assign(new e,JSON.parse(r));return i.CharWidths=i.CharMetrics.reduce(function(e,t){return e[t.N]=t.WX,e},{}),i.KernPairXAmounts=i.KernPairs.reduce(function(e,t){var n=t[0],r=t[1],i=t[2];return e[n]||(e[n]={}),e[n][r]=i,e},{}),Ig[t]=i,i},e}()})),zg,Bg=s((()=>{zg=`eJztWsuy48iN/Ret74KZfHtX47meqfGjPHaXx4/wgpJ4JbooUU1JVXXb0f9u4JwESF13R7TD29koIpFi8gCJBHDA/Pvm+nraTuPmZ3/f5HHzs7/k8WlzvXS7fvPXp02eqyR/2vRfd2N3gqhUUfm0Od9P236+DoczxLWK66fNpZ93/fkGWaOy5mnTnUR67c57lRaZSItM/tnN/XnsX/DfIqg0JOk8HI4UK4BCAFzG+xWCQgXF02Y3nU4dJJVKKrx5mPgKBVMImOvYXY+QKJRCoHzXzxMErQrap810hqaloioF1e0L5kvFUwqe23Hu+Q+1TinWeZnuMwSKrRRsL8Nn/kOxlYLtOnzFWE1Viqmu/eceVioVaylYe1OwVKilQD0PCYgiLRtVcJz4kEItW13mNLi0UsCVAB77K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wHgW4uQGVbZ0uM7mAJ1b/68/JlpUMnWdy5MF6/Vd5eL19YYSPd6FqPwBkNQo/h2NQxdQQ3bn/dpCxrGrqCW7U8rKZl/mfi0Xytk3Am66ZhYbg4y+KAVslDwbXdNL2d5qU5hnYBlTZaa6hs2t1qWdaeeTptcLco+hl5R7w4H5uOGcQbtEkpT18GusOI2xT9dYcVJf7zCSjmbD+Iud2s1NPRb9E+0UICmizb8ZK/+5JOLOulSqwaw5VJr2vB8dSFn89fvv/8H0oq1dA==`})),Vg,Hg,Ug,Wg,Gg=s((()=>{ag(),Bg(),Vg=rg(zg),Hg=JSON.parse(Vg),Ug=function(){function e(e,t){var n=this;this.canEncodeUnicodeCodePoint=function(e){return e in n.unicodeMappings},this.encodeUnicodeCodePoint=function(e){var t=n.unicodeMappings[e];if(!t){var r=String.fromCharCode(e),i=`0x`+ig(e.toString(16),4,`0`),a=n.name+` cannot encode "`+r+`" (`+i+`)`;throw Error(a)}return{code:t[0],name:t[1]}},this.name=e,this.supportedCodePoints=Object.keys(t).map(Number).sort(function(e,t){return e-t}),this.unicodeMappings=t}return e}(),Wg={Symbol:new Ug(`Symbol`,Hg.symbol),ZapfDingbats:new Ug(`ZapfDingbats`,Hg.zapfdingbats),WinAnsi:new Ug(`WinAnsi`,Hg.win1252)}})),Kg=s((()=>{Rg(),Gg()})),qg,Jg,Yg,Xg,Zg=s((()=>{Kg(),qg=function(e){return Object.keys(e).map(function(t){return e[t]})},Jg=qg(Fg),Yg=function(e){return Jg.includes(e)},Xg=function(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}})),Qg,$g,e_,t_,n_,r_,i_,a_,o_,s_,q,J,c_,l_,u_,d_,f_,p_,m_=s((()=>{Zg(),Qg=function(e){return"`"+e+"`"},$g=function(e){return`'`+e+`'`},e_=function(e){var t=typeof e;return t===`string`?$g(e):t===`undefined`?Qg(e):e},t_=function(e,t,n){for(var r=Array(n.length),i=0,a=n.length;i<a;i++){var o=n[i];r[i]=e_(o)}var s=r.join(` or `);return Qg(t)+` must be one of `+s+`, but was actually `+e_(e)},n_=function(e,t,n){Array.isArray(n)||(n=qg(n));for(var r=0,i=n.length;r<i;r++)if(e===n[r])return;throw TypeError(t_(e,t,n))},r_=function(e,t,n){Array.isArray(n)||(n=qg(n)),n_(e,t,n.concat(void 0))},i_=function(e,t,n){Array.isArray(n)||(n=qg(n));for(var r=0,i=e.length;r<i;r++)n_(e[r],t,n)},a_=function(e){return e===null?`null`:e===void 0?`undefined`:typeof e==`string`?`string`:isNaN(e)?`NaN`:typeof e==`number`?`number`:typeof e==`boolean`?`boolean`:typeof e==`symbol`?`symbol`:typeof e==`bigint`?`bigint`:e.constructor&&e.constructor.name?e.constructor.name:e.name?e.name:e.constructor?String(e.constructor):String(e)},o_=function(e,t){return t===`null`?e===null:t===`undefined`?e===void 0:t===`string`?typeof e==`string`:t===`number`?typeof e==`number`&&!isNaN(e):t===`boolean`?typeof e==`boolean`:t===`symbol`?typeof e==`symbol`:t===`bigint`?typeof e==`bigint`:t===Date?e instanceof Date:t===Array?e instanceof Array:t===Uint8Array?e instanceof Uint8Array:t===ArrayBuffer?e instanceof ArrayBuffer:t===Function?e instanceof Function:e instanceof t[0]},s_=function(e,t,n){for(var r=Array(n.length),i=0,a=n.length;i<a;i++){var o=n[i];o===`null`&&(r[i]=Qg(`null`)),o===`undefined`&&(r[i]=Qg(`undefined`)),o===`string`?r[i]=Qg(`string`):o===`number`?r[i]=Qg(`number`):o===`boolean`?r[i]=Qg(`boolean`):o===`symbol`?r[i]=Qg(`symbol`):o===`bigint`?r[i]=Qg(`bigint`):o===Array?r[i]=Qg(`Array`):o===Uint8Array?r[i]=Qg(`Uint8Array`):o===ArrayBuffer?r[i]=Qg(`ArrayBuffer`):r[i]=Qg(o[1])}var s=r.join(` or `);return Qg(t)+` must be of type `+s+`, but was actually of type `+Qg(a_(e))},q=function(e,t,n){for(var r=0,i=n.length;r<i;r++)if(o_(e,n[r]))return;throw TypeError(s_(e,t,n))},J=function(e,t,n){q(e,t,n.concat(`undefined`))},c_=function(e,t,n){for(var r=0,i=e.length;r<i;r++)q(e[r],t,n)},l_=function(e,t,n,r){if(q(e,t,[`number`]),q(n,`min`,[`number`]),q(r,`max`,[`number`]),r=Math.max(n,r),e<n||e>r)throw Error(Qg(t)+` must be at least `+n+` and at most `+r+`, but was actually `+e)},u_=function(e,t,n,r){q(e,t,[`number`,`undefined`]),typeof e==`number`&&l_(e,t,n,r)},d_=function(e,t,n){if(q(e,t,[`number`]),e%n!==0)throw Error(Qg(t)+` must be a multiple of `+n+`, but was actually `+e)},f_=function(e,t){if(!Number.isInteger(e))throw Error(Qg(t)+` must be an integer, but was actually `+e)},p_=function(e,t){if(![1,0].includes(Math.sign(e)))throw Error(Qg(t)+` must be a positive number or 0, but was actually `+e)}})),h_,g_,__,v_=s((()=>{for(Xm(),h_=new Uint16Array(256),g_=0;g_<256;g_++)h_[g_]=g_;h_[22]=km(``),h_[24]=km(`˘`),h_[25]=km(`ˇ`),h_[26]=km(`ˆ`),h_[27]=km(`˙`),h_[28]=km(`˝`),h_[29]=km(`˛`),h_[30]=km(`˚`),h_[31]=km(`˜`),h_[127]=km(`�`),h_[128]=km(`•`),h_[129]=km(`†`),h_[130]=km(`‡`),h_[131]=km(`…`),h_[132]=km(`—`),h_[133]=km(`–`),h_[134]=km(`ƒ`),h_[135]=km(`⁄`),h_[136]=km(`‹`),h_[137]=km(`›`),h_[138]=km(`−`),h_[139]=km(`‰`),h_[140]=km(`„`),h_[141]=km(`“`),h_[142]=km(`”`),h_[143]=km(`‘`),h_[144]=km(`’`),h_[145]=km(`‚`),h_[146]=km(`™`),h_[147]=km(`fi`),h_[148]=km(`fl`),h_[149]=km(`Ł`),h_[150]=km(`Œ`),h_[151]=km(`Š`),h_[152]=km(`Ÿ`),h_[153]=km(`Ž`),h_[154]=km(`ı`),h_[155]=km(`ł`),h_[156]=km(`œ`),h_[157]=km(`š`),h_[158]=km(`ž`),h_[159]=km(`�`),h_[160]=km(`€`),h_[173]=km(`�`),__=function(e){for(var t=Array(e.length),n=0,r=e.length;n<r;n++)t[n]=h_[e[n]];return String.fromCodePoint.apply(String,t)}})),y_,b_=s((()=>{y_=function(){function e(e){this.populate=e,this.value=void 0}return e.prototype.getValue=function(){return this.value},e.prototype.access=function(){return this.value||=this.populate(),this.value},e.prototype.invalidate=function(){this.value=void 0},e.populatedBy=function(t){return new e(t)},e}()})),x_=s((()=>{uh(),fh(),Xm(),Oh(),Mh(),Ph(),Om(),Zg(),m_(),v_(),b_()})),S_,C_,w_,T_,E_,D_,O_,k_,A_,j_,M_,N_,P_,F_,I_,L_,R_,z_,B_,V_,H_,U_,W_,G_,K_,q_,J_,Y_=s((()=>{K(),x_(),S_=function(e){G(t,e);function t(t,n){var r=this,i=`Method `+t+`.`+n+`() not implemented`;return r=e.call(this,i)||this,r}return t}(Error),C_=function(e){G(t,e);function t(t){var n=this,r=`Cannot construct `+t+` - it has a private constructor`;return n=e.call(this,r)||this,n}return t}(Error),w_=function(e){G(t,e);function t(t,n){var r=this,i=function(e){return e?.name??e?.constructor?.name},a=`Expected instance of `+(Array.isArray(t)?t.map(i):[i(t)]).join(` or `)+`, `+(`but got instance of `+(n&&i(n)));return r=e.call(this,a)||this,r}return t}(Error),T_=function(e){G(t,e);function t(t){var n=this,r=t+` stream encoding not supported`;return n=e.call(this,r)||this,n}return t}(Error),E_=function(e){G(t,e);function t(t,n){var r=this,i=`Cannot call `+t+`.`+n+`() more than once`;return r=e.call(this,i)||this,r}return t}(Error),function(e){G(t,e);function t(t){var n=this,r=`Missing catalog (ref=`+t+`)`;return n=e.call(this,r)||this,n}return t}(Error),D_=function(e){G(t,e);function t(){var t=this;return t=e.call(this,`Can't embed page with missing Contents`)||this,t}return t}(Error),O_=function(e){G(t,e);function t(t){var n=this,r=`Unrecognized stream type: `+(t?.contructor?.name??t?.name??t);return n=e.call(this,r)||this,n}return t}(Error),k_=function(e){G(t,e);function t(){var t=this;return t=e.call(this,"Found mismatched contexts while embedding pages. All pages in the array passed to `PDFDocument.embedPages()` must be from the same document.")||this,t}return t}(Error),A_=function(e){G(t,e);function t(t){var n=this,r=`Attempted to convert PDFArray with `+t+` elements to rectangle, but must have exactly 4 elements.`;return n=e.call(this,r)||this,n}return t}(Error),j_=function(e){G(t,e);function t(t){var n=this,r=`Attempted to convert "`+t+`" to a date, but it does not match the PDF date string format.`;return n=e.call(this,r)||this,n}return t}(Error),M_=function(e){G(t,e);function t(t,n){var r=this,i=`Invalid targetIndex specified: targetIndex=`+t+` must be less than Count=`+n;return r=e.call(this,i)||this,r}return t}(Error),N_=function(e){G(t,e);function t(t,n){var r=this,i=`Failed to `+n+` at targetIndex=`+t+` due to corrupt page tree: It is likely that one or more 'Count' entries are invalid`;return r=e.call(this,i)||this,r}return t}(Error),P_=function(e){G(t,e);function t(t,n,r){var i=this,a=`index should be at least `+n+` and at most `+r+`, but was actually `+t;return i=e.call(this,a)||this,i}return t}(Error),F_=function(e){G(t,e);function t(){var t=this;return t=e.call(this,`Attempted to set invalid field value`)||this,t}return t}(Error),I_=function(e){G(t,e);function t(){var t=this;return t=e.call(this,`Attempted to select multiple values for single-select field`)||this,t}return t}(Error),L_=function(e){G(t,e);function t(t){var n=this,r=`No /DA (default appearance) entry found for field: `+t;return n=e.call(this,r)||this,n}return t}(Error),R_=function(e){G(t,e);function t(t){var n=this,r=`No Tf operator found for DA of field: `+t;return n=e.call(this,r)||this,n}return t}(Error),z_=function(e){G(t,e);function t(t,n){var r=this,i=`Failed to parse number `+(`(line:`+t.line+` col:`+t.column+` offset=`+t.offset+`): "`+n+`"`);return r=e.call(this,i)||this,r}return t}(Error),B_=function(e){G(t,e);function t(t,n){var r=this,i=`Failed to parse PDF document `+(`(line:`+t.line+` col:`+t.column+` offset=`+t.offset+`): `+n);return r=e.call(this,i)||this,r}return t}(Error),V_=function(e){G(t,e);function t(t,n,r){var i=this,a=`Expected next byte to be `+n+` but it was actually `+r;return i=e.call(this,t,a)||this,i}return t}(B_),H_=function(e){G(t,e);function t(t,n){var r=this,i=`Failed to parse PDF object starting with the following byte: `+n;return r=e.call(this,t,i)||this,r}return t}(B_),U_=function(e){G(t,e);function t(t){var n=this;return n=e.call(this,t,`Failed to parse invalid PDF object`)||this,n}return t}(B_),W_=function(e){G(t,e);function t(t){var n=this;return n=e.call(this,t,`Failed to parse PDF stream`)||this,n}return t}(B_),G_=function(e){G(t,e);function t(t){var n=this;return n=e.call(this,t,`Failed to parse PDF literal string due to unbalanced parenthesis`)||this,n}return t}(B_),K_=function(e){G(t,e);function t(t){var n=this;return n=e.call(this,t,`Parser stalled`)||this,n}return t}(B_),q_=function(e){G(t,e);function t(t){var n=this;return n=e.call(this,t,`No PDF header found`)||this,n}return t}(B_),J_=function(e){G(t,e);function t(t,n){var r=this,i=`Did not find expected keyword '`+th(n)+`'`;return r=e.call(this,t,i)||this,r}return t}(B_)})),X_,Y,Z_=s((()=>{(function(e){e[e.Null=0]=`Null`,e[e.Backspace=8]=`Backspace`,e[e.Tab=9]=`Tab`,e[e.Newline=10]=`Newline`,e[e.FormFeed=12]=`FormFeed`,e[e.CarriageReturn=13]=`CarriageReturn`,e[e.Space=32]=`Space`,e[e.ExclamationPoint=33]=`ExclamationPoint`,e[e.Hash=35]=`Hash`,e[e.Percent=37]=`Percent`,e[e.LeftParen=40]=`LeftParen`,e[e.RightParen=41]=`RightParen`,e[e.Plus=43]=`Plus`,e[e.Minus=45]=`Minus`,e[e.Dash=45]=`Dash`,e[e.Period=46]=`Period`,e[e.ForwardSlash=47]=`ForwardSlash`,e[e.Zero=48]=`Zero`,e[e.One=49]=`One`,e[e.Two=50]=`Two`,e[e.Three=51]=`Three`,e[e.Four=52]=`Four`,e[e.Five=53]=`Five`,e[e.Six=54]=`Six`,e[e.Seven=55]=`Seven`,e[e.Eight=56]=`Eight`,e[e.Nine=57]=`Nine`,e[e.LessThan=60]=`LessThan`,e[e.GreaterThan=62]=`GreaterThan`,e[e.A=65]=`A`,e[e.D=68]=`D`,e[e.E=69]=`E`,e[e.F=70]=`F`,e[e.O=79]=`O`,e[e.P=80]=`P`,e[e.R=82]=`R`,e[e.LeftSquareBracket=91]=`LeftSquareBracket`,e[e.BackSlash=92]=`BackSlash`,e[e.RightSquareBracket=93]=`RightSquareBracket`,e[e.a=97]=`a`,e[e.b=98]=`b`,e[e.d=100]=`d`,e[e.e=101]=`e`,e[e.f=102]=`f`,e[e.i=105]=`i`,e[e.j=106]=`j`,e[e.l=108]=`l`,e[e.m=109]=`m`,e[e.n=110]=`n`,e[e.o=111]=`o`,e[e.r=114]=`r`,e[e.s=115]=`s`,e[e.t=116]=`t`,e[e.u=117]=`u`,e[e.x=120]=`x`,e[e.LeftCurly=123]=`LeftCurly`,e[e.RightCurly=125]=`RightCurly`,e[e.Tilde=126]=`Tilde`})(X_||={}),Y=X_})),Q_,$_=s((()=>{Z_(),x_(),Q_=function(){function e(e,t){this.major=String(e),this.minor=String(t)}return e.prototype.toString=function(){var e=Nm(129);return`%PDF-`+this.major+`.`+this.minor+`
|
|
947
|
+
%`+e+e+e+e},e.prototype.sizeInBytes=function(){return 12+this.major.length+this.minor.length},e.prototype.copyBytesInto=function(e,t){var n=t;return e[t++]=Y.Percent,e[t++]=Y.P,e[t++]=Y.D,e[t++]=Y.F,e[t++]=Y.Dash,t+=Im(this.major,e,t),e[t++]=Y.Period,t+=Im(this.minor,e,t),e[t++]=Y.Newline,e[t++]=Y.Percent,e[t++]=129,e[t++]=129,e[t++]=129,e[t++]=129,t-n},e.forVersion=function(t,n){return new e(t,n)},e}()})),ev,tv=s((()=>{Y_(),ev=function(){function e(){}return e.prototype.clone=function(e){throw new S_(this.constructor.name,`clone`)},e.prototype.toString=function(){throw new S_(this.constructor.name,`toString`)},e.prototype.sizeInBytes=function(){throw new S_(this.constructor.name,`sizeInBytes`)},e.prototype.copyBytesInto=function(e,t){throw new S_(this.constructor.name,`copyBytesInto`)},e}()})),nv,rv=s((()=>{K(),x_(),tv(),nv=function(e){G(t,e);function t(t){var n=e.call(this)||this;return n.numberValue=t,n.stringValue=kh(t),n}return t.prototype.asNumber=function(){return this.numberValue},t.prototype.value=function(){return this.numberValue},t.prototype.clone=function(){return t.of(this.numberValue)},t.prototype.toString=function(){return this.stringValue},t.prototype.sizeInBytes=function(){return this.stringValue.length},t.prototype.copyBytesInto=function(e,t){return t+=Im(this.stringValue,e,t),this.stringValue.length},t.of=function(e){return new t(e)},t}(ev)})),X,iv=s((()=>{K(),rv(),tv(),Z_(),Y_(),X=function(e){G(t,e);function t(t){var n=e.call(this)||this;return n.array=[],n.context=t,n}return t.prototype.size=function(){return this.array.length},t.prototype.push=function(e){this.array.push(e)},t.prototype.insert=function(e,t){this.array.splice(e,0,t)},t.prototype.indexOf=function(e){var t=this.array.indexOf(e);return t===-1?void 0:t},t.prototype.remove=function(e){this.array.splice(e,1)},t.prototype.set=function(e,t){this.array[e]=t},t.prototype.get=function(e){return this.array[e]},t.prototype.lookupMaybe=function(e){for(var t,n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];return(t=this.context).lookupMaybe.apply(t,vm([this.get(e)],n))},t.prototype.lookup=function(e){for(var t,n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];return(t=this.context).lookup.apply(t,vm([this.get(e)],n))},t.prototype.asRectangle=function(){if(this.size()!==4)throw new A_(this.size());var e=this.lookup(0,nv).asNumber(),t=this.lookup(1,nv).asNumber(),n=this.lookup(2,nv).asNumber(),r=this.lookup(3,nv).asNumber();return{x:e,y:t,width:n-e,height:r-t}},t.prototype.asArray=function(){return this.array.slice()},t.prototype.clone=function(e){for(var n=t.withContext(e||this.context),r=0,i=this.size();r<i;r++)n.push(this.array[r]);return n},t.prototype.toString=function(){for(var e=`[ `,t=0,n=this.size();t<n;t++)e+=this.get(t).toString(),e+=` `;return e+=`]`,e},t.prototype.sizeInBytes=function(){for(var e=3,t=0,n=this.size();t<n;t++)e+=this.get(t).sizeInBytes()+1;return e},t.prototype.copyBytesInto=function(e,t){var n=t;e[t++]=Y.LeftSquareBracket,e[t++]=Y.Space;for(var r=0,i=this.size();r<i;r++)t+=this.get(r).copyBytesInto(e,t),e[t++]=Y.Space;return e[t++]=Y.RightSquareBracket,t-n},t.prototype.scalePDFNumbers=function(e,t){for(var n=0,r=this.size();n<r;n++){var i=this.lookup(n);if(i instanceof nv){var a=n%2==0?e:t;this.set(n,nv.of(i.asNumber()*a))}}},t.withContext=function(e){return new t(e)},t}(ev)})),av,ov,sv=s((()=>{K(),Y_(),tv(),Z_(),av={},ov=function(e){G(t,e);function t(t,n){var r=this;if(t!==av)throw new C_(`PDFBool`);return r=e.call(this)||this,r.value=n,r}return t.prototype.asBoolean=function(){return this.value},t.prototype.clone=function(){return this},t.prototype.toString=function(){return String(this.value)},t.prototype.sizeInBytes=function(){return this.value?4:5},t.prototype.copyBytesInto=function(e,t){return this.value?(e[t++]=Y.t,e[t++]=Y.r,e[t++]=Y.u,e[t++]=Y.e,4):(e[t++]=Y.f,e[t++]=Y.a,e[t++]=Y.l,e[t++]=Y.s,e[t++]=Y.e,5)},t.True=new t(av,!0),t.False=new t(av,!1),t}(ev)})),cv,lv=s((()=>{Z_(),cv=new Uint8Array(256),cv[Y.LeftParen]=1,cv[Y.RightParen]=1,cv[Y.LessThan]=1,cv[Y.GreaterThan]=1,cv[Y.LeftSquareBracket]=1,cv[Y.RightSquareBracket]=1,cv[Y.LeftCurly]=1,cv[Y.RightCurly]=1,cv[Y.ForwardSlash]=1,cv[Y.Percent]=1})),uv,dv=s((()=>{Z_(),uv=new Uint8Array(256),uv[Y.Null]=1,uv[Y.Tab]=1,uv[Y.Newline]=1,uv[Y.FormFeed]=1,uv[Y.CarriageReturn]=1,uv[Y.Space]=1})),fv,pv,mv,hv=s((()=>{for(Z_(),lv(),dv(),fv=new Uint8Array(256),pv=0,mv=256;pv<mv;pv++)fv[pv]=uv[pv]||cv[pv]?1:0;fv[Y.Hash]=1})),gv,_v,vv,yv,Z,bv=s((()=>{K(),Y_(),tv(),Z_(),hv(),x_(),gv=function(e){return e.replace(/#([\dABCDEF]{2})/g,function(e,t){return Pm(t)})},_v=function(e){return e>=Y.ExclamationPoint&&e<=Y.Tilde&&!fv[e]},vv={},yv=new Map,Z=function(e){G(t,e);function t(t,n){var r=this;if(t!==vv)throw new C_(`PDFName`);r=e.call(this)||this;for(var i=`/`,a=0,o=n.length;a<o;a++){var s=n[a],c=km(s);i+=_v(c)?s:`#`+Mm(c)}return r.encodedName=i,r}return t.prototype.asBytes=function(){for(var e=[],t=``,n=!1,r=function(t){t!==void 0&&e.push(t),n=!1},i=1,a=this.encodedName.length;i<a;i++){var o=this.encodedName[i],s=km(o),c=this.encodedName[i+1];n?s>=Y.Zero&&s<=Y.Nine||s>=Y.a&&s<=Y.f||s>=Y.A&&s<=Y.F?(t+=o,t.length!==2&&(c>=`0`&&c<=`9`||c>=`a`&&c<=`f`||c>=`A`&&c<=`F`)||(r(parseInt(t,16)),t=``)):r(s):s===Y.Hash?n=!0:r(s)}return new Uint8Array(e)},t.prototype.decodeText=function(){var e=this.asBytes();return String.fromCharCode.apply(String,Array.from(e))},t.prototype.asString=function(){return this.encodedName},t.prototype.value=function(){return this.encodedName},t.prototype.clone=function(){return this},t.prototype.toString=function(){return this.encodedName},t.prototype.sizeInBytes=function(){return this.encodedName.length},t.prototype.copyBytesInto=function(e,t){return t+=Im(this.encodedName,e,t),this.encodedName.length},t.of=function(e){var n=gv(e),r=yv.get(n);return r||(r=new t(vv,n),yv.set(n,r)),r},t.Length=t.of(`Length`),t.FlateDecode=t.of(`FlateDecode`),t.Resources=t.of(`Resources`),t.Font=t.of(`Font`),t.XObject=t.of(`XObject`),t.ExtGState=t.of(`ExtGState`),t.Contents=t.of(`Contents`),t.Type=t.of(`Type`),t.Parent=t.of(`Parent`),t.MediaBox=t.of(`MediaBox`),t.Page=t.of(`Page`),t.Annots=t.of(`Annots`),t.TrimBox=t.of(`TrimBox`),t.ArtBox=t.of(`ArtBox`),t.BleedBox=t.of(`BleedBox`),t.CropBox=t.of(`CropBox`),t.Rotate=t.of(`Rotate`),t.Title=t.of(`Title`),t.Author=t.of(`Author`),t.Subject=t.of(`Subject`),t.Creator=t.of(`Creator`),t.Keywords=t.of(`Keywords`),t.Producer=t.of(`Producer`),t.CreationDate=t.of(`CreationDate`),t.ModDate=t.of(`ModDate`),t}(ev)})),xv,Sv,Cv=s((()=>{K(),tv(),Z_(),xv=function(e){G(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.asNull=function(){return null},t.prototype.clone=function(){return this},t.prototype.toString=function(){return`null`},t.prototype.sizeInBytes=function(){return 4},t.prototype.copyBytesInto=function(e,t){return e[t++]=Y.n,e[t++]=Y.u,e[t++]=Y.l,e[t++]=Y.l,4},t}(ev),Sv=new xv})),Q,wv=s((()=>{K(),bv(),Cv(),tv(),Z_(),Q=function(e){G(t,e);function t(t,n){var r=e.call(this)||this;return r.dict=t,r.context=n,r}return t.prototype.keys=function(){return Array.from(this.dict.keys())},t.prototype.values=function(){return Array.from(this.dict.values())},t.prototype.entries=function(){return Array.from(this.dict.entries())},t.prototype.set=function(e,t){this.dict.set(e,t)},t.prototype.get=function(e,t){t===void 0&&(t=!1);var n=this.dict.get(e);if(n!==Sv||t)return n},t.prototype.has=function(e){var t=this.dict.get(e);return t!==void 0&&t!==Sv},t.prototype.lookupMaybe=function(e){for(var t,n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];var i=n.includes(Sv),a=(t=this.context).lookupMaybe.apply(t,vm([this.get(e,i)],n));if(a!==Sv||i)return a},t.prototype.lookup=function(e){for(var t,n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];var i=n.includes(Sv),a=(t=this.context).lookup.apply(t,vm([this.get(e,i)],n));if(a!==Sv||i)return a},t.prototype.delete=function(e){return this.dict.delete(e)},t.prototype.asMap=function(){return new Map(this.dict)},t.prototype.uniqueKey=function(e){e===void 0&&(e=``);for(var t=this.keys(),n=Z.of(this.context.addRandomSuffix(e,10));t.includes(n);)n=Z.of(this.context.addRandomSuffix(e,10));return n},t.prototype.clone=function(e){for(var n=t.withContext(e||this.context),r=this.entries(),i=0,a=r.length;i<a;i++){var o=r[i],s=o[0],c=o[1];n.set(s,c)}return n},t.prototype.toString=function(){for(var e=`<<
|
|
948
|
+
`,t=this.entries(),n=0,r=t.length;n<r;n++){var i=t[n],a=i[0],o=i[1];e+=a.toString()+` `+o.toString()+`
|
|
949
|
+
`}return e+=`>>`,e},t.prototype.sizeInBytes=function(){for(var e=5,t=this.entries(),n=0,r=t.length;n<r;n++){var i=t[n],a=i[0],o=i[1];e+=a.sizeInBytes()+o.sizeInBytes()+2}return e},t.prototype.copyBytesInto=function(e,t){var n=t;e[t++]=Y.LessThan,e[t++]=Y.LessThan,e[t++]=Y.Newline;for(var r=this.entries(),i=0,a=r.length;i<a;i++){var o=r[i],s=o[0],c=o[1];t+=s.copyBytesInto(e,t),e[t++]=Y.Space,t+=c.copyBytesInto(e,t),e[t++]=Y.Newline}return e[t++]=Y.GreaterThan,e[t++]=Y.GreaterThan,t-n},t.withContext=function(e){return new t(new Map,e)},t.fromMapWithContext=function(e,n){return new t(e,n)},t}(ev)})),Tv,Ev=s((()=>{K(),Y_(),bv(),rv(),tv(),Z_(),Tv=function(e){G(t,e);function t(t){var n=e.call(this)||this;return n.dict=t,n}return t.prototype.clone=function(e){throw new S_(this.constructor.name,`clone`)},t.prototype.getContentsString=function(){throw new S_(this.constructor.name,`getContentsString`)},t.prototype.getContents=function(){throw new S_(this.constructor.name,`getContents`)},t.prototype.getContentsSize=function(){throw new S_(this.constructor.name,`getContentsSize`)},t.prototype.updateDict=function(){var e=this.getContentsSize();this.dict.set(Z.Length,nv.of(e))},t.prototype.sizeInBytes=function(){return this.updateDict(),this.dict.sizeInBytes()+this.getContentsSize()+18},t.prototype.toString=function(){this.updateDict();var e=this.dict.toString();return e+=`
|
|
950
|
+
stream
|
|
951
|
+
`,e+=this.getContentsString(),e+=`
|
|
952
|
+
endstream`,e},t.prototype.copyBytesInto=function(e,t){this.updateDict();var n=t;t+=this.dict.copyBytesInto(e,t),e[t++]=Y.Newline,e[t++]=Y.s,e[t++]=Y.t,e[t++]=Y.r,e[t++]=Y.e,e[t++]=Y.a,e[t++]=Y.m,e[t++]=Y.Newline;for(var r=this.getContents(),i=0,a=r.length;i<a;i++)e[t++]=r[i];return e[t++]=Y.Newline,e[t++]=Y.e,e[t++]=Y.n,e[t++]=Y.d,e[t++]=Y.s,e[t++]=Y.t,e[t++]=Y.r,e[t++]=Y.e,e[t++]=Y.a,e[t++]=Y.m,t-n},t}(ev)})),Dv,Ov=s((()=>{K(),Ev(),x_(),Dv=function(e){G(t,e);function t(t,n){var r=e.call(this,t)||this;return r.contents=n,r}return t.prototype.asUint8Array=function(){return this.contents.slice()},t.prototype.clone=function(e){return t.of(this.dict.clone(e),this.contents.slice())},t.prototype.getContentsString=function(){return th(this.contents)},t.prototype.getContents=function(){return this.contents},t.prototype.getContentsSize=function(){return this.contents.length},t.of=function(e,n){return new t(e,n)},t}(Tv)})),kv,Av,jv,Mv=s((()=>{K(),Y_(),tv(),x_(),kv={},Av=new Map,jv=function(e){G(t,e);function t(t,n,r){var i=this;if(t!==kv)throw new C_(`PDFRef`);return i=e.call(this)||this,i.objectNumber=n,i.generationNumber=r,i.tag=n+` `+r+` R`,i}return t.prototype.clone=function(){return this},t.prototype.toString=function(){return this.tag},t.prototype.sizeInBytes=function(){return this.tag.length},t.prototype.copyBytesInto=function(e,t){return t+=Im(this.tag,e,t),this.tag.length},t.of=function(e,n){n===void 0&&(n=0);var r=e+` `+n+` R`,i=Av.get(r);return i||(i=new t(kv,e,n),Av.set(r,i)),i},t}(ev)})),Nv,Pv=s((()=>{tv(),Z_(),x_(),Nv=function(){function e(e,t){this.name=e,this.args=t||[]}return e.prototype.clone=function(t){for(var n=Array(this.args.length),r=0,i=n.length;r<i;r++){var a=this.args[r];n[r]=a instanceof ev?a.clone(t):a}return e.of(this.name,n)},e.prototype.toString=function(){for(var e=``,t=0,n=this.args.length;t<n;t++)e+=String(this.args[t])+` `;return e+=this.name,e},e.prototype.sizeInBytes=function(){for(var e=0,t=0,n=this.args.length;t<n;t++){var r=this.args[t];e+=(r instanceof ev?r.sizeInBytes():r.length)+1}return e+=this.name.length,e},e.prototype.copyBytesInto=function(e,t){for(var n=t,r=0,i=this.args.length;r<i;r++){var a=this.args[r];a instanceof ev?t+=a.copyBytesInto(e,t):t+=Im(a,e,t),e[t++]=Y.Space}return t+=Im(this.name,e,t),t-n},e.of=function(t,n){return new e(t,n)},e}()})),Fv,Iv,Lv=s((()=>{(function(e){e.NonStrokingColor=`sc`,e.NonStrokingColorN=`scn`,e.NonStrokingColorRgb=`rg`,e.NonStrokingColorGray=`g`,e.NonStrokingColorCmyk=`k`,e.NonStrokingColorspace=`cs`,e.StrokingColor=`SC`,e.StrokingColorN=`SCN`,e.StrokingColorRgb=`RG`,e.StrokingColorGray=`G`,e.StrokingColorCmyk=`K`,e.StrokingColorspace=`CS`,e.BeginMarkedContentSequence=`BDC`,e.BeginMarkedContent=`BMC`,e.EndMarkedContent=`EMC`,e.MarkedContentPointWithProps=`DP`,e.MarkedContentPoint=`MP`,e.DrawObject=`Do`,e.ConcatTransformationMatrix=`cm`,e.PopGraphicsState=`Q`,e.PushGraphicsState=`q`,e.SetFlatness=`i`,e.SetGraphicsStateParams=`gs`,e.SetLineCapStyle=`J`,e.SetLineDashPattern=`d`,e.SetLineJoinStyle=`j`,e.SetLineMiterLimit=`M`,e.SetLineWidth=`w`,e.SetTextMatrix=`Tm`,e.SetRenderingIntent=`ri`,e.AppendRectangle=`re`,e.BeginInlineImage=`BI`,e.BeginInlineImageData=`ID`,e.EndInlineImage=`EI`,e.ClipEvenOdd=`W*`,e.ClipNonZero=`W`,e.CloseAndStroke=`s`,e.CloseFillEvenOddAndStroke=`b*`,e.CloseFillNonZeroAndStroke=`b`,e.ClosePath=`h`,e.AppendBezierCurve=`c`,e.CurveToReplicateFinalPoint=`y`,e.CurveToReplicateInitialPoint=`v`,e.EndPath=`n`,e.FillEvenOddAndStroke=`B*`,e.FillEvenOdd=`f*`,e.FillNonZeroAndStroke=`B`,e.FillNonZero=`f`,e.LegacyFillNonZero=`F`,e.LineTo=`l`,e.MoveTo=`m`,e.ShadingFill=`sh`,e.StrokePath=`S`,e.BeginText=`BT`,e.EndText=`ET`,e.MoveText=`Td`,e.MoveTextSetLeading=`TD`,e.NextLine=`T*`,e.SetCharacterSpacing=`Tc`,e.SetFontAndSize=`Tf`,e.SetTextHorizontalScaling=`Tz`,e.SetTextLineHeight=`TL`,e.SetTextRenderingMode=`Tr`,e.SetTextRise=`Ts`,e.SetWordSpacing=`Tw`,e.ShowText=`Tj`,e.ShowTextAdjusted=`TJ`,e.ShowTextLine=`'`,e.ShowTextLineAndSpace=`"`,e.Type3D0=`d0`,e.Type3D1=`d1`,e.BeginCompatibilitySection=`BX`,e.EndCompatibilitySection=`EX`})(Fv||={}),Iv=Fv})),Rv,zv,Bv=s((()=>{K(),Rv=d(Xh()),Y_(),bv(),Ev(),x_(),zv=function(e){G(t,e);function t(t,n){var r=e.call(this,t)||this;return r.computeContents=function(){var e=r.getUnencodedContents();return r.encode?Rv.default.deflate(e):e},r.encode=n,n&&t.set(Z.of(`Filter`),Z.of(`FlateDecode`)),r.contentsCache=y_.populatedBy(r.computeContents),r}return t.prototype.getContents=function(){return this.contentsCache.access()},t.prototype.getContentsSize=function(){return this.contentsCache.access().length},t.prototype.getUnencodedContents=function(){throw new S_(this.constructor.name,`getUnencodedContents`)},t}(Tv)})),Vv,Hv=s((()=>{K(),Bv(),Z_(),Vv=function(e){G(t,e);function t(t,n,r){r===void 0&&(r=!0);var i=e.call(this,t,r)||this;return i.operators=n,i}return t.prototype.push=function(){for(var e,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];(e=this.operators).push.apply(e,t)},t.prototype.clone=function(e){for(var n=Array(this.operators.length),r=0,i=this.operators.length;r<i;r++)n[r]=this.operators[r].clone(e);var a=this,o=a.dict,s=a.encode;return t.of(o.clone(e),n,s)},t.prototype.getContentsString=function(){for(var e=``,t=0,n=this.operators.length;t<n;t++)e+=this.operators[t]+`
|
|
953
|
+
`;return e},t.prototype.getUnencodedContents=function(){for(var e=new Uint8Array(this.getUnencodedContentsSize()),t=0,n=0,r=this.operators.length;n<r;n++)t+=this.operators[n].copyBytesInto(e,t),e[t++]=Y.Newline;return e},t.prototype.getUnencodedContentsSize=function(){for(var e=0,t=0,n=this.operators.length;t<n;t++)e+=this.operators[t].sizeInBytes()+1;return e},t.of=function(e,n,r){return r===void 0&&(r=!0),new t(e,n,r)},t}(zv)})),Uv,Wv=s((()=>{Uv=function(){function e(e){this.seed=e}return e.prototype.nextInt=function(){var e=Math.sin(this.seed++)*1e4;return e-Math.floor(e)},e.withSeed=function(t){return new e(t)},e}()})),Gv,Kv,qv,Jv=s((()=>{K(),Gv=d(Xh()),$_(),Y_(),iv(),sv(),wv(),bv(),Cv(),rv(),tv(),Ov(),Mv(),Pv(),Lv(),Hv(),x_(),Wv(),Kv=function(e,t){var n=e[0],r=t[0];return n.objectNumber-r.objectNumber},qv=function(){function e(){this.largestObjectNumber=0,this.header=Q_.forVersion(1,7),this.trailerInfo={},this.indirectObjects=new Map,this.rng=Uv.withSeed(1)}return e.prototype.assign=function(e,t){this.indirectObjects.set(e,t),e.objectNumber>this.largestObjectNumber&&(this.largestObjectNumber=e.objectNumber)},e.prototype.nextRef=function(){return this.largestObjectNumber+=1,jv.of(this.largestObjectNumber)},e.prototype.register=function(e){var t=this.nextRef();return this.assign(t,e),t},e.prototype.delete=function(e){return this.indirectObjects.delete(e)},e.prototype.lookupMaybe=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];var r=t.includes(Sv),i=e instanceof jv?this.indirectObjects.get(e):e;if(i&&(i!==Sv||r)){for(var a=0,o=t.length;a<o;a++){var s=t[a];if(s===Sv){if(i===Sv)return i}else if(i instanceof s)return i}throw new w_(t,i)}},e.prototype.lookup=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];var r=e instanceof jv?this.indirectObjects.get(e):e;if(t.length===0)return r;for(var i=0,a=t.length;i<a;i++){var o=t[i];if(o===Sv){if(r===Sv)return r}else if(r instanceof o)return r}throw new w_(t,r)},e.prototype.getObjectRef=function(e){for(var t=Array.from(this.indirectObjects.entries()),n=0,r=t.length;n<r;n++){var i=t[n],a=i[0];if(i[1]===e)return a}},e.prototype.enumerateIndirectObjects=function(){return Array.from(this.indirectObjects.entries()).sort(Kv)},e.prototype.obj=function(e){if(e instanceof ev)return e;if(e==null)return Sv;if(typeof e==`string`)return Z.of(e);if(typeof e==`number`)return nv.of(e);if(typeof e==`boolean`)return e?ov.True:ov.False;if(Array.isArray(e)){for(var t=X.withContext(this),n=0,r=e.length;n<r;n++)t.push(this.obj(e[n]));return t}for(var i=Q.withContext(this),a=Object.keys(e),n=0,r=a.length;n<r;n++){var o=a[n],s=e[o];s!==void 0&&i.set(Z.of(o),this.obj(s))}return i},e.prototype.stream=function(e,t){return t===void 0&&(t={}),Dv.of(this.obj(t),Qm(e))},e.prototype.flateStream=function(e,t){return t===void 0&&(t={}),this.stream(Gv.default.deflate(Qm(e)),bm(bm({},t),{Filter:`FlateDecode`}))},e.prototype.contentStream=function(e,t){return t===void 0&&(t={}),Vv.of(this.obj(t),e)},e.prototype.formXObject=function(e,t){return t===void 0&&(t={}),this.contentStream(e,bm(bm({BBox:this.obj([0,0,0,0]),Matrix:this.obj([1,0,0,1,0,0])},t),{Type:`XObject`,Subtype:`Form`}))},e.prototype.getPushGraphicsStateContentStream=function(){if(this.pushGraphicsStateContentStreamRef)return this.pushGraphicsStateContentStreamRef;var e=this.obj({}),t=Nv.of(Iv.PushGraphicsState),n=Vv.of(e,[t]);return this.pushGraphicsStateContentStreamRef=this.register(n),this.pushGraphicsStateContentStreamRef},e.prototype.getPopGraphicsStateContentStream=function(){if(this.popGraphicsStateContentStreamRef)return this.popGraphicsStateContentStreamRef;var e=this.obj({}),t=Nv.of(Iv.PopGraphicsState),n=Vv.of(e,[t]);return this.popGraphicsStateContentStreamRef=this.register(n),this.popGraphicsStateContentStreamRef},e.prototype.addRandomSuffix=function(e,t){return t===void 0&&(t=4),e+`-`+Math.floor(this.rng.nextInt()*10**t)},e.create=function(){return new e},e}()})),Yv,Xv=s((()=>{K(),iv(),wv(),bv(),rv(),Ev(),Yv=function(e){G(t,e);function t(t,n,r){r===void 0&&(r=!0);var i=e.call(this,t,n)||this;return i.normalized=!1,i.autoNormalizeCTM=r,i}return t.prototype.clone=function(e){for(var n=t.fromMapWithContext(new Map,e||this.context,this.autoNormalizeCTM),r=this.entries(),i=0,a=r.length;i<a;i++){var o=r[i],s=o[0],c=o[1];n.set(s,c)}return n},t.prototype.Parent=function(){return this.lookupMaybe(Z.Parent,Q)},t.prototype.Contents=function(){return this.lookup(Z.of(`Contents`))},t.prototype.Annots=function(){return this.lookupMaybe(Z.Annots,X)},t.prototype.BleedBox=function(){return this.lookupMaybe(Z.BleedBox,X)},t.prototype.TrimBox=function(){return this.lookupMaybe(Z.TrimBox,X)},t.prototype.ArtBox=function(){return this.lookupMaybe(Z.ArtBox,X)},t.prototype.Resources=function(){var e=this.getInheritableAttribute(Z.Resources);return this.context.lookupMaybe(e,Q)},t.prototype.MediaBox=function(){var e=this.getInheritableAttribute(Z.MediaBox);return this.context.lookup(e,X)},t.prototype.CropBox=function(){var e=this.getInheritableAttribute(Z.CropBox);return this.context.lookupMaybe(e,X)},t.prototype.Rotate=function(){var e=this.getInheritableAttribute(Z.Rotate);return this.context.lookupMaybe(e,nv)},t.prototype.getInheritableAttribute=function(e){var t;return this.ascend(function(n){t||=n.get(e)}),t},t.prototype.setParent=function(e){this.set(Z.Parent,e)},t.prototype.addContentStream=function(e){var t=this.normalizedEntries().Contents||this.context.obj([]);this.set(Z.Contents,t),t.push(e)},t.prototype.wrapContentStreams=function(e,t){var n=this.Contents();return n instanceof X&&(n.insert(0,e),n.push(t),!0)},t.prototype.addAnnot=function(e){this.normalizedEntries().Annots.push(e)},t.prototype.removeAnnot=function(e){var t=this.normalizedEntries().Annots,n=t.indexOf(e);n!==void 0&&t.remove(n)},t.prototype.setFontDictionary=function(e,t){this.normalizedEntries().Font.set(e,t)},t.prototype.newFontDictionaryKey=function(e){return this.normalizedEntries().Font.uniqueKey(e)},t.prototype.newFontDictionary=function(e,t){var n=this.newFontDictionaryKey(e);return this.setFontDictionary(n,t),n},t.prototype.setXObject=function(e,t){this.normalizedEntries().XObject.set(e,t)},t.prototype.newXObjectKey=function(e){return this.normalizedEntries().XObject.uniqueKey(e)},t.prototype.newXObject=function(e,t){var n=this.newXObjectKey(e);return this.setXObject(n,t),n},t.prototype.setExtGState=function(e,t){this.normalizedEntries().ExtGState.set(e,t)},t.prototype.newExtGStateKey=function(e){return this.normalizedEntries().ExtGState.uniqueKey(e)},t.prototype.newExtGState=function(e,t){var n=this.newExtGStateKey(e);return this.setExtGState(n,t),n},t.prototype.ascend=function(e){e(this);var t=this.Parent();t&&t.ascend(e)},t.prototype.normalize=function(){if(!this.normalized){var e=this.context,t=this.get(Z.Contents);this.context.lookup(t)instanceof Tv&&this.set(Z.Contents,e.obj([t])),this.autoNormalizeCTM&&this.wrapContentStreams(this.context.getPushGraphicsStateContentStream(),this.context.getPopGraphicsStateContentStream());var n=this.getInheritableAttribute(Z.Resources),r=e.lookupMaybe(n,Q)||e.obj({});this.set(Z.Resources,r);var i=r.lookupMaybe(Z.Font,Q)||e.obj({});r.set(Z.Font,i);var a=r.lookupMaybe(Z.XObject,Q)||e.obj({});r.set(Z.XObject,a);var o=r.lookupMaybe(Z.ExtGState,Q)||e.obj({});r.set(Z.ExtGState,o);var s=this.Annots()||e.obj([]);this.set(Z.Annots,s),this.normalized=!0}},t.prototype.normalizedEntries=function(){this.normalize();var e=this.Annots(),t=this.Resources();return{Annots:e,Resources:t,Contents:this.Contents(),Font:t.lookup(Z.Font,Q),XObject:t.lookup(Z.XObject,Q),ExtGState:t.lookup(Z.ExtGState,Q)}},t.InheritableEntries=[`Resources`,`MediaBox`,`CropBox`,`Rotate`],t.withContextAndParent=function(e,n){var r=new Map;return r.set(Z.Type,Z.Page),r.set(Z.Parent,n),r.set(Z.Resources,e.obj({})),r.set(Z.MediaBox,e.obj([0,0,612,792])),new t(r,e,!1)},t.fromMapWithContext=function(e,n,r){return r===void 0&&(r=!0),new t(e,n,r)},t}(Q)})),Zv,Qv=s((()=>{iv(),wv(),bv(),Mv(),Ev(),Xv(),Zv=function(){function e(e,t){var n=this;this.traversedObjects=new Map,this.copy=function(e){return e instanceof Yv?n.copyPDFPage(e):e instanceof Q?n.copyPDFDict(e):e instanceof X?n.copyPDFArray(e):e instanceof Tv?n.copyPDFStream(e):e instanceof jv?n.copyPDFIndirectObject(e):e.clone()},this.copyPDFPage=function(e){for(var t=e.clone(),r=Yv.InheritableEntries,i=0,a=r.length;i<a;i++){var o=Z.of(r[i]),s=t.getInheritableAttribute(o);!t.get(o)&&s&&t.set(o,s)}return t.delete(Z.of(`Parent`)),n.copyPDFDict(t)},this.copyPDFDict=function(e){if(n.traversedObjects.has(e))return n.traversedObjects.get(e);var t=e.clone(n.dest);n.traversedObjects.set(e,t);for(var r=e.entries(),i=0,a=r.length;i<a;i++){var o=r[i],s=o[0],c=o[1];t.set(s,n.copy(c))}return t},this.copyPDFArray=function(e){if(n.traversedObjects.has(e))return n.traversedObjects.get(e);var t=e.clone(n.dest);n.traversedObjects.set(e,t);for(var r=0,i=e.size();r<i;r++){var a=e.get(r);t.set(r,n.copy(a))}return t},this.copyPDFStream=function(e){if(n.traversedObjects.has(e))return n.traversedObjects.get(e);var t=e.clone(n.dest);n.traversedObjects.set(e,t);for(var r=e.dict.entries(),i=0,a=r.length;i<a;i++){var o=r[i],s=o[0],c=o[1];t.dict.set(s,n.copy(c))}return t},this.copyPDFIndirectObject=function(e){if(!n.traversedObjects.has(e)){var t=n.dest.nextRef();n.traversedObjects.set(e,t);var r=n.src.lookup(e);if(r){var i=n.copy(r);n.dest.assign(t,i)}}return n.traversedObjects.get(e)},this.src=e,this.dest=t}return e.for=function(t,n){return new e(t,n)},e}()})),$v,ey=s((()=>{Mv(),Z_(),x_(),$v=function(){function e(e){this.subsections=e?[[e]]:[],this.chunkIdx=0,this.chunkLength=+!!e}return e.prototype.addEntry=function(e,t){this.append({ref:e,offset:t,deleted:!1})},e.prototype.addDeletedEntry=function(e,t){this.append({ref:e,offset:t,deleted:!0})},e.prototype.toString=function(){for(var e=`xref
|
|
954
|
+
`,t=0,n=this.subsections.length;t<n;t++){var r=this.subsections[t];e+=r[0].ref.objectNumber+` `+r.length+`
|
|
955
|
+
`;for(var i=0,a=r.length;i<a;i++){var o=r[i];e+=Fm(String(o.offset),10,`0`),e+=` `,e+=Fm(String(o.ref.generationNumber),5,`0`),e+=` `,e+=o.deleted?`f`:`n`,e+=`
|
|
956
|
+
`}}return e},e.prototype.sizeInBytes=function(){for(var e=5,t=0,n=this.subsections.length;t<n;t++){var r=this.subsections[t],i=r.length,a=r[0];e+=2,e+=String(a.ref.objectNumber).length,e+=String(i).length,e+=20*i}return e},e.prototype.copyBytesInto=function(e,t){var n=t;return e[t++]=Y.x,e[t++]=Y.r,e[t++]=Y.e,e[t++]=Y.f,e[t++]=Y.Newline,t+=this.copySubsectionsIntoBuffer(this.subsections,e,t),t-n},e.prototype.copySubsectionsIntoBuffer=function(e,t,n){for(var r=n,i=e.length,a=0;a<i;a++){var o=this.subsections[a],s=String(o[0].ref.objectNumber);n+=Im(s,t,n),t[n++]=Y.Space;var c=String(o.length);n+=Im(c,t,n),t[n++]=Y.Newline,n+=this.copyEntriesIntoBuffer(o,t,n)}return n-r},e.prototype.copyEntriesIntoBuffer=function(e,t,n){for(var r=e.length,i=0;i<r;i++){var a=e[i],o=Fm(String(a.offset),10,`0`);n+=Im(o,t,n),t[n++]=Y.Space;var s=Fm(String(a.ref.generationNumber),5,`0`);n+=Im(s,t,n),t[n++]=Y.Space,t[n++]=a.deleted?Y.f:Y.n,t[n++]=Y.Space,t[n++]=Y.Newline}return 20*r},e.prototype.append=function(e){if(this.chunkLength===0)this.subsections.push([e]),this.chunkIdx=0,this.chunkLength=1;else{var t=this.subsections[this.chunkIdx],n=t[this.chunkLength-1];e.ref.objectNumber-n.ref.objectNumber>1?(this.subsections.push([e]),this.chunkIdx+=1,this.chunkLength=1):(t.push(e),this.chunkLength+=1)}},e.create=function(){return new e({ref:jv.of(0,65535),offset:0,deleted:!0})},e.createEmpty=function(){return new e},e}()})),ty,ny=s((()=>{Z_(),x_(),ty=function(){function e(e){this.lastXRefOffset=String(e)}return e.prototype.toString=function(){return`startxref
|
|
957
|
+
`+this.lastXRefOffset+`
|
|
958
|
+
%%EOF`},e.prototype.sizeInBytes=function(){return 16+this.lastXRefOffset.length},e.prototype.copyBytesInto=function(e,t){var n=t;return e[t++]=Y.s,e[t++]=Y.t,e[t++]=Y.a,e[t++]=Y.r,e[t++]=Y.t,e[t++]=Y.x,e[t++]=Y.r,e[t++]=Y.e,e[t++]=Y.f,e[t++]=Y.Newline,t+=Im(this.lastXRefOffset,e,t),e[t++]=Y.Newline,e[t++]=Y.Percent,e[t++]=Y.Percent,e[t++]=Y.E,e[t++]=Y.O,e[t++]=Y.F,t-n},e.forLastCrossRefSectionOffset=function(t){return new e(t)},e}()})),ry,iy=s((()=>{Z_(),ry=function(){function e(e){this.dict=e}return e.prototype.toString=function(){return`trailer
|
|
959
|
+
`+this.dict.toString()},e.prototype.sizeInBytes=function(){return 8+this.dict.sizeInBytes()},e.prototype.copyBytesInto=function(e,t){var n=t;return e[t++]=Y.t,e[t++]=Y.r,e[t++]=Y.a,e[t++]=Y.i,e[t++]=Y.l,e[t++]=Y.e,e[t++]=Y.r,e[t++]=Y.Newline,t+=this.dict.copyBytesInto(e,t),t-n},e.of=function(t){return new e(t)},e}()})),ay,oy=s((()=>{K(),bv(),rv(),Bv(),Z_(),x_(),ay=function(e){G(t,e);function t(t,n,r){r===void 0&&(r=!0);var i=e.call(this,t.obj({}),r)||this;return i.objects=n,i.offsets=i.computeObjectOffsets(),i.offsetsString=i.computeOffsetsString(),i.dict.set(Z.of(`Type`),Z.of(`ObjStm`)),i.dict.set(Z.of(`N`),nv.of(i.objects.length)),i.dict.set(Z.of(`First`),nv.of(i.offsetsString.length)),i}return t.prototype.getObjectsCount=function(){return this.objects.length},t.prototype.clone=function(e){return t.withContextAndObjects(e||this.dict.context,this.objects.slice(),this.encode)},t.prototype.getContentsString=function(){for(var e=this.offsetsString,t=0,n=this.objects.length;t<n;t++){var r=this.objects[t][1];e+=r+`
|
|
960
|
+
`}return e},t.prototype.getUnencodedContents=function(){for(var e=new Uint8Array(this.getUnencodedContentsSize()),t=Im(this.offsetsString,e,0),n=0,r=this.objects.length;n<r;n++){var i=this.objects[n][1];t+=i.copyBytesInto(e,t),e[t++]=Y.Newline}return e},t.prototype.getUnencodedContentsSize=function(){return this.offsetsString.length+Zm(this.offsets)[1]+Zm(this.objects)[1].sizeInBytes()+1},t.prototype.computeOffsetsString=function(){for(var e=``,t=0,n=this.offsets.length;t<n;t++){var r=this.offsets[t],i=r[0],a=r[1];e+=i+` `+a+` `}return e},t.prototype.computeObjectOffsets=function(){for(var e=0,t=Array(this.objects.length),n=0,r=this.objects.length;n<r;n++){var i=this.objects[n],a=i[0],o=i[1];t[n]=[a.objectNumber,e],e+=o.sizeInBytes()+1}return t},t.withContextAndObjects=function(e,n,r){return r===void 0&&(r=!0),new t(e,n,r)},t}(zv)})),sy,cy=s((()=>{K(),ey(),$_(),ny(),iy(),oy(),Z_(),x_(),sy=function(){function e(e,t){var n=this;this.parsedObjects=0,this.shouldWaitForTick=function(e){return n.parsedObjects+=e,n.parsedObjects%n.objectsPerTick===0},this.context=e,this.objectsPerTick=t}return e.prototype.serializeToBuffer=function(){return gm(this,void 0,void 0,function(){var e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g;return _m(this,function(_){switch(_.label){case 0:return[4,this.computeBufferSize()];case 1:e=_.sent(),t=e.size,n=e.header,r=e.indirectObjects,i=e.xref,a=e.trailerDict,o=e.trailer,s=0,c=new Uint8Array(t),s+=n.copyBytesInto(c,s),c[s++]=Y.Newline,c[s++]=Y.Newline,l=0,u=r.length,_.label=2;case 2:return l<u?(d=r[l],f=d[0],p=d[1],m=String(f.objectNumber),s+=Im(m,c,s),c[s++]=Y.Space,h=String(f.generationNumber),s+=Im(h,c,s),c[s++]=Y.Space,c[s++]=Y.o,c[s++]=Y.b,c[s++]=Y.j,c[s++]=Y.Newline,s+=p.copyBytesInto(c,s),c[s++]=Y.Newline,c[s++]=Y.e,c[s++]=Y.n,c[s++]=Y.d,c[s++]=Y.o,c[s++]=Y.b,c[s++]=Y.j,c[s++]=Y.Newline,c[s++]=Y.Newline,g=p instanceof ay?p.getObjectsCount():1,this.shouldWaitForTick(g)?[4,dh()]:[3,4]):[3,5];case 3:_.sent(),_.label=4;case 4:return l++,[3,2];case 5:return i&&(s+=i.copyBytesInto(c,s),c[s++]=Y.Newline),a&&(s+=a.copyBytesInto(c,s),c[s++]=Y.Newline,c[s++]=Y.Newline),s+=o.copyBytesInto(c,s),[2,c]}})})},e.prototype.computeIndirectObjectSize=function(e){var t=e[0],n=e[1];return t.sizeInBytes()+3+(n.sizeInBytes()+9)},e.prototype.createTrailerDict=function(){return this.context.obj({Size:this.context.largestObjectNumber+1,Root:this.context.trailerInfo.Root,Encrypt:this.context.trailerInfo.Encrypt,Info:this.context.trailerInfo.Info,ID:this.context.trailerInfo.ID})},e.prototype.computeBufferSize=function(){return gm(this,void 0,void 0,function(){var e,t,n,r,i,a,o,s,c,l,u;return _m(this,function(d){switch(d.label){case 0:e=Q_.forVersion(1,7),t=e.sizeInBytes()+2,n=$v.create(),r=this.context.enumerateIndirectObjects(),i=0,a=r.length,d.label=1;case 1:return i<a?(o=r[i],s=o[0],n.addEntry(s,t),t+=this.computeIndirectObjectSize(o),this.shouldWaitForTick(1)?[4,dh()]:[3,3]):[3,4];case 2:d.sent(),d.label=3;case 3:return i++,[3,1];case 4:return c=t,t+=n.sizeInBytes()+1,l=ry.of(this.createTrailerDict()),t+=l.sizeInBytes()+2,u=ty.forLastCrossRefSectionOffset(c),t+=u.sizeInBytes(),[2,{size:t,header:e,indirectObjects:r,xref:n,trailerDict:l,trailer:u}]}})})},e.forContext=function(t,n){return new e(t,n)},e}()})),ly,uy=s((()=>{K(),tv(),ly=function(e){G(t,e);function t(t){var n=e.call(this)||this;return n.data=t,n}return t.prototype.clone=function(){return t.of(this.data.slice())},t.prototype.toString=function(){return`PDFInvalidObject(`+this.data.length+` bytes)`},t.prototype.sizeInBytes=function(){return this.data.length},t.prototype.copyBytesInto=function(e,t){for(var n=this.data.length,r=0;r<n;r++)e[t++]=this.data[r];return n},t.of=function(e){return new t(e)},t}(ev)})),dy,fy,py=s((()=>{K(),bv(),Mv(),Bv(),x_(),(function(e){e[e.Deleted=0]=`Deleted`,e[e.Uncompressed=1]=`Uncompressed`,e[e.Compressed=2]=`Compressed`})(dy||={}),fy=function(e){G(t,e);function t(t,n,r){r===void 0&&(r=!0);var i=e.call(this,t,r)||this;return i.computeIndex=function(){for(var e=[],t=0,n=0,r=i.entries.length;n<r;n++){var a=i.entries[n],o=i.entries[n-1];n===0?e.push(a.ref.objectNumber):a.ref.objectNumber-o.ref.objectNumber>1&&(e.push(t),e.push(a.ref.objectNumber),t=0),t+=1}return e.push(t),e},i.computeEntryTuples=function(){for(var e=Array(i.entries.length),t=0,n=i.entries.length;t<n;t++){var r=i.entries[t];if(r.type===dy.Deleted){var a=r.type,o=r.nextFreeObjectNumber,s=r.ref;e[t]=[a,o,s.generationNumber]}if(r.type===dy.Uncompressed){var a=r.type,c=r.offset,s=r.ref;e[t]=[a,c,s.generationNumber]}if(r.type===dy.Compressed){var a=r.type,l=r.objectStreamRef,u=r.index;e[t]=[a,l.objectNumber,u]}}return e},i.computeMaxEntryByteWidths=function(){for(var e=i.entryTuplesCache.access(),t=[0,0,0],n=0,r=e.length;n<r;n++){var a=e[n],o=a[0],s=a[1],c=a[2],l=Ah(o),u=Ah(s),d=Ah(c);l>t[0]&&(t[0]=l),u>t[1]&&(t[1]=u),d>t[2]&&(t[2]=d)}return t},i.entries=n||[],i.entryTuplesCache=y_.populatedBy(i.computeEntryTuples),i.maxByteWidthsCache=y_.populatedBy(i.computeMaxEntryByteWidths),i.indexCache=y_.populatedBy(i.computeIndex),t.set(Z.of(`Type`),Z.of(`XRef`)),i}return t.prototype.addDeletedEntry=function(e,t){var n=dy.Deleted;this.entries.push({type:n,ref:e,nextFreeObjectNumber:t}),this.entryTuplesCache.invalidate(),this.maxByteWidthsCache.invalidate(),this.indexCache.invalidate(),this.contentsCache.invalidate()},t.prototype.addUncompressedEntry=function(e,t){var n=dy.Uncompressed;this.entries.push({type:n,ref:e,offset:t}),this.entryTuplesCache.invalidate(),this.maxByteWidthsCache.invalidate(),this.indexCache.invalidate(),this.contentsCache.invalidate()},t.prototype.addCompressedEntry=function(e,t,n){var r=dy.Compressed;this.entries.push({type:r,ref:e,objectStreamRef:t,index:n}),this.entryTuplesCache.invalidate(),this.maxByteWidthsCache.invalidate(),this.indexCache.invalidate(),this.contentsCache.invalidate()},t.prototype.clone=function(e){var n=this,r=n.dict,i=n.entries,a=n.encode;return t.of(r.clone(e),i.slice(),a)},t.prototype.getContentsString=function(){for(var e=this.entryTuplesCache.access(),t=this.maxByteWidthsCache.access(),n=``,r=0,i=e.length;r<i;r++){for(var a=e[r],o=a[0],s=a[1],c=a[2],l=ih(jh(o)),u=ih(jh(s)),d=ih(jh(c)),f=t[0]-1;f>=0;f--)n+=(l[f]||0).toString(2);for(var f=t[1]-1;f>=0;f--)n+=(u[f]||0).toString(2);for(var f=t[2]-1;f>=0;f--)n+=(d[f]||0).toString(2)}return n},t.prototype.getUnencodedContents=function(){for(var e=this.entryTuplesCache.access(),t=this.maxByteWidthsCache.access(),n=new Uint8Array(this.getUnencodedContentsSize()),r=0,i=0,a=e.length;i<a;i++){for(var o=e[i],s=o[0],c=o[1],l=o[2],u=ih(jh(s)),d=ih(jh(c)),f=ih(jh(l)),p=t[0]-1;p>=0;p--)n[r++]=u[p]||0;for(var p=t[1]-1;p>=0;p--)n[r++]=d[p]||0;for(var p=t[2]-1;p>=0;p--)n[r++]=f[p]||0}return n},t.prototype.getUnencodedContentsSize=function(){var e=this.maxByteWidthsCache.access();return ah(e)*this.entries.length},t.prototype.updateDict=function(){e.prototype.updateDict.call(this);var t=this.maxByteWidthsCache.access(),n=this.indexCache.access(),r=this.dict.context;this.dict.set(Z.of(`W`),r.obj(t)),this.dict.set(Z.of(`Index`),r.obj(n))},t.create=function(e,n){n===void 0&&(n=!0);var r=new t(e,[],n);return r.addDeletedEntry(jv.of(0,65535),0),r},t.of=function(e,n,r){return r===void 0&&(r=!0),new t(e,n,r)},t}(zv)})),my,hy=s((()=>{K(),$_(),ny(),uy(),bv(),rv(),Mv(),Ev(),py(),oy(),cy(),x_(),my=function(e){G(t,e);function t(t,n,r,i){var a=e.call(this,t,n)||this;return a.encodeStreams=r,a.objectsPerStream=i,a}return t.prototype.computeBufferSize=function(){return gm(this,void 0,void 0,function(){var e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,c,l,m,d,g,_,v,y;return _m(this,function(b){switch(b.label){case 0:e=this.context.largestObjectNumber+1,t=Q_.forVersion(1,7),n=t.sizeInBytes()+2,r=fy.create(this.createTrailerDict(),this.encodeStreams),i=[],a=[],o=[],s=this.context.enumerateIndirectObjects(),c=0,l=s.length,b.label=1;case 1:return c<l?(u=s[c],d=u[0],f=u[1],p=d===this.context.trailerInfo.Encrypt||f instanceof Tv||f instanceof ly||d.generationNumber!==0,p?(i.push(u),r.addUncompressedEntry(d,n),n+=this.computeIndirectObjectSize(u),this.shouldWaitForTick(1)?[4,dh()]:[3,3]):[3,4]):[3,6];case 2:b.sent(),b.label=3;case 3:return[3,5];case 4:m=Zm(a),h=Zm(o),m&&m.length%this.objectsPerStream!==0||(m=[],a.push(m),h=jv.of(e++),o.push(h)),r.addCompressedEntry(d,h,m.length),m.push(u),b.label=5;case 5:return c++,[3,1];case 6:c=0,l=a.length,b.label=7;case 7:return c<l?(m=a[c],d=o[c],g=ay.withContextAndObjects(this.context,m,this.encodeStreams),r.addUncompressedEntry(d,n),n+=this.computeIndirectObjectSize([d,g]),i.push([d,g]),this.shouldWaitForTick(m.length)?[4,dh()]:[3,9]):[3,10];case 8:b.sent(),b.label=9;case 9:return c++,[3,7];case 10:return _=jv.of(e++),r.dict.set(Z.of(`Size`),nv.of(e)),r.addUncompressedEntry(_,n),v=n,n+=this.computeIndirectObjectSize([_,r]),i.push([_,r]),y=ty.forLastCrossRefSectionOffset(v),n+=y.sizeInBytes(),[2,{size:n,header:t,indirectObjects:i,trailer:y}]}})})},t.forContext=function(e,n,r,i){return r===void 0&&(r=!0),i===void 0&&(i=50),new t(e,n,r,i)},t}(sy)})),gy,_y=s((()=>{K(),tv(),Z_(),x_(),Y_(),gy=function(e){G(t,e);function t(t){var n=e.call(this)||this;return n.value=t,n}return t.prototype.asBytes=function(){for(var e=this.value+(this.value.length%2==1?`0`:``),t=e.length,n=new Uint8Array(e.length/2),r=0,i=0;r<t;){var a=parseInt(e.substring(r,r+2),16);n[i]=a,r+=2,i+=1}return n},t.prototype.decodeText=function(){var e=this.asBytes();return Dh(e)?bh(e):__(e)},t.prototype.decodeDate=function(){var e=this.decodeText(),t=Jm(e);if(!t)throw new j_(e);return t},t.prototype.asString=function(){return this.value},t.prototype.clone=function(){return t.of(this.value)},t.prototype.toString=function(){return`<`+this.value+`>`},t.prototype.sizeInBytes=function(){return this.value.length+2},t.prototype.copyBytesInto=function(e,t){return e[t++]=Y.LessThan,t+=Im(this.value,e,t),e[t++]=Y.GreaterThan,this.value.length+2},t.of=function(e){return new t(e)},t.fromText=function(e){for(var n=ph(e),r=``,i=0,a=n.length;i<a;i++)r+=jm(n[i],4);return new t(r)},t}(ev)})),vy,yy=s((()=>{Kg(),_y(),x_(),vy=function(){function e(e,t){this.encoding=e===Fg.ZapfDingbats?Wg.ZapfDingbats:e===Fg.Symbol?Wg.Symbol:Wg.WinAnsi,this.font=Lg.load(e),this.fontName=this.font.FontName,this.customName=t}return e.prototype.encodeText=function(e){for(var t=this.encodeTextAsGlyphs(e),n=Array(t.length),r=0,i=t.length;r<i;r++)n[r]=Mm(t[r].code);return gy.of(n.join(``))},e.prototype.widthOfTextAtSize=function(e,t){for(var n=this.encodeTextAsGlyphs(e),r=0,i=0,a=n.length;i<a;i++){var o=n[i].name,s=(n[i+1]||{}).name,c=this.font.getXAxisKerningForPair(o,s)||0;r+=this.widthOfGlyph(o)+c}var l=t/1e3;return r*l},e.prototype.heightOfFontAtSize=function(e,t){t===void 0&&(t={});var n=t.descender,r=n===void 0||n,i=this.font,a=i.Ascender,o=i.Descender,s=i.FontBBox,c=(a||s[3])-(o||s[1]);return r||(c+=o||0),c/1e3*e},e.prototype.sizeOfFontAtHeight=function(e){var t=this.font,n=t.Ascender,r=t.Descender,i=t.FontBBox,a=n||i[3],o=r||i[1];return 1e3*e/(a-o)},e.prototype.embedIntoContext=function(e,t){var n=e.obj({Type:`Font`,Subtype:`Type1`,BaseFont:this.customName||this.fontName,Encoding:this.encoding===Wg.WinAnsi?`WinAnsiEncoding`:void 0});return t?(e.assign(t,n),t):e.register(n)},e.prototype.widthOfGlyph=function(e){return this.font.getWidthOfGlyph(e)||250},e.prototype.encodeTextAsGlyphs=function(e){for(var t=Array.from(e),n=Array(t.length),r=0,i=t.length;r<i;r++){var a=Am(t[r]);n[r]=this.encoding.encodeUnicodeCodePoint(a)}return n},e.for=function(t,n){return new e(t,n)},e}()})),by,xy,Sy,Cy,wy,Ty=s((()=>{x_(),Oh(),by=function(e,t){for(var n=Array(e.length),r=0,i=e.length;r<i;r++){var a=e[r],o=Sy(Cy(t(a))),s=Sy.apply(void 0,a.codePoints.map(wy));n[r]=[o,s]}return xy(n)},xy=function(e){return`/CIDInit /ProcSet findresource begin
|
|
961
|
+
12 dict begin
|
|
962
|
+
begincmap
|
|
963
|
+
/CIDSystemInfo <<
|
|
964
|
+
/Registry (Adobe)
|
|
965
|
+
/Ordering (UCS)
|
|
966
|
+
/Supplement 0
|
|
967
|
+
>> def
|
|
968
|
+
/CMapName /Adobe-Identity-UCS def
|
|
969
|
+
/CMapType 2 def
|
|
970
|
+
1 begincodespacerange
|
|
971
|
+
<0000><ffff>
|
|
972
|
+
endcodespacerange
|
|
973
|
+
`+e.length+` beginbfchar
|
|
974
|
+
`+e.map(function(e){var t=e[0],n=e[1];return t+` `+n}).join(`
|
|
975
|
+
`)+`
|
|
976
|
+
endbfchar
|
|
977
|
+
endcmap
|
|
978
|
+
CMapName currentdict /CMap defineresource pop
|
|
979
|
+
end
|
|
980
|
+
end`},Sy=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return`<`+e.join(``)+`>`},Cy=function(e){return jm(e,4)},wy=function(e){if(mh(e))return Cy(e);if(hh(e)){var t=gh(e),n=_h(e);return``+Cy(t)+Cy(n)}var r=`0x`+Mm(e)+` is not a valid UTF-8 or UTF-16 codepoint.`;throw Error(r)}})),Ey,Dy,Oy=s((()=>{Ey=function(e){var t=0,n=function(e){t|=1<<e-1};return e.fixedPitch&&n(1),e.serif&&n(2),e.symbolic&&n(3),e.script&&n(4),e.nonsymbolic&&n(6),e.italic&&n(7),e.allCap&&n(17),e.smallCap&&n(18),e.forceBold&&n(19),t},Dy=function(e){var t=e[`OS/2`]?e[`OS/2`].sFamilyClass:0;return Ey({fixedPitch:e.post.isFixedPitch,serif:1<=t&&t<=7,symbolic:!0,script:t===10,italic:e.head.macStyle.italic})}})),ky,Ay=s((()=>{K(),tv(),Z_(),x_(),Y_(),ky=function(e){G(t,e);function t(t){var n=e.call(this)||this;return n.value=t,n}return t.prototype.asBytes=function(){for(var e=[],t=``,n=!1,r=function(t){t!==void 0&&e.push(t),n=!1},i=0,a=this.value.length;i<a;i++){var o=this.value[i],s=km(o),c=this.value[i+1];n?s===Y.Newline||s===Y.CarriageReturn?r():s===Y.n?r(Y.Newline):s===Y.r?r(Y.CarriageReturn):s===Y.t?r(Y.Tab):s===Y.b?r(Y.Backspace):s===Y.f?r(Y.FormFeed):s===Y.LeftParen?r(Y.LeftParen):s===Y.RightParen?r(Y.RightParen):s===Y.Backspace?r(Y.BackSlash):s>=Y.Zero&&s<=Y.Seven?(t+=o,t.length!==3&&c>=`0`&&c<=`7`||(r(parseInt(t,8)),t=``)):r(s):s===Y.BackSlash?n=!0:r(s)}return new Uint8Array(e)},t.prototype.decodeText=function(){var e=this.asBytes();return Dh(e)?bh(e):__(e)},t.prototype.decodeDate=function(){var e=this.decodeText(),t=Jm(e);if(!t)throw new j_(e);return t},t.prototype.asString=function(){return this.value},t.prototype.clone=function(){return t.of(this.value)},t.prototype.toString=function(){return`(`+this.value+`)`},t.prototype.sizeInBytes=function(){return this.value.length+2},t.prototype.copyBytesInto=function(e,t){return e[t++]=Y.LeftParen,t+=Im(this.value,e,t),e[t++]=Y.RightParen,this.value.length+2},t.of=function(e){return new t(e)},t.fromDate=function(e){var n=Fm(String(e.getUTCFullYear()),4,`0`),r=Fm(String(e.getUTCMonth()+1),2,`0`),i=Fm(String(e.getUTCDate()),2,`0`),a=Fm(String(e.getUTCHours()),2,`0`),o=Fm(String(e.getUTCMinutes()),2,`0`),s=Fm(String(e.getUTCSeconds()),2,`0`);return new t(`D:`+n+r+i+a+o+s+`Z`)},t}(ev)})),jy,My=s((()=>{K(),Ty(),Oy(),_y(),Ay(),x_(),jy=function(){function e(e,t,n,r){var i=this;this.allGlyphsInFontSortedById=function(){for(var e=Array(i.font.characterSet.length),t=0,n=e.length;t<n;t++){var r=i.font.characterSet[t];e[t]=i.font.glyphForCodePoint(r)}return rh(e.sort(nh),function(e){return e.id})},this.font=e,this.scale=1e3/this.font.unitsPerEm,this.fontData=t,this.fontName=this.font.postscriptName||`Font`,this.customName=n,this.fontFeatures=r,this.baseFontName=``,this.glyphCache=y_.populatedBy(this.allGlyphsInFontSortedById)}return e.for=function(t,n,r,i){return gm(this,void 0,void 0,function(){var a;return _m(this,function(o){switch(o.label){case 0:return[4,t.create(n)];case 1:return a=o.sent(),[2,new e(a,n,r,i)]}})})},e.prototype.encodeText=function(e){for(var t=this.font.layout(e,this.fontFeatures).glyphs,n=Array(t.length),r=0,i=t.length;r<i;r++)n[r]=jm(t[r].id,4);return gy.of(n.join(``))},e.prototype.widthOfTextAtSize=function(e,t){for(var n=this.font.layout(e,this.fontFeatures).glyphs,r=0,i=0,a=n.length;i<a;i++)r+=n[i].advanceWidth*this.scale;var o=t/1e3;return r*o},e.prototype.heightOfFontAtSize=function(e,t){t===void 0&&(t={});var n=t.descender,r=n===void 0||n,i=this.font,a=i.ascent,o=i.descent,s=i.bbox,c=(a||s.maxY)*this.scale-(o||s.minY)*this.scale;return r||(c-=Math.abs(o)||0),c/1e3*e},e.prototype.sizeOfFontAtHeight=function(e){var t=this.font,n=t.ascent,r=t.descent,i=t.bbox,a=(n||i.maxY)*this.scale,o=(r||i.minY)*this.scale;return 1e3*e/(a-o)},e.prototype.embedIntoContext=function(e,t){return this.baseFontName=this.customName||e.addRandomSuffix(this.fontName),this.embedFontDict(e,t)},e.prototype.embedFontDict=function(e,t){return gm(this,void 0,void 0,function(){var n,r,i;return _m(this,function(a){switch(a.label){case 0:return[4,this.embedCIDFontDict(e)];case 1:return n=a.sent(),r=this.embedUnicodeCmap(e),i=e.obj({Type:`Font`,Subtype:`Type0`,BaseFont:this.baseFontName,Encoding:`Identity-H`,DescendantFonts:[n],ToUnicode:r}),t?(e.assign(t,i),[2,t]):[2,e.register(i)]}})})},e.prototype.isCFF=function(){return this.font.cff},e.prototype.embedCIDFontDict=function(e){return gm(this,void 0,void 0,function(){var t,n;return _m(this,function(r){switch(r.label){case 0:return[4,this.embedFontDescriptor(e)];case 1:return t=r.sent(),n=e.obj({Type:`Font`,Subtype:this.isCFF()?`CIDFontType0`:`CIDFontType2`,CIDToGIDMap:`Identity`,BaseFont:this.baseFontName,CIDSystemInfo:{Registry:ky.of(`Adobe`),Ordering:ky.of(`Identity`),Supplement:0},FontDescriptor:t,W:this.computeWidths()}),[2,e.register(n)]}})})},e.prototype.embedFontDescriptor=function(e){return gm(this,void 0,void 0,function(){var t,n,r,i,a,o,s,c,l,u,d,f,p,m,h;return _m(this,function(g){switch(g.label){case 0:return[4,this.embedFontStream(e)];case 1:return t=g.sent(),n=this.scale,r=this.font,i=r.italicAngle,a=r.ascent,o=r.descent,s=r.capHeight,c=r.xHeight,l=this.font.bbox,u=l.minX,d=l.minY,f=l.maxX,p=l.maxY,m=e.obj((h={Type:`FontDescriptor`,FontName:this.baseFontName,Flags:Dy(this.font),FontBBox:[u*n,d*n,f*n,p*n],ItalicAngle:i,Ascent:a*n,Descent:o*n,CapHeight:(s||a)*n,XHeight:(c||0)*n,StemV:0},h[this.isCFF()?`FontFile3`:`FontFile2`]=t,h)),[2,e.register(m)]}})})},e.prototype.serializeFont=function(){return gm(this,void 0,void 0,function(){return _m(this,function(e){return[2,this.fontData]})})},e.prototype.embedFontStream=function(e){return gm(this,void 0,void 0,function(){var t,n,r;return _m(this,function(i){switch(i.label){case 0:return r=(n=e).flateStream,[4,this.serializeFont()];case 1:return t=r.apply(n,[i.sent(),{Subtype:this.isCFF()?`CIDFontType0C`:void 0}]),[2,e.register(t)]}})})},e.prototype.embedUnicodeCmap=function(e){var t=by(this.glyphCache.access(),this.glyphId.bind(this)),n=e.flateStream(t);return e.register(n)},e.prototype.glyphId=function(e){return e?e.id:-1},e.prototype.computeWidths=function(){for(var e=this.glyphCache.access(),t=[],n=[],r=0,i=e.length;r<i;r++){var a=e[r],o=e[r-1],s=this.glyphId(a),c=this.glyphId(o);r===0?t.push(s):s-c!==1&&(t.push(n),t.push(s),n=[]),n.push(a.advanceWidth*this.scale)}return t.push(n),t},e}()})),Ny,Py=s((()=>{K(),My(),_y(),x_(),Ny=function(e){G(t,e);function t(t,n,r,i){var a=e.call(this,t,n,r,i)||this;return a.subset=a.font.createSubset(),a.glyphs=[],a.glyphCache=y_.populatedBy(function(){return a.glyphs}),a.glyphIdMap=new Map,a}return t.for=function(e,n,r,i){return gm(this,void 0,void 0,function(){var a;return _m(this,function(o){switch(o.label){case 0:return[4,e.create(n)];case 1:return a=o.sent(),[2,new t(a,n,r,i)]}})})},t.prototype.encodeText=function(e){for(var t=this.font.layout(e,this.fontFeatures).glyphs,n=Array(t.length),r=0,i=t.length;r<i;r++){var a=t[r],o=this.subset.includeGlyph(a);this.glyphs[o-1]=a,this.glyphIdMap.set(a.id,o),n[r]=jm(o,4)}return this.glyphCache.invalidate(),gy.of(n.join(``))},t.prototype.isCFF=function(){return this.subset.cff},t.prototype.glyphId=function(e){return e?this.glyphIdMap.get(e.id):-1},t.prototype.serializeFont=function(){var e=this;return new Promise(function(t,n){var r=[];e.subset.encodeStream().on(`data`,function(e){return r.push(e)}).on(`end`,function(){return t(eh(r))}).on(`error`,function(e){return n(e)})})},t}(jy)})),Fy,Iy,Ly=s((()=>{K(),Ay(),_y(),(function(e){e.Source=`Source`,e.Data=`Data`,e.Alternative=`Alternative`,e.Supplement=`Supplement`,e.EncryptedPayload=`EncryptedPayload`,e.FormData=`EncryptedPayload`,e.Schema=`Schema`,e.Unspecified=`Unspecified`})(Fy||={}),Iy=function(){function e(e,t,n){n===void 0&&(n={}),this.fileData=e,this.fileName=t,this.options=n}return e.for=function(t,n,r){return r===void 0&&(r={}),new e(t,n,r)},e.prototype.embedIntoContext=function(e,t){return gm(this,void 0,void 0,function(){var n,r,i,a,o,s,c,l,u;return _m(this,function(d){return n=this.options,r=n.mimeType,i=n.description,a=n.creationDate,o=n.modificationDate,s=n.afRelationship,c=e.flateStream(this.fileData,{Type:`EmbeddedFile`,Subtype:r??void 0,Params:{Size:this.fileData.length,CreationDate:a?ky.fromDate(a):void 0,ModDate:o?ky.fromDate(o):void 0}}),l=e.register(c),u=e.obj({Type:`Filespec`,F:ky.of(this.fileName),UF:gy.fromText(this.fileName),EF:{F:l},Desc:i?gy.fromText(i):void 0,AFRelationship:s??void 0}),t?(e.assign(t,u),[2,t]):[2,e.register(u)]})})},e}()})),Ry,zy,By,Vy,Hy=s((()=>{K(),Ry=[65472,65473,65474,65475,65477,65478,65479,65480,65481,65482,65483,65484,65485,65486,65487],(function(e){e.DeviceGray=`DeviceGray`,e.DeviceRGB=`DeviceRGB`,e.DeviceCMYK=`DeviceCMYK`})(zy||={}),By={1:zy.DeviceGray,3:zy.DeviceRGB,4:zy.DeviceCMYK},Vy=function(){function e(e,t,n,r,i){this.imageData=e,this.bitsPerComponent=t,this.width=n,this.height=r,this.colorSpace=i}return e.for=function(t){return gm(this,void 0,void 0,function(){var n,r,i,a,o,s,c,l,u,d;return _m(this,function(f){if(n=new DataView(t.buffer),r=n.getUint16(0),r!==65496)throw Error(`SOI not found in JPEG`);for(i=2;i<n.byteLength&&(a=n.getUint16(i),i+=2,!Ry.includes(a));)i+=n.getUint16(i);if(!Ry.includes(a))throw Error(`Invalid JPEG`);if(i+=2,o=n.getUint8(i++),s=n.getUint16(i),i+=2,c=n.getUint16(i),i+=2,l=n.getUint8(i++),u=By[l],!u)throw Error(`Unknown JPEG channel.`);return d=u,[2,new e(t,o,c,s,d)]})})},e.prototype.embedIntoContext=function(e,t){return gm(this,void 0,void 0,function(){var n;return _m(this,function(r){return n=e.stream(this.imageData,{Type:`XObject`,Subtype:`Image`,BitsPerComponent:this.bitsPerComponent,Width:this.width,Height:this.height,ColorSpace:this.colorSpace,Filter:`DCTDecode`,Decode:this.colorSpace===zy.DeviceCMYK?[1,0,1,0,1,0,1,0]:void 0}),t?(e.assign(t,n),[2,t]):[2,e.register(n)]})})},e}()})),Uy,$,Wy=s((()=>{Uy=d(Xh()),$={},$.toRGBA8=function(e){var t=e.width,n=e.height;if(e.tabs.acTL==null)return[$.toRGBA8.decodeImage(e.data,t,n,e).buffer];var r=[];e.frames[0].data??(e.frames[0].data=e.data);for(var i=t*n*4,a=new Uint8Array(i),o=new Uint8Array(i),s=new Uint8Array(i),c=0;c<e.frames.length;c++){var l=e.frames[c],u=l.rect.x,d=l.rect.y,f=l.rect.width,p=l.rect.height,m=$.toRGBA8.decodeImage(l.data,f,p,e);if(c!=0)for(var h=0;h<i;h++)s[h]=a[h];if(l.blend==0?$._copyTile(m,f,p,a,t,n,u,d,0):l.blend==1&&$._copyTile(m,f,p,a,t,n,u,d,1),r.push(a.buffer.slice(0)),l.dispose!=0){if(l.dispose==1)$._copyTile(o,f,p,a,t,n,u,d,0);else if(l.dispose==2)for(var h=0;h<i;h++)a[h]=s[h]}}return r},$.toRGBA8.decodeImage=function(e,t,n,r){var i=t*n,a=$.decode._getBPP(r),o=Math.ceil(t*a/8),s=new Uint8Array(i*4),c=new Uint32Array(s.buffer),l=r.ctype,u=r.depth,d=$._bin.readUshort;if(l==6){var f=i<<2;if(u==8)for(var p=0;p<f;p+=4)s[p]=e[p],s[p+1]=e[p+1],s[p+2]=e[p+2],s[p+3]=e[p+3];if(u==16)for(var p=0;p<f;p++)s[p]=e[p<<1]}else if(l==2){var m=r.tabs.tRNS;if(m==null){if(u==8)for(var p=0;p<i;p++){var h=p*3;c[p]=255<<24|e[h+2]<<16|e[h+1]<<8|e[h]}if(u==16)for(var p=0;p<i;p++){var h=p*6;c[p]=255<<24|e[h+4]<<16|e[h+2]<<8|e[h]}}else{var g=m[0],_=m[1],v=m[2];if(u==8)for(var p=0;p<i;p++){var y=p<<2,h=p*3;c[p]=255<<24|e[h+2]<<16|e[h+1]<<8|e[h],e[h]==g&&e[h+1]==_&&e[h+2]==v&&(s[y+3]=0)}if(u==16)for(var p=0;p<i;p++){var y=p<<2,h=p*6;c[p]=255<<24|e[h+4]<<16|e[h+2]<<8|e[h],d(e,h)==g&&d(e,h+2)==_&&d(e,h+4)==v&&(s[y+3]=0)}}}else if(l==3){var b=r.tabs.PLTE,x=r.tabs.tRNS,S=x?x.length:0;if(u==1)for(var C=0;C<n;C++)for(var w=C*o,T=C*t,p=0;p<t;p++){var y=T+p<<2,E=e[w+(p>>3)]>>7-(p&7)&1,D=3*E;s[y]=b[D],s[y+1]=b[D+1],s[y+2]=b[D+2],s[y+3]=E<S?x[E]:255}if(u==2)for(var C=0;C<n;C++)for(var w=C*o,T=C*t,p=0;p<t;p++){var y=T+p<<2,E=e[w+(p>>2)]>>6-((p&3)<<1)&3,D=3*E;s[y]=b[D],s[y+1]=b[D+1],s[y+2]=b[D+2],s[y+3]=E<S?x[E]:255}if(u==4)for(var C=0;C<n;C++)for(var w=C*o,T=C*t,p=0;p<t;p++){var y=T+p<<2,E=e[w+(p>>1)]>>4-((p&1)<<2)&15,D=3*E;s[y]=b[D],s[y+1]=b[D+1],s[y+2]=b[D+2],s[y+3]=E<S?x[E]:255}if(u==8)for(var p=0;p<i;p++){var y=p<<2,E=e[p],D=3*E;s[y]=b[D],s[y+1]=b[D+1],s[y+2]=b[D+2],s[y+3]=E<S?x[E]:255}}else if(l==4){if(u==8)for(var p=0;p<i;p++){var y=p<<2,O=p<<1,k=e[O];s[y]=k,s[y+1]=k,s[y+2]=k,s[y+3]=e[O+1]}if(u==16)for(var p=0;p<i;p++){var y=p<<2,O=p<<2,k=e[O];s[y]=k,s[y+1]=k,s[y+2]=k,s[y+3]=e[O+2]}}else if(l==0)for(var g=r.tabs.tRNS?r.tabs.tRNS:-1,C=0;C<n;C++){var A=C*o,j=C*t;if(u==1)for(var M=0;M<t;M++){var k=255*(e[A+(M>>>3)]>>>7-(M&7)&1),N=k==g*255?0:255;c[j+M]=N<<24|k<<16|k<<8|k}else if(u==2)for(var M=0;M<t;M++){var k=85*(e[A+(M>>>2)]>>>6-((M&3)<<1)&3),N=k==g*85?0:255;c[j+M]=N<<24|k<<16|k<<8|k}else if(u==4)for(var M=0;M<t;M++){var k=17*(e[A+(M>>>1)]>>>4-((M&1)<<2)&15),N=k==g*17?0:255;c[j+M]=N<<24|k<<16|k<<8|k}else if(u==8)for(var M=0;M<t;M++){var k=e[A+M],N=k==g?0:255;c[j+M]=N<<24|k<<16|k<<8|k}else if(u==16)for(var M=0;M<t;M++){var k=e[A+(M<<1)],N=d(e,A+(M<<p))==g?0:255;c[j+M]=N<<24|k<<16|k<<8|k}}return s},$.decode=function(e){for(var t=new Uint8Array(e),n=8,r=$._bin,i=r.readUshort,a=r.readUint,o={tabs:{},frames:[]},s=new Uint8Array(t.length),c=0,l,u=0,d=[137,80,78,71,13,10,26,10],f=0;f<8;f++)if(t[f]!=d[f])throw`The input is not a PNG file!`;for(;n<t.length;){var p=r.readUint(t,n);n+=4;var m=r.readASCII(t,n,4);if(n+=4,m==`IHDR`)$.decode._IHDR(t,n,o);else if(m==`IDAT`){for(var f=0;f<p;f++)s[c+f]=t[n+f];c+=p}else if(m==`acTL`)o.tabs[m]={num_frames:a(t,n),num_plays:a(t,n+4)},l=new Uint8Array(t.length);else if(m==`fcTL`){if(u!=0){var h=o.frames[o.frames.length-1];h.data=$.decode._decompress(o,l.slice(0,u),h.rect.width,h.rect.height),u=0}var g={x:a(t,n+12),y:a(t,n+16),width:a(t,n+4),height:a(t,n+8)},_=i(t,n+22);_=i(t,n+20)/(_==0?100:_);var v={rect:g,delay:Math.round(_*1e3),dispose:t[n+24],blend:t[n+25]};o.frames.push(v)}else if(m==`fdAT`){for(var f=0;f<p-4;f++)l[u+f]=t[n+f+4];u+=p-4}else if(m==`pHYs`)o.tabs[m]=[r.readUint(t,n),r.readUint(t,n+4),t[n+8]];else if(m==`cHRM`){o.tabs[m]=[];for(var f=0;f<8;f++)o.tabs[m].push(r.readUint(t,n+f*4))}else if(m==`tEXt`){o.tabs[m]??(o.tabs[m]={});var y=r.nextZero(t,n),b=r.readASCII(t,n,y-n),x=r.readASCII(t,y+1,n+p-y-1);o.tabs[m][b]=x}else if(m==`iTXt`){o.tabs[m]??(o.tabs[m]={});var y=0,S=n;y=r.nextZero(t,S);var b=r.readASCII(t,S,y-S);S=y+1,t[S],t[S+1],S+=2,y=r.nextZero(t,S),r.readASCII(t,S,y-S),S=y+1,y=r.nextZero(t,S),r.readUTF8(t,S,y-S),S=y+1;var x=r.readUTF8(t,S,p-(S-n));o.tabs[m][b]=x}else if(m==`PLTE`)o.tabs[m]=r.readBytes(t,n,p);else if(m==`hIST`){var C=o.tabs.PLTE.length/3;o.tabs[m]=[];for(var f=0;f<C;f++)o.tabs[m].push(i(t,n+f*2))}else if(m==`tRNS`)o.ctype==3?o.tabs[m]=r.readBytes(t,n,p):o.ctype==0?o.tabs[m]=i(t,n):o.ctype==2&&(o.tabs[m]=[i(t,n),i(t,n+2),i(t,n+4)]);else if(m==`gAMA`)o.tabs[m]=r.readUint(t,n)/1e5;else if(m==`sRGB`)o.tabs[m]=t[n];else if(m==`bKGD`)o.ctype==0||o.ctype==4?o.tabs[m]=[i(t,n)]:o.ctype==2||o.ctype==6?o.tabs[m]=[i(t,n),i(t,n+2),i(t,n+4)]:o.ctype==3&&(o.tabs[m]=t[n]);else if(m==`IEND`)break;n+=p,r.readUint(t,n),n+=4}if(u!=0){var h=o.frames[o.frames.length-1];h.data=$.decode._decompress(o,l.slice(0,u),h.rect.width,h.rect.height),u=0}return o.data=$.decode._decompress(o,s,o.width,o.height),delete o.compress,delete o.interlace,delete o.filter,o},$.decode._decompress=function(e,t,n,r){var i=$.decode._getBPP(e),a=Math.ceil(n*i/8),o=new Uint8Array((a+1+e.interlace)*r);return t=$.decode._inflate(t,o),e.interlace==0?t=$.decode._filterZero(t,e,0,n,r):e.interlace==1&&(t=$.decode._readInterlace(t,e)),t},$.decode._inflate=function(e,t){return $.inflateRaw(new Uint8Array(e.buffer,2,e.length-6),t)},$.inflateRaw=function(){var e={};return e.H={},e.H.N=function(t,n){var r=Uint8Array,i=0,a=0,o=0,s=0,c=0,l=0,u=0,d=0,f=0,p,m;if(t[0]==3&&t[1]==0)return n||new r(0);var h=e.H,g=h.b,_=h.e,v=h.R,y=h.n,b=h.A,x=h.Z,S=h.m,C=n==null;for(C&&(n=new r(t.length>>>2<<3));i==0;)if(i=g(t,f,1),a=g(t,f+1,2),f+=3,a==0){f&7&&(f+=8-(f&7));var w=(f>>>3)+4,T=t[w-4]|t[w-3]<<8;C&&(n=e.H.W(n,d+T)),n.set(new r(t.buffer,t.byteOffset+w,T),d),f=w+T<<3,d+=T}else{if(C&&(n=e.H.W(n,d+(1<<17))),a==1&&(p=S.J,m=S.h,l=511,u=31),a==2){o=_(t,f,5)+257,s=_(t,f+5,5)+1,c=_(t,f+10,4)+4,f+=14;for(var E=1,D=0;D<38;D+=2)S.Q[D]=0,S.Q[D+1]=0;for(var D=0;D<c;D++){var O=_(t,f+D*3,3);S.Q[(S.X[D]<<1)+1]=O,O>E&&(E=O)}f+=3*c,y(S.Q,E),b(S.Q,E,S.u),p=S.w,m=S.d,f=v(S.u,(1<<E)-1,o+s,t,f,S.v);var k=h.V(S.v,0,o,S.C);l=(1<<k)-1;var A=h.V(S.v,o,s,S.D);u=(1<<A)-1,y(S.C,k),b(S.C,k,p),y(S.D,A),b(S.D,A,m)}for(;;){var j=p[x(t,f)&l];f+=j&15;var M=j>>>4;if(!(M>>>8))n[d++]=M;else if(M==256)break;else{var N=d+M-254;if(M>264){var P=S.q[M-257];N=d+(P>>>3)+_(t,f,P&7),f+=P&7}var ee=m[x(t,f)&u];f+=ee&15;var te=ee>>>4,ne=S.c[te],re=(ne>>>4)+g(t,f,ne&15);for(f+=ne&15;d<N;)n[d]=n[d++-re],n[d]=n[d++-re],n[d]=n[d++-re],n[d]=n[d++-re];d=N}}}return n.length==d?n:n.slice(0,d)},e.H.W=function(e,t){var n=e.length;if(t<=n)return e;var r=new Uint8Array(n<<1);return r.set(e,0),r},e.H.R=function(t,n,r,i,a,o){for(var s=e.H.e,c=e.H.Z,l=0;l<r;){var u=t[c(i,a)&n];a+=u&15;var d=u>>>4;if(d<=15)o[l]=d,l++;else{var f=0,p=0;d==16?(p=3+s(i,a,2),a+=2,f=o[l-1]):d==17?(p=3+s(i,a,3),a+=3):d==18&&(p=11+s(i,a,7),a+=7);for(var m=l+p;l<m;)o[l]=f,l++}}return a},e.H.V=function(e,t,n,r){for(var i=0,a=0,o=r.length>>>1;a<n;){var s=e[a+t];r[a<<1]=0,r[(a<<1)+1]=s,s>i&&(i=s),a++}for(;a<o;)r[a<<1]=0,r[(a<<1)+1]=0,a++;return i},e.H.n=function(t,n){for(var r=e.H.m,i=t.length,a,o,s,c,l,u=r.j,c=0;c<=n;c++)u[c]=0;for(c=1;c<i;c+=2)u[t[c]]++;var d=r.K;for(a=0,u[0]=0,o=1;o<=n;o++)a=a+u[o-1]<<1,d[o]=a;for(s=0;s<i;s+=2)l=t[s+1],l!=0&&(t[s]=d[l],d[l]++)},e.H.A=function(t,n,r){for(var i=t.length,a=e.H.m.r,o=0;o<i;o+=2)if(t[o+1]!=0)for(var s=o>>1,c=t[o+1],l=s<<4|c,u=n-c,d=t[o]<<u,f=d+(1<<u);d!=f;){var p=a[d]>>>15-n;r[p]=l,d++}},e.H.l=function(t,n){for(var r=e.H.m.r,i=15-n,a=0;a<t.length;a+=2){var o=t[a]<<n-t[a+1];t[a]=r[o]>>>i}},e.H.M=function(e,t,n){n<<=t&7;var r=t>>>3;e[r]|=n,e[r+1]|=n>>>8},e.H.I=function(e,t,n){n<<=t&7;var r=t>>>3;e[r]|=n,e[r+1]|=n>>>8,e[r+2]|=n>>>16},e.H.e=function(e,t,n){return(e[t>>>3]|e[(t>>>3)+1]<<8)>>>(t&7)&(1<<n)-1},e.H.b=function(e,t,n){return(e[t>>>3]|e[(t>>>3)+1]<<8|e[(t>>>3)+2]<<16)>>>(t&7)&(1<<n)-1},e.H.Z=function(e,t){return(e[t>>>3]|e[(t>>>3)+1]<<8|e[(t>>>3)+2]<<16)>>>(t&7)},e.H.i=function(e,t){return(e[t>>>3]|e[(t>>>3)+1]<<8|e[(t>>>3)+2]<<16|e[(t>>>3)+3]<<24)>>>(t&7)},e.H.m=function(){var e=Uint16Array,t=Uint32Array;return{K:new e(16),j:new e(16),X:[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],S:[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,999,999,999],T:[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0],q:new e(32),p:[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,65535,65535],z:[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0],c:new t(32),J:new e(512),_:[],h:new e(32),$:[],w:new e(32768),C:[],v:[],d:new e(32768),D:[],u:new e(512),Q:[],r:new e(32768),s:new t(286),Y:new t(30),a:new t(19),t:new t(15e3),k:new e(65536),g:new e(32768)}}(),(function(){for(var t=e.H.m,n=32768,r=0;r<n;r++){var i=r;i=(i&2863311530)>>>1|(i&1431655765)<<1,i=(i&3435973836)>>>2|(i&858993459)<<2,i=(i&4042322160)>>>4|(i&252645135)<<4,i=(i&4278255360)>>>8|(i&16711935)<<8,t.r[r]=(i>>>16|i<<16)>>>17}function a(e,t,n){for(;t--!=0;)e.push(0,n)}for(var r=0;r<32;r++)t.q[r]=t.S[r]<<3|t.T[r],t.c[r]=t.p[r]<<4|t.z[r];a(t._,144,8),a(t._,112,9),a(t._,24,7),a(t._,8,8),e.H.n(t._,9),e.H.A(t._,9,t.J),e.H.l(t._,9),a(t.$,32,5),e.H.n(t.$,5),e.H.A(t.$,5,t.h),e.H.l(t.$,5),a(t.Q,19,0),a(t.C,286,0),a(t.D,30,0),a(t.v,320,0)})(),e.H.N}(),$.decode._readInterlace=function(e,t){for(var n=t.width,r=t.height,i=$.decode._getBPP(t),a=i>>3,o=Math.ceil(n*i/8),s=new Uint8Array(r*o),c=0,l=[0,0,4,0,2,0,1],u=[0,4,0,2,0,1,0],d=[8,8,8,4,4,2,2],f=[8,8,4,4,2,2,1],p=0;p<7;){for(var m=d[p],h=f[p],g=0,_=0,v=l[p];v<r;)v+=m,_++;for(var y=u[p];y<n;)y+=h,g++;var b=Math.ceil(g*i/8);$.decode._filterZero(e,t,c,g,_);for(var x=0,S=l[p];S<r;){for(var C=u[p],w=c+x*b<<3;C<n;){if(i==1){var T=e[w>>3];T=T>>7-(w&7)&1,s[S*o+(C>>3)]|=T<<7-(C&7)}if(i==2){var T=e[w>>3];T=T>>6-(w&7)&3,s[S*o+(C>>2)]|=T<<6-((C&3)<<1)}if(i==4){var T=e[w>>3];T=T>>4-(w&7)&15,s[S*o+(C>>1)]|=T<<4-((C&1)<<2)}if(i>=8)for(var E=S*o+C*a,D=0;D<a;D++)s[E+D]=e[(w>>3)+D];w+=i,C+=h}x++,S+=m}g*_!=0&&(c+=_*(1+b)),p+=1}return s},$.decode._getBPP=function(e){return[1,null,3,1,2,null,4][e.ctype]*e.depth},$.decode._filterZero=function(e,t,n,r,i){var a=$.decode._getBPP(t),o=Math.ceil(r*a/8),s=$.decode._paeth;a=Math.ceil(a/8);var c=0,l=1,u=e[n],d=0;if(u>1&&(e[n]=[0,0,1][u-2]),u==3)for(d=a;d<o;d++)e[d+1]=e[d+1]+(e[d+1-a]>>>1)&255;for(var f=0;f<i;f++)if(c=n+f*o,l=c+f+1,u=e[l-1],d=0,u==0)for(;d<o;d++)e[c+d]=e[l+d];else if(u==1){for(;d<a;d++)e[c+d]=e[l+d];for(;d<o;d++)e[c+d]=e[l+d]+e[c+d-a]}else if(u==2)for(;d<o;d++)e[c+d]=e[l+d]+e[c+d-o];else if(u==3){for(;d<a;d++)e[c+d]=e[l+d]+(e[c+d-o]>>>1);for(;d<o;d++)e[c+d]=e[l+d]+(e[c+d-o]+e[c+d-a]>>>1)}else{for(;d<a;d++)e[c+d]=e[l+d]+s(0,e[c+d-o],0);for(;d<o;d++)e[c+d]=e[l+d]+s(e[c+d-a],e[c+d-o],e[c+d-a-o])}return e},$.decode._paeth=function(e,t,n){var r=e+t-n,i=r-e,a=r-t,o=r-n;return i*i<=a*a&&i*i<=o*o?e:a*a<=o*o?t:n},$.decode._IHDR=function(e,t,n){var r=$._bin;n.width=r.readUint(e,t),t+=4,n.height=r.readUint(e,t),t+=4,n.depth=e[t],t++,n.ctype=e[t],t++,n.compress=e[t],t++,n.filter=e[t],t++,n.interlace=e[t],t++},$._bin={nextZero:function(e,t){for(;e[t]!=0;)t++;return t},readUshort:function(e,t){return e[t]<<8|e[t+1]},writeUshort:function(e,t,n){e[t]=n>>8&255,e[t+1]=n&255},readUint:function(e,t){return e[t]*16777216+(e[t+1]<<16|e[t+2]<<8|e[t+3])},writeUint:function(e,t,n){e[t]=n>>24&255,e[t+1]=n>>16&255,e[t+2]=n>>8&255,e[t+3]=n&255},readASCII:function(e,t,n){for(var r=``,i=0;i<n;i++)r+=String.fromCharCode(e[t+i]);return r},writeASCII:function(e,t,n){for(var r=0;r<n.length;r++)e[t+r]=n.charCodeAt(r)},readBytes:function(e,t,n){for(var r=[],i=0;i<n;i++)r.push(e[t+i]);return r},pad:function(e){return e.length<2?`0`+e:e},readUTF8:function(e,t,n){for(var r=``,i,a=0;a<n;a++)r+=`%`+$._bin.pad(e[t+a].toString(16));try{i=decodeURIComponent(r)}catch{return $._bin.readASCII(e,t,n)}return i}},$._copyTile=function(e,t,n,r,i,a,o,s,c){for(var l=Math.min(t,i),u=Math.min(n,a),d=0,f=0,p=0;p<u;p++)for(var m=0;m<l;m++)if(o>=0&&s>=0?(d=p*t+m<<2,f=(s+p)*i+o+m<<2):(d=(-s+p)*t-o+m<<2,f=p*i+m<<2),c==0)r[f]=e[d],r[f+1]=e[d+1],r[f+2]=e[d+2],r[f+3]=e[d+3];else if(c==1){var h=e[d+3]*(1/255),g=e[d]*h,_=e[d+1]*h,v=e[d+2]*h,y=r[f+3]*(1/255),b=r[f]*y,x=r[f+1]*y,S=r[f+2]*y,C=1-h,w=h+y*C,T=w==0?0:1/w;r[f+3]=255*w,r[f+0]=(g+b*C)*T,r[f+1]=(_+x*C)*T,r[f+2]=(v+S*C)*T}else if(c==2){var h=e[d+3],g=e[d],_=e[d+1],v=e[d+2],y=r[f+3],b=r[f],x=r[f+1],S=r[f+2];h==y&&g==b&&_==x&&v==S?(r[f]=0,r[f+1]=0,r[f+2]=0,r[f+3]=0):(r[f]=g,r[f+1]=_,r[f+2]=v,r[f+3]=h)}else if(c==3){var h=e[d+3],g=e[d],_=e[d+1],v=e[d+2],y=r[f+3],b=r[f],x=r[f+1],S=r[f+2];if(h==y&&g==b&&_==x&&v==S)continue;if(h<220&&y>20)return!1}return!0},$.encode=function(e,t,n,r,i,a,o){r??=0,o??=!1;var s=$.encode.compress(e,t,n,r,[!1,!1,!1,0,o]);return $.encode.compressPNG(s,-1),$.encode._main(s,t,n,i,a)},$.encodeLL=function(e,t,n,r,i,a,o,s){for(var c={ctype:0+(r==1?0:2)+(i==0?0:4),depth:a,frames:[]},l=(r+i)*a,u=l*t,d=0;d<e.length;d++)c.frames.push({rect:{x:0,y:0,width:t,height:n},img:new Uint8Array(e[d]),blend:0,dispose:1,bpp:Math.ceil(l/8),bpl:Math.ceil(u/8)});return $.encode.compressPNG(c,0,!0),$.encode._main(c,t,n,o,s)},$.encode._main=function(e,t,n,r,i){i??={};var a=$.crc.crc,o=$._bin.writeUint,s=$._bin.writeUshort,c=$._bin.writeASCII,l=8,u=e.frames.length>1,d=!1,f=33+(u?20:0);if(i.sRGB!=null&&(f+=13),i.pHYs!=null&&(f+=21),e.ctype==3){for(var p=e.plte.length,m=0;m<p;m++)e.plte[m]>>>24!=255&&(d=!0);f+=8+p*3+4+(d?8+p*1+4:0)}for(var h=0;h<e.frames.length;h++){var g=e.frames[h];u&&(f+=38),f+=g.cimg.length+12,h!=0&&(f+=4)}f+=12;for(var _=new Uint8Array(f),v=[137,80,78,71,13,10,26,10],m=0;m<8;m++)_[m]=v[m];if(o(_,l,13),l+=4,c(_,l,`IHDR`),l+=4,o(_,l,t),l+=4,o(_,l,n),l+=4,_[l]=e.depth,l++,_[l]=e.ctype,l++,_[l]=0,l++,_[l]=0,l++,_[l]=0,l++,o(_,l,a(_,l-17,17)),l+=4,i.sRGB!=null&&(o(_,l,1),l+=4,c(_,l,`sRGB`),l+=4,_[l]=i.sRGB,l++,o(_,l,a(_,l-5,5)),l+=4),i.pHYs!=null&&(o(_,l,9),l+=4,c(_,l,`pHYs`),l+=4,o(_,l,i.pHYs[0]),l+=4,o(_,l,i.pHYs[1]),l+=4,_[l]=i.pHYs[2],l++,o(_,l,a(_,l-13,13)),l+=4),u&&(o(_,l,8),l+=4,c(_,l,`acTL`),l+=4,o(_,l,e.frames.length),l+=4,o(_,l,i.loop==null?0:i.loop),l+=4,o(_,l,a(_,l-12,12)),l+=4),e.ctype==3){var p=e.plte.length;o(_,l,p*3),l+=4,c(_,l,`PLTE`),l+=4;for(var m=0;m<p;m++){var y=m*3,b=e.plte[m],x=b&255,S=b>>>8&255,C=b>>>16&255;_[l+y+0]=x,_[l+y+1]=S,_[l+y+2]=C}if(l+=p*3,o(_,l,a(_,l-p*3-4,p*3+4)),l+=4,d){o(_,l,p),l+=4,c(_,l,`tRNS`),l+=4;for(var m=0;m<p;m++)_[l+m]=e.plte[m]>>>24&255;l+=p,o(_,l,a(_,l-p-4,p+4)),l+=4}}for(var w=0,h=0;h<e.frames.length;h++){var g=e.frames[h];u&&(o(_,l,26),l+=4,c(_,l,`fcTL`),l+=4,o(_,l,w++),l+=4,o(_,l,g.rect.width),l+=4,o(_,l,g.rect.height),l+=4,o(_,l,g.rect.x),l+=4,o(_,l,g.rect.y),l+=4,s(_,l,r[h]),l+=2,s(_,l,1e3),l+=2,_[l]=g.dispose,l++,_[l]=g.blend,l++,o(_,l,a(_,l-30,30)),l+=4);var T=g.cimg,p=T.length;o(_,l,p+(h==0?0:4)),l+=4;var E=l;c(_,l,h==0?`IDAT`:`fdAT`),l+=4,h!=0&&(o(_,l,w++),l+=4),_.set(T,l),l+=p,o(_,l,a(_,E,l-E)),l+=4}return o(_,l,0),l+=4,c(_,l,`IEND`),l+=4,o(_,l,a(_,l-4,4)),l+=4,_.buffer},$.encode.compressPNG=function(e,t,n){for(var r=0;r<e.frames.length;r++){var i=e.frames[r];i.rect.width;var a=i.rect.height,o=new Uint8Array(a*i.bpl+a);i.cimg=$.encode._filterZero(i.img,a,i.bpp,i.bpl,o,t,n)}},$.encode.compress=function(e,t,n,r,i){for(var a=i[0],o=i[1],s=i[2],c=i[3],l=i[4],u=6,d=8,f=255,p=0;p<e.length;p++)for(var m=new Uint8Array(e[p]),h=m.length,g=0;g<h;g+=4)f&=m[g+3];var _=f!=255,v=$.encode.framize(e,t,n,a,o,s),y={},b=[],x=[];if(r!=0){for(var S=[],g=0;g<v.length;g++)S.push(v[g].img.buffer);for(var C=$.encode.concatRGBA(S),w=$.quantize(C,r),T=0,E=new Uint8Array(w.abuf),g=0;g<v.length;g++){var D=v[g].img,O=D.length;x.push(new Uint8Array(w.inds.buffer,T>>2,O>>2));for(var p=0;p<O;p+=4)D[p]=E[T+p],D[p+1]=E[T+p+1],D[p+2]=E[T+p+2],D[p+3]=E[T+p+3];T+=O}for(var g=0;g<w.plte.length;g++)b.push(w.plte[g].est.rgba)}else for(var p=0;p<v.length;p++){var k=v[p],A=new Uint32Array(k.img.buffer),j=k.rect.width,h=A.length,M=new Uint8Array(h);x.push(M);for(var g=0;g<h;g++){var N=A[g];if(g!=0&&N==A[g-1])M[g]=M[g-1];else if(g>j&&N==A[g-j])M[g]=M[g-j];else{var P=y[N];if(P==null&&(y[N]=P=b.length,b.push(N),b.length>=300))break;M[g]=P}}}var ee=b.length;ee<=256&&l==0&&(d=ee<=2?1:ee<=4?2:ee<=16?4:8,d=Math.max(d,c));for(var p=0;p<v.length;p++){var k=v[p];k.rect.x,k.rect.y;var j=k.rect.width,te=k.rect.height,ne=k.img;new Uint32Array(ne.buffer);var re=4*j,ie=4;if(ee<=256&&l==0){re=Math.ceil(d*j/8);for(var ae=new Uint8Array(re*te),oe=x[p],se=0;se<te;se++){var g=se*re,F=se*j;if(d==8)for(var ce=0;ce<j;ce++)ae[g+ce]=oe[F+ce];else if(d==4)for(var ce=0;ce<j;ce++)ae[g+(ce>>1)]|=oe[F+ce]<<4-(ce&1)*4;else if(d==2)for(var ce=0;ce<j;ce++)ae[g+(ce>>2)]|=oe[F+ce]<<6-(ce&3)*2;else if(d==1)for(var ce=0;ce<j;ce++)ae[g+(ce>>3)]|=oe[F+ce]<<7-(ce&7)*1}ne=ae,u=3,ie=1}else if(_==0&&v.length==1){for(var ae=new Uint8Array(j*te*3),le=j*te,g=0;g<le;g++){var D=g*3,ue=g*4;ae[D]=ne[ue],ae[D+1]=ne[ue+1],ae[D+2]=ne[ue+2]}ne=ae,u=2,ie=3,re=3*j}k.img=ne,k.bpl=re,k.bpp=ie}return{ctype:u,depth:d,plte:b,frames:v}},$.encode.framize=function(e,t,n,r,i,a){for(var o=[],s=0;s<e.length;s++){var c=new Uint8Array(e[s]),l=new Uint32Array(c.buffer),u,d=0,f=0,p=t,m=n,h=+!!r;if(s!=0){for(var g=a||r||s==1||o[s-2].dispose!=0?1:2,_=0,v=1e9,y=0;y<g;y++){for(var b=new Uint8Array(e[s-1-y]),x=new Uint32Array(e[s-1-y]),S=t,C=n,w=-1,T=-1,E=0;E<n;E++)for(var D=0;D<t;D++){var O=E*t+D;l[O]!=x[O]&&(D<S&&(S=D),D>w&&(w=D),E<C&&(C=E),E>T&&(T=E))}w==-1&&(S=C=w=T=0),i&&((S&1)==1&&S--,(C&1)==1&&C--);var k=(w-S+1)*(T-C+1);k<v&&(v=k,_=y,d=S,f=C,p=w-S+1,m=T-C+1)}var b=new Uint8Array(e[s-1-_]);_==1&&(o[s-1].dispose=2),u=new Uint8Array(p*m*4),$._copyTile(b,t,n,u,p,m,-d,-f,0),h=+!!$._copyTile(c,t,n,u,p,m,-d,-f,3),h==1?$.encode._prepareDiff(c,t,n,u,{x:d,y:f,width:p,height:m}):$._copyTile(c,t,n,u,p,m,-d,-f,0)}else u=c.slice(0);o.push({rect:{x:d,y:f,width:p,height:m},img:u,blend:h,dispose:0})}if(r)for(var s=0;s<o.length;s++){var A=o[s];if(A.blend!=1){var j=A.rect,M=o[s-1].rect,N=Math.min(j.x,M.x),P=Math.min(j.y,M.y),ee=Math.max(j.x+j.width,M.x+M.width),te=Math.max(j.y+j.height,M.y+M.height),ne={x:N,y:P,width:ee-N,height:te-P};o[s-1].dispose=1,s-1!=0&&$.encode._updateFrame(e,t,n,o,s-1,ne,i),$.encode._updateFrame(e,t,n,o,s,ne,i)}}var re=0;if(e.length!=1)for(var O=0;O<o.length;O++){var A=o[O];re+=A.rect.width*A.rect.height}return o},$.encode._updateFrame=function(e,t,n,r,i,a,o){for(var s=Uint8Array,c=Uint32Array,l=new s(e[i-1]),u=new c(e[i-1]),d=i+1<e.length?new s(e[i+1]):null,f=new s(e[i]),p=new c(f.buffer),m=t,h=n,g=-1,_=-1,v=0;v<a.height;v++)for(var y=0;y<a.width;y++){var b=a.x+y,x=a.y+v,S=x*t+b,C=p[S];C==0||r[i-1].dispose==0&&u[S]==C&&(d==null||d[S*4+3]!=0)||(b<m&&(m=b),b>g&&(g=b),x<h&&(h=x),x>_&&(_=x))}g==-1&&(m=h=g=_=0),o&&((m&1)==1&&m--,(h&1)==1&&h--),a={x:m,y:h,width:g-m+1,height:_-h+1};var w=r[i];w.rect=a,w.blend=1,w.img=new Uint8Array(a.width*a.height*4),r[i-1].dispose==0?($._copyTile(l,t,n,w.img,a.width,a.height,-a.x,-a.y,0),$.encode._prepareDiff(f,t,n,w.img,a)):$._copyTile(f,t,n,w.img,a.width,a.height,-a.x,-a.y,0)},$.encode._prepareDiff=function(e,t,n,r,i){$._copyTile(e,t,n,r,i.width,i.height,-i.x,-i.y,2)},$.encode._filterZero=function(e,t,n,r,i,a,o){var s=[],c=[0,1,2,3,4];a==-1?(t*r>5e5||n==1)&&(c=[0]):c=[a];var l;o&&(l={level:0});for(var u=o&&UZIP!=null?UZIP:Uy.default,d=0;d<c.length;d++){for(var f=0;f<t;f++)$.encode._filterLine(i,e,f,r,n,c[d]);s.push(u.deflate(i,l))}for(var p,m=1e9,d=0;d<s.length;d++)s[d].length<m&&(p=d,m=s[d].length);return s[p]},$.encode._filterLine=function(e,t,n,r,i,a){var o=n*r,s=o+n,c=$.decode._paeth;if(e[s]=a,s++,a==0){if(r<500)for(var l=0;l<r;l++)e[s+l]=t[o+l];else e.set(new Uint8Array(t.buffer,o,r),s)}else if(a==1){for(var l=0;l<i;l++)e[s+l]=t[o+l];for(var l=i;l<r;l++)e[s+l]=t[o+l]-t[o+l-i]+256&255}else if(n==0){for(var l=0;l<i;l++)e[s+l]=t[o+l];if(a==2)for(var l=i;l<r;l++)e[s+l]=t[o+l];if(a==3)for(var l=i;l<r;l++)e[s+l]=t[o+l]-(t[o+l-i]>>1)+256&255;if(a==4)for(var l=i;l<r;l++)e[s+l]=t[o+l]-c(t[o+l-i],0,0)+256&255}else{if(a==2)for(var l=0;l<r;l++)e[s+l]=t[o+l]+256-t[o+l-r]&255;if(a==3){for(var l=0;l<i;l++)e[s+l]=t[o+l]+256-(t[o+l-r]>>1)&255;for(var l=i;l<r;l++)e[s+l]=t[o+l]+256-(t[o+l-r]+t[o+l-i]>>1)&255}if(a==4){for(var l=0;l<i;l++)e[s+l]=t[o+l]+256-c(0,t[o+l-r],0)&255;for(var l=i;l<r;l++)e[s+l]=t[o+l]+256-c(t[o+l-i],t[o+l-r],t[o+l-i-r])&255}}},$.crc={table:(function(){for(var e=new Uint32Array(256),t=0;t<256;t++){for(var n=t,r=0;r<8;r++)n&1?n=3988292384^n>>>1:n>>>=1;e[t]=n}return e})(),update:function(e,t,n,r){for(var i=0;i<r;i++)e=$.crc.table[(e^t[n+i])&255]^e>>>8;return e},crc:function(e,t,n){return $.crc.update(4294967295,e,t,n)^4294967295}},$.quantize=function(e,t){var n=new Uint8Array(e),r=n.slice(0),i=new Uint32Array(r.buffer),a=$.quantize.getKDtree(r,t),o=a[0],s=a[1];$.quantize.planeDst;for(var c=n,l=i,u=c.length,d=new Uint8Array(n.length>>2),f=0;f<u;f+=4){var p=c[f]*(1/255),m=c[f+1]*(1/255),h=c[f+2]*(1/255),g=c[f+3]*(1/255),_=$.quantize.getNearest(o,p,m,h,g);d[f>>2]=_.ind,l[f>>2]=_.est.rgba}return{abuf:r.buffer,inds:d,plte:s}},$.quantize.getKDtree=function(e,t,n){n??=1e-4;var r=new Uint32Array(e.buffer),i={i0:0,i1:e.length,bst:null,est:null,tdst:0,left:null,right:null};i.bst=$.quantize.stats(e,i.i0,i.i1),i.est=$.quantize.estats(i.bst);for(var a=[i];a.length<t;){for(var o=0,s=0,c=0;c<a.length;c++)a[c].est.L>o&&(o=a[c].est.L,s=c);if(o<n)break;var l=a[s],u=$.quantize.splitPixels(e,r,l.i0,l.i1,l.est.e,l.est.eMq255);if(l.i0>=u||l.i1<=u)l.est.L=0;else{var d={i0:l.i0,i1:u,bst:null,est:null,tdst:0,left:null,right:null};d.bst=$.quantize.stats(e,d.i0,d.i1),d.est=$.quantize.estats(d.bst);var f={i0:u,i1:l.i1,bst:null,est:null,tdst:0,left:null,right:null};f.bst={R:[],m:[],N:l.bst.N-d.bst.N};for(var c=0;c<16;c++)f.bst.R[c]=l.bst.R[c]-d.bst.R[c];for(var c=0;c<4;c++)f.bst.m[c]=l.bst.m[c]-d.bst.m[c];f.est=$.quantize.estats(f.bst),l.left=d,l.right=f,a[s]=d,a.push(f)}}a.sort(function(e,t){return t.bst.N-e.bst.N});for(var c=0;c<a.length;c++)a[c].ind=c;return[i,a]},$.quantize.getNearest=function(e,t,n,r,i){if(e.left==null)return e.tdst=$.quantize.dist(e.est.q,t,n,r,i),e;var a=$.quantize.planeDst(e.est,t,n,r,i),o=e.left,s=e.right;a>0&&(o=e.right,s=e.left);var c=$.quantize.getNearest(o,t,n,r,i);if(c.tdst<=a*a)return c;var l=$.quantize.getNearest(s,t,n,r,i);return l.tdst<c.tdst?l:c},$.quantize.planeDst=function(e,t,n,r,i){var a=e.e;return a[0]*t+a[1]*n+a[2]*r+a[3]*i-e.eMq},$.quantize.dist=function(e,t,n,r,i){var a=t-e[0],o=n-e[1],s=r-e[2],c=i-e[3];return a*a+o*o+s*s+c*c},$.quantize.splitPixels=function(e,t,n,r,i,a){var o=$.quantize.vecDot;for(r-=4;n<r;){for(;o(e,n,i)<=a;)n+=4;for(;o(e,r,i)>a;)r-=4;if(n>=r)break;var s=t[n>>2];t[n>>2]=t[r>>2],t[r>>2]=s,n+=4,r-=4}for(;o(e,n,i)>a;)n-=4;return n+4},$.quantize.vecDot=function(e,t,n){return e[t]*n[0]+e[t+1]*n[1]+e[t+2]*n[2]+e[t+3]*n[3]},$.quantize.stats=function(e,t,n){for(var r=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],i=[0,0,0,0],a=n-t>>2,o=t;o<n;o+=4){var s=e[o]*(1/255),c=e[o+1]*(1/255),l=e[o+2]*(1/255),u=e[o+3]*(1/255);i[0]+=s,i[1]+=c,i[2]+=l,i[3]+=u,r[0]+=s*s,r[1]+=s*c,r[2]+=s*l,r[3]+=s*u,r[5]+=c*c,r[6]+=c*l,r[7]+=c*u,r[10]+=l*l,r[11]+=l*u,r[15]+=u*u}return r[4]=r[1],r[8]=r[2],r[9]=r[6],r[12]=r[3],r[13]=r[7],r[14]=r[11],{R:r,m:i,N:a}},$.quantize.estats=function(e){var t=e.R,n=e.m,r=e.N,i=n[0],a=n[1],o=n[2],s=n[3],c=r==0?0:1/r,l=[t[0]-i*i*c,t[1]-i*a*c,t[2]-i*o*c,t[3]-i*s*c,t[4]-a*i*c,t[5]-a*a*c,t[6]-a*o*c,t[7]-a*s*c,t[8]-o*i*c,t[9]-o*a*c,t[10]-o*o*c,t[11]-o*s*c,t[12]-s*i*c,t[13]-s*a*c,t[14]-s*o*c,t[15]-s*s*c],u=l,d=$.M4,f=[.5,.5,.5,.5],p=0,m=0;if(r!=0)for(var h=0;h<10&&(f=d.multVec(u,f),m=Math.sqrt(d.dot(f,f)),f=d.sml(1/m,f),!(Math.abs(m-p)<1e-9));h++)p=m;var g=[i*c,a*c,o*c,s*c],_=d.dot(d.sml(255,g),f);return{Cov:l,q:g,e:f,L:p,eMq255:_,eMq:d.dot(f,g),rgba:(Math.round(255*g[3])<<24|Math.round(255*g[2])<<16|Math.round(255*g[1])<<8|Math.round(255*g[0]))>>>0}},$.M4={multVec:function(e,t){return[e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3],e[4]*t[0]+e[5]*t[1]+e[6]*t[2]+e[7]*t[3],e[8]*t[0]+e[9]*t[1]+e[10]*t[2]+e[11]*t[3],e[12]*t[0]+e[13]*t[1]+e[14]*t[2]+e[15]*t[3]]},dot:function(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3]},sml:function(e,t){return[e*t[0],e*t[1],e*t[2],e*t[3]]}},$.encode.concatRGBA=function(e){for(var t=0,n=0;n<e.length;n++)t+=e[n].byteLength;for(var r=new Uint8Array(t),i=0,n=0;n<e.length;n++){for(var a=new Uint8Array(e[n]),o=a.length,s=0;s<o;s+=4){var c=a[s],l=a[s+1],u=a[s+2],d=a[s+3];d==0&&(c=l=u=0),r[i+s]=c,r[i+s+1]=l,r[i+s+2]=u,r[i+s+3]=d}i+=o}return r.buffer}})),Gy,Ky,qy,Jy,Yy=s((()=>{Wy(),Gy=function(e){if(e===0)return qy.Greyscale;if(e===2)return qy.Truecolour;if(e===3)return qy.IndexedColour;if(e===4)return qy.GreyscaleWithAlpha;if(e===6)return qy.TruecolourWithAlpha;throw Error(`Unknown color type: `+e)},Ky=function(e){for(var t=Math.floor(e.length/4),n=new Uint8Array(t*3),r=new Uint8Array(t*1),i=0,a=0,o=0;i<e.length;)n[a++]=e[i++],n[a++]=e[i++],n[a++]=e[i++],r[o++]=e[i++];return{rgbChannel:n,alphaChannel:r}},(function(e){e.Greyscale=`Greyscale`,e.Truecolour=`Truecolour`,e.IndexedColour=`IndexedColour`,e.GreyscaleWithAlpha=`GreyscaleWithAlpha`,e.TruecolourWithAlpha=`TruecolourWithAlpha`})(qy||={}),Jy=function(){function e(e){var t=$.decode(e),n=$.toRGBA8(t);if(n.length>1)throw Error(`Animated PNGs are not supported`);var r=Ky(new Uint8Array(n[0])),i=r.rgbChannel,a=r.alphaChannel;this.rgbChannel=i,a.some(function(e){return e<255})&&(this.alphaChannel=a),this.type=Gy(t.ctype),this.width=t.width,this.height=t.height,this.bitsPerComponent=8}return e.load=function(t){return new e(t)},e}()})),Xy,Zy=s((()=>{K(),Yy(),Xy=function(){function e(e){this.image=e,this.bitsPerComponent=e.bitsPerComponent,this.width=e.width,this.height=e.height,this.colorSpace=`DeviceRGB`}return e.for=function(t){return gm(this,void 0,void 0,function(){var n;return _m(this,function(r){return n=Jy.load(t),[2,new e(n)]})})},e.prototype.embedIntoContext=function(e,t){return gm(this,void 0,void 0,function(){var n,r;return _m(this,function(i){return n=this.embedAlphaChannel(e),r=e.flateStream(this.image.rgbChannel,{Type:`XObject`,Subtype:`Image`,BitsPerComponent:this.image.bitsPerComponent,Width:this.image.width,Height:this.image.height,ColorSpace:this.colorSpace,SMask:n}),t?(e.assign(t,r),[2,t]):[2,e.register(r)]})})},e.prototype.embedAlphaChannel=function(e){if(this.image.alphaChannel){var t=e.flateStream(this.image.alphaChannel,{Type:`XObject`,Subtype:`Image`,Height:this.image.height,Width:this.image.width,BitsPerComponent:this.image.bitsPerComponent,ColorSpace:`DeviceGray`,Decode:[0,1]});return e.register(t)}},e}()})),Qy,$y=s((()=>{Qy=function(){function e(e,t,n){this.bytes=e,this.start=t||0,this.pos=this.start,this.end=t&&n?t+n:this.bytes.length}return Object.defineProperty(e.prototype,"length",{get:function(){return this.end-this.start},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.length===0},enumerable:!1,configurable:!0}),e.prototype.getByte=function(){return this.pos>=this.end?-1:this.bytes[this.pos++]},e.prototype.getUint16=function(){var e=this.getByte(),t=this.getByte();return e===-1||t===-1?-1:(e<<8)+t},e.prototype.getInt32=function(){var e=this.getByte(),t=this.getByte(),n=this.getByte(),r=this.getByte();return(e<<24)+(t<<16)+(n<<8)+r},e.prototype.getBytes=function(e,t){t===void 0&&(t=!1);var n=this.bytes,r=this.pos,i=this.end;if(e){var a=r+e;a>i&&(a=i),this.pos=a;var o=n.subarray(r,a);return t?new Uint8ClampedArray(o):o}var o=n.subarray(r,i);return t?new Uint8ClampedArray(o):o},e.prototype.peekByte=function(){var e=this.getByte();return this.pos--,e},e.prototype.peekBytes=function(e,t){t===void 0&&(t=!1);var n=this.getBytes(e,t);return this.pos-=n.length,n},e.prototype.skip=function(e){e||=1,this.pos+=e},e.prototype.reset=function(){this.pos=this.start},e.prototype.moveStart=function(){this.start=this.pos},e.prototype.makeSubStream=function(t,n){return new e(this.bytes,t,n)},e.prototype.decode=function(){return this.bytes},e}()})),eb,tb,nb=s((()=>{Y_(),$y(),eb=new Uint8Array,tb=function(){function e(e){if(this.pos=0,this.bufferLength=0,this.eof=!1,this.buffer=eb,this.minBufferLength=512,e)for(;this.minBufferLength<e;)this.minBufferLength*=2}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){for(;!this.eof&&this.bufferLength===0;)this.readBlock();return this.bufferLength===0},enumerable:!1,configurable:!0}),e.prototype.getByte=function(){for(var e=this.pos;this.bufferLength<=e;){if(this.eof)return-1;this.readBlock()}return this.buffer[this.pos++]},e.prototype.getUint16=function(){var e=this.getByte(),t=this.getByte();return e===-1||t===-1?-1:(e<<8)+t},e.prototype.getInt32=function(){var e=this.getByte(),t=this.getByte(),n=this.getByte(),r=this.getByte();return(e<<24)+(t<<16)+(n<<8)+r},e.prototype.getBytes=function(e,t){t===void 0&&(t=!1);var n,r=this.pos;if(e){for(this.ensureBuffer(r+e),n=r+e;!this.eof&&this.bufferLength<n;)this.readBlock();var i=this.bufferLength;n>i&&(n=i)}else{for(;!this.eof;)this.readBlock();n=this.bufferLength}this.pos=n;var a=this.buffer.subarray(r,n);return t&&!(a instanceof Uint8ClampedArray)?new Uint8ClampedArray(a):a},e.prototype.peekByte=function(){var e=this.getByte();return this.pos--,e},e.prototype.peekBytes=function(e,t){t===void 0&&(t=!1);var n=this.getBytes(e,t);return this.pos-=n.length,n},e.prototype.skip=function(e){e||=1,this.pos+=e},e.prototype.reset=function(){this.pos=0},e.prototype.makeSubStream=function(e,t){for(var n=e+t;this.bufferLength<=n&&!this.eof;)this.readBlock();return new Qy(this.buffer,e,t)},e.prototype.decode=function(){for(;!this.eof;)this.readBlock();return this.buffer.subarray(0,this.bufferLength)},e.prototype.readBlock=function(){throw new S_(this.constructor.name,`readBlock`)},e.prototype.ensureBuffer=function(e){var t=this.buffer;if(e<=t.byteLength)return t;for(var n=this.minBufferLength;n<e;)n*=2;var r=new Uint8Array(n);return r.set(t),this.buffer=r},e}()})),rb,ib,ab=s((()=>{K(),nb(),rb=function(e){return e===32||e===9||e===13||e===10},ib=function(e){G(t,e);function t(t,n){var r=e.call(this,n)||this;return r.stream=t,r.input=new Uint8Array(5),n&&=.8*n,r}return t.prototype.readBlock=function(){for(var e=126,t=122,n=-1,r=this.stream,i=r.getByte();rb(i);)i=r.getByte();if(i===n||i===e)this.eof=!0;else{var a=this.bufferLength,o,s;if(i===t){for(o=this.ensureBuffer(a+4),s=0;s<4;++s)o[a+s]=0;this.bufferLength+=4}else{var c=this.input;for(c[0]=i,s=1;s<5;++s){for(i=r.getByte();rb(i);)i=r.getByte();if(c[s]=i,i===n||i===e)break}if(o=this.ensureBuffer(a+s-1),this.bufferLength+=s-1,s<5){for(;s<5;++s)c[s]=117;this.eof=!0}var l=0;for(s=0;s<5;++s)l=l*85+(c[s]-33);for(s=3;s>=0;--s)o[a+s]=l&255,l>>=8}}},t}(tb)})),ob,sb=s((()=>{K(),nb(),ob=function(e){G(t,e);function t(t,n){var r=e.call(this,n)||this;return r.stream=t,r.firstDigit=-1,n&&=.5*n,r}return t.prototype.readBlock=function(){var e=this.stream.getBytes(8e3);if(!e.length)this.eof=!0;else{for(var t=e.length+1>>1,n=this.ensureBuffer(this.bufferLength+t),r=this.bufferLength,i=this.firstDigit,a=0,o=e.length;a<o;a++){var s=e[a],c=void 0;if(s>=48&&s<=57)c=s&15;else if(s>=65&&s<=70||s>=97&&s<=102)c=(s&15)+9;else if(s===62){this.eof=!0;break}else continue;i<0?i=c:(n[r++]=i<<4|c,i=-1)}i>=0&&this.eof&&(n[r++]=i<<4,i=-1),this.firstDigit=i,this.bufferLength=r}},t}(tb)})),cb,lb,ub,db,fb,pb,mb=s((()=>{K(),nb(),cb=new Int32Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),lb=new Int32Array([3,4,5,6,7,8,9,10,65547,65549,65551,65553,131091,131095,131099,131103,196643,196651,196659,196667,262211,262227,262243,262259,327811,327843,327875,327907,258,258,258]),ub=new Int32Array([1,2,3,4,65541,65543,131081,131085,196625,196633,262177,262193,327745,327777,393345,393409,459009,459137,524801,525057,590849,591361,657409,658433,724993,727041,794625,798721,868353,876545]),db=[new Int32Array([459008,524368,524304,524568,459024,524400,524336,590016,459016,524384,524320,589984,524288,524416,524352,590048,459012,524376,524312,589968,459028,524408,524344,590032,459020,524392,524328,59e4,524296,524424,524360,590064,459010,524372,524308,524572,459026,524404,524340,590024,459018,524388,524324,589992,524292,524420,524356,590056,459014,524380,524316,589976,459030,524412,524348,590040,459022,524396,524332,590008,524300,524428,524364,590072,459009,524370,524306,524570,459025,524402,524338,590020,459017,524386,524322,589988,524290,524418,524354,590052,459013,524378,524314,589972,459029,524410,524346,590036,459021,524394,524330,590004,524298,524426,524362,590068,459011,524374,524310,524574,459027,524406,524342,590028,459019,524390,524326,589996,524294,524422,524358,590060,459015,524382,524318,589980,459031,524414,524350,590044,459023,524398,524334,590012,524302,524430,524366,590076,459008,524369,524305,524569,459024,524401,524337,590018,459016,524385,524321,589986,524289,524417,524353,590050,459012,524377,524313,589970,459028,524409,524345,590034,459020,524393,524329,590002,524297,524425,524361,590066,459010,524373,524309,524573,459026,524405,524341,590026,459018,524389,524325,589994,524293,524421,524357,590058,459014,524381,524317,589978,459030,524413,524349,590042,459022,524397,524333,590010,524301,524429,524365,590074,459009,524371,524307,524571,459025,524403,524339,590022,459017,524387,524323,589990,524291,524419,524355,590054,459013,524379,524315,589974,459029,524411,524347,590038,459021,524395,524331,590006,524299,524427,524363,590070,459011,524375,524311,524575,459027,524407,524343,590030,459019,524391,524327,589998,524295,524423,524359,590062,459015,524383,524319,589982,459031,524415,524351,590046,459023,524399,524335,590014,524303,524431,524367,590078,459008,524368,524304,524568,459024,524400,524336,590017,459016,524384,524320,589985,524288,524416,524352,590049,459012,524376,524312,589969,459028,524408,524344,590033,459020,524392,524328,590001,524296,524424,524360,590065,459010,524372,524308,524572,459026,524404,524340,590025,459018,524388,524324,589993,524292,524420,524356,590057,459014,524380,524316,589977,459030,524412,524348,590041,459022,524396,524332,590009,524300,524428,524364,590073,459009,524370,524306,524570,459025,524402,524338,590021,459017,524386,524322,589989,524290,524418,524354,590053,459013,524378,524314,589973,459029,524410,524346,590037,459021,524394,524330,590005,524298,524426,524362,590069,459011,524374,524310,524574,459027,524406,524342,590029,459019,524390,524326,589997,524294,524422,524358,590061,459015,524382,524318,589981,459031,524414,524350,590045,459023,524398,524334,590013,524302,524430,524366,590077,459008,524369,524305,524569,459024,524401,524337,590019,459016,524385,524321,589987,524289,524417,524353,590051,459012,524377,524313,589971,459028,524409,524345,590035,459020,524393,524329,590003,524297,524425,524361,590067,459010,524373,524309,524573,459026,524405,524341,590027,459018,524389,524325,589995,524293,524421,524357,590059,459014,524381,524317,589979,459030,524413,524349,590043,459022,524397,524333,590011,524301,524429,524365,590075,459009,524371,524307,524571,459025,524403,524339,590023,459017,524387,524323,589991,524291,524419,524355,590055,459013,524379,524315,589975,459029,524411,524347,590039,459021,524395,524331,590007,524299,524427,524363,590071,459011,524375,524311,524575,459027,524407,524343,590031,459019,524391,524327,589999,524295,524423,524359,590063,459015,524383,524319,589983,459031,524415,524351,590047,459023,524399,524335,590015,524303,524431,524367,590079]),9],fb=[new Int32Array([327680,327696,327688,327704,327684,327700,327692,327708,327682,327698,327690,327706,327686,327702,327694,0,327681,327697,327689,327705,327685,327701,327693,327709,327683,327699,327691,327707,327687,327703,327695,0]),5],pb=function(e){G(t,e);function t(t,n){var r=e.call(this,n)||this;r.stream=t;var i=t.getByte(),a=t.getByte();if(i===-1||a===-1)throw Error(`Invalid header in flate stream: `+i+`, `+a);if((i&15)!=8)throw Error(`Unknown compression method in flate stream: `+i+`, `+a);if(((i<<8)+a)%31!=0)throw Error(`Bad FCHECK in flate stream: `+i+`, `+a);if(a&32)throw Error(`FDICT bit set in flate stream: `+i+`, `+a);return r.codeSize=0,r.codeBuf=0,r}return t.prototype.readBlock=function(){var e,t,n=this.stream,r=this.getBits(3);if(r&1&&(this.eof=!0),r>>=1,r===0){var i=void 0;if((i=n.getByte())===-1)throw Error(`Bad block header in flate stream`);var a=i;if((i=n.getByte())===-1||(a|=i<<8,(i=n.getByte())===-1))throw Error(`Bad block header in flate stream`);var o=i;if((i=n.getByte())===-1)throw Error(`Bad block header in flate stream`);if(o|=i<<8,o!==(~a&65535)&&(a!==0||o!==0))throw Error(`Bad uncompressed block length in flate stream`);this.codeBuf=0,this.codeSize=0;var s=this.bufferLength;e=this.ensureBuffer(s+a);var c=s+a;if(this.bufferLength=c,a===0)n.peekByte()===-1&&(this.eof=!0);else for(var l=s;l<c;++l){if((i=n.getByte())===-1){this.eof=!0;break}e[l]=i}}else{var u,d;if(r===1)u=db,d=fb;else if(r===2){var f=this.getBits(5)+257,p=this.getBits(5)+1,m=this.getBits(4)+4,h=new Uint8Array(cb.length),g=void 0;for(g=0;g<m;++g)h[cb[g]]=this.getBits(3);var _=this.generateHuffmanTable(h);t=0,g=0;for(var v=f+p,y=new Uint8Array(v),b=void 0,x=void 0,S=void 0;g<v;){var C=this.getCode(_);if(C===16)b=2,x=3,S=t;else if(C===17)b=3,x=3,S=t=0;else if(C===18)b=7,x=11,S=t=0;else{y[g++]=t=C;continue}for(var w=this.getBits(b)+x;w-->0;)y[g++]=S}u=this.generateHuffmanTable(y.subarray(0,f)),d=this.generateHuffmanTable(y.subarray(f,v))}else throw Error(`Unknown block type in flate stream`);e=this.buffer;for(var T=e?e.length:0,E=this.bufferLength;;){var D=this.getCode(u);if(D<256)E+1>=T&&(e=this.ensureBuffer(E+1),T=e.length),e[E++]=D;else{if(D===256){this.bufferLength=E;return}D-=257,D=lb[D];var O=D>>16;O>0&&(O=this.getBits(O)),t=(D&65535)+O,D=this.getCode(d),D=ub[D],O=D>>16,O>0&&(O=this.getBits(O));var k=(D&65535)+O;E+t>=T&&(e=this.ensureBuffer(E+t),T=e.length);for(var A=0;A<t;++A,++E)e[E]=e[E-k]}}}},t.prototype.getBits=function(e){for(var t=this.stream,n=this.codeSize,r=this.codeBuf,i;n<e;){if((i=t.getByte())===-1)throw Error(`Bad encoding in flate stream`);r|=i<<n,n+=8}return i=r&(1<<e)-1,this.codeBuf=r>>e,this.codeSize=n-=e,i},t.prototype.getCode=function(e){for(var t=this.stream,n=e[0],r=e[1],i=this.codeSize,a=this.codeBuf,o;i<r&&(o=t.getByte())!==-1;)a|=o<<i,i+=8;var s=n[a&(1<<r)-1];typeof n==`number`&&console.log(`FLATE:`,s);var c=s>>16,l=s&65535;if(c<1||i<c)throw Error(`Bad encoding in flate stream`);return this.codeBuf=a>>c,this.codeSize=i-c,l},t.prototype.generateHuffmanTable=function(e){for(var t=e.length,n=0,r=0;r<t;++r)e[r]>n&&(n=e[r]);for(var i=1<<n,a=new Int32Array(i),o=1,s=0,c=2;o<=n;++o,s<<=1,c<<=1)for(var l=0;l<t;++l)if(e[l]===o){var u=0,d=s;for(r=0;r<o;++r)u=u<<1|d&1,d>>=1;for(r=u;r<i;r+=c)a[r]=o<<16|l;++s}return[a,n]},t}(tb)})),hb,gb=s((()=>{K(),nb(),hb=function(e){G(t,e);function t(t,n,r){var i=e.call(this,n)||this;i.stream=t,i.cachedData=0,i.bitsCached=0;for(var a=4096,o={earlyChange:r,codeLength:9,nextCode:258,dictionaryValues:new Uint8Array(a),dictionaryLengths:new Uint16Array(a),dictionaryPrevCodes:new Uint16Array(a),currentSequence:new Uint8Array(a),currentSequenceLength:0},s=0;s<256;++s)o.dictionaryValues[s]=s,o.dictionaryLengths[s]=1;return i.lzwState=o,i}return t.prototype.readBlock=function(){var e=512,t=e*2,n=e,r,i,a,o=this.lzwState;if(o){var s=o.earlyChange,c=o.nextCode,l=o.dictionaryValues,u=o.dictionaryLengths,d=o.dictionaryPrevCodes,f=o.codeLength,p=o.prevCode,m=o.currentSequence,h=o.currentSequenceLength,g=0,_=this.bufferLength,v=this.ensureBuffer(this.bufferLength+t);for(r=0;r<e;r++){var y=this.readBits(f),b=h>0;if(!y||y<256)m[0]=y,h=1;else if(y>=258){if(y<c)for(h=u[y],i=h-1,a=y;i>=0;i--)m[i]=l[a],a=d[a];else m[h++]=m[0]}else if(y===256){f=9,c=258,h=0;continue}else{this.eof=!0,delete this.lzwState;break}if(b&&(d[c]=p,u[c]=u[p]+1,l[c]=m[0],c++,f=c+s&c+s-1?f:Math.min(Math.log(c+s)/.6931471805599453+1,12)|0),p=y,g+=h,t<g){do t+=n;while(t<g);v=this.ensureBuffer(this.bufferLength+t)}for(i=0;i<h;i++)v[_++]=m[i]}o.nextCode=c,o.codeLength=f,o.prevCode=p,o.currentSequenceLength=h,this.bufferLength=_}},t.prototype.readBits=function(e){for(var t=this.bitsCached,n=this.cachedData;t<e;){var r=this.stream.getByte();if(r===-1)return this.eof=!0,null;n=n<<8|r,t+=8}return this.bitsCached=t-=e,this.cachedData=n,n>>>t&(1<<e)-1},t}(tb)})),_b,vb=s((()=>{K(),nb(),_b=function(e){G(t,e);function t(t,n){var r=e.call(this,n)||this;return r.stream=t,r}return t.prototype.readBlock=function(){var e=this.stream.getBytes(2);if(!e||e.length<2||e[0]===128)this.eof=!0;else{var t,n=this.bufferLength,r=e[0];if(r<128){if(t=this.ensureBuffer(n+r+1),t[n++]=e[1],r>0){var i=this.stream.getBytes(r);t.set(i,n),n+=r}}else{r=257-r;var a=e[1];t=this.ensureBuffer(n+r+1);for(var o=0;o<r;o++)t[n++]=a}this.bufferLength=n}},t}(tb)})),yb,bb,xb=s((()=>{Y_(),iv(),wv(),bv(),rv(),ab(),sb(),mb(),gb(),vb(),$y(),yb=function(e,t,n){if(t===Z.of(`FlateDecode`))return new pb(e);if(t===Z.of(`LZWDecode`)){var r=1;if(n instanceof Q){var i=n.lookup(Z.of(`EarlyChange`));i instanceof nv&&(r=i.asNumber())}return new hb(e,void 0,r)}if(t===Z.of(`ASCII85Decode`))return new ib(e);if(t===Z.of(`ASCIIHexDecode`))return new ob(e);if(t===Z.of(`RunLengthDecode`))return new _b(e);throw new T_(t.asString())},bb=function(e){var t=e.dict,n=e.contents,r=new Qy(n),i=t.lookup(Z.of(`Filter`)),a=t.lookup(Z.of(`DecodeParms`));if(i instanceof Z)r=yb(r,i,a);else if(i instanceof X)for(var o=0,s=i.size();o<s;o++)r=yb(r,i.lookup(o,Z),a&&a.lookupMaybe(o,Q));else if(i)throw new w_([Z,X],i);return r}})),Sb,Cb,wb,Tb=s((()=>{K(),Y_(),rv(),Ov(),Ev(),xb(),Hv(),Z_(),x_(),Sb=function(e){var t=e.MediaBox();return{left:0,bottom:0,right:t.lookup(2,nv).asNumber()-t.lookup(0,nv).asNumber(),top:t.lookup(3,nv).asNumber()-t.lookup(1,nv).asNumber()}},Cb=function(e){return[1,0,0,1,-e.left,-e.bottom]},wb=function(){function e(e,t,n){this.page=e;var r=t??Sb(e);this.width=r.right-r.left,this.height=r.top-r.bottom,this.boundingBox=r,this.transformationMatrix=n??Cb(r)}return e.for=function(t,n,r){return gm(this,void 0,void 0,function(){return _m(this,function(i){return[2,new e(t,n,r)]})})},e.prototype.embedIntoContext=function(e,t){return gm(this,void 0,void 0,function(){var n,r,i,a,o,s,c,l,u,d;return _m(this,function(f){if(n=this.page.normalizedEntries(),r=n.Contents,i=n.Resources,!r)throw new D_;return a=this.decodeContents(r),o=this.boundingBox,s=o.left,c=o.bottom,l=o.right,u=o.top,d=e.flateStream(a,{Type:`XObject`,Subtype:`Form`,FormType:1,BBox:[s,c,l,u],Matrix:this.transformationMatrix,Resources:i}),t?(e.assign(t,d),[2,t]):[2,e.register(d)]})})},e.prototype.decodeContents=function(e){for(var t=Uint8Array.of(Y.Newline),n=[],r=0,i=e.size();r<i;r++){var a=e.lookup(r,Tv),o=void 0;if(a instanceof Dv)o=bb(a).decode();else if(a instanceof Vv)o=a.getUnencodedContents();else throw new O_(a);n.push(o,t)}return $m.apply(void 0,n)},e}()})),Eb,Db,Ob,kb,Ab,jb,Mb=s((()=>{iv(),sv(),bv(),rv(),x_(),Eb=function(e,t){if(e!==void 0)return t[e]},(function(e){e.UseNone=`UseNone`,e.UseOutlines=`UseOutlines`,e.UseThumbs=`UseThumbs`,e.UseOC=`UseOC`})(Db||={}),(function(e){e.L2R=`L2R`,e.R2L=`R2L`})(Ob||={}),(function(e){e.None=`None`,e.AppDefault=`AppDefault`})(kb||={}),(function(e){e.Simplex=`Simplex`,e.DuplexFlipShortEdge=`DuplexFlipShortEdge`,e.DuplexFlipLongEdge=`DuplexFlipLongEdge`})(Ab||={}),jb=function(){function e(e){this.dict=e}return e.prototype.lookupBool=function(e){var t=this.dict.lookup(Z.of(e));if(t instanceof ov)return t},e.prototype.lookupName=function(e){var t=this.dict.lookup(Z.of(e));if(t instanceof Z)return t},e.prototype.HideToolbar=function(){return this.lookupBool(`HideToolbar`)},e.prototype.HideMenubar=function(){return this.lookupBool(`HideMenubar`)},e.prototype.HideWindowUI=function(){return this.lookupBool(`HideWindowUI`)},e.prototype.FitWindow=function(){return this.lookupBool(`FitWindow`)},e.prototype.CenterWindow=function(){return this.lookupBool(`CenterWindow`)},e.prototype.DisplayDocTitle=function(){return this.lookupBool(`DisplayDocTitle`)},e.prototype.NonFullScreenPageMode=function(){return this.lookupName(`NonFullScreenPageMode`)},e.prototype.Direction=function(){return this.lookupName(`Direction`)},e.prototype.PrintScaling=function(){return this.lookupName(`PrintScaling`)},e.prototype.Duplex=function(){return this.lookupName(`Duplex`)},e.prototype.PickTrayByPDFSize=function(){return this.lookupBool(`PickTrayByPDFSize`)},e.prototype.PrintPageRange=function(){var e=this.dict.lookup(Z.of(`PrintPageRange`));if(e instanceof X)return e},e.prototype.NumCopies=function(){var e=this.dict.lookup(Z.of(`NumCopies`));if(e instanceof nv)return e},e.prototype.getHideToolbar=function(){return this.HideToolbar()?.asBoolean()??!1},e.prototype.getHideMenubar=function(){return this.HideMenubar()?.asBoolean()??!1},e.prototype.getHideWindowUI=function(){return this.HideWindowUI()?.asBoolean()??!1},e.prototype.getFitWindow=function(){return this.FitWindow()?.asBoolean()??!1},e.prototype.getCenterWindow=function(){return this.CenterWindow()?.asBoolean()??!1},e.prototype.getDisplayDocTitle=function(){return this.DisplayDocTitle()?.asBoolean()??!1},e.prototype.getNonFullScreenPageMode=function(){return Eb(this.NonFullScreenPageMode()?.decodeText(),Db)??Db.UseNone},e.prototype.getReadingDirection=function(){return Eb(this.Direction()?.decodeText(),Ob)??Ob.L2R},e.prototype.getPrintScaling=function(){return Eb(this.PrintScaling()?.decodeText(),kb)??kb.AppDefault},e.prototype.getDuplex=function(){return Eb(this.Duplex()?.decodeText(),Ab)},e.prototype.getPickTrayByPDFSize=function(){return this.PickTrayByPDFSize()?.asBoolean()},e.prototype.getPrintPageRange=function(){var e=this.PrintPageRange();if(!e)return[];for(var t=[],n=0;n<e.size();n+=2){var r=e.lookup(n,nv).asNumber(),i=e.lookup(n+1,nv).asNumber();t.push({start:r,end:i})}return t},e.prototype.getNumCopies=function(){return this.NumCopies()?.asNumber()??1},e.prototype.setHideToolbar=function(e){var t=this.dict.context.obj(e);this.dict.set(Z.of(`HideToolbar`),t)},e.prototype.setHideMenubar=function(e){var t=this.dict.context.obj(e);this.dict.set(Z.of(`HideMenubar`),t)},e.prototype.setHideWindowUI=function(e){var t=this.dict.context.obj(e);this.dict.set(Z.of(`HideWindowUI`),t)},e.prototype.setFitWindow=function(e){var t=this.dict.context.obj(e);this.dict.set(Z.of(`FitWindow`),t)},e.prototype.setCenterWindow=function(e){var t=this.dict.context.obj(e);this.dict.set(Z.of(`CenterWindow`),t)},e.prototype.setDisplayDocTitle=function(e){var t=this.dict.context.obj(e);this.dict.set(Z.of(`DisplayDocTitle`),t)},e.prototype.setNonFullScreenPageMode=function(e){n_(e,`nonFullScreenPageMode`,Db);var t=Z.of(e);this.dict.set(Z.of(`NonFullScreenPageMode`),t)},e.prototype.setReadingDirection=function(e){n_(e,`readingDirection`,Ob);var t=Z.of(e);this.dict.set(Z.of(`Direction`),t)},e.prototype.setPrintScaling=function(e){n_(e,`printScaling`,kb);var t=Z.of(e);this.dict.set(Z.of(`PrintScaling`),t)},e.prototype.setDuplex=function(e){n_(e,`duplex`,Ab);var t=Z.of(e);this.dict.set(Z.of(`Duplex`),t)},e.prototype.setPickTrayByPDFSize=function(e){var t=this.dict.context.obj(e);this.dict.set(Z.of(`PickTrayByPDFSize`),t)},e.prototype.setPrintPageRange=function(e){Array.isArray(e)||(e=[e]);for(var t=[],n=0,r=e.length;n<r;n++)t.push(e[n].start),t.push(e[n].end);c_(t,`printPageRange`,[`number`]);var i=this.dict.context.obj(t);this.dict.set(Z.of(`PrintPageRange`),i)},e.prototype.setNumCopies=function(e){l_(e,`numCopies`,1,Number.MAX_VALUE),f_(e,`numCopies`);var t=this.dict.context.obj(e);this.dict.set(Z.of(`NumCopies`),t)},e.fromDict=function(t){return new e(t)},e.create=function(t){return new e(t.obj({}))},e}()})),Nb,Pb,Fb=s((()=>{wv(),Ay(),_y(),bv(),rv(),iv(),Mv(),x_(),Y_(),Nb=/\/([^\0\t\n\f\r\ ]+)[\0\t\n\f\r\ ]*(\d*\.\d+|\d+)?[\0\t\n\f\r\ ]+Tf/,Pb=function(){function e(e,t){this.dict=e,this.ref=t}return e.prototype.T=function(){return this.dict.lookupMaybe(Z.of(`T`),ky,gy)},e.prototype.Ff=function(){var e=this.getInheritableAttribute(Z.of(`Ff`));return this.dict.context.lookupMaybe(e,nv)},e.prototype.V=function(){var e=this.getInheritableAttribute(Z.of(`V`));return this.dict.context.lookup(e)},e.prototype.Kids=function(){return this.dict.lookupMaybe(Z.of(`Kids`),X)},e.prototype.DA=function(){var e=this.dict.lookup(Z.of(`DA`));if(e instanceof ky||e instanceof gy)return e},e.prototype.setKids=function(e){this.dict.set(Z.of(`Kids`),this.dict.context.obj(e))},e.prototype.getParent=function(){var t=this.dict.get(Z.of(`Parent`));if(t instanceof jv)return new e(this.dict.lookup(Z.of(`Parent`),Q),t)},e.prototype.setParent=function(e){e?this.dict.set(Z.of(`Parent`),e):this.dict.delete(Z.of(`Parent`))},e.prototype.getFullyQualifiedName=function(){var e=this.getParent();return e?e.getFullyQualifiedName()+`.`+this.getPartialName():this.getPartialName()},e.prototype.getPartialName=function(){return this.T()?.decodeText()},e.prototype.setPartialName=function(e){e?this.dict.set(Z.of(`T`),gy.fromText(e)):this.dict.delete(Z.of(`T`))},e.prototype.setDefaultAppearance=function(e){this.dict.set(Z.of(`DA`),ky.of(e))},e.prototype.getDefaultAppearance=function(){var e=this.DA();return e instanceof gy?e.decodeText():e?.asString()},e.prototype.setFontSize=function(e){var t=this.getFullyQualifiedName()??``,n=this.getDefaultAppearance();if(!n)throw new L_(t);var r=Ym(n,Nb);if(!r.match)throw new R_(t);var i=n.slice(0,r.pos-r.match[0].length),a=r.pos<=n.length?n.slice(r.pos):``,o=r.match[1],s=i+` /`+o+` `+e+` Tf `+a;this.setDefaultAppearance(s)},e.prototype.getFlags=function(){return this.Ff()?.asNumber()??0},e.prototype.setFlags=function(e){this.dict.set(Z.of(`Ff`),nv.of(e))},e.prototype.hasFlag=function(e){return(this.getFlags()&e)!==0},e.prototype.setFlag=function(e){var t=this.getFlags();this.setFlags(t|e)},e.prototype.clearFlag=function(e){var t=this.getFlags();this.setFlags(t&~e)},e.prototype.setFlagTo=function(e,t){t?this.setFlag(e):this.clearFlag(e)},e.prototype.getInheritableAttribute=function(e){var t;return this.ascend(function(n){t||=n.dict.get(e)}),t},e.prototype.ascend=function(e){e(this);var t=this.getParent();t&&t.ascend(e)},e}()})),Ib,Lb=s((()=>{bv(),rv(),Ib=function(){function e(e){this.dict=e}return e.prototype.W=function(){var e=this.dict.lookup(Z.of(`W`));if(e instanceof nv)return e},e.prototype.getWidth=function(){return this.W()?.asNumber()??1},e.prototype.setWidth=function(e){var t=this.dict.context.obj(e);this.dict.set(Z.of(`W`),t)},e.fromDict=function(t){return new e(t)},e}()})),Rb,zb=s((()=>{wv(),bv(),Ev(),iv(),Mv(),rv(),Rb=function(){function e(e){this.dict=e}return e.prototype.Rect=function(){return this.dict.lookup(Z.of(`Rect`),X)},e.prototype.AP=function(){return this.dict.lookupMaybe(Z.of(`AP`),Q)},e.prototype.F=function(){var e=this.dict.lookup(Z.of(`F`));return this.dict.context.lookupMaybe(e,nv)},e.prototype.getRectangle=function(){return this.Rect()?.asRectangle()??{x:0,y:0,width:0,height:0}},e.prototype.setRectangle=function(e){var t=e.x,n=e.y,r=e.width,i=e.height,a=this.dict.context.obj([t,n,t+r,n+i]);this.dict.set(Z.of(`Rect`),a)},e.prototype.getAppearanceState=function(){var e=this.dict.lookup(Z.of(`AS`));if(e instanceof Z)return e},e.prototype.setAppearanceState=function(e){this.dict.set(Z.of(`AS`),e)},e.prototype.setAppearances=function(e){this.dict.set(Z.of(`AP`),e)},e.prototype.ensureAP=function(){var e=this.AP();return e||(e=this.dict.context.obj({}),this.dict.set(Z.of(`AP`),e)),e},e.prototype.getNormalAppearance=function(){var e=this.ensureAP().get(Z.of(`N`));if(e instanceof jv||e instanceof Q)return e;throw Error(`Unexpected N type: `+e?.constructor.name)},e.prototype.setNormalAppearance=function(e){this.ensureAP().set(Z.of(`N`),e)},e.prototype.setRolloverAppearance=function(e){this.ensureAP().set(Z.of(`R`),e)},e.prototype.setDownAppearance=function(e){this.ensureAP().set(Z.of(`D`),e)},e.prototype.removeRolloverAppearance=function(){this.AP()?.delete(Z.of(`R`))},e.prototype.removeDownAppearance=function(){this.AP()?.delete(Z.of(`D`))},e.prototype.getAppearances=function(){var e=this.AP();if(e)return{normal:e.lookup(Z.of(`N`),Q,Tv),rollover:e.lookupMaybe(Z.of(`R`),Q,Tv),down:e.lookupMaybe(Z.of(`D`),Q,Tv)}},e.prototype.getFlags=function(){return this.F()?.asNumber()??0},e.prototype.setFlags=function(e){this.dict.set(Z.of(`F`),nv.of(e))},e.prototype.hasFlag=function(e){return(this.getFlags()&e)!==0},e.prototype.setFlag=function(e){var t=this.getFlags();this.setFlags(t|e)},e.prototype.clearFlag=function(e){var t=this.getFlags();this.setFlags(t&~e)},e.prototype.setFlagTo=function(e,t){t?this.setFlag(e):this.clearFlag(e)},e.fromDict=function(t){return new e(t)},e}()})),Bb,Vb=s((()=>{bv(),rv(),iv(),_y(),Ay(),Bb=function(){function e(e){this.dict=e}return e.prototype.R=function(){var e=this.dict.lookup(Z.of(`R`));if(e instanceof nv)return e},e.prototype.BC=function(){var e=this.dict.lookup(Z.of(`BC`));if(e instanceof X)return e},e.prototype.BG=function(){var e=this.dict.lookup(Z.of(`BG`));if(e instanceof X)return e},e.prototype.CA=function(){var e=this.dict.lookup(Z.of(`CA`));if(e instanceof gy||e instanceof ky)return e},e.prototype.RC=function(){var e=this.dict.lookup(Z.of(`RC`));if(e instanceof gy||e instanceof ky)return e},e.prototype.AC=function(){var e=this.dict.lookup(Z.of(`AC`));if(e instanceof gy||e instanceof ky)return e},e.prototype.getRotation=function(){return this.R()?.asNumber()},e.prototype.getBorderColor=function(){var e=this.BC();if(e){for(var t=[],n=0,r=e?.size();n<r;n++){var i=e.get(n);i instanceof nv&&t.push(i.asNumber())}return t}},e.prototype.getBackgroundColor=function(){var e=this.BG();if(e){for(var t=[],n=0,r=e?.size();n<r;n++){var i=e.get(n);i instanceof nv&&t.push(i.asNumber())}return t}},e.prototype.getCaptions=function(){var e=this.CA(),t=this.RC(),n=this.AC();return{normal:e?.decodeText(),rollover:t?.decodeText(),down:n?.decodeText()}},e.prototype.setRotation=function(e){var t=this.dict.context.obj(e);this.dict.set(Z.of(`R`),t)},e.prototype.setBorderColor=function(e){var t=this.dict.context.obj(e);this.dict.set(Z.of(`BC`),t)},e.prototype.setBackgroundColor=function(e){var t=this.dict.context.obj(e);this.dict.set(Z.of(`BG`),t)},e.prototype.setCaptions=function(e){var t=gy.fromText(e.normal);if(this.dict.set(Z.of(`CA`),t),e.rollover){var n=gy.fromText(e.rollover);this.dict.set(Z.of(`RC`),n)}else this.dict.delete(Z.of(`RC`));if(e.down){var r=gy.fromText(e.down);this.dict.set(Z.of(`AC`),r)}else this.dict.delete(Z.of(`AC`))},e.fromDict=function(t){return new e(t)},e}()})),Hb,Ub=s((()=>{K(),wv(),bv(),Mv(),Ay(),_y(),Lb(),zb(),Vb(),Hb=function(e){G(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.MK=function(){var e=this.dict.lookup(Z.of(`MK`));if(e instanceof Q)return e},t.prototype.BS=function(){var e=this.dict.lookup(Z.of(`BS`));if(e instanceof Q)return e},t.prototype.DA=function(){var e=this.dict.lookup(Z.of(`DA`));if(e instanceof ky||e instanceof gy)return e},t.prototype.P=function(){var e=this.dict.get(Z.of(`P`));if(e instanceof jv)return e},t.prototype.setP=function(e){this.dict.set(Z.of(`P`),e)},t.prototype.setDefaultAppearance=function(e){this.dict.set(Z.of(`DA`),ky.of(e))},t.prototype.getDefaultAppearance=function(){var e=this.DA();return e instanceof gy?e.decodeText():e?.asString()},t.prototype.getAppearanceCharacteristics=function(){var e=this.MK();if(e)return Bb.fromDict(e)},t.prototype.getOrCreateAppearanceCharacteristics=function(){var e=this.MK();if(e)return Bb.fromDict(e);var t=Bb.fromDict(this.dict.context.obj({}));return this.dict.set(Z.of(`MK`),t.dict),t},t.prototype.getBorderStyle=function(){var e=this.BS();if(e)return Ib.fromDict(e)},t.prototype.getOrCreateBorderStyle=function(){var e=this.BS();if(e)return Ib.fromDict(e);var t=Ib.fromDict(this.dict.context.obj({}));return this.dict.set(Z.of(`BS`),t.dict),t},t.prototype.getOnValue=function(){var e=this.getAppearances()?.normal;if(e instanceof Q)for(var t=e.keys(),n=0,r=t.length;n<r;n++){var i=t[n];if(i!==Z.of(`Off`))return i}},t.fromDict=function(e){return new t(e)},t.create=function(e,n){return new t(e.obj({Type:`Annot`,Subtype:`Widget`,Rect:[0,0,0,0],Parent:n}))},t}(Rb)})),Wb,Gb=s((()=>{K(),wv(),bv(),Fb(),Ub(),Y_(),Wb=function(e){G(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.FT=function(){var e=this.getInheritableAttribute(Z.of(`FT`));return this.dict.context.lookup(e,Z)},t.prototype.getWidgets=function(){var e=this.Kids();if(!e)return[Hb.fromDict(this.dict)];for(var t=Array(e.size()),n=0,r=e.size();n<r;n++){var i=e.lookup(n,Q);t[n]=Hb.fromDict(i)}return t},t.prototype.addWidget=function(e){this.normalizedEntries().Kids.push(e)},t.prototype.removeWidget=function(e){var t=this.Kids();if(t){if(e<0||e>t.size())throw new P_(e,0,t.size());t.remove(e)}else{if(e!==0)throw new P_(e,0,0);this.setKids([])}},t.prototype.normalizedEntries=function(){var e=this.Kids();return e||(e=this.dict.context.obj([this.ref]),this.dict.set(Z.of(`Kids`),e)),{Kids:e}},t.fromDict=function(e,n){return new t(e,n)},t}(Pb)})),Kb,qb=s((()=>{K(),Ay(),_y(),iv(),bv(),Gb(),Y_(),Kb=function(e){G(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.Opt=function(){return this.dict.lookupMaybe(Z.of(`Opt`),ky,gy,X)},t.prototype.setOpt=function(e){this.dict.set(Z.of(`Opt`),this.dict.context.obj(e))},t.prototype.getExportValues=function(){var e=this.Opt();if(e){if(e instanceof ky||e instanceof gy)return[e];for(var t=[],n=0,r=e.size();n<r;n++){var i=e.lookup(n);(i instanceof ky||i instanceof gy)&&t.push(i)}return t}},t.prototype.removeExportValue=function(e){var t=this.Opt();if(t){if(t instanceof ky||t instanceof gy){if(e!==0)throw new P_(e,0,0);this.setOpt([])}else{if(e<0||e>t.size())throw new P_(e,0,t.size());t.remove(e)}}},t.prototype.normalizeExportValues=function(){for(var e=this.getExportValues()??[],t=[],n=this.getWidgets(),r=0,i=n.length;r<i;r++){var a=n[r],o=e[r]??gy.fromText(a.getOnValue()?.decodeText()??``);t.push(o)}this.setOpt(t)},t.prototype.addOpt=function(e,t){this.normalizeExportValues();var n=e.decodeText(),r;if(t)for(var i=this.getExportValues()??[],a=0,o=i.length;a<o;a++)i[a].decodeText()===n&&(r=a);var s=this.Opt();return s.push(e),r??s.size()-1},t.prototype.addWidgetWithOpt=function(e,t,n){var r=this.addOpt(t,n),i=Z.of(String(r));return this.addWidget(e),i},t}(Wb)})),Jb,Yb=s((()=>{K(),bv(),qb(),Y_(),Jb=function(e){G(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.setValue=function(e){if(e!==(this.getOnValue()??Z.of(`Yes`))&&e!==Z.of(`Off`))throw new F_;this.dict.set(Z.of(`V`),e);for(var t=this.getWidgets(),n=0,r=t.length;n<r;n++){var i=t[n],a=i.getOnValue()===e?e:Z.of(`Off`);i.setAppearanceState(a)}},t.prototype.getValue=function(){var e=this.V();return e instanceof Z?e:Z.of(`Off`)},t.prototype.getOnValue=function(){return this.getWidgets()[0]?.getOnValue()},t.fromDict=function(e,n){return new t(e,n)},t.create=function(e){var n=e.obj({FT:`Btn`,Kids:[]});return new t(n,e.register(n))},t}(Kb)})),Xb,Zb,Qb,$b,ex,tx=s((()=>{Xb=function(e){return 1<<e},(function(e){e[e.ReadOnly=Xb(0)]=`ReadOnly`,e[e.Required=Xb(1)]=`Required`,e[e.NoExport=Xb(2)]=`NoExport`})(Zb||={}),(function(e){e[e.NoToggleToOff=Xb(14)]=`NoToggleToOff`,e[e.Radio=Xb(15)]=`Radio`,e[e.PushButton=Xb(16)]=`PushButton`,e[e.RadiosInUnison=Xb(25)]=`RadiosInUnison`})(Qb||={}),(function(e){e[e.Multiline=Xb(12)]=`Multiline`,e[e.Password=Xb(13)]=`Password`,e[e.FileSelect=Xb(20)]=`FileSelect`,e[e.DoNotSpellCheck=Xb(22)]=`DoNotSpellCheck`,e[e.DoNotScroll=Xb(23)]=`DoNotScroll`,e[e.Comb=Xb(24)]=`Comb`,e[e.RichText=Xb(25)]=`RichText`})($b||={}),(function(e){e[e.Combo=Xb(17)]=`Combo`,e[e.Edit=Xb(18)]=`Edit`,e[e.Sort=Xb(19)]=`Sort`,e[e.MultiSelect=Xb(21)]=`MultiSelect`,e[e.DoNotSpellCheck=Xb(22)]=`DoNotSpellCheck`,e[e.CommitOnSelChange=Xb(26)]=`CommitOnSelChange`})(ex||={})})),nx,rx=s((()=>{K(),Gb(),_y(),Ay(),iv(),bv(),tx(),Y_(),nx=function(e){G(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.setValues=function(e){if(this.hasFlag(ex.Combo)&&!this.hasFlag(ex.Edit)&&!this.valuesAreValid(e))throw new F_;if(e.length===0&&this.dict.delete(Z.of(`V`)),e.length===1&&this.dict.set(Z.of(`V`),e[0]),e.length>1){if(!this.hasFlag(ex.MultiSelect))throw new I_;this.dict.set(Z.of(`V`),this.dict.context.obj(e))}this.updateSelectedIndices(e)},t.prototype.valuesAreValid=function(e){for(var t=this.getOptions(),n=function(n,r){var i=e[n].decodeText();if(!t.find(function(e){return i===(e.display||e.value).decodeText()}))return{value:!1}},r=0,i=e.length;r<i;r++){var a=n(r,i);if(typeof a==`object`)return a.value}return!0},t.prototype.updateSelectedIndices=function(e){if(e.length>1){for(var t=Array(e.length),n=this.getOptions(),r=function(r,i){var a=e[r].decodeText();t[r]=n.findIndex(function(e){return a===(e.display||e.value).decodeText()})},i=0,a=e.length;i<a;i++)r(i,a);this.dict.set(Z.of(`I`),this.dict.context.obj(t.sort()))}else this.dict.delete(Z.of(`I`))},t.prototype.getValues=function(){var e=this.V();if(e instanceof ky||e instanceof gy)return[e];if(e instanceof X){for(var t=[],n=0,r=e.size();n<r;n++){var i=e.lookup(n);(i instanceof ky||i instanceof gy)&&t.push(i)}return t}return[]},t.prototype.Opt=function(){return this.dict.lookupMaybe(Z.of(`Opt`),ky,gy,X)},t.prototype.setOptions=function(e){for(var t=Array(e.length),n=0,r=e.length;n<r;n++){var i=e[n],a=i.value,o=i.display;t[n]=this.dict.context.obj([a,o||a])}this.dict.set(Z.of(`Opt`),this.dict.context.obj(t))},t.prototype.getOptions=function(){var e=this.Opt();if(e instanceof ky||e instanceof gy)return[{value:e,display:e}];if(e instanceof X){for(var t=[],n=0,r=e.size();n<r;n++){var i=e.lookup(n);if((i instanceof ky||i instanceof gy)&&t.push({value:i,display:i}),i instanceof X&&i.size()>0){var a=i.lookup(0,ky,gy),o=i.lookupMaybe(1,ky,gy);t.push({value:a,display:o||a})}}return t}return[]},t}(Wb)})),ix,ax=s((()=>{K(),rx(),tx(),ix=function(e){G(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.fromDict=function(e,n){return new t(e,n)},t.create=function(e){var n=e.obj({FT:`Ch`,Ff:ex.Combo,Kids:[]});return new t(n,e.register(n))},t}(nx)})),ox,sx=s((()=>{K(),bv(),Fb(),ox=function(e){G(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.addField=function(e){this.normalizedEntries().Kids?.push(e)},t.prototype.normalizedEntries=function(){var e=this.Kids();return e||(e=this.dict.context.obj([]),this.dict.set(Z.of(`Kids`),e)),{Kids:e}},t.fromDict=function(e,n){return new t(e,n)},t.create=function(e){var n=e.obj({});return new t(n,e.register(n))},t}(Pb)})),cx,lx=s((()=>{K(),Gb(),cx=function(e){G(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.fromDict=function(e,n){return new t(e,n)},t}(Wb)})),ux,dx=s((()=>{K(),rv(),Ay(),_y(),bv(),Gb(),ux=function(e){G(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.MaxLen=function(){var e=this.dict.lookup(Z.of(`MaxLen`));if(e instanceof nv)return e},t.prototype.Q=function(){var e=this.dict.lookup(Z.of(`Q`));if(e instanceof nv)return e},t.prototype.setMaxLength=function(e){this.dict.set(Z.of(`MaxLen`),nv.of(e))},t.prototype.removeMaxLength=function(){this.dict.delete(Z.of(`MaxLen`))},t.prototype.getMaxLength=function(){return this.MaxLen()?.asNumber()},t.prototype.setQuadding=function(e){this.dict.set(Z.of(`Q`),nv.of(e))},t.prototype.getQuadding=function(){return this.Q()?.asNumber()},t.prototype.setValue=function(e){this.dict.set(Z.of(`V`),e)},t.prototype.removeValue=function(){this.dict.delete(Z.of(`V`))},t.prototype.getValue=function(){var e=this.V();if(e instanceof ky||e instanceof gy)return e},t.fromDict=function(e,n){return new t(e,n)},t.create=function(e){var n=e.obj({FT:`Tx`,Kids:[]});return new t(n,e.register(n))},t}(Wb)})),fx,px=s((()=>{K(),qb(),tx(),fx=function(e){G(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.fromDict=function(e,n){return new t(e,n)},t.create=function(e){var n=e.obj({FT:`Btn`,Ff:Qb.PushButton,Kids:[]});return new t(n,e.register(n))},t}(Kb)})),mx,hx=s((()=>{K(),bv(),qb(),tx(),Y_(),mx=function(e){G(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.setValue=function(e){if(!this.getOnValues().includes(e)&&e!==Z.of(`Off`))throw new F_;this.dict.set(Z.of(`V`),e);for(var t=this.getWidgets(),n=0,r=t.length;n<r;n++){var i=t[n],a=i.getOnValue()===e?e:Z.of(`Off`);i.setAppearanceState(a)}},t.prototype.getValue=function(){var e=this.V();return e instanceof Z?e:Z.of(`Off`)},t.prototype.getOnValues=function(){for(var e=this.getWidgets(),t=[],n=0,r=e.length;n<r;n++){var i=e[n].getOnValue();i&&t.push(i)}return t},t.fromDict=function(e,n){return new t(e,n)},t.create=function(e){var n=e.obj({FT:`Btn`,Ff:Qb.Radio,Kids:[]});return new t(n,e.register(n))},t}(Kb)})),gx,_x=s((()=>{K(),rx(),gx=function(e){G(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.fromDict=function(e,n){return new t(e,n)},t.create=function(e){var n=e.obj({FT:`Ch`,Kids:[]});return new t(n,e.register(n))},t}(nx)})),vx,yx,bx,xx,Sx,Cx,wx,Tx,Ex,Dx=s((()=>{rv(),wv(),bv(),iv(),Mv(),Gb(),sx(),lx(),dx(),px(),hx(),Yb(),ax(),_x(),tx(),vx=function(e){if(!e)return[];for(var t=[],n=0,r=e.size();n<r;n++){var i=e.get(n),a=e.lookup(n);i instanceof jv&&a instanceof Q&&t.push([yx(a,i),i])}return t},yx=function(e,t){return bx(e)?ox.fromDict(e,t):xx(e,t)},bx=function(e){var t=e.lookup(Z.of(`Kids`));if(t instanceof X)for(var n=0,r=t.size();n<r;n++){var i=t.lookup(n);if(i instanceof Q&&i.has(Z.of(`T`)))return!0}return!1},xx=function(e,t){var n=Tx(e,Z.of(`FT`)),r=e.context.lookup(n,Z);return r===Z.of(`Btn`)?Sx(e,t):r===Z.of(`Ch`)?Cx(e,t):r===Z.of(`Tx`)?ux.fromDict(e,t):r===Z.of(`Sig`)?cx.fromDict(e,t):Wb.fromDict(e,t)},Sx=function(e,t){var n=Tx(e,Z.of(`Ff`)),r=e.context.lookupMaybe(n,nv)?.asNumber()??0;return wx(r,Qb.PushButton)?fx.fromDict(e,t):wx(r,Qb.Radio)?mx.fromDict(e,t):Jb.fromDict(e,t)},Cx=function(e,t){var n=Tx(e,Z.of(`Ff`)),r=e.context.lookupMaybe(n,nv);return wx(r?.asNumber()??0,ex.Combo)?ix.fromDict(e,t):gx.fromDict(e,t)},wx=function(e,t){return(e&t)!==0},Tx=function(e,t){var n;return Ex(e,function(e){n||=e.get(t)}),n},Ex=function(e,t){t(e);var n=e.lookupMaybe(Z.of(`Parent`),Q);n&&Ex(n,t)}})),Ox,kx=s((()=>{wv(),iv(),bv(),sx(),Dx(),Ox=function(){function e(e){this.dict=e}return e.prototype.Fields=function(){var e=this.dict.lookup(Z.of(`Fields`));if(e instanceof X)return e},e.prototype.getFields=function(){for(var e=this.normalizedEntries().Fields,t=Array(e.size()),n=0,r=e.size();n<r;n++){var i=e.get(n),a=e.lookup(n,Q);t[n]=[yx(a,i),i]}return t},e.prototype.getAllFields=function(){var e=[],t=function(n){if(n)for(var r=0,i=n.length;r<i;r++){var a=n[r];e.push(a);var o=a[0];o instanceof ox&&t(vx(o.Kids()))}};return t(this.getFields()),e},e.prototype.addField=function(e){this.normalizedEntries().Fields?.push(e)},e.prototype.removeField=function(e){var t=e.getParent(),n=t===void 0?this.normalizedEntries().Fields:t.Kids(),r=n?.indexOf(e.ref);if(n===void 0||r===void 0)throw Error(`Tried to remove inexistent field `+e.getFullyQualifiedName());n.remove(r),t!==void 0&&n.size()===0&&this.removeField(t)},e.prototype.normalizedEntries=function(){var e=this.Fields();return e||(e=this.dict.context.obj([]),this.dict.set(Z.of(`Fields`),e)),{Fields:e}},e.fromDict=function(t){return new e(t)},e.create=function(t){return new e(t.obj({Fields:[]}))},e}()})),Ax=s((()=>{qb(),Yb(),rx(),ax(),Fb(),kx(),_x(),sx(),px(),hx(),lx(),Gb(),dx(),tx(),Dx()})),jx,Mx=s((()=>{K(),wv(),bv(),Ax(),Mb(),jx=function(e){G(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.Pages=function(){return this.lookup(Z.of(`Pages`),Q)},t.prototype.AcroForm=function(){return this.lookupMaybe(Z.of(`AcroForm`),Q)},t.prototype.getAcroForm=function(){var e=this.AcroForm();if(e)return Ox.fromDict(e)},t.prototype.getOrCreateAcroForm=function(){var e=this.getAcroForm();if(!e){e=Ox.create(this.context);var t=this.context.register(e.dict);this.set(Z.of(`AcroForm`),t)}return e},t.prototype.ViewerPreferences=function(){return this.lookupMaybe(Z.of(`ViewerPreferences`),Q)},t.prototype.getViewerPreferences=function(){var e=this.ViewerPreferences();if(e)return jb.fromDict(e)},t.prototype.getOrCreateViewerPreferences=function(){var e=this.getViewerPreferences();if(!e){e=jb.create(this.context);var t=this.context.register(e.dict);this.set(Z.of(`ViewerPreferences`),t)}return e},t.prototype.insertLeafNode=function(e,t){var n=this.get(Z.of(`Pages`));return this.Pages().insertLeafNode(e,t)||n},t.prototype.removeLeafNode=function(e){this.Pages().removeLeafNode(e)},t.withContextAndPages=function(e,n){var r=new Map;return r.set(Z.of(`Type`),Z.of(`Catalog`)),r.set(Z.of(`Pages`),n),new t(r,e)},t.fromMapWithContext=function(e,n){return new t(e,n)},t}(Q)})),Nx,Px=s((()=>{K(),iv(),wv(),bv(),rv(),Xv(),Y_(),Nx=function(e){G(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.Parent=function(){return this.lookup(Z.of(`Parent`))},t.prototype.Kids=function(){return this.lookup(Z.of(`Kids`),X)},t.prototype.Count=function(){return this.lookup(Z.of(`Count`),nv)},t.prototype.pushTreeNode=function(e){this.Kids().push(e)},t.prototype.pushLeafNode=function(e){var t=this.Kids();this.insertLeafKid(t.size(),e)},t.prototype.insertLeafNode=function(e,n){var r=this.Kids(),i=this.Count().asNumber();if(n>i)throw new M_(n,i);for(var a=n,o=0,s=r.size();o<s;o++){if(a===0){this.insertLeafKid(o,e);return}var c=r.get(o),l=this.context.lookup(c);if(l instanceof t){if(l.Count().asNumber()>a)return l.insertLeafNode(e,a)||c;a-=l.Count().asNumber()}l instanceof Yv&&--a}if(a===0)this.insertLeafKid(r.size(),e);else throw new N_(n,`insertLeafNode`)},t.prototype.removeLeafNode=function(e,n){n===void 0&&(n=!0);var r=this.Kids(),i=this.Count().asNumber();if(e>=i)throw new M_(e,i);for(var a=e,o=0,s=r.size();o<s;o++){var c=r.get(o),l=this.context.lookup(c);if(l instanceof t){if(l.Count().asNumber()>a){l.removeLeafNode(a,n),n&&l.Kids().size()===0&&r.remove(o);return}a-=l.Count().asNumber()}if(l instanceof Yv){if(a===0){this.removeKid(o);return}--a}}throw new N_(e,`removeLeafNode`)},t.prototype.ascend=function(e){e(this);var t=this.Parent();t&&t.ascend(e)},t.prototype.traverse=function(e){for(var n=this.Kids(),r=0,i=n.size();r<i;r++){var a=n.get(r),o=this.context.lookup(a);o instanceof t&&o.traverse(e),e(o,a)}},t.prototype.insertLeafKid=function(e,t){var n=this.Kids();this.ascend(function(e){var t=e.Count().asNumber()+1;e.set(Z.of(`Count`),nv.of(t))}),n.insert(e,t)},t.prototype.removeKid=function(e){var t=this.Kids();t.lookup(e)instanceof Yv&&this.ascend(function(e){var t=e.Count().asNumber()-1;e.set(Z.of(`Count`),nv.of(t))}),t.remove(e)},t.withContext=function(e,n){var r=new Map;return r.set(Z.of(`Type`),Z.of(`Pages`)),r.set(Z.of(`Kids`),e.obj([])),r.set(Z.of(`Count`),e.obj(0)),n&&r.set(Z.of(`Parent`),n),new t(r,e)},t.fromMapWithContext=function(e,n){return new t(e,n)},t}(Q)})),Fx,Ix,Lx,Rx,zx,Bx=s((()=>{for(Z_(),Fx=new Uint8Array(256),Fx[Y.Zero]=1,Fx[Y.One]=1,Fx[Y.Two]=1,Fx[Y.Three]=1,Fx[Y.Four]=1,Fx[Y.Five]=1,Fx[Y.Six]=1,Fx[Y.Seven]=1,Fx[Y.Eight]=1,Fx[Y.Nine]=1,Ix=new Uint8Array(256),Ix[Y.Period]=1,Ix[Y.Plus]=1,Ix[Y.Minus]=1,Lx=new Uint8Array(256),Rx=0,zx=256;Rx<zx;Rx++)Lx[Rx]=Fx[Rx]||Ix[Rx]?1:0})),Vx,Hx,Ux,Wx=s((()=>{Y_(),Z_(),Bx(),dv(),x_(),Vx=Y.Newline,Hx=Y.CarriageReturn,Ux=function(){function e(e,t){t===void 0&&(t=!1),this.bytes=e,this.capNumbers=t}return e.prototype.parseRawInt=function(){for(var e=``;!this.bytes.done();){var t=this.bytes.peek();if(!Fx[t])break;e+=Nm(this.bytes.next())}var n=Number(e);if(!e||!isFinite(n))throw new z_(this.bytes.position(),e);return n},e.prototype.parseRawNumber=function(){for(var e=``;!this.bytes.done();){var t=this.bytes.peek();if(!Lx[t]||(e+=Nm(this.bytes.next()),t===Y.Period))break}for(;!this.bytes.done();){var t=this.bytes.peek();if(!Fx[t])break;e+=Nm(this.bytes.next())}var n=Number(e);if(!e||!isFinite(n))throw new z_(this.bytes.position(),e);if(n>2**53-1){if(this.capNumbers){var r=`Parsed number that is too large for some PDF readers: `+e+`, using Number.MAX_SAFE_INTEGER instead.`;return console.warn(r),2**53-1}var r=`Parsed number that is too large for some PDF readers: `+e+`, not capping.`;console.warn(r)}return n},e.prototype.skipWhitespace=function(){for(;!this.bytes.done()&&uv[this.bytes.peek()];)this.bytes.next()},e.prototype.skipLine=function(){for(;!this.bytes.done();){var e=this.bytes.peek();if(e===Vx||e===Hx)return;this.bytes.next()}},e.prototype.skipComment=function(){if(this.bytes.peek()!==Y.Percent)return!1;for(;!this.bytes.done();){var e=this.bytes.peek();if(e===Vx||e===Hx)return!0;this.bytes.next()}return!0},e.prototype.skipWhitespaceAndComments=function(){for(this.skipWhitespace();this.skipComment();)this.skipWhitespace()},e.prototype.matchKeyword=function(e){for(var t=this.bytes.offset(),n=0,r=e.length;n<r;n++)if(this.bytes.done()||this.bytes.next()!==e[n])return this.bytes.moveTo(t),!1;return!0},e}()})),Gx,Kx=s((()=>{Y_(),xb(),Z_(),Gx=function(){function e(e){this.idx=0,this.line=0,this.column=0,this.bytes=e,this.length=this.bytes.length}return e.prototype.moveTo=function(e){this.idx=e},e.prototype.next=function(){var e=this.bytes[this.idx++];return e===Y.Newline?(this.line+=1,this.column=0):this.column+=1,e},e.prototype.assertNext=function(e){if(this.peek()!==e)throw new V_(this.position(),e,this.peek());return this.next()},e.prototype.peek=function(){return this.bytes[this.idx]},e.prototype.peekAhead=function(e){return this.bytes[this.idx+e]},e.prototype.peekAt=function(e){return this.bytes[e]},e.prototype.done=function(){return this.idx>=this.length},e.prototype.offset=function(){return this.idx},e.prototype.slice=function(e,t){return this.bytes.slice(e,t)},e.prototype.position=function(){return{line:this.line,column:this.column,offset:this.idx}},e.of=function(t){return new e(t)},e.fromPDFRawStream=function(t){return e.of(bb(t).decode())},e}()})),qx,Jx,Yx,Xx,Zx,Qx,$x=s((()=>{K(),Z_(),qx=Y.Space,Jx=Y.CarriageReturn,Yx=Y.Newline,Xx=[Y.s,Y.t,Y.r,Y.e,Y.a,Y.m],Zx=[Y.e,Y.n,Y.d,Y.s,Y.t,Y.r,Y.e,Y.a,Y.m],Qx={header:[Y.Percent,Y.P,Y.D,Y.F,Y.Dash],eof:[Y.Percent,Y.Percent,Y.E,Y.O,Y.F],obj:[Y.o,Y.b,Y.j],endobj:[Y.e,Y.n,Y.d,Y.o,Y.b,Y.j],xref:[Y.x,Y.r,Y.e,Y.f],trailer:[Y.t,Y.r,Y.a,Y.i,Y.l,Y.e,Y.r],startxref:[Y.s,Y.t,Y.a,Y.r,Y.t,Y.x,Y.r,Y.e,Y.f],true:[Y.t,Y.r,Y.u,Y.e],false:[Y.f,Y.a,Y.l,Y.s,Y.e],null:[Y.n,Y.u,Y.l,Y.l],stream:Xx,streamEOF1:vm(Xx,[qx,Jx,Yx]),streamEOF2:vm(Xx,[Jx,Yx]),streamEOF3:vm(Xx,[Jx]),streamEOF4:vm(Xx,[Yx]),endstream:Zx,EOF1endstream:vm([Jx,Yx],Zx),EOF2endstream:vm([Jx],Zx),EOF3endstream:vm([Yx],Zx)}})),eS,tS=s((()=>{K(),Y_(),iv(),sv(),wv(),_y(),bv(),Cv(),rv(),Ov(),Mv(),Ay(),Wx(),Kx(),Mx(),Xv(),Px(),Z_(),lv(),$x(),Bx(),dv(),x_(),eS=function(e){G(t,e);function t(t,n,r){r===void 0&&(r=!1);var i=e.call(this,t,r)||this;return i.context=n,i}return t.prototype.parseObject=function(){if(this.skipWhitespaceAndComments(),this.matchKeyword(Qx.true))return ov.True;if(this.matchKeyword(Qx.false))return ov.False;if(this.matchKeyword(Qx.null))return Sv;var e=this.bytes.peek();if(e===Y.LessThan&&this.bytes.peekAhead(1)===Y.LessThan)return this.parseDictOrStream();if(e===Y.LessThan)return this.parseHexString();if(e===Y.LeftParen)return this.parseString();if(e===Y.ForwardSlash)return this.parseName();if(e===Y.LeftSquareBracket)return this.parseArray();if(Lx[e])return this.parseNumberOrRef();throw new H_(this.bytes.position(),e)},t.prototype.parseNumberOrRef=function(){var e=this.parseRawNumber();this.skipWhitespaceAndComments();var t=this.bytes.offset();if(Fx[this.bytes.peek()]){var n=this.parseRawNumber();if(this.skipWhitespaceAndComments(),this.bytes.peek()===Y.R)return this.bytes.assertNext(Y.R),jv.of(e,n)}return this.bytes.moveTo(t),nv.of(e)},t.prototype.parseHexString=function(){var e=``;for(this.bytes.assertNext(Y.LessThan);!this.bytes.done()&&this.bytes.peek()!==Y.GreaterThan;)e+=Nm(this.bytes.next());return this.bytes.assertNext(Y.GreaterThan),gy.of(e)},t.prototype.parseString=function(){for(var e=0,t=!1,n=``;!this.bytes.done();){var r=this.bytes.next();if(n+=Nm(r),t||(r===Y.LeftParen&&(e+=1),r===Y.RightParen&&--e),r===Y.BackSlash?t=!t:t&&=!1,e===0)return ky.of(n.substring(1,n.length-1))}throw new G_(this.bytes.position())},t.prototype.parseName=function(){this.bytes.assertNext(Y.ForwardSlash);for(var e=``;!this.bytes.done();){var t=this.bytes.peek();if(uv[t]||cv[t])break;e+=Nm(t),this.bytes.next()}return Z.of(e)},t.prototype.parseArray=function(){this.bytes.assertNext(Y.LeftSquareBracket),this.skipWhitespaceAndComments();for(var e=X.withContext(this.context);this.bytes.peek()!==Y.RightSquareBracket;){var t=this.parseObject();e.push(t),this.skipWhitespaceAndComments()}return this.bytes.assertNext(Y.RightSquareBracket),e},t.prototype.parseDict=function(){this.bytes.assertNext(Y.LessThan),this.bytes.assertNext(Y.LessThan),this.skipWhitespaceAndComments();for(var e=new Map;!this.bytes.done()&&this.bytes.peek()!==Y.GreaterThan&&this.bytes.peekAhead(1)!==Y.GreaterThan;){var t=this.parseName(),n=this.parseObject();e.set(t,n),this.skipWhitespaceAndComments()}this.skipWhitespaceAndComments(),this.bytes.assertNext(Y.GreaterThan),this.bytes.assertNext(Y.GreaterThan);var r=e.get(Z.of(`Type`));return r===Z.of(`Catalog`)?jx.fromMapWithContext(e,this.context):r===Z.of(`Pages`)?Nx.fromMapWithContext(e,this.context):r===Z.of(`Page`)?Yv.fromMapWithContext(e,this.context):Q.fromMapWithContext(e,this.context)},t.prototype.parseDictOrStream=function(){var e=this.bytes.position(),t=this.parseDict();if(this.skipWhitespaceAndComments(),!this.matchKeyword(Qx.streamEOF1)&&!this.matchKeyword(Qx.streamEOF2)&&!this.matchKeyword(Qx.streamEOF3)&&!this.matchKeyword(Qx.streamEOF4)&&!this.matchKeyword(Qx.stream))return t;var n=this.bytes.offset(),r,i=t.get(Z.of(`Length`));i instanceof nv?(r=n+i.asNumber(),this.bytes.moveTo(r),this.skipWhitespaceAndComments(),this.matchKeyword(Qx.endstream)||(this.bytes.moveTo(n),r=this.findEndOfStreamFallback(e))):r=this.findEndOfStreamFallback(e);var a=this.bytes.slice(n,r);return Dv.of(t,a)},t.prototype.findEndOfStreamFallback=function(e){for(var t=1,n=this.bytes.offset();!this.bytes.done()&&(n=this.bytes.offset(),this.matchKeyword(Qx.stream)?t+=1:this.matchKeyword(Qx.EOF1endstream)||this.matchKeyword(Qx.EOF2endstream)||this.matchKeyword(Qx.EOF3endstream)||this.matchKeyword(Qx.endstream)?--t:this.bytes.next(),t!==0););if(t!==0)throw new W_(e);return n},t.forBytes=function(e,n,r){return new t(Gx.of(e),n,r)},t.forByteStream=function(e,n,r){return r===void 0&&(r=!1),new t(e,n,r)},t}(Ux)})),nS,rS=s((()=>{K(),Y_(),bv(),rv(),Mv(),Kx(),tS(),x_(),nS=function(e){G(t,e);function t(t,n){var r=e.call(this,Gx.fromPDFRawStream(t),t.dict.context)||this,i=t.dict;return r.alreadyParsed=!1,r.shouldWaitForTick=n||(function(){return!1}),r.firstOffset=i.lookup(Z.of(`First`),nv).asNumber(),r.objectCount=i.lookup(Z.of(`N`),nv).asNumber(),r}return t.prototype.parseIntoContext=function(){return gm(this,void 0,void 0,function(){var e,t,n,r,i,a,o,s;return _m(this,function(c){switch(c.label){case 0:if(this.alreadyParsed)throw new E_(`PDFObjectStreamParser`,`parseIntoContext`);this.alreadyParsed=!0,e=this.parseOffsetsAndObjectNumbers(),t=0,n=e.length,c.label=1;case 1:return t<n?(r=e[t],i=r.objectNumber,a=r.offset,this.bytes.moveTo(this.firstOffset+a),o=this.parseObject(),s=jv.of(i,0),this.context.assign(s,o),this.shouldWaitForTick()?[4,dh()]:[3,3]):[3,4];case 2:c.sent(),c.label=3;case 3:return t++,[3,1];case 4:return[2]}})})},t.prototype.parseOffsetsAndObjectNumbers=function(){for(var e=[],t=0,n=this.objectCount;t<n;t++){this.skipWhitespaceAndComments();var r=this.parseRawInt();this.skipWhitespaceAndComments();var i=this.parseRawInt();e.push({objectNumber:r,offset:i})}return e},t.forStream=function(e,n){return new t(e,n)},t}(eS)})),iS,aS=s((()=>{Y_(),iv(),bv(),rv(),Mv(),Kx(),iS=function(){function e(e){this.alreadyParsed=!1,this.dict=e.dict,this.bytes=Gx.fromPDFRawStream(e),this.context=this.dict.context;var t=this.dict.lookup(Z.of(`Size`),nv),n=this.dict.lookup(Z.of(`Index`));if(n instanceof X){this.subsections=[];for(var r=0,i=n.size();r<i;r+=2){var a=n.lookup(r+0,nv).asNumber(),o=n.lookup(r+1,nv).asNumber();this.subsections.push({firstObjectNumber:a,length:o})}}else this.subsections=[{firstObjectNumber:0,length:t.asNumber()}];var s=this.dict.lookup(Z.of(`W`),X);this.byteWidths=[-1,-1,-1];for(var r=0,i=s.size();r<i;r++)this.byteWidths[r]=s.lookup(r,nv).asNumber()}return e.prototype.parseIntoContext=function(){if(this.alreadyParsed)throw new E_(`PDFXRefStreamParser`,`parseIntoContext`);return this.alreadyParsed=!0,this.context.trailerInfo={Root:this.dict.get(Z.of(`Root`)),Encrypt:this.dict.get(Z.of(`Encrypt`)),Info:this.dict.get(Z.of(`Info`)),ID:this.dict.get(Z.of(`ID`))},this.parseEntries()},e.prototype.parseEntries=function(){for(var e=[],t=this.byteWidths,n=t[0],r=t[1],i=t[2],a=0,o=this.subsections.length;a<o;a++)for(var s=this.subsections[a],c=s.firstObjectNumber,l=s.length,u=0;u<l;u++){for(var d=0,f=0,p=n;f<p;f++)d=d<<8|this.bytes.next();for(var m=0,f=0,p=r;f<p;f++)m=m<<8|this.bytes.next();for(var h=0,f=0,p=i;f<p;f++)h=h<<8|this.bytes.next();n===0&&(d=1);var g=c+u,_={ref:jv.of(g,h),offset:m,deleted:d===0,inObjectStream:d===2};e.push(_)}return e},e.forStream=function(t){return new e(t)},e}()})),oS,sS=s((()=>{K(),ey(),$_(),ny(),Y_(),wv(),uy(),bv(),Ov(),Mv(),Kx(),tS(),rS(),aS(),Jv(),Z_(),$x(),Bx(),x_(),oS=function(e){G(t,e);function t(t,n,r,i){n===void 0&&(n=1/0),r===void 0&&(r=!1),i===void 0&&(i=!1);var a=e.call(this,Gx.of(t),qv.create(),i)||this;return a.alreadyParsed=!1,a.parsedObjects=0,a.shouldWaitForTick=function(){return a.parsedObjects+=1,a.parsedObjects%a.objectsPerTick===0},a.objectsPerTick=n,a.throwOnInvalidObject=r,a}return t.prototype.parseDocument=function(){return gm(this,void 0,void 0,function(){var e,t;return _m(this,function(n){switch(n.label){case 0:if(this.alreadyParsed)throw new E_(`PDFParser`,`parseDocument`);this.alreadyParsed=!0,this.context.header=this.parseHeader(),n.label=1;case 1:return this.bytes.done()?[3,3]:[4,this.parseDocumentSection()];case 2:if(n.sent(),t=this.bytes.offset(),t===e)throw new K_(this.bytes.position());return e=t,[3,1];case 3:return this.maybeRecoverRoot(),this.context.lookup(jv.of(0))&&(console.warn(`Removing parsed object: 0 0 R`),this.context.delete(jv.of(0))),[2,this.context]}})})},t.prototype.maybeRecoverRoot=function(){var e=function(e){return e instanceof Q&&e.lookup(Z.of(`Type`))===Z.of(`Catalog`)};if(!e(this.context.lookup(this.context.trailerInfo.Root)))for(var t=this.context.enumerateIndirectObjects(),n=0,r=t.length;n<r;n++){var i=t[n],a=i[0],o=i[1];e(o)&&(this.context.trailerInfo.Root=a)}},t.prototype.parseHeader=function(){for(;!this.bytes.done();){if(this.matchKeyword(Qx.header)){var e=this.parseRawInt();this.bytes.assertNext(Y.Period);var t=this.parseRawInt(),n=Q_.forVersion(e,t);return this.skipBinaryHeaderComment(),n}this.bytes.next()}throw new q_(this.bytes.position())},t.prototype.parseIndirectObjectHeader=function(){this.skipWhitespaceAndComments();var e=this.parseRawInt();this.skipWhitespaceAndComments();var t=this.parseRawInt();if(this.skipWhitespaceAndComments(),!this.matchKeyword(Qx.obj))throw new J_(this.bytes.position(),Qx.obj);return jv.of(e,t)},t.prototype.matchIndirectObjectHeader=function(){var e=this.bytes.offset();try{return this.parseIndirectObjectHeader(),!0}catch{return this.bytes.moveTo(e),!1}},t.prototype.parseIndirectObject=function(){return gm(this,void 0,void 0,function(){var e,t;return _m(this,function(n){switch(n.label){case 0:return e=this.parseIndirectObjectHeader(),this.skipWhitespaceAndComments(),t=this.parseObject(),this.skipWhitespaceAndComments(),this.matchKeyword(Qx.endobj),t instanceof Dv&&t.dict.lookup(Z.of(`Type`))===Z.of(`ObjStm`)?[4,nS.forStream(t,this.shouldWaitForTick).parseIntoContext()]:[3,2];case 1:return n.sent(),[3,3];case 2:t instanceof Dv&&t.dict.lookup(Z.of(`Type`))===Z.of(`XRef`)?iS.forStream(t).parseIntoContext():this.context.assign(e,t),n.label=3;case 3:return[2,e]}})})},t.prototype.tryToParseInvalidIndirectObject=function(){var e=this.bytes.position(),t=`Trying to parse invalid object: `+JSON.stringify(e)+`)`;if(this.throwOnInvalidObject)throw Error(t);console.warn(t);var n=this.parseIndirectObjectHeader();console.warn(`Invalid object ref: `+n),this.skipWhitespaceAndComments();for(var r=this.bytes.offset(),i=!0;!this.bytes.done()&&(this.matchKeyword(Qx.endobj)&&(i=!1),i);)this.bytes.next();if(i)throw new U_(e);var a=this.bytes.offset()-Qx.endobj.length,o=ly.of(this.bytes.slice(r,a));return this.context.assign(n,o),n},t.prototype.parseIndirectObjects=function(){return gm(this,void 0,void 0,function(){var e;return _m(this,function(t){switch(t.label){case 0:this.skipWhitespaceAndComments(),t.label=1;case 1:if(this.bytes.done()||!Fx[this.bytes.peek()])return[3,8];e=this.bytes.offset(),t.label=2;case 2:return t.trys.push([2,4,,5]),[4,this.parseIndirectObject()];case 3:return t.sent(),[3,5];case 4:return t.sent(),this.bytes.moveTo(e),this.tryToParseInvalidIndirectObject(),[3,5];case 5:return this.skipWhitespaceAndComments(),this.skipJibberish(),this.shouldWaitForTick()?[4,dh()]:[3,7];case 6:t.sent(),t.label=7;case 7:return[3,1];case 8:return[2]}})})},t.prototype.maybeParseCrossRefSection=function(){if(this.skipWhitespaceAndComments(),this.matchKeyword(Qx.xref)){this.skipWhitespaceAndComments();for(var e=-1,t=$v.createEmpty();!this.bytes.done()&&Fx[this.bytes.peek()];){var n=this.parseRawInt();this.skipWhitespaceAndComments();var r=this.parseRawInt();this.skipWhitespaceAndComments();var i=this.bytes.peek();if(i===Y.n||i===Y.f){var a=jv.of(e,r);this.bytes.next()===Y.n?t.addEntry(a,n):t.addDeletedEntry(a,n),e+=1}else e=n;this.skipWhitespaceAndComments()}return t}},t.prototype.maybeParseTrailerDict=function(){if(this.skipWhitespaceAndComments(),this.matchKeyword(Qx.trailer)){this.skipWhitespaceAndComments();var e=this.parseDict(),t=this.context;t.trailerInfo={Root:e.get(Z.of(`Root`))||t.trailerInfo.Root,Encrypt:e.get(Z.of(`Encrypt`))||t.trailerInfo.Encrypt,Info:e.get(Z.of(`Info`))||t.trailerInfo.Info,ID:e.get(Z.of(`ID`))||t.trailerInfo.ID}}},t.prototype.maybeParseTrailer=function(){if(this.skipWhitespaceAndComments(),this.matchKeyword(Qx.startxref)){this.skipWhitespaceAndComments();var e=this.parseRawInt();return this.skipWhitespace(),this.matchKeyword(Qx.eof),this.skipWhitespaceAndComments(),this.matchKeyword(Qx.eof),this.skipWhitespaceAndComments(),ty.forLastCrossRefSectionOffset(e)}},t.prototype.parseDocumentSection=function(){return gm(this,void 0,void 0,function(){return _m(this,function(e){switch(e.label){case 0:return[4,this.parseIndirectObjects()];case 1:return e.sent(),this.maybeParseCrossRefSection(),this.maybeParseTrailerDict(),this.maybeParseTrailer(),this.skipJibberish(),[2]}})})},t.prototype.skipJibberish=function(){for(this.skipWhitespaceAndComments();!this.bytes.done();){var e=this.bytes.offset(),t=this.bytes.peek();if(t>=Y.Space&&t<=Y.Tilde&&(this.matchKeyword(Qx.xref)||this.matchKeyword(Qx.trailer)||this.matchKeyword(Qx.startxref)||this.matchIndirectObjectHeader())){this.bytes.moveTo(e);break}this.bytes.next()}},t.prototype.skipBinaryHeaderComment=function(){this.skipWhitespaceAndComments();try{var e=this.bytes.offset();this.parseIndirectObjectHeader(),this.bytes.moveTo(e)}catch{this.bytes.next(),this.skipWhitespaceAndComments()}},t.forBytesWithOptions=function(e,n,r,i){return new t(e,n,r,i)},t}(eS)})),cS,lS,uS=s((()=>{cS=function(e){return 1<<e},(function(e){e[e.Invisible=cS(0)]=`Invisible`,e[e.Hidden=cS(1)]=`Hidden`,e[e.Print=cS(2)]=`Print`,e[e.NoZoom=cS(3)]=`NoZoom`,e[e.NoRotate=cS(4)]=`NoRotate`,e[e.NoView=cS(5)]=`NoView`,e[e.ReadOnly=cS(6)]=`ReadOnly`,e[e.Locked=cS(7)]=`Locked`,e[e.ToggleNoView=cS(8)]=`ToggleNoView`,e[e.LockedContents=cS(9)]=`LockedContents`})(lS||={})})),dS=s((()=>{zb(),Ub(),Vb(),uS()})),fS=s((()=>{Y_(),Z_(),Jv(),Qv(),cy(),hy(),$_(),ny(),iy(),ey(),yy(),My(),Py(),Ly(),Hy(),Zy(),Tb(),Mb(),tv(),sv(),rv(),Ay(),_y(),bv(),Cv(),iv(),wv(),Mv(),uy(),Ev(),Ov(),Mx(),Hv(),py(),oy(),Px(),Xv(),Bv(),Pv(),Lv(),tS(),rS(),sS(),aS(),xb(),dS(),Ax()})),pS,mS,hS,gS=s((()=>{fS(),pS=function(e){return e instanceof Z?e:Z.of(e)},mS=function(e){return e instanceof nv?e:nv.of(e)},hS=function(e){return e instanceof nv?e.asNumber():e}})),_S,vS,yS,bS,xS,SS,CS,wS,TS,ES,DS,OS=s((()=>{x_(),(function(e){e.Degrees=`degrees`,e.Radians=`radians`})(_S||={}),vS=function(e){return q(e,`degreeAngle`,[`number`]),{type:_S.Degrees,angle:e}},yS=_S.Radians,bS=_S.Degrees,xS=function(e){return e*Math.PI/180},SS=function(e){return e*180/Math.PI},CS=function(e){return e.type===yS?e.angle:e.type===bS?xS(e.angle):Nh(`Invalid rotation: `+JSON.stringify(e))},wS=function(e){return e.type===yS?SS(e.angle):e.type===bS?e.angle:Nh(`Invalid rotation: `+JSON.stringify(e))},TS=function(e){e===void 0&&(e=0);var t=e/90%4;return t===0?0:t===1?90:t===2?180:t===3?270:0},ES=function(e,t){t===void 0&&(t=0);var n=TS(t);return n===90||n===270?{width:e.height,height:e.width}:{width:e.width,height:e.height}},DS=function(e,t,n){t===void 0&&(t=0),n===void 0&&(n=0);var r=e.x,i=e.y,a=e.width,o=e.height,s=TS(n),c=t/2;return s===0?{x:r-c,y:i-c,width:a,height:o}:s===90?{x:r-o+c,y:i-c,width:o,height:a}:s===180?{x:r-a+c,y:i-o+c,width:a,height:o}:s===270?{x:r-c,y:i-a+c,width:o,height:a}:{x:r-c,y:i-c,width:a,height:o}}})),kS,AS,jS,MS,NS,PS,FS,IS,LS,RS,zS,BS,VS,HS,US,WS,GS,KS,qS,JS,YS,XS,ZS,QS,$S,eC,tC,nC,rC,iC,aC,oC,sC,cC,lC,uC,dC,fC,pC,mC,hC,gC,_C,vC,yC,bC=s((()=>{gS(),OS(),fS(),kS=function(){return Nv.of(Iv.ClipNonZero)},AS=Math.cos,jS=Math.sin,MS=Math.tan,NS=function(e,t,n,r,i,a){return Nv.of(Iv.ConcatTransformationMatrix,[mS(e),mS(t),mS(n),mS(r),mS(i),mS(a)])},PS=function(e,t){return NS(1,0,0,1,e,t)},FS=function(e,t){return NS(e,0,0,t,0,0)},IS=function(e){return NS(AS(hS(e)),jS(hS(e)),-jS(hS(e)),AS(hS(e)),0,0)},LS=function(e){return IS(xS(hS(e)))},RS=function(e,t){return NS(1,MS(hS(e)),MS(hS(t)),1,0,0)},zS=function(e,t){return Nv.of(Iv.SetLineDashPattern,[`[`+e.map(mS).join(` `)+`]`,mS(t)])},(function(e){e[e.Butt=0]=`Butt`,e[e.Round=1]=`Round`,e[e.Projecting=2]=`Projecting`})(BS||={}),VS=function(e){return Nv.of(Iv.SetLineCapStyle,[mS(e)])},(function(e){e[e.Miter=0]=`Miter`,e[e.Round=1]=`Round`,e[e.Bevel=2]=`Bevel`})(HS||={}),US=function(e){return Nv.of(Iv.SetGraphicsStateParams,[pS(e)])},WS=function(){return Nv.of(Iv.PushGraphicsState)},GS=function(){return Nv.of(Iv.PopGraphicsState)},KS=function(e){return Nv.of(Iv.SetLineWidth,[mS(e)])},qS=function(e,t,n,r,i,a){return Nv.of(Iv.AppendBezierCurve,[mS(e),mS(t),mS(n),mS(r),mS(i),mS(a)])},JS=function(e,t,n,r){return Nv.of(Iv.CurveToReplicateInitialPoint,[mS(e),mS(t),mS(n),mS(r)])},YS=function(){return Nv.of(Iv.ClosePath)},XS=function(e,t){return Nv.of(Iv.MoveTo,[mS(e),mS(t)])},ZS=function(e,t){return Nv.of(Iv.LineTo,[mS(e),mS(t)])},QS=function(){return Nv.of(Iv.StrokePath)},$S=function(){return Nv.of(Iv.FillNonZero)},eC=function(){return Nv.of(Iv.FillNonZeroAndStroke)},tC=function(){return Nv.of(Iv.EndPath)},nC=function(){return Nv.of(Iv.NextLine)},rC=function(e){return Nv.of(Iv.ShowText,[e])},iC=function(){return Nv.of(Iv.BeginText)},aC=function(){return Nv.of(Iv.EndText)},oC=function(e,t){return Nv.of(Iv.SetFontAndSize,[pS(e),mS(t)])},sC=function(e){return Nv.of(Iv.SetTextLineHeight,[mS(e)])},(function(e){e[e.Fill=0]=`Fill`,e[e.Outline=1]=`Outline`,e[e.FillAndOutline=2]=`FillAndOutline`,e[e.Invisible=3]=`Invisible`,e[e.FillAndClip=4]=`FillAndClip`,e[e.OutlineAndClip=5]=`OutlineAndClip`,e[e.FillAndOutlineAndClip=6]=`FillAndOutlineAndClip`,e[e.Clip=7]=`Clip`})(cC||={}),lC=function(e,t,n,r,i,a){return Nv.of(Iv.SetTextMatrix,[mS(e),mS(t),mS(n),mS(r),mS(i),mS(a)])},uC=function(e,t,n,r,i){return lC(AS(hS(e)),jS(hS(e))+MS(hS(t)),-jS(hS(e))+MS(hS(n)),AS(hS(e)),r,i)},dC=function(e){return Nv.of(Iv.DrawObject,[pS(e)])},fC=function(e){return Nv.of(Iv.NonStrokingColorGray,[mS(e)])},pC=function(e){return Nv.of(Iv.StrokingColorGray,[mS(e)])},mC=function(e,t,n){return Nv.of(Iv.NonStrokingColorRgb,[mS(e),mS(t),mS(n)])},hC=function(e,t,n){return Nv.of(Iv.StrokingColorRgb,[mS(e),mS(t),mS(n)])},gC=function(e,t,n,r){return Nv.of(Iv.NonStrokingColorCmyk,[mS(e),mS(t),mS(n),mS(r)])},_C=function(e,t,n,r){return Nv.of(Iv.StrokingColorCmyk,[mS(e),mS(t),mS(n),mS(r)])},vC=function(e){return Nv.of(Iv.BeginMarkedContent,[pS(e)])},yC=function(){return Nv.of(Iv.EndMarkedContent)}})),xC,SC,CC,wC,TC,EC,DC,OC,kC,AC,jC,MC=s((()=>{bC(),x_(),(function(e){e.Grayscale=`Grayscale`,e.RGB=`RGB`,e.CMYK=`CMYK`})(xC||={}),SC=function(e){return l_(e,`gray`,0,1),{type:xC.Grayscale,gray:e}},CC=function(e,t,n){return l_(e,`red`,0,1),l_(t,`green`,0,1),l_(n,`blue`,0,1),{type:xC.RGB,red:e,green:t,blue:n}},wC=function(e,t,n,r){return l_(e,`cyan`,0,1),l_(t,`magenta`,0,1),l_(n,`yellow`,0,1),l_(r,`key`,0,1),{type:xC.CMYK,cyan:e,magenta:t,yellow:n,key:r}},TC=xC.Grayscale,EC=xC.RGB,DC=xC.CMYK,OC=function(e){return e.type===TC?fC(e.gray):e.type===EC?mC(e.red,e.green,e.blue):e.type===DC?gC(e.cyan,e.magenta,e.yellow,e.key):Nh(`Invalid color: `+JSON.stringify(e))},kC=function(e){return e.type===TC?pC(e.gray):e.type===EC?hC(e.red,e.green,e.blue):e.type===DC?_C(e.cyan,e.magenta,e.yellow,e.key):Nh(`Invalid color: `+JSON.stringify(e))},AC=function(e,t){return t===void 0&&(t=1),e?.length===1?SC(e[0]*t):e?.length===3?CC(e[0]*t,e[1]*t,e[2]*t):e?.length===4?wC(e[0]*t,e[1]*t,e[2]*t,e[3]*t):void 0},jC=function(e){return e.type===TC?[e.gray]:e.type===EC?[e.red,e.green,e.blue]:e.type===DC?[e.cyan,e.magenta,e.yellow,e.key]:Nh(`Invalid color: `+JSON.stringify(e))}})),NC,PC,FC,IC,LC,RC,zC,BC,VC,HC,UC,WC,GC,KC,qC=s((()=>{bC(),NC=0,PC=0,FC=0,IC=0,LC=0,RC=0,zC=new Map([[`A`,7],[`a`,7],[`C`,6],[`c`,6],[`H`,1],[`h`,1],[`L`,2],[`l`,2],[`M`,2],[`m`,2],[`Q`,4],[`q`,4],[`S`,4],[`s`,4],[`T`,2],[`t`,2],[`V`,1],[`v`,1],[`Z`,0],[`z`,0]]),BC=function(e){for(var t,n=[],r=[],i=``,a=!1,o=0,s=0,c=e;s<c.length;s++){var l=c[s];if(zC.has(l))o=zC.get(l),t&&(i.length>0&&(r[r.length]=+i),n[n.length]={cmd:t,args:r},r=[],i=``,a=!1),t=l;else if([` `,`,`].includes(l)||l===`-`&&i.length>0&&i[i.length-1]!==`e`||l===`.`&&a){if(i.length===0)continue;r.length===o?(n[n.length]={cmd:t,args:r},r=[+i],t===`M`&&(t=`L`),t===`m`&&(t=`l`)):r[r.length]=+i,a=l===`.`,i=[`-`,`.`].includes(l)?l:``}else i+=l,l===`.`&&(a=!0)}return i.length>0&&(r.length===o?(n[n.length]={cmd:t,args:r},r=[+i],t===`M`&&(t=`L`),t===`m`&&(t=`l`)):r[r.length]=+i),n[n.length]={cmd:t,args:r},n},VC=function(e){NC=PC=FC=IC=LC=RC=0;for(var t=[],n=0;n<e.length;n++){var r=e[n];if(r.cmd&&typeof HC[r.cmd]==`function`){var i=HC[r.cmd](r.args);Array.isArray(i)?t=t.concat(i):t.push(i)}}return t},HC={M:function(e){return NC=e[0],PC=e[1],FC=IC=null,LC=NC,RC=PC,XS(NC,PC)},m:function(e){return NC+=e[0],PC+=e[1],FC=IC=null,LC=NC,RC=PC,XS(NC,PC)},C:function(e){return NC=e[4],PC=e[5],FC=e[2],IC=e[3],qS(e[0],e[1],e[2],e[3],e[4],e[5])},c:function(e){var t=qS(e[0]+NC,e[1]+PC,e[2]+NC,e[3]+PC,e[4]+NC,e[5]+PC);return FC=NC+e[2],IC=PC+e[3],NC+=e[4],PC+=e[5],t},S:function(e){(FC===null||IC===null)&&(FC=NC,IC=PC);var t=qS(NC-(FC-NC),PC-(IC-PC),e[0],e[1],e[2],e[3]);return FC=e[0],IC=e[1],NC=e[2],PC=e[3],t},s:function(e){(FC===null||IC===null)&&(FC=NC,IC=PC);var t=qS(NC-(FC-NC),PC-(IC-PC),NC+e[0],PC+e[1],NC+e[2],PC+e[3]);return FC=NC+e[0],IC=PC+e[1],NC+=e[2],PC+=e[3],t},Q:function(e){return FC=e[0],IC=e[1],NC=e[2],PC=e[3],JS(e[0],e[1],NC,PC)},q:function(e){var t=JS(e[0]+NC,e[1]+PC,e[2]+NC,e[3]+PC);return FC=NC+e[0],IC=PC+e[1],NC+=e[2],PC+=e[3],t},T:function(e){FC===null||IC===null?(FC=NC,IC=PC):(FC=NC-(FC-NC),IC=PC-(IC-PC));var t=JS(FC,IC,e[0],e[1]);return FC=NC-(FC-NC),IC=PC-(IC-PC),NC=e[0],PC=e[1],t},t:function(e){FC===null||IC===null?(FC=NC,IC=PC):(FC=NC-(FC-NC),IC=PC-(IC-PC));var t=JS(FC,IC,NC+e[0],PC+e[1]);return NC+=e[0],PC+=e[1],t},A:function(e){var t=UC(NC,PC,e);return NC=e[5],PC=e[6],t},a:function(e){e[5]+=NC,e[6]+=PC;var t=UC(NC,PC,e);return NC=e[5],PC=e[6],t},L:function(e){return NC=e[0],PC=e[1],FC=IC=null,ZS(NC,PC)},l:function(e){return NC+=e[0],PC+=e[1],FC=IC=null,ZS(NC,PC)},H:function(e){return NC=e[0],FC=IC=null,ZS(NC,PC)},h:function(e){return NC+=e[0],FC=IC=null,ZS(NC,PC)},V:function(e){return PC=e[0],FC=IC=null,ZS(NC,PC)},v:function(e){return PC+=e[0],FC=IC=null,ZS(NC,PC)},Z:function(){var e=YS();return NC=LC,PC=RC,e},z:function(){var e=YS();return NC=LC,PC=RC,e}},UC=function(e,t,n){for(var r=n[0],i=n[1],a=n[2],o=n[3],s=n[4],c=n[5],l=n[6],u=WC(c,l,r,i,o,s,a,e,t),d=[],f=0,p=u;f<p.length;f++){var m=p[f],h=GC.apply(void 0,m);d.push(qS.apply(void 0,h))}return d},WC=function(e,t,n,r,i,a,o,s,c){var l=Math.PI/180*o,u=Math.sin(l),d=Math.cos(l);n=Math.abs(n),r=Math.abs(r),FC=d*(s-e)*.5+u*(c-t)*.5,IC=d*(c-t)*.5-u*(s-e)*.5;var f=FC*FC/(n*n)+IC*IC/(r*r);f>1&&(f=Math.sqrt(f),n*=f,r*=f);var p=d/n,m=u/n,h=-u/r,g=d/r,_=p*s+m*c,v=h*s+g*c,y=p*e+m*t,b=h*e+g*t,x=1/((y-_)*(y-_)+(b-v)*(b-v))-.25;x<0&&(x=0);var S=Math.sqrt(x);a===i&&(S=-S);var C=.5*(_+y)-S*(b-v),w=.5*(v+b)+S*(y-_),T=Math.atan2(v-w,_-C),E=Math.atan2(b-w,y-C)-T;E<0&&a===1?E+=2*Math.PI:E>0&&a===0&&(E-=2*Math.PI);for(var D=Math.ceil(Math.abs(E/(Math.PI*.5+.001))),O=[],k=0;k<D;k++){var A=T+k*E/D,j=T+(k+1)*E/D;O[k]=[C,w,A,j,n,r,u,d]}return O},GC=function(e,t,n,r,i,a,o,s){var c=s*i,l=-o*a,u=o*i,d=s*a,f=.5*(r-n),p=8/3*Math.sin(f*.5)*Math.sin(f*.5)/Math.sin(f),m=e+Math.cos(n)-p*Math.sin(n),h=t+Math.sin(n)+p*Math.cos(n),g=e+Math.cos(r),_=t+Math.sin(r),v=g+p*Math.sin(r),y=_-p*Math.cos(r);return[c*m+l*h,u*m+d*h,c*v+l*y,u*v+d*y,c*g+l*_,u*g+d*_]},KC=function(e){return VC(BC(e))}})),JC,YC,XC,ZC,QC,$C,ew,tw,nw,rw,iw,aw,ow,sw,cw,lw,uw,dw,fw=s((()=>{K(),MC(),bC(),OS(),qC(),gS(),JC=function(e,t){for(var n=[WS(),t.graphicsState&&US(t.graphicsState),iC(),OC(t.color),oC(t.font,t.size),sC(t.lineHeight),uC(CS(t.rotate),CS(t.xSkew),CS(t.ySkew),t.x,t.y)].filter(Boolean),r=0,i=e.length;r<i;r++)n.push(rC(e[r]),nC());return n.push(aC(),GS()),n},YC=function(e,t){return[WS(),t.graphicsState&&US(t.graphicsState),PS(t.x,t.y),IS(CS(t.rotate)),FS(t.width,t.height),RS(CS(t.xSkew),CS(t.ySkew)),dC(e),GS()].filter(Boolean)},XC=function(e,t){return[WS(),t.graphicsState&&US(t.graphicsState),PS(t.x,t.y),IS(CS(t.rotate)),FS(t.xScale,t.yScale),RS(CS(t.xSkew),CS(t.ySkew)),dC(e),GS()].filter(Boolean)},ZC=function(e){return[WS(),e.graphicsState&&US(e.graphicsState),e.color&&kC(e.color),KS(e.thickness),zS(e.dashArray??[],e.dashPhase??0),XS(e.start.x,e.start.y),e.lineCap&&VS(e.lineCap),XS(e.start.x,e.start.y),ZS(e.end.x,e.end.y),QS(),GS()].filter(Boolean)},QC=function(e){return[WS(),e.graphicsState&&US(e.graphicsState),e.color&&OC(e.color),e.borderColor&&kC(e.borderColor),KS(e.borderWidth),e.borderLineCap&&VS(e.borderLineCap),zS(e.borderDashArray??[],e.borderDashPhase??0),PS(e.x,e.y),IS(CS(e.rotate)),RS(CS(e.xSkew),CS(e.ySkew)),XS(0,0),ZS(0,e.height),ZS(e.width,e.height),ZS(e.width,0),YS(),e.color&&e.borderWidth?eC():e.color?$S():e.borderColor?QS():YS(),GS()].filter(Boolean)},$C=4*((Math.sqrt(2)-1)/3),ew=function(e){var t=hS(e.x),n=hS(e.y),r=hS(e.xScale),i=hS(e.yScale);t-=r,n-=i;var a=r*$C,o=i*$C,s=t+r*2,c=n+i*2,l=t+r,u=n+i;return[WS(),XS(t,u),qS(t,u-o,l-a,n,l,n),qS(l+a,n,s,u-o,s,u),qS(s,u+o,l+a,c,l,c),qS(l-a,c,t,u+o,t,u),GS()]},tw=function(e){var t=hS(e.x),n=hS(e.y),r=hS(e.xScale),i=hS(e.yScale),a=-r,o=-i,s=r*$C,c=i*$C,l=a+r*2,u=o+i*2,d=a+r,f=o+i;return[PS(t,n),IS(CS(e.rotate)),XS(a,f),qS(a,f-c,d-s,o,d,o),qS(d+s,o,l,f-c,l,f),qS(l,f+c,d+s,u,d,u),qS(d-s,u,a,f+c,a,f)]},nw=function(e){return vm([WS(),e.graphicsState&&US(e.graphicsState),e.color&&OC(e.color),e.borderColor&&kC(e.borderColor),KS(e.borderWidth),e.borderLineCap&&VS(e.borderLineCap),zS(e.borderDashArray??[],e.borderDashPhase??0)],e.rotate===void 0?ew({x:e.x,y:e.y,xScale:e.xScale,yScale:e.yScale}):tw({x:e.x,y:e.y,xScale:e.xScale,yScale:e.yScale,rotate:e.rotate??vS(0)}),[e.color&&e.borderWidth?eC():e.color?$S():e.borderColor?QS():YS(),GS()]).filter(Boolean)},rw=function(e,t){return vm([WS(),t.graphicsState&&US(t.graphicsState),PS(t.x,t.y),IS(CS(t.rotate??vS(0))),t.scale?FS(t.scale,-t.scale):FS(1,-1),t.color&&OC(t.color),t.borderColor&&kC(t.borderColor),t.borderWidth&&KS(t.borderWidth),t.borderLineCap&&VS(t.borderLineCap),zS(t.borderDashArray??[],t.borderDashPhase??0)],KC(e),[t.color&&t.borderWidth?eC():t.color?$S():t.borderColor?QS():YS(),GS()]).filter(Boolean)},iw=function(e){var t=hS(e.size),n=-.25,r=-.49,i=.475,a=.69,o=-.675,s=-((o-n)*(a-n))/(i-r)+r;return[WS(),e.color&&kC(e.color),KS(e.thickness),PS(e.x,e.y),XS(o*t,s*t),ZS(n*t,r*t),ZS(a*t,i*t),QS(),GS()].filter(Boolean)},aw=function(e){return e.rotation===0?[PS(0,0),LS(0)]:e.rotation===90?[PS(e.width,0),LS(90)]:e.rotation===180?[PS(e.width,e.height),LS(180)]:e.rotation===270?[PS(0,e.height),LS(270)]:[]},ow=function(e){var t=QC({x:e.x,y:e.y,width:e.width,height:e.height,borderWidth:e.borderWidth,color:e.color,borderColor:e.borderColor,rotate:vS(0),xSkew:vS(0),ySkew:vS(0)});if(!e.filled)return t;var n=hS(e.width),r=hS(e.height),i=Math.min(n,r)/2,a=iw({x:n/2,y:r/2,size:i,thickness:e.thickness,color:e.markColor});return vm([WS()],t,a,[GS()])},sw=function(e){var t=hS(e.width),n=hS(e.height),r=Math.min(t,n)/2,i=nw({x:e.x,y:e.y,xScale:r,yScale:r,color:e.color,borderColor:e.borderColor,borderWidth:e.borderWidth});if(!e.filled)return i;var a=nw({x:e.x,y:e.y,xScale:r*.45,yScale:r*.45,color:e.dotColor,borderColor:void 0,borderWidth:0});return vm([WS()],i,a,[GS()])},cw=function(e){var t=QC({x:hS(e.x),y:hS(e.y),width:hS(e.width),height:hS(e.height),borderWidth:e.borderWidth,color:e.color,borderColor:e.borderColor,rotate:vS(0),xSkew:vS(0),ySkew:vS(0)}),n=lw(e.textLines,{color:e.textColor,font:e.font,size:e.fontSize,rotate:vS(0),xSkew:vS(0),ySkew:vS(0)});return vm([WS()],t,n,[GS()])},lw=function(e,t){for(var n=[iC(),OC(t.color),oC(t.font,t.size)],r=0,i=e.length;r<i;r++){var a=e[r],o=a.encoded,s=a.x,c=a.y;n.push(uC(CS(t.rotate),CS(t.xSkew),CS(t.ySkew),s,c),rC(o))}return n.push(aC()),n},uw=function(e){var t=hS(e.x),n=hS(e.y),r=hS(e.width),i=hS(e.height),a=hS(e.borderWidth),o=hS(e.padding),s=t+a/2+o,c=n+a/2+o,l=r-(a/2+o)*2,u=i-(a/2+o)*2,d=[XS(s,c),ZS(s,c+u),ZS(s+l,c+u),ZS(s+l,c),YS(),kS(),tC()],f=QC({x:t,y:n,width:r,height:i,borderWidth:e.borderWidth,color:e.color,borderColor:e.borderColor,rotate:vS(0),xSkew:vS(0),ySkew:vS(0)}),p=lw(e.textLines,{color:e.textColor,font:e.font,size:e.fontSize,rotate:vS(0),xSkew:vS(0),ySkew:vS(0)}),m=vm([vC(`Tx`),WS()],p,[GS(),yC()]);return vm([WS()],f,d,m,[GS()])},dw=function(e){for(var t=hS(e.x),n=hS(e.y),r=hS(e.width),i=hS(e.height),a=hS(e.lineHeight),o=hS(e.borderWidth),s=hS(e.padding),c=t+o/2+s,l=n+o/2+s,u=r-(o/2+s)*2,d=i-(o/2+s)*2,f=[XS(c,l),ZS(c,l+d),ZS(c+u,l+d),ZS(c+u,l),YS(),kS(),tC()],p=QC({x:t,y:n,width:r,height:i,borderWidth:e.borderWidth,color:e.color,borderColor:e.borderColor,rotate:vS(0),xSkew:vS(0),ySkew:vS(0)}),m=[],h=0,g=e.selectedLines.length;h<g;h++){var _=e.textLines[e.selectedLines[h]];m.push.apply(m,QC({x:_.x-s,y:_.y-(a-_.height)/2,width:r-o,height:_.height+(a-_.height)/2,borderWidth:0,color:e.selectedColor,borderColor:void 0,rotate:vS(0),xSkew:vS(0),ySkew:vS(0)}))}var v=lw(e.textLines,{color:e.textColor,font:e.font,size:e.fontSize,rotate:vS(0),xSkew:vS(0),ySkew:vS(0)}),y=vm([vC(`Tx`),WS()],v,[GS(),yC()]);return vm([WS()],p,m,f,y,[GS()])}})),pw,mw,hw,gw,_w,vw,yw,bw,xw,Sw,Cw,ww,Tw=s((()=>{K(),pw=function(e){G(t,e);function t(){var t=this;return t=e.call(this,"Input document to `PDFDocument.load` is encrypted. You can use `PDFDocument.load(..., { ignoreEncryption: true })` if you wish to load the document anyways.")||this,t}return t}(Error),mw=function(e){G(t,e);function t(){var t=this;return t=e.call(this,"Input to `PDFDocument.embedFont` was a custom font, but no `fontkit` instance was found. You must register a `fontkit` instance with `PDFDocument.registerFontkit(...)` before embedding custom fonts.")||this,t}return t}(Error),hw=function(e){G(t,e);function t(){var t=this;return t=e.call(this,"A `page` passed to `PDFDocument.addPage` or `PDFDocument.insertPage` was from a different (foreign) PDF document. If you want to copy pages from one PDFDocument to another, you must use `PDFDocument.copyPages(...)` to copy the pages before adding or inserting them.")||this,t}return t}(Error),gw=function(e){G(t,e);function t(){var t=this;return t=e.call(this,"PDFDocument has no pages so `PDFDocument.removePage` cannot be called")||this,t}return t}(Error),_w=function(e){G(t,e);function t(t){var n=this,r=`PDFDocument has no form field with the name "`+t+`"`;return n=e.call(this,r)||this,n}return t}(Error),vw=function(e){G(t,e);function t(t,n,r){var i=this,a=n?.name,o=r?.constructor?.name??r,s=`Expected field "`+t+`" to be of type `+a+`, `+(`but it is actually of type `+o);return i=e.call(this,s)||this,i}return t}(Error),function(e){G(t,e);function t(t){var n=this,r=`Failed to select check box due to missing onValue: "`+t+`"`;return n=e.call(this,r)||this,n}return t}(Error),yw=function(e){G(t,e);function t(t){var n=this,r=`A field already exists with the specified name: "`+t+`"`;return n=e.call(this,r)||this,n}return t}(Error),bw=function(e){G(t,e);function t(t){var n=this,r=`Field name contains invalid component: "`+t+`"`;return n=e.call(this,r)||this,n}return t}(Error),function(e){G(t,e);function t(t){var n=this,r=`A non-terminal field already exists with the specified name: "`+t+`"`;return n=e.call(this,r)||this,n}return t}(Error),xw=function(e){G(t,e);function t(t){var n=this,r=`Reading rich text fields is not supported: Attempted to read rich text field: `+t;return n=e.call(this,r)||this,n}return t}(Error),Sw=function(e){G(t,e);function t(t,n){var r=this,i=`Failed to layout combed text as lineLength=`+t+` is greater than cellCount=`+n;return r=e.call(this,i)||this,r}return t}(Error),Cw=function(e){G(t,e);function t(t,n,r){var i=this,a=`Attempted to set text with length=`+t+` for TextField with maxLength=`+n+` and name=`+r;return i=e.call(this,a)||this,i}return t}(Error),ww=function(e){G(t,e);function t(t,n,r){var i=this,a=`Attempted to set maxLength=`+n+`, which is less than `+t+`, the length of this field's current value (name=`+r+`)`;return i=e.call(this,a)||this,i}return t}(Error)})),Ew,Dw=s((()=>{(function(e){e[e.Left=0]=`Left`,e[e.Center=1]=`Center`,e[e.Right=2]=`Right`})(Ew||={})})),Ow,kw,Aw,jw,Mw,Nw,Pw,Fw,Iw,Lw=s((()=>{Tw(),Dw(),x_(),Ow=4,kw=500,Aw=function(e,t,n,r){r===void 0&&(r=!1);for(var i=Ow;i<kw;){for(var a=0,o=0,s=e.length;o<s;o++){a+=1;for(var c=e[o].split(` `),l=n.width,u=0,d=c.length;u<d;u++){var f=u===d-1?c[u]:c[u]+` `,p=t.widthOfTextAtSize(f,i);l-=p,l<=0&&(a+=1,l=n.width-p)}}if(!r&&a>e.length)return i-1;var m=t.heightAtSize(i);if((m+m*.2)*a>Math.abs(n.height))return i-1;i+=1}return i},jw=function(e,t,n,r){for(var i=n.width/r,a=n.height,o=Ow,s=Wm(e);o<kw;){for(var c=0,l=s.length;c<l;c++){var u=s[c];if(t.widthOfTextAtSize(u,o)>i*.75)return o-1}if(t.heightAtSize(o,{descender:!1})>a)return o-1;o+=1}return o},Mw=function(e){for(var t=e.length;t>0;t--)if(/\s/.test(e[t]))return t},Nw=function(e,t,n,r){for(var i=e.length;i>0;){var a=e.substring(0,i),o=n.encodeText(a),s=n.widthOfTextAtSize(a,r);if(s<t)return{line:a,encoded:o,width:s,remainder:e.substring(i)||void 0};i=Mw(a)??0}return{line:e,encoded:n.encodeText(e),width:n.widthOfTextAtSize(e,r),remainder:void 0}},Pw=function(e,t){var n=t.alignment,r=t.fontSize,i=t.font,a=t.bounds,o=Vm(Rm(e));(r===void 0||r===0)&&(r=Aw(o,i,a,!0));for(var s=i.heightAtSize(r),c=s+s*.2,l=[],u=a.x,d=a.y,f=a.x+a.width,p=a.y+a.height,m=a.y+a.height,h=0,g=o.length;h<g;h++)for(var _=o[h];_!==void 0;){var v=Nw(_,a.width,i,r),y=v.line,b=v.encoded,x=v.width,S=v.remainder,C=n===Ew.Left?a.x:n===Ew.Center?a.x+a.width/2-x/2:n===Ew.Right?a.x+a.width-x:a.x;m-=c,C<u&&(u=C),m<d&&(d=m),C+x>f&&(f=C+x),m+s>p&&(p=m+s),l.push({text:y,encoded:b,width:x,height:s,x:C,y:m}),_=S?.trim()}return{fontSize:r,lineHeight:c,lines:l,bounds:{x:u,y:d,width:f-u,height:p-d}}},Fw=function(e,t){var n=t.fontSize,r=t.font,i=t.bounds,a=t.cellCount,o=Hm(Rm(e));if(o.length>a)throw new Sw(o.length,a);(n===void 0||n===0)&&(n=jw(o,r,i,a));for(var s=i.width/a,c=r.heightAtSize(n,{descender:!1}),l=i.y+(i.height/2-c/2),u=[],d=i.x,f=i.y,p=i.x+i.width,m=i.y+i.height,h=0,g=0;h<a;){var _=Um(o,g),v=_[0],y=_[1],b=r.encodeText(v),x=r.widthOfTextAtSize(v,n),S=i.x+(s*h+s/2)-x/2;S<d&&(d=S),l<f&&(f=l),S+x>p&&(p=S+x),l+c>m&&(m=l+c),u.push({text:o,encoded:b,width:x,height:c,x:S,y:l}),h+=1,g+=y}return{fontSize:n,cells:u,bounds:{x:d,y:f,width:p-d,height:m-f}}},Iw=function(e,t){var n=t.alignment,r=t.fontSize,i=t.font,a=t.bounds,o=Hm(Rm(e));(r===void 0||r===0)&&(r=Aw([o],i,a));var s=i.encodeText(o),c=i.widthOfTextAtSize(o,r),l=i.heightAtSize(r,{descender:!1}),u=n===Ew.Left?a.x:n===Ew.Center?a.x+a.width/2-c/2:n===Ew.Right?a.x+a.width-c:a.x,d=a.y+(a.height/2-l/2);return{fontSize:r,line:{text:o,encoded:s,width:c,height:l,x:u,y:d},bounds:{x:u,y:d,width:c,height:l}}}})),Rw,zw,Bw,Vw,Hw,Uw,Ww,Gw,Kw,qw,Jw,Yw,Xw=s((()=>{K(),fw(),MC(),OS(),Lw(),Dw(),bC(),x_(),Rw=function(e){return`normal`in e?e:{normal:e}},zw=/\/([^\0\t\n\f\r\ ]+)[\0\t\n\f\r\ ]+(\d*\.\d+|\d+)[\0\t\n\f\r\ ]+Tf/,Bw=function(e){var t=e.getDefaultAppearance()??``,n=Ym(t,zw).match??[],r=Number(n[2]);return isFinite(r)?r:void 0},Vw=/(\d*\.\d+|\d+)[\0\t\n\f\r\ ]*(\d*\.\d+|\d+)?[\0\t\n\f\r\ ]*(\d*\.\d+|\d+)?[\0\t\n\f\r\ ]*(\d*\.\d+|\d+)?[\0\t\n\f\r\ ]+(g|rg|k)/,Hw=function(e){var t=e.getDefaultAppearance()??``,n=Ym(t,Vw).match??[],r=n[1],i=n[2],a=n[3],o=n[4],s=n[5];if(s===`g`&&r)return SC(Number(r));if(s===`rg`&&r&&i&&a)return CC(Number(r),Number(i),Number(a));if(s===`k`&&r&&i&&a&&o)return wC(Number(r),Number(i),Number(a),Number(o))},Uw=function(e,t,n,r){r===void 0&&(r=0);var i=[OC(t).toString(),oC(n?.name??`dummy__noop`,r).toString()].join(`
|
|
981
|
+
`);e.setDefaultAppearance(i)},Ww=function(e,t){var n=Hw(t),r=Hw(e.acroField),i=t.getRectangle(),a=t.getAppearanceCharacteristics(),o=t.getBorderStyle()?.getWidth()??0,s=TS(a?.getRotation()),c=ES(i,s),l=c.width,u=c.height,d=aw(bm(bm({},i),{rotation:s})),f=CC(0,0,0),p=AC(a?.getBorderColor())??f,m=AC(a?.getBackgroundColor()),h=AC(a?.getBackgroundColor(),.8),g=n??r??f;Uw(n?t:e.acroField,g);var _={x:0+o/2,y:0+o/2,width:l-o,height:u-o,thickness:1.5,borderWidth:o,borderColor:p,markColor:g};return{normal:{on:vm(d,ow(bm(bm({},_),{color:m,filled:!0}))),off:vm(d,ow(bm(bm({},_),{color:m,filled:!1})))},down:{on:vm(d,ow(bm(bm({},_),{color:h,filled:!0}))),off:vm(d,ow(bm(bm({},_),{color:h,filled:!1})))}}},Gw=function(e,t){var n=Hw(t),r=Hw(e.acroField),i=t.getRectangle(),a=t.getAppearanceCharacteristics(),o=t.getBorderStyle()?.getWidth()??0,s=TS(a?.getRotation()),c=ES(i,s),l=c.width,u=c.height,d=aw(bm(bm({},i),{rotation:s})),f=CC(0,0,0),p=AC(a?.getBorderColor())??f,m=AC(a?.getBackgroundColor()),h=AC(a?.getBackgroundColor(),.8),g=n??r??f;Uw(n?t:e.acroField,g);var _={x:l/2,y:u/2,width:l-o,height:u-o,borderWidth:o,borderColor:p,dotColor:g};return{normal:{on:vm(d,sw(bm(bm({},_),{color:m,filled:!0}))),off:vm(d,sw(bm(bm({},_),{color:m,filled:!1})))},down:{on:vm(d,sw(bm(bm({},_),{color:h,filled:!0}))),off:vm(d,sw(bm(bm({},_),{color:h,filled:!1})))}}},Kw=function(e,t,n){var r=Hw(t),i=Hw(e.acroField),a=Bw(t),o=Bw(e.acroField),s=t.getRectangle(),c=t.getAppearanceCharacteristics(),l=t.getBorderStyle(),u=c?.getCaptions(),d=u?.normal??``,f=u?.down??d??``,p=l?.getWidth()??0,m=TS(c?.getRotation()),h=ES(s,m),g=h.width,_=h.height,v=aw(bm(bm({},s),{rotation:m})),y=CC(0,0,0),b=AC(c?.getBorderColor()),x=AC(c?.getBackgroundColor()),S=AC(c?.getBackgroundColor(),.8),C={x:p,y:p,width:g-p*2,height:_-p*2},w=Iw(d,{alignment:Ew.Center,fontSize:a??o,font:n,bounds:C}),T=Iw(f,{alignment:Ew.Center,fontSize:a??o,font:n,bounds:C}),E=Math.min(w.fontSize,T.fontSize),D=r??i??y;Uw(r||a!==void 0?t:e.acroField,D,n,E);var O={x:0+p/2,y:0+p/2,width:g-p,height:_-p,borderWidth:p,borderColor:b,textColor:D,font:n.name,fontSize:E};return{normal:vm(v,cw(bm(bm({},O),{color:x,textLines:[w.line]}))),down:vm(v,cw(bm(bm({},O),{color:S,textLines:[T.line]})))}},qw=function(e,t,n){var r=Hw(t),i=Hw(e.acroField),a=Bw(t),o=Bw(e.acroField),s=t.getRectangle(),c=t.getAppearanceCharacteristics(),l=t.getBorderStyle(),u=e.getText()??``,d=l?.getWidth()??0,f=TS(c?.getRotation()),p=ES(s,f),m=p.width,h=p.height,g=aw(bm(bm({},s),{rotation:f})),_=CC(0,0,0),v=AC(c?.getBorderColor()),y=AC(c?.getBackgroundColor()),b,x,S=+!e.isCombed(),C={x:d+S,y:d+S,width:m-(d+S)*2,height:h-(d+S)*2};if(e.isMultiline()){var w=Pw(u,{alignment:e.getAlignment(),fontSize:a??o,font:n,bounds:C});b=w.lines,x=w.fontSize}else if(e.isCombed()){var w=Fw(u,{fontSize:a??o,font:n,bounds:C,cellCount:e.getMaxLength()??0});b=w.cells,x=w.fontSize}else{var w=Iw(u,{alignment:e.getAlignment(),fontSize:a??o,font:n,bounds:C});b=[w.line],x=w.fontSize}var T=r??i??_;Uw(r||a!==void 0?t:e.acroField,T,n,x);var E={x:0+d/2,y:0+d/2,width:m-d,height:h-d,borderWidth:d??0,borderColor:v,textColor:T,font:n.name,fontSize:x,color:y,textLines:b,padding:S};return vm(g,uw(E))},Jw=function(e,t,n){var r=Hw(t),i=Hw(e.acroField),a=Bw(t),o=Bw(e.acroField),s=t.getRectangle(),c=t.getAppearanceCharacteristics(),l=t.getBorderStyle(),u=e.getSelected()[0]??``,d=l?.getWidth()??0,f=TS(c?.getRotation()),p=ES(s,f),m=p.width,h=p.height,g=aw(bm(bm({},s),{rotation:f})),_=CC(0,0,0),v=AC(c?.getBorderColor()),y=AC(c?.getBackgroundColor()),b=1,x={x:d+b,y:d+b,width:m-(d+b)*2,height:h-(d+b)*2},S=Iw(u,{alignment:Ew.Left,fontSize:a??o,font:n,bounds:x}),C=S.line,w=S.fontSize,T=r??i??_;Uw(r||a!==void 0?t:e.acroField,T,n,w);var E={x:0+d/2,y:0+d/2,width:m-d,height:h-d,borderWidth:d??0,borderColor:v,textColor:T,font:n.name,fontSize:w,color:y,textLines:[C],padding:b};return vm(g,uw(E))},Yw=function(e,t,n){var r=Hw(t),i=Hw(e.acroField),a=Bw(t),o=Bw(e.acroField),s=t.getRectangle(),c=t.getAppearanceCharacteristics(),l=t.getBorderStyle()?.getWidth()??0,u=TS(c?.getRotation()),d=ES(s,u),f=d.width,p=d.height,m=aw(bm(bm({},s),{rotation:u})),h=CC(0,0,0),g=AC(c?.getBorderColor()),_=AC(c?.getBackgroundColor()),v=e.getOptions(),y=e.getSelected();e.isSorted()&&v.sort();for(var b=``,x=0,S=v.length;x<S;x++)b+=v[x],x<S-1&&(b+=`
|
|
982
|
+
`);for(var C=1,w={x:l+C,y:l+C,width:f-(l+C)*2,height:p-(l+C)*2},T=Pw(b,{alignment:Ew.Left,fontSize:a??o,font:n,bounds:w}),E=T.lines,D=T.fontSize,O=T.lineHeight,k=[],x=0,S=E.length;x<S;x++){var A=E[x];y.includes(A.text)&&k.push(x)}var j=CC(153/255,193/255,218/255),M=r??i??h;return Uw(r||a!==void 0?t:e.acroField,M,n,D),vm(m,dw({x:0+l/2,y:0+l/2,width:f-l,height:p-l,borderWidth:l??0,borderColor:g,textColor:M,font:n.name,fontSize:D,color:_,textLines:E,lineHeight:O,selectedColor:j,selectedLines:k,padding:C}))}})),Zw,Qw=s((()=>{K(),BT(),fS(),x_(),Zw=function(){function e(e,t,n){this.alreadyEmbedded=!1,q(e,`ref`,[[jv,`PDFRef`]]),q(t,`doc`,[[zT,`PDFDocument`]]),q(n,`embedder`,[[wb,`PDFPageEmbedder`]]),this.ref=e,this.doc=t,this.width=n.width,this.height=n.height,this.embedder=n}return e.prototype.scale=function(e){return q(e,`factor`,[`number`]),{width:this.width*e,height:this.height*e}},e.prototype.size=function(){return this.scale(1)},e.prototype.embed=function(){return gm(this,void 0,void 0,function(){return _m(this,function(e){switch(e.label){case 0:return this.alreadyEmbedded?[3,2]:[4,this.embedder.embedIntoContext(this.doc.context,this.ref)];case 1:e.sent(),this.alreadyEmbedded=!0,e.label=2;case 2:return[2]}})})},e.of=function(t,n,r){return new e(t,n,r)},e}()})),$w,eT=s((()=>{K(),BT(),fS(),x_(),$w=function(){function e(e,t,n){this.modified=!0,q(e,`ref`,[[jv,`PDFRef`]]),q(t,`doc`,[[zT,`PDFDocument`]]),q(n,`embedder`,[[jy,`CustomFontEmbedder`],[vy,`StandardFontEmbedder`]]),this.ref=e,this.doc=t,this.name=n.fontName,this.embedder=n}return e.prototype.encodeText=function(e){return q(e,`text`,[`string`]),this.modified=!0,this.embedder.encodeText(e)},e.prototype.widthOfTextAtSize=function(e,t){return q(e,`text`,[`string`]),q(t,`size`,[`number`]),this.embedder.widthOfTextAtSize(e,t)},e.prototype.heightAtSize=function(e,t){return q(e,`size`,[`number`]),J(t?.descender,`options.descender`,[`boolean`]),this.embedder.heightOfFontAtSize(e,{descender:t?.descender??!0})},e.prototype.sizeAtHeight=function(e){return q(e,`height`,[`number`]),this.embedder.sizeOfFontAtHeight(e)},e.prototype.getCharacterSet=function(){return this.embedder instanceof vy?this.embedder.encoding.supportedCodePoints:this.embedder.font.characterSet},e.prototype.embed=function(){return gm(this,void 0,void 0,function(){return _m(this,function(e){switch(e.label){case 0:return this.modified?[4,this.embedder.embedIntoContext(this.doc.context,this.ref)]:[3,2];case 1:e.sent(),this.modified=!1,e.label=2;case 2:return[2]}})})},e.of=function(t,n,r){return new e(t,n,r)},e}()})),tT,nT=s((()=>{K(),BT(),fS(),x_(),tT=function(){function e(e,t,n){q(e,`ref`,[[jv,`PDFRef`]]),q(t,`doc`,[[zT,`PDFDocument`]]),q(n,`embedder`,[[Vy,`JpegEmbedder`],[Xy,`PngEmbedder`]]),this.ref=e,this.doc=t,this.width=n.width,this.height=n.height,this.embedder=n}return e.prototype.scale=function(e){return q(e,`factor`,[`number`]),{width:this.width*e,height:this.height*e}},e.prototype.scaleToFit=function(e,t){q(e,`width`,[`number`]),q(t,`height`,[`number`]);var n=e/this.width,r=t/this.height,i=Math.min(n,r);return this.scale(i)},e.prototype.size=function(){return this.scale(1)},e.prototype.embed=function(){return gm(this,void 0,void 0,function(){var e,t,n;return _m(this,function(r){switch(r.label){case 0:return this.embedder?(this.embedTask||=(e=this,t=e.doc,n=e.ref,this.embedder.embedIntoContext(t.context,n)),[4,this.embedTask]):[2];case 1:return r.sent(),this.embedder=void 0,[2]}})})},e.of=function(t,n,r){return new e(t,n,r)},e}()})),rT,iT=s((()=>{(function(e){e[e.Left=0]=`Left`,e[e.Center=1]=`Center`,e[e.Right=2]=`Right`})(rT||={})})),aT=s((()=>{iT()})),oT,sT,cT=s((()=>{K(),BT(),MC(),OS(),fS(),x_(),aT(),fw(),oT=function(e){J(e?.x,`options.x`,[`number`]),J(e?.y,`options.y`,[`number`]),J(e?.width,`options.width`,[`number`]),J(e?.height,`options.height`,[`number`]),J(e?.textColor,`options.textColor`,[[Object,`Color`]]),J(e?.backgroundColor,`options.backgroundColor`,[[Object,`Color`]]),J(e?.borderColor,`options.borderColor`,[[Object,`Color`]]),J(e?.borderWidth,`options.borderWidth`,[`number`]),J(e?.rotate,`options.rotate`,[[Object,`Rotation`]])},sT=function(){function e(e,t,n){q(e,`acroField`,[[Wb,`PDFAcroTerminal`]]),q(t,`ref`,[[jv,`PDFRef`]]),q(n,`doc`,[[zT,`PDFDocument`]]),this.acroField=e,this.ref=t,this.doc=n}return e.prototype.getName=function(){return this.acroField.getFullyQualifiedName()??``},e.prototype.isReadOnly=function(){return this.acroField.hasFlag(Zb.ReadOnly)},e.prototype.enableReadOnly=function(){this.acroField.setFlagTo(Zb.ReadOnly,!0)},e.prototype.disableReadOnly=function(){this.acroField.setFlagTo(Zb.ReadOnly,!1)},e.prototype.isRequired=function(){return this.acroField.hasFlag(Zb.Required)},e.prototype.enableRequired=function(){this.acroField.setFlagTo(Zb.Required,!0)},e.prototype.disableRequired=function(){this.acroField.setFlagTo(Zb.Required,!1)},e.prototype.isExported=function(){return!this.acroField.hasFlag(Zb.NoExport)},e.prototype.enableExporting=function(){this.acroField.setFlagTo(Zb.NoExport,!1)},e.prototype.disableExporting=function(){this.acroField.setFlagTo(Zb.NoExport,!0)},e.prototype.needsAppearancesUpdate=function(){throw new S_(this.constructor.name,`needsAppearancesUpdate`)},e.prototype.defaultUpdateAppearances=function(e){throw new S_(this.constructor.name,`defaultUpdateAppearances`)},e.prototype.markAsDirty=function(){this.doc.getForm().markFieldAsDirty(this.ref)},e.prototype.markAsClean=function(){this.doc.getForm().markFieldAsClean(this.ref)},e.prototype.isDirty=function(){return this.doc.getForm().fieldIsDirty(this.ref)},e.prototype.createWidget=function(e){var t=e.textColor,n=e.backgroundColor,r=e.borderColor,i=e.borderWidth,a=wS(e.rotate),o=e.caption,s=e.x,c=e.y,l=e.width+i,u=e.height+i,d=!!e.hidden,f=e.page;d_(a,`degreesAngle`,90);var p=Hb.create(this.doc.context,this.ref),m=DS({x:s,y:c,width:l,height:u},i,a);p.setRectangle(m),f&&p.setP(f);var h=p.getOrCreateAppearanceCharacteristics();n&&h.setBackgroundColor(jC(n)),h.setRotation(a),o&&h.setCaptions({normal:o}),r&&h.setBorderColor(jC(r));var g=p.getOrCreateBorderStyle();if(i!==void 0&&g.setWidth(i),p.setFlagTo(lS.Print,!0),p.setFlagTo(lS.Hidden,d),p.setFlagTo(lS.Invisible,!1),t){var _=(this.acroField.getDefaultAppearance()??``)+`
|
|
983
|
+
`+OC(t).toString();this.acroField.setDefaultAppearance(_)}return p},e.prototype.updateWidgetAppearanceWithFont=function(e,t,n){var r=n.normal,i=n.rollover,a=n.down;this.updateWidgetAppearances(e,{normal:this.createAppearanceStream(e,r,t),rollover:i&&this.createAppearanceStream(e,i,t),down:a&&this.createAppearanceStream(e,a,t)})},e.prototype.updateOnOffWidgetAppearance=function(e,t,n){var r=n.normal,i=n.rollover,a=n.down;this.updateWidgetAppearances(e,{normal:this.createAppearanceDict(e,r,t),rollover:i&&this.createAppearanceDict(e,i,t),down:a&&this.createAppearanceDict(e,a,t)})},e.prototype.updateWidgetAppearances=function(e,t){var n=t.normal,r=t.rollover,i=t.down;e.setNormalAppearance(n),r?e.setRolloverAppearance(r):e.removeRolloverAppearance(),i?e.setDownAppearance(i):e.removeDownAppearance()},e.prototype.createAppearanceStream=function(e,t,n){var r,i=this.acroField.dict.context,a=e.getRectangle(),o=a.width,s=a.height,c=n&&{Font:(r={},r[n.name]=n.ref,r)},l=i.formXObject(t,{Resources:c,BBox:i.obj([0,0,o,s]),Matrix:i.obj([1,0,0,1,0,0])});return i.register(l)},e.prototype.createImageAppearanceStream=function(e,t,n){var r,i=this.acroField.dict.context,a=e.getRectangle(),o=e.getAppearanceCharacteristics(),s=e.getBorderStyle()?.getWidth()??0,c=TS(o?.getRotation()),l=aw(bm(bm({},a),{rotation:c})),u=ES(a,c),d=t.scaleToFit(u.width-s*2,u.height-s*2),f={x:s,y:s,width:d.width,height:d.height,rotate:vS(0),xSkew:vS(0),ySkew:vS(0)};n===rT.Center?(f.x+=(u.width-s*2)/2-d.width/2,f.y+=(u.height-s*2)/2-d.height/2):n===rT.Right&&(f.x=u.width-s-d.width,f.y=u.height-s-d.height);var p=this.doc.context.addRandomSuffix(`Image`,10),m=vm(l,YC(p,f)),h={XObject:(r={},r[p]=t.ref,r)},g=i.formXObject(m,{Resources:h,BBox:i.obj([0,0,a.width,a.height]),Matrix:i.obj([1,0,0,1,0,0])});return i.register(g)},e.prototype.createAppearanceDict=function(e,t,n){var r=this.acroField.dict.context,i=this.createAppearanceStream(e,t.on),a=this.createAppearanceStream(e,t.off),o=r.obj({});return o.set(n,i),o.set(Z.of(`Off`),a),o},e}()})),lT,uT=s((()=>{K(),WT(),Xw(),MC(),OS(),cT(),fS(),x_(),lT=function(e){G(t,e);function t(t,n,r){var i=e.call(this,t,n,r)||this;return q(t,`acroCheckBox`,[[Jb,`PDFAcroCheckBox`]]),i.acroField=t,i}return t.prototype.check=function(){var e=this.acroField.getOnValue()??Z.of(`Yes`);this.markAsDirty(),this.acroField.setValue(e)},t.prototype.uncheck=function(){this.markAsDirty(),this.acroField.setValue(Z.of(`Off`))},t.prototype.isChecked=function(){var e=this.acroField.getOnValue();return!!e&&e===this.acroField.getValue()},t.prototype.addToPage=function(e,t){q(e,`page`,[[UT,`PDFPage`]]),oT(t),t||={},`textColor`in t||(t.textColor=CC(0,0,0)),`backgroundColor`in t||(t.backgroundColor=CC(1,1,1)),`borderColor`in t||(t.borderColor=CC(0,0,0)),`borderWidth`in t||(t.borderWidth=1);var n=this.createWidget({x:t.x??0,y:t.y??0,width:t.width??50,height:t.height??50,textColor:t.textColor,backgroundColor:t.backgroundColor,borderColor:t.borderColor,borderWidth:t.borderWidth??0,rotate:t.rotate??vS(0),hidden:t.hidden,page:e.ref}),r=this.doc.context.register(n.dict);this.acroField.addWidget(r),n.setAppearanceState(Z.of(`Off`)),this.updateWidgetAppearance(n,Z.of(`Yes`)),e.node.addAnnot(r)},t.prototype.needsAppearancesUpdate=function(){for(var e=this.acroField.getWidgets(),t=0,n=e.length;t<n;t++){var r=e[t],i=r.getAppearanceState(),a=r.getAppearances()?.normal;if(!(a instanceof Q)||i&&!a.has(i))return!0}return!1},t.prototype.defaultUpdateAppearances=function(){this.updateAppearances()},t.prototype.updateAppearances=function(e){J(e,`provider`,[Function]);for(var t=this.acroField.getWidgets(),n=0,r=t.length;n<r;n++){var i=t[n],a=i.getOnValue()??Z.of(`Yes`);a&&this.updateWidgetAppearance(i,a,e)}this.markAsClean()},t.prototype.updateWidgetAppearance=function(e,t,n){var r=Rw((n??Ww)(this,e));this.updateOnOffWidgetAppearance(e,t,r)},t.of=function(e,n,r){return new t(e,n,r)},t}(sT)})),dT,fT=s((()=>{K(),WT(),eT(),cT(),Xw(),MC(),OS(),fS(),x_(),dT=function(e){G(t,e);function t(t,n,r){var i=e.call(this,t,n,r)||this;return q(t,`acroComboBox`,[[ix,`PDFAcroComboBox`]]),i.acroField=t,i}return t.prototype.getOptions=function(){for(var e=this.acroField.getOptions(),t=Array(e.length),n=0,r=t.length;n<r;n++){var i=e[n],a=i.display,o=i.value;t[n]=(a??o).decodeText()}return t},t.prototype.getSelected=function(){for(var e=this.acroField.getValues(),t=Array(e.length),n=0,r=e.length;n<r;n++)t[n]=e[n].decodeText();return t},t.prototype.setOptions=function(e){q(e,`options`,[Array]);for(var t=Array(e.length),n=0,r=e.length;n<r;n++)t[n]={value:gy.fromText(e[n])};this.acroField.setOptions(t)},t.prototype.addOptions=function(e){q(e,`options`,[`string`,Array]);for(var t=Array.isArray(e)?e:[e],n=this.acroField.getOptions(),r=Array(t.length),i=0,a=t.length;i<a;i++)r[i]={value:gy.fromText(t[i])};this.acroField.setOptions(n.concat(r))},t.prototype.select=function(e,t){t===void 0&&(t=!1),q(e,`options`,[`string`,Array]),q(t,`merge`,[`boolean`]);var n=Array.isArray(e)?e:[e],r=this.getOptions();n.find(function(e){return!r.includes(e)})&&this.enableEditing(),this.markAsDirty(),(n.length>1||n.length===1&&t)&&this.enableMultiselect();for(var i=Array(n.length),a=0,o=n.length;a<o;a++)i[a]=gy.fromText(n[a]);if(t){var s=this.acroField.getValues();this.acroField.setValues(s.concat(i))}else this.acroField.setValues(i)},t.prototype.clear=function(){this.markAsDirty(),this.acroField.setValues([])},t.prototype.setFontSize=function(e){p_(e,`fontSize`),this.acroField.setFontSize(e),this.markAsDirty()},t.prototype.isEditable=function(){return this.acroField.hasFlag(ex.Edit)},t.prototype.enableEditing=function(){this.acroField.setFlagTo(ex.Edit,!0)},t.prototype.disableEditing=function(){this.acroField.setFlagTo(ex.Edit,!1)},t.prototype.isSorted=function(){return this.acroField.hasFlag(ex.Sort)},t.prototype.enableSorting=function(){this.acroField.setFlagTo(ex.Sort,!0)},t.prototype.disableSorting=function(){this.acroField.setFlagTo(ex.Sort,!1)},t.prototype.isMultiselect=function(){return this.acroField.hasFlag(ex.MultiSelect)},t.prototype.enableMultiselect=function(){this.acroField.setFlagTo(ex.MultiSelect,!0)},t.prototype.disableMultiselect=function(){this.acroField.setFlagTo(ex.MultiSelect,!1)},t.prototype.isSpellChecked=function(){return!this.acroField.hasFlag(ex.DoNotSpellCheck)},t.prototype.enableSpellChecking=function(){this.acroField.setFlagTo(ex.DoNotSpellCheck,!1)},t.prototype.disableSpellChecking=function(){this.acroField.setFlagTo(ex.DoNotSpellCheck,!0)},t.prototype.isSelectOnClick=function(){return this.acroField.hasFlag(ex.CommitOnSelChange)},t.prototype.enableSelectOnClick=function(){this.acroField.setFlagTo(ex.CommitOnSelChange,!0)},t.prototype.disableSelectOnClick=function(){this.acroField.setFlagTo(ex.CommitOnSelChange,!1)},t.prototype.addToPage=function(e,t){q(e,`page`,[[UT,`PDFPage`]]),oT(t),t||={},`textColor`in t||(t.textColor=CC(0,0,0)),`backgroundColor`in t||(t.backgroundColor=CC(1,1,1)),`borderColor`in t||(t.borderColor=CC(0,0,0)),`borderWidth`in t||(t.borderWidth=1);var n=this.createWidget({x:t.x??0,y:t.y??0,width:t.width??200,height:t.height??50,textColor:t.textColor,backgroundColor:t.backgroundColor,borderColor:t.borderColor,borderWidth:t.borderWidth??0,rotate:t.rotate??vS(0),hidden:t.hidden,page:e.ref}),r=this.doc.context.register(n.dict);this.acroField.addWidget(r);var i=t.font??this.doc.getForm().getDefaultFont();this.updateWidgetAppearance(n,i),e.node.addAnnot(r)},t.prototype.needsAppearancesUpdate=function(){if(this.isDirty())return!0;for(var e=this.acroField.getWidgets(),t=0,n=e.length;t<n;t++)if(!(e[t].getAppearances()?.normal instanceof Tv))return!0;return!1},t.prototype.defaultUpdateAppearances=function(e){q(e,`font`,[[$w,`PDFFont`]]),this.updateAppearances(e)},t.prototype.updateAppearances=function(e,t){q(e,`font`,[[$w,`PDFFont`]]),J(t,`provider`,[Function]);for(var n=this.acroField.getWidgets(),r=0,i=n.length;r<i;r++){var a=n[r];this.updateWidgetAppearance(a,e,t)}this.markAsClean()},t.prototype.updateWidgetAppearance=function(e,t,n){var r=Rw((n??Jw)(this,e,t));this.updateWidgetAppearanceWithFont(e,t,r)},t.of=function(e,n,r){return new t(e,n,r)},t}(sT)})),pT,mT=s((()=>{K(),WT(),eT(),cT(),Xw(),MC(),OS(),fS(),x_(),pT=function(e){G(t,e);function t(t,n,r){var i=e.call(this,t,n,r)||this;return q(t,`acroListBox`,[[gx,`PDFAcroListBox`]]),i.acroField=t,i}return t.prototype.getOptions=function(){for(var e=this.acroField.getOptions(),t=Array(e.length),n=0,r=t.length;n<r;n++){var i=e[n],a=i.display,o=i.value;t[n]=(a??o).decodeText()}return t},t.prototype.getSelected=function(){for(var e=this.acroField.getValues(),t=Array(e.length),n=0,r=e.length;n<r;n++)t[n]=e[n].decodeText();return t},t.prototype.setOptions=function(e){q(e,`options`,[Array]),this.markAsDirty();for(var t=Array(e.length),n=0,r=e.length;n<r;n++)t[n]={value:gy.fromText(e[n])};this.acroField.setOptions(t)},t.prototype.addOptions=function(e){q(e,`options`,[`string`,Array]),this.markAsDirty();for(var t=Array.isArray(e)?e:[e],n=this.acroField.getOptions(),r=Array(t.length),i=0,a=t.length;i<a;i++)r[i]={value:gy.fromText(t[i])};this.acroField.setOptions(n.concat(r))},t.prototype.select=function(e,t){t===void 0&&(t=!1),q(e,`options`,[`string`,Array]),q(t,`merge`,[`boolean`]);var n=Array.isArray(e)?e:[e],r=this.getOptions();i_(n,`option`,r),this.markAsDirty(),(n.length>1||n.length===1&&t)&&this.enableMultiselect();for(var i=Array(n.length),a=0,o=n.length;a<o;a++)i[a]=gy.fromText(n[a]);if(t){var s=this.acroField.getValues();this.acroField.setValues(s.concat(i))}else this.acroField.setValues(i)},t.prototype.clear=function(){this.markAsDirty(),this.acroField.setValues([])},t.prototype.setFontSize=function(e){p_(e,`fontSize`),this.acroField.setFontSize(e),this.markAsDirty()},t.prototype.isSorted=function(){return this.acroField.hasFlag(ex.Sort)},t.prototype.enableSorting=function(){this.acroField.setFlagTo(ex.Sort,!0)},t.prototype.disableSorting=function(){this.acroField.setFlagTo(ex.Sort,!1)},t.prototype.isMultiselect=function(){return this.acroField.hasFlag(ex.MultiSelect)},t.prototype.enableMultiselect=function(){this.acroField.setFlagTo(ex.MultiSelect,!0)},t.prototype.disableMultiselect=function(){this.acroField.setFlagTo(ex.MultiSelect,!1)},t.prototype.isSelectOnClick=function(){return this.acroField.hasFlag(ex.CommitOnSelChange)},t.prototype.enableSelectOnClick=function(){this.acroField.setFlagTo(ex.CommitOnSelChange,!0)},t.prototype.disableSelectOnClick=function(){this.acroField.setFlagTo(ex.CommitOnSelChange,!1)},t.prototype.addToPage=function(e,t){q(e,`page`,[[UT,`PDFPage`]]),oT(t),t||={},`textColor`in t||(t.textColor=CC(0,0,0)),`backgroundColor`in t||(t.backgroundColor=CC(1,1,1)),`borderColor`in t||(t.borderColor=CC(0,0,0)),`borderWidth`in t||(t.borderWidth=1);var n=this.createWidget({x:t.x??0,y:t.y??0,width:t.width??200,height:t.height??100,textColor:t.textColor,backgroundColor:t.backgroundColor,borderColor:t.borderColor,borderWidth:t.borderWidth??0,rotate:t.rotate??vS(0),hidden:t.hidden,page:e.ref}),r=this.doc.context.register(n.dict);this.acroField.addWidget(r);var i=t.font??this.doc.getForm().getDefaultFont();this.updateWidgetAppearance(n,i),e.node.addAnnot(r)},t.prototype.needsAppearancesUpdate=function(){if(this.isDirty())return!0;for(var e=this.acroField.getWidgets(),t=0,n=e.length;t<n;t++)if(!(e[t].getAppearances()?.normal instanceof Tv))return!0;return!1},t.prototype.defaultUpdateAppearances=function(e){q(e,`font`,[[$w,`PDFFont`]]),this.updateAppearances(e)},t.prototype.updateAppearances=function(e,t){q(e,`font`,[[$w,`PDFFont`]]),J(t,`provider`,[Function]);for(var n=this.acroField.getWidgets(),r=0,i=n.length;r<i;r++){var a=n[r];this.updateWidgetAppearance(a,e,t)}this.markAsClean()},t.prototype.updateWidgetAppearance=function(e,t,n){var r=Rw((n??Yw)(this,e,t));this.updateWidgetAppearanceWithFont(e,t,r)},t.of=function(e,n,r){return new t(e,n,r)},t}(sT)})),hT,gT=s((()=>{K(),WT(),cT(),Xw(),MC(),OS(),fS(),x_(),hT=function(e){G(t,e);function t(t,n,r){var i=e.call(this,t,n,r)||this;return q(t,`acroRadioButton`,[[mx,`PDFAcroRadioButton`]]),i.acroField=t,i}return t.prototype.getOptions=function(){var e=this.acroField.getExportValues();if(e){for(var t=Array(e.length),n=0,r=e.length;n<r;n++)t[n]=e[n].decodeText();return t}for(var i=this.acroField.getOnValues(),a=Array(i.length),n=0,r=a.length;n<r;n++)a[n]=i[n].decodeText();return a},t.prototype.getSelected=function(){var e=this.acroField.getValue();if(e!==Z.of(`Off`)){var t=this.acroField.getExportValues();if(t){for(var n=this.acroField.getOnValues(),r=0,i=n.length;r<i;r++)if(n[r]===e)return t[r].decodeText()}return e.decodeText()}},t.prototype.select=function(e){q(e,`option`,[`string`]);var t=this.getOptions();n_(e,`option`,t),this.markAsDirty();var n=this.acroField.getOnValues(),r=this.acroField.getExportValues();if(r)for(var i=0,a=r.length;i<a;i++)r[i].decodeText()===e&&this.acroField.setValue(n[i]);else for(var i=0,a=n.length;i<a;i++){var o=n[i];o.decodeText()===e&&this.acroField.setValue(o)}},t.prototype.clear=function(){this.markAsDirty(),this.acroField.setValue(Z.of(`Off`))},t.prototype.isOffToggleable=function(){return!this.acroField.hasFlag(Qb.NoToggleToOff)},t.prototype.enableOffToggling=function(){this.acroField.setFlagTo(Qb.NoToggleToOff,!1)},t.prototype.disableOffToggling=function(){this.acroField.setFlagTo(Qb.NoToggleToOff,!0)},t.prototype.isMutuallyExclusive=function(){return!this.acroField.hasFlag(Qb.RadiosInUnison)},t.prototype.enableMutualExclusion=function(){this.acroField.setFlagTo(Qb.RadiosInUnison,!1)},t.prototype.disableMutualExclusion=function(){this.acroField.setFlagTo(Qb.RadiosInUnison,!0)},t.prototype.addOptionToPage=function(e,t,n){q(e,`option`,[`string`]),q(t,`page`,[[UT,`PDFPage`]]),oT(n);var r=this.createWidget({x:n?.x??0,y:n?.y??0,width:n?.width??50,height:n?.height??50,textColor:n?.textColor??CC(0,0,0),backgroundColor:n?.backgroundColor??CC(1,1,1),borderColor:n?.borderColor??CC(0,0,0),borderWidth:n?.borderWidth??1,rotate:n?.rotate??vS(0),hidden:n?.hidden,page:t.ref}),i=this.doc.context.register(r.dict),a=this.acroField.addWidgetWithOpt(i,gy.fromText(e),!this.isMutuallyExclusive());r.setAppearanceState(Z.of(`Off`)),this.updateWidgetAppearance(r,a),t.node.addAnnot(i)},t.prototype.needsAppearancesUpdate=function(){for(var e=this.acroField.getWidgets(),t=0,n=e.length;t<n;t++){var r=e[t],i=r.getAppearanceState(),a=r.getAppearances()?.normal;if(!(a instanceof Q)||i&&!a.has(i))return!0}return!1},t.prototype.defaultUpdateAppearances=function(){this.updateAppearances()},t.prototype.updateAppearances=function(e){J(e,`provider`,[Function]);for(var t=this.acroField.getWidgets(),n=0,r=t.length;n<r;n++){var i=t[n],a=i.getOnValue();a&&this.updateWidgetAppearance(i,a,e)}},t.prototype.updateWidgetAppearance=function(e,t,n){var r=Rw((n??Gw)(this,e));this.updateOnOffWidgetAppearance(e,t,r)},t.of=function(e,n,r){return new t(e,n,r)},t}(sT)})),_T,vT=s((()=>{K(),cT(),fS(),x_(),_T=function(e){G(t,e);function t(t,n,r){var i=e.call(this,t,n,r)||this;return q(t,`acroSignature`,[[cx,`PDFAcroSignature`]]),i.acroField=t,i}return t.prototype.needsAppearancesUpdate=function(){return!1},t.of=function(e,n,r){return new t(e,n,r)},t}(sT)})),yT,bT=s((()=>{K(),WT(),eT(),cT(),Xw(),MC(),OS(),Tw(),iT(),Dw(),fS(),x_(),yT=function(e){G(t,e);function t(t,n,r){var i=e.call(this,t,n,r)||this;return q(t,`acroText`,[[ux,`PDFAcroText`]]),i.acroField=t,i}return t.prototype.getText=function(){var e=this.acroField.getValue();if(!e&&this.isRichFormatted())throw new xw(this.getName());return e?.decodeText()},t.prototype.setText=function(e){J(e,`text`,[`string`]);var t=this.getMaxLength();if(t!==void 0&&e&&e.length>t)throw new Cw(e.length,t,this.getName());this.markAsDirty(),this.disableRichFormatting(),e?this.acroField.setValue(gy.fromText(e)):this.acroField.removeValue()},t.prototype.getAlignment=function(){var e=this.acroField.getQuadding();return e===0?Ew.Left:e===1?Ew.Center:e===2?Ew.Right:Ew.Left},t.prototype.setAlignment=function(e){n_(e,`alignment`,Ew),this.markAsDirty(),this.acroField.setQuadding(e)},t.prototype.getMaxLength=function(){return this.acroField.getMaxLength()},t.prototype.setMaxLength=function(e){if(u_(e,`maxLength`,0,2**53-1),this.markAsDirty(),e===void 0)this.acroField.removeMaxLength();else{var t=this.getText();if(t&&t.length>e)throw new ww(t.length,e,this.getName());this.acroField.setMaxLength(e)}},t.prototype.removeMaxLength=function(){this.markAsDirty(),this.acroField.removeMaxLength()},t.prototype.setImage=function(e){for(var t=this.getAlignment(),n=t===Ew.Center?rT.Center:t===Ew.Right?rT.Right:rT.Left,r=this.acroField.getWidgets(),i=0,a=r.length;i<a;i++){var o=r[i],s=this.createImageAppearanceStream(o,e,n);this.updateWidgetAppearances(o,{normal:s})}this.markAsClean()},t.prototype.setFontSize=function(e){p_(e,`fontSize`),this.acroField.setFontSize(e),this.markAsDirty()},t.prototype.isMultiline=function(){return this.acroField.hasFlag($b.Multiline)},t.prototype.enableMultiline=function(){this.markAsDirty(),this.acroField.setFlagTo($b.Multiline,!0)},t.prototype.disableMultiline=function(){this.markAsDirty(),this.acroField.setFlagTo($b.Multiline,!1)},t.prototype.isPassword=function(){return this.acroField.hasFlag($b.Password)},t.prototype.enablePassword=function(){this.acroField.setFlagTo($b.Password,!0)},t.prototype.disablePassword=function(){this.acroField.setFlagTo($b.Password,!1)},t.prototype.isFileSelector=function(){return this.acroField.hasFlag($b.FileSelect)},t.prototype.enableFileSelection=function(){this.acroField.setFlagTo($b.FileSelect,!0)},t.prototype.disableFileSelection=function(){this.acroField.setFlagTo($b.FileSelect,!1)},t.prototype.isSpellChecked=function(){return!this.acroField.hasFlag($b.DoNotSpellCheck)},t.prototype.enableSpellChecking=function(){this.acroField.setFlagTo($b.DoNotSpellCheck,!1)},t.prototype.disableSpellChecking=function(){this.acroField.setFlagTo($b.DoNotSpellCheck,!0)},t.prototype.isScrollable=function(){return!this.acroField.hasFlag($b.DoNotScroll)},t.prototype.enableScrolling=function(){this.acroField.setFlagTo($b.DoNotScroll,!1)},t.prototype.disableScrolling=function(){this.acroField.setFlagTo($b.DoNotScroll,!0)},t.prototype.isCombed=function(){return this.acroField.hasFlag($b.Comb)&&!this.isMultiline()&&!this.isPassword()&&!this.isFileSelector()&&this.getMaxLength()!==void 0},t.prototype.enableCombing=function(){this.getMaxLength()===void 0&&console.warn(`PDFTextFields must have a max length in order to be combed`),this.markAsDirty(),this.disableMultiline(),this.disablePassword(),this.disableFileSelection(),this.acroField.setFlagTo($b.Comb,!0)},t.prototype.disableCombing=function(){this.markAsDirty(),this.acroField.setFlagTo($b.Comb,!1)},t.prototype.isRichFormatted=function(){return this.acroField.hasFlag($b.RichText)},t.prototype.enableRichFormatting=function(){this.acroField.setFlagTo($b.RichText,!0)},t.prototype.disableRichFormatting=function(){this.acroField.setFlagTo($b.RichText,!1)},t.prototype.addToPage=function(e,t){q(e,`page`,[[UT,`PDFPage`]]),oT(t),t||={},`textColor`in t||(t.textColor=CC(0,0,0)),`backgroundColor`in t||(t.backgroundColor=CC(1,1,1)),`borderColor`in t||(t.borderColor=CC(0,0,0)),`borderWidth`in t||(t.borderWidth=1);var n=this.createWidget({x:t.x??0,y:t.y??0,width:t.width??200,height:t.height??50,textColor:t.textColor,backgroundColor:t.backgroundColor,borderColor:t.borderColor,borderWidth:t.borderWidth??0,rotate:t.rotate??vS(0),hidden:t.hidden,page:e.ref}),r=this.doc.context.register(n.dict);this.acroField.addWidget(r);var i=t.font??this.doc.getForm().getDefaultFont();this.updateWidgetAppearance(n,i),e.node.addAnnot(r)},t.prototype.needsAppearancesUpdate=function(){if(this.isDirty())return!0;for(var e=this.acroField.getWidgets(),t=0,n=e.length;t<n;t++)if(!(e[t].getAppearances()?.normal instanceof Tv))return!0;return!1},t.prototype.defaultUpdateAppearances=function(e){q(e,`font`,[[$w,`PDFFont`]]),this.updateAppearances(e)},t.prototype.updateAppearances=function(e,t){q(e,`font`,[[$w,`PDFFont`]]),J(t,`provider`,[Function]);for(var n=this.acroField.getWidgets(),r=0,i=n.length;r<i;r++){var a=n[r];this.updateWidgetAppearance(a,e,t)}this.markAsClean()},t.prototype.updateWidgetAppearance=function(e,t,n){var r=Rw((n??qw)(this,e,t));this.updateWidgetAppearanceWithFont(e,t,r)},t.of=function(e,n,r){return new t(e,n,r)},t}(sT)})),xT,ST=s((()=>{(function(e){e.Courier=`Courier`,e.CourierBold=`Courier-Bold`,e.CourierOblique=`Courier-Oblique`,e.CourierBoldOblique=`Courier-BoldOblique`,e.Helvetica=`Helvetica`,e.HelveticaBold=`Helvetica-Bold`,e.HelveticaOblique=`Helvetica-Oblique`,e.HelveticaBoldOblique=`Helvetica-BoldOblique`,e.TimesRoman=`Times-Roman`,e.TimesRomanBold=`Times-Bold`,e.TimesRomanItalic=`Times-Italic`,e.TimesRomanBoldItalic=`Times-BoldItalic`,e.Symbol=`Symbol`,e.ZapfDingbats=`ZapfDingbats`})(xT||={})})),CT,wT,TT,ET,DT=s((()=>{K(),BT(),KT(),uT(),fT(),mT(),gT(),vT(),bT(),Tw(),eT(),ST(),fw(),bC(),fS(),x_(),CT=function(){function e(e,t){var n=this;this.embedDefaultFont=function(){return n.doc.embedStandardFont(xT.Helvetica)},q(e,`acroForm`,[[Ox,`PDFAcroForm`]]),q(t,`doc`,[[zT,`PDFDocument`]]),this.acroForm=e,this.doc=t,this.dirtyFields=new Set,this.defaultFontCache=y_.populatedBy(this.embedDefaultFont)}return e.prototype.hasXFA=function(){return this.acroForm.dict.has(Z.of(`XFA`))},e.prototype.deleteXFA=function(){this.acroForm.dict.delete(Z.of(`XFA`))},e.prototype.getFields=function(){for(var e=this.acroForm.getAllFields(),t=[],n=0,r=e.length;n<r;n++){var i=e[n],a=i[0],o=i[1],s=wT(a,o,this.doc);s&&t.push(s)}return t},e.prototype.getFieldMaybe=function(e){q(e,`name`,[`string`]);for(var t=this.getFields(),n=0,r=t.length;n<r;n++){var i=t[n];if(i.getName()===e)return i}},e.prototype.getField=function(e){q(e,`name`,[`string`]);var t=this.getFieldMaybe(e);if(t)return t;throw new _w(e)},e.prototype.getButton=function(e){q(e,`name`,[`string`]);var t=this.getField(e);if(t instanceof GT)return t;throw new vw(e,GT,t)},e.prototype.getCheckBox=function(e){q(e,`name`,[`string`]);var t=this.getField(e);if(t instanceof lT)return t;throw new vw(e,lT,t)},e.prototype.getDropdown=function(e){q(e,`name`,[`string`]);var t=this.getField(e);if(t instanceof dT)return t;throw new vw(e,dT,t)},e.prototype.getOptionList=function(e){q(e,`name`,[`string`]);var t=this.getField(e);if(t instanceof pT)return t;throw new vw(e,pT,t)},e.prototype.getRadioGroup=function(e){q(e,`name`,[`string`]);var t=this.getField(e);if(t instanceof hT)return t;throw new vw(e,hT,t)},e.prototype.getSignature=function(e){q(e,`name`,[`string`]);var t=this.getField(e);if(t instanceof _T)return t;throw new vw(e,_T,t)},e.prototype.getTextField=function(e){q(e,`name`,[`string`]);var t=this.getField(e);if(t instanceof yT)return t;throw new vw(e,yT,t)},e.prototype.createButton=function(e){q(e,`name`,[`string`]);var t=TT(e),n=this.findOrCreateNonTerminals(t.nonTerminal),r=fx.create(this.doc.context);return r.setPartialName(t.terminal),ET(n,[r,r.ref],t.terminal),GT.of(r,r.ref,this.doc)},e.prototype.createCheckBox=function(e){q(e,`name`,[`string`]);var t=TT(e),n=this.findOrCreateNonTerminals(t.nonTerminal),r=Jb.create(this.doc.context);return r.setPartialName(t.terminal),ET(n,[r,r.ref],t.terminal),lT.of(r,r.ref,this.doc)},e.prototype.createDropdown=function(e){q(e,`name`,[`string`]);var t=TT(e),n=this.findOrCreateNonTerminals(t.nonTerminal),r=ix.create(this.doc.context);return r.setPartialName(t.terminal),ET(n,[r,r.ref],t.terminal),dT.of(r,r.ref,this.doc)},e.prototype.createOptionList=function(e){q(e,`name`,[`string`]);var t=TT(e),n=this.findOrCreateNonTerminals(t.nonTerminal),r=gx.create(this.doc.context);return r.setPartialName(t.terminal),ET(n,[r,r.ref],t.terminal),pT.of(r,r.ref,this.doc)},e.prototype.createRadioGroup=function(e){q(e,`name`,[`string`]);var t=TT(e),n=this.findOrCreateNonTerminals(t.nonTerminal),r=mx.create(this.doc.context);return r.setPartialName(t.terminal),ET(n,[r,r.ref],t.terminal),hT.of(r,r.ref,this.doc)},e.prototype.createTextField=function(e){q(e,`name`,[`string`]);var t=TT(e),n=this.findOrCreateNonTerminals(t.nonTerminal),r=ux.create(this.doc.context);return r.setPartialName(t.terminal),ET(n,[r,r.ref],t.terminal),yT.of(r,r.ref,this.doc)},e.prototype.flatten=function(e){e===void 0&&(e={updateFieldAppearances:!0}),e.updateFieldAppearances&&this.updateFieldAppearances();for(var t=this.getFields(),n=0,r=t.length;n<r;n++){for(var i=t[n],a=i.acroField.getWidgets(),o=0,s=a.length;o<s;o++){var c=a[o],l=this.findWidgetPage(c),u=this.findWidgetAppearanceRef(i,c),d=l.node.newXObject(`FlatWidget`,u),f=c.getRectangle(),p=vm([WS(),PS(f.x,f.y)],aw(bm(bm({},f),{rotation:0})),[dC(d),GS()]).filter(Boolean);l.pushOperators.apply(l,p)}this.removeField(i)}},e.prototype.removeField=function(e){for(var t=e.acroField.getWidgets(),n=new Set,r=0,i=t.length;r<i;r++){var a=t[r],o=this.findWidgetAppearanceRef(e,a),s=this.findWidgetPage(a);n.add(s),s.node.removeAnnot(o)}n.forEach(function(t){return t.node.removeAnnot(e.ref)}),this.acroForm.removeField(e.acroField);for(var c=e.acroField.normalizedEntries().Kids,l=c.size(),u=0;u<l;u++){var d=c.get(u);d instanceof jv&&this.doc.context.delete(d)}this.doc.context.delete(e.ref)},e.prototype.updateFieldAppearances=function(e){J(e,`font`,[[$w,`PDFFont`]]),e??=this.getDefaultFont();for(var t=this.getFields(),n=0,r=t.length;n<r;n++){var i=t[n];i.needsAppearancesUpdate()&&i.defaultUpdateAppearances(e)}},e.prototype.markFieldAsDirty=function(e){J(e,`fieldRef`,[[jv,`PDFRef`]]),this.dirtyFields.add(e)},e.prototype.markFieldAsClean=function(e){J(e,`fieldRef`,[[jv,`PDFRef`]]),this.dirtyFields.delete(e)},e.prototype.fieldIsDirty=function(e){return J(e,`fieldRef`,[[jv,`PDFRef`]]),this.dirtyFields.has(e)},e.prototype.getDefaultFont=function(){return this.defaultFontCache.access()},e.prototype.findWidgetPage=function(e){var t=e.P(),n=this.doc.getPages().find(function(e){return e.ref===t});if(n===void 0){var r=this.doc.context.getObjectRef(e.dict);if(r===void 0)throw Error(`Could not find PDFRef for PDFObject`);if(n=this.doc.findPageForAnnotationRef(r),n===void 0)throw Error(`Could not find page for PDFRef `+r)}return n},e.prototype.findWidgetAppearanceRef=function(e,t){var n=t.getNormalAppearance();if(n instanceof Q&&(e instanceof lT||e instanceof hT)){var r=e.acroField.getValue(),i=n.get(r)??n.get(Z.of(`Off`));i instanceof jv&&(n=i)}if(!(n instanceof jv)){var a=e.getName();throw Error(`Failed to extract appearance ref for: `+a)}return n},e.prototype.findOrCreateNonTerminals=function(e){for(var t=[this.acroForm],n=0,r=e.length;n<r;n++){var i=e[n];if(!i)throw new bw(i);var a=t[0],o=t[1],s=this.findNonTerminal(i,a);if(s)t=s;else{var c=ox.create(this.doc.context);c.setPartialName(i),c.setParent(o);var l=this.doc.context.register(c.dict);a.addField(l),t=[c,l]}}return t},e.prototype.findNonTerminal=function(e,t){for(var n=t instanceof Ox?this.acroForm.getFields():vx(t.Kids()),r=0,i=n.length;r<i;r++){var a=n[r],o=a[0],s=a[1];if(o.getPartialName()===e){if(o instanceof ox)return[o,s];throw new yw(e)}}},e.of=function(t,n){return new e(t,n)},e}(),wT=function(e,t,n){if(e instanceof fx)return GT.of(e,t,n);if(e instanceof Jb)return lT.of(e,t,n);if(e instanceof ix)return dT.of(e,t,n);if(e instanceof gx)return pT.of(e,t,n);if(e instanceof ux)return yT.of(e,t,n);if(e instanceof mx)return hT.of(e,t,n);if(e instanceof cx)return _T.of(e,t,n)},TT=function(e){if(e.length===0)throw Error(`PDF field names must not be empty strings`);for(var t=e.split(`.`),n=0,r=t.length;n<r;n++)if(t[n]===``)throw Error(`Periods in PDF field names must be separated by at least one character: "`+e+`"`);return t.length===1?{nonTerminal:[],terminal:t[0]}:{nonTerminal:t.slice(0,t.length-1),terminal:t[t.length-1]}},ET=function(e,t,n){for(var r=e[0],i=e[1],a=t[0],o=t[1],s=r.normalizedEntries(),c=vx(`Kids`in s?s.Kids:s.Fields),l=0,u=c.length;l<u;l++)if(c[l][0].getPartialName()===n)throw new yw(n);r.addField(o),a.setParent(i)}})),OT,kT=s((()=>{OT={"4A0":[4767.87,6740.79],"2A0":[3370.39,4767.87],A0:[2383.94,3370.39],A1:[1683.78,2383.94],A2:[1190.55,1683.78],A3:[841.89,1190.55],A4:[595.28,841.89],A5:[419.53,595.28],A6:[297.64,419.53],A7:[209.76,297.64],A8:[147.4,209.76],A9:[104.88,147.4],A10:[73.7,104.88],B0:[2834.65,4008.19],B1:[2004.09,2834.65],B2:[1417.32,2004.09],B3:[1000.63,1417.32],B4:[708.66,1000.63],B5:[498.9,708.66],B6:[354.33,498.9],B7:[249.45,354.33],B8:[175.75,249.45],B9:[124.72,175.75],B10:[87.87,124.72],C0:[2599.37,3676.54],C1:[1836.85,2599.37],C2:[1298.27,1836.85],C3:[918.43,1298.27],C4:[649.13,918.43],C5:[459.21,649.13],C6:[323.15,459.21],C7:[229.61,323.15],C8:[161.57,229.61],C9:[113.39,161.57],C10:[79.37,113.39],RA0:[2437.8,3458.27],RA1:[1729.13,2437.8],RA2:[1218.9,1729.13],RA3:[864.57,1218.9],RA4:[609.45,864.57],SRA0:[2551.18,3628.35],SRA1:[1814.17,2551.18],SRA2:[1275.59,1814.17],SRA3:[907.09,1275.59],SRA4:[637.8,907.09],Executive:[521.86,756],Folio:[612,936],Legal:[612,1008],Letter:[612,792],Tabloid:[792,1224]}})),AT,jT=s((()=>{(function(e){e[e.Fastest=1/0]=`Fastest`,e[e.Fast=1500]=`Fast`,e[e.Medium=500]=`Medium`,e[e.Slow=100]=`Slow`})(AT||={})})),MT,NT=s((()=>{K(),fS(),MT=function(){function e(e,t,n){this.alreadyEmbedded=!1,this.ref=e,this.doc=t,this.embedder=n}return e.prototype.embed=function(){return gm(this,void 0,void 0,function(){var e,t,n,r,i;return _m(this,function(a){switch(a.label){case 0:return this.alreadyEmbedded?[3,2]:[4,this.embedder.embedIntoContext(this.doc.context,this.ref)];case 1:e=a.sent(),this.doc.catalog.has(Z.of(`Names`))||this.doc.catalog.set(Z.of(`Names`),this.doc.context.obj({})),t=this.doc.catalog.lookup(Z.of(`Names`),Q),t.has(Z.of(`EmbeddedFiles`))||t.set(Z.of(`EmbeddedFiles`),this.doc.context.obj({})),n=t.lookup(Z.of(`EmbeddedFiles`),Q),n.has(Z.of(`Names`))||n.set(Z.of(`Names`),this.doc.context.obj([])),r=n.lookup(Z.of(`Names`),X),r.push(gy.fromText(this.embedder.fileName)),r.push(e),this.doc.catalog.has(Z.of(`AF`))||this.doc.catalog.set(Z.of(`AF`),this.doc.context.obj([])),i=this.doc.catalog.lookup(Z.of(`AF`),X),i.push(e),this.alreadyEmbedded=!0,a.label=2;case 2:return[2]}})})},e.of=function(t,n,r){return new e(t,n,r)},e}()})),PT,FT=s((()=>{K(),fS(),PT=function(){function e(e,t,n){this.alreadyEmbedded=!1,this.ref=e,this.doc=t,this.embedder=n}return e.prototype.embed=function(){return gm(this,void 0,void 0,function(){var e,t,n,r,i,a,o;return _m(this,function(s){switch(s.label){case 0:return this.alreadyEmbedded?[3,2]:(e=this.doc,t=e.catalog,n=e.context,[4,this.embedder.embedIntoContext(this.doc.context,this.ref)]);case 1:r=s.sent(),t.has(Z.of(`Names`))||t.set(Z.of(`Names`),n.obj({})),i=t.lookup(Z.of(`Names`),Q),i.has(Z.of(`JavaScript`))||i.set(Z.of(`JavaScript`),n.obj({})),a=i.lookup(Z.of(`JavaScript`),Q),a.has(Z.of(`Names`))||a.set(Z.of(`Names`),n.obj([])),o=a.lookup(Z.of(`Names`),X),o.push(gy.fromText(this.embedder.scriptName)),o.push(r),this.alreadyEmbedded=!0,s.label=2;case 2:return[2]}})})},e.of=function(t,n,r){return new e(t,n,r)},e}()})),IT,LT=s((()=>{K(),_y(),IT=function(){function e(e,t){this.script=e,this.scriptName=t}return e.for=function(t,n){return new e(t,n)},e.prototype.embedIntoContext=function(e,t){return gm(this,void 0,void 0,function(){var n;return _m(this,function(r){return n=e.obj({Type:`Action`,S:`JavaScript`,JS:gy.fromText(this.script)}),t?(e.assign(t,n),[2,t]):[2,e.register(n)]})})},e}()}));function RT(e){if(!(e instanceof gy)&&!(e instanceof ky))throw new w_([gy,ky],e)}var zT,BT=s((()=>{K(),Tw(),Qw(),eT(),nT(),WT(),DT(),kT(),fS(),jT(),x_(),Ly(),NT(),FT(),LT(),zT=function(){function e(e,t,n){var r=this;if(this.defaultWordBreaks=[` `],this.computePages=function(){var e=[];return r.catalog.Pages().traverse(function(t,n){if(t instanceof Yv){var i=r.pageMap.get(t);i||(i=UT.of(t,n,r),r.pageMap.set(t,i)),e.push(i)}}),e},this.getOrCreateForm=function(){var e=r.catalog.getOrCreateAcroForm();return CT.of(e,r)},q(e,`context`,[[qv,`PDFContext`]]),q(t,`ignoreEncryption`,[`boolean`]),this.context=e,this.catalog=e.lookup(e.trailerInfo.Root),this.isEncrypted=!!e.lookup(e.trailerInfo.Encrypt),this.pageCache=y_.populatedBy(this.computePages),this.pageMap=new Map,this.formCache=y_.populatedBy(this.getOrCreateForm),this.fonts=[],this.images=[],this.embeddedPages=[],this.embeddedFiles=[],this.javaScripts=[],!t&&this.isEncrypted)throw new pw;n&&this.updateInfoDict()}return e.load=function(t,n){return n===void 0&&(n={}),gm(this,void 0,void 0,function(){var r,i,a,o,s,c,l,u,d,f,p,m;return _m(this,function(h){switch(h.label){case 0:return r=n.ignoreEncryption,i=r!==void 0&&r,a=n.parseSpeed,o=a===void 0?AT.Slow:a,s=n.throwOnInvalidObject,c=s!==void 0&&s,l=n.updateMetadata,u=l===void 0||l,d=n.capNumbers,f=d!==void 0&&d,q(t,`pdf`,[`string`,Uint8Array,ArrayBuffer]),q(i,`ignoreEncryption`,[`boolean`]),q(o,`parseSpeed`,[`number`]),q(c,`throwOnInvalidObject`,[`boolean`]),p=lh(t),[4,oS.forBytesWithOptions(p,o,c,f).parseDocument()];case 1:return m=h.sent(),[2,new e(m,i,u)]}})})},e.create=function(t){return t===void 0&&(t={}),gm(this,void 0,void 0,function(){var n,r,i,a,o,s;return _m(this,function(c){return n=t.updateMetadata,r=n===void 0||n,i=qv.create(),a=Nx.withContext(i),o=i.register(a),s=jx.withContextAndPages(i,o),i.trailerInfo.Root=i.register(s),[2,new e(i,!1,r)]})})},e.prototype.registerFontkit=function(e){this.fontkit=e},e.prototype.getForm=function(){var e=this.formCache.access();return e.hasXFA()&&(console.warn(`Removing XFA form data as pdf-lib does not support reading or writing XFA`),e.deleteXFA()),e},e.prototype.getTitle=function(){var e=this.getInfoDict().lookup(Z.Title);if(e)return RT(e),e.decodeText()},e.prototype.getAuthor=function(){var e=this.getInfoDict().lookup(Z.Author);if(e)return RT(e),e.decodeText()},e.prototype.getSubject=function(){var e=this.getInfoDict().lookup(Z.Subject);if(e)return RT(e),e.decodeText()},e.prototype.getKeywords=function(){var e=this.getInfoDict().lookup(Z.Keywords);if(e)return RT(e),e.decodeText()},e.prototype.getCreator=function(){var e=this.getInfoDict().lookup(Z.Creator);if(e)return RT(e),e.decodeText()},e.prototype.getProducer=function(){var e=this.getInfoDict().lookup(Z.Producer);if(e)return RT(e),e.decodeText()},e.prototype.getCreationDate=function(){var e=this.getInfoDict().lookup(Z.CreationDate);if(e)return RT(e),e.decodeDate()},e.prototype.getModificationDate=function(){var e=this.getInfoDict().lookup(Z.ModDate);if(e)return RT(e),e.decodeDate()},e.prototype.setTitle=function(e,t){q(e,`title`,[`string`]);var n=Z.of(`Title`);this.getInfoDict().set(n,gy.fromText(e)),t?.showInWindowTitleBar&&this.catalog.getOrCreateViewerPreferences().setDisplayDocTitle(!0)},e.prototype.setAuthor=function(e){q(e,`author`,[`string`]);var t=Z.of(`Author`);this.getInfoDict().set(t,gy.fromText(e))},e.prototype.setSubject=function(e){q(e,`author`,[`string`]);var t=Z.of(`Subject`);this.getInfoDict().set(t,gy.fromText(e))},e.prototype.setKeywords=function(e){q(e,`keywords`,[Array]);var t=Z.of(`Keywords`);this.getInfoDict().set(t,gy.fromText(e.join(` `)))},e.prototype.setCreator=function(e){q(e,`creator`,[`string`]);var t=Z.of(`Creator`);this.getInfoDict().set(t,gy.fromText(e))},e.prototype.setProducer=function(e){q(e,`creator`,[`string`]);var t=Z.of(`Producer`);this.getInfoDict().set(t,gy.fromText(e))},e.prototype.setLanguage=function(e){q(e,`language`,[`string`]);var t=Z.of(`Lang`);this.catalog.set(t,ky.of(e))},e.prototype.setCreationDate=function(e){q(e,`creationDate`,[[Date,`Date`]]);var t=Z.of(`CreationDate`);this.getInfoDict().set(t,ky.fromDate(e))},e.prototype.setModificationDate=function(e){q(e,`modificationDate`,[[Date,`Date`]]);var t=Z.of(`ModDate`);this.getInfoDict().set(t,ky.fromDate(e))},e.prototype.getPageCount=function(){return this.pageCount===void 0&&(this.pageCount=this.getPages().length),this.pageCount},e.prototype.getPages=function(){return this.pageCache.access()},e.prototype.getPage=function(e){var t=this.getPages();return l_(e,`index`,0,t.length-1),t[e]},e.prototype.getPageIndices=function(){return oh(0,this.getPageCount())},e.prototype.removePage=function(e){var t=this.getPageCount();if(this.pageCount===0)throw new gw;l_(e,`index`,0,t-1),this.catalog.removeLeafNode(e),this.pageCount=t-1},e.prototype.addPage=function(e){return q(e,`page`,[`undefined`,[UT,`PDFPage`],Array]),this.insertPage(this.getPageCount(),e)},e.prototype.insertPage=function(e,t){var n=this.getPageCount();if(l_(e,`index`,0,n),q(t,`page`,[`undefined`,[UT,`PDFPage`],Array]),!t||Array.isArray(t)){var r=Array.isArray(t)?t:OT.A4;t=UT.create(this),t.setSize.apply(t,r)}else if(t.doc!==this)throw new hw;var i=this.catalog.insertLeafNode(t.ref,e);return t.node.setParent(i),this.pageMap.set(t.node,t),this.pageCache.invalidate(),this.pageCount=n+1,t},e.prototype.copyPages=function(t,n){return gm(this,void 0,void 0,function(){var r,i,a,o,s,c,l,u;return _m(this,function(d){switch(d.label){case 0:return q(t,`srcDoc`,[[e,`PDFDocument`]]),q(n,`indices`,[Array]),[4,t.flush()];case 1:for(d.sent(),r=Zv.for(t.context,this.context),i=t.getPages(),a=Array(n.length),o=0,s=n.length;o<s;o++)c=i[n[o]],l=r.copy(c.node),u=this.context.register(l),a[o]=UT.of(l,u,this);return[2,a]}})})},e.prototype.copy=function(){return gm(this,void 0,void 0,function(){var t,n,r,i;return _m(this,function(a){switch(a.label){case 0:return[4,e.create()];case 1:return t=a.sent(),[4,t.copyPages(this,this.getPageIndices())];case 2:for(n=a.sent(),r=0,i=n.length;r<i;r++)t.addPage(n[r]);return this.getAuthor()!==void 0&&t.setAuthor(this.getAuthor()),this.getCreationDate()!==void 0&&t.setCreationDate(this.getCreationDate()),this.getCreator()!==void 0&&t.setCreator(this.getCreator()),this.getModificationDate()!==void 0&&t.setModificationDate(this.getModificationDate()),this.getProducer()!==void 0&&t.setProducer(this.getProducer()),this.getSubject()!==void 0&&t.setSubject(this.getSubject()),this.getTitle()!==void 0&&t.setTitle(this.getTitle()),t.defaultWordBreaks=this.defaultWordBreaks,[2,t]}})})},e.prototype.addJavaScript=function(e,t){q(e,`name`,[`string`]),q(t,`script`,[`string`]);var n=IT.for(t,e),r=this.context.nextRef(),i=PT.of(r,this,n);this.javaScripts.push(i)},e.prototype.attach=function(e,t,n){return n===void 0&&(n={}),gm(this,void 0,void 0,function(){var r,i,a,o;return _m(this,function(s){return q(e,`attachment`,[`string`,Uint8Array,ArrayBuffer]),q(t,`name`,[`string`]),J(n.mimeType,`mimeType`,[`string`]),J(n.description,`description`,[`string`]),J(n.creationDate,`options.creationDate`,[Date]),J(n.modificationDate,`options.modificationDate`,[Date]),r_(n.afRelationship,`options.afRelationship`,Fy),r=lh(e),i=Iy.for(r,t,n),a=this.context.nextRef(),o=MT.of(a,this,i),this.embeddedFiles.push(o),[2]})})},e.prototype.embedFont=function(e,t){return t===void 0&&(t={}),gm(this,void 0,void 0,function(){var n,r,i,a,o,s,c,l,u,d;return _m(this,function(f){switch(f.label){case 0:return n=t.subset,r=n!==void 0&&n,i=t.customName,a=t.features,q(e,`font`,[`string`,Uint8Array,ArrayBuffer]),q(r,`subset`,[`boolean`]),Yg(e)?(o=vy.for(e,i),[3,7]):[3,1];case 1:return ch(e)?(s=lh(e),c=this.assertFontkit(),r?[4,Ny.for(c,s,i,a)]:[3,3]):[3,6];case 2:return l=f.sent(),[3,5];case 3:return[4,jy.for(c,s,i,a)];case 4:l=f.sent(),f.label=5;case 5:return o=l,[3,7];case 6:throw TypeError("`font` must be one of `StandardFonts | string | Uint8Array | ArrayBuffer`");case 7:return u=this.context.nextRef(),d=$w.of(u,this,o),this.fonts.push(d),[2,d]}})})},e.prototype.embedStandardFont=function(e,t){if(q(e,`font`,[`string`]),!Yg(e))throw TypeError("`font` must be one of type `StandardFonts`");var n=vy.for(e,t),r=this.context.nextRef(),i=$w.of(r,this,n);return this.fonts.push(i),i},e.prototype.embedJpg=function(e){return gm(this,void 0,void 0,function(){var t,n,r,i;return _m(this,function(a){switch(a.label){case 0:return q(e,`jpg`,[`string`,Uint8Array,ArrayBuffer]),t=lh(e),[4,Vy.for(t)];case 1:return n=a.sent(),r=this.context.nextRef(),i=tT.of(r,this,n),this.images.push(i),[2,i]}})})},e.prototype.embedPng=function(e){return gm(this,void 0,void 0,function(){var t,n,r,i;return _m(this,function(a){switch(a.label){case 0:return q(e,`png`,[`string`,Uint8Array,ArrayBuffer]),t=lh(e),[4,Xy.for(t)];case 1:return n=a.sent(),r=this.context.nextRef(),i=tT.of(r,this,n),this.images.push(i),[2,i]}})})},e.prototype.embedPdf=function(t,n){return n===void 0&&(n=[0]),gm(this,void 0,void 0,function(){var r,i,a;return _m(this,function(o){switch(o.label){case 0:return q(t,`pdf`,[`string`,Uint8Array,ArrayBuffer,[e,`PDFDocument`]]),q(n,`indices`,[Array]),t instanceof e?(i=t,[3,3]):[3,1];case 1:return[4,e.load(t)];case 2:i=o.sent(),o.label=3;case 3:return r=i,a=sh(r.getPages(),n),[2,this.embedPages(a)]}})})},e.prototype.embedPage=function(e,t,n){return gm(this,void 0,void 0,function(){var r;return _m(this,function(i){switch(i.label){case 0:return q(e,`page`,[[UT,`PDFPage`]]),[4,this.embedPages([e],[t],[n])];case 1:return r=i.sent()[0],[2,r]}})})},e.prototype.embedPages=function(e,t,n){return t===void 0&&(t=[]),n===void 0&&(n=[]),gm(this,void 0,void 0,function(){var r,i,a,o,s,c,l,r,i,u,d,f,p,m,h;return _m(this,function(g){switch(g.label){case 0:if(e.length===0)return[2,[]];for(r=0,i=e.length-1;r<i;r++)if(a=e[r],o=e[r+1],a.node.context!==o.node.context)throw new k_;s=e[0].node.context,c=s===this.context?function(e){return e}:Zv.for(s,this.context).copy,l=Array(e.length),r=0,i=e.length,g.label=1;case 1:return r<i?(u=c(e[r].node),d=t[r],f=n[r],[4,wb.for(u,d,f)]):[3,4];case 2:p=g.sent(),m=this.context.nextRef(),l[r]=Zw.of(m,this,p),g.label=3;case 3:return r++,[3,1];case 4:return(h=this.embeddedPages).push.apply(h,l),[2,l]}})})},e.prototype.flush=function(){return gm(this,void 0,void 0,function(){return _m(this,function(e){switch(e.label){case 0:return[4,this.embedAll(this.fonts)];case 1:return e.sent(),[4,this.embedAll(this.images)];case 2:return e.sent(),[4,this.embedAll(this.embeddedPages)];case 3:return e.sent(),[4,this.embedAll(this.embeddedFiles)];case 4:return e.sent(),[4,this.embedAll(this.javaScripts)];case 5:return e.sent(),[2]}})})},e.prototype.save=function(e){return e===void 0&&(e={}),gm(this,void 0,void 0,function(){var t,n,r,i,a,o,s,c,l,u;return _m(this,function(d){switch(d.label){case 0:return t=e.useObjectStreams,n=t===void 0||t,r=e.addDefaultPage,i=r===void 0||r,a=e.objectsPerTick,o=a===void 0?50:a,s=e.updateFieldAppearances,c=s===void 0||s,q(n,`useObjectStreams`,[`boolean`]),q(i,`addDefaultPage`,[`boolean`]),q(o,`objectsPerTick`,[`number`]),q(c,`updateFieldAppearances`,[`boolean`]),i&&this.getPageCount()===0&&this.addPage(),c&&(l=this.formCache.getValue(),l&&l.updateFieldAppearances()),[4,this.flush()];case 1:return d.sent(),u=n?my:sy,[2,u.forContext(this.context,o).serializeToBuffer()]}})})},e.prototype.saveAsBase64=function(e){return e===void 0&&(e={}),gm(this,void 0,void 0,function(){var t,n,r,i,a;return _m(this,function(o){switch(o.label){case 0:return t=e.dataUri,n=t!==void 0&&t,r=hm(e,[`dataUri`]),q(n,`dataUri`,[`boolean`]),[4,this.save(r)];case 1:return i=o.sent(),a=wm(i),[2,n?`data:application/pdf;base64,`+a:a]}})})},e.prototype.findPageForAnnotationRef=function(e){for(var t=this.getPages(),n=0,r=t.length;n<r;n++){var i=t[n];if(i.node.Annots()?.indexOf(e)!==void 0)return i}},e.prototype.embedAll=function(e){return gm(this,void 0,void 0,function(){var t,n;return _m(this,function(r){switch(r.label){case 0:t=0,n=e.length,r.label=1;case 1:return t<n?[4,e[t].embed()]:[3,4];case 2:r.sent(),r.label=3;case 3:return t++,[3,1];case 4:return[2]}})})},e.prototype.updateInfoDict=function(){var e=`pdf-lib (https://github.com/Hopding/pdf-lib)`,t=new Date,n=this.getInfoDict();this.setProducer(e),this.setModificationDate(t),n.get(Z.of(`Creator`))||this.setCreator(e),n.get(Z.of(`CreationDate`))||this.setCreationDate(t)},e.prototype.getInfoDict=function(){var e=this.context.lookup(this.context.trailerInfo.Info);if(e instanceof Q)return e;var t=this.context.obj({});return this.context.trailerInfo.Info=this.context.register(t),t},e.prototype.assertFontkit=function(){if(!this.fontkit)throw new mw;return this.fontkit},e}()})),VT,HT=s((()=>{(function(e){e.Normal=`Normal`,e.Multiply=`Multiply`,e.Screen=`Screen`,e.Overlay=`Overlay`,e.Darken=`Darken`,e.Lighten=`Lighten`,e.ColorDodge=`ColorDodge`,e.ColorBurn=`ColorBurn`,e.HardLight=`HardLight`,e.SoftLight=`SoftLight`,e.Difference=`Difference`,e.Exclusion=`Exclusion`})(VT||={})})),UT,WT=s((()=>{K(),MC(),fw(),bC(),BT(),Qw(),eT(),nT(),HT(),OS(),ST(),fS(),x_(),UT=function(){function e(e,t,n){this.fontSize=24,this.fontColor=CC(0,0,0),this.lineHeight=24,this.x=0,this.y=0,q(e,`leafNode`,[[Yv,`PDFPageLeaf`]]),q(t,`ref`,[[jv,`PDFRef`]]),q(n,`doc`,[[zT,`PDFDocument`]]),this.node=e,this.ref=t,this.doc=n}return e.prototype.setRotation=function(e){var t=wS(e);d_(t,`degreesAngle`,90),this.node.set(Z.of(`Rotate`),this.doc.context.obj(t))},e.prototype.getRotation=function(){var e=this.node.Rotate();return vS(e?e.asNumber():0)},e.prototype.setSize=function(e,t){q(e,`width`,[`number`]),q(t,`height`,[`number`]);var n=this.getMediaBox();this.setMediaBox(n.x,n.y,e,t);var r=this.getCropBox(),i=this.getBleedBox(),a=this.getTrimBox(),o=this.getArtBox(),s=this.node.CropBox(),c=this.node.BleedBox(),l=this.node.TrimBox(),u=this.node.ArtBox();s&&Xg(r,n)&&this.setCropBox(n.x,n.y,e,t),c&&Xg(i,n)&&this.setBleedBox(n.x,n.y,e,t),l&&Xg(a,n)&&this.setTrimBox(n.x,n.y,e,t),u&&Xg(o,n)&&this.setArtBox(n.x,n.y,e,t)},e.prototype.setWidth=function(e){q(e,`width`,[`number`]),this.setSize(e,this.getSize().height)},e.prototype.setHeight=function(e){q(e,`height`,[`number`]),this.setSize(this.getSize().width,e)},e.prototype.setMediaBox=function(e,t,n,r){q(e,`x`,[`number`]),q(t,`y`,[`number`]),q(n,`width`,[`number`]),q(r,`height`,[`number`]);var i=this.doc.context.obj([e,t,e+n,t+r]);this.node.set(Z.MediaBox,i)},e.prototype.setCropBox=function(e,t,n,r){q(e,`x`,[`number`]),q(t,`y`,[`number`]),q(n,`width`,[`number`]),q(r,`height`,[`number`]);var i=this.doc.context.obj([e,t,e+n,t+r]);this.node.set(Z.CropBox,i)},e.prototype.setBleedBox=function(e,t,n,r){q(e,`x`,[`number`]),q(t,`y`,[`number`]),q(n,`width`,[`number`]),q(r,`height`,[`number`]);var i=this.doc.context.obj([e,t,e+n,t+r]);this.node.set(Z.BleedBox,i)},e.prototype.setTrimBox=function(e,t,n,r){q(e,`x`,[`number`]),q(t,`y`,[`number`]),q(n,`width`,[`number`]),q(r,`height`,[`number`]);var i=this.doc.context.obj([e,t,e+n,t+r]);this.node.set(Z.TrimBox,i)},e.prototype.setArtBox=function(e,t,n,r){q(e,`x`,[`number`]),q(t,`y`,[`number`]),q(n,`width`,[`number`]),q(r,`height`,[`number`]);var i=this.doc.context.obj([e,t,e+n,t+r]);this.node.set(Z.ArtBox,i)},e.prototype.getSize=function(){var e=this.getMediaBox();return{width:e.width,height:e.height}},e.prototype.getWidth=function(){return this.getSize().width},e.prototype.getHeight=function(){return this.getSize().height},e.prototype.getMediaBox=function(){return this.node.MediaBox().asRectangle()},e.prototype.getCropBox=function(){return this.node.CropBox()?.asRectangle()??this.getMediaBox()},e.prototype.getBleedBox=function(){return this.node.BleedBox()?.asRectangle()??this.getCropBox()},e.prototype.getTrimBox=function(){return this.node.TrimBox()?.asRectangle()??this.getCropBox()},e.prototype.getArtBox=function(){return this.node.ArtBox()?.asRectangle()??this.getCropBox()},e.prototype.translateContent=function(e,t){q(e,`x`,[`number`]),q(t,`y`,[`number`]),this.node.normalize(),this.getContentStream();var n=this.createContentStream(WS(),PS(e,t)),r=this.doc.context.register(n),i=this.createContentStream(GS()),a=this.doc.context.register(i);this.node.wrapContentStreams(r,a)},e.prototype.scale=function(e,t){q(e,`x`,[`number`]),q(t,`y`,[`number`]),this.setSize(this.getWidth()*e,this.getHeight()*t),this.scaleContent(e,t),this.scaleAnnotations(e,t)},e.prototype.scaleContent=function(e,t){q(e,`x`,[`number`]),q(t,`y`,[`number`]),this.node.normalize(),this.getContentStream();var n=this.createContentStream(WS(),FS(e,t)),r=this.doc.context.register(n),i=this.createContentStream(GS()),a=this.doc.context.register(i);this.node.wrapContentStreams(r,a)},e.prototype.scaleAnnotations=function(e,t){q(e,`x`,[`number`]),q(t,`y`,[`number`]);var n=this.node.Annots();if(n)for(var r=0;r<n.size();r++){var i=n.lookup(r);i instanceof Q&&this.scaleAnnot(i,e,t)}},e.prototype.resetPosition=function(){this.getContentStream(!1),this.x=0,this.y=0},e.prototype.setFont=function(e){q(e,`font`,[[$w,`PDFFont`]]),this.font=e,this.fontKey=this.node.newFontDictionary(this.font.name,this.font.ref)},e.prototype.setFontSize=function(e){q(e,`fontSize`,[`number`]),this.fontSize=e},e.prototype.setFontColor=function(e){q(e,`fontColor`,[[Object,`Color`]]),this.fontColor=e},e.prototype.setLineHeight=function(e){q(e,`lineHeight`,[`number`]),this.lineHeight=e},e.prototype.getPosition=function(){return{x:this.x,y:this.y}},e.prototype.getX=function(){return this.x},e.prototype.getY=function(){return this.y},e.prototype.moveTo=function(e,t){q(e,`x`,[`number`]),q(t,`y`,[`number`]),this.x=e,this.y=t},e.prototype.moveDown=function(e){q(e,`yDecrease`,[`number`]),this.y-=e},e.prototype.moveUp=function(e){q(e,`yIncrease`,[`number`]),this.y+=e},e.prototype.moveLeft=function(e){q(e,`xDecrease`,[`number`]),this.x-=e},e.prototype.moveRight=function(e){q(e,`xIncrease`,[`number`]),this.x+=e},e.prototype.pushOperators=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];c_(e,`operator`,[[Nv,`PDFOperator`]]);var n=this.getContentStream();n.push.apply(n,e)},e.prototype.drawText=function(e,t){t===void 0&&(t={}),q(e,`text`,[`string`]),J(t.color,`options.color`,[[Object,`Color`]]),u_(t.opacity,`opacity.opacity`,0,1),J(t.font,`options.font`,[[$w,`PDFFont`]]),J(t.size,`options.size`,[`number`]),J(t.rotate,`options.rotate`,[[Object,`Rotation`]]),J(t.xSkew,`options.xSkew`,[[Object,`Rotation`]]),J(t.ySkew,`options.ySkew`,[[Object,`Rotation`]]),J(t.x,`options.x`,[`number`]),J(t.y,`options.y`,[`number`]),J(t.lineHeight,`options.lineHeight`,[`number`]),J(t.maxWidth,`options.maxWidth`,[`number`]),J(t.wordBreaks,`options.wordBreaks`,[Array]),r_(t.blendMode,`options.blendMode`,VT);for(var n=this.setOrEmbedFont(t.font),r=n.oldFont,i=n.newFont,a=n.newFontKey,o=t.size||this.fontSize,s=t.wordBreaks||this.doc.defaultWordBreaks,c=t.maxWidth===void 0?Vm(Rm(e)):Km(e,s,t.maxWidth,function(e){return i.widthOfTextAtSize(e,o)}),l=Array(c.length),u=0,d=c.length;u<d;u++)l[u]=i.encodeText(c[u]);var f=this.maybeEmbedGraphicsState({opacity:t.opacity,blendMode:t.blendMode}),p=this.getContentStream();p.push.apply(p,JC(l,{color:t.color??this.fontColor,font:a,size:o,rotate:t.rotate??vS(0),xSkew:t.xSkew??vS(0),ySkew:t.ySkew??vS(0),x:t.x??this.x,y:t.y??this.y,lineHeight:t.lineHeight??this.lineHeight,graphicsState:f})),t.font&&(r?this.setFont(r):this.resetFont())},e.prototype.drawImage=function(e,t){t===void 0&&(t={}),q(e,`image`,[[tT,`PDFImage`]]),J(t.x,`options.x`,[`number`]),J(t.y,`options.y`,[`number`]),J(t.width,`options.width`,[`number`]),J(t.height,`options.height`,[`number`]),J(t.rotate,`options.rotate`,[[Object,`Rotation`]]),J(t.xSkew,`options.xSkew`,[[Object,`Rotation`]]),J(t.ySkew,`options.ySkew`,[[Object,`Rotation`]]),u_(t.opacity,`opacity.opacity`,0,1),r_(t.blendMode,`options.blendMode`,VT);var n=this.node.newXObject(`Image`,e.ref),r=this.maybeEmbedGraphicsState({opacity:t.opacity,blendMode:t.blendMode}),i=this.getContentStream();i.push.apply(i,YC(n,{x:t.x??this.x,y:t.y??this.y,width:t.width??e.size().width,height:t.height??e.size().height,rotate:t.rotate??vS(0),xSkew:t.xSkew??vS(0),ySkew:t.ySkew??vS(0),graphicsState:r}))},e.prototype.drawPage=function(e,t){t===void 0&&(t={}),q(e,`embeddedPage`,[[Zw,`PDFEmbeddedPage`]]),J(t.x,`options.x`,[`number`]),J(t.y,`options.y`,[`number`]),J(t.xScale,`options.xScale`,[`number`]),J(t.yScale,`options.yScale`,[`number`]),J(t.width,`options.width`,[`number`]),J(t.height,`options.height`,[`number`]),J(t.rotate,`options.rotate`,[[Object,`Rotation`]]),J(t.xSkew,`options.xSkew`,[[Object,`Rotation`]]),J(t.ySkew,`options.ySkew`,[[Object,`Rotation`]]),u_(t.opacity,`opacity.opacity`,0,1),r_(t.blendMode,`options.blendMode`,VT);var n=this.node.newXObject(`EmbeddedPdfPage`,e.ref),r=this.maybeEmbedGraphicsState({opacity:t.opacity,blendMode:t.blendMode}),i=t.width===void 0?t.xScale===void 0?1:t.xScale:t.width/e.width,a=t.height===void 0?t.yScale===void 0?1:t.yScale:t.height/e.height,o=this.getContentStream();o.push.apply(o,XC(n,{x:t.x??this.x,y:t.y??this.y,xScale:i,yScale:a,rotate:t.rotate??vS(0),xSkew:t.xSkew??vS(0),ySkew:t.ySkew??vS(0),graphicsState:r}))},e.prototype.drawSvgPath=function(e,t){t===void 0&&(t={}),q(e,`path`,[`string`]),J(t.x,`options.x`,[`number`]),J(t.y,`options.y`,[`number`]),J(t.scale,`options.scale`,[`number`]),J(t.rotate,`options.rotate`,[[Object,`Rotation`]]),J(t.borderWidth,`options.borderWidth`,[`number`]),J(t.color,`options.color`,[[Object,`Color`]]),u_(t.opacity,`opacity.opacity`,0,1),J(t.borderColor,`options.borderColor`,[[Object,`Color`]]),J(t.borderDashArray,`options.borderDashArray`,[Array]),J(t.borderDashPhase,`options.borderDashPhase`,[`number`]),r_(t.borderLineCap,`options.borderLineCap`,BS),u_(t.borderOpacity,`options.borderOpacity`,0,1),r_(t.blendMode,`options.blendMode`,VT);var n=this.maybeEmbedGraphicsState({opacity:t.opacity,borderOpacity:t.borderOpacity,blendMode:t.blendMode});!(`color`in t)&&!(`borderColor`in t)&&(t.borderColor=CC(0,0,0));var r=this.getContentStream();r.push.apply(r,rw(e,{x:t.x??this.x,y:t.y??this.y,scale:t.scale,rotate:t.rotate??vS(0),color:t.color??void 0,borderColor:t.borderColor??void 0,borderWidth:t.borderWidth??0,borderDashArray:t.borderDashArray??void 0,borderDashPhase:t.borderDashPhase??void 0,borderLineCap:t.borderLineCap??void 0,graphicsState:n}))},e.prototype.drawLine=function(e){q(e.start,`options.start`,[[Object,`{ x: number, y: number }`]]),q(e.end,`options.end`,[[Object,`{ x: number, y: number }`]]),q(e.start.x,`options.start.x`,[`number`]),q(e.start.y,`options.start.y`,[`number`]),q(e.end.x,`options.end.x`,[`number`]),q(e.end.y,`options.end.y`,[`number`]),J(e.thickness,`options.thickness`,[`number`]),J(e.color,`options.color`,[[Object,`Color`]]),J(e.dashArray,`options.dashArray`,[Array]),J(e.dashPhase,`options.dashPhase`,[`number`]),r_(e.lineCap,`options.lineCap`,BS),u_(e.opacity,`opacity.opacity`,0,1),r_(e.blendMode,`options.blendMode`,VT);var t=this.maybeEmbedGraphicsState({borderOpacity:e.opacity,blendMode:e.blendMode});`color`in e||(e.color=CC(0,0,0));var n=this.getContentStream();n.push.apply(n,ZC({start:e.start,end:e.end,thickness:e.thickness??1,color:e.color??void 0,dashArray:e.dashArray??void 0,dashPhase:e.dashPhase??void 0,lineCap:e.lineCap??void 0,graphicsState:t}))},e.prototype.drawRectangle=function(e){e===void 0&&(e={}),J(e.x,`options.x`,[`number`]),J(e.y,`options.y`,[`number`]),J(e.width,`options.width`,[`number`]),J(e.height,`options.height`,[`number`]),J(e.rotate,`options.rotate`,[[Object,`Rotation`]]),J(e.xSkew,`options.xSkew`,[[Object,`Rotation`]]),J(e.ySkew,`options.ySkew`,[[Object,`Rotation`]]),J(e.borderWidth,`options.borderWidth`,[`number`]),J(e.color,`options.color`,[[Object,`Color`]]),u_(e.opacity,`opacity.opacity`,0,1),J(e.borderColor,`options.borderColor`,[[Object,`Color`]]),J(e.borderDashArray,`options.borderDashArray`,[Array]),J(e.borderDashPhase,`options.borderDashPhase`,[`number`]),r_(e.borderLineCap,`options.borderLineCap`,BS),u_(e.borderOpacity,`options.borderOpacity`,0,1),r_(e.blendMode,`options.blendMode`,VT);var t=this.maybeEmbedGraphicsState({opacity:e.opacity,borderOpacity:e.borderOpacity,blendMode:e.blendMode});!(`color`in e)&&!(`borderColor`in e)&&(e.color=CC(0,0,0));var n=this.getContentStream();n.push.apply(n,QC({x:e.x??this.x,y:e.y??this.y,width:e.width??150,height:e.height??100,rotate:e.rotate??vS(0),xSkew:e.xSkew??vS(0),ySkew:e.ySkew??vS(0),borderWidth:e.borderWidth??0,color:e.color??void 0,borderColor:e.borderColor??void 0,borderDashArray:e.borderDashArray??void 0,borderDashPhase:e.borderDashPhase??void 0,graphicsState:t,borderLineCap:e.borderLineCap??void 0}))},e.prototype.drawSquare=function(e){e===void 0&&(e={});var t=e.size;J(t,`size`,[`number`]),this.drawRectangle(bm(bm({},e),{width:t,height:t}))},e.prototype.drawEllipse=function(e){e===void 0&&(e={}),J(e.x,`options.x`,[`number`]),J(e.y,`options.y`,[`number`]),J(e.xScale,`options.xScale`,[`number`]),J(e.yScale,`options.yScale`,[`number`]),J(e.rotate,`options.rotate`,[[Object,`Rotation`]]),J(e.color,`options.color`,[[Object,`Color`]]),u_(e.opacity,`opacity.opacity`,0,1),J(e.borderColor,`options.borderColor`,[[Object,`Color`]]),u_(e.borderOpacity,`options.borderOpacity`,0,1),J(e.borderWidth,`options.borderWidth`,[`number`]),J(e.borderDashArray,`options.borderDashArray`,[Array]),J(e.borderDashPhase,`options.borderDashPhase`,[`number`]),r_(e.borderLineCap,`options.borderLineCap`,BS),r_(e.blendMode,`options.blendMode`,VT);var t=this.maybeEmbedGraphicsState({opacity:e.opacity,borderOpacity:e.borderOpacity,blendMode:e.blendMode});!(`color`in e)&&!(`borderColor`in e)&&(e.color=CC(0,0,0));var n=this.getContentStream();n.push.apply(n,nw({x:e.x??this.x,y:e.y??this.y,xScale:e.xScale??100,yScale:e.yScale??100,rotate:e.rotate??void 0,color:e.color??void 0,borderColor:e.borderColor??void 0,borderWidth:e.borderWidth??0,borderDashArray:e.borderDashArray??void 0,borderDashPhase:e.borderDashPhase??void 0,borderLineCap:e.borderLineCap??void 0,graphicsState:t}))},e.prototype.drawCircle=function(e){e===void 0&&(e={});var t=e.size,n=t===void 0?100:t;J(n,`size`,[`number`]),this.drawEllipse(bm(bm({},e),{xScale:n,yScale:n}))},e.prototype.setOrEmbedFont=function(e){var t=this.font,n=this.fontKey;return e?this.setFont(e):this.getFont(),{oldFont:t,oldFontKey:n,newFont:this.font,newFontKey:this.fontKey}},e.prototype.getFont=function(){if(!this.font||!this.fontKey){var e=this.doc.embedStandardFont(xT.Helvetica);this.setFont(e)}return[this.font,this.fontKey]},e.prototype.resetFont=function(){this.font=void 0,this.fontKey=void 0},e.prototype.getContentStream=function(e){return e===void 0&&(e=!0),e&&this.contentStream||(this.contentStream=this.createContentStream(),this.contentStreamRef=this.doc.context.register(this.contentStream),this.node.addContentStream(this.contentStreamRef)),this.contentStream},e.prototype.createContentStream=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=this.doc.context.obj({});return Vv.of(n,e)},e.prototype.maybeEmbedGraphicsState=function(e){var t=e.opacity,n=e.borderOpacity,r=e.blendMode;if(t!==void 0||n!==void 0||r!==void 0){var i=this.doc.context.obj({Type:`ExtGState`,ca:t,CA:n,BM:r});return this.node.newExtGState(`GS`,i)}},e.prototype.scaleAnnot=function(e,t,n){for(var r=[`RD`,`CL`,`Vertices`,`QuadPoints`,`L`,`Rect`],i=0,a=r.length;i<a;i++){var o=e.lookup(Z.of(r[i]));o instanceof X&&o.scalePDFNumbers(t,n)}var s=e.lookup(Z.of(`InkList`));if(s instanceof X)for(var i=0,a=s.size();i<a;i++){var c=s.lookup(i);c instanceof X&&c.scalePDFNumbers(t,n)}},e.of=function(t,n,r){return new e(t,n,r)},e.create=function(t){q(t,`doc`,[[zT,`PDFDocument`]]);var n=jv.of(-1),r=Yv.withContextAndParent(t.context,n);return new e(r,t.context.register(r),t)},e}()})),GT,KT=s((()=>{K(),WT(),eT(),iT(),Xw(),cT(),MC(),OS(),fS(),x_(),GT=function(e){G(t,e);function t(t,n,r){var i=e.call(this,t,n,r)||this;return q(t,`acroButton`,[[fx,`PDFAcroPushButton`]]),i.acroField=t,i}return t.prototype.setImage=function(e,t){t===void 0&&(t=rT.Center);for(var n=this.acroField.getWidgets(),r=0,i=n.length;r<i;r++){var a=n[r],o=this.createImageAppearanceStream(a,e,t);this.updateWidgetAppearances(a,{normal:o})}this.markAsClean()},t.prototype.setFontSize=function(e){p_(e,`fontSize`),this.acroField.setFontSize(e),this.markAsDirty()},t.prototype.addToPage=function(e,t,n){J(e,`text`,[`string`]),J(t,`page`,[[UT,`PDFPage`]]),oT(n);var r=this.createWidget({x:(n?.x??0)-(n?.borderWidth??0)/2,y:(n?.y??0)-(n?.borderWidth??0)/2,width:n?.width??100,height:n?.height??50,textColor:n?.textColor??CC(0,0,0),backgroundColor:n?.backgroundColor??CC(.75,.75,.75),borderColor:n?.borderColor,borderWidth:n?.borderWidth??0,rotate:n?.rotate??vS(0),caption:e,hidden:n?.hidden,page:t.ref}),i=this.doc.context.register(r.dict);this.acroField.addWidget(i);var a=n?.font??this.doc.getForm().getDefaultFont();this.updateWidgetAppearance(r,a),t.node.addAnnot(i)},t.prototype.needsAppearancesUpdate=function(){if(this.isDirty())return!0;for(var e=this.acroField.getWidgets(),t=0,n=e.length;t<n;t++)if(!(e[t].getAppearances()?.normal instanceof Tv))return!0;return!1},t.prototype.defaultUpdateAppearances=function(e){q(e,`font`,[[$w,`PDFFont`]]),this.updateAppearances(e)},t.prototype.updateAppearances=function(e,t){q(e,`font`,[[$w,`PDFFont`]]),J(t,`provider`,[Function]);for(var n=this.acroField.getWidgets(),r=0,i=n.length;r<i;r++){var a=n[r];this.updateWidgetAppearance(a,e,t)}},t.prototype.updateWidgetAppearance=function(e,t,n){var r=Rw((n??Kw)(this,e,t));this.updateWidgetAppearanceWithFont(e,t,r)},t.of=function(e,n,r){return new t(e,n,r)},t}(sT)})),qT=s((()=>{Xw(),KT(),uT(),fT(),cT(),DT(),mT(),gT(),vT(),bT()})),JT=s((()=>{Dw(),Lw()})),YT=s((()=>{qT(),JT(),MC(),Tw(),aT(),gS(),fw(),bC(),OS(),kT(),HT(),jT(),ST(),BT(),eT(),nT(),WT(),Qw(),FT()})),XT=s((()=>{})),ZT=s((()=>{YT(),fS(),XT(),x_()}));function QT(e){let t=new Date(e),n=Number.isNaN(t.getTime())?new Date:t,r=e=>String(e).padStart(2,`0`);return`D:${n.getUTCFullYear()}${r(n.getUTCMonth()+1)}${r(n.getUTCDate())}${r(n.getUTCHours())}${r(n.getUTCMinutes())}${r(n.getUTCSeconds())}Z`}function $T(e){if(!e)return null;let t=/^(?:D:)?(\d{4})(\d{2})?(\d{2})?(\d{2})?(\d{2})?(\d{2})?(Z|[+-]\d{2}'?\d{0,2}'?)?/.exec(e.trim());if(!t)return null;let[,n,r=`01`,i=`01`,a=`00`,o=`00`,s=`00`,c]=t,l=`Z`;if(c&&c!==`Z`){let e=/([+-])(\d{2})'?(\d{2})?/.exec(c);l=`${e[1]}${e[2]}:${e[3]??`00`}`}let u=new Date(`${n}-${r}-${i}T${a}:${o}:${s}${l}`);return Number.isNaN(u.getTime())?null:u.toISOString()}function eE(e){let t=Number.parseInt(e.slice(1),16);return[(t>>16&255)/255,(t>>8&255)/255,(t&255)/255]}function tE(e){let t;if(e.length===1)t=[e[0],e[0],e[0]];else if(e.length===3)t=e;else if(e.length===4){let[n,r,i,a]=e;t=[(1-n)*(1-a),(1-r)*(1-a),(1-i)*(1-a)]}else return null;return t.some(e=>!Number.isFinite(e))?null:`#${t.map(e=>Math.round(Math.min(1,Math.max(0,e))*255).toString(16).padStart(2,`0`)).join(``)}`}function nE(e){if(!Number.isFinite(e))return`0`;let t=e.toFixed(4).replace(/\.?0+$/,``);return t===`-0`?`0`:t}var rE,iE=s((()=>{rE=class{ops=[];push(...e){return this.ops.push(e.map(e=>typeof e==`number`?nE(e):e).join(` `)),this}strokeColor(e){return this.push(...eE(e),`RG`)}fillColor(e){return this.push(...eE(e),`rg`)}moveTo(e,t){return this.push(e,t,`m`)}lineTo(e,t){return this.push(e,t,`l`)}curveTo(e,t,n,r,i,a){return this.push(e,t,n,r,i,a,`c`)}ellipse(e,t,n,r){let i=.5522847498,a=n/2,o=r/2,s=e+a,c=t+o;return this.moveTo(s+a,c).curveTo(s+a,c+o*i,s+a*i,c+o,s,c+o).curveTo(s-a*i,c+o,s-a,c+o*i,s-a,c).curveTo(s-a,c-o*i,s-a*i,c-o,s,c-o).curveTo(s+a*i,c-o,s+a,c-o*i,s+a,c).push(`h`)}toString(){return this.ops.join(`
|
|
984
|
+
`)}}}));function aE(e){return[e.rect.x,e.rect.y,e.rect.x+e.rect.width,e.rect.y+e.rect.height]}function oE(e,t){let[n,...r]=t;if(n){e.moveTo(n.x,n.y),r.length===0&&e.lineTo(n.x+.01,n.y);for(let t of r)e.lineTo(t.x,t.y)}}function sE(e,t,n){let r=[];for(let i of e.split(/\r?\n/)){let e=``;for(let a of i.split(/(\s+)/).filter(e=>e!==``))if(n(e+a)<=t)e+=a;else if(/\s/.test(a))r.push(e.trimEnd()),e=``;else if(e.trim()!==``&&r.push(e.trimEnd()),e=``,n(a)<=t)e=a;else for(let i of a)e!==``&&n(e+i)>t&&(r.push(e),e=``),e+=i;r.push(e.trimEnd())}return r}function cE(e,t){let n=new rE,r={bbox:aE(e),opacity:e.opacity<1?e.opacity:null,multiply:!1,usesFont:!1};switch(e.type){case`highlight`:n.fillColor(e.color);for(let t of e.quads)n.moveTo(t[0],t[1]).lineTo(t[2],t[3]).lineTo(t[6],t[7]).lineTo(t[4],t[5]).push(`h`);return n.push(`f`),{...r,content:n.toString(),multiply:!0};case`underline`:case`strikeout`:{n.strokeColor(e.color);let t=e.type===`underline`?.08:.45;for(let r of e.quads){let e=Math.hypot(r[0]-r[4],r[1]-r[5]);n.push(Math.max(.6,e*.07),`w`).moveTo(r[4]+(r[0]-r[4])*t,r[5]+(r[1]-r[5])*t).lineTo(r[6]+(r[2]-r[6])*t,r[7]+(r[3]-r[7])*t).push(`S`)}return{...r,content:n.toString()}}case`ink`:n.strokeColor(e.color).push(e.strokeWidth,`w`).push(`1 J 1 j`);for(let t of e.paths)oE(n,t),n.push(`S`);return{...r,content:n.toString()};case`rectangle`:case`ellipse`:{let t=e.strokeWidth,{x:i,y:a,width:o,height:s}=e.rect,c=[i+t/2,a+t/2,Math.max(0,o-t),Math.max(0,s-t)];return n.strokeColor(e.color).push(t,`w`),e.fillColor&&n.fillColor(e.fillColor),e.type===`rectangle`?n.push(...c,`re`):n.ellipse(...c),n.push(e.fillColor?t>0?`B`:`f`:`S`),{...r,content:n.toString()}}case`redaction`:{let{x:t,y:i,width:a,height:o}=e.rect;return n.strokeColor(e.color).push(1.5,`w`).push(t+.75,i+.75,Math.max(0,a-1.5),Math.max(0,o-1.5),`re`).push(`S`),{...r,content:n.toString()}}case`line`:case`arrow`:if(n.strokeColor(e.color).push(e.strokeWidth,`w`).push(`1 J 1 j`),n.moveTo(e.start.x,e.start.y).lineTo(e.end.x,e.end.y).push(`S`),e.type===`arrow`){let[t,r]=L(e.start,e.end,e.strokeWidth);n.moveTo(t.x,t.y).lineTo(e.end.x,e.end.y).lineTo(r.x,r.y).push(`S`)}return{...r,content:n.toString()};case`note`:{let{x:t,y:i,width:a,height:o}=e.rect,s=(e,n)=>[t+e/24*a,i+(24-n)/24*o],c=[s(3,4),s(21,4),s(21,17),s(9,17),s(4,21),s(4,17),s(3,17)];n.fillColor(e.color).push(.45,.45,.45,`RG`).push(a/24*1.2,`w`).push(`1 j`),n.moveTo(...c[0]);for(let e of c.slice(1))n.lineTo(...e);return n.push(`h B`),n.push(a/24*1.4,`w`,`1 J`),n.moveTo(...s(7,9)).lineTo(...s(17,9)).moveTo(...s(7,12.5)).lineTo(...s(14,12.5)).push(`S`),{...r,content:n.toString()}}case`reply`:return{...r,content:``};case`freeText`:{let i=t.font;if(!i)throw Error(`A font is required for free-text appearances.`);let a=t.pageRotation%180!=0,o=a?e.rect.height:e.rect.width,s=a?e.rect.width:e.rect.height;e.backgroundColor&&n.fillColor(e.backgroundColor).push(0,0,o,s,`re f`),e.borderColor&&n.strokeColor(e.borderColor).push(1,`w`).push(.5,.5,Math.max(0,o-1),Math.max(0,s-1),`re S`);let c=e.fontSize,l=sE(e.contents,Math.max(1,o-8),e=>i.widthOfTextAtSize(e,c));n.push(lE,lE,Math.max(0,o-4),Math.max(0,s-4),`re W n`),n.push(`BT`).push(`/${i.name}`,c,`Tf`).fillColor(e.color),n.push(4,s-lE-c*.9,`Td`),l.forEach((e,t)=>{t>0&&n.push(0,-c*uE,`Td`),n.push(`<${i.encode(e)}>`,`Tj`)}),n.push(`ET`);let u=t.pageRotation*Math.PI/180,d=a||t.pageRotation===180?[Math.cos(u),Math.sin(u),-Math.sin(u),Math.cos(u),0,0]:void 0;return{...r,bbox:[0,0,o,s],...d?{matrix:d}:{},content:n.toString(),usesFont:!0}}}}var lE,uE,dE=s((()=>{Me(),iE(),lE=2,uE=1.2}));function fE(e){return e.generationNumber===0?`${e.objectNumber}R`:`${e.objectNumber}R${e.generationNumber}`}function pE(e){let t=/^(\d+)R(\d*)$/.exec(e);return t?jv.of(Number(t[1]),t[2]?Number(t[2]):0):null}function mE(e,t){return t instanceof jv?e.lookup(t):t}function hE(e,t,n){let r=mE(e,t.get(Z.of(n)));return r instanceof nv?r.asNumber():void 0}function gE(e,t,n){let r=mE(e,t.get(Z.of(n)));return r instanceof Z?r.decodeText():void 0}function _E(e,t,n){let r=mE(e,t.get(Z.of(n)));return r instanceof ky||r instanceof gy?r.decodeText():void 0}function vE(e,t,n){let r=mE(e,t.get(Z.of(n)));return r instanceof X?r:void 0}function yE(e,t,n){let r=mE(e,t.get(Z.of(n)));return r instanceof Q?r:void 0}function bE(e,t){if(!t)return[];let n=[];for(let r=0;r<t.size();r++){let i=mE(e,t.get(r));i instanceof nv&&n.push(i.asNumber())}return n}var xE,SE=s((()=>{ZT(),xE=e=>gy.fromText(e)}));function CE(e){let t=mE(e.context,e.catalog.get(Z.of(`AcroForm`)));if(!(t instanceof Q))return;let n=new Set;for(let t of e.getPages()){let r=mE(e.context,t.node.get(Z.of(`Annots`)));if(r instanceof X)for(let e of r.asArray())e instanceof jv&&n.add(e.toString())}let r=t=>{let i=mE(e.context,t);if(!(i instanceof Q))return!1;let a=mE(e.context,i.get(Z.of(`Kids`)));if(a instanceof X){let t=a.asArray().filter(r);return i.set(Z.of(`Kids`),e.context.obj(t)),t.length>0}return t instanceof jv&&n.has(t.toString())},i=mE(e.context,t.get(Z.of(`Fields`)));i instanceof X&&t.set(Z.of(`Fields`),e.context.obj(i.asArray().filter(r)))}async function wE(e,t){let n=e.getForm(),r=[];for(let[i,a]of Object.entries(t.values)){let t=n.getFieldMaybe(i);t&&(TE(e,t,a),r.push(t))}let i=[],a;for(let t of r)if(t.needsAppearancesUpdate()){a??=await e.embedFont(xT.Helvetica);try{t.defaultUpdateAppearances(a)}catch{i.push(t.getName())}}return i.length>0&&n.acroForm.dict.set(Z.of(`NeedAppearances`),e.context.obj(!0)),t.flatten&&n.flatten({updateFieldAppearances:!1}),i}function TE(e,t,n){if(t instanceof yT)t.setText(typeof n==`string`&&n!==``?n:void 0);else if(t instanceof lT)n===!0?t.check():t.uncheck();else if(t instanceof hT)typeof n==`string`&&n!==``?t.select(n):t.clear();else if(t instanceof dT||t instanceof pT){let r=Array.isArray(n)?n:typeof n==`string`&&n!==``?[n]:[],{dict:i}=t.acroField;r.length===0?i.delete(Z.of(`V`)):i.set(Z.of(`V`),r.length===1?gy.fromText(r[0]):e.context.obj(r.map(e=>gy.fromText(e)))),i.delete(Z.of(`I`)),e.getForm().markFieldAsDirty(t.ref)}}var EE=s((()=>{ZT(),SE()}));async function DE(e,t,n=[]){if(t.length===0)throw RangeError(`A document needs at least one page.`);let r=e.getPages(),i=await Promise.all(n.map(e=>zT.load(e,{ignoreEncryption:!0,updateMetadata:!1}))),a=new Map;for(let[n,r]of i.entries()){let i=[...new Set(t.filter(e=>e.doc===n+1).map(e=>e.index))];if(i.length===0)continue;let o=await e.copyPages(r,i);a.set(n+1,new Map(i.map((e,t)=>[e,o[t]])))}let o=t.map(e=>{let t=e.doc===0?r[e.index]:a.get(e.doc)?.get(e.index);if(!t)throw RangeError(`Page plan refers to page ${e.index+1} of document ${e.doc}, which doesn't exist.`);return{page:t,rotation:e.rotation}});for(let t=e.getPageCount()-1;t>=0;t--)e.removePage(t);for(let{page:t,rotation:n}of o)n%360!=0&&t.setRotation(vS(((t.getRotation().angle+n)%360+360)%360)),e.addPage(t)}var OE=s((()=>{ZT()}));function kE(e){let t=e.replace(/^[A-Z]{6}\+/,``);if(NE.includes(t))return t;let[n=``,r=``]=t.split(/[,-]/),i=/bold/i.test(r),a=/italic|oblique/i.test(r),o=e=>e===`Times`?i&&a?`Times-BoldItalic`:i?`Times-Bold`:a?`Times-Italic`:`Times-Roman`:`${e}${i&&a?`-BoldOblique`:i?`-Bold`:a?`-Oblique`:``}`;return/^(Arial|Helvetica)/i.test(n)?o(`Helvetica`):/^(TimesNewRoman|Times)/i.test(n)?o(`Times`):/^(CourierNew|Courier)/i.test(n)?o(`Courier`):null}function AE(){if(!PE){PE=new Map;let{encoding:e}=vy.for(`Helvetica`),t=e.unicodeMappings;for(let[e,n]of Object.values(t))PE.set(e,n)}return PE}function jE(e,t){let n={glyphs:()=>null,ascent:.9,descent:-.25},r=t?e.lookup(t):void 0;if(!(r instanceof Q))return n;let i=r.lookupMaybe(Z.of(`Subtype`),Z)?.asString().slice(1),a=e=>e.lookupMaybe(Z.of(`FontDescriptor`),Q),o=(t,n=1/1e3)=>{let r=FE(e,t?.get(Z.of(`Ascent`))),i=FE(e,t?.get(Z.of(`Descent`)));return{ascent:r&&r>0?r*n:.9,descent:i&&i<0?i*n:-.25}};if(i===`Type0`){let t=r.lookupMaybe(Z.of(`Encoding`),Z)?.asString(),i=r.lookupMaybe(Z.of(`DescendantFonts`),X)?.lookupMaybe(0,Q);if(t!==`/Identity-H`||!i)return n;let s=FE(e,i.get(Z.of(`DW`)))??1e3,c=new Map,l=i.lookupMaybe(Z.of(`W`),X);if(l){let t=l.asArray();for(let n=0;n<t.length;){let r=FE(e,t[n]),i=e.lookup(t[n+1]);if(r===void 0)break;if(i instanceof X)i.asArray().forEach((t,n)=>c.set(r+n,FE(e,t)??s)),n+=2;else{let i=FE(e,t[n+1]),a=FE(e,t[n+2]);if(i===void 0||a===void 0)break;for(let e=r;e<=i&&e-r<65536;e++)c.set(e,a);n+=3}}}return{...o(a(i)),glyphs(e){if(e.length%2)return null;let t=[];for(let n=0;n<e.length;n+=2){let r=e[n]*256+e[n+1];t.push({bytes:e.subarray(n,n+2),width:(c.get(r)??s)/1e3,isSpace:!1})}return t}}}let s=i===`Type3`,c=s?FE(e,r.lookupMaybe(Z.of(`FontMatrix`),X)?.get(0))??.001:1/1e3,l=a(r),u=r.lookupMaybe(Z.of(`Widths`),X),d=FE(e,r.get(Z.of(`FirstChar`)))??0,f=FE(e,l?.get(Z.of(`MissingWidth`)))??0,p=null;if(u){let t=u.asArray().map(t=>FE(e,t)??f);p=e=>(t[e-d]??f)*c}else{let t=r.lookupMaybe(Z.of(`BaseFont`),Z)?.asString().slice(1),n=t?kE(t):null;if(n){let t=vy.for(n),i=new Map(AE()),a=r.lookup(Z.of(`Encoding`)),s=a instanceof Q?a.lookupMaybe(Z.of(`Differences`),X):void 0;if(s){let t=0;for(let n of s.asArray()){let r=FE(e,n);r===void 0?n instanceof Z&&i.set(t++,n.asString().slice(1)):t=r}}let c=e=>{try{return t.font.getWidthOfGlyph(e)}catch{return}},u=n===`Symbol`||n===`ZapfDingbats`;return p=e=>((u?void 0:c(i.get(e)??``))??600)/1e3,{ascent:.9,descent:-.25,...l?o(l):{},glyphs:ME(p)}}}return p?{...o(l,s?c:1/1e3),glyphs:ME(p)}:n}function ME(e){return t=>Array.from(t,(n,r)=>({bytes:t.subarray(r,r+1),width:e(n),isSpace:n===32}))}var NE,PE,FE,IE=s((()=>{ZT(),NE=[`Courier`,`Courier-Bold`,`Courier-Oblique`,`Courier-BoldOblique`,`Helvetica`,`Helvetica-Bold`,`Helvetica-Oblique`,`Helvetica-BoldOblique`,`Times-Roman`,`Times-Bold`,`Times-Italic`,`Times-BoldItalic`,`Symbol`,`ZapfDingbats`],PE=null,FE=(e,t)=>{let n=t?e.lookup(t):void 0;return n instanceof nv?n.asNumber():void 0}}));function LE(e){let t=0,n=[],r=[],i=-1,a=()=>{for(;t<e.length;){let n=e[t];if(BE.has(n))t++;else if(n===37)for(;t<e.length&&e[t]!==10&&e[t]!==13;)t++;else break}},o=()=>{t++;let n=[],r=1;for(;t<e.length;){let i=e[t++];if(i===92){let r=e[t++];if(r===void 0)break;let i={110:10,114:13,116:9,98:8,102:12,40:40,41:41,92:92};if(r in i)n.push(i[r]);else if(r>=48&&r<=55){let i=r-48;for(let n=0;n<2&&e[t]>=48&&e[t]<=55;n++)i=i*8+(e[t++]-48);n.push(i&255)}else r===13?e[t]===10&&t++:r!==10&&n.push(r)}else if(i===40)r++,n.push(i);else if(i===41){if(--r===0)break;n.push(i)}else n.push(i)}return new Uint8Array(n)},s=()=>{t++;let n=[];for(;t<e.length&&e[t]!==62;){let r=e[t++],i=r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:-1;i>=0&&n.push(i)}t++,n.length%2&&n.push(0);let r=new Uint8Array(n.length/2);for(let e=0;e<r.length;e++)r[e]=n[2*e]*16+n[2*e+1];return r},c=()=>{t++;let n=t;for(;t<e.length&&HE(e[t]);)t++;return UE(e,n,t).replace(/#([0-9a-fA-F]{2})/g,(e,t)=>String.fromCharCode(parseInt(t,16)))},l=()=>{a();let n=e[t];if(n===40)return{kind:`string`,bytes:o()};if(n===60&&e[t+1]===60){t+=2;let n=new Map;for(;a(),!(t>=e.length);){if(e[t]===62&&e[t+1]===62){t+=2;break}let r=l(),i=l();typeof r==`object`&&r.kind===`name`&&typeof i==`object`&&n.set(r.value,i)}return{kind:`dict`,entries:n}}if(n===60)return{kind:`string`,bytes:s()};if(n===47)return{kind:`name`,value:c()};if(n===91){t++;let n=[];for(;a(),!(t>=e.length);){if(e[t]===93){t++;break}let r=l();typeof r==`object`&&n.push(r)}return{kind:`array`,items:n}}if(n===41||n===62||n===93||n===123||n===125)return t++,l();let r=t;for(;t<e.length&&HE(e[t]);)t++;let i=UE(e,r,t);return/^[+-]?(\d+\.?\d*|\.\d+)$/.test(i)?{kind:`number`,value:Number(i)}:i===`true`||i===`false`?{kind:`bool`,value:i===`true`}:i===`null`?{kind:`null`}:i};for(;a(),!(t>=e.length);){i<0&&(i=t);let e=l();typeof e==`object`?r.push(e):e===``?t++:(e===`BI`?n.push(u(i)):n.push({operator:e,operands:r,start:i,end:t}),r=[],i=-1)}return n;function u(n){let r=new Map;for(;a(),!(t>=e.length);){let e=l();if(e===`ID`)break;let t=l();typeof e==`object`&&e.kind===`name`&&typeof t==`object`&&r.set(e.value,t)}t++;let i=t;for(;t<e.length&&!(e[t]===69&&e[t+1]===73&&BE.has(e[t-1]??32)&&(t+2>=e.length||BE.has(e[t+2])));)t++;let o=e.slice(i,Math.max(i,t-1));return t=Math.min(e.length,t+2),{operator:`BI`,operands:[],start:n,end:t,inlineImage:{dict:r,data:o}}}}function RE(e){switch(e.kind){case`number`:return GE(e.value);case`name`:return KE(e.value);case`string`:return WE(e.bytes);case`array`:return`[${e.items.map(RE).join(` `)}]`;case`dict`:return`<<${[...e.entries].map(([e,t])=>`${KE(e)} ${RE(t)}`).join(` `)}>>`;case`bool`:return String(e.value);case`null`:return`null`}}function zE(e,t){return[...t.map(RE),e].join(` `)}var BE,VE,HE,UE,WE,GE,KE,qE=s((()=>{BE=new Set([0,9,10,12,13,32]),VE=new Set([40,41,60,62,91,93,123,125,47,37]),HE=e=>!BE.has(e)&&!VE.has(e),UE=(e,t,n)=>String.fromCharCode(...e.subarray(t,n)),WE=e=>`<${Array.from(e,e=>e.toString(16).padStart(2,`0`)).join(``)}>`,GE=e=>String(Number.isInteger(e)?e:Math.round(e*1e4)/1e4),KE=e=>`/${e.replace(/[^!-~]|[()<>[\]{}/%#]/g,e=>`#${e.charCodeAt(0).toString(16).padStart(2,`0`)}`)}`}));function JE(e,t){return[e[0]*t[0]+e[1]*t[2],e[0]*t[1]+e[1]*t[3],e[2]*t[0]+e[3]*t[2],e[2]*t[1]+e[3]*t[3],e[4]*t[0]+e[5]*t[2]+t[4],e[4]*t[1]+e[5]*t[3]+t[5]]}function YE(e,t,n,r,i){let a=[nD(e,t,n),nD(e,r,n),nD(e,t,i),nD(e,r,i)],o=a.map(e=>e.x),s=a.map(e=>e.y),c=Math.min(...o),l=Math.min(...s);return{x:c,y:l,width:Math.max(...o)-c,height:Math.max(...s)-l}}function XE(e,t){let n=e.x+e.width/2,r=e.y+e.height/2,i=Math.max(e.width*e.height,1e-9);return t.some(t=>n>=t.x&&n<=t.x+t.width&&r>=t.y&&r<=t.y+t.height||rD(e,t)/i>=.25)}async function ZE(e,t,n,r){let{context:i,marks:a}=r,o=LE(e),s=[],c=!1,l=!1,u=new Map,d=new Set,f=new Map,p=e=>s.push([e.start,e.end]),m=e=>{s.push(e),c=!0},h={ctm:n,font:null,fontSize:0,charSpacing:0,wordSpacing:0,scale:1,leading:0,rise:0},g=[],_=tD,v=tD,y=[],b=null,x=!1,S=(e,n)=>(t?.lookupMaybe(Z.of(e),Q))?.get(Z.of(n)),C=(e,t)=>{let n=nD(h.ctm,e,t);b=b?(()=>{let e=Math.min(b.x,n.x),t=Math.min(b.y,n.y);return{x:e,y:t,width:Math.max(b.x+b.width,n.x)-e,height:Math.max(b.y+b.height,n.y)-t}})():{x:n.x,y:n.y,width:0,height:0}},w=e=>{let{font:t,fontSize:n,charSpacing:i,wordSpacing:o,scale:s,rise:c}=h,u=[],d=!1,f=0,p=[],m=()=>{p.length&&u.push({kind:`string`,bytes:new Uint8Array(p)}),p=[]};for(let l of e){if(l.kind===`number`){m(),u.push(l),f+=-l.value/1e3*n*s;continue}if(l.kind!==`string`)continue;let e=t?.glyphs(l.bytes)??null;if(e){for(let r of e){let e=(r.width*n+i+(r.isSpace?o:0))*s;XE(YE(JE([n*s,0,0,n,f,c],JE(_,h.ctm)),0,t.descent,r.width,t.ascent),a)?(m(),u.push({kind:`number`,value:n&&s?-(e/s/n)*1e3:0}),d=!0):p.push(...r.bytes),f+=e}m()}else{let e=l.bytes.length*n*s,t=YE(JE([1,0,0,1,f,c],JE(_,h.ctm)),0,-.25*n,e,n);a.some(e=>iD(t,e))?(m(),u.push({kind:`number`,value:n?-(e/s/n)*1e3:0}),d=!0,r.report(`unmeasured-text`)):(m(),u.push(l)),f+=e}}if(_=JE([1,0,0,1,f,0],_),!d)return null;r.report(`text`),l=!0;let g=[];for(let e of u){let t=g.at(-1);e.kind===`number`&&t?.kind===`number`?g[g.length-1]={kind:`number`,value:t.value+e.value}:g.push(e)}return g},T=()=>{v=JE([1,0,0,1,0,-h.leading],v),_=v};for(let e of o){let t=e.operands;switch(e.operator){case`q`:g.push({...h}),p(e);break;case`Q`:h=g.pop()??h,p(e);break;case`cm`:h={...h,ctm:JE(t.map(oD),h.ctm)},p(e);break;case`BT`:_=tD,v=tD,p(e);break;case`Tf`:{let n=t[0]?.kind===`name`?t[0].value:``;f.has(n)||f.set(n,jE(i,S(`Font`,n))),h={...h,font:f.get(n),fontSize:oD(t[1])},p(e);break}case`Tc`:h={...h,charSpacing:oD(t[0])},p(e);break;case`Tw`:h={...h,wordSpacing:oD(t[0])},p(e);break;case`Tz`:h={...h,scale:oD(t[0])/100},p(e);break;case`TL`:h={...h,leading:oD(t[0])},p(e);break;case`Ts`:h={...h,rise:oD(t[0])},p(e);break;case`Td`:v=JE([1,0,0,1,oD(t[0]),oD(t[1])],v),_=v,p(e);break;case`TD`:h={...h,leading:-oD(t[1])},v=JE([1,0,0,1,oD(t[0]),oD(t[1])],v),_=v,p(e);break;case`Tm`:v=t.map(oD),_=v,p(e);break;case`T*`:T(),p(e);break;case`Tj`:case`TJ`:case`'`:case`"`:{let n=``,r;e.operator===`"`?(h={...h,wordSpacing:oD(t[0]),charSpacing:oD(t[1])},n=`${zE(`Tw`,[t[0]])} ${zE(`Tc`,[t[1]])} T* `,T(),r=t[2]?[t[2]]:[]):e.operator===`'`?(n=`T* `,T(),r=t[0]?[t[0]]:[]):r=e.operator===`TJ`?t[0]?.kind===`array`?t[0].items:[]:t[0]?[t[0]]:[];let i=w(r);i?m(n+zE(`TJ`,[{kind:`array`,items:i}])):p(e);break}case`Do`:{let n=t[0]?.kind===`name`?t[0].value:``,o=S(`XObject`,n),s=o?i.lookup(o):void 0;if(!(s instanceof Tv)){d.add(n),p(e);break}let c=s.dict.lookupMaybe(Z.of(`Subtype`),Z)?.asString();if(c===`/Image`){let t=YE(h.ctm,0,0,1,1);if(!a.some(e=>iD(t,e))){d.add(n),p(e);break}let i=await r.redactImage(s,h.ctm);if(r.report(`image`),!i)m(``);else{let e=`PlRd${u.size+1}x${i.objectNumber}`;u.set(e,i),d.add(e),m(zE(`Do`,[{kind:`name`,value:e}]))}}else if(c===`/Form`){let t=await j(s);if(t){let e=`PlRd${u.size+1}x${t.objectNumber}`;u.set(e,t),d.add(e),m(zE(`Do`,[{kind:`name`,value:e}]))}else d.add(n),p(e)}else d.add(n),p(e);break}case`BI`:a.some(e=>iD(YE(h.ctm,0,0,1,1),e))?(r.report(`inline-image`),m(``)):p(e);break;default:if(sD.has(e.operator)){if(y.push(e),e.operator===`re`){let[e,n,r,i]=t.map(oD);C(e,n),C(e+r,n+i),C(e+r,n),C(e,n+i)}else if(e.operator!==`h`)for(let e=0;e+1<t.length;e+=2)C(oD(t[e]),oD(t[e+1]))}else if(e.operator===`W`||e.operator===`W*`)y.push(e),x=!0;else if(cD.has(e.operator)){let t=b;if(t&&e.operator!==`n`&&a.some(e=>aD(e,t)))r.report(`path`),m(x?y.map(e=>A(e)).join(` `)+` n`:``);else{for(let e of y)p(e);p(e)}y=[],b=null,x=!1}else p(e)}}for(let e of y)p(e);if(l)for(let e=0;e<s.length;e++){let t=s[e];if(typeof t==`string`)continue;let n=o.find(e=>e.start===t[0]&&e.end===t[1]);if(!n||n.operator!==`BDC`&&n.operator!==`DP`)continue;let r=n.operands[1];if(r?.kind===`dict`&&lD.some(e=>r.entries.has(e))){let t=new Map([...r.entries].filter(([e])=>!lD.includes(e)));s[e]=zE(n.operator,[n.operands[0],{kind:`dict`,entries:t}]),c=!0}}if(!c)return{bytes:e,changed:!1,xobjects:u,usedXObjects:d};let E=s.map(t=>typeof t==`string`?QE(t):e.subarray(t[0],t[1])),D=E.reduce((e,t)=>e+t.length+1,0),O=new Uint8Array(D),k=0;for(let e of E)O.set(e,k),k+=e.length,O[k++]=10;return{bytes:O,changed:!0,xobjects:u,usedXObjects:d};function A(t){return String.fromCharCode(...e.subarray(t.start,t.end))}async function j(e){let n=e.dict.lookupMaybe(Z.of(`Matrix`),X)?.asArray().map(e=>e.asNumber()),o=JE(n&&n.length===6?n:tD,h.ctm),s=e.dict.lookupMaybe(Z.of(`BBox`),X)?.asArray().map(e=>e.asNumber());if(s&&s.length===4){let e=YE(o,s[0],s[1],s[2],s[3]);if(!a.some(t=>iD(e,t)))return null}let c=e.dict.lookupMaybe(Z.of(`Resources`),Q)??t,l=await ZE($E(e),c,o,r);if(!l.changed)return null;let u=e.dict.clone(i);return u.delete(Z.of(`Filter`)),u.delete(Z.of(`DecodeParms`)),u.delete(Z.of(`Length`)),u.set(Z.of(`Resources`),eD(i,c,l.xobjects,l.usedXObjects)),i.register(i.flateStream(l.bytes,Object.fromEntries([...u.entries()].map(([e,t])=>[e.asString().slice(1),t]))))}}function QE(e){let t=new Uint8Array(e.length);for(let n=0;n<e.length;n++)t[n]=e.charCodeAt(n)&255;return t}function $E(e){return e instanceof Dv?bb(e).decode():e.getUnencodedContents()}function eD(e,t,n,r){let i=t?t.clone(e):e.obj({}),a=i.lookupMaybe(Z.of(`XObject`),Q),o=e.obj({});for(let[e,t]of a?.entries()??[])r.has(e.asString().slice(1))&&o.set(e,t);for(let[e,t]of n)o.set(Z.of(e),t);return i.set(Z.of(`XObject`),o),i}var tD,nD,rD,iD,aD,oD,sD,cD,lD,uD=s((()=>{ZT(),IE(),qE(),tD=[1,0,0,1,0,0],nD=(e,t,n)=>({x:e[0]*t+e[2]*n+e[4],y:e[1]*t+e[3]*n+e[5]}),rD=(e,t)=>Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x))*Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y)),iD=(e,t)=>e.x<t.x+t.width&&t.x<e.x+e.width&&e.y<t.y+t.height&&t.y<e.y+e.height,aD=(e,t)=>t.x>=e.x&&t.y>=e.y&&t.x+t.width<=e.x+e.width&&t.y+t.height<=e.y+e.height,oD=e=>e?.kind===`number`?e.value:0,sD=new Set([`m`,`l`,`c`,`v`,`y`,`h`,`re`]),cD=new Set([`S`,`s`,`f`,`F`,`f*`,`B`,`B*`,`b`,`b*`,`n`]),lD=[`ActualText`,`Alt`,`E`]}));function dD(e,t,n,r){let i=e[0]*e[3]-e[1]*e[2];if(Math.abs(i)<1e-12)return[];let a=[e[3]/i,-e[1]/i,-e[2]/i,e[0]/i,(e[2]*e[5]-e[3]*e[4])/i,(e[1]*e[4]-e[0]*e[5])/i],o=[];for(let e of r){let r=[nD(a,e.x,e.y),nD(a,e.x+e.width,e.y),nD(a,e.x,e.y+e.height),nD(a,e.x+e.width,e.y+e.height)],i=r.map(e=>e.x),s=r.map(e=>e.y),c=Math.max(0,Math.floor(Math.min(...i)*t)-1),l=Math.min(t,Math.ceil(Math.max(...i)*t)+1),u=Math.max(0,Math.floor((1-Math.max(...s))*n)-1),d=Math.min(n,Math.ceil((1-Math.min(...s))*n)+1);c<l&&u<d&&o.push([c,u,l,d])}return o}function fD(e,t,n,r){let i=_D(n,t?.get(Z.of(`Predictor`)))??1;if(i<2)return e;if(i<10)return null;let a=_D(n,t?.get(Z.of(`Colors`)))??r.colors,o=_D(n,t?.get(Z.of(`BitsPerComponent`)))??r.bpc,s=_D(n,t?.get(Z.of(`Columns`)))??r.columns,c=Math.max(1,Math.ceil(a*o/8)),l=Math.ceil(a*o*s/8),u=Math.floor(e.length/(l+1)),d=new Uint8Array(u*l),f=new Uint8Array(l);for(let t=0;t<u;t++){let n=e[t*(l+1)],r=e.subarray(t*(l+1)+1,(t+1)*(l+1)),i=d.subarray(t*l,(t+1)*l);for(let e=0;e<l;e++){let t=e>=c?i[e-c]:0,a=f[e],o=e>=c?f[e-c]:0,s=r[e];if(n===1)s+=t;else if(n===2)s+=a;else if(n===3)s+=t+a>>1;else if(n===4){let e=t+a-o,n=Math.abs(e-t),r=Math.abs(e-a),i=Math.abs(e-o);s+=n<=r&&n<=i?t:r<=i?a:o}else if(n!==0)return null;i[e]=s&255}f=i}return d}function pD(e,t,n){let r=2**n-1,i=t.get(Z.of(`ColorSpace`));i=i?e.lookup(i):void 0;let a=t=>t instanceof Z?t.asString().slice(1):t instanceof X?e.lookup(t.get(0))?.asString().slice(1):void 0,o=a(i),s=0,c=[];if(o===`ICCBased`&&i instanceof X){let t=e.lookup(i.get(1)),n=t instanceof Tv?_D(e,t.dict.get(Z.of(`N`))):void 0;o=n===1?`DeviceGray`:n===3?`DeviceRGB`:n===4?`DeviceCMYK`:void 0}if(o===`DeviceGray`||o===`CalGray`||o===`G`)[s,c]=[1,[0]];else if(o===`DeviceRGB`||o===`CalRGB`||o===`RGB`)[s,c]=[3,[0,0,0]];else if(o===`DeviceCMYK`||o===`CMYK`)[s,c]=[4,[0,0,0,1]];else if((o===`Separation`||o===`DeviceN`)&&i instanceof X){let t=e.lookup(i.get(1));s=o===`Separation`?1:t instanceof X?t.size():0,c=Array(s).fill(1)}else if(o===`Indexed`&&i instanceof X){let t=a(e.lookup(i.get(1))),n=_D(e,i.get(2))??0,r=e.lookup(i.get(3)),o=r instanceof Tv?r instanceof Dv?bb(r).decode():null:r&&`asBytes`in r?r.asBytes():null,s=t===`DeviceRGB`?3:t===`DeviceGray`?1:t===`DeviceCMYK`?4:0;if(!o||!s)return null;let c=0,l=-1/0;for(let e=0;e<=n;e++){let t=Array.from(o.subarray(e*s,e*s+s)),n=s===4?t[3]+(t[0]+t[1]+t[2])/3:-t.reduce((e,t)=>e+t,0);n>l&&([c,l]=[e,n])}return{components:1,black:[c]}}else return null;let l=t.lookupMaybe(Z.of(`Decode`),X)?.asArray().map(t=>_D(e,t)??0);return{components:s,black:c.map((e,t)=>{let[n,i]=l&&l.length>=2*(t+1)?[l[2*t],l[2*t+1]]:[0,1];return i===n?0:Math.round(Math.min(1,Math.max(0,(e-n)/(i-n)))*r)})}}function mD(e,t,n,r,i,a,o,s){let c=(i*n+o)*r,l=a*t;if(r===8)e[l+(c>>3)]=s;else if(r===16)e[l+(c>>3)]=s>>8,e[l+(c>>3)+1]=s&255;else{let t=l+(c>>3),n=8-r-(c&7),i=(1<<r)-1<<n;e[t]=e[t]&~i|s<<n&i}}async function hD(e,t,n,r,i){let a=t.dict,o=_D(e,a.get(Z.of(`Width`)))??0,s=_D(e,a.get(Z.of(`Height`)))??0;if(!o||!s)return null;let c=dD(n,o,s,r),l=a.get(Z.of(`Filter`))?e.lookup(a.get(Z.of(`Filter`))):void 0,u=(l instanceof X?l.asArray():l?[l]:[]).map(e=>e.asString().slice(1)),d=a.get(Z.of(`DecodeParms`))?e.lookup(a.get(Z.of(`DecodeParms`))):void 0,f=d instanceof X?e.lookup(d.get(d.size()-1)):d,p=a.get(Z.of(`SMask`)),m=p?e.lookup(p):void 0,h=m instanceof Tv?await gD(e,m,n,r):void 0;if(m&&h===null)return null;let g=e=>{let t={};for(let[e,n]of a.entries()){let r=e.asString().slice(1);[`Filter`,`DecodeParms`,`Length`,`SMask`].includes(r)||(t[r]=n)}return h&&(t.SMask=h),{...t,...e}};if(u.length===1&&u[0]===`DCTDecode`){let n=a.get(Z.of(`ColorSpace`))?e.lookup(a.get(Z.of(`ColorSpace`)))?.toString():``;if(!i||/CMYK/.test(n??``))return null;let r=t.contents,l=await i.decodeJpeg(r);if(!l||l.width!==o||l.height!==s)return null;for(let[e,t,n,r]of c)for(let i=t;i<r;i++)for(let t=e;t<n;t++)l.data.set([0,0,0,255],(i*o+t)*4);let u=await i.encodeJpeg(l.data,o,s),d=g({ColorSpace:`DeviceRGB`,BitsPerComponent:8,Filter:`DCTDecode`});return delete d.Decode,e.register(e.stream(u,d))}if(!u.every(e=>[`FlateDecode`,`Fl`,`LZWDecode`,`LZW`,`ASCIIHexDecode`,`AHx`,`ASCII85Decode`,`A85`,`RunLengthDecode`,`RL`].includes(e)))return null;let _=vD(e,a.get(Z.of(`ImageMask`))),v=_?1:_D(e,a.get(Z.of(`BitsPerComponent`)))??8,y;if(_){let t=a.lookupMaybe(Z.of(`Decode`),X)?.asArray().map(t=>_D(e,t)??0);y={components:1,black:[t&&t[0]===1?0:1]}}else y=pD(e,a,v);if(!y||![1,2,4,8,16].includes(v))return null;let b;try{b=t instanceof Dv?bb(t).decode():t.getUnencodedContents()}catch{return null}b=fD(b,f,e,{colors:y.components,bpc:v,columns:o});let x=Math.ceil(o*y.components*v/8);if(!b||b.length<x*s)return null;let S=b.slice(0,x*s);for(let[e,t,n,r]of c)for(let i=t;i<r;i++)for(let t=e;t<n;t++)for(let e=0;e<y.components;e++)mD(S,x,y.components,v,t,i,e,y.black[e]);return e.register(e.flateStream(S,g({})))}async function gD(e,t,n,r){let i=_D(e,t.dict.get(Z.of(`Width`)))??0,a=_D(e,t.dict.get(Z.of(`Height`)))??0,o=_D(e,t.dict.get(Z.of(`BitsPerComponent`)))??8;if(!i||!a||![1,2,4,8,16].includes(o))return null;let s;try{s=t instanceof Dv?bb(t).decode():t.getUnencodedContents()}catch{return null}let c=t.dict.lookupMaybe(Z.of(`DecodeParms`),Q);s=fD(s,c,e,{colors:1,bpc:o,columns:i});let l=Math.ceil(i*o/8);if(!s||s.length<l*a)return null;let u=s.slice(0,l*a);for(let[e,t,s,c]of dD(n,i,a,r))for(let n=t;n<c;n++)for(let t=e;t<s;t++)mD(u,l,1,o,t,n,0,2**o-1);let d={};for(let[e,n]of t.dict.entries()){let t=e.asString().slice(1);[`Filter`,`DecodeParms`,`Length`].includes(t)||(d[t]=n)}return e.register(e.flateStream(u,d))}var _D,vD,yD=s((()=>{ZT(),uD(),_D=(e,t)=>{let n=t?e.lookup(t):void 0;return n instanceof nv?n.asNumber():void 0},vD=(e,t)=>!!t&&e.lookup(t)?.toString()===`true`}));function bD(e,t){let n=t.lookupMaybe(Z.of(`Rect`),X)?.asArray().map(t=>Number(e.context.lookup(t)?.toString()));if(!n||n.length!==4||n.some(e=>!Number.isFinite(e)))return null;let[r,i,a,o]=n;return{x:Math.min(r,a),y:Math.min(i,o),width:Math.abs(a-r),height:Math.abs(o-i)}}async function xD(e,t,n){let r={removed:{text:0,image:0,path:0,"inline-image":0,"unmeasured-text":0,annotation:0},imagesRemovedWhole:[]},{context:i}=e,a=e.getPages();for(let[o,s]of t){let t=a[o];if(!t||s.length===0)continue;let c={context:i,marks:s,report:e=>r.removed[e]++,async redactImage(e,t){let a=await hD(i,e,t,s,n);return a||r.imagesRemovedWhole.push(o+1),a}},l=t.node.get(Z.of(`Contents`)),u=l?i.lookup(l):void 0,d=(u instanceof X?u.asArray().map(e=>i.lookup(e)):[u]).filter(e=>e instanceof Tv).map($E),f=new Uint8Array(d.reduce((e,t)=>e+t.length+1,0)),p=0;for(let e of d)f.set(e,p),p+=e.length,f[p++]=10;let m=t.node.Resources(),h=await ZE(f,m,tD,c),g=s.map(e=>`${e.x} ${e.y} ${e.width} ${e.height} re`).join(`
|
|
985
|
+
`),_=new TextEncoder().encode(`\nQ\nq 0 0 0 rg 0 0 0 RG\n${g}\nf\nQ\n`),v=new TextEncoder().encode(`q
|
|
986
|
+
`),y=new Uint8Array(v.length+h.bytes.length+_.length);y.set(v,0),y.set(h.bytes,v.length),y.set(_,v.length+h.bytes.length),t.node.set(Z.of(`Contents`),i.register(i.flateStream(y))),h.changed&&t.node.set(Z.of(`Resources`),eD(i,m,h.xobjects,h.usedXObjects));let b=t.node.lookupMaybe(Z.of(`Annots`),X);if(b){let n=b.asArray().filter(t=>{let n=i.lookup(t);if(!(n instanceof Q))return!0;let a=bD(e,n),o=!!a&&s.some(e=>iD(a,e));return o&&r.removed.annotation++,!o});t.node.set(Z.of(`Annots`),i.obj(n))}}return CE(e),r}function SD(e){let{context:t}=e,n=new Set,r=[],{Root:i,Info:a,Encrypt:o}=t.trailerInfo;for(let e of[i,a,o])e&&r.push(e);for(;r.length;){let e=r.pop();if(e instanceof jv){let i=e.toString();if(n.has(i))continue;n.add(i);let a=t.lookup(e);a&&r.push(a)}else if(e instanceof Q)for(let[,t]of e.entries())r.push(t);else if(e instanceof X)for(let t of e.asArray())r.push(t);else e instanceof Tv&&r.push(e.dict)}for(let[e]of t.enumerateIndirectObjects())n.has(e.toString())||t.delete(e)}var CD=s((()=>{ZT(),EE(),uD(),yD()}));function wD(e){let t=atob(e.slice(e.indexOf(`,`)+1)),n=new Uint8Array(t.length);for(let e=0;e<t.length;e++)n[e]=t.charCodeAt(e);return n}function TD(e,t){let{x:n,y:r,width:i,height:a}=e;switch((t%360+360)%360){case 90:return[0,a,-i,0,n+i,r];case 180:return[-i,0,0,-a,n+i,r+a];case 270:return[0,-a,i,0,n,r+a];default:return[i,0,0,a,n,r]}}async function ED(e,t){let n=e.getPages(),r=new Map,i=t=>{let n=r.get(t);if(!n){let i=wD(t);n=t.startsWith(`data:image/png`)?e.embedPng(i):e.embedJpg(i),r.set(t,n)}return n};for(let r of t){let t=n[r.page-1];if(!t)continue;t.node.normalize();let a=await i(r.image),o=[WS()];if(r.opacity<1){let n=t.node.newExtGState(`SigGS`,e.context.obj({Type:`ExtGState`,CA:r.opacity,ca:r.opacity}));o.push(US(n))}o.push(NS(...TD(r.rect,t.getRotation().angle)),dC(t.node.newXObject(`Sig`,a.ref)),GS()),t.pushOperators(...o)}}var DD=s((()=>{ZT()}));async function OD(e,t){let n=await e.embedFont(xT.HelveticaBold);for(let r of e.getPages()){let e=r.getCropBox(),i=Math.max(10,Math.min(e.width,e.height)/14),a=n.widthOfTextAtSize(t,i),o=Math.atan2(e.height,e.width),[s,c]=[Math.cos(o),Math.sin(o)],l=Math.hypot(e.width,e.height),[u,d]=[e.x+e.width/2,e.y+e.height/2],f=i*4;for(let e=-l/2,p=0;e<=l/2;e+=f,p++)for(let f=-l/2+p%2*a*.6;f<=l/2;f+=a*1.6)r.drawText(t,{x:u+f*s-e*c,y:d+f*c+e*s,size:i,font:n,color:CC(.86,.15,.15),opacity:.18,rotate:vS(o*180/Math.PI)})}}var kD=s((()=>{ZT()}));async function AD(e,t,n={}){let r=await zT.load(e,{updateMetadata:!1,ignoreEncryption:!0});if(r.isEncrypted)throw new Ee;if(n.pages&&(await DE(r,n.pages,n.extraDocuments),CE(r)),n.form){let e=await wE(r,n.form);e.length>0&&console.warn(`[pdfcedar] these form fields need the reader to draw them (text outside the standard font):`,e)}let i=new Map;for(let e of t)e.type===`redaction`&&e.applied&&i.set(e.page-1,[...i.get(e.page-1)??[],e.rect]);if(i.size>0){let e=await xD(r,i,n.imageCodec);e.imagesRemovedWhole.length>0&&console.warn(`[pdfcedar] images under redactions that could not be decoded were removed whole, on pages:`,[...new Set(e.imagesRemovedWhole)])}let a=t.filter(e=>e.type===`signature`);return await ID(r,t.filter(e=>!(e.type===`redaction`&&e.applied)),n),await ED(r,a),n.watermark&&await OD(r,n.watermark),i.size>0&&SD(r),r.save({updateFieldAppearances:!1})}function jD(e){return(Math.round(e.getRotation().angle/90)*90%360+360)%360}function MD(e,t){let n=mE(e.context,t.node.get(Z.of(`Annots`)));if(n instanceof X)return n;let r=e.context.obj([]);return t.node.set(Z.of(`Annots`),r),r}function ND(e,t){if(t.size===0)return;let n=e=>t.has(`${e.objectNumber} ${e.generationNumber}`);for(let t of e.getPages()){let r=mE(e.context,t.node.get(Z.of(`Annots`)));if(!(r instanceof X))continue;let i=r.asArray().filter(t=>{if(t instanceof jv&&n(t))return!1;let r=mE(e.context,t),i=r instanceof Q?r.get(Z.of(`Parent`)):void 0;return!(i instanceof jv&&n(i)&&PD(r)===`Popup`)});t.node.set(Z.of(`Annots`),e.context.obj(i))}}function PD(e){let t=e.get(Z.of(`Subtype`));return t instanceof Z?t.decodeText():void 0}function FD(e){let t=new Set(e.getCharacterSet()),n=e=>[...e].map(e=>t.has(e.codePointAt(0))?e:`?`).join(``);return{name:`Helv`,widthOfTextAtSize:(t,r)=>e.widthOfTextAtSize(n(t),r),encode:t=>e.encodeText(n(t)).toString().replace(/^<|>$/g,``)}}async function ID(e,t,n={}){let r=new Set;for(let e of n.replacedIds??[]){let t=pE(e);t&&r.add(`${t.objectNumber} ${t.generationNumber}`)}ND(e,r);let i=e.getPages(),a=t.some(e=>e.type===`freeText`)?await e.embedFont(xT.Helvetica):null,o=a?FD(a):void 0,{context:s}=e,c=new Map(t.map(e=>[e.id,s.nextRef()]));for(let n of t){let t=i[n.page-1];if(!t||n.type===`signature`||n.type===`redaction`&&n.applied)continue;let r=jD(t),l=cE(n,{pageRotation:r,...o?{font:o}:{}}),u={};(l.opacity!==null||l.multiply)&&(u.ExtGState={GS:{Type:`ExtGState`,...l.opacity===null?{}:{CA:l.opacity,ca:l.opacity},...l.multiply?{BM:`Multiply`}:{}}}),l.usesFont&&a&&(u.Font={Helv:a.ref});let d=(u.ExtGState?`/GS gs
|
|
987
|
+
`:``)+l.content,f=s.flateStream(d,{Type:`XObject`,Subtype:`Form`,BBox:l.bbox,...l.matrix?{Matrix:l.matrix}:{},Resources:u}),{x:p,y:m,width:h,height:g}=n.rect,_=LD|(n.locked?RD:0);(n.type===`note`||n.type===`reply`)&&(_|=24);let v={Type:`Annot`,Subtype:zD[n.type],Rect:[p,m,p+h,m+g],P:t.ref,NM:xE(n.id),T:xE(n.author),Contents:xE(n.contents),M:xE(QT(n.modifiedAt)),CreationDate:xE(QT(n.createdAt)),F:_,AP:{N:s.register(f)}};switch(n.opacity<1&&(v.CA=n.opacity),n.type!==`freeText`&&(v.C=eE(n.color)),n.type){case`highlight`:case`underline`:case`strikeout`:v.QuadPoints=n.quads.flat();break;case`note`:Object.assign(v,{Name:`Comment`,Open:!1});break;case`reply`:{let e=c.get(n.inReplyTo);Object.assign(v,{Name:`Comment`,Open:!1,RT:`R`}),e&&(v.IRT=e);break}case`ink`:Object.assign(v,{InkList:n.paths.map(e=>e.flatMap(e=>[e.x,e.y])),BS:{W:n.strokeWidth,S:`S`}});break;case`rectangle`:case`ellipse`:v.BS={W:n.strokeWidth,S:`S`},n.fillColor&&(v.IC=eE(n.fillColor));break;case`line`:case`arrow`:Object.assign(v,{L:[n.start.x,n.start.y,n.end.x,n.end.y],LE:[`None`,n.type===`arrow`?`OpenArrow`:`None`],BS:{W:n.strokeWidth,S:`S`}});break;case`freeText`:{let[e,t,i]=eE(n.color);Object.assign(v,{DA:xE(`/Helv ${n.fontSize} Tf ${e.toFixed(3)} ${t.toFixed(3)} ${i.toFixed(3)} rg`),Q:0,BS:{W:+!!n.borderColor,S:`S`},[BD]:xE(JSON.stringify({backgroundColor:n.backgroundColor,borderColor:n.borderColor}))}),n.backgroundColor&&(v.C=eE(n.backgroundColor)),r&&(v.Rotate=r);break}}let y=c.get(n.id);s.assign(y,s.obj(v)),MD(e,t).push(y)}}var LD,RD,zD,BD,VD=s((()=>{Me(),ZT(),dE(),EE(),OE(),CD(),DD(),kD(),SE(),iE(),LD=4,RD=128,zD={highlight:`Highlight`,underline:`Underline`,strikeout:`StrikeOut`,note:`Text`,reply:`Text`,ink:`Ink`,rectangle:`Square`,ellipse:`Circle`,line:`Line`,arrow:`Line`,freeText:`FreeText`,redaction:`Redact`},BD=`PDFCedarStyle`}));async function HD(e){return UD(await zT.load(e,{updateMetadata:!1,ignoreEncryption:!0,parseSpeed:AT.Medium}))}function UD(e,t=new Date().toISOString()){let{context:n}=e,r=[];e.getPages().forEach((e,t)=>{let i=mE(n,e.node.get(Z.of(`Annots`)));if(i instanceof X)for(let e of i.asArray()){if(!(e instanceof jv))continue;let i=n.lookup(e);if(!(i instanceof Q))continue;let a=gE(n,i,`Subtype`),o=hE(n,i,`F`)??0;!a||!g.has(a)||o&GD||r.push({ref:e,dict:i,page:t+1,subtype:a})}});let i=new Map,a=new Set;for(let e of r){let t=_E(n,e.dict,`NM`)?.trim()||`pdf-${e.ref.objectNumber}-${e.ref.generationNumber}`;for(;a.has(t);)t=`${t}-${e.ref.objectNumber}`;a.add(t),i.set(fE(e.ref),t)}let o=[];for(let n of r){let r=WD(e,n,i,t);r&&o.push({annotation:r,pdfId:fE(n.ref)})}let s=new Set(o.map(e=>e.annotation.id)),c=o.filter(({annotation:e})=>e.type!==`reply`||s.has(e.inReplyTo));return{annotations:c.map(e=>e.annotation),ids:c.map(e=>e.pdfId)}}function WD(e,t,n,r){let{context:i}=e,{dict:a}=t,o=bE(i,vE(i,a,`Rect`));if(o.length!==4)return null;let[s,c,l,u]=o,d={x:Math.min(s,l),y:Math.min(c,u),width:Math.abs(l-s),height:Math.abs(u-c)},f=e=>tE(bE(i,vE(i,a,`C`)))??e,p=hE(i,a,`F`)??0,m=$T(_E(i,a,`CreationDate`))??$T(_E(i,a,`M`))??r,g=()=>hE(i,yE(i,a,`BS`)??a,`W`)??bE(i,vE(i,a,`Border`))[2]??1,_={id:n.get(fE(t.ref)),page:t.page,rect:d,opacity:Math.min(1,Math.max(0,hE(i,a,`CA`)??1)),contents:_E(i,a,`Contents`)??``,author:_E(i,a,`T`)??``,authorId:``,createdAt:m,modifiedAt:$T(_E(i,a,`M`))??m,locked:(p&KD)!==0};switch(t.subtype){case`Highlight`:case`Underline`:case`StrikeOut`:{let e=t.subtype===`Highlight`?`highlight`:t.subtype===`Underline`?`underline`:`strikeout`,n=bE(i,vE(i,a,`QuadPoints`)),r=[];for(let e=0;e+8<=n.length;e+=8)r.push(n.slice(e,e+8));return{..._,type:e,color:f(h[e]),quads:r.length?r:[be(d)]}}case`Text`:{let e=a.get(Z.of(`IRT`));if(e instanceof jv){let t=n.get(fE(e));return t?{..._,type:`reply`,inReplyTo:t,color:f(h.reply)}:null}return{..._,type:`note`,color:f(h.note)}}case`Ink`:{let e=vE(i,a,`InkList`),t=[];for(let n of e?.asArray()??[]){let e=bE(i,mE(i,n)),r=[];for(let t=0;t+2<=e.length;t+=2)r.push({x:e[t],y:e[t+1]});r.length&&t.push(r)}return t.length?{..._,type:`ink`,color:f(h.ink),paths:t,strokeWidth:g()}:null}case`Redact`:return{..._,type:`redaction`,color:f(h.redaction),applied:!1};case`Square`:case`Circle`:{let[e=0,n=0,r=0,o=0]=bE(i,vE(i,a,`RD`)),s={x:d.x+e,y:d.y+n,width:Math.max(0,d.width-e-r),height:Math.max(0,d.height-n-o)},c=t.subtype===`Square`?`rectangle`:`ellipse`;return{..._,type:c,rect:s,color:f(h[c]),strokeWidth:g(),fillColor:tE(bE(i,vE(i,a,`IC`)))}}case`Line`:{let e=bE(i,vE(i,a,`L`));if(e.length!==4)return null;let t={x:e[0],y:e[1]},n={x:e[2],y:e[3]},r=(vE(i,a,`LE`)?.asArray()??[]).map(e=>{let t=mE(i,e);return t instanceof Z?t.decodeText():``}),o=qD.has(r[0]??``),s=qD.has(r[1]??``);o&&!s&&([t,n]=[n,t]);let c=o||s?`arrow`:`line`;return{..._,type:c,color:f(h[c]),start:t,end:n,strokeWidth:g()}}case`FreeText`:{let e=_E(i,a,`DA`)??``,t=Number(/([\d.]+)\s+Tf/.exec(e)?.[1]),n=/([\d.]+)\s+([\d.]+)\s+([\d.]+)\s+rg/.exec(e),r=/([\d.]+)\s+g(?:\s|$)/.exec(e),o=n?tE([Number(n[1]),Number(n[2]),Number(n[3])]):r?tE([Number(r[1])]):null,s={};try{s=JSON.parse(_E(i,a,`PDFCedarStyle`)??`{}`)}catch{}let c=_E(i,a,BD)!==void 0,l=g()>0;return{..._,type:`freeText`,color:o??h.freeText,fontSize:Number.isFinite(t)&&t>0?t:14,backgroundColor:c?s.backgroundColor??null:null,borderColor:c?s.borderColor??null:l&&vE(i,a,`BS`)?o??h.freeText:null}}default:return null}}var GD,KD,qD,JD=s((()=>{Me(),ZT(),SE(),iE(),VD(),GD=2,KD=128,qD=new Set([`OpenArrow`,`ClosedArrow`])})),YD=l({EncryptedDocumentError:()=>Ee,STYLE_KEY:()=>BD,applyPagePlan:()=>DE,applyRedactions:()=>xD,buildAppearance:()=>cE,drawSignatures:()=>ED,parsePdfDate:()=>$T,pruneOrphanFields:()=>CE,readAnnotations:()=>HD,readFromDocument:()=>UD,removeUnreachable:()=>SD,saveDocument:()=>AD,signatureMatrix:()=>TD,toPdfDate:()=>QT,wrapText:()=>sE,writeAnnotations:()=>ID,writeForm:()=>wE}),XD=s((()=>{VD(),JD(),OE(),dE(),iE(),Me(),DD(),EE(),CD()})),ZD,QD,$D,eO,tO,nO=s((()=>{ZD=()=>new Map,QD=e=>{let t=ZD();return e.forEach((e,n)=>{t.set(n,e)}),t},$D=(e,t,n)=>{let r=e.get(t);return r===void 0&&e.set(t,r=n()),r},eO=(e,t)=>{let n=[];for(let[r,i]of e)n.push(t(i,r));return n},tO=(e,t)=>{for(let[n,r]of e)if(t(r,n))return!0;return!1}})),rO,iO=s((()=>{rO=()=>new Set})),aO,oO,sO,cO,lO,uO,dO,fO=s((()=>{aO=e=>e[e.length-1],oO=(e,t)=>{for(let n=0;n<t.length;n++)e.push(t[n])},sO=Array.from,cO=(e,t)=>{for(let n=0;n<e.length;n++)if(!t(e[n],n,e))return!1;return!0},lO=(e,t)=>{for(let n=0;n<e.length;n++)if(t(e[n],n,e))return!0;return!1},uO=(e,t)=>{let n=Array(e);for(let r=0;r<e;r++)n[r]=t(r,n);return n},dO=Array.isArray})),pO,mO,hO=s((()=>{nO(),iO(),fO(),pO=class{constructor(){this._observers=ZD()}on(e,t){return $D(this._observers,e,rO).add(t),t}once(e,t){let n=(...r)=>{this.off(e,n),t(...r)};this.on(e,n)}off(e,t){let n=this._observers.get(e);n!==void 0&&(n.delete(t),n.size===0&&this._observers.delete(e))}emit(e,t){return sO((this._observers.get(e)||ZD()).values()).forEach(e=>e(...t))}destroy(){this._observers=ZD()}},mO=class{constructor(){this._observers=ZD()}on(e,t){$D(this._observers,e,rO).add(t)}once(e,t){let n=(...r)=>{this.off(e,n),t(...r)};this.on(e,n)}off(e,t){let n=this._observers.get(e);n!==void 0&&(n.delete(t),n.size===0&&this._observers.delete(e))}emit(e,t){return sO((this._observers.get(e)||ZD()).values()).forEach(e=>e(...t))}destroy(){this._observers=ZD()}}})),gO,_O,vO,yO,bO,xO,SO=s((()=>{gO=Math.floor,_O=Math.abs,vO=(e,t)=>e<t?e:t,yO=(e,t)=>e>t?e:t,Number.isNaN,bO=Math.pow,xO=e=>e===0?1/e<0:e<0})),CO=s((()=>{})),wO,TO,EO,DO=s((()=>{SO(),wO=2**53-1,TO=-(2**53-1),EO=Number.isInteger||(e=>typeof e==`number`&&isFinite(e)&&gO(e)===e),Number.isNaN,Number.parseInt})),OO,kO,AO,jO,MO,NO,PO,FO,IO,LO,RO,zO,BO=s((()=>{fO(),OO=String.fromCharCode,String.fromCodePoint,OO(65535),kO=e=>e.toLowerCase(),AO=/^\s*/g,jO=e=>e.replace(AO,``),MO=/([A-Z])/g,NO=(e,t)=>jO(e.replace(MO,e=>`${t}${kO(e)}`)),PO=e=>{let t=unescape(encodeURIComponent(e)),n=t.length,r=new Uint8Array(n);for(let e=0;e<n;e++)r[e]=t.codePointAt(e);return r},FO=typeof TextEncoder<`u`?new TextEncoder:null,IO=e=>FO.encode(e),LO=FO?IO:PO,RO=typeof TextDecoder>`u`?null:new TextDecoder(`utf-8`,{fatal:!0,ignoreBOM:!0}),RO&&RO.decode(new Uint8Array).length===1&&(RO=null),zO=(e,t)=>uO(t,()=>e).join(``)})),VO,HO,UO,WO,GO,KO,qO,JO,YO,XO,ZO,QO,$O,ek,tk,nk,rk,ik,ak,ok,sk,ck,lk,uk,dk,fk,pk,mk,hk,gk=s((()=>{SO(),DO(),CO(),BO(),fO(),VO=class{constructor(){this.cpos=0,this.cbuf=new Uint8Array(100),this.bufs=[]}},HO=()=>new VO,UO=e=>{let t=e.cpos;for(let n=0;n<e.bufs.length;n++)t+=e.bufs[n].length;return t},WO=e=>{let t=new Uint8Array(UO(e)),n=0;for(let r=0;r<e.bufs.length;r++){let i=e.bufs[r];t.set(i,n),n+=i.length}return t.set(new Uint8Array(e.cbuf.buffer,0,e.cpos),n),t},GO=(e,t)=>{let n=e.cbuf.length;n-e.cpos<t&&(e.bufs.push(new Uint8Array(e.cbuf.buffer,0,e.cpos)),e.cbuf=new Uint8Array(yO(n,t)*2),e.cpos=0)},KO=(e,t)=>{let n=e.cbuf.length;e.cpos===n&&(e.bufs.push(e.cbuf),e.cbuf=new Uint8Array(n*2),e.cpos=0),e.cbuf[e.cpos++]=t},qO=KO,JO=(e,t)=>{for(;t>127;)KO(e,128|127&t),t=gO(t/128);KO(e,127&t)},YO=(e,t)=>{let n=xO(t);for(n&&(t=-t),KO(e,(t>63?128:0)|(n?64:0)|63&t),t=gO(t/64);t>0;)KO(e,(t>127?128:0)|127&t),t=gO(t/128)},XO=new Uint8Array(3e4),ZO=XO.length/3,QO=(e,t)=>{if(t.length<ZO){let n=FO.encodeInto(t,XO).written||0;JO(e,n);for(let t=0;t<n;t++)KO(e,XO[t])}else nk(e,LO(t))},$O=(e,t)=>{let n=unescape(encodeURIComponent(t)),r=n.length;JO(e,r);for(let t=0;t<r;t++)KO(e,n.codePointAt(t))},ek=FO&&FO.encodeInto?QO:$O,tk=(e,t)=>{let n=e.cbuf.length,r=e.cpos,i=vO(n-r,t.length),a=t.length-i;e.cbuf.set(t.subarray(0,i),r),e.cpos+=i,a>0&&(e.bufs.push(e.cbuf),e.cbuf=new Uint8Array(yO(n*2,a)),e.cbuf.set(t.subarray(i)),e.cpos=a)},nk=(e,t)=>{JO(e,t.byteLength),tk(e,t)},rk=(e,t)=>{GO(e,t);let n=new DataView(e.cbuf.buffer,e.cpos,t);return e.cpos+=t,n},ik=(e,t)=>rk(e,4).setFloat32(0,t,!1),ak=(e,t)=>rk(e,8).setFloat64(0,t,!1),ok=(e,t)=>rk(e,8).setBigInt64(0,t,!1),sk=new DataView(new ArrayBuffer(4)),ck=e=>(sk.setFloat32(0,e),sk.getFloat32(0)===e),lk=(e,t)=>{switch(typeof t){case`string`:KO(e,119),ek(e,t);break;case`number`:EO(t)&&_O(t)<=2147483647?(KO(e,125),YO(e,t)):ck(t)?(KO(e,124),ik(e,t)):(KO(e,123),ak(e,t));break;case`bigint`:KO(e,122),ok(e,t);break;case`object`:if(t===null)KO(e,126);else if(dO(t)){KO(e,117),JO(e,t.length);for(let n=0;n<t.length;n++)lk(e,t[n])}else if(t instanceof Uint8Array)KO(e,116),nk(e,t);else{KO(e,118);let n=Object.keys(t);JO(e,n.length);for(let r=0;r<n.length;r++){let i=n[r];ek(e,i),lk(e,t[i])}}break;case`boolean`:KO(e,t?120:121);break;default:KO(e,127)}},uk=class extends VO{constructor(e){super(),this.w=e,this.s=null,this.count=0}write(e){this.s===e?this.count++:(this.count>0&&JO(this,this.count-1),this.count=1,this.w(this,e),this.s=e)}},dk=e=>{e.count>0&&(YO(e.encoder,e.count===1?e.s:-e.s),e.count>1&&JO(e.encoder,e.count-2))},fk=class{constructor(){this.encoder=new VO,this.s=0,this.count=0}write(e){this.s===e?this.count++:(dk(this),this.count=1,this.s=e)}toUint8Array(){return dk(this),WO(this.encoder)}},pk=e=>{if(e.count>0){let t=e.diff*2+(e.count===1?0:1);YO(e.encoder,t),e.count>1&&JO(e.encoder,e.count-2)}},mk=class{constructor(){this.encoder=new VO,this.s=0,this.count=0,this.diff=0}write(e){this.diff===e-this.s?(this.s=e,this.count++):(pk(this),this.count=1,this.diff=e-this.s,this.s=e)}toUint8Array(){return pk(this),WO(this.encoder)}},hk=class{constructor(){this.sarr=[],this.s=``,this.lensE=new fk}write(e){this.s+=e,this.s.length>19&&(this.sarr.push(this.s),this.s=``),this.lensE.write(e.length)}toUint8Array(){let e=new VO;return this.sarr.push(this.s),this.s=``,ek(e,this.sarr.join(``)),tk(e,this.lensE.toUint8Array()),WO(e)}}})),_k,vk,yk,bk=s((()=>{_k=e=>Error(e),vk=()=>{throw _k(`Method unimplemented`)},yk=()=>{throw _k(`Unexpected case`)}})),xk,Sk,Ck,wk,Tk,Ek,Dk,Ok,kk,Ak,jk,Mk,Nk,Pk,Fk,Ik,Lk,Rk,zk,Bk,Vk,Hk,Uk,Wk,Gk,Kk=s((()=>{CO(),SO(),DO(),BO(),bk(),xk=_k(`Unexpected end of array`),Sk=_k(`Integer out of Range`),Ck=(e,t,n)=>{if(t<0||n<0||t+n>e.length)throw xk;return new Uint8Array(e.buffer,e.byteOffset+t,n)},wk=(e,t,n)=>{if(t<0||n<0||t+n>e.length)throw xk;return new DataView(e.buffer,e.byteOffset+t,n)},Tk=class{constructor(e){this.arr=e,this.pos=0}},Ek=e=>new Tk(e),Dk=e=>e.pos!==e.arr.length,Ok=(e,t)=>{let n=Ck(e.arr,e.pos,t);return e.pos+=t,n},kk=e=>Ok(e,jk(e)),Ak=e=>e.arr[e.pos++],jk=e=>{let t=0,n=1,r=e.arr.length;for(;e.pos<r;){let r=e.arr[e.pos++];if(t+=(r&127)*n,n*=128,r<128)return t;if(t>wO)throw Sk}throw xk},Mk=e=>{let t=e.arr[e.pos++],n=t&63,r=64,i=(t&64)>0?-1:1;if(!(t&128))return i*n;let a=e.arr.length;for(;e.pos<a;){if(t=e.arr[e.pos++],n+=(t&127)*r,r*=128,t<128)return i*n;if(n>wO)throw Sk}throw xk},Nk=e=>{let t=jk(e);if(t===0)return``;{let n=String.fromCodePoint(Ak(e));if(--t<100)for(;t--;)n+=String.fromCodePoint(Ak(e));else for(;t>0;){let r=t<1e4?t:1e4,i=e.arr.subarray(e.pos,e.pos+r);e.pos+=r,n+=String.fromCodePoint.apply(null,i),t-=r}return decodeURIComponent(escape(n))}},Pk=e=>RO.decode(kk(e)),Fk=RO?Pk:Nk,Ik=(e,t)=>{let n=wk(e.arr,e.pos,t);return e.pos+=t,n},Lk=e=>Ik(e,4).getFloat32(0,!1),Rk=e=>Ik(e,8).getFloat64(0,!1),zk=e=>Ik(e,8).getBigInt64(0,!1),Bk=[e=>void 0,e=>null,Mk,Lk,Rk,zk,e=>!1,e=>!0,Fk,e=>{let t=jk(e),n={};for(let r=0;r<t;r++){let t=Fk(e);n[t]=Vk(e)}return n},e=>{let t=jk(e),n=[];for(let r=0;r<t;r++)n.push(Vk(e));return n},kk],Vk=e=>Bk[127-Ak(e)](e),Hk=class extends Tk{constructor(e,t){super(e),this.reader=t,this.s=null,this.count=0}read(){return this.count===0&&(this.s=this.reader(this),this.count=Dk(this)?jk(this)+1:-1),this.count--,this.s}},Uk=class extends Tk{constructor(e){super(e),this.s=0,this.count=0}read(){if(this.count===0){this.s=Mk(this);let e=xO(this.s);this.count=1,e&&(this.s=-this.s,this.count=jk(this)+2)}return this.count--,this.s}},Wk=class extends Tk{constructor(e){super(e),this.s=0,this.count=0,this.diff=0}read(){if(this.count===0){let e=Mk(this),t=e&1;this.diff=gO(e/2),this.count=1,t&&(this.count=jk(this)+2)}return this.s+=this.diff,this.count--,this.s}},Gk=class{constructor(e){this.decoder=new Uk(e),this.str=Fk(this.decoder),this.spos=0}read(){let e=this.spos+this.decoder.read(),t=this.str.slice(this.spos,e);return this.spos=e,t}}})),qk,Jk=s((()=>{crypto.subtle,qk=crypto.getRandomValues.bind(crypto)})),Yk,Xk,Zk,Qk=s((()=>{Jk(),Yk=()=>qk(new Uint32Array(1))[0],Xk=`10000000-1000-4000-8000-100000000000`,Zk=()=>Xk.replace(/[018]/g,e=>(e^Yk()&15>>e/4).toString(16))})),$k,eA=s((()=>{$k=Date.now})),tA,nA=s((()=>{tA=e=>new Promise(e),Promise.all.bind(Promise)})),rA,iA=s((()=>{rA=e=>e===void 0?null:e})),aA,oA,sA,cA,lA,uA,dA=s((()=>{aA=class{constructor(){this.map=new Map}setItem(e,t){this.map.set(e,t)}getItem(e){return this.map.get(e)}},oA=new aA,sA=!0;try{typeof localStorage<`u`&&localStorage&&(oA=localStorage,sA=!1)}catch{}cA=oA,lA=e=>sA||addEventListener(`storage`,e),uA=e=>sA||removeEventListener(`storage`,e)})),fA,pA,mA=s((()=>{fA=Symbol(`Equality`),pA=(e,t)=>e===t||!!e?.[fA]?.(t)||!1})),hA,gA,_A,vA,yA,bA,xA,SA,CA,wA,TA,EA,DA=s((()=>{mA(),hA=e=>typeof e==`object`,gA=Object.assign,_A=Object.keys,vA=(e,t)=>{for(let n in e)t(e[n],n)},yA=(e,t)=>{let n=[];for(let r in e)n.push(t(e[r],r));return n},bA=e=>_A(e).length,xA=e=>{for(let t in e)return!1;return!0},SA=(e,t)=>{for(let n in e)if(!t(e[n],n))return!1;return!0},CA=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),wA=(e,t)=>e===t||bA(e)===bA(t)&&SA(e,(e,n)=>(e!==void 0||CA(t,n))&&pA(t[n],e)),TA=Object.freeze,EA=e=>{for(let t in e){let n=e[t];(typeof n==`object`||typeof n==`function`)&&EA(e[t])}return TA(e)}})),OA,kA,AA,jA,MA=s((()=>{DA(),mA(),OA=(e,t,n=0)=>{try{for(;n<e.length;n++)e[n](...t)}finally{n<e.length&&OA(e,t,n+1)}},kA=e=>e,AA=(e,t)=>{if(e===t)return!0;if(e==null||t==null||e.constructor!==t.constructor&&(e.constructor||Object)!==(t.constructor||Object))return!1;if(e[fA]!=null)return e[fA](t);switch(e.constructor){case ArrayBuffer:e=new Uint8Array(e),t=new Uint8Array(t);case Uint8Array:if(e.byteLength!==t.byteLength)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;break;case Set:if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;break;case Map:if(e.size!==t.size)return!1;for(let n of e.keys())if(!t.has(n)||!AA(e.get(n),t.get(n)))return!1;break;case void 0:case Object:if(bA(e)!==bA(t))return!1;for(let n in e)if(!CA(e,n)||!AA(e[n],t[n]))return!1;break;case Array:if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!AA(e[n],t[n]))return!1;break;default:return!1}return!0},jA=(e,t)=>t.includes(e)})),NA,PA,FA,IA,LA,RA,zA,BA,VA,HA,UA,WA=s((()=>{nO(),BO(),iA(),dA(),MA(),NA=typeof process<`u`&&process.release&&/node|io\.js/.test(process.release.name)&&Object.prototype.toString.call(typeof process<`u`?process:0)===`[object process]`,PA=typeof window<`u`&&typeof document<`u`&&!NA,typeof navigator<`u`&&/Mac/.test(navigator.platform),IA=[],LA=()=>{if(FA===void 0){if(NA){FA=ZD();let e=process.argv,t=null;for(let n=0;n<e.length;n++){let r=e[n];r[0]===`-`?(t!==null&&FA.set(t,``),t=r):t===null?IA.push(r):(FA.set(t,r),t=null)}t!==null&&FA.set(t,``)}else typeof location==`object`?(FA=ZD(),(location.search||`?`).slice(1).split(`&`).forEach(e=>{if(e.length!==0){let[t,n]=e.split(`=`);FA.set(`--${NO(t,`-`)}`,n),FA.set(`-${NO(t,`-`)}`,n)}})):FA=ZD()}return FA},RA=e=>LA().has(e),zA=e=>rA(NA?process.env[e.toUpperCase().replaceAll(`-`,`_`)]:cA.getItem(e)),BA=e=>RA(`--`+e)||zA(e)!==null,VA=BA(`production`),HA=NA&&jA(process.env.FORCE_COLOR,[`true`,`1`,`2`]),UA=HA||!RA(`--no-colors`)&&!BA(`no-color`)&&(!NA||process.stdout.isTTY)&&(!NA||RA(`--color`)||zA(`COLORTERM`)!==null||(zA(`TERM`)||``).includes(`color`))})),GA,KA,qA,JA,YA,XA,ZA,QA,$A,ej=s((()=>{BO(),WA(),GA=e=>new Uint8Array(e),KA=e=>new Uint8Array(e),qA=e=>{let t=``;for(let n=0;n<e.byteLength;n++)t+=OO(e[n]);return btoa(t)},JA=e=>Buffer.from(e.buffer,e.byteOffset,e.byteLength).toString(`base64`),YA=e=>{let t=atob(e),n=GA(t.length);for(let e=0;e<t.length;e++)n[e]=t.charCodeAt(e);return n},XA=e=>new Uint8Array(Buffer.from(e,`base64`)),ZA=PA?qA:JA,QA=PA?YA:XA,$A=e=>{let t=GA(e.byteLength);return t.set(e),t}})),tj,nj,rj=s((()=>{tj=class{constructor(e,t){this.left=e,this.right=t}},nj=(e,t)=>new tj(e,t)})),ij,aj,oj,sj,cj,lj,uj,dj=s((()=>{BO(),SO(),ij=e=>e.next()>=.5,aj=(e,t,n)=>gO(e.next()*(n+1-t)+t),oj=(e,t,n)=>gO(e.next()*(n+1-t)+t),sj=(e,t,n)=>oj(e,t,n),cj=e=>OO(sj(e,97,122)),lj=(e,t=0,n=20)=>{let r=sj(e,t,n),i=``;for(let t=0;t<r;t++)i+=cj(e);return i},uj=(e,t)=>t[sj(e,0,t.length-1)]})),fj,pj,mj,hj,gj,_j,vj,yj,bj,xj,Sj,Cj,wj,Tj,Ej,Dj,Oj,kj,Aj,jj,Mj,Nj,Pj,Fj,Ij,Lj,Rj,zj,Bj,Vj,Hj,Uj,Wj,Gj,Kj,qj,Jj,Yj,Xj,Zj,Qj,$j,eM,tM,nM,rM,iM,aM,oM,sM,cM,lM,uM,dM,fM,pM,mM,hM,gM,_M,vM,yM,bM,xM=s((()=>{DA(),fO(),bk(),WA(),mA(),MA(),BO(),dj(),DO(),fj=Symbol(`0schema`),pj=class{constructor(){this._rerrs=[]}extend(e,t,n,r=null){this._rerrs.push({path:e,expected:t,has:n,message:r})}toString(){let e=[];for(let t=this._rerrs.length-1;t>0;t--){let n=this._rerrs[t];e.push(zO(` `,(this._rerrs.length-t)*2)+`${n.path==null?``:`[${n.path}] `}${n.has} doesn't match ${n.expected}. ${n.message}`)}return e.join(`
|
|
988
|
+
`)}},mj=(e,t)=>e===t?!0:e==null||t==null||e.constructor!==t.constructor?!1:e[fA]?pA(e,t):dO(e)?cO(e,e=>lO(t,t=>mj(e,t))):hA(e)?SA(e,(e,n)=>mj(e,t[n])):!1,hj=class{static _dilutes=!1;extends(e){let[t,n]=[this.shape,e.shape];return this.constructor._dilutes&&([n,t]=[t,n]),mj(t,n)}equals(e){return this.constructor===e.constructor&&AA(this.shape,e.shape)}[fj](){return!0}[fA](e){return this.equals(e)}validate(e){return this.check(e)}check(e,t){vk()}get nullable(){return Zj(this,fM)}get optional(){return new Dj(this)}cast(e){return gM(e,this),e}expect(e){return gM(e,this),e}},gj=class extends hj{constructor(e,t){super(),this.shape=e,this._c=t}check(e,t=void 0){let n=e?.constructor===this.shape&&(this._c==null||this._c(e));return!n&&t?.extend(null,this.shape.name,e?.constructor.name,e?.constructor===this.shape?`Check failed`:`Constructor match failed`),n}},_j=(e,t=null)=>new gj(e,t),_j(gj),vj=class extends hj{constructor(e){super(),this.shape=e}check(e,t){let n=this.shape(e);return!n&&t?.extend(null,`custom prop`,e?.constructor.name,`failed to check custom prop`),n}},yj=e=>new vj(e),_j(vj),bj=class extends hj{constructor(e){super(),this.shape=e}check(e,t){let n=this.shape.some(t=>t===e);return!n&&t?.extend(null,this.shape.join(` | `),e.toString()),n}},xj=(...e)=>new bj(e),Sj=_j(bj),Cj=RegExp.escape||(e=>e.replace(/[().|&,$^[\]]/g,e=>`\\`+e)),wj=e=>{if(sM.check(e))return[Cj(e)];if(Sj.check(e))return e.shape.map(e=>e+``);if(oM.check(e))return[`[+-]?\\d+.?\\d*`];if(cM.check(e))return[`.*`];if(Qj.check(e))return e.shape.map(wj).flat(1);yk()},Tj=class extends hj{constructor(e){super(),this.shape=e,this._r=RegExp(`^`+e.map(wj).map(e=>`(${e.join(`|`)})`).join(``)+`$`)}check(e,t){let n=this._r.exec(e)!=null;return!n&&t?.extend(null,this._r.toString(),e.toString(),`String doesn't match string template.`),n}},_j(Tj),Ej=Symbol(`optional`),Dj=class extends hj{constructor(e){super(),this.shape=e}check(e,t){let n=e===void 0||this.shape.check(e);return!n&&t?.extend(null,`undefined (optional)`,`()`),n}get[Ej](){return!0}},Oj=_j(Dj),kj=class extends hj{check(e,t){return t?.extend(null,`never`,typeof e),!1}},new kj,_j(kj),Aj=class e extends hj{constructor(e,t=!1){super(),this.shape=e,this._isPartial=t}static _dilutes=!0;get partial(){return new e(this.shape,!0)}check(e,t){return e==null?(t?.extend(null,`object`,`null`),!1):SA(this.shape,(n,r)=>{let i=this._isPartial&&!CA(e,r)||n.check(e[r],t);return!i&&t?.extend(r.toString(),n.toString(),typeof e[r],`Object property does not match`),i})}},jj=e=>new Aj(e),Mj=_j(Aj),Nj=yj(e=>e!=null&&(e.constructor===Object||e.constructor==null)),Pj=class extends hj{constructor(e,t){super(),this.shape={keys:e,values:t}}check(e,t){return e!=null&&SA(e,(n,r)=>{let i=this.shape.keys.check(r,t);return!i&&t?.extend(r+``,`Record`,typeof e,i?`Key doesn't match schema`:`Value doesn't match value`),i&&this.shape.values.check(n,t)})}},Fj=(e,t)=>new Pj(e,t),Ij=_j(Pj),Lj=class extends hj{constructor(e){super(),this.shape=e}check(e,t){return e!=null&&SA(this.shape,(n,r)=>{let i=n.check(e[r],t);return!i&&t?.extend(r.toString(),`Tuple`,typeof n),i})}},Rj=(...e)=>new Lj(e),_j(Lj),zj=class extends hj{constructor(e){super(),this.shape=e.length===1?e[0]:new Xj(e)}check(e,t){let n=dO(e)&&cO(e,e=>this.shape.check(e));return!n&&t?.extend(null,`Array`,``),n}},Bj=(...e)=>new zj(e),Vj=_j(zj),Hj=yj(e=>dO(e)),Uj=class extends hj{constructor(e,t){super(),this.shape=e,this._c=t}check(e,t){let n=e instanceof this.shape&&(this._c==null||this._c(e));return!n&&t?.extend(null,this.shape.name,e?.constructor.name),n}},Wj=(e,t=null)=>new Uj(e,t),_j(Uj),Gj=Wj(hj),Kj=class extends hj{constructor(e){super(),this.len=e.length-1,this.args=Rj(...e.slice(-1)),this.res=e[this.len]}check(e,t){let n=e.constructor===Function&&e.length<=this.len;return!n&&t?.extend(null,`function`,typeof e),n}},qj=_j(Kj),Jj=yj(e=>typeof e==`function`),Yj=class extends hj{constructor(e){super(),this.shape=e}check(e,t){let n=cO(this.shape,n=>n.check(e,t));return!n&&t?.extend(null,`Intersectinon`,typeof e),n}},_j(Yj,e=>e.shape.length>0),Xj=class extends hj{static _dilutes=!0;constructor(e){super(),this.shape=e}check(e,t){let n=lO(this.shape,n=>n.check(e,t));return t?.extend(null,`Union`,typeof e),n}},Zj=(...e)=>e.findIndex(e=>Qj.check(e))>=0?Zj(...e.map(e=>hM(e)).map(e=>Qj.check(e)?e.shape:[e]).flat(1)):e.length===1?e[0]:new Xj(e),Qj=_j(Xj),$j=()=>!0,eM=yj($j),tM=_j(vj,e=>e.shape===$j),nM=yj(e=>typeof e==`bigint`),rM=yj(e=>e===nM),iM=yj(e=>typeof e==`symbol`),yj(e=>e===iM),aM=yj(e=>typeof e==`number`),oM=yj(e=>e===aM),sM=yj(e=>typeof e==`string`),cM=yj(e=>e===sM),lM=yj(e=>typeof e==`boolean`),uM=yj(e=>e===lM),dM=xj(void 0),_j(bj,e=>e.shape.length===1&&e.shape[0]===void 0),xj(void 0),fM=xj(null),pM=_j(bj,e=>e.shape.length===1&&e.shape[0]===null),_j(Uint8Array),_j(gj,e=>e.shape===Uint8Array),mM=Zj(aM,sM,fM,dM,nM,lM,iM),(()=>{let e=Bj(eM),t=Fj(sM,eM),n=Zj(aM,sM,fM,lM,e,t);return e.shape=n,t.shape.values=n,n})(),hM=e=>{if(Gj.check(e))return e;if(Nj.check(e)){let t={};for(let n in e)t[n]=hM(e[n]);return jj(t)}if(Hj.check(e))return Zj(...e.map(hM));if(mM.check(e))return xj(e);if(Jj.check(e))return _j(e);yk()},gM=VA?()=>{}:(e,t)=>{let n=new pj;if(!t.check(e,n))throw _k(`Expected value to be of type ${t.constructor.name}.\n${n.toString()}`)},_M=class{constructor(e){this.patterns=[],this.$state=e}if(e,t){return this.patterns.push({if:hM(e),h:t}),this}else(e){return this.if(eM,e)}done(){return(e,t)=>{for(let n=0;n<this.patterns.length;n++){let r=this.patterns[n];if(r.if.check(e))return r.h(e,t)}throw _k(`Unhandled pattern`)}}},vM=e=>new _M(e),yM=vM(eM).if(oM,(e,t)=>aj(t,TO,wO)).if(cM,(e,t)=>lj(t)).if(uM,(e,t)=>ij(t)).if(rM,(e,t)=>BigInt(aj(t,TO,wO))).if(Qj,(e,t)=>bM(t,uj(t,e.shape))).if(Mj,(e,t)=>{let n={};for(let r in e.shape){let i=e.shape[r];if(Oj.check(i)){if(ij(t))continue;i=i.shape}n[r]=yM(i,t)}return n}).if(Vj,(e,t)=>{let n=[],r=oj(t,0,42);for(let i=0;i<r;i++)n.push(bM(t,e.shape));return n}).if(Sj,(e,t)=>uj(t,e.shape)).if(pM,(e,t)=>null).if(qj,(e,t)=>{let n=bM(t,e.res);return()=>n}).if(tM,(e,t)=>bM(t,uj(t,[aM,sM,fM,dM,nM,lM,Bj(aM),Fj(Zj(`a`,`b`,`c`),aM)]))).if(Ij,(e,t)=>{let n={},r=aj(t,0,3);for(let i=0;i<r;i++){let r=bM(t,e.shape.keys);n[r]=bM(t,e.shape.values)}return n}).done(),bM=(e,t)=>yM(hM(t),e)})),SM,CM,wM,TM,EM,DM,OM=s((()=>{nO(),xM(),SM=typeof document<`u`?document:{},yj(e=>e.nodeType===DM),typeof DOMParser<`u`&&new DOMParser,yj(e=>e.nodeType===wM),yj(e=>e.nodeType===TM),CM=e=>eO(e,(e,t)=>`${t}:${e};`).join(``),wM=SM.ELEMENT_NODE,TM=SM.TEXT_NODE,SM.CDATA_SECTION_NODE,SM.COMMENT_NODE,EM=SM.DOCUMENT_NODE,SM.DOCUMENT_TYPE_NODE,DM=SM.DOCUMENT_FRAGMENT_NODE,yj(e=>e.nodeType===EM)})),kM,AM=s((()=>{kM=Symbol})),jM,MM,NM,PM,FM,IM,LM,RM,zM,BM,VM=s((()=>{AM(),eA(),jM=kM(),MM=kM(),NM=kM(),PM=kM(),FM=kM(),IM=kM(),LM=kM(),RM=kM(),zM=kM(),BM=e=>{e.length===1&&e[0]?.constructor===Function&&(e=e[0]());let t=[],n=[],r=0;for(;r<e.length;r++){let n=e[r];if(n===void 0)break;if(n.constructor===String||n.constructor===Number)t.push(n);else if(n.constructor===Object)break}for(r>0&&n.push(t.join(``));r<e.length;r++){let t=e[r];t instanceof Symbol||n.push(t)}return n},$k()})),HM,UM,WM,GM,KM,qM,JM=s((()=>{WA(),iO(),rj(),OM(),nO(),VM(),HM={[jM]:nj(`font-weight`,`bold`),[MM]:nj(`font-weight`,`normal`),[NM]:nj(`color`,`blue`),[FM]:nj(`color`,`green`),[PM]:nj(`color`,`grey`),[IM]:nj(`color`,`red`),[LM]:nj(`color`,`purple`),[RM]:nj(`color`,`orange`),[zM]:nj(`color`,`black`)},UM=e=>{e.length===1&&e[0]?.constructor===Function&&(e=e[0]());let t=[],n=[],r=ZD(),i=[],a=0;for(;a<e.length;a++){let i=e[a],o=HM[i];if(o!==void 0)r.set(o.left,o.right);else{if(i===void 0)break;if(i.constructor===String||i.constructor===Number){let e=CM(r);a>0||e.length>0?(t.push(`%c`+i),n.push(e)):t.push(i)}else break}}for(a>0&&(i=n,i.unshift(t.join(``)));a<e.length;a++){let t=e[a];t instanceof Symbol||i.push(t)}return i},WM=UA?UM:BM,GM=(...e)=>{console.log(...WM(e)),qM.forEach(t=>t.print(e))},KM=(...e)=>{console.warn(...WM(e)),e.unshift(RM),qM.forEach(t=>t.print(e))},qM=rO()})),YM,XM,ZM,QM=s((()=>{YM=e=>({[Symbol.iterator](){return this},next:e}),XM=(e,t)=>YM(()=>{let n;do n=e.next();while(!n.done&&!t(n.value));return n}),ZM=(e,t)=>YM(()=>{let{done:n,value:r}=e.next();return{done:n,value:n?void 0:t(r)}})}));function*$M(e){let t=jk(e.restDecoder);for(let n=0;n<t;n++){let t=jk(e.restDecoder),n=e.readClient(),r=jk(e.restDecoder);for(let i=0;i<t;i++){let t=e.readInfo();if(t===10){let t=jk(e.restDecoder);yield new wI(qN(n,r),t),r+=t}else if(31&t){let i=!(t&192),a=new bI(qN(n,r),null,(t&128)==128?e.readLeftID():null,null,(t&64)==64?e.readRightID():null,i?e.readParentInfo()?e.readString():e.readLeftID():null,i&&(t&32)==32?e.readString():null,xI(e,t));yield a,r+=a.length}else{let t=e.readLen();yield new WF(qN(n,r),t),r+=t}}}}var eN,tN,nN,rN,iN,aN,oN,sN,cN,lN,uN,dN,fN,pN,mN,hN,gN,_N,vN,yN,bN,xN,SN,CN,wN,TN,EN,DN,ON,kN,AN,jN,MN,NN,PN,FN,IN,LN,RN,zN,BN,VN,HN,UN,WN,GN,KN,qN,JN,YN,XN,ZN,QN,$N,eP,tP,nP,rP,iP,aP,oP,sP,cP,lP,uP,dP,fP,pP,mP,hP,gP,_P,vP,yP,bP,xP,SP,CP,wP,TP,EP,DP,OP,kP,AP,jP,MP,NP,PP,FP,IP,LP,RP,zP,BP,VP,HP,UP,WP,GP,KP,qP,JP,YP,XP,ZP,QP,$P,eF,tF,nF,rF,iF,aF,oF,sF,cF,lF,uF,dF,fF,pF,mF,hF,gF,_F,vF,yF,bF,xF,SF,CF,wF,TF,EF,DF,OF,kF,AF,jF,MF,NF,PF,FF,IF,LF,RF,zF,BF,VF,HF,UF,WF,GF,KF,qF,JF,YF,XF,ZF,QF,$F,eI,tI,nI,rI,iI,aI,oI,sI,cI,lI,uI,dI,fI,pI,mI,hI,gI,_I,vI,yI,bI,xI,SI,CI,wI,TI,EI,DI=s((()=>{hO(),fO(),SO(),nO(),gk(),Kk(),Qk(),nA(),ej(),bk(),CO(),MA(),iO(),JM(),QM(),DA(),WA(),eN=class{constructor(e,t){this.clock=e,this.len=t}},tN=class{constructor(){this.clients=new Map}},nN=(e,t,n)=>t.clients.forEach((t,r)=>{let i=e.doc.store.clients.get(r);if(i!=null){let r=i[i.length-1],a=r.id.clock+r.length;for(let r=0,o=t[r];r<t.length&&o.clock<a;o=t[++r])uP(e,i,o.clock,o.len,n)}}),rN=(e,t)=>{let n=0,r=e.length-1;for(;n<=r;){let i=gO((n+r)/2),a=e[i],o=a.clock;if(o<=t){if(t<o+a.len)return i;n=i+1}else r=i-1}return null},iN=(e,t)=>{let n=e.clients.get(t.client);return n!==void 0&&rN(n,t.clock)!==null},aN=e=>{e.clients.forEach(e=>{e.sort((e,t)=>e.clock-t.clock);let t,n;for(t=1,n=1;t<e.length;t++){let r=e[n-1],i=e[t];r.clock+r.len>=i.clock?e[n-1]=new eN(r.clock,yO(r.len,i.clock+i.len-r.clock)):(n<t&&(e[n]=i),n++)}e.length=n})},oN=e=>{let t=new tN;for(let n=0;n<e.length;n++)e[n].clients.forEach((r,i)=>{if(!t.clients.has(i)){let a=r.slice();for(let t=n+1;t<e.length;t++)oO(a,e[t].clients.get(i)||[]);t.clients.set(i,a)}});return aN(t),t},sN=(e,t,n,r)=>{$D(e.clients,t,()=>[]).push(new eN(n,r))},cN=()=>new tN,lN=e=>{let t=cN();return e.clients.forEach((e,n)=>{let r=[];for(let t=0;t<e.length;t++){let n=e[t];if(n.deleted){let i=n.id.clock,a=n.length;if(t+1<e.length)for(let n=e[t+1];t+1<e.length&&n.deleted;n=e[++t+1])a+=n.length;r.push(new eN(i,a))}}r.length>0&&t.clients.set(n,r)}),t},uN=(e,t)=>{JO(e.restEncoder,t.clients.size),sO(t.clients.entries()).sort((e,t)=>t[0]-e[0]).forEach(([t,n])=>{e.resetDsCurVal(),JO(e.restEncoder,t);let r=n.length;JO(e.restEncoder,r);for(let t=0;t<r;t++){let r=n[t];e.writeDsClock(r.clock),e.writeDsLen(r.len)}})},dN=e=>{let t=new tN,n=jk(e.restDecoder);for(let r=0;r<n;r++){e.resetDsCurVal();let n=jk(e.restDecoder),r=jk(e.restDecoder);if(r>0){let i=$D(t.clients,n,()=>[]);for(let t=0;t<r;t++)i.push(new eN(e.readDsClock(),e.readDsLen()))}}return t},fN=(e,t,n)=>{let r=new tN,i=jk(e.restDecoder);for(let a=0;a<i;a++){e.resetDsCurVal();let i=jk(e.restDecoder),a=jk(e.restDecoder),o=n.clients.get(i)||[],s=tP(n,i);for(let n=0;n<a;n++){let n=e.readDsClock(),a=n+e.readDsLen();if(n<s){s<a&&sN(r,i,s,a-s);let e=rP(o,n),c=o[e];for(!c.deleted&&c.id.clock<n&&(o.splice(e+1,0,yI(t,c,n-c.id.clock)),e++);e<o.length&&(c=o[e++],c.id.clock<a);)c.deleted||(a<c.id.clock+c.length&&o.splice(e,0,yI(t,c,a-c.id.clock)),c.delete(t))}else sN(r,i,n,a-n)}}if(r.clients.size>0){let e=new SN;return JO(e.restEncoder,0),uN(e,r),e.toUint8Array()}return null},pN=Yk,mN=class e extends pO{constructor({guid:e=Zk(),collectionid:t=null,gc:n=!0,gcFilter:r=()=>!0,meta:i=null,autoLoad:a=!1,shouldLoad:o=!0}={}){super(),this.gc=n,this.gcFilter=r,this.clientID=pN(),this.guid=e,this.collectionid=t,this.share=new Map,this.store=new $N,this._transaction=null,this._transactionCleanups=[],this.subdocs=new Set,this._item=null,this.shouldLoad=o,this.autoLoad=a,this.meta=i,this.isLoaded=!1,this.isSynced=!1,this.isDestroyed=!1,this.whenLoaded=tA(e=>{this.on(`load`,()=>{this.isLoaded=!0,e(this)})});let s=()=>tA(e=>{let t=n=>{(n===void 0||n===!0)&&(this.off(`sync`,t),e())};this.on(`sync`,t)});this.on(`sync`,e=>{e===!1&&this.isSynced&&(this.whenSynced=s()),this.isSynced=e===void 0||e===!0,this.isSynced&&!this.isLoaded&&this.emit(`load`,[this])}),this.whenSynced=s()}load(){let e=this._item;e!==null&&!this.shouldLoad&&vP(e.parent.doc,e=>{e.subdocsLoaded.add(this)},null,!0),this.shouldLoad=!0}getSubdocs(){return this.subdocs}getSubdocGuids(){return new Set(sO(this.subdocs).map(e=>e.guid))}transact(e,t=null){return vP(this,e,t)}get(e,t=UP){let n=$D(this.share,e,()=>{let e=new t;return e._integrate(this,null),e}),r=n.constructor;if(t!==UP&&r!==t){if(r===UP){let r=new t;r._map=n._map,n._map.forEach(e=>{for(;e!==null;e=e.left)e.parent=r}),r._start=n._start;for(let e=r._start;e!==null;e=e.right)e.parent=r;return r._length=n._length,this.share.set(e,r),r._integrate(this,null),r}throw Error(`Type with the name ${e} has already been defined with a different constructor`)}return n}getArray(e=``){return this.get(e,lF)}getText(e=``){return this.get(e,AF)}getMap(e=``){return this.get(e,fF)}getXmlElement(e=``){return this.get(e,FF)}getXmlFragment(e=``){return this.get(e,NF)}toJSON(){let e={};return this.share.forEach((t,n)=>{e[n]=t.toJSON()}),e}destroy(){this.isDestroyed=!0,sO(this.subdocs).forEach(e=>e.destroy());let t=this._item;if(t!==null){this._item=null;let n=t.content;n.doc=new e({guid:this.guid,...n.opts,shouldLoad:!1}),n.doc._item=t,vP(t.parent.doc,e=>{let r=n.doc;t.deleted||e.subdocsAdded.add(r),e.subdocsRemoved.add(this)},null,!0)}this.emit(`destroyed`,[!0]),this.emit(`destroy`,[this]),super.destroy()}},hN=class{constructor(e){this.restDecoder=e}resetDsCurVal(){}readDsClock(){return jk(this.restDecoder)}readDsLen(){return jk(this.restDecoder)}},gN=class extends hN{readLeftID(){return qN(jk(this.restDecoder),jk(this.restDecoder))}readRightID(){return qN(jk(this.restDecoder),jk(this.restDecoder))}readClient(){return jk(this.restDecoder)}readInfo(){return Ak(this.restDecoder)}readString(){return Fk(this.restDecoder)}readParentInfo(){return jk(this.restDecoder)===1}readTypeRef(){return jk(this.restDecoder)}readLen(){return jk(this.restDecoder)}readAny(){return Vk(this.restDecoder)}readBuf(){return $A(kk(this.restDecoder))}readJSON(){return JSON.parse(Fk(this.restDecoder))}readKey(){return Fk(this.restDecoder)}},_N=class{constructor(e){this.dsCurrVal=0,this.restDecoder=e}resetDsCurVal(){this.dsCurrVal=0}readDsClock(){return this.dsCurrVal+=jk(this.restDecoder),this.dsCurrVal}readDsLen(){let e=jk(this.restDecoder)+1;return this.dsCurrVal+=e,e}},vN=class extends _N{constructor(e){super(e),this.keys=[],jk(e),this.keyClockDecoder=new Wk(kk(e)),this.clientDecoder=new Uk(kk(e)),this.leftClockDecoder=new Wk(kk(e)),this.rightClockDecoder=new Wk(kk(e)),this.infoDecoder=new Hk(kk(e),Ak),this.stringDecoder=new Gk(kk(e)),this.parentInfoDecoder=new Hk(kk(e),Ak),this.typeRefDecoder=new Uk(kk(e)),this.lenDecoder=new Uk(kk(e))}readLeftID(){return new GN(this.clientDecoder.read(),this.leftClockDecoder.read())}readRightID(){return new GN(this.clientDecoder.read(),this.rightClockDecoder.read())}readClient(){return this.clientDecoder.read()}readInfo(){return this.infoDecoder.read()}readString(){return this.stringDecoder.read()}readParentInfo(){return this.parentInfoDecoder.read()===1}readTypeRef(){return this.typeRefDecoder.read()}readLen(){return this.lenDecoder.read()}readAny(){return Vk(this.restDecoder)}readBuf(){return kk(this.restDecoder)}readJSON(){return Vk(this.restDecoder)}readKey(){let e=this.keyClockDecoder.read();if(e<this.keys.length)return this.keys[e];{let e=this.stringDecoder.read();return this.keys.push(e),e}}},yN=class{constructor(){this.restEncoder=HO()}toUint8Array(){return WO(this.restEncoder)}resetDsCurVal(){}writeDsClock(e){JO(this.restEncoder,e)}writeDsLen(e){JO(this.restEncoder,e)}},bN=class extends yN{writeLeftID(e){JO(this.restEncoder,e.client),JO(this.restEncoder,e.clock)}writeRightID(e){JO(this.restEncoder,e.client),JO(this.restEncoder,e.clock)}writeClient(e){JO(this.restEncoder,e)}writeInfo(e){qO(this.restEncoder,e)}writeString(e){ek(this.restEncoder,e)}writeParentInfo(e){JO(this.restEncoder,+!!e)}writeTypeRef(e){JO(this.restEncoder,e)}writeLen(e){JO(this.restEncoder,e)}writeAny(e){lk(this.restEncoder,e)}writeBuf(e){nk(this.restEncoder,e)}writeJSON(e){ek(this.restEncoder,JSON.stringify(e))}writeKey(e){ek(this.restEncoder,e)}},xN=class{constructor(){this.restEncoder=HO(),this.dsCurrVal=0}toUint8Array(){return WO(this.restEncoder)}resetDsCurVal(){this.dsCurrVal=0}writeDsClock(e){let t=e-this.dsCurrVal;this.dsCurrVal=e,JO(this.restEncoder,t)}writeDsLen(e){e===0&&yk(),JO(this.restEncoder,e-1),this.dsCurrVal+=e}},SN=class extends xN{constructor(){super(),this.keyMap=new Map,this.keyClock=0,this.keyClockEncoder=new mk,this.clientEncoder=new fk,this.leftClockEncoder=new mk,this.rightClockEncoder=new mk,this.infoEncoder=new uk(qO),this.stringEncoder=new hk,this.parentInfoEncoder=new uk(qO),this.typeRefEncoder=new fk,this.lenEncoder=new fk}toUint8Array(){let e=HO();return JO(e,0),nk(e,this.keyClockEncoder.toUint8Array()),nk(e,this.clientEncoder.toUint8Array()),nk(e,this.leftClockEncoder.toUint8Array()),nk(e,this.rightClockEncoder.toUint8Array()),nk(e,WO(this.infoEncoder)),nk(e,this.stringEncoder.toUint8Array()),nk(e,WO(this.parentInfoEncoder)),nk(e,this.typeRefEncoder.toUint8Array()),nk(e,this.lenEncoder.toUint8Array()),tk(e,WO(this.restEncoder)),WO(e)}writeLeftID(e){this.clientEncoder.write(e.client),this.leftClockEncoder.write(e.clock)}writeRightID(e){this.clientEncoder.write(e.client),this.rightClockEncoder.write(e.clock)}writeClient(e){this.clientEncoder.write(e)}writeInfo(e){this.infoEncoder.write(e)}writeString(e){this.stringEncoder.write(e)}writeParentInfo(e){this.parentInfoEncoder.write(+!!e)}writeTypeRef(e){this.typeRefEncoder.write(e)}writeLen(e){this.lenEncoder.write(e)}writeAny(e){lk(this.restEncoder,e)}writeBuf(e){nk(this.restEncoder,e)}writeJSON(e){lk(this.restEncoder,e)}writeKey(e){let t=this.keyMap.get(e);t===void 0?(this.keyClockEncoder.write(this.keyClock++),this.stringEncoder.write(e)):this.keyClockEncoder.write(t)}},CN=(e,t,n,r)=>{r=yO(r,t[0].id.clock);let i=rP(t,r);JO(e.restEncoder,t.length-i),e.writeClient(n),JO(e.restEncoder,r);let a=t[i];a.write(e,r-a.id.clock);for(let n=i+1;n<t.length;n++)t[n].write(e,0)},wN=(e,t,n)=>{let r=new Map;n.forEach((e,n)=>{tP(t,n)>e&&r.set(n,e)}),eP(t).forEach((e,t)=>{n.has(t)||r.set(t,0)}),JO(e.restEncoder,r.size),sO(r.entries()).sort((e,t)=>t[0]-e[0]).forEach(([n,r])=>{CN(e,t.clients.get(n),n,r)})},TN=(e,t)=>{let n=ZD(),r=jk(e.restDecoder);for(let i=0;i<r;i++){let r=jk(e.restDecoder),i=Array(r),a=e.readClient(),o=jk(e.restDecoder);n.set(a,{i:0,refs:i});for(let n=0;n<r;n++){let r=e.readInfo();switch(31&r){case 0:{let t=e.readLen();i[n]=new WF(qN(a,o),t),o+=t;break}case 10:{let t=jk(e.restDecoder);i[n]=new wI(qN(a,o),t),o+=t;break}default:{let s=!(r&192),c=new bI(qN(a,o),null,(r&128)==128?e.readLeftID():null,null,(r&64)==64?e.readRightID():null,s?e.readParentInfo()?t.get(e.readString()):e.readLeftID():null,s&&(r&32)==32?e.readString():null,xI(e,r));i[n]=c,o+=c.length}}}}return n},EN=(e,t,n)=>{let r=[],i=sO(n.keys()).sort((e,t)=>e-t);if(i.length===0)return null;let a=()=>{if(i.length===0)return null;let e=n.get(i[i.length-1]);for(;e.refs.length===e.i;)if(i.pop(),i.length>0)e=n.get(i[i.length-1]);else return null;return e},o=a();if(o===null)return null;let s=new $N,c=new Map,l=(e,t)=>{let n=c.get(e);(n==null||n>t)&&c.set(e,t)},u=o.refs[o.i++],d=new Map,f=()=>{for(let e of r){let t=e.id.client,r=n.get(t);r?(r.i--,s.clients.set(t,r.refs.slice(r.i)),n.delete(t),r.i=0,r.refs=[]):s.clients.set(t,[e]),i=i.filter(e=>e!==t)}r.length=0};for(;;){if(u.constructor!==wI){let i=$D(d,u.id.client,()=>tP(t,u.id.client))-u.id.clock;if(i<0)r.push(u),l(u.id.client,u.id.clock-1),f();else{let a=u.getMissing(e,t);if(a!==null){r.push(u);let e=n.get(a)||{refs:[],i:0};if(e.refs.length===e.i)l(a,tP(t,a)),f();else{u=e.refs[e.i++];continue}}else(i===0||i<u.length)&&(u.integrate(e,i),d.set(u.id.client,u.id.clock+u.length))}}if(r.length>0)u=r.pop();else if(o!==null&&o.i<o.refs.length)u=o.refs[o.i++];else{if(o=a(),o===null)break;u=o.refs[o.i++]}}if(s.clients.size>0){let e=new SN;return wN(e,s,new Map),JO(e.restEncoder,0),{missing:c,update:e.toUint8Array()}}return null},DN=(e,t)=>wN(e,t.doc.store,t.beforeState),ON=(e,t,n,r=new vN(e))=>vP(t,e=>{e.local=!1;let t=!1,n=e.doc,i=n.store,a=TN(r,n),o=EN(e,i,a),s=i.pendingStructs;if(s){for(let[e,n]of s.missing)if(n<tP(i,e)){t=!0;break}if(o){for(let[e,t]of o.missing){let n=s.missing.get(e);(n==null||n>t)&&s.missing.set(e,t)}s.update=CP([s.update,o.update])}}else i.pendingStructs=o;let c=fN(r,e,i);if(i.pendingDs){let t=new vN(Ek(i.pendingDs));jk(t.restDecoder);let n=fN(t,e,i);i.pendingDs=c&&n?CP([c,n]):c||n}else i.pendingDs=c;if(t){let t=i.pendingStructs.update;i.pendingStructs=null,kN(e.doc,t)}},n,!1),kN=(e,t,n,r=vN)=>{let i=Ek(t);ON(i,e,n,new r(i))},AN=(e,t,n)=>kN(e,t,n,gN),jN=(e,t,n=new Map)=>{wN(e,t.store,n),uN(e,lN(t.store))},MN=(e,t=new Uint8Array([0]),n=new SN)=>{let r=FN(t);jN(n,e,r);let i=[n.toUint8Array()];if(e.store.pendingDs&&i.push(e.store.pendingDs),e.store.pendingStructs&&i.push(wP(e.store.pendingStructs.update,t)),i.length>1){if(n.constructor===bN)return xP(i.map((e,t)=>t===0?e:kP(e)));if(n.constructor===SN)return CP(i)}return i[0]},NN=(e,t)=>MN(e,t,new bN),PN=e=>{let t=new Map,n=jk(e.restDecoder);for(let r=0;r<n;r++){let n=jk(e.restDecoder),r=jk(e.restDecoder);t.set(n,r)}return t},FN=e=>PN(new hN(Ek(e))),IN=(e,t)=>(JO(e.restEncoder,t.size),sO(t.entries()).sort((e,t)=>t[0]-e[0]).forEach(([t,n])=>{JO(e.restEncoder,t),JO(e.restEncoder,n)}),e),LN=(e,t)=>IN(e,eP(t.store)),RN=(e,t=new xN)=>(e instanceof Map?IN(t,e):LN(t,e),t.toUint8Array()),zN=e=>RN(e,new yN),BN=class{constructor(){this.l=[]}},VN=()=>new BN,HN=(e,t)=>e.l.push(t),UN=(e,t)=>{let n=e.l,r=n.length;e.l=n.filter(e=>t!==e),r===e.l.length&&console.error(`[yjs] Tried to remove event handler that doesn't exist.`)},WN=(e,t,n)=>OA(e.l,[t,n]),GN=class{constructor(e,t){this.client=e,this.clock=t}},KN=(e,t)=>e===t||e!==null&&t!==null&&e.client===t.client&&e.clock===t.clock,qN=(e,t)=>new GN(e,t),JN=e=>{for(let[t,n]of e.doc.share.entries())if(n===e)return t;throw yk()},YN=class{constructor(e,t){this.ds=e,this.sv=t}},XN=(e,t)=>new YN(e,t),XN(cN(),new Map),ZN=(e,t)=>t===void 0?!e.deleted:t.sv.has(e.id.client)&&(t.sv.get(e.id.client)||0)>e.id.clock&&!iN(t.ds,e.id),QN=(e,t)=>{let n=$D(e.meta,QN,rO),r=e.doc.store;n.has(t)||(t.sv.forEach((t,n)=>{t<tP(r,n)&&sP(e,qN(n,t))}),nN(e,t.ds,e=>{}),n.add(t))},$N=class{constructor(){this.clients=new Map,this.pendingStructs=null,this.pendingDs=null}},eP=e=>{let t=new Map;return e.clients.forEach((e,n)=>{let r=e[e.length-1];t.set(n,r.id.clock+r.length)}),t},tP=(e,t)=>{let n=e.clients.get(t);if(n===void 0)return 0;let r=n[n.length-1];return r.id.clock+r.length},nP=(e,t)=>{let n=e.clients.get(t.id.client);if(n===void 0)n=[],e.clients.set(t.id.client,n);else{let e=n[n.length-1];if(e.id.clock+e.length!==t.id.clock)throw yk()}n.push(t)},rP=(e,t)=>{let n=0,r=e.length-1,i=e[r],a=i.id.clock;if(a===t)return r;let o=gO(t/(a+i.length-1)*r);for(;n<=r;){if(i=e[o],a=i.id.clock,a<=t){if(t<a+i.length)return o;n=o+1}else r=o-1;o=gO((n+r)/2)}throw yk()},iP=(e,t)=>{let n=e.clients.get(t.client);return n[rP(n,t.clock)]},aP=iP,oP=(e,t,n)=>{let r=rP(t,n),i=t[r];return i.id.clock<n&&i instanceof bI?(t.splice(r+1,0,yI(e,i,n-i.id.clock)),r+1):r},sP=(e,t)=>{let n=e.doc.store.clients.get(t.client);return n[oP(e,n,t.clock)]},cP=(e,t,n)=>{let r=t.clients.get(n.client),i=rP(r,n.clock),a=r[i];return n.clock!==a.id.clock+a.length-1&&a.constructor!==WF&&r.splice(i+1,0,yI(e,a,n.clock-a.id.clock+1)),a},lP=(e,t,n)=>{let r=e.clients.get(t.id.client);r[rP(r,t.id.clock)]=n},uP=(e,t,n,r,i)=>{if(r===0)return;let a=n+r,o=oP(e,t,n),s;do s=t[o++],a<s.id.clock+s.length&&oP(e,t,a),i(s);while(o<t.length&&t[o].id.clock<a)},dP=class{constructor(e,t,n){this.doc=e,this.deleteSet=new tN,this.beforeState=eP(e.store),this.afterState=new Map,this.changed=new Map,this.changedParentTypes=new Map,this._mergeStructs=[],this.origin=t,this.meta=new Map,this.local=n,this.subdocsAdded=new Set,this.subdocsRemoved=new Set,this.subdocsLoaded=new Set,this._needFormattingCleanup=!1}},fP=(e,t)=>t.deleteSet.clients.size===0&&!tO(t.afterState,(e,n)=>t.beforeState.get(n)!==e)?!1:(aN(t.deleteSet),DN(e,t),uN(e,t.deleteSet),!0),pP=(e,t,n)=>{let r=t._item;(r===null||r.id.clock<(e.beforeState.get(r.id.client)||0)&&!r.deleted)&&$D(e.changed,t,rO).add(n)},mP=(e,t)=>{let n=e[t],r=e[t-1],i=t;for(;i>0&&r.deleted===n.deleted&&r.constructor===n.constructor&&r.mergeWith(n);n=r,r=e[--i-1])n instanceof bI&&n.parentSub!==null&&n.parent._map.get(n.parentSub)===n&&n.parent._map.set(n.parentSub,r);let a=t-i;return a&&e.splice(t+1-a,a),a},hP=(e,t,n)=>{for(let[r,i]of e.clients.entries()){let e=t.clients.get(r);for(let r=i.length-1;r>=0;r--){let a=i[r],o=a.clock+a.len;for(let r=rP(e,a.clock),i=e[r];r<e.length&&i.id.clock<o;i=e[++r]){let i=e[r];if(a.clock+a.len<=i.id.clock)break;i instanceof bI&&i.deleted&&!i.keep&&n(i)&&i.gc(t,!1)}}}},gP=(e,t)=>{e.clients.forEach((e,n)=>{let r=t.clients.get(n);for(let t=e.length-1;t>=0;t--){let n=e[t],i=vO(r.length-1,1+rP(r,n.clock+n.len-1));for(let e=i,t=r[e];e>0&&t.id.clock>=n.clock;t=r[e])e-=1+mP(r,e)}})},_P=(e,t)=>{if(t<e.length){let n=e[t],r=n.doc,i=r.store,a=n.deleteSet,o=n._mergeStructs;try{aN(a),n.afterState=eP(n.doc.store),r.emit(`beforeObserverCalls`,[n,r]);let e=[];n.changed.forEach((t,r)=>e.push(()=>{r._item!==null&&r._item.deleted||r._callObserver(n,t)})),e.push(()=>{n.changedParentTypes.forEach((t,r)=>{r._dEH.l.length>0&&(r._item===null||!r._item.deleted)&&e.push(()=>{t=t.filter(e=>e.target._item===null||!e.target._item.deleted),t.forEach(e=>{e.currentTarget=r,e._path=null}),t.sort((e,t)=>e.path.length-t.path.length),WN(r._dEH,t,n)})}),e.push(()=>r.emit(`afterTransaction`,[n,r])),e.push(()=>{n._needFormattingCleanup&&DF(n)})}),OA(e,[])}finally{r.gc&&hP(a,i,r.gcFilter),gP(a,i),n.afterState.forEach((e,t)=>{let r=n.beforeState.get(t)||0;if(r!==e){let e=i.clients.get(t),n=yO(rP(e,r),1);for(let t=e.length-1;t>=n;)t-=1+mP(e,t)}});for(let e=o.length-1;e>=0;e--){let{client:t,clock:n}=o[e].id,r=i.clients.get(t),a=rP(r,n);a+1<r.length&&mP(r,a+1)>1||a>0&&mP(r,a)}if(!n.local&&n.afterState.get(r.clientID)!==n.beforeState.get(r.clientID)&&(GM(RM,jM,`[yjs] `,MM,IM,`Changed the client-id because another client seems to be using it.`),r.clientID=pN()),r.emit(`afterTransactionCleanup`,[n,r]),r._observers.has(`update`)){let e=new bN;fP(e,n)&&r.emit(`update`,[e.toUint8Array(),n.origin,r,n])}if(r._observers.has(`updateV2`)){let e=new SN;fP(e,n)&&r.emit(`updateV2`,[e.toUint8Array(),n.origin,r,n])}let{subdocsAdded:s,subdocsLoaded:c,subdocsRemoved:l}=n;(s.size>0||l.size>0||c.size>0)&&(s.forEach(e=>{e.clientID=r.clientID,e.collectionid??=r.collectionid,r.subdocs.add(e)}),l.forEach(e=>r.subdocs.delete(e)),r.emit(`subdocs`,[{loaded:c,added:s,removed:l},r,n]),l.forEach(e=>e.destroy())),e.length<=t+1?(r._transactionCleanups=[],r.emit(`afterAllTransactions`,[r,e])):_P(e,t+1)}}},vP=(e,t,n=null,r=!0)=>{let i=e._transactionCleanups,a=!1,o=null;e._transaction===null&&(a=!0,e._transaction=new dP(e,n,r),i.push(e._transaction),i.length===1&&e.emit(`beforeAllTransactions`,[e]),e.emit(`beforeTransaction`,[e._transaction,e]));try{o=t(e._transaction)}finally{if(a){let t=e._transaction===i[0];e._transaction=null,t&&_P(i,0)}}return o},yP=class{constructor(e,t){this.gen=$M(e),this.curr=null,this.done=!1,this.filterSkips=t,this.next()}next(){do this.curr=this.gen.next().value||null;while(this.filterSkips&&this.curr!==null&&this.curr.constructor===wI);return this.curr}},bP=class{constructor(e){this.currClient=0,this.startClock=0,this.written=0,this.encoder=e,this.clientStructs=[]}},xP=e=>CP(e,gN,bN),SP=(e,t)=>{if(e.constructor===WF){let{client:n,clock:r}=e.id;return new WF(qN(n,r+t),e.length-t)}if(e.constructor===wI){let{client:n,clock:r}=e.id;return new wI(qN(n,r+t),e.length-t)}{let n=e,{client:r,clock:i}=n.id;return new bI(qN(r,i+t),null,qN(r,i+t-1),null,n.rightOrigin,n.parent,n.parentSub,n.content.splice(t))}},CP=(e,t=vN,n=SN)=>{if(e.length===1)return e[0];let r=e.map(e=>new t(Ek(e))),i=r.map(e=>new yP(e,!0)),a=null,o=new n,s=new bP(o);for(;i=i.filter(e=>e.curr!==null),i.sort((e,t)=>{if(e.curr.id.client===t.curr.id.client){let n=e.curr.id.clock-t.curr.id.clock;return n===0?e.curr.constructor===t.curr.constructor?0:e.curr.constructor===wI?1:-1:n}return t.curr.id.client-e.curr.id.client}),i.length!==0;){let e=i[0],t=e.curr.id.client;if(a!==null){let n=e.curr,r=!1;for(;n!==null&&n.id.clock+n.length<=a.struct.id.clock+a.struct.length&&n.id.client>=a.struct.id.client;)n=e.next(),r=!0;if(n===null||n.id.client!==t||r&&n.id.clock>a.struct.id.clock+a.struct.length)continue;if(t!==a.struct.id.client)EP(s,a.struct,a.offset),a={struct:n,offset:0},e.next();else if(a.struct.id.clock+a.struct.length<n.id.clock){if(a.struct.constructor===wI)a.struct.length=n.id.clock+n.length-a.struct.id.clock;else{EP(s,a.struct,a.offset);let e=n.id.clock-a.struct.id.clock-a.struct.length;a={struct:new wI(qN(t,a.struct.id.clock+a.struct.length),e),offset:0}}}else{let t=a.struct.id.clock+a.struct.length-n.id.clock;t>0&&(a.struct.constructor===wI?a.struct.length-=t:n=SP(n,t)),a.struct.mergeWith(n)||(EP(s,a.struct,a.offset),a={struct:n,offset:0},e.next())}}else a={struct:e.curr,offset:0},e.next();for(let n=e.curr;n!==null&&n.id.client===t&&n.id.clock===a.struct.id.clock+a.struct.length&&n.constructor!==wI;n=e.next())EP(s,a.struct,a.offset),a={struct:n,offset:0}}a!==null&&(EP(s,a.struct,a.offset),a=null),DP(s);let c=r.map(e=>dN(e)),l=oN(c);return uN(o,l),o.toUint8Array()},wP=(e,t,n=vN,r=SN)=>{let i=FN(t),a=new r,o=new bP(a),s=new n(Ek(e)),c=new yP(s,!1);for(;c.curr;){let e=c.curr,t=e.id.client,n=i.get(t)||0;if(c.curr.constructor===wI)c.next();else if(e.id.clock+e.length>n)for(EP(o,e,yO(n-e.id.clock,0)),c.next();c.curr&&c.curr.id.client===t;)EP(o,c.curr,0),c.next();else for(;c.curr&&c.curr.id.client===t&&c.curr.id.clock+c.curr.length<=n;)c.next()}DP(o);let l=dN(s);return uN(a,l),a.toUint8Array()},TP=e=>{e.written>0&&(e.clientStructs.push({written:e.written,restEncoder:WO(e.encoder.restEncoder)}),e.encoder.restEncoder=HO(),e.written=0)},EP=(e,t,n)=>{e.written>0&&e.currClient!==t.id.client&&TP(e),e.written===0&&(e.currClient=t.id.client,e.encoder.writeClient(t.id.client),JO(e.encoder.restEncoder,t.id.clock+n)),t.write(e.encoder,n),e.written++},DP=e=>{TP(e);let t=e.encoder.restEncoder;JO(t,e.clientStructs.length);for(let n=0;n<e.clientStructs.length;n++){let r=e.clientStructs[n];JO(t,r.written),tk(t,r.restEncoder)}},OP=(e,t,n,r)=>{let i=new n(Ek(e)),a=new yP(i,!1),o=new r,s=new bP(o);for(let e=a.curr;e!==null;e=a.next())EP(s,t(e),0);DP(s);let c=dN(i);return uN(o,c),o.toUint8Array()},kP=e=>OP(e,kA,vN,bN),AP=`You must not compute changes after the event-handler fired.`,jP=class{constructor(e,t){this.target=e,this.currentTarget=e,this.transaction=t,this._changes=null,this._keys=null,this._delta=null,this._path=null}get path(){return this._path||=MP(this.currentTarget,this.target)}deletes(e){return iN(this.transaction.deleteSet,e.id)}get keys(){if(this._keys===null){if(this.transaction.doc._transactionCleanups.length===0)throw _k(AP);let e=new Map,t=this.target;this.transaction.changed.get(t).forEach(n=>{if(n!==null){let r=t._map.get(n),i,a;if(this.adds(r)){let e=r.left;for(;e!==null&&this.adds(e);)e=e.left;if(this.deletes(r)){if(e!==null&&this.deletes(e))i=`delete`,a=aO(e.content.getContent());else return}else e!==null&&this.deletes(e)?(i=`update`,a=aO(e.content.getContent())):(i=`add`,a=void 0)}else if(this.deletes(r))i=`delete`,a=aO(r.content.getContent());else return;e.set(n,{action:i,oldValue:a})}}),this._keys=e}return this._keys}get delta(){return this.changes.delta}adds(e){return e.id.clock>=(this.transaction.beforeState.get(e.id.client)||0)}get changes(){let e=this._changes;if(e===null){if(this.transaction.doc._transactionCleanups.length===0)throw _k(AP);let t=this.target,n=rO(),r=rO(),i=[];if(e={added:n,deleted:r,delta:i,keys:this.keys},this.transaction.changed.get(t).has(null)){let e=null,a=()=>{e&&i.push(e)};for(let i=t._start;i!==null;i=i.right)i.deleted?this.deletes(i)&&!this.adds(i)&&((e===null||e.delete===void 0)&&(a(),e={delete:0}),e.delete+=i.length,r.add(i)):this.adds(i)?((e===null||e.insert===void 0)&&(a(),e={insert:[]}),e.insert=e.insert.concat(i.content.getContent()),n.add(i)):((e===null||e.retain===void 0)&&(a(),e={retain:0}),e.retain+=i.length);e!==null&&e.retain===void 0&&a()}this._changes=e}return e}},MP=(e,t)=>{let n=[];for(;t._item!==null&&t!==e;){if(t._item.parentSub!==null)n.unshift(t._item.parentSub);else{let e=0,r=t._item.parent._start;for(;r!==t._item&&r!==null;)!r.deleted&&r.countable&&(e+=r.length),r=r.right;n.unshift(e)}t=t._item.parent}return n},NP=()=>{KM(`Invalid access: Add Yjs type to a document before reading data.`)},PP=80,FP=0,IP=class{constructor(e,t){e.marker=!0,this.p=e,this.index=t,this.timestamp=FP++}},LP=e=>{e.timestamp=FP++},RP=(e,t,n)=>{e.p.marker=!1,e.p=t,t.marker=!0,e.index=n,e.timestamp=FP++},zP=(e,t,n)=>{if(e.length>=PP){let r=e.reduce((e,t)=>e.timestamp<t.timestamp?e:t);return RP(r,t,n),r}{let r=new IP(t,n);return e.push(r),r}},BP=(e,t)=>{if(e._start===null||t===0||e._searchMarker===null)return null;let n=e._searchMarker.length===0?null:e._searchMarker.reduce((e,n)=>_O(t-e.index)<_O(t-n.index)?e:n),r=e._start,i=0;for(n!==null&&(r=n.p,i=n.index,LP(n));r.right!==null&&i<t;){if(!r.deleted&&r.countable){if(t<i+r.length)break;i+=r.length}r=r.right}for(;r.left!==null&&i>t;)r=r.left,!r.deleted&&r.countable&&(i-=r.length);for(;r.left!==null&&r.left.id.client===r.id.client&&r.left.id.clock+r.left.length===r.id.clock;)r=r.left,!r.deleted&&r.countable&&(i-=r.length);return n!==null&&_O(n.index-i)<r.parent.length/PP?(RP(n,r,i),n):zP(e._searchMarker,r,i)},VP=(e,t,n)=>{for(let r=e.length-1;r>=0;r--){let i=e[r];if(n>0){let t=i.p;for(t.marker=!1;t&&(t.deleted||!t.countable);)t=t.left,t&&!t.deleted&&t.countable&&(i.index-=t.length);if(t===null||t.marker===!0){e.splice(r,1);continue}i.p=t,t.marker=!0}(t<i.index||n>0&&t===i.index)&&(i.index=yO(t,i.index+n))}},HP=(e,t,n)=>{let r=e,i=t.changedParentTypes;for(;$D(i,e,()=>[]).push(n),e._item!==null;)e=e._item.parent;WN(r._eH,n,t)},UP=class{constructor(){this._item=null,this._map=new Map,this._start=null,this.doc=null,this._length=0,this._eH=VN(),this._dEH=VN(),this._searchMarker=null}get parent(){return this._item?this._item.parent:null}_integrate(e,t){this.doc=e,this._item=t}_copy(){throw vk()}clone(){throw vk()}_write(e){}get _first(){let e=this._start;for(;e!==null&&e.deleted;)e=e.right;return e}_callObserver(e,t){!e.local&&this._searchMarker&&(this._searchMarker.length=0)}observe(e){HN(this._eH,e)}observeDeep(e){HN(this._dEH,e)}unobserve(e){UN(this._eH,e)}unobserveDeep(e){UN(this._dEH,e)}toJSON(){}},WP=(e,t,n)=>{e.doc??NP(),t<0&&(t=e._length+t),n<0&&(n=e._length+n);let r=n-t,i=[],a=e._start;for(;a!==null&&r>0;){if(a.countable&&!a.deleted){let e=a.content.getContent();if(e.length<=t)t-=e.length;else{for(let n=t;n<e.length&&r>0;n++)i.push(e[n]),r--;t=0}}a=a.right}return i},GP=e=>{e.doc??NP();let t=[],n=e._start;for(;n!==null;){if(n.countable&&!n.deleted){let e=n.content.getContent();for(let n=0;n<e.length;n++)t.push(e[n])}n=n.right}return t},KP=(e,t)=>{let n=0,r=e._start;for(e.doc??NP();r!==null;){if(r.countable&&!r.deleted){let i=r.content.getContent();for(let r=0;r<i.length;r++)t(i[r],n++,e)}r=r.right}},qP=(e,t)=>{let n=[];return KP(e,(r,i)=>{n.push(t(r,i,e))}),n},JP=e=>{let t=e._start,n=null,r=0;return{[Symbol.iterator](){return this},next:()=>{if(n===null){for(;t!==null&&t.deleted;)t=t.right;if(t===null)return{done:!0,value:void 0};n=t.content.getContent(),r=0,t=t.right}let e=n[r++];return n.length<=r&&(n=null),{done:!1,value:e}}}},YP=(e,t)=>{e.doc??NP();let n=BP(e,t),r=e._start;for(n!==null&&(r=n.p,t-=n.index);r!==null;r=r.right)if(!r.deleted&&r.countable){if(t<r.length)return r.content.getContent()[t];t-=r.length}},XP=(e,t,n,r)=>{let i=n,a=e.doc,o=a.clientID,s=a.store,c=n===null?t._start:n.right,l=[],u=()=>{l.length>0&&(i=new bI(qN(o,tP(s,o)),i,i&&i.lastId,c,c&&c.id,t,null,new aI(l)),i.integrate(e,0),l=[])};r.forEach(n=>{if(n===null)l.push(n);else switch(n.constructor){case Number:case Object:case Boolean:case Array:case String:l.push(n);break;default:switch(u(),n.constructor){case Uint8Array:case ArrayBuffer:i=new bI(qN(o,tP(s,o)),i,i&&i.lastId,c,c&&c.id,t,null,new GF(new Uint8Array(n))),i.integrate(e,0);break;case mN:i=new bI(qN(o,tP(s,o)),i,i&&i.lastId,c,c&&c.id,t,null,new XF(n)),i.integrate(e,0);break;default:if(n instanceof UP)i=new bI(qN(o,tP(s,o)),i,i&&i.lastId,c,c&&c.id,t,null,new _I(n)),i.integrate(e,0);else throw Error(`Unexpected content type in insert operation`)}}}),u()},ZP=()=>_k(`Length exceeded!`),QP=(e,t,n,r)=>{if(n>t._length)throw ZP();if(n===0)return t._searchMarker&&VP(t._searchMarker,n,r.length),XP(e,t,null,r);let i=n,a=BP(t,n),o=t._start;for(a!==null&&(o=a.p,n-=a.index,n===0&&(o=o.prev,n+=o&&o.countable&&!o.deleted?o.length:0));o!==null;o=o.right)if(!o.deleted&&o.countable){if(n<=o.length){n<o.length&&sP(e,qN(o.id.client,o.id.clock+n));break}n-=o.length}return t._searchMarker&&VP(t._searchMarker,i,r.length),XP(e,t,o,r)},$P=(e,t,n)=>{let r=(t._searchMarker||[]).reduce((e,t)=>t.index>e.index?t:e,{index:0,p:t._start}).p;if(r)for(;r.right;)r=r.right;return XP(e,t,r,n)},eF=(e,t,n,r)=>{if(r===0)return;let i=n,a=r,o=BP(t,n),s=t._start;for(o!==null&&(s=o.p,n-=o.index);s!==null&&n>0;s=s.right)!s.deleted&&s.countable&&(n<s.length&&sP(e,qN(s.id.client,s.id.clock+n)),n-=s.length);for(;r>0&&s!==null;)s.deleted||(r<s.length&&sP(e,qN(s.id.client,s.id.clock+r)),s.delete(e),r-=s.length),s=s.right;if(r>0)throw ZP();t._searchMarker&&VP(t._searchMarker,i,-a+r)},tF=(e,t,n)=>{let r=t._map.get(n);r!==void 0&&r.delete(e)},nF=(e,t,n,r)=>{let i=t._map.get(n)||null,a=e.doc,o=a.clientID,s;if(r==null)s=new aI([r]);else switch(r.constructor){case Number:case Object:case Boolean:case Array:case String:case Date:case BigInt:s=new aI([r]);break;case Uint8Array:s=new GF(r);break;case mN:s=new XF(r);break;default:if(r instanceof UP)s=new _I(r);else throw Error(`Unexpected content type`)}new bI(qN(o,tP(a.store,o)),i,i&&i.lastId,null,null,t,n,s).integrate(e,0)},rF=(e,t)=>{e.doc??NP();let n=e._map.get(t);return n!==void 0&&!n.deleted?n.content.getContent()[n.length-1]:void 0},iF=e=>{let t={};return e.doc??NP(),e._map.forEach((e,n)=>{e.deleted||(t[n]=e.content.getContent()[e.length-1])}),t},aF=(e,t)=>{e.doc??NP();let n=e._map.get(t);return n!==void 0&&!n.deleted},oF=(e,t)=>{let n={};return e._map.forEach((e,r)=>{let i=e;for(;i!==null&&(!t.sv.has(i.id.client)||i.id.clock>=(t.sv.get(i.id.client)||0));)i=i.left;i!==null&&ZN(i,t)&&(n[r]=i.content.getContent()[i.length-1])}),n},sF=e=>(e.doc??NP(),XM(e._map.entries(),e=>!e[1].deleted)),cF=class extends jP{},lF=class e extends UP{constructor(){super(),this._prelimContent=[],this._searchMarker=[]}static from(t){let n=new e;return n.push(t),n}_integrate(e,t){super._integrate(e,t),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new e}clone(){let t=new e;return t.insert(0,this.toArray().map(e=>e instanceof UP?e.clone():e)),t}get length(){return this.doc??NP(),this._length}_callObserver(e,t){super._callObserver(e,t),HP(this,e,new cF(this,e))}insert(e,t){this.doc===null?this._prelimContent.splice(e,0,...t):vP(this.doc,n=>{QP(n,this,e,t)})}push(e){this.doc===null?this._prelimContent.push(...e):vP(this.doc,t=>{$P(t,this,e)})}unshift(e){this.insert(0,e)}delete(e,t=1){this.doc===null?this._prelimContent.splice(e,t):vP(this.doc,n=>{eF(n,this,e,t)})}get(e){return YP(this,e)}toArray(){return GP(this)}slice(e=0,t=this.length){return WP(this,e,t)}toJSON(){return this.map(e=>e instanceof UP?e.toJSON():e)}map(e){return qP(this,e)}forEach(e){KP(this,e)}[Symbol.iterator](){return JP(this)}_write(e){e.writeTypeRef(uI)}},uF=e=>new lF,dF=class extends jP{constructor(e,t,n){super(e,t),this.keysChanged=n}},fF=class e extends UP{constructor(e){super(),this._prelimContent=null,this._prelimContent=e===void 0?new Map:new Map(e)}_integrate(e,t){super._integrate(e,t),this._prelimContent.forEach((e,t)=>{this.set(t,e)}),this._prelimContent=null}_copy(){return new e}clone(){let t=new e;return this.forEach((e,n)=>{t.set(n,e instanceof UP?e.clone():e)}),t}_callObserver(e,t){HP(this,e,new dF(this,e,t))}toJSON(){this.doc??NP();let e={};return this._map.forEach((t,n)=>{if(!t.deleted){let r=t.content.getContent()[t.length-1];e[n]=r instanceof UP?r.toJSON():r}}),e}get size(){return[...sF(this)].length}keys(){return ZM(sF(this),e=>e[0])}values(){return ZM(sF(this),e=>e[1].content.getContent()[e[1].length-1])}entries(){return ZM(sF(this),e=>[e[0],e[1].content.getContent()[e[1].length-1]])}forEach(e){this.doc??NP(),this._map.forEach((t,n)=>{t.deleted||e(t.content.getContent()[t.length-1],n,this)})}[Symbol.iterator](){return this.entries()}delete(e){this.doc===null?this._prelimContent.delete(e):vP(this.doc,t=>{tF(t,this,e)})}set(e,t){return this.doc===null?this._prelimContent.set(e,t):vP(this.doc,n=>{nF(n,this,e,t)}),t}get(e){return rF(this,e)}has(e){return aF(this,e)}clear(){this.doc===null?this._prelimContent.clear():vP(this.doc,e=>{this.forEach(function(t,n,r){tF(e,r,n)})})}_write(e){e.writeTypeRef(dI)}},pF=e=>new fF,mF=(e,t)=>e===t||typeof e==`object`&&typeof t==`object`&&e&&t&&wA(e,t),hF=class{constructor(e,t,n,r){this.left=e,this.right=t,this.index=n,this.currentAttributes=r}forward(){switch(this.right===null&&yk(),this.right.content.constructor){case eI:this.right.deleted||yF(this.currentAttributes,this.right.content);break;default:this.right.deleted||(this.index+=this.right.length)}this.left=this.right,this.right=this.right.right}},gF=(e,t,n)=>{for(;t.right!==null&&n>0;){switch(t.right.content.constructor){case eI:t.right.deleted||yF(t.currentAttributes,t.right.content);break;default:t.right.deleted||(n<t.right.length&&sP(e,qN(t.right.id.client,t.right.id.clock+n)),t.index+=t.right.length,n-=t.right.length)}t.left=t.right,t.right=t.right.right}return t},_F=(e,t,n,r)=>{let i=new Map,a=r?BP(t,n):null;if(a){let t=new hF(a.p.left,a.p,a.index,i);return gF(e,t,n-a.index)}{let r=new hF(null,t._start,0,i);return gF(e,r,n)}},vF=(e,t,n,r)=>{for(;n.right!==null&&(n.right.deleted===!0||n.right.content.constructor===eI&&mF(r.get(n.right.content.key),n.right.content.value));)n.right.deleted||r.delete(n.right.content.key),n.forward();let i=e.doc,a=i.clientID;r.forEach((r,o)=>{let s=n.left,c=n.right,l=new bI(qN(a,tP(i.store,a)),s,s&&s.lastId,c,c&&c.id,t,null,new eI(o,r));l.integrate(e,0),n.right=l,n.forward()})},yF=(e,t)=>{let{key:n,value:r}=t;r===null?e.delete(n):e.set(n,r)},bF=(e,t)=>{for(;e.right!==null&&(e.right.deleted||e.right.content.constructor===eI&&mF(t[e.right.content.key]??null,e.right.content.value));)e.forward()},xF=(e,t,n,r)=>{let i=e.doc,a=i.clientID,o=new Map;for(let s in r){let c=r[s],l=n.currentAttributes.get(s)??null;if(!mF(l,c)){o.set(s,l);let{left:r,right:u}=n;n.right=new bI(qN(a,tP(i.store,a)),r,r&&r.lastId,u,u&&u.id,t,null,new eI(s,c)),n.right.integrate(e,0),n.forward()}}return o},SF=(e,t,n,r,i)=>{n.currentAttributes.forEach((e,t)=>{i[t]===void 0&&(i[t]=null)});let a=e.doc,o=a.clientID;bF(n,i);let s=xF(e,t,n,i),c=r.constructor===String?new sI(r):r instanceof UP?new _I(r):new QF(r),{left:l,right:u,index:d}=n;t._searchMarker&&VP(t._searchMarker,n.index,c.getLength()),u=new bI(qN(o,tP(a.store,o)),l,l&&l.lastId,u,u&&u.id,t,null,c),u.integrate(e,0),n.right=u,n.index=d,n.forward(),vF(e,t,n,s)},CF=(e,t,n,r,i)=>{let a=e.doc,o=a.clientID;bF(n,i);let s=xF(e,t,n,i);iterationLoop:for(;n.right!==null&&(r>0||s.size>0&&(n.right.deleted||n.right.content.constructor===eI));){if(!n.right.deleted)switch(n.right.content.constructor){case eI:{let{key:t,value:a}=n.right.content,o=i[t];if(o!==void 0){if(mF(o,a))s.delete(t);else{if(r===0)break iterationLoop;s.set(t,a)}n.right.delete(e)}else n.currentAttributes.set(t,a);break}default:r<n.right.length&&sP(e,qN(n.right.id.client,n.right.id.clock+r)),r-=n.right.length}n.forward()}if(r>0){let i=``;for(;r>0;r--)i+=`
|
|
989
|
+
`;n.right=new bI(qN(o,tP(a.store,o)),n.left,n.left&&n.left.lastId,n.right,n.right&&n.right.id,t,null,new sI(i)),n.right.integrate(e,0),n.forward()}vF(e,t,n,s)},wF=(e,t,n,r,i)=>{let a=t,o=ZD();for(;a&&(!a.countable||a.deleted);){if(!a.deleted&&a.content.constructor===eI){let e=a.content;o.set(e.key,e)}a=a.right}let s=0,c=!1;for(;t!==a;){if(n===t&&(c=!0),!t.deleted){let n=t.content;switch(n.constructor){case eI:{let{key:a,value:l}=n,u=r.get(a)??null;(o.get(a)!==n||u===l)&&(t.delete(e),s++,!c&&(i.get(a)??null)===l&&u!==l&&(u===null?i.delete(a):i.set(a,u))),!c&&!t.deleted&&yF(i,n);break}}}t=t.right}return s},TF=(e,t)=>{for(;t&&t.right&&(t.right.deleted||!t.right.countable);)t=t.right;let n=new Set;for(;t&&(t.deleted||!t.countable);){if(!t.deleted&&t.content.constructor===eI){let r=t.content.key;n.has(r)?t.delete(e):n.add(r)}t=t.left}},EF=e=>{let t=0;return vP(e.doc,n=>{let r=e._start,i=e._start,a=ZD(),o=QD(a);for(;i;){if(i.deleted===!1)switch(i.content.constructor){case eI:yF(o,i.content);break;default:t+=wF(n,r,i,a,o),a=QD(o),r=i}i=i.right}}),t},DF=e=>{let t=new Set,n=e.doc;for(let[r,i]of e.afterState.entries()){let a=e.beforeState.get(r)||0;i!==a&&uP(e,n.store.clients.get(r),a,i,e=>{!e.deleted&&e.content.constructor===eI&&e.constructor!==WF&&t.add(e.parent)})}vP(n,n=>{nN(e,e.deleteSet,e=>{if(e instanceof WF||!e.parent._hasFormatting||t.has(e.parent))return;let r=e.parent;e.content.constructor===eI?t.add(r):TF(n,e)});for(let e of t)EF(e)})},OF=(e,t,n)=>{let r=n,i=QD(t.currentAttributes),a=t.right;for(;n>0&&t.right!==null;){if(t.right.deleted===!1)switch(t.right.content.constructor){case _I:case QF:case sI:n<t.right.length&&sP(e,qN(t.right.id.client,t.right.id.clock+n)),n-=t.right.length,t.right.delete(e)}t.forward()}a&&wF(e,a,t.right,i,t.currentAttributes);let o=(t.left||t.right).parent;return o._searchMarker&&VP(o._searchMarker,t.index,-r+n),t},kF=class extends jP{constructor(e,t,n){super(e,t),this.childListChanged=!1,this.keysChanged=new Set,n.forEach(e=>{e===null?this.childListChanged=!0:this.keysChanged.add(e)})}get changes(){if(this._changes===null){let e={keys:this.keys,delta:this.delta,added:new Set,deleted:new Set};this._changes=e}return this._changes}get delta(){if(this._delta===null){let e=this.target.doc,t=[];vP(e,e=>{let n=new Map,r=new Map,i=this.target._start,a=null,o={},s=``,c=0,l=0,u=()=>{if(a!==null){let e=null;switch(a){case`delete`:l>0&&(e={delete:l}),l=0;break;case`insert`:(typeof s==`object`||s.length>0)&&(e={insert:s},n.size>0&&(e.attributes={},n.forEach((t,n)=>{t!==null&&(e.attributes[n]=t)}))),s=``;break;case`retain`:c>0&&(e={retain:c},xA(o)||(e.attributes=gA({},o))),c=0}e&&t.push(e),a=null}};for(;i!==null;){switch(i.content.constructor){case _I:case QF:this.adds(i)?this.deletes(i)||(u(),a=`insert`,s=i.content.getContent()[0],u()):this.deletes(i)?(a!==`delete`&&(u(),a=`delete`),l+=1):i.deleted||(a!==`retain`&&(u(),a=`retain`),c+=1);break;case sI:this.adds(i)?this.deletes(i)||(a!==`insert`&&(u(),a=`insert`),s+=i.content.str):this.deletes(i)?(a!==`delete`&&(u(),a=`delete`),l+=i.length):i.deleted||(a!==`retain`&&(u(),a=`retain`),c+=i.length);break;case eI:{let{key:t,value:s}=i.content;if(this.adds(i)){if(!this.deletes(i)){let c=n.get(t)??null;mF(c,s)?s!==null&&i.delete(e):(a===`retain`&&u(),mF(s,r.get(t)??null)?delete o[t]:o[t]=s)}}else if(this.deletes(i)){r.set(t,s);let e=n.get(t)??null;mF(e,s)||(a===`retain`&&u(),o[t]=e)}else if(!i.deleted){r.set(t,s);let n=o[t];n!==void 0&&(mF(n,s)?n!==null&&i.delete(e):(a===`retain`&&u(),s===null?delete o[t]:o[t]=s))}i.deleted||(a===`insert`&&u(),yF(n,i.content));break}}i=i.right}for(u();t.length>0;){let e=t[t.length-1];if(e.retain!==void 0&&e.attributes===void 0)t.pop();else break}}),this._delta=t}return this._delta}},AF=class e extends UP{constructor(e){super(),this._pending=e===void 0?[]:[()=>this.insert(0,e)],this._searchMarker=[],this._hasFormatting=!1}get length(){return this.doc??NP(),this._length}_integrate(e,t){super._integrate(e,t);try{this._pending.forEach(e=>e())}catch(e){console.error(e)}this._pending=null}_copy(){return new e}clone(){let t=new e;return t.applyDelta(this.toDelta()),t}_callObserver(e,t){super._callObserver(e,t);let n=new kF(this,e,t);HP(this,e,n),!e.local&&this._hasFormatting&&(e._needFormattingCleanup=!0)}toString(){this.doc??NP();let e=``,t=this._start;for(;t!==null;)!t.deleted&&t.countable&&t.content.constructor===sI&&(e+=t.content.str),t=t.right;return e}toJSON(){return this.toString()}applyDelta(e,{sanitize:t=!0}={}){this.doc===null?this._pending.push(()=>this.applyDelta(e)):vP(this.doc,n=>{let r=new hF(null,this._start,0,new Map);for(let i=0;i<e.length;i++){let a=e[i];if(a.insert!==void 0){let o=!t&&typeof a.insert==`string`&&i===e.length-1&&r.right===null&&a.insert.slice(-1)===`
|
|
990
|
+
`?a.insert.slice(0,-1):a.insert;(typeof o!=`string`||o.length>0)&&SF(n,this,r,o,a.attributes||{})}else a.retain===void 0?a.delete!==void 0&&OF(n,r,a.delete):CF(n,this,r,a.retain,a.attributes||{})}})}toDelta(e,t,n){this.doc??NP();let r=[],i=new Map,a=this.doc,o=``,s=this._start;function c(){if(o.length>0){let e={},t=!1;i.forEach((n,r)=>{t=!0,e[r]=n});let n={insert:o};t&&(n.attributes=e),r.push(n),o=``}}let l=()=>{for(;s!==null;){if(ZN(s,e)||t!==void 0&&ZN(s,t))switch(s.content.constructor){case sI:{let r=i.get(`ychange`);e!==void 0&&!ZN(s,e)?(r===void 0||r.user!==s.id.client||r.type!==`removed`)&&(c(),i.set(`ychange`,n?n(`removed`,s.id):{type:`removed`})):t!==void 0&&!ZN(s,t)?(r===void 0||r.user!==s.id.client||r.type!==`added`)&&(c(),i.set(`ychange`,n?n(`added`,s.id):{type:`added`})):r!==void 0&&(c(),i.delete(`ychange`)),o+=s.content.str;break}case _I:case QF:{c();let e={insert:s.content.getContent()[0]};if(i.size>0){let t={};e.attributes=t,i.forEach((e,n)=>{t[n]=e})}r.push(e);break}case eI:ZN(s,e)&&(c(),yF(i,s.content))}s=s.right}c()};return e||t?vP(a,n=>{e&&QN(n,e),t&&QN(n,t),l()},`cleanup`):l(),r}insert(e,t,n){if(t.length<=0)return;let r=this.doc;r===null?this._pending.push(()=>this.insert(e,t,n)):vP(r,r=>{let i=_F(r,this,e,!n);n||(n={},i.currentAttributes.forEach((e,t)=>{n[t]=e})),SF(r,this,i,t,n)})}insertEmbed(e,t,n){let r=this.doc;r===null?this._pending.push(()=>this.insertEmbed(e,t,n||{})):vP(r,r=>{let i=_F(r,this,e,!n);SF(r,this,i,t,n||{})})}delete(e,t){if(t===0)return;let n=this.doc;n===null?this._pending.push(()=>this.delete(e,t)):vP(n,n=>{OF(n,_F(n,this,e,!0),t)})}format(e,t,n){if(t===0)return;let r=this.doc;r===null?this._pending.push(()=>this.format(e,t,n)):vP(r,r=>{let i=_F(r,this,e,!1);i.right!==null&&CF(r,this,i,t,n)})}removeAttribute(e){this.doc===null?this._pending.push(()=>this.removeAttribute(e)):vP(this.doc,t=>{tF(t,this,e)})}setAttribute(e,t){this.doc===null?this._pending.push(()=>this.setAttribute(e,t)):vP(this.doc,n=>{nF(n,this,e,t)})}getAttribute(e){return rF(this,e)}getAttributes(){return iF(this)}_write(e){e.writeTypeRef(fI)}},jF=e=>new AF,MF=class{constructor(e,t=()=>!0){this._filter=t,this._root=e,this._currentNode=e._start,this._firstCall=!0,e.doc??NP()}[Symbol.iterator](){return this}next(){let e=this._currentNode,t=e&&e.content&&e.content.type;if(e!==null&&(!this._firstCall||e.deleted||!this._filter(t)))do if(t=e.content.type,!e.deleted&&(t.constructor===FF||t.constructor===NF)&&t._start!==null)e=t._start;else for(;e!==null;){let t=e.next;if(t!==null){e=t;break}e=e.parent===this._root?null:e.parent._item}while(e!==null&&(e.deleted||!this._filter(e.content.type)));return this._firstCall=!1,e===null?{value:void 0,done:!0}:(this._currentNode=e,{value:e.content.type,done:!1})}},NF=class e extends UP{constructor(){super(),this._prelimContent=[]}get firstChild(){let e=this._first;return e?e.content.getContent()[0]:null}_integrate(e,t){super._integrate(e,t),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new e}clone(){let t=new e;return t.insert(0,this.toArray().map(e=>e instanceof UP?e.clone():e)),t}get length(){return this.doc??NP(),this._prelimContent===null?this._length:this._prelimContent.length}createTreeWalker(e){return new MF(this,e)}querySelector(e){e=e.toUpperCase();let t=new MF(this,t=>t.nodeName&&t.nodeName.toUpperCase()===e).next();return t.done?null:t.value}querySelectorAll(e){return e=e.toUpperCase(),sO(new MF(this,t=>t.nodeName&&t.nodeName.toUpperCase()===e))}_callObserver(e,t){HP(this,e,new LF(this,t,e))}toString(){return qP(this,e=>e.toString()).join(``)}toJSON(){return this.toString()}toDOM(e=document,t={},n){let r=e.createDocumentFragment();return n!==void 0&&n._createAssociation(r,this),KP(this,i=>{r.insertBefore(i.toDOM(e,t,n),null)}),r}insert(e,t){this.doc===null?this._prelimContent.splice(e,0,...t):vP(this.doc,n=>{QP(n,this,e,t)})}insertAfter(e,t){if(this.doc!==null)vP(this.doc,n=>{let r=e&&e instanceof UP?e._item:e;XP(n,this,r,t)});else{let n=this._prelimContent,r=e===null?0:n.findIndex(t=>t===e)+1;if(r===0&&e!==null)throw _k(`Reference item not found`);n.splice(r,0,...t)}}delete(e,t=1){this.doc===null?this._prelimContent.splice(e,t):vP(this.doc,n=>{eF(n,this,e,t)})}toArray(){return GP(this)}push(e){this.insert(this.length,e)}unshift(e){this.insert(0,e)}get(e){return YP(this,e)}slice(e=0,t=this.length){return WP(this,e,t)}forEach(e){KP(this,e)}_write(e){e.writeTypeRef(mI)}},PF=e=>new NF,FF=class e extends NF{constructor(e=`UNDEFINED`){super(),this.nodeName=e,this._prelimAttrs=new Map}get nextSibling(){let e=this._item?this._item.next:null;return e?e.content.type:null}get prevSibling(){let e=this._item?this._item.prev:null;return e?e.content.type:null}_integrate(e,t){super._integrate(e,t),this._prelimAttrs.forEach((e,t)=>{this.setAttribute(t,e)}),this._prelimAttrs=null}_copy(){return new e(this.nodeName)}clone(){let t=new e(this.nodeName),n=this.getAttributes();return vA(n,(e,n)=>{t.setAttribute(n,e)}),t.insert(0,this.toArray().map(e=>e instanceof UP?e.clone():e)),t}toString(){let e=this.getAttributes(),t=[],n=[];for(let t in e)n.push(t);n.sort();let r=n.length;for(let i=0;i<r;i++){let r=n[i];t.push(r+`="`+e[r]+`"`)}let i=this.nodeName.toLocaleLowerCase();return`<${i}${t.length>0?` `+t.join(` `):``}>${super.toString()}</${i}>`}removeAttribute(e){this.doc===null?this._prelimAttrs.delete(e):vP(this.doc,t=>{tF(t,this,e)})}setAttribute(e,t){this.doc===null?this._prelimAttrs.set(e,t):vP(this.doc,n=>{nF(n,this,e,t)})}getAttribute(e){return rF(this,e)}hasAttribute(e){return aF(this,e)}getAttributes(e){return e?oF(this,e):iF(this)}toDOM(e=document,t={},n){let r=e.createElement(this.nodeName),i=this.getAttributes();for(let e in i){let t=i[e];typeof t==`string`&&r.setAttribute(e,t)}return KP(this,i=>{r.appendChild(i.toDOM(e,t,n))}),n!==void 0&&n._createAssociation(r,this),r}_write(e){e.writeTypeRef(pI),e.writeKey(this.nodeName)}},IF=e=>new FF(e.readKey()),LF=class extends jP{constructor(e,t,n){super(e,n),this.childListChanged=!1,this.attributesChanged=new Set,t.forEach(e=>{e===null?this.childListChanged=!0:this.attributesChanged.add(e)})}},RF=class e extends fF{constructor(e){super(),this.hookName=e}_copy(){return new e(this.hookName)}clone(){let t=new e(this.hookName);return this.forEach((e,n)=>{t.set(n,e)}),t}toDOM(e=document,t={},n){let r=t[this.hookName],i;return i=r===void 0?document.createElement(this.hookName):r.createDom(this),i.setAttribute(`data-yjs-hook`,this.hookName),n!==void 0&&n._createAssociation(i,this),i}_write(e){e.writeTypeRef(hI),e.writeKey(this.hookName)}},zF=e=>new RF(e.readKey()),BF=class e extends AF{get nextSibling(){let e=this._item?this._item.next:null;return e?e.content.type:null}get prevSibling(){let e=this._item?this._item.prev:null;return e?e.content.type:null}_copy(){return new e}clone(){let t=new e;return t.applyDelta(this.toDelta()),t}toDOM(e=document,t,n){let r=e.createTextNode(this.toString());return n!==void 0&&n._createAssociation(r,this),r}toString(){return this.toDelta().map(e=>{let t=[];for(let n in e.attributes){let r=[];for(let t in e.attributes[n])r.push({key:t,value:e.attributes[n][t]});r.sort((e,t)=>e.key<t.key?-1:1),t.push({nodeName:n,attrs:r})}t.sort((e,t)=>e.nodeName<t.nodeName?-1:1);let n=``;for(let e=0;e<t.length;e++){let r=t[e];n+=`<${r.nodeName}`;for(let e=0;e<r.attrs.length;e++){let t=r.attrs[e];n+=` ${t.key}="${t.value}"`}n+=`>`}n+=e.insert;for(let e=t.length-1;e>=0;e--)n+=`</${t[e].nodeName}>`;return n}).join(``)}toJSON(){return this.toString()}_write(e){e.writeTypeRef(gI)}},VF=e=>new BF,HF=class{constructor(e,t){this.id=e,this.length=t}get deleted(){throw vk()}mergeWith(e){return!1}write(e,t,n){throw vk()}integrate(e,t){throw vk()}},UF=0,WF=class extends HF{get deleted(){return!0}delete(){}mergeWith(e){return this.constructor===e.constructor&&(this.length+=e.length,!0)}integrate(e,t){t>0&&(this.id.clock+=t,this.length-=t),nP(e.doc.store,this)}write(e,t){e.writeInfo(UF),e.writeLen(this.length-t)}getMissing(e,t){return null}},GF=class e{constructor(e){this.content=e}getLength(){return 1}getContent(){return[this.content]}isCountable(){return!0}copy(){return new e(this.content)}splice(e){throw vk()}mergeWith(e){return!1}integrate(e,t){}delete(e){}gc(e){}write(e,t){e.writeBuf(this.content)}getRef(){return 3}},KF=e=>new GF(e.readBuf()),qF=class e{constructor(e){this.len=e}getLength(){return this.len}getContent(){return[]}isCountable(){return!1}copy(){return new e(this.len)}splice(t){let n=new e(this.len-t);return this.len=t,n}mergeWith(e){return this.len+=e.len,!0}integrate(e,t){sN(e.deleteSet,t.id.client,t.id.clock,this.len),t.markDeleted()}delete(e){}gc(e){}write(e,t){e.writeLen(this.len-t)}getRef(){return 1}},JF=e=>new qF(e.readLen()),YF=(e,t)=>new mN({guid:e,...t,shouldLoad:t.shouldLoad||t.autoLoad||!1}),XF=class e{constructor(e){e._item&&console.error(`This document was already integrated as a sub-document. You should create a second instance instead with the same guid.`),this.doc=e;let t={};this.opts=t,e.gc||(t.gc=!1),e.autoLoad&&(t.autoLoad=!0),e.meta!==null&&(t.meta=e.meta)}getLength(){return 1}getContent(){return[this.doc]}isCountable(){return!0}copy(){return new e(YF(this.doc.guid,this.opts))}splice(e){throw vk()}mergeWith(e){return!1}integrate(e,t){this.doc._item=t,e.subdocsAdded.add(this.doc),this.doc.shouldLoad&&e.subdocsLoaded.add(this.doc)}delete(e){e.subdocsAdded.has(this.doc)?e.subdocsAdded.delete(this.doc):e.subdocsRemoved.add(this.doc)}gc(e){}write(e,t){e.writeString(this.doc.guid),e.writeAny(this.opts)}getRef(){return 9}},ZF=e=>new XF(YF(e.readString(),e.readAny())),QF=class e{constructor(e){this.embed=e}getLength(){return 1}getContent(){return[this.embed]}isCountable(){return!0}copy(){return new e(this.embed)}splice(e){throw vk()}mergeWith(e){return!1}integrate(e,t){}delete(e){}gc(e){}write(e,t){e.writeJSON(this.embed)}getRef(){return 5}},$F=e=>new QF(e.readJSON()),eI=class e{constructor(e,t){this.key=e,this.value=t}getLength(){return 1}getContent(){return[]}isCountable(){return!1}copy(){return new e(this.key,this.value)}splice(e){throw vk()}mergeWith(e){return!1}integrate(e,t){let n=t.parent;n._searchMarker=null,n._hasFormatting=!0}delete(e){}gc(e){}write(e,t){e.writeKey(this.key),e.writeJSON(this.value)}getRef(){return 6}},tI=e=>new eI(e.readKey(),e.readJSON()),nI=class e{constructor(e){this.arr=e}getLength(){return this.arr.length}getContent(){return this.arr}isCountable(){return!0}copy(){return new e(this.arr)}splice(t){let n=new e(this.arr.slice(t));return this.arr=this.arr.slice(0,t),n}mergeWith(e){return this.arr=this.arr.concat(e.arr),!0}integrate(e,t){}delete(e){}gc(e){}write(e,t){let n=this.arr.length;e.writeLen(n-t);for(let r=t;r<n;r++){let t=this.arr[r];e.writeString(t===void 0?`undefined`:JSON.stringify(t))}}getRef(){return 2}},rI=e=>{let t=e.readLen(),n=[];for(let r=0;r<t;r++){let t=e.readString();t===`undefined`?n.push(void 0):n.push(JSON.parse(t))}return new nI(n)},iI=zA(`node_env`)===`development`,aI=class e{constructor(e){this.arr=e,iI&&EA(e)}getLength(){return this.arr.length}getContent(){return this.arr}isCountable(){return!0}copy(){return new e(this.arr)}splice(t){let n=new e(this.arr.slice(t));return this.arr=this.arr.slice(0,t),n}mergeWith(e){return this.arr=this.arr.concat(e.arr),!0}integrate(e,t){}delete(e){}gc(e){}write(e,t){let n=this.arr.length;e.writeLen(n-t);for(let r=t;r<n;r++){let t=this.arr[r];e.writeAny(t)}}getRef(){return 8}},oI=e=>{let t=e.readLen(),n=[];for(let r=0;r<t;r++)n.push(e.readAny());return new aI(n)},sI=class e{constructor(e){this.str=e}getLength(){return this.str.length}getContent(){return this.str.split(``)}isCountable(){return!0}copy(){return new e(this.str)}splice(t){let n=new e(this.str.slice(t));this.str=this.str.slice(0,t);let r=this.str.charCodeAt(t-1);return r>=55296&&r<=56319&&(this.str=this.str.slice(0,t-1)+`�`,n.str=`�`+n.str.slice(1)),n}mergeWith(e){return this.str+=e.str,!0}integrate(e,t){}delete(e){}gc(e){}write(e,t){e.writeString(t===0?this.str:this.str.slice(t))}getRef(){return 4}},cI=e=>new sI(e.readString()),lI=[uF,pF,jF,IF,PF,zF,VF],uI=0,dI=1,fI=2,pI=3,mI=4,hI=5,gI=6,_I=class e{constructor(e){this.type=e}getLength(){return 1}getContent(){return[this.type]}isCountable(){return!0}copy(){return new e(this.type._copy())}splice(e){throw vk()}mergeWith(e){return!1}integrate(e,t){this.type._integrate(e.doc,t)}delete(e){let t=this.type._start;for(;t!==null;)t.deleted?t.id.clock<(e.beforeState.get(t.id.client)||0)&&e._mergeStructs.push(t):t.delete(e),t=t.right;this.type._map.forEach(t=>{t.deleted?t.id.clock<(e.beforeState.get(t.id.client)||0)&&e._mergeStructs.push(t):t.delete(e)}),e.changed.delete(this.type)}gc(e){let t=this.type._start;for(;t!==null;)t.gc(e,!0),t=t.right;this.type._start=null,this.type._map.forEach(t=>{for(;t!==null;)t.gc(e,!0),t=t.left}),this.type._map=new Map}write(e,t){this.type._write(e)}getRef(){return 7}},vI=e=>new _I(lI[e.readTypeRef()](e)),yI=(e,t,n)=>{let{client:r,clock:i}=t.id,a=new bI(qN(r,i+n),t,qN(r,i+n-1),t.right,t.rightOrigin,t.parent,t.parentSub,t.content.splice(n));return t.deleted&&a.markDeleted(),t.keep&&(a.keep=!0),t.redone!==null&&(a.redone=qN(t.redone.client,t.redone.clock+n)),t.right=a,a.right!==null&&(a.right.left=a),e._mergeStructs.push(a),a.parentSub!==null&&a.right===null&&a.parent._map.set(a.parentSub,a),t.length=n,a},bI=class e extends HF{constructor(e,t,n,r,i,a,o,s){super(e,s.getLength()),this.origin=n,this.left=t,this.right=r,this.rightOrigin=i,this.parent=a,this.parentSub=o,this.redone=null,this.content=s,this.info=this.content.isCountable()?2:0}set marker(e){(this.info&8)>0!==e&&(this.info^=8)}get marker(){return(this.info&8)>0}get keep(){return(this.info&1)>0}set keep(e){this.keep!==e&&(this.info^=1)}get countable(){return(this.info&2)>0}get deleted(){return(this.info&4)>0}set deleted(e){this.deleted!==e&&(this.info^=4)}markDeleted(){this.info|=4}getMissing(t,n){if(this.origin&&this.origin.client!==this.id.client&&this.origin.clock>=tP(n,this.origin.client))return this.origin.client;if(this.rightOrigin&&this.rightOrigin.client!==this.id.client&&this.rightOrigin.clock>=tP(n,this.rightOrigin.client))return this.rightOrigin.client;if(this.parent&&this.parent.constructor===GN&&this.id.client!==this.parent.client&&this.parent.clock>=tP(n,this.parent.client))return this.parent.client;if(this.origin&&=(this.left=cP(t,n,this.origin),this.left.lastId),this.rightOrigin&&=(this.right=sP(t,this.rightOrigin),this.right.id),this.left&&this.left.constructor===WF||this.right&&this.right.constructor===WF)this.parent=null;else if(!this.parent)this.left&&this.left.constructor===e?(this.parent=this.left.parent,this.parentSub=this.left.parentSub):this.right&&this.right.constructor===e&&(this.parent=this.right.parent,this.parentSub=this.right.parentSub);else if(this.parent.constructor===GN){let e=aP(n,this.parent);this.parent=e.constructor===WF?null:e.content.type}return null}integrate(e,t){if(t>0&&(this.id.clock+=t,this.left=cP(e,e.doc.store,qN(this.id.client,this.id.clock-1)),this.origin=this.left.lastId,this.content=this.content.splice(t),this.length-=t),this.parent){if(!this.left&&(!this.right||this.right.left!==null)||this.left&&this.left.right!==this.right){let t=this.left,n;if(t!==null)n=t.right;else if(this.parentSub!==null)for(n=this.parent._map.get(this.parentSub)||null;n!==null&&n.left!==null;)n=n.left;else n=this.parent._start;let r=new Set,i=new Set;for(;n!==null&&n!==this.right;){if(i.add(n),r.add(n),KN(this.origin,n.origin)){if(n.id.client<this.id.client)t=n,r.clear();else if(KN(this.rightOrigin,n.rightOrigin))break}else if(n.origin!==null&&i.has(aP(e.doc.store,n.origin)))r.has(aP(e.doc.store,n.origin))||(t=n,r.clear());else break;n=n.right}this.left=t}if(this.left!==null){let e=this.left.right;this.right=e,this.left.right=this}else{let e;if(this.parentSub!==null)for(e=this.parent._map.get(this.parentSub)||null;e!==null&&e.left!==null;)e=e.left;else e=this.parent._start,this.parent._start=this;this.right=e}this.right===null?this.parentSub!==null&&(this.parent._map.set(this.parentSub,this),this.left!==null&&this.left.delete(e)):this.right.left=this,this.parentSub===null&&this.countable&&!this.deleted&&(this.parent._length+=this.length),nP(e.doc.store,this),this.content.integrate(e,this),pP(e,this.parent,this.parentSub),(this.parent._item!==null&&this.parent._item.deleted||this.parentSub!==null&&this.right!==null)&&this.delete(e)}else new WF(this.id,this.length).integrate(e,0)}get next(){let e=this.right;for(;e!==null&&e.deleted;)e=e.right;return e}get prev(){let e=this.left;for(;e!==null&&e.deleted;)e=e.left;return e}get lastId(){return this.length===1?this.id:qN(this.id.client,this.id.clock+this.length-1)}mergeWith(e){if(this.constructor===e.constructor&&KN(e.origin,this.lastId)&&this.right===e&&KN(this.rightOrigin,e.rightOrigin)&&this.id.client===e.id.client&&this.id.clock+this.length===e.id.clock&&this.deleted===e.deleted&&this.redone===null&&e.redone===null&&this.content.constructor===e.content.constructor&&this.content.mergeWith(e.content)){let t=this.parent._searchMarker;return t&&t.forEach(t=>{t.p===e&&(t.p=this,!this.deleted&&this.countable&&(t.index-=this.length))}),e.keep&&(this.keep=!0),this.right=e.right,this.right!==null&&(this.right.left=this),this.length+=e.length,!0}return!1}delete(e){if(!this.deleted){let t=this.parent;this.countable&&this.parentSub===null&&(t._length-=this.length),this.markDeleted(),sN(e.deleteSet,this.id.client,this.id.clock,this.length),pP(e,t,this.parentSub),this.content.delete(e)}}gc(e,t){if(!this.deleted)throw yk();this.content.gc(e),t?lP(e,this,new WF(this.id,this.length)):this.content=new qF(this.length)}write(e,t){let n=t>0?qN(this.id.client,this.id.clock+t-1):this.origin,r=this.rightOrigin,i=this.parentSub,a=this.content.getRef()&31|(n===null?0:128)|(r===null?0:64)|(i===null?0:32);if(e.writeInfo(a),n!==null&&e.writeLeftID(n),r!==null&&e.writeRightID(r),n===null&&r===null){let t=this.parent;if(t._item!==void 0){let n=t._item;if(n===null){let n=JN(t);e.writeParentInfo(!0),e.writeString(n)}else e.writeParentInfo(!1),e.writeLeftID(n.id)}else t.constructor===String?(e.writeParentInfo(!0),e.writeString(t)):t.constructor===GN?(e.writeParentInfo(!1),e.writeLeftID(t)):yk();i!==null&&e.writeString(i)}this.content.write(e,t)}},xI=(e,t)=>SI[t&31](e),SI=[()=>{yk()},JF,rI,KF,cI,$F,tI,vI,oI,ZF,()=>{yk()}],CI=10,wI=class extends HF{get deleted(){return!0}delete(){}mergeWith(e){return this.constructor===e.constructor&&(this.length+=e.length,!0)}integrate(e,t){yk()}write(e,t){e.writeInfo(CI),JO(e.restEncoder,this.length-t)}getMissing(e,t){return null}},TI=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof global<`u`?global:{},EI=`__ $YJS$ __`,TI[EI]===!0&&console.error(`Yjs was already imported. This breaks constructor checks and will lead to issues! - https://github.com/yjs/yjs/issues/438`),TI[EI]=!0})),OI,kI,AI,jI,MI,NI,PI,FI=s((()=>{nO(),iO(),ej(),dA(),OI=new Map,kI=class{constructor(e){this.room=e,this.onmessage=null,this._onChange=t=>t.key===e&&this.onmessage!==null&&this.onmessage({data:QA(t.newValue||``)}),lA(this._onChange)}postMessage(e){cA.setItem(this.room,ZA(KA(e)))}close(){uA(this._onChange)}},AI=typeof BroadcastChannel>`u`?kI:BroadcastChannel,jI=e=>$D(OI,e,()=>{let t=rO(),n=new AI(e);return n.onmessage=e=>t.forEach(t=>t(e.data,`broadcastchannel`)),{bc:n,subs:t}}),MI=(e,t)=>(jI(e).subs.add(t),t),NI=(e,t)=>{let n=jI(e),r=n.subs.delete(t);return r&&n.subs.size===0&&(n.bc.close(),OI.delete(e)),r},PI=(e,t,n=null)=>{let r=jI(e);r.bc.postMessage(t),r.subs.forEach(e=>e(t,n))}})),II,LI,RI,zI,BI,VI,HI,UI=s((()=>{gk(),Kk(),DI(),II=(e,t)=>{JO(e,0);let n=zN(t);nk(e,n)},LI=(e,t,n)=>{JO(e,1),nk(e,NN(t,n))},RI=(e,t,n)=>LI(t,n,kk(e)),zI=(e,t,n,r)=>{try{AN(t,kk(e),n)}catch(e){r?.(e),console.error(`Caught error while handling a Yjs update`,e)}},BI=(e,t)=>{JO(e,2),nk(e,t)},VI=zI,HI=(e,t,n,r,i)=>{let a=jk(e);switch(a){case 0:RI(e,t,n);break;case 1:zI(e,n,r,i);break;case 2:VI(e,n,r,i);break;default:throw Error(`Unknown message type`)}return a}})),WI,GI=s((()=>{Kk(),WI=(e,t,n)=>{jk(e)===0&&n(t,Fk(e))}})),KI,qI,JI,YI,XI,ZI=s((()=>{gk(),Kk(),eA(),SO(),hO(),MA(),KI=3e4,qI=class extends mO{constructor(e){super(),this.doc=e,this.clientID=e.clientID,this.states=new Map,this.meta=new Map,this._checkInterval=setInterval(()=>{let e=$k();this.getLocalState()!==null&&15e3<=e-this.meta.get(this.clientID).lastUpdated&&this.setLocalState(this.getLocalState());let t=[];this.meta.forEach((n,r)=>{r!==this.clientID&&3e4<=e-n.lastUpdated&&this.states.has(r)&&t.push(r)}),t.length>0&&JI(this,t,`timeout`)},gO(KI/10)),e.on(`destroy`,()=>{this.destroy()}),this.setLocalState({})}destroy(){this.emit(`destroy`,[this]),this.setLocalState(null),super.destroy(),clearInterval(this._checkInterval)}getLocalState(){return this.states.get(this.clientID)||null}setLocalState(e){let t=this.clientID,n=this.meta.get(t),r=n===void 0?0:n.clock+1,i=this.states.get(t);e===null?this.states.delete(t):this.states.set(t,e),this.meta.set(t,{clock:r,lastUpdated:$k()});let a=[],o=[],s=[],c=[];e===null?c.push(t):i==null?e!=null&&a.push(t):(o.push(t),AA(i,e)||s.push(t)),(a.length>0||s.length>0||c.length>0)&&this.emit(`change`,[{added:a,updated:s,removed:c},`local`]),this.emit(`update`,[{added:a,updated:o,removed:c},`local`])}setLocalStateField(e,t){let n=this.getLocalState();n!==null&&this.setLocalState({...n,[e]:t})}getStates(){return this.states}},JI=(e,t,n)=>{let r=[];for(let n=0;n<t.length;n++){let i=t[n];if(e.states.has(i)){if(e.states.delete(i),i===e.clientID){let t=e.meta.get(i);e.meta.set(i,{clock:t.clock+1,lastUpdated:$k()})}r.push(i)}}r.length>0&&(e.emit(`change`,[{added:[],updated:[],removed:r},n]),e.emit(`update`,[{added:[],updated:[],removed:r},n]))},YI=(e,t,n=e.states)=>{let r=t.length,i=HO();JO(i,r);for(let a=0;a<r;a++){let r=t[a],o=n.get(r)||null,s=e.meta.get(r).clock;JO(i,r),JO(i,s),ek(i,JSON.stringify(o))}return WO(i)},XI=(e,t,n)=>{let r=Ek(t),i=$k(),a=[],o=[],s=[],c=[],l=jk(r);for(let t=0;t<l;t++){let t=jk(r),n=jk(r),l=JSON.parse(Fk(r)),u=e.meta.get(t),d=e.states.get(t),f=u===void 0?0:u.clock;(f<n||f===n&&l===null&&e.states.has(t))&&(l===null?t===e.clientID&&e.getLocalState()!=null?n++:e.states.delete(t):e.states.set(t,l),e.meta.set(t,{clock:n,lastUpdated:i}),u===void 0&&l!==null?a.push(t):u!==void 0&&l===null?c.push(t):l!==null&&(AA(l,d)||s.push(t),o.push(t)))}(a.length>0||s.length>0||c.length>0)&&e.emit(`change`,[{added:a,updated:s,removed:c},n]),(a.length>0||o.length>0||c.length>0)&&e.emit(`update`,[{added:a,updated:o,removed:c},n])}})),QI,$I=s((()=>{DA(),QI=e=>yA(e,(e,t)=>`${encodeURIComponent(t)}=${encodeURIComponent(e)}`).join(`&`)})),eL,tL,nL,rL,iL,aL,oL,sL,cL,lL=s((()=>{FI(),eA(),gk(),Kk(),UI(),GI(),ZI(),hO(),SO(),$I(),WA(),eL=[],eL[0]=(e,t,n,r,i)=>{JO(e,0);let a=HI(t,e,n.doc,n);r&&a===1&&!n.synced&&(n.synced=!0)},eL[3]=(e,t,n,r,i)=>{JO(e,1),nk(e,YI(n.awareness,Array.from(n.awareness.getStates().keys())))},eL[1]=(e,t,n,r,i)=>{XI(n.awareness,kk(t),n)},eL[2]=(e,t,n,r,i)=>{WI(t,n.doc,(e,t)=>nL(n,t))},tL=3e4,nL=(e,t)=>console.warn(`Permission denied to access ${e.url}.\n${t}`),rL=(e,t,n)=>{let r=Ek(t),i=HO(),a=jk(r),o=e.messageHandlers[a];return o?o(i,r,e,n,a):console.error(`Unable to compute message`),i},iL=e=>!(e.code>=4400&&e.code<4500),aL=(e,t,n)=>{if(t!==null&&t===e.ws){e.emit(`connection-close`,[n,e]),e.ws=null,t.onmessage=null,t.onopen=null,t.onclose=null,t.onerror=()=>{},t.close(),e.wsconnecting=!1,e.wsconnected&&(e.wsconnected=!1,e.synced=!1,JI(e.awareness,Array.from(e.awareness.getStates().keys()).filter(t=>t!==e.doc.clientID),e),e.emit(`status`,[{status:`disconnected`}])),e.wsUnsuccessfulReconnects++;let r=null;n!=null&&!e.shouldReconnect(n,e)&&(e.shouldConnect=!1,r={code:n.code,reason:n.reason}),setTimeout(oL,vO(bO(2,e.wsUnsuccessfulReconnects)*100,e.maxBackoffTime),e),r!==null&&e.emit(`closed`,[r,e])}},oL=e=>{if(e.shouldConnect&&e.ws===null){let t=new e._WS(e.url,e.protocols);t.binaryType=`arraybuffer`,e.ws=t,e.wsconnecting=!0,e.wsconnected=!1,e.synced=!1,t.onmessage=n=>{if(e.ws!==t)return;e.wsLastMessageReceived=$k();let r=rL(e,new Uint8Array(n.data),!0);UO(r)>1&&t.send(WO(r))},t.onerror=n=>{e.ws===t&&e.emit(`connection-error`,[n,e])},t.onclose=n=>{aL(e,t,n)},t.onopen=()=>{if(e.ws!==t)return;e.wsLastMessageReceived=$k(),e.wsconnecting=!1,e.wsconnected=!0,e.emit(`status`,[{status:`connected`}]);let n=HO();if(JO(n,0),II(n,e.doc),t.send(WO(n)),e.awareness.getLocalState()!==null){let n=HO();JO(n,1),nk(n,YI(e.awareness,[e.doc.clientID])),t.send(WO(n))}},e.emit(`status`,[{status:`connecting`}])}},sL=(e,t)=>{let n=e.ws;e.wsconnected&&n&&n.readyState===n.OPEN&&n.send(t),e.bcconnected&&PI(e.bcChannel,t,e)},cL=class extends pO{constructor(e,t,n,{connect:r=!0,awareness:i=new qI(n),params:a={},protocols:o=[],WebSocketPolyfill:s=WebSocket,resyncInterval:c=-1,maxBackoffTime:l=2500,disableBc:u=!1,shouldReconnect:d=iL}={}){for(super();e[e.length-1]===`/`;)e=e.slice(0,e.length-1);this.serverUrl=e,this.bcChannel=e+`/`+t,this.maxBackoffTime=l,this.shouldReconnect=d,this.params=a,this.protocols=o,this.roomname=t,this.doc=n,this._WS=s,this.awareness=i,this.wsconnected=!1,this.wsconnecting=!1,this.bcconnected=!1,this.disableBc=u,this.wsUnsuccessfulReconnects=0,this.messageHandlers=eL.slice(),this._synced=!1,this.ws=null,this.wsLastMessageReceived=0,this.shouldConnect=r,this._resyncInterval=0,c>0&&(this._resyncInterval=setInterval(()=>{if(this.ws&&this.ws.readyState===WebSocket.OPEN){let e=HO();JO(e,0),II(e,n),this.ws.send(WO(e))}},c)),this._bcSubscriber=(e,t)=>{if(t!==this){let t=rL(this,new Uint8Array(e),!1);UO(t)>1&&PI(this.bcChannel,WO(t),this)}},this._updateHandler=(e,t)=>{if(t!==this){let t=HO();JO(t,0),BI(t,e),sL(this,WO(t))}},this.doc.on(`update`,this._updateHandler),this._awarenessUpdateHandler=({added:e,updated:t,removed:n},r)=>{let a=e.concat(t).concat(n),o=HO();JO(o,1),nk(o,YI(i,a)),sL(this,WO(o))},this._exitHandler=()=>{JI(this.awareness,[n.clientID],`app closed`)},NA&&typeof process<`u`&&process.on(`exit`,this._exitHandler),i.on(`update`,this._awarenessUpdateHandler),this._checkInterval=setInterval(()=>{this.wsconnected&&tL<$k()-this.wsLastMessageReceived&&aL(this,this.ws,null)},tL/10),r&&this.connect()}get url(){let e=QI(this.params);return this.serverUrl+`/`+this.roomname+(e.length===0?``:`?`+e)}get synced(){return this._synced}set synced(e){this._synced!==e&&(this._synced=e,e&&(this.wsUnsuccessfulReconnects=0),this.emit(`synced`,[e]),this.emit(`sync`,[e]))}destroy(){this._resyncInterval!==0&&clearInterval(this._resyncInterval),clearInterval(this._checkInterval),this.disconnect(),NA&&typeof process<`u`&&process.off(`exit`,this._exitHandler),this.awareness.off(`update`,this._awarenessUpdateHandler),this.doc.off(`update`,this._updateHandler),super.destroy()}connectBc(){if(this.disableBc)return;this.bcconnected||=(MI(this.bcChannel,this._bcSubscriber),!0);let e=HO();JO(e,0),II(e,this.doc),PI(this.bcChannel,WO(e),this);let t=HO();JO(t,0),LI(t,this.doc),PI(this.bcChannel,WO(t),this);let n=HO();JO(n,3),PI(this.bcChannel,WO(n),this);let r=HO();JO(r,1),nk(r,YI(this.awareness,[this.doc.clientID])),PI(this.bcChannel,WO(r),this)}disconnectBc(){let e=HO();JO(e,1),nk(e,YI(this.awareness,[this.doc.clientID],new Map)),sL(this,WO(e)),this.bcconnected&&=(NI(this.bcChannel,this._bcSubscriber),!1)}disconnect(){this.shouldConnect=!1,this.disconnectBc(),this.ws!==null&&aL(this,this.ws,null)}connect(){this.shouldConnect=!0,!this.wsconnected&&this.ws===null&&(oL(this),this.connectBc())}}})),uL=l({colorFor:()=>dL,startCollaboration:()=>fL});function dL(e){let t=0;for(let n of e)t=t*31+n.charCodeAt(0)|0;return pL[Math.abs(t)%pL.length]}function fL(e){let{bridge:t}=e,n=new mN,r=n.getMap(`annotations`),i=n.getMap(`fields`),a=n.getMap(`meta`),o=new cL(e.serverUrl.replace(/\/+$/,``),e.roomId,n,{...e.WebSocketPolyfill?{WebSocketPolyfill:e.WebSocketPolyfill}:{}}),{awareness:s}=o;s.setLocalStateField(`user`,{id:e.user.id,name:e.user.name,color:dL(e.user.id)});let c=new Set,l=()=>c.forEach(e=>e()),u=`connecting`;r.observe(e=>{if(e.transaction.origin===mL)return;let n=[],i=[];for(let[t,a]of e.changes.keys)a.action===`delete`?i.push(t):n.push(r.get(t));t.annotations.applyRemote({upsert:n,remove:i})}),i.observe(e=>{if(e.transaction.origin===mL)return;let n={};for(let[t,r]of e.changes.keys)r.action!==`delete`&&(n[t]=i.get(t));t.forms.applyRemote(n)});let d=[t.annotations.onLocal(({upsert:e,remove:t})=>n.transact(()=>{e&&r.set(e.id,hL(e)),t&&r.delete(t)},mL)),t.forms.onLocal((e,t)=>n.transact(()=>i.set(e,hL(t)),mL))],f=()=>{},p=new Promise(e=>f=e),m=e=>{if(e){if(o.off(`sync`,m),!a.get(`seeded`))n.transact(()=>{for(let e of t.annotations.list())r.set(e.id,hL(e));for(let[e,n]of Object.entries(t.forms.values()))i.set(e,hL(n));a.set(`seeded`,!0)},mL);else{let e=new Set(r.keys());t.annotations.applyRemote({upsert:[...r.values()],remove:t.annotations.list().filter(t=>!e.has(t.id)).map(e=>e.id)}),t.forms.applyRemote(i.toJSON())}f()}};return o.on(`sync`,m),o.on(`status`,({status:e})=>{u=e,l()}),s.on(`change`,l),{get status(){return u},get peers(){let e=[];for(let[t,r]of s.getStates()){let i=r.user;i&&typeof i.name==`string`&&e.push({clientId:t,id:String(i.id??t),name:i.name,color:typeof i.color==`string`&&/^#[0-9a-f]{6}$/i.test(i.color)?i.color:dL(String(t)),self:t===n.clientID})}return e.sort((e,t)=>Number(t.self)-Number(e.self)||e.name.localeCompare(t.name))},synced:p,onChange(e){return c.add(e),()=>c.delete(e)},destroy(){c.clear();for(let e of d)e();s.setLocalState(null),o.destroy(),s.destroy(),n.destroy()}}}var pL,mL,hL,gL=s((()=>{lL(),DI(),pL=[`#e11d48`,`#2563eb`,`#16a34a`,`#a855f7`,`#f97316`,`#0891b2`,`#ca8a04`,`#db2777`],mL=Symbol(`pdfcedar-local`),hL=e=>JSON.parse(JSON.stringify(e))}));Me();var _L=`0.1.0-beta.0`,vL=()=>Promise.resolve().then(()=>(XD(),YD)),yL=()=>Promise.resolve().then(()=>(gL(),uL));function bL(e){let t=``;if(typeof File<`u`&&e instanceof File)t=e.name;else if(typeof e==`string`)try{t=decodeURIComponent(new URL(e,`http://x`).pathname.split(`/`).pop()??``)}catch{t=``}return t=t.trim()||`document.pdf`,/.pdf$/i.test(t)?t:`${t}.pdf`}function xL(e){return e instanceof HTMLElement?e.isContentEditable||e instanceof HTMLTextAreaElement||e instanceof HTMLInputElement&&e.type!==`checkbox`:!1}var SL=new WeakMap,CL=640,wL=()=>new DOMException(`createViewer: replaced by a newer viewer in the same container.`,`AbortError`);async function TL(e){if(!(e?.container instanceof HTMLElement))throw TypeError("createViewer: `container` must be an HTMLElement.");if(e.document==null)throw TypeError("createViewer: `document` is required.");let{container:t}=e;SL.get(t)?.();let n=!1,r=()=>{n=!0,a.remove()};SL.set(t,r),e.assetBaseUrl&&Vu(e.assetBaseUrl),Kd();let i=new f,a=document.createElement(`div`);a.className=`pdfcedar-viewer`,a.dataset.pdfcedarVersion=_L,a.dataset.state=`loading`,qd(a,e.theme);let o=Lf(),s=Vf(),c=tf();c.slot=`pages`;let l=qf();l.slot=`comments`,s.append(c,l);let u=document.createElement(`div`);u.className=`pl-main`;let d=document.createElement(`div`);d.className=`pl-body`,d.append(s,u),a.append(o,d),t.append(a);let p=a.clientWidth>0&&a.clientWidth<CL;p&&(s.hidden=!0,a.toggleAttribute(`data-compact`,!0));let m=e.toolbar,h=e=>!m||m.includes(e),_=e.readOnly??!1,v=dm(e.licenseKey),y={valid:!1,reason:`missing`},b=e=>{y.valid||mm(e)},x,S,C=()=>{},w=()=>{};try{if(x=await Wu.open(e.document),n)throw x.destroy(),wL();if(y=await v,S=await Td.create(u,Xu.of(x),{onPageChange(e,t){a.dataset.page=String(e+1),c.setCurrentPage(e),w(),i.emit(`pageChanged`,{page:e+1,previousPage:t+1})},onZoomChange(e){a.dataset.zoom=String(e),w()},onSizesChange(){c.refreshSizes(),C()}}),S.decorateCanvas=(e,t)=>b(t),n)throw S.destroy(),x.destroy(),wL()}catch(e){if(a.remove(),SL.get(t)===r&&SL.delete(t),n)throw e instanceof DOMException?e:wL();let i=e instanceof Error?e.message:String(e);throw Error(`createViewer: could not open the document (${i}).`,{cause:e})}if(a.dataset.state=`ready`,a.dataset.license=y.valid?`valid`:`trial`,!y.valid){a.dataset.licenseReason=y.reason;let e=document.createElement(`div`);e.className=`pl-trial-badge`,e.setAttribute(`role`,`note`),e.textContent=`Trial`,e.title=`PDFCedar is running in trial mode: ${fm[y.reason]}.`,u.append(e),console.warn(`[pdfcedar] Trial mode (pages are watermarked): ${fm[y.reason]}. Pass a valid \`licenseKey\` to createViewer.`)}a.dataset.page=`1`,a.dataset.pageCount=String(S.pageCount),a.dataset.zoom=String(S.currentZoom);let T=e=>c.setSource({pageCount:e.count,pageSize:e=>S.pageSize(e),render:async(t,n,r)=>{let i=await Id(e,t,n,r);return i&&(ae(i,t),b(i)),i}});T(S.pageList),c.onSelect=e=>{S.goToPage(e),le&&ue(!1)};let E=cf();u.append(E);let D=new Fd(S,e=>{E.setStatus(e),a.dataset.searchTotal=String(e.total),a.dataset.searchCurrent=String(e.current+1),a.dataset.searching=String(e.searching)});E.onQuery=e=>void D.search(e),E.onNext=()=>D.next(),E.onPrevious=()=>D.previous(),E.onClose=()=>{D.clear(),S.scroller.focus({preventScroll:!0})};let O=new Ce,k=()=>{a.dataset.canUndo=String(O.state.canUndo),a.dataset.canRedo=String(O.state.canRedo)};O.onChange(k),k();let A=new de({undo:O,emit:(e,t)=>{if(i.emit(e,t),e===`annotationAdded`){let{annotation:e,source:n}=t;e.type===`signature`&&(n===`user`||n===`api`)&&i.emit(`signatureAdded`,{annotation:e})}},user:()=>e.user,pageCount:()=>S.pageCount}),j=tp();a.append(j);let M=new Np(e.signatureStore,e.user?.id??``),N=new bp({root:a,main:u,viewport:S,manager:A,history:O,events:i,tools:m?uf.filter(e=>e===`select`||m.includes(e)):uf,readOnly:_,applyRedactions:async()=>{let e=re().length;await te.ask({title:`Apply ${e} redaction${e===1?``:`s`}?`,message:`The marked areas turn black, and what's under them is permanently removed when you save. Annotations and form fields under them are deleted. This can't be undone.`,confirmLabel:`Apply redactions`,danger:!0})&&await Se.apply()},chooseSignature:async()=>{let e=await M.all(),t=await j.choose(e,e=>void M.remove(e));if(!t)return null;let n=await kp(t.image);return t.remember&&await M.add(n),{image:n,...await jp(n)}}}),P=new Ae({undo:O,emit:e=>i.emit(`formFieldChanged`,e),available:e=>e.widgets.some(e=>S.pageList.entries.some(t=>t.doc===x&&t.index===e.pageIndex))}),ee=new wp({viewport:S,manager:P,doc:x,readOnly:_}),te=ap();a.append(te);let ne=e=>A.list({page:e,type:`redaction`}).filter(e=>e.type===`redaction`&&e.applied),re=()=>A.list({type:`redaction`}).filter(e=>e.type===`redaction`&&!e.applied),ie=(e,t)=>e.x<t.x+t.width&&t.x<e.x+e.width&&e.y<t.y+t.height&&t.y<e.y+e.height;function ae(e,t){let n=ne(t+1);if(n.length===0)return;let r=e.getContext(`2d`);r.fillStyle=`#000`;for(let i of n){let n=ju(i.rect,S.pageSize(t));r.fillRect(n.left*e.width,n.top*e.height,n.width*e.width,n.height*e.height)}}let oe=new Set,se=()=>{let e=new Set;for(let t of A.list({type:`redaction`}))t.type===`redaction`&&t.applied&&e.add(t.page-1);for(let t of new Set([...oe,...e]))S.setTextMask(t,ne(t+1).map(e=>ju(e.rect,S.pageSize(t))));oe=e,ee.layout()};S.decorateCanvas=(e,t)=>{ae(t,e),b(t)},D.hidden=(e,t)=>ne(e+1).some(e=>t.some(t=>ie(e.rect,t))),ee.masked=(e,t)=>ne(t+1).some(t=>ie(t.rect,e.rect)),C=()=>{N.refreshAll(),se()},N.toolbar.slot=`tools`,o.append(N.toolbar);let F=new Ip({viewport:S,manager:A,history:O,original:x,onChange(e){a.dataset.pageCount=String(e.count),T(e),c.setCurrentPage(S.currentIndex),D.clear(),N.refreshAll(),w()}}),ce=!0,le=p,ue=e=>{ce=e,s.hidden=!e,a.dataset.sidebar=e?`open`:`closed`,w()};w=()=>o.setState({page:S.currentIndex+1,pageCount:S.pageCount,zoom:S.currentZoom,fit:S.fitMode,sidebarOpen:ce}),o.setFeatures({zoom:h(`zoom`),search:h(`search`),download:h(`download`),print:h(`print`)}),o.onSidebarToggle=()=>ue(!ce);let fe=e=>{e!==le&&(le=e,a.toggleAttribute(`data-compact`,e),o.setCompact(e),e&&ue(!1))},pe=new ResizeObserver(([e])=>fe((e?.contentRect.width??1e3)<CL));pe.observe(a),o.setCompact(le);let me=Ud(S,{onPinchStart:()=>N.cancelGesture()});o.onPage=e=>{e>=1&&e<=S.pageCount&&S.goToPage(e-1)},o.onZoom=e=>e===`width`||e===`page`?S.fit(e):S.setZoom(e),o.onSearch=()=>E.open();let he=e=>t=>console.error(`[pdfcedar] ${e} failed`,t);o.onDownload=()=>void we.download().catch(he(`download`)),o.onPrint=()=>void we.print().catch(he(`print`)),ue(!le),c.setPageTools(h(`pages`)&&!_),c.onRotate=e=>F.rotate(e+1,90,`user`),c.onDelete=e=>{S.pageCount>1&&F.delete(e+1,`user`)},c.onMove=(e,t)=>F.move(e+1,t+1,`user`),c.onMerge=e=>void F.merge(e).catch(he(`adding pages`));let ge=!1,I=()=>{ge||(ge=!0,queueMicrotask(()=>{ge=!1;let e=A.list(),t=new Map;for(let n of e)n.type===`reply`&&t.set(n.inReplyTo,(t.get(n.inReplyTo)??0)+1);let n=e.filter(e=>e.type!==`reply`).sort((e,t)=>e.page-t.page||t.rect.y+t.rect.height-(e.rect.y+e.rect.height)||e.rect.x-t.rect.x).map(e=>({id:e.id,label:mp[e.type],page:e.page,color:e.color,author:e.author,modifiedAt:e.modifiedAt,contents:e.contents,replies:t.get(e.id)??0}));l.setItems(n)}))};for(let e of[`annotationAdded`,`annotationChanged`,`annotationRemoved`])i.on(e,I);I(),l.onSelect=e=>N.focusAnnotation(e),N.onSelectionChange=e=>l.setSelected(e);let _e=new AbortController,{signal:ve}=_e;a.addEventListener(`keydown`,e=>{if(!(e.ctrlKey||e.metaKey)||e.altKey)return;let t=e.key.toLowerCase();if(t===`f`){if(!h(`search`))return;e.preventDefault(),E.open()}else xL(e.composedPath()[0])||(t===`z`&&!e.shiftKey?(e.preventDefault(),O.undo()):(t===`z`&&e.shiftKey||t===`y`)&&(e.preventDefault(),O.redo()))},{signal:ve}),a.addEventListener(`copy`,e=>{let t=document.getSelection();t&&!t.isCollapsed&&e.clipboardData&&(e.clipboardData.setData(`text/plain`,Md(t.toString())),e.preventDefault())},{signal:ve}),u.addEventListener(`pointerdown`,e=>e.target.closest(`.textLayer`)?.classList.add(`selecting`),{signal:ve}),document.addEventListener(`pointerup`,()=>u.querySelectorAll(`.textLayer.selecting`).forEach(e=>e.classList.remove(`selecting`)),{signal:ve});let ye=!1,be=[],xe=(async()=>{try{let e=await x.scanAnnotations(g);if(ye)return;if(e.widgets.length>0){P.load(ku(e.widgets)),ee.build();let t=new Map(e.widgets.flatMap(({pageIndex:e,widgets:t})=>t.map(t=>[t.id,{pageIndex:e,popupRef:null}])));x.hideAnnotations(t);let n=new Map;S.pageList.entries.forEach((e,t)=>e.doc===x&&n.set(e.index,t));let r=new Set(e.widgets.flatMap(e=>n.has(e.pageIndex)?[n.get(e.pageIndex)]:[]));S.rerenderPages(r),c.invalidate(r)}if(e.annotations.size===0)return;let{readAnnotations:t}=await vL(),n=await t(await x.getData());if(ye)return;let r=new Map;S.pageList.entries.forEach((e,t)=>e.doc===x&&r.set(e.index,t));let i=n.annotations.flatMap((e,t)=>{let i=r.get(e.page-1);return i===void 0?[]:[{annotation:{...e,page:i+1},pdfId:n.ids[t]}]}),a=EL(A,O,i.map(e=>e.annotation)),o=new Map;for(let{annotation:t,pdfId:n}of i){let r=e.annotations.get(n);r&&a.has(t.id)&&o.set(n,r)}x.hideAnnotations(o),be=n.ids;let s=new Set([...o.values()].flatMap(e=>r.has(e.pageIndex)?[r.get(e.pageIndex)]:[]));S.rerenderPages(s),c.invalidate(s)}catch(e){console.warn(`[pdfcedar] could not load the annotations in this PDF; they stay visible but not editable.`,e)}})();xe.then(()=>{ye||i.emit(`documentLoaded`,{pageCount:S.pageCount})});let L=null;if(e.collaboration){let{serverUrl:t,roomId:n}=e.collaboration,r=e.user??{id:`guest-${Math.random().toString(36).slice(2,10)}`,name:`Guest`},s=fp();s.slot=`presence`,o.append(s),xe.then(yL).then(({startCollaboration:e})=>{if(ye)return;let o=e({serverUrl:t,roomId:n,user:r,bridge:{annotations:{list:()=>A.export(),applyRemote:e=>{A.applyRemote(e);let t=(e.upsert??[]).filter(e=>{let t=e;return t.type===`redaction`&&t.applied===!0});if(t.length){O.clear(),se();let e=new Set(t.map(e=>e.page-1));S.rerenderPages(e),c.invalidate(e)}},onLocal:e=>{let t=({annotation:t,source:n})=>n!==`remote`&&e({upsert:t}),n=({annotation:t,source:n})=>n!==`remote`&&e({upsert:t}),r=({annotation:t,source:n})=>n!==`remote`&&e({remove:t.id});return i.on(`annotationAdded`,t),i.on(`annotationChanged`,n),i.on(`annotationRemoved`,r),()=>{i.off(`annotationAdded`,t),i.off(`annotationChanged`,n),i.off(`annotationRemoved`,r)}}},forms:{values:()=>P.values(),applyRemote:e=>P.applyRemote(e),onLocal:e=>{let t=({name:t,value:n,source:r})=>r!==`remote`&&e(t,n);return i.on(`formFieldChanged`,t),()=>i.off(`formFieldChanged`,t)}}}}),l=()=>{s.setStatus(o.status),s.setPeers(o.peers),a.dataset.collab=o.status};o.onChange(l),l(),L=o}).catch(e=>{s.setStatus(`disconnected`),console.error(`[pdfcedar] collaboration could not start`,e)})}let Se={mark:({page:e,rect:t})=>A.add({type:`redaction`,page:e,rect:t},`api`),async apply(){let e=re();if(e.length===0)return;O.untracked(()=>{for(let t of A.list())t.type!==`redaction`&&t.type!==`reply`&&e.some(e=>e.page===t.page&&ie(e.rect,t.rect))&&A.remove(t.id,`api`)}),A.markApplied(e.map(e=>e.id),`api`),O.clear(),se();let t=new Set(e.map(e=>e.page-1));S.rerenderPages(t),c.invalidate(t)}},R=async()=>{await xe,ee.commitPending();let{saveDocument:e}=await vL(),t=F.unchanged?null:F.plan(),n=P.changed(),r=P.flattened||Object.keys(n).length>0;return e(await x.getData(),A.export(),{replacedIds:be,imageCodec:Pp,...y.valid?{}:{watermark:`PDFCedar trial`},...r?{form:{values:n,flatten:P.flattened}}:{},...t?{pages:t.pages,extraDocuments:await Promise.all(t.documents.map(e=>e.getData()))}:{}})},z=async()=>{let e=await R();return ye||i.emit(`saved`,{bytes:e}),e},we={on:(e,t)=>i.on(e,t),off:(e,t)=>i.off(e,t),goToPage(e){let t=S.pageCount;if(!Number.isInteger(e)||e<1||e>t)throw RangeError(`goToPage: expected an integer from 1 to ${t}, got ${e}.`);S.goToPage(e-1)},setZoom:e=>S.setZoom(e),fit:e=>S.fit(e),search(e){if(typeof e!=`string`)throw TypeError(`search: expected a string.`);return e.trim()===``?(E.close(),D.clear(),Promise.resolve([])):(E.open(e),D.search(e))},annotations:{add:e=>A.add(e),update:(e,t)=>A.update(e,t),remove:e=>A.remove(e),list:e=>A.list(e),export:()=>A.export(),import:(e,t)=>void A.import(e,t)},undo:()=>void O.undo(),redo:()=>void O.redo(),pages:{rotate:(e,t)=>F.rotate(e,t),delete:e=>F.delete(e),move:(e,t)=>F.move(e,t),merge:e=>F.merge(e)},forms:{getValues:()=>P.values(),setValues:e=>P.setValues(e,`api`),flatten:()=>P.flatten()},signatures:{async add({page:e,rect:t,image:n}){let r=await kp(n);if(ye)throw Error(`signatures.add: the viewer was destroyed.`);return A.add({type:`signature`,page:e,rect:t,image:r},`api`)}},redaction:Se,save:z,async download(t){let n=await z(),r=URL.createObjectURL(new Blob([n],{type:`application/pdf`})),i=document.createElement(`a`);i.href=r,i.download=t??bL(e.document),i.rel=`noopener`,i.style.display=`none`,document.body.append(i),i.click(),i.remove(),setTimeout(()=>URL.revokeObjectURL(r),6e4)},async print(){await Hd(await R())},destroy(){ye||(ye=!0,i.clear(),_e.abort(),pe.disconnect(),L?.destroy(),me(),N.destroy(),ee.destroy(),F.destroy(),D.clear(),S.destroy(),x.destroy(),a.remove(),SL.get(t)===Te&&SL.delete(t))}},Te=()=>we.destroy();return SL.set(t,Te),w(),we}function EL(e,t,n){return t.untracked(()=>{try{return e.import(n,{},`document`),new Set(n.map(e=>e.id))}catch(t){console.warn(`[pdfcedar] some annotations in this PDF are invalid; loading the others.`,t);let r=new Set;for(let t of[...n].sort((e,t)=>Number(e.type===`reply`)-Number(t.type===`reply`)))try{e.import([t],{},`document`),r.add(t.id)}catch{}return r}})}Me(),re(),B(),je(),e.AnnotationValidationError=P,e.EncryptedDocumentError=Ee,e.FormValueError=Oe,e.NotImplementedError=Te,e.VERSION=_L,e.createViewer=TL});
|
|
991
|
+
//# sourceMappingURL=index.umd.cjs.map
|