@vue-pdf-viewer/annotation 1.4.0-beta.1 → 1.4.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/dist/index.js +1265 -1265
  2. package/dist/index.umd.cjs +10 -10
  3. package/package.json +2 -2
@@ -1,16 +1,16 @@
1
- (function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode('.vp-text-xl[data-v-9d5f0033]{font-size:1.25rem;line-height:1.75rem}.vpv-toolbar-btn.vpv-toolbar-btn-active[data-v-df5778ee],.vpv-toolbar-btn[data-v-df5778ee]:hover{background-color:var(--vpv-primary-color);color:#fff}.vpv-annotation-editor-layer{position:absolute;left:0;top:0;transform-origin:0 0;width:round(down,var(--page-width) * var(--scale-factor),var(--scale-round-x));height:round(down,var(--page-height) * var(--scale-factor),var(--scale-round-y));pointer-events:none}.vpv-annotation-editor-layer[data-main-rotation="90"],.vpv-annotation-editor-layer[data-main-rotation="270"]{width:round(down,var(--page-height) * var(--scale-factor),var(--scale-round-y));height:round(down,var(--page-width) * var(--scale-factor),var(--scale-round-x))}.vpv-annotation-editor-layer *{pointer-events:auto}.vpv-annotation-editor-layer .vpv-annotation-editor{z-index:calc(var(--vpv-base-z-index) * 4)}.vpv-annotation-editor-layer.highlight-mode,.vpv-annotation-editor-layer.underline-mode,.vpv-annotation-editor-layer.strikeout-mode{cursor:text}.vpv-annotation-editor-layer.highlight-mode .vpv-annotation-editor .vpv-annotation-editor__clip-path,.vpv-annotation-editor-layer.underline-mode .vpv-annotation-editor .vpv-annotation-editor__clip-path,.vpv-annotation-editor-layer.strikeout-mode .vpv-annotation-editor .vpv-annotation-editor__clip-path{position:absolute;inset:0;pointer-events:none;z-index:calc(var(--vpv-base-z-index) * 5)}.vpv-annotation-editor-layer:not(.highlight-mode,.underline-mode,.strikeout-mode) .vpv-annotation-editor:is(.vpv-annotation-editor__highlight,.vpv-annotation-editor__underline,.vpv-annotation-editor__strikeout){pointer-events:none}.vpv-annotation-editor-layer:not(.highlight-mode,.underline-mode,.strikeout-mode) .vpv-annotation-editor:is(.vpv-annotation-editor__highlight,.vpv-annotation-editor__underline,.vpv-annotation-editor__strikeout) .vpv-annotation-editor__clip-path{pointer-events:none}.vpv-annotation-text-selection__color-picker-wrapper{padding-left:4px;padding-right:4px;padding-bottom:4px;text-align:left}.vpv-annotation-text-selection__color-picker-wrapper>p{margin-bottom:.75rem}.vpv-canvas-layer>.vpv-highlight:is(svg),.vpv-canvas-layer>.vpv-underline:is(svg),.vpv-canvas-layer>.vpv-underline-interaction:is(svg),.vpv-canvas-layer>.vpv-strikeout:is(svg),.vpv-canvas-layer>.vpv-strikeout-interaction:is(svg){position:absolute;mix-blend-mode:multiply;pointer-events:none}.vpv-canvas-layer>.vpv-highlight:is(svg)>use,.vpv-canvas-layer>.vpv-underline:is(svg)>use,.vpv-canvas-layer>.vpv-underline-interaction:is(svg)>use,.vpv-canvas-layer>.vpv-strikeout:is(svg)>use,.vpv-canvas-layer>.vpv-strikeout-interaction:is(svg)>use{fill:inherit}.vpv-canvas-layer>.vpv-highlight:is(svg):not(.free),.vpv-canvas-layer>.vpv-underline:is(svg):not(.free),.vpv-canvas-layer>.vpv-underline-interaction:is(svg):not(.free),.vpv-canvas-layer>.vpv-strikeout:is(svg):not(.free),.vpv-canvas-layer>.vpv-strikeout-interaction:is(svg):not(.free){fill-rule:evenodd}.vpv-canvas-layer>.vpv-highlight:is(svg):not(.free) path,.vpv-canvas-layer>.vpv-highlight:is(svg):not(.free) use,.vpv-canvas-layer>.vpv-underline:is(svg):not(.free) path,.vpv-canvas-layer>.vpv-underline:is(svg):not(.free) use,.vpv-canvas-layer>.vpv-underline-interaction:is(svg):not(.free) path,.vpv-canvas-layer>.vpv-underline-interaction:is(svg):not(.free) use,.vpv-canvas-layer>.vpv-strikeout:is(svg):not(.free) path,.vpv-canvas-layer>.vpv-strikeout:is(svg):not(.free) use,.vpv-canvas-layer>.vpv-strikeout-interaction:is(svg):not(.free) path,.vpv-canvas-layer>.vpv-strikeout-interaction:is(svg):not(.free) use{fill-rule:evenodd}.vpv-canvas-layer>.vpv-highlight-outline:is(svg),.vpv-canvas-layer>.vpv-underline-outline:is(svg),.vpv-canvas-layer>.vpv-strikeout-outline:is(svg){position:absolute;mix-blend-mode:normal;fill-rule:evenodd;fill:transparent;pointer-events:none;stroke:transparent;stroke-width:var(--vpv-annotation-text-selection__outline-width);vector-effect:non-scaling-stroke}.vpv-canvas-layer>.vpv-highlight-outline:is(svg) path,.vpv-canvas-layer>.vpv-highlight-outline:is(svg) use,.vpv-canvas-layer>.vpv-underline-outline:is(svg) path,.vpv-canvas-layer>.vpv-underline-outline:is(svg) use,.vpv-canvas-layer>.vpv-strikeout-outline:is(svg) path,.vpv-canvas-layer>.vpv-strikeout-outline:is(svg) use{fill-rule:evenodd;stroke:inherit;stroke-width:inherit;vector-effect:inherit}.vpv-canvas-layer>.vpv-highlight-outline:is(svg).selected,.vpv-canvas-layer>.vpv-underline-outline:is(svg).selected,.vpv-canvas-layer>.vpv-strikeout-outline:is(svg).selected{stroke:var(--vpv-annotation-text-selection__outline-selected-color)}.vpv-annotation-editor-layer.highlight-mode .vpv-annotation-editor,.vpv-annotation-editor-layer.underline-mode .vpv-annotation-editor,.vpv-annotation-editor-layer.strikeout-mode .vpv-annotation-editor{pointer-events:none}.vpv-annotation-editor-layer.highlight-mode .vpv-annotation-editor__underline,.vpv-annotation-editor-layer.highlight-mode .vpv-annotation-editor__strikeout,.vpv-annotation-editor-layer.highlight-mode .vpv-annotation-editor__highlight,.vpv-annotation-editor-layer.underline-mode .vpv-annotation-editor__underline,.vpv-annotation-editor-layer.underline-mode .vpv-annotation-editor__strikeout,.vpv-annotation-editor-layer.underline-mode .vpv-annotation-editor__highlight,.vpv-annotation-editor-layer.strikeout-mode .vpv-annotation-editor__underline,.vpv-annotation-editor-layer.strikeout-mode .vpv-annotation-editor__strikeout,.vpv-annotation-editor-layer.strikeout-mode .vpv-annotation-editor__highlight{cursor:pointer}.vpv-annotation-editor-layer .vpv-annotation-editor__free-text{position:absolute;user-select:none;padding:calc(var(--vpv-annotation-free-text__padding, 2px) * var(--scale-factor));cursor:auto}.vpv-annotation-editor-layer .vpv-annotation-editor__free-text.draggable{cursor:move}.vpv-annotation-editor-layer .vpv-annotation-editor__free-text--selected:has([role=textbox][contenteditable=true]){width:auto!important;height:auto!important}.vpv-annotation-editor-layer .vpv-annotation-editor__free-text--selected,.vpv-annotation-editor-layer .vpv-annotation-editor__free-text:hover{outline:1px solid #0082ff}.vpv-annotation-editor-layer .vpv-annotation-editor__free-text [role=textbox]{outline:none!important;text-align:start;font:10px sans-serif;line-height:var(--vpv-annotation-free-text__line-height);width:auto;height:auto;white-space:pre-wrap;word-wrap:break-word}.vpv-annotation-editor-layer .vpv-annotation-editor__free-text--temp{min-width:100px;min-height:calc(20px * var(--scale-factor));border:1px dashed #007bff;background-color:#ffffffe6;color:#000;cursor:text}.vpv-annotation-editor-layer .vpv-annotation-editor__free-text--temp>[role=textbox]{outline:none;font-size:calc(16px * var(--scale-factor));font-family:sans-serif;min-height:calc(16px * var(--scale-factor));white-space:nowrap}.vpv-annotation-editor-layer.freetext-mode>:not(.vpv-annotation-editor__free-text){user-select:none;pointer-events:none}.vpv-annotation-editor-layer:not(.freetext-mode) .vpv-annotation-editor__free-text,.vpv-annotation-editor-layer:not(.freetext-mode) .vpv-annotation-editor__free-text [role=textbox]{pointer-events:none}.vpv-resizers{position:absolute;inset:0;pointer-events:none}.vpv-resizers .vpv-resizer{position:absolute;width:var(--vpv-annotation-outline-resizer-size);height:var(--vpv-annotation-outline-resizer-size);background:white;border:1px solid var(--vpv-annotation-outline-resizer-border-color);border-radius:50%;pointer-events:auto;cursor:pointer;z-index:calc(var(--vpv-base-z-index) * 9999);transition:opacity .2s ease,visibility .2s ease}.vpv-resizers .vpv-resizer:hover,.vpv-resizers .vpv-resizer:focus{transform:scale(1.5)}.vpv-resizers .vpv-resizer--top-left{top:calc(var(--vpv-annotation-outline-resizer-size) * -1.25);left:calc(var(--vpv-annotation-outline-resizer-size) * -1.25);cursor:nwse-resize}.vpv-resizers .vpv-resizer--top-right{top:calc(var(--vpv-annotation-outline-resizer-size) * -1.25);right:calc(var(--vpv-annotation-outline-resizer-size) * -1.25);cursor:nesw-resize}.vpv-resizers .vpv-resizer--bottom-left{bottom:calc(var(--vpv-annotation-outline-resizer-size) * -1.25);left:calc(var(--vpv-annotation-outline-resizer-size) * -1.25);cursor:nesw-resize}.vpv-resizers .vpv-resizer--bottom-right{bottom:calc(var(--vpv-annotation-outline-resizer-size) * -1.25);right:calc(var(--vpv-annotation-outline-resizer-size) * -1.25);cursor:nwse-resize}.vpv-page[data-main-rotation="90"] .vpv-resizer--top-left,.vpv-page[data-main-rotation="270"] .vpv-resizer--top-left{cursor:nesw-resize}.vpv-page[data-main-rotation="90"] .vpv-resizer--top-right,.vpv-page[data-main-rotation="270"] .vpv-resizer--top-right,.vpv-page[data-main-rotation="90"] .vpv-resizer--bottom-left,.vpv-page[data-main-rotation="270"] .vpv-resizer--bottom-left{cursor:nwse-resize}.vpv-page[data-main-rotation="90"] .vpv-resizer--bottom-right,.vpv-page[data-main-rotation="270"] .vpv-resizer--bottom-right{cursor:nesw-resize}.vpv-resizer--dark{background:#80ebff;border-color:#2b2a33}.vpv-resizer--dark:focus{outline-color:#80ebff}.vpv-annotation-editor__image{position:absolute;cursor:pointer;touch-action:none;user-select:none;will-change:transform}.vpv-annotation-editor__image.hovered,.vpv-annotation-editor__image:hover{outline-width:var(--vpv-annotation-outline-width);outline-style:solid;outline-color:var(--vpv-annotation-outline-hovered-color)}.vpv-annotation-editor__image.selected{outline-width:var(--vpv-annotation-outline-width);outline-style:solid;outline-offset:var(--vpv-annotation-outline-selected-offset);outline-color:var(--vpv-annotation-outline-selected-color);cursor:move}.vpv-annotation-editor__image canvas{position:absolute;width:100%;height:100%;margin:0;top:0;left:0}.vpv-annotation-editor__image.dragging canvas{user-drag:none;-webkit-user-drag:none;pointer-events:none;touch-action:none}.vpv-page:not([data-main-rotation="0"]) .vpv-annotation-editor__image:hover{outline:none}.vpv-annotation-tools-container[data-v-f01943e3]{padding-top:.5rem;padding-bottom:.5rem;border-top:1px solid #c6ccd2;max-width:min-content;margin:.5rem auto}.vpv-annotation-tools-container[data-v-f01943e3] .vpv-toolbar-btn{margin-bottom:.25rem}.slide-enter-active[data-v-f01943e3],.slide-leave-active[data-v-f01943e3]{transition:all .3s ease-out}.slide-enter-from[data-v-f01943e3],.slide-leave-to[data-v-f01943e3]{opacity:0}.slide-enter-from[data-v-f01943e3],.slide-leave-to[data-v-f01943e3]{transform:translateY(-20px)}')),document.head.appendChild(e)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}})();
2
- (function(de,g){typeof exports=="object"&&typeof module<"u"?g(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],g):(de=typeof globalThis<"u"?globalThis:de||self,g(de["@vue-pdf-viewer/annotation"]={},de.Vue))})(this,function(de,g){"use strict";var kc=Object.defineProperty,Ac=(e,t,n)=>t in e?kc(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,b=(e,t,n)=>(Ac(e,typeof t!="symbol"?t+"":t,n),n);const xt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Kt=new Uint8Array(256);for(let e=0;e<xt.length;e++)Kt[xt.charCodeAt(e)]=e;const Cc=e=>{let t="";const n=e.length;for(let r=0;r<n;r+=3)t+=xt[e[r]>>2],t+=xt[(e[r]&3)<<4|e[r+1]>>4],t+=xt[(e[r+1]&15)<<2|e[r+2]>>6],t+=xt[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},po=e=>{let t=e.length*.75;const n=e.length;let r,i=0,o,s,c,l;e[e.length-1]==="="&&(t--,e[e.length-2]==="="&&t--);const a=new Uint8Array(t);for(r=0;r<n;r+=4)o=Kt[e.charCodeAt(r)],s=Kt[e.charCodeAt(r+1)],c=Kt[e.charCodeAt(r+2)],l=Kt[e.charCodeAt(r+3)],a[i++]=o<<2|s>>4,a[i++]=(s&15)<<4|c>>2,a[i++]=(c&3)<<6|l&63;return a},Bc=/^(data)?:?([\w\/\+]+)?;?(charset=[\w-]+|base64)?.*,/i,Dc=e=>{const t=e.trim(),r=t.substring(0,100).match(Bc);if(!r)return po(t);const[i]=r,o=t.substring(i.length);return po(o)},H=e=>e.charCodeAt(0),bo=(e,t)=>ze(e.toString(16),t,"0").toUpperCase(),mo=e=>bo(e,2),We=e=>String.fromCharCode(e),Tc=e=>We(parseInt(e,16)),ze=(e,t,n)=>{let r="";for(let i=0,o=t-e.length;i<o;i++)r+=n;return r+e},be=(e,t,n)=>{const r=e.length;for(let i=0;i<r;i++)t[n++]=e.charCodeAt(i);return r},Ec=/^D:(\d\d\d\d)(\d\d)?(\d\d)?(\d\d)?(\d\d)?(\d\d)?([+\-Z])?(\d\d)?'?(\d\d)?'?$/,yo=e=>{const t=e.match(Ec);if(!t)return;const[,n,r="01",i="01",o="00",s="00",c="00",l="Z",a="00",h="00"]=t,f=l==="Z"?"Z":`${l}${a}:${h}`;return new Date(`${n}-${r}-${i}T${o}:${s}:${c}${f}`)},Pc=(e,t)=>{var n;let r=0,i;for(;r<e.length;){const o=e.substring(r).match(t);if(!o)return{match:i,pos:r};i=o,r+=((n=o.index)!=null?n:0)+o[0].length}return{match:i,pos:r}},Rn=e=>e[e.length-1],Br=e=>{if(e instanceof Uint8Array)return e;const t=e.length,n=new Uint8Array(t);for(let r=0;r<t;r++)n[r]=e.charCodeAt(r);return n},Rc=(...e)=>{const t=e.length,n=[];for(let s=0;s<t;s++){const c=e[s];n[s]=c instanceof Uint8Array?c:Br(c)}let r=0;for(let s=0;s<t;s++)r+=e[s].length;const i=new Uint8Array(r);let o=0;for(let s=0;s<t;s++){const c=n[s];for(let l=0,a=c.length;l<a;l++)i[o++]=c[l]}return i},_o=e=>{let t="";for(let n=0,r=e.length;n<r;n++)t+=We(e[n]);return t},St=e=>{const t=e.length;for(let n=0,r=Math.floor(t/2);n<r;n++){const i=n,o=t-n-1,s=e[n];e[i]=e[o],e[o]=s}return e},Ic=e=>{let t=0;for(let n=0,r=e.length;n<r;n++)t+=e[n];return t},Oc=(e,t)=>{const n=new Array(t-e);for(let r=0,i=n.length;r<i;r++)n[r]=e+r;return n},zc=e=>{if(typeof e=="string")return Dc(e);if(e instanceof ArrayBuffer)return new Uint8Array(e);if(e instanceof Uint8Array)return e;throw new TypeError("`input` must be one of `string | ArrayBuffer | Uint8Array`")},vt=()=>new Promise(e=>{setTimeout(()=>e(),0)}),wo=class{constructor(e){b(this,"populate"),b(this,"value"),this.populate=e,this.value=void 0}getValue(){return this.value}access(){return this.value||(this.value=this.populate()),this.value}invalidate(){this.value=void 0}};let kt=wo;b(kt,"populatedBy",e=>new wo(e));const In=e=>{throw new Error(e)},Fc=e=>{let t=String(e);if(Math.abs(e)<1){const n=parseInt(e.toString().split("e-")[1]);if(n){const r=e<0;r&&(e*=-1),e*=Math.pow(10,n-1),t="0."+new Array(n).join("0")+e.toString().substring(2),r&&(t="-"+t)}}else{let n=parseInt(e.toString().split("+")[1]);n>20&&(n-=20,e/=Math.pow(10,n),t=e.toString()+new Array(n+1).join("0"))}return t},On=e=>Math.ceil(e.toString(2).length/8),At=e=>{const t=new Uint8Array(On(e));for(let n=1;n<=t.length;n++)t[n-1]=e>>(t.length-n)*8;return t},G=new Uint16Array(256);for(let e=0;e<256;e++)G[e]=e;G[22]=H(""),G[24]=H("\u02D8"),G[25]=H("\u02C7"),G[26]=H("\u02C6"),G[27]=H("\u02D9"),G[28]=H("\u02DD"),G[29]=H("\u02DB"),G[30]=H("\u02DA"),G[31]=H("\u02DC"),G[127]=H("\uFFFD"),G[128]=H("\u2022"),G[129]=H("\u2020"),G[130]=H("\u2021"),G[131]=H("\u2026"),G[132]=H("\u2014"),G[133]=H("\u2013"),G[134]=H("\u0192"),G[135]=H("\u2044"),G[136]=H("\u2039"),G[137]=H("\u203A"),G[138]=H("\u2212"),G[139]=H("\u2030"),G[140]=H("\u201E"),G[141]=H("\u201C"),G[142]=H("\u201D"),G[143]=H("\u2018"),G[144]=H("\u2019"),G[145]=H("\u201A"),G[146]=H("\u2122"),G[147]=H("\uFB01"),G[148]=H("\uFB02"),G[149]=H("\u0141"),G[150]=H("\u0152"),G[151]=H("\u0160"),G[152]=H("\u0178"),G[153]=H("\u017D"),G[154]=H("\u0131"),G[155]=H("\u0142"),G[156]=H("\u0153"),G[157]=H("\u0161"),G[158]=H("\u017E"),G[159]=H("\uFFFD"),G[160]=H("\u20AC"),G[173]=H("\uFFFD");const xo=e=>{const t=new Array(e.length);for(let n=0,r=e.length;n<r;n++)t[n]=G[e[n]];return String.fromCodePoint(...t)},So=e=>Object.keys(e).map(t=>e[t]),zn=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height,Nc=(e,t=!0)=>{const n=[];t&&n.push(65279);for(let r=0,i=e.length;r<i;){const o=e.codePointAt(r);if(o<65536)n.push(o),r+=1;else if(o<1114112)n.push(Mc(o),Lc(o)),r+=2;else throw new Error(`Invalid code point: 0x${mo(o)}`)}return new Uint16Array(n)},Mc=e=>Math.floor((e-65536)/1024)+55296,Lc=e=>(e-65536)%1024+56320,Zt="\uFFFD".codePointAt(0),vo=(e,t=!0)=>{if(e.length<=1)return String.fromCodePoint(Zt);const n=t?Uc(e):"BigEndian";let r=t?2:0;const i=[];for(;e.length-r>=2;){const o=Ao(e[r++],e[r++],n);if(jc(o))if(e.length-r<2)i.push(Zt);else{const s=Ao(e[r++],e[r++],n);ko(s)?i.push(o,s):i.push(Zt)}else ko(o)?(r+=2,i.push(Zt)):i.push(o)}return r<e.length&&i.push(Zt),String.fromCodePoint(...i)},jc=e=>e>=55296&&e<=56319,ko=e=>e>=56320&&e<=57343,Ao=(e,t,n)=>{if(n==="LittleEndian")return t<<8|e;if(n==="BigEndian")return e<<8|t;throw new Error(`Invalid byteOrder: ${n}`)},Uc=e=>Co(e)?"BigEndian":Bo(e)?"LittleEndian":"BigEndian",Co=e=>e[0]===254&&e[1]===255,Bo=e=>e[0]===255&&e[1]===254,Do=e=>Co(e)||Bo(e),ue=e=>`\`${e}\``,$c=e=>`'${e}'`,To=e=>{const t=typeof e;return t==="string"?$c(e):t==="undefined"?ue(e):e},Hc=(e,t,n)=>{const r=new Array(n.length);for(let o=0,s=n.length;o<s;o++){const c=n[o];r[o]=To(c)}const i=r.join(" or ");return`${ue(t)} must be one of ${i}, but was actually ${To(e)}`},qt=(e,t,n)=>{Array.isArray(n)||(n=So(n));for(let r=0,i=n.length;r<i;r++)if(e===n[r])return;throw new TypeError(Hc(e,t,n))},Ne=(e,t,n)=>{Array.isArray(n)||(n=So(n)),qt(e,t,n.concat(void 0))},Gc=e=>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),Vc=(e,t)=>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],Wc=(e,t,n)=>{const r=new Array(n.length);for(let o=0,s=n.length;o<s;o++){const c=n[o];c==="null"&&(r[o]=ue("null")),c==="undefined"&&(r[o]=ue("undefined")),c==="string"?r[o]=ue("string"):c==="number"?r[o]=ue("number"):c==="boolean"?r[o]=ue("boolean"):c==="symbol"?r[o]=ue("symbol"):c==="bigint"?r[o]=ue("bigint"):c===Array?r[o]=ue("Array"):c===Uint8Array?r[o]=ue("Uint8Array"):c===ArrayBuffer?r[o]=ue("ArrayBuffer"):r[o]=ue(c[1])}const i=r.join(" or ");return`${ue(t)} must be of type ${i}, but was actually of type ${ue(Gc(e))}`},D=(e,t,n)=>{for(let r=0,i=n.length;r<i;r++)if(Vc(e,n[r]))return;throw new TypeError(Wc(e,t,n))},j=(e,t,n)=>{D(e,t,n.concat("undefined"))},Eo=(e,t,n)=>{for(let r=0,i=e.length;r<i;r++)D(e[r],t,n)},et=(e,t,n,r)=>{if(D(e,t,["number"]),D(n,"min",["number"]),D(r,"max",["number"]),r=Math.max(n,r),e<n||e>r)throw new Error(`${ue(t)} must be at least ${n} and at most ${r}, but was actually ${e}`)},Ke=(e,t,n,r)=>{D(e,t,["number","undefined"]),typeof e=="number"&&et(e,t,n,r)},Kc=(e,t,n)=>{if(D(e,t,["number"]),e%n!==0)throw new Error(`${ue(t)} must be a multiple of ${n}, but was actually ${e}`)},Zc=(e,t)=>{if(!Number.isInteger(e))throw new Error(`${ue(t)} must be an integer, but was actually ${e}`)};class Me extends Error{constructor(t,n){const r=`Method ${t}.${n}() not implemented`;super(r)}}class Dr extends Error{constructor(t){const n=`Cannot construct ${t} - it has a private constructor`;super(n)}}class Tr extends Error{constructor(t,n){const r=s=>{var c,l;return(l=s?.name)!=null?l:(c=s?.constructor)==null?void 0:c.name},o=`Expected instance of ${(Array.isArray(t)?t.map(r):[r(t)]).join(" or ")}, but got instance of ${n&&r(n)}`;super(o)}}class qc extends Error{constructor(t){const n=`${t} stream encoding not supported`;super(n)}}class Er extends Error{constructor(t,n){const r=`Cannot call ${t}.${n}() more than once`;super(r)}}class Xc extends Error{constructor(){const t="Can't embed page with missing Contents";super(t)}}class Yc extends Error{constructor(t){var n,r,i;const s=`Unrecognized stream type: ${(i=(r=(n=t?.contructor)==null?void 0:n.name)!=null?r:t?.name)!=null?i:t}`;super(s)}}class Jc extends Error{constructor(t){const n=`Attempted to convert PDFArray with ${t} elements to rectangle, but must have exactly 4 elements.`;super(n)}}class Po extends Error{constructor(t){const n=`Attempted to convert "${t}" to a date, but it does not match the PDF date string format.`;super(n)}}class Ro extends Error{constructor(t,n){const r=`Invalid targetIndex specified: targetIndex=${t} must be less than Count=${n}`;super(r)}}class Io extends Error{constructor(t,n){const r=`Failed to ${n} at targetIndex=${t} due to corrupt page tree: It is likely that one or more 'Count' entries are invalid`;super(r)}}class Fn extends Error{constructor(t,n,r){const i=`index should be at least ${n} and at most ${r}, but was actually ${t}`;super(i)}}class Pr extends Error{constructor(){const t="Attempted to set invalid field value";super(t)}}class Qc extends Error{constructor(){const t="Attempted to select multiple values for single-select field";super(t)}}class el extends Error{constructor(t){const n=`No /DA (default appearance) entry found for field: ${t}`;super(n)}}class tl extends Error{constructor(t){const n=`No Tf operator found for DA of field: ${t}`;super(n)}}class Oo extends Error{constructor(t,n){const r=`Failed to parse number (line:${t.line} col:${t.column} offset=${t.offset}): "${n}"`;super(r)}}class tt extends Error{constructor(t,n){const r=`Failed to parse PDF document (line:${t.line} col:${t.column} offset=${t.offset}): ${n}`;super(r)}}class nl extends tt{constructor(t,n,r){const i=`Expected next byte to be ${n} but it was actually ${r}`;super(t,i)}}class rl extends tt{constructor(t,n){const r=`Failed to parse PDF object starting with the following byte: ${n}`;super(t,r)}}class il extends tt{constructor(t){const n="Failed to parse invalid PDF object";super(t,n)}}class ol extends tt{constructor(t){const n="Failed to parse PDF stream";super(t,n)}}class sl extends tt{constructor(t){const n="Failed to parse PDF literal string due to unbalanced parenthesis";super(t,n)}}class al extends tt{constructor(t){const n="Parser stalled";super(t,n)}}class cl extends tt{constructor(t){const n="No PDF header found";super(t,n)}}class ll extends tt{constructor(t,n){const r=`Did not find expected keyword '${_o(n)}'`;super(t,r)}}class _e{clone(t){throw new Me(this.constructor.name,"clone")}toString(){throw new Me(this.constructor.name,"toString")}sizeInBytes(){throw new Me(this.constructor.name,"sizeInBytes")}copyBytesInto(t,n){throw new Me(this.constructor.name,"copyBytesInto")}}const Rr=class extends _e{constructor(e){super(),b(this,"numberValue"),b(this,"stringValue"),this.numberValue=e,this.stringValue=Fc(e)}asNumber(){return this.numberValue}value(){return this.numberValue}clone(){return Rr.of(this.numberValue)}toString(){return this.stringValue}sizeInBytes(){return this.stringValue.length}copyBytesInto(e,t){return t+=be(this.stringValue,e,t),this.stringValue.length}};let $=Rr;b($,"of",e=>new Rr(e));var m=(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",e))(m||{});const Ir=class extends _e{constructor(e){super(),b(this,"array"),b(this,"context"),this.array=[],this.context=e}size(){return this.array.length}push(e){this.array.push(e)}insert(e,t){this.array.splice(e,0,t)}indexOf(e){const t=this.array.indexOf(e);return t===-1?void 0:t}remove(e){this.array.splice(e,1)}set(e,t){this.array[e]=t}get(e){return this.array[e]}lookupMaybe(e,...t){return this.context.lookupMaybe(this.get(e),...t)}lookup(e,...t){return this.context.lookup(this.get(e),...t)}asRectangle(){if(this.size()!==4)throw new Jc(this.size());const e=this.lookup(0,$).asNumber(),t=this.lookup(1,$).asNumber(),n=this.lookup(2,$).asNumber(),r=this.lookup(3,$).asNumber(),i=e,o=t,s=n-e,c=r-t;return{x:i,y:o,width:s,height:c}}asArray(){return this.array.slice()}clone(e){const t=Ir.withContext(e||this.context);for(let n=0,r=this.size();n<r;n++)t.push(this.array[n]);return t}toString(){let e="[ ";for(let t=0,n=this.size();t<n;t++)e+=this.get(t).toString(),e+=" ";return e+="]",e}sizeInBytes(){let e=3;for(let t=0,n=this.size();t<n;t++)e+=this.get(t).sizeInBytes()+1;return e}copyBytesInto(e,t){const n=t;e[t++]=m.LeftSquareBracket,e[t++]=m.Space;for(let r=0,i=this.size();r<i;r++)t+=this.get(r).copyBytesInto(e,t),e[t++]=m.Space;return e[t++]=m.RightSquareBracket,t-n}scalePDFNumbers(e,t){for(let n=0,r=this.size();n<r;n++){const i=this.lookup(n);if(i instanceof $){const o=n%2===0?e:t;this.set(n,$.of(i.asNumber()*o))}}}};let q=Ir;b(q,"withContext",e=>new Ir(e));const Te=new Uint8Array(256);Te[m.LeftParen]=1,Te[m.RightParen]=1,Te[m.LessThan]=1,Te[m.GreaterThan]=1,Te[m.LeftSquareBracket]=1,Te[m.RightSquareBracket]=1,Te[m.LeftCurly]=1,Te[m.RightCurly]=1,Te[m.ForwardSlash]=1,Te[m.Percent]=1;const Ze=new Uint8Array(256);Ze[m.Null]=1,Ze[m.Tab]=1,Ze[m.Newline]=1,Ze[m.FormFeed]=1,Ze[m.CarriageReturn]=1,Ze[m.Space]=1;const Or=new Uint8Array(256);for(let e=0,t=256;e<t;e++)Or[e]=Ze[e]||Te[e]?1:0;Or[m.Hash]=1;const hl=e=>e.replace(/#([\dABCDEF]{2})/g,(t,n)=>Tc(n)),dl=e=>e>=m.ExclamationPoint&&e<=m.Tilde&&!Or[e],zo={},Fo=new Map,ne=class extends _e{constructor(e,t){if(e!==zo)throw new Dr("PDFName");super(),b(this,"encodedName");let n="/";for(let r=0,i=t.length;r<i;r++){const o=t[r],s=H(o);n+=dl(s)?o:`#${mo(s)}`}this.encodedName=n}asBytes(){const e=[];let t="",n=!1;const r=i=>{i!==void 0&&e.push(i),n=!1};for(let i=1,o=this.encodedName.length;i<o;i++){const s=this.encodedName[i],c=H(s),l=this.encodedName[i+1];n?c>=m.Zero&&c<=m.Nine||c>=m.a&&c<=m.f||c>=m.A&&c<=m.F?(t+=s,(t.length===2||!(l>="0"&&l<="9"||l>="a"&&l<="f"||l>="A"&&l<="F"))&&(r(parseInt(t,16)),t="")):r(c):c===m.Hash?n=!0:r(c)}return new Uint8Array(e)}decodeText(){const e=this.asBytes();return String.fromCharCode(...Array.from(e))}asString(){return this.encodedName}value(){return this.encodedName}clone(){return this}toString(){return this.encodedName}sizeInBytes(){return this.encodedName.length}copyBytesInto(e,t){return t+=be(this.encodedName,e,t),this.encodedName.length}};let p=ne;b(p,"of",e=>{const t=hl(e);let n=Fo.get(t);return n||(n=new ne(zo,t),Fo.set(t,n)),n}),b(p,"Length",ne.of("Length")),b(p,"FlateDecode",ne.of("FlateDecode")),b(p,"Resources",ne.of("Resources")),b(p,"Font",ne.of("Font")),b(p,"XObject",ne.of("XObject")),b(p,"ExtGState",ne.of("ExtGState")),b(p,"Contents",ne.of("Contents")),b(p,"Type",ne.of("Type")),b(p,"Parent",ne.of("Parent")),b(p,"MediaBox",ne.of("MediaBox")),b(p,"Page",ne.of("Page")),b(p,"Annots",ne.of("Annots")),b(p,"TrimBox",ne.of("TrimBox")),b(p,"ArtBox",ne.of("ArtBox")),b(p,"BleedBox",ne.of("BleedBox")),b(p,"CropBox",ne.of("CropBox")),b(p,"Rotate",ne.of("Rotate")),b(p,"Title",ne.of("Title")),b(p,"Author",ne.of("Author")),b(p,"Subject",ne.of("Subject")),b(p,"Creator",ne.of("Creator")),b(p,"Keywords",ne.of("Keywords")),b(p,"Producer",ne.of("Producer")),b(p,"CreationDate",ne.of("CreationDate")),b(p,"ModDate",ne.of("ModDate"));const Nn=class extends _e{constructor(e){super(),b(this,"value"),this.value=e}asBytes(){const e=this.value+(this.value.length%2===1?"0":""),t=e.length,n=new Uint8Array(e.length/2);let r=0,i=0;for(;r<t;){const o=parseInt(e.substring(r,r+2),16);n[i]=o,r+=2,i+=1}return n}decodeText(){const e=this.asBytes();return Do(e)?vo(e):xo(e)}decodeDate(){const e=this.decodeText(),t=yo(e);if(!t)throw new Po(e);return t}asString(){return this.value}clone(){return Nn.of(this.value)}toString(){return`<${this.value}>`}sizeInBytes(){return this.value.length+2}copyBytesInto(e,t){return e[t++]=m.LessThan,t+=be(this.value,e,t),e[t++]=m.GreaterThan,this.value.length+2}};let X=Nn;b(X,"of",e=>new Nn(e)),b(X,"fromText",e=>{const t=Nc(e);let n="";for(let r=0,i=t.length;r<i;r++)n+=bo(t[r],4);return new Nn(n)});/*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */const fl=4,No=0,Mo=1,ul=2;function Ct(e){let t=e.length;for(;--t>=0;)e[t]=0}const gl=0,Lo=1,pl=2,bl=3,ml=258,zr=29,Xt=256,Yt=Xt+1+zr,Bt=30,Fr=19,jo=2*Yt+1,ht=15,Nr=16,yl=7,Mr=256,Uo=16,$o=17,Ho=18,Lr=new Uint8Array([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]),Mn=new Uint8Array([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]),_l=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),Go=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),wl=512,qe=new Array((Yt+2)*2);Ct(qe);const Jt=new Array(Bt*2);Ct(Jt);const Qt=new Array(wl);Ct(Qt);const en=new Array(ml-bl+1);Ct(en);const jr=new Array(zr);Ct(jr);const Ln=new Array(Bt);Ct(Ln);function Ur(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}let Vo,Wo,Ko;function $r(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}const Zo=e=>e<256?Qt[e]:Qt[256+(e>>>7)],tn=(e,t)=>{e.pending_buf[e.pending++]=t&255,e.pending_buf[e.pending++]=t>>>8&255},xe=(e,t,n)=>{e.bi_valid>Nr-n?(e.bi_buf|=t<<e.bi_valid&65535,tn(e,e.bi_buf),e.bi_buf=t>>Nr-e.bi_valid,e.bi_valid+=n-Nr):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=n)},Le=(e,t,n)=>{xe(e,n[t*2],n[t*2+1])},qo=(e,t)=>{let n=0;do n|=e&1,e>>>=1,n<<=1;while(--t>0);return n>>>1},xl=e=>{e.bi_valid===16?(tn(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)},Sl=(e,t)=>{const n=t.dyn_tree,r=t.max_code,i=t.stat_desc.static_tree,o=t.stat_desc.has_stree,s=t.stat_desc.extra_bits,c=t.stat_desc.extra_base,l=t.stat_desc.max_length;let a,h,f,u,d,y,w=0;for(u=0;u<=ht;u++)e.bl_count[u]=0;for(n[e.heap[e.heap_max]*2+1]=0,a=e.heap_max+1;a<jo;a++)h=e.heap[a],u=n[n[h*2+1]*2+1]+1,u>l&&(u=l,w++),n[h*2+1]=u,!(h>r)&&(e.bl_count[u]++,d=0,h>=c&&(d=s[h-c]),y=n[h*2],e.opt_len+=y*(u+d),o&&(e.static_len+=y*(i[h*2+1]+d)));if(w!==0){do{for(u=l-1;e.bl_count[u]===0;)u--;e.bl_count[u]--,e.bl_count[u+1]+=2,e.bl_count[l]--,w-=2}while(w>0);for(u=l;u!==0;u--)for(h=e.bl_count[u];h!==0;)f=e.heap[--a],!(f>r)&&(n[f*2+1]!==u&&(e.opt_len+=(u-n[f*2+1])*n[f*2],n[f*2+1]=u),h--)}},Xo=(e,t,n)=>{const r=new Array(ht+1);let i=0,o,s;for(o=1;o<=ht;o++)i=i+n[o-1]<<1,r[o]=i;for(s=0;s<=t;s++){let c=e[s*2+1];c!==0&&(e[s*2]=qo(r[c]++,c))}},vl=()=>{let e,t,n,r,i;const o=new Array(ht+1);for(n=0,r=0;r<zr-1;r++)for(jr[r]=n,e=0;e<1<<Lr[r];e++)en[n++]=r;for(en[n-1]=r,i=0,r=0;r<16;r++)for(Ln[r]=i,e=0;e<1<<Mn[r];e++)Qt[i++]=r;for(i>>=7;r<Bt;r++)for(Ln[r]=i<<7,e=0;e<1<<Mn[r]-7;e++)Qt[256+i++]=r;for(t=0;t<=ht;t++)o[t]=0;for(e=0;e<=143;)qe[e*2+1]=8,e++,o[8]++;for(;e<=255;)qe[e*2+1]=9,e++,o[9]++;for(;e<=279;)qe[e*2+1]=7,e++,o[7]++;for(;e<=287;)qe[e*2+1]=8,e++,o[8]++;for(Xo(qe,Yt+1,o),e=0;e<Bt;e++)Jt[e*2+1]=5,Jt[e*2]=qo(e,5);Vo=new Ur(qe,Lr,Xt+1,Yt,ht),Wo=new Ur(Jt,Mn,0,Bt,ht),Ko=new Ur(new Array(0),_l,0,Fr,yl)},Yo=e=>{let t;for(t=0;t<Yt;t++)e.dyn_ltree[t*2]=0;for(t=0;t<Bt;t++)e.dyn_dtree[t*2]=0;for(t=0;t<Fr;t++)e.bl_tree[t*2]=0;e.dyn_ltree[Mr*2]=1,e.opt_len=e.static_len=0,e.sym_next=e.matches=0},Jo=e=>{e.bi_valid>8?tn(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0},Qo=(e,t,n,r)=>{const i=t*2,o=n*2;return e[i]<e[o]||e[i]===e[o]&&r[t]<=r[n]},Hr=(e,t,n)=>{const r=e.heap[n];let i=n<<1;for(;i<=e.heap_len&&(i<e.heap_len&&Qo(t,e.heap[i+1],e.heap[i],e.depth)&&i++,!Qo(t,r,e.heap[i],e.depth));)e.heap[n]=e.heap[i],n=i,i<<=1;e.heap[n]=r},es=(e,t,n)=>{let r,i,o=0,s,c;if(e.sym_next!==0)do r=e.pending_buf[e.sym_buf+o++]&255,r+=(e.pending_buf[e.sym_buf+o++]&255)<<8,i=e.pending_buf[e.sym_buf+o++],r===0?Le(e,i,t):(s=en[i],Le(e,s+Xt+1,t),c=Lr[s],c!==0&&(i-=jr[s],xe(e,i,c)),r--,s=Zo(r),Le(e,s,n),c=Mn[s],c!==0&&(r-=Ln[s],xe(e,r,c)));while(o<e.sym_next);Le(e,Mr,t)},Gr=(e,t)=>{const n=t.dyn_tree,r=t.stat_desc.static_tree,i=t.stat_desc.has_stree,o=t.stat_desc.elems;let s,c,l=-1,a;for(e.heap_len=0,e.heap_max=jo,s=0;s<o;s++)n[s*2]!==0?(e.heap[++e.heap_len]=l=s,e.depth[s]=0):n[s*2+1]=0;for(;e.heap_len<2;)a=e.heap[++e.heap_len]=l<2?++l:0,n[a*2]=1,e.depth[a]=0,e.opt_len--,i&&(e.static_len-=r[a*2+1]);for(t.max_code=l,s=e.heap_len>>1;s>=1;s--)Hr(e,n,s);a=o;do s=e.heap[1],e.heap[1]=e.heap[e.heap_len--],Hr(e,n,1),c=e.heap[1],e.heap[--e.heap_max]=s,e.heap[--e.heap_max]=c,n[a*2]=n[s*2]+n[c*2],e.depth[a]=(e.depth[s]>=e.depth[c]?e.depth[s]:e.depth[c])+1,n[s*2+1]=n[c*2+1]=a,e.heap[1]=a++,Hr(e,n,1);while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],Sl(e,t),Xo(n,l,e.bl_count)},ts=(e,t,n)=>{let r,i=-1,o,s=t[0*2+1],c=0,l=7,a=4;for(s===0&&(l=138,a=3),t[(n+1)*2+1]=65535,r=0;r<=n;r++)o=s,s=t[(r+1)*2+1],!(++c<l&&o===s)&&(c<a?e.bl_tree[o*2]+=c:o!==0?(o!==i&&e.bl_tree[o*2]++,e.bl_tree[Uo*2]++):c<=10?e.bl_tree[$o*2]++:e.bl_tree[Ho*2]++,c=0,i=o,s===0?(l=138,a=3):o===s?(l=6,a=3):(l=7,a=4))},ns=(e,t,n)=>{let r,i=-1,o,s=t[0*2+1],c=0,l=7,a=4;for(s===0&&(l=138,a=3),r=0;r<=n;r++)if(o=s,s=t[(r+1)*2+1],!(++c<l&&o===s)){if(c<a)do Le(e,o,e.bl_tree);while(--c!==0);else o!==0?(o!==i&&(Le(e,o,e.bl_tree),c--),Le(e,Uo,e.bl_tree),xe(e,c-3,2)):c<=10?(Le(e,$o,e.bl_tree),xe(e,c-3,3)):(Le(e,Ho,e.bl_tree),xe(e,c-11,7));c=0,i=o,s===0?(l=138,a=3):o===s?(l=6,a=3):(l=7,a=4)}},kl=e=>{let t;for(ts(e,e.dyn_ltree,e.l_desc.max_code),ts(e,e.dyn_dtree,e.d_desc.max_code),Gr(e,e.bl_desc),t=Fr-1;t>=3&&e.bl_tree[Go[t]*2+1]===0;t--);return e.opt_len+=3*(t+1)+5+5+4,t},Al=(e,t,n,r)=>{let i;for(xe(e,t-257,5),xe(e,n-1,5),xe(e,r-4,4),i=0;i<r;i++)xe(e,e.bl_tree[Go[i]*2+1],3);ns(e,e.dyn_ltree,t-1),ns(e,e.dyn_dtree,n-1)},Cl=e=>{let t=4093624447,n;for(n=0;n<=31;n++,t>>>=1)if(t&1&&e.dyn_ltree[n*2]!==0)return No;if(e.dyn_ltree[9*2]!==0||e.dyn_ltree[10*2]!==0||e.dyn_ltree[13*2]!==0)return Mo;for(n=32;n<Xt;n++)if(e.dyn_ltree[n*2]!==0)return Mo;return No};let rs=!1;const Bl=e=>{rs||(vl(),rs=!0),e.l_desc=new $r(e.dyn_ltree,Vo),e.d_desc=new $r(e.dyn_dtree,Wo),e.bl_desc=new $r(e.bl_tree,Ko),e.bi_buf=0,e.bi_valid=0,Yo(e)},is=(e,t,n,r)=>{xe(e,(gl<<1)+(r?1:0),3),Jo(e),tn(e,n),tn(e,~n),n&&e.pending_buf.set(e.window.subarray(t,t+n),e.pending),e.pending+=n},Dl=e=>{xe(e,Lo<<1,3),Le(e,Mr,qe),xl(e)},Tl=(e,t,n,r)=>{let i,o,s=0;e.level>0?(e.strm.data_type===ul&&(e.strm.data_type=Cl(e)),Gr(e,e.l_desc),Gr(e,e.d_desc),s=kl(e),i=e.opt_len+3+7>>>3,o=e.static_len+3+7>>>3,o<=i&&(i=o)):i=o=n+5,n+4<=i&&t!==-1?is(e,t,n,r):e.strategy===fl||o===i?(xe(e,(Lo<<1)+(r?1:0),3),es(e,qe,Jt)):(xe(e,(pl<<1)+(r?1:0),3),Al(e,e.l_desc.max_code+1,e.d_desc.max_code+1,s+1),es(e,e.dyn_ltree,e.dyn_dtree)),Yo(e),r&&Jo(e)},El=(e,t,n)=>(e.pending_buf[e.sym_buf+e.sym_next++]=t,e.pending_buf[e.sym_buf+e.sym_next++]=t>>8,e.pending_buf[e.sym_buf+e.sym_next++]=n,t===0?e.dyn_ltree[n*2]++:(e.matches++,t--,e.dyn_ltree[(en[n]+Xt+1)*2]++,e.dyn_dtree[Zo(t)*2]++),e.sym_next===e.sym_end);var Pl=Bl,Rl=is,Il=Tl,Ol=El,zl=Dl,Fl={_tr_init:Pl,_tr_stored_block:Rl,_tr_flush_block:Il,_tr_tally:Ol,_tr_align:zl},nn=(e,t,n,r)=>{let i=e&65535|0,o=e>>>16&65535|0,s=0;for(;n!==0;){s=n>2e3?2e3:n,n-=s;do i=i+t[r++]|0,o=o+i|0;while(--s);i%=65521,o%=65521}return i|o<<16|0};const Nl=()=>{let e,t=[];for(var 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},Ml=new Uint32Array(Nl());var ge=(e,t,n,r)=>{const i=Ml,o=r+n;e^=-1;for(let s=r;s<o;s++)e=e>>>8^i[(e^t[s])&255];return e^-1},dt={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"},ft={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_MEM_ERROR:-4,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};const{_tr_init:Ll,_tr_stored_block:Vr,_tr_flush_block:jl,_tr_tally:nt,_tr_align:Ul}=Fl,{Z_NO_FLUSH:rt,Z_PARTIAL_FLUSH:$l,Z_FULL_FLUSH:Hl,Z_FINISH:Ee,Z_BLOCK:os,Z_OK:me,Z_STREAM_END:ss,Z_STREAM_ERROR:je,Z_DATA_ERROR:Gl,Z_BUF_ERROR:Wr,Z_DEFAULT_COMPRESSION:Vl,Z_FILTERED:Wl,Z_HUFFMAN_ONLY:jn,Z_RLE:Kl,Z_FIXED:Zl,Z_DEFAULT_STRATEGY:ql,Z_UNKNOWN:Xl,Z_DEFLATED:Un}=ft,Yl=9,Jl=15,Ql=8,eh=29,Kr=256+1+eh,th=30,nh=19,rh=2*Kr+1,ih=15,Y=3,it=258,Ue=it+Y+1,oh=32,Dt=42,Zr=57,qr=69,Xr=73,Yr=91,Jr=103,ut=113,rn=666,we=1,Tt=2,gt=3,Et=4,sh=3,pt=(e,t)=>(e.msg=dt[t],t),as=e=>e*2-(e>4?9:0),ot=e=>{let t=e.length;for(;--t>=0;)e[t]=0},ah=e=>{let t,n,r,i=e.w_size;t=e.hash_size,r=t;do n=e.head[--r],e.head[r]=n>=i?n-i:0;while(--t);t=i,r=t;do n=e.prev[--r],e.prev[r]=n>=i?n-i:0;while(--t)};let st=(e,t,n)=>(t<<e.hash_shift^n)&e.hash_mask;const Ae=e=>{const t=e.state;let n=t.pending;n>e.avail_out&&(n=e.avail_out),n!==0&&(e.output.set(t.pending_buf.subarray(t.pending_out,t.pending_out+n),e.next_out),e.next_out+=n,t.pending_out+=n,e.total_out+=n,e.avail_out-=n,t.pending-=n,t.pending===0&&(t.pending_out=0))},Ce=(e,t)=>{jl(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,Ae(e.strm)},Q=(e,t)=>{e.pending_buf[e.pending++]=t},on=(e,t)=>{e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=t&255},Qr=(e,t,n,r)=>{let i=e.avail_in;return i>r&&(i=r),i===0?0:(e.avail_in-=i,t.set(e.input.subarray(e.next_in,e.next_in+i),n),e.state.wrap===1?e.adler=nn(e.adler,t,i,n):e.state.wrap===2&&(e.adler=ge(e.adler,t,i,n)),e.next_in+=i,e.total_in+=i,i)},cs=(e,t)=>{let n=e.max_chain_length,r=e.strstart,i,o,s=e.prev_length,c=e.nice_match;const l=e.strstart>e.w_size-Ue?e.strstart-(e.w_size-Ue):0,a=e.window,h=e.w_mask,f=e.prev,u=e.strstart+it;let d=a[r+s-1],y=a[r+s];e.prev_length>=e.good_match&&(n>>=2),c>e.lookahead&&(c=e.lookahead);do if(i=t,!(a[i+s]!==y||a[i+s-1]!==d||a[i]!==a[r]||a[++i]!==a[r+1])){r+=2,i++;do;while(a[++r]===a[++i]&&a[++r]===a[++i]&&a[++r]===a[++i]&&a[++r]===a[++i]&&a[++r]===a[++i]&&a[++r]===a[++i]&&a[++r]===a[++i]&&a[++r]===a[++i]&&r<u);if(o=it-(u-r),r=u-it,o>s){if(e.match_start=t,s=o,o>=c)break;d=a[r+s-1],y=a[r+s]}}while((t=f[t&h])>l&&--n!==0);return s<=e.lookahead?s:e.lookahead},Pt=e=>{const t=e.w_size;let n,r,i;do{if(r=e.window_size-e.lookahead-e.strstart,e.strstart>=t+(t-Ue)&&(e.window.set(e.window.subarray(t,t+t-r),0),e.match_start-=t,e.strstart-=t,e.block_start-=t,e.insert>e.strstart&&(e.insert=e.strstart),ah(e),r+=t),e.strm.avail_in===0)break;if(n=Qr(e.strm,e.window,e.strstart+e.lookahead,r),e.lookahead+=n,e.lookahead+e.insert>=Y)for(i=e.strstart-e.insert,e.ins_h=e.window[i],e.ins_h=st(e,e.ins_h,e.window[i+1]);e.insert&&(e.ins_h=st(e,e.ins_h,e.window[i+Y-1]),e.prev[i&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=i,i++,e.insert--,!(e.lookahead+e.insert<Y)););}while(e.lookahead<Ue&&e.strm.avail_in!==0)},ls=(e,t)=>{let n=e.pending_buf_size-5>e.w_size?e.w_size:e.pending_buf_size-5,r,i,o,s=0,c=e.strm.avail_in;do{if(r=65535,o=e.bi_valid+42>>3,e.strm.avail_out<o||(o=e.strm.avail_out-o,i=e.strstart-e.block_start,r>i+e.strm.avail_in&&(r=i+e.strm.avail_in),r>o&&(r=o),r<n&&(r===0&&t!==Ee||t===rt||r!==i+e.strm.avail_in)))break;s=t===Ee&&r===i+e.strm.avail_in?1:0,Vr(e,0,0,s),e.pending_buf[e.pending-4]=r,e.pending_buf[e.pending-3]=r>>8,e.pending_buf[e.pending-2]=~r,e.pending_buf[e.pending-1]=~r>>8,Ae(e.strm),i&&(i>r&&(i=r),e.strm.output.set(e.window.subarray(e.block_start,e.block_start+i),e.strm.next_out),e.strm.next_out+=i,e.strm.avail_out-=i,e.strm.total_out+=i,e.block_start+=i,r-=i),r&&(Qr(e.strm,e.strm.output,e.strm.next_out,r),e.strm.next_out+=r,e.strm.avail_out-=r,e.strm.total_out+=r)}while(s===0);return c-=e.strm.avail_in,c&&(c>=e.w_size?(e.matches=2,e.window.set(e.strm.input.subarray(e.strm.next_in-e.w_size,e.strm.next_in),0),e.strstart=e.w_size,e.insert=e.strstart):(e.window_size-e.strstart<=c&&(e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,e.insert>e.strstart&&(e.insert=e.strstart)),e.window.set(e.strm.input.subarray(e.strm.next_in-c,e.strm.next_in),e.strstart),e.strstart+=c,e.insert+=c>e.w_size-e.insert?e.w_size-e.insert:c),e.block_start=e.strstart),e.high_water<e.strstart&&(e.high_water=e.strstart),s?Et:t!==rt&&t!==Ee&&e.strm.avail_in===0&&e.strstart===e.block_start?Tt:(o=e.window_size-e.strstart,e.strm.avail_in>o&&e.block_start>=e.w_size&&(e.block_start-=e.w_size,e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,o+=e.w_size,e.insert>e.strstart&&(e.insert=e.strstart)),o>e.strm.avail_in&&(o=e.strm.avail_in),o&&(Qr(e.strm,e.window,e.strstart,o),e.strstart+=o,e.insert+=o>e.w_size-e.insert?e.w_size-e.insert:o),e.high_water<e.strstart&&(e.high_water=e.strstart),o=e.bi_valid+42>>3,o=e.pending_buf_size-o>65535?65535:e.pending_buf_size-o,n=o>e.w_size?e.w_size:o,i=e.strstart-e.block_start,(i>=n||(i||t===Ee)&&t!==rt&&e.strm.avail_in===0&&i<=o)&&(r=i>o?o:i,s=t===Ee&&e.strm.avail_in===0&&r===i?1:0,Vr(e,e.block_start,r,s),e.block_start+=r,Ae(e.strm)),s?gt:we)},ei=(e,t)=>{let n,r;for(;;){if(e.lookahead<Ue){if(Pt(e),e.lookahead<Ue&&t===rt)return we;if(e.lookahead===0)break}if(n=0,e.lookahead>=Y&&(e.ins_h=st(e,e.ins_h,e.window[e.strstart+Y-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),n!==0&&e.strstart-n<=e.w_size-Ue&&(e.match_length=cs(e,n)),e.match_length>=Y)if(r=nt(e,e.strstart-e.match_start,e.match_length-Y),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=Y){e.match_length--;do e.strstart++,e.ins_h=st(e,e.ins_h,e.window[e.strstart+Y-1]),n=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=st(e,e.ins_h,e.window[e.strstart+1]);else r=nt(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(r&&(Ce(e,!1),e.strm.avail_out===0))return we}return e.insert=e.strstart<Y-1?e.strstart:Y-1,t===Ee?(Ce(e,!0),e.strm.avail_out===0?gt:Et):e.sym_next&&(Ce(e,!1),e.strm.avail_out===0)?we:Tt},Rt=(e,t)=>{let n,r,i;for(;;){if(e.lookahead<Ue){if(Pt(e),e.lookahead<Ue&&t===rt)return we;if(e.lookahead===0)break}if(n=0,e.lookahead>=Y&&(e.ins_h=st(e,e.ins_h,e.window[e.strstart+Y-1]),n=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=Y-1,n!==0&&e.prev_length<e.max_lazy_match&&e.strstart-n<=e.w_size-Ue&&(e.match_length=cs(e,n),e.match_length<=5&&(e.strategy===Wl||e.match_length===Y&&e.strstart-e.match_start>4096)&&(e.match_length=Y-1)),e.prev_length>=Y&&e.match_length<=e.prev_length){i=e.strstart+e.lookahead-Y,r=nt(e,e.strstart-1-e.prev_match,e.prev_length-Y),e.lookahead-=e.prev_length-1,e.prev_length-=2;do++e.strstart<=i&&(e.ins_h=st(e,e.ins_h,e.window[e.strstart+Y-1]),n=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=Y-1,e.strstart++,r&&(Ce(e,!1),e.strm.avail_out===0))return we}else if(e.match_available){if(r=nt(e,0,e.window[e.strstart-1]),r&&Ce(e,!1),e.strstart++,e.lookahead--,e.strm.avail_out===0)return we}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(r=nt(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<Y-1?e.strstart:Y-1,t===Ee?(Ce(e,!0),e.strm.avail_out===0?gt:Et):e.sym_next&&(Ce(e,!1),e.strm.avail_out===0)?we:Tt},ch=(e,t)=>{let n,r,i,o;const s=e.window;for(;;){if(e.lookahead<=it){if(Pt(e),e.lookahead<=it&&t===rt)return we;if(e.lookahead===0)break}if(e.match_length=0,e.lookahead>=Y&&e.strstart>0&&(i=e.strstart-1,r=s[i],r===s[++i]&&r===s[++i]&&r===s[++i])){o=e.strstart+it;do;while(r===s[++i]&&r===s[++i]&&r===s[++i]&&r===s[++i]&&r===s[++i]&&r===s[++i]&&r===s[++i]&&r===s[++i]&&i<o);e.match_length=it-(o-i),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=Y?(n=nt(e,1,e.match_length-Y),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(n=nt(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),n&&(Ce(e,!1),e.strm.avail_out===0))return we}return e.insert=0,t===Ee?(Ce(e,!0),e.strm.avail_out===0?gt:Et):e.sym_next&&(Ce(e,!1),e.strm.avail_out===0)?we:Tt},lh=(e,t)=>{let n;for(;;){if(e.lookahead===0&&(Pt(e),e.lookahead===0)){if(t===rt)return we;break}if(e.match_length=0,n=nt(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,n&&(Ce(e,!1),e.strm.avail_out===0))return we}return e.insert=0,t===Ee?(Ce(e,!0),e.strm.avail_out===0?gt:Et):e.sym_next&&(Ce(e,!1),e.strm.avail_out===0)?we:Tt};function $e(e,t,n,r,i){this.good_length=e,this.max_lazy=t,this.nice_length=n,this.max_chain=r,this.func=i}const sn=[new $e(0,0,0,0,ls),new $e(4,4,8,4,ei),new $e(4,5,16,8,ei),new $e(4,6,32,32,ei),new $e(4,4,16,16,Rt),new $e(8,16,32,32,Rt),new $e(8,16,128,128,Rt),new $e(8,32,128,256,Rt),new $e(32,128,258,1024,Rt),new $e(32,258,258,4096,Rt)],hh=e=>{e.window_size=2*e.w_size,ot(e.head),e.max_lazy_match=sn[e.level].max_lazy,e.good_match=sn[e.level].good_length,e.nice_match=sn[e.level].nice_length,e.max_chain_length=sn[e.level].max_chain,e.strstart=0,e.block_start=0,e.lookahead=0,e.insert=0,e.match_length=e.prev_length=Y-1,e.match_available=0,e.ins_h=0};function dh(){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=Un,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 Uint16Array(rh*2),this.dyn_dtree=new Uint16Array((2*th+1)*2),this.bl_tree=new Uint16Array((2*nh+1)*2),ot(this.dyn_ltree),ot(this.dyn_dtree),ot(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(ih+1),this.heap=new Uint16Array(2*Kr+1),ot(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(2*Kr+1),ot(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}const an=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.status!==Dt&&t.status!==Zr&&t.status!==qr&&t.status!==Xr&&t.status!==Yr&&t.status!==Jr&&t.status!==ut&&t.status!==rn?1:0},hs=e=>{if(an(e))return pt(e,je);e.total_in=e.total_out=0,e.data_type=Xl;const t=e.state;return t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap===2?Zr:t.wrap?Dt:ut,e.adler=t.wrap===2?0:1,t.last_flush=-2,Ll(t),me},ds=e=>{const t=hs(e);return t===me&&hh(e.state),t},fh=(e,t)=>an(e)||e.state.wrap!==2?je:(e.state.gzhead=t,me),fs=(e,t,n,r,i,o)=>{if(!e)return je;let s=1;if(t===Vl&&(t=6),r<0?(s=0,r=-r):r>15&&(s=2,r-=16),i<1||i>Yl||n!==Un||r<8||r>15||t<0||t>9||o<0||o>Zl||r===8&&s!==1)return pt(e,je);r===8&&(r=9);const c=new dh;return e.state=c,c.strm=e,c.status=Dt,c.wrap=s,c.gzhead=null,c.w_bits=r,c.w_size=1<<c.w_bits,c.w_mask=c.w_size-1,c.hash_bits=i+7,c.hash_size=1<<c.hash_bits,c.hash_mask=c.hash_size-1,c.hash_shift=~~((c.hash_bits+Y-1)/Y),c.window=new Uint8Array(c.w_size*2),c.head=new Uint16Array(c.hash_size),c.prev=new Uint16Array(c.w_size),c.lit_bufsize=1<<i+6,c.pending_buf_size=c.lit_bufsize*4,c.pending_buf=new Uint8Array(c.pending_buf_size),c.sym_buf=c.lit_bufsize,c.sym_end=(c.lit_bufsize-1)*3,c.level=t,c.strategy=o,c.method=n,ds(e)},uh=(e,t)=>fs(e,t,Un,Jl,Ql,ql),gh=(e,t)=>{if(an(e)||t>os||t<0)return e?pt(e,je):je;const n=e.state;if(!e.output||e.avail_in!==0&&!e.input||n.status===rn&&t!==Ee)return pt(e,e.avail_out===0?Wr:je);const r=n.last_flush;if(n.last_flush=t,n.pending!==0){if(Ae(e),e.avail_out===0)return n.last_flush=-1,me}else if(e.avail_in===0&&as(t)<=as(r)&&t!==Ee)return pt(e,Wr);if(n.status===rn&&e.avail_in!==0)return pt(e,Wr);if(n.status===Dt&&n.wrap===0&&(n.status=ut),n.status===Dt){let i=Un+(n.w_bits-8<<4)<<8,o=-1;if(n.strategy>=jn||n.level<2?o=0:n.level<6?o=1:n.level===6?o=2:o=3,i|=o<<6,n.strstart!==0&&(i|=oh),i+=31-i%31,on(n,i),n.strstart!==0&&(on(n,e.adler>>>16),on(n,e.adler&65535)),e.adler=1,n.status=ut,Ae(e),n.pending!==0)return n.last_flush=-1,me}if(n.status===Zr){if(e.adler=0,Q(n,31),Q(n,139),Q(n,8),n.gzhead)Q(n,(n.gzhead.text?1:0)+(n.gzhead.hcrc?2:0)+(n.gzhead.extra?4:0)+(n.gzhead.name?8:0)+(n.gzhead.comment?16:0)),Q(n,n.gzhead.time&255),Q(n,n.gzhead.time>>8&255),Q(n,n.gzhead.time>>16&255),Q(n,n.gzhead.time>>24&255),Q(n,n.level===9?2:n.strategy>=jn||n.level<2?4:0),Q(n,n.gzhead.os&255),n.gzhead.extra&&n.gzhead.extra.length&&(Q(n,n.gzhead.extra.length&255),Q(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=ge(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=qr;else if(Q(n,0),Q(n,0),Q(n,0),Q(n,0),Q(n,0),Q(n,n.level===9?2:n.strategy>=jn||n.level<2?4:0),Q(n,sh),n.status=ut,Ae(e),n.pending!==0)return n.last_flush=-1,me}if(n.status===qr){if(n.gzhead.extra){let i=n.pending,o=(n.gzhead.extra.length&65535)-n.gzindex;for(;n.pending+o>n.pending_buf_size;){let c=n.pending_buf_size-n.pending;if(n.pending_buf.set(n.gzhead.extra.subarray(n.gzindex,n.gzindex+c),n.pending),n.pending=n.pending_buf_size,n.gzhead.hcrc&&n.pending>i&&(e.adler=ge(e.adler,n.pending_buf,n.pending-i,i)),n.gzindex+=c,Ae(e),n.pending!==0)return n.last_flush=-1,me;i=0,o-=c}let s=new Uint8Array(n.gzhead.extra);n.pending_buf.set(s.subarray(n.gzindex,n.gzindex+o),n.pending),n.pending+=o,n.gzhead.hcrc&&n.pending>i&&(e.adler=ge(e.adler,n.pending_buf,n.pending-i,i)),n.gzindex=0}n.status=Xr}if(n.status===Xr){if(n.gzhead.name){let i=n.pending,o;do{if(n.pending===n.pending_buf_size){if(n.gzhead.hcrc&&n.pending>i&&(e.adler=ge(e.adler,n.pending_buf,n.pending-i,i)),Ae(e),n.pending!==0)return n.last_flush=-1,me;i=0}n.gzindex<n.gzhead.name.length?o=n.gzhead.name.charCodeAt(n.gzindex++)&255:o=0,Q(n,o)}while(o!==0);n.gzhead.hcrc&&n.pending>i&&(e.adler=ge(e.adler,n.pending_buf,n.pending-i,i)),n.gzindex=0}n.status=Yr}if(n.status===Yr){if(n.gzhead.comment){let i=n.pending,o;do{if(n.pending===n.pending_buf_size){if(n.gzhead.hcrc&&n.pending>i&&(e.adler=ge(e.adler,n.pending_buf,n.pending-i,i)),Ae(e),n.pending!==0)return n.last_flush=-1,me;i=0}n.gzindex<n.gzhead.comment.length?o=n.gzhead.comment.charCodeAt(n.gzindex++)&255:o=0,Q(n,o)}while(o!==0);n.gzhead.hcrc&&n.pending>i&&(e.adler=ge(e.adler,n.pending_buf,n.pending-i,i))}n.status=Jr}if(n.status===Jr){if(n.gzhead.hcrc){if(n.pending+2>n.pending_buf_size&&(Ae(e),n.pending!==0))return n.last_flush=-1,me;Q(n,e.adler&255),Q(n,e.adler>>8&255),e.adler=0}if(n.status=ut,Ae(e),n.pending!==0)return n.last_flush=-1,me}if(e.avail_in!==0||n.lookahead!==0||t!==rt&&n.status!==rn){let i=n.level===0?ls(n,t):n.strategy===jn?lh(n,t):n.strategy===Kl?ch(n,t):sn[n.level].func(n,t);if((i===gt||i===Et)&&(n.status=rn),i===we||i===gt)return e.avail_out===0&&(n.last_flush=-1),me;if(i===Tt&&(t===$l?Ul(n):t!==os&&(Vr(n,0,0,!1),t===Hl&&(ot(n.head),n.lookahead===0&&(n.strstart=0,n.block_start=0,n.insert=0))),Ae(e),e.avail_out===0))return n.last_flush=-1,me}return t!==Ee?me:n.wrap<=0?ss:(n.wrap===2?(Q(n,e.adler&255),Q(n,e.adler>>8&255),Q(n,e.adler>>16&255),Q(n,e.adler>>24&255),Q(n,e.total_in&255),Q(n,e.total_in>>8&255),Q(n,e.total_in>>16&255),Q(n,e.total_in>>24&255)):(on(n,e.adler>>>16),on(n,e.adler&65535)),Ae(e),n.wrap>0&&(n.wrap=-n.wrap),n.pending!==0?me:ss)},ph=e=>{if(an(e))return je;const t=e.state.status;return e.state=null,t===ut?pt(e,Gl):me},bh=(e,t)=>{let n=t.length;if(an(e))return je;const r=e.state,i=r.wrap;if(i===2||i===1&&r.status!==Dt||r.lookahead)return je;if(i===1&&(e.adler=nn(e.adler,t,n,0)),r.wrap=0,n>=r.w_size){i===0&&(ot(r.head),r.strstart=0,r.block_start=0,r.insert=0);let l=new Uint8Array(r.w_size);l.set(t.subarray(n-r.w_size,n),0),t=l,n=r.w_size}const o=e.avail_in,s=e.next_in,c=e.input;for(e.avail_in=n,e.next_in=0,e.input=t,Pt(r);r.lookahead>=Y;){let l=r.strstart,a=r.lookahead-(Y-1);do r.ins_h=st(r,r.ins_h,r.window[l+Y-1]),r.prev[l&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=l,l++;while(--a);r.strstart=l,r.lookahead=Y-1,Pt(r)}return r.strstart+=r.lookahead,r.block_start=r.strstart,r.insert=r.lookahead,r.lookahead=0,r.match_length=r.prev_length=Y-1,r.match_available=0,e.next_in=s,e.input=c,e.avail_in=o,r.wrap=i,me};var mh=uh,yh=fs,_h=ds,wh=hs,xh=fh,Sh=gh,vh=ph,kh=bh,Ah="pako deflate (from Nodeca project)",cn={deflateInit:mh,deflateInit2:yh,deflateReset:_h,deflateResetKeep:wh,deflateSetHeader:xh,deflate:Sh,deflateEnd:vh,deflateSetDictionary:kh,deflateInfo:Ah};const Ch=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var Bh=function(e){const t=Array.prototype.slice.call(arguments,1);for(;t.length;){const n=t.shift();if(!!n){if(typeof n!="object")throw new TypeError(n+"must be non-object");for(const r in n)Ch(n,r)&&(e[r]=n[r])}}return e},Dh=e=>{let t=0;for(let r=0,i=e.length;r<i;r++)t+=e[r].length;const n=new Uint8Array(t);for(let r=0,i=0,o=e.length;r<o;r++){let s=e[r];n.set(s,i),i+=s.length}return n},$n={assign:Bh,flattenChunks:Dh};let us=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{us=!1}const ln=new Uint8Array(256);for(let e=0;e<256;e++)ln[e]=e>=252?6:e>=248?5:e>=240?4:e>=224?3:e>=192?2:1;ln[254]=ln[254]=1;var Th=e=>{if(typeof TextEncoder=="function"&&TextEncoder.prototype.encode)return new TextEncoder().encode(e);let t,n,r,i,o,s=e.length,c=0;for(i=0;i<s;i++)n=e.charCodeAt(i),(n&64512)===55296&&i+1<s&&(r=e.charCodeAt(i+1),(r&64512)===56320&&(n=65536+(n-55296<<10)+(r-56320),i++)),c+=n<128?1:n<2048?2:n<65536?3:4;for(t=new Uint8Array(c),o=0,i=0;o<c;i++)n=e.charCodeAt(i),(n&64512)===55296&&i+1<s&&(r=e.charCodeAt(i+1),(r&64512)===56320&&(n=65536+(n-55296<<10)+(r-56320),i++)),n<128?t[o++]=n:n<2048?(t[o++]=192|n>>>6,t[o++]=128|n&63):n<65536?(t[o++]=224|n>>>12,t[o++]=128|n>>>6&63,t[o++]=128|n&63):(t[o++]=240|n>>>18,t[o++]=128|n>>>12&63,t[o++]=128|n>>>6&63,t[o++]=128|n&63);return t};const Eh=(e,t)=>{if(t<65534&&e.subarray&&us)return String.fromCharCode.apply(null,e.length===t?e:e.subarray(0,t));let n="";for(let r=0;r<t;r++)n+=String.fromCharCode(e[r]);return n};var Ph=(e,t)=>{const n=t||e.length;if(typeof TextDecoder=="function"&&TextDecoder.prototype.decode)return new TextDecoder().decode(e.subarray(0,t));let r,i;const o=new Array(n*2);for(i=0,r=0;r<n;){let s=e[r++];if(s<128){o[i++]=s;continue}let c=ln[s];if(c>4){o[i++]=65533,r+=c-1;continue}for(s&=c===2?31:c===3?15:7;c>1&&r<n;)s=s<<6|e[r++]&63,c--;if(c>1){o[i++]=65533;continue}s<65536?o[i++]=s:(s-=65536,o[i++]=55296|s>>10&1023,o[i++]=56320|s&1023)}return Eh(o,i)},Rh=(e,t)=>{t=t||e.length,t>e.length&&(t=e.length);let n=t-1;for(;n>=0&&(e[n]&192)===128;)n--;return n<0||n===0?t:n+ln[e[n]]>t?n:t},hn={string2buf:Th,buf2string:Ph,utf8border:Rh};function Ih(){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}var gs=Ih;const ps=Object.prototype.toString,{Z_NO_FLUSH:Oh,Z_SYNC_FLUSH:zh,Z_FULL_FLUSH:Fh,Z_FINISH:Nh,Z_OK:Hn,Z_STREAM_END:Mh,Z_DEFAULT_COMPRESSION:Lh,Z_DEFAULT_STRATEGY:jh,Z_DEFLATED:Uh}=ft;function dn(e){this.options=$n.assign({level:Lh,method:Uh,chunkSize:16384,windowBits:15,memLevel:8,strategy:jh},e||{});let t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new gs,this.strm.avail_out=0;let n=cn.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(n!==Hn)throw new Error(dt[n]);if(t.header&&cn.deflateSetHeader(this.strm,t.header),t.dictionary){let r;if(typeof t.dictionary=="string"?r=hn.string2buf(t.dictionary):ps.call(t.dictionary)==="[object ArrayBuffer]"?r=new Uint8Array(t.dictionary):r=t.dictionary,n=cn.deflateSetDictionary(this.strm,r),n!==Hn)throw new Error(dt[n]);this._dict_set=!0}}dn.prototype.push=function(e,t){const n=this.strm,r=this.options.chunkSize;let i,o;if(this.ended)return!1;for(t===~~t?o=t:o=t===!0?Nh:Oh,typeof e=="string"?n.input=hn.string2buf(e):ps.call(e)==="[object ArrayBuffer]"?n.input=new Uint8Array(e):n.input=e,n.next_in=0,n.avail_in=n.input.length;;){if(n.avail_out===0&&(n.output=new Uint8Array(r),n.next_out=0,n.avail_out=r),(o===zh||o===Fh)&&n.avail_out<=6){this.onData(n.output.subarray(0,n.next_out)),n.avail_out=0;continue}if(i=cn.deflate(n,o),i===Mh)return n.next_out>0&&this.onData(n.output.subarray(0,n.next_out)),i=cn.deflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===Hn;if(n.avail_out===0){this.onData(n.output);continue}if(o>0&&n.next_out>0){this.onData(n.output.subarray(0,n.next_out)),n.avail_out=0;continue}if(n.avail_in===0)break}return!0},dn.prototype.onData=function(e){this.chunks.push(e)},dn.prototype.onEnd=function(e){e===Hn&&(this.result=$n.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function ti(e,t){const n=new dn(t);if(n.push(e,!0),n.err)throw n.msg||dt[n.err];return n.result}function $h(e,t){return t=t||{},t.raw=!0,ti(e,t)}function Hh(e,t){return t=t||{},t.gzip=!0,ti(e,t)}var Gh=dn,Vh=ti,Wh=$h,Kh=Hh,Zh=ft,qh={Deflate:Gh,deflate:Vh,deflateRaw:Wh,gzip:Kh,constants:Zh};const Gn=16209,Xh=16191;var Yh=function(t,n){let r,i,o,s,c,l,a,h,f,u,d,y,w,x,_,E,v,S,z,C,k,F,I,T;const R=t.state;r=t.next_in,I=t.input,i=r+(t.avail_in-5),o=t.next_out,T=t.output,s=o-(n-t.avail_out),c=o+(t.avail_out-257),l=R.dmax,a=R.wsize,h=R.whave,f=R.wnext,u=R.window,d=R.hold,y=R.bits,w=R.lencode,x=R.distcode,_=(1<<R.lenbits)-1,E=(1<<R.distbits)-1;e:do{y<15&&(d+=I[r++]<<y,y+=8,d+=I[r++]<<y,y+=8),v=w[d&_];t:for(;;){if(S=v>>>24,d>>>=S,y-=S,S=v>>>16&255,S===0)T[o++]=v&65535;else if(S&16){z=v&65535,S&=15,S&&(y<S&&(d+=I[r++]<<y,y+=8),z+=d&(1<<S)-1,d>>>=S,y-=S),y<15&&(d+=I[r++]<<y,y+=8,d+=I[r++]<<y,y+=8),v=x[d&E];n:for(;;){if(S=v>>>24,d>>>=S,y-=S,S=v>>>16&255,S&16){if(C=v&65535,S&=15,y<S&&(d+=I[r++]<<y,y+=8,y<S&&(d+=I[r++]<<y,y+=8)),C+=d&(1<<S)-1,C>l){t.msg="invalid distance too far back",R.mode=Gn;break e}if(d>>>=S,y-=S,S=o-s,C>S){if(S=C-S,S>h&&R.sane){t.msg="invalid distance too far back",R.mode=Gn;break e}if(k=0,F=u,f===0){if(k+=a-S,S<z){z-=S;do T[o++]=u[k++];while(--S);k=o-C,F=T}}else if(f<S){if(k+=a+f-S,S-=f,S<z){z-=S;do T[o++]=u[k++];while(--S);if(k=0,f<z){S=f,z-=S;do T[o++]=u[k++];while(--S);k=o-C,F=T}}}else if(k+=f-S,S<z){z-=S;do T[o++]=u[k++];while(--S);k=o-C,F=T}for(;z>2;)T[o++]=F[k++],T[o++]=F[k++],T[o++]=F[k++],z-=3;z&&(T[o++]=F[k++],z>1&&(T[o++]=F[k++]))}else{k=o-C;do T[o++]=T[k++],T[o++]=T[k++],T[o++]=T[k++],z-=3;while(z>2);z&&(T[o++]=T[k++],z>1&&(T[o++]=T[k++]))}}else if((S&64)===0){v=x[(v&65535)+(d&(1<<S)-1)];continue n}else{t.msg="invalid distance code",R.mode=Gn;break e}break}}else if((S&64)===0){v=w[(v&65535)+(d&(1<<S)-1)];continue t}else if(S&32){R.mode=Xh;break e}else{t.msg="invalid literal/length code",R.mode=Gn;break e}break}}while(r<i&&o<c);z=y>>3,r-=z,y-=z<<3,d&=(1<<y)-1,t.next_in=r,t.next_out=o,t.avail_in=r<i?5+(i-r):5-(r-i),t.avail_out=o<c?257+(c-o):257-(o-c),R.hold=d,R.bits=y};const It=15,bs=852,ms=592,ys=0,ni=1,_s=2,Jh=new Uint16Array([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]),Qh=new Uint8Array([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]),ed=new Uint16Array([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]),td=new Uint8Array([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]);var fn=(e,t,n,r,i,o,s,c)=>{const l=c.bits;let a=0,h=0,f=0,u=0,d=0,y=0,w=0,x=0,_=0,E=0,v,S,z,C,k,F=null,I;const T=new Uint16Array(It+1),R=new Uint16Array(It+1);let J=null,N,O,P;for(a=0;a<=It;a++)T[a]=0;for(h=0;h<r;h++)T[t[n+h]]++;for(d=l,u=It;u>=1&&T[u]===0;u--);if(d>u&&(d=u),u===0)return i[o++]=1<<24|64<<16|0,i[o++]=1<<24|64<<16|0,c.bits=1,0;for(f=1;f<u&&T[f]===0;f++);for(d<f&&(d=f),x=1,a=1;a<=It;a++)if(x<<=1,x-=T[a],x<0)return-1;if(x>0&&(e===ys||u!==1))return-1;for(R[1]=0,a=1;a<It;a++)R[a+1]=R[a]+T[a];for(h=0;h<r;h++)t[n+h]!==0&&(s[R[t[n+h]]++]=h);if(e===ys?(F=J=s,I=20):e===ni?(F=Jh,J=Qh,I=257):(F=ed,J=td,I=0),E=0,h=0,a=f,k=o,y=d,w=0,z=-1,_=1<<d,C=_-1,e===ni&&_>bs||e===_s&&_>ms)return 1;for(;;){N=a-w,s[h]+1<I?(O=0,P=s[h]):s[h]>=I?(O=J[s[h]-I],P=F[s[h]-I]):(O=32+64,P=0),v=1<<a-w,S=1<<y,f=S;do S-=v,i[k+(E>>w)+S]=N<<24|O<<16|P|0;while(S!==0);for(v=1<<a-1;E&v;)v>>=1;if(v!==0?(E&=v-1,E+=v):E=0,h++,--T[a]===0){if(a===u)break;a=t[n+s[h]]}if(a>d&&(E&C)!==z){for(w===0&&(w=d),k+=f,y=a-w,x=1<<y;y+w<u&&(x-=T[y+w],!(x<=0));)y++,x<<=1;if(_+=1<<y,e===ni&&_>bs||e===_s&&_>ms)return 1;z=E&C,i[z]=d<<24|y<<16|k-o|0}}return E!==0&&(i[k+E]=a-w<<24|64<<16|0),c.bits=d,0};const nd=0,ws=1,xs=2,{Z_FINISH:Ss,Z_BLOCK:rd,Z_TREES:Vn,Z_OK:bt,Z_STREAM_END:id,Z_NEED_DICT:od,Z_STREAM_ERROR:Pe,Z_DATA_ERROR:vs,Z_MEM_ERROR:ks,Z_BUF_ERROR:sd,Z_DEFLATED:As}=ft,Wn=16180,Cs=16181,Bs=16182,Ds=16183,Ts=16184,Es=16185,Ps=16186,Rs=16187,Is=16188,Os=16189,Kn=16190,Xe=16191,ri=16192,zs=16193,ii=16194,Fs=16195,Ns=16196,Ms=16197,Ls=16198,Zn=16199,qn=16200,js=16201,Us=16202,$s=16203,Hs=16204,Gs=16205,oi=16206,Vs=16207,Ws=16208,ae=16209,Ks=16210,Zs=16211,ad=852,cd=592,ld=15,qs=e=>(e>>>24&255)+(e>>>8&65280)+((e&65280)<<8)+((e&255)<<24);function hd(){this.strm=null,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 Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}const mt=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.mode<Wn||t.mode>Zs?1:0},Xs=e=>{if(mt(e))return Pe;const t=e.state;return e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=t.wrap&1),t.mode=Wn,t.last=0,t.havedict=0,t.flags=-1,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new Int32Array(ad),t.distcode=t.distdyn=new Int32Array(cd),t.sane=1,t.back=-1,bt},Ys=e=>{if(mt(e))return Pe;const t=e.state;return t.wsize=0,t.whave=0,t.wnext=0,Xs(e)},Js=(e,t)=>{let n;if(mt(e))return Pe;const r=e.state;return t<0?(n=0,t=-t):(n=(t>>4)+5,t<48&&(t&=15)),t&&(t<8||t>15)?Pe:(r.window!==null&&r.wbits!==t&&(r.window=null),r.wrap=n,r.wbits=t,Ys(e))},Qs=(e,t)=>{if(!e)return Pe;const n=new hd;e.state=n,n.strm=e,n.window=null,n.mode=Wn;const r=Js(e,t);return r!==bt&&(e.state=null),r},dd=e=>Qs(e,ld);let ea=!0,si,ai;const fd=e=>{if(ea){si=new Int32Array(512),ai=new Int32Array(32);let t=0;for(;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(fn(ws,e.lens,0,288,si,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;fn(xs,e.lens,0,32,ai,0,e.work,{bits:5}),ea=!1}e.lencode=si,e.lenbits=9,e.distcode=ai,e.distbits=5},ta=(e,t,n,r)=>{let i;const o=e.state;return o.window===null&&(o.wsize=1<<o.wbits,o.wnext=0,o.whave=0,o.window=new Uint8Array(o.wsize)),r>=o.wsize?(o.window.set(t.subarray(n-o.wsize,n),0),o.wnext=0,o.whave=o.wsize):(i=o.wsize-o.wnext,i>r&&(i=r),o.window.set(t.subarray(n-r,n-r+i),o.wnext),r-=i,r?(o.window.set(t.subarray(n-r,n),0),o.wnext=r,o.whave=o.wsize):(o.wnext+=i,o.wnext===o.wsize&&(o.wnext=0),o.whave<o.wsize&&(o.whave+=i))),0},ud=(e,t)=>{let n,r,i,o,s,c,l,a,h,f,u,d,y,w,x=0,_,E,v,S,z,C,k,F;const I=new Uint8Array(4);let T,R;const J=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(mt(e)||!e.output||!e.input&&e.avail_in!==0)return Pe;n=e.state,n.mode===Xe&&(n.mode=ri),s=e.next_out,i=e.output,l=e.avail_out,o=e.next_in,r=e.input,c=e.avail_in,a=n.hold,h=n.bits,f=c,u=l,F=bt;e:for(;;)switch(n.mode){case Wn:if(n.wrap===0){n.mode=ri;break}for(;h<16;){if(c===0)break e;c--,a+=r[o++]<<h,h+=8}if(n.wrap&2&&a===35615){n.wbits===0&&(n.wbits=15),n.check=0,I[0]=a&255,I[1]=a>>>8&255,n.check=ge(n.check,I,2,0),a=0,h=0,n.mode=Cs;break}if(n.head&&(n.head.done=!1),!(n.wrap&1)||(((a&255)<<8)+(a>>8))%31){e.msg="incorrect header check",n.mode=ae;break}if((a&15)!==As){e.msg="unknown compression method",n.mode=ae;break}if(a>>>=4,h-=4,k=(a&15)+8,n.wbits===0&&(n.wbits=k),k>15||k>n.wbits){e.msg="invalid window size",n.mode=ae;break}n.dmax=1<<n.wbits,n.flags=0,e.adler=n.check=1,n.mode=a&512?Os:Xe,a=0,h=0;break;case Cs:for(;h<16;){if(c===0)break e;c--,a+=r[o++]<<h,h+=8}if(n.flags=a,(n.flags&255)!==As){e.msg="unknown compression method",n.mode=ae;break}if(n.flags&57344){e.msg="unknown header flags set",n.mode=ae;break}n.head&&(n.head.text=a>>8&1),n.flags&512&&n.wrap&4&&(I[0]=a&255,I[1]=a>>>8&255,n.check=ge(n.check,I,2,0)),a=0,h=0,n.mode=Bs;case Bs:for(;h<32;){if(c===0)break e;c--,a+=r[o++]<<h,h+=8}n.head&&(n.head.time=a),n.flags&512&&n.wrap&4&&(I[0]=a&255,I[1]=a>>>8&255,I[2]=a>>>16&255,I[3]=a>>>24&255,n.check=ge(n.check,I,4,0)),a=0,h=0,n.mode=Ds;case Ds:for(;h<16;){if(c===0)break e;c--,a+=r[o++]<<h,h+=8}n.head&&(n.head.xflags=a&255,n.head.os=a>>8),n.flags&512&&n.wrap&4&&(I[0]=a&255,I[1]=a>>>8&255,n.check=ge(n.check,I,2,0)),a=0,h=0,n.mode=Ts;case Ts:if(n.flags&1024){for(;h<16;){if(c===0)break e;c--,a+=r[o++]<<h,h+=8}n.length=a,n.head&&(n.head.extra_len=a),n.flags&512&&n.wrap&4&&(I[0]=a&255,I[1]=a>>>8&255,n.check=ge(n.check,I,2,0)),a=0,h=0}else n.head&&(n.head.extra=null);n.mode=Es;case Es:if(n.flags&1024&&(d=n.length,d>c&&(d=c),d&&(n.head&&(k=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Uint8Array(n.head.extra_len)),n.head.extra.set(r.subarray(o,o+d),k)),n.flags&512&&n.wrap&4&&(n.check=ge(n.check,r,d,o)),c-=d,o+=d,n.length-=d),n.length))break e;n.length=0,n.mode=Ps;case Ps:if(n.flags&2048){if(c===0)break e;d=0;do k=r[o+d++],n.head&&k&&n.length<65536&&(n.head.name+=String.fromCharCode(k));while(k&&d<c);if(n.flags&512&&n.wrap&4&&(n.check=ge(n.check,r,d,o)),c-=d,o+=d,k)break e}else n.head&&(n.head.name=null);n.length=0,n.mode=Rs;case Rs:if(n.flags&4096){if(c===0)break e;d=0;do k=r[o+d++],n.head&&k&&n.length<65536&&(n.head.comment+=String.fromCharCode(k));while(k&&d<c);if(n.flags&512&&n.wrap&4&&(n.check=ge(n.check,r,d,o)),c-=d,o+=d,k)break e}else n.head&&(n.head.comment=null);n.mode=Is;case Is:if(n.flags&512){for(;h<16;){if(c===0)break e;c--,a+=r[o++]<<h,h+=8}if(n.wrap&4&&a!==(n.check&65535)){e.msg="header crc mismatch",n.mode=ae;break}a=0,h=0}n.head&&(n.head.hcrc=n.flags>>9&1,n.head.done=!0),e.adler=n.check=0,n.mode=Xe;break;case Os:for(;h<32;){if(c===0)break e;c--,a+=r[o++]<<h,h+=8}e.adler=n.check=qs(a),a=0,h=0,n.mode=Kn;case Kn:if(n.havedict===0)return e.next_out=s,e.avail_out=l,e.next_in=o,e.avail_in=c,n.hold=a,n.bits=h,od;e.adler=n.check=1,n.mode=Xe;case Xe:if(t===rd||t===Vn)break e;case ri:if(n.last){a>>>=h&7,h-=h&7,n.mode=oi;break}for(;h<3;){if(c===0)break e;c--,a+=r[o++]<<h,h+=8}switch(n.last=a&1,a>>>=1,h-=1,a&3){case 0:n.mode=zs;break;case 1:if(fd(n),n.mode=Zn,t===Vn){a>>>=2,h-=2;break e}break;case 2:n.mode=Ns;break;case 3:e.msg="invalid block type",n.mode=ae}a>>>=2,h-=2;break;case zs:for(a>>>=h&7,h-=h&7;h<32;){if(c===0)break e;c--,a+=r[o++]<<h,h+=8}if((a&65535)!==(a>>>16^65535)){e.msg="invalid stored block lengths",n.mode=ae;break}if(n.length=a&65535,a=0,h=0,n.mode=ii,t===Vn)break e;case ii:n.mode=Fs;case Fs:if(d=n.length,d){if(d>c&&(d=c),d>l&&(d=l),d===0)break e;i.set(r.subarray(o,o+d),s),c-=d,o+=d,l-=d,s+=d,n.length-=d;break}n.mode=Xe;break;case Ns:for(;h<14;){if(c===0)break e;c--,a+=r[o++]<<h,h+=8}if(n.nlen=(a&31)+257,a>>>=5,h-=5,n.ndist=(a&31)+1,a>>>=5,h-=5,n.ncode=(a&15)+4,a>>>=4,h-=4,n.nlen>286||n.ndist>30){e.msg="too many length or distance symbols",n.mode=ae;break}n.have=0,n.mode=Ms;case Ms:for(;n.have<n.ncode;){for(;h<3;){if(c===0)break e;c--,a+=r[o++]<<h,h+=8}n.lens[J[n.have++]]=a&7,a>>>=3,h-=3}for(;n.have<19;)n.lens[J[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,T={bits:n.lenbits},F=fn(nd,n.lens,0,19,n.lencode,0,n.work,T),n.lenbits=T.bits,F){e.msg="invalid code lengths set",n.mode=ae;break}n.have=0,n.mode=Ls;case Ls:for(;n.have<n.nlen+n.ndist;){for(;x=n.lencode[a&(1<<n.lenbits)-1],_=x>>>24,E=x>>>16&255,v=x&65535,!(_<=h);){if(c===0)break e;c--,a+=r[o++]<<h,h+=8}if(v<16)a>>>=_,h-=_,n.lens[n.have++]=v;else{if(v===16){for(R=_+2;h<R;){if(c===0)break e;c--,a+=r[o++]<<h,h+=8}if(a>>>=_,h-=_,n.have===0){e.msg="invalid bit length repeat",n.mode=ae;break}k=n.lens[n.have-1],d=3+(a&3),a>>>=2,h-=2}else if(v===17){for(R=_+3;h<R;){if(c===0)break e;c--,a+=r[o++]<<h,h+=8}a>>>=_,h-=_,k=0,d=3+(a&7),a>>>=3,h-=3}else{for(R=_+7;h<R;){if(c===0)break e;c--,a+=r[o++]<<h,h+=8}a>>>=_,h-=_,k=0,d=11+(a&127),a>>>=7,h-=7}if(n.have+d>n.nlen+n.ndist){e.msg="invalid bit length repeat",n.mode=ae;break}for(;d--;)n.lens[n.have++]=k}}if(n.mode===ae)break;if(n.lens[256]===0){e.msg="invalid code -- missing end-of-block",n.mode=ae;break}if(n.lenbits=9,T={bits:n.lenbits},F=fn(ws,n.lens,0,n.nlen,n.lencode,0,n.work,T),n.lenbits=T.bits,F){e.msg="invalid literal/lengths set",n.mode=ae;break}if(n.distbits=6,n.distcode=n.distdyn,T={bits:n.distbits},F=fn(xs,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,T),n.distbits=T.bits,F){e.msg="invalid distances set",n.mode=ae;break}if(n.mode=Zn,t===Vn)break e;case Zn:n.mode=qn;case qn:if(c>=6&&l>=258){e.next_out=s,e.avail_out=l,e.next_in=o,e.avail_in=c,n.hold=a,n.bits=h,Yh(e,u),s=e.next_out,i=e.output,l=e.avail_out,o=e.next_in,r=e.input,c=e.avail_in,a=n.hold,h=n.bits,n.mode===Xe&&(n.back=-1);break}for(n.back=0;x=n.lencode[a&(1<<n.lenbits)-1],_=x>>>24,E=x>>>16&255,v=x&65535,!(_<=h);){if(c===0)break e;c--,a+=r[o++]<<h,h+=8}if(E&&(E&240)===0){for(S=_,z=E,C=v;x=n.lencode[C+((a&(1<<S+z)-1)>>S)],_=x>>>24,E=x>>>16&255,v=x&65535,!(S+_<=h);){if(c===0)break e;c--,a+=r[o++]<<h,h+=8}a>>>=S,h-=S,n.back+=S}if(a>>>=_,h-=_,n.back+=_,n.length=v,E===0){n.mode=Gs;break}if(E&32){n.back=-1,n.mode=Xe;break}if(E&64){e.msg="invalid literal/length code",n.mode=ae;break}n.extra=E&15,n.mode=js;case js:if(n.extra){for(R=n.extra;h<R;){if(c===0)break e;c--,a+=r[o++]<<h,h+=8}n.length+=a&(1<<n.extra)-1,a>>>=n.extra,h-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=Us;case Us:for(;x=n.distcode[a&(1<<n.distbits)-1],_=x>>>24,E=x>>>16&255,v=x&65535,!(_<=h);){if(c===0)break e;c--,a+=r[o++]<<h,h+=8}if((E&240)===0){for(S=_,z=E,C=v;x=n.distcode[C+((a&(1<<S+z)-1)>>S)],_=x>>>24,E=x>>>16&255,v=x&65535,!(S+_<=h);){if(c===0)break e;c--,a+=r[o++]<<h,h+=8}a>>>=S,h-=S,n.back+=S}if(a>>>=_,h-=_,n.back+=_,E&64){e.msg="invalid distance code",n.mode=ae;break}n.offset=v,n.extra=E&15,n.mode=$s;case $s:if(n.extra){for(R=n.extra;h<R;){if(c===0)break e;c--,a+=r[o++]<<h,h+=8}n.offset+=a&(1<<n.extra)-1,a>>>=n.extra,h-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){e.msg="invalid distance too far back",n.mode=ae;break}n.mode=Hs;case Hs:if(l===0)break e;if(d=u-l,n.offset>d){if(d=n.offset-d,d>n.whave&&n.sane){e.msg="invalid distance too far back",n.mode=ae;break}d>n.wnext?(d-=n.wnext,y=n.wsize-d):y=n.wnext-d,d>n.length&&(d=n.length),w=n.window}else w=i,y=s-n.offset,d=n.length;d>l&&(d=l),l-=d,n.length-=d;do i[s++]=w[y++];while(--d);n.length===0&&(n.mode=qn);break;case Gs:if(l===0)break e;i[s++]=n.length,l--,n.mode=qn;break;case oi:if(n.wrap){for(;h<32;){if(c===0)break e;c--,a|=r[o++]<<h,h+=8}if(u-=l,e.total_out+=u,n.total+=u,n.wrap&4&&u&&(e.adler=n.check=n.flags?ge(n.check,i,u,s-u):nn(n.check,i,u,s-u)),u=l,n.wrap&4&&(n.flags?a:qs(a))!==n.check){e.msg="incorrect data check",n.mode=ae;break}a=0,h=0}n.mode=Vs;case Vs:if(n.wrap&&n.flags){for(;h<32;){if(c===0)break e;c--,a+=r[o++]<<h,h+=8}if(n.wrap&4&&a!==(n.total&4294967295)){e.msg="incorrect length check",n.mode=ae;break}a=0,h=0}n.mode=Ws;case Ws:F=id;break e;case ae:F=vs;break e;case Ks:return ks;case Zs:default:return Pe}return e.next_out=s,e.avail_out=l,e.next_in=o,e.avail_in=c,n.hold=a,n.bits=h,(n.wsize||u!==e.avail_out&&n.mode<ae&&(n.mode<oi||t!==Ss))&&ta(e,e.output,e.next_out,u-e.avail_out),f-=e.avail_in,u-=e.avail_out,e.total_in+=f,e.total_out+=u,n.total+=u,n.wrap&4&&u&&(e.adler=n.check=n.flags?ge(n.check,i,u,e.next_out-u):nn(n.check,i,u,e.next_out-u)),e.data_type=n.bits+(n.last?64:0)+(n.mode===Xe?128:0)+(n.mode===Zn||n.mode===ii?256:0),(f===0&&u===0||t===Ss)&&F===bt&&(F=sd),F},gd=e=>{if(mt(e))return Pe;let t=e.state;return t.window&&(t.window=null),e.state=null,bt},pd=(e,t)=>{if(mt(e))return Pe;const n=e.state;return(n.wrap&2)===0?Pe:(n.head=t,t.done=!1,bt)},bd=(e,t)=>{const n=t.length;let r,i,o;return mt(e)||(r=e.state,r.wrap!==0&&r.mode!==Kn)?Pe:r.mode===Kn&&(i=1,i=nn(i,t,n,0),i!==r.check)?vs:(o=ta(e,t,n,n),o?(r.mode=Ks,ks):(r.havedict=1,bt))};var md=Ys,yd=Js,_d=Xs,wd=dd,xd=Qs,Sd=ud,vd=gd,kd=pd,Ad=bd,Cd="pako inflate (from Nodeca project)",Ye={inflateReset:md,inflateReset2:yd,inflateResetKeep:_d,inflateInit:wd,inflateInit2:xd,inflate:Sd,inflateEnd:vd,inflateGetHeader:kd,inflateSetDictionary:Ad,inflateInfo:Cd};function Bd(){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}var Dd=Bd;const na=Object.prototype.toString,{Z_NO_FLUSH:Td,Z_FINISH:Ed,Z_OK:un,Z_STREAM_END:ci,Z_NEED_DICT:li,Z_STREAM_ERROR:Pd,Z_DATA_ERROR:ra,Z_MEM_ERROR:Rd}=ft;function gn(e){this.options=$n.assign({chunkSize:1024*64,windowBits:15,to:""},e||{});const t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,t.windowBits===0&&(t.windowBits=-15)),t.windowBits>=0&&t.windowBits<16&&!(e&&e.windowBits)&&(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&(t.windowBits&15)===0&&(t.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new gs,this.strm.avail_out=0;let n=Ye.inflateInit2(this.strm,t.windowBits);if(n!==un)throw new Error(dt[n]);if(this.header=new Dd,Ye.inflateGetHeader(this.strm,this.header),t.dictionary&&(typeof t.dictionary=="string"?t.dictionary=hn.string2buf(t.dictionary):na.call(t.dictionary)==="[object ArrayBuffer]"&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(n=Ye.inflateSetDictionary(this.strm,t.dictionary),n!==un)))throw new Error(dt[n])}gn.prototype.push=function(e,t){const n=this.strm,r=this.options.chunkSize,i=this.options.dictionary;let o,s,c;if(this.ended)return!1;for(t===~~t?s=t:s=t===!0?Ed:Td,na.call(e)==="[object ArrayBuffer]"?n.input=new Uint8Array(e):n.input=e,n.next_in=0,n.avail_in=n.input.length;;){for(n.avail_out===0&&(n.output=new Uint8Array(r),n.next_out=0,n.avail_out=r),o=Ye.inflate(n,s),o===li&&i&&(o=Ye.inflateSetDictionary(n,i),o===un?o=Ye.inflate(n,s):o===ra&&(o=li));n.avail_in>0&&o===ci&&n.state.wrap>0&&e[n.next_in]!==0;)Ye.inflateReset(n),o=Ye.inflate(n,s);switch(o){case Pd:case ra:case li:case Rd:return this.onEnd(o),this.ended=!0,!1}if(c=n.avail_out,n.next_out&&(n.avail_out===0||o===ci))if(this.options.to==="string"){let l=hn.utf8border(n.output,n.next_out),a=n.next_out-l,h=hn.buf2string(n.output,l);n.next_out=a,n.avail_out=r-a,a&&n.output.set(n.output.subarray(l,l+a),0),this.onData(h)}else this.onData(n.output.length===n.next_out?n.output:n.output.subarray(0,n.next_out));if(!(o===un&&c===0)){if(o===ci)return o=Ye.inflateEnd(this.strm),this.onEnd(o),this.ended=!0,!0;if(n.avail_in===0)break}}return!0},gn.prototype.onData=function(e){this.chunks.push(e)},gn.prototype.onEnd=function(e){e===un&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=$n.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function hi(e,t){const n=new gn(t);if(n.push(e),n.err)throw n.msg||dt[n.err];return n.result}function Id(e,t){return t=t||{},t.raw=!0,hi(e,t)}var Od=gn,zd=hi,Fd=Id,Nd=hi,Md=ft,Ld={Inflate:Od,inflate:zd,inflateRaw:Fd,ungzip:Nd,constants:Md};const{Deflate:jd,deflate:Ud,deflateRaw:$d,gzip:Hd}=qh,{Inflate:Gd,inflate:Vd,inflateRaw:Wd,ungzip:Kd}=Ld;var Zd=jd,qd=Ud,Xd=$d,Yd=Hd,Jd=Gd,Qd=Vd,ef=Wd,tf=Kd,nf=ft,di={Deflate:Zd,deflate:qd,deflateRaw:Xd,gzip:Yd,Inflate:Jd,inflate:Qd,inflateRaw:ef,ungzip:tf,constants:nf};const ia=class{constructor(e,t){b(this,"major"),b(this,"minor"),this.major=String(e),this.minor=String(t)}toString(){const e=We(129);return`%PDF-${this.major}.${this.minor}
3
- %${e}${e}${e}${e}`}sizeInBytes(){return 12+this.major.length+this.minor.length}copyBytesInto(e,t){const n=t;return e[t++]=m.Percent,e[t++]=m.P,e[t++]=m.D,e[t++]=m.F,e[t++]=m.Dash,t+=be(this.major,e,t),e[t++]=m.Period,t+=be(this.minor,e,t),e[t++]=m.Newline,e[t++]=m.Percent,e[t++]=129,e[t++]=129,e[t++]=129,e[t++]=129,t-n}};let pn=ia;b(pn,"forVersion",(e,t)=>new ia(e,t));const fi={},ui=class extends _e{constructor(e,t){if(e!==fi)throw new Dr("PDFBool");super(),b(this,"value"),this.value=t}asBoolean(){return this.value}clone(){return this}toString(){return String(this.value)}sizeInBytes(){return this.value?4:5}copyBytesInto(e,t){return this.value?(e[t++]=m.t,e[t++]=m.r,e[t++]=m.u,e[t++]=m.e,4):(e[t++]=m.f,e[t++]=m.a,e[t++]=m.l,e[t++]=m.s,e[t++]=m.e,5)}};let yt=ui;b(yt,"True",new ui(fi,!0)),b(yt,"False",new ui(fi,!1));class rf extends _e{asNull(){return null}clone(){return this}toString(){return"null"}sizeInBytes(){return 4}copyBytesInto(t,n){return t[n++]=m.n,t[n++]=m.u,t[n++]=m.l,t[n++]=m.l,4}}const Se=new rf,Xn=class extends _e{constructor(e,t){super(),b(this,"context"),b(this,"dict"),this.dict=e,this.context=t}keys(){return Array.from(this.dict.keys())}values(){return Array.from(this.dict.values())}entries(){return Array.from(this.dict.entries())}set(e,t){this.dict.set(e,t)}get(e,t=!1){const n=this.dict.get(e);if(!(n===Se&&!t))return n}has(e){const t=this.dict.get(e);return t!==void 0&&t!==Se}lookupMaybe(e,...t){const n=t.includes(Se),r=this.context.lookupMaybe(this.get(e,n),...t);if(!(r===Se&&!n))return r}lookup(e,...t){const n=t.includes(Se),r=this.context.lookup(this.get(e,n),...t);if(!(r===Se&&!n))return r}delete(e){return this.dict.delete(e)}asMap(){return new Map(this.dict)}uniqueKey(e=""){const t=this.keys();let n=p.of(this.context.addRandomSuffix(e,10));for(;t.includes(n);)n=p.of(this.context.addRandomSuffix(e,10));return n}clone(e){const t=Xn.withContext(e||this.context),n=this.entries();for(let r=0,i=n.length;r<i;r++){const[o,s]=n[r];t.set(o,s)}return t}toString(){let e=`<<
1
+ (function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode('.vp-text-xl[data-v-9d5f0033]{font-size:1.25rem;line-height:1.75rem}.vpv-toolbar-btn.vpv-toolbar-btn-active[data-v-df5778ee],.vpv-toolbar-btn[data-v-df5778ee]:hover{background-color:var(--vpv-primary-color);color:#fff}.vpv-annotation-editor-layer{position:absolute;left:0;top:0;transform-origin:0 0;width:round(down,var(--page-width) * var(--scale-factor),var(--scale-round-x));height:round(down,var(--page-height) * var(--scale-factor),var(--scale-round-y));pointer-events:none}.vpv-annotation-editor-layer[data-main-rotation="90"],.vpv-annotation-editor-layer[data-main-rotation="270"]{width:round(down,var(--page-height) * var(--scale-factor),var(--scale-round-y));height:round(down,var(--page-width) * var(--scale-factor),var(--scale-round-x))}.vpv-annotation-editor-layer *{pointer-events:auto}.vpv-annotation-editor-layer .vpv-annotation-editor{z-index:calc(var(--vpv-base-z-index) * 4)}.vpv-annotation-editor-layer.highlight-mode,.vpv-annotation-editor-layer.underline-mode,.vpv-annotation-editor-layer.strikeout-mode{cursor:text}.vpv-annotation-editor-layer.highlight-mode .vpv-annotation-editor .vpv-annotation-editor__clip-path,.vpv-annotation-editor-layer.underline-mode .vpv-annotation-editor .vpv-annotation-editor__clip-path,.vpv-annotation-editor-layer.strikeout-mode .vpv-annotation-editor .vpv-annotation-editor__clip-path{position:absolute;inset:0;pointer-events:none;z-index:calc(var(--vpv-base-z-index) * 5)}.vpv-annotation-editor-layer:not(.highlight-mode,.underline-mode,.strikeout-mode) .vpv-annotation-editor:is(.vpv-annotation-editor__highlight,.vpv-annotation-editor__underline,.vpv-annotation-editor__strikeout){pointer-events:none}.vpv-annotation-editor-layer:not(.highlight-mode,.underline-mode,.strikeout-mode) .vpv-annotation-editor:is(.vpv-annotation-editor__highlight,.vpv-annotation-editor__underline,.vpv-annotation-editor__strikeout) .vpv-annotation-editor__clip-path{pointer-events:none}.vpv-annotation-text-selection__color-picker-wrapper{padding-left:4px;padding-right:4px;padding-bottom:4px;text-align:left}.vpv-annotation-text-selection__color-picker-wrapper>p{margin-bottom:.75rem}.vpv-canvas-layer>.vpv-highlight:is(svg),.vpv-canvas-layer>.vpv-underline:is(svg),.vpv-canvas-layer>.vpv-underline-interaction:is(svg),.vpv-canvas-layer>.vpv-strikeout:is(svg),.vpv-canvas-layer>.vpv-strikeout-interaction:is(svg){position:absolute;mix-blend-mode:multiply;pointer-events:none}.vpv-canvas-layer>.vpv-highlight:is(svg)>use,.vpv-canvas-layer>.vpv-underline:is(svg)>use,.vpv-canvas-layer>.vpv-underline-interaction:is(svg)>use,.vpv-canvas-layer>.vpv-strikeout:is(svg)>use,.vpv-canvas-layer>.vpv-strikeout-interaction:is(svg)>use{fill:inherit}.vpv-canvas-layer>.vpv-highlight:is(svg):not(.free),.vpv-canvas-layer>.vpv-underline:is(svg):not(.free),.vpv-canvas-layer>.vpv-underline-interaction:is(svg):not(.free),.vpv-canvas-layer>.vpv-strikeout:is(svg):not(.free),.vpv-canvas-layer>.vpv-strikeout-interaction:is(svg):not(.free){fill-rule:evenodd}.vpv-canvas-layer>.vpv-highlight:is(svg):not(.free) path,.vpv-canvas-layer>.vpv-highlight:is(svg):not(.free) use,.vpv-canvas-layer>.vpv-underline:is(svg):not(.free) path,.vpv-canvas-layer>.vpv-underline:is(svg):not(.free) use,.vpv-canvas-layer>.vpv-underline-interaction:is(svg):not(.free) path,.vpv-canvas-layer>.vpv-underline-interaction:is(svg):not(.free) use,.vpv-canvas-layer>.vpv-strikeout:is(svg):not(.free) path,.vpv-canvas-layer>.vpv-strikeout:is(svg):not(.free) use,.vpv-canvas-layer>.vpv-strikeout-interaction:is(svg):not(.free) path,.vpv-canvas-layer>.vpv-strikeout-interaction:is(svg):not(.free) use{fill-rule:evenodd}.vpv-canvas-layer>.vpv-highlight-outline:is(svg),.vpv-canvas-layer>.vpv-underline-outline:is(svg),.vpv-canvas-layer>.vpv-strikeout-outline:is(svg){position:absolute;mix-blend-mode:normal;fill-rule:evenodd;fill:transparent;pointer-events:none;stroke:transparent;stroke-width:var(--vpv-annotation-text-selection__outline-width);vector-effect:non-scaling-stroke}.vpv-canvas-layer>.vpv-highlight-outline:is(svg) path,.vpv-canvas-layer>.vpv-highlight-outline:is(svg) use,.vpv-canvas-layer>.vpv-underline-outline:is(svg) path,.vpv-canvas-layer>.vpv-underline-outline:is(svg) use,.vpv-canvas-layer>.vpv-strikeout-outline:is(svg) path,.vpv-canvas-layer>.vpv-strikeout-outline:is(svg) use{fill-rule:evenodd;stroke:inherit;stroke-width:inherit;vector-effect:inherit}.vpv-canvas-layer>.vpv-highlight-outline:is(svg).selected,.vpv-canvas-layer>.vpv-underline-outline:is(svg).selected,.vpv-canvas-layer>.vpv-strikeout-outline:is(svg).selected{stroke:var(--vpv-annotation-text-selection__outline-selected-color)}.vpv-annotation-editor-layer.highlight-mode .vpv-annotation-editor,.vpv-annotation-editor-layer.underline-mode .vpv-annotation-editor,.vpv-annotation-editor-layer.strikeout-mode .vpv-annotation-editor{pointer-events:none}.vpv-annotation-editor-layer.highlight-mode .vpv-annotation-editor__underline,.vpv-annotation-editor-layer.highlight-mode .vpv-annotation-editor__strikeout,.vpv-annotation-editor-layer.highlight-mode .vpv-annotation-editor__highlight,.vpv-annotation-editor-layer.underline-mode .vpv-annotation-editor__underline,.vpv-annotation-editor-layer.underline-mode .vpv-annotation-editor__strikeout,.vpv-annotation-editor-layer.underline-mode .vpv-annotation-editor__highlight,.vpv-annotation-editor-layer.strikeout-mode .vpv-annotation-editor__underline,.vpv-annotation-editor-layer.strikeout-mode .vpv-annotation-editor__strikeout,.vpv-annotation-editor-layer.strikeout-mode .vpv-annotation-editor__highlight{cursor:pointer}.vpv-annotation-editor-layer .vpv-annotation-editor__free-text{position:absolute;user-select:none;padding:calc(var(--vpv-annotation-free-text__padding, 2px) * var(--scale-factor));cursor:auto}.vpv-annotation-editor-layer .vpv-annotation-editor__free-text.draggable{cursor:move}.vpv-annotation-editor-layer .vpv-annotation-editor__free-text--selected:has([role=textbox][contenteditable=true]){width:auto!important;height:auto!important}.vpv-annotation-editor-layer .vpv-annotation-editor__free-text--selected,.vpv-annotation-editor-layer .vpv-annotation-editor__free-text:hover{outline:1px solid #0082ff}.vpv-annotation-editor-layer .vpv-annotation-editor__free-text [role=textbox]{outline:none!important;text-align:start;font:10px sans-serif;line-height:var(--vpv-annotation-free-text__line-height);width:auto;height:auto;white-space:pre-wrap;word-wrap:break-word}.vpv-annotation-editor-layer .vpv-annotation-editor__free-text--temp{min-width:100px;min-height:calc(20px * var(--scale-factor));border:1px dashed #007bff;background-color:#ffffffe6;color:#000;cursor:text}.vpv-annotation-editor-layer .vpv-annotation-editor__free-text--temp>[role=textbox]{outline:none;font-size:calc(16px * var(--scale-factor));font-family:sans-serif;min-height:calc(16px * var(--scale-factor));white-space:nowrap}.vpv-annotation-editor-layer.freetext-mode>:not(.vpv-annotation-editor__free-text){user-select:none;pointer-events:none}.vpv-annotation-editor-layer:not(.freetext-mode) .vpv-annotation-editor__free-text,.vpv-annotation-editor-layer:not(.freetext-mode) .vpv-annotation-editor__free-text [role=textbox]{pointer-events:none}.vpv-resizers{position:absolute;inset:0;pointer-events:none}.vpv-resizers .vpv-resizer{position:absolute;width:var(--vpv-annotation-outline-resizer-size);height:var(--vpv-annotation-outline-resizer-size);background:white;border:1px solid var(--vpv-annotation-outline-resizer-border-color);border-radius:50%;pointer-events:auto;cursor:pointer;z-index:calc(var(--vpv-base-z-index) * 9999);transition:opacity .2s ease,visibility .2s ease}.vpv-resizers .vpv-resizer:hover,.vpv-resizers .vpv-resizer:focus{transform:scale(1.5)}.vpv-resizers .vpv-resizer--top-left{top:calc(var(--vpv-annotation-outline-resizer-size) * -1.25);left:calc(var(--vpv-annotation-outline-resizer-size) * -1.25);cursor:nwse-resize}.vpv-resizers .vpv-resizer--top-right{top:calc(var(--vpv-annotation-outline-resizer-size) * -1.25);right:calc(var(--vpv-annotation-outline-resizer-size) * -1.25);cursor:nesw-resize}.vpv-resizers .vpv-resizer--bottom-left{bottom:calc(var(--vpv-annotation-outline-resizer-size) * -1.25);left:calc(var(--vpv-annotation-outline-resizer-size) * -1.25);cursor:nesw-resize}.vpv-resizers .vpv-resizer--bottom-right{bottom:calc(var(--vpv-annotation-outline-resizer-size) * -1.25);right:calc(var(--vpv-annotation-outline-resizer-size) * -1.25);cursor:nwse-resize}.vpv-page[data-main-rotation="90"] .vpv-resizer--top-left,.vpv-page[data-main-rotation="270"] .vpv-resizer--top-left{cursor:nesw-resize}.vpv-page[data-main-rotation="90"] .vpv-resizer--top-right,.vpv-page[data-main-rotation="270"] .vpv-resizer--top-right,.vpv-page[data-main-rotation="90"] .vpv-resizer--bottom-left,.vpv-page[data-main-rotation="270"] .vpv-resizer--bottom-left{cursor:nwse-resize}.vpv-page[data-main-rotation="90"] .vpv-resizer--bottom-right,.vpv-page[data-main-rotation="270"] .vpv-resizer--bottom-right{cursor:nesw-resize}.vpv-resizer--dark{background:#80ebff;border-color:#2b2a33}.vpv-resizer--dark:focus{outline-color:#80ebff}.vpv-annotation-editor__image{position:absolute;cursor:pointer;touch-action:none;user-select:none;will-change:transform}.vpv-annotation-editor__image.hovered,.vpv-annotation-editor__image:hover{outline-width:var(--vpv-annotation-outline-width);outline-style:solid;outline-color:var(--vpv-annotation-outline-hovered-color)}.vpv-annotation-editor__image.selected{outline-width:var(--vpv-annotation-outline-width);outline-style:solid;outline-offset:var(--vpv-annotation-outline-selected-offset);outline-color:var(--vpv-annotation-outline-selected-color);cursor:move}.vpv-annotation-editor__image canvas{position:absolute;width:100%;height:100%;margin:0;top:0;left:0}.vpv-annotation-editor__image.dragging canvas{user-drag:none;-webkit-user-drag:none;pointer-events:none;touch-action:none}.vpv-page:not([data-main-rotation="0"]) .vpv-annotation-editor__image:hover{outline:none}.vpv-annotation-tools-container[data-v-9e031a97]{padding-top:.5rem;padding-bottom:.5rem;border-top:1px solid #c6ccd2;max-width:min-content;margin:.5rem auto}.vpv-annotation-tools-container[data-v-9e031a97] .vpv-toolbar-btn{margin-bottom:.25rem}.slide-enter-active[data-v-9e031a97],.slide-leave-active[data-v-9e031a97]{transition:all .3s ease-out}.slide-enter-from[data-v-9e031a97],.slide-leave-to[data-v-9e031a97]{opacity:0}.slide-enter-from[data-v-9e031a97],.slide-leave-to[data-v-9e031a97]{transform:translateY(-20px)}')),document.head.appendChild(e)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}})();
2
+ (function(de,g){typeof exports=="object"&&typeof module<"u"?g(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],g):(de=typeof globalThis<"u"?globalThis:de||self,g(de["@vue-pdf-viewer/annotation"]={},de.Vue))})(this,function(de,g){"use strict";var kc=Object.defineProperty,Ac=(e,t,n)=>t in e?kc(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,b=(e,t,n)=>(Ac(e,typeof t!="symbol"?t+"":t,n),n);const St="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Zt=new Uint8Array(256);for(let e=0;e<St.length;e++)Zt[St.charCodeAt(e)]=e;const Cc=e=>{let t="";const n=e.length;for(let r=0;r<n;r+=3)t+=St[e[r]>>2],t+=St[(e[r]&3)<<4|e[r+1]>>4],t+=St[(e[r+1]&15)<<2|e[r+2]>>6],t+=St[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},bo=e=>{let t=e.length*.75;const n=e.length;let r,i=0,o,s,c,l;e[e.length-1]==="="&&(t--,e[e.length-2]==="="&&t--);const a=new Uint8Array(t);for(r=0;r<n;r+=4)o=Zt[e.charCodeAt(r)],s=Zt[e.charCodeAt(r+1)],c=Zt[e.charCodeAt(r+2)],l=Zt[e.charCodeAt(r+3)],a[i++]=o<<2|s>>4,a[i++]=(s&15)<<4|c>>2,a[i++]=(c&3)<<6|l&63;return a},Bc=/^(data)?:?([\w\/\+]+)?;?(charset=[\w-]+|base64)?.*,/i,Dc=e=>{const t=e.trim(),r=t.substring(0,100).match(Bc);if(!r)return bo(t);const[i]=r,o=t.substring(i.length);return bo(o)},H=e=>e.charCodeAt(0),mo=(e,t)=>ze(e.toString(16),t,"0").toUpperCase(),yo=e=>mo(e,2),Ke=e=>String.fromCharCode(e),Tc=e=>Ke(parseInt(e,16)),ze=(e,t,n)=>{let r="";for(let i=0,o=t-e.length;i<o;i++)r+=n;return r+e},be=(e,t,n)=>{const r=e.length;for(let i=0;i<r;i++)t[n++]=e.charCodeAt(i);return r},Ec=/^D:(\d\d\d\d)(\d\d)?(\d\d)?(\d\d)?(\d\d)?(\d\d)?([+\-Z])?(\d\d)?'?(\d\d)?'?$/,_o=e=>{const t=e.match(Ec);if(!t)return;const[,n,r="01",i="01",o="00",s="00",c="00",l="Z",a="00",h="00"]=t,f=l==="Z"?"Z":`${l}${a}:${h}`;return new Date(`${n}-${r}-${i}T${o}:${s}:${c}${f}`)},Pc=(e,t)=>{var n;let r=0,i;for(;r<e.length;){const o=e.substring(r).match(t);if(!o)return{match:i,pos:r};i=o,r+=((n=o.index)!=null?n:0)+o[0].length}return{match:i,pos:r}},In=e=>e[e.length-1],Dr=e=>{if(e instanceof Uint8Array)return e;const t=e.length,n=new Uint8Array(t);for(let r=0;r<t;r++)n[r]=e.charCodeAt(r);return n},Rc=(...e)=>{const t=e.length,n=[];for(let s=0;s<t;s++){const c=e[s];n[s]=c instanceof Uint8Array?c:Dr(c)}let r=0;for(let s=0;s<t;s++)r+=e[s].length;const i=new Uint8Array(r);let o=0;for(let s=0;s<t;s++){const c=n[s];for(let l=0,a=c.length;l<a;l++)i[o++]=c[l]}return i},wo=e=>{let t="";for(let n=0,r=e.length;n<r;n++)t+=Ke(e[n]);return t},vt=e=>{const t=e.length;for(let n=0,r=Math.floor(t/2);n<r;n++){const i=n,o=t-n-1,s=e[n];e[i]=e[o],e[o]=s}return e},Ic=e=>{let t=0;for(let n=0,r=e.length;n<r;n++)t+=e[n];return t},Oc=(e,t)=>{const n=new Array(t-e);for(let r=0,i=n.length;r<i;r++)n[r]=e+r;return n},zc=e=>{if(typeof e=="string")return Dc(e);if(e instanceof ArrayBuffer)return new Uint8Array(e);if(e instanceof Uint8Array)return e;throw new TypeError("`input` must be one of `string | ArrayBuffer | Uint8Array`")},kt=()=>new Promise(e=>{setTimeout(()=>e(),0)}),xo=class{constructor(e){b(this,"populate"),b(this,"value"),this.populate=e,this.value=void 0}getValue(){return this.value}access(){return this.value||(this.value=this.populate()),this.value}invalidate(){this.value=void 0}};let At=xo;b(At,"populatedBy",e=>new xo(e));const On=e=>{throw new Error(e)},Fc=e=>{let t=String(e);if(Math.abs(e)<1){const n=parseInt(e.toString().split("e-")[1]);if(n){const r=e<0;r&&(e*=-1),e*=Math.pow(10,n-1),t="0."+new Array(n).join("0")+e.toString().substring(2),r&&(t="-"+t)}}else{let n=parseInt(e.toString().split("+")[1]);n>20&&(n-=20,e/=Math.pow(10,n),t=e.toString()+new Array(n+1).join("0"))}return t},zn=e=>Math.ceil(e.toString(2).length/8),Ct=e=>{const t=new Uint8Array(zn(e));for(let n=1;n<=t.length;n++)t[n-1]=e>>(t.length-n)*8;return t},G=new Uint16Array(256);for(let e=0;e<256;e++)G[e]=e;G[22]=H(""),G[24]=H("\u02D8"),G[25]=H("\u02C7"),G[26]=H("\u02C6"),G[27]=H("\u02D9"),G[28]=H("\u02DD"),G[29]=H("\u02DB"),G[30]=H("\u02DA"),G[31]=H("\u02DC"),G[127]=H("\uFFFD"),G[128]=H("\u2022"),G[129]=H("\u2020"),G[130]=H("\u2021"),G[131]=H("\u2026"),G[132]=H("\u2014"),G[133]=H("\u2013"),G[134]=H("\u0192"),G[135]=H("\u2044"),G[136]=H("\u2039"),G[137]=H("\u203A"),G[138]=H("\u2212"),G[139]=H("\u2030"),G[140]=H("\u201E"),G[141]=H("\u201C"),G[142]=H("\u201D"),G[143]=H("\u2018"),G[144]=H("\u2019"),G[145]=H("\u201A"),G[146]=H("\u2122"),G[147]=H("\uFB01"),G[148]=H("\uFB02"),G[149]=H("\u0141"),G[150]=H("\u0152"),G[151]=H("\u0160"),G[152]=H("\u0178"),G[153]=H("\u017D"),G[154]=H("\u0131"),G[155]=H("\u0142"),G[156]=H("\u0153"),G[157]=H("\u0161"),G[158]=H("\u017E"),G[159]=H("\uFFFD"),G[160]=H("\u20AC"),G[173]=H("\uFFFD");const So=e=>{const t=new Array(e.length);for(let n=0,r=e.length;n<r;n++)t[n]=G[e[n]];return String.fromCodePoint(...t)},vo=e=>Object.keys(e).map(t=>e[t]),Fn=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height,Nc=(e,t=!0)=>{const n=[];t&&n.push(65279);for(let r=0,i=e.length;r<i;){const o=e.codePointAt(r);if(o<65536)n.push(o),r+=1;else if(o<1114112)n.push(Mc(o),Lc(o)),r+=2;else throw new Error(`Invalid code point: 0x${yo(o)}`)}return new Uint16Array(n)},Mc=e=>Math.floor((e-65536)/1024)+55296,Lc=e=>(e-65536)%1024+56320,qt="\uFFFD".codePointAt(0),ko=(e,t=!0)=>{if(e.length<=1)return String.fromCodePoint(qt);const n=t?Uc(e):"BigEndian";let r=t?2:0;const i=[];for(;e.length-r>=2;){const o=Co(e[r++],e[r++],n);if(jc(o))if(e.length-r<2)i.push(qt);else{const s=Co(e[r++],e[r++],n);Ao(s)?i.push(o,s):i.push(qt)}else Ao(o)?(r+=2,i.push(qt)):i.push(o)}return r<e.length&&i.push(qt),String.fromCodePoint(...i)},jc=e=>e>=55296&&e<=56319,Ao=e=>e>=56320&&e<=57343,Co=(e,t,n)=>{if(n==="LittleEndian")return t<<8|e;if(n==="BigEndian")return e<<8|t;throw new Error(`Invalid byteOrder: ${n}`)},Uc=e=>Bo(e)?"BigEndian":Do(e)?"LittleEndian":"BigEndian",Bo=e=>e[0]===254&&e[1]===255,Do=e=>e[0]===255&&e[1]===254,To=e=>Bo(e)||Do(e),ue=e=>`\`${e}\``,$c=e=>`'${e}'`,Eo=e=>{const t=typeof e;return t==="string"?$c(e):t==="undefined"?ue(e):e},Hc=(e,t,n)=>{const r=new Array(n.length);for(let o=0,s=n.length;o<s;o++){const c=n[o];r[o]=Eo(c)}const i=r.join(" or ");return`${ue(t)} must be one of ${i}, but was actually ${Eo(e)}`},Xt=(e,t,n)=>{Array.isArray(n)||(n=vo(n));for(let r=0,i=n.length;r<i;r++)if(e===n[r])return;throw new TypeError(Hc(e,t,n))},Me=(e,t,n)=>{Array.isArray(n)||(n=vo(n)),Xt(e,t,n.concat(void 0))},Gc=e=>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),Vc=(e,t)=>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],Wc=(e,t,n)=>{const r=new Array(n.length);for(let o=0,s=n.length;o<s;o++){const c=n[o];c==="null"&&(r[o]=ue("null")),c==="undefined"&&(r[o]=ue("undefined")),c==="string"?r[o]=ue("string"):c==="number"?r[o]=ue("number"):c==="boolean"?r[o]=ue("boolean"):c==="symbol"?r[o]=ue("symbol"):c==="bigint"?r[o]=ue("bigint"):c===Array?r[o]=ue("Array"):c===Uint8Array?r[o]=ue("Uint8Array"):c===ArrayBuffer?r[o]=ue("ArrayBuffer"):r[o]=ue(c[1])}const i=r.join(" or ");return`${ue(t)} must be of type ${i}, but was actually of type ${ue(Gc(e))}`},D=(e,t,n)=>{for(let r=0,i=n.length;r<i;r++)if(Vc(e,n[r]))return;throw new TypeError(Wc(e,t,n))},j=(e,t,n)=>{D(e,t,n.concat("undefined"))},Po=(e,t,n)=>{for(let r=0,i=e.length;r<i;r++)D(e[r],t,n)},tt=(e,t,n,r)=>{if(D(e,t,["number"]),D(n,"min",["number"]),D(r,"max",["number"]),r=Math.max(n,r),e<n||e>r)throw new Error(`${ue(t)} must be at least ${n} and at most ${r}, but was actually ${e}`)},Ze=(e,t,n,r)=>{D(e,t,["number","undefined"]),typeof e=="number"&&tt(e,t,n,r)},Kc=(e,t,n)=>{if(D(e,t,["number"]),e%n!==0)throw new Error(`${ue(t)} must be a multiple of ${n}, but was actually ${e}`)},Zc=(e,t)=>{if(!Number.isInteger(e))throw new Error(`${ue(t)} must be an integer, but was actually ${e}`)};class Le extends Error{constructor(t,n){const r=`Method ${t}.${n}() not implemented`;super(r)}}class Tr extends Error{constructor(t){const n=`Cannot construct ${t} - it has a private constructor`;super(n)}}class Er extends Error{constructor(t,n){const r=s=>{var c,l;return(l=s?.name)!=null?l:(c=s?.constructor)==null?void 0:c.name},o=`Expected instance of ${(Array.isArray(t)?t.map(r):[r(t)]).join(" or ")}, but got instance of ${n&&r(n)}`;super(o)}}class qc extends Error{constructor(t){const n=`${t} stream encoding not supported`;super(n)}}class Pr extends Error{constructor(t,n){const r=`Cannot call ${t}.${n}() more than once`;super(r)}}class Xc extends Error{constructor(){const t="Can't embed page with missing Contents";super(t)}}class Yc extends Error{constructor(t){var n,r,i;const s=`Unrecognized stream type: ${(i=(r=(n=t?.contructor)==null?void 0:n.name)!=null?r:t?.name)!=null?i:t}`;super(s)}}class Jc extends Error{constructor(t){const n=`Attempted to convert PDFArray with ${t} elements to rectangle, but must have exactly 4 elements.`;super(n)}}class Ro extends Error{constructor(t){const n=`Attempted to convert "${t}" to a date, but it does not match the PDF date string format.`;super(n)}}class Io extends Error{constructor(t,n){const r=`Invalid targetIndex specified: targetIndex=${t} must be less than Count=${n}`;super(r)}}class Oo extends Error{constructor(t,n){const r=`Failed to ${n} at targetIndex=${t} due to corrupt page tree: It is likely that one or more 'Count' entries are invalid`;super(r)}}class Nn extends Error{constructor(t,n,r){const i=`index should be at least ${n} and at most ${r}, but was actually ${t}`;super(i)}}class Rr extends Error{constructor(){const t="Attempted to set invalid field value";super(t)}}class Qc extends Error{constructor(){const t="Attempted to select multiple values for single-select field";super(t)}}class el extends Error{constructor(t){const n=`No /DA (default appearance) entry found for field: ${t}`;super(n)}}class tl extends Error{constructor(t){const n=`No Tf operator found for DA of field: ${t}`;super(n)}}class zo extends Error{constructor(t,n){const r=`Failed to parse number (line:${t.line} col:${t.column} offset=${t.offset}): "${n}"`;super(r)}}class nt extends Error{constructor(t,n){const r=`Failed to parse PDF document (line:${t.line} col:${t.column} offset=${t.offset}): ${n}`;super(r)}}class nl extends nt{constructor(t,n,r){const i=`Expected next byte to be ${n} but it was actually ${r}`;super(t,i)}}class rl extends nt{constructor(t,n){const r=`Failed to parse PDF object starting with the following byte: ${n}`;super(t,r)}}class il extends nt{constructor(t){const n="Failed to parse invalid PDF object";super(t,n)}}class ol extends nt{constructor(t){const n="Failed to parse PDF stream";super(t,n)}}class sl extends nt{constructor(t){const n="Failed to parse PDF literal string due to unbalanced parenthesis";super(t,n)}}class al extends nt{constructor(t){const n="Parser stalled";super(t,n)}}class cl extends nt{constructor(t){const n="No PDF header found";super(t,n)}}class ll extends nt{constructor(t,n){const r=`Did not find expected keyword '${wo(n)}'`;super(t,r)}}class _e{clone(t){throw new Le(this.constructor.name,"clone")}toString(){throw new Le(this.constructor.name,"toString")}sizeInBytes(){throw new Le(this.constructor.name,"sizeInBytes")}copyBytesInto(t,n){throw new Le(this.constructor.name,"copyBytesInto")}}const Ir=class extends _e{constructor(e){super(),b(this,"numberValue"),b(this,"stringValue"),this.numberValue=e,this.stringValue=Fc(e)}asNumber(){return this.numberValue}value(){return this.numberValue}clone(){return Ir.of(this.numberValue)}toString(){return this.stringValue}sizeInBytes(){return this.stringValue.length}copyBytesInto(e,t){return t+=be(this.stringValue,e,t),this.stringValue.length}};let $=Ir;b($,"of",e=>new Ir(e));var m=(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",e))(m||{});const Or=class extends _e{constructor(e){super(),b(this,"array"),b(this,"context"),this.array=[],this.context=e}size(){return this.array.length}push(e){this.array.push(e)}insert(e,t){this.array.splice(e,0,t)}indexOf(e){const t=this.array.indexOf(e);return t===-1?void 0:t}remove(e){this.array.splice(e,1)}set(e,t){this.array[e]=t}get(e){return this.array[e]}lookupMaybe(e,...t){return this.context.lookupMaybe(this.get(e),...t)}lookup(e,...t){return this.context.lookup(this.get(e),...t)}asRectangle(){if(this.size()!==4)throw new Jc(this.size());const e=this.lookup(0,$).asNumber(),t=this.lookup(1,$).asNumber(),n=this.lookup(2,$).asNumber(),r=this.lookup(3,$).asNumber(),i=e,o=t,s=n-e,c=r-t;return{x:i,y:o,width:s,height:c}}asArray(){return this.array.slice()}clone(e){const t=Or.withContext(e||this.context);for(let n=0,r=this.size();n<r;n++)t.push(this.array[n]);return t}toString(){let e="[ ";for(let t=0,n=this.size();t<n;t++)e+=this.get(t).toString(),e+=" ";return e+="]",e}sizeInBytes(){let e=3;for(let t=0,n=this.size();t<n;t++)e+=this.get(t).sizeInBytes()+1;return e}copyBytesInto(e,t){const n=t;e[t++]=m.LeftSquareBracket,e[t++]=m.Space;for(let r=0,i=this.size();r<i;r++)t+=this.get(r).copyBytesInto(e,t),e[t++]=m.Space;return e[t++]=m.RightSquareBracket,t-n}scalePDFNumbers(e,t){for(let n=0,r=this.size();n<r;n++){const i=this.lookup(n);if(i instanceof $){const o=n%2===0?e:t;this.set(n,$.of(i.asNumber()*o))}}}};let q=Or;b(q,"withContext",e=>new Or(e));const Te=new Uint8Array(256);Te[m.LeftParen]=1,Te[m.RightParen]=1,Te[m.LessThan]=1,Te[m.GreaterThan]=1,Te[m.LeftSquareBracket]=1,Te[m.RightSquareBracket]=1,Te[m.LeftCurly]=1,Te[m.RightCurly]=1,Te[m.ForwardSlash]=1,Te[m.Percent]=1;const qe=new Uint8Array(256);qe[m.Null]=1,qe[m.Tab]=1,qe[m.Newline]=1,qe[m.FormFeed]=1,qe[m.CarriageReturn]=1,qe[m.Space]=1;const zr=new Uint8Array(256);for(let e=0,t=256;e<t;e++)zr[e]=qe[e]||Te[e]?1:0;zr[m.Hash]=1;const hl=e=>e.replace(/#([\dABCDEF]{2})/g,(t,n)=>Tc(n)),dl=e=>e>=m.ExclamationPoint&&e<=m.Tilde&&!zr[e],Fo={},No=new Map,ne=class extends _e{constructor(e,t){if(e!==Fo)throw new Tr("PDFName");super(),b(this,"encodedName");let n="/";for(let r=0,i=t.length;r<i;r++){const o=t[r],s=H(o);n+=dl(s)?o:`#${yo(s)}`}this.encodedName=n}asBytes(){const e=[];let t="",n=!1;const r=i=>{i!==void 0&&e.push(i),n=!1};for(let i=1,o=this.encodedName.length;i<o;i++){const s=this.encodedName[i],c=H(s),l=this.encodedName[i+1];n?c>=m.Zero&&c<=m.Nine||c>=m.a&&c<=m.f||c>=m.A&&c<=m.F?(t+=s,(t.length===2||!(l>="0"&&l<="9"||l>="a"&&l<="f"||l>="A"&&l<="F"))&&(r(parseInt(t,16)),t="")):r(c):c===m.Hash?n=!0:r(c)}return new Uint8Array(e)}decodeText(){const e=this.asBytes();return String.fromCharCode(...Array.from(e))}asString(){return this.encodedName}value(){return this.encodedName}clone(){return this}toString(){return this.encodedName}sizeInBytes(){return this.encodedName.length}copyBytesInto(e,t){return t+=be(this.encodedName,e,t),this.encodedName.length}};let p=ne;b(p,"of",e=>{const t=hl(e);let n=No.get(t);return n||(n=new ne(Fo,t),No.set(t,n)),n}),b(p,"Length",ne.of("Length")),b(p,"FlateDecode",ne.of("FlateDecode")),b(p,"Resources",ne.of("Resources")),b(p,"Font",ne.of("Font")),b(p,"XObject",ne.of("XObject")),b(p,"ExtGState",ne.of("ExtGState")),b(p,"Contents",ne.of("Contents")),b(p,"Type",ne.of("Type")),b(p,"Parent",ne.of("Parent")),b(p,"MediaBox",ne.of("MediaBox")),b(p,"Page",ne.of("Page")),b(p,"Annots",ne.of("Annots")),b(p,"TrimBox",ne.of("TrimBox")),b(p,"ArtBox",ne.of("ArtBox")),b(p,"BleedBox",ne.of("BleedBox")),b(p,"CropBox",ne.of("CropBox")),b(p,"Rotate",ne.of("Rotate")),b(p,"Title",ne.of("Title")),b(p,"Author",ne.of("Author")),b(p,"Subject",ne.of("Subject")),b(p,"Creator",ne.of("Creator")),b(p,"Keywords",ne.of("Keywords")),b(p,"Producer",ne.of("Producer")),b(p,"CreationDate",ne.of("CreationDate")),b(p,"ModDate",ne.of("ModDate"));const Mn=class extends _e{constructor(e){super(),b(this,"value"),this.value=e}asBytes(){const e=this.value+(this.value.length%2===1?"0":""),t=e.length,n=new Uint8Array(e.length/2);let r=0,i=0;for(;r<t;){const o=parseInt(e.substring(r,r+2),16);n[i]=o,r+=2,i+=1}return n}decodeText(){const e=this.asBytes();return To(e)?ko(e):So(e)}decodeDate(){const e=this.decodeText(),t=_o(e);if(!t)throw new Ro(e);return t}asString(){return this.value}clone(){return Mn.of(this.value)}toString(){return`<${this.value}>`}sizeInBytes(){return this.value.length+2}copyBytesInto(e,t){return e[t++]=m.LessThan,t+=be(this.value,e,t),e[t++]=m.GreaterThan,this.value.length+2}};let X=Mn;b(X,"of",e=>new Mn(e)),b(X,"fromText",e=>{const t=Nc(e);let n="";for(let r=0,i=t.length;r<i;r++)n+=mo(t[r],4);return new Mn(n)});/*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */const fl=4,Mo=0,Lo=1,ul=2;function Bt(e){let t=e.length;for(;--t>=0;)e[t]=0}const gl=0,jo=1,pl=2,bl=3,ml=258,Fr=29,Yt=256,Jt=Yt+1+Fr,Dt=30,Nr=19,Uo=2*Jt+1,dt=15,Mr=16,yl=7,Lr=256,$o=16,Ho=17,Go=18,jr=new Uint8Array([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]),Ln=new Uint8Array([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]),_l=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),Vo=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),wl=512,Xe=new Array((Jt+2)*2);Bt(Xe);const Qt=new Array(Dt*2);Bt(Qt);const en=new Array(wl);Bt(en);const tn=new Array(ml-bl+1);Bt(tn);const Ur=new Array(Fr);Bt(Ur);const jn=new Array(Dt);Bt(jn);function $r(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}let Wo,Ko,Zo;function Hr(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}const qo=e=>e<256?en[e]:en[256+(e>>>7)],nn=(e,t)=>{e.pending_buf[e.pending++]=t&255,e.pending_buf[e.pending++]=t>>>8&255},xe=(e,t,n)=>{e.bi_valid>Mr-n?(e.bi_buf|=t<<e.bi_valid&65535,nn(e,e.bi_buf),e.bi_buf=t>>Mr-e.bi_valid,e.bi_valid+=n-Mr):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=n)},je=(e,t,n)=>{xe(e,n[t*2],n[t*2+1])},Xo=(e,t)=>{let n=0;do n|=e&1,e>>>=1,n<<=1;while(--t>0);return n>>>1},xl=e=>{e.bi_valid===16?(nn(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)},Sl=(e,t)=>{const n=t.dyn_tree,r=t.max_code,i=t.stat_desc.static_tree,o=t.stat_desc.has_stree,s=t.stat_desc.extra_bits,c=t.stat_desc.extra_base,l=t.stat_desc.max_length;let a,h,f,u,d,y,w=0;for(u=0;u<=dt;u++)e.bl_count[u]=0;for(n[e.heap[e.heap_max]*2+1]=0,a=e.heap_max+1;a<Uo;a++)h=e.heap[a],u=n[n[h*2+1]*2+1]+1,u>l&&(u=l,w++),n[h*2+1]=u,!(h>r)&&(e.bl_count[u]++,d=0,h>=c&&(d=s[h-c]),y=n[h*2],e.opt_len+=y*(u+d),o&&(e.static_len+=y*(i[h*2+1]+d)));if(w!==0){do{for(u=l-1;e.bl_count[u]===0;)u--;e.bl_count[u]--,e.bl_count[u+1]+=2,e.bl_count[l]--,w-=2}while(w>0);for(u=l;u!==0;u--)for(h=e.bl_count[u];h!==0;)f=e.heap[--a],!(f>r)&&(n[f*2+1]!==u&&(e.opt_len+=(u-n[f*2+1])*n[f*2],n[f*2+1]=u),h--)}},Yo=(e,t,n)=>{const r=new Array(dt+1);let i=0,o,s;for(o=1;o<=dt;o++)i=i+n[o-1]<<1,r[o]=i;for(s=0;s<=t;s++){let c=e[s*2+1];c!==0&&(e[s*2]=Xo(r[c]++,c))}},vl=()=>{let e,t,n,r,i;const o=new Array(dt+1);for(n=0,r=0;r<Fr-1;r++)for(Ur[r]=n,e=0;e<1<<jr[r];e++)tn[n++]=r;for(tn[n-1]=r,i=0,r=0;r<16;r++)for(jn[r]=i,e=0;e<1<<Ln[r];e++)en[i++]=r;for(i>>=7;r<Dt;r++)for(jn[r]=i<<7,e=0;e<1<<Ln[r]-7;e++)en[256+i++]=r;for(t=0;t<=dt;t++)o[t]=0;for(e=0;e<=143;)Xe[e*2+1]=8,e++,o[8]++;for(;e<=255;)Xe[e*2+1]=9,e++,o[9]++;for(;e<=279;)Xe[e*2+1]=7,e++,o[7]++;for(;e<=287;)Xe[e*2+1]=8,e++,o[8]++;for(Yo(Xe,Jt+1,o),e=0;e<Dt;e++)Qt[e*2+1]=5,Qt[e*2]=Xo(e,5);Wo=new $r(Xe,jr,Yt+1,Jt,dt),Ko=new $r(Qt,Ln,0,Dt,dt),Zo=new $r(new Array(0),_l,0,Nr,yl)},Jo=e=>{let t;for(t=0;t<Jt;t++)e.dyn_ltree[t*2]=0;for(t=0;t<Dt;t++)e.dyn_dtree[t*2]=0;for(t=0;t<Nr;t++)e.bl_tree[t*2]=0;e.dyn_ltree[Lr*2]=1,e.opt_len=e.static_len=0,e.sym_next=e.matches=0},Qo=e=>{e.bi_valid>8?nn(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0},es=(e,t,n,r)=>{const i=t*2,o=n*2;return e[i]<e[o]||e[i]===e[o]&&r[t]<=r[n]},Gr=(e,t,n)=>{const r=e.heap[n];let i=n<<1;for(;i<=e.heap_len&&(i<e.heap_len&&es(t,e.heap[i+1],e.heap[i],e.depth)&&i++,!es(t,r,e.heap[i],e.depth));)e.heap[n]=e.heap[i],n=i,i<<=1;e.heap[n]=r},ts=(e,t,n)=>{let r,i,o=0,s,c;if(e.sym_next!==0)do r=e.pending_buf[e.sym_buf+o++]&255,r+=(e.pending_buf[e.sym_buf+o++]&255)<<8,i=e.pending_buf[e.sym_buf+o++],r===0?je(e,i,t):(s=tn[i],je(e,s+Yt+1,t),c=jr[s],c!==0&&(i-=Ur[s],xe(e,i,c)),r--,s=qo(r),je(e,s,n),c=Ln[s],c!==0&&(r-=jn[s],xe(e,r,c)));while(o<e.sym_next);je(e,Lr,t)},Vr=(e,t)=>{const n=t.dyn_tree,r=t.stat_desc.static_tree,i=t.stat_desc.has_stree,o=t.stat_desc.elems;let s,c,l=-1,a;for(e.heap_len=0,e.heap_max=Uo,s=0;s<o;s++)n[s*2]!==0?(e.heap[++e.heap_len]=l=s,e.depth[s]=0):n[s*2+1]=0;for(;e.heap_len<2;)a=e.heap[++e.heap_len]=l<2?++l:0,n[a*2]=1,e.depth[a]=0,e.opt_len--,i&&(e.static_len-=r[a*2+1]);for(t.max_code=l,s=e.heap_len>>1;s>=1;s--)Gr(e,n,s);a=o;do s=e.heap[1],e.heap[1]=e.heap[e.heap_len--],Gr(e,n,1),c=e.heap[1],e.heap[--e.heap_max]=s,e.heap[--e.heap_max]=c,n[a*2]=n[s*2]+n[c*2],e.depth[a]=(e.depth[s]>=e.depth[c]?e.depth[s]:e.depth[c])+1,n[s*2+1]=n[c*2+1]=a,e.heap[1]=a++,Gr(e,n,1);while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],Sl(e,t),Yo(n,l,e.bl_count)},ns=(e,t,n)=>{let r,i=-1,o,s=t[0*2+1],c=0,l=7,a=4;for(s===0&&(l=138,a=3),t[(n+1)*2+1]=65535,r=0;r<=n;r++)o=s,s=t[(r+1)*2+1],!(++c<l&&o===s)&&(c<a?e.bl_tree[o*2]+=c:o!==0?(o!==i&&e.bl_tree[o*2]++,e.bl_tree[$o*2]++):c<=10?e.bl_tree[Ho*2]++:e.bl_tree[Go*2]++,c=0,i=o,s===0?(l=138,a=3):o===s?(l=6,a=3):(l=7,a=4))},rs=(e,t,n)=>{let r,i=-1,o,s=t[0*2+1],c=0,l=7,a=4;for(s===0&&(l=138,a=3),r=0;r<=n;r++)if(o=s,s=t[(r+1)*2+1],!(++c<l&&o===s)){if(c<a)do je(e,o,e.bl_tree);while(--c!==0);else o!==0?(o!==i&&(je(e,o,e.bl_tree),c--),je(e,$o,e.bl_tree),xe(e,c-3,2)):c<=10?(je(e,Ho,e.bl_tree),xe(e,c-3,3)):(je(e,Go,e.bl_tree),xe(e,c-11,7));c=0,i=o,s===0?(l=138,a=3):o===s?(l=6,a=3):(l=7,a=4)}},kl=e=>{let t;for(ns(e,e.dyn_ltree,e.l_desc.max_code),ns(e,e.dyn_dtree,e.d_desc.max_code),Vr(e,e.bl_desc),t=Nr-1;t>=3&&e.bl_tree[Vo[t]*2+1]===0;t--);return e.opt_len+=3*(t+1)+5+5+4,t},Al=(e,t,n,r)=>{let i;for(xe(e,t-257,5),xe(e,n-1,5),xe(e,r-4,4),i=0;i<r;i++)xe(e,e.bl_tree[Vo[i]*2+1],3);rs(e,e.dyn_ltree,t-1),rs(e,e.dyn_dtree,n-1)},Cl=e=>{let t=4093624447,n;for(n=0;n<=31;n++,t>>>=1)if(t&1&&e.dyn_ltree[n*2]!==0)return Mo;if(e.dyn_ltree[9*2]!==0||e.dyn_ltree[10*2]!==0||e.dyn_ltree[13*2]!==0)return Lo;for(n=32;n<Yt;n++)if(e.dyn_ltree[n*2]!==0)return Lo;return Mo};let is=!1;const Bl=e=>{is||(vl(),is=!0),e.l_desc=new Hr(e.dyn_ltree,Wo),e.d_desc=new Hr(e.dyn_dtree,Ko),e.bl_desc=new Hr(e.bl_tree,Zo),e.bi_buf=0,e.bi_valid=0,Jo(e)},os=(e,t,n,r)=>{xe(e,(gl<<1)+(r?1:0),3),Qo(e),nn(e,n),nn(e,~n),n&&e.pending_buf.set(e.window.subarray(t,t+n),e.pending),e.pending+=n},Dl=e=>{xe(e,jo<<1,3),je(e,Lr,Xe),xl(e)},Tl=(e,t,n,r)=>{let i,o,s=0;e.level>0?(e.strm.data_type===ul&&(e.strm.data_type=Cl(e)),Vr(e,e.l_desc),Vr(e,e.d_desc),s=kl(e),i=e.opt_len+3+7>>>3,o=e.static_len+3+7>>>3,o<=i&&(i=o)):i=o=n+5,n+4<=i&&t!==-1?os(e,t,n,r):e.strategy===fl||o===i?(xe(e,(jo<<1)+(r?1:0),3),ts(e,Xe,Qt)):(xe(e,(pl<<1)+(r?1:0),3),Al(e,e.l_desc.max_code+1,e.d_desc.max_code+1,s+1),ts(e,e.dyn_ltree,e.dyn_dtree)),Jo(e),r&&Qo(e)},El=(e,t,n)=>(e.pending_buf[e.sym_buf+e.sym_next++]=t,e.pending_buf[e.sym_buf+e.sym_next++]=t>>8,e.pending_buf[e.sym_buf+e.sym_next++]=n,t===0?e.dyn_ltree[n*2]++:(e.matches++,t--,e.dyn_ltree[(tn[n]+Yt+1)*2]++,e.dyn_dtree[qo(t)*2]++),e.sym_next===e.sym_end);var Pl=Bl,Rl=os,Il=Tl,Ol=El,zl=Dl,Fl={_tr_init:Pl,_tr_stored_block:Rl,_tr_flush_block:Il,_tr_tally:Ol,_tr_align:zl},rn=(e,t,n,r)=>{let i=e&65535|0,o=e>>>16&65535|0,s=0;for(;n!==0;){s=n>2e3?2e3:n,n-=s;do i=i+t[r++]|0,o=o+i|0;while(--s);i%=65521,o%=65521}return i|o<<16|0};const Nl=()=>{let e,t=[];for(var 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},Ml=new Uint32Array(Nl());var ge=(e,t,n,r)=>{const i=Ml,o=r+n;e^=-1;for(let s=r;s<o;s++)e=e>>>8^i[(e^t[s])&255];return e^-1},ft={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"},ut={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_MEM_ERROR:-4,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};const{_tr_init:Ll,_tr_stored_block:Wr,_tr_flush_block:jl,_tr_tally:rt,_tr_align:Ul}=Fl,{Z_NO_FLUSH:it,Z_PARTIAL_FLUSH:$l,Z_FULL_FLUSH:Hl,Z_FINISH:Ee,Z_BLOCK:ss,Z_OK:me,Z_STREAM_END:as,Z_STREAM_ERROR:Ue,Z_DATA_ERROR:Gl,Z_BUF_ERROR:Kr,Z_DEFAULT_COMPRESSION:Vl,Z_FILTERED:Wl,Z_HUFFMAN_ONLY:Un,Z_RLE:Kl,Z_FIXED:Zl,Z_DEFAULT_STRATEGY:ql,Z_UNKNOWN:Xl,Z_DEFLATED:$n}=ut,Yl=9,Jl=15,Ql=8,eh=29,Zr=256+1+eh,th=30,nh=19,rh=2*Zr+1,ih=15,Y=3,ot=258,$e=ot+Y+1,oh=32,Tt=42,qr=57,Xr=69,Yr=73,Jr=91,Qr=103,gt=113,on=666,we=1,Et=2,pt=3,Pt=4,sh=3,bt=(e,t)=>(e.msg=ft[t],t),cs=e=>e*2-(e>4?9:0),st=e=>{let t=e.length;for(;--t>=0;)e[t]=0},ah=e=>{let t,n,r,i=e.w_size;t=e.hash_size,r=t;do n=e.head[--r],e.head[r]=n>=i?n-i:0;while(--t);t=i,r=t;do n=e.prev[--r],e.prev[r]=n>=i?n-i:0;while(--t)};let at=(e,t,n)=>(t<<e.hash_shift^n)&e.hash_mask;const Ae=e=>{const t=e.state;let n=t.pending;n>e.avail_out&&(n=e.avail_out),n!==0&&(e.output.set(t.pending_buf.subarray(t.pending_out,t.pending_out+n),e.next_out),e.next_out+=n,t.pending_out+=n,e.total_out+=n,e.avail_out-=n,t.pending-=n,t.pending===0&&(t.pending_out=0))},Ce=(e,t)=>{jl(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,Ae(e.strm)},Q=(e,t)=>{e.pending_buf[e.pending++]=t},sn=(e,t)=>{e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=t&255},ei=(e,t,n,r)=>{let i=e.avail_in;return i>r&&(i=r),i===0?0:(e.avail_in-=i,t.set(e.input.subarray(e.next_in,e.next_in+i),n),e.state.wrap===1?e.adler=rn(e.adler,t,i,n):e.state.wrap===2&&(e.adler=ge(e.adler,t,i,n)),e.next_in+=i,e.total_in+=i,i)},ls=(e,t)=>{let n=e.max_chain_length,r=e.strstart,i,o,s=e.prev_length,c=e.nice_match;const l=e.strstart>e.w_size-$e?e.strstart-(e.w_size-$e):0,a=e.window,h=e.w_mask,f=e.prev,u=e.strstart+ot;let d=a[r+s-1],y=a[r+s];e.prev_length>=e.good_match&&(n>>=2),c>e.lookahead&&(c=e.lookahead);do if(i=t,!(a[i+s]!==y||a[i+s-1]!==d||a[i]!==a[r]||a[++i]!==a[r+1])){r+=2,i++;do;while(a[++r]===a[++i]&&a[++r]===a[++i]&&a[++r]===a[++i]&&a[++r]===a[++i]&&a[++r]===a[++i]&&a[++r]===a[++i]&&a[++r]===a[++i]&&a[++r]===a[++i]&&r<u);if(o=ot-(u-r),r=u-ot,o>s){if(e.match_start=t,s=o,o>=c)break;d=a[r+s-1],y=a[r+s]}}while((t=f[t&h])>l&&--n!==0);return s<=e.lookahead?s:e.lookahead},Rt=e=>{const t=e.w_size;let n,r,i;do{if(r=e.window_size-e.lookahead-e.strstart,e.strstart>=t+(t-$e)&&(e.window.set(e.window.subarray(t,t+t-r),0),e.match_start-=t,e.strstart-=t,e.block_start-=t,e.insert>e.strstart&&(e.insert=e.strstart),ah(e),r+=t),e.strm.avail_in===0)break;if(n=ei(e.strm,e.window,e.strstart+e.lookahead,r),e.lookahead+=n,e.lookahead+e.insert>=Y)for(i=e.strstart-e.insert,e.ins_h=e.window[i],e.ins_h=at(e,e.ins_h,e.window[i+1]);e.insert&&(e.ins_h=at(e,e.ins_h,e.window[i+Y-1]),e.prev[i&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=i,i++,e.insert--,!(e.lookahead+e.insert<Y)););}while(e.lookahead<$e&&e.strm.avail_in!==0)},hs=(e,t)=>{let n=e.pending_buf_size-5>e.w_size?e.w_size:e.pending_buf_size-5,r,i,o,s=0,c=e.strm.avail_in;do{if(r=65535,o=e.bi_valid+42>>3,e.strm.avail_out<o||(o=e.strm.avail_out-o,i=e.strstart-e.block_start,r>i+e.strm.avail_in&&(r=i+e.strm.avail_in),r>o&&(r=o),r<n&&(r===0&&t!==Ee||t===it||r!==i+e.strm.avail_in)))break;s=t===Ee&&r===i+e.strm.avail_in?1:0,Wr(e,0,0,s),e.pending_buf[e.pending-4]=r,e.pending_buf[e.pending-3]=r>>8,e.pending_buf[e.pending-2]=~r,e.pending_buf[e.pending-1]=~r>>8,Ae(e.strm),i&&(i>r&&(i=r),e.strm.output.set(e.window.subarray(e.block_start,e.block_start+i),e.strm.next_out),e.strm.next_out+=i,e.strm.avail_out-=i,e.strm.total_out+=i,e.block_start+=i,r-=i),r&&(ei(e.strm,e.strm.output,e.strm.next_out,r),e.strm.next_out+=r,e.strm.avail_out-=r,e.strm.total_out+=r)}while(s===0);return c-=e.strm.avail_in,c&&(c>=e.w_size?(e.matches=2,e.window.set(e.strm.input.subarray(e.strm.next_in-e.w_size,e.strm.next_in),0),e.strstart=e.w_size,e.insert=e.strstart):(e.window_size-e.strstart<=c&&(e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,e.insert>e.strstart&&(e.insert=e.strstart)),e.window.set(e.strm.input.subarray(e.strm.next_in-c,e.strm.next_in),e.strstart),e.strstart+=c,e.insert+=c>e.w_size-e.insert?e.w_size-e.insert:c),e.block_start=e.strstart),e.high_water<e.strstart&&(e.high_water=e.strstart),s?Pt:t!==it&&t!==Ee&&e.strm.avail_in===0&&e.strstart===e.block_start?Et:(o=e.window_size-e.strstart,e.strm.avail_in>o&&e.block_start>=e.w_size&&(e.block_start-=e.w_size,e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,o+=e.w_size,e.insert>e.strstart&&(e.insert=e.strstart)),o>e.strm.avail_in&&(o=e.strm.avail_in),o&&(ei(e.strm,e.window,e.strstart,o),e.strstart+=o,e.insert+=o>e.w_size-e.insert?e.w_size-e.insert:o),e.high_water<e.strstart&&(e.high_water=e.strstart),o=e.bi_valid+42>>3,o=e.pending_buf_size-o>65535?65535:e.pending_buf_size-o,n=o>e.w_size?e.w_size:o,i=e.strstart-e.block_start,(i>=n||(i||t===Ee)&&t!==it&&e.strm.avail_in===0&&i<=o)&&(r=i>o?o:i,s=t===Ee&&e.strm.avail_in===0&&r===i?1:0,Wr(e,e.block_start,r,s),e.block_start+=r,Ae(e.strm)),s?pt:we)},ti=(e,t)=>{let n,r;for(;;){if(e.lookahead<$e){if(Rt(e),e.lookahead<$e&&t===it)return we;if(e.lookahead===0)break}if(n=0,e.lookahead>=Y&&(e.ins_h=at(e,e.ins_h,e.window[e.strstart+Y-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),n!==0&&e.strstart-n<=e.w_size-$e&&(e.match_length=ls(e,n)),e.match_length>=Y)if(r=rt(e,e.strstart-e.match_start,e.match_length-Y),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=Y){e.match_length--;do e.strstart++,e.ins_h=at(e,e.ins_h,e.window[e.strstart+Y-1]),n=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=at(e,e.ins_h,e.window[e.strstart+1]);else r=rt(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(r&&(Ce(e,!1),e.strm.avail_out===0))return we}return e.insert=e.strstart<Y-1?e.strstart:Y-1,t===Ee?(Ce(e,!0),e.strm.avail_out===0?pt:Pt):e.sym_next&&(Ce(e,!1),e.strm.avail_out===0)?we:Et},It=(e,t)=>{let n,r,i;for(;;){if(e.lookahead<$e){if(Rt(e),e.lookahead<$e&&t===it)return we;if(e.lookahead===0)break}if(n=0,e.lookahead>=Y&&(e.ins_h=at(e,e.ins_h,e.window[e.strstart+Y-1]),n=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=Y-1,n!==0&&e.prev_length<e.max_lazy_match&&e.strstart-n<=e.w_size-$e&&(e.match_length=ls(e,n),e.match_length<=5&&(e.strategy===Wl||e.match_length===Y&&e.strstart-e.match_start>4096)&&(e.match_length=Y-1)),e.prev_length>=Y&&e.match_length<=e.prev_length){i=e.strstart+e.lookahead-Y,r=rt(e,e.strstart-1-e.prev_match,e.prev_length-Y),e.lookahead-=e.prev_length-1,e.prev_length-=2;do++e.strstart<=i&&(e.ins_h=at(e,e.ins_h,e.window[e.strstart+Y-1]),n=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=Y-1,e.strstart++,r&&(Ce(e,!1),e.strm.avail_out===0))return we}else if(e.match_available){if(r=rt(e,0,e.window[e.strstart-1]),r&&Ce(e,!1),e.strstart++,e.lookahead--,e.strm.avail_out===0)return we}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(r=rt(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<Y-1?e.strstart:Y-1,t===Ee?(Ce(e,!0),e.strm.avail_out===0?pt:Pt):e.sym_next&&(Ce(e,!1),e.strm.avail_out===0)?we:Et},ch=(e,t)=>{let n,r,i,o;const s=e.window;for(;;){if(e.lookahead<=ot){if(Rt(e),e.lookahead<=ot&&t===it)return we;if(e.lookahead===0)break}if(e.match_length=0,e.lookahead>=Y&&e.strstart>0&&(i=e.strstart-1,r=s[i],r===s[++i]&&r===s[++i]&&r===s[++i])){o=e.strstart+ot;do;while(r===s[++i]&&r===s[++i]&&r===s[++i]&&r===s[++i]&&r===s[++i]&&r===s[++i]&&r===s[++i]&&r===s[++i]&&i<o);e.match_length=ot-(o-i),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=Y?(n=rt(e,1,e.match_length-Y),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(n=rt(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),n&&(Ce(e,!1),e.strm.avail_out===0))return we}return e.insert=0,t===Ee?(Ce(e,!0),e.strm.avail_out===0?pt:Pt):e.sym_next&&(Ce(e,!1),e.strm.avail_out===0)?we:Et},lh=(e,t)=>{let n;for(;;){if(e.lookahead===0&&(Rt(e),e.lookahead===0)){if(t===it)return we;break}if(e.match_length=0,n=rt(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,n&&(Ce(e,!1),e.strm.avail_out===0))return we}return e.insert=0,t===Ee?(Ce(e,!0),e.strm.avail_out===0?pt:Pt):e.sym_next&&(Ce(e,!1),e.strm.avail_out===0)?we:Et};function He(e,t,n,r,i){this.good_length=e,this.max_lazy=t,this.nice_length=n,this.max_chain=r,this.func=i}const an=[new He(0,0,0,0,hs),new He(4,4,8,4,ti),new He(4,5,16,8,ti),new He(4,6,32,32,ti),new He(4,4,16,16,It),new He(8,16,32,32,It),new He(8,16,128,128,It),new He(8,32,128,256,It),new He(32,128,258,1024,It),new He(32,258,258,4096,It)],hh=e=>{e.window_size=2*e.w_size,st(e.head),e.max_lazy_match=an[e.level].max_lazy,e.good_match=an[e.level].good_length,e.nice_match=an[e.level].nice_length,e.max_chain_length=an[e.level].max_chain,e.strstart=0,e.block_start=0,e.lookahead=0,e.insert=0,e.match_length=e.prev_length=Y-1,e.match_available=0,e.ins_h=0};function dh(){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=$n,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 Uint16Array(rh*2),this.dyn_dtree=new Uint16Array((2*th+1)*2),this.bl_tree=new Uint16Array((2*nh+1)*2),st(this.dyn_ltree),st(this.dyn_dtree),st(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(ih+1),this.heap=new Uint16Array(2*Zr+1),st(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(2*Zr+1),st(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}const cn=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.status!==Tt&&t.status!==qr&&t.status!==Xr&&t.status!==Yr&&t.status!==Jr&&t.status!==Qr&&t.status!==gt&&t.status!==on?1:0},ds=e=>{if(cn(e))return bt(e,Ue);e.total_in=e.total_out=0,e.data_type=Xl;const t=e.state;return t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap===2?qr:t.wrap?Tt:gt,e.adler=t.wrap===2?0:1,t.last_flush=-2,Ll(t),me},fs=e=>{const t=ds(e);return t===me&&hh(e.state),t},fh=(e,t)=>cn(e)||e.state.wrap!==2?Ue:(e.state.gzhead=t,me),us=(e,t,n,r,i,o)=>{if(!e)return Ue;let s=1;if(t===Vl&&(t=6),r<0?(s=0,r=-r):r>15&&(s=2,r-=16),i<1||i>Yl||n!==$n||r<8||r>15||t<0||t>9||o<0||o>Zl||r===8&&s!==1)return bt(e,Ue);r===8&&(r=9);const c=new dh;return e.state=c,c.strm=e,c.status=Tt,c.wrap=s,c.gzhead=null,c.w_bits=r,c.w_size=1<<c.w_bits,c.w_mask=c.w_size-1,c.hash_bits=i+7,c.hash_size=1<<c.hash_bits,c.hash_mask=c.hash_size-1,c.hash_shift=~~((c.hash_bits+Y-1)/Y),c.window=new Uint8Array(c.w_size*2),c.head=new Uint16Array(c.hash_size),c.prev=new Uint16Array(c.w_size),c.lit_bufsize=1<<i+6,c.pending_buf_size=c.lit_bufsize*4,c.pending_buf=new Uint8Array(c.pending_buf_size),c.sym_buf=c.lit_bufsize,c.sym_end=(c.lit_bufsize-1)*3,c.level=t,c.strategy=o,c.method=n,fs(e)},uh=(e,t)=>us(e,t,$n,Jl,Ql,ql),gh=(e,t)=>{if(cn(e)||t>ss||t<0)return e?bt(e,Ue):Ue;const n=e.state;if(!e.output||e.avail_in!==0&&!e.input||n.status===on&&t!==Ee)return bt(e,e.avail_out===0?Kr:Ue);const r=n.last_flush;if(n.last_flush=t,n.pending!==0){if(Ae(e),e.avail_out===0)return n.last_flush=-1,me}else if(e.avail_in===0&&cs(t)<=cs(r)&&t!==Ee)return bt(e,Kr);if(n.status===on&&e.avail_in!==0)return bt(e,Kr);if(n.status===Tt&&n.wrap===0&&(n.status=gt),n.status===Tt){let i=$n+(n.w_bits-8<<4)<<8,o=-1;if(n.strategy>=Un||n.level<2?o=0:n.level<6?o=1:n.level===6?o=2:o=3,i|=o<<6,n.strstart!==0&&(i|=oh),i+=31-i%31,sn(n,i),n.strstart!==0&&(sn(n,e.adler>>>16),sn(n,e.adler&65535)),e.adler=1,n.status=gt,Ae(e),n.pending!==0)return n.last_flush=-1,me}if(n.status===qr){if(e.adler=0,Q(n,31),Q(n,139),Q(n,8),n.gzhead)Q(n,(n.gzhead.text?1:0)+(n.gzhead.hcrc?2:0)+(n.gzhead.extra?4:0)+(n.gzhead.name?8:0)+(n.gzhead.comment?16:0)),Q(n,n.gzhead.time&255),Q(n,n.gzhead.time>>8&255),Q(n,n.gzhead.time>>16&255),Q(n,n.gzhead.time>>24&255),Q(n,n.level===9?2:n.strategy>=Un||n.level<2?4:0),Q(n,n.gzhead.os&255),n.gzhead.extra&&n.gzhead.extra.length&&(Q(n,n.gzhead.extra.length&255),Q(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=ge(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=Xr;else if(Q(n,0),Q(n,0),Q(n,0),Q(n,0),Q(n,0),Q(n,n.level===9?2:n.strategy>=Un||n.level<2?4:0),Q(n,sh),n.status=gt,Ae(e),n.pending!==0)return n.last_flush=-1,me}if(n.status===Xr){if(n.gzhead.extra){let i=n.pending,o=(n.gzhead.extra.length&65535)-n.gzindex;for(;n.pending+o>n.pending_buf_size;){let c=n.pending_buf_size-n.pending;if(n.pending_buf.set(n.gzhead.extra.subarray(n.gzindex,n.gzindex+c),n.pending),n.pending=n.pending_buf_size,n.gzhead.hcrc&&n.pending>i&&(e.adler=ge(e.adler,n.pending_buf,n.pending-i,i)),n.gzindex+=c,Ae(e),n.pending!==0)return n.last_flush=-1,me;i=0,o-=c}let s=new Uint8Array(n.gzhead.extra);n.pending_buf.set(s.subarray(n.gzindex,n.gzindex+o),n.pending),n.pending+=o,n.gzhead.hcrc&&n.pending>i&&(e.adler=ge(e.adler,n.pending_buf,n.pending-i,i)),n.gzindex=0}n.status=Yr}if(n.status===Yr){if(n.gzhead.name){let i=n.pending,o;do{if(n.pending===n.pending_buf_size){if(n.gzhead.hcrc&&n.pending>i&&(e.adler=ge(e.adler,n.pending_buf,n.pending-i,i)),Ae(e),n.pending!==0)return n.last_flush=-1,me;i=0}n.gzindex<n.gzhead.name.length?o=n.gzhead.name.charCodeAt(n.gzindex++)&255:o=0,Q(n,o)}while(o!==0);n.gzhead.hcrc&&n.pending>i&&(e.adler=ge(e.adler,n.pending_buf,n.pending-i,i)),n.gzindex=0}n.status=Jr}if(n.status===Jr){if(n.gzhead.comment){let i=n.pending,o;do{if(n.pending===n.pending_buf_size){if(n.gzhead.hcrc&&n.pending>i&&(e.adler=ge(e.adler,n.pending_buf,n.pending-i,i)),Ae(e),n.pending!==0)return n.last_flush=-1,me;i=0}n.gzindex<n.gzhead.comment.length?o=n.gzhead.comment.charCodeAt(n.gzindex++)&255:o=0,Q(n,o)}while(o!==0);n.gzhead.hcrc&&n.pending>i&&(e.adler=ge(e.adler,n.pending_buf,n.pending-i,i))}n.status=Qr}if(n.status===Qr){if(n.gzhead.hcrc){if(n.pending+2>n.pending_buf_size&&(Ae(e),n.pending!==0))return n.last_flush=-1,me;Q(n,e.adler&255),Q(n,e.adler>>8&255),e.adler=0}if(n.status=gt,Ae(e),n.pending!==0)return n.last_flush=-1,me}if(e.avail_in!==0||n.lookahead!==0||t!==it&&n.status!==on){let i=n.level===0?hs(n,t):n.strategy===Un?lh(n,t):n.strategy===Kl?ch(n,t):an[n.level].func(n,t);if((i===pt||i===Pt)&&(n.status=on),i===we||i===pt)return e.avail_out===0&&(n.last_flush=-1),me;if(i===Et&&(t===$l?Ul(n):t!==ss&&(Wr(n,0,0,!1),t===Hl&&(st(n.head),n.lookahead===0&&(n.strstart=0,n.block_start=0,n.insert=0))),Ae(e),e.avail_out===0))return n.last_flush=-1,me}return t!==Ee?me:n.wrap<=0?as:(n.wrap===2?(Q(n,e.adler&255),Q(n,e.adler>>8&255),Q(n,e.adler>>16&255),Q(n,e.adler>>24&255),Q(n,e.total_in&255),Q(n,e.total_in>>8&255),Q(n,e.total_in>>16&255),Q(n,e.total_in>>24&255)):(sn(n,e.adler>>>16),sn(n,e.adler&65535)),Ae(e),n.wrap>0&&(n.wrap=-n.wrap),n.pending!==0?me:as)},ph=e=>{if(cn(e))return Ue;const t=e.state.status;return e.state=null,t===gt?bt(e,Gl):me},bh=(e,t)=>{let n=t.length;if(cn(e))return Ue;const r=e.state,i=r.wrap;if(i===2||i===1&&r.status!==Tt||r.lookahead)return Ue;if(i===1&&(e.adler=rn(e.adler,t,n,0)),r.wrap=0,n>=r.w_size){i===0&&(st(r.head),r.strstart=0,r.block_start=0,r.insert=0);let l=new Uint8Array(r.w_size);l.set(t.subarray(n-r.w_size,n),0),t=l,n=r.w_size}const o=e.avail_in,s=e.next_in,c=e.input;for(e.avail_in=n,e.next_in=0,e.input=t,Rt(r);r.lookahead>=Y;){let l=r.strstart,a=r.lookahead-(Y-1);do r.ins_h=at(r,r.ins_h,r.window[l+Y-1]),r.prev[l&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=l,l++;while(--a);r.strstart=l,r.lookahead=Y-1,Rt(r)}return r.strstart+=r.lookahead,r.block_start=r.strstart,r.insert=r.lookahead,r.lookahead=0,r.match_length=r.prev_length=Y-1,r.match_available=0,e.next_in=s,e.input=c,e.avail_in=o,r.wrap=i,me};var mh=uh,yh=us,_h=fs,wh=ds,xh=fh,Sh=gh,vh=ph,kh=bh,Ah="pako deflate (from Nodeca project)",ln={deflateInit:mh,deflateInit2:yh,deflateReset:_h,deflateResetKeep:wh,deflateSetHeader:xh,deflate:Sh,deflateEnd:vh,deflateSetDictionary:kh,deflateInfo:Ah};const Ch=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var Bh=function(e){const t=Array.prototype.slice.call(arguments,1);for(;t.length;){const n=t.shift();if(!!n){if(typeof n!="object")throw new TypeError(n+"must be non-object");for(const r in n)Ch(n,r)&&(e[r]=n[r])}}return e},Dh=e=>{let t=0;for(let r=0,i=e.length;r<i;r++)t+=e[r].length;const n=new Uint8Array(t);for(let r=0,i=0,o=e.length;r<o;r++){let s=e[r];n.set(s,i),i+=s.length}return n},Hn={assign:Bh,flattenChunks:Dh};let gs=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{gs=!1}const hn=new Uint8Array(256);for(let e=0;e<256;e++)hn[e]=e>=252?6:e>=248?5:e>=240?4:e>=224?3:e>=192?2:1;hn[254]=hn[254]=1;var Th=e=>{if(typeof TextEncoder=="function"&&TextEncoder.prototype.encode)return new TextEncoder().encode(e);let t,n,r,i,o,s=e.length,c=0;for(i=0;i<s;i++)n=e.charCodeAt(i),(n&64512)===55296&&i+1<s&&(r=e.charCodeAt(i+1),(r&64512)===56320&&(n=65536+(n-55296<<10)+(r-56320),i++)),c+=n<128?1:n<2048?2:n<65536?3:4;for(t=new Uint8Array(c),o=0,i=0;o<c;i++)n=e.charCodeAt(i),(n&64512)===55296&&i+1<s&&(r=e.charCodeAt(i+1),(r&64512)===56320&&(n=65536+(n-55296<<10)+(r-56320),i++)),n<128?t[o++]=n:n<2048?(t[o++]=192|n>>>6,t[o++]=128|n&63):n<65536?(t[o++]=224|n>>>12,t[o++]=128|n>>>6&63,t[o++]=128|n&63):(t[o++]=240|n>>>18,t[o++]=128|n>>>12&63,t[o++]=128|n>>>6&63,t[o++]=128|n&63);return t};const Eh=(e,t)=>{if(t<65534&&e.subarray&&gs)return String.fromCharCode.apply(null,e.length===t?e:e.subarray(0,t));let n="";for(let r=0;r<t;r++)n+=String.fromCharCode(e[r]);return n};var Ph=(e,t)=>{const n=t||e.length;if(typeof TextDecoder=="function"&&TextDecoder.prototype.decode)return new TextDecoder().decode(e.subarray(0,t));let r,i;const o=new Array(n*2);for(i=0,r=0;r<n;){let s=e[r++];if(s<128){o[i++]=s;continue}let c=hn[s];if(c>4){o[i++]=65533,r+=c-1;continue}for(s&=c===2?31:c===3?15:7;c>1&&r<n;)s=s<<6|e[r++]&63,c--;if(c>1){o[i++]=65533;continue}s<65536?o[i++]=s:(s-=65536,o[i++]=55296|s>>10&1023,o[i++]=56320|s&1023)}return Eh(o,i)},Rh=(e,t)=>{t=t||e.length,t>e.length&&(t=e.length);let n=t-1;for(;n>=0&&(e[n]&192)===128;)n--;return n<0||n===0?t:n+hn[e[n]]>t?n:t},dn={string2buf:Th,buf2string:Ph,utf8border:Rh};function Ih(){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}var ps=Ih;const bs=Object.prototype.toString,{Z_NO_FLUSH:Oh,Z_SYNC_FLUSH:zh,Z_FULL_FLUSH:Fh,Z_FINISH:Nh,Z_OK:Gn,Z_STREAM_END:Mh,Z_DEFAULT_COMPRESSION:Lh,Z_DEFAULT_STRATEGY:jh,Z_DEFLATED:Uh}=ut;function fn(e){this.options=Hn.assign({level:Lh,method:Uh,chunkSize:16384,windowBits:15,memLevel:8,strategy:jh},e||{});let t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new ps,this.strm.avail_out=0;let n=ln.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(n!==Gn)throw new Error(ft[n]);if(t.header&&ln.deflateSetHeader(this.strm,t.header),t.dictionary){let r;if(typeof t.dictionary=="string"?r=dn.string2buf(t.dictionary):bs.call(t.dictionary)==="[object ArrayBuffer]"?r=new Uint8Array(t.dictionary):r=t.dictionary,n=ln.deflateSetDictionary(this.strm,r),n!==Gn)throw new Error(ft[n]);this._dict_set=!0}}fn.prototype.push=function(e,t){const n=this.strm,r=this.options.chunkSize;let i,o;if(this.ended)return!1;for(t===~~t?o=t:o=t===!0?Nh:Oh,typeof e=="string"?n.input=dn.string2buf(e):bs.call(e)==="[object ArrayBuffer]"?n.input=new Uint8Array(e):n.input=e,n.next_in=0,n.avail_in=n.input.length;;){if(n.avail_out===0&&(n.output=new Uint8Array(r),n.next_out=0,n.avail_out=r),(o===zh||o===Fh)&&n.avail_out<=6){this.onData(n.output.subarray(0,n.next_out)),n.avail_out=0;continue}if(i=ln.deflate(n,o),i===Mh)return n.next_out>0&&this.onData(n.output.subarray(0,n.next_out)),i=ln.deflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===Gn;if(n.avail_out===0){this.onData(n.output);continue}if(o>0&&n.next_out>0){this.onData(n.output.subarray(0,n.next_out)),n.avail_out=0;continue}if(n.avail_in===0)break}return!0},fn.prototype.onData=function(e){this.chunks.push(e)},fn.prototype.onEnd=function(e){e===Gn&&(this.result=Hn.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function ni(e,t){const n=new fn(t);if(n.push(e,!0),n.err)throw n.msg||ft[n.err];return n.result}function $h(e,t){return t=t||{},t.raw=!0,ni(e,t)}function Hh(e,t){return t=t||{},t.gzip=!0,ni(e,t)}var Gh=fn,Vh=ni,Wh=$h,Kh=Hh,Zh=ut,qh={Deflate:Gh,deflate:Vh,deflateRaw:Wh,gzip:Kh,constants:Zh};const Vn=16209,Xh=16191;var Yh=function(t,n){let r,i,o,s,c,l,a,h,f,u,d,y,w,x,_,E,v,S,z,C,k,F,I,T;const R=t.state;r=t.next_in,I=t.input,i=r+(t.avail_in-5),o=t.next_out,T=t.output,s=o-(n-t.avail_out),c=o+(t.avail_out-257),l=R.dmax,a=R.wsize,h=R.whave,f=R.wnext,u=R.window,d=R.hold,y=R.bits,w=R.lencode,x=R.distcode,_=(1<<R.lenbits)-1,E=(1<<R.distbits)-1;e:do{y<15&&(d+=I[r++]<<y,y+=8,d+=I[r++]<<y,y+=8),v=w[d&_];t:for(;;){if(S=v>>>24,d>>>=S,y-=S,S=v>>>16&255,S===0)T[o++]=v&65535;else if(S&16){z=v&65535,S&=15,S&&(y<S&&(d+=I[r++]<<y,y+=8),z+=d&(1<<S)-1,d>>>=S,y-=S),y<15&&(d+=I[r++]<<y,y+=8,d+=I[r++]<<y,y+=8),v=x[d&E];n:for(;;){if(S=v>>>24,d>>>=S,y-=S,S=v>>>16&255,S&16){if(C=v&65535,S&=15,y<S&&(d+=I[r++]<<y,y+=8,y<S&&(d+=I[r++]<<y,y+=8)),C+=d&(1<<S)-1,C>l){t.msg="invalid distance too far back",R.mode=Vn;break e}if(d>>>=S,y-=S,S=o-s,C>S){if(S=C-S,S>h&&R.sane){t.msg="invalid distance too far back",R.mode=Vn;break e}if(k=0,F=u,f===0){if(k+=a-S,S<z){z-=S;do T[o++]=u[k++];while(--S);k=o-C,F=T}}else if(f<S){if(k+=a+f-S,S-=f,S<z){z-=S;do T[o++]=u[k++];while(--S);if(k=0,f<z){S=f,z-=S;do T[o++]=u[k++];while(--S);k=o-C,F=T}}}else if(k+=f-S,S<z){z-=S;do T[o++]=u[k++];while(--S);k=o-C,F=T}for(;z>2;)T[o++]=F[k++],T[o++]=F[k++],T[o++]=F[k++],z-=3;z&&(T[o++]=F[k++],z>1&&(T[o++]=F[k++]))}else{k=o-C;do T[o++]=T[k++],T[o++]=T[k++],T[o++]=T[k++],z-=3;while(z>2);z&&(T[o++]=T[k++],z>1&&(T[o++]=T[k++]))}}else if((S&64)===0){v=x[(v&65535)+(d&(1<<S)-1)];continue n}else{t.msg="invalid distance code",R.mode=Vn;break e}break}}else if((S&64)===0){v=w[(v&65535)+(d&(1<<S)-1)];continue t}else if(S&32){R.mode=Xh;break e}else{t.msg="invalid literal/length code",R.mode=Vn;break e}break}}while(r<i&&o<c);z=y>>3,r-=z,y-=z<<3,d&=(1<<y)-1,t.next_in=r,t.next_out=o,t.avail_in=r<i?5+(i-r):5-(r-i),t.avail_out=o<c?257+(c-o):257-(o-c),R.hold=d,R.bits=y};const Ot=15,ms=852,ys=592,_s=0,ri=1,ws=2,Jh=new Uint16Array([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]),Qh=new Uint8Array([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]),ed=new Uint16Array([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]),td=new Uint8Array([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]);var un=(e,t,n,r,i,o,s,c)=>{const l=c.bits;let a=0,h=0,f=0,u=0,d=0,y=0,w=0,x=0,_=0,E=0,v,S,z,C,k,F=null,I;const T=new Uint16Array(Ot+1),R=new Uint16Array(Ot+1);let J=null,N,O,P;for(a=0;a<=Ot;a++)T[a]=0;for(h=0;h<r;h++)T[t[n+h]]++;for(d=l,u=Ot;u>=1&&T[u]===0;u--);if(d>u&&(d=u),u===0)return i[o++]=1<<24|64<<16|0,i[o++]=1<<24|64<<16|0,c.bits=1,0;for(f=1;f<u&&T[f]===0;f++);for(d<f&&(d=f),x=1,a=1;a<=Ot;a++)if(x<<=1,x-=T[a],x<0)return-1;if(x>0&&(e===_s||u!==1))return-1;for(R[1]=0,a=1;a<Ot;a++)R[a+1]=R[a]+T[a];for(h=0;h<r;h++)t[n+h]!==0&&(s[R[t[n+h]]++]=h);if(e===_s?(F=J=s,I=20):e===ri?(F=Jh,J=Qh,I=257):(F=ed,J=td,I=0),E=0,h=0,a=f,k=o,y=d,w=0,z=-1,_=1<<d,C=_-1,e===ri&&_>ms||e===ws&&_>ys)return 1;for(;;){N=a-w,s[h]+1<I?(O=0,P=s[h]):s[h]>=I?(O=J[s[h]-I],P=F[s[h]-I]):(O=32+64,P=0),v=1<<a-w,S=1<<y,f=S;do S-=v,i[k+(E>>w)+S]=N<<24|O<<16|P|0;while(S!==0);for(v=1<<a-1;E&v;)v>>=1;if(v!==0?(E&=v-1,E+=v):E=0,h++,--T[a]===0){if(a===u)break;a=t[n+s[h]]}if(a>d&&(E&C)!==z){for(w===0&&(w=d),k+=f,y=a-w,x=1<<y;y+w<u&&(x-=T[y+w],!(x<=0));)y++,x<<=1;if(_+=1<<y,e===ri&&_>ms||e===ws&&_>ys)return 1;z=E&C,i[z]=d<<24|y<<16|k-o|0}}return E!==0&&(i[k+E]=a-w<<24|64<<16|0),c.bits=d,0};const nd=0,xs=1,Ss=2,{Z_FINISH:vs,Z_BLOCK:rd,Z_TREES:Wn,Z_OK:mt,Z_STREAM_END:id,Z_NEED_DICT:od,Z_STREAM_ERROR:Pe,Z_DATA_ERROR:ks,Z_MEM_ERROR:As,Z_BUF_ERROR:sd,Z_DEFLATED:Cs}=ut,Kn=16180,Bs=16181,Ds=16182,Ts=16183,Es=16184,Ps=16185,Rs=16186,Is=16187,Os=16188,zs=16189,Zn=16190,Ye=16191,ii=16192,Fs=16193,oi=16194,Ns=16195,Ms=16196,Ls=16197,js=16198,qn=16199,Xn=16200,Us=16201,$s=16202,Hs=16203,Gs=16204,Vs=16205,si=16206,Ws=16207,Ks=16208,ae=16209,Zs=16210,qs=16211,ad=852,cd=592,ld=15,Xs=e=>(e>>>24&255)+(e>>>8&65280)+((e&65280)<<8)+((e&255)<<24);function hd(){this.strm=null,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 Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}const yt=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.mode<Kn||t.mode>qs?1:0},Ys=e=>{if(yt(e))return Pe;const t=e.state;return e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=t.wrap&1),t.mode=Kn,t.last=0,t.havedict=0,t.flags=-1,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new Int32Array(ad),t.distcode=t.distdyn=new Int32Array(cd),t.sane=1,t.back=-1,mt},Js=e=>{if(yt(e))return Pe;const t=e.state;return t.wsize=0,t.whave=0,t.wnext=0,Ys(e)},Qs=(e,t)=>{let n;if(yt(e))return Pe;const r=e.state;return t<0?(n=0,t=-t):(n=(t>>4)+5,t<48&&(t&=15)),t&&(t<8||t>15)?Pe:(r.window!==null&&r.wbits!==t&&(r.window=null),r.wrap=n,r.wbits=t,Js(e))},ea=(e,t)=>{if(!e)return Pe;const n=new hd;e.state=n,n.strm=e,n.window=null,n.mode=Kn;const r=Qs(e,t);return r!==mt&&(e.state=null),r},dd=e=>ea(e,ld);let ta=!0,ai,ci;const fd=e=>{if(ta){ai=new Int32Array(512),ci=new Int32Array(32);let t=0;for(;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(un(xs,e.lens,0,288,ai,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;un(Ss,e.lens,0,32,ci,0,e.work,{bits:5}),ta=!1}e.lencode=ai,e.lenbits=9,e.distcode=ci,e.distbits=5},na=(e,t,n,r)=>{let i;const o=e.state;return o.window===null&&(o.wsize=1<<o.wbits,o.wnext=0,o.whave=0,o.window=new Uint8Array(o.wsize)),r>=o.wsize?(o.window.set(t.subarray(n-o.wsize,n),0),o.wnext=0,o.whave=o.wsize):(i=o.wsize-o.wnext,i>r&&(i=r),o.window.set(t.subarray(n-r,n-r+i),o.wnext),r-=i,r?(o.window.set(t.subarray(n-r,n),0),o.wnext=r,o.whave=o.wsize):(o.wnext+=i,o.wnext===o.wsize&&(o.wnext=0),o.whave<o.wsize&&(o.whave+=i))),0},ud=(e,t)=>{let n,r,i,o,s,c,l,a,h,f,u,d,y,w,x=0,_,E,v,S,z,C,k,F;const I=new Uint8Array(4);let T,R;const J=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(yt(e)||!e.output||!e.input&&e.avail_in!==0)return Pe;n=e.state,n.mode===Ye&&(n.mode=ii),s=e.next_out,i=e.output,l=e.avail_out,o=e.next_in,r=e.input,c=e.avail_in,a=n.hold,h=n.bits,f=c,u=l,F=mt;e:for(;;)switch(n.mode){case Kn:if(n.wrap===0){n.mode=ii;break}for(;h<16;){if(c===0)break e;c--,a+=r[o++]<<h,h+=8}if(n.wrap&2&&a===35615){n.wbits===0&&(n.wbits=15),n.check=0,I[0]=a&255,I[1]=a>>>8&255,n.check=ge(n.check,I,2,0),a=0,h=0,n.mode=Bs;break}if(n.head&&(n.head.done=!1),!(n.wrap&1)||(((a&255)<<8)+(a>>8))%31){e.msg="incorrect header check",n.mode=ae;break}if((a&15)!==Cs){e.msg="unknown compression method",n.mode=ae;break}if(a>>>=4,h-=4,k=(a&15)+8,n.wbits===0&&(n.wbits=k),k>15||k>n.wbits){e.msg="invalid window size",n.mode=ae;break}n.dmax=1<<n.wbits,n.flags=0,e.adler=n.check=1,n.mode=a&512?zs:Ye,a=0,h=0;break;case Bs:for(;h<16;){if(c===0)break e;c--,a+=r[o++]<<h,h+=8}if(n.flags=a,(n.flags&255)!==Cs){e.msg="unknown compression method",n.mode=ae;break}if(n.flags&57344){e.msg="unknown header flags set",n.mode=ae;break}n.head&&(n.head.text=a>>8&1),n.flags&512&&n.wrap&4&&(I[0]=a&255,I[1]=a>>>8&255,n.check=ge(n.check,I,2,0)),a=0,h=0,n.mode=Ds;case Ds:for(;h<32;){if(c===0)break e;c--,a+=r[o++]<<h,h+=8}n.head&&(n.head.time=a),n.flags&512&&n.wrap&4&&(I[0]=a&255,I[1]=a>>>8&255,I[2]=a>>>16&255,I[3]=a>>>24&255,n.check=ge(n.check,I,4,0)),a=0,h=0,n.mode=Ts;case Ts:for(;h<16;){if(c===0)break e;c--,a+=r[o++]<<h,h+=8}n.head&&(n.head.xflags=a&255,n.head.os=a>>8),n.flags&512&&n.wrap&4&&(I[0]=a&255,I[1]=a>>>8&255,n.check=ge(n.check,I,2,0)),a=0,h=0,n.mode=Es;case Es:if(n.flags&1024){for(;h<16;){if(c===0)break e;c--,a+=r[o++]<<h,h+=8}n.length=a,n.head&&(n.head.extra_len=a),n.flags&512&&n.wrap&4&&(I[0]=a&255,I[1]=a>>>8&255,n.check=ge(n.check,I,2,0)),a=0,h=0}else n.head&&(n.head.extra=null);n.mode=Ps;case Ps:if(n.flags&1024&&(d=n.length,d>c&&(d=c),d&&(n.head&&(k=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Uint8Array(n.head.extra_len)),n.head.extra.set(r.subarray(o,o+d),k)),n.flags&512&&n.wrap&4&&(n.check=ge(n.check,r,d,o)),c-=d,o+=d,n.length-=d),n.length))break e;n.length=0,n.mode=Rs;case Rs:if(n.flags&2048){if(c===0)break e;d=0;do k=r[o+d++],n.head&&k&&n.length<65536&&(n.head.name+=String.fromCharCode(k));while(k&&d<c);if(n.flags&512&&n.wrap&4&&(n.check=ge(n.check,r,d,o)),c-=d,o+=d,k)break e}else n.head&&(n.head.name=null);n.length=0,n.mode=Is;case Is:if(n.flags&4096){if(c===0)break e;d=0;do k=r[o+d++],n.head&&k&&n.length<65536&&(n.head.comment+=String.fromCharCode(k));while(k&&d<c);if(n.flags&512&&n.wrap&4&&(n.check=ge(n.check,r,d,o)),c-=d,o+=d,k)break e}else n.head&&(n.head.comment=null);n.mode=Os;case Os:if(n.flags&512){for(;h<16;){if(c===0)break e;c--,a+=r[o++]<<h,h+=8}if(n.wrap&4&&a!==(n.check&65535)){e.msg="header crc mismatch",n.mode=ae;break}a=0,h=0}n.head&&(n.head.hcrc=n.flags>>9&1,n.head.done=!0),e.adler=n.check=0,n.mode=Ye;break;case zs:for(;h<32;){if(c===0)break e;c--,a+=r[o++]<<h,h+=8}e.adler=n.check=Xs(a),a=0,h=0,n.mode=Zn;case Zn:if(n.havedict===0)return e.next_out=s,e.avail_out=l,e.next_in=o,e.avail_in=c,n.hold=a,n.bits=h,od;e.adler=n.check=1,n.mode=Ye;case Ye:if(t===rd||t===Wn)break e;case ii:if(n.last){a>>>=h&7,h-=h&7,n.mode=si;break}for(;h<3;){if(c===0)break e;c--,a+=r[o++]<<h,h+=8}switch(n.last=a&1,a>>>=1,h-=1,a&3){case 0:n.mode=Fs;break;case 1:if(fd(n),n.mode=qn,t===Wn){a>>>=2,h-=2;break e}break;case 2:n.mode=Ms;break;case 3:e.msg="invalid block type",n.mode=ae}a>>>=2,h-=2;break;case Fs:for(a>>>=h&7,h-=h&7;h<32;){if(c===0)break e;c--,a+=r[o++]<<h,h+=8}if((a&65535)!==(a>>>16^65535)){e.msg="invalid stored block lengths",n.mode=ae;break}if(n.length=a&65535,a=0,h=0,n.mode=oi,t===Wn)break e;case oi:n.mode=Ns;case Ns:if(d=n.length,d){if(d>c&&(d=c),d>l&&(d=l),d===0)break e;i.set(r.subarray(o,o+d),s),c-=d,o+=d,l-=d,s+=d,n.length-=d;break}n.mode=Ye;break;case Ms:for(;h<14;){if(c===0)break e;c--,a+=r[o++]<<h,h+=8}if(n.nlen=(a&31)+257,a>>>=5,h-=5,n.ndist=(a&31)+1,a>>>=5,h-=5,n.ncode=(a&15)+4,a>>>=4,h-=4,n.nlen>286||n.ndist>30){e.msg="too many length or distance symbols",n.mode=ae;break}n.have=0,n.mode=Ls;case Ls:for(;n.have<n.ncode;){for(;h<3;){if(c===0)break e;c--,a+=r[o++]<<h,h+=8}n.lens[J[n.have++]]=a&7,a>>>=3,h-=3}for(;n.have<19;)n.lens[J[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,T={bits:n.lenbits},F=un(nd,n.lens,0,19,n.lencode,0,n.work,T),n.lenbits=T.bits,F){e.msg="invalid code lengths set",n.mode=ae;break}n.have=0,n.mode=js;case js:for(;n.have<n.nlen+n.ndist;){for(;x=n.lencode[a&(1<<n.lenbits)-1],_=x>>>24,E=x>>>16&255,v=x&65535,!(_<=h);){if(c===0)break e;c--,a+=r[o++]<<h,h+=8}if(v<16)a>>>=_,h-=_,n.lens[n.have++]=v;else{if(v===16){for(R=_+2;h<R;){if(c===0)break e;c--,a+=r[o++]<<h,h+=8}if(a>>>=_,h-=_,n.have===0){e.msg="invalid bit length repeat",n.mode=ae;break}k=n.lens[n.have-1],d=3+(a&3),a>>>=2,h-=2}else if(v===17){for(R=_+3;h<R;){if(c===0)break e;c--,a+=r[o++]<<h,h+=8}a>>>=_,h-=_,k=0,d=3+(a&7),a>>>=3,h-=3}else{for(R=_+7;h<R;){if(c===0)break e;c--,a+=r[o++]<<h,h+=8}a>>>=_,h-=_,k=0,d=11+(a&127),a>>>=7,h-=7}if(n.have+d>n.nlen+n.ndist){e.msg="invalid bit length repeat",n.mode=ae;break}for(;d--;)n.lens[n.have++]=k}}if(n.mode===ae)break;if(n.lens[256]===0){e.msg="invalid code -- missing end-of-block",n.mode=ae;break}if(n.lenbits=9,T={bits:n.lenbits},F=un(xs,n.lens,0,n.nlen,n.lencode,0,n.work,T),n.lenbits=T.bits,F){e.msg="invalid literal/lengths set",n.mode=ae;break}if(n.distbits=6,n.distcode=n.distdyn,T={bits:n.distbits},F=un(Ss,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,T),n.distbits=T.bits,F){e.msg="invalid distances set",n.mode=ae;break}if(n.mode=qn,t===Wn)break e;case qn:n.mode=Xn;case Xn:if(c>=6&&l>=258){e.next_out=s,e.avail_out=l,e.next_in=o,e.avail_in=c,n.hold=a,n.bits=h,Yh(e,u),s=e.next_out,i=e.output,l=e.avail_out,o=e.next_in,r=e.input,c=e.avail_in,a=n.hold,h=n.bits,n.mode===Ye&&(n.back=-1);break}for(n.back=0;x=n.lencode[a&(1<<n.lenbits)-1],_=x>>>24,E=x>>>16&255,v=x&65535,!(_<=h);){if(c===0)break e;c--,a+=r[o++]<<h,h+=8}if(E&&(E&240)===0){for(S=_,z=E,C=v;x=n.lencode[C+((a&(1<<S+z)-1)>>S)],_=x>>>24,E=x>>>16&255,v=x&65535,!(S+_<=h);){if(c===0)break e;c--,a+=r[o++]<<h,h+=8}a>>>=S,h-=S,n.back+=S}if(a>>>=_,h-=_,n.back+=_,n.length=v,E===0){n.mode=Vs;break}if(E&32){n.back=-1,n.mode=Ye;break}if(E&64){e.msg="invalid literal/length code",n.mode=ae;break}n.extra=E&15,n.mode=Us;case Us:if(n.extra){for(R=n.extra;h<R;){if(c===0)break e;c--,a+=r[o++]<<h,h+=8}n.length+=a&(1<<n.extra)-1,a>>>=n.extra,h-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=$s;case $s:for(;x=n.distcode[a&(1<<n.distbits)-1],_=x>>>24,E=x>>>16&255,v=x&65535,!(_<=h);){if(c===0)break e;c--,a+=r[o++]<<h,h+=8}if((E&240)===0){for(S=_,z=E,C=v;x=n.distcode[C+((a&(1<<S+z)-1)>>S)],_=x>>>24,E=x>>>16&255,v=x&65535,!(S+_<=h);){if(c===0)break e;c--,a+=r[o++]<<h,h+=8}a>>>=S,h-=S,n.back+=S}if(a>>>=_,h-=_,n.back+=_,E&64){e.msg="invalid distance code",n.mode=ae;break}n.offset=v,n.extra=E&15,n.mode=Hs;case Hs:if(n.extra){for(R=n.extra;h<R;){if(c===0)break e;c--,a+=r[o++]<<h,h+=8}n.offset+=a&(1<<n.extra)-1,a>>>=n.extra,h-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){e.msg="invalid distance too far back",n.mode=ae;break}n.mode=Gs;case Gs:if(l===0)break e;if(d=u-l,n.offset>d){if(d=n.offset-d,d>n.whave&&n.sane){e.msg="invalid distance too far back",n.mode=ae;break}d>n.wnext?(d-=n.wnext,y=n.wsize-d):y=n.wnext-d,d>n.length&&(d=n.length),w=n.window}else w=i,y=s-n.offset,d=n.length;d>l&&(d=l),l-=d,n.length-=d;do i[s++]=w[y++];while(--d);n.length===0&&(n.mode=Xn);break;case Vs:if(l===0)break e;i[s++]=n.length,l--,n.mode=Xn;break;case si:if(n.wrap){for(;h<32;){if(c===0)break e;c--,a|=r[o++]<<h,h+=8}if(u-=l,e.total_out+=u,n.total+=u,n.wrap&4&&u&&(e.adler=n.check=n.flags?ge(n.check,i,u,s-u):rn(n.check,i,u,s-u)),u=l,n.wrap&4&&(n.flags?a:Xs(a))!==n.check){e.msg="incorrect data check",n.mode=ae;break}a=0,h=0}n.mode=Ws;case Ws:if(n.wrap&&n.flags){for(;h<32;){if(c===0)break e;c--,a+=r[o++]<<h,h+=8}if(n.wrap&4&&a!==(n.total&4294967295)){e.msg="incorrect length check",n.mode=ae;break}a=0,h=0}n.mode=Ks;case Ks:F=id;break e;case ae:F=ks;break e;case Zs:return As;case qs:default:return Pe}return e.next_out=s,e.avail_out=l,e.next_in=o,e.avail_in=c,n.hold=a,n.bits=h,(n.wsize||u!==e.avail_out&&n.mode<ae&&(n.mode<si||t!==vs))&&na(e,e.output,e.next_out,u-e.avail_out),f-=e.avail_in,u-=e.avail_out,e.total_in+=f,e.total_out+=u,n.total+=u,n.wrap&4&&u&&(e.adler=n.check=n.flags?ge(n.check,i,u,e.next_out-u):rn(n.check,i,u,e.next_out-u)),e.data_type=n.bits+(n.last?64:0)+(n.mode===Ye?128:0)+(n.mode===qn||n.mode===oi?256:0),(f===0&&u===0||t===vs)&&F===mt&&(F=sd),F},gd=e=>{if(yt(e))return Pe;let t=e.state;return t.window&&(t.window=null),e.state=null,mt},pd=(e,t)=>{if(yt(e))return Pe;const n=e.state;return(n.wrap&2)===0?Pe:(n.head=t,t.done=!1,mt)},bd=(e,t)=>{const n=t.length;let r,i,o;return yt(e)||(r=e.state,r.wrap!==0&&r.mode!==Zn)?Pe:r.mode===Zn&&(i=1,i=rn(i,t,n,0),i!==r.check)?ks:(o=na(e,t,n,n),o?(r.mode=Zs,As):(r.havedict=1,mt))};var md=Js,yd=Qs,_d=Ys,wd=dd,xd=ea,Sd=ud,vd=gd,kd=pd,Ad=bd,Cd="pako inflate (from Nodeca project)",Je={inflateReset:md,inflateReset2:yd,inflateResetKeep:_d,inflateInit:wd,inflateInit2:xd,inflate:Sd,inflateEnd:vd,inflateGetHeader:kd,inflateSetDictionary:Ad,inflateInfo:Cd};function Bd(){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}var Dd=Bd;const ra=Object.prototype.toString,{Z_NO_FLUSH:Td,Z_FINISH:Ed,Z_OK:gn,Z_STREAM_END:li,Z_NEED_DICT:hi,Z_STREAM_ERROR:Pd,Z_DATA_ERROR:ia,Z_MEM_ERROR:Rd}=ut;function pn(e){this.options=Hn.assign({chunkSize:1024*64,windowBits:15,to:""},e||{});const t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,t.windowBits===0&&(t.windowBits=-15)),t.windowBits>=0&&t.windowBits<16&&!(e&&e.windowBits)&&(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&(t.windowBits&15)===0&&(t.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new ps,this.strm.avail_out=0;let n=Je.inflateInit2(this.strm,t.windowBits);if(n!==gn)throw new Error(ft[n]);if(this.header=new Dd,Je.inflateGetHeader(this.strm,this.header),t.dictionary&&(typeof t.dictionary=="string"?t.dictionary=dn.string2buf(t.dictionary):ra.call(t.dictionary)==="[object ArrayBuffer]"&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(n=Je.inflateSetDictionary(this.strm,t.dictionary),n!==gn)))throw new Error(ft[n])}pn.prototype.push=function(e,t){const n=this.strm,r=this.options.chunkSize,i=this.options.dictionary;let o,s,c;if(this.ended)return!1;for(t===~~t?s=t:s=t===!0?Ed:Td,ra.call(e)==="[object ArrayBuffer]"?n.input=new Uint8Array(e):n.input=e,n.next_in=0,n.avail_in=n.input.length;;){for(n.avail_out===0&&(n.output=new Uint8Array(r),n.next_out=0,n.avail_out=r),o=Je.inflate(n,s),o===hi&&i&&(o=Je.inflateSetDictionary(n,i),o===gn?o=Je.inflate(n,s):o===ia&&(o=hi));n.avail_in>0&&o===li&&n.state.wrap>0&&e[n.next_in]!==0;)Je.inflateReset(n),o=Je.inflate(n,s);switch(o){case Pd:case ia:case hi:case Rd:return this.onEnd(o),this.ended=!0,!1}if(c=n.avail_out,n.next_out&&(n.avail_out===0||o===li))if(this.options.to==="string"){let l=dn.utf8border(n.output,n.next_out),a=n.next_out-l,h=dn.buf2string(n.output,l);n.next_out=a,n.avail_out=r-a,a&&n.output.set(n.output.subarray(l,l+a),0),this.onData(h)}else this.onData(n.output.length===n.next_out?n.output:n.output.subarray(0,n.next_out));if(!(o===gn&&c===0)){if(o===li)return o=Je.inflateEnd(this.strm),this.onEnd(o),this.ended=!0,!0;if(n.avail_in===0)break}}return!0},pn.prototype.onData=function(e){this.chunks.push(e)},pn.prototype.onEnd=function(e){e===gn&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=Hn.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function di(e,t){const n=new pn(t);if(n.push(e),n.err)throw n.msg||ft[n.err];return n.result}function Id(e,t){return t=t||{},t.raw=!0,di(e,t)}var Od=pn,zd=di,Fd=Id,Nd=di,Md=ut,Ld={Inflate:Od,inflate:zd,inflateRaw:Fd,ungzip:Nd,constants:Md};const{Deflate:jd,deflate:Ud,deflateRaw:$d,gzip:Hd}=qh,{Inflate:Gd,inflate:Vd,inflateRaw:Wd,ungzip:Kd}=Ld;var Zd=jd,qd=Ud,Xd=$d,Yd=Hd,Jd=Gd,Qd=Vd,ef=Wd,tf=Kd,nf=ut,fi={Deflate:Zd,deflate:qd,deflateRaw:Xd,gzip:Yd,Inflate:Jd,inflate:Qd,inflateRaw:ef,ungzip:tf,constants:nf};const oa=class{constructor(e,t){b(this,"major"),b(this,"minor"),this.major=String(e),this.minor=String(t)}toString(){const e=Ke(129);return`%PDF-${this.major}.${this.minor}
3
+ %${e}${e}${e}${e}`}sizeInBytes(){return 12+this.major.length+this.minor.length}copyBytesInto(e,t){const n=t;return e[t++]=m.Percent,e[t++]=m.P,e[t++]=m.D,e[t++]=m.F,e[t++]=m.Dash,t+=be(this.major,e,t),e[t++]=m.Period,t+=be(this.minor,e,t),e[t++]=m.Newline,e[t++]=m.Percent,e[t++]=129,e[t++]=129,e[t++]=129,e[t++]=129,t-n}};let bn=oa;b(bn,"forVersion",(e,t)=>new oa(e,t));const ui={},gi=class extends _e{constructor(e,t){if(e!==ui)throw new Tr("PDFBool");super(),b(this,"value"),this.value=t}asBoolean(){return this.value}clone(){return this}toString(){return String(this.value)}sizeInBytes(){return this.value?4:5}copyBytesInto(e,t){return this.value?(e[t++]=m.t,e[t++]=m.r,e[t++]=m.u,e[t++]=m.e,4):(e[t++]=m.f,e[t++]=m.a,e[t++]=m.l,e[t++]=m.s,e[t++]=m.e,5)}};let _t=gi;b(_t,"True",new gi(ui,!0)),b(_t,"False",new gi(ui,!1));class rf extends _e{asNull(){return null}clone(){return this}toString(){return"null"}sizeInBytes(){return 4}copyBytesInto(t,n){return t[n++]=m.n,t[n++]=m.u,t[n++]=m.l,t[n++]=m.l,4}}const Se=new rf,Yn=class extends _e{constructor(e,t){super(),b(this,"context"),b(this,"dict"),this.dict=e,this.context=t}keys(){return Array.from(this.dict.keys())}values(){return Array.from(this.dict.values())}entries(){return Array.from(this.dict.entries())}set(e,t){this.dict.set(e,t)}get(e,t=!1){const n=this.dict.get(e);if(!(n===Se&&!t))return n}has(e){const t=this.dict.get(e);return t!==void 0&&t!==Se}lookupMaybe(e,...t){const n=t.includes(Se),r=this.context.lookupMaybe(this.get(e,n),...t);if(!(r===Se&&!n))return r}lookup(e,...t){const n=t.includes(Se),r=this.context.lookup(this.get(e,n),...t);if(!(r===Se&&!n))return r}delete(e){return this.dict.delete(e)}asMap(){return new Map(this.dict)}uniqueKey(e=""){const t=this.keys();let n=p.of(this.context.addRandomSuffix(e,10));for(;t.includes(n);)n=p.of(this.context.addRandomSuffix(e,10));return n}clone(e){const t=Yn.withContext(e||this.context),n=this.entries();for(let r=0,i=n.length;r<i;r++){const[o,s]=n[r];t.set(o,s)}return t}toString(){let e=`<<
4
4
  `;const t=this.entries();for(let n=0,r=t.length;n<r;n++){const[i,o]=t[n];e+=i.toString()+" "+o.toString()+`
5
- `}return e+=">>",e}sizeInBytes(){let e=5;const t=this.entries();for(let n=0,r=t.length;n<r;n++){const[i,o]=t[n];e+=i.sizeInBytes()+o.sizeInBytes()+2}return e}copyBytesInto(e,t){const n=t;e[t++]=m.LessThan,e[t++]=m.LessThan,e[t++]=m.Newline;const r=this.entries();for(let i=0,o=r.length;i<o;i++){const[s,c]=r[i];t+=s.copyBytesInto(e,t),e[t++]=m.Space,t+=c.copyBytesInto(e,t),e[t++]=m.Newline}return e[t++]=m.GreaterThan,e[t++]=m.GreaterThan,t-n}};let V=Xn;b(V,"withContext",e=>new Xn(new Map,e)),b(V,"fromMapWithContext",(e,t)=>new Xn(e,t));class at extends _e{constructor(t){super(),b(this,"dict"),this.dict=t}clone(t){throw new Me(this.constructor.name,"clone")}getContentsString(){throw new Me(this.constructor.name,"getContentsString")}getContents(){throw new Me(this.constructor.name,"getContents")}getContentsSize(){throw new Me(this.constructor.name,"getContentsSize")}updateDict(){const t=this.getContentsSize();this.dict.set(p.Length,$.of(t))}sizeInBytes(){return this.updateDict(),this.dict.sizeInBytes()+this.getContentsSize()+18}toString(){this.updateDict();let t=this.dict.toString();return t+=`
5
+ `}return e+=">>",e}sizeInBytes(){let e=5;const t=this.entries();for(let n=0,r=t.length;n<r;n++){const[i,o]=t[n];e+=i.sizeInBytes()+o.sizeInBytes()+2}return e}copyBytesInto(e,t){const n=t;e[t++]=m.LessThan,e[t++]=m.LessThan,e[t++]=m.Newline;const r=this.entries();for(let i=0,o=r.length;i<o;i++){const[s,c]=r[i];t+=s.copyBytesInto(e,t),e[t++]=m.Space,t+=c.copyBytesInto(e,t),e[t++]=m.Newline}return e[t++]=m.GreaterThan,e[t++]=m.GreaterThan,t-n}};let V=Yn;b(V,"withContext",e=>new Yn(new Map,e)),b(V,"fromMapWithContext",(e,t)=>new Yn(e,t));class ct extends _e{constructor(t){super(),b(this,"dict"),this.dict=t}clone(t){throw new Le(this.constructor.name,"clone")}getContentsString(){throw new Le(this.constructor.name,"getContentsString")}getContents(){throw new Le(this.constructor.name,"getContents")}getContentsSize(){throw new Le(this.constructor.name,"getContentsSize")}updateDict(){const t=this.getContentsSize();this.dict.set(p.Length,$.of(t))}sizeInBytes(){return this.updateDict(),this.dict.sizeInBytes()+this.getContentsSize()+18}toString(){this.updateDict();let t=this.dict.toString();return t+=`
6
6
  stream
7
7
  `,t+=this.getContentsString(),t+=`
8
- endstream`,t}copyBytesInto(t,n){this.updateDict();const r=n;n+=this.dict.copyBytesInto(t,n),t[n++]=m.Newline,t[n++]=m.s,t[n++]=m.t,t[n++]=m.r,t[n++]=m.e,t[n++]=m.a,t[n++]=m.m,t[n++]=m.Newline;const i=this.getContents();for(let o=0,s=i.length;o<s;o++)t[n++]=i[o];return t[n++]=m.Newline,t[n++]=m.e,t[n++]=m.n,t[n++]=m.d,t[n++]=m.s,t[n++]=m.t,t[n++]=m.r,t[n++]=m.e,t[n++]=m.a,t[n++]=m.m,n-r}}const gi=class extends at{constructor(e,t){super(e),b(this,"contents"),this.contents=t}asUint8Array(){return this.contents.slice()}clone(e){return gi.of(this.dict.clone(e),this.contents.slice())}getContentsString(){return _o(this.contents)}getContents(){return this.contents}getContentsSize(){return this.contents.length}};let Ot=gi;b(Ot,"of",(e,t)=>new gi(e,t));const oa={},sa=new Map,aa=class extends _e{constructor(e,t,n){if(e!==oa)throw new Dr("PDFRef");super(),b(this,"objectNumber"),b(this,"generationNumber"),b(this,"tag"),this.objectNumber=t,this.generationNumber=n,this.tag=`${t} ${n} R`}clone(){return this}toString(){return this.tag}sizeInBytes(){return this.tag.length}copyBytesInto(e,t){return t+=be(this.tag,e,t),this.tag.length}};let oe=aa;b(oe,"of",(e,t=0)=>{const n=`${e} ${t} R`;let r=sa.get(n);return r||(r=new aa(oa,e,t),sa.set(n,r)),r});const pi=class{constructor(e,t){b(this,"name"),b(this,"args"),this.name=e,this.args=t||[]}clone(e){const t=new Array(this.args.length);for(let n=0,r=t.length;n<r;n++){const i=this.args[n];t[n]=i instanceof _e?i.clone(e):i}return pi.of(this.name,t)}toString(){let e="";for(let t=0,n=this.args.length;t<n;t++)e+=String(this.args[t])+" ";return e+=this.name,e}sizeInBytes(){let e=0;for(let t=0,n=this.args.length;t<n;t++){const r=this.args[t];e+=(r instanceof _e?r.sizeInBytes():r.length)+1}return e+=this.name.length,e}copyBytesInto(e,t){const n=t;for(let r=0,i=this.args.length;r<i;r++){const o=this.args[r];o instanceof _e?t+=o.copyBytesInto(e,t):t+=be(o,e,t),e[t++]=m.Space}return t+=be(this.name,e,t),t-n}};let re=pi;b(re,"of",(e,t)=>new pi(e,t));var se=(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",e))(se||{});class bi extends at{constructor(t,n){super(t),b(this,"contentsCache"),b(this,"encode"),b(this,"computeContents",()=>{const r=this.getUnencodedContents();return this.encode?di.deflate(r):r}),this.encode=n,n&&t.set(p.of("Filter"),p.of("FlateDecode")),this.contentsCache=kt.populatedBy(this.computeContents)}getContents(){return this.contentsCache.access()}getContentsSize(){return this.contentsCache.access().length}getUnencodedContents(){throw new Me(this.constructor.name,"getUnencodedContents")}}const mi=class extends bi{constructor(e,t,n=!0){super(e,n),b(this,"operators"),this.operators=t}push(...e){this.operators.push(...e)}clone(e){const t=new Array(this.operators.length);for(let i=0,o=this.operators.length;i<o;i++)t[i]=this.operators[i].clone(e);const{dict:n,encode:r}=this;return mi.of(n.clone(e),t,r)}getContentsString(){let e="";for(let t=0,n=this.operators.length;t<n;t++)e+=`${this.operators[t]}
9
- `;return e}getUnencodedContents(){const e=new Uint8Array(this.getUnencodedContentsSize());let t=0;for(let n=0,r=this.operators.length;n<r;n++)t+=this.operators[n].copyBytesInto(e,t),e[t++]=m.Newline;return e}getUnencodedContentsSize(){let e=0;for(let t=0,n=this.operators.length;t<n;t++)e+=this.operators[t].sizeInBytes()+1;return e}};let zt=mi;b(zt,"of",(e,t,n=!0)=>new mi(e,t,n));const ca=class{constructor(e){b(this,"seed"),this.seed=e}nextInt(){const e=Math.sin(this.seed++)*1e4;return e-Math.floor(e)}};let la=ca;b(la,"withSeed",e=>new ca(e));const of=([e],[t])=>e.objectNumber-t.objectNumber,ha=class{constructor(){b(this,"largestObjectNumber"),b(this,"header"),b(this,"trailerInfo"),b(this,"rng"),b(this,"indirectObjects"),b(this,"pushGraphicsStateContentStreamRef"),b(this,"popGraphicsStateContentStreamRef"),this.largestObjectNumber=0,this.header=pn.forVersion(1,7),this.trailerInfo={},this.indirectObjects=new Map,this.rng=la.withSeed(1)}assign(e,t){this.indirectObjects.set(e,t),e.objectNumber>this.largestObjectNumber&&(this.largestObjectNumber=e.objectNumber)}nextRef(){return this.largestObjectNumber+=1,oe.of(this.largestObjectNumber)}register(e){const t=this.nextRef();return this.assign(t,e),t}delete(e){return this.indirectObjects.delete(e)}lookupMaybe(e,...t){const n=t.includes(Se),r=e instanceof oe?this.indirectObjects.get(e):e;if(!(!r||r===Se&&!n)){for(let i=0,o=t.length;i<o;i++){const s=t[i];if(s===Se){if(r===Se)return r}else if(r instanceof s)return r}throw new Tr(t,r)}}lookup(e,...t){const n=e instanceof oe?this.indirectObjects.get(e):e;if(t.length===0)return n;for(let r=0,i=t.length;r<i;r++){const o=t[r];if(o===Se){if(n===Se)return n}else if(n instanceof o)return n}throw new Tr(t,n)}getObjectRef(e){const t=Array.from(this.indirectObjects.entries());for(let n=0,r=t.length;n<r;n++){const[i,o]=t[n];if(o===e)return i}}enumerateIndirectObjects(){return Array.from(this.indirectObjects.entries()).sort(of)}obj(e){if(e instanceof _e)return e;if(e==null)return Se;if(typeof e=="string")return p.of(e);if(typeof e=="number")return $.of(e);if(typeof e=="boolean")return e?yt.True:yt.False;if(Array.isArray(e)){const t=q.withContext(this);for(let n=0,r=e.length;n<r;n++)t.push(this.obj(e[n]));return t}else{const t=V.withContext(this),n=Object.keys(e);for(let r=0,i=n.length;r<i;r++){const o=n[r],s=e[o];s!==void 0&&t.set(p.of(o),this.obj(s))}return t}}stream(e,t={}){return Ot.of(this.obj(t),Br(e))}flateStream(e,t={}){return this.stream(di.deflate(Br(e)),{...t,Filter:"FlateDecode"})}contentStream(e,t={}){return zt.of(this.obj(t),e)}formXObject(e,t={}){return this.contentStream(e,{BBox:this.obj([0,0,0,0]),Matrix:this.obj([1,0,0,1,0,0]),...t,Type:"XObject",Subtype:"Form"})}getPushGraphicsStateContentStream(){if(this.pushGraphicsStateContentStreamRef)return this.pushGraphicsStateContentStreamRef;const e=this.obj({}),t=re.of(se.PushGraphicsState),n=zt.of(e,[t]);return this.pushGraphicsStateContentStreamRef=this.register(n),this.pushGraphicsStateContentStreamRef}getPopGraphicsStateContentStream(){if(this.popGraphicsStateContentStreamRef)return this.popGraphicsStateContentStreamRef;const e=this.obj({}),t=re.of(se.PopGraphicsState),n=zt.of(e,[t]);return this.popGraphicsStateContentStreamRef=this.register(n),this.popGraphicsStateContentStreamRef}addRandomSuffix(e,t=4){return`${e}-${Math.floor(this.rng.nextInt()*10**t)}`}};let yi=ha;b(yi,"create",()=>new ha);const _i=class{constructor(e){b(this,"subsections"),b(this,"chunkIdx"),b(this,"chunkLength"),this.subsections=e?[[e]]:[],this.chunkIdx=0,this.chunkLength=e?1:0}addEntry(e,t){this.append({ref:e,offset:t,deleted:!1})}addDeletedEntry(e,t){this.append({ref:e,offset:t,deleted:!0})}toString(){let e=`xref
8
+ endstream`,t}copyBytesInto(t,n){this.updateDict();const r=n;n+=this.dict.copyBytesInto(t,n),t[n++]=m.Newline,t[n++]=m.s,t[n++]=m.t,t[n++]=m.r,t[n++]=m.e,t[n++]=m.a,t[n++]=m.m,t[n++]=m.Newline;const i=this.getContents();for(let o=0,s=i.length;o<s;o++)t[n++]=i[o];return t[n++]=m.Newline,t[n++]=m.e,t[n++]=m.n,t[n++]=m.d,t[n++]=m.s,t[n++]=m.t,t[n++]=m.r,t[n++]=m.e,t[n++]=m.a,t[n++]=m.m,n-r}}const pi=class extends ct{constructor(e,t){super(e),b(this,"contents"),this.contents=t}asUint8Array(){return this.contents.slice()}clone(e){return pi.of(this.dict.clone(e),this.contents.slice())}getContentsString(){return wo(this.contents)}getContents(){return this.contents}getContentsSize(){return this.contents.length}};let zt=pi;b(zt,"of",(e,t)=>new pi(e,t));const sa={},aa=new Map,ca=class extends _e{constructor(e,t,n){if(e!==sa)throw new Tr("PDFRef");super(),b(this,"objectNumber"),b(this,"generationNumber"),b(this,"tag"),this.objectNumber=t,this.generationNumber=n,this.tag=`${t} ${n} R`}clone(){return this}toString(){return this.tag}sizeInBytes(){return this.tag.length}copyBytesInto(e,t){return t+=be(this.tag,e,t),this.tag.length}};let oe=ca;b(oe,"of",(e,t=0)=>{const n=`${e} ${t} R`;let r=aa.get(n);return r||(r=new ca(sa,e,t),aa.set(n,r)),r});const bi=class{constructor(e,t){b(this,"name"),b(this,"args"),this.name=e,this.args=t||[]}clone(e){const t=new Array(this.args.length);for(let n=0,r=t.length;n<r;n++){const i=this.args[n];t[n]=i instanceof _e?i.clone(e):i}return bi.of(this.name,t)}toString(){let e="";for(let t=0,n=this.args.length;t<n;t++)e+=String(this.args[t])+" ";return e+=this.name,e}sizeInBytes(){let e=0;for(let t=0,n=this.args.length;t<n;t++){const r=this.args[t];e+=(r instanceof _e?r.sizeInBytes():r.length)+1}return e+=this.name.length,e}copyBytesInto(e,t){const n=t;for(let r=0,i=this.args.length;r<i;r++){const o=this.args[r];o instanceof _e?t+=o.copyBytesInto(e,t):t+=be(o,e,t),e[t++]=m.Space}return t+=be(this.name,e,t),t-n}};let re=bi;b(re,"of",(e,t)=>new bi(e,t));var se=(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",e))(se||{});class mi extends ct{constructor(t,n){super(t),b(this,"contentsCache"),b(this,"encode"),b(this,"computeContents",()=>{const r=this.getUnencodedContents();return this.encode?fi.deflate(r):r}),this.encode=n,n&&t.set(p.of("Filter"),p.of("FlateDecode")),this.contentsCache=At.populatedBy(this.computeContents)}getContents(){return this.contentsCache.access()}getContentsSize(){return this.contentsCache.access().length}getUnencodedContents(){throw new Le(this.constructor.name,"getUnencodedContents")}}const yi=class extends mi{constructor(e,t,n=!0){super(e,n),b(this,"operators"),this.operators=t}push(...e){this.operators.push(...e)}clone(e){const t=new Array(this.operators.length);for(let i=0,o=this.operators.length;i<o;i++)t[i]=this.operators[i].clone(e);const{dict:n,encode:r}=this;return yi.of(n.clone(e),t,r)}getContentsString(){let e="";for(let t=0,n=this.operators.length;t<n;t++)e+=`${this.operators[t]}
9
+ `;return e}getUnencodedContents(){const e=new Uint8Array(this.getUnencodedContentsSize());let t=0;for(let n=0,r=this.operators.length;n<r;n++)t+=this.operators[n].copyBytesInto(e,t),e[t++]=m.Newline;return e}getUnencodedContentsSize(){let e=0;for(let t=0,n=this.operators.length;t<n;t++)e+=this.operators[t].sizeInBytes()+1;return e}};let Ft=yi;b(Ft,"of",(e,t,n=!0)=>new yi(e,t,n));const la=class{constructor(e){b(this,"seed"),this.seed=e}nextInt(){const e=Math.sin(this.seed++)*1e4;return e-Math.floor(e)}};let ha=la;b(ha,"withSeed",e=>new la(e));const of=([e],[t])=>e.objectNumber-t.objectNumber,da=class{constructor(){b(this,"largestObjectNumber"),b(this,"header"),b(this,"trailerInfo"),b(this,"rng"),b(this,"indirectObjects"),b(this,"pushGraphicsStateContentStreamRef"),b(this,"popGraphicsStateContentStreamRef"),this.largestObjectNumber=0,this.header=bn.forVersion(1,7),this.trailerInfo={},this.indirectObjects=new Map,this.rng=ha.withSeed(1)}assign(e,t){this.indirectObjects.set(e,t),e.objectNumber>this.largestObjectNumber&&(this.largestObjectNumber=e.objectNumber)}nextRef(){return this.largestObjectNumber+=1,oe.of(this.largestObjectNumber)}register(e){const t=this.nextRef();return this.assign(t,e),t}delete(e){return this.indirectObjects.delete(e)}lookupMaybe(e,...t){const n=t.includes(Se),r=e instanceof oe?this.indirectObjects.get(e):e;if(!(!r||r===Se&&!n)){for(let i=0,o=t.length;i<o;i++){const s=t[i];if(s===Se){if(r===Se)return r}else if(r instanceof s)return r}throw new Er(t,r)}}lookup(e,...t){const n=e instanceof oe?this.indirectObjects.get(e):e;if(t.length===0)return n;for(let r=0,i=t.length;r<i;r++){const o=t[r];if(o===Se){if(n===Se)return n}else if(n instanceof o)return n}throw new Er(t,n)}getObjectRef(e){const t=Array.from(this.indirectObjects.entries());for(let n=0,r=t.length;n<r;n++){const[i,o]=t[n];if(o===e)return i}}enumerateIndirectObjects(){return Array.from(this.indirectObjects.entries()).sort(of)}obj(e){if(e instanceof _e)return e;if(e==null)return Se;if(typeof e=="string")return p.of(e);if(typeof e=="number")return $.of(e);if(typeof e=="boolean")return e?_t.True:_t.False;if(Array.isArray(e)){const t=q.withContext(this);for(let n=0,r=e.length;n<r;n++)t.push(this.obj(e[n]));return t}else{const t=V.withContext(this),n=Object.keys(e);for(let r=0,i=n.length;r<i;r++){const o=n[r],s=e[o];s!==void 0&&t.set(p.of(o),this.obj(s))}return t}}stream(e,t={}){return zt.of(this.obj(t),Dr(e))}flateStream(e,t={}){return this.stream(fi.deflate(Dr(e)),{...t,Filter:"FlateDecode"})}contentStream(e,t={}){return Ft.of(this.obj(t),e)}formXObject(e,t={}){return this.contentStream(e,{BBox:this.obj([0,0,0,0]),Matrix:this.obj([1,0,0,1,0,0]),...t,Type:"XObject",Subtype:"Form"})}getPushGraphicsStateContentStream(){if(this.pushGraphicsStateContentStreamRef)return this.pushGraphicsStateContentStreamRef;const e=this.obj({}),t=re.of(se.PushGraphicsState),n=Ft.of(e,[t]);return this.pushGraphicsStateContentStreamRef=this.register(n),this.pushGraphicsStateContentStreamRef}getPopGraphicsStateContentStream(){if(this.popGraphicsStateContentStreamRef)return this.popGraphicsStateContentStreamRef;const e=this.obj({}),t=re.of(se.PopGraphicsState),n=Ft.of(e,[t]);return this.popGraphicsStateContentStreamRef=this.register(n),this.popGraphicsStateContentStreamRef}addRandomSuffix(e,t=4){return`${e}-${Math.floor(this.rng.nextInt()*10**t)}`}};let _i=da;b(_i,"create",()=>new da);const wi=class{constructor(e){b(this,"subsections"),b(this,"chunkIdx"),b(this,"chunkLength"),this.subsections=e?[[e]]:[],this.chunkIdx=0,this.chunkLength=e?1:0}addEntry(e,t){this.append({ref:e,offset:t,deleted:!1})}addDeletedEntry(e,t){this.append({ref:e,offset:t,deleted:!0})}toString(){let e=`xref
10
10
  `;for(let t=0,n=this.subsections.length;t<n;t++){const r=this.subsections[t];e+=`${r[0].ref.objectNumber} ${r.length}
11
11
  `;for(let i=0,o=r.length;i<o;i++){const s=r[i];e+=ze(String(s.offset),10,"0"),e+=" ",e+=ze(String(s.ref.generationNumber),5,"0"),e+=" ",e+=s.deleted?"f":"n",e+=`
12
- `}}return e}sizeInBytes(){let e=5;for(let t=0,n=this.subsections.length;t<n;t++){const r=this.subsections[t],i=r.length,[o]=r;e+=2,e+=String(o.ref.objectNumber).length,e+=String(i).length,e+=20*i}return e}copyBytesInto(e,t){const n=t;return e[t++]=m.x,e[t++]=m.r,e[t++]=m.e,e[t++]=m.f,e[t++]=m.Newline,t+=this.copySubsectionsIntoBuffer(this.subsections,e,t),t-n}copySubsectionsIntoBuffer(e,t,n){const r=n,i=e.length;for(let o=0;o<i;o++){const s=this.subsections[o],c=String(s[0].ref.objectNumber);n+=be(c,t,n),t[n++]=m.Space;const l=String(s.length);n+=be(l,t,n),t[n++]=m.Newline,n+=this.copyEntriesIntoBuffer(s,t,n)}return n-r}copyEntriesIntoBuffer(e,t,n){const r=e.length;for(let i=0;i<r;i++){const o=e[i],s=ze(String(o.offset),10,"0");n+=be(s,t,n),t[n++]=m.Space;const c=ze(String(o.ref.generationNumber),5,"0");n+=be(c,t,n),t[n++]=m.Space,t[n++]=o.deleted?m.f:m.n,t[n++]=m.Space,t[n++]=m.Newline}return 20*r}append(e){if(this.chunkLength===0){this.subsections.push([e]),this.chunkIdx=0,this.chunkLength=1;return}const 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)}};let Yn=_i;b(Yn,"create",()=>new _i({ref:oe.of(0,65535),offset:0,deleted:!0})),b(Yn,"createEmpty",()=>new _i);const da=class{constructor(e){b(this,"lastXRefOffset"),this.lastXRefOffset=String(e)}toString(){return`startxref
12
+ `}}return e}sizeInBytes(){let e=5;for(let t=0,n=this.subsections.length;t<n;t++){const r=this.subsections[t],i=r.length,[o]=r;e+=2,e+=String(o.ref.objectNumber).length,e+=String(i).length,e+=20*i}return e}copyBytesInto(e,t){const n=t;return e[t++]=m.x,e[t++]=m.r,e[t++]=m.e,e[t++]=m.f,e[t++]=m.Newline,t+=this.copySubsectionsIntoBuffer(this.subsections,e,t),t-n}copySubsectionsIntoBuffer(e,t,n){const r=n,i=e.length;for(let o=0;o<i;o++){const s=this.subsections[o],c=String(s[0].ref.objectNumber);n+=be(c,t,n),t[n++]=m.Space;const l=String(s.length);n+=be(l,t,n),t[n++]=m.Newline,n+=this.copyEntriesIntoBuffer(s,t,n)}return n-r}copyEntriesIntoBuffer(e,t,n){const r=e.length;for(let i=0;i<r;i++){const o=e[i],s=ze(String(o.offset),10,"0");n+=be(s,t,n),t[n++]=m.Space;const c=ze(String(o.ref.generationNumber),5,"0");n+=be(c,t,n),t[n++]=m.Space,t[n++]=o.deleted?m.f:m.n,t[n++]=m.Space,t[n++]=m.Newline}return 20*r}append(e){if(this.chunkLength===0){this.subsections.push([e]),this.chunkIdx=0,this.chunkLength=1;return}const 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)}};let Jn=wi;b(Jn,"create",()=>new wi({ref:oe.of(0,65535),offset:0,deleted:!0})),b(Jn,"createEmpty",()=>new wi);const fa=class{constructor(e){b(this,"lastXRefOffset"),this.lastXRefOffset=String(e)}toString(){return`startxref
13
13
  ${this.lastXRefOffset}
14
- %%EOF`}sizeInBytes(){return 16+this.lastXRefOffset.length}copyBytesInto(e,t){const n=t;return e[t++]=m.s,e[t++]=m.t,e[t++]=m.a,e[t++]=m.r,e[t++]=m.t,e[t++]=m.x,e[t++]=m.r,e[t++]=m.e,e[t++]=m.f,e[t++]=m.Newline,t+=be(this.lastXRefOffset,e,t),e[t++]=m.Newline,e[t++]=m.Percent,e[t++]=m.Percent,e[t++]=m.E,e[t++]=m.O,e[t++]=m.F,t-n}};let Jn=da;b(Jn,"forLastCrossRefSectionOffset",e=>new da(e));const fa=class{constructor(e){b(this,"dict"),this.dict=e}toString(){return`trailer
15
- ${this.dict.toString()}`}sizeInBytes(){return 8+this.dict.sizeInBytes()}copyBytesInto(e,t){const n=t;return e[t++]=m.t,e[t++]=m.r,e[t++]=m.a,e[t++]=m.i,e[t++]=m.l,e[t++]=m.e,e[t++]=m.r,e[t++]=m.Newline,t+=this.dict.copyBytesInto(e,t),t-n}};let ua=fa;b(ua,"of",e=>new fa(e));const wi=class extends bi{constructor(e,t,n=!0){super(e.obj({}),n),b(this,"objects"),b(this,"offsets"),b(this,"offsetsString"),this.objects=t,this.offsets=this.computeObjectOffsets(),this.offsetsString=this.computeOffsetsString(),this.dict.set(p.of("Type"),p.of("ObjStm")),this.dict.set(p.of("N"),$.of(this.objects.length)),this.dict.set(p.of("First"),$.of(this.offsetsString.length))}getObjectsCount(){return this.objects.length}clone(e){return wi.withContextAndObjects(e||this.dict.context,this.objects.slice(),this.encode)}getContentsString(){let e=this.offsetsString;for(let t=0,n=this.objects.length;t<n;t++){const[,r]=this.objects[t];e+=`${r}
16
- `}return e}getUnencodedContents(){const e=new Uint8Array(this.getUnencodedContentsSize());let t=be(this.offsetsString,e,0);for(let n=0,r=this.objects.length;n<r;n++){const[,i]=this.objects[n];t+=i.copyBytesInto(e,t),e[t++]=m.Newline}return e}getUnencodedContentsSize(){return this.offsetsString.length+Rn(this.offsets)[1]+Rn(this.objects)[1].sizeInBytes()+1}computeOffsetsString(){let e="";for(let t=0,n=this.offsets.length;t<n;t++){const[r,i]=this.offsets[t];e+=`${r} ${i} `}return e}computeObjectOffsets(){let e=0;const t=new Array(this.objects.length);for(let n=0,r=this.objects.length;n<r;n++){const[i,o]=this.objects[n];t[n]=[i.objectNumber,e],e+=o.sizeInBytes()+1}return t}};let xi=wi;b(xi,"withContextAndObjects",(e,t,n=!0)=>new wi(e,t,n));const ga=class{constructor(e,t){b(this,"context"),b(this,"objectsPerTick"),b(this,"parsedObjects",0),b(this,"shouldWaitForTick",n=>(this.parsedObjects+=n,this.parsedObjects%this.objectsPerTick===0)),this.context=e,this.objectsPerTick=t}async serializeToBuffer(){const{size:e,header:t,indirectObjects:n,xref:r,trailerDict:i,trailer:o}=await this.computeBufferSize();let s=0;const c=new Uint8Array(e);s+=t.copyBytesInto(c,s),c[s++]=m.Newline,c[s++]=m.Newline;for(let l=0,a=n.length;l<a;l++){const[h,f]=n[l],u=String(h.objectNumber);s+=be(u,c,s),c[s++]=m.Space;const d=String(h.generationNumber);s+=be(d,c,s),c[s++]=m.Space,c[s++]=m.o,c[s++]=m.b,c[s++]=m.j,c[s++]=m.Newline,s+=f.copyBytesInto(c,s),c[s++]=m.Newline,c[s++]=m.e,c[s++]=m.n,c[s++]=m.d,c[s++]=m.o,c[s++]=m.b,c[s++]=m.j,c[s++]=m.Newline,c[s++]=m.Newline;const y=f instanceof xi?f.getObjectsCount():1;this.shouldWaitForTick(y)&&await vt()}return r&&(s+=r.copyBytesInto(c,s),c[s++]=m.Newline),i&&(s+=i.copyBytesInto(c,s),c[s++]=m.Newline,c[s++]=m.Newline),s+=o.copyBytesInto(c,s),c}computeIndirectObjectSize([e,t]){const n=e.sizeInBytes()+3,r=t.sizeInBytes()+9;return n+r}createTrailerDict(){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})}async computeBufferSize(){const e=pn.forVersion(1,7);let t=e.sizeInBytes()+2;const n=Yn.create(),r=this.context.enumerateIndirectObjects();for(let c=0,l=r.length;c<l;c++){const a=r[c],[h]=a;n.addEntry(h,t),t+=this.computeIndirectObjectSize(a),this.shouldWaitForTick(1)&&await vt()}const i=t;t+=n.sizeInBytes()+1;const o=ua.of(this.createTrailerDict());t+=o.sizeInBytes()+2;const s=Jn.forLastCrossRefSectionOffset(i);return t+=s.sizeInBytes(),{size:t,header:e,indirectObjects:r,xref:n,trailerDict:o,trailer:s}}};let Si=ga;b(Si,"forContext",(e,t)=>new ga(e,t));const Qn=class extends _e{constructor(e){super(),b(this,"value"),this.value=e}asBytes(){const e=[];let t="",n=!1;const r=i=>{i!==void 0&&e.push(i),n=!1};for(let i=0,o=this.value.length;i<o;i++){const s=this.value[i],c=H(s),l=this.value[i+1];n?c===m.Newline||c===m.CarriageReturn?r():c===m.n?r(m.Newline):c===m.r?r(m.CarriageReturn):c===m.t?r(m.Tab):c===m.b?r(m.Backspace):c===m.f?r(m.FormFeed):c===m.LeftParen?r(m.LeftParen):c===m.RightParen?r(m.RightParen):c===m.Backspace?r(m.BackSlash):c>=m.Zero&&c<=m.Seven?(t+=s,(t.length===3||!(l>="0"&&l<="7"))&&(r(parseInt(t,8)),t="")):r(c):c===m.BackSlash?n=!0:r(c)}return new Uint8Array(e)}decodeText(){const e=this.asBytes();return Do(e)?vo(e):xo(e)}decodeDate(){const e=this.decodeText(),t=yo(e);if(!t)throw new Po(e);return t}asString(){return this.value}clone(){return Qn.of(this.value)}toString(){return`(${this.value})`}sizeInBytes(){return this.value.length+2}copyBytesInto(e,t){return e[t++]=m.LeftParen,t+=be(this.value,e,t),e[t++]=m.RightParen,this.value.length+2}};let ee=Qn;b(ee,"of",e=>new Qn(e)),b(ee,"fromDate",e=>{const t=ze(String(e.getUTCFullYear()),4,"0"),n=ze(String(e.getUTCMonth()+1),2,"0"),r=ze(String(e.getUTCDate()),2,"0"),i=ze(String(e.getUTCHours()),2,"0"),o=ze(String(e.getUTCMinutes()),2,"0"),s=ze(String(e.getUTCSeconds()),2,"0");return new Qn(`D:${t}${n}${r}${i}${o}${s}Z`)});class er{constructor(t,n,r){b(this,"bytes"),b(this,"start"),b(this,"pos"),b(this,"end"),this.bytes=t,this.start=n||0,this.pos=this.start,this.end=!!n&&!!r?n+r:this.bytes.length}get length(){return this.end-this.start}get isEmpty(){return this.length===0}getByte(){return this.pos>=this.end?-1:this.bytes[this.pos++]}getUint16(){const t=this.getByte(),n=this.getByte();return t===-1||n===-1?-1:(t<<8)+n}getInt32(){const t=this.getByte(),n=this.getByte(),r=this.getByte(),i=this.getByte();return(t<<24)+(n<<16)+(r<<8)+i}getBytes(t,n=!1){const r=this.bytes,i=this.pos,o=this.end;if(t){let s=i+t;s>o&&(s=o),this.pos=s;const c=r.subarray(i,s);return n?new Uint8ClampedArray(c):c}else{const s=r.subarray(i,o);return n?new Uint8ClampedArray(s):s}}peekByte(){const t=this.getByte();return this.pos--,t}peekBytes(t,n=!1){const r=this.getBytes(t,n);return this.pos-=r.length,r}skip(t){t||(t=1),this.pos+=t}reset(){this.pos=this.start}moveStart(){this.start=this.pos}makeSubStream(t,n){return new er(this.bytes,t,n)}decode(){return this.bytes}}const sf=new Uint8Array(0);class bn{constructor(t){if(b(this,"bufferLength"),b(this,"buffer"),b(this,"eof"),b(this,"pos"),b(this,"minBufferLength"),this.pos=0,this.bufferLength=0,this.eof=!1,this.buffer=sf,this.minBufferLength=512,t)for(;this.minBufferLength<t;)this.minBufferLength*=2}get isEmpty(){for(;!this.eof&&this.bufferLength===0;)this.readBlock();return this.bufferLength===0}getByte(){const t=this.pos;for(;this.bufferLength<=t;){if(this.eof)return-1;this.readBlock()}return this.buffer[this.pos++]}getUint16(){const t=this.getByte(),n=this.getByte();return t===-1||n===-1?-1:(t<<8)+n}getInt32(){const t=this.getByte(),n=this.getByte(),r=this.getByte(),i=this.getByte();return(t<<24)+(n<<16)+(r<<8)+i}getBytes(t,n=!1){let r;const i=this.pos;if(t){for(this.ensureBuffer(i+t),r=i+t;!this.eof&&this.bufferLength<r;)this.readBlock();const s=this.bufferLength;r>s&&(r=s)}else{for(;!this.eof;)this.readBlock();r=this.bufferLength}this.pos=r;const o=this.buffer.subarray(i,r);return n&&!(o instanceof Uint8ClampedArray)?new Uint8ClampedArray(o):o}peekByte(){const t=this.getByte();return this.pos--,t}peekBytes(t,n=!1){const r=this.getBytes(t,n);return this.pos-=r.length,r}skip(t){t||(t=1),this.pos+=t}reset(){this.pos=0}makeSubStream(t,n){const r=t+n;for(;this.bufferLength<=r&&!this.eof;)this.readBlock();return new er(this.buffer,t,n)}decode(){for(;!this.eof;)this.readBlock();return this.buffer.subarray(0,this.bufferLength)}readBlock(){throw new Me(this.constructor.name,"readBlock")}ensureBuffer(t){const n=this.buffer;if(t<=n.byteLength)return n;let r=this.minBufferLength;for(;r<t;)r*=2;const i=new Uint8Array(r);return i.set(n),this.buffer=i}}const pa=e=>e===32||e===9||e===13||e===10;class af extends bn{constructor(t,n){super(n),b(this,"stream"),b(this,"input"),this.stream=t,this.input=new Uint8Array(5),n&&(n=.8*n)}readBlock(){const i=this.stream;let o=i.getByte();for(;pa(o);)o=i.getByte();if(o===-1||o===126){this.eof=!0;return}const s=this.bufferLength;let c,l;if(o===122){for(c=this.ensureBuffer(s+4),l=0;l<4;++l)c[s+l]=0;this.bufferLength+=4}else{const a=this.input;for(a[0]=o,l=1;l<5;++l){for(o=i.getByte();pa(o);)o=i.getByte();if(a[l]=o,o===-1||o===126)break}if(c=this.ensureBuffer(s+l-1),this.bufferLength+=l-1,l<5){for(;l<5;++l)a[l]=33+84;this.eof=!0}let h=0;for(l=0;l<5;++l)h=h*85+(a[l]-33);for(l=3;l>=0;--l)c[s+l]=h&255,h>>=8}}}class cf extends bn{constructor(t,n){super(n),b(this,"stream"),b(this,"firstDigit"),this.stream=t,this.firstDigit=-1,n&&(n=.5*n)}readBlock(){const n=this.stream.getBytes(8e3);if(!n.length){this.eof=!0;return}const r=n.length+1>>1,i=this.ensureBuffer(this.bufferLength+r);let o=this.bufferLength,s=this.firstDigit;for(let c=0,l=n.length;c<l;c++){const a=n[c];let h;if(a>=48&&a<=57)h=a&15;else if(a>=65&&a<=70||a>=97&&a<=102)h=(a&15)+9;else if(a===62){this.eof=!0;break}else continue;s<0?s=h:(i[o++]=s<<4|h,s=-1)}s>=0&&this.eof&&(i[o++]=s<<4,s=-1),this.firstDigit=s,this.bufferLength=o}}const ba=new Int32Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),lf=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]),hf=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]),df=[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],ff=[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];class uf extends bn{constructor(t,n){super(n),b(this,"stream"),b(this,"codeSize"),b(this,"codeBuf"),this.stream=t;const r=t.getByte(),i=t.getByte();if(r===-1||i===-1)throw new Error(`Invalid header in flate stream: ${r}, ${i}`);if((r&15)!==8)throw new Error(`Unknown compression method in flate stream: ${r}, ${i}`);if(((r<<8)+i)%31!==0)throw new Error(`Bad FCHECK in flate stream: ${r}, ${i}`);if(i&32)throw new Error(`FDICT bit set in flate stream: ${r}, ${i}`);this.codeSize=0,this.codeBuf=0}readBlock(){let t,n;const r=this.stream;let i=this.getBits(3);if(i&1&&(this.eof=!0),i>>=1,i===0){let a;if((a=r.getByte())===-1)throw new Error("Bad block header in flate stream");let h=a;if((a=r.getByte())===-1)throw new Error("Bad block header in flate stream");if(h|=a<<8,(a=r.getByte())===-1)throw new Error("Bad block header in flate stream");let f=a;if((a=r.getByte())===-1)throw new Error("Bad block header in flate stream");if(f|=a<<8,f!==(~h&65535)&&(h!==0||f!==0))throw new Error("Bad uncompressed block length in flate stream");this.codeBuf=0,this.codeSize=0;const u=this.bufferLength;t=this.ensureBuffer(u+h);const d=u+h;if(this.bufferLength=d,h===0)r.peekByte()===-1&&(this.eof=!0);else for(let y=u;y<d;++y){if((a=r.getByte())===-1){this.eof=!0;break}t[y]=a}return}let o,s;if(i===1)o=df,s=ff;else if(i===2){const a=this.getBits(5)+257,h=this.getBits(5)+1,f=this.getBits(4)+4,u=new Uint8Array(ba.length);let d;for(d=0;d<f;++d)u[ba[d]]=this.getBits(3);const y=this.generateHuffmanTable(u);n=0,d=0;const w=a+h,x=new Uint8Array(w);let _,E,v;for(;d<w;){const S=this.getCode(y);if(S===16)_=2,E=3,v=n;else if(S===17)_=3,E=3,v=n=0;else if(S===18)_=7,E=11,v=n=0;else{x[d++]=n=S;continue}let z=this.getBits(_)+E;for(;z-- >0;)x[d++]=v}o=this.generateHuffmanTable(x.subarray(0,a)),s=this.generateHuffmanTable(x.subarray(a,w))}else throw new Error("Unknown block type in flate stream");t=this.buffer;let c=t?t.length:0,l=this.bufferLength;for(;;){let a=this.getCode(o);if(a<256){l+1>=c&&(t=this.ensureBuffer(l+1),c=t.length),t[l++]=a;continue}if(a===256){this.bufferLength=l;return}a-=257,a=lf[a];let h=a>>16;h>0&&(h=this.getBits(h)),n=(a&65535)+h,a=this.getCode(s),a=hf[a],h=a>>16,h>0&&(h=this.getBits(h));const f=(a&65535)+h;l+n>=c&&(t=this.ensureBuffer(l+n),c=t.length);for(let u=0;u<n;++u,++l)t[l]=t[l-f]}}getBits(t){const n=this.stream;let r=this.codeSize,i=this.codeBuf,o;for(;r<t;){if((o=n.getByte())===-1)throw new Error("Bad encoding in flate stream");i|=o<<r,r+=8}return o=i&(1<<t)-1,this.codeBuf=i>>t,this.codeSize=r-=t,o}getCode(t){const n=this.stream,r=t[0],i=t[1];let o=this.codeSize,s=this.codeBuf,c;for(;o<i&&(c=n.getByte())!==-1;)s|=c<<o,o+=8;const l=r[s&(1<<i)-1];typeof r=="number"&&console.log("FLATE:",l);const a=l>>16,h=l&65535;if(a<1||o<a)throw new Error("Bad encoding in flate stream");return this.codeBuf=s>>a,this.codeSize=o-a,h}generateHuffmanTable(t){const n=t.length;let r=0,i;for(i=0;i<n;++i)t[i]>r&&(r=t[i]);const o=1<<r,s=new Int32Array(o);for(let c=1,l=0,a=2;c<=r;++c,l<<=1,a<<=1)for(let h=0;h<n;++h)if(t[h]===c){let f=0,u=l;for(i=0;i<c;++i)f=f<<1|u&1,u>>=1;for(i=f;i<o;i+=a)s[i]=c<<16|h;++l}return[s,r]}}class gf extends bn{constructor(t,n,r){super(n),b(this,"stream"),b(this,"cachedData"),b(this,"bitsCached"),b(this,"lzwState"),this.stream=t,this.cachedData=0,this.bitsCached=0;const i=4096,o={earlyChange:r,codeLength:9,nextCode:258,dictionaryValues:new Uint8Array(i),dictionaryLengths:new Uint16Array(i),dictionaryPrevCodes:new Uint16Array(i),currentSequence:new Uint8Array(i),currentSequenceLength:0};for(let s=0;s<256;++s)o.dictionaryValues[s]=s,o.dictionaryLengths[s]=1;this.lzwState=o}readBlock(){let n=1024;const r=512;let i,o,s;const c=this.lzwState;if(!c)return;const l=c.earlyChange;let a=c.nextCode;const h=c.dictionaryValues,f=c.dictionaryLengths,u=c.dictionaryPrevCodes;let d=c.codeLength,y=c.prevCode;const w=c.currentSequence;let x=c.currentSequenceLength,_=0,E=this.bufferLength,v=this.ensureBuffer(this.bufferLength+n);for(i=0;i<512;i++){const S=this.readBits(d),z=x>0;if(!S||S<256)w[0]=S,x=1;else if(S>=258)if(S<a)for(x=f[S],o=x-1,s=S;o>=0;o--)w[o]=h[s],s=u[s];else w[x++]=w[0];else if(S===256){d=9,a=258,x=0;continue}else{this.eof=!0,delete this.lzwState;break}if(z&&(u[a]=y,f[a]=f[y]+1,h[a]=w[0],a++,d=a+l&a+l-1?d:Math.min(Math.log(a+l)/.6931471805599453+1,12)|0),y=S,_+=x,n<_){do n+=r;while(n<_);v=this.ensureBuffer(this.bufferLength+n)}for(o=0;o<x;o++)v[E++]=w[o]}c.nextCode=a,c.codeLength=d,c.prevCode=y,c.currentSequenceLength=x,this.bufferLength=E}readBits(t){let n=this.bitsCached,r=this.cachedData;for(;n<t;){const i=this.stream.getByte();if(i===-1)return this.eof=!0,null;r=r<<8|i,n+=8}return this.bitsCached=n-=t,this.cachedData=r,r>>>n&(1<<t)-1}}class pf extends bn{constructor(t,n){super(n),b(this,"stream"),this.stream=t}readBlock(){const t=this.stream.getBytes(2);if(!t||t.length<2||t[0]===128){this.eof=!0;return}let n,r=this.bufferLength,i=t[0];if(i<128){if(n=this.ensureBuffer(r+i+1),n[r++]=t[1],i>0){const o=this.stream.getBytes(i);n.set(o,r),r+=i}}else{i=257-i;const o=t[1];n=this.ensureBuffer(r+i+1);for(let s=0;s<i;s++)n[r++]=o}this.bufferLength=r}}const ma=(e,t,n)=>{if(t===p.of("FlateDecode"))return new uf(e);if(t===p.of("LZWDecode")){let r=1;if(n instanceof V){const i=n.lookup(p.of("EarlyChange"));i instanceof $&&(r=i.asNumber())}return new gf(e,void 0,r)}if(t===p.of("ASCII85Decode"))return new af(e);if(t===p.of("ASCIIHexDecode"))return new cf(e);if(t===p.of("RunLengthDecode"))return new pf(e);throw new qc(t.asString())},ya=({dict:e,contents:t})=>{let n=new er(t);const r=e.lookup(p.of("Filter")),i=e.lookup(p.of("DecodeParms"));if(r instanceof p)n=ma(n,r,i);else if(r instanceof q)for(let o=0,s=r.size();o<s;o++)n=ma(n,r.lookup(o,p),i&&i.lookupMaybe(o,V));else if(r)throw new Tr([p,q],r);return n},bf=e=>{const t=e.MediaBox(),n=t.lookup(2,$).asNumber()-t.lookup(0,$).asNumber(),r=t.lookup(3,$).asNumber()-t.lookup(1,$).asNumber();return{left:0,bottom:0,right:n,top:r}},mf=e=>[1,0,0,1,-e.left,-e.bottom];class vi{constructor(t,n,r){b(this,"width"),b(this,"height"),b(this,"boundingBox"),b(this,"transformationMatrix"),b(this,"page"),this.page=t;const i=n??bf(t);this.width=i.right-i.left,this.height=i.top-i.bottom,this.boundingBox=i,this.transformationMatrix=r??mf(i)}static async for(t,n,r){return new vi(t,n,r)}async embedIntoContext(t,n){const{Contents:r,Resources:i}=this.page.normalizedEntries();if(!r)throw new Xc;const o=this.decodeContents(r),{left:s,bottom:c,right:l,top:a}=this.boundingBox,h=t.flateStream(o,{Type:"XObject",Subtype:"Form",FormType:1,BBox:[s,c,l,a],Matrix:this.transformationMatrix,Resources:i});return n?(t.assign(n,h),n):t.register(h)}decodeContents(t){const n=Uint8Array.of(m.Newline),r=[];for(let i=0,o=t.size();i<o;i++){const s=t.lookup(i,at);let c;if(s instanceof Ot)c=ya(s).decode();else if(s instanceof zt)c=s.getUnencodedContents();else throw new Yc(s);r.push(c,n)}return Rc(...r)}}const ki=class extends _e{constructor(e){super(),b(this,"data"),this.data=e}clone(){return ki.of(this.data.slice())}toString(){return`PDFInvalidObject(${this.data.length} bytes)`}sizeInBytes(){return this.data.length}copyBytesInto(e,t){const n=this.data.length;for(let r=0;r<n;r++)e[t++]=this.data[r];return n}};let Ai=ki;b(Ai,"of",e=>new ki(e));const tr=class extends bi{constructor(e,t,n=!0){super(e,n),b(this,"entries"),b(this,"entryTuplesCache"),b(this,"maxByteWidthsCache"),b(this,"indexCache"),b(this,"computeIndex",()=>{const r=[];let i=0;for(let o=0,s=this.entries.length;o<s;o++){const c=this.entries[o],l=this.entries[o-1];o===0?r.push(c.ref.objectNumber):c.ref.objectNumber-l.ref.objectNumber>1&&(r.push(i),r.push(c.ref.objectNumber),i=0),i+=1}return r.push(i),r}),b(this,"computeEntryTuples",()=>{const r=new Array(this.entries.length);for(let i=0,o=this.entries.length;i<o;i++){const s=this.entries[i];if(s.type===0){const{type:c,nextFreeObjectNumber:l,ref:a}=s;r[i]=[c,l,a.generationNumber]}if(s.type===1){const{type:c,offset:l,ref:a}=s;r[i]=[c,l,a.generationNumber]}if(s.type===2){const{type:c,objectStreamRef:l,index:a}=s;r[i]=[c,l.objectNumber,a]}}return r}),b(this,"computeMaxEntryByteWidths",()=>{const r=this.entryTuplesCache.access(),i=[0,0,0];for(let o=0,s=r.length;o<s;o++){const[c,l,a]=r[o],h=On(c),f=On(l),u=On(a);h>i[0]&&(i[0]=h),f>i[1]&&(i[1]=f),u>i[2]&&(i[2]=u)}return i}),this.entries=t||[],this.entryTuplesCache=kt.populatedBy(this.computeEntryTuples),this.maxByteWidthsCache=kt.populatedBy(this.computeMaxEntryByteWidths),this.indexCache=kt.populatedBy(this.computeIndex),e.set(p.of("Type"),p.of("XRef"))}addDeletedEntry(e,t){this.entries.push({type:0,ref:e,nextFreeObjectNumber:t}),this.entryTuplesCache.invalidate(),this.maxByteWidthsCache.invalidate(),this.indexCache.invalidate(),this.contentsCache.invalidate()}addUncompressedEntry(e,t){this.entries.push({type:1,ref:e,offset:t}),this.entryTuplesCache.invalidate(),this.maxByteWidthsCache.invalidate(),this.indexCache.invalidate(),this.contentsCache.invalidate()}addCompressedEntry(e,t,n){this.entries.push({type:2,ref:e,objectStreamRef:t,index:n}),this.entryTuplesCache.invalidate(),this.maxByteWidthsCache.invalidate(),this.indexCache.invalidate(),this.contentsCache.invalidate()}clone(e){const{dict:t,entries:n,encode:r}=this;return tr.of(t.clone(e),n.slice(),r)}getContentsString(){const e=this.entryTuplesCache.access(),t=this.maxByteWidthsCache.access();let n="";for(let r=0,i=e.length;r<i;r++){const[o,s,c]=e[r],l=St(At(o)),a=St(At(s)),h=St(At(c));for(let f=t[0]-1;f>=0;f--)n+=(l[f]||0).toString(2);for(let f=t[1]-1;f>=0;f--)n+=(a[f]||0).toString(2);for(let f=t[2]-1;f>=0;f--)n+=(h[f]||0).toString(2)}return n}getUnencodedContents(){const e=this.entryTuplesCache.access(),t=this.maxByteWidthsCache.access(),n=new Uint8Array(this.getUnencodedContentsSize());let r=0;for(let i=0,o=e.length;i<o;i++){const[s,c,l]=e[i],a=St(At(s)),h=St(At(c)),f=St(At(l));for(let u=t[0]-1;u>=0;u--)n[r++]=a[u]||0;for(let u=t[1]-1;u>=0;u--)n[r++]=h[u]||0;for(let u=t[2]-1;u>=0;u--)n[r++]=f[u]||0}return n}getUnencodedContentsSize(){const e=this.maxByteWidthsCache.access();return Ic(e)*this.entries.length}updateDict(){super.updateDict();const e=this.maxByteWidthsCache.access(),t=this.indexCache.access(),{context:n}=this.dict;this.dict.set(p.of("W"),n.obj(e)),this.dict.set(p.of("Index"),n.obj(t))}};let Ci=tr;b(Ci,"create",(e,t=!0)=>{const n=new tr(e,[],t);return n.addDeletedEntry(oe.of(0,65535),0),n}),b(Ci,"of",(e,t,n=!0)=>new tr(e,t,n));const _a=class extends Si{constructor(e,t,n,r){super(e,t),b(this,"encodeStreams"),b(this,"objectsPerStream"),this.encodeStreams=n,this.objectsPerStream=r}async computeBufferSize(){let e=this.context.largestObjectNumber+1;const t=pn.forVersion(1,7);let n=t.sizeInBytes()+2;const r=Ci.create(this.createTrailerDict(),this.encodeStreams),i=[],o=[],s=[],c=this.context.enumerateIndirectObjects();for(let f=0,u=c.length;f<u;f++){const d=c[f],[y,w]=d;if(y===this.context.trailerInfo.Encrypt||w instanceof at||w instanceof Ai||y.generationNumber!==0)i.push(d),r.addUncompressedEntry(y,n),n+=this.computeIndirectObjectSize(d),this.shouldWaitForTick(1)&&await vt();else{let _=Rn(o),E=Rn(s);(!_||_.length%this.objectsPerStream===0)&&(_=[],o.push(_),E=oe.of(e++),s.push(E)),r.addCompressedEntry(y,E,_.length),_.push(d)}}for(let f=0,u=o.length;f<u;f++){const d=o[f],y=s[f],w=xi.withContextAndObjects(this.context,d,this.encodeStreams);r.addUncompressedEntry(y,n),n+=this.computeIndirectObjectSize([y,w]),i.push([y,w]),this.shouldWaitForTick(d.length)&&await vt()}const l=oe.of(e++);r.dict.set(p.of("Size"),$.of(e)),r.addUncompressedEntry(l,n);const a=n;n+=this.computeIndirectObjectSize([l,r]),i.push([l,r]);const h=Jn.forLastCrossRefSectionOffset(a);return n+=h.sizeInBytes(),{size:n,header:t,indirectObjects:i,trailer:h}}};let wa=_a;b(wa,"forContext",(e,t,n=!0,r=50)=>new _a(e,t,n,r));const xa=[65472,65473,65474,65475,65477,65478,65479,65480,65481,65482,65483,65484,65485,65486,65487],yf={1:"DeviceGray",3:"DeviceRGB",4:"DeviceCMYK"};class Bi{constructor(t,n,r,i,o){b(this,"bitsPerComponent"),b(this,"height"),b(this,"width"),b(this,"colorSpace"),b(this,"imageData"),this.imageData=t,this.bitsPerComponent=n,this.width=r,this.height=i,this.colorSpace=o}static async for(t){const n=new DataView(t.buffer);if(n.getUint16(0)!==65496)throw new Error("SOI not found in JPEG");let i=2,o;for(;i<n.byteLength&&(o=n.getUint16(i),i+=2,!xa.includes(o));)i+=n.getUint16(i);if(!xa.includes(o))throw new Error("Invalid JPEG");i+=2;const s=n.getUint8(i++),c=n.getUint16(i);i+=2;const l=n.getUint16(i);i+=2;const a=n.getUint8(i++),h=yf[a];if(!h)throw new Error("Unknown JPEG channel.");const f=h;return new Bi(t,s,l,c,f)}async embedIntoContext(t,n){const r=t.stream(this.imageData,{Type:"XObject",Subtype:"Image",BitsPerComponent:this.bitsPerComponent,Width:this.width,Height:this.height,ColorSpace:this.colorSpace,Filter:"DCTDecode",Decode:this.colorSpace==="DeviceCMYK"?[1,0,1,0,1,0,1,0]:void 0});return n?(t.assign(n,r),n):t.register(r)}}var A={};A.toRGBA8=function(e){var t=e.width,n=e.height;if(e.tabs.acTL==null)return[A.toRGBA8.decodeImage(e.data,t,n,e).buffer];var r=[];e.frames[0].data==null&&(e.frames[0].data=e.data);for(var i=t*n*4,o=new Uint8Array(i),s=new Uint8Array(i),c=new Uint8Array(i),l=0;l<e.frames.length;l++){var a=e.frames[l],h=a.rect.x,f=a.rect.y,u=a.rect.width,d=a.rect.height,y=A.toRGBA8.decodeImage(a.data,u,d,e);if(l!=0)for(var w=0;w<i;w++)c[w]=o[w];if(a.blend==0?A._copyTile(y,u,d,o,t,n,h,f,0):a.blend==1&&A._copyTile(y,u,d,o,t,n,h,f,1),r.push(o.buffer.slice(0)),a.dispose!=0){if(a.dispose==1)A._copyTile(s,u,d,o,t,n,h,f,0);else if(a.dispose==2)for(var w=0;w<i;w++)o[w]=c[w]}}return r},A.toRGBA8.decodeImage=function(e,t,n,r){var i=t*n,o=A.decode._getBPP(r),s=Math.ceil(t*o/8),c=new Uint8Array(i*4),l=new Uint32Array(c.buffer),a=r.ctype,h=r.depth,f=A._bin.readUshort;if(a==6){var u=i<<2;if(h==8)for(var d=0;d<u;d+=4)c[d]=e[d],c[d+1]=e[d+1],c[d+2]=e[d+2],c[d+3]=e[d+3];if(h==16)for(var d=0;d<u;d++)c[d]=e[d<<1]}else if(a==2){var y=r.tabs.tRNS;if(y==null){if(h==8)for(var d=0;d<i;d++){var w=d*3;l[d]=255<<24|e[w+2]<<16|e[w+1]<<8|e[w]}if(h==16)for(var d=0;d<i;d++){var w=d*6;l[d]=255<<24|e[w+4]<<16|e[w+2]<<8|e[w]}}else{var x=y[0],_=y[1],E=y[2];if(h==8)for(var d=0;d<i;d++){var v=d<<2,w=d*3;l[d]=255<<24|e[w+2]<<16|e[w+1]<<8|e[w],e[w]==x&&e[w+1]==_&&e[w+2]==E&&(c[v+3]=0)}if(h==16)for(var d=0;d<i;d++){var v=d<<2,w=d*6;l[d]=255<<24|e[w+4]<<16|e[w+2]<<8|e[w],f(e,w)==x&&f(e,w+2)==_&&f(e,w+4)==E&&(c[v+3]=0)}}}else if(a==3){var S=r.tabs.PLTE,z=r.tabs.tRNS,C=z?z.length:0;if(h==1)for(var k=0;k<n;k++)for(var F=k*s,I=k*t,d=0;d<t;d++){var v=I+d<<2,T=e[F+(d>>3)]>>7-((d&7)<<0)&1,R=3*T;c[v]=S[R],c[v+1]=S[R+1],c[v+2]=S[R+2],c[v+3]=T<C?z[T]:255}if(h==2)for(var k=0;k<n;k++)for(var F=k*s,I=k*t,d=0;d<t;d++){var v=I+d<<2,T=e[F+(d>>2)]>>6-((d&3)<<1)&3,R=3*T;c[v]=S[R],c[v+1]=S[R+1],c[v+2]=S[R+2],c[v+3]=T<C?z[T]:255}if(h==4)for(var k=0;k<n;k++)for(var F=k*s,I=k*t,d=0;d<t;d++){var v=I+d<<2,T=e[F+(d>>1)]>>4-((d&1)<<2)&15,R=3*T;c[v]=S[R],c[v+1]=S[R+1],c[v+2]=S[R+2],c[v+3]=T<C?z[T]:255}if(h==8)for(var d=0;d<i;d++){var v=d<<2,T=e[d],R=3*T;c[v]=S[R],c[v+1]=S[R+1],c[v+2]=S[R+2],c[v+3]=T<C?z[T]:255}}else if(a==4){if(h==8)for(var d=0;d<i;d++){var v=d<<2,J=d<<1,N=e[J];c[v]=N,c[v+1]=N,c[v+2]=N,c[v+3]=e[J+1]}if(h==16)for(var d=0;d<i;d++){var v=d<<2,J=d<<2,N=e[J];c[v]=N,c[v+1]=N,c[v+2]=N,c[v+3]=e[J+2]}}else if(a==0)for(var x=r.tabs.tRNS?r.tabs.tRNS:-1,k=0;k<n;k++){var O=k*s,P=k*t;if(h==1)for(var B=0;B<t;B++){var N=255*(e[O+(B>>>3)]>>>7-(B&7)&1),U=N==x*255?0:255;l[P+B]=U<<24|N<<16|N<<8|N}else if(h==2)for(var B=0;B<t;B++){var N=85*(e[O+(B>>>2)]>>>6-((B&3)<<1)&3),U=N==x*85?0:255;l[P+B]=U<<24|N<<16|N<<8|N}else if(h==4)for(var B=0;B<t;B++){var N=17*(e[O+(B>>>1)]>>>4-((B&1)<<2)&15),U=N==x*17?0:255;l[P+B]=U<<24|N<<16|N<<8|N}else if(h==8)for(var B=0;B<t;B++){var N=e[O+B],U=N==x?0:255;l[P+B]=U<<24|N<<16|N<<8|N}else if(h==16)for(var B=0;B<t;B++){var N=e[O+(B<<1)],U=f(e,O+(B<<d))==x?0:255;l[P+B]=U<<24|N<<16|N<<8|N}}return c},A.decode=function(e){for(var t=new Uint8Array(e),n=8,r=A._bin,i=r.readUshort,o=r.readUint,s={tabs:{},frames:[]},c=new Uint8Array(t.length),l=0,a,h=0,f=[137,80,78,71,13,10,26,10],u=0;u<8;u++)if(t[u]!=f[u])throw"The input is not a PNG file!";for(;n<t.length;){var d=r.readUint(t,n);n+=4;var y=r.readASCII(t,n,4);if(n+=4,y=="IHDR")A.decode._IHDR(t,n,s);else if(y=="IDAT"){for(var u=0;u<d;u++)c[l+u]=t[n+u];l+=d}else if(y=="acTL")s.tabs[y]={num_frames:o(t,n),num_plays:o(t,n+4)},a=new Uint8Array(t.length);else if(y=="fcTL"){if(h!=0){var w=s.frames[s.frames.length-1];w.data=A.decode._decompress(s,a.slice(0,h),w.rect.width,w.rect.height),h=0}var x={x:o(t,n+12),y:o(t,n+16),width:o(t,n+4),height:o(t,n+8)},_=i(t,n+22);_=i(t,n+20)/(_==0?100:_);var E={rect:x,delay:Math.round(_*1e3),dispose:t[n+24],blend:t[n+25]};s.frames.push(E)}else if(y=="fdAT"){for(var u=0;u<d-4;u++)a[h+u]=t[n+u+4];h+=d-4}else if(y=="pHYs")s.tabs[y]=[r.readUint(t,n),r.readUint(t,n+4),t[n+8]];else if(y=="cHRM"){s.tabs[y]=[];for(var u=0;u<8;u++)s.tabs[y].push(r.readUint(t,n+u*4))}else if(y=="tEXt"){s.tabs[y]==null&&(s.tabs[y]={});var v=r.nextZero(t,n),S=r.readASCII(t,n,v-n),z=r.readASCII(t,v+1,n+d-v-1);s.tabs[y][S]=z}else if(y=="iTXt"){s.tabs[y]==null&&(s.tabs[y]={});var v=0,C=n;v=r.nextZero(t,C);var S=r.readASCII(t,C,v-C);C=v+1,t[C],t[C+1],C+=2,v=r.nextZero(t,C),r.readASCII(t,C,v-C),C=v+1,v=r.nextZero(t,C),r.readUTF8(t,C,v-C),C=v+1;var z=r.readUTF8(t,C,d-(C-n));s.tabs[y][S]=z}else if(y=="PLTE")s.tabs[y]=r.readBytes(t,n,d);else if(y=="hIST"){var k=s.tabs.PLTE.length/3;s.tabs[y]=[];for(var u=0;u<k;u++)s.tabs[y].push(i(t,n+u*2))}else if(y=="tRNS")s.ctype==3?s.tabs[y]=r.readBytes(t,n,d):s.ctype==0?s.tabs[y]=i(t,n):s.ctype==2&&(s.tabs[y]=[i(t,n),i(t,n+2),i(t,n+4)]);else if(y=="gAMA")s.tabs[y]=r.readUint(t,n)/1e5;else if(y=="sRGB")s.tabs[y]=t[n];else if(y=="bKGD")s.ctype==0||s.ctype==4?s.tabs[y]=[i(t,n)]:s.ctype==2||s.ctype==6?s.tabs[y]=[i(t,n),i(t,n+2),i(t,n+4)]:s.ctype==3&&(s.tabs[y]=t[n]);else if(y=="IEND")break;n+=d,r.readUint(t,n),n+=4}if(h!=0){var w=s.frames[s.frames.length-1];w.data=A.decode._decompress(s,a.slice(0,h),w.rect.width,w.rect.height),h=0}return s.data=A.decode._decompress(s,c,s.width,s.height),delete s.compress,delete s.interlace,delete s.filter,s},A.decode._decompress=function(e,t,n,r){var i=A.decode._getBPP(e),o=Math.ceil(n*i/8),s=new Uint8Array((o+1+e.interlace)*r);return t=A.decode._inflate(t,s),e.interlace==0?t=A.decode._filterZero(t,e,0,n,r):e.interlace==1&&(t=A.decode._readInterlace(t,e)),t},A.decode._inflate=function(e,t){var n=A.inflateRaw(new Uint8Array(e.buffer,2,e.length-6),t);return n},A.inflateRaw=function(){var e={};return e.H={},e.H.N=function(t,n){var r=Uint8Array,i=0,o=0,s=0,c=0,l=0,a=0,h=0,f=0,u=0,d,y;if(t[0]==3&&t[1]==0)return n||new r(0);var w=e.H,x=w.b,_=w.e,E=w.R,v=w.n,S=w.A,z=w.Z,C=w.m,k=n==null;for(k&&(n=new r(t.length>>>2<<3));i==0;){if(i=x(t,u,1),o=x(t,u+1,2),u+=3,o==0){(u&7)!=0&&(u+=8-(u&7));var F=(u>>>3)+4,I=t[F-4]|t[F-3]<<8;k&&(n=e.H.W(n,f+I)),n.set(new r(t.buffer,t.byteOffset+F,I),f),u=F+I<<3,f+=I;continue}if(k&&(n=e.H.W(n,f+(1<<17))),o==1&&(d=C.J,y=C.h,a=(1<<9)-1,h=(1<<5)-1),o==2){s=_(t,u,5)+257,c=_(t,u+5,5)+1,l=_(t,u+10,4)+4,u+=14;for(var T=1,R=0;R<38;R+=2)C.Q[R]=0,C.Q[R+1]=0;for(var R=0;R<l;R++){var J=_(t,u+R*3,3);C.Q[(C.X[R]<<1)+1]=J,J>T&&(T=J)}u+=3*l,v(C.Q,T),S(C.Q,T,C.u),d=C.w,y=C.d,u=E(C.u,(1<<T)-1,s+c,t,u,C.v);var N=w.V(C.v,0,s,C.C);a=(1<<N)-1;var O=w.V(C.v,s,c,C.D);h=(1<<O)-1,v(C.C,N),S(C.C,N,d),v(C.D,O),S(C.D,O,y)}for(;;){var P=d[z(t,u)&a];u+=P&15;var B=P>>>4;if(B>>>8==0)n[f++]=B;else{if(B==256)break;var U=f+B-254;if(B>264){var ie=C.q[B-257];U=f+(ie>>>3)+_(t,u,ie&7),u+=ie&7}var le=y[z(t,u)&h];u+=le&15;var pe=le>>>4,ke=C.c[pe],Oe=(ke>>>4)+x(t,u,ke&15);for(u+=ke&15;f<U;)n[f]=n[f++-Oe],n[f]=n[f++-Oe],n[f]=n[f++-Oe],n[f]=n[f++-Oe];f=U}}}return n.length==f?n:n.slice(0,f)},e.H.W=function(t,n){var r=t.length;if(n<=r)return t;var i=new Uint8Array(r<<1);return i.set(t,0),i},e.H.R=function(t,n,r,i,o,s){for(var c=e.H.e,l=e.H.Z,a=0;a<r;){var h=t[l(i,o)&n];o+=h&15;var f=h>>>4;if(f<=15)s[a]=f,a++;else{var u=0,d=0;f==16?(d=3+c(i,o,2),o+=2,u=s[a-1]):f==17?(d=3+c(i,o,3),o+=3):f==18&&(d=11+c(i,o,7),o+=7);for(var y=a+d;a<y;)s[a]=u,a++}}return o},e.H.V=function(t,n,r,i){for(var o=0,s=0,c=i.length>>>1;s<r;){var l=t[s+n];i[s<<1]=0,i[(s<<1)+1]=l,l>o&&(o=l),s++}for(;s<c;)i[s<<1]=0,i[(s<<1)+1]=0,s++;return o},e.H.n=function(t,n){for(var r=e.H.m,i=t.length,o,s,c,l,a,h=r.j,l=0;l<=n;l++)h[l]=0;for(l=1;l<i;l+=2)h[t[l]]++;var f=r.K;for(o=0,h[0]=0,s=1;s<=n;s++)o=o+h[s-1]<<1,f[s]=o;for(c=0;c<i;c+=2)a=t[c+1],a!=0&&(t[c]=f[a],f[a]++)},e.H.A=function(t,n,r){for(var i=t.length,o=e.H.m,s=o.r,c=0;c<i;c+=2)if(t[c+1]!=0)for(var l=c>>1,a=t[c+1],h=l<<4|a,f=n-a,u=t[c]<<f,d=u+(1<<f);u!=d;){var y=s[u]>>>15-n;r[y]=h,u++}},e.H.l=function(t,n){for(var r=e.H.m.r,i=15-n,o=0;o<t.length;o+=2){var s=t[o]<<n-t[o+1];t[o]=r[s]>>>i}},e.H.M=function(t,n,r){r=r<<(n&7);var i=n>>>3;t[i]|=r,t[i+1]|=r>>>8},e.H.I=function(t,n,r){r=r<<(n&7);var i=n>>>3;t[i]|=r,t[i+1]|=r>>>8,t[i+2]|=r>>>16},e.H.e=function(t,n,r){return(t[n>>>3]|t[(n>>>3)+1]<<8)>>>(n&7)&(1<<r)-1},e.H.b=function(t,n,r){return(t[n>>>3]|t[(n>>>3)+1]<<8|t[(n>>>3)+2]<<16)>>>(n&7)&(1<<r)-1},e.H.Z=function(t,n){return(t[n>>>3]|t[(n>>>3)+1]<<8|t[(n>>>3)+2]<<16)>>>(n&7)},e.H.i=function(t,n){return(t[n>>>3]|t[(n>>>3)+1]<<8|t[(n>>>3)+2]<<16|t[(n>>>3)+3]<<24)>>>(n&7)},e.H.m=function(){var t=Uint16Array,n=Uint32Array;return{K:new t(16),j:new t(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 t(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 n(32),J:new t(512),_:[],h:new t(32),$:[],w:new t(32768),C:[],v:[],d:new t(32768),D:[],u:new t(512),Q:[],r:new t(1<<15),s:new n(286),Y:new n(30),a:new n(19),t:new n(15e3),k:new t(1<<16),g:new t(1<<15)}}(),function(){for(var t=e.H.m,n=1<<15,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 o(s,c,l){for(;c--!=0;)s.push(0,l)}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];o(t._,144,8),o(t._,255-143,9),o(t._,279-255,7),o(t._,287-279,8),e.H.n(t._,9),e.H.A(t._,9,t.J),e.H.l(t._,9),o(t.$,32,5),e.H.n(t.$,5),e.H.A(t.$,5,t.h),e.H.l(t.$,5),o(t.Q,19,0),o(t.C,286,0),o(t.D,30,0),o(t.v,320,0)}(),e.H.N}(),A.decode._readInterlace=function(e,t){for(var n=t.width,r=t.height,i=A.decode._getBPP(t),o=i>>3,s=Math.ceil(n*i/8),c=new Uint8Array(r*s),l=0,a=[0,0,4,0,2,0,1],h=[0,4,0,2,0,1,0],f=[8,8,8,4,4,2,2],u=[8,8,4,4,2,2,1],d=0;d<7;){for(var y=f[d],w=u[d],x=0,_=0,E=a[d];E<r;)E+=y,_++;for(var v=h[d];v<n;)v+=w,x++;var S=Math.ceil(x*i/8);A.decode._filterZero(e,t,l,x,_);for(var z=0,C=a[d];C<r;){for(var k=h[d],F=l+z*S<<3;k<n;){if(i==1){var I=e[F>>3];I=I>>7-(F&7)&1,c[C*s+(k>>3)]|=I<<7-((k&7)<<0)}if(i==2){var I=e[F>>3];I=I>>6-(F&7)&3,c[C*s+(k>>2)]|=I<<6-((k&3)<<1)}if(i==4){var I=e[F>>3];I=I>>4-(F&7)&15,c[C*s+(k>>1)]|=I<<4-((k&1)<<2)}if(i>=8)for(var T=C*s+k*o,R=0;R<o;R++)c[T+R]=e[(F>>3)+R];F+=i,k+=w}z++,C+=y}x*_!=0&&(l+=_*(1+S)),d=d+1}return c},A.decode._getBPP=function(e){var t=[1,null,3,1,2,null,4][e.ctype];return t*e.depth},A.decode._filterZero=function(e,t,n,r,i){var o=A.decode._getBPP(t),s=Math.ceil(r*o/8),c=A.decode._paeth;o=Math.ceil(o/8);var l=0,a=1,h=e[n],f=0;if(h>1&&(e[n]=[0,0,1][h-2]),h==3)for(f=o;f<s;f++)e[f+1]=e[f+1]+(e[f+1-o]>>>1)&255;for(var u=0;u<i;u++)if(l=n+u*s,a=l+u+1,h=e[a-1],f=0,h==0)for(;f<s;f++)e[l+f]=e[a+f];else if(h==1){for(;f<o;f++)e[l+f]=e[a+f];for(;f<s;f++)e[l+f]=e[a+f]+e[l+f-o]}else if(h==2)for(;f<s;f++)e[l+f]=e[a+f]+e[l+f-s];else if(h==3){for(;f<o;f++)e[l+f]=e[a+f]+(e[l+f-s]>>>1);for(;f<s;f++)e[l+f]=e[a+f]+(e[l+f-s]+e[l+f-o]>>>1)}else{for(;f<o;f++)e[l+f]=e[a+f]+c(0,e[l+f-s],0);for(;f<s;f++)e[l+f]=e[a+f]+c(e[l+f-o],e[l+f-s],e[l+f-o-s])}return e},A.decode._paeth=function(e,t,n){var r=e+t-n,i=r-e,o=r-t,s=r-n;return i*i<=o*o&&i*i<=s*s?e:o*o<=s*s?t:n},A.decode._IHDR=function(e,t,n){var r=A._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++},A._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]*(256*256*256)+(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,o=0;o<n;o++)r+="%"+A._bin.pad(e[t+o].toString(16));try{i=decodeURIComponent(r)}catch{return A._bin.readASCII(e,t,n)}return i}},A._copyTile=function(e,t,n,r,i,o,s,c,l){for(var a=Math.min(t,i),h=Math.min(n,o),f=0,u=0,d=0;d<h;d++)for(var y=0;y<a;y++)if(s>=0&&c>=0?(f=d*t+y<<2,u=(c+d)*i+s+y<<2):(f=(-c+d)*t-s+y<<2,u=d*i+y<<2),l==0)r[u]=e[f],r[u+1]=e[f+1],r[u+2]=e[f+2],r[u+3]=e[f+3];else if(l==1){var w=e[f+3]*.00392156862745098,x=e[f]*w,_=e[f+1]*w,E=e[f+2]*w,v=r[u+3]*(1/255),S=r[u]*v,z=r[u+1]*v,C=r[u+2]*v,k=1-w,F=w+v*k,I=F==0?0:1/F;r[u+3]=255*F,r[u+0]=(x+S*k)*I,r[u+1]=(_+z*k)*I,r[u+2]=(E+C*k)*I}else if(l==2){var w=e[f+3],x=e[f],_=e[f+1],E=e[f+2],v=r[u+3],S=r[u],z=r[u+1],C=r[u+2];w==v&&x==S&&_==z&&E==C?(r[u]=0,r[u+1]=0,r[u+2]=0,r[u+3]=0):(r[u]=x,r[u+1]=_,r[u+2]=E,r[u+3]=w)}else if(l==3){var w=e[f+3],x=e[f],_=e[f+1],E=e[f+2],v=r[u+3],S=r[u],z=r[u+1],C=r[u+2];if(w==v&&x==S&&_==z&&E==C)continue;if(w<220&&v>20)return!1}return!0},A.encode=function(e,t,n,r,i,o,s){r==null&&(r=0),s==null&&(s=!1);var c=A.encode.compress(e,t,n,r,[!1,!1,!1,0,s]);return A.encode.compressPNG(c,-1),A.encode._main(c,t,n,i,o)},A.encodeLL=function(e,t,n,r,i,o,s,c){for(var l={ctype:0+(r==1?0:2)+(i==0?0:4),depth:o,frames:[]},a=(r+i)*o,h=a*t,f=0;f<e.length;f++)l.frames.push({rect:{x:0,y:0,width:t,height:n},img:new Uint8Array(e[f]),blend:0,dispose:1,bpp:Math.ceil(a/8),bpl:Math.ceil(h/8)});A.encode.compressPNG(l,0,!0);var u=A.encode._main(l,t,n,s,c);return u},A.encode._main=function(e,t,n,r,i){i==null&&(i={});var o=A.crc.crc,s=A._bin.writeUint,c=A._bin.writeUshort,l=A._bin.writeASCII,a=8,h=e.frames.length>1,f=!1,u=8+(16+5+4)+(h?20:0);if(i.sRGB!=null&&(u+=8+1+4),i.pHYs!=null&&(u+=8+9+4),e.ctype==3){for(var d=e.plte.length,y=0;y<d;y++)e.plte[y]>>>24!=255&&(f=!0);u+=8+d*3+4+(f?8+d*1+4:0)}for(var w=0;w<e.frames.length;w++){var x=e.frames[w];h&&(u+=38),u+=x.cimg.length+12,w!=0&&(u+=4)}u+=12;for(var _=new Uint8Array(u),E=[137,80,78,71,13,10,26,10],y=0;y<8;y++)_[y]=E[y];if(s(_,a,13),a+=4,l(_,a,"IHDR"),a+=4,s(_,a,t),a+=4,s(_,a,n),a+=4,_[a]=e.depth,a++,_[a]=e.ctype,a++,_[a]=0,a++,_[a]=0,a++,_[a]=0,a++,s(_,a,o(_,a-17,17)),a+=4,i.sRGB!=null&&(s(_,a,1),a+=4,l(_,a,"sRGB"),a+=4,_[a]=i.sRGB,a++,s(_,a,o(_,a-5,5)),a+=4),i.pHYs!=null&&(s(_,a,9),a+=4,l(_,a,"pHYs"),a+=4,s(_,a,i.pHYs[0]),a+=4,s(_,a,i.pHYs[1]),a+=4,_[a]=i.pHYs[2],a++,s(_,a,o(_,a-13,13)),a+=4),h&&(s(_,a,8),a+=4,l(_,a,"acTL"),a+=4,s(_,a,e.frames.length),a+=4,s(_,a,i.loop!=null?i.loop:0),a+=4,s(_,a,o(_,a-12,12)),a+=4),e.ctype==3){var d=e.plte.length;s(_,a,d*3),a+=4,l(_,a,"PLTE"),a+=4;for(var y=0;y<d;y++){var v=y*3,S=e.plte[y],z=S&255,C=S>>>8&255,k=S>>>16&255;_[a+v+0]=z,_[a+v+1]=C,_[a+v+2]=k}if(a+=d*3,s(_,a,o(_,a-d*3-4,d*3+4)),a+=4,f){s(_,a,d),a+=4,l(_,a,"tRNS"),a+=4;for(var y=0;y<d;y++)_[a+y]=e.plte[y]>>>24&255;a+=d,s(_,a,o(_,a-d-4,d+4)),a+=4}}for(var F=0,w=0;w<e.frames.length;w++){var x=e.frames[w];h&&(s(_,a,26),a+=4,l(_,a,"fcTL"),a+=4,s(_,a,F++),a+=4,s(_,a,x.rect.width),a+=4,s(_,a,x.rect.height),a+=4,s(_,a,x.rect.x),a+=4,s(_,a,x.rect.y),a+=4,c(_,a,r[w]),a+=2,c(_,a,1e3),a+=2,_[a]=x.dispose,a++,_[a]=x.blend,a++,s(_,a,o(_,a-30,30)),a+=4);var I=x.cimg,d=I.length;s(_,a,d+(w==0?0:4)),a+=4;var T=a;l(_,a,w==0?"IDAT":"fdAT"),a+=4,w!=0&&(s(_,a,F++),a+=4),_.set(I,a),a+=d,s(_,a,o(_,T,a-T)),a+=4}return s(_,a,0),a+=4,l(_,a,"IEND"),a+=4,s(_,a,o(_,a-4,4)),a+=4,_.buffer},A.encode.compressPNG=function(e,t,n){for(var r=0;r<e.frames.length;r++){var i=e.frames[r];i.rect.width;var o=i.rect.height,s=new Uint8Array(o*i.bpl+o);i.cimg=A.encode._filterZero(i.img,o,i.bpp,i.bpl,s,t,n)}},A.encode.compress=function(e,t,n,r,i){for(var o=i[0],s=i[1],c=i[2],l=i[3],a=i[4],h=6,f=8,u=255,d=0;d<e.length;d++)for(var y=new Uint8Array(e[d]),w=y.length,x=0;x<w;x+=4)u&=y[x+3];var _=u!=255,E=A.encode.framize(e,t,n,o,s,c),v={},S=[],z=[];if(r!=0){for(var C=[],x=0;x<E.length;x++)C.push(E[x].img.buffer);for(var k=A.encode.concatRGBA(C),F=A.quantize(k,r),I=0,T=new Uint8Array(F.abuf),x=0;x<E.length;x++){var R=E[x].img,J=R.length;z.push(new Uint8Array(F.inds.buffer,I>>2,J>>2));for(var d=0;d<J;d+=4)R[d]=T[I+d],R[d+1]=T[I+d+1],R[d+2]=T[I+d+2],R[d+3]=T[I+d+3];I+=J}for(var x=0;x<F.plte.length;x++)S.push(F.plte[x].est.rgba)}else for(var d=0;d<E.length;d++){var N=E[d],O=new Uint32Array(N.img.buffer),P=N.rect.width,w=O.length,B=new Uint8Array(w);z.push(B);for(var x=0;x<w;x++){var U=O[x];if(x!=0&&U==O[x-1])B[x]=B[x-1];else if(x>P&&U==O[x-P])B[x]=B[x-P];else{var ie=v[U];if(ie==null&&(v[U]=ie=S.length,S.push(U),S.length>=300))break;B[x]=ie}}}var le=S.length;le<=256&&a==!1&&(le<=2?f=1:le<=4?f=2:le<=16?f=4:f=8,f=Math.max(f,l));for(var d=0;d<E.length;d++){var N=E[d];N.rect.x,N.rect.y;var P=N.rect.width,pe=N.rect.height,ke=N.img;new Uint32Array(ke.buffer);var Oe=4*P,uo=4;if(le<=256&&a==!1){Oe=Math.ceil(f*P/8);for(var Ve=new Uint8Array(Oe*pe),kr=z[d],Ar=0;Ar<pe;Ar++){var x=Ar*Oe,Cr=Ar*P;if(f==8)for(var he=0;he<P;he++)Ve[x+he]=kr[Cr+he];else if(f==4)for(var he=0;he<P;he++)Ve[x+(he>>1)]|=kr[Cr+he]<<4-(he&1)*4;else if(f==2)for(var he=0;he<P;he++)Ve[x+(he>>2)]|=kr[Cr+he]<<6-(he&3)*2;else if(f==1)for(var he=0;he<P;he++)Ve[x+(he>>3)]|=kr[Cr+he]<<7-(he&7)*1}ke=Ve,h=3,uo=1}else if(_==!1&&E.length==1){for(var Ve=new Uint8Array(P*pe*3),Ku=P*pe,x=0;x<Ku;x++){var R=x*3,go=x*4;Ve[R]=ke[go],Ve[R+1]=ke[go+1],Ve[R+2]=ke[go+2]}ke=Ve,h=2,uo=3,Oe=3*P}N.img=ke,N.bpl=Oe,N.bpp=uo}return{ctype:h,depth:f,plte:S,frames:E}},A.encode.framize=function(e,t,n,r,i,o){for(var s=[],c=0;c<e.length;c++){var l=new Uint8Array(e[c]),a=new Uint32Array(l.buffer),h,f=0,u=0,d=t,y=n,w=r?1:0;if(c!=0){for(var x=o||r||c==1||s[c-2].dispose!=0?1:2,_=0,E=1e9,v=0;v<x;v++){for(var N=new Uint8Array(e[c-1-v]),S=new Uint32Array(e[c-1-v]),z=t,C=n,k=-1,F=-1,I=0;I<n;I++)for(var T=0;T<t;T++){var R=I*t+T;a[R]!=S[R]&&(T<z&&(z=T),T>k&&(k=T),I<C&&(C=I),I>F&&(F=I))}k==-1&&(z=C=k=F=0),i&&((z&1)==1&&z--,(C&1)==1&&C--);var J=(k-z+1)*(F-C+1);J<E&&(E=J,_=v,f=z,u=C,d=k-z+1,y=F-C+1)}var N=new Uint8Array(e[c-1-_]);_==1&&(s[c-1].dispose=2),h=new Uint8Array(d*y*4),A._copyTile(N,t,n,h,d,y,-f,-u,0),w=A._copyTile(l,t,n,h,d,y,-f,-u,3)?1:0,w==1?A.encode._prepareDiff(l,t,n,h,{x:f,y:u,width:d,height:y}):A._copyTile(l,t,n,h,d,y,-f,-u,0)}else h=l.slice(0);s.push({rect:{x:f,y:u,width:d,height:y},img:h,blend:w,dispose:0})}if(r)for(var c=0;c<s.length;c++){var O=s[c];if(O.blend!=1){var P=O.rect,B=s[c-1].rect,U=Math.min(P.x,B.x),ie=Math.min(P.y,B.y),le=Math.max(P.x+P.width,B.x+B.width),pe=Math.max(P.y+P.height,B.y+B.height),ke={x:U,y:ie,width:le-U,height:pe-ie};s[c-1].dispose=1,c-1!=0&&A.encode._updateFrame(e,t,n,s,c-1,ke,i),A.encode._updateFrame(e,t,n,s,c,ke,i)}}var Oe=0;if(e.length!=1)for(var R=0;R<s.length;R++){var O=s[R];Oe+=O.rect.width*O.rect.height}return s},A.encode._updateFrame=function(e,t,n,r,i,o,s){for(var c=Uint8Array,l=Uint32Array,a=new c(e[i-1]),h=new l(e[i-1]),f=i+1<e.length?new c(e[i+1]):null,u=new c(e[i]),d=new l(u.buffer),y=t,w=n,x=-1,_=-1,E=0;E<o.height;E++)for(var v=0;v<o.width;v++){var S=o.x+v,z=o.y+E,C=z*t+S,k=d[C];k==0||r[i-1].dispose==0&&h[C]==k&&(f==null||f[C*4+3]!=0)||(S<y&&(y=S),S>x&&(x=S),z<w&&(w=z),z>_&&(_=z))}x==-1&&(y=w=x=_=0),s&&((y&1)==1&&y--,(w&1)==1&&w--),o={x:y,y:w,width:x-y+1,height:_-w+1};var F=r[i];F.rect=o,F.blend=1,F.img=new Uint8Array(o.width*o.height*4),r[i-1].dispose==0?(A._copyTile(a,t,n,F.img,o.width,o.height,-o.x,-o.y,0),A.encode._prepareDiff(u,t,n,F.img,o)):A._copyTile(u,t,n,F.img,o.width,o.height,-o.x,-o.y,0)},A.encode._prepareDiff=function(e,t,n,r,i){A._copyTile(e,t,n,r,i.width,i.height,-i.x,-i.y,2)},A.encode._filterZero=function(e,t,n,r,i,o,s){var c=[],l=[0,1,2,3,4];o!=-1?l=[o]:(t*r>5e5||n==1)&&(l=[0]);var a;s&&(a={level:0});for(var h=s&&UZIP!=null?UZIP:di,f=0;f<l.length;f++){for(var u=0;u<t;u++)A.encode._filterLine(i,e,u,r,n,l[f]);c.push(h.deflate(i,a))}for(var d,y=1e9,f=0;f<c.length;f++)c[f].length<y&&(d=f,y=c[f].length);return c[d]},A.encode._filterLine=function(e,t,n,r,i,o){var s=n*r,c=s+n,l=A.decode._paeth;if(e[c]=o,c++,o==0)if(r<500)for(var a=0;a<r;a++)e[c+a]=t[s+a];else e.set(new Uint8Array(t.buffer,s,r),c);else if(o==1){for(var a=0;a<i;a++)e[c+a]=t[s+a];for(var a=i;a<r;a++)e[c+a]=t[s+a]-t[s+a-i]+256&255}else if(n==0){for(var a=0;a<i;a++)e[c+a]=t[s+a];if(o==2)for(var a=i;a<r;a++)e[c+a]=t[s+a];if(o==3)for(var a=i;a<r;a++)e[c+a]=t[s+a]-(t[s+a-i]>>1)+256&255;if(o==4)for(var a=i;a<r;a++)e[c+a]=t[s+a]-l(t[s+a-i],0,0)+256&255}else{if(o==2)for(var a=0;a<r;a++)e[c+a]=t[s+a]+256-t[s+a-r]&255;if(o==3){for(var a=0;a<i;a++)e[c+a]=t[s+a]+256-(t[s+a-r]>>1)&255;for(var a=i;a<r;a++)e[c+a]=t[s+a]+256-(t[s+a-r]+t[s+a-i]>>1)&255}if(o==4){for(var a=0;a<i;a++)e[c+a]=t[s+a]+256-l(0,t[s+a-r],0)&255;for(var a=i;a<r;a++)e[c+a]=t[s+a]+256-l(t[s+a-i],t[s+a-r],t[s+a-i-r])&255}}},A.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=n>>>1;e[t]=n}return e}(),update:function(e,t,n,r){for(var i=0;i<r;i++)e=A.crc.table[(e^t[n+i])&255]^e>>>8;return e},crc:function(e,t,n){return A.crc.update(4294967295,e,t,n)^4294967295}},A.quantize=function(e,t){var n=new Uint8Array(e),r=n.slice(0),i=new Uint32Array(r.buffer),o=A.quantize.getKDtree(r,t),s=o[0],c=o[1];A.quantize.planeDst;for(var l=n,a=i,h=l.length,f=new Uint8Array(n.length>>2),u=0;u<h;u+=4){var d=l[u]*.00392156862745098,y=l[u+1]*(1/255),w=l[u+2]*(1/255),x=l[u+3]*(1/255),_=A.quantize.getNearest(s,d,y,w,x);f[u>>2]=_.ind,a[u>>2]=_.est.rgba}return{abuf:r.buffer,inds:f,plte:c}},A.quantize.getKDtree=function(e,t,n){n==null&&(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=A.quantize.stats(e,i.i0,i.i1),i.est=A.quantize.estats(i.bst);for(var o=[i];o.length<t;){for(var s=0,c=0,l=0;l<o.length;l++)o[l].est.L>s&&(s=o[l].est.L,c=l);if(s<n)break;var a=o[c],h=A.quantize.splitPixels(e,r,a.i0,a.i1,a.est.e,a.est.eMq255),f=a.i0>=h||a.i1<=h;if(f){a.est.L=0;continue}var u={i0:a.i0,i1:h,bst:null,est:null,tdst:0,left:null,right:null};u.bst=A.quantize.stats(e,u.i0,u.i1),u.est=A.quantize.estats(u.bst);var d={i0:h,i1:a.i1,bst:null,est:null,tdst:0,left:null,right:null};d.bst={R:[],m:[],N:a.bst.N-u.bst.N};for(var l=0;l<16;l++)d.bst.R[l]=a.bst.R[l]-u.bst.R[l];for(var l=0;l<4;l++)d.bst.m[l]=a.bst.m[l]-u.bst.m[l];d.est=A.quantize.estats(d.bst),a.left=u,a.right=d,o[c]=u,o.push(d)}o.sort(function(y,w){return w.bst.N-y.bst.N});for(var l=0;l<o.length;l++)o[l].ind=l;return[i,o]},A.quantize.getNearest=function(e,t,n,r,i){if(e.left==null)return e.tdst=A.quantize.dist(e.est.q,t,n,r,i),e;var o=A.quantize.planeDst(e.est,t,n,r,i),s=e.left,c=e.right;o>0&&(s=e.right,c=e.left);var l=A.quantize.getNearest(s,t,n,r,i);if(l.tdst<=o*o)return l;var a=A.quantize.getNearest(c,t,n,r,i);return a.tdst<l.tdst?a:l},A.quantize.planeDst=function(e,t,n,r,i){var o=e.e;return o[0]*t+o[1]*n+o[2]*r+o[3]*i-e.eMq},A.quantize.dist=function(e,t,n,r,i){var o=t-e[0],s=n-e[1],c=r-e[2],l=i-e[3];return o*o+s*s+c*c+l*l},A.quantize.splitPixels=function(e,t,n,r,i,o){var s=A.quantize.vecDot;for(r-=4;n<r;){for(;s(e,n,i)<=o;)n+=4;for(;s(e,r,i)>o;)r-=4;if(n>=r)break;var c=t[n>>2];t[n>>2]=t[r>>2],t[r>>2]=c,n+=4,r-=4}for(;s(e,n,i)>o;)n-=4;return n+4},A.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]},A.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],o=n-t>>2,s=t;s<n;s+=4){var c=e[s]*.00392156862745098,l=e[s+1]*(1/255),a=e[s+2]*(1/255),h=e[s+3]*(1/255);i[0]+=c,i[1]+=l,i[2]+=a,i[3]+=h,r[0]+=c*c,r[1]+=c*l,r[2]+=c*a,r[3]+=c*h,r[5]+=l*l,r[6]+=l*a,r[7]+=l*h,r[10]+=a*a,r[11]+=a*h,r[15]+=h*h}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:o}},A.quantize.estats=function(e){var t=e.R,n=e.m,r=e.N,i=n[0],o=n[1],s=n[2],c=n[3],l=r==0?0:1/r,a=[t[0]-i*i*l,t[1]-i*o*l,t[2]-i*s*l,t[3]-i*c*l,t[4]-o*i*l,t[5]-o*o*l,t[6]-o*s*l,t[7]-o*c*l,t[8]-s*i*l,t[9]-s*o*l,t[10]-s*s*l,t[11]-s*c*l,t[12]-c*i*l,t[13]-c*o*l,t[14]-c*s*l,t[15]-c*c*l],h=a,f=A.M4,u=[.5,.5,.5,.5],d=0,y=0;if(r!=0)for(var w=0;w<10&&(u=f.multVec(h,u),y=Math.sqrt(f.dot(u,u)),u=f.sml(1/y,u),!(Math.abs(y-d)<1e-9));w++)d=y;var x=[i*l,o*l,s*l,c*l],_=f.dot(f.sml(255,x),u);return{Cov:a,q:x,e:u,L:d,eMq255:_,eMq:f.dot(u,x),rgba:(Math.round(255*x[3])<<24|Math.round(255*x[2])<<16|Math.round(255*x[1])<<8|Math.round(255*x[0])<<0)>>>0}},A.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]]}},A.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 o=new Uint8Array(e[n]),s=o.length,c=0;c<s;c+=4){var l=o[c],a=o[c+1],h=o[c+2],f=o[c+3];f==0&&(l=a=h=0),r[i+c]=l,r[i+c+1]=a,r[i+c+2]=h,r[i+c+3]=f}i+=s}return r.buffer};const _f=e=>{if(e===0)return Ft.Greyscale;if(e===2)return Ft.Truecolour;if(e===3)return Ft.IndexedColour;if(e===4)return Ft.GreyscaleWithAlpha;if(e===6)return Ft.TruecolourWithAlpha;throw new Error(`Unknown color type: ${e}`)},wf=e=>{const t=Math.floor(e.length/4),n=new Uint8Array(t*3),r=new Uint8Array(t*1);let i=0,o=0,s=0;for(;i<e.length;)n[o++]=e[i++],n[o++]=e[i++],n[o++]=e[i++],r[s++]=e[i++];return{rgbChannel:n,alphaChannel:r}};var Ft=(e=>(e.Greyscale="Greyscale",e.Truecolour="Truecolour",e.IndexedColour="IndexedColour",e.GreyscaleWithAlpha="GreyscaleWithAlpha",e.TruecolourWithAlpha="TruecolourWithAlpha",e))(Ft||{});const Sa=class{constructor(e){b(this,"rgbChannel"),b(this,"alphaChannel"),b(this,"type"),b(this,"width"),b(this,"height"),b(this,"bitsPerComponent");const t=A.decode(e),n=A.toRGBA8(t);if(n.length>1)throw new Error("Animated PNGs are not supported");const r=new Uint8Array(n[0]),{rgbChannel:i,alphaChannel:o}=wf(r);this.rgbChannel=i,o.some(c=>c<255)&&(this.alphaChannel=o),this.type=_f(t.ctype),this.width=t.width,this.height=t.height,this.bitsPerComponent=8}};let va=Sa;b(va,"load",e=>new Sa(e));class Di{constructor(t){b(this,"bitsPerComponent"),b(this,"height"),b(this,"width"),b(this,"colorSpace"),b(this,"image"),this.image=t,this.bitsPerComponent=t.bitsPerComponent,this.width=t.width,this.height=t.height,this.colorSpace="DeviceRGB"}static async for(t){const n=va.load(t);return new Di(n)}async embedIntoContext(t,n){const r=this.embedAlphaChannel(t),i=t.flateStream(this.image.rgbChannel,{Type:"XObject",Subtype:"Image",BitsPerComponent:this.image.bitsPerComponent,Width:this.image.width,Height:this.image.height,ColorSpace:this.colorSpace,SMask:r});return n?(t.assign(n,i),n):t.register(i)}embedAlphaChannel(t){if(!this.image.alphaChannel)return;const n=t.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 t.register(n)}}const xf=/\/([^\0\t\n\f\r\ ]+)[\0\t\n\f\r\ ]*(\d*\.\d+|\d+)?[\0\t\n\f\r\ ]+Tf/;class nr{constructor(t,n){b(this,"dict"),b(this,"ref"),this.dict=t,this.ref=n}T(){return this.dict.lookupMaybe(p.of("T"),ee,X)}Ff(){const t=this.getInheritableAttribute(p.of("Ff"));return this.dict.context.lookupMaybe(t,$)}V(){const t=this.getInheritableAttribute(p.of("V"));return this.dict.context.lookup(t)}Kids(){return this.dict.lookupMaybe(p.of("Kids"),q)}DA(){const t=this.dict.lookup(p.of("DA"));if(t instanceof ee||t instanceof X)return t}setKids(t){this.dict.set(p.of("Kids"),this.dict.context.obj(t))}getParent(){const t=this.dict.get(p.of("Parent"));if(t instanceof oe){const n=this.dict.lookup(p.of("Parent"),V);return new nr(n,t)}}setParent(t){t?this.dict.set(p.of("Parent"),t):this.dict.delete(p.of("Parent"))}getFullyQualifiedName(){const t=this.getParent();return t?`${t.getFullyQualifiedName()}.${this.getPartialName()}`:this.getPartialName()}getPartialName(){var t;return(t=this.T())==null?void 0:t.decodeText()}setPartialName(t){t?this.dict.set(p.of("T"),X.fromText(t)):this.dict.delete(p.of("T"))}setDefaultAppearance(t){this.dict.set(p.of("DA"),ee.of(t))}getDefaultAppearance(){const t=this.DA();return t instanceof X?t.decodeText():t?.asString()}setFontSize(t){var n;const r=(n=this.getFullyQualifiedName())!=null?n:"",i=this.getDefaultAppearance();if(!i)throw new el(r);const o=Pc(i,xf);if(!o.match)throw new tl(r);const s=i.slice(0,o.pos-o.match[0].length),c=o.pos<=i.length?i.slice(o.pos):"",l=o.match[1],a=`${s} /${l} ${t} Tf ${c}`;this.setDefaultAppearance(a)}getFlags(){var t,n;return(n=(t=this.Ff())==null?void 0:t.asNumber())!=null?n:0}setFlags(t){this.dict.set(p.of("Ff"),$.of(t))}hasFlag(t){return(this.getFlags()&t)!==0}setFlag(t){const n=this.getFlags();this.setFlags(n|t)}clearFlag(t){const n=this.getFlags();this.setFlags(n&~t)}setFlagTo(t,n){n?this.setFlag(t):this.clearFlag(t)}getInheritableAttribute(t){let n;return this.ascend(r=>{n||(n=r.dict.get(t))}),n}ascend(t){t(this);const n=this.getParent();n&&n.ascend(t)}}const ka=class{constructor(e){b(this,"dict"),this.dict=e}W(){const e=this.dict.lookup(p.of("W"));if(e instanceof $)return e}getWidth(){var e,t;return(t=(e=this.W())==null?void 0:e.asNumber())!=null?t:1}setWidth(e){const t=this.dict.context.obj(e);this.dict.set(p.of("W"),t)}};let rr=ka;b(rr,"fromDict",e=>new ka(e));const Aa=class{constructor(e){b(this,"dict"),this.dict=e}Rect(){return this.dict.lookup(p.of("Rect"),q)}AP(){return this.dict.lookupMaybe(p.of("AP"),V)}F(){const e=this.dict.lookup(p.of("F"));return this.dict.context.lookupMaybe(e,$)}getRectangle(){var e;const t=this.Rect();return(e=t?.asRectangle())!=null?e:{x:0,y:0,width:0,height:0}}setRectangle(e){const{x:t,y:n,width:r,height:i}=e,o=this.dict.context.obj([t,n,t+r,n+i]);this.dict.set(p.of("Rect"),o)}getAppearanceState(){const e=this.dict.lookup(p.of("AS"));if(e instanceof p)return e}setAppearanceState(e){this.dict.set(p.of("AS"),e)}setAppearances(e){this.dict.set(p.of("AP"),e)}ensureAP(){let e=this.AP();return e||(e=this.dict.context.obj({}),this.dict.set(p.of("AP"),e)),e}getNormalAppearance(){const t=this.ensureAP().get(p.of("N"));if(t instanceof oe||t instanceof V)return t;throw new Error(`Unexpected N type: ${t?.constructor.name}`)}setNormalAppearance(e){this.ensureAP().set(p.of("N"),e)}setRolloverAppearance(e){this.ensureAP().set(p.of("R"),e)}setDownAppearance(e){this.ensureAP().set(p.of("D"),e)}removeRolloverAppearance(){const e=this.AP();e?.delete(p.of("R"))}removeDownAppearance(){const e=this.AP();e?.delete(p.of("D"))}getAppearances(){const e=this.AP();if(!e)return;const t=e.lookup(p.of("N"),V,at),n=e.lookupMaybe(p.of("R"),V,at),r=e.lookupMaybe(p.of("D"),V,at);return{normal:t,rollover:n,down:r}}getFlags(){var e,t;return(t=(e=this.F())==null?void 0:e.asNumber())!=null?t:0}setFlags(e){this.dict.set(p.of("F"),$.of(e))}hasFlag(e){return(this.getFlags()&e)!==0}setFlag(e){const t=this.getFlags();this.setFlags(t|e)}clearFlag(e){const t=this.getFlags();this.setFlags(t&~e)}setFlagTo(e,t){t?this.setFlag(e):this.clearFlag(e)}};let Ca=Aa;b(Ca,"fromDict",e=>new Aa(e));const Ba=class{constructor(e){b(this,"dict"),this.dict=e}R(){const e=this.dict.lookup(p.of("R"));if(e instanceof $)return e}BC(){const e=this.dict.lookup(p.of("BC"));if(e instanceof q)return e}BG(){const e=this.dict.lookup(p.of("BG"));if(e instanceof q)return e}CA(){const e=this.dict.lookup(p.of("CA"));if(e instanceof X||e instanceof ee)return e}RC(){const e=this.dict.lookup(p.of("RC"));if(e instanceof X||e instanceof ee)return e}AC(){const e=this.dict.lookup(p.of("AC"));if(e instanceof X||e instanceof ee)return e}getRotation(){var e;return(e=this.R())==null?void 0:e.asNumber()}getBorderColor(){const e=this.BC();if(!e)return;const t=[];for(let n=0,r=e?.size();n<r;n++){const i=e.get(n);i instanceof $&&t.push(i.asNumber())}return t}getBackgroundColor(){const e=this.BG();if(!e)return;const t=[];for(let n=0,r=e?.size();n<r;n++){const i=e.get(n);i instanceof $&&t.push(i.asNumber())}return t}getCaptions(){const e=this.CA(),t=this.RC(),n=this.AC();return{normal:e?.decodeText(),rollover:t?.decodeText(),down:n?.decodeText()}}setRotation(e){const t=this.dict.context.obj(e);this.dict.set(p.of("R"),t)}setBorderColor(e){const t=this.dict.context.obj(e);this.dict.set(p.of("BC"),t)}setBackgroundColor(e){const t=this.dict.context.obj(e);this.dict.set(p.of("BG"),t)}setCaptions(e){const t=X.fromText(e.normal);if(this.dict.set(p.of("CA"),t),e.rollover){const n=X.fromText(e.rollover);this.dict.set(p.of("RC"),n)}else this.dict.delete(p.of("RC"));if(e.down){const n=X.fromText(e.down);this.dict.set(p.of("AC"),n)}else this.dict.delete(p.of("AC"))}};let ir=Ba;b(ir,"fromDict",e=>new Ba(e));const Ti=class extends Ca{MK(){const e=this.dict.lookup(p.of("MK"));if(e instanceof V)return e}BS(){const e=this.dict.lookup(p.of("BS"));if(e instanceof V)return e}DA(){const e=this.dict.lookup(p.of("DA"));if(e instanceof ee||e instanceof X)return e}P(){const e=this.dict.get(p.of("P"));if(e instanceof oe)return e}setP(e){this.dict.set(p.of("P"),e)}setDefaultAppearance(e){this.dict.set(p.of("DA"),ee.of(e))}getDefaultAppearance(){const e=this.DA();return e instanceof X?e.decodeText():e?.asString()}getAppearanceCharacteristics(){const e=this.MK();if(e)return ir.fromDict(e)}getOrCreateAppearanceCharacteristics(){const e=this.MK();if(e)return ir.fromDict(e);const t=ir.fromDict(this.dict.context.obj({}));return this.dict.set(p.of("MK"),t.dict),t}getBorderStyle(){const e=this.BS();if(e)return rr.fromDict(e)}getOrCreateBorderStyle(){const e=this.BS();if(e)return rr.fromDict(e);const t=rr.fromDict(this.dict.context.obj({}));return this.dict.set(p.of("BS"),t.dict),t}getOnValue(){var e;const t=(e=this.getAppearances())==null?void 0:e.normal;if(t instanceof V){const n=t.keys();for(let r=0,i=n.length;r<i;r++){const o=n[r];if(o!==p.of("Off"))return o}}}};let or=Ti;b(or,"fromDict",e=>new Ti(e)),b(or,"create",(e,t)=>{const n=e.obj({Type:"Annot",Subtype:"Widget",Rect:[0,0,0,0],Parent:t});return new Ti(n)});const Da=class extends nr{FT(){const e=this.getInheritableAttribute(p.of("FT"));return this.dict.context.lookup(e,p)}getWidgets(){const e=this.Kids();if(!e)return[or.fromDict(this.dict)];const t=new Array(e.size());for(let n=0,r=e.size();n<r;n++){const i=e.lookup(n,V);t[n]=or.fromDict(i)}return t}addWidget(e){const{Kids:t}=this.normalizedEntries();t.push(e)}removeWidget(e){const t=this.Kids();if(t){if(e<0||e>t.size())throw new Fn(e,0,t.size());t.remove(e)}else{if(e!==0)throw new Fn(e,0,0);this.setKids([])}}normalizedEntries(){let e=this.Kids();return e||(e=this.dict.context.obj([this.ref]),this.dict.set(p.of("Kids"),e)),{Kids:e}}};let Nt=Da;b(Nt,"fromDict",(e,t)=>new Da(e,t));class Ei extends Nt{Opt(){return this.dict.lookupMaybe(p.of("Opt"),ee,X,q)}setOpt(t){this.dict.set(p.of("Opt"),this.dict.context.obj(t))}getExportValues(){const t=this.Opt();if(!t)return;if(t instanceof ee||t instanceof X)return[t];const n=[];for(let r=0,i=t.size();r<i;r++){const o=t.lookup(r);(o instanceof ee||o instanceof X)&&n.push(o)}return n}removeExportValue(t){const n=this.Opt();if(!!n)if(n instanceof ee||n instanceof X){if(t!==0)throw new Fn(t,0,0);this.setOpt([])}else{if(t<0||t>n.size())throw new Fn(t,0,n.size());n.remove(t)}}normalizeExportValues(){var t,n,r,i;const o=(t=this.getExportValues())!=null?t:[],s=[],c=this.getWidgets();for(let l=0,a=c.length;l<a;l++){const h=c[l],f=(i=o[l])!=null?i:X.fromText((r=(n=h.getOnValue())==null?void 0:n.decodeText())!=null?r:"");s.push(f)}this.setOpt(s)}addOpt(t,n){var r;this.normalizeExportValues();const i=t.decodeText();let o;if(n){const c=(r=this.getExportValues())!=null?r:[];for(let l=0,a=c.length;l<a;l++)c[l].decodeText()===i&&(o=l)}const s=this.Opt();return s.push(t),o??s.size()-1}addWidgetWithOpt(t,n,r){const i=this.addOpt(n,r),o=p.of(String(i));return this.addWidget(t),o}}const Pi=class extends Ei{setValue(e){var t;const n=(t=this.getOnValue())!=null?t:p.of("Yes");if(e!==n&&e!==p.of("Off"))throw new Pr;this.dict.set(p.of("V"),e);const r=this.getWidgets();for(let i=0,o=r.length;i<o;i++){const s=r[i],c=s.getOnValue()===e?e:p.of("Off");s.setAppearanceState(c)}}getValue(){const e=this.V();return e instanceof p?e:p.of("Off")}getOnValue(){const[e]=this.getWidgets();return e?.getOnValue()}};let Ri=Pi;b(Ri,"fromDict",(e,t)=>new Pi(e,t)),b(Ri,"create",e=>{const t=e.obj({FT:"Btn",Kids:[]}),n=e.register(t);return new Pi(t,n)});const fe=e=>1<<e;var Sf=(e=>(e[e.ReadOnly=fe(0)]="ReadOnly",e[e.Required=fe(1)]="Required",e[e.NoExport=fe(2)]="NoExport",e))(Sf||{}),mn=(e=>(e[e.NoToggleToOff=fe(14)]="NoToggleToOff",e[e.Radio=fe(15)]="Radio",e[e.PushButton=fe(16)]="PushButton",e[e.RadiosInUnison=fe(25)]="RadiosInUnison",e))(mn||{}),vf=(e=>(e[e.Multiline=fe(12)]="Multiline",e[e.Password=fe(13)]="Password",e[e.FileSelect=fe(20)]="FileSelect",e[e.DoNotSpellCheck=fe(22)]="DoNotSpellCheck",e[e.DoNotScroll=fe(23)]="DoNotScroll",e[e.Comb=fe(24)]="Comb",e[e.RichText=fe(25)]="RichText",e))(vf||{}),Mt=(e=>(e[e.Combo=fe(17)]="Combo",e[e.Edit=fe(18)]="Edit",e[e.Sort=fe(19)]="Sort",e[e.MultiSelect=fe(21)]="MultiSelect",e[e.DoNotSpellCheck=fe(22)]="DoNotSpellCheck",e[e.CommitOnSelChange=fe(26)]="CommitOnSelChange",e))(Mt||{});class Ta extends Nt{setValues(t){if(this.hasFlag(Mt.Combo)&&!this.hasFlag(Mt.Edit)&&!this.valuesAreValid(t))throw new Pr;if(t.length===0&&this.dict.delete(p.of("V")),t.length===1&&this.dict.set(p.of("V"),t[0]),t.length>1){if(!this.hasFlag(Mt.MultiSelect))throw new Qc;this.dict.set(p.of("V"),this.dict.context.obj(t))}this.updateSelectedIndices(t)}valuesAreValid(t){const n=this.getOptions();for(let r=0,i=t.length;r<i;r++){const o=t[r].decodeText();if(!n.find(s=>o===(s.display||s.value).decodeText()))return!1}return!0}updateSelectedIndices(t){if(t.length>1){const n=new Array(t.length),r=this.getOptions();for(let i=0,o=t.length;i<o;i++){const s=t[i].decodeText();n[i]=r.findIndex(c=>s===(c.display||c.value).decodeText())}this.dict.set(p.of("I"),this.dict.context.obj(n.sort()))}else this.dict.delete(p.of("I"))}getValues(){const t=this.V();if(t instanceof ee||t instanceof X)return[t];if(t instanceof q){const n=[];for(let r=0,i=t.size();r<i;r++){const o=t.lookup(r);(o instanceof ee||o instanceof X)&&n.push(o)}return n}return[]}Opt(){return this.dict.lookupMaybe(p.of("Opt"),ee,X,q)}setOptions(t){const n=new Array(t.length);for(let r=0,i=t.length;r<i;r++){const{value:o,display:s}=t[r];n[r]=this.dict.context.obj([o,s||o])}this.dict.set(p.of("Opt"),this.dict.context.obj(n))}getOptions(){const t=this.Opt();if(t instanceof ee||t instanceof X)return[{value:t,display:t}];if(t instanceof q){const n=[];for(let r=0,i=t.size();r<i;r++){const o=t.lookup(r);if((o instanceof ee||o instanceof X)&&n.push({value:o,display:o}),o instanceof q&&o.size()>0){const s=o.lookup(0,ee,X),c=o.lookupMaybe(1,ee,X);n.push({value:s,display:c||s})}}return n}return[]}}const Ii=class extends Ta{};let Oi=Ii;b(Oi,"fromDict",(e,t)=>new Ii(e,t)),b(Oi,"create",e=>{const t=e.obj({FT:"Ch",Ff:Mt.Combo,Kids:[]}),n=e.register(t);return new Ii(t,n)});const zi=class extends nr{addField(e){const{Kids:t}=this.normalizedEntries();t?.push(e)}normalizedEntries(){let e=this.Kids();return e||(e=this.dict.context.obj([]),this.dict.set(p.of("Kids"),e)),{Kids:e}}};let sr=zi;b(sr,"fromDict",(e,t)=>new zi(e,t)),b(sr,"create",e=>{const t=e.obj({}),n=e.register(t);return new zi(t,n)});const Ea=class extends Nt{};let Pa=Ea;b(Pa,"fromDict",(e,t)=>new Ea(e,t));const Fi=class extends Nt{MaxLen(){const e=this.dict.lookup(p.of("MaxLen"));if(e instanceof $)return e}Q(){const e=this.dict.lookup(p.of("Q"));if(e instanceof $)return e}setMaxLength(e){this.dict.set(p.of("MaxLen"),$.of(e))}removeMaxLength(){this.dict.delete(p.of("MaxLen"))}getMaxLength(){var e;return(e=this.MaxLen())==null?void 0:e.asNumber()}setQuadding(e){this.dict.set(p.of("Q"),$.of(e))}getQuadding(){var e;return(e=this.Q())==null?void 0:e.asNumber()}setValue(e){this.dict.set(p.of("V"),e)}removeValue(){this.dict.delete(p.of("V"))}getValue(){const e=this.V();if(e instanceof ee||e instanceof X)return e}};let Ni=Fi;b(Ni,"fromDict",(e,t)=>new Fi(e,t)),b(Ni,"create",e=>{const t=e.obj({FT:"Tx",Kids:[]}),n=e.register(t);return new Fi(t,n)});const Mi=class extends Ei{};let Li=Mi;b(Li,"fromDict",(e,t)=>new Mi(e,t)),b(Li,"create",e=>{const t=e.obj({FT:"Btn",Ff:mn.PushButton,Kids:[]}),n=e.register(t);return new Mi(t,n)});const ji=class extends Ei{setValue(e){if(!this.getOnValues().includes(e)&&e!==p.of("Off"))throw new Pr;this.dict.set(p.of("V"),e);const n=this.getWidgets();for(let r=0,i=n.length;r<i;r++){const o=n[r],s=o.getOnValue()===e?e:p.of("Off");o.setAppearanceState(s)}}getValue(){const e=this.V();return e instanceof p?e:p.of("Off")}getOnValues(){const e=this.getWidgets(),t=[];for(let n=0,r=e.length;n<r;n++){const i=e[n].getOnValue();i&&t.push(i)}return t}};let Ui=ji;b(Ui,"fromDict",(e,t)=>new ji(e,t)),b(Ui,"create",e=>{const t=e.obj({FT:"Btn",Ff:mn.Radio,Kids:[]}),n=e.register(t);return new ji(t,n)});const $i=class extends Ta{};let Hi=$i;b(Hi,"fromDict",(e,t)=>new $i(e,t)),b(Hi,"create",e=>{const t=e.obj({FT:"Ch",Kids:[]}),n=e.register(t);return new $i(t,n)});const kf=e=>{if(!e)return[];const t=[];for(let n=0,r=e.size();n<r;n++){const i=e.get(n),o=e.lookup(n);i instanceof oe&&o instanceof V&&t.push([Ra(o,i),i])}return t},Ra=(e,t)=>Af(e)?sr.fromDict(e,t):Cf(e,t),Af=e=>{const t=e.lookup(p.of("Kids"));if(t instanceof q)for(let n=0,r=t.size();n<r;n++){const i=t.lookup(n);if(i instanceof V&&i.has(p.of("T")))return!0}return!1},Cf=(e,t)=>{const n=Vi(e,p.of("FT")),r=e.context.lookup(n,p);return r===p.of("Btn")?Bf(e,t):r===p.of("Ch")?Df(e,t):r===p.of("Tx")?Ni.fromDict(e,t):r===p.of("Sig")?Pa.fromDict(e,t):Nt.fromDict(e,t)},Bf=(e,t)=>{var n;const r=Vi(e,p.of("Ff")),i=e.context.lookupMaybe(r,$),o=(n=i?.asNumber())!=null?n:0;return Gi(o,mn.PushButton)?Li.fromDict(e,t):Gi(o,mn.Radio)?Ui.fromDict(e,t):Ri.fromDict(e,t)},Df=(e,t)=>{var n;const r=Vi(e,p.of("Ff")),i=e.context.lookupMaybe(r,$),o=(n=i?.asNumber())!=null?n:0;return Gi(o,Mt.Combo)?Oi.fromDict(e,t):Hi.fromDict(e,t)},Gi=(e,t)=>(e&t)!==0,Vi=(e,t)=>{let n;return Ia(e,r=>{n||(n=r.get(t))}),n},Ia=(e,t)=>{t(e);const n=e.lookupMaybe(p.of("Parent"),V);n&&Ia(n,t)},Wi=class{constructor(e){b(this,"dict"),this.dict=e}Fields(){const e=this.dict.lookup(p.of("Fields"));if(e instanceof q)return e}getFields(){const{Fields:e}=this.normalizedEntries(),t=new Array(e.size());for(let n=0,r=e.size();n<r;n++){const i=e.get(n),o=e.lookup(n,V);t[n]=[Ra(o,i),i]}return t}getAllFields(){const e=[],t=n=>{if(!!n)for(let r=0,i=n.length;r<i;r++){const o=n[r];e.push(o);const[s]=o;s instanceof sr&&t(kf(s.Kids()))}};return t(this.getFields()),e}addField(e){const{Fields:t}=this.normalizedEntries();t?.push(e)}removeField(e){const 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 new Error(`Tried to remove inexistent field ${e.getFullyQualifiedName()}`);n.remove(r),t!==void 0&&n.size()===0&&this.removeField(t)}normalizedEntries(){let e=this.Fields();return e||(e=this.dict.context.obj([]),this.dict.set(p.of("Fields"),e)),{Fields:e}}};let ar=Wi;b(ar,"fromDict",e=>new Wi(e)),b(ar,"create",e=>{const t=e.obj({Fields:[]});return new Wi(t)});const cr=(e,t)=>{if(e!==void 0)return t[e]};var Ki=(e=>(e.UseNone="UseNone",e.UseOutlines="UseOutlines",e.UseThumbs="UseThumbs",e.UseOC="UseOC",e))(Ki||{}),Zi=(e=>(e.L2R="L2R",e.R2L="R2L",e))(Zi||{}),qi=(e=>(e.None="None",e.AppDefault="AppDefault",e))(qi||{}),Xi=(e=>(e.Simplex="Simplex",e.DuplexFlipShortEdge="DuplexFlipShortEdge",e.DuplexFlipLongEdge="DuplexFlipLongEdge",e))(Xi||{});const Yi=class{constructor(e){b(this,"dict"),this.dict=e}lookupBool(e){const t=this.dict.lookup(p.of(e));if(t instanceof yt)return t}lookupName(e){const t=this.dict.lookup(p.of(e));if(t instanceof p)return t}HideToolbar(){return this.lookupBool("HideToolbar")}HideMenubar(){return this.lookupBool("HideMenubar")}HideWindowUI(){return this.lookupBool("HideWindowUI")}FitWindow(){return this.lookupBool("FitWindow")}CenterWindow(){return this.lookupBool("CenterWindow")}DisplayDocTitle(){return this.lookupBool("DisplayDocTitle")}NonFullScreenPageMode(){return this.lookupName("NonFullScreenPageMode")}Direction(){return this.lookupName("Direction")}PrintScaling(){return this.lookupName("PrintScaling")}Duplex(){return this.lookupName("Duplex")}PickTrayByPDFSize(){return this.lookupBool("PickTrayByPDFSize")}PrintPageRange(){const e=this.dict.lookup(p.of("PrintPageRange"));if(e instanceof q)return e}NumCopies(){const e=this.dict.lookup(p.of("NumCopies"));if(e instanceof $)return e}getHideToolbar(){var e,t;return(t=(e=this.HideToolbar())==null?void 0:e.asBoolean())!=null?t:!1}getHideMenubar(){var e,t;return(t=(e=this.HideMenubar())==null?void 0:e.asBoolean())!=null?t:!1}getHideWindowUI(){var e,t;return(t=(e=this.HideWindowUI())==null?void 0:e.asBoolean())!=null?t:!1}getFitWindow(){var e,t;return(t=(e=this.FitWindow())==null?void 0:e.asBoolean())!=null?t:!1}getCenterWindow(){var e,t;return(t=(e=this.CenterWindow())==null?void 0:e.asBoolean())!=null?t:!1}getDisplayDocTitle(){var e,t;return(t=(e=this.DisplayDocTitle())==null?void 0:e.asBoolean())!=null?t:!1}getNonFullScreenPageMode(){var e,t;const n=(e=this.NonFullScreenPageMode())==null?void 0:e.decodeText();return(t=cr(n,Ki))!=null?t:"UseNone"}getReadingDirection(){var e,t;const n=(e=this.Direction())==null?void 0:e.decodeText();return(t=cr(n,Zi))!=null?t:"L2R"}getPrintScaling(){var e,t;const n=(e=this.PrintScaling())==null?void 0:e.decodeText();return(t=cr(n,qi))!=null?t:"AppDefault"}getDuplex(){var e;const t=(e=this.Duplex())==null?void 0:e.decodeText();return cr(t,Xi)}getPickTrayByPDFSize(){var e;return(e=this.PickTrayByPDFSize())==null?void 0:e.asBoolean()}getPrintPageRange(){const e=this.PrintPageRange();if(!e)return[];const t=[];for(let n=0;n<e.size();n+=2){const r=e.lookup(n,$).asNumber(),i=e.lookup(n+1,$).asNumber();t.push({start:r,end:i})}return t}getNumCopies(){var e,t;return(t=(e=this.NumCopies())==null?void 0:e.asNumber())!=null?t:1}setHideToolbar(e){const t=this.dict.context.obj(e);this.dict.set(p.of("HideToolbar"),t)}setHideMenubar(e){const t=this.dict.context.obj(e);this.dict.set(p.of("HideMenubar"),t)}setHideWindowUI(e){const t=this.dict.context.obj(e);this.dict.set(p.of("HideWindowUI"),t)}setFitWindow(e){const t=this.dict.context.obj(e);this.dict.set(p.of("FitWindow"),t)}setCenterWindow(e){const t=this.dict.context.obj(e);this.dict.set(p.of("CenterWindow"),t)}setDisplayDocTitle(e){const t=this.dict.context.obj(e);this.dict.set(p.of("DisplayDocTitle"),t)}setNonFullScreenPageMode(e){qt(e,"nonFullScreenPageMode",Ki);const t=p.of(e);this.dict.set(p.of("NonFullScreenPageMode"),t)}setReadingDirection(e){qt(e,"readingDirection",Zi);const t=p.of(e);this.dict.set(p.of("Direction"),t)}setPrintScaling(e){qt(e,"printScaling",qi);const t=p.of(e);this.dict.set(p.of("PrintScaling"),t)}setDuplex(e){qt(e,"duplex",Xi);const t=p.of(e);this.dict.set(p.of("Duplex"),t)}setPickTrayByPDFSize(e){const t=this.dict.context.obj(e);this.dict.set(p.of("PickTrayByPDFSize"),t)}setPrintPageRange(e){Array.isArray(e)||(e=[e]);const t=[];for(let r=0,i=e.length;r<i;r++)t.push(e[r].start),t.push(e[r].end);Eo(t,"printPageRange",["number"]);const n=this.dict.context.obj(t);this.dict.set(p.of("PrintPageRange"),n)}setNumCopies(e){et(e,"numCopies",1,Number.MAX_VALUE),Zc(e,"numCopies");const t=this.dict.context.obj(e);this.dict.set(p.of("NumCopies"),t)}};let lr=Yi;b(lr,"fromDict",e=>new Yi(e)),b(lr,"create",e=>{const t=e.obj({});return new Yi(t)});const Ji=class extends V{Pages(){return this.lookup(p.of("Pages"),V)}AcroForm(){return this.lookupMaybe(p.of("AcroForm"),V)}getAcroForm(){const e=this.AcroForm();if(!!e)return ar.fromDict(e)}getOrCreateAcroForm(){let e=this.getAcroForm();if(!e){e=ar.create(this.context);const t=this.context.register(e.dict);this.set(p.of("AcroForm"),t)}return e}ViewerPreferences(){return this.lookupMaybe(p.of("ViewerPreferences"),V)}getViewerPreferences(){const e=this.ViewerPreferences();if(!!e)return lr.fromDict(e)}getOrCreateViewerPreferences(){let e=this.getViewerPreferences();if(!e){e=lr.create(this.context);const t=this.context.register(e.dict);this.set(p.of("ViewerPreferences"),t)}return e}insertLeafNode(e,t){const n=this.get(p.of("Pages"));return this.Pages().insertLeafNode(e,t)||n}removeLeafNode(e){this.Pages().removeLeafNode(e)}};let Qi=Ji;b(Qi,"withContextAndPages",(e,t)=>{const n=new Map;return n.set(p.of("Type"),p.of("Catalog")),n.set(p.of("Pages"),t),new Ji(n,e)}),b(Qi,"fromMapWithContext",(e,t)=>new Ji(e,t));const hr=class extends V{constructor(e,t,n=!0){super(e,t),b(this,"normalized",!1),b(this,"autoNormalizeCTM"),this.autoNormalizeCTM=n}clone(e){const t=hr.fromMapWithContext(new Map,e||this.context,this.autoNormalizeCTM),n=this.entries();for(let r=0,i=n.length;r<i;r++){const[o,s]=n[r];t.set(o,s)}return t}Parent(){return this.lookupMaybe(p.Parent,V)}Contents(){return this.lookup(p.of("Contents"))}Annots(){return this.lookupMaybe(p.Annots,q)}BleedBox(){return this.lookupMaybe(p.BleedBox,q)}TrimBox(){return this.lookupMaybe(p.TrimBox,q)}ArtBox(){return this.lookupMaybe(p.ArtBox,q)}Resources(){const e=this.getInheritableAttribute(p.Resources);return this.context.lookupMaybe(e,V)}MediaBox(){const e=this.getInheritableAttribute(p.MediaBox);return this.context.lookup(e,q)}CropBox(){const e=this.getInheritableAttribute(p.CropBox);return this.context.lookupMaybe(e,q)}Rotate(){const e=this.getInheritableAttribute(p.Rotate);return this.context.lookupMaybe(e,$)}getInheritableAttribute(e){let t;return this.ascend(n=>{t||(t=n.get(e))}),t}setParent(e){this.set(p.Parent,e)}addContentStream(e){const t=this.normalizedEntries().Contents||this.context.obj([]);this.set(p.Contents,t),t.push(e)}wrapContentStreams(e,t){const n=this.Contents();return n instanceof q?(n.insert(0,e),n.push(t),!0):!1}addAnnot(e){const{Annots:t}=this.normalizedEntries();t.push(e)}removeAnnot(e){const{Annots:t}=this.normalizedEntries(),n=t.indexOf(e);n!==void 0&&t.remove(n)}setFontDictionary(e,t){const{Font:n}=this.normalizedEntries();n.set(e,t)}newFontDictionaryKey(e){const{Font:t}=this.normalizedEntries();return t.uniqueKey(e)}newFontDictionary(e,t){const n=this.newFontDictionaryKey(e);return this.setFontDictionary(n,t),n}setXObject(e,t){const{XObject:n}=this.normalizedEntries();n.set(e,t)}newXObjectKey(e){const{XObject:t}=this.normalizedEntries();return t.uniqueKey(e)}newXObject(e,t){const n=this.newXObjectKey(e);return this.setXObject(n,t),n}setExtGState(e,t){const{ExtGState:n}=this.normalizedEntries();n.set(e,t)}newExtGStateKey(e){const{ExtGState:t}=this.normalizedEntries();return t.uniqueKey(e)}newExtGState(e,t){const n=this.newExtGStateKey(e);return this.setExtGState(n,t),n}ascend(e){e(this);const t=this.Parent();t&&t.ascend(e)}normalize(){if(this.normalized)return;const{context:e}=this,t=this.get(p.Contents);this.context.lookup(t)instanceof at&&this.set(p.Contents,e.obj([t])),this.autoNormalizeCTM&&this.wrapContentStreams(this.context.getPushGraphicsStateContentStream(),this.context.getPopGraphicsStateContentStream());const r=this.getInheritableAttribute(p.Resources),i=e.lookupMaybe(r,V)||e.obj({});this.set(p.Resources,i);const o=i.lookupMaybe(p.Font,V)||e.obj({});i.set(p.Font,o);const s=i.lookupMaybe(p.XObject,V)||e.obj({});i.set(p.XObject,s);const c=i.lookupMaybe(p.ExtGState,V)||e.obj({});i.set(p.ExtGState,c);const l=this.Annots()||e.obj([]);this.set(p.Annots,l),this.normalized=!0}normalizedEntries(){this.normalize();const e=this.Annots(),t=this.Resources(),n=this.Contents();return{Annots:e,Resources:t,Contents:n,Font:t.lookup(p.Font,V),XObject:t.lookup(p.XObject,V),ExtGState:t.lookup(p.ExtGState,V)}}};let He=hr;b(He,"InheritableEntries",["Resources","MediaBox","CropBox","Rotate"]),b(He,"withContextAndParent",(e,t)=>{const n=new Map;return n.set(p.Type,p.Page),n.set(p.Parent,t),n.set(p.Resources,e.obj({})),n.set(p.MediaBox,e.obj([0,0,612,792])),new hr(n,e,!1)}),b(He,"fromMapWithContext",(e,t,n=!0)=>new hr(e,t,n));const eo=class{constructor(e){b(this,"bytes"),b(this,"length"),b(this,"idx",0),b(this,"line",0),b(this,"column",0),this.bytes=e,this.length=this.bytes.length}moveTo(e){this.idx=e}next(){const e=this.bytes[this.idx++];return e===m.Newline?(this.line+=1,this.column=0):this.column+=1,e}assertNext(e){if(this.peek()!==e)throw new nl(this.position(),e,this.peek());return this.next()}peek(){return this.bytes[this.idx]}peekAhead(e){return this.bytes[this.idx+e]}peekAt(e){return this.bytes[e]}done(){return this.idx>=this.length}offset(){return this.idx}slice(e,t){return this.bytes.slice(e,t)}position(){return{line:this.line,column:this.column,offset:this.idx}}};let Lt=eo;b(Lt,"of",e=>new eo(e)),b(Lt,"fromPDFRawStream",e=>eo.of(ya(e).decode()));const ye=new Uint8Array(256);ye[m.Zero]=1,ye[m.One]=1,ye[m.Two]=1,ye[m.Three]=1,ye[m.Four]=1,ye[m.Five]=1,ye[m.Six]=1,ye[m.Seven]=1,ye[m.Eight]=1,ye[m.Nine]=1;const dr=new Uint8Array(256);dr[m.Period]=1,dr[m.Plus]=1,dr[m.Minus]=1;const to=new Uint8Array(256);for(let e=0,t=256;e<t;e++)to[e]=ye[e]||dr[e]?1:0;const{Newline:Oa,CarriageReturn:za}=m;class Tf{constructor(t,n=!1){b(this,"bytes"),b(this,"capNumbers"),this.bytes=t,this.capNumbers=n}parseRawInt(){let t="";for(;!this.bytes.done();){const r=this.bytes.peek();if(!ye[r])break;t+=We(this.bytes.next())}const n=Number(t);if(!t||!isFinite(n))throw new Oo(this.bytes.position(),t);return n}parseRawNumber(){let t="";for(;!this.bytes.done();){const r=this.bytes.peek();if(!to[r]||(t+=We(this.bytes.next()),r===m.Period))break}for(;!this.bytes.done();){const r=this.bytes.peek();if(!ye[r])break;t+=We(this.bytes.next())}const n=Number(t);if(!t||!isFinite(n))throw new Oo(this.bytes.position(),t);if(n>Number.MAX_SAFE_INTEGER)if(this.capNumbers){const r=`Parsed number that is too large for some PDF readers: ${t}, using Number.MAX_SAFE_INTEGER instead.`;return console.warn(r),Number.MAX_SAFE_INTEGER}else{const r=`Parsed number that is too large for some PDF readers: ${t}, not capping.`;console.warn(r)}return n}skipWhitespace(){for(;!this.bytes.done()&&Ze[this.bytes.peek()];)this.bytes.next()}skipLine(){for(;!this.bytes.done();){const t=this.bytes.peek();if(t===Oa||t===za)return;this.bytes.next()}}skipComment(){if(this.bytes.peek()!==m.Percent)return!1;for(;!this.bytes.done();){const t=this.bytes.peek();if(t===Oa||t===za)return!0;this.bytes.next()}return!0}skipWhitespaceAndComments(){for(this.skipWhitespace();this.skipComment();)this.skipWhitespace()}matchKeyword(t){const n=this.bytes.offset();for(let r=0,i=t.length;r<i;r++)if(this.bytes.done()||this.bytes.next()!==t[r])return this.bytes.moveTo(n),!1;return!0}}const jt=class extends V{Parent(){return this.lookup(p.of("Parent"))}Kids(){return this.lookup(p.of("Kids"),q)}Count(){return this.lookup(p.of("Count"),$)}pushTreeNode(e){this.Kids().push(e)}pushLeafNode(e){const t=this.Kids();this.insertLeafKid(t.size(),e)}insertLeafNode(e,t){const n=this.Kids(),r=this.Count().asNumber();if(t>r)throw new Ro(t,r);let i=t;for(let o=0,s=n.size();o<s;o++){if(i===0){this.insertLeafKid(o,e);return}const c=n.get(o),l=this.context.lookup(c);if(l instanceof jt){if(l.Count().asNumber()>i)return l.insertLeafNode(e,i)||c;i-=l.Count().asNumber()}l instanceof He&&(i-=1)}if(i===0){this.insertLeafKid(n.size(),e);return}throw new Io(t,"insertLeafNode")}removeLeafNode(e,t=!0){const n=this.Kids(),r=this.Count().asNumber();if(e>=r)throw new Ro(e,r);let i=e;for(let o=0,s=n.size();o<s;o++){const c=n.get(o),l=this.context.lookup(c);if(l instanceof jt)if(l.Count().asNumber()>i){l.removeLeafNode(i,t),t&&l.Kids().size()===0&&n.remove(o);return}else i-=l.Count().asNumber();if(l instanceof He)if(i===0){this.removeKid(o);return}else i-=1}throw new Io(e,"removeLeafNode")}ascend(e){e(this);const t=this.Parent();t&&t.ascend(e)}traverse(e){const t=this.Kids();for(let n=0,r=t.size();n<r;n++){const i=t.get(n),o=this.context.lookup(i);o instanceof jt&&o.traverse(e),e(o,i)}}insertLeafKid(e,t){const n=this.Kids();this.ascend(r=>{const i=r.Count().asNumber()+1;r.set(p.of("Count"),$.of(i))}),n.insert(e,t)}removeKid(e){const t=this.Kids();t.lookup(e)instanceof He&&this.ascend(r=>{const i=r.Count().asNumber()-1;r.set(p.of("Count"),$.of(i))}),t.remove(e)}};let no=jt;b(no,"withContext",(e,t)=>{const n=new Map;return n.set(p.of("Type"),p.of("Pages")),n.set(p.of("Kids"),e.obj([])),n.set(p.of("Count"),e.obj(0)),t&&n.set(p.of("Parent"),t),new jt(n,e)}),b(no,"fromMapWithContext",(e,t)=>new jt(e,t));const{Space:Ef,CarriageReturn:yn,Newline:_n}=m,wn=[m.s,m.t,m.r,m.e,m.a,m.m],fr=[m.e,m.n,m.d,m.s,m.t,m.r,m.e,m.a,m.m],te={header:[m.Percent,m.P,m.D,m.F,m.Dash],eof:[m.Percent,m.Percent,m.E,m.O,m.F],obj:[m.o,m.b,m.j],endobj:[m.e,m.n,m.d,m.o,m.b,m.j],xref:[m.x,m.r,m.e,m.f],trailer:[m.t,m.r,m.a,m.i,m.l,m.e,m.r],startxref:[m.s,m.t,m.a,m.r,m.t,m.x,m.r,m.e,m.f],true:[m.t,m.r,m.u,m.e],false:[m.f,m.a,m.l,m.s,m.e],null:[m.n,m.u,m.l,m.l],stream:wn,streamEOF1:[...wn,Ef,yn,_n],streamEOF2:[...wn,yn,_n],streamEOF3:[...wn,yn],streamEOF4:[...wn,_n],endstream:fr,EOF1endstream:[yn,_n,...fr],EOF2endstream:[yn,...fr],EOF3endstream:[_n,...fr]},ro=class extends Tf{constructor(e,t,n=!1){super(e,n),b(this,"context"),this.context=t}parseObject(){if(this.skipWhitespaceAndComments(),this.matchKeyword(te.true))return yt.True;if(this.matchKeyword(te.false))return yt.False;if(this.matchKeyword(te.null))return Se;const e=this.bytes.peek();if(e===m.LessThan&&this.bytes.peekAhead(1)===m.LessThan)return this.parseDictOrStream();if(e===m.LessThan)return this.parseHexString();if(e===m.LeftParen)return this.parseString();if(e===m.ForwardSlash)return this.parseName();if(e===m.LeftSquareBracket)return this.parseArray();if(to[e])return this.parseNumberOrRef();throw new rl(this.bytes.position(),e)}parseNumberOrRef(){const e=this.parseRawNumber();this.skipWhitespaceAndComments();const t=this.bytes.offset();if(ye[this.bytes.peek()]){const n=this.parseRawNumber();if(this.skipWhitespaceAndComments(),this.bytes.peek()===m.R)return this.bytes.assertNext(m.R),oe.of(e,n)}return this.bytes.moveTo(t),$.of(e)}parseHexString(){let e="";for(this.bytes.assertNext(m.LessThan);!this.bytes.done()&&this.bytes.peek()!==m.GreaterThan;)e+=We(this.bytes.next());return this.bytes.assertNext(m.GreaterThan),X.of(e)}parseString(){let e=0,t=!1,n="";for(;!this.bytes.done();){const r=this.bytes.next();if(n+=We(r),t||(r===m.LeftParen&&(e+=1),r===m.RightParen&&(e-=1)),r===m.BackSlash?t=!t:t&&(t=!1),e===0)return ee.of(n.substring(1,n.length-1))}throw new sl(this.bytes.position())}parseName(){this.bytes.assertNext(m.ForwardSlash);let e="";for(;!this.bytes.done();){const t=this.bytes.peek();if(Ze[t]||Te[t])break;e+=We(t),this.bytes.next()}return p.of(e)}parseArray(){this.bytes.assertNext(m.LeftSquareBracket),this.skipWhitespaceAndComments();const e=q.withContext(this.context);for(;this.bytes.peek()!==m.RightSquareBracket;){const t=this.parseObject();e.push(t),this.skipWhitespaceAndComments()}return this.bytes.assertNext(m.RightSquareBracket),e}parseDict(){this.bytes.assertNext(m.LessThan),this.bytes.assertNext(m.LessThan),this.skipWhitespaceAndComments();const e=new Map;for(;!this.bytes.done()&&this.bytes.peek()!==m.GreaterThan&&this.bytes.peekAhead(1)!==m.GreaterThan;){const n=this.parseName(),r=this.parseObject();e.set(n,r),this.skipWhitespaceAndComments()}this.skipWhitespaceAndComments(),this.bytes.assertNext(m.GreaterThan),this.bytes.assertNext(m.GreaterThan);const t=e.get(p.of("Type"));return t===p.of("Catalog")?Qi.fromMapWithContext(e,this.context):t===p.of("Pages")?no.fromMapWithContext(e,this.context):t===p.of("Page")?He.fromMapWithContext(e,this.context):V.fromMapWithContext(e,this.context)}parseDictOrStream(){const e=this.bytes.position(),t=this.parseDict();if(this.skipWhitespaceAndComments(),!this.matchKeyword(te.streamEOF1)&&!this.matchKeyword(te.streamEOF2)&&!this.matchKeyword(te.streamEOF3)&&!this.matchKeyword(te.streamEOF4)&&!this.matchKeyword(te.stream))return t;const n=this.bytes.offset();let r;const i=t.get(p.of("Length"));i instanceof $?(r=n+i.asNumber(),this.bytes.moveTo(r),this.skipWhitespaceAndComments(),this.matchKeyword(te.endstream)||(this.bytes.moveTo(n),r=this.findEndOfStreamFallback(e))):r=this.findEndOfStreamFallback(e);const o=this.bytes.slice(n,r);return Ot.of(t,o)}findEndOfStreamFallback(e){let t=1,n=this.bytes.offset();for(;!this.bytes.done()&&(n=this.bytes.offset(),this.matchKeyword(te.stream)?t+=1:this.matchKeyword(te.EOF1endstream)||this.matchKeyword(te.EOF2endstream)||this.matchKeyword(te.EOF3endstream)||this.matchKeyword(te.endstream)?t-=1:this.bytes.next(),t!==0););if(t!==0)throw new ol(e);return n}};let ur=ro;b(ur,"forBytes",(e,t,n)=>new ro(Lt.of(e),t,n)),b(ur,"forByteStream",(e,t,n=!1)=>new ro(e,t,n));const Fa=class extends ur{constructor(e,t){super(Lt.fromPDFRawStream(e),e.dict.context),b(this,"alreadyParsed"),b(this,"shouldWaitForTick"),b(this,"firstOffset"),b(this,"objectCount");const{dict:n}=e;this.alreadyParsed=!1,this.shouldWaitForTick=t||(()=>!1),this.firstOffset=n.lookup(p.of("First"),$).asNumber(),this.objectCount=n.lookup(p.of("N"),$).asNumber()}async parseIntoContext(){if(this.alreadyParsed)throw new Er("PDFObjectStreamParser","parseIntoContext");this.alreadyParsed=!0;const e=this.parseOffsetsAndObjectNumbers();for(let t=0,n=e.length;t<n;t++){const{objectNumber:r,offset:i}=e[t];this.bytes.moveTo(this.firstOffset+i);const o=this.parseObject(),s=oe.of(r,0);this.context.assign(s,o),this.shouldWaitForTick()&&await vt()}}parseOffsetsAndObjectNumbers(){const e=[];for(let t=0,n=this.objectCount;t<n;t++){this.skipWhitespaceAndComments();const r=this.parseRawInt();this.skipWhitespaceAndComments();const i=this.parseRawInt();e.push({objectNumber:r,offset:i})}return e}};let Na=Fa;b(Na,"forStream",(e,t)=>new Fa(e,t));const Ma=class{constructor(e){b(this,"alreadyParsed"),b(this,"dict"),b(this,"context"),b(this,"bytes"),b(this,"subsections"),b(this,"byteWidths"),this.alreadyParsed=!1,this.dict=e.dict,this.bytes=Lt.fromPDFRawStream(e),this.context=this.dict.context;const t=this.dict.lookup(p.of("Size"),$),n=this.dict.lookup(p.of("Index"));if(n instanceof q){this.subsections=[];for(let i=0,o=n.size();i<o;i+=2){const s=n.lookup(i+0,$).asNumber(),c=n.lookup(i+1,$).asNumber();this.subsections.push({firstObjectNumber:s,length:c})}}else this.subsections=[{firstObjectNumber:0,length:t.asNumber()}];const r=this.dict.lookup(p.of("W"),q);this.byteWidths=[-1,-1,-1];for(let i=0,o=r.size();i<o;i++)this.byteWidths[i]=r.lookup(i,$).asNumber()}parseIntoContext(){if(this.alreadyParsed)throw new Er("PDFXRefStreamParser","parseIntoContext");return this.alreadyParsed=!0,this.context.trailerInfo={Root:this.dict.get(p.of("Root")),Encrypt:this.dict.get(p.of("Encrypt")),Info:this.dict.get(p.of("Info")),ID:this.dict.get(p.of("ID"))},this.parseEntries()}parseEntries(){const e=[],[t,n,r]=this.byteWidths;for(let i=0,o=this.subsections.length;i<o;i++){const{firstObjectNumber:s,length:c}=this.subsections[i];for(let l=0;l<c;l++){let a=0;for(let y=0,w=t;y<w;y++)a=a<<8|this.bytes.next();let h=0;for(let y=0,w=n;y<w;y++)h=h<<8|this.bytes.next();let f=0;for(let y=0,w=r;y<w;y++)f=f<<8|this.bytes.next();t===0&&(a=1);const u=s+l,d={ref:oe.of(u,f),offset:h,deleted:a===0,inObjectStream:a===2};e.push(d)}}return e}};let La=Ma;b(La,"forStream",e=>new Ma(e));const ja=class extends ur{constructor(e,t=1/0,n=!1,r=!1){super(Lt.of(e),yi.create(),r),b(this,"objectsPerTick"),b(this,"throwOnInvalidObject"),b(this,"alreadyParsed",!1),b(this,"parsedObjects",0),b(this,"shouldWaitForTick",()=>(this.parsedObjects+=1,this.parsedObjects%this.objectsPerTick===0)),this.objectsPerTick=t,this.throwOnInvalidObject=n}async parseDocument(){if(this.alreadyParsed)throw new Er("PDFParser","parseDocument");this.alreadyParsed=!0,this.context.header=this.parseHeader();let e;for(;!this.bytes.done();){await this.parseDocumentSection();const t=this.bytes.offset();if(t===e)throw new al(this.bytes.position());e=t}return this.maybeRecoverRoot(),this.context.lookup(oe.of(0))&&(console.warn("Removing parsed object: 0 0 R"),this.context.delete(oe.of(0))),this.context}maybeRecoverRoot(){const e=n=>n instanceof V&&n.lookup(p.of("Type"))===p.of("Catalog"),t=this.context.lookup(this.context.trailerInfo.Root);if(!e(t)){const n=this.context.enumerateIndirectObjects();for(let r=0,i=n.length;r<i;r++){const[o,s]=n[r];e(s)&&(this.context.trailerInfo.Root=o)}}}parseHeader(){for(;!this.bytes.done();){if(this.matchKeyword(te.header)){const e=this.parseRawInt();this.bytes.assertNext(m.Period);const t=this.parseRawInt(),n=pn.forVersion(e,t);return this.skipBinaryHeaderComment(),n}this.bytes.next()}throw new cl(this.bytes.position())}parseIndirectObjectHeader(){this.skipWhitespaceAndComments();const e=this.parseRawInt();this.skipWhitespaceAndComments();const t=this.parseRawInt();if(this.skipWhitespaceAndComments(),!this.matchKeyword(te.obj))throw new ll(this.bytes.position(),te.obj);return oe.of(e,t)}matchIndirectObjectHeader(){const e=this.bytes.offset();try{return this.parseIndirectObjectHeader(),!0}catch{return this.bytes.moveTo(e),!1}}async parseIndirectObject(){const e=this.parseIndirectObjectHeader();this.skipWhitespaceAndComments();const t=this.parseObject();return this.skipWhitespaceAndComments(),this.matchKeyword(te.endobj),t instanceof Ot&&t.dict.lookup(p.of("Type"))===p.of("ObjStm")?await Na.forStream(t,this.shouldWaitForTick).parseIntoContext():t instanceof Ot&&t.dict.lookup(p.of("Type"))===p.of("XRef")?La.forStream(t).parseIntoContext():this.context.assign(e,t),e}tryToParseInvalidIndirectObject(){const e=this.bytes.position(),t=`Trying to parse invalid object: ${JSON.stringify(e)})`;if(this.throwOnInvalidObject)throw new Error(t);console.warn(t);const n=this.parseIndirectObjectHeader();console.warn(`Invalid object ref: ${n}`),this.skipWhitespaceAndComments();const r=this.bytes.offset();let i=!0;for(;!this.bytes.done()&&(this.matchKeyword(te.endobj)&&(i=!1),!!i);)this.bytes.next();if(i)throw new il(e);const o=this.bytes.offset()-te.endobj.length,s=Ai.of(this.bytes.slice(r,o));return this.context.assign(n,s),n}async parseIndirectObjects(){for(this.skipWhitespaceAndComments();!this.bytes.done()&&ye[this.bytes.peek()];){const e=this.bytes.offset();try{await this.parseIndirectObject()}catch{this.bytes.moveTo(e),this.tryToParseInvalidIndirectObject()}this.skipWhitespaceAndComments(),this.skipJibberish(),this.shouldWaitForTick()&&await vt()}}maybeParseCrossRefSection(){if(this.skipWhitespaceAndComments(),!this.matchKeyword(te.xref))return;this.skipWhitespaceAndComments();let e=-1;const t=Yn.createEmpty();for(;!this.bytes.done()&&ye[this.bytes.peek()];){const n=this.parseRawInt();this.skipWhitespaceAndComments();const r=this.parseRawInt();this.skipWhitespaceAndComments();const i=this.bytes.peek();if(i===m.n||i===m.f){const o=oe.of(e,r);this.bytes.next()===m.n?t.addEntry(o,n):t.addDeletedEntry(o,n),e+=1}else e=n;this.skipWhitespaceAndComments()}return t}maybeParseTrailerDict(){if(this.skipWhitespaceAndComments(),!this.matchKeyword(te.trailer))return;this.skipWhitespaceAndComments();const e=this.parseDict(),{context:t}=this;t.trailerInfo={Root:e.get(p.of("Root"))||t.trailerInfo.Root,Encrypt:e.get(p.of("Encrypt"))||t.trailerInfo.Encrypt,Info:e.get(p.of("Info"))||t.trailerInfo.Info,ID:e.get(p.of("ID"))||t.trailerInfo.ID}}maybeParseTrailer(){if(this.skipWhitespaceAndComments(),!this.matchKeyword(te.startxref))return;this.skipWhitespaceAndComments();const e=this.parseRawInt();return this.skipWhitespace(),this.matchKeyword(te.eof),this.skipWhitespaceAndComments(),this.matchKeyword(te.eof),this.skipWhitespaceAndComments(),Jn.forLastCrossRefSectionOffset(e)}async parseDocumentSection(){await this.parseIndirectObjects(),this.maybeParseCrossRefSection(),this.maybeParseTrailerDict(),this.maybeParseTrailer(),this.skipJibberish()}skipJibberish(){for(this.skipWhitespaceAndComments();!this.bytes.done();){const e=this.bytes.offset(),t=this.bytes.peek();if(t>=m.Space&&t<=m.Tilde&&(this.matchKeyword(te.xref)||this.matchKeyword(te.trailer)||this.matchKeyword(te.startxref)||this.matchIndirectObjectHeader())){this.bytes.moveTo(e);break}this.bytes.next()}}skipBinaryHeaderComment(){this.skipWhitespaceAndComments();try{const e=this.bytes.offset();this.parseIndirectObjectHeader(),this.bytes.moveTo(e)}catch{this.bytes.next(),this.skipWhitespaceAndComments()}}};let Ua=ja;b(Ua,"forBytesWithOptions",(e,t,n,r)=>new ja(e,t,n,r));const $a=e=>e instanceof p?e:p.of(e),W=e=>e instanceof $?e:$.of(e),ve=e=>e instanceof $?e.asNumber():e;var Ha=(e=>(e.Degrees="degrees",e.Radians="radians",e))(Ha||{});const Be=e=>(D(e,"degreeAngle",["number"]),{type:"degrees",angle:e}),{Radians:Ga,Degrees:Va}=Ha,Pf=e=>e*Math.PI/180,Rf=e=>e*180/Math.PI,Fe=e=>e.type===Ga?e.angle:e.type===Va?Pf(e.angle):In(`Invalid rotation: ${JSON.stringify(e)}`),If=e=>e.type===Ga?Rf(e.angle):e.type===Va?e.angle:In(`Invalid rotation: ${JSON.stringify(e)}`),{cos:Wa,sin:Ka,tan:Za}=Math,gr=(e,t,n,r,i,o)=>re.of(se.ConcatTransformationMatrix,[W(e),W(t),W(n),W(r),W(i),W(o)]),Ut=(e,t)=>gr(1,0,0,1,e,t),xn=(e,t)=>gr(e,0,0,t,0,0),Sn=e=>gr(Wa(ve(e)),Ka(ve(e)),-Ka(ve(e)),Wa(ve(e)),0,0),io=(e,t)=>gr(1,Za(ve(e)),Za(ve(t)),1,0,0),pr=(e,t)=>re.of(se.SetLineDashPattern,[`[${e.map(W).join(" ")}]`,W(t)]);var vn=(e=>(e[e.Butt=0]="Butt",e[e.Round=1]="Round",e[e.Projecting=2]="Projecting",e))(vn||{});const br=e=>re.of(se.SetLineCapStyle,[W(e)]),$t=e=>re.of(se.SetGraphicsStateParams,[$a(e)]),Je=()=>re.of(se.PushGraphicsState),Qe=()=>re.of(se.PopGraphicsState),mr=e=>re.of(se.SetLineWidth,[W(e)]),De=(e,t,n,r,i,o)=>re.of(se.AppendBezierCurve,[W(e),W(t),W(n),W(r),W(i),W(o)]),yr=(e,t,n,r)=>re.of(se.CurveToReplicateInitialPoint,[W(e),W(t),W(n),W(r)]),Ht=()=>re.of(se.ClosePath),_t=(e,t)=>re.of(se.MoveTo,[W(e),W(t)]),Ge=(e,t)=>re.of(se.LineTo,[W(e),W(t)]),_r=()=>re.of(se.StrokePath),oo=()=>re.of(se.FillNonZero),so=()=>re.of(se.FillNonZeroAndStroke),qa=e=>re.of(se.DrawObject,[$a(e)]),Of=e=>re.of(se.NonStrokingColorGray,[W(e)]),zf=e=>re.of(se.StrokingColorGray,[W(e)]),Ff=(e,t,n)=>re.of(se.NonStrokingColorRgb,[W(e),W(t),W(n)]),Nf=(e,t,n)=>re.of(se.StrokingColorRgb,[W(e),W(t),W(n)]),Mf=(e,t,n,r)=>re.of(se.NonStrokingColorCmyk,[W(e),W(t),W(n),W(r)]),Lf=(e,t,n,r)=>re.of(se.StrokingColorCmyk,[W(e),W(t),W(n),W(r)]);var Xa=(e=>(e.Grayscale="Grayscale",e.RGB="RGB",e.CMYK="CMYK",e))(Xa||{});const kn=(e,t,n)=>(et(e,"red",0,1),et(t,"green",0,1),et(n,"blue",0,1),{type:"RGB",red:e,green:t,blue:n}),{Grayscale:Ya,RGB:Ja,CMYK:Qa}=Xa,ao=e=>e.type===Ya?Of(e.gray):e.type===Ja?Ff(e.red,e.green,e.blue):e.type===Qa?Mf(e.cyan,e.magenta,e.yellow,e.key):In(`Invalid color: ${JSON.stringify(e)}`),wr=e=>e.type===Ya?zf(e.gray):e.type===Ja?Nf(e.red,e.green,e.blue):e.type===Qa?Lf(e.cyan,e.magenta,e.yellow,e.key):In(`Invalid color: ${JSON.stringify(e)}`);class jf extends Error{constructor(){const t="Input document to `PDFDocument.load` is encrypted. You can use `PDFDocument.load(..., { ignoreEncryption: true })` if you wish to load the document anyways.";super(t)}}class Uf extends Error{constructor(){const t="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.";super(t)}}class $f extends Error{constructor(){const t="PDFDocument has no pages so `PDFDocument.removePage` cannot be called";super(t)}}let M=0,L=0,K=0,Z=0,An=0,Cn=0;const ec=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]]),Hf=e=>{let t;const n=[];let r=[],i="",o=!1,s=0;for(const c of e)if(ec.has(c))s=ec.get(c),t&&(i.length>0&&(r[r.length]=+i),n[n.length]={cmd:t,args:r},r=[],i="",o=!1),t=c;else if([" ",","].includes(c)||c==="-"&&i.length>0&&i[i.length-1]!=="e"||c==="."&&o){if(i.length===0)continue;r.length===s?(n[n.length]={cmd:t,args:r},r=[+i],t==="M"&&(t="L"),t==="m"&&(t="l")):r[r.length]=+i,o=c===".",i=["-","."].includes(c)?c:""}else i+=c,c==="."&&(o=!0);return i.length>0&&(r.length===s?(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},Gf=e=>{M=L=K=Z=An=Cn=0;let t=[];for(let n=0;n<e.length;n++){const r=e[n];if(r.cmd&&typeof tc[r.cmd]=="function"){const i=tc[r.cmd](r.args);Array.isArray(i)?t=t.concat(i):t.push(i)}}return t},tc={M(e){return M=e[0],L=e[1],K=Z=null,An=M,Cn=L,_t(M,L)},m(e){return M+=e[0],L+=e[1],K=Z=null,An=M,Cn=L,_t(M,L)},C(e){return M=e[4],L=e[5],K=e[2],Z=e[3],De(e[0],e[1],e[2],e[3],e[4],e[5])},c(e){const t=De(e[0]+M,e[1]+L,e[2]+M,e[3]+L,e[4]+M,e[5]+L);return K=M+e[2],Z=L+e[3],M+=e[4],L+=e[5],t},S(e){(K===null||Z===null)&&(K=M,Z=L);const t=De(M-(K-M),L-(Z-L),e[0],e[1],e[2],e[3]);return K=e[0],Z=e[1],M=e[2],L=e[3],t},s(e){(K===null||Z===null)&&(K=M,Z=L);const t=De(M-(K-M),L-(Z-L),M+e[0],L+e[1],M+e[2],L+e[3]);return K=M+e[0],Z=L+e[1],M+=e[2],L+=e[3],t},Q(e){return K=e[0],Z=e[1],M=e[2],L=e[3],yr(e[0],e[1],M,L)},q(e){const t=yr(e[0]+M,e[1]+L,e[2]+M,e[3]+L);return K=M+e[0],Z=L+e[1],M+=e[2],L+=e[3],t},T(e){K===null||Z===null?(K=M,Z=L):(K=M-(K-M),Z=L-(Z-L));const t=yr(K,Z,e[0],e[1]);return K=M-(K-M),Z=L-(Z-L),M=e[0],L=e[1],t},t(e){K===null||Z===null?(K=M,Z=L):(K=M-(K-M),Z=L-(Z-L));const t=yr(K,Z,M+e[0],L+e[1]);return M+=e[0],L+=e[1],t},A(e){const t=nc(M,L,e);return M=e[5],L=e[6],t},a(e){e[5]+=M,e[6]+=L;const t=nc(M,L,e);return M=e[5],L=e[6],t},L(e){return M=e[0],L=e[1],K=Z=null,Ge(M,L)},l(e){return M+=e[0],L+=e[1],K=Z=null,Ge(M,L)},H(e){return M=e[0],K=Z=null,Ge(M,L)},h(e){return M+=e[0],K=Z=null,Ge(M,L)},V(e){return L=e[0],K=Z=null,Ge(M,L)},v(e){return L+=e[0],K=Z=null,Ge(M,L)},Z(){const e=Ht();return M=An,L=Cn,e},z(){const e=Ht();return M=An,L=Cn,e}},nc=(e,t,n)=>{const[r,i,o,s,c,l,a]=n,h=Vf(l,a,r,i,s,c,o,e,t),f=[];for(const u of h){const d=Wf(...u);f.push(De(...d))}return f},Vf=(e,t,n,r,i,o,s,c,l)=>{const a=s*(Math.PI/180),h=Math.sin(a),f=Math.cos(a);n=Math.abs(n),r=Math.abs(r),K=f*(c-e)*.5+h*(l-t)*.5,Z=f*(l-t)*.5-h*(c-e)*.5;let u=K*K/(n*n)+Z*Z/(r*r);u>1&&(u=Math.sqrt(u),n*=u,r*=u);const d=f/n,y=h/n,w=-h/r,x=f/r,_=d*c+y*l,E=w*c+x*l,v=d*e+y*t,S=w*e+x*t;let C=1/((v-_)*(v-_)+(S-E)*(S-E))-.25;C<0&&(C=0);let k=Math.sqrt(C);o===i&&(k=-k);const F=.5*(_+v)-k*(S-E),I=.5*(E+S)+k*(v-_),T=Math.atan2(E-I,_-F);let J=Math.atan2(S-I,v-F)-T;J<0&&o===1?J+=2*Math.PI:J>0&&o===0&&(J-=2*Math.PI);const N=Math.ceil(Math.abs(J/(Math.PI*.5+.001))),O=[];for(let P=0;P<N;P++){const B=T+P*J/N,U=T+(P+1)*J/N;O[P]=[F,I,B,U,n,r,h,f]}return O},Wf=(e,t,n,r,i,o,s,c)=>{const l=c*i,a=-s*o,h=s*i,f=c*o,u=.5*(r-n),d=8/3*Math.sin(u*.5)*Math.sin(u*.5)/Math.sin(u),y=e+Math.cos(n)-d*Math.sin(n),w=t+Math.sin(n)+d*Math.cos(n),x=e+Math.cos(r),_=t+Math.sin(r),E=x+d*Math.sin(r),v=_-d*Math.cos(r);return[l*y+a*w,h*y+f*w,l*E+a*v,h*E+f*v,l*x+a*_,h*x+f*_]},Kf=e=>Gf(Hf(e)),Zf=(e,t)=>[Je(),t.graphicsState&&$t(t.graphicsState),Ut(t.x,t.y),Sn(Fe(t.rotate)),xn(t.width,t.height),io(Fe(t.xSkew),Fe(t.ySkew)),qa(e),Qe()].filter(Boolean),qf=(e,t)=>[Je(),t.graphicsState&&$t(t.graphicsState),Ut(t.x,t.y),Sn(Fe(t.rotate)),xn(t.xScale,t.yScale),io(Fe(t.xSkew),Fe(t.ySkew)),qa(e),Qe()].filter(Boolean),Xf=e=>{var t,n;return[Je(),e.graphicsState&&$t(e.graphicsState),e.color&&wr(e.color),mr(e.thickness),pr((t=e.dashArray)!=null?t:[],(n=e.dashPhase)!=null?n:0),_t(e.start.x,e.start.y),e.lineCap&&br(e.lineCap),_t(e.start.x,e.start.y),Ge(e.end.x,e.end.y),_r(),Qe()].filter(Boolean)},Yf=e=>{var t,n;return[Je(),e.graphicsState&&$t(e.graphicsState),e.color&&ao(e.color),e.borderColor&&wr(e.borderColor),mr(e.borderWidth),e.borderLineCap&&br(e.borderLineCap),pr((t=e.borderDashArray)!=null?t:[],(n=e.borderDashPhase)!=null?n:0),Ut(e.x,e.y),Sn(Fe(e.rotate)),io(Fe(e.xSkew),Fe(e.ySkew)),_t(0,0),Ge(0,e.height),Ge(e.width,e.height),Ge(e.width,0),Ht(),e.color&&e.borderWidth?so():e.color?oo():e.borderColor?_r():Ht(),Qe()].filter(Boolean)},xr=4*((Math.sqrt(2)-1)/3),Jf=e=>{let t=ve(e.x),n=ve(e.y);const r=ve(e.xScale),i=ve(e.yScale);t-=r,n-=i;const o=r*xr,s=i*xr,c=t+r*2,l=n+i*2,a=t+r,h=n+i;return[Je(),_t(t,h),De(t,h-s,a-o,n,a,n),De(a+o,n,c,h-s,c,h),De(c,h+s,a+o,l,a,l),De(a-o,l,t,h+s,t,h),Qe()]},Qf=e=>{const t=ve(e.x),n=ve(e.y),r=ve(e.xScale),i=ve(e.yScale),o=-r,s=-i,c=r*xr,l=i*xr,a=o+r*2,h=s+i*2,f=o+r,u=s+i;return[Ut(t,n),Sn(Fe(e.rotate)),_t(o,u),De(o,u-l,f-c,s,f,s),De(f+c,s,a,u-l,a,u),De(a,u+l,f+c,h,f,h),De(f-c,h,o,u+l,o,u)]},eu=e=>{var t,n,r;return[Je(),e.graphicsState&&$t(e.graphicsState),e.color&&ao(e.color),e.borderColor&&wr(e.borderColor),mr(e.borderWidth),e.borderLineCap&&br(e.borderLineCap),pr((t=e.borderDashArray)!=null?t:[],(n=e.borderDashPhase)!=null?n:0),...e.rotate===void 0?Jf({x:e.x,y:e.y,xScale:e.xScale,yScale:e.yScale}):Qf({x:e.x,y:e.y,xScale:e.xScale,yScale:e.yScale,rotate:(r=e.rotate)!=null?r:Be(0)}),e.color&&e.borderWidth?so():e.color?oo():e.borderColor?_r():Ht(),Qe()].filter(Boolean)},tu=(e,t)=>{var n,r,i;return[Je(),t.graphicsState&&$t(t.graphicsState),Ut(t.x,t.y),Sn(Fe((n=t.rotate)!=null?n:Be(0))),t.scale?xn(t.scale,-t.scale):xn(1,-1),t.color&&ao(t.color),t.borderColor&&wr(t.borderColor),t.borderWidth&&mr(t.borderWidth),t.borderLineCap&&br(t.borderLineCap),pr((r=t.borderDashArray)!=null?r:[],(i=t.borderDashPhase)!=null?i:0),...Kf(e),t.color&&t.borderWidth?so():t.color?oo():t.borderColor?_r():Ht(),Qe()].filter(Boolean)},nu={"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]};var wt=(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",e))(wt||{});const rc=class{constructor(e,t,n){b(this,"ref"),b(this,"doc"),b(this,"width"),b(this,"height"),b(this,"alreadyEmbedded",!1),b(this,"embedder"),D(e,"ref",[[oe,"PDFRef"]]),D(t,"doc",[[ct,"PDFDocument"]]),D(n,"embedder",[[vi,"PDFPageEmbedder"]]),this.ref=e,this.doc=t,this.width=n.width,this.height=n.height,this.embedder=n}scale(e){return D(e,"factor",["number"]),{width:this.width*e,height:this.height*e}}size(){return this.scale(1)}async embed(){this.alreadyEmbedded||(await this.embedder.embedIntoContext(this.doc.context,this.ref),this.alreadyEmbedded=!0)}};let ic=rc;b(ic,"of",(e,t,n)=>new rc(e,t,n));const oc=class{constructor(e,t,n){b(this,"ref"),b(this,"doc"),b(this,"name"),b(this,"modified",!0),b(this,"embedder"),D(e,"ref",[[oe,"PDFRef"]]),D(t,"doc",[[ct,"PDFDocument"]]),this.ref=e,this.doc=t,this.name=n.fontName,this.embedder=n}encodeText(e){return D(e,"text",["string"]),this.modified=!0,this.embedder.encodeText(e)}widthOfTextAtSize(e,t){return D(e,"text",["string"]),D(t,"size",["number"]),this.embedder.widthOfTextAtSize(e,t)}heightAtSize(e,t){var n;return D(e,"size",["number"]),j(t?.descender,"options.descender",["boolean"]),this.embedder.heightOfFontAtSize(e,{descender:(n=t?.descender)!=null?n:!0})}sizeAtHeight(e){return D(e,"height",["number"]),this.embedder.sizeOfFontAtHeight(e)}getCharacterSet(){return this.embedder.font.characterSet}async embed(){this.modified&&(await this.embedder.embedIntoContext(this.doc.context,this.ref),this.modified=!1)}};let sc=oc;b(sc,"of",(e,t,n)=>new oc(e,t,n));const ac=class{constructor(e,t,n){b(this,"ref"),b(this,"doc"),b(this,"width"),b(this,"height"),b(this,"embedder"),b(this,"embedTask"),D(e,"ref",[[oe,"PDFRef"]]),D(t,"doc",[[ct,"PDFDocument"]]),D(n,"embedder",[[Bi,"JpegEmbedder"],[Di,"PngEmbedder"]]),this.ref=e,this.doc=t,this.width=n.width,this.height=n.height,this.embedder=n}scale(e){return D(e,"factor",["number"]),{width:this.width*e,height:this.height*e}}scaleToFit(e,t){D(e,"width",["number"]),D(t,"height",["number"]);const n=e/this.width,r=t/this.height,i=Math.min(n,r);return this.scale(i)}size(){return this.scale(1)}async embed(){if(!!this.embedder){if(!this.embedTask){const{doc:e,ref:t}=this;this.embedTask=this.embedder.embedIntoContext(e.context,t)}await this.embedTask,this.embedder=void 0}}};let cc=ac;b(cc,"of",(e,t,n)=>new ac(e,t,n));const co=class{constructor(e,t,n){b(this,"node"),b(this,"ref"),b(this,"doc"),b(this,"fontKey"),b(this,"font"),b(this,"fontSize",24),b(this,"fontColor",kn(0,0,0)),b(this,"lineHeight",24),b(this,"x",0),b(this,"y",0),b(this,"contentStream"),b(this,"contentStreamRef"),D(e,"leafNode",[[He,"PDFPageLeaf"]]),D(t,"ref",[[oe,"PDFRef"]]),D(n,"doc",[[ct,"PDFDocument"]]),this.node=e,this.ref=t,this.doc=n}setRotation(e){const t=If(e);Kc(t,"degreesAngle",90),this.node.set(p.of("Rotate"),this.doc.context.obj(t))}getRotation(){const e=this.node.Rotate();return Be(e?e.asNumber():0)}setSize(e,t){D(e,"width",["number"]),D(t,"height",["number"]);const n=this.getMediaBox();this.setMediaBox(n.x,n.y,e,t);const r=this.getCropBox(),i=this.getBleedBox(),o=this.getTrimBox(),s=this.getArtBox(),c=this.node.CropBox(),l=this.node.BleedBox(),a=this.node.TrimBox(),h=this.node.ArtBox();c&&zn(r,n)&&this.setCropBox(n.x,n.y,e,t),l&&zn(i,n)&&this.setBleedBox(n.x,n.y,e,t),a&&zn(o,n)&&this.setTrimBox(n.x,n.y,e,t),h&&zn(s,n)&&this.setArtBox(n.x,n.y,e,t)}setWidth(e){D(e,"width",["number"]),this.setSize(e,this.getSize().height)}setHeight(e){D(e,"height",["number"]),this.setSize(this.getSize().width,e)}setMediaBox(e,t,n,r){D(e,"x",["number"]),D(t,"y",["number"]),D(n,"width",["number"]),D(r,"height",["number"]);const i=this.doc.context.obj([e,t,e+n,t+r]);this.node.set(p.MediaBox,i)}setCropBox(e,t,n,r){D(e,"x",["number"]),D(t,"y",["number"]),D(n,"width",["number"]),D(r,"height",["number"]);const i=this.doc.context.obj([e,t,e+n,t+r]);this.node.set(p.CropBox,i)}setBleedBox(e,t,n,r){D(e,"x",["number"]),D(t,"y",["number"]),D(n,"width",["number"]),D(r,"height",["number"]);const i=this.doc.context.obj([e,t,e+n,t+r]);this.node.set(p.BleedBox,i)}setTrimBox(e,t,n,r){D(e,"x",["number"]),D(t,"y",["number"]),D(n,"width",["number"]),D(r,"height",["number"]);const i=this.doc.context.obj([e,t,e+n,t+r]);this.node.set(p.TrimBox,i)}setArtBox(e,t,n,r){D(e,"x",["number"]),D(t,"y",["number"]),D(n,"width",["number"]),D(r,"height",["number"]);const i=this.doc.context.obj([e,t,e+n,t+r]);this.node.set(p.ArtBox,i)}getSize(){const{width:e,height:t}=this.getMediaBox();return{width:e,height:t}}getWidth(){return this.getSize().width}getHeight(){return this.getSize().height}getMediaBox(){return this.node.MediaBox().asRectangle()}getCropBox(){var e;const t=this.node.CropBox();return(e=t?.asRectangle())!=null?e:this.getMediaBox()}getBleedBox(){var e;const t=this.node.BleedBox();return(e=t?.asRectangle())!=null?e:this.getCropBox()}getTrimBox(){var e;const t=this.node.TrimBox();return(e=t?.asRectangle())!=null?e:this.getCropBox()}getArtBox(){var e;const t=this.node.ArtBox();return(e=t?.asRectangle())!=null?e:this.getCropBox()}translateContent(e,t){D(e,"x",["number"]),D(t,"y",["number"]),this.node.normalize(),this.getContentStream();const n=this.createContentStream(Je(),Ut(e,t)),r=this.doc.context.register(n),i=this.createContentStream(Qe()),o=this.doc.context.register(i);this.node.wrapContentStreams(r,o)}scale(e,t){D(e,"x",["number"]),D(t,"y",["number"]),this.setSize(this.getWidth()*e,this.getHeight()*t),this.scaleContent(e,t),this.scaleAnnotations(e,t)}scaleContent(e,t){D(e,"x",["number"]),D(t,"y",["number"]),this.node.normalize(),this.getContentStream();const n=this.createContentStream(Je(),xn(e,t)),r=this.doc.context.register(n),i=this.createContentStream(Qe()),o=this.doc.context.register(i);this.node.wrapContentStreams(r,o)}scaleAnnotations(e,t){D(e,"x",["number"]),D(t,"y",["number"]);const n=this.node.Annots();if(!!n)for(let r=0;r<n.size();r++){const i=n.lookup(r);i instanceof V&&this.scaleAnnot(i,e,t)}}resetPosition(){this.getContentStream(!1),this.x=0,this.y=0}setFont(e){D(e,"font",[[sc,"PDFFont"]]),this.font=e,this.fontKey=this.node.newFontDictionary(this.font.name,this.font.ref)}setFontSize(e){D(e,"fontSize",["number"]),this.fontSize=e}setFontColor(e){D(e,"fontColor",[[Object,"Color"]]),this.fontColor=e}setLineHeight(e){D(e,"lineHeight",["number"]),this.lineHeight=e}getPosition(){return{x:this.x,y:this.y}}getX(){return this.x}getY(){return this.y}moveTo(e,t){D(e,"x",["number"]),D(t,"y",["number"]),this.x=e,this.y=t}moveDown(e){D(e,"yDecrease",["number"]),this.y-=e}moveUp(e){D(e,"yIncrease",["number"]),this.y+=e}moveLeft(e){D(e,"xDecrease",["number"]),this.x-=e}moveRight(e){D(e,"xIncrease",["number"]),this.x+=e}pushOperators(...e){Eo(e,"operator",[[re,"PDFOperator"]]),this.getContentStream().push(...e)}drawImage(e,t={}){var n,r,i,o,s,c,l;D(e,"image",[[cc,"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"]]),Ke(t.opacity,"opacity.opacity",0,1),Ne(t.blendMode,"options.blendMode",wt);const a=this.node.newXObject("Image",e.ref),h=this.maybeEmbedGraphicsState({opacity:t.opacity,blendMode:t.blendMode});this.getContentStream().push(...Zf(a,{x:(n=t.x)!=null?n:this.x,y:(r=t.y)!=null?r:this.y,width:(i=t.width)!=null?i:e.size().width,height:(o=t.height)!=null?o:e.size().height,rotate:(s=t.rotate)!=null?s:Be(0),xSkew:(c=t.xSkew)!=null?c:Be(0),ySkew:(l=t.ySkew)!=null?l:Be(0),graphicsState:h}))}drawPage(e,t={}){var n,r,i,o,s;D(e,"embeddedPage",[[ic,"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"]]),Ke(t.opacity,"opacity.opacity",0,1),Ne(t.blendMode,"options.blendMode",wt);const c=this.node.newXObject("EmbeddedPdfPage",e.ref),l=this.maybeEmbedGraphicsState({opacity:t.opacity,blendMode:t.blendMode}),a=t.width!==void 0?t.width/e.width:t.xScale!==void 0?t.xScale:1,h=t.height!==void 0?t.height/e.height:t.yScale!==void 0?t.yScale:1;this.getContentStream().push(...qf(c,{x:(n=t.x)!=null?n:this.x,y:(r=t.y)!=null?r:this.y,xScale:a,yScale:h,rotate:(i=t.rotate)!=null?i:Be(0),xSkew:(o=t.xSkew)!=null?o:Be(0),ySkew:(s=t.ySkew)!=null?s:Be(0),graphicsState:l}))}drawSvgPath(e,t={}){var n,r,i,o,s,c,l,a,h;D(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"]]),Ke(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"]),Ne(t.borderLineCap,"options.borderLineCap",vn),Ke(t.borderOpacity,"options.borderOpacity",0,1),Ne(t.blendMode,"options.blendMode",wt);const f=this.maybeEmbedGraphicsState({opacity:t.opacity,borderOpacity:t.borderOpacity,blendMode:t.blendMode});!("color"in t)&&!("borderColor"in t)&&(t.borderColor=kn(0,0,0)),this.getContentStream().push(...tu(e,{x:(n=t.x)!=null?n:this.x,y:(r=t.y)!=null?r:this.y,scale:t.scale,rotate:(i=t.rotate)!=null?i:Be(0),color:(o=t.color)!=null?o:void 0,borderColor:(s=t.borderColor)!=null?s:void 0,borderWidth:(c=t.borderWidth)!=null?c:0,borderDashArray:(l=t.borderDashArray)!=null?l:void 0,borderDashPhase:(a=t.borderDashPhase)!=null?a:void 0,borderLineCap:(h=t.borderLineCap)!=null?h:void 0,graphicsState:f}))}drawLine(e){var t,n,r,i,o;D(e.start,"options.start",[[Object,"{ x: number, y: number }"]]),D(e.end,"options.end",[[Object,"{ x: number, y: number }"]]),D(e.start.x,"options.start.x",["number"]),D(e.start.y,"options.start.y",["number"]),D(e.end.x,"options.end.x",["number"]),D(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"]),Ne(e.lineCap,"options.lineCap",vn),Ke(e.opacity,"opacity.opacity",0,1),Ne(e.blendMode,"options.blendMode",wt);const s=this.maybeEmbedGraphicsState({borderOpacity:e.opacity,blendMode:e.blendMode});"color"in e||(e.color=kn(0,0,0)),this.getContentStream().push(...Xf({start:e.start,end:e.end,thickness:(t=e.thickness)!=null?t:1,color:(n=e.color)!=null?n:void 0,dashArray:(r=e.dashArray)!=null?r:void 0,dashPhase:(i=e.dashPhase)!=null?i:void 0,lineCap:(o=e.lineCap)!=null?o:void 0,graphicsState:s}))}drawRectangle(e={}){var t,n,r,i,o,s,c,l,a,h,f,u,d;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"]]),Ke(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"]),Ne(e.borderLineCap,"options.borderLineCap",vn),Ke(e.borderOpacity,"options.borderOpacity",0,1),Ne(e.blendMode,"options.blendMode",wt);const y=this.maybeEmbedGraphicsState({opacity:e.opacity,borderOpacity:e.borderOpacity,blendMode:e.blendMode});!("color"in e)&&!("borderColor"in e)&&(e.color=kn(0,0,0)),this.getContentStream().push(...Yf({x:(t=e.x)!=null?t:this.x,y:(n=e.y)!=null?n:this.y,width:(r=e.width)!=null?r:150,height:(i=e.height)!=null?i:100,rotate:(o=e.rotate)!=null?o:Be(0),xSkew:(s=e.xSkew)!=null?s:Be(0),ySkew:(c=e.ySkew)!=null?c:Be(0),borderWidth:(l=e.borderWidth)!=null?l:0,color:(a=e.color)!=null?a:void 0,borderColor:(h=e.borderColor)!=null?h:void 0,borderDashArray:(f=e.borderDashArray)!=null?f:void 0,borderDashPhase:(u=e.borderDashPhase)!=null?u:void 0,graphicsState:y,borderLineCap:(d=e.borderLineCap)!=null?d:void 0}))}drawSquare(e={}){const{size:t}=e;j(t,"size",["number"]),this.drawRectangle({...e,width:t,height:t})}drawEllipse(e={}){var t,n,r,i,o,s,c,l,a,h,f;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"]]),Ke(e.opacity,"opacity.opacity",0,1),j(e.borderColor,"options.borderColor",[[Object,"Color"]]),Ke(e.borderOpacity,"options.borderOpacity",0,1),j(e.borderWidth,"options.borderWidth",["number"]),j(e.borderDashArray,"options.borderDashArray",[Array]),j(e.borderDashPhase,"options.borderDashPhase",["number"]),Ne(e.borderLineCap,"options.borderLineCap",vn),Ne(e.blendMode,"options.blendMode",wt);const u=this.maybeEmbedGraphicsState({opacity:e.opacity,borderOpacity:e.borderOpacity,blendMode:e.blendMode});!("color"in e)&&!("borderColor"in e)&&(e.color=kn(0,0,0)),this.getContentStream().push(...eu({x:(t=e.x)!=null?t:this.x,y:(n=e.y)!=null?n:this.y,xScale:(r=e.xScale)!=null?r:100,yScale:(i=e.yScale)!=null?i:100,rotate:(o=e.rotate)!=null?o:void 0,color:(s=e.color)!=null?s:void 0,borderColor:(c=e.borderColor)!=null?c:void 0,borderWidth:(l=e.borderWidth)!=null?l:0,borderDashArray:(a=e.borderDashArray)!=null?a:void 0,borderDashPhase:(h=e.borderDashPhase)!=null?h:void 0,borderLineCap:(f=e.borderLineCap)!=null?f:void 0,graphicsState:u}))}drawCircle(e={}){const{size:t=100}=e;j(t,"size",["number"]),this.drawEllipse({...e,xScale:t,yScale:t})}resetFont(){this.font=void 0,this.fontKey=void 0}getContentStream(e=!0){return e&&this.contentStream?this.contentStream:(this.contentStream=this.createContentStream(),this.contentStreamRef=this.doc.context.register(this.contentStream),this.node.addContentStream(this.contentStreamRef),this.contentStream)}createContentStream(...e){const t=this.doc.context.obj({});return zt.of(t,e)}maybeEmbedGraphicsState(e){const{opacity:t,borderOpacity:n,blendMode:r}=e;if(t===void 0&&n===void 0&&r===void 0)return;const i=this.doc.context.obj({Type:"ExtGState",ca:t,CA:n,BM:r});return this.node.newExtGState("GS",i)}scaleAnnot(e,t,n){const r=["RD","CL","Vertices","QuadPoints","L","Rect"];for(let o=0,s=r.length;o<s;o++){const c=e.lookup(p.of(r[o]));c instanceof q&&c.scalePDFNumbers(t,n)}const i=e.lookup(p.of("InkList"));if(i instanceof q)for(let o=0,s=i.size();o<s;o++){const c=i.lookup(o);c instanceof q&&c.scalePDFNumbers(t,n)}}};let Gt=co;b(Gt,"of",(e,t,n)=>new co(e,t,n)),b(Gt,"create",e=>{D(e,"doc",[[ct,"PDFDocument"]]);const t=oe.of(-1),n=He.withContextAndParent(e.context,t),r=e.context.register(n);return new co(n,r,e)});const lc=class{constructor(e,t,n){b(this,"ref"),b(this,"doc"),b(this,"alreadyEmbedded",!1),b(this,"embedder"),this.ref=e,this.doc=t,this.embedder=n}async embed(){if(!this.alreadyEmbedded){const{catalog:e,context:t}=this.doc,n=await this.embedder.embedIntoContext(this.doc.context,this.ref);e.has(p.of("Names"))||e.set(p.of("Names"),t.obj({}));const r=e.lookup(p.of("Names"),V);r.has(p.of("JavaScript"))||r.set(p.of("JavaScript"),t.obj({}));const i=r.lookup(p.of("JavaScript"),V);i.has(p.of("Names"))||i.set(p.of("Names"),t.obj([]));const o=i.lookup(p.of("Names"),q);o.push(X.fromText(this.embedder.scriptName)),o.push(n),this.alreadyEmbedded=!0}}};let hc=lc;b(hc,"of",(e,t,n)=>new lc(e,t,n));class lo{constructor(t,n){b(this,"script"),b(this,"scriptName"),this.script=t,this.scriptName=n}static for(t,n){return new lo(t,n)}async embedIntoContext(t,n){const r=t.obj({Type:"Action",S:"JavaScript",JS:X.fromText(this.script)});return n?(t.assign(n,r),n):t.register(r)}}class ct{constructor(t,n){if(b(this,"context"),b(this,"catalog"),b(this,"isEncrypted"),b(this,"defaultWordBreaks",[" "]),b(this,"fontkit"),b(this,"pageCount"),b(this,"pageCache"),b(this,"pageMap"),b(this,"fonts"),b(this,"images"),b(this,"embeddedPages"),b(this,"embeddedFiles"),b(this,"javaScripts"),b(this,"computePages",()=>{const r=[];return this.catalog.Pages().traverse((i,o)=>{if(i instanceof He){let s=this.pageMap.get(i);s||(s=Gt.of(i,o,this),this.pageMap.set(i,s)),r.push(s)}}),r}),D(t,"context",[[yi,"PDFContext"]]),D(n,"ignoreEncryption",["boolean"]),this.context=t,this.catalog=t.lookup(t.trailerInfo.Root),this.isEncrypted=!!t.lookup(t.trailerInfo.Encrypt),this.pageCache=kt.populatedBy(this.computePages),this.pageMap=new Map,this.fonts=[],this.images=[],this.embeddedPages=[],this.embeddedFiles=[],this.javaScripts=[],!n&&this.isEncrypted)throw new jf}static async load(t,n={}){const{ignoreEncryption:r=!1,parseSpeed:i=100,throwOnInvalidObject:o=!1,updateMetadata:s=!0,capNumbers:c=!1}=n;D(t,"pdf",["string",Uint8Array,ArrayBuffer]),D(r,"ignoreEncryption",["boolean"]),D(i,"parseSpeed",["number"]),D(o,"throwOnInvalidObject",["boolean"]);const l=zc(t),a=await Ua.forBytesWithOptions(l,i,o,c).parseDocument();return new ct(a,r)}registerFontkit(t){this.fontkit=t}getPageCount(){return this.pageCount===void 0&&(this.pageCount=this.getPages().length),this.pageCount}getPages(){return this.pageCache.access()}getPage(t){const n=this.getPages();return et(t,"index",0,n.length-1),n[t]}getPageIndices(){return Oc(0,this.getPageCount())}removePage(t){const n=this.getPageCount();if(this.pageCount===0)throw new $f;et(t,"index",0,n-1),this.catalog.removeLeafNode(t),this.pageCount=n-1}addPage(t){return D(t,"page",["undefined",[Gt,"PDFPage"],Array]),this.insertPage(this.getPageCount(),t)}insertPage(t,n){const r=this.getPageCount();if(et(t,"index",0,r),D(n,"page",["undefined",[Gt,"PDFPage"],Array]),!n||Array.isArray(n)){const o=Array.isArray(n)?n:nu.A4;n=Gt.create(this),n.setSize(...o)}else if(n.doc!==this)throw new Uf;const i=this.catalog.insertLeafNode(n.ref,t);return n.node.setParent(i),this.pageMap.set(n.node,n),this.pageCache.invalidate(),this.pageCount=r+1,n}addJavaScript(t,n){D(t,"name",["string"]),D(n,"script",["string"]);const r=lo.for(n,t),i=this.context.nextRef(),o=hc.of(i,this,r);this.javaScripts.push(o)}async flush(){await this.embedAll(this.fonts),await this.embedAll(this.images),await this.embedAll(this.embeddedPages),await this.embedAll(this.embeddedFiles),await this.embedAll(this.javaScripts)}async save(t={}){const{useObjectStreams:n=!0,addDefaultPage:r=!0,objectsPerTick:i=50,updateFieldAppearances:o=!0}=t;return D(n,"useObjectStreams",["boolean"]),D(r,"addDefaultPage",["boolean"]),D(i,"objectsPerTick",["number"]),D(o,"updateFieldAppearances",["boolean"]),r&&this.getPageCount()===0&&this.addPage(),await this.flush(),(n?wa:Si).forContext(this.context,i).serializeToBuffer()}async saveAsBase64(t={}){const{dataUri:n=!1,...r}=t;D(n,"dataUri",["boolean"]);const i=await this.save(r),o=Cc(i);return n?`data:application/pdf;base64,${o}`:o}findPageForAnnotationRef(t){const n=this.getPages();for(let r=0,i=n.length;r<i;r++){const o=n[r],s=o.node.Annots();if(s?.indexOf(t)!==void 0)return o}}async embedAll(t){for(let n=0,r=t.length;n<r;n++)await t[n].embed()}}var dc;(function(e){e.APNG="image/apng",e.AVIF="image/avif",e.BMP="image/bmp",e.GIF="image/gif",e.JPEG="image/jpeg",e.PNG="image/png",e.SVG="image/svg+xml",e.WEBP="image/webp",e.ICON="image/x-icon"})(dc||(dc={}));var Sr;(function(e){e.UnsupportedFileType="unsupported-file-type",e.FileSizeExceeded="file-size-exceeded"})(Sr||(Sr={}));var Vt;(function(e){e.textSelection="vpv:annotation:textSelection",e.freeText="vpv:annotation:freeText",e.signature="vpv:annotation:signature",e.image="vpv:annotation:image",e.highlight="vpv:annotation:highlight",e.underline="vpv:annotation:underline",e.strikeout="vpv:annotation:strikeout"})(Vt||(Vt={}));var vr;(function(e){e.AnnotationCreated="vpv:annotation:created",e.AnnotationUpdated="vpv:annotation:updated",e.AnnotationDeleted="vpv:annotation:deleted",e.AnnotationMounted="vpv:annotation:mounted",e.Rotate="vpv:rotate",e.ShowNotificationError="vpv:notification:error"})(vr||(vr={})),de.AnnotationType=void 0,function(e){e[e.Text=1]="Text",e[e.Link=2]="Link",e[e.FreeText=3]="FreeText",e[e.Line=4]="Line",e[e.Square=5]="Square",e[e.Circle=6]="Circle",e[e.Polygon=7]="Polygon",e[e.Polyline=8]="Polyline",e[e.Highlight=9]="Highlight",e[e.Underline=10]="Underline",e[e.Squiggly=11]="Squiggly",e[e.StrikeOut=12]="StrikeOut",e[e.Stamp=13]="Stamp",e[e.Caret=14]="Caret",e[e.Ink=15]="Ink",e[e.Popup=16]="Popup",e[e.FileAttachment=17]="FileAttachment",e[e.Sound=18]="Sound",e[e.Movie=19]="Movie",e[e.Widget=20]="Widget",e[e.Screen=21]="Screen",e[e.PrinterMark=22]="PrinterMark",e[e.TrapNet=23]="TrapNet",e[e.Watermark=24]="Watermark",e[e.ThreeD=25]="ThreeD",e[e.Redact=26]="Redact"}(de.AnnotationType||(de.AnnotationType={})),de.AnnotationFlag=void 0,function(e){e[e.INVISIBLE=1]="INVISIBLE",e[e.HIDDEN=2]="HIDDEN",e[e.PRINT=4]="PRINT",e[e.NOZOOM=8]="NOZOOM",e[e.NOROTATE=16]="NOROTATE",e[e.NOVIEW=32]="NOVIEW",e[e.READONLY=64]="READONLY",e[e.LOCKED=128]="LOCKED",e[e.TOGGLENOVIEW=256]="TOGGLENOVIEW",e[e.LOCKEDCONTENTS=512]="LOCKEDCONTENTS"}(de.AnnotationFlag||(de.AnnotationFlag={}));const ru={ANNOTATIONS:"annotations"},Bn=Symbol("VPV Shared UIs"),fc=Symbol("VPV Current Localization"),Dn=vr,ho={Black:"#000000",DarkGray:"#444444",Gray:"#696969",LightGray:"#9C9C9C",LightestGray:"#CDCDCD",ChristmasWhite:"#EDEDED"},Re={...ho,Purple:"#7862FF",Blue:"#1777FF",Red:"#F66365",Orange:"#F67E63",Yellow:"#F5C463",Green:"#48BB77"},Ie={Purple:"#CAAAFF",Cyan:"#65EDE9",Red:"#FFACAC",Orange:"#FFBD82",Yellow:"#FCE244",Green:"#A0F751",...ho},ce={Purple:"#7862FF",Blue:"#1777FF",Red:"#F66365",Orange:"#F67E63",Yellow:"#F5C463",Green:"#48BB77",...ho},iu={[Ie.Purple]:"Purple",[Ie.Cyan]:"Cyan",[Ie.Red]:"Red",[Ie.Orange]:"Orange",[Ie.Yellow]:"Yellow",[Ie.Green]:"Green",[Ie.Black]:"Black",[Ie.DarkGray]:"Dark Gray",[Ie.Gray]:"Gray",[Ie.LightGray]:"Light Gray",[Ie.LightestGray]:"Lightest Gray",[Ie.ChristmasWhite]:"Christmas White"},ou={[ce.Purple]:"Purple",[ce.Blue]:"Blue",[ce.Red]:"Red",[ce.Orange]:"Orange",[ce.Yellow]:"Yellow",[ce.Green]:"Green",[ce.Black]:"Black",[ce.DarkGray]:"Dark Gray",[ce.Gray]:"Gray",[ce.LightGray]:"Light Gray",[ce.LightestGray]:"Lightest Gray",[ce.ChristmasWhite]:"Christmas White"},su={[ce.Purple]:"Purple",[ce.Blue]:"Blue",[ce.Red]:"Red",[ce.Orange]:"Orange",[ce.Yellow]:"Yellow",[ce.Green]:"Green",[ce.Black]:"Black",[ce.DarkGray]:"Dark Gray",[ce.Gray]:"Gray",[ce.LightGray]:"Light Gray",[ce.LightestGray]:"Lightest Gray",[ce.ChristmasWhite]:"Christmas White"},au={[Re.Black]:"Black",[Re.DarkGray]:"Dark Gray",[Re.Gray]:"Gray",[Re.LightGray]:"Light Gray",[Re.LightestGray]:"Lightest Gray",[Re.ChristmasWhite]:"Christmas White",[Re.Purple]:"Purple",[Re.Blue]:"Blue",[Re.Red]:"Red",[Re.Orange]:"Orange",[Re.Yellow]:"Yellow",[Re.Green]:"Green"},cu="pdfjs_internal_editor_",Wt=(e,t)=>`${e}-${t}`;class lu{static async serializeAnnotationsToPdf(t,n,r){const i=await ct.load(t),o=i.getPages();if(r&&r.length>0){const a=typeof r[0]=="string"?r.map(h=>({id:h,pageIndex:-1,annotationType:-1})):r;await this.removeAnnotations(i,o,a)}const s=n.filter(a=>a.annotationType===de.AnnotationType.Underline||a.annotationType===de.AnnotationType.StrikeOut),c=n.filter(a=>a.annotationType===de.AnnotationType.Square);for(const a of s)await this.addTextMarkupAnnotation(i,o,a);for(const a of c)await this.addRectangleAnnotation(i,o,a);return await i.save()}static async removeAnnotations(t,n,r){const i=new Map,o=[];for(const s of r)if(s.pageIndex>=0){const c=i.get(s.pageIndex)||[];c.push(s),i.set(s.pageIndex,c)}else o.push(s);for(let s=0;s<n.length;s++){const c=n[s],l=[...i.get(s)||[],...o];if(l.length===0)continue;const a=c.node.Annots();if(!a||!(a instanceof q))continue;const h=[];for(let f=0;f<a.size();f++){const u=a.get(f);let d;if(u instanceof oe){const w=t.context.lookup(u);w instanceof V&&(d=w)}else u instanceof V&&(d=u);if(!d)continue;this.matchesDeletedAnnotation(d,l)&&h.push(f)}for(let f=h.length-1;f>=0;f--)a.remove(h[f])}}static matchesDeletedAnnotation(t,n){const r=t.get(p.of("NM"));let i=null;if((r instanceof ee||r instanceof X)&&(i=r.decodeText()),i&&n.find(f=>f.id===i))return!0;const o=t.get(p.of("Subtype")),s=o instanceof p?o.decodeText():null;let c=null;if(s==="Underline"?c=de.AnnotationType.Underline:s==="StrikeOut"&&(c=de.AnnotationType.StrikeOut),c===null)return!1;const l=t.get(p.of("Rect"));if(!(l instanceof q))return!1;const a=[];for(let h=0;h<l.size();h++){const f=l.get(h);f instanceof $&&a.push(f.asNumber())}if(a.length!==4)return!1;for(const h of n){if(h.annotationType!==-1&&h.annotationType!==c||!h.rect||h.rect.length!==4)continue;const f=1;if(Math.abs(a[0]-h.rect[0])<f&&Math.abs(a[1]-h.rect[1])<f&&Math.abs(a[2]-h.rect[2])<f&&Math.abs(a[3]-h.rect[3])<f)return!0}return!1}static async addTextMarkupAnnotation(t,n,r){const i=n[r.pageIndex??0],o=r.rect,s=Array.from(r.quadPoints||[]),c={Type:"Annot",Subtype:r.annotationType===de.AnnotationType.Underline?"Underline":"StrikeOut",Rect:o,QuadPoints:s,C:[(r.color?.[0]??0)/255,(r.color?.[1]??0)/255,(r.color?.[2]??0)/255],F:4,Contents:X.fromText(r.contents||`${r.subtype} annotation`)};if(r.modificationDate){const f=r.modificationDate instanceof Date?this.formatPdfDate(r.modificationDate):r.modificationDate.toString();c.M=ee.of(f)}if(r.creationDate){const f=r.creationDate instanceof Date?this.formatPdfDate(r.creationDate):r.creationDate.toString();c.CreationDate=ee.of(f)}c.T=X.fromText(r.titleObj?.str||"Vue PDF Viewer"),r.id&&(c.NM=X.fromText(r.id));const l=t.context.obj(c),a=t.context.register(l);let h=i.node.lookup(p.of("Annots"));h||(h=t.context.obj([]),i.node.set(p.of("Annots"),h)),h instanceof q&&h.push(a)}static formatPdfDate(t){const n=t.getFullYear(),r=String(t.getMonth()+1).padStart(2,"0"),i=String(t.getDate()).padStart(2,"0"),o=String(t.getHours()).padStart(2,"0"),s=String(t.getMinutes()).padStart(2,"0"),c=String(t.getSeconds()).padStart(2,"0"),l=-t.getTimezoneOffset(),a=l>=0?"+":"-",h=String(Math.floor(Math.abs(l)/60)).padStart(2,"0"),f=String(Math.abs(l)%60).padStart(2,"0");return`D:${n}${r}${i}${o}${s}${c}${a}${h}'${f}`}static async addRectangleAnnotation(t,n,r){const i=n[r.pageIndex??0],{height:o}=i.getSize(),s=this.convertRectToPdfCoords(r.rect,o),c=r.borderColor||r.color,l=r.backgroundColor,a={Type:"Annot",Subtype:"Square",Rect:s,F:r.annotationFlags??4};if(c&&(a.C=[(c[0]??0)/255,(c[1]??0)/255,(c[2]??0)/255]),l&&(a.IC=[(l[0]??0)/255,(l[1]??0)/255,(l[2]??0)/255]),r.borderStyle){const d={Type:"Border"};if(r.borderStyle.width!==void 0&&(d.W=r.borderStyle.width),r.borderStyle.style!==void 0){const y={1:"S",2:"D",3:"B",4:"I",5:"U"};d.S=p.of(y[r.borderStyle.style]||"S")}r.borderStyle.dashArray&&r.borderStyle.dashArray.length>0&&(d.D=r.borderStyle.dashArray),a.BS=t.context.obj(d)}if(r.opacity!==void 0&&r.opacity<1&&(a.CA=r.opacity),r.contents&&(a.Contents=X.fromText(r.contents)),r.creationDate){const d=r.creationDate instanceof Date?this.formatPdfDate(r.creationDate):r.creationDate.toString();a.CreationDate=ee.of(d)}if(r.modificationDate){const d=r.modificationDate instanceof Date?this.formatPdfDate(r.modificationDate):r.modificationDate.toString();a.M=ee.of(d)}const h=t.context.obj(a),f=t.context.register(h);let u=i.node.lookup(p.of("Annots"));u||(u=t.context.obj([]),i.node.set(p.of("Annots"),u)),u instanceof q&&u.push(f)}static convertRectToPdfCoords(t,n){return[t[0],n-t[3],t[2],n-t[1]]}static convertQuadPointsToPdfCoords(t,n){const r=[];for(let i=0;i<t.length;i+=2)r.push(t[i],n-t[i+1]);return r}}const hu={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",honeydew:"#f0fff0",hotpink:"#ff69b4","indianred ":"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgrey:"#d3d3d3",lightgreen:"#90ee90",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370d8",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#d87093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"},du=e=>e.startsWith("#")||e.startsWith("0x")?e:hu[e]||e,Tn=g.defineComponent({__name:"AppTooltip",setup(e){const t=g.inject(Bn),n=g.computed(()=>t?.AppTooltip);return(r,i)=>n.value?(g.openBlock(),g.createBlock(g.resolveDynamicComponent(n.value),g.normalizeProps(g.mergeProps({key:0},r.$attrs)),g.createSlots({default:g.withCtx(()=>[g.renderSlot(r.$slots,"default")]),_:2},[g.renderList(r.$slots,(o,s)=>({name:s,fn:g.withCtx(()=>[g.renderSlot(r.$slots,s)])}))]),1040)):(g.openBlock(),g.createElementBlock("div",g.normalizeProps(g.mergeProps({key:1},r.$attrs)),[g.renderSlot(r.$slots,"default")],16))}}),En=g.defineComponent({inheritAttrs:!1,__name:"AppButton",props:{ariaLabel:{},ariaDisabled:{type:Boolean}},setup(e){const t=e,n=g.useAttrs(),r=g.inject(Bn),i=g.computed(()=>r?.AppButton),o=g.computed(()=>({"aria-label":t.ariaLabel,"aria-disabled":t.ariaDisabled,...n}));return(s,c)=>i.value?(g.openBlock(),g.createBlock(g.resolveDynamicComponent(i.value),g.normalizeProps(g.mergeProps({key:0},o.value)),{default:g.withCtx(()=>[g.renderSlot(s.$slots,"default")]),_:3},16)):(g.openBlock(),g.createElementBlock("button",g.normalizeProps(g.mergeProps({key:1},o.value)),[g.renderSlot(s.$slots,"default")],16))}}),fu=(e,t)=>{const n=e[t];return n?typeof n=="function"?n():Promise.resolve(n):new Promise((r,i)=>{(typeof queueMicrotask=="function"?queueMicrotask:setTimeout)(i.bind(null,new Error("Unknown variable dynamic import: "+t)))})},uu=g.defineComponent({__name:"Icon",props:{name:{}},setup(e){const t=e,n=g.defineAsyncComponent({loader:()=>fu(Object.assign({"../assets/icons/annotations.svg":()=>Promise.resolve().then(()=>Eu),"../assets/icons/tool-comment.svg":()=>Promise.resolve().then(()=>Ru),"../assets/icons/tool-free-text.svg":()=>Promise.resolve().then(()=>Ou),"../assets/icons/tool-highlight.svg":()=>Promise.resolve().then(()=>Fu),"../assets/icons/tool-image.svg":()=>Promise.resolve().then(()=>Mu),"../assets/icons/tool-signature.svg":()=>Promise.resolve().then(()=>ju),"../assets/icons/tool-strikethrough.svg":()=>Promise.resolve().then(()=>$u),"../assets/icons/tool-text-selection.svg":()=>Promise.resolve().then(()=>Gu),"../assets/icons/tool-underline.svg":()=>Promise.resolve().then(()=>Wu)}),`../assets/icons/${t.name}.svg`)});return(r,i)=>(g.openBlock(),g.createBlock(g.resolveDynamicComponent(g.unref(n)),{class:"vp-text-xl"}))}}),e0="",fo=(e,t)=>{const n=e.__vccOpts||e;for(const[r,i]of t)n[r]=i;return n},lt=fo(uu,[["__scopeId","data-v-9d5f0033"]]),Pn=()=>{const e=g.inject(fc,g.computed(()=>({})));return{t:g.computed(()=>n=>{const r=n.split(".").pop()||n;return e.value&&r in e.value?e.value[r]:(console.warn(`useLocalization - Translation not found for key: ${n}`),n)}).value,currentLocale:g.computed(()=>e.value)}},gu=g.defineComponent({__name:"ToolAnnotation",emits:["toggle"],setup(e,{emit:t}){const{t:n}=Pn(),r=t,i=g.ref(!1),o=()=>{i.value=!i.value,r("toggle",i.value)};return(s,c)=>s.$slots.default?g.renderSlot(s.$slots,"default",{key:0,onClick:o},void 0,!0):(g.openBlock(),g.createBlock(Tn,{key:1},{content:g.withCtx(()=>[g.createTextVNode(g.toDisplayString(i.value?g.unref(n)("annotationToggleHideTooltip"):g.unref(n)("annotationToggleShowTooltip")),1)]),default:g.withCtx(()=>[g.createVNode(En,{"aria-label":i.value?g.unref(n)("annotationToggleHideTooltip"):g.unref(n)("annotationToggleShowTooltip"),class:g.normalizeClass(["vpv-toolbar-btn",{"vpv-toolbar-btn-active":i.value}]),onClick:o},{default:g.withCtx(()=>[g.createVNode(lt,{name:"annotations",class:"vp-text-xl"})]),_:1},8,["aria-label","class"])]),_:1}))}}),t0="",pu=fo(gu,[["__scopeId","data-v-df5778ee"]]),bu=g.defineComponent({__name:"ToolAnnotationTextSelection",props:g.mergeModels({ariaDisabled:{type:Boolean},active:{type:Boolean}},{active:{type:Boolean,required:!0},activeModifiers:{}}),emits:["update:active"],setup(e){const t=e,n=g.useModel(e,"active"),{t:r}=Pn(),i=g.computed(()=>t.ariaDisabled===!0),o=()=>{i.value||(n.value=!n.value)};return(s,c)=>s.$slots.default?g.renderSlot(s.$slots,"default",g.mergeProps({key:0},s.$attrs,{onClick:o})):(g.openBlock(),g.createBlock(Tn,{key:1},{content:g.withCtx(()=>[g.createTextVNode(g.toDisplayString(g.unref(r)("annotationTextSelectionTooltip")),1)]),default:g.withCtx(()=>[g.createVNode(En,g.mergeProps({"aria-label":g.unref(r)("annotationTextSelectionLabel"),class:["vpv-toolbar-btn",{"vpv-toolbar-btn-active":n.value}]},s.$attrs,{onClick:o}),{default:g.withCtx(()=>[g.renderSlot(s.$slots,"icon",{},()=>[g.createVNode(lt,{name:"tool-text-selection"})])]),_:3},16,["aria-label","class"])]),_:3}))}}),mu=g.defineComponent({__name:"AppPopover",props:{open:{type:Boolean},side:{},sideOffset:{},class:{},ariaLabel:{}},setup(e){const t=e,n=g.inject(Bn),r=g.computed(()=>n?.AppPopover);return(i,o)=>r.value?(g.openBlock(),g.createBlock(g.resolveDynamicComponent(r.value),g.normalizeProps(g.mergeProps({key:0},t)),{trigger:g.withCtx(()=>[g.renderSlot(i.$slots,"trigger")]),default:g.withCtx(()=>[g.renderSlot(i.$slots,"default")]),_:3},16)):(g.openBlock(),g.createElementBlock("button",g.normalizeProps(g.mergeProps({key:1},t)),[g.renderSlot(i.$slots,"default")],16))}}),yu=g.defineComponent({__name:"AppSignatures",setup(e){const t=g.inject(Bn),n=g.computed(()=>t?.AppSignatures);return(r,i)=>n.value?(g.openBlock(),g.createBlock(g.resolveDynamicComponent(n.value),g.normalizeProps(g.mergeProps({key:0},r.$attrs)),null,16)):g.createCommentVNode("",!0)}}),_u=g.defineComponent({__name:"ToolAnnotationSignature",props:g.mergeModels({ariaDisabled:{type:Boolean},active:{type:Boolean}},{active:{type:Boolean,required:!0},activeModifiers:{}}),emits:["update:active"],setup(e){const t=e,n=g.useModel(e,"active"),{t:r}=Pn(),i=g.ref(!1),o=g.computed(()=>t.ariaDisabled===!0),s=()=>{o.value||(!n.value&&!i.value&&(i.value=!0),n.value=!n.value)},c=l=>{i.value=!1};return(l,a)=>l.$slots.default?g.renderSlot(l.$slots,"default",g.mergeProps({key:0},l.$attrs,{onClick:s})):(g.openBlock(),g.createBlock(mu,{key:1,open:i.value,side:"right",sideOffset:10,class:"vpv-annotation-signatures__popover",onInteractOutside:c},{trigger:g.withCtx(()=>[g.createVNode(Tn,null,{content:g.withCtx(()=>[g.createTextVNode(g.toDisplayString(g.unref(r)("annotationSignatureTooltip")),1)]),default:g.withCtx(()=>[g.createVNode(En,g.mergeProps({"aria-label":g.unref(r)("annotationSignatureLabel"),class:["vpv-toolbar-btn",{"vpv-toolbar-btn-active":n.value}]},l.$attrs,{onClick:s}),{default:g.withCtx(()=>[g.renderSlot(l.$slots,"icon",{},()=>[g.createVNode(lt,{name:"tool-signature"})])]),_:3},16,["aria-label","class"])]),_:3})]),default:g.withCtx(()=>[g.createVNode(yu)]),_:3},8,["open"]))}}),wu=g.defineComponent({__name:"ToolAnnotationFreeText",props:g.mergeModels({ariaDisabled:{type:Boolean},active:{type:Boolean}},{active:{type:Boolean,required:!0},activeModifiers:{}}),emits:["update:active"],setup(e){const t=e,n=g.useModel(e,"active"),{t:r}=Pn(),i=g.computed(()=>t.ariaDisabled===!0),o=()=>{i.value||(n.value=!n.value)};return(s,c)=>s.$slots.default?g.renderSlot(s.$slots,"default",g.mergeProps({key:0},s.$attrs,{onClick:o})):(g.openBlock(),g.createBlock(Tn,{key:1},{content:g.withCtx(()=>[g.createTextVNode(g.toDisplayString(g.unref(r)("annotationFreeTextTooltip")),1)]),default:g.withCtx(()=>[g.createVNode(En,g.mergeProps({"aria-label":g.unref(r)("annotationFreeTextLabel"),class:["vpv-toolbar-btn",{"vpv-toolbar-btn-active":n.value}]},s.$attrs,{onClick:o}),{default:g.withCtx(()=>[g.renderSlot(s.$slots,"icon",{},()=>[g.createVNode(lt,{name:"tool-free-text"})])]),_:3},16,["aria-label","class"])]),_:3}))}}),xu=g.defineComponent({__name:"ToolAnnotationImage",props:{ariaDisabled:{type:Boolean}},emits:["change"],setup(e,{emit:t}){const n=e,{t:r}=Pn(),i=t,o=g.computed(()=>n.ariaDisabled===!0),s=()=>{if(o.value)return;const c=document.createElement("input");c.type="file",c.accept="image/*",c.onchange=l=>{const a=l.target.files?.[0];i("change",a)},c.click()};return(c,l)=>c.$slots.default?g.renderSlot(c.$slots,"default",g.mergeProps({key:0},c.$attrs,{onClick:s})):(g.openBlock(),g.createBlock(Tn,{key:1},{content:g.withCtx(()=>[g.createTextVNode(g.toDisplayString(g.unref(r)("annotationImageTooltip")),1)]),default:g.withCtx(()=>[g.createVNode(En,g.mergeProps({"aria-label":g.unref(r)("annotationImageLabel"),class:"vpv-toolbar-btn"},c.$attrs,{onClick:s}),{default:g.withCtx(()=>[g.renderSlot(c.$slots,"icon",{},()=>[g.createVNode(lt,{name:"tool-image"})])]),_:3},16,["aria-label"])]),_:3}))}}),n0="",uc={B:1,K:1e3,KB:1e3,M:1e3**2,MB:1e3**2,G:1e3**3,GB:1e3**3,T:1e3**4,TB:1e3**4};function Su(e){if(!e||typeof e!="string")return{isValid:!1,bytes:0,error:"Size input is required and must be a string"};const n=e.trim().toUpperCase().match(/^(\d*\.?\d+)\s*([KMGTB]B?)?$/);if(!n)return{isValid:!1,bytes:0,error:'Invalid format. Expected: number + optional unit (e.g., "10MB", "1.5G", "512")'};const[,r,i="B"]=n,o=parseFloat(r);if(isNaN(o)||o<0)return{isValid:!1,bytes:0,error:"Size must be a positive number"};const s=i;return s in uc?{isValid:!0,bytes:Math.floor(o*uc[s])}:{isValid:!1,bytes:0,error:`Unsupported unit "${i}". Supported: B, K, KB, M, MB, G, GB, T, TB`}}function vu(e,t=1){if(e===0)return"0 B";const n=["B","KB","MB","GB","TB"],r=1e3,i=Math.floor(Math.log(e)/Math.log(r)),o=e/Math.pow(r,i);return`${t===0?Math.round(o):o.toFixed(t)} ${n[i]}`}function ku(e){const t=Su(e);if(!t.isValid)throw new Error(t.error);return t.bytes}const Au={class:"vpv-annotation-tools-container"},Cu={key:0,class:"vpv-annotation-tools"},Bu=g.defineComponent({__name:"VPdfAnnotationTools",props:{textSelection:{type:[Object,Boolean],default:()=>!0},freeText:{type:[Object,Boolean],default:()=>!0},signature:{type:[Object,Boolean],default:()=>!1},image:{type:[Object,Boolean],default:()=>!0},instanceId:{type:Number,required:!0},onAnnotationCreated:{type:Function,default:void 0},onAnnotationUpdated:{type:Function,default:void 0},onAnnotationDeleted:{type:Function,default:void 0}},emits:["textSelection","freeText","signature","image"],setup(e,{emit:t}){const n=e,r=t,i=g.ref(!1),o=O=>Wt(n.instanceId,O),s={textSelection:new CustomEvent(o(Vt.textSelection),{detail:{active:!1,highlight:null,strikethrough:null,underline:null}}),freeText:new CustomEvent(o(Vt.freeText),{detail:{active:!1,fontColors:null,fontSizes:null}}),signature:new CustomEvent(o(Vt.signature),{detail:{active:!1}}),image:new CustomEvent(o(Vt.image),{detail:{file:void 0}}),error:new CustomEvent(o(vr.ShowNotificationError),{detail:{error:void 0,maxSize:void 0}})},c=g.ref(!1),l=g.reactive({textSelection:!1,freeText:!1,signature:!1}),a=g.computed({get:()=>l.textSelection,set:O=>{l.textSelection=O,O&&(l.freeText=!1,l.signature=!1),T()}}),h=g.computed({get:()=>l.freeText,set:O=>{O&&(l.textSelection=!1,l.signature=!1),l.freeText=O,T()}}),f=g.computed({get:()=>l.signature,set:O=>{O&&(l.textSelection=!1,l.freeText=!1),l.signature=O,T()}}),u=g.computed(()=>n.textSelection),d=g.computed(()=>n.freeText),y=g.computed(()=>n.signature),w=g.computed(()=>n.image);function x(O){return O.map(P=>typeof P=="string"?{value:du(P),label:P}:P)}const _=O=>{c.value=O,O||(a.value=!1,h.value=!1,f.value=!1)},E=Object.entries(iu).map(([O,P])=>({value:O,label:P})),v=Object.entries(ou).map(([O,P])=>({value:O,label:P})),S=Object.entries(su).map(([O,P])=>({value:O,label:P})),z=O=>{r("textSelection",O),s.textSelection.detail.active=O;let P={icon:g.markRaw(g.h(lt,{name:"tool-highlight"}))},B={icon:g.markRaw(g.h(lt,{name:"tool-strikethrough"}))},U={icon:g.markRaw(g.h(lt,{name:"tool-underline"}))};if(typeof n.textSelection=="object"){const{highlight:ie,strikethrough:le,underline:pe}=n.textSelection;ie===!1?P=!1:typeof ie=="object"&&(P={...P,...ie},ie.icon&&typeof ie.icon=="object"&&(P.icon=g.markRaw(ie.icon))),le===!1?B=!1:typeof le=="object"&&(B={...B,...le},le.icon&&typeof le.icon=="object"&&(B.icon=g.markRaw(le.icon))),pe===!1?U=!1:typeof pe=="object"&&(U={...U,...pe},pe.icon&&typeof pe.icon=="object"&&(U.icon=g.markRaw(pe.icon)))}P&&typeof P=="object"&&(P.colors?P.colors=x(P.colors):P.colors=E),U&&typeof U=="object"&&(U.colors?U.colors=x(U.colors):U.colors=v),B&&typeof B=="object"&&(B.colors?B.colors=x(B.colors):B.colors=S),s.textSelection.detail.highlight=P,s.textSelection.detail.strikethrough=B,s.textSelection.detail.underline=U,window.dispatchEvent(s.textSelection)},C=O=>{r("freeText",O),s.freeText.detail.active=O;let P=Object.entries(au).map(([B,U])=>({value:B,label:U}));typeof n.freeText=="object"&&n.freeText?.fontColors&&(P=x(n.freeText.fontColors)),s.freeText.detail.fontColors=P,typeof n.freeText=="object"&&n.freeText?.fontSizes?.length&&(s.freeText.detail.fontSizes=n.freeText.fontSizes),window.dispatchEvent(s.freeText)},k=O=>{r("signature",O),s.signature.detail.active=O,window.dispatchEvent(s.signature)},F=(O,P,B)=>{if(!O)return{isValid:!0};if(typeof P<"u"){let U;if(typeof P=="number"?U=P:U=ku(P),O.size>U)return{isValid:!1,error:Sr.FileSizeExceeded,maxSize:vu(U)}}return B&&B.length>0&&!B.includes(O.type)?{isValid:!1,error:Sr.UnsupportedFileType}:{isValid:!0}},I=O=>{const P=n.image,B=F(O,P?.maxSize,P?.types);if(!B.isValid){s.error.detail.error=B?.error,s.error.detail.maxSize=B?.maxSize,window.dispatchEvent(s.error);return}l.textSelection=!1,l.freeText=!1,l.signature=!1,r("image",O),s.image.detail.file=O,window.dispatchEvent(s.image)};function T(){z(a.value),C(h.value),k(f.value)}const R=Wt(n.instanceId,Dn.Rotate);g.onMounted(()=>{window.dispatchEvent(new CustomEvent(Wt(n.instanceId,Dn.AnnotationMounted))),window.addEventListener(R,J)});function J(O){const{firstPageRotation:P,rotation:B}=O.detail;i.value=B!==0}g.watch(i,O=>{O&&(l.textSelection=!1,l.freeText=!1,l.signature=!1,T())});const N=O=>{const{id:P,...B}=O;return{...B,id:P?.startsWith(cu)?null:P}};return g.watch(()=>n.onAnnotationCreated,(O,P,B)=>{if(!O)return;const U=le=>{O(N(le.detail))},ie=Wt(n.instanceId,Dn.AnnotationCreated);window.addEventListener(ie,U),B(()=>{window.removeEventListener(ie,U)})},{immediate:!0}),g.watch(()=>n.onAnnotationUpdated,(O,P,B)=>{if(!O)return;const U=le=>{O(N(le.detail))},ie=Wt(n.instanceId,Dn.AnnotationUpdated);window.addEventListener(ie,U),B(()=>{window.removeEventListener(ie,U)})},{immediate:!0}),g.watch(()=>n.onAnnotationDeleted,(O,P,B)=>{if(!O)return;const U=le=>{O(N(le.detail))},ie=Wt(n.instanceId,Dn.AnnotationDeleted);window.addEventListener(ie,U),B(()=>{window.removeEventListener(ie,U)})},{immediate:!0}),g.onUnmounted(()=>{window.removeEventListener(R,J)}),(O,P)=>(g.openBlock(),g.createElementBlock("div",Au,[g.createVNode(pu,{onToggle:_}),g.createVNode(g.Transition,{name:"slide"},{default:g.withCtx(()=>[c.value?(g.openBlock(),g.createElementBlock("div",Cu,[u.value?(g.openBlock(),g.createBlock(bu,{key:0,active:a.value,"onUpdate:active":P[0]||(P[0]=B=>a.value=B),"aria-disabled":i.value},g.createSlots({_:2},[typeof n.textSelection=="object"&&n.textSelection.icon?{name:"icon",fn:g.withCtx(()=>[typeof n.textSelection=="object"&&n.textSelection.icon?(g.openBlock(),g.createBlock(g.resolveDynamicComponent(n.textSelection.icon),{key:0})):g.createCommentVNode("",!0)]),key:"0"}:typeof n.textSelection=="object"&&n.textSelection.component?{name:"default",fn:g.withCtx(({onClick:B})=>[typeof n.textSelection=="object"&&n.textSelection.component?(g.openBlock(),g.createBlock(g.resolveDynamicComponent(n.textSelection.component),{key:0,onClick:B},null,8,["onClick"])):g.createCommentVNode("",!0)]),key:"1"}:void 0]),1032,["active","aria-disabled"])):g.createCommentVNode("",!0),d.value?(g.openBlock(),g.createBlock(wu,{key:1,active:h.value,"onUpdate:active":P[1]||(P[1]=B=>h.value=B),"aria-disabled":i.value},g.createSlots({_:2},[typeof n.freeText=="object"&&n.freeText.icon?{name:"icon",fn:g.withCtx(()=>[typeof n.freeText=="object"&&n.freeText.icon?(g.openBlock(),g.createBlock(g.resolveDynamicComponent(n.freeText.icon),{key:0})):g.createCommentVNode("",!0),typeof n.freeText=="object"&&n.freeText.icon?(g.openBlock(),g.createBlock(g.resolveDynamicComponent(n.freeText.icon),{key:1})):g.createCommentVNode("",!0)]),key:"0"}:typeof n.freeText=="object"&&n.freeText.component?{name:"default",fn:g.withCtx(({onClick:B})=>[typeof n.freeText=="object"&&n.freeText.component?(g.openBlock(),g.createBlock(g.resolveDynamicComponent(n.freeText.component),{key:0,onClick:B},null,8,["onClick"])):g.createCommentVNode("",!0)]),key:"1"}:void 0]),1032,["active","aria-disabled"])):g.createCommentVNode("",!0),w.value?(g.openBlock(),g.createBlock(xu,{key:2,onChange:I,"aria-disabled":i.value},g.createSlots({_:2},[typeof n.image=="object"&&n.image?{name:"icon",fn:g.withCtx(()=>[typeof n.image=="object"&&n.image.icon?(g.openBlock(),g.createBlock(g.resolveDynamicComponent(n.image.icon),{key:0})):g.createCommentVNode("",!0)]),key:"0"}:typeof n.image=="object"&&n.image&&"component"in n.image?{name:"default",fn:g.withCtx(({onClick:B})=>[typeof n.image=="object"&&n.image&&"component"in n.image?(g.openBlock(),g.createBlock(g.resolveDynamicComponent(n.image.component),{key:0,onClick:B},null,8,["onClick"])):g.createCommentVNode("",!0)]),key:"1"}:void 0]),1032,["aria-disabled"])):g.createCommentVNode("",!0),y.value?(g.openBlock(),g.createBlock(_u,{key:3,active:f.value,"onUpdate:active":P[2]||(P[2]=B=>f.value=B),"aria-disabled":i.value},g.createSlots({_:2},[typeof n.signature=="object"&&n.signature.icon?{name:"icon",fn:g.withCtx(()=>[typeof n.signature=="object"&&n.signature.icon?(g.openBlock(),g.createBlock(g.resolveDynamicComponent(n.signature.icon),{key:0})):g.createCommentVNode("",!0)]),key:"0"}:typeof n.signature=="object"&&n.signature.component?{name:"default",fn:g.withCtx(({onClick:B})=>[typeof n.signature=="object"&&n.signature.component?(g.openBlock(),g.createBlock(g.resolveDynamicComponent(n.signature.component),{key:0,onClick:B},null,8,["onClick"])):g.createCommentVNode("",!0)]),key:"1"}:void 0]),1032,["active","aria-disabled"])):g.createCommentVNode("",!0)])):g.createCommentVNode("",!0)]),_:1})]))}}),r0="",gc=fo(Bu,[["__scopeId","data-v-f01943e3"]]),Du=(e={})=>{const{textSelection:t,freeText:n,image:r,...i}=e;let o=null;return{name:"annotation",setup(s){const{componentInstance:c,shared:l}=s,a=c?.uid??0;s.toolbar.addItem({id:ru.ANNOTATIONS,toolbarDirection:"left",component:g.h(gc,{textSelection:t,freeText:n,image:r,instanceId:a,...i})});const h=c?.appContext.app;l.ui?h.provide(Bn,l.ui):console.warn("VPdfAnnotationPlugin - No UI context found in plugin context"),l.localization?.value?h.provide(fc,l.localization):console.warn("VPdfAnnotationPlugin - No localization found in plugin context"),l.pdf||console.warn("VPdfAnnotationPlugin - PDF context not available"),o={exportToPdf:async(f,u)=>{const d=await l.pdf?.getOriginalBytes();if(!d)return console.error("[exportToPdf] originalBytes is null - cannot serialize text markup annotations. Check if PDF source type is supported."),null;try{const y=await lu.serializeAnnotationsToPdf(d,f,u);return console.debug("[exportToPdf] Serialization successful, result size:",y.byteLength),y}catch(y){throw console.error("[exportToPdf] Serialization failed:",y),y}}}},getApi:()=>o}},Tu={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"none",viewBox:"0 0 20 20"};function pc(e,t){return g.openBlock(),g.createElementBlock("svg",Tu,[...t[0]||(t[0]=[g.createElementVNode("path",{stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"1.25",d:"M10 18.334a8.333 8.333 0 1 0 0-16.667 8.333 8.333 0 0 0 0 16.667"},null,-1),g.createElementVNode("path",{stroke:"currentColor","stroke-linejoin":"round","stroke-width":"1.25",d:"m5.417 17.084 1.171-4.394c.238-.892.357-1.338.694-1.597s.798-.259 1.722-.259h1.992c.923 0 1.385 0 1.722.259.337.258.456.705.693 1.597l1.172 4.394"},null,-1),g.createElementVNode("path",{stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"1.25",d:"M7.917 10.834 9.23 7.8c.327-.756.491-1.134.769-1.134s.441.378.77 1.134l1.313 3.033"},null,-1)])])}const Eu=Object.freeze(Object.defineProperty({__proto__:null,render:pc,default:{render:pc}},Symbol.toStringTag,{value:"Module"})),Pu={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"none",viewBox:"0 0 20 20"};function bc(e,t){return g.openBlock(),g.createElementBlock("svg",Pu,[...t[0]||(t[0]=[g.createElementVNode("path",{fill:"currentColor",d:"M18.125 9.688a7.82 7.82 0 0 1-7.812 7.812H3.75a1.25 1.25 0 0 1-1.25-1.25V9.688a7.812 7.812 0 0 1 15.625 0m-1.25 0a6.563 6.563 0 0 0-13.125 0v6.562h6.563a6.57 6.57 0 0 0 6.562-6.562"},null,-1),g.createElementVNode("path",{fill:"currentColor",d:"M12.5 10a.624.624 0 0 1-.625.625h-1.25v1.25a.624.624 0 1 1-1.25 0v-1.25h-1.25a.625.625 0 1 1 0-1.25h1.25v-1.25a.625.625 0 0 1 1.25 0v1.25h1.25A.625.625 0 0 1 12.5 10"},null,-1)])])}const Ru=Object.freeze(Object.defineProperty({__proto__:null,render:bc,default:{render:bc}},Symbol.toStringTag,{value:"Module"})),Iu={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"none",viewBox:"0 0 20 20"};function mc(e,t){return g.openBlock(),g.createElementBlock("svg",Iu,[...t[0]||(t[0]=[g.createElementVNode("path",{fill:"currentColor",d:"M11.458 13.75a.624.624 0 1 0 0-1.25h-.625v-5h2.5v.625a.625.625 0 0 0 1.25 0v-1.25a.625.625 0 0 0-.625-.625h-7.5a.625.625 0 0 0-.625.625v1.25a.625.625 0 0 0 1.25 0V7.5h2.5v5h-.625a.625.625 0 1 0 0 1.25z"},null,-1),g.createElementVNode("path",{fill:"currentColor","fill-rule":"evenodd",d:"M3.125 3.75c0-.115.093-.208.208-.208h13.334c.115 0 .208.093.208.208v2.917a.625.625 0 1 0 1.25 0V3.75c0-.805-.653-1.458-1.458-1.458H3.333c-.805 0-1.458.653-1.458 1.458v3.334a.625.625 0 1 0 1.25 0zm0 12.5c0 .115.093.209.208.209h13.334a.21.21 0 0 0 .208-.209v-2.916a.625.625 0 1 1 1.25 0v2.916c0 .806-.653 1.459-1.458 1.459H3.333a1.46 1.46 0 0 1-1.458-1.459v-3.333a.625.625 0 1 1 1.25 0zM2.5 8.542c.345 0 .625.28.625.625v1.667a.625.625 0 0 1-1.25 0V9.167c0-.345.28-.625.625-.625m15.625.625a.625.625 0 1 0-1.25 0v1.667a.625.625 0 0 0 1.25 0z","clip-rule":"evenodd"},null,-1)])])}const Ou=Object.freeze(Object.defineProperty({__proto__:null,render:mc,default:{render:mc}},Symbol.toStringTag,{value:"Module"})),zu={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"none",viewBox:"0 0 20 20"};function yc(e,t){return g.openBlock(),g.createElementBlock("svg",zu,[...t[0]||(t[0]=[g.createElementVNode("g",{"clip-path":"url(#a)"},[g.createElementVNode("path",{fill:"currentColor",d:"M19.818 8.308a.625.625 0 0 0-.885 0L15 12.242 8.384 5.625l3.934-3.932a.626.626 0 0 0-.885-.885L7.5 4.742a1.25 1.25 0 0 0-.22 1.47L5.625 7.866a1.25 1.25 0 0 0 0 1.767l.367.366-4.559 4.558a.625.625 0 0 0 .245 1.035l5.625 1.875a.62.62 0 0 0 .437-.015.6.6 0 0 0 .203-.136l2.682-2.683.367.366a1.25 1.25 0 0 0 1.767 0l1.656-1.654a1.25 1.25 0 0 0 1.469-.22l3.934-3.933a.626.626 0 0 0 0-.885M7.332 16.16l-4.297-1.433 3.84-3.843 2.867 2.866zm4.543-2.043L6.51 8.75l1.616-1.616 5.367 5.366z"})],-1),g.createElementVNode("defs",null,[g.createElementVNode("clipPath",{id:"a"},[g.createElementVNode("path",{fill:"currentColor",d:"M0 0h20v20H0z"})])],-1)])])}const Fu=Object.freeze(Object.defineProperty({__proto__:null,render:yc,default:{render:yc}},Symbol.toStringTag,{value:"Module"})),Nu={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"none",viewBox:"0 0 20 20"};function _c(e,t){return g.openBlock(),g.createElementBlock("svg",Nu,[...t[0]||(t[0]=[g.createElementVNode("path",{fill:"currentColor",d:"M16.875 3.125H3.125a1.25 1.25 0 0 0-1.25 1.25v11.25a1.25 1.25 0 0 0 1.25 1.25h13.75a1.25 1.25 0 0 0 1.25-1.25V4.375a1.25 1.25 0 0 0-1.25-1.25m0 1.25v8.027l-2.037-2.036a1.25 1.25 0 0 0-1.768 0l-1.562 1.563L8.07 8.49a1.25 1.25 0 0 0-1.767 0L3.125 11.67V4.376zm-13.75 9.063 4.063-4.063 6.25 6.25H3.124zm13.75 2.187h-1.67l-2.812-2.812 1.563-1.563 2.919 2.92zM11.25 7.813a.938.938 0 1 1 1.875 0 .938.938 0 0 1-1.875 0"},null,-1)])])}const Mu=Object.freeze(Object.defineProperty({__proto__:null,render:_c,default:{render:_c}},Symbol.toStringTag,{value:"Module"})),Lu={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"none",viewBox:"0 0 20 20"};function wc(e,t){return g.openBlock(),g.createElementBlock("svg",Lu,[...t[0]||(t[0]=[g.createElementVNode("path",{fill:"currentColor",d:"M18.125 13.125H4.99q.313-.615.625-1.259c1.172.13 2.546-.685 4.114-2.432.391 1.051 1.13 2.416 2.39 2.441.707.014 1.414-.406 2.142-1.279.53.634 1.623 1.279 3.865 1.279a.625.625 0 1 0 0-1.25c-2.377 0-3.08-.816-3.125-1.259a.6.6 0 0 0-.426-.605.636.636 0 0 0-.723.273c-.943 1.448-1.514 1.596-1.713 1.591-.645-.012-1.301-1.525-1.526-2.61a.625.625 0 0 0-1.1-.264c-1.579 1.98-2.637 2.646-3.295 2.818.663-1.474 1.158-2.768 1.475-3.858.533-1.831.572-3.112.118-3.914-.234-.42-.73-.922-1.723-.922-1.255 0-2.245 1.186-2.716 3.254-.28 1.227-.327 2.594-.127 3.75.2 1.155.615 1.996 1.218 2.495a72 72 0 0 1-.877 1.751h-1.71a.625.625 0 1 0 0 1.25h1.048c-.884 1.64-1.572 2.784-1.583 2.803a.625.625 0 1 0 1.071.644c.012-.02.88-1.468 1.93-3.447h13.784a.625.625 0 1 0 0-1.25M4.59 5.407c.311-1.365.914-2.282 1.498-2.282.416 0 .555.145.635.287.235.416.51 1.89-1.692 6.749-.645-.881-.865-2.895-.44-4.754"},null,-1)])])}const ju=Object.freeze(Object.defineProperty({__proto__:null,render:wc,default:{render:wc}},Symbol.toStringTag,{value:"Module"})),Uu={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"none",viewBox:"0 0 20 20"};function xc(e,t){return g.openBlock(),g.createElementBlock("svg",Uu,[...t[0]||(t[0]=[g.createElementVNode("path",{fill:"currentColor",d:"M17.5 10a.624.624 0 0 1-.625.625h-3.13c.718.556 1.255 1.344 1.255 2.5 0 1.042-.547 2.008-1.543 2.718-.931.666-2.16 1.032-3.457 1.032-1.298 0-2.526-.366-3.457-1.032C5.547 15.133 5 14.167 5 13.125a.625.625 0 1 1 1.25 0c0 1.355 1.719 2.5 3.75 2.5s3.75-1.145 3.75-2.5c0-1.16-.823-1.842-3.029-2.5H3.125a.625.625 0 1 1 0-1.25h13.75A.625.625 0 0 1 17.5 10M5.963 8.125a.625.625 0 0 0 .595-.82 1.4 1.4 0 0 1-.065-.43c0-1.425 1.508-2.5 3.507-2.5 1.472 0 2.669.58 3.203 1.55a.625.625 0 0 0 1.094-.6c-.756-1.378-2.362-2.2-4.297-2.2-2.712 0-4.757 1.612-4.757 3.75-.001.278.041.555.127.82a.625.625 0 0 0 .593.43"},null,-1)])])}const $u=Object.freeze(Object.defineProperty({__proto__:null,render:xc,default:{render:xc}},Symbol.toStringTag,{value:"Module"})),Hu={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"none",viewBox:"0 0 20 20"};function Sc(e,t){return g.openBlock(),g.createElementBlock("svg",Hu,[...t[0]||(t[0]=[g.createElementVNode("path",{fill:"currentColor",d:"M17.916 14.568c.345 0 .625.28.625.625V17.9c0 .345-.28.625-.625.625H2.083a.625.625 0 0 1-.625-.625v-2.708c0-.345.28-.625.625-.625zM2.708 17.276h14.583v-1.458H2.708zm8.333-15.428a.626.626 0 0 1 .88.887L8.39 6.242l3.525 3.524 3.584-3.558a.626.626 0 0 1 .88.887l-4.057 4.03a.63.63 0 0 1-.633.15v.001h.004l.002.002-.018-.004a1 1 0 0 0-.125-.02 2 2 0 0 0-.534.015c-.457.07-1.144.312-1.92 1.07a.625.625 0 0 1-.873 0l-.07-.069-1.173 1.09a.63.63 0 0 1-.426.166H3.75a.625.625 0 0 1-.444-1.065l2.487-2.5-.045-.044a.626.626 0 0 1 0-.894c.775-.757 1.018-1.425 1.09-1.862.035-.224.029-.4.016-.512a1 1 0 0 0-.02-.118l-.004-.012v.001l.002.002V6.52a.63.63 0 0 1 .15-.643zM5.254 12.276h1.058l.948-.88-.444-.435-.13-.127zm6.444-.998h-.003zM8.014 7.634c-.131.537-.412 1.162-.958 1.814l1.627 1.591c.648-.523 1.267-.8 1.802-.934z"},null,-1)])])}const Gu=Object.freeze(Object.defineProperty({__proto__:null,render:Sc,default:{render:Sc}},Symbol.toStringTag,{value:"Module"})),Vu={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"none",viewBox:"0 0 20 20"};function vc(e,t){return g.openBlock(),g.createElementBlock("svg",Vu,[...t[0]||(t[0]=[g.createElementVNode("path",{fill:"currentColor",d:"M15.625 17.5a.624.624 0 0 1-.625.625H5a.625.625 0 1 1 0-1.25h10a.624.624 0 0 1 .625.625M10 15.625a5.005 5.005 0 0 0 5-5v-6.25a.625.625 0 1 0-1.25 0v6.25a3.75 3.75 0 0 1-7.5 0v-6.25a.625.625 0 0 0-1.25 0v6.25a5.005 5.005 0 0 0 5 5"},null,-1)])])}const Wu=Object.freeze(Object.defineProperty({__proto__:null,render:vc,default:{render:vc}},Symbol.toStringTag,{value:"Module"}));de.VPdfAnnotationTools=gc,de.default=Du,Object.defineProperties(de,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
14
+ %%EOF`}sizeInBytes(){return 16+this.lastXRefOffset.length}copyBytesInto(e,t){const n=t;return e[t++]=m.s,e[t++]=m.t,e[t++]=m.a,e[t++]=m.r,e[t++]=m.t,e[t++]=m.x,e[t++]=m.r,e[t++]=m.e,e[t++]=m.f,e[t++]=m.Newline,t+=be(this.lastXRefOffset,e,t),e[t++]=m.Newline,e[t++]=m.Percent,e[t++]=m.Percent,e[t++]=m.E,e[t++]=m.O,e[t++]=m.F,t-n}};let Qn=fa;b(Qn,"forLastCrossRefSectionOffset",e=>new fa(e));const ua=class{constructor(e){b(this,"dict"),this.dict=e}toString(){return`trailer
15
+ ${this.dict.toString()}`}sizeInBytes(){return 8+this.dict.sizeInBytes()}copyBytesInto(e,t){const n=t;return e[t++]=m.t,e[t++]=m.r,e[t++]=m.a,e[t++]=m.i,e[t++]=m.l,e[t++]=m.e,e[t++]=m.r,e[t++]=m.Newline,t+=this.dict.copyBytesInto(e,t),t-n}};let ga=ua;b(ga,"of",e=>new ua(e));const xi=class extends mi{constructor(e,t,n=!0){super(e.obj({}),n),b(this,"objects"),b(this,"offsets"),b(this,"offsetsString"),this.objects=t,this.offsets=this.computeObjectOffsets(),this.offsetsString=this.computeOffsetsString(),this.dict.set(p.of("Type"),p.of("ObjStm")),this.dict.set(p.of("N"),$.of(this.objects.length)),this.dict.set(p.of("First"),$.of(this.offsetsString.length))}getObjectsCount(){return this.objects.length}clone(e){return xi.withContextAndObjects(e||this.dict.context,this.objects.slice(),this.encode)}getContentsString(){let e=this.offsetsString;for(let t=0,n=this.objects.length;t<n;t++){const[,r]=this.objects[t];e+=`${r}
16
+ `}return e}getUnencodedContents(){const e=new Uint8Array(this.getUnencodedContentsSize());let t=be(this.offsetsString,e,0);for(let n=0,r=this.objects.length;n<r;n++){const[,i]=this.objects[n];t+=i.copyBytesInto(e,t),e[t++]=m.Newline}return e}getUnencodedContentsSize(){return this.offsetsString.length+In(this.offsets)[1]+In(this.objects)[1].sizeInBytes()+1}computeOffsetsString(){let e="";for(let t=0,n=this.offsets.length;t<n;t++){const[r,i]=this.offsets[t];e+=`${r} ${i} `}return e}computeObjectOffsets(){let e=0;const t=new Array(this.objects.length);for(let n=0,r=this.objects.length;n<r;n++){const[i,o]=this.objects[n];t[n]=[i.objectNumber,e],e+=o.sizeInBytes()+1}return t}};let Si=xi;b(Si,"withContextAndObjects",(e,t,n=!0)=>new xi(e,t,n));const pa=class{constructor(e,t){b(this,"context"),b(this,"objectsPerTick"),b(this,"parsedObjects",0),b(this,"shouldWaitForTick",n=>(this.parsedObjects+=n,this.parsedObjects%this.objectsPerTick===0)),this.context=e,this.objectsPerTick=t}async serializeToBuffer(){const{size:e,header:t,indirectObjects:n,xref:r,trailerDict:i,trailer:o}=await this.computeBufferSize();let s=0;const c=new Uint8Array(e);s+=t.copyBytesInto(c,s),c[s++]=m.Newline,c[s++]=m.Newline;for(let l=0,a=n.length;l<a;l++){const[h,f]=n[l],u=String(h.objectNumber);s+=be(u,c,s),c[s++]=m.Space;const d=String(h.generationNumber);s+=be(d,c,s),c[s++]=m.Space,c[s++]=m.o,c[s++]=m.b,c[s++]=m.j,c[s++]=m.Newline,s+=f.copyBytesInto(c,s),c[s++]=m.Newline,c[s++]=m.e,c[s++]=m.n,c[s++]=m.d,c[s++]=m.o,c[s++]=m.b,c[s++]=m.j,c[s++]=m.Newline,c[s++]=m.Newline;const y=f instanceof Si?f.getObjectsCount():1;this.shouldWaitForTick(y)&&await kt()}return r&&(s+=r.copyBytesInto(c,s),c[s++]=m.Newline),i&&(s+=i.copyBytesInto(c,s),c[s++]=m.Newline,c[s++]=m.Newline),s+=o.copyBytesInto(c,s),c}computeIndirectObjectSize([e,t]){const n=e.sizeInBytes()+3,r=t.sizeInBytes()+9;return n+r}createTrailerDict(){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})}async computeBufferSize(){const e=bn.forVersion(1,7);let t=e.sizeInBytes()+2;const n=Jn.create(),r=this.context.enumerateIndirectObjects();for(let c=0,l=r.length;c<l;c++){const a=r[c],[h]=a;n.addEntry(h,t),t+=this.computeIndirectObjectSize(a),this.shouldWaitForTick(1)&&await kt()}const i=t;t+=n.sizeInBytes()+1;const o=ga.of(this.createTrailerDict());t+=o.sizeInBytes()+2;const s=Qn.forLastCrossRefSectionOffset(i);return t+=s.sizeInBytes(),{size:t,header:e,indirectObjects:r,xref:n,trailerDict:o,trailer:s}}};let vi=pa;b(vi,"forContext",(e,t)=>new pa(e,t));const er=class extends _e{constructor(e){super(),b(this,"value"),this.value=e}asBytes(){const e=[];let t="",n=!1;const r=i=>{i!==void 0&&e.push(i),n=!1};for(let i=0,o=this.value.length;i<o;i++){const s=this.value[i],c=H(s),l=this.value[i+1];n?c===m.Newline||c===m.CarriageReturn?r():c===m.n?r(m.Newline):c===m.r?r(m.CarriageReturn):c===m.t?r(m.Tab):c===m.b?r(m.Backspace):c===m.f?r(m.FormFeed):c===m.LeftParen?r(m.LeftParen):c===m.RightParen?r(m.RightParen):c===m.Backspace?r(m.BackSlash):c>=m.Zero&&c<=m.Seven?(t+=s,(t.length===3||!(l>="0"&&l<="7"))&&(r(parseInt(t,8)),t="")):r(c):c===m.BackSlash?n=!0:r(c)}return new Uint8Array(e)}decodeText(){const e=this.asBytes();return To(e)?ko(e):So(e)}decodeDate(){const e=this.decodeText(),t=_o(e);if(!t)throw new Ro(e);return t}asString(){return this.value}clone(){return er.of(this.value)}toString(){return`(${this.value})`}sizeInBytes(){return this.value.length+2}copyBytesInto(e,t){return e[t++]=m.LeftParen,t+=be(this.value,e,t),e[t++]=m.RightParen,this.value.length+2}};let ee=er;b(ee,"of",e=>new er(e)),b(ee,"fromDate",e=>{const t=ze(String(e.getUTCFullYear()),4,"0"),n=ze(String(e.getUTCMonth()+1),2,"0"),r=ze(String(e.getUTCDate()),2,"0"),i=ze(String(e.getUTCHours()),2,"0"),o=ze(String(e.getUTCMinutes()),2,"0"),s=ze(String(e.getUTCSeconds()),2,"0");return new er(`D:${t}${n}${r}${i}${o}${s}Z`)});class tr{constructor(t,n,r){b(this,"bytes"),b(this,"start"),b(this,"pos"),b(this,"end"),this.bytes=t,this.start=n||0,this.pos=this.start,this.end=!!n&&!!r?n+r:this.bytes.length}get length(){return this.end-this.start}get isEmpty(){return this.length===0}getByte(){return this.pos>=this.end?-1:this.bytes[this.pos++]}getUint16(){const t=this.getByte(),n=this.getByte();return t===-1||n===-1?-1:(t<<8)+n}getInt32(){const t=this.getByte(),n=this.getByte(),r=this.getByte(),i=this.getByte();return(t<<24)+(n<<16)+(r<<8)+i}getBytes(t,n=!1){const r=this.bytes,i=this.pos,o=this.end;if(t){let s=i+t;s>o&&(s=o),this.pos=s;const c=r.subarray(i,s);return n?new Uint8ClampedArray(c):c}else{const s=r.subarray(i,o);return n?new Uint8ClampedArray(s):s}}peekByte(){const t=this.getByte();return this.pos--,t}peekBytes(t,n=!1){const r=this.getBytes(t,n);return this.pos-=r.length,r}skip(t){t||(t=1),this.pos+=t}reset(){this.pos=this.start}moveStart(){this.start=this.pos}makeSubStream(t,n){return new tr(this.bytes,t,n)}decode(){return this.bytes}}const sf=new Uint8Array(0);class mn{constructor(t){if(b(this,"bufferLength"),b(this,"buffer"),b(this,"eof"),b(this,"pos"),b(this,"minBufferLength"),this.pos=0,this.bufferLength=0,this.eof=!1,this.buffer=sf,this.minBufferLength=512,t)for(;this.minBufferLength<t;)this.minBufferLength*=2}get isEmpty(){for(;!this.eof&&this.bufferLength===0;)this.readBlock();return this.bufferLength===0}getByte(){const t=this.pos;for(;this.bufferLength<=t;){if(this.eof)return-1;this.readBlock()}return this.buffer[this.pos++]}getUint16(){const t=this.getByte(),n=this.getByte();return t===-1||n===-1?-1:(t<<8)+n}getInt32(){const t=this.getByte(),n=this.getByte(),r=this.getByte(),i=this.getByte();return(t<<24)+(n<<16)+(r<<8)+i}getBytes(t,n=!1){let r;const i=this.pos;if(t){for(this.ensureBuffer(i+t),r=i+t;!this.eof&&this.bufferLength<r;)this.readBlock();const s=this.bufferLength;r>s&&(r=s)}else{for(;!this.eof;)this.readBlock();r=this.bufferLength}this.pos=r;const o=this.buffer.subarray(i,r);return n&&!(o instanceof Uint8ClampedArray)?new Uint8ClampedArray(o):o}peekByte(){const t=this.getByte();return this.pos--,t}peekBytes(t,n=!1){const r=this.getBytes(t,n);return this.pos-=r.length,r}skip(t){t||(t=1),this.pos+=t}reset(){this.pos=0}makeSubStream(t,n){const r=t+n;for(;this.bufferLength<=r&&!this.eof;)this.readBlock();return new tr(this.buffer,t,n)}decode(){for(;!this.eof;)this.readBlock();return this.buffer.subarray(0,this.bufferLength)}readBlock(){throw new Le(this.constructor.name,"readBlock")}ensureBuffer(t){const n=this.buffer;if(t<=n.byteLength)return n;let r=this.minBufferLength;for(;r<t;)r*=2;const i=new Uint8Array(r);return i.set(n),this.buffer=i}}const ba=e=>e===32||e===9||e===13||e===10;class af extends mn{constructor(t,n){super(n),b(this,"stream"),b(this,"input"),this.stream=t,this.input=new Uint8Array(5),n&&(n=.8*n)}readBlock(){const i=this.stream;let o=i.getByte();for(;ba(o);)o=i.getByte();if(o===-1||o===126){this.eof=!0;return}const s=this.bufferLength;let c,l;if(o===122){for(c=this.ensureBuffer(s+4),l=0;l<4;++l)c[s+l]=0;this.bufferLength+=4}else{const a=this.input;for(a[0]=o,l=1;l<5;++l){for(o=i.getByte();ba(o);)o=i.getByte();if(a[l]=o,o===-1||o===126)break}if(c=this.ensureBuffer(s+l-1),this.bufferLength+=l-1,l<5){for(;l<5;++l)a[l]=33+84;this.eof=!0}let h=0;for(l=0;l<5;++l)h=h*85+(a[l]-33);for(l=3;l>=0;--l)c[s+l]=h&255,h>>=8}}}class cf extends mn{constructor(t,n){super(n),b(this,"stream"),b(this,"firstDigit"),this.stream=t,this.firstDigit=-1,n&&(n=.5*n)}readBlock(){const n=this.stream.getBytes(8e3);if(!n.length){this.eof=!0;return}const r=n.length+1>>1,i=this.ensureBuffer(this.bufferLength+r);let o=this.bufferLength,s=this.firstDigit;for(let c=0,l=n.length;c<l;c++){const a=n[c];let h;if(a>=48&&a<=57)h=a&15;else if(a>=65&&a<=70||a>=97&&a<=102)h=(a&15)+9;else if(a===62){this.eof=!0;break}else continue;s<0?s=h:(i[o++]=s<<4|h,s=-1)}s>=0&&this.eof&&(i[o++]=s<<4,s=-1),this.firstDigit=s,this.bufferLength=o}}const ma=new Int32Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),lf=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]),hf=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]),df=[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],ff=[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];class uf extends mn{constructor(t,n){super(n),b(this,"stream"),b(this,"codeSize"),b(this,"codeBuf"),this.stream=t;const r=t.getByte(),i=t.getByte();if(r===-1||i===-1)throw new Error(`Invalid header in flate stream: ${r}, ${i}`);if((r&15)!==8)throw new Error(`Unknown compression method in flate stream: ${r}, ${i}`);if(((r<<8)+i)%31!==0)throw new Error(`Bad FCHECK in flate stream: ${r}, ${i}`);if(i&32)throw new Error(`FDICT bit set in flate stream: ${r}, ${i}`);this.codeSize=0,this.codeBuf=0}readBlock(){let t,n;const r=this.stream;let i=this.getBits(3);if(i&1&&(this.eof=!0),i>>=1,i===0){let a;if((a=r.getByte())===-1)throw new Error("Bad block header in flate stream");let h=a;if((a=r.getByte())===-1)throw new Error("Bad block header in flate stream");if(h|=a<<8,(a=r.getByte())===-1)throw new Error("Bad block header in flate stream");let f=a;if((a=r.getByte())===-1)throw new Error("Bad block header in flate stream");if(f|=a<<8,f!==(~h&65535)&&(h!==0||f!==0))throw new Error("Bad uncompressed block length in flate stream");this.codeBuf=0,this.codeSize=0;const u=this.bufferLength;t=this.ensureBuffer(u+h);const d=u+h;if(this.bufferLength=d,h===0)r.peekByte()===-1&&(this.eof=!0);else for(let y=u;y<d;++y){if((a=r.getByte())===-1){this.eof=!0;break}t[y]=a}return}let o,s;if(i===1)o=df,s=ff;else if(i===2){const a=this.getBits(5)+257,h=this.getBits(5)+1,f=this.getBits(4)+4,u=new Uint8Array(ma.length);let d;for(d=0;d<f;++d)u[ma[d]]=this.getBits(3);const y=this.generateHuffmanTable(u);n=0,d=0;const w=a+h,x=new Uint8Array(w);let _,E,v;for(;d<w;){const S=this.getCode(y);if(S===16)_=2,E=3,v=n;else if(S===17)_=3,E=3,v=n=0;else if(S===18)_=7,E=11,v=n=0;else{x[d++]=n=S;continue}let z=this.getBits(_)+E;for(;z-- >0;)x[d++]=v}o=this.generateHuffmanTable(x.subarray(0,a)),s=this.generateHuffmanTable(x.subarray(a,w))}else throw new Error("Unknown block type in flate stream");t=this.buffer;let c=t?t.length:0,l=this.bufferLength;for(;;){let a=this.getCode(o);if(a<256){l+1>=c&&(t=this.ensureBuffer(l+1),c=t.length),t[l++]=a;continue}if(a===256){this.bufferLength=l;return}a-=257,a=lf[a];let h=a>>16;h>0&&(h=this.getBits(h)),n=(a&65535)+h,a=this.getCode(s),a=hf[a],h=a>>16,h>0&&(h=this.getBits(h));const f=(a&65535)+h;l+n>=c&&(t=this.ensureBuffer(l+n),c=t.length);for(let u=0;u<n;++u,++l)t[l]=t[l-f]}}getBits(t){const n=this.stream;let r=this.codeSize,i=this.codeBuf,o;for(;r<t;){if((o=n.getByte())===-1)throw new Error("Bad encoding in flate stream");i|=o<<r,r+=8}return o=i&(1<<t)-1,this.codeBuf=i>>t,this.codeSize=r-=t,o}getCode(t){const n=this.stream,r=t[0],i=t[1];let o=this.codeSize,s=this.codeBuf,c;for(;o<i&&(c=n.getByte())!==-1;)s|=c<<o,o+=8;const l=r[s&(1<<i)-1];typeof r=="number"&&console.log("FLATE:",l);const a=l>>16,h=l&65535;if(a<1||o<a)throw new Error("Bad encoding in flate stream");return this.codeBuf=s>>a,this.codeSize=o-a,h}generateHuffmanTable(t){const n=t.length;let r=0,i;for(i=0;i<n;++i)t[i]>r&&(r=t[i]);const o=1<<r,s=new Int32Array(o);for(let c=1,l=0,a=2;c<=r;++c,l<<=1,a<<=1)for(let h=0;h<n;++h)if(t[h]===c){let f=0,u=l;for(i=0;i<c;++i)f=f<<1|u&1,u>>=1;for(i=f;i<o;i+=a)s[i]=c<<16|h;++l}return[s,r]}}class gf extends mn{constructor(t,n,r){super(n),b(this,"stream"),b(this,"cachedData"),b(this,"bitsCached"),b(this,"lzwState"),this.stream=t,this.cachedData=0,this.bitsCached=0;const i=4096,o={earlyChange:r,codeLength:9,nextCode:258,dictionaryValues:new Uint8Array(i),dictionaryLengths:new Uint16Array(i),dictionaryPrevCodes:new Uint16Array(i),currentSequence:new Uint8Array(i),currentSequenceLength:0};for(let s=0;s<256;++s)o.dictionaryValues[s]=s,o.dictionaryLengths[s]=1;this.lzwState=o}readBlock(){let n=1024;const r=512;let i,o,s;const c=this.lzwState;if(!c)return;const l=c.earlyChange;let a=c.nextCode;const h=c.dictionaryValues,f=c.dictionaryLengths,u=c.dictionaryPrevCodes;let d=c.codeLength,y=c.prevCode;const w=c.currentSequence;let x=c.currentSequenceLength,_=0,E=this.bufferLength,v=this.ensureBuffer(this.bufferLength+n);for(i=0;i<512;i++){const S=this.readBits(d),z=x>0;if(!S||S<256)w[0]=S,x=1;else if(S>=258)if(S<a)for(x=f[S],o=x-1,s=S;o>=0;o--)w[o]=h[s],s=u[s];else w[x++]=w[0];else if(S===256){d=9,a=258,x=0;continue}else{this.eof=!0,delete this.lzwState;break}if(z&&(u[a]=y,f[a]=f[y]+1,h[a]=w[0],a++,d=a+l&a+l-1?d:Math.min(Math.log(a+l)/.6931471805599453+1,12)|0),y=S,_+=x,n<_){do n+=r;while(n<_);v=this.ensureBuffer(this.bufferLength+n)}for(o=0;o<x;o++)v[E++]=w[o]}c.nextCode=a,c.codeLength=d,c.prevCode=y,c.currentSequenceLength=x,this.bufferLength=E}readBits(t){let n=this.bitsCached,r=this.cachedData;for(;n<t;){const i=this.stream.getByte();if(i===-1)return this.eof=!0,null;r=r<<8|i,n+=8}return this.bitsCached=n-=t,this.cachedData=r,r>>>n&(1<<t)-1}}class pf extends mn{constructor(t,n){super(n),b(this,"stream"),this.stream=t}readBlock(){const t=this.stream.getBytes(2);if(!t||t.length<2||t[0]===128){this.eof=!0;return}let n,r=this.bufferLength,i=t[0];if(i<128){if(n=this.ensureBuffer(r+i+1),n[r++]=t[1],i>0){const o=this.stream.getBytes(i);n.set(o,r),r+=i}}else{i=257-i;const o=t[1];n=this.ensureBuffer(r+i+1);for(let s=0;s<i;s++)n[r++]=o}this.bufferLength=r}}const ya=(e,t,n)=>{if(t===p.of("FlateDecode"))return new uf(e);if(t===p.of("LZWDecode")){let r=1;if(n instanceof V){const i=n.lookup(p.of("EarlyChange"));i instanceof $&&(r=i.asNumber())}return new gf(e,void 0,r)}if(t===p.of("ASCII85Decode"))return new af(e);if(t===p.of("ASCIIHexDecode"))return new cf(e);if(t===p.of("RunLengthDecode"))return new pf(e);throw new qc(t.asString())},_a=({dict:e,contents:t})=>{let n=new tr(t);const r=e.lookup(p.of("Filter")),i=e.lookup(p.of("DecodeParms"));if(r instanceof p)n=ya(n,r,i);else if(r instanceof q)for(let o=0,s=r.size();o<s;o++)n=ya(n,r.lookup(o,p),i&&i.lookupMaybe(o,V));else if(r)throw new Er([p,q],r);return n},bf=e=>{const t=e.MediaBox(),n=t.lookup(2,$).asNumber()-t.lookup(0,$).asNumber(),r=t.lookup(3,$).asNumber()-t.lookup(1,$).asNumber();return{left:0,bottom:0,right:n,top:r}},mf=e=>[1,0,0,1,-e.left,-e.bottom];class ki{constructor(t,n,r){b(this,"width"),b(this,"height"),b(this,"boundingBox"),b(this,"transformationMatrix"),b(this,"page"),this.page=t;const i=n??bf(t);this.width=i.right-i.left,this.height=i.top-i.bottom,this.boundingBox=i,this.transformationMatrix=r??mf(i)}static async for(t,n,r){return new ki(t,n,r)}async embedIntoContext(t,n){const{Contents:r,Resources:i}=this.page.normalizedEntries();if(!r)throw new Xc;const o=this.decodeContents(r),{left:s,bottom:c,right:l,top:a}=this.boundingBox,h=t.flateStream(o,{Type:"XObject",Subtype:"Form",FormType:1,BBox:[s,c,l,a],Matrix:this.transformationMatrix,Resources:i});return n?(t.assign(n,h),n):t.register(h)}decodeContents(t){const n=Uint8Array.of(m.Newline),r=[];for(let i=0,o=t.size();i<o;i++){const s=t.lookup(i,ct);let c;if(s instanceof zt)c=_a(s).decode();else if(s instanceof Ft)c=s.getUnencodedContents();else throw new Yc(s);r.push(c,n)}return Rc(...r)}}const Ai=class extends _e{constructor(e){super(),b(this,"data"),this.data=e}clone(){return Ai.of(this.data.slice())}toString(){return`PDFInvalidObject(${this.data.length} bytes)`}sizeInBytes(){return this.data.length}copyBytesInto(e,t){const n=this.data.length;for(let r=0;r<n;r++)e[t++]=this.data[r];return n}};let Ci=Ai;b(Ci,"of",e=>new Ai(e));const nr=class extends mi{constructor(e,t,n=!0){super(e,n),b(this,"entries"),b(this,"entryTuplesCache"),b(this,"maxByteWidthsCache"),b(this,"indexCache"),b(this,"computeIndex",()=>{const r=[];let i=0;for(let o=0,s=this.entries.length;o<s;o++){const c=this.entries[o],l=this.entries[o-1];o===0?r.push(c.ref.objectNumber):c.ref.objectNumber-l.ref.objectNumber>1&&(r.push(i),r.push(c.ref.objectNumber),i=0),i+=1}return r.push(i),r}),b(this,"computeEntryTuples",()=>{const r=new Array(this.entries.length);for(let i=0,o=this.entries.length;i<o;i++){const s=this.entries[i];if(s.type===0){const{type:c,nextFreeObjectNumber:l,ref:a}=s;r[i]=[c,l,a.generationNumber]}if(s.type===1){const{type:c,offset:l,ref:a}=s;r[i]=[c,l,a.generationNumber]}if(s.type===2){const{type:c,objectStreamRef:l,index:a}=s;r[i]=[c,l.objectNumber,a]}}return r}),b(this,"computeMaxEntryByteWidths",()=>{const r=this.entryTuplesCache.access(),i=[0,0,0];for(let o=0,s=r.length;o<s;o++){const[c,l,a]=r[o],h=zn(c),f=zn(l),u=zn(a);h>i[0]&&(i[0]=h),f>i[1]&&(i[1]=f),u>i[2]&&(i[2]=u)}return i}),this.entries=t||[],this.entryTuplesCache=At.populatedBy(this.computeEntryTuples),this.maxByteWidthsCache=At.populatedBy(this.computeMaxEntryByteWidths),this.indexCache=At.populatedBy(this.computeIndex),e.set(p.of("Type"),p.of("XRef"))}addDeletedEntry(e,t){this.entries.push({type:0,ref:e,nextFreeObjectNumber:t}),this.entryTuplesCache.invalidate(),this.maxByteWidthsCache.invalidate(),this.indexCache.invalidate(),this.contentsCache.invalidate()}addUncompressedEntry(e,t){this.entries.push({type:1,ref:e,offset:t}),this.entryTuplesCache.invalidate(),this.maxByteWidthsCache.invalidate(),this.indexCache.invalidate(),this.contentsCache.invalidate()}addCompressedEntry(e,t,n){this.entries.push({type:2,ref:e,objectStreamRef:t,index:n}),this.entryTuplesCache.invalidate(),this.maxByteWidthsCache.invalidate(),this.indexCache.invalidate(),this.contentsCache.invalidate()}clone(e){const{dict:t,entries:n,encode:r}=this;return nr.of(t.clone(e),n.slice(),r)}getContentsString(){const e=this.entryTuplesCache.access(),t=this.maxByteWidthsCache.access();let n="";for(let r=0,i=e.length;r<i;r++){const[o,s,c]=e[r],l=vt(Ct(o)),a=vt(Ct(s)),h=vt(Ct(c));for(let f=t[0]-1;f>=0;f--)n+=(l[f]||0).toString(2);for(let f=t[1]-1;f>=0;f--)n+=(a[f]||0).toString(2);for(let f=t[2]-1;f>=0;f--)n+=(h[f]||0).toString(2)}return n}getUnencodedContents(){const e=this.entryTuplesCache.access(),t=this.maxByteWidthsCache.access(),n=new Uint8Array(this.getUnencodedContentsSize());let r=0;for(let i=0,o=e.length;i<o;i++){const[s,c,l]=e[i],a=vt(Ct(s)),h=vt(Ct(c)),f=vt(Ct(l));for(let u=t[0]-1;u>=0;u--)n[r++]=a[u]||0;for(let u=t[1]-1;u>=0;u--)n[r++]=h[u]||0;for(let u=t[2]-1;u>=0;u--)n[r++]=f[u]||0}return n}getUnencodedContentsSize(){const e=this.maxByteWidthsCache.access();return Ic(e)*this.entries.length}updateDict(){super.updateDict();const e=this.maxByteWidthsCache.access(),t=this.indexCache.access(),{context:n}=this.dict;this.dict.set(p.of("W"),n.obj(e)),this.dict.set(p.of("Index"),n.obj(t))}};let Bi=nr;b(Bi,"create",(e,t=!0)=>{const n=new nr(e,[],t);return n.addDeletedEntry(oe.of(0,65535),0),n}),b(Bi,"of",(e,t,n=!0)=>new nr(e,t,n));const wa=class extends vi{constructor(e,t,n,r){super(e,t),b(this,"encodeStreams"),b(this,"objectsPerStream"),this.encodeStreams=n,this.objectsPerStream=r}async computeBufferSize(){let e=this.context.largestObjectNumber+1;const t=bn.forVersion(1,7);let n=t.sizeInBytes()+2;const r=Bi.create(this.createTrailerDict(),this.encodeStreams),i=[],o=[],s=[],c=this.context.enumerateIndirectObjects();for(let f=0,u=c.length;f<u;f++){const d=c[f],[y,w]=d;if(y===this.context.trailerInfo.Encrypt||w instanceof ct||w instanceof Ci||y.generationNumber!==0)i.push(d),r.addUncompressedEntry(y,n),n+=this.computeIndirectObjectSize(d),this.shouldWaitForTick(1)&&await kt();else{let _=In(o),E=In(s);(!_||_.length%this.objectsPerStream===0)&&(_=[],o.push(_),E=oe.of(e++),s.push(E)),r.addCompressedEntry(y,E,_.length),_.push(d)}}for(let f=0,u=o.length;f<u;f++){const d=o[f],y=s[f],w=Si.withContextAndObjects(this.context,d,this.encodeStreams);r.addUncompressedEntry(y,n),n+=this.computeIndirectObjectSize([y,w]),i.push([y,w]),this.shouldWaitForTick(d.length)&&await kt()}const l=oe.of(e++);r.dict.set(p.of("Size"),$.of(e)),r.addUncompressedEntry(l,n);const a=n;n+=this.computeIndirectObjectSize([l,r]),i.push([l,r]);const h=Qn.forLastCrossRefSectionOffset(a);return n+=h.sizeInBytes(),{size:n,header:t,indirectObjects:i,trailer:h}}};let xa=wa;b(xa,"forContext",(e,t,n=!0,r=50)=>new wa(e,t,n,r));const Sa=[65472,65473,65474,65475,65477,65478,65479,65480,65481,65482,65483,65484,65485,65486,65487],yf={1:"DeviceGray",3:"DeviceRGB",4:"DeviceCMYK"};class Di{constructor(t,n,r,i,o){b(this,"bitsPerComponent"),b(this,"height"),b(this,"width"),b(this,"colorSpace"),b(this,"imageData"),this.imageData=t,this.bitsPerComponent=n,this.width=r,this.height=i,this.colorSpace=o}static async for(t){const n=new DataView(t.buffer);if(n.getUint16(0)!==65496)throw new Error("SOI not found in JPEG");let i=2,o;for(;i<n.byteLength&&(o=n.getUint16(i),i+=2,!Sa.includes(o));)i+=n.getUint16(i);if(!Sa.includes(o))throw new Error("Invalid JPEG");i+=2;const s=n.getUint8(i++),c=n.getUint16(i);i+=2;const l=n.getUint16(i);i+=2;const a=n.getUint8(i++),h=yf[a];if(!h)throw new Error("Unknown JPEG channel.");const f=h;return new Di(t,s,l,c,f)}async embedIntoContext(t,n){const r=t.stream(this.imageData,{Type:"XObject",Subtype:"Image",BitsPerComponent:this.bitsPerComponent,Width:this.width,Height:this.height,ColorSpace:this.colorSpace,Filter:"DCTDecode",Decode:this.colorSpace==="DeviceCMYK"?[1,0,1,0,1,0,1,0]:void 0});return n?(t.assign(n,r),n):t.register(r)}}var A={};A.toRGBA8=function(e){var t=e.width,n=e.height;if(e.tabs.acTL==null)return[A.toRGBA8.decodeImage(e.data,t,n,e).buffer];var r=[];e.frames[0].data==null&&(e.frames[0].data=e.data);for(var i=t*n*4,o=new Uint8Array(i),s=new Uint8Array(i),c=new Uint8Array(i),l=0;l<e.frames.length;l++){var a=e.frames[l],h=a.rect.x,f=a.rect.y,u=a.rect.width,d=a.rect.height,y=A.toRGBA8.decodeImage(a.data,u,d,e);if(l!=0)for(var w=0;w<i;w++)c[w]=o[w];if(a.blend==0?A._copyTile(y,u,d,o,t,n,h,f,0):a.blend==1&&A._copyTile(y,u,d,o,t,n,h,f,1),r.push(o.buffer.slice(0)),a.dispose!=0){if(a.dispose==1)A._copyTile(s,u,d,o,t,n,h,f,0);else if(a.dispose==2)for(var w=0;w<i;w++)o[w]=c[w]}}return r},A.toRGBA8.decodeImage=function(e,t,n,r){var i=t*n,o=A.decode._getBPP(r),s=Math.ceil(t*o/8),c=new Uint8Array(i*4),l=new Uint32Array(c.buffer),a=r.ctype,h=r.depth,f=A._bin.readUshort;if(a==6){var u=i<<2;if(h==8)for(var d=0;d<u;d+=4)c[d]=e[d],c[d+1]=e[d+1],c[d+2]=e[d+2],c[d+3]=e[d+3];if(h==16)for(var d=0;d<u;d++)c[d]=e[d<<1]}else if(a==2){var y=r.tabs.tRNS;if(y==null){if(h==8)for(var d=0;d<i;d++){var w=d*3;l[d]=255<<24|e[w+2]<<16|e[w+1]<<8|e[w]}if(h==16)for(var d=0;d<i;d++){var w=d*6;l[d]=255<<24|e[w+4]<<16|e[w+2]<<8|e[w]}}else{var x=y[0],_=y[1],E=y[2];if(h==8)for(var d=0;d<i;d++){var v=d<<2,w=d*3;l[d]=255<<24|e[w+2]<<16|e[w+1]<<8|e[w],e[w]==x&&e[w+1]==_&&e[w+2]==E&&(c[v+3]=0)}if(h==16)for(var d=0;d<i;d++){var v=d<<2,w=d*6;l[d]=255<<24|e[w+4]<<16|e[w+2]<<8|e[w],f(e,w)==x&&f(e,w+2)==_&&f(e,w+4)==E&&(c[v+3]=0)}}}else if(a==3){var S=r.tabs.PLTE,z=r.tabs.tRNS,C=z?z.length:0;if(h==1)for(var k=0;k<n;k++)for(var F=k*s,I=k*t,d=0;d<t;d++){var v=I+d<<2,T=e[F+(d>>3)]>>7-((d&7)<<0)&1,R=3*T;c[v]=S[R],c[v+1]=S[R+1],c[v+2]=S[R+2],c[v+3]=T<C?z[T]:255}if(h==2)for(var k=0;k<n;k++)for(var F=k*s,I=k*t,d=0;d<t;d++){var v=I+d<<2,T=e[F+(d>>2)]>>6-((d&3)<<1)&3,R=3*T;c[v]=S[R],c[v+1]=S[R+1],c[v+2]=S[R+2],c[v+3]=T<C?z[T]:255}if(h==4)for(var k=0;k<n;k++)for(var F=k*s,I=k*t,d=0;d<t;d++){var v=I+d<<2,T=e[F+(d>>1)]>>4-((d&1)<<2)&15,R=3*T;c[v]=S[R],c[v+1]=S[R+1],c[v+2]=S[R+2],c[v+3]=T<C?z[T]:255}if(h==8)for(var d=0;d<i;d++){var v=d<<2,T=e[d],R=3*T;c[v]=S[R],c[v+1]=S[R+1],c[v+2]=S[R+2],c[v+3]=T<C?z[T]:255}}else if(a==4){if(h==8)for(var d=0;d<i;d++){var v=d<<2,J=d<<1,N=e[J];c[v]=N,c[v+1]=N,c[v+2]=N,c[v+3]=e[J+1]}if(h==16)for(var d=0;d<i;d++){var v=d<<2,J=d<<2,N=e[J];c[v]=N,c[v+1]=N,c[v+2]=N,c[v+3]=e[J+2]}}else if(a==0)for(var x=r.tabs.tRNS?r.tabs.tRNS:-1,k=0;k<n;k++){var O=k*s,P=k*t;if(h==1)for(var B=0;B<t;B++){var N=255*(e[O+(B>>>3)]>>>7-(B&7)&1),U=N==x*255?0:255;l[P+B]=U<<24|N<<16|N<<8|N}else if(h==2)for(var B=0;B<t;B++){var N=85*(e[O+(B>>>2)]>>>6-((B&3)<<1)&3),U=N==x*85?0:255;l[P+B]=U<<24|N<<16|N<<8|N}else if(h==4)for(var B=0;B<t;B++){var N=17*(e[O+(B>>>1)]>>>4-((B&1)<<2)&15),U=N==x*17?0:255;l[P+B]=U<<24|N<<16|N<<8|N}else if(h==8)for(var B=0;B<t;B++){var N=e[O+B],U=N==x?0:255;l[P+B]=U<<24|N<<16|N<<8|N}else if(h==16)for(var B=0;B<t;B++){var N=e[O+(B<<1)],U=f(e,O+(B<<d))==x?0:255;l[P+B]=U<<24|N<<16|N<<8|N}}return c},A.decode=function(e){for(var t=new Uint8Array(e),n=8,r=A._bin,i=r.readUshort,o=r.readUint,s={tabs:{},frames:[]},c=new Uint8Array(t.length),l=0,a,h=0,f=[137,80,78,71,13,10,26,10],u=0;u<8;u++)if(t[u]!=f[u])throw"The input is not a PNG file!";for(;n<t.length;){var d=r.readUint(t,n);n+=4;var y=r.readASCII(t,n,4);if(n+=4,y=="IHDR")A.decode._IHDR(t,n,s);else if(y=="IDAT"){for(var u=0;u<d;u++)c[l+u]=t[n+u];l+=d}else if(y=="acTL")s.tabs[y]={num_frames:o(t,n),num_plays:o(t,n+4)},a=new Uint8Array(t.length);else if(y=="fcTL"){if(h!=0){var w=s.frames[s.frames.length-1];w.data=A.decode._decompress(s,a.slice(0,h),w.rect.width,w.rect.height),h=0}var x={x:o(t,n+12),y:o(t,n+16),width:o(t,n+4),height:o(t,n+8)},_=i(t,n+22);_=i(t,n+20)/(_==0?100:_);var E={rect:x,delay:Math.round(_*1e3),dispose:t[n+24],blend:t[n+25]};s.frames.push(E)}else if(y=="fdAT"){for(var u=0;u<d-4;u++)a[h+u]=t[n+u+4];h+=d-4}else if(y=="pHYs")s.tabs[y]=[r.readUint(t,n),r.readUint(t,n+4),t[n+8]];else if(y=="cHRM"){s.tabs[y]=[];for(var u=0;u<8;u++)s.tabs[y].push(r.readUint(t,n+u*4))}else if(y=="tEXt"){s.tabs[y]==null&&(s.tabs[y]={});var v=r.nextZero(t,n),S=r.readASCII(t,n,v-n),z=r.readASCII(t,v+1,n+d-v-1);s.tabs[y][S]=z}else if(y=="iTXt"){s.tabs[y]==null&&(s.tabs[y]={});var v=0,C=n;v=r.nextZero(t,C);var S=r.readASCII(t,C,v-C);C=v+1,t[C],t[C+1],C+=2,v=r.nextZero(t,C),r.readASCII(t,C,v-C),C=v+1,v=r.nextZero(t,C),r.readUTF8(t,C,v-C),C=v+1;var z=r.readUTF8(t,C,d-(C-n));s.tabs[y][S]=z}else if(y=="PLTE")s.tabs[y]=r.readBytes(t,n,d);else if(y=="hIST"){var k=s.tabs.PLTE.length/3;s.tabs[y]=[];for(var u=0;u<k;u++)s.tabs[y].push(i(t,n+u*2))}else if(y=="tRNS")s.ctype==3?s.tabs[y]=r.readBytes(t,n,d):s.ctype==0?s.tabs[y]=i(t,n):s.ctype==2&&(s.tabs[y]=[i(t,n),i(t,n+2),i(t,n+4)]);else if(y=="gAMA")s.tabs[y]=r.readUint(t,n)/1e5;else if(y=="sRGB")s.tabs[y]=t[n];else if(y=="bKGD")s.ctype==0||s.ctype==4?s.tabs[y]=[i(t,n)]:s.ctype==2||s.ctype==6?s.tabs[y]=[i(t,n),i(t,n+2),i(t,n+4)]:s.ctype==3&&(s.tabs[y]=t[n]);else if(y=="IEND")break;n+=d,r.readUint(t,n),n+=4}if(h!=0){var w=s.frames[s.frames.length-1];w.data=A.decode._decompress(s,a.slice(0,h),w.rect.width,w.rect.height),h=0}return s.data=A.decode._decompress(s,c,s.width,s.height),delete s.compress,delete s.interlace,delete s.filter,s},A.decode._decompress=function(e,t,n,r){var i=A.decode._getBPP(e),o=Math.ceil(n*i/8),s=new Uint8Array((o+1+e.interlace)*r);return t=A.decode._inflate(t,s),e.interlace==0?t=A.decode._filterZero(t,e,0,n,r):e.interlace==1&&(t=A.decode._readInterlace(t,e)),t},A.decode._inflate=function(e,t){var n=A.inflateRaw(new Uint8Array(e.buffer,2,e.length-6),t);return n},A.inflateRaw=function(){var e={};return e.H={},e.H.N=function(t,n){var r=Uint8Array,i=0,o=0,s=0,c=0,l=0,a=0,h=0,f=0,u=0,d,y;if(t[0]==3&&t[1]==0)return n||new r(0);var w=e.H,x=w.b,_=w.e,E=w.R,v=w.n,S=w.A,z=w.Z,C=w.m,k=n==null;for(k&&(n=new r(t.length>>>2<<3));i==0;){if(i=x(t,u,1),o=x(t,u+1,2),u+=3,o==0){(u&7)!=0&&(u+=8-(u&7));var F=(u>>>3)+4,I=t[F-4]|t[F-3]<<8;k&&(n=e.H.W(n,f+I)),n.set(new r(t.buffer,t.byteOffset+F,I),f),u=F+I<<3,f+=I;continue}if(k&&(n=e.H.W(n,f+(1<<17))),o==1&&(d=C.J,y=C.h,a=(1<<9)-1,h=(1<<5)-1),o==2){s=_(t,u,5)+257,c=_(t,u+5,5)+1,l=_(t,u+10,4)+4,u+=14;for(var T=1,R=0;R<38;R+=2)C.Q[R]=0,C.Q[R+1]=0;for(var R=0;R<l;R++){var J=_(t,u+R*3,3);C.Q[(C.X[R]<<1)+1]=J,J>T&&(T=J)}u+=3*l,v(C.Q,T),S(C.Q,T,C.u),d=C.w,y=C.d,u=E(C.u,(1<<T)-1,s+c,t,u,C.v);var N=w.V(C.v,0,s,C.C);a=(1<<N)-1;var O=w.V(C.v,s,c,C.D);h=(1<<O)-1,v(C.C,N),S(C.C,N,d),v(C.D,O),S(C.D,O,y)}for(;;){var P=d[z(t,u)&a];u+=P&15;var B=P>>>4;if(B>>>8==0)n[f++]=B;else{if(B==256)break;var U=f+B-254;if(B>264){var ie=C.q[B-257];U=f+(ie>>>3)+_(t,u,ie&7),u+=ie&7}var le=y[z(t,u)&h];u+=le&15;var pe=le>>>4,ke=C.c[pe],Oe=(ke>>>4)+x(t,u,ke&15);for(u+=ke&15;f<U;)n[f]=n[f++-Oe],n[f]=n[f++-Oe],n[f]=n[f++-Oe],n[f]=n[f++-Oe];f=U}}}return n.length==f?n:n.slice(0,f)},e.H.W=function(t,n){var r=t.length;if(n<=r)return t;var i=new Uint8Array(r<<1);return i.set(t,0),i},e.H.R=function(t,n,r,i,o,s){for(var c=e.H.e,l=e.H.Z,a=0;a<r;){var h=t[l(i,o)&n];o+=h&15;var f=h>>>4;if(f<=15)s[a]=f,a++;else{var u=0,d=0;f==16?(d=3+c(i,o,2),o+=2,u=s[a-1]):f==17?(d=3+c(i,o,3),o+=3):f==18&&(d=11+c(i,o,7),o+=7);for(var y=a+d;a<y;)s[a]=u,a++}}return o},e.H.V=function(t,n,r,i){for(var o=0,s=0,c=i.length>>>1;s<r;){var l=t[s+n];i[s<<1]=0,i[(s<<1)+1]=l,l>o&&(o=l),s++}for(;s<c;)i[s<<1]=0,i[(s<<1)+1]=0,s++;return o},e.H.n=function(t,n){for(var r=e.H.m,i=t.length,o,s,c,l,a,h=r.j,l=0;l<=n;l++)h[l]=0;for(l=1;l<i;l+=2)h[t[l]]++;var f=r.K;for(o=0,h[0]=0,s=1;s<=n;s++)o=o+h[s-1]<<1,f[s]=o;for(c=0;c<i;c+=2)a=t[c+1],a!=0&&(t[c]=f[a],f[a]++)},e.H.A=function(t,n,r){for(var i=t.length,o=e.H.m,s=o.r,c=0;c<i;c+=2)if(t[c+1]!=0)for(var l=c>>1,a=t[c+1],h=l<<4|a,f=n-a,u=t[c]<<f,d=u+(1<<f);u!=d;){var y=s[u]>>>15-n;r[y]=h,u++}},e.H.l=function(t,n){for(var r=e.H.m.r,i=15-n,o=0;o<t.length;o+=2){var s=t[o]<<n-t[o+1];t[o]=r[s]>>>i}},e.H.M=function(t,n,r){r=r<<(n&7);var i=n>>>3;t[i]|=r,t[i+1]|=r>>>8},e.H.I=function(t,n,r){r=r<<(n&7);var i=n>>>3;t[i]|=r,t[i+1]|=r>>>8,t[i+2]|=r>>>16},e.H.e=function(t,n,r){return(t[n>>>3]|t[(n>>>3)+1]<<8)>>>(n&7)&(1<<r)-1},e.H.b=function(t,n,r){return(t[n>>>3]|t[(n>>>3)+1]<<8|t[(n>>>3)+2]<<16)>>>(n&7)&(1<<r)-1},e.H.Z=function(t,n){return(t[n>>>3]|t[(n>>>3)+1]<<8|t[(n>>>3)+2]<<16)>>>(n&7)},e.H.i=function(t,n){return(t[n>>>3]|t[(n>>>3)+1]<<8|t[(n>>>3)+2]<<16|t[(n>>>3)+3]<<24)>>>(n&7)},e.H.m=function(){var t=Uint16Array,n=Uint32Array;return{K:new t(16),j:new t(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 t(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 n(32),J:new t(512),_:[],h:new t(32),$:[],w:new t(32768),C:[],v:[],d:new t(32768),D:[],u:new t(512),Q:[],r:new t(1<<15),s:new n(286),Y:new n(30),a:new n(19),t:new n(15e3),k:new t(1<<16),g:new t(1<<15)}}(),function(){for(var t=e.H.m,n=1<<15,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 o(s,c,l){for(;c--!=0;)s.push(0,l)}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];o(t._,144,8),o(t._,255-143,9),o(t._,279-255,7),o(t._,287-279,8),e.H.n(t._,9),e.H.A(t._,9,t.J),e.H.l(t._,9),o(t.$,32,5),e.H.n(t.$,5),e.H.A(t.$,5,t.h),e.H.l(t.$,5),o(t.Q,19,0),o(t.C,286,0),o(t.D,30,0),o(t.v,320,0)}(),e.H.N}(),A.decode._readInterlace=function(e,t){for(var n=t.width,r=t.height,i=A.decode._getBPP(t),o=i>>3,s=Math.ceil(n*i/8),c=new Uint8Array(r*s),l=0,a=[0,0,4,0,2,0,1],h=[0,4,0,2,0,1,0],f=[8,8,8,4,4,2,2],u=[8,8,4,4,2,2,1],d=0;d<7;){for(var y=f[d],w=u[d],x=0,_=0,E=a[d];E<r;)E+=y,_++;for(var v=h[d];v<n;)v+=w,x++;var S=Math.ceil(x*i/8);A.decode._filterZero(e,t,l,x,_);for(var z=0,C=a[d];C<r;){for(var k=h[d],F=l+z*S<<3;k<n;){if(i==1){var I=e[F>>3];I=I>>7-(F&7)&1,c[C*s+(k>>3)]|=I<<7-((k&7)<<0)}if(i==2){var I=e[F>>3];I=I>>6-(F&7)&3,c[C*s+(k>>2)]|=I<<6-((k&3)<<1)}if(i==4){var I=e[F>>3];I=I>>4-(F&7)&15,c[C*s+(k>>1)]|=I<<4-((k&1)<<2)}if(i>=8)for(var T=C*s+k*o,R=0;R<o;R++)c[T+R]=e[(F>>3)+R];F+=i,k+=w}z++,C+=y}x*_!=0&&(l+=_*(1+S)),d=d+1}return c},A.decode._getBPP=function(e){var t=[1,null,3,1,2,null,4][e.ctype];return t*e.depth},A.decode._filterZero=function(e,t,n,r,i){var o=A.decode._getBPP(t),s=Math.ceil(r*o/8),c=A.decode._paeth;o=Math.ceil(o/8);var l=0,a=1,h=e[n],f=0;if(h>1&&(e[n]=[0,0,1][h-2]),h==3)for(f=o;f<s;f++)e[f+1]=e[f+1]+(e[f+1-o]>>>1)&255;for(var u=0;u<i;u++)if(l=n+u*s,a=l+u+1,h=e[a-1],f=0,h==0)for(;f<s;f++)e[l+f]=e[a+f];else if(h==1){for(;f<o;f++)e[l+f]=e[a+f];for(;f<s;f++)e[l+f]=e[a+f]+e[l+f-o]}else if(h==2)for(;f<s;f++)e[l+f]=e[a+f]+e[l+f-s];else if(h==3){for(;f<o;f++)e[l+f]=e[a+f]+(e[l+f-s]>>>1);for(;f<s;f++)e[l+f]=e[a+f]+(e[l+f-s]+e[l+f-o]>>>1)}else{for(;f<o;f++)e[l+f]=e[a+f]+c(0,e[l+f-s],0);for(;f<s;f++)e[l+f]=e[a+f]+c(e[l+f-o],e[l+f-s],e[l+f-o-s])}return e},A.decode._paeth=function(e,t,n){var r=e+t-n,i=r-e,o=r-t,s=r-n;return i*i<=o*o&&i*i<=s*s?e:o*o<=s*s?t:n},A.decode._IHDR=function(e,t,n){var r=A._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++},A._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]*(256*256*256)+(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,o=0;o<n;o++)r+="%"+A._bin.pad(e[t+o].toString(16));try{i=decodeURIComponent(r)}catch{return A._bin.readASCII(e,t,n)}return i}},A._copyTile=function(e,t,n,r,i,o,s,c,l){for(var a=Math.min(t,i),h=Math.min(n,o),f=0,u=0,d=0;d<h;d++)for(var y=0;y<a;y++)if(s>=0&&c>=0?(f=d*t+y<<2,u=(c+d)*i+s+y<<2):(f=(-c+d)*t-s+y<<2,u=d*i+y<<2),l==0)r[u]=e[f],r[u+1]=e[f+1],r[u+2]=e[f+2],r[u+3]=e[f+3];else if(l==1){var w=e[f+3]*.00392156862745098,x=e[f]*w,_=e[f+1]*w,E=e[f+2]*w,v=r[u+3]*(1/255),S=r[u]*v,z=r[u+1]*v,C=r[u+2]*v,k=1-w,F=w+v*k,I=F==0?0:1/F;r[u+3]=255*F,r[u+0]=(x+S*k)*I,r[u+1]=(_+z*k)*I,r[u+2]=(E+C*k)*I}else if(l==2){var w=e[f+3],x=e[f],_=e[f+1],E=e[f+2],v=r[u+3],S=r[u],z=r[u+1],C=r[u+2];w==v&&x==S&&_==z&&E==C?(r[u]=0,r[u+1]=0,r[u+2]=0,r[u+3]=0):(r[u]=x,r[u+1]=_,r[u+2]=E,r[u+3]=w)}else if(l==3){var w=e[f+3],x=e[f],_=e[f+1],E=e[f+2],v=r[u+3],S=r[u],z=r[u+1],C=r[u+2];if(w==v&&x==S&&_==z&&E==C)continue;if(w<220&&v>20)return!1}return!0},A.encode=function(e,t,n,r,i,o,s){r==null&&(r=0),s==null&&(s=!1);var c=A.encode.compress(e,t,n,r,[!1,!1,!1,0,s]);return A.encode.compressPNG(c,-1),A.encode._main(c,t,n,i,o)},A.encodeLL=function(e,t,n,r,i,o,s,c){for(var l={ctype:0+(r==1?0:2)+(i==0?0:4),depth:o,frames:[]},a=(r+i)*o,h=a*t,f=0;f<e.length;f++)l.frames.push({rect:{x:0,y:0,width:t,height:n},img:new Uint8Array(e[f]),blend:0,dispose:1,bpp:Math.ceil(a/8),bpl:Math.ceil(h/8)});A.encode.compressPNG(l,0,!0);var u=A.encode._main(l,t,n,s,c);return u},A.encode._main=function(e,t,n,r,i){i==null&&(i={});var o=A.crc.crc,s=A._bin.writeUint,c=A._bin.writeUshort,l=A._bin.writeASCII,a=8,h=e.frames.length>1,f=!1,u=8+(16+5+4)+(h?20:0);if(i.sRGB!=null&&(u+=8+1+4),i.pHYs!=null&&(u+=8+9+4),e.ctype==3){for(var d=e.plte.length,y=0;y<d;y++)e.plte[y]>>>24!=255&&(f=!0);u+=8+d*3+4+(f?8+d*1+4:0)}for(var w=0;w<e.frames.length;w++){var x=e.frames[w];h&&(u+=38),u+=x.cimg.length+12,w!=0&&(u+=4)}u+=12;for(var _=new Uint8Array(u),E=[137,80,78,71,13,10,26,10],y=0;y<8;y++)_[y]=E[y];if(s(_,a,13),a+=4,l(_,a,"IHDR"),a+=4,s(_,a,t),a+=4,s(_,a,n),a+=4,_[a]=e.depth,a++,_[a]=e.ctype,a++,_[a]=0,a++,_[a]=0,a++,_[a]=0,a++,s(_,a,o(_,a-17,17)),a+=4,i.sRGB!=null&&(s(_,a,1),a+=4,l(_,a,"sRGB"),a+=4,_[a]=i.sRGB,a++,s(_,a,o(_,a-5,5)),a+=4),i.pHYs!=null&&(s(_,a,9),a+=4,l(_,a,"pHYs"),a+=4,s(_,a,i.pHYs[0]),a+=4,s(_,a,i.pHYs[1]),a+=4,_[a]=i.pHYs[2],a++,s(_,a,o(_,a-13,13)),a+=4),h&&(s(_,a,8),a+=4,l(_,a,"acTL"),a+=4,s(_,a,e.frames.length),a+=4,s(_,a,i.loop!=null?i.loop:0),a+=4,s(_,a,o(_,a-12,12)),a+=4),e.ctype==3){var d=e.plte.length;s(_,a,d*3),a+=4,l(_,a,"PLTE"),a+=4;for(var y=0;y<d;y++){var v=y*3,S=e.plte[y],z=S&255,C=S>>>8&255,k=S>>>16&255;_[a+v+0]=z,_[a+v+1]=C,_[a+v+2]=k}if(a+=d*3,s(_,a,o(_,a-d*3-4,d*3+4)),a+=4,f){s(_,a,d),a+=4,l(_,a,"tRNS"),a+=4;for(var y=0;y<d;y++)_[a+y]=e.plte[y]>>>24&255;a+=d,s(_,a,o(_,a-d-4,d+4)),a+=4}}for(var F=0,w=0;w<e.frames.length;w++){var x=e.frames[w];h&&(s(_,a,26),a+=4,l(_,a,"fcTL"),a+=4,s(_,a,F++),a+=4,s(_,a,x.rect.width),a+=4,s(_,a,x.rect.height),a+=4,s(_,a,x.rect.x),a+=4,s(_,a,x.rect.y),a+=4,c(_,a,r[w]),a+=2,c(_,a,1e3),a+=2,_[a]=x.dispose,a++,_[a]=x.blend,a++,s(_,a,o(_,a-30,30)),a+=4);var I=x.cimg,d=I.length;s(_,a,d+(w==0?0:4)),a+=4;var T=a;l(_,a,w==0?"IDAT":"fdAT"),a+=4,w!=0&&(s(_,a,F++),a+=4),_.set(I,a),a+=d,s(_,a,o(_,T,a-T)),a+=4}return s(_,a,0),a+=4,l(_,a,"IEND"),a+=4,s(_,a,o(_,a-4,4)),a+=4,_.buffer},A.encode.compressPNG=function(e,t,n){for(var r=0;r<e.frames.length;r++){var i=e.frames[r];i.rect.width;var o=i.rect.height,s=new Uint8Array(o*i.bpl+o);i.cimg=A.encode._filterZero(i.img,o,i.bpp,i.bpl,s,t,n)}},A.encode.compress=function(e,t,n,r,i){for(var o=i[0],s=i[1],c=i[2],l=i[3],a=i[4],h=6,f=8,u=255,d=0;d<e.length;d++)for(var y=new Uint8Array(e[d]),w=y.length,x=0;x<w;x+=4)u&=y[x+3];var _=u!=255,E=A.encode.framize(e,t,n,o,s,c),v={},S=[],z=[];if(r!=0){for(var C=[],x=0;x<E.length;x++)C.push(E[x].img.buffer);for(var k=A.encode.concatRGBA(C),F=A.quantize(k,r),I=0,T=new Uint8Array(F.abuf),x=0;x<E.length;x++){var R=E[x].img,J=R.length;z.push(new Uint8Array(F.inds.buffer,I>>2,J>>2));for(var d=0;d<J;d+=4)R[d]=T[I+d],R[d+1]=T[I+d+1],R[d+2]=T[I+d+2],R[d+3]=T[I+d+3];I+=J}for(var x=0;x<F.plte.length;x++)S.push(F.plte[x].est.rgba)}else for(var d=0;d<E.length;d++){var N=E[d],O=new Uint32Array(N.img.buffer),P=N.rect.width,w=O.length,B=new Uint8Array(w);z.push(B);for(var x=0;x<w;x++){var U=O[x];if(x!=0&&U==O[x-1])B[x]=B[x-1];else if(x>P&&U==O[x-P])B[x]=B[x-P];else{var ie=v[U];if(ie==null&&(v[U]=ie=S.length,S.push(U),S.length>=300))break;B[x]=ie}}}var le=S.length;le<=256&&a==!1&&(le<=2?f=1:le<=4?f=2:le<=16?f=4:f=8,f=Math.max(f,l));for(var d=0;d<E.length;d++){var N=E[d];N.rect.x,N.rect.y;var P=N.rect.width,pe=N.rect.height,ke=N.img;new Uint32Array(ke.buffer);var Oe=4*P,go=4;if(le<=256&&a==!1){Oe=Math.ceil(f*P/8);for(var We=new Uint8Array(Oe*pe),Ar=z[d],Cr=0;Cr<pe;Cr++){var x=Cr*Oe,Br=Cr*P;if(f==8)for(var he=0;he<P;he++)We[x+he]=Ar[Br+he];else if(f==4)for(var he=0;he<P;he++)We[x+(he>>1)]|=Ar[Br+he]<<4-(he&1)*4;else if(f==2)for(var he=0;he<P;he++)We[x+(he>>2)]|=Ar[Br+he]<<6-(he&3)*2;else if(f==1)for(var he=0;he<P;he++)We[x+(he>>3)]|=Ar[Br+he]<<7-(he&7)*1}ke=We,h=3,go=1}else if(_==!1&&E.length==1){for(var We=new Uint8Array(P*pe*3),Ku=P*pe,x=0;x<Ku;x++){var R=x*3,po=x*4;We[R]=ke[po],We[R+1]=ke[po+1],We[R+2]=ke[po+2]}ke=We,h=2,go=3,Oe=3*P}N.img=ke,N.bpl=Oe,N.bpp=go}return{ctype:h,depth:f,plte:S,frames:E}},A.encode.framize=function(e,t,n,r,i,o){for(var s=[],c=0;c<e.length;c++){var l=new Uint8Array(e[c]),a=new Uint32Array(l.buffer),h,f=0,u=0,d=t,y=n,w=r?1:0;if(c!=0){for(var x=o||r||c==1||s[c-2].dispose!=0?1:2,_=0,E=1e9,v=0;v<x;v++){for(var N=new Uint8Array(e[c-1-v]),S=new Uint32Array(e[c-1-v]),z=t,C=n,k=-1,F=-1,I=0;I<n;I++)for(var T=0;T<t;T++){var R=I*t+T;a[R]!=S[R]&&(T<z&&(z=T),T>k&&(k=T),I<C&&(C=I),I>F&&(F=I))}k==-1&&(z=C=k=F=0),i&&((z&1)==1&&z--,(C&1)==1&&C--);var J=(k-z+1)*(F-C+1);J<E&&(E=J,_=v,f=z,u=C,d=k-z+1,y=F-C+1)}var N=new Uint8Array(e[c-1-_]);_==1&&(s[c-1].dispose=2),h=new Uint8Array(d*y*4),A._copyTile(N,t,n,h,d,y,-f,-u,0),w=A._copyTile(l,t,n,h,d,y,-f,-u,3)?1:0,w==1?A.encode._prepareDiff(l,t,n,h,{x:f,y:u,width:d,height:y}):A._copyTile(l,t,n,h,d,y,-f,-u,0)}else h=l.slice(0);s.push({rect:{x:f,y:u,width:d,height:y},img:h,blend:w,dispose:0})}if(r)for(var c=0;c<s.length;c++){var O=s[c];if(O.blend!=1){var P=O.rect,B=s[c-1].rect,U=Math.min(P.x,B.x),ie=Math.min(P.y,B.y),le=Math.max(P.x+P.width,B.x+B.width),pe=Math.max(P.y+P.height,B.y+B.height),ke={x:U,y:ie,width:le-U,height:pe-ie};s[c-1].dispose=1,c-1!=0&&A.encode._updateFrame(e,t,n,s,c-1,ke,i),A.encode._updateFrame(e,t,n,s,c,ke,i)}}var Oe=0;if(e.length!=1)for(var R=0;R<s.length;R++){var O=s[R];Oe+=O.rect.width*O.rect.height}return s},A.encode._updateFrame=function(e,t,n,r,i,o,s){for(var c=Uint8Array,l=Uint32Array,a=new c(e[i-1]),h=new l(e[i-1]),f=i+1<e.length?new c(e[i+1]):null,u=new c(e[i]),d=new l(u.buffer),y=t,w=n,x=-1,_=-1,E=0;E<o.height;E++)for(var v=0;v<o.width;v++){var S=o.x+v,z=o.y+E,C=z*t+S,k=d[C];k==0||r[i-1].dispose==0&&h[C]==k&&(f==null||f[C*4+3]!=0)||(S<y&&(y=S),S>x&&(x=S),z<w&&(w=z),z>_&&(_=z))}x==-1&&(y=w=x=_=0),s&&((y&1)==1&&y--,(w&1)==1&&w--),o={x:y,y:w,width:x-y+1,height:_-w+1};var F=r[i];F.rect=o,F.blend=1,F.img=new Uint8Array(o.width*o.height*4),r[i-1].dispose==0?(A._copyTile(a,t,n,F.img,o.width,o.height,-o.x,-o.y,0),A.encode._prepareDiff(u,t,n,F.img,o)):A._copyTile(u,t,n,F.img,o.width,o.height,-o.x,-o.y,0)},A.encode._prepareDiff=function(e,t,n,r,i){A._copyTile(e,t,n,r,i.width,i.height,-i.x,-i.y,2)},A.encode._filterZero=function(e,t,n,r,i,o,s){var c=[],l=[0,1,2,3,4];o!=-1?l=[o]:(t*r>5e5||n==1)&&(l=[0]);var a;s&&(a={level:0});for(var h=s&&UZIP!=null?UZIP:fi,f=0;f<l.length;f++){for(var u=0;u<t;u++)A.encode._filterLine(i,e,u,r,n,l[f]);c.push(h.deflate(i,a))}for(var d,y=1e9,f=0;f<c.length;f++)c[f].length<y&&(d=f,y=c[f].length);return c[d]},A.encode._filterLine=function(e,t,n,r,i,o){var s=n*r,c=s+n,l=A.decode._paeth;if(e[c]=o,c++,o==0)if(r<500)for(var a=0;a<r;a++)e[c+a]=t[s+a];else e.set(new Uint8Array(t.buffer,s,r),c);else if(o==1){for(var a=0;a<i;a++)e[c+a]=t[s+a];for(var a=i;a<r;a++)e[c+a]=t[s+a]-t[s+a-i]+256&255}else if(n==0){for(var a=0;a<i;a++)e[c+a]=t[s+a];if(o==2)for(var a=i;a<r;a++)e[c+a]=t[s+a];if(o==3)for(var a=i;a<r;a++)e[c+a]=t[s+a]-(t[s+a-i]>>1)+256&255;if(o==4)for(var a=i;a<r;a++)e[c+a]=t[s+a]-l(t[s+a-i],0,0)+256&255}else{if(o==2)for(var a=0;a<r;a++)e[c+a]=t[s+a]+256-t[s+a-r]&255;if(o==3){for(var a=0;a<i;a++)e[c+a]=t[s+a]+256-(t[s+a-r]>>1)&255;for(var a=i;a<r;a++)e[c+a]=t[s+a]+256-(t[s+a-r]+t[s+a-i]>>1)&255}if(o==4){for(var a=0;a<i;a++)e[c+a]=t[s+a]+256-l(0,t[s+a-r],0)&255;for(var a=i;a<r;a++)e[c+a]=t[s+a]+256-l(t[s+a-i],t[s+a-r],t[s+a-i-r])&255}}},A.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=n>>>1;e[t]=n}return e}(),update:function(e,t,n,r){for(var i=0;i<r;i++)e=A.crc.table[(e^t[n+i])&255]^e>>>8;return e},crc:function(e,t,n){return A.crc.update(4294967295,e,t,n)^4294967295}},A.quantize=function(e,t){var n=new Uint8Array(e),r=n.slice(0),i=new Uint32Array(r.buffer),o=A.quantize.getKDtree(r,t),s=o[0],c=o[1];A.quantize.planeDst;for(var l=n,a=i,h=l.length,f=new Uint8Array(n.length>>2),u=0;u<h;u+=4){var d=l[u]*.00392156862745098,y=l[u+1]*(1/255),w=l[u+2]*(1/255),x=l[u+3]*(1/255),_=A.quantize.getNearest(s,d,y,w,x);f[u>>2]=_.ind,a[u>>2]=_.est.rgba}return{abuf:r.buffer,inds:f,plte:c}},A.quantize.getKDtree=function(e,t,n){n==null&&(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=A.quantize.stats(e,i.i0,i.i1),i.est=A.quantize.estats(i.bst);for(var o=[i];o.length<t;){for(var s=0,c=0,l=0;l<o.length;l++)o[l].est.L>s&&(s=o[l].est.L,c=l);if(s<n)break;var a=o[c],h=A.quantize.splitPixels(e,r,a.i0,a.i1,a.est.e,a.est.eMq255),f=a.i0>=h||a.i1<=h;if(f){a.est.L=0;continue}var u={i0:a.i0,i1:h,bst:null,est:null,tdst:0,left:null,right:null};u.bst=A.quantize.stats(e,u.i0,u.i1),u.est=A.quantize.estats(u.bst);var d={i0:h,i1:a.i1,bst:null,est:null,tdst:0,left:null,right:null};d.bst={R:[],m:[],N:a.bst.N-u.bst.N};for(var l=0;l<16;l++)d.bst.R[l]=a.bst.R[l]-u.bst.R[l];for(var l=0;l<4;l++)d.bst.m[l]=a.bst.m[l]-u.bst.m[l];d.est=A.quantize.estats(d.bst),a.left=u,a.right=d,o[c]=u,o.push(d)}o.sort(function(y,w){return w.bst.N-y.bst.N});for(var l=0;l<o.length;l++)o[l].ind=l;return[i,o]},A.quantize.getNearest=function(e,t,n,r,i){if(e.left==null)return e.tdst=A.quantize.dist(e.est.q,t,n,r,i),e;var o=A.quantize.planeDst(e.est,t,n,r,i),s=e.left,c=e.right;o>0&&(s=e.right,c=e.left);var l=A.quantize.getNearest(s,t,n,r,i);if(l.tdst<=o*o)return l;var a=A.quantize.getNearest(c,t,n,r,i);return a.tdst<l.tdst?a:l},A.quantize.planeDst=function(e,t,n,r,i){var o=e.e;return o[0]*t+o[1]*n+o[2]*r+o[3]*i-e.eMq},A.quantize.dist=function(e,t,n,r,i){var o=t-e[0],s=n-e[1],c=r-e[2],l=i-e[3];return o*o+s*s+c*c+l*l},A.quantize.splitPixels=function(e,t,n,r,i,o){var s=A.quantize.vecDot;for(r-=4;n<r;){for(;s(e,n,i)<=o;)n+=4;for(;s(e,r,i)>o;)r-=4;if(n>=r)break;var c=t[n>>2];t[n>>2]=t[r>>2],t[r>>2]=c,n+=4,r-=4}for(;s(e,n,i)>o;)n-=4;return n+4},A.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]},A.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],o=n-t>>2,s=t;s<n;s+=4){var c=e[s]*.00392156862745098,l=e[s+1]*(1/255),a=e[s+2]*(1/255),h=e[s+3]*(1/255);i[0]+=c,i[1]+=l,i[2]+=a,i[3]+=h,r[0]+=c*c,r[1]+=c*l,r[2]+=c*a,r[3]+=c*h,r[5]+=l*l,r[6]+=l*a,r[7]+=l*h,r[10]+=a*a,r[11]+=a*h,r[15]+=h*h}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:o}},A.quantize.estats=function(e){var t=e.R,n=e.m,r=e.N,i=n[0],o=n[1],s=n[2],c=n[3],l=r==0?0:1/r,a=[t[0]-i*i*l,t[1]-i*o*l,t[2]-i*s*l,t[3]-i*c*l,t[4]-o*i*l,t[5]-o*o*l,t[6]-o*s*l,t[7]-o*c*l,t[8]-s*i*l,t[9]-s*o*l,t[10]-s*s*l,t[11]-s*c*l,t[12]-c*i*l,t[13]-c*o*l,t[14]-c*s*l,t[15]-c*c*l],h=a,f=A.M4,u=[.5,.5,.5,.5],d=0,y=0;if(r!=0)for(var w=0;w<10&&(u=f.multVec(h,u),y=Math.sqrt(f.dot(u,u)),u=f.sml(1/y,u),!(Math.abs(y-d)<1e-9));w++)d=y;var x=[i*l,o*l,s*l,c*l],_=f.dot(f.sml(255,x),u);return{Cov:a,q:x,e:u,L:d,eMq255:_,eMq:f.dot(u,x),rgba:(Math.round(255*x[3])<<24|Math.round(255*x[2])<<16|Math.round(255*x[1])<<8|Math.round(255*x[0])<<0)>>>0}},A.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]]}},A.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 o=new Uint8Array(e[n]),s=o.length,c=0;c<s;c+=4){var l=o[c],a=o[c+1],h=o[c+2],f=o[c+3];f==0&&(l=a=h=0),r[i+c]=l,r[i+c+1]=a,r[i+c+2]=h,r[i+c+3]=f}i+=s}return r.buffer};const _f=e=>{if(e===0)return Nt.Greyscale;if(e===2)return Nt.Truecolour;if(e===3)return Nt.IndexedColour;if(e===4)return Nt.GreyscaleWithAlpha;if(e===6)return Nt.TruecolourWithAlpha;throw new Error(`Unknown color type: ${e}`)},wf=e=>{const t=Math.floor(e.length/4),n=new Uint8Array(t*3),r=new Uint8Array(t*1);let i=0,o=0,s=0;for(;i<e.length;)n[o++]=e[i++],n[o++]=e[i++],n[o++]=e[i++],r[s++]=e[i++];return{rgbChannel:n,alphaChannel:r}};var Nt=(e=>(e.Greyscale="Greyscale",e.Truecolour="Truecolour",e.IndexedColour="IndexedColour",e.GreyscaleWithAlpha="GreyscaleWithAlpha",e.TruecolourWithAlpha="TruecolourWithAlpha",e))(Nt||{});const va=class{constructor(e){b(this,"rgbChannel"),b(this,"alphaChannel"),b(this,"type"),b(this,"width"),b(this,"height"),b(this,"bitsPerComponent");const t=A.decode(e),n=A.toRGBA8(t);if(n.length>1)throw new Error("Animated PNGs are not supported");const r=new Uint8Array(n[0]),{rgbChannel:i,alphaChannel:o}=wf(r);this.rgbChannel=i,o.some(c=>c<255)&&(this.alphaChannel=o),this.type=_f(t.ctype),this.width=t.width,this.height=t.height,this.bitsPerComponent=8}};let ka=va;b(ka,"load",e=>new va(e));class Ti{constructor(t){b(this,"bitsPerComponent"),b(this,"height"),b(this,"width"),b(this,"colorSpace"),b(this,"image"),this.image=t,this.bitsPerComponent=t.bitsPerComponent,this.width=t.width,this.height=t.height,this.colorSpace="DeviceRGB"}static async for(t){const n=ka.load(t);return new Ti(n)}async embedIntoContext(t,n){const r=this.embedAlphaChannel(t),i=t.flateStream(this.image.rgbChannel,{Type:"XObject",Subtype:"Image",BitsPerComponent:this.image.bitsPerComponent,Width:this.image.width,Height:this.image.height,ColorSpace:this.colorSpace,SMask:r});return n?(t.assign(n,i),n):t.register(i)}embedAlphaChannel(t){if(!this.image.alphaChannel)return;const n=t.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 t.register(n)}}const xf=/\/([^\0\t\n\f\r\ ]+)[\0\t\n\f\r\ ]*(\d*\.\d+|\d+)?[\0\t\n\f\r\ ]+Tf/;class rr{constructor(t,n){b(this,"dict"),b(this,"ref"),this.dict=t,this.ref=n}T(){return this.dict.lookupMaybe(p.of("T"),ee,X)}Ff(){const t=this.getInheritableAttribute(p.of("Ff"));return this.dict.context.lookupMaybe(t,$)}V(){const t=this.getInheritableAttribute(p.of("V"));return this.dict.context.lookup(t)}Kids(){return this.dict.lookupMaybe(p.of("Kids"),q)}DA(){const t=this.dict.lookup(p.of("DA"));if(t instanceof ee||t instanceof X)return t}setKids(t){this.dict.set(p.of("Kids"),this.dict.context.obj(t))}getParent(){const t=this.dict.get(p.of("Parent"));if(t instanceof oe){const n=this.dict.lookup(p.of("Parent"),V);return new rr(n,t)}}setParent(t){t?this.dict.set(p.of("Parent"),t):this.dict.delete(p.of("Parent"))}getFullyQualifiedName(){const t=this.getParent();return t?`${t.getFullyQualifiedName()}.${this.getPartialName()}`:this.getPartialName()}getPartialName(){var t;return(t=this.T())==null?void 0:t.decodeText()}setPartialName(t){t?this.dict.set(p.of("T"),X.fromText(t)):this.dict.delete(p.of("T"))}setDefaultAppearance(t){this.dict.set(p.of("DA"),ee.of(t))}getDefaultAppearance(){const t=this.DA();return t instanceof X?t.decodeText():t?.asString()}setFontSize(t){var n;const r=(n=this.getFullyQualifiedName())!=null?n:"",i=this.getDefaultAppearance();if(!i)throw new el(r);const o=Pc(i,xf);if(!o.match)throw new tl(r);const s=i.slice(0,o.pos-o.match[0].length),c=o.pos<=i.length?i.slice(o.pos):"",l=o.match[1],a=`${s} /${l} ${t} Tf ${c}`;this.setDefaultAppearance(a)}getFlags(){var t,n;return(n=(t=this.Ff())==null?void 0:t.asNumber())!=null?n:0}setFlags(t){this.dict.set(p.of("Ff"),$.of(t))}hasFlag(t){return(this.getFlags()&t)!==0}setFlag(t){const n=this.getFlags();this.setFlags(n|t)}clearFlag(t){const n=this.getFlags();this.setFlags(n&~t)}setFlagTo(t,n){n?this.setFlag(t):this.clearFlag(t)}getInheritableAttribute(t){let n;return this.ascend(r=>{n||(n=r.dict.get(t))}),n}ascend(t){t(this);const n=this.getParent();n&&n.ascend(t)}}const Aa=class{constructor(e){b(this,"dict"),this.dict=e}W(){const e=this.dict.lookup(p.of("W"));if(e instanceof $)return e}getWidth(){var e,t;return(t=(e=this.W())==null?void 0:e.asNumber())!=null?t:1}setWidth(e){const t=this.dict.context.obj(e);this.dict.set(p.of("W"),t)}};let ir=Aa;b(ir,"fromDict",e=>new Aa(e));const Ca=class{constructor(e){b(this,"dict"),this.dict=e}Rect(){return this.dict.lookup(p.of("Rect"),q)}AP(){return this.dict.lookupMaybe(p.of("AP"),V)}F(){const e=this.dict.lookup(p.of("F"));return this.dict.context.lookupMaybe(e,$)}getRectangle(){var e;const t=this.Rect();return(e=t?.asRectangle())!=null?e:{x:0,y:0,width:0,height:0}}setRectangle(e){const{x:t,y:n,width:r,height:i}=e,o=this.dict.context.obj([t,n,t+r,n+i]);this.dict.set(p.of("Rect"),o)}getAppearanceState(){const e=this.dict.lookup(p.of("AS"));if(e instanceof p)return e}setAppearanceState(e){this.dict.set(p.of("AS"),e)}setAppearances(e){this.dict.set(p.of("AP"),e)}ensureAP(){let e=this.AP();return e||(e=this.dict.context.obj({}),this.dict.set(p.of("AP"),e)),e}getNormalAppearance(){const t=this.ensureAP().get(p.of("N"));if(t instanceof oe||t instanceof V)return t;throw new Error(`Unexpected N type: ${t?.constructor.name}`)}setNormalAppearance(e){this.ensureAP().set(p.of("N"),e)}setRolloverAppearance(e){this.ensureAP().set(p.of("R"),e)}setDownAppearance(e){this.ensureAP().set(p.of("D"),e)}removeRolloverAppearance(){const e=this.AP();e?.delete(p.of("R"))}removeDownAppearance(){const e=this.AP();e?.delete(p.of("D"))}getAppearances(){const e=this.AP();if(!e)return;const t=e.lookup(p.of("N"),V,ct),n=e.lookupMaybe(p.of("R"),V,ct),r=e.lookupMaybe(p.of("D"),V,ct);return{normal:t,rollover:n,down:r}}getFlags(){var e,t;return(t=(e=this.F())==null?void 0:e.asNumber())!=null?t:0}setFlags(e){this.dict.set(p.of("F"),$.of(e))}hasFlag(e){return(this.getFlags()&e)!==0}setFlag(e){const t=this.getFlags();this.setFlags(t|e)}clearFlag(e){const t=this.getFlags();this.setFlags(t&~e)}setFlagTo(e,t){t?this.setFlag(e):this.clearFlag(e)}};let Ba=Ca;b(Ba,"fromDict",e=>new Ca(e));const Da=class{constructor(e){b(this,"dict"),this.dict=e}R(){const e=this.dict.lookup(p.of("R"));if(e instanceof $)return e}BC(){const e=this.dict.lookup(p.of("BC"));if(e instanceof q)return e}BG(){const e=this.dict.lookup(p.of("BG"));if(e instanceof q)return e}CA(){const e=this.dict.lookup(p.of("CA"));if(e instanceof X||e instanceof ee)return e}RC(){const e=this.dict.lookup(p.of("RC"));if(e instanceof X||e instanceof ee)return e}AC(){const e=this.dict.lookup(p.of("AC"));if(e instanceof X||e instanceof ee)return e}getRotation(){var e;return(e=this.R())==null?void 0:e.asNumber()}getBorderColor(){const e=this.BC();if(!e)return;const t=[];for(let n=0,r=e?.size();n<r;n++){const i=e.get(n);i instanceof $&&t.push(i.asNumber())}return t}getBackgroundColor(){const e=this.BG();if(!e)return;const t=[];for(let n=0,r=e?.size();n<r;n++){const i=e.get(n);i instanceof $&&t.push(i.asNumber())}return t}getCaptions(){const e=this.CA(),t=this.RC(),n=this.AC();return{normal:e?.decodeText(),rollover:t?.decodeText(),down:n?.decodeText()}}setRotation(e){const t=this.dict.context.obj(e);this.dict.set(p.of("R"),t)}setBorderColor(e){const t=this.dict.context.obj(e);this.dict.set(p.of("BC"),t)}setBackgroundColor(e){const t=this.dict.context.obj(e);this.dict.set(p.of("BG"),t)}setCaptions(e){const t=X.fromText(e.normal);if(this.dict.set(p.of("CA"),t),e.rollover){const n=X.fromText(e.rollover);this.dict.set(p.of("RC"),n)}else this.dict.delete(p.of("RC"));if(e.down){const n=X.fromText(e.down);this.dict.set(p.of("AC"),n)}else this.dict.delete(p.of("AC"))}};let or=Da;b(or,"fromDict",e=>new Da(e));const Ei=class extends Ba{MK(){const e=this.dict.lookup(p.of("MK"));if(e instanceof V)return e}BS(){const e=this.dict.lookup(p.of("BS"));if(e instanceof V)return e}DA(){const e=this.dict.lookup(p.of("DA"));if(e instanceof ee||e instanceof X)return e}P(){const e=this.dict.get(p.of("P"));if(e instanceof oe)return e}setP(e){this.dict.set(p.of("P"),e)}setDefaultAppearance(e){this.dict.set(p.of("DA"),ee.of(e))}getDefaultAppearance(){const e=this.DA();return e instanceof X?e.decodeText():e?.asString()}getAppearanceCharacteristics(){const e=this.MK();if(e)return or.fromDict(e)}getOrCreateAppearanceCharacteristics(){const e=this.MK();if(e)return or.fromDict(e);const t=or.fromDict(this.dict.context.obj({}));return this.dict.set(p.of("MK"),t.dict),t}getBorderStyle(){const e=this.BS();if(e)return ir.fromDict(e)}getOrCreateBorderStyle(){const e=this.BS();if(e)return ir.fromDict(e);const t=ir.fromDict(this.dict.context.obj({}));return this.dict.set(p.of("BS"),t.dict),t}getOnValue(){var e;const t=(e=this.getAppearances())==null?void 0:e.normal;if(t instanceof V){const n=t.keys();for(let r=0,i=n.length;r<i;r++){const o=n[r];if(o!==p.of("Off"))return o}}}};let sr=Ei;b(sr,"fromDict",e=>new Ei(e)),b(sr,"create",(e,t)=>{const n=e.obj({Type:"Annot",Subtype:"Widget",Rect:[0,0,0,0],Parent:t});return new Ei(n)});const Ta=class extends rr{FT(){const e=this.getInheritableAttribute(p.of("FT"));return this.dict.context.lookup(e,p)}getWidgets(){const e=this.Kids();if(!e)return[sr.fromDict(this.dict)];const t=new Array(e.size());for(let n=0,r=e.size();n<r;n++){const i=e.lookup(n,V);t[n]=sr.fromDict(i)}return t}addWidget(e){const{Kids:t}=this.normalizedEntries();t.push(e)}removeWidget(e){const t=this.Kids();if(t){if(e<0||e>t.size())throw new Nn(e,0,t.size());t.remove(e)}else{if(e!==0)throw new Nn(e,0,0);this.setKids([])}}normalizedEntries(){let e=this.Kids();return e||(e=this.dict.context.obj([this.ref]),this.dict.set(p.of("Kids"),e)),{Kids:e}}};let Mt=Ta;b(Mt,"fromDict",(e,t)=>new Ta(e,t));class Pi extends Mt{Opt(){return this.dict.lookupMaybe(p.of("Opt"),ee,X,q)}setOpt(t){this.dict.set(p.of("Opt"),this.dict.context.obj(t))}getExportValues(){const t=this.Opt();if(!t)return;if(t instanceof ee||t instanceof X)return[t];const n=[];for(let r=0,i=t.size();r<i;r++){const o=t.lookup(r);(o instanceof ee||o instanceof X)&&n.push(o)}return n}removeExportValue(t){const n=this.Opt();if(!!n)if(n instanceof ee||n instanceof X){if(t!==0)throw new Nn(t,0,0);this.setOpt([])}else{if(t<0||t>n.size())throw new Nn(t,0,n.size());n.remove(t)}}normalizeExportValues(){var t,n,r,i;const o=(t=this.getExportValues())!=null?t:[],s=[],c=this.getWidgets();for(let l=0,a=c.length;l<a;l++){const h=c[l],f=(i=o[l])!=null?i:X.fromText((r=(n=h.getOnValue())==null?void 0:n.decodeText())!=null?r:"");s.push(f)}this.setOpt(s)}addOpt(t,n){var r;this.normalizeExportValues();const i=t.decodeText();let o;if(n){const c=(r=this.getExportValues())!=null?r:[];for(let l=0,a=c.length;l<a;l++)c[l].decodeText()===i&&(o=l)}const s=this.Opt();return s.push(t),o??s.size()-1}addWidgetWithOpt(t,n,r){const i=this.addOpt(n,r),o=p.of(String(i));return this.addWidget(t),o}}const Ri=class extends Pi{setValue(e){var t;const n=(t=this.getOnValue())!=null?t:p.of("Yes");if(e!==n&&e!==p.of("Off"))throw new Rr;this.dict.set(p.of("V"),e);const r=this.getWidgets();for(let i=0,o=r.length;i<o;i++){const s=r[i],c=s.getOnValue()===e?e:p.of("Off");s.setAppearanceState(c)}}getValue(){const e=this.V();return e instanceof p?e:p.of("Off")}getOnValue(){const[e]=this.getWidgets();return e?.getOnValue()}};let Ii=Ri;b(Ii,"fromDict",(e,t)=>new Ri(e,t)),b(Ii,"create",e=>{const t=e.obj({FT:"Btn",Kids:[]}),n=e.register(t);return new Ri(t,n)});const fe=e=>1<<e;var Sf=(e=>(e[e.ReadOnly=fe(0)]="ReadOnly",e[e.Required=fe(1)]="Required",e[e.NoExport=fe(2)]="NoExport",e))(Sf||{}),yn=(e=>(e[e.NoToggleToOff=fe(14)]="NoToggleToOff",e[e.Radio=fe(15)]="Radio",e[e.PushButton=fe(16)]="PushButton",e[e.RadiosInUnison=fe(25)]="RadiosInUnison",e))(yn||{}),vf=(e=>(e[e.Multiline=fe(12)]="Multiline",e[e.Password=fe(13)]="Password",e[e.FileSelect=fe(20)]="FileSelect",e[e.DoNotSpellCheck=fe(22)]="DoNotSpellCheck",e[e.DoNotScroll=fe(23)]="DoNotScroll",e[e.Comb=fe(24)]="Comb",e[e.RichText=fe(25)]="RichText",e))(vf||{}),Lt=(e=>(e[e.Combo=fe(17)]="Combo",e[e.Edit=fe(18)]="Edit",e[e.Sort=fe(19)]="Sort",e[e.MultiSelect=fe(21)]="MultiSelect",e[e.DoNotSpellCheck=fe(22)]="DoNotSpellCheck",e[e.CommitOnSelChange=fe(26)]="CommitOnSelChange",e))(Lt||{});class Ea extends Mt{setValues(t){if(this.hasFlag(Lt.Combo)&&!this.hasFlag(Lt.Edit)&&!this.valuesAreValid(t))throw new Rr;if(t.length===0&&this.dict.delete(p.of("V")),t.length===1&&this.dict.set(p.of("V"),t[0]),t.length>1){if(!this.hasFlag(Lt.MultiSelect))throw new Qc;this.dict.set(p.of("V"),this.dict.context.obj(t))}this.updateSelectedIndices(t)}valuesAreValid(t){const n=this.getOptions();for(let r=0,i=t.length;r<i;r++){const o=t[r].decodeText();if(!n.find(s=>o===(s.display||s.value).decodeText()))return!1}return!0}updateSelectedIndices(t){if(t.length>1){const n=new Array(t.length),r=this.getOptions();for(let i=0,o=t.length;i<o;i++){const s=t[i].decodeText();n[i]=r.findIndex(c=>s===(c.display||c.value).decodeText())}this.dict.set(p.of("I"),this.dict.context.obj(n.sort()))}else this.dict.delete(p.of("I"))}getValues(){const t=this.V();if(t instanceof ee||t instanceof X)return[t];if(t instanceof q){const n=[];for(let r=0,i=t.size();r<i;r++){const o=t.lookup(r);(o instanceof ee||o instanceof X)&&n.push(o)}return n}return[]}Opt(){return this.dict.lookupMaybe(p.of("Opt"),ee,X,q)}setOptions(t){const n=new Array(t.length);for(let r=0,i=t.length;r<i;r++){const{value:o,display:s}=t[r];n[r]=this.dict.context.obj([o,s||o])}this.dict.set(p.of("Opt"),this.dict.context.obj(n))}getOptions(){const t=this.Opt();if(t instanceof ee||t instanceof X)return[{value:t,display:t}];if(t instanceof q){const n=[];for(let r=0,i=t.size();r<i;r++){const o=t.lookup(r);if((o instanceof ee||o instanceof X)&&n.push({value:o,display:o}),o instanceof q&&o.size()>0){const s=o.lookup(0,ee,X),c=o.lookupMaybe(1,ee,X);n.push({value:s,display:c||s})}}return n}return[]}}const Oi=class extends Ea{};let zi=Oi;b(zi,"fromDict",(e,t)=>new Oi(e,t)),b(zi,"create",e=>{const t=e.obj({FT:"Ch",Ff:Lt.Combo,Kids:[]}),n=e.register(t);return new Oi(t,n)});const Fi=class extends rr{addField(e){const{Kids:t}=this.normalizedEntries();t?.push(e)}normalizedEntries(){let e=this.Kids();return e||(e=this.dict.context.obj([]),this.dict.set(p.of("Kids"),e)),{Kids:e}}};let ar=Fi;b(ar,"fromDict",(e,t)=>new Fi(e,t)),b(ar,"create",e=>{const t=e.obj({}),n=e.register(t);return new Fi(t,n)});const Pa=class extends Mt{};let Ra=Pa;b(Ra,"fromDict",(e,t)=>new Pa(e,t));const Ni=class extends Mt{MaxLen(){const e=this.dict.lookup(p.of("MaxLen"));if(e instanceof $)return e}Q(){const e=this.dict.lookup(p.of("Q"));if(e instanceof $)return e}setMaxLength(e){this.dict.set(p.of("MaxLen"),$.of(e))}removeMaxLength(){this.dict.delete(p.of("MaxLen"))}getMaxLength(){var e;return(e=this.MaxLen())==null?void 0:e.asNumber()}setQuadding(e){this.dict.set(p.of("Q"),$.of(e))}getQuadding(){var e;return(e=this.Q())==null?void 0:e.asNumber()}setValue(e){this.dict.set(p.of("V"),e)}removeValue(){this.dict.delete(p.of("V"))}getValue(){const e=this.V();if(e instanceof ee||e instanceof X)return e}};let Mi=Ni;b(Mi,"fromDict",(e,t)=>new Ni(e,t)),b(Mi,"create",e=>{const t=e.obj({FT:"Tx",Kids:[]}),n=e.register(t);return new Ni(t,n)});const Li=class extends Pi{};let ji=Li;b(ji,"fromDict",(e,t)=>new Li(e,t)),b(ji,"create",e=>{const t=e.obj({FT:"Btn",Ff:yn.PushButton,Kids:[]}),n=e.register(t);return new Li(t,n)});const Ui=class extends Pi{setValue(e){if(!this.getOnValues().includes(e)&&e!==p.of("Off"))throw new Rr;this.dict.set(p.of("V"),e);const n=this.getWidgets();for(let r=0,i=n.length;r<i;r++){const o=n[r],s=o.getOnValue()===e?e:p.of("Off");o.setAppearanceState(s)}}getValue(){const e=this.V();return e instanceof p?e:p.of("Off")}getOnValues(){const e=this.getWidgets(),t=[];for(let n=0,r=e.length;n<r;n++){const i=e[n].getOnValue();i&&t.push(i)}return t}};let $i=Ui;b($i,"fromDict",(e,t)=>new Ui(e,t)),b($i,"create",e=>{const t=e.obj({FT:"Btn",Ff:yn.Radio,Kids:[]}),n=e.register(t);return new Ui(t,n)});const Hi=class extends Ea{};let Gi=Hi;b(Gi,"fromDict",(e,t)=>new Hi(e,t)),b(Gi,"create",e=>{const t=e.obj({FT:"Ch",Kids:[]}),n=e.register(t);return new Hi(t,n)});const kf=e=>{if(!e)return[];const t=[];for(let n=0,r=e.size();n<r;n++){const i=e.get(n),o=e.lookup(n);i instanceof oe&&o instanceof V&&t.push([Ia(o,i),i])}return t},Ia=(e,t)=>Af(e)?ar.fromDict(e,t):Cf(e,t),Af=e=>{const t=e.lookup(p.of("Kids"));if(t instanceof q)for(let n=0,r=t.size();n<r;n++){const i=t.lookup(n);if(i instanceof V&&i.has(p.of("T")))return!0}return!1},Cf=(e,t)=>{const n=Wi(e,p.of("FT")),r=e.context.lookup(n,p);return r===p.of("Btn")?Bf(e,t):r===p.of("Ch")?Df(e,t):r===p.of("Tx")?Mi.fromDict(e,t):r===p.of("Sig")?Ra.fromDict(e,t):Mt.fromDict(e,t)},Bf=(e,t)=>{var n;const r=Wi(e,p.of("Ff")),i=e.context.lookupMaybe(r,$),o=(n=i?.asNumber())!=null?n:0;return Vi(o,yn.PushButton)?ji.fromDict(e,t):Vi(o,yn.Radio)?$i.fromDict(e,t):Ii.fromDict(e,t)},Df=(e,t)=>{var n;const r=Wi(e,p.of("Ff")),i=e.context.lookupMaybe(r,$),o=(n=i?.asNumber())!=null?n:0;return Vi(o,Lt.Combo)?zi.fromDict(e,t):Gi.fromDict(e,t)},Vi=(e,t)=>(e&t)!==0,Wi=(e,t)=>{let n;return Oa(e,r=>{n||(n=r.get(t))}),n},Oa=(e,t)=>{t(e);const n=e.lookupMaybe(p.of("Parent"),V);n&&Oa(n,t)},Ki=class{constructor(e){b(this,"dict"),this.dict=e}Fields(){const e=this.dict.lookup(p.of("Fields"));if(e instanceof q)return e}getFields(){const{Fields:e}=this.normalizedEntries(),t=new Array(e.size());for(let n=0,r=e.size();n<r;n++){const i=e.get(n),o=e.lookup(n,V);t[n]=[Ia(o,i),i]}return t}getAllFields(){const e=[],t=n=>{if(!!n)for(let r=0,i=n.length;r<i;r++){const o=n[r];e.push(o);const[s]=o;s instanceof ar&&t(kf(s.Kids()))}};return t(this.getFields()),e}addField(e){const{Fields:t}=this.normalizedEntries();t?.push(e)}removeField(e){const 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 new Error(`Tried to remove inexistent field ${e.getFullyQualifiedName()}`);n.remove(r),t!==void 0&&n.size()===0&&this.removeField(t)}normalizedEntries(){let e=this.Fields();return e||(e=this.dict.context.obj([]),this.dict.set(p.of("Fields"),e)),{Fields:e}}};let cr=Ki;b(cr,"fromDict",e=>new Ki(e)),b(cr,"create",e=>{const t=e.obj({Fields:[]});return new Ki(t)});const lr=(e,t)=>{if(e!==void 0)return t[e]};var Zi=(e=>(e.UseNone="UseNone",e.UseOutlines="UseOutlines",e.UseThumbs="UseThumbs",e.UseOC="UseOC",e))(Zi||{}),qi=(e=>(e.L2R="L2R",e.R2L="R2L",e))(qi||{}),Xi=(e=>(e.None="None",e.AppDefault="AppDefault",e))(Xi||{}),Yi=(e=>(e.Simplex="Simplex",e.DuplexFlipShortEdge="DuplexFlipShortEdge",e.DuplexFlipLongEdge="DuplexFlipLongEdge",e))(Yi||{});const Ji=class{constructor(e){b(this,"dict"),this.dict=e}lookupBool(e){const t=this.dict.lookup(p.of(e));if(t instanceof _t)return t}lookupName(e){const t=this.dict.lookup(p.of(e));if(t instanceof p)return t}HideToolbar(){return this.lookupBool("HideToolbar")}HideMenubar(){return this.lookupBool("HideMenubar")}HideWindowUI(){return this.lookupBool("HideWindowUI")}FitWindow(){return this.lookupBool("FitWindow")}CenterWindow(){return this.lookupBool("CenterWindow")}DisplayDocTitle(){return this.lookupBool("DisplayDocTitle")}NonFullScreenPageMode(){return this.lookupName("NonFullScreenPageMode")}Direction(){return this.lookupName("Direction")}PrintScaling(){return this.lookupName("PrintScaling")}Duplex(){return this.lookupName("Duplex")}PickTrayByPDFSize(){return this.lookupBool("PickTrayByPDFSize")}PrintPageRange(){const e=this.dict.lookup(p.of("PrintPageRange"));if(e instanceof q)return e}NumCopies(){const e=this.dict.lookup(p.of("NumCopies"));if(e instanceof $)return e}getHideToolbar(){var e,t;return(t=(e=this.HideToolbar())==null?void 0:e.asBoolean())!=null?t:!1}getHideMenubar(){var e,t;return(t=(e=this.HideMenubar())==null?void 0:e.asBoolean())!=null?t:!1}getHideWindowUI(){var e,t;return(t=(e=this.HideWindowUI())==null?void 0:e.asBoolean())!=null?t:!1}getFitWindow(){var e,t;return(t=(e=this.FitWindow())==null?void 0:e.asBoolean())!=null?t:!1}getCenterWindow(){var e,t;return(t=(e=this.CenterWindow())==null?void 0:e.asBoolean())!=null?t:!1}getDisplayDocTitle(){var e,t;return(t=(e=this.DisplayDocTitle())==null?void 0:e.asBoolean())!=null?t:!1}getNonFullScreenPageMode(){var e,t;const n=(e=this.NonFullScreenPageMode())==null?void 0:e.decodeText();return(t=lr(n,Zi))!=null?t:"UseNone"}getReadingDirection(){var e,t;const n=(e=this.Direction())==null?void 0:e.decodeText();return(t=lr(n,qi))!=null?t:"L2R"}getPrintScaling(){var e,t;const n=(e=this.PrintScaling())==null?void 0:e.decodeText();return(t=lr(n,Xi))!=null?t:"AppDefault"}getDuplex(){var e;const t=(e=this.Duplex())==null?void 0:e.decodeText();return lr(t,Yi)}getPickTrayByPDFSize(){var e;return(e=this.PickTrayByPDFSize())==null?void 0:e.asBoolean()}getPrintPageRange(){const e=this.PrintPageRange();if(!e)return[];const t=[];for(let n=0;n<e.size();n+=2){const r=e.lookup(n,$).asNumber(),i=e.lookup(n+1,$).asNumber();t.push({start:r,end:i})}return t}getNumCopies(){var e,t;return(t=(e=this.NumCopies())==null?void 0:e.asNumber())!=null?t:1}setHideToolbar(e){const t=this.dict.context.obj(e);this.dict.set(p.of("HideToolbar"),t)}setHideMenubar(e){const t=this.dict.context.obj(e);this.dict.set(p.of("HideMenubar"),t)}setHideWindowUI(e){const t=this.dict.context.obj(e);this.dict.set(p.of("HideWindowUI"),t)}setFitWindow(e){const t=this.dict.context.obj(e);this.dict.set(p.of("FitWindow"),t)}setCenterWindow(e){const t=this.dict.context.obj(e);this.dict.set(p.of("CenterWindow"),t)}setDisplayDocTitle(e){const t=this.dict.context.obj(e);this.dict.set(p.of("DisplayDocTitle"),t)}setNonFullScreenPageMode(e){Xt(e,"nonFullScreenPageMode",Zi);const t=p.of(e);this.dict.set(p.of("NonFullScreenPageMode"),t)}setReadingDirection(e){Xt(e,"readingDirection",qi);const t=p.of(e);this.dict.set(p.of("Direction"),t)}setPrintScaling(e){Xt(e,"printScaling",Xi);const t=p.of(e);this.dict.set(p.of("PrintScaling"),t)}setDuplex(e){Xt(e,"duplex",Yi);const t=p.of(e);this.dict.set(p.of("Duplex"),t)}setPickTrayByPDFSize(e){const t=this.dict.context.obj(e);this.dict.set(p.of("PickTrayByPDFSize"),t)}setPrintPageRange(e){Array.isArray(e)||(e=[e]);const t=[];for(let r=0,i=e.length;r<i;r++)t.push(e[r].start),t.push(e[r].end);Po(t,"printPageRange",["number"]);const n=this.dict.context.obj(t);this.dict.set(p.of("PrintPageRange"),n)}setNumCopies(e){tt(e,"numCopies",1,Number.MAX_VALUE),Zc(e,"numCopies");const t=this.dict.context.obj(e);this.dict.set(p.of("NumCopies"),t)}};let hr=Ji;b(hr,"fromDict",e=>new Ji(e)),b(hr,"create",e=>{const t=e.obj({});return new Ji(t)});const Qi=class extends V{Pages(){return this.lookup(p.of("Pages"),V)}AcroForm(){return this.lookupMaybe(p.of("AcroForm"),V)}getAcroForm(){const e=this.AcroForm();if(!!e)return cr.fromDict(e)}getOrCreateAcroForm(){let e=this.getAcroForm();if(!e){e=cr.create(this.context);const t=this.context.register(e.dict);this.set(p.of("AcroForm"),t)}return e}ViewerPreferences(){return this.lookupMaybe(p.of("ViewerPreferences"),V)}getViewerPreferences(){const e=this.ViewerPreferences();if(!!e)return hr.fromDict(e)}getOrCreateViewerPreferences(){let e=this.getViewerPreferences();if(!e){e=hr.create(this.context);const t=this.context.register(e.dict);this.set(p.of("ViewerPreferences"),t)}return e}insertLeafNode(e,t){const n=this.get(p.of("Pages"));return this.Pages().insertLeafNode(e,t)||n}removeLeafNode(e){this.Pages().removeLeafNode(e)}};let eo=Qi;b(eo,"withContextAndPages",(e,t)=>{const n=new Map;return n.set(p.of("Type"),p.of("Catalog")),n.set(p.of("Pages"),t),new Qi(n,e)}),b(eo,"fromMapWithContext",(e,t)=>new Qi(e,t));const dr=class extends V{constructor(e,t,n=!0){super(e,t),b(this,"normalized",!1),b(this,"autoNormalizeCTM"),this.autoNormalizeCTM=n}clone(e){const t=dr.fromMapWithContext(new Map,e||this.context,this.autoNormalizeCTM),n=this.entries();for(let r=0,i=n.length;r<i;r++){const[o,s]=n[r];t.set(o,s)}return t}Parent(){return this.lookupMaybe(p.Parent,V)}Contents(){return this.lookup(p.of("Contents"))}Annots(){return this.lookupMaybe(p.Annots,q)}BleedBox(){return this.lookupMaybe(p.BleedBox,q)}TrimBox(){return this.lookupMaybe(p.TrimBox,q)}ArtBox(){return this.lookupMaybe(p.ArtBox,q)}Resources(){const e=this.getInheritableAttribute(p.Resources);return this.context.lookupMaybe(e,V)}MediaBox(){const e=this.getInheritableAttribute(p.MediaBox);return this.context.lookup(e,q)}CropBox(){const e=this.getInheritableAttribute(p.CropBox);return this.context.lookupMaybe(e,q)}Rotate(){const e=this.getInheritableAttribute(p.Rotate);return this.context.lookupMaybe(e,$)}getInheritableAttribute(e){let t;return this.ascend(n=>{t||(t=n.get(e))}),t}setParent(e){this.set(p.Parent,e)}addContentStream(e){const t=this.normalizedEntries().Contents||this.context.obj([]);this.set(p.Contents,t),t.push(e)}wrapContentStreams(e,t){const n=this.Contents();return n instanceof q?(n.insert(0,e),n.push(t),!0):!1}addAnnot(e){const{Annots:t}=this.normalizedEntries();t.push(e)}removeAnnot(e){const{Annots:t}=this.normalizedEntries(),n=t.indexOf(e);n!==void 0&&t.remove(n)}setFontDictionary(e,t){const{Font:n}=this.normalizedEntries();n.set(e,t)}newFontDictionaryKey(e){const{Font:t}=this.normalizedEntries();return t.uniqueKey(e)}newFontDictionary(e,t){const n=this.newFontDictionaryKey(e);return this.setFontDictionary(n,t),n}setXObject(e,t){const{XObject:n}=this.normalizedEntries();n.set(e,t)}newXObjectKey(e){const{XObject:t}=this.normalizedEntries();return t.uniqueKey(e)}newXObject(e,t){const n=this.newXObjectKey(e);return this.setXObject(n,t),n}setExtGState(e,t){const{ExtGState:n}=this.normalizedEntries();n.set(e,t)}newExtGStateKey(e){const{ExtGState:t}=this.normalizedEntries();return t.uniqueKey(e)}newExtGState(e,t){const n=this.newExtGStateKey(e);return this.setExtGState(n,t),n}ascend(e){e(this);const t=this.Parent();t&&t.ascend(e)}normalize(){if(this.normalized)return;const{context:e}=this,t=this.get(p.Contents);this.context.lookup(t)instanceof ct&&this.set(p.Contents,e.obj([t])),this.autoNormalizeCTM&&this.wrapContentStreams(this.context.getPushGraphicsStateContentStream(),this.context.getPopGraphicsStateContentStream());const r=this.getInheritableAttribute(p.Resources),i=e.lookupMaybe(r,V)||e.obj({});this.set(p.Resources,i);const o=i.lookupMaybe(p.Font,V)||e.obj({});i.set(p.Font,o);const s=i.lookupMaybe(p.XObject,V)||e.obj({});i.set(p.XObject,s);const c=i.lookupMaybe(p.ExtGState,V)||e.obj({});i.set(p.ExtGState,c);const l=this.Annots()||e.obj([]);this.set(p.Annots,l),this.normalized=!0}normalizedEntries(){this.normalize();const e=this.Annots(),t=this.Resources(),n=this.Contents();return{Annots:e,Resources:t,Contents:n,Font:t.lookup(p.Font,V),XObject:t.lookup(p.XObject,V),ExtGState:t.lookup(p.ExtGState,V)}}};let Ge=dr;b(Ge,"InheritableEntries",["Resources","MediaBox","CropBox","Rotate"]),b(Ge,"withContextAndParent",(e,t)=>{const n=new Map;return n.set(p.Type,p.Page),n.set(p.Parent,t),n.set(p.Resources,e.obj({})),n.set(p.MediaBox,e.obj([0,0,612,792])),new dr(n,e,!1)}),b(Ge,"fromMapWithContext",(e,t,n=!0)=>new dr(e,t,n));const to=class{constructor(e){b(this,"bytes"),b(this,"length"),b(this,"idx",0),b(this,"line",0),b(this,"column",0),this.bytes=e,this.length=this.bytes.length}moveTo(e){this.idx=e}next(){const e=this.bytes[this.idx++];return e===m.Newline?(this.line+=1,this.column=0):this.column+=1,e}assertNext(e){if(this.peek()!==e)throw new nl(this.position(),e,this.peek());return this.next()}peek(){return this.bytes[this.idx]}peekAhead(e){return this.bytes[this.idx+e]}peekAt(e){return this.bytes[e]}done(){return this.idx>=this.length}offset(){return this.idx}slice(e,t){return this.bytes.slice(e,t)}position(){return{line:this.line,column:this.column,offset:this.idx}}};let jt=to;b(jt,"of",e=>new to(e)),b(jt,"fromPDFRawStream",e=>to.of(_a(e).decode()));const ye=new Uint8Array(256);ye[m.Zero]=1,ye[m.One]=1,ye[m.Two]=1,ye[m.Three]=1,ye[m.Four]=1,ye[m.Five]=1,ye[m.Six]=1,ye[m.Seven]=1,ye[m.Eight]=1,ye[m.Nine]=1;const fr=new Uint8Array(256);fr[m.Period]=1,fr[m.Plus]=1,fr[m.Minus]=1;const no=new Uint8Array(256);for(let e=0,t=256;e<t;e++)no[e]=ye[e]||fr[e]?1:0;const{Newline:za,CarriageReturn:Fa}=m;class Tf{constructor(t,n=!1){b(this,"bytes"),b(this,"capNumbers"),this.bytes=t,this.capNumbers=n}parseRawInt(){let t="";for(;!this.bytes.done();){const r=this.bytes.peek();if(!ye[r])break;t+=Ke(this.bytes.next())}const n=Number(t);if(!t||!isFinite(n))throw new zo(this.bytes.position(),t);return n}parseRawNumber(){let t="";for(;!this.bytes.done();){const r=this.bytes.peek();if(!no[r]||(t+=Ke(this.bytes.next()),r===m.Period))break}for(;!this.bytes.done();){const r=this.bytes.peek();if(!ye[r])break;t+=Ke(this.bytes.next())}const n=Number(t);if(!t||!isFinite(n))throw new zo(this.bytes.position(),t);if(n>Number.MAX_SAFE_INTEGER)if(this.capNumbers){const r=`Parsed number that is too large for some PDF readers: ${t}, using Number.MAX_SAFE_INTEGER instead.`;return console.warn(r),Number.MAX_SAFE_INTEGER}else{const r=`Parsed number that is too large for some PDF readers: ${t}, not capping.`;console.warn(r)}return n}skipWhitespace(){for(;!this.bytes.done()&&qe[this.bytes.peek()];)this.bytes.next()}skipLine(){for(;!this.bytes.done();){const t=this.bytes.peek();if(t===za||t===Fa)return;this.bytes.next()}}skipComment(){if(this.bytes.peek()!==m.Percent)return!1;for(;!this.bytes.done();){const t=this.bytes.peek();if(t===za||t===Fa)return!0;this.bytes.next()}return!0}skipWhitespaceAndComments(){for(this.skipWhitespace();this.skipComment();)this.skipWhitespace()}matchKeyword(t){const n=this.bytes.offset();for(let r=0,i=t.length;r<i;r++)if(this.bytes.done()||this.bytes.next()!==t[r])return this.bytes.moveTo(n),!1;return!0}}const Ut=class extends V{Parent(){return this.lookup(p.of("Parent"))}Kids(){return this.lookup(p.of("Kids"),q)}Count(){return this.lookup(p.of("Count"),$)}pushTreeNode(e){this.Kids().push(e)}pushLeafNode(e){const t=this.Kids();this.insertLeafKid(t.size(),e)}insertLeafNode(e,t){const n=this.Kids(),r=this.Count().asNumber();if(t>r)throw new Io(t,r);let i=t;for(let o=0,s=n.size();o<s;o++){if(i===0){this.insertLeafKid(o,e);return}const c=n.get(o),l=this.context.lookup(c);if(l instanceof Ut){if(l.Count().asNumber()>i)return l.insertLeafNode(e,i)||c;i-=l.Count().asNumber()}l instanceof Ge&&(i-=1)}if(i===0){this.insertLeafKid(n.size(),e);return}throw new Oo(t,"insertLeafNode")}removeLeafNode(e,t=!0){const n=this.Kids(),r=this.Count().asNumber();if(e>=r)throw new Io(e,r);let i=e;for(let o=0,s=n.size();o<s;o++){const c=n.get(o),l=this.context.lookup(c);if(l instanceof Ut)if(l.Count().asNumber()>i){l.removeLeafNode(i,t),t&&l.Kids().size()===0&&n.remove(o);return}else i-=l.Count().asNumber();if(l instanceof Ge)if(i===0){this.removeKid(o);return}else i-=1}throw new Oo(e,"removeLeafNode")}ascend(e){e(this);const t=this.Parent();t&&t.ascend(e)}traverse(e){const t=this.Kids();for(let n=0,r=t.size();n<r;n++){const i=t.get(n),o=this.context.lookup(i);o instanceof Ut&&o.traverse(e),e(o,i)}}insertLeafKid(e,t){const n=this.Kids();this.ascend(r=>{const i=r.Count().asNumber()+1;r.set(p.of("Count"),$.of(i))}),n.insert(e,t)}removeKid(e){const t=this.Kids();t.lookup(e)instanceof Ge&&this.ascend(r=>{const i=r.Count().asNumber()-1;r.set(p.of("Count"),$.of(i))}),t.remove(e)}};let ro=Ut;b(ro,"withContext",(e,t)=>{const n=new Map;return n.set(p.of("Type"),p.of("Pages")),n.set(p.of("Kids"),e.obj([])),n.set(p.of("Count"),e.obj(0)),t&&n.set(p.of("Parent"),t),new Ut(n,e)}),b(ro,"fromMapWithContext",(e,t)=>new Ut(e,t));const{Space:Ef,CarriageReturn:_n,Newline:wn}=m,xn=[m.s,m.t,m.r,m.e,m.a,m.m],ur=[m.e,m.n,m.d,m.s,m.t,m.r,m.e,m.a,m.m],te={header:[m.Percent,m.P,m.D,m.F,m.Dash],eof:[m.Percent,m.Percent,m.E,m.O,m.F],obj:[m.o,m.b,m.j],endobj:[m.e,m.n,m.d,m.o,m.b,m.j],xref:[m.x,m.r,m.e,m.f],trailer:[m.t,m.r,m.a,m.i,m.l,m.e,m.r],startxref:[m.s,m.t,m.a,m.r,m.t,m.x,m.r,m.e,m.f],true:[m.t,m.r,m.u,m.e],false:[m.f,m.a,m.l,m.s,m.e],null:[m.n,m.u,m.l,m.l],stream:xn,streamEOF1:[...xn,Ef,_n,wn],streamEOF2:[...xn,_n,wn],streamEOF3:[...xn,_n],streamEOF4:[...xn,wn],endstream:ur,EOF1endstream:[_n,wn,...ur],EOF2endstream:[_n,...ur],EOF3endstream:[wn,...ur]},io=class extends Tf{constructor(e,t,n=!1){super(e,n),b(this,"context"),this.context=t}parseObject(){if(this.skipWhitespaceAndComments(),this.matchKeyword(te.true))return _t.True;if(this.matchKeyword(te.false))return _t.False;if(this.matchKeyword(te.null))return Se;const e=this.bytes.peek();if(e===m.LessThan&&this.bytes.peekAhead(1)===m.LessThan)return this.parseDictOrStream();if(e===m.LessThan)return this.parseHexString();if(e===m.LeftParen)return this.parseString();if(e===m.ForwardSlash)return this.parseName();if(e===m.LeftSquareBracket)return this.parseArray();if(no[e])return this.parseNumberOrRef();throw new rl(this.bytes.position(),e)}parseNumberOrRef(){const e=this.parseRawNumber();this.skipWhitespaceAndComments();const t=this.bytes.offset();if(ye[this.bytes.peek()]){const n=this.parseRawNumber();if(this.skipWhitespaceAndComments(),this.bytes.peek()===m.R)return this.bytes.assertNext(m.R),oe.of(e,n)}return this.bytes.moveTo(t),$.of(e)}parseHexString(){let e="";for(this.bytes.assertNext(m.LessThan);!this.bytes.done()&&this.bytes.peek()!==m.GreaterThan;)e+=Ke(this.bytes.next());return this.bytes.assertNext(m.GreaterThan),X.of(e)}parseString(){let e=0,t=!1,n="";for(;!this.bytes.done();){const r=this.bytes.next();if(n+=Ke(r),t||(r===m.LeftParen&&(e+=1),r===m.RightParen&&(e-=1)),r===m.BackSlash?t=!t:t&&(t=!1),e===0)return ee.of(n.substring(1,n.length-1))}throw new sl(this.bytes.position())}parseName(){this.bytes.assertNext(m.ForwardSlash);let e="";for(;!this.bytes.done();){const t=this.bytes.peek();if(qe[t]||Te[t])break;e+=Ke(t),this.bytes.next()}return p.of(e)}parseArray(){this.bytes.assertNext(m.LeftSquareBracket),this.skipWhitespaceAndComments();const e=q.withContext(this.context);for(;this.bytes.peek()!==m.RightSquareBracket;){const t=this.parseObject();e.push(t),this.skipWhitespaceAndComments()}return this.bytes.assertNext(m.RightSquareBracket),e}parseDict(){this.bytes.assertNext(m.LessThan),this.bytes.assertNext(m.LessThan),this.skipWhitespaceAndComments();const e=new Map;for(;!this.bytes.done()&&this.bytes.peek()!==m.GreaterThan&&this.bytes.peekAhead(1)!==m.GreaterThan;){const n=this.parseName(),r=this.parseObject();e.set(n,r),this.skipWhitespaceAndComments()}this.skipWhitespaceAndComments(),this.bytes.assertNext(m.GreaterThan),this.bytes.assertNext(m.GreaterThan);const t=e.get(p.of("Type"));return t===p.of("Catalog")?eo.fromMapWithContext(e,this.context):t===p.of("Pages")?ro.fromMapWithContext(e,this.context):t===p.of("Page")?Ge.fromMapWithContext(e,this.context):V.fromMapWithContext(e,this.context)}parseDictOrStream(){const e=this.bytes.position(),t=this.parseDict();if(this.skipWhitespaceAndComments(),!this.matchKeyword(te.streamEOF1)&&!this.matchKeyword(te.streamEOF2)&&!this.matchKeyword(te.streamEOF3)&&!this.matchKeyword(te.streamEOF4)&&!this.matchKeyword(te.stream))return t;const n=this.bytes.offset();let r;const i=t.get(p.of("Length"));i instanceof $?(r=n+i.asNumber(),this.bytes.moveTo(r),this.skipWhitespaceAndComments(),this.matchKeyword(te.endstream)||(this.bytes.moveTo(n),r=this.findEndOfStreamFallback(e))):r=this.findEndOfStreamFallback(e);const o=this.bytes.slice(n,r);return zt.of(t,o)}findEndOfStreamFallback(e){let t=1,n=this.bytes.offset();for(;!this.bytes.done()&&(n=this.bytes.offset(),this.matchKeyword(te.stream)?t+=1:this.matchKeyword(te.EOF1endstream)||this.matchKeyword(te.EOF2endstream)||this.matchKeyword(te.EOF3endstream)||this.matchKeyword(te.endstream)?t-=1:this.bytes.next(),t!==0););if(t!==0)throw new ol(e);return n}};let gr=io;b(gr,"forBytes",(e,t,n)=>new io(jt.of(e),t,n)),b(gr,"forByteStream",(e,t,n=!1)=>new io(e,t,n));const Na=class extends gr{constructor(e,t){super(jt.fromPDFRawStream(e),e.dict.context),b(this,"alreadyParsed"),b(this,"shouldWaitForTick"),b(this,"firstOffset"),b(this,"objectCount");const{dict:n}=e;this.alreadyParsed=!1,this.shouldWaitForTick=t||(()=>!1),this.firstOffset=n.lookup(p.of("First"),$).asNumber(),this.objectCount=n.lookup(p.of("N"),$).asNumber()}async parseIntoContext(){if(this.alreadyParsed)throw new Pr("PDFObjectStreamParser","parseIntoContext");this.alreadyParsed=!0;const e=this.parseOffsetsAndObjectNumbers();for(let t=0,n=e.length;t<n;t++){const{objectNumber:r,offset:i}=e[t];this.bytes.moveTo(this.firstOffset+i);const o=this.parseObject(),s=oe.of(r,0);this.context.assign(s,o),this.shouldWaitForTick()&&await kt()}}parseOffsetsAndObjectNumbers(){const e=[];for(let t=0,n=this.objectCount;t<n;t++){this.skipWhitespaceAndComments();const r=this.parseRawInt();this.skipWhitespaceAndComments();const i=this.parseRawInt();e.push({objectNumber:r,offset:i})}return e}};let Ma=Na;b(Ma,"forStream",(e,t)=>new Na(e,t));const La=class{constructor(e){b(this,"alreadyParsed"),b(this,"dict"),b(this,"context"),b(this,"bytes"),b(this,"subsections"),b(this,"byteWidths"),this.alreadyParsed=!1,this.dict=e.dict,this.bytes=jt.fromPDFRawStream(e),this.context=this.dict.context;const t=this.dict.lookup(p.of("Size"),$),n=this.dict.lookup(p.of("Index"));if(n instanceof q){this.subsections=[];for(let i=0,o=n.size();i<o;i+=2){const s=n.lookup(i+0,$).asNumber(),c=n.lookup(i+1,$).asNumber();this.subsections.push({firstObjectNumber:s,length:c})}}else this.subsections=[{firstObjectNumber:0,length:t.asNumber()}];const r=this.dict.lookup(p.of("W"),q);this.byteWidths=[-1,-1,-1];for(let i=0,o=r.size();i<o;i++)this.byteWidths[i]=r.lookup(i,$).asNumber()}parseIntoContext(){if(this.alreadyParsed)throw new Pr("PDFXRefStreamParser","parseIntoContext");return this.alreadyParsed=!0,this.context.trailerInfo={Root:this.dict.get(p.of("Root")),Encrypt:this.dict.get(p.of("Encrypt")),Info:this.dict.get(p.of("Info")),ID:this.dict.get(p.of("ID"))},this.parseEntries()}parseEntries(){const e=[],[t,n,r]=this.byteWidths;for(let i=0,o=this.subsections.length;i<o;i++){const{firstObjectNumber:s,length:c}=this.subsections[i];for(let l=0;l<c;l++){let a=0;for(let y=0,w=t;y<w;y++)a=a<<8|this.bytes.next();let h=0;for(let y=0,w=n;y<w;y++)h=h<<8|this.bytes.next();let f=0;for(let y=0,w=r;y<w;y++)f=f<<8|this.bytes.next();t===0&&(a=1);const u=s+l,d={ref:oe.of(u,f),offset:h,deleted:a===0,inObjectStream:a===2};e.push(d)}}return e}};let ja=La;b(ja,"forStream",e=>new La(e));const Ua=class extends gr{constructor(e,t=1/0,n=!1,r=!1){super(jt.of(e),_i.create(),r),b(this,"objectsPerTick"),b(this,"throwOnInvalidObject"),b(this,"alreadyParsed",!1),b(this,"parsedObjects",0),b(this,"shouldWaitForTick",()=>(this.parsedObjects+=1,this.parsedObjects%this.objectsPerTick===0)),this.objectsPerTick=t,this.throwOnInvalidObject=n}async parseDocument(){if(this.alreadyParsed)throw new Pr("PDFParser","parseDocument");this.alreadyParsed=!0,this.context.header=this.parseHeader();let e;for(;!this.bytes.done();){await this.parseDocumentSection();const t=this.bytes.offset();if(t===e)throw new al(this.bytes.position());e=t}return this.maybeRecoverRoot(),this.context.lookup(oe.of(0))&&(console.warn("Removing parsed object: 0 0 R"),this.context.delete(oe.of(0))),this.context}maybeRecoverRoot(){const e=n=>n instanceof V&&n.lookup(p.of("Type"))===p.of("Catalog"),t=this.context.lookup(this.context.trailerInfo.Root);if(!e(t)){const n=this.context.enumerateIndirectObjects();for(let r=0,i=n.length;r<i;r++){const[o,s]=n[r];e(s)&&(this.context.trailerInfo.Root=o)}}}parseHeader(){for(;!this.bytes.done();){if(this.matchKeyword(te.header)){const e=this.parseRawInt();this.bytes.assertNext(m.Period);const t=this.parseRawInt(),n=bn.forVersion(e,t);return this.skipBinaryHeaderComment(),n}this.bytes.next()}throw new cl(this.bytes.position())}parseIndirectObjectHeader(){this.skipWhitespaceAndComments();const e=this.parseRawInt();this.skipWhitespaceAndComments();const t=this.parseRawInt();if(this.skipWhitespaceAndComments(),!this.matchKeyword(te.obj))throw new ll(this.bytes.position(),te.obj);return oe.of(e,t)}matchIndirectObjectHeader(){const e=this.bytes.offset();try{return this.parseIndirectObjectHeader(),!0}catch{return this.bytes.moveTo(e),!1}}async parseIndirectObject(){const e=this.parseIndirectObjectHeader();this.skipWhitespaceAndComments();const t=this.parseObject();return this.skipWhitespaceAndComments(),this.matchKeyword(te.endobj),t instanceof zt&&t.dict.lookup(p.of("Type"))===p.of("ObjStm")?await Ma.forStream(t,this.shouldWaitForTick).parseIntoContext():t instanceof zt&&t.dict.lookup(p.of("Type"))===p.of("XRef")?ja.forStream(t).parseIntoContext():this.context.assign(e,t),e}tryToParseInvalidIndirectObject(){const e=this.bytes.position(),t=`Trying to parse invalid object: ${JSON.stringify(e)})`;if(this.throwOnInvalidObject)throw new Error(t);console.warn(t);const n=this.parseIndirectObjectHeader();console.warn(`Invalid object ref: ${n}`),this.skipWhitespaceAndComments();const r=this.bytes.offset();let i=!0;for(;!this.bytes.done()&&(this.matchKeyword(te.endobj)&&(i=!1),!!i);)this.bytes.next();if(i)throw new il(e);const o=this.bytes.offset()-te.endobj.length,s=Ci.of(this.bytes.slice(r,o));return this.context.assign(n,s),n}async parseIndirectObjects(){for(this.skipWhitespaceAndComments();!this.bytes.done()&&ye[this.bytes.peek()];){const e=this.bytes.offset();try{await this.parseIndirectObject()}catch{this.bytes.moveTo(e),this.tryToParseInvalidIndirectObject()}this.skipWhitespaceAndComments(),this.skipJibberish(),this.shouldWaitForTick()&&await kt()}}maybeParseCrossRefSection(){if(this.skipWhitespaceAndComments(),!this.matchKeyword(te.xref))return;this.skipWhitespaceAndComments();let e=-1;const t=Jn.createEmpty();for(;!this.bytes.done()&&ye[this.bytes.peek()];){const n=this.parseRawInt();this.skipWhitespaceAndComments();const r=this.parseRawInt();this.skipWhitespaceAndComments();const i=this.bytes.peek();if(i===m.n||i===m.f){const o=oe.of(e,r);this.bytes.next()===m.n?t.addEntry(o,n):t.addDeletedEntry(o,n),e+=1}else e=n;this.skipWhitespaceAndComments()}return t}maybeParseTrailerDict(){if(this.skipWhitespaceAndComments(),!this.matchKeyword(te.trailer))return;this.skipWhitespaceAndComments();const e=this.parseDict(),{context:t}=this;t.trailerInfo={Root:e.get(p.of("Root"))||t.trailerInfo.Root,Encrypt:e.get(p.of("Encrypt"))||t.trailerInfo.Encrypt,Info:e.get(p.of("Info"))||t.trailerInfo.Info,ID:e.get(p.of("ID"))||t.trailerInfo.ID}}maybeParseTrailer(){if(this.skipWhitespaceAndComments(),!this.matchKeyword(te.startxref))return;this.skipWhitespaceAndComments();const e=this.parseRawInt();return this.skipWhitespace(),this.matchKeyword(te.eof),this.skipWhitespaceAndComments(),this.matchKeyword(te.eof),this.skipWhitespaceAndComments(),Qn.forLastCrossRefSectionOffset(e)}async parseDocumentSection(){await this.parseIndirectObjects(),this.maybeParseCrossRefSection(),this.maybeParseTrailerDict(),this.maybeParseTrailer(),this.skipJibberish()}skipJibberish(){for(this.skipWhitespaceAndComments();!this.bytes.done();){const e=this.bytes.offset(),t=this.bytes.peek();if(t>=m.Space&&t<=m.Tilde&&(this.matchKeyword(te.xref)||this.matchKeyword(te.trailer)||this.matchKeyword(te.startxref)||this.matchIndirectObjectHeader())){this.bytes.moveTo(e);break}this.bytes.next()}}skipBinaryHeaderComment(){this.skipWhitespaceAndComments();try{const e=this.bytes.offset();this.parseIndirectObjectHeader(),this.bytes.moveTo(e)}catch{this.bytes.next(),this.skipWhitespaceAndComments()}}};let $a=Ua;b($a,"forBytesWithOptions",(e,t,n,r)=>new Ua(e,t,n,r));const Ha=e=>e instanceof p?e:p.of(e),W=e=>e instanceof $?e:$.of(e),ve=e=>e instanceof $?e.asNumber():e;var Ga=(e=>(e.Degrees="degrees",e.Radians="radians",e))(Ga||{});const Be=e=>(D(e,"degreeAngle",["number"]),{type:"degrees",angle:e}),{Radians:Va,Degrees:Wa}=Ga,Pf=e=>e*Math.PI/180,Rf=e=>e*180/Math.PI,Fe=e=>e.type===Va?e.angle:e.type===Wa?Pf(e.angle):On(`Invalid rotation: ${JSON.stringify(e)}`),If=e=>e.type===Va?Rf(e.angle):e.type===Wa?e.angle:On(`Invalid rotation: ${JSON.stringify(e)}`),{cos:Ka,sin:Za,tan:qa}=Math,pr=(e,t,n,r,i,o)=>re.of(se.ConcatTransformationMatrix,[W(e),W(t),W(n),W(r),W(i),W(o)]),$t=(e,t)=>pr(1,0,0,1,e,t),Sn=(e,t)=>pr(e,0,0,t,0,0),vn=e=>pr(Ka(ve(e)),Za(ve(e)),-Za(ve(e)),Ka(ve(e)),0,0),oo=(e,t)=>pr(1,qa(ve(e)),qa(ve(t)),1,0,0),br=(e,t)=>re.of(se.SetLineDashPattern,[`[${e.map(W).join(" ")}]`,W(t)]);var kn=(e=>(e[e.Butt=0]="Butt",e[e.Round=1]="Round",e[e.Projecting=2]="Projecting",e))(kn||{});const mr=e=>re.of(se.SetLineCapStyle,[W(e)]),Ht=e=>re.of(se.SetGraphicsStateParams,[Ha(e)]),Qe=()=>re.of(se.PushGraphicsState),et=()=>re.of(se.PopGraphicsState),yr=e=>re.of(se.SetLineWidth,[W(e)]),De=(e,t,n,r,i,o)=>re.of(se.AppendBezierCurve,[W(e),W(t),W(n),W(r),W(i),W(o)]),_r=(e,t,n,r)=>re.of(se.CurveToReplicateInitialPoint,[W(e),W(t),W(n),W(r)]),Gt=()=>re.of(se.ClosePath),wt=(e,t)=>re.of(se.MoveTo,[W(e),W(t)]),Ve=(e,t)=>re.of(se.LineTo,[W(e),W(t)]),wr=()=>re.of(se.StrokePath),so=()=>re.of(se.FillNonZero),ao=()=>re.of(se.FillNonZeroAndStroke),Xa=e=>re.of(se.DrawObject,[Ha(e)]),Of=e=>re.of(se.NonStrokingColorGray,[W(e)]),zf=e=>re.of(se.StrokingColorGray,[W(e)]),Ff=(e,t,n)=>re.of(se.NonStrokingColorRgb,[W(e),W(t),W(n)]),Nf=(e,t,n)=>re.of(se.StrokingColorRgb,[W(e),W(t),W(n)]),Mf=(e,t,n,r)=>re.of(se.NonStrokingColorCmyk,[W(e),W(t),W(n),W(r)]),Lf=(e,t,n,r)=>re.of(se.StrokingColorCmyk,[W(e),W(t),W(n),W(r)]);var Ya=(e=>(e.Grayscale="Grayscale",e.RGB="RGB",e.CMYK="CMYK",e))(Ya||{});const An=(e,t,n)=>(tt(e,"red",0,1),tt(t,"green",0,1),tt(n,"blue",0,1),{type:"RGB",red:e,green:t,blue:n}),{Grayscale:Ja,RGB:Qa,CMYK:ec}=Ya,co=e=>e.type===Ja?Of(e.gray):e.type===Qa?Ff(e.red,e.green,e.blue):e.type===ec?Mf(e.cyan,e.magenta,e.yellow,e.key):On(`Invalid color: ${JSON.stringify(e)}`),xr=e=>e.type===Ja?zf(e.gray):e.type===Qa?Nf(e.red,e.green,e.blue):e.type===ec?Lf(e.cyan,e.magenta,e.yellow,e.key):On(`Invalid color: ${JSON.stringify(e)}`);class jf extends Error{constructor(){const t="Input document to `PDFDocument.load` is encrypted. You can use `PDFDocument.load(..., { ignoreEncryption: true })` if you wish to load the document anyways.";super(t)}}class Uf extends Error{constructor(){const t="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.";super(t)}}class $f extends Error{constructor(){const t="PDFDocument has no pages so `PDFDocument.removePage` cannot be called";super(t)}}let M=0,L=0,K=0,Z=0,Cn=0,Bn=0;const tc=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]]),Hf=e=>{let t;const n=[];let r=[],i="",o=!1,s=0;for(const c of e)if(tc.has(c))s=tc.get(c),t&&(i.length>0&&(r[r.length]=+i),n[n.length]={cmd:t,args:r},r=[],i="",o=!1),t=c;else if([" ",","].includes(c)||c==="-"&&i.length>0&&i[i.length-1]!=="e"||c==="."&&o){if(i.length===0)continue;r.length===s?(n[n.length]={cmd:t,args:r},r=[+i],t==="M"&&(t="L"),t==="m"&&(t="l")):r[r.length]=+i,o=c===".",i=["-","."].includes(c)?c:""}else i+=c,c==="."&&(o=!0);return i.length>0&&(r.length===s?(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},Gf=e=>{M=L=K=Z=Cn=Bn=0;let t=[];for(let n=0;n<e.length;n++){const r=e[n];if(r.cmd&&typeof nc[r.cmd]=="function"){const i=nc[r.cmd](r.args);Array.isArray(i)?t=t.concat(i):t.push(i)}}return t},nc={M(e){return M=e[0],L=e[1],K=Z=null,Cn=M,Bn=L,wt(M,L)},m(e){return M+=e[0],L+=e[1],K=Z=null,Cn=M,Bn=L,wt(M,L)},C(e){return M=e[4],L=e[5],K=e[2],Z=e[3],De(e[0],e[1],e[2],e[3],e[4],e[5])},c(e){const t=De(e[0]+M,e[1]+L,e[2]+M,e[3]+L,e[4]+M,e[5]+L);return K=M+e[2],Z=L+e[3],M+=e[4],L+=e[5],t},S(e){(K===null||Z===null)&&(K=M,Z=L);const t=De(M-(K-M),L-(Z-L),e[0],e[1],e[2],e[3]);return K=e[0],Z=e[1],M=e[2],L=e[3],t},s(e){(K===null||Z===null)&&(K=M,Z=L);const t=De(M-(K-M),L-(Z-L),M+e[0],L+e[1],M+e[2],L+e[3]);return K=M+e[0],Z=L+e[1],M+=e[2],L+=e[3],t},Q(e){return K=e[0],Z=e[1],M=e[2],L=e[3],_r(e[0],e[1],M,L)},q(e){const t=_r(e[0]+M,e[1]+L,e[2]+M,e[3]+L);return K=M+e[0],Z=L+e[1],M+=e[2],L+=e[3],t},T(e){K===null||Z===null?(K=M,Z=L):(K=M-(K-M),Z=L-(Z-L));const t=_r(K,Z,e[0],e[1]);return K=M-(K-M),Z=L-(Z-L),M=e[0],L=e[1],t},t(e){K===null||Z===null?(K=M,Z=L):(K=M-(K-M),Z=L-(Z-L));const t=_r(K,Z,M+e[0],L+e[1]);return M+=e[0],L+=e[1],t},A(e){const t=rc(M,L,e);return M=e[5],L=e[6],t},a(e){e[5]+=M,e[6]+=L;const t=rc(M,L,e);return M=e[5],L=e[6],t},L(e){return M=e[0],L=e[1],K=Z=null,Ve(M,L)},l(e){return M+=e[0],L+=e[1],K=Z=null,Ve(M,L)},H(e){return M=e[0],K=Z=null,Ve(M,L)},h(e){return M+=e[0],K=Z=null,Ve(M,L)},V(e){return L=e[0],K=Z=null,Ve(M,L)},v(e){return L+=e[0],K=Z=null,Ve(M,L)},Z(){const e=Gt();return M=Cn,L=Bn,e},z(){const e=Gt();return M=Cn,L=Bn,e}},rc=(e,t,n)=>{const[r,i,o,s,c,l,a]=n,h=Vf(l,a,r,i,s,c,o,e,t),f=[];for(const u of h){const d=Wf(...u);f.push(De(...d))}return f},Vf=(e,t,n,r,i,o,s,c,l)=>{const a=s*(Math.PI/180),h=Math.sin(a),f=Math.cos(a);n=Math.abs(n),r=Math.abs(r),K=f*(c-e)*.5+h*(l-t)*.5,Z=f*(l-t)*.5-h*(c-e)*.5;let u=K*K/(n*n)+Z*Z/(r*r);u>1&&(u=Math.sqrt(u),n*=u,r*=u);const d=f/n,y=h/n,w=-h/r,x=f/r,_=d*c+y*l,E=w*c+x*l,v=d*e+y*t,S=w*e+x*t;let C=1/((v-_)*(v-_)+(S-E)*(S-E))-.25;C<0&&(C=0);let k=Math.sqrt(C);o===i&&(k=-k);const F=.5*(_+v)-k*(S-E),I=.5*(E+S)+k*(v-_),T=Math.atan2(E-I,_-F);let J=Math.atan2(S-I,v-F)-T;J<0&&o===1?J+=2*Math.PI:J>0&&o===0&&(J-=2*Math.PI);const N=Math.ceil(Math.abs(J/(Math.PI*.5+.001))),O=[];for(let P=0;P<N;P++){const B=T+P*J/N,U=T+(P+1)*J/N;O[P]=[F,I,B,U,n,r,h,f]}return O},Wf=(e,t,n,r,i,o,s,c)=>{const l=c*i,a=-s*o,h=s*i,f=c*o,u=.5*(r-n),d=8/3*Math.sin(u*.5)*Math.sin(u*.5)/Math.sin(u),y=e+Math.cos(n)-d*Math.sin(n),w=t+Math.sin(n)+d*Math.cos(n),x=e+Math.cos(r),_=t+Math.sin(r),E=x+d*Math.sin(r),v=_-d*Math.cos(r);return[l*y+a*w,h*y+f*w,l*E+a*v,h*E+f*v,l*x+a*_,h*x+f*_]},Kf=e=>Gf(Hf(e)),Zf=(e,t)=>[Qe(),t.graphicsState&&Ht(t.graphicsState),$t(t.x,t.y),vn(Fe(t.rotate)),Sn(t.width,t.height),oo(Fe(t.xSkew),Fe(t.ySkew)),Xa(e),et()].filter(Boolean),qf=(e,t)=>[Qe(),t.graphicsState&&Ht(t.graphicsState),$t(t.x,t.y),vn(Fe(t.rotate)),Sn(t.xScale,t.yScale),oo(Fe(t.xSkew),Fe(t.ySkew)),Xa(e),et()].filter(Boolean),Xf=e=>{var t,n;return[Qe(),e.graphicsState&&Ht(e.graphicsState),e.color&&xr(e.color),yr(e.thickness),br((t=e.dashArray)!=null?t:[],(n=e.dashPhase)!=null?n:0),wt(e.start.x,e.start.y),e.lineCap&&mr(e.lineCap),wt(e.start.x,e.start.y),Ve(e.end.x,e.end.y),wr(),et()].filter(Boolean)},Yf=e=>{var t,n;return[Qe(),e.graphicsState&&Ht(e.graphicsState),e.color&&co(e.color),e.borderColor&&xr(e.borderColor),yr(e.borderWidth),e.borderLineCap&&mr(e.borderLineCap),br((t=e.borderDashArray)!=null?t:[],(n=e.borderDashPhase)!=null?n:0),$t(e.x,e.y),vn(Fe(e.rotate)),oo(Fe(e.xSkew),Fe(e.ySkew)),wt(0,0),Ve(0,e.height),Ve(e.width,e.height),Ve(e.width,0),Gt(),e.color&&e.borderWidth?ao():e.color?so():e.borderColor?wr():Gt(),et()].filter(Boolean)},Sr=4*((Math.sqrt(2)-1)/3),Jf=e=>{let t=ve(e.x),n=ve(e.y);const r=ve(e.xScale),i=ve(e.yScale);t-=r,n-=i;const o=r*Sr,s=i*Sr,c=t+r*2,l=n+i*2,a=t+r,h=n+i;return[Qe(),wt(t,h),De(t,h-s,a-o,n,a,n),De(a+o,n,c,h-s,c,h),De(c,h+s,a+o,l,a,l),De(a-o,l,t,h+s,t,h),et()]},Qf=e=>{const t=ve(e.x),n=ve(e.y),r=ve(e.xScale),i=ve(e.yScale),o=-r,s=-i,c=r*Sr,l=i*Sr,a=o+r*2,h=s+i*2,f=o+r,u=s+i;return[$t(t,n),vn(Fe(e.rotate)),wt(o,u),De(o,u-l,f-c,s,f,s),De(f+c,s,a,u-l,a,u),De(a,u+l,f+c,h,f,h),De(f-c,h,o,u+l,o,u)]},eu=e=>{var t,n,r;return[Qe(),e.graphicsState&&Ht(e.graphicsState),e.color&&co(e.color),e.borderColor&&xr(e.borderColor),yr(e.borderWidth),e.borderLineCap&&mr(e.borderLineCap),br((t=e.borderDashArray)!=null?t:[],(n=e.borderDashPhase)!=null?n:0),...e.rotate===void 0?Jf({x:e.x,y:e.y,xScale:e.xScale,yScale:e.yScale}):Qf({x:e.x,y:e.y,xScale:e.xScale,yScale:e.yScale,rotate:(r=e.rotate)!=null?r:Be(0)}),e.color&&e.borderWidth?ao():e.color?so():e.borderColor?wr():Gt(),et()].filter(Boolean)},tu=(e,t)=>{var n,r,i;return[Qe(),t.graphicsState&&Ht(t.graphicsState),$t(t.x,t.y),vn(Fe((n=t.rotate)!=null?n:Be(0))),t.scale?Sn(t.scale,-t.scale):Sn(1,-1),t.color&&co(t.color),t.borderColor&&xr(t.borderColor),t.borderWidth&&yr(t.borderWidth),t.borderLineCap&&mr(t.borderLineCap),br((r=t.borderDashArray)!=null?r:[],(i=t.borderDashPhase)!=null?i:0),...Kf(e),t.color&&t.borderWidth?ao():t.color?so():t.borderColor?wr():Gt(),et()].filter(Boolean)},nu={"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]};var xt=(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",e))(xt||{});const ic=class{constructor(e,t,n){b(this,"ref"),b(this,"doc"),b(this,"width"),b(this,"height"),b(this,"alreadyEmbedded",!1),b(this,"embedder"),D(e,"ref",[[oe,"PDFRef"]]),D(t,"doc",[[lt,"PDFDocument"]]),D(n,"embedder",[[ki,"PDFPageEmbedder"]]),this.ref=e,this.doc=t,this.width=n.width,this.height=n.height,this.embedder=n}scale(e){return D(e,"factor",["number"]),{width:this.width*e,height:this.height*e}}size(){return this.scale(1)}async embed(){this.alreadyEmbedded||(await this.embedder.embedIntoContext(this.doc.context,this.ref),this.alreadyEmbedded=!0)}};let oc=ic;b(oc,"of",(e,t,n)=>new ic(e,t,n));const sc=class{constructor(e,t,n){b(this,"ref"),b(this,"doc"),b(this,"name"),b(this,"modified",!0),b(this,"embedder"),D(e,"ref",[[oe,"PDFRef"]]),D(t,"doc",[[lt,"PDFDocument"]]),this.ref=e,this.doc=t,this.name=n.fontName,this.embedder=n}encodeText(e){return D(e,"text",["string"]),this.modified=!0,this.embedder.encodeText(e)}widthOfTextAtSize(e,t){return D(e,"text",["string"]),D(t,"size",["number"]),this.embedder.widthOfTextAtSize(e,t)}heightAtSize(e,t){var n;return D(e,"size",["number"]),j(t?.descender,"options.descender",["boolean"]),this.embedder.heightOfFontAtSize(e,{descender:(n=t?.descender)!=null?n:!0})}sizeAtHeight(e){return D(e,"height",["number"]),this.embedder.sizeOfFontAtHeight(e)}getCharacterSet(){return this.embedder.font.characterSet}async embed(){this.modified&&(await this.embedder.embedIntoContext(this.doc.context,this.ref),this.modified=!1)}};let ac=sc;b(ac,"of",(e,t,n)=>new sc(e,t,n));const cc=class{constructor(e,t,n){b(this,"ref"),b(this,"doc"),b(this,"width"),b(this,"height"),b(this,"embedder"),b(this,"embedTask"),D(e,"ref",[[oe,"PDFRef"]]),D(t,"doc",[[lt,"PDFDocument"]]),D(n,"embedder",[[Di,"JpegEmbedder"],[Ti,"PngEmbedder"]]),this.ref=e,this.doc=t,this.width=n.width,this.height=n.height,this.embedder=n}scale(e){return D(e,"factor",["number"]),{width:this.width*e,height:this.height*e}}scaleToFit(e,t){D(e,"width",["number"]),D(t,"height",["number"]);const n=e/this.width,r=t/this.height,i=Math.min(n,r);return this.scale(i)}size(){return this.scale(1)}async embed(){if(!!this.embedder){if(!this.embedTask){const{doc:e,ref:t}=this;this.embedTask=this.embedder.embedIntoContext(e.context,t)}await this.embedTask,this.embedder=void 0}}};let lc=cc;b(lc,"of",(e,t,n)=>new cc(e,t,n));const lo=class{constructor(e,t,n){b(this,"node"),b(this,"ref"),b(this,"doc"),b(this,"fontKey"),b(this,"font"),b(this,"fontSize",24),b(this,"fontColor",An(0,0,0)),b(this,"lineHeight",24),b(this,"x",0),b(this,"y",0),b(this,"contentStream"),b(this,"contentStreamRef"),D(e,"leafNode",[[Ge,"PDFPageLeaf"]]),D(t,"ref",[[oe,"PDFRef"]]),D(n,"doc",[[lt,"PDFDocument"]]),this.node=e,this.ref=t,this.doc=n}setRotation(e){const t=If(e);Kc(t,"degreesAngle",90),this.node.set(p.of("Rotate"),this.doc.context.obj(t))}getRotation(){const e=this.node.Rotate();return Be(e?e.asNumber():0)}setSize(e,t){D(e,"width",["number"]),D(t,"height",["number"]);const n=this.getMediaBox();this.setMediaBox(n.x,n.y,e,t);const r=this.getCropBox(),i=this.getBleedBox(),o=this.getTrimBox(),s=this.getArtBox(),c=this.node.CropBox(),l=this.node.BleedBox(),a=this.node.TrimBox(),h=this.node.ArtBox();c&&Fn(r,n)&&this.setCropBox(n.x,n.y,e,t),l&&Fn(i,n)&&this.setBleedBox(n.x,n.y,e,t),a&&Fn(o,n)&&this.setTrimBox(n.x,n.y,e,t),h&&Fn(s,n)&&this.setArtBox(n.x,n.y,e,t)}setWidth(e){D(e,"width",["number"]),this.setSize(e,this.getSize().height)}setHeight(e){D(e,"height",["number"]),this.setSize(this.getSize().width,e)}setMediaBox(e,t,n,r){D(e,"x",["number"]),D(t,"y",["number"]),D(n,"width",["number"]),D(r,"height",["number"]);const i=this.doc.context.obj([e,t,e+n,t+r]);this.node.set(p.MediaBox,i)}setCropBox(e,t,n,r){D(e,"x",["number"]),D(t,"y",["number"]),D(n,"width",["number"]),D(r,"height",["number"]);const i=this.doc.context.obj([e,t,e+n,t+r]);this.node.set(p.CropBox,i)}setBleedBox(e,t,n,r){D(e,"x",["number"]),D(t,"y",["number"]),D(n,"width",["number"]),D(r,"height",["number"]);const i=this.doc.context.obj([e,t,e+n,t+r]);this.node.set(p.BleedBox,i)}setTrimBox(e,t,n,r){D(e,"x",["number"]),D(t,"y",["number"]),D(n,"width",["number"]),D(r,"height",["number"]);const i=this.doc.context.obj([e,t,e+n,t+r]);this.node.set(p.TrimBox,i)}setArtBox(e,t,n,r){D(e,"x",["number"]),D(t,"y",["number"]),D(n,"width",["number"]),D(r,"height",["number"]);const i=this.doc.context.obj([e,t,e+n,t+r]);this.node.set(p.ArtBox,i)}getSize(){const{width:e,height:t}=this.getMediaBox();return{width:e,height:t}}getWidth(){return this.getSize().width}getHeight(){return this.getSize().height}getMediaBox(){return this.node.MediaBox().asRectangle()}getCropBox(){var e;const t=this.node.CropBox();return(e=t?.asRectangle())!=null?e:this.getMediaBox()}getBleedBox(){var e;const t=this.node.BleedBox();return(e=t?.asRectangle())!=null?e:this.getCropBox()}getTrimBox(){var e;const t=this.node.TrimBox();return(e=t?.asRectangle())!=null?e:this.getCropBox()}getArtBox(){var e;const t=this.node.ArtBox();return(e=t?.asRectangle())!=null?e:this.getCropBox()}translateContent(e,t){D(e,"x",["number"]),D(t,"y",["number"]),this.node.normalize(),this.getContentStream();const n=this.createContentStream(Qe(),$t(e,t)),r=this.doc.context.register(n),i=this.createContentStream(et()),o=this.doc.context.register(i);this.node.wrapContentStreams(r,o)}scale(e,t){D(e,"x",["number"]),D(t,"y",["number"]),this.setSize(this.getWidth()*e,this.getHeight()*t),this.scaleContent(e,t),this.scaleAnnotations(e,t)}scaleContent(e,t){D(e,"x",["number"]),D(t,"y",["number"]),this.node.normalize(),this.getContentStream();const n=this.createContentStream(Qe(),Sn(e,t)),r=this.doc.context.register(n),i=this.createContentStream(et()),o=this.doc.context.register(i);this.node.wrapContentStreams(r,o)}scaleAnnotations(e,t){D(e,"x",["number"]),D(t,"y",["number"]);const n=this.node.Annots();if(!!n)for(let r=0;r<n.size();r++){const i=n.lookup(r);i instanceof V&&this.scaleAnnot(i,e,t)}}resetPosition(){this.getContentStream(!1),this.x=0,this.y=0}setFont(e){D(e,"font",[[ac,"PDFFont"]]),this.font=e,this.fontKey=this.node.newFontDictionary(this.font.name,this.font.ref)}setFontSize(e){D(e,"fontSize",["number"]),this.fontSize=e}setFontColor(e){D(e,"fontColor",[[Object,"Color"]]),this.fontColor=e}setLineHeight(e){D(e,"lineHeight",["number"]),this.lineHeight=e}getPosition(){return{x:this.x,y:this.y}}getX(){return this.x}getY(){return this.y}moveTo(e,t){D(e,"x",["number"]),D(t,"y",["number"]),this.x=e,this.y=t}moveDown(e){D(e,"yDecrease",["number"]),this.y-=e}moveUp(e){D(e,"yIncrease",["number"]),this.y+=e}moveLeft(e){D(e,"xDecrease",["number"]),this.x-=e}moveRight(e){D(e,"xIncrease",["number"]),this.x+=e}pushOperators(...e){Po(e,"operator",[[re,"PDFOperator"]]),this.getContentStream().push(...e)}drawImage(e,t={}){var n,r,i,o,s,c,l;D(e,"image",[[lc,"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"]]),Ze(t.opacity,"opacity.opacity",0,1),Me(t.blendMode,"options.blendMode",xt);const a=this.node.newXObject("Image",e.ref),h=this.maybeEmbedGraphicsState({opacity:t.opacity,blendMode:t.blendMode});this.getContentStream().push(...Zf(a,{x:(n=t.x)!=null?n:this.x,y:(r=t.y)!=null?r:this.y,width:(i=t.width)!=null?i:e.size().width,height:(o=t.height)!=null?o:e.size().height,rotate:(s=t.rotate)!=null?s:Be(0),xSkew:(c=t.xSkew)!=null?c:Be(0),ySkew:(l=t.ySkew)!=null?l:Be(0),graphicsState:h}))}drawPage(e,t={}){var n,r,i,o,s;D(e,"embeddedPage",[[oc,"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"]]),Ze(t.opacity,"opacity.opacity",0,1),Me(t.blendMode,"options.blendMode",xt);const c=this.node.newXObject("EmbeddedPdfPage",e.ref),l=this.maybeEmbedGraphicsState({opacity:t.opacity,blendMode:t.blendMode}),a=t.width!==void 0?t.width/e.width:t.xScale!==void 0?t.xScale:1,h=t.height!==void 0?t.height/e.height:t.yScale!==void 0?t.yScale:1;this.getContentStream().push(...qf(c,{x:(n=t.x)!=null?n:this.x,y:(r=t.y)!=null?r:this.y,xScale:a,yScale:h,rotate:(i=t.rotate)!=null?i:Be(0),xSkew:(o=t.xSkew)!=null?o:Be(0),ySkew:(s=t.ySkew)!=null?s:Be(0),graphicsState:l}))}drawSvgPath(e,t={}){var n,r,i,o,s,c,l,a,h;D(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"]]),Ze(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"]),Me(t.borderLineCap,"options.borderLineCap",kn),Ze(t.borderOpacity,"options.borderOpacity",0,1),Me(t.blendMode,"options.blendMode",xt);const f=this.maybeEmbedGraphicsState({opacity:t.opacity,borderOpacity:t.borderOpacity,blendMode:t.blendMode});!("color"in t)&&!("borderColor"in t)&&(t.borderColor=An(0,0,0)),this.getContentStream().push(...tu(e,{x:(n=t.x)!=null?n:this.x,y:(r=t.y)!=null?r:this.y,scale:t.scale,rotate:(i=t.rotate)!=null?i:Be(0),color:(o=t.color)!=null?o:void 0,borderColor:(s=t.borderColor)!=null?s:void 0,borderWidth:(c=t.borderWidth)!=null?c:0,borderDashArray:(l=t.borderDashArray)!=null?l:void 0,borderDashPhase:(a=t.borderDashPhase)!=null?a:void 0,borderLineCap:(h=t.borderLineCap)!=null?h:void 0,graphicsState:f}))}drawLine(e){var t,n,r,i,o;D(e.start,"options.start",[[Object,"{ x: number, y: number }"]]),D(e.end,"options.end",[[Object,"{ x: number, y: number }"]]),D(e.start.x,"options.start.x",["number"]),D(e.start.y,"options.start.y",["number"]),D(e.end.x,"options.end.x",["number"]),D(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"]),Me(e.lineCap,"options.lineCap",kn),Ze(e.opacity,"opacity.opacity",0,1),Me(e.blendMode,"options.blendMode",xt);const s=this.maybeEmbedGraphicsState({borderOpacity:e.opacity,blendMode:e.blendMode});"color"in e||(e.color=An(0,0,0)),this.getContentStream().push(...Xf({start:e.start,end:e.end,thickness:(t=e.thickness)!=null?t:1,color:(n=e.color)!=null?n:void 0,dashArray:(r=e.dashArray)!=null?r:void 0,dashPhase:(i=e.dashPhase)!=null?i:void 0,lineCap:(o=e.lineCap)!=null?o:void 0,graphicsState:s}))}drawRectangle(e={}){var t,n,r,i,o,s,c,l,a,h,f,u,d;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"]]),Ze(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"]),Me(e.borderLineCap,"options.borderLineCap",kn),Ze(e.borderOpacity,"options.borderOpacity",0,1),Me(e.blendMode,"options.blendMode",xt);const y=this.maybeEmbedGraphicsState({opacity:e.opacity,borderOpacity:e.borderOpacity,blendMode:e.blendMode});!("color"in e)&&!("borderColor"in e)&&(e.color=An(0,0,0)),this.getContentStream().push(...Yf({x:(t=e.x)!=null?t:this.x,y:(n=e.y)!=null?n:this.y,width:(r=e.width)!=null?r:150,height:(i=e.height)!=null?i:100,rotate:(o=e.rotate)!=null?o:Be(0),xSkew:(s=e.xSkew)!=null?s:Be(0),ySkew:(c=e.ySkew)!=null?c:Be(0),borderWidth:(l=e.borderWidth)!=null?l:0,color:(a=e.color)!=null?a:void 0,borderColor:(h=e.borderColor)!=null?h:void 0,borderDashArray:(f=e.borderDashArray)!=null?f:void 0,borderDashPhase:(u=e.borderDashPhase)!=null?u:void 0,graphicsState:y,borderLineCap:(d=e.borderLineCap)!=null?d:void 0}))}drawSquare(e={}){const{size:t}=e;j(t,"size",["number"]),this.drawRectangle({...e,width:t,height:t})}drawEllipse(e={}){var t,n,r,i,o,s,c,l,a,h,f;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"]]),Ze(e.opacity,"opacity.opacity",0,1),j(e.borderColor,"options.borderColor",[[Object,"Color"]]),Ze(e.borderOpacity,"options.borderOpacity",0,1),j(e.borderWidth,"options.borderWidth",["number"]),j(e.borderDashArray,"options.borderDashArray",[Array]),j(e.borderDashPhase,"options.borderDashPhase",["number"]),Me(e.borderLineCap,"options.borderLineCap",kn),Me(e.blendMode,"options.blendMode",xt);const u=this.maybeEmbedGraphicsState({opacity:e.opacity,borderOpacity:e.borderOpacity,blendMode:e.blendMode});!("color"in e)&&!("borderColor"in e)&&(e.color=An(0,0,0)),this.getContentStream().push(...eu({x:(t=e.x)!=null?t:this.x,y:(n=e.y)!=null?n:this.y,xScale:(r=e.xScale)!=null?r:100,yScale:(i=e.yScale)!=null?i:100,rotate:(o=e.rotate)!=null?o:void 0,color:(s=e.color)!=null?s:void 0,borderColor:(c=e.borderColor)!=null?c:void 0,borderWidth:(l=e.borderWidth)!=null?l:0,borderDashArray:(a=e.borderDashArray)!=null?a:void 0,borderDashPhase:(h=e.borderDashPhase)!=null?h:void 0,borderLineCap:(f=e.borderLineCap)!=null?f:void 0,graphicsState:u}))}drawCircle(e={}){const{size:t=100}=e;j(t,"size",["number"]),this.drawEllipse({...e,xScale:t,yScale:t})}resetFont(){this.font=void 0,this.fontKey=void 0}getContentStream(e=!0){return e&&this.contentStream?this.contentStream:(this.contentStream=this.createContentStream(),this.contentStreamRef=this.doc.context.register(this.contentStream),this.node.addContentStream(this.contentStreamRef),this.contentStream)}createContentStream(...e){const t=this.doc.context.obj({});return Ft.of(t,e)}maybeEmbedGraphicsState(e){const{opacity:t,borderOpacity:n,blendMode:r}=e;if(t===void 0&&n===void 0&&r===void 0)return;const i=this.doc.context.obj({Type:"ExtGState",ca:t,CA:n,BM:r});return this.node.newExtGState("GS",i)}scaleAnnot(e,t,n){const r=["RD","CL","Vertices","QuadPoints","L","Rect"];for(let o=0,s=r.length;o<s;o++){const c=e.lookup(p.of(r[o]));c instanceof q&&c.scalePDFNumbers(t,n)}const i=e.lookup(p.of("InkList"));if(i instanceof q)for(let o=0,s=i.size();o<s;o++){const c=i.lookup(o);c instanceof q&&c.scalePDFNumbers(t,n)}}};let Vt=lo;b(Vt,"of",(e,t,n)=>new lo(e,t,n)),b(Vt,"create",e=>{D(e,"doc",[[lt,"PDFDocument"]]);const t=oe.of(-1),n=Ge.withContextAndParent(e.context,t),r=e.context.register(n);return new lo(n,r,e)});const hc=class{constructor(e,t,n){b(this,"ref"),b(this,"doc"),b(this,"alreadyEmbedded",!1),b(this,"embedder"),this.ref=e,this.doc=t,this.embedder=n}async embed(){if(!this.alreadyEmbedded){const{catalog:e,context:t}=this.doc,n=await this.embedder.embedIntoContext(this.doc.context,this.ref);e.has(p.of("Names"))||e.set(p.of("Names"),t.obj({}));const r=e.lookup(p.of("Names"),V);r.has(p.of("JavaScript"))||r.set(p.of("JavaScript"),t.obj({}));const i=r.lookup(p.of("JavaScript"),V);i.has(p.of("Names"))||i.set(p.of("Names"),t.obj([]));const o=i.lookup(p.of("Names"),q);o.push(X.fromText(this.embedder.scriptName)),o.push(n),this.alreadyEmbedded=!0}}};let dc=hc;b(dc,"of",(e,t,n)=>new hc(e,t,n));class ho{constructor(t,n){b(this,"script"),b(this,"scriptName"),this.script=t,this.scriptName=n}static for(t,n){return new ho(t,n)}async embedIntoContext(t,n){const r=t.obj({Type:"Action",S:"JavaScript",JS:X.fromText(this.script)});return n?(t.assign(n,r),n):t.register(r)}}class lt{constructor(t,n){if(b(this,"context"),b(this,"catalog"),b(this,"isEncrypted"),b(this,"defaultWordBreaks",[" "]),b(this,"fontkit"),b(this,"pageCount"),b(this,"pageCache"),b(this,"pageMap"),b(this,"fonts"),b(this,"images"),b(this,"embeddedPages"),b(this,"embeddedFiles"),b(this,"javaScripts"),b(this,"computePages",()=>{const r=[];return this.catalog.Pages().traverse((i,o)=>{if(i instanceof Ge){let s=this.pageMap.get(i);s||(s=Vt.of(i,o,this),this.pageMap.set(i,s)),r.push(s)}}),r}),D(t,"context",[[_i,"PDFContext"]]),D(n,"ignoreEncryption",["boolean"]),this.context=t,this.catalog=t.lookup(t.trailerInfo.Root),this.isEncrypted=!!t.lookup(t.trailerInfo.Encrypt),this.pageCache=At.populatedBy(this.computePages),this.pageMap=new Map,this.fonts=[],this.images=[],this.embeddedPages=[],this.embeddedFiles=[],this.javaScripts=[],!n&&this.isEncrypted)throw new jf}static async load(t,n={}){const{ignoreEncryption:r=!1,parseSpeed:i=100,throwOnInvalidObject:o=!1,updateMetadata:s=!0,capNumbers:c=!1}=n;D(t,"pdf",["string",Uint8Array,ArrayBuffer]),D(r,"ignoreEncryption",["boolean"]),D(i,"parseSpeed",["number"]),D(o,"throwOnInvalidObject",["boolean"]);const l=zc(t),a=await $a.forBytesWithOptions(l,i,o,c).parseDocument();return new lt(a,r)}registerFontkit(t){this.fontkit=t}getPageCount(){return this.pageCount===void 0&&(this.pageCount=this.getPages().length),this.pageCount}getPages(){return this.pageCache.access()}getPage(t){const n=this.getPages();return tt(t,"index",0,n.length-1),n[t]}getPageIndices(){return Oc(0,this.getPageCount())}removePage(t){const n=this.getPageCount();if(this.pageCount===0)throw new $f;tt(t,"index",0,n-1),this.catalog.removeLeafNode(t),this.pageCount=n-1}addPage(t){return D(t,"page",["undefined",[Vt,"PDFPage"],Array]),this.insertPage(this.getPageCount(),t)}insertPage(t,n){const r=this.getPageCount();if(tt(t,"index",0,r),D(n,"page",["undefined",[Vt,"PDFPage"],Array]),!n||Array.isArray(n)){const o=Array.isArray(n)?n:nu.A4;n=Vt.create(this),n.setSize(...o)}else if(n.doc!==this)throw new Uf;const i=this.catalog.insertLeafNode(n.ref,t);return n.node.setParent(i),this.pageMap.set(n.node,n),this.pageCache.invalidate(),this.pageCount=r+1,n}addJavaScript(t,n){D(t,"name",["string"]),D(n,"script",["string"]);const r=ho.for(n,t),i=this.context.nextRef(),o=dc.of(i,this,r);this.javaScripts.push(o)}async flush(){await this.embedAll(this.fonts),await this.embedAll(this.images),await this.embedAll(this.embeddedPages),await this.embedAll(this.embeddedFiles),await this.embedAll(this.javaScripts)}async save(t={}){const{useObjectStreams:n=!0,addDefaultPage:r=!0,objectsPerTick:i=50,updateFieldAppearances:o=!0}=t;return D(n,"useObjectStreams",["boolean"]),D(r,"addDefaultPage",["boolean"]),D(i,"objectsPerTick",["number"]),D(o,"updateFieldAppearances",["boolean"]),r&&this.getPageCount()===0&&this.addPage(),await this.flush(),(n?xa:vi).forContext(this.context,i).serializeToBuffer()}async saveAsBase64(t={}){const{dataUri:n=!1,...r}=t;D(n,"dataUri",["boolean"]);const i=await this.save(r),o=Cc(i);return n?`data:application/pdf;base64,${o}`:o}findPageForAnnotationRef(t){const n=this.getPages();for(let r=0,i=n.length;r<i;r++){const o=n[r],s=o.node.Annots();if(s?.indexOf(t)!==void 0)return o}}async embedAll(t){for(let n=0,r=t.length;n<r;n++)await t[n].embed()}}var Ne;(function(e){e.APNG="image/apng",e.AVIF="image/avif",e.BMP="image/bmp",e.GIF="image/gif",e.JPEG="image/jpeg",e.PNG="image/png",e.SVG="image/svg+xml",e.WEBP="image/webp",e.ICON="image/x-icon"})(Ne||(Ne={}));var vr;(function(e){e.UnsupportedFileType="unsupported-file-type",e.FileSizeExceeded="file-size-exceeded"})(vr||(vr={}));var Wt;(function(e){e.textSelection="vpv:annotation:textSelection",e.freeText="vpv:annotation:freeText",e.signature="vpv:annotation:signature",e.image="vpv:annotation:image",e.highlight="vpv:annotation:highlight",e.underline="vpv:annotation:underline",e.strikeout="vpv:annotation:strikeout"})(Wt||(Wt={}));var kr;(function(e){e.AnnotationCreated="vpv:annotation:created",e.AnnotationUpdated="vpv:annotation:updated",e.AnnotationDeleted="vpv:annotation:deleted",e.AnnotationMounted="vpv:annotation:mounted",e.Rotate="vpv:rotate",e.ShowNotificationError="vpv:notification:error"})(kr||(kr={})),de.AnnotationType=void 0,function(e){e[e.Text=1]="Text",e[e.Link=2]="Link",e[e.FreeText=3]="FreeText",e[e.Line=4]="Line",e[e.Square=5]="Square",e[e.Circle=6]="Circle",e[e.Polygon=7]="Polygon",e[e.Polyline=8]="Polyline",e[e.Highlight=9]="Highlight",e[e.Underline=10]="Underline",e[e.Squiggly=11]="Squiggly",e[e.StrikeOut=12]="StrikeOut",e[e.Stamp=13]="Stamp",e[e.Caret=14]="Caret",e[e.Ink=15]="Ink",e[e.Popup=16]="Popup",e[e.FileAttachment=17]="FileAttachment",e[e.Sound=18]="Sound",e[e.Movie=19]="Movie",e[e.Widget=20]="Widget",e[e.Screen=21]="Screen",e[e.PrinterMark=22]="PrinterMark",e[e.TrapNet=23]="TrapNet",e[e.Watermark=24]="Watermark",e[e.ThreeD=25]="ThreeD",e[e.Redact=26]="Redact"}(de.AnnotationType||(de.AnnotationType={})),de.AnnotationFlag=void 0,function(e){e[e.INVISIBLE=1]="INVISIBLE",e[e.HIDDEN=2]="HIDDEN",e[e.PRINT=4]="PRINT",e[e.NOZOOM=8]="NOZOOM",e[e.NOROTATE=16]="NOROTATE",e[e.NOVIEW=32]="NOVIEW",e[e.READONLY=64]="READONLY",e[e.LOCKED=128]="LOCKED",e[e.TOGGLENOVIEW=256]="TOGGLENOVIEW",e[e.LOCKEDCONTENTS=512]="LOCKEDCONTENTS"}(de.AnnotationFlag||(de.AnnotationFlag={}));const ru={ANNOTATIONS:"annotations"},Dn=Symbol("VPV Shared UIs"),fc=Symbol("VPV Current Localization"),Tn=kr,fo={Black:"#000000",DarkGray:"#444444",Gray:"#696969",LightGray:"#9C9C9C",LightestGray:"#CDCDCD",ChristmasWhite:"#EDEDED"},Re={...fo,Purple:"#7862FF",Blue:"#1777FF",Red:"#F66365",Orange:"#F67E63",Yellow:"#F5C463",Green:"#48BB77"},Ie={Purple:"#CAAAFF",Cyan:"#65EDE9",Red:"#FFACAC",Orange:"#FFBD82",Yellow:"#FCE244",Green:"#A0F751",...fo},ce={Purple:"#7862FF",Blue:"#1777FF",Red:"#F66365",Orange:"#F67E63",Yellow:"#F5C463",Green:"#48BB77",...fo},iu={[Ie.Purple]:"Purple",[Ie.Cyan]:"Cyan",[Ie.Red]:"Red",[Ie.Orange]:"Orange",[Ie.Yellow]:"Yellow",[Ie.Green]:"Green",[Ie.Black]:"Black",[Ie.DarkGray]:"Dark Gray",[Ie.Gray]:"Gray",[Ie.LightGray]:"Light Gray",[Ie.LightestGray]:"Lightest Gray",[Ie.ChristmasWhite]:"Christmas White"},ou={[ce.Purple]:"Purple",[ce.Blue]:"Blue",[ce.Red]:"Red",[ce.Orange]:"Orange",[ce.Yellow]:"Yellow",[ce.Green]:"Green",[ce.Black]:"Black",[ce.DarkGray]:"Dark Gray",[ce.Gray]:"Gray",[ce.LightGray]:"Light Gray",[ce.LightestGray]:"Lightest Gray",[ce.ChristmasWhite]:"Christmas White"},su={[ce.Purple]:"Purple",[ce.Blue]:"Blue",[ce.Red]:"Red",[ce.Orange]:"Orange",[ce.Yellow]:"Yellow",[ce.Green]:"Green",[ce.Black]:"Black",[ce.DarkGray]:"Dark Gray",[ce.Gray]:"Gray",[ce.LightGray]:"Light Gray",[ce.LightestGray]:"Lightest Gray",[ce.ChristmasWhite]:"Christmas White"},au={[Re.Black]:"Black",[Re.DarkGray]:"Dark Gray",[Re.Gray]:"Gray",[Re.LightGray]:"Light Gray",[Re.LightestGray]:"Lightest Gray",[Re.ChristmasWhite]:"Christmas White",[Re.Purple]:"Purple",[Re.Blue]:"Blue",[Re.Red]:"Red",[Re.Orange]:"Orange",[Re.Yellow]:"Yellow",[Re.Green]:"Green"},cu="pdfjs_internal_editor_",Kt=(e,t)=>`${e}-${t}`;class lu{static async serializeAnnotationsToPdf(t,n,r){const i=await lt.load(t),o=i.getPages();if(r&&r.length>0){const a=typeof r[0]=="string"?r.map(h=>({id:h,pageIndex:-1,annotationType:-1})):r;await this.removeAnnotations(i,o,a)}const s=n.filter(a=>a.annotationType===de.AnnotationType.Underline||a.annotationType===de.AnnotationType.StrikeOut),c=n.filter(a=>a.annotationType===de.AnnotationType.Square);for(const a of s)await this.addTextMarkupAnnotation(i,o,a);for(const a of c)await this.addRectangleAnnotation(i,o,a);return await i.save()}static async removeAnnotations(t,n,r){const i=new Map,o=[];for(const s of r)if(s.pageIndex>=0){const c=i.get(s.pageIndex)||[];c.push(s),i.set(s.pageIndex,c)}else o.push(s);for(let s=0;s<n.length;s++){const c=n[s],l=[...i.get(s)||[],...o];if(l.length===0)continue;const a=c.node.Annots();if(!a||!(a instanceof q))continue;const h=[];for(let f=0;f<a.size();f++){const u=a.get(f);let d;if(u instanceof oe){const w=t.context.lookup(u);w instanceof V&&(d=w)}else u instanceof V&&(d=u);if(!d)continue;this.matchesDeletedAnnotation(d,l)&&h.push(f)}for(let f=h.length-1;f>=0;f--)a.remove(h[f])}}static matchesDeletedAnnotation(t,n){const r=t.get(p.of("NM"));let i=null;if((r instanceof ee||r instanceof X)&&(i=r.decodeText()),i&&n.find(f=>f.id===i))return!0;const o=t.get(p.of("Subtype")),s=o instanceof p?o.decodeText():null;let c=null;if(s==="Underline"?c=de.AnnotationType.Underline:s==="StrikeOut"&&(c=de.AnnotationType.StrikeOut),c===null)return!1;const l=t.get(p.of("Rect"));if(!(l instanceof q))return!1;const a=[];for(let h=0;h<l.size();h++){const f=l.get(h);f instanceof $&&a.push(f.asNumber())}if(a.length!==4)return!1;for(const h of n){if(h.annotationType!==-1&&h.annotationType!==c||!h.rect||h.rect.length!==4)continue;const f=1;if(Math.abs(a[0]-h.rect[0])<f&&Math.abs(a[1]-h.rect[1])<f&&Math.abs(a[2]-h.rect[2])<f&&Math.abs(a[3]-h.rect[3])<f)return!0}return!1}static async addTextMarkupAnnotation(t,n,r){const i=n[r.pageIndex??0],o=r.rect,s=Array.from(r.quadPoints||[]),c={Type:"Annot",Subtype:r.annotationType===de.AnnotationType.Underline?"Underline":"StrikeOut",Rect:o,QuadPoints:s,C:[(r.color?.[0]??0)/255,(r.color?.[1]??0)/255,(r.color?.[2]??0)/255],F:4,Contents:X.fromText(r.contents||`${r.subtype} annotation`)};if(r.modificationDate){const f=r.modificationDate instanceof Date?this.formatPdfDate(r.modificationDate):r.modificationDate.toString();c.M=ee.of(f)}if(r.creationDate){const f=r.creationDate instanceof Date?this.formatPdfDate(r.creationDate):r.creationDate.toString();c.CreationDate=ee.of(f)}c.T=X.fromText(r.titleObj?.str||"Vue PDF Viewer"),r.id&&(c.NM=X.fromText(r.id));const l=t.context.obj(c),a=t.context.register(l);let h=i.node.lookup(p.of("Annots"));h||(h=t.context.obj([]),i.node.set(p.of("Annots"),h)),h instanceof q&&h.push(a)}static formatPdfDate(t){const n=t.getFullYear(),r=String(t.getMonth()+1).padStart(2,"0"),i=String(t.getDate()).padStart(2,"0"),o=String(t.getHours()).padStart(2,"0"),s=String(t.getMinutes()).padStart(2,"0"),c=String(t.getSeconds()).padStart(2,"0"),l=-t.getTimezoneOffset(),a=l>=0?"+":"-",h=String(Math.floor(Math.abs(l)/60)).padStart(2,"0"),f=String(Math.abs(l)%60).padStart(2,"0");return`D:${n}${r}${i}${o}${s}${c}${a}${h}'${f}`}static async addRectangleAnnotation(t,n,r){const i=n[r.pageIndex??0],{height:o}=i.getSize(),s=this.convertRectToPdfCoords(r.rect,o),c=r.borderColor||r.color,l=r.backgroundColor,a={Type:"Annot",Subtype:"Square",Rect:s,F:r.annotationFlags??4};if(c&&(a.C=[(c[0]??0)/255,(c[1]??0)/255,(c[2]??0)/255]),l&&(a.IC=[(l[0]??0)/255,(l[1]??0)/255,(l[2]??0)/255]),r.borderStyle){const d={Type:"Border"};if(r.borderStyle.width!==void 0&&(d.W=r.borderStyle.width),r.borderStyle.style!==void 0){const y={1:"S",2:"D",3:"B",4:"I",5:"U"};d.S=p.of(y[r.borderStyle.style]||"S")}r.borderStyle.dashArray&&r.borderStyle.dashArray.length>0&&(d.D=r.borderStyle.dashArray),a.BS=t.context.obj(d)}if(r.opacity!==void 0&&r.opacity<1&&(a.CA=r.opacity),r.contents&&(a.Contents=X.fromText(r.contents)),r.creationDate){const d=r.creationDate instanceof Date?this.formatPdfDate(r.creationDate):r.creationDate.toString();a.CreationDate=ee.of(d)}if(r.modificationDate){const d=r.modificationDate instanceof Date?this.formatPdfDate(r.modificationDate):r.modificationDate.toString();a.M=ee.of(d)}const h=t.context.obj(a),f=t.context.register(h);let u=i.node.lookup(p.of("Annots"));u||(u=t.context.obj([]),i.node.set(p.of("Annots"),u)),u instanceof q&&u.push(f)}static convertRectToPdfCoords(t,n){return[t[0],n-t[3],t[2],n-t[1]]}static convertQuadPointsToPdfCoords(t,n){const r=[];for(let i=0;i<t.length;i+=2)r.push(t[i],n-t[i+1]);return r}}const hu={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",honeydew:"#f0fff0",hotpink:"#ff69b4","indianred ":"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgrey:"#d3d3d3",lightgreen:"#90ee90",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370d8",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#d87093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"},du=e=>e.startsWith("#")||e.startsWith("0x")?e:hu[e]||e,En=g.defineComponent({__name:"AppTooltip",setup(e){const t=g.inject(Dn),n=g.computed(()=>t?.AppTooltip);return(r,i)=>n.value?(g.openBlock(),g.createBlock(g.resolveDynamicComponent(n.value),g.normalizeProps(g.mergeProps({key:0},r.$attrs)),g.createSlots({default:g.withCtx(()=>[g.renderSlot(r.$slots,"default")]),_:2},[g.renderList(r.$slots,(o,s)=>({name:s,fn:g.withCtx(()=>[g.renderSlot(r.$slots,s)])}))]),1040)):(g.openBlock(),g.createElementBlock("div",g.normalizeProps(g.mergeProps({key:1},r.$attrs)),[g.renderSlot(r.$slots,"default")],16))}}),Pn=g.defineComponent({inheritAttrs:!1,__name:"AppButton",props:{ariaLabel:{},ariaDisabled:{type:Boolean}},setup(e){const t=e,n=g.useAttrs(),r=g.inject(Dn),i=g.computed(()=>r?.AppButton),o=g.computed(()=>({"aria-label":t.ariaLabel,"aria-disabled":t.ariaDisabled,...n}));return(s,c)=>i.value?(g.openBlock(),g.createBlock(g.resolveDynamicComponent(i.value),g.normalizeProps(g.mergeProps({key:0},o.value)),{default:g.withCtx(()=>[g.renderSlot(s.$slots,"default")]),_:3},16)):(g.openBlock(),g.createElementBlock("button",g.normalizeProps(g.mergeProps({key:1},o.value)),[g.renderSlot(s.$slots,"default")],16))}}),fu=(e,t)=>{const n=e[t];return n?typeof n=="function"?n():Promise.resolve(n):new Promise((r,i)=>{(typeof queueMicrotask=="function"?queueMicrotask:setTimeout)(i.bind(null,new Error("Unknown variable dynamic import: "+t)))})},uu=g.defineComponent({__name:"Icon",props:{name:{}},setup(e){const t=e,n=g.defineAsyncComponent({loader:()=>fu(Object.assign({"../assets/icons/annotations.svg":()=>Promise.resolve().then(()=>Eu),"../assets/icons/tool-comment.svg":()=>Promise.resolve().then(()=>Ru),"../assets/icons/tool-free-text.svg":()=>Promise.resolve().then(()=>Ou),"../assets/icons/tool-highlight.svg":()=>Promise.resolve().then(()=>Fu),"../assets/icons/tool-image.svg":()=>Promise.resolve().then(()=>Mu),"../assets/icons/tool-signature.svg":()=>Promise.resolve().then(()=>ju),"../assets/icons/tool-strikethrough.svg":()=>Promise.resolve().then(()=>$u),"../assets/icons/tool-text-selection.svg":()=>Promise.resolve().then(()=>Gu),"../assets/icons/tool-underline.svg":()=>Promise.resolve().then(()=>Wu)}),`../assets/icons/${t.name}.svg`)});return(r,i)=>(g.openBlock(),g.createBlock(g.resolveDynamicComponent(g.unref(n)),{class:"vp-text-xl"}))}}),e0="",uo=(e,t)=>{const n=e.__vccOpts||e;for(const[r,i]of t)n[r]=i;return n},ht=uo(uu,[["__scopeId","data-v-9d5f0033"]]),Rn=()=>{const e=g.inject(fc,g.computed(()=>({})));return{t:g.computed(()=>n=>{const r=n.split(".").pop()||n;return e.value&&r in e.value?e.value[r]:(console.warn(`useLocalization - Translation not found for key: ${n}`),n)}).value,currentLocale:g.computed(()=>e.value)}},gu=g.defineComponent({__name:"ToolAnnotation",emits:["toggle"],setup(e,{emit:t}){const{t:n}=Rn(),r=t,i=g.ref(!1),o=()=>{i.value=!i.value,r("toggle",i.value)};return(s,c)=>s.$slots.default?g.renderSlot(s.$slots,"default",{key:0,onClick:o},void 0,!0):(g.openBlock(),g.createBlock(En,{key:1},{content:g.withCtx(()=>[g.createTextVNode(g.toDisplayString(i.value?g.unref(n)("annotationToggleHideTooltip"):g.unref(n)("annotationToggleShowTooltip")),1)]),default:g.withCtx(()=>[g.createVNode(Pn,{"aria-label":i.value?g.unref(n)("annotationToggleHideTooltip"):g.unref(n)("annotationToggleShowTooltip"),class:g.normalizeClass(["vpv-toolbar-btn",{"vpv-toolbar-btn-active":i.value}]),onClick:o},{default:g.withCtx(()=>[g.createVNode(ht,{name:"annotations",class:"vp-text-xl"})]),_:1},8,["aria-label","class"])]),_:1}))}}),t0="",pu=uo(gu,[["__scopeId","data-v-df5778ee"]]),bu=g.defineComponent({__name:"ToolAnnotationTextSelection",props:g.mergeModels({ariaDisabled:{type:Boolean},active:{type:Boolean}},{active:{type:Boolean,required:!0},activeModifiers:{}}),emits:["update:active"],setup(e){const t=e,n=g.useModel(e,"active"),{t:r}=Rn(),i=g.computed(()=>t.ariaDisabled===!0),o=()=>{i.value||(n.value=!n.value)};return(s,c)=>s.$slots.default?g.renderSlot(s.$slots,"default",g.mergeProps({key:0},s.$attrs,{onClick:o})):(g.openBlock(),g.createBlock(En,{key:1},{content:g.withCtx(()=>[g.createTextVNode(g.toDisplayString(g.unref(r)("annotationTextSelectionTooltip")),1)]),default:g.withCtx(()=>[g.createVNode(Pn,g.mergeProps({"aria-label":g.unref(r)("annotationTextSelectionLabel"),class:["vpv-toolbar-btn",{"vpv-toolbar-btn-active":n.value}]},s.$attrs,{onClick:o}),{default:g.withCtx(()=>[g.renderSlot(s.$slots,"icon",{},()=>[g.createVNode(ht,{name:"tool-text-selection"})])]),_:3},16,["aria-label","class"])]),_:3}))}}),mu=g.defineComponent({__name:"AppPopover",props:{open:{type:Boolean},side:{},sideOffset:{},class:{},ariaLabel:{}},setup(e){const t=e,n=g.inject(Dn),r=g.computed(()=>n?.AppPopover);return(i,o)=>r.value?(g.openBlock(),g.createBlock(g.resolveDynamicComponent(r.value),g.normalizeProps(g.mergeProps({key:0},t)),{trigger:g.withCtx(()=>[g.renderSlot(i.$slots,"trigger")]),default:g.withCtx(()=>[g.renderSlot(i.$slots,"default")]),_:3},16)):(g.openBlock(),g.createElementBlock("button",g.normalizeProps(g.mergeProps({key:1},t)),[g.renderSlot(i.$slots,"default")],16))}}),yu=g.defineComponent({__name:"AppSignatures",setup(e){const t=g.inject(Dn),n=g.computed(()=>t?.AppSignatures);return(r,i)=>n.value?(g.openBlock(),g.createBlock(g.resolveDynamicComponent(n.value),g.normalizeProps(g.mergeProps({key:0},r.$attrs)),null,16)):g.createCommentVNode("",!0)}}),_u=g.defineComponent({__name:"ToolAnnotationSignature",props:g.mergeModels({ariaDisabled:{type:Boolean},active:{type:Boolean}},{active:{type:Boolean,required:!0},activeModifiers:{}}),emits:["update:active"],setup(e){const t=e,n=g.useModel(e,"active"),{t:r}=Rn(),i=g.ref(!1),o=g.computed(()=>t.ariaDisabled===!0),s=()=>{o.value||(!n.value&&!i.value&&(i.value=!0),n.value=!n.value)},c=l=>{i.value=!1};return(l,a)=>l.$slots.default?g.renderSlot(l.$slots,"default",g.mergeProps({key:0},l.$attrs,{onClick:s})):(g.openBlock(),g.createBlock(mu,{key:1,open:i.value,side:"right",sideOffset:10,class:"vpv-annotation-signatures__popover",onInteractOutside:c},{trigger:g.withCtx(()=>[g.createVNode(En,null,{content:g.withCtx(()=>[g.createTextVNode(g.toDisplayString(g.unref(r)("annotationSignatureTooltip")),1)]),default:g.withCtx(()=>[g.createVNode(Pn,g.mergeProps({"aria-label":g.unref(r)("annotationSignatureLabel"),class:["vpv-toolbar-btn",{"vpv-toolbar-btn-active":n.value}]},l.$attrs,{onClick:s}),{default:g.withCtx(()=>[g.renderSlot(l.$slots,"icon",{},()=>[g.createVNode(ht,{name:"tool-signature"})])]),_:3},16,["aria-label","class"])]),_:3})]),default:g.withCtx(()=>[g.createVNode(yu)]),_:3},8,["open"]))}}),wu=g.defineComponent({__name:"ToolAnnotationFreeText",props:g.mergeModels({ariaDisabled:{type:Boolean},active:{type:Boolean}},{active:{type:Boolean,required:!0},activeModifiers:{}}),emits:["update:active"],setup(e){const t=e,n=g.useModel(e,"active"),{t:r}=Rn(),i=g.computed(()=>t.ariaDisabled===!0),o=()=>{i.value||(n.value=!n.value)};return(s,c)=>s.$slots.default?g.renderSlot(s.$slots,"default",g.mergeProps({key:0},s.$attrs,{onClick:o})):(g.openBlock(),g.createBlock(En,{key:1},{content:g.withCtx(()=>[g.createTextVNode(g.toDisplayString(g.unref(r)("annotationFreeTextTooltip")),1)]),default:g.withCtx(()=>[g.createVNode(Pn,g.mergeProps({"aria-label":g.unref(r)("annotationFreeTextLabel"),class:["vpv-toolbar-btn",{"vpv-toolbar-btn-active":n.value}]},s.$attrs,{onClick:o}),{default:g.withCtx(()=>[g.renderSlot(s.$slots,"icon",{},()=>[g.createVNode(ht,{name:"tool-free-text"})])]),_:3},16,["aria-label","class"])]),_:3}))}}),xu=g.defineComponent({__name:"ToolAnnotationImage",props:{ariaDisabled:{type:Boolean}},emits:["change"],setup(e,{emit:t}){const n=e,{t:r}=Rn(),i=t,o=g.computed(()=>n.ariaDisabled===!0),s=()=>{if(o.value)return;const c=document.createElement("input");c.type="file",c.accept="image/*",c.onchange=l=>{const a=l.target.files?.[0];i("change",a)},c.click()};return(c,l)=>c.$slots.default?g.renderSlot(c.$slots,"default",g.mergeProps({key:0},c.$attrs,{onClick:s})):(g.openBlock(),g.createBlock(En,{key:1},{content:g.withCtx(()=>[g.createTextVNode(g.toDisplayString(g.unref(r)("annotationImageTooltip")),1)]),default:g.withCtx(()=>[g.createVNode(Pn,g.mergeProps({"aria-label":g.unref(r)("annotationImageLabel"),class:"vpv-toolbar-btn"},c.$attrs,{onClick:s}),{default:g.withCtx(()=>[g.renderSlot(c.$slots,"icon",{},()=>[g.createVNode(ht,{name:"tool-image"})])]),_:3},16,["aria-label"])]),_:3}))}}),n0="",uc={B:1,K:1e3,KB:1e3,M:1e3**2,MB:1e3**2,G:1e3**3,GB:1e3**3,T:1e3**4,TB:1e3**4};function Su(e){if(!e||typeof e!="string")return{isValid:!1,bytes:0,error:"Size input is required and must be a string"};const n=e.trim().toUpperCase().match(/^(\d*\.?\d+)\s*([KMGTB]B?)?$/);if(!n)return{isValid:!1,bytes:0,error:'Invalid format. Expected: number + optional unit (e.g., "10MB", "1.5G", "512")'};const[,r,i="B"]=n,o=parseFloat(r);if(isNaN(o)||o<0)return{isValid:!1,bytes:0,error:"Size must be a positive number"};const s=i;return s in uc?{isValid:!0,bytes:Math.floor(o*uc[s])}:{isValid:!1,bytes:0,error:`Unsupported unit "${i}". Supported: B, K, KB, M, MB, G, GB, T, TB`}}function vu(e,t=1){if(e===0)return"0 B";const n=["B","KB","MB","GB","TB"],r=1e3,i=Math.floor(Math.log(e)/Math.log(r)),o=e/Math.pow(r,i);return`${t===0?Math.round(o):o.toFixed(t)} ${n[i]}`}function ku(e){const t=Su(e);if(!t.isValid)throw new Error(t.error);return t.bytes}const Au={class:"vpv-annotation-tools-container"},Cu={key:0,class:"vpv-annotation-tools"},Bu=g.defineComponent({__name:"VPdfAnnotationTools",props:{textSelection:{type:[Object,Boolean],default:()=>!0},freeText:{type:[Object,Boolean],default:()=>!0},signature:{type:[Object,Boolean],default:()=>!1},image:{type:[Object,Boolean],default:()=>!0},instanceId:{type:Number,required:!0},onAnnotationCreated:{type:Function,default:void 0},onAnnotationUpdated:{type:Function,default:void 0},onAnnotationDeleted:{type:Function,default:void 0}},emits:["textSelection","freeText","signature","image"],setup(e,{emit:t}){const n=e,r=t,i=g.ref(!1),o=O=>Kt(n.instanceId,O),s={textSelection:new CustomEvent(o(Wt.textSelection),{detail:{active:!1,highlight:null,strikethrough:null,underline:null}}),freeText:new CustomEvent(o(Wt.freeText),{detail:{active:!1,fontColors:null,fontSizes:null}}),signature:new CustomEvent(o(Wt.signature),{detail:{active:!1}}),image:new CustomEvent(o(Wt.image),{detail:{file:void 0}}),error:new CustomEvent(o(kr.ShowNotificationError),{detail:{error:void 0,maxSize:void 0}})},c=g.ref(!1),l=g.reactive({textSelection:!1,freeText:!1,signature:!1}),a=g.computed({get:()=>l.textSelection,set:O=>{l.textSelection=O,O&&(l.freeText=!1,l.signature=!1),T()}}),h=g.computed({get:()=>l.freeText,set:O=>{O&&(l.textSelection=!1,l.signature=!1),l.freeText=O,T()}}),f=g.computed({get:()=>l.signature,set:O=>{O&&(l.textSelection=!1,l.freeText=!1),l.signature=O,T()}}),u=g.computed(()=>n.textSelection),d=g.computed(()=>n.freeText),y=g.computed(()=>n.signature),w=g.computed(()=>n.image);function x(O){return O.map(P=>typeof P=="string"?{value:du(P),label:P}:P)}const _=O=>{c.value=O,O||(a.value=!1,h.value=!1,f.value=!1)},E=Object.entries(iu).map(([O,P])=>({value:O,label:P})),v=Object.entries(ou).map(([O,P])=>({value:O,label:P})),S=Object.entries(su).map(([O,P])=>({value:O,label:P})),z=O=>{r("textSelection",O),s.textSelection.detail.active=O;let P={icon:g.markRaw(g.h(ht,{name:"tool-highlight"}))},B={icon:g.markRaw(g.h(ht,{name:"tool-strikethrough"}))},U={icon:g.markRaw(g.h(ht,{name:"tool-underline"}))};if(typeof n.textSelection=="object"){const{highlight:ie,strikethrough:le,underline:pe}=n.textSelection;ie===!1?P=!1:typeof ie=="object"&&(P={...P,...ie},ie.icon&&typeof ie.icon=="object"&&(P.icon=g.markRaw(ie.icon))),le===!1?B=!1:typeof le=="object"&&(B={...B,...le},le.icon&&typeof le.icon=="object"&&(B.icon=g.markRaw(le.icon))),pe===!1?U=!1:typeof pe=="object"&&(U={...U,...pe},pe.icon&&typeof pe.icon=="object"&&(U.icon=g.markRaw(pe.icon)))}P&&typeof P=="object"&&(P.colors?P.colors=x(P.colors):P.colors=E),U&&typeof U=="object"&&(U.colors?U.colors=x(U.colors):U.colors=v),B&&typeof B=="object"&&(B.colors?B.colors=x(B.colors):B.colors=S),s.textSelection.detail.highlight=P,s.textSelection.detail.strikethrough=B,s.textSelection.detail.underline=U,window.dispatchEvent(s.textSelection)},C=O=>{r("freeText",O),s.freeText.detail.active=O;let P=Object.entries(au).map(([B,U])=>({value:B,label:U}));typeof n.freeText=="object"&&n.freeText?.fontColors&&(P=x(n.freeText.fontColors)),s.freeText.detail.fontColors=P,typeof n.freeText=="object"&&n.freeText?.fontSizes?.length&&(s.freeText.detail.fontSizes=n.freeText.fontSizes),window.dispatchEvent(s.freeText)},k=O=>{r("signature",O),s.signature.detail.active=O,window.dispatchEvent(s.signature)},F=(O,P="1MB",B=[Ne.APNG,Ne.AVIF,Ne.BMP,Ne.GIF,Ne.ICON,Ne.JPEG,Ne.PNG,Ne.SVG,Ne.WEBP])=>{if(!O)return{isValid:!0};if(typeof P<"u"){let U;if(typeof P=="number"?U=P:U=ku(P),O.size>U)return{isValid:!1,error:vr.FileSizeExceeded,maxSize:vu(U)}}return B&&B.length>0&&!B.includes(O.type)?{isValid:!1,error:vr.UnsupportedFileType}:{isValid:!0}},I=O=>{const P=n.image,B=F(O,P?.maxSize,P?.types);if(!B.isValid){s.error.detail.error=B?.error,s.error.detail.maxSize=B?.maxSize,window.dispatchEvent(s.error);return}l.textSelection=!1,l.freeText=!1,l.signature=!1,r("image",O),s.image.detail.file=O,window.dispatchEvent(s.image)};function T(){z(a.value),C(h.value),k(f.value)}const R=Kt(n.instanceId,Tn.Rotate);g.onMounted(()=>{window.dispatchEvent(new CustomEvent(Kt(n.instanceId,Tn.AnnotationMounted))),window.addEventListener(R,J)});function J(O){const{firstPageRotation:P,rotation:B}=O.detail;i.value=B!==0}g.watch(i,O=>{O&&(l.textSelection=!1,l.freeText=!1,l.signature=!1,T())});const N=O=>{const{id:P,...B}=O;return{...B,id:P?.startsWith(cu)?null:P}};return g.watch(()=>n.onAnnotationCreated,(O,P,B)=>{if(!O)return;const U=le=>{O(N(le.detail))},ie=Kt(n.instanceId,Tn.AnnotationCreated);window.addEventListener(ie,U),B(()=>{window.removeEventListener(ie,U)})},{immediate:!0}),g.watch(()=>n.onAnnotationUpdated,(O,P,B)=>{if(!O)return;const U=le=>{O(N(le.detail))},ie=Kt(n.instanceId,Tn.AnnotationUpdated);window.addEventListener(ie,U),B(()=>{window.removeEventListener(ie,U)})},{immediate:!0}),g.watch(()=>n.onAnnotationDeleted,(O,P,B)=>{if(!O)return;const U=le=>{O(N(le.detail))},ie=Kt(n.instanceId,Tn.AnnotationDeleted);window.addEventListener(ie,U),B(()=>{window.removeEventListener(ie,U)})},{immediate:!0}),g.onUnmounted(()=>{window.removeEventListener(R,J)}),(O,P)=>(g.openBlock(),g.createElementBlock("div",Au,[g.createVNode(pu,{onToggle:_}),g.createVNode(g.Transition,{name:"slide"},{default:g.withCtx(()=>[c.value?(g.openBlock(),g.createElementBlock("div",Cu,[u.value?(g.openBlock(),g.createBlock(bu,{key:0,active:a.value,"onUpdate:active":P[0]||(P[0]=B=>a.value=B),"aria-disabled":i.value},g.createSlots({_:2},[typeof n.textSelection=="object"&&n.textSelection.icon?{name:"icon",fn:g.withCtx(()=>[typeof n.textSelection=="object"&&n.textSelection.icon?(g.openBlock(),g.createBlock(g.resolveDynamicComponent(n.textSelection.icon),{key:0})):g.createCommentVNode("",!0)]),key:"0"}:typeof n.textSelection=="object"&&n.textSelection.component?{name:"default",fn:g.withCtx(({onClick:B})=>[typeof n.textSelection=="object"&&n.textSelection.component?(g.openBlock(),g.createBlock(g.resolveDynamicComponent(n.textSelection.component),{key:0,onClick:B},null,8,["onClick"])):g.createCommentVNode("",!0)]),key:"1"}:void 0]),1032,["active","aria-disabled"])):g.createCommentVNode("",!0),d.value?(g.openBlock(),g.createBlock(wu,{key:1,active:h.value,"onUpdate:active":P[1]||(P[1]=B=>h.value=B),"aria-disabled":i.value},g.createSlots({_:2},[typeof n.freeText=="object"&&n.freeText.icon?{name:"icon",fn:g.withCtx(()=>[typeof n.freeText=="object"&&n.freeText.icon?(g.openBlock(),g.createBlock(g.resolveDynamicComponent(n.freeText.icon),{key:0})):g.createCommentVNode("",!0),typeof n.freeText=="object"&&n.freeText.icon?(g.openBlock(),g.createBlock(g.resolveDynamicComponent(n.freeText.icon),{key:1})):g.createCommentVNode("",!0)]),key:"0"}:typeof n.freeText=="object"&&n.freeText.component?{name:"default",fn:g.withCtx(({onClick:B})=>[typeof n.freeText=="object"&&n.freeText.component?(g.openBlock(),g.createBlock(g.resolveDynamicComponent(n.freeText.component),{key:0,onClick:B},null,8,["onClick"])):g.createCommentVNode("",!0)]),key:"1"}:void 0]),1032,["active","aria-disabled"])):g.createCommentVNode("",!0),w.value?(g.openBlock(),g.createBlock(xu,{key:2,onChange:I,"aria-disabled":i.value},g.createSlots({_:2},[typeof n.image=="object"&&n.image?{name:"icon",fn:g.withCtx(()=>[typeof n.image=="object"&&n.image.icon?(g.openBlock(),g.createBlock(g.resolveDynamicComponent(n.image.icon),{key:0})):g.createCommentVNode("",!0)]),key:"0"}:typeof n.image=="object"&&n.image&&"component"in n.image?{name:"default",fn:g.withCtx(({onClick:B})=>[typeof n.image=="object"&&n.image&&"component"in n.image?(g.openBlock(),g.createBlock(g.resolveDynamicComponent(n.image.component),{key:0,onClick:B},null,8,["onClick"])):g.createCommentVNode("",!0)]),key:"1"}:void 0]),1032,["aria-disabled"])):g.createCommentVNode("",!0),y.value?(g.openBlock(),g.createBlock(_u,{key:3,active:f.value,"onUpdate:active":P[2]||(P[2]=B=>f.value=B),"aria-disabled":i.value},g.createSlots({_:2},[typeof n.signature=="object"&&n.signature.icon?{name:"icon",fn:g.withCtx(()=>[typeof n.signature=="object"&&n.signature.icon?(g.openBlock(),g.createBlock(g.resolveDynamicComponent(n.signature.icon),{key:0})):g.createCommentVNode("",!0)]),key:"0"}:typeof n.signature=="object"&&n.signature.component?{name:"default",fn:g.withCtx(({onClick:B})=>[typeof n.signature=="object"&&n.signature.component?(g.openBlock(),g.createBlock(g.resolveDynamicComponent(n.signature.component),{key:0,onClick:B},null,8,["onClick"])):g.createCommentVNode("",!0)]),key:"1"}:void 0]),1032,["active","aria-disabled"])):g.createCommentVNode("",!0)])):g.createCommentVNode("",!0)]),_:1})]))}}),r0="",gc=uo(Bu,[["__scopeId","data-v-9e031a97"]]),Du=(e={})=>{const{textSelection:t,freeText:n,image:r,...i}=e;let o=null;return{name:"annotation",setup(s){const{componentInstance:c,shared:l}=s,a=c?.uid??0;s.toolbar.addItem({id:ru.ANNOTATIONS,toolbarDirection:"left",component:g.h(gc,{textSelection:t,freeText:n,image:r,instanceId:a,...i})});const h=c?.appContext.app;l.ui?h.provide(Dn,l.ui):console.warn("VPdfAnnotationPlugin - No UI context found in plugin context"),l.localization?.value?h.provide(fc,l.localization):console.warn("VPdfAnnotationPlugin - No localization found in plugin context"),l.pdf||console.warn("VPdfAnnotationPlugin - PDF context not available"),o={exportToPdf:async(f,u)=>{const d=await l.pdf?.getOriginalBytes();if(!d)return console.error("[exportToPdf] originalBytes is null - cannot serialize text markup annotations. Check if PDF source type is supported."),null;try{const y=await lu.serializeAnnotationsToPdf(d,f,u);return console.debug("[exportToPdf] Serialization successful, result size:",y.byteLength),y}catch(y){throw console.error("[exportToPdf] Serialization failed:",y),y}}}},getApi:()=>o}},Tu={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"none",viewBox:"0 0 20 20"};function pc(e,t){return g.openBlock(),g.createElementBlock("svg",Tu,[...t[0]||(t[0]=[g.createElementVNode("path",{stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"1.25",d:"M10 18.334a8.333 8.333 0 1 0 0-16.667 8.333 8.333 0 0 0 0 16.667"},null,-1),g.createElementVNode("path",{stroke:"currentColor","stroke-linejoin":"round","stroke-width":"1.25",d:"m5.417 17.084 1.171-4.394c.238-.892.357-1.338.694-1.597s.798-.259 1.722-.259h1.992c.923 0 1.385 0 1.722.259.337.258.456.705.693 1.597l1.172 4.394"},null,-1),g.createElementVNode("path",{stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"1.25",d:"M7.917 10.834 9.23 7.8c.327-.756.491-1.134.769-1.134s.441.378.77 1.134l1.313 3.033"},null,-1)])])}const Eu=Object.freeze(Object.defineProperty({__proto__:null,render:pc,default:{render:pc}},Symbol.toStringTag,{value:"Module"})),Pu={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"none",viewBox:"0 0 20 20"};function bc(e,t){return g.openBlock(),g.createElementBlock("svg",Pu,[...t[0]||(t[0]=[g.createElementVNode("path",{fill:"currentColor",d:"M18.125 9.688a7.82 7.82 0 0 1-7.812 7.812H3.75a1.25 1.25 0 0 1-1.25-1.25V9.688a7.812 7.812 0 0 1 15.625 0m-1.25 0a6.563 6.563 0 0 0-13.125 0v6.562h6.563a6.57 6.57 0 0 0 6.562-6.562"},null,-1),g.createElementVNode("path",{fill:"currentColor",d:"M12.5 10a.624.624 0 0 1-.625.625h-1.25v1.25a.624.624 0 1 1-1.25 0v-1.25h-1.25a.625.625 0 1 1 0-1.25h1.25v-1.25a.625.625 0 0 1 1.25 0v1.25h1.25A.625.625 0 0 1 12.5 10"},null,-1)])])}const Ru=Object.freeze(Object.defineProperty({__proto__:null,render:bc,default:{render:bc}},Symbol.toStringTag,{value:"Module"})),Iu={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"none",viewBox:"0 0 20 20"};function mc(e,t){return g.openBlock(),g.createElementBlock("svg",Iu,[...t[0]||(t[0]=[g.createElementVNode("path",{fill:"currentColor",d:"M11.458 13.75a.624.624 0 1 0 0-1.25h-.625v-5h2.5v.625a.625.625 0 0 0 1.25 0v-1.25a.625.625 0 0 0-.625-.625h-7.5a.625.625 0 0 0-.625.625v1.25a.625.625 0 0 0 1.25 0V7.5h2.5v5h-.625a.625.625 0 1 0 0 1.25z"},null,-1),g.createElementVNode("path",{fill:"currentColor","fill-rule":"evenodd",d:"M3.125 3.75c0-.115.093-.208.208-.208h13.334c.115 0 .208.093.208.208v2.917a.625.625 0 1 0 1.25 0V3.75c0-.805-.653-1.458-1.458-1.458H3.333c-.805 0-1.458.653-1.458 1.458v3.334a.625.625 0 1 0 1.25 0zm0 12.5c0 .115.093.209.208.209h13.334a.21.21 0 0 0 .208-.209v-2.916a.625.625 0 1 1 1.25 0v2.916c0 .806-.653 1.459-1.458 1.459H3.333a1.46 1.46 0 0 1-1.458-1.459v-3.333a.625.625 0 1 1 1.25 0zM2.5 8.542c.345 0 .625.28.625.625v1.667a.625.625 0 0 1-1.25 0V9.167c0-.345.28-.625.625-.625m15.625.625a.625.625 0 1 0-1.25 0v1.667a.625.625 0 0 0 1.25 0z","clip-rule":"evenodd"},null,-1)])])}const Ou=Object.freeze(Object.defineProperty({__proto__:null,render:mc,default:{render:mc}},Symbol.toStringTag,{value:"Module"})),zu={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"none",viewBox:"0 0 20 20"};function yc(e,t){return g.openBlock(),g.createElementBlock("svg",zu,[...t[0]||(t[0]=[g.createElementVNode("g",{"clip-path":"url(#a)"},[g.createElementVNode("path",{fill:"currentColor",d:"M19.818 8.308a.625.625 0 0 0-.885 0L15 12.242 8.384 5.625l3.934-3.932a.626.626 0 0 0-.885-.885L7.5 4.742a1.25 1.25 0 0 0-.22 1.47L5.625 7.866a1.25 1.25 0 0 0 0 1.767l.367.366-4.559 4.558a.625.625 0 0 0 .245 1.035l5.625 1.875a.62.62 0 0 0 .437-.015.6.6 0 0 0 .203-.136l2.682-2.683.367.366a1.25 1.25 0 0 0 1.767 0l1.656-1.654a1.25 1.25 0 0 0 1.469-.22l3.934-3.933a.626.626 0 0 0 0-.885M7.332 16.16l-4.297-1.433 3.84-3.843 2.867 2.866zm4.543-2.043L6.51 8.75l1.616-1.616 5.367 5.366z"})],-1),g.createElementVNode("defs",null,[g.createElementVNode("clipPath",{id:"a"},[g.createElementVNode("path",{fill:"currentColor",d:"M0 0h20v20H0z"})])],-1)])])}const Fu=Object.freeze(Object.defineProperty({__proto__:null,render:yc,default:{render:yc}},Symbol.toStringTag,{value:"Module"})),Nu={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"none",viewBox:"0 0 20 20"};function _c(e,t){return g.openBlock(),g.createElementBlock("svg",Nu,[...t[0]||(t[0]=[g.createElementVNode("path",{fill:"currentColor",d:"M16.875 3.125H3.125a1.25 1.25 0 0 0-1.25 1.25v11.25a1.25 1.25 0 0 0 1.25 1.25h13.75a1.25 1.25 0 0 0 1.25-1.25V4.375a1.25 1.25 0 0 0-1.25-1.25m0 1.25v8.027l-2.037-2.036a1.25 1.25 0 0 0-1.768 0l-1.562 1.563L8.07 8.49a1.25 1.25 0 0 0-1.767 0L3.125 11.67V4.376zm-13.75 9.063 4.063-4.063 6.25 6.25H3.124zm13.75 2.187h-1.67l-2.812-2.812 1.563-1.563 2.919 2.92zM11.25 7.813a.938.938 0 1 1 1.875 0 .938.938 0 0 1-1.875 0"},null,-1)])])}const Mu=Object.freeze(Object.defineProperty({__proto__:null,render:_c,default:{render:_c}},Symbol.toStringTag,{value:"Module"})),Lu={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"none",viewBox:"0 0 20 20"};function wc(e,t){return g.openBlock(),g.createElementBlock("svg",Lu,[...t[0]||(t[0]=[g.createElementVNode("path",{fill:"currentColor",d:"M18.125 13.125H4.99q.313-.615.625-1.259c1.172.13 2.546-.685 4.114-2.432.391 1.051 1.13 2.416 2.39 2.441.707.014 1.414-.406 2.142-1.279.53.634 1.623 1.279 3.865 1.279a.625.625 0 1 0 0-1.25c-2.377 0-3.08-.816-3.125-1.259a.6.6 0 0 0-.426-.605.636.636 0 0 0-.723.273c-.943 1.448-1.514 1.596-1.713 1.591-.645-.012-1.301-1.525-1.526-2.61a.625.625 0 0 0-1.1-.264c-1.579 1.98-2.637 2.646-3.295 2.818.663-1.474 1.158-2.768 1.475-3.858.533-1.831.572-3.112.118-3.914-.234-.42-.73-.922-1.723-.922-1.255 0-2.245 1.186-2.716 3.254-.28 1.227-.327 2.594-.127 3.75.2 1.155.615 1.996 1.218 2.495a72 72 0 0 1-.877 1.751h-1.71a.625.625 0 1 0 0 1.25h1.048c-.884 1.64-1.572 2.784-1.583 2.803a.625.625 0 1 0 1.071.644c.012-.02.88-1.468 1.93-3.447h13.784a.625.625 0 1 0 0-1.25M4.59 5.407c.311-1.365.914-2.282 1.498-2.282.416 0 .555.145.635.287.235.416.51 1.89-1.692 6.749-.645-.881-.865-2.895-.44-4.754"},null,-1)])])}const ju=Object.freeze(Object.defineProperty({__proto__:null,render:wc,default:{render:wc}},Symbol.toStringTag,{value:"Module"})),Uu={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"none",viewBox:"0 0 20 20"};function xc(e,t){return g.openBlock(),g.createElementBlock("svg",Uu,[...t[0]||(t[0]=[g.createElementVNode("path",{fill:"currentColor",d:"M17.5 10a.624.624 0 0 1-.625.625h-3.13c.718.556 1.255 1.344 1.255 2.5 0 1.042-.547 2.008-1.543 2.718-.931.666-2.16 1.032-3.457 1.032-1.298 0-2.526-.366-3.457-1.032C5.547 15.133 5 14.167 5 13.125a.625.625 0 1 1 1.25 0c0 1.355 1.719 2.5 3.75 2.5s3.75-1.145 3.75-2.5c0-1.16-.823-1.842-3.029-2.5H3.125a.625.625 0 1 1 0-1.25h13.75A.625.625 0 0 1 17.5 10M5.963 8.125a.625.625 0 0 0 .595-.82 1.4 1.4 0 0 1-.065-.43c0-1.425 1.508-2.5 3.507-2.5 1.472 0 2.669.58 3.203 1.55a.625.625 0 0 0 1.094-.6c-.756-1.378-2.362-2.2-4.297-2.2-2.712 0-4.757 1.612-4.757 3.75-.001.278.041.555.127.82a.625.625 0 0 0 .593.43"},null,-1)])])}const $u=Object.freeze(Object.defineProperty({__proto__:null,render:xc,default:{render:xc}},Symbol.toStringTag,{value:"Module"})),Hu={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"none",viewBox:"0 0 20 20"};function Sc(e,t){return g.openBlock(),g.createElementBlock("svg",Hu,[...t[0]||(t[0]=[g.createElementVNode("path",{fill:"currentColor",d:"M17.916 14.568c.345 0 .625.28.625.625V17.9c0 .345-.28.625-.625.625H2.083a.625.625 0 0 1-.625-.625v-2.708c0-.345.28-.625.625-.625zM2.708 17.276h14.583v-1.458H2.708zm8.333-15.428a.626.626 0 0 1 .88.887L8.39 6.242l3.525 3.524 3.584-3.558a.626.626 0 0 1 .88.887l-4.057 4.03a.63.63 0 0 1-.633.15v.001h.004l.002.002-.018-.004a1 1 0 0 0-.125-.02 2 2 0 0 0-.534.015c-.457.07-1.144.312-1.92 1.07a.625.625 0 0 1-.873 0l-.07-.069-1.173 1.09a.63.63 0 0 1-.426.166H3.75a.625.625 0 0 1-.444-1.065l2.487-2.5-.045-.044a.626.626 0 0 1 0-.894c.775-.757 1.018-1.425 1.09-1.862.035-.224.029-.4.016-.512a1 1 0 0 0-.02-.118l-.004-.012v.001l.002.002V6.52a.63.63 0 0 1 .15-.643zM5.254 12.276h1.058l.948-.88-.444-.435-.13-.127zm6.444-.998h-.003zM8.014 7.634c-.131.537-.412 1.162-.958 1.814l1.627 1.591c.648-.523 1.267-.8 1.802-.934z"},null,-1)])])}const Gu=Object.freeze(Object.defineProperty({__proto__:null,render:Sc,default:{render:Sc}},Symbol.toStringTag,{value:"Module"})),Vu={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"none",viewBox:"0 0 20 20"};function vc(e,t){return g.openBlock(),g.createElementBlock("svg",Vu,[...t[0]||(t[0]=[g.createElementVNode("path",{fill:"currentColor",d:"M15.625 17.5a.624.624 0 0 1-.625.625H5a.625.625 0 1 1 0-1.25h10a.624.624 0 0 1 .625.625M10 15.625a5.005 5.005 0 0 0 5-5v-6.25a.625.625 0 1 0-1.25 0v6.25a3.75 3.75 0 0 1-7.5 0v-6.25a.625.625 0 0 0-1.25 0v6.25a5.005 5.005 0 0 0 5 5"},null,-1)])])}const Wu=Object.freeze(Object.defineProperty({__proto__:null,render:vc,default:{render:vc}},Symbol.toStringTag,{value:"Module"}));de.VPdfAnnotationTools=gc,de.default=Du,Object.defineProperties(de,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});