@vue-pdf-viewer/annotation 1.3.0-alpha.1 → 1.3.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1276 -1246
- package/dist/index.umd.cjs +10 -10
- package/dist/utils/pdfSerializer.d.ts +1 -1
- package/package.json +3 -3
package/dist/index.umd.cjs
CHANGED
|
@@ -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;top:0;left:0;width:100%;height:100%;pointer-events:none}.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-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 .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{cursor:pointer;position:absolute;inset:0;pointer-events:auto;z-index:calc(var(--vpv-base-z-index) * 5)}.vpv-annotation-editor-layer:not(.highlight-mode,.underline-mode,.strikeout-mode) .vpv-annotation-editor.vpv-annotation-editor__highlight{pointer-events:none}.vpv-annotation-editor-layer:not(.highlight-mode,.underline-mode,.strikeout-mode) .vpv-annotation-editor.vpv-annotation-editor__highlight .vpv-annotation-editor__clip-path{pointer-events:none}.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{pointer-events:none}.vpv-annotation-highlight__color-picker-wrapper{padding-left:4px;padding-right:4px;padding-bottom:4px;text-align:left}.vpv-annotation-highlight__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}.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-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:none}.vpv-canvas-layer>.vpv-highlight-outline:is(svg).hovered,.vpv-canvas-layer>.vpv-highlight-outline:is(svg).selected,.vpv-canvas-layer>.vpv-underline-outline:is(svg).hovered,.vpv-canvas-layer>.vpv-underline-outline:is(svg).selected,.vpv-canvas-layer>.vpv-strikeout-outline:is(svg).hovered,.vpv-canvas-layer>.vpv-strikeout-outline:is(svg).selected{stroke-width:var(--vpv-annotation-highlight__outline-width)}.vpv-canvas-layer>.vpv-highlight-outline:is(svg).hovered,.vpv-canvas-layer>.vpv-underline-outline:is(svg).hovered,.vpv-canvas-layer>.vpv-strikeout-outline:is(svg).hovered{stroke:var(--vpv-annotation-highlight__outline-hover-color)}.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-highlight__outline-selected-color)}.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,.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-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-8583d7e5]{padding-top:.5rem;padding-bottom:.5rem;border-top:1px solid #c6ccd2;max-width:min-content;margin:.5rem auto}.vpv-annotation-tools-container[data-v-8583d7e5] .vpv-toolbar-btn{margin-bottom:.25rem}.slide-enter-active[data-v-8583d7e5],.slide-leave-active[data-v-8583d7e5]{transition:all .3s ease-out}.slide-enter-from[data-v-8583d7e5],.slide-leave-to[data-v-8583d7e5]{opacity:0}.slide-enter-from[data-v-8583d7e5],.slide-leave-to[data-v-8583d7e5]{transform:translateY(-20px)}')),document.head.appendChild(e)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}})();
|
|
2
|
-
(function(be,u){typeof exports=="object"&&typeof module<"u"?u(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],u):(be=typeof globalThis<"u"?globalThis:be||self,u(be["@vue-pdf-viewer/annotation"]={},be.Vue))})(this,function(be,u){"use strict";var wc=Object.defineProperty,xc=(e,t,n)=>t in e?wc(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,p=(e,t,n)=>(xc(e,typeof t!="symbol"?t+"":t,n),n);const wt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Vt=new Uint8Array(256);for(let e=0;e<wt.length;e++)Vt[wt.charCodeAt(e)]=e;const Sc=e=>{let t="";const n=e.length;for(let r=0;r<n;r+=3)t+=wt[e[r]>>2],t+=wt[(e[r]&3)<<4|e[r+1]>>4],t+=wt[(e[r+1]&15)<<2|e[r+2]>>6],t+=wt[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},ds=e=>{let t=e.length*.75;const n=e.length;let r,i=0,s,o,c,l;e[e.length-1]==="="&&(t--,e[e.length-2]==="="&&t--);const a=new Uint8Array(t);for(r=0;r<n;r+=4)s=Vt[e.charCodeAt(r)],o=Vt[e.charCodeAt(r+1)],c=Vt[e.charCodeAt(r+2)],l=Vt[e.charCodeAt(r+3)],a[i++]=s<<2|o>>4,a[i++]=(o&15)<<4|c>>2,a[i++]=(c&3)<<6|l&63;return a},vc=/^(data)?:?([\w\/\+]+)?;?(charset=[\w-]+|base64)?.*,/i,kc=e=>{const t=e.trim(),r=t.substring(0,100).match(vc);if(!r)return ds(t);const[i]=r,s=t.substring(i.length);return ds(s)},$=e=>e.charCodeAt(0),fs=(e,t)=>De(e.toString(16),t,"0").toUpperCase(),us=e=>fs(e,2),We=e=>String.fromCharCode(e),Ac=e=>We(parseInt(e,16)),De=(e,t,n)=>{let r="";for(let i=0,s=t-e.length;i<s;i++)r+=n;return r+e},de=(e,t,n)=>{const r=e.length;for(let i=0;i<r;i++)t[n++]=e.charCodeAt(i);return r},Cc=/^D:(\d\d\d\d)(\d\d)?(\d\d)?(\d\d)?(\d\d)?(\d\d)?([+\-Z])?(\d\d)?'?(\d\d)?'?$/,gs=e=>{const t=e.match(Cc);if(!t)return;const[,n,r="01",i="01",s="00",o="00",c="00",l="Z",a="00",h="00"]=t,g=l==="Z"?"Z":`${l}${a}:${h}`;return new Date(`${n}-${r}-${i}T${s}:${o}:${c}${g}`)},Bc=(e,t)=>{var n;let r=0,i;for(;r<e.length;){const s=e.substring(r).match(t);if(!s)return{match:i,pos:r};i=s,r+=((n=s.index)!=null?n:0)+s[0].length}return{match:i,pos:r}},Dn=e=>e[e.length-1],kr=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},Ec=(...e)=>{const t=e.length,n=[];for(let o=0;o<t;o++){const c=e[o];n[o]=c instanceof Uint8Array?c:kr(c)}let r=0;for(let o=0;o<t;o++)r+=e[o].length;const i=new Uint8Array(r);let s=0;for(let o=0;o<t;o++){const c=n[o];for(let l=0,a=c.length;l<a;l++)i[s++]=c[l]}return i},ps=e=>{let t="";for(let n=0,r=e.length;n<r;n++)t+=We(e[n]);return t},xt=e=>{const t=e.length;for(let n=0,r=Math.floor(t/2);n<r;n++){const i=n,s=t-n-1,o=e[n];e[i]=e[s],e[s]=o}return e},Tc=e=>{let t=0;for(let n=0,r=e.length;n<r;n++)t+=e[n];return t},Pc=(e,t)=>{const n=new Array(t-e);for(let r=0,i=n.length;r<i;r++)n[r]=e+r;return n},Dc=e=>{if(typeof e=="string")return kc(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`")},St=()=>new Promise(e=>{setTimeout(()=>e(),0)}),bs=class{constructor(e){p(this,"populate"),p(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 vt=bs;p(vt,"populatedBy",e=>new bs(e));const Rn=e=>{throw new Error(e)},Rc=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},In=e=>Math.ceil(e.toString(2).length/8),kt=e=>{const t=new Uint8Array(In(e));for(let n=1;n<=t.length;n++)t[n-1]=e>>(t.length-n)*8;return t},H=new Uint16Array(256);for(let e=0;e<256;e++)H[e]=e;H[22]=$(""),H[24]=$("\u02D8"),H[25]=$("\u02C7"),H[26]=$("\u02C6"),H[27]=$("\u02D9"),H[28]=$("\u02DD"),H[29]=$("\u02DB"),H[30]=$("\u02DA"),H[31]=$("\u02DC"),H[127]=$("\uFFFD"),H[128]=$("\u2022"),H[129]=$("\u2020"),H[130]=$("\u2021"),H[131]=$("\u2026"),H[132]=$("\u2014"),H[133]=$("\u2013"),H[134]=$("\u0192"),H[135]=$("\u2044"),H[136]=$("\u2039"),H[137]=$("\u203A"),H[138]=$("\u2212"),H[139]=$("\u2030"),H[140]=$("\u201E"),H[141]=$("\u201C"),H[142]=$("\u201D"),H[143]=$("\u2018"),H[144]=$("\u2019"),H[145]=$("\u201A"),H[146]=$("\u2122"),H[147]=$("\uFB01"),H[148]=$("\uFB02"),H[149]=$("\u0141"),H[150]=$("\u0152"),H[151]=$("\u0160"),H[152]=$("\u0178"),H[153]=$("\u017D"),H[154]=$("\u0131"),H[155]=$("\u0142"),H[156]=$("\u0153"),H[157]=$("\u0161"),H[158]=$("\u017E"),H[159]=$("\uFFFD"),H[160]=$("\u20AC"),H[173]=$("\uFFFD");const ms=e=>{const t=new Array(e.length);for(let n=0,r=e.length;n<r;n++)t[n]=H[e[n]];return String.fromCodePoint(...t)},_s=e=>Object.keys(e).map(t=>e[t]),On=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height,Ic=(e,t=!0)=>{const n=[];t&&n.push(65279);for(let r=0,i=e.length;r<i;){const s=e.codePointAt(r);if(s<65536)n.push(s),r+=1;else if(s<1114112)n.push(Oc(s),zc(s)),r+=2;else throw new Error(`Invalid code point: 0x${us(s)}`)}return new Uint16Array(n)},Oc=e=>Math.floor((e-65536)/1024)+55296,zc=e=>(e-65536)%1024+56320,Kt="\uFFFD".codePointAt(0),ys=(e,t=!0)=>{if(e.length<=1)return String.fromCodePoint(Kt);const n=t?Nc(e):"BigEndian";let r=t?2:0;const i=[];for(;e.length-r>=2;){const s=xs(e[r++],e[r++],n);if(Fc(s))if(e.length-r<2)i.push(Kt);else{const o=xs(e[r++],e[r++],n);ws(o)?i.push(s,o):i.push(Kt)}else ws(s)?(r+=2,i.push(Kt)):i.push(s)}return r<e.length&&i.push(Kt),String.fromCodePoint(...i)},Fc=e=>e>=55296&&e<=56319,ws=e=>e>=56320&&e<=57343,xs=(e,t,n)=>{if(n==="LittleEndian")return t<<8|e;if(n==="BigEndian")return e<<8|t;throw new Error(`Invalid byteOrder: ${n}`)},Nc=e=>Ss(e)?"BigEndian":vs(e)?"LittleEndian":"BigEndian",Ss=e=>e[0]===254&&e[1]===255,vs=e=>e[0]===255&&e[1]===254,ks=e=>Ss(e)||vs(e),le=e=>`\`${e}\``,Lc=e=>`'${e}'`,As=e=>{const t=typeof e;return t==="string"?Lc(e):t==="undefined"?le(e):e},jc=(e,t,n)=>{const r=new Array(n.length);for(let s=0,o=n.length;s<o;s++){const c=n[s];r[s]=As(c)}const i=r.join(" or ");return`${le(t)} must be one of ${i}, but was actually ${As(e)}`},Zt=(e,t,n)=>{Array.isArray(n)||(n=_s(n));for(let r=0,i=n.length;r<i;r++)if(e===n[r])return;throw new TypeError(jc(e,t,n))},Ie=(e,t,n)=>{Array.isArray(n)||(n=_s(n)),Zt(e,t,n.concat(void 0))},Mc=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),Uc=(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],$c=(e,t,n)=>{const r=new Array(n.length);for(let s=0,o=n.length;s<o;s++){const c=n[s];c==="null"&&(r[s]=le("null")),c==="undefined"&&(r[s]=le("undefined")),c==="string"?r[s]=le("string"):c==="number"?r[s]=le("number"):c==="boolean"?r[s]=le("boolean"):c==="symbol"?r[s]=le("symbol"):c==="bigint"?r[s]=le("bigint"):c===Array?r[s]=le("Array"):c===Uint8Array?r[s]=le("Uint8Array"):c===ArrayBuffer?r[s]=le("ArrayBuffer"):r[s]=le(c[1])}const i=r.join(" or ");return`${le(t)} must be of type ${i}, but was actually of type ${le(Mc(e))}`},E=(e,t,n)=>{for(let r=0,i=n.length;r<i;r++)if(Uc(e,n[r]))return;throw new TypeError($c(e,t,n))},M=(e,t,n)=>{E(e,t,n.concat("undefined"))},Cs=(e,t,n)=>{for(let r=0,i=e.length;r<i;r++)E(e[r],t,n)},Je=(e,t,n,r)=>{if(E(e,t,["number"]),E(n,"min",["number"]),E(r,"max",["number"]),r=Math.max(n,r),e<n||e>r)throw new Error(`${le(t)} must be at least ${n} and at most ${r}, but was actually ${e}`)},Ge=(e,t,n,r)=>{E(e,t,["number","undefined"]),typeof e=="number"&&Je(e,t,n,r)},Hc=(e,t,n)=>{if(E(e,t,["number"]),e%n!==0)throw new Error(`${le(t)} must be a multiple of ${n}, but was actually ${e}`)},Wc=(e,t)=>{if(!Number.isInteger(e))throw new Error(`${le(t)} must be an integer, but was actually ${e}`)};class Oe extends Error{constructor(t,n){const r=`Method ${t}.${n}() not implemented`;super(r)}}class Ar extends Error{constructor(t){const n=`Cannot construct ${t} - it has a private constructor`;super(n)}}class Cr extends Error{constructor(t,n){const r=o=>{var c,l;return(l=o?.name)!=null?l:(c=o?.constructor)==null?void 0:c.name},s=`Expected instance of ${(Array.isArray(t)?t.map(r):[r(t)]).join(" or ")}, but got instance of ${n&&r(n)}`;super(s)}}class Gc extends Error{constructor(t){const n=`${t} stream encoding not supported`;super(n)}}class Br extends Error{constructor(t,n){const r=`Cannot call ${t}.${n}() more than once`;super(r)}}class Vc extends Error{constructor(){const t="Can't embed page with missing Contents";super(t)}}class Kc extends Error{constructor(t){var n,r,i;const o=`Unrecognized stream type: ${(i=(r=(n=t?.contructor)==null?void 0:n.name)!=null?r:t?.name)!=null?i:t}`;super(o)}}class Zc extends Error{constructor(t){const n=`Attempted to convert PDFArray with ${t} elements to rectangle, but must have exactly 4 elements.`;super(n)}}class Bs 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 Es extends Error{constructor(t,n){const r=`Invalid targetIndex specified: targetIndex=${t} must be less than Count=${n}`;super(r)}}class Ts 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 zn 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 Er 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 Xc extends Error{constructor(t){const n=`No /DA (default appearance) entry found for field: ${t}`;super(n)}}class Yc extends Error{constructor(t){const n=`No Tf operator found for DA of field: ${t}`;super(n)}}class Ps extends Error{constructor(t,n){const r=`Failed to parse number (line:${t.line} col:${t.column} offset=${t.offset}): "${n}"`;super(r)}}class Qe 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 Jc extends Qe{constructor(t,n,r){const i=`Expected next byte to be ${n} but it was actually ${r}`;super(t,i)}}class Qc extends Qe{constructor(t,n){const r=`Failed to parse PDF object starting with the following byte: ${n}`;super(t,r)}}class el extends Qe{constructor(t){const n="Failed to parse invalid PDF object";super(t,n)}}class tl extends Qe{constructor(t){const n="Failed to parse PDF stream";super(t,n)}}class nl extends Qe{constructor(t){const n="Failed to parse PDF literal string due to unbalanced parenthesis";super(t,n)}}class rl extends Qe{constructor(t){const n="Parser stalled";super(t,n)}}class il extends Qe{constructor(t){const n="No PDF header found";super(t,n)}}class sl extends Qe{constructor(t,n){const r=`Did not find expected keyword '${ps(n)}'`;super(t,r)}}class ge{clone(t){throw new Oe(this.constructor.name,"clone")}toString(){throw new Oe(this.constructor.name,"toString")}sizeInBytes(){throw new Oe(this.constructor.name,"sizeInBytes")}copyBytesInto(t,n){throw new Oe(this.constructor.name,"copyBytesInto")}}const Tr=class extends ge{constructor(e){super(),p(this,"numberValue"),p(this,"stringValue"),this.numberValue=e,this.stringValue=Rc(e)}asNumber(){return this.numberValue}value(){return this.numberValue}clone(){return Tr.of(this.numberValue)}toString(){return this.stringValue}sizeInBytes(){return this.stringValue.length}copyBytesInto(e,t){return t+=de(this.stringValue,e,t),this.stringValue.length}};let U=Tr;p(U,"of",e=>new Tr(e));var b=(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))(b||{});const Pr=class extends ge{constructor(e){super(),p(this,"array"),p(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 Zc(this.size());const e=this.lookup(0,U).asNumber(),t=this.lookup(1,U).asNumber(),n=this.lookup(2,U).asNumber(),r=this.lookup(3,U).asNumber(),i=e,s=t,o=n-e,c=r-t;return{x:i,y:s,width:o,height:c}}asArray(){return this.array.slice()}clone(e){const t=Pr.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++]=b.LeftSquareBracket,e[t++]=b.Space;for(let r=0,i=this.size();r<i;r++)t+=this.get(r).copyBytesInto(e,t),e[t++]=b.Space;return e[t++]=b.RightSquareBracket,t-n}scalePDFNumbers(e,t){for(let n=0,r=this.size();n<r;n++){const i=this.lookup(n);if(i instanceof U){const s=n%2===0?e:t;this.set(n,U.of(i.asNumber()*s))}}}};let J=Pr;p(J,"withContext",e=>new Pr(e));const Ae=new Uint8Array(256);Ae[b.LeftParen]=1,Ae[b.RightParen]=1,Ae[b.LessThan]=1,Ae[b.GreaterThan]=1,Ae[b.LeftSquareBracket]=1,Ae[b.RightSquareBracket]=1,Ae[b.LeftCurly]=1,Ae[b.RightCurly]=1,Ae[b.ForwardSlash]=1,Ae[b.Percent]=1;const Ve=new Uint8Array(256);Ve[b.Null]=1,Ve[b.Tab]=1,Ve[b.Newline]=1,Ve[b.FormFeed]=1,Ve[b.CarriageReturn]=1,Ve[b.Space]=1;const Dr=new Uint8Array(256);for(let e=0,t=256;e<t;e++)Dr[e]=Ve[e]||Ae[e]?1:0;Dr[b.Hash]=1;const ol=e=>e.replace(/#([\dABCDEF]{2})/g,(t,n)=>Ac(n)),al=e=>e>=b.ExclamationPoint&&e<=b.Tilde&&!Dr[e],Ds={},Rs=new Map,te=class extends ge{constructor(e,t){if(e!==Ds)throw new Ar("PDFName");super(),p(this,"encodedName");let n="/";for(let r=0,i=t.length;r<i;r++){const s=t[r],o=$(s);n+=al(o)?s:`#${us(o)}`}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,s=this.encodedName.length;i<s;i++){const o=this.encodedName[i],c=$(o),l=this.encodedName[i+1];n?c>=b.Zero&&c<=b.Nine||c>=b.a&&c<=b.f||c>=b.A&&c<=b.F?(t+=o,(t.length===2||!(l>="0"&&l<="9"||l>="a"&&l<="f"||l>="A"&&l<="F"))&&(r(parseInt(t,16)),t="")):r(c):c===b.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+=de(this.encodedName,e,t),this.encodedName.length}};let m=te;p(m,"of",e=>{const t=ol(e);let n=Rs.get(t);return n||(n=new te(Ds,t),Rs.set(t,n)),n}),p(m,"Length",te.of("Length")),p(m,"FlateDecode",te.of("FlateDecode")),p(m,"Resources",te.of("Resources")),p(m,"Font",te.of("Font")),p(m,"XObject",te.of("XObject")),p(m,"ExtGState",te.of("ExtGState")),p(m,"Contents",te.of("Contents")),p(m,"Type",te.of("Type")),p(m,"Parent",te.of("Parent")),p(m,"MediaBox",te.of("MediaBox")),p(m,"Page",te.of("Page")),p(m,"Annots",te.of("Annots")),p(m,"TrimBox",te.of("TrimBox")),p(m,"ArtBox",te.of("ArtBox")),p(m,"BleedBox",te.of("BleedBox")),p(m,"CropBox",te.of("CropBox")),p(m,"Rotate",te.of("Rotate")),p(m,"Title",te.of("Title")),p(m,"Author",te.of("Author")),p(m,"Subject",te.of("Subject")),p(m,"Creator",te.of("Creator")),p(m,"Keywords",te.of("Keywords")),p(m,"Producer",te.of("Producer")),p(m,"CreationDate",te.of("CreationDate")),p(m,"ModDate",te.of("ModDate"));const Fn=class extends ge{constructor(e){super(),p(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 s=parseInt(e.substring(r,r+2),16);n[i]=s,r+=2,i+=1}return n}decodeText(){const e=this.asBytes();return ks(e)?ys(e):ms(e)}decodeDate(){const e=this.decodeText(),t=gs(e);if(!t)throw new Bs(e);return t}asString(){return this.value}clone(){return Fn.of(this.value)}toString(){return`<${this.value}>`}sizeInBytes(){return this.value.length+2}copyBytesInto(e,t){return e[t++]=b.LessThan,t+=de(this.value,e,t),e[t++]=b.GreaterThan,this.value.length+2}};let X=Fn;p(X,"of",e=>new Fn(e)),p(X,"fromText",e=>{const t=Ic(e);let n="";for(let r=0,i=t.length;r<i;r++)n+=fs(t[r],4);return new Fn(n)});/*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */const cl=4,Is=0,Os=1,ll=2;function At(e){let t=e.length;for(;--t>=0;)e[t]=0}const hl=0,zs=1,dl=2,fl=3,ul=258,Rr=29,qt=256,Xt=qt+1+Rr,Ct=30,Ir=19,Fs=2*Xt+1,lt=15,Or=16,gl=7,zr=256,Ns=16,Ls=17,js=18,Fr=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]),Nn=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]),pl=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),Ms=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),bl=512,Ke=new Array((Xt+2)*2);At(Ke);const Yt=new Array(Ct*2);At(Yt);const Jt=new Array(bl);At(Jt);const Qt=new Array(ul-fl+1);At(Qt);const Nr=new Array(Rr);At(Nr);const Ln=new Array(Ct);At(Ln);function Lr(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 Us,$s,Hs;function jr(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}const Ws=e=>e<256?Jt[e]:Jt[256+(e>>>7)],en=(e,t)=>{e.pending_buf[e.pending++]=t&255,e.pending_buf[e.pending++]=t>>>8&255},me=(e,t,n)=>{e.bi_valid>Or-n?(e.bi_buf|=t<<e.bi_valid&65535,en(e,e.bi_buf),e.bi_buf=t>>Or-e.bi_valid,e.bi_valid+=n-Or):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=n)},ze=(e,t,n)=>{me(e,n[t*2],n[t*2+1])},Gs=(e,t)=>{let n=0;do n|=e&1,e>>>=1,n<<=1;while(--t>0);return n>>>1},ml=e=>{e.bi_valid===16?(en(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)},_l=(e,t)=>{const n=t.dyn_tree,r=t.max_code,i=t.stat_desc.static_tree,s=t.stat_desc.has_stree,o=t.stat_desc.extra_bits,c=t.stat_desc.extra_base,l=t.stat_desc.max_length;let a,h,g,f,d,_,w=0;for(f=0;f<=lt;f++)e.bl_count[f]=0;for(n[e.heap[e.heap_max]*2+1]=0,a=e.heap_max+1;a<Fs;a++)h=e.heap[a],f=n[n[h*2+1]*2+1]+1,f>l&&(f=l,w++),n[h*2+1]=f,!(h>r)&&(e.bl_count[f]++,d=0,h>=c&&(d=o[h-c]),_=n[h*2],e.opt_len+=_*(f+d),s&&(e.static_len+=_*(i[h*2+1]+d)));if(w!==0){do{for(f=l-1;e.bl_count[f]===0;)f--;e.bl_count[f]--,e.bl_count[f+1]+=2,e.bl_count[l]--,w-=2}while(w>0);for(f=l;f!==0;f--)for(h=e.bl_count[f];h!==0;)g=e.heap[--a],!(g>r)&&(n[g*2+1]!==f&&(e.opt_len+=(f-n[g*2+1])*n[g*2],n[g*2+1]=f),h--)}},Vs=(e,t,n)=>{const r=new Array(lt+1);let i=0,s,o;for(s=1;s<=lt;s++)i=i+n[s-1]<<1,r[s]=i;for(o=0;o<=t;o++){let c=e[o*2+1];c!==0&&(e[o*2]=Gs(r[c]++,c))}},yl=()=>{let e,t,n,r,i;const s=new Array(lt+1);for(n=0,r=0;r<Rr-1;r++)for(Nr[r]=n,e=0;e<1<<Fr[r];e++)Qt[n++]=r;for(Qt[n-1]=r,i=0,r=0;r<16;r++)for(Ln[r]=i,e=0;e<1<<Nn[r];e++)Jt[i++]=r;for(i>>=7;r<Ct;r++)for(Ln[r]=i<<7,e=0;e<1<<Nn[r]-7;e++)Jt[256+i++]=r;for(t=0;t<=lt;t++)s[t]=0;for(e=0;e<=143;)Ke[e*2+1]=8,e++,s[8]++;for(;e<=255;)Ke[e*2+1]=9,e++,s[9]++;for(;e<=279;)Ke[e*2+1]=7,e++,s[7]++;for(;e<=287;)Ke[e*2+1]=8,e++,s[8]++;for(Vs(Ke,Xt+1,s),e=0;e<Ct;e++)Yt[e*2+1]=5,Yt[e*2]=Gs(e,5);Us=new Lr(Ke,Fr,qt+1,Xt,lt),$s=new Lr(Yt,Nn,0,Ct,lt),Hs=new Lr(new Array(0),pl,0,Ir,gl)},Ks=e=>{let t;for(t=0;t<Xt;t++)e.dyn_ltree[t*2]=0;for(t=0;t<Ct;t++)e.dyn_dtree[t*2]=0;for(t=0;t<Ir;t++)e.bl_tree[t*2]=0;e.dyn_ltree[zr*2]=1,e.opt_len=e.static_len=0,e.sym_next=e.matches=0},Zs=e=>{e.bi_valid>8?en(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0},qs=(e,t,n,r)=>{const i=t*2,s=n*2;return e[i]<e[s]||e[i]===e[s]&&r[t]<=r[n]},Mr=(e,t,n)=>{const r=e.heap[n];let i=n<<1;for(;i<=e.heap_len&&(i<e.heap_len&&qs(t,e.heap[i+1],e.heap[i],e.depth)&&i++,!qs(t,r,e.heap[i],e.depth));)e.heap[n]=e.heap[i],n=i,i<<=1;e.heap[n]=r},Xs=(e,t,n)=>{let r,i,s=0,o,c;if(e.sym_next!==0)do r=e.pending_buf[e.sym_buf+s++]&255,r+=(e.pending_buf[e.sym_buf+s++]&255)<<8,i=e.pending_buf[e.sym_buf+s++],r===0?ze(e,i,t):(o=Qt[i],ze(e,o+qt+1,t),c=Fr[o],c!==0&&(i-=Nr[o],me(e,i,c)),r--,o=Ws(r),ze(e,o,n),c=Nn[o],c!==0&&(r-=Ln[o],me(e,r,c)));while(s<e.sym_next);ze(e,zr,t)},Ur=(e,t)=>{const n=t.dyn_tree,r=t.stat_desc.static_tree,i=t.stat_desc.has_stree,s=t.stat_desc.elems;let o,c,l=-1,a;for(e.heap_len=0,e.heap_max=Fs,o=0;o<s;o++)n[o*2]!==0?(e.heap[++e.heap_len]=l=o,e.depth[o]=0):n[o*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,o=e.heap_len>>1;o>=1;o--)Mr(e,n,o);a=s;do o=e.heap[1],e.heap[1]=e.heap[e.heap_len--],Mr(e,n,1),c=e.heap[1],e.heap[--e.heap_max]=o,e.heap[--e.heap_max]=c,n[a*2]=n[o*2]+n[c*2],e.depth[a]=(e.depth[o]>=e.depth[c]?e.depth[o]:e.depth[c])+1,n[o*2+1]=n[c*2+1]=a,e.heap[1]=a++,Mr(e,n,1);while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],_l(e,t),Vs(n,l,e.bl_count)},Ys=(e,t,n)=>{let r,i=-1,s,o=t[0*2+1],c=0,l=7,a=4;for(o===0&&(l=138,a=3),t[(n+1)*2+1]=65535,r=0;r<=n;r++)s=o,o=t[(r+1)*2+1],!(++c<l&&s===o)&&(c<a?e.bl_tree[s*2]+=c:s!==0?(s!==i&&e.bl_tree[s*2]++,e.bl_tree[Ns*2]++):c<=10?e.bl_tree[Ls*2]++:e.bl_tree[js*2]++,c=0,i=s,o===0?(l=138,a=3):s===o?(l=6,a=3):(l=7,a=4))},Js=(e,t,n)=>{let r,i=-1,s,o=t[0*2+1],c=0,l=7,a=4;for(o===0&&(l=138,a=3),r=0;r<=n;r++)if(s=o,o=t[(r+1)*2+1],!(++c<l&&s===o)){if(c<a)do ze(e,s,e.bl_tree);while(--c!==0);else s!==0?(s!==i&&(ze(e,s,e.bl_tree),c--),ze(e,Ns,e.bl_tree),me(e,c-3,2)):c<=10?(ze(e,Ls,e.bl_tree),me(e,c-3,3)):(ze(e,js,e.bl_tree),me(e,c-11,7));c=0,i=s,o===0?(l=138,a=3):s===o?(l=6,a=3):(l=7,a=4)}},wl=e=>{let t;for(Ys(e,e.dyn_ltree,e.l_desc.max_code),Ys(e,e.dyn_dtree,e.d_desc.max_code),Ur(e,e.bl_desc),t=Ir-1;t>=3&&e.bl_tree[Ms[t]*2+1]===0;t--);return e.opt_len+=3*(t+1)+5+5+4,t},xl=(e,t,n,r)=>{let i;for(me(e,t-257,5),me(e,n-1,5),me(e,r-4,4),i=0;i<r;i++)me(e,e.bl_tree[Ms[i]*2+1],3);Js(e,e.dyn_ltree,t-1),Js(e,e.dyn_dtree,n-1)},Sl=e=>{let t=4093624447,n;for(n=0;n<=31;n++,t>>>=1)if(t&1&&e.dyn_ltree[n*2]!==0)return Is;if(e.dyn_ltree[9*2]!==0||e.dyn_ltree[10*2]!==0||e.dyn_ltree[13*2]!==0)return Os;for(n=32;n<qt;n++)if(e.dyn_ltree[n*2]!==0)return Os;return Is};let Qs=!1;const vl=e=>{Qs||(yl(),Qs=!0),e.l_desc=new jr(e.dyn_ltree,Us),e.d_desc=new jr(e.dyn_dtree,$s),e.bl_desc=new jr(e.bl_tree,Hs),e.bi_buf=0,e.bi_valid=0,Ks(e)},eo=(e,t,n,r)=>{me(e,(hl<<1)+(r?1:0),3),Zs(e),en(e,n),en(e,~n),n&&e.pending_buf.set(e.window.subarray(t,t+n),e.pending),e.pending+=n},kl=e=>{me(e,zs<<1,3),ze(e,zr,Ke),ml(e)},Al=(e,t,n,r)=>{let i,s,o=0;e.level>0?(e.strm.data_type===ll&&(e.strm.data_type=Sl(e)),Ur(e,e.l_desc),Ur(e,e.d_desc),o=wl(e),i=e.opt_len+3+7>>>3,s=e.static_len+3+7>>>3,s<=i&&(i=s)):i=s=n+5,n+4<=i&&t!==-1?eo(e,t,n,r):e.strategy===cl||s===i?(me(e,(zs<<1)+(r?1:0),3),Xs(e,Ke,Yt)):(me(e,(dl<<1)+(r?1:0),3),xl(e,e.l_desc.max_code+1,e.d_desc.max_code+1,o+1),Xs(e,e.dyn_ltree,e.dyn_dtree)),Ks(e),r&&Zs(e)},Cl=(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[(Qt[n]+qt+1)*2]++,e.dyn_dtree[Ws(t)*2]++),e.sym_next===e.sym_end);var Bl=vl,El=eo,Tl=Al,Pl=Cl,Dl=kl,Rl={_tr_init:Bl,_tr_stored_block:El,_tr_flush_block:Tl,_tr_tally:Pl,_tr_align:Dl},tn=(e,t,n,r)=>{let i=e&65535|0,s=e>>>16&65535|0,o=0;for(;n!==0;){o=n>2e3?2e3:n,n-=o;do i=i+t[r++]|0,s=s+i|0;while(--o);i%=65521,s%=65521}return i|s<<16|0};const Il=()=>{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},Ol=new Uint32Array(Il());var he=(e,t,n,r)=>{const i=Ol,s=r+n;e^=-1;for(let o=r;o<s;o++)e=e>>>8^i[(e^t[o])&255];return e^-1},ht={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"},dt={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:zl,_tr_stored_block:$r,_tr_flush_block:Fl,_tr_tally:et,_tr_align:Nl}=Rl,{Z_NO_FLUSH:tt,Z_PARTIAL_FLUSH:Ll,Z_FULL_FLUSH:jl,Z_FINISH:Ce,Z_BLOCK:to,Z_OK:fe,Z_STREAM_END:no,Z_STREAM_ERROR:Fe,Z_DATA_ERROR:Ml,Z_BUF_ERROR:Hr,Z_DEFAULT_COMPRESSION:Ul,Z_FILTERED:$l,Z_HUFFMAN_ONLY:jn,Z_RLE:Hl,Z_FIXED:Wl,Z_DEFAULT_STRATEGY:Gl,Z_UNKNOWN:Vl,Z_DEFLATED:Mn}=dt,Kl=9,Zl=15,ql=8,Xl=29,Wr=256+1+Xl,Yl=30,Jl=19,Ql=2*Wr+1,eh=15,q=3,nt=258,Ne=nt+q+1,th=32,Bt=42,Gr=57,Vr=69,Kr=73,Zr=91,qr=103,ft=113,nn=666,pe=1,Et=2,ut=3,Tt=4,nh=3,gt=(e,t)=>(e.msg=ht[t],t),ro=e=>e*2-(e>4?9:0),rt=e=>{let t=e.length;for(;--t>=0;)e[t]=0},rh=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 it=(e,t,n)=>(t<<e.hash_shift^n)&e.hash_mask;const xe=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))},Se=(e,t)=>{Fl(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,xe(e.strm)},Q=(e,t)=>{e.pending_buf[e.pending++]=t},rn=(e,t)=>{e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=t&255},Xr=(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=tn(e.adler,t,i,n):e.state.wrap===2&&(e.adler=he(e.adler,t,i,n)),e.next_in+=i,e.total_in+=i,i)},io=(e,t)=>{let n=e.max_chain_length,r=e.strstart,i,s,o=e.prev_length,c=e.nice_match;const l=e.strstart>e.w_size-Ne?e.strstart-(e.w_size-Ne):0,a=e.window,h=e.w_mask,g=e.prev,f=e.strstart+nt;let d=a[r+o-1],_=a[r+o];e.prev_length>=e.good_match&&(n>>=2),c>e.lookahead&&(c=e.lookahead);do if(i=t,!(a[i+o]!==_||a[i+o-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<f);if(s=nt-(f-r),r=f-nt,s>o){if(e.match_start=t,o=s,s>=c)break;d=a[r+o-1],_=a[r+o]}}while((t=g[t&h])>l&&--n!==0);return o<=e.lookahead?o: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-Ne)&&(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),rh(e),r+=t),e.strm.avail_in===0)break;if(n=Xr(e.strm,e.window,e.strstart+e.lookahead,r),e.lookahead+=n,e.lookahead+e.insert>=q)for(i=e.strstart-e.insert,e.ins_h=e.window[i],e.ins_h=it(e,e.ins_h,e.window[i+1]);e.insert&&(e.ins_h=it(e,e.ins_h,e.window[i+q-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<q)););}while(e.lookahead<Ne&&e.strm.avail_in!==0)},so=(e,t)=>{let n=e.pending_buf_size-5>e.w_size?e.w_size:e.pending_buf_size-5,r,i,s,o=0,c=e.strm.avail_in;do{if(r=65535,s=e.bi_valid+42>>3,e.strm.avail_out<s||(s=e.strm.avail_out-s,i=e.strstart-e.block_start,r>i+e.strm.avail_in&&(r=i+e.strm.avail_in),r>s&&(r=s),r<n&&(r===0&&t!==Ce||t===tt||r!==i+e.strm.avail_in)))break;o=t===Ce&&r===i+e.strm.avail_in?1:0,$r(e,0,0,o),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,xe(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&&(Xr(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(o===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),o?Tt:t!==tt&&t!==Ce&&e.strm.avail_in===0&&e.strstart===e.block_start?Et:(s=e.window_size-e.strstart,e.strm.avail_in>s&&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++,s+=e.w_size,e.insert>e.strstart&&(e.insert=e.strstart)),s>e.strm.avail_in&&(s=e.strm.avail_in),s&&(Xr(e.strm,e.window,e.strstart,s),e.strstart+=s,e.insert+=s>e.w_size-e.insert?e.w_size-e.insert:s),e.high_water<e.strstart&&(e.high_water=e.strstart),s=e.bi_valid+42>>3,s=e.pending_buf_size-s>65535?65535:e.pending_buf_size-s,n=s>e.w_size?e.w_size:s,i=e.strstart-e.block_start,(i>=n||(i||t===Ce)&&t!==tt&&e.strm.avail_in===0&&i<=s)&&(r=i>s?s:i,o=t===Ce&&e.strm.avail_in===0&&r===i?1:0,$r(e,e.block_start,r,o),e.block_start+=r,xe(e.strm)),o?ut:pe)},Yr=(e,t)=>{let n,r;for(;;){if(e.lookahead<Ne){if(Pt(e),e.lookahead<Ne&&t===tt)return pe;if(e.lookahead===0)break}if(n=0,e.lookahead>=q&&(e.ins_h=it(e,e.ins_h,e.window[e.strstart+q-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-Ne&&(e.match_length=io(e,n)),e.match_length>=q)if(r=et(e,e.strstart-e.match_start,e.match_length-q),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=q){e.match_length--;do e.strstart++,e.ins_h=it(e,e.ins_h,e.window[e.strstart+q-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=it(e,e.ins_h,e.window[e.strstart+1]);else r=et(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(r&&(Se(e,!1),e.strm.avail_out===0))return pe}return e.insert=e.strstart<q-1?e.strstart:q-1,t===Ce?(Se(e,!0),e.strm.avail_out===0?ut:Tt):e.sym_next&&(Se(e,!1),e.strm.avail_out===0)?pe:Et},Dt=(e,t)=>{let n,r,i;for(;;){if(e.lookahead<Ne){if(Pt(e),e.lookahead<Ne&&t===tt)return pe;if(e.lookahead===0)break}if(n=0,e.lookahead>=q&&(e.ins_h=it(e,e.ins_h,e.window[e.strstart+q-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=q-1,n!==0&&e.prev_length<e.max_lazy_match&&e.strstart-n<=e.w_size-Ne&&(e.match_length=io(e,n),e.match_length<=5&&(e.strategy===$l||e.match_length===q&&e.strstart-e.match_start>4096)&&(e.match_length=q-1)),e.prev_length>=q&&e.match_length<=e.prev_length){i=e.strstart+e.lookahead-q,r=et(e,e.strstart-1-e.prev_match,e.prev_length-q),e.lookahead-=e.prev_length-1,e.prev_length-=2;do++e.strstart<=i&&(e.ins_h=it(e,e.ins_h,e.window[e.strstart+q-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=q-1,e.strstart++,r&&(Se(e,!1),e.strm.avail_out===0))return pe}else if(e.match_available){if(r=et(e,0,e.window[e.strstart-1]),r&&Se(e,!1),e.strstart++,e.lookahead--,e.strm.avail_out===0)return pe}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(r=et(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<q-1?e.strstart:q-1,t===Ce?(Se(e,!0),e.strm.avail_out===0?ut:Tt):e.sym_next&&(Se(e,!1),e.strm.avail_out===0)?pe:Et},ih=(e,t)=>{let n,r,i,s;const o=e.window;for(;;){if(e.lookahead<=nt){if(Pt(e),e.lookahead<=nt&&t===tt)return pe;if(e.lookahead===0)break}if(e.match_length=0,e.lookahead>=q&&e.strstart>0&&(i=e.strstart-1,r=o[i],r===o[++i]&&r===o[++i]&&r===o[++i])){s=e.strstart+nt;do;while(r===o[++i]&&r===o[++i]&&r===o[++i]&&r===o[++i]&&r===o[++i]&&r===o[++i]&&r===o[++i]&&r===o[++i]&&i<s);e.match_length=nt-(s-i),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=q?(n=et(e,1,e.match_length-q),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(n=et(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),n&&(Se(e,!1),e.strm.avail_out===0))return pe}return e.insert=0,t===Ce?(Se(e,!0),e.strm.avail_out===0?ut:Tt):e.sym_next&&(Se(e,!1),e.strm.avail_out===0)?pe:Et},sh=(e,t)=>{let n;for(;;){if(e.lookahead===0&&(Pt(e),e.lookahead===0)){if(t===tt)return pe;break}if(e.match_length=0,n=et(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,n&&(Se(e,!1),e.strm.avail_out===0))return pe}return e.insert=0,t===Ce?(Se(e,!0),e.strm.avail_out===0?ut:Tt):e.sym_next&&(Se(e,!1),e.strm.avail_out===0)?pe:Et};function Le(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 Le(0,0,0,0,so),new Le(4,4,8,4,Yr),new Le(4,5,16,8,Yr),new Le(4,6,32,32,Yr),new Le(4,4,16,16,Dt),new Le(8,16,32,32,Dt),new Le(8,16,128,128,Dt),new Le(8,32,128,256,Dt),new Le(32,128,258,1024,Dt),new Le(32,258,258,4096,Dt)],oh=e=>{e.window_size=2*e.w_size,rt(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=q-1,e.match_available=0,e.ins_h=0};function ah(){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=Mn,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(Ql*2),this.dyn_dtree=new Uint16Array((2*Yl+1)*2),this.bl_tree=new Uint16Array((2*Jl+1)*2),rt(this.dyn_ltree),rt(this.dyn_dtree),rt(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(eh+1),this.heap=new Uint16Array(2*Wr+1),rt(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(2*Wr+1),rt(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 on=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.status!==Bt&&t.status!==Gr&&t.status!==Vr&&t.status!==Kr&&t.status!==Zr&&t.status!==qr&&t.status!==ft&&t.status!==nn?1:0},oo=e=>{if(on(e))return gt(e,Fe);e.total_in=e.total_out=0,e.data_type=Vl;const t=e.state;return t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap===2?Gr:t.wrap?Bt:ft,e.adler=t.wrap===2?0:1,t.last_flush=-2,zl(t),fe},ao=e=>{const t=oo(e);return t===fe&&oh(e.state),t},ch=(e,t)=>on(e)||e.state.wrap!==2?Fe:(e.state.gzhead=t,fe),co=(e,t,n,r,i,s)=>{if(!e)return Fe;let o=1;if(t===Ul&&(t=6),r<0?(o=0,r=-r):r>15&&(o=2,r-=16),i<1||i>Kl||n!==Mn||r<8||r>15||t<0||t>9||s<0||s>Wl||r===8&&o!==1)return gt(e,Fe);r===8&&(r=9);const c=new ah;return e.state=c,c.strm=e,c.status=Bt,c.wrap=o,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+q-1)/q),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=s,c.method=n,ao(e)},lh=(e,t)=>co(e,t,Mn,Zl,ql,Gl),hh=(e,t)=>{if(on(e)||t>to||t<0)return e?gt(e,Fe):Fe;const n=e.state;if(!e.output||e.avail_in!==0&&!e.input||n.status===nn&&t!==Ce)return gt(e,e.avail_out===0?Hr:Fe);const r=n.last_flush;if(n.last_flush=t,n.pending!==0){if(xe(e),e.avail_out===0)return n.last_flush=-1,fe}else if(e.avail_in===0&&ro(t)<=ro(r)&&t!==Ce)return gt(e,Hr);if(n.status===nn&&e.avail_in!==0)return gt(e,Hr);if(n.status===Bt&&n.wrap===0&&(n.status=ft),n.status===Bt){let i=Mn+(n.w_bits-8<<4)<<8,s=-1;if(n.strategy>=jn||n.level<2?s=0:n.level<6?s=1:n.level===6?s=2:s=3,i|=s<<6,n.strstart!==0&&(i|=th),i+=31-i%31,rn(n,i),n.strstart!==0&&(rn(n,e.adler>>>16),rn(n,e.adler&65535)),e.adler=1,n.status=ft,xe(e),n.pending!==0)return n.last_flush=-1,fe}if(n.status===Gr){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=he(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=Vr;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,nh),n.status=ft,xe(e),n.pending!==0)return n.last_flush=-1,fe}if(n.status===Vr){if(n.gzhead.extra){let i=n.pending,s=(n.gzhead.extra.length&65535)-n.gzindex;for(;n.pending+s>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=he(e.adler,n.pending_buf,n.pending-i,i)),n.gzindex+=c,xe(e),n.pending!==0)return n.last_flush=-1,fe;i=0,s-=c}let o=new Uint8Array(n.gzhead.extra);n.pending_buf.set(o.subarray(n.gzindex,n.gzindex+s),n.pending),n.pending+=s,n.gzhead.hcrc&&n.pending>i&&(e.adler=he(e.adler,n.pending_buf,n.pending-i,i)),n.gzindex=0}n.status=Kr}if(n.status===Kr){if(n.gzhead.name){let i=n.pending,s;do{if(n.pending===n.pending_buf_size){if(n.gzhead.hcrc&&n.pending>i&&(e.adler=he(e.adler,n.pending_buf,n.pending-i,i)),xe(e),n.pending!==0)return n.last_flush=-1,fe;i=0}n.gzindex<n.gzhead.name.length?s=n.gzhead.name.charCodeAt(n.gzindex++)&255:s=0,Q(n,s)}while(s!==0);n.gzhead.hcrc&&n.pending>i&&(e.adler=he(e.adler,n.pending_buf,n.pending-i,i)),n.gzindex=0}n.status=Zr}if(n.status===Zr){if(n.gzhead.comment){let i=n.pending,s;do{if(n.pending===n.pending_buf_size){if(n.gzhead.hcrc&&n.pending>i&&(e.adler=he(e.adler,n.pending_buf,n.pending-i,i)),xe(e),n.pending!==0)return n.last_flush=-1,fe;i=0}n.gzindex<n.gzhead.comment.length?s=n.gzhead.comment.charCodeAt(n.gzindex++)&255:s=0,Q(n,s)}while(s!==0);n.gzhead.hcrc&&n.pending>i&&(e.adler=he(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&&(xe(e),n.pending!==0))return n.last_flush=-1,fe;Q(n,e.adler&255),Q(n,e.adler>>8&255),e.adler=0}if(n.status=ft,xe(e),n.pending!==0)return n.last_flush=-1,fe}if(e.avail_in!==0||n.lookahead!==0||t!==tt&&n.status!==nn){let i=n.level===0?so(n,t):n.strategy===jn?sh(n,t):n.strategy===Hl?ih(n,t):sn[n.level].func(n,t);if((i===ut||i===Tt)&&(n.status=nn),i===pe||i===ut)return e.avail_out===0&&(n.last_flush=-1),fe;if(i===Et&&(t===Ll?Nl(n):t!==to&&($r(n,0,0,!1),t===jl&&(rt(n.head),n.lookahead===0&&(n.strstart=0,n.block_start=0,n.insert=0))),xe(e),e.avail_out===0))return n.last_flush=-1,fe}return t!==Ce?fe:n.wrap<=0?no:(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)):(rn(n,e.adler>>>16),rn(n,e.adler&65535)),xe(e),n.wrap>0&&(n.wrap=-n.wrap),n.pending!==0?fe:no)},dh=e=>{if(on(e))return Fe;const t=e.state.status;return e.state=null,t===ft?gt(e,Ml):fe},fh=(e,t)=>{let n=t.length;if(on(e))return Fe;const r=e.state,i=r.wrap;if(i===2||i===1&&r.status!==Bt||r.lookahead)return Fe;if(i===1&&(e.adler=tn(e.adler,t,n,0)),r.wrap=0,n>=r.w_size){i===0&&(rt(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 s=e.avail_in,o=e.next_in,c=e.input;for(e.avail_in=n,e.next_in=0,e.input=t,Pt(r);r.lookahead>=q;){let l=r.strstart,a=r.lookahead-(q-1);do r.ins_h=it(r,r.ins_h,r.window[l+q-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=q-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=q-1,r.match_available=0,e.next_in=o,e.input=c,e.avail_in=s,r.wrap=i,fe};var uh=lh,gh=co,ph=ao,bh=oo,mh=ch,_h=hh,yh=dh,wh=fh,xh="pako deflate (from Nodeca project)",an={deflateInit:uh,deflateInit2:gh,deflateReset:ph,deflateResetKeep:bh,deflateSetHeader:mh,deflate:_h,deflateEnd:yh,deflateSetDictionary:wh,deflateInfo:xh};const Sh=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var vh=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)Sh(n,r)&&(e[r]=n[r])}}return e},kh=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,s=e.length;r<s;r++){let o=e[r];n.set(o,i),i+=o.length}return n},Un={assign:vh,flattenChunks:kh};let lo=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{lo=!1}const cn=new Uint8Array(256);for(let e=0;e<256;e++)cn[e]=e>=252?6:e>=248?5:e>=240?4:e>=224?3:e>=192?2:1;cn[254]=cn[254]=1;var Ah=e=>{if(typeof TextEncoder=="function"&&TextEncoder.prototype.encode)return new TextEncoder().encode(e);let t,n,r,i,s,o=e.length,c=0;for(i=0;i<o;i++)n=e.charCodeAt(i),(n&64512)===55296&&i+1<o&&(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),s=0,i=0;s<c;i++)n=e.charCodeAt(i),(n&64512)===55296&&i+1<o&&(r=e.charCodeAt(i+1),(r&64512)===56320&&(n=65536+(n-55296<<10)+(r-56320),i++)),n<128?t[s++]=n:n<2048?(t[s++]=192|n>>>6,t[s++]=128|n&63):n<65536?(t[s++]=224|n>>>12,t[s++]=128|n>>>6&63,t[s++]=128|n&63):(t[s++]=240|n>>>18,t[s++]=128|n>>>12&63,t[s++]=128|n>>>6&63,t[s++]=128|n&63);return t};const Ch=(e,t)=>{if(t<65534&&e.subarray&&lo)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 Bh=(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 s=new Array(n*2);for(i=0,r=0;r<n;){let o=e[r++];if(o<128){s[i++]=o;continue}let c=cn[o];if(c>4){s[i++]=65533,r+=c-1;continue}for(o&=c===2?31:c===3?15:7;c>1&&r<n;)o=o<<6|e[r++]&63,c--;if(c>1){s[i++]=65533;continue}o<65536?s[i++]=o:(o-=65536,s[i++]=55296|o>>10&1023,s[i++]=56320|o&1023)}return Ch(s,i)},Eh=(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+cn[e[n]]>t?n:t},ln={string2buf:Ah,buf2string:Bh,utf8border:Eh};function Th(){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 ho=Th;const fo=Object.prototype.toString,{Z_NO_FLUSH:Ph,Z_SYNC_FLUSH:Dh,Z_FULL_FLUSH:Rh,Z_FINISH:Ih,Z_OK:$n,Z_STREAM_END:Oh,Z_DEFAULT_COMPRESSION:zh,Z_DEFAULT_STRATEGY:Fh,Z_DEFLATED:Nh}=dt;function hn(e){this.options=Un.assign({level:zh,method:Nh,chunkSize:16384,windowBits:15,memLevel:8,strategy:Fh},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 ho,this.strm.avail_out=0;let n=an.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(n!==$n)throw new Error(ht[n]);if(t.header&&an.deflateSetHeader(this.strm,t.header),t.dictionary){let r;if(typeof t.dictionary=="string"?r=ln.string2buf(t.dictionary):fo.call(t.dictionary)==="[object ArrayBuffer]"?r=new Uint8Array(t.dictionary):r=t.dictionary,n=an.deflateSetDictionary(this.strm,r),n!==$n)throw new Error(ht[n]);this._dict_set=!0}}hn.prototype.push=function(e,t){const n=this.strm,r=this.options.chunkSize;let i,s;if(this.ended)return!1;for(t===~~t?s=t:s=t===!0?Ih:Ph,typeof e=="string"?n.input=ln.string2buf(e):fo.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),(s===Dh||s===Rh)&&n.avail_out<=6){this.onData(n.output.subarray(0,n.next_out)),n.avail_out=0;continue}if(i=an.deflate(n,s),i===Oh)return n.next_out>0&&this.onData(n.output.subarray(0,n.next_out)),i=an.deflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===$n;if(n.avail_out===0){this.onData(n.output);continue}if(s>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},hn.prototype.onData=function(e){this.chunks.push(e)},hn.prototype.onEnd=function(e){e===$n&&(this.result=Un.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function Jr(e,t){const n=new hn(t);if(n.push(e,!0),n.err)throw n.msg||ht[n.err];return n.result}function Lh(e,t){return t=t||{},t.raw=!0,Jr(e,t)}function jh(e,t){return t=t||{},t.gzip=!0,Jr(e,t)}var Mh=hn,Uh=Jr,$h=Lh,Hh=jh,Wh=dt,Gh={Deflate:Mh,deflate:Uh,deflateRaw:$h,gzip:Hh,constants:Wh};const Hn=16209,Vh=16191;var Kh=function(t,n){let r,i,s,o,c,l,a,h,g,f,d,_,w,x,y,P,v,S,I,B,A,O,R,T;const k=t.state;r=t.next_in,R=t.input,i=r+(t.avail_in-5),s=t.next_out,T=t.output,o=s-(n-t.avail_out),c=s+(t.avail_out-257),l=k.dmax,a=k.wsize,h=k.whave,g=k.wnext,f=k.window,d=k.hold,_=k.bits,w=k.lencode,x=k.distcode,y=(1<<k.lenbits)-1,P=(1<<k.distbits)-1;e:do{_<15&&(d+=R[r++]<<_,_+=8,d+=R[r++]<<_,_+=8),v=w[d&y];t:for(;;){if(S=v>>>24,d>>>=S,_-=S,S=v>>>16&255,S===0)T[s++]=v&65535;else if(S&16){I=v&65535,S&=15,S&&(_<S&&(d+=R[r++]<<_,_+=8),I+=d&(1<<S)-1,d>>>=S,_-=S),_<15&&(d+=R[r++]<<_,_+=8,d+=R[r++]<<_,_+=8),v=x[d&P];n:for(;;){if(S=v>>>24,d>>>=S,_-=S,S=v>>>16&255,S&16){if(B=v&65535,S&=15,_<S&&(d+=R[r++]<<_,_+=8,_<S&&(d+=R[r++]<<_,_+=8)),B+=d&(1<<S)-1,B>l){t.msg="invalid distance too far back",k.mode=Hn;break e}if(d>>>=S,_-=S,S=s-o,B>S){if(S=B-S,S>h&&k.sane){t.msg="invalid distance too far back",k.mode=Hn;break e}if(A=0,O=f,g===0){if(A+=a-S,S<I){I-=S;do T[s++]=f[A++];while(--S);A=s-B,O=T}}else if(g<S){if(A+=a+g-S,S-=g,S<I){I-=S;do T[s++]=f[A++];while(--S);if(A=0,g<I){S=g,I-=S;do T[s++]=f[A++];while(--S);A=s-B,O=T}}}else if(A+=g-S,S<I){I-=S;do T[s++]=f[A++];while(--S);A=s-B,O=T}for(;I>2;)T[s++]=O[A++],T[s++]=O[A++],T[s++]=O[A++],I-=3;I&&(T[s++]=O[A++],I>1&&(T[s++]=O[A++]))}else{A=s-B;do T[s++]=T[A++],T[s++]=T[A++],T[s++]=T[A++],I-=3;while(I>2);I&&(T[s++]=T[A++],I>1&&(T[s++]=T[A++]))}}else if((S&64)===0){v=x[(v&65535)+(d&(1<<S)-1)];continue n}else{t.msg="invalid distance code",k.mode=Hn;break e}break}}else if((S&64)===0){v=w[(v&65535)+(d&(1<<S)-1)];continue t}else if(S&32){k.mode=Vh;break e}else{t.msg="invalid literal/length code",k.mode=Hn;break e}break}}while(r<i&&s<c);I=_>>3,r-=I,_-=I<<3,d&=(1<<_)-1,t.next_in=r,t.next_out=s,t.avail_in=r<i?5+(i-r):5-(r-i),t.avail_out=s<c?257+(c-s):257-(s-c),k.hold=d,k.bits=_};const Rt=15,uo=852,go=592,po=0,Qr=1,bo=2,Zh=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]),Xh=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]),Yh=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 dn=(e,t,n,r,i,s,o,c)=>{const l=c.bits;let a=0,h=0,g=0,f=0,d=0,_=0,w=0,x=0,y=0,P=0,v,S,I,B,A,O=null,R;const T=new Uint16Array(Rt+1),k=new Uint16Array(Rt+1);let F=null,D,W,j;for(a=0;a<=Rt;a++)T[a]=0;for(h=0;h<r;h++)T[t[n+h]]++;for(d=l,f=Rt;f>=1&&T[f]===0;f--);if(d>f&&(d=f),f===0)return i[s++]=1<<24|64<<16|0,i[s++]=1<<24|64<<16|0,c.bits=1,0;for(g=1;g<f&&T[g]===0;g++);for(d<g&&(d=g),x=1,a=1;a<=Rt;a++)if(x<<=1,x-=T[a],x<0)return-1;if(x>0&&(e===po||f!==1))return-1;for(k[1]=0,a=1;a<Rt;a++)k[a+1]=k[a]+T[a];for(h=0;h<r;h++)t[n+h]!==0&&(o[k[t[n+h]]++]=h);if(e===po?(O=F=o,R=20):e===Qr?(O=Zh,F=qh,R=257):(O=Xh,F=Yh,R=0),P=0,h=0,a=g,A=s,_=d,w=0,I=-1,y=1<<d,B=y-1,e===Qr&&y>uo||e===bo&&y>go)return 1;for(;;){D=a-w,o[h]+1<R?(W=0,j=o[h]):o[h]>=R?(W=F[o[h]-R],j=O[o[h]-R]):(W=32+64,j=0),v=1<<a-w,S=1<<_,g=S;do S-=v,i[A+(P>>w)+S]=D<<24|W<<16|j|0;while(S!==0);for(v=1<<a-1;P&v;)v>>=1;if(v!==0?(P&=v-1,P+=v):P=0,h++,--T[a]===0){if(a===f)break;a=t[n+o[h]]}if(a>d&&(P&B)!==I){for(w===0&&(w=d),A+=g,_=a-w,x=1<<_;_+w<f&&(x-=T[_+w],!(x<=0));)_++,x<<=1;if(y+=1<<_,e===Qr&&y>uo||e===bo&&y>go)return 1;I=P&B,i[I]=d<<24|_<<16|A-s|0}}return P!==0&&(i[A+P]=a-w<<24|64<<16|0),c.bits=d,0};const Jh=0,mo=1,_o=2,{Z_FINISH:yo,Z_BLOCK:Qh,Z_TREES:Wn,Z_OK:pt,Z_STREAM_END:ed,Z_NEED_DICT:td,Z_STREAM_ERROR:Be,Z_DATA_ERROR:wo,Z_MEM_ERROR:xo,Z_BUF_ERROR:nd,Z_DEFLATED:So}=dt,Gn=16180,vo=16181,ko=16182,Ao=16183,Co=16184,Bo=16185,Eo=16186,To=16187,Po=16188,Do=16189,Vn=16190,Ze=16191,ei=16192,Ro=16193,ti=16194,Io=16195,Oo=16196,zo=16197,Fo=16198,Kn=16199,Zn=16200,No=16201,Lo=16202,jo=16203,Mo=16204,Uo=16205,ni=16206,$o=16207,Ho=16208,ie=16209,Wo=16210,Go=16211,rd=852,id=592,sd=15,Vo=e=>(e>>>24&255)+(e>>>8&65280)+((e&65280)<<8)+((e&255)<<24);function od(){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 bt=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.mode<Gn||t.mode>Go?1:0},Ko=e=>{if(bt(e))return Be;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=Gn,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(rd),t.distcode=t.distdyn=new Int32Array(id),t.sane=1,t.back=-1,pt},Zo=e=>{if(bt(e))return Be;const t=e.state;return t.wsize=0,t.whave=0,t.wnext=0,Ko(e)},qo=(e,t)=>{let n;if(bt(e))return Be;const r=e.state;return t<0?(n=0,t=-t):(n=(t>>4)+5,t<48&&(t&=15)),t&&(t<8||t>15)?Be:(r.window!==null&&r.wbits!==t&&(r.window=null),r.wrap=n,r.wbits=t,Zo(e))},Xo=(e,t)=>{if(!e)return Be;const n=new od;e.state=n,n.strm=e,n.window=null,n.mode=Gn;const r=qo(e,t);return r!==pt&&(e.state=null),r},ad=e=>Xo(e,sd);let Yo=!0,ri,ii;const cd=e=>{if(Yo){ri=new Int32Array(512),ii=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(dn(mo,e.lens,0,288,ri,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;dn(_o,e.lens,0,32,ii,0,e.work,{bits:5}),Yo=!1}e.lencode=ri,e.lenbits=9,e.distcode=ii,e.distbits=5},Jo=(e,t,n,r)=>{let i;const s=e.state;return s.window===null&&(s.wsize=1<<s.wbits,s.wnext=0,s.whave=0,s.window=new Uint8Array(s.wsize)),r>=s.wsize?(s.window.set(t.subarray(n-s.wsize,n),0),s.wnext=0,s.whave=s.wsize):(i=s.wsize-s.wnext,i>r&&(i=r),s.window.set(t.subarray(n-r,n-r+i),s.wnext),r-=i,r?(s.window.set(t.subarray(n-r,n),0),s.wnext=r,s.whave=s.wsize):(s.wnext+=i,s.wnext===s.wsize&&(s.wnext=0),s.whave<s.wsize&&(s.whave+=i))),0},ld=(e,t)=>{let n,r,i,s,o,c,l,a,h,g,f,d,_,w,x=0,y,P,v,S,I,B,A,O;const R=new Uint8Array(4);let T,k;const F=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(bt(e)||!e.output||!e.input&&e.avail_in!==0)return Be;n=e.state,n.mode===Ze&&(n.mode=ei),o=e.next_out,i=e.output,l=e.avail_out,s=e.next_in,r=e.input,c=e.avail_in,a=n.hold,h=n.bits,g=c,f=l,O=pt;e:for(;;)switch(n.mode){case Gn:if(n.wrap===0){n.mode=ei;break}for(;h<16;){if(c===0)break e;c--,a+=r[s++]<<h,h+=8}if(n.wrap&2&&a===35615){n.wbits===0&&(n.wbits=15),n.check=0,R[0]=a&255,R[1]=a>>>8&255,n.check=he(n.check,R,2,0),a=0,h=0,n.mode=vo;break}if(n.head&&(n.head.done=!1),!(n.wrap&1)||(((a&255)<<8)+(a>>8))%31){e.msg="incorrect header check",n.mode=ie;break}if((a&15)!==So){e.msg="unknown compression method",n.mode=ie;break}if(a>>>=4,h-=4,A=(a&15)+8,n.wbits===0&&(n.wbits=A),A>15||A>n.wbits){e.msg="invalid window size",n.mode=ie;break}n.dmax=1<<n.wbits,n.flags=0,e.adler=n.check=1,n.mode=a&512?Do:Ze,a=0,h=0;break;case vo:for(;h<16;){if(c===0)break e;c--,a+=r[s++]<<h,h+=8}if(n.flags=a,(n.flags&255)!==So){e.msg="unknown compression method",n.mode=ie;break}if(n.flags&57344){e.msg="unknown header flags set",n.mode=ie;break}n.head&&(n.head.text=a>>8&1),n.flags&512&&n.wrap&4&&(R[0]=a&255,R[1]=a>>>8&255,n.check=he(n.check,R,2,0)),a=0,h=0,n.mode=ko;case ko:for(;h<32;){if(c===0)break e;c--,a+=r[s++]<<h,h+=8}n.head&&(n.head.time=a),n.flags&512&&n.wrap&4&&(R[0]=a&255,R[1]=a>>>8&255,R[2]=a>>>16&255,R[3]=a>>>24&255,n.check=he(n.check,R,4,0)),a=0,h=0,n.mode=Ao;case Ao:for(;h<16;){if(c===0)break e;c--,a+=r[s++]<<h,h+=8}n.head&&(n.head.xflags=a&255,n.head.os=a>>8),n.flags&512&&n.wrap&4&&(R[0]=a&255,R[1]=a>>>8&255,n.check=he(n.check,R,2,0)),a=0,h=0,n.mode=Co;case Co:if(n.flags&1024){for(;h<16;){if(c===0)break e;c--,a+=r[s++]<<h,h+=8}n.length=a,n.head&&(n.head.extra_len=a),n.flags&512&&n.wrap&4&&(R[0]=a&255,R[1]=a>>>8&255,n.check=he(n.check,R,2,0)),a=0,h=0}else n.head&&(n.head.extra=null);n.mode=Bo;case Bo:if(n.flags&1024&&(d=n.length,d>c&&(d=c),d&&(n.head&&(A=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Uint8Array(n.head.extra_len)),n.head.extra.set(r.subarray(s,s+d),A)),n.flags&512&&n.wrap&4&&(n.check=he(n.check,r,d,s)),c-=d,s+=d,n.length-=d),n.length))break e;n.length=0,n.mode=Eo;case Eo:if(n.flags&2048){if(c===0)break e;d=0;do A=r[s+d++],n.head&&A&&n.length<65536&&(n.head.name+=String.fromCharCode(A));while(A&&d<c);if(n.flags&512&&n.wrap&4&&(n.check=he(n.check,r,d,s)),c-=d,s+=d,A)break e}else n.head&&(n.head.name=null);n.length=0,n.mode=To;case To:if(n.flags&4096){if(c===0)break e;d=0;do A=r[s+d++],n.head&&A&&n.length<65536&&(n.head.comment+=String.fromCharCode(A));while(A&&d<c);if(n.flags&512&&n.wrap&4&&(n.check=he(n.check,r,d,s)),c-=d,s+=d,A)break e}else n.head&&(n.head.comment=null);n.mode=Po;case Po:if(n.flags&512){for(;h<16;){if(c===0)break e;c--,a+=r[s++]<<h,h+=8}if(n.wrap&4&&a!==(n.check&65535)){e.msg="header crc mismatch",n.mode=ie;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=Ze;break;case Do:for(;h<32;){if(c===0)break e;c--,a+=r[s++]<<h,h+=8}e.adler=n.check=Vo(a),a=0,h=0,n.mode=Vn;case Vn:if(n.havedict===0)return e.next_out=o,e.avail_out=l,e.next_in=s,e.avail_in=c,n.hold=a,n.bits=h,td;e.adler=n.check=1,n.mode=Ze;case Ze:if(t===Qh||t===Wn)break e;case ei:if(n.last){a>>>=h&7,h-=h&7,n.mode=ni;break}for(;h<3;){if(c===0)break e;c--,a+=r[s++]<<h,h+=8}switch(n.last=a&1,a>>>=1,h-=1,a&3){case 0:n.mode=Ro;break;case 1:if(cd(n),n.mode=Kn,t===Wn){a>>>=2,h-=2;break e}break;case 2:n.mode=Oo;break;case 3:e.msg="invalid block type",n.mode=ie}a>>>=2,h-=2;break;case Ro:for(a>>>=h&7,h-=h&7;h<32;){if(c===0)break e;c--,a+=r[s++]<<h,h+=8}if((a&65535)!==(a>>>16^65535)){e.msg="invalid stored block lengths",n.mode=ie;break}if(n.length=a&65535,a=0,h=0,n.mode=ti,t===Wn)break e;case ti:n.mode=Io;case Io:if(d=n.length,d){if(d>c&&(d=c),d>l&&(d=l),d===0)break e;i.set(r.subarray(s,s+d),o),c-=d,s+=d,l-=d,o+=d,n.length-=d;break}n.mode=Ze;break;case Oo:for(;h<14;){if(c===0)break e;c--,a+=r[s++]<<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=ie;break}n.have=0,n.mode=zo;case zo:for(;n.have<n.ncode;){for(;h<3;){if(c===0)break e;c--,a+=r[s++]<<h,h+=8}n.lens[F[n.have++]]=a&7,a>>>=3,h-=3}for(;n.have<19;)n.lens[F[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,T={bits:n.lenbits},O=dn(Jh,n.lens,0,19,n.lencode,0,n.work,T),n.lenbits=T.bits,O){e.msg="invalid code lengths set",n.mode=ie;break}n.have=0,n.mode=Fo;case Fo:for(;n.have<n.nlen+n.ndist;){for(;x=n.lencode[a&(1<<n.lenbits)-1],y=x>>>24,P=x>>>16&255,v=x&65535,!(y<=h);){if(c===0)break e;c--,a+=r[s++]<<h,h+=8}if(v<16)a>>>=y,h-=y,n.lens[n.have++]=v;else{if(v===16){for(k=y+2;h<k;){if(c===0)break e;c--,a+=r[s++]<<h,h+=8}if(a>>>=y,h-=y,n.have===0){e.msg="invalid bit length repeat",n.mode=ie;break}A=n.lens[n.have-1],d=3+(a&3),a>>>=2,h-=2}else if(v===17){for(k=y+3;h<k;){if(c===0)break e;c--,a+=r[s++]<<h,h+=8}a>>>=y,h-=y,A=0,d=3+(a&7),a>>>=3,h-=3}else{for(k=y+7;h<k;){if(c===0)break e;c--,a+=r[s++]<<h,h+=8}a>>>=y,h-=y,A=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=ie;break}for(;d--;)n.lens[n.have++]=A}}if(n.mode===ie)break;if(n.lens[256]===0){e.msg="invalid code -- missing end-of-block",n.mode=ie;break}if(n.lenbits=9,T={bits:n.lenbits},O=dn(mo,n.lens,0,n.nlen,n.lencode,0,n.work,T),n.lenbits=T.bits,O){e.msg="invalid literal/lengths set",n.mode=ie;break}if(n.distbits=6,n.distcode=n.distdyn,T={bits:n.distbits},O=dn(_o,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,T),n.distbits=T.bits,O){e.msg="invalid distances set",n.mode=ie;break}if(n.mode=Kn,t===Wn)break e;case Kn:n.mode=Zn;case Zn:if(c>=6&&l>=258){e.next_out=o,e.avail_out=l,e.next_in=s,e.avail_in=c,n.hold=a,n.bits=h,Kh(e,f),o=e.next_out,i=e.output,l=e.avail_out,s=e.next_in,r=e.input,c=e.avail_in,a=n.hold,h=n.bits,n.mode===Ze&&(n.back=-1);break}for(n.back=0;x=n.lencode[a&(1<<n.lenbits)-1],y=x>>>24,P=x>>>16&255,v=x&65535,!(y<=h);){if(c===0)break e;c--,a+=r[s++]<<h,h+=8}if(P&&(P&240)===0){for(S=y,I=P,B=v;x=n.lencode[B+((a&(1<<S+I)-1)>>S)],y=x>>>24,P=x>>>16&255,v=x&65535,!(S+y<=h);){if(c===0)break e;c--,a+=r[s++]<<h,h+=8}a>>>=S,h-=S,n.back+=S}if(a>>>=y,h-=y,n.back+=y,n.length=v,P===0){n.mode=Uo;break}if(P&32){n.back=-1,n.mode=Ze;break}if(P&64){e.msg="invalid literal/length code",n.mode=ie;break}n.extra=P&15,n.mode=No;case No:if(n.extra){for(k=n.extra;h<k;){if(c===0)break e;c--,a+=r[s++]<<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=Lo;case Lo:for(;x=n.distcode[a&(1<<n.distbits)-1],y=x>>>24,P=x>>>16&255,v=x&65535,!(y<=h);){if(c===0)break e;c--,a+=r[s++]<<h,h+=8}if((P&240)===0){for(S=y,I=P,B=v;x=n.distcode[B+((a&(1<<S+I)-1)>>S)],y=x>>>24,P=x>>>16&255,v=x&65535,!(S+y<=h);){if(c===0)break e;c--,a+=r[s++]<<h,h+=8}a>>>=S,h-=S,n.back+=S}if(a>>>=y,h-=y,n.back+=y,P&64){e.msg="invalid distance code",n.mode=ie;break}n.offset=v,n.extra=P&15,n.mode=jo;case jo:if(n.extra){for(k=n.extra;h<k;){if(c===0)break e;c--,a+=r[s++]<<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=ie;break}n.mode=Mo;case Mo:if(l===0)break e;if(d=f-l,n.offset>d){if(d=n.offset-d,d>n.whave&&n.sane){e.msg="invalid distance too far back",n.mode=ie;break}d>n.wnext?(d-=n.wnext,_=n.wsize-d):_=n.wnext-d,d>n.length&&(d=n.length),w=n.window}else w=i,_=o-n.offset,d=n.length;d>l&&(d=l),l-=d,n.length-=d;do i[o++]=w[_++];while(--d);n.length===0&&(n.mode=Zn);break;case Uo:if(l===0)break e;i[o++]=n.length,l--,n.mode=Zn;break;case ni:if(n.wrap){for(;h<32;){if(c===0)break e;c--,a|=r[s++]<<h,h+=8}if(f-=l,e.total_out+=f,n.total+=f,n.wrap&4&&f&&(e.adler=n.check=n.flags?he(n.check,i,f,o-f):tn(n.check,i,f,o-f)),f=l,n.wrap&4&&(n.flags?a:Vo(a))!==n.check){e.msg="incorrect data check",n.mode=ie;break}a=0,h=0}n.mode=$o;case $o:if(n.wrap&&n.flags){for(;h<32;){if(c===0)break e;c--,a+=r[s++]<<h,h+=8}if(n.wrap&4&&a!==(n.total&4294967295)){e.msg="incorrect length check",n.mode=ie;break}a=0,h=0}n.mode=Ho;case Ho:O=ed;break e;case ie:O=wo;break e;case Wo:return xo;case Go:default:return Be}return e.next_out=o,e.avail_out=l,e.next_in=s,e.avail_in=c,n.hold=a,n.bits=h,(n.wsize||f!==e.avail_out&&n.mode<ie&&(n.mode<ni||t!==yo))&&Jo(e,e.output,e.next_out,f-e.avail_out),g-=e.avail_in,f-=e.avail_out,e.total_in+=g,e.total_out+=f,n.total+=f,n.wrap&4&&f&&(e.adler=n.check=n.flags?he(n.check,i,f,e.next_out-f):tn(n.check,i,f,e.next_out-f)),e.data_type=n.bits+(n.last?64:0)+(n.mode===Ze?128:0)+(n.mode===Kn||n.mode===ti?256:0),(g===0&&f===0||t===yo)&&O===pt&&(O=nd),O},hd=e=>{if(bt(e))return Be;let t=e.state;return t.window&&(t.window=null),e.state=null,pt},dd=(e,t)=>{if(bt(e))return Be;const n=e.state;return(n.wrap&2)===0?Be:(n.head=t,t.done=!1,pt)},fd=(e,t)=>{const n=t.length;let r,i,s;return bt(e)||(r=e.state,r.wrap!==0&&r.mode!==Vn)?Be:r.mode===Vn&&(i=1,i=tn(i,t,n,0),i!==r.check)?wo:(s=Jo(e,t,n,n),s?(r.mode=Wo,xo):(r.havedict=1,pt))};var ud=Zo,gd=qo,pd=Ko,bd=ad,md=Xo,_d=ld,yd=hd,wd=dd,xd=fd,Sd="pako inflate (from Nodeca project)",qe={inflateReset:ud,inflateReset2:gd,inflateResetKeep:pd,inflateInit:bd,inflateInit2:md,inflate:_d,inflateEnd:yd,inflateGetHeader:wd,inflateSetDictionary:xd,inflateInfo:Sd};function vd(){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 kd=vd;const Qo=Object.prototype.toString,{Z_NO_FLUSH:Ad,Z_FINISH:Cd,Z_OK:fn,Z_STREAM_END:si,Z_NEED_DICT:oi,Z_STREAM_ERROR:Bd,Z_DATA_ERROR:ea,Z_MEM_ERROR:Ed}=dt;function un(e){this.options=Un.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 ho,this.strm.avail_out=0;let n=qe.inflateInit2(this.strm,t.windowBits);if(n!==fn)throw new Error(ht[n]);if(this.header=new kd,qe.inflateGetHeader(this.strm,this.header),t.dictionary&&(typeof t.dictionary=="string"?t.dictionary=ln.string2buf(t.dictionary):Qo.call(t.dictionary)==="[object ArrayBuffer]"&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(n=qe.inflateSetDictionary(this.strm,t.dictionary),n!==fn)))throw new Error(ht[n])}un.prototype.push=function(e,t){const n=this.strm,r=this.options.chunkSize,i=this.options.dictionary;let s,o,c;if(this.ended)return!1;for(t===~~t?o=t:o=t===!0?Cd:Ad,Qo.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),s=qe.inflate(n,o),s===oi&&i&&(s=qe.inflateSetDictionary(n,i),s===fn?s=qe.inflate(n,o):s===ea&&(s=oi));n.avail_in>0&&s===si&&n.state.wrap>0&&e[n.next_in]!==0;)qe.inflateReset(n),s=qe.inflate(n,o);switch(s){case Bd:case ea:case oi:case Ed:return this.onEnd(s),this.ended=!0,!1}if(c=n.avail_out,n.next_out&&(n.avail_out===0||s===si))if(this.options.to==="string"){let l=ln.utf8border(n.output,n.next_out),a=n.next_out-l,h=ln.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(!(s===fn&&c===0)){if(s===si)return s=qe.inflateEnd(this.strm),this.onEnd(s),this.ended=!0,!0;if(n.avail_in===0)break}}return!0},un.prototype.onData=function(e){this.chunks.push(e)},un.prototype.onEnd=function(e){e===fn&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=Un.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function ai(e,t){const n=new un(t);if(n.push(e),n.err)throw n.msg||ht[n.err];return n.result}function Td(e,t){return t=t||{},t.raw=!0,ai(e,t)}var Pd=un,Dd=ai,Rd=Td,Id=ai,Od=dt,zd={Inflate:Pd,inflate:Dd,inflateRaw:Rd,ungzip:Id,constants:Od};const{Deflate:Fd,deflate:Nd,deflateRaw:Ld,gzip:jd}=Gh,{Inflate:Md,inflate:Ud,inflateRaw:$d,ungzip:Hd}=zd;var Wd=Fd,Gd=Nd,Vd=Ld,Kd=jd,Zd=Md,qd=Ud,Xd=$d,Yd=Hd,Jd=dt,ci={Deflate:Wd,deflate:Gd,deflateRaw:Vd,gzip:Kd,Inflate:Zd,inflate:qd,inflateRaw:Xd,ungzip:Yd,constants:Jd};const ta=class{constructor(e,t){p(this,"major"),p(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++]=b.Percent,e[t++]=b.P,e[t++]=b.D,e[t++]=b.F,e[t++]=b.Dash,t+=
|
|
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;top:0;left:0;width:100%;height:100%;pointer-events:none}.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-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 .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{cursor:pointer;position:absolute;inset:0;pointer-events:auto;z-index:calc(var(--vpv-base-z-index) * 5)}.vpv-annotation-editor-layer:not(.highlight-mode,.underline-mode,.strikeout-mode) .vpv-annotation-editor.vpv-annotation-editor__highlight{pointer-events:none}.vpv-annotation-editor-layer:not(.highlight-mode,.underline-mode,.strikeout-mode) .vpv-annotation-editor.vpv-annotation-editor__highlight .vpv-annotation-editor__clip-path{pointer-events:none}.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{pointer-events:none}.vpv-annotation-highlight__color-picker-wrapper{padding-left:4px;padding-right:4px;padding-bottom:4px;text-align:left}.vpv-annotation-highlight__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}.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:none}.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}.vpv-canvas-layer>.vpv-highlight-outline:is(svg).hovered,.vpv-canvas-layer>.vpv-highlight-outline:is(svg).selected,.vpv-canvas-layer>.vpv-underline-outline:is(svg).hovered,.vpv-canvas-layer>.vpv-underline-outline:is(svg).selected,.vpv-canvas-layer>.vpv-strikeout-outline:is(svg).hovered,.vpv-canvas-layer>.vpv-strikeout-outline:is(svg).selected{stroke-width:var(--vpv-annotation-highlight__outline-width)}.vpv-canvas-layer>.vpv-highlight-outline:is(svg).hovered,.vpv-canvas-layer>.vpv-underline-outline:is(svg).hovered,.vpv-canvas-layer>.vpv-strikeout-outline:is(svg).hovered{stroke:var(--vpv-annotation-highlight__outline-hover-color)}.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-highlight__outline-selected-color)}.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,.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-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-8583d7e5]{padding-top:.5rem;padding-bottom:.5rem;border-top:1px solid #c6ccd2;max-width:min-content;margin:.5rem auto}.vpv-annotation-tools-container[data-v-8583d7e5] .vpv-toolbar-btn{margin-bottom:.25rem}.slide-enter-active[data-v-8583d7e5],.slide-leave-active[data-v-8583d7e5]{transition:all .3s ease-out}.slide-enter-from[data-v-8583d7e5],.slide-leave-to[data-v-8583d7e5]{opacity:0}.slide-enter-from[data-v-8583d7e5],.slide-leave-to[data-v-8583d7e5]{transform:translateY(-20px)}')),document.head.appendChild(e)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}})();
|
|
2
|
+
(function(le,u){typeof exports=="object"&&typeof module<"u"?u(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],u):(le=typeof globalThis<"u"?globalThis:le||self,u(le["@vue-pdf-viewer/annotation"]={},le.Vue))})(this,function(le,u){"use strict";var wc=Object.defineProperty,xc=(e,t,n)=>t in e?wc(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,p=(e,t,n)=>(xc(e,typeof t!="symbol"?t+"":t,n),n);const wt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Vt=new Uint8Array(256);for(let e=0;e<wt.length;e++)Vt[wt.charCodeAt(e)]=e;const Sc=e=>{let t="";const n=e.length;for(let r=0;r<n;r+=3)t+=wt[e[r]>>2],t+=wt[(e[r]&3)<<4|e[r+1]>>4],t+=wt[(e[r+1]&15)<<2|e[r+2]>>6],t+=wt[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},ds=e=>{let t=e.length*.75;const n=e.length;let r,i=0,s,o,c,l;e[e.length-1]==="="&&(t--,e[e.length-2]==="="&&t--);const a=new Uint8Array(t);for(r=0;r<n;r+=4)s=Vt[e.charCodeAt(r)],o=Vt[e.charCodeAt(r+1)],c=Vt[e.charCodeAt(r+2)],l=Vt[e.charCodeAt(r+3)],a[i++]=s<<2|o>>4,a[i++]=(o&15)<<4|c>>2,a[i++]=(c&3)<<6|l&63;return a},vc=/^(data)?:?([\w\/\+]+)?;?(charset=[\w-]+|base64)?.*,/i,kc=e=>{const t=e.trim(),r=t.substring(0,100).match(vc);if(!r)return ds(t);const[i]=r,s=t.substring(i.length);return ds(s)},$=e=>e.charCodeAt(0),fs=(e,t)=>Pe(e.toString(16),t,"0").toUpperCase(),us=e=>fs(e,2),We=e=>String.fromCharCode(e),Ac=e=>We(parseInt(e,16)),Pe=(e,t,n)=>{let r="";for(let i=0,s=t-e.length;i<s;i++)r+=n;return r+e},fe=(e,t,n)=>{const r=e.length;for(let i=0;i<r;i++)t[n++]=e.charCodeAt(i);return r},Cc=/^D:(\d\d\d\d)(\d\d)?(\d\d)?(\d\d)?(\d\d)?(\d\d)?([+\-Z])?(\d\d)?'?(\d\d)?'?$/,gs=e=>{const t=e.match(Cc);if(!t)return;const[,n,r="01",i="01",s="00",o="00",c="00",l="Z",a="00",h="00"]=t,g=l==="Z"?"Z":`${l}${a}:${h}`;return new Date(`${n}-${r}-${i}T${s}:${o}:${c}${g}`)},Bc=(e,t)=>{var n;let r=0,i;for(;r<e.length;){const s=e.substring(r).match(t);if(!s)return{match:i,pos:r};i=s,r+=((n=s.index)!=null?n:0)+s[0].length}return{match:i,pos:r}},Pn=e=>e[e.length-1],kr=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},Tc=(...e)=>{const t=e.length,n=[];for(let o=0;o<t;o++){const c=e[o];n[o]=c instanceof Uint8Array?c:kr(c)}let r=0;for(let o=0;o<t;o++)r+=e[o].length;const i=new Uint8Array(r);let s=0;for(let o=0;o<t;o++){const c=n[o];for(let l=0,a=c.length;l<a;l++)i[s++]=c[l]}return i},ps=e=>{let t="";for(let n=0,r=e.length;n<r;n++)t+=We(e[n]);return t},xt=e=>{const t=e.length;for(let n=0,r=Math.floor(t/2);n<r;n++){const i=n,s=t-n-1,o=e[n];e[i]=e[s],e[s]=o}return e},Ec=e=>{let t=0;for(let n=0,r=e.length;n<r;n++)t+=e[n];return t},Dc=(e,t)=>{const n=new Array(t-e);for(let r=0,i=n.length;r<i;r++)n[r]=e+r;return n},Pc=e=>{if(typeof e=="string")return kc(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`")},St=()=>new Promise(e=>{setTimeout(()=>e(),0)}),bs=class{constructor(e){p(this,"populate"),p(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 vt=bs;p(vt,"populatedBy",e=>new bs(e));const Rn=e=>{throw new Error(e)},Rc=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},In=e=>Math.ceil(e.toString(2).length/8),kt=e=>{const t=new Uint8Array(In(e));for(let n=1;n<=t.length;n++)t[n-1]=e>>(t.length-n)*8;return t},H=new Uint16Array(256);for(let e=0;e<256;e++)H[e]=e;H[22]=$(""),H[24]=$("\u02D8"),H[25]=$("\u02C7"),H[26]=$("\u02C6"),H[27]=$("\u02D9"),H[28]=$("\u02DD"),H[29]=$("\u02DB"),H[30]=$("\u02DA"),H[31]=$("\u02DC"),H[127]=$("\uFFFD"),H[128]=$("\u2022"),H[129]=$("\u2020"),H[130]=$("\u2021"),H[131]=$("\u2026"),H[132]=$("\u2014"),H[133]=$("\u2013"),H[134]=$("\u0192"),H[135]=$("\u2044"),H[136]=$("\u2039"),H[137]=$("\u203A"),H[138]=$("\u2212"),H[139]=$("\u2030"),H[140]=$("\u201E"),H[141]=$("\u201C"),H[142]=$("\u201D"),H[143]=$("\u2018"),H[144]=$("\u2019"),H[145]=$("\u201A"),H[146]=$("\u2122"),H[147]=$("\uFB01"),H[148]=$("\uFB02"),H[149]=$("\u0141"),H[150]=$("\u0152"),H[151]=$("\u0160"),H[152]=$("\u0178"),H[153]=$("\u017D"),H[154]=$("\u0131"),H[155]=$("\u0142"),H[156]=$("\u0153"),H[157]=$("\u0161"),H[158]=$("\u017E"),H[159]=$("\uFFFD"),H[160]=$("\u20AC"),H[173]=$("\uFFFD");const ms=e=>{const t=new Array(e.length);for(let n=0,r=e.length;n<r;n++)t[n]=H[e[n]];return String.fromCodePoint(...t)},_s=e=>Object.keys(e).map(t=>e[t]),On=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height,Ic=(e,t=!0)=>{const n=[];t&&n.push(65279);for(let r=0,i=e.length;r<i;){const s=e.codePointAt(r);if(s<65536)n.push(s),r+=1;else if(s<1114112)n.push(Oc(s),zc(s)),r+=2;else throw new Error(`Invalid code point: 0x${us(s)}`)}return new Uint16Array(n)},Oc=e=>Math.floor((e-65536)/1024)+55296,zc=e=>(e-65536)%1024+56320,Kt="\uFFFD".codePointAt(0),ys=(e,t=!0)=>{if(e.length<=1)return String.fromCodePoint(Kt);const n=t?Nc(e):"BigEndian";let r=t?2:0;const i=[];for(;e.length-r>=2;){const s=xs(e[r++],e[r++],n);if(Fc(s))if(e.length-r<2)i.push(Kt);else{const o=xs(e[r++],e[r++],n);ws(o)?i.push(s,o):i.push(Kt)}else ws(s)?(r+=2,i.push(Kt)):i.push(s)}return r<e.length&&i.push(Kt),String.fromCodePoint(...i)},Fc=e=>e>=55296&&e<=56319,ws=e=>e>=56320&&e<=57343,xs=(e,t,n)=>{if(n==="LittleEndian")return t<<8|e;if(n==="BigEndian")return e<<8|t;throw new Error(`Invalid byteOrder: ${n}`)},Nc=e=>Ss(e)?"BigEndian":vs(e)?"LittleEndian":"BigEndian",Ss=e=>e[0]===254&&e[1]===255,vs=e=>e[0]===255&&e[1]===254,ks=e=>Ss(e)||vs(e),he=e=>`\`${e}\``,Lc=e=>`'${e}'`,As=e=>{const t=typeof e;return t==="string"?Lc(e):t==="undefined"?he(e):e},Mc=(e,t,n)=>{const r=new Array(n.length);for(let s=0,o=n.length;s<o;s++){const c=n[s];r[s]=As(c)}const i=r.join(" or ");return`${he(t)} must be one of ${i}, but was actually ${As(e)}`},Zt=(e,t,n)=>{Array.isArray(n)||(n=_s(n));for(let r=0,i=n.length;r<i;r++)if(e===n[r])return;throw new TypeError(Mc(e,t,n))},Ie=(e,t,n)=>{Array.isArray(n)||(n=_s(n)),Zt(e,t,n.concat(void 0))},jc=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),Uc=(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],$c=(e,t,n)=>{const r=new Array(n.length);for(let s=0,o=n.length;s<o;s++){const c=n[s];c==="null"&&(r[s]=he("null")),c==="undefined"&&(r[s]=he("undefined")),c==="string"?r[s]=he("string"):c==="number"?r[s]=he("number"):c==="boolean"?r[s]=he("boolean"):c==="symbol"?r[s]=he("symbol"):c==="bigint"?r[s]=he("bigint"):c===Array?r[s]=he("Array"):c===Uint8Array?r[s]=he("Uint8Array"):c===ArrayBuffer?r[s]=he("ArrayBuffer"):r[s]=he(c[1])}const i=r.join(" or ");return`${he(t)} must be of type ${i}, but was actually of type ${he(jc(e))}`},T=(e,t,n)=>{for(let r=0,i=n.length;r<i;r++)if(Uc(e,n[r]))return;throw new TypeError($c(e,t,n))},j=(e,t,n)=>{T(e,t,n.concat("undefined"))},Cs=(e,t,n)=>{for(let r=0,i=e.length;r<i;r++)T(e[r],t,n)},Je=(e,t,n,r)=>{if(T(e,t,["number"]),T(n,"min",["number"]),T(r,"max",["number"]),r=Math.max(n,r),e<n||e>r)throw new Error(`${he(t)} must be at least ${n} and at most ${r}, but was actually ${e}`)},Ge=(e,t,n,r)=>{T(e,t,["number","undefined"]),typeof e=="number"&&Je(e,t,n,r)},Hc=(e,t,n)=>{if(T(e,t,["number"]),e%n!==0)throw new Error(`${he(t)} must be a multiple of ${n}, but was actually ${e}`)},Wc=(e,t)=>{if(!Number.isInteger(e))throw new Error(`${he(t)} must be an integer, but was actually ${e}`)};class Oe extends Error{constructor(t,n){const r=`Method ${t}.${n}() not implemented`;super(r)}}class Ar extends Error{constructor(t){const n=`Cannot construct ${t} - it has a private constructor`;super(n)}}class Cr extends Error{constructor(t,n){const r=o=>{var c,l;return(l=o?.name)!=null?l:(c=o?.constructor)==null?void 0:c.name},s=`Expected instance of ${(Array.isArray(t)?t.map(r):[r(t)]).join(" or ")}, but got instance of ${n&&r(n)}`;super(s)}}class Gc extends Error{constructor(t){const n=`${t} stream encoding not supported`;super(n)}}class Br extends Error{constructor(t,n){const r=`Cannot call ${t}.${n}() more than once`;super(r)}}class Vc extends Error{constructor(){const t="Can't embed page with missing Contents";super(t)}}class Kc extends Error{constructor(t){var n,r,i;const o=`Unrecognized stream type: ${(i=(r=(n=t?.contructor)==null?void 0:n.name)!=null?r:t?.name)!=null?i:t}`;super(o)}}class Zc extends Error{constructor(t){const n=`Attempted to convert PDFArray with ${t} elements to rectangle, but must have exactly 4 elements.`;super(n)}}class Bs 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 Ts extends Error{constructor(t,n){const r=`Invalid targetIndex specified: targetIndex=${t} must be less than Count=${n}`;super(r)}}class Es 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 zn 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 Tr 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 Xc extends Error{constructor(t){const n=`No /DA (default appearance) entry found for field: ${t}`;super(n)}}class Yc extends Error{constructor(t){const n=`No Tf operator found for DA of field: ${t}`;super(n)}}class Ds extends Error{constructor(t,n){const r=`Failed to parse number (line:${t.line} col:${t.column} offset=${t.offset}): "${n}"`;super(r)}}class Qe 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 Jc extends Qe{constructor(t,n,r){const i=`Expected next byte to be ${n} but it was actually ${r}`;super(t,i)}}class Qc extends Qe{constructor(t,n){const r=`Failed to parse PDF object starting with the following byte: ${n}`;super(t,r)}}class el extends Qe{constructor(t){const n="Failed to parse invalid PDF object";super(t,n)}}class tl extends Qe{constructor(t){const n="Failed to parse PDF stream";super(t,n)}}class nl extends Qe{constructor(t){const n="Failed to parse PDF literal string due to unbalanced parenthesis";super(t,n)}}class rl extends Qe{constructor(t){const n="Parser stalled";super(t,n)}}class il extends Qe{constructor(t){const n="No PDF header found";super(t,n)}}class sl extends Qe{constructor(t,n){const r=`Did not find expected keyword '${ps(n)}'`;super(t,r)}}class pe{clone(t){throw new Oe(this.constructor.name,"clone")}toString(){throw new Oe(this.constructor.name,"toString")}sizeInBytes(){throw new Oe(this.constructor.name,"sizeInBytes")}copyBytesInto(t,n){throw new Oe(this.constructor.name,"copyBytesInto")}}const Er=class extends pe{constructor(e){super(),p(this,"numberValue"),p(this,"stringValue"),this.numberValue=e,this.stringValue=Rc(e)}asNumber(){return this.numberValue}value(){return this.numberValue}clone(){return Er.of(this.numberValue)}toString(){return this.stringValue}sizeInBytes(){return this.stringValue.length}copyBytesInto(e,t){return t+=fe(this.stringValue,e,t),this.stringValue.length}};let U=Er;p(U,"of",e=>new Er(e));var b=(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))(b||{});const Dr=class extends pe{constructor(e){super(),p(this,"array"),p(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 Zc(this.size());const e=this.lookup(0,U).asNumber(),t=this.lookup(1,U).asNumber(),n=this.lookup(2,U).asNumber(),r=this.lookup(3,U).asNumber(),i=e,s=t,o=n-e,c=r-t;return{x:i,y:s,width:o,height:c}}asArray(){return this.array.slice()}clone(e){const t=Dr.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++]=b.LeftSquareBracket,e[t++]=b.Space;for(let r=0,i=this.size();r<i;r++)t+=this.get(r).copyBytesInto(e,t),e[t++]=b.Space;return e[t++]=b.RightSquareBracket,t-n}scalePDFNumbers(e,t){for(let n=0,r=this.size();n<r;n++){const i=this.lookup(n);if(i instanceof U){const s=n%2===0?e:t;this.set(n,U.of(i.asNumber()*s))}}}};let J=Dr;p(J,"withContext",e=>new Dr(e));const Ae=new Uint8Array(256);Ae[b.LeftParen]=1,Ae[b.RightParen]=1,Ae[b.LessThan]=1,Ae[b.GreaterThan]=1,Ae[b.LeftSquareBracket]=1,Ae[b.RightSquareBracket]=1,Ae[b.LeftCurly]=1,Ae[b.RightCurly]=1,Ae[b.ForwardSlash]=1,Ae[b.Percent]=1;const Ve=new Uint8Array(256);Ve[b.Null]=1,Ve[b.Tab]=1,Ve[b.Newline]=1,Ve[b.FormFeed]=1,Ve[b.CarriageReturn]=1,Ve[b.Space]=1;const Pr=new Uint8Array(256);for(let e=0,t=256;e<t;e++)Pr[e]=Ve[e]||Ae[e]?1:0;Pr[b.Hash]=1;const ol=e=>e.replace(/#([\dABCDEF]{2})/g,(t,n)=>Ac(n)),al=e=>e>=b.ExclamationPoint&&e<=b.Tilde&&!Pr[e],Ps={},Rs=new Map,te=class extends pe{constructor(e,t){if(e!==Ps)throw new Ar("PDFName");super(),p(this,"encodedName");let n="/";for(let r=0,i=t.length;r<i;r++){const s=t[r],o=$(s);n+=al(o)?s:`#${us(o)}`}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,s=this.encodedName.length;i<s;i++){const o=this.encodedName[i],c=$(o),l=this.encodedName[i+1];n?c>=b.Zero&&c<=b.Nine||c>=b.a&&c<=b.f||c>=b.A&&c<=b.F?(t+=o,(t.length===2||!(l>="0"&&l<="9"||l>="a"&&l<="f"||l>="A"&&l<="F"))&&(r(parseInt(t,16)),t="")):r(c):c===b.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+=fe(this.encodedName,e,t),this.encodedName.length}};let m=te;p(m,"of",e=>{const t=ol(e);let n=Rs.get(t);return n||(n=new te(Ps,t),Rs.set(t,n)),n}),p(m,"Length",te.of("Length")),p(m,"FlateDecode",te.of("FlateDecode")),p(m,"Resources",te.of("Resources")),p(m,"Font",te.of("Font")),p(m,"XObject",te.of("XObject")),p(m,"ExtGState",te.of("ExtGState")),p(m,"Contents",te.of("Contents")),p(m,"Type",te.of("Type")),p(m,"Parent",te.of("Parent")),p(m,"MediaBox",te.of("MediaBox")),p(m,"Page",te.of("Page")),p(m,"Annots",te.of("Annots")),p(m,"TrimBox",te.of("TrimBox")),p(m,"ArtBox",te.of("ArtBox")),p(m,"BleedBox",te.of("BleedBox")),p(m,"CropBox",te.of("CropBox")),p(m,"Rotate",te.of("Rotate")),p(m,"Title",te.of("Title")),p(m,"Author",te.of("Author")),p(m,"Subject",te.of("Subject")),p(m,"Creator",te.of("Creator")),p(m,"Keywords",te.of("Keywords")),p(m,"Producer",te.of("Producer")),p(m,"CreationDate",te.of("CreationDate")),p(m,"ModDate",te.of("ModDate"));const Fn=class extends pe{constructor(e){super(),p(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 s=parseInt(e.substring(r,r+2),16);n[i]=s,r+=2,i+=1}return n}decodeText(){const e=this.asBytes();return ks(e)?ys(e):ms(e)}decodeDate(){const e=this.decodeText(),t=gs(e);if(!t)throw new Bs(e);return t}asString(){return this.value}clone(){return Fn.of(this.value)}toString(){return`<${this.value}>`}sizeInBytes(){return this.value.length+2}copyBytesInto(e,t){return e[t++]=b.LessThan,t+=fe(this.value,e,t),e[t++]=b.GreaterThan,this.value.length+2}};let X=Fn;p(X,"of",e=>new Fn(e)),p(X,"fromText",e=>{const t=Ic(e);let n="";for(let r=0,i=t.length;r<i;r++)n+=fs(t[r],4);return new Fn(n)});/*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */const cl=4,Is=0,Os=1,ll=2;function At(e){let t=e.length;for(;--t>=0;)e[t]=0}const hl=0,zs=1,dl=2,fl=3,ul=258,Rr=29,qt=256,Xt=qt+1+Rr,Ct=30,Ir=19,Fs=2*Xt+1,lt=15,Or=16,gl=7,zr=256,Ns=16,Ls=17,Ms=18,Fr=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]),Nn=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]),pl=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),js=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),bl=512,Ke=new Array((Xt+2)*2);At(Ke);const Yt=new Array(Ct*2);At(Yt);const Jt=new Array(bl);At(Jt);const Qt=new Array(ul-fl+1);At(Qt);const Nr=new Array(Rr);At(Nr);const Ln=new Array(Ct);At(Ln);function Lr(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 Us,$s,Hs;function Mr(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}const Ws=e=>e<256?Jt[e]:Jt[256+(e>>>7)],en=(e,t)=>{e.pending_buf[e.pending++]=t&255,e.pending_buf[e.pending++]=t>>>8&255},me=(e,t,n)=>{e.bi_valid>Or-n?(e.bi_buf|=t<<e.bi_valid&65535,en(e,e.bi_buf),e.bi_buf=t>>Or-e.bi_valid,e.bi_valid+=n-Or):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=n)},ze=(e,t,n)=>{me(e,n[t*2],n[t*2+1])},Gs=(e,t)=>{let n=0;do n|=e&1,e>>>=1,n<<=1;while(--t>0);return n>>>1},ml=e=>{e.bi_valid===16?(en(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)},_l=(e,t)=>{const n=t.dyn_tree,r=t.max_code,i=t.stat_desc.static_tree,s=t.stat_desc.has_stree,o=t.stat_desc.extra_bits,c=t.stat_desc.extra_base,l=t.stat_desc.max_length;let a,h,g,f,d,_,w=0;for(f=0;f<=lt;f++)e.bl_count[f]=0;for(n[e.heap[e.heap_max]*2+1]=0,a=e.heap_max+1;a<Fs;a++)h=e.heap[a],f=n[n[h*2+1]*2+1]+1,f>l&&(f=l,w++),n[h*2+1]=f,!(h>r)&&(e.bl_count[f]++,d=0,h>=c&&(d=o[h-c]),_=n[h*2],e.opt_len+=_*(f+d),s&&(e.static_len+=_*(i[h*2+1]+d)));if(w!==0){do{for(f=l-1;e.bl_count[f]===0;)f--;e.bl_count[f]--,e.bl_count[f+1]+=2,e.bl_count[l]--,w-=2}while(w>0);for(f=l;f!==0;f--)for(h=e.bl_count[f];h!==0;)g=e.heap[--a],!(g>r)&&(n[g*2+1]!==f&&(e.opt_len+=(f-n[g*2+1])*n[g*2],n[g*2+1]=f),h--)}},Vs=(e,t,n)=>{const r=new Array(lt+1);let i=0,s,o;for(s=1;s<=lt;s++)i=i+n[s-1]<<1,r[s]=i;for(o=0;o<=t;o++){let c=e[o*2+1];c!==0&&(e[o*2]=Gs(r[c]++,c))}},yl=()=>{let e,t,n,r,i;const s=new Array(lt+1);for(n=0,r=0;r<Rr-1;r++)for(Nr[r]=n,e=0;e<1<<Fr[r];e++)Qt[n++]=r;for(Qt[n-1]=r,i=0,r=0;r<16;r++)for(Ln[r]=i,e=0;e<1<<Nn[r];e++)Jt[i++]=r;for(i>>=7;r<Ct;r++)for(Ln[r]=i<<7,e=0;e<1<<Nn[r]-7;e++)Jt[256+i++]=r;for(t=0;t<=lt;t++)s[t]=0;for(e=0;e<=143;)Ke[e*2+1]=8,e++,s[8]++;for(;e<=255;)Ke[e*2+1]=9,e++,s[9]++;for(;e<=279;)Ke[e*2+1]=7,e++,s[7]++;for(;e<=287;)Ke[e*2+1]=8,e++,s[8]++;for(Vs(Ke,Xt+1,s),e=0;e<Ct;e++)Yt[e*2+1]=5,Yt[e*2]=Gs(e,5);Us=new Lr(Ke,Fr,qt+1,Xt,lt),$s=new Lr(Yt,Nn,0,Ct,lt),Hs=new Lr(new Array(0),pl,0,Ir,gl)},Ks=e=>{let t;for(t=0;t<Xt;t++)e.dyn_ltree[t*2]=0;for(t=0;t<Ct;t++)e.dyn_dtree[t*2]=0;for(t=0;t<Ir;t++)e.bl_tree[t*2]=0;e.dyn_ltree[zr*2]=1,e.opt_len=e.static_len=0,e.sym_next=e.matches=0},Zs=e=>{e.bi_valid>8?en(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0},qs=(e,t,n,r)=>{const i=t*2,s=n*2;return e[i]<e[s]||e[i]===e[s]&&r[t]<=r[n]},jr=(e,t,n)=>{const r=e.heap[n];let i=n<<1;for(;i<=e.heap_len&&(i<e.heap_len&&qs(t,e.heap[i+1],e.heap[i],e.depth)&&i++,!qs(t,r,e.heap[i],e.depth));)e.heap[n]=e.heap[i],n=i,i<<=1;e.heap[n]=r},Xs=(e,t,n)=>{let r,i,s=0,o,c;if(e.sym_next!==0)do r=e.pending_buf[e.sym_buf+s++]&255,r+=(e.pending_buf[e.sym_buf+s++]&255)<<8,i=e.pending_buf[e.sym_buf+s++],r===0?ze(e,i,t):(o=Qt[i],ze(e,o+qt+1,t),c=Fr[o],c!==0&&(i-=Nr[o],me(e,i,c)),r--,o=Ws(r),ze(e,o,n),c=Nn[o],c!==0&&(r-=Ln[o],me(e,r,c)));while(s<e.sym_next);ze(e,zr,t)},Ur=(e,t)=>{const n=t.dyn_tree,r=t.stat_desc.static_tree,i=t.stat_desc.has_stree,s=t.stat_desc.elems;let o,c,l=-1,a;for(e.heap_len=0,e.heap_max=Fs,o=0;o<s;o++)n[o*2]!==0?(e.heap[++e.heap_len]=l=o,e.depth[o]=0):n[o*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,o=e.heap_len>>1;o>=1;o--)jr(e,n,o);a=s;do o=e.heap[1],e.heap[1]=e.heap[e.heap_len--],jr(e,n,1),c=e.heap[1],e.heap[--e.heap_max]=o,e.heap[--e.heap_max]=c,n[a*2]=n[o*2]+n[c*2],e.depth[a]=(e.depth[o]>=e.depth[c]?e.depth[o]:e.depth[c])+1,n[o*2+1]=n[c*2+1]=a,e.heap[1]=a++,jr(e,n,1);while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],_l(e,t),Vs(n,l,e.bl_count)},Ys=(e,t,n)=>{let r,i=-1,s,o=t[0*2+1],c=0,l=7,a=4;for(o===0&&(l=138,a=3),t[(n+1)*2+1]=65535,r=0;r<=n;r++)s=o,o=t[(r+1)*2+1],!(++c<l&&s===o)&&(c<a?e.bl_tree[s*2]+=c:s!==0?(s!==i&&e.bl_tree[s*2]++,e.bl_tree[Ns*2]++):c<=10?e.bl_tree[Ls*2]++:e.bl_tree[Ms*2]++,c=0,i=s,o===0?(l=138,a=3):s===o?(l=6,a=3):(l=7,a=4))},Js=(e,t,n)=>{let r,i=-1,s,o=t[0*2+1],c=0,l=7,a=4;for(o===0&&(l=138,a=3),r=0;r<=n;r++)if(s=o,o=t[(r+1)*2+1],!(++c<l&&s===o)){if(c<a)do ze(e,s,e.bl_tree);while(--c!==0);else s!==0?(s!==i&&(ze(e,s,e.bl_tree),c--),ze(e,Ns,e.bl_tree),me(e,c-3,2)):c<=10?(ze(e,Ls,e.bl_tree),me(e,c-3,3)):(ze(e,Ms,e.bl_tree),me(e,c-11,7));c=0,i=s,o===0?(l=138,a=3):s===o?(l=6,a=3):(l=7,a=4)}},wl=e=>{let t;for(Ys(e,e.dyn_ltree,e.l_desc.max_code),Ys(e,e.dyn_dtree,e.d_desc.max_code),Ur(e,e.bl_desc),t=Ir-1;t>=3&&e.bl_tree[js[t]*2+1]===0;t--);return e.opt_len+=3*(t+1)+5+5+4,t},xl=(e,t,n,r)=>{let i;for(me(e,t-257,5),me(e,n-1,5),me(e,r-4,4),i=0;i<r;i++)me(e,e.bl_tree[js[i]*2+1],3);Js(e,e.dyn_ltree,t-1),Js(e,e.dyn_dtree,n-1)},Sl=e=>{let t=4093624447,n;for(n=0;n<=31;n++,t>>>=1)if(t&1&&e.dyn_ltree[n*2]!==0)return Is;if(e.dyn_ltree[9*2]!==0||e.dyn_ltree[10*2]!==0||e.dyn_ltree[13*2]!==0)return Os;for(n=32;n<qt;n++)if(e.dyn_ltree[n*2]!==0)return Os;return Is};let Qs=!1;const vl=e=>{Qs||(yl(),Qs=!0),e.l_desc=new Mr(e.dyn_ltree,Us),e.d_desc=new Mr(e.dyn_dtree,$s),e.bl_desc=new Mr(e.bl_tree,Hs),e.bi_buf=0,e.bi_valid=0,Ks(e)},eo=(e,t,n,r)=>{me(e,(hl<<1)+(r?1:0),3),Zs(e),en(e,n),en(e,~n),n&&e.pending_buf.set(e.window.subarray(t,t+n),e.pending),e.pending+=n},kl=e=>{me(e,zs<<1,3),ze(e,zr,Ke),ml(e)},Al=(e,t,n,r)=>{let i,s,o=0;e.level>0?(e.strm.data_type===ll&&(e.strm.data_type=Sl(e)),Ur(e,e.l_desc),Ur(e,e.d_desc),o=wl(e),i=e.opt_len+3+7>>>3,s=e.static_len+3+7>>>3,s<=i&&(i=s)):i=s=n+5,n+4<=i&&t!==-1?eo(e,t,n,r):e.strategy===cl||s===i?(me(e,(zs<<1)+(r?1:0),3),Xs(e,Ke,Yt)):(me(e,(dl<<1)+(r?1:0),3),xl(e,e.l_desc.max_code+1,e.d_desc.max_code+1,o+1),Xs(e,e.dyn_ltree,e.dyn_dtree)),Ks(e),r&&Zs(e)},Cl=(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[(Qt[n]+qt+1)*2]++,e.dyn_dtree[Ws(t)*2]++),e.sym_next===e.sym_end);var Bl=vl,Tl=eo,El=Al,Dl=Cl,Pl=kl,Rl={_tr_init:Bl,_tr_stored_block:Tl,_tr_flush_block:El,_tr_tally:Dl,_tr_align:Pl},tn=(e,t,n,r)=>{let i=e&65535|0,s=e>>>16&65535|0,o=0;for(;n!==0;){o=n>2e3?2e3:n,n-=o;do i=i+t[r++]|0,s=s+i|0;while(--o);i%=65521,s%=65521}return i|s<<16|0};const Il=()=>{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},Ol=new Uint32Array(Il());var de=(e,t,n,r)=>{const i=Ol,s=r+n;e^=-1;for(let o=r;o<s;o++)e=e>>>8^i[(e^t[o])&255];return e^-1},ht={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"},dt={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:zl,_tr_stored_block:$r,_tr_flush_block:Fl,_tr_tally:et,_tr_align:Nl}=Rl,{Z_NO_FLUSH:tt,Z_PARTIAL_FLUSH:Ll,Z_FULL_FLUSH:Ml,Z_FINISH:Ce,Z_BLOCK:to,Z_OK:ue,Z_STREAM_END:no,Z_STREAM_ERROR:Fe,Z_DATA_ERROR:jl,Z_BUF_ERROR:Hr,Z_DEFAULT_COMPRESSION:Ul,Z_FILTERED:$l,Z_HUFFMAN_ONLY:Mn,Z_RLE:Hl,Z_FIXED:Wl,Z_DEFAULT_STRATEGY:Gl,Z_UNKNOWN:Vl,Z_DEFLATED:jn}=dt,Kl=9,Zl=15,ql=8,Xl=29,Wr=256+1+Xl,Yl=30,Jl=19,Ql=2*Wr+1,eh=15,q=3,nt=258,Ne=nt+q+1,th=32,Bt=42,Gr=57,Vr=69,Kr=73,Zr=91,qr=103,ft=113,nn=666,be=1,Tt=2,ut=3,Et=4,nh=3,gt=(e,t)=>(e.msg=ht[t],t),ro=e=>e*2-(e>4?9:0),rt=e=>{let t=e.length;for(;--t>=0;)e[t]=0},rh=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 it=(e,t,n)=>(t<<e.hash_shift^n)&e.hash_mask;const xe=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))},Se=(e,t)=>{Fl(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,xe(e.strm)},Q=(e,t)=>{e.pending_buf[e.pending++]=t},rn=(e,t)=>{e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=t&255},Xr=(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=tn(e.adler,t,i,n):e.state.wrap===2&&(e.adler=de(e.adler,t,i,n)),e.next_in+=i,e.total_in+=i,i)},io=(e,t)=>{let n=e.max_chain_length,r=e.strstart,i,s,o=e.prev_length,c=e.nice_match;const l=e.strstart>e.w_size-Ne?e.strstart-(e.w_size-Ne):0,a=e.window,h=e.w_mask,g=e.prev,f=e.strstart+nt;let d=a[r+o-1],_=a[r+o];e.prev_length>=e.good_match&&(n>>=2),c>e.lookahead&&(c=e.lookahead);do if(i=t,!(a[i+o]!==_||a[i+o-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<f);if(s=nt-(f-r),r=f-nt,s>o){if(e.match_start=t,o=s,s>=c)break;d=a[r+o-1],_=a[r+o]}}while((t=g[t&h])>l&&--n!==0);return o<=e.lookahead?o:e.lookahead},Dt=e=>{const t=e.w_size;let n,r,i;do{if(r=e.window_size-e.lookahead-e.strstart,e.strstart>=t+(t-Ne)&&(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),rh(e),r+=t),e.strm.avail_in===0)break;if(n=Xr(e.strm,e.window,e.strstart+e.lookahead,r),e.lookahead+=n,e.lookahead+e.insert>=q)for(i=e.strstart-e.insert,e.ins_h=e.window[i],e.ins_h=it(e,e.ins_h,e.window[i+1]);e.insert&&(e.ins_h=it(e,e.ins_h,e.window[i+q-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<q)););}while(e.lookahead<Ne&&e.strm.avail_in!==0)},so=(e,t)=>{let n=e.pending_buf_size-5>e.w_size?e.w_size:e.pending_buf_size-5,r,i,s,o=0,c=e.strm.avail_in;do{if(r=65535,s=e.bi_valid+42>>3,e.strm.avail_out<s||(s=e.strm.avail_out-s,i=e.strstart-e.block_start,r>i+e.strm.avail_in&&(r=i+e.strm.avail_in),r>s&&(r=s),r<n&&(r===0&&t!==Ce||t===tt||r!==i+e.strm.avail_in)))break;o=t===Ce&&r===i+e.strm.avail_in?1:0,$r(e,0,0,o),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,xe(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&&(Xr(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(o===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),o?Et:t!==tt&&t!==Ce&&e.strm.avail_in===0&&e.strstart===e.block_start?Tt:(s=e.window_size-e.strstart,e.strm.avail_in>s&&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++,s+=e.w_size,e.insert>e.strstart&&(e.insert=e.strstart)),s>e.strm.avail_in&&(s=e.strm.avail_in),s&&(Xr(e.strm,e.window,e.strstart,s),e.strstart+=s,e.insert+=s>e.w_size-e.insert?e.w_size-e.insert:s),e.high_water<e.strstart&&(e.high_water=e.strstart),s=e.bi_valid+42>>3,s=e.pending_buf_size-s>65535?65535:e.pending_buf_size-s,n=s>e.w_size?e.w_size:s,i=e.strstart-e.block_start,(i>=n||(i||t===Ce)&&t!==tt&&e.strm.avail_in===0&&i<=s)&&(r=i>s?s:i,o=t===Ce&&e.strm.avail_in===0&&r===i?1:0,$r(e,e.block_start,r,o),e.block_start+=r,xe(e.strm)),o?ut:be)},Yr=(e,t)=>{let n,r;for(;;){if(e.lookahead<Ne){if(Dt(e),e.lookahead<Ne&&t===tt)return be;if(e.lookahead===0)break}if(n=0,e.lookahead>=q&&(e.ins_h=it(e,e.ins_h,e.window[e.strstart+q-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-Ne&&(e.match_length=io(e,n)),e.match_length>=q)if(r=et(e,e.strstart-e.match_start,e.match_length-q),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=q){e.match_length--;do e.strstart++,e.ins_h=it(e,e.ins_h,e.window[e.strstart+q-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=it(e,e.ins_h,e.window[e.strstart+1]);else r=et(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(r&&(Se(e,!1),e.strm.avail_out===0))return be}return e.insert=e.strstart<q-1?e.strstart:q-1,t===Ce?(Se(e,!0),e.strm.avail_out===0?ut:Et):e.sym_next&&(Se(e,!1),e.strm.avail_out===0)?be:Tt},Pt=(e,t)=>{let n,r,i;for(;;){if(e.lookahead<Ne){if(Dt(e),e.lookahead<Ne&&t===tt)return be;if(e.lookahead===0)break}if(n=0,e.lookahead>=q&&(e.ins_h=it(e,e.ins_h,e.window[e.strstart+q-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=q-1,n!==0&&e.prev_length<e.max_lazy_match&&e.strstart-n<=e.w_size-Ne&&(e.match_length=io(e,n),e.match_length<=5&&(e.strategy===$l||e.match_length===q&&e.strstart-e.match_start>4096)&&(e.match_length=q-1)),e.prev_length>=q&&e.match_length<=e.prev_length){i=e.strstart+e.lookahead-q,r=et(e,e.strstart-1-e.prev_match,e.prev_length-q),e.lookahead-=e.prev_length-1,e.prev_length-=2;do++e.strstart<=i&&(e.ins_h=it(e,e.ins_h,e.window[e.strstart+q-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=q-1,e.strstart++,r&&(Se(e,!1),e.strm.avail_out===0))return be}else if(e.match_available){if(r=et(e,0,e.window[e.strstart-1]),r&&Se(e,!1),e.strstart++,e.lookahead--,e.strm.avail_out===0)return be}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(r=et(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<q-1?e.strstart:q-1,t===Ce?(Se(e,!0),e.strm.avail_out===0?ut:Et):e.sym_next&&(Se(e,!1),e.strm.avail_out===0)?be:Tt},ih=(e,t)=>{let n,r,i,s;const o=e.window;for(;;){if(e.lookahead<=nt){if(Dt(e),e.lookahead<=nt&&t===tt)return be;if(e.lookahead===0)break}if(e.match_length=0,e.lookahead>=q&&e.strstart>0&&(i=e.strstart-1,r=o[i],r===o[++i]&&r===o[++i]&&r===o[++i])){s=e.strstart+nt;do;while(r===o[++i]&&r===o[++i]&&r===o[++i]&&r===o[++i]&&r===o[++i]&&r===o[++i]&&r===o[++i]&&r===o[++i]&&i<s);e.match_length=nt-(s-i),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=q?(n=et(e,1,e.match_length-q),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(n=et(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),n&&(Se(e,!1),e.strm.avail_out===0))return be}return e.insert=0,t===Ce?(Se(e,!0),e.strm.avail_out===0?ut:Et):e.sym_next&&(Se(e,!1),e.strm.avail_out===0)?be:Tt},sh=(e,t)=>{let n;for(;;){if(e.lookahead===0&&(Dt(e),e.lookahead===0)){if(t===tt)return be;break}if(e.match_length=0,n=et(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,n&&(Se(e,!1),e.strm.avail_out===0))return be}return e.insert=0,t===Ce?(Se(e,!0),e.strm.avail_out===0?ut:Et):e.sym_next&&(Se(e,!1),e.strm.avail_out===0)?be:Tt};function Le(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 Le(0,0,0,0,so),new Le(4,4,8,4,Yr),new Le(4,5,16,8,Yr),new Le(4,6,32,32,Yr),new Le(4,4,16,16,Pt),new Le(8,16,32,32,Pt),new Le(8,16,128,128,Pt),new Le(8,32,128,256,Pt),new Le(32,128,258,1024,Pt),new Le(32,258,258,4096,Pt)],oh=e=>{e.window_size=2*e.w_size,rt(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=q-1,e.match_available=0,e.ins_h=0};function ah(){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=jn,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(Ql*2),this.dyn_dtree=new Uint16Array((2*Yl+1)*2),this.bl_tree=new Uint16Array((2*Jl+1)*2),rt(this.dyn_ltree),rt(this.dyn_dtree),rt(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(eh+1),this.heap=new Uint16Array(2*Wr+1),rt(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(2*Wr+1),rt(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 on=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.status!==Bt&&t.status!==Gr&&t.status!==Vr&&t.status!==Kr&&t.status!==Zr&&t.status!==qr&&t.status!==ft&&t.status!==nn?1:0},oo=e=>{if(on(e))return gt(e,Fe);e.total_in=e.total_out=0,e.data_type=Vl;const t=e.state;return t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap===2?Gr:t.wrap?Bt:ft,e.adler=t.wrap===2?0:1,t.last_flush=-2,zl(t),ue},ao=e=>{const t=oo(e);return t===ue&&oh(e.state),t},ch=(e,t)=>on(e)||e.state.wrap!==2?Fe:(e.state.gzhead=t,ue),co=(e,t,n,r,i,s)=>{if(!e)return Fe;let o=1;if(t===Ul&&(t=6),r<0?(o=0,r=-r):r>15&&(o=2,r-=16),i<1||i>Kl||n!==jn||r<8||r>15||t<0||t>9||s<0||s>Wl||r===8&&o!==1)return gt(e,Fe);r===8&&(r=9);const c=new ah;return e.state=c,c.strm=e,c.status=Bt,c.wrap=o,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+q-1)/q),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=s,c.method=n,ao(e)},lh=(e,t)=>co(e,t,jn,Zl,ql,Gl),hh=(e,t)=>{if(on(e)||t>to||t<0)return e?gt(e,Fe):Fe;const n=e.state;if(!e.output||e.avail_in!==0&&!e.input||n.status===nn&&t!==Ce)return gt(e,e.avail_out===0?Hr:Fe);const r=n.last_flush;if(n.last_flush=t,n.pending!==0){if(xe(e),e.avail_out===0)return n.last_flush=-1,ue}else if(e.avail_in===0&&ro(t)<=ro(r)&&t!==Ce)return gt(e,Hr);if(n.status===nn&&e.avail_in!==0)return gt(e,Hr);if(n.status===Bt&&n.wrap===0&&(n.status=ft),n.status===Bt){let i=jn+(n.w_bits-8<<4)<<8,s=-1;if(n.strategy>=Mn||n.level<2?s=0:n.level<6?s=1:n.level===6?s=2:s=3,i|=s<<6,n.strstart!==0&&(i|=th),i+=31-i%31,rn(n,i),n.strstart!==0&&(rn(n,e.adler>>>16),rn(n,e.adler&65535)),e.adler=1,n.status=ft,xe(e),n.pending!==0)return n.last_flush=-1,ue}if(n.status===Gr){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>=Mn||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=de(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=Vr;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>=Mn||n.level<2?4:0),Q(n,nh),n.status=ft,xe(e),n.pending!==0)return n.last_flush=-1,ue}if(n.status===Vr){if(n.gzhead.extra){let i=n.pending,s=(n.gzhead.extra.length&65535)-n.gzindex;for(;n.pending+s>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=de(e.adler,n.pending_buf,n.pending-i,i)),n.gzindex+=c,xe(e),n.pending!==0)return n.last_flush=-1,ue;i=0,s-=c}let o=new Uint8Array(n.gzhead.extra);n.pending_buf.set(o.subarray(n.gzindex,n.gzindex+s),n.pending),n.pending+=s,n.gzhead.hcrc&&n.pending>i&&(e.adler=de(e.adler,n.pending_buf,n.pending-i,i)),n.gzindex=0}n.status=Kr}if(n.status===Kr){if(n.gzhead.name){let i=n.pending,s;do{if(n.pending===n.pending_buf_size){if(n.gzhead.hcrc&&n.pending>i&&(e.adler=de(e.adler,n.pending_buf,n.pending-i,i)),xe(e),n.pending!==0)return n.last_flush=-1,ue;i=0}n.gzindex<n.gzhead.name.length?s=n.gzhead.name.charCodeAt(n.gzindex++)&255:s=0,Q(n,s)}while(s!==0);n.gzhead.hcrc&&n.pending>i&&(e.adler=de(e.adler,n.pending_buf,n.pending-i,i)),n.gzindex=0}n.status=Zr}if(n.status===Zr){if(n.gzhead.comment){let i=n.pending,s;do{if(n.pending===n.pending_buf_size){if(n.gzhead.hcrc&&n.pending>i&&(e.adler=de(e.adler,n.pending_buf,n.pending-i,i)),xe(e),n.pending!==0)return n.last_flush=-1,ue;i=0}n.gzindex<n.gzhead.comment.length?s=n.gzhead.comment.charCodeAt(n.gzindex++)&255:s=0,Q(n,s)}while(s!==0);n.gzhead.hcrc&&n.pending>i&&(e.adler=de(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&&(xe(e),n.pending!==0))return n.last_flush=-1,ue;Q(n,e.adler&255),Q(n,e.adler>>8&255),e.adler=0}if(n.status=ft,xe(e),n.pending!==0)return n.last_flush=-1,ue}if(e.avail_in!==0||n.lookahead!==0||t!==tt&&n.status!==nn){let i=n.level===0?so(n,t):n.strategy===Mn?sh(n,t):n.strategy===Hl?ih(n,t):sn[n.level].func(n,t);if((i===ut||i===Et)&&(n.status=nn),i===be||i===ut)return e.avail_out===0&&(n.last_flush=-1),ue;if(i===Tt&&(t===Ll?Nl(n):t!==to&&($r(n,0,0,!1),t===Ml&&(rt(n.head),n.lookahead===0&&(n.strstart=0,n.block_start=0,n.insert=0))),xe(e),e.avail_out===0))return n.last_flush=-1,ue}return t!==Ce?ue:n.wrap<=0?no:(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)):(rn(n,e.adler>>>16),rn(n,e.adler&65535)),xe(e),n.wrap>0&&(n.wrap=-n.wrap),n.pending!==0?ue:no)},dh=e=>{if(on(e))return Fe;const t=e.state.status;return e.state=null,t===ft?gt(e,jl):ue},fh=(e,t)=>{let n=t.length;if(on(e))return Fe;const r=e.state,i=r.wrap;if(i===2||i===1&&r.status!==Bt||r.lookahead)return Fe;if(i===1&&(e.adler=tn(e.adler,t,n,0)),r.wrap=0,n>=r.w_size){i===0&&(rt(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 s=e.avail_in,o=e.next_in,c=e.input;for(e.avail_in=n,e.next_in=0,e.input=t,Dt(r);r.lookahead>=q;){let l=r.strstart,a=r.lookahead-(q-1);do r.ins_h=it(r,r.ins_h,r.window[l+q-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=q-1,Dt(r)}return r.strstart+=r.lookahead,r.block_start=r.strstart,r.insert=r.lookahead,r.lookahead=0,r.match_length=r.prev_length=q-1,r.match_available=0,e.next_in=o,e.input=c,e.avail_in=s,r.wrap=i,ue};var uh=lh,gh=co,ph=ao,bh=oo,mh=ch,_h=hh,yh=dh,wh=fh,xh="pako deflate (from Nodeca project)",an={deflateInit:uh,deflateInit2:gh,deflateReset:ph,deflateResetKeep:bh,deflateSetHeader:mh,deflate:_h,deflateEnd:yh,deflateSetDictionary:wh,deflateInfo:xh};const Sh=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var vh=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)Sh(n,r)&&(e[r]=n[r])}}return e},kh=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,s=e.length;r<s;r++){let o=e[r];n.set(o,i),i+=o.length}return n},Un={assign:vh,flattenChunks:kh};let lo=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{lo=!1}const cn=new Uint8Array(256);for(let e=0;e<256;e++)cn[e]=e>=252?6:e>=248?5:e>=240?4:e>=224?3:e>=192?2:1;cn[254]=cn[254]=1;var Ah=e=>{if(typeof TextEncoder=="function"&&TextEncoder.prototype.encode)return new TextEncoder().encode(e);let t,n,r,i,s,o=e.length,c=0;for(i=0;i<o;i++)n=e.charCodeAt(i),(n&64512)===55296&&i+1<o&&(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),s=0,i=0;s<c;i++)n=e.charCodeAt(i),(n&64512)===55296&&i+1<o&&(r=e.charCodeAt(i+1),(r&64512)===56320&&(n=65536+(n-55296<<10)+(r-56320),i++)),n<128?t[s++]=n:n<2048?(t[s++]=192|n>>>6,t[s++]=128|n&63):n<65536?(t[s++]=224|n>>>12,t[s++]=128|n>>>6&63,t[s++]=128|n&63):(t[s++]=240|n>>>18,t[s++]=128|n>>>12&63,t[s++]=128|n>>>6&63,t[s++]=128|n&63);return t};const Ch=(e,t)=>{if(t<65534&&e.subarray&&lo)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 Bh=(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 s=new Array(n*2);for(i=0,r=0;r<n;){let o=e[r++];if(o<128){s[i++]=o;continue}let c=cn[o];if(c>4){s[i++]=65533,r+=c-1;continue}for(o&=c===2?31:c===3?15:7;c>1&&r<n;)o=o<<6|e[r++]&63,c--;if(c>1){s[i++]=65533;continue}o<65536?s[i++]=o:(o-=65536,s[i++]=55296|o>>10&1023,s[i++]=56320|o&1023)}return Ch(s,i)},Th=(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+cn[e[n]]>t?n:t},ln={string2buf:Ah,buf2string:Bh,utf8border:Th};function Eh(){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 ho=Eh;const fo=Object.prototype.toString,{Z_NO_FLUSH:Dh,Z_SYNC_FLUSH:Ph,Z_FULL_FLUSH:Rh,Z_FINISH:Ih,Z_OK:$n,Z_STREAM_END:Oh,Z_DEFAULT_COMPRESSION:zh,Z_DEFAULT_STRATEGY:Fh,Z_DEFLATED:Nh}=dt;function hn(e){this.options=Un.assign({level:zh,method:Nh,chunkSize:16384,windowBits:15,memLevel:8,strategy:Fh},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 ho,this.strm.avail_out=0;let n=an.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(n!==$n)throw new Error(ht[n]);if(t.header&&an.deflateSetHeader(this.strm,t.header),t.dictionary){let r;if(typeof t.dictionary=="string"?r=ln.string2buf(t.dictionary):fo.call(t.dictionary)==="[object ArrayBuffer]"?r=new Uint8Array(t.dictionary):r=t.dictionary,n=an.deflateSetDictionary(this.strm,r),n!==$n)throw new Error(ht[n]);this._dict_set=!0}}hn.prototype.push=function(e,t){const n=this.strm,r=this.options.chunkSize;let i,s;if(this.ended)return!1;for(t===~~t?s=t:s=t===!0?Ih:Dh,typeof e=="string"?n.input=ln.string2buf(e):fo.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),(s===Ph||s===Rh)&&n.avail_out<=6){this.onData(n.output.subarray(0,n.next_out)),n.avail_out=0;continue}if(i=an.deflate(n,s),i===Oh)return n.next_out>0&&this.onData(n.output.subarray(0,n.next_out)),i=an.deflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===$n;if(n.avail_out===0){this.onData(n.output);continue}if(s>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},hn.prototype.onData=function(e){this.chunks.push(e)},hn.prototype.onEnd=function(e){e===$n&&(this.result=Un.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function Jr(e,t){const n=new hn(t);if(n.push(e,!0),n.err)throw n.msg||ht[n.err];return n.result}function Lh(e,t){return t=t||{},t.raw=!0,Jr(e,t)}function Mh(e,t){return t=t||{},t.gzip=!0,Jr(e,t)}var jh=hn,Uh=Jr,$h=Lh,Hh=Mh,Wh=dt,Gh={Deflate:jh,deflate:Uh,deflateRaw:$h,gzip:Hh,constants:Wh};const Hn=16209,Vh=16191;var Kh=function(t,n){let r,i,s,o,c,l,a,h,g,f,d,_,w,x,y,D,v,S,I,B,A,O,R,E;const k=t.state;r=t.next_in,R=t.input,i=r+(t.avail_in-5),s=t.next_out,E=t.output,o=s-(n-t.avail_out),c=s+(t.avail_out-257),l=k.dmax,a=k.wsize,h=k.whave,g=k.wnext,f=k.window,d=k.hold,_=k.bits,w=k.lencode,x=k.distcode,y=(1<<k.lenbits)-1,D=(1<<k.distbits)-1;e:do{_<15&&(d+=R[r++]<<_,_+=8,d+=R[r++]<<_,_+=8),v=w[d&y];t:for(;;){if(S=v>>>24,d>>>=S,_-=S,S=v>>>16&255,S===0)E[s++]=v&65535;else if(S&16){I=v&65535,S&=15,S&&(_<S&&(d+=R[r++]<<_,_+=8),I+=d&(1<<S)-1,d>>>=S,_-=S),_<15&&(d+=R[r++]<<_,_+=8,d+=R[r++]<<_,_+=8),v=x[d&D];n:for(;;){if(S=v>>>24,d>>>=S,_-=S,S=v>>>16&255,S&16){if(B=v&65535,S&=15,_<S&&(d+=R[r++]<<_,_+=8,_<S&&(d+=R[r++]<<_,_+=8)),B+=d&(1<<S)-1,B>l){t.msg="invalid distance too far back",k.mode=Hn;break e}if(d>>>=S,_-=S,S=s-o,B>S){if(S=B-S,S>h&&k.sane){t.msg="invalid distance too far back",k.mode=Hn;break e}if(A=0,O=f,g===0){if(A+=a-S,S<I){I-=S;do E[s++]=f[A++];while(--S);A=s-B,O=E}}else if(g<S){if(A+=a+g-S,S-=g,S<I){I-=S;do E[s++]=f[A++];while(--S);if(A=0,g<I){S=g,I-=S;do E[s++]=f[A++];while(--S);A=s-B,O=E}}}else if(A+=g-S,S<I){I-=S;do E[s++]=f[A++];while(--S);A=s-B,O=E}for(;I>2;)E[s++]=O[A++],E[s++]=O[A++],E[s++]=O[A++],I-=3;I&&(E[s++]=O[A++],I>1&&(E[s++]=O[A++]))}else{A=s-B;do E[s++]=E[A++],E[s++]=E[A++],E[s++]=E[A++],I-=3;while(I>2);I&&(E[s++]=E[A++],I>1&&(E[s++]=E[A++]))}}else if((S&64)===0){v=x[(v&65535)+(d&(1<<S)-1)];continue n}else{t.msg="invalid distance code",k.mode=Hn;break e}break}}else if((S&64)===0){v=w[(v&65535)+(d&(1<<S)-1)];continue t}else if(S&32){k.mode=Vh;break e}else{t.msg="invalid literal/length code",k.mode=Hn;break e}break}}while(r<i&&s<c);I=_>>3,r-=I,_-=I<<3,d&=(1<<_)-1,t.next_in=r,t.next_out=s,t.avail_in=r<i?5+(i-r):5-(r-i),t.avail_out=s<c?257+(c-s):257-(s-c),k.hold=d,k.bits=_};const Rt=15,uo=852,go=592,po=0,Qr=1,bo=2,Zh=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]),Xh=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]),Yh=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 dn=(e,t,n,r,i,s,o,c)=>{const l=c.bits;let a=0,h=0,g=0,f=0,d=0,_=0,w=0,x=0,y=0,D=0,v,S,I,B,A,O=null,R;const E=new Uint16Array(Rt+1),k=new Uint16Array(Rt+1);let F=null,P,W,M;for(a=0;a<=Rt;a++)E[a]=0;for(h=0;h<r;h++)E[t[n+h]]++;for(d=l,f=Rt;f>=1&&E[f]===0;f--);if(d>f&&(d=f),f===0)return i[s++]=1<<24|64<<16|0,i[s++]=1<<24|64<<16|0,c.bits=1,0;for(g=1;g<f&&E[g]===0;g++);for(d<g&&(d=g),x=1,a=1;a<=Rt;a++)if(x<<=1,x-=E[a],x<0)return-1;if(x>0&&(e===po||f!==1))return-1;for(k[1]=0,a=1;a<Rt;a++)k[a+1]=k[a]+E[a];for(h=0;h<r;h++)t[n+h]!==0&&(o[k[t[n+h]]++]=h);if(e===po?(O=F=o,R=20):e===Qr?(O=Zh,F=qh,R=257):(O=Xh,F=Yh,R=0),D=0,h=0,a=g,A=s,_=d,w=0,I=-1,y=1<<d,B=y-1,e===Qr&&y>uo||e===bo&&y>go)return 1;for(;;){P=a-w,o[h]+1<R?(W=0,M=o[h]):o[h]>=R?(W=F[o[h]-R],M=O[o[h]-R]):(W=32+64,M=0),v=1<<a-w,S=1<<_,g=S;do S-=v,i[A+(D>>w)+S]=P<<24|W<<16|M|0;while(S!==0);for(v=1<<a-1;D&v;)v>>=1;if(v!==0?(D&=v-1,D+=v):D=0,h++,--E[a]===0){if(a===f)break;a=t[n+o[h]]}if(a>d&&(D&B)!==I){for(w===0&&(w=d),A+=g,_=a-w,x=1<<_;_+w<f&&(x-=E[_+w],!(x<=0));)_++,x<<=1;if(y+=1<<_,e===Qr&&y>uo||e===bo&&y>go)return 1;I=D&B,i[I]=d<<24|_<<16|A-s|0}}return D!==0&&(i[A+D]=a-w<<24|64<<16|0),c.bits=d,0};const Jh=0,mo=1,_o=2,{Z_FINISH:yo,Z_BLOCK:Qh,Z_TREES:Wn,Z_OK:pt,Z_STREAM_END:ed,Z_NEED_DICT:td,Z_STREAM_ERROR:Be,Z_DATA_ERROR:wo,Z_MEM_ERROR:xo,Z_BUF_ERROR:nd,Z_DEFLATED:So}=dt,Gn=16180,vo=16181,ko=16182,Ao=16183,Co=16184,Bo=16185,To=16186,Eo=16187,Do=16188,Po=16189,Vn=16190,Ze=16191,ei=16192,Ro=16193,ti=16194,Io=16195,Oo=16196,zo=16197,Fo=16198,Kn=16199,Zn=16200,No=16201,Lo=16202,Mo=16203,jo=16204,Uo=16205,ni=16206,$o=16207,Ho=16208,ie=16209,Wo=16210,Go=16211,rd=852,id=592,sd=15,Vo=e=>(e>>>24&255)+(e>>>8&65280)+((e&65280)<<8)+((e&255)<<24);function od(){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 bt=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.mode<Gn||t.mode>Go?1:0},Ko=e=>{if(bt(e))return Be;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=Gn,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(rd),t.distcode=t.distdyn=new Int32Array(id),t.sane=1,t.back=-1,pt},Zo=e=>{if(bt(e))return Be;const t=e.state;return t.wsize=0,t.whave=0,t.wnext=0,Ko(e)},qo=(e,t)=>{let n;if(bt(e))return Be;const r=e.state;return t<0?(n=0,t=-t):(n=(t>>4)+5,t<48&&(t&=15)),t&&(t<8||t>15)?Be:(r.window!==null&&r.wbits!==t&&(r.window=null),r.wrap=n,r.wbits=t,Zo(e))},Xo=(e,t)=>{if(!e)return Be;const n=new od;e.state=n,n.strm=e,n.window=null,n.mode=Gn;const r=qo(e,t);return r!==pt&&(e.state=null),r},ad=e=>Xo(e,sd);let Yo=!0,ri,ii;const cd=e=>{if(Yo){ri=new Int32Array(512),ii=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(dn(mo,e.lens,0,288,ri,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;dn(_o,e.lens,0,32,ii,0,e.work,{bits:5}),Yo=!1}e.lencode=ri,e.lenbits=9,e.distcode=ii,e.distbits=5},Jo=(e,t,n,r)=>{let i;const s=e.state;return s.window===null&&(s.wsize=1<<s.wbits,s.wnext=0,s.whave=0,s.window=new Uint8Array(s.wsize)),r>=s.wsize?(s.window.set(t.subarray(n-s.wsize,n),0),s.wnext=0,s.whave=s.wsize):(i=s.wsize-s.wnext,i>r&&(i=r),s.window.set(t.subarray(n-r,n-r+i),s.wnext),r-=i,r?(s.window.set(t.subarray(n-r,n),0),s.wnext=r,s.whave=s.wsize):(s.wnext+=i,s.wnext===s.wsize&&(s.wnext=0),s.whave<s.wsize&&(s.whave+=i))),0},ld=(e,t)=>{let n,r,i,s,o,c,l,a,h,g,f,d,_,w,x=0,y,D,v,S,I,B,A,O;const R=new Uint8Array(4);let E,k;const F=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(bt(e)||!e.output||!e.input&&e.avail_in!==0)return Be;n=e.state,n.mode===Ze&&(n.mode=ei),o=e.next_out,i=e.output,l=e.avail_out,s=e.next_in,r=e.input,c=e.avail_in,a=n.hold,h=n.bits,g=c,f=l,O=pt;e:for(;;)switch(n.mode){case Gn:if(n.wrap===0){n.mode=ei;break}for(;h<16;){if(c===0)break e;c--,a+=r[s++]<<h,h+=8}if(n.wrap&2&&a===35615){n.wbits===0&&(n.wbits=15),n.check=0,R[0]=a&255,R[1]=a>>>8&255,n.check=de(n.check,R,2,0),a=0,h=0,n.mode=vo;break}if(n.head&&(n.head.done=!1),!(n.wrap&1)||(((a&255)<<8)+(a>>8))%31){e.msg="incorrect header check",n.mode=ie;break}if((a&15)!==So){e.msg="unknown compression method",n.mode=ie;break}if(a>>>=4,h-=4,A=(a&15)+8,n.wbits===0&&(n.wbits=A),A>15||A>n.wbits){e.msg="invalid window size",n.mode=ie;break}n.dmax=1<<n.wbits,n.flags=0,e.adler=n.check=1,n.mode=a&512?Po:Ze,a=0,h=0;break;case vo:for(;h<16;){if(c===0)break e;c--,a+=r[s++]<<h,h+=8}if(n.flags=a,(n.flags&255)!==So){e.msg="unknown compression method",n.mode=ie;break}if(n.flags&57344){e.msg="unknown header flags set",n.mode=ie;break}n.head&&(n.head.text=a>>8&1),n.flags&512&&n.wrap&4&&(R[0]=a&255,R[1]=a>>>8&255,n.check=de(n.check,R,2,0)),a=0,h=0,n.mode=ko;case ko:for(;h<32;){if(c===0)break e;c--,a+=r[s++]<<h,h+=8}n.head&&(n.head.time=a),n.flags&512&&n.wrap&4&&(R[0]=a&255,R[1]=a>>>8&255,R[2]=a>>>16&255,R[3]=a>>>24&255,n.check=de(n.check,R,4,0)),a=0,h=0,n.mode=Ao;case Ao:for(;h<16;){if(c===0)break e;c--,a+=r[s++]<<h,h+=8}n.head&&(n.head.xflags=a&255,n.head.os=a>>8),n.flags&512&&n.wrap&4&&(R[0]=a&255,R[1]=a>>>8&255,n.check=de(n.check,R,2,0)),a=0,h=0,n.mode=Co;case Co:if(n.flags&1024){for(;h<16;){if(c===0)break e;c--,a+=r[s++]<<h,h+=8}n.length=a,n.head&&(n.head.extra_len=a),n.flags&512&&n.wrap&4&&(R[0]=a&255,R[1]=a>>>8&255,n.check=de(n.check,R,2,0)),a=0,h=0}else n.head&&(n.head.extra=null);n.mode=Bo;case Bo:if(n.flags&1024&&(d=n.length,d>c&&(d=c),d&&(n.head&&(A=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Uint8Array(n.head.extra_len)),n.head.extra.set(r.subarray(s,s+d),A)),n.flags&512&&n.wrap&4&&(n.check=de(n.check,r,d,s)),c-=d,s+=d,n.length-=d),n.length))break e;n.length=0,n.mode=To;case To:if(n.flags&2048){if(c===0)break e;d=0;do A=r[s+d++],n.head&&A&&n.length<65536&&(n.head.name+=String.fromCharCode(A));while(A&&d<c);if(n.flags&512&&n.wrap&4&&(n.check=de(n.check,r,d,s)),c-=d,s+=d,A)break e}else n.head&&(n.head.name=null);n.length=0,n.mode=Eo;case Eo:if(n.flags&4096){if(c===0)break e;d=0;do A=r[s+d++],n.head&&A&&n.length<65536&&(n.head.comment+=String.fromCharCode(A));while(A&&d<c);if(n.flags&512&&n.wrap&4&&(n.check=de(n.check,r,d,s)),c-=d,s+=d,A)break e}else n.head&&(n.head.comment=null);n.mode=Do;case Do:if(n.flags&512){for(;h<16;){if(c===0)break e;c--,a+=r[s++]<<h,h+=8}if(n.wrap&4&&a!==(n.check&65535)){e.msg="header crc mismatch",n.mode=ie;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=Ze;break;case Po:for(;h<32;){if(c===0)break e;c--,a+=r[s++]<<h,h+=8}e.adler=n.check=Vo(a),a=0,h=0,n.mode=Vn;case Vn:if(n.havedict===0)return e.next_out=o,e.avail_out=l,e.next_in=s,e.avail_in=c,n.hold=a,n.bits=h,td;e.adler=n.check=1,n.mode=Ze;case Ze:if(t===Qh||t===Wn)break e;case ei:if(n.last){a>>>=h&7,h-=h&7,n.mode=ni;break}for(;h<3;){if(c===0)break e;c--,a+=r[s++]<<h,h+=8}switch(n.last=a&1,a>>>=1,h-=1,a&3){case 0:n.mode=Ro;break;case 1:if(cd(n),n.mode=Kn,t===Wn){a>>>=2,h-=2;break e}break;case 2:n.mode=Oo;break;case 3:e.msg="invalid block type",n.mode=ie}a>>>=2,h-=2;break;case Ro:for(a>>>=h&7,h-=h&7;h<32;){if(c===0)break e;c--,a+=r[s++]<<h,h+=8}if((a&65535)!==(a>>>16^65535)){e.msg="invalid stored block lengths",n.mode=ie;break}if(n.length=a&65535,a=0,h=0,n.mode=ti,t===Wn)break e;case ti:n.mode=Io;case Io:if(d=n.length,d){if(d>c&&(d=c),d>l&&(d=l),d===0)break e;i.set(r.subarray(s,s+d),o),c-=d,s+=d,l-=d,o+=d,n.length-=d;break}n.mode=Ze;break;case Oo:for(;h<14;){if(c===0)break e;c--,a+=r[s++]<<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=ie;break}n.have=0,n.mode=zo;case zo:for(;n.have<n.ncode;){for(;h<3;){if(c===0)break e;c--,a+=r[s++]<<h,h+=8}n.lens[F[n.have++]]=a&7,a>>>=3,h-=3}for(;n.have<19;)n.lens[F[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,E={bits:n.lenbits},O=dn(Jh,n.lens,0,19,n.lencode,0,n.work,E),n.lenbits=E.bits,O){e.msg="invalid code lengths set",n.mode=ie;break}n.have=0,n.mode=Fo;case Fo:for(;n.have<n.nlen+n.ndist;){for(;x=n.lencode[a&(1<<n.lenbits)-1],y=x>>>24,D=x>>>16&255,v=x&65535,!(y<=h);){if(c===0)break e;c--,a+=r[s++]<<h,h+=8}if(v<16)a>>>=y,h-=y,n.lens[n.have++]=v;else{if(v===16){for(k=y+2;h<k;){if(c===0)break e;c--,a+=r[s++]<<h,h+=8}if(a>>>=y,h-=y,n.have===0){e.msg="invalid bit length repeat",n.mode=ie;break}A=n.lens[n.have-1],d=3+(a&3),a>>>=2,h-=2}else if(v===17){for(k=y+3;h<k;){if(c===0)break e;c--,a+=r[s++]<<h,h+=8}a>>>=y,h-=y,A=0,d=3+(a&7),a>>>=3,h-=3}else{for(k=y+7;h<k;){if(c===0)break e;c--,a+=r[s++]<<h,h+=8}a>>>=y,h-=y,A=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=ie;break}for(;d--;)n.lens[n.have++]=A}}if(n.mode===ie)break;if(n.lens[256]===0){e.msg="invalid code -- missing end-of-block",n.mode=ie;break}if(n.lenbits=9,E={bits:n.lenbits},O=dn(mo,n.lens,0,n.nlen,n.lencode,0,n.work,E),n.lenbits=E.bits,O){e.msg="invalid literal/lengths set",n.mode=ie;break}if(n.distbits=6,n.distcode=n.distdyn,E={bits:n.distbits},O=dn(_o,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,E),n.distbits=E.bits,O){e.msg="invalid distances set",n.mode=ie;break}if(n.mode=Kn,t===Wn)break e;case Kn:n.mode=Zn;case Zn:if(c>=6&&l>=258){e.next_out=o,e.avail_out=l,e.next_in=s,e.avail_in=c,n.hold=a,n.bits=h,Kh(e,f),o=e.next_out,i=e.output,l=e.avail_out,s=e.next_in,r=e.input,c=e.avail_in,a=n.hold,h=n.bits,n.mode===Ze&&(n.back=-1);break}for(n.back=0;x=n.lencode[a&(1<<n.lenbits)-1],y=x>>>24,D=x>>>16&255,v=x&65535,!(y<=h);){if(c===0)break e;c--,a+=r[s++]<<h,h+=8}if(D&&(D&240)===0){for(S=y,I=D,B=v;x=n.lencode[B+((a&(1<<S+I)-1)>>S)],y=x>>>24,D=x>>>16&255,v=x&65535,!(S+y<=h);){if(c===0)break e;c--,a+=r[s++]<<h,h+=8}a>>>=S,h-=S,n.back+=S}if(a>>>=y,h-=y,n.back+=y,n.length=v,D===0){n.mode=Uo;break}if(D&32){n.back=-1,n.mode=Ze;break}if(D&64){e.msg="invalid literal/length code",n.mode=ie;break}n.extra=D&15,n.mode=No;case No:if(n.extra){for(k=n.extra;h<k;){if(c===0)break e;c--,a+=r[s++]<<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=Lo;case Lo:for(;x=n.distcode[a&(1<<n.distbits)-1],y=x>>>24,D=x>>>16&255,v=x&65535,!(y<=h);){if(c===0)break e;c--,a+=r[s++]<<h,h+=8}if((D&240)===0){for(S=y,I=D,B=v;x=n.distcode[B+((a&(1<<S+I)-1)>>S)],y=x>>>24,D=x>>>16&255,v=x&65535,!(S+y<=h);){if(c===0)break e;c--,a+=r[s++]<<h,h+=8}a>>>=S,h-=S,n.back+=S}if(a>>>=y,h-=y,n.back+=y,D&64){e.msg="invalid distance code",n.mode=ie;break}n.offset=v,n.extra=D&15,n.mode=Mo;case Mo:if(n.extra){for(k=n.extra;h<k;){if(c===0)break e;c--,a+=r[s++]<<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=ie;break}n.mode=jo;case jo:if(l===0)break e;if(d=f-l,n.offset>d){if(d=n.offset-d,d>n.whave&&n.sane){e.msg="invalid distance too far back",n.mode=ie;break}d>n.wnext?(d-=n.wnext,_=n.wsize-d):_=n.wnext-d,d>n.length&&(d=n.length),w=n.window}else w=i,_=o-n.offset,d=n.length;d>l&&(d=l),l-=d,n.length-=d;do i[o++]=w[_++];while(--d);n.length===0&&(n.mode=Zn);break;case Uo:if(l===0)break e;i[o++]=n.length,l--,n.mode=Zn;break;case ni:if(n.wrap){for(;h<32;){if(c===0)break e;c--,a|=r[s++]<<h,h+=8}if(f-=l,e.total_out+=f,n.total+=f,n.wrap&4&&f&&(e.adler=n.check=n.flags?de(n.check,i,f,o-f):tn(n.check,i,f,o-f)),f=l,n.wrap&4&&(n.flags?a:Vo(a))!==n.check){e.msg="incorrect data check",n.mode=ie;break}a=0,h=0}n.mode=$o;case $o:if(n.wrap&&n.flags){for(;h<32;){if(c===0)break e;c--,a+=r[s++]<<h,h+=8}if(n.wrap&4&&a!==(n.total&4294967295)){e.msg="incorrect length check",n.mode=ie;break}a=0,h=0}n.mode=Ho;case Ho:O=ed;break e;case ie:O=wo;break e;case Wo:return xo;case Go:default:return Be}return e.next_out=o,e.avail_out=l,e.next_in=s,e.avail_in=c,n.hold=a,n.bits=h,(n.wsize||f!==e.avail_out&&n.mode<ie&&(n.mode<ni||t!==yo))&&Jo(e,e.output,e.next_out,f-e.avail_out),g-=e.avail_in,f-=e.avail_out,e.total_in+=g,e.total_out+=f,n.total+=f,n.wrap&4&&f&&(e.adler=n.check=n.flags?de(n.check,i,f,e.next_out-f):tn(n.check,i,f,e.next_out-f)),e.data_type=n.bits+(n.last?64:0)+(n.mode===Ze?128:0)+(n.mode===Kn||n.mode===ti?256:0),(g===0&&f===0||t===yo)&&O===pt&&(O=nd),O},hd=e=>{if(bt(e))return Be;let t=e.state;return t.window&&(t.window=null),e.state=null,pt},dd=(e,t)=>{if(bt(e))return Be;const n=e.state;return(n.wrap&2)===0?Be:(n.head=t,t.done=!1,pt)},fd=(e,t)=>{const n=t.length;let r,i,s;return bt(e)||(r=e.state,r.wrap!==0&&r.mode!==Vn)?Be:r.mode===Vn&&(i=1,i=tn(i,t,n,0),i!==r.check)?wo:(s=Jo(e,t,n,n),s?(r.mode=Wo,xo):(r.havedict=1,pt))};var ud=Zo,gd=qo,pd=Ko,bd=ad,md=Xo,_d=ld,yd=hd,wd=dd,xd=fd,Sd="pako inflate (from Nodeca project)",qe={inflateReset:ud,inflateReset2:gd,inflateResetKeep:pd,inflateInit:bd,inflateInit2:md,inflate:_d,inflateEnd:yd,inflateGetHeader:wd,inflateSetDictionary:xd,inflateInfo:Sd};function vd(){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 kd=vd;const Qo=Object.prototype.toString,{Z_NO_FLUSH:Ad,Z_FINISH:Cd,Z_OK:fn,Z_STREAM_END:si,Z_NEED_DICT:oi,Z_STREAM_ERROR:Bd,Z_DATA_ERROR:ea,Z_MEM_ERROR:Td}=dt;function un(e){this.options=Un.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 ho,this.strm.avail_out=0;let n=qe.inflateInit2(this.strm,t.windowBits);if(n!==fn)throw new Error(ht[n]);if(this.header=new kd,qe.inflateGetHeader(this.strm,this.header),t.dictionary&&(typeof t.dictionary=="string"?t.dictionary=ln.string2buf(t.dictionary):Qo.call(t.dictionary)==="[object ArrayBuffer]"&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(n=qe.inflateSetDictionary(this.strm,t.dictionary),n!==fn)))throw new Error(ht[n])}un.prototype.push=function(e,t){const n=this.strm,r=this.options.chunkSize,i=this.options.dictionary;let s,o,c;if(this.ended)return!1;for(t===~~t?o=t:o=t===!0?Cd:Ad,Qo.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),s=qe.inflate(n,o),s===oi&&i&&(s=qe.inflateSetDictionary(n,i),s===fn?s=qe.inflate(n,o):s===ea&&(s=oi));n.avail_in>0&&s===si&&n.state.wrap>0&&e[n.next_in]!==0;)qe.inflateReset(n),s=qe.inflate(n,o);switch(s){case Bd:case ea:case oi:case Td:return this.onEnd(s),this.ended=!0,!1}if(c=n.avail_out,n.next_out&&(n.avail_out===0||s===si))if(this.options.to==="string"){let l=ln.utf8border(n.output,n.next_out),a=n.next_out-l,h=ln.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(!(s===fn&&c===0)){if(s===si)return s=qe.inflateEnd(this.strm),this.onEnd(s),this.ended=!0,!0;if(n.avail_in===0)break}}return!0},un.prototype.onData=function(e){this.chunks.push(e)},un.prototype.onEnd=function(e){e===fn&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=Un.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function ai(e,t){const n=new un(t);if(n.push(e),n.err)throw n.msg||ht[n.err];return n.result}function Ed(e,t){return t=t||{},t.raw=!0,ai(e,t)}var Dd=un,Pd=ai,Rd=Ed,Id=ai,Od=dt,zd={Inflate:Dd,inflate:Pd,inflateRaw:Rd,ungzip:Id,constants:Od};const{Deflate:Fd,deflate:Nd,deflateRaw:Ld,gzip:Md}=Gh,{Inflate:jd,inflate:Ud,inflateRaw:$d,ungzip:Hd}=zd;var Wd=Fd,Gd=Nd,Vd=Ld,Kd=Md,Zd=jd,qd=Ud,Xd=$d,Yd=Hd,Jd=dt,ci={Deflate:Wd,deflate:Gd,deflateRaw:Vd,gzip:Kd,Inflate:Zd,inflate:qd,inflateRaw:Xd,ungzip:Yd,constants:Jd};const ta=class{constructor(e,t){p(this,"major"),p(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++]=b.Percent,e[t++]=b.P,e[t++]=b.D,e[t++]=b.F,e[t++]=b.Dash,t+=fe(this.major,e,t),e[t++]=b.Period,t+=fe(this.minor,e,t),e[t++]=b.Newline,e[t++]=b.Percent,e[t++]=129,e[t++]=129,e[t++]=129,e[t++]=129,t-n}};let gn=ta;p(gn,"forVersion",(e,t)=>new ta(e,t));const li={},hi=class extends pe{constructor(e,t){if(e!==li)throw new Ar("PDFBool");super(),p(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++]=b.t,e[t++]=b.r,e[t++]=b.u,e[t++]=b.e,4):(e[t++]=b.f,e[t++]=b.a,e[t++]=b.l,e[t++]=b.s,e[t++]=b.e,5)}};let mt=hi;p(mt,"True",new hi(li,!0)),p(mt,"False",new hi(li,!1));class Qd extends pe{asNull(){return null}clone(){return this}toString(){return"null"}sizeInBytes(){return 4}copyBytesInto(t,n){return t[n++]=b.n,t[n++]=b.u,t[n++]=b.l,t[n++]=b.l,4}}const _e=new Qd,qn=class extends pe{constructor(e,t){super(),p(this,"context"),p(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===_e&&!t))return n}has(e){const t=this.dict.get(e);return t!==void 0&&t!==_e}lookupMaybe(e,...t){const n=t.includes(_e),r=this.context.lookupMaybe(this.get(e,n),...t);if(!(r===_e&&!n))return r}lookup(e,...t){const n=t.includes(_e),r=this.context.lookup(this.get(e,n),...t);if(!(r===_e&&!n))return r}delete(e){return this.dict.delete(e)}asMap(){return new Map(this.dict)}uniqueKey(e=""){const t=this.keys();let n=m.of(this.context.addRandomSuffix(e,10));for(;t.includes(n);)n=m.of(this.context.addRandomSuffix(e,10));return n}clone(e){const t=qn.withContext(e||this.context),n=this.entries();for(let r=0,i=n.length;r<i;r++){const[s,o]=n[r];t.set(s,o)}return t}toString(){let e=`<<
|
|
4
4
|
`;const t=this.entries();for(let n=0,r=t.length;n<r;n++){const[i,s]=t[n];e+=i.toString()+" "+s.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,s]=t[n];e+=i.sizeInBytes()+s.sizeInBytes()+2}return e}copyBytesInto(e,t){const n=t;e[t++]=b.LessThan,e[t++]=b.LessThan,e[t++]=b.Newline;const r=this.entries();for(let i=0,s=r.length;i<s;i++){const[o,c]=r[i];t+=o.copyBytesInto(e,t),e[t++]=b.Space,t+=c.copyBytesInto(e,t),e[t++]=b.Newline}return e[t++]=b.GreaterThan,e[t++]=b.GreaterThan,t-n}};let V=qn;p(V,"withContext",e=>new qn(new Map,e)),p(V,"fromMapWithContext",(e,t)=>new qn(e,t));class st extends
|
|
5
|
+
`}return e+=">>",e}sizeInBytes(){let e=5;const t=this.entries();for(let n=0,r=t.length;n<r;n++){const[i,s]=t[n];e+=i.sizeInBytes()+s.sizeInBytes()+2}return e}copyBytesInto(e,t){const n=t;e[t++]=b.LessThan,e[t++]=b.LessThan,e[t++]=b.Newline;const r=this.entries();for(let i=0,s=r.length;i<s;i++){const[o,c]=r[i];t+=o.copyBytesInto(e,t),e[t++]=b.Space,t+=c.copyBytesInto(e,t),e[t++]=b.Newline}return e[t++]=b.GreaterThan,e[t++]=b.GreaterThan,t-n}};let V=qn;p(V,"withContext",e=>new qn(new Map,e)),p(V,"fromMapWithContext",(e,t)=>new qn(e,t));class st extends pe{constructor(t){super(),p(this,"dict"),this.dict=t}clone(t){throw new Oe(this.constructor.name,"clone")}getContentsString(){throw new Oe(this.constructor.name,"getContentsString")}getContents(){throw new Oe(this.constructor.name,"getContents")}getContentsSize(){throw new Oe(this.constructor.name,"getContentsSize")}updateDict(){const t=this.getContentsSize();this.dict.set(m.Length,U.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++]=b.Newline,t[n++]=b.s,t[n++]=b.t,t[n++]=b.r,t[n++]=b.e,t[n++]=b.a,t[n++]=b.m,t[n++]=b.Newline;const i=this.getContents();for(let s=0,o=i.length;s<o;s++)t[n++]=i[s];return t[n++]=b.Newline,t[n++]=b.e,t[n++]=b.n,t[n++]=b.d,t[n++]=b.s,t[n++]=b.t,t[n++]=b.r,t[n++]=b.e,t[n++]=b.a,t[n++]=b.m,n-r}}const di=class extends st{constructor(e,t){super(e),p(this,"contents"),this.contents=t}asUint8Array(){return this.contents.slice()}clone(e){return di.of(this.dict.clone(e),this.contents.slice())}getContentsString(){return ps(this.contents)}getContents(){return this.contents}getContentsSize(){return this.contents.length}};let It=di;p(It,"of",(e,t)=>new di(e,t));const na={},ra=new Map,ia=class extends
|
|
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++]=b.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 Ot=gi;p(Ot,"of",(e,t,n=!0)=>new gi(e,t,n));const sa=class{constructor(e){p(this,"seed"),this.seed=e}nextInt(){const e=Math.sin(this.seed++)*1e4;return e-Math.floor(e)}};let oa=sa;p(oa,"withSeed",e=>new sa(e));const ef=([e],[t])=>e.objectNumber-t.objectNumber,aa=class{constructor(){p(this,"largestObjectNumber"),p(this,"header"),p(this,"trailerInfo"),p(this,"rng"),p(this,"indirectObjects"),p(this,"pushGraphicsStateContentStreamRef"),p(this,"popGraphicsStateContentStreamRef"),this.largestObjectNumber=0,this.header=gn.forVersion(1,7),this.trailerInfo={},this.indirectObjects=new Map,this.rng=oa.withSeed(1)}assign(e,t){this.indirectObjects.set(e,t),e.objectNumber>this.largestObjectNumber&&(this.largestObjectNumber=e.objectNumber)}nextRef(){return this.largestObjectNumber+=1,se.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(_e),r=e instanceof se?this.indirectObjects.get(e):e;if(!(!r||r===_e&&!n)){for(let i=0,s=t.length;i<s;i++){const o=t[i];if(o===_e){if(r===_e)return r}else if(r instanceof o)return r}throw new Cr(t,r)}}lookup(e,...t){const n=e instanceof se?this.indirectObjects.get(e):e;if(t.length===0)return n;for(let r=0,i=t.length;r<i;r++){const s=t[r];if(s===_e){if(n===_e)return n}else if(n instanceof s)return n}throw new Cr(t,n)}getObjectRef(e){const t=Array.from(this.indirectObjects.entries());for(let n=0,r=t.length;n<r;n++){const[i,s]=t[n];if(s===e)return i}}enumerateIndirectObjects(){return Array.from(this.indirectObjects.entries()).sort(ef)}obj(e){if(e instanceof
|
|
8
|
+
endstream`,t}copyBytesInto(t,n){this.updateDict();const r=n;n+=this.dict.copyBytesInto(t,n),t[n++]=b.Newline,t[n++]=b.s,t[n++]=b.t,t[n++]=b.r,t[n++]=b.e,t[n++]=b.a,t[n++]=b.m,t[n++]=b.Newline;const i=this.getContents();for(let s=0,o=i.length;s<o;s++)t[n++]=i[s];return t[n++]=b.Newline,t[n++]=b.e,t[n++]=b.n,t[n++]=b.d,t[n++]=b.s,t[n++]=b.t,t[n++]=b.r,t[n++]=b.e,t[n++]=b.a,t[n++]=b.m,n-r}}const di=class extends st{constructor(e,t){super(e),p(this,"contents"),this.contents=t}asUint8Array(){return this.contents.slice()}clone(e){return di.of(this.dict.clone(e),this.contents.slice())}getContentsString(){return ps(this.contents)}getContents(){return this.contents}getContentsSize(){return this.contents.length}};let It=di;p(It,"of",(e,t)=>new di(e,t));const na={},ra=new Map,ia=class extends pe{constructor(e,t,n){if(e!==na)throw new Ar("PDFRef");super(),p(this,"objectNumber"),p(this,"generationNumber"),p(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+=fe(this.tag,e,t),this.tag.length}};let se=ia;p(se,"of",(e,t=0)=>{const n=`${e} ${t} R`;let r=ra.get(n);return r||(r=new ia(na,e,t),ra.set(n,r)),r});const fi=class{constructor(e,t){p(this,"name"),p(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 pe?i.clone(e):i}return fi.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 pe?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 s=this.args[r];s instanceof pe?t+=s.copyBytesInto(e,t):t+=fe(s,e,t),e[t++]=b.Space}return t+=fe(this.name,e,t),t-n}};let ne=fi;p(ne,"of",(e,t)=>new fi(e,t));var re=(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))(re||{});class ui extends st{constructor(t,n){super(t),p(this,"contentsCache"),p(this,"encode"),p(this,"computeContents",()=>{const r=this.getUnencodedContents();return this.encode?ci.deflate(r):r}),this.encode=n,n&&t.set(m.of("Filter"),m.of("FlateDecode")),this.contentsCache=vt.populatedBy(this.computeContents)}getContents(){return this.contentsCache.access()}getContentsSize(){return this.contentsCache.access().length}getUnencodedContents(){throw new Oe(this.constructor.name,"getUnencodedContents")}}const gi=class extends ui{constructor(e,t,n=!0){super(e,n),p(this,"operators"),this.operators=t}push(...e){this.operators.push(...e)}clone(e){const t=new Array(this.operators.length);for(let i=0,s=this.operators.length;i<s;i++)t[i]=this.operators[i].clone(e);const{dict:n,encode:r}=this;return gi.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++]=b.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 Ot=gi;p(Ot,"of",(e,t,n=!0)=>new gi(e,t,n));const sa=class{constructor(e){p(this,"seed"),this.seed=e}nextInt(){const e=Math.sin(this.seed++)*1e4;return e-Math.floor(e)}};let oa=sa;p(oa,"withSeed",e=>new sa(e));const ef=([e],[t])=>e.objectNumber-t.objectNumber,aa=class{constructor(){p(this,"largestObjectNumber"),p(this,"header"),p(this,"trailerInfo"),p(this,"rng"),p(this,"indirectObjects"),p(this,"pushGraphicsStateContentStreamRef"),p(this,"popGraphicsStateContentStreamRef"),this.largestObjectNumber=0,this.header=gn.forVersion(1,7),this.trailerInfo={},this.indirectObjects=new Map,this.rng=oa.withSeed(1)}assign(e,t){this.indirectObjects.set(e,t),e.objectNumber>this.largestObjectNumber&&(this.largestObjectNumber=e.objectNumber)}nextRef(){return this.largestObjectNumber+=1,se.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(_e),r=e instanceof se?this.indirectObjects.get(e):e;if(!(!r||r===_e&&!n)){for(let i=0,s=t.length;i<s;i++){const o=t[i];if(o===_e){if(r===_e)return r}else if(r instanceof o)return r}throw new Cr(t,r)}}lookup(e,...t){const n=e instanceof se?this.indirectObjects.get(e):e;if(t.length===0)return n;for(let r=0,i=t.length;r<i;r++){const s=t[r];if(s===_e){if(n===_e)return n}else if(n instanceof s)return n}throw new Cr(t,n)}getObjectRef(e){const t=Array.from(this.indirectObjects.entries());for(let n=0,r=t.length;n<r;n++){const[i,s]=t[n];if(s===e)return i}}enumerateIndirectObjects(){return Array.from(this.indirectObjects.entries()).sort(ef)}obj(e){if(e instanceof pe)return e;if(e==null)return _e;if(typeof e=="string")return m.of(e);if(typeof e=="number")return U.of(e);if(typeof e=="boolean")return e?mt.True:mt.False;if(Array.isArray(e)){const t=J.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 s=n[r],o=e[s];o!==void 0&&t.set(m.of(s),this.obj(o))}return t}}stream(e,t={}){return It.of(this.obj(t),kr(e))}flateStream(e,t={}){return this.stream(ci.deflate(kr(e)),{...t,Filter:"FlateDecode"})}contentStream(e,t={}){return Ot.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=ne.of(re.PushGraphicsState),n=Ot.of(e,[t]);return this.pushGraphicsStateContentStreamRef=this.register(n),this.pushGraphicsStateContentStreamRef}getPopGraphicsStateContentStream(){if(this.popGraphicsStateContentStreamRef)return this.popGraphicsStateContentStreamRef;const e=this.obj({}),t=ne.of(re.PopGraphicsState),n=Ot.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 pi=aa;p(pi,"create",()=>new aa);const bi=class{constructor(e){p(this,"subsections"),p(this,"chunkIdx"),p(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
|
-
`;for(let i=0,s=r.length;i<s;i++){const o=r[i];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,[s]=r;e+=2,e+=String(s.ref.objectNumber).length,e+=String(i).length,e+=20*i}return e}copyBytesInto(e,t){const n=t;return e[t++]=b.x,e[t++]=b.r,e[t++]=b.e,e[t++]=b.f,e[t++]=b.Newline,t+=this.copySubsectionsIntoBuffer(this.subsections,e,t),t-n}copySubsectionsIntoBuffer(e,t,n){const r=n,i=e.length;for(let s=0;s<i;s++){const o=this.subsections[s],c=String(o[0].ref.objectNumber);n+=
|
|
11
|
+
`;for(let i=0,s=r.length;i<s;i++){const o=r[i];e+=Pe(String(o.offset),10,"0"),e+=" ",e+=Pe(String(o.ref.generationNumber),5,"0"),e+=" ",e+=o.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,[s]=r;e+=2,e+=String(s.ref.objectNumber).length,e+=String(i).length,e+=20*i}return e}copyBytesInto(e,t){const n=t;return e[t++]=b.x,e[t++]=b.r,e[t++]=b.e,e[t++]=b.f,e[t++]=b.Newline,t+=this.copySubsectionsIntoBuffer(this.subsections,e,t),t-n}copySubsectionsIntoBuffer(e,t,n){const r=n,i=e.length;for(let s=0;s<i;s++){const o=this.subsections[s],c=String(o[0].ref.objectNumber);n+=fe(c,t,n),t[n++]=b.Space;const l=String(o.length);n+=fe(l,t,n),t[n++]=b.Newline,n+=this.copyEntriesIntoBuffer(o,t,n)}return n-r}copyEntriesIntoBuffer(e,t,n){const r=e.length;for(let i=0;i<r;i++){const s=e[i],o=Pe(String(s.offset),10,"0");n+=fe(o,t,n),t[n++]=b.Space;const c=Pe(String(s.ref.generationNumber),5,"0");n+=fe(c,t,n),t[n++]=b.Space,t[n++]=s.deleted?b.f:b.n,t[n++]=b.Space,t[n++]=b.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 Xn=bi;p(Xn,"create",()=>new bi({ref:se.of(0,65535),offset:0,deleted:!0})),p(Xn,"createEmpty",()=>new bi);const ca=class{constructor(e){p(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++]=b.s,e[t++]=b.t,e[t++]=b.a,e[t++]=b.r,e[t++]=b.t,e[t++]=b.x,e[t++]=b.r,e[t++]=b.e,e[t++]=b.f,e[t++]=b.Newline,t+=
|
|
14
|
+
%%EOF`}sizeInBytes(){return 16+this.lastXRefOffset.length}copyBytesInto(e,t){const n=t;return e[t++]=b.s,e[t++]=b.t,e[t++]=b.a,e[t++]=b.r,e[t++]=b.t,e[t++]=b.x,e[t++]=b.r,e[t++]=b.e,e[t++]=b.f,e[t++]=b.Newline,t+=fe(this.lastXRefOffset,e,t),e[t++]=b.Newline,e[t++]=b.Percent,e[t++]=b.Percent,e[t++]=b.E,e[t++]=b.O,e[t++]=b.F,t-n}};let Yn=ca;p(Yn,"forLastCrossRefSectionOffset",e=>new ca(e));const la=class{constructor(e){p(this,"dict"),this.dict=e}toString(){return`trailer
|
|
15
15
|
${this.dict.toString()}`}sizeInBytes(){return 8+this.dict.sizeInBytes()}copyBytesInto(e,t){const n=t;return e[t++]=b.t,e[t++]=b.r,e[t++]=b.a,e[t++]=b.i,e[t++]=b.l,e[t++]=b.e,e[t++]=b.r,e[t++]=b.Newline,t+=this.dict.copyBytesInto(e,t),t-n}};let ha=la;p(ha,"of",e=>new la(e));const mi=class extends ui{constructor(e,t,n=!0){super(e.obj({}),n),p(this,"objects"),p(this,"offsets"),p(this,"offsetsString"),this.objects=t,this.offsets=this.computeObjectOffsets(),this.offsetsString=this.computeOffsetsString(),this.dict.set(m.of("Type"),m.of("ObjStm")),this.dict.set(m.of("N"),U.of(this.objects.length)),this.dict.set(m.of("First"),U.of(this.offsetsString.length))}getObjectsCount(){return this.objects.length}clone(e){return mi.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=de(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++]=b.Newline}return e}getUnencodedContentsSize(){return this.offsetsString.length+Dn(this.offsets)[1]+Dn(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,s]=this.objects[n];t[n]=[i.objectNumber,e],e+=s.sizeInBytes()+1}return t}};let _i=mi;p(_i,"withContextAndObjects",(e,t,n=!0)=>new mi(e,t,n));const da=class{constructor(e,t){p(this,"context"),p(this,"objectsPerTick"),p(this,"parsedObjects",0),p(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:s}=await this.computeBufferSize();let o=0;const c=new Uint8Array(e);o+=t.copyBytesInto(c,o),c[o++]=b.Newline,c[o++]=b.Newline;for(let l=0,a=n.length;l<a;l++){const[h,g]=n[l],f=String(h.objectNumber);o+=de(f,c,o),c[o++]=b.Space;const d=String(h.generationNumber);o+=de(d,c,o),c[o++]=b.Space,c[o++]=b.o,c[o++]=b.b,c[o++]=b.j,c[o++]=b.Newline,o+=g.copyBytesInto(c,o),c[o++]=b.Newline,c[o++]=b.e,c[o++]=b.n,c[o++]=b.d,c[o++]=b.o,c[o++]=b.b,c[o++]=b.j,c[o++]=b.Newline,c[o++]=b.Newline;const _=g instanceof _i?g.getObjectsCount():1;this.shouldWaitForTick(_)&&await St()}return r&&(o+=r.copyBytesInto(c,o),c[o++]=b.Newline),i&&(o+=i.copyBytesInto(c,o),c[o++]=b.Newline,c[o++]=b.Newline),o+=s.copyBytesInto(c,o),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=gn.forVersion(1,7);let t=e.sizeInBytes()+2;const n=Xn.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 St()}const i=t;t+=n.sizeInBytes()+1;const s=ha.of(this.createTrailerDict());t+=s.sizeInBytes()+2;const o=Yn.forLastCrossRefSectionOffset(i);return t+=o.sizeInBytes(),{size:t,header:e,indirectObjects:r,xref:n,trailerDict:s,trailer:o}}};let yi=da;p(yi,"forContext",(e,t)=>new da(e,t));class Jn{constructor(t,n,r){p(this,"bytes"),p(this,"start"),p(this,"pos"),p(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,s=this.end;if(t){let o=i+t;o>s&&(o=s),this.pos=o;const c=r.subarray(i,o);return n?new Uint8ClampedArray(c):c}else{const o=r.subarray(i,s);return n?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=this.start}moveStart(){this.start=this.pos}makeSubStream(t,n){return new Jn(this.bytes,t,n)}decode(){return this.bytes}}const tf=new Uint8Array(0);class pn{constructor(t){if(p(this,"bufferLength"),p(this,"buffer"),p(this,"eof"),p(this,"pos"),p(this,"minBufferLength"),this.pos=0,this.bufferLength=0,this.eof=!1,this.buffer=tf,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 o=this.bufferLength;r>o&&(r=o)}else{for(;!this.eof;)this.readBlock();r=this.bufferLength}this.pos=r;const s=this.buffer.subarray(i,r);return n&&!(s instanceof Uint8ClampedArray)?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=0}makeSubStream(t,n){const r=t+n;for(;this.bufferLength<=r&&!this.eof;)this.readBlock();return new Jn(this.buffer,t,n)}decode(){for(;!this.eof;)this.readBlock();return this.buffer.subarray(0,this.bufferLength)}readBlock(){throw new Oe(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 fa=e=>e===32||e===9||e===13||e===10;class nf extends pn{constructor(t,n){super(n),p(this,"stream"),p(this,"input"),this.stream=t,this.input=new Uint8Array(5),n&&(n=.8*n)}readBlock(){const i=this.stream;let s=i.getByte();for(;fa(s);)s=i.getByte();if(s===-1||s===126){this.eof=!0;return}const o=this.bufferLength;let c,l;if(s===122){for(c=this.ensureBuffer(o+4),l=0;l<4;++l)c[o+l]=0;this.bufferLength+=4}else{const a=this.input;for(a[0]=s,l=1;l<5;++l){for(s=i.getByte();fa(s);)s=i.getByte();if(a[l]=s,s===-1||s===126)break}if(c=this.ensureBuffer(o+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[o+l]=h&255,h>>=8}}}class rf extends pn{constructor(t,n){super(n),p(this,"stream"),p(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 s=this.bufferLength,o=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;o<0?o=h:(i[s++]=o<<4|h,o=-1)}o>=0&&this.eof&&(i[s++]=o<<4,o=-1),this.firstDigit=o,this.bufferLength=s}}const ua=new Int32Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),sf=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]),of=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]),af=[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],cf=[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 lf extends pn{constructor(t,n){super(n),p(this,"stream"),p(this,"codeSize"),p(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 g=a;if((a=r.getByte())===-1)throw new Error("Bad block header in flate stream");if(g|=a<<8,g!==(~h&65535)&&(h!==0||g!==0))throw new Error("Bad uncompressed block length in flate stream");this.codeBuf=0,this.codeSize=0;const f=this.bufferLength;t=this.ensureBuffer(f+h);const d=f+h;if(this.bufferLength=d,h===0)r.peekByte()===-1&&(this.eof=!0);else for(let _=f;_<d;++_){if((a=r.getByte())===-1){this.eof=!0;break}t[_]=a}return}let s,o;if(i===1)s=af,o=cf;else if(i===2){const a=this.getBits(5)+257,h=this.getBits(5)+1,g=this.getBits(4)+4,f=new Uint8Array(ua.length);let d;for(d=0;d<g;++d)f[ua[d]]=this.getBits(3);const _=this.generateHuffmanTable(f);n=0,d=0;const w=a+h,x=new Uint8Array(w);let y,P,v;for(;d<w;){const S=this.getCode(_);if(S===16)y=2,P=3,v=n;else if(S===17)y=3,P=3,v=n=0;else if(S===18)y=7,P=11,v=n=0;else{x[d++]=n=S;continue}let I=this.getBits(y)+P;for(;I-- >0;)x[d++]=v}s=this.generateHuffmanTable(x.subarray(0,a)),o=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(s);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=sf[a];let h=a>>16;h>0&&(h=this.getBits(h)),n=(a&65535)+h,a=this.getCode(o),a=of[a],h=a>>16,h>0&&(h=this.getBits(h));const g=(a&65535)+h;l+n>=c&&(t=this.ensureBuffer(l+n),c=t.length);for(let f=0;f<n;++f,++l)t[l]=t[l-g]}}getBits(t){const n=this.stream;let r=this.codeSize,i=this.codeBuf,s;for(;r<t;){if((s=n.getByte())===-1)throw new Error("Bad encoding in flate stream");i|=s<<r,r+=8}return s=i&(1<<t)-1,this.codeBuf=i>>t,this.codeSize=r-=t,s}getCode(t){const n=this.stream,r=t[0],i=t[1];let s=this.codeSize,o=this.codeBuf,c;for(;s<i&&(c=n.getByte())!==-1;)o|=c<<s,s+=8;const l=r[o&(1<<i)-1];typeof r=="number"&&console.log("FLATE:",l);const a=l>>16,h=l&65535;if(a<1||s<a)throw new Error("Bad encoding in flate stream");return this.codeBuf=o>>a,this.codeSize=s-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 s=1<<r,o=new Int32Array(s);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 g=0,f=l;for(i=0;i<c;++i)g=g<<1|f&1,f>>=1;for(i=g;i<s;i+=a)o[i]=c<<16|h;++l}return[o,r]}}class hf extends pn{constructor(t,n,r){super(n),p(this,"stream"),p(this,"cachedData"),p(this,"bitsCached"),p(this,"lzwState"),this.stream=t,this.cachedData=0,this.bitsCached=0;const i=4096,s={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 o=0;o<256;++o)s.dictionaryValues[o]=o,s.dictionaryLengths[o]=1;this.lzwState=s}readBlock(){let n=1024;const r=512;let i,s,o;const c=this.lzwState;if(!c)return;const l=c.earlyChange;let a=c.nextCode;const h=c.dictionaryValues,g=c.dictionaryLengths,f=c.dictionaryPrevCodes;let d=c.codeLength,_=c.prevCode;const w=c.currentSequence;let x=c.currentSequenceLength,y=0,P=this.bufferLength,v=this.ensureBuffer(this.bufferLength+n);for(i=0;i<512;i++){const S=this.readBits(d),I=x>0;if(!S||S<256)w[0]=S,x=1;else if(S>=258)if(S<a)for(x=g[S],s=x-1,o=S;s>=0;s--)w[s]=h[o],o=f[o];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(I&&(f[a]=_,g[a]=g[_]+1,h[a]=w[0],a++,d=a+l&a+l-1?d:Math.min(Math.log(a+l)/.6931471805599453+1,12)|0),_=S,y+=x,n<y){do n+=r;while(n<y);v=this.ensureBuffer(this.bufferLength+n)}for(s=0;s<x;s++)v[P++]=w[s]}c.nextCode=a,c.codeLength=d,c.prevCode=_,c.currentSequenceLength=x,this.bufferLength=P}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 df extends pn{constructor(t,n){super(n),p(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 s=this.stream.getBytes(i);n.set(s,r),r+=i}}else{i=257-i;const s=t[1];n=this.ensureBuffer(r+i+1);for(let o=0;o<i;o++)n[r++]=s}this.bufferLength=r}}const ga=(e,t,n)=>{if(t===m.of("FlateDecode"))return new lf(e);if(t===m.of("LZWDecode")){let r=1;if(n instanceof V){const i=n.lookup(m.of("EarlyChange"));i instanceof U&&(r=i.asNumber())}return new hf(e,void 0,r)}if(t===m.of("ASCII85Decode"))return new nf(e);if(t===m.of("ASCIIHexDecode"))return new rf(e);if(t===m.of("RunLengthDecode"))return new df(e);throw new Gc(t.asString())},pa=({dict:e,contents:t})=>{let n=new Jn(t);const r=e.lookup(m.of("Filter")),i=e.lookup(m.of("DecodeParms"));if(r instanceof m)n=ga(n,r,i);else if(r instanceof J)for(let s=0,o=r.size();s<o;s++)n=ga(n,r.lookup(s,m),i&&i.lookupMaybe(s,V));else if(r)throw new Cr([m,J],r);return n},ff=e=>{const t=e.MediaBox(),n=t.lookup(2,U).asNumber()-t.lookup(0,U).asNumber(),r=t.lookup(3,U).asNumber()-t.lookup(1,U).asNumber();return{left:0,bottom:0,right:n,top:r}},uf=e=>[1,0,0,1,-e.left,-e.bottom];class wi{constructor(t,n,r){p(this,"width"),p(this,"height"),p(this,"boundingBox"),p(this,"transformationMatrix"),p(this,"page"),this.page=t;const i=n??ff(t);this.width=i.right-i.left,this.height=i.top-i.bottom,this.boundingBox=i,this.transformationMatrix=r??uf(i)}static async for(t,n,r){return new wi(t,n,r)}async embedIntoContext(t,n){const{Contents:r,Resources:i}=this.page.normalizedEntries();if(!r)throw new Vc;const s=this.decodeContents(r),{left:o,bottom:c,right:l,top:a}=this.boundingBox,h=t.flateStream(s,{Type:"XObject",Subtype:"Form",FormType:1,BBox:[o,c,l,a],Matrix:this.transformationMatrix,Resources:i});return n?(t.assign(n,h),n):t.register(h)}decodeContents(t){const n=Uint8Array.of(b.Newline),r=[];for(let i=0,s=t.size();i<s;i++){const o=t.lookup(i,st);let c;if(o instanceof It)c=pa(o).decode();else if(o instanceof Ot)c=o.getUnencodedContents();else throw new Kc(o);r.push(c,n)}return Ec(...r)}}const xi=class extends ge{constructor(e){super(),p(this,"data"),this.data=e}clone(){return xi.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 Si=xi;p(Si,"of",e=>new xi(e));const Qn=class extends ui{constructor(e,t,n=!0){super(e,n),p(this,"entries"),p(this,"entryTuplesCache"),p(this,"maxByteWidthsCache"),p(this,"indexCache"),p(this,"computeIndex",()=>{const r=[];let i=0;for(let s=0,o=this.entries.length;s<o;s++){const c=this.entries[s],l=this.entries[s-1];s===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}),p(this,"computeEntryTuples",()=>{const r=new Array(this.entries.length);for(let i=0,s=this.entries.length;i<s;i++){const o=this.entries[i];if(o.type===0){const{type:c,nextFreeObjectNumber:l,ref:a}=o;r[i]=[c,l,a.generationNumber]}if(o.type===1){const{type:c,offset:l,ref:a}=o;r[i]=[c,l,a.generationNumber]}if(o.type===2){const{type:c,objectStreamRef:l,index:a}=o;r[i]=[c,l.objectNumber,a]}}return r}),p(this,"computeMaxEntryByteWidths",()=>{const r=this.entryTuplesCache.access(),i=[0,0,0];for(let s=0,o=r.length;s<o;s++){const[c,l,a]=r[s],h=In(c),g=In(l),f=In(a);h>i[0]&&(i[0]=h),g>i[1]&&(i[1]=g),f>i[2]&&(i[2]=f)}return i}),this.entries=t||[],this.entryTuplesCache=vt.populatedBy(this.computeEntryTuples),this.maxByteWidthsCache=vt.populatedBy(this.computeMaxEntryByteWidths),this.indexCache=vt.populatedBy(this.computeIndex),e.set(m.of("Type"),m.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 Qn.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[s,o,c]=e[r],l=xt(kt(s)),a=xt(kt(o)),h=xt(kt(c));for(let g=t[0]-1;g>=0;g--)n+=(l[g]||0).toString(2);for(let g=t[1]-1;g>=0;g--)n+=(a[g]||0).toString(2);for(let g=t[2]-1;g>=0;g--)n+=(h[g]||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,s=e.length;i<s;i++){const[o,c,l]=e[i],a=xt(kt(o)),h=xt(kt(c)),g=xt(kt(l));for(let f=t[0]-1;f>=0;f--)n[r++]=a[f]||0;for(let f=t[1]-1;f>=0;f--)n[r++]=h[f]||0;for(let f=t[2]-1;f>=0;f--)n[r++]=g[f]||0}return n}getUnencodedContentsSize(){const e=this.maxByteWidthsCache.access();return Tc(e)*this.entries.length}updateDict(){super.updateDict();const e=this.maxByteWidthsCache.access(),t=this.indexCache.access(),{context:n}=this.dict;this.dict.set(m.of("W"),n.obj(e)),this.dict.set(m.of("Index"),n.obj(t))}};let vi=Qn;p(vi,"create",(e,t=!0)=>{const n=new Qn(e,[],t);return n.addDeletedEntry(se.of(0,65535),0),n}),p(vi,"of",(e,t,n=!0)=>new Qn(e,t,n));const ba=class extends yi{constructor(e,t,n,r){super(e,t),p(this,"encodeStreams"),p(this,"objectsPerStream"),this.encodeStreams=n,this.objectsPerStream=r}async computeBufferSize(){let e=this.context.largestObjectNumber+1;const t=gn.forVersion(1,7);let n=t.sizeInBytes()+2;const r=vi.create(this.createTrailerDict(),this.encodeStreams),i=[],s=[],o=[],c=this.context.enumerateIndirectObjects();for(let g=0,f=c.length;g<f;g++){const d=c[g],[_,w]=d;if(_===this.context.trailerInfo.Encrypt||w instanceof st||w instanceof Si||_.generationNumber!==0)i.push(d),r.addUncompressedEntry(_,n),n+=this.computeIndirectObjectSize(d),this.shouldWaitForTick(1)&&await St();else{let y=Dn(s),P=Dn(o);(!y||y.length%this.objectsPerStream===0)&&(y=[],s.push(y),P=se.of(e++),o.push(P)),r.addCompressedEntry(_,P,y.length),y.push(d)}}for(let g=0,f=s.length;g<f;g++){const d=s[g],_=o[g],w=_i.withContextAndObjects(this.context,d,this.encodeStreams);r.addUncompressedEntry(_,n),n+=this.computeIndirectObjectSize([_,w]),i.push([_,w]),this.shouldWaitForTick(d.length)&&await St()}const l=se.of(e++);r.dict.set(m.of("Size"),U.of(e)),r.addUncompressedEntry(l,n);const a=n;n+=this.computeIndirectObjectSize([l,r]),i.push([l,r]);const h=Yn.forLastCrossRefSectionOffset(a);return n+=h.sizeInBytes(),{size:n,header:t,indirectObjects:i,trailer:h}}};let ma=ba;p(ma,"forContext",(e,t,n=!0,r=50)=>new ba(e,t,n,r));const _a=[65472,65473,65474,65475,65477,65478,65479,65480,65481,65482,65483,65484,65485,65486,65487],gf={1:"DeviceGray",3:"DeviceRGB",4:"DeviceCMYK"};class ki{constructor(t,n,r,i,s){p(this,"bitsPerComponent"),p(this,"height"),p(this,"width"),p(this,"colorSpace"),p(this,"imageData"),this.imageData=t,this.bitsPerComponent=n,this.width=r,this.height=i,this.colorSpace=s}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,s;for(;i<n.byteLength&&(s=n.getUint16(i),i+=2,!_a.includes(s));)i+=n.getUint16(i);if(!_a.includes(s))throw new Error("Invalid JPEG");i+=2;const o=n.getUint8(i++),c=n.getUint16(i);i+=2;const l=n.getUint16(i);i+=2;const a=n.getUint8(i++),h=gf[a];if(!h)throw new Error("Unknown JPEG channel.");const g=h;return new ki(t,o,l,c,g)}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 C={};C.toRGBA8=function(e){var t=e.width,n=e.height;if(e.tabs.acTL==null)return[C.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,s=new Uint8Array(i),o=new Uint8Array(i),c=new Uint8Array(i),l=0;l<e.frames.length;l++){var a=e.frames[l],h=a.rect.x,g=a.rect.y,f=a.rect.width,d=a.rect.height,_=C.toRGBA8.decodeImage(a.data,f,d,e);if(l!=0)for(var w=0;w<i;w++)c[w]=s[w];if(a.blend==0?C._copyTile(_,f,d,s,t,n,h,g,0):a.blend==1&&C._copyTile(_,f,d,s,t,n,h,g,1),r.push(s.buffer.slice(0)),a.dispose!=0){if(a.dispose==1)C._copyTile(o,f,d,s,t,n,h,g,0);else if(a.dispose==2)for(var w=0;w<i;w++)s[w]=c[w]}}return r},C.toRGBA8.decodeImage=function(e,t,n,r){var i=t*n,s=C.decode._getBPP(r),o=Math.ceil(t*s/8),c=new Uint8Array(i*4),l=new Uint32Array(c.buffer),a=r.ctype,h=r.depth,g=C._bin.readUshort;if(a==6){var f=i<<2;if(h==8)for(var d=0;d<f;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<f;d++)c[d]=e[d<<1]}else if(a==2){var _=r.tabs.tRNS;if(_==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=_[0],y=_[1],P=_[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]==y&&e[w+2]==P&&(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],g(e,w)==x&&g(e,w+2)==y&&g(e,w+4)==P&&(c[v+3]=0)}}}else if(a==3){var S=r.tabs.PLTE,I=r.tabs.tRNS,B=I?I.length:0;if(h==1)for(var A=0;A<n;A++)for(var O=A*o,R=A*t,d=0;d<t;d++){var v=R+d<<2,T=e[O+(d>>3)]>>7-((d&7)<<0)&1,k=3*T;c[v]=S[k],c[v+1]=S[k+1],c[v+2]=S[k+2],c[v+3]=T<B?I[T]:255}if(h==2)for(var A=0;A<n;A++)for(var O=A*o,R=A*t,d=0;d<t;d++){var v=R+d<<2,T=e[O+(d>>2)]>>6-((d&3)<<1)&3,k=3*T;c[v]=S[k],c[v+1]=S[k+1],c[v+2]=S[k+2],c[v+3]=T<B?I[T]:255}if(h==4)for(var A=0;A<n;A++)for(var O=A*o,R=A*t,d=0;d<t;d++){var v=R+d<<2,T=e[O+(d>>1)]>>4-((d&1)<<2)&15,k=3*T;c[v]=S[k],c[v+1]=S[k+1],c[v+2]=S[k+2],c[v+3]=T<B?I[T]:255}if(h==8)for(var d=0;d<i;d++){var v=d<<2,T=e[d],k=3*T;c[v]=S[k],c[v+1]=S[k+1],c[v+2]=S[k+2],c[v+3]=T<B?I[T]:255}}else if(a==4){if(h==8)for(var d=0;d<i;d++){var v=d<<2,F=d<<1,D=e[F];c[v]=D,c[v+1]=D,c[v+2]=D,c[v+3]=e[F+1]}if(h==16)for(var d=0;d<i;d++){var v=d<<2,F=d<<2,D=e[F];c[v]=D,c[v+1]=D,c[v+2]=D,c[v+3]=e[F+2]}}else if(a==0)for(var x=r.tabs.tRNS?r.tabs.tRNS:-1,A=0;A<n;A++){var W=A*o,j=A*t;if(h==1)for(var z=0;z<t;z++){var D=255*(e[W+(z>>>3)]>>>7-(z&7)&1),Y=D==x*255?0:255;l[j+z]=Y<<24|D<<16|D<<8|D}else if(h==2)for(var z=0;z<t;z++){var D=85*(e[W+(z>>>2)]>>>6-((z&3)<<1)&3),Y=D==x*85?0:255;l[j+z]=Y<<24|D<<16|D<<8|D}else if(h==4)for(var z=0;z<t;z++){var D=17*(e[W+(z>>>1)]>>>4-((z&1)<<2)&15),Y=D==x*17?0:255;l[j+z]=Y<<24|D<<16|D<<8|D}else if(h==8)for(var z=0;z<t;z++){var D=e[W+z],Y=D==x?0:255;l[j+z]=Y<<24|D<<16|D<<8|D}else if(h==16)for(var z=0;z<t;z++){var D=e[W+(z<<1)],Y=g(e,W+(z<<d))==x?0:255;l[j+z]=Y<<24|D<<16|D<<8|D}}return c},C.decode=function(e){for(var t=new Uint8Array(e),n=8,r=C._bin,i=r.readUshort,s=r.readUint,o={tabs:{},frames:[]},c=new Uint8Array(t.length),l=0,a,h=0,g=[137,80,78,71,13,10,26,10],f=0;f<8;f++)if(t[f]!=g[f])throw"The input is not a PNG file!";for(;n<t.length;){var d=r.readUint(t,n);n+=4;var _=r.readASCII(t,n,4);if(n+=4,_=="IHDR")C.decode._IHDR(t,n,o);else if(_=="IDAT"){for(var f=0;f<d;f++)c[l+f]=t[n+f];l+=d}else if(_=="acTL")o.tabs[_]={num_frames:s(t,n),num_plays:s(t,n+4)},a=new Uint8Array(t.length);else if(_=="fcTL"){if(h!=0){var w=o.frames[o.frames.length-1];w.data=C.decode._decompress(o,a.slice(0,h),w.rect.width,w.rect.height),h=0}var x={x:s(t,n+12),y:s(t,n+16),width:s(t,n+4),height:s(t,n+8)},y=i(t,n+22);y=i(t,n+20)/(y==0?100:y);var P={rect:x,delay:Math.round(y*1e3),dispose:t[n+24],blend:t[n+25]};o.frames.push(P)}else if(_=="fdAT"){for(var f=0;f<d-4;f++)a[h+f]=t[n+f+4];h+=d-4}else if(_=="pHYs")o.tabs[_]=[r.readUint(t,n),r.readUint(t,n+4),t[n+8]];else if(_=="cHRM"){o.tabs[_]=[];for(var f=0;f<8;f++)o.tabs[_].push(r.readUint(t,n+f*4))}else if(_=="tEXt"){o.tabs[_]==null&&(o.tabs[_]={});var v=r.nextZero(t,n),S=r.readASCII(t,n,v-n),I=r.readASCII(t,v+1,n+d-v-1);o.tabs[_][S]=I}else if(_=="iTXt"){o.tabs[_]==null&&(o.tabs[_]={});var v=0,B=n;v=r.nextZero(t,B);var S=r.readASCII(t,B,v-B);B=v+1,t[B],t[B+1],B+=2,v=r.nextZero(t,B),r.readASCII(t,B,v-B),B=v+1,v=r.nextZero(t,B),r.readUTF8(t,B,v-B),B=v+1;var I=r.readUTF8(t,B,d-(B-n));o.tabs[_][S]=I}else if(_=="PLTE")o.tabs[_]=r.readBytes(t,n,d);else if(_=="hIST"){var A=o.tabs.PLTE.length/3;o.tabs[_]=[];for(var f=0;f<A;f++)o.tabs[_].push(i(t,n+f*2))}else if(_=="tRNS")o.ctype==3?o.tabs[_]=r.readBytes(t,n,d):o.ctype==0?o.tabs[_]=i(t,n):o.ctype==2&&(o.tabs[_]=[i(t,n),i(t,n+2),i(t,n+4)]);else if(_=="gAMA")o.tabs[_]=r.readUint(t,n)/1e5;else if(_=="sRGB")o.tabs[_]=t[n];else if(_=="bKGD")o.ctype==0||o.ctype==4?o.tabs[_]=[i(t,n)]:o.ctype==2||o.ctype==6?o.tabs[_]=[i(t,n),i(t,n+2),i(t,n+4)]:o.ctype==3&&(o.tabs[_]=t[n]);else if(_=="IEND")break;n+=d,r.readUint(t,n),n+=4}if(h!=0){var w=o.frames[o.frames.length-1];w.data=C.decode._decompress(o,a.slice(0,h),w.rect.width,w.rect.height),h=0}return o.data=C.decode._decompress(o,c,o.width,o.height),delete o.compress,delete o.interlace,delete o.filter,o},C.decode._decompress=function(e,t,n,r){var i=C.decode._getBPP(e),s=Math.ceil(n*i/8),o=new Uint8Array((s+1+e.interlace)*r);return t=C.decode._inflate(t,o),e.interlace==0?t=C.decode._filterZero(t,e,0,n,r):e.interlace==1&&(t=C.decode._readInterlace(t,e)),t},C.decode._inflate=function(e,t){var n=C.inflateRaw(new Uint8Array(e.buffer,2,e.length-6),t);return n},C.inflateRaw=function(){var e={};return e.H={},e.H.N=function(t,n){var r=Uint8Array,i=0,s=0,o=0,c=0,l=0,a=0,h=0,g=0,f=0,d,_;if(t[0]==3&&t[1]==0)return n||new r(0);var w=e.H,x=w.b,y=w.e,P=w.R,v=w.n,S=w.A,I=w.Z,B=w.m,A=n==null;for(A&&(n=new r(t.length>>>2<<3));i==0;){if(i=x(t,f,1),s=x(t,f+1,2),f+=3,s==0){(f&7)!=0&&(f+=8-(f&7));var O=(f>>>3)+4,R=t[O-4]|t[O-3]<<8;A&&(n=e.H.W(n,g+R)),n.set(new r(t.buffer,t.byteOffset+O,R),g),f=O+R<<3,g+=R;continue}if(A&&(n=e.H.W(n,g+(1<<17))),s==1&&(d=B.J,_=B.h,a=(1<<9)-1,h=(1<<5)-1),s==2){o=y(t,f,5)+257,c=y(t,f+5,5)+1,l=y(t,f+10,4)+4,f+=14;for(var T=1,k=0;k<38;k+=2)B.Q[k]=0,B.Q[k+1]=0;for(var k=0;k<l;k++){var F=y(t,f+k*3,3);B.Q[(B.X[k]<<1)+1]=F,F>T&&(T=F)}f+=3*l,v(B.Q,T),S(B.Q,T,B.u),d=B.w,_=B.d,f=P(B.u,(1<<T)-1,o+c,t,f,B.v);var D=w.V(B.v,0,o,B.C);a=(1<<D)-1;var W=w.V(B.v,o,c,B.D);h=(1<<W)-1,v(B.C,D),S(B.C,D,d),v(B.D,W),S(B.D,W,_)}for(;;){var j=d[I(t,f)&a];f+=j&15;var z=j>>>4;if(z>>>8==0)n[g++]=z;else{if(z==256)break;var Y=g+z-254;if(z>264){var Ue=B.q[z-257];Y=g+(Ue>>>3)+y(t,f,Ue&7),f+=Ue&7}var $e=_[I(t,f)&h];f+=$e&15;var ct=$e>>>4,we=B.c[ct],Pe=(we>>>4)+x(t,f,we&15);for(f+=we&15;g<Y;)n[g]=n[g++-Pe],n[g]=n[g++-Pe],n[g]=n[g++-Pe],n[g]=n[g++-Pe];g=Y}}}return n.length==g?n:n.slice(0,g)},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,s,o){for(var c=e.H.e,l=e.H.Z,a=0;a<r;){var h=t[l(i,s)&n];s+=h&15;var g=h>>>4;if(g<=15)o[a]=g,a++;else{var f=0,d=0;g==16?(d=3+c(i,s,2),s+=2,f=o[a-1]):g==17?(d=3+c(i,s,3),s+=3):g==18&&(d=11+c(i,s,7),s+=7);for(var _=a+d;a<_;)o[a]=f,a++}}return s},e.H.V=function(t,n,r,i){for(var s=0,o=0,c=i.length>>>1;o<r;){var l=t[o+n];i[o<<1]=0,i[(o<<1)+1]=l,l>s&&(s=l),o++}for(;o<c;)i[o<<1]=0,i[(o<<1)+1]=0,o++;return s},e.H.n=function(t,n){for(var r=e.H.m,i=t.length,s,o,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 g=r.K;for(s=0,h[0]=0,o=1;o<=n;o++)s=s+h[o-1]<<1,g[o]=s;for(c=0;c<i;c+=2)a=t[c+1],a!=0&&(t[c]=g[a],g[a]++)},e.H.A=function(t,n,r){for(var i=t.length,s=e.H.m,o=s.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,g=n-a,f=t[c]<<g,d=f+(1<<g);f!=d;){var _=o[f]>>>15-n;r[_]=h,f++}},e.H.l=function(t,n){for(var r=e.H.m.r,i=15-n,s=0;s<t.length;s+=2){var o=t[s]<<n-t[s+1];t[s]=r[o]>>>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 s(o,c,l){for(;c--!=0;)o.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];s(t._,144,8),s(t._,255-143,9),s(t._,279-255,7),s(t._,287-279,8),e.H.n(t._,9),e.H.A(t._,9,t.J),e.H.l(t._,9),s(t.$,32,5),e.H.n(t.$,5),e.H.A(t.$,5,t.h),e.H.l(t.$,5),s(t.Q,19,0),s(t.C,286,0),s(t.D,30,0),s(t.v,320,0)}(),e.H.N}(),C.decode._readInterlace=function(e,t){for(var n=t.width,r=t.height,i=C.decode._getBPP(t),s=i>>3,o=Math.ceil(n*i/8),c=new Uint8Array(r*o),l=0,a=[0,0,4,0,2,0,1],h=[0,4,0,2,0,1,0],g=[8,8,8,4,4,2,2],f=[8,8,4,4,2,2,1],d=0;d<7;){for(var _=g[d],w=f[d],x=0,y=0,P=a[d];P<r;)P+=_,y++;for(var v=h[d];v<n;)v+=w,x++;var S=Math.ceil(x*i/8);C.decode._filterZero(e,t,l,x,y);for(var I=0,B=a[d];B<r;){for(var A=h[d],O=l+I*S<<3;A<n;){if(i==1){var R=e[O>>3];R=R>>7-(O&7)&1,c[B*o+(A>>3)]|=R<<7-((A&7)<<0)}if(i==2){var R=e[O>>3];R=R>>6-(O&7)&3,c[B*o+(A>>2)]|=R<<6-((A&3)<<1)}if(i==4){var R=e[O>>3];R=R>>4-(O&7)&15,c[B*o+(A>>1)]|=R<<4-((A&1)<<2)}if(i>=8)for(var T=B*o+A*s,k=0;k<s;k++)c[T+k]=e[(O>>3)+k];O+=i,A+=w}I++,B+=_}x*y!=0&&(l+=y*(1+S)),d=d+1}return c},C.decode._getBPP=function(e){var t=[1,null,3,1,2,null,4][e.ctype];return t*e.depth},C.decode._filterZero=function(e,t,n,r,i){var s=C.decode._getBPP(t),o=Math.ceil(r*s/8),c=C.decode._paeth;s=Math.ceil(s/8);var l=0,a=1,h=e[n],g=0;if(h>1&&(e[n]=[0,0,1][h-2]),h==3)for(g=s;g<o;g++)e[g+1]=e[g+1]+(e[g+1-s]>>>1)&255;for(var f=0;f<i;f++)if(l=n+f*o,a=l+f+1,h=e[a-1],g=0,h==0)for(;g<o;g++)e[l+g]=e[a+g];else if(h==1){for(;g<s;g++)e[l+g]=e[a+g];for(;g<o;g++)e[l+g]=e[a+g]+e[l+g-s]}else if(h==2)for(;g<o;g++)e[l+g]=e[a+g]+e[l+g-o];else if(h==3){for(;g<s;g++)e[l+g]=e[a+g]+(e[l+g-o]>>>1);for(;g<o;g++)e[l+g]=e[a+g]+(e[l+g-o]+e[l+g-s]>>>1)}else{for(;g<s;g++)e[l+g]=e[a+g]+c(0,e[l+g-o],0);for(;g<o;g++)e[l+g]=e[a+g]+c(e[l+g-s],e[l+g-o],e[l+g-s-o])}return e},C.decode._paeth=function(e,t,n){var r=e+t-n,i=r-e,s=r-t,o=r-n;return i*i<=s*s&&i*i<=o*o?e:s*s<=o*o?t:n},C.decode._IHDR=function(e,t,n){var r=C._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++},C._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,s=0;s<n;s++)r+="%"+C._bin.pad(e[t+s].toString(16));try{i=decodeURIComponent(r)}catch{return C._bin.readASCII(e,t,n)}return i}},C._copyTile=function(e,t,n,r,i,s,o,c,l){for(var a=Math.min(t,i),h=Math.min(n,s),g=0,f=0,d=0;d<h;d++)for(var _=0;_<a;_++)if(o>=0&&c>=0?(g=d*t+_<<2,f=(c+d)*i+o+_<<2):(g=(-c+d)*t-o+_<<2,f=d*i+_<<2),l==0)r[f]=e[g],r[f+1]=e[g+1],r[f+2]=e[g+2],r[f+3]=e[g+3];else if(l==1){var w=e[g+3]*.00392156862745098,x=e[g]*w,y=e[g+1]*w,P=e[g+2]*w,v=r[f+3]*(1/255),S=r[f]*v,I=r[f+1]*v,B=r[f+2]*v,A=1-w,O=w+v*A,R=O==0?0:1/O;r[f+3]=255*O,r[f+0]=(x+S*A)*R,r[f+1]=(y+I*A)*R,r[f+2]=(P+B*A)*R}else if(l==2){var w=e[g+3],x=e[g],y=e[g+1],P=e[g+2],v=r[f+3],S=r[f],I=r[f+1],B=r[f+2];w==v&&x==S&&y==I&&P==B?(r[f]=0,r[f+1]=0,r[f+2]=0,r[f+3]=0):(r[f]=x,r[f+1]=y,r[f+2]=P,r[f+3]=w)}else if(l==3){var w=e[g+3],x=e[g],y=e[g+1],P=e[g+2],v=r[f+3],S=r[f],I=r[f+1],B=r[f+2];if(w==v&&x==S&&y==I&&P==B)continue;if(w<220&&v>20)return!1}return!0},C.encode=function(e,t,n,r,i,s,o){r==null&&(r=0),o==null&&(o=!1);var c=C.encode.compress(e,t,n,r,[!1,!1,!1,0,o]);return C.encode.compressPNG(c,-1),C.encode._main(c,t,n,i,s)},C.encodeLL=function(e,t,n,r,i,s,o,c){for(var l={ctype:0+(r==1?0:2)+(i==0?0:4),depth:s,frames:[]},a=(r+i)*s,h=a*t,g=0;g<e.length;g++)l.frames.push({rect:{x:0,y:0,width:t,height:n},img:new Uint8Array(e[g]),blend:0,dispose:1,bpp:Math.ceil(a/8),bpl:Math.ceil(h/8)});C.encode.compressPNG(l,0,!0);var f=C.encode._main(l,t,n,o,c);return f},C.encode._main=function(e,t,n,r,i){i==null&&(i={});var s=C.crc.crc,o=C._bin.writeUint,c=C._bin.writeUshort,l=C._bin.writeASCII,a=8,h=e.frames.length>1,g=!1,f=8+(16+5+4)+(h?20:0);if(i.sRGB!=null&&(f+=8+1+4),i.pHYs!=null&&(f+=8+9+4),e.ctype==3){for(var d=e.plte.length,_=0;_<d;_++)e.plte[_]>>>24!=255&&(g=!0);f+=8+d*3+4+(g?8+d*1+4:0)}for(var w=0;w<e.frames.length;w++){var x=e.frames[w];h&&(f+=38),f+=x.cimg.length+12,w!=0&&(f+=4)}f+=12;for(var y=new Uint8Array(f),P=[137,80,78,71,13,10,26,10],_=0;_<8;_++)y[_]=P[_];if(o(y,a,13),a+=4,l(y,a,"IHDR"),a+=4,o(y,a,t),a+=4,o(y,a,n),a+=4,y[a]=e.depth,a++,y[a]=e.ctype,a++,y[a]=0,a++,y[a]=0,a++,y[a]=0,a++,o(y,a,s(y,a-17,17)),a+=4,i.sRGB!=null&&(o(y,a,1),a+=4,l(y,a,"sRGB"),a+=4,y[a]=i.sRGB,a++,o(y,a,s(y,a-5,5)),a+=4),i.pHYs!=null&&(o(y,a,9),a+=4,l(y,a,"pHYs"),a+=4,o(y,a,i.pHYs[0]),a+=4,o(y,a,i.pHYs[1]),a+=4,y[a]=i.pHYs[2],a++,o(y,a,s(y,a-13,13)),a+=4),h&&(o(y,a,8),a+=4,l(y,a,"acTL"),a+=4,o(y,a,e.frames.length),a+=4,o(y,a,i.loop!=null?i.loop:0),a+=4,o(y,a,s(y,a-12,12)),a+=4),e.ctype==3){var d=e.plte.length;o(y,a,d*3),a+=4,l(y,a,"PLTE"),a+=4;for(var _=0;_<d;_++){var v=_*3,S=e.plte[_],I=S&255,B=S>>>8&255,A=S>>>16&255;y[a+v+0]=I,y[a+v+1]=B,y[a+v+2]=A}if(a+=d*3,o(y,a,s(y,a-d*3-4,d*3+4)),a+=4,g){o(y,a,d),a+=4,l(y,a,"tRNS"),a+=4;for(var _=0;_<d;_++)y[a+_]=e.plte[_]>>>24&255;a+=d,o(y,a,s(y,a-d-4,d+4)),a+=4}}for(var O=0,w=0;w<e.frames.length;w++){var x=e.frames[w];h&&(o(y,a,26),a+=4,l(y,a,"fcTL"),a+=4,o(y,a,O++),a+=4,o(y,a,x.rect.width),a+=4,o(y,a,x.rect.height),a+=4,o(y,a,x.rect.x),a+=4,o(y,a,x.rect.y),a+=4,c(y,a,r[w]),a+=2,c(y,a,1e3),a+=2,y[a]=x.dispose,a++,y[a]=x.blend,a++,o(y,a,s(y,a-30,30)),a+=4);var R=x.cimg,d=R.length;o(y,a,d+(w==0?0:4)),a+=4;var T=a;l(y,a,w==0?"IDAT":"fdAT"),a+=4,w!=0&&(o(y,a,O++),a+=4),y.set(R,a),a+=d,o(y,a,s(y,T,a-T)),a+=4}return o(y,a,0),a+=4,l(y,a,"IEND"),a+=4,o(y,a,s(y,a-4,4)),a+=4,y.buffer},C.encode.compressPNG=function(e,t,n){for(var r=0;r<e.frames.length;r++){var i=e.frames[r];i.rect.width;var s=i.rect.height,o=new Uint8Array(s*i.bpl+s);i.cimg=C.encode._filterZero(i.img,s,i.bpp,i.bpl,o,t,n)}},C.encode.compress=function(e,t,n,r,i){for(var s=i[0],o=i[1],c=i[2],l=i[3],a=i[4],h=6,g=8,f=255,d=0;d<e.length;d++)for(var _=new Uint8Array(e[d]),w=_.length,x=0;x<w;x+=4)f&=_[x+3];var y=f!=255,P=C.encode.framize(e,t,n,s,o,c),v={},S=[],I=[];if(r!=0){for(var B=[],x=0;x<P.length;x++)B.push(P[x].img.buffer);for(var A=C.encode.concatRGBA(B),O=C.quantize(A,r),R=0,T=new Uint8Array(O.abuf),x=0;x<P.length;x++){var k=P[x].img,F=k.length;I.push(new Uint8Array(O.inds.buffer,R>>2,F>>2));for(var d=0;d<F;d+=4)k[d]=T[R+d],k[d+1]=T[R+d+1],k[d+2]=T[R+d+2],k[d+3]=T[R+d+3];R+=F}for(var x=0;x<O.plte.length;x++)S.push(O.plte[x].est.rgba)}else for(var d=0;d<P.length;d++){var D=P[d],W=new Uint32Array(D.img.buffer),j=D.rect.width,w=W.length,z=new Uint8Array(w);I.push(z);for(var x=0;x<w;x++){var Y=W[x];if(x!=0&&Y==W[x-1])z[x]=z[x-1];else if(x>j&&Y==W[x-j])z[x]=z[x-j];else{var Ue=v[Y];if(Ue==null&&(v[Y]=Ue=S.length,S.push(Y),S.length>=300))break;z[x]=Ue}}}var $e=S.length;$e<=256&&a==!1&&($e<=2?g=1:$e<=4?g=2:$e<=16?g=4:g=8,g=Math.max(g,l));for(var d=0;d<P.length;d++){var D=P[d];D.rect.x,D.rect.y;var j=D.rect.width,ct=D.rect.height,we=D.img;new Uint32Array(we.buffer);var Pe=4*j,ls=4;if($e<=256&&a==!1){Pe=Math.ceil(g*j/8);for(var He=new Uint8Array(Pe*ct),xr=I[d],Sr=0;Sr<ct;Sr++){var x=Sr*Pe,vr=Sr*j;if(g==8)for(var ae=0;ae<j;ae++)He[x+ae]=xr[vr+ae];else if(g==4)for(var ae=0;ae<j;ae++)He[x+(ae>>1)]|=xr[vr+ae]<<4-(ae&1)*4;else if(g==2)for(var ae=0;ae<j;ae++)He[x+(ae>>2)]|=xr[vr+ae]<<6-(ae&3)*2;else if(g==1)for(var ae=0;ae<j;ae++)He[x+(ae>>3)]|=xr[vr+ae]<<7-(ae&7)*1}we=He,h=3,ls=1}else if(y==!1&&P.length==1){for(var He=new Uint8Array(j*ct*3),Lu=j*ct,x=0;x<Lu;x++){var k=x*3,hs=x*4;He[k]=we[hs],He[k+1]=we[hs+1],He[k+2]=we[hs+2]}we=He,h=2,ls=3,Pe=3*j}D.img=we,D.bpl=Pe,D.bpp=ls}return{ctype:h,depth:g,plte:S,frames:P}},C.encode.framize=function(e,t,n,r,i,s){for(var o=[],c=0;c<e.length;c++){var l=new Uint8Array(e[c]),a=new Uint32Array(l.buffer),h,g=0,f=0,d=t,_=n,w=r?1:0;if(c!=0){for(var x=s||r||c==1||o[c-2].dispose!=0?1:2,y=0,P=1e9,v=0;v<x;v++){for(var D=new Uint8Array(e[c-1-v]),S=new Uint32Array(e[c-1-v]),I=t,B=n,A=-1,O=-1,R=0;R<n;R++)for(var T=0;T<t;T++){var k=R*t+T;a[k]!=S[k]&&(T<I&&(I=T),T>A&&(A=T),R<B&&(B=R),R>O&&(O=R))}A==-1&&(I=B=A=O=0),i&&((I&1)==1&&I--,(B&1)==1&&B--);var F=(A-I+1)*(O-B+1);F<P&&(P=F,y=v,g=I,f=B,d=A-I+1,_=O-B+1)}var D=new Uint8Array(e[c-1-y]);y==1&&(o[c-1].dispose=2),h=new Uint8Array(d*_*4),C._copyTile(D,t,n,h,d,_,-g,-f,0),w=C._copyTile(l,t,n,h,d,_,-g,-f,3)?1:0,w==1?C.encode._prepareDiff(l,t,n,h,{x:g,y:f,width:d,height:_}):C._copyTile(l,t,n,h,d,_,-g,-f,0)}else h=l.slice(0);o.push({rect:{x:g,y:f,width:d,height:_},img:h,blend:w,dispose:0})}if(r)for(var c=0;c<o.length;c++){var W=o[c];if(W.blend!=1){var j=W.rect,z=o[c-1].rect,Y=Math.min(j.x,z.x),Ue=Math.min(j.y,z.y),$e=Math.max(j.x+j.width,z.x+z.width),ct=Math.max(j.y+j.height,z.y+z.height),we={x:Y,y:Ue,width:$e-Y,height:ct-Ue};o[c-1].dispose=1,c-1!=0&&C.encode._updateFrame(e,t,n,o,c-1,we,i),C.encode._updateFrame(e,t,n,o,c,we,i)}}var Pe=0;if(e.length!=1)for(var k=0;k<o.length;k++){var W=o[k];Pe+=W.rect.width*W.rect.height}return o},C.encode._updateFrame=function(e,t,n,r,i,s,o){for(var c=Uint8Array,l=Uint32Array,a=new c(e[i-1]),h=new l(e[i-1]),g=i+1<e.length?new c(e[i+1]):null,f=new c(e[i]),d=new l(f.buffer),_=t,w=n,x=-1,y=-1,P=0;P<s.height;P++)for(var v=0;v<s.width;v++){var S=s.x+v,I=s.y+P,B=I*t+S,A=d[B];A==0||r[i-1].dispose==0&&h[B]==A&&(g==null||g[B*4+3]!=0)||(S<_&&(_=S),S>x&&(x=S),I<w&&(w=I),I>y&&(y=I))}x==-1&&(_=w=x=y=0),o&&((_&1)==1&&_--,(w&1)==1&&w--),s={x:_,y:w,width:x-_+1,height:y-w+1};var O=r[i];O.rect=s,O.blend=1,O.img=new Uint8Array(s.width*s.height*4),r[i-1].dispose==0?(C._copyTile(a,t,n,O.img,s.width,s.height,-s.x,-s.y,0),C.encode._prepareDiff(f,t,n,O.img,s)):C._copyTile(f,t,n,O.img,s.width,s.height,-s.x,-s.y,0)},C.encode._prepareDiff=function(e,t,n,r,i){C._copyTile(e,t,n,r,i.width,i.height,-i.x,-i.y,2)},C.encode._filterZero=function(e,t,n,r,i,s,o){var c=[],l=[0,1,2,3,4];s!=-1?l=[s]:(t*r>5e5||n==1)&&(l=[0]);var a;o&&(a={level:0});for(var h=o&&UZIP!=null?UZIP:ci,g=0;g<l.length;g++){for(var f=0;f<t;f++)C.encode._filterLine(i,e,f,r,n,l[g]);c.push(h.deflate(i,a))}for(var d,_=1e9,g=0;g<c.length;g++)c[g].length<_&&(d=g,_=c[g].length);return c[d]},C.encode._filterLine=function(e,t,n,r,i,s){var o=n*r,c=o+n,l=C.decode._paeth;if(e[c]=s,c++,s==0)if(r<500)for(var a=0;a<r;a++)e[c+a]=t[o+a];else e.set(new Uint8Array(t.buffer,o,r),c);else if(s==1){for(var a=0;a<i;a++)e[c+a]=t[o+a];for(var a=i;a<r;a++)e[c+a]=t[o+a]-t[o+a-i]+256&255}else if(n==0){for(var a=0;a<i;a++)e[c+a]=t[o+a];if(s==2)for(var a=i;a<r;a++)e[c+a]=t[o+a];if(s==3)for(var a=i;a<r;a++)e[c+a]=t[o+a]-(t[o+a-i]>>1)+256&255;if(s==4)for(var a=i;a<r;a++)e[c+a]=t[o+a]-l(t[o+a-i],0,0)+256&255}else{if(s==2)for(var a=0;a<r;a++)e[c+a]=t[o+a]+256-t[o+a-r]&255;if(s==3){for(var a=0;a<i;a++)e[c+a]=t[o+a]+256-(t[o+a-r]>>1)&255;for(var a=i;a<r;a++)e[c+a]=t[o+a]+256-(t[o+a-r]+t[o+a-i]>>1)&255}if(s==4){for(var a=0;a<i;a++)e[c+a]=t[o+a]+256-l(0,t[o+a-r],0)&255;for(var a=i;a<r;a++)e[c+a]=t[o+a]+256-l(t[o+a-i],t[o+a-r],t[o+a-i-r])&255}}},C.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=C.crc.table[(e^t[n+i])&255]^e>>>8;return e},crc:function(e,t,n){return C.crc.update(4294967295,e,t,n)^4294967295}},C.quantize=function(e,t){var n=new Uint8Array(e),r=n.slice(0),i=new Uint32Array(r.buffer),s=C.quantize.getKDtree(r,t),o=s[0],c=s[1];C.quantize.planeDst;for(var l=n,a=i,h=l.length,g=new Uint8Array(n.length>>2),f=0;f<h;f+=4){var d=l[f]*.00392156862745098,_=l[f+1]*(1/255),w=l[f+2]*(1/255),x=l[f+3]*(1/255),y=C.quantize.getNearest(o,d,_,w,x);g[f>>2]=y.ind,a[f>>2]=y.est.rgba}return{abuf:r.buffer,inds:g,plte:c}},C.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=C.quantize.stats(e,i.i0,i.i1),i.est=C.quantize.estats(i.bst);for(var s=[i];s.length<t;){for(var o=0,c=0,l=0;l<s.length;l++)s[l].est.L>o&&(o=s[l].est.L,c=l);if(o<n)break;var a=s[c],h=C.quantize.splitPixels(e,r,a.i0,a.i1,a.est.e,a.est.eMq255),g=a.i0>=h||a.i1<=h;if(g){a.est.L=0;continue}var f={i0:a.i0,i1:h,bst:null,est:null,tdst:0,left:null,right:null};f.bst=C.quantize.stats(e,f.i0,f.i1),f.est=C.quantize.estats(f.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-f.bst.N};for(var l=0;l<16;l++)d.bst.R[l]=a.bst.R[l]-f.bst.R[l];for(var l=0;l<4;l++)d.bst.m[l]=a.bst.m[l]-f.bst.m[l];d.est=C.quantize.estats(d.bst),a.left=f,a.right=d,s[c]=f,s.push(d)}s.sort(function(_,w){return w.bst.N-_.bst.N});for(var l=0;l<s.length;l++)s[l].ind=l;return[i,s]},C.quantize.getNearest=function(e,t,n,r,i){if(e.left==null)return e.tdst=C.quantize.dist(e.est.q,t,n,r,i),e;var s=C.quantize.planeDst(e.est,t,n,r,i),o=e.left,c=e.right;s>0&&(o=e.right,c=e.left);var l=C.quantize.getNearest(o,t,n,r,i);if(l.tdst<=s*s)return l;var a=C.quantize.getNearest(c,t,n,r,i);return a.tdst<l.tdst?a:l},C.quantize.planeDst=function(e,t,n,r,i){var s=e.e;return s[0]*t+s[1]*n+s[2]*r+s[3]*i-e.eMq},C.quantize.dist=function(e,t,n,r,i){var s=t-e[0],o=n-e[1],c=r-e[2],l=i-e[3];return s*s+o*o+c*c+l*l},C.quantize.splitPixels=function(e,t,n,r,i,s){var o=C.quantize.vecDot;for(r-=4;n<r;){for(;o(e,n,i)<=s;)n+=4;for(;o(e,r,i)>s;)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(;o(e,n,i)>s;)n-=4;return n+4},C.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]},C.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],s=n-t>>2,o=t;o<n;o+=4){var c=e[o]*.00392156862745098,l=e[o+1]*(1/255),a=e[o+2]*(1/255),h=e[o+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:s}},C.quantize.estats=function(e){var t=e.R,n=e.m,r=e.N,i=n[0],s=n[1],o=n[2],c=n[3],l=r==0?0:1/r,a=[t[0]-i*i*l,t[1]-i*s*l,t[2]-i*o*l,t[3]-i*c*l,t[4]-s*i*l,t[5]-s*s*l,t[6]-s*o*l,t[7]-s*c*l,t[8]-o*i*l,t[9]-o*s*l,t[10]-o*o*l,t[11]-o*c*l,t[12]-c*i*l,t[13]-c*s*l,t[14]-c*o*l,t[15]-c*c*l],h=a,g=C.M4,f=[.5,.5,.5,.5],d=0,_=0;if(r!=0)for(var w=0;w<10&&(f=g.multVec(h,f),_=Math.sqrt(g.dot(f,f)),f=g.sml(1/_,f),!(Math.abs(_-d)<1e-9));w++)d=_;var x=[i*l,s*l,o*l,c*l],y=g.dot(g.sml(255,x),f);return{Cov:a,q:x,e:f,L:d,eMq255:y,eMq:g.dot(f,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}},C.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]]}},C.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 s=new Uint8Array(e[n]),o=s.length,c=0;c<o;c+=4){var l=s[c],a=s[c+1],h=s[c+2],g=s[c+3];g==0&&(l=a=h=0),r[i+c]=l,r[i+c+1]=a,r[i+c+2]=h,r[i+c+3]=g}i+=o}return r.buffer};const pf=e=>{if(e===0)return zt.Greyscale;if(e===2)return zt.Truecolour;if(e===3)return zt.IndexedColour;if(e===4)return zt.GreyscaleWithAlpha;if(e===6)return zt.TruecolourWithAlpha;throw new Error(`Unknown color type: ${e}`)},bf=e=>{const t=Math.floor(e.length/4),n=new Uint8Array(t*3),r=new Uint8Array(t*1);let i=0,s=0,o=0;for(;i<e.length;)n[s++]=e[i++],n[s++]=e[i++],n[s++]=e[i++],r[o++]=e[i++];return{rgbChannel:n,alphaChannel:r}};var zt=(e=>(e.Greyscale="Greyscale",e.Truecolour="Truecolour",e.IndexedColour="IndexedColour",e.GreyscaleWithAlpha="GreyscaleWithAlpha",e.TruecolourWithAlpha="TruecolourWithAlpha",e))(zt||{});const ya=class{constructor(e){p(this,"rgbChannel"),p(this,"alphaChannel"),p(this,"type"),p(this,"width"),p(this,"height"),p(this,"bitsPerComponent");const t=C.decode(e),n=C.toRGBA8(t);if(n.length>1)throw new Error("Animated PNGs are not supported");const r=new Uint8Array(n[0]),{rgbChannel:i,alphaChannel:s}=bf(r);this.rgbChannel=i,s.some(c=>c<255)&&(this.alphaChannel=s),this.type=pf(t.ctype),this.width=t.width,this.height=t.height,this.bitsPerComponent=8}};let wa=ya;p(wa,"load",e=>new ya(e));class Ai{constructor(t){p(this,"bitsPerComponent"),p(this,"height"),p(this,"width"),p(this,"colorSpace"),p(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=wa.load(t);return new Ai(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 er=class extends ge{constructor(e){super(),p(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,s=this.value.length;i<s;i++){const o=this.value[i],c=$(o),l=this.value[i+1];n?c===b.Newline||c===b.CarriageReturn?r():c===b.n?r(b.Newline):c===b.r?r(b.CarriageReturn):c===b.t?r(b.Tab):c===b.b?r(b.Backspace):c===b.f?r(b.FormFeed):c===b.LeftParen?r(b.LeftParen):c===b.RightParen?r(b.RightParen):c===b.Backspace?r(b.BackSlash):c>=b.Zero&&c<=b.Seven?(t+=o,(t.length===3||!(l>="0"&&l<="7"))&&(r(parseInt(t,8)),t="")):r(c):c===b.BackSlash?n=!0:r(c)}return new Uint8Array(e)}decodeText(){const e=this.asBytes();return ks(e)?ys(e):ms(e)}decodeDate(){const e=this.decodeText(),t=gs(e);if(!t)throw new Bs(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++]=b.LeftParen,t+=de(this.value,e,t),e[t++]=b.RightParen,this.value.length+2}};let oe=er;p(oe,"of",e=>new er(e)),p(oe,"fromDate",e=>{const t=De(String(e.getUTCFullYear()),4,"0"),n=De(String(e.getUTCMonth()+1),2,"0"),r=De(String(e.getUTCDate()),2,"0"),i=De(String(e.getUTCHours()),2,"0"),s=De(String(e.getUTCMinutes()),2,"0"),o=De(String(e.getUTCSeconds()),2,"0");return new er(`D:${t}${n}${r}${i}${s}${o}Z`)});const mf=/\/([^\0\t\n\f\r\ ]+)[\0\t\n\f\r\ ]*(\d*\.\d+|\d+)?[\0\t\n\f\r\ ]+Tf/;class tr{constructor(t,n){p(this,"dict"),p(this,"ref"),this.dict=t,this.ref=n}T(){return this.dict.lookupMaybe(m.of("T"),oe,X)}Ff(){const t=this.getInheritableAttribute(m.of("Ff"));return this.dict.context.lookupMaybe(t,U)}V(){const t=this.getInheritableAttribute(m.of("V"));return this.dict.context.lookup(t)}Kids(){return this.dict.lookupMaybe(m.of("Kids"),J)}DA(){const t=this.dict.lookup(m.of("DA"));if(t instanceof oe||t instanceof X)return t}setKids(t){this.dict.set(m.of("Kids"),this.dict.context.obj(t))}getParent(){const t=this.dict.get(m.of("Parent"));if(t instanceof se){const n=this.dict.lookup(m.of("Parent"),V);return new tr(n,t)}}setParent(t){t?this.dict.set(m.of("Parent"),t):this.dict.delete(m.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(m.of("T"),X.fromText(t)):this.dict.delete(m.of("T"))}setDefaultAppearance(t){this.dict.set(m.of("DA"),oe.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 Xc(r);const s=Bc(i,mf);if(!s.match)throw new Yc(r);const o=i.slice(0,s.pos-s.match[0].length),c=s.pos<=i.length?i.slice(s.pos):"",l=s.match[1],a=`${o} /${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(m.of("Ff"),U.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 xa=class{constructor(e){p(this,"dict"),this.dict=e}W(){const e=this.dict.lookup(m.of("W"));if(e instanceof U)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(m.of("W"),t)}};let nr=xa;p(nr,"fromDict",e=>new xa(e));const Sa=class{constructor(e){p(this,"dict"),this.dict=e}Rect(){return this.dict.lookup(m.of("Rect"),J)}AP(){return this.dict.lookupMaybe(m.of("AP"),V)}F(){const e=this.dict.lookup(m.of("F"));return this.dict.context.lookupMaybe(e,U)}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,s=this.dict.context.obj([t,n,t+r,n+i]);this.dict.set(m.of("Rect"),s)}getAppearanceState(){const e=this.dict.lookup(m.of("AS"));if(e instanceof m)return e}setAppearanceState(e){this.dict.set(m.of("AS"),e)}setAppearances(e){this.dict.set(m.of("AP"),e)}ensureAP(){let e=this.AP();return e||(e=this.dict.context.obj({}),this.dict.set(m.of("AP"),e)),e}getNormalAppearance(){const t=this.ensureAP().get(m.of("N"));if(t instanceof se||t instanceof V)return t;throw new Error(`Unexpected N type: ${t?.constructor.name}`)}setNormalAppearance(e){this.ensureAP().set(m.of("N"),e)}setRolloverAppearance(e){this.ensureAP().set(m.of("R"),e)}setDownAppearance(e){this.ensureAP().set(m.of("D"),e)}removeRolloverAppearance(){const e=this.AP();e?.delete(m.of("R"))}removeDownAppearance(){const e=this.AP();e?.delete(m.of("D"))}getAppearances(){const e=this.AP();if(!e)return;const t=e.lookup(m.of("N"),V,st),n=e.lookupMaybe(m.of("R"),V,st),r=e.lookupMaybe(m.of("D"),V,st);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(m.of("F"),U.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 va=Sa;p(va,"fromDict",e=>new Sa(e));const ka=class{constructor(e){p(this,"dict"),this.dict=e}R(){const e=this.dict.lookup(m.of("R"));if(e instanceof U)return e}BC(){const e=this.dict.lookup(m.of("BC"));if(e instanceof J)return e}BG(){const e=this.dict.lookup(m.of("BG"));if(e instanceof J)return e}CA(){const e=this.dict.lookup(m.of("CA"));if(e instanceof X||e instanceof oe)return e}RC(){const e=this.dict.lookup(m.of("RC"));if(e instanceof X||e instanceof oe)return e}AC(){const e=this.dict.lookup(m.of("AC"));if(e instanceof X||e instanceof oe)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 U&&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 U&&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(m.of("R"),t)}setBorderColor(e){const t=this.dict.context.obj(e);this.dict.set(m.of("BC"),t)}setBackgroundColor(e){const t=this.dict.context.obj(e);this.dict.set(m.of("BG"),t)}setCaptions(e){const t=X.fromText(e.normal);if(this.dict.set(m.of("CA"),t),e.rollover){const n=X.fromText(e.rollover);this.dict.set(m.of("RC"),n)}else this.dict.delete(m.of("RC"));if(e.down){const n=X.fromText(e.down);this.dict.set(m.of("AC"),n)}else this.dict.delete(m.of("AC"))}};let rr=ka;p(rr,"fromDict",e=>new ka(e));const Ci=class extends va{MK(){const e=this.dict.lookup(m.of("MK"));if(e instanceof V)return e}BS(){const e=this.dict.lookup(m.of("BS"));if(e instanceof V)return e}DA(){const e=this.dict.lookup(m.of("DA"));if(e instanceof oe||e instanceof X)return e}P(){const e=this.dict.get(m.of("P"));if(e instanceof se)return e}setP(e){this.dict.set(m.of("P"),e)}setDefaultAppearance(e){this.dict.set(m.of("DA"),oe.of(e))}getDefaultAppearance(){const e=this.DA();return e instanceof X?e.decodeText():e?.asString()}getAppearanceCharacteristics(){const e=this.MK();if(e)return rr.fromDict(e)}getOrCreateAppearanceCharacteristics(){const e=this.MK();if(e)return rr.fromDict(e);const t=rr.fromDict(this.dict.context.obj({}));return this.dict.set(m.of("MK"),t.dict),t}getBorderStyle(){const e=this.BS();if(e)return nr.fromDict(e)}getOrCreateBorderStyle(){const e=this.BS();if(e)return nr.fromDict(e);const t=nr.fromDict(this.dict.context.obj({}));return this.dict.set(m.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 s=n[r];if(s!==m.of("Off"))return s}}}};let ir=Ci;p(ir,"fromDict",e=>new Ci(e)),p(ir,"create",(e,t)=>{const n=e.obj({Type:"Annot",Subtype:"Widget",Rect:[0,0,0,0],Parent:t});return new Ci(n)});const Aa=class extends tr{FT(){const e=this.getInheritableAttribute(m.of("FT"));return this.dict.context.lookup(e,m)}getWidgets(){const e=this.Kids();if(!e)return[ir.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]=ir.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 zn(e,0,t.size());t.remove(e)}else{if(e!==0)throw new zn(e,0,0);this.setKids([])}}normalizedEntries(){let e=this.Kids();return e||(e=this.dict.context.obj([this.ref]),this.dict.set(m.of("Kids"),e)),{Kids:e}}};let Ft=Aa;p(Ft,"fromDict",(e,t)=>new Aa(e,t));class Bi extends Ft{Opt(){return this.dict.lookupMaybe(m.of("Opt"),oe,X,J)}setOpt(t){this.dict.set(m.of("Opt"),this.dict.context.obj(t))}getExportValues(){const t=this.Opt();if(!t)return;if(t instanceof oe||t instanceof X)return[t];const n=[];for(let r=0,i=t.size();r<i;r++){const s=t.lookup(r);(s instanceof oe||s instanceof X)&&n.push(s)}return n}removeExportValue(t){const n=this.Opt();if(!!n)if(n instanceof oe||n instanceof X){if(t!==0)throw new zn(t,0,0);this.setOpt([])}else{if(t<0||t>n.size())throw new zn(t,0,n.size());n.remove(t)}}normalizeExportValues(){var t,n,r,i;const s=(t=this.getExportValues())!=null?t:[],o=[],c=this.getWidgets();for(let l=0,a=c.length;l<a;l++){const h=c[l],g=(i=s[l])!=null?i:X.fromText((r=(n=h.getOnValue())==null?void 0:n.decodeText())!=null?r:"");o.push(g)}this.setOpt(o)}addOpt(t,n){var r;this.normalizeExportValues();const i=t.decodeText();let s;if(n){const c=(r=this.getExportValues())!=null?r:[];for(let l=0,a=c.length;l<a;l++)c[l].decodeText()===i&&(s=l)}const o=this.Opt();return o.push(t),s??o.size()-1}addWidgetWithOpt(t,n,r){const i=this.addOpt(n,r),s=m.of(String(i));return this.addWidget(t),s}}const Ei=class extends Bi{setValue(e){var t;const n=(t=this.getOnValue())!=null?t:m.of("Yes");if(e!==n&&e!==m.of("Off"))throw new Er;this.dict.set(m.of("V"),e);const r=this.getWidgets();for(let i=0,s=r.length;i<s;i++){const o=r[i],c=o.getOnValue()===e?e:m.of("Off");o.setAppearanceState(c)}}getValue(){const e=this.V();return e instanceof m?e:m.of("Off")}getOnValue(){const[e]=this.getWidgets();return e?.getOnValue()}};let Ti=Ei;p(Ti,"fromDict",(e,t)=>new Ei(e,t)),p(Ti,"create",e=>{const t=e.obj({FT:"Btn",Kids:[]}),n=e.register(t);return new Ei(t,n)});const ce=e=>1<<e;var _f=(e=>(e[e.ReadOnly=ce(0)]="ReadOnly",e[e.Required=ce(1)]="Required",e[e.NoExport=ce(2)]="NoExport",e))(_f||{}),bn=(e=>(e[e.NoToggleToOff=ce(14)]="NoToggleToOff",e[e.Radio=ce(15)]="Radio",e[e.PushButton=ce(16)]="PushButton",e[e.RadiosInUnison=ce(25)]="RadiosInUnison",e))(bn||{}),yf=(e=>(e[e.Multiline=ce(12)]="Multiline",e[e.Password=ce(13)]="Password",e[e.FileSelect=ce(20)]="FileSelect",e[e.DoNotSpellCheck=ce(22)]="DoNotSpellCheck",e[e.DoNotScroll=ce(23)]="DoNotScroll",e[e.Comb=ce(24)]="Comb",e[e.RichText=ce(25)]="RichText",e))(yf||{}),Nt=(e=>(e[e.Combo=ce(17)]="Combo",e[e.Edit=ce(18)]="Edit",e[e.Sort=ce(19)]="Sort",e[e.MultiSelect=ce(21)]="MultiSelect",e[e.DoNotSpellCheck=ce(22)]="DoNotSpellCheck",e[e.CommitOnSelChange=ce(26)]="CommitOnSelChange",e))(Nt||{});class Ca extends Ft{setValues(t){if(this.hasFlag(Nt.Combo)&&!this.hasFlag(Nt.Edit)&&!this.valuesAreValid(t))throw new Er;if(t.length===0&&this.dict.delete(m.of("V")),t.length===1&&this.dict.set(m.of("V"),t[0]),t.length>1){if(!this.hasFlag(Nt.MultiSelect))throw new qc;this.dict.set(m.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 s=t[r].decodeText();if(!n.find(o=>s===(o.display||o.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,s=t.length;i<s;i++){const o=t[i].decodeText();n[i]=r.findIndex(c=>o===(c.display||c.value).decodeText())}this.dict.set(m.of("I"),this.dict.context.obj(n.sort()))}else this.dict.delete(m.of("I"))}getValues(){const t=this.V();if(t instanceof oe||t instanceof X)return[t];if(t instanceof J){const n=[];for(let r=0,i=t.size();r<i;r++){const s=t.lookup(r);(s instanceof oe||s instanceof X)&&n.push(s)}return n}return[]}Opt(){return this.dict.lookupMaybe(m.of("Opt"),oe,X,J)}setOptions(t){const n=new Array(t.length);for(let r=0,i=t.length;r<i;r++){const{value:s,display:o}=t[r];n[r]=this.dict.context.obj([s,o||s])}this.dict.set(m.of("Opt"),this.dict.context.obj(n))}getOptions(){const t=this.Opt();if(t instanceof oe||t instanceof X)return[{value:t,display:t}];if(t instanceof J){const n=[];for(let r=0,i=t.size();r<i;r++){const s=t.lookup(r);if((s instanceof oe||s instanceof X)&&n.push({value:s,display:s}),s instanceof J&&s.size()>0){const o=s.lookup(0,oe,X),c=s.lookupMaybe(1,oe,X);n.push({value:o,display:c||o})}}return n}return[]}}const Pi=class extends Ca{};let Di=Pi;p(Di,"fromDict",(e,t)=>new Pi(e,t)),p(Di,"create",e=>{const t=e.obj({FT:"Ch",Ff:Nt.Combo,Kids:[]}),n=e.register(t);return new Pi(t,n)});const Ri=class extends tr{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(m.of("Kids"),e)),{Kids:e}}};let sr=Ri;p(sr,"fromDict",(e,t)=>new Ri(e,t)),p(sr,"create",e=>{const t=e.obj({}),n=e.register(t);return new Ri(t,n)});const Ba=class extends Ft{};let Ea=Ba;p(Ea,"fromDict",(e,t)=>new Ba(e,t));const Ii=class extends Ft{MaxLen(){const e=this.dict.lookup(m.of("MaxLen"));if(e instanceof U)return e}Q(){const e=this.dict.lookup(m.of("Q"));if(e instanceof U)return e}setMaxLength(e){this.dict.set(m.of("MaxLen"),U.of(e))}removeMaxLength(){this.dict.delete(m.of("MaxLen"))}getMaxLength(){var e;return(e=this.MaxLen())==null?void 0:e.asNumber()}setQuadding(e){this.dict.set(m.of("Q"),U.of(e))}getQuadding(){var e;return(e=this.Q())==null?void 0:e.asNumber()}setValue(e){this.dict.set(m.of("V"),e)}removeValue(){this.dict.delete(m.of("V"))}getValue(){const e=this.V();if(e instanceof oe||e instanceof X)return e}};let Oi=Ii;p(Oi,"fromDict",(e,t)=>new Ii(e,t)),p(Oi,"create",e=>{const t=e.obj({FT:"Tx",Kids:[]}),n=e.register(t);return new Ii(t,n)});const zi=class extends Bi{};let Fi=zi;p(Fi,"fromDict",(e,t)=>new zi(e,t)),p(Fi,"create",e=>{const t=e.obj({FT:"Btn",Ff:bn.PushButton,Kids:[]}),n=e.register(t);return new zi(t,n)});const Ni=class extends Bi{setValue(e){if(!this.getOnValues().includes(e)&&e!==m.of("Off"))throw new Er;this.dict.set(m.of("V"),e);const n=this.getWidgets();for(let r=0,i=n.length;r<i;r++){const s=n[r],o=s.getOnValue()===e?e:m.of("Off");s.setAppearanceState(o)}}getValue(){const e=this.V();return e instanceof m?e:m.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 Li=Ni;p(Li,"fromDict",(e,t)=>new Ni(e,t)),p(Li,"create",e=>{const t=e.obj({FT:"Btn",Ff:bn.Radio,Kids:[]}),n=e.register(t);return new Ni(t,n)});const ji=class extends Ca{};let Mi=ji;p(Mi,"fromDict",(e,t)=>new ji(e,t)),p(Mi,"create",e=>{const t=e.obj({FT:"Ch",Kids:[]}),n=e.register(t);return new ji(t,n)});const wf=e=>{if(!e)return[];const t=[];for(let n=0,r=e.size();n<r;n++){const i=e.get(n),s=e.lookup(n);i instanceof se&&s instanceof V&&t.push([Ta(s,i),i])}return t},Ta=(e,t)=>xf(e)?sr.fromDict(e,t):Sf(e,t),xf=e=>{const t=e.lookup(m.of("Kids"));if(t instanceof J)for(let n=0,r=t.size();n<r;n++){const i=t.lookup(n);if(i instanceof V&&i.has(m.of("T")))return!0}return!1},Sf=(e,t)=>{const n=$i(e,m.of("FT")),r=e.context.lookup(n,m);return r===m.of("Btn")?vf(e,t):r===m.of("Ch")?kf(e,t):r===m.of("Tx")?Oi.fromDict(e,t):r===m.of("Sig")?Ea.fromDict(e,t):Ft.fromDict(e,t)},vf=(e,t)=>{var n;const r=$i(e,m.of("Ff")),i=e.context.lookupMaybe(r,U),s=(n=i?.asNumber())!=null?n:0;return Ui(s,bn.PushButton)?Fi.fromDict(e,t):Ui(s,bn.Radio)?Li.fromDict(e,t):Ti.fromDict(e,t)},kf=(e,t)=>{var n;const r=$i(e,m.of("Ff")),i=e.context.lookupMaybe(r,U),s=(n=i?.asNumber())!=null?n:0;return Ui(s,Nt.Combo)?Di.fromDict(e,t):Mi.fromDict(e,t)},Ui=(e,t)=>(e&t)!==0,$i=(e,t)=>{let n;return Pa(e,r=>{n||(n=r.get(t))}),n},Pa=(e,t)=>{t(e);const n=e.lookupMaybe(m.of("Parent"),V);n&&Pa(n,t)},Hi=class{constructor(e){p(this,"dict"),this.dict=e}Fields(){const e=this.dict.lookup(m.of("Fields"));if(e instanceof J)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),s=e.lookup(n,V);t[n]=[Ta(s,i),i]}return t}getAllFields(){const e=[],t=n=>{if(!!n)for(let r=0,i=n.length;r<i;r++){const s=n[r];e.push(s);const[o]=s;o instanceof sr&&t(wf(o.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(m.of("Fields"),e)),{Fields:e}}};let or=Hi;p(or,"fromDict",e=>new Hi(e)),p(or,"create",e=>{const t=e.obj({Fields:[]});return new Hi(t)});const ar=(e,t)=>{if(e!==void 0)return t[e]};var Wi=(e=>(e.UseNone="UseNone",e.UseOutlines="UseOutlines",e.UseThumbs="UseThumbs",e.UseOC="UseOC",e))(Wi||{}),Gi=(e=>(e.L2R="L2R",e.R2L="R2L",e))(Gi||{}),Vi=(e=>(e.None="None",e.AppDefault="AppDefault",e))(Vi||{}),Ki=(e=>(e.Simplex="Simplex",e.DuplexFlipShortEdge="DuplexFlipShortEdge",e.DuplexFlipLongEdge="DuplexFlipLongEdge",e))(Ki||{});const Zi=class{constructor(e){p(this,"dict"),this.dict=e}lookupBool(e){const t=this.dict.lookup(m.of(e));if(t instanceof mt)return t}lookupName(e){const t=this.dict.lookup(m.of(e));if(t instanceof m)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(m.of("PrintPageRange"));if(e instanceof J)return e}NumCopies(){const e=this.dict.lookup(m.of("NumCopies"));if(e instanceof U)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=ar(n,Wi))!=null?t:"UseNone"}getReadingDirection(){var e,t;const n=(e=this.Direction())==null?void 0:e.decodeText();return(t=ar(n,Gi))!=null?t:"L2R"}getPrintScaling(){var e,t;const n=(e=this.PrintScaling())==null?void 0:e.decodeText();return(t=ar(n,Vi))!=null?t:"AppDefault"}getDuplex(){var e;const t=(e=this.Duplex())==null?void 0:e.decodeText();return ar(t,Ki)}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,U).asNumber(),i=e.lookup(n+1,U).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(m.of("HideToolbar"),t)}setHideMenubar(e){const t=this.dict.context.obj(e);this.dict.set(m.of("HideMenubar"),t)}setHideWindowUI(e){const t=this.dict.context.obj(e);this.dict.set(m.of("HideWindowUI"),t)}setFitWindow(e){const t=this.dict.context.obj(e);this.dict.set(m.of("FitWindow"),t)}setCenterWindow(e){const t=this.dict.context.obj(e);this.dict.set(m.of("CenterWindow"),t)}setDisplayDocTitle(e){const t=this.dict.context.obj(e);this.dict.set(m.of("DisplayDocTitle"),t)}setNonFullScreenPageMode(e){Zt(e,"nonFullScreenPageMode",Wi);const t=m.of(e);this.dict.set(m.of("NonFullScreenPageMode"),t)}setReadingDirection(e){Zt(e,"readingDirection",Gi);const t=m.of(e);this.dict.set(m.of("Direction"),t)}setPrintScaling(e){Zt(e,"printScaling",Vi);const t=m.of(e);this.dict.set(m.of("PrintScaling"),t)}setDuplex(e){Zt(e,"duplex",Ki);const t=m.of(e);this.dict.set(m.of("Duplex"),t)}setPickTrayByPDFSize(e){const t=this.dict.context.obj(e);this.dict.set(m.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);Cs(t,"printPageRange",["number"]);const n=this.dict.context.obj(t);this.dict.set(m.of("PrintPageRange"),n)}setNumCopies(e){Je(e,"numCopies",1,Number.MAX_VALUE),Wc(e,"numCopies");const t=this.dict.context.obj(e);this.dict.set(m.of("NumCopies"),t)}};let cr=Zi;p(cr,"fromDict",e=>new Zi(e)),p(cr,"create",e=>{const t=e.obj({});return new Zi(t)});const qi=class extends V{Pages(){return this.lookup(m.of("Pages"),V)}AcroForm(){return this.lookupMaybe(m.of("AcroForm"),V)}getAcroForm(){const e=this.AcroForm();if(!!e)return or.fromDict(e)}getOrCreateAcroForm(){let e=this.getAcroForm();if(!e){e=or.create(this.context);const t=this.context.register(e.dict);this.set(m.of("AcroForm"),t)}return e}ViewerPreferences(){return this.lookupMaybe(m.of("ViewerPreferences"),V)}getViewerPreferences(){const e=this.ViewerPreferences();if(!!e)return cr.fromDict(e)}getOrCreateViewerPreferences(){let e=this.getViewerPreferences();if(!e){e=cr.create(this.context);const t=this.context.register(e.dict);this.set(m.of("ViewerPreferences"),t)}return e}insertLeafNode(e,t){const n=this.get(m.of("Pages"));return this.Pages().insertLeafNode(e,t)||n}removeLeafNode(e){this.Pages().removeLeafNode(e)}};let Xi=qi;p(Xi,"withContextAndPages",(e,t)=>{const n=new Map;return n.set(m.of("Type"),m.of("Catalog")),n.set(m.of("Pages"),t),new qi(n,e)}),p(Xi,"fromMapWithContext",(e,t)=>new qi(e,t));const lr=class extends V{constructor(e,t,n=!0){super(e,t),p(this,"normalized",!1),p(this,"autoNormalizeCTM"),this.autoNormalizeCTM=n}clone(e){const t=lr.fromMapWithContext(new Map,e||this.context,this.autoNormalizeCTM),n=this.entries();for(let r=0,i=n.length;r<i;r++){const[s,o]=n[r];t.set(s,o)}return t}Parent(){return this.lookupMaybe(m.Parent,V)}Contents(){return this.lookup(m.of("Contents"))}Annots(){return this.lookupMaybe(m.Annots,J)}BleedBox(){return this.lookupMaybe(m.BleedBox,J)}TrimBox(){return this.lookupMaybe(m.TrimBox,J)}ArtBox(){return this.lookupMaybe(m.ArtBox,J)}Resources(){const e=this.getInheritableAttribute(m.Resources);return this.context.lookupMaybe(e,V)}MediaBox(){const e=this.getInheritableAttribute(m.MediaBox);return this.context.lookup(e,J)}CropBox(){const e=this.getInheritableAttribute(m.CropBox);return this.context.lookupMaybe(e,J)}Rotate(){const e=this.getInheritableAttribute(m.Rotate);return this.context.lookupMaybe(e,U)}getInheritableAttribute(e){let t;return this.ascend(n=>{t||(t=n.get(e))}),t}setParent(e){this.set(m.Parent,e)}addContentStream(e){const t=this.normalizedEntries().Contents||this.context.obj([]);this.set(m.Contents,t),t.push(e)}wrapContentStreams(e,t){const n=this.Contents();return n instanceof J?(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(m.Contents);this.context.lookup(t)instanceof st&&this.set(m.Contents,e.obj([t])),this.autoNormalizeCTM&&this.wrapContentStreams(this.context.getPushGraphicsStateContentStream(),this.context.getPopGraphicsStateContentStream());const r=this.getInheritableAttribute(m.Resources),i=e.lookupMaybe(r,V)||e.obj({});this.set(m.Resources,i);const s=i.lookupMaybe(m.Font,V)||e.obj({});i.set(m.Font,s);const o=i.lookupMaybe(m.XObject,V)||e.obj({});i.set(m.XObject,o);const c=i.lookupMaybe(m.ExtGState,V)||e.obj({});i.set(m.ExtGState,c);const l=this.Annots()||e.obj([]);this.set(m.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(m.Font,V),XObject:t.lookup(m.XObject,V),ExtGState:t.lookup(m.ExtGState,V)}}};let je=lr;p(je,"InheritableEntries",["Resources","MediaBox","CropBox","Rotate"]),p(je,"withContextAndParent",(e,t)=>{const n=new Map;return n.set(m.Type,m.Page),n.set(m.Parent,t),n.set(m.Resources,e.obj({})),n.set(m.MediaBox,e.obj([0,0,612,792])),new lr(n,e,!1)}),p(je,"fromMapWithContext",(e,t,n=!0)=>new lr(e,t,n));const Yi=class{constructor(e){p(this,"bytes"),p(this,"length"),p(this,"idx",0),p(this,"line",0),p(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===b.Newline?(this.line+=1,this.column=0):this.column+=1,e}assertNext(e){if(this.peek()!==e)throw new Jc(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=Yi;p(Lt,"of",e=>new Yi(e)),p(Lt,"fromPDFRawStream",e=>Yi.of(pa(e).decode()));const ue=new Uint8Array(256);ue[b.Zero]=1,ue[b.One]=1,ue[b.Two]=1,ue[b.Three]=1,ue[b.Four]=1,ue[b.Five]=1,ue[b.Six]=1,ue[b.Seven]=1,ue[b.Eight]=1,ue[b.Nine]=1;const hr=new Uint8Array(256);hr[b.Period]=1,hr[b.Plus]=1,hr[b.Minus]=1;const Ji=new Uint8Array(256);for(let e=0,t=256;e<t;e++)Ji[e]=ue[e]||hr[e]?1:0;const{Newline:Da,CarriageReturn:Ra}=b;class Af{constructor(t,n=!1){p(this,"bytes"),p(this,"capNumbers"),this.bytes=t,this.capNumbers=n}parseRawInt(){let t="";for(;!this.bytes.done();){const r=this.bytes.peek();if(!ue[r])break;t+=We(this.bytes.next())}const n=Number(t);if(!t||!isFinite(n))throw new Ps(this.bytes.position(),t);return n}parseRawNumber(){let t="";for(;!this.bytes.done();){const r=this.bytes.peek();if(!Ji[r]||(t+=We(this.bytes.next()),r===b.Period))break}for(;!this.bytes.done();){const r=this.bytes.peek();if(!ue[r])break;t+=We(this.bytes.next())}const n=Number(t);if(!t||!isFinite(n))throw new Ps(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()&&Ve[this.bytes.peek()];)this.bytes.next()}skipLine(){for(;!this.bytes.done();){const t=this.bytes.peek();if(t===Da||t===Ra)return;this.bytes.next()}}skipComment(){if(this.bytes.peek()!==b.Percent)return!1;for(;!this.bytes.done();){const t=this.bytes.peek();if(t===Da||t===Ra)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(m.of("Parent"))}Kids(){return this.lookup(m.of("Kids"),J)}Count(){return this.lookup(m.of("Count"),U)}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 Es(t,r);let i=t;for(let s=0,o=n.size();s<o;s++){if(i===0){this.insertLeafKid(s,e);return}const c=n.get(s),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 je&&(i-=1)}if(i===0){this.insertLeafKid(n.size(),e);return}throw new Ts(t,"insertLeafNode")}removeLeafNode(e,t=!0){const n=this.Kids(),r=this.Count().asNumber();if(e>=r)throw new Es(e,r);let i=e;for(let s=0,o=n.size();s<o;s++){const c=n.get(s),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(s);return}else i-=l.Count().asNumber();if(l instanceof je)if(i===0){this.removeKid(s);return}else i-=1}throw new Ts(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),s=this.context.lookup(i);s instanceof jt&&s.traverse(e),e(s,i)}}insertLeafKid(e,t){const n=this.Kids();this.ascend(r=>{const i=r.Count().asNumber()+1;r.set(m.of("Count"),U.of(i))}),n.insert(e,t)}removeKid(e){const t=this.Kids();t.lookup(e)instanceof je&&this.ascend(r=>{const i=r.Count().asNumber()-1;r.set(m.of("Count"),U.of(i))}),t.remove(e)}};let Qi=jt;p(Qi,"withContext",(e,t)=>{const n=new Map;return n.set(m.of("Type"),m.of("Pages")),n.set(m.of("Kids"),e.obj([])),n.set(m.of("Count"),e.obj(0)),t&&n.set(m.of("Parent"),t),new jt(n,e)}),p(Qi,"fromMapWithContext",(e,t)=>new jt(e,t));const{Space:Cf,CarriageReturn:mn,Newline:_n}=b,yn=[b.s,b.t,b.r,b.e,b.a,b.m],dr=[b.e,b.n,b.d,b.s,b.t,b.r,b.e,b.a,b.m],ee={header:[b.Percent,b.P,b.D,b.F,b.Dash],eof:[b.Percent,b.Percent,b.E,b.O,b.F],obj:[b.o,b.b,b.j],endobj:[b.e,b.n,b.d,b.o,b.b,b.j],xref:[b.x,b.r,b.e,b.f],trailer:[b.t,b.r,b.a,b.i,b.l,b.e,b.r],startxref:[b.s,b.t,b.a,b.r,b.t,b.x,b.r,b.e,b.f],true:[b.t,b.r,b.u,b.e],false:[b.f,b.a,b.l,b.s,b.e],null:[b.n,b.u,b.l,b.l],stream:yn,streamEOF1:[...yn,Cf,mn,_n],streamEOF2:[...yn,mn,_n],streamEOF3:[...yn,mn],streamEOF4:[...yn,_n],endstream:dr,EOF1endstream:[mn,_n,...dr],EOF2endstream:[mn,...dr],EOF3endstream:[_n,...dr]},es=class extends Af{constructor(e,t,n=!1){super(e,n),p(this,"context"),this.context=t}parseObject(){if(this.skipWhitespaceAndComments(),this.matchKeyword(ee.true))return mt.True;if(this.matchKeyword(ee.false))return mt.False;if(this.matchKeyword(ee.null))return _e;const e=this.bytes.peek();if(e===b.LessThan&&this.bytes.peekAhead(1)===b.LessThan)return this.parseDictOrStream();if(e===b.LessThan)return this.parseHexString();if(e===b.LeftParen)return this.parseString();if(e===b.ForwardSlash)return this.parseName();if(e===b.LeftSquareBracket)return this.parseArray();if(Ji[e])return this.parseNumberOrRef();throw new Qc(this.bytes.position(),e)}parseNumberOrRef(){const e=this.parseRawNumber();this.skipWhitespaceAndComments();const t=this.bytes.offset();if(ue[this.bytes.peek()]){const n=this.parseRawNumber();if(this.skipWhitespaceAndComments(),this.bytes.peek()===b.R)return this.bytes.assertNext(b.R),se.of(e,n)}return this.bytes.moveTo(t),U.of(e)}parseHexString(){let e="";for(this.bytes.assertNext(b.LessThan);!this.bytes.done()&&this.bytes.peek()!==b.GreaterThan;)e+=We(this.bytes.next());return this.bytes.assertNext(b.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===b.LeftParen&&(e+=1),r===b.RightParen&&(e-=1)),r===b.BackSlash?t=!t:t&&(t=!1),e===0)return oe.of(n.substring(1,n.length-1))}throw new nl(this.bytes.position())}parseName(){this.bytes.assertNext(b.ForwardSlash);let e="";for(;!this.bytes.done();){const t=this.bytes.peek();if(Ve[t]||Ae[t])break;e+=We(t),this.bytes.next()}return m.of(e)}parseArray(){this.bytes.assertNext(b.LeftSquareBracket),this.skipWhitespaceAndComments();const e=J.withContext(this.context);for(;this.bytes.peek()!==b.RightSquareBracket;){const t=this.parseObject();e.push(t),this.skipWhitespaceAndComments()}return this.bytes.assertNext(b.RightSquareBracket),e}parseDict(){this.bytes.assertNext(b.LessThan),this.bytes.assertNext(b.LessThan),this.skipWhitespaceAndComments();const e=new Map;for(;!this.bytes.done()&&this.bytes.peek()!==b.GreaterThan&&this.bytes.peekAhead(1)!==b.GreaterThan;){const n=this.parseName(),r=this.parseObject();e.set(n,r),this.skipWhitespaceAndComments()}this.skipWhitespaceAndComments(),this.bytes.assertNext(b.GreaterThan),this.bytes.assertNext(b.GreaterThan);const t=e.get(m.of("Type"));return t===m.of("Catalog")?Xi.fromMapWithContext(e,this.context):t===m.of("Pages")?Qi.fromMapWithContext(e,this.context):t===m.of("Page")?je.fromMapWithContext(e,this.context):V.fromMapWithContext(e,this.context)}parseDictOrStream(){const e=this.bytes.position(),t=this.parseDict();if(this.skipWhitespaceAndComments(),!this.matchKeyword(ee.streamEOF1)&&!this.matchKeyword(ee.streamEOF2)&&!this.matchKeyword(ee.streamEOF3)&&!this.matchKeyword(ee.streamEOF4)&&!this.matchKeyword(ee.stream))return t;const n=this.bytes.offset();let r;const i=t.get(m.of("Length"));i instanceof U?(r=n+i.asNumber(),this.bytes.moveTo(r),this.skipWhitespaceAndComments(),this.matchKeyword(ee.endstream)||(this.bytes.moveTo(n),r=this.findEndOfStreamFallback(e))):r=this.findEndOfStreamFallback(e);const s=this.bytes.slice(n,r);return It.of(t,s)}findEndOfStreamFallback(e){let t=1,n=this.bytes.offset();for(;!this.bytes.done()&&(n=this.bytes.offset(),this.matchKeyword(ee.stream)?t+=1:this.matchKeyword(ee.EOF1endstream)||this.matchKeyword(ee.EOF2endstream)||this.matchKeyword(ee.EOF3endstream)||this.matchKeyword(ee.endstream)?t-=1:this.bytes.next(),t!==0););if(t!==0)throw new tl(e);return n}};let fr=es;p(fr,"forBytes",(e,t,n)=>new es(Lt.of(e),t,n)),p(fr,"forByteStream",(e,t,n=!1)=>new es(e,t,n));const Ia=class extends fr{constructor(e,t){super(Lt.fromPDFRawStream(e),e.dict.context),p(this,"alreadyParsed"),p(this,"shouldWaitForTick"),p(this,"firstOffset"),p(this,"objectCount");const{dict:n}=e;this.alreadyParsed=!1,this.shouldWaitForTick=t||(()=>!1),this.firstOffset=n.lookup(m.of("First"),U).asNumber(),this.objectCount=n.lookup(m.of("N"),U).asNumber()}async parseIntoContext(){if(this.alreadyParsed)throw new Br("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 s=this.parseObject(),o=se.of(r,0);this.context.assign(o,s),this.shouldWaitForTick()&&await St()}}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 Oa=Ia;p(Oa,"forStream",(e,t)=>new Ia(e,t));const za=class{constructor(e){p(this,"alreadyParsed"),p(this,"dict"),p(this,"context"),p(this,"bytes"),p(this,"subsections"),p(this,"byteWidths"),this.alreadyParsed=!1,this.dict=e.dict,this.bytes=Lt.fromPDFRawStream(e),this.context=this.dict.context;const t=this.dict.lookup(m.of("Size"),U),n=this.dict.lookup(m.of("Index"));if(n instanceof J){this.subsections=[];for(let i=0,s=n.size();i<s;i+=2){const o=n.lookup(i+0,U).asNumber(),c=n.lookup(i+1,U).asNumber();this.subsections.push({firstObjectNumber:o,length:c})}}else this.subsections=[{firstObjectNumber:0,length:t.asNumber()}];const r=this.dict.lookup(m.of("W"),J);this.byteWidths=[-1,-1,-1];for(let i=0,s=r.size();i<s;i++)this.byteWidths[i]=r.lookup(i,U).asNumber()}parseIntoContext(){if(this.alreadyParsed)throw new Br("PDFXRefStreamParser","parseIntoContext");return this.alreadyParsed=!0,this.context.trailerInfo={Root:this.dict.get(m.of("Root")),Encrypt:this.dict.get(m.of("Encrypt")),Info:this.dict.get(m.of("Info")),ID:this.dict.get(m.of("ID"))},this.parseEntries()}parseEntries(){const e=[],[t,n,r]=this.byteWidths;for(let i=0,s=this.subsections.length;i<s;i++){const{firstObjectNumber:o,length:c}=this.subsections[i];for(let l=0;l<c;l++){let a=0;for(let _=0,w=t;_<w;_++)a=a<<8|this.bytes.next();let h=0;for(let _=0,w=n;_<w;_++)h=h<<8|this.bytes.next();let g=0;for(let _=0,w=r;_<w;_++)g=g<<8|this.bytes.next();t===0&&(a=1);const f=o+l,d={ref:se.of(f,g),offset:h,deleted:a===0,inObjectStream:a===2};e.push(d)}}return e}};let Fa=za;p(Fa,"forStream",e=>new za(e));const Na=class extends fr{constructor(e,t=1/0,n=!1,r=!1){super(Lt.of(e),pi.create(),r),p(this,"objectsPerTick"),p(this,"throwOnInvalidObject"),p(this,"alreadyParsed",!1),p(this,"parsedObjects",0),p(this,"shouldWaitForTick",()=>(this.parsedObjects+=1,this.parsedObjects%this.objectsPerTick===0)),this.objectsPerTick=t,this.throwOnInvalidObject=n}async parseDocument(){if(this.alreadyParsed)throw new Br("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 rl(this.bytes.position());e=t}return this.maybeRecoverRoot(),this.context.lookup(se.of(0))&&(console.warn("Removing parsed object: 0 0 R"),this.context.delete(se.of(0))),this.context}maybeRecoverRoot(){const e=n=>n instanceof V&&n.lookup(m.of("Type"))===m.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[s,o]=n[r];e(o)&&(this.context.trailerInfo.Root=s)}}}parseHeader(){for(;!this.bytes.done();){if(this.matchKeyword(ee.header)){const e=this.parseRawInt();this.bytes.assertNext(b.Period);const t=this.parseRawInt(),n=gn.forVersion(e,t);return this.skipBinaryHeaderComment(),n}this.bytes.next()}throw new il(this.bytes.position())}parseIndirectObjectHeader(){this.skipWhitespaceAndComments();const e=this.parseRawInt();this.skipWhitespaceAndComments();const t=this.parseRawInt();if(this.skipWhitespaceAndComments(),!this.matchKeyword(ee.obj))throw new sl(this.bytes.position(),ee.obj);return se.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(ee.endobj),t instanceof It&&t.dict.lookup(m.of("Type"))===m.of("ObjStm")?await Oa.forStream(t,this.shouldWaitForTick).parseIntoContext():t instanceof It&&t.dict.lookup(m.of("Type"))===m.of("XRef")?Fa.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(ee.endobj)&&(i=!1),!!i);)this.bytes.next();if(i)throw new el(e);const s=this.bytes.offset()-ee.endobj.length,o=Si.of(this.bytes.slice(r,s));return this.context.assign(n,o),n}async parseIndirectObjects(){for(this.skipWhitespaceAndComments();!this.bytes.done()&&ue[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 St()}}maybeParseCrossRefSection(){if(this.skipWhitespaceAndComments(),!this.matchKeyword(ee.xref))return;this.skipWhitespaceAndComments();let e=-1;const t=Xn.createEmpty();for(;!this.bytes.done()&&ue[this.bytes.peek()];){const n=this.parseRawInt();this.skipWhitespaceAndComments();const r=this.parseRawInt();this.skipWhitespaceAndComments();const i=this.bytes.peek();if(i===b.n||i===b.f){const s=se.of(e,r);this.bytes.next()===b.n?t.addEntry(s,n):t.addDeletedEntry(s,n),e+=1}else e=n;this.skipWhitespaceAndComments()}return t}maybeParseTrailerDict(){if(this.skipWhitespaceAndComments(),!this.matchKeyword(ee.trailer))return;this.skipWhitespaceAndComments();const e=this.parseDict(),{context:t}=this;t.trailerInfo={Root:e.get(m.of("Root"))||t.trailerInfo.Root,Encrypt:e.get(m.of("Encrypt"))||t.trailerInfo.Encrypt,Info:e.get(m.of("Info"))||t.trailerInfo.Info,ID:e.get(m.of("ID"))||t.trailerInfo.ID}}maybeParseTrailer(){if(this.skipWhitespaceAndComments(),!this.matchKeyword(ee.startxref))return;this.skipWhitespaceAndComments();const e=this.parseRawInt();return this.skipWhitespace(),this.matchKeyword(ee.eof),this.skipWhitespaceAndComments(),this.matchKeyword(ee.eof),this.skipWhitespaceAndComments(),Yn.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>=b.Space&&t<=b.Tilde&&(this.matchKeyword(ee.xref)||this.matchKeyword(ee.trailer)||this.matchKeyword(ee.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 La=Na;p(La,"forBytesWithOptions",(e,t,n,r)=>new Na(e,t,n,r));const ja=e=>e instanceof m?e:m.of(e),G=e=>e instanceof U?e:U.of(e),ye=e=>e instanceof U?e.asNumber():e;var Ma=(e=>(e.Degrees="degrees",e.Radians="radians",e))(Ma||{});const ve=e=>(E(e,"degreeAngle",["number"]),{type:"degrees",angle:e}),{Radians:Ua,Degrees:$a}=Ma,Bf=e=>e*Math.PI/180,Ef=e=>e*180/Math.PI,Re=e=>e.type===Ua?e.angle:e.type===$a?Bf(e.angle):Rn(`Invalid rotation: ${JSON.stringify(e)}`),Tf=e=>e.type===Ua?Ef(e.angle):e.type===$a?e.angle:Rn(`Invalid rotation: ${JSON.stringify(e)}`),{cos:Ha,sin:Wa,tan:Ga}=Math,ur=(e,t,n,r,i,s)=>ne.of(re.ConcatTransformationMatrix,[G(e),G(t),G(n),G(r),G(i),G(s)]),Mt=(e,t)=>ur(1,0,0,1,e,t),wn=(e,t)=>ur(e,0,0,t,0,0),xn=e=>ur(Ha(ye(e)),Wa(ye(e)),-Wa(ye(e)),Ha(ye(e)),0,0),ts=(e,t)=>ur(1,Ga(ye(e)),Ga(ye(t)),1,0,0),gr=(e,t)=>ne.of(re.SetLineDashPattern,[`[${e.map(G).join(" ")}]`,G(t)]);var Sn=(e=>(e[e.Butt=0]="Butt",e[e.Round=1]="Round",e[e.Projecting=2]="Projecting",e))(Sn||{});const pr=e=>ne.of(re.SetLineCapStyle,[G(e)]),Ut=e=>ne.of(re.SetGraphicsStateParams,[ja(e)]),Xe=()=>ne.of(re.PushGraphicsState),Ye=()=>ne.of(re.PopGraphicsState),br=e=>ne.of(re.SetLineWidth,[G(e)]),ke=(e,t,n,r,i,s)=>ne.of(re.AppendBezierCurve,[G(e),G(t),G(n),G(r),G(i),G(s)]),mr=(e,t,n,r)=>ne.of(re.CurveToReplicateInitialPoint,[G(e),G(t),G(n),G(r)]),$t=()=>ne.of(re.ClosePath),_t=(e,t)=>ne.of(re.MoveTo,[G(e),G(t)]),Me=(e,t)=>ne.of(re.LineTo,[G(e),G(t)]),_r=()=>ne.of(re.StrokePath),ns=()=>ne.of(re.FillNonZero),rs=()=>ne.of(re.FillNonZeroAndStroke),Va=e=>ne.of(re.DrawObject,[ja(e)]),Pf=e=>ne.of(re.NonStrokingColorGray,[G(e)]),Df=e=>ne.of(re.StrokingColorGray,[G(e)]),Rf=(e,t,n)=>ne.of(re.NonStrokingColorRgb,[G(e),G(t),G(n)]),If=(e,t,n)=>ne.of(re.StrokingColorRgb,[G(e),G(t),G(n)]),Of=(e,t,n,r)=>ne.of(re.NonStrokingColorCmyk,[G(e),G(t),G(n),G(r)]),zf=(e,t,n,r)=>ne.of(re.StrokingColorCmyk,[G(e),G(t),G(n),G(r)]);var Ka=(e=>(e.Grayscale="Grayscale",e.RGB="RGB",e.CMYK="CMYK",e))(Ka||{});const vn=(e,t,n)=>(Je(e,"red",0,1),Je(t,"green",0,1),Je(n,"blue",0,1),{type:"RGB",red:e,green:t,blue:n}),{Grayscale:Za,RGB:qa,CMYK:Xa}=Ka,is=e=>e.type===Za?Pf(e.gray):e.type===qa?Rf(e.red,e.green,e.blue):e.type===Xa?Of(e.cyan,e.magenta,e.yellow,e.key):Rn(`Invalid color: ${JSON.stringify(e)}`),yr=e=>e.type===Za?Df(e.gray):e.type===qa?If(e.red,e.green,e.blue):e.type===Xa?zf(e.cyan,e.magenta,e.yellow,e.key):Rn(`Invalid color: ${JSON.stringify(e)}`);class Ff 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 Nf 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 Lf extends Error{constructor(){const t="PDFDocument has no pages so `PDFDocument.removePage` cannot be called";super(t)}}let N=0,L=0,K=0,Z=0,kn=0,An=0;const Ya=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]]),jf=e=>{let t;const n=[];let r=[],i="",s=!1,o=0;for(const c of e)if(Ya.has(c))o=Ya.get(c),t&&(i.length>0&&(r[r.length]=+i),n[n.length]={cmd:t,args:r},r=[],i="",s=!1),t=c;else if([" ",","].includes(c)||c==="-"&&i.length>0&&i[i.length-1]!=="e"||c==="."&&s){if(i.length===0)continue;r.length===o?(n[n.length]={cmd:t,args:r},r=[+i],t==="M"&&(t="L"),t==="m"&&(t="l")):r[r.length]=+i,s=c===".",i=["-","."].includes(c)?c:""}else i+=c,c==="."&&(s=!0);return i.length>0&&(r.length===o?(n[n.length]={cmd:t,args:r},r=[+i],t==="M"&&(t="L"),t==="m"&&(t="l")):r[r.length]=+i),n[n.length]={cmd:t,args:r},n},Mf=e=>{N=L=K=Z=kn=An=0;let t=[];for(let n=0;n<e.length;n++){const r=e[n];if(r.cmd&&typeof Ja[r.cmd]=="function"){const i=Ja[r.cmd](r.args);Array.isArray(i)?t=t.concat(i):t.push(i)}}return t},Ja={M(e){return N=e[0],L=e[1],K=Z=null,kn=N,An=L,_t(N,L)},m(e){return N+=e[0],L+=e[1],K=Z=null,kn=N,An=L,_t(N,L)},C(e){return N=e[4],L=e[5],K=e[2],Z=e[3],ke(e[0],e[1],e[2],e[3],e[4],e[5])},c(e){const t=ke(e[0]+N,e[1]+L,e[2]+N,e[3]+L,e[4]+N,e[5]+L);return K=N+e[2],Z=L+e[3],N+=e[4],L+=e[5],t},S(e){(K===null||Z===null)&&(K=N,Z=L);const t=ke(N-(K-N),L-(Z-L),e[0],e[1],e[2],e[3]);return K=e[0],Z=e[1],N=e[2],L=e[3],t},s(e){(K===null||Z===null)&&(K=N,Z=L);const t=ke(N-(K-N),L-(Z-L),N+e[0],L+e[1],N+e[2],L+e[3]);return K=N+e[0],Z=L+e[1],N+=e[2],L+=e[3],t},Q(e){return K=e[0],Z=e[1],N=e[2],L=e[3],mr(e[0],e[1],N,L)},q(e){const t=mr(e[0]+N,e[1]+L,e[2]+N,e[3]+L);return K=N+e[0],Z=L+e[1],N+=e[2],L+=e[3],t},T(e){K===null||Z===null?(K=N,Z=L):(K=N-(K-N),Z=L-(Z-L));const t=mr(K,Z,e[0],e[1]);return K=N-(K-N),Z=L-(Z-L),N=e[0],L=e[1],t},t(e){K===null||Z===null?(K=N,Z=L):(K=N-(K-N),Z=L-(Z-L));const t=mr(K,Z,N+e[0],L+e[1]);return N+=e[0],L+=e[1],t},A(e){const t=Qa(N,L,e);return N=e[5],L=e[6],t},a(e){e[5]+=N,e[6]+=L;const t=Qa(N,L,e);return N=e[5],L=e[6],t},L(e){return N=e[0],L=e[1],K=Z=null,Me(N,L)},l(e){return N+=e[0],L+=e[1],K=Z=null,Me(N,L)},H(e){return N=e[0],K=Z=null,Me(N,L)},h(e){return N+=e[0],K=Z=null,Me(N,L)},V(e){return L=e[0],K=Z=null,Me(N,L)},v(e){return L+=e[0],K=Z=null,Me(N,L)},Z(){const e=$t();return N=kn,L=An,e},z(){const e=$t();return N=kn,L=An,e}},Qa=(e,t,n)=>{const[r,i,s,o,c,l,a]=n,h=Uf(l,a,r,i,o,c,s,e,t),g=[];for(const f of h){const d=$f(...f);g.push(ke(...d))}return g},Uf=(e,t,n,r,i,s,o,c,l)=>{const a=o*(Math.PI/180),h=Math.sin(a),g=Math.cos(a);n=Math.abs(n),r=Math.abs(r),K=g*(c-e)*.5+h*(l-t)*.5,Z=g*(l-t)*.5-h*(c-e)*.5;let f=K*K/(n*n)+Z*Z/(r*r);f>1&&(f=Math.sqrt(f),n*=f,r*=f);const d=g/n,_=h/n,w=-h/r,x=g/r,y=d*c+_*l,P=w*c+x*l,v=d*e+_*t,S=w*e+x*t;let B=1/((v-y)*(v-y)+(S-P)*(S-P))-.25;B<0&&(B=0);let A=Math.sqrt(B);s===i&&(A=-A);const O=.5*(y+v)-A*(S-P),R=.5*(P+S)+A*(v-y),T=Math.atan2(P-R,y-O);let F=Math.atan2(S-R,v-O)-T;F<0&&s===1?F+=2*Math.PI:F>0&&s===0&&(F-=2*Math.PI);const D=Math.ceil(Math.abs(F/(Math.PI*.5+.001))),W=[];for(let j=0;j<D;j++){const z=T+j*F/D,Y=T+(j+1)*F/D;W[j]=[O,R,z,Y,n,r,h,g]}return W},$f=(e,t,n,r,i,s,o,c)=>{const l=c*i,a=-o*s,h=o*i,g=c*s,f=.5*(r-n),d=8/3*Math.sin(f*.5)*Math.sin(f*.5)/Math.sin(f),_=e+Math.cos(n)-d*Math.sin(n),w=t+Math.sin(n)+d*Math.cos(n),x=e+Math.cos(r),y=t+Math.sin(r),P=x+d*Math.sin(r),v=y-d*Math.cos(r);return[l*_+a*w,h*_+g*w,l*P+a*v,h*P+g*v,l*x+a*y,h*x+g*y]},Hf=e=>Mf(jf(e)),Wf=(e,t)=>[Xe(),t.graphicsState&&Ut(t.graphicsState),Mt(t.x,t.y),xn(Re(t.rotate)),wn(t.width,t.height),ts(Re(t.xSkew),Re(t.ySkew)),Va(e),Ye()].filter(Boolean),Gf=(e,t)=>[Xe(),t.graphicsState&&Ut(t.graphicsState),Mt(t.x,t.y),xn(Re(t.rotate)),wn(t.xScale,t.yScale),ts(Re(t.xSkew),Re(t.ySkew)),Va(e),Ye()].filter(Boolean),Vf=e=>{var t,n;return[Xe(),e.graphicsState&&Ut(e.graphicsState),e.color&&yr(e.color),br(e.thickness),gr((t=e.dashArray)!=null?t:[],(n=e.dashPhase)!=null?n:0),_t(e.start.x,e.start.y),e.lineCap&&pr(e.lineCap),_t(e.start.x,e.start.y),Me(e.end.x,e.end.y),_r(),Ye()].filter(Boolean)},Kf=e=>{var t,n;return[Xe(),e.graphicsState&&Ut(e.graphicsState),e.color&&is(e.color),e.borderColor&&yr(e.borderColor),br(e.borderWidth),e.borderLineCap&&pr(e.borderLineCap),gr((t=e.borderDashArray)!=null?t:[],(n=e.borderDashPhase)!=null?n:0),Mt(e.x,e.y),xn(Re(e.rotate)),ts(Re(e.xSkew),Re(e.ySkew)),_t(0,0),Me(0,e.height),Me(e.width,e.height),Me(e.width,0),$t(),e.color&&e.borderWidth?rs():e.color?ns():e.borderColor?_r():$t(),Ye()].filter(Boolean)},wr=4*((Math.sqrt(2)-1)/3),Zf=e=>{let t=ye(e.x),n=ye(e.y);const r=ye(e.xScale),i=ye(e.yScale);t-=r,n-=i;const s=r*wr,o=i*wr,c=t+r*2,l=n+i*2,a=t+r,h=n+i;return[Xe(),_t(t,h),ke(t,h-o,a-s,n,a,n),ke(a+s,n,c,h-o,c,h),ke(c,h+o,a+s,l,a,l),ke(a-s,l,t,h+o,t,h),Ye()]},qf=e=>{const t=ye(e.x),n=ye(e.y),r=ye(e.xScale),i=ye(e.yScale),s=-r,o=-i,c=r*wr,l=i*wr,a=s+r*2,h=o+i*2,g=s+r,f=o+i;return[Mt(t,n),xn(Re(e.rotate)),_t(s,f),ke(s,f-l,g-c,o,g,o),ke(g+c,o,a,f-l,a,f),ke(a,f+l,g+c,h,g,h),ke(g-c,h,s,f+l,s,f)]},Xf=e=>{var t,n,r;return[Xe(),e.graphicsState&&Ut(e.graphicsState),e.color&&is(e.color),e.borderColor&&yr(e.borderColor),br(e.borderWidth),e.borderLineCap&&pr(e.borderLineCap),gr((t=e.borderDashArray)!=null?t:[],(n=e.borderDashPhase)!=null?n:0),...e.rotate===void 0?Zf({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:ve(0)}),e.color&&e.borderWidth?rs():e.color?ns():e.borderColor?_r():$t(),Ye()].filter(Boolean)},Yf=(e,t)=>{var n,r,i;return[Xe(),t.graphicsState&&Ut(t.graphicsState),Mt(t.x,t.y),xn(Re((n=t.rotate)!=null?n:ve(0))),t.scale?wn(t.scale,-t.scale):wn(1,-1),t.color&&is(t.color),t.borderColor&&yr(t.borderColor),t.borderWidth&&br(t.borderWidth),t.borderLineCap&&pr(t.borderLineCap),gr((r=t.borderDashArray)!=null?r:[],(i=t.borderDashPhase)!=null?i:0),...Hf(e),t.color&&t.borderWidth?rs():t.color?ns():t.borderColor?_r():$t(),Ye()].filter(Boolean)},Jf={"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 yt=(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))(yt||{});const ec=class{constructor(e,t,n){p(this,"ref"),p(this,"doc"),p(this,"width"),p(this,"height"),p(this,"alreadyEmbedded",!1),p(this,"embedder"),E(e,"ref",[[se,"PDFRef"]]),E(t,"doc",[[ot,"PDFDocument"]]),E(n,"embedder",[[wi,"PDFPageEmbedder"]]),this.ref=e,this.doc=t,this.width=n.width,this.height=n.height,this.embedder=n}scale(e){return E(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 tc=ec;p(tc,"of",(e,t,n)=>new ec(e,t,n));const nc=class{constructor(e,t,n){p(this,"ref"),p(this,"doc"),p(this,"name"),p(this,"modified",!0),p(this,"embedder"),E(e,"ref",[[se,"PDFRef"]]),E(t,"doc",[[ot,"PDFDocument"]]),this.ref=e,this.doc=t,this.name=n.fontName,this.embedder=n}encodeText(e){return E(e,"text",["string"]),this.modified=!0,this.embedder.encodeText(e)}widthOfTextAtSize(e,t){return E(e,"text",["string"]),E(t,"size",["number"]),this.embedder.widthOfTextAtSize(e,t)}heightAtSize(e,t){var n;return E(e,"size",["number"]),M(t?.descender,"options.descender",["boolean"]),this.embedder.heightOfFontAtSize(e,{descender:(n=t?.descender)!=null?n:!0})}sizeAtHeight(e){return E(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 rc=nc;p(rc,"of",(e,t,n)=>new nc(e,t,n));const ic=class{constructor(e,t,n){p(this,"ref"),p(this,"doc"),p(this,"width"),p(this,"height"),p(this,"embedder"),p(this,"embedTask"),E(e,"ref",[[se,"PDFRef"]]),E(t,"doc",[[ot,"PDFDocument"]]),E(n,"embedder",[[ki,"JpegEmbedder"],[Ai,"PngEmbedder"]]),this.ref=e,this.doc=t,this.width=n.width,this.height=n.height,this.embedder=n}scale(e){return E(e,"factor",["number"]),{width:this.width*e,height:this.height*e}}scaleToFit(e,t){E(e,"width",["number"]),E(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 sc=ic;p(sc,"of",(e,t,n)=>new ic(e,t,n));const ss=class{constructor(e,t,n){p(this,"node"),p(this,"ref"),p(this,"doc"),p(this,"fontKey"),p(this,"font"),p(this,"fontSize",24),p(this,"fontColor",vn(0,0,0)),p(this,"lineHeight",24),p(this,"x",0),p(this,"y",0),p(this,"contentStream"),p(this,"contentStreamRef"),E(e,"leafNode",[[je,"PDFPageLeaf"]]),E(t,"ref",[[se,"PDFRef"]]),E(n,"doc",[[ot,"PDFDocument"]]),this.node=e,this.ref=t,this.doc=n}setRotation(e){const t=Tf(e);Hc(t,"degreesAngle",90),this.node.set(m.of("Rotate"),this.doc.context.obj(t))}getRotation(){const e=this.node.Rotate();return ve(e?e.asNumber():0)}setSize(e,t){E(e,"width",["number"]),E(t,"height",["number"]);const n=this.getMediaBox();this.setMediaBox(n.x,n.y,e,t);const r=this.getCropBox(),i=this.getBleedBox(),s=this.getTrimBox(),o=this.getArtBox(),c=this.node.CropBox(),l=this.node.BleedBox(),a=this.node.TrimBox(),h=this.node.ArtBox();c&&On(r,n)&&this.setCropBox(n.x,n.y,e,t),l&&On(i,n)&&this.setBleedBox(n.x,n.y,e,t),a&&On(s,n)&&this.setTrimBox(n.x,n.y,e,t),h&&On(o,n)&&this.setArtBox(n.x,n.y,e,t)}setWidth(e){E(e,"width",["number"]),this.setSize(e,this.getSize().height)}setHeight(e){E(e,"height",["number"]),this.setSize(this.getSize().width,e)}setMediaBox(e,t,n,r){E(e,"x",["number"]),E(t,"y",["number"]),E(n,"width",["number"]),E(r,"height",["number"]);const i=this.doc.context.obj([e,t,e+n,t+r]);this.node.set(m.MediaBox,i)}setCropBox(e,t,n,r){E(e,"x",["number"]),E(t,"y",["number"]),E(n,"width",["number"]),E(r,"height",["number"]);const i=this.doc.context.obj([e,t,e+n,t+r]);this.node.set(m.CropBox,i)}setBleedBox(e,t,n,r){E(e,"x",["number"]),E(t,"y",["number"]),E(n,"width",["number"]),E(r,"height",["number"]);const i=this.doc.context.obj([e,t,e+n,t+r]);this.node.set(m.BleedBox,i)}setTrimBox(e,t,n,r){E(e,"x",["number"]),E(t,"y",["number"]),E(n,"width",["number"]),E(r,"height",["number"]);const i=this.doc.context.obj([e,t,e+n,t+r]);this.node.set(m.TrimBox,i)}setArtBox(e,t,n,r){E(e,"x",["number"]),E(t,"y",["number"]),E(n,"width",["number"]),E(r,"height",["number"]);const i=this.doc.context.obj([e,t,e+n,t+r]);this.node.set(m.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){E(e,"x",["number"]),E(t,"y",["number"]),this.node.normalize(),this.getContentStream();const n=this.createContentStream(Xe(),Mt(e,t)),r=this.doc.context.register(n),i=this.createContentStream(Ye()),s=this.doc.context.register(i);this.node.wrapContentStreams(r,s)}scale(e,t){E(e,"x",["number"]),E(t,"y",["number"]),this.setSize(this.getWidth()*e,this.getHeight()*t),this.scaleContent(e,t),this.scaleAnnotations(e,t)}scaleContent(e,t){E(e,"x",["number"]),E(t,"y",["number"]),this.node.normalize(),this.getContentStream();const n=this.createContentStream(Xe(),wn(e,t)),r=this.doc.context.register(n),i=this.createContentStream(Ye()),s=this.doc.context.register(i);this.node.wrapContentStreams(r,s)}scaleAnnotations(e,t){E(e,"x",["number"]),E(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){E(e,"font",[[rc,"PDFFont"]]),this.font=e,this.fontKey=this.node.newFontDictionary(this.font.name,this.font.ref)}setFontSize(e){E(e,"fontSize",["number"]),this.fontSize=e}setFontColor(e){E(e,"fontColor",[[Object,"Color"]]),this.fontColor=e}setLineHeight(e){E(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){E(e,"x",["number"]),E(t,"y",["number"]),this.x=e,this.y=t}moveDown(e){E(e,"yDecrease",["number"]),this.y-=e}moveUp(e){E(e,"yIncrease",["number"]),this.y+=e}moveLeft(e){E(e,"xDecrease",["number"]),this.x-=e}moveRight(e){E(e,"xIncrease",["number"]),this.x+=e}pushOperators(...e){Cs(e,"operator",[[ne,"PDFOperator"]]),this.getContentStream().push(...e)}drawImage(e,t={}){var n,r,i,s,o,c,l;E(e,"image",[[sc,"PDFImage"]]),M(t.x,"options.x",["number"]),M(t.y,"options.y",["number"]),M(t.width,"options.width",["number"]),M(t.height,"options.height",["number"]),M(t.rotate,"options.rotate",[[Object,"Rotation"]]),M(t.xSkew,"options.xSkew",[[Object,"Rotation"]]),M(t.ySkew,"options.ySkew",[[Object,"Rotation"]]),Ge(t.opacity,"opacity.opacity",0,1),Ie(t.blendMode,"options.blendMode",yt);const a=this.node.newXObject("Image",e.ref),h=this.maybeEmbedGraphicsState({opacity:t.opacity,blendMode:t.blendMode});this.getContentStream().push(...Wf(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:(s=t.height)!=null?s:e.size().height,rotate:(o=t.rotate)!=null?o:ve(0),xSkew:(c=t.xSkew)!=null?c:ve(0),ySkew:(l=t.ySkew)!=null?l:ve(0),graphicsState:h}))}drawPage(e,t={}){var n,r,i,s,o;E(e,"embeddedPage",[[tc,"PDFEmbeddedPage"]]),M(t.x,"options.x",["number"]),M(t.y,"options.y",["number"]),M(t.xScale,"options.xScale",["number"]),M(t.yScale,"options.yScale",["number"]),M(t.width,"options.width",["number"]),M(t.height,"options.height",["number"]),M(t.rotate,"options.rotate",[[Object,"Rotation"]]),M(t.xSkew,"options.xSkew",[[Object,"Rotation"]]),M(t.ySkew,"options.ySkew",[[Object,"Rotation"]]),Ge(t.opacity,"opacity.opacity",0,1),Ie(t.blendMode,"options.blendMode",yt);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(...Gf(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:ve(0),xSkew:(s=t.xSkew)!=null?s:ve(0),ySkew:(o=t.ySkew)!=null?o:ve(0),graphicsState:l}))}drawSvgPath(e,t={}){var n,r,i,s,o,c,l,a,h;E(e,"path",["string"]),M(t.x,"options.x",["number"]),M(t.y,"options.y",["number"]),M(t.scale,"options.scale",["number"]),M(t.rotate,"options.rotate",[[Object,"Rotation"]]),M(t.borderWidth,"options.borderWidth",["number"]),M(t.color,"options.color",[[Object,"Color"]]),Ge(t.opacity,"opacity.opacity",0,1),M(t.borderColor,"options.borderColor",[[Object,"Color"]]),M(t.borderDashArray,"options.borderDashArray",[Array]),M(t.borderDashPhase,"options.borderDashPhase",["number"]),Ie(t.borderLineCap,"options.borderLineCap",Sn),Ge(t.borderOpacity,"options.borderOpacity",0,1),Ie(t.blendMode,"options.blendMode",yt);const g=this.maybeEmbedGraphicsState({opacity:t.opacity,borderOpacity:t.borderOpacity,blendMode:t.blendMode});!("color"in t)&&!("borderColor"in t)&&(t.borderColor=vn(0,0,0)),this.getContentStream().push(...Yf(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:ve(0),color:(s=t.color)!=null?s:void 0,borderColor:(o=t.borderColor)!=null?o: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:g}))}drawLine(e){var t,n,r,i,s;E(e.start,"options.start",[[Object,"{ x: number, y: number }"]]),E(e.end,"options.end",[[Object,"{ x: number, y: number }"]]),E(e.start.x,"options.start.x",["number"]),E(e.start.y,"options.start.y",["number"]),E(e.end.x,"options.end.x",["number"]),E(e.end.y,"options.end.y",["number"]),M(e.thickness,"options.thickness",["number"]),M(e.color,"options.color",[[Object,"Color"]]),M(e.dashArray,"options.dashArray",[Array]),M(e.dashPhase,"options.dashPhase",["number"]),Ie(e.lineCap,"options.lineCap",Sn),Ge(e.opacity,"opacity.opacity",0,1),Ie(e.blendMode,"options.blendMode",yt);const o=this.maybeEmbedGraphicsState({borderOpacity:e.opacity,blendMode:e.blendMode});"color"in e||(e.color=vn(0,0,0)),this.getContentStream().push(...Vf({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:(s=e.lineCap)!=null?s:void 0,graphicsState:o}))}drawRectangle(e={}){var t,n,r,i,s,o,c,l,a,h,g,f,d;M(e.x,"options.x",["number"]),M(e.y,"options.y",["number"]),M(e.width,"options.width",["number"]),M(e.height,"options.height",["number"]),M(e.rotate,"options.rotate",[[Object,"Rotation"]]),M(e.xSkew,"options.xSkew",[[Object,"Rotation"]]),M(e.ySkew,"options.ySkew",[[Object,"Rotation"]]),M(e.borderWidth,"options.borderWidth",["number"]),M(e.color,"options.color",[[Object,"Color"]]),Ge(e.opacity,"opacity.opacity",0,1),M(e.borderColor,"options.borderColor",[[Object,"Color"]]),M(e.borderDashArray,"options.borderDashArray",[Array]),M(e.borderDashPhase,"options.borderDashPhase",["number"]),Ie(e.borderLineCap,"options.borderLineCap",Sn),Ge(e.borderOpacity,"options.borderOpacity",0,1),Ie(e.blendMode,"options.blendMode",yt);const _=this.maybeEmbedGraphicsState({opacity:e.opacity,borderOpacity:e.borderOpacity,blendMode:e.blendMode});!("color"in e)&&!("borderColor"in e)&&(e.color=vn(0,0,0)),this.getContentStream().push(...Kf({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:(s=e.rotate)!=null?s:ve(0),xSkew:(o=e.xSkew)!=null?o:ve(0),ySkew:(c=e.ySkew)!=null?c:ve(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:(g=e.borderDashArray)!=null?g:void 0,borderDashPhase:(f=e.borderDashPhase)!=null?f:void 0,graphicsState:_,borderLineCap:(d=e.borderLineCap)!=null?d:void 0}))}drawSquare(e={}){const{size:t}=e;M(t,"size",["number"]),this.drawRectangle({...e,width:t,height:t})}drawEllipse(e={}){var t,n,r,i,s,o,c,l,a,h,g;M(e.x,"options.x",["number"]),M(e.y,"options.y",["number"]),M(e.xScale,"options.xScale",["number"]),M(e.yScale,"options.yScale",["number"]),M(e.rotate,"options.rotate",[[Object,"Rotation"]]),M(e.color,"options.color",[[Object,"Color"]]),Ge(e.opacity,"opacity.opacity",0,1),M(e.borderColor,"options.borderColor",[[Object,"Color"]]),Ge(e.borderOpacity,"options.borderOpacity",0,1),M(e.borderWidth,"options.borderWidth",["number"]),M(e.borderDashArray,"options.borderDashArray",[Array]),M(e.borderDashPhase,"options.borderDashPhase",["number"]),Ie(e.borderLineCap,"options.borderLineCap",Sn),Ie(e.blendMode,"options.blendMode",yt);const f=this.maybeEmbedGraphicsState({opacity:e.opacity,borderOpacity:e.borderOpacity,blendMode:e.blendMode});!("color"in e)&&!("borderColor"in e)&&(e.color=vn(0,0,0)),this.getContentStream().push(...Xf({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:(s=e.rotate)!=null?s:void 0,color:(o=e.color)!=null?o: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:(g=e.borderLineCap)!=null?g:void 0,graphicsState:f}))}drawCircle(e={}){const{size:t=100}=e;M(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 Ot.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 s=0,o=r.length;s<o;s++){const c=e.lookup(m.of(r[s]));c instanceof J&&c.scalePDFNumbers(t,n)}const i=e.lookup(m.of("InkList"));if(i instanceof J)for(let s=0,o=i.size();s<o;s++){const c=i.lookup(s);c instanceof J&&c.scalePDFNumbers(t,n)}}};let Ht=ss;p(Ht,"of",(e,t,n)=>new ss(e,t,n)),p(Ht,"create",e=>{E(e,"doc",[[ot,"PDFDocument"]]);const t=se.of(-1),n=je.withContextAndParent(e.context,t),r=e.context.register(n);return new ss(n,r,e)});const oc=class{constructor(e,t,n){p(this,"ref"),p(this,"doc"),p(this,"alreadyEmbedded",!1),p(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(m.of("Names"))||e.set(m.of("Names"),t.obj({}));const r=e.lookup(m.of("Names"),V);r.has(m.of("JavaScript"))||r.set(m.of("JavaScript"),t.obj({}));const i=r.lookup(m.of("JavaScript"),V);i.has(m.of("Names"))||i.set(m.of("Names"),t.obj([]));const s=i.lookup(m.of("Names"),J);s.push(X.fromText(this.embedder.scriptName)),s.push(n),this.alreadyEmbedded=!0}}};let ac=oc;p(ac,"of",(e,t,n)=>new oc(e,t,n));class os{constructor(t,n){p(this,"script"),p(this,"scriptName"),this.script=t,this.scriptName=n}static for(t,n){return new os(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 ot{constructor(t,n){if(p(this,"context"),p(this,"catalog"),p(this,"isEncrypted"),p(this,"defaultWordBreaks",[" "]),p(this,"fontkit"),p(this,"pageCount"),p(this,"pageCache"),p(this,"pageMap"),p(this,"fonts"),p(this,"images"),p(this,"embeddedPages"),p(this,"embeddedFiles"),p(this,"javaScripts"),p(this,"computePages",()=>{const r=[];return this.catalog.Pages().traverse((i,s)=>{if(i instanceof je){let o=this.pageMap.get(i);o||(o=Ht.of(i,s,this),this.pageMap.set(i,o)),r.push(o)}}),r}),E(t,"context",[[pi,"PDFContext"]]),E(n,"ignoreEncryption",["boolean"]),this.context=t,this.catalog=t.lookup(t.trailerInfo.Root),this.isEncrypted=!!t.lookup(t.trailerInfo.Encrypt),this.pageCache=vt.populatedBy(this.computePages),this.pageMap=new Map,this.fonts=[],this.images=[],this.embeddedPages=[],this.embeddedFiles=[],this.javaScripts=[],!n&&this.isEncrypted)throw new Ff}static async load(t,n={}){const{ignoreEncryption:r=!1,parseSpeed:i=100,throwOnInvalidObject:s=!1,updateMetadata:o=!0,capNumbers:c=!1}=n;E(t,"pdf",["string",Uint8Array,ArrayBuffer]),E(r,"ignoreEncryption",["boolean"]),E(i,"parseSpeed",["number"]),E(s,"throwOnInvalidObject",["boolean"]);const l=Dc(t),a=await La.forBytesWithOptions(l,i,s,c).parseDocument();return new ot(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 Je(t,"index",0,n.length-1),n[t]}getPageIndices(){return Pc(0,this.getPageCount())}removePage(t){const n=this.getPageCount();if(this.pageCount===0)throw new Lf;Je(t,"index",0,n-1),this.catalog.removeLeafNode(t),this.pageCount=n-1}addPage(t){return E(t,"page",["undefined",[Ht,"PDFPage"],Array]),this.insertPage(this.getPageCount(),t)}insertPage(t,n){const r=this.getPageCount();if(Je(t,"index",0,r),E(n,"page",["undefined",[Ht,"PDFPage"],Array]),!n||Array.isArray(n)){const s=Array.isArray(n)?n:Jf.A4;n=Ht.create(this),n.setSize(...s)}else if(n.doc!==this)throw new Nf;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){E(t,"name",["string"]),E(n,"script",["string"]);const r=os.for(n,t),i=this.context.nextRef(),s=ac.of(i,this,r);this.javaScripts.push(s)}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:s=!0}=t;return E(n,"useObjectStreams",["boolean"]),E(r,"addDefaultPage",["boolean"]),E(i,"objectsPerTick",["number"]),E(s,"updateFieldAppearances",["boolean"]),r&&this.getPageCount()===0&&this.addPage(),await this.flush(),(n?ma:yi).forContext(this.context,i).serializeToBuffer()}async saveAsBase64(t={}){const{dataUri:n=!1,...r}=t;E(n,"dataUri",["boolean"]);const i=await this.save(r),s=Sc(i);return n?`data:application/pdf;base64,${s}`:s}findPageForAnnotationRef(t){const n=this.getPages();for(let r=0,i=n.length;r<i;r++){const s=n[r],o=s.node.Annots();if(o?.indexOf(t)!==void 0)return s}}async embedAll(t){for(let n=0,r=t.length;n<r;n++)await t[n].embed()}}class Qf{static async serializeAnnotationsToPdf(t,n){const r=await ot.load(t),i=r.getPages(),s=n.filter(c=>c.annotationType===10||c.annotationType===11),o=n.filter(c=>c.annotationType===5);for(const c of s)await this.addUnderlineAnnotation(r,i,c);for(const c of o)await this.addRectangleAnnotation(r,i,c);return await r.save()}static async addUnderlineAnnotation(t,n,r){const i=n[r.pageIndex??0],{height:s}=i.getSize(),o=this.convertRectToPdfCoords(r.rect,s),c=this.convertQuadPointsToPdfCoords(r.quadPoints||[],s),l=t.context.obj({Type:"Annot",Subtype:r.annotationType===10?"Underline":"StrikeOut",Rect:o,QuadPoints:c,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`)}),a=t.context.register(l);let h=i.node.lookup(m.of("Annots"));h||(h=t.context.obj([]),i.node.set(m.of("Annots"),h)),h instanceof J&&h.push(a)}static async addRectangleAnnotation(t,n,r){const i=n[r.pageIndex??0],{height:s}=i.getSize(),o=this.convertRectToPdfCoords(r.rect,s),c=r.borderColor||r.color,l=r.backgroundColor,a={Type:"Annot",Subtype:"Square",Rect:o,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 _={1:"S",2:"D",3:"B",4:"I",5:"U"};d.S=m.of(_[r.borderStyle.style]||"S")}r.borderStyle.dashArray&&r.borderStyle.dashArray.length>0&&(d.D=r.borderStyle.dashArray),a.BS=t.context.obj(d)}r.opacity!==void 0&&r.opacity<1&&(a.CA=r.opacity),r.contents&&(a.Contents=X.fromText(r.contents)),r.creationDate&&(a.CreationDate=X.fromText(r.creationDate.toString())),r.modificationDate&&(a.M=X.fromText(r.modificationDate.toString()));const h=t.context.obj(a),g=t.context.register(h);let f=i.node.lookup(m.of("Annots"));f||(f=t.context.obj([]),i.node.set(m.of("Annots"),f)),f instanceof J&&f.push(g)}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}}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 as;(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"})(as||(as={})),be.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"}(be.AnnotationType||(be.AnnotationType={})),be.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"}(be.AnnotationFlag||(be.AnnotationFlag={}));const eu={ANNOTATIONS:"annotations"},Cn=Symbol("VPV Shared UIs"),cc=Symbol("VPV Current Localization"),Bn=as,lc={Black:"#000000",DarkGray:"#444444",Gray:"#696969",LightGray:"#9C9C9C",LightestGray:"#CDCDCD",White:"#FFFFFF"},Ee={...lc,Purple:"#7862FF",Blue:"#1777FF",Red:"#F66365",Orange:"#F67E63",Yellow:"#F5C463",Green:"#48BB77"},Te={Purple:"#CAAAFF",Cyan:"#65EDE9",Red:"#FFACAC",Orange:"#FFBD82",Yellow:"#FCE244",Green:"#A0F751",...lc},tu={[Te.Purple]:"Purple",[Te.Cyan]:"Cyan",[Te.Red]:"Red",[Te.Orange]:"Orange",[Te.Yellow]:"Yellow",[Te.Green]:"Green",[Te.Black]:"Black",[Te.DarkGray]:"Dark Gray",[Te.Gray]:"Gray",[Te.LightGray]:"Light Gray",[Te.LightestGray]:"Lightest Gray",[Te.White]:"White"},nu={[Ee.Black]:"Black",[Ee.DarkGray]:"Dark Gray",[Ee.Gray]:"Gray",[Ee.LightGray]:"Light Gray",[Ee.LightestGray]:"Lightest Gray",[Ee.White]:"White",[Ee.Purple]:"Purple",[Ee.Blue]:"Blue",[Ee.Red]:"Red",[Ee.Orange]:"Orange",[Ee.Yellow]:"Yellow",[Ee.Green]:"Green"},ru="pdfjs_internal_editor_",Gt=(e,t)=>`${e}-${t}`,iu={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"},su=e=>e.startsWith("#")||e.startsWith("0x")?e:iu[e]||e,En=u.defineComponent({__name:"AppTooltip",setup(e){const t=u.inject(Cn),n=u.computed(()=>t?.AppTooltip);return(r,i)=>n.value?(u.openBlock(),u.createBlock(u.resolveDynamicComponent(n.value),u.normalizeProps(u.mergeProps({key:0},r.$attrs)),u.createSlots({default:u.withCtx(()=>[u.renderSlot(r.$slots,"default")]),_:2},[u.renderList(r.$slots,(s,o)=>({name:o,fn:u.withCtx(()=>[u.renderSlot(r.$slots,o)])}))]),1040)):(u.openBlock(),u.createElementBlock("div",u.normalizeProps(u.mergeProps({key:1},r.$attrs)),[u.renderSlot(r.$slots,"default")],16))}}),Tn=u.defineComponent({__name:"AppButton",setup(e){const t=u.inject(Cn),n=u.computed(()=>t?.AppButton);return(r,i)=>n.value?(u.openBlock(),u.createBlock(u.resolveDynamicComponent(n.value),u.normalizeProps(u.mergeProps({key:0},r.$attrs)),{default:u.withCtx(()=>[u.renderSlot(r.$slots,"default")]),_:3},16)):(u.openBlock(),u.createElementBlock("button",u.normalizeProps(u.mergeProps({key:1},r.$attrs)),[u.renderSlot(r.$slots,"default")],16))}}),ou=(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)))})},au=u.defineComponent({__name:"Icon",props:{name:{}},setup(e){const t=e,n=u.defineAsyncComponent({loader:()=>ou(Object.assign({"../assets/icons/annotations.svg":()=>Promise.resolve().then(()=>xu),"../assets/icons/tool-comment.svg":()=>Promise.resolve().then(()=>vu),"../assets/icons/tool-free-text.svg":()=>Promise.resolve().then(()=>Au),"../assets/icons/tool-highlight.svg":()=>Promise.resolve().then(()=>Bu),"../assets/icons/tool-image.svg":()=>Promise.resolve().then(()=>Tu),"../assets/icons/tool-signature.svg":()=>Promise.resolve().then(()=>Du),"../assets/icons/tool-strikethrough.svg":()=>Promise.resolve().then(()=>Iu),"../assets/icons/tool-text-selection.svg":()=>Promise.resolve().then(()=>zu),"../assets/icons/tool-underline.svg":()=>Promise.resolve().then(()=>Nu)}),`../assets/icons/${t.name}.svg`)});return(r,i)=>(u.openBlock(),u.createBlock(u.resolveDynamicComponent(u.unref(n)),{class:"vp-text-xl"}))}}),Gu="",cs=(e,t)=>{const n=e.__vccOpts||e;for(const[r,i]of t)n[r]=i;return n},at=cs(au,[["__scopeId","data-v-9d5f0033"]]),Pn=()=>{const e=u.inject(cc,u.computed(()=>({})));return{t:u.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:u.computed(()=>e.value)}},cu=u.defineComponent({__name:"ToolAnnotation",emits:["toggle"],setup(e,{emit:t}){const{t:n}=Pn(),r=t,i=u.ref(!1),s=()=>{i.value=!i.value,r("toggle",i.value)};return(o,c)=>o.$slots.default?u.renderSlot(o.$slots,"default",{key:0,onClick:s},void 0,!0):(u.openBlock(),u.createBlock(En,{key:1},{content:u.withCtx(()=>[u.createTextVNode(u.toDisplayString(i.value?u.unref(n)("annotationToggleHideTooltip"):u.unref(n)("annotationToggleShowTooltip")),1)]),default:u.withCtx(()=>[u.createVNode(Tn,{"aria-label":i.value?u.unref(n)("annotationToggleHideTooltip"):u.unref(n)("annotationToggleShowTooltip"),class:u.normalizeClass(["vpv-toolbar-btn",{"vpv-toolbar-btn-active":i.value}]),onClick:s},{default:u.withCtx(()=>[u.createVNode(at,{name:"annotations",class:"vp-text-xl"})]),_:1},8,["aria-label","class"])]),_:1}))}}),Vu="",lu=cs(cu,[["__scopeId","data-v-df5778ee"]]),hu=u.defineComponent({__name:"ToolAnnotationTextSelection",props:{active:{type:Boolean,required:!0},activeModifiers:{}},emits:["update:active"],setup(e){const t=u.useModel(e,"active"),{t:n}=Pn(),r=u.useAttrs(),i=u.computed(()=>r["aria-disabled"]===!0),s=()=>{i.value||(t.value=!t.value)};return(o,c)=>o.$slots.default?u.renderSlot(o.$slots,"default",u.mergeProps({key:0},o.$attrs,{onClick:s})):(u.openBlock(),u.createBlock(En,{key:1},{content:u.withCtx(()=>[u.createTextVNode(u.toDisplayString(u.unref(n)("annotationTextSelectionTooltip")),1)]),default:u.withCtx(()=>[u.createVNode(Tn,u.mergeProps({"aria-label":u.unref(n)("annotationTextSelectionLabel"),class:["vpv-toolbar-btn",{"vpv-toolbar-btn-active":t.value}]},o.$attrs,{onClick:s}),{default:u.withCtx(()=>[u.renderSlot(o.$slots,"icon",{},()=>[u.createVNode(at,{name:"tool-text-selection"})])]),_:3},16,["aria-label","class"])]),_:3}))}}),du=u.defineComponent({__name:"AppPopover",setup(e){const t=u.inject(Cn),n=u.computed(()=>t?.AppPopover);return(r,i)=>n.value?(u.openBlock(),u.createBlock(u.resolveDynamicComponent(n.value),u.normalizeProps(u.mergeProps({key:0},r.$attrs)),{trigger:u.withCtx(()=>[u.renderSlot(r.$slots,"trigger")]),default:u.withCtx(()=>[u.renderSlot(r.$slots,"default")]),_:3},16)):(u.openBlock(),u.createElementBlock("button",u.normalizeProps(u.mergeProps({key:1},r.$attrs)),[u.renderSlot(r.$slots,"default")],16))}}),fu=u.defineComponent({__name:"AppSignatures",setup(e){const t=u.inject(Cn),n=u.computed(()=>t?.AppSignatures);return(r,i)=>n.value?(u.openBlock(),u.createBlock(u.resolveDynamicComponent(n.value),u.normalizeProps(u.mergeProps({key:0},r.$attrs)),null,16)):u.createCommentVNode("",!0)}}),uu=u.defineComponent({__name:"ToolAnnotationSignature",props:{active:{type:Boolean,required:!0},activeModifiers:{}},emits:["update:active"],setup(e){const t=u.useModel(e,"active"),{t:n}=Pn(),r=u.useAttrs(),i=u.ref(!1),s=u.computed(()=>r["aria-disabled"]===!0),o=()=>{s.value||(!t.value&&!i.value&&(i.value=!0),t.value=!t.value)},c=l=>{i.value=!1};return(l,a)=>l.$slots.default?u.renderSlot(l.$slots,"default",u.mergeProps({key:0},l.$attrs,{onClick:o})):(u.openBlock(),u.createBlock(du,{key:1,open:i.value,side:"right",sideOffset:10,class:"vpv-annotation-signatures__popover",onInteractOutside:c},{trigger:u.withCtx(()=>[u.createVNode(En,null,{content:u.withCtx(()=>[u.createTextVNode(u.toDisplayString(u.unref(n)("annotationSignatureTooltip")),1)]),default:u.withCtx(()=>[u.createVNode(Tn,u.mergeProps({"aria-label":u.unref(n)("annotationSignatureLabel"),class:["vpv-toolbar-btn",{"vpv-toolbar-btn-active":t.value}]},l.$attrs,{onClick:o}),{default:u.withCtx(()=>[u.renderSlot(l.$slots,"icon",{},()=>[u.createVNode(at,{name:"tool-signature"})])]),_:3},16,["aria-label","class"])]),_:3})]),default:u.withCtx(()=>[u.createVNode(fu)]),_:3},8,["open"]))}}),gu=u.defineComponent({__name:"ToolAnnotationFreeText",props:{active:{type:Boolean,required:!0},activeModifiers:{}},emits:["update:active"],setup(e){const t=u.useModel(e,"active"),{t:n}=Pn(),r=u.useAttrs(),i=u.computed(()=>r["aria-disabled"]===!0),s=()=>{i.value||(t.value=!t.value)};return(o,c)=>o.$slots.default?u.renderSlot(o.$slots,"default",u.mergeProps({key:0},o.$attrs,{onClick:s})):(u.openBlock(),u.createBlock(En,{key:1},{content:u.withCtx(()=>[u.createTextVNode(u.toDisplayString(u.unref(n)("annotationFreeTextTooltip")),1)]),default:u.withCtx(()=>[u.createVNode(Tn,u.mergeProps({"aria-label":u.unref(n)("annotationFreeTextLabel"),class:["vpv-toolbar-btn",{"vpv-toolbar-btn-active":t.value}]},o.$attrs,{onClick:s}),{default:u.withCtx(()=>[u.renderSlot(o.$slots,"icon",{},()=>[u.createVNode(at,{name:"tool-free-text"})])]),_:3},16,["aria-label","class"])]),_:3}))}}),pu=u.defineComponent({__name:"ToolAnnotationImage",emits:["change"],setup(e,{emit:t}){const{t:n}=Pn(),r=t,i=u.useAttrs(),s=u.computed(()=>i["aria-disabled"]===!0),o=()=>{if(s.value)return;const c=document.createElement("input");c.type="file",c.accept="image/*",c.onchange=l=>{const a=l.target.files?.[0];r("change",a)},c.click()};return(c,l)=>c.$slots.default?u.renderSlot(c.$slots,"default",u.mergeProps({key:0},c.$attrs,{onClick:o})):(u.openBlock(),u.createBlock(En,{key:1},{content:u.withCtx(()=>[u.createTextVNode(u.toDisplayString(u.unref(n)("annotationImageTooltip")),1)]),default:u.withCtx(()=>[u.createVNode(Tn,u.mergeProps({"aria-label":u.unref(n)("annotationImageLabel"),class:"vpv-toolbar-btn"},c.$attrs,{onClick:o}),{default:u.withCtx(()=>[u.renderSlot(c.$slots,"icon",{},()=>[u.createVNode(at,{name:"tool-image"})])]),_:3},16,["aria-label"])]),_:3}))}}),Ku="",bu={class:"vpv-annotation-tools-container"},mu={key:0,class:"vpv-annotation-tools"},_u=u.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=u.ref(!1),s=k=>Gt(n.instanceId,k),o={textSelection:new CustomEvent(s(Wt.textSelection),{detail:{active:!1,colors:null,highlight:null,strikethrough:null,underline:null}}),freeText:new CustomEvent(s(Wt.freeText),{detail:{active:!1,fontColors:null,fontSizes:null}}),signature:new CustomEvent(s(Wt.signature),{detail:{active:!1}}),image:new CustomEvent(s(Wt.image),{detail:{file:void 0}})},c=u.ref(!1),l=u.reactive({textSelection:!1,freeText:!1,signature:!1}),a=u.computed({get:()=>l.textSelection,set:k=>{l.textSelection=k,k&&(l.freeText=!1,l.signature=!1),A()}}),h=u.computed({get:()=>l.freeText,set:k=>{k&&(l.textSelection=!1,l.signature=!1),l.freeText=k,A()}}),g=u.computed({get:()=>l.signature,set:k=>{k&&(l.textSelection=!1,l.freeText=!1),l.signature=k,A()}}),f=u.computed(()=>n.textSelection),d=u.computed(()=>n.freeText),_=u.computed(()=>n.signature),w=u.computed(()=>n.image);function x(k){return k.map(F=>typeof F=="string"?{value:su(F),label:F}:F)}const y=k=>{c.value=k,k||(a.value=!1,h.value=!1,g.value=!1)},P=Object.entries(tu).map(([k,F])=>({value:k,label:F})),v=k=>{r("textSelection",k),o.textSelection.detail.active=k,o.textSelection.detail.colors=P;let F={icon:u.markRaw(u.h(at,{name:"tool-highlight"}))},D={icon:u.markRaw(u.h(at,{name:"tool-strikethrough"}))},W={icon:u.markRaw(u.h(at,{name:"tool-underline"}))};if(typeof n.textSelection=="object"){const{highlight:j,strikethrough:z,underline:Y}=n.textSelection;j===!1?F=!1:typeof j=="object"&&(F={...F,...j},j.icon&&typeof j.icon=="object"&&(F.icon=u.markRaw(j.icon))),z===!1?D=!1:typeof z=="object"&&(D={...D,...z},z.icon&&typeof z.icon=="object"&&(D.icon=u.markRaw(z.icon))),Y===!1?W=!1:typeof Y=="object"&&(W={...W,...Y},Y.icon&&typeof Y.icon=="object"&&(W.icon=u.markRaw(Y.icon)))}o.textSelection.detail.highlight=F,o.textSelection.detail.strikethrough=D,o.textSelection.detail.underline=W,window.dispatchEvent(o.textSelection)},S=k=>{r("freeText",k),o.freeText.detail.active=k;let F=Object.entries(nu).map(([D,W])=>({value:D,label:W}));typeof n.freeText=="object"&&n.freeText?.fontColors&&(F=x(n.freeText.fontColors)),o.freeText.detail.fontColors=F,typeof n.freeText=="object"&&n.freeText?.fontSizes?.length&&(o.freeText.detail.fontSizes=n.freeText.fontSizes),window.dispatchEvent(o.freeText)},I=k=>{r("signature",k),o.signature.detail.active=k,window.dispatchEvent(o.signature)},B=k=>{l.textSelection=!1,l.freeText=!1,l.signature=!1,r("image",k),o.image.detail.file=k,window.dispatchEvent(o.image)};function A(){v(a.value),S(h.value),I(g.value)}const O=Gt(n.instanceId,Bn.Rotate);u.onMounted(()=>{window.dispatchEvent(new CustomEvent(Gt(n.instanceId,Bn.AnnotationMounted))),window.addEventListener(O,R)});function R(k){const{firstPageRotation:F,rotation:D}=k.detail;i.value=D!==0}u.watch(i,k=>{k&&(l.textSelection=!1,l.freeText=!1,l.signature=!1,A())});const T=k=>{const{id:F,...D}=k;return{...D,id:F?.startsWith(ru)?null:F}};return u.watch(()=>n.onAnnotationCreated,(k,F,D)=>{if(!k)return;const W=z=>{k(T(z.detail))},j=Gt(n.instanceId,Bn.AnnotationCreated);window.addEventListener(j,W),D(()=>{window.removeEventListener(j,W)})},{immediate:!0}),u.watch(()=>n.onAnnotationUpdated,(k,F,D)=>{if(!k)return;const W=z=>{k(T(z.detail))},j=Gt(n.instanceId,Bn.AnnotationUpdated);window.addEventListener(j,W),D(()=>{window.removeEventListener(j,W)})},{immediate:!0}),u.watch(()=>n.onAnnotationDeleted,(k,F,D)=>{if(!k)return;const W=z=>{k(T(z.detail))},j=Gt(n.instanceId,Bn.AnnotationDeleted);window.addEventListener(j,W),D(()=>{window.removeEventListener(j,W)})},{immediate:!0}),u.onUnmounted(()=>{window.removeEventListener(O,R)}),(k,F)=>(u.openBlock(),u.createElementBlock("div",bu,[u.createVNode(lu,{onToggle:y}),u.createVNode(u.Transition,{name:"slide"},{default:u.withCtx(()=>[c.value?(u.openBlock(),u.createElementBlock("div",mu,[f.value?(u.openBlock(),u.createBlock(hu,{key:0,active:a.value,"onUpdate:active":F[0]||(F[0]=D=>a.value=D),"aria-disabled":i.value},u.createSlots({_:2},[typeof n.textSelection=="object"&&n.textSelection.icon?{name:"icon",fn:u.withCtx(()=>[typeof n.textSelection=="object"&&n.textSelection.icon?(u.openBlock(),u.createBlock(u.resolveDynamicComponent(n.textSelection.icon),{key:0})):u.createCommentVNode("",!0)]),key:"0"}:typeof n.textSelection=="object"&&n.textSelection.component?{name:"default",fn:u.withCtx(({onClick:D})=>[typeof n.textSelection=="object"&&n.textSelection.component?(u.openBlock(),u.createBlock(u.resolveDynamicComponent(n.textSelection.component),{key:0,onClick:D},null,8,["onClick"])):u.createCommentVNode("",!0)]),key:"1"}:void 0]),1032,["active","aria-disabled"])):u.createCommentVNode("",!0),d.value?(u.openBlock(),u.createBlock(gu,{key:1,active:h.value,"onUpdate:active":F[1]||(F[1]=D=>h.value=D),"aria-disabled":i.value},u.createSlots({_:2},[typeof n.freeText=="object"&&n.freeText.icon?{name:"icon",fn:u.withCtx(()=>[typeof n.freeText=="object"&&n.freeText.icon?(u.openBlock(),u.createBlock(u.resolveDynamicComponent(n.freeText.icon),{key:0})):u.createCommentVNode("",!0),typeof n.freeText=="object"&&n.freeText.icon?(u.openBlock(),u.createBlock(u.resolveDynamicComponent(n.freeText.icon),{key:1})):u.createCommentVNode("",!0)]),key:"0"}:typeof n.freeText=="object"&&n.freeText.component?{name:"default",fn:u.withCtx(({onClick:D})=>[typeof n.freeText=="object"&&n.freeText.component?(u.openBlock(),u.createBlock(u.resolveDynamicComponent(n.freeText.component),{key:0,onClick:D},null,8,["onClick"])):u.createCommentVNode("",!0)]),key:"1"}:void 0]),1032,["active","aria-disabled"])):u.createCommentVNode("",!0),w.value?(u.openBlock(),u.createBlock(pu,{key:2,onChange:B,"aria-disabled":i.value},u.createSlots({_:2},[typeof n.image=="object"&&n.image?{name:"icon",fn:u.withCtx(()=>[typeof n.image=="object"&&n.image.icon?(u.openBlock(),u.createBlock(u.resolveDynamicComponent(n.image.icon),{key:0})):u.createCommentVNode("",!0)]),key:"0"}:typeof n.image=="object"&&n.image&&"component"in n.image?{name:"default",fn:u.withCtx(({onClick:D})=>[typeof n.image=="object"&&n.image&&"component"in n.image?(u.openBlock(),u.createBlock(u.resolveDynamicComponent(n.image.component),{key:0,onClick:D},null,8,["onClick"])):u.createCommentVNode("",!0)]),key:"1"}:void 0]),1032,["aria-disabled"])):u.createCommentVNode("",!0),_.value?(u.openBlock(),u.createBlock(uu,{key:3,active:g.value,"onUpdate:active":F[2]||(F[2]=D=>g.value=D),"aria-disabled":i.value},u.createSlots({_:2},[typeof n.signature=="object"&&n.signature.icon?{name:"icon",fn:u.withCtx(()=>[typeof n.signature=="object"&&n.signature.icon?(u.openBlock(),u.createBlock(u.resolveDynamicComponent(n.signature.icon),{key:0})):u.createCommentVNode("",!0)]),key:"0"}:typeof n.signature=="object"&&n.signature.component?{name:"default",fn:u.withCtx(({onClick:D})=>[typeof n.signature=="object"&&n.signature.component?(u.openBlock(),u.createBlock(u.resolveDynamicComponent(n.signature.component),{key:0,onClick:D},null,8,["onClick"])):u.createCommentVNode("",!0)]),key:"1"}:void 0]),1032,["active","aria-disabled"])):u.createCommentVNode("",!0)])):u.createCommentVNode("",!0)]),_:1})]))}}),Zu="",hc=cs(_u,[["__scopeId","data-v-8583d7e5"]]),yu=(e={})=>{const{textSelection:t,freeText:n,image:r,...i}=e;let s=null;return{name:"annotation",setup(o){const{componentInstance:c,shared:l}=o,a=c?.uid??0;o.toolbar.addItem({id:eu.ANNOTATIONS,toolbarDirection:"left",component:u.h(hc,{textSelection:t,freeText:n,image:r,instanceId:a,...i})});const h=c?.appContext.app;l.ui?h.provide(Cn,l.ui):console.warn("VPdfAnnotationPlugin - No UI context found in plugin context"),l.localization?.value?h.provide(cc,l.localization):console.warn("VPdfAnnotationPlugin - No localization found in plugin context"),l.pdf||console.warn("VPdfAnnotationPlugin - PDF context not available"),s={exportToPdf:async g=>{const f=await l.pdf?.getOriginalBytes();return f?await Qf.serializeAnnotationsToPdf(f,g):null}}},getApi:()=>s}},wu={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"none",viewBox:"0 0 20 20"};function dc(e,t){return u.openBlock(),u.createElementBlock("svg",wu,[...t[0]||(t[0]=[u.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),u.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),u.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 xu=Object.freeze(Object.defineProperty({__proto__:null,render:dc,default:{render:dc}},Symbol.toStringTag,{value:"Module"})),Su={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"none",viewBox:"0 0 20 20"};function fc(e,t){return u.openBlock(),u.createElementBlock("svg",Su,[...t[0]||(t[0]=[u.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),u.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 vu=Object.freeze(Object.defineProperty({__proto__:null,render:fc,default:{render:fc}},Symbol.toStringTag,{value:"Module"})),ku={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"none",viewBox:"0 0 20 20"};function uc(e,t){return u.openBlock(),u.createElementBlock("svg",ku,[...t[0]||(t[0]=[u.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),u.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 Au=Object.freeze(Object.defineProperty({__proto__:null,render:uc,default:{render:uc}},Symbol.toStringTag,{value:"Module"})),Cu={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"none",viewBox:"0 0 20 20"};function gc(e,t){return u.openBlock(),u.createElementBlock("svg",Cu,[...t[0]||(t[0]=[u.createElementVNode("g",{"clip-path":"url(#a)"},[u.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),u.createElementVNode("defs",null,[u.createElementVNode("clipPath",{id:"a"},[u.createElementVNode("path",{fill:"currentColor",d:"M0 0h20v20H0z"})])],-1)])])}const Bu=Object.freeze(Object.defineProperty({__proto__:null,render:gc,default:{render:gc}},Symbol.toStringTag,{value:"Module"})),Eu={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"none",viewBox:"0 0 20 20"};function pc(e,t){return u.openBlock(),u.createElementBlock("svg",Eu,[...t[0]||(t[0]=[u.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 Tu=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 u.openBlock(),u.createElementBlock("svg",Pu,[...t[0]||(t[0]=[u.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 Du=Object.freeze(Object.defineProperty({__proto__:null,render:bc,default:{render:bc}},Symbol.toStringTag,{value:"Module"})),Ru={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"none",viewBox:"0 0 20 20"};function mc(e,t){return u.openBlock(),u.createElementBlock("svg",Ru,[...t[0]||(t[0]=[u.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 Iu=Object.freeze(Object.defineProperty({__proto__:null,render:mc,default:{render:mc}},Symbol.toStringTag,{value:"Module"})),Ou={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"none",viewBox:"0 0 20 20"};function _c(e,t){return u.openBlock(),u.createElementBlock("svg",Ou,[...t[0]||(t[0]=[u.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 zu=Object.freeze(Object.defineProperty({__proto__:null,render:_c,default:{render:_c}},Symbol.toStringTag,{value:"Module"})),Fu={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"none",viewBox:"0 0 20 20"};function yc(e,t){return u.openBlock(),u.createElementBlock("svg",Fu,[...t[0]||(t[0]=[u.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 Nu=Object.freeze(Object.defineProperty({__proto__:null,render:yc,default:{render:yc}},Symbol.toStringTag,{value:"Module"}));be.VPdfAnnotationTools=hc,be.default=yu,Object.defineProperties(be,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
16
|
+
`}return e}getUnencodedContents(){const e=new Uint8Array(this.getUnencodedContentsSize());let t=fe(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++]=b.Newline}return e}getUnencodedContentsSize(){return this.offsetsString.length+Pn(this.offsets)[1]+Pn(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,s]=this.objects[n];t[n]=[i.objectNumber,e],e+=s.sizeInBytes()+1}return t}};let _i=mi;p(_i,"withContextAndObjects",(e,t,n=!0)=>new mi(e,t,n));const da=class{constructor(e,t){p(this,"context"),p(this,"objectsPerTick"),p(this,"parsedObjects",0),p(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:s}=await this.computeBufferSize();let o=0;const c=new Uint8Array(e);o+=t.copyBytesInto(c,o),c[o++]=b.Newline,c[o++]=b.Newline;for(let l=0,a=n.length;l<a;l++){const[h,g]=n[l],f=String(h.objectNumber);o+=fe(f,c,o),c[o++]=b.Space;const d=String(h.generationNumber);o+=fe(d,c,o),c[o++]=b.Space,c[o++]=b.o,c[o++]=b.b,c[o++]=b.j,c[o++]=b.Newline,o+=g.copyBytesInto(c,o),c[o++]=b.Newline,c[o++]=b.e,c[o++]=b.n,c[o++]=b.d,c[o++]=b.o,c[o++]=b.b,c[o++]=b.j,c[o++]=b.Newline,c[o++]=b.Newline;const _=g instanceof _i?g.getObjectsCount():1;this.shouldWaitForTick(_)&&await St()}return r&&(o+=r.copyBytesInto(c,o),c[o++]=b.Newline),i&&(o+=i.copyBytesInto(c,o),c[o++]=b.Newline,c[o++]=b.Newline),o+=s.copyBytesInto(c,o),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=gn.forVersion(1,7);let t=e.sizeInBytes()+2;const n=Xn.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 St()}const i=t;t+=n.sizeInBytes()+1;const s=ha.of(this.createTrailerDict());t+=s.sizeInBytes()+2;const o=Yn.forLastCrossRefSectionOffset(i);return t+=o.sizeInBytes(),{size:t,header:e,indirectObjects:r,xref:n,trailerDict:s,trailer:o}}};let yi=da;p(yi,"forContext",(e,t)=>new da(e,t));class Jn{constructor(t,n,r){p(this,"bytes"),p(this,"start"),p(this,"pos"),p(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,s=this.end;if(t){let o=i+t;o>s&&(o=s),this.pos=o;const c=r.subarray(i,o);return n?new Uint8ClampedArray(c):c}else{const o=r.subarray(i,s);return n?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=this.start}moveStart(){this.start=this.pos}makeSubStream(t,n){return new Jn(this.bytes,t,n)}decode(){return this.bytes}}const tf=new Uint8Array(0);class pn{constructor(t){if(p(this,"bufferLength"),p(this,"buffer"),p(this,"eof"),p(this,"pos"),p(this,"minBufferLength"),this.pos=0,this.bufferLength=0,this.eof=!1,this.buffer=tf,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 o=this.bufferLength;r>o&&(r=o)}else{for(;!this.eof;)this.readBlock();r=this.bufferLength}this.pos=r;const s=this.buffer.subarray(i,r);return n&&!(s instanceof Uint8ClampedArray)?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=0}makeSubStream(t,n){const r=t+n;for(;this.bufferLength<=r&&!this.eof;)this.readBlock();return new Jn(this.buffer,t,n)}decode(){for(;!this.eof;)this.readBlock();return this.buffer.subarray(0,this.bufferLength)}readBlock(){throw new Oe(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 fa=e=>e===32||e===9||e===13||e===10;class nf extends pn{constructor(t,n){super(n),p(this,"stream"),p(this,"input"),this.stream=t,this.input=new Uint8Array(5),n&&(n=.8*n)}readBlock(){const i=this.stream;let s=i.getByte();for(;fa(s);)s=i.getByte();if(s===-1||s===126){this.eof=!0;return}const o=this.bufferLength;let c,l;if(s===122){for(c=this.ensureBuffer(o+4),l=0;l<4;++l)c[o+l]=0;this.bufferLength+=4}else{const a=this.input;for(a[0]=s,l=1;l<5;++l){for(s=i.getByte();fa(s);)s=i.getByte();if(a[l]=s,s===-1||s===126)break}if(c=this.ensureBuffer(o+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[o+l]=h&255,h>>=8}}}class rf extends pn{constructor(t,n){super(n),p(this,"stream"),p(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 s=this.bufferLength,o=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;o<0?o=h:(i[s++]=o<<4|h,o=-1)}o>=0&&this.eof&&(i[s++]=o<<4,o=-1),this.firstDigit=o,this.bufferLength=s}}const ua=new Int32Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),sf=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]),of=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]),af=[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],cf=[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 lf extends pn{constructor(t,n){super(n),p(this,"stream"),p(this,"codeSize"),p(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 g=a;if((a=r.getByte())===-1)throw new Error("Bad block header in flate stream");if(g|=a<<8,g!==(~h&65535)&&(h!==0||g!==0))throw new Error("Bad uncompressed block length in flate stream");this.codeBuf=0,this.codeSize=0;const f=this.bufferLength;t=this.ensureBuffer(f+h);const d=f+h;if(this.bufferLength=d,h===0)r.peekByte()===-1&&(this.eof=!0);else for(let _=f;_<d;++_){if((a=r.getByte())===-1){this.eof=!0;break}t[_]=a}return}let s,o;if(i===1)s=af,o=cf;else if(i===2){const a=this.getBits(5)+257,h=this.getBits(5)+1,g=this.getBits(4)+4,f=new Uint8Array(ua.length);let d;for(d=0;d<g;++d)f[ua[d]]=this.getBits(3);const _=this.generateHuffmanTable(f);n=0,d=0;const w=a+h,x=new Uint8Array(w);let y,D,v;for(;d<w;){const S=this.getCode(_);if(S===16)y=2,D=3,v=n;else if(S===17)y=3,D=3,v=n=0;else if(S===18)y=7,D=11,v=n=0;else{x[d++]=n=S;continue}let I=this.getBits(y)+D;for(;I-- >0;)x[d++]=v}s=this.generateHuffmanTable(x.subarray(0,a)),o=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(s);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=sf[a];let h=a>>16;h>0&&(h=this.getBits(h)),n=(a&65535)+h,a=this.getCode(o),a=of[a],h=a>>16,h>0&&(h=this.getBits(h));const g=(a&65535)+h;l+n>=c&&(t=this.ensureBuffer(l+n),c=t.length);for(let f=0;f<n;++f,++l)t[l]=t[l-g]}}getBits(t){const n=this.stream;let r=this.codeSize,i=this.codeBuf,s;for(;r<t;){if((s=n.getByte())===-1)throw new Error("Bad encoding in flate stream");i|=s<<r,r+=8}return s=i&(1<<t)-1,this.codeBuf=i>>t,this.codeSize=r-=t,s}getCode(t){const n=this.stream,r=t[0],i=t[1];let s=this.codeSize,o=this.codeBuf,c;for(;s<i&&(c=n.getByte())!==-1;)o|=c<<s,s+=8;const l=r[o&(1<<i)-1];typeof r=="number"&&console.log("FLATE:",l);const a=l>>16,h=l&65535;if(a<1||s<a)throw new Error("Bad encoding in flate stream");return this.codeBuf=o>>a,this.codeSize=s-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 s=1<<r,o=new Int32Array(s);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 g=0,f=l;for(i=0;i<c;++i)g=g<<1|f&1,f>>=1;for(i=g;i<s;i+=a)o[i]=c<<16|h;++l}return[o,r]}}class hf extends pn{constructor(t,n,r){super(n),p(this,"stream"),p(this,"cachedData"),p(this,"bitsCached"),p(this,"lzwState"),this.stream=t,this.cachedData=0,this.bitsCached=0;const i=4096,s={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 o=0;o<256;++o)s.dictionaryValues[o]=o,s.dictionaryLengths[o]=1;this.lzwState=s}readBlock(){let n=1024;const r=512;let i,s,o;const c=this.lzwState;if(!c)return;const l=c.earlyChange;let a=c.nextCode;const h=c.dictionaryValues,g=c.dictionaryLengths,f=c.dictionaryPrevCodes;let d=c.codeLength,_=c.prevCode;const w=c.currentSequence;let x=c.currentSequenceLength,y=0,D=this.bufferLength,v=this.ensureBuffer(this.bufferLength+n);for(i=0;i<512;i++){const S=this.readBits(d),I=x>0;if(!S||S<256)w[0]=S,x=1;else if(S>=258)if(S<a)for(x=g[S],s=x-1,o=S;s>=0;s--)w[s]=h[o],o=f[o];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(I&&(f[a]=_,g[a]=g[_]+1,h[a]=w[0],a++,d=a+l&a+l-1?d:Math.min(Math.log(a+l)/.6931471805599453+1,12)|0),_=S,y+=x,n<y){do n+=r;while(n<y);v=this.ensureBuffer(this.bufferLength+n)}for(s=0;s<x;s++)v[D++]=w[s]}c.nextCode=a,c.codeLength=d,c.prevCode=_,c.currentSequenceLength=x,this.bufferLength=D}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 df extends pn{constructor(t,n){super(n),p(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 s=this.stream.getBytes(i);n.set(s,r),r+=i}}else{i=257-i;const s=t[1];n=this.ensureBuffer(r+i+1);for(let o=0;o<i;o++)n[r++]=s}this.bufferLength=r}}const ga=(e,t,n)=>{if(t===m.of("FlateDecode"))return new lf(e);if(t===m.of("LZWDecode")){let r=1;if(n instanceof V){const i=n.lookup(m.of("EarlyChange"));i instanceof U&&(r=i.asNumber())}return new hf(e,void 0,r)}if(t===m.of("ASCII85Decode"))return new nf(e);if(t===m.of("ASCIIHexDecode"))return new rf(e);if(t===m.of("RunLengthDecode"))return new df(e);throw new Gc(t.asString())},pa=({dict:e,contents:t})=>{let n=new Jn(t);const r=e.lookup(m.of("Filter")),i=e.lookup(m.of("DecodeParms"));if(r instanceof m)n=ga(n,r,i);else if(r instanceof J)for(let s=0,o=r.size();s<o;s++)n=ga(n,r.lookup(s,m),i&&i.lookupMaybe(s,V));else if(r)throw new Cr([m,J],r);return n},ff=e=>{const t=e.MediaBox(),n=t.lookup(2,U).asNumber()-t.lookup(0,U).asNumber(),r=t.lookup(3,U).asNumber()-t.lookup(1,U).asNumber();return{left:0,bottom:0,right:n,top:r}},uf=e=>[1,0,0,1,-e.left,-e.bottom];class wi{constructor(t,n,r){p(this,"width"),p(this,"height"),p(this,"boundingBox"),p(this,"transformationMatrix"),p(this,"page"),this.page=t;const i=n??ff(t);this.width=i.right-i.left,this.height=i.top-i.bottom,this.boundingBox=i,this.transformationMatrix=r??uf(i)}static async for(t,n,r){return new wi(t,n,r)}async embedIntoContext(t,n){const{Contents:r,Resources:i}=this.page.normalizedEntries();if(!r)throw new Vc;const s=this.decodeContents(r),{left:o,bottom:c,right:l,top:a}=this.boundingBox,h=t.flateStream(s,{Type:"XObject",Subtype:"Form",FormType:1,BBox:[o,c,l,a],Matrix:this.transformationMatrix,Resources:i});return n?(t.assign(n,h),n):t.register(h)}decodeContents(t){const n=Uint8Array.of(b.Newline),r=[];for(let i=0,s=t.size();i<s;i++){const o=t.lookup(i,st);let c;if(o instanceof It)c=pa(o).decode();else if(o instanceof Ot)c=o.getUnencodedContents();else throw new Kc(o);r.push(c,n)}return Tc(...r)}}const xi=class extends pe{constructor(e){super(),p(this,"data"),this.data=e}clone(){return xi.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 Si=xi;p(Si,"of",e=>new xi(e));const Qn=class extends ui{constructor(e,t,n=!0){super(e,n),p(this,"entries"),p(this,"entryTuplesCache"),p(this,"maxByteWidthsCache"),p(this,"indexCache"),p(this,"computeIndex",()=>{const r=[];let i=0;for(let s=0,o=this.entries.length;s<o;s++){const c=this.entries[s],l=this.entries[s-1];s===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}),p(this,"computeEntryTuples",()=>{const r=new Array(this.entries.length);for(let i=0,s=this.entries.length;i<s;i++){const o=this.entries[i];if(o.type===0){const{type:c,nextFreeObjectNumber:l,ref:a}=o;r[i]=[c,l,a.generationNumber]}if(o.type===1){const{type:c,offset:l,ref:a}=o;r[i]=[c,l,a.generationNumber]}if(o.type===2){const{type:c,objectStreamRef:l,index:a}=o;r[i]=[c,l.objectNumber,a]}}return r}),p(this,"computeMaxEntryByteWidths",()=>{const r=this.entryTuplesCache.access(),i=[0,0,0];for(let s=0,o=r.length;s<o;s++){const[c,l,a]=r[s],h=In(c),g=In(l),f=In(a);h>i[0]&&(i[0]=h),g>i[1]&&(i[1]=g),f>i[2]&&(i[2]=f)}return i}),this.entries=t||[],this.entryTuplesCache=vt.populatedBy(this.computeEntryTuples),this.maxByteWidthsCache=vt.populatedBy(this.computeMaxEntryByteWidths),this.indexCache=vt.populatedBy(this.computeIndex),e.set(m.of("Type"),m.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 Qn.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[s,o,c]=e[r],l=xt(kt(s)),a=xt(kt(o)),h=xt(kt(c));for(let g=t[0]-1;g>=0;g--)n+=(l[g]||0).toString(2);for(let g=t[1]-1;g>=0;g--)n+=(a[g]||0).toString(2);for(let g=t[2]-1;g>=0;g--)n+=(h[g]||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,s=e.length;i<s;i++){const[o,c,l]=e[i],a=xt(kt(o)),h=xt(kt(c)),g=xt(kt(l));for(let f=t[0]-1;f>=0;f--)n[r++]=a[f]||0;for(let f=t[1]-1;f>=0;f--)n[r++]=h[f]||0;for(let f=t[2]-1;f>=0;f--)n[r++]=g[f]||0}return n}getUnencodedContentsSize(){const e=this.maxByteWidthsCache.access();return Ec(e)*this.entries.length}updateDict(){super.updateDict();const e=this.maxByteWidthsCache.access(),t=this.indexCache.access(),{context:n}=this.dict;this.dict.set(m.of("W"),n.obj(e)),this.dict.set(m.of("Index"),n.obj(t))}};let vi=Qn;p(vi,"create",(e,t=!0)=>{const n=new Qn(e,[],t);return n.addDeletedEntry(se.of(0,65535),0),n}),p(vi,"of",(e,t,n=!0)=>new Qn(e,t,n));const ba=class extends yi{constructor(e,t,n,r){super(e,t),p(this,"encodeStreams"),p(this,"objectsPerStream"),this.encodeStreams=n,this.objectsPerStream=r}async computeBufferSize(){let e=this.context.largestObjectNumber+1;const t=gn.forVersion(1,7);let n=t.sizeInBytes()+2;const r=vi.create(this.createTrailerDict(),this.encodeStreams),i=[],s=[],o=[],c=this.context.enumerateIndirectObjects();for(let g=0,f=c.length;g<f;g++){const d=c[g],[_,w]=d;if(_===this.context.trailerInfo.Encrypt||w instanceof st||w instanceof Si||_.generationNumber!==0)i.push(d),r.addUncompressedEntry(_,n),n+=this.computeIndirectObjectSize(d),this.shouldWaitForTick(1)&&await St();else{let y=Pn(s),D=Pn(o);(!y||y.length%this.objectsPerStream===0)&&(y=[],s.push(y),D=se.of(e++),o.push(D)),r.addCompressedEntry(_,D,y.length),y.push(d)}}for(let g=0,f=s.length;g<f;g++){const d=s[g],_=o[g],w=_i.withContextAndObjects(this.context,d,this.encodeStreams);r.addUncompressedEntry(_,n),n+=this.computeIndirectObjectSize([_,w]),i.push([_,w]),this.shouldWaitForTick(d.length)&&await St()}const l=se.of(e++);r.dict.set(m.of("Size"),U.of(e)),r.addUncompressedEntry(l,n);const a=n;n+=this.computeIndirectObjectSize([l,r]),i.push([l,r]);const h=Yn.forLastCrossRefSectionOffset(a);return n+=h.sizeInBytes(),{size:n,header:t,indirectObjects:i,trailer:h}}};let ma=ba;p(ma,"forContext",(e,t,n=!0,r=50)=>new ba(e,t,n,r));const _a=[65472,65473,65474,65475,65477,65478,65479,65480,65481,65482,65483,65484,65485,65486,65487],gf={1:"DeviceGray",3:"DeviceRGB",4:"DeviceCMYK"};class ki{constructor(t,n,r,i,s){p(this,"bitsPerComponent"),p(this,"height"),p(this,"width"),p(this,"colorSpace"),p(this,"imageData"),this.imageData=t,this.bitsPerComponent=n,this.width=r,this.height=i,this.colorSpace=s}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,s;for(;i<n.byteLength&&(s=n.getUint16(i),i+=2,!_a.includes(s));)i+=n.getUint16(i);if(!_a.includes(s))throw new Error("Invalid JPEG");i+=2;const o=n.getUint8(i++),c=n.getUint16(i);i+=2;const l=n.getUint16(i);i+=2;const a=n.getUint8(i++),h=gf[a];if(!h)throw new Error("Unknown JPEG channel.");const g=h;return new ki(t,o,l,c,g)}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 C={};C.toRGBA8=function(e){var t=e.width,n=e.height;if(e.tabs.acTL==null)return[C.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,s=new Uint8Array(i),o=new Uint8Array(i),c=new Uint8Array(i),l=0;l<e.frames.length;l++){var a=e.frames[l],h=a.rect.x,g=a.rect.y,f=a.rect.width,d=a.rect.height,_=C.toRGBA8.decodeImage(a.data,f,d,e);if(l!=0)for(var w=0;w<i;w++)c[w]=s[w];if(a.blend==0?C._copyTile(_,f,d,s,t,n,h,g,0):a.blend==1&&C._copyTile(_,f,d,s,t,n,h,g,1),r.push(s.buffer.slice(0)),a.dispose!=0){if(a.dispose==1)C._copyTile(o,f,d,s,t,n,h,g,0);else if(a.dispose==2)for(var w=0;w<i;w++)s[w]=c[w]}}return r},C.toRGBA8.decodeImage=function(e,t,n,r){var i=t*n,s=C.decode._getBPP(r),o=Math.ceil(t*s/8),c=new Uint8Array(i*4),l=new Uint32Array(c.buffer),a=r.ctype,h=r.depth,g=C._bin.readUshort;if(a==6){var f=i<<2;if(h==8)for(var d=0;d<f;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<f;d++)c[d]=e[d<<1]}else if(a==2){var _=r.tabs.tRNS;if(_==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=_[0],y=_[1],D=_[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]==y&&e[w+2]==D&&(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],g(e,w)==x&&g(e,w+2)==y&&g(e,w+4)==D&&(c[v+3]=0)}}}else if(a==3){var S=r.tabs.PLTE,I=r.tabs.tRNS,B=I?I.length:0;if(h==1)for(var A=0;A<n;A++)for(var O=A*o,R=A*t,d=0;d<t;d++){var v=R+d<<2,E=e[O+(d>>3)]>>7-((d&7)<<0)&1,k=3*E;c[v]=S[k],c[v+1]=S[k+1],c[v+2]=S[k+2],c[v+3]=E<B?I[E]:255}if(h==2)for(var A=0;A<n;A++)for(var O=A*o,R=A*t,d=0;d<t;d++){var v=R+d<<2,E=e[O+(d>>2)]>>6-((d&3)<<1)&3,k=3*E;c[v]=S[k],c[v+1]=S[k+1],c[v+2]=S[k+2],c[v+3]=E<B?I[E]:255}if(h==4)for(var A=0;A<n;A++)for(var O=A*o,R=A*t,d=0;d<t;d++){var v=R+d<<2,E=e[O+(d>>1)]>>4-((d&1)<<2)&15,k=3*E;c[v]=S[k],c[v+1]=S[k+1],c[v+2]=S[k+2],c[v+3]=E<B?I[E]:255}if(h==8)for(var d=0;d<i;d++){var v=d<<2,E=e[d],k=3*E;c[v]=S[k],c[v+1]=S[k+1],c[v+2]=S[k+2],c[v+3]=E<B?I[E]:255}}else if(a==4){if(h==8)for(var d=0;d<i;d++){var v=d<<2,F=d<<1,P=e[F];c[v]=P,c[v+1]=P,c[v+2]=P,c[v+3]=e[F+1]}if(h==16)for(var d=0;d<i;d++){var v=d<<2,F=d<<2,P=e[F];c[v]=P,c[v+1]=P,c[v+2]=P,c[v+3]=e[F+2]}}else if(a==0)for(var x=r.tabs.tRNS?r.tabs.tRNS:-1,A=0;A<n;A++){var W=A*o,M=A*t;if(h==1)for(var z=0;z<t;z++){var P=255*(e[W+(z>>>3)]>>>7-(z&7)&1),Y=P==x*255?0:255;l[M+z]=Y<<24|P<<16|P<<8|P}else if(h==2)for(var z=0;z<t;z++){var P=85*(e[W+(z>>>2)]>>>6-((z&3)<<1)&3),Y=P==x*85?0:255;l[M+z]=Y<<24|P<<16|P<<8|P}else if(h==4)for(var z=0;z<t;z++){var P=17*(e[W+(z>>>1)]>>>4-((z&1)<<2)&15),Y=P==x*17?0:255;l[M+z]=Y<<24|P<<16|P<<8|P}else if(h==8)for(var z=0;z<t;z++){var P=e[W+z],Y=P==x?0:255;l[M+z]=Y<<24|P<<16|P<<8|P}else if(h==16)for(var z=0;z<t;z++){var P=e[W+(z<<1)],Y=g(e,W+(z<<d))==x?0:255;l[M+z]=Y<<24|P<<16|P<<8|P}}return c},C.decode=function(e){for(var t=new Uint8Array(e),n=8,r=C._bin,i=r.readUshort,s=r.readUint,o={tabs:{},frames:[]},c=new Uint8Array(t.length),l=0,a,h=0,g=[137,80,78,71,13,10,26,10],f=0;f<8;f++)if(t[f]!=g[f])throw"The input is not a PNG file!";for(;n<t.length;){var d=r.readUint(t,n);n+=4;var _=r.readASCII(t,n,4);if(n+=4,_=="IHDR")C.decode._IHDR(t,n,o);else if(_=="IDAT"){for(var f=0;f<d;f++)c[l+f]=t[n+f];l+=d}else if(_=="acTL")o.tabs[_]={num_frames:s(t,n),num_plays:s(t,n+4)},a=new Uint8Array(t.length);else if(_=="fcTL"){if(h!=0){var w=o.frames[o.frames.length-1];w.data=C.decode._decompress(o,a.slice(0,h),w.rect.width,w.rect.height),h=0}var x={x:s(t,n+12),y:s(t,n+16),width:s(t,n+4),height:s(t,n+8)},y=i(t,n+22);y=i(t,n+20)/(y==0?100:y);var D={rect:x,delay:Math.round(y*1e3),dispose:t[n+24],blend:t[n+25]};o.frames.push(D)}else if(_=="fdAT"){for(var f=0;f<d-4;f++)a[h+f]=t[n+f+4];h+=d-4}else if(_=="pHYs")o.tabs[_]=[r.readUint(t,n),r.readUint(t,n+4),t[n+8]];else if(_=="cHRM"){o.tabs[_]=[];for(var f=0;f<8;f++)o.tabs[_].push(r.readUint(t,n+f*4))}else if(_=="tEXt"){o.tabs[_]==null&&(o.tabs[_]={});var v=r.nextZero(t,n),S=r.readASCII(t,n,v-n),I=r.readASCII(t,v+1,n+d-v-1);o.tabs[_][S]=I}else if(_=="iTXt"){o.tabs[_]==null&&(o.tabs[_]={});var v=0,B=n;v=r.nextZero(t,B);var S=r.readASCII(t,B,v-B);B=v+1,t[B],t[B+1],B+=2,v=r.nextZero(t,B),r.readASCII(t,B,v-B),B=v+1,v=r.nextZero(t,B),r.readUTF8(t,B,v-B),B=v+1;var I=r.readUTF8(t,B,d-(B-n));o.tabs[_][S]=I}else if(_=="PLTE")o.tabs[_]=r.readBytes(t,n,d);else if(_=="hIST"){var A=o.tabs.PLTE.length/3;o.tabs[_]=[];for(var f=0;f<A;f++)o.tabs[_].push(i(t,n+f*2))}else if(_=="tRNS")o.ctype==3?o.tabs[_]=r.readBytes(t,n,d):o.ctype==0?o.tabs[_]=i(t,n):o.ctype==2&&(o.tabs[_]=[i(t,n),i(t,n+2),i(t,n+4)]);else if(_=="gAMA")o.tabs[_]=r.readUint(t,n)/1e5;else if(_=="sRGB")o.tabs[_]=t[n];else if(_=="bKGD")o.ctype==0||o.ctype==4?o.tabs[_]=[i(t,n)]:o.ctype==2||o.ctype==6?o.tabs[_]=[i(t,n),i(t,n+2),i(t,n+4)]:o.ctype==3&&(o.tabs[_]=t[n]);else if(_=="IEND")break;n+=d,r.readUint(t,n),n+=4}if(h!=0){var w=o.frames[o.frames.length-1];w.data=C.decode._decompress(o,a.slice(0,h),w.rect.width,w.rect.height),h=0}return o.data=C.decode._decompress(o,c,o.width,o.height),delete o.compress,delete o.interlace,delete o.filter,o},C.decode._decompress=function(e,t,n,r){var i=C.decode._getBPP(e),s=Math.ceil(n*i/8),o=new Uint8Array((s+1+e.interlace)*r);return t=C.decode._inflate(t,o),e.interlace==0?t=C.decode._filterZero(t,e,0,n,r):e.interlace==1&&(t=C.decode._readInterlace(t,e)),t},C.decode._inflate=function(e,t){var n=C.inflateRaw(new Uint8Array(e.buffer,2,e.length-6),t);return n},C.inflateRaw=function(){var e={};return e.H={},e.H.N=function(t,n){var r=Uint8Array,i=0,s=0,o=0,c=0,l=0,a=0,h=0,g=0,f=0,d,_;if(t[0]==3&&t[1]==0)return n||new r(0);var w=e.H,x=w.b,y=w.e,D=w.R,v=w.n,S=w.A,I=w.Z,B=w.m,A=n==null;for(A&&(n=new r(t.length>>>2<<3));i==0;){if(i=x(t,f,1),s=x(t,f+1,2),f+=3,s==0){(f&7)!=0&&(f+=8-(f&7));var O=(f>>>3)+4,R=t[O-4]|t[O-3]<<8;A&&(n=e.H.W(n,g+R)),n.set(new r(t.buffer,t.byteOffset+O,R),g),f=O+R<<3,g+=R;continue}if(A&&(n=e.H.W(n,g+(1<<17))),s==1&&(d=B.J,_=B.h,a=(1<<9)-1,h=(1<<5)-1),s==2){o=y(t,f,5)+257,c=y(t,f+5,5)+1,l=y(t,f+10,4)+4,f+=14;for(var E=1,k=0;k<38;k+=2)B.Q[k]=0,B.Q[k+1]=0;for(var k=0;k<l;k++){var F=y(t,f+k*3,3);B.Q[(B.X[k]<<1)+1]=F,F>E&&(E=F)}f+=3*l,v(B.Q,E),S(B.Q,E,B.u),d=B.w,_=B.d,f=D(B.u,(1<<E)-1,o+c,t,f,B.v);var P=w.V(B.v,0,o,B.C);a=(1<<P)-1;var W=w.V(B.v,o,c,B.D);h=(1<<W)-1,v(B.C,P),S(B.C,P,d),v(B.D,W),S(B.D,W,_)}for(;;){var M=d[I(t,f)&a];f+=M&15;var z=M>>>4;if(z>>>8==0)n[g++]=z;else{if(z==256)break;var Y=g+z-254;if(z>264){var Ue=B.q[z-257];Y=g+(Ue>>>3)+y(t,f,Ue&7),f+=Ue&7}var $e=_[I(t,f)&h];f+=$e&15;var ct=$e>>>4,we=B.c[ct],De=(we>>>4)+x(t,f,we&15);for(f+=we&15;g<Y;)n[g]=n[g++-De],n[g]=n[g++-De],n[g]=n[g++-De],n[g]=n[g++-De];g=Y}}}return n.length==g?n:n.slice(0,g)},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,s,o){for(var c=e.H.e,l=e.H.Z,a=0;a<r;){var h=t[l(i,s)&n];s+=h&15;var g=h>>>4;if(g<=15)o[a]=g,a++;else{var f=0,d=0;g==16?(d=3+c(i,s,2),s+=2,f=o[a-1]):g==17?(d=3+c(i,s,3),s+=3):g==18&&(d=11+c(i,s,7),s+=7);for(var _=a+d;a<_;)o[a]=f,a++}}return s},e.H.V=function(t,n,r,i){for(var s=0,o=0,c=i.length>>>1;o<r;){var l=t[o+n];i[o<<1]=0,i[(o<<1)+1]=l,l>s&&(s=l),o++}for(;o<c;)i[o<<1]=0,i[(o<<1)+1]=0,o++;return s},e.H.n=function(t,n){for(var r=e.H.m,i=t.length,s,o,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 g=r.K;for(s=0,h[0]=0,o=1;o<=n;o++)s=s+h[o-1]<<1,g[o]=s;for(c=0;c<i;c+=2)a=t[c+1],a!=0&&(t[c]=g[a],g[a]++)},e.H.A=function(t,n,r){for(var i=t.length,s=e.H.m,o=s.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,g=n-a,f=t[c]<<g,d=f+(1<<g);f!=d;){var _=o[f]>>>15-n;r[_]=h,f++}},e.H.l=function(t,n){for(var r=e.H.m.r,i=15-n,s=0;s<t.length;s+=2){var o=t[s]<<n-t[s+1];t[s]=r[o]>>>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 s(o,c,l){for(;c--!=0;)o.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];s(t._,144,8),s(t._,255-143,9),s(t._,279-255,7),s(t._,287-279,8),e.H.n(t._,9),e.H.A(t._,9,t.J),e.H.l(t._,9),s(t.$,32,5),e.H.n(t.$,5),e.H.A(t.$,5,t.h),e.H.l(t.$,5),s(t.Q,19,0),s(t.C,286,0),s(t.D,30,0),s(t.v,320,0)}(),e.H.N}(),C.decode._readInterlace=function(e,t){for(var n=t.width,r=t.height,i=C.decode._getBPP(t),s=i>>3,o=Math.ceil(n*i/8),c=new Uint8Array(r*o),l=0,a=[0,0,4,0,2,0,1],h=[0,4,0,2,0,1,0],g=[8,8,8,4,4,2,2],f=[8,8,4,4,2,2,1],d=0;d<7;){for(var _=g[d],w=f[d],x=0,y=0,D=a[d];D<r;)D+=_,y++;for(var v=h[d];v<n;)v+=w,x++;var S=Math.ceil(x*i/8);C.decode._filterZero(e,t,l,x,y);for(var I=0,B=a[d];B<r;){for(var A=h[d],O=l+I*S<<3;A<n;){if(i==1){var R=e[O>>3];R=R>>7-(O&7)&1,c[B*o+(A>>3)]|=R<<7-((A&7)<<0)}if(i==2){var R=e[O>>3];R=R>>6-(O&7)&3,c[B*o+(A>>2)]|=R<<6-((A&3)<<1)}if(i==4){var R=e[O>>3];R=R>>4-(O&7)&15,c[B*o+(A>>1)]|=R<<4-((A&1)<<2)}if(i>=8)for(var E=B*o+A*s,k=0;k<s;k++)c[E+k]=e[(O>>3)+k];O+=i,A+=w}I++,B+=_}x*y!=0&&(l+=y*(1+S)),d=d+1}return c},C.decode._getBPP=function(e){var t=[1,null,3,1,2,null,4][e.ctype];return t*e.depth},C.decode._filterZero=function(e,t,n,r,i){var s=C.decode._getBPP(t),o=Math.ceil(r*s/8),c=C.decode._paeth;s=Math.ceil(s/8);var l=0,a=1,h=e[n],g=0;if(h>1&&(e[n]=[0,0,1][h-2]),h==3)for(g=s;g<o;g++)e[g+1]=e[g+1]+(e[g+1-s]>>>1)&255;for(var f=0;f<i;f++)if(l=n+f*o,a=l+f+1,h=e[a-1],g=0,h==0)for(;g<o;g++)e[l+g]=e[a+g];else if(h==1){for(;g<s;g++)e[l+g]=e[a+g];for(;g<o;g++)e[l+g]=e[a+g]+e[l+g-s]}else if(h==2)for(;g<o;g++)e[l+g]=e[a+g]+e[l+g-o];else if(h==3){for(;g<s;g++)e[l+g]=e[a+g]+(e[l+g-o]>>>1);for(;g<o;g++)e[l+g]=e[a+g]+(e[l+g-o]+e[l+g-s]>>>1)}else{for(;g<s;g++)e[l+g]=e[a+g]+c(0,e[l+g-o],0);for(;g<o;g++)e[l+g]=e[a+g]+c(e[l+g-s],e[l+g-o],e[l+g-s-o])}return e},C.decode._paeth=function(e,t,n){var r=e+t-n,i=r-e,s=r-t,o=r-n;return i*i<=s*s&&i*i<=o*o?e:s*s<=o*o?t:n},C.decode._IHDR=function(e,t,n){var r=C._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++},C._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,s=0;s<n;s++)r+="%"+C._bin.pad(e[t+s].toString(16));try{i=decodeURIComponent(r)}catch{return C._bin.readASCII(e,t,n)}return i}},C._copyTile=function(e,t,n,r,i,s,o,c,l){for(var a=Math.min(t,i),h=Math.min(n,s),g=0,f=0,d=0;d<h;d++)for(var _=0;_<a;_++)if(o>=0&&c>=0?(g=d*t+_<<2,f=(c+d)*i+o+_<<2):(g=(-c+d)*t-o+_<<2,f=d*i+_<<2),l==0)r[f]=e[g],r[f+1]=e[g+1],r[f+2]=e[g+2],r[f+3]=e[g+3];else if(l==1){var w=e[g+3]*.00392156862745098,x=e[g]*w,y=e[g+1]*w,D=e[g+2]*w,v=r[f+3]*(1/255),S=r[f]*v,I=r[f+1]*v,B=r[f+2]*v,A=1-w,O=w+v*A,R=O==0?0:1/O;r[f+3]=255*O,r[f+0]=(x+S*A)*R,r[f+1]=(y+I*A)*R,r[f+2]=(D+B*A)*R}else if(l==2){var w=e[g+3],x=e[g],y=e[g+1],D=e[g+2],v=r[f+3],S=r[f],I=r[f+1],B=r[f+2];w==v&&x==S&&y==I&&D==B?(r[f]=0,r[f+1]=0,r[f+2]=0,r[f+3]=0):(r[f]=x,r[f+1]=y,r[f+2]=D,r[f+3]=w)}else if(l==3){var w=e[g+3],x=e[g],y=e[g+1],D=e[g+2],v=r[f+3],S=r[f],I=r[f+1],B=r[f+2];if(w==v&&x==S&&y==I&&D==B)continue;if(w<220&&v>20)return!1}return!0},C.encode=function(e,t,n,r,i,s,o){r==null&&(r=0),o==null&&(o=!1);var c=C.encode.compress(e,t,n,r,[!1,!1,!1,0,o]);return C.encode.compressPNG(c,-1),C.encode._main(c,t,n,i,s)},C.encodeLL=function(e,t,n,r,i,s,o,c){for(var l={ctype:0+(r==1?0:2)+(i==0?0:4),depth:s,frames:[]},a=(r+i)*s,h=a*t,g=0;g<e.length;g++)l.frames.push({rect:{x:0,y:0,width:t,height:n},img:new Uint8Array(e[g]),blend:0,dispose:1,bpp:Math.ceil(a/8),bpl:Math.ceil(h/8)});C.encode.compressPNG(l,0,!0);var f=C.encode._main(l,t,n,o,c);return f},C.encode._main=function(e,t,n,r,i){i==null&&(i={});var s=C.crc.crc,o=C._bin.writeUint,c=C._bin.writeUshort,l=C._bin.writeASCII,a=8,h=e.frames.length>1,g=!1,f=8+(16+5+4)+(h?20:0);if(i.sRGB!=null&&(f+=8+1+4),i.pHYs!=null&&(f+=8+9+4),e.ctype==3){for(var d=e.plte.length,_=0;_<d;_++)e.plte[_]>>>24!=255&&(g=!0);f+=8+d*3+4+(g?8+d*1+4:0)}for(var w=0;w<e.frames.length;w++){var x=e.frames[w];h&&(f+=38),f+=x.cimg.length+12,w!=0&&(f+=4)}f+=12;for(var y=new Uint8Array(f),D=[137,80,78,71,13,10,26,10],_=0;_<8;_++)y[_]=D[_];if(o(y,a,13),a+=4,l(y,a,"IHDR"),a+=4,o(y,a,t),a+=4,o(y,a,n),a+=4,y[a]=e.depth,a++,y[a]=e.ctype,a++,y[a]=0,a++,y[a]=0,a++,y[a]=0,a++,o(y,a,s(y,a-17,17)),a+=4,i.sRGB!=null&&(o(y,a,1),a+=4,l(y,a,"sRGB"),a+=4,y[a]=i.sRGB,a++,o(y,a,s(y,a-5,5)),a+=4),i.pHYs!=null&&(o(y,a,9),a+=4,l(y,a,"pHYs"),a+=4,o(y,a,i.pHYs[0]),a+=4,o(y,a,i.pHYs[1]),a+=4,y[a]=i.pHYs[2],a++,o(y,a,s(y,a-13,13)),a+=4),h&&(o(y,a,8),a+=4,l(y,a,"acTL"),a+=4,o(y,a,e.frames.length),a+=4,o(y,a,i.loop!=null?i.loop:0),a+=4,o(y,a,s(y,a-12,12)),a+=4),e.ctype==3){var d=e.plte.length;o(y,a,d*3),a+=4,l(y,a,"PLTE"),a+=4;for(var _=0;_<d;_++){var v=_*3,S=e.plte[_],I=S&255,B=S>>>8&255,A=S>>>16&255;y[a+v+0]=I,y[a+v+1]=B,y[a+v+2]=A}if(a+=d*3,o(y,a,s(y,a-d*3-4,d*3+4)),a+=4,g){o(y,a,d),a+=4,l(y,a,"tRNS"),a+=4;for(var _=0;_<d;_++)y[a+_]=e.plte[_]>>>24&255;a+=d,o(y,a,s(y,a-d-4,d+4)),a+=4}}for(var O=0,w=0;w<e.frames.length;w++){var x=e.frames[w];h&&(o(y,a,26),a+=4,l(y,a,"fcTL"),a+=4,o(y,a,O++),a+=4,o(y,a,x.rect.width),a+=4,o(y,a,x.rect.height),a+=4,o(y,a,x.rect.x),a+=4,o(y,a,x.rect.y),a+=4,c(y,a,r[w]),a+=2,c(y,a,1e3),a+=2,y[a]=x.dispose,a++,y[a]=x.blend,a++,o(y,a,s(y,a-30,30)),a+=4);var R=x.cimg,d=R.length;o(y,a,d+(w==0?0:4)),a+=4;var E=a;l(y,a,w==0?"IDAT":"fdAT"),a+=4,w!=0&&(o(y,a,O++),a+=4),y.set(R,a),a+=d,o(y,a,s(y,E,a-E)),a+=4}return o(y,a,0),a+=4,l(y,a,"IEND"),a+=4,o(y,a,s(y,a-4,4)),a+=4,y.buffer},C.encode.compressPNG=function(e,t,n){for(var r=0;r<e.frames.length;r++){var i=e.frames[r];i.rect.width;var s=i.rect.height,o=new Uint8Array(s*i.bpl+s);i.cimg=C.encode._filterZero(i.img,s,i.bpp,i.bpl,o,t,n)}},C.encode.compress=function(e,t,n,r,i){for(var s=i[0],o=i[1],c=i[2],l=i[3],a=i[4],h=6,g=8,f=255,d=0;d<e.length;d++)for(var _=new Uint8Array(e[d]),w=_.length,x=0;x<w;x+=4)f&=_[x+3];var y=f!=255,D=C.encode.framize(e,t,n,s,o,c),v={},S=[],I=[];if(r!=0){for(var B=[],x=0;x<D.length;x++)B.push(D[x].img.buffer);for(var A=C.encode.concatRGBA(B),O=C.quantize(A,r),R=0,E=new Uint8Array(O.abuf),x=0;x<D.length;x++){var k=D[x].img,F=k.length;I.push(new Uint8Array(O.inds.buffer,R>>2,F>>2));for(var d=0;d<F;d+=4)k[d]=E[R+d],k[d+1]=E[R+d+1],k[d+2]=E[R+d+2],k[d+3]=E[R+d+3];R+=F}for(var x=0;x<O.plte.length;x++)S.push(O.plte[x].est.rgba)}else for(var d=0;d<D.length;d++){var P=D[d],W=new Uint32Array(P.img.buffer),M=P.rect.width,w=W.length,z=new Uint8Array(w);I.push(z);for(var x=0;x<w;x++){var Y=W[x];if(x!=0&&Y==W[x-1])z[x]=z[x-1];else if(x>M&&Y==W[x-M])z[x]=z[x-M];else{var Ue=v[Y];if(Ue==null&&(v[Y]=Ue=S.length,S.push(Y),S.length>=300))break;z[x]=Ue}}}var $e=S.length;$e<=256&&a==!1&&($e<=2?g=1:$e<=4?g=2:$e<=16?g=4:g=8,g=Math.max(g,l));for(var d=0;d<D.length;d++){var P=D[d];P.rect.x,P.rect.y;var M=P.rect.width,ct=P.rect.height,we=P.img;new Uint32Array(we.buffer);var De=4*M,ls=4;if($e<=256&&a==!1){De=Math.ceil(g*M/8);for(var He=new Uint8Array(De*ct),xr=I[d],Sr=0;Sr<ct;Sr++){var x=Sr*De,vr=Sr*M;if(g==8)for(var ae=0;ae<M;ae++)He[x+ae]=xr[vr+ae];else if(g==4)for(var ae=0;ae<M;ae++)He[x+(ae>>1)]|=xr[vr+ae]<<4-(ae&1)*4;else if(g==2)for(var ae=0;ae<M;ae++)He[x+(ae>>2)]|=xr[vr+ae]<<6-(ae&3)*2;else if(g==1)for(var ae=0;ae<M;ae++)He[x+(ae>>3)]|=xr[vr+ae]<<7-(ae&7)*1}we=He,h=3,ls=1}else if(y==!1&&D.length==1){for(var He=new Uint8Array(M*ct*3),Lu=M*ct,x=0;x<Lu;x++){var k=x*3,hs=x*4;He[k]=we[hs],He[k+1]=we[hs+1],He[k+2]=we[hs+2]}we=He,h=2,ls=3,De=3*M}P.img=we,P.bpl=De,P.bpp=ls}return{ctype:h,depth:g,plte:S,frames:D}},C.encode.framize=function(e,t,n,r,i,s){for(var o=[],c=0;c<e.length;c++){var l=new Uint8Array(e[c]),a=new Uint32Array(l.buffer),h,g=0,f=0,d=t,_=n,w=r?1:0;if(c!=0){for(var x=s||r||c==1||o[c-2].dispose!=0?1:2,y=0,D=1e9,v=0;v<x;v++){for(var P=new Uint8Array(e[c-1-v]),S=new Uint32Array(e[c-1-v]),I=t,B=n,A=-1,O=-1,R=0;R<n;R++)for(var E=0;E<t;E++){var k=R*t+E;a[k]!=S[k]&&(E<I&&(I=E),E>A&&(A=E),R<B&&(B=R),R>O&&(O=R))}A==-1&&(I=B=A=O=0),i&&((I&1)==1&&I--,(B&1)==1&&B--);var F=(A-I+1)*(O-B+1);F<D&&(D=F,y=v,g=I,f=B,d=A-I+1,_=O-B+1)}var P=new Uint8Array(e[c-1-y]);y==1&&(o[c-1].dispose=2),h=new Uint8Array(d*_*4),C._copyTile(P,t,n,h,d,_,-g,-f,0),w=C._copyTile(l,t,n,h,d,_,-g,-f,3)?1:0,w==1?C.encode._prepareDiff(l,t,n,h,{x:g,y:f,width:d,height:_}):C._copyTile(l,t,n,h,d,_,-g,-f,0)}else h=l.slice(0);o.push({rect:{x:g,y:f,width:d,height:_},img:h,blend:w,dispose:0})}if(r)for(var c=0;c<o.length;c++){var W=o[c];if(W.blend!=1){var M=W.rect,z=o[c-1].rect,Y=Math.min(M.x,z.x),Ue=Math.min(M.y,z.y),$e=Math.max(M.x+M.width,z.x+z.width),ct=Math.max(M.y+M.height,z.y+z.height),we={x:Y,y:Ue,width:$e-Y,height:ct-Ue};o[c-1].dispose=1,c-1!=0&&C.encode._updateFrame(e,t,n,o,c-1,we,i),C.encode._updateFrame(e,t,n,o,c,we,i)}}var De=0;if(e.length!=1)for(var k=0;k<o.length;k++){var W=o[k];De+=W.rect.width*W.rect.height}return o},C.encode._updateFrame=function(e,t,n,r,i,s,o){for(var c=Uint8Array,l=Uint32Array,a=new c(e[i-1]),h=new l(e[i-1]),g=i+1<e.length?new c(e[i+1]):null,f=new c(e[i]),d=new l(f.buffer),_=t,w=n,x=-1,y=-1,D=0;D<s.height;D++)for(var v=0;v<s.width;v++){var S=s.x+v,I=s.y+D,B=I*t+S,A=d[B];A==0||r[i-1].dispose==0&&h[B]==A&&(g==null||g[B*4+3]!=0)||(S<_&&(_=S),S>x&&(x=S),I<w&&(w=I),I>y&&(y=I))}x==-1&&(_=w=x=y=0),o&&((_&1)==1&&_--,(w&1)==1&&w--),s={x:_,y:w,width:x-_+1,height:y-w+1};var O=r[i];O.rect=s,O.blend=1,O.img=new Uint8Array(s.width*s.height*4),r[i-1].dispose==0?(C._copyTile(a,t,n,O.img,s.width,s.height,-s.x,-s.y,0),C.encode._prepareDiff(f,t,n,O.img,s)):C._copyTile(f,t,n,O.img,s.width,s.height,-s.x,-s.y,0)},C.encode._prepareDiff=function(e,t,n,r,i){C._copyTile(e,t,n,r,i.width,i.height,-i.x,-i.y,2)},C.encode._filterZero=function(e,t,n,r,i,s,o){var c=[],l=[0,1,2,3,4];s!=-1?l=[s]:(t*r>5e5||n==1)&&(l=[0]);var a;o&&(a={level:0});for(var h=o&&UZIP!=null?UZIP:ci,g=0;g<l.length;g++){for(var f=0;f<t;f++)C.encode._filterLine(i,e,f,r,n,l[g]);c.push(h.deflate(i,a))}for(var d,_=1e9,g=0;g<c.length;g++)c[g].length<_&&(d=g,_=c[g].length);return c[d]},C.encode._filterLine=function(e,t,n,r,i,s){var o=n*r,c=o+n,l=C.decode._paeth;if(e[c]=s,c++,s==0)if(r<500)for(var a=0;a<r;a++)e[c+a]=t[o+a];else e.set(new Uint8Array(t.buffer,o,r),c);else if(s==1){for(var a=0;a<i;a++)e[c+a]=t[o+a];for(var a=i;a<r;a++)e[c+a]=t[o+a]-t[o+a-i]+256&255}else if(n==0){for(var a=0;a<i;a++)e[c+a]=t[o+a];if(s==2)for(var a=i;a<r;a++)e[c+a]=t[o+a];if(s==3)for(var a=i;a<r;a++)e[c+a]=t[o+a]-(t[o+a-i]>>1)+256&255;if(s==4)for(var a=i;a<r;a++)e[c+a]=t[o+a]-l(t[o+a-i],0,0)+256&255}else{if(s==2)for(var a=0;a<r;a++)e[c+a]=t[o+a]+256-t[o+a-r]&255;if(s==3){for(var a=0;a<i;a++)e[c+a]=t[o+a]+256-(t[o+a-r]>>1)&255;for(var a=i;a<r;a++)e[c+a]=t[o+a]+256-(t[o+a-r]+t[o+a-i]>>1)&255}if(s==4){for(var a=0;a<i;a++)e[c+a]=t[o+a]+256-l(0,t[o+a-r],0)&255;for(var a=i;a<r;a++)e[c+a]=t[o+a]+256-l(t[o+a-i],t[o+a-r],t[o+a-i-r])&255}}},C.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=C.crc.table[(e^t[n+i])&255]^e>>>8;return e},crc:function(e,t,n){return C.crc.update(4294967295,e,t,n)^4294967295}},C.quantize=function(e,t){var n=new Uint8Array(e),r=n.slice(0),i=new Uint32Array(r.buffer),s=C.quantize.getKDtree(r,t),o=s[0],c=s[1];C.quantize.planeDst;for(var l=n,a=i,h=l.length,g=new Uint8Array(n.length>>2),f=0;f<h;f+=4){var d=l[f]*.00392156862745098,_=l[f+1]*(1/255),w=l[f+2]*(1/255),x=l[f+3]*(1/255),y=C.quantize.getNearest(o,d,_,w,x);g[f>>2]=y.ind,a[f>>2]=y.est.rgba}return{abuf:r.buffer,inds:g,plte:c}},C.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=C.quantize.stats(e,i.i0,i.i1),i.est=C.quantize.estats(i.bst);for(var s=[i];s.length<t;){for(var o=0,c=0,l=0;l<s.length;l++)s[l].est.L>o&&(o=s[l].est.L,c=l);if(o<n)break;var a=s[c],h=C.quantize.splitPixels(e,r,a.i0,a.i1,a.est.e,a.est.eMq255),g=a.i0>=h||a.i1<=h;if(g){a.est.L=0;continue}var f={i0:a.i0,i1:h,bst:null,est:null,tdst:0,left:null,right:null};f.bst=C.quantize.stats(e,f.i0,f.i1),f.est=C.quantize.estats(f.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-f.bst.N};for(var l=0;l<16;l++)d.bst.R[l]=a.bst.R[l]-f.bst.R[l];for(var l=0;l<4;l++)d.bst.m[l]=a.bst.m[l]-f.bst.m[l];d.est=C.quantize.estats(d.bst),a.left=f,a.right=d,s[c]=f,s.push(d)}s.sort(function(_,w){return w.bst.N-_.bst.N});for(var l=0;l<s.length;l++)s[l].ind=l;return[i,s]},C.quantize.getNearest=function(e,t,n,r,i){if(e.left==null)return e.tdst=C.quantize.dist(e.est.q,t,n,r,i),e;var s=C.quantize.planeDst(e.est,t,n,r,i),o=e.left,c=e.right;s>0&&(o=e.right,c=e.left);var l=C.quantize.getNearest(o,t,n,r,i);if(l.tdst<=s*s)return l;var a=C.quantize.getNearest(c,t,n,r,i);return a.tdst<l.tdst?a:l},C.quantize.planeDst=function(e,t,n,r,i){var s=e.e;return s[0]*t+s[1]*n+s[2]*r+s[3]*i-e.eMq},C.quantize.dist=function(e,t,n,r,i){var s=t-e[0],o=n-e[1],c=r-e[2],l=i-e[3];return s*s+o*o+c*c+l*l},C.quantize.splitPixels=function(e,t,n,r,i,s){var o=C.quantize.vecDot;for(r-=4;n<r;){for(;o(e,n,i)<=s;)n+=4;for(;o(e,r,i)>s;)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(;o(e,n,i)>s;)n-=4;return n+4},C.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]},C.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],s=n-t>>2,o=t;o<n;o+=4){var c=e[o]*.00392156862745098,l=e[o+1]*(1/255),a=e[o+2]*(1/255),h=e[o+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:s}},C.quantize.estats=function(e){var t=e.R,n=e.m,r=e.N,i=n[0],s=n[1],o=n[2],c=n[3],l=r==0?0:1/r,a=[t[0]-i*i*l,t[1]-i*s*l,t[2]-i*o*l,t[3]-i*c*l,t[4]-s*i*l,t[5]-s*s*l,t[6]-s*o*l,t[7]-s*c*l,t[8]-o*i*l,t[9]-o*s*l,t[10]-o*o*l,t[11]-o*c*l,t[12]-c*i*l,t[13]-c*s*l,t[14]-c*o*l,t[15]-c*c*l],h=a,g=C.M4,f=[.5,.5,.5,.5],d=0,_=0;if(r!=0)for(var w=0;w<10&&(f=g.multVec(h,f),_=Math.sqrt(g.dot(f,f)),f=g.sml(1/_,f),!(Math.abs(_-d)<1e-9));w++)d=_;var x=[i*l,s*l,o*l,c*l],y=g.dot(g.sml(255,x),f);return{Cov:a,q:x,e:f,L:d,eMq255:y,eMq:g.dot(f,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}},C.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]]}},C.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 s=new Uint8Array(e[n]),o=s.length,c=0;c<o;c+=4){var l=s[c],a=s[c+1],h=s[c+2],g=s[c+3];g==0&&(l=a=h=0),r[i+c]=l,r[i+c+1]=a,r[i+c+2]=h,r[i+c+3]=g}i+=o}return r.buffer};const pf=e=>{if(e===0)return zt.Greyscale;if(e===2)return zt.Truecolour;if(e===3)return zt.IndexedColour;if(e===4)return zt.GreyscaleWithAlpha;if(e===6)return zt.TruecolourWithAlpha;throw new Error(`Unknown color type: ${e}`)},bf=e=>{const t=Math.floor(e.length/4),n=new Uint8Array(t*3),r=new Uint8Array(t*1);let i=0,s=0,o=0;for(;i<e.length;)n[s++]=e[i++],n[s++]=e[i++],n[s++]=e[i++],r[o++]=e[i++];return{rgbChannel:n,alphaChannel:r}};var zt=(e=>(e.Greyscale="Greyscale",e.Truecolour="Truecolour",e.IndexedColour="IndexedColour",e.GreyscaleWithAlpha="GreyscaleWithAlpha",e.TruecolourWithAlpha="TruecolourWithAlpha",e))(zt||{});const ya=class{constructor(e){p(this,"rgbChannel"),p(this,"alphaChannel"),p(this,"type"),p(this,"width"),p(this,"height"),p(this,"bitsPerComponent");const t=C.decode(e),n=C.toRGBA8(t);if(n.length>1)throw new Error("Animated PNGs are not supported");const r=new Uint8Array(n[0]),{rgbChannel:i,alphaChannel:s}=bf(r);this.rgbChannel=i,s.some(c=>c<255)&&(this.alphaChannel=s),this.type=pf(t.ctype),this.width=t.width,this.height=t.height,this.bitsPerComponent=8}};let wa=ya;p(wa,"load",e=>new ya(e));class Ai{constructor(t){p(this,"bitsPerComponent"),p(this,"height"),p(this,"width"),p(this,"colorSpace"),p(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=wa.load(t);return new Ai(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 er=class extends pe{constructor(e){super(),p(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,s=this.value.length;i<s;i++){const o=this.value[i],c=$(o),l=this.value[i+1];n?c===b.Newline||c===b.CarriageReturn?r():c===b.n?r(b.Newline):c===b.r?r(b.CarriageReturn):c===b.t?r(b.Tab):c===b.b?r(b.Backspace):c===b.f?r(b.FormFeed):c===b.LeftParen?r(b.LeftParen):c===b.RightParen?r(b.RightParen):c===b.Backspace?r(b.BackSlash):c>=b.Zero&&c<=b.Seven?(t+=o,(t.length===3||!(l>="0"&&l<="7"))&&(r(parseInt(t,8)),t="")):r(c):c===b.BackSlash?n=!0:r(c)}return new Uint8Array(e)}decodeText(){const e=this.asBytes();return ks(e)?ys(e):ms(e)}decodeDate(){const e=this.decodeText(),t=gs(e);if(!t)throw new Bs(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++]=b.LeftParen,t+=fe(this.value,e,t),e[t++]=b.RightParen,this.value.length+2}};let oe=er;p(oe,"of",e=>new er(e)),p(oe,"fromDate",e=>{const t=Pe(String(e.getUTCFullYear()),4,"0"),n=Pe(String(e.getUTCMonth()+1),2,"0"),r=Pe(String(e.getUTCDate()),2,"0"),i=Pe(String(e.getUTCHours()),2,"0"),s=Pe(String(e.getUTCMinutes()),2,"0"),o=Pe(String(e.getUTCSeconds()),2,"0");return new er(`D:${t}${n}${r}${i}${s}${o}Z`)});const mf=/\/([^\0\t\n\f\r\ ]+)[\0\t\n\f\r\ ]*(\d*\.\d+|\d+)?[\0\t\n\f\r\ ]+Tf/;class tr{constructor(t,n){p(this,"dict"),p(this,"ref"),this.dict=t,this.ref=n}T(){return this.dict.lookupMaybe(m.of("T"),oe,X)}Ff(){const t=this.getInheritableAttribute(m.of("Ff"));return this.dict.context.lookupMaybe(t,U)}V(){const t=this.getInheritableAttribute(m.of("V"));return this.dict.context.lookup(t)}Kids(){return this.dict.lookupMaybe(m.of("Kids"),J)}DA(){const t=this.dict.lookup(m.of("DA"));if(t instanceof oe||t instanceof X)return t}setKids(t){this.dict.set(m.of("Kids"),this.dict.context.obj(t))}getParent(){const t=this.dict.get(m.of("Parent"));if(t instanceof se){const n=this.dict.lookup(m.of("Parent"),V);return new tr(n,t)}}setParent(t){t?this.dict.set(m.of("Parent"),t):this.dict.delete(m.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(m.of("T"),X.fromText(t)):this.dict.delete(m.of("T"))}setDefaultAppearance(t){this.dict.set(m.of("DA"),oe.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 Xc(r);const s=Bc(i,mf);if(!s.match)throw new Yc(r);const o=i.slice(0,s.pos-s.match[0].length),c=s.pos<=i.length?i.slice(s.pos):"",l=s.match[1],a=`${o} /${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(m.of("Ff"),U.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 xa=class{constructor(e){p(this,"dict"),this.dict=e}W(){const e=this.dict.lookup(m.of("W"));if(e instanceof U)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(m.of("W"),t)}};let nr=xa;p(nr,"fromDict",e=>new xa(e));const Sa=class{constructor(e){p(this,"dict"),this.dict=e}Rect(){return this.dict.lookup(m.of("Rect"),J)}AP(){return this.dict.lookupMaybe(m.of("AP"),V)}F(){const e=this.dict.lookup(m.of("F"));return this.dict.context.lookupMaybe(e,U)}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,s=this.dict.context.obj([t,n,t+r,n+i]);this.dict.set(m.of("Rect"),s)}getAppearanceState(){const e=this.dict.lookup(m.of("AS"));if(e instanceof m)return e}setAppearanceState(e){this.dict.set(m.of("AS"),e)}setAppearances(e){this.dict.set(m.of("AP"),e)}ensureAP(){let e=this.AP();return e||(e=this.dict.context.obj({}),this.dict.set(m.of("AP"),e)),e}getNormalAppearance(){const t=this.ensureAP().get(m.of("N"));if(t instanceof se||t instanceof V)return t;throw new Error(`Unexpected N type: ${t?.constructor.name}`)}setNormalAppearance(e){this.ensureAP().set(m.of("N"),e)}setRolloverAppearance(e){this.ensureAP().set(m.of("R"),e)}setDownAppearance(e){this.ensureAP().set(m.of("D"),e)}removeRolloverAppearance(){const e=this.AP();e?.delete(m.of("R"))}removeDownAppearance(){const e=this.AP();e?.delete(m.of("D"))}getAppearances(){const e=this.AP();if(!e)return;const t=e.lookup(m.of("N"),V,st),n=e.lookupMaybe(m.of("R"),V,st),r=e.lookupMaybe(m.of("D"),V,st);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(m.of("F"),U.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 va=Sa;p(va,"fromDict",e=>new Sa(e));const ka=class{constructor(e){p(this,"dict"),this.dict=e}R(){const e=this.dict.lookup(m.of("R"));if(e instanceof U)return e}BC(){const e=this.dict.lookup(m.of("BC"));if(e instanceof J)return e}BG(){const e=this.dict.lookup(m.of("BG"));if(e instanceof J)return e}CA(){const e=this.dict.lookup(m.of("CA"));if(e instanceof X||e instanceof oe)return e}RC(){const e=this.dict.lookup(m.of("RC"));if(e instanceof X||e instanceof oe)return e}AC(){const e=this.dict.lookup(m.of("AC"));if(e instanceof X||e instanceof oe)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 U&&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 U&&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(m.of("R"),t)}setBorderColor(e){const t=this.dict.context.obj(e);this.dict.set(m.of("BC"),t)}setBackgroundColor(e){const t=this.dict.context.obj(e);this.dict.set(m.of("BG"),t)}setCaptions(e){const t=X.fromText(e.normal);if(this.dict.set(m.of("CA"),t),e.rollover){const n=X.fromText(e.rollover);this.dict.set(m.of("RC"),n)}else this.dict.delete(m.of("RC"));if(e.down){const n=X.fromText(e.down);this.dict.set(m.of("AC"),n)}else this.dict.delete(m.of("AC"))}};let rr=ka;p(rr,"fromDict",e=>new ka(e));const Ci=class extends va{MK(){const e=this.dict.lookup(m.of("MK"));if(e instanceof V)return e}BS(){const e=this.dict.lookup(m.of("BS"));if(e instanceof V)return e}DA(){const e=this.dict.lookup(m.of("DA"));if(e instanceof oe||e instanceof X)return e}P(){const e=this.dict.get(m.of("P"));if(e instanceof se)return e}setP(e){this.dict.set(m.of("P"),e)}setDefaultAppearance(e){this.dict.set(m.of("DA"),oe.of(e))}getDefaultAppearance(){const e=this.DA();return e instanceof X?e.decodeText():e?.asString()}getAppearanceCharacteristics(){const e=this.MK();if(e)return rr.fromDict(e)}getOrCreateAppearanceCharacteristics(){const e=this.MK();if(e)return rr.fromDict(e);const t=rr.fromDict(this.dict.context.obj({}));return this.dict.set(m.of("MK"),t.dict),t}getBorderStyle(){const e=this.BS();if(e)return nr.fromDict(e)}getOrCreateBorderStyle(){const e=this.BS();if(e)return nr.fromDict(e);const t=nr.fromDict(this.dict.context.obj({}));return this.dict.set(m.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 s=n[r];if(s!==m.of("Off"))return s}}}};let ir=Ci;p(ir,"fromDict",e=>new Ci(e)),p(ir,"create",(e,t)=>{const n=e.obj({Type:"Annot",Subtype:"Widget",Rect:[0,0,0,0],Parent:t});return new Ci(n)});const Aa=class extends tr{FT(){const e=this.getInheritableAttribute(m.of("FT"));return this.dict.context.lookup(e,m)}getWidgets(){const e=this.Kids();if(!e)return[ir.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]=ir.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 zn(e,0,t.size());t.remove(e)}else{if(e!==0)throw new zn(e,0,0);this.setKids([])}}normalizedEntries(){let e=this.Kids();return e||(e=this.dict.context.obj([this.ref]),this.dict.set(m.of("Kids"),e)),{Kids:e}}};let Ft=Aa;p(Ft,"fromDict",(e,t)=>new Aa(e,t));class Bi extends Ft{Opt(){return this.dict.lookupMaybe(m.of("Opt"),oe,X,J)}setOpt(t){this.dict.set(m.of("Opt"),this.dict.context.obj(t))}getExportValues(){const t=this.Opt();if(!t)return;if(t instanceof oe||t instanceof X)return[t];const n=[];for(let r=0,i=t.size();r<i;r++){const s=t.lookup(r);(s instanceof oe||s instanceof X)&&n.push(s)}return n}removeExportValue(t){const n=this.Opt();if(!!n)if(n instanceof oe||n instanceof X){if(t!==0)throw new zn(t,0,0);this.setOpt([])}else{if(t<0||t>n.size())throw new zn(t,0,n.size());n.remove(t)}}normalizeExportValues(){var t,n,r,i;const s=(t=this.getExportValues())!=null?t:[],o=[],c=this.getWidgets();for(let l=0,a=c.length;l<a;l++){const h=c[l],g=(i=s[l])!=null?i:X.fromText((r=(n=h.getOnValue())==null?void 0:n.decodeText())!=null?r:"");o.push(g)}this.setOpt(o)}addOpt(t,n){var r;this.normalizeExportValues();const i=t.decodeText();let s;if(n){const c=(r=this.getExportValues())!=null?r:[];for(let l=0,a=c.length;l<a;l++)c[l].decodeText()===i&&(s=l)}const o=this.Opt();return o.push(t),s??o.size()-1}addWidgetWithOpt(t,n,r){const i=this.addOpt(n,r),s=m.of(String(i));return this.addWidget(t),s}}const Ti=class extends Bi{setValue(e){var t;const n=(t=this.getOnValue())!=null?t:m.of("Yes");if(e!==n&&e!==m.of("Off"))throw new Tr;this.dict.set(m.of("V"),e);const r=this.getWidgets();for(let i=0,s=r.length;i<s;i++){const o=r[i],c=o.getOnValue()===e?e:m.of("Off");o.setAppearanceState(c)}}getValue(){const e=this.V();return e instanceof m?e:m.of("Off")}getOnValue(){const[e]=this.getWidgets();return e?.getOnValue()}};let Ei=Ti;p(Ei,"fromDict",(e,t)=>new Ti(e,t)),p(Ei,"create",e=>{const t=e.obj({FT:"Btn",Kids:[]}),n=e.register(t);return new Ti(t,n)});const ce=e=>1<<e;var _f=(e=>(e[e.ReadOnly=ce(0)]="ReadOnly",e[e.Required=ce(1)]="Required",e[e.NoExport=ce(2)]="NoExport",e))(_f||{}),bn=(e=>(e[e.NoToggleToOff=ce(14)]="NoToggleToOff",e[e.Radio=ce(15)]="Radio",e[e.PushButton=ce(16)]="PushButton",e[e.RadiosInUnison=ce(25)]="RadiosInUnison",e))(bn||{}),yf=(e=>(e[e.Multiline=ce(12)]="Multiline",e[e.Password=ce(13)]="Password",e[e.FileSelect=ce(20)]="FileSelect",e[e.DoNotSpellCheck=ce(22)]="DoNotSpellCheck",e[e.DoNotScroll=ce(23)]="DoNotScroll",e[e.Comb=ce(24)]="Comb",e[e.RichText=ce(25)]="RichText",e))(yf||{}),Nt=(e=>(e[e.Combo=ce(17)]="Combo",e[e.Edit=ce(18)]="Edit",e[e.Sort=ce(19)]="Sort",e[e.MultiSelect=ce(21)]="MultiSelect",e[e.DoNotSpellCheck=ce(22)]="DoNotSpellCheck",e[e.CommitOnSelChange=ce(26)]="CommitOnSelChange",e))(Nt||{});class Ca extends Ft{setValues(t){if(this.hasFlag(Nt.Combo)&&!this.hasFlag(Nt.Edit)&&!this.valuesAreValid(t))throw new Tr;if(t.length===0&&this.dict.delete(m.of("V")),t.length===1&&this.dict.set(m.of("V"),t[0]),t.length>1){if(!this.hasFlag(Nt.MultiSelect))throw new qc;this.dict.set(m.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 s=t[r].decodeText();if(!n.find(o=>s===(o.display||o.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,s=t.length;i<s;i++){const o=t[i].decodeText();n[i]=r.findIndex(c=>o===(c.display||c.value).decodeText())}this.dict.set(m.of("I"),this.dict.context.obj(n.sort()))}else this.dict.delete(m.of("I"))}getValues(){const t=this.V();if(t instanceof oe||t instanceof X)return[t];if(t instanceof J){const n=[];for(let r=0,i=t.size();r<i;r++){const s=t.lookup(r);(s instanceof oe||s instanceof X)&&n.push(s)}return n}return[]}Opt(){return this.dict.lookupMaybe(m.of("Opt"),oe,X,J)}setOptions(t){const n=new Array(t.length);for(let r=0,i=t.length;r<i;r++){const{value:s,display:o}=t[r];n[r]=this.dict.context.obj([s,o||s])}this.dict.set(m.of("Opt"),this.dict.context.obj(n))}getOptions(){const t=this.Opt();if(t instanceof oe||t instanceof X)return[{value:t,display:t}];if(t instanceof J){const n=[];for(let r=0,i=t.size();r<i;r++){const s=t.lookup(r);if((s instanceof oe||s instanceof X)&&n.push({value:s,display:s}),s instanceof J&&s.size()>0){const o=s.lookup(0,oe,X),c=s.lookupMaybe(1,oe,X);n.push({value:o,display:c||o})}}return n}return[]}}const Di=class extends Ca{};let Pi=Di;p(Pi,"fromDict",(e,t)=>new Di(e,t)),p(Pi,"create",e=>{const t=e.obj({FT:"Ch",Ff:Nt.Combo,Kids:[]}),n=e.register(t);return new Di(t,n)});const Ri=class extends tr{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(m.of("Kids"),e)),{Kids:e}}};let sr=Ri;p(sr,"fromDict",(e,t)=>new Ri(e,t)),p(sr,"create",e=>{const t=e.obj({}),n=e.register(t);return new Ri(t,n)});const Ba=class extends Ft{};let Ta=Ba;p(Ta,"fromDict",(e,t)=>new Ba(e,t));const Ii=class extends Ft{MaxLen(){const e=this.dict.lookup(m.of("MaxLen"));if(e instanceof U)return e}Q(){const e=this.dict.lookup(m.of("Q"));if(e instanceof U)return e}setMaxLength(e){this.dict.set(m.of("MaxLen"),U.of(e))}removeMaxLength(){this.dict.delete(m.of("MaxLen"))}getMaxLength(){var e;return(e=this.MaxLen())==null?void 0:e.asNumber()}setQuadding(e){this.dict.set(m.of("Q"),U.of(e))}getQuadding(){var e;return(e=this.Q())==null?void 0:e.asNumber()}setValue(e){this.dict.set(m.of("V"),e)}removeValue(){this.dict.delete(m.of("V"))}getValue(){const e=this.V();if(e instanceof oe||e instanceof X)return e}};let Oi=Ii;p(Oi,"fromDict",(e,t)=>new Ii(e,t)),p(Oi,"create",e=>{const t=e.obj({FT:"Tx",Kids:[]}),n=e.register(t);return new Ii(t,n)});const zi=class extends Bi{};let Fi=zi;p(Fi,"fromDict",(e,t)=>new zi(e,t)),p(Fi,"create",e=>{const t=e.obj({FT:"Btn",Ff:bn.PushButton,Kids:[]}),n=e.register(t);return new zi(t,n)});const Ni=class extends Bi{setValue(e){if(!this.getOnValues().includes(e)&&e!==m.of("Off"))throw new Tr;this.dict.set(m.of("V"),e);const n=this.getWidgets();for(let r=0,i=n.length;r<i;r++){const s=n[r],o=s.getOnValue()===e?e:m.of("Off");s.setAppearanceState(o)}}getValue(){const e=this.V();return e instanceof m?e:m.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 Li=Ni;p(Li,"fromDict",(e,t)=>new Ni(e,t)),p(Li,"create",e=>{const t=e.obj({FT:"Btn",Ff:bn.Radio,Kids:[]}),n=e.register(t);return new Ni(t,n)});const Mi=class extends Ca{};let ji=Mi;p(ji,"fromDict",(e,t)=>new Mi(e,t)),p(ji,"create",e=>{const t=e.obj({FT:"Ch",Kids:[]}),n=e.register(t);return new Mi(t,n)});const wf=e=>{if(!e)return[];const t=[];for(let n=0,r=e.size();n<r;n++){const i=e.get(n),s=e.lookup(n);i instanceof se&&s instanceof V&&t.push([Ea(s,i),i])}return t},Ea=(e,t)=>xf(e)?sr.fromDict(e,t):Sf(e,t),xf=e=>{const t=e.lookup(m.of("Kids"));if(t instanceof J)for(let n=0,r=t.size();n<r;n++){const i=t.lookup(n);if(i instanceof V&&i.has(m.of("T")))return!0}return!1},Sf=(e,t)=>{const n=$i(e,m.of("FT")),r=e.context.lookup(n,m);return r===m.of("Btn")?vf(e,t):r===m.of("Ch")?kf(e,t):r===m.of("Tx")?Oi.fromDict(e,t):r===m.of("Sig")?Ta.fromDict(e,t):Ft.fromDict(e,t)},vf=(e,t)=>{var n;const r=$i(e,m.of("Ff")),i=e.context.lookupMaybe(r,U),s=(n=i?.asNumber())!=null?n:0;return Ui(s,bn.PushButton)?Fi.fromDict(e,t):Ui(s,bn.Radio)?Li.fromDict(e,t):Ei.fromDict(e,t)},kf=(e,t)=>{var n;const r=$i(e,m.of("Ff")),i=e.context.lookupMaybe(r,U),s=(n=i?.asNumber())!=null?n:0;return Ui(s,Nt.Combo)?Pi.fromDict(e,t):ji.fromDict(e,t)},Ui=(e,t)=>(e&t)!==0,$i=(e,t)=>{let n;return Da(e,r=>{n||(n=r.get(t))}),n},Da=(e,t)=>{t(e);const n=e.lookupMaybe(m.of("Parent"),V);n&&Da(n,t)},Hi=class{constructor(e){p(this,"dict"),this.dict=e}Fields(){const e=this.dict.lookup(m.of("Fields"));if(e instanceof J)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),s=e.lookup(n,V);t[n]=[Ea(s,i),i]}return t}getAllFields(){const e=[],t=n=>{if(!!n)for(let r=0,i=n.length;r<i;r++){const s=n[r];e.push(s);const[o]=s;o instanceof sr&&t(wf(o.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(m.of("Fields"),e)),{Fields:e}}};let or=Hi;p(or,"fromDict",e=>new Hi(e)),p(or,"create",e=>{const t=e.obj({Fields:[]});return new Hi(t)});const ar=(e,t)=>{if(e!==void 0)return t[e]};var Wi=(e=>(e.UseNone="UseNone",e.UseOutlines="UseOutlines",e.UseThumbs="UseThumbs",e.UseOC="UseOC",e))(Wi||{}),Gi=(e=>(e.L2R="L2R",e.R2L="R2L",e))(Gi||{}),Vi=(e=>(e.None="None",e.AppDefault="AppDefault",e))(Vi||{}),Ki=(e=>(e.Simplex="Simplex",e.DuplexFlipShortEdge="DuplexFlipShortEdge",e.DuplexFlipLongEdge="DuplexFlipLongEdge",e))(Ki||{});const Zi=class{constructor(e){p(this,"dict"),this.dict=e}lookupBool(e){const t=this.dict.lookup(m.of(e));if(t instanceof mt)return t}lookupName(e){const t=this.dict.lookup(m.of(e));if(t instanceof m)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(m.of("PrintPageRange"));if(e instanceof J)return e}NumCopies(){const e=this.dict.lookup(m.of("NumCopies"));if(e instanceof U)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=ar(n,Wi))!=null?t:"UseNone"}getReadingDirection(){var e,t;const n=(e=this.Direction())==null?void 0:e.decodeText();return(t=ar(n,Gi))!=null?t:"L2R"}getPrintScaling(){var e,t;const n=(e=this.PrintScaling())==null?void 0:e.decodeText();return(t=ar(n,Vi))!=null?t:"AppDefault"}getDuplex(){var e;const t=(e=this.Duplex())==null?void 0:e.decodeText();return ar(t,Ki)}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,U).asNumber(),i=e.lookup(n+1,U).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(m.of("HideToolbar"),t)}setHideMenubar(e){const t=this.dict.context.obj(e);this.dict.set(m.of("HideMenubar"),t)}setHideWindowUI(e){const t=this.dict.context.obj(e);this.dict.set(m.of("HideWindowUI"),t)}setFitWindow(e){const t=this.dict.context.obj(e);this.dict.set(m.of("FitWindow"),t)}setCenterWindow(e){const t=this.dict.context.obj(e);this.dict.set(m.of("CenterWindow"),t)}setDisplayDocTitle(e){const t=this.dict.context.obj(e);this.dict.set(m.of("DisplayDocTitle"),t)}setNonFullScreenPageMode(e){Zt(e,"nonFullScreenPageMode",Wi);const t=m.of(e);this.dict.set(m.of("NonFullScreenPageMode"),t)}setReadingDirection(e){Zt(e,"readingDirection",Gi);const t=m.of(e);this.dict.set(m.of("Direction"),t)}setPrintScaling(e){Zt(e,"printScaling",Vi);const t=m.of(e);this.dict.set(m.of("PrintScaling"),t)}setDuplex(e){Zt(e,"duplex",Ki);const t=m.of(e);this.dict.set(m.of("Duplex"),t)}setPickTrayByPDFSize(e){const t=this.dict.context.obj(e);this.dict.set(m.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);Cs(t,"printPageRange",["number"]);const n=this.dict.context.obj(t);this.dict.set(m.of("PrintPageRange"),n)}setNumCopies(e){Je(e,"numCopies",1,Number.MAX_VALUE),Wc(e,"numCopies");const t=this.dict.context.obj(e);this.dict.set(m.of("NumCopies"),t)}};let cr=Zi;p(cr,"fromDict",e=>new Zi(e)),p(cr,"create",e=>{const t=e.obj({});return new Zi(t)});const qi=class extends V{Pages(){return this.lookup(m.of("Pages"),V)}AcroForm(){return this.lookupMaybe(m.of("AcroForm"),V)}getAcroForm(){const e=this.AcroForm();if(!!e)return or.fromDict(e)}getOrCreateAcroForm(){let e=this.getAcroForm();if(!e){e=or.create(this.context);const t=this.context.register(e.dict);this.set(m.of("AcroForm"),t)}return e}ViewerPreferences(){return this.lookupMaybe(m.of("ViewerPreferences"),V)}getViewerPreferences(){const e=this.ViewerPreferences();if(!!e)return cr.fromDict(e)}getOrCreateViewerPreferences(){let e=this.getViewerPreferences();if(!e){e=cr.create(this.context);const t=this.context.register(e.dict);this.set(m.of("ViewerPreferences"),t)}return e}insertLeafNode(e,t){const n=this.get(m.of("Pages"));return this.Pages().insertLeafNode(e,t)||n}removeLeafNode(e){this.Pages().removeLeafNode(e)}};let Xi=qi;p(Xi,"withContextAndPages",(e,t)=>{const n=new Map;return n.set(m.of("Type"),m.of("Catalog")),n.set(m.of("Pages"),t),new qi(n,e)}),p(Xi,"fromMapWithContext",(e,t)=>new qi(e,t));const lr=class extends V{constructor(e,t,n=!0){super(e,t),p(this,"normalized",!1),p(this,"autoNormalizeCTM"),this.autoNormalizeCTM=n}clone(e){const t=lr.fromMapWithContext(new Map,e||this.context,this.autoNormalizeCTM),n=this.entries();for(let r=0,i=n.length;r<i;r++){const[s,o]=n[r];t.set(s,o)}return t}Parent(){return this.lookupMaybe(m.Parent,V)}Contents(){return this.lookup(m.of("Contents"))}Annots(){return this.lookupMaybe(m.Annots,J)}BleedBox(){return this.lookupMaybe(m.BleedBox,J)}TrimBox(){return this.lookupMaybe(m.TrimBox,J)}ArtBox(){return this.lookupMaybe(m.ArtBox,J)}Resources(){const e=this.getInheritableAttribute(m.Resources);return this.context.lookupMaybe(e,V)}MediaBox(){const e=this.getInheritableAttribute(m.MediaBox);return this.context.lookup(e,J)}CropBox(){const e=this.getInheritableAttribute(m.CropBox);return this.context.lookupMaybe(e,J)}Rotate(){const e=this.getInheritableAttribute(m.Rotate);return this.context.lookupMaybe(e,U)}getInheritableAttribute(e){let t;return this.ascend(n=>{t||(t=n.get(e))}),t}setParent(e){this.set(m.Parent,e)}addContentStream(e){const t=this.normalizedEntries().Contents||this.context.obj([]);this.set(m.Contents,t),t.push(e)}wrapContentStreams(e,t){const n=this.Contents();return n instanceof J?(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(m.Contents);this.context.lookup(t)instanceof st&&this.set(m.Contents,e.obj([t])),this.autoNormalizeCTM&&this.wrapContentStreams(this.context.getPushGraphicsStateContentStream(),this.context.getPopGraphicsStateContentStream());const r=this.getInheritableAttribute(m.Resources),i=e.lookupMaybe(r,V)||e.obj({});this.set(m.Resources,i);const s=i.lookupMaybe(m.Font,V)||e.obj({});i.set(m.Font,s);const o=i.lookupMaybe(m.XObject,V)||e.obj({});i.set(m.XObject,o);const c=i.lookupMaybe(m.ExtGState,V)||e.obj({});i.set(m.ExtGState,c);const l=this.Annots()||e.obj([]);this.set(m.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(m.Font,V),XObject:t.lookup(m.XObject,V),ExtGState:t.lookup(m.ExtGState,V)}}};let Me=lr;p(Me,"InheritableEntries",["Resources","MediaBox","CropBox","Rotate"]),p(Me,"withContextAndParent",(e,t)=>{const n=new Map;return n.set(m.Type,m.Page),n.set(m.Parent,t),n.set(m.Resources,e.obj({})),n.set(m.MediaBox,e.obj([0,0,612,792])),new lr(n,e,!1)}),p(Me,"fromMapWithContext",(e,t,n=!0)=>new lr(e,t,n));const Yi=class{constructor(e){p(this,"bytes"),p(this,"length"),p(this,"idx",0),p(this,"line",0),p(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===b.Newline?(this.line+=1,this.column=0):this.column+=1,e}assertNext(e){if(this.peek()!==e)throw new Jc(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=Yi;p(Lt,"of",e=>new Yi(e)),p(Lt,"fromPDFRawStream",e=>Yi.of(pa(e).decode()));const ge=new Uint8Array(256);ge[b.Zero]=1,ge[b.One]=1,ge[b.Two]=1,ge[b.Three]=1,ge[b.Four]=1,ge[b.Five]=1,ge[b.Six]=1,ge[b.Seven]=1,ge[b.Eight]=1,ge[b.Nine]=1;const hr=new Uint8Array(256);hr[b.Period]=1,hr[b.Plus]=1,hr[b.Minus]=1;const Ji=new Uint8Array(256);for(let e=0,t=256;e<t;e++)Ji[e]=ge[e]||hr[e]?1:0;const{Newline:Pa,CarriageReturn:Ra}=b;class Af{constructor(t,n=!1){p(this,"bytes"),p(this,"capNumbers"),this.bytes=t,this.capNumbers=n}parseRawInt(){let t="";for(;!this.bytes.done();){const r=this.bytes.peek();if(!ge[r])break;t+=We(this.bytes.next())}const n=Number(t);if(!t||!isFinite(n))throw new Ds(this.bytes.position(),t);return n}parseRawNumber(){let t="";for(;!this.bytes.done();){const r=this.bytes.peek();if(!Ji[r]||(t+=We(this.bytes.next()),r===b.Period))break}for(;!this.bytes.done();){const r=this.bytes.peek();if(!ge[r])break;t+=We(this.bytes.next())}const n=Number(t);if(!t||!isFinite(n))throw new Ds(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()&&Ve[this.bytes.peek()];)this.bytes.next()}skipLine(){for(;!this.bytes.done();){const t=this.bytes.peek();if(t===Pa||t===Ra)return;this.bytes.next()}}skipComment(){if(this.bytes.peek()!==b.Percent)return!1;for(;!this.bytes.done();){const t=this.bytes.peek();if(t===Pa||t===Ra)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 Mt=class extends V{Parent(){return this.lookup(m.of("Parent"))}Kids(){return this.lookup(m.of("Kids"),J)}Count(){return this.lookup(m.of("Count"),U)}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 Ts(t,r);let i=t;for(let s=0,o=n.size();s<o;s++){if(i===0){this.insertLeafKid(s,e);return}const c=n.get(s),l=this.context.lookup(c);if(l instanceof Mt){if(l.Count().asNumber()>i)return l.insertLeafNode(e,i)||c;i-=l.Count().asNumber()}l instanceof Me&&(i-=1)}if(i===0){this.insertLeafKid(n.size(),e);return}throw new Es(t,"insertLeafNode")}removeLeafNode(e,t=!0){const n=this.Kids(),r=this.Count().asNumber();if(e>=r)throw new Ts(e,r);let i=e;for(let s=0,o=n.size();s<o;s++){const c=n.get(s),l=this.context.lookup(c);if(l instanceof Mt)if(l.Count().asNumber()>i){l.removeLeafNode(i,t),t&&l.Kids().size()===0&&n.remove(s);return}else i-=l.Count().asNumber();if(l instanceof Me)if(i===0){this.removeKid(s);return}else i-=1}throw new Es(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),s=this.context.lookup(i);s instanceof Mt&&s.traverse(e),e(s,i)}}insertLeafKid(e,t){const n=this.Kids();this.ascend(r=>{const i=r.Count().asNumber()+1;r.set(m.of("Count"),U.of(i))}),n.insert(e,t)}removeKid(e){const t=this.Kids();t.lookup(e)instanceof Me&&this.ascend(r=>{const i=r.Count().asNumber()-1;r.set(m.of("Count"),U.of(i))}),t.remove(e)}};let Qi=Mt;p(Qi,"withContext",(e,t)=>{const n=new Map;return n.set(m.of("Type"),m.of("Pages")),n.set(m.of("Kids"),e.obj([])),n.set(m.of("Count"),e.obj(0)),t&&n.set(m.of("Parent"),t),new Mt(n,e)}),p(Qi,"fromMapWithContext",(e,t)=>new Mt(e,t));const{Space:Cf,CarriageReturn:mn,Newline:_n}=b,yn=[b.s,b.t,b.r,b.e,b.a,b.m],dr=[b.e,b.n,b.d,b.s,b.t,b.r,b.e,b.a,b.m],ee={header:[b.Percent,b.P,b.D,b.F,b.Dash],eof:[b.Percent,b.Percent,b.E,b.O,b.F],obj:[b.o,b.b,b.j],endobj:[b.e,b.n,b.d,b.o,b.b,b.j],xref:[b.x,b.r,b.e,b.f],trailer:[b.t,b.r,b.a,b.i,b.l,b.e,b.r],startxref:[b.s,b.t,b.a,b.r,b.t,b.x,b.r,b.e,b.f],true:[b.t,b.r,b.u,b.e],false:[b.f,b.a,b.l,b.s,b.e],null:[b.n,b.u,b.l,b.l],stream:yn,streamEOF1:[...yn,Cf,mn,_n],streamEOF2:[...yn,mn,_n],streamEOF3:[...yn,mn],streamEOF4:[...yn,_n],endstream:dr,EOF1endstream:[mn,_n,...dr],EOF2endstream:[mn,...dr],EOF3endstream:[_n,...dr]},es=class extends Af{constructor(e,t,n=!1){super(e,n),p(this,"context"),this.context=t}parseObject(){if(this.skipWhitespaceAndComments(),this.matchKeyword(ee.true))return mt.True;if(this.matchKeyword(ee.false))return mt.False;if(this.matchKeyword(ee.null))return _e;const e=this.bytes.peek();if(e===b.LessThan&&this.bytes.peekAhead(1)===b.LessThan)return this.parseDictOrStream();if(e===b.LessThan)return this.parseHexString();if(e===b.LeftParen)return this.parseString();if(e===b.ForwardSlash)return this.parseName();if(e===b.LeftSquareBracket)return this.parseArray();if(Ji[e])return this.parseNumberOrRef();throw new Qc(this.bytes.position(),e)}parseNumberOrRef(){const e=this.parseRawNumber();this.skipWhitespaceAndComments();const t=this.bytes.offset();if(ge[this.bytes.peek()]){const n=this.parseRawNumber();if(this.skipWhitespaceAndComments(),this.bytes.peek()===b.R)return this.bytes.assertNext(b.R),se.of(e,n)}return this.bytes.moveTo(t),U.of(e)}parseHexString(){let e="";for(this.bytes.assertNext(b.LessThan);!this.bytes.done()&&this.bytes.peek()!==b.GreaterThan;)e+=We(this.bytes.next());return this.bytes.assertNext(b.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===b.LeftParen&&(e+=1),r===b.RightParen&&(e-=1)),r===b.BackSlash?t=!t:t&&(t=!1),e===0)return oe.of(n.substring(1,n.length-1))}throw new nl(this.bytes.position())}parseName(){this.bytes.assertNext(b.ForwardSlash);let e="";for(;!this.bytes.done();){const t=this.bytes.peek();if(Ve[t]||Ae[t])break;e+=We(t),this.bytes.next()}return m.of(e)}parseArray(){this.bytes.assertNext(b.LeftSquareBracket),this.skipWhitespaceAndComments();const e=J.withContext(this.context);for(;this.bytes.peek()!==b.RightSquareBracket;){const t=this.parseObject();e.push(t),this.skipWhitespaceAndComments()}return this.bytes.assertNext(b.RightSquareBracket),e}parseDict(){this.bytes.assertNext(b.LessThan),this.bytes.assertNext(b.LessThan),this.skipWhitespaceAndComments();const e=new Map;for(;!this.bytes.done()&&this.bytes.peek()!==b.GreaterThan&&this.bytes.peekAhead(1)!==b.GreaterThan;){const n=this.parseName(),r=this.parseObject();e.set(n,r),this.skipWhitespaceAndComments()}this.skipWhitespaceAndComments(),this.bytes.assertNext(b.GreaterThan),this.bytes.assertNext(b.GreaterThan);const t=e.get(m.of("Type"));return t===m.of("Catalog")?Xi.fromMapWithContext(e,this.context):t===m.of("Pages")?Qi.fromMapWithContext(e,this.context):t===m.of("Page")?Me.fromMapWithContext(e,this.context):V.fromMapWithContext(e,this.context)}parseDictOrStream(){const e=this.bytes.position(),t=this.parseDict();if(this.skipWhitespaceAndComments(),!this.matchKeyword(ee.streamEOF1)&&!this.matchKeyword(ee.streamEOF2)&&!this.matchKeyword(ee.streamEOF3)&&!this.matchKeyword(ee.streamEOF4)&&!this.matchKeyword(ee.stream))return t;const n=this.bytes.offset();let r;const i=t.get(m.of("Length"));i instanceof U?(r=n+i.asNumber(),this.bytes.moveTo(r),this.skipWhitespaceAndComments(),this.matchKeyword(ee.endstream)||(this.bytes.moveTo(n),r=this.findEndOfStreamFallback(e))):r=this.findEndOfStreamFallback(e);const s=this.bytes.slice(n,r);return It.of(t,s)}findEndOfStreamFallback(e){let t=1,n=this.bytes.offset();for(;!this.bytes.done()&&(n=this.bytes.offset(),this.matchKeyword(ee.stream)?t+=1:this.matchKeyword(ee.EOF1endstream)||this.matchKeyword(ee.EOF2endstream)||this.matchKeyword(ee.EOF3endstream)||this.matchKeyword(ee.endstream)?t-=1:this.bytes.next(),t!==0););if(t!==0)throw new tl(e);return n}};let fr=es;p(fr,"forBytes",(e,t,n)=>new es(Lt.of(e),t,n)),p(fr,"forByteStream",(e,t,n=!1)=>new es(e,t,n));const Ia=class extends fr{constructor(e,t){super(Lt.fromPDFRawStream(e),e.dict.context),p(this,"alreadyParsed"),p(this,"shouldWaitForTick"),p(this,"firstOffset"),p(this,"objectCount");const{dict:n}=e;this.alreadyParsed=!1,this.shouldWaitForTick=t||(()=>!1),this.firstOffset=n.lookup(m.of("First"),U).asNumber(),this.objectCount=n.lookup(m.of("N"),U).asNumber()}async parseIntoContext(){if(this.alreadyParsed)throw new Br("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 s=this.parseObject(),o=se.of(r,0);this.context.assign(o,s),this.shouldWaitForTick()&&await St()}}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 Oa=Ia;p(Oa,"forStream",(e,t)=>new Ia(e,t));const za=class{constructor(e){p(this,"alreadyParsed"),p(this,"dict"),p(this,"context"),p(this,"bytes"),p(this,"subsections"),p(this,"byteWidths"),this.alreadyParsed=!1,this.dict=e.dict,this.bytes=Lt.fromPDFRawStream(e),this.context=this.dict.context;const t=this.dict.lookup(m.of("Size"),U),n=this.dict.lookup(m.of("Index"));if(n instanceof J){this.subsections=[];for(let i=0,s=n.size();i<s;i+=2){const o=n.lookup(i+0,U).asNumber(),c=n.lookup(i+1,U).asNumber();this.subsections.push({firstObjectNumber:o,length:c})}}else this.subsections=[{firstObjectNumber:0,length:t.asNumber()}];const r=this.dict.lookup(m.of("W"),J);this.byteWidths=[-1,-1,-1];for(let i=0,s=r.size();i<s;i++)this.byteWidths[i]=r.lookup(i,U).asNumber()}parseIntoContext(){if(this.alreadyParsed)throw new Br("PDFXRefStreamParser","parseIntoContext");return this.alreadyParsed=!0,this.context.trailerInfo={Root:this.dict.get(m.of("Root")),Encrypt:this.dict.get(m.of("Encrypt")),Info:this.dict.get(m.of("Info")),ID:this.dict.get(m.of("ID"))},this.parseEntries()}parseEntries(){const e=[],[t,n,r]=this.byteWidths;for(let i=0,s=this.subsections.length;i<s;i++){const{firstObjectNumber:o,length:c}=this.subsections[i];for(let l=0;l<c;l++){let a=0;for(let _=0,w=t;_<w;_++)a=a<<8|this.bytes.next();let h=0;for(let _=0,w=n;_<w;_++)h=h<<8|this.bytes.next();let g=0;for(let _=0,w=r;_<w;_++)g=g<<8|this.bytes.next();t===0&&(a=1);const f=o+l,d={ref:se.of(f,g),offset:h,deleted:a===0,inObjectStream:a===2};e.push(d)}}return e}};let Fa=za;p(Fa,"forStream",e=>new za(e));const Na=class extends fr{constructor(e,t=1/0,n=!1,r=!1){super(Lt.of(e),pi.create(),r),p(this,"objectsPerTick"),p(this,"throwOnInvalidObject"),p(this,"alreadyParsed",!1),p(this,"parsedObjects",0),p(this,"shouldWaitForTick",()=>(this.parsedObjects+=1,this.parsedObjects%this.objectsPerTick===0)),this.objectsPerTick=t,this.throwOnInvalidObject=n}async parseDocument(){if(this.alreadyParsed)throw new Br("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 rl(this.bytes.position());e=t}return this.maybeRecoverRoot(),this.context.lookup(se.of(0))&&(console.warn("Removing parsed object: 0 0 R"),this.context.delete(se.of(0))),this.context}maybeRecoverRoot(){const e=n=>n instanceof V&&n.lookup(m.of("Type"))===m.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[s,o]=n[r];e(o)&&(this.context.trailerInfo.Root=s)}}}parseHeader(){for(;!this.bytes.done();){if(this.matchKeyword(ee.header)){const e=this.parseRawInt();this.bytes.assertNext(b.Period);const t=this.parseRawInt(),n=gn.forVersion(e,t);return this.skipBinaryHeaderComment(),n}this.bytes.next()}throw new il(this.bytes.position())}parseIndirectObjectHeader(){this.skipWhitespaceAndComments();const e=this.parseRawInt();this.skipWhitespaceAndComments();const t=this.parseRawInt();if(this.skipWhitespaceAndComments(),!this.matchKeyword(ee.obj))throw new sl(this.bytes.position(),ee.obj);return se.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(ee.endobj),t instanceof It&&t.dict.lookup(m.of("Type"))===m.of("ObjStm")?await Oa.forStream(t,this.shouldWaitForTick).parseIntoContext():t instanceof It&&t.dict.lookup(m.of("Type"))===m.of("XRef")?Fa.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(ee.endobj)&&(i=!1),!!i);)this.bytes.next();if(i)throw new el(e);const s=this.bytes.offset()-ee.endobj.length,o=Si.of(this.bytes.slice(r,s));return this.context.assign(n,o),n}async parseIndirectObjects(){for(this.skipWhitespaceAndComments();!this.bytes.done()&&ge[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 St()}}maybeParseCrossRefSection(){if(this.skipWhitespaceAndComments(),!this.matchKeyword(ee.xref))return;this.skipWhitespaceAndComments();let e=-1;const t=Xn.createEmpty();for(;!this.bytes.done()&&ge[this.bytes.peek()];){const n=this.parseRawInt();this.skipWhitespaceAndComments();const r=this.parseRawInt();this.skipWhitespaceAndComments();const i=this.bytes.peek();if(i===b.n||i===b.f){const s=se.of(e,r);this.bytes.next()===b.n?t.addEntry(s,n):t.addDeletedEntry(s,n),e+=1}else e=n;this.skipWhitespaceAndComments()}return t}maybeParseTrailerDict(){if(this.skipWhitespaceAndComments(),!this.matchKeyword(ee.trailer))return;this.skipWhitespaceAndComments();const e=this.parseDict(),{context:t}=this;t.trailerInfo={Root:e.get(m.of("Root"))||t.trailerInfo.Root,Encrypt:e.get(m.of("Encrypt"))||t.trailerInfo.Encrypt,Info:e.get(m.of("Info"))||t.trailerInfo.Info,ID:e.get(m.of("ID"))||t.trailerInfo.ID}}maybeParseTrailer(){if(this.skipWhitespaceAndComments(),!this.matchKeyword(ee.startxref))return;this.skipWhitespaceAndComments();const e=this.parseRawInt();return this.skipWhitespace(),this.matchKeyword(ee.eof),this.skipWhitespaceAndComments(),this.matchKeyword(ee.eof),this.skipWhitespaceAndComments(),Yn.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>=b.Space&&t<=b.Tilde&&(this.matchKeyword(ee.xref)||this.matchKeyword(ee.trailer)||this.matchKeyword(ee.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 La=Na;p(La,"forBytesWithOptions",(e,t,n,r)=>new Na(e,t,n,r));const Ma=e=>e instanceof m?e:m.of(e),G=e=>e instanceof U?e:U.of(e),ye=e=>e instanceof U?e.asNumber():e;var ja=(e=>(e.Degrees="degrees",e.Radians="radians",e))(ja||{});const ve=e=>(T(e,"degreeAngle",["number"]),{type:"degrees",angle:e}),{Radians:Ua,Degrees:$a}=ja,Bf=e=>e*Math.PI/180,Tf=e=>e*180/Math.PI,Re=e=>e.type===Ua?e.angle:e.type===$a?Bf(e.angle):Rn(`Invalid rotation: ${JSON.stringify(e)}`),Ef=e=>e.type===Ua?Tf(e.angle):e.type===$a?e.angle:Rn(`Invalid rotation: ${JSON.stringify(e)}`),{cos:Ha,sin:Wa,tan:Ga}=Math,ur=(e,t,n,r,i,s)=>ne.of(re.ConcatTransformationMatrix,[G(e),G(t),G(n),G(r),G(i),G(s)]),jt=(e,t)=>ur(1,0,0,1,e,t),wn=(e,t)=>ur(e,0,0,t,0,0),xn=e=>ur(Ha(ye(e)),Wa(ye(e)),-Wa(ye(e)),Ha(ye(e)),0,0),ts=(e,t)=>ur(1,Ga(ye(e)),Ga(ye(t)),1,0,0),gr=(e,t)=>ne.of(re.SetLineDashPattern,[`[${e.map(G).join(" ")}]`,G(t)]);var Sn=(e=>(e[e.Butt=0]="Butt",e[e.Round=1]="Round",e[e.Projecting=2]="Projecting",e))(Sn||{});const pr=e=>ne.of(re.SetLineCapStyle,[G(e)]),Ut=e=>ne.of(re.SetGraphicsStateParams,[Ma(e)]),Xe=()=>ne.of(re.PushGraphicsState),Ye=()=>ne.of(re.PopGraphicsState),br=e=>ne.of(re.SetLineWidth,[G(e)]),ke=(e,t,n,r,i,s)=>ne.of(re.AppendBezierCurve,[G(e),G(t),G(n),G(r),G(i),G(s)]),mr=(e,t,n,r)=>ne.of(re.CurveToReplicateInitialPoint,[G(e),G(t),G(n),G(r)]),$t=()=>ne.of(re.ClosePath),_t=(e,t)=>ne.of(re.MoveTo,[G(e),G(t)]),je=(e,t)=>ne.of(re.LineTo,[G(e),G(t)]),_r=()=>ne.of(re.StrokePath),ns=()=>ne.of(re.FillNonZero),rs=()=>ne.of(re.FillNonZeroAndStroke),Va=e=>ne.of(re.DrawObject,[Ma(e)]),Df=e=>ne.of(re.NonStrokingColorGray,[G(e)]),Pf=e=>ne.of(re.StrokingColorGray,[G(e)]),Rf=(e,t,n)=>ne.of(re.NonStrokingColorRgb,[G(e),G(t),G(n)]),If=(e,t,n)=>ne.of(re.StrokingColorRgb,[G(e),G(t),G(n)]),Of=(e,t,n,r)=>ne.of(re.NonStrokingColorCmyk,[G(e),G(t),G(n),G(r)]),zf=(e,t,n,r)=>ne.of(re.StrokingColorCmyk,[G(e),G(t),G(n),G(r)]);var Ka=(e=>(e.Grayscale="Grayscale",e.RGB="RGB",e.CMYK="CMYK",e))(Ka||{});const vn=(e,t,n)=>(Je(e,"red",0,1),Je(t,"green",0,1),Je(n,"blue",0,1),{type:"RGB",red:e,green:t,blue:n}),{Grayscale:Za,RGB:qa,CMYK:Xa}=Ka,is=e=>e.type===Za?Df(e.gray):e.type===qa?Rf(e.red,e.green,e.blue):e.type===Xa?Of(e.cyan,e.magenta,e.yellow,e.key):Rn(`Invalid color: ${JSON.stringify(e)}`),yr=e=>e.type===Za?Pf(e.gray):e.type===qa?If(e.red,e.green,e.blue):e.type===Xa?zf(e.cyan,e.magenta,e.yellow,e.key):Rn(`Invalid color: ${JSON.stringify(e)}`);class Ff 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 Nf 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 Lf extends Error{constructor(){const t="PDFDocument has no pages so `PDFDocument.removePage` cannot be called";super(t)}}let N=0,L=0,K=0,Z=0,kn=0,An=0;const Ya=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]]),Mf=e=>{let t;const n=[];let r=[],i="",s=!1,o=0;for(const c of e)if(Ya.has(c))o=Ya.get(c),t&&(i.length>0&&(r[r.length]=+i),n[n.length]={cmd:t,args:r},r=[],i="",s=!1),t=c;else if([" ",","].includes(c)||c==="-"&&i.length>0&&i[i.length-1]!=="e"||c==="."&&s){if(i.length===0)continue;r.length===o?(n[n.length]={cmd:t,args:r},r=[+i],t==="M"&&(t="L"),t==="m"&&(t="l")):r[r.length]=+i,s=c===".",i=["-","."].includes(c)?c:""}else i+=c,c==="."&&(s=!0);return i.length>0&&(r.length===o?(n[n.length]={cmd:t,args:r},r=[+i],t==="M"&&(t="L"),t==="m"&&(t="l")):r[r.length]=+i),n[n.length]={cmd:t,args:r},n},jf=e=>{N=L=K=Z=kn=An=0;let t=[];for(let n=0;n<e.length;n++){const r=e[n];if(r.cmd&&typeof Ja[r.cmd]=="function"){const i=Ja[r.cmd](r.args);Array.isArray(i)?t=t.concat(i):t.push(i)}}return t},Ja={M(e){return N=e[0],L=e[1],K=Z=null,kn=N,An=L,_t(N,L)},m(e){return N+=e[0],L+=e[1],K=Z=null,kn=N,An=L,_t(N,L)},C(e){return N=e[4],L=e[5],K=e[2],Z=e[3],ke(e[0],e[1],e[2],e[3],e[4],e[5])},c(e){const t=ke(e[0]+N,e[1]+L,e[2]+N,e[3]+L,e[4]+N,e[5]+L);return K=N+e[2],Z=L+e[3],N+=e[4],L+=e[5],t},S(e){(K===null||Z===null)&&(K=N,Z=L);const t=ke(N-(K-N),L-(Z-L),e[0],e[1],e[2],e[3]);return K=e[0],Z=e[1],N=e[2],L=e[3],t},s(e){(K===null||Z===null)&&(K=N,Z=L);const t=ke(N-(K-N),L-(Z-L),N+e[0],L+e[1],N+e[2],L+e[3]);return K=N+e[0],Z=L+e[1],N+=e[2],L+=e[3],t},Q(e){return K=e[0],Z=e[1],N=e[2],L=e[3],mr(e[0],e[1],N,L)},q(e){const t=mr(e[0]+N,e[1]+L,e[2]+N,e[3]+L);return K=N+e[0],Z=L+e[1],N+=e[2],L+=e[3],t},T(e){K===null||Z===null?(K=N,Z=L):(K=N-(K-N),Z=L-(Z-L));const t=mr(K,Z,e[0],e[1]);return K=N-(K-N),Z=L-(Z-L),N=e[0],L=e[1],t},t(e){K===null||Z===null?(K=N,Z=L):(K=N-(K-N),Z=L-(Z-L));const t=mr(K,Z,N+e[0],L+e[1]);return N+=e[0],L+=e[1],t},A(e){const t=Qa(N,L,e);return N=e[5],L=e[6],t},a(e){e[5]+=N,e[6]+=L;const t=Qa(N,L,e);return N=e[5],L=e[6],t},L(e){return N=e[0],L=e[1],K=Z=null,je(N,L)},l(e){return N+=e[0],L+=e[1],K=Z=null,je(N,L)},H(e){return N=e[0],K=Z=null,je(N,L)},h(e){return N+=e[0],K=Z=null,je(N,L)},V(e){return L=e[0],K=Z=null,je(N,L)},v(e){return L+=e[0],K=Z=null,je(N,L)},Z(){const e=$t();return N=kn,L=An,e},z(){const e=$t();return N=kn,L=An,e}},Qa=(e,t,n)=>{const[r,i,s,o,c,l,a]=n,h=Uf(l,a,r,i,o,c,s,e,t),g=[];for(const f of h){const d=$f(...f);g.push(ke(...d))}return g},Uf=(e,t,n,r,i,s,o,c,l)=>{const a=o*(Math.PI/180),h=Math.sin(a),g=Math.cos(a);n=Math.abs(n),r=Math.abs(r),K=g*(c-e)*.5+h*(l-t)*.5,Z=g*(l-t)*.5-h*(c-e)*.5;let f=K*K/(n*n)+Z*Z/(r*r);f>1&&(f=Math.sqrt(f),n*=f,r*=f);const d=g/n,_=h/n,w=-h/r,x=g/r,y=d*c+_*l,D=w*c+x*l,v=d*e+_*t,S=w*e+x*t;let B=1/((v-y)*(v-y)+(S-D)*(S-D))-.25;B<0&&(B=0);let A=Math.sqrt(B);s===i&&(A=-A);const O=.5*(y+v)-A*(S-D),R=.5*(D+S)+A*(v-y),E=Math.atan2(D-R,y-O);let F=Math.atan2(S-R,v-O)-E;F<0&&s===1?F+=2*Math.PI:F>0&&s===0&&(F-=2*Math.PI);const P=Math.ceil(Math.abs(F/(Math.PI*.5+.001))),W=[];for(let M=0;M<P;M++){const z=E+M*F/P,Y=E+(M+1)*F/P;W[M]=[O,R,z,Y,n,r,h,g]}return W},$f=(e,t,n,r,i,s,o,c)=>{const l=c*i,a=-o*s,h=o*i,g=c*s,f=.5*(r-n),d=8/3*Math.sin(f*.5)*Math.sin(f*.5)/Math.sin(f),_=e+Math.cos(n)-d*Math.sin(n),w=t+Math.sin(n)+d*Math.cos(n),x=e+Math.cos(r),y=t+Math.sin(r),D=x+d*Math.sin(r),v=y-d*Math.cos(r);return[l*_+a*w,h*_+g*w,l*D+a*v,h*D+g*v,l*x+a*y,h*x+g*y]},Hf=e=>jf(Mf(e)),Wf=(e,t)=>[Xe(),t.graphicsState&&Ut(t.graphicsState),jt(t.x,t.y),xn(Re(t.rotate)),wn(t.width,t.height),ts(Re(t.xSkew),Re(t.ySkew)),Va(e),Ye()].filter(Boolean),Gf=(e,t)=>[Xe(),t.graphicsState&&Ut(t.graphicsState),jt(t.x,t.y),xn(Re(t.rotate)),wn(t.xScale,t.yScale),ts(Re(t.xSkew),Re(t.ySkew)),Va(e),Ye()].filter(Boolean),Vf=e=>{var t,n;return[Xe(),e.graphicsState&&Ut(e.graphicsState),e.color&&yr(e.color),br(e.thickness),gr((t=e.dashArray)!=null?t:[],(n=e.dashPhase)!=null?n:0),_t(e.start.x,e.start.y),e.lineCap&&pr(e.lineCap),_t(e.start.x,e.start.y),je(e.end.x,e.end.y),_r(),Ye()].filter(Boolean)},Kf=e=>{var t,n;return[Xe(),e.graphicsState&&Ut(e.graphicsState),e.color&&is(e.color),e.borderColor&&yr(e.borderColor),br(e.borderWidth),e.borderLineCap&&pr(e.borderLineCap),gr((t=e.borderDashArray)!=null?t:[],(n=e.borderDashPhase)!=null?n:0),jt(e.x,e.y),xn(Re(e.rotate)),ts(Re(e.xSkew),Re(e.ySkew)),_t(0,0),je(0,e.height),je(e.width,e.height),je(e.width,0),$t(),e.color&&e.borderWidth?rs():e.color?ns():e.borderColor?_r():$t(),Ye()].filter(Boolean)},wr=4*((Math.sqrt(2)-1)/3),Zf=e=>{let t=ye(e.x),n=ye(e.y);const r=ye(e.xScale),i=ye(e.yScale);t-=r,n-=i;const s=r*wr,o=i*wr,c=t+r*2,l=n+i*2,a=t+r,h=n+i;return[Xe(),_t(t,h),ke(t,h-o,a-s,n,a,n),ke(a+s,n,c,h-o,c,h),ke(c,h+o,a+s,l,a,l),ke(a-s,l,t,h+o,t,h),Ye()]},qf=e=>{const t=ye(e.x),n=ye(e.y),r=ye(e.xScale),i=ye(e.yScale),s=-r,o=-i,c=r*wr,l=i*wr,a=s+r*2,h=o+i*2,g=s+r,f=o+i;return[jt(t,n),xn(Re(e.rotate)),_t(s,f),ke(s,f-l,g-c,o,g,o),ke(g+c,o,a,f-l,a,f),ke(a,f+l,g+c,h,g,h),ke(g-c,h,s,f+l,s,f)]},Xf=e=>{var t,n,r;return[Xe(),e.graphicsState&&Ut(e.graphicsState),e.color&&is(e.color),e.borderColor&&yr(e.borderColor),br(e.borderWidth),e.borderLineCap&&pr(e.borderLineCap),gr((t=e.borderDashArray)!=null?t:[],(n=e.borderDashPhase)!=null?n:0),...e.rotate===void 0?Zf({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:ve(0)}),e.color&&e.borderWidth?rs():e.color?ns():e.borderColor?_r():$t(),Ye()].filter(Boolean)},Yf=(e,t)=>{var n,r,i;return[Xe(),t.graphicsState&&Ut(t.graphicsState),jt(t.x,t.y),xn(Re((n=t.rotate)!=null?n:ve(0))),t.scale?wn(t.scale,-t.scale):wn(1,-1),t.color&&is(t.color),t.borderColor&&yr(t.borderColor),t.borderWidth&&br(t.borderWidth),t.borderLineCap&&pr(t.borderLineCap),gr((r=t.borderDashArray)!=null?r:[],(i=t.borderDashPhase)!=null?i:0),...Hf(e),t.color&&t.borderWidth?rs():t.color?ns():t.borderColor?_r():$t(),Ye()].filter(Boolean)},Jf={"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 yt=(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))(yt||{});const ec=class{constructor(e,t,n){p(this,"ref"),p(this,"doc"),p(this,"width"),p(this,"height"),p(this,"alreadyEmbedded",!1),p(this,"embedder"),T(e,"ref",[[se,"PDFRef"]]),T(t,"doc",[[ot,"PDFDocument"]]),T(n,"embedder",[[wi,"PDFPageEmbedder"]]),this.ref=e,this.doc=t,this.width=n.width,this.height=n.height,this.embedder=n}scale(e){return T(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 tc=ec;p(tc,"of",(e,t,n)=>new ec(e,t,n));const nc=class{constructor(e,t,n){p(this,"ref"),p(this,"doc"),p(this,"name"),p(this,"modified",!0),p(this,"embedder"),T(e,"ref",[[se,"PDFRef"]]),T(t,"doc",[[ot,"PDFDocument"]]),this.ref=e,this.doc=t,this.name=n.fontName,this.embedder=n}encodeText(e){return T(e,"text",["string"]),this.modified=!0,this.embedder.encodeText(e)}widthOfTextAtSize(e,t){return T(e,"text",["string"]),T(t,"size",["number"]),this.embedder.widthOfTextAtSize(e,t)}heightAtSize(e,t){var n;return T(e,"size",["number"]),j(t?.descender,"options.descender",["boolean"]),this.embedder.heightOfFontAtSize(e,{descender:(n=t?.descender)!=null?n:!0})}sizeAtHeight(e){return T(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 rc=nc;p(rc,"of",(e,t,n)=>new nc(e,t,n));const ic=class{constructor(e,t,n){p(this,"ref"),p(this,"doc"),p(this,"width"),p(this,"height"),p(this,"embedder"),p(this,"embedTask"),T(e,"ref",[[se,"PDFRef"]]),T(t,"doc",[[ot,"PDFDocument"]]),T(n,"embedder",[[ki,"JpegEmbedder"],[Ai,"PngEmbedder"]]),this.ref=e,this.doc=t,this.width=n.width,this.height=n.height,this.embedder=n}scale(e){return T(e,"factor",["number"]),{width:this.width*e,height:this.height*e}}scaleToFit(e,t){T(e,"width",["number"]),T(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 sc=ic;p(sc,"of",(e,t,n)=>new ic(e,t,n));const ss=class{constructor(e,t,n){p(this,"node"),p(this,"ref"),p(this,"doc"),p(this,"fontKey"),p(this,"font"),p(this,"fontSize",24),p(this,"fontColor",vn(0,0,0)),p(this,"lineHeight",24),p(this,"x",0),p(this,"y",0),p(this,"contentStream"),p(this,"contentStreamRef"),T(e,"leafNode",[[Me,"PDFPageLeaf"]]),T(t,"ref",[[se,"PDFRef"]]),T(n,"doc",[[ot,"PDFDocument"]]),this.node=e,this.ref=t,this.doc=n}setRotation(e){const t=Ef(e);Hc(t,"degreesAngle",90),this.node.set(m.of("Rotate"),this.doc.context.obj(t))}getRotation(){const e=this.node.Rotate();return ve(e?e.asNumber():0)}setSize(e,t){T(e,"width",["number"]),T(t,"height",["number"]);const n=this.getMediaBox();this.setMediaBox(n.x,n.y,e,t);const r=this.getCropBox(),i=this.getBleedBox(),s=this.getTrimBox(),o=this.getArtBox(),c=this.node.CropBox(),l=this.node.BleedBox(),a=this.node.TrimBox(),h=this.node.ArtBox();c&&On(r,n)&&this.setCropBox(n.x,n.y,e,t),l&&On(i,n)&&this.setBleedBox(n.x,n.y,e,t),a&&On(s,n)&&this.setTrimBox(n.x,n.y,e,t),h&&On(o,n)&&this.setArtBox(n.x,n.y,e,t)}setWidth(e){T(e,"width",["number"]),this.setSize(e,this.getSize().height)}setHeight(e){T(e,"height",["number"]),this.setSize(this.getSize().width,e)}setMediaBox(e,t,n,r){T(e,"x",["number"]),T(t,"y",["number"]),T(n,"width",["number"]),T(r,"height",["number"]);const i=this.doc.context.obj([e,t,e+n,t+r]);this.node.set(m.MediaBox,i)}setCropBox(e,t,n,r){T(e,"x",["number"]),T(t,"y",["number"]),T(n,"width",["number"]),T(r,"height",["number"]);const i=this.doc.context.obj([e,t,e+n,t+r]);this.node.set(m.CropBox,i)}setBleedBox(e,t,n,r){T(e,"x",["number"]),T(t,"y",["number"]),T(n,"width",["number"]),T(r,"height",["number"]);const i=this.doc.context.obj([e,t,e+n,t+r]);this.node.set(m.BleedBox,i)}setTrimBox(e,t,n,r){T(e,"x",["number"]),T(t,"y",["number"]),T(n,"width",["number"]),T(r,"height",["number"]);const i=this.doc.context.obj([e,t,e+n,t+r]);this.node.set(m.TrimBox,i)}setArtBox(e,t,n,r){T(e,"x",["number"]),T(t,"y",["number"]),T(n,"width",["number"]),T(r,"height",["number"]);const i=this.doc.context.obj([e,t,e+n,t+r]);this.node.set(m.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){T(e,"x",["number"]),T(t,"y",["number"]),this.node.normalize(),this.getContentStream();const n=this.createContentStream(Xe(),jt(e,t)),r=this.doc.context.register(n),i=this.createContentStream(Ye()),s=this.doc.context.register(i);this.node.wrapContentStreams(r,s)}scale(e,t){T(e,"x",["number"]),T(t,"y",["number"]),this.setSize(this.getWidth()*e,this.getHeight()*t),this.scaleContent(e,t),this.scaleAnnotations(e,t)}scaleContent(e,t){T(e,"x",["number"]),T(t,"y",["number"]),this.node.normalize(),this.getContentStream();const n=this.createContentStream(Xe(),wn(e,t)),r=this.doc.context.register(n),i=this.createContentStream(Ye()),s=this.doc.context.register(i);this.node.wrapContentStreams(r,s)}scaleAnnotations(e,t){T(e,"x",["number"]),T(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){T(e,"font",[[rc,"PDFFont"]]),this.font=e,this.fontKey=this.node.newFontDictionary(this.font.name,this.font.ref)}setFontSize(e){T(e,"fontSize",["number"]),this.fontSize=e}setFontColor(e){T(e,"fontColor",[[Object,"Color"]]),this.fontColor=e}setLineHeight(e){T(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){T(e,"x",["number"]),T(t,"y",["number"]),this.x=e,this.y=t}moveDown(e){T(e,"yDecrease",["number"]),this.y-=e}moveUp(e){T(e,"yIncrease",["number"]),this.y+=e}moveLeft(e){T(e,"xDecrease",["number"]),this.x-=e}moveRight(e){T(e,"xIncrease",["number"]),this.x+=e}pushOperators(...e){Cs(e,"operator",[[ne,"PDFOperator"]]),this.getContentStream().push(...e)}drawImage(e,t={}){var n,r,i,s,o,c,l;T(e,"image",[[sc,"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"]]),Ge(t.opacity,"opacity.opacity",0,1),Ie(t.blendMode,"options.blendMode",yt);const a=this.node.newXObject("Image",e.ref),h=this.maybeEmbedGraphicsState({opacity:t.opacity,blendMode:t.blendMode});this.getContentStream().push(...Wf(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:(s=t.height)!=null?s:e.size().height,rotate:(o=t.rotate)!=null?o:ve(0),xSkew:(c=t.xSkew)!=null?c:ve(0),ySkew:(l=t.ySkew)!=null?l:ve(0),graphicsState:h}))}drawPage(e,t={}){var n,r,i,s,o;T(e,"embeddedPage",[[tc,"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"]]),Ge(t.opacity,"opacity.opacity",0,1),Ie(t.blendMode,"options.blendMode",yt);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(...Gf(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:ve(0),xSkew:(s=t.xSkew)!=null?s:ve(0),ySkew:(o=t.ySkew)!=null?o:ve(0),graphicsState:l}))}drawSvgPath(e,t={}){var n,r,i,s,o,c,l,a,h;T(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"]]),Ge(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"]),Ie(t.borderLineCap,"options.borderLineCap",Sn),Ge(t.borderOpacity,"options.borderOpacity",0,1),Ie(t.blendMode,"options.blendMode",yt);const g=this.maybeEmbedGraphicsState({opacity:t.opacity,borderOpacity:t.borderOpacity,blendMode:t.blendMode});!("color"in t)&&!("borderColor"in t)&&(t.borderColor=vn(0,0,0)),this.getContentStream().push(...Yf(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:ve(0),color:(s=t.color)!=null?s:void 0,borderColor:(o=t.borderColor)!=null?o: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:g}))}drawLine(e){var t,n,r,i,s;T(e.start,"options.start",[[Object,"{ x: number, y: number }"]]),T(e.end,"options.end",[[Object,"{ x: number, y: number }"]]),T(e.start.x,"options.start.x",["number"]),T(e.start.y,"options.start.y",["number"]),T(e.end.x,"options.end.x",["number"]),T(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"]),Ie(e.lineCap,"options.lineCap",Sn),Ge(e.opacity,"opacity.opacity",0,1),Ie(e.blendMode,"options.blendMode",yt);const o=this.maybeEmbedGraphicsState({borderOpacity:e.opacity,blendMode:e.blendMode});"color"in e||(e.color=vn(0,0,0)),this.getContentStream().push(...Vf({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:(s=e.lineCap)!=null?s:void 0,graphicsState:o}))}drawRectangle(e={}){var t,n,r,i,s,o,c,l,a,h,g,f,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"]]),Ge(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"]),Ie(e.borderLineCap,"options.borderLineCap",Sn),Ge(e.borderOpacity,"options.borderOpacity",0,1),Ie(e.blendMode,"options.blendMode",yt);const _=this.maybeEmbedGraphicsState({opacity:e.opacity,borderOpacity:e.borderOpacity,blendMode:e.blendMode});!("color"in e)&&!("borderColor"in e)&&(e.color=vn(0,0,0)),this.getContentStream().push(...Kf({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:(s=e.rotate)!=null?s:ve(0),xSkew:(o=e.xSkew)!=null?o:ve(0),ySkew:(c=e.ySkew)!=null?c:ve(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:(g=e.borderDashArray)!=null?g:void 0,borderDashPhase:(f=e.borderDashPhase)!=null?f:void 0,graphicsState:_,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,s,o,c,l,a,h,g;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"]]),Ge(e.opacity,"opacity.opacity",0,1),j(e.borderColor,"options.borderColor",[[Object,"Color"]]),Ge(e.borderOpacity,"options.borderOpacity",0,1),j(e.borderWidth,"options.borderWidth",["number"]),j(e.borderDashArray,"options.borderDashArray",[Array]),j(e.borderDashPhase,"options.borderDashPhase",["number"]),Ie(e.borderLineCap,"options.borderLineCap",Sn),Ie(e.blendMode,"options.blendMode",yt);const f=this.maybeEmbedGraphicsState({opacity:e.opacity,borderOpacity:e.borderOpacity,blendMode:e.blendMode});!("color"in e)&&!("borderColor"in e)&&(e.color=vn(0,0,0)),this.getContentStream().push(...Xf({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:(s=e.rotate)!=null?s:void 0,color:(o=e.color)!=null?o: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:(g=e.borderLineCap)!=null?g:void 0,graphicsState:f}))}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 Ot.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 s=0,o=r.length;s<o;s++){const c=e.lookup(m.of(r[s]));c instanceof J&&c.scalePDFNumbers(t,n)}const i=e.lookup(m.of("InkList"));if(i instanceof J)for(let s=0,o=i.size();s<o;s++){const c=i.lookup(s);c instanceof J&&c.scalePDFNumbers(t,n)}}};let Ht=ss;p(Ht,"of",(e,t,n)=>new ss(e,t,n)),p(Ht,"create",e=>{T(e,"doc",[[ot,"PDFDocument"]]);const t=se.of(-1),n=Me.withContextAndParent(e.context,t),r=e.context.register(n);return new ss(n,r,e)});const oc=class{constructor(e,t,n){p(this,"ref"),p(this,"doc"),p(this,"alreadyEmbedded",!1),p(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(m.of("Names"))||e.set(m.of("Names"),t.obj({}));const r=e.lookup(m.of("Names"),V);r.has(m.of("JavaScript"))||r.set(m.of("JavaScript"),t.obj({}));const i=r.lookup(m.of("JavaScript"),V);i.has(m.of("Names"))||i.set(m.of("Names"),t.obj([]));const s=i.lookup(m.of("Names"),J);s.push(X.fromText(this.embedder.scriptName)),s.push(n),this.alreadyEmbedded=!0}}};let ac=oc;p(ac,"of",(e,t,n)=>new oc(e,t,n));class os{constructor(t,n){p(this,"script"),p(this,"scriptName"),this.script=t,this.scriptName=n}static for(t,n){return new os(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 ot{constructor(t,n){if(p(this,"context"),p(this,"catalog"),p(this,"isEncrypted"),p(this,"defaultWordBreaks",[" "]),p(this,"fontkit"),p(this,"pageCount"),p(this,"pageCache"),p(this,"pageMap"),p(this,"fonts"),p(this,"images"),p(this,"embeddedPages"),p(this,"embeddedFiles"),p(this,"javaScripts"),p(this,"computePages",()=>{const r=[];return this.catalog.Pages().traverse((i,s)=>{if(i instanceof Me){let o=this.pageMap.get(i);o||(o=Ht.of(i,s,this),this.pageMap.set(i,o)),r.push(o)}}),r}),T(t,"context",[[pi,"PDFContext"]]),T(n,"ignoreEncryption",["boolean"]),this.context=t,this.catalog=t.lookup(t.trailerInfo.Root),this.isEncrypted=!!t.lookup(t.trailerInfo.Encrypt),this.pageCache=vt.populatedBy(this.computePages),this.pageMap=new Map,this.fonts=[],this.images=[],this.embeddedPages=[],this.embeddedFiles=[],this.javaScripts=[],!n&&this.isEncrypted)throw new Ff}static async load(t,n={}){const{ignoreEncryption:r=!1,parseSpeed:i=100,throwOnInvalidObject:s=!1,updateMetadata:o=!0,capNumbers:c=!1}=n;T(t,"pdf",["string",Uint8Array,ArrayBuffer]),T(r,"ignoreEncryption",["boolean"]),T(i,"parseSpeed",["number"]),T(s,"throwOnInvalidObject",["boolean"]);const l=Pc(t),a=await La.forBytesWithOptions(l,i,s,c).parseDocument();return new ot(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 Je(t,"index",0,n.length-1),n[t]}getPageIndices(){return Dc(0,this.getPageCount())}removePage(t){const n=this.getPageCount();if(this.pageCount===0)throw new Lf;Je(t,"index",0,n-1),this.catalog.removeLeafNode(t),this.pageCount=n-1}addPage(t){return T(t,"page",["undefined",[Ht,"PDFPage"],Array]),this.insertPage(this.getPageCount(),t)}insertPage(t,n){const r=this.getPageCount();if(Je(t,"index",0,r),T(n,"page",["undefined",[Ht,"PDFPage"],Array]),!n||Array.isArray(n)){const s=Array.isArray(n)?n:Jf.A4;n=Ht.create(this),n.setSize(...s)}else if(n.doc!==this)throw new Nf;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){T(t,"name",["string"]),T(n,"script",["string"]);const r=os.for(n,t),i=this.context.nextRef(),s=ac.of(i,this,r);this.javaScripts.push(s)}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:s=!0}=t;return T(n,"useObjectStreams",["boolean"]),T(r,"addDefaultPage",["boolean"]),T(i,"objectsPerTick",["number"]),T(s,"updateFieldAppearances",["boolean"]),r&&this.getPageCount()===0&&this.addPage(),await this.flush(),(n?ma:yi).forContext(this.context,i).serializeToBuffer()}async saveAsBase64(t={}){const{dataUri:n=!1,...r}=t;T(n,"dataUri",["boolean"]);const i=await this.save(r),s=Sc(i);return n?`data:application/pdf;base64,${s}`:s}findPageForAnnotationRef(t){const n=this.getPages();for(let r=0,i=n.length;r<i;r++){const s=n[r],o=s.node.Annots();if(o?.indexOf(t)!==void 0)return s}}async embedAll(t){for(let n=0,r=t.length;n<r;n++)await t[n].embed()}}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 as;(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"})(as||(as={})),le.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"}(le.AnnotationType||(le.AnnotationType={})),le.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"}(le.AnnotationFlag||(le.AnnotationFlag={}));const Qf={ANNOTATIONS:"annotations"},Cn=Symbol("VPV Shared UIs"),cc=Symbol("VPV Current Localization"),Bn=as,lc={Black:"#000000",DarkGray:"#444444",Gray:"#696969",LightGray:"#9C9C9C",LightestGray:"#CDCDCD",White:"#FFFFFF"},Te={...lc,Purple:"#7862FF",Blue:"#1777FF",Red:"#F66365",Orange:"#F67E63",Yellow:"#F5C463",Green:"#48BB77"},Ee={Purple:"#CAAAFF",Cyan:"#65EDE9",Red:"#FFACAC",Orange:"#FFBD82",Yellow:"#FCE244",Green:"#A0F751",...lc},eu={[Ee.Purple]:"Purple",[Ee.Cyan]:"Cyan",[Ee.Red]:"Red",[Ee.Orange]:"Orange",[Ee.Yellow]:"Yellow",[Ee.Green]:"Green",[Ee.Black]:"Black",[Ee.DarkGray]:"Dark Gray",[Ee.Gray]:"Gray",[Ee.LightGray]:"Light Gray",[Ee.LightestGray]:"Lightest Gray",[Ee.White]:"White"},tu={[Te.Black]:"Black",[Te.DarkGray]:"Dark Gray",[Te.Gray]:"Gray",[Te.LightGray]:"Light Gray",[Te.LightestGray]:"Lightest Gray",[Te.White]:"White",[Te.Purple]:"Purple",[Te.Blue]:"Blue",[Te.Red]:"Red",[Te.Orange]:"Orange",[Te.Yellow]:"Yellow",[Te.Green]:"Green"},nu="pdfjs_internal_editor_",Gt=(e,t)=>`${e}-${t}`;class ru{static async serializeAnnotationsToPdf(t,n){const r=await ot.load(t),i=r.getPages(),s=n.filter(c=>c.annotationType===le.AnnotationType.Underline||c.annotationType===le.AnnotationType.StrikeOut),o=n.filter(c=>c.annotationType===le.AnnotationType.Square);for(const c of s)await this.addTextMarkupAnnotation(r,i,c);for(const c of o)await this.addRectangleAnnotation(r,i,c);return await r.save()}static async addTextMarkupAnnotation(t,n,r){const i=n[r.pageIndex??0],s=r.rect,o=Array.from(r.quadPoints||[]),c=t.context.obj({Type:"Annot",Subtype:r.annotationType===le.AnnotationType.Underline?"Underline":"StrikeOut",Rect:s,QuadPoints:o,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`)}),l=t.context.register(c);let a=i.node.lookup(m.of("Annots"));a||(a=t.context.obj([]),i.node.set(m.of("Annots"),a)),a instanceof J&&a.push(l)}static async addRectangleAnnotation(t,n,r){const i=n[r.pageIndex??0],{height:s}=i.getSize(),o=this.convertRectToPdfCoords(r.rect,s),c=r.borderColor||r.color,l=r.backgroundColor,a={Type:"Annot",Subtype:"Square",Rect:o,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 _={1:"S",2:"D",3:"B",4:"I",5:"U"};d.S=m.of(_[r.borderStyle.style]||"S")}r.borderStyle.dashArray&&r.borderStyle.dashArray.length>0&&(d.D=r.borderStyle.dashArray),a.BS=t.context.obj(d)}r.opacity!==void 0&&r.opacity<1&&(a.CA=r.opacity),r.contents&&(a.Contents=X.fromText(r.contents)),r.creationDate&&(a.CreationDate=X.fromText(r.creationDate.toString())),r.modificationDate&&(a.M=X.fromText(r.modificationDate.toString()));const h=t.context.obj(a),g=t.context.register(h);let f=i.node.lookup(m.of("Annots"));f||(f=t.context.obj([]),i.node.set(m.of("Annots"),f)),f instanceof J&&f.push(g)}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 iu={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"},su=e=>e.startsWith("#")||e.startsWith("0x")?e:iu[e]||e,Tn=u.defineComponent({__name:"AppTooltip",setup(e){const t=u.inject(Cn),n=u.computed(()=>t?.AppTooltip);return(r,i)=>n.value?(u.openBlock(),u.createBlock(u.resolveDynamicComponent(n.value),u.normalizeProps(u.mergeProps({key:0},r.$attrs)),u.createSlots({default:u.withCtx(()=>[u.renderSlot(r.$slots,"default")]),_:2},[u.renderList(r.$slots,(s,o)=>({name:o,fn:u.withCtx(()=>[u.renderSlot(r.$slots,o)])}))]),1040)):(u.openBlock(),u.createElementBlock("div",u.normalizeProps(u.mergeProps({key:1},r.$attrs)),[u.renderSlot(r.$slots,"default")],16))}}),En=u.defineComponent({inheritAttrs:!1,__name:"AppButton",props:{ariaLabel:{},ariaDisabled:{type:Boolean}},setup(e){const t=e,n=u.useAttrs(),r=u.inject(Cn),i=u.computed(()=>r?.AppButton),s=u.computed(()=>({"aria-label":t.ariaLabel,"aria-disabled":t.ariaDisabled,...n}));return(o,c)=>i.value?(u.openBlock(),u.createBlock(u.resolveDynamicComponent(i.value),u.normalizeProps(u.mergeProps({key:0},s.value)),{default:u.withCtx(()=>[u.renderSlot(o.$slots,"default")]),_:3},16)):(u.openBlock(),u.createElementBlock("button",u.normalizeProps(u.mergeProps({key:1},s.value)),[u.renderSlot(o.$slots,"default")],16))}}),ou=(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)))})},au=u.defineComponent({__name:"Icon",props:{name:{}},setup(e){const t=e,n=u.defineAsyncComponent({loader:()=>ou(Object.assign({"../assets/icons/annotations.svg":()=>Promise.resolve().then(()=>xu),"../assets/icons/tool-comment.svg":()=>Promise.resolve().then(()=>vu),"../assets/icons/tool-free-text.svg":()=>Promise.resolve().then(()=>Au),"../assets/icons/tool-highlight.svg":()=>Promise.resolve().then(()=>Bu),"../assets/icons/tool-image.svg":()=>Promise.resolve().then(()=>Eu),"../assets/icons/tool-signature.svg":()=>Promise.resolve().then(()=>Pu),"../assets/icons/tool-strikethrough.svg":()=>Promise.resolve().then(()=>Iu),"../assets/icons/tool-text-selection.svg":()=>Promise.resolve().then(()=>zu),"../assets/icons/tool-underline.svg":()=>Promise.resolve().then(()=>Nu)}),`../assets/icons/${t.name}.svg`)});return(r,i)=>(u.openBlock(),u.createBlock(u.resolveDynamicComponent(u.unref(n)),{class:"vp-text-xl"}))}}),Gu="",cs=(e,t)=>{const n=e.__vccOpts||e;for(const[r,i]of t)n[r]=i;return n},at=cs(au,[["__scopeId","data-v-9d5f0033"]]),Dn=()=>{const e=u.inject(cc,u.computed(()=>({})));return{t:u.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:u.computed(()=>e.value)}},cu=u.defineComponent({__name:"ToolAnnotation",emits:["toggle"],setup(e,{emit:t}){const{t:n}=Dn(),r=t,i=u.ref(!1),s=()=>{i.value=!i.value,r("toggle",i.value)};return(o,c)=>o.$slots.default?u.renderSlot(o.$slots,"default",{key:0,onClick:s},void 0,!0):(u.openBlock(),u.createBlock(Tn,{key:1},{content:u.withCtx(()=>[u.createTextVNode(u.toDisplayString(i.value?u.unref(n)("annotationToggleHideTooltip"):u.unref(n)("annotationToggleShowTooltip")),1)]),default:u.withCtx(()=>[u.createVNode(En,{"aria-label":i.value?u.unref(n)("annotationToggleHideTooltip"):u.unref(n)("annotationToggleShowTooltip"),class:u.normalizeClass(["vpv-toolbar-btn",{"vpv-toolbar-btn-active":i.value}]),onClick:s},{default:u.withCtx(()=>[u.createVNode(at,{name:"annotations",class:"vp-text-xl"})]),_:1},8,["aria-label","class"])]),_:1}))}}),Vu="",lu=cs(cu,[["__scopeId","data-v-df5778ee"]]),hu=u.defineComponent({__name:"ToolAnnotationTextSelection",props:u.mergeModels({ariaDisabled:{type:Boolean},active:{type:Boolean}},{active:{type:Boolean,required:!0},activeModifiers:{}}),emits:["update:active"],setup(e){const t=e,n=u.useModel(e,"active"),{t:r}=Dn(),i=u.computed(()=>t.ariaDisabled===!0),s=()=>{i.value||(n.value=!n.value)};return(o,c)=>o.$slots.default?u.renderSlot(o.$slots,"default",u.mergeProps({key:0},o.$attrs,{onClick:s})):(u.openBlock(),u.createBlock(Tn,{key:1},{content:u.withCtx(()=>[u.createTextVNode(u.toDisplayString(u.unref(r)("annotationTextSelectionTooltip")),1)]),default:u.withCtx(()=>[u.createVNode(En,u.mergeProps({"aria-label":u.unref(r)("annotationTextSelectionLabel"),class:["vpv-toolbar-btn",{"vpv-toolbar-btn-active":n.value}]},o.$attrs,{onClick:s}),{default:u.withCtx(()=>[u.renderSlot(o.$slots,"icon",{},()=>[u.createVNode(at,{name:"tool-text-selection"})])]),_:3},16,["aria-label","class"])]),_:3}))}}),du=u.defineComponent({__name:"AppPopover",props:{open:{type:Boolean},side:{},sideOffset:{},class:{},ariaLabel:{}},setup(e){const t=e,n=u.inject(Cn),r=u.computed(()=>n?.AppPopover);return(i,s)=>r.value?(u.openBlock(),u.createBlock(u.resolveDynamicComponent(r.value),u.normalizeProps(u.mergeProps({key:0},t)),{trigger:u.withCtx(()=>[u.renderSlot(i.$slots,"trigger")]),default:u.withCtx(()=>[u.renderSlot(i.$slots,"default")]),_:3},16)):(u.openBlock(),u.createElementBlock("button",u.normalizeProps(u.mergeProps({key:1},t)),[u.renderSlot(i.$slots,"default")],16))}}),fu=u.defineComponent({__name:"AppSignatures",setup(e){const t=u.inject(Cn),n=u.computed(()=>t?.AppSignatures);return(r,i)=>n.value?(u.openBlock(),u.createBlock(u.resolveDynamicComponent(n.value),u.normalizeProps(u.mergeProps({key:0},r.$attrs)),null,16)):u.createCommentVNode("",!0)}}),uu=u.defineComponent({__name:"ToolAnnotationSignature",props:u.mergeModels({ariaDisabled:{type:Boolean},active:{type:Boolean}},{active:{type:Boolean,required:!0},activeModifiers:{}}),emits:["update:active"],setup(e){const t=e,n=u.useModel(e,"active"),{t:r}=Dn(),i=u.ref(!1),s=u.computed(()=>t.ariaDisabled===!0),o=()=>{s.value||(!n.value&&!i.value&&(i.value=!0),n.value=!n.value)},c=l=>{i.value=!1};return(l,a)=>l.$slots.default?u.renderSlot(l.$slots,"default",u.mergeProps({key:0},l.$attrs,{onClick:o})):(u.openBlock(),u.createBlock(du,{key:1,open:i.value,side:"right",sideOffset:10,class:"vpv-annotation-signatures__popover",onInteractOutside:c},{trigger:u.withCtx(()=>[u.createVNode(Tn,null,{content:u.withCtx(()=>[u.createTextVNode(u.toDisplayString(u.unref(r)("annotationSignatureTooltip")),1)]),default:u.withCtx(()=>[u.createVNode(En,u.mergeProps({"aria-label":u.unref(r)("annotationSignatureLabel"),class:["vpv-toolbar-btn",{"vpv-toolbar-btn-active":n.value}]},l.$attrs,{onClick:o}),{default:u.withCtx(()=>[u.renderSlot(l.$slots,"icon",{},()=>[u.createVNode(at,{name:"tool-signature"})])]),_:3},16,["aria-label","class"])]),_:3})]),default:u.withCtx(()=>[u.createVNode(fu)]),_:3},8,["open"]))}}),gu=u.defineComponent({__name:"ToolAnnotationFreeText",props:u.mergeModels({ariaDisabled:{type:Boolean},active:{type:Boolean}},{active:{type:Boolean,required:!0},activeModifiers:{}}),emits:["update:active"],setup(e){const t=e,n=u.useModel(e,"active"),{t:r}=Dn(),i=u.computed(()=>t.ariaDisabled===!0),s=()=>{i.value||(n.value=!n.value)};return(o,c)=>o.$slots.default?u.renderSlot(o.$slots,"default",u.mergeProps({key:0},o.$attrs,{onClick:s})):(u.openBlock(),u.createBlock(Tn,{key:1},{content:u.withCtx(()=>[u.createTextVNode(u.toDisplayString(u.unref(r)("annotationFreeTextTooltip")),1)]),default:u.withCtx(()=>[u.createVNode(En,u.mergeProps({"aria-label":u.unref(r)("annotationFreeTextLabel"),class:["vpv-toolbar-btn",{"vpv-toolbar-btn-active":n.value}]},o.$attrs,{onClick:s}),{default:u.withCtx(()=>[u.renderSlot(o.$slots,"icon",{},()=>[u.createVNode(at,{name:"tool-free-text"})])]),_:3},16,["aria-label","class"])]),_:3}))}}),pu=u.defineComponent({__name:"ToolAnnotationImage",props:{ariaDisabled:{type:Boolean}},emits:["change"],setup(e,{emit:t}){const n=e,{t:r}=Dn(),i=t,s=u.computed(()=>n.ariaDisabled===!0),o=()=>{if(s.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?u.renderSlot(c.$slots,"default",u.mergeProps({key:0},c.$attrs,{onClick:o})):(u.openBlock(),u.createBlock(Tn,{key:1},{content:u.withCtx(()=>[u.createTextVNode(u.toDisplayString(u.unref(r)("annotationImageTooltip")),1)]),default:u.withCtx(()=>[u.createVNode(En,u.mergeProps({"aria-label":u.unref(r)("annotationImageLabel"),class:"vpv-toolbar-btn"},c.$attrs,{onClick:o}),{default:u.withCtx(()=>[u.renderSlot(c.$slots,"icon",{},()=>[u.createVNode(at,{name:"tool-image"})])]),_:3},16,["aria-label"])]),_:3}))}}),Ku="",bu={class:"vpv-annotation-tools-container"},mu={key:0,class:"vpv-annotation-tools"},_u=u.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=u.ref(!1),s=k=>Gt(n.instanceId,k),o={textSelection:new CustomEvent(s(Wt.textSelection),{detail:{active:!1,colors:null,highlight:null,strikethrough:null,underline:null}}),freeText:new CustomEvent(s(Wt.freeText),{detail:{active:!1,fontColors:null,fontSizes:null}}),signature:new CustomEvent(s(Wt.signature),{detail:{active:!1}}),image:new CustomEvent(s(Wt.image),{detail:{file:void 0}})},c=u.ref(!1),l=u.reactive({textSelection:!1,freeText:!1,signature:!1}),a=u.computed({get:()=>l.textSelection,set:k=>{l.textSelection=k,k&&(l.freeText=!1,l.signature=!1),A()}}),h=u.computed({get:()=>l.freeText,set:k=>{k&&(l.textSelection=!1,l.signature=!1),l.freeText=k,A()}}),g=u.computed({get:()=>l.signature,set:k=>{k&&(l.textSelection=!1,l.freeText=!1),l.signature=k,A()}}),f=u.computed(()=>n.textSelection),d=u.computed(()=>n.freeText),_=u.computed(()=>n.signature),w=u.computed(()=>n.image);function x(k){return k.map(F=>typeof F=="string"?{value:su(F),label:F}:F)}const y=k=>{c.value=k,k||(a.value=!1,h.value=!1,g.value=!1)},D=Object.entries(eu).map(([k,F])=>({value:k,label:F})),v=k=>{r("textSelection",k),o.textSelection.detail.active=k,o.textSelection.detail.colors=D;let F={icon:u.markRaw(u.h(at,{name:"tool-highlight"}))},P={icon:u.markRaw(u.h(at,{name:"tool-strikethrough"}))},W={icon:u.markRaw(u.h(at,{name:"tool-underline"}))};if(typeof n.textSelection=="object"){const{highlight:M,strikethrough:z,underline:Y}=n.textSelection;M===!1?F=!1:typeof M=="object"&&(F={...F,...M},M.icon&&typeof M.icon=="object"&&(F.icon=u.markRaw(M.icon))),z===!1?P=!1:typeof z=="object"&&(P={...P,...z},z.icon&&typeof z.icon=="object"&&(P.icon=u.markRaw(z.icon))),Y===!1?W=!1:typeof Y=="object"&&(W={...W,...Y},Y.icon&&typeof Y.icon=="object"&&(W.icon=u.markRaw(Y.icon)))}o.textSelection.detail.highlight=F,o.textSelection.detail.strikethrough=P,o.textSelection.detail.underline=W,window.dispatchEvent(o.textSelection)},S=k=>{r("freeText",k),o.freeText.detail.active=k;let F=Object.entries(tu).map(([P,W])=>({value:P,label:W}));typeof n.freeText=="object"&&n.freeText?.fontColors&&(F=x(n.freeText.fontColors)),o.freeText.detail.fontColors=F,typeof n.freeText=="object"&&n.freeText?.fontSizes?.length&&(o.freeText.detail.fontSizes=n.freeText.fontSizes),window.dispatchEvent(o.freeText)},I=k=>{r("signature",k),o.signature.detail.active=k,window.dispatchEvent(o.signature)},B=k=>{l.textSelection=!1,l.freeText=!1,l.signature=!1,r("image",k),o.image.detail.file=k,window.dispatchEvent(o.image)};function A(){v(a.value),S(h.value),I(g.value)}const O=Gt(n.instanceId,Bn.Rotate);u.onMounted(()=>{window.dispatchEvent(new CustomEvent(Gt(n.instanceId,Bn.AnnotationMounted))),window.addEventListener(O,R)});function R(k){const{firstPageRotation:F,rotation:P}=k.detail;i.value=P!==0}u.watch(i,k=>{k&&(l.textSelection=!1,l.freeText=!1,l.signature=!1,A())});const E=k=>{const{id:F,...P}=k;return{...P,id:F?.startsWith(nu)?null:F}};return u.watch(()=>n.onAnnotationCreated,(k,F,P)=>{if(!k)return;const W=z=>{k(E(z.detail))},M=Gt(n.instanceId,Bn.AnnotationCreated);window.addEventListener(M,W),P(()=>{window.removeEventListener(M,W)})},{immediate:!0}),u.watch(()=>n.onAnnotationUpdated,(k,F,P)=>{if(!k)return;const W=z=>{k(E(z.detail))},M=Gt(n.instanceId,Bn.AnnotationUpdated);window.addEventListener(M,W),P(()=>{window.removeEventListener(M,W)})},{immediate:!0}),u.watch(()=>n.onAnnotationDeleted,(k,F,P)=>{if(!k)return;const W=z=>{k(E(z.detail))},M=Gt(n.instanceId,Bn.AnnotationDeleted);window.addEventListener(M,W),P(()=>{window.removeEventListener(M,W)})},{immediate:!0}),u.onUnmounted(()=>{window.removeEventListener(O,R)}),(k,F)=>(u.openBlock(),u.createElementBlock("div",bu,[u.createVNode(lu,{onToggle:y}),u.createVNode(u.Transition,{name:"slide"},{default:u.withCtx(()=>[c.value?(u.openBlock(),u.createElementBlock("div",mu,[f.value?(u.openBlock(),u.createBlock(hu,{key:0,active:a.value,"onUpdate:active":F[0]||(F[0]=P=>a.value=P),"aria-disabled":i.value},u.createSlots({_:2},[typeof n.textSelection=="object"&&n.textSelection.icon?{name:"icon",fn:u.withCtx(()=>[typeof n.textSelection=="object"&&n.textSelection.icon?(u.openBlock(),u.createBlock(u.resolveDynamicComponent(n.textSelection.icon),{key:0})):u.createCommentVNode("",!0)]),key:"0"}:typeof n.textSelection=="object"&&n.textSelection.component?{name:"default",fn:u.withCtx(({onClick:P})=>[typeof n.textSelection=="object"&&n.textSelection.component?(u.openBlock(),u.createBlock(u.resolveDynamicComponent(n.textSelection.component),{key:0,onClick:P},null,8,["onClick"])):u.createCommentVNode("",!0)]),key:"1"}:void 0]),1032,["active","aria-disabled"])):u.createCommentVNode("",!0),d.value?(u.openBlock(),u.createBlock(gu,{key:1,active:h.value,"onUpdate:active":F[1]||(F[1]=P=>h.value=P),"aria-disabled":i.value},u.createSlots({_:2},[typeof n.freeText=="object"&&n.freeText.icon?{name:"icon",fn:u.withCtx(()=>[typeof n.freeText=="object"&&n.freeText.icon?(u.openBlock(),u.createBlock(u.resolveDynamicComponent(n.freeText.icon),{key:0})):u.createCommentVNode("",!0),typeof n.freeText=="object"&&n.freeText.icon?(u.openBlock(),u.createBlock(u.resolveDynamicComponent(n.freeText.icon),{key:1})):u.createCommentVNode("",!0)]),key:"0"}:typeof n.freeText=="object"&&n.freeText.component?{name:"default",fn:u.withCtx(({onClick:P})=>[typeof n.freeText=="object"&&n.freeText.component?(u.openBlock(),u.createBlock(u.resolveDynamicComponent(n.freeText.component),{key:0,onClick:P},null,8,["onClick"])):u.createCommentVNode("",!0)]),key:"1"}:void 0]),1032,["active","aria-disabled"])):u.createCommentVNode("",!0),w.value?(u.openBlock(),u.createBlock(pu,{key:2,onChange:B,"aria-disabled":i.value},u.createSlots({_:2},[typeof n.image=="object"&&n.image?{name:"icon",fn:u.withCtx(()=>[typeof n.image=="object"&&n.image.icon?(u.openBlock(),u.createBlock(u.resolveDynamicComponent(n.image.icon),{key:0})):u.createCommentVNode("",!0)]),key:"0"}:typeof n.image=="object"&&n.image&&"component"in n.image?{name:"default",fn:u.withCtx(({onClick:P})=>[typeof n.image=="object"&&n.image&&"component"in n.image?(u.openBlock(),u.createBlock(u.resolveDynamicComponent(n.image.component),{key:0,onClick:P},null,8,["onClick"])):u.createCommentVNode("",!0)]),key:"1"}:void 0]),1032,["aria-disabled"])):u.createCommentVNode("",!0),_.value?(u.openBlock(),u.createBlock(uu,{key:3,active:g.value,"onUpdate:active":F[2]||(F[2]=P=>g.value=P),"aria-disabled":i.value},u.createSlots({_:2},[typeof n.signature=="object"&&n.signature.icon?{name:"icon",fn:u.withCtx(()=>[typeof n.signature=="object"&&n.signature.icon?(u.openBlock(),u.createBlock(u.resolveDynamicComponent(n.signature.icon),{key:0})):u.createCommentVNode("",!0)]),key:"0"}:typeof n.signature=="object"&&n.signature.component?{name:"default",fn:u.withCtx(({onClick:P})=>[typeof n.signature=="object"&&n.signature.component?(u.openBlock(),u.createBlock(u.resolveDynamicComponent(n.signature.component),{key:0,onClick:P},null,8,["onClick"])):u.createCommentVNode("",!0)]),key:"1"}:void 0]),1032,["active","aria-disabled"])):u.createCommentVNode("",!0)])):u.createCommentVNode("",!0)]),_:1})]))}}),Zu="",hc=cs(_u,[["__scopeId","data-v-8583d7e5"]]),yu=(e={})=>{const{textSelection:t,freeText:n,image:r,...i}=e;let s=null;return{name:"annotation",setup(o){const{componentInstance:c,shared:l}=o,a=c?.uid??0;o.toolbar.addItem({id:Qf.ANNOTATIONS,toolbarDirection:"left",component:u.h(hc,{textSelection:t,freeText:n,image:r,instanceId:a,...i})});const h=c?.appContext.app;l.ui?h.provide(Cn,l.ui):console.warn("VPdfAnnotationPlugin - No UI context found in plugin context"),l.localization?.value?h.provide(cc,l.localization):console.warn("VPdfAnnotationPlugin - No localization found in plugin context"),l.pdf||console.warn("VPdfAnnotationPlugin - PDF context not available"),s={exportToPdf:async g=>{const f=await l.pdf?.getOriginalBytes();return f?await ru.serializeAnnotationsToPdf(f,g):null}}},getApi:()=>s}},wu={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"none",viewBox:"0 0 20 20"};function dc(e,t){return u.openBlock(),u.createElementBlock("svg",wu,[...t[0]||(t[0]=[u.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),u.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),u.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 xu=Object.freeze(Object.defineProperty({__proto__:null,render:dc,default:{render:dc}},Symbol.toStringTag,{value:"Module"})),Su={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"none",viewBox:"0 0 20 20"};function fc(e,t){return u.openBlock(),u.createElementBlock("svg",Su,[...t[0]||(t[0]=[u.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),u.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 vu=Object.freeze(Object.defineProperty({__proto__:null,render:fc,default:{render:fc}},Symbol.toStringTag,{value:"Module"})),ku={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"none",viewBox:"0 0 20 20"};function uc(e,t){return u.openBlock(),u.createElementBlock("svg",ku,[...t[0]||(t[0]=[u.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),u.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 Au=Object.freeze(Object.defineProperty({__proto__:null,render:uc,default:{render:uc}},Symbol.toStringTag,{value:"Module"})),Cu={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"none",viewBox:"0 0 20 20"};function gc(e,t){return u.openBlock(),u.createElementBlock("svg",Cu,[...t[0]||(t[0]=[u.createElementVNode("g",{"clip-path":"url(#a)"},[u.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),u.createElementVNode("defs",null,[u.createElementVNode("clipPath",{id:"a"},[u.createElementVNode("path",{fill:"currentColor",d:"M0 0h20v20H0z"})])],-1)])])}const Bu=Object.freeze(Object.defineProperty({__proto__:null,render:gc,default:{render:gc}},Symbol.toStringTag,{value:"Module"})),Tu={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"none",viewBox:"0 0 20 20"};function pc(e,t){return u.openBlock(),u.createElementBlock("svg",Tu,[...t[0]||(t[0]=[u.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 Eu=Object.freeze(Object.defineProperty({__proto__:null,render:pc,default:{render:pc}},Symbol.toStringTag,{value:"Module"})),Du={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"none",viewBox:"0 0 20 20"};function bc(e,t){return u.openBlock(),u.createElementBlock("svg",Du,[...t[0]||(t[0]=[u.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 Pu=Object.freeze(Object.defineProperty({__proto__:null,render:bc,default:{render:bc}},Symbol.toStringTag,{value:"Module"})),Ru={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"none",viewBox:"0 0 20 20"};function mc(e,t){return u.openBlock(),u.createElementBlock("svg",Ru,[...t[0]||(t[0]=[u.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 Iu=Object.freeze(Object.defineProperty({__proto__:null,render:mc,default:{render:mc}},Symbol.toStringTag,{value:"Module"})),Ou={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"none",viewBox:"0 0 20 20"};function _c(e,t){return u.openBlock(),u.createElementBlock("svg",Ou,[...t[0]||(t[0]=[u.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 zu=Object.freeze(Object.defineProperty({__proto__:null,render:_c,default:{render:_c}},Symbol.toStringTag,{value:"Module"})),Fu={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"none",viewBox:"0 0 20 20"};function yc(e,t){return u.openBlock(),u.createElementBlock("svg",Fu,[...t[0]||(t[0]=[u.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 Nu=Object.freeze(Object.defineProperty({__proto__:null,render:yc,default:{render:yc}},Symbol.toStringTag,{value:"Module"}));le.VPdfAnnotationTools=hc,le.default=yu,Object.defineProperties(le,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|