the editable site (validation-lab)

This commit is contained in:
kpgarrod committed 2026-11-21 08:03:55 +01:00
commit 3ac81d5a52
13454 files changed
+2227005

No files matched your search

+52
View File
@@ -0,0 +1,52 @@
const e=!(typeof process!=`object`||process+``!=`[object process]`||process.versions.nw||process.versions.electron&&process.type&&process.type!==`browser`),t=[1/0,1/0,-1/0,-1/0],n=new Float32Array(t),r=[.001,0,0,.001,0,0],i=.35/1.35,a=`http://www.w3.org/2000/svg`,o=`pdfjs_internal_editor_`,s={PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048},c={TEXT:1,LINK:2,FREETEXT:3,LINE:4,SQUARE:5,CIRCLE:6,POLYGON:7,POLYLINE:8,HIGHLIGHT:9,UNDERLINE:10,SQUIGGLY:11,STRIKEOUT:12,STAMP:13,CARET:14,INK:15,POPUP:16,FILEATTACHMENT:17,SOUND:18,MOVIE:19,WIDGET:20,SCREEN:21,PRINTERMARK:22,TRAPNET:23,WATERMARK:24,THREED:25,REDACT:26,RICHMEDIA:27},l=`Group`,u={E:`Mouse Enter`,X:`Mouse Exit`,D:`Mouse Down`,U:`Mouse Up`,Fo:`Focus`,Bl:`Blur`,PO:`PageOpen`,PC:`PageClose`,PV:`PageVisible`,PI:`PageInvisible`,K:`Keystroke`,F:`Format`,V:`Validate`,C:`Calculate`},d={WC:`WillClose`,WS:`WillSave`,DS:`DidSave`,WP:`WillPrint`,DP:`DidPrint`},f={O:`PageOpen`,C:`PageClose`};let p=1;function m(e){p>=5&&console.info(`Info: ${e}`)}function h(e){p>=1&&console.warn(`Warning: ${e}`)}function g(e){throw Error(e)}function _(e,t){e||g(t)}function v(e,t=null,n=null){if(!e)return null;if(n&&typeof e==`string`&&(n.addDefaultProtocol&&e.startsWith(`www.`)&&e.match(/\./g)?.length>=2&&(e=`http://${e}`),n.tryConvertEncoding))try{e=j(e)}catch{}let r=t?URL.parse(e,t):URL.parse(e);return function(e){switch(e?.protocol){case`http:`:case`https:`:case`ftp:`:case`mailto:`:case`tel:`:return!0;default:return!1}}(r)?r:null}function y(e,t,n,r=!1){return Object.defineProperty(e,t,{value:n,enumerable:!r,configurable:!0,writable:!1}),n}const b=function(){function e(e,t){this.message=e,this.name=t}return e.prototype=/* @__PURE__ */ Error(),e.constructor=e,e}();var x=class extends b{constructor(e,t){super(e,`PasswordException`),this.code=t}},S=class extends b{constructor(e,t){super(e,`UnknownErrorException`),this.details=t}},C=class extends b{constructor(e){super(e,`InvalidPDFException`)}},w=class extends b{constructor(e,t,n){super(e,`ResponseException`),this.status=t,this.missing=n}},T=class extends b{constructor(e){super(e,`FormatError`)}},E=class extends b{constructor(e){super(e,`AbortException`)}};function D(e){typeof e==`object`&&e?.length!==void 0||g(`Invalid argument for bytesToString`);let t=e.length,n=8192;if(t<n)return String.fromCharCode.apply(null,e);let r=[];for(let i=0;i<t;i+=n){let a=Math.min(i+n,t),o=e.subarray(i,a);r.push(String.fromCharCode.apply(null,o))}return r.join(``)}function O(e){typeof e!=`string`&&g(`Invalid argument for stringToBytes`);let t=e.length,n=new Uint8Array(t);for(let r=0;r<t;++r)n[r]=255&e.charCodeAt(r);return n}var k=class{static get isLittleEndian(){let e=/* @__PURE__ */ new Uint8Array(4);return e[0]=1,y(this,`isLittleEndian`,new Uint32Array(e.buffer,0,1)[0]===1)}static get isOffscreenCanvasSupported(){return y(this,`isOffscreenCanvasSupported`,typeof OffscreenCanvas<`u`)}static get isImageDecoderSupported(){return y(this,`isImageDecoderSupported`,typeof ImageDecoder<`u`)}static get isVideoFrameSupported(){return y(this,`isVideoFrameSupported`,typeof VideoFrame<`u`)}static get isFloat16ArraySupported(){return y(this,`isFloat16ArraySupported`,typeof Float16Array<`u`)}static get isSanitizerSupported(){return y(this,`isSanitizerSupported`,typeof Sanitizer<`u`)}static get platform(){let{platform:e,userAgent:t}=navigator;return y(this,`platform`,{isAndroid:t.includes(`Android`),isLinux:e.includes(`Linux`),isMac:e.includes(`Mac`),isWindows:e.includes(`Win`),isFirefox:t.includes(`Firefox`)})}static get isCanvasFilterSupported(){let e;return this.isOffscreenCanvasSupported&&(e=new OffscreenCanvas(1,1).getContext(`2d`)),y(this,`isCanvasFilterSupported`,e?.filter!==void 0)}static get isAlphaColorInputSupported(){return y(this,`isAlphaColorInputSupported`,!1)}static get isBackdropFilterSupported(){return y(this,`isBackdropFilterSupported`,typeof CSS<`u`&&CSS.supports(`backdrop-filter`,`blur(1px)`))}},A=class{static get hexNums(){return y(this,`hexNums`,Array.from({length:256},(e,t)=>t.toString(16).padStart(2,`0`)))}static makeHexColor(e,t,n){return`#${this.hexNums[e]}${this.hexNums[t]}${this.hexNums[n]}`}static get identity0to256Map(){return y(this,`identity0to256Map`,Uint8Array.from({length:256},(e,t)=>t))}static transform(e,t){return[e[0]*t[0]+e[2]*t[1],e[1]*t[0]+e[3]*t[1],e[0]*t[2]+e[2]*t[3],e[1]*t[2]+e[3]*t[3],e[0]*t[4]+e[2]*t[5]+e[4],e[1]*t[4]+e[3]*t[5]+e[5]]}static multiplyByDOMMatrix(e,t){return[e[0]*t.a+e[2]*t.b,e[1]*t.a+e[3]*t.b,e[0]*t.c+e[2]*t.d,e[1]*t.c+e[3]*t.d,e[0]*t.e+e[2]*t.f+e[4],e[1]*t.e+e[3]*t.f+e[5]]}static applyTransform(e,t,n=0){let r=e[n],i=e[n+1];e[n]=r*t[0]+i*t[2]+t[4],e[n+1]=r*t[1]+i*t[3]+t[5]}static applyTransformToBezier(e,t,n=0){let r=t[0],i=t[1],a=t[2],o=t[3],s=t[4],c=t[5];for(let t=0;t<6;t+=2){let l=e[n+t],u=e[n+t+1];e[n+t]=l*r+u*a+s,e[n+t+1]=l*i+u*o+c}}static applyInverseTransform(e,t){let n=e[0],r=e[1],i=t[0]*t[3]-t[1]*Line truncated
`?`\\n`:e===`\r`?`\\r`:`\\${e}`)}function Xe(e,t,n,r){if(!e)return;let i=null;if(e instanceof F){if(r.has(e))return;i=e,r.put(i),e=t.fetch(e)}if(Array.isArray(e))for(let i of e)Xe(i,t,n,r);else if(e instanceof P){if(I(e.get(`S`),`JavaScript`)){let t=e.get(`JS`),r;t instanceof L?r=t.getString():typeof t==`string`&&(r=t),r&&=R(r,!0).replaceAll(`\0`,``),r&&n.push(r.trim())}Xe(e.getRaw(`Next`),t,n,r)}i&&r.remove(i)}function Ze(e,t,n,r){let i=[];Xe(e,n,i,new me),i.length&&r.set(t,i)}function Qe(e,t,n){let r=/* @__PURE__ */ new Map,i=Re({dict:t,key:`AA`,stopWhenFound:!1});if(i)for(let t=i.length-1;t>=0;t--){let a=i[t];if(a instanceof P)for(let[t,i]of a.getRawEntries()){let a=n[t];a&&Ze(i,a,e,r)}}return t.has(`A`)&&Ze(t.get(`A`),`Action`,e,r),r.size?r:null}const $e={60:`&lt;`,62:`&gt;`,38:`&amp;`,34:`&quot;`,39:`&apos;`};function*et(e){for(let t=0,n=e.length;t<n;t++){let n=e.codePointAt(t);n>55295&&(n<57344||n>65533)&&t++,yield n}}function tt(e){let t=[],n=0;for(let r=0,i=e.length;r<i;r++){let i=e.codePointAt(r);if(32<=i&&i<=126){let a=$e[i];a&&(n<r&&t.push(e.substring(n,r)),t.push(a),n=r+1)}else n<r&&t.push(e.substring(n,r)),t.push(`&#x${i.toString(16).toUpperCase()};`),i>65535&&r++,n=r+1}return t.length===0?e:(n<e.length&&t.push(e.substring(n)),t.join(``))}function nt(e,t=!1){let n=/^("|').*("|')$/.exec(e);if(n&&n[1]===n[2]){if(RegExp(`[^\\\\]${n[1]}`).test(e.slice(1,-1)))return t&&h(`FontFamily contains unescaped ${n[1]}: ${e}.`),!1;if(ye.test(e))return t&&h(`FontFamily contains control characters: ${e}.`),!1}else for(let n of e.split(/[ \t]+/))if(/^(?:\d|-[\d-])/.test(n)||!/^[\w\\-]+$/.test(n))return t&&h(`FontFamily contains invalid <custom-ident>: ${e}.`),!1;return!0}function rt(e){return e.replaceAll(/( +)(\d)?/g,(e,t,n)=>n??` `)}function it(e){let t=/* @__PURE__ */ new Set([`100`,`200`,`300`,`400`,`500`,`600`,`700`,`800`,`900`,`1000`,`normal`,`bold`,`bolder`,`lighter`]),{fontFamily:n,fontWeight:r,italicAngle:i}=e;if(!nt(n,!0))return!1;let a=r?r.toString():``;e.fontWeight=t.has(a)?a:`400`;let o=parseFloat(i);return e.italicAngle=isNaN(o)||o<-90||o>90?`14`:i.toString(),!0}function at(e){let t=(/* @__PURE__ */ RegExp(`^\\s*(app\\.launchURL|window\\.open|xfa\\.host\\.gotoURL)\\((?:'|")([^'"]*)(?:'|")(?:,\\s*(\\w+)\\)|\\))`,`i`)).exec(e);return t?.[2]?{url:t[2],newWindow:t[1]===`app.launchURL`&&t[3]===`true`}:null}function ot(e){if(Number.isInteger(e))return e.toString();let t=Math.round(100*e);return t%100==0?(t/100).toString():t%10==0?e.toFixed(1):e.toFixed(2)}function st(e){if(!e)return null;let t=/* @__PURE__ */ new Map;for(let[n,r]of e)n.startsWith(o)&&t.getOrInsertComputed(r.pageIndex,ie).push(r);return t.size>0?t:null}function ct(e=/* @__PURE__ */ new Date){return e instanceof Date||(e=new Date(e)),[e.getUTCFullYear().toString(),(e.getUTCMonth()+1).toString().padStart(2,`0`),e.getUTCDate().toString().padStart(2,`0`),e.getUTCHours().toString().padStart(2,`0`),e.getUTCMinutes().toString().padStart(2,`0`),e.getUTCSeconds().toString().padStart(2,`0`)].join(``)}function lt(e,t,n){switch(e){case 90:return[0,1,-1,0,t,0];case 180:return[-1,0,0,-1,t,n];case 270:return[0,-1,1,0,0,n];default:throw Error(`Invalid rotation`)}}function ut(e){return Math.ceil(Math.ceil(Math.log2(1+e))/8)}const dt=new Uint8Array(new Uint32Array([1]).buffer)[0]===1?4278190080:255,ft=~dt;var pt=class{static#e=null;static _memory=null;static _destBuffer=null;static _destOffset=0;static _keepAlpha=!1;static get _memoryArray(){let e=this.#e;return e?.byteLength?e:this.#e=new Uint8Array(this._memory.buffer)}};const mt=Object.freeze({RGB8:0,0:`RGB8`,RGBA8:1,1:`RGBA8`,BGRA8:2,2:`BGRA8`,Gray8:3,3:`Gray8`,GrayA8:4,4:`GrayA8`,CMYK:5,5:`CMYK`}),ht=Object.freeze({Perceptual:0,0:`Perceptual`,RelativeColorimetric:1,1:`RelativeColorimetric`,Saturation:2,2:`Saturation`,AbsoluteColorimetric:3,3:`AbsoluteColorimetric`});function gt(e,t,n){let r=bt(t,wt.__wbindgen_malloc),i=Tt;wt.qcms_convert_array(e,r,i,n)}function _t(){return{__proto__:null,"./qcms_bg.js":{__proto__:null,__wbg___wbindgen_throw_344f42d3211c4765:function(e,t){throw Error(function(e,t){return function(e,t){return Ct+=t,Ct>=St&&(xt=new TextDecoder(`utf-8`,{ignoreBOM:!0,fatal:!0}),xt.decode(),Ct=t),xt.decode(yt().subarray(e,e+t))}(e>>>0,t)}(e,t))},__wbg_copy_result_0d15f3bf9d9012ae:function(e,t){(function(e,t){let{_destBuffer:n,_destOffset:r,_keepAlpha:i,_memoryArray:a}=pt;if(!i){n.set(a.subarray(e,e+t),r);return}let o=t>>2,s=n.byteOffset+r;if(3&(s|e))for(let i=e,o=e+t,s=r;i<o;i+=4,s+=4)n[s]=a[i],n[s+1]=a[i+1],n[s+2]=a[i+2];else{let t=new Uint32Array(n.buffer,s,o),r=new Uint32Array(pt._memory.buffer,e,o);for(let e=0;e<o;e++)t[e]=t[e]&dt|r[e]&ft}})(e>>>0,t>>>0)},__wbindgen_init_externref_table:function(){let e=wt.__wbindgen_externrefs,t=e.grow(4);e.set(0,void 0),e.set(t+0,void 0),e.set(t+1,null),e.set(t+2,!0),e.set(t+3,!1)}}}}let vt=null;function yt(){return vt!==null&&vt.byteLength!==0||(vt=new Uint8Array(wt.memory.buffer)),vt}function bt(e,t){let n=t(1*e.length,1)>>>0;return yt().set(e,n/1) Line truncated
#]# for # a # that #. # with #'# from # by #. The # on # as # is #ing #
#:#ed #(# at #ly #="# of the #. This #,# not #er #al #='#ful #ive #less #est #ize #ous #`,` !! ! , *! &! " ! ) * * - ! # ! #!*! + ,$ ! - % . / # 0 1 . " 2 3!* 4% ! # / 5 6 7 8 0 1 & $ 9 + : ; < ' != > ?! 4 @ 4 2 & A *# ( B C& ) % ) !*# *-% A +! *. D! %' & E *6 F G% ! *A *% H! D I!+! J!+ K +- *4! A L!*4 M N +6 O!*% +.! K *G P +%( ! G *D +D Q +# *K!*G!+D!+# +G +A +4!+% +K!+4!*D!+K!*K`);function oe(e,t){let n=1<<t-1;for(;(e&n)!==0;)n>>=1;return(e&n-1)+n}function M(e,t,n,r,i){let a=r;for(;a>0;)a-=n,e[t+a]=i}function se(e,t,n){let r=t,i=1<<r-n;for(;r<15&&(i-=e[r],!(i<=0));)r++,i<<=1;return r-n}function ce(e,t,n,r,i){let a=e[t],o=new Int32Array(i),s=/* @__PURE__ */ new Int32Array(16),c=/* @__PURE__ */ new Int32Array(16);for(let e=0;e<i;++e)s[r[e]]++;c[1]=0;for(let e=1;e<15;++e)c[e+1]=c[e]+s[e];for(let e=0;e<i;++e)r[e]!==0&&(o[c[r[e]]++]=e);let l=n,u=1<<l,d=u;if(c[15]===1){for(let t=0;t<d;++t)e[a+t]=o[0];return d}let f=0,p=0,m=1;for(let t=1;t<=n;++t)for(m<<=1;s[t]>0;)M(e,a+f,m,u,t<<16|o[p++]),f=oe(f,t),s[t]--;let h=d-1,g=-1,_=a;m=1;for(let t=n+1;t<=15;++t)for(m<<=1;s[t]>0;)(f&h)!==g&&(_+=u,l=se(s,t,n),u=1<<l,d+=u,g=f&h,e[a+g]=l+n<<16|_-a-g),M(e,_+(f>>n),m,u,t-n<<16|o[p++]),f=oe(f,t),s[t]--;return d}function le(e){if(e.endOfStreamReached!==0)return F(e)>=-2?0:Se(e,-16);let t=e.halfOffset<<1,n=4096-t;for(e.byteBuffer.copyWithin(0,t,4096),e.halfOffset=0;n<4096;){let t=4096-n,r=be(e,e.byteBuffer,n,t);if(r<-1)return r;if(r<=0){e.endOfStreamReached=1,e.tailBytes=n,n+=1;break}n+=r}return(function(e,t){let n=e.byteBuffer,r=t>>1,i=e.shortBuffer;for(let e=0;e<r;++e)i[e]=255&n[2*e]|(255&n[2*e+1])<<8})(e,n),0}function ue(e,t){if(e.endOfStreamReached===0)return 0;let n=(e.halfOffset<<1)+(e.bitOffset+7>>3)-4;return n>e.tailBytes?Se(e,-13):t!==0&&n!==e.tailBytes?Se(e,-17):0}function de(e,t){let n=e.accumulator32>>>e.bitOffset&(1<<t)-1;return e.bitOffset+=t,n}function N(e,t){let n=de(e,16);return e.accumulator32=e.shortBuffer[e.halfOffset++]<<16|e.accumulator32>>>16,e.bitOffset-=16,n|de(e,t-16)<<16}function fe(e){if(e.halfOffset>2030){let t=le(e);if(t!==0)return t}let t=ue(e,0);return t===0?(e.accumulator32=e.shortBuffer[e.halfOffset++]<<16|e.accumulator32>>>16,e.bitOffset-=16,e.accumulator32=e.shortBuffer[e.halfOffset++]<<16|e.accumulator32>>>16,e.bitOffset-=16,0):t}function pe(e){return e.bitOffset===32?fe(e):0}function P(e){let t=32-e.bitOffset&7;return t!==0&&de(e,t)!==0?Se(e,-5):0}function F(e){let t=2048;return e.endOfStreamReached!==0&&(t=e.tailBytes+1>>1),t-e.halfOffset}let me=/* @__PURE__ */ new Int32Array(2048);(function(e,t,n){for(let t=0;t<256;++t)e[t]=63&t,e[512+t]=t>>2,e[1792+t]=2+(t>>6);for(let n=0;n<128;++n)e[1024+n]=4*(t.charCodeAt(n)-32);for(let t=0;t<64;++t)e[1152+t]=1&t,e[1216+t]=2+(1&t);let r=1280;for(let t=0;t<19;++t){let i=3&t,a=n.charCodeAt(t)-32;for(let t=0;t<a;++t)e[r++]=i}for(let t=0;t<16;++t)e[1792+t]=1,e[2032+t]=6;e[1792]=0,e[2047]=7;for(let t=0;t<256;++t)e[1536+t]=e[1792+t]<<3})(me,` !! ! "#$##%#$&'##(#)#++++++++++((&*'##,---,---,-----,-----,-----&#'###.///.///./////./////./////&#'# `,`A/* ': & : $  @`);function he(){this.ringBuffer=/* @__PURE__ */ new Int8Array,this.contextModes=/* @__PURE__ */ new Int8Array,this.contextMap=/* @__PURE__ */ new Int8Array,this.distContextMap=/* @__PURE__ */ new Int8Array,this.distExtraBits=/* @__PURE__ */ new Int8Array,this.output=/* @__PURE__ */ new Int8Array,this.byteBuffer=/* @__PURE__ */ new Int8Array,this.shortBuffer=/* @__PURE__ */ new Int16Array,this.intBuffer=/* @__PURE__ */ new Int32Array,this.rings=/* @__PURE__ */ new Int32Array,this.blockTrees=/* @__PURE__ */ new Int32Array,this.literalTreeGroup=/* @__PURE__ */ new Int32Array,this.commandTreeGroup=/* @__PURE__ */ new Int32Array,this.distanceTreeGroup=/* @__PURE__ */ new Int32Array,this.distOffset=/* @__PURE__ */ new Int32Array,this.accumulator64=0,this.runningState=0,this.nextRunningState=0,this.accumulator32=0,this.bitOffset=0,this.halfOffset=0,this.tailBytes=0,this.endOfStreamReached=0,this.metaBlockLength=0,this.inputEnd=0,this.isUncompressed=0,this.isMetadata=0,this.literalBlockLength=0,this.numLiteralBlockTypes=0,this.commandBlockLength=0,this.numCommandBlockTypes=0,this.distanceBlockLength=0,this.numDistanceBlockTypes=0,this.pos=0,this.maxDistance=0,this.distRbIdx=0,this.trivialLiteralContext=0,this.literalTreeIdx=0,this.commandTreeIdx=0,this.j=0,this.insertLength=0,this.contextMapSlice=0,this.distContextMapSlice=0,this.contextLookupOffset1=0,this.contextLookupOffset2=0,this.distanceCode=0,this.numDirectDistanceCodes=0,this.distancePostfixBits=0,this.distance=0,this.copyLength=0,this.maxBackwardDistance=0,this.maxRingBufferSize=0,this.ringBufferSize=0,this.expectedTotalSize=0,this.outputOffset=0,this.outputLength=0,this.outputUsed=0,this.ringBufferBytesWritten=0,this.ringBufferBytesReady=0,this.isEager=0,this.isLargeWindow=0,this.cdNumChunks=0,this.cdTotalSize=0,this.cdBrIndex=0,this.cdBrOffset=0,thiLine truncated
/*webpackIgnore: true*/
/*@vite-ignore*/
`${e.#i}${this._noWasmFilename}`);return{exports:n(t)}}async#c(t){return this.#a||=e.#r?await Le(`${e.#i}${this._filename}`):await e.#e().sendWithPromise(`FetchBinaryData`,{kind:`wasmUrl`,filename:this._filename}),(await WebAssembly.instantiate(this.#a,t)).instance}async#l(t,n,r){if(e.#n)try{return r(await this.#c(n))}catch(e){h(`#getWasmInstance: ${e}`)}try{return r(await this.#s(n))}catch(e){h(`#getJsInstance: ${e}`)}return t(null),null}_getModule(e){if(!this.#o){let{promise:t,resolve:n}=Promise.withResolvers();this.#o=Promise.race([t,e({warn:h,instantiateWasm:this.#l.bind(this,n)})])}return this.#o}async decode(e,t){g("Abstract method `decode` called")}},Un=class extends b{constructor(e){super(e,`Jbig2Error`)}},Wn=class e extends Hn{_filename=`jbig2.wasm`;_noWasmFilename=`jbig2_nowasm_fallback.js`;static get instance(){return y(this,`instance`,new e(!0))}async decode(e,t,n,r,i){let a=await this._getModule(Vn);if(!a)throw new Un(`JBig2 failed to initialize`);let o,s;try{let c=e.length;if(o=a._malloc(c),a.writeArrayToMemory(e,o),i)a._ccitt_decode(o,c,t,n,i.K,+!!i.EndOfLine,+!!i.EncodedByteAlign,+!!i.BlackIs1,i.Columns,i.Rows);else{let e=r?r.length:0;e>0&&(s=a._malloc(e),a.writeArrayToMemory(r,s)),a._jbig2_decode(o,c,t,n,s,e)}if(!a.imageData)throw new Un(`Unknown error`);let{imageData:l}=a;return a.imageData=null,l}finally{o&&a._free(o),s&&a._free(s)}}},Gn=class extends Qt{constructor(e,t,n){super(t),this.stream=e,this.maybeLength=t,this.dict=e.dict,n instanceof P||(n=P.empty),this.params={K:n.get(`K`)||0,EndOfLine:!!n.get(`EndOfLine`),EncodedByteAlign:!!n.get(`EncodedByteAlign`),Columns:n.get(`Columns`)||1728,Rows:n.get(`Rows`)||0,EndOfBlock:!!(n.get(`EndOfBlock`)??!0),BlackIs1:!!n.get(`BlackIs1`)}}get bytes(){return y(this,`bytes`,this.stream.getBytes(this.maybeLength))}get isImageStream(){return!0}get isAsyncDecoder(){return!0}async decodeImage(e,t,n){return this.eof||=(e??=this.stream.isAsync&&await this.stream.asyncGetBytes()||this.bytes,this.buffer=await Wn.instance.decode(e,this.dict.get(`W`,`Width`),this.dict.get(`H`,`Height`),null,this.params),this.bufferLength=this.buffer.length,!0),this.buffer}};const Kn=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),qn=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]),Jn=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]),Yn=[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,52Line truncated
`+n:t.errorMessages=n}};return S=await async function(){function e(e){return(function(e){t._malloc=e.k,t._free=e.l,t._jp2_decode=e.m,b=e.i,e.__indirect_function_table})(S=e.exports),o(),S}var n=function(){return{a:C}}(),r=t.instantiateWasm;return new Promise(t=>{r(n,n=>t(e(n)))})}(),await async function(){(function(){var e=t.preRun;e&&(typeof e==`function`&&(e=[e]),f.push(...e)),u(f)})();var e=t.setStatus;e&&(e(`Running...`),await new Promise(e=>setTimeout(e,1)),setTimeout(e,1,``)),(function(){S.j()})(),t.onRuntimeInitialized?.(),(function(){var e=t.postRun;e&&(typeof e==`function`&&(e=[e]),d.push(...e)),u(d)})()}(),t};var er=class extends b{constructor(e){super(e,`JpxError`)}},tr=class e extends Hn{_filename=`openjpeg.wasm`;_noWasmFilename=`openjpeg_nowasm_fallback.js`;static get instance(){return y(this,`instance`,new e(!0))}async decode(e,{numComponents:t,isIndexedColormap:n=!1,smaskInData:r=!1,reducePower:i=0}={}){let a=t!==void 0;t??=4;let o=await this._getModule($n);if(!o)throw new er(`OpenJPEG failed to initialize`);let s;try{let c=e.length;if(s=o._malloc(c),o.writeArrayToMemory(e,s),o._jp2_decode(s,c,t>0?t:0,!!n,!!r,i,a)){let{errorMessages:e}=o;throw e?(delete o.errorMessages,new er(e)):new er(`Unknown error`)}let{imageData:l}=o;return o.imageData=null,l}finally{s&&o._free(s)}}static parseImageProperties(e){let t=e.getByte();for(;t>=0;){let n=t;if(t=e.getByte(),(n<<8|t)==65361){e.skip(4);let t=e.getInt32()>>>0,n=e.getInt32()>>>0,r=e.getInt32()>>>0,i=e.getInt32()>>>0;return e.skip(16),{width:t-r,height:n-i,bitsPerComponent:8,componentsCount:e.getUint16()}}}throw new er(`No size marker found in JPX stream`)}},nr=class extends Qt{constructor(e,t){super(t),this.stream=e,this.dict=e.dict,this.maybeLength=t}get bytes(){return y(this,`bytes`,this.stream.getBytes(this.maybeLength))}ensureBuffer(e){}get isAsyncDecoder(){return!0}async decodeImage(e,t,n){return this.eof||=(e||=this.bytes,this.buffer=await tr.instance.decode(e,n),this.bufferLength=this.buffer.length,!0),this.buffer}get canAsyncDecodeImageFromBuffer(){return this.stream.isAsync}get isImageStream(){return!0}},rr=class extends Qt{constructor(e,t,n){super(t),this.stream=e,this.dict=e.dict,this.cachedData=0,this.bitsCached=0;let r=4096,i={earlyChange:n,codeLength:9,nextCode:258,dictionaryValues:new Uint8Array(r),dictionaryLengths:new Uint16Array(r).fill(1,0,256),dictionaryPrevCodes:new Uint16Array(r),currentSequence:new Uint8Array(r),currentSequenceLength:0};i.dictionaryValues.set(A.identity0to256Map,0),this.lzwState=i}readBits(e){let t=this.bitsCached,n=this.cachedData;for(;t<e;){let e=this.stream.getByte();if(e===-1)return this.eof=!0,null;n=n<<8|e,t+=8}return this.bitsCached=t-=e,this.cachedData=n,n>>>t&(1<<e)-1}readBlock(){let e,t,n,r=1024,{lzwState:i}=this,a=i.earlyChange,o=i.nextCode,s=i.dictionaryValues,c=i.dictionaryLengths,l=i.dictionaryPrevCodes,u=i.codeLength,d=i.prevCode,f=i.currentSequence,p=i.currentSequenceLength,m=0,h=this.bufferLength,g=this.ensureBuffer(this.bufferLength+r);for(e=0;e<512;e++){let e=this.readBits(u),i=p>0;if(e<256)f[0]=e,p=1;else{if(!(e>=258)){if(e===256){u=9,o=258,p=0;continue}this.eof=!0,delete this.lzwState;break}if(e<o)for(p=c[e],t=p-1,n=e;t>=0;t--)f[t]=s[n],n=l[n];else f[p++]=f[0]}if(i&&(l[o]=d,c[o]=c[d]+1,s[o]=f[0],o++,u=o+a&o+a-1?u:0|Math.min(Math.log(o+a)/.6931471805599453+1,12)),d=e,m+=p,r<m){do r+=512;while(r<m);g=this.ensureBuffer(this.bufferLength+r)}for(t=0;t<p;t++)g[h++]=f[t]}i.nextCode=o,i.codeLength=u,i.prevCode=d,i.currentSequenceLength=p,this.bufferLength=h}},ir=class extends Qt{constructor(e,t,n){if(super(t),!(n instanceof P))return e;let r=this.predictor=n.get(`Predictor`)||1;if(r<=1)return e;if(r!==2&&(r<10||r>15))throw new T(`Unsupported predictor: ${r}`);this.readBlock=r===2?this.readBlockTiff:this.readBlockPng,this.stream=e,this.dict=e.dict;let i=this.colors=n.get(`Colors`)||1,a=this.bits=n.get(`BPC`,`BitsPerComponent`)||8,o=this.columns=n.get(`Columns`)||1;return this.pixBytes=i*a+7>>3,this.rowBytes=o*i*a+7>>3,this}readBlockTiff(){let e=this.rowBytes,t=this.bufferLength,n=this.ensureBuffer(t+e),r=this.bits,i=this.colors,a=this.stream.getBytes(e);if(this.eof=!a.length,this.eof)return;let o,s=0,c=0,l=0,u=0,d=t;if(r===1&&i===1)for(o=0;o<e;++o){let e=a[o]^s;e^=e>>1,e^=e>>2,e^=e>>4,s=(1&e)<<7,n[d++]=e}else if(r===8){for(o=0;o<i;++o)n[d++]=a[o];for(;o<e;++o)n[d]=n[d-i]+a[o],d++}else if(r===16){let t=2*i;for(o=0;o<t;++o)n[d++]=a[o];for(;o<e;o+=2){let e=((255&a[o])<<8)+(255&a[o+1])+((255&n[d-t])<<8)+(255&n[d-t+1]);n[d++]=e>>8&255,n[d++]=255&e}}else{let e=new Uint8Array(i+1),d=(1<<r)-1,f=0,p=t,m=this.columns;for(o=0;o<m;++o)for(let t=0;t<i;++t)l<r&&(s=s<<8|255&a[f++],l+=8),e[t]=e[t]+(s>>l-r)&d,l-=r,c=c<<r|e[t],u+=r,u>=8&&(n[p++]=c>>u-8&255,u-=8);u>0&&(n[p++]=(c<<8-u)+(s&(1<<8-u)-1))}this.bufferLength+=e}readBlockPng(){let e=this.rowBytes,t=this.pixBytes,n=this.stream.getByte(),r=this.stream.getBytes(e);if(this.eof=!r.length,this.eof)return;let i=this.bufferLength,a=this.ensureBuffer(i+e),o=a.subarr Line truncated
`);break;case 114:n.push(`\r`);break;case 116:n.push(` `);break;case 98:n.push(`\b`);break;case 102:n.push(`\f`);break;case 92:n.push(`\\`);break;case 40:n.push(`(`);break;case 41:n.push(`)`);break;case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:let e=15&r;r=this.nextChar(),i=!0,r>=48&&r<=55&&(e=(e<<3)+(15&r),r=this.nextChar(),r>=48&&r<=55&&(i=!1,e=(e<<3)+(15&r))),n.push(String.fromCharCode(e));break;case 13:this.peekChar()===10&&this.nextChar();break;case 10:break;default:n.push(String.fromCharCode(r))}break;default:n.push(String.fromCharCode(r))}if(t)break;i||(r=this.nextChar())}return n.join(``)}getName(){let e,t,n=this.strBuf;for(n.length=0;(e=this.nextChar())>=0&&!sr[e];)if(e===35){if(e=this.nextChar(),sr[e]){h(`Lexer_getName: NUMBER SIGN (#) should be followed by a hexadecimal number.`),n.push(`#`);break}let r=cr(e);if(r!==-1){t=e,e=this.nextChar();let i=cr(e);if(i===-1){if(h(`Lexer_getName: Illegal digit (${String.fromCharCode(e)}) in hexadecimal number.`),n.push(`#`,String.fromCharCode(t)),sr[e])break;n.push(String.fromCharCode(e));continue}n.push(String.fromCharCode(r<<4|i))}else n.push(`#`,String.fromCharCode(e))}else n.push(String.fromCharCode(e));return n.length>127&&h(`Name token is longer than allowed by the spec: ${n.length}`),N.get(n.join(``))}_hexStringWarn(e){this._hexStringNumWarn++===5?h(`getHexString - ignoring additional invalid characters.`):this._hexStringNumWarn>5||h(`getHexString - ignoring invalid character: ${e}`)}getHexString(){let e=this.strBuf;e.length=0;let t=this.currentChar,n=-1,r=-1;for(this._hexStringNumWarn=0;;){if(t<0){h(`Unterminated hex string`);break}if(t===62){this.nextChar();break}sr[t]===1||(r=cr(t),r===-1?this._hexStringWarn(t):n===-1?n=r:(e.push(String.fromCharCode(n<<4|r)),n=-1)),t=this.nextChar()}return n!==-1&&e.push(String.fromCharCode(n<<4)),e.join(``)}getObj(){let e=!1,t=this.currentChar;for(;;){if(t<0)return ce;if(e)t!==10&&t!==13||(e=!1);else if(t===37)e=!0;else if(sr[t]!==1)break;t=this.nextChar()}switch(0|t){case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:case 43:case 45:case 46:return this.getNumber();case 40:return this.getString();case 47:return this.getName();case 91:return this.nextChar(),fe.get(`[`);case 93:return this.nextChar(),fe.get(`]`);case 60:return t=this.nextChar(),t===60?(this.nextChar(),fe.get(`<<`)):this.getHexString();case 62:return t=this.nextChar(),t===62?(this.nextChar(),fe.get(`>>`)):fe.get(`>`);case 123:return this.nextChar(),fe.get(`{`);case 125:return this.nextChar(),fe.get(`}`);case 41:throw this.nextChar(),new T(`Illegal character: ${t}`)}let n=String.fromCharCode(t);if(t<32||t>127){let e=this.peekChar();if(e>=32&&e<=127)return this.nextChar(),fe.get(n)}let r=this.knownCommands,i=r?.[n]!==void 0;for(;(t=this.nextChar())>=0&&!sr[t];){let e=n+String.fromCharCode(t);if(i&&r[e]===void 0)break;if(n.length===128)throw new T(`Command token too long: ${n.length}`);n=e,i=r?.[n]!==void 0}return n===`true`?!0:n===`false`?!1:n===`null`?null:(n===`BI`&&(this.beginInlineImagePos=this.stream.pos),fe.get(n))}skipToNextLine(){let e=this.currentChar;for(;e>=0;){if(e===13){e=this.nextChar(),e===10&&this.nextChar();break}if(e===10){this.nextChar();break}e=this.nextChar()}}},ur=class{static create(e){function t(e,t,n=!1){let r=e.get(t);if(Number.isInteger(r)&&(n?r>=0:r>0))return r;throw Error(`The "${t}" parameter in the linearization dictionary is invalid.`)}let n=new or({lexer:new lr(e),xref:null}),r=n.getObj(),i=n.getObj(),a=n.getObj(),o=n.getObj(),s,c;if(!(Number.isInteger(r)&&Number.isInteger(i)&&ge(a,`obj`)&&o instanceof P&&typeof(s=o.get(`Linearized`))==`number`&&s>0))return null;if((c=t(o,`L`))!==e.length)throw Error(`The "L" parameter in the linearization dictionary does not equal the stream length.`);return{length:c,hints:function(e){let t=e.get(`H`),n;if(Array.isArray(t)&&((n=t.length)===2||n===4)){for(let e=0;e<n;e++){let n=t[e];if(!(Number.isInteger(n)&&n>0))throw Error(`Hint (${e}) in the linearization dictionary is invalid.`)}return t}throw Error(`Hint array in the linearization dictionary is invalid.`)}(o),objectNumberFirst:t(o,`O`),endFirst:t(o,`E`),numPages:t(o,`N`),mainXRefEntriesOffset:t(o,`T`),pageFirst:o.has(`P`)?t(o,`P`,!0):0}}};const dr=/* @__PURE__ */ new Set(/* @__PURE__ */ `Adobe-GB1-UCS2.Adobe-CNS1-UCS2.Adobe-Japan1-UCS2.Adobe-Korea1-UCS2.78-EUC-H.78-EUC-V.78-H.78-RKSJ-H.78-RKSJ-V.78-V.78ms-RKSJ-H.78ms-RKSJ-V.83pv-RKSJ-H.90ms-RKSJ-H.90ms-RKSJ-V.90msp-RKSJ-H.90msp-RKSJ-V.90pv-RKSJ-H.90pv-RKSJ-V.Add-H.Add-RKSJ-H.Add-RKSJ-V.Add-V.Adobe-CNS1-0.Adobe-CNS1-1.Adobe-CNS1-2.Adobe-CNS1-3.Adobe-CNS1-4.Adobe-CNS1-5.Adobe-CNS1-6.Adobe-GB1-0.Adobe-GB1-1.Adobe-GB1-2.Adobe-GB1-3.Adobe-GB1-4.Adobe-GB1-5.Adobe-Japan1-0.Adobe-Japan1-1.Adobe-Japan1-2.Adobe-Japan1-3.Adobe-Japan1-4.Adobe-Japan1-5.Adobe-Japan1-6.Adobe-Korea1-0.Adobe-Korea1-1.Adobe-Korea1-2.B5-H.B5-V.B5pc-H.B5pc-V.CNS-EUC-H.CNS-EUC-V.CNS1-H.CNS1-V.CNS2-H.CNS2-V.ETHK-B5-H.ETHK-B5-V.ETen-B5-H.ETen-B5-V.ETenms-B5-H.ETenms-B5-V.EULine truncated
`,this.pos),t=this.data.indexOf(`\r`,this.pos),n=Math.min(e<0?this.len:e,t<0?this.len:t);this.pos=Math.min(n+1,this.len)}_getNumber(){this._numberPattern.lastIndex=this.pos;let e=this._numberPattern.exec(this.data);if(!e)return this.pos++,new us(z.number,0);let t=parseFloat(e[0]);return this.pos=this._numberPattern.lastIndex,new us(z.number,Number.isFinite(t)?t:0)}_getOperator(){this._identifierPattern.lastIndex=this.pos;let t=this._identifierPattern.exec(this.data);if(!t)return this.pos++,new us(z.number,0);this.pos=this._identifierPattern.lastIndex;let n=t[0];return e.#t[n]??new us(z.number,0)}next(){for(;this.pos<this.len;){let t=this.data.charCodeAt(this.pos++);switch(t){case 0:case 9:case 10:case 12:case 13:case 32:break;case 37:this._skipComment();break;case 123:return e.#e.lbrace;case 125:return e.#e.rbrace;case 43:case 45:case 46:return this.pos--,this._getNumber();default:return t>=48&&t<=57?(this.pos--,this._getNumber()):t>=97&&t<=122?(this.pos--,this._getOperator()):new us(z.number,0)}}return e.#e.eof}},fs=class{constructor(e){this.type=e}},ps=class extends fs{constructor(e){super(0),this.body=e}},ms=class extends fs{constructor(e){super(1),this.instructions=e}},hs=class extends fs{constructor(e){super(2),this.value=e}},gs=class extends fs{constructor(e){super(3),this.op=e}},_s=class extends fs{constructor(e){super(4),this.then=e}},vs=class extends fs{constructor(e,t){super(5),this.then=e,this.otherwise=t}},ys=class extends fs{constructor(e){super(6),this.index=e,this.valueType=0,this.depth=0}},bs=class extends fs{constructor(e){super(7),this.value=e,this.valueType=+(typeof e==`boolean`),this.depth=0}},xs=class extends fs{constructor(e,t,n=2){super(8),this.op=e,this.operand=t,this.valueType=n,this.depth=t.depth+1}},Ss=class extends fs{constructor(e,t,n,r=2){super(9),this.op=e,this.first=t,this.second=n,this.valueType=r,this.depth=Math.max(t.depth,n.depth)+1}},Cs=class extends fs{constructor(e,t,n,r=2){super(10),this.cond=e,this.then=t,this.otherwise=n,this.valueType=r,this.depth=Math.max(e.depth,t.depth,n.depth)+1}},ws=class e{constructor(e){this.lexer=e,this._token=null,this._depth=0}static _isRegularOperator(e){return e>=z.true&&e<z.if}_advance(){this._token=this.lexer.next()}_expect(e){if(this._token.id!==e)throw new T(`PostScript function: expected token id ${e}, got ${this._token.id}.`);let t=this._token;return this._advance(),t}parse(){this._advance(),this._expect(z.lbrace);let e=this._parseBlock();return this._expect(z.rbrace),this._token.id!==z.eof&&h(`PostScript function: unexpected content after closing brace.`),new ps(e)}_parseBlock(){let t=[];for(;;){let n=this._token;switch(n.id){case z.number:t.push(new hs(n.value)),this._advance();break;case z.lbrace:{if(++this._depth>1e3)throw new T(`PostScript function: procedures are nested too deeply.`);this._advance();let e=this._parseBlock();if(this._expect(z.rbrace),this._token.id===z.if)this._advance(),t.push(new _s(e));else{if(this._token.id!==z.lbrace)throw new T(`PostScript function: a procedure block must be followed by 'if' or '{…} ifelse'.`);{this._advance();let n=this._parseBlock();this._expect(z.rbrace),this._expect(z.ifelse),t.push(new vs(e,n))}}this._depth--;break}case z.rbrace:case z.eof:return new ms(t);case z.if:case z.ifelse:throw new T(`PostScript function: unexpected '${n.value}' operator.`);default:if(e._isRegularOperator(n.id)){t.push(new gs(n.id)),this._advance();break}throw new T(`PostScript function: unexpected token id ${n.id}.`)}}}};function Ts(e){return new ws(new ds(e)).parse()}var Es=class e{static#e=null;static#t=null;static#n=null;static#r=null;static#i(){this.#e=/* @__PURE__ */ new Set([z.add,z.sub,z.mul,z.div,z.idiv,z.mod,z.exp,z.atan,z.eq,z.ne,z.gt,z.ge,z.lt,z.le,z.and,z.or,z.xor,z.bitshift]),this.#t=/* @__PURE__ */ new Set([z.abs,z.neg,z.ceiling,z.floor,z.round,z.truncate,z.sqrt,z.sin,z.cos,z.ln,z.log,z.cvi,z.cvr,z.not]),this.#n=/* @__PURE__ */ new Set([z.abs,z.ceiling,z.cvi,z.cvr,z.floor,z.round,z.truncate]),this.#r=/* @__PURE__ */ new Map([[z.eq,z.ne],[z.ne,z.eq],[z.lt,z.ge],[z.le,z.gt],[z.gt,z.le],[z.ge,z.lt]])}evaluate(t,n){if(e.#e||e.#i(),this._failed=!1,this._work=0,this._forkDepth=0,n>100)return null;let r=[];for(let e=0;e<n;e++)r.push(new ys(e));return this._evalBlock(t.body,r),this._failed?null:(e.#a(r),r)}static#a(e){let t=/* @__PURE__ */ new Map,n=e=>{if(!e||e.type===6||e.type===7)return;let r=t.get(e)??0;if(t.set(e,r+1),!(r>0))switch(e.type){case 8:n(e.operand);break;case 9:n(e.first),n(e.second);break;case 10:n(e.cond),n(e.then),n(e.otherwise)}};for(let t of e)n(t);for(let[e,n]of t)n>1&&(e.shared=!0,e.sharedCount=n)}_evalBlock(e,t){this._evalBlockFrom(e.instructions,0,t)}_evalBlockFrom(e,t,n){for(let r=t;r<e.length&&!this._failed&&this._checkWorkLimit();r++){let t=e[r];switch(t.type){case 2:n.push(new bs(t.value)),n.length>100&&(this._failed=!0);break;case 3:this._evalOp(t.op,n);break;case 4:{if(n.length<1){this._failed=!0;break}let i=n.pop(),a=n.slice();if(this._evalBlock(t.then,n),this._fail Line truncated
`),D(),b.initialized?(b.hasEOL=!0,ye()):y.items.push({str:``,dir:`ltr`,width:0,height:0,transform:le(),fontName:M.loadedName,hasEOL:!0})}function ve(e,t,n){if(n*b.spaceInFlowMin<=e&&e<=n*b.spaceInFlowMax)return b.initialized&&(D(),b.str.push(` `),p?.addExtraChar(` `)),!1;let r=b.fontName,i=0;return b.vertical&&(i=e,e=0),ye(),D(),ce({width:Math.abs(e),height:Math.abs(i),transform:t||le(),fontName:r}),!0}function ye(){b.initialized&&b.str&&(b.vertical?b.totalHeight+=b.height*b.textAdvanceScale:b.totalWidth+=b.width*b.textAdvanceScale,y.items.push(fe(b)),b.initialized=!1,b.str.length=0)}function be(e=0){if(a&&!(_<=e))for(ye();_>e;_--)y.items.push({type:`endMarkedContent`})}function xe(e=!1){let t=y.items.length;t!==0&&!(e&&t<10)&&(o.enqueue(y,t),y.items=[],y.styles=Object.create(null))}let Se=new Ic;return new Promise(function e(r,f){let p=function(t){xe(!0),Promise.all([t,o.ready]).then(function(){try{e(r,f)}catch(e){f(e)}},f)};t.ensureNotTerminated(),Se.reset();let m={},b,x,S,C=[];for(;!(b=Se.check())&&(C.length=0,m.args=C,oe.read(m));){M=i.state,se||=M.clone();let e=m.fn;switch(C=m.args,0|e){case 37:let e=C[0].name,r=C[1];if(M.font&&e===M.fontName&&r===M.fontSize)break;M.fontName=e,M.fontSize=r,p(pe(e,null));return;case 39:M.textRise=C[0];break;case 35:M.textHScale=C[0]/100;break;case 36:M.leading=C[0];break;case 40:M.translateTextLineMatrix(C[0],C[1]),M.textMatrix=M.textLineMatrix.slice();break;case 41:M.leading=-C[1],M.translateTextLineMatrix(C[0],C[1]),M.textMatrix=M.textLineMatrix.slice();break;case 43:M.carriageReturn();break;case 42:M.setTextMatrix(C[0],C[1],C[2],C[3],C[4],C[5]),M.setTextLineMatrix(C[0],C[1],C[2],C[3],C[4],C[5]),de();break;case 33:M.charSpacing=C[0];break;case 34:M.wordSpacing=C[0];break;case 31:M.textMatrix=Oe.slice(),M.textLineMatrix=Oe.slice(),v=_;break;case 32:v!==null&&(be(v),v=null);break;case 45:if(!i.state.font){O.ensureStateFont(i.state);continue}let f=(M.font.vertical?1:-1)*M.fontSize/1e3;for(let e of C[0])if(typeof e==`string`)j.push(e);else if(typeof e==`number`&&e!==0){let t=j.join(``);j.length=0,ge({chars:t,extraSpacing:e*f})}if(j.length>0){let e=j.join(``);j.length=0,ge({chars:e,extraSpacing:0})}break;case 44:if(!i.state.font){O.ensureStateFont(i.state);continue}ge({chars:C[0],extraSpacing:0});break;case 46:if(!i.state.font){O.ensureStateFont(i.state);continue}M.carriageReturn(),ge({chars:C[0],extraSpacing:0});break;case 47:if(!i.state.font){O.ensureStateFont(i.state);continue}M.wordSpacing=C[0],M.charSpacing=C[1],M.carriageReturn(),ge({chars:C[2],extraSpacing:0});break;case 66:if(ye(),ee??=n.get(`XObject`)||P.empty,S=C[0]instanceof N,x=C[0].name,S&&ie.getByName(x))break;p(new Promise(function(e,r){if(!S)throw new T(`XObject must be referred to by name.`);let f=ee.getRaw(x);if(f instanceof F){if(ie.getByRef(f)||O.globalImageCache.getData(f,O.pageIndex)){e();return}f=k.fetch(f)}if(!(f instanceof L))throw new T(`XObject should be a stream`);let{dict:p}=f,m=p.get(`Subtype`);if(!(m instanceof N))throw new T(`XObject should have a Name subtype`);if(m.name!==`Form`){ie.set(x,p.objId,!0),e();return}let h=new zc(i.state.clone()),_=We(p.getArray(`Matrix`),null);_&&h.transform(_);let v=p.get(`Resources`);xe();let y=ec(o);O.getTextContent({stream:f,task:t,resources:v instanceof P?v:n,stateManager:h,includeMarkedContent:a,sink:y,seenStyles:s,viewBox:c,lang:l,disableNormalization:u,keepWhiteSpace:d,prevRefs:g}).then(function(){y.enqueueInvoked||ie.set(x,p.objId,!0),e()},r)}).catch(e=>{if(!(e instanceof E)){if(!O.options.ignoreErrors)throw e;h(`getTextContent - ignoring XObject: "${e}".`)}}));return;case 9:if(S=C[0]instanceof N,x=C[0].name,S&&ae.getByName(x))break;p(new Promise(function(e,t){if(!S)throw new T(`GState must be referred to by name.`);let r=n.get(`ExtGState`);if(!(r instanceof P))throw new T(`ExtGState should be a dictionary.`);let i=r.get(x);if(!(i instanceof P))throw new T(`GState should be a dictionary.`);let a=i.get(`Font`);a?(ye(),M.fontName=null,M.fontSize=a[1],pe(null,a[0]).then(e,t)):(ae.set(x,i.objId,!0),e())}).catch(e=>{if(!(e instanceof E)){if(!O.options.ignoreErrors)throw e;h(`getTextContent - ignoring ExtGState: "${e}".`)}}));return;case 69:ye(),a&&(_++,y.items.push({type:`beginMarkedContent`,tag:C[0]instanceof N?C[0].name:null}));break;case 70:if(ye(),a){_++;let e=C[1]instanceof P?C[1].get(`MCID`):null;y.items.push({type:`beginMarkedContentProps`,id:Number.isInteger(e)?`${O.idFactory.getPageObjId()}_mc${e}`:null,tag:C[0]instanceof N?C[0].name:null})}break;case 71:if(ye(),a){if(_===0)break;_--,y.items.push({type:`endMarkedContent`})}}if(y.items.length>=o.desiredSize){b=!0;break}}b?p(Mc):(ye(),be(),xe(),r())}).catch(e=>{if(!(e instanceof E)){if(!this.options.ignoreErrors)throw e;h(`getTextContent - ignoring errors during "${t.name}" task: "${e}".`),ye(),be(),xe()}})}async extractDataStructures(e,t){let n=this.xref,r,i=this.readToUnicode(t.toUnicode);if(t.composite){let n=e.get(`CIDSystemInfo`);n instanceof P&&!t.cidSystemInfo&&(t.cidSystemInfo={registry:R(n. Line truncated
`),T=new P(this.xref);if(T.setIfName(`Subtype`,`Form`),T.setIfName(`Type`,`XObject`),T.set(`BBox`,[0,0,p,m]),T.set(`Length`,w.length),T.set(`Resources`,S),n){let e=lt(n,p,m);T.set(`Matrix`,e)}return new Wt(w,T)}};const Jc=[`m/d`,`m/d/yy`,`mm/dd/yy`,`mm/yy`,`d-mmm`,`d-mmm-yy`,`dd-mmm-yy`,`yy-mm-dd`,`mmm-yy`,`mmmm-yy`,`mmm d, yyyy`,`mmmm d, yyyy`,`m/d/yy h:MM tt`,`m/d/yy HH:MM`],Yc=[`HH:MM`,`h:MM tt`,`HH:MM:ss`,`h:MM:ss tt`];var Xc=class{constructor(e,t,n){this.root=e,this.xref=t,this._type=n}getAll(e=!1){let t=/* @__PURE__ */ new Map;if(!this.root)return t;let n=this.xref,r=new me;this.root instanceof F&&r.put(this.root);let i=[this.root];for(let a of i){let o=n.fetchIfRef(a);if(!(o instanceof P))continue;if(o.has(`Kids`)){let e=o.get(`Kids`);if(!Array.isArray(e))continue;for(let t of e){if(t instanceof F){if(r.has(t))throw new T(`Duplicate entry in "${this._type}" tree.`);r.put(t)}i.push(t)}continue}let s=o.get(this._type);if(Array.isArray(s))for(let r=0,i=s.length;r<i;r+=2)t.set(e?s[r]:n.fetchIfRef(s[r]),e?s[r+1]:n.fetchIfRef(s[r+1]))}return t}getRaw(e){if(!this.root)return null;let t=this.xref,n=t.fetchIfRef(this.root),r=0;for(;n.has(`Kids`);){if(++r>10)return h(`Search depth limit reached for "${this._type}" tree.`),null;let i=n.get(`Kids`);if(!Array.isArray(i))return null;let a=0,o=i.length-1;for(;a<=o;){let r=a+o>>1,s=t.fetchIfRef(i[r]),c=s.get(`Limits`);if(e<t.fetchIfRef(c[0]))o=r-1;else{if(!(e>t.fetchIfRef(c[1]))){n=s;break}a=r+1}}if(a>o)return null}let i=n.get(this._type);if(Array.isArray(i)){let n=0,r=i.length-2;for(;n<=r;){let a=n+r>>1,o=a+(1&a),s=t.fetchIfRef(i[o]);if(e<s)r=o-2;else{if(!(e>s))return i[o+1];n=o+2}}}return null}get(e){return this.xref.fetchIfRef(this.getRaw(e))}},Zc=class extends Xc{constructor(e,t){super(e,t,`Names`)}},Qc=class extends Xc{constructor(e,t){super(e,t,`Nums`)}};function $c(){(function(){go?.clear()})(),(function(){le.clear(),ue.clear(),de.clear()})(),(function(){Ur.clear()})(),Hn.cleanup()}var el=class e{constructor(e){e instanceof P&&(this.root=e,e.has(`RF`)&&h(`Related file specifications are not supported`))}get filename(){let t=e.pickPlatformItem(this.root);return t&&typeof t==`string`?R(t,!0).replaceAll(`\\\\`,`\\`).replaceAll(`\\/`,`/`).replaceAll(`\\`,`/`):``}get description(){let e=this.root?.get(`Desc`);return e&&typeof e==`string`?R(e):``}get serializable(){let{filename:e,description:t}=this;return{rawFilename:e,filename:(n=e,n.substring(n.lastIndexOf(`/`)+1)||`unnamed`),description:t};var n}static pickPlatformItem(e,t=!1){if(e instanceof P){for(let n of[`UF`,`F`,`Unix`,`Mac`,`DOS`])if(e.has(n))return t?e.getRaw(n):e.get(n)}return null}static hasEmbeddedFile(e){return this.pickPlatformItem(e.get(`EF`))instanceof L}static readContent(e){if(!(e instanceof P))return null;let t=this.pickPlatformItem(e.get(`EF`));return t instanceof L?this.readStreamContent(t):(h(`Embedded file specification points to non-existing/invalid content`),null)}static readStreamContent(e){if(e.dict?.xref?.encrypt?.encryptionKey===null)throw new x(`No password given`,1);return e.getBytes()}};function tl(e,t){let n=e[t];return n===` `||n===`
`||n===`\r`||n===` `}var nl=class e{static get _entityRegex(){return y(this,`_entityRegex`,/&(?:#x([^;&]+)|#([^;&]+)|([^;&]+));/g)}_resolveEntities(t){return t.replaceAll(e._entityRegex,(e,t,n,r)=>{if(t||n){let r=t?parseInt(t,16):parseInt(n,10);return r>=0&&r<=1114111?String.fromCodePoint(r):e}switch(r){case`lt`:return`<`;case`gt`:return`>`;case`amp`:return`&`;case`quot`:return`"`;case`apos`:return`'`}return this.onResolveEntity(r)})}_parseContent(e,t){let n=[],r=t;function i(){for(;r<e.length&&tl(e,r);)++r}for(;r<e.length&&!tl(e,r)&&e[r]!==`>`&&e[r]!==`/`;)++r;let a=e.substring(t,r);for(i();r<e.length&&e[r]!==`>`&&e[r]!==`/`&&e[r]!==`?`;){i();let t=``,a=``;for(;r<e.length&&!tl(e,r)&&e[r]!==`=`;)t+=e[r],++r;if(i(),e[r]!==`=`)return null;++r,i();let o=e[r];if(o!==`"`&&o!==`'`)return null;let s=e.indexOf(o,++r);if(s<0)return null;a=e.substring(r,s),n.push({name:t,value:this._resolveEntities(a)}),r=s+1,i()}return{name:a,attributes:n,parsed:r-t}}_parseProcessingInstruction(e,t){let n=t;for(;n<e.length&&!tl(e,n)&&e[n]!==`>`&&e[n]!==`?`&&e[n]!==`/`;)++n;let r=e.substring(t,n);(function(){for(;n<e.length&&tl(e,n);)++n})();let i=n;for(;n<e.length&&(e[n]!==`?`||e[n+1]!==`>`);)++n;return{name:r,value:e.substring(i,n),parsed:n-t}}parseXml(e){let t=0;for(;t<e.length;){let n=t;if(e[t]===`<`){++n;let t;switch(e[n]){case`/`:if(++n,t=e.indexOf(`>`,n),t<0){this.onError(-9);return}this.onEndElement(e.substring(n,t)),n=t+1;break;case`?`:++n;let r=this._parseProcessingInstruction(e,n);if(e.substring(n+r.parsed,n+r.parsed+2)!==`?>`){this.onError(-3);return}this.onPi(r.name,r.value),n+=r.parsed+2;break;case`!`:if(e.substring(n+1,n+3)===`--`){if(t=e.indexOf(`-->`,n+3),t<0){this.onError(-5);return}this.onComment(e.substring(n+3,t)),n=t+3}else if(e.substring(n+1,n+8)===`[CDATA[`){if(t=e.indexOf(`]]>`,n+8),t<0){this.onError(-2);return}this.onCdata(e.substring(n+8,t)),n=t+3}else{if(e.substring(n+1,n+8)!==`DOCTYPE`){this.onError(-6);return}{let r=e.indexOf(`[`,n+8),i=!1;if(t=e.indexOf(`>`,n+8),t<0){this.onError(-4);return}if(r>0&&t>r){if(t=e.indexOf(`]>`,n+8),t<0){this.onError(-4);return}i=!0}let a=e.substring(n+8,t+ +!!i);this.onDoctype(a),n=t+(i?2:1)}}break;default:let i=this._parseContent(e,n);if(i===null){this.onError(-6);return}let a=!1;if(e.substring(n+i.parsed,n+i.parsed+2)===`/>`)a=!0;else if(e.substring(n+i.parsed,n+i.parsed+1)!==`>`){this.onError(-9);return}this.onBeginElement(i.name,i.attributes,a),n+=i.parsed+(a?2:1)}}else{for(;n<e.length&&e[n]!==`<`;)n++;let r=e.substring(t,n);this.onText(this._resolveEntities(r))}t=n}}onResolveEntity(e){return`&${e};`}onPi(e,t){}onComment(e){}onCdata(e){}onDoctype(e){}onText(e){}onBeginElement(e,t,n){}onEndElement(e){}onError(e){}},rl=class{constructor(e,t){this.nodeName=e,this.nodeValue=t,Object.defineProperty(this,"parentNode",{value:null,writable:!0})}get firstChild(){return this.childNodes?.[0]}get nextSibling(){let e=this.parentNode.childNodes;if(!e)return;let t=e.indexOf(this);return t===-1?void 0:e[t+1]}get textContent(){return this.childNodes?this.childNodes.map(e=>e.textContent).join(``):this.nodeValue||``}get children(){return this.childNodes||[]}hasChildNodes(){return this.childNodes?.length>0}searchNode(e,t){if(t>=e.length)return this;let n=e[t];if(n.name.startsWith(`#`)&&t<e.length-1)return this.searchNode(e,t+1);let r=[],i=this;for(;;){if(n.name===i.nodeName){if(n.pos!==0){if(r.length===0)return null;{let[a]=r.pop(),o=0;for(let r of a.childNodes)if(n.name===r.nodeName){if(o===n.pos)return r.searchNode(e,t+1);o++}return i.searchNode(e,t+1)}}{let n=i.searchNode(e,t+1);if(n!==null)return n}}if(i.childNodes?.length>0)r.push([i,0]),i=i.childNodes[0];else{if(r.length===0)return null;for(;r.length!==0;){let[e,t]=r.pop(),n=t+1;if(n<e.childNodes.length){r.push([e,n]),i=e.childNodes[n];break}}if(r.length===0)return null}}}dump(e){if(this.nodeName!==`#text`){if(e.push(`<${this.nodeName}`),this.attributes)for(let t of this.attributes)e.push(` ${t.name}="${tt(t.value)}"`);if(this.hasChildNodes()){e.push(`>`);for(let t of this.childNodes)t.dump(e);e.push(`</${this.nodeName}>`)}else this.nodeValue?e.push(`>${tt(this.nodeValue)}</${this.nodeName}>`):e.push(`/>`)}else e.push(tt(this.nodeValue))}},il=class extends nl{constructor({hasAttributes:e=!1,lowerCaseName:t=!1}){super(),this._currentFragment=null,this._stack=null,this._errorCode=0,this._hasAttributes=e,this._lowerCaseName=t}parseFromString(e){if(this._currentFragment=[],this._stack=[],this._errorCode=0,this.parseXml(e),this._errorCode!==0)return;let[t]=this._currentFragment;return t?{documentElement:t}:void 0}onText(e){if(function(e){for(let t=0,n=e.length;t<n;t++)if(!tl(e,t))return!1;return!0}(e))return;let t=new rl(`#text`,e);this._currentFragment.push(t)}onCdata(e){let t=new rl(`#text`,e);this._currentFragment.push(t)}onBeginElement(e,t,n){this._lowerCaseName&&(e=e.toLowerCase());let r=new rl(e);r.childNodes=[],this._hasAttributes&&(r.attributes=t),this._currentFragment.push(r),n||(this._stack.push(this._currentFragment),this._cur Line truncated
`,!0])}this.glyphs.pop()}else{for(let t of e.split(/[\u2029\n]/)){for(let e of t.split(``))this.glyphs.push([n,1.2*n,n,e,!1]);this.glyphs.push([0,0,0,`
`,!0])}this.glyphs.pop()}}compute(e){let t=-1,n=0,r=0,i=0,a=0,o=0,s=!1,c=!0;for(let l=0,u=this.glyphs.length;l<u;l++){let[u,d,f,p,m]=this.glyphs[l],h=p===` `,g=c?f:d;m?(r=Math.max(r,a),a=0,i+=o,o=g,t=-1,n=0,c=!1):h?a+u>e?(r=Math.max(r,a),a=0,i+=o,o=g,t=-1,n=0,s=!0,c=!1):(o=Math.max(g,o),n=a,a+=u,t=l):a+u>e?(i+=o,o=g,t===-1?(r=Math.max(r,a),a=u):(l=t,r=Math.max(r,n),a=0,t=-1,n=0),s=!0,c=!1):(a+=u,o=Math.max(g,o))}return r=Math.max(r,a),i+=o+this.extraHeight,{width:1.02*r,height:i,isBroken:s}}};const Ju=/^[^.[]+/,Yu=/^[^\]]+/,Xu=/* @__PURE__ */ new Map([[`$data`,(e,t)=>e.datasets?e.datasets.data:e],[`$record`,(e,t)=>(e.datasets?e.datasets.data:e)[Kl]()[0]],[`$template`,(e,t)=>e.template],[`$connectionSet`,(e,t)=>e.connectionSet],[`$form`,(e,t)=>e.form],[`$layout`,(e,t)=>e.layout],[`$host`,(e,t)=>e.host],[`$dataWindow`,(e,t)=>e.dataWindow],[`$event`,(e,t)=>e.event],[`!`,(e,t)=>e.datasets],[`$xfa`,(e,t)=>e],[`xfa`,(e,t)=>e],[`$`,(e,t)=>t]]),Zu=/* @__PURE__ */ new WeakMap;function Qu(e){return(e=e.trim())===`*`?1/0:parseInt(e,10)||0}function $u(e,t,n=!0){let r=e.match(Ju);if(!r)return null;let[i]=r,a=[{name:i,cacheName:`.`+i,index:0,js:null,formCalc:null,operator:0}],o=i.length;for(;o<e.length;){let s=o;if(e.charAt(o++)===`[`){if(r=e.slice(o).match(Yu),!r)return h(`XFA - Invalid index in SOM expression`),null;a.at(-1).index=Qu(r[0]),o+=r[0].length+1;continue}let c;switch(e.charAt(o)){case`.`:if(!t)return null;o++,c=1;break;case`#`:o++,c=2;break;case`[`:if(n)return h(`XFA - SOM expression contains a FormCalc subexpression which is not supported for now.`),null;c=3;break;case`(`:if(n)return h(`XFA - SOM expression contains a JavaScript subexpression which is not supported for now.`),null;c=4;break;default:c=0}if(r=e.slice(o).match(Ju),!r)break;[i]=r,o+=i.length,a.push({name:i,cacheName:e.slice(s,o),operator:c,index:0,js:null,formCalc:null})}return a}function ed(e,t,n,r=!0,i=!0){let a=$u(n,r);if(!a)return null;let o=Xu.get(a[0].name),s,c=0;o?(s=!0,e=[o(e,t)],c=1):(s=t===null,e=[t||e]);for(let n=a.length;c<n;c++){let{name:n,cacheName:r,operator:o,index:l}=a[c],u=[];for(let t of e){if(!t.isXFAObject)continue;let e,a;if(i&&(a=Zu.getOrInsertComputed(t,ae),e=a.get(r)),!e){switch(o){case 0:e=t[Vl](n,!1);break;case 1:e=t[Vl](n,!0);break;case 2:e=t[Bl](n),e=e.isXFAObjectArray?e.children:[e]}i&&a.set(r,e)}e.length>0&&u.push(e)}if(u.length===0&&!s&&c===0){if(!(t=t[H]()))return null;c=-1,e=[t]}else e=isFinite(l)?u.filter(e=>l<e.length).map(e=>e[l]):u.flat()}return e.length===0?null:e}function td(e,t,n){let r=$u(n);if(!r||r.some(e=>e.operator===1))return null;let i=Xu.get(r[0].name),a=0;i?(e=i(e,t),a=1):e=t||e;for(let t=r.length;a<t;a++){let{name:t,operator:n,index:i}=r[a];if(!isFinite(i))return r[a].index=0,e.createNodes(r.slice(a));let o;switch(n){case 0:o=e[Vl](t,!1);break;case 1:o=e[Vl](t,!0);break;case 2:o=e[Bl](t),o=o.isXFAObjectArray?o.children:[o]}if(o.length===0)return e.createNodes(r.slice(a));if(!(i<o.length))return r[a].index=i-o.length,e.createNodes(r.slice(a));{let t=o[i];if(!t.isXFAObject)return h(`XFA - Cannot create a node.`),null;e=t}}return null}const nd=Symbol(),rd=Symbol(),id=Symbol(),ad=Symbol(`_children`),od=Symbol(),sd=Symbol(),cd=Symbol(),ld=Symbol(),ud=Symbol(),dd=Symbol(),fd=Symbol(),pd=Symbol(),md=Symbol(),hd=Symbol(`parent`),gd=Symbol(),_d=Symbol(),vd=Symbol();let yd=0;const bd=Fu.datasets.id;var J=class e{constructor(e,t,n=!1){this[fu]=e,this[pu]=t,this[fd]=n,this[hd]=null,this[ad]=[],this[Nu]=`${t}${yd++}`,this[Zl]=null}get isXFAObject(){return!0}get isXFAObjectArray(){return!1}createNodes(e){let t=this,n=null;for(let{name:r,index:i}of e){for(let e=0,a=isFinite(i)?i:0;e<=a;e++)n=new Sd(t[fu]===bd?-1:t[fu],r),t[El](n);t=n}return n}[hu](e){if(!this[fd]||!this[gu](e))return!1;let t=e[pu],n=this[t];if(!(n instanceof Y))return n!==null&&this[xu](n),this[t]=e,this[El](e),!0;if(n.push(e))return this[El](e),!0;let r=``;return this.id?r=` (id: ${this.id})`:this.name&&(r=` (name: ${this.name} ${this.h.value})`),h(`XFA - node "${this[pu]}"${r} has already enough "${t}"!`),!1}[gu](e){return Object.hasOwn(this,e[pu])&&e[fu]===this[fu]}[ou](){return!1}[wl](){return!1}[nu](){return!1}[ru](){return!1}[yu](){this.para&&this[Xl]()[V].paraStack.pop()}[bu](){this[Xl]()[V].paraStack.push(this.para)}[Tu](e){this.id&&this[fu]===Fu.template.id&&e.set(this.id,this)}[Xl](){return this[Zl].template}[su](){return!1}[cu](){return!1}[El](e){e[hd]=this,this[ad].push(e),!e[Zl]&&this[Zl]&&(e[Zl]=this[Zl])}[xu](e){let t=this[ad].indexOf(e);this[ad].splice(t,1)}[Ql](){return Object.hasOwn(this,`value`)}[Du](e){}[_u](e){}[Fl](){}[Ol](e){delete this[fd],this[Al]&&(e.clean(this[Al]),delete this[Al])}[eu](e){return this[ad].indexOf(e)}[tu](e,t){t[hd]=this,this[ad].splice(e,0,t),!t[Zl]&&this[Zl]&&(t[Zl]=this[Zl])}[lu](){return!this.name}[du](){return``}[ku](){return this[ad].length===0?this[B]:this[ad].map(e=>e[ku]()).join(``)}get[id](){let t=Object.getPrototypeOf(this);if(!t._attributes){let n=t._attributes=/* @__PURE__ */ new Set;fo Line truncated
`,`
`))}[Wl](){return typeof this[B]==`string`?this[B].split(/[\u2029\u2028\n]/).filter(Boolean).join(`
`):this[B][ku]()}[U](e){if(typeof this[B]==`string`){let e=cf(this[B]).html;return this[B].includes(`\u2029`)?(e.name=`div`,e.children=[],this[B].split(`\u2029`).map(e=>e.split(/[\u2028\n]/).flatMap(e=>[{name:`span`,value:e},{name:`br`}])).forEach(t=>{e.children.push({name:`p`,children:t})})):/[\u2028\n]/.test(this[B])&&(e.name=`div`,e.children=[],this[B].split(/[\u2028\n]/).forEach(t=>{e.children.push({name:`span`,value:t},{name:`br`})})),q.success(e)}return this[B][U](e)}},cm=class extends J{constructor(e){super(Z,`textEdit`,!0),this.allowRichText=W({data:e.allowRichText,defaultValue:0,validate:e=>e===1}),this.hScrollPolicy=G(e.hScrollPolicy,[`auto`,`off`,`on`]),this.id=e.id||``,this.multiLine=W({data:e.multiLine,defaultValue:``,validate:e=>e===0||e===1}),this.use=e.use||``,this.usehref=e.usehref||``,this.vScrollPolicy=G(e.vScrollPolicy,[`auto`,`off`,`on`]),this.border=null,this.comb=null,this.extras=null,this.margin=null}[U](e){let t=Id(this,`border`,`font`,`margin`),n,r=this[H]()[H]();return this.multiLine===``&&(this.multiLine=+(r instanceof Kf)),n=this.multiLine===1?{name:`textarea`,attributes:{dataId:r[Nl]?.[Nu]||r[Nu],fieldId:r[Nu],class:[`xfaTextfield`],style:t,"aria-label":sf(r),"aria-required":!1}}:{name:`input`,attributes:{type:`text`,dataId:r[Nl]?.[Nu]||r[Nu],fieldId:r[Nu],class:[`xfaTextfield`],style:t,"aria-label":sf(r),"aria-required":!1}},rf(r)&&(n.attributes[`aria-required`]=!0,n.attributes.required=!0),q.success({name:`label`,attributes:{class:[`xfaLabel`]},children:[n]})}},lm=class extends Td{constructor(e){super(Z,`time`),this.id=e.id||``,this.name=e.name||``,this.use=e.use||``,this.usehref=e.usehref||``}[Fl](){let e=this[B].trim();this[B]=e?new Date(e):null}[U](e){return cf(this[B]?this[B].toString():``)}},um=class extends J{constructor(e){super(Z,`timeStamp`),this.id=e.id||``,this.server=e.server||``,this.type=G(e.type,[`optional`,`required`]),this.use=e.use||``,this.usehref=e.usehref||``}},dm=class extends Td{constructor(e){super(Z,`toolTip`),this.id=e.id||``,this.rid=e.rid||``,this.use=e.use||``,this.usehref=e.usehref||``}},fm=class extends J{constructor(e){super(Z,`traversal`,!0),this.id=e.id||``,this.use=e.use||``,this.usehref=e.usehref||``,this.extras=null,this.traverse=new Y}},pm=class extends J{constructor(e){super(Z,`traverse`,!0),this.id=e.id||``,this.operation=G(e.operation,[`next`,`back`,`down`,`first`,`left`,`right`,`up`]),this.ref=e.ref||``,this.use=e.use||``,this.usehref=e.usehref||``,this.extras=null,this.script=null}get name(){return this.operation}[lu](){return!1}},mm=class extends J{constructor(e){super(Z,`ui`,!0),this.id=e.id||``,this.use=e.use||``,this.usehref=e.usehref||``,this.extras=null,this.picture=null,this.barcode=null,this.button=null,this.checkButton=null,this.choiceList=null,this.dateTimeEdit=null,this.defaultUi=null,this.imageEdit=null,this.numericEdit=null,this.passwordEdit=null,this.signature=null,this.textEdit=null}[Wl](){if(this[V]===void 0){for(let e of Object.getOwnPropertyNames(this)){if(e===`extras`||e===`picture`)continue;let t=this[e];if(t instanceof J)return this[V]=t,t}this[V]=null}return this[V]}[U](e){let t=this[Wl]();return t?t[U](e):q.EMPTY}},hm=class extends J{constructor(e){super(Z,`validate`,!0),this.formatTest=G(e.formatTest,[`warning`,`disabled`,`error`]),this.id=e.id||``,this.nullTest=G(e.nullTest,[`disabled`,`error`,`warning`]),this.scriptTest=G(e.scriptTest,[`error`,`disabled`,`warning`]),this.use=e.use||``,this.usehref=e.usehref||``,this.extras=null,this.message=null,this.picture=null,this.script=null}},gm=class extends J{constructor(e){super(Z,`value`,!0),this.id=e.id||``,this.override=W({data:e.override,defaultValue:0,validate:e=>e===1}),this.relevant=Hu(e.relevant),this.use=e.use||``,this.usehref=e.usehref||``,this.arc=null,this.boolean=null,this.date=null,this.dateTime=null,this.decimal=null,this.exData=null,this.float=null,this.image=null,this.integer=null,this.line=null,this.rectangle=null,this.text=null,this.time=null}[Du](e){let t=this[H]();if(t instanceof sp&&t.ui?.imageEdit){this.image||(this.image=new hp({}),this[El](this.image)),this.image[B]=e[B];return}let n=e[pu];if(this[n]===null){for(let e of Object.getOwnPropertyNames(this)){let t=this[e];t instanceof J&&(this[e]=null,this[xu](t))}this[e[pu]]=e,this[El](e)}else this[n][B]=e[B]}[ku](){if(this.exData)return typeof this.exData[B]==`string`?this.exData[B].trim():this.exData[B][ku]().trim();for(let e of Object.getOwnPropertyNames(this)){if(e===`image`)continue;let t=this[e];if(t instanceof J)return(t[B]||``).toString().trim()}return null}[U](e){for(let t of Object.getOwnPropertyNames(this)){let n=this[t];if(n instanceof J)return n[U](e)}return q.EMPTY}},_m=class extends J{constructor(e){super(Z,`variables`,!0),this.id=e.id||``,this.use=e.use||``,this.usehref=e.usehref||``,this.boolean=new Y,this.date=new Y,this.dateTime=new Y,this.decimal=new Y,this.exData=new Y,this.float=new Y,this.image=new Y,this.integer=new Y,this.manifest=new Y,this.script=new Y,this.text=new Line truncated
`);e[Du](bm(n))}else this._isConsumeData()&&h(`XFA - Nodes haven't the same type.`)}else!t[iu]()||this._isMatchTemplate()?this._bindElement(e,t):h(`XFA - Nodes haven't the same type.`)}_findDataByNameToConsume(e,t,n,r){if(!e)return null;let i,a;for(let r=0;r<3;r++){for(i=n[Gl](e,!1,!0);a=i.next().value,a;)if(t===a[iu]())return a;if(n[fu]===ym&&n[pu]===`data`)break;n=n[H]()}return r?(i=this.data[Gl](e,!0,!1),a=i.next().value,a||(i=this.data[Ll](e,!0),a=i.next().value,a?.[iu]()?a:null)):null}_setProperties(e,t){if(Object.hasOwn(e,`setProperty`))for(let{ref:n,target:r,connection:i}of e.setProperty.children){if(i||!n)continue;let a=ed(this.root,t,n,!1,!1);if(!a){h(`XFA - Invalid reference: ${n}.`);continue}let[o]=a;if(!o[au](this.data)){h(`XFA - Invalid node: must be a data node.`);continue}let s=ed(this.root,e,r,!1,!1);if(!s){h(`XFA - Invalid target: ${r}.`);continue}let[c]=s;if(!c[au](e)){h(`XFA - Invalid target: must be a property or subproperty.`);continue}let l=c[H]();if(c instanceof Jp||l instanceof Jp){h(`XFA - Invalid target: cannot be a setProperty or one of its properties.`);continue}if(c instanceof yf||l instanceof yf){h(`XFA - Invalid target: cannot be a bindItems or one of its properties.`);continue}let u=o[ku](),d=c[pu];if(c instanceof xd){let e=Object.create(null);e[d]=u,l[d]=Reflect.construct(Object.getPrototypeOf(l).constructor,[e])[d]}else Object.hasOwn(c,B)?(c[Nl]=o,c[B]=u,c[Fl]()):h(`XFA - Invalid node to use in setProperty`)}}_bindItems(e,t){if(!Object.hasOwn(e,`items`)||!Object.hasOwn(e,`bindItems`)||e.bindItems.isEmpty())return;for(let t of e.items.children)e[xu](t);e.items.clear();let n=new yp({}),r=new yp({});e[El](n),e.items.push(n),e[El](r),e.items.push(r);for(let{ref:i,labelRef:a,valueRef:o,connection:s}of e.bindItems.children){if(s||!i)continue;let e=ed(this.root,t,i,!1,!1);if(e)for(let t of e){if(!t[au](this.datasets)){h(`XFA - Invalid ref (${i}): must be a datasets child.`);continue}let e=ed(this.root,t,a,!0,!1);if(!e){h(`XFA - Invalid label: ${a}.`);continue}let[s]=e;if(!s[au](this.datasets)){h(`XFA - Invalid label: must be a datasets child.`);continue}let c=ed(this.root,t,o,!0,!1);if(!c){h(`XFA - Invalid value: ${o}.`);continue}let[l]=c;if(!l[au](this.datasets)){h(`XFA - Invalid value: must be a datasets child.`);continue}let u=bm(s[ku]()),d=bm(l[ku]());n[El](u),n.text.push(u),r[El](d),r.text.push(d)}else h(`XFA - Invalid reference: ${i}.`)}}_bindOccurrences(e,t,n){let r;if(t.length>1&&(r=e[jl](),r[xu](r.occur),r.occur=null),this._bindValue(e,t[0],n),this._setProperties(e,t[0]),this._bindItems(e,t[0]),t.length===1)return;let i=e[H](),a=e[pu],o=i[eu](e);for(let e=1,s=t.length;e<s;e++){let s=t[e],c=r[jl]();i[a].push(c),i[tu](o+e,c),this._bindValue(c,s,n),this._setProperties(c,s),this._bindItems(c,s)}}_createOccurrences(e){if(!this.emptyMerge)return;let{occur:t}=e;if(!t||t.initial<=1)return;let n=e[H](),r=e[pu];if(!(n[r]instanceof Y))return;let i;i=e.name?n[r].children.filter(t=>t.name===e.name).length:n[r].children.length;let a=n[eu](e)+1,o=t.initial-i;if(o){let t=e[jl]();t[xu](t.occur),t.occur=null,n[r].push(t),n[tu](a,t);for(let e=1;e<o;e++){let i=t[jl]();n[r].push(i),n[tu](a+e,i)}}}_getOccurInfo(e){let{name:t,occur:n}=e;if(!n||!t)return[1,1];let r=n.max===-1?1/0:n.max;return[n.min,r]}_setAndBind(e,t){this._setProperties(e,t),this._bindItems(e,t),this._bindElement(e,t)}_bindElement(e,t){let n=[];this._createOccurrences(e);for(let r of e[Kl]()){if(r[Nl])continue;if(this._mergeMode===void 0&&r[pu]===`subform`){this._mergeMode=r.mergeMode===`consumeData`;let e=t[Kl]();if(e.length>0)this._bindOccurrences(r,[e[0]],null);else if(this.emptyMerge){let e=t[fu]===ym?-1:t[fu],n=r[Nl]=new Sd(e,r.name||`root`);t[El](n),this._bindElement(r,n)}continue}if(!r[ru]())continue;let e=!1,i=null,a=null,o=null;if(r.bind){switch(r.bind.match){case`none`:this._setAndBind(r,t);continue;case`global`:e=!0;break;case`dataRef`:if(!r.bind.ref){h(`XFA - ref is empty in node ${r[pu]}.`),this._setAndBind(r,t);continue}a=r.bind.ref}r.bind.picture&&(i=r.bind.picture[B])}let[s,c]=this._getOccurInfo(r);if(a){if(o=ed(this.root,t,a,!0,!1),o===null){if(o=td(this.data,t,a),!o)continue;this._isConsumeData()&&(o[Ml]=!0),this._setAndBind(r,o);continue}this._isConsumeData()&&(o=o.filter(e=>!e[Ml])),o.length>c?o=o.slice(0,c):o.length===0&&(o=null),o&&this._isConsumeData()&&o.forEach(e=>{e[Ml]=!0})}else{if(!r.name){this._setAndBind(r,t);continue}if(this._isConsumeData()){let n=[];for(;n.length<c;){let i=this._findDataByNameToConsume(r.name,r[Ql](),t,e);if(!i)break;i[Ml]=!0,n.push(i)}o=n.length>0?n:null}else{if(o=t[Gl](r.name,!1,this.emptyMerge).next().value,!o){if(s===0){n.push(r);continue}let e=t[fu]===ym?-1:t[fu];o=r[Nl]=new Sd(e,r.name),this.emptyMerge&&(o[Ml]=!0),t[El](o),this._setAndBind(r,o);continue}this.emptyMerge&&(o[Ml]=!0),o=[o]}}o?this._bindOccurrences(r,o,i):s>0?this._setAndBind(r,t):n.push(r)}n.forEach(e=>e[H]()[xu](e))}},Sm=class{constructor(e,t){this.data=t,this.dataset=e.datasets||null}serialize(e){let t=[[- Line truncated
`):void 0:this[B]||void 0,q.success({name:this[pu],attributes:{href:this.href,style:sv(this.style,this,this[tv])},children:t,value:n})}},uv=class extends lv{constructor(e){super(e,`a`),this.href=Wd(e.href)||``}},dv=class extends lv{constructor(e){super(e,`b`)}[vu](e){e.pushFont({weight:`bold`}),super[vu](e),e.popFont()}},fv=class extends lv{constructor(e){super(e,`body`)}[U](e){let t=super[U](e),{html:n}=t;return n?(n.name=`div`,n.attributes.class=[`xfaRich`],t):q.EMPTY}},pv=class extends lv{constructor(e){super(e,`br`)}[ku](){return`
`}[vu](e){e.addString(`
`)}[U](e){return q.success({name:`br`})}},mv=class extends lv{constructor(e){super(e,`html`)}[U](e){let t=[];if(this[V]={children:t},this[Dl]({}),t.length===0)return q.success({name:`div`,attributes:{class:[`xfaRich`],style:{}},value:this[B]||``});if(t.length===1){let e=t[0];if(e.attributes?.class.includes(`xfaRich`))return q.success(e)}return q.success({name:`div`,attributes:{class:[`xfaRich`],style:{}},children:t})}},hv=class extends lv{constructor(e){super(e,`i`)}[vu](e){e.pushFont({posture:`italic`}),super[vu](e),e.popFont()}},gv=class extends lv{constructor(e){super(e,`li`)}},_v=class extends lv{constructor(e){super(e,`ol`)}},vv=class extends lv{constructor(e){super(e,`p`)}[vu](e){super[vu](e,!1),e.addString(`
`),e.addPara(),e.popFont()}[ku](){return this[H]()[Kl]().at(-1)===this?super[ku]():super[ku]()+`
`}},yv=class extends lv{constructor(e){super(e,`span`)}},bv=class extends lv{constructor(e){super(e,`sub`)}},xv=class extends lv{constructor(e){super(e,`sup`)}},Sv=class extends lv{constructor(e){super(e,`ul`)}},Cv=class e{static[Pu](t,n){return Object.hasOwn(e,t)?e[t](n):void 0}static a(e){return new uv(e)}static b(e){return new dv(e)}static body(e){return new fv(e)}static br(e){return new pv(e)}static html(e){return new mv(e)}static i(e){return new hv(e)}static li(e){return new gv(e)}static ol(e){return new _v(e)}static p(e){return new vv(e)}static span(e){return new yv(e)}static sub(e){return new bv(e)}static sup(e){return new xv(e)}static ul(e){return new Sv(e)}};const wv={config:e_,connection:m_,datasets:v_,localeSet:W_,signature:q_,stylesheet:X_,template:vm,xdp:$_,xhtml:Cv};var Tv=class{constructor(e){this.namespaceId=e}[Pu](e,t){return new Sd(this.namespaceId,e,t)}},Ev=class extends J{constructor(e){super(-1,`root`,Object.create(null)),this.element=null,this[$l]=e}[hu](e){return this.element=e,!0}[Fl](){super[Fl](),this.element.template instanceof om&&(this[$l].set(Su,this.element),this.element.template[Cu](this[$l]),this.element.template[$l]=this[$l])}},Dv=class extends J{constructor(){super(-1,``,Object.create(null))}[hu](e){return!1}},Ov=class{constructor(e=null){this._namespaceStack=[],this._nsAgnosticLevel=0,this._namespacePrefixes=/* @__PURE__ */ new Map,this._namespaces=/* @__PURE__ */ new Map,this._nextNsId=Math.max(...Object.values(Fu).map(({id:e})=>e)),this._currentNamespace=e||new Tv(++this._nextNsId)}buildRoot(e){return new Ev(e)}build({nsPrefix:e,name:t,attributes:n,namespace:r,prefixes:i}){let a=r!==null;if(a&&(this._namespaceStack.push(this._currentNamespace),this._currentNamespace=this._searchNamespace(r)),i&&this._addNamespacePrefix(i),Object.hasOwn(n,mu)){let e=wv.datasets,t=n[mu],r=null;for(let[n,i]of Object.entries(t))if(this._getNamespaceToUse(n)===e){r={xfa:i};break}r?n[mu]=r:delete n[mu]}let o=this._getNamespaceToUse(e)?.[Pu](t,n)||new Dv;return o[ou]()&&this._nsAgnosticLevel++,(a||i||o[ou]())&&(o[Al]={hasNamespace:a,prefixes:i,nsAgnostic:o[ou]()}),o}isNsAgnostic(){return this._nsAgnosticLevel>0}_searchNamespace(e){let t=this._namespaces.get(e);if(t)return t;for(let[n,{check:r}]of Object.entries(Fu))if(r(e)){if(t=wv[n],t)return this._namespaces.set(e,t),t;break}return t=new Tv(++this._nextNsId),this._namespaces.set(e,t),t}_addNamespacePrefix(e){for(let{prefix:t,value:n}of e){let e=this._searchNamespace(n);this._namespacePrefixes.getOrInsertComputed(t,ie).push(e)}}_getNamespaceToUse(e){if(!e)return this._currentNamespace;let t=this._namespacePrefixes.get(e);return t?.length>0?t.at(-1):(h(`Unknown namespace prefix: ${e}.`),null)}clean(e){let{hasNamespace:t,prefixes:n,nsAgnostic:r}=e;t&&(this._currentNamespace=this._namespaceStack.pop()),n?.forEach(({prefix:e})=>{this._namespacePrefixes.get(e).pop()}),r&&this._nsAgnosticLevel--}},kv=class e extends nl{constructor(e=null,t=!1){super(),this._builder=new Ov(e),this._stack=[],this._globalData={usedTypefaces:/* @__PURE__ */ new Set},this._ids=/* @__PURE__ */ new Map,this._current=this._builder.buildRoot(this._ids),this._errorCode=0,this._whiteRegex=/^\s+$/,this._nbsps=/\xa0+/g,this._richText=t}parse(e){if(this.parseXml(e),this._errorCode===0)return this._current[Fl](),this._current.element}onText(e){e=e.replace(this._nbsps,e=>e.slice(1)+` `),this._richText||this._current[wl]()?this._current[_u](e,this._richText):this._whiteRegex.test(e)||this._current[_u](e.trim())}onCdata(e){this._current[_u](e)}_mkAttributes(e,t){let n=null,r=null,i=Object.create({});for(let{name:a,value:o}of e)if(a===`xmlns`)n?h(`XFA - multiple namespace definition in <${t}>`):n=o;else if(a.startsWith(`xmlns:`)){let e=a.substring(6);r??=[],r.push({prefix:e,value:o})}else{let e=a.indexOf(`:`);if(e===-1)i[a]=o;else{let t=i[mu]??=Object.create(null),[n,r]=[a.slice(0,e),a.slice(e+1)];(t[n]||=Object.create(null))[r]=o}}return[n,r,i]}_getNameAndPrefix(e,t){let n=e.indexOf(`:`);return n===-1?[e,null]:[e.substring(n+1),t?``:e.substring(0,n)]}onBeginElement(e,t,n){let[r,i,a]=this._mkAttributes(t,e),[o,s]=this._getNameAndPrefix(e,this._builder.isNsAgnostic()),c=this._builder.build({nsPrefix:s,name:o,attributes:a,namespace:r,prefixes:i});c[Zl]=this._globalData,n?(c[Fl](),this._current[hu](c)&&c[Tu](this._ids),c[Ol](this._builder)):(this._stack.push(this._current),this._current=c)}onEndElement(t){let n=this._current;if(n[nu]()&&typeof n[B]==`string`){let t=new e;t._globalData=this._globalData;let r=t.parse(n[B]);n[B]=null,n[hu](r)}n[Fl](),this._current=this._stack.pop(),this._current[hu](n)&&n[Tu](this._ids),n[Ol](this._builder)}onError(e){this._errorCode=e}},Av=class e{constructor(t){try{this.root=new kv().parse(e._createDocument(t));let n=new xm(this.root);this.form=n.bind(),this.dataHandler=new Sm(this.root,n.getData()),this.form[Zl].template=this.form}catch(e){h(`XFA - an error occurred during parsing and binding: ${e}`)}}isValid(){return!(!this.root||!this.form)}_createPa Line truncated
`);return`/Tx BMC q ${h}BT `+e+` 1 0 0 1 0 ${ot(a)} Tm ${g} ET Q EMC`}_splitLine(e,t,n,r,i,a={}){e=a.line||e;let o=a.glyphs||t.charsToGlyphs(e);if(o.length<=1)return[e];let s=n/1e3;if(Math.sumPrecise(o.map(e=>e.width))*s<=i)return[e];let c=a.positions||t.getCharPositions(e),l=[],u=-1,d=-1,f=-1,p=0,m=0;for(let t=0,n=o.length;t<n;t++){let[n,i]=c[t],a=o[t],h=a.width*s;a.unicode===` `?m+h>r?(l.push(e.substring(p,n)),p=n,m=h,u=-1,f=-1):(m+=h,u=n,d=i,f=t):m+h>r?u===-1?(l.push(e.substring(p,n)),p=n,m=h):(l.push(e.substring(p,d)),p=d,t=f+1,u=-1,m=0):m+=h}return p<e.length&&l.push(e.substring(p)),l}async extractTextContent(e,t,n){await super.extractTextContent(e,t,n);let r=this.data.textContent;if(!r)return;let i=r.join(`
`);if(i===this.data.fieldValue)return;let a=i.replaceAll(/([.*+?^${}()|[\]\\])|(\s+)/g,(e,t)=>t?`\\${t}`:`\\s+`);RegExp(`^\\s*${a}\\s*$`).test(this.data.fieldValue)&&(this.data.textContent=this.data.fieldValue.split(`
`))}getFieldObject(){return{id:this.data.id,value:this.data.fieldValue,defaultValue:this.data.defaultFieldValue||``,multiline:this.data.multiLine,password:this.data.password,charLimit:this.data.maxLen,comb:this.data.comb,editable:!this.data.readOnly,hidden:this.data.hidden,name:this.data.fieldName,rect:this.data.rect,actions:this.data.actions,page:this.data.pageIndex,strokeColor:this.data.borderColor,fillColor:this.data.backgroundColor,rotation:this.rotation,datetimeFormat:this.data.datetimeFormat,hasDatetimeHTML:!!this.data.datetimeType,type:`text`}}},Hv=class extends Bv{constructor(e){super(e),this.checkedAppearance=null,this.uncheckedAppearance=null;let t=this.hasFieldFlag(32768),n=this.hasFieldFlag(65536);this.data.checkBox=!t&&!n,this.data.radioButton=t&&!n,this.data.pushButton=n,this.data.isTooltipOnly=!1,this.data.hasOwnCanvas=!0,this.data.noHTML=!1,this.data.checkBox?this._processCheckBox(e):this.data.radioButton?this._processRadioButton(e):this.data.pushButton?this._processPushButton(e):h(`Invalid field flags for button widget annotation`)}get _ownCanvasRequiresForms(){return this.data.checkBox||this.data.radioButton}#e(e,t,n,r,i,a){if(!a)return this._getOperatorListNoAppearance();let o=this.appearance,s=We(a.dict.getArray(`Matrix`),Oe);i&&a.dict.set(`Matrix`,this.getRotationMatrix(r)),this.appearance=a;let c=super.getOperatorList(e,t,n,r);return this.appearance=o,a.dict.set(`Matrix`,s),c}async getOperatorList(e,t,n,r){if(this.data.pushButton)return super.getOperatorList(e,t,n,!1,r);if(n&2&&n&16&&(this.data.checkBox||this.data.radioButton)){let i=(e,t)=>{let n=e.fnArray.indexOf(80);n!==-1&&e.argsArray[n].push(t)},a=await this.#e(e,t,n,r,null,this.checkedAppearance);i(a.opList,`checked`);let o=await this.#e(e,t,n,r,null,this.uncheckedAppearance);return i(o.opList,`unchecked`),a.opList.addOpList(o.opList),a.separateForm||=o.separateForm,a.separateCanvas||=o.separateCanvas,a}let i=null,a=null;if(r){let e=r.get(this.data.id);i=e?e.value:null,a=e?e.rotation:null}return i===null&&this.appearance?super.getOperatorList(e,t,n,r):(i??=this.data.checkBox?this.data.fieldValue===this.data.exportValue:this.data.fieldValue===this.data.buttonValue,this.#e(e,t,n,r,a,i?this.checkedAppearance:this.uncheckedAppearance))}async save(e,t,n,r){this.data.checkBox?this._saveCheckbox(e,t,n,r):this.data.radioButton&&this._saveRadioButton(e,t,n,r)}async _saveCheckbox(e,t,n,r){if(!n)return;let i=n.get(this.data.id),a=this._buildFlags(i?.noView,i?.noPrint),o=i?.rotation,s=i?.value;if(o===void 0&&a===void 0&&(s===void 0||this.data.fieldValue===this.data.exportValue===s))return;let c=e.xref.fetchIfRef(this.ref);if(!(c instanceof P))return;c=c.clone(),o===void 0&&(o=this.rotation),s===void 0&&(s=this.data.fieldValue===this.data.exportValue);let l={path:this.data.fieldName,value:s?this.data.exportValue:``},u=N.get(s?this._onStateName:`Off`);this.setValue(c,u,e.xref,r),c.set(`AS`,u),c.set(`M`,`D:${ct()}`),a!==void 0&&c.set(`F`,a),this._setMKDict(c,o),r.put(this.ref,{data:c,xfa:l,needAppearances:!1})}async _saveRadioButton(e,t,n,r){if(!n)return;let i=n.get(this.data.id),a=this._buildFlags(i?.noView,i?.noPrint),o=i?.rotation,s=i?.value;if(o===void 0&&a===void 0&&(s===void 0||this.data.fieldValue===this.data.buttonValue===s))return;let c=e.xref.fetchIfRef(this.ref);if(!(c instanceof P))return;c=c.clone(),s===void 0&&(s=this.data.fieldValue===this.data.buttonValue),o===void 0&&(o=this.rotation);let l={path:this.data.fieldName,value:s?this.data.buttonValue:``},u=N.get(s?this._onStateName:`Off`);s&&this.setValue(c,u,e.xref,r),c.set(`AS`,u),c.set(`M`,`D:${ct()}`),a!==void 0&&c.set(`F`,a),this._setMKDict(c,o),r.put(this.ref,{data:c,xfa:l,needAppearances:!1})}#t(e){let t=Pr[e.charCodeAt(0)];return fa().ZapfDingbats()[t]}#n(e){let t=e.get(`MK`),n=t instanceof P?t.get(`CA`):null;if(typeof n!=`string`)return null;let r=R(n)[0];return r&&this.#t(r)?r:null}#r(e,t,n,r){this._needAppearances&&(this.appearance=null,t=n=null);let i=t instanceof L,a=this.#n(e.dict)??r;this.checkedAppearance=i?t:this.#i(e.xref,a,!0),this.uncheckedAppearance=n instanceof L?n:null,i||(this.uncheckedAppearance??=this.#i(e.xref,a,!1));for(let e of[this.checkedAppearance,this.uncheckedAppearance])e&&this._streams.push(e)}#i(e,t,n){let{rotation:r}=this,[i,a]=r%180==0?[this.width,this.height]:[this.height,this.width],o=this.data.radioButton&&t===`l`,s=this.getBorderAndBackgroundAppearances(null,o);if(n){let{fontColor:e,fontSize:n}=this.data.defaultAppearanceData,r=n||Math.min(i,a)*.8,o=ot((i-this.#t(t)/1e3*r)/2),c=ot((a-.705*r)/2);s+=`BT /PdfJsZaDb ${r} Tf ${Kc(e,!0)} ${o} ${c} Td (${Ye(t)}) Tj ET`}else if(!s)return null;s=`q ${s} Q`;let c=new P(e);c.set(`FormType`,1),c.setIfName(`Subtype`,`Form`),c.setIfName(`Type`,`XObject`),c.set(`BBox`,[0,0,i,a]),c.set(`Matrix`,this.getRotationMatrix()),c.set(`Length`,s.length);let l=new P(e),u=new P(e);return u.set(`PdfJsZaDb`,this.fallbackFontDict),l.set(`Font`,u),c.set(`Resources`,l),new Wt(s,c)}_getOnStateName(e){let t=e.get(`AP`);if( Line truncated
`)}},Wv=class extends Bv{_hasValueFromXFA=!1;constructor(e){super(e),this.data.fieldValue=null,this.data.hasOwnCanvas=this.data.noRotate,this.data.noHTML=!this.data.hasOwnCanvas}getFieldObject(){return{id:this.data.id,value:null,page:this.data.pageIndex,type:`signature`}}},Gv=class extends zv{constructor(e){super(e),this.data.noRotate=!0,this.data.hasOwnCanvas=this.data.noRotate,this.data.noHTML=!1;let{dict:t}=e;this.data.hasAppearance?this.data.name=`NoIcon`:(this.data.rect[1]=this.data.rect[3]-22,this.data.rect[2]=this.data.rect[0]+22,this.data.name=t.has(`Name`)?t.get(`Name`).name:`Note`),t.has(`State`)?(this.data.state=t.get(`State`)||null,this.data.stateModel=t.get(`StateModel`)||null):(this.data.state=null,this.data.stateModel=null)}},Kv=class extends Lv{constructor(e){super(e);let{dict:t,annotationGlobals:n}=e;this.data.noHTML=!1;let r=Pv(t,this.rectangle);r&&(this.data.quadPoints=r),this.data.borderColor||=this.data.color,hl.parseDestDictionary({destDict:t,resultObj:this.data,docBaseUrl:n.baseUrl,docAttachments:n.attachments})}get overlaysTextContent(){return!0}},qv=class extends Lv{constructor(e){super(e);let{dict:t}=e;this.data.noHTML=!1,this.width!==0&&this.height!==0||(this.data.rect=null);let n=t.get(`Parent`);if(!n)h(`Popup annotation has a missing or invalid parent annotation.`);else{if(this.data.parentRect=Ke(n.getArray(`Rect`),null),this.data.creationDate=n.get(`CreationDate`)||``,I(n.get(`RT`),l)&&(n=n.get(`IRT`)),n.has(`M`)?(this.setModificationDate(n.get(`M`)),this.data.modificationDate=this.modificationDate):this.data.modificationDate=null,n.has(`C`)?(this.setColor(n.getArray(`C`)),this.data.color=this.color):this.data.color=null,!this.viewable){let e=n.get(`F`);this._isViewable(e)&&this.setFlags(e)}this.setTitle(n.get(`T`)),this.data.titleObj=this._title,this.setContents(n.get(`Contents`)),this.data.contentsObj=this._contents,n.has(`RC`)&&(this.data.richText=Av.getRichTextAsHtml(n.get(`RC`))),this.data.open=!!t.get(`Open`)}}static createNewDict(e,t,n){let{oldAnnotation:r,rect:i,parent:a}=e,o=r||new P(t);return o.setIfNotExists(`Type`,N.get(`Annot`)),o.setIfNotExists(`Subtype`,N.get(`Popup`)),o.setIfNotExists(`Open`,!1),o.setIfArray(`Rect`,i),o.set(`Parent`,a),o}static async createNewAppearanceStream(e,t,n){return null}},Jv=class extends zv{constructor(e){super(e),this.data.hasOwnCanvas=this.data.noRotate,this.data.isEditable=!this.data.noHTML,this.data.noHTML=!1;let{annotationGlobals:t,xref:n}=e;if(this.setDefaultAppearance(e),this._hasAppearance=!!this.appearance,this._hasAppearance){let{fontColor:e,fontSize:r}=function(e,t,n){return new Gc(e,t,n).parse()}(this.appearance,n,t.globalColorSpaceCache);this.data.defaultAppearanceData.fontColor=e,this.data.defaultAppearanceData.fontSize=r||10}else{this.data.defaultAppearanceData.fontSize||=10;let{fontColor:t,fontSize:r}=this.data.defaultAppearanceData;if(this._contents.str){this.data.textContent=this._contents.str.split(/\r\n?|\n/).map(e=>e.trimEnd());let{coords:e,bbox:t,matrix:n}=qc.getFirstPositionInfo(this.rectangle,this.rotation,r);this.data.textPosition=this._transformPoint(e,t,n)}if(this._isOffscreenCanvasSupported){let i=e.dict.get(`CA`),a=new qc(n,`sans-serif`);this.appearance=a.createAppearance(this._contents.str,this.rectangle,this.rotation,r,t,i),this._streams.push(this.appearance)}else h(`FreeTextAnnotation: OffscreenCanvas is not supported, annotation may not render correctly.`)}}get hasTextContent(){return this._hasAppearance}static createNewDict(e,t,{apRef:n,ap:r}){let{color:i,date:a,fontSize:o,oldAnnotation:s,rect:c,rotation:l,user:u,value:d}=e,f=s||new P(t);f.setIfNotExists(`Type`,N.get(`Annot`)),f.setIfNotExists(`Subtype`,N.get(`FreeText`)),f.set(s?`M`:`CreationDate`,`D:${ct(a)}`),s&&f.delete(`RC`),f.setIfArray(`Rect`,c);let p=`/Helv ${o} Tf ${Kc(i,!0)}`;if(f.set(`DA`,p),f.setIfDefined(`Contents`,xe(d)),f.setIfNotExists(`F`,4),f.setIfNotExists(`Border`,[0,0,0]),f.setIfNumber(`Rotate`,l),f.setIfDefined(`T`,xe(u)),n||r){let e=new P(t);f.set(`AP`,e),e.set(`N`,n||r)}return f}static getPrintData({color:e,fontSize:t,rect:n,rotation:r,value:i}){throw Error(`Not implemented: getPrintData`)}static async createNewAppearanceStream(e,t,n){let{baseFontRef:r,evaluator:i,task:a}=n,{color:o,fontSize:s,rect:c,rotation:l,value:u}=e;if(!o)return null;let d=new P(t),f=new P(t);if(r)f.set(`Helv`,r);else{let e=new P(t);e.setIfName(`BaseFont`,`Helvetica`),e.setIfName(`Type`,`Font`),e.setIfName(`Subtype`,`Type1`),e.setIfName(`Encoding`,`WinAnsiEncoding`),f.set(`Helv`,e)}d.set(`Font`,f);let p=await Bv._getFontData(i,a,{fontName:`Helv`,fontSize:s},d),[m,h,g,_]=c,v=g-m,y=_-h;l%180!=0&&([v,y]=[y,v]);let b=u.split(`
`),x=s/1e3,S=-1/0,C=[];for(let e of b){let t=p.encodeString(e);if(t.length>1)return null;e=t.join(``),C.push(e);let n=0,r=p.charsToGlyphs(e);for(let e of r)n+=e.width*x;S=Math.max(S,n)}let w=S>v?v/S:1,T=1,E=1.35*s,D=1*s,O=E*b.length;O>y&&(T=y/O);let k=s*Math.min(w,T),A,j,ee;switch(l){case 0:ee=[1,0,0,1],j=[c[0],c[1],v,y],A=[c[0],c[3]-D];break;case 90:ee=[0,1,-1,0],j=[c[1],-c[2],v,y],A=[c[1],-c[0]-D];break;case 180:ee=[-1,0,0,-1],j=[-c[2],-c[3],v,y],A=[-c[2],-c[1]-D];break;case 270:ee=[0,-1,1,0],j=[-c[3],c[0],v,y],A=[-c[3],c[2]-D]}let te=[`q`,`${ee.join(` `)} 0 0 cm`,`${j.join(` `)} re W n`,`BT`,`${Kc(o,!0)}`,`0 Tc /Helv ${ot(k)} Tf`];te.push(`${A.join(` `)} Td (${Ye(C[0])}) Tj`);let ne=ot(E);for(let e=1,t=C.length;e<t;e++){let t=C[e];te.push(`0 -${ne} Td (${Ye(t)}) Tj`)}te.push(`ET`,`Q`);let re=te.join(`
`),ie=new P(t);return ie.set(`FormType`,1),ie.setIfName(`Subtype`,`Form`),ie.setIfName(`Type`,`XObject`),ie.set(`BBox`,c),ie.set(`Resources`,d),ie.set(`Matrix`,[1,0,0,1,-c[0],-c[1]]),new Wt(re,ie)}},Yv=class extends zv{constructor(e){super(e);let{dict:t,xref:n}=e;this.data.hasOwnCanvas=this.data.noRotate,this.data.noHTML=!1;let r=Ge(t.getArray(`L`),[0,0,0,0]);if(this.data.lineCoordinates=A.normalizeRect(r),this.setLineEndings(t.getArray(`LE`)),this.data.lineEndings=this.lineEndings,!this.appearance){let e=Nv(this.color,[0,0,0]),i=t.get(`CA`),a=Nv(Mv(t.getArray(`IC`),null)),o=a?i:null,s=this.borderStyle.width||1,c=2*s,l=[this.data.lineCoordinates[0]-c,this.data.lineCoordinates[1]-c,this.data.lineCoordinates[2]+c,this.data.lineCoordinates[3]+c];A.intersect(this.rectangle,l)||(this.rectangle=l),this._setDefaultAppearance({xref:n,extra:`${s} w`,strokeColor:e,fillColor:a,strokeAlpha:i,fillAlpha:o,pointsCallback:(e,t)=>(e.push(`${r[0]} ${r[1]} m`,`${r[2]} ${r[3]} l`,`S`),[t[0]-s,t[7]-s,t[2]+s,t[3]+s])})}}},Xv=class extends zv{constructor(e){super(e);let{dict:t,xref:n}=e;if(this.data.hasOwnCanvas=this.data.noRotate,this.data.noHTML=!1,!this.appearance){let e=Nv(this.color,[0,0,0]),r=t.get(`CA`),i=Nv(Mv(t.getArray(`IC`),null)),a=i?r:null;if(this.borderStyle.width===0&&!i)return;this._setDefaultAppearance({xref:n,extra:`${this.borderStyle.width} w`,strokeColor:e,fillColor:i,strokeAlpha:r,fillAlpha:a,pointsCallback:(e,t)=>{let n=t[4]+this.borderStyle.width/2,r=t[5]+this.borderStyle.width/2,a=t[6]-t[4]-this.borderStyle.width,o=t[3]-t[7]-this.borderStyle.width;return e.push(`${n} ${r} ${a} ${o} re`),i?e.push(`B`):e.push(`S`),[t[0],t[7],t[2],t[3]]}})}}},Zv=class extends zv{constructor(e){super(e);let{dict:t,xref:n}=e;if(!this.appearance){let e=Nv(this.color,[0,0,0]),r=t.get(`CA`),i=Nv(Mv(t.getArray(`IC`),null)),a=i?r:null;if(this.borderStyle.width===0&&!i)return;let o=4/3*Math.tan(Math.PI/8);this._setDefaultAppearance({xref:n,extra:`${this.borderStyle.width} w`,strokeColor:e,fillColor:i,strokeAlpha:r,fillAlpha:a,pointsCallback:(e,t)=>{let n=t[0]+this.borderStyle.width/2,r=t[1]-this.borderStyle.width/2,a=t[6]-this.borderStyle.width/2,s=t[7]+this.borderStyle.width/2,c=n+(a-n)/2,l=r+(s-r)/2,u=(a-n)/2*o,d=(s-r)/2*o;return e.push(`${c} ${s} m`,`${c+u} ${s} ${a} ${l+d} ${a} ${l} c`,`${a} ${l-d} ${c+u} ${r} ${c} ${r} c`,`${c-u} ${r} ${n} ${l-d} ${n} ${l} c`,`${n} ${l+d} ${c-u} ${s} ${c} ${s} c`,`h`),i?e.push(`B`):e.push(`S`),[t[0],t[7],t[2],t[3]]}})}}},Qv=class extends zv{constructor(e){super(e);let{dict:n,xref:r}=e;this.data.hasOwnCanvas=this.data.noRotate,this.data.noHTML=!1,this.data.vertices=null,this instanceof $v||(this.setLineEndings(n.getArray(`LE`)),this.data.lineEndings=this.lineEndings);let i=n.getArray(`Vertices`);if(!Ue(i,null))return;let a=this.data.vertices=Float32Array.from(i);if(!this.appearance){let e=Nv(this.color,[0,0,0]),i=n.get(`CA`),o,s=Mv(n.getArray(`IC`),null);s&&=Nv(s),o=s?this.color?s.every((t,n)=>t===e[n])?`f`:`B`:`f`:`S`;let c=this.borderStyle.width||1,l=2*c,u=t.slice();for(let e=0,t=a.length;e<t;e+=2)A.rectBoundingBox(a[e]-l,a[e+1]-l,a[e]+l,a[e+1]+l,u);A.intersect(this.rectangle,u)||(this.rectangle=u),this._setDefaultAppearance({xref:r,extra:`${c} w`,strokeColor:e,strokeAlpha:i,fillColor:s,fillAlpha:s?i:null,pointsCallback:(e,t)=>{for(let t=0,n=a.length;t<n;t+=2)e.push(`${a[t]} ${a[t+1]} ${t===0?`m`:`l`}`);return e.push(o),[t[0],t[7],t[2],t[3]]}})}}},$v=class extends Qv{},ey=class extends zv{},ty=class extends zv{constructor(e){super(e),this.data.hasOwnCanvas=this.data.noRotate,this.data.noHTML=!1;let{dict:n,xref:r}=e;this.data.inkLists=[],this.data.isEditable=!this.data.noHTML,this.data.noHTML=!1,this.data.opacity=n.get(`CA`)||1;let i=n.getArray(`InkList`);if(Array.isArray(i)){for(let e of i){if(!Array.isArray(e))continue;let t=new Float32Array(e.length);this.data.inkLists.push(t);for(let n=0,i=e.length;n<i;n+=2){let i=r.fetchIfRef(e[n]),a=r.fetchIfRef(e[n+1]);typeof i==`number`&&typeof a==`number`&&(t[n]=i,t[n+1]=a)}}if(!this.appearance){let e=Nv(this.color,[0,0,0]),i=n.get(`CA`),a=this.borderStyle.width||1,o=2*a,s=t.slice();for(let e of this.data.inkLists)for(let t=0,n=e.length;t<n;t+=2)A.rectBoundingBox(e[t]-o,e[t+1]-o,e[t]+o,e[t+1]+o,s);A.intersect(this.rectangle,s)||(this.rectangle=s),this._setDefaultAppearance({xref:r,extra:`${a} w`,strokeColor:e,strokeAlpha:i,pointsCallback:(e,t)=>{for(let t of this.data.inkLists){for(let n=0,r=t.length;n<r;n+=2)e.push(`${t[n]} ${t[n+1]} ${n===0?`m`:`l`}`);e.push(`S`)}return[t[0],t[7],t[2],t[3]]}})}}}static createNewDict(e,t,{apRef:n,ap:r}){let{oldAnnotation:i,color:a,date:o,opacity:s,paths:c,outlines:l,rect:u,rotation:d,thickness:f,user:p}=e,m=i||new P(t);if(m.setIfNotExists(`Type`,N.get(`Annot`)),m.setIfNotExists(`Subtype`,N.get(`Ink`)),m.set(i?`M`:`CreationDate`,`D:${ct(o)}`),m.setIfArray(`Rect`,u),m.setIfArray(`InkList`,l?.points||c?.points),m.setIfNotExists(`F`,4),m.setIfNumber(`Rotate`,d),m.setIfDefined(`T`,xe(p)),l&&m.setIfName(`IT`,`InkHighlight`) Line truncated
`),u=new P(t);if(u.set(`FormType`,1),u.setIfName(`Subtype`,`Form`),u.setIfName(`Type`,`XObject`),u.set(`BBox`,i),u.set(`Length`,l.length),s!==1){let e=new P(t),n=new P(t),r=new P(t);r.set(`CA`,s),r.setIfName(`Type`,`ExtGState`),n.set(`R0`,r),e.set(`ExtGState`,n),u.set(`Resources`,e)}return new Wt(l,u)}static async createNewAppearanceStreamForHighlight(e,t,n){let{color:r,rect:i,outlines:{outline:a},opacity:o}=e;if(!r)return null;let s=[`${Kc(r,!0)}`,`/R0 gs`];Iv(a,s),s.push(`h f`);let c=s.join(`
`),l=new P(t);l.set(`FormType`,1),l.setIfName(`Subtype`,`Form`),l.setIfName(`Type`,`XObject`),l.set(`BBox`,i),l.set(`Length`,c.length);let u=new P(t),d=new P(t);u.set(`ExtGState`,d),l.set(`Resources`,u);let f=new P(t);return d.set(`R0`,f),f.setIfName(`BM`,`Multiply`),o!==1&&(f.set(`ca`,o),f.setIfName(`Type`,`ExtGState`)),new Wt(c,l)}},ny=class extends zv{constructor(e){super(e);let{dict:t,xref:n}=e;if(this.data.isEditable=!this.data.noHTML,this.data.noHTML=!1,this.data.opacity=t.get(`CA`)||1,this.data.quadPoints=Pv(t,null)){if(!this.appearance){let e=Nv(this.color,[1,1,0]),r=t.get(`CA`);this._setDefaultAppearance({xref:n,fillColor:e,blendMode:`Multiply`,fillAlpha:r,pointsCallback:(e,t)=>(e.push(`${t[0]} ${t[1]} m`,`${t[2]} ${t[3]} l`,`${t[6]} ${t[7]} l`,`${t[4]} ${t[5]} l`,`f`),[t[0],t[7],t[2],t[3]])})}}else this.data.popupRef=null}get overlaysTextContent(){return!0}static createNewDict(e,t,{apRef:n,ap:r}){let{color:i,date:a,oldAnnotation:o,opacity:s,rect:c,rotation:l,user:u,quadPoints:d}=e,f=o||new P(t);if(f.setIfNotExists(`Type`,N.get(`Annot`)),f.setIfNotExists(`Subtype`,N.get(`Highlight`)),f.set(o?`M`:`CreationDate`,`D:${ct(a)}`),f.setIfArray(`Rect`,c),f.setIfNotExists(`F`,4),f.setIfNotExists(`Border`,[0,0,0]),f.setIfNumber(`Rotate`,l),f.setIfArray(`QuadPoints`,d),f.setIfArray(`C`,Nv(i)),f.setIfNumber(`CA`,s),f.setIfDefined(`T`,xe(u)),n||r){let e=new P(t);f.set(`AP`,e),e.set(`N`,n||r)}return f}static async createNewAppearanceStream(e,t,n){let{color:r,rect:i,outlines:a,opacity:o}=e;if(!r)return null;let s=[`${Kc(r,!0)}`,`/R0 gs`],c=[];for(let e of a){c.length=0,c.push(`${ot(e[0])} ${ot(e[1])} m`);for(let t=2,n=e.length;t<n;t+=2)c.push(`${ot(e[t])} ${ot(e[t+1])} l`);c.push(`h`),s.push(c.join(`
`))}s.push(`f*`);let l=s.join(`
`),u=new P(t);u.set(`FormType`,1),u.setIfName(`Subtype`,`Form`),u.setIfName(`Type`,`XObject`),u.set(`BBox`,i),u.set(`Length`,l.length);let d=new P(t),f=new P(t);d.set(`ExtGState`,f),u.set(`Resources`,d);let p=new P(t);return f.set(`R0`,p),p.setIfName(`BM`,`Multiply`),o!==1&&(p.set(`ca`,o),p.setIfName(`Type`,`ExtGState`)),new Wt(l,u)}},ry=class extends zv{constructor(e){super(e);let{dict:t,xref:n}=e;if(this.data.quadPoints=Pv(t,null)){if(!this.appearance){let e=Nv(this.color,[0,0,0]),r=t.get(`CA`);this._setDefaultAppearance({xref:n,extra:`[] 0 d 0.571 w`,strokeColor:e,strokeAlpha:r,pointsCallback:(e,t)=>(e.push(`${t[4]} ${t[5]+1.3} m`,`${t[6]} ${t[7]+1.3} l`,`S`),[t[0],t[7],t[2],t[3]])})}}else this.data.popupRef=null}get overlaysTextContent(){return!0}},iy=class extends zv{constructor(e){super(e);let{dict:t,xref:n}=e;if(this.data.quadPoints=Pv(t,null)){if(!this.appearance){let e=Nv(this.color,[0,0,0]),r=t.get(`CA`);this._setDefaultAppearance({xref:n,extra:`[] 0 d 1 w`,strokeColor:e,strokeAlpha:r,pointsCallback:(e,t)=>{let n=(t[1]-t[5])/6,r=n,i=t[4],a=t[5],o=t[6];e.push(`${i} ${a+r} m`);do i+=2,r=r===0?n:0,e.push(`${i} ${a+r} l`);while(i<o);return e.push(`S`),[t[4],a-2*n,o,a+2*n]}})}}else this.data.popupRef=null}get overlaysTextContent(){return!0}},ay=class extends zv{constructor(e){super(e);let{dict:t,xref:n}=e;if(this.data.quadPoints=Pv(t,null)){if(!this.appearance){let e=Nv(this.color,[0,0,0]),r=t.get(`CA`);this._setDefaultAppearance({xref:n,extra:`[] 0 d 1 w`,strokeColor:e,strokeAlpha:r,pointsCallback:(e,t)=>(e.push((t[0]+t[4])/2+` `+(t[1]+t[5])/2+` m`,(t[2]+t[6])/2+` `+(t[3]+t[7])/2+` l`,`S`),[t[0],t[7],t[2],t[3]])})}}else this.data.popupRef=null}get overlaysTextContent(){return!0}},oy=class extends zv{#e=null;constructor(e){super(e),this.data.hasOwnCanvas=this.data.noRotate,this.data.isEditable=!this.data.noHTML,this.data.noHTML=!1}mustBeViewedWhenEditing(e,t=null){return e?(this.data.isEditable&&(this.#e??=this.data.hasOwnCanvas,this.data.hasOwnCanvas=!0),!0):(this.#e!==null&&(this.data.hasOwnCanvas=this.#e,this.#e=null),!t?.has(this.data.id))}static createNewDict(e,t,{apRef:n,ap:r}){let{date:i,oldAnnotation:a,rect:o,rotation:s,user:c}=e,l=a||new P(t);if(l.setIfNotExists(`Type`,N.get(`Annot`)),l.setIfNotExists(`Subtype`,N.get(`Stamp`)),l.set(a?`M`:`CreationDate`,`D:${ct(i)}`),l.setIfArray(`Rect`,o),l.setIfNotExists(`F`,4),l.setIfNotExists(`Border`,[0,0,0]),l.setIfNumber(`Rotate`,s),l.setIfDefined(`T`,xe(c)),n||r){let e=new P(t);l.set(`AP`,e),e.set(`N`,n||r)}return l}static async#t(e,t){let{areContours:n,color:r,rect:i,lines:a,thickness:o}=e;if(!r)return null;let s=[`${o} w 1 J 1 j`,`${Kc(r,n)}`];for(let e of a)Iv(e,s,!0);s.push(n?`F`:`S`);let c=s.join(`
`),l=new P(t);return l.set(`FormType`,1),l.setIfName(`Subtype`,`Form`),l.setIfName(`Type`,`XObject`),l.set(`BBox`,i),l.set(`Length`,c.length),new Wt(c,l)}static async createNewAppearanceStream(e,t,n){if(e.oldAnnotation)return null;if(e.isSignature)return this.#t(e,t);let{rotation:r}=e,{imageRef:i,width:a,height:o}=n.image,s=new P(t),c=new P(t);s.set(`XObject`,c),c.set(`Im0`,i);let l=`q ${a} 0 0 ${o} 0 0 cm /Im0 Do Q`,u=new P(t);if(u.set(`FormType`,1),u.setIfName(`Subtype`,`Form`),u.setIfName(`Type`,`XObject`),u.set(`BBox`,[0,0,a,o]),u.set(`Resources`,s),r){let e=lt(r,a,o);u.set(`Matrix`,e)}return new Wt(l,u)}},sy=class extends zv{constructor(e){super(e);let{annotationGlobals:t,dict:n}=e,r=n.get(`FS`);this.data.hasOwnCanvas=this.data.noRotate,this.data.noHTML=!1,this.data.fileId=this._getAttachmentId(r,n.getRaw(`FS`),t),this.data.file=new el(r).serializable;let i=n.get(`Name`);this.data.name=i instanceof N?R(i.name):`PushPin`;let a=n.get(`ca`);this.data.fillAlpha=typeof a==`number`&&a>=0&&a<=1?a:null}},cy=class e extends Lv{static#e=/^(?:video|audio)\/[a-z0-9][\w!#$&^.+-]{0,126}$/i;static#t=/^(?:video|audio)\/[a-z0-9][\w!#$&^.+-]{0,126}(?: *; *[a-z0-9][\w!#$&^.+-]{0,126} *= *(?:[-!#$%&'*+.^\x60{|}~\w]+|"(?:[\x20\x21\x23-\x5b\x5d-\x7e]|\\[\x20-\x7e])*"))* *$/i;constructor(e){super(e),this.data.noHTML=!0}_setMediaData({assetRef:e,assetDict:t,filename:n,contentType:r,wrapSound:i=!1},a){this.data.noHTML=!1,this.data.richMedia={fileId:this._getAttachmentId(t,e,a,i),filename:n,contentType:r}}static _getContentType(t,n,r=null,i=!1){if(typeof r==`string`&&(i?e.#e:e.#t).test(r))return r;let a=el.pickPlatformItem(t.get(`EF`)),o=a instanceof L?a.dict?.get(`Subtype`):null;if(o instanceof N&&e.#e.test(o.name))return o.name;let s=n.lastIndexOf(`.`)+1;switch(s>0&&n.substring(s).toLowerCase()){case`mp4`:case`m4v`:return`video/mp4`;case`webm`:return`video/webm`;case`ogv`:return`video/ogg`;case`mov`:return`video/quicktime`;case`mp3`:return`audio/mpeg`;case`m4a`:return`audio/mp4`;case`wav`:return`audio/wav`;case`oga`:case`ogg`:return`audio/ogg`;default:return null}}},ly=class e extends cy{constructor(t){super(t);let{dict:n,xref:r,annotationGlobals:i}=t,a=n.get(`RichMediaContent`);if(!(a instanceof P))return;let o=e.#e(a,r);o?this._setMediaData(o,i):h(`RichMedia annotation has no playable asset.`)}static#e(e,t){let n=e.get(`Configurations`);if(!Array.isArray(n))return null;for(let e of n){let n=t.fetchIfRef(e);if(!(n instanceof P))continue;let r=n.get(`Instances`);if(Array.isArray(r))for(let e of r){let n=t.fetchIfRef(e);if(!(n instanceof P)||I(n.get(`Subtype`),`Flash`))continue;let r=n.getRaw(`Asset`),i=t.fetchIfRef(r);if(!(i instanceof P)||!el.hasEmbeddedFile(i))continue;let{filename:a}=new el(i).serializable,o=cy._getContentType(i,a);if(o)return{assetRef:r instanceof F?r:null,assetDict:i,filename:a,contentType:o}}}return null}},uy=class e extends cy{constructor(t){super(t);let{dict:n,xref:r,annotationGlobals:i}=t,a=e.#e(n,r);a&&this._setMediaData(a,i)}static#e(e,t){for(let n of this.#t(e)){let e=this.#r(n.get(`R`),t,new me);if(e)return e}return null}static*#t(e){let t=e.get(`A`);this.#n(t)&&(yield t);let n=e.get(`AA`);if(n instanceof P)for(let[,e]of n)this.#n(e)&&(yield e)}static#n(e){if(!(e instanceof P&&I(e.get(`S`),`Rendition`)))return!1;let t=e.get(`OP`);return t===void 0||t===0||t===4}static#r(e,t,n){if(!(e instanceof P))return null;let r=e.get(`S`);if(I(r,`MR`))return this.#i(e.get(`C`),t);if(I(r,`SR`)){let r=e.get(`R`);if(Array.isArray(r))for(let e of r){if(e instanceof F){if(n.has(e))continue;n.put(e)}let r=this.#r(t.fetchIfRef(e),t,n);if(r)return r}}return null}static#i(e,t){if(!(e instanceof P&&I(e.get(`S`),`MCD`)))return null;let n=e.getRaw(`D`),r=t.fetchIfRef(n),i=e.get(`CT`),a,o,s=typeof i==`string`?i:null,c=!1;if(r instanceof L){a=r.dict;let t=e.get(`N`);if(o=typeof t==`string`?R(t):``,!s){let e=r.dict.get(`Subtype`);e instanceof N&&(s=e.name,c=!0)}}else{if(!(r instanceof P)||!el.hasEmbeddedFile(r))return null;a=r,{filename:o}=new el(r).serializable}let l=cy._getContentType(a,o,s,c);return l?{assetRef:n instanceof F?n:null,assetDict:a,filename:o,contentType:l}:null}},dy=class extends cy{constructor(e){super(e);let{dict:t,xref:n,annotationGlobals:r}=e,i=t.getRaw(`Sound`);if(!(i instanceof F))return;let a;try{a=n.fetch(i)}catch(e){if(e instanceof Me)throw e;h(`SoundAnnotation: "${e}".`);return}a instanceof L&&ol(a.dict)&&this._setMediaData({assetRef:i,assetDict:a.dict,filename:`sound.wav`,contentType:`audio/wav`,wrapSound:!0},r)}};const fy={get r(){return y(this,`r`,new Uint8Array([7,12,17,22,7,12,17,22,7,12,17,22,7,12,17,22,5,9,14,20,5,9,14,20,5,9,14,20,5,9,14,20,4,11,16,23,4,11,16,23,4,11,16,23,4,11,16,23,6,10,15,21,6,10,15,21,6,10,15,21,6,10,15,21]))},get k(){return y(this,`k`,new Int32Array([-680876936,-389564586,606105819,-1044525330,-176418897,1200080426,-1473231341,-45705983,1770035416,-1958414417,-42063,-1990404162,1804603682,-40341101,-1502002290,1236535329,-165796510,-1069501632,643717713,-373897302,-7 Line truncated
endobj
`)}async function fb(e,t,n){t.push(`<<`);for(let[r,i]of e.getRawEntries())t.push(` /${Je(r)} `),await pb(i,t,n);t.push(`>>`)}async function pb(e,t,n){e instanceof N?t.push(`/${Je(e.name)}`):e instanceof F?t.push(`${e.num} ${e.gen} R`):Array.isArray(e)||ArrayBuffer.isView(e)?await async function(e,t,n){t.push(`[`);for(let r=0,i=e.length;r<i;r++)await pb(e[r],t,n),r<i-1&&t.push(` `);t.push(`]`)}(e,t,n):typeof e==`string`?(n&&(e=n.encryptString(e)),t.push(`(${Ye(e)})`)):typeof e==`number`?t.push(function(e){if(Number.isInteger(e)&&Math.abs(e)>=1e21)return BigInt(e).toString();let t=e.toFixed(10),n=t.length;for(;t[n-1]===`0`;)n--;return t[n-1]===`.`&&n--,t.slice(0,n)}(e)):typeof e==`boolean`?t.push(e.toString()):e instanceof P?await fb(e,t,n):e instanceof L?await async function(e,t,n){(e=e.getOriginalStream()).reset();let r=e.getBytes(),{dict:i}=e,[a,o]=await Promise.all([i.getAsync(`Filter`),i.getAsync(`DecodeParms`)]),s=Array.isArray(a)?await Promise.all(a.map(e=>i.xref.fetchIfRefAsync(e))):[a],c=null,l=s.findIndex(e=>I(e,`Crypt`));if(l!==-1){if(n){let e=Array.isArray(o)?await i.xref.fetchIfRefAsync(o[l]):o,t=e instanceof P?e.get(`Name`):null;c=t instanceof N?t:N.get(`Identity`)}else s.splice(l,1),s.length===0?(a=o=void 0,i.delete(`Filter`),i.delete(`DecodeParms`)):(a=a.toSpliced(l,1),i.set(`Filter`,a),Array.isArray(o)&&(o=o.toSpliced(l,1),i.set(`DecodeParms`,o)))}let u=s[0],d=I(u,`FlateDecode`),f=I(u,`DCTDecode`)||I(u,`JPXDecode`)||I(u,`JBIG2Decode`)||I(u,`CCITTFaxDecode`)||I(u,`LZWDecode`);if(!(d||f||I(u,`BrotliDecode`))&&!c&&!_e(i,`Metadata`)&&r.length>=256)try{let e=new CompressionStream(`deflate`),t=e.writable.getWriter();await t.ready,t.write(r).then(async()=>{await t.ready,await t.close()}).catch(()=>{}),r=await new Response(e.readable).bytes();let n,s;a?d||(n=Array.isArray(a)?[N.get(`FlateDecode`),...a]:[N.get(`FlateDecode`),a],o&&(s=Array.isArray(o)?[null,...o]:[null,o])):n=N.get(`FlateDecode`),n&&i.set(`Filter`,n),s&&i.set(`DecodeParms`,s)}catch(e){m(`writeStream - cannot compress data: "${e}".`)}let p=D(r);n&&(p=n.encryptStream(p,i,c)),i.set(`Length`,p.length),await fb(i,t,n),t.push(` stream
`,p,`
endstream`)}(e,t,n):e===null?t.push(`null`):h(`Unhandled value in writer: ${typeof e}, please file a bug.`)}function mb(e,t,n,r){for(let i=t+n-1;i>n-1;i--)r[i]=255&e,e>>=8;return n+t}function hb(e,t,n){let r=e.length;for(let i=0;i<r;i++)n[t+i]=255&e.charCodeAt(i);return t+r}function gb({xfaData:e,xfaDatasetsRef:t,changes:n,xref:r}){e===null&&(e=function(e,t){let n=new il({hasAttributes:!0}).parseFromString(e);for(let{xfa:e}of t){if(!e)continue;let{path:t,value:r}=e;if(!t||r===null)continue;let i=qe(t),a=n.documentElement.searchNode(i,0);!a&&i.length>1&&(a=n.documentElement.searchNode([i.at(-1)],0)),a?a.childNodes=Array.isArray(r)?r.map(e=>new rl(`value`,e)):[new rl(`#text`,r)]:h(`Node not found for path: ${t}`)}let r=[];return n.documentElement.dump(r),r.join(``)}(r.fetchIfRef(t).getString(),n));let i=new Wt(e,new P(r));i.dict.setIfName(`Type`,`EmbeddedFile`),n.put(t,{data:i})}function _b(e){let t=[];for(let{ref:n}of e)n.num===t.at(-2)+t.at(-1)?t[t.length-1]+=1:t.push(n.num,1);return t}function vb(e,t,n){if(Array.isArray(t.fileIds)&&t.fileIds.length>0){let r=function(e,t){let n=Math.floor(Date.now()/1e3),r=t.filename||``,i=[n.toString(),r,e.toString(),...t.infoMap.values()],a=Math.sumPrecise(i.map(e=>e.length)),o=new Uint8Array(a),s=0;for(let e of i)s=hb(e,s,o);return D(py(o,0,o.length))}(e,t);n.set(`ID`,[t.fileIds[0]||r,r])}}async function yb({originalData:e,xrefInfo:t,changes:n,xref:r=null,hasXfa:i=!1,xfaDatasetsRef:a=null,hasXfaDatasetsEntry:o=!1,needAppearances:s,acroFormRef:c=null,acroForm:l=null,xfaData:u=null,useXrefStream:d=!1}){await async function({xref:e,acroForm:t,acroFormRef:n,hasXfa:r,hasXfaDatasetsEntry:i,xfaDatasetsRef:a,needAppearances:o,changes:s}){if(!r||i||a||h(`XFA - Cannot save it`),!o&&(!r||!a||i))return;let c=t.clone();if(r&&!i){let e=t.get(`XFA`).slice();e.splice(2,0,`datasets`),e.splice(3,0,a),c.set(`XFA`,e)}o&&c.set(`NeedAppearances`,!0),s.put(n,{data:c})}({xref:r,acroForm:l,acroFormRef:c,hasXfa:i,hasXfaDatasetsEntry:o,xfaDatasetsRef:a,needAppearances:s,changes:n}),i&&gb({xfaData:u,xfaDatasetsRef:a,changes:n,xref:r});let f=function(e,t,n){let r=new P(null);r.setIfDefined(`Prev`,e?.startXRef);let i=e.newRef;return n?(t.put(i,{data:``}),r.set(`Size`,i.num+1),r.setIfName(`Type`,`XRef`)):r.set(`Size`,i.num),r.setIfDefined(`Root`,e?.rootRef),r.setIfDefined(`Info`,e?.infoRef),r.setIfDefined(`Encrypt`,e?.encryptRef),r}(t,n,d),p=[],m=await async function(e,t,n=[]){let r=[];for(let[i,{data:a,objStreamRef:o,index:s}]of e.items())o?r.push({ref:i,data:a,objStreamRef:o,index:s}):a!==null&&typeof a!=`string`?(await db(i,a,n,t),r.push({ref:i,data:n.join(``)}),n.length=0):r.push({ref:i,data:a});return r.sort((e,t)=>e.ref.num-t.ref.num)}(n,r,p),g=e.length,_=e.at(-1);_!==10&&_!==13&&(p.push(`
`),g+=1);for(let{data:e}of m)e!==null&&p.push(e);await(d?async function(e,t,n,r,i){let a=[],o=0,s=0;for(let{ref:e,data:r,objStreamRef:i,index:c}of n){let n;o=Math.max(o,t),i?(n=c,a.push([2,i.num,n])):r===null?(n=Math.min(e.gen+1,65535),a.push([0,0,n])):(n=Math.min(e.gen,65535),a.push([1,t,n]),t+=r.length),s=Math.max(s,n)}r.set(`Index`,_b(n));let c=[1,ut(o),ut(s)];r.set(`W`,c),vb(t,e,r);let l=Math.sumPrecise(c),u=new Uint8Array(l*a.length),d=new Ut(u);d.dict=r;let f=0;for(let[e,t,n]of a)f=mb(e,c[0],f,u),f=mb(t,c[1],f,u),f=mb(n,c[2],f,u);await db(e.newRef,d,i,{}),i.push(`startxref
`,t.toString(),`
%%EOF
`)}(t,g,m,f,p):async function(e,t,n,r,i){i.push(`xref
`);let a=_b(n),o=0;for(let{ref:e,data:r}of n)e.num===a[o]&&(i.push(`${a[o]} ${a[o+1]}\n`),o+=2),r===null?i.push(`0000000000 ${Math.min(e.gen+1,65535).toString().padStart(5,`0`)} f\r\n`):(i.push(`${t.toString().padStart(10,`0`)} ${Math.min(e.gen,65535).toString().padStart(5,`0`)} n\r\n`),t+=r.length);vb(t,e,r),i.push(`trailer
`),await fb(r,i,null),i.push(`
startxref
`,t.toString(),`
%%EOF
`)}(t,g,m,f,p));let v=e.length+Math.sumPrecise(p.map(e=>e.length)),y=new Uint8Array(v);y.set(e);let b=e.length;for(let e of p)b=hb(e,b,y);return y}const bb=[`GTS_PDFXVersion`,`GTS_PDFXConformance`,`ISO_PDFEVersion`];var xb=class{constructor(e,t){this.page=e,this.documentData=t,this.annotations=null,this.pointingNamedDestinations=null,this.copyLevel=0,t.pagesMap.put(e.ref,this)}},Sb=class{constructor(e){this.document=e,this.destinations=null,this.pageLabels=null,this.pagesMap=new he,this.oldRefMapping=new he,this.dedupNamedDestinations=/* @__PURE__ */ new Map,this.usedNamedDestinations=/* @__PURE__ */ new Set,this.postponedRefCopies=new he,this.resourceStreamPromises=/* @__PURE__ */ new Map,this.usedStructParents=/* @__PURE__ */ new Set,this.oldStructParentMapping=/* @__PURE__ */ new Map,this.structTreeRoot=null,this.parentTree=null,this.idTree=null,this.roleMap=null,this.classMap=null,this.namespaces=null,this.structTreeAF=null,this.structTreePronunciationLexicon=[],this.acroForm=null,this.acroFormDefaultAppearance=``,this.acroFormDefaultResources=null,this.acroFormQ=0,this.hasSignatureAnnotations=!1,this.fieldToParent=new he,this.outline=null,this.embeddedFiles=null}},Cb=class{constructor(e,t){this.entries=e,this._getNewRef=t}getNewTemporaryRef(){return this._getNewRef()}countUpdatesAfter(e){return null}fetchIfRef(e){return e instanceof F?this.fetch(e):e}fetch(e){if(!(e instanceof F))throw Error(`ref object is not a reference`);return this.entries[e.num]}async fetchIfRefAsync(e){return e instanceof F?this.fetchAsync(e):e}async fetchAsync(e){return this.fetch(e)}},wb=class{isSingleFile=!1;#e=null;#t=null;#n=/* @__PURE__ */ new Map;currentDocument=null;oldPages=[];newPages=[];xref=[null];xrefWrapper=new Cb(this.xref,()=>this.newRef);newRefCount=1;namesDict=null;version=`1.7`;pageLabels=null;namedDestinations=/* @__PURE__ */ new Map;parentTree=/* @__PURE__ */ new Map;structTreeKids=[];idTree=/* @__PURE__ */ new Map;classMap=new P;roleMap=new P;namespaces=/* @__PURE__ */ new Map;structTreeAF=[];structTreePronunciationLexicon=[];fields=[];acroFormDefaultAppearance=``;acroFormDefaultResources=null;acroFormNeedAppearances=!1;acroFormSigFlags=0;acroFormCalculationOrder=null;acroFormQ=0;outlineItems=null;embeddedFiles=/* @__PURE__ */ new Map;constructor({useObjectStreams:e=!0,title:t=``,author:n=``}={}){[this.rootRef,this.rootDict]=this.newDict,[this.infoRef,this.infoDict]=this.newDict,[this.pagesRef,this.pagesDict]=this.newDict,this.useObjectStreams=e,this.objStreamRefs=e?/* @__PURE__ */ new Set:null,this.title=t,this.author=n}get newRef(){return F.get(this.newRefCount++,0)}get newDict(){let e=this.newRef;return[e,this.xref[e.num]=new P]}async#r(e,t){let n=this.newRef;return this.xref[n.num]=await this.#i(e,!0,t),n}cloneDict(e){let t=e.clone();return t.xref=this.xrefWrapper,t}async#i(e,t,n,r=new me){if(e instanceof F){let{currentDocument:{fieldToParent:t,oldRefMapping:i}}=this,a=i.get(e);if(a)return a;let o=e;e=await n.fetchAsync(o);let s=i.get(o);if(s)return s;if(typeof e==`number`)return e;if(e instanceof L&&this.#a(e.dict))return this.#l(o,e,n,r);let c=this.newRef;i.put(o,c);let l=!0;return t.has(o)&&e instanceof P&&((e=this.cloneDict(e)).delete(`Parent`),l=!1),this.xref[c.num]=await this.#i(e,l,n,r),c}let i=[],{currentDocument:{postponedRefCopies:a}}=this;if(Array.isArray(e)){t&&(e=e.slice());for(let t=0,o=e.length;t<o;t++){let o=e[t]instanceof F&&a.get(e[t]);o?o.push(n=>e[t]=n):i.push(this.#i(e[t],!0,n,r).then(n=>e[t]=n))}return await Promise.all(i),e}let o;if(e instanceof L?({dict:o}=e=e.getOriginalStream().clone(),o.xref=this.xrefWrapper):e instanceof P&&(t&&((e=e.clone()).xref=this.xrefWrapper),o=e),o){for(let[e,t]of o.getRawEntries()){let s=t instanceof F&&a.get(t);s?s.push(t=>o.set(e,t)):i.push(this.#i(t,!0,n,r).then(t=>o.set(e,t)))}await Promise.all(i)}return e}#a(e){let t=e.get(`Subtype`);return I(t,`Image`)||e.has(`Length1`)||I(t,`Type1C`)||I(t,`CIDFontType0C`)||I(t,`OpenType`)}#o(e){let t=e.getOriginalStream();return t.reset(),t.getBytes()}async#s(e){let t=[];return await pb(e,t,null),t.join(``)}#c(e,t){let{length:n}=t,r=new Ec;if(r.update(e),r.update(`#${n}`),n<=1024)r.update(t);else{let e=Math.floor((n-256)/3);for(let i=0;i<4;i++){let a=Math.min(i*e,n-256);r.update(t.subarray(a,a+256))}}return r.hexdigest()}async#l(e,t,n,r){let{currentDocument:{oldRefMapping:i,resourceStreamPromises:a}}=this;if(r.has(e))return i.getOrPutComputed(e,()=>this.newRef);let o=e.toString(),s=a.get(o);if(s)return s;let c=new me(r);c.put(e);let l=Promise.resolve().then(async()=>{let r=await this.#i(t,!0,n,c),a=i.get(e);if(a)return this.xref[a.num]=r,a;let o=await this.#u(r);return i.put(e,o),o});a.set(o,l);try{return await l}finally{a.get(o)===l&&a.delete(o)}}async#u(e){let t=await this.#s(e.dict),n=this.#o(e),r=this.#c(t,n),i=this.#n.getOrInsertComputed(r,ie);for(let e of i)if(e.dictStr===t&&te(this.#o(e.stream),n))return e.ref;let a=this.newRef;return this.xref[a.num]=e,i.push({ref:a,dictStr:t,stream:e}),a}async#d(e,t){i Line truncated
`);let s=new P;s.setIfName(`Type`,`ObjStm`),s.set(`N`,t.length),s.set(`First`,r[0].length+1);let c=new Wt(r.join(`
`),s);n.put(e,{data:c})}async writePDF(){await this.#X();let e=this.#Z(),[t,n,r]=await this.#Q(),[i,a]=await this.#$(n,t);return yb({originalData:O(`%PDF-${this.version}\n%úÞúÎ`),changes:i,xrefInfo:{startXRef:null,rootRef:this.rootRef,infoRef:this.infoRef,encryptRef:t,newRef:a,fileIds:r||[null,null],infoMap:e},useXrefStream:this.useObjectStreams,xref:{encrypt:n,encryptRef:t}})}},Tb=class{#e=null;#t=null;_fullReader=null;_rangeReaders=/* @__PURE__ */ new Set;_source=null;constructor(e,t,n){this._source=e,this.#e=t,this.#t=n}get _progressiveDataLength(){return this._fullReader?._loaded??0}getFullReader(){return _(!this._fullReader,`BasePDFStream.getFullReader can only be called once.`),this._fullReader=new this.#e(this)}getRangeReader(e,t){if(t<=this._progressiveDataLength)return null;let n=new this.#t(this,e,t);return this._rangeReaders.add(n),n}cancelAllRequests(e){this._fullReader?.cancel(e);for(let t of new Set(this._rangeReaders))t.cancel(e)}},Eb=class{onProgress=null;_contentLength=0;_filename=null;_headersCapability=Promise.withResolvers();_isRangeSupported=!1;_isStreamingSupported=!1;_loaded=0;_stream=null;constructor(e){this._stream=e}_callOnProgress(){this.onProgress?.({loaded:this._loaded,total:this._contentLength})}get headersReady(){return this._headersCapability.promise}get filename(){return this._filename}get contentLength(){return this._contentLength}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}async read(){g("Abstract method `read` called")}cancel(e){g("Abstract method `cancel` called")}},Db=class{_stream=null;constructor(e,t,n){this._stream=e}async read(){g("Abstract method `read` called")}cancel(e){g("Abstract method `cancel` called")}},Ob=class extends Tb{constructor(e){super(e,kb,Ab)}},kb=class extends Eb{_reader=null;constructor(e){super(e);let{msgHandler:t}=e._source,n=t.sendWithStream(`GetReader`);this._reader=n.getReader(),t.sendWithPromise(`ReaderHeadersReady`).then(e=>{this._contentLength=e.contentLength,this._isStreamingSupported=e.isStreamingSupported,this._isRangeSupported=e.isRangeSupported,this._headersCapability.resolve()},this._headersCapability.reject)}async read(){let{value:e,done:t}=await this._reader.read();return t?{value:void 0,done:!0}:{value:e.buffer,done:!1}}cancel(e){this._reader.cancel(e).catch(()=>{})}},Ab=class extends Db{_reader=null;constructor(e,t,n){super(e,t,n);let{msgHandler:r}=e._source,i=r.sendWithStream(`GetRangeReader`,{begin:t,end:n});this._reader=i.getReader()}async read(){let{value:e,done:t}=await this._reader.read();return t?{value:void 0,done:!0}:{value:e.buffer,done:!1}}cancel(e){this._reader.cancel(e).catch(()=>{})}},jb=class{#e=Promise.withResolvers();terminated=!1;constructor(e){this.name=e}get finished(){return this.#e.promise}finish(){this.#e.resolve()}terminate(){this.terminated=!0}ensureNotTerminated(){if(this.terminated)throw Error(`Worker task was terminated`)}},Mb=class{static{typeof window>`u`&&!e&&typeof self<`u`&&typeof self.postMessage==`function`&&`onmessage`in self&&this.initializeFromPort(self)}static setup(e,t){e.on(`configure`,e=>{(function(e){Number.isInteger(e)&&(p=e)})(e.verbosity)}),e.on(`GetDocRequest`,e=>this.createDocumentHandler(e,t))}static createDocumentHandler(e,t){let n,r=!1,i=null,a=/* @__PURE__ */ new Set,{docId:o,apiVersion:s}=e,c=`6.5.438`;if(s!==c)throw Error(`The API version "${s}" does not match the Worker version "${c}".`);let l=(e,t)=>`The \`${e}.prototype\` contains unexpected enumerable property "${t}", thus breaking e.g. \`for...in\` iteration of ${e}s.`;for(let e in{})throw Error(l(`Object`,e));for(let e in[])throw Error(l(`Array`,e));let u=o+`_worker`,d=new ub(u,o,t);function f(){if(r)throw Error(`Worker was terminated`)}function p(e){a.add(e)}function m(e){e.finish(),a.delete(e)}async function g(e){await n.initDocument(e);let t=await n.ensureDoc(`isPureXfa`);if(t){let e=new jb(`loadXfaResources`);p(e),await n.ensureDoc(`loadXfaResources`,[d,e]),m(e)}let[r,i]=await Promise.all([n.ensureDoc(`numPages`),n.ensureDoc(`fingerprints`)]);return{numPages:r,fingerprints:i,htmlForXfa:t?await n.ensureDoc(`htmlForXfa`):null}}async function _(e){let t=new jb(`PasswordException: response ${e.code}`);p(t);try{return(await d.sendWithPromise(`PasswordRequest`,e)).password}finally{Promise.resolve().then(()=>{m(t)})}}function v(e){function t(e){f(),d.send(`GetDoc`,{pdfInfo:e})}function a(e){r||(e instanceof x?_(e).then(e=>{n.updatePassword(e),s()}).catch(()=>{d.send(`DocException`,e)}):d.send(`DocException`,lb(e)))}function s(){f(),g(!1).then(t,function(e){f(),e instanceof Fe?n.requestLoadedStream().then(function(){f(),g(!0).then(t,a)},a):a(e)})}f(),(async function({data:e,password:t,disableAutoFetch:n,rangeChunkSize:r,docBaseUrl:a,enableXfa:s,evaluatorOptions:c}){let l={source:null,disableAutoFetch:n,docBaseUrl:a,docId:o,enableXfa:s,evaluatorOptions:c,handler:d,length:0,password:t,rangeChunkSize:r};if(e)return l.source=e,new ob(l);let u=new Ob({msgLine truncated
//# sourceMappingURL=pdf-worker-ClT6UGn4.js.map