From 4255d4a683add55614c6be35150d700af41a9d40 Mon Sep 17 00:00:00 2001 From: Michael Sharman Date: Thu, 19 Sep 2024 16:29:27 +1000 Subject: [PATCH] Updating to import ssmlEditor from npm. --- dist/332.js | 2 +- dist/assessment/index.js | 2 +- dist/authoring/index.js | 2 +- package-lock.json | 537 +++++++++++------- package.json | 4 +- .../extensions/ui/ssmlEditor/index.js | 2 +- 6 files changed, 324 insertions(+), 225 deletions(-) diff --git a/dist/332.js b/dist/332.js index 9f07284..e499359 100644 --- a/dist/332.js +++ b/dist/332.js @@ -1 +1 @@ -var A={d:(e,t)=>{for(var i in t)A.o(t,i)&&!A.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},o:(A,e)=>Object.prototype.hasOwnProperty.call(A,e)},e=globalThis.pdfjsWorker={};A.d(e,{WorkerMessageHandler:()=>Sd});const t=!("object"!=typeof process||process+""!="[object process]"||process.versions.nw||process.versions.electron&&process.type&&"browser"!==process.type),i=[1,0,0,1,0,0],a=[.001,0,0,.001,0,0],s=1.35,n=.25925925925925924,g="pdfjs_internal_editor_",r={PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048},o="Group",I=8192,c=65536,C={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"},B={WC:"WillClose",WS:"WillSave",DS:"DidSave",WP:"WillPrint",DP:"DidPrint"},h={O:"PageOpen",C:"PageClose"},Q={ERRORS:0,WARNINGS:1,INFOS:5},l={NONE:0,BINARY:1},E=10,u=11,d=12,f=37,p=44,m=58,y=59,w=70,D=71,b=83,k=85;let F=Q.WARNINGS;function S(){return F}function R(A){F>=Q.INFOS&&console.log(`Info: ${A}`)}function G(A){F>=Q.WARNINGS&&console.log(`Warning: ${A}`)}function N(A){throw new Error(A)}function x(A,e){A||N(e)}function U(A,e=null,t=null){if(!A)return null;try{if(t&&"string"==typeof A){if(t.addDefaultProtocol&&A.startsWith("www.")){const e=A.match(/\./g);e?.length>=2&&(A=`http://${A}`)}if(t.tryConvertEncoding)try{A=$(A)}catch{}}const i=e?new URL(A,e):new URL(A);if(function(A){switch(A?.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":return!0;default:return!1}}(i))return i}catch{}return null}function M(A,e,t,i=!1){return Object.defineProperty(A,e,{value:t,enumerable:!i,configurable:!0,writable:!1}),t}const L=function(){function A(A,e){this.message=A,this.name=e}return A.prototype=new Error,A.constructor=A,A}();class J extends L{constructor(A,e){super(A,"PasswordException"),this.code=e}}class H extends L{constructor(A,e){super(A,"UnknownErrorException"),this.details=e}}class Y extends L{constructor(A){super(A,"InvalidPDFException")}}class v extends L{constructor(A){super(A,"MissingPDFException")}}class K extends L{constructor(A,e){super(A,"UnexpectedResponseException"),this.status=e}}class q extends L{constructor(A){super(A,"FormatError")}}class T extends L{constructor(A){super(A,"AbortException")}}function P(A){"object"==typeof A&&void 0!==A?.length||N("Invalid argument for bytesToString");const e=A.length,t=8192;if(e>24&255,A>>16&255,A>>8&255,255&A)}function O(A){return Object.keys(A).length}class X{static get isLittleEndian(){return M(this,"isLittleEndian",function(){const A=new Uint8Array(4);return A[0]=1,1===new Uint32Array(A.buffer,0,1)[0]}())}static get isEvalSupported(){return M(this,"isEvalSupported",function(){try{return new Function(""),!0}catch{return!1}}())}static get isOffscreenCanvasSupported(){return M(this,"isOffscreenCanvasSupported","undefined"!=typeof OffscreenCanvas)}static get platform(){return"undefined"!=typeof navigator&&"string"==typeof navigator?.platform?M(this,"platform",{isMac:navigator.platform.includes("Mac")}):M(this,"platform",{isMac:!1})}static get isCSSRoundSupported(){return M(this,"isCSSRoundSupported",globalThis.CSS?.supports?.("width: round(1.5px, 1px)"))}}const V=Array.from(Array(256).keys(),(A=>A.toString(16).padStart(2,"0")));class j{static makeHexColor(A,e,t){return`#${V[A]}${V[e]}${V[t]}`}static scaleMinMax(A,e){let t;A[0]?(A[0]<0&&(t=e[0],e[0]=e[2],e[2]=t),e[0]*=A[0],e[2]*=A[0],A[3]<0&&(t=e[1],e[1]=e[3],e[3]=t),e[1]*=A[3],e[3]*=A[3]):(t=e[0],e[0]=e[1],e[1]=t,t=e[2],e[2]=e[3],e[3]=t,A[1]<0&&(t=e[1],e[1]=e[3],e[3]=t),e[1]*=A[1],e[3]*=A[1],A[2]<0&&(t=e[0],e[0]=e[2],e[2]=t),e[0]*=A[2],e[2]*=A[2]),e[0]+=A[4],e[1]+=A[5],e[2]+=A[4],e[3]+=A[5]}static transform(A,e){return[A[0]*e[0]+A[2]*e[1],A[1]*e[0]+A[3]*e[1],A[0]*e[2]+A[2]*e[3],A[1]*e[2]+A[3]*e[3],A[0]*e[4]+A[2]*e[5]+A[4],A[1]*e[4]+A[3]*e[5]+A[5]]}static applyTransform(A,e){return[A[0]*e[0]+A[1]*e[2]+e[4],A[0]*e[1]+A[1]*e[3]+e[5]]}static applyInverseTransform(A,e){const t=e[0]*e[3]-e[1]*e[2];return[(A[0]*e[3]-A[1]*e[2]+e[2]*e[5]-e[4]*e[3])/t,(-A[0]*e[1]+A[1]*e[0]+e[4]*e[1]-e[5]*e[0])/t]}static getAxialAlignedBoundingBox(A,e){const t=this.applyTransform(A,e),i=this.applyTransform(A.slice(2,4),e),a=this.applyTransform([A[0],A[3]],e),s=this.applyTransform([A[2],A[1]],e);return[Math.min(t[0],i[0],a[0],s[0]),Math.min(t[1],i[1],a[1],s[1]),Math.max(t[0],i[0],a[0],s[0]),Math.max(t[1],i[1],a[1],s[1])]}static inverseTransform(A){const e=A[0]*A[3]-A[1]*A[2];return[A[3]/e,-A[1]/e,-A[2]/e,A[0]/e,(A[2]*A[5]-A[4]*A[3])/e,(A[4]*A[1]-A[5]*A[0])/e]}static singularValueDecompose2dScale(A){const e=[A[0],A[2],A[1],A[3]],t=A[0]*e[0]+A[1]*e[2],i=A[0]*e[1]+A[1]*e[3],a=A[2]*e[0]+A[3]*e[2],s=A[2]*e[1]+A[3]*e[3],n=(t+s)/2,g=Math.sqrt((t+s)**2-4*(t*s-a*i))/2,r=n+g||1,o=n-g||1;return[Math.sqrt(r),Math.sqrt(o)]}static normalizeRect(A){const e=A.slice(0);return A[0]>A[2]&&(e[0]=A[2],e[2]=A[0]),A[1]>A[3]&&(e[1]=A[3],e[3]=A[1]),e}static intersect(A,e){const t=Math.max(Math.min(A[0],A[2]),Math.min(e[0],e[2])),i=Math.min(Math.max(A[0],A[2]),Math.max(e[0],e[2]));if(t>i)return null;const a=Math.max(Math.min(A[1],A[3]),Math.min(e[1],e[3])),s=Math.min(Math.max(A[1],A[3]),Math.max(e[1],e[3]));return a>s?null:[t,a,i,s]}static#A(A,e,t,i,a,s,n,g,r,o){if(r<=0||r>=1)return;const I=1-r,c=r*r,C=c*r,B=I*(I*(I*A+3*r*e)+3*c*t)+C*i,h=I*(I*(I*a+3*r*s)+3*c*n)+C*g;o[0]=Math.min(o[0],B),o[1]=Math.min(o[1],h),o[2]=Math.max(o[2],B),o[3]=Math.max(o[3],h)}static#e(A,e,t,i,a,s,n,g,r,o,I,c){if(Math.abs(r)<1e-12)return void(Math.abs(o)>=1e-12&&this.#A(A,e,t,i,a,s,n,g,-I/o,c));const C=o**2-4*I*r;if(C<0)return;const B=Math.sqrt(C),h=2*r;this.#A(A,e,t,i,a,s,n,g,(-o+B)/h,c),this.#A(A,e,t,i,a,s,n,g,(-o-B)/h,c)}static bezierBoundingBox(A,e,t,i,a,s,n,g,r){return r?(r[0]=Math.min(r[0],A,n),r[1]=Math.min(r[1],e,g),r[2]=Math.max(r[2],A,n),r[3]=Math.max(r[3],e,g)):r=[Math.min(A,n),Math.min(e,g),Math.max(A,n),Math.max(e,g)],this.#e(A,t,a,n,e,i,s,g,3*(3*(t-a)-A+n),6*(A-2*t+a),3*(t-A),r),this.#e(A,t,a,n,e,i,s,g,3*(3*(i-s)-e+g),6*(e-2*i+s),3*(i-e),r),r}}const z=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,728,711,710,729,733,731,730,732,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8226,8224,8225,8230,8212,8211,402,8260,8249,8250,8722,8240,8222,8220,8221,8216,8217,8218,8482,64257,64258,321,338,352,376,381,305,322,339,353,382,0,8364];function _(A){if(A[0]>="ï"){let e;if("þ"===A[0]&&"ÿ"===A[1]?(e="utf-16be",A.length%2==1&&(A=A.slice(0,-1))):"ÿ"===A[0]&&"þ"===A[1]?(e="utf-16le",A.length%2==1&&(A=A.slice(0,-1))):"ï"===A[0]&&"»"===A[1]&&"¿"===A[2]&&(e="utf-8"),e)try{const t=new TextDecoder(e,{fatal:!0}),i=W(A),a=t.decode(i);return a.includes("")?a.replaceAll(/\x1b[^\x1b]*(?:\x1b|$)/g,""):a}catch(A){G(`stringToPDFString: "${A}".`)}}const e=[];for(let t=0,i=A.length;t{N("Should not call `set` on the empty dictionary.")},M(this,"empty",A)}static merge({xref:A,dictArray:e,mergeSubDicts:t=!1}){const i=new BA(A),a=new Map;for(const A of e)if(A instanceof BA)for(const[e,i]of Object.entries(A._map)){let A=a.get(e);if(void 0===A)A=[],a.set(e,A);else if(!(t&&i instanceof BA))continue;A.push(i)}for(const[e,t]of a){if(1===t.length||!(t[0]instanceof BA)){i._map[e]=t[0];continue}const a=new BA(A);for(const A of t)for(const[e,t]of Object.entries(A._map))void 0===a._map[e]&&(a._map[e]=t);a.size>0&&(i._map[e]=a)}return a.clear(),i.size>0?i:BA.empty}clone(){const A=new BA(this.xref);for(const e of this.getKeys())A.set(e,this.getRaw(e));return A}delete(A){delete this._map[A]}}class hA{constructor(A,e){this.num=A,this.gen=e}toString(){return 0===this.gen?`${this.num}R`:`${this.num}R${this.gen}`}static fromString(A){const e=oA[A];if(e)return e;const t=/^(\d+)R(\d*)$/.exec(A);return t&&"0"!==t[1]?oA[A]=new hA(parseInt(t[1]),t[2]?parseInt(t[2]):0):null}static get(A,e){const t=0===e?`${A}R`:`${A}R${e}`;return oA[t]||=new hA(A,e)}}class QA{constructor(A=null){this._set=new Set(A?._set)}has(A){return this._set.has(A.toString())}put(A){this._set.add(A.toString())}remove(A){this._set.delete(A.toString())}[Symbol.iterator](){return this._set.values()}clear(){this._set.clear()}}class lA{constructor(){this._map=new Map}get size(){return this._map.size}get(A){return this._map.get(A.toString())}has(A){return this._map.has(A.toString())}put(A,e){this._map.set(A.toString(),e)}putAlias(A,e){this._map.set(A.toString(),this.get(e))}[Symbol.iterator](){return this._map.values()}clear(){this._map.clear()}*items(){for(const[A,e]of this._map)yield[hA.fromString(A),e]}}function EA(A,e){return A instanceof IA&&(void 0===e||A.name===e)}function uA(A,e){return A instanceof cA&&(void 0===e||A.cmd===e)}function dA(A,e){return A instanceof BA&&(void 0===e||EA(A.get("Type"),e))}function fA(A,e){return A.num===e.num&&A.gen===e.gen}class pA{get length(){N("Abstract getter `length` accessed")}get isEmpty(){N("Abstract getter `isEmpty` accessed")}get isDataLoaded(){return M(this,"isDataLoaded",!0)}getByte(){N("Abstract method `getByte` called")}getBytes(A){N("Abstract method `getBytes` called")}async getImageData(A,e){return this.getBytes(A,e)}async asyncGetBytes(){N("Abstract method `asyncGetBytes` called")}get isAsync(){return!1}get canAsyncDecodeImageFromBuffer(){return!1}peekByte(){const A=this.getByte();return-1!==A&&this.pos--,A}peekBytes(A){const e=this.getBytes(A);return this.pos-=e.length,e}getUint16(){const A=this.getByte(),e=this.getByte();return-1===A||-1===e?-1:(A<<8)+e}getInt32(){return(this.getByte()<<24)+(this.getByte()<<16)+(this.getByte()<<8)+this.getByte()}getByteRange(A,e){N("Abstract method `getByteRange` called")}getString(A){return P(this.getBytes(A))}skip(A){this.pos+=A||1}reset(){N("Abstract method `reset` called")}moveStart(){N("Abstract method `moveStart` called")}makeSubStream(A,e,t=null){N("Abstract method `makeSubStream` called")}getBaseStreams(){return null}}const mA=/^[1-9]\.\d$/;function yA(A){let e;return function(){return A&&(e=Object.create(null),A(e),A=null),e}}class wA extends L{constructor(A,e){super(`Missing data [${A}, ${e})`,"MissingDataException"),this.begin=A,this.end=e}}class DA extends L{constructor(A){super(A,"ParserEOFException")}}class bA extends L{constructor(A){super(A,"XRefEntryException")}}class kA extends L{constructor(A){super(A,"XRefParseException")}}function FA(A){const e=A.length;if(0===e)return new Uint8Array(0);if(1===e)return new Uint8Array(A[0]);let t=0;for(let i=0;i0,"The number should be a positive integer.");const t=[];let i;for(;A>=1e3;)A-=1e3,t.push("M");i=A/100|0,A%=100,t.push(RA[i]),i=A/10|0,A%=10,t.push(RA[10+i]),t.push(RA[20+A]);const a=t.join("");return e?a.toLowerCase():a}function NA(A){return A<=0?0:Math.ceil(Math.log2(A))}function xA(A,e){return A[e]<<24>>24}function UA(A,e){return A[e]<<8|A[e+1]}function MA(A,e){return(A[e]<<24|A[e+1]<<16|A[e+2]<<8|A[e+3])>>>0}function LA(A){return 32===A||9===A||13===A||10===A}function JA(A,e){return Array.isArray(A)?(null===e||A.length===e)&&A.every((A=>"number"==typeof A)):ArrayBuffer.isView(A)&&(0===A.length||"number"==typeof A[0])&&(null===e||A.length===e)}function HA(A,e){return JA(A,6)?A:e}function YA(A,e){return JA(A,4)?A:e}function vA(A,e){return JA(A,4)?j.normalizeRect(A):e}function KA(A){const e=/(.+)\[(\d+)\]$/;return A.split(".").map((A=>{const t=A.match(e);return t?{name:t[1],pos:parseInt(t[2],10)}:{name:A,pos:0}}))}function qA(A){const e=[];let t=0;for(let i=0,a=A.length;i126||35===a||40===a||41===a||60===a||62===a||91===a||93===a||123===a||125===a||47===a||37===a)&&(t"\n"===A?"\\n":"\r"===A?"\\r":`\\${A}`))}function PA(A,e,t,i){if(!A)return;let a=null;if(A instanceof hA){if(i.has(A))return;a=A,i.put(a),A=e.fetch(A)}if(Array.isArray(A))for(const a of A)PA(a,e,t,i);else if(A instanceof BA){if(EA(A.get("S"),"JavaScript")){const e=A.get("JS");let i;e instanceof pA?i=e.getString():"string"==typeof e&&(i=e),i&&=_(i).replaceAll("\0",""),i&&t.push(i)}PA(A.getRaw("Next"),e,t,i)}a&&i.remove(a)}function WA(A,e,t){const i=Object.create(null),a=SA({dict:e,key:"AA",stopWhenFound:!1});if(a)for(let e=a.length-1;e>=0;e--){const s=a[e];if(s instanceof BA)for(const e of s.getKeys()){const a=t[e];if(!a)continue;const n=[];PA(s.getRaw(e),A,n,new QA),n.length>0&&(i[a]=n)}}if(e.has("A")){const t=[];PA(e.get("A"),A,t,new QA),t.length>0&&(i.Action=t)}return O(i)>0?i:null}const ZA={60:"<",62:">",38:"&",34:""",39:"'"};function*OA(A){for(let e=0,t=A.length;e55295&&(t<57344||t>65533)&&e++,yield t}}function XA(A){const e=[];let t=0;for(let i=0,a=A.length;i55295&&(a<57344||a>65533)&&i++,t=i+1}return 0===e.length?A:(t: ${A}.`),!1;return!0}function jA(A){const e=new Set(["100","200","300","400","500","600","700","800","900","1000","normal","bold","bolder","lighter"]),{fontFamily:t,fontWeight:i,italicAngle:a}=A;if(!VA(t,!0))return!1;const s=i?i.toString():"";A.fontWeight=e.has(s)?s:"400";const n=parseFloat(a);return A.italicAngle=isNaN(n)||n<-90||n>90?"14":a.toString(),!0}function zA(A){const e=new RegExp("^\\s*("+["app.launchURL","window.open","xfa.host.gotoURL"].join("|").replaceAll(".","\\.")+")\\((?:'|\")([^'\"]*)(?:'|\")(?:,\\s*(\\w+)\\)|\\))","i").exec(A);if(e?.[2]){const A=e[2];let t=!1;return"true"===e[3]&&"app.launchURL"===e[1]&&(t=!0),{url:A,newWindow:t}}return null}function _A(A){if(Number.isInteger(A))return A.toString();const e=Math.round(100*A);return e%100==0?(e/100).toString():e%10==0?A.toFixed(1):A.toFixed(2)}function $A(A){if(!A)return null;const e=new Map;for(const[t,i]of A){if(!t.startsWith(g))continue;let A=e.get(i.pageIndex);A||(A=[],e.set(i.pageIndex,A)),A.push(i)}return e.size>0?e:null}function Ae(A){return function(A){return/^[\x00-\x7F]*$/.test(A)}(A)?A:te(A,!0)}function ee(A){const e=[];for(let t=0,i=A.length;t>8&255).toString(16).padStart(2,"0"),(255&i).toString(16).padStart(2,"0"))}return e.join("")}function te(A,e=!1){const t=[];e&&t.push("þÿ");for(let e=0,i=A.length;e>8&255),String.fromCharCode(255&i))}return t.join("")}function ie(A,e,t){switch(A){case 90:return[0,1,-1,0,e,0];case 180:return[-1,0,0,-1,e,t];case 270:return[0,-1,1,0,0,t];default:throw new Error("Invalid rotation")}}function ae(A){return Math.ceil(Math.ceil(Math.log2(1+A))/8)}class se extends pA{constructor(A,e,t,i){super(),this.bytes=A instanceof Uint8Array?A:new Uint8Array(A),this.start=e||0,this.pos=this.start,this.end=e+t||this.bytes.length,this.dict=i}get length(){return this.end-this.start}get isEmpty(){return 0===this.length}getByte(){return this.pos>=this.end?-1:this.bytes[this.pos++]}getBytes(A){const e=this.bytes,t=this.pos,i=this.end;if(!A)return e.subarray(t,i);let a=t+A;return a>i&&(a=i),this.pos=a,e.subarray(t,a)}getByteRange(A,e){return A<0&&(A=0),e>this.end&&(e=this.end),this.bytes.subarray(A,e)}reset(){this.pos=this.start}moveStart(){this.start=this.pos}makeSubStream(A,e,t=null){return new se(this.bytes.buffer,A,e,t)}}class ne extends se{constructor(A){super(W(A))}}class ge extends se{constructor(){super(new Uint8Array(0))}}class re extends se{constructor(A,e,t){super(new Uint8Array(A),0,A,null),this.chunkSize=e,this._loadedChunks=new Set,this.numChunks=Math.ceil(A/e),this.manager=t,this.progressiveDataLength=0,this.lastSuccessfulEnsureByteChunk=-1}getMissingChunks(){const A=[];for(let e=0,t=this.numChunks;e=this.end?this.numChunks:Math.floor(e/this.chunkSize);for(let A=t;Athis.numChunks)&&e!==this.lastSuccessfulEnsureByteChunk){if(!this._loadedChunks.has(e))throw new wA(A,A+1);this.lastSuccessfulEnsureByteChunk=e}}ensureRange(A,e){if(A>=e)return;if(e<=this.progressiveDataLength)return;const t=Math.floor(A/this.chunkSize);if(t>this.numChunks)return;const i=Math.min(Math.floor((e-1)/this.chunkSize)+1,this.numChunks);for(let a=t;a=this.end?-1:(A>=this.progressiveDataLength&&this.ensureByte(A),this.bytes[this.pos++])}getBytes(A){const e=this.bytes,t=this.pos,i=this.end;if(!A)return i>this.progressiveDataLength&&this.ensureRange(t,i),e.subarray(t,i);let a=t+A;return a>i&&(a=i),a>this.progressiveDataLength&&this.ensureRange(t,a),this.pos=a,e.subarray(t,a)}getByteRange(A,e){return A<0&&(A=0),e>this.end&&(e=this.end),e>this.progressiveDataLength&&this.ensureRange(A,e),this.bytes.subarray(A,e)}makeSubStream(A,e,t=null){function i(){}e?A+e>this.progressiveDataLength&&this.ensureRange(A,A+e):A>=this.progressiveDataLength&&this.ensureByte(A),i.prototype=Object.create(this),i.prototype.getMissingChunks=function(){const A=this.chunkSize,e=Math.floor(this.start/A),t=Math.floor((this.end-1)/A)+1,i=[];for(let A=e;A{const s=({value:n,done:g})=>{try{if(g){const e=FA(i);return i=null,void A(e)}a+=n.byteLength,t.isStreamingSupported&&this.onProgress({loaded:a}),i.push(n),t.read().then(s,e)}catch(A){e(A)}};t.read().then(s,e)})).then((e=>{this.aborted||this.onReceiveData({chunk:e,begin:A})}))}requestAllChunks(A=!1){if(!A){const A=this.stream.getMissingChunks();this._requestChunks(A)}return this._loadedStreamCapability.promise}_requestChunks(A){const e=this.currRequestId++,t=new Set;this._chunksNeededByRequest.set(e,t);for(const e of A)this.stream.hasChunk(e)||t.add(e);if(0===t.size)return Promise.resolve();const i=Promise.withResolvers();this._promisesByRequest.set(e,i);const a=[];for(const A of t){let t=this._requestsByChunk.get(A);t||(t=[],this._requestsByChunk.set(A,t),a.push(A)),t.push(e)}if(a.length>0){const A=this.groupChunks(a);for(const e of A){const A=e.beginChunk*this.chunkSize,t=Math.min(e.endChunk*this.chunkSize,this.length);this.sendRequest(A,t).catch(i.reject)}}return i.promise.catch((A=>{if(!this.aborted)throw A}))}getStream(){return this.stream}requestRange(A,e){e=Math.min(e,this.length);const t=this.getBeginChunk(A),i=this.getEndChunk(e),a=[];for(let A=t;A=0&&i+1!==s&&(e.push({beginChunk:t,endChunk:i+1}),t=s),a+1===A.length&&e.push({beginChunk:t,endChunk:s+1}),i=s}return e}onProgress(A){this.msgHandler.send("DocProgress",{loaded:this.stream.numChunksLoaded*this.chunkSize+A.loaded,total:this.length})}onReceiveData(A){const e=A.chunk,t=void 0===A.begin,i=t?this.progressiveDataLength:A.begin,a=i+e.byteLength,s=Math.floor(i/this.chunkSize),n=a0||g.push(t)}}}if(!this.disableAutoFetch&&0===this._requestsByChunk.size){let A;if(1===this.stream.numChunksLoaded){const e=this.stream.numChunks-1;this.stream.hasChunk(e)||(A=e)}else A=this.stream.nextEmptyChunk(n);Number.isInteger(A)&&this._requestChunks([A])}for(const A of g){const e=this._promisesByRequest.get(A);this._promisesByRequest.delete(A),e.resolve()}this.msgHandler.send("DocProgress",{loaded:this.stream.numChunksLoaded*this.chunkSize,total:this.length})}onError(A){this._loadedStreamCapability.reject(A)}getBeginChunk(A){return Math.floor(A/this.chunkSize)}getEndChunk(A){return Math.floor((A-1)/this.chunkSize)+1}abort(A){this.aborted=!0,this.pdfNetworkStream?.cancelAllRequests(A);for(const e of this._promisesByRequest.values())e.reject(A)}}class Ie{constructor(A,e){this.name=A,this.numComps=e}getRgb(A,e){const t=new Uint8ClampedArray(3);return this.getRgbItem(A,e,t,0),t}getRgbItem(A,e,t,i){N("Should not call ColorSpace.getRgbItem")}getRgbBuffer(A,e,t,i,a,s,n){N("Should not call ColorSpace.getRgbBuffer")}getOutputLength(A,e){N("Should not call ColorSpace.getOutputLength")}isPassthrough(A){return!1}isDefaultDecode(A,e){return Ie.isDefaultDecode(A,this.numComps)}fillRgb(A,e,t,i,a,s,n,g,r){const o=e*t;let I=null;const c=1<c&&"DeviceGray"!==this.name&&"DeviceRGB"!==this.name){const e=n<=8?new Uint8Array(c):new Uint16Array(c);for(let A=0;A=.99554525?1:this.#Q(0,1,1.055*A**(1/2.4)-.055)}#Q(A,e,t){return Math.max(A,Math.min(e,t))}#l(A){return A<0?-this.#l(-A):A>8?((A+16)/116)**3:A*de.#I}#E(A,e,t){if(0===A[0]&&0===A[1]&&0===A[2])return t[0]=e[0],t[1]=e[1],void(t[2]=e[2]);const i=this.#l(0),a=(1-i)/(1-this.#l(A[0])),s=1-a,n=(1-i)/(1-this.#l(A[1])),g=1-n,r=(1-i)/(1-this.#l(A[2])),o=1-r;t[0]=e[0]*a+s,t[1]=e[1]*n+g,t[2]=e[2]*r+o}#u(A,e,t){if(1===A[0]&&1===A[2])return t[0]=e[0],t[1]=e[1],void(t[2]=e[2]);const i=t;this.#c(de.#i,e,i);const a=de.#g;this.#C(A,i,a),this.#c(de.#a,a,t)}#d(A,e,t){const i=t;this.#c(de.#i,e,i);const a=de.#g;this.#B(A,i,a),this.#c(de.#a,a,t)}#t(A,e,t,i,a){const s=this.#Q(0,1,A[e]*a),n=this.#Q(0,1,A[e+1]*a),g=this.#Q(0,1,A[e+2]*a),r=1===s?1:s**this.GR,o=1===n?1:n**this.GG,I=1===g?1:g**this.GB,c=this.MXA*r+this.MXB*o+this.MXC*I,C=this.MYA*r+this.MYB*o+this.MYC*I,B=this.MZA*r+this.MZB*o+this.MZC*I,h=de.#r;h[0]=c,h[1]=C,h[2]=B;const Q=de.#o;this.#u(this.whitePoint,h,Q);const l=de.#r;this.#E(this.blackPoint,Q,l);const E=de.#o;this.#d(de.#n,l,E);const u=de.#r;this.#c(de.#s,E,u),t[i]=255*this.#h(u[0]),t[i+1]=255*this.#h(u[1]),t[i+2]=255*this.#h(u[2])}getRgbItem(A,e,t,i){this.#t(A,e,t,i,1)}getRgbBuffer(A,e,t,i,a,s,n){const g=1/((1<this.amax||this.bmin>this.bmax)&&(R("Invalid Range, falling back to defaults"),this.amin=-100,this.amax=100,this.bmin=-100,this.bmax=100)}#f(A){return A>=6/29?A**3:108/841*(A-4/29)}#p(A,e,t,i){return t+A*(i-t)/e}#t(A,e,t,i,a){let s=A[e],n=A[e+1],g=A[e+2];!1!==t&&(s=this.#p(s,t,0,100),n=this.#p(n,t,this.amin,this.amax),g=this.#p(g,t,this.bmin,this.bmax)),n>this.amax?n=this.amax:nthis.bmax?g=this.bmax:g>>0}function me(A,e){return 1===e?String.fromCharCode(A[0],A[1]):3===e?String.fromCharCode(A[0],A[1],A[2],A[3]):String.fromCharCode(...A.subarray(0,e+1))}function ye(A,e,t){let i=0;for(let a=t;a>=0;a--)i+=A[a]+e[a],A[a]=255&i,i>>=8}function we(A,e){let t=1;for(let i=e;i>=0&&t>0;i--)t+=A[i],A[i]=255&t,t>>=8}const De=16;class be{constructor(A){this.buffer=A,this.pos=0,this.end=A.length,this.tmpBuf=new Uint8Array(19)}readByte(){return this.pos>=this.end?-1:this.buffer[this.pos++]}readNumber(){let A,e=0;do{const t=this.readByte();if(t<0)throw new q("unexpected EOF in bcmap");A=!(128&t),e=e<<7|127&t}while(!A);return e}readSigned(){const A=this.readNumber();return 1&A?~(A>>>1):A>>>1}readHex(A,e){A.set(this.buffer.subarray(this.pos,this.pos+e+1)),this.pos+=e+1}readHexNumber(A,e){let t;const i=this.tmpBuf;let a=0;do{const A=this.readByte();if(A<0)throw new q("unexpected EOF in bcmap");t=!(128&A),i[a++]=127&A}while(!t);let s=e,n=0,g=0;for(;s>=0;){for(;g<8&&i.length>0;)n|=i[--a]<>=8,g-=8}}readHexSigned(A,e){this.readHexNumber(A,e);const t=1&A[e]?255:0;let i=0;for(let a=0;a<=e;a++)i=(1&i)<<8|A[a],A[a]=i>>1^t}readString(){const A=this.readNumber(),e=new Array(A);for(let t=0;t=0;){const A=C>>5;if(7===A){switch(31&C){case 0:i.readString();break;case 1:s=i.readString()}continue}const t=!!(16&C),a=15&C;if(a+1>De)throw new Error("BinaryCMapReader.process: Invalid dataSize.");const B=1,h=i.readNumber();switch(A){case 0:i.readHex(n,a),i.readHexNumber(g,a),ye(g,n,a),e.addCodespaceRange(a+1,pe(n,a),pe(g,a));for(let A=1;Aa&&(i=a)}else{for(;!this.eof;)this.readBlock(e);i=this.bufferLength}return this.pos=i,this.buffer.subarray(t,i)}async getImageData(A,e=null){if(!this.canAsyncDecodeImageFromBuffer)return this.getBytes(A,e);const t=await this.stream.asyncGetBytes();return this.decodeImage(t,e)}reset(){this.pos=0}makeSubStream(A,e,t=null){if(void 0===e)for(;!this.eof;)this.readBlock();else{const t=A+e;for(;this.bufferLength<=t&&!this.eof;)this.readBlock()}return new se(this.buffer,A,e,t)}getBaseStreams(){return this.str?this.str.getBaseStreams():null}}class Re extends Se{constructor(A,e=null){let t=0;for(const e of A)t+=e instanceof Se?e._rawMinBufferLength:e.length;super(t),this.streams=A,this._onError=e}readBlock(){const A=this.streams;if(0===A.length)return void(this.eof=!0);const e=A.shift();let t;try{t=e.getBytes()}catch(A){if(this._onError)return void this._onError(A,e.dict?.objId);throw A}const i=this.bufferLength,a=i+t.length;this.ensureBuffer(a).set(t,i),this.bufferLength=a}getBaseStreams(){const A=[];for(const e of this.streams){const t=e.getBaseStreams();t&&A.push(...t)}return A.length>0?A:null}}class Ge extends Se{constructor(A,e){e&&(e*=.8),super(e),this.str=A,this.dict=A.dict,this.input=new Uint8Array(5)}readBlock(){const A=this.str;let e=A.getByte();for(;LA(e);)e=A.getByte();if(-1===e||126===e)return void(this.eof=!0);const t=this.bufferLength;let i,a;if(122===e){for(i=this.ensureBuffer(t+4),a=0;a<4;++a)i[t+a]=0;this.bufferLength+=4}else{const s=this.input;for(s[0]=e,a=1;a<5;++a){for(e=A.getByte();LA(e);)e=A.getByte();if(s[a]=e,-1===e||126===e)break}if(i=this.ensureBuffer(t+a-1),this.bufferLength+=a-1,a<5){for(;a<5;++a)s[a]=117;this.eof=!0}let n=0;for(a=0;a<5;++a)n=85*n+(s[a]-33);for(a=3;a>=0;--a)i[t+a]=255&n,n>>=8}}}class Ne extends Se{constructor(A,e){e&&(e*=.5),super(e),this.str=A,this.dict=A.dict,this.firstDigit=-1}readBlock(){const A=this.str.getBytes(8e3);if(!A.length)return void(this.eof=!0);const e=A.length+1>>1,t=this.ensureBuffer(this.bufferLength+e);let i=this.bufferLength,a=this.firstDigit;for(const e of A){let A;if(e>=48&&e<=57)A=15&e;else{if(!(e>=65&&e<=70||e>=97&&e<=102)){if(62===e){this.eof=!0;break}continue}A=9+(15&e)}a<0?a=A:(t[i++]=a<<4|A,a=-1)}a>=0&&this.eof&&(t[i++]=a<<4,a=-1),this.firstDigit=a,this.bufferLength=i}}const xe=-1,Ue=[[-1,-1],[-1,-1],[7,8],[7,7],[6,6],[6,6],[6,5],[6,5],[4,0],[4,0],[4,0],[4,0],[4,0],[4,0],[4,0],[4,0],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,3],[3,3],[3,3],[3,3],[3,3],[3,3],[3,3],[3,3],[3,3],[3,3],[3,3],[3,3],[3,3],[3,3],[3,3],[3,3],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2]],Me=[[-1,-1],[12,-2],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[11,1792],[11,1792],[12,1984],[12,2048],[12,2112],[12,2176],[12,2240],[12,2304],[11,1856],[11,1856],[11,1920],[11,1920],[12,2368],[12,2432],[12,2496],[12,2560]],Le=[[-1,-1],[-1,-1],[-1,-1],[-1,-1],[8,29],[8,29],[8,30],[8,30],[8,45],[8,45],[8,46],[8,46],[7,22],[7,22],[7,22],[7,22],[7,23],[7,23],[7,23],[7,23],[8,47],[8,47],[8,48],[8,48],[6,13],[6,13],[6,13],[6,13],[6,13],[6,13],[6,13],[6,13],[7,20],[7,20],[7,20],[7,20],[8,33],[8,33],[8,34],[8,34],[8,35],[8,35],[8,36],[8,36],[8,37],[8,37],[8,38],[8,38],[7,19],[7,19],[7,19],[7,19],[8,31],[8,31],[8,32],[8,32],[6,1],[6,1],[6,1],[6,1],[6,1],[6,1],[6,1],[6,1],[6,12],[6,12],[6,12],[6,12],[6,12],[6,12],[6,12],[6,12],[8,53],[8,53],[8,54],[8,54],[7,26],[7,26],[7,26],[7,26],[8,39],[8,39],[8,40],[8,40],[8,41],[8,41],[8,42],[8,42],[8,43],[8,43],[8,44],[8,44],[7,21],[7,21],[7,21],[7,21],[7,28],[7,28],[7,28],[7,28],[8,61],[8,61],[8,62],[8,62],[8,63],[8,63],[8,0],[8,0],[8,320],[8,320],[8,384],[8,384],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[7,27],[7,27],[7,27],[7,27],[8,59],[8,59],[8,60],[8,60],[9,1472],[9,1536],[9,1600],[9,1728],[7,18],[7,18],[7,18],[7,18],[7,24],[7,24],[7,24],[7,24],[8,49],[8,49],[8,50],[8,50],[8,51],[8,51],[8,52],[8,52],[7,25],[7,25],[7,25],[7,25],[8,55],[8,55],[8,56],[8,56],[8,57],[8,57],[8,58],[8,58],[6,192],[6,192],[6,192],[6,192],[6,192],[6,192],[6,192],[6,192],[6,1664],[6,1664],[6,1664],[6,1664],[6,1664],[6,1664],[6,1664],[6,1664],[8,448],[8,448],[8,512],[8,512],[9,704],[9,768],[8,640],[8,640],[8,576],[8,576],[9,832],[9,896],[9,960],[9,1024],[9,1088],[9,1152],[9,1216],[9,1280],[9,1344],[9,1408],[7,256],[7,256],[7,256],[7,256],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[6,16],[6,16],[6,16],[6,16],[6,16],[6,16],[6,16],[6,16],[6,17],[6,17],[6,17],[6,17],[6,17],[6,17],[6,17],[6,17],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[6,14],[6,14],[6,14],[6,14],[6,14],[6,14],[6,14],[6,14],[6,15],[6,15],[6,15],[6,15],[6,15],[6,15],[6,15],[6,15],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7]],Je=[[-1,-1],[-1,-1],[12,-2],[12,-2],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[11,1792],[11,1792],[11,1792],[11,1792],[12,1984],[12,1984],[12,2048],[12,2048],[12,2112],[12,2112],[12,2176],[12,2176],[12,2240],[12,2240],[12,2304],[12,2304],[11,1856],[11,1856],[11,1856],[11,1856],[11,1920],[11,1920],[11,1920],[11,1920],[12,2368],[12,2368],[12,2432],[12,2432],[12,2496],[12,2496],[12,2560],[12,2560],[10,18],[10,18],[10,18],[10,18],[10,18],[10,18],[10,18],[10,18],[12,52],[12,52],[13,640],[13,704],[13,768],[13,832],[12,55],[12,55],[12,56],[12,56],[13,1280],[13,1344],[13,1408],[13,1472],[12,59],[12,59],[12,60],[12,60],[13,1536],[13,1600],[11,24],[11,24],[11,24],[11,24],[11,25],[11,25],[11,25],[11,25],[13,1664],[13,1728],[12,320],[12,320],[12,384],[12,384],[12,448],[12,448],[13,512],[13,576],[12,53],[12,53],[12,54],[12,54],[13,896],[13,960],[13,1024],[13,1088],[13,1152],[13,1216],[10,64],[10,64],[10,64],[10,64],[10,64],[10,64],[10,64],[10,64]],He=[[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[11,23],[11,23],[12,50],[12,51],[12,44],[12,45],[12,46],[12,47],[12,57],[12,58],[12,61],[12,256],[10,16],[10,16],[10,16],[10,16],[10,17],[10,17],[10,17],[10,17],[12,48],[12,49],[12,62],[12,63],[12,30],[12,31],[12,32],[12,33],[12,40],[12,41],[11,22],[11,22],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[9,15],[9,15],[9,15],[9,15],[9,15],[9,15],[9,15],[9,15],[12,128],[12,192],[12,26],[12,27],[12,28],[12,29],[11,19],[11,19],[11,20],[11,20],[12,34],[12,35],[12,36],[12,37],[12,38],[12,39],[11,21],[11,21],[12,42],[12,43],[10,0],[10,0],[10,0],[10,0],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12]],Ye=[[-1,-1],[-1,-1],[-1,-1],[-1,-1],[6,9],[6,8],[5,7],[5,7],[4,6],[4,6],[4,6],[4,6],[4,5],[4,5],[4,5],[4,5],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2]];class ve{constructor(A,e={}){if(!A||"function"!=typeof A.next)throw new Error('CCITTFaxDecoder - invalid "source" parameter.');let t;for(this.source=A,this.eof=!1,this.encoding=e.K||0,this.eoline=e.EndOfLine||!1,this.byteAlign=e.EncodedByteAlign||!1,this.columns=e.Columns||1728,this.rows=e.Rows||0,this.eoblock=e.EndOfBlock??!0,this.black=e.BlackIs1||!1,this.codingLine=new Uint32Array(this.columns+1),this.refLine=new Uint32Array(this.columns+2),this.codingLine[0]=this.columns,this.codingPos=0,this.row=0,this.nextLine2D=this.encoding<0,this.inputBits=0,this.inputBuf=0,this.outputBits=0,this.rowsDone=!1;0===(t=this._lookBits(12));)this._eatBits(1);1===t&&this._eatBits(12),this.encoding>0&&(this.nextLine2D=!this._lookBits(1),this._eatBits(1))}readNextChar(){if(this.eof)return-1;const A=this.refLine,e=this.codingLine,t=this.columns;let i,a,s,n,g;if(0===this.outputBits){if(this.rowsDone&&(this.eof=!0),this.eof)return-1;let s,g,r;if(this.err=!1,this.nextLine2D){for(n=0;e[n]=64);do{g+=r=this._getWhiteCode()}while(r>=64)}else{do{s+=r=this._getWhiteCode()}while(r>=64);do{g+=r=this._getBlackCode()}while(r>=64)}for(this._addPixels(e[this.codingPos]+s,a),e[this.codingPos]0?--i:++i;A[i]<=e[this.codingPos]&&A[i]0?--i:++i;A[i]<=e[this.codingPos]&&A[i]0?--i:++i;A[i]<=e[this.codingPos]&&A[i]=64);else do{s+=r=this._getWhiteCode()}while(r>=64);this._addPixels(e[this.codingPos]+s,a),a^=1}let o=!1;if(this.byteAlign&&(this.inputBits&=-8),this.eoblock||this.row!==this.rows-1){if(s=this._lookBits(12),this.eoline)for(;s!==xe&&1!==s;)this._eatBits(1),s=this._lookBits(12);else for(;0===s;)this._eatBits(1),s=this._lookBits(12);1===s?(this._eatBits(12),o=!0):s===xe&&(this.eof=!0)}else this.rowsDone=!0;if(!this.eof&&this.encoding>0&&!this.rowsDone&&(this.nextLine2D=!this._lookBits(1),this._eatBits(1)),this.eoblock&&o&&this.byteAlign){if(s=this._lookBits(12),1===s){if(this._eatBits(12),this.encoding>0&&(this._lookBits(1),this._eatBits(1)),this.encoding>=0)for(n=0;n<4;++n)s=this._lookBits(12),1!==s&&R("bad rtc code: "+s),this._eatBits(12),this.encoding>0&&(this._lookBits(1),this._eatBits(1));this.eof=!0}}else if(this.err&&this.eoline){for(;;){if(s=this._lookBits(13),s===xe)return this.eof=!0,-1;if(s>>1==1)break;this._eatBits(1)}this._eatBits(12),this.encoding>0&&(this._eatBits(1),this.nextLine2D=!(1&s))}this.outputBits=e[0]>0?e[this.codingPos=0]:e[this.codingPos=1],this.row++}if(this.outputBits>=8)g=1&this.codingPos?0:255,this.outputBits-=8,0===this.outputBits&&e[this.codingPos]s?(g<<=s,1&this.codingPos||(g|=255>>8-s),this.outputBits-=s,s=0):(g<<=this.outputBits,1&this.codingPos||(g|=255>>8-this.outputBits),s-=this.outputBits,this.outputBits=0,e[this.codingPos]0&&(g<<=s,s=0))}while(s)}return this.black&&(g^=255),g}_addPixels(A,e){const t=this.codingLine;let i=this.codingPos;A>t[i]&&(A>this.columns&&(R("row is wrong length"),this.err=!0,A=this.columns),1&i^e&&++i,t[i]=A),this.codingPos=i}_addPixelsNeg(A,e){const t=this.codingLine;let i=this.codingPos;if(A>t[i])A>this.columns&&(R("row is wrong length"),this.err=!0,A=this.columns),1&i^e&&++i,t[i]=A;else if(A0&&A=a){const e=t[A-a];if(e[0]===i)return this._eatBits(i),[!0,e[1],!0]}}return[!1,0,!1]}_getTwoDimCode(){let A,e=0;if(this.eoblock){if(e=this._lookBits(7),A=Ue[e],A?.[0]>0)return this._eatBits(A[0]),A[1]}else{const A=this._findTableCode(1,7,Ue);if(A[0]&&A[2])return A[1]}return R("Bad two dim code"),xe}_getWhiteCode(){let A,e=0;if(this.eoblock){if(e=this._lookBits(12),e===xe)return 1;if(A=e>>5?Le[e>>3]:Me[e],A[0]>0)return this._eatBits(A[0]),A[1]}else{let A=this._findTableCode(1,9,Le);if(A[0])return A[1];if(A=this._findTableCode(11,12,Me),A[0])return A[1]}return R("bad white code"),this._eatBits(1),1}_getBlackCode(){let A,e;if(this.eoblock){if(A=this._lookBits(13),A===xe)return 1;if(e=A>>7?!(A>>9)&&A>>7?He[(A>>1)-64]:Ye[A>>7]:Je[A],e[0]>0)return this._eatBits(e[0]),e[1]}else{let A=this._findTableCode(2,6,Ye);if(A[0])return A[1];if(A=this._findTableCode(7,12,He,64),A[0])return A[1];if(A=this._findTableCode(10,13,Je),A[0])return A[1]}return R("bad black code"),this._eatBits(1),1}_lookBits(A){let e;for(;this.inputBits>16-A;this.inputBuf=this.inputBuf<<8|e,this.inputBits+=8}return this.inputBuf>>this.inputBits-A&65535>>16-A}_eatBits(A){(this.inputBits-=A)<0&&(this.inputBits=0)}}class Ke extends Se{constructor(A,e,t){super(e),this.str=A,this.dict=A.dict,t instanceof BA||(t=BA.empty);const i={next:()=>A.getByte()};this.ccittFaxDecoder=new ve(i,{K:t.get("K"),EndOfLine:t.get("EndOfLine"),EncodedByteAlign:t.get("EncodedByteAlign"),Columns:t.get("Columns"),Rows:t.get("Rows"),EndOfBlock:t.get("EndOfBlock"),BlackIs1:t.get("BlackIs1")})}readBlock(){for(;!this.eof;){const A=this.ccittFaxDecoder.readNextChar();if(-1===A)return void(this.eof=!0);this.ensureBuffer(this.bufferLength+1),this.buffer[this.bufferLength++]=A}}}const qe=new Int32Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Te=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]),Pe=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]),We=[new Int32Array([459008,524368,524304,524568,459024,524400,524336,590016,459016,524384,524320,589984,524288,524416,524352,590048,459012,524376,524312,589968,459028,524408,524344,590032,459020,524392,524328,59e4,524296,524424,524360,590064,459010,524372,524308,524572,459026,524404,524340,590024,459018,524388,524324,589992,524292,524420,524356,590056,459014,524380,524316,589976,459030,524412,524348,590040,459022,524396,524332,590008,524300,524428,524364,590072,459009,524370,524306,524570,459025,524402,524338,590020,459017,524386,524322,589988,524290,524418,524354,590052,459013,524378,524314,589972,459029,524410,524346,590036,459021,524394,524330,590004,524298,524426,524362,590068,459011,524374,524310,524574,459027,524406,524342,590028,459019,524390,524326,589996,524294,524422,524358,590060,459015,524382,524318,589980,459031,524414,524350,590044,459023,524398,524334,590012,524302,524430,524366,590076,459008,524369,524305,524569,459024,524401,524337,590018,459016,524385,524321,589986,524289,524417,524353,590050,459012,524377,524313,589970,459028,524409,524345,590034,459020,524393,524329,590002,524297,524425,524361,590066,459010,524373,524309,524573,459026,524405,524341,590026,459018,524389,524325,589994,524293,524421,524357,590058,459014,524381,524317,589978,459030,524413,524349,590042,459022,524397,524333,590010,524301,524429,524365,590074,459009,524371,524307,524571,459025,524403,524339,590022,459017,524387,524323,589990,524291,524419,524355,590054,459013,524379,524315,589974,459029,524411,524347,590038,459021,524395,524331,590006,524299,524427,524363,590070,459011,524375,524311,524575,459027,524407,524343,590030,459019,524391,524327,589998,524295,524423,524359,590062,459015,524383,524319,589982,459031,524415,524351,590046,459023,524399,524335,590014,524303,524431,524367,590078,459008,524368,524304,524568,459024,524400,524336,590017,459016,524384,524320,589985,524288,524416,524352,590049,459012,524376,524312,589969,459028,524408,524344,590033,459020,524392,524328,590001,524296,524424,524360,590065,459010,524372,524308,524572,459026,524404,524340,590025,459018,524388,524324,589993,524292,524420,524356,590057,459014,524380,524316,589977,459030,524412,524348,590041,459022,524396,524332,590009,524300,524428,524364,590073,459009,524370,524306,524570,459025,524402,524338,590021,459017,524386,524322,589989,524290,524418,524354,590053,459013,524378,524314,589973,459029,524410,524346,590037,459021,524394,524330,590005,524298,524426,524362,590069,459011,524374,524310,524574,459027,524406,524342,590029,459019,524390,524326,589997,524294,524422,524358,590061,459015,524382,524318,589981,459031,524414,524350,590045,459023,524398,524334,590013,524302,524430,524366,590077,459008,524369,524305,524569,459024,524401,524337,590019,459016,524385,524321,589987,524289,524417,524353,590051,459012,524377,524313,589971,459028,524409,524345,590035,459020,524393,524329,590003,524297,524425,524361,590067,459010,524373,524309,524573,459026,524405,524341,590027,459018,524389,524325,589995,524293,524421,524357,590059,459014,524381,524317,589979,459030,524413,524349,590043,459022,524397,524333,590011,524301,524429,524365,590075,459009,524371,524307,524571,459025,524403,524339,590023,459017,524387,524323,589991,524291,524419,524355,590055,459013,524379,524315,589975,459029,524411,524347,590039,459021,524395,524331,590007,524299,524427,524363,590071,459011,524375,524311,524575,459027,524407,524343,590031,459019,524391,524327,589999,524295,524423,524359,590063,459015,524383,524319,589983,459031,524415,524351,590047,459023,524399,524335,590015,524303,524431,524367,590079]),9],Ze=[new Int32Array([327680,327696,327688,327704,327684,327700,327692,327708,327682,327698,327690,327706,327686,327702,327694,0,327681,327697,327689,327705,327685,327701,327693,327709,327683,327699,327691,327707,327687,327703,327695,0]),5];class Oe extends Se{constructor(A,e){super(e),this.str=A,this.dict=A.dict;const t=A.getByte(),i=A.getByte();if(-1===t||-1===i)throw new q(`Invalid header in flate stream: ${t}, ${i}`);if(8!=(15&t))throw new q(`Unknown compression method in flate stream: ${t}, ${i}`);if(((t<<8)+i)%31!=0)throw new q(`Bad FCHECK in flate stream: ${t}, ${i}`);if(32&i)throw new q(`FDICT bit set in flate stream: ${t}, ${i}`);this.codeSize=0,this.codeBuf=0}async getImageData(A,e){const t=await this.asyncGetBytes();return t?.subarray(0,A)||this.getBytes(A)}async asyncGetBytes(){this.str.reset();const A=this.str.getBytes();try{const{readable:e,writable:t}=new DecompressionStream("deflate"),i=t.getWriter();i.write(A),i.close();const a=[];let s=0;for await(const A of e)a.push(A),s+=A.byteLength;const n=new Uint8Array(s);let g=0;for(const A of a)n.set(A,g),g+=A.byteLength;return n}catch{return this.str=new se(A,2,A.length,this.str.dict),this.reset(),null}}get isAsync(){return!0}getBits(A){const e=this.str;let t,i=this.codeSize,a=this.codeBuf;for(;i>A,this.codeSize=i-=A,t}getCode(A){const e=this.str,t=A[0],i=A[1];let a,s=this.codeSize,n=this.codeBuf;for(;s>16,o=65535&g;if(r<1||s>r,this.codeSize=s-r,o}generateHuffmanTable(A){const e=A.length;let t,i=0;for(t=0;ti&&(i=A[t]);const a=1<>=1;for(t=A;t>=1,0===e){let e;if(-1===(e=i.getByte()))return void this.#m("Bad block header in flate stream");let t=e;if(-1===(e=i.getByte()))return void this.#m("Bad block header in flate stream");if(t|=e<<8,-1===(e=i.getByte()))return void this.#m("Bad block header in flate stream");let a=e;if(-1===(e=i.getByte()))return void this.#m("Bad block header in flate stream");if(a|=e<<8,a!==(65535&~t)&&(0!==t||0!==a))throw new q("Bad uncompressed block length in flate stream");this.codeBuf=0,this.codeSize=0;const s=this.bufferLength,n=s+t;if(A=this.ensureBuffer(n),this.bufferLength=n,0===t)-1===i.peekByte()&&(this.eof=!0);else{const e=i.getBytes(t);A.set(e,s),e.length0;)I[g++]=B}a=this.generateHuffmanTable(I.subarray(0,A)),s=this.generateHuffmanTable(I.subarray(A,o))}}A=this.buffer;let n=A?A.length:0,g=this.bufferLength;for(;;){let e=this.getCode(a);if(e<256){g+1>=n&&(A=this.ensureBuffer(g+1),n=A.length),A[g++]=e;continue}if(256===e)return void(this.bufferLength=g);e-=257,e=Te[e];let i=e>>16;i>0&&(i=this.getBits(i)),t=(65535&e)+i,e=this.getCode(s),e=Pe[e],i=e>>16,i>0&&(i=this.getBits(i));const r=(65535&e)+i;g+t>=n&&(A=this.ensureBuffer(g+t),n=A.length);for(let e=0;e>9&127,this.clow=this.clow<<7&65535,this.ct-=7,this.a=32768}byteIn(){const A=this.data;let e=this.bp;255===A[e]?A[e+1]>143?(this.clow+=65280,this.ct=8):(e++,this.clow+=A[e]<<9,this.ct=7,this.bp=e):(e++,this.clow+=e65535&&(this.chigh+=this.clow>>16,this.clow&=65535)}readBit(A,e){let t=A[e]>>1,i=1&A[e];const a=Xe[t],s=a.qe;let n,g=this.a-s;if(this.chigh>15&1,this.clow=this.clow<<1&65535,this.ct--}while(!(32768&g));return this.a=g,A[e]=t<<1|i,n}}class je extends L{constructor(A){super(A,"Jbig2Error")}}class ze{getContexts(A){return A in this?this[A]:this[A]=new Int8Array(65536)}}class _e{constructor(A,e,t){this.data=A,this.start=e,this.end=t}get decoder(){return M(this,"decoder",new Ve(this.data,this.start,this.end))}get contextCache(){return M(this,"contextCache",new ze)}}const $e=2**31-1,At=-(2**31);function et(A,e,t){const i=A.getContexts(e);let a=1;function s(A){let e=0;for(let s=0;s>>0}const n=s(1),g=s(1)?s(1)?s(1)?s(1)?s(1)?s(32)+4436:s(12)+340:s(8)+84:s(6)+20:s(4)+4:s(2);let r;return 0===n?r=g:g>0&&(r=-g),r>=At&&r<=$e?r:null}function tt(A,e,t){const i=A.getContexts("IAID");let a=1;for(let A=0;A=w&&N=D)for(H=H<<1&l,Q=0;Q=0&&U=0&&(M=S[x][U],M&&(H|=M<=A?o<<=1:o=o<<1|p[g][r];for(B=0;B=d||r<0||r>=u?o<<=1:o=o<<1|i[g][r];const h=m.readBit(y,o);e[n]=h}}return p}function It(A,e,t,i,a,s,n,g,r,o,I,c,C,B,h,Q,l,E,u){if(A&&e)throw new je("refinement with Huffman is not supported");const d=[];let f,p;for(f=0;f1&&(a=A?u.readBits(E):et(y,"IAIT",m));const s=n*w+a,D=A?B.symbolIDTable.decode(u):tt(y,m,r),b=e&&(A?u.readBit():et(y,"IARI",m));let k=g[D],F=k[0].length,S=k.length;if(b){const A=et(y,"IARDW",m),e=et(y,"IARDH",m);F+=A,S+=e,k=ot(F,S,h,k,(A>>1)+et(y,"IARDX",m),(e>>1)+et(y,"IARDY",m),!1,Q,l)}let R=0;o?1&c?R=S-1:i+=S-1:c>1?i+=F-1:R=F-1;const G=s-(1&c?0:S-1),N=i-(2&c?F-1:0);let x,U,M;if(o)for(x=0;x>5&7;const r=[31&n];let o=e+6;if(7===n){g=536870911&MA(A,o-1),o+=3;let e=g+7>>3;for(r[0]=A[o++];--e>0;)r.push(A[o++])}else if(5===n||6===n)throw new je("invalid referred-to flags");t.retainBits=r;let I=4;t.number<=256?I=1:t.number<=65536&&(I=2);const c=[];let C,B;for(C=0;C>>24&255,s[3]=e.height>>16&255,s[4]=e.height>>8&255,s[5]=255&e.height,C=o,B=A.length;C>2&3,A.huffmanDWSelector=e>>4&3,A.bitmapSizeSelector=e>>6&1,A.aggregationInstancesSelector=e>>7&1,A.bitmapCodingContextUsed=!!(256&e),A.bitmapCodingContextRetained=!!(512&e),A.template=e>>10&3,A.refinementTemplate=e>>12&1,o+=2,!A.huffman){for(r=0===A.template?4:1,n=[],g=0;g>2&3,I.stripSize=1<>4&3,I.transposed=!!(64&c),I.combinationOperator=c>>7&3,I.defaultPixelValue=c>>9&1,I.dsOffset=c<<17>>27,I.refinementTemplate=c>>15&1,I.huffman){const A=UA(i,o);o+=2,I.huffmanFS=3&A,I.huffmanDS=A>>2&3,I.huffmanDT=A>>4&3,I.huffmanRefinementDW=A>>6&3,I.huffmanRefinementDH=A>>8&3,I.huffmanRefinementDX=A>>10&3,I.huffmanRefinementDY=A>>12&3,I.huffmanRefinementSizeSelector=!!(16384&A)}if(I.refinement&&!I.refinementTemplate){for(n=[],g=0;g<2;g++)n.push({x:xA(i,o),y:xA(i,o+1)}),o+=2;I.refinementAt=n}I.numberOfSymbolInstances=MA(i,o),o+=4,s=[I,t.referredTo,i,o,a];break;case 16:const C={},B=i[o++];C.mmr=!!(1&B),C.template=B>>1&3,C.patternWidth=i[o++],C.patternHeight=i[o++],C.maxPatternIndex=MA(i,o),o+=4,s=[C,t.number,i,o,a];break;case 22:case 23:const h={};h.info=Bt(i,o),o+=ht;const Q=i[o++];h.mmr=!!(1&Q),h.template=Q>>1&3,h.enableSkip=!!(8&Q),h.combinationOperator=Q>>4&7,h.defaultPixelValue=Q>>7&1,h.gridWidth=MA(i,o),o+=4,h.gridHeight=MA(i,o),o+=4,h.gridOffsetX=4294967295&MA(i,o),o+=4,h.gridOffsetY=4294967295&MA(i,o),o+=4,h.gridVectorX=UA(i,o),o+=2,h.gridVectorY=UA(i,o),o+=2,s=[h,t.referredTo,i,o,a];break;case 38:case 39:const l={};l.info=Bt(i,o),o+=ht;const E=i[o++];if(l.mmr=!!(1&E),l.template=E>>1&3,l.prediction=!!(8&E),!l.mmr){for(r=0===l.template?4:1,n=[],g=0;g>2&1,u.combinationOperator=d>>3&3,u.requiresBuffer=!!(32&d),u.combinationOperatorOverride=!!(64&d),s=[u];break;case 49:case 50:case 51:case 62:break;case 53:s=[t.number,i,o,a];break;default:throw new je(`segment type ${t.typeName}(${t.type}) is not implemented`)}const I="on"+t.typeName;I in e&&e[I].apply(e,s)}function lt(A,e){for(let t=0,i=A.length;t>3,t=new Uint8ClampedArray(e*A.height);A.defaultPixelValue&&t.fill(255),this.buffer=t}drawBitmap(A,e){const t=this.currentPageInfo,i=A.width,a=A.height,s=t.width+7>>3,n=t.combinationOperatorOverride?A.combinationOperator:t.combinationOperator,g=this.buffer,r=128>>(7&A.x);let o,I,c,C,B=A.y*s+(A.x>>3);switch(n){case 0:for(o=0;o>=1,c||(c=128,C++);B+=s}break;case 2:for(o=0;o>=1,c||(c=128,C++);B+=s}break;default:throw new je(`operator ${n} is not supported`)}}onImmediateGenericRegion(A,e,t,i){const a=A.info,s=new _e(e,t,i),n=rt(A.mmr,a.width,a.height,A.template,A.prediction,null,A.at,s);this.drawBitmap(a,n)}onImmediateLosslessGenericRegion(){this.onImmediateGenericRegion(...arguments)}onSymbolDictionary(A,e,t,i,a,s){let n,g;A.huffman&&(n=function(A,e,t){let i,a,s,n,g=0;switch(A.huffmanDHSelector){case 0:case 1:i=mt(A.huffmanDHSelector+4);break;case 3:i=wt(g,e,t),g++;break;default:throw new je("invalid Huffman DH selector")}switch(A.huffmanDWSelector){case 0:case 1:a=mt(A.huffmanDWSelector+2);break;case 3:a=wt(g,e,t),g++;break;default:throw new je("invalid Huffman DW selector")}return A.bitmapSizeSelector?(s=wt(g,e,t),g++):s=mt(1),n=A.aggregationInstancesSelector?wt(g,e,t):mt(1),{tableDeltaHeight:i,tableDeltaWidth:a,tableBitmapSize:s,tableAggregateInstances:n}}(A,t,this.customTables),g=new yt(i,a,s));let r=this.symbols;r||(this.symbols=r={});const o=[];for(const A of t){const e=r[A];e&&o.push(...e)}const I=new _e(i,a,s);r[e]=function(A,e,t,i,a,s,n,g,r,o,I,c){if(A&&e)throw new je("symbol refinement with Huffman is not supported");const C=[];let B=0,h=NA(t.length+i);const Q=I.decoder,l=I.contextCache;let E,u;for(A&&(E=mt(1),u=[],h=Math.max(h,1));C.length1)d=It(A,e,i,B,0,a,1,t.concat(C),h,0,0,1,0,s,r,o,I,0,c);else{const A=tt(l,Q,h),e=et(l,"IARDX",Q),a=et(l,"IARDY",Q);d=ot(i,B,r,A=32){let t,i,n;switch(e){case 32:if(0===A)throw new je("no previous value in symbol ID table");i=a.readBits(2)+3,t=s[A-1].prefixLength;break;case 33:i=a.readBits(3)+3,t=0;break;case 34:i=a.readBits(7)+11,t=0;break;default:throw new je("invalid code length in symbol ID table")}for(n=0;n=0;l--)k=A?bt(b,r,o,!0):rt(!1,r,o,t,!1,null,w,h),D[l]=k;for(F=0;F=0;E--)R^=D[E][F][S],G|=R<>8,U=c+F*C-S*B>>8,x>=0&&x+p<=i&&U>=0&&U+m<=a)for(l=0;l=a))for(L=Q[e],M=N[l],E=0;E=0&&A>1&7),r=1+(i>>4&7),o=[];let I,c,C=a;do{I=n.readBits(g),c=n.readBits(r),o.push(new ut([C,I,c,0])),C+=1<>e&1;if(e<=0)this.children[t]=new dt(A);else{let i=this.children[t];i||(this.children[t]=i=new dt(null)),i.buildTree(A,e-1)}}decodeNode(A){if(this.isLeaf){if(this.isOOB)return null;const e=A.readBits(this.rangeLength);return this.rangeLow+(this.isLowerRange?-e:e)}const e=this.children[A.readBit()];if(!e)throw new je("invalid Huffman data");return e.decodeNode(A)}}class ft{constructor(A,e){e||this.assignPrefixCodes(A),this.rootNode=new dt(null);for(let e=0,t=A.length;e0&&this.rootNode.buildTree(t,t.prefixLength-1)}}decode(A){return this.rootNode.decodeNode(A)}assignPrefixCodes(A){const e=A.length;let t=0;for(let i=0;i=this.end)throw new je("end of data while reading bit");this.currentByte=this.data[this.position++],this.shift=7}const A=this.currentByte>>this.shift&1;return this.shift--,A}readBits(A){let e,t=0;for(e=A-1;e>=0;e--)t|=this.readBit()<=this.end?-1:this.data[this.position++]}}function wt(A,e,t){let i=0;for(let a=0,s=e.length;a>t&1,t--}if(i&&!g){const A=5;for(let e=0;e>3,c=7&i,C=A.length;t=new Uint32Array(t.buffer);let B=0;for(let i=0;i0&&!A[s-1];)s--;const n=[{children:[],index:0}];let g,r=n[0];for(t=0;t0;)r=n.pop();for(r.index++,n.push(r);n.length<=t;)n.push(g={children:[],index:0}),r.children[r.index]=g.children,r=g;a++}t+10)return h--,B>>h&1;if(B=A[e++],255===B){const i=A[e++];if(i){if(220===i&&o){const i=UA(A,e+=2);if(e+=2,i>0&&i!==t.scanLines)throw new Gt("Found DNL marker (0xFFDC) while parsing scan data",i)}else if(217===i){if(o){const A=m*(8===t.precision?8:0);if(A>0&&Math.round(t.scanLines/A)>=5)throw new Gt("Found EOI marker (0xFFD9) while parsing scan data, possibly caused by incorrect `scanLines` parameter",A)}throw new Nt("Found EOI marker (0xFFD9) while parsing scan data")}throw new Rt(`unexpected marker ${(B<<8|i).toString(16)}`)}}return h=7,B>>>7}function l(A){let e=A;for(;;){switch(e=e[Q()],typeof e){case"number":return e;case"object":continue}throw new Rt("invalid huffman sequence")}}function E(A){let e=0;for(;A>0;)e=e<<1|Q(),A--;return e}function u(A){if(1===A)return 1===Q()?1:-1;const e=E(A);return e>=1<0)return void f--;let t=s;const i=n;for(;t<=i;){const i=l(A.huffmanTableAC),a=15&i,s=i>>4;if(0===a){if(s<15){f=E(s)+(1<>4,0===a)o<15?(f=E(o)+(1<>4;if(0===i){if(s<15)break;a+=16;continue}a+=s;const n=xt[a];A.blockData[e+n]=u(i),a++}};let x,U=0;const M=1===D?i[0].blocksPerLine*i[0].blocksPerColumn:I*t.mcusPerColumn;let L,J;for(;U<=M;){const t=a?Math.min(M-U,a):M;if(t>0){for(k=0;k0?"unexpected":"excessive"} MCU data, current marker is: ${x.invalid}`),e=x.offset),!(x.marker>=65488&&x.marker<=65495))break;e+=2}return e-C}function Wt(A,e,t){const i=A.quantizationTable,a=A.blockData;let s,n,g,r,o,I,c,C,B,h,Q,l,E,u,d,f,p;if(!i)throw new Rt("missing required Quantization Table.");for(let A=0;A<64;A+=8)B=a[e+A],h=a[e+A+1],Q=a[e+A+2],l=a[e+A+3],E=a[e+A+4],u=a[e+A+5],d=a[e+A+6],f=a[e+A+7],B*=i[A],h|Q|l|E|u|d|f?(h*=i[A+1],Q*=i[A+2],l*=i[A+3],E*=i[A+4],u*=i[A+5],d*=i[A+6],f*=i[A+7],s=vt*B+128>>8,n=vt*E+128>>8,g=Q,r=d,o=Kt*(h-f)+128>>8,C=Kt*(h+f)+128>>8,I=l<<4,c=u<<4,s=s+n+1>>1,n=s-n,p=g*Yt+r*Ht+128>>8,g=g*Ht-r*Yt+128>>8,r=p,o=o+c+1>>1,c=o-c,C=C+I+1>>1,I=C-I,s=s+r+1>>1,r=s-r,n=n+g+1>>1,g=n-g,p=o*Jt+C*Lt+2048>>12,o=o*Lt-C*Jt+2048>>12,C=p,p=I*Mt+c*Ut+2048>>12,I=I*Ut-c*Mt+2048>>12,c=p,t[A]=s+C,t[A+7]=s-C,t[A+1]=n+c,t[A+6]=n-c,t[A+2]=g+I,t[A+5]=g-I,t[A+3]=r+o,t[A+4]=r-o):(p=vt*B+512>>10,t[A]=p,t[A+1]=p,t[A+2]=p,t[A+3]=p,t[A+4]=p,t[A+5]=p,t[A+6]=p,t[A+7]=p);for(let A=0;A<8;++A)B=t[A],h=t[A+8],Q=t[A+16],l=t[A+24],E=t[A+32],u=t[A+40],d=t[A+48],f=t[A+56],h|Q|l|E|u|d|f?(s=vt*B+2048>>12,n=vt*E+2048>>12,g=Q,r=d,o=Kt*(h-f)+2048>>12,C=Kt*(h+f)+2048>>12,I=l,c=u,s=4112+(s+n+1>>1),n=s-n,p=g*Yt+r*Ht+2048>>12,g=g*Ht-r*Yt+2048>>12,r=p,o=o+c+1>>1,c=o-c,C=C+I+1>>1,I=C-I,s=s+r+1>>1,r=s-r,n=n+g+1>>1,g=n-g,p=o*Jt+C*Lt+2048>>12,o=o*Lt-C*Jt+2048>>12,C=p,p=I*Mt+c*Ut+2048>>12,I=I*Ut-c*Mt+2048>>12,c=p,B=s+C,f=s-C,h=n+c,d=n-c,Q=g+I,u=g-I,l=r+o,E=r-o,B<16?B=0:B>=4080?B=255:B>>=4,h<16?h=0:h>=4080?h=255:h>>=4,Q<16?Q=0:Q>=4080?Q=255:Q>>=4,l<16?l=0:l>=4080?l=255:l>>=4,E<16?E=0:E>=4080?E=255:E>>=4,u<16?u=0:u>=4080?u=255:u>>=4,d<16?d=0:d>=4080?d=255:d>>=4,f<16?f=0:f>=4080?f=255:f>>=4,a[e+A]=B,a[e+A+8]=h,a[e+A+16]=Q,a[e+A+24]=l,a[e+A+32]=E,a[e+A+40]=u,a[e+A+48]=d,a[e+A+56]=f):(p=vt*B+8192>>14,p=p<-2040?0:p>=2024?255:p+2056>>4,a[e+A]=p,a[e+A+8]=p,a[e+A+16]=p,a[e+A+24]=p,a[e+A+32]=p,a[e+A+40]=p,a[e+A+48]=p,a[e+A+56]=p)}function Zt(A,e){const t=e.blocksPerLine,i=e.blocksPerColumn,a=new Int16Array(64);for(let A=0;A=i)return null;const s=UA(A,e);if(s>=65472&&s<=65534)return{invalid:null,marker:s,offset:e};let n=UA(A,a);for(;!(n>=65472&&n<=65534);){if(++a>=i)return null;n=UA(A,a)}return{invalid:s.toString(16),marker:n,offset:a}}class Xt{constructor({decodeTransform:A=null,colorTransform:e=-1}={}){this._decodeTransform=A,this._colorTransform=e}parse(A,{dnlScanLines:e=null}={}){function t(){const e=UA(A,n);n+=2;let t=n+e-2;const i=Ot(A,t,n);i?.invalid&&(G("readDataBlock - incorrect length, current marker is: "+i.invalid),t=i.offset);const a=A.subarray(n,t);return n+=a.length,a}function i(A){const e=Math.ceil(A.samplesPerLine/8/A.maxH),t=Math.ceil(A.scanLines/8/A.maxV);for(const i of A.components){const a=Math.ceil(Math.ceil(A.samplesPerLine/8)*i.h/A.maxH),s=Math.ceil(Math.ceil(A.scanLines/8)*i.v/A.maxV),n=e*i.h,g=t*i.v*64*(n+1);i.blockData=new Int16Array(g),i.blocksPerLine=a,i.blocksPerColumn=s}A.mcusPerLine=e,A.mcusPerColumn=t}let a,s,n=0,g=null,r=null,o=0;const I=[],c=[],C=[];let B=UA(A,n);if(n+=2,65496!==B)throw new Rt("SOI not found");B=UA(A,n),n+=2;A:for(;65497!==B;){let h,Q,l;switch(B){case 65504:case 65505:case 65506:case 65507:case 65508:case 65509:case 65510:case 65511:case 65512:case 65513:case 65514:case 65515:case 65516:case 65517:case 65518:case 65519:case 65534:const E=t();65504===B&&74===E[0]&&70===E[1]&&73===E[2]&&70===E[3]&&0===E[4]&&(g={version:{major:E[5],minor:E[6]},densityUnits:E[7],xDensity:E[8]<<8|E[9],yDensity:E[10]<<8|E[11],thumbWidth:E[12],thumbHeight:E[13],thumbData:E.subarray(14,14+3*E[12]*E[13])}),65518===B&&65===E[0]&&100===E[1]&&111===E[2]&&98===E[3]&&101===E[4]&&(r={version:E[5]<<8|E[6],flags0:E[7]<<8|E[8],flags1:E[9]<<8|E[10],transformCode:E[11]});break;case 65499:const u=UA(A,n);n+=2;const d=u+n-2;let f;for(;n>4){if(e>>4!=1)throw new Rt("DQT - invalid table spec");for(Q=0;Q<64;Q++)f=xt[Q],t[f]=UA(A,n),n+=2}else for(Q=0;Q<64;Q++)f=xt[Q],t[f]=A[n++];I[15&e]=t}break;case 65472:case 65473:case 65474:if(a)throw new Rt("Only single frame JPEGs supported");n+=2,a={},a.extended=65473===B,a.progressive=65474===B,a.precision=A[n++];const p=UA(A,n);n+=2,a.scanLines=e||p,a.samplesPerLine=UA(A,n),n+=2,a.components=[],a.componentIds={};const m=A[n++];let y=0,w=0;for(h=0;h>4,i=15&A[n+1];y>4?c:C)[15&e]=qt(t,a)}break;case 65501:n+=2,s=UA(A,n),n+=2;break;case 65498:const b=1==++o&&!e;n+=2;const k=A[n++],F=[];for(h=0;h>4],i.huffmanTableAC=c[15&s],F.push(i)}const S=A[n++],R=A[n++],N=A[n++];try{const e=Pt(A,n,a,F,s,S,R,N>>4,15&N,b);n+=e}catch(e){if(e instanceof Gt)return G(`${e.message} -- attempting to re-parse the JPEG image.`),this.parse(A,{dnlScanLines:e.scanLines});if(e instanceof Nt){G(`${e.message} -- ignoring the rest of the image data.`);break A}throw e}break;case 65500:n+=4;break;case 65535:255!==A[n]&&n--;break;default:const x=Ot(A,n-2,n-3);if(x?.invalid){G("JpegImage.parse - unexpected data, current marker is: "+x.invalid),n=x.offset;break}if(!x||n>=A.length-1){G("JpegImage.parse - reached the end of the image data without finding an EOI marker (0xFFD9).");break A}throw new Rt("JpegImage.parse - unknown marker: "+B.toString(16))}B=UA(A,n),n+=2}if(!a)throw new Rt("JpegImage.parse - no frame data found.");this.width=a.samplesPerLine,this.height=a.scanLines,this.jfif=g,this.adobe=r,this.components=[];for(const A of a.components){const e=I[A.quantizationId];e&&(A.quantizationTable=e),this.components.push({index:A.index,output:Zt(0,A),scaleX:A.h/a.maxH,scaleY:A.v/a.maxV,blocksPerLine:A.blocksPerLine,blocksPerColumn:A.blocksPerColumn})}this.numComponents=this.components.length}_getLinearizedBlockData(A,e,t=!1){const i=this.width/A,a=this.height/e;let s,n,g,r,o,I,c,C,B,h,Q,l=0;const E=this.components.length,u=A*e*E,d=new Uint8ClampedArray(u),f=new Uint32Array(A),p=4294967288;let m;for(c=0;c>8)+y[B+1];return d}get _isColorConversionNeeded(){return this.adobe?!!this.adobe.transformCode:3===this.numComponents?0!==this._colorTransform&&(82!==this.components[0].index||71!==this.components[1].index||66!==this.components[2].index):1===this._colorTransform}_convertYccToRgb(A){let e,t,i;for(let a=0,s=A.length;a4)throw new Rt("Unsupported color mode");const s=this._getLinearizedBlockData(A,e,a);if(1===this.numComponents&&(t||i)){const A=s.length*(t?4:3),e=new Uint8ClampedArray(A);let i=0;if(t)!function(A,e){if(X.isLittleEndian)for(let t=0,i=A.length;t0&&(A=A.subarray(e));break}const e={decodeTransform:void 0,colorTransform:void 0},t=this.dict.getArray("D","Decode");if((this.forceRGBA||this.forceRGB)&&Array.isArray(t)){const A=this.dict.get("BPC","BitsPerComponent")||8,i=t.length,a=new Int32Array(i);let s=!1;const n=(1<{e=A,t=i})),i.decode=function(A,{numComponents:e=4,isIndexedColormap:t=!1,smaskInData:a=!1}){const s=A.length,n=i._malloc(s);i.HEAPU8.set(A,n);const g=i._jp2_decode(n,s,e>0?e:0,!!t,!!a);if(i._free(n),g){const{errorMessages:A}=i;return A?(delete i.errorMessages,A):"Unknown error"}const{imageData:r}=i;return i.imageData=null,r};var a=Object.assign({},i),s="./this.program",n="";"undefined"!=typeof document&&document.currentScript&&(n=document.currentScript.src),jt&&(n=jt),n=n.startsWith("blob:")?"":n.substr(0,n.replace(/[?#].*/,"").lastIndexOf("/")+1);var g,r,o,I,c,C=i.print||console.log.bind(console),B=i.printErr||console.error.bind(console);function h(){var A=r.buffer;i.HEAP8=o=new Int8Array(A),i.HEAP16=new Int16Array(A),i.HEAPU8=I=new Uint8Array(A),i.HEAPU16=new Uint16Array(A),i.HEAP32=new Int32Array(A),i.HEAPU32=c=new Uint32Array(A),i.HEAPF32=new Float32Array(A),i.HEAPF64=new Float64Array(A)}Object.assign(i,a),a=null,i.arguments&&i.arguments,i.thisProgram&&(s=i.thisProgram),i.quit&&i.quit,i.wasmBinary&&(g=i.wasmBinary);var Q,l=[],E=[],u=[],d=0,f=null,p=null,m="data:application/octet-stream;base64,",y=A=>A.startsWith(m);function w(A,e){var t,i=function(A){if(A==Q&&g)return new Uint8Array(g);var e=function(A){if(y(A))return function(A){for(var e=atob(A),t=new Uint8Array(e.length),i=0;i{for(;A.length>0;)A.shift()(i)};i.noExitRuntime;var b,k=A=>{var e=(A-r.buffer.byteLength+65535)/65536;try{return r.grow(e),h(),1}catch(A){}},F={},S=()=>{if(!S.strings){var A={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:("object"==typeof navigator&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:s||"./this.program"};for(var e in F)void 0===F[e]?delete A[e]:A[e]=F[e];var t=[];for(var e in A)t.push(`${e}=${A[e]}`);S.strings=t}return S.strings},R=[null,[],[]],G="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0,N=(A,e,t)=>{for(var i=e+t,a=e;A[a]&&!(a>=i);)++a;if(a-e>16&&A.buffer&&G)return G.decode(A.subarray(e,a));for(var s="";e>10,56320|1023&o)}}else s+=String.fromCharCode((31&n)<<6|g)}else s+=String.fromCharCode(n)}return s},x=(A,e)=>A?N(I,A,e):"",U={c:(A,e,t)=>I.copyWithin(A,e,e+t),g:function(A,e){A>>=2;const t=i.imageData=new Uint8ClampedArray(e),a=i.HEAP32.subarray(A,A+e);t.set(a)},f:function(A,e,t,a){A>>=2,e>>=2,t>>=2;const s=i.imageData=new Uint8ClampedArray(3*a),n=i.HEAP32.subarray(A,A+a),g=i.HEAP32.subarray(e,e+a),r=i.HEAP32.subarray(t,t+a);for(let A=0;A>=2,e>>=2,t>>=2,a>>=2;const n=i.imageData=new Uint8ClampedArray(4*s),g=i.HEAP32.subarray(A,A+s),r=i.HEAP32.subarray(e,e+s),o=i.HEAP32.subarray(t,t+s),I=i.HEAP32.subarray(a,a+s);for(let A=0;A{var e=I.length,t=2147483648;if((A>>>=0)>t)return!1;for(var i,a=1;a<=4;a*=2){var s=e*(1+.2/a);s=Math.min(s,A+100663296);var n=Math.min(t,(i=Math.max(A,s))+(65536-i%65536)%65536);if(k(n))return!0}return!1},l:(A,e)=>{var t=0;return S().forEach(((i,a)=>{var s=e+t;c[A+4*a>>2]=s,((A,e)=>{for(var t=0;t{var t=S();c[A>>2]=t.length;var i=0;return t.forEach((A=>i+=A.length+1)),c[e>>2]=i,0},n:A=>52,j:function(A,e,t,i,a){return 70},b:(A,e,t,i)=>{for(var a,s,n,g=0,r=0;r>2],h=c[e+4>>2];e+=8;for(var Q=0;Q>2]=g,0},o:function(A,e){A>>=2;const t=i.imageData=new Uint8ClampedArray(4*e),a=i.HEAP32.subarray(A,A+e);for(let A=0;A>=2,e>>=2;const a=i.imageData=new Uint8ClampedArray(4*t),s=i.HEAP32.subarray(A,A+t),n=i.HEAP32.subarray(e,e+t);for(let A=0;A>=2,e>>=2,t>>=2;const s=i.imageData=new Uint8ClampedArray(4*a),n=i.HEAP32.subarray(A,A+a),g=i.HEAP32.subarray(e,e+a),r=i.HEAP32.subarray(t,t+a);for(let A=0;A0||(function(){if(i.preRun)for("function"==typeof i.preRun&&(i.preRun=[i.preRun]);i.preRun.length;)A=i.preRun.shift(),l.unshift(A);var A;D(l)}(),d>0||(i.setStatus?(i.setStatus("Running..."),setTimeout((function(){setTimeout((function(){i.setStatus("")}),1),A()}),1)):A()))}if(M.q,i._malloc=M.r,i._free=M.s,i._jp2_decode=M.u,p=function A(){b||L(),b||(p=A)},i.preInit)for("function"==typeof i.preInit&&(i.preInit=[i.preInit]);i.preInit.length>0;)i.preInit.pop()();return L(),i});const _t=zt;class $t extends L{constructor(A){super(A,"JpxError")}}class Ai{static#y=null;static decode(A,e){e||={},this.#y||=_t({warn:G});const t=this.#y.decode(A,e);if("string"==typeof t)throw new $t(t);return t}static cleanup(){this.#y=null}static parseImageProperties(A){let e=A.getByte();for(;e>=0;){const t=e;if(e=A.getByte(),65361==(t<<8|e)){A.skip(4);const e=A.getInt32()>>>0,t=A.getInt32()>>>0,i=A.getInt32()>>>0,a=A.getInt32()>>>0;return A.skip(16),{width:e-i,height:t-a,bitsPerComponent:8,componentsCount:A.getUint16()}}}throw new $t("No size marker found in JPX stream")}}class ei extends Se{constructor(A,e,t){super(e),this.stream=A,this.dict=A.dict,this.maybeLength=e,this.params=t}get bytes(){return M(this,"bytes",this.stream.getBytes(this.maybeLength))}ensureBuffer(A){}readBlock(A){this.decodeImage(null,A)}decodeImage(A,e){return this.eof||(A||=this.bytes,this.buffer=Ai.decode(A,e),this.bufferLength=this.buffer.length,this.eof=!0),this.buffer}get canAsyncDecodeImageFromBuffer(){return this.stream.isAsync}}class ti extends Se{constructor(A,e,t){super(e),this.str=A,this.dict=A.dict,this.cachedData=0,this.bitsCached=0;const i=4096,a={earlyChange:t,codeLength:9,nextCode:258,dictionaryValues:new Uint8Array(i),dictionaryLengths:new Uint16Array(i),dictionaryPrevCodes:new Uint16Array(i),currentSequence:new Uint8Array(i),currentSequenceLength:0};for(let A=0;A<256;++A)a.dictionaryValues[A]=A,a.dictionaryLengths[A]=1;this.lzwState=a}readBits(A){let e=this.bitsCached,t=this.cachedData;for(;e>>e&(1<0;if(A<256)C[0]=A,B=1;else{if(!(A>=258)){if(256===A){I=9,n=258,B=0;continue}this.eof=!0,delete this.lzwState;break}if(A=0;e--)C[e]=g[t],t=o[t];else C[B++]=C[0]}if(a&&(o[n]=c,r[n]=r[c]+1,g[n]=C[0],n++,I=n+s&n+s-1?I:0|Math.min(Math.log(n+s)/.6931471805599453+1,12)),c=A,h+=B,i15))throw new q(`Unsupported predictor: ${i}`);this.readBlock=2===i?this.readBlockTiff:this.readBlockPng,this.str=A,this.dict=A.dict;const a=this.colors=t.get("Colors")||1,s=this.bits=t.get("BPC","BitsPerComponent")||8,n=this.columns=t.get("Columns")||1;return this.pixBytes=a*s+7>>3,this.rowBytes=n*a*s+7>>3,this}readBlockTiff(){const A=this.rowBytes,e=this.bufferLength,t=this.ensureBuffer(e+A),i=this.bits,a=this.colors,s=this.str.getBytes(A);if(this.eof=!s.length,this.eof)return;let n,g=0,r=0,o=0,I=0,c=e;if(1===i&&1===a)for(n=0;n>1,A^=A>>2,A^=A>>4,g=(1&A)<<7,t[c++]=A}else if(8===i){for(n=0;n>8&255,t[c++]=255&A}}else{const A=new Uint8Array(a+1),c=(1<>o-i)&c,o-=i,r=r<=8&&(t[B++]=r>>I-8&255,I-=8);I>0&&(t[B++]=(r<<8-I)+(g&(1<<8-I)-1))}this.bufferLength+=A}readBlockPng(){const A=this.rowBytes,e=this.pixBytes,t=this.str.getByte(),i=this.str.getBytes(A);if(this.eof=!i.length,this.eof)return;const a=this.bufferLength,s=this.ensureBuffer(a+A);let n=s.subarray(a-A,a);0===n.length&&(n=new Uint8Array(A));let g,r,o,I=a;switch(t){case 0:for(g=0;g>1)+i[g];for(;g>1)+i[g]&255,I++;break;case 4:for(g=0;g0){const A=this.str.getBytes(i);e.set(A,t),t+=i}}else{i=257-i;const a=A[1];e=this.ensureBuffer(t+i+1);for(let A=0;A>")&&this.buf1!==nA;){if(!(this.buf1 instanceof IA)){R("Malformed dictionary: key must be a name object"),this.shift();continue}const e=this.buf1.name;if(this.shift(),this.buf1===nA)break;i.set(e,this.getObj(A))}if(this.buf1===nA){if(this.recoveryMode)return i;throw new DA("End of file inside dictionary.")}return uA(this.buf2,"stream")?this.allowStreams?this.makeStream(i,A):i:(this.shift(),i);default:return e}if(Number.isInteger(e)){if(Number.isInteger(this.buf1)&&uA(this.buf2,"R")){const A=hA.get(e,this.buf1);return this.shift(),this.shift(),A}return e}return"string"==typeof e&&A?A.decryptString(e):e}findDefaultInlineStreamEnd(A){const{knownCommands:e}=this.lexer,t=A.pos;let i,a,s=0;for(;-1!==(i=A.getByte());)if(0===s)s=69===i?1:0;else if(1===s)s=73===i?2:0;else if(32===i||10===i||13===i){a=A.pos;const t=A.peekBytes(15),n=t.length;if(0===n)break;for(let A=0;A127)){s=0;break}if(2!==s)continue;if(!e){G("findDefaultInlineStreamEnd - `lexer.knownCommands` is undefined.");continue}const g=new ri(new se(t.slice()),e);g._hexStringWarn=()=>{};let r=0;for(;;){const A=g.getObj();if(A===nA){s=0;break}if(A instanceof cA){const t=e[A.cmd];if(!t){s=0;break}if(t.variableArgs?r<=t.numArgs:r===t.numArgs)break;r=0}else r++}if(2===s)break}else s=0;-1===i&&(G("findDefaultInlineStreamEnd: Reached the end of the stream without finding a valid EI marker"),a&&(G('... trying to recover by using the last "EI" occurrence.'),A.skip(-(A.pos-a))));let n=4;return A.skip(-n),i=A.peekByte(),A.skip(n),LA(i)||n--,A.pos-n-t}findDCTDecodeInlineStreamEnd(A){const e=A.pos;let t,i,a=!1;for(;-1!==(t=A.getByte());)if(255===t){switch(A.getByte()){case 0:break;case 255:A.skip(-1);break;case 217:a=!0;break;case 192:case 193:case 194:case 195:case 197:case 198:case 199:case 201:case 202:case 203:case 205:case 206:case 207:case 196:case 204:case 218:case 219:case 220:case 221:case 222:case 223:case 224:case 225:case 226:case 227:case 228:case 229:case 230:case 231:case 232:case 233:case 234:case 235:case 236:case 237:case 238:case 239:case 254:i=A.getUint16(),i>2?A.skip(i-2):A.skip(-2)}if(a)break}const s=A.pos-e;return-1===t?(G("Inline DCTDecode image stream: EOI marker not found, searching for /EI/ instead."),A.skip(-s),this.findDefaultInlineStreamEnd(A)):(this.inlineStreamSkipEI(A),s)}findASCII85DecodeInlineStreamEnd(A){const e=A.pos;let t;for(;-1!==(t=A.getByte());)if(126===t){const e=A.pos;for(t=A.peekByte();LA(t);)A.skip(),t=A.peekByte();if(62===t){A.skip();break}if(A.pos>e){const e=A.peekBytes(2);if(69===e[0]&&73===e[1])break}}const i=A.pos-e;return-1===t?(G("Inline ASCII85Decode image stream: EOD marker not found, searching for /EI/ instead."),A.skip(-i),this.findDefaultInlineStreamEnd(A)):(this.inlineStreamSkipEI(A),i)}findASCIIHexDecodeInlineStreamEnd(A){const e=A.pos;let t;for(;-1!==(t=A.getByte())&&62!==t;);const i=A.pos-e;return-1===t?(G("Inline ASCIIHexDecode image stream: EOD marker not found, searching for /EI/ instead."),A.skip(-i),this.findDefaultInlineStreamEnd(A)):(this.inlineStreamSkipEI(A),i)}inlineStreamSkipEI(A){let e,t=0;for(;-1!==(e=A.getByte());)if(0===t)t=69===e?1:0;else if(1===t)t=73===e?2:0;else if(2===t)break}makeInlineImage(A){const e=this.lexer,t=e.stream,i=Object.create(null);let a;for(;!uA(this.buf1,"ID")&&this.buf1!==nA;){if(!(this.buf1 instanceof IA))throw new q("Dictionary key must be a name object");const e=this.buf1.name;if(this.shift(),this.buf1===nA)break;i[e]=this.getObj(A)}-1!==e.beginInlineImagePos&&(a=t.pos-e.beginInlineImagePos);const s=this.xref.fetchIfRef(i.F||i.Filter);let n;if(s instanceof IA)n=s.name;else if(Array.isArray(s)){const A=this.xref.fetchIfRef(s[0]);A instanceof IA&&(n=A.name)}const g=t.pos;let r,o;switch(n){case"DCT":case"DCTDecode":r=this.findDCTDecodeInlineStreamEnd(t);break;case"A85":case"ASCII85Decode":r=this.findASCII85DecodeInlineStreamEnd(t);break;case"AHx":case"ASCIIHexDecode":r=this.findASCIIHexDecodeInlineStreamEnd(t);break;default:r=this.findDefaultInlineStreamEnd(t)}if(r<1e3&&a>0){const A=t.pos;t.pos=e.beginInlineImagePos,o=function(A){const e=[],t=A.length;let i=0;for(;i=i){let i=!1;for(const A of a){const e=A.length;let a=0;for(;a=s){i=!0;break}if(a>=e){LA(n[r+g+a])&&(R(`Found "${P([...t,...A])}" when searching for endstream command.`),i=!0);break}}if(i)return e.pos+=r,e.pos-A}r++}e.pos+=g}return-1}makeStream(A,e){const t=this.lexer;let i=t.stream;t.skipToNextLine();const a=i.pos-1;let s=A.get("Length");if(Number.isInteger(s)||(R(`Bad length "${s&&s.toString()}" in stream.`),s=0),i.pos=a+s,t.nextChar(),this.tryShift()&&uA(this.buf2,"endstream"))this.shift();else{if(s=this.#w(a),s<0)throw new q("Missing endstream command.");t.nextChar(),this.shift(),this.shift()}return this.shift(),i=i.makeSubStream(a,s,A),e&&(i=e.createStream(i,s)),i=this.filter(i,A,s),i.dict=A,i}filter(A,e,t){let i=e.get("F","Filter"),a=e.get("DP","DecodeParms");if(i instanceof IA)return Array.isArray(a)&&G("/DecodeParms should not be an Array, when /Filter is a Name."),this.makeFilter(A,i.name,t,a);let s=t;if(Array.isArray(i)){const e=i,t=a;for(let n=0,g=e.length;n=48&&A<=57?15&A:A>=65&&A<=70||A>=97&&A<=102?9+(15&A):-1}class ri{constructor(A,e=null){this.stream=A,this.nextChar(),this.strBuf=[],this.knownCommands=e,this._hexStringNumWarn=0,this.beginInlineImagePos=-1}nextChar(){return this.currentChar=this.stream.getByte()}peekChar(){return this.stream.peekByte()}getNumber(){let A=this.currentChar,e=!1,t=0,i=1;if(45===A?(i=-1,A=this.nextChar(),45===A&&(A=this.nextChar())):43===A&&(A=this.nextChar()),10===A||13===A)do{A=this.nextChar()}while(10===A||13===A);if(46===A&&(t=10,A=this.nextChar()),A<48||A>57){const e=`Invalid number: ${String.fromCharCode(A)} (charCode ${A})`;if(LA(A)||-1===A)return R(`Lexer.getNumber - "${e}".`),0;throw new q(e)}let a=A-48,s=0,n=1;for(;(A=this.nextChar())>=0;)if(A>=48&&A<=57){const i=A-48;e?s=10*s+i:(0!==t&&(t*=10),a=10*a+i)}else if(46===A){if(0!==t)break;t=1}else if(45===A)G("Badly formatted number: minus sign in the middle");else{if(69!==A&&101!==A)break;if(A=this.peekChar(),43===A||45===A)n=45===A?-1:1,this.nextChar();else if(A<48||A>57)break;e=!0}return 0!==t&&(a/=t),e&&(a*=10**(n*s)),i*a}getString(){let A=1,e=!1;const t=this.strBuf;t.length=0;let i=this.nextChar();for(;;){let a=!1;switch(0|i){case-1:G("Unterminated string"),e=!0;break;case 40:++A,t.push("(");break;case 41:0==--A?(this.nextChar(),e=!0):t.push(")");break;case 92:switch(i=this.nextChar(),i){case-1:G("Unterminated string"),e=!0;break;case 110:t.push("\n");break;case 114:t.push("\r");break;case 116:t.push("\t");break;case 98:t.push("\b");break;case 102:t.push("\f");break;case 92:case 40:case 41:t.push(String.fromCharCode(i));break;case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:let A=15&i;i=this.nextChar(),a=!0,i>=48&&i<=55&&(A=(A<<3)+(15&i),i=this.nextChar(),i>=48&&i<=55&&(a=!1,A=(A<<3)+(15&i))),t.push(String.fromCharCode(A));break;case 13:10===this.peekChar()&&this.nextChar();break;case 10:break;default:t.push(String.fromCharCode(i))}break;default:t.push(String.fromCharCode(i))}if(e)break;a||(i=this.nextChar())}return t.join("")}getName(){let A,e;const t=this.strBuf;for(t.length=0;(A=this.nextChar())>=0&&!ni[A];)if(35===A){if(A=this.nextChar(),ni[A]){G("Lexer_getName: NUMBER SIGN (#) should be followed by a hexadecimal number."),t.push("#");break}const i=gi(A);if(-1!==i){e=A,A=this.nextChar();const a=gi(A);if(-1===a){if(G(`Lexer_getName: Illegal digit (${String.fromCharCode(A)}) in hexadecimal number.`),t.push("#",String.fromCharCode(e)),ni[A])break;t.push(String.fromCharCode(A));continue}t.push(String.fromCharCode(i<<4|a))}else t.push("#",String.fromCharCode(A))}else t.push(String.fromCharCode(A));return t.length>127&&G(`Name token is longer than allowed by the spec: ${t.length}`),IA.get(t.join(""))}_hexStringWarn(A){5!=this._hexStringNumWarn++?this._hexStringNumWarn>5||G(`getHexString - ignoring invalid character: ${A}`):G("getHexString - ignoring additional invalid characters.")}getHexString(){const A=this.strBuf;A.length=0;let e=this.currentChar,t=-1,i=-1;for(this._hexStringNumWarn=0;;){if(e<0){G("Unterminated hex string");break}if(62===e){this.nextChar();break}1!==ni[e]?(i=gi(e),-1===i?this._hexStringWarn(e):-1===t?t=i:(A.push(String.fromCharCode(t<<4|i)),t=-1),e=this.nextChar()):e=this.nextChar()}return-1!==t&&A.push(String.fromCharCode(t<<4)),A.join("")}getObj(){let A=!1,e=this.currentChar;for(;;){if(e<0)return nA;if(A)10!==e&&13!==e||(A=!1);else if(37===e)A=!0;else if(1!==ni[e])break;e=this.nextChar()}switch(0|e){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(),cA.get("[");case 93:return this.nextChar(),cA.get("]");case 60:return e=this.nextChar(),60===e?(this.nextChar(),cA.get("<<")):this.getHexString();case 62:return e=this.nextChar(),62===e?(this.nextChar(),cA.get(">>")):cA.get(">");case 123:return this.nextChar(),cA.get("{");case 125:return this.nextChar(),cA.get("}");case 41:throw this.nextChar(),new q(`Illegal character: ${e}`)}let t=String.fromCharCode(e);if(e<32||e>127){const A=this.peekChar();if(A>=32&&A<=127)return this.nextChar(),cA.get(t)}const i=this.knownCommands;let a=void 0!==i?.[t];for(;(e=this.nextChar())>=0&&!ni[e];){const A=t+String.fromCharCode(e);if(a&&void 0===i[A])break;if(128===t.length)throw new q(`Command token too long: ${t.length}`);t=A,a=void 0!==i?.[t]}return"true"===t||"false"!==t&&("null"===t?null:("BI"===t&&(this.beginInlineImagePos=this.stream.pos),cA.get(t)))}skipToNextLine(){let A=this.currentChar;for(;A>=0;){if(13===A){A=this.nextChar(),10===A&&this.nextChar();break}if(10===A){this.nextChar();break}A=this.nextChar()}}}class oi{static create(A){function e(A,e,t=!1){const i=A.get(e);if(Number.isInteger(i)&&(t?i>=0:i>0))return i;throw new Error(`The "${e}" parameter in the linearization dictionary is invalid.`)}const t=new si({lexer:new ri(A),xref:null}),i=t.getObj(),a=t.getObj(),s=t.getObj(),n=t.getObj();let g,r;if(!(Number.isInteger(i)&&Number.isInteger(a)&&uA(s,"obj")&&n instanceof BA&&"number"==typeof(g=n.get("Linearized"))&&g>0))return null;if((r=e(n,"L"))!==A.length)throw new Error('The "L" parameter in the linearization dictionary does not equal the stream length.');return{length:r,hints:function(A){const e=A.get("H");let t;if(Array.isArray(e)&&(2===(t=e.length)||4===t)){for(let A=0;A0))throw new Error(`Hint (${A}) in the linearization dictionary is invalid.`)}return e}throw new Error("Hint array in the linearization dictionary is invalid.")}(n),objectNumberFirst:e(n,"O"),endFirst:e(n,"E"),numPages:e(n,"N"),mainXRefEntriesOffset:e(n,"T"),pageFirst:n.has("P")?e(n,"P",!0):0}}}const Ii=["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","EUC-H","EUC-V","Ext-H","Ext-RKSJ-H","Ext-RKSJ-V","Ext-V","GB-EUC-H","GB-EUC-V","GB-H","GB-V","GBK-EUC-H","GBK-EUC-V","GBK2K-H","GBK2K-V","GBKp-EUC-H","GBKp-EUC-V","GBT-EUC-H","GBT-EUC-V","GBT-H","GBT-V","GBTpc-EUC-H","GBTpc-EUC-V","GBpc-EUC-H","GBpc-EUC-V","H","HKdla-B5-H","HKdla-B5-V","HKdlb-B5-H","HKdlb-B5-V","HKgccs-B5-H","HKgccs-B5-V","HKm314-B5-H","HKm314-B5-V","HKm471-B5-H","HKm471-B5-V","HKscs-B5-H","HKscs-B5-V","Hankaku","Hiragana","KSC-EUC-H","KSC-EUC-V","KSC-H","KSC-Johab-H","KSC-Johab-V","KSC-V","KSCms-UHC-H","KSCms-UHC-HW-H","KSCms-UHC-HW-V","KSCms-UHC-V","KSCpc-EUC-H","KSCpc-EUC-V","Katakana","NWP-H","NWP-V","RKSJ-H","RKSJ-V","Roman","UniCNS-UCS2-H","UniCNS-UCS2-V","UniCNS-UTF16-H","UniCNS-UTF16-V","UniCNS-UTF32-H","UniCNS-UTF32-V","UniCNS-UTF8-H","UniCNS-UTF8-V","UniGB-UCS2-H","UniGB-UCS2-V","UniGB-UTF16-H","UniGB-UTF16-V","UniGB-UTF32-H","UniGB-UTF32-V","UniGB-UTF8-H","UniGB-UTF8-V","UniJIS-UCS2-H","UniJIS-UCS2-HW-H","UniJIS-UCS2-HW-V","UniJIS-UCS2-V","UniJIS-UTF16-H","UniJIS-UTF16-V","UniJIS-UTF32-H","UniJIS-UTF32-V","UniJIS-UTF8-H","UniJIS-UTF8-V","UniJIS2004-UTF16-H","UniJIS2004-UTF16-V","UniJIS2004-UTF32-H","UniJIS2004-UTF32-V","UniJIS2004-UTF8-H","UniJIS2004-UTF8-V","UniJISPro-UCS2-HW-V","UniJISPro-UCS2-V","UniJISPro-UTF8-V","UniJISX0213-UTF32-H","UniJISX0213-UTF32-V","UniJISX02132004-UTF32-H","UniJISX02132004-UTF32-V","UniKS-UCS2-H","UniKS-UCS2-V","UniKS-UTF16-H","UniKS-UTF16-V","UniKS-UTF32-H","UniKS-UTF32-V","UniKS-UTF8-H","UniKS-UTF8-V","V","WP-Symbol"],ci=2**24-1;class Ci{constructor(A=!1){this.codespaceRanges=[[],[],[],[]],this.numCodespaceRanges=0,this._map=[],this.name="",this.vertical=!1,this.useCMap=null,this.builtInCMap=A}addCodespaceRange(A,e,t){this.codespaceRanges[A-1].push(e,t),this.numCodespaceRanges++}mapCidRange(A,e,t){if(e-A>ci)throw new Error("mapCidRange - ignoring data above MAX_MAP_RANGE.");for(;A<=e;)this._map[A++]=t++}mapBfRange(A,e,t){if(e-A>ci)throw new Error("mapBfRange - ignoring data above MAX_MAP_RANGE.");const i=t.length-1;for(;A<=e;){this._map[A++]=t;const e=t.charCodeAt(i)+1;t=e>255?t.substring(0,i-1)+String.fromCharCode(t.charCodeAt(i-1)+1)+"\0":t.substring(0,i)+String.fromCharCode(e)}}mapBfRangeToArray(A,e,t){if(e-A>ci)throw new Error("mapBfRangeToArray - ignoring data above MAX_MAP_RANGE.");const i=t.length;let a=0;for(;A<=e&&a>>0;const n=a[s];for(let A=0,e=n.length;A=e&&i<=a)return t.charcode=i,void(t.length=s+1)}}t.charcode=0,t.length=1}getCharCodeLength(A){const e=this.codespaceRanges;for(let t=0,i=e.length;t=a&&A<=s)return t+1}}return 1}get length(){return this._map.length}get isIdentityCMap(){if("Identity-H"!==this.name&&"Identity-V"!==this.name)return!1;if(65536!==this._map.length)return!1;for(let A=0;A<65536;A++)if(this._map[A]!==A)return!1;return!0}}class Bi extends Ci{constructor(A,e){super(),this.vertical=A,this.addCodespaceRange(e,0,65535)}mapCidRange(A,e,t){N("should not call mapCidRange")}mapBfRange(A,e,t){N("should not call mapBfRange")}mapBfRangeToArray(A,e,t){N("should not call mapBfRangeToArray")}mapOne(A,e){N("should not call mapCidOne")}lookup(A){return Number.isInteger(A)&&A<=65535?A:void 0}contains(A){return Number.isInteger(A)&&A<=65535}forEach(A){for(let e=0;e<=65535;e++)A(e,e)}charCodeOf(A){return Number.isInteger(A)&&A<=65535?A:-1}getMap(){const A=new Array(65536);for(let e=0;e<=65535;e++)A[e]=e;return A}get length(){return 65536}get isIdentityCMap(){N("should not access .isIdentityCMap")}}function hi(A){let e=0;for(let t=0;t>>0}function Qi(A){if("string"!=typeof A)throw new q("Malformed CMap: expected string.")}function li(A){if(!Number.isInteger(A))throw new q("Malformed CMap: expected int.")}function Ei(A,e){for(;;){let t=e.getObj();if(t===nA)break;if(uA(t,"endbfchar"))return;Qi(t);const i=hi(t);t=e.getObj(),Qi(t);const a=t;A.mapOne(i,a)}}function ui(A,e){for(;;){let t=e.getObj();if(t===nA)break;if(uA(t,"endbfrange"))return;Qi(t);const i=hi(t);t=e.getObj(),Qi(t);const a=hi(t);if(t=e.getObj(),Number.isInteger(t)||"string"==typeof t){const e=Number.isInteger(t)?String.fromCharCode(t):t;A.mapBfRange(i,a,e)}else{if(!uA(t,"["))break;{t=e.getObj();const s=[];for(;!uA(t,"]")&&t!==nA;)s.push(t),t=e.getObj();A.mapBfRangeToArray(i,a,s)}}}throw new q("Invalid bf range.")}function di(A,e){for(;;){let t=e.getObj();if(t===nA)break;if(uA(t,"endcidchar"))return;Qi(t);const i=hi(t);t=e.getObj(),li(t);const a=t;A.mapOne(i,a)}}function fi(A,e){for(;;){let t=e.getObj();if(t===nA)break;if(uA(t,"endcidrange"))return;Qi(t);const i=hi(t);t=e.getObj(),Qi(t);const a=hi(t);t=e.getObj(),li(t);const s=t;A.mapCidRange(i,a,s)}}function pi(A,e){for(;;){let t=e.getObj();if(t===nA)break;if(uA(t,"endcodespacerange"))return;if("string"!=typeof t)break;const i=hi(t);if(t=e.getObj(),"string"!=typeof t)break;const a=hi(t);A.addCodespaceRange(t.length,i,a)}throw new q("Invalid codespace range.")}function mi(A,e){const t=e.getObj();Number.isInteger(t)&&(A.vertical=!!t)}function yi(A,e){const t=e.getObj();t instanceof IA&&(A.name=t.name)}async function wi(A,e,t,i){let a,s;A:for(;;)try{const t=e.getObj();if(t===nA)break;if(t instanceof IA)"WMode"===t.name?mi(A,e):"CMapName"===t.name&&yi(A,e),a=t;else if(t instanceof cA)switch(t.cmd){case"endcmap":break A;case"usecmap":a instanceof IA&&(s=a.name);break;case"begincodespacerange":pi(A,e);break;case"beginbfchar":Ei(A,e);break;case"begincidchar":di(A,e);break;case"beginbfrange":ui(A,e);break;case"begincidrange":fi(A,e)}}catch(A){if(A instanceof wA)throw A;G("Invalid cMap data: "+A);continue}return!i&&s&&(i=s),i?Di(A,t,i):A}async function Di(A,e,t){if(A.useCMap=await bi(t,e),0===A.numCodespaceRanges){const e=A.useCMap.codespaceRanges;for(let t=0;tDi(a,e,A)));if(i===l.NONE){const A=new ri(new se(t));return wi(a,A,e,null)}throw new Error(`Invalid CMap "compressionType" value: ${i}`)}class ki{static async create({encoding:A,fetchBuiltInCMap:e,useCMap:t}){if(A instanceof IA)return bi(A.name,e);if(A instanceof pA){const i=await wi(new Ci,new ri(A),e,t);return i.isIdentityCMap?bi(i.name,e):i}throw new Error("Encoding required.")}}const Fi=[".notdef","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quoteright","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","quoteleft","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","exclamdown","cent","sterling","fraction","yen","florin","section","currency","quotesingle","quotedblleft","guillemotleft","guilsinglleft","guilsinglright","fi","fl","endash","dagger","daggerdbl","periodcentered","paragraph","bullet","quotesinglbase","quotedblbase","quotedblright","guillemotright","ellipsis","perthousand","questiondown","grave","acute","circumflex","tilde","macron","breve","dotaccent","dieresis","ring","cedilla","hungarumlaut","ogonek","caron","emdash","AE","ordfeminine","Lslash","Oslash","OE","ordmasculine","ae","dotlessi","lslash","oslash","oe","germandbls","onesuperior","logicalnot","mu","trademark","Eth","onehalf","plusminus","Thorn","onequarter","divide","brokenbar","degree","thorn","threequarters","twosuperior","registered","minus","eth","multiply","threesuperior","copyright","Aacute","Acircumflex","Adieresis","Agrave","Aring","Atilde","Ccedilla","Eacute","Ecircumflex","Edieresis","Egrave","Iacute","Icircumflex","Idieresis","Igrave","Ntilde","Oacute","Ocircumflex","Odieresis","Ograve","Otilde","Scaron","Uacute","Ucircumflex","Udieresis","Ugrave","Yacute","Ydieresis","Zcaron","aacute","acircumflex","adieresis","agrave","aring","atilde","ccedilla","eacute","ecircumflex","edieresis","egrave","iacute","icircumflex","idieresis","igrave","ntilde","oacute","ocircumflex","odieresis","ograve","otilde","scaron","uacute","ucircumflex","udieresis","ugrave","yacute","ydieresis","zcaron"],Si=[".notdef","space","exclamsmall","Hungarumlautsmall","dollaroldstyle","dollarsuperior","ampersandsmall","Acutesmall","parenleftsuperior","parenrightsuperior","twodotenleader","onedotenleader","comma","hyphen","period","fraction","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","colon","semicolon","commasuperior","threequartersemdash","periodsuperior","questionsmall","asuperior","bsuperior","centsuperior","dsuperior","esuperior","isuperior","lsuperior","msuperior","nsuperior","osuperior","rsuperior","ssuperior","tsuperior","ff","fi","fl","ffi","ffl","parenleftinferior","parenrightinferior","Circumflexsmall","hyphensuperior","Gravesmall","Asmall","Bsmall","Csmall","Dsmall","Esmall","Fsmall","Gsmall","Hsmall","Ismall","Jsmall","Ksmall","Lsmall","Msmall","Nsmall","Osmall","Psmall","Qsmall","Rsmall","Ssmall","Tsmall","Usmall","Vsmall","Wsmall","Xsmall","Ysmall","Zsmall","colonmonetary","onefitted","rupiah","Tildesmall","exclamdownsmall","centoldstyle","Lslashsmall","Scaronsmall","Zcaronsmall","Dieresissmall","Brevesmall","Caronsmall","Dotaccentsmall","Macronsmall","figuredash","hypheninferior","Ogoneksmall","Ringsmall","Cedillasmall","onequarter","onehalf","threequarters","questiondownsmall","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","zerosuperior","onesuperior","twosuperior","threesuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","eightsuperior","ninesuperior","zeroinferior","oneinferior","twoinferior","threeinferior","fourinferior","fiveinferior","sixinferior","seveninferior","eightinferior","nineinferior","centinferior","dollarinferior","periodinferior","commainferior","Agravesmall","Aacutesmall","Acircumflexsmall","Atildesmall","Adieresissmall","Aringsmall","AEsmall","Ccedillasmall","Egravesmall","Eacutesmall","Ecircumflexsmall","Edieresissmall","Igravesmall","Iacutesmall","Icircumflexsmall","Idieresissmall","Ethsmall","Ntildesmall","Ogravesmall","Oacutesmall","Ocircumflexsmall","Otildesmall","Odieresissmall","OEsmall","Oslashsmall","Ugravesmall","Uacutesmall","Ucircumflexsmall","Udieresissmall","Yacutesmall","Thornsmall","Ydieresissmall"],Ri=[".notdef","space","dollaroldstyle","dollarsuperior","parenleftsuperior","parenrightsuperior","twodotenleader","onedotenleader","comma","hyphen","period","fraction","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","colon","semicolon","commasuperior","threequartersemdash","periodsuperior","asuperior","bsuperior","centsuperior","dsuperior","esuperior","isuperior","lsuperior","msuperior","nsuperior","osuperior","rsuperior","ssuperior","tsuperior","ff","fi","fl","ffi","ffl","parenleftinferior","parenrightinferior","hyphensuperior","colonmonetary","onefitted","rupiah","centoldstyle","figuredash","hypheninferior","onequarter","onehalf","threequarters","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","zerosuperior","onesuperior","twosuperior","threesuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","eightsuperior","ninesuperior","zeroinferior","oneinferior","twoinferior","threeinferior","fourinferior","fiveinferior","sixinferior","seveninferior","eightinferior","nineinferior","centinferior","dollarinferior","periodinferior","commainferior"],Gi=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","space","exclamsmall","Hungarumlautsmall","","dollaroldstyle","dollarsuperior","ampersandsmall","Acutesmall","parenleftsuperior","parenrightsuperior","twodotenleader","onedotenleader","comma","hyphen","period","fraction","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","colon","semicolon","commasuperior","threequartersemdash","periodsuperior","questionsmall","","asuperior","bsuperior","centsuperior","dsuperior","esuperior","","","","isuperior","","","lsuperior","msuperior","nsuperior","osuperior","","","rsuperior","ssuperior","tsuperior","","ff","fi","fl","ffi","ffl","parenleftinferior","","parenrightinferior","Circumflexsmall","hyphensuperior","Gravesmall","Asmall","Bsmall","Csmall","Dsmall","Esmall","Fsmall","Gsmall","Hsmall","Ismall","Jsmall","Ksmall","Lsmall","Msmall","Nsmall","Osmall","Psmall","Qsmall","Rsmall","Ssmall","Tsmall","Usmall","Vsmall","Wsmall","Xsmall","Ysmall","Zsmall","colonmonetary","onefitted","rupiah","Tildesmall","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","exclamdownsmall","centoldstyle","Lslashsmall","","","Scaronsmall","Zcaronsmall","Dieresissmall","Brevesmall","Caronsmall","","Dotaccentsmall","","","Macronsmall","","","figuredash","hypheninferior","","","Ogoneksmall","Ringsmall","Cedillasmall","","","","onequarter","onehalf","threequarters","questiondownsmall","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","","","zerosuperior","onesuperior","twosuperior","threesuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","eightsuperior","ninesuperior","zeroinferior","oneinferior","twoinferior","threeinferior","fourinferior","fiveinferior","sixinferior","seveninferior","eightinferior","nineinferior","centinferior","dollarinferior","periodinferior","commainferior","Agravesmall","Aacutesmall","Acircumflexsmall","Atildesmall","Adieresissmall","Aringsmall","AEsmall","Ccedillasmall","Egravesmall","Eacutesmall","Ecircumflexsmall","Edieresissmall","Igravesmall","Iacutesmall","Icircumflexsmall","Idieresissmall","Ethsmall","Ntildesmall","Ogravesmall","Oacutesmall","Ocircumflexsmall","Otildesmall","Odieresissmall","OEsmall","Oslashsmall","Ugravesmall","Uacutesmall","Ucircumflexsmall","Udieresissmall","Yacutesmall","Thornsmall","Ydieresissmall"],Ni=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","space","exclamsmall","Hungarumlautsmall","centoldstyle","dollaroldstyle","dollarsuperior","ampersandsmall","Acutesmall","parenleftsuperior","parenrightsuperior","twodotenleader","onedotenleader","comma","hyphen","period","fraction","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","colon","semicolon","","threequartersemdash","","questionsmall","","","","","Ethsmall","","","onequarter","onehalf","threequarters","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","","","","","","","ff","fi","fl","ffi","ffl","parenleftinferior","","parenrightinferior","Circumflexsmall","hypheninferior","Gravesmall","Asmall","Bsmall","Csmall","Dsmall","Esmall","Fsmall","Gsmall","Hsmall","Ismall","Jsmall","Ksmall","Lsmall","Msmall","Nsmall","Osmall","Psmall","Qsmall","Rsmall","Ssmall","Tsmall","Usmall","Vsmall","Wsmall","Xsmall","Ysmall","Zsmall","colonmonetary","onefitted","rupiah","Tildesmall","","","asuperior","centsuperior","","","","","Aacutesmall","Agravesmall","Acircumflexsmall","Adieresissmall","Atildesmall","Aringsmall","Ccedillasmall","Eacutesmall","Egravesmall","Ecircumflexsmall","Edieresissmall","Iacutesmall","Igravesmall","Icircumflexsmall","Idieresissmall","Ntildesmall","Oacutesmall","Ogravesmall","Ocircumflexsmall","Odieresissmall","Otildesmall","Uacutesmall","Ugravesmall","Ucircumflexsmall","Udieresissmall","","eightsuperior","fourinferior","threeinferior","sixinferior","eightinferior","seveninferior","Scaronsmall","","centinferior","twoinferior","","Dieresissmall","","Caronsmall","osuperior","fiveinferior","","commainferior","periodinferior","Yacutesmall","","dollarinferior","","","Thornsmall","","nineinferior","zeroinferior","Zcaronsmall","AEsmall","Oslashsmall","questiondownsmall","oneinferior","Lslashsmall","","","","","","","Cedillasmall","","","","","","OEsmall","figuredash","hyphensuperior","","","","","exclamdownsmall","","Ydieresissmall","","onesuperior","twosuperior","threesuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","ninesuperior","zerosuperior","","esuperior","rsuperior","tsuperior","","","isuperior","ssuperior","dsuperior","","","","","","lsuperior","Ogoneksmall","Brevesmall","Macronsmall","bsuperior","nsuperior","msuperior","commasuperior","periodsuperior","Dotaccentsmall","Ringsmall","","","",""],xi=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quotesingle","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","grave","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","","Adieresis","Aring","Ccedilla","Eacute","Ntilde","Odieresis","Udieresis","aacute","agrave","acircumflex","adieresis","atilde","aring","ccedilla","eacute","egrave","ecircumflex","edieresis","iacute","igrave","icircumflex","idieresis","ntilde","oacute","ograve","ocircumflex","odieresis","otilde","uacute","ugrave","ucircumflex","udieresis","dagger","degree","cent","sterling","section","bullet","paragraph","germandbls","registered","copyright","trademark","acute","dieresis","notequal","AE","Oslash","infinity","plusminus","lessequal","greaterequal","yen","mu","partialdiff","summation","product","pi","integral","ordfeminine","ordmasculine","Omega","ae","oslash","questiondown","exclamdown","logicalnot","radical","florin","approxequal","Delta","guillemotleft","guillemotright","ellipsis","space","Agrave","Atilde","Otilde","OE","oe","endash","emdash","quotedblleft","quotedblright","quoteleft","quoteright","divide","lozenge","ydieresis","Ydieresis","fraction","currency","guilsinglleft","guilsinglright","fi","fl","daggerdbl","periodcentered","quotesinglbase","quotedblbase","perthousand","Acircumflex","Ecircumflex","Aacute","Edieresis","Egrave","Iacute","Icircumflex","Idieresis","Igrave","Oacute","Ocircumflex","apple","Ograve","Uacute","Ucircumflex","Ugrave","dotlessi","circumflex","tilde","macron","breve","dotaccent","ring","cedilla","hungarumlaut","ogonek","caron"],Ui=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quoteright","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","quoteleft","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","exclamdown","cent","sterling","fraction","yen","florin","section","currency","quotesingle","quotedblleft","guillemotleft","guilsinglleft","guilsinglright","fi","fl","","endash","dagger","daggerdbl","periodcentered","","paragraph","bullet","quotesinglbase","quotedblbase","quotedblright","guillemotright","ellipsis","perthousand","","questiondown","","grave","acute","circumflex","tilde","macron","breve","dotaccent","dieresis","","ring","cedilla","","hungarumlaut","ogonek","caron","emdash","","","","","","","","","","","","","","","","","AE","","ordfeminine","","","","","Lslash","Oslash","OE","ordmasculine","","","","","","ae","","","","dotlessi","","","lslash","oslash","oe","germandbls","","","",""],Mi=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quotesingle","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","grave","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","bullet","Euro","bullet","quotesinglbase","florin","quotedblbase","ellipsis","dagger","daggerdbl","circumflex","perthousand","Scaron","guilsinglleft","OE","bullet","Zcaron","bullet","bullet","quoteleft","quoteright","quotedblleft","quotedblright","bullet","endash","emdash","tilde","trademark","scaron","guilsinglright","oe","bullet","zcaron","Ydieresis","space","exclamdown","cent","sterling","currency","yen","brokenbar","section","dieresis","copyright","ordfeminine","guillemotleft","logicalnot","hyphen","registered","macron","degree","plusminus","twosuperior","threesuperior","acute","mu","paragraph","periodcentered","cedilla","onesuperior","ordmasculine","guillemotright","onequarter","onehalf","threequarters","questiondown","Agrave","Aacute","Acircumflex","Atilde","Adieresis","Aring","AE","Ccedilla","Egrave","Eacute","Ecircumflex","Edieresis","Igrave","Iacute","Icircumflex","Idieresis","Eth","Ntilde","Ograve","Oacute","Ocircumflex","Otilde","Odieresis","multiply","Oslash","Ugrave","Uacute","Ucircumflex","Udieresis","Yacute","Thorn","germandbls","agrave","aacute","acircumflex","atilde","adieresis","aring","ae","ccedilla","egrave","eacute","ecircumflex","edieresis","igrave","iacute","icircumflex","idieresis","eth","ntilde","ograve","oacute","ocircumflex","otilde","odieresis","divide","oslash","ugrave","uacute","ucircumflex","udieresis","yacute","thorn","ydieresis"],Li=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","space","exclam","universal","numbersign","existential","percent","ampersand","suchthat","parenleft","parenright","asteriskmath","plus","comma","minus","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","congruent","Alpha","Beta","Chi","Delta","Epsilon","Phi","Gamma","Eta","Iota","theta1","Kappa","Lambda","Mu","Nu","Omicron","Pi","Theta","Rho","Sigma","Tau","Upsilon","sigma1","Omega","Xi","Psi","Zeta","bracketleft","therefore","bracketright","perpendicular","underscore","radicalex","alpha","beta","chi","delta","epsilon","phi","gamma","eta","iota","phi1","kappa","lambda","mu","nu","omicron","pi","theta","rho","sigma","tau","upsilon","omega1","omega","xi","psi","zeta","braceleft","bar","braceright","similar","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","Euro","Upsilon1","minute","lessequal","fraction","infinity","florin","club","diamond","heart","spade","arrowboth","arrowleft","arrowup","arrowright","arrowdown","degree","plusminus","second","greaterequal","multiply","proportional","partialdiff","bullet","divide","notequal","equivalence","approxequal","ellipsis","arrowvertex","arrowhorizex","carriagereturn","aleph","Ifraktur","Rfraktur","weierstrass","circlemultiply","circleplus","emptyset","intersection","union","propersuperset","reflexsuperset","notsubset","propersubset","reflexsubset","element","notelement","angle","gradient","registerserif","copyrightserif","trademarkserif","product","radical","dotmath","logicalnot","logicaland","logicalor","arrowdblboth","arrowdblleft","arrowdblup","arrowdblright","arrowdbldown","lozenge","angleleft","registersans","copyrightsans","trademarksans","summation","parenlefttp","parenleftex","parenleftbt","bracketlefttp","bracketleftex","bracketleftbt","bracelefttp","braceleftmid","braceleftbt","braceex","","angleright","integral","integraltp","integralex","integralbt","parenrighttp","parenrightex","parenrightbt","bracketrighttp","bracketrightex","bracketrightbt","bracerighttp","bracerightmid","bracerightbt",""],Ji=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","space","a1","a2","a202","a3","a4","a5","a119","a118","a117","a11","a12","a13","a14","a15","a16","a105","a17","a18","a19","a20","a21","a22","a23","a24","a25","a26","a27","a28","a6","a7","a8","a9","a10","a29","a30","a31","a32","a33","a34","a35","a36","a37","a38","a39","a40","a41","a42","a43","a44","a45","a46","a47","a48","a49","a50","a51","a52","a53","a54","a55","a56","a57","a58","a59","a60","a61","a62","a63","a64","a65","a66","a67","a68","a69","a70","a71","a72","a73","a74","a203","a75","a204","a76","a77","a78","a79","a81","a82","a83","a84","a97","a98","a99","a100","","a89","a90","a93","a94","a91","a92","a205","a85","a206","a86","a87","a88","a95","a96","","","","","","","","","","","","","","","","","","","","a101","a102","a103","a104","a106","a107","a108","a112","a111","a110","a109","a120","a121","a122","a123","a124","a125","a126","a127","a128","a129","a130","a131","a132","a133","a134","a135","a136","a137","a138","a139","a140","a141","a142","a143","a144","a145","a146","a147","a148","a149","a150","a151","a152","a153","a154","a155","a156","a157","a158","a159","a160","a161","a163","a164","a196","a165","a192","a166","a167","a168","a169","a170","a171","a172","a173","a162","a174","a175","a176","a177","a178","a179","a193","a180","a199","a181","a200","a182","","a201","a183","a184","a197","a185","a194","a198","a186","a195","a187","a188","a189","a190","a191",""];function Hi(A){switch(A){case"WinAnsiEncoding":return Mi;case"StandardEncoding":return Ui;case"MacRomanEncoding":return xi;case"SymbolSetEncoding":return Li;case"ZapfDingbatsEncoding":return Ji;case"ExpertEncoding":return Gi;case"MacExpertEncoding":return Ni;default:return null}}const Yi=[".notdef","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quoteright","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","quoteleft","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","exclamdown","cent","sterling","fraction","yen","florin","section","currency","quotesingle","quotedblleft","guillemotleft","guilsinglleft","guilsinglright","fi","fl","endash","dagger","daggerdbl","periodcentered","paragraph","bullet","quotesinglbase","quotedblbase","quotedblright","guillemotright","ellipsis","perthousand","questiondown","grave","acute","circumflex","tilde","macron","breve","dotaccent","dieresis","ring","cedilla","hungarumlaut","ogonek","caron","emdash","AE","ordfeminine","Lslash","Oslash","OE","ordmasculine","ae","dotlessi","lslash","oslash","oe","germandbls","onesuperior","logicalnot","mu","trademark","Eth","onehalf","plusminus","Thorn","onequarter","divide","brokenbar","degree","thorn","threequarters","twosuperior","registered","minus","eth","multiply","threesuperior","copyright","Aacute","Acircumflex","Adieresis","Agrave","Aring","Atilde","Ccedilla","Eacute","Ecircumflex","Edieresis","Egrave","Iacute","Icircumflex","Idieresis","Igrave","Ntilde","Oacute","Ocircumflex","Odieresis","Ograve","Otilde","Scaron","Uacute","Ucircumflex","Udieresis","Ugrave","Yacute","Ydieresis","Zcaron","aacute","acircumflex","adieresis","agrave","aring","atilde","ccedilla","eacute","ecircumflex","edieresis","egrave","iacute","icircumflex","idieresis","igrave","ntilde","oacute","ocircumflex","odieresis","ograve","otilde","scaron","uacute","ucircumflex","udieresis","ugrave","yacute","ydieresis","zcaron","exclamsmall","Hungarumlautsmall","dollaroldstyle","dollarsuperior","ampersandsmall","Acutesmall","parenleftsuperior","parenrightsuperior","twodotenleader","onedotenleader","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","commasuperior","threequartersemdash","periodsuperior","questionsmall","asuperior","bsuperior","centsuperior","dsuperior","esuperior","isuperior","lsuperior","msuperior","nsuperior","osuperior","rsuperior","ssuperior","tsuperior","ff","ffi","ffl","parenleftinferior","parenrightinferior","Circumflexsmall","hyphensuperior","Gravesmall","Asmall","Bsmall","Csmall","Dsmall","Esmall","Fsmall","Gsmall","Hsmall","Ismall","Jsmall","Ksmall","Lsmall","Msmall","Nsmall","Osmall","Psmall","Qsmall","Rsmall","Ssmall","Tsmall","Usmall","Vsmall","Wsmall","Xsmall","Ysmall","Zsmall","colonmonetary","onefitted","rupiah","Tildesmall","exclamdownsmall","centoldstyle","Lslashsmall","Scaronsmall","Zcaronsmall","Dieresissmall","Brevesmall","Caronsmall","Dotaccentsmall","Macronsmall","figuredash","hypheninferior","Ogoneksmall","Ringsmall","Cedillasmall","questiondownsmall","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","zerosuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","eightsuperior","ninesuperior","zeroinferior","oneinferior","twoinferior","threeinferior","fourinferior","fiveinferior","sixinferior","seveninferior","eightinferior","nineinferior","centinferior","dollarinferior","periodinferior","commainferior","Agravesmall","Aacutesmall","Acircumflexsmall","Atildesmall","Adieresissmall","Aringsmall","AEsmall","Ccedillasmall","Egravesmall","Eacutesmall","Ecircumflexsmall","Edieresissmall","Igravesmall","Iacutesmall","Icircumflexsmall","Idieresissmall","Ethsmall","Ntildesmall","Ogravesmall","Oacutesmall","Ocircumflexsmall","Otildesmall","Odieresissmall","OEsmall","Oslashsmall","Ugravesmall","Uacutesmall","Ucircumflexsmall","Udieresissmall","Yacutesmall","Thornsmall","Ydieresissmall","001.000","001.001","001.002","001.003","Black","Bold","Book","Light","Medium","Regular","Roman","Semibold"],vi=[null,{id:"hstem",min:2,stackClearing:!0,stem:!0},null,{id:"vstem",min:2,stackClearing:!0,stem:!0},{id:"vmoveto",min:1,stackClearing:!0},{id:"rlineto",min:2,resetStack:!0},{id:"hlineto",min:1,resetStack:!0},{id:"vlineto",min:1,resetStack:!0},{id:"rrcurveto",min:6,resetStack:!0},null,{id:"callsubr",min:1,undefStack:!0},{id:"return",min:0,undefStack:!0},null,null,{id:"endchar",min:0,stackClearing:!0},null,null,null,{id:"hstemhm",min:2,stackClearing:!0,stem:!0},{id:"hintmask",min:0,stackClearing:!0},{id:"cntrmask",min:0,stackClearing:!0},{id:"rmoveto",min:2,stackClearing:!0},{id:"hmoveto",min:1,stackClearing:!0},{id:"vstemhm",min:2,stackClearing:!0,stem:!0},{id:"rcurveline",min:8,resetStack:!0},{id:"rlinecurve",min:8,resetStack:!0},{id:"vvcurveto",min:4,resetStack:!0},{id:"hhcurveto",min:4,resetStack:!0},null,{id:"callgsubr",min:1,undefStack:!0},{id:"vhcurveto",min:4,resetStack:!0},{id:"hvcurveto",min:4,resetStack:!0}],Ki=[null,null,null,{id:"and",min:2,stackDelta:-1},{id:"or",min:2,stackDelta:-1},{id:"not",min:1,stackDelta:0},null,null,null,{id:"abs",min:1,stackDelta:0},{id:"add",min:2,stackDelta:-1,stackFn(A,e){A[e-2]=A[e-2]+A[e-1]}},{id:"sub",min:2,stackDelta:-1,stackFn(A,e){A[e-2]=A[e-2]-A[e-1]}},{id:"div",min:2,stackDelta:-1,stackFn(A,e){A[e-2]=A[e-2]/A[e-1]}},null,{id:"neg",min:1,stackDelta:0,stackFn(A,e){A[e-1]=-A[e-1]}},{id:"eq",min:2,stackDelta:-1},null,null,{id:"drop",min:1,stackDelta:-1},null,{id:"put",min:2,stackDelta:-2},{id:"get",min:1,stackDelta:0},{id:"ifelse",min:4,stackDelta:-3},{id:"random",min:0,stackDelta:1},{id:"mul",min:2,stackDelta:-1,stackFn(A,e){A[e-2]=A[e-2]*A[e-1]}},null,{id:"sqrt",min:1,stackDelta:0},{id:"dup",min:1,stackDelta:1},{id:"exch",min:2,stackDelta:0},{id:"index",min:2,stackDelta:0},{id:"roll",min:3,stackDelta:-2},null,null,null,{id:"hflex",min:7,resetStack:!0},{id:"flex",min:13,resetStack:!0},{id:"hflex1",min:9,resetStack:!0},{id:"flex1",min:11,resetStack:!0}];class qi{constructor(A,e,t){this.bytes=A.getBytes(),this.properties=e,this.seacAnalysisEnabled=!!t}parse(){const A=this.properties,e=new Ti;this.cff=e;const t=this.parseHeader(),i=this.parseIndex(t.endPos),a=this.parseIndex(i.endPos),s=this.parseIndex(a.endPos),n=this.parseIndex(s.endPos),g=this.parseDict(a.obj.get(0)),r=this.createDict(Vi,g,e.strings);e.header=t.obj,e.names=this.parseNameIndex(i.obj),e.strings=this.parseStringIndex(s.obj),e.topDict=r,e.globalSubrIndex=n.obj,this.parsePrivateDict(e.topDict),e.isCIDFont=r.hasName("ROS");const o=r.getByName("CharStrings"),I=this.parseIndex(o).obj,c=r.getByName("FontMatrix");c&&(A.fontMatrix=c);const C=r.getByName("FontBBox");let B,h;if(C&&(A.ascent=Math.max(C[3],C[1]),A.descent=Math.min(C[1],C[3]),A.ascentScaled=!0),e.isCIDFont){const A=this.parseIndex(r.getByName("FDArray")).obj;for(let t=0,i=A.count;t=e)throw new q("Invalid CFF header");0!==t&&(R("cff data is shifted"),A=A.subarray(t),this.bytes=A);const i=A[0],a=A[1],s=A[2],n=A[3];return{obj:new Pi(i,a,s,n),endPos:s}}parseDict(A){let e=0;function t(){let t=A[e++];return 30===t?function(){let t="";const i=["0","1","2","3","4","5","6","7","8","9",".","E","E-",null,"-"],a=A.length;for(;e>4,n=15&a;if(15===s)break;if(t+=i[s],15===n)break;t+=i[n]}return parseFloat(t)}():28===t?(t=A[e++],t=(t<<24|A[e++]<<16)>>16,t):29===t?(t=A[e++],t=t<<8|A[e++],t=t<<8|A[e++],t=t<<8|A[e++],t):t>=32&&t<=246?t-139:t>=247&&t<=250?256*(t-247)+A[e++]+108:t>=251&&t<=254?-256*(t-251)-A[e++]-108:(G('CFFParser_parseDict: "'+t+'" is a reserved command.'),NaN)}let i=[];const a=[];e=0;const s=A.length;for(;e10)return!1;let a=A.stackSize;const s=A.stack;let n=e.length;for(let g=0;g>16,g+=2,a++;else if(14===r){if(a>=4&&(a-=4,this.seacAnalysisEnabled))return A.seac=s.slice(a,a+4),!1;o=vi[r]}else if(r>=32&&r<=246)s[a]=r-139,a++;else if(r>=247&&r<=254)s[a]=r<251?(r-247<<8)+e[g]+108:-(r-251<<8)-e[g]-108,g++,a++;else if(255===r)s[a]=(e[g]<<24|e[g+1]<<16|e[g+2]<<8|e[g+3])/65536,g+=4,a++;else if(19===r||20===r){if(A.hints+=a>>1,0===A.hints){e.copyWithin(g-1,g,-1),g-=1,n-=1;continue}g+=A.hints+7>>3,a%=2,o=vi[r]}else{if(10===r||29===r){const e=10===r?t:i;if(!e)return o=vi[r],G("Missing subrsIndex for "+o.id),!1;let n=32768;e.count<1240?n=107:e.count<33900&&(n=1131);const g=s[--a]+n;if(g<0||g>=e.count||isNaN(g))return o=vi[r],G("Out of bounds subrIndex for "+o.id),!1;if(A.stackSize=a,A.callDepth++,!this.parseCharString(A,e.get(g),t,i))return!1;A.callDepth--,a=A.stackSize;continue}if(11===r)return A.stackSize=a,!0;if(0===r&&g===e.length)e[g-1]=14,o=vi[14];else{if(9===r){e.copyWithin(g-1,g,-1),g-=1,n-=1;continue}o=vi[r]}}if(o){if(o.stem&&(A.hints+=a>>1,3===r||23===r?A.hasVStems=!0:!A.hasVStems||1!==r&&18!==r||(G("CFF stem hints are in wrong order"),e[g-1]=1===r?3:23)),"min"in o&&!A.undefStack&&a=2&&o.stem?a%=2:a>1&&G("Found too many parameters for stack-clearing command"),a>0&&(A.width=s[a-1])),"stackDelta"in o?("stackFn"in o&&o.stackFn(s,a),a+=o.stackDelta):o.stackClearing?a=0:o.resetStack?(a=0,A.undefStack=!1):o.undefStack&&(a=0,A.undefStack=!0,A.firstStackClearing=!1)}}return n=a.length&&(G("Invalid fd index for glyph index."),c=!1),c&&(B=a[A].privateDict,C=B.subrsIndex)}else e&&(C=e);if(c&&(c=this.parseCharString(I,r,C,t)),null!==I.width){const A=B.getByName("nominalWidthX");g[o]=A+I.width}else{const A=B.getByName("defaultWidthX");g[o]=A}null!==I.seac&&(n[o]=I.seac),c||A.set(o,new Uint8Array([14]))}return{charStrings:A,seacs:n,widths:g}}emptyPrivateDictionary(A){const e=this.createDict(zi,[],A.strings);A.setByKey(18,[0,0]),A.privateDict=e}parsePrivateDict(A){if(!A.hasName("Private"))return void this.emptyPrivateDictionary(A);const e=A.getByName("Private");if(!Array.isArray(e)||2!==e.length)return void A.removeByName("Private");const t=e[0],i=e[1];if(0===t||i>=this.bytes.length)return void this.emptyPrivateDictionary(A);const a=i+t,s=this.bytes.subarray(i,a),n=this.parseDict(s),g=this.createDict(zi,n,A.strings);if(A.privateDict=g,0===g.getByName("ExpansionFactor")&&g.setByName("ExpansionFactor",.06),!g.getByName("Subrs"))return;const r=g.getByName("Subrs"),o=i+r;if(0===r||o>=this.bytes.length)return void this.emptyPrivateDictionary(A);const I=this.parseIndex(o);g.subrsIndex=I.obj}parseCharsets(A,e,t,i){if(0===A)return new $i(!0,_i.ISO_ADOBE,Fi);if(1===A)return new $i(!0,_i.EXPERT,Si);if(2===A)return new $i(!0,_i.EXPERT_SUBSET,Ri);const a=this.bytes,s=A,n=a[A++],g=[i?0:".notdef"];let r,o,I;switch(e-=1,n){case 0:for(I=0;I=65535)return void G("Not enough space in charstrings to duplicate first glyph.");const A=this.charStrings.get(0);this.charStrings.add(A),this.isCIDFont&&this.fdSelect.fdSelect.push(this.fdSelect.fdSelect[0])}hasGlyphId(A){return!(A<0||A>=this.charStrings.count)&&this.charStrings.get(A).length>0}}class Pi{constructor(A,e,t,i){this.major=A,this.minor=e,this.hdrSize=t,this.offSize=i}}class Wi{constructor(){this.strings=[]}get(A){return A>=0&&A<=390?Yi[A]:A-391<=this.strings.length?this.strings[A-391]:Yi[0]}getSID(A){let e=Yi.indexOf(A);return-1!==e?e:(e=this.strings.indexOf(A),-1!==e?e+391:-1)}add(A){this.strings.push(A)}get count(){return this.strings.length}}class Zi{constructor(){this.objects=[],this.length=0}add(A){this.length+=A.length,this.objects.push(A)}set(A,e){this.length+=e.length-this.objects[A].length,this.objects[A]=e}get(A){return this.objects[A]}get count(){return this.objects.length}}class Oi{constructor(A,e){this.keyToNameMap=A.keyToNameMap,this.nameToKeyMap=A.nameToKeyMap,this.defaults=A.defaults,this.types=A.types,this.opcodes=A.opcodes,this.order=A.order,this.strings=e,this.values=Object.create(null)}setByKey(A,e){if(!(A in this.keyToNameMap))return!1;if(0===e.length)return!0;for(const t of e)if(isNaN(t))return G(`Invalid CFFDict value: "${e}" for key "${A}".`),!0;const t=this.types[A];return"num"!==t&&"sid"!==t&&"offset"!==t||(e=e[0]),this.values[A]=e,!0}setByName(A,e){if(!(A in this.nameToKeyMap))throw new q(`Invalid dictionary name "${A}"`);this.values[this.nameToKeyMap[A]]=e}hasName(A){return this.nameToKeyMap[A]in this.values}getByName(A){if(!(A in this.nameToKeyMap))throw new q(`Invalid dictionary name ${A}"`);const e=this.nameToKeyMap[A];return e in this.values?this.values[e]:this.defaults[e]}removeByName(A){delete this.values[this.nameToKeyMap[A]]}static createTables(A){const e={keyToNameMap:{},nameToKeyMap:{},defaults:{},types:{},opcodes:{},order:[]};for(const t of A){const A=Array.isArray(t[0])?(t[0][0]<<8)+t[0][1]:t[0];e.keyToNameMap[A]=t[1],e.nameToKeyMap[t[1]]=A,e.types[A]=t[2],e.defaults[A]=t[3],e.opcodes[A]=Array.isArray(t[0])?t[0]:[t[0]],e.order.push(A)}return e}}const Xi=[[[12,30],"ROS",["sid","sid","num"],null],[[12,20],"SyntheticBase","num",null],[0,"version","sid",null],[1,"Notice","sid",null],[[12,0],"Copyright","sid",null],[2,"FullName","sid",null],[3,"FamilyName","sid",null],[4,"Weight","sid",null],[[12,1],"isFixedPitch","num",0],[[12,2],"ItalicAngle","num",0],[[12,3],"UnderlinePosition","num",-100],[[12,4],"UnderlineThickness","num",50],[[12,5],"PaintType","num",0],[[12,6],"CharstringType","num",2],[[12,7],"FontMatrix",["num","num","num","num","num","num"],[.001,0,0,.001,0,0]],[13,"UniqueID","num",null],[5,"FontBBox",["num","num","num","num"],[0,0,0,0]],[[12,8],"StrokeWidth","num",0],[14,"XUID","array",null],[15,"charset","offset",0],[16,"Encoding","offset",0],[17,"CharStrings","offset",0],[18,"Private",["offset","offset"],null],[[12,21],"PostScript","sid",null],[[12,22],"BaseFontName","sid",null],[[12,23],"BaseFontBlend","delta",null],[[12,31],"CIDFontVersion","num",0],[[12,32],"CIDFontRevision","num",0],[[12,33],"CIDFontType","num",0],[[12,34],"CIDCount","num",8720],[[12,35],"UIDBase","num",null],[[12,37],"FDSelect","offset",null],[[12,36],"FDArray","offset",null],[[12,38],"FontName","sid",null]];class Vi extends Oi{static get tables(){return M(this,"tables",this.createTables(Xi))}constructor(A){super(Vi.tables,A),this.privateDict=null}}const ji=[[6,"BlueValues","delta",null],[7,"OtherBlues","delta",null],[8,"FamilyBlues","delta",null],[9,"FamilyOtherBlues","delta",null],[[12,9],"BlueScale","num",.039625],[[12,10],"BlueShift","num",7],[[12,11],"BlueFuzz","num",1],[10,"StdHW","num",null],[11,"StdVW","num",null],[[12,12],"StemSnapH","delta",null],[[12,13],"StemSnapV","delta",null],[[12,14],"ForceBold","num",0],[[12,17],"LanguageGroup","num",0],[[12,18],"ExpansionFactor","num",.06],[[12,19],"initialRandomSeed","num",0],[20,"defaultWidthX","num",0],[21,"nominalWidthX","num",0],[19,"Subrs","offset",null]];class zi extends Oi{static get tables(){return M(this,"tables",this.createTables(ji))}constructor(A){super(zi.tables,A),this.subrsIndex=null}}const _i={ISO_ADOBE:0,EXPERT:1,EXPERT_SUBSET:2};class $i{constructor(A,e,t,i){this.predefined=A,this.format=e,this.charset=t,this.raw=i}}class Aa{constructor(A,e,t,i){this.predefined=A,this.format=e,this.encoding=t,this.raw=i}}class ea{constructor(A,e){this.format=A,this.fdSelect=e}getFDIndex(A){return A<0||A>=this.fdSelect.length?-1:this.fdSelect[A]}}class ta{constructor(){this.offsets=Object.create(null)}isTracking(A){return A in this.offsets}track(A,e){if(A in this.offsets)throw new q(`Already tracking location of ${A}`);this.offsets[A]=e}offset(A){for(const e in this.offsets)this.offsets[e]+=A}setEntryLocation(A,e,t){if(!(A in this.offsets))throw new q(`Not tracking location of ${A}`);const i=t.data,a=this.offsets[A];for(let A=0,t=e.length;A>24&255,i[n]=o>>16&255,i[g]=o>>8&255,i[r]=255&o}}}class ia{constructor(A){this.cff=A}compile(){const A=this.cff,e={data:[],length:0,add(A){try{this.data.push(...A)}catch{this.data=this.data.concat(A)}this.length=this.data.length}},t=this.compileHeader(A.header);e.add(t);const i=this.compileNameIndex(A.names);if(e.add(i),A.isCIDFont&&A.topDict.hasName("FontMatrix")){const e=A.topDict.getByName("FontMatrix");A.topDict.removeByName("FontMatrix");for(const t of A.fdArray){let A=e.slice(0);t.hasName("FontMatrix")&&(A=j.transform(A,t.getByName("FontMatrix"))),t.setByName("FontMatrix",A)}}const a=A.topDict.getByName("XUID");a?.length>16&&A.topDict.removeByName("XUID"),A.topDict.setByName("charset",0);let s=this.compileTopDicts([A.topDict],e.length,A.isCIDFont);e.add(s.output);const n=s.trackers[0],g=this.compileStringIndex(A.strings.strings);e.add(g);const r=this.compileIndex(A.globalSubrIndex);if(e.add(r),A.encoding&&A.topDict.hasName("Encoding"))if(A.encoding.predefined)n.setEntryLocation("Encoding",[A.encoding.format],e);else{const t=this.compileEncoding(A.encoding);n.setEntryLocation("Encoding",[e.length],e),e.add(t)}const o=this.compileCharset(A.charset,A.charStrings.count,A.strings,A.isCIDFont);n.setEntryLocation("charset",[e.length],e),e.add(o);const I=this.compileCharStrings(A.charStrings);if(n.setEntryLocation("CharStrings",[e.length],e),e.add(I),A.isCIDFont){n.setEntryLocation("FDSelect",[e.length],e);const t=this.compileFDSelect(A.fdSelect);e.add(t),s=this.compileTopDicts(A.fdArray,e.length,!0),n.setEntryLocation("FDArray",[e.length],e),e.add(s.output);const i=s.trackers;this.compilePrivateDicts(A.fdArray,i,e)}return this.compilePrivateDicts([A.topDict],[n],e),e.add([0]),e.data}encodeNumber(A){return Number.isInteger(A)?this.encodeInteger(A):this.encodeFloat(A)}static get EncodeFloatRegExp(){return M(this,"EncodeFloatRegExp",/\.(\d*?)(?:9{5,20}|0{5,20})\d{0,2}(?:e(.+)|$)/)}encodeFloat(A){let e=A.toString();const t=ia.EncodeFloatRegExp.exec(e);if(t){const i=parseFloat("1e"+((t[2]?+t[2]:0)+t[1].length));e=(Math.round(A*i)/i).toString()}let i,a,s="";for(i=0,a=e.length;i=-107&&A<=107?[A+139]:A>=108&&A<=1131?[247+((A-=108)>>8),255&A]:A>=-1131&&A<=-108?[251+((A=-A-108)>>8),255&A]:A>=-32768&&A<=32767?[28,A>>8&255,255&A]:[29,A>>24&255,A>>16&255,A>>8&255,255&A],e}compileHeader(A){return[A.major,A.minor,4,A.offSize]}compileNameIndex(A){const e=new Zi;for(const t of A){const A=Math.min(t.length,127);let i=new Array(A);for(let e=0;e"~"||"["===A||"]"===A||"("===A||")"===A||"{"===A||"}"===A||"<"===A||">"===A||"/"===A||"%"===A)&&(A="_"),i[e]=A}i=i.join(""),""===i&&(i="Bad_Font_Name"),e.add(W(i))}return this.compileIndex(e)}compileTopDicts(A,e,t){const i=[];let a=new Zi;for(const s of A){t&&(s.removeByName("CIDFontVersion"),s.removeByName("CIDFontRevision"),s.removeByName("CIDFontType"),s.removeByName("CIDCount"),s.removeByName("UIDBase"));const A=new ta,n=this.compileDict(s,A);i.push(A),a.add(n),A.offset(e)}return a=this.compileIndex(a,i),{trackers:i,output:a}}compilePrivateDicts(A,e,t){for(let i=0,a=A.length;i>8&255,255&s]);else{a=new Uint8Array(1+2*s),a[0]=0;let e=0;const i=A.charset.length;let n=!1;for(let s=1;s>8&255,a[s+1]=255&g}}return this.compileTypedArray(a)}compileEncoding(A){return this.compileTypedArray(A.raw)}compileFDSelect(A){const e=A.format;let t,i;switch(e){case 0:for(t=new Uint8Array(1+A.fdSelect.length),t[0]=e,i=0;i>8&255,255&a,s];for(i=1;i>8&255,255&i,e),s=e)}const g=(n.length-3)/3;n[1]=g>>8&255,n[2]=255&g,n.push(i>>8&255,255&i),t=new Uint8Array(n)}return this.compileTypedArray(t)}compileTypedArray(A){return Array.from(A)}compileIndex(A,e=[]){const t=A.objects,i=t.length;if(0===i)return[0,0];const a=[i>>8&255,255&i];let s,n,g=1;for(s=0;s>8&255,255&r):3===n?a.push(r>>16&255,r>>8&255,255&r):a.push(r>>>24&255,r>>16&255,r>>8&255,255&r),t[s]&&(r+=t[s].length);for(s=0;s=5&&e<=7))return-1;i=A.substring(1)}if(i===i.toUpperCase()&&(t=parseInt(i,16),t>=0))return t}return-1}const ra=[[0,127],[128,255],[256,383],[384,591],[592,687,7424,7551,7552,7615],[688,767,42752,42783],[768,879,7616,7679],[880,1023],[11392,11519],[1024,1279,1280,1327,11744,11775,42560,42655],[1328,1423],[1424,1535],[42240,42559],[1536,1791,1872,1919],[1984,2047],[2304,2431],[2432,2559],[2560,2687],[2688,2815],[2816,2943],[2944,3071],[3072,3199],[3200,3327],[3328,3455],[3584,3711],[3712,3839],[4256,4351,11520,11567],[6912,7039],[4352,4607],[7680,7935,11360,11391,42784,43007],[7936,8191],[8192,8303,11776,11903],[8304,8351],[8352,8399],[8400,8447],[8448,8527],[8528,8591],[8592,8703,10224,10239,10496,10623,11008,11263],[8704,8959,10752,11007,10176,10223,10624,10751],[8960,9215],[9216,9279],[9280,9311],[9312,9471],[9472,9599],[9600,9631],[9632,9727],[9728,9983],[9984,10175],[12288,12351],[12352,12447],[12448,12543,12784,12799],[12544,12591,12704,12735],[12592,12687],[43072,43135],[12800,13055],[13056,13311],[44032,55215],[55296,57343],[67840,67871],[19968,40959,11904,12031,12032,12255,12272,12287,13312,19903,131072,173791,12688,12703],[57344,63743],[12736,12783,63744,64255,194560,195103],[64256,64335],[64336,65023],[65056,65071],[65040,65055],[65104,65135],[65136,65279],[65280,65519],[65520,65535],[3840,4095],[1792,1871],[1920,1983],[3456,3583],[4096,4255],[4608,4991,4992,5023,11648,11743],[5024,5119],[5120,5759],[5760,5791],[5792,5887],[6016,6143],[6144,6319],[10240,10495],[40960,42127],[5888,5919,5920,5951,5952,5983,5984,6015],[66304,66351],[66352,66383],[66560,66639],[118784,119039,119040,119295,119296,119375],[119808,120831],[1044480,1048573],[65024,65039,917760,917999],[917504,917631],[6400,6479],[6480,6527],[6528,6623],[6656,6687],[11264,11359],[11568,11647],[19904,19967],[43008,43055],[65536,65663,65664,65791,65792,65855],[65856,65935],[66432,66463],[66464,66527],[66640,66687],[66688,66735],[67584,67647],[68096,68191],[119552,119647],[73728,74751,74752,74879],[119648,119679],[7040,7103],[7168,7247],[7248,7295],[43136,43231],[43264,43311],[43312,43359],[43520,43615],[65936,65999],[66e3,66047],[66208,66271,66176,66207,67872,67903],[127024,127135,126976,127023]];function oa(A,e=-1){if(-1!==e){const t=ra[e];for(let i=0,a=t.length;i=t[i]&&A<=t[i+1])return e}for(let e=0,t=ra.length;e=t[i]&&A<=t[i+1])return e}return-1}const Ia=new RegExp("^(\\s)|(\\p{Mn})|(\\p{Cf})$","u"),ca=new Map,Ca=!0,Ba=[".notdef",".null","nonmarkingreturn","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quotesingle","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","grave","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","Adieresis","Aring","Ccedilla","Eacute","Ntilde","Odieresis","Udieresis","aacute","agrave","acircumflex","adieresis","atilde","aring","ccedilla","eacute","egrave","ecircumflex","edieresis","iacute","igrave","icircumflex","idieresis","ntilde","oacute","ograve","ocircumflex","odieresis","otilde","uacute","ugrave","ucircumflex","udieresis","dagger","degree","cent","sterling","section","bullet","paragraph","germandbls","registered","copyright","trademark","acute","dieresis","notequal","AE","Oslash","infinity","plusminus","lessequal","greaterequal","yen","mu","partialdiff","summation","product","pi","integral","ordfeminine","ordmasculine","Omega","ae","oslash","questiondown","exclamdown","logicalnot","radical","florin","approxequal","Delta","guillemotleft","guillemotright","ellipsis","nonbreakingspace","Agrave","Atilde","Otilde","OE","oe","endash","emdash","quotedblleft","quotedblright","quoteleft","quoteright","divide","lozenge","ydieresis","Ydieresis","fraction","currency","guilsinglleft","guilsinglright","fi","fl","daggerdbl","periodcentered","quotesinglbase","quotedblbase","perthousand","Acircumflex","Ecircumflex","Aacute","Edieresis","Egrave","Iacute","Icircumflex","Idieresis","Igrave","Oacute","Ocircumflex","apple","Ograve","Uacute","Ucircumflex","Ugrave","dotlessi","circumflex","tilde","macron","breve","dotaccent","ring","cedilla","hungarumlaut","ogonek","caron","Lslash","lslash","Scaron","scaron","Zcaron","zcaron","brokenbar","Eth","eth","Yacute","yacute","Thorn","thorn","minus","multiply","onesuperior","twosuperior","threesuperior","onehalf","onequarter","threequarters","franc","Gbreve","gbreve","Idotaccent","Scedilla","scedilla","Cacute","cacute","Ccaron","ccaron","dcroat"];function ha(A,e){if(void 0!==e[A])return A;const t=ga(A,e);if(-1!==t)for(const A in e)if(e[A]===t)return A;return R("Unable to recover a standard glyph name for: "+A),A}function Qa(A,e,t){const i=Object.create(null);let a,s,n;const g=!!(4&A.flags);if(A.isInternalFont)for(n=e,s=0;s=0?a:0;else if(A.baseEncodingName)for(n=Hi(A.baseEncodingName),s=0;s=0?a:0;else if(g)for(s in e)i[s]=e[s];else for(n=Ui,s=0;s=0?a:0;const r=A.differences;let o;if(r)for(s in r){const A=r[s];if(a=t.indexOf(A),-1===a){o||(o=aa());const e=ha(A,o);e!==A&&(a=t.indexOf(e))}i[s]=a>=0?a:0}return i}function la(A){return A.replaceAll(/[,_]/g,"-").replaceAll(/\s/g,"")}const Ea=yA((A=>{A[8211]=65074,A[8212]=65073,A[8229]=65072,A[8230]=65049,A[12289]=65041,A[12290]=65042,A[12296]=65087,A[12297]=65088,A[12298]=65085,A[12299]=65086,A[12300]=65089,A[12301]=65090,A[12302]=65091,A[12303]=65092,A[12304]=65083,A[12305]=65084,A[12308]=65081,A[12309]=65082,A[12310]=65047,A[12311]=65048,A[65103]=65076,A[65281]=65045,A[65288]=65077,A[65289]=65078,A[65292]=65040,A[65306]=65043,A[65307]=65044,A[65311]=65046,A[65339]=65095,A[65341]=65096,A[65343]=65075,A[65371]=65079,A[65373]=65080})),ua=yA((function(A){A["Times-Roman"]="Times-Roman",A.Helvetica="Helvetica",A.Courier="Courier",A.Symbol="Symbol",A["Times-Bold"]="Times-Bold",A["Helvetica-Bold"]="Helvetica-Bold",A["Courier-Bold"]="Courier-Bold",A.ZapfDingbats="ZapfDingbats",A["Times-Italic"]="Times-Italic",A["Helvetica-Oblique"]="Helvetica-Oblique",A["Courier-Oblique"]="Courier-Oblique",A["Times-BoldItalic"]="Times-BoldItalic",A["Helvetica-BoldOblique"]="Helvetica-BoldOblique",A["Courier-BoldOblique"]="Courier-BoldOblique",A.ArialNarrow="Helvetica",A["ArialNarrow-Bold"]="Helvetica-Bold",A["ArialNarrow-BoldItalic"]="Helvetica-BoldOblique",A["ArialNarrow-Italic"]="Helvetica-Oblique",A.ArialBlack="Helvetica",A["ArialBlack-Bold"]="Helvetica-Bold",A["ArialBlack-BoldItalic"]="Helvetica-BoldOblique",A["ArialBlack-Italic"]="Helvetica-Oblique",A["Arial-Black"]="Helvetica",A["Arial-Black-Bold"]="Helvetica-Bold",A["Arial-Black-BoldItalic"]="Helvetica-BoldOblique",A["Arial-Black-Italic"]="Helvetica-Oblique",A.Arial="Helvetica",A["Arial-Bold"]="Helvetica-Bold",A["Arial-BoldItalic"]="Helvetica-BoldOblique",A["Arial-Italic"]="Helvetica-Oblique",A.ArialMT="Helvetica",A["Arial-BoldItalicMT"]="Helvetica-BoldOblique",A["Arial-BoldMT"]="Helvetica-Bold",A["Arial-ItalicMT"]="Helvetica-Oblique",A["Arial-BoldItalicMT-BoldItalic"]="Helvetica-BoldOblique",A["Arial-BoldMT-Bold"]="Helvetica-Bold",A["Arial-ItalicMT-Italic"]="Helvetica-Oblique",A.ArialUnicodeMS="Helvetica",A["ArialUnicodeMS-Bold"]="Helvetica-Bold",A["ArialUnicodeMS-BoldItalic"]="Helvetica-BoldOblique",A["ArialUnicodeMS-Italic"]="Helvetica-Oblique",A["Courier-BoldItalic"]="Courier-BoldOblique",A["Courier-Italic"]="Courier-Oblique",A.CourierNew="Courier",A["CourierNew-Bold"]="Courier-Bold",A["CourierNew-BoldItalic"]="Courier-BoldOblique",A["CourierNew-Italic"]="Courier-Oblique",A["CourierNewPS-BoldItalicMT"]="Courier-BoldOblique",A["CourierNewPS-BoldMT"]="Courier-Bold",A["CourierNewPS-ItalicMT"]="Courier-Oblique",A.CourierNewPSMT="Courier",A["Helvetica-BoldItalic"]="Helvetica-BoldOblique",A["Helvetica-Italic"]="Helvetica-Oblique",A["Symbol-Bold"]="Symbol",A["Symbol-BoldItalic"]="Symbol",A["Symbol-Italic"]="Symbol",A.TimesNewRoman="Times-Roman",A["TimesNewRoman-Bold"]="Times-Bold",A["TimesNewRoman-BoldItalic"]="Times-BoldItalic",A["TimesNewRoman-Italic"]="Times-Italic",A.TimesNewRomanPS="Times-Roman",A["TimesNewRomanPS-Bold"]="Times-Bold",A["TimesNewRomanPS-BoldItalic"]="Times-BoldItalic",A["TimesNewRomanPS-BoldItalicMT"]="Times-BoldItalic",A["TimesNewRomanPS-BoldMT"]="Times-Bold",A["TimesNewRomanPS-Italic"]="Times-Italic",A["TimesNewRomanPS-ItalicMT"]="Times-Italic",A.TimesNewRomanPSMT="Times-Roman",A["TimesNewRomanPSMT-Bold"]="Times-Bold",A["TimesNewRomanPSMT-BoldItalic"]="Times-BoldItalic",A["TimesNewRomanPSMT-Italic"]="Times-Italic"})),da=yA((function(A){A.Courier="FoxitFixed.pfb",A["Courier-Bold"]="FoxitFixedBold.pfb",A["Courier-BoldOblique"]="FoxitFixedBoldItalic.pfb",A["Courier-Oblique"]="FoxitFixedItalic.pfb",A.Helvetica="LiberationSans-Regular.ttf",A["Helvetica-Bold"]="LiberationSans-Bold.ttf",A["Helvetica-BoldOblique"]="LiberationSans-BoldItalic.ttf",A["Helvetica-Oblique"]="LiberationSans-Italic.ttf",A["Times-Roman"]="FoxitSerif.pfb",A["Times-Bold"]="FoxitSerifBold.pfb",A["Times-BoldItalic"]="FoxitSerifBoldItalic.pfb",A["Times-Italic"]="FoxitSerifItalic.pfb",A.Symbol="FoxitSymbol.pfb",A.ZapfDingbats="FoxitDingbats.pfb",A["LiberationSans-Regular"]="LiberationSans-Regular.ttf",A["LiberationSans-Bold"]="LiberationSans-Bold.ttf",A["LiberationSans-Italic"]="LiberationSans-Italic.ttf",A["LiberationSans-BoldItalic"]="LiberationSans-BoldItalic.ttf"})),fa=yA((function(A){A.Calibri="Helvetica",A["Calibri-Bold"]="Helvetica-Bold",A["Calibri-BoldItalic"]="Helvetica-BoldOblique",A["Calibri-Italic"]="Helvetica-Oblique",A.CenturyGothic="Helvetica",A["CenturyGothic-Bold"]="Helvetica-Bold",A["CenturyGothic-BoldItalic"]="Helvetica-BoldOblique",A["CenturyGothic-Italic"]="Helvetica-Oblique",A.ComicSansMS="Comic Sans MS",A["ComicSansMS-Bold"]="Comic Sans MS-Bold",A["ComicSansMS-BoldItalic"]="Comic Sans MS-BoldItalic",A["ComicSansMS-Italic"]="Comic Sans MS-Italic",A.Impact="Helvetica",A["ItcSymbol-Bold"]="Helvetica-Bold",A["ItcSymbol-BoldItalic"]="Helvetica-BoldOblique",A["ItcSymbol-Book"]="Helvetica",A["ItcSymbol-BookItalic"]="Helvetica-Oblique",A["ItcSymbol-Medium"]="Helvetica",A["ItcSymbol-MediumItalic"]="Helvetica-Oblique",A.LucidaConsole="Courier",A["LucidaConsole-Bold"]="Courier-Bold",A["LucidaConsole-BoldItalic"]="Courier-BoldOblique",A["LucidaConsole-Italic"]="Courier-Oblique",A["LucidaSans-Demi"]="Helvetica-Bold",A["MS-Gothic"]="MS Gothic",A["MS-Gothic-Bold"]="MS Gothic-Bold",A["MS-Gothic-BoldItalic"]="MS Gothic-BoldItalic",A["MS-Gothic-Italic"]="MS Gothic-Italic",A["MS-Mincho"]="MS Mincho",A["MS-Mincho-Bold"]="MS Mincho-Bold",A["MS-Mincho-BoldItalic"]="MS Mincho-BoldItalic",A["MS-Mincho-Italic"]="MS Mincho-Italic",A["MS-PGothic"]="MS PGothic",A["MS-PGothic-Bold"]="MS PGothic-Bold",A["MS-PGothic-BoldItalic"]="MS PGothic-BoldItalic",A["MS-PGothic-Italic"]="MS PGothic-Italic",A["MS-PMincho"]="MS PMincho",A["MS-PMincho-Bold"]="MS PMincho-Bold",A["MS-PMincho-BoldItalic"]="MS PMincho-BoldItalic",A["MS-PMincho-Italic"]="MS PMincho-Italic",A.NuptialScript="Times-Italic",A.SegoeUISymbol="Helvetica"})),pa=yA((function(A){A["Adobe Jenson"]=!0,A["Adobe Text"]=!0,A.Albertus=!0,A.Aldus=!0,A.Alexandria=!0,A.Algerian=!0,A["American Typewriter"]=!0,A.Antiqua=!0,A.Apex=!0,A.Arno=!0,A.Aster=!0,A.Aurora=!0,A.Baskerville=!0,A.Bell=!0,A.Bembo=!0,A["Bembo Schoolbook"]=!0,A.Benguiat=!0,A["Berkeley Old Style"]=!0,A["Bernhard Modern"]=!0,A["Berthold City"]=!0,A.Bodoni=!0,A["Bauer Bodoni"]=!0,A["Book Antiqua"]=!0,A.Bookman=!0,A["Bordeaux Roman"]=!0,A["Californian FB"]=!0,A.Calisto=!0,A.Calvert=!0,A.Capitals=!0,A.Cambria=!0,A.Cartier=!0,A.Caslon=!0,A.Catull=!0,A.Centaur=!0,A["Century Old Style"]=!0,A["Century Schoolbook"]=!0,A.Chaparral=!0,A["Charis SIL"]=!0,A.Cheltenham=!0,A["Cholla Slab"]=!0,A.Clarendon=!0,A.Clearface=!0,A.Cochin=!0,A.Colonna=!0,A["Computer Modern"]=!0,A["Concrete Roman"]=!0,A.Constantia=!0,A["Cooper Black"]=!0,A.Corona=!0,A.Ecotype=!0,A.Egyptienne=!0,A.Elephant=!0,A.Excelsior=!0,A.Fairfield=!0,A["FF Scala"]=!0,A.Folkard=!0,A.Footlight=!0,A.FreeSerif=!0,A["Friz Quadrata"]=!0,A.Garamond=!0,A.Gentium=!0,A.Georgia=!0,A.Gloucester=!0,A["Goudy Old Style"]=!0,A["Goudy Schoolbook"]=!0,A["Goudy Pro Font"]=!0,A.Granjon=!0,A["Guardian Egyptian"]=!0,A.Heather=!0,A.Hercules=!0,A["High Tower Text"]=!0,A.Hiroshige=!0,A["Hoefler Text"]=!0,A["Humana Serif"]=!0,A.Imprint=!0,A["Ionic No. 5"]=!0,A.Janson=!0,A.Joanna=!0,A.Korinna=!0,A.Lexicon=!0,A.LiberationSerif=!0,A["Liberation Serif"]=!0,A["Linux Libertine"]=!0,A.Literaturnaya=!0,A.Lucida=!0,A["Lucida Bright"]=!0,A.Melior=!0,A.Memphis=!0,A.Miller=!0,A.Minion=!0,A.Modern=!0,A["Mona Lisa"]=!0,A["Mrs Eaves"]=!0,A["MS Serif"]=!0,A["Museo Slab"]=!0,A["New York"]=!0,A["Nimbus Roman"]=!0,A["NPS Rawlinson Roadway"]=!0,A.NuptialScript=!0,A.Palatino=!0,A.Perpetua=!0,A.Plantin=!0,A["Plantin Schoolbook"]=!0,A.Playbill=!0,A["Poor Richard"]=!0,A["Rawlinson Roadway"]=!0,A.Renault=!0,A.Requiem=!0,A.Rockwell=!0,A.Roman=!0,A["Rotis Serif"]=!0,A.Sabon=!0,A.Scala=!0,A.Seagull=!0,A.Sistina=!0,A.Souvenir=!0,A.STIX=!0,A["Stone Informal"]=!0,A["Stone Serif"]=!0,A.Sylfaen=!0,A.Times=!0,A.Trajan=!0,A["Trinité"]=!0,A["Trump Mediaeval"]=!0,A.Utopia=!0,A["Vale Type"]=!0,A["Bitstream Vera"]=!0,A["Vera Serif"]=!0,A.Versailles=!0,A.Wanted=!0,A.Weiss=!0,A["Wide Latin"]=!0,A.Windsor=!0,A.XITS=!0})),ma=yA((function(A){A.Dingbats=!0,A.Symbol=!0,A.ZapfDingbats=!0,A.Wingdings=!0,A["Wingdings-Bold"]=!0,A["Wingdings-Regular"]=!0})),ya=yA((function(A){A[2]=10,A[3]=32,A[4]=33,A[5]=34,A[6]=35,A[7]=36,A[8]=37,A[9]=38,A[10]=39,A[11]=40,A[12]=41,A[13]=42,A[14]=43,A[15]=44,A[16]=45,A[17]=46,A[18]=47,A[19]=48,A[20]=49,A[21]=50,A[22]=51,A[23]=52,A[24]=53,A[25]=54,A[26]=55,A[27]=56,A[28]=57,A[29]=58,A[30]=894,A[31]=60,A[32]=61,A[33]=62,A[34]=63,A[35]=64,A[36]=65,A[37]=66,A[38]=67,A[39]=68,A[40]=69,A[41]=70,A[42]=71,A[43]=72,A[44]=73,A[45]=74,A[46]=75,A[47]=76,A[48]=77,A[49]=78,A[50]=79,A[51]=80,A[52]=81,A[53]=82,A[54]=83,A[55]=84,A[56]=85,A[57]=86,A[58]=87,A[59]=88,A[60]=89,A[61]=90,A[62]=91,A[63]=92,A[64]=93,A[65]=94,A[66]=95,A[67]=96,A[68]=97,A[69]=98,A[70]=99,A[71]=100,A[72]=101,A[73]=102,A[74]=103,A[75]=104,A[76]=105,A[77]=106,A[78]=107,A[79]=108,A[80]=109,A[81]=110,A[82]=111,A[83]=112,A[84]=113,A[85]=114,A[86]=115,A[87]=116,A[88]=117,A[89]=118,A[90]=119,A[91]=120,A[92]=121,A[93]=122,A[94]=123,A[95]=124,A[96]=125,A[97]=126,A[98]=196,A[99]=197,A[100]=199,A[101]=201,A[102]=209,A[103]=214,A[104]=220,A[105]=225,A[106]=224,A[107]=226,A[108]=228,A[109]=227,A[110]=229,A[111]=231,A[112]=233,A[113]=232,A[114]=234,A[115]=235,A[116]=237,A[117]=236,A[118]=238,A[119]=239,A[120]=241,A[121]=243,A[122]=242,A[123]=244,A[124]=246,A[125]=245,A[126]=250,A[127]=249,A[128]=251,A[129]=252,A[130]=8224,A[131]=176,A[132]=162,A[133]=163,A[134]=167,A[135]=8226,A[136]=182,A[137]=223,A[138]=174,A[139]=169,A[140]=8482,A[141]=180,A[142]=168,A[143]=8800,A[144]=198,A[145]=216,A[146]=8734,A[147]=177,A[148]=8804,A[149]=8805,A[150]=165,A[151]=181,A[152]=8706,A[153]=8721,A[154]=8719,A[156]=8747,A[157]=170,A[158]=186,A[159]=8486,A[160]=230,A[161]=248,A[162]=191,A[163]=161,A[164]=172,A[165]=8730,A[166]=402,A[167]=8776,A[168]=8710,A[169]=171,A[170]=187,A[171]=8230,A[179]=8220,A[180]=8221,A[181]=8216,A[182]=8217,A[200]=193,A[203]=205,A[207]=211,A[210]=218,A[223]=711,A[224]=321,A[225]=322,A[226]=352,A[227]=353,A[228]=381,A[229]=382,A[233]=221,A[234]=253,A[252]=263,A[253]=268,A[254]=269,A[258]=258,A[260]=260,A[261]=261,A[265]=280,A[266]=281,A[267]=282,A[268]=283,A[269]=313,A[275]=323,A[276]=324,A[278]=328,A[283]=344,A[284]=345,A[285]=346,A[286]=347,A[292]=367,A[295]=377,A[296]=378,A[298]=380,A[305]=963,A[306]=964,A[307]=966,A[308]=8215,A[309]=8252,A[310]=8319,A[311]=8359,A[312]=8592,A[313]=8593,A[337]=9552,A[493]=1039,A[494]=1040,A[672]=1488,A[673]=1489,A[674]=1490,A[675]=1491,A[676]=1492,A[677]=1493,A[678]=1494,A[679]=1495,A[680]=1496,A[681]=1497,A[682]=1498,A[683]=1499,A[684]=1500,A[685]=1501,A[686]=1502,A[687]=1503,A[688]=1504,A[689]=1505,A[690]=1506,A[691]=1507,A[692]=1508,A[693]=1509,A[694]=1510,A[695]=1511,A[696]=1512,A[697]=1513,A[698]=1514,A[705]=1524,A[706]=8362,A[710]=64288,A[711]=64298,A[759]=1617,A[761]=1776,A[763]=1778,A[775]=1652,A[777]=1764,A[778]=1780,A[779]=1781,A[780]=1782,A[782]=771,A[783]=64726,A[786]=8363,A[788]=8532,A[790]=768,A[791]=769,A[792]=768,A[795]=803,A[797]=64336,A[798]=64337,A[799]=64342,A[800]=64343,A[801]=64344,A[802]=64345,A[803]=64362,A[804]=64363,A[805]=64364,A[2424]=7821,A[2425]=7822,A[2426]=7823,A[2427]=7824,A[2428]=7825,A[2429]=7826,A[2430]=7827,A[2433]=7682,A[2678]=8045,A[2679]=8046,A[2830]=1552,A[2838]=686,A[2840]=751,A[2842]=753,A[2843]=754,A[2844]=755,A[2846]=757,A[2856]=767,A[2857]=848,A[2858]=849,A[2862]=853,A[2863]=854,A[2864]=855,A[2865]=861,A[2866]=862,A[2906]=7460,A[2908]=7462,A[2909]=7463,A[2910]=7464,A[2912]=7466,A[2913]=7467,A[2914]=7468,A[2916]=7470,A[2917]=7471,A[2918]=7472,A[2920]=7474,A[2921]=7475,A[2922]=7476,A[2924]=7478,A[2925]=7479,A[2926]=7480,A[2928]=7482,A[2929]=7483,A[2930]=7484,A[2932]=7486,A[2933]=7487,A[2934]=7488,A[2936]=7490,A[2937]=7491,A[2938]=7492,A[2940]=7494,A[2941]=7495,A[2942]=7496,A[2944]=7498,A[2946]=7500,A[2948]=7502,A[2950]=7504,A[2951]=7505,A[2952]=7506,A[2954]=7508,A[2955]=7509,A[2956]=7510,A[2958]=7512,A[2959]=7513,A[2960]=7514,A[2962]=7516,A[2963]=7517,A[2964]=7518,A[2966]=7520,A[2967]=7521,A[2968]=7522,A[2970]=7524,A[2971]=7525,A[2972]=7526,A[2974]=7528,A[2975]=7529,A[2976]=7530,A[2978]=1537,A[2979]=1538,A[2980]=1539,A[2982]=1549,A[2983]=1551,A[2984]=1552,A[2986]=1554,A[2987]=1555,A[2988]=1556,A[2990]=1623,A[2991]=1624,A[2995]=1775,A[2999]=1791,A[3002]=64290,A[3003]=64291,A[3004]=64292,A[3006]=64294,A[3007]=64295,A[3008]=64296,A[3011]=1900,A[3014]=8223,A[3015]=8244,A[3017]=7532,A[3018]=7533,A[3019]=7534,A[3075]=7590,A[3076]=7591,A[3079]=7594,A[3080]=7595,A[3083]=7598,A[3084]=7599,A[3087]=7602,A[3088]=7603,A[3091]=7606,A[3092]=7607,A[3095]=7610,A[3096]=7611,A[3099]=7614,A[3100]=7615,A[3103]=7618,A[3104]=7619,A[3107]=8337,A[3108]=8338,A[3116]=1884,A[3119]=1885,A[3120]=1885,A[3123]=1886,A[3124]=1886,A[3127]=1887,A[3128]=1887,A[3131]=1888,A[3132]=1888,A[3135]=1889,A[3136]=1889,A[3139]=1890,A[3140]=1890,A[3143]=1891,A[3144]=1891,A[3147]=1892,A[3148]=1892,A[3153]=580,A[3154]=581,A[3157]=584,A[3158]=585,A[3161]=588,A[3162]=589,A[3165]=891,A[3166]=892,A[3169]=1274,A[3170]=1275,A[3173]=1278,A[3174]=1279,A[3181]=7622,A[3182]=7623,A[3282]=11799,A[3316]=578,A[3379]=42785,A[3393]=1159,A[3416]=8377})),wa=yA((function(A){A[227]=322,A[264]=261,A[291]=346})),Da=yA((function(A){A[1]=32,A[4]=65,A[5]=192,A[6]=193,A[9]=196,A[17]=66,A[18]=67,A[21]=268,A[24]=68,A[28]=69,A[29]=200,A[30]=201,A[32]=282,A[38]=70,A[39]=71,A[44]=72,A[47]=73,A[48]=204,A[49]=205,A[58]=74,A[60]=75,A[62]=76,A[68]=77,A[69]=78,A[75]=79,A[76]=210,A[80]=214,A[87]=80,A[89]=81,A[90]=82,A[92]=344,A[94]=83,A[97]=352,A[100]=84,A[104]=85,A[109]=220,A[115]=86,A[116]=87,A[121]=88,A[122]=89,A[124]=221,A[127]=90,A[129]=381,A[258]=97,A[259]=224,A[260]=225,A[263]=228,A[268]=261,A[271]=98,A[272]=99,A[273]=263,A[275]=269,A[282]=100,A[286]=101,A[287]=232,A[288]=233,A[290]=283,A[295]=281,A[296]=102,A[336]=103,A[346]=104,A[349]=105,A[350]=236,A[351]=237,A[361]=106,A[364]=107,A[367]=108,A[371]=322,A[373]=109,A[374]=110,A[381]=111,A[382]=242,A[383]=243,A[386]=246,A[393]=112,A[395]=113,A[396]=114,A[398]=345,A[400]=115,A[401]=347,A[403]=353,A[410]=116,A[437]=117,A[442]=252,A[448]=118,A[449]=119,A[454]=120,A[455]=121,A[457]=253,A[460]=122,A[462]=382,A[463]=380,A[853]=44,A[855]=58,A[856]=46,A[876]=47,A[878]=45,A[882]=45,A[894]=40,A[895]=41,A[896]=91,A[897]=93,A[923]=64,A[1004]=48,A[1005]=49,A[1006]=50,A[1007]=51,A[1008]=52,A[1009]=53,A[1010]=54,A[1011]=55,A[1012]=56,A[1013]=57,A[1081]=37,A[1085]=43,A[1086]=45}));function ba(A){const e=la(A);return ua()[e]}function ka(A){const e=la(A);return!!(ua()[e]||fa()[e]||pa()[e]||ma()[e])}class Fa{constructor(A=[]){this._map=A}get length(){return this._map.length}forEach(A){for(const e in this._map)A(e,this._map[e].charCodeAt(0))}has(A){return void 0!==this._map[A]}get(A){return this._map[A]}charCodeOf(A){const e=this._map;if(e.length<=65536)return e.indexOf(A);for(const t in e)if(e[t]===A)return 0|t;return-1}amend(A){for(const e in A)this._map[e]=A[e]}}class Sa{constructor(A,e){this.firstChar=A,this.lastChar=e}get length(){return this.lastChar+1-this.firstChar}forEach(A){for(let e=this.firstChar,t=this.lastChar;e<=t;e++)A(e,e)}has(A){return this.firstChar<=A&&A<=this.lastChar}get(A){if(this.firstChar<=A&&A<=this.lastChar)return String.fromCharCode(A)}charCodeOf(A){return Number.isInteger(A)&&A>=this.firstChar&&A<=this.lastChar?A:-1}amend(A){N("Should not call amend()")}}class Ra{constructor(A,e){this.properties=e;const t=new qi(A,e,Ca);this.cff=t.parse(),this.cff.duplicateFirstGlyph();const i=new ia(this.cff);this.seacs=this.cff.seacs;try{this.data=i.compile()}catch{G("Failed to compile font "+e.loadedName),this.data=A}this._createBuiltInEncoding()}get numGlyphs(){return this.cff.charStrings.count}getCharset(){return this.cff.charset.charset}getGlyphMapping(){const A=this.cff,e=this.properties,{cidToGidMap:t,cMap:i}=e,a=A.charset.charset;let s,n;if(e.composite){let e,g;if(t?.length>0){e=Object.create(null);for(let A=0,i=t.length;A=0){const i=t[e];i&&(a[A]=i)}}a.length>0&&(this.properties.builtInEncoding=a)}}function Ga(A,e){return(A[e]<<24|A[e+1]<<16|A[e+2]<<8|A[e+3])>>>0}function Na(A,e){return A[e]<<8|A[e+1]}function xa(A,e){return(A[e]<<24|A[e+1]<<16)>>16}function Ua(A,e){return A[e]<<24>>24}function Ma(A,e){return xa(A,e)/16384}function La(A){const e=A.length;let t=32768;return e<1240?t=107:e<33900&&(t=1131),t}function Ja(A,e,t){const i=1===Na(A,e+2)?Ga(A,e+8):Ga(A,e+16),a=Na(A,e+i);let s,n,g;if(4===a){Na(A,e+i+2);const t=Na(A,e+i+6)>>1;for(n=e+i+14,s=[],g=0;g>1;t0;)B.push({flags:r})}for(t=0;t>1,m=!0;break;case 4:o+=g.pop(),a(r,o),m=!0;break;case 5:for(;g.length>0;)r+=g.shift(),o+=g.shift(),s(r,o);break;case 6:for(;g.length>0&&(r+=g.shift(),s(r,o),0!==g.length);)o+=g.shift(),s(r,o);break;case 7:for(;g.length>0&&(o+=g.shift(),s(r,o),0!==g.length);)r+=g.shift(),s(r,o);break;case 8:for(;g.length>0;)B=r+g.shift(),Q=o+g.shift(),h=B+g.shift(),l=Q+g.shift(),r=h+g.shift(),o=l+g.shift(),n(B,Q,h,l,r,o);break;case 10:if(f=g.pop(),p=null,t.isCFFCIDFont){const A=t.fdSelect.getFDIndex(i);if(A>=0&&AMath.abs(o-e)?r+=g.shift():o+=g.shift(),n(B,Q,h,l,r,o);break;default:throw new q(`unknown operator: 12 ${y}`)}break;case 14:if(g.length>=4){const A=g.pop(),i=g.pop();o=g.pop(),r=g.pop(),e.add(5),e.add(8,[r,o]);let a=Ya(t.cmap,String.fromCharCode(t.glyphNameMap[Ui[A]]));Ka(t.glyphs[a.glyphId],e,t,a.glyphId),e.add(4),a=Ya(t.cmap,String.fromCharCode(t.glyphNameMap[Ui[i]])),Ka(t.glyphs[a.glyphId],e,t,a.glyphId)}return;case 19:case 20:I+=g.length>>1,C+=I+7>>3,m=!0;break;case 21:o+=g.pop(),r+=g.pop(),a(r,o),m=!0;break;case 22:r+=g.pop(),a(r,o),m=!0;break;case 24:for(;g.length>2;)B=r+g.shift(),Q=o+g.shift(),h=B+g.shift(),l=Q+g.shift(),r=h+g.shift(),o=l+g.shift(),n(B,Q,h,l,r,o);r+=g.shift(),o+=g.shift(),s(r,o);break;case 25:for(;g.length>6;)r+=g.shift(),o+=g.shift(),s(r,o);B=r+g.shift(),Q=o+g.shift(),h=B+g.shift(),l=Q+g.shift(),r=h+g.shift(),o=l+g.shift(),n(B,Q,h,l,r,o);break;case 26:for(g.length%2&&(r+=g.shift());g.length>0;)B=r,Q=o+g.shift(),h=B+g.shift(),l=Q+g.shift(),r=h,o=l+g.shift(),n(B,Q,h,l,r,o);break;case 27:for(g.length%2&&(o+=g.shift());g.length>0;)B=r+g.shift(),Q=o,h=B+g.shift(),l=Q+g.shift(),r=h+g.shift(),o=l,n(B,Q,h,l,r,o);break;case 28:g.push((c[C]<<24|c[C+1]<<16)>>16),C+=2;break;case 29:f=g.pop()+t.gsubrsBias,p=t.gsubrs[f],p&&A(p);break;case 30:for(;g.length>0&&(B=r,Q=o+g.shift(),h=B+g.shift(),l=Q+g.shift(),r=h+g.shift(),o=l+(1===g.length?g.shift():0),n(B,Q,h,l,r,o),0!==g.length);)B=r+g.shift(),Q=o,h=B+g.shift(),l=Q+g.shift(),o=l+g.shift(),r=h+(1===g.length?g.shift():0),n(B,Q,h,l,r,o);break;case 31:for(;g.length>0&&(B=r+g.shift(),Q=o,h=B+g.shift(),l=Q+g.shift(),o=l+g.shift(),r=h+(1===g.length?g.shift():0),n(B,Q,h,l,r,o),0!==g.length);)B=r,Q=o+g.shift(),h=B+g.shift(),l=Q+g.shift(),r=h+g.shift(),o=l+(1===g.length?g.shift():0),n(B,Q,h,l,r,o);break;default:if(y<32)throw new q(`unknown operator: ${y}`);y<247?g.push(y-139):y<251?g.push(256*(y-247)+c[C++]+108):y<255?g.push(256*-(y-251)-c[C++]-108):(g.push((c[C]<<24|c[C+1]<<16|c[C+2]<<8|c[C+3])/65536),C+=4)}m&&(g.length=0)}}(A)}const qa=[];class Ta{cmds=[];add(A,e){if(e)if(JA(e,null))this.cmds.push(A,...e);else{G(`Commands.add - "${A}" has at least one non-number arg: "${e}".`);const t=e.map((A=>"number"==typeof A?A:0));this.cmds.push(A,...t)}else this.cmds.push(A)}}class Pa{constructor(A){this.fontMatrix=A,this.compiledGlyphs=Object.create(null),this.compiledCharCodeToGlyphId=Object.create(null)}getPathJs(A){const{charCode:e,glyphId:t}=Ya(this.cmap,A);let i,a=this.compiledGlyphs[t];if(!a){try{a=this.compileGlyph(this.glyphs[t],t)}catch(A){a=qa,i=A}this.compiledGlyphs[t]=a}if(this.compiledCharCodeToGlyphId[e]??=t,i)throw i;return a}compileGlyph(A,e){if(!A||0===A.length||14===A[0])return qa;let t=this.fontMatrix;if(this.isCFFCIDFont){const A=this.fdSelect.getFDIndex(e);A>=0&&A2*Na(A,e));const s=[];let n=a(e,0);for(let t=i;tA+(e.getSize()+3&-4)),0)}write(){const A=this.getSize(),e=new DataView(new ArrayBuffer(A)),t=A>131070,i=t?4:2,a=new DataView(new ArrayBuffer((this.glyphs.length+1)*i));t?a.setUint32(0,0):a.setUint16(0,0);let s=0,n=0;for(const A of this.glyphs)s+=A.write(s,e),s=s+3&-4,n+=i,t?a.setUint32(n,s):a.setUint16(n,s>>1);return{isLocationLong:t,loca:new Uint8Array(a.buffer),glyf:new Uint8Array(e.buffer)}}scale(A){for(let e=0,t=this.glyphs.length;eA+e.getSize()),0);return this.header.getSize()+A}write(A,e){if(!this.header)return 0;const t=A;if(A+=this.header.write(A,e),this.simple)A+=this.simple.write(A,e);else for(const t of this.composites)A+=t.write(A,e);return A-t}scale(A){if(!this.header)return;const e=(this.header.xMin+this.header.xMax)/2;if(this.header.scale(e,A),this.simple)this.simple.scale(e,A);else for(const t of this.composites)t.scale(e,A)}}class _a{constructor({numberOfContours:A,xMin:e,yMin:t,xMax:i,yMax:a}){this.numberOfContours=A,this.xMin=e,this.yMin=t,this.xMax=i,this.yMax=a}static parse(A,e){return[10,new _a({numberOfContours:e.getInt16(A),xMin:e.getInt16(A+2),yMin:e.getInt16(A+4),xMax:e.getInt16(A+6),yMax:e.getInt16(A+8)})]}getSize(){return 10}write(A,e){return e.setInt16(A,this.numberOfContours),e.setInt16(A+2,this.xMin),e.setInt16(A+4,this.yMin),e.setInt16(A+6,this.xMax),e.setInt16(A+8,this.yMax),10}scale(A,e){this.xMin=Math.round(A+(this.xMin-A)*e),this.xMax=Math.round(A+(this.xMax-A)*e)}}class $a{constructor({flags:A,xCoordinates:e,yCoordinates:t}){this.xCoordinates=e,this.yCoordinates=t,this.flags=A}}class As{constructor({contours:A,instructions:e}){this.contours=A,this.instructions=e}static parse(A,e,t){const i=[];for(let a=0;a255?A+=2:g>0&&(A+=1),e=s,g=Math.abs(n-t),g>255?A+=2:g>0&&(A+=1),t=n}}return A}write(A,e){const t=A,i=[],a=[],s=[];let n=0,g=0;for(const t of this.contours){for(let A=0,e=t.xCoordinates.length;A=0?18:2,i.push(A)):i.push(o)}n=r;const I=t.yCoordinates[A];if(o=I-g,0===o)e|=32,a.push(0);else{const A=Math.abs(o);A<=255?(e|=o>=0?36:4,a.push(A)):a.push(o)}g=I,s.push(e)}e.setUint16(A,i.length-1),A+=2}e.setUint16(A,this.instructions.length),A+=2,this.instructions.length&&(new Uint8Array(e.buffer,0,e.buffer.byteLength).set(this.instructions,A),A+=this.instructions.length);for(const t of s)e.setUint8(A++,t);for(let t=0,a=i.length;t=-128&&this.argument1<=127&&this.argument2>=-128&&this.argument2<=127||(A+=2):this.argument1>=0&&this.argument1<=255&&this.argument2>=0&&this.argument2<=255||(A+=2),A}write(A,e){const t=A;return 2&this.flags?this.argument1>=-128&&this.argument1<=127&&this.argument2>=-128&&this.argument2<=127||(this.flags|=1):this.argument1>=0&&this.argument1<=255&&this.argument2>=0&&this.argument2<=255||(this.flags|=1),e.setUint16(A,this.flags),e.setUint16(A+2,this.glyphIndex),A+=4,1&this.flags?(2&this.flags?(e.setInt16(A,this.argument1),e.setInt16(A+2,this.argument2)):(e.setUint16(A,this.argument1),e.setUint16(A+2,this.argument2)),A+=4):(e.setUint8(A,this.argument1),e.setUint8(A+1,this.argument2),A+=2),256&this.flags&&(e.setUint16(A,this.instructions.length),A+=2,this.instructions.length&&(new Uint8Array(e.buffer,0,e.buffer.byteLength).set(this.instructions,A),A+=this.instructions.length)),A-t}scale(A,e){}}function ts(A,e,t){A[e]=t>>8&255,A[e+1]=255&t}function is(A,e,t){A[e]=t>>24&255,A[e+1]=t>>16&255,A[e+2]=t>>8&255,A[e+3]=255&t}function as(A,e,t){if(t instanceof Uint8Array)A.set(t,e);else if("string"==typeof t)for(let i=0,a=t.length;it;)t<<=1,i++;const a=t*e;return{range:a,entry:i,rangeShift:e*A-a}}toArray(){let A=this.sfnt;const e=this.tables,t=Object.keys(e);t.sort();const i=t.length;let a,s,n,g,r,o=12+16*i;const I=[o];for(a=0;a>>0,I.push(o);const c=new Uint8Array(o);for(a=0;a>>0;is(c,o+4,A),is(c,o+8,I[a]),is(c,o+12,e[r].length),o+=16}return c}addTable(A,e){if(A in this.tables)throw new Error("Table "+A+" already exists");this.tables[A]=e}}const ns=[4],gs=[5],rs=[6],os=[7],Is=[8],cs=[12,35],Cs=[14],Bs=[21],hs=[22],Qs=[30],ls=[31];class Es{constructor(){this.width=0,this.lsb=0,this.flexing=!1,this.output=[],this.stack=[]}convert(A,e,t){const i=A.length;let a,s,n,g=!1;for(let r=0;ri)return!0;const a=i-A;for(let A=a;A>8&255,255&e):(e=65536*e|0,this.output.push(255,e>>24&255,e>>16&255,e>>8&255,255&e))}return this.output.push(...e),t?this.stack.splice(a,A):this.stack.length=0,!1}}function us(A){return A>=48&&A<=57||A>=65&&A<=70||A>=97&&A<=102}function ds(A,e,t){if(t>=A.length)return new Uint8Array(0);let i,a,s=0|e;for(i=0;i>8,s=52845*(e+s)+22719&65535}return g}function fs(A){return 47===A||91===A||93===A||123===A||125===A||40===A||41===A}class ps{constructor(A,e,t){if(e){const e=A.getBytes(),t=!((us(e[0])||LA(e[0]))&&us(e[1])&&us(e[2])&&us(e[3])&&us(e[4])&&us(e[5])&&us(e[6])&&us(e[7]));A=new se(t?ds(e,55665,4):function(A){let e=55665;const t=A.length,i=new Uint8Array(t>>>1);let a,s;for(a=0,s=0;a>8,e=52845*(A+e)+22719&65535}}return i.slice(4,s)}(e))}this.seacAnalysisEnabled=!!t,this.stream=A,this.nextChar()}readNumberArray(){this.getToken();const A=[];for(;;){const e=this.getToken();if(null===e||"]"===e||"}"===e)break;A.push(parseFloat(e||0))}return A}readNumber(){const A=this.getToken();return parseFloat(A||0)}readInt(){const A=this.getToken();return 0|parseInt(A||0,10)}readBoolean(){return"true"===this.getToken()?1:0}nextChar(){return this.currentChar=this.stream.getByte()}prevChar(){return this.stream.skip(-2),this.currentChar=this.stream.getByte()}getToken(){let A=!1,e=this.currentChar;for(;;){if(-1===e)return null;if(A)10!==e&&13!==e||(A=!1);else if(37===e)A=!0;else if(!LA(e))break;e=this.nextChar()}if(fs(e))return this.nextChar(),String.fromCharCode(e);let t="";do{t+=String.fromCharCode(e),e=this.nextChar()}while(e>=0&&!LA(e)&&!fs(e));return t}readCharStrings(A,e){return-1===e?A:ds(A,4330,e)}extractFontProgram(A){const e=this.stream,t=[],i=[],a=Object.create(null);a.lenIV=4;const s={subrs:[],charstrings:[],properties:{privateData:a}};let n,g,r,o;for(;null!==(n=this.getToken());)if("/"===n)switch(n=this.getToken(),n){case"CharStrings":for(this.getToken(),this.getToken(),this.getToken(),this.getToken();n=this.getToken(),null!==n&&"end"!==n;){if("/"!==n)continue;const A=this.getToken();g=this.readInt(),this.getToken(),r=g>0?e.getBytes(g):new Uint8Array(0),o=s.properties.privateData.lenIV;const t=this.readCharStrings(r,o);this.nextChar(),n=this.getToken(),"noaccess"===n?this.getToken():"/"===n&&this.prevChar(),i.push({glyph:A,encoded:t})}break;case"Subrs":for(this.readInt(),this.getToken();"dup"===this.getToken();){const A=this.readInt();g=this.readInt(),this.getToken(),r=g>0?e.getBytes(g):new Uint8Array(0),o=s.properties.privateData.lenIV;const i=this.readCharStrings(r,o);this.nextChar(),n=this.getToken(),"noaccess"===n&&this.getToken(),t[A]=i}break;case"BlueValues":case"OtherBlues":case"FamilyBlues":case"FamilyOtherBlues":const A=this.readNumberArray();A.length>0&&A.length;break;case"StemSnapH":case"StemSnapV":s.properties.privateData[n]=this.readNumberArray();break;case"StdHW":case"StdVW":s.properties.privateData[n]=this.readNumberArray()[0];break;case"BlueShift":case"lenIV":case"BlueFuzz":case"BlueScale":case"LanguageGroup":s.properties.privateData[n]=this.readNumber();break;case"ExpansionFactor":s.properties.privateData[n]=this.readNumber()||.06;break;case"ForceBold":s.properties.privateData[n]=this.readBoolean()}for(const{encoded:e,glyph:a}of i){const i=new Es,n=i.convert(e,t,this.seacAnalysisEnabled);let g=i.output;n&&(g=[14]);const r={glyphName:a,charstring:g,width:i.width,lsb:i.lsb,seac:i.seac};if(".notdef"===a?s.charstrings.unshift(r):s.charstrings.push(r),A.builtInEncoding){const e=A.builtInEncoding.indexOf(a);e>-1&&void 0===A.widths[e]&&e>=A.firstChar&&e<=A.lastChar&&(A.widths[e]=i.width)}}return s}extractFontHeader(A){let e;for(;null!==(e=this.getToken());)if("/"===e)switch(e=this.getToken(),e){case"FontMatrix":const t=this.readNumberArray();A.fontMatrix=t;break;case"Encoding":const i=this.getToken();let a;if(/^\d+$/.test(i)){a=[];const A=0|parseInt(i,10);this.getToken();for(let t=0;t=a){for(n+=t;n=0&&(i[A]=a)}return Qa(A,i,t)}hasGlyphId(A){return!(A<0||A>=this.numGlyphs)&&(0===A||this.charstrings[A-1].charstring.length>0)}getSeacs(A){const e=[];for(let t=0,i=A.length;t0;A--)e[A]-=e[A-1];B.setByName(A,e)}s.topDict.privateDict=B;const Q=new Zi;for(I=0,c=i.length;I0&&A.toUnicode.amend(e)}class Rs{constructor(A,e,t,i,a,s,n,g,r){this.originalCharCode=A,this.fontChar=e,this.unicode=t,this.accent=i,this.width=a,this.vmetric=s,this.operatorListId=n,this.isSpace=g,this.isInFont=r}get category(){return M(this,"category",function(A){const e=ca.get(A);if(e)return e;const t=A.match(Ia),i={isWhitespace:!!t?.[1],isZeroWidthDiacritic:!!t?.[2],isInvisibleFormatMark:!!t?.[3]};return ca.set(A,i),i}(this.unicode),!0)}}function Gs(A,e){return(A<<8)+e}function Ns(A,e,t){A[e+1]=t,A[e]=t>>>8}function xs(A,e){const t=(A<<8)+e;return 32768&t?t-65536:t}function Us(A){return String.fromCharCode(A>>8&255,255&A)}function Ms(A){return A>32767?A=32767:A<-32768&&(A=-32768),String.fromCharCode(A>>8&255,255&A)}function Ls(A){return"ttcf"===P(A.peekBytes(4))}function Js(A,e){for(const t in e)A[+t]=e[t]}function Hs(A,e,t){const i=[];let a;for(let t=0,s=A.length;tI){if(r++,r>=ws.length){G("Ran out of space in font private use area.");break}o=ws[r][0],I=ws[r][1]}const h=o++;0===B&&(B=t);let Q=i.get(C);"string"==typeof Q&&(Q=Q.codePointAt(0)),!Q||(c=Q,ws[0][0]<=c&&c<=ws[0][1]||ws[1][0]<=c&&c<=ws[1][1])||g.has(B)||(s.set(Q,B),g.add(B)),a[h]=B,n[C]=h}var c;return{toFontChar:n,charCodeToGlyphId:a,toUnicodeExtraMap:s,nextAvailableFontCharCode:o}}function Ts(A,e,t){const i=function(A,e,t){const i=[];for(const e in A)A[e]>=t||i.push({fontCharCode:0|e,glyphId:A[e]});if(e)for(const[A,a]of e)a>=t||i.push({fontCharCode:A,glyphId:a});0===i.length&&i.push({fontCharCode:0,glyphId:0}),i.sort((function(A,e){return A.fontCharCode-e.fontCharCode}));const a=[],s=i.length;for(let A=0;A65535?2:1;let s,n,g,r,o="\0\0"+Us(a)+"\0\0"+Z(4+8*a);for(s=i.length-1;s>=0&&!(i[s][0]<=65535);--s);const I=s+1;i[s][0]<65535&&65535===i[s][1]&&(i[s][1]=65534);const c=i[s][1]<65535?1:0,C=I+c,B=ss.getSearchParams(C,2);let h,Q,l,E,u="",d="",f="",p="",m="",y=0;for(s=0,n=I;s0&&(d+="ÿÿ",u+="ÿÿ",f+="\0",p+="\0\0");const w="\0\0"+Us(2*C)+Us(B.range)+Us(B.entry)+Us(B.rangeShift)+d+"\0\0"+u+f+p+m;let D="",b="";if(a>1){for(o+="\0\0\n"+Z(4+8*a+4+w.length),D="",s=0,n=i.length;sA||!g)&&(g=A),r 123 are reserved for internal usage");n|=1<65535&&(r=65535)}else g=0,r=255;const I=A.bbox||[0,0,0,0],c=t.unitsPerEm||(A.fontMatrix?1/Math.max(...A.fontMatrix.slice(0,4).map(Math.abs)):1e3),C=A.ascentScaled?1:c/Ds,B=t.ascent||Math.round(C*(A.ascent||I[3]));let h=t.descent||Math.round(C*(A.descent||I[1]));h>0&&A.descent>0&&I[1]<0&&(h=-h);const Q=t.yMax||B,l=-t.yMin||-h;return"\0$ô\0\0\0Š»\0\0\0ŒŠ»\0\0ß\x001\0\0\0\0"+String.fromCharCode(A.fixedPitch?9:0)+"\0\0\0\0\0\0"+Z(i)+Z(a)+Z(s)+Z(n)+"*21*"+Us(A.italicAngle?1:0)+Us(g||A.firstChar)+Us(r||A.lastChar)+Us(B)+Us(h)+"\0d"+Us(Q)+Us(l)+"\0\0\0\0\0\0\0\0"+Us(A.xHeight)+Us(A.capHeight)+Us(0)+Us(g||A.firstChar)+"\0"}function Ws(A){return"\0\0\0"+Z(Math.floor(65536*A.italicAngle))+"\0\0\0\0"+Z(A.fixedPitch?1:0)+"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"}function Zs(A){return A.replaceAll(/[^\x21-\x7E]|[[\](){}<>/%]/g,"").slice(0,63)}function Os(A,e){e||(e=[[],[]]);const t=[e[0][0]||"Original licence",e[0][1]||A,e[0][2]||"Unknown",e[0][3]||"uniqueID",e[0][4]||A,e[0][5]||"Version 0.11",e[0][6]||Zs(A),e[0][7]||"Unknown",e[0][8]||"Unknown",e[0][9]||"Unknown"],i=[];let a,s,n,g,r;for(a=0,s=t.length;a=1&&e[3]>=1&&e[3]<=4}(A)?i?(a="CIDFontType0",s="CIDFontType0C"):(a="MMType1"===e?"MMType1":"Type1",s="Type1C"):(G("getFontFileType: Unable to detect correct font file Type/Subtype."),a=e,s=t),[a,s]}(e,t),a===this.type&&s===this.subtype||R(`Inconsistent font file Type/SubType, expected: ${this.type}/${this.subtype} but found: ${a}/${s}.`);try{switch(a){case"MMType1":R("MMType1 font ("+A+"), falling back to Type1.");case"Type1":case"CIDFontType0":this.mimetype="font/opentype";const i="Type1C"===s||"CIDFontType0C"===s?new Ra(e,t):new ys(A,e,t);Fs(t),g=this.convert(A,i,t);break;case"OpenType":case"TrueType":case"CIDFontType2":this.mimetype="font/opentype",g=this.checkAndRepair(A,e,t),this.isOpenType&&(Fs(t),a="OpenType");break;default:throw new q(`Font ${a} is not supported`)}}catch(A){return G(A),void this.fallbackToSystemFont(t)}Ss(t),this.data=g,this.type=a,this.subtype=s,this.fontMatrix=t.fontMatrix,this.widths=t.widths,this.defaultWidth=t.defaultWidth,this.toUnicode=t.toUnicode,this.seacMap=t.seacMap}get renderer(){return M(this,"renderer",Oa.create(this,Ca))}exportData(A=!1){const e=A?[...bs,...ks]:bs,t=Object.create(null);let i,a;for(i of e)a=this[i],void 0!==a&&(t[i]=a);return t}fallbackToSystemFont(A){this.missingFile=!0;const{name:e,type:t}=this;let i=la(e);const a=ua(),s=fa(),n=!!a[i],g=!(!s[i]||!a[s[i]]);i=a[i]||s[i]||i;const r=Va()[i];r&&(isNaN(this.ascent)&&(this.ascent=r.ascent/Ds),isNaN(this.descent)&&(this.descent=r.descent/Ds),isNaN(this.capHeight)&&(this.capHeight=r.capHeight/Ds)),this.bold=/bold/gi.test(i),this.italic=/oblique|italic/gi.test(i),this.black=/Black/g.test(e);const o=/Narrow/g.test(e);if(this.remeasure=(!n||o)&&Object.keys(this.widths).length>0,(n||g)&&"CIDFontType2"===t&&this.cidEncoding.startsWith("Identity-")){const t=A.cidToGidMap,i=[];if(Js(i,ya()),/Arial-?Black/i.test(e)?Js(i,wa()):/Calibri/i.test(e)&&Js(i,Da()),t){for(const A in i){const e=i[A];void 0!==t[e]&&(i[+A]=t[e])}t.length!==this.toUnicode.length&&A.hasIncludedToUnicodeMap&&this.toUnicode instanceof Sa&&this.toUnicode.forEach((function(A,e){const a=i[A];void 0===t[a]&&(i[+A]=e)}))}this.toUnicode instanceof Sa||this.toUnicode.forEach((function(A,e){i[+A]=e})),this.toFontChar=i,this.toUnicode=new Fa(i)}else if(/Symbol/i.test(i))this.toFontChar=Hs(Li,aa(),this.differences);else if(/Dingbats/i.test(i))this.toFontChar=Hs(Ji,sa(),this.differences);else if(n||g){const A=Hs(this.defaultEncoding,aa(),this.differences);"CIDFontType2"!==t||this.cidEncoding.startsWith("Identity-")||this.toUnicode instanceof Sa||this.toUnicode.forEach((function(e,t){A[+e]=t})),this.toFontChar=A}else{const A=aa(),t=[];this.toUnicode.forEach(((e,i)=>{if(!this.composite){const t=ga(this.differences[e]||this.defaultEncoding[e],A);-1!==t&&(i=t)}t[+e]=i})),this.composite&&this.toUnicode instanceof Sa&&/Tahoma|Verdana/i.test(e)&&Js(t,ya()),this.toFontChar=t}Ss(A),this.loadedName=i.split("-",1)[0]}checkAndRepair(A,e,t){const i=["OS/2","cmap","head","hhea","hmtx","maxp","name","post","loca","glyf","fpgm","prep","cvt ","CFF "];function a(A,e){const t=Object.create(null);t["OS/2"]=null,t.cmap=null,t.head=null,t.hhea=null,t.hmtx=null,t.maxp=null,t.name=null,t.post=null;for(let a=0;a>>0,i=A.getInt32()>>>0,a=A.getInt32()>>>0,s=A.pos;A.pos=A.start||0,A.skip(i);const n=A.getBytes(a);return A.pos=s,"head"===e&&(n[8]=n[9]=n[10]=n[11]=0,n[17]|=32),{tag:e,checksum:t,length:a,offset:i,data:n}}function n(A){return{version:A.getString(4),numTables:A.getUint16(),searchRange:A.getUint16(),entrySelector:A.getUint16(),rangeShift:A.getUint16()}}function g(A,e,t,i,a,s){const n={length:0,sizeOfInstructions:0};if(e<0||e>=A.length||t>A.length||t-e<=12)return n;const g=A.subarray(e,t),r=xs(g[2],g[3]),o=xs(g[4],g[5]),I=xs(g[6],g[7]),c=xs(g[8],g[9]);r>I&&(Ns(g,2,I),Ns(g,6,r)),o>c&&(Ns(g,4,c),Ns(g,8,o));const C=xs(g[0],g[1]);if(C<0)return C<-1||(i.set(g,a),n.length=g.length),n;let B,h=10,Q=0;for(B=0;Bg.length?n:!s&&E>0?(i.set(g.subarray(0,l),a),i.set([0,0],a+l),i.set(g.subarray(u,f),a+l+2),f-=E,g.length-f>3&&(f=f+3&-4),n.length=f,n):g.length-f>3?(f=f+3&-4,i.set(g.subarray(0,f),a),n.length=f,n):(i.set(g,a),n.length=g.length,n)}function r(A){const t=(e.start||0)+A.offset;e.pos=t;const i=[[],[]],a=[],s=A.length,n=t+s;if(0!==e.getUint16()||s<6)return[i,a];const g=e.getUint16(),r=e.getUint16();let o,I;for(o=0;on)continue;e.pos=s;const g=A.name;if(A.encoding){let t="";for(let i=0,a=A.length;i0&&(r+=A-1)}}else(l||u)&&(G("TT: nested FDEFs not allowed"),Q=!0),l=!0,c=r,s=C.pop(),e.functionsDefined[s]={data:g,i:r};else if(!l&&!u)if(s=C.at(-1),isNaN(s))R("TT: CALL empty stack (or invalid entry).");else if(e.functionsUsed[s]=!0,s in e.functionsStackDeltas){const A=C.length+e.functionsStackDeltas[s];if(A<0)return G("TT: CALL invalid functions stack delta."),void(e.hintsValid=!1);C.length=A}else if(s in e.functionsDefined&&!h.includes(s)){if(B.push({data:g,i:r,stackTop:C.length-1}),h.push(s),n=e.functionsDefined[s],!n)return G("TT: CALL non-existent function"),void(e.hintsValid=!1);g=n.data,r=n.i}if(!l&&!u){let e=0;for(A<=142?e=o[A]:A>=192&&A<=223?e=-1:A>=224&&(e=-2),A>=113&&A<=117&&(i=C.pop(),isNaN(i)||(e=2*-i));e<0&&C.length>0;)C.pop(),e++;for(;e>0;)C.push(NaN),e--}}e.tooComplexToFollowFunctions=Q;const d=[g];r>g.length&&d.push(new Uint8Array(r-g.length)),c>I&&(G("TT: complementing a missing function tail"),d.push(new Uint8Array([34,45]))),function(A,e){if(e.length>1){let t,i,a=0;for(t=0,i=e.length;t>>0,s=[];for(let e=0;e>>0);const n={ttcTag:e,majorVersion:t,minorVersion:i,numFonts:a,offsetTable:s};switch(t){case 1:return n;case 2:return n.dsigTag=A.getInt32()>>>0,n.dsigLength=A.getInt32()>>>0,n.dsigOffset=A.getInt32()>>>0,n}throw new q(`Invalid TrueType Collection majorVersion: ${t}.`)}(A),s=e.split("+");let g;for(let o=0;o0||!(t.cMap instanceof Bi));if("OTTO"===c.version&&!e||!C.head||!C.hhea||!C.maxp||!C.post)return h=new se(C["CFF "].data),B=new Ra(h,t),Fs(t),this.convert(A,B,t);delete C.glyf,delete C.loca,delete C.fpgm,delete C.prep,delete C["cvt "],this.isOpenType=!0}if(!C.maxp)throw new q('Required "maxp" table is not found');e.pos=(e.start||0)+C.maxp.offset;let l=e.getInt32();const E=e.getUint16();if(65536!==l&&20480!==l){if(6===C.maxp.length)l=20480;else{if(!(C.maxp.length>=32))throw new q('"maxp" table has a wrong version number');l=65536}d=l,(u=C.maxp.data)[3+0]=255&d,u[2]=d>>>8,u[1]=d>>>16,u[0]=d>>>24}var u,d;if(t.scaleFactors?.length===E&&Q){const{scaleFactors:A}=t,e=Gs(C.head.data[50],C.head.data[51]),i=new ja({glyfTable:C.glyf.data,isGlyphLocationsLong:e,locaTable:C.loca.data,numGlyphs:E});i.scale(A);const{glyf:a,loca:s,isLocationLong:n}=i.write();C.glyf.data=a,C.loca.data=s,n!==!!e&&(C.head.data[50]=0,C.head.data[51]=n?1:0);const g=C.hmtx.data;for(let e=0;e>8&255,g[t+1]=255&i,Ns(g,t+2,Math.round(A[e]*xs(g[t+2],g[t+3])))}}let f=E+1,p=!0;f>65535&&(p=!1,f=E,G("Not enough space in glyfs to duplicate first glyph."));let m=0,y=0;l>=65536&&C.maxp.length>=32&&(e.pos+=8,e.getUint16()>2&&(C.maxp.data[14]=0,C.maxp.data[15]=2),e.pos+=4,m=e.getUint16(),e.pos+=4,y=e.getUint16()),C.maxp.data[4]=f>>8,C.maxp.data[5]=255&f;const w=function(A,e,t,i){const a={functionsDefined:[],functionsUsed:[],functionsStackDeltas:[],tooComplexToFollowFunctions:!1,hintsValid:!0};if(A&&I(A,a),e&&I(e,a),A&&function(A,e){if(!A.tooComplexToFollowFunctions){if(A.functionsDefined.length>e)return G("TT: more functions defined than expected"),void(A.hintsValid=!1);for(let t=0,i=A.functionsUsed.length;te)return G("TT: invalid function id: "+t),void(A.hintsValid=!1);if(A.functionsUsed[t]&&!A.functionsDefined[t])return G("TT: undefined function: "+t),void(A.hintsValid=!1)}}}(a,i),t&&1&t.length){const A=new Uint8Array(t.length+1);A.set(t.data),t.data=A}return a.hintsValid}(C.fpgm,C.prep,C["cvt "],m);if(w||(delete C.fpgm,delete C.prep,delete C["cvt "]),function(A,e,t,i,a,s){if(!e)return void(t&&(t.data=null));A.pos=(A.start||0)+e.offset,A.pos+=4,A.pos+=2,A.pos+=2,A.pos+=2,A.pos+=2,A.pos+=2,A.pos+=2,A.pos+=2,A.pos+=2,A.pos+=2;const n=A.getUint16();A.pos+=8,A.pos+=2;let g=A.getUint16();0!==n&&(2&Gs(i.data[44],i.data[45])||(e.data[22]=0,e.data[23]=0)),g>a&&(R(`The numOfMetrics (${g}) should not be greater than the numGlyphs (${a}).`),g=a,e.data[34]=(65280&g)>>8,e.data[35]=255&g);const r=a-g-(t.length-4*g>>1);if(r>0){const A=new Uint8Array(t.length+2*r);A.set(t.data),s&&(A[t.length]=t.data[2],A[t.length+1]=t.data[3]),t.data=A}}(e,C.hhea,C.hmtx,C.head,f,p),!C.head)throw new q('Required "head" table is not found');!function(A,e,t){const i=A.data,a=(i[0]<<24)+(i[1]<<16)+(i[2]<<8)+i[3];a>>16!=1&&(R("Attempting to fix invalid version in head table: "+a),i[0]=0,i[1]=1,i[2]=0,i[3]=0);const s=Gs(i[50],i[51]);if(s<0||s>1){R("Attempting to fix invalid indexToLocFormat in head table: "+s);const A=e+1;if(t===A<<1)i[50]=0,i[51]=0;else{if(t!==A<<2)throw new q("Could not fix indexToLocFormat: "+s);i[50]=0,i[51]=1}}}(C.head,E,Q?C.loca.length:0);let D=Object.create(null);if(Q){const A=Gs(C.head.data[50],C.head.data[51]),e=function(A,e,t,i,a,s,n){let r,o,I;i?(r=4,o=function(A,e){return A[e]<<24|A[e+1]<<16|A[e+2]<<8|A[e+3]},I=function(A,e,t){A[e]=t>>>24&255,A[e+1]=t>>16&255,A[e+2]=t>>8&255,A[e+3]=255&t}):(r=2,o=function(A,e){return A[e]<<9|A[e+1]<<1},I=function(A,e,t){A[e]=t>>9&255,A[e+1]=t>>1&255});const c=s?t+1:t,C=r*(1+c),B=new Uint8Array(C);B.set(A.data.subarray(0,C)),A.data=B;const h=e.data,Q=h.length,l=new Uint8Array(Q);let E,u;const d=[];for(E=0,u=0;EQ&&(A=Q),d.push({index:E,offset:A,endOffset:0})}for(d.sort(((A,e)=>A.offset-e.offset)),E=0;EA.index-e.index)),E=0;En&&(n=A.sizeOfInstructions),m+=e,I(B,u,m)}if(0===m){const A=new Uint8Array([0,1,0,0,0,0,0,0,0,0,0,0,0,0,49,0]);for(E=0,u=r;Et+m?e.data=l.subarray(0,t+m):(e.data=new Uint8Array(t+m),e.data.set(l.subarray(0,m))),e.data.set(l.subarray(0,t),m),I(A.data,B.length-r,m+t)}else e.data=l.subarray(0,m);return{missingGlyphs:p,maxSizeOfInstructions:n}}(C.loca,C.glyf,E,A,w,p,y);D=e.missingGlyphs,l>=65536&&C.maxp.length>=32&&(C.maxp.data[26]=e.maxSizeOfInstructions>>8,C.maxp.data[27]=255&e.maxSizeOfInstructions)}if(!C.hhea)throw new q('Required "hhea" table is not found');0===C.hhea.data[10]&&0===C.hhea.data[11]&&(C.hhea.data[10]=255,C.hhea.data[11]=255);const b={unitsPerEm:Gs(C.head.data[18],C.head.data[19]),yMax:xs(C.head.data[42],C.head.data[43]),yMin:xs(C.head.data[38],C.head.data[39]),ascent:xs(C.hhea.data[4],C.hhea.data[5]),descent:xs(C.hhea.data[6],C.hhea.data[7]),lineGap:xs(C.hhea.data[8],C.hhea.data[9])};this.ascent=b.ascent/b.unitsPerEm,this.descent=b.descent/b.unitsPerEm,this.lineGap=b.lineGap/b.unitsPerEm,this.cssFontInfo?.lineHeight?(this.lineHeight=this.cssFontInfo.metrics.lineHeight,this.lineGap=this.cssFontInfo.metrics.lineGap):this.lineHeight=this.ascent-this.descent+this.lineGap,C.post&&function(A,t,i){const a=(e.start||0)+A.offset;e.pos=a;const s=a+A.length,n=e.getInt32();let g;e.skip(28);let r,o=!0;switch(n){case 65536:g=Ba;break;case 131072:const A=e.getUint16();if(A!==i){o=!1;break}const a=[];for(r=0;r=32768){o=!1;break}a.push(A)}if(!o)break;const I=[],c=[];for(;e.pos65535)throw new q("Max size of CID is 65,535");let a=-1;e?a=i:void 0!==A[i]&&(a=A[i]),a>=0&&a>>0;let I=!1;if(g?.platformId!==a||g?.encodingId!==s){if(0!==a||0!==s&&1!==s&&3!==s)if(1===a&&0===s)I=!0;else if(3!==a||1!==s||!i&&g){if(t&&3===a&&0===s){I=!0;let t=!0;if(A>3;A.push(i),t=Math.max(i,t)}const i=[];for(let A=0;A<=t;A++)i.push({firstCode:e.getUint16(),entryCount:e.getUint16(),idDelta:xs(e.getByte(),e.getByte()),idRangePos:e.pos+e.getUint16()});for(let t=0;t<256;t++)if(0===A[t])e.pos=i[0].idRangePos+2*t,B=e.getUint16(),c.push({charCode:t,glyphId:B});else{const a=i[A[t]];for(C=0;C>1;e.skip(6);const t=[];let i;for(i=0;i>1)-(A-i),a.offsetIndex=n,g=Math.max(g,n+a.end-a.start+1)):a.offsetIndex=-1}const r=[];for(C=0;C>>0;for(C=0;C>>0,t=e.getInt32()>>>0;let i=e.getInt32()>>>0;for(let e=A;e<=t;e++)c.push({charCode:e,glyphId:i++})}}}c.sort((function(A,e){return A.charCode-e.charCode}));for(let A=1;A=61440&&e<=61695&&(e&=255),k[e]=A.glyphId}else for(const A of s)k[A.charCode]=A.glyphId;if(t.glyphNames&&(n.length||this.differences.length))for(let A=0;A<256;++A){if(!g&&void 0!==k[A])continue;const e=this.differences[A]||n[A];if(!e)continue;const i=t.glyphNames.indexOf(e);i>0&&F(i)&&(k[A]=i)}}0===k.length&&(k[0]=0);let S=f-1;if(p||(S=0),!t.cssFontInfo){const A=qs(k,F,S,this.toUnicode);this.toFontChar=A.toFontChar,C.cmap={tag:"cmap",data:Ts(A.charCodeToGlyphId,A.toUnicodeExtraMap,f)},C["OS/2"]&&function(A,e){e.pos=(e.start||0)+A.offset;const t=e.getUint16();e.skip(60);const i=e.getUint16();return!(t<4&&768&i||e.getUint16()>e.getUint16()||(e.skip(6),0===e.getUint16()||(A.data[8]=A.data[9]=0,0)))}(C["OS/2"],e)||(C["OS/2"]={tag:"OS/2",data:Ps(t,A.charCodeToGlyphId,b)})}if(!Q)try{h=new se(C["CFF "].data),B=new qi(h,t,Ca).parse(),B.duplicateFirstGlyph();const A=new ia(B);C["CFF "].data=A.compile()}catch{G("Failed to compile font "+t.loadedName)}if(C.name){const[e,i]=r(C.name);C.name.data=Os(A,e),this.psName=e[0][6]||null,t.composite||function(A,e,t){if(A.isInternalFont)return;if(A.hasIncludedToUnicodeMap)return;if(A.hasEncoding)return;if(A.toUnicode instanceof Sa)return;if(!e)return;if(0===t.length)return;if(A.defaultEncoding===Mi)return;for(const A of t)if(!vs(A))return;const i=Mi,a=[],s=aa();for(const A in i){const e=i[A];if(""===e)continue;const t=s[e];void 0!==t&&(a[A]=String.fromCharCode(t))}a.length>0&&A.toUnicode.amend(a)}(t,this.isSymbolicFont,i)}else C.name={tag:"name",data:Os(this.name)};const N=new ss(c.version);for(const A in C)N.addTable(A,C[A].data);return N.toArray()}convert(A,e,t){t.fixedPitch=!1,t.builtInEncoding&&function(A,e){if(A.isInternalFont)return;if(A.hasIncludedToUnicodeMap)return;if(e===A.defaultEncoding)return;if(A.toUnicode instanceof Sa)return;const t=[],i=aa();for(const a in e){if(A.hasEncoding&&(A.baseEncodingName||void 0!==A.differences[a]))continue;const s=ga(e[a],i);-1!==s&&(t[a]=String.fromCharCode(s))}t.length>0&&A.toUnicode.amend(t)}(t,t.builtInEncoding);let i=1;e instanceof Ra&&(i=e.numGlyphs-1);const s=e.getGlyphMapping(t);let n=null,g=s,r=null;t.cssFontInfo||(n=qs(s,e.hasGlyphId.bind(e),i,this.toUnicode),this.toFontChar=n.toFontChar,g=n.charCodeToGlyphId,r=n.toUnicodeExtraMap);const o=e.numGlyphs;function I(A,e){let t=null;for(const i in A)e===A[i]&&(t||=[]).push(0|i);return t}function c(A,e){for(const t in A)if(e===A[t])return 0|t;return n.charCodeToGlyphId[n.nextAvailableFontCharCode]=e,n.nextAvailableFontCharCode++}const C=e.seacs;if(n&&C?.length){const A=t.fontMatrix||a,i=e.getCharset(),g=Object.create(null);for(let e in C){e|=0;const t=C[e],a=Ui[t[2]],r=Ui[t[3]],o=i.indexOf(a),B=i.indexOf(r);if(o<0||B<0)continue;const h={x:t[0]*A[0]+t[1]*A[2]+A[4],y:t[0]*A[1]+t[1]*A[3]+A[5]},Q=I(s,e);if(Q)for(const A of Q){const e=n.charCodeToGlyphId,t=c(e,o),i=c(e,B);g[A]={baseFontCharCode:t,accentFontCharCode:i,accentOffset:h}}}t.seacMap=g}const B=t.fontMatrix?1/Math.max(...t.fontMatrix.slice(0,4).map(Math.abs)):1e3,h=new ss("OTTO");return h.addTable("CFF ",e.data),h.addTable("OS/2",Ps(t,g)),h.addTable("cmap",Ts(g,r,o)),h.addTable("head","\0\0\0\0\0\0\0\0\0\0_<õ\0\0"+Ms(B)+"\0\0\0\0ž\v~'\0\0\0\0ž\v~'\0\0"+Ms(t.descent)+"ÿ"+Ms(t.ascent)+Us(t.italicAngle?2:0)+"\0\0\0\0\0\0\0"),h.addTable("hhea","\0\0\0"+Ms(t.ascent)+Ms(t.descent)+"\0\0ÿÿ\0\0\0\0\0\0"+Ms(t.capHeight)+Ms(Math.tan(t.italicAngle)*t.xHeight)+"\0\0\0\0\0\0\0\0\0\0\0\0"+Us(o)),h.addTable("hmtx",function(){const A=e.charstrings,t=e.cff?e.cff.widths:null;let i="\0\0\0\0";for(let e=1,a=o;e=65520&&I<=65535?0:I>=62976&&I<=63743?na()[I]||I:173===I?45:I}var I;this.isType3Font&&(a=t);let c=null;if(this.seacMap?.[A]){o=!0;const e=this.seacMap[A];t=e.baseFontCharCode,c={fontChar:String.fromCodePoint(e.accentFontCharCode),offset:e.accentOffset}}let C="";if("number"==typeof t&&(t<=1114111?C=String.fromCodePoint(t):G(`charToGlyph - invalid fontCharCode: ${t}`)),this.missingFile&&this.vertical&&1===C.length){const A=Ea()[C.charCodeAt(0)];A&&(C=r=String.fromCharCode(A))}return s=new Rs(A,C,r,c,i,g,a,e,o),this._glyphCache[A]=s}charsToGlyphs(A){let e=this._charsCache[A];if(e)return e;if(e=[],this.cMap){const t=Object.create(null),i=A.length;let a=0;for(;ae.length%2==1,a=this.toUnicode instanceof Sa?A=>this.toUnicode.charCodeOf(A):A=>this.toUnicode.charCodeOf(String.fromCodePoint(A));for(let s=0,n=A.length;s55295&&(n<57344||n>65533)&&s++,this.toUnicode){const A=a(n);if(-1!==A){i()&&(e.push(t.join("")),t.length=0);for(let e=(this.cMap?this.cMap.getCharCodeLength(A):1)-1;e>=0;e--)t.push(String.fromCharCode(A>>8*e&255));continue}}i()||(e.push(t.join("")),t.length=0),t.push(String.fromCodePoint(n))}return e.push(t.join("")),e}}class Vs{constructor(A){this.error=A,this.loadedName="g_font_error",this.missingFile=!0}charsToGlyphs(){return[]}encodeString(A){return[A]}exportData(A=!1){return{error:this.error}}}class js{constructor(){N("Cannot initialize Pattern.")}static parseShading(A,e,t,i,a){const s=A instanceof pA?A.dict:A,n=s.get("ShadingType");try{switch(n){case 2:case 3:return new _s(s,e,t,i,a);case 4:case 5:case 6:case 7:return new tn(A,e,t,i,a);default:throw new q("Unsupported ShadingType: "+n)}}catch(A){if(A instanceof wA)throw A;return G(A),new an}}}class zs{static SMALL_NUMBER=1e-6;getIR(){N("Abstract method `getIR` called.")}}class _s extends zs{constructor(A,e,t,i,a){super(),this.shadingType=A.get("ShadingType");let s=0;if(2===this.shadingType?s=4:3===this.shadingType&&(s=6),this.coordsArr=A.getArray("Coords"),!JA(this.coordsArr,s))throw new q("RadialAxialShading: Invalid /Coords array.");const n=Ie.parse({cs:A.getRaw("CS")||A.getRaw("ColorSpace"),xref:e,resources:t,pdfFunctionFactory:i,localColorSpaceCache:a});this.bbox=vA(A.getArray("BBox"),null);let g=0,r=1;const o=A.getArray("Domain");JA(o,2)&&([g,r]=o);let I=!1,c=!1;const C=A.getArray("Extend");var B;if(B=C,Array.isArray(B)&&2===B.length&&B.every((A=>"boolean"==typeof A))&&([I,c]=C),!(3!==this.shadingType||I&&c)){const[A,e,t,i,a,s]=this.coordsArr,n=Math.hypot(A-i,e-a);t<=s+n&&s<=t+n&&G("Unsupported radial gradient.")}this.extendStart=I,this.extendEnd=c;const h=A.getRaw("Function"),Q=i.createFromArray(h),l=(r-g)/840,E=this.colorStops=[];if(g>=r||l<=0)return void R("Bad shading domain.");const u=new Float32Array(n.numComps),d=new Float32Array(1);let f,p=0;d[0]=g,Q(d,0,u,0);let m=n.getRgb(u,0);const y=j.makeHexColor(m[0],m[1],m[2]);E.push([0,y]);let w=1;d[0]=g+l,Q(d,0,u,0);let D=n.getRgb(u,0),b=D[0]-m[0]+1,k=D[1]-m[1]+1,F=D[2]-m[2]+1,S=D[0]-m[0]-1,N=D[1]-m[1]-1,x=D[2]-m[2]-1;for(let A=2;A<840;A++){d[0]=g+A*l,Q(d,0,u,0),f=n.getRgb(u,0);const e=A-p;if(b=Math.min(b,(f[0]-m[0]+1)/e),k=Math.min(k,(f[1]-m[1]+1)/e),F=Math.min(F,(f[2]-m[2]+1)/e),S=Math.max(S,(f[0]-m[0]-1)/e),N=Math.max(N,(f[1]-m[1]-1)/e),x=Math.max(x,(f[2]-m[2]-1)/e),!(S<=b&&N<=k&&x<=F)){const A=j.makeHexColor(D[0],D[1],D[2]);E.push([w/840,A]),b=f[0]-D[0]+1,k=f[1]-D[1]+1,F=f[2]-D[2]+1,S=f[0]-D[0]-1,N=f[1]-D[1]-1,x=f[2]-D[2]-1,p=w,m=D}w=A,D=f}const U=j.makeHexColor(D[0],D[1],D[2]);E.push([1,U]);let M="transparent";A.has("Background")&&(f=n.getRgb(A.get("Background"),0),M=j.makeHexColor(f[0],f[1],f[2])),I||(E.unshift([0,M]),E[1][0]+=zs.SMALL_NUMBER),c||(E.at(-1)[0]-=zs.SMALL_NUMBER,E.push([1,M])),this.colorStops=E}getIR(){const{coordsArr:A,shadingType:e}=this;let t,i,a,s,n;return 2===e?(i=[A[0],A[1]],a=[A[2],A[3]],s=null,n=null,t="axial"):3===e?(i=[A[0],A[1]],a=[A[3],A[4]],s=A[2],n=A[5],t="radial"):N(`getPattern type unknown: ${e}`),["RadialAxial",t,this.bbox,this.colorStops,i,a,s,n]}}class $s{constructor(A,e){this.stream=A,this.context=e,this.buffer=0,this.bufferLength=0;const t=e.numComps;this.tmpCompsBuf=new Float32Array(t);const i=e.colorSpace.numComps;this.tmpCsCompsBuf=e.colorFn?new Float32Array(i):this.tmpCompsBuf}get hasData(){if(this.stream.end)return this.stream.pos0)return!0;const A=this.stream.getByte();return!(A<0||(this.buffer=A,this.bufferLength=8,0))}readBits(A){let e=this.buffer,t=this.bufferLength;if(32===A){if(0===t)return(this.stream.getByte()<<24|this.stream.getByte()<<16|this.stream.getByte()<<8|this.stream.getByte())>>>0;e=e<<24|this.stream.getByte()<<16|this.stream.getByte()<<8|this.stream.getByte();const A=this.stream.getByte();return this.buffer=A&(1<>t)>>>0}if(8===A&&0===t)return this.stream.getByte();for(;t>t}align(){this.buffer=0,this.bufferLength=0}readFlag(){return this.readBits(this.context.bitsPerFlag)}readCoordinate(){const A=this.context.bitsPerCoordinate,e=this.readBits(A),t=this.readBits(A),i=this.context.decode,a=A<32?1/((1<s?s:A,e=e>n?n:e,t=tA*a[e])):t;let n,g=-2;const r=[];for(const[A,e]of i.map(((A,e)=>[A,e])).sort((([A],[e])=>A-e)))-1!==A&&(A===g+1?(n.push(s[e]),g+=1):(g=A,n=[s[e]],r.push(A,n)));return r}(A),t=new BA(null);t.set("BaseFont",IA.get(A)),t.set("Type",IA.get("Font")),t.set("Subtype",IA.get("CIDFontType2")),t.set("Encoding",IA.get("Identity-H")),t.set("CIDToGIDMap",IA.get("Identity")),t.set("W",e),t.set("FirstChar",e[0]),t.set("LastChar",e.at(-2)+e.at(-1).length-1);const i=new BA(null);t.set("FontDescriptor",i);const a=new BA(null);return a.set("Ordering","Identity"),a.set("Registry","Adobe"),a.set("Supplement",0),t.set("CIDSystemInfo",a),t}class Vn{constructor(A){this.lexer=A,this.operators=[],this.token=null,this.prev=null}nextToken(){this.prev=this.token,this.token=this.lexer.getToken()}accept(A){return this.token.type===A&&(this.nextToken(),!0)}expect(A){if(this.accept(A))return!0;throw new q(`Unexpected symbol: found ${this.token.type} expected ${A}.`)}parse(){return this.nextToken(),this.expect(jn.LBRACE),this.parseBlock(),this.expect(jn.RBRACE),this.operators}parseBlock(){for(;;)if(this.accept(jn.NUMBER))this.operators.push(this.prev.value);else if(this.accept(jn.OPERATOR))this.operators.push(this.prev.value);else{if(!this.accept(jn.LBRACE))return;this.parseCondition()}}parseCondition(){const A=this.operators.length;if(this.operators.push(null,null),this.parseBlock(),this.expect(jn.RBRACE),this.accept(jn.IF))this.operators[A]=this.operators.length,this.operators[A+1]="jz";else{if(!this.accept(jn.LBRACE))throw new q("PS Function: error parsing conditional.");{const e=this.operators.length;this.operators.push(null,null);const t=this.operators.length;this.parseBlock(),this.expect(jn.RBRACE),this.expect(jn.IFELSE),this.operators[e]=this.operators.length,this.operators[e+1]="j",this.operators[A]=t,this.operators[A+1]="jz"}}}}const jn={LBRACE:0,RBRACE:1,NUMBER:2,OPERATOR:3,IF:4,IFELSE:5};class zn{static get opCache(){return M(this,"opCache",Object.create(null))}constructor(A,e){this.type=A,this.value=e}static getOperator(A){return zn.opCache[A]||=new zn(jn.OPERATOR,A)}static get LBRACE(){return M(this,"LBRACE",new zn(jn.LBRACE,"{"))}static get RBRACE(){return M(this,"RBRACE",new zn(jn.RBRACE,"}"))}static get IF(){return M(this,"IF",new zn(jn.IF,"IF"))}static get IFELSE(){return M(this,"IFELSE",new zn(jn.IFELSE,"IFELSE"))}}class _n{constructor(A){this.stream=A,this.nextChar(),this.strBuf=[]}nextChar(){return this.currentChar=this.stream.getByte()}getToken(){let A=!1,e=this.currentChar;for(;;){if(e<0)return nA;if(A)10!==e&&13!==e||(A=!1);else if(37===e)A=!0;else if(!LA(e))break;e=this.nextChar()}switch(0|e){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 new zn(jn.NUMBER,this.getNumber());case 123:return this.nextChar(),zn.LBRACE;case 125:return this.nextChar(),zn.RBRACE}const t=this.strBuf;for(t.length=0,t[0]=String.fromCharCode(e);(e=this.nextChar())>=0&&(e>=65&&e<=90||e>=97&&e<=122);)t.push(String.fromCharCode(e));const i=t.join("");switch(i.toLowerCase()){case"if":return zn.IF;case"ifelse":return zn.IFELSE;default:return zn.getOperator(i)}}getNumber(){let A=this.currentChar;const e=this.strBuf;for(e.length=0,e[0]=String.fromCharCode(A);(A=this.nextChar())>=0&&(A>=48&&A<=57||45===A||46===A);)e.push(String.fromCharCode(A));const t=parseFloat(e.join(""));if(isNaN(t))throw new q(`Invalid floating point number: ${t}`);return t}}class $n{constructor(A){this._onlyRefs=!0===A?.onlyRefs,this._onlyRefs||(this._nameRefMap=new Map,this._imageMap=new Map),this._imageCache=new lA}getByName(A){this._onlyRefs&&N("Should not call `getByName` method.");const e=this._nameRefMap.get(A);return e?this.getByRef(e):this._imageMap.get(A)||null}getByRef(A){return this._imageCache.get(A)||null}set(A,e,t){N("Abstract method `set` called.")}}class Ag extends $n{set(A,e=null,t){if("string"!=typeof A)throw new Error('LocalImageCache.set - expected "name" argument.');if(e){if(this._imageCache.has(e))return;return this._nameRefMap.set(A,e),void this._imageCache.put(e,t)}this._imageMap.has(A)||this._imageMap.set(A,t)}}class eg extends $n{set(A=null,e=null,t){if("string"!=typeof A&&!e)throw new Error('LocalColorSpaceCache.set - expected "name" and/or "ref" argument.');if(e){if(this._imageCache.has(e))return;return null!==A&&this._nameRefMap.set(A,e),void this._imageCache.put(e,t)}this._imageMap.has(A)||this._imageMap.set(A,t)}}class tg extends $n{constructor(A){super({onlyRefs:!0})}set(A=null,e,t){if(!e)throw new Error('LocalFunctionCache.set - expected "ref" argument.');this._imageCache.has(e)||this._imageCache.put(e,t)}}class ig extends $n{set(A,e=null,t){if("string"!=typeof A)throw new Error('LocalGStateCache.set - expected "name" argument.');if(e){if(this._imageCache.has(e))return;return this._nameRefMap.set(A,e),void this._imageCache.put(e,t)}this._imageMap.has(A)||this._imageMap.set(A,t)}}class ag extends $n{constructor(A){super({onlyRefs:!0})}set(A=null,e,t){if(!e)throw new Error('LocalTilingPatternCache.set - expected "ref" argument.');this._imageCache.has(e)||this._imageCache.put(e,t)}}class sg extends $n{constructor(A){super({onlyRefs:!0})}set(A=null,e,t){if(!e)throw new Error('RegionalImageCache.set - expected "ref" argument.');this._imageCache.has(e)||this._imageCache.put(e,t)}}class ng{static NUM_PAGES_THRESHOLD=2;static MIN_IMAGES_TO_CACHE=10;static MAX_BYTE_SIZE=5e7;#D=new QA;constructor(){this._refCache=new lA,this._imageCache=new lA}get#b(){let A=0;for(const e of this._imageCache)A+=e.byteSize;return A}get#k(){return!(this._imageCache.size+A)):null}class og{static getSampleArray(A,e,t,i){let a,s,n=1;for(a=0,s=A.length;a>r)*I,o&=(1<t?A=t:A0&&(C=s[c-1]);let B=i[1];c>1,o=a.length>>1,I=new Cg(g),c=Object.create(null);let C=8192;const B=new Float32Array(o);return function(A,e,t,i){let a,n,g="";const h=B;for(a=0;aA&&(n=A)),l[a]=n}C>0&&(C--,c[g]=l),t.set(l,i)}}}function Ig(A){let e;if(A instanceof BA)e=A;else{if(!(A instanceof pA))return!1;e=A.dict}return e.has("FunctionType")}class cg{static MAX_STACK_SIZE=100;constructor(A){this.stack=A?Array.from(A):[]}push(A){if(this.stack.length>=cg.MAX_STACK_SIZE)throw new Error("PostScript function stack overflow.");this.stack.push(A)}pop(){if(this.stack.length<=0)throw new Error("PostScript function stack underflow.");return this.stack.pop()}copy(A){if(this.stack.length+A>=cg.MAX_STACK_SIZE)throw new Error("PostScript function stack overflow.");const e=this.stack;for(let t=e.length-A,i=A-1;i>=0;i--,t++)e.push(e[t])}index(A){this.push(this.stack[this.stack.length-A-1])}roll(A,e){const t=this.stack,i=t.length-A,a=t.length-1,s=i+(e-Math.floor(e/A)*A);for(let A=i,e=a;A0?e.push(n<>g);break;case"ceiling":n=e.pop(),e.push(Math.ceil(n));break;case"copy":n=e.pop(),e.copy(n);break;case"cos":n=e.pop(),e.push(Math.cos(n%360/180*Math.PI));break;case"cvi":n=0|e.pop(),e.push(n);break;case"cvr":break;case"div":g=e.pop(),n=e.pop(),e.push(n/g);break;case"dup":e.copy(1);break;case"eq":g=e.pop(),n=e.pop(),e.push(n===g);break;case"exch":e.roll(2,1);break;case"exp":g=e.pop(),n=e.pop(),e.push(n**g);break;case"false":e.push(!1);break;case"floor":n=e.pop(),e.push(Math.floor(n));break;case"ge":g=e.pop(),n=e.pop(),e.push(n>=g);break;case"gt":g=e.pop(),n=e.pop(),e.push(n>g);break;case"idiv":g=e.pop(),n=e.pop(),e.push(n/g|0);break;case"index":n=e.pop(),e.index(n);break;case"le":g=e.pop(),n=e.pop(),e.push(n<=g);break;case"ln":n=e.pop(),e.push(Math.log(n));break;case"log":n=e.pop(),e.push(Math.log10(n));break;case"lt":g=e.pop(),n=e.pop(),e.push(n=e?new Qg(e):A.max<=e?A:new Eg(A,e)}class Dg{compile(A,e,t){const i=[],a=[],s=e.length>>1,n=t.length>>1;let g,r,o,I,c,C,B,h,Q=0;for(let A=0;Ae.min&&(g.unshift("Math.max(",s,", "),g.push(")")),n4?(i=!0,e=0):(i=!1,e=1));const r=[];for(s=0;s=0&&"ET"===Mg[A];--A)Mg[A]="EN";for(let A=s+1;A0&&(e=Mg[s-1]);let t=c;A+1h&&Fg(h)&&(l=h);for(h=Q;h>=l;--h){let A=-1;for(s=0,n=r.length;s=0&&(Ng(Ug,A,s),A=-1):A<0&&(A=s);A>=0&&Ng(Ug,A,r.length)}for(s=0,n=Ug.length;s"!==A||(Ug[s]="")}return xg(Ug.join(""),i)}const Jg={style:"normal",weight:"normal"},Hg={style:"normal",weight:"bold"},Yg={style:"italic",weight:"normal"},vg={style:"italic",weight:"bold"},Kg=new Map([["Times-Roman",{local:["Times New Roman","Times-Roman","Times","Liberation Serif","Nimbus Roman","Nimbus Roman L","Tinos","Thorndale","TeX Gyre Termes","FreeSerif","Linux Libertine O","Libertinus Serif","DejaVu Serif","Bitstream Vera Serif","Ubuntu"],style:Jg,ultimate:"serif"}],["Times-Bold",{alias:"Times-Roman",style:Hg,ultimate:"serif"}],["Times-Italic",{alias:"Times-Roman",style:Yg,ultimate:"serif"}],["Times-BoldItalic",{alias:"Times-Roman",style:vg,ultimate:"serif"}],["Helvetica",{local:["Helvetica","Helvetica Neue","Arial","Arial Nova","Liberation Sans","Arimo","Nimbus Sans","Nimbus Sans L","A030","TeX Gyre Heros","FreeSans","DejaVu Sans","Albany","Bitstream Vera Sans","Arial Unicode MS","Microsoft Sans Serif","Apple Symbols","Cantarell"],path:"LiberationSans-Regular.ttf",style:Jg,ultimate:"sans-serif"}],["Helvetica-Bold",{alias:"Helvetica",path:"LiberationSans-Bold.ttf",style:Hg,ultimate:"sans-serif"}],["Helvetica-Oblique",{alias:"Helvetica",path:"LiberationSans-Italic.ttf",style:Yg,ultimate:"sans-serif"}],["Helvetica-BoldOblique",{alias:"Helvetica",path:"LiberationSans-BoldItalic.ttf",style:vg,ultimate:"sans-serif"}],["Courier",{local:["Courier","Courier New","Liberation Mono","Nimbus Mono","Nimbus Mono L","Cousine","Cumberland","TeX Gyre Cursor","FreeMono","Linux Libertine Mono O","Libertinus Mono"],style:Jg,ultimate:"monospace"}],["Courier-Bold",{alias:"Courier",style:Hg,ultimate:"monospace"}],["Courier-Oblique",{alias:"Courier",style:Yg,ultimate:"monospace"}],["Courier-BoldOblique",{alias:"Courier",style:vg,ultimate:"monospace"}],["ArialBlack",{local:["Arial Black"],style:{style:"normal",weight:"900"},fallback:"Helvetica-Bold"}],["ArialBlack-Bold",{alias:"ArialBlack"}],["ArialBlack-Italic",{alias:"ArialBlack",style:{style:"italic",weight:"900"},fallback:"Helvetica-BoldOblique"}],["ArialBlack-BoldItalic",{alias:"ArialBlack-Italic"}],["ArialNarrow",{local:["Arial Narrow","Liberation Sans Narrow","Helvetica Condensed","Nimbus Sans Narrow","TeX Gyre Heros Cn"],style:Jg,fallback:"Helvetica"}],["ArialNarrow-Bold",{alias:"ArialNarrow",style:Hg,fallback:"Helvetica-Bold"}],["ArialNarrow-Italic",{alias:"ArialNarrow",style:Yg,fallback:"Helvetica-Oblique"}],["ArialNarrow-BoldItalic",{alias:"ArialNarrow",style:vg,fallback:"Helvetica-BoldOblique"}],["Calibri",{local:["Calibri","Carlito"],style:Jg,fallback:"Helvetica"}],["Calibri-Bold",{alias:"Calibri",style:Hg,fallback:"Helvetica-Bold"}],["Calibri-Italic",{alias:"Calibri",style:Yg,fallback:"Helvetica-Oblique"}],["Calibri-BoldItalic",{alias:"Calibri",style:vg,fallback:"Helvetica-BoldOblique"}],["Wingdings",{local:["Wingdings","URW Dingbats"],style:Jg}],["Wingdings-Regular",{alias:"Wingdings"}],["Wingdings-Bold",{alias:"Wingdings"}]]),qg=new Map([["Arial-Black","ArialBlack"]]);function Tg(A){const e=new Set(["thin","extralight","ultralight","demilight","semilight","light","book","regular","normal","medium","demibold","semibold","bold","extrabold","ultrabold","black","heavy","extrablack","ultrablack","roman","italic","oblique","ultracondensed","extracondensed","condensed","semicondensed","normal","semiexpanded","expanded","extraexpanded","ultraexpanded","bolditalic"]);return A.split(/[- ,+]+/g).filter((A=>!e.has(A.toLowerCase()))).join(" ")}function Pg({alias:A,local:e,path:t,fallback:i,style:a,ultimate:s},n,g,r=!0,o=!0,I=""){const c={style:null,ultimate:null};if(e){const A=I?` ${I}`:"";for(const t of e)n.push(`local(${t}${A})`)}if(A){const e=Kg.get(A),s=I||function(A){switch(A){case Hg:return"Bold";case Yg:return"Italic";case vg:return"Bold Italic";default:if("bold"===A?.weight)return"Bold";if("italic"===A?.style)return"Italic"}return""}(a);Object.assign(c,Pg(e,n,g,r&&!i,o&&!t,s))}if(a&&(c.style=a),s&&(c.ultimate=s),r&&i){const A=Kg.get(i),{ultimate:e}=Pg(A,n,g,r,o&&!t,I);c.ultimate||=e}return o&&t&&g&&n.push(`url(${g}${t})`),c}function Wg(A,e,t,i,a,s){if(i.startsWith("InvalidPDFjsFont_"))return null;"TrueType"!==s&&"Type1"!==s||!/^[A-Z]{6}\+/.test(i)||(i=i.slice(7));const n=i=la(i);let g=A.get(n);if(g)return g;let r=Kg.get(i);if(!r)for(const[A,e]of qg)if(i.startsWith(A)){i=`${e}${i.substring(A.length)}`,r=Kg.get(i);break}let o=!1;r||(r=Kg.get(a),o=!0);const I=`${e.getDocId()}_s${e.createFontId()}`;if(!r){if(!VA(i))return G(`Cannot substitute the font because of its name: ${i}`),A.set(n,null),null;const e=/bold/gi.test(i),t=/oblique|italic/gi.test(i),a=e&&t&&vg||e&&Hg||t&&Yg||Jg;return g={css:`"${Tg(i)}",${I}`,guessFallback:!0,loadedName:I,baseFontName:i,src:`local(${i})`,style:a},A.set(n,g),g}const c=[];o&&VA(i)&&c.push(`local(${i})`);const{style:C,ultimate:B}=Pg(r,c,t),h=null===B,Q=h?"":`,${B}`;return g={css:`"${Tg(i)}",${I}${Q}`,guessFallback:h,loadedName:I,baseFontName:i,src:c.join(","),style:C},A.set(n,g),g}class Zg{constructor(A,e){this._imgData=A,this._isMask=e}static needsToBeResized(A,e){if(A<=this._goodSquareLength&&e<=this._goodSquareLength)return!1;const{MAX_DIM:t}=this;if(A>t||e>t)return!0;const i=A*e;return this._hasMaxArea?i>this.MAX_AREA:!(i(this.MAX_AREA=this._goodSquareLength**2)))}static get MAX_DIM(){return M(this,"MAX_DIM",this._guessMax(2048,65537,0,1))}static get MAX_AREA(){return this._hasMaxArea=!0,M(this,"MAX_AREA",this._guessMax(Zg._goodSquareLength,this.MAX_DIM,128,0)**2)}static set MAX_AREA(A){A>=0&&(this._hasMaxArea=!0,M(this,"MAX_AREA",A))}static setMaxArea(A){this._hasMaxArea||(this.MAX_AREA=A>>2)}static _areGoodDims(A,e){try{const t=new OffscreenCanvas(A,e),i=t.getContext("2d");i.fillRect(0,0,1,1);const a=i.getImageData(0,0,1,1).data[3];return t.width=t.height=1,0!==a}catch{return!1}}static _guessMax(A,e,t,i){for(;A+t+1>3,n=t+3&-4;if(t!==n){const A=new Uint8Array(n*e);let i=0;for(let s=0,g=e*t;s>>8,e[t++]=255&a)}}else{if(!ArrayBuffer.isView(A))throw new Error("Invalid data format, must be a string or TypedArray.");e=A.slice(),t=e.byteLength}const i=t>>2,a=t-4*i,s=new Uint32Array(e.buffer,0,i);let n=0,g=0,r=this.h1,o=this.h2;const I=3432918353,c=461845907,C=11601,B=13715;for(let A=0;A>>17,n=n*c&Xg|n*B&Vg,r^=n,r=r<<13|r>>>19,r=5*r+3864292196):(g=s[A],g=g*I&Xg|g*C&Vg,g=g<<15|g>>>17,g=g*c&Xg|g*B&Vg,o^=g,o=o<<13|o>>>19,o=5*o+3864292196);switch(n=0,a){case 3:n^=e[4*i+2]<<16;case 2:n^=e[4*i+1]<<8;case 1:n^=e[4*i],n=n*I&Xg|n*C&Vg,n=n<<15|n>>>17,n=n*c&Xg|n*B&Vg,1&i?r^=n:o^=n}this.h1=r,this.h2=o}hexdigest(){let A=this.h1,e=this.h2;return A^=e>>>1,A=3981806797*A&Xg|36045*A&Vg,e=4283543511*e&Xg|(2950163797*(e<<16|A>>>16)&Xg)>>>16,A^=e>>>1,A=444984403*A&Xg|60499*A&Vg,e=3301882366*e&Xg|(3120437893*(e<<16|A>>>16)&Xg)>>>16,A^=e>>>1,(A>>>0).toString(16).padStart(8,"0")+(e>>>0).toString(16).padStart(8,"0")}}function zg(A,e,t,i,a){let s=A;for(let A=0,t=e.length-1;A1e3&&(o=Math.max(o,C),B+=c+2,C=0,c=0),I.push({transform:e,x:C,y:B,w:t.width,h:t.height}),C+=t.width+2,c=Math.max(c,t.height)}const h=Math.max(o,C)+1,Q=B+c+1,l=new Uint8Array(h*Q*4),E=h<<2;for(let A=0;A=0;)e[s-4]=e[s],e[s-3]=e[s+1],e[s-2]=e[s+2],e[s-1]=e[s+3],e[s+t]=e[s+t-4],e[s+t+1]=e[s+t-3],e[s+t+2]=e[s+t-2],e[s+t+3]=e[s+t-1],s-=E}const u={width:h,height:Q};if(A.isOffscreenCanvasSupported){const A=new OffscreenCanvas(h,Q);A.getContext("2d").putImageData(new ImageData(new Uint8ClampedArray(l.buffer),h,Q),0,0),u.bitmap=A.transferToImageBitmap(),u.data=null}else u.kind=3,u.data=l;return t.splice(s,4*r,87),i.splice(s,4*r,[u,I]),s+1})),zg(_g,[E,d,b,u],null,(function(A,e){const t=A.fnArray,i=(e-(A.iCurr-3))%4;switch(i){case 0:return t[e]===E;case 1:return t[e]===d;case 2:return t[e]===b;case 3:return t[e]===u}throw new Error(`iterateImageMaskGroup - invalid pos: ${i}`)}),(function(A,e){const t=A.fnArray,i=A.argsArray,a=A.iCurr,s=a-3,n=a-2,g=a-1;let r=Math.floor((e-s)/4);if(r<10)return e-(e-s)%4;let o,I,c=!1;const C=i[g][0],B=i[n][0],h=i[n][1],Q=i[n][2],l=i[n][3];if(h===Q){c=!0,o=n+4;let A=g+4;for(let e=1;e=4&&t[s-4]===t[n]&&t[s-3]===t[g]&&t[s-2]===t[r]&&t[s-1]===t[o]&&i[s-4][0]===I&&i[s-4][1]===c&&(C++,B-=5);let h=B+4;for(let A=1;A=t)break}i=(i||_g)[A[e]],i&&!Array.isArray(i)?(s.iCurr=e,e++,!i.checkFn||(0,i.checkFn)(s)?(a=i,i=null):i=null):e++}this.state=i,this.match=a,this.lastProcessed=e}flush(){for(;this.match;){const A=this.queue.fnArray.length;this.lastProcessed=(0,this.match.processFn)(this.context,A),this.match=null,this.state=null,this._optimize()}}reset(){this.state=null,this.match=null,this.lastProcessed=0}}class er{static CHUNK_SIZE=1e3;static CHUNK_SIZE_ABOUT=this.CHUNK_SIZE-5;constructor(A=0,e){this._streamSink=e,this.fnArray=[],this.argsArray=[],this.optimizer=!e||256&A?new $g(this):new Ar(this),this.dependencies=new Set,this._totalLength=0,this.weight=0,this._resolved=e?null:Promise.resolve()}set isOffscreenCanvasSupported(A){this.optimizer.isOffscreenCanvasSupported=A}get length(){return this.argsArray.length}get ready(){return this._resolved||this._streamSink.ready}get totalLength(){return this._totalLength+this.length}addOp(A,e){this.optimizer.push(A,e),this.weight++,this._streamSink&&(this.weight>=er.CHUNK_SIZE||this.weight>=er.CHUNK_SIZE_ABOUT&&(A===u||32===A))&&this.flush()}addImageOps(A,e,t){void 0!==t&&this.addOp(w,["OC",t]),this.addOp(A,e),void 0!==t&&this.addOp(D,[])}addDependency(A){this.dependencies.has(A)||(this.dependencies.add(A),this.addOp(1,[A]))}addDependencies(A){for(const e of A)this.addDependency(e)}addOpList(A){if(A instanceof er){for(const e of A.dependencies)this.dependencies.add(e);for(let e=0,t=A.length;ei&&(A=i),A}function ir(A,e,t,i,a,s){const n=a*s;let g;g=e<=8?new Uint8Array(n):e<=16?new Uint16Array(n):new Uint32Array(n);const r=t/a,o=i/s;let I,c,C,B,h=0;const Q=new Uint16Array(a),l=t;for(I=0;I0&&Number.isInteger(t.height)&&t.height>0&&(t.width!==C||t.height!==B)&&(G("PDFImage - using the Width/Height of the image data, rather than the image dictionary."),C=t.width,B=t.height),C<1||B<1)throw new q(`Invalid image width: ${C} or height: ${B}`);this.width=C,this.height=B,this.interpolate=o.get("I","Interpolate"),this.imageMask=o.get("IM","ImageMask")||!1,this.matte=o.get("Matte")||!1;let h=t.bitsPerComponent;if(!h&&(h=o.get("BPC","BitsPerComponent"),!h)){if(!this.imageMask)throw new q(`Bits per component missing in image: ${this.imageMask}`);h=1}if(this.bpc=h,!this.imageMask){let a=o.getRaw("CS")||o.getRaw("ColorSpace");const s=!!a;if(s)this.jpxDecoderOptions?.smaskInData&&(a=IA.get("DeviceRGBA"));else if(this.jpxDecoderOptions)a=IA.get("DeviceRGBA");else switch(t.numComps){case 1:a=IA.get("DeviceGray");break;case 3:a=IA.get("DeviceRGB");break;case 4:a=IA.get("DeviceCMYK");break;default:throw new Error(`Images with ${t.numComps} color components not supported.`)}this.colorSpace=Ie.parse({cs:a,xref:A,resources:i?e:null,pdfFunctionFactory:g,localColorSpaceCache:r}),this.numComps=this.colorSpace.numComps,this.jpxDecoderOptions&&(this.jpxDecoderOptions.numComponents=s?this.numComp:0,this.jpxDecoderOptions.isIndexedColormap="Indexed"===this.colorSpace.name)}if(this.decode=o.getArray("D","Decode"),this.needsDecode=!1,this.decode&&(this.colorSpace&&!this.colorSpace.isDefaultDecode(this.decode,h)||n&&!Ie.isDefaultDecode(this.decode,1))){this.needsDecode=!0;const A=(1<>3)*t,g=A.byteLength;let r,o;if(!i||a&&n!==g?a?(r=new Uint8Array(n),r.set(A),r.fill(255,g)):r=new Uint8Array(A):r=A,a)for(o=0;o>7&1,n[C+1]=c>>6&1,n[C+2]=c>>5&1,n[C+3]=c>>4&1,n[C+4]=c>>3&1,n[C+5]=c>>2&1,n[C+6]=c>>1&1,n[C+7]=1&c,C+=8;if(C>=1}}else{let t=0;for(c=0,C=0,I=s;C>i;a<0?a=0:a>o&&(a=o),n[C]=a,c&=(1<n[i+1]){e=255;break}}g[I]=e}}}if(g)for(I=0,C=3,c=e*i;I>3,I=e&&Zg.needsToBeResized(t,i);if("DeviceRGBA"===this.colorSpace.name){a.kind=3;const A=a.data=await this.getImageBytes(g*n*4,{});return e?I?Zg.createImage(a,!1):this.createBitmap(3,t,i,A):a}if(!A){let A;if("DeviceGray"===this.colorSpace.name&&1===r?A=1:"DeviceRGB"!==this.colorSpace.name||8!==r||this.needsDecode||(A=2),A&&!this.smask&&!this.mask&&t===n&&i===g){const s=await this.getImageBytes(g*o,{});if(e)return I?Zg.createImage({data:s,kind:A,width:t,height:i,interpolate:this.interpolate},this.needsDecode):this.createBitmap(A,n,g,s);if(a.kind=A,a.data=s,this.needsDecode){x(1===A,"PDFImage.createImageData: The image must be grayscale.");const e=a.data;for(let A=0,t=e.length;A>3,n=await this.getImageBytes(i*s,{internal:!0}),g=this.getComponents(n);let r,o;if(1===a){if(o=t*i,this.needsDecode)for(r=0;r>2,r=new Uint32Array(A.buffer,e,g);if(X.isLittleEndian){for(;n>>24|e<<8|4278190080,t[i+2]=e>>>16|a<<16|4278190080,t[i+3]=a>>>8|4278190080}for(let e=4*n,a=A.length;e>>8|255,t[i+2]=e<<16|a>>>16|255,t[i+3]=a<<8|255}for(let e=4*n,a=A.length;e0&&e.args[0].count++}class or{static TIME_SLOT_DURATION_MS=20;static CHECK_TIME_EVERY=100;constructor(){this.reset()}check(){return!(++this.checkedc){const A="Image exceeded maximum allowed size and was removed.";if(this.options.ignoreErrors)return void G(A);throw new Error(A)}let C,B,h;if(g.has("OC")&&(C=await this.parseMarkedContentProps(g.get("OC"),A)),g.get("IM","ImageMask")){const A=g.get("I","Interpolate"),t=o+7>>3,n=e.getBytes(t*I),c=g.getArray("D","Decode");if(this.parsingType3Font){if(B=ar.createRawMask({imgArray:n,width:o,height:I,imageIsFromDecodeStream:e instanceof Se,inverseDecode:c?.[0]>0,interpolate:A}),B.cached=!!a,h=[B],i.addImageOps(b,h,C),a){const A={fn:b,args:h,optionalContent:C};s.set(a,r,A),r&&this._regionalImageCache.set(null,r,A)}return}if(B=await ar.createMask({imgArray:n,width:o,height:I,imageIsFromDecodeStream:e instanceof Se,inverseDecode:c?.[0]>0,interpolate:A,isOffscreenCanvasSupported:this.options.isOffscreenCanvasSupported}),B.isSingleOpaquePixel){if(i.addImageOps(90,[],C),a){const A={fn:90,args:[],optionalContent:C};s.set(a,r,A),r&&this._regionalImageCache.set(null,r,A)}return}const Q=`mask_${this.idFactory.createObjId()}`;if(i.addDependency(Q),B.dataLen=B.bitmap?B.width*B.height*4:B.data.length,this._sendImgData(Q,B),h=[{data:Q,width:B.width,height:B.height,interpolate:B.interpolate,count:1}],i.addImageOps(b,h,C),a){const A={objId:Q,fn:b,args:h,optionalContent:C};s.set(a,r,A),r&&this._regionalImageCache.set(null,r,A)}return}if(t&&o+I<200&&!g.has("SMask")&&!g.has("Mask")){try{const a=new ar({xref:this.xref,res:A,image:e,isInline:t,pdfFunctionFactory:this._pdfFunctionFactory,localColorSpaceCache:n});B=await a.createImageData(!0,!1),i.isOffscreenCanvasSupported=this.options.isOffscreenCanvasSupported,i.addImageOps(86,[B],C)}catch(A){const e=`Unable to decode inline image: "${A}".`;if(!this.options.ignoreErrors)throw new Error(e);G(e)}return}let Q=`img_${this.idFactory.createObjId()}`,l=!1;if(this.parsingType3Font?Q=`${this.idFactory.getDocId()}_type3_${Q}`:a&&r&&(l=this.globalImageCache.shouldCache(r,this.pageIndex),l&&(x(!t,"Cannot cache an inline image globally."),Q=`${this.idFactory.getDocId()}_${Q}`)),i.addDependency(Q),h=[Q,o,I],i.addImageOps(k,h,C),l){if(this.globalImageCache.hasDecodeFailed(r))return this.globalImageCache.setData(r,{objId:Q,fn:k,args:h,optionalContent:C,byteSize:0}),void this._sendImgData(Q,null,l);if(o*I>25e4||g.has("SMask")||g.has("Mask")){const A=await this.handler.sendWithPromise("commonobj",[Q,"CopyLocalImage",{imageRef:r}]);if(A)return this.globalImageCache.setData(r,{objId:Q,fn:k,args:h,optionalContent:C,byteSize:0}),void this.globalImageCache.addByteSize(r,A)}}if(ar.buildImage({xref:this.xref,res:A,image:e,isInline:t,pdfFunctionFactory:this._pdfFunctionFactory,localColorSpaceCache:n}).then((async A=>(B=await A.createImageData(!1,this.options.isOffscreenCanvasSupported),B.dataLen=B.bitmap?B.width*B.height*4:B.data.length,B.ref=r,l&&this.globalImageCache.addByteSize(r,B.dataLen),this._sendImgData(Q,B,l)))).catch((A=>(G(`Unable to decode image "${Q}": "${A}".`),r&&this.globalImageCache.addDecodeFailed(r),this._sendImgData(Q,null,l)))),a){const A={objId:Q,fn:k,args:h,optionalContent:C};s.set(a,r,A),r&&(this._regionalImageCache.set(null,r,A),l&&this.globalImageCache.setData(r,{objId:Q,fn:k,args:h,optionalContent:C,byteSize:0}))}}handleSMask(A,e,t,i,a,s){const n=A.get("G"),g={subtype:A.get("S").name,backdrop:A.get("BC")},r=A.get("TR");if(Ig(r)){const A=this._pdfFunctionFactory.create(r),e=new Uint8Array(256),t=new Float32Array(1);for(let i=0;i<256;i++)t[0]=i/255,A(t,0,t,0),e[i]=255*t[0]|0;g.transferMap=e}return this.buildFormXObject(e,n,g,t,i,a.state.clone(),s)}handleTransferFunction(A){let e;if(Array.isArray(A))e=A;else{if(!Ig(A))return null;e=[A]}const t=[];let i=0,a=0;for(const A of e){const e=this.xref.fetchIfRef(A);if(i++,EA(e,"Identity")){t.push(null);continue}if(!Ig(e))return null;const s=this._pdfFunctionFactory.create(e),n=new Uint8Array(256),g=new Float32Array(1);for(let A=0;A<256;A++)g[0]=A/255,s(g,0,g,0),n[A]=255*g[0]|0;t.push(n),a++}return 1!==i&&4!==i||0===a?null:t}handleTilingType(A,e,t,i,a,s,n,g){const r=new er,o=BA.merge({xref:this.xref,dictArray:[a.get("Resources"),t]});return this.getOperatorList({stream:i,task:n,resources:o,operatorList:r}).then((function(){const t=r.getIR(),i=sn(t,a,e);s.addDependencies(r.dependencies),s.addOp(A,i),a.objId&&g.set(null,a.objId,{operatorListIR:t,dict:a})})).catch((A=>{if(!(A instanceof T)){if(!this.options.ignoreErrors)throw A;G(`handleTilingType - ignoring pattern: "${A}".`)}}))}async handleSetFont(A,e,t,i,a,s,n=null,g=null){const r=e?.[0]instanceof IA?e[0].name:null;let o=await this.loadFont(r,t,A,n,g);if(o.font.isType3Font)try{await o.loadType3Data(this,A,a),i.addDependencies(o.type3Dependencies)}catch(A){o=new cr({loadedName:"g_font_error",font:new Vs(`Type3 font load error: ${A}`),dict:o.font,evaluatorOptions:this.options})}return s.font=o.font,o.send(this.handler),o.loadedName}handleText(A,e){const t=e.font,i=t.charsToGlyphs(A);return t.data&&(4&e.textRenderingMode||"Pattern"===e.fillColorSpace.name||t.disableFontFace||this.options.disableFontFace)&&Ir.buildFontPaths(t,i,this.handler,this.options),i}ensureStateFont(A){if(A.font)return;const e=new q("Missing setFont (Tf) operator before text rendering operator.");if(!this.options.ignoreErrors)throw e;G(`ensureStateFont: "${e}".`)}async setGState({resources:A,gState:e,operatorList:t,cacheKey:i,task:a,stateManager:s,localGStateCache:n,localColorSpaceCache:g}){const r=e.objId;let o=!0;const I=[];let c=Promise.resolve();for(const i of e.getKeys()){const n=e.get(i);switch(i){case"Type":break;case"LW":case"LC":case"LJ":case"ML":case"D":case"RI":case"FL":case"CA":case"ca":I.push([i,n]);break;case"Font":o=!1,c=c.then((()=>this.handleSetFont(A,null,n[0],t,a,s.state).then((function(A){t.addDependency(A),I.push([i,[A,n[1]]])}))));break;case"BM":I.push([i,gr(n)]);break;case"SMask":if(EA(n,"None")){I.push([i,!1]);break}n instanceof BA?(o=!1,c=c.then((()=>this.handleSMask(n,A,t,a,s,g))),I.push([i,!0])):G("Unsupported SMask type");break;case"TR":const e=this.handleTransferFunction(n);I.push([i,e]);break;case"OP":case"op":case"OPM":case"BG":case"BG2":case"UCR":case"UCR2":case"TR2":case"HT":case"SM":case"SA":case"AIS":case"TK":R("graphic state operator "+i);break;default:R("Unknown graphic state operator "+i)}}await c,I.length>0&&t.addOp(9,[I]),o&&n.set(i,r,I)}loadFont(A,e,t,i=null,a=null){const s=async()=>new cr({loadedName:"g_font_error",font:new Vs(`Font "${A}" is not available.`),dict:e,evaluatorOptions:this.options});let n;if(e)e instanceof hA&&(n=e);else{const e=t.get("Font");e&&(n=e.getRaw(A))}if(n){if(this.type3FontRefs?.has(n))return s();if(this.fontCache.has(n))return this.fontCache.get(n);try{e=this.xref.fetchIfRef(n)}catch(A){G(`loadFont - lookup failed: "${A}".`)}}if(!(e instanceof BA)){if(!this.options.ignoreErrors&&!this.parsingType3Font)return G(`Font "${A}" is not available.`),s();G(`Font "${A}" is not available -- attempting to fallback to a default font.`),e=i||Ir.fallbackFontDict}if(e.cacheKey&&this.fontCache.has(e.cacheKey))return this.fontCache.get(e.cacheKey);const{promise:g,resolve:r}=Promise.withResolvers();let o;try{o=this.preEvaluateFont(e),o.cssFontInfo=a}catch(A){return G(`loadFont - preEvaluateFont failed: "${A}".`),s()}const{descriptor:I,hash:c}=o,C=n instanceof hA;let B;if(c&&I instanceof BA){const A=I.fontAliases||=Object.create(null);if(A[c]){const e=A[c].aliasRef;if(C&&e&&this.fontCache.has(e))return this.fontCache.putAlias(n,e),this.fontCache.get(n)}else A[c]={fontID:this.idFactory.createFontId()};C&&(A[c].aliasRef=n),B=A[c].fontID}else B=this.idFactory.createFontId();return x(B?.startsWith("f"),'The "fontID" must be (correctly) defined.'),C?this.fontCache.put(n,g):(e.cacheKey=`cacheKey_${B}`,this.fontCache.put(e.cacheKey,g)),e.loadedName=`${this.idFactory.getDocId()}_${B}`,this.translateFont(o).then((A=>{r(new cr({loadedName:e.loadedName,font:A,dict:e,evaluatorOptions:this.options}))})).catch((A=>{G(`loadFont - translateFont failed: "${A}".`),r(new cr({loadedName:e.loadedName,font:new Vs(A instanceof Error?A.message:A),dict:e,evaluatorOptions:this.options}))})),g}buildPath(A,e,t,i=!1){const a=A.length-1;if(t||(t=[]),a<0||91!==A.fnArray[a]){let a;switch(i&&(G(`Encountered path operator "${e}" inside of a text object.`),A.addOp(E,null)),e){case 19:const A=t[0]+t[2],e=t[1]+t[3];a=[Math.min(t[0],A),Math.min(t[1],e),Math.max(t[0],A),Math.max(t[1],e)];break;case 13:case 14:a=[t[0],t[1],t[0],t[1]];break;default:a=[1/0,1/0,-1/0,-1/0]}A.addOp(91,[[e],t,a]),i&&A.addOp(u,null)}else{const i=A.argsArray[a];i[0].push(e),i[1].push(...t);const s=i[2];switch(e){case 19:const A=t[0]+t[2],e=t[1]+t[3];s[0]=Math.min(s[0],t[0],A),s[1]=Math.min(s[1],t[1],e),s[2]=Math.max(s[2],t[0],A),s[3]=Math.max(s[3],t[1],e);break;case 13:case 14:s[0]=Math.min(s[0],t[0]),s[1]=Math.min(s[1],t[1]),s[2]=Math.max(s[2],t[0]),s[3]=Math.max(s[3],t[1])}}}parseColorSpace({cs:A,resources:e,localColorSpaceCache:t}){return Ie.parseAsync({cs:A,xref:this.xref,resources:e,pdfFunctionFactory:this._pdfFunctionFactory,localColorSpaceCache:t}).catch((A=>{if(A instanceof T)return null;if(this.options.ignoreErrors)return G(`parseColorSpace - ignoring ColorSpace: "${A}".`),null;throw A}))}parseShading({shading:A,resources:e,localColorSpaceCache:t,localShadingPatternCache:i}){let a,s=i.get(A);if(s)return s;try{a=js.parseShading(A,this.xref,e,this._pdfFunctionFactory,t).getIR()}catch(e){if(e instanceof T)return null;if(this.options.ignoreErrors)return G(`parseShading - ignoring shading: "${e}".`),i.set(A,null),null;throw e}return s=`pattern_${this.idFactory.createObjId()}`,this.parsingType3Font&&(s=`${this.idFactory.getDocId()}_type3_${s}`),i.set(A,s),this.parsingType3Font?this.handler.send("commonobj",[s,"Pattern",a]):this.handler.send("obj",[s,this.pageIndex,"Pattern",a]),s}handleColorN(A,e,t,i,a,s,n,g,r,o){const I=t.pop();if(I instanceof IA){const c=a.getRaw(I.name),C=c instanceof hA&&r.getByRef(c);if(C)try{const a=i.base?i.base.getRgb(t,0):null,s=sn(C.operatorListIR,C.dict,a);return void A.addOp(e,s)}catch{}const B=this.xref.fetchIfRef(c);if(B){const a=B instanceof pA?B.dict:B,I=a.get("PatternType");if(1===I){const g=i.base?i.base.getRgb(t,0):null;return this.handleTilingType(e,g,s,B,a,A,n,r)}if(2===I){const t=a.get("Shading"),i=this.parseShading({shading:t,resources:s,localColorSpaceCache:g,localShadingPatternCache:o});if(i){const t=HA(a.getArray("Matrix"),null);A.addOp(e,["Shading",i,t])}return}throw new q(`Unknown PatternType: ${I}`)}}throw new q(`Unknown PatternName: ${I}`)}_parseVisibilityExpression(A,e,t){if(++e>10)return void G("Visibility expression is too deeply nested");const i=A.length,a=this.xref.fetchIfRef(A[0]);if(!(i<2)&&a instanceof IA){switch(a.name){case"And":case"Or":case"Not":t.push(a.name);break;default:return void G(`Invalid operator ${a.name} in visibility expression`)}for(let a=1;a0)return{type:"OCMD",expression:e}}const e=t.get("OCGs");if(Array.isArray(e)||e instanceof BA){const A=[];if(Array.isArray(e))for(const t of e)A.push(t.toString());else A.push(e.objId);return{type:i,ids:A,policy:t.get("P")instanceof IA?t.get("P").name:null,expression:null}}if(e instanceof hA)return{type:i,id:e.toString()}}return null}getOperatorList({stream:A,task:e,resources:t,operatorList:i,initialState:a=null,fallbackFontDict:s=null}){if(t||=BA.empty,a||=new hr,!i)throw new Error('getOperatorList: missing "operatorList" parameter');const n=this,g=this.xref;let r=!1;const o=new Ag,I=new eg,c=new ig,C=new ag,B=new Map,h=t.get("XObject")||BA.empty,Q=t.get("Pattern")||BA.empty,l=new Cr(a),E=new Qr(A,g,l),d=new or;function D(A){for(let A=0,e=E.savedStatesDepth;A0&&i.addOp(9,[e]),A=null;continue}}return void b(new Promise((function(A,a){if(!M)throw new q("GState must be referred to by name.");const s=t.get("ExtGState");if(!(s instanceof BA))throw new q("ExtGState should be a dictionary.");const g=s.get(U);if(!(g instanceof BA))throw new q("GState should be a dictionary.");n.setGState({resources:t,gState:g,operatorList:i,cacheKey:U,task:e,stateManager:l,localGStateCache:c,localColorSpaceCache:I}).then(A,a)})).catch((function(A){if(!(A instanceof T)){if(!n.options.ignoreErrors)throw A;G(`getOperatorList - ignoring ExtGState: "${A}".`)}})));case 13:case 14:case 15:case 16:case 17:case 18:case 19:n.buildPath(i,a,A,r);continue;case 67:case 68:case 72:case 73:continue;case w:if(!(A[0]instanceof IA)){G(`Expected name for beginMarkedContentProps arg0=${A[0]}`),i.addOp(w,["OC",null]);continue}if("OC"===A[0].name)return void b(n.parseMarkedContentProps(A[1],t).then((A=>{i.addOp(w,["OC",A])})).catch((A=>{if(!(A instanceof T)){if(n.options.ignoreErrors)return G(`getOperatorList - ignoring beginMarkedContentProps: "${A}".`),void i.addOp(w,["OC",null]);throw A}})));A=[A[0].name,A[1]instanceof BA?A[1].get("MCID"):null];break;default:if(null!==A){for(S=0,N=A.length;S{if(!(A instanceof T)){if(this.options.ignoreErrors)return G(`getOperatorList - ignoring errors during "${e.name}" task: "${A}".`),void D();throw A}}))}getTextContent({stream:A,task:e,resources:t,stateManager:s=null,includeMarkedContent:n=!1,sink:g,seenStyles:r=new Set,viewBox:o,lang:I=null,markedContentData:c=null,disableNormalization:C=!1,keepWhiteSpace:B=!1}){t||=BA.empty,s||=new Cr(new Br),n&&(c||={level:0});const h={items:[],styles:Object.create(null),lang:I},Q={initialized:!1,str:[],totalWidth:0,totalHeight:0,width:0,height:0,vertical:!1,prevTransform:null,textAdvanceScale:0,spaceInFlowMin:0,spaceInFlowMax:0,trackingSpaceMin:1/0,negativeSpaceMax:-1/0,notASpace:-1/0,transform:null,fontName:null,hasEOL:!1},l=[" "," "];let E=0;function d(A){const e=(E+1)%2,t=" "!==l[E]&&" "===l[e];return l[E]=A,E=e,!B&&t}function m(){return!B&&" "!==l[E]&&" "===l[(E+1)%2]}function y(){l[0]=l[1]=" ",E=0}const b=this,k=this.xref,F=[];let S=null;const R=new Ag,N=new ig,x=new Qr(A,k,s);let U;function M({width:A=0,height:e=0,transform:t=Q.prevTransform,fontName:i=Q.fontName}){h.items.push({str:" ",dir:"ltr",width:A,height:e,transform:t,fontName:i,hasEOL:!1})}function L(){const A=U.font,e=[U.fontSize*U.textHScale,0,0,U.fontSize,0,U.textRise];if(A.isType3Font&&(U.fontSize<=1||A.isCharBBox)&&!eA(U.fontMatrix,a)){const t=A.bbox[3]-A.bbox[1];t>0&&(e[3]*=t*U.fontMatrix[3])}return j.transform(U.ctm,j.transform(U.textMatrix,e))}function J(){if(Q.initialized)return Q;const{font:A,loadedName:e}=U;if(!r.has(e)&&(r.add(e),h.styles[e]={fontFamily:A.fallbackName,ascent:A.ascent,descent:A.descent,vertical:A.vertical},b.options.fontExtraProperties&&A.systemFontInfo)){const t=h.styles[e];t.fontSubstitution=A.systemFontInfo.css,t.fontSubstitutionLoadedName=A.systemFontInfo.loadedName}Q.fontName=e;const t=Q.transform=L();A.vertical?(Q.width=Q.totalWidth=Math.hypot(t[0],t[1]),Q.height=Q.totalHeight=0,Q.vertical=!0):(Q.width=Q.totalWidth=0,Q.height=Q.totalHeight=Math.hypot(t[2],t[3]),Q.vertical=!1);const i=Math.hypot(U.textLineMatrix[0],U.textLineMatrix[1]),a=Math.hypot(U.ctm[0],U.ctm[1]);Q.textAdvanceScale=a*i;const{fontSize:s}=U;return Q.trackingSpaceMin=.102*s,Q.notASpace=.03*s,Q.negativeSpaceMax=-.2*s,Q.spaceInFlowMin=.102*s,Q.spaceInFlowMax=.6*s,Q.hasEOL=!1,Q.initialized=!0,Q}function H(){if(!Q.initialized)return;const A=Math.hypot(U.textLineMatrix[0],U.textLineMatrix[1]),e=Math.hypot(U.ctm[0],U.ctm[1])*A;e!==Q.textAdvanceScale&&(Q.vertical?(Q.totalHeight+=Q.height*Q.textAdvanceScale,Q.height=0):(Q.totalWidth+=Q.width*Q.textAdvanceScale,Q.width=0),Q.textAdvanceScale=e)}async function Y(A,i){const s=await b.loadFont(A,i,t);if(s.font.isType3Font)try{await s.loadType3Data(b,t,e)}catch{}U.loadedName=s.loadedName,U.font=s.font,U.fontMatrix=s.font.fontMatrix||a}function v(A,e,t){const i=Math.hypot(t[0],t[1]);return[(t[0]*A+t[1]*e)/i,(t[2]*A+t[3]*e)/i]}function K(A){const e=L();let t=e[4],i=e[5];if(U.font?.vertical){if(to[2]||i+Ao[3])return!1}else if(t+Ao[2]||io[3])return!1;if(!U.font||!Q.prevTransform)return!0;let a=Q.prevTransform[4],s=Q.prevTransform[5];if(a===t&&s===i)return!0;let n=-1;switch(e[0]&&0===e[1]&&0===e[2]?n=e[0]>0?0:180:e[1]&&0===e[0]&&0===e[3]&&(n=e[1]>0?90:270),n){case 0:break;case 90:[t,i]=[i,t],[a,s]=[s,a];break;case 180:[t,i,a,s]=[-t,-i,-a,-s];break;case 270:[t,i]=[-i,-t],[a,s]=[-s,-a];break;default:[t,i]=v(t,i,e),[a,s]=v(a,s,Q.prevTransform)}if(U.font.vertical){const A=(s-i)/Q.textAdvanceScale,e=t-a,n=Math.sign(Q.height);return A.5*Q.width?(W(),!0):(y(),O(),!0):Math.abs(e)>Q.width?(W(),!0):(A<=n*Q.notASpace&&y(),A<=n*Q.trackingSpaceMin?m()?(y(),O(),M({height:Math.abs(A)})):Q.height+=A:Z(A,Q.prevTransform,n)||(0===Q.str.length?(y(),M({height:Math.abs(A)})):Q.height+=A),Math.abs(e)>.25*Q.width&&O(),!0)}const g=(t-a)/Q.textAdvanceScale,r=i-s,I=Math.sign(Q.width);return g.5*Q.height?(W(),!0):(y(),O(),!0):Math.abs(r)>Q.height?(W(),!0):(g<=I*Q.notASpace&&y(),g<=I*Q.trackingSpaceMin?m()?(y(),O(),M({width:Math.abs(g)})):Q.width+=g:Z(g,Q.prevTransform,I)||(0===Q.str.length?(y(),M({width:Math.abs(g)})):Q.width+=g),Math.abs(r)>.25*Q.height&&O(),!0)}function P({chars:A,extraSpacing:e}){const t=U.font;if(!A){const A=U.charSpacing+e;return A&&(t.vertical?U.translateTextMatrix(0,-A):U.translateTextMatrix(A*U.textHScale,0)),void(B&&K(0))}const i=t.charsToGlyphs(A),a=U.fontMatrix[0]*U.fontSize;for(let A=0,s=i.length;Ae?e.normalize("NFKC"):aA.get(t))));const i=Lg(e,-1,A.vertical);return{str:i.str,dir:i.dir,width:Math.abs(A.totalWidth),height:Math.abs(A.totalHeight),transform:A.transform,fontName:A.fontName,hasEOL:A.hasEOL}}(Q)),Q.initialized=!1,Q.str.length=0)}function X(A=!1){const e=h.items.length;0!==e&&(A&&e<10||(g.enqueue(h,e),h.items=[],h.styles=Object.create(null)))}const V=new or;return new Promise((function A(a,Q){const l=function(e){X(!0),Promise.all([e,g.ready]).then((function(){try{A(a,Q)}catch(A){Q(A)}}),Q)};e.ensureNotTerminated(),V.reset();const E={};let d,m=[];for(;!(d=V.check())&&(m.length=0,E.args=m,x.read(E));){const A=U;U=s.state;const a=E.fn;switch(m=E.args,0|a){case f:var y=m[0].name,M=m[1];if(U.font&&y===U.fontName&&M===U.fontSize)break;return O(),U.fontName=y,U.fontSize=M,void l(Y(y,null));case 39:U.textRise=m[0];break;case 35:U.textHScale=m[0]/100;break;case 36:U.leading=m[0];break;case 40:U.translateTextLineMatrix(m[0],m[1]),U.textMatrix=U.textLineMatrix.slice();break;case 41:U.leading=-m[1],U.translateTextLineMatrix(m[0],m[1]),U.textMatrix=U.textLineMatrix.slice();break;case 43:U.carriageReturn();break;case 42:U.setTextMatrix(m[0],m[1],m[2],m[3],m[4],m[5]),U.setTextLineMatrix(m[0],m[1],m[2],m[3],m[4],m[5]),H();break;case 33:U.charSpacing=m[0];break;case 34:U.wordSpacing=m[0];break;case 31:U.textMatrix=i.slice(),U.textLineMatrix=i.slice();break;case 45:if(!s.state.font){b.ensureStateFont(s.state);continue}const a=(U.font.vertical?1:-1)*U.fontSize/1e3,Q=m[0];for(let A=0,e=Q.length;A0){const A=F.join("");F.length=0,P({chars:A,extraSpacing:0})}break;case p:if(!s.state.font){b.ensureStateFont(s.state);continue}P({chars:m[0],extraSpacing:0});break;case 46:if(!s.state.font){b.ensureStateFont(s.state);continue}U.carriageReturn(),P({chars:m[0],extraSpacing:0});break;case 47:if(!s.state.font){b.ensureStateFont(s.state);continue}U.wordSpacing=m[0],U.charSpacing=m[1],U.carriageReturn(),P({chars:m[2],extraSpacing:0});break;case 66:O(),S||(S=t.get("XObject")||BA.empty);var L=m[0]instanceof IA,J=m[0].name;if(L&&R.getByName(J))break;return void l(new Promise((function(A,i){if(!L)throw new q("XObject must be referred to by name.");let a=S.getRaw(J);if(a instanceof hA){if(R.getByRef(a))return void A();if(b.globalImageCache.getData(a,b.pageIndex))return void A();a=k.fetch(a)}if(!(a instanceof pA))throw new q("XObject should be a stream");const h=a.dict.get("Subtype");if(!(h instanceof IA))throw new q("XObject should have a Name subtype");if("Form"!==h.name)return R.set(J,a.dict.objId,!0),void A();const Q=s.state.clone(),l=new Cr(Q),E=HA(a.dict.getArray("Matrix"),null);E&&l.transform(E),X();const u={enqueueInvoked:!1,enqueue(A,e){this.enqueueInvoked=!0,g.enqueue(A,e)},get desiredSize(){return g.desiredSize},get ready(){return g.ready}};b.getTextContent({stream:a,task:e,resources:a.dict.get("Resources")||t,stateManager:l,includeMarkedContent:n,sink:u,seenStyles:r,viewBox:o,lang:I,markedContentData:c,disableNormalization:C,keepWhiteSpace:B}).then((function(){u.enqueueInvoked||R.set(J,a.dict.objId,!0),A()}),i)})).catch((function(A){if(!(A instanceof T)){if(!b.options.ignoreErrors)throw A;G(`getTextContent - ignoring XObject: "${A}".`)}})));case 9:if(L=m[0]instanceof IA,J=m[0].name,L&&N.getByName(J))break;return void l(new Promise((function(A,e){if(!L)throw new q("GState must be referred to by name.");const i=t.get("ExtGState");if(!(i instanceof BA))throw new q("ExtGState should be a dictionary.");const a=i.get(J);if(!(a instanceof BA))throw new q("GState should be a dictionary.");const s=a.get("Font");if(!s)return N.set(J,a.objId,!0),void A();O(),U.fontName=null,U.fontSize=s[1],Y(null,s[0]).then(A,e)})).catch((function(A){if(!(A instanceof T)){if(!b.options.ignoreErrors)throw A;G(`getTextContent - ignoring ExtGState: "${A}".`)}})));case 69:O(),n&&(c.level++,h.items.push({type:"beginMarkedContent",tag:m[0]instanceof IA?m[0].name:null}));break;case w:if(O(),n){c.level++;let A=null;m[1]instanceof BA&&(A=m[1].get("MCID")),h.items.push({type:"beginMarkedContentProps",id:Number.isInteger(A)?`${b.idFactory.getPageObjId()}_mc${A}`:null,tag:m[0]instanceof IA?m[0].name:null})}break;case D:if(O(),n){if(0===c.level)break;c.level--,h.items.push({type:"endMarkedContent"})}break;case u:!A||A.font===U.font&&A.fontSize===U.fontSize&&A.fontName===U.fontName||O()}if(h.items.length>=g.desiredSize){d=!0;break}}d?l(nr):(O(),X(),a())})).catch((A=>{if(!(A instanceof T)){if(this.options.ignoreErrors)return G(`getTextContent - ignoring errors during "${e.name}" task: "${A}".`),O(),void X();throw A}}))}async extractDataStructures(A,e){const t=this.xref;let i;const a=this.readToUnicode(e.toUnicode);if(e.composite){const t=A.get("CIDSystemInfo");t instanceof BA&&(e.cidSystemInfo={registry:_(t.get("Registry")),ordering:_(t.get("Ordering")),supplement:t.get("Supplement")});try{const e=A.get("CIDToGIDMap");e instanceof pA&&(i=e.getBytes())}catch(A){if(!this.options.ignoreErrors)throw A;G(`extractDataStructures - ignoring CIDToGIDMap data: "${A}".`)}}const s=[];let n,g=null;if(A.has("Encoding")){if(n=A.get("Encoding"),n instanceof BA){if(g=n.get("BaseEncoding"),g=g instanceof IA?g.name:null,n.has("Differences")){const A=n.get("Differences");let e=0;for(const i of A){const A=t.fetchIfRef(i);if("number"==typeof A)e=A;else{if(!(A instanceof IA))throw new q(`Invalid entry in 'Differences' array: ${A}`);s[e++]=A.name}}}}else if(n instanceof IA)g=n.name;else{const A="Encoding is not a Name nor a Dict";if(!this.options.ignoreErrors)throw new q(A);G(A)}"MacRomanEncoding"!==g&&"MacExpertEncoding"!==g&&"WinAnsiEncoding"!==g&&(g=null)}const r=!e.file||e.isInternalFont,o=ma()[e.name];if(g&&r&&o&&(g=null),g)e.defaultEncoding=Hi(g);else{const A=!!(4&e.flags),t=!!(32&e.flags);n=Ui,"TrueType"!==e.type||t||(n=Mi),(A||o)&&(n=xi,r&&(/Symbol/i.test(e.name)?n=Li:/Dingbats/i.test(e.name)?n=Ji:/Wingdings/i.test(e.name)&&(n=Mi))),e.defaultEncoding=n}e.differences=s,e.baseEncodingName=g,e.hasEncoding=!!g||s.length>0,e.dict=A,e.toUnicode=await a;const I=await this.buildToUnicode(e);return e.toUnicode=I,i&&(e.cidToGidMap=this.readCidToGidMap(i,I)),e}_simpleFontToUnicode(A,e=!1){x(!A.composite,"Must be a simple font.");const t=[],i=A.defaultEncoding.slice(),a=A.baseEncodingName,s=A.differences;for(const A in s){const e=s[A];".notdef"!==e&&(i[A]=e)}const n=aa();for(const s in i){let g=i[s];if(""===g)continue;let r=n[g];if(void 0!==r){t[s]=String.fromCharCode(r);continue}let o=0;switch(g[0]){case"G":3===g.length&&(o=parseInt(g.substring(1),16));break;case"g":5===g.length&&(o=parseInt(g.substring(1),16));break;case"C":case"c":if(g.length>=3&&g.length<=4){const t=g.substring(1);if(e){o=parseInt(t,16);break}if(o=+t,Number.isNaN(o)&&Number.isInteger(parseInt(t,16)))return this._simpleFontToUnicode(A,!0)}break;case"u":r=ga(g,n),-1!==r&&(o=r);break;default:switch(g){case"f_h":case"f_t":case"T_h":t[s]=g.replaceAll("_","");continue}}if(o>0&&o<=1114111&&Number.isInteger(o)){if(a&&o===+s){const A=Hi(a);if(A&&(g=A[s])){t[s]=String.fromCharCode(n[g]);continue}}t[s]=String.fromCodePoint(o)}}return t}async buildToUnicode(A){if(A.hasIncludedToUnicodeMap=A.toUnicode?.length>0,A.hasIncludedToUnicodeMap)return!A.composite&&A.hasEncoding&&(A.fallbackToUnicode=this._simpleFontToUnicode(A)),A.toUnicode;if(!A.composite)return new Fa(this._simpleFontToUnicode(A));if(A.composite&&(A.cMap.builtInCMap&&!(A.cMap instanceof Bi)||"Adobe"===A.cidSystemInfo?.registry&&("GB1"===A.cidSystemInfo.ordering||"CNS1"===A.cidSystemInfo.ordering||"Japan1"===A.cidSystemInfo.ordering||"Korea1"===A.cidSystemInfo.ordering))){const{registry:e,ordering:t}=A.cidSystemInfo,i=IA.get(`${e}-${t}-UCS2`),a=await ki.create({encoding:i,fetchBuiltInCMap:this._fetchBuiltInCMapBound,useCMap:null}),s=[],n=[];return A.cMap.forEach((function(A,e){if(e>65535)throw new q("Max size of CID is 65,535");const t=a.lookup(e);if(t){n.length=0;for(let A=0,e=t.length;A>1;(0!==a||e.has(s))&&(t[s]=a)}return t}extractWidths(A,e,t){const i=this.xref;let a=[],s=0;const n=[];let g;if(t.composite){const e=A.get("DW");s="number"==typeof e?Math.ceil(e):1e3;const r=A.get("W");if(Array.isArray(r))for(let A=0,e=r.length;A{const e=r.get(A),a=new er;return i.getOperatorList({stream:e,task:t,resources:o,operatorList:a}).then((()=>{49===a.fnArray[0]&&this._removeType3ColorOperators(a,h),I[A]=a.getIR();for(const A of a.dependencies)n.add(A)})).catch((function(e){G(`Type3 font resource "${A}" is not available.`);const t=new er;I[A]=t.getIR()}))}));return this.type3Loaded=g.then((()=>{s.charProcOperatorList=I,this._bbox&&(s.isCharBBox=!0,s.bbox=this._bbox)})),this.type3Loaded}_removeType3ColorOperators(A,e=NaN){const t=j.normalizeRect(A.argsArray[0].slice(2)),i=t[2]-t[0],a=t[3]-t[1],s=Math.hypot(i,a);0===i||0===a?(A.fnArray.splice(0,1),A.argsArray.splice(0,1)):(0===e||Math.round(s/e)>=10)&&(this._bbox||(this._bbox=[1/0,1/0,-1/0,-1/0]),this._bbox[0]=Math.min(this._bbox[0],t[0]),this._bbox[1]=Math.min(this._bbox[1],t[1]),this._bbox[2]=Math.max(this._bbox[2],t[2]),this._bbox[3]=Math.max(this._bbox[3],t[3]));let n=0,g=A.length;for(;n=13&&s<=28,a.variableArgs)g>n&&R(`Command ${i}: expected [0, ${n}] args, but received ${g} args.`);else{if(g!==n){const A=this.nonProcessedArgs;for(;g>n;)A.push(e.shift()),g--;for(;gQr.MAX_INVALID_PATH_OPS)throw new q(`Invalid ${A}`);G(`Skipping ${A}`),null!==e&&(e.length=0);continue}}return this.preprocessCommand(s,e),A.fn=s,A.args=e,!0}if(t===nA)return!1;if(null!==t&&(null===e&&(e=[]),e.push(t),e.length>33))throw new q("Too many arguments")}}preprocessCommand(A,e){switch(0|A){case E:this.stateManager.save();break;case u:this.stateManager.restore();break;case d:this.stateManager.transform(e)}}}class lr extends Qr{constructor(A){super(new ne(A))}parse(){const A={fn:0,args:[]},e={fontSize:0,fontName:"",fontColor:new Uint8ClampedArray(3)};try{for(;A.args.length=0,this.read(A);){if(0!==this.savedStatesDepth)continue;const{fn:t,args:i}=A;switch(0|t){case f:const[A,t]=i;A instanceof IA&&(e.fontName=A.name),"number"==typeof t&&t>0&&(e.fontSize=t);break;case y:Ie.singletons.rgb.getRgbItem(i,0,e.fontColor,0);break;case 57:Ie.singletons.gray.getRgbItem(i,0,e.fontColor,0);break;case 61:Ie.singletons.cmyk.getRgbItem(i,0,e.fontColor,0)}}}catch(A){G(`parseDefaultAppearance - ignoring errors: "${A}".`)}return e}}function Er(A){return new lr(A).parse()}class ur extends Qr{constructor(A,e,t){super(A),this.stream=A,this.evaluatorOptions=e,this.xref=t,this.resources=A.dict?.get("Resources")}parse(){const A={fn:0,args:[]};let e={scaleFactor:1,fontSize:0,fontName:"",fontColor:new Uint8ClampedArray(3),fillColorSpace:Ie.singletons.gray},t=!1;const i=[];try{for(;A.args.length=0,!t&&this.read(A);){const{fn:a,args:s}=A;switch(0|a){case E:i.push({scaleFactor:e.scaleFactor,fontSize:e.fontSize,fontName:e.fontName,fontColor:e.fontColor.slice(),fillColorSpace:e.fillColorSpace});break;case u:e=i.pop()||e;break;case 42:e.scaleFactor*=Math.hypot(s[0],s[1]);break;case f:const[A,a]=s;A instanceof IA&&(e.fontName=A.name),"number"==typeof a&&a>0&&(e.fontSize=a*e.scaleFactor);break;case 51:e.fillColorSpace=Ie.parse({cs:s[0],xref:this.xref,resources:this.resources,pdfFunctionFactory:this._pdfFunctionFactory,localColorSpaceCache:this._localColorSpaceCache});break;case 54:e.fillColorSpace.getRgbItem(s,0,e.fontColor,0);break;case y:Ie.singletons.rgb.getRgbItem(s,0,e.fontColor,0);break;case 57:Ie.singletons.gray.getRgbItem(s,0,e.fontColor,0);break;case 61:Ie.singletons.cmyk.getRgbItem(s,0,e.fontColor,0);break;case p:case 45:case 46:case 47:t=!0}}}catch(A){G(`parseAppearanceStream - ignoring errors: "${A}".`)}return this.stream.reset(),delete e.scaleFactor,delete e.fillColorSpace,e}get _localColorSpaceCache(){return M(this,"_localColorSpaceCache",new eg)}get _pdfFunctionFactory(){return M(this,"_pdfFunctionFactory",new gg({xref:this.xref,isEvalSupported:this.evaluatorOptions.isEvalSupported}))}}function dr(A,e){return A[0]===A[1]&&A[1]===A[2]?`${_A(A[0]/255)} ${e?"g":"G"}`:Array.from(A,(A=>_A(A/255))).join(" ")+" "+(e?"rg":"RG")}class fr{constructor(A,e){this.xref=A,this.widths=null,this.firstChar=1/0,this.lastChar=-1/0,this.fontFamily=e;const t=new OffscreenCanvas(1,1);this.ctxMeasure=t.getContext("2d",{willReadFrequently:!0}),fr._fontNameId||(fr._fontNameId=1),this.fontName=IA.get(`InvalidPDFjsFont_${e}_${fr._fontNameId++}`)}get fontDescriptorRef(){if(!fr._fontDescriptorRef){const A=new BA(this.xref);A.set("Type",IA.get("FontDescriptor")),A.set("FontName",this.fontName),A.set("FontFamily","MyriadPro Regular"),A.set("FontBBox",[0,0,0,0]),A.set("FontStretch",IA.get("Normal")),A.set("FontWeight",400),A.set("ItalicAngle",0),fr._fontDescriptorRef=this.xref.getNewPersistentRef(A)}return fr._fontDescriptorRef}get descendantFontRef(){const A=new BA(this.xref);A.set("BaseFont",this.fontName),A.set("Type",IA.get("Font")),A.set("Subtype",IA.get("CIDFontType0")),A.set("CIDToGIDMap",IA.get("Identity")),A.set("FirstChar",this.firstChar),A.set("LastChar",this.lastChar),A.set("FontDescriptor",this.fontDescriptorRef),A.set("DW",1e3);const e=[],t=[...this.widths.entries()].sort();let i=null,a=null;for(const[A,s]of t)i?A===i+a.length?a.push(s):(e.push(i,a),i=A,a=[s]):(i=A,a=[s]);i&&e.push(i,a),A.set("W",e);const s=new BA(this.xref);return s.set("Ordering","Identity"),s.set("Registry","Adobe"),s.set("Supplement",0),A.set("CIDSystemInfo",s),this.xref.getNewPersistentRef(A)}get baseFontRef(){const A=new BA(this.xref);return A.set("BaseFont",this.fontName),A.set("Type",IA.get("Font")),A.set("Subtype",IA.get("Type0")),A.set("Encoding",IA.get("Identity-H")),A.set("DescendantFonts",[this.descendantFontRef]),A.set("ToUnicode",IA.get("Identity-H")),this.xref.getNewPersistentRef(A)}get resources(){const A=new BA(this.xref),e=new BA(this.xref);return e.set(this.fontName.name,this.baseFontRef),A.set("Font",e),A}_createContext(){return this.widths=new Map,this.ctxMeasure.font=`1000px ${this.fontFamily}`,this.ctxMeasure}createFontResources(A){const e=this._createContext();for(const t of A.split(/\r\n?|\n/))for(const A of t.split("")){const t=A.charCodeAt(0);if(this.widths.has(t))continue;const i=e.measureText(A),a=Math.ceil(i.width);this.widths.set(t,a),this.firstChar=Math.min(t,this.firstChar),this.lastChar=Math.max(t,this.lastChar)}return this.resources}static getFirstPositionInfo(A,e,t){const[i,a,n,g]=A;let r=n-i,o=g-a;e%180!=0&&([r,o]=[o,r]);const I=s*t;return{coords:[0,o+.35*t-I],bbox:[0,0,r,o],matrix:0!==e?ie(e,o,I):void 0}}createAppearance(A,e,t,i,a,n){const g=this._createContext(),r=[];let o=-1/0;for(const e of A.split(/\r\n?|\n/)){r.push(e);const A=g.measureText(e).width;o=Math.max(o,A);for(const A of OA(e)){const e=String.fromCodePoint(A);let t=this.widths.get(A);if(void 0===t){const i=g.measureText(e);t=Math.ceil(i.width),this.widths.set(A,t),this.firstChar=Math.min(A,this.firstChar),this.lastChar=Math.max(A,this.lastChar)}}}o*=i/1e3;const[I,c,C,B]=e;let h=C-I,Q=B-c;t%180!=0&&([h,Q]=[Q,h]);let l=1;o>h&&(l=h/o);let E=1;const u=s*i,d=.35*i,f=u*r.length;f>Q&&(E=Q/f);const p=i*Math.min(l,E),m=["q",`0 0 ${_A(h)} ${_A(Q)} re W n`,"BT",`1 0 0 1 0 ${_A(Q+d)} Tm 0 Tc ${dr(a,!0)}`,`/${this.fontName.name} ${_A(p)} Tf`],{resources:y}=this;if(1!==(n="number"==typeof n&&n>=0&&n<=1?n:1)){m.push("/R0 gs");const A=new BA(this.xref),e=new BA(this.xref);e.set("ca",n),e.set("CA",n),e.set("Type",IA.get("ExtGState")),A.set("R0",e),y.set("ExtGState",A)}const w=_A(u);for(const A of r)m.push(`0 -${w} Td <${ee(A)}> Tj`);m.push("ET","Q");const D=m.join("\n"),b=new BA(this.xref);if(b.set("Subtype",IA.get("Form")),b.set("Type",IA.get("XObject")),b.set("BBox",[0,0,h,Q]),b.set("Length",D.length),b.set("Resources",y),t){const A=ie(t,h,Q);b.set("Matrix",A)}const k=new ne(D);return k.dict=b,k}}class pr{constructor(A,e,t){this.root=A,this.xref=e,this._type=t}getAll(){const A=new Map;if(!this.root)return A;const e=this.xref,t=new QA;t.put(this.root);const i=[this.root];for(;i.length>0;){const a=e.fetchIfRef(i.shift());if(!(a instanceof BA))continue;if(a.has("Kids")){const A=a.get("Kids");if(!Array.isArray(A))continue;for(const e of A){if(t.has(e))throw new q(`Duplicate entry in "${this._type}" tree.`);i.push(e),t.put(e)}continue}const s=a.get(this._type);if(Array.isArray(s))for(let t=0,i=s.length;t10)return G(`Search depth limit reached for "${this._type}" tree.`),null;const a=t.get("Kids");if(!Array.isArray(a))return null;let s=0,n=a.length-1;for(;s<=n;){const i=s+n>>1,g=e.fetchIfRef(a[i]),r=g.get("Limits");if(Ae.fetchIfRef(r[1]))){t=g;break}s=i+1}}if(s>n)return null}const a=t.get(this._type);if(Array.isArray(a)){let t=0,i=a.length-2;for(;t<=i;){const s=t+i>>1,n=s+(1&s),g=e.fetchIfRef(a[n]);if(Ag))return e.fetchIfRef(a[n+1]);t=n+2}}}return null}}class mr extends pr{constructor(A,e){super(A,e,"Names")}}class yr extends pr{constructor(A,e){super(A,e,"Nums")}}function wr(){An=Object.create(null),gA=Object.create(null),rA=Object.create(null),oA=Object.create(null),ca.clear(),Ai.cleanup()}function Dr(A){return A instanceof BA?A.has("UF")?A.get("UF"):A.has("F")?A.get("F"):A.has("Unix")?A.get("Unix"):A.has("Mac")?A.get("Mac"):A.has("DOS")?A.get("DOS"):null:null}class br{#F=!1;constructor(A,e,t=!1){A instanceof BA&&(this.xref=e,this.root=A,A.has("FS")&&(this.fs=A.get("FS")),A.has("RF")&&G("Related file specifications are not supported"),t||(A.has("EF")?this.#F=!0:G("Non-embedded file specifications are not supported")))}get filename(){let A="";const e=Dr(this.root);return e&&"string"==typeof e&&(A=_(e).replaceAll("\\\\","\\").replaceAll("\\/","/").replaceAll("\\","/")),M(this,"filename",A||"unnamed")}get content(){if(!this.#F)return null;this._contentRef||=Dr(this.root?.get("EF"));let A=null;if(this._contentRef){const e=this.xref.fetchIfRef(this._contentRef);e instanceof pA?A=e.getBytes():G("Embedded file specification points to non-existing/invalid content")}else G("Embedded file specification does not have any content");return A}get description(){let A="";const e=this.root?.get("Desc");return e&&"string"==typeof e&&(A=_(e)),M(this,"description",A)}get serializable(){return{rawFilename:this.filename,filename:(A=this.filename,A.substring(A.lastIndexOf("/")+1)),content:this.content,description:this.description};var A}}function kr(A,e){const t=A[e];return" "===t||"\n"===t||"\r"===t||"\t"===t}class Fr{_resolveEntities(A){return A.replaceAll(/&([^;]+);/g,((A,e)=>{if("#x"===e.substring(0,2))return String.fromCodePoint(parseInt(e.substring(2),16));if("#"===e.substring(0,1))return String.fromCodePoint(parseInt(e.substring(1),10));switch(e){case"lt":return"<";case"gt":return">";case"amp":return"&";case"quot":return'"';case"apos":return"'"}return this.onResolveEntity(e)}))}_parseContent(A,e){const t=[];let i=e;function a(){for(;i"!==A[i]&&"/"!==A[i];)++i;const s=A.substring(e,i);for(a();i"!==A[i]&&"/"!==A[i]&&"?"!==A[i];){a();let e="",s="";for(;i"!==A[t]&&"?"!==A[t]&&"/"!==A[t];)++t;const i=A.substring(e,t);!function(){for(;t"!==A[t+1]);)++t;return{name:i,value:A.substring(a,t),parsed:t-e}}parseXml(A){let e=0;for(;e",t),e<0)return void this.onError(-9);this.onEndElement(A.substring(t,e)),t=e+1;break;case"?":++t;const i=this._parseProcessingInstruction(A,t);if("?>"!==A.substring(t+i.parsed,t+i.parsed+2))return void this.onError(-3);this.onPi(i.name,i.value),t+=i.parsed+2;break;case"!":if("--"===A.substring(t+1,t+3)){if(e=A.indexOf("--\x3e",t+3),e<0)return void this.onError(-5);this.onComment(A.substring(t+3,e)),t=e+3}else if("[CDATA["===A.substring(t+1,t+8)){if(e=A.indexOf("]]>",t+8),e<0)return void this.onError(-2);this.onCdata(A.substring(t+8,e)),t=e+3}else{if("DOCTYPE"!==A.substring(t+1,t+8))return void this.onError(-6);{const i=A.indexOf("[",t+8);let a=!1;if(e=A.indexOf(">",t+8),e<0)return void this.onError(-4);if(i>0&&e>i){if(e=A.indexOf("]>",t+8),e<0)return void this.onError(-4);a=!0}const s=A.substring(t+8,e+(a?1:0));this.onDoctype(s),t=e+(a?2:1)}}break;default:const a=this._parseContent(A,t);if(null===a)return void this.onError(-6);let s=!1;if("/>"===A.substring(t+a.parsed,t+a.parsed+2))s=!0;else if(">"!==A.substring(t+a.parsed,t+a.parsed+1))return void this.onError(-9);this.onBeginElement(a.name,a.attributes,s),t+=a.parsed+(s?2:1)}}else{for(;t0}searchNode(A,e){if(e>=A.length)return this;const t=A[e];if(t.name.startsWith("#")&&e0)i.push([a,0]),a=a.childNodes[0];else{if(0===i.length)return null;for(;0!==i.length;){const[A,e]=i.pop(),t=e+1;if(t");for(const e of this.childNodes)e.dump(A);A.push(``)}else this.nodeValue?A.push(`>${XA(this.nodeValue)}`):A.push("/>")}else A.push(XA(this.nodeValue))}}class Rr extends Fr{constructor({hasAttributes:A=!1,lowerCaseName:e=!1}){super(),this._currentFragment=null,this._stack=null,this._errorCode=0,this._hasAttributes=A,this._lowerCaseName=e}parseFromString(A){if(this._currentFragment=[],this._stack=[],this._errorCode=0,this.parseXml(A),0!==this._errorCode)return;const[e]=this._currentFragment;return e?{documentElement:e}:void 0}onText(A){if(function(A){for(let e=0,t=A.length;e\\376\\377([^<]+)/g,(function(A,e){const t=e.replaceAll(/\\([0-3])([0-7])([0-7])/g,(function(A,e,t,i){return String.fromCharCode(64*e+8*t+1*i)})).replaceAll(/&(amp|apos|gt|lt|quot);/g,(function(A,e){switch(e){case"amp":return"&";case"apos":return"'";case"gt":return">";case"lt":return"<";case"quot":return'"'}throw new Error(`_repair: ${e} isn't defined.`)})),i=[">"];for(let A=0,e=t.length;A=32&&e<127&&60!==e&&62!==e&&38!==e?i.push(String.fromCharCode(e)):i.push("&#x"+(65536+e).toString(16).substring(1)+";")}return i.join("")}))}_getSequence(A){const e=A.nodeName;return"rdf:bag"!==e&&"rdf:seq"!==e&&"rdf:alt"!==e?null:A.childNodes.filter((A=>"rdf:li"===A.nodeName))}_parseArray(A){if(!A.hasChildNodes())return;const[e]=A.childNodes,t=this._getSequence(e)||[];this._metadataMap.set(A.nodeName,t.map((A=>A.textContent.trim())))}_parse(A){let e=A.documentElement;if("rdf:rdf"!==e.nodeName)for(e=e.firstChild;e&&"rdf:rdf"!==e.nodeName;)e=e.nextSibling;if(e&&"rdf:rdf"===e.nodeName&&e.hasChildNodes())for(const A of e.childNodes)if("rdf:description"===A.nodeName)for(const e of A.childNodes){const A=e.nodeName;switch(A){case"#text":continue;case"dc:creator":case"dc:subject":this._parseArray(e);continue}this._metadataMap.set(A,e.textContent.trim())}}get serializable(){return{parsedData:this._metadataMap,rawData:this._data}}}class Nr extends Se{constructor(A,e,t){super(e),this.str=A,this.dict=A.dict,this.decrypt=t,this.nextChunk=null,this.initialized=!1}readBlock(){let A;if(this.initialized?A=this.nextChunk:(A=this.str.getBytes(512),this.initialized=!0),!A||0===A.length)return void(this.eof=!0);this.nextChunk=this.str.getBytes(512);const e=this.nextChunk?.length>0;A=(0,this.decrypt)(A,!e);const t=this.bufferLength,i=t+A.length;this.ensureBuffer(i).set(A,t),this.bufferLength=i}}class xr{constructor(A){this.a=0,this.b=0;const e=new Uint8Array(256),t=A.length;for(let A=0;A<256;++A)e[A]=A;for(let i=0,a=0;i<256;++i){const s=e[i];a=a+s+A[i%t]&255,e[i]=e[a],e[a]=s}this.s=e}encryptBlock(A){let e=this.a,t=this.b;const i=this.s,a=A.length,s=new Uint8Array(a);for(let n=0;n>5&255,I[c++]=a>>13&255,I[c++]=a>>21&255,I[c++]=a>>>29&255,I[c++]=0,I[c++]=0,I[c++]=0;const h=new Int32Array(16);for(c=0;c>>32-g)|0,a=s}s=s+a|0,n=n+o|0,g=g+B|0,r=r+Q|0}return new Uint8Array([255&s,s>>8&255,s>>16&255,s>>>24&255,255&n,n>>8&255,n>>16&255,n>>>24&255,255&g,g>>8&255,g>>16&255,g>>>24&255,255&r,r>>8&255,r>>16&255,r>>>24&255])}}();class Mr{constructor(A,e){this.high=0|A,this.low=0|e}and(A){this.high&=A.high,this.low&=A.low}xor(A){this.high^=A.high,this.low^=A.low}or(A){this.high|=A.high,this.low|=A.low}shiftRight(A){A>=32?(this.low=this.high>>>A-32|0,this.high=0):(this.low=this.low>>>A|this.high<<32-A,this.high=this.high>>>A|0)}shiftLeft(A){A>=32?(this.high=this.low<>>32-A,this.low<<=A)}rotateRight(A){let e,t;32&A?(t=this.low,e=this.high):(e=this.low,t=this.high),A&=31,this.low=e>>>A|t<<32-A,this.high=t>>>A|e<<32-A}not(){this.high=~this.high,this.low=~this.low}add(A){const e=(this.low>>>0)+(A.low>>>0);let t=(this.high>>>0)+(A.high>>>0);e>4294967295&&(t+=1),this.low=0|e,this.high=0|t}copyTo(A,e){A[e]=this.high>>>24&255,A[e+1]=this.high>>16&255,A[e+2]=this.high>>8&255,A[e+3]=255&this.high,A[e+4]=this.low>>>24&255,A[e+5]=this.low>>16&255,A[e+6]=this.low>>8&255,A[e+7]=255&this.low}assign(A){this.high=A.high,this.low=A.low}}const Lr=function(){function A(A,e){return A>>>e|A<<32-e}function e(A,e,t){return A&e^~A&t}function t(A,e,t){return A&e^A&t^e&t}function i(e){return A(e,2)^A(e,13)^A(e,22)}function a(e){return A(e,6)^A(e,11)^A(e,25)}function s(e){return A(e,7)^A(e,18)^e>>>3}const n=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];return function(g,r,o){let I=1779033703,c=3144134277,C=1013904242,B=2773480762,h=1359893119,Q=2600822924,l=528734635,E=1541459225;const u=64*Math.ceil((o+9)/64),d=new Uint8Array(u);let f,p;for(f=0;f>>29&255,d[f++]=o>>21&255,d[f++]=o>>13&255,d[f++]=o>>5&255,d[f++]=o<<3&255;const y=new Uint32Array(64);for(f=0;f>>10)+y[p-7]+s(y[p-15])+y[p-16];let g,r,o=I,u=c,m=C,D=B,b=h,k=Q,F=l,S=E;for(p=0;p<64;++p)g=S+a(b)+e(b,k,F)+n[p]+y[p],r=i(o)+t(o,u,m),S=F,F=k,k=b,b=D+g|0,D=m,m=u,u=o,o=g+r|0;I=I+o|0,c=c+u|0,C=C+m|0,B=B+D|0,h=h+b|0,Q=Q+k|0,l=l+F|0,E=E+S|0}var w;return new Uint8Array([I>>24&255,I>>16&255,I>>8&255,255&I,c>>24&255,c>>16&255,c>>8&255,255&c,C>>24&255,C>>16&255,C>>8&255,255&C,B>>24&255,B>>16&255,B>>8&255,255&B,h>>24&255,h>>16&255,h>>8&255,255&h,Q>>24&255,Q>>16&255,Q>>8&255,255&Q,l>>24&255,l>>16&255,l>>8&255,255&l,E>>24&255,E>>16&255,E>>8&255,255&E])}}(),Jr=function(){function A(A,e,t,i,a){A.assign(e),A.and(t),a.assign(e),a.not(),a.and(i),A.xor(a)}function e(A,e,t,i,a){A.assign(e),A.and(t),a.assign(e),a.and(i),A.xor(a),a.assign(t),a.and(i),A.xor(a)}function t(A,e,t){A.assign(e),A.rotateRight(28),t.assign(e),t.rotateRight(34),A.xor(t),t.assign(e),t.rotateRight(39),A.xor(t)}function i(A,e,t){A.assign(e),A.rotateRight(14),t.assign(e),t.rotateRight(18),A.xor(t),t.assign(e),t.rotateRight(41),A.xor(t)}function a(A,e,t){A.assign(e),A.rotateRight(1),t.assign(e),t.rotateRight(8),A.xor(t),t.assign(e),t.shiftRight(7),A.xor(t)}function s(A,e,t){A.assign(e),A.rotateRight(19),t.assign(e),t.rotateRight(61),A.xor(t),t.assign(e),t.shiftRight(6),A.xor(t)}const n=[new Mr(1116352408,3609767458),new Mr(1899447441,602891725),new Mr(3049323471,3964484399),new Mr(3921009573,2173295548),new Mr(961987163,4081628472),new Mr(1508970993,3053834265),new Mr(2453635748,2937671579),new Mr(2870763221,3664609560),new Mr(3624381080,2734883394),new Mr(310598401,1164996542),new Mr(607225278,1323610764),new Mr(1426881987,3590304994),new Mr(1925078388,4068182383),new Mr(2162078206,991336113),new Mr(2614888103,633803317),new Mr(3248222580,3479774868),new Mr(3835390401,2666613458),new Mr(4022224774,944711139),new Mr(264347078,2341262773),new Mr(604807628,2007800933),new Mr(770255983,1495990901),new Mr(1249150122,1856431235),new Mr(1555081692,3175218132),new Mr(1996064986,2198950837),new Mr(2554220882,3999719339),new Mr(2821834349,766784016),new Mr(2952996808,2566594879),new Mr(3210313671,3203337956),new Mr(3336571891,1034457026),new Mr(3584528711,2466948901),new Mr(113926993,3758326383),new Mr(338241895,168717936),new Mr(666307205,1188179964),new Mr(773529912,1546045734),new Mr(1294757372,1522805485),new Mr(1396182291,2643833823),new Mr(1695183700,2343527390),new Mr(1986661051,1014477480),new Mr(2177026350,1206759142),new Mr(2456956037,344077627),new Mr(2730485921,1290863460),new Mr(2820302411,3158454273),new Mr(3259730800,3505952657),new Mr(3345764771,106217008),new Mr(3516065817,3606008344),new Mr(3600352804,1432725776),new Mr(4094571909,1467031594),new Mr(275423344,851169720),new Mr(430227734,3100823752),new Mr(506948616,1363258195),new Mr(659060556,3750685593),new Mr(883997877,3785050280),new Mr(958139571,3318307427),new Mr(1322822218,3812723403),new Mr(1537002063,2003034995),new Mr(1747873779,3602036899),new Mr(1955562222,1575990012),new Mr(2024104815,1125592928),new Mr(2227730452,2716904306),new Mr(2361852424,442776044),new Mr(2428436474,593698344),new Mr(2756734187,3733110249),new Mr(3204031479,2999351573),new Mr(3329325298,3815920427),new Mr(3391569614,3928383900),new Mr(3515267271,566280711),new Mr(3940187606,3454069534),new Mr(4118630271,4000239992),new Mr(116418474,1914138554),new Mr(174292421,2731055270),new Mr(289380356,3203993006),new Mr(460393269,320620315),new Mr(685471733,587496836),new Mr(852142971,1086792851),new Mr(1017036298,365543100),new Mr(1126000580,2618297676),new Mr(1288033470,3409855158),new Mr(1501505948,4234509866),new Mr(1607167915,987167468),new Mr(1816402316,1246189591)];return function(g,r,o,I=!1){let c,C,B,h,Q,l,E,u;I?(c=new Mr(3418070365,3238371032),C=new Mr(1654270250,914150663),B=new Mr(2438529370,812702999),h=new Mr(355462360,4144912697),Q=new Mr(1731405415,4290775857),l=new Mr(2394180231,1750603025),E=new Mr(3675008525,1694076839),u=new Mr(1203062813,3204075428)):(c=new Mr(1779033703,4089235720),C=new Mr(3144134277,2227873595),B=new Mr(1013904242,4271175723),h=new Mr(2773480762,1595750129),Q=new Mr(1359893119,2917565137),l=new Mr(2600822924,725511199),E=new Mr(528734635,4215389547),u=new Mr(1541459225,327033209));const d=128*Math.ceil((o+17)/128),f=new Uint8Array(d);let p,m;for(p=0;p>>29&255,f[p++]=o>>21&255,f[p++]=o>>13&255,f[p++]=o>>5&255,f[p++]=o<<3&255;const w=new Array(80);for(p=0;p<80;p++)w[p]=new Mr(0,0);let D=new Mr(0,0),b=new Mr(0,0),k=new Mr(0,0),F=new Mr(0,0),S=new Mr(0,0),R=new Mr(0,0),G=new Mr(0,0),N=new Mr(0,0);const x=new Mr(0,0),U=new Mr(0,0),M=new Mr(0,0),L=new Mr(0,0);let J,H;for(p=0;p=1;--A){t=s[13],s[13]=s[9],s[9]=s[5],s[5]=s[1],s[1]=t,t=s[14],i=s[10],s[14]=s[6],s[10]=s[2],s[6]=t,s[2]=i,t=s[15],i=s[11],a=s[7],s[15]=s[3],s[11]=t,s[7]=i,s[3]=a;for(let A=0;A<16;++A)s[A]=this._inv_s[s[A]];for(let t=0,i=16*A;t<16;++t,++i)s[t]^=e[i];for(let A=0;A<16;A+=4){const e=this._mix[s[A]],i=this._mix[s[A+1]],a=this._mix[s[A+2]],n=this._mix[s[A+3]];t=e^i>>>8^i<<24^a>>>16^a<<16^n>>>24^n<<8,s[A]=t>>>24&255,s[A+1]=t>>16&255,s[A+2]=t>>8&255,s[A+3]=255&t}}t=s[13],s[13]=s[9],s[9]=s[5],s[5]=s[1],s[1]=t,t=s[14],i=s[10],s[14]=s[6],s[10]=s[2],s[6]=t,s[2]=i,t=s[15],i=s[11],a=s[7],s[15]=s[3],s[11]=t,s[7]=i,s[3]=a;for(let A=0;A<16;++A)s[A]=this._inv_s[s[A]],s[A]^=e[A];return s}_encrypt(A,e){const t=this._s;let i,a,s;const n=new Uint8Array(16);n.set(A);for(let A=0;A<16;++A)n[A]^=e[A];for(let A=1;A=i;--t)if(A[t]!==e){e=0;break}g-=e,s[s.length-1]=A.subarray(0,16-e)}}const r=new Uint8Array(g);for(let A=0,e=0,t=s.length;A=256&&(g=255&(27^g)));for(let e=0;e<4;++e)t[A]=i^=t[A-32],A++,t[A]=a^=t[A-32],A++,t[A]=s^=t[A-32],A++,t[A]=n^=t[A-32],A++}return t}}class qr{checkOwnerPassword(A,e,t,i){const a=new Uint8Array(A.length+56);return a.set(A,0),a.set(e,A.length),a.set(t,A.length+e.length),eA(Lr(a,0,a.length),i)}checkUserPassword(A,e,t){const i=new Uint8Array(A.length+8);return i.set(A,0),i.set(e,A.length),eA(Lr(i,0,i.length),t)}getOwnerKey(A,e,t,i){const a=new Uint8Array(A.length+56);a.set(A,0),a.set(e,A.length),a.set(t,A.length+e.length);const s=Lr(a,0,a.length);return new Kr(s).decryptBlock(i,!1,new Uint8Array(16))}getUserKey(A,e,t){const i=new Uint8Array(A.length+8);i.set(A,0),i.set(e,A.length);const a=Lr(i,0,i.length);return new Kr(a).decryptBlock(t,!1,new Uint8Array(16))}}class Tr{_hash(A,e,t){let i=Lr(e,0,e.length).subarray(0,32),a=[0],s=0;for(;s<64||a.at(-1)>s-32;){const e=A.length+i.length+t.length,r=new Uint8Array(e);let o=0;r.set(A,o),o+=A.length,r.set(i,o),o+=i.length,r.set(t,o);const I=new Uint8Array(64*e);for(let A=0,t=0;A<64;A++,t+=e)I.set(r,t);a=new vr(i.subarray(0,16)).encrypt(I,i.subarray(16,32));const c=a.slice(0,16).reduce(((A,e)=>A+e),0)%3;0===c?i=Lr(a,0,a.length):1===c?(n=a,g=a.length,i=Jr(n,0,g,!0)):2===c&&(i=Jr(a,0,a.length)),s++}var n,g;return i.subarray(0,32)}checkOwnerPassword(A,e,t,i){const a=new Uint8Array(A.length+56);return a.set(A,0),a.set(e,A.length),a.set(t,A.length+e.length),eA(this._hash(A,a,t),i)}checkUserPassword(A,e,t){const i=new Uint8Array(A.length+8);return i.set(A,0),i.set(e,A.length),eA(this._hash(A,i,[]),t)}getOwnerKey(A,e,t,i){const a=new Uint8Array(A.length+56);a.set(A,0),a.set(e,A.length),a.set(t,A.length+e.length);const s=this._hash(A,a,t);return new Kr(s).decryptBlock(i,!1,new Uint8Array(16))}getUserKey(A,e,t){const i=new Uint8Array(A.length+8);i.set(A,0),i.set(e,A.length);const a=this._hash(A,i,[]);return new Kr(a).decryptBlock(t,!1,new Uint8Array(16))}}class Pr{constructor(A,e){this.StringCipherConstructor=A,this.StreamCipherConstructor=e}createStream(A,e){const t=new this.StreamCipherConstructor;return new Nr(A,e,(function(A,e){return t.decryptBlock(A,e)}))}decryptString(A){const e=new this.StringCipherConstructor;let t=W(A);return t=e.decryptBlock(t,!0),P(t)}encryptString(A){const e=new this.StringCipherConstructor;if(e instanceof Yr){const t=16-A.length%16;A+=String.fromCharCode(t).repeat(t);const i=new Uint8Array(16);if("undefined"!=typeof crypto)crypto.getRandomValues(i);else for(let A=0;A<16;A++)i[A]=Math.floor(256*Math.random());let a=W(A);a=e.encrypt(a,i);const s=new Uint8Array(16+a.length);return s.set(i),s.set(a,16),P(s)}let t=W(A);return t=e.encrypt(t),P(t)}}class Wr{static#S=new Uint8Array([40,191,78,94,78,117,138,65,100,0,78,86,255,250,1,8,46,46,0,182,208,104,62,128,47,12,169,254,100,83,105,122]);#R(A,e,t,i,a,s,n,g,r,o,I,c){if(e){const A=Math.min(127,e.length);e=e.subarray(0,A)}else e=[];const C=6===A?new Tr:new qr;return C.checkUserPassword(e,g,n)?C.getUserKey(e,r,I):e.length&&C.checkOwnerPassword(e,i,s,t)?C.getOwnerKey(e,a,s,o):null}#G(A,e,t,i,a,s,n,g){const r=40+t.length+A.length,o=new Uint8Array(r);let I,c,C=0;if(e)for(c=Math.min(32,e.length);C>8&255,o[C++]=a>>16&255,o[C++]=a>>>24&255,I=0,c=A.length;I=4&&!g&&(o[C++]=255,o[C++]=255,o[C++]=255,o[C++]=255);let B=Ur(o,0,C);const h=n>>3;if(s>=3)for(I=0;I<50;++I)B=Ur(B,0,h);const Q=B.subarray(0,h);let l,E;if(s>=3){for(C=0;C<32;++C)o[C]=Wr.#S[C];for(I=0,c=A.length;I>3;if(t>=3)for(g=0;g<50;++g)r=Ur(r,0,r.length);let I,c;if(t>=3){c=e;const A=new Uint8Array(o);for(g=19;g>=0;g--){for(let e=0;e>8&255,a[n++]=A>>16&255,a[n++]=255&e,a[n++]=e>>8&255,i&&(a[n++]=115,a[n++]=65,a[n++]=108,a[n++]=84),Ur(a,0,n).subarray(0,Math.min(t.length+5,16))}#U(A,e,t,i,a){if(!(e instanceof IA))throw new q("Invalid crypt filter name.");const s=this,n=A.get(e.name),g=n?.get("CFM");if(!g||"None"===g.name)return function(){return new Hr};if("V2"===g.name)return function(){return new xr(s.#x(t,i,a,!1))};if("AESV2"===g.name)return function(){return new vr(s.#x(t,i,a,!0))};if("AESV3"===g.name)return function(){return new Kr(a)};throw new q("Unknown crypto method")}constructor(A,e,t){const i=A.get("Filter");if(!EA(i,"Standard"))throw new q("unknown encryption method");this.filterName=i.name,this.dict=A;const a=A.get("V");if(!Number.isInteger(a)||1!==a&&2!==a&&4!==a&&5!==a)throw new q("unsupported encryption algorithm");this.algorithm=a;let s=A.get("Length");if(!s)if(a<=3)s=40;else{const e=A.get("CF"),t=A.get("StmF");if(e instanceof BA&&t instanceof IA){e.suppressEncryption=!0;const A=e.get(t.name);s=A?.get("Length")||128,s<40&&(s<<=3)}}if(!Number.isInteger(s)||s<40||s%8!=0)throw new q("invalid key length");const n=W(A.get("O")),g=W(A.get("U")),r=n.subarray(0,32),o=g.subarray(0,32),I=A.get("P"),c=A.get("R"),C=(4===a||5===a)&&!1!==A.get("EncryptMetadata");this.encryptMetadata=C;const B=W(e);let h,Q;if(t){if(6===c)try{t=AA(t)}catch{G("CipherTransformFactory: Unable to convert UTF8 encoded password.")}h=W(t)}if(5!==a)Q=this.#G(B,h,r,o,I,c,s,C);else{const e=n.subarray(32,40),t=n.subarray(40,48),i=g.subarray(0,48),a=g.subarray(32,40),s=g.subarray(40,48),I=W(A.get("OE")),C=W(A.get("UE")),B=W(A.get("Perms"));Q=this.#R(c,h,r,e,t,i,o,a,s,I,C,B)}if(!Q&&!t)throw new J("No password given",1);if(!Q&&t){const A=this.#N(h,r,c,s);Q=this.#G(B,A,r,o,I,c,s,C)}if(!Q)throw new J("Incorrect Password",2);if(this.encryptionKey=Q,a>=4){const e=A.get("CF");e instanceof BA&&(e.suppressEncryption=!0),this.cf=e,this.stmf=A.get("StmF")||IA.get("Identity"),this.strf=A.get("StrF")||IA.get("Identity"),this.eff=A.get("EFF")||this.stmf}}createCipherTransform(A,e){if(4===this.algorithm||5===this.algorithm)return new Pr(this.#U(this.cf,this.strf,A,e,this.encryptionKey),this.#U(this.cf,this.stmf,A,e,this.encryptionKey));const t=this.#x(A,e,this.encryptionKey,!1),i=function(){return new xr(t)};return new Pr(i,i)}}async function Zr(A,e,t,{encrypt:i=null}){const a=i?.createCipherTransform(A.num,A.gen);t.push(`${A.num} ${A.gen} obj\n`),e instanceof BA?await Or(e,t,a):e instanceof pA?await Xr(e,t,a):(Array.isArray(e)||ArrayBuffer.isView(e))&&await Vr(e,t,a),t.push("\nendobj\n")}async function Or(A,e,t){e.push("<<");for(const i of A.getKeys())e.push(` /${qA(i)} `),await jr(A.getRaw(i),e,t);e.push(">>")}async function Xr(A,e,t){let i=A.getBytes();const{dict:a}=A,[s,n]=await Promise.all([a.getAsync("Filter"),a.getAsync("DecodeParms")]),g=EA(Array.isArray(s)?await a.xref.fetchIfRefAsync(s[0]):s,"FlateDecode");if(i.length>=256||g)try{const A=new CompressionStream("deflate"),e=A.writable.getWriter();e.write(i),e.close();const t=await new Response(A.readable).arrayBuffer();let r,o;i=new Uint8Array(t),s?g||(r=Array.isArray(s)?[IA.get("FlateDecode"),...s]:[IA.get("FlateDecode"),s],n&&(o=Array.isArray(n)?[null,...n]:[null,n])):r=IA.get("FlateDecode"),r&&a.set("Filter",r),o&&a.set("DecodeParms",o)}catch(A){R(`writeStream - cannot compress data: "${A}".`)}let r=P(i);t&&(r=t.encryptString(r)),a.set("Length",r.length),await Or(a,e,t),e.push(" stream\n",r,"\nendstream")}async function Vr(A,e,t){e.push("[");let i=!0;for(const a of A)i?i=!1:e.push(" "),await jr(a,e,t);e.push("]")}async function jr(A,e,t){A instanceof IA?e.push(`/${qA(A.name)}`):A instanceof hA?e.push(`${A.num} ${A.gen} R`):Array.isArray(A)||ArrayBuffer.isView(A)?await Vr(A,e,t):"string"==typeof A?(t&&(A=t.encryptString(A)),e.push(`(${TA(A)})`)):"number"==typeof A?e.push(_A(A)):"boolean"==typeof A?e.push(A.toString()):A instanceof BA?await Or(A,e,t):A instanceof pA?await Xr(A,e,t):null===A?e.push("null"):G(`Unhandled value in writer: ${typeof A}, please file a bug.`)}function zr(A,e,t,i){for(let a=e+t-1;a>t-1;a--)i[a]=255&A,A>>=8;return t+e}function _r(A,e,t){for(let i=0,a=A.length;i0){const i=function(A,e){const t=Math.floor(Date.now()/1e3),i=e.filename||"",a=[t.toString(),i,A.toString()];let s=a.reduce(((A,e)=>A+e.length),0);for(const A of Object.values(e.info))a.push(A),s+=A.length;const n=new Uint8Array(s);let g=0;for(const A of a)_r(A,g,n),g+=A.length;return P(Ur(n))}(A,e);t.set("ID",[e.fileIds[0],i])}}async function eo({originalData:A,xrefInfo:e,newRefs:t,xref:i=null,hasXfa:a=!1,xfaDatasetsRef:s=null,hasXfaDatasetsEntry:n=!1,needAppearances:g,acroFormRef:r=null,acroForm:o=null,xfaData:I=null,useXrefStream:c=!1}){await async function({xref:A,acroForm:e,acroFormRef:t,hasXfa:i,hasXfaDatasetsEntry:a,xfaDatasetsRef:s,needAppearances:n,newRefs:g}){if(!i||a||s||G("XFA - Cannot save it"),!n&&(!i||!s||a))return;const r=e.clone();if(i&&!a){const A=e.get("XFA").slice();A.splice(2,0,"datasets"),A.splice(3,0,s),r.set("XFA",A)}n&&r.set("NeedAppearances",!0);const o=[];await Zr(t,r,o,A),g.push({ref:t,data:o.join("")})}({xref:i,acroForm:o,acroFormRef:r,hasXfa:a,hasXfaDatasetsEntry:n,xfaDatasetsRef:s,needAppearances:g,newRefs:t}),a&&function({xfaData:A,xfaDatasetsRef:e,newRefs:t,xref:i}){null===A&&(A=function(A,e){const t=new Rr({hasAttributes:!0}).parseFromString(A);for(const{xfa:A}of e){if(!A)continue;const{path:e,value:i}=A;if(!e)continue;const a=KA(e);let s=t.documentElement.searchNode(a,0);!s&&a.length>1&&(s=t.documentElement.searchNode([a.at(-1)],0)),s?s.childNodes=Array.isArray(i)?i.map((A=>new Sr("value",A))):[new Sr("#text",i)]:G(`Node not found for path: ${e}`)}const i=[];return t.documentElement.dump(i),i.join("")}(i.fetchIfRef(e).getString(),t));const a=i.encrypt;a&&(A=a.createCipherTransform(e.num,e.gen).encryptString(A));const s=`${e.num} ${e.gen} obj\n<< /Type /EmbeddedFile /Length ${A.length}>>\nstream\n`+A+"\nendstream\nendobj\n";t.push({ref:e,data:s})}({xfaData:I,xfaDatasetsRef:s,newRefs:t,xref:i});const C=[];let B=A.length;const h=A.at(-1);10!==h&&13!==h&&(C.push("\n"),B+=1);const Q=function(A,e,t){const i=new BA(null);i.set("Prev",A.startXRef);const a=A.newRef;return t?(e.push({ref:a,data:""}),i.set("Size",a.num+1),i.set("Type",IA.get("XRef"))):i.set("Size",a.num),null!==A.rootRef&&i.set("Root",A.rootRef),null!==A.infoRef&&i.set("Info",A.infoRef),null!==A.encryptRef&&i.set("Encrypt",A.encryptRef),i}(e,t,c);t=t.sort(((A,e)=>A.ref.num-e.ref.num));for(const{data:A}of t)null!==A&&C.push(A);await(c?async function(A,e,t,i,a){const s=[];let n=0,g=0;for(const{ref:A,data:i}of t){let t;n=Math.max(n,e),null!==i?(t=Math.min(A.gen,65535),s.push([1,e,t]),e+=i.length):(t=Math.min(A.gen+1,65535),s.push([0,0,t])),g=Math.max(g,t)}i.set("Index",$r(t));const r=[1,ae(n),ae(g)];i.set("W",r),Ao(e,A,i);const o=r.reduce(((A,e)=>A+e),0),I=new Uint8Array(o*s.length),c=new se(I);c.dict=i;let C=0;for(const[A,e,t]of s)C=zr(A,r[0],C,I),C=zr(e,r[1],C,I),C=zr(t,r[2],C,I);await Zr(A.newRef,c,a,{}),a.push("startxref\n",e.toString(),"\n%%EOF\n")}(e,B,t,Q,C):async function(A,e,t,i,a){a.push("xref\n");const s=$r(t);let n=0;for(const{ref:A,data:i}of t)A.num===s[n]&&(a.push(`${s[n]} ${s[n+1]}\n`),n+=2),null!==i?(a.push(`${e.toString().padStart(10,"0")} ${Math.min(A.gen,65535).toString().padStart(5,"0")} n\r\n`),e+=i.length):a.push(`0000000000 ${Math.min(A.gen+1,65535).toString().padStart(5,"0")} f\r\n`);Ao(e,A,i),a.push("trailer\n"),await Or(i,a),a.push("\nstartxref\n",e.toString(),"\n%%EOF\n")}(e,B,t,Q,C));const l=C.reduce(((A,e)=>A+e.length),A.length),E=new Uint8Array(l);E.set(A);let u=A.length;for(const A of C)_r(A,u,E),u+=A.length;return E}class to{constructor(A,e){this.dict=A,this.ref=e instanceof hA?e:null,this.roleMap=new Map,this.structParentIds=null}init(){this.readRoleMap()}#M(A,e,t){if(!(A instanceof hA)||e<0)return;this.structParentIds||=new lA;let i=this.structParentIds.get(A);i||(i=[],this.structParentIds.put(A,i)),i.push([e,t])}addAnnotationIdToPage(A,e){this.#M(A,e,4)}readRoleMap(){const A=this.dict.get("RoleMap");A instanceof BA&&A.forEach(((A,e)=>{e instanceof IA&&this.roleMap.set(A,e.name)}))}static async canCreateStructureTree({catalogRef:A,pdfManager:e,newAnnotationsByPage:t}){if(!(A instanceof hA))return G("Cannot save the struct tree: no catalog reference."),!1;let i=0,a=!0;for(const[A,s]of t){const{ref:t}=await e.getPage(A);if(!(t instanceof hA)){G(`Cannot save the struct tree: page ${A} has no ref.`),a=!0;break}for(const A of s)A.accessibilityData?.type&&(A.parentTreeId=i++,a=!1)}if(a){for(const A of t.values())for(const e of A)delete e.parentTreeId;return!1}return!0}static async createStructureTree({newAnnotationsByPage:A,xref:e,catalogRef:t,pdfManager:i,newRefs:a}){const s=i.catalog.cloneDict(),n=new lA;n.put(t,s);const g=e.getNewTemporaryRef();s.set("StructTreeRoot",g);const r=new BA(e);r.set("Type",IA.get("StructTreeRoot"));const o=e.getNewTemporaryRef();r.set("ParentTree",o);const I=[];r.set("K",I),n.put(g,r);const c=new BA(e),C=[];c.set("Nums",C);const B=await this.#L({newAnnotationsByPage:A,structTreeRootRef:g,kids:I,nums:C,xref:e,pdfManager:i,cache:n});r.set("ParentTreeNextKey",B),n.put(o,c);const h=[];for(const[A,t]of n.items())h.length=0,await Zr(A,t,h,e),a.push({ref:A,data:h.join("")})}async canUpdateStructTree({pdfManager:A,xref:e,newAnnotationsByPage:t}){if(!this.ref)return G("Cannot update the struct tree: no root reference."),!1;let i=this.dict.get("ParentTreeNextKey");if(!Number.isInteger(i)||i<0)return G("Cannot update the struct tree: invalid next key."),!1;const a=this.dict.get("ParentTree");if(!(a instanceof BA))return G("Cannot update the struct tree: ParentTree isn't a dict."),!1;const s=a.get("Nums");if(!Array.isArray(s))return G("Cannot update the struct tree: nums isn't an array."),!1;const n=new yr(a,e);for(const e of t.keys()){const{pageDict:t}=await A.getPage(e);if(!t.has("StructParents"))continue;const i=t.get("StructParents");if(!Number.isInteger(i)||!Array.isArray(n.get(i)))return G(`Cannot save the struct tree: page ${e} has a wrong id.`),!1}let g=!0;for(const[e,a]of t){const{pageDict:t}=await A.getPage(e);to.#J({elements:a,xref:this.dict.xref,pageDict:t,numberTree:n});for(const A of a)A.accessibilityData?.type&&(A.parentTreeId=i++,g=!1)}if(g){for(const A of t.values())for(const e of A)delete e.parentTreeId,delete e.structTreeParent;return!1}return!0}async updateStructureTree({newAnnotationsByPage:A,pdfManager:e,newRefs:t}){const i=this.dict.xref,a=this.dict.clone(),s=this.ref,n=new lA;n.put(s,a);let g,r=a.getRaw("ParentTree");r instanceof hA?g=i.fetch(r):(g=r,r=i.getNewTemporaryRef(),a.set("ParentTree",r)),g=g.clone(),n.put(r,g);let o=g.getRaw("Nums"),I=null;o instanceof hA&&(I=o,o=i.fetch(I)),o=o.slice(),I||g.set("Nums",o);const c=await to.#L({newAnnotationsByPage:A,structTreeRootRef:s,kids:null,nums:o,xref:i,pdfManager:e,cache:n});a.set("ParentTreeNextKey",c),I&&n.put(I,o);const C=[];for(const[A,e]of n.items())C.length=0,await Zr(A,e,C,i),t.push({ref:A,data:C.join("")})}static async#L({newAnnotationsByPage:A,structTreeRootRef:e,kids:t,nums:i,xref:a,pdfManager:s,cache:n}){const g=IA.get("OBJR");let r=-1/0;for(const[o,I]of A){const{ref:A}=await s.getPage(o),c=A instanceof hA;for(const{accessibilityData:s,ref:o,parentTreeId:C,structTreeParent:B}of I){if(!s?.type)continue;const{type:I,title:h,lang:Q,alt:l,expanded:E,actualText:u}=s;r=Math.max(r,C);const d=a.getNewTemporaryRef(),f=new BA(a);f.set("S",IA.get(I)),h&&f.set("T",Ae(h)),Q&&f.set("Lang",Q),l&&f.set("Alt",Ae(l)),E&&f.set("E",Ae(E)),u&&f.set("ActualText",Ae(u)),await this.#H({structTreeParent:B,tagDict:f,newTagRef:d,structTreeRootRef:e,fallbackKids:t,xref:a,cache:n});const p=new BA(a);f.set("K",p),p.set("Type",g),c&&p.set("Pg",A),p.set("Obj",o),n.put(d,f),i.push(C,d)}}return r+1}static#J({elements:A,xref:e,pageDict:t,numberTree:i}){const a=new Map;for(const e of A)if(e.structTreeParentId){const A=parseInt(e.structTreeParentId.split("_mc")[1],10);let t=a.get(A);t||(t=[],a.set(A,t)),t.push(e)}const s=t.get("StructParents");if(!Number.isInteger(s))return;const n=i.get(s),g=(A,t,i)=>{const s=a.get(A);if(s){const A=t.getRaw("P"),a=e.fetchIfRef(A);if(A instanceof hA&&a instanceof BA){const A={ref:i,dict:t};for(const e of s)e.structTreeParent=A}return!0}return!1};for(const A of n){if(!(A instanceof hA))continue;const t=e.fetch(A),i=t.get("K");if(Number.isInteger(i))g(i,t,A);else if(Array.isArray(i))for(let a of i){if(a=e.fetchIfRef(a),Number.isInteger(a)&&g(a,t,A))break;if(!(a instanceof BA))continue;if(!EA(a.get("Type"),"MCR"))break;const i=a.get("MCID");if(Number.isInteger(i)&&g(i,t,A))break}}}static async#H({structTreeParent:A,tagDict:e,newTagRef:t,structTreeRootRef:i,fallbackKids:a,xref:s,cache:n}){let g,r=null;A?(({ref:r}=A),g=A.dict.getRaw("P")||i):g=i,e.set("P",g);const o=s.fetchIfRef(g);if(!o)return void a.push(t);let I=n.get(g);I||(I=o.clone(),n.put(g,I));const c=I.getRaw("K");let C=c instanceof hA?n.get(c):null;if(!C){C=s.fetchIfRef(c),C=Array.isArray(C)?C.slice():[c];const A=s.getNewTemporaryRef();I.set("K",A),n.put(A,C)}const B=C.indexOf(r);C.splice(B>=0?B+1:C.length,0,t)}}class io{constructor(A,e){this.tree=A,this.dict=e,this.kids=[],this.parseKids()}get role(){const A=this.dict.get("S"),e=A instanceof IA?A.name:"",{root:t}=this.tree;return t.roleMap.has(e)?t.roleMap.get(e):e}parseKids(){let A=null;const e=this.dict.getRaw("Pg");e instanceof hA&&(A=e.toString());const t=this.dict.get("K");if(Array.isArray(t))for(const e of t){const t=this.parseKid(A,e);t&&this.kids.push(t)}else{const e=this.parseKid(A,t);e&&this.kids.push(e)}}parseKid(A,e){if(Number.isInteger(e))return this.tree.pageDict.objId!==A?null:new ao({type:1,mcid:e,pageObjId:A});let t=null;if(e instanceof hA?t=this.dict.xref.fetch(e):e instanceof BA&&(t=e),!t)return null;const i=t.getRaw("Pg");i instanceof hA&&(A=i.toString());const a=t.get("Type")instanceof IA?t.get("Type").name:null;if("MCR"===a){if(this.tree.pageDict.objId!==A)return null;const e=t.getRaw("Stm");return new ao({type:2,refObjId:e instanceof hA?e.toString():null,pageObjId:A,mcid:t.get("MCID")})}if("OBJR"===a){if(this.tree.pageDict.objId!==A)return null;const e=t.getRaw("Obj");return new ao({type:3,refObjId:e instanceof hA?e.toString():null,pageObjId:A})}return new ao({type:5,dict:t})}}class ao{constructor({type:A,dict:e=null,mcid:t=null,pageObjId:i=null,refObjId:a=null}){this.type=A,this.dict=e,this.mcid=t,this.pageObjId=i,this.refObjId=a,this.parentNode=null}}class so{constructor(A,e){this.root=A,this.rootDict=A?A.dict:null,this.pageDict=e,this.nodes=[]}parse(A){if(!this.root||!this.rootDict)return;const e=this.rootDict.get("ParentTree");if(!e)return;const t=this.pageDict.get("StructParents"),i=A instanceof hA&&this.root.structParentIds?.get(A);if(!Number.isInteger(t)&&!i)return;const a=new Map,s=new yr(e,this.rootDict.xref);if(Number.isInteger(t)){const A=s.get(t);if(Array.isArray(A))for(const e of A)e instanceof hA&&this.addNode(this.rootDict.xref.fetch(e),a)}if(i)for(const[A,e]of i){const t=s.get(A);if(t){const A=this.addNode(this.rootDict.xref.fetchIfRef(t),a);1===A?.kids?.length&&3===A.kids[0].type&&(A.kids[0].type=e)}}}addNode(A,e,t=0){if(t>40)return G("StructTree MAX_DEPTH reached."),null;if(!(A instanceof BA))return null;if(e.has(A))return e.get(A);const i=new io(this,A);e.set(A,i);const a=A.get("P");if(!a||EA(a.get("Type"),"StructTreeRoot"))return this.addTopLevelNode(A,i)||e.delete(A),i;const s=this.addNode(a,e,t+1);if(!s)return i;let n=!1;for(const e of s.kids)5===e.type&&e.dict===A&&(e.parentNode=i,n=!0);return n||e.delete(A),i}addTopLevelNode(A,e){const t=this.rootDict.get("K");if(!t)return!1;if(t instanceof BA)return t.objId===A.objId&&(this.nodes[0]=e,!0);if(!Array.isArray(t))return!0;let i=!1;for(let a=0;a40)return void G("StructTree too deep to be fully serialized.");const a=Object.create(null);a.role=e.role,a.children=[],t.children.push(a);const s=e.dict.get("Alt");"string"==typeof s&&(a.alt=_(s));const n=e.dict.get("Lang");"string"==typeof n&&(a.lang=_(n));for(const t of e.kids){const e=5===t.type?t.parentNode:null;e?A(e,a,i+1):1===t.type||2===t.type?a.children.push({type:"content",id:`p${t.pageObjId}_mc${t.mcid}`}):3===t.type?a.children.push({type:"object",id:t.refObjId}):4===t.type&&a.children.push({type:"annotation",id:`pdfjs_internal_id_${t.refObjId}`})}}const e=Object.create(null);e.children=[],e.role="Root";for(const t of this.nodes)t&&A(t,e);return e}}function no(A){if(!Array.isArray(A)||A.length<2)return!1;const[e,t,...i]=A;if(!(e instanceof hA||Number.isInteger(e)))return!1;if(!(t instanceof IA))return!1;const a=i.length;let s=!0;switch(t.name){case"XYZ":if(a<2||a>3)return!1;break;case"Fit":case"FitB":return 0===a;case"FitH":case"FitBH":case"FitV":case"FitBV":if(a>1)return!1;break;case"FitR":if(4!==a)return!1;s=!1;break;default:return!1}for(const A of i)if(!("number"==typeof A||s&&null===A))return!1;return!0}function go(A){return A instanceof BA&&(A=A.get("D")),no(A)?A:null}function ro(A){let e=A.get("D");if(e){if(e instanceof IA&&(e=e.name),"string"==typeof e)return _(e);if(no(e))return JSON.stringify(e)}return null}class oo{constructor(A,e){if(this.pdfManager=A,this.xref=e,this._catDict=e.getCatalogObj(),!(this._catDict instanceof BA))throw new q("Catalog object is not a dictionary.");this.toplevelPagesDict,this._actualNumPages=null,this.fontCache=new lA,this.builtInCMapCache=new Map,this.standardFontDataCache=new Map,this.globalImageCache=new ng,this.pageKidsCountCache=new lA,this.pageIndexCache=new lA,this.pageDictCache=new lA,this.nonBlendModesSet=new QA,this.systemFontCache=new Map}cloneDict(){return this._catDict.clone()}get version(){const A=this._catDict.get("Version");if(A instanceof IA){if(mA.test(A.name))return M(this,"version",A.name);G(`Invalid PDF catalog version: ${A.name}`)}return M(this,"version",null)}get lang(){const A=this._catDict.get("Lang");return M(this,"lang",A&&"string"==typeof A?_(A):null)}get needsRendering(){const A=this._catDict.get("NeedsRendering");return M(this,"needsRendering","boolean"==typeof A&&A)}get collection(){let A=null;try{const e=this._catDict.get("Collection");e instanceof BA&&e.size>0&&(A=e)}catch(A){if(A instanceof wA)throw A;R("Cannot fetch Collection entry; assuming no collection is present.")}return M(this,"collection",A)}get acroForm(){let A=null;try{const e=this._catDict.get("AcroForm");e instanceof BA&&e.size>0&&(A=e)}catch(A){if(A instanceof wA)throw A;R("Cannot fetch AcroForm entry; assuming no forms are present.")}return M(this,"acroForm",A)}get acroFormRef(){const A=this._catDict.getRaw("AcroForm");return M(this,"acroFormRef",A instanceof hA?A:null)}get metadata(){const A=this._catDict.getRaw("Metadata");if(!(A instanceof hA))return M(this,"metadata",null);let e=null;try{const t=this.xref.fetch(A,!this.xref.encrypt?.encryptMetadata);if(t instanceof pA&&t.dict instanceof BA){const A=t.dict.get("Type"),i=t.dict.get("Subtype");if(EA(A,"Metadata")&&EA(i,"XML")){const A=$(t.getString());A&&(e=new Gr(A).serializable)}}}catch(A){if(A instanceof wA)throw A;R(`Skipping invalid Metadata: "${A}".`)}return M(this,"metadata",e)}get markInfo(){let A=null;try{A=this._readMarkInfo()}catch(A){if(A instanceof wA)throw A;G("Unable to read mark info.")}return M(this,"markInfo",A)}_readMarkInfo(){const A=this._catDict.get("MarkInfo");if(!(A instanceof BA))return null;const e={Marked:!1,UserProperties:!1,Suspects:!1};for(const t in e){const i=A.get(t);"boolean"==typeof i&&(e[t]=i)}return e}get structTreeRoot(){let A=null;try{A=this._readStructTreeRoot()}catch(A){if(A instanceof wA)throw A;G("Unable read to structTreeRoot info.")}return M(this,"structTreeRoot",A)}_readStructTreeRoot(){const A=this._catDict.getRaw("StructTreeRoot"),e=this.xref.fetchIfRef(A);if(!(e instanceof BA))return null;const t=new to(e,A);return t.init(),t}get toplevelPagesDict(){const A=this._catDict.get("Pages");if(!(A instanceof BA))throw new q("Invalid top-level pages dictionary.");return M(this,"toplevelPagesDict",A)}get documentOutline(){let A=null;try{A=this._readDocumentOutline()}catch(A){if(A instanceof wA)throw A;G("Unable to read document outline.")}return M(this,"documentOutline",A)}_readDocumentOutline(){let A=this._catDict.get("Outlines");if(!(A instanceof BA))return null;if(A=A.getRaw("First"),!(A instanceof hA))return null;const e={items:[]},t=[{obj:A,parent:e}],i=new QA;i.put(A);const a=this.xref,s=new Uint8ClampedArray(3);for(;t.length>0;){const e=t.shift(),n=a.fetchIfRef(e.obj);if(null===n)continue;n.has("Title")||G("Invalid outline item encountered.");const g={url:null,dest:null,action:null};oo.parseDestDictionary({destDict:n,resultObj:g,docBaseUrl:this.baseUrl,docAttachments:this.attachments});const r=n.get("Title"),o=n.get("F")||0,I=n.getArray("C"),c=n.get("Count");let C=s;!JA(I,3)||0===I[0]&&0===I[1]&&0===I[2]||(C=Ie.singletons.rgb.getRgb(I,0));const B={action:g.action,attachment:g.attachment,dest:g.dest,url:g.url,unsafeUrl:g.unsafeUrl,newWindow:g.newWindow,setOCGState:g.setOCGState,title:"string"==typeof r?_(r):"",color:C,count:Number.isInteger(c)?c:void 0,bold:!!(2&o),italic:!!(1&o),items:[]};e.parent.items.push(B),A=n.getRaw("First"),A instanceof hA&&!i.has(A)&&(t.push({obj:A,parent:B}),i.put(A)),A=n.getRaw("Next"),A instanceof hA&&!i.has(A)&&(t.push({obj:A,parent:e.parent}),i.put(A))}return e.items.length>0?e.items:null}get permissions(){let A=null;try{A=this._readPermissions()}catch(A){if(A instanceof wA)throw A;G("Unable to read permissions.")}return M(this,"permissions",A)}_readPermissions(){const A=this.xref.trailer.get("Encrypt");if(!(A instanceof BA))return null;let e=A.get("P");if("number"!=typeof e)return null;e+=2**32;const t=[];for(const A in r){const i=r[A];e&i&&t.push(i)}return t}get optionalContentConfig(){let A=null;try{const e=this._catDict.get("OCProperties");if(!e)return M(this,"optionalContentConfig",null);const t=e.get("D");if(!t)return M(this,"optionalContentConfig",null);const i=e.get("OCGs");if(!Array.isArray(i))return M(this,"optionalContentConfig",null);const a=[],s=new QA;for(const A of i)A instanceof hA&&!s.has(A)&&(s.put(A),a.push(this.#Y(A)));A=this.#v(t,s),A.groups=a}catch(A){if(A instanceof wA)throw A;G(`Unable to read optional content config: ${A}`)}return M(this,"optionalContentConfig",A)}#Y(A){const e=this.xref.fetch(A),t={id:A.toString(),name:null,intent:null,usage:{print:null,view:null}},i=e.get("Name");"string"==typeof i&&(t.name=_(i));let a=e.getArray("Intent");Array.isArray(a)||(a=[a]),a.every((A=>A instanceof IA))&&(t.intent=a.map((A=>A.name)));const s=e.get("Usage");if(!(s instanceof BA))return t;const n=t.usage,g=s.get("Print");if(g instanceof BA){const A=g.get("PrintState");if(A instanceof IA)switch(A.name){case"ON":case"OFF":n.print={printState:A.name}}}const r=s.get("View");if(r instanceof BA){const A=r.get("ViewState");if(A instanceof IA)switch(A.name){case"ON":case"OFF":n.view={viewState:A.name}}}return t}#v(A,e){function t(A){const t=[];if(Array.isArray(A))for(const i of A)i instanceof hA&&e.has(i)&&t.push(i.toString());return t}function i(A,t=0){if(!Array.isArray(A))return null;const i=[];for(const s of A){if(s instanceof hA&&e.has(s)){n.put(s),i.push(s.toString());continue}const A=a(s,t);A&&i.push(A)}if(t>0)return i;const s=[];for(const A of e)n.has(A)||s.push(A.toString());return s.length&&i.push({name:null,order:s}),i}function a(A,e){if(++e>g)return G("parseNestedOrder - reached MAX_NESTED_LEVELS."),null;const t=s.fetchIfRef(A);if(!Array.isArray(t))return null;const a=s.fetchIfRef(t[0]);if("string"!=typeof a)return null;const n=i(t.slice(1),e);return n&&n.length?{name:_(a),order:n}:null}const s=this.xref,n=new QA,g=10;return{name:"string"==typeof A.get("Name")?_(A.get("Name")):null,creator:"string"==typeof A.get("Creator")?_(A.get("Creator")):null,baseState:A.get("BaseState")instanceof IA?A.get("BaseState").name:null,on:t(A.get("ON")),off:t(A.get("OFF")),order:i(A.get("Order")),groups:null}}setActualNumPages(A=null){this._actualNumPages=A}get hasActualNumPages(){return null!==this._actualNumPages}get _pagesCount(){const A=this.toplevelPagesDict.get("Count");if(!Number.isInteger(A))throw new q("Page count in top-level pages dictionary is not an integer.");return M(this,"_pagesCount",A)}get numPages(){return this.hasActualNumPages?this._actualNumPages:this._pagesCount}get destinations(){const A=this._readDests(),e=Object.create(null);if(A instanceof mr)for(const[t,i]of A.getAll()){const A=go(i);A&&(e[_(t)]=A)}else A instanceof BA&&A.forEach((function(A,t){const i=go(t);i&&(e[A]=i)}));return M(this,"destinations",e)}getDestination(A){const e=this._readDests();if(e instanceof mr){const t=go(e.get(A));if(t)return t;const i=this.destinations[A];if(i)return G(`Found "${A}" at an incorrect position in the NameTree.`),i}else if(e instanceof BA){const t=go(e.get(A));if(t)return t}return null}_readDests(){const A=this._catDict.get("Names");return A?.has("Dests")?new mr(A.getRaw("Dests"),this.xref):this._catDict.has("Dests")?this._catDict.get("Dests"):void 0}get pageLabels(){let A=null;try{A=this._readPageLabels()}catch(A){if(A instanceof wA)throw A;G("Unable to read page labels.")}return M(this,"pageLabels",A)}_readPageLabels(){const A=this._catDict.getRaw("PageLabels");if(!A)return null;const e=new Array(this.numPages);let t=null,i="";const a=new yr(A,this.xref).getAll();let s="",n=1;for(let A=0,g=this.numPages;A=1))throw new q("Invalid start in PageLabel dictionary.");n=A}else n=1}switch(t){case"D":s=n;break;case"R":case"r":s=GA(n,"r"===t);break;case"A":case"a":const A=26,e="a"===t?97:65,i=n-1;s=String.fromCharCode(e+i%A).repeat(Math.floor(i/A)+1);break;default:if(t)throw new q(`Invalid style "${t}" in PageLabel dictionary.`);s=""}e[A]=i+s,n++}return e}get pageLayout(){const A=this._catDict.get("PageLayout");let e="";if(A instanceof IA)switch(A.name){case"SinglePage":case"OneColumn":case"TwoColumnLeft":case"TwoColumnRight":case"TwoPageLeft":case"TwoPageRight":e=A.name}return M(this,"pageLayout",e)}get pageMode(){const A=this._catDict.get("PageMode");let e="UseNone";if(A instanceof IA)switch(A.name){case"UseNone":case"UseOutlines":case"UseThumbs":case"FullScreen":case"UseOC":case"UseAttachments":e=A.name}return M(this,"pageMode",e)}get viewerPreferences(){const A=this._catDict.get("ViewerPreferences");if(!(A instanceof BA))return M(this,"viewerPreferences",null);let e=null;for(const t of A.getKeys()){const i=A.get(t);let a;switch(t){case"HideToolbar":case"HideMenubar":case"HideWindowUI":case"FitWindow":case"CenterWindow":case"DisplayDocTitle":case"PickTrayByPDFSize":"boolean"==typeof i&&(a=i);break;case"NonFullScreenPageMode":if(i instanceof IA)switch(i.name){case"UseNone":case"UseOutlines":case"UseThumbs":case"UseOC":a=i.name;break;default:a="UseNone"}break;case"Direction":if(i instanceof IA)switch(i.name){case"L2R":case"R2L":a=i.name;break;default:a="L2R"}break;case"ViewArea":case"ViewClip":case"PrintArea":case"PrintClip":if(i instanceof IA)switch(i.name){case"MediaBox":case"CropBox":case"BleedBox":case"TrimBox":case"ArtBox":a=i.name;break;default:a="CropBox"}break;case"PrintScaling":if(i instanceof IA)switch(i.name){case"None":case"AppDefault":a=i.name;break;default:a="AppDefault"}break;case"Duplex":if(i instanceof IA)switch(i.name){case"Simplex":case"DuplexFlipShortEdge":case"DuplexFlipLongEdge":a=i.name;break;default:a="None"}break;case"PrintPageRange":Array.isArray(i)&&i.length%2==0&&i.every(((A,e,t)=>Number.isInteger(A)&&A>0&&(0===e||A>=t[e-1])&&A<=this.numPages))&&(a=i);break;case"NumCopies":Number.isInteger(i)&&i>0&&(a=i);break;default:G(`Ignoring non-standard key in ViewerPreferences: ${t}.`);continue}void 0!==a?(e||(e=Object.create(null)),e[t]=a):G(`Bad value, for key "${t}", in ViewerPreferences: ${i}.`)}return M(this,"viewerPreferences",e)}get openAction(){const A=this._catDict.get("OpenAction"),e=Object.create(null);if(A instanceof BA){const t=new BA(this.xref);t.set("A",A);const i={url:null,dest:null,action:null};oo.parseDestDictionary({destDict:t,resultObj:i}),Array.isArray(i.dest)?e.dest=i.dest:i.action&&(e.action=i.action)}else Array.isArray(A)&&(e.dest=A);return M(this,"openAction",O(e)>0?e:null)}get attachments(){const A=this._catDict.get("Names");let e=null;if(A instanceof BA&&A.has("EmbeddedFiles")){const t=new mr(A.getRaw("EmbeddedFiles"),this.xref);for(const[A,i]of t.getAll()){const t=new br(i,this.xref);e||(e=Object.create(null)),e[_(A)]=t.serializable}}return M(this,"attachments",e)}get xfaImages(){const A=this._catDict.get("Names");let e=null;if(A instanceof BA&&A.has("XFAImages")){const t=new mr(A.getRaw("XFAImages"),this.xref);for(const[A,i]of t.getAll())e||(e=new BA(this.xref)),e.set(_(A),i)}return M(this,"xfaImages",e)}_collectJavaScript(){const A=this._catDict.get("Names");let e=null;function t(A,t){if(!(t instanceof BA))return;if(!EA(t.get("S"),"JavaScript"))return;let i=t.get("JS");if(i instanceof pA)i=i.getString();else if("string"!=typeof i)return;i=_(i).replaceAll("\0",""),i&&(e||=new Map).set(A,i)}if(A instanceof BA&&A.has("JavaScript")){const e=new mr(A.getRaw("JavaScript"),this.xref);for(const[A,i]of e.getAll())t(_(A),i)}const i=this._catDict.get("OpenAction");return i&&t("OpenAction",i),e}get jsActions(){const A=this._collectJavaScript();let e=WA(this.xref,this._catDict,B);if(A){e||=Object.create(null);for(const[t,i]of A)t in e?e[t].push(i):e[t]=[i]}return M(this,"jsActions",e)}async fontFallback(A,e){const t=await Promise.all(this.fontCache);for(const i of t)if(i.loadedName===A)return void i.fallback(e)}async cleanup(A=!1){wr(),this.globalImageCache.clear(A),this.pageKidsCountCache.clear(),this.pageIndexCache.clear(),this.pageDictCache.clear(),this.nonBlendModesSet.clear();const e=await Promise.all(this.fontCache);for(const{dict:A}of e)delete A.cacheKey;this.fontCache.clear(),this.builtInCMapCache.clear(),this.standardFontDataCache.clear(),this.systemFontCache.clear()}async getPageDict(A){const e=[this.toplevelPagesDict],t=new QA,i=this._catDict.getRaw("Pages");i instanceof hA&&t.put(i);const a=this.xref,s=this.pageKidsCountCache,n=this.pageIndexCache,g=this.pageDictCache;let r=0;for(;e.length;){const i=e.pop();if(i instanceof hA){const o=s.get(i);if(o>=0&&r+o<=A){r+=o;continue}if(t.has(i))throw new q("Pages tree contains circular reference.");t.put(i);const I=await(g.get(i)||a.fetchAsync(i));if(I instanceof BA){let e=I.getRaw("Type");if(e instanceof hA&&(e=await a.fetchAsync(e)),EA(e,"Page")||!I.has("Kids")){if(s.has(i)||s.put(i,1),n.has(i)||n.put(i,r),r===A)return[I,i];r++;continue}}e.push(I);continue}if(!(i instanceof BA))throw new q("Page dictionary kid reference points to wrong type of object.");const{objId:o}=i;let I=i.getRaw("Count");if(I instanceof hA&&(I=await a.fetchAsync(I)),Number.isInteger(I)&&I>=0&&(o&&!s.has(o)&&s.put(o,I),r+I<=A)){r+=I;continue}let c=i.getRaw("Kids");if(c instanceof hA&&(c=await a.fetchAsync(c)),!Array.isArray(c)){let e=i.getRaw("Type");if(e instanceof hA&&(e=await a.fetchAsync(e)),EA(e,"Page")||!i.has("Kids")){if(r===A)return[i,null];r++;continue}throw new q("Page dictionary kids object is not an array.")}for(let A=c.length-1;A>=0;A--){const t=c[A];e.push(t),i===this.toplevelPagesDict&&t instanceof hA&&!g.has(t)&&g.put(t,a.fetchAsync(t))}}throw new Error(`Page index ${A} not found.`)}async getAllPageDicts(A=!1){const{ignoreErrors:e}=this.pdfManager.evaluatorOptions,t=[{currentNode:this.toplevelPagesDict,posInKids:0}],i=new QA,a=this._catDict.getRaw("Pages");a instanceof hA&&i.put(a);const s=new Map,n=this.xref,g=this.pageIndexCache;let r=0;function o(t){if(t instanceof bA&&!A)throw t;A&&e&&0===r&&(G(`getAllPageDicts - Skipping invalid first page: "${t}".`),t=BA.empty),s.set(r++,[t,null])}for(;t.length>0;){const A=t.at(-1),{currentNode:e,posInKids:a}=A;let C=e.getRaw("Kids");if(C instanceof hA)try{C=await n.fetchAsync(C)}catch(A){o(A);break}if(!Array.isArray(C)){o(new q("Page dictionary kids object is not an array."));break}if(a>=C.length){t.pop();continue}const B=C[a];let h;if(B instanceof hA){if(i.has(B)){o(new q("Pages tree contains circular reference."));break}i.put(B);try{h=await n.fetchAsync(B)}catch(A){o(A);break}}else h=B;if(!(h instanceof BA)){o(new q("Page dictionary kid reference points to wrong type of object."));break}let Q=h.getRaw("Type");if(Q instanceof hA)try{Q=await n.fetchAsync(Q)}catch(A){o(A);break}EA(Q,"Page")||!h.has("Kids")?(I=h,(c=B instanceof hA?B:null)&&!g.has(c)&&g.put(c,r),s.set(r++,[I,c])):t.push({currentNode:h,posInKids:0}),A.posInKids++}var I,c;return s}getPageIndex(A){const e=this.pageIndexCache.get(A);if(void 0!==e)return Promise.resolve(e);const t=this.xref;let i=0;const a=e=>function(e){let i,a=0;return t.fetchAsync(e).then((function(t){if(fA(e,A)&&!dA(t,"Page")&&!(t instanceof BA&&!t.has("Type")&&t.has("Contents")))throw new q("The reference does not point to a /Page dictionary.");if(!t)return null;if(!(t instanceof BA))throw new q("Node must be a dictionary.");return i=t.getRaw("Parent"),t.getAsync("Parent")})).then((function(A){if(!A)return null;if(!(A instanceof BA))throw new q("Parent must be a dictionary.");return A.getAsync("Kids")})).then((function(A){if(!A)return null;const s=[];let n=!1;for(const i of A){if(!(i instanceof hA))throw new q("Kid must be a reference.");if(fA(i,e)){n=!0;break}s.push(t.fetchAsync(i).then((function(A){if(!(A instanceof BA))throw new q("Kid node must be a dictionary.");A.has("Count")?a+=A.get("Count"):a++})))}if(!n)throw new q("Kid reference not found in parent's kids.");return Promise.all(s).then((function(){return[a,i]}))}))}(e).then((e=>{if(!e)return this.pageIndexCache.put(A,i),i;const[t,s]=e;return i+=t,a(s)}));return a(A)}get baseUrl(){const A=this._catDict.get("URI");if(A instanceof BA){const e=A.get("Base");if("string"==typeof e){const A=U(e,null,{tryConvertEncoding:!0});if(A)return M(this,"baseUrl",A.href)}}return M(this,"baseUrl",this.pdfManager.docBaseUrl)}static parseDestDictionary({destDict:A,resultObj:e,docBaseUrl:t=null,docAttachments:i=null}){if(!(A instanceof BA))return void G("parseDestDictionary: `destDict` must be a dictionary.");let a,s,n=A.get("A");if(n instanceof BA||(A.has("Dest")?n=A.get("Dest"):(n=A.get("AA"),n instanceof BA&&(n.has("D")?n=n.get("D"):n.has("U")&&(n=n.get("U"))))),n instanceof BA){const A=n.get("S");if(!(A instanceof IA))return void G("parseDestDictionary: Invalid type in Action dictionary.");const t=A.name;switch(t){case"ResetForm":const A=n.get("Flags"),g=!(1&("number"==typeof A?A:0)),r=[],o=[];for(const A of n.get("Fields")||[])A instanceof hA?o.push(A.toString()):"string"==typeof A&&r.push(_(A));e.resetForm={fields:r,refs:o,include:g};break;case"URI":a=n.get("URI"),a instanceof IA&&(a="/"+a.name);break;case"GoTo":s=n.get("D");break;case"Launch":case"GoToR":const I=n.get("F");if(I instanceof BA){const A=new br(I,null,!0),{rawFilename:e}=A.serializable;a=e}else"string"==typeof I&&(a=I);const c=ro(n);c&&"string"==typeof a&&(a=a.split("#",1)[0]+"#"+c);const C=n.get("NewWindow");"boolean"==typeof C&&(e.newWindow=C);break;case"GoToE":const B=n.get("T");let h;if(i&&B instanceof BA){const A=B.get("R"),e=B.get("N");EA(A,"C")&&"string"==typeof e&&(h=i[_(e)])}if(h){e.attachment=h;const A=ro(n);A&&(e.attachmentDest=A)}else G('parseDestDictionary - unimplemented "GoToE" action.');break;case"Named":const Q=n.get("N");Q instanceof IA&&(e.action=Q.name);break;case"SetOCGState":const l=n.get("State"),E=n.get("PreserveRB");if(!Array.isArray(l)||0===l.length)break;const u=[];for(const A of l)if(A instanceof IA)switch(A.name){case"ON":case"OFF":case"Toggle":u.push(A.name)}else A instanceof hA&&u.push(A.toString());if(u.length!==l.length)break;e.setOCGState={state:u,preserveRB:"boolean"!=typeof E||E};break;case"JavaScript":const d=n.get("JS");let f;d instanceof pA?f=d.getString():"string"==typeof d&&(f=d);const p=f&&zA(_(f));if(p){a=p.url,e.newWindow=p.newWindow;break}default:if("JavaScript"===t||"SubmitForm"===t)break;G(`parseDestDictionary - unsupported action: "${t}".`)}}else A.has("Dest")&&(s=A.get("Dest"));if("string"==typeof a){const A=U(a,t,{addDefaultProtocol:!0,tryConvertEncoding:!0});A&&(e.url=A.href),e.unsafeUrl=a}s&&(s instanceof IA&&(s=s.name),"string"==typeof s?e.dest=_(s):no(s)&&(e.dest=s))}}function Io(A,e){if(A instanceof BA)A=A.getRawValues();else if(A instanceof pA)A=A.dict.getRawValues();else if(!Array.isArray(A))return;for(const i of A)((t=i)instanceof hA||t instanceof BA||t instanceof pA||Array.isArray(t))&&e.push(i);var t}class co{constructor(A,e,t){this.dict=A,this.keys=e,this.xref=t,this.refSet=null}async load(){if(this.xref.stream.isDataLoaded)return;const{keys:A,dict:e}=this;this.refSet=new QA;const t=[];for(const i of A){const A=e.getRaw(i);void 0!==A&&t.push(A)}return this._walk(t)}async _walk(A){const e=[],t=[];for(;A.length;){let i=A.pop();if(i instanceof hA){if(this.refSet.has(i))continue;try{this.refSet.put(i),i=this.xref.fetch(i)}catch(A){if(!(A instanceof wA)){G(`ObjectLoader._walk - requesting all data: "${A}".`),this.refSet=null;const{manager:e}=this.xref.stream;return e.requestAllChunks()}e.push(i),t.push({begin:A.begin,end:A.end})}}if(i instanceof pA){const A=i.getBaseStreams();if(A){let a=!1;for(const e of A)e.isDataLoaded||(a=!0,t.push({begin:e.start,end:e.end}));a&&e.push(i)}}Io(i,A)}if(t.length){await this.xref.stream.manager.requestRanges(t);for(const A of e)A instanceof hA&&this.refSet.remove(A);return this._walk(e)}this.refSet=null}}const Co=Symbol(),Bo=Symbol(),ho=Symbol(),Qo=Symbol(),lo=Symbol(),Eo=Symbol(),uo=Symbol(),fo=Symbol(),po=Symbol(),mo=Symbol("content"),yo=Symbol("data"),wo=Symbol(),Do=Symbol("extra"),bo=Symbol(),ko=Symbol(),Fo=Symbol(),So=Symbol(),Ro=Symbol(),Go=Symbol(),No=Symbol(),xo=Symbol(),Uo=Symbol(),Mo=Symbol(),Lo=Symbol(),Jo=Symbol(),Ho=Symbol(),Yo=Symbol(),vo=Symbol(),Ko=Symbol(),qo=Symbol(),To=Symbol(),Po=Symbol(),Wo=Symbol(),Zo=Symbol(),Oo=Symbol(),Xo=Symbol(),Vo=Symbol(),jo=Symbol(),zo=Symbol(),_o=Symbol(),$o=Symbol(),AI=Symbol(),eI=Symbol(),tI=Symbol(),iI=Symbol(),aI=Symbol("namespaceId"),sI=Symbol("nodeName"),nI=Symbol(),gI=Symbol(),rI=Symbol(),oI=Symbol(),II=Symbol(),cI=Symbol(),CI=Symbol(),BI=Symbol(),hI=Symbol("root"),QI=Symbol(),lI=Symbol(),EI=Symbol(),uI=Symbol(),dI=Symbol(),fI=Symbol(),pI=Symbol(),mI=Symbol(),yI=Symbol(),wI=Symbol(),DI=Symbol(),bI=Symbol("uid"),kI=Symbol(),FI={config:{id:0,check:A=>A.startsWith("http://www.xfa.org/schema/xci/")},connectionSet:{id:1,check:A=>A.startsWith("http://www.xfa.org/schema/xfa-connection-set/")},datasets:{id:2,check:A=>A.startsWith("http://www.xfa.org/schema/xfa-data/")},form:{id:3,check:A=>A.startsWith("http://www.xfa.org/schema/xfa-form/")},localeSet:{id:4,check:A=>A.startsWith("http://www.xfa.org/schema/xfa-locale-set/")},pdf:{id:5,check:A=>"http://ns.adobe.com/xdp/pdf/"===A},signature:{id:6,check:A=>"http://www.w3.org/2000/09/xmldsig#"===A},sourceSet:{id:7,check:A=>A.startsWith("http://www.xfa.org/schema/xfa-source-set/")},stylesheet:{id:8,check:A=>"http://www.w3.org/1999/XSL/Transform"===A},template:{id:9,check:A=>A.startsWith("http://www.xfa.org/schema/xfa-template/")},xdc:{id:10,check:A=>A.startsWith("http://www.xfa.org/schema/xdc/")},xdp:{id:11,check:A=>"http://ns.adobe.com/xdp/"===A},xfdf:{id:12,check:A=>"http://ns.adobe.com/xfdf/"===A},xhtml:{id:13,check:A=>"http://www.w3.org/1999/xhtml"===A},xmpmeta:{id:14,check:A=>"http://ns.adobe.com/xmpmeta/"===A}},SI={pt:A=>A,cm:A=>A/2.54*72,mm:A=>A/25.4*72,in:A=>72*A,px:A=>A},RI=/([+-]?\d+\.?\d*)(.*)/;function GI(A){return A.startsWith("'")||A.startsWith('"')?A.slice(1,-1):A}function NI({data:A,defaultValue:e,validate:t}){if(!A)return e;A=A.trim();const i=parseInt(A,10);return!isNaN(i)&&t(i)?i:e}function xI({data:A,defaultValue:e,validate:t}){if(!A)return e;A=A.trim();const i=parseFloat(A);return!isNaN(i)&&t(i)?i:e}function UI({data:A,defaultValue:e,validate:t}){return A&&t(A=A.trim())?A:e}function MI(A,e){return UI({data:A,defaultValue:e[0],validate:A=>e.includes(A)})}function LI(A,e="0"){if(e||="0",!A)return LI(e);const t=A.trim().match(RI);if(!t)return LI(e);const[,i,a]=t,s=parseFloat(i);if(isNaN(s))return LI(e);if(0===s)return 0;const n=SI[a];return n?n(s):s}function JI(A){if(!A)return{num:1,den:1};const e=A.trim().split(/\s*:\s*/).map((A=>parseFloat(A))).filter((A=>!isNaN(A)));if(1===e.length&&e.push(1),0===e.length)return{num:1,den:1};const[t,i]=e;return{num:t,den:i}}function HI(A){return A?A.trim().split(/\s+/).map((A=>({excluded:"-"===A[0],viewname:A.substring(1)}))):[]}class YI{static get FAILURE(){return M(this,"FAILURE",new YI(!1,null,null,null))}static get EMPTY(){return M(this,"EMPTY",new YI(!0,null,null,null))}constructor(A,e,t,i){this.success=A,this.html=e,this.bbox=t,this.breakNode=i}isBreak(){return!!this.breakNode}static breakNode(A){return new YI(!1,null,null,A)}static success(A,e=null){return new YI(!0,A,e,null)}}class vI{constructor(A){this.fonts=new Map,this.cache=new Map,this.warned=new Set,this.defaultFont=null,this.add(A)}add(A,e=null){for(const e of A)this.addPdfFont(e);for(const A of this.fonts.values())A.regular||(A.regular=A.italic||A.bold||A.bolditalic);if(!e||0===e.size)return;const t=this.fonts.get("PdfJS-Fallback-PdfJS-XFA");for(const A of e)this.fonts.set(A,t)}addPdfFont(A){const e=A.cssFontInfo,t=e.fontFamily;let i=this.fonts.get(t);i||(i=Object.create(null),this.fonts.set(t,i),this.defaultFont||(this.defaultFont=i));let a="";const s=parseFloat(e.fontWeight);0!==parseFloat(e.italicAngle)?a=s>=700?"bolditalic":"italic":s>=700&&(a="bold"),a||((A.name.includes("Bold")||A.psName?.includes("Bold"))&&(a="bold"),(A.name.includes("Italic")||A.name.endsWith("It")||A.psName?.includes("Italic")||A.psName?.endsWith("It"))&&(a+="italic")),a||(a="regular"),i[a]=A}getDefault(){return this.defaultFont}find(A,e=!0){let t=this.fonts.get(A)||this.cache.get(A);if(t)return t;const i=/,|-|_| |bolditalic|bold|italic|regular|it/gi;let a=A.replaceAll(i,"");if(t=this.fonts.get(a),t)return this.cache.set(A,t),t;a=a.toLowerCase();const s=[];for(const[A,e]of this.fonts.entries())A.replaceAll(i,"").toLowerCase().startsWith(a)&&s.push(e);if(0===s.length)for(const[,A]of this.fonts.entries())A.regular.name?.replaceAll(i,"").toLowerCase().startsWith(a)&&s.push(A);if(0===s.length){a=a.replaceAll(/psmt|mt/gi,"");for(const[A,e]of this.fonts.entries())A.replaceAll(i,"").toLowerCase().startsWith(a)&&s.push(e)}if(0===s.length)for(const A of this.fonts.values())A.regular.name?.replaceAll(i,"").toLowerCase().startsWith(a)&&s.push(A);return s.length>=1?(1!==s.length&&e&&G(`XFA - Too many choices to guess the correct font: ${A}`),this.cache.set(A,s[0]),s[0]):(e&&!this.warned.has(A)&&(this.warned.add(A),G(`XFA - Cannot find the font: ${A}`)),null)}}function KI(A,e){return"italic"===A.posture?"bold"===A.weight?e.bolditalic:e.italic:"bold"===A.weight?e.bold:e.regular}class qI{constructor(A,e,t,i){if(this.lineHeight=t,this.paraMargin=e||{top:0,bottom:0,left:0,right:0},!A)return void([this.pdfFont,this.xfaFont]=this.defaultFont(i));this.xfaFont={typeface:A.typeface,posture:A.posture,weight:A.weight,size:A.size,letterSpacing:A.letterSpacing};const a=i.find(A.typeface);a?(this.pdfFont=KI(A,a),this.pdfFont||([this.pdfFont,this.xfaFont]=this.defaultFont(i))):[this.pdfFont,this.xfaFont]=this.defaultFont(i)}defaultFont(A){const e=A.find("Helvetica",!1)||A.find("Myriad Pro",!1)||A.find("Arial",!1)||A.getDefault();if(e?.regular){const A=e.regular;return[A,{typeface:A.cssFontInfo.fontFamily,posture:"normal",weight:"normal",size:10,letterSpacing:0}]}return[null,{typeface:"Courier",posture:"normal",weight:"normal",size:10,letterSpacing:0}]}}class TI{constructor(A,e,t,i){this.fontFinder=i,this.stack=[new qI(A,e,t,i)]}pushData(A,e,t){const i=this.stack.at(-1);for(const e of["typeface","posture","weight","size","letterSpacing"])A[e]||(A[e]=i.xfaFont[e]);for(const A of["top","bottom","left","right"])isNaN(e[A])&&(e[A]=i.paraMargin[A]);const a=new qI(A,e,t||i.lineHeight,this.fontFinder);a.pdfFont||(a.pdfFont=i.pdfFont),this.stack.push(a)}popFont(){this.stack.pop()}topFont(){return this.stack.at(-1)}}class PI{constructor(A,e,t,i){this.glyphs=[],this.fontSelector=new TI(A,e,t,i),this.extraHeight=0}pushData(A,e,t){this.fontSelector.pushData(A,e,t)}popFont(A){return this.fontSelector.popFont()}addPara(){const A=this.fontSelector.topFont();this.extraHeight+=A.paraMargin.top+A.paraMargin.bottom}addString(A){if(!A)return;const e=this.fontSelector.topFont(),t=e.xfaFont.size;if(e.pdfFont){const i=e.xfaFont.letterSpacing,a=e.pdfFont,s=a.lineHeight||1.2,n=e.lineHeight||Math.max(1.2,s)*t,g=s-(void 0===a.lineGap?.2:a.lineGap),r=Math.max(1,g)*t,o=t/1e3,I=a.defaultWidth||a.charsToGlyphs(" ")[0].width;for(const e of A.split(/[\u2029\n]/)){const A=a.encodeString(e).join(""),t=a.charsToGlyphs(A);for(const A of t){const e=A.width||I;this.glyphs.push([e*o+i,n,r,A.unicode,!1])}this.glyphs.push([0,0,0,"\n",!0])}this.glyphs.pop()}else{for(const e of A.split(/[\u2029\n]/)){for(const A of e.split(""))this.glyphs.push([t,1.2*t,t,A,!1]);this.glyphs.push([0,0,0,"\n",!0])}this.glyphs.pop()}}compute(A){let e=-1,t=0,i=0,a=0,s=0,n=0,g=!1,r=!0;for(let o=0,I=this.glyphs.length;oA?(i=Math.max(i,s),s=0,a+=n,n=l,e=-1,t=0,g=!0,r=!1):(n=Math.max(l,n),t=s,s+=I,e=o):s+I>A?(a+=n,n=l,-1!==e?(o=e,i=Math.max(i,t),s=0,e=-1,t=0):(i=Math.max(i,s),s=I),g=!0,r=!1):(s+=I,n=Math.max(l,n))}return i=Math.max(i,s),a+=n+this.extraHeight,{width:1.02*i,height:a,isBroken:g}}}const WI=/^[^.[]+/,ZI=/^[^\]]+/,OI={dot:0,dotDot:1,dotHash:2,dotBracket:3,dotParen:4},XI=new Map([["$data",(A,e)=>A.datasets?A.datasets.data:A],["$record",(A,e)=>(A.datasets?A.datasets.data:A)[Jo]()[0]],["$template",(A,e)=>A.template],["$connectionSet",(A,e)=>A.connectionSet],["$form",(A,e)=>A.form],["$layout",(A,e)=>A.layout],["$host",(A,e)=>A.host],["$dataWindow",(A,e)=>A.dataWindow],["$event",(A,e)=>A.event],["!",(A,e)=>A.datasets],["$xfa",(A,e)=>A],["xfa",(A,e)=>A],["$",(A,e)=>e]]),VI=new WeakMap;function jI(A,e,t=!0){let i=A.match(WI);if(!i)return null;let[a]=i;const s=[{name:a,cacheName:"."+a,index:0,js:null,formCalc:null,operator:OI.dot}];let n=a.length;for(;n0&&I.push(A)}if(0!==I.length||g||0!==r)A=isFinite(o)?I.filter((A=>oA[o])):I.flat();else{const t=e[Ko]();if(!(e=t))return null;r=-1,A=[e]}}return 0===A.length?null:A}function _I(A,e,t){const i=jI(t);if(!i)return null;if(i.some((A=>A.operator===OI.dotDot)))return null;const a=XI.get(i[0].name);let s=0;a?(A=a(A,e),s=1):A=e||A;for(let e=i.length;sA[pI]())).join("")}get[ec](){const A=Object.getPrototypeOf(this);if(!A._attributes){const e=A._attributes=new Set;for(const A of Object.getOwnPropertyNames(this)){if(null===this[A]||this[A]instanceof uc||this[A]instanceof dc)break;e.add(A)}}return M(this,ec,A._attributes)}[zo](A){let e=this;for(;e;){if(e===A)return!0;e=e[Ko]()}return!1}[Ko](){return this[Cc]}[vo](){return this[Ko]()}[Jo](A=null){return A?this[A]:this[tc]}[wo](){const A=Object.create(null);this[mo]&&(A.$content=this[mo]);for(const e of Object.getOwnPropertyNames(this)){const t=this[e];null!==t&&(t instanceof uc?A[e]=t[wo]():t instanceof dc?t.isEmpty()||(A[e]=t.dump()):A[e]=t)}return A}[DI](){return null}[yI](){return YI.EMPTY}*[Ho](){for(const A of this[Jo]())yield A}*[nc](A,e){for(const t of this[Ho]())if(!A||e===A.has(t[sI])){const A=this[Ro](),e=t[yI](A);e.success||(this[Do].failingNode=t),yield e}}[ko](){return null}[Bo](A,e){this[Do].children.push(A)}[Ro](){}[Qo]({filter:A=null,include:e=!0}){if(this[Do].generator){const A=this[Ro](),e=this[Do].failingNode[yI](A);if(!e.success)return e;e.html&&this[Bo](e.html,e.bbox),delete this[Do].failingNode}else this[Do].generator=this[nc](A,e);for(;;){const A=this[Do].generator.next();if(A.done)break;const e=A.value;if(!e.success)return e;e.html&&this[Bo](e.html,e.bbox)}return this[Do].generator=null,YI.EMPTY}[uI](A){this[hc]=new Set(Object.keys(A))}[rc](A){const e=this[ec],t=this[hc];return[...A].filter((A=>e.has(A)&&!t.has(A)))}[QI](A,e=new Set){for(const t of this[tc])t[Bc](A,e)}[Bc](A,e){const t=this[gc](A,e);t?this[$I](t,A,e):this[QI](A,e)}[gc](A,e){const{use:t,usehref:i}=this;if(!t&&!i)return null;let a=null,s=null,n=null,g=t;if(i?(g=i,i.startsWith("#som(")&&i.endsWith(")")?s=i.slice(5,-1):i.startsWith(".#som(")&&i.endsWith(")")?s=i.slice(6,-1):i.startsWith("#")?n=i.slice(1):i.startsWith(".#")&&(n=i.slice(2))):t.startsWith("#")?n=t.slice(1):s=t,this.use=this.usehref="",n?a=A.get(n):(a=zI(A.get(hI),this,s,!0,!1),a&&(a=a[0])),!a)return G(`XFA - Invalid prototype reference: ${g}.`),null;if(a[sI]!==this[sI])return G(`XFA - Incompatible prototype: ${a[sI]} !== ${this[sI]}.`),null;if(e.has(a))return G("XFA - Cycle detected in prototypes use."),null;e.add(a);const r=a[gc](A,e);return r&&a[$I](r,A,e),a[QI](A,e),e.delete(a),a}[$I](A,e,t){if(t.has(A))G("XFA - Cycle detected in prototypes use.");else{!this[mo]&&A[mo]&&(this[mo]=A[mo]),new Set(t).add(A);for(const e of this[rc](A[hc]))this[e]=A[e],this[hc]&&this[hc].add(e);for(const i of Object.getOwnPropertyNames(this)){if(this[ec].has(i))continue;const a=this[i],s=A[i];if(a instanceof dc){for(const A of a[tc])A[Bc](e,t);for(let i=a[tc].length,n=s[tc].length;iuc[ic](A))):"object"==typeof A&&null!==A?Object.assign({},A):A}[fo](){const A=Object.create(Object.getPrototypeOf(this));for(const e of Object.getOwnPropertySymbols(this))try{A[e]=this[e]}catch{M(A,e,this[e])}A[bI]=`${A[sI]}${lc++}`,A[tc]=[];for(const e of Object.getOwnPropertyNames(this)){if(this[ec].has(e)){A[e]=uc[ic](this[e]);continue}const t=this[e];A[e]=t instanceof dc?new dc(t[Ic]):null}for(const e of this[tc]){const t=e[sI],i=e[fo]();A[tc].push(i),i[Cc]=A,null===A[t]?A[t]=i:A[t][tc].push(i)}return A}[Jo](A=null){return A?this[tc].filter((e=>e[sI]===A)):this[tc]}[Go](A){return this[A]}[No](A,e,t=!0){return Array.from(this[xo](A,e,t))}*[xo](A,e,t=!0){if("parent"!==A){for(const t of this[tc])t[sI]===A&&(yield t),t.name===A&&(yield t),(e||t[eI]())&&(yield*t[xo](A,e,!1));t&&this[ec].has(A)&&(yield new fc(this,A,this[A]))}else yield this[Cc]}}class dc{constructor(A=1/0){this[Ic]=A,this[tc]=[]}get isXFAObject(){return!1}get isXFAObjectArray(){return!0}push(A){return this[tc].length<=this[Ic]?(this[tc].push(A),!0):(G(`XFA - node "${A[sI]}" accepts no more than ${this[Ic]} children`),!1)}isEmpty(){return 0===this[tc].length}dump(){return 1===this[tc].length?this[tc][0][wo]():this[tc].map((A=>A[wo]()))}[fo](){const A=new dc(this[Ic]);return A[tc]=this[tc].map((A=>A[fo]())),A}get children(){return this[tc]}clear(){this[tc].length=0}}class fc{constructor(A,e,t){this[Cc]=A,this[sI]=e,this[mo]=t,this[po]=!1,this[bI]="attribute"+lc++}[Ko](){return this[Cc]}[jo](){return!0}[Uo](){return this[mo].trim()}[dI](A){A=A.value||"",this[mo]=A.toString()}[pI](){return this[mo]}[zo](A){return this[Cc]===A||this[Cc][zo](A)}}class pc extends uc{constructor(A,e,t={}){if(super(A,e),this[mo]="",this[ac]=null,"#text"!==e){const A=new Map;this[Ac]=A;for(const[e,i]of Object.entries(t))A.set(e,new fc(this,e,i));if(t.hasOwnProperty(nI)){const A=t[nI].xfa.dataNode;void 0!==A&&("dataGroup"===A?this[ac]=!1:"dataValue"===A&&(this[ac]=!0))}}this[po]=!1}[wI](A){const e=this[sI];if("#text"===e)return void A.push(XA(this[mo]));const t=AA(e),i=this[aI]===Ec?"xfa:":"";A.push(`<${i}${t}`);for(const[e,t]of this[Ac].entries()){const i=AA(e);A.push(` ${i}="${XA(t[mo])}"`)}if(null!==this[ac]&&(this[ac]?A.push(' xfa:dataNode="dataValue"'):A.push(' xfa:dataNode="dataGroup"')),this[mo]||0!==this[tc].length){if(A.push(">"),this[mo])"string"==typeof this[mo]?A.push(XA(this[mo])):this[mo][wI](A);else for(const e of this[tc])e[wI](A);A.push(``)}else A.push("/>")}[gI](A){if(this[mo]){const A=new pc(this[aI],"#text");this[ho](A),A[mo]=this[mo],this[mo]=""}return this[ho](A),!0}[oI](A){this[mo]+=A}[bo](){if(this[mo]&&this[tc].length>0){const A=new pc(this[aI],"#text");this[ho](A),A[mo]=this[mo],delete this[mo]}}[yI](){return"#text"===this[sI]?YI.success({name:"#text",value:this[mo]}):YI.EMPTY}[Jo](A=null){return A?this[tc].filter((e=>e[sI]===A)):this[tc]}[So](){return this[Ac]}[Go](A){const e=this[Ac].get(A);return void 0!==e?e:this[Jo](A)}*[xo](A,e){const t=this[Ac].get(A);t&&(yield t);for(const t of this[tc])t[sI]===A&&(yield t),e&&(yield*t[xo](A,e))}*[Fo](A,e){const t=this[Ac].get(A);!t||e&&t[po]||(yield t);for(const t of this[tc])yield*t[Fo](A,e)}*[Lo](A,e,t){for(const i of this[tc])i[sI]!==A||t&&i[po]||(yield i),e&&(yield*i[Lo](A,e,t))}[jo](){return null===this[ac]?0===this[tc].length||this[tc][0][aI]===FI.xhtml.id:this[ac]}[Uo](){return null===this[ac]?0===this[tc].length?this[mo].trim():this[tc][0][aI]===FI.xhtml.id?this[tc][0][pI]().trim():null:this[mo].trim()}[dI](A){A=A.value||"",this[mo]=A.toString()}[wo](A=!1){const e=Object.create(null);A&&(e.$ns=this[aI]),this[mo]&&(e.$content=this[mo]),e.$name=this[sI],e.children=[];for(const t of this[tc])e.children.push(t[wo](A));e.attributes=Object.create(null);for(const[A,t]of this[Ac])e.attributes[A]=t[mo];return e}}class mc extends uc{constructor(A,e){super(A,e),this[mo]=""}[oI](A){this[mo]+=A}[bo](){}}class yc extends mc{constructor(A,e,t){super(A,e),this[cc]=t}[bo](){this[mo]=UI({data:this[mo],defaultValue:this[cc][0],validate:A=>this[cc].includes(A)})}[lo](A){super[lo](A),delete this[cc]}}class wc extends mc{[bo](){this[mo]=this[mo].trim()}}class Dc extends mc{constructor(A,e,t,i){super(A,e),this[sc]=t,this[Qc]=i}[bo](){this[mo]=NI({data:this[mo],defaultValue:this[sc],validate:this[Qc]})}[lo](A){super[lo](A),delete this[sc],delete this[Qc]}}class bc extends Dc{constructor(A,e){super(A,e,0,(A=>1===A))}}class kc extends Dc{constructor(A,e){super(A,e,1,(A=>0===A))}}function Fc(A){return"string"==typeof A?"0px":Number.isInteger(A)?`${A}px`:`${A.toFixed(2)}px`}const Sc={anchorType(A,e){const t=A[vo]();if(t&&(!t.layout||"position"===t.layout))switch("transform"in e||(e.transform=""),A.anchorType){case"bottomCenter":e.transform+="translate(-50%, -100%)";break;case"bottomLeft":e.transform+="translate(0,-100%)";break;case"bottomRight":e.transform+="translate(-100%,-100%)";break;case"middleCenter":e.transform+="translate(-50%,-50%)";break;case"middleLeft":e.transform+="translate(0,-50%)";break;case"middleRight":e.transform+="translate(-100%,-50%)";break;case"topCenter":e.transform+="translate(-50%,0)";break;case"topRight":e.transform+="translate(-100%,0)"}},dimensions(A,e){const t=A[vo]();let i=A.w;const a=A.h;if(t.layout?.includes("row")){const e=t[Do],a=A.colSpan;let s;-1===a?(s=e.columnWidths.slice(e.currentColumn).reduce(((A,e)=>A+e),0),e.currentColumn=0):(s=e.columnWidths.slice(e.currentColumn,e.currentColumn+a).reduce(((A,e)=>A+e),0),e.currentColumn=(e.currentColumn+A.colSpan)%e.columnWidths.length),isNaN(s)||(i=A.w=s)}e.width=""!==i?Fc(i):"auto",e.height=""!==a?Fc(a):"auto"},position(A,e){const t=A[vo]();t?.layout&&"position"!==t.layout||(e.position="absolute",e.left=Fc(A.x),e.top=Fc(A.y))},rotate(A,e){A.rotate&&("transform"in e||(e.transform=""),e.transform+=`rotate(-${A.rotate}deg)`,e.transformOrigin="top left")},presence(A,e){switch(A.presence){case"invisible":e.visibility="hidden";break;case"hidden":case"inactive":e.display="none"}},hAlign(A,e){if("para"===A[sI])switch(A.hAlign){case"justifyAll":e.textAlign="justify-all";break;case"radix":e.textAlign="left";break;default:e.textAlign=A.hAlign}else switch(A.hAlign){case"left":e.alignSelf="start";break;case"center":e.alignSelf="center";break;case"right":e.alignSelf="end"}},margin(A,e){A.margin&&(e.margin=A.margin[DI]().margin)}};function Rc(A,e){"position"===A[vo]().layout&&(A.minW>0&&(e.minWidth=Fc(A.minW)),A.maxW>0&&(e.maxWidth=Fc(A.maxW)),A.minH>0&&(e.minHeight=Fc(A.minH)),A.maxH>0&&(e.maxHeight=Fc(A.maxH)))}function Gc(A,e,t,i,a,s){const n=new PI(e,t,i,a);return"string"==typeof A?n.addString(A):A[II](n),n.compute(s)}function Nc(A,e){let t=null,i=null,a=!1;if((!A.w||!A.h)&&A.value){let s=0,n=0;A.margin&&(s=A.margin.leftInset+A.margin.rightInset,n=A.margin.topInset+A.margin.bottomInset);let g=null,r=null;A.para&&(r=Object.create(null),g=""===A.para.lineHeight?null:A.para.lineHeight,r.top=""===A.para.spaceAbove?0:A.para.spaceAbove,r.bottom=""===A.para.spaceBelow?0:A.para.spaceBelow,r.left=""===A.para.marginLeft?0:A.para.marginLeft,r.right=""===A.para.marginRight?0:A.para.marginRight);let o=A.font;if(!o){const e=A[qo]();let t=A[Ko]();for(;t&&t!==e;){if(t.font){o=t.font;break}t=t[Ko]()}}const I=(A.w||e.width)-s,c=A[To].fontFinder;if(A.value.exData&&A.value.exData[mo]&&"text/html"===A.value.exData.contentType){const e=Gc(A.value.exData[mo],o,r,g,c,I);i=e.width,t=e.height,a=e.isBroken}else{const e=A.value[pI]();if(e){const A=Gc(e,o,r,g,c,I);i=A.width,t=A.height,a=A.isBroken}}null===i||A.w||(i+=s),null===t||A.h||(t+=n)}return{w:i,h:t,isBroken:a}}function xc(A,e,t){let i;if(""!==A.w&&""!==A.h)i=[A.x,A.y,A.w,A.h];else{if(!t)return null;let a=A.w;if(""===a){if(0===A.maxW){const e=A[vo]();a="position"===e.layout&&""!==e.w?0:A.minW}else a=Math.min(A.maxW,t.width);e.attributes.style.width=Fc(a)}let s=A.h;if(""===s){if(0===A.maxH){const e=A[vo]();s="position"===e.layout&&""!==e.h?0:A.minH}else s=Math.min(A.maxH,t.height);e.attributes.style.height=Fc(s)}i=[A.x,A.y,a,s]}return i}function Uc(A){const e=A[vo]();if(e.layout?.includes("row")){const t=e[Do],i=A.colSpan;let a;a=-1===i?t.columnWidths.slice(t.currentColumn).reduce(((A,e)=>A+e),0):t.columnWidths.slice(t.currentColumn,t.currentColumn+i).reduce(((A,e)=>A+e),0),isNaN(a)||(A.w=a)}e.layout&&"position"!==e.layout&&(A.x=A.y=0),"table"===A.layout&&""===A.w&&Array.isArray(A.columnWidths)&&(A.w=A.columnWidths.reduce(((A,e)=>A+e),0))}function Mc(A){switch(A.layout){case"position":default:return"xfaPosition";case"lr-tb":return"xfaLrTb";case"rl-row":return"xfaRlRow";case"rl-tb":return"xfaRlTb";case"row":return"xfaRow";case"table":return"xfaTable";case"tb":return"xfaTb"}}function Lc(A,...e){const t=Object.create(null);for(const i of e){const e=A[i];if(null!==e)if(Sc.hasOwnProperty(i))Sc[i](A,t);else if(e instanceof uc){const A=e[DI]();A?Object.assign(t,A):G(`(DEBUG) - XFA - style for ${i} not implemented yet`)}}return t}function Jc(A,e){const{attributes:t}=e,{style:i}=t,a={name:"div",attributes:{class:["xfaWrapper"],style:Object.create(null)},children:[]};if(t.class.push("xfaWrapped"),A.border){const{widths:t,insets:s}=A.border[Do];let n,g,r=s[0],o=s[3];const I=s[0]+s[2],c=s[1]+s[3];switch(A.border.hand){case"even":r-=t[0]/2,o-=t[3]/2,n=`calc(100% + ${(t[1]+t[3])/2-c}px)`,g=`calc(100% + ${(t[0]+t[2])/2-I}px)`;break;case"left":r-=t[0],o-=t[3],n=`calc(100% + ${t[1]+t[3]-c}px)`,g=`calc(100% + ${t[0]+t[2]-I}px)`;break;case"right":n=c?`calc(100% - ${c}px)`:"100%",g=I?`calc(100% - ${I}px)`:"100%"}const C=["xfaBorder"];vc(A.border)&&C.push("xfaPrintOnly");const B={name:"div",attributes:{class:C,style:{top:`${r}px`,left:`${o}px`,width:n,height:g}},children:[]};for(const A of["border","borderWidth","borderColor","borderRadius","borderStyle"])void 0!==i[A]&&(B.attributes.style[A]=i[A],delete i[A]);a.children.push(B,e)}else a.children.push(e);for(const A of["background","backgroundClip","top","left","width","height","minWidth","minHeight","maxWidth","maxHeight","transform","transformOrigin","visibility"])void 0!==i[A]&&(a.attributes.style[A]=i[A],delete i[A]);return a.attributes.style.position="absolute"===i.position?"absolute":"relative",delete i.position,i.alignSelf&&(a.attributes.style.alignSelf=i.alignSelf,delete i.alignSelf),a}function Hc(A){const e=LI(A.textIndent,"0px");if(e>=0)return;const t="padding"+("left"==("right"===A.textAlign?"right":"left")?"Left":"Right"),i=LI(A[t],"0px");A[t]=i-e+"px"}function Yc(A,e){switch(A.access){case"nonInteractive":e.push("xfaNonInteractive");break;case"readOnly":e.push("xfaReadOnly");break;case"protected":e.push("xfaDisabled")}}function vc(A){return A.relevant.length>0&&!A.relevant[0].excluded&&"print"===A.relevant[0].viewname}function Kc(A){const e=A[qo]()[Do].paraStack;return e.length?e.at(-1):null}function qc(A,e,t){if(t.attributes.class?.includes("xfaRich")){e&&(""===A.h&&(e.height="auto"),""===A.w&&(e.width="auto"));const i=Kc(A);if(i){const A=t.attributes.style;switch(A.display="flex",A.flexDirection="column",i.vAlign){case"top":A.justifyContent="start";break;case"bottom":A.justifyContent="end";break;case"middle":A.justifyContent="center"}const e=i[DI]();for(const[t,i]of Object.entries(e))t in A||(A[t]=i)}}}function Tc(A,e,t,i){if(!t)return void delete i.fontFamily;const a=GI(A.typeface);i.fontFamily=`"${a}"`;const s=t.find(a);if(s){const{fontFamily:t}=s.regular.cssFontInfo;t!==a&&(i.fontFamily=`"${t}"`);const n=Kc(e);if(n&&""!==n.lineHeight)return;if(i.lineHeight)return;const g=KI(A,s);g&&(i.lineHeight=Math.max(1.2,g.lineHeight))}}function Pc(A){const e=U(A,null,{addDefaultProtocol:!0,tryConvertEncoding:!0});return e?e.href:null}function Wc(A,e){return{name:"div",attributes:{class:["lr-tb"===A.layout?"xfaLr":"xfaRl"]},children:e}}function Zc(A){if(!A[Do])return null;const e={name:"div",attributes:A[Do].attributes,children:A[Do].children};if(A[Do].failingNode){const t=A[Do].failingNode[ko]();t&&(A.layout.endsWith("-tb")?e.children.push(Wc(A,[t])):e.children.push(t))}return 0===e.children.length?null:e}function Oc(A,e,t){const i=A[Do],a=i.availableSpace,[s,n,g,r]=t;switch(A.layout){case"position":i.width=Math.max(i.width,s+g),i.height=Math.max(i.height,n+r),i.children.push(e);break;case"lr-tb":case"rl-tb":i.line&&1!==i.attempt||(i.line=Wc(A,[]),i.children.push(i.line),i.numberInLine=0),i.numberInLine+=1,i.line.children.push(e),0===i.attempt?(i.currentWidth+=g,i.height=Math.max(i.height,i.prevHeight+r)):(i.currentWidth=g,i.prevHeight=i.height,i.height+=r,i.attempt=0),i.width=Math.max(i.width,i.currentWidth);break;case"rl-row":case"row":{i.children.push(e),i.width+=g,i.height=Math.max(i.height,r);const A=Fc(i.height);for(const e of i.children)e.attributes.style.height=A;break}case"table":case"tb":i.width=Math.min(a.width,Math.max(i.width,g)),i.height+=r,i.children.push(e)}}function Xc(A){const e=A[Do].availableSpace,t=A.margin?A.margin.topInset+A.margin.bottomInset:0,i=A.margin?A.margin.leftInset+A.margin.rightInset:0;switch(A.layout){case"lr-tb":case"rl-tb":return 0===A[Do].attempt?{width:e.width-i-A[Do].currentWidth,height:e.height-t-A[Do].prevHeight}:{width:e.width-i,height:e.height-t-A[Do].height};case"rl-row":case"row":return{width:A[Do].columnWidths.slice(A[Do].currentColumn).reduce(((A,e)=>A+e)),height:e.height-i};case"table":case"tb":return{width:e.width-i,height:e.height-t-A[Do].height};default:return e}}function Vc(A,e){if(null===A[qo]()[Do].firstUnsplittable)return!0;if(0===A.w||0===A.h)return!0;const t=A[vo](),i=t[Do]?.attempt||0,[,a,s,n]=function(A){let e,t,i=""===A.w?NaN:A.w,a=""===A.h?NaN:A.h,[s,n]=[0,0];switch(A.anchorType||""){case"bottomCenter":[s,n]=[i/2,a];break;case"bottomLeft":[s,n]=[0,a];break;case"bottomRight":[s,n]=[i,a];break;case"middleCenter":[s,n]=[i/2,a/2];break;case"middleLeft":[s,n]=[0,a/2];break;case"middleRight":[s,n]=[i,a/2];break;case"topCenter":[s,n]=[i/2,0];break;case"topRight":[s,n]=[i,0]}switch(A.rotate||0){case 0:[e,t]=[-s,-n];break;case 90:[e,t]=[-n,s],[i,a]=[a,-i];break;case 180:[e,t]=[s,n],[i,a]=[-i,-a];break;case 270:[e,t]=[n,-s],[i,a]=[-a,i]}return[A.x+e+Math.min(0,i),A.y+t+Math.min(0,a),Math.abs(i),Math.abs(a)]}(A);switch(t.layout){case"lr-tb":case"rl-tb":return 0===i?A[qo]()[Do].noLayoutFailure?""!==A.w?Math.round(s-e.width)<=2:e.width>2:!(""!==A.h&&Math.round(n-e.height)>2)&&(""!==A.w?Math.round(s-e.width)<=2||0===t[Do].numberInLine&&e.height>2:e.width>2):!!A[qo]()[Do].noLayoutFailure||!(""!==A.h&&Math.round(n-e.height)>2)&&(""===A.w||Math.round(s-e.width)<=2||!t[AI]())&&e.height>2;case"table":case"tb":return!!A[qo]()[Do].noLayoutFailure||(""===A.h||A[$o]()?(""===A.w||Math.round(s-e.width)<=2||!t[AI]())&&e.height>2:Math.round(n-e.height)<=2);case"position":return!!A[qo]()[Do].noLayoutFailure||(""===A.h||Math.round(n+a-e.height)<=2||n+a>A[qo]()[Do].currentContentArea.h);case"rl-row":case"row":return!!A[qo]()[Do].noLayoutFailure||""===A.h||Math.round(n-e.height)<=2;default:return!0}}const jc=FI.template.id,zc="http://www.w3.org/2000/svg",_c=/^H(\d+)$/,$c=new Set(["image/gif","image/jpeg","image/jpg","image/pjpeg","image/png","image/apng","image/x-png","image/bmp","image/x-ms-bmp","image/tiff","image/tif","application/octet-stream"]),AC=[[[66,77],"image/bmp"],[[255,216,255],"image/jpeg"],[[73,73,42,0],"image/tiff"],[[77,77,0,42],"image/tiff"],[[71,73,70,56,57,97],"image/gif"],[[137,80,78,71,13,10,26,10],"image/png"]];function eC(A){if(!A||!A.border)return{w:0,h:0};const e=A.border[Mo]();return e?{w:e.widths[0]+e.widths[2]+e.insets[0]+e.insets[2],h:e.widths[1]+e.widths[3]+e.insets[1]+e.insets[3]}:{w:0,h:0}}function tC(A){return A.margin&&(A.margin.topInset||A.margin.rightInset||A.margin.bottomInset||A.margin.leftInset)}function iC(A,e){if(!A.value){const e=new Eh({});A[ho](e),A.value=e}A.value[dI](e)}function*aC(A){for(const e of A[Jo]())e instanceof ih?yield*e[Ho]():yield e}function sC(A){return"error"===A.validate?.nullTest}function nC(A){for(;A;){if(!A.traversal)return void(A[fI]=A[Ko]()[fI]);if(A[fI])return;let e=null;for(const t of A.traversal[Jo]())if("next"===t.operation){e=t;break}if(!e||!e.ref)return void(A[fI]=A[Ko]()[fI]);const t=A[qo]();A[fI]=++t[fI];const i=t[lI](e.ref,A);if(!i)return;A=i[0]}}function gC(A,e){const t=A.assist;if(t){const A=t[yI]();A&&(e.title=A);const i=t.role.match(_c);if(i){const A="heading",t=i[1];e.role=A,e["aria-level"]=t}}if("table"===A.layout)e.role="table";else if("row"===A.layout)e.role="row";else{const t=A[Ko]();"row"===t.layout&&(e.role="TH"===t.assist?.role?"columnheader":"cell")}}function rC(A){if(!A.assist)return null;const e=A.assist;return e.speak&&""!==e.speak[mo]?e.speak[mo]:e.toolTip?e.toolTip[mo]:null}function oC(A){return YI.success({name:"div",attributes:{class:["xfaRich"],style:Object.create(null)},children:[{name:"span",attributes:{style:Object.create(null)},value:A}]})}function IC(A){const e=A[qo]();null===e[Do].firstUnsplittable&&(e[Do].firstUnsplittable=A,e[Do].noLayoutFailure=!0)}function cC(A){const e=A[qo]();e[Do].firstUnsplittable===A&&(e[Do].noLayoutFailure=!1)}function CC(A){if(A[Do])return!1;if(A[Do]=Object.create(null),"auto"===A.targetType)return!1;const e=A[qo]();let t=null;if(A.target){if(t=e[lI](A.target,A[Ko]()),!t)return!1;t=t[0]}const{currentPageArea:i,currentContentArea:a}=e[Do];if("pageArea"===A.targetType)return t instanceof LB||(t=null),A.startNew?(A[Do].target=t||i,!0):!(!t||t===i||(A[Do].target=t,0));t instanceof JC||(t=null);const s=t&&t[Ko]();let n,g=s;if(A.startNew)if(t){const A=s.contentArea.children,e=A.indexOf(a),i=A.indexOf(t);-1!==e&&eA,i[Do].noLayoutFailure=!0;const n=e[yI](t);A[Bo](n.html,n.bbox),i[Do].noLayoutFailure=a,e[vo]=s}class hC extends wc{constructor(A){super(jc,"appearanceFilter"),this.id=A.id||"",this.type=MI(A.type,["optional","required"]),this.use=A.use||"",this.usehref=A.usehref||""}}class QC extends uc{constructor(A){super(jc,"arc",!0),this.circular=NI({data:A.circular,defaultValue:0,validate:A=>1===A}),this.hand=MI(A.hand,["even","left","right"]),this.id=A.id||"",this.startAngle=xI({data:A.startAngle,defaultValue:0,validate:A=>!0}),this.sweepAngle=xI({data:A.sweepAngle,defaultValue:360,validate:A=>!0}),this.use=A.use||"",this.usehref=A.usehref||"",this.edge=null,this.fill=null}[yI](){const A=this.edge||new XC({}),e=A[DI](),t=Object.create(null);let i;"visible"===this.fill?.presence?Object.assign(t,this.fill[DI]()):t.fill="transparent",t.strokeWidth=Fc("visible"===A.presence?A.thickness:0),t.stroke=e.color;const a={xmlns:zc,style:{width:"100%",height:"100%",overflow:"visible"}};if(360===this.sweepAngle)i={name:"ellipse",attributes:{xmlns:zc,cx:"50%",cy:"50%",rx:"50%",ry:"50%",style:t}};else{const A=this.startAngle*Math.PI/180,e=this.sweepAngle*Math.PI/180,s=this.sweepAngle>180?1:0,[n,g,r,o]=[50*(1+Math.cos(A)),50*(1-Math.sin(A)),50*(1+Math.cos(A+e)),50*(1-Math.sin(A+e))];i={name:"path",attributes:{xmlns:zc,d:`M ${n} ${g} A 50 50 0 ${s} 0 ${r} ${o}`,vectorEffect:"non-scaling-stroke",style:t}},Object.assign(a,{viewBox:"0 0 100 100",preserveAspectRatio:"none"})}const s={name:"svg",children:[i],attributes:a};return tC(this[Ko]()[Ko]())?YI.success({name:"div",attributes:{style:{display:"inline",width:"100%",height:"100%"}},children:[s]}):(s.attributes.style.position="absolute",YI.success(s))}}class lC extends uc{constructor(A){super(jc,"area",!0),this.colSpan=NI({data:A.colSpan,defaultValue:1,validate:A=>A>=1||-1===A}),this.id=A.id||"",this.name=A.name||"",this.relevant=HI(A.relevant),this.use=A.use||"",this.usehref=A.usehref||"",this.x=LI(A.x,"0pt"),this.y=LI(A.y,"0pt"),this.desc=null,this.extras=null,this.area=new dc,this.draw=new dc,this.exObject=new dc,this.exclGroup=new dc,this.field=new dc,this.subform=new dc,this.subformSet=new dc}*[Ho](){yield*aC(this)}[eI](){return!0}[Vo](){return!0}[Bo](A,e){const[t,i,a,s]=e;this[Do].width=Math.max(this[Do].width,t+a),this[Do].height=Math.max(this[Do].height,i+s),this[Do].children.push(A)}[Ro](){return this[Do].availableSpace}[yI](A){const e=Lc(this,"position"),t={style:e,id:this[bI],class:["xfaArea"]};vc(this)&&t.class.push("xfaPrintOnly"),this.name&&(t.xfaName=this.name);const i=[];this[Do]={children:i,width:0,height:0,availableSpace:A};const a=this[Qo]({filter:new Set(["area","draw","field","exclGroup","subform","subformSet"]),include:!0});if(!a.success)return a.isBreak()?a:(delete this[Do],YI.FAILURE);e.width=Fc(this[Do].width),e.height=Fc(this[Do].height);const s={name:"div",attributes:t,children:i},n=[this.x,this.y,this[Do].width,this[Do].height];return delete this[Do],YI.success(s,n)}}class EC extends uc{constructor(A){super(jc,"assist",!0),this.id=A.id||"",this.role=A.role||"",this.use=A.use||"",this.usehref=A.usehref||"",this.speak=null,this.toolTip=null}[yI](){return this.toolTip?.[mo]||null}}class uC extends uc{constructor(A){super(jc,"barcode",!0),this.charEncoding=UI({data:A.charEncoding?A.charEncoding.toLowerCase():"",defaultValue:"",validate:A=>["utf-8","big-five","fontspecific","gbk","gb-18030","gb-2312","ksc-5601","none","shift-jis","ucs-2","utf-16"].includes(A)||A.match(/iso-8859-\d{2}/)}),this.checksum=MI(A.checksum,["none","1mod10","1mod10_1mod11","2mod10","auto"]),this.dataColumnCount=NI({data:A.dataColumnCount,defaultValue:-1,validate:A=>A>=0}),this.dataLength=NI({data:A.dataLength,defaultValue:-1,validate:A=>A>=0}),this.dataPrep=MI(A.dataPrep,["none","flateCompress"]),this.dataRowCount=NI({data:A.dataRowCount,defaultValue:-1,validate:A=>A>=0}),this.endChar=A.endChar||"",this.errorCorrectionLevel=NI({data:A.errorCorrectionLevel,defaultValue:-1,validate:A=>A>=0&&A<=8}),this.id=A.id||"",this.moduleHeight=LI(A.moduleHeight,"5mm"),this.moduleWidth=LI(A.moduleWidth,"0.25mm"),this.printCheckDigit=NI({data:A.printCheckDigit,defaultValue:0,validate:A=>1===A}),this.rowColumnRatio=JI(A.rowColumnRatio),this.startChar=A.startChar||"",this.textLocation=MI(A.textLocation,["below","above","aboveEmbedded","belowEmbedded","none"]),this.truncate=NI({data:A.truncate,defaultValue:0,validate:A=>1===A}),this.type=MI(A.type?A.type.toLowerCase():"",["aztec","codabar","code2of5industrial","code2of5interleaved","code2of5matrix","code2of5standard","code3of9","code3of9extended","code11","code49","code93","code128","code128a","code128b","code128c","code128sscc","datamatrix","ean8","ean8add2","ean8add5","ean13","ean13add2","ean13add5","ean13pwcd","fim","logmars","maxicode","msi","pdf417","pdf417macro","plessey","postauscust2","postauscust3","postausreplypaid","postausstandard","postukrm4scc","postusdpbc","postusimb","postusstandard","postus5zip","qrcode","rfid","rss14","rss14expanded","rss14limited","rss14stacked","rss14stackedomni","rss14truncated","telepen","ucc128","ucc128random","ucc128sscc","upca","upcaadd2","upcaadd5","upcapwcd","upce","upceadd2","upceadd5","upcean2","upcean5","upsmaxicode"]),this.upsMode=MI(A.upsMode,["usCarrier","internationalCarrier","secureSymbol","standardSymbol"]),this.use=A.use||"",this.usehref=A.usehref||"",this.wideNarrowRatio=JI(A.wideNarrowRatio),this.encrypt=null,this.extras=null}}class dC extends uc{constructor(A){super(jc,"bind",!0),this.match=MI(A.match,["once","dataRef","global","none"]),this.ref=A.ref||"",this.picture=null}}class fC extends uc{constructor(A){super(jc,"bindItems"),this.connection=A.connection||"",this.labelRef=A.labelRef||"",this.ref=A.ref||"",this.valueRef=A.valueRef||""}}class pC extends uc{constructor(A){super(jc,"bookend"),this.id=A.id||"",this.leader=A.leader||"",this.trailer=A.trailer||"",this.use=A.use||"",this.usehref=A.usehref||""}}class mC extends bc{constructor(A){super(jc,"boolean"),this.id=A.id||"",this.name=A.name||"",this.use=A.use||"",this.usehref=A.usehref||""}[yI](A){return oC(1===this[mo]?"1":"0")}}class yC extends uc{constructor(A){super(jc,"border",!0),this.break=MI(A.break,["close","open"]),this.hand=MI(A.hand,["even","left","right"]),this.id=A.id||"",this.presence=MI(A.presence,["visible","hidden","inactive","invisible"]),this.relevant=HI(A.relevant),this.use=A.use||"",this.usehref=A.usehref||"",this.corner=new dc(4),this.edge=new dc(4),this.extras=null,this.fill=null,this.margin=null}[Mo](){if(!this[Do]){const A=this.edge.children.slice();if(A.length<4){const e=A.at(-1)||new XC({});for(let t=A.length;t<4;t++)A.push(e)}const e=A.map((A=>A.thickness)),t=[0,0,0,0];this.margin&&(t[0]=this.margin.topInset,t[1]=this.margin.rightInset,t[2]=this.margin.bottomInset,t[3]=this.margin.leftInset),this[Do]={widths:e,insets:t,edges:A}}return this[Do]}[DI](){const{edges:A}=this[Mo](),e=A.map((A=>{const e=A[DI]();return e.color||="#000000",e})),t=Object.create(null);if(this.margin&&Object.assign(t,this.margin[DI]()),"visible"===this.fill?.presence&&Object.assign(t,this.fill[DI]()),this.corner.children.some((A=>0!==A.radius))){const A=this.corner.children.map((A=>A[DI]()));if(2===A.length||3===A.length){const e=A.at(-1);for(let t=A.length;t<4;t++)A.push(e)}t.borderRadius=A.map((A=>A.radius)).join(" ")}switch(this.presence){case"invisible":case"hidden":t.borderStyle="";break;case"inactive":t.borderStyle="none";break;default:t.borderStyle=e.map((A=>A.style)).join(" ")}return t.borderWidth=e.map((A=>A.width)).join(" "),t.borderColor=e.map((A=>A.color)).join(" "),t}}class wC extends uc{constructor(A){super(jc,"break",!0),this.after=MI(A.after,["auto","contentArea","pageArea","pageEven","pageOdd"]),this.afterTarget=A.afterTarget||"",this.before=MI(A.before,["auto","contentArea","pageArea","pageEven","pageOdd"]),this.beforeTarget=A.beforeTarget||"",this.bookendLeader=A.bookendLeader||"",this.bookendTrailer=A.bookendTrailer||"",this.id=A.id||"",this.overflowLeader=A.overflowLeader||"",this.overflowTarget=A.overflowTarget||"",this.overflowTrailer=A.overflowTrailer||"",this.startNew=NI({data:A.startNew,defaultValue:0,validate:A=>1===A}),this.use=A.use||"",this.usehref=A.usehref||"",this.extras=null}}class DC extends uc{constructor(A){super(jc,"breakAfter",!0),this.id=A.id||"",this.leader=A.leader||"",this.startNew=NI({data:A.startNew,defaultValue:0,validate:A=>1===A}),this.target=A.target||"",this.targetType=MI(A.targetType,["auto","contentArea","pageArea"]),this.trailer=A.trailer||"",this.use=A.use||"",this.usehref=A.usehref||"",this.script=null}}class bC extends uc{constructor(A){super(jc,"breakBefore",!0),this.id=A.id||"",this.leader=A.leader||"",this.startNew=NI({data:A.startNew,defaultValue:0,validate:A=>1===A}),this.target=A.target||"",this.targetType=MI(A.targetType,["auto","contentArea","pageArea"]),this.trailer=A.trailer||"",this.use=A.use||"",this.usehref=A.usehref||"",this.script=null}[yI](A){return this[Do]={},YI.FAILURE}}class kC extends uc{constructor(A){super(jc,"button",!0),this.highlight=MI(A.highlight,["inverted","none","outline","push"]),this.id=A.id||"",this.use=A.use||"",this.usehref=A.usehref||"",this.extras=null}[yI](A){const e=this[Ko]()[Ko](),t={name:"button",attributes:{id:this[bI],class:["xfaButton"],style:{}},children:[]};for(const A of e.event.children){if("click"!==A.activity||!A.script)continue;const e=zA(A.script[mo]);if(!e)continue;const i=Pc(e.url);i&&t.children.push({name:"a",attributes:{id:"link"+this[bI],href:i,newWindow:e.newWindow,class:["xfaLink"],style:{}},children:[]})}return YI.success(t)}}class FC extends uc{constructor(A){super(jc,"calculate",!0),this.id=A.id||"",this.override=MI(A.override,["disabled","error","ignore","warning"]),this.use=A.use||"",this.usehref=A.usehref||"",this.extras=null,this.message=null,this.script=null}}class SC extends uc{constructor(A){super(jc,"caption",!0),this.id=A.id||"",this.placement=MI(A.placement,["left","bottom","inline","right","top"]),this.presence=MI(A.presence,["visible","hidden","inactive","invisible"]),this.reserve=Math.ceil(LI(A.reserve)),this.use=A.use||"",this.usehref=A.usehref||"",this.extras=null,this.font=null,this.margin=null,this.para=null,this.value=null}[dI](A){iC(this,A)}[Mo](A){if(!this[Do]){let{width:e,height:t}=A;switch(this.placement){case"left":case"right":case"inline":e=this.reserve<=0?e:this.reserve;break;case"top":case"bottom":t=this.reserve<=0?t:this.reserve}this[Do]=Nc(this,{width:e,height:t})}return this[Do]}[yI](A){if(!this.value)return YI.EMPTY;this[CI]();const e=this.value[yI](A).html;if(!e)return this[cI](),YI.EMPTY;const t=this.reserve;if(this.reserve<=0){const{w:e,h:t}=this[Mo](A);switch(this.placement){case"left":case"right":case"inline":this.reserve=e;break;case"top":case"bottom":this.reserve=t}}const i=[];"string"==typeof e?i.push({name:"#text",value:e}):i.push(e);const a=Lc(this,"font","margin","visibility");switch(this.placement){case"left":case"right":this.reserve>0&&(a.width=Fc(this.reserve));break;case"top":case"bottom":this.reserve>0&&(a.height=Fc(this.reserve))}return qc(this,null,e),this[cI](),this.reserve=t,YI.success({name:"div",attributes:{style:a,class:["xfaCaption"]},children:i})}}class RC extends wc{constructor(A){super(jc,"certificate"),this.id=A.id||"",this.name=A.name||"",this.use=A.use||"",this.usehref=A.usehref||""}}class GC extends uc{constructor(A){super(jc,"certificates",!0),this.credentialServerPolicy=MI(A.credentialServerPolicy,["optional","required"]),this.id=A.id||"",this.url=A.url||"",this.urlPolicy=A.urlPolicy||"",this.use=A.use||"",this.usehref=A.usehref||"",this.encryption=null,this.issuers=null,this.keyUsage=null,this.oids=null,this.signing=null,this.subjectDNs=null}}class NC extends uc{constructor(A){super(jc,"checkButton",!0),this.id=A.id||"",this.mark=MI(A.mark,["default","check","circle","cross","diamond","square","star"]),this.shape=MI(A.shape,["square","round"]),this.size=LI(A.size,"10pt"),this.use=A.use||"",this.usehref=A.usehref||"",this.border=null,this.extras=null,this.margin=null}[yI](A){const e=Lc("margin"),t=Fc(this.size);let i,a,s;e.width=e.height=t;const n=this[Ko]()[Ko](),g=n.items.children.length&&n.items.children[0][yI]().html||[],r={on:(void 0!==g[0]?g[0]:"on").toString(),off:(void 0!==g[1]?g[1]:"off").toString()},o=(n.value?.[pI]()||"off")===r.on||void 0,I=n[vo](),c=n[bI];let C;I instanceof sB?(s=I[bI],i="radio",a="xfaRadio",C=I[yo]?.[bI]||I[bI]):(i="checkbox",a="xfaCheckbox",C=n[yo]?.[bI]||n[bI]);const B={name:"input",attributes:{class:[a],style:e,fieldId:c,dataId:C,type:i,checked:o,xfaOn:r.on,xfaOff:r.off,"aria-label":rC(n),"aria-required":!1}};return s&&(B.attributes.name=s),sC(n)&&(B.attributes["aria-required"]=!0,B.attributes.required=!0),YI.success({name:"label",attributes:{class:["xfaLabel"]},children:[B]})}}class xC extends uc{constructor(A){super(jc,"choiceList",!0),this.commitOn=MI(A.commitOn,["select","exit"]),this.id=A.id||"",this.open=MI(A.open,["userControl","always","multiSelect","onEntry"]),this.textEntry=NI({data:A.textEntry,defaultValue:0,validate:A=>1===A}),this.use=A.use||"",this.usehref=A.usehref||"",this.border=null,this.extras=null,this.margin=null}[yI](A){const e=Lc(this,"border","margin"),t=this[Ko]()[Ko](),i={fontSize:`calc(${t.font?.size||10}px * var(--scale-factor))`},a=[];if(t.items.children.length>0){const A=t.items;let e=0,s=0;2===A.children.length&&(e=A.children[0].save,s=1-e);const n=A.children[e][yI]().html,g=A.children[s][yI]().html;let r=!1;const o=t.value?.[pI]()||"";for(let A=0,e=n.length;AMath.min(Math.max(0,parseInt(A.trim(),10)),255))).map((A=>isNaN(A)?0:A));return s.length<3||([t,i,a]=s),{r:t,g:i,b:a}}(A.value):"",this.extras=null}[Po](){return!1}[DI](){return this.value?j.makeHexColor(this.value.r,this.value.g,this.value.b):null}}class MC extends uc{constructor(A){super(jc,"comb"),this.id=A.id||"",this.numberOfCells=NI({data:A.numberOfCells,defaultValue:0,validate:A=>A>=0}),this.use=A.use||"",this.usehref=A.usehref||""}}class LC extends uc{constructor(A){super(jc,"connect",!0),this.connection=A.connection||"",this.id=A.id||"",this.ref=A.ref||"",this.usage=MI(A.usage,["exportAndImport","exportOnly","importOnly"]),this.use=A.use||"",this.usehref=A.usehref||"",this.picture=null}}class JC extends uc{constructor(A){super(jc,"contentArea",!0),this.h=LI(A.h),this.id=A.id||"",this.name=A.name||"",this.relevant=HI(A.relevant),this.use=A.use||"",this.usehref=A.usehref||"",this.w=LI(A.w),this.x=LI(A.x,"0pt"),this.y=LI(A.y,"0pt"),this.desc=null,this.extras=null}[yI](A){const e={left:Fc(this.x),top:Fc(this.y),width:Fc(this.w),height:Fc(this.h)},t=["xfaContentarea"];return vc(this)&&t.push("xfaPrintOnly"),YI.success({name:"div",children:[],attributes:{style:e,class:t,id:this[bI]}})}}class HC extends uc{constructor(A){super(jc,"corner",!0),this.id=A.id||"",this.inverted=NI({data:A.inverted,defaultValue:0,validate:A=>1===A}),this.join=MI(A.join,["square","round"]),this.presence=MI(A.presence,["visible","hidden","inactive","invisible"]),this.radius=LI(A.radius),this.stroke=MI(A.stroke,["solid","dashDot","dashDotDot","dashed","dotted","embossed","etched","lowered","raised"]),this.thickness=LI(A.thickness,"0.5pt"),this.use=A.use||"",this.usehref=A.usehref||"",this.color=null,this.extras=null}[DI](){const A=Lc(this,"visibility");return A.radius=Fc("square"===this.join?0:this.radius),A}}class YC extends mc{constructor(A){super(jc,"date"),this.id=A.id||"",this.name=A.name||"",this.use=A.use||"",this.usehref=A.usehref||""}[bo](){const A=this[mo].trim();this[mo]=A?new Date(A):null}[yI](A){return oC(this[mo]?this[mo].toString():"")}}class vC extends mc{constructor(A){super(jc,"dateTime"),this.id=A.id||"",this.name=A.name||"",this.use=A.use||"",this.usehref=A.usehref||""}[bo](){const A=this[mo].trim();this[mo]=A?new Date(A):null}[yI](A){return oC(this[mo]?this[mo].toString():"")}}class KC extends uc{constructor(A){super(jc,"dateTimeEdit",!0),this.hScrollPolicy=MI(A.hScrollPolicy,["auto","off","on"]),this.id=A.id||"",this.picker=MI(A.picker,["host","none"]),this.use=A.use||"",this.usehref=A.usehref||"",this.border=null,this.comb=null,this.extras=null,this.margin=null}[yI](A){const e=Lc(this,"border","font","margin"),t=this[Ko]()[Ko](),i={name:"input",attributes:{type:"text",fieldId:t[bI],dataId:t[yo]?.[bI]||t[bI],class:["xfaTextfield"],style:e,"aria-label":rC(t),"aria-required":!1}};return sC(t)&&(i.attributes["aria-required"]=!0,i.attributes.required=!0),YI.success({name:"label",attributes:{class:["xfaLabel"]},children:[i]})}}class qC extends mc{constructor(A){super(jc,"decimal"),this.fracDigits=NI({data:A.fracDigits,defaultValue:2,validate:A=>!0}),this.id=A.id||"",this.leadDigits=NI({data:A.leadDigits,defaultValue:-1,validate:A=>!0}),this.name=A.name||"",this.use=A.use||"",this.usehref=A.usehref||""}[bo](){const A=parseFloat(this[mo].trim());this[mo]=isNaN(A)?null:A}[yI](A){return oC(null!==this[mo]?this[mo].toString():"")}}class TC extends uc{constructor(A){super(jc,"defaultUi",!0),this.id=A.id||"",this.use=A.use||"",this.usehref=A.usehref||"",this.extras=null}}class PC extends uc{constructor(A){super(jc,"desc",!0),this.id=A.id||"",this.use=A.use||"",this.usehref=A.usehref||"",this.boolean=new dc,this.date=new dc,this.dateTime=new dc,this.decimal=new dc,this.exData=new dc,this.float=new dc,this.image=new dc,this.integer=new dc,this.text=new dc,this.time=new dc}}class WC extends yc{constructor(A){super(jc,"digestMethod",["","SHA1","SHA256","SHA512","RIPEMD160"]),this.id=A.id||"",this.use=A.use||"",this.usehref=A.usehref||""}}class ZC extends uc{constructor(A){super(jc,"digestMethods",!0),this.id=A.id||"",this.type=MI(A.type,["optional","required"]),this.use=A.use||"",this.usehref=A.usehref||"",this.digestMethod=new dc}}class OC extends uc{constructor(A){super(jc,"draw",!0),this.anchorType=MI(A.anchorType,["topLeft","bottomCenter","bottomLeft","bottomRight","middleCenter","middleLeft","middleRight","topCenter","topRight"]),this.colSpan=NI({data:A.colSpan,defaultValue:1,validate:A=>A>=1||-1===A}),this.h=A.h?LI(A.h):"",this.hAlign=MI(A.hAlign,["left","center","justify","justifyAll","radix","right"]),this.id=A.id||"",this.locale=A.locale||"",this.maxH=LI(A.maxH,"0pt"),this.maxW=LI(A.maxW,"0pt"),this.minH=LI(A.minH,"0pt"),this.minW=LI(A.minW,"0pt"),this.name=A.name||"",this.presence=MI(A.presence,["visible","hidden","inactive","invisible"]),this.relevant=HI(A.relevant),this.rotate=NI({data:A.rotate,defaultValue:0,validate:A=>A%90==0}),this.use=A.use||"",this.usehref=A.usehref||"",this.w=A.w?LI(A.w):"",this.x=LI(A.x,"0pt"),this.y=LI(A.y,"0pt"),this.assist=null,this.border=null,this.caption=null,this.desc=null,this.extras=null,this.font=null,this.keep=null,this.margin=null,this.para=null,this.traversal=null,this.ui=null,this.value=null,this.setProperty=new dc}[dI](A){iC(this,A)}[yI](A){if(nC(this),"hidden"===this.presence||"inactive"===this.presence)return YI.EMPTY;Uc(this),this[CI]();const e=this.w,t=this.h,{w:i,h:a,isBroken:s}=Nc(this,A);if(i&&""===this.w){if(s&&this[vo]()[AI]())return this[cI](),YI.FAILURE;this.w=i}if(a&&""===this.h&&(this.h=a),IC(this),!Vc(this,A))return this.w=e,this.h=t,this[cI](),YI.FAILURE;cC(this);const n=Lc(this,"font","hAlign","dimensions","position","presence","rotate","anchorType","border","margin");Rc(this,n),n.margin&&(n.padding=n.margin,delete n.margin);const g=["xfaDraw"];this.font&&g.push("xfaFont"),vc(this)&&g.push("xfaPrintOnly");const r={style:n,id:this[bI],class:g};this.name&&(r.xfaName=this.name);const o={name:"div",attributes:r,children:[]};gC(this,r);const I=xc(this,o,A),c=this.value?this.value[yI](A).html:null;return null===c?(this.w=e,this.h=t,this[cI](),YI.success(Jc(this,o),I)):(o.children.push(c),qc(this,n,c),this.w=e,this.h=t,this[cI](),YI.success(Jc(this,o),I))}}class XC extends uc{constructor(A){super(jc,"edge",!0),this.cap=MI(A.cap,["square","butt","round"]),this.id=A.id||"",this.presence=MI(A.presence,["visible","hidden","inactive","invisible"]),this.stroke=MI(A.stroke,["solid","dashDot","dashDotDot","dashed","dotted","embossed","etched","lowered","raised"]),this.thickness=LI(A.thickness,"0.5pt"),this.use=A.use||"",this.usehref=A.usehref||"",this.color=null,this.extras=null}[DI](){const A=Lc(this,"visibility");if(Object.assign(A,{linecap:this.cap,width:Fc(this.thickness),color:this.color?this.color[DI]():"#000000",style:""}),"visible"!==this.presence)A.style="none";else switch(this.stroke){case"solid":A.style="solid";break;case"dashDot":case"dashDotDot":case"dashed":A.style="dashed";break;case"dotted":A.style="dotted";break;case"embossed":A.style="ridge";break;case"etched":A.style="groove";break;case"lowered":A.style="inset";break;case"raised":A.style="outset"}return A}}class VC extends yc{constructor(A){super(jc,"encoding",["adbe.x509.rsa_sha1","adbe.pkcs7.detached","adbe.pkcs7.sha1"]),this.id=A.id||"",this.use=A.use||"",this.usehref=A.usehref||""}}class jC extends uc{constructor(A){super(jc,"encodings",!0),this.id=A.id||"",this.type=MI(A.type,["optional","required"]),this.use=A.use||"",this.usehref=A.usehref||"",this.encoding=new dc}}class zC extends uc{constructor(A){super(jc,"encrypt",!0),this.id=A.id||"",this.use=A.use||"",this.usehref=A.usehref||"",this.certificate=null}}class _C extends uc{constructor(A){super(jc,"encryptData",!0),this.id=A.id||"",this.operation=MI(A.operation,["encrypt","decrypt"]),this.target=A.target||"",this.use=A.use||"",this.usehref=A.usehref||"",this.filter=null,this.manifest=null}}class $C extends uc{constructor(A){super(jc,"encryption",!0),this.id=A.id||"",this.type=MI(A.type,["optional","required"]),this.use=A.use||"",this.usehref=A.usehref||"",this.certificate=new dc}}class AB extends yc{constructor(A){super(jc,"encryptionMethod",["","AES256-CBC","TRIPLEDES-CBC","AES128-CBC","AES192-CBC"]),this.id=A.id||"",this.use=A.use||"",this.usehref=A.usehref||""}}class eB extends uc{constructor(A){super(jc,"encryptionMethods",!0),this.id=A.id||"",this.type=MI(A.type,["optional","required"]),this.use=A.use||"",this.usehref=A.usehref||"",this.encryptionMethod=new dc}}class tB extends uc{constructor(A){super(jc,"event",!0),this.activity=MI(A.activity,["click","change","docClose","docReady","enter","exit","full","indexChange","initialize","mouseDown","mouseEnter","mouseExit","mouseUp","postExecute","postOpen","postPrint","postSave","postSign","postSubmit","preExecute","preOpen","prePrint","preSave","preSign","preSubmit","ready","validationState"]),this.id=A.id||"",this.listen=MI(A.listen,["refOnly","refAndDescendents"]),this.name=A.name||"",this.ref=A.ref||"",this.use=A.use||"",this.usehref=A.usehref||"",this.extras=null,this.encryptData=null,this.execute=null,this.script=null,this.signData=null,this.submit=null}}class iB extends mc{constructor(A){super(jc,"exData"),this.contentType=A.contentType||"",this.href=A.href||"",this.id=A.id||"",this.maxLength=NI({data:A.maxLength,defaultValue:-1,validate:A=>A>=-1}),this.name=A.name||"",this.rid=A.rid||"",this.transferEncoding=MI(A.transferEncoding,["none","base64","package"]),this.use=A.use||"",this.usehref=A.usehref||""}[Xo](){return"text/html"===this.contentType}[gI](A){return("text/html"===this.contentType&&A[aI]===FI.xhtml.id||"text/xml"===this.contentType)&&(this[mo]=A,!0)}[yI](A){return"text/html"===this.contentType&&this[mo]?this[mo][yI](A):YI.EMPTY}}class aB extends uc{constructor(A){super(jc,"exObject",!0),this.archive=A.archive||"",this.classId=A.classId||"",this.codeBase=A.codeBase||"",this.codeType=A.codeType||"",this.id=A.id||"",this.name=A.name||"",this.use=A.use||"",this.usehref=A.usehref||"",this.extras=null,this.boolean=new dc,this.date=new dc,this.dateTime=new dc,this.decimal=new dc,this.exData=new dc,this.exObject=new dc,this.float=new dc,this.image=new dc,this.integer=new dc,this.text=new dc,this.time=new dc}}class sB extends uc{constructor(A){super(jc,"exclGroup",!0),this.access=MI(A.access,["open","nonInteractive","protected","readOnly"]),this.accessKey=A.accessKey||"",this.anchorType=MI(A.anchorType,["topLeft","bottomCenter","bottomLeft","bottomRight","middleCenter","middleLeft","middleRight","topCenter","topRight"]),this.colSpan=NI({data:A.colSpan,defaultValue:1,validate:A=>A>=1||-1===A}),this.h=A.h?LI(A.h):"",this.hAlign=MI(A.hAlign,["left","center","justify","justifyAll","radix","right"]),this.id=A.id||"",this.layout=MI(A.layout,["position","lr-tb","rl-row","rl-tb","row","table","tb"]),this.maxH=LI(A.maxH,"0pt"),this.maxW=LI(A.maxW,"0pt"),this.minH=LI(A.minH,"0pt"),this.minW=LI(A.minW,"0pt"),this.name=A.name||"",this.presence=MI(A.presence,["visible","hidden","inactive","invisible"]),this.relevant=HI(A.relevant),this.use=A.use||"",this.usehref=A.usehref||"",this.w=A.w?LI(A.w):"",this.x=LI(A.x,"0pt"),this.y=LI(A.y,"0pt"),this.assist=null,this.bind=null,this.border=null,this.calculate=null,this.caption=null,this.desc=null,this.extras=null,this.margin=null,this.para=null,this.traversal=null,this.validate=null,this.connect=new dc,this.event=new dc,this.field=new dc,this.setProperty=new dc}[Vo](){return!0}[Po](){return!0}[dI](A){for(const e of this.field.children){if(!e.value){const A=new Eh({});e[ho](A),e.value=A}e.value[dI](A)}}[AI](){return this.layout.endsWith("-tb")&&0===this[Do].attempt&&this[Do].numberInLine>0||this[Ko]()[AI]()}[$o](){const A=this[vo]();return!!A[$o]()&&(void 0!==this[Do]._isSplittable?this[Do]._isSplittable:"position"===this.layout||this.layout.includes("row")?(this[Do]._isSplittable=!1,!1):!(A.layout?.endsWith("-tb")&&0!==A[Do].numberInLine||(this[Do]._isSplittable=!0,0)))}[ko](){return Zc(this)}[Bo](A,e){Oc(this,A,e)}[Ro](){return Xc(this)}[yI](A){if(nC(this),"hidden"===this.presence||"inactive"===this.presence||0===this.h||0===this.w)return YI.EMPTY;Uc(this);const e=[],t={id:this[bI],class:[]};Yc(this,t.class),this[Do]||(this[Do]=Object.create(null)),Object.assign(this[Do],{children:e,attributes:t,attempt:0,line:null,numberInLine:0,availableSpace:{width:Math.min(this.w||1/0,A.width),height:Math.min(this.h||1/0,A.height)},width:0,height:0,prevHeight:0,currentWidth:0});const i=this[$o]();if(i||IC(this),!Vc(this,A))return YI.FAILURE;const a=new Set(["field"]);if(this.layout.includes("row")){const A=this[vo]().columnWidths;Array.isArray(A)&&A.length>0&&(this[Do].columnWidths=A,this[Do].currentColumn=0)}const s=Lc(this,"anchorType","dimensions","position","presence","border","margin","hAlign"),n=["xfaExclgroup"],g=Mc(this);g&&n.push(g),vc(this)&&n.push("xfaPrintOnly"),t.style=s,t.class=n,this.name&&(t.xfaName=this.name),this[CI]();const r="lr-tb"===this.layout||"rl-tb"===this.layout,o=r?2:1;for(;this[Do].attemptA>=1||-1===A}),this.h=A.h?LI(A.h):"",this.hAlign=MI(A.hAlign,["left","center","justify","justifyAll","radix","right"]),this.id=A.id||"",this.locale=A.locale||"",this.maxH=LI(A.maxH,"0pt"),this.maxW=LI(A.maxW,"0pt"),this.minH=LI(A.minH,"0pt"),this.minW=LI(A.minW,"0pt"),this.name=A.name||"",this.presence=MI(A.presence,["visible","hidden","inactive","invisible"]),this.relevant=HI(A.relevant),this.rotate=NI({data:A.rotate,defaultValue:0,validate:A=>A%90==0}),this.use=A.use||"",this.usehref=A.usehref||"",this.w=A.w?LI(A.w):"",this.x=LI(A.x,"0pt"),this.y=LI(A.y,"0pt"),this.assist=null,this.bind=null,this.border=null,this.calculate=null,this.caption=null,this.desc=null,this.extras=null,this.font=null,this.format=null,this.items=new dc(2),this.keep=null,this.margin=null,this.para=null,this.traversal=null,this.ui=null,this.validate=null,this.value=null,this.bindItems=new dc,this.connect=new dc,this.event=new dc,this.setProperty=new dc}[Vo](){return!0}[dI](A){iC(this,A)}[yI](A){if(nC(this),!this.ui){let A;switch(this.ui=new Qh({}),this.ui[To]=this[To],this[ho](this.ui),this.items.children.length){case 0:A=new oh({}),this.ui.textEdit=A;break;case 1:A=new NC({}),this.ui.checkButton=A;break;case 2:A=new xC({}),this.ui.choiceList=A}this.ui[ho](A)}if(!this.ui||"hidden"===this.presence||"inactive"===this.presence||0===this.h||0===this.w)return YI.EMPTY;this.caption&&delete this.caption[Do],this[CI]();const e=this.caption?this.caption[yI](A).html:null,t=this.w,i=this.h;let a=0,s=0;this.margin&&(a=this.margin.leftInset+this.margin.rightInset,s=this.margin.topInset+this.margin.bottomInset);let n=null;if(""===this.w||""===this.h){let e=null,t=null,i=0,g=0;if(this.ui.checkButton)i=g=this.ui.checkButton.size;else{const{w:e,h:t}=Nc(this,A);null!==e?(i=e,g=t):g=function(A,e=!1){let t=null;if(A){const e=GI(A.typeface),i=A[To].fontFinder.find(e);t=KI(A,i)}if(!t)return{lineHeight:12,lineGap:2,lineNoGap:10};const i=A.size||10,a=t.lineHeight?Math.max(e?0:1.2,t.lineHeight):1.2,s=void 0===t.lineGap?.2:t.lineGap;return{lineHeight:a*i,lineGap:s*i,lineNoGap:Math.max(1,a-s)*i}}(this.font,!0).lineNoGap}if(n=eC(this.ui[Mo]()),i+=n.w,g+=n.h,this.caption){const{w:a,h:s,isBroken:n}=this.caption[Mo](A);if(n&&this[vo]()[AI]())return this[cI](),YI.FAILURE;switch(e=a,t=s,this.caption.placement){case"left":case"right":case"inline":e+=i;break;case"top":case"bottom":t+=g}}else e=i,t=g;e&&""===this.w&&(e+=a,this.w=Math.min(this.maxW<=0?1/0:this.maxW,this.minW+1A>=1&&A<=5}),this.appearanceFilter=null,this.certificates=null,this.digestMethods=null,this.encodings=null,this.encryptionMethods=null,this.handler=null,this.lockDocument=null,this.mdp=null,this.reasons=null,this.timeStamp=null}}class cB extends mc{constructor(A){super(jc,"float"),this.id=A.id||"",this.name=A.name||"",this.use=A.use||"",this.usehref=A.usehref||""}[bo](){const A=parseFloat(this[mo].trim());this[mo]=isNaN(A)?null:A}[yI](A){return oC(null!==this[mo]?this[mo].toString():"")}}class CB extends uc{constructor(A){super(jc,"font",!0),this.baselineShift=LI(A.baselineShift),this.fontHorizontalScale=xI({data:A.fontHorizontalScale,defaultValue:100,validate:A=>A>=0}),this.fontVerticalScale=xI({data:A.fontVerticalScale,defaultValue:100,validate:A=>A>=0}),this.id=A.id||"",this.kerningMode=MI(A.kerningMode,["none","pair"]),this.letterSpacing=LI(A.letterSpacing,"0"),this.lineThrough=NI({data:A.lineThrough,defaultValue:0,validate:A=>1===A||2===A}),this.lineThroughPeriod=MI(A.lineThroughPeriod,["all","word"]),this.overline=NI({data:A.overline,defaultValue:0,validate:A=>1===A||2===A}),this.overlinePeriod=MI(A.overlinePeriod,["all","word"]),this.posture=MI(A.posture,["normal","italic"]),this.size=LI(A.size,"10pt"),this.typeface=A.typeface||"Courier",this.underline=NI({data:A.underline,defaultValue:0,validate:A=>1===A||2===A}),this.underlinePeriod=MI(A.underlinePeriod,["all","word"]),this.use=A.use||"",this.usehref=A.usehref||"",this.weight=MI(A.weight,["normal","bold"]),this.extras=null,this.fill=null}[lo](A){super[lo](A),this[To].usedTypefaces.add(this.typeface)}[DI](){const A=Lc(this,"fill"),e=A.color;return e&&("#000000"===e?delete A.color:e.startsWith("#")||(A.background=e,A.backgroundClip="text",A.color="transparent")),this.baselineShift&&(A.verticalAlign=Fc(this.baselineShift)),A.fontKerning="none"===this.kerningMode?"none":"normal",A.letterSpacing=Fc(this.letterSpacing),0!==this.lineThrough&&(A.textDecoration="line-through",2===this.lineThrough&&(A.textDecorationStyle="double")),0!==this.overline&&(A.textDecoration="overline",2===this.overline&&(A.textDecorationStyle="double")),A.fontStyle=this.posture,A.fontSize=Fc(.99*this.size),Tc(this,this,this[To].fontFinder,A),0!==this.underline&&(A.textDecoration="underline",2===this.underline&&(A.textDecorationStyle="double")),A.fontWeight=this.weight,A}}class BB extends uc{constructor(A){super(jc,"format",!0),this.id=A.id||"",this.use=A.use||"",this.usehref=A.usehref||"",this.extras=null,this.picture=null}}class hB extends wc{constructor(A){super(jc,"handler"),this.id=A.id||"",this.type=MI(A.type,["optional","required"]),this.use=A.use||"",this.usehref=A.usehref||""}}class QB extends uc{constructor(A){super(jc,"hyphenation"),this.excludeAllCaps=NI({data:A.excludeAllCaps,defaultValue:0,validate:A=>1===A}),this.excludeInitialCap=NI({data:A.excludeInitialCap,defaultValue:0,validate:A=>1===A}),this.hyphenate=NI({data:A.hyphenate,defaultValue:0,validate:A=>1===A}),this.id=A.id||"",this.pushCharacterCount=NI({data:A.pushCharacterCount,defaultValue:3,validate:A=>A>=0}),this.remainCharacterCount=NI({data:A.remainCharacterCount,defaultValue:3,validate:A=>A>=0}),this.use=A.use||"",this.usehref=A.usehref||"",this.wordCharacterCount=NI({data:A.wordCharacterCount,defaultValue:7,validate:A=>A>=0})}}class lB extends wc{constructor(A){super(jc,"image"),this.aspect=MI(A.aspect,["fit","actual","height","none","width"]),this.contentType=A.contentType||"",this.href=A.href||"",this.id=A.id||"",this.name=A.name||"",this.transferEncoding=MI(A.transferEncoding,["base64","none","package"]),this.use=A.use||"",this.usehref=A.usehref||""}[yI](){if(this.contentType&&!$c.has(this.contentType.toLowerCase()))return YI.EMPTY;let A=this[To].images&&this[To].images.get(this.href);if(!A&&(this.href||!this[mo]))return YI.EMPTY;if(A||"base64"!==this.transferEncoding||(A=W(atob(this[mo]))),!A)return YI.EMPTY;if(!this.contentType){for(const[e,t]of AC)if(A.length>e.length&&e.every(((e,t)=>e===A[t]))){this.contentType=t;break}if(!this.contentType)return YI.EMPTY}const e=new Blob([A],{type:this.contentType});let t;switch(this.aspect){case"fit":case"actual":break;case"height":t={height:"100%",objectFit:"fill"};break;case"none":t={width:"100%",height:"100%",objectFit:"fill"};break;case"width":t={width:"100%",objectFit:"fill"}}const i=this[Ko]();return YI.success({name:"img",attributes:{class:["xfaImage"],style:t,src:URL.createObjectURL(e),alt:i?rC(i[Ko]()):null}})}}class EB extends uc{constructor(A){super(jc,"imageEdit",!0),this.data=MI(A.data,["link","embed"]),this.id=A.id||"",this.use=A.use||"",this.usehref=A.usehref||"",this.border=null,this.extras=null,this.margin=null}[yI](A){return"embed"===this.data?YI.success({name:"div",children:[],attributes:{}}):YI.EMPTY}}class uB extends mc{constructor(A){super(jc,"integer"),this.id=A.id||"",this.name=A.name||"",this.use=A.use||"",this.usehref=A.usehref||""}[bo](){const A=parseInt(this[mo].trim(),10);this[mo]=isNaN(A)?null:A}[yI](A){return oC(null!==this[mo]?this[mo].toString():"")}}class dB extends uc{constructor(A){super(jc,"issuers",!0),this.id=A.id||"",this.type=MI(A.type,["optional","required"]),this.use=A.use||"",this.usehref=A.usehref||"",this.certificate=new dc}}class fB extends uc{constructor(A){super(jc,"items",!0),this.id=A.id||"",this.name=A.name||"",this.presence=MI(A.presence,["visible","hidden","inactive","invisible"]),this.ref=A.ref||"",this.save=NI({data:A.save,defaultValue:0,validate:A=>1===A}),this.use=A.use||"",this.usehref=A.usehref||"",this.boolean=new dc,this.date=new dc,this.dateTime=new dc,this.decimal=new dc,this.exData=new dc,this.float=new dc,this.image=new dc,this.integer=new dc,this.text=new dc,this.time=new dc}[yI](){const A=[];for(const e of this[Jo]())A.push(e[pI]());return YI.success(A)}}class pB extends uc{constructor(A){super(jc,"keep",!0),this.id=A.id||"";const e=["none","contentArea","pageArea"];this.intact=MI(A.intact,e),this.next=MI(A.next,e),this.previous=MI(A.previous,e),this.use=A.use||"",this.usehref=A.usehref||"",this.extras=null}}class mB extends uc{constructor(A){super(jc,"keyUsage");const e=["","yes","no"];this.crlSign=MI(A.crlSign,e),this.dataEncipherment=MI(A.dataEncipherment,e),this.decipherOnly=MI(A.decipherOnly,e),this.digitalSignature=MI(A.digitalSignature,e),this.encipherOnly=MI(A.encipherOnly,e),this.id=A.id||"",this.keyAgreement=MI(A.keyAgreement,e),this.keyCertSign=MI(A.keyCertSign,e),this.keyEncipherment=MI(A.keyEncipherment,e),this.nonRepudiation=MI(A.nonRepudiation,e),this.type=MI(A.type,["optional","required"]),this.use=A.use||"",this.usehref=A.usehref||""}}class yB extends uc{constructor(A){super(jc,"line",!0),this.hand=MI(A.hand,["even","left","right"]),this.id=A.id||"",this.slope=MI(A.slope,["\\","/"]),this.use=A.use||"",this.usehref=A.usehref||"",this.edge=null}[yI](){const A=this[Ko]()[Ko](),e=this.edge||new XC({}),t=e[DI](),i=Object.create(null),a="visible"===e.presence?e.thickness:0;let s,n,g,r;i.strokeWidth=Fc(a),i.stroke=t.color;let o="100%",I="100%";A.w<=a?([s,n,g,r]=["50%",0,"50%","100%"],o=i.strokeWidth):A.h<=a?([s,n,g,r]=[0,"50%","100%","50%"],I=i.strokeWidth):"\\"===this.slope?[s,n,g,r]=[0,0,"100%","100%"]:[s,n,g,r]=[0,"100%","100%",0];const c={name:"svg",children:[{name:"line",attributes:{xmlns:zc,x1:s,y1:n,x2:g,y2:r,style:i}}],attributes:{xmlns:zc,width:o,height:I,style:{overflow:"visible"}}};return tC(A)?YI.success({name:"div",attributes:{style:{display:"inline",width:"100%",height:"100%"}},children:[c]}):(c.attributes.style.position="absolute",YI.success(c))}}class wB extends uc{constructor(A){super(jc,"linear",!0),this.id=A.id||"",this.type=MI(A.type,["toRight","toBottom","toLeft","toTop"]),this.use=A.use||"",this.usehref=A.usehref||"",this.color=null,this.extras=null}[DI](A){return A=A?A[DI]():"#FFFFFF",`linear-gradient(${this.type.replace(/([RBLT])/," $1").toLowerCase()}, ${A}, ${this.color?this.color[DI]():"#000000"})`}}class DB extends mc{constructor(A){super(jc,"lockDocument"),this.id=A.id||"",this.type=MI(A.type,["optional","required"]),this.use=A.use||"",this.usehref=A.usehref||""}[bo](){this[mo]=MI(this[mo],["auto","0","1"])}}class bB extends uc{constructor(A){super(jc,"manifest",!0),this.action=MI(A.action,["include","all","exclude"]),this.id=A.id||"",this.name=A.name||"",this.use=A.use||"",this.usehref=A.usehref||"",this.extras=null,this.ref=new dc}}class kB extends uc{constructor(A){super(jc,"margin",!0),this.bottomInset=LI(A.bottomInset,"0"),this.id=A.id||"",this.leftInset=LI(A.leftInset,"0"),this.rightInset=LI(A.rightInset,"0"),this.topInset=LI(A.topInset,"0"),this.use=A.use||"",this.usehref=A.usehref||"",this.extras=null}[DI](){return{margin:Fc(this.topInset)+" "+Fc(this.rightInset)+" "+Fc(this.bottomInset)+" "+Fc(this.leftInset)}}}class FB extends uc{constructor(A){super(jc,"mdp"),this.id=A.id||"",this.permissions=NI({data:A.permissions,defaultValue:2,validate:A=>1===A||3===A}),this.signatureType=MI(A.signatureType,["filler","author"]),this.use=A.use||"",this.usehref=A.usehref||""}}class SB extends uc{constructor(A){super(jc,"medium"),this.id=A.id||"",this.imagingBBox=function(A){const e=-1;if(!A)return{x:e,y:e,width:e,height:e};const t=A.trim().split(/\s*,\s*/).map((A=>LI(A,"-1")));if(t.length<4||t[2]<0||t[3]<0)return{x:e,y:e,width:e,height:e};const[i,a,s,n]=t;return{x:i,y:a,width:s,height:n}}(A.imagingBBox),this.long=LI(A.long),this.orientation=MI(A.orientation,["portrait","landscape"]),this.short=LI(A.short),this.stock=A.stock||"",this.trayIn=MI(A.trayIn,["auto","delegate","pageFront"]),this.trayOut=MI(A.trayOut,["auto","delegate"]),this.use=A.use||"",this.usehref=A.usehref||""}}class RB extends uc{constructor(A){super(jc,"message",!0),this.id=A.id||"",this.use=A.use||"",this.usehref=A.usehref||"",this.text=new dc}}class GB extends uc{constructor(A){super(jc,"numericEdit",!0),this.hScrollPolicy=MI(A.hScrollPolicy,["auto","off","on"]),this.id=A.id||"",this.use=A.use||"",this.usehref=A.usehref||"",this.border=null,this.comb=null,this.extras=null,this.margin=null}[yI](A){const e=Lc(this,"border","font","margin"),t=this[Ko]()[Ko](),i={name:"input",attributes:{type:"text",fieldId:t[bI],dataId:t[yo]?.[bI]||t[bI],class:["xfaTextfield"],style:e,"aria-label":rC(t),"aria-required":!1}};return sC(t)&&(i.attributes["aria-required"]=!0,i.attributes.required=!0),YI.success({name:"label",attributes:{class:["xfaLabel"]},children:[i]})}}class NB extends uc{constructor(A){super(jc,"occur",!0),this.id=A.id||"",this.initial=""!==A.initial?NI({data:A.initial,defaultValue:"",validate:A=>!0}):"",this.max=""!==A.max?NI({data:A.max,defaultValue:1,validate:A=>!0}):"",this.min=""!==A.min?NI({data:A.min,defaultValue:1,validate:A=>!0}):"",this.use=A.use||"",this.usehref=A.usehref||"",this.extras=null}[lo](){const A=this[Ko](),e=this.min;""===this.min&&(this.min=A instanceof LB||A instanceof JB?0:1),""===this.max&&(this.max=""===e?A instanceof LB||A instanceof JB?-1:1:this.min),-1!==this.max&&this.max!0}),this.name=A.name||"",this.numbered=NI({data:A.numbered,defaultValue:1,validate:A=>!0}),this.oddOrEven=MI(A.oddOrEven,["any","even","odd"]),this.pagePosition=MI(A.pagePosition,["any","first","last","only","rest"]),this.relevant=HI(A.relevant),this.use=A.use||"",this.usehref=A.usehref||"",this.desc=null,this.extras=null,this.medium=null,this.occur=null,this.area=new dc,this.contentArea=new dc,this.draw=new dc,this.exclGroup=new dc,this.field=new dc,this.subform=new dc}[tI](){return this[Do]?!this.occur||-1===this.occur.max||this[Do].numberOfUseA.oddOrEven===e&&A.pagePosition===t));return i||(i=this.pageArea.children.find((A=>"any"===A.oddOrEven&&A.pagePosition===t)),i||(i=this.pageArea.children.find((A=>"any"===A.oddOrEven&&"any"===A.pagePosition)),i||this.pageArea.children[0]))}}class HB extends uc{constructor(A){super(jc,"para",!0),this.hAlign=MI(A.hAlign,["left","center","justify","justifyAll","radix","right"]),this.id=A.id||"",this.lineHeight=A.lineHeight?LI(A.lineHeight,"0pt"):"",this.marginLeft=A.marginLeft?LI(A.marginLeft,"0pt"):"",this.marginRight=A.marginRight?LI(A.marginRight,"0pt"):"",this.orphans=NI({data:A.orphans,defaultValue:0,validate:A=>A>=0}),this.preserve=A.preserve||"",this.radixOffset=A.radixOffset?LI(A.radixOffset,"0pt"):"",this.spaceAbove=A.spaceAbove?LI(A.spaceAbove,"0pt"):"",this.spaceBelow=A.spaceBelow?LI(A.spaceBelow,"0pt"):"",this.tabDefault=A.tabDefault?LI(this.tabDefault):"",this.tabStops=(A.tabStops||"").trim().split(/\s+/).map(((A,e)=>e%2==1?LI(A):A)),this.textIndent=A.textIndent?LI(A.textIndent,"0pt"):"",this.use=A.use||"",this.usehref=A.usehref||"",this.vAlign=MI(A.vAlign,["top","bottom","middle"]),this.widows=NI({data:A.widows,defaultValue:0,validate:A=>A>=0}),this.hyphenation=null}[DI](){const A=Lc(this,"hAlign");return""!==this.marginLeft&&(A.paddingLeft=Fc(this.marginLeft)),""!==this.marginRight&&(A.paddingight=Fc(this.marginRight)),""!==this.spaceAbove&&(A.paddingTop=Fc(this.spaceAbove)),""!==this.spaceBelow&&(A.paddingBottom=Fc(this.spaceBelow)),""!==this.textIndent&&(A.textIndent=Fc(this.textIndent),Hc(A)),this.lineHeight>0&&(A.lineHeight=Fc(this.lineHeight)),""!==this.tabDefault&&(A.tabSize=Fc(this.tabDefault)),this.tabStops.length,this.hyphenatation&&Object.assign(A,this.hyphenatation[DI]()),A}}class YB extends uc{constructor(A){super(jc,"passwordEdit",!0),this.hScrollPolicy=MI(A.hScrollPolicy,["auto","off","on"]),this.id=A.id||"",this.passwordChar=A.passwordChar||"*",this.use=A.use||"",this.usehref=A.usehref||"",this.border=null,this.extras=null,this.margin=null}}class vB extends uc{constructor(A){super(jc,"pattern",!0),this.id=A.id||"",this.type=MI(A.type,["crossHatch","crossDiagonal","diagonalLeft","diagonalRight","horizontal","vertical"]),this.use=A.use||"",this.usehref=A.usehref||"",this.color=null,this.extras=null}[DI](A){A=A?A[DI]():"#FFFFFF";const e=this.color?this.color[DI]():"#000000",t="repeating-linear-gradient",i=`${A},${A} 5px,${e} 5px,${e} 10px`;switch(this.type){case"crossHatch":return`${t}(to top,${i}) ${t}(to right,${i})`;case"crossDiagonal":return`${t}(45deg,${i}) ${t}(-45deg,${i})`;case"diagonalLeft":return`${t}(45deg,${i})`;case"diagonalRight":return`${t}(-45deg,${i})`;case"horizontal":return`${t}(to top,${i})`;case"vertical":return`${t}(to right,${i})`}return""}}class KB extends wc{constructor(A){super(jc,"picture"),this.id=A.id||"",this.use=A.use||"",this.usehref=A.usehref||""}}class qB extends uc{constructor(A){super(jc,"proto",!0),this.appearanceFilter=new dc,this.arc=new dc,this.area=new dc,this.assist=new dc,this.barcode=new dc,this.bindItems=new dc,this.bookend=new dc,this.boolean=new dc,this.border=new dc,this.break=new dc,this.breakAfter=new dc,this.breakBefore=new dc,this.button=new dc,this.calculate=new dc,this.caption=new dc,this.certificate=new dc,this.certificates=new dc,this.checkButton=new dc,this.choiceList=new dc,this.color=new dc,this.comb=new dc,this.connect=new dc,this.contentArea=new dc,this.corner=new dc,this.date=new dc,this.dateTime=new dc,this.dateTimeEdit=new dc,this.decimal=new dc,this.defaultUi=new dc,this.desc=new dc,this.digestMethod=new dc,this.digestMethods=new dc,this.draw=new dc,this.edge=new dc,this.encoding=new dc,this.encodings=new dc,this.encrypt=new dc,this.encryptData=new dc,this.encryption=new dc,this.encryptionMethod=new dc,this.encryptionMethods=new dc,this.event=new dc,this.exData=new dc,this.exObject=new dc,this.exclGroup=new dc,this.execute=new dc,this.extras=new dc,this.field=new dc,this.fill=new dc,this.filter=new dc,this.float=new dc,this.font=new dc,this.format=new dc,this.handler=new dc,this.hyphenation=new dc,this.image=new dc,this.imageEdit=new dc,this.integer=new dc,this.issuers=new dc,this.items=new dc,this.keep=new dc,this.keyUsage=new dc,this.line=new dc,this.linear=new dc,this.lockDocument=new dc,this.manifest=new dc,this.margin=new dc,this.mdp=new dc,this.medium=new dc,this.message=new dc,this.numericEdit=new dc,this.occur=new dc,this.oid=new dc,this.oids=new dc,this.overflow=new dc,this.pageArea=new dc,this.pageSet=new dc,this.para=new dc,this.passwordEdit=new dc,this.pattern=new dc,this.picture=new dc,this.radial=new dc,this.reason=new dc,this.reasons=new dc,this.rectangle=new dc,this.ref=new dc,this.script=new dc,this.setProperty=new dc,this.signData=new dc,this.signature=new dc,this.signing=new dc,this.solid=new dc,this.speak=new dc,this.stipple=new dc,this.subform=new dc,this.subformSet=new dc,this.subjectDN=new dc,this.subjectDNs=new dc,this.submit=new dc,this.text=new dc,this.textEdit=new dc,this.time=new dc,this.timeStamp=new dc,this.toolTip=new dc,this.traversal=new dc,this.traverse=new dc,this.ui=new dc,this.validate=new dc,this.value=new dc,this.variables=new dc}}class TB extends uc{constructor(A){super(jc,"radial",!0),this.id=A.id||"",this.type=MI(A.type,["toEdge","toCenter"]),this.use=A.use||"",this.usehref=A.usehref||"",this.color=null,this.extras=null}[DI](A){A=A?A[DI]():"#FFFFFF";const e=this.color?this.color[DI]():"#000000";return`radial-gradient(circle at center, ${"toEdge"===this.type?`${A},${e}`:`${e},${A}`})`}}class PB extends wc{constructor(A){super(jc,"reason"),this.id=A.id||"",this.name=A.name||"",this.use=A.use||"",this.usehref=A.usehref||""}}class WB extends uc{constructor(A){super(jc,"reasons",!0),this.id=A.id||"",this.type=MI(A.type,["optional","required"]),this.use=A.use||"",this.usehref=A.usehref||"",this.reason=new dc}}class ZB extends uc{constructor(A){super(jc,"rectangle",!0),this.hand=MI(A.hand,["even","left","right"]),this.id=A.id||"",this.use=A.use||"",this.usehref=A.usehref||"",this.corner=new dc(4),this.edge=new dc(4),this.fill=null}[yI](){const A=this.edge.children.length?this.edge.children[0]:new XC({}),e=A[DI](),t=Object.create(null);"visible"===this.fill?.presence?Object.assign(t,this.fill[DI]()):t.fill="transparent",t.strokeWidth=Fc("visible"===A.presence?A.thickness:0),t.stroke=e.color;const i=(this.corner.children.length?this.corner.children[0]:new HC({}))[DI](),a={name:"svg",children:[{name:"rect",attributes:{xmlns:zc,width:"100%",height:"100%",x:0,y:0,rx:i.radius,ry:i.radius,style:t}}],attributes:{xmlns:zc,style:{overflow:"visible"},width:"100%",height:"100%"}};return tC(this[Ko]()[Ko]())?YI.success({name:"div",attributes:{style:{display:"inline",width:"100%",height:"100%"}},children:[a]}):(a.attributes.style.position="absolute",YI.success(a))}}class OB extends wc{constructor(A){super(jc,"ref"),this.id=A.id||"",this.use=A.use||"",this.usehref=A.usehref||""}}class XB extends wc{constructor(A){super(jc,"script"),this.binding=A.binding||"",this.contentType=A.contentType||"",this.id=A.id||"",this.name=A.name||"",this.runAt=MI(A.runAt,["client","both","server"]),this.use=A.use||"",this.usehref=A.usehref||""}}class VB extends uc{constructor(A){super(jc,"setProperty"),this.connection=A.connection||"",this.ref=A.ref||"",this.target=A.target||""}}class jB extends uc{constructor(A){super(jc,"signData",!0),this.id=A.id||"",this.operation=MI(A.operation,["sign","clear","verify"]),this.ref=A.ref||"",this.target=A.target||"",this.use=A.use||"",this.usehref=A.usehref||"",this.filter=null,this.manifest=null}}class zB extends uc{constructor(A){super(jc,"signature",!0),this.id=A.id||"",this.type=MI(A.type,["PDF1.3","PDF1.6"]),this.use=A.use||"",this.usehref=A.usehref||"",this.border=null,this.extras=null,this.filter=null,this.manifest=null,this.margin=null}}class _B extends uc{constructor(A){super(jc,"signing",!0),this.id=A.id||"",this.type=MI(A.type,["optional","required"]),this.use=A.use||"",this.usehref=A.usehref||"",this.certificate=new dc}}class $B extends uc{constructor(A){super(jc,"solid",!0),this.id=A.id||"",this.use=A.use||"",this.usehref=A.usehref||"",this.extras=null}[DI](A){return A?A[DI]():"#FFFFFF"}}class Ah extends wc{constructor(A){super(jc,"speak"),this.disable=NI({data:A.disable,defaultValue:0,validate:A=>1===A}),this.id=A.id||"",this.priority=MI(A.priority,["custom","caption","name","toolTip"]),this.rid=A.rid||"",this.use=A.use||"",this.usehref=A.usehref||""}}class eh extends uc{constructor(A){super(jc,"stipple",!0),this.id=A.id||"",this.rate=NI({data:A.rate,defaultValue:50,validate:A=>A>=0&&A<=100}),this.use=A.use||"",this.usehref=A.usehref||"",this.color=null,this.extras=null}[DI](A){const e=this.rate/100;return j.makeHexColor(Math.round(A.value.r*(1-e)+this.value.r*e),Math.round(A.value.g*(1-e)+this.value.g*e),Math.round(A.value.b*(1-e)+this.value.b*e))}}class th extends uc{constructor(A){super(jc,"subform",!0),this.access=MI(A.access,["open","nonInteractive","protected","readOnly"]),this.allowMacro=NI({data:A.allowMacro,defaultValue:0,validate:A=>1===A}),this.anchorType=MI(A.anchorType,["topLeft","bottomCenter","bottomLeft","bottomRight","middleCenter","middleLeft","middleRight","topCenter","topRight"]),this.colSpan=NI({data:A.colSpan,defaultValue:1,validate:A=>A>=1||-1===A}),this.columnWidths=(A.columnWidths||"").trim().split(/\s+/).map((A=>"-1"===A?-1:LI(A))),this.h=A.h?LI(A.h):"",this.hAlign=MI(A.hAlign,["left","center","justify","justifyAll","radix","right"]),this.id=A.id||"",this.layout=MI(A.layout,["position","lr-tb","rl-row","rl-tb","row","table","tb"]),this.locale=A.locale||"",this.maxH=LI(A.maxH,"0pt"),this.maxW=LI(A.maxW,"0pt"),this.mergeMode=MI(A.mergeMode,["consumeData","matchTemplate"]),this.minH=LI(A.minH,"0pt"),this.minW=LI(A.minW,"0pt"),this.name=A.name||"",this.presence=MI(A.presence,["visible","hidden","inactive","invisible"]),this.relevant=HI(A.relevant),this.restoreState=MI(A.restoreState,["manual","auto"]),this.scope=MI(A.scope,["name","none"]),this.use=A.use||"",this.usehref=A.usehref||"",this.w=A.w?LI(A.w):"",this.x=LI(A.x,"0pt"),this.y=LI(A.y,"0pt"),this.assist=null,this.bind=null,this.bookend=null,this.border=null,this.break=null,this.calculate=null,this.desc=null,this.extras=null,this.keep=null,this.margin=null,this.occur=null,this.overflow=null,this.pageSet=null,this.para=null,this.traversal=null,this.validate=null,this.variables=null,this.area=new dc,this.breakAfter=new dc,this.breakBefore=new dc,this.connect=new dc,this.draw=new dc,this.event=new dc,this.exObject=new dc,this.exclGroup=new dc,this.field=new dc,this.proto=new dc,this.setProperty=new dc,this.subform=new dc,this.subformSet=new dc}[vo](){const A=this[Ko]();return A instanceof ih?A[vo]():A}[Vo](){return!0}[AI](){return this.layout.endsWith("-tb")&&0===this[Do].attempt&&this[Do].numberInLine>0||this[Ko]()[AI]()}*[Ho](){yield*aC(this)}[ko](){return Zc(this)}[Bo](A,e){Oc(this,A,e)}[Ro](){return Xc(this)}[$o](){const A=this[vo]();return!!A[$o]()&&(void 0!==this[Do]._isSplittable?this[Do]._isSplittable:"position"===this.layout||this.layout.includes("row")||this.keep&&"none"!==this.keep.intact?(this[Do]._isSplittable=!1,!1):!(A.layout?.endsWith("-tb")&&0!==A[Do].numberInLine||(this[Do]._isSplittable=!0,0)))}[yI](A){if(nC(this),this.break){if("auto"!==this.break.after||""!==this.break.afterTarget){const A=new DC({targetType:this.break.after,target:this.break.afterTarget,startNew:this.break.startNew.toString()});A[To]=this[To],this[ho](A),this.breakAfter.push(A)}if("auto"!==this.break.before||""!==this.break.beforeTarget){const A=new bC({targetType:this.break.before,target:this.break.beforeTarget,startNew:this.break.startNew.toString()});A[To]=this[To],this[ho](A),this.breakBefore.push(A)}if(""!==this.break.overflowTarget){const A=new MB({target:this.break.overflowTarget,leader:this.break.overflowLeader,trailer:this.break.overflowTrailer});A[To]=this[To],this[ho](A),this.overflow.push(A)}this[BI](this.break),this.break=null}if("hidden"===this.presence||"inactive"===this.presence)return YI.EMPTY;if((this.breakBefore.children.length>1||this.breakAfter.children.length>1)&&G("XFA - Several breakBefore or breakAfter in subforms: please file a bug."),this.breakBefore.children.length>=1){const A=this.breakBefore.children[0];if(CC(A))return YI.breakNode(A)}if(this[Do]?.afterBreakAfter)return YI.EMPTY;Uc(this);const e=[],t={id:this[bI],class:[]};Yc(this,t.class),this[Do]||(this[Do]=Object.create(null)),Object.assign(this[Do],{children:e,line:null,attributes:t,attempt:0,numberInLine:0,availableSpace:{width:Math.min(this.w||1/0,A.width),height:Math.min(this.h||1/0,A.height)},width:0,height:0,prevHeight:0,currentWidth:0});const i=this[qo](),a=i[Do].noLayoutFailure,s=this[$o]();if(s||IC(this),!Vc(this,A))return YI.FAILURE;const n=new Set(["area","draw","exclGroup","field","subform","subformSet"]);if(this.layout.includes("row")){const A=this[vo]().columnWidths;Array.isArray(A)&&A.length>0&&(this[Do].columnWidths=A,this[Do].currentColumn=0)}const g=Lc(this,"anchorType","dimensions","position","presence","border","margin","hAlign"),r=["xfaSubform"],o=Mc(this);if(o&&r.push(o),t.style=g,t.class=r,this.name&&(t.xfaName=this.name),this.overflow){const e=this.overflow[Mo]();e.addLeader&&(e.addLeader=!1,BC(this,e.leader,A))}this[CI]();const I="lr-tb"===this.layout||"rl-tb"===this.layout,c=I?2:1;for(;this[Do].attempt=1){const A=this.breakAfter.children[0];if(CC(A))return this[Do].afterBreakAfter=u,YI.breakNode(A)}return delete this[Do],u}}class ih extends uc{constructor(A){super(jc,"subformSet",!0),this.id=A.id||"",this.name=A.name||"",this.relation=MI(A.relation,["ordered","choice","unordered"]),this.relevant=HI(A.relevant),this.use=A.use||"",this.usehref=A.usehref||"",this.bookend=null,this.break=null,this.desc=null,this.extras=null,this.occur=null,this.overflow=null,this.breakAfter=new dc,this.breakBefore=new dc,this.subform=new dc,this.subformSet=new dc}*[Ho](){yield*aC(this)}[vo](){let A=this[Ko]();for(;!(A instanceof th);)A=A[Ko]();return A}[Vo](){return!0}}class ah extends mc{constructor(A){super(jc,"subjectDN"),this.delimiter=A.delimiter||",",this.id=A.id||"",this.name=A.name||"",this.use=A.use||"",this.usehref=A.usehref||""}[bo](){this[mo]=new Map(this[mo].split(this.delimiter).map((A=>((A=A.split("=",2))[0]=A[0].trim(),A))))}}class sh extends uc{constructor(A){super(jc,"subjectDNs",!0),this.id=A.id||"",this.type=MI(A.type,["optional","required"]),this.use=A.use||"",this.usehref=A.usehref||"",this.subjectDN=new dc}}class nh extends uc{constructor(A){super(jc,"submit",!0),this.embedPDF=NI({data:A.embedPDF,defaultValue:0,validate:A=>1===A}),this.format=MI(A.format,["xdp","formdata","pdf","urlencoded","xfd","xml"]),this.id=A.id||"",this.target=A.target||"",this.textEncoding=UI({data:A.textEncoding?A.textEncoding.toLowerCase():"",defaultValue:"",validate:A=>["utf-8","big-five","fontspecific","gbk","gb-18030","gb-2312","ksc-5601","none","shift-jis","ucs-2","utf-16"].includes(A)||A.match(/iso-8859-\d{2}/)}),this.use=A.use||"",this.usehref=A.usehref||"",this.xdpContent=A.xdpContent||"",this.encrypt=null,this.encryptData=new dc,this.signData=new dc}}class gh extends uc{constructor(A){super(jc,"template",!0),this.baseProfile=MI(A.baseProfile,["full","interactiveForms"]),this.extras=null,this.subform=new dc}[bo](){0===this.subform.children.length&&G("XFA - No subforms in template node."),this.subform.children.length>=2&&G("XFA - Several subforms in template node: please file a bug."),this[fI]=5e3}[$o](){return!0}[lI](A,e){return A.startsWith("#")?[this[Wo].get(A.slice(1))]:zI(this,e,A,!0,!0)}*[mI](){if(!this.subform.children.length)return YI.success({name:"div",children:[]});this[Do]={overflowNode:null,firstUnsplittable:null,currentContentArea:null,currentPageArea:null,noLayoutFailure:!1,pageNumber:1,pagePosition:"first",oddOrEven:"odd",blankOrNotBlank:"nonBlank",paraStack:[]};const A=this.subform.children[0];A.pageSet[Eo]();const e=A.pageSet.pageArea.children,t={name:"div",children:[]};let i=null,a=null,s=null;if(A.breakBefore.children.length>=1?(a=A.breakBefore.children[0],s=a.target):A.subform.children.length>=1&&A.subform.children[0].breakBefore.children.length>=1?(a=A.subform.children[0].breakBefore.children[0],s=a.target):A.break?.beforeTarget?(a=A.break,s=a.beforeTarget):A.subform.children.length>=1&&A.subform.children[0].break?.beforeTarget&&(a=A.subform.children[0].break,s=a.beforeTarget),a){const A=this[lI](s,a[Ko]());A instanceof LB&&(i=A,a[Do]={})}i||(i=e[0]),i[Do]={numberOfUse:1};const n=i[Ko]();let g;n[Do]={numberOfUse:1,pageIndex:n.pageArea.children.indexOf(i),pageSetIndex:0};let r=null,o=null,I=!0,c=0,C=0;for(;;){if(I)c=0;else if(t.children.pop(),3==++c)return G("XFA - Something goes wrong: please file a bug."),t;g=null,this[Do].currentPageArea=i;const e=i[yI]().html;t.children.push(e),r&&(this[Do].noLayoutFailure=!0,e.children.push(r[yI](i[Do].space).html),r=null),o&&(this[Do].noLayoutFailure=!0,e.children.push(o[yI](i[Do].space).html),o=null);const a=i.contentArea.children,s=e.children.filter((A=>A.attributes.class.includes("xfaContentarea")));I=!1,this[Do].firstUnsplittable=null,this[Do].noLayoutFailure=!1;const n=e=>{const t=A[ko]();t&&(I||=t.children?.length>0,s[e].children.push(t))};for(let e=C,i=a.length;e0,s[e].children.push(B.html)):!I&&t.children.length>1&&t.children.pop(),t;if(B.isBreak()){const A=B.breakNode;if(n(e),"auto"===A.targetType)continue;A.leader&&(r=this[lI](A.leader,A[Ko]()),r=r?r[0]:null),A.trailer&&(o=this[lI](A.trailer,A[Ko]()),o=o?o[0]:null),"pageArea"===A.targetType?(g=A[Do].target,e=1/0):A[Do].target?(g=A[Do].target,C=A[Do].index+1,e=1/0):e=A[Do].index}else if(this[Do].overflowNode){const A=this[Do].overflowNode;this[Do].overflowNode=null;const t=A[Mo](),i=t.target;t.addLeader=null!==t.leader,t.addTrailer=null!==t.trailer,n(e);const s=e;if(e=1/0,i instanceof LB)g=i;else if(i instanceof JC){const A=a.indexOf(i);-1!==A?A>s?e=A-1:C=A:(g=i[Ko](),C=g.contentArea.children.indexOf(i))}}else n(e)}this[Do].pageNumber+=1,g&&(g[tI]()?g[Do].numberOfUse+=1:g=null),i=g||i[Yo](),yield null}}}class rh extends mc{constructor(A){super(jc,"text"),this.id=A.id||"",this.maxChars=NI({data:A.maxChars,defaultValue:0,validate:A=>A>=0}),this.name=A.name||"",this.rid=A.rid||"",this.use=A.use||"",this.usehref=A.usehref||""}[Co](){return!0}[gI](A){return A[aI]===FI.xhtml.id?(this[mo]=A,!0):(G(`XFA - Invalid content in Text: ${A[sI]}.`),!1)}[oI](A){this[mo]instanceof uc||super[oI](A)}[bo](){"string"==typeof this[mo]&&(this[mo]=this[mo].replaceAll("\r\n","\n"))}[Mo](){return"string"==typeof this[mo]?this[mo].split(/[\u2029\u2028\n]/).reduce(((A,e)=>(e&&A.push(e),A)),[]).join("\n"):this[mo][pI]()}[yI](A){if("string"==typeof this[mo]){const A=oC(this[mo]).html;return this[mo].includes("\u2029")?(A.name="div",A.children=[],this[mo].split("\u2029").map((A=>A.split(/[\u2028\n]/).reduce(((A,e)=>(A.push({name:"span",value:e},{name:"br"}),A)),[]))).forEach((e=>{A.children.push({name:"p",children:e})}))):/[\u2028\n]/.test(this[mo])&&(A.name="div",A.children=[],this[mo].split(/[\u2028\n]/).forEach((e=>{A.children.push({name:"span",value:e},{name:"br"})}))),YI.success(A)}return this[mo][yI](A)}}class oh extends uc{constructor(A){super(jc,"textEdit",!0),this.allowRichText=NI({data:A.allowRichText,defaultValue:0,validate:A=>1===A}),this.hScrollPolicy=MI(A.hScrollPolicy,["auto","off","on"]),this.id=A.id||"",this.multiLine=NI({data:A.multiLine,defaultValue:"",validate:A=>0===A||1===A}),this.use=A.use||"",this.usehref=A.usehref||"",this.vScrollPolicy=MI(A.vScrollPolicy,["auto","off","on"]),this.border=null,this.comb=null,this.extras=null,this.margin=null}[yI](A){const e=Lc(this,"border","font","margin");let t;const i=this[Ko]()[Ko]();return""===this.multiLine&&(this.multiLine=i instanceof OC?1:0),t=1===this.multiLine?{name:"textarea",attributes:{dataId:i[yo]?.[bI]||i[bI],fieldId:i[bI],class:["xfaTextfield"],style:e,"aria-label":rC(i),"aria-required":!1}}:{name:"input",attributes:{type:"text",dataId:i[yo]?.[bI]||i[bI],fieldId:i[bI],class:["xfaTextfield"],style:e,"aria-label":rC(i),"aria-required":!1}},sC(i)&&(t.attributes["aria-required"]=!0,t.attributes.required=!0),YI.success({name:"label",attributes:{class:["xfaLabel"]},children:[t]})}}class Ih extends wc{constructor(A){super(jc,"time"),this.id=A.id||"",this.name=A.name||"",this.use=A.use||"",this.usehref=A.usehref||""}[bo](){const A=this[mo].trim();this[mo]=A?new Date(A):null}[yI](A){return oC(this[mo]?this[mo].toString():"")}}class ch extends uc{constructor(A){super(jc,"timeStamp"),this.id=A.id||"",this.server=A.server||"",this.type=MI(A.type,["optional","required"]),this.use=A.use||"",this.usehref=A.usehref||""}}class Ch extends wc{constructor(A){super(jc,"toolTip"),this.id=A.id||"",this.rid=A.rid||"",this.use=A.use||"",this.usehref=A.usehref||""}}class Bh extends uc{constructor(A){super(jc,"traversal",!0),this.id=A.id||"",this.use=A.use||"",this.usehref=A.usehref||"",this.extras=null,this.traverse=new dc}}class hh extends uc{constructor(A){super(jc,"traverse",!0),this.id=A.id||"",this.operation=MI(A.operation,["next","back","down","first","left","right","up"]),this.ref=A.ref||"",this.use=A.use||"",this.usehref=A.usehref||"",this.extras=null,this.script=null}get name(){return this.operation}[eI](){return!1}}class Qh extends uc{constructor(A){super(jc,"ui",!0),this.id=A.id||"",this.use=A.use||"",this.usehref=A.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}[Mo](){if(void 0===this[Do]){for(const A of Object.getOwnPropertyNames(this)){if("extras"===A||"picture"===A)continue;const e=this[A];if(e instanceof uc)return this[Do]=e,e}this[Do]=null}return this[Do]}[yI](A){const e=this[Mo]();return e?e[yI](A):YI.EMPTY}}class lh extends uc{constructor(A){super(jc,"validate",!0),this.formatTest=MI(A.formatTest,["warning","disabled","error"]),this.id=A.id||"",this.nullTest=MI(A.nullTest,["disabled","error","warning"]),this.scriptTest=MI(A.scriptTest,["error","disabled","warning"]),this.use=A.use||"",this.usehref=A.usehref||"",this.extras=null,this.message=null,this.picture=null,this.script=null}}class Eh extends uc{constructor(A){super(jc,"value",!0),this.id=A.id||"",this.override=NI({data:A.override,defaultValue:0,validate:A=>1===A}),this.relevant=HI(A.relevant),this.use=A.use||"",this.usehref=A.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}[dI](A){const e=this[Ko]();if(e instanceof rB&&e.ui?.imageEdit)return this.image||(this.image=new lB({}),this[ho](this.image)),void(this.image[mo]=A[mo]);const t=A[sI];if(null===this[t]){for(const A of Object.getOwnPropertyNames(this)){const e=this[A];e instanceof uc&&(this[A]=null,this[BI](e))}this[A[sI]]=A,this[ho](A)}else this[t][mo]=A[mo]}[pI](){if(this.exData)return"string"==typeof this.exData[mo]?this.exData[mo].trim():this.exData[mo][pI]().trim();for(const A of Object.getOwnPropertyNames(this)){if("image"===A)continue;const e=this[A];if(e instanceof uc)return(e[mo]||"").toString().trim()}return null}[yI](A){for(const e of Object.getOwnPropertyNames(this)){const t=this[e];if(t instanceof uc)return t[yI](A)}return YI.EMPTY}}class uh extends uc{constructor(A){super(jc,"variables",!0),this.id=A.id||"",this.use=A.use||"",this.usehref=A.usehref||"",this.boolean=new dc,this.date=new dc,this.dateTime=new dc,this.decimal=new dc,this.exData=new dc,this.float=new dc,this.image=new dc,this.integer=new dc,this.manifest=new dc,this.script=new dc,this.text=new dc,this.time=new dc}[eI](){return!0}}class dh{static[kI](A,e){if(dh.hasOwnProperty(A)){const t=dh[A](e);return t[uI](e),t}}static appearanceFilter(A){return new hC(A)}static arc(A){return new QC(A)}static area(A){return new lC(A)}static assist(A){return new EC(A)}static barcode(A){return new uC(A)}static bind(A){return new dC(A)}static bindItems(A){return new fC(A)}static bookend(A){return new pC(A)}static boolean(A){return new mC(A)}static border(A){return new yC(A)}static break(A){return new wC(A)}static breakAfter(A){return new DC(A)}static breakBefore(A){return new bC(A)}static button(A){return new kC(A)}static calculate(A){return new FC(A)}static caption(A){return new SC(A)}static certificate(A){return new RC(A)}static certificates(A){return new GC(A)}static checkButton(A){return new NC(A)}static choiceList(A){return new xC(A)}static color(A){return new UC(A)}static comb(A){return new MC(A)}static connect(A){return new LC(A)}static contentArea(A){return new JC(A)}static corner(A){return new HC(A)}static date(A){return new YC(A)}static dateTime(A){return new vC(A)}static dateTimeEdit(A){return new KC(A)}static decimal(A){return new qC(A)}static defaultUi(A){return new TC(A)}static desc(A){return new PC(A)}static digestMethod(A){return new WC(A)}static digestMethods(A){return new ZC(A)}static draw(A){return new OC(A)}static edge(A){return new XC(A)}static encoding(A){return new VC(A)}static encodings(A){return new jC(A)}static encrypt(A){return new zC(A)}static encryptData(A){return new _C(A)}static encryption(A){return new $C(A)}static encryptionMethod(A){return new AB(A)}static encryptionMethods(A){return new eB(A)}static event(A){return new tB(A)}static exData(A){return new iB(A)}static exObject(A){return new aB(A)}static exclGroup(A){return new sB(A)}static execute(A){return new nB(A)}static extras(A){return new gB(A)}static field(A){return new rB(A)}static fill(A){return new oB(A)}static filter(A){return new IB(A)}static float(A){return new cB(A)}static font(A){return new CB(A)}static format(A){return new BB(A)}static handler(A){return new hB(A)}static hyphenation(A){return new QB(A)}static image(A){return new lB(A)}static imageEdit(A){return new EB(A)}static integer(A){return new uB(A)}static issuers(A){return new dB(A)}static items(A){return new fB(A)}static keep(A){return new pB(A)}static keyUsage(A){return new mB(A)}static line(A){return new yB(A)}static linear(A){return new wB(A)}static lockDocument(A){return new DB(A)}static manifest(A){return new bB(A)}static margin(A){return new kB(A)}static mdp(A){return new FB(A)}static medium(A){return new SB(A)}static message(A){return new RB(A)}static numericEdit(A){return new GB(A)}static occur(A){return new NB(A)}static oid(A){return new xB(A)}static oids(A){return new UB(A)}static overflow(A){return new MB(A)}static pageArea(A){return new LB(A)}static pageSet(A){return new JB(A)}static para(A){return new HB(A)}static passwordEdit(A){return new YB(A)}static pattern(A){return new vB(A)}static picture(A){return new KB(A)}static proto(A){return new qB(A)}static radial(A){return new TB(A)}static reason(A){return new PB(A)}static reasons(A){return new WB(A)}static rectangle(A){return new ZB(A)}static ref(A){return new OB(A)}static script(A){return new XB(A)}static setProperty(A){return new VB(A)}static signData(A){return new jB(A)}static signature(A){return new zB(A)}static signing(A){return new _B(A)}static solid(A){return new $B(A)}static speak(A){return new Ah(A)}static stipple(A){return new eh(A)}static subform(A){return new th(A)}static subformSet(A){return new ih(A)}static subjectDN(A){return new ah(A)}static subjectDNs(A){return new sh(A)}static submit(A){return new nh(A)}static template(A){return new gh(A)}static text(A){return new rh(A)}static textEdit(A){return new oh(A)}static time(A){return new Ih(A)}static timeStamp(A){return new ch(A)}static toolTip(A){return new Ch(A)}static traversal(A){return new Bh(A)}static traverse(A){return new hh(A)}static ui(A){return new Qh(A)}static validate(A){return new lh(A)}static value(A){return new Eh(A)}static variables(A){return new uh(A)}}const fh=FI.datasets.id;function ph(A){const e=new rh({});return e[mo]=A,e}class mh{constructor(A){this.root=A,this.datasets=A.datasets,this.data=A.datasets?.data||new pc(FI.datasets.id,"data"),this.emptyMerge=0===this.data[Jo]().length,this.root.form=this.form=A.template[fo]()}_isConsumeData(){return!this.emptyMerge&&this._mergeMode}_isMatchTemplate(){return!this._isConsumeData()}bind(){return this._bindElement(this.form,this.data),this.form}getData(){return this.data}_bindValue(A,e,t){if(A[yo]=e,A[Po]())if(e[jo]()){const t=e[Uo]();A[dI](ph(t))}else if(A instanceof rB&&"multiSelect"===A.ui?.choiceList?.open){const t=e[Jo]().map((A=>A[mo].trim())).join("\n");A[dI](ph(t))}else this._isConsumeData()&&G("XFA - Nodes haven't the same type.");else!e[jo]()||this._isMatchTemplate()?this._bindElement(A,e):G("XFA - Nodes haven't the same type.")}_findDataByNameToConsume(A,e,t,i){if(!A)return null;let a,s;for(let i=0;i<3;i++){for(a=t[Lo](A,!1,!0);s=a.next().value,s;)if(e===s[jo]())return s;if(t[aI]===FI.datasets.id&&"data"===t[sI])break;t=t[Ko]()}return i?(a=this.data[Lo](A,!0,!1),s=a.next().value,s||(a=this.data[Fo](A,!0),s=a.next().value,s?.[jo]()?s:null)):null}_setProperties(A,e){if(A.hasOwnProperty("setProperty"))for(const{ref:t,target:i,connection:a}of A.setProperty.children){if(a)continue;if(!t)continue;const s=zI(this.root,e,t,!1,!1);if(!s){G(`XFA - Invalid reference: ${t}.`);continue}const[n]=s;if(!n[zo](this.data)){G("XFA - Invalid node: must be a data node.");continue}const g=zI(this.root,A,i,!1,!1);if(!g){G(`XFA - Invalid target: ${i}.`);continue}const[r]=g;if(!r[zo](A)){G("XFA - Invalid target: must be a property or subproperty.");continue}const o=r[Ko]();if(r instanceof VB||o instanceof VB){G("XFA - Invalid target: cannot be a setProperty or one of its properties.");continue}if(r instanceof fC||o instanceof fC){G("XFA - Invalid target: cannot be a bindItems or one of its properties.");continue}const I=n[pI](),c=r[sI];if(r instanceof fc){const A=Object.create(null);A[c]=I;const e=Reflect.construct(Object.getPrototypeOf(o).constructor,[A]);o[c]=e[c]}else r.hasOwnProperty(mo)?(r[yo]=n,r[mo]=I,r[bo]()):G("XFA - Invalid node to use in setProperty")}}_bindItems(A,e){if(!A.hasOwnProperty("items")||!A.hasOwnProperty("bindItems")||A.bindItems.isEmpty())return;for(const e of A.items.children)A[BI](e);A.items.clear();const t=new fB({}),i=new fB({});A[ho](t),A.items.push(t),A[ho](i),A.items.push(i);for(const{ref:a,labelRef:s,valueRef:n,connection:g}of A.bindItems.children){if(g)continue;if(!a)continue;const A=zI(this.root,e,a,!1,!1);if(A)for(const e of A){if(!e[zo](this.datasets)){G(`XFA - Invalid ref (${a}): must be a datasets child.`);continue}const A=zI(this.root,e,s,!0,!1);if(!A){G(`XFA - Invalid label: ${s}.`);continue}const[g]=A;if(!g[zo](this.datasets)){G("XFA - Invalid label: must be a datasets child.");continue}const r=zI(this.root,e,n,!0,!1);if(!r){G(`XFA - Invalid value: ${n}.`);continue}const[o]=r;if(!o[zo](this.datasets)){G("XFA - Invalid value: must be a datasets child.");continue}const I=ph(g[pI]()),c=ph(o[pI]());t[ho](I),t.text.push(I),i[ho](c),i.text.push(c)}else G(`XFA - Invalid reference: ${a}.`)}}_bindOccurrences(A,e,t){let i;if(e.length>1&&(i=A[fo](),i[BI](i.occur),i.occur=null),this._bindValue(A,e[0],t),this._setProperties(A,e[0]),this._bindItems(A,e[0]),1===e.length)return;const a=A[Ko](),s=A[sI],n=a[Zo](A);for(let A=1,g=e.length;Ae.name===A.name)).length:t[i].children.length;const s=t[Zo](A)+1,n=e.initial-a;if(n){const e=A[fo]();e[BI](e.occur),e.occur=null,t[i].push(e),t[Oo](s,e);for(let A=1;A0)this._bindOccurrences(i,[A[0]],null);else if(this.emptyMerge){const A=e[aI]===fh?-1:e[aI],t=i[yo]=new pc(A,i.name||"root");e[ho](t),this._bindElement(i,t)}continue}if(!i[Vo]())continue;let A=!1,a=null,s=null,n=null;if(i.bind){switch(i.bind.match){case"none":this._setAndBind(i,e);continue;case"global":A=!0;break;case"dataRef":if(!i.bind.ref){G(`XFA - ref is empty in node ${i[sI]}.`),this._setAndBind(i,e);continue}s=i.bind.ref}i.bind.picture&&(a=i.bind.picture[mo])}const[g,r]=this._getOccurInfo(i);if(s){if(n=zI(this.root,e,s,!0,!1),null===n){if(n=_I(this.data,e,s),!n)continue;this._isConsumeData()&&(n[po]=!0),this._setAndBind(i,n);continue}this._isConsumeData()&&(n=n.filter((A=>!A[po]))),n.length>r?n=n.slice(0,r):0===n.length&&(n=null),n&&this._isConsumeData()&&n.forEach((A=>{A[po]=!0}))}else{if(!i.name){this._setAndBind(i,e);continue}if(this._isConsumeData()){const t=[];for(;t.length0?t:null}else{if(n=e[Lo](i.name,!1,this.emptyMerge).next().value,!n){if(0===g){t.push(i);continue}const A=e[aI]===fh?-1:e[aI];n=i[yo]=new pc(A,i.name),this.emptyMerge&&(n[po]=!0),e[ho](n),this._setAndBind(i,n);continue}this.emptyMerge&&(n[po]=!0),n=[n]}}n?this._bindOccurrences(i,n,a):g>0?this._setAndBind(i,e):t.push(i)}t.forEach((A=>A[Ko]()[BI](A)))}}class yh{constructor(A,e){this.data=e,this.dataset=A.datasets||null}serialize(A){const e=[[-1,this.data[Jo]()]];for(;e.length>0;){const t=e.at(-1),[i,a]=t;if(i+1===a.length){e.pop();continue}const s=a[++t[0]],n=A.get(s[bI]);if(n)s[dI](n);else{const e=s[So]();for(const t of e.values()){const e=A.get(t[bI]);if(e){t[dI](e);break}}}const g=s[Jo]();g.length>0&&e.push([-1,g])}const t=[''];if(this.dataset)for(const A of this.dataset[Jo]())"data"!==A[sI]&&A[wI](t);return this.data[wI](t),t.push(""),t.join("")}}const wh=FI.config.id;class Dh extends uc{constructor(A){super(wh,"acrobat",!0),this.acrobat7=null,this.autoSave=null,this.common=null,this.validate=null,this.validateApprovalSignatures=null,this.submitUrl=new dc}}class bh extends uc{constructor(A){super(wh,"acrobat7",!0),this.dynamicRender=null}}class kh extends yc{constructor(A){super(wh,"ADBE_JSConsole",["delegate","Enable","Disable"])}}class Fh extends yc{constructor(A){super(wh,"ADBE_JSDebugger",["delegate","Enable","Disable"])}}class Sh extends bc{constructor(A){super(wh,"addSilentPrint")}}class Rh extends bc{constructor(A){super(wh,"addViewerPreferences")}}class Gh extends kc{constructor(A){super(wh,"adjustData")}}class Nh extends Dc{constructor(A){super(wh,"adobeExtensionLevel",0,(A=>A>=1&&A<=8))}}class xh extends uc{constructor(A){super(wh,"agent",!0),this.name=A.name?A.name.trim():"",this.common=new dc}}class Uh extends mc{constructor(A){super(wh,"alwaysEmbed")}}class Mh extends wc{constructor(A){super(wh,"amd")}}class Lh extends uc{constructor(A){super(wh,"area"),this.level=NI({data:A.level,defaultValue:0,validate:A=>A>=1&&A<=3}),this.name=MI(A.name,["","barcode","coreinit","deviceDriver","font","general","layout","merge","script","signature","sourceSet","templateCache"])}}class Jh extends yc{constructor(A){super(wh,"attributes",["preserve","delegate","ignore"])}}class Hh extends yc{constructor(A){super(wh,"autoSave",["disabled","enabled"])}}class Yh extends wc{constructor(A){super(wh,"base")}}class vh extends uc{constructor(A){super(wh,"batchOutput"),this.format=MI(A.format,["none","concat","zip","zipCompress"])}}class Kh extends mc{constructor(A){super(wh,"behaviorOverride")}[bo](){this[mo]=new Map(this[mo].trim().split(/\s+/).filter((A=>A.includes(":"))).map((A=>A.split(":",2))))}}class qh extends uc{constructor(A){super(wh,"cache",!0),this.templateCache=null}}class Th extends bc{constructor(A){super(wh,"change")}}class Ph extends uc{constructor(A){super(wh,"common",!0),this.data=null,this.locale=null,this.localeSet=null,this.messaging=null,this.suppressBanner=null,this.template=null,this.validationMessaging=null,this.versionControl=null,this.log=new dc}}class Wh extends uc{constructor(A){super(wh,"compress"),this.scope=MI(A.scope,["imageOnly","document"])}}class Zh extends bc{constructor(A){super(wh,"compressLogicalStructure")}}class Oh extends kc{constructor(A){super(wh,"compressObjectStream")}}class Xh extends uc{constructor(A){super(wh,"compression",!0),this.compressLogicalStructure=null,this.compressObjectStream=null,this.level=null,this.type=null}}class Vh extends uc{constructor(A){super(wh,"config",!0),this.acrobat=null,this.present=null,this.trace=null,this.agent=new dc}}class jh extends yc{constructor(A){super(wh,"conformance",["A","B"])}}class zh extends bc{constructor(A){super(wh,"contentCopy")}}class _h extends Dc{constructor(A){super(wh,"copies",1,(A=>A>=1))}}class $h extends wc{constructor(A){super(wh,"creator")}}class AQ extends Dc{constructor(A){super(wh,"currentPage",0,(A=>A>=0))}}class eQ extends uc{constructor(A){super(wh,"data",!0),this.adjustData=null,this.attributes=null,this.incrementalLoad=null,this.outputXSL=null,this.range=null,this.record=null,this.startNode=null,this.uri=null,this.window=null,this.xsl=null,this.excludeNS=new dc,this.transform=new dc}}class tQ extends uc{constructor(A){super(wh,"debug",!0),this.uri=null}}class iQ extends mc{constructor(A){super(wh,"defaultTypeface"),this.writingScript=MI(A.writingScript,["*","Arabic","Cyrillic","EastEuropeanRoman","Greek","Hebrew","Japanese","Korean","Roman","SimplifiedChinese","Thai","TraditionalChinese","Vietnamese"])}}class aQ extends yc{constructor(A){super(wh,"destination",["pdf","pcl","ps","webClient","zpl"])}}class sQ extends bc{constructor(A){super(wh,"documentAssembly")}}class nQ extends uc{constructor(A){super(wh,"driver",!0),this.name=A.name?A.name.trim():"",this.fontInfo=null,this.xdc=null}}class gQ extends yc{constructor(A){super(wh,"duplexOption",["simplex","duplexFlipLongEdge","duplexFlipShortEdge"])}}class rQ extends yc{constructor(A){super(wh,"dynamicRender",["forbidden","required"])}}class oQ extends bc{constructor(A){super(wh,"embed")}}class IQ extends bc{constructor(A){super(wh,"encrypt")}}class cQ extends uc{constructor(A){super(wh,"encryption",!0),this.encrypt=null,this.encryptionLevel=null,this.permissions=null}}class CQ extends yc{constructor(A){super(wh,"encryptionLevel",["40bit","128bit"])}}class BQ extends wc{constructor(A){super(wh,"enforce")}}class hQ extends uc{constructor(A){super(wh,"equate"),this.force=NI({data:A.force,defaultValue:1,validate:A=>0===A}),this.from=A.from||"",this.to=A.to||""}}class QQ extends uc{constructor(A){super(wh,"equateRange"),this.from=A.from||"",this.to=A.to||"",this._unicodeRange=A.unicodeRange||""}get unicodeRange(){const A=[],e=/U\+([0-9a-fA-F]+)/,t=this._unicodeRange;for(let i of t.split(",").map((A=>A.trim())).filter((A=>!!A)))i=i.split("-",2).map((A=>{const t=A.match(e);return t?parseInt(t[1],16):0})),1===i.length&&i.push(i[0]),A.push(i);return M(this,"unicodeRange",A)}}class lQ extends mc{constructor(A){super(wh,"exclude")}[bo](){this[mo]=this[mo].trim().split(/\s+/).filter((A=>A&&["calculate","close","enter","exit","initialize","ready","validate"].includes(A)))}}class EQ extends wc{constructor(A){super(wh,"excludeNS")}}class uQ extends yc{constructor(A){super(wh,"flipLabel",["usePrinterSetting","on","off"])}}class dQ extends uc{constructor(A){super(wh,"fontInfo",!0),this.embed=null,this.map=null,this.subsetBelow=null,this.alwaysEmbed=new dc,this.defaultTypeface=new dc,this.neverEmbed=new dc}}class fQ extends bc{constructor(A){super(wh,"formFieldFilling")}}class pQ extends wc{constructor(A){super(wh,"groupParent")}}class mQ extends yc{constructor(A){super(wh,"ifEmpty",["dataValue","dataGroup","ignore","remove"])}}class yQ extends wc{constructor(A){super(wh,"includeXDPContent")}}class wQ extends yc{constructor(A){super(wh,"incrementalLoad",["none","forwardOnly"])}}class DQ extends bc{constructor(A){super(wh,"incrementalMerge")}}class bQ extends bc{constructor(A){super(wh,"interactive")}}class kQ extends yc{constructor(A){super(wh,"jog",["usePrinterSetting","none","pageSet"])}}class FQ extends uc{constructor(A){super(wh,"labelPrinter",!0),this.name=MI(A.name,["zpl","dpl","ipl","tcpl"]),this.batchOutput=null,this.flipLabel=null,this.fontInfo=null,this.xdc=null}}class SQ extends yc{constructor(A){super(wh,"layout",["paginate","panel"])}}class RQ extends Dc{constructor(A){super(wh,"level",0,(A=>A>0))}}class GQ extends bc{constructor(A){super(wh,"linearized")}}class NQ extends wc{constructor(A){super(wh,"locale")}}class xQ extends wc{constructor(A){super(wh,"localeSet")}}class UQ extends uc{constructor(A){super(wh,"log",!0),this.mode=null,this.threshold=null,this.to=null,this.uri=null}}class MQ extends uc{constructor(A){super(wh,"map",!0),this.equate=new dc,this.equateRange=new dc}}class LQ extends uc{constructor(A){super(wh,"mediumInfo",!0),this.map=null}}class JQ extends uc{constructor(A){super(wh,"message",!0),this.msgId=null,this.severity=null}}class HQ extends uc{constructor(A){super(wh,"messaging",!0),this.message=new dc}}class YQ extends yc{constructor(A){super(wh,"mode",["append","overwrite"])}}class vQ extends bc{constructor(A){super(wh,"modifyAnnots")}}class KQ extends Dc{constructor(A){super(wh,"msgId",1,(A=>A>=1))}}class qQ extends wc{constructor(A){super(wh,"nameAttr")}}class TQ extends mc{constructor(A){super(wh,"neverEmbed")}}class PQ extends Dc{constructor(A){super(wh,"numberOfCopies",null,(A=>A>=2&&A<=5))}}class WQ extends uc{constructor(A){super(wh,"openAction",!0),this.destination=null}}class ZQ extends uc{constructor(A){super(wh,"output",!0),this.to=null,this.type=null,this.uri=null}}class OQ extends wc{constructor(A){super(wh,"outputBin")}}class XQ extends uc{constructor(A){super(wh,"outputXSL",!0),this.uri=null}}class VQ extends yc{constructor(A){super(wh,"overprint",["none","both","draw","field"])}}class jQ extends wc{constructor(A){super(wh,"packets")}[bo](){"*"!==this[mo]&&(this[mo]=this[mo].trim().split(/\s+/).filter((A=>["config","datasets","template","xfdf","xslt"].includes(A))))}}class zQ extends uc{constructor(A){super(wh,"pageOffset"),this.x=NI({data:A.x,defaultValue:"useXDCSetting",validate:A=>!0}),this.y=NI({data:A.y,defaultValue:"useXDCSetting",validate:A=>!0})}}class _Q extends wc{constructor(A){super(wh,"pageRange")}[bo](){const A=this[mo].trim().split(/\s+/).map((A=>parseInt(A,10))),e=[];for(let t=0,i=A.length;t!1))}}class tl extends uc{constructor(A){super(wh,"pcl",!0),this.name=A.name||"",this.batchOutput=null,this.fontInfo=null,this.jog=null,this.mediumInfo=null,this.outputBin=null,this.pageOffset=null,this.staple=null,this.xdc=null}}class il extends uc{constructor(A){super(wh,"pdf",!0),this.name=A.name||"",this.adobeExtensionLevel=null,this.batchOutput=null,this.compression=null,this.creator=null,this.encryption=null,this.fontInfo=null,this.interactive=null,this.linearized=null,this.openAction=null,this.pdfa=null,this.producer=null,this.renderPolicy=null,this.scriptModel=null,this.silentPrint=null,this.submitFormat=null,this.tagged=null,this.version=null,this.viewerPreferences=null,this.xdc=null}}class al extends uc{constructor(A){super(wh,"pdfa",!0),this.amd=null,this.conformance=null,this.includeXDPContent=null,this.part=null}}class sl extends uc{constructor(A){super(wh,"permissions",!0),this.accessibleContent=null,this.change=null,this.contentCopy=null,this.documentAssembly=null,this.formFieldFilling=null,this.modifyAnnots=null,this.plaintextMetadata=null,this.print=null,this.printHighQuality=null}}class nl extends bc{constructor(A){super(wh,"pickTrayByPDFSize")}}class gl extends wc{constructor(A){super(wh,"picture")}}class rl extends bc{constructor(A){super(wh,"plaintextMetadata")}}class ol extends yc{constructor(A){super(wh,"presence",["preserve","dissolve","dissolveStructure","ignore","remove"])}}class Il extends uc{constructor(A){super(wh,"present",!0),this.behaviorOverride=null,this.cache=null,this.common=null,this.copies=null,this.destination=null,this.incrementalMerge=null,this.layout=null,this.output=null,this.overprint=null,this.pagination=null,this.paginationOverride=null,this.script=null,this.validate=null,this.xdp=null,this.driver=new dc,this.labelPrinter=new dc,this.pcl=new dc,this.pdf=new dc,this.ps=new dc,this.submitUrl=new dc,this.webClient=new dc,this.zpl=new dc}}class cl extends bc{constructor(A){super(wh,"print")}}class Cl extends bc{constructor(A){super(wh,"printHighQuality")}}class Bl extends yc{constructor(A){super(wh,"printScaling",["appdefault","noScaling"])}}class hl extends wc{constructor(A){super(wh,"printerName")}}class Ql extends wc{constructor(A){super(wh,"producer")}}class ll extends uc{constructor(A){super(wh,"ps",!0),this.name=A.name||"",this.batchOutput=null,this.fontInfo=null,this.jog=null,this.mediumInfo=null,this.outputBin=null,this.staple=null,this.xdc=null}}class El extends mc{constructor(A){super(wh,"range")}[bo](){this[mo]=this[mo].trim().split(/\s*,\s*/,2).map((A=>A.split("-").map((A=>parseInt(A.trim(),10))))).filter((A=>A.every((A=>!isNaN(A))))).map((A=>(1===A.length&&A.push(A[0]),A)))}}class ul extends mc{constructor(A){super(wh,"record")}[bo](){this[mo]=this[mo].trim();const A=parseInt(this[mo],10);!isNaN(A)&&A>=0&&(this[mo]=A)}}class dl extends mc{constructor(A){super(wh,"relevant")}[bo](){this[mo]=this[mo].trim().split(/\s+/)}}class fl extends mc{constructor(A){super(wh,"rename")}[bo](){this[mo]=this[mo].trim(),(this[mo].toLowerCase().startsWith("xml")||new RegExp("[\\p{L}_][\\p{L}\\d._\\p{M}-]*","u").test(this[mo]))&&G("XFA - Rename: invalid XFA name")}}class pl extends yc{constructor(A){super(wh,"renderPolicy",["server","client"])}}class ml extends yc{constructor(A){super(wh,"runScripts",["both","client","none","server"])}}class yl extends uc{constructor(A){super(wh,"script",!0),this.currentPage=null,this.exclude=null,this.runScripts=null}}class wl extends yc{constructor(A){super(wh,"scriptModel",["XFA","none"])}}class Dl extends yc{constructor(A){super(wh,"severity",["ignore","error","information","trace","warning"])}}class bl extends uc{constructor(A){super(wh,"silentPrint",!0),this.addSilentPrint=null,this.printerName=null}}class kl extends uc{constructor(A){super(wh,"staple"),this.mode=MI(A.mode,["usePrinterSetting","on","off"])}}class Fl extends wc{constructor(A){super(wh,"startNode")}}class Sl extends Dc{constructor(A){super(wh,"startPage",0,(A=>!0))}}class Rl extends yc{constructor(A){super(wh,"submitFormat",["html","delegate","fdf","xml","pdf"])}}class Gl extends wc{constructor(A){super(wh,"submitUrl")}}class Nl extends Dc{constructor(A){super(wh,"subsetBelow",100,(A=>A>=0&&A<=100))}}class xl extends bc{constructor(A){super(wh,"suppressBanner")}}class Ul extends bc{constructor(A){super(wh,"tagged")}}class Ml extends uc{constructor(A){super(wh,"template",!0),this.base=null,this.relevant=null,this.startPage=null,this.uri=null,this.xsl=null}}class Ll extends yc{constructor(A){super(wh,"threshold",["trace","error","information","warning"])}}class Jl extends yc{constructor(A){super(wh,"to",["null","memory","stderr","stdout","system","uri"])}}class Hl extends uc{constructor(A){super(wh,"templateCache"),this.maxEntries=NI({data:A.maxEntries,defaultValue:5,validate:A=>A>=0})}}class Yl extends uc{constructor(A){super(wh,"trace",!0),this.area=new dc}}class vl extends uc{constructor(A){super(wh,"transform",!0),this.groupParent=null,this.ifEmpty=null,this.nameAttr=null,this.picture=null,this.presence=null,this.rename=null,this.whitespace=null}}class Kl extends yc{constructor(A){super(wh,"type",["none","ascii85","asciiHex","ccittfax","flate","lzw","runLength","native","xdp","mergedXDP"])}}class ql extends wc{constructor(A){super(wh,"uri")}}class Tl extends yc{constructor(A){super(wh,"validate",["preSubmit","prePrint","preExecute","preSave"])}}class Pl extends mc{constructor(A){super(wh,"validateApprovalSignatures")}[bo](){this[mo]=this[mo].trim().split(/\s+/).filter((A=>["docReady","postSign"].includes(A)))}}class Wl extends yc{constructor(A){super(wh,"validationMessaging",["allMessagesIndividually","allMessagesTogether","firstMessageOnly","noMessages"])}}class Zl extends yc{constructor(A){super(wh,"version",["1.7","1.6","1.5","1.4","1.3","1.2"])}}class Ol extends uc{constructor(A){super(wh,"VersionControl"),this.outputBelow=MI(A.outputBelow,["warn","error","update"]),this.sourceAbove=MI(A.sourceAbove,["warn","error"]),this.sourceBelow=MI(A.sourceBelow,["update","maintain"])}}class Xl extends uc{constructor(A){super(wh,"viewerPreferences",!0),this.ADBE_JSConsole=null,this.ADBE_JSDebugger=null,this.addViewerPreferences=null,this.duplexOption=null,this.enforce=null,this.numberOfCopies=null,this.pageRange=null,this.pickTrayByPDFSize=null,this.printScaling=null}}class Vl extends uc{constructor(A){super(wh,"webClient",!0),this.name=A.name?A.name.trim():"",this.fontInfo=null,this.xdc=null}}class jl extends yc{constructor(A){super(wh,"whitespace",["preserve","ltrim","normalize","rtrim","trim"])}}class zl extends mc{constructor(A){super(wh,"window")}[bo](){const A=this[mo].trim().split(/\s*,\s*/,2).map((A=>parseInt(A,10)));A.some((A=>isNaN(A)))?this[mo]=[0,0]:(1===A.length&&A.push(A[0]),this[mo]=A)}}class _l extends uc{constructor(A){super(wh,"xdc",!0),this.uri=new dc,this.xsl=new dc}}class $l extends uc{constructor(A){super(wh,"xdp",!0),this.packets=null}}class AE extends uc{constructor(A){super(wh,"xsl",!0),this.debug=null,this.uri=null}}class eE extends uc{constructor(A){super(wh,"zpl",!0),this.name=A.name?A.name.trim():"",this.batchOutput=null,this.flipLabel=null,this.fontInfo=null,this.xdc=null}}class tE{static[kI](A,e){if(tE.hasOwnProperty(A))return tE[A](e)}static acrobat(A){return new Dh(A)}static acrobat7(A){return new bh(A)}static ADBE_JSConsole(A){return new kh(A)}static ADBE_JSDebugger(A){return new Fh(A)}static addSilentPrint(A){return new Sh(A)}static addViewerPreferences(A){return new Rh(A)}static adjustData(A){return new Gh(A)}static adobeExtensionLevel(A){return new Nh(A)}static agent(A){return new xh(A)}static alwaysEmbed(A){return new Uh(A)}static amd(A){return new Mh(A)}static area(A){return new Lh(A)}static attributes(A){return new Jh(A)}static autoSave(A){return new Hh(A)}static base(A){return new Yh(A)}static batchOutput(A){return new vh(A)}static behaviorOverride(A){return new Kh(A)}static cache(A){return new qh(A)}static change(A){return new Th(A)}static common(A){return new Ph(A)}static compress(A){return new Wh(A)}static compressLogicalStructure(A){return new Zh(A)}static compressObjectStream(A){return new Oh(A)}static compression(A){return new Xh(A)}static config(A){return new Vh(A)}static conformance(A){return new jh(A)}static contentCopy(A){return new zh(A)}static copies(A){return new _h(A)}static creator(A){return new $h(A)}static currentPage(A){return new AQ(A)}static data(A){return new eQ(A)}static debug(A){return new tQ(A)}static defaultTypeface(A){return new iQ(A)}static destination(A){return new aQ(A)}static documentAssembly(A){return new sQ(A)}static driver(A){return new nQ(A)}static duplexOption(A){return new gQ(A)}static dynamicRender(A){return new rQ(A)}static embed(A){return new oQ(A)}static encrypt(A){return new IQ(A)}static encryption(A){return new cQ(A)}static encryptionLevel(A){return new CQ(A)}static enforce(A){return new BQ(A)}static equate(A){return new hQ(A)}static equateRange(A){return new QQ(A)}static exclude(A){return new lQ(A)}static excludeNS(A){return new EQ(A)}static flipLabel(A){return new uQ(A)}static fontInfo(A){return new dQ(A)}static formFieldFilling(A){return new fQ(A)}static groupParent(A){return new pQ(A)}static ifEmpty(A){return new mQ(A)}static includeXDPContent(A){return new yQ(A)}static incrementalLoad(A){return new wQ(A)}static incrementalMerge(A){return new DQ(A)}static interactive(A){return new bQ(A)}static jog(A){return new kQ(A)}static labelPrinter(A){return new FQ(A)}static layout(A){return new SQ(A)}static level(A){return new RQ(A)}static linearized(A){return new GQ(A)}static locale(A){return new NQ(A)}static localeSet(A){return new xQ(A)}static log(A){return new UQ(A)}static map(A){return new MQ(A)}static mediumInfo(A){return new LQ(A)}static message(A){return new JQ(A)}static messaging(A){return new HQ(A)}static mode(A){return new YQ(A)}static modifyAnnots(A){return new vQ(A)}static msgId(A){return new KQ(A)}static nameAttr(A){return new qQ(A)}static neverEmbed(A){return new TQ(A)}static numberOfCopies(A){return new PQ(A)}static openAction(A){return new WQ(A)}static output(A){return new ZQ(A)}static outputBin(A){return new OQ(A)}static outputXSL(A){return new XQ(A)}static overprint(A){return new VQ(A)}static packets(A){return new jQ(A)}static pageOffset(A){return new zQ(A)}static pageRange(A){return new _Q(A)}static pagination(A){return new $Q(A)}static paginationOverride(A){return new Al(A)}static part(A){return new el(A)}static pcl(A){return new tl(A)}static pdf(A){return new il(A)}static pdfa(A){return new al(A)}static permissions(A){return new sl(A)}static pickTrayByPDFSize(A){return new nl(A)}static picture(A){return new gl(A)}static plaintextMetadata(A){return new rl(A)}static presence(A){return new ol(A)}static present(A){return new Il(A)}static print(A){return new cl(A)}static printHighQuality(A){return new Cl(A)}static printScaling(A){return new Bl(A)}static printerName(A){return new hl(A)}static producer(A){return new Ql(A)}static ps(A){return new ll(A)}static range(A){return new El(A)}static record(A){return new ul(A)}static relevant(A){return new dl(A)}static rename(A){return new fl(A)}static renderPolicy(A){return new pl(A)}static runScripts(A){return new ml(A)}static script(A){return new yl(A)}static scriptModel(A){return new wl(A)}static severity(A){return new Dl(A)}static silentPrint(A){return new bl(A)}static staple(A){return new kl(A)}static startNode(A){return new Fl(A)}static startPage(A){return new Sl(A)}static submitFormat(A){return new Rl(A)}static submitUrl(A){return new Gl(A)}static subsetBelow(A){return new Nl(A)}static suppressBanner(A){return new xl(A)}static tagged(A){return new Ul(A)}static template(A){return new Ml(A)}static templateCache(A){return new Hl(A)}static threshold(A){return new Ll(A)}static to(A){return new Jl(A)}static trace(A){return new Yl(A)}static transform(A){return new vl(A)}static type(A){return new Kl(A)}static uri(A){return new ql(A)}static validate(A){return new Tl(A)}static validateApprovalSignatures(A){return new Pl(A)}static validationMessaging(A){return new Wl(A)}static version(A){return new Zl(A)}static versionControl(A){return new Ol(A)}static viewerPreferences(A){return new Xl(A)}static webClient(A){return new Vl(A)}static whitespace(A){return new jl(A)}static window(A){return new zl(A)}static xdc(A){return new _l(A)}static xdp(A){return new $l(A)}static xsl(A){return new AE(A)}static zpl(A){return new eE(A)}}const iE=FI.connectionSet.id;class aE extends uc{constructor(A){super(iE,"connectionSet",!0),this.wsdlConnection=new dc,this.xmlConnection=new dc,this.xsdConnection=new dc}}class sE extends uc{constructor(A){super(iE,"effectiveInputPolicy"),this.id=A.id||"",this.name=A.name||"",this.use=A.use||"",this.usehref=A.usehref||""}}class nE extends uc{constructor(A){super(iE,"effectiveOutputPolicy"),this.id=A.id||"",this.name=A.name||"",this.use=A.use||"",this.usehref=A.usehref||""}}class gE extends wc{constructor(A){super(iE,"operation"),this.id=A.id||"",this.input=A.input||"",this.name=A.name||"",this.output=A.output||"",this.use=A.use||"",this.usehref=A.usehref||""}}class rE extends wc{constructor(A){super(iE,"rootElement"),this.id=A.id||"",this.name=A.name||"",this.use=A.use||"",this.usehref=A.usehref||""}}class oE extends wc{constructor(A){super(iE,"soapAction"),this.id=A.id||"",this.name=A.name||"",this.use=A.use||"",this.usehref=A.usehref||""}}class IE extends wc{constructor(A){super(iE,"soapAddress"),this.id=A.id||"",this.name=A.name||"",this.use=A.use||"",this.usehref=A.usehref||""}}class cE extends wc{constructor(A){super(iE,"uri"),this.id=A.id||"",this.name=A.name||"",this.use=A.use||"",this.usehref=A.usehref||""}}class CE extends wc{constructor(A){super(iE,"wsdlAddress"),this.id=A.id||"",this.name=A.name||"",this.use=A.use||"",this.usehref=A.usehref||""}}class BE extends uc{constructor(A){super(iE,"wsdlConnection",!0),this.dataDescription=A.dataDescription||"",this.name=A.name||"",this.effectiveInputPolicy=null,this.effectiveOutputPolicy=null,this.operation=null,this.soapAction=null,this.soapAddress=null,this.wsdlAddress=null}}class hE extends uc{constructor(A){super(iE,"xmlConnection",!0),this.dataDescription=A.dataDescription||"",this.name=A.name||"",this.uri=null}}class QE extends uc{constructor(A){super(iE,"xsdConnection",!0),this.dataDescription=A.dataDescription||"",this.name=A.name||"",this.rootElement=null,this.uri=null}}class lE{static[kI](A,e){if(lE.hasOwnProperty(A))return lE[A](e)}static connectionSet(A){return new aE(A)}static effectiveInputPolicy(A){return new sE(A)}static effectiveOutputPolicy(A){return new nE(A)}static operation(A){return new gE(A)}static rootElement(A){return new rE(A)}static soapAction(A){return new oE(A)}static soapAddress(A){return new IE(A)}static uri(A){return new cE(A)}static wsdlAddress(A){return new CE(A)}static wsdlConnection(A){return new BE(A)}static xmlConnection(A){return new hE(A)}static xsdConnection(A){return new QE(A)}}const EE=FI.datasets.id;class uE extends pc{constructor(A){super(EE,"data",A)}[_o](){return!0}}class dE extends uc{constructor(A){super(EE,"datasets",!0),this.data=null,this.Signature=null}[gI](A){const e=A[sI];("data"===e&&A[aI]===EE||"Signature"===e&&A[aI]===FI.signature.id)&&(this[e]=A),this[ho](A)}}class fE{static[kI](A,e){if(fE.hasOwnProperty(A))return fE[A](e)}static datasets(A){return new dE(A)}static data(A){return new uE(A)}}const pE=FI.localeSet.id;class mE extends uc{constructor(A){super(pE,"calendarSymbols",!0),this.name="gregorian",this.dayNames=new dc(2),this.eraNames=null,this.meridiemNames=null,this.monthNames=new dc(2)}}class yE extends wc{constructor(A){super(pE,"currencySymbol"),this.name=MI(A.name,["symbol","isoname","decimal"])}}class wE extends uc{constructor(A){super(pE,"currencySymbols",!0),this.currencySymbol=new dc(3)}}class DE extends wc{constructor(A){super(pE,"datePattern"),this.name=MI(A.name,["full","long","med","short"])}}class bE extends uc{constructor(A){super(pE,"datePatterns",!0),this.datePattern=new dc(4)}}class kE extends mc{constructor(A){super(pE,"dateTimeSymbols")}}class FE extends wc{constructor(A){super(pE,"day")}}class SE extends uc{constructor(A){super(pE,"dayNames",!0),this.abbr=NI({data:A.abbr,defaultValue:0,validate:A=>1===A}),this.day=new dc(7)}}class RE extends wc{constructor(A){super(pE,"era")}}class GE extends uc{constructor(A){super(pE,"eraNames",!0),this.era=new dc(2)}}class NE extends uc{constructor(A){super(pE,"locale",!0),this.desc=A.desc||"",this.name="isoname",this.calendarSymbols=null,this.currencySymbols=null,this.datePatterns=null,this.dateTimeSymbols=null,this.numberPatterns=null,this.numberSymbols=null,this.timePatterns=null,this.typeFaces=null}}class xE extends uc{constructor(A){super(pE,"localeSet",!0),this.locale=new dc}}class UE extends wc{constructor(A){super(pE,"meridiem")}}class ME extends uc{constructor(A){super(pE,"meridiemNames",!0),this.meridiem=new dc(2)}}class LE extends wc{constructor(A){super(pE,"month")}}class JE extends uc{constructor(A){super(pE,"monthNames",!0),this.abbr=NI({data:A.abbr,defaultValue:0,validate:A=>1===A}),this.month=new dc(12)}}class HE extends wc{constructor(A){super(pE,"numberPattern"),this.name=MI(A.name,["full","long","med","short"])}}class YE extends uc{constructor(A){super(pE,"numberPatterns",!0),this.numberPattern=new dc(4)}}class vE extends wc{constructor(A){super(pE,"numberSymbol"),this.name=MI(A.name,["decimal","grouping","percent","minus","zero"])}}class KE extends uc{constructor(A){super(pE,"numberSymbols",!0),this.numberSymbol=new dc(5)}}class qE extends wc{constructor(A){super(pE,"timePattern"),this.name=MI(A.name,["full","long","med","short"])}}class TE extends uc{constructor(A){super(pE,"timePatterns",!0),this.timePattern=new dc(4)}}class PE extends uc{constructor(A){super(pE,"typeFace",!0),this.name=""|A.name}}class WE extends uc{constructor(A){super(pE,"typeFaces",!0),this.typeFace=new dc}}class ZE{static[kI](A,e){if(ZE.hasOwnProperty(A))return ZE[A](e)}static calendarSymbols(A){return new mE(A)}static currencySymbol(A){return new yE(A)}static currencySymbols(A){return new wE(A)}static datePattern(A){return new DE(A)}static datePatterns(A){return new bE(A)}static dateTimeSymbols(A){return new kE(A)}static day(A){return new FE(A)}static dayNames(A){return new SE(A)}static era(A){return new RE(A)}static eraNames(A){return new GE(A)}static locale(A){return new NE(A)}static localeSet(A){return new xE(A)}static meridiem(A){return new UE(A)}static meridiemNames(A){return new ME(A)}static month(A){return new LE(A)}static monthNames(A){return new JE(A)}static numberPattern(A){return new HE(A)}static numberPatterns(A){return new YE(A)}static numberSymbol(A){return new vE(A)}static numberSymbols(A){return new KE(A)}static timePattern(A){return new qE(A)}static timePatterns(A){return new TE(A)}static typeFace(A){return new PE(A)}static typeFaces(A){return new WE(A)}}const OE=FI.signature.id;class XE extends uc{constructor(A){super(OE,"signature",!0)}}class VE{static[kI](A,e){if(VE.hasOwnProperty(A))return VE[A](e)}static signature(A){return new XE(A)}}const jE=FI.stylesheet.id;class zE extends uc{constructor(A){super(jE,"stylesheet",!0)}}class _E{static[kI](A,e){if(_E.hasOwnProperty(A))return _E[A](e)}static stylesheet(A){return new zE(A)}}const $E=FI.xdp.id;class Au extends uc{constructor(A){super($E,"xdp",!0),this.uuid=A.uuid||"",this.timeStamp=A.timeStamp||"",this.config=null,this.connectionSet=null,this.datasets=null,this.localeSet=null,this.stylesheet=new dc,this.template=null}[rI](A){const e=FI[A[sI]];return e&&A[aI]===e.id}}class eu{static[kI](A,e){if(eu.hasOwnProperty(A))return eu[A](e)}static xdp(A){return new Au(A)}}const tu=FI.xhtml.id,iu=Symbol(),au=new Set(["color","font","font-family","font-size","font-stretch","font-style","font-weight","margin","margin-bottom","margin-left","margin-right","margin-top","letter-spacing","line-height","orphans","page-break-after","page-break-before","page-break-inside","tab-interval","tab-stop","text-align","text-decoration","text-indent","vertical-align","widows","kerning-mode","xfa-font-horizontal-scale","xfa-font-vertical-scale","xfa-spacerun","xfa-tab-stops"]),su=new Map([["page-break-after","breakAfter"],["page-break-before","breakBefore"],["page-break-inside","breakInside"],["kerning-mode",A=>"none"===A?"none":"normal"],["xfa-font-horizontal-scale",A=>`scaleX(${Math.max(0,Math.min(parseInt(A)/100)).toFixed(2)})`],["xfa-font-vertical-scale",A=>`scaleY(${Math.max(0,Math.min(parseInt(A)/100)).toFixed(2)})`],["xfa-spacerun",""],["xfa-tab-stops",""],["font-size",(A,e)=>Fc(.99*(A=e.fontSize=LI(A)))],["letter-spacing",A=>Fc(LI(A))],["line-height",A=>Fc(LI(A))],["margin",A=>Fc(LI(A))],["margin-bottom",A=>Fc(LI(A))],["margin-left",A=>Fc(LI(A))],["margin-right",A=>Fc(LI(A))],["margin-top",A=>Fc(LI(A))],["text-indent",A=>Fc(LI(A))],["font-family",A=>A],["vertical-align",A=>Fc(LI(A))]]),nu=/\s+/g,gu=/[\r\n]+/g,ru=/\r\n?/g;function ou(A,e,t){const i=Object.create(null);if(!A)return i;const a=Object.create(null);for(const[e,t]of A.split(";").map((A=>A.split(":",2)))){const A=su.get(e);if(""===A)continue;let s=t;A&&(s="string"==typeof A?A:A(t,a)),e.endsWith("scale")?i.transform=i.transform?`${i[e]} ${s}`:s:i[e.replaceAll(/-([a-zA-Z])/g,((A,e)=>e.toUpperCase()))]=s}if(i.fontFamily&&Tc({typeface:i.fontFamily,weight:i.fontWeight||"normal",posture:i.fontStyle||"normal",size:a.fontSize||0},e,e[To].fontFinder,i),t&&i.verticalAlign&&"0px"!==i.verticalAlign&&i.fontSize){const A=.583,e=.333,t=LI(i.fontSize);i.fontSize=Fc(t*A),i.verticalAlign=Fc(Math.sign(LI(i.verticalAlign))*t*e)}return t&&i.fontSize&&(i.fontSize=`calc(${i.fontSize} * var(--scale-factor))`),Hc(i),i}const Iu=new Set(["body","html"]);class cu extends pc{constructor(A,e){super(tu,e),this[iu]=!1,this.style=A.style||""}[lo](A){var e;super[lo](A),this.style=(e=this).style?e.style.trim().split(/\s*;\s*/).filter((A=>!!A)).map((A=>A.split(/\s*:\s*/,2))).filter((([A,t])=>("font-family"===A&&e[To].usedTypefaces.add(t),au.has(A)))).map((A=>A.join(":"))).join(";"):""}[Co](){return!Iu.has(this[sI])}[oI](A,e=!1){e?this[iu]=!0:(A=A.replaceAll(gu,""),this.style.includes("xfa-spacerun:yes")||(A=A.replaceAll(nu," "))),A&&(this[mo]+=A)}[II](A,e=!0){const t=Object.create(null),i={top:NaN,bottom:NaN,left:NaN,right:NaN};let a=null;for(const[A,e]of this.style.split(";").map((A=>A.split(":",2))))switch(A){case"font-family":t.typeface=GI(e);break;case"font-size":t.size=LI(e);break;case"font-weight":t.weight=e;break;case"font-style":t.posture=e;break;case"letter-spacing":t.letterSpacing=LI(e);break;case"margin":const A=e.split(/ \t/).map((A=>LI(A)));switch(A.length){case 1:i.top=i.bottom=i.left=i.right=A[0];break;case 2:i.top=i.bottom=A[0],i.left=i.right=A[1];break;case 3:i.top=A[0],i.bottom=A[2],i.left=i.right=A[1];break;case 4:i.top=A[0],i.left=A[1],i.bottom=A[2],i.right=A[3]}break;case"margin-top":i.top=LI(e);break;case"margin-bottom":i.bottom=LI(e);break;case"margin-left":i.left=LI(e);break;case"margin-right":i.right=LI(e);break;case"line-height":a=LI(e)}if(A.pushData(t,i,a),this[mo])A.addString(this[mo]);else for(const e of this[Jo]())"#text"!==e[sI]?e[II](A):A.addString(e[mo]);e&&A.popFont()}[yI](A){const e=[];if(this[Do]={children:e},this[Qo]({}),0===e.length&&!this[mo])return YI.EMPTY;let t;return t=this[iu]?this[mo]?this[mo].replaceAll(ru,"\n"):void 0:this[mo]||void 0,YI.success({name:this[sI],attributes:{href:this.href,style:ou(this.style,this,this[iu])},children:e,value:t})}}class Cu extends cu{constructor(A){super(A,"a"),this.href=Pc(A.href)||""}}class Bu extends cu{constructor(A){super(A,"b")}[II](A){A.pushFont({weight:"bold"}),super[II](A),A.popFont()}}class hu extends cu{constructor(A){super(A,"body")}[yI](A){const e=super[yI](A),{html:t}=e;return t?(t.name="div",t.attributes.class=["xfaRich"],e):YI.EMPTY}}class Qu extends cu{constructor(A){super(A,"br")}[pI](){return"\n"}[II](A){A.addString("\n")}[yI](A){return YI.success({name:"br"})}}class lu extends cu{constructor(A){super(A,"html")}[yI](A){const e=[];if(this[Do]={children:e},this[Qo]({}),0===e.length)return YI.success({name:"div",attributes:{class:["xfaRich"],style:{}},value:this[mo]||""});if(1===e.length){const A=e[0];if(A.attributes?.class.includes("xfaRich"))return YI.success(A)}return YI.success({name:"div",attributes:{class:["xfaRich"],style:{}},children:e})}}class Eu extends cu{constructor(A){super(A,"i")}[II](A){A.pushFont({posture:"italic"}),super[II](A),A.popFont()}}class uu extends cu{constructor(A){super(A,"li")}}class du extends cu{constructor(A){super(A,"ol")}}class fu extends cu{constructor(A){super(A,"p")}[II](A){super[II](A,!1),A.addString("\n"),A.addPara(),A.popFont()}[pI](){return this[Ko]()[Jo]().at(-1)===this?super[pI]():super[pI]()+"\n"}}class pu extends cu{constructor(A){super(A,"span")}}class mu extends cu{constructor(A){super(A,"sub")}}class yu extends cu{constructor(A){super(A,"sup")}}class wu extends cu{constructor(A){super(A,"ul")}}class Du{static[kI](A,e){if(Du.hasOwnProperty(A))return Du[A](e)}static a(A){return new Cu(A)}static b(A){return new Bu(A)}static body(A){return new hu(A)}static br(A){return new Qu(A)}static html(A){return new lu(A)}static i(A){return new Eu(A)}static li(A){return new uu(A)}static ol(A){return new du(A)}static p(A){return new fu(A)}static span(A){return new pu(A)}static sub(A){return new mu(A)}static sup(A){return new yu(A)}static ul(A){return new wu(A)}}const bu={config:tE,connection:lE,datasets:fE,localeSet:ZE,signature:VE,stylesheet:_E,template:dh,xdp:eu,xhtml:Du};class ku{constructor(A){this.namespaceId=A}[kI](A,e){return new pc(this.namespaceId,A,e)}}class Fu extends uc{constructor(A){super(-1,"root",Object.create(null)),this.element=null,this[Wo]=A}[gI](A){return this.element=A,!0}[bo](){super[bo](),this.element.template instanceof gh&&(this[Wo].set(hI,this.element),this.element.template[QI](this[Wo]),this.element.template[Wo]=this[Wo])}}class Su extends uc{constructor(){super(-1,"",Object.create(null))}[gI](A){return!1}}class Ru{constructor(A=null){this._namespaceStack=[],this._nsAgnosticLevel=0,this._namespacePrefixes=new Map,this._namespaces=new Map,this._nextNsId=Math.max(...Object.values(FI).map((({id:A})=>A))),this._currentNamespace=A||new ku(++this._nextNsId)}buildRoot(A){return new Fu(A)}build({nsPrefix:A,name:e,attributes:t,namespace:i,prefixes:a}){const s=null!==i;if(s&&(this._namespaceStack.push(this._currentNamespace),this._currentNamespace=this._searchNamespace(i)),a&&this._addNamespacePrefix(a),t.hasOwnProperty(nI)){const A=bu.datasets,e=t[nI];let i=null;for(const[t,a]of Object.entries(e))if(this._getNamespaceToUse(t)===A){i={xfa:a};break}i?t[nI]=i:delete t[nI]}const n=this._getNamespaceToUse(A),g=n?.[kI](e,t)||new Su;return g[_o]()&&this._nsAgnosticLevel++,(s||a||g[_o]())&&(g[uo]={hasNamespace:s,prefixes:a,nsAgnostic:g[_o]()}),g}isNsAgnostic(){return this._nsAgnosticLevel>0}_searchNamespace(A){let e=this._namespaces.get(A);if(e)return e;for(const[t,{check:i}]of Object.entries(FI))if(i(A)){if(e=bu[t],e)return this._namespaces.set(A,e),e;break}return e=new ku(++this._nextNsId),this._namespaces.set(A,e),e}_addNamespacePrefix(A){for(const{prefix:e,value:t}of A){const A=this._searchNamespace(t);let i=this._namespacePrefixes.get(e);i||(i=[],this._namespacePrefixes.set(e,i)),i.push(A)}}_getNamespaceToUse(A){if(!A)return this._currentNamespace;const e=this._namespacePrefixes.get(A);return e?.length>0?e.at(-1):(G(`Unknown namespace prefix: ${A}.`),null)}clean(A){const{hasNamespace:e,prefixes:t,nsAgnostic:i}=A;e&&(this._currentNamespace=this._namespaceStack.pop()),t&&t.forEach((({prefix:A})=>{this._namespacePrefixes.get(A).pop()})),i&&this._nsAgnosticLevel--}}class Gu extends Fr{constructor(A=null,e=!1){super(),this._builder=new Ru(A),this._stack=[],this._globalData={usedTypefaces:new Set},this._ids=new Map,this._current=this._builder.buildRoot(this._ids),this._errorCode=0,this._whiteRegex=/^\s+$/,this._nbsps=/\xa0+/g,this._richText=e}parse(A){if(this.parseXml(A),0===this._errorCode)return this._current[bo](),this._current.element}onText(A){A=A.replace(this._nbsps,(A=>A.slice(1)+" ")),this._richText||this._current[Co]()?this._current[oI](A,this._richText):this._whiteRegex.test(A)||this._current[oI](A.trim())}onCdata(A){this._current[oI](A)}_mkAttributes(A,e){let t=null,i=null;const a=Object.create({});for(const{name:s,value:n}of A)if("xmlns"===s)t?G(`XFA - multiple namespace definition in <${e}>`):t=n;else if(s.startsWith("xmlns:")){const A=s.substring(6);i||(i=[]),i.push({prefix:A,value:n})}else{const A=s.indexOf(":");if(-1===A)a[s]=n;else{let e=a[nI];e||(e=a[nI]=Object.create(null));const[t,i]=[s.slice(0,A),s.slice(A+1)];(e[t]||=Object.create(null))[i]=n}}return[t,i,a]}_getNameAndPrefix(A,e){const t=A.indexOf(":");return-1===t?[A,null]:[A.substring(t+1),e?"":A.substring(0,t)]}onBeginElement(A,e,t){const[i,a,s]=this._mkAttributes(e,A),[n,g]=this._getNameAndPrefix(A,this._builder.isNsAgnostic()),r=this._builder.build({nsPrefix:g,name:n,attributes:s,namespace:i,prefixes:a});if(r[To]=this._globalData,t)return r[bo](),this._current[gI](r)&&r[EI](this._ids),void r[lo](this._builder);this._stack.push(this._current),this._current=r}onEndElement(A){const e=this._current;if(e[Xo]()&&"string"==typeof e[mo]){const A=new Gu;A._globalData=this._globalData;const t=A.parse(e[mo]);e[mo]=null,e[gI](t)}e[bo](),this._current=this._stack.pop(),this._current[gI](e)&&e[EI](this._ids),e[lo](this._builder)}onError(A){this._errorCode=A}}class Nu{constructor(A){try{this.root=(new Gu).parse(Nu._createDocument(A));const e=new mh(this.root);this.form=e.bind(),this.dataHandler=new yh(this.root,e.getData()),this.form[To].template=this.form}catch(A){G(`XFA - an error occurred during parsing and binding: ${A}`)}}isValid(){return this.root&&this.form}_createPagesHelper(){const A=this.form[mI]();return new Promise(((e,t)=>{const i=()=>{try{const t=A.next();t.done?e(t.value):setTimeout(i,0)}catch(A){t(A)}};setTimeout(i,0)}))}async _createPages(){try{this.pages=await this._createPagesHelper(),this.dims=this.pages.children.map((A=>{const{width:e,height:t}=A.attributes.style;return[0,0,parseInt(e),parseInt(t)]}))}catch(A){G(`XFA - an error occurred during layout: ${A}`)}}getBoundingBox(A){return this.dims[A]}async getNumPages(){return this.pages||await this._createPages(),this.dims.length}setImages(A){this.form[To].images=A}setFonts(A){this.form[To].fontFinder=new vI(A);const e=[];for(let A of this.form[To].usedTypefaces)A=GI(A),this.form[To].fontFinder.find(A)||e.push(A);return e.length>0?e:null}appendFonts(A,e){this.form[To].fontFinder.add(A,e)}async getPages(){this.pages||await this._createPages();const A=this.pages;return this.pages=null,A}serializeData(A){return this.dataHandler.serialize(A)}static _createDocument(A){return A["/xdp:xdp"]?Object.values(A).join(""):A["xdp:xdp"]}static getRichTextAsHtml(A){if(!A||"string"!=typeof A)return null;try{let e=new Gu(Du,!0).parse(A);if(!["body","xhtml"].includes(e[sI])){const A=Du.body({});A[ho](e),e=A}const t=e[yI]();if(!t.success)return null;const{html:i}=t,{attributes:a}=i;return a&&(a.class&&(a.class=a.class.filter((A=>!A.startsWith("xfa")))),a.dir="auto"),{html:i,str:e[pI]()}}catch(A){G(`XFA - an error occurred during parsing of rich text: ${A}`)}return null}}class xu{static createGlobals(A){return Promise.all([A.ensureCatalog("acroForm"),A.ensureDoc("xfaDatasets"),A.ensureCatalog("structTreeRoot"),A.ensureCatalog("baseUrl"),A.ensureCatalog("attachments")]).then((([e,t,i,a,s])=>({pdfManager:A,acroForm:e instanceof BA?e:BA.empty,xfaDatasets:t,structTreeRoot:i,baseUrl:a,attachments:s})),(A=>(G(`createGlobals: "${A}".`),null)))}static async create(A,e,t,i,a,s){const n=a?await this._getPageIndex(A,e,t.pdfManager):null;return t.pdfManager.ensure(this,"_create",[A,e,t,i,a,n,s])}static _create(A,e,t,i,a=!1,s=null,n=null){const g=A.fetchIfRef(e);if(!(g instanceof BA))return;const{acroForm:r,pdfManager:o}=t,I=e instanceof hA?e.toString():`annot_${i.createObjId()}`;let c=g.get("Subtype");c=c instanceof IA?c.name:null;const C={xref:A,ref:e,dict:g,subtype:c,id:I,annotationGlobals:t,collectFields:a,needAppearances:!a&&!0===r.get("NeedAppearances"),pageIndex:s,evaluatorOptions:o.evaluatorOptions,pageRef:n};switch(c){case"Link":return new Ou(C);case"Text":return new Zu(C);case"Widget":let A=SA({dict:g,key:"FT"});switch(A=A instanceof IA?A.name:null,A){case"Tx":return new qu(C);case"Btn":return new Tu(C);case"Ch":return new Pu(C);case"Sig":return new Wu(C)}return G(`Unimplemented widget field type "${A}", falling back to base field type.`),new Ku(C);case"Popup":return new Xu(C);case"FreeText":return new Vu(C);case"Line":return new ju(C);case"Square":return new zu(C);case"Circle":return new _u(C);case"PolyLine":return new $u(C);case"Polygon":return new Ad(C);case"Caret":return new ed(C);case"Ink":return new td(C);case"Highlight":return new id(C);case"Underline":return new ad(C);case"Squiggly":return new sd(C);case"StrikeOut":return new nd(C);case"Stamp":return new gd(C);case"FileAttachment":return new rd(C);default:return a||G(c?`Unimplemented annotation type "${c}", falling back to base annotation.`:"Annotation is missing the required /Subtype."),new Hu(C)}}static async _getPageIndex(A,e,t){try{const i=await A.fetchIfRefAsync(e);if(!(i instanceof BA))return-1;const a=i.getRaw("P");if(a instanceof hA)try{return await t.ensureCatalog("getPageIndex",[a])}catch(A){R(`_getPageIndex -- not a valid page reference: "${A}".`)}if(i.has("Kids"))return-1;const s=await t.ensureDoc("numPages");for(let A=0;AA/255))}function Lu(A,e){const t=A.getArray("QuadPoints");if(!JA(t,null)||0===t.length||t.length%8>0)return null;const i=new Float32Array(t.length);for(let A=0,a=t.length;Ae[2]||he[3]))return null;i.set([C,Q,B,Q,C,h,B,h],A)}return i}function Ju(A,e,t){const[i,a,s,n]=j.getAxialAlignedBoundingBox(e,t);if(i===s||a===n)return[1,0,0,1,A[0],A[1]];const g=(A[2]-A[0])/(s-i),r=(A[3]-A[1])/(n-a);return[g,0,0,r,A[0]-i*g,A[1]-a*r]}class Hu{constructor(A){const{dict:e,xref:t,annotationGlobals:i}=A;this.setTitle(e.get("T")),this.setContents(e.get("Contents")),this.setModificationDate(e.get("M")),this.setFlags(e.get("F")),this.setRectangle(e.getArray("Rect")),this.setColor(e.getArray("C")),this.setBorderStyle(e),this.setAppearance(e),this.setOptionalContent(e);const a=e.get("MK");this.setBorderAndBackgroundColors(a),this.setRotation(a,e),this.ref=A.ref instanceof hA?A.ref:null,this._streams=[],this.appearance&&this._streams.push(this.appearance);const s=!!(128&this.flags),n=!!(512&this.flags);if(i.structTreeRoot){let t=e.get("StructParent");t=Number.isInteger(t)&&t>=0?t:-1,i.structTreeRoot.addAnnotationIdToPage(A.pageRef,t)}if(this.data={annotationFlags:this.flags,borderStyle:this.borderStyle,color:this.color,backgroundColor:this.backgroundColor,borderColor:this.borderColor,rotation:this.rotation,contentsObj:this._contents,hasAppearance:!!this.appearance,id:A.id,modificationDate:this.modificationDate,rect:this.rectangle,subtype:A.subtype,hasOwnCanvas:!1,noRotate:!!(16&this.flags),noHTML:s&&n,isEditable:!1},A.collectFields){const i=e.get("Kids");if(Array.isArray(i)){const A=[];for(const e of i)e instanceof hA&&A.push(e.toString());0!==A.length&&(this.data.kidIds=A)}this.data.actions=WA(t,e,C),this.data.fieldName=this._constructFieldName(e),this.data.pageIndex=A.pageIndex}this._isOffscreenCanvasSupported=A.evaluatorOptions.isOffscreenCanvasSupported,this._fallbackFontDict=null,this._needAppearances=!1}_hasFlag(A,e){return!!(A&e)}_isViewable(A){return!this._hasFlag(A,1)&&!this._hasFlag(A,32)}_isPrintable(A){return this._hasFlag(A,4)&&!this._hasFlag(A,2)&&!this._hasFlag(A,1)}mustBeViewed(A,e){const t=A?.get(this.data.id)?.noView;return void 0!==t?!t:this.viewable&&!this._hasFlag(this.flags,2)}mustBePrinted(A){const e=A?.get(this.data.id)?.noPrint;return void 0!==e?!e:this.printable}mustBeViewedWhenEditing(A,e=null){return A?!this.data.isEditable:!e?.has(this.data.id)}get viewable(){return null!==this.data.quadPoints&&(0===this.flags||this._isViewable(this.flags))}get printable(){return null!==this.data.quadPoints&&0!==this.flags&&this._isPrintable(this.flags)}_parseStringHelper(A){const e="string"==typeof A?_(A):"";return{str:e,dir:e&&"rtl"===Lg(e).dir?"rtl":"ltr"}}setDefaultAppearance(A){const{dict:e,annotationGlobals:t}=A,i=SA({dict:e,key:"DA"})||t.acroForm.get("DA");this._defaultAppearance="string"==typeof i?i:"",this.data.defaultAppearanceData=Er(this._defaultAppearance)}setTitle(A){this._title=this._parseStringHelper(A)}setContents(A){this._contents=this._parseStringHelper(A)}setModificationDate(A){this.modificationDate="string"==typeof A?A:null}setFlags(A){this.flags=Number.isInteger(A)&&A>0?A:0,1&this.flags&&"Annotation"!==this.constructor.name&&(this.flags^=1)}hasFlag(A){return this._hasFlag(this.flags,A)}setRectangle(A){this.rectangle=vA(A,[0,0,0,0])}setColor(A){this.color=Uu(A)}setLineEndings(A){if(this.lineEndings=["None","None"],Array.isArray(A)&&2===A.length)for(let e=0;e<2;e++){const t=A[e];if(t instanceof IA)switch(t.name){case"None":continue;case"Square":case"Circle":case"Diamond":case"OpenArrow":case"ClosedArrow":case"Butt":case"ROpenArrow":case"RClosedArrow":case"Slash":this.lineEndings[e]=t.name;continue}G(`Ignoring invalid lineEnding: ${t}`)}}setRotation(A,e){this.rotation=0;let t=A instanceof BA?A.get("R")||0:e.get("Rotate")||0;Number.isInteger(t)&&0!==t&&(t%=360,t<0&&(t+=360),t%90==0&&(this.rotation=t))}setBorderAndBackgroundColors(A){A instanceof BA?(this.borderColor=Uu(A.getArray("BC"),null),this.backgroundColor=Uu(A.getArray("BG"),null)):this.borderColor=this.backgroundColor=null}setBorderStyle(A){if(this.borderStyle=new Yu,A instanceof BA)if(A.has("BS")){const e=A.get("BS");if(e instanceof BA){const A=e.get("Type");A&&!EA(A,"Border")||(this.borderStyle.setWidth(e.get("W"),this.rectangle),this.borderStyle.setStyle(e.get("S")),this.borderStyle.setDashArray(e.getArray("D")))}}else if(A.has("Border")){const e=A.getArray("Border");Array.isArray(e)&&e.length>=3&&(this.borderStyle.setHorizontalCornerRadius(e[0]),this.borderStyle.setVerticalCornerRadius(e[1]),this.borderStyle.setWidth(e[2],this.rectangle),4===e.length&&this.borderStyle.setDashArray(e[3],!0))}else this.borderStyle.setWidth(0)}setAppearance(A){this.appearance=null;const e=A.get("AP");if(!(e instanceof BA))return;const t=e.get("N");if(t instanceof pA)return void(this.appearance=t);if(!(t instanceof BA))return;const i=A.get("AS");if(!(i instanceof IA&&t.has(i.name)))return;const a=t.get(i.name);a instanceof pA&&(this.appearance=a)}setOptionalContent(A){this.oc=null;const e=A.get("OC");e instanceof IA?G("setOptionalContent: Support for /Name-entry is not implemented."):e instanceof BA&&(this.oc=e)}loadResources(A,e){return e.dict.getAsync("Resources").then((e=>{if(e)return new co(e,A,e.xref).load().then((function(){return e}))}))}async getOperatorList(A,e,t,a){const{hasOwnCanvas:s,id:n,rect:g}=this.data;let r=this.appearance;const o=!!(s&&2&t);if(o&&(g[0]===g[2]||g[1]===g[3]))return this.data.hasOwnCanvas=!1,{opList:new er,separateForm:!1,separateCanvas:!1};if(!r){if(!o)return{opList:new er,separateForm:!1,separateCanvas:!1};r=new ne(""),r.dict=new BA}const I=r.dict,c=await this.loadResources(["ExtGState","ColorSpace","Pattern","Shading","XObject","Font"],r),C=YA(I.getArray("BBox"),[0,0,1,1]),B=HA(I.getArray("Matrix"),i),h=Ju(g,C,B),Q=new er;let l;return this.oc&&(l=await A.parseMarkedContentProps(this.oc,null)),void 0!==l&&Q.addOp(w,["OC",l]),Q.addOp(80,[n,g,h,B,o]),await A.getOperatorList({stream:r,task:e,resources:c,operatorList:Q,fallbackFontDict:this._fallbackFontDict}),Q.addOp(81,[]),void 0!==l&&Q.addOp(D,[]),this.reset(),{opList:Q,separateForm:!1,separateCanvas:o}}async save(A,e,t){return null}get hasTextContent(){return!1}async extractTextContent(A,e,t){if(!this.appearance)return;const i=await this.loadResources(["ExtGState","Font","Properties","XObject"],this.appearance),a=[],s=[];let n=null;const g={desiredSize:Math.Infinity,ready:!0,enqueue(A,e){for(const e of A.items)void 0!==e.str&&(n||=e.transform.slice(-2),s.push(e.str),e.hasEOL&&(a.push(s.join("").trimEnd()),s.length=0))}};if(await A.getTextContent({stream:this.appearance,task:e,resources:i,includeMarkedContent:!0,keepWhiteSpace:!0,sink:g,viewBox:t}),this.reset(),s.length&&a.push(s.join("").trimEnd()),a.length>1||a[0]){const A=this.appearance.dict,e=YA(A.getArray("BBox"),null),t=HA(A.getArray("Matrix"),null);this.data.textPosition=this._transformPoint(n,e,t),this.data.textContent=a}}_transformPoint(A,e,t){const{rect:i}=this.data;e||=[0,0,1,1],t||=[1,0,0,1,0,0];const a=Ju(i,e,t);return a[4]-=i[0],a[5]-=i[1],A=j.applyTransform(A,a),j.applyTransform(A,t)}getFieldObject(){return this.data.kidIds?{id:this.data.id,actions:this.data.actions,name:this.data.fieldName,strokeColor:this.data.borderColor,fillColor:this.data.backgroundColor,type:"",kidIds:this.data.kidIds,page:this.data.pageIndex,rotation:this.rotation}:null}reset(){for(const A of this._streams)A.reset()}_constructFieldName(A){if(!A.has("T")&&!A.has("Parent"))return G("Unknown field name, falling back to empty field name."),"";if(!A.has("Parent"))return _(A.get("T"));const e=[];A.has("T")&&e.unshift(_(A.get("T")));let t=A;const i=new QA;for(A.objId&&i.put(A.objId);t.has("Parent")&&(t=t.get("Parent"),t instanceof BA&&(!t.objId||!i.has(t.objId)));)t.objId&&i.put(t.objId),t.has("T")&&e.unshift(_(t.get("T")));return e.join(".")}}class Yu{constructor(){this.width=1,this.style=1,this.dashArray=[3],this.horizontalCornerRadius=0,this.verticalCornerRadius=0}setWidth(A,e=[0,0,0,0]){if(A instanceof IA)this.width=0;else if("number"==typeof A){if(A>0){const t=(e[2]-e[0])/2,i=(e[3]-e[1])/2;t>0&&i>0&&(A>t||A>i)&&(G(`AnnotationBorderStyle.setWidth - ignoring width: ${A}`),A=1)}this.width=A}}setStyle(A){if(A instanceof IA)switch(A.name){case"S":this.style=1;break;case"D":this.style=2;break;case"B":this.style=3;break;case"I":this.style=4;break;case"U":this.style=5}}setDashArray(A,e=!1){if(Array.isArray(A)){let t=!0,i=!0;for(const e of A){if(!(+e>=0)){t=!1;break}e>0&&(i=!1)}0===A.length||t&&!i?(this.dashArray=A,e&&this.setStyle(IA.get("D"))):this.width=0}else A&&(this.width=0)}setHorizontalCornerRadius(A){Number.isInteger(A)&&(this.horizontalCornerRadius=A)}setVerticalCornerRadius(A){Number.isInteger(A)&&(this.verticalCornerRadius=A)}}class vu extends Hu{constructor(A){super(A);const{dict:e}=A;if(e.has("IRT")){const A=e.getRaw("IRT");this.data.inReplyTo=A instanceof hA?A.toString():null;const t=e.get("RT");this.data.replyType=t instanceof IA?t.name:"R"}let t=null;if(this.data.replyType===o){const A=e.get("IRT");this.setTitle(A.get("T")),this.data.titleObj=this._title,this.setContents(A.get("Contents")),this.data.contentsObj=this._contents,A.has("CreationDate")?(this.setCreationDate(A.get("CreationDate")),this.data.creationDate=this.creationDate):this.data.creationDate=null,A.has("M")?(this.setModificationDate(A.get("M")),this.data.modificationDate=this.modificationDate):this.data.modificationDate=null,t=A.getRaw("Popup"),A.has("C")?(this.setColor(A.getArray("C")),this.data.color=this.color):this.data.color=null}else this.data.titleObj=this._title,this.setCreationDate(e.get("CreationDate")),this.data.creationDate=this.creationDate,t=e.getRaw("Popup"),e.has("C")||(this.data.color=null);this.data.popupRef=t instanceof hA?t.toString():null,e.has("RC")&&(this.data.richText=Nu.getRichTextAsHtml(e.get("RC")))}setCreationDate(A){this.creationDate="string"==typeof A?A:null}_setDefaultAppearance({xref:A,extra:e,strokeColor:t,fillColor:i,blendMode:a,strokeAlpha:s,fillAlpha:n,pointsCallback:g}){let r=Number.MAX_VALUE,o=Number.MAX_VALUE,I=Number.MIN_VALUE,c=Number.MIN_VALUE;const C=["q"];e&&C.push(e),t&&C.push(`${t[0]} ${t[1]} ${t[2]} RG`),i&&C.push(`${i[0]} ${i[1]} ${i[2]} rg`);let B=this.data.quadPoints;B||(B=Float32Array.from([this.rectangle[0],this.rectangle[3],this.rectangle[2],this.rectangle[3],this.rectangle[0],this.rectangle[1],this.rectangle[2],this.rectangle[1]]));for(let A=0,e=B.length;A"string"==typeof A)).map((A=>_(A))):A instanceof IA?_(A.name):"string"==typeof A?_(A):null}hasFieldFlag(A){return!!(this.data.fieldFlags&A)}_isViewable(A){return!0}mustBeViewed(A,e){return e?this.viewable:super.mustBeViewed(A,e)&&!this._hasFlag(this.flags,32)}getRotationMatrix(A){let e=A?.get(this.data.id)?.rotation;return void 0===e&&(e=this.rotation),0===e?i:ie(e,this.data.rect[2]-this.data.rect[0],this.data.rect[3]-this.data.rect[1])}getBorderAndBackgroundAppearances(A){let e=A?.get(this.data.id)?.rotation;if(void 0===e&&(e=this.rotation),!this.backgroundColor&&!this.borderColor)return"";const t=this.data.rect[2]-this.data.rect[0],i=this.data.rect[3]-this.data.rect[1],a=0===e||180===e?`0 0 ${t} ${i} re`:`0 0 ${i} ${t} re`;let s="";return this.backgroundColor&&(s=`${dr(this.backgroundColor,!0)} ${a} f `),this.borderColor&&(s+=`${this.borderStyle.width||1} w ${dr(this.borderColor,!1)} ${a} S `),s}async getOperatorList(A,e,t,i){if(16&t&&!(this instanceof Wu)&&!this.data.noHTML&&!this.data.hasOwnCanvas)return{opList:new er,separateForm:!0,separateCanvas:!1};if(!this._hasText)return super.getOperatorList(A,e,t,i);const a=await this._getAppearance(A,e,t,i);if(this.appearance&&null===a)return super.getOperatorList(A,e,t,i);const s=new er;if(!this._defaultAppearance||null===a)return{opList:s,separateForm:!1,separateCanvas:!1};const n=!!(this.data.hasOwnCanvas&&2&t),g=[0,0,this.data.rect[2]-this.data.rect[0],this.data.rect[3]-this.data.rect[1]],r=Ju(this.data.rect,g,[1,0,0,1,0,0]);let o;this.oc&&(o=await A.parseMarkedContentProps(this.oc,null)),void 0!==o&&s.addOp(w,["OC",o]),s.addOp(80,[this.data.id,this.data.rect,r,this.getRotationMatrix(i),n]);const I=new ne(a);return await A.getOperatorList({stream:I,task:e,resources:this._fieldResources.mergedResources,operatorList:s}),s.addOp(81,[]),void 0!==o&&s.addOp(D,[]),{opList:s,separateForm:!1,separateCanvas:n}}_getMKDict(A){const e=new BA(null);return A&&e.set("R",A),this.borderColor&&e.set("BC",Mu(this.borderColor)),this.backgroundColor&&e.set("BG",Mu(this.backgroundColor)),e.size>0?e:null}amendSavedDict(A,e){}async save(A,e,t){const a=t?.get(this.data.id);let s=a?.value,n=a?.rotation;if(s===this.data.fieldValue||void 0===s){if(!this._hasValueFromXFA&&void 0===n)return null;s||=this.data.fieldValue}if(void 0===n&&!this._hasValueFromXFA&&Array.isArray(s)&&Array.isArray(this.data.fieldValue)&&s.length===this.data.fieldValue.length&&s.every(((A,e)=>A===this.data.fieldValue[e])))return null;void 0===n&&(n=this.rotation);let g=null;if(!this._needAppearances&&(g=await this._getAppearance(A,e,8,t),null===g))return null;let r=!1;g?.needAppearances&&(r=!0,g=null);const{xref:o}=A,I=o.fetchIfRef(this.ref);if(!(I instanceof BA))return null;const c=new BA(o);for(const A of I.getKeys())"AP"!==A&&c.set(A,I.getRaw(A));const C={path:this.data.fieldName,value:s};c.set("V",Array.isArray(s)?s.map(Ae):Ae(s)),this.amendSavedDict(t,c);const B=this._getMKDict(n);B&&c.set("MK",B);const h=[],Q=[{ref:this.ref,data:"",xfa:C,needAppearances:r}];if(null!==g){const A=o.getNewTemporaryRef(),e=new BA(o);c.set("AP",e),e.set("N",A);const a=this._getSaveFieldResources(o),s=new ne(g),n=s.dict=new BA(o);n.set("Subtype",IA.get("Form")),n.set("Resources",a),n.set("BBox",[0,0,this.data.rect[2]-this.data.rect[0],this.data.rect[3]-this.data.rect[1]]);const r=this.getRotationMatrix(t);r!==i&&n.set("Matrix",r),await Zr(A,s,h,o),Q.push({ref:A,data:h.join(""),xfa:null,needAppearances:!1}),h.length=0}return c.set("M",`D:${tA()}`),await Zr(this.ref,c,h,o),Q[0].data=h.join(""),Q}async _getAppearance(A,e,t,i){if(this.hasFieldFlag(I))return null;const a=i?.get(this.data.id);let s,g;if(a&&(s=a.formattedValue||a.value,g=a.rotation),void 0===g&&void 0===s&&!this._needAppearances&&(!this._hasValueFromXFA||this.appearance))return null;const r=this.getBorderAndBackgroundAppearances(i);if(void 0===s&&(s=this.data.fieldValue,!s))return`/Tx BMC q ${r}Q EMC`;if(Array.isArray(s)&&1===s.length&&(s=s[0]),x("string"==typeof s,"Expected `value` to be a string."),s=s.trim(),this.data.combo){const A=this.data.options.find((({exportValue:A})=>s===A));s=A?.displayValue||s}if(""===s)return`/Tx BMC q ${r}Q EMC`;void 0===g&&(g=this.rotation);let o,c=-1;this.data.multiLine?(o=s.split(/\r\n?|\n/).map((A=>A.normalize("NFC"))),c=o.length):o=[s.replace(/\r\n?|\n/,"").normalize("NFC")];let C=this.data.rect[3]-this.data.rect[1],B=this.data.rect[2]-this.data.rect[0];90!==g&&270!==g||([B,C]=[C,B]),this._defaultAppearance||(this.data.defaultAppearanceData=Er(this._defaultAppearance="/Helvetica 0 Tf 0 g"));let h,Q,l,E=await Ku._getFontData(A,e,this.data.defaultAppearanceData,this._fieldResources.mergedResources);const u=[];let d=!1;for(const A of o){const e=E.encodeString(A);e.length>1&&(d=!0),u.push(e.join(""))}if(d&&8&t)return{needAppearances:!0};if(d&&this._isOffscreenCanvasSupported){const t=this.data.comb?"monospace":"sans-serif",i=new fr(A.xref,t),a=i.createFontResources(o.join("")),n=a.getRaw("Font");if(this._fieldResources.mergedResources.has("Font")){const A=this._fieldResources.mergedResources.get("Font");for(const e of n.getKeys())A.set(e,n.getRaw(e))}else this._fieldResources.mergedResources.set("Font",n);const g=i.fontName.name;E=await Ku._getFontData(A,e,{fontName:g,fontSize:0},a);for(let A=0,e=u.length;A2?`/Tx BMC q ${r}BT `+h+` 1 0 0 1 ${_A(2)} ${_A(y)} Tm (${TA(u[0])}) Tj ET Q EMC`:`/Tx BMC q ${r}BT `+h+` 1 0 0 1 0 0 Tm ${this._renderText(u[0],E,Q,B,m,{shift:0},2,y)} ET Q EMC`}static async _getFontData(A,e,t,i){const a=new er,s={font:null,clone(){return this}},{fontName:n,fontSize:g}=t;return await A.handleSetFont(i,[n&&IA.get(n),g],null,a,e,s,null),s.font}_getTextWidth(A,e){return e.charsToGlyphs(A).reduce(((A,e)=>A+e.width),0)/1e3}_computeFontSize(A,e,t,i,a){let{fontSize:n}=this.data.defaultAppearanceData,g=(n||12)*s,r=Math.round(A/g);if(!n){const o=A=>Math.floor(100*A)/100;if(-1===a){const a=this._getTextWidth(t,i);n=o(Math.min(A/s,a>e?e/a:1/0)),r=1}else{const I=t.split(/\r\n?|\n/),c=[];for(const A of I){const e=i.encodeString(A).join(""),t=i.charsToGlyphs(e),a=i.getCharPositions(e);c.push({line:e,glyphs:t,positions:a})}const C=t=>{let a=0;for(const s of c)if(a+=this._splitLine(null,i,t,e,s).length*t,a>A)return!0;return!1};for(r=Math.max(r,a);g=A/r,n=o(g/s),C(n);)r++}const{fontName:I,fontColor:c}=this.data.defaultAppearanceData;this._defaultAppearance=function({fontSize:A,fontName:e,fontColor:t}){return`/${qA(e)} ${A} Tf ${dr(t,!0)}`}({fontSize:n,fontName:I,fontColor:c})}return[this._defaultAppearance,n,A/r]}_renderText(A,e,t,i,a,s,n,g){let r;r=1===a?(i-this._getTextWidth(A,e)*t)/2:2===a?i-this._getTextWidth(A,e)*t-n:n;const o=_A(r-s.shift);return s.shift=r,`${o} ${g=_A(g)} Td (${TA(A)}) Tj`}_getSaveFieldResources(A){const{localResources:e,appearanceResources:t,acroFormResources:i}=this._fieldResources,a=this.data.defaultAppearanceData?.fontName;if(!a)return e||BA.empty;for(const A of[e,t])if(A instanceof BA){const e=A.get("Font");if(e instanceof BA&&e.has(a))return A}if(i instanceof BA){const t=i.get("Font");if(t instanceof BA&&t.has(a)){const i=new BA(A);i.set(a,t.getRaw(a));const s=new BA(A);return s.set("Font",i),BA.merge({xref:A,dictArray:[s,e],mergeSubDicts:!0})}}return e||BA.empty}getFieldObject(){return null}}class qu extends Ku{constructor(A){super(A);const{dict:e}=A;e.has("PMD")&&(this.flags|=2,this.data.hidden=!0,G("Barcodes are not supported")),this.data.hasOwnCanvas=this.data.readOnly&&!this.data.noHTML,this._hasText=!0,"string"!=typeof this.data.fieldValue&&(this.data.fieldValue="");let t=SA({dict:e,key:"Q"});(!Number.isInteger(t)||t<0||t>2)&&(t=null),this.data.textAlignment=t;let i=SA({dict:e,key:"MaxLen"});(!Number.isInteger(i)||i<0)&&(i=0),this.data.maxLen=i,this.data.multiLine=this.hasFieldFlag(4096),this.data.comb=this.hasFieldFlag(16777216)&&!this.hasFieldFlag(4096)&&!this.hasFieldFlag(I)&&!this.hasFieldFlag(1048576)&&0!==this.data.maxLen,this.data.doNotScroll=this.hasFieldFlag(8388608)}get hasTextContent(){return!!this.appearance&&!this._needAppearances}_getCombAppearance(A,e,t,i,a,s,n,g,r,o,I){const c=a/this.data.maxLen,C=this.getBorderAndBackgroundAppearances(I),B=[],h=e.getCharPositions(t);for(const[A,e]of h)B.push(`(${TA(t.substring(A,e))}) Tj`);const Q=B.join(` ${_A(c)} 0 Td `);return`/Tx BMC q ${C}BT `+A+` 1 0 0 1 ${_A(n)} ${_A(g+r)} Tm ${Q} ET Q EMC`}_getMultilineAppearance(A,e,t,i,a,s,n,g,r,o,I,c){const C=[],B=a-2*g,h={shift:0};for(let A=0,s=e.length;Ai?(r.push(A.substring(C,t)),C=t,B=Q,o=-1,c=-1):(B+=Q,o=t,I=a,c=e):B+Q>i?-1!==o?(r.push(A.substring(C,I)),C=I,e=c+1,o=-1,B=0):(r.push(A.substring(C,t)),C=t,B=Q):B+=Q}return C"Off"!==A));s.length=0,s.push("Off",A)}s.includes(this.data.fieldValue)||(this.data.fieldValue="Off"),this.data.exportValue=s[1];const n=t.get(this.data.exportValue);this.checkedAppearance=n instanceof pA?n:null;const g=t.get("Off");this.uncheckedAppearance=g instanceof pA?g:null,this.checkedAppearance?this._streams.push(this.checkedAppearance):this._getDefaultCheckedAppearance(A,"check"),this.uncheckedAppearance&&this._streams.push(this.uncheckedAppearance),this._fallbackFontDict=this.fallbackFontDict,null===this.data.defaultFieldValue&&(this.data.defaultFieldValue="Off")}_processRadioButton(A){this.data.buttonValue=null;const e=A.dict.get("Parent");if(e instanceof BA){this.parent=A.dict.getRaw("Parent");const t=e.get("V");t instanceof IA&&(this.data.fieldValue=this._decodeFormValue(t))}const t=A.dict.get("AP");if(!(t instanceof BA))return;const i=t.get("N");if(!(i instanceof BA))return;for(const A of i.getKeys())if("Off"!==A){this.data.buttonValue=this._decodeFormValue(A);break}const a=i.get(this.data.buttonValue);this.checkedAppearance=a instanceof pA?a:null;const s=i.get("Off");this.uncheckedAppearance=s instanceof pA?s:null,this.checkedAppearance?this._streams.push(this.checkedAppearance):this._getDefaultCheckedAppearance(A,"disc"),this.uncheckedAppearance&&this._streams.push(this.uncheckedAppearance),this._fallbackFontDict=this.fallbackFontDict,null===this.data.defaultFieldValue&&(this.data.defaultFieldValue="Off")}_processPushButton(A){const{dict:e,annotationGlobals:t}=A;e.has("A")||e.has("AA")||this.data.alternativeText?(this.data.isTooltipOnly=!e.has("A")&&!e.has("AA"),oo.parseDestDictionary({destDict:e,resultObj:this.data,docBaseUrl:t.baseUrl,docAttachments:t.attachments})):G("Push buttons without action dictionaries are not supported")}getFieldObject(){let A,e="button";return this.data.checkBox?(e="checkbox",A=this.data.exportValue):this.data.radioButton&&(e="radiobutton",A=this.data.buttonValue),{id:this.data.id,value:this.data.fieldValue||"Off",defaultValue:this.data.defaultFieldValue,exportValues:A,editable:!this.data.readOnly,name:this.data.fieldName,rect:this.data.rect,hidden:this.data.hidden,actions:this.data.actions,page:this.data.pageIndex,strokeColor:this.data.borderColor,fillColor:this.data.backgroundColor,rotation:this.rotation,type:e}}get fallbackFontDict(){const A=new BA;return A.set("BaseFont",IA.get("ZapfDingbats")),A.set("Type",IA.get("FallbackType")),A.set("Subtype",IA.get("FallbackType")),A.set("Encoding",IA.get("ZapfDingbatsEncoding")),M(this,"fallbackFontDict",A)}}class Pu extends Ku{constructor(A){super(A);const{dict:e,xref:t}=A;this.indices=e.getArray("I"),this.hasIndices=Array.isArray(this.indices)&&this.indices.length>0,this.data.options=[];const i=SA({dict:e,key:"Opt"});if(Array.isArray(i))for(let A=0,e=i.length;A=0&&e0?this.data.fieldValue[0]:null;return{id:this.data.id,value:e,defaultValue:this.data.defaultFieldValue,editable:!this.data.readOnly,name:this.data.fieldName,rect:this.data.rect,numItems:this.data.fieldValue.length,multipleSelection:this.data.multiSelect,hidden:this.data.hidden,actions:this.data.actions,items:this.data.options,page:this.data.pageIndex,strokeColor:this.data.borderColor,fillColor:this.data.backgroundColor,rotation:this.rotation,type:A}}amendSavedDict(A,e){if(!this.hasIndices)return;let t=A?.get(this.data.id)?.value;Array.isArray(t)||(t=[t]);const i=[],{options:a}=this.data;for(let A=0,e=0,s=a.length;At&&(t=i,e=A)}[B,h]=this._computeFontSize(A,o-4,e,C,-1)}const Q=h*s,l=(Q-h)/2,E=Math.floor(r/Q);let u=0;if(c.length>0){const A=Math.min(...c),e=Math.max(...c);u=Math.max(0,e-E+1),u>A&&(u=A)}const d=Math.min(u+E+1,I),f=["/Tx BMC q",`1 1 ${o} ${r} re W n`];if(c.length){f.push("0.600006 0.756866 0.854904 rg");for(const A of c)u<=A&&AA.trimEnd()));const{coords:A,bbox:e,matrix:t}=fr.getFirstPositionInfo(this.rectangle,this.rotation,i);this.data.textPosition=this._transformPoint(A,e,t)}if(this._isOffscreenCanvasSupported){const a=A.dict.get("CA"),s=new fr(t,"sans-serif");this.appearance=s.createAppearance(this._contents.str,this.rectangle,this.rotation,i,e,a),this._streams.push(this.appearance)}else G("FreeTextAnnotation: OffscreenCanvas is not supported, annotation may not render correctly.")}}get hasTextContent(){return this._hasAppearance}static createNewDict(A,e,{apRef:t,ap:i,oldAnnotation:a}){const{color:s,fontSize:n,rect:g,rotation:r,user:o,value:I}=A,c=a||new BA(e);c.set("Type",IA.get("Annot")),c.set("Subtype",IA.get("FreeText")),a?(c.set("M",`D:${tA()}`),c.delete("RC")):c.set("CreationDate",`D:${tA()}`),c.set("Rect",g);const C=`/Helv ${n} Tf ${dr(s,!0)}`;if(c.set("DA",C),c.set("Contents",Ae(I)),c.set("F",4),c.set("Border",[0,0,0]),c.set("Rotate",r),o&&c.set("T",Ae(o)),t||i){const A=new BA(e);c.set("AP",A),t?A.set("N",t):A.set("N",i)}return c}static async createNewAppearanceStream(A,e,t){const{baseFontRef:i,evaluator:a,task:n}=t,{color:g,fontSize:r,rect:o,rotation:I,value:c}=A,C=new BA(e),B=new BA(e);if(i)B.set("Helv",i);else{const A=new BA(e);A.set("BaseFont",IA.get("Helvetica")),A.set("Type",IA.get("Font")),A.set("Subtype",IA.get("Type1")),A.set("Encoding",IA.get("WinAnsiEncoding")),B.set("Helv",A)}C.set("Font",B);const h=await Ku._getFontData(a,n,{fontName:"Helv",fontSize:r},C),[Q,l,E,u]=o;let d=E-Q,f=u-l;I%180!=0&&([d,f]=[f,d]);const p=c.split("\n"),m=r/1e3;let y=-1/0;const w=[];for(let A of p){const e=h.encodeString(A);if(e.length>1)return null;A=e.join(""),w.push(A);let t=0;const i=h.charsToGlyphs(A);for(const A of i)t+=A.width*m;y=Math.max(y,t)}let D=1;y>d&&(D=d/y);let b=1;const k=s*r,F=1*r,S=k*p.length;S>f&&(b=f/S);const R=r*Math.min(D,b);let G,N,x;switch(I){case 0:x=[1,0,0,1],N=[o[0],o[1],d,f],G=[o[0],o[3]-F];break;case 90:x=[0,1,-1,0],N=[o[1],-o[2],d,f],G=[o[1],-o[0]-F];break;case 180:x=[-1,0,0,-1],N=[-o[2],-o[3],d,f],G=[-o[2],-o[1]-F];break;case 270:x=[0,-1,1,0],N=[-o[3],o[0],d,f],G=[-o[3],o[2]-F]}const U=["q",`${x.join(" ")} 0 0 cm`,`${N.join(" ")} re W n`,"BT",`${dr(g,!0)}`,`0 Tc /Helv ${_A(R)} Tf`];U.push(`${G.join(" ")} Td (${TA(w[0])}) Tj`);const M=_A(k);for(let A=1,e=w.length;A(A.push(`${i[0]} ${i[1]} m`,`${i[2]} ${i[3]} l`,"S"),[e[0]-r,e[2]+r,e[7]-r,e[3]+r])})}}}class zu extends vu{constructor(A){super(A);const{dict:e,xref:t}=A;if(this.data.annotationType=5,this.data.hasOwnCanvas=this.data.noRotate,this.data.noHTML=!1,!this.appearance){const A=this.color?Mu(this.color):[0,0,0],i=e.get("CA"),a=Uu(e.getArray("IC"),null),s=a?Mu(a):null,n=s?i:null;if(0===this.borderStyle.width&&!s)return;this._setDefaultAppearance({xref:t,extra:`${this.borderStyle.width} w`,strokeColor:A,fillColor:s,strokeAlpha:i,fillAlpha:n,pointsCallback:(A,e)=>{const t=e[4]+this.borderStyle.width/2,i=e[5]+this.borderStyle.width/2,a=e[6]-e[4]-this.borderStyle.width,n=e[3]-e[7]-this.borderStyle.width;return A.push(`${t} ${i} ${a} ${n} re`),s?A.push("B"):A.push("S"),[e[0],e[2],e[7],e[3]]}})}}}class _u extends vu{constructor(A){super(A);const{dict:e,xref:t}=A;if(this.data.annotationType=6,!this.appearance){const A=this.color?Mu(this.color):[0,0,0],i=e.get("CA"),a=Uu(e.getArray("IC"),null),s=a?Mu(a):null,n=s?i:null;if(0===this.borderStyle.width&&!s)return;const g=4/3*Math.tan(Math.PI/8);this._setDefaultAppearance({xref:t,extra:`${this.borderStyle.width} w`,strokeColor:A,fillColor:s,strokeAlpha:i,fillAlpha:n,pointsCallback:(A,e)=>{const t=e[0]+this.borderStyle.width/2,i=e[1]-this.borderStyle.width/2,a=e[6]-this.borderStyle.width/2,n=e[7]+this.borderStyle.width/2,r=t+(a-t)/2,o=i+(n-i)/2,I=(a-t)/2*g,c=(n-i)/2*g;return A.push(`${r} ${n} m`,`${r+I} ${n} ${a} ${o+c} ${a} ${o} c`,`${a} ${o-c} ${r+I} ${i} ${r} ${i} c`,`${r-I} ${i} ${t} ${o-c} ${t} ${o} c`,`${t} ${o+c} ${r-I} ${n} ${r} ${n} c`,"h"),s?A.push("B"):A.push("S"),[e[0],e[2],e[7],e[3]]}})}}}class $u extends vu{constructor(A){super(A);const{dict:e,xref:t}=A;this.data.annotationType=8,this.data.hasOwnCanvas=this.data.noRotate,this.data.noHTML=!1,this.data.vertices=null,this instanceof Ad||(this.setLineEndings(e.getArray("LE")),this.data.lineEndings=this.lineEndings);const i=e.getArray("Vertices");if(!JA(i,null))return;const a=this.data.vertices=Float32Array.from(i);if(!this.appearance){const A=this.color?Mu(this.color):[0,0,0],i=e.get("CA"),s=this.borderStyle.width||1,n=2*s,g=[1/0,1/0,-1/0,-1/0];for(let A=0,e=a.length;A{for(let e=0,t=a.length;e{for(const e of this.data.inkLists){for(let t=0,i=e.length;tA.points))),c.set("F",4),c.set("Rotate",o),g&&c.set("IT",IA.get("InkHighlight"));const C=new BA(e);c.set("BS",C),C.set("W",I),c.set("C",Array.from(a,(A=>A/255))),c.set("CA",s);const B=new BA(e);return c.set("AP",B),t?B.set("N",t):B.set("N",i),c}static async createNewAppearanceStream(A,e,t){if(A.outlines)return this.createNewAppearanceStreamForHighlight(A,e,t);const{color:i,rect:a,paths:s,thickness:n,opacity:g}=A,r=[`${n} w 1 J 1 j`,`${dr(i,!1)}`];1!==g&&r.push("/R0 gs");const o=[];for(const{bezier:A}of s){if(o.length=0,o.push(`${_A(A[0])} ${_A(A[1])} m`),2===A.length)o.push(`${_A(A[0])} ${_A(A[1])} l S`);else{for(let e=2,t=A.length;e(A.push(`${e[0]} ${e[1]} m`,`${e[2]} ${e[3]} l`,`${e[6]} ${e[7]} l`,`${e[4]} ${e[5]} l`,"f"),[e[0],e[2],e[7],e[3]])})}}else this.data.popupRef=null}static createNewDict(A,e,{apRef:t,ap:i}){const{color:a,opacity:s,rect:n,rotation:g,user:r,quadPoints:o}=A,I=new BA(e);if(I.set("Type",IA.get("Annot")),I.set("Subtype",IA.get("Highlight")),I.set("CreationDate",`D:${tA()}`),I.set("Rect",n),I.set("F",4),I.set("Border",[0,0,0]),I.set("Rotate",g),I.set("QuadPoints",o),I.set("C",Array.from(a,(A=>A/255))),I.set("CA",s),r&&I.set("T",Ae(r)),t||i){const A=new BA(e);I.set("AP",A),A.set("N",t||i)}return I}static async createNewAppearanceStream(A,e,t){const{color:i,rect:a,outlines:s,opacity:n}=A,g=[`${dr(i,!0)}`,"/R0 gs"],r=[];for(const A of s){r.length=0,r.push(`${_A(A[0])} ${_A(A[1])} m`);for(let e=2,t=A.length;e(A.push(`${e[4]} ${e[5]+1.3} m`,`${e[6]} ${e[7]+1.3} l`,"S"),[e[0],e[2],e[7],e[3]])})}}else this.data.popupRef=null}}class sd extends vu{constructor(A){super(A);const{dict:e,xref:t}=A;if(this.data.annotationType=11,this.data.quadPoints=Lu(e,null)){if(!this.appearance){const A=this.color?Mu(this.color):[0,0,0],i=e.get("CA");this._setDefaultAppearance({xref:t,extra:"[] 0 d 1 w",strokeColor:A,strokeAlpha:i,pointsCallback:(A,e)=>{const t=(e[1]-e[5])/6;let i=t,a=e[4];const s=e[5],n=e[6];A.push(`${a} ${s+i} m`);do{a+=2,i=0===i?t:0,A.push(`${a} ${s+i} l`)}while(a(A.push((e[0]+e[4])/2+" "+(e[1]+e[5])/2+" m",(e[2]+e[6])/2+" "+(e[3]+e[7])/2+" l","S"),[e[0],e[2],e[7],e[3]])})}}else this.data.popupRef=null}}class gd extends vu{constructor(A){super(A),this.data.annotationType=13,this.data.hasOwnCanvas=this.data.noRotate,this.data.noHTML=!1}static async createImage(A,e){const{width:t,height:i}=A,a=new OffscreenCanvas(t,i),s=a.getContext("2d",{alpha:!0});s.drawImage(A,0,0);const n=s.getImageData(0,0,t,i).data,g=new Uint32Array(n.buffer),r=g.some(X.isLittleEndian?A=>A>>>24!=255:A=>!!(255&~A));r&&(s.fillStyle="white",s.fillRect(0,0,t,i),s.drawImage(A,0,0));const o=a.convertToBlob({type:"image/jpeg",quality:1}).then((A=>A.arrayBuffer())),I=IA.get("XObject"),c=IA.get("Image"),C=new BA(e);C.set("Type",I),C.set("Subtype",c),C.set("BitsPerComponent",8),C.set("ColorSpace",IA.get("DeviceRGB")),C.set("Filter",IA.get("DCTDecode")),C.set("BBox",[0,0,t,i]),C.set("Width",t),C.set("Height",i);let B=null;if(r){const A=new Uint8Array(g.length);if(X.isLittleEndian)for(let e=0,t=g.length;e>>24;else for(let e=0,t=g.length;e=0&&s<=1?s:null}}function od(A){try{return $(A)}catch(e){return G(`UTF-8 decoding failed: "${e}".`),A}}class Id extends Rr{constructor(A){super(A),this.node=null}onEndElement(A){const e=super.onEndElement(A);if(e&&"xfa:datasets"===A)throw this.node=e,new Error("Aborting DatasetXMLParser.")}}class cd{constructor(A){if(A.datasets)this.node=new Rr({hasAttributes:!0}).parseFromString(A.datasets).documentElement;else{const e=new Id({hasAttributes:!0});try{e.parseFromString(A["xdp:xdp"])}catch{}this.node=e.node}}getValue(A){if(!this.node||!A)return"";const e=this.node.searchNode(KA(A),0);if(!e)return"";const t=e.firstChild;return"value"===t?.nodeName?e.children.map((A=>od(A.textContent))):od(e.textContent)}}class Cd{#K=null;constructor(A,e){this.stream=A,this.pdfManager=e,this.entries=[],this._xrefStms=new Set,this._cacheMap=new Map,this._pendingRefs=new QA,this._newPersistentRefNum=null,this._newTemporaryRefNum=null,this._persistentRefsCache=null}getNewPersistentRef(A){null===this._newPersistentRefNum&&(this._newPersistentRefNum=this.entries.length||1);const e=this._newPersistentRefNum++;return this._cacheMap.set(e,A),hA.get(e,0)}getNewTemporaryRef(){if(null===this._newTemporaryRefNum&&(this._newTemporaryRefNum=this.entries.length||1,this._newPersistentRefNum)){this._persistentRefsCache=new Map;for(let A=this._newTemporaryRefNum;A0;){const[n,g]=s;if(!Number.isInteger(n)||!Number.isInteger(g))throw new q(`Invalid XRef range fields: ${n}, ${g}`);if(!Number.isInteger(t)||!Number.isInteger(i)||!Number.isInteger(a))throw new q(`Invalid XRef entry fields length: ${n}, ${g}`);for(let s=e.entryNum;s=A.length);)t+=String.fromCharCode(i),i=A[e];return t}function e(A,e,t){const i=t.length,a=A.length;let s=0;for(;e=i)break;e++,s++}return s}const t=/\b(endobj|\d+\s+\d+\s+obj|xref|trailer\s*<<)\b/g,i=/\b(startxref|\d+\s+\d+\s+obj)\b/g,a=/^(\d+)\s+(\d+)\s+obj\b/,s=new Uint8Array([116,114,97,105,108,101,114]),n=new Uint8Array([115,116,97,114,116,120,114,101,102]),g=new Uint8Array([47,88,82,101,102]);this.entries.length=0,this._cacheMap.clear();const r=this.stream;r.pos=0;const o=r.getBytes(),I=P(o),c=o.length;let C=r.start;const B=[],h=[];for(;C=c)break;Q=o[C]}while(10!==Q&&13!==Q);continue}const l=A(o,C);let E;if(l.startsWith("xref")&&(4===l.length||/\s/.test(l[4])))C+=e(o,C,s),B.push(C),C+=e(o,C,n);else if(E=a.exec(l)){const A=0|E[1],i=0|E[2],a=C+l.length;let s,n=!1;if(this.entries[A]){if(this.entries[A].gen===i)try{new si({lexer:new ri(r.makeSubStream(a))}).getObj(),n=!0}catch(A){A instanceof DA?G(`indexObjects -- checking object (${l}): "${A}".`):n=!0}}else n=!0;n&&(this.entries[A]={offset:C-r.start,gen:i,uncompressed:!0}),t.lastIndex=a;const B=t.exec(I);B?(s=t.lastIndex+1-C,"endobj"!==B[1]&&(G(`indexObjects: Found "${B[1]}" inside of another "obj", caused by missing "endobj" -- trying to recover.`),s-=B[1].length+1)):s=c-C;const Q=o.subarray(C,C+s),u=e(Q,0,g);u0?Math.max(...this._xrefStms):null)}getEntry(A){const e=this.entries[A];return e&&!e.free&&e.offset?e:null}fetchIfRef(A,e=!1){return A instanceof hA?this.fetch(A,e):A}fetch(A,e=!1){if(!(A instanceof hA))throw new Error("ref object is not a reference");const t=A.num,i=this._cacheMap.get(t);if(void 0!==i)return i instanceof BA&&!i.objId&&(i.objId=A.toString()),i;let a=this.getEntry(t);if(null===a)return this._cacheMap.set(t,a),a;if(this._pendingRefs.has(A))return this._pendingRefs.remove(A),G(`Ignoring circular reference: ${A}.`),sA;this._pendingRefs.put(A);try{a=a.uncompressed?this.fetchUncompressed(A,a,e):this.fetchCompressed(A,a,e),this._pendingRefs.remove(A)}catch(e){throw this._pendingRefs.remove(A),e}return a instanceof BA?a.objId=A.toString():a instanceof pA&&(a.dict.objId=A.toString()),a}fetchUncompressed(A,e,t=!1){const i=A.gen;let a=A.num;if(e.gen!==i){const s=`Inconsistent generation in XRef: ${A}`;if(this._generationFallback&&e.gen0&&e[3]-e[1]>0)return e;G(`Empty, or invalid, /${A} entry.`)}return null}get mediaBox(){return M(this,"mediaBox",this._getBoundingBox("MediaBox")||Bd)}get cropBox(){return M(this,"cropBox",this._getBoundingBox("CropBox")||this.mediaBox)}get userUnit(){let A=this.pageDict.get("UserUnit");return("number"!=typeof A||A<=0)&&(A=1),M(this,"userUnit",A)}get view(){const{cropBox:A,mediaBox:e}=this;if(A!==e&&!eA(A,e)){const t=j.intersect(A,e);if(t&&t[2]-t[0]>0&&t[3]-t[1]>0)return M(this,"view",t);G("Empty /CropBox and /MediaBox intersection.")}return M(this,"view",e)}get rotate(){let A=this._getInheritableProperty("Rotate")||0;return A%90!=0?A=0:A>=360?A%=360:A<0&&(A=(A%360+360)%360),M(this,"rotate",A)}_onSubStreamError(A,e){if(!this.evaluatorOptions.ignoreErrors)throw A;G(`getContentStream - ignoring sub-stream (${e}): "${A}".`)}getContentStream(){return this.pdfManager.ensure(this,"content").then((A=>A instanceof pA?A:Array.isArray(A)?new Re(A,this._onSubStreamError.bind(this)):new ge))}get xfaData(){return M(this,"xfaData",this.xfaFactory?{bbox:this.xfaFactory.getBoundingBox(this.pageIndex)}:null)}#q(A,e,t){for(const i of A)if(i.id){const A=hA.fromString(i.id);if(!A){G(`A non-linked annotation cannot be modified: ${i.id}`);continue}if(i.deleted){e.put(A,A);continue}t?.put(A),i.ref=A,delete i.id}}async saveNewAnnotations(A,e,t,i){if(this.xfaFactory)throw new Error("XFA: Cannot save new annotations.");const a=new Ir({xref:this.xref,handler:A,pageIndex:this.pageIndex,idFactory:this._localIdFactory,fontCache:this.fontCache,builtInCMapCache:this.builtInCMapCache,standardFontDataCache:this.standardFontDataCache,globalImageCache:this.globalImageCache,systemFontCache:this.systemFontCache,options:this.evaluatorOptions}),s=new lA,n=new QA;this.#q(t,s,n);const g=this.pageDict,r=this.annotations.filter((A=>!(A instanceof hA&&s.has(A)))),o=await xu.saveNewAnnotations(a,e,t,i);for(const{ref:A}of o.annotations)A instanceof hA&&!n.has(A)&&r.push(A);const I=g.get("Annots");g.set("Annots",r);const c=[];await Zr(this.ref,g,c,this.xref),I&&g.set("Annots",I);const C=o.dependencies;C.push({ref:this.ref,data:c.join("")},...o.annotations);for(const A of s)C.push({ref:A,data:null});return C}save(A,e,t){const i=new Ir({xref:this.xref,handler:A,pageIndex:this.pageIndex,idFactory:this._localIdFactory,fontCache:this.fontCache,builtInCMapCache:this.builtInCMapCache,standardFontDataCache:this.standardFontDataCache,globalImageCache:this.globalImageCache,systemFontCache:this.systemFontCache,options:this.evaluatorOptions});return this._parsedAnnotations.then((function(A){const a=[];for(const s of A)s.mustBePrinted(t)&&a.push(s.save(i,e,t).catch((function(A){return G(`save - ignoring annotation data during "${e.name}" task: "${A}".`),null})));return Promise.all(a).then((function(A){return A.filter((A=>!!A))}))}))}loadResources(A){return this.resourcesPromise||=this.pdfManager.ensure(this,"resources"),this.resourcesPromise.then((()=>new co(this.resources,A,this.xref).load()))}getOperatorList({handler:A,sink:e,task:t,intent:i,cacheKey:a,annotationStorage:s=null,modifiedIds:n=null}){const r=this.getContentStream(),o=this.loadResources(["ColorSpace","ExtGState","Font","Pattern","Properties","Shading","XObject"]),I=new Ir({xref:this.xref,handler:A,pageIndex:this.pageIndex,idFactory:this._localIdFactory,fontCache:this.fontCache,builtInCMapCache:this.builtInCMapCache,standardFontDataCache:this.standardFontDataCache,globalImageCache:this.globalImageCache,systemFontCache:this.systemFontCache,options:this.evaluatorOptions}),c=this.xfaFactory?null:$A(s),C=c?.get(this.pageIndex);let B=Promise.resolve(null),h=null;if(C){const A=this.pdfManager.ensureDoc("annotationGlobals");let e;const i=new Set;for(const{bitmapId:A,bitmap:e}of C)!A||e||i.has(A)||i.add(A);const{isOffscreenCanvasSupported:a}=this.evaluatorOptions;if(i.size>0){const A=C.slice();for(const[e,t]of s)e.startsWith(g)&&t.bitmap&&i.has(t.bitmapId)&&A.push(t);e=xu.generateImages(A,this.xref,a)}else e=xu.generateImages(C,this.xref,a);h=new QA,this.#q(C,h,null),B=A.then((A=>A?xu.printNewAnnotations(A,I,t,C,e):null))}const Q=Promise.all([r,o]).then((([s])=>{const n=new er(i,e);return A.send("StartRenderPage",{transparency:I.hasBlendModes(this.resources,this.nonBlendModesSet),pageIndex:this.pageIndex,cacheKey:a}),I.getOperatorList({stream:s,task:t,resources:this.resources,operatorList:n}).then((function(){return n}))}));return Promise.all([Q,this._parsedAnnotations,B]).then((function([A,e,a]){if(a){e=e.filter((A=>!(A.ref&&h.has(A.ref))));for(let A=0,t=a.length;AA.ref&&fA(A.ref,i.refToReplace)));s>=0&&(e.splice(s,1,i),a.splice(A--,1),t--)}}e=e.concat(a)}if(0===e.length||64&i)return A.flush(!0),{length:A.totalLength};const g=!!(16&i),r=!!(128&i),o=!!(1&i),c=!!(2&i),C=!!(4&i),B=[];for(const A of e)(o||c&&A.mustBeViewed(s,g)&&A.mustBeViewedWhenEditing(r,n)||C&&A.mustBePrinted(s))&&B.push(A.getOperatorList(I,t,i,s).catch((function(A){return G(`getOperatorList - ignoring annotation data during "${t.name}" task: "${A}".`),{opList:null,separateForm:!1,separateCanvas:!1}})));return Promise.all(B).then((function(e){let t=!1,i=!1;for(const{opList:a,separateForm:s,separateCanvas:n}of e)A.addOpList(a),t||=s,i||=n;return A.flush(!0,{form:t,canvas:i}),{length:A.totalLength}}))}))}async extractTextContent({handler:A,task:e,includeMarkedContent:t,disableNormalization:i,sink:a}){const s=this.getContentStream(),n=this.loadResources(["ExtGState","Font","Properties","XObject"]),g=this.pdfManager.ensureCatalog("lang"),[r,,o]=await Promise.all([s,n,g]);return new Ir({xref:this.xref,handler:A,pageIndex:this.pageIndex,idFactory:this._localIdFactory,fontCache:this.fontCache,builtInCMapCache:this.builtInCMapCache,standardFontDataCache:this.standardFontDataCache,globalImageCache:this.globalImageCache,systemFontCache:this.systemFontCache,options:this.evaluatorOptions}).getTextContent({stream:r,task:e,resources:this.resources,includeMarkedContent:t,disableNormalization:i,sink:a,viewBox:this.view,lang:o})}async getStructTree(){const A=await this.pdfManager.ensureCatalog("structTreeRoot");return A?(await this._parsedAnnotations,(await this.pdfManager.ensure(this,"_parseStructTree",[A])).serializable):null}_parseStructTree(A){const e=new so(A,this.pageDict);return e.parse(this.ref),e}async getAnnotationsData(A,e,t){const i=await this._parsedAnnotations;if(0===i.length)return i;const a=[],s=[];let n;const g=!!(1&t),r=!!(2&t),o=!!(4&t);for(const t of i){const i=g||r&&t.viewable;(i||o&&t.printable)&&a.push(t.data),t.hasTextContent&&i&&(n||=new Ir({xref:this.xref,handler:A,pageIndex:this.pageIndex,idFactory:this._localIdFactory,fontCache:this.fontCache,builtInCMapCache:this.builtInCMapCache,standardFontDataCache:this.standardFontDataCache,globalImageCache:this.globalImageCache,systemFontCache:this.systemFontCache,options:this.evaluatorOptions}),s.push(t.extractTextContent(n,e,[-1/0,-1/0,1/0,1/0]).catch((function(A){G(`getAnnotationsData - ignoring textContent during "${e.name}" task: "${A}".`)}))))}return await Promise.all(s),a}get annotations(){const A=this._getInheritableProperty("Annots");return M(this,"annotations",Array.isArray(A)?A:[])}get _parsedAnnotations(){return M(this,"_parsedAnnotations",this.pdfManager.ensure(this,"annotations").then((async A=>{if(0===A.length)return A;const e=await this.pdfManager.ensureDoc("annotationGlobals");if(!e)return[];const t=[];for(const i of A)t.push(xu.create(this.xref,i,e,this._localIdFactory,!1,this.ref).catch((function(A){return G(`_parsedAnnotations: "${A}".`),null})));const i=[];let a,s;for(const A of await Promise.all(t))A&&(A instanceof Ku?(s||=[]).push(A):A instanceof Xu?(a||=[]).push(A):i.push(A));return s&&i.push(...s),a&&i.push(...a),i})))}get jsActions(){return M(this,"jsActions",WA(this.xref,this.pageDict,h))}}const Qd=new Uint8Array([37,80,68,70,45]),ld=new Uint8Array([115,116,97,114,116,120,114,101,102]),Ed=new Uint8Array([101,110,100,111,98,106]);function ud(A,e,t=1024,i=!1){const a=e.length,s=A.peekBytes(t),n=s.length-a;if(n<=0)return!1;if(i){const t=a-1;let i=s.length-1;for(;i>=t;){let n=0;for(;n=a)return A.pos+=i-t,!0;i--}}else{let t=0;for(;t<=n;){let i=0;for(;i=a)return A.pos+=t,!0;t++}}return!1}class dd{constructor(A,e){if(e.length<=0)throw new Y("The PDF file is empty, i.e. its size is zero bytes.");this.pdfManager=A,this.stream=e,this.xref=new Cd(e,A),this._pagePromises=new Map,this._version=null;const t={font:0};this._globalIdFactory=class{static getDocId(){return`g_${A.docId}`}static createFontId(){return"f"+ ++t.font}static createObjId(){N("Abstract method `createObjId` called.")}static getPageObjId(){N("Abstract method `getPageObjId` called.")}}}parse(A){this.xref.parse(A),this.catalog=new oo(this.pdfManager,this.xref)}get linearization(){let A=null;try{A=oi.create(this.stream)}catch(A){if(A instanceof wA)throw A;R(A)}return M(this,"linearization",A)}get startXRef(){const A=this.stream;let e=0;if(this.linearization){if(A.reset(),ud(A,Ed)){A.skip(6);let t=A.peekByte();for(;LA(t);)A.pos++,t=A.peekByte();e=A.pos-A.start}}else{const t=1024,i=ld.length;let a=!1,s=A.end;for(;!a&&s>0;)s-=t-i,s<0&&(s=0),A.pos=s,a=ud(A,ld,t,!0);if(a){let t;A.skip(9);do{t=A.getByte()}while(LA(t));let i="";for(;t>=32&&t<=57;)i+=String.fromCharCode(t),t=A.getByte();e=parseInt(i,10),isNaN(e)&&(e=0)}}return M(this,"startXRef",e)}checkHeader(){const A=this.stream;if(A.reset(),!ud(A,Qd))return;A.moveStart(),A.skip(Qd.length);let e,t="";for(;(e=A.getByte())>32&&t.length<7;)t+=String.fromCharCode(e);mA.test(t)?this._version=t:G(`Invalid PDF header version: ${t}`)}parseStartXRef(){this.xref.setStartXRef(this.startXRef)}get numPages(){let A=0;return A=this.catalog.hasActualNumPages?this.catalog.numPages:this.xfaFactory?this.xfaFactory.getNumPages():this.linearization?this.linearization.numPages:this.catalog.numPages,M(this,"numPages",A)}_hasOnlyDocumentSignatures(A,e=0){return!!Array.isArray(A)&&A.every((A=>{if(!((A=this.xref.fetchIfRef(A))instanceof BA))return!1;if(A.has("Kids"))return++e>10?(G("_hasOnlyDocumentSignatures: maximum recursion depth reached"),!1):this._hasOnlyDocumentSignatures(A.get("Kids"),e);const t=EA(A.get("FT"),"Sig"),i=A.get("Rect"),a=Array.isArray(i)&&i.every((A=>0===A));return t&&a}))}get _xfaStreams(){const A=this.catalog.acroForm;if(!A)return null;const e=A.get("XFA"),t={"xdp:xdp":"",template:"",datasets:"",config:"",connectionSet:"",localeSet:"",stylesheet:"","/xdp:xdp":""};if(e instanceof pA&&!e.isEmpty)return t["xdp:xdp"]=e,t;if(!Array.isArray(e)||0===e.length)return null;for(let A=0,i=e.length;A{c.set(A,e)}));const C=[];for(const[A,t]of c){const a=t.get("FontDescriptor");if(!(a instanceof BA))continue;let s=a.get("FontFamily");s=s.replaceAll(/[ ]+(\d)/g,"$1");const n={fontFamily:s,fontWeight:a.get("FontWeight"),italicAngle:-a.get("ItalicAngle")};jA(n)&&C.push(g.handleSetFont(i,[IA.get(A),1],null,r,e,I,null,n).catch((function(A){return G(`loadXfaFonts: "${A}".`),null})))}await Promise.all(C);const B=this.xfaFactory.setFonts(o);if(!B)return;n.ignoreErrors=!0,C.length=0,o.length=0;const h=new Set;for(const A of B)On(`${A}-Regular`)||h.add(A);h.size&&B.push("PdfJS-Fallback");for(const A of B)if(!h.has(A))for(const t of[{name:"Regular",fontWeight:400,italicAngle:0},{name:"Bold",fontWeight:700,italicAngle:0},{name:"Italic",fontWeight:400,italicAngle:12},{name:"BoldItalic",fontWeight:700,italicAngle:12}]){const a=`${A}-${t.name}`,s=Xn(a);C.push(g.handleSetFont(i,[IA.get(a),1],null,r,e,I,s,{fontFamily:A,fontWeight:t.fontWeight,italicAngle:t.italicAngle}).catch((function(A){return G(`loadXfaFonts: "${A}".`),null})))}await Promise.all(C),this.xfaFactory.appendFonts(o,h)}async serializeXfaData(A){return this.xfaFactory?this.xfaFactory.serializeData(A):null}get version(){return this.catalog.version||this._version}get formInfo(){const A={hasFields:!1,hasAcroForm:!1,hasXfa:!1,hasSignatures:!1},e=this.catalog.acroForm;if(!e)return M(this,"formInfo",A);try{const t=e.get("Fields"),i=Array.isArray(t)&&t.length>0;A.hasFields=i;const a=e.get("XFA");A.hasXfa=Array.isArray(a)&&a.length>0||a instanceof pA&&!a.isEmpty;const s=!!(1&e.get("SigFlags")),n=s&&this._hasOnlyDocumentSignatures(t);A.hasAcroForm=i&&!n,A.hasSignatures=s}catch(A){if(A instanceof wA)throw A;G(`Cannot fetch form information: "${A}".`)}return M(this,"formInfo",A)}get documentInfo(){const A={PDFFormatVersion:this.version,Language:this.catalog.lang,EncryptFilterName:this.xref.encrypt?this.xref.encrypt.filterName:null,IsLinearized:!!this.linearization,IsAcroFormPresent:this.formInfo.hasAcroForm,IsXFAPresent:this.formInfo.hasXfa,IsCollectionPresent:!!this.catalog.collection,IsSignaturesPresent:this.formInfo.hasSignatures};let e;try{e=this.xref.trailer.get("Info")}catch(A){if(A instanceof wA)throw A;R("The document information dictionary is invalid.")}if(!(e instanceof BA))return M(this,"documentInfo",A);for(const t of e.getKeys()){const i=e.get(t);switch(t){case"Title":case"Author":case"Subject":case"Keywords":case"Creator":case"Producer":case"CreationDate":case"ModDate":if("string"==typeof i){A[t]=_(i);continue}break;case"Trapped":if(i instanceof IA){A[t]=i;continue}break;default:let e;switch(typeof i){case"string":e=_(i);break;case"number":case"boolean":e=i;break;default:i instanceof IA&&(e=i)}if(void 0===e){G(`Bad value, for custom key "${t}", in Info: ${i}.`);continue}A.Custom||(A.Custom=Object.create(null)),A.Custom[t]=e;continue}G(`Bad value, for key "${t}", in Info: ${i}.`)}return M(this,"documentInfo",A)}get fingerprints(){function A(A){return"string"==typeof A&&A.length>0&&"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"!==A}function e(A){const e=[];for(const t of A){const A=t.toString(16);e.push(A.padStart(2,"0"))}return e.join("")}const t=this.xref.trailer.get("ID");let i,a;return Array.isArray(t)&&A(t[0])?(i=W(t[0]),t[1]!==t[0]&&A(t[1])&&(a=W(t[1]))):i=Ur(this.stream.getByteRange(0,1024),0,1024),M(this,"fingerprints",[e(i),a?e(a):null])}async _getLinearizationPage(A){const{catalog:e,linearization:t,xref:i}=this,a=hA.get(t.objectNumberFirst,0);try{const A=await i.fetchAsync(a);if(A instanceof BA){let t=A.getRaw("Type");if(t instanceof hA&&(t=await i.fetchAsync(t)),EA(t,"Page")||!A.has("Type")&&!A.has("Kids")&&A.has("Contents"))return e.pageKidsCountCache.has(a)||e.pageKidsCountCache.put(a,1),e.pageIndexCache.has(a)||e.pageIndexCache.put(a,0),[A,a]}throw new q("The Linearization dictionary doesn't point to a valid Page dictionary.")}catch(t){return G(`_getLinearizationPage: "${t.message}".`),e.getPageDict(A)}}getPage(A){const e=this._pagePromises.get(A);if(e)return e;const{catalog:t,linearization:i,xfaFactory:a}=this;let s;return s=a?Promise.resolve([BA.empty,null]):i?.pageFirst===A?this._getLinearizationPage(A):t.getPageDict(A),s=s.then((([e,i])=>new hd({pdfManager:this.pdfManager,xref:this.xref,pageIndex:A,pageDict:e,ref:i,globalIdFactory:this._globalIdFactory,fontCache:t.fontCache,builtInCMapCache:t.builtInCMapCache,standardFontDataCache:t.standardFontDataCache,globalImageCache:t.globalImageCache,systemFontCache:t.systemFontCache,nonBlendModesSet:t.nonBlendModesSet,xfaFactory:a}))),this._pagePromises.set(A,s),s}async checkFirstPage(A=!1){if(!A)try{await this.getPage(0)}catch(A){if(A instanceof bA)throw this._pagePromises.delete(0),await this.cleanup(),new kA}}async checkLastPage(A=!1){const{catalog:e,pdfManager:t}=this;let i;e.setActualNumPages();try{if(await Promise.all([t.ensureDoc("xfaFactory"),t.ensureDoc("linearization"),t.ensureCatalog("numPages")]),this.xfaFactory)return;if(i=this.linearization?this.linearization.numPages:e.numPages,!Number.isInteger(i))throw new q("Page count is not an integer.");if(i<=1)return;await this.getPage(i-1)}catch(a){if(this._pagePromises.delete(i-1),await this.cleanup(),a instanceof bA&&!A)throw new kA;let s;G(`checkLastPage - invalid /Pages tree /Count: ${i}.`);try{s=await e.getAllPageDicts(A)}catch(t){if(t instanceof bA&&!A)throw new kA;return void e.setActualNumPages(1)}for(const[A,[i,a]]of s){let s;i instanceof Error?(s=Promise.reject(i),s.catch((()=>{}))):s=Promise.resolve(new hd({pdfManager:t,xref:this.xref,pageIndex:A,pageDict:i,ref:a,globalIdFactory:this._globalIdFactory,fontCache:e.fontCache,builtInCMapCache:e.builtInCMapCache,standardFontDataCache:e.standardFontDataCache,globalImageCache:e.globalImageCache,systemFontCache:e.systemFontCache,nonBlendModesSet:e.nonBlendModesSet,xfaFactory:null})),this._pagePromises.set(A,s)}e.setActualNumPages(s.size)}}fontFallback(A,e){return this.catalog.fontFallback(A,e)}async cleanup(A=!1){return this.catalog?this.catalog.cleanup(A):wr()}async#T(A,e,t,i,a){const{xref:s}=this;if(!(e instanceof hA)||a.has(e))return;a.put(e);const n=await s.fetchAsync(e);if(!(n instanceof BA))return;if(n.has("T")){const e=_(await n.getAsync("T"));A=""===A?e:`${A}.${e}`}else{let e=n;for(;;){if(e=e.getRaw("Parent"),e instanceof hA){if(a.has(e))break;e=await s.fetchAsync(e)}if(!(e instanceof BA))break;if(e.has("T")){const t=_(await e.getAsync("T"));A=""===A?t:`${A}.${t}`;break}}}if(t.has(A)||t.set(A,[]),t.get(A).push(xu.create(s,e,i,null,!0,null).then((A=>A?.getFieldObject())).catch((function(A){return G(`#collectFieldObjects: "${A}".`),null}))),!n.has("Kids"))return;const g=await n.getAsync("Kids");if(Array.isArray(g))for(const e of g)await this.#T(A,e,t,i,a)}get fieldObjects(){return this.formInfo.hasFields?M(this,"fieldObjects",Promise.all([this.pdfManager.ensureDoc("annotationGlobals"),this.pdfManager.ensureCatalog("acroForm")]).then((async([A,e])=>{if(!A)return null;const t=new QA,i=Object.create(null),a=new Map;for(const i of await e.getAsync("Fields"))await this.#T("",i,a,A,t);const s=[];for(const[A,e]of a)s.push(Promise.all(e).then((e=>{(e=e.filter((A=>!!A))).length>0&&(i[A]=e)})));return await Promise.all(s),i}))):M(this,"fieldObjects",Promise.resolve(null))}get hasJSActions(){return M(this,"hasJSActions",this.pdfManager.ensureDoc("_parseHasJSActions"))}async _parseHasJSActions(){const[A,e]=await Promise.all([this.pdfManager.ensureCatalog("jsActions"),this.pdfManager.ensureDoc("fieldObjects")]);return!!A||!!e&&Object.values(e).some((A=>A.some((A=>null!==A.actions))))}get calculationOrderIds(){const A=this.catalog.acroForm;if(!A?.has("CO"))return M(this,"calculationOrderIds",null);const e=A.get("CO");if(!Array.isArray(e)||0===e.length)return M(this,"calculationOrderIds",null);const t=[];for(const A of e)A instanceof hA&&t.push(A.toString());return 0===t.length?M(this,"calculationOrderIds",null):M(this,"calculationOrderIds",t)}get annotationGlobals(){return M(this,"annotationGlobals",xu.createGlobals(this.pdfManager))}}class fd{constructor(A){this._docBaseUrl=function(A){if(A){const e=U(A);if(e)return e.href;G(`Invalid absolute docBaseUrl: "${A}".`)}return null}(A.docBaseUrl),this._docId=A.docId,this._password=A.password,this.enableXfa=A.enableXfa,A.evaluatorOptions.isOffscreenCanvasSupported&&=X.isOffscreenCanvasSupported,this.evaluatorOptions=Object.freeze(A.evaluatorOptions)}get docId(){return this._docId}get password(){return this._password}get docBaseUrl(){return this._docBaseUrl}get catalog(){return this.pdfDocument.catalog}ensureDoc(A,e){return this.ensure(this.pdfDocument,A,e)}ensureXRef(A,e){return this.ensure(this.pdfDocument.xref,A,e)}ensureCatalog(A,e){return this.ensure(this.pdfDocument.catalog,A,e)}getPage(A){return this.pdfDocument.getPage(A)}fontFallback(A,e){return this.pdfDocument.fontFallback(A,e)}loadXfaFonts(A,e){return this.pdfDocument.loadXfaFonts(A,e)}loadXfaImages(){return this.pdfDocument.loadXfaImages()}serializeXfaData(A){return this.pdfDocument.serializeXfaData(A)}cleanup(A=!1){return this.pdfDocument.cleanup(A)}async ensure(A,e,t){N("Abstract method `ensure` called")}requestRange(A,e){N("Abstract method `requestRange` called")}requestLoadedStream(A=!1){N("Abstract method `requestLoadedStream` called")}sendProgressiveData(A){N("Abstract method `sendProgressiveData` called")}updatePassword(A){this._password=A}terminate(A){N("Abstract method `terminate` called")}}class pd extends fd{constructor(A){super(A);const e=new se(A.source);this.pdfDocument=new dd(this,e),this._loadedStreamPromise=Promise.resolve(e)}async ensure(A,e,t){const i=A[e];return"function"==typeof i?i.apply(A,t):i}requestRange(A,e){return Promise.resolve()}requestLoadedStream(A=!1){return this._loadedStreamPromise}terminate(A){}}class md extends fd{constructor(A){super(A),this.streamManager=new oe(A.source,{msgHandler:A.handler,length:A.length,disableAutoFetch:A.disableAutoFetch,rangeChunkSize:A.rangeChunkSize}),this.pdfDocument=new dd(this,this.streamManager.getStream())}async ensure(A,e,t){try{const i=A[e];return"function"==typeof i?i.apply(A,t):i}catch(i){if(!(i instanceof wA))throw i;return await this.requestRange(i.begin,i.end),this.ensure(A,e,t)}}requestRange(A,e){return this.streamManager.requestRange(A,e)}requestLoadedStream(A=!1){return this.streamManager.requestAllChunks(A)}sendProgressiveData(A){this.streamManager.onReceiveData({chunk:A})}terminate(A){this.streamManager.abort(A)}}function yd(A){switch(A instanceof Error||"object"==typeof A&&null!==A||N('wrapReason: Expected "reason" to be a (possibly cloned) Error.'),A.name){case"AbortException":return new T(A.message);case"MissingPDFException":return new v(A.message);case"PasswordException":return new J(A.message,A.code);case"UnexpectedResponseException":return new K(A.message,A.status);case"UnknownErrorException":return new H(A.message,A.details);default:return new H(A.message,A.toString())}}class wd{constructor(A,e,t){this.sourceName=A,this.targetName=e,this.comObj=t,this.callbackId=1,this.streamId=1,this.streamSinks=Object.create(null),this.streamControllers=Object.create(null),this.callbackCapabilities=Object.create(null),this.actionHandler=Object.create(null),this._onComObjOnMessage=A=>{const e=A.data;if(e.targetName!==this.sourceName)return;if(e.stream)return void this.#P(e);if(e.callback){const A=e.callbackId,t=this.callbackCapabilities[A];if(!t)throw new Error(`Cannot resolve callback ${A}`);if(delete this.callbackCapabilities[A],1===e.callback)t.resolve(e.data);else{if(2!==e.callback)throw new Error("Unexpected callback case");t.reject(yd(e.reason))}return}const i=this.actionHandler[e.action];if(!i)throw new Error(`Unknown action from worker: ${e.action}`);if(e.callbackId){const A=this.sourceName,a=e.sourceName;new Promise((function(A){A(i(e.data))})).then((function(i){t.postMessage({sourceName:A,targetName:a,callback:1,callbackId:e.callbackId,data:i})}),(function(i){t.postMessage({sourceName:A,targetName:a,callback:2,callbackId:e.callbackId,reason:yd(i)})}))}else e.streamId?this.#W(e):i(e.data)},t.addEventListener("message",this._onComObjOnMessage)}on(A,e){const t=this.actionHandler;if(t[A])throw new Error(`There is already an actionName called "${A}"`);t[A]=e}send(A,e,t){this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:A,data:e},t)}sendWithPromise(A,e,t){const i=this.callbackId++,a=Promise.withResolvers();this.callbackCapabilities[i]=a;try{this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:A,callbackId:i,data:e},t)}catch(A){a.reject(A)}return a.promise}sendWithStream(A,e,t,i){const a=this.streamId++,s=this.sourceName,n=this.targetName,g=this.comObj;return new ReadableStream({start:t=>{const r=Promise.withResolvers();return this.streamControllers[a]={controller:t,startCall:r,pullCall:null,cancelCall:null,isClosed:!1},g.postMessage({sourceName:s,targetName:n,action:A,streamId:a,data:e,desiredSize:t.desiredSize},i),r.promise},pull:A=>{const e=Promise.withResolvers();return this.streamControllers[a].pullCall=e,g.postMessage({sourceName:s,targetName:n,stream:6,streamId:a,desiredSize:A.desiredSize}),e.promise},cancel:A=>{x(A instanceof Error,"cancel must have a valid reason");const e=Promise.withResolvers();return this.streamControllers[a].cancelCall=e,this.streamControllers[a].isClosed=!0,g.postMessage({sourceName:s,targetName:n,stream:1,streamId:a,reason:yd(A)}),e.promise}},t)}#W(A){const e=A.streamId,t=this.sourceName,i=A.sourceName,a=this.comObj,s=this,n=this.actionHandler[A.action],g={enqueue(A,s=1,n){if(this.isCancelled)return;const g=this.desiredSize;this.desiredSize-=s,g>0&&this.desiredSize<=0&&(this.sinkCapability=Promise.withResolvers(),this.ready=this.sinkCapability.promise),a.postMessage({sourceName:t,targetName:i,stream:4,streamId:e,chunk:A},n)},close(){this.isCancelled||(this.isCancelled=!0,a.postMessage({sourceName:t,targetName:i,stream:3,streamId:e}),delete s.streamSinks[e])},error(A){x(A instanceof Error,"error must have a valid reason"),this.isCancelled||(this.isCancelled=!0,a.postMessage({sourceName:t,targetName:i,stream:5,streamId:e,reason:yd(A)}))},sinkCapability:Promise.withResolvers(),onPull:null,onCancel:null,isCancelled:!1,desiredSize:A.desiredSize,ready:null};g.sinkCapability.resolve(),g.ready=g.sinkCapability.promise,this.streamSinks[e]=g,new Promise((function(e){e(n(A.data,g))})).then((function(){a.postMessage({sourceName:t,targetName:i,stream:8,streamId:e,success:!0})}),(function(A){a.postMessage({sourceName:t,targetName:i,stream:8,streamId:e,reason:yd(A)})}))}#P(A){const e=A.streamId,t=this.sourceName,i=A.sourceName,a=this.comObj,s=this.streamControllers[e],n=this.streamSinks[e];switch(A.stream){case 8:A.success?s.startCall.resolve():s.startCall.reject(yd(A.reason));break;case 7:A.success?s.pullCall.resolve():s.pullCall.reject(yd(A.reason));break;case 6:if(!n){a.postMessage({sourceName:t,targetName:i,stream:7,streamId:e,success:!0});break}n.desiredSize<=0&&A.desiredSize>0&&n.sinkCapability.resolve(),n.desiredSize=A.desiredSize,new Promise((function(A){A(n.onPull?.())})).then((function(){a.postMessage({sourceName:t,targetName:i,stream:7,streamId:e,success:!0})}),(function(A){a.postMessage({sourceName:t,targetName:i,stream:7,streamId:e,reason:yd(A)})}));break;case 4:if(x(s,"enqueue should have stream controller"),s.isClosed)break;s.controller.enqueue(A.chunk);break;case 3:if(x(s,"close should have stream controller"),s.isClosed)break;s.isClosed=!0,s.controller.close(),this.#Z(s,e);break;case 5:x(s,"error should have stream controller"),s.controller.error(yd(A.reason)),this.#Z(s,e);break;case 2:A.success?s.cancelCall.resolve():s.cancelCall.reject(yd(A.reason)),this.#Z(s,e);break;case 1:if(!n)break;new Promise((function(e){e(n.onCancel?.(yd(A.reason)))})).then((function(){a.postMessage({sourceName:t,targetName:i,stream:2,streamId:e,success:!0})}),(function(A){a.postMessage({sourceName:t,targetName:i,stream:2,streamId:e,reason:yd(A)})})),n.sinkCapability.reject(yd(A.reason)),n.isCancelled=!0,delete this.streamSinks[e];break;default:throw new Error("Unexpected stream case")}}async#Z(A,e){await Promise.allSettled([A.startCall?.promise,A.pullCall?.promise,A.cancelCall?.promise]),delete this.streamControllers[e]}destroy(){this.comObj.removeEventListener("message",this._onComObjOnMessage)}}class Dd{constructor(A){this._msgHandler=A,this._contentLength=null,this._fullRequestReader=null,this._rangeRequestReaders=[]}getFullReader(){return x(!this._fullRequestReader,"PDFWorkerStream.getFullReader can only be called once."),this._fullRequestReader=new bd(this._msgHandler),this._fullRequestReader}getRangeReader(A,e){const t=new kd(A,e,this._msgHandler);return this._rangeRequestReaders.push(t),t}cancelAllRequests(A){this._fullRequestReader?.cancel(A);for(const e of this._rangeRequestReaders.slice(0))e.cancel(A)}}class bd{constructor(A){this._msgHandler=A,this.onProgress=null,this._contentLength=null,this._isRangeSupported=!1,this._isStreamingSupported=!1;const e=this._msgHandler.sendWithStream("GetReader");this._reader=e.getReader(),this._headersReady=this._msgHandler.sendWithPromise("ReaderHeadersReady").then((A=>{this._isStreamingSupported=A.isStreamingSupported,this._isRangeSupported=A.isRangeSupported,this._contentLength=A.contentLength}))}get headersReady(){return this._headersReady}get contentLength(){return this._contentLength}get isStreamingSupported(){return this._isStreamingSupported}get isRangeSupported(){return this._isRangeSupported}async read(){const{value:A,done:e}=await this._reader.read();return e?{value:void 0,done:!0}:{value:A.buffer,done:!1}}cancel(A){this._reader.cancel(A)}}class kd{constructor(A,e,t){this._msgHandler=t,this.onProgress=null;const i=this._msgHandler.sendWithStream("GetRangeReader",{begin:A,end:e});this._reader=i.getReader()}get isStreamingSupported(){return!1}async read(){const{value:A,done:e}=await this._reader.read();return e?{value:void 0,done:!0}:{value:A.buffer,done:!1}}cancel(A){this._reader.cancel(A)}}class Fd{constructor(A){this.name=A,this.terminated=!1,this._capability=Promise.withResolvers()}get finished(){return this._capability.promise}finish(){this._capability.resolve()}terminate(){this.terminated=!0}ensureNotTerminated(){if(this.terminated)throw new Error("Worker task was terminated")}}class Sd{static setup(A,e){let t=!1;A.on("test",(function(e){t||(t=!0,A.send("test",e instanceof Uint8Array))})),A.on("configure",(function(A){var e;e=A.verbosity,Number.isInteger(e)&&(F=e)})),A.on("GetDocRequest",(function(A){return Sd.createDocumentHandler(A,e)}))}static createDocumentHandler(A,e){let t,i=!1,a=null;const s=new Set,n=S(),{docId:g,apiVersion:r}=A,o="4.6.82";if(r!==o)throw new Error(`The API version "${r}" does not match the Worker version "${o}".`);const I=[];for(const A in[])I.push(A);if(I.length)throw new Error("The `Array.prototype` contains unexpected enumerable properties: "+I.join(", ")+"; thus breaking e.g. `for...in` iteration of `Array`s.");const c=g+"_worker";let C=new wd(c,g,e);function B(){if(i)throw new Error("Worker was terminated")}function h(A){s.add(A)}function l(A){A.finish(),s.delete(A)}async function E(A){await t.ensureDoc("checkHeader"),await t.ensureDoc("parseStartXRef"),await t.ensureDoc("parse",[A]),await t.ensureDoc("checkFirstPage",[A]),await t.ensureDoc("checkLastPage",[A]);const e=await t.ensureDoc("isPureXfa");if(e){const A=new Fd("loadXfaFonts");h(A),await Promise.all([t.loadXfaFonts(C,A).catch((A=>{})).then((()=>l(A))),t.loadXfaImages()])}const[i,a]=await Promise.all([t.ensureDoc("numPages"),t.ensureDoc("fingerprints")]);return{numPages:i,fingerprints:a,htmlForXfa:e?await t.ensureDoc("htmlForXfa"):null}}return C.on("GetPage",(function(A){return t.getPage(A.pageIndex).then((function(A){return Promise.all([t.ensure(A,"rotate"),t.ensure(A,"ref"),t.ensure(A,"userUnit"),t.ensure(A,"view")]).then((function([A,e,t,i]){return{rotate:A,ref:e,refStr:e?.toString()??null,userUnit:t,view:i}}))}))})),C.on("GetPageIndex",(function(A){const e=hA.get(A.num,A.gen);return t.ensureCatalog("getPageIndex",[e])})),C.on("GetDestinations",(function(A){return t.ensureCatalog("destinations")})),C.on("GetDestination",(function(A){return t.ensureCatalog("getDestination",[A.id])})),C.on("GetPageLabels",(function(A){return t.ensureCatalog("pageLabels")})),C.on("GetPageLayout",(function(A){return t.ensureCatalog("pageLayout")})),C.on("GetPageMode",(function(A){return t.ensureCatalog("pageMode")})),C.on("GetViewerPreferences",(function(A){return t.ensureCatalog("viewerPreferences")})),C.on("GetOpenAction",(function(A){return t.ensureCatalog("openAction")})),C.on("GetAttachments",(function(A){return t.ensureCatalog("attachments")})),C.on("GetDocJSActions",(function(A){return t.ensureCatalog("jsActions")})),C.on("GetPageJSActions",(function({pageIndex:A}){return t.getPage(A).then((function(A){return t.ensure(A,"jsActions")}))})),C.on("GetOutline",(function(A){return t.ensureCatalog("documentOutline")})),C.on("GetOptionalContentConfig",(function(A){return t.ensureCatalog("optionalContentConfig")})),C.on("GetPermissions",(function(A){return t.ensureCatalog("permissions")})),C.on("GetMetadata",(function(A){return Promise.all([t.ensureDoc("documentInfo"),t.ensureCatalog("metadata")])})),C.on("GetMarkInfo",(function(A){return t.ensureCatalog("markInfo")})),C.on("GetData",(function(A){return t.requestLoadedStream().then((function(A){return A.bytes}))})),C.on("GetAnnotations",(function({pageIndex:A,intent:e}){return t.getPage(A).then((function(t){const i=new Fd(`GetAnnotations: page ${A}`);return h(i),t.getAnnotationsData(C,i,e).then((A=>(l(i),A)),(A=>{throw l(i),A}))}))})),C.on("GetFieldObjects",(function(A){return t.ensureDoc("fieldObjects")})),C.on("HasJSActions",(function(A){return t.ensureDoc("hasJSActions")})),C.on("GetCalculationOrderIds",(function(A){return t.ensureDoc("calculationOrderIds")})),C.on("SaveDocument",(async function({isPureXfa:A,numPages:e,annotationStorage:i,filename:a}){const s=[t.requestLoadedStream(),t.ensureCatalog("acroForm"),t.ensureCatalog("acroFormRef"),t.ensureDoc("startXRef"),t.ensureDoc("xref"),t.ensureDoc("linearization"),t.ensureCatalog("structTreeRoot")],n=[],g=A?null:$A(i),[r,o,I,c,B,h,Q]=await Promise.all(s),E=B.trailer.getRaw("Root")||null;let u;if(g){Q?await Q.canUpdateStructTree({pdfManager:t,xref:B,newAnnotationsByPage:g})&&(u=Q):await to.canCreateStructureTree({catalogRef:E,pdfManager:t,newAnnotationsByPage:g})&&(u=null);const A=xu.generateImages(i.values(),B,t.evaluatorOptions.isOffscreenCanvasSupported),e=void 0===u?n:[];for(const[i,a]of g)e.push(t.getPage(i).then((e=>{const t=new Fd(`Save (editor): page ${i}`);return e.saveNewAnnotations(C,t,a,A).finally((function(){l(t)}))})));null===u?n.push(Promise.all(e).then((async A=>(await to.createStructureTree({newAnnotationsByPage:g,xref:B,catalogRef:E,pdfManager:t,newRefs:A}),A)))):u&&n.push(Promise.all(e).then((async A=>(await u.updateStructureTree({newAnnotationsByPage:g,pdfManager:t,newRefs:A}),A))))}if(A)n.push(t.serializeXfaData(i));else for(let A=0;AA.needAppearances)),y=o instanceof BA&&o.get("XFA")||null;let w=null,D=!1;if(Array.isArray(y)){for(let A=0,e=y.length;A{"string"==typeof t&&(A[e]=_(t))})),b={rootRef:E,encryptRef:B.trailer.getRaw("Encrypt")||null,newRef:B.getNewTemporaryRef(),infoRef:B.trailer.getRaw("Info")||null,info:A,fileIds:B.trailer.get("ID")||null,startXRef:h?c:B.lastXRefStreamPos??c,filename:a}}return eo({originalData:r.bytes,xrefInfo:b,newRefs:f,xref:B,hasXfa:!!y,xfaDatasetsRef:w,hasXfaDatasetsEntry:D,needAppearances:m,acroFormRef:I,acroForm:o,xfaData:p,useXrefStream:dA(B.topDict,"XRef")}).finally((()=>{B.resetNewTemporaryRef()}))})),C.on("GetOperatorList",(function(A,e){const i=A.pageIndex;t.getPage(i).then((function(t){const a=new Fd(`GetOperatorList: page ${i}`);h(a);const s=n>=Q.INFOS?Date.now():0;t.getOperatorList({handler:C,sink:e,task:a,intent:A.intent,cacheKey:A.cacheKey,annotationStorage:A.annotationStorage,modifiedIds:A.modifiedIds}).then((function(A){l(a),s&&R(`page=${i+1} - getOperatorList: time=${Date.now()-s}ms, len=${A.length}`),e.close()}),(function(A){l(a),a.terminated||e.error(A)}))}))})),C.on("GetTextContent",(function(A,e){const{pageIndex:i,includeMarkedContent:a,disableNormalization:s}=A;t.getPage(i).then((function(A){const t=new Fd("GetTextContent: page "+i);h(t);const g=n>=Q.INFOS?Date.now():0;A.extractTextContent({handler:C,task:t,sink:e,includeMarkedContent:a,disableNormalization:s}).then((function(){l(t),g&&R(`page=${i+1} - getTextContent: time=`+(Date.now()-g)+"ms"),e.close()}),(function(A){l(t),t.terminated||e.error(A)}))}))})),C.on("GetStructTree",(function(A){return t.getPage(A.pageIndex).then((function(A){return t.ensure(A,"getStructTree")}))})),C.on("FontFallback",(function(A){return t.fontFallback(A.id,C)})),C.on("Cleanup",(function(A){return t.cleanup(!0)})),C.on("Terminate",(function(A){i=!0;const e=[];if(t){t.terminate(new T("Worker was terminated."));const A=t.cleanup();e.push(A),t=null}else wr();a&&a(new T("Worker was terminated."));for(const A of s)e.push(A.finished),A.terminate();return Promise.all(e).then((function(){C.destroy(),C=null}))})),C.on("Ready",(function(e){!function(A){function e(A){B(),C.send("GetDoc",{pdfInfo:A})}function s(A){if(B(),A instanceof J){const e=new Fd(`PasswordException: response ${A.code}`);h(e),C.sendWithPromise("PasswordRequest",A).then((function({password:A}){l(e),t.updatePassword(A),n()})).catch((function(){l(e),C.send("DocException",A)}))}else A instanceof Y||A instanceof v||A instanceof K||A instanceof H?C.send("DocException",A):C.send("DocException",new H(A.message,A.toString()))}function n(){B(),E(!1).then(e,(function(A){B(),A instanceof kA?t.requestLoadedStream().then((function(){B(),E(!0).then(e,s)})):s(A)}))}B(),function({data:A,password:e,disableAutoFetch:t,rangeChunkSize:i,length:s,docBaseUrl:n,enableXfa:r,evaluatorOptions:o}){const I={source:null,disableAutoFetch:t,docBaseUrl:n,docId:g,enableXfa:r,evaluatorOptions:o,handler:C,length:s,password:e,rangeChunkSize:i},c=Promise.withResolvers();let h;if(A){try{I.source=A,h=new pd(I),c.resolve(h)}catch(A){c.reject(A)}return c.promise}let Q,l=[];try{Q=new Dd(C)}catch(A){return c.reject(A),c.promise}const E=Q.getFullReader();E.headersReady.then((function(){if(E.isRangeSupported){I.source=Q,I.length=E.contentLength,I.disableAutoFetch||=E.isStreamingSupported,h=new md(I);for(const A of l)h.sendProgressiveData(A);l=[],c.resolve(h),a=null}})).catch((function(A){c.reject(A),a=null}));let u=0;return new Promise((function(A,e){const t=function({value:A,done:i}){try{if(B(),i)return h||function(){const A=FA(l);s&&A.length!==s&&G("reported HTTP length is different from actual");try{I.source=A,h=new pd(I),c.resolve(h)}catch(A){c.reject(A)}l=[]}(),void(a=null);u+=A.byteLength,E.isStreamingSupported||C.send("DocProgress",{loaded:u,total:Math.max(u,E.contentLength||0)}),h?h.sendProgressiveData(A):l.push(A),E.read().then(t,e)}catch(A){e(A)}};E.read().then(t,e)})).catch((function(A){c.reject(A),a=null})),a=function(A){Q.cancelAllRequests(A)},c.promise}(A).then((function(A){if(i)throw A.terminate(new T("Worker was terminated.")),new Error("Worker was terminated");t=A,t.requestLoadedStream(!0).then((A=>{C.send("DataLoaded",{length:A.bytes.byteLength})}))})).then(n,s)}(A),A=null})),c}static initializeFromPort(A){const e=new wd("worker","main",A);Sd.setup(e,A),e.send("ready",null)}}var Rd;"undefined"==typeof window&&!t&&"undefined"!=typeof self&&"function"==typeof(Rd=self).postMessage&&"onmessage"in Rd&&Sd.initializeFromPort(self);var Gd={}.false;export{Gd as WorkerMessageHandler}; \ No newline at end of file +var A={d:(e,t)=>{for(var i in t)A.o(t,i)&&!A.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},o:(A,e)=>Object.prototype.hasOwnProperty.call(A,e)},e=globalThis.pdfjsWorker={};A.d(e,{WorkerMessageHandler:()=>wd});const t=!("object"!=typeof process||process+""!="[object process]"||process.versions.nw||process.versions.electron&&process.type&&"browser"!==process.type),i=[1,0,0,1,0,0],a=[.001,0,0,.001,0,0],s=1.35,n=.25925925925925924,g="pdfjs_internal_editor_",r={PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048},o="Group",I=8192,c=65536,C={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"},B={WC:"WillClose",WS:"WillSave",DS:"DidSave",WP:"WillPrint",DP:"DidPrint"},h={O:"PageOpen",C:"PageClose"},Q=10,l=11,E=12,u=37,d=44,f=58,p=59,m=70,y=71,w=83,D=85;let b=1;function k(){return b}function F(A){b>=5&&console.log(`Info: ${A}`)}function S(A){b>=1&&console.log(`Warning: ${A}`)}function R(A){throw new Error(A)}function G(A,e){A||R(e)}function N(A,e=null,t=null){if(!A)return null;try{if(t&&"string"==typeof A){if(t.addDefaultProtocol&&A.startsWith("www.")){const e=A.match(/\./g);e?.length>=2&&(A=`http://${A}`)}if(t.tryConvertEncoding)try{A=z(A)}catch{}}const i=e?new URL(A,e):new URL(A);if(function(A){switch(A?.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":return!0;default:return!1}}(i))return i}catch{}return null}function x(A,e,t,i=!1){return Object.defineProperty(A,e,{value:t,enumerable:!i,configurable:!0,writable:!1}),t}const U=function(){function A(A,e){this.message=A,this.name=e}return A.prototype=new Error,A.constructor=A,A}();class M extends U{constructor(A,e){super(A,"PasswordException"),this.code=e}}class L extends U{constructor(A,e){super(A,"UnknownErrorException"),this.details=e}}class J extends U{constructor(A){super(A,"InvalidPDFException")}}class H extends U{constructor(A){super(A,"MissingPDFException")}}class Y extends U{constructor(A,e){super(A,"UnexpectedResponseException"),this.status=e}}class v extends U{constructor(A){super(A,"FormatError")}}class K extends U{constructor(A){super(A,"AbortException")}}function q(A){"object"==typeof A&&void 0!==A?.length||R("Invalid argument for bytesToString");const e=A.length,t=8192;if(e>24&255,A>>16&255,A>>8&255,255&A)}function W(A){return Object.keys(A).length}class Z{static get isLittleEndian(){return x(this,"isLittleEndian",function(){const A=new Uint8Array(4);return A[0]=1,1===new Uint32Array(A.buffer,0,1)[0]}())}static get isEvalSupported(){return x(this,"isEvalSupported",function(){try{return new Function(""),!0}catch{return!1}}())}static get isOffscreenCanvasSupported(){return x(this,"isOffscreenCanvasSupported","undefined"!=typeof OffscreenCanvas)}static get platform(){return"undefined"!=typeof navigator&&"string"==typeof navigator?.platform?x(this,"platform",{isMac:navigator.platform.includes("Mac")}):x(this,"platform",{isMac:!1})}static get isCSSRoundSupported(){return x(this,"isCSSRoundSupported",globalThis.CSS?.supports?.("width: round(1.5px, 1px)"))}}const O=Array.from(Array(256).keys(),(A=>A.toString(16).padStart(2,"0")));class X{static makeHexColor(A,e,t){return`#${O[A]}${O[e]}${O[t]}`}static scaleMinMax(A,e){let t;A[0]?(A[0]<0&&(t=e[0],e[0]=e[2],e[2]=t),e[0]*=A[0],e[2]*=A[0],A[3]<0&&(t=e[1],e[1]=e[3],e[3]=t),e[1]*=A[3],e[3]*=A[3]):(t=e[0],e[0]=e[1],e[1]=t,t=e[2],e[2]=e[3],e[3]=t,A[1]<0&&(t=e[1],e[1]=e[3],e[3]=t),e[1]*=A[1],e[3]*=A[1],A[2]<0&&(t=e[0],e[0]=e[2],e[2]=t),e[0]*=A[2],e[2]*=A[2]),e[0]+=A[4],e[1]+=A[5],e[2]+=A[4],e[3]+=A[5]}static transform(A,e){return[A[0]*e[0]+A[2]*e[1],A[1]*e[0]+A[3]*e[1],A[0]*e[2]+A[2]*e[3],A[1]*e[2]+A[3]*e[3],A[0]*e[4]+A[2]*e[5]+A[4],A[1]*e[4]+A[3]*e[5]+A[5]]}static applyTransform(A,e){return[A[0]*e[0]+A[1]*e[2]+e[4],A[0]*e[1]+A[1]*e[3]+e[5]]}static applyInverseTransform(A,e){const t=e[0]*e[3]-e[1]*e[2];return[(A[0]*e[3]-A[1]*e[2]+e[2]*e[5]-e[4]*e[3])/t,(-A[0]*e[1]+A[1]*e[0]+e[4]*e[1]-e[5]*e[0])/t]}static getAxialAlignedBoundingBox(A,e){const t=this.applyTransform(A,e),i=this.applyTransform(A.slice(2,4),e),a=this.applyTransform([A[0],A[3]],e),s=this.applyTransform([A[2],A[1]],e);return[Math.min(t[0],i[0],a[0],s[0]),Math.min(t[1],i[1],a[1],s[1]),Math.max(t[0],i[0],a[0],s[0]),Math.max(t[1],i[1],a[1],s[1])]}static inverseTransform(A){const e=A[0]*A[3]-A[1]*A[2];return[A[3]/e,-A[1]/e,-A[2]/e,A[0]/e,(A[2]*A[5]-A[4]*A[3])/e,(A[4]*A[1]-A[5]*A[0])/e]}static singularValueDecompose2dScale(A){const e=[A[0],A[2],A[1],A[3]],t=A[0]*e[0]+A[1]*e[2],i=A[0]*e[1]+A[1]*e[3],a=A[2]*e[0]+A[3]*e[2],s=A[2]*e[1]+A[3]*e[3],n=(t+s)/2,g=Math.sqrt((t+s)**2-4*(t*s-a*i))/2,r=n+g||1,o=n-g||1;return[Math.sqrt(r),Math.sqrt(o)]}static normalizeRect(A){const e=A.slice(0);return A[0]>A[2]&&(e[0]=A[2],e[2]=A[0]),A[1]>A[3]&&(e[1]=A[3],e[3]=A[1]),e}static intersect(A,e){const t=Math.max(Math.min(A[0],A[2]),Math.min(e[0],e[2])),i=Math.min(Math.max(A[0],A[2]),Math.max(e[0],e[2]));if(t>i)return null;const a=Math.max(Math.min(A[1],A[3]),Math.min(e[1],e[3])),s=Math.min(Math.max(A[1],A[3]),Math.max(e[1],e[3]));return a>s?null:[t,a,i,s]}static#A(A,e,t,i,a,s,n,g,r,o){if(r<=0||r>=1)return;const I=1-r,c=r*r,C=c*r,B=I*(I*(I*A+3*r*e)+3*c*t)+C*i,h=I*(I*(I*a+3*r*s)+3*c*n)+C*g;o[0]=Math.min(o[0],B),o[1]=Math.min(o[1],h),o[2]=Math.max(o[2],B),o[3]=Math.max(o[3],h)}static#e(A,e,t,i,a,s,n,g,r,o,I,c){if(Math.abs(r)<1e-12)return void(Math.abs(o)>=1e-12&&this.#A(A,e,t,i,a,s,n,g,-I/o,c));const C=o**2-4*I*r;if(C<0)return;const B=Math.sqrt(C),h=2*r;this.#A(A,e,t,i,a,s,n,g,(-o+B)/h,c),this.#A(A,e,t,i,a,s,n,g,(-o-B)/h,c)}static bezierBoundingBox(A,e,t,i,a,s,n,g,r){return r?(r[0]=Math.min(r[0],A,n),r[1]=Math.min(r[1],e,g),r[2]=Math.max(r[2],A,n),r[3]=Math.max(r[3],e,g)):r=[Math.min(A,n),Math.min(e,g),Math.max(A,n),Math.max(e,g)],this.#e(A,t,a,n,e,i,s,g,3*(3*(t-a)-A+n),6*(A-2*t+a),3*(t-A),r),this.#e(A,t,a,n,e,i,s,g,3*(3*(i-s)-e+g),6*(e-2*i+s),3*(i-e),r),r}}const V=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,728,711,710,729,733,731,730,732,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8226,8224,8225,8230,8212,8211,402,8260,8249,8250,8722,8240,8222,8220,8221,8216,8217,8218,8482,64257,64258,321,338,352,376,381,305,322,339,353,382,0,8364];function j(A){if(A[0]>="ï"){let e;if("þ"===A[0]&&"ÿ"===A[1]?(e="utf-16be",A.length%2==1&&(A=A.slice(0,-1))):"ÿ"===A[0]&&"þ"===A[1]?(e="utf-16le",A.length%2==1&&(A=A.slice(0,-1))):"ï"===A[0]&&"»"===A[1]&&"¿"===A[2]&&(e="utf-8"),e)try{const t=new TextDecoder(e,{fatal:!0}),i=T(A),a=t.decode(i);return a.includes("")?a.replaceAll(/\x1b[^\x1b]*(?:\x1b|$)/g,""):a}catch(A){S(`stringToPDFString: "${A}".`)}}const e=[];for(let t=0,i=A.length;t{R("Should not call `set` on the empty dictionary.")},x(this,"empty",A)}static merge({xref:A,dictArray:e,mergeSubDicts:t=!1}){const i=new cA(A),a=new Map;for(const A of e)if(A instanceof cA)for(const[e,i]of Object.entries(A._map)){let A=a.get(e);if(void 0===A)A=[],a.set(e,A);else if(!(t&&i instanceof cA))continue;A.push(i)}for(const[e,t]of a){if(1===t.length||!(t[0]instanceof cA)){i._map[e]=t[0];continue}const a=new cA(A);for(const A of t)for(const[e,t]of Object.entries(A._map))void 0===a._map[e]&&(a._map[e]=t);a.size>0&&(i._map[e]=a)}return a.clear(),i.size>0?i:cA.empty}clone(){const A=new cA(this.xref);for(const e of this.getKeys())A.set(e,this.getRaw(e));return A}delete(A){delete this._map[A]}}class CA{constructor(A,e){this.num=A,this.gen=e}toString(){return 0===this.gen?`${this.num}R`:`${this.num}R${this.gen}`}static fromString(A){const e=gA[A];if(e)return e;const t=/^(\d+)R(\d*)$/.exec(A);return t&&"0"!==t[1]?gA[A]=new CA(parseInt(t[1]),t[2]?parseInt(t[2]):0):null}static get(A,e){const t=0===e?`${A}R`:`${A}R${e}`;return gA[t]||=new CA(A,e)}}class BA{constructor(A=null){this._set=new Set(A?._set)}has(A){return this._set.has(A.toString())}put(A){this._set.add(A.toString())}remove(A){this._set.delete(A.toString())}[Symbol.iterator](){return this._set.values()}clear(){this._set.clear()}}class hA{constructor(){this._map=new Map}get size(){return this._map.size}get(A){return this._map.get(A.toString())}has(A){return this._map.has(A.toString())}put(A,e){this._map.set(A.toString(),e)}putAlias(A,e){this._map.set(A.toString(),this.get(e))}[Symbol.iterator](){return this._map.values()}clear(){this._map.clear()}*items(){for(const[A,e]of this._map)yield[CA.fromString(A),e]}}function QA(A,e){return A instanceof rA&&(void 0===e||A.name===e)}function lA(A,e){return A instanceof oA&&(void 0===e||A.cmd===e)}function EA(A,e){return A instanceof cA&&(void 0===e||QA(A.get("Type"),e))}function uA(A,e){return A.num===e.num&&A.gen===e.gen}class dA{get length(){R("Abstract getter `length` accessed")}get isEmpty(){R("Abstract getter `isEmpty` accessed")}get isDataLoaded(){return x(this,"isDataLoaded",!0)}getByte(){R("Abstract method `getByte` called")}getBytes(A){R("Abstract method `getBytes` called")}async getImageData(A,e){return this.getBytes(A,e)}async asyncGetBytes(){R("Abstract method `asyncGetBytes` called")}get isAsync(){return!1}get canAsyncDecodeImageFromBuffer(){return!1}peekByte(){const A=this.getByte();return-1!==A&&this.pos--,A}peekBytes(A){const e=this.getBytes(A);return this.pos-=e.length,e}getUint16(){const A=this.getByte(),e=this.getByte();return-1===A||-1===e?-1:(A<<8)+e}getInt32(){return(this.getByte()<<24)+(this.getByte()<<16)+(this.getByte()<<8)+this.getByte()}getByteRange(A,e){R("Abstract method `getByteRange` called")}getString(A){return q(this.getBytes(A))}skip(A){this.pos+=A||1}reset(){R("Abstract method `reset` called")}moveStart(){R("Abstract method `moveStart` called")}makeSubStream(A,e,t=null){R("Abstract method `makeSubStream` called")}getBaseStreams(){return null}}const fA=/^[1-9]\.\d$/;function pA(A){let e;return function(){return A&&(e=Object.create(null),A(e),A=null),e}}class mA extends U{constructor(A,e){super(`Missing data [${A}, ${e})`,"MissingDataException"),this.begin=A,this.end=e}}class yA extends U{constructor(A){super(A,"ParserEOFException")}}class wA extends U{constructor(A){super(A,"XRefEntryException")}}class DA extends U{constructor(A){super(A,"XRefParseException")}}function bA(A){const e=A.length;if(0===e)return new Uint8Array(0);if(1===e)return new Uint8Array(A[0]);let t=0;for(let i=0;i0,"The number should be a positive integer.");const t=[];let i;for(;A>=1e3;)A-=1e3,t.push("M");i=A/100|0,A%=100,t.push(FA[i]),i=A/10|0,A%=10,t.push(FA[10+i]),t.push(FA[20+A]);const a=t.join("");return e?a.toLowerCase():a}function RA(A){return A<=0?0:Math.ceil(Math.log2(A))}function GA(A,e){return A[e]<<24>>24}function NA(A,e){return A[e]<<8|A[e+1]}function xA(A,e){return(A[e]<<24|A[e+1]<<16|A[e+2]<<8|A[e+3])>>>0}function UA(A){return 32===A||9===A||13===A||10===A}function MA(A,e){return Array.isArray(A)?(null===e||A.length===e)&&A.every((A=>"number"==typeof A)):ArrayBuffer.isView(A)&&(0===A.length||"number"==typeof A[0])&&(null===e||A.length===e)}function LA(A,e){return MA(A,6)?A:e}function JA(A,e){return MA(A,4)?A:e}function HA(A,e){return MA(A,4)?X.normalizeRect(A):e}function YA(A){const e=/(.+)\[(\d+)\]$/;return A.split(".").map((A=>{const t=A.match(e);return t?{name:t[1],pos:parseInt(t[2],10)}:{name:A,pos:0}}))}function vA(A){const e=[];let t=0;for(let i=0,a=A.length;i126||35===a||40===a||41===a||60===a||62===a||91===a||93===a||123===a||125===a||47===a||37===a)&&(t"\n"===A?"\\n":"\r"===A?"\\r":`\\${A}`))}function qA(A,e,t,i){if(!A)return;let a=null;if(A instanceof CA){if(i.has(A))return;a=A,i.put(a),A=e.fetch(A)}if(Array.isArray(A))for(const a of A)qA(a,e,t,i);else if(A instanceof cA){if(QA(A.get("S"),"JavaScript")){const e=A.get("JS");let i;e instanceof dA?i=e.getString():"string"==typeof e&&(i=e),i&&=j(i).replaceAll("\0",""),i&&t.push(i)}qA(A.getRaw("Next"),e,t,i)}a&&i.remove(a)}function TA(A,e,t){const i=Object.create(null),a=kA({dict:e,key:"AA",stopWhenFound:!1});if(a)for(let e=a.length-1;e>=0;e--){const s=a[e];if(s instanceof cA)for(const e of s.getKeys()){const a=t[e];if(!a)continue;const n=[];qA(s.getRaw(e),A,n,new BA),n.length>0&&(i[a]=n)}}if(e.has("A")){const t=[];qA(e.get("A"),A,t,new BA),t.length>0&&(i.Action=t)}return W(i)>0?i:null}const PA={60:"<",62:">",38:"&",34:""",39:"'"};function*WA(A){for(let e=0,t=A.length;e55295&&(t<57344||t>65533)&&e++,yield t}}function ZA(A){const e=[];let t=0;for(let i=0,a=A.length;i55295&&(a<57344||a>65533)&&i++,t=i+1}return 0===e.length?A:(t: ${A}.`),!1;return!0}function XA(A){const e=new Set(["100","200","300","400","500","600","700","800","900","1000","normal","bold","bolder","lighter"]),{fontFamily:t,fontWeight:i,italicAngle:a}=A;if(!OA(t,!0))return!1;const s=i?i.toString():"";A.fontWeight=e.has(s)?s:"400";const n=parseFloat(a);return A.italicAngle=isNaN(n)||n<-90||n>90?"14":a.toString(),!0}function VA(A){const e=new RegExp("^\\s*("+["app.launchURL","window.open","xfa.host.gotoURL"].join("|").replaceAll(".","\\.")+")\\((?:'|\")([^'\"]*)(?:'|\")(?:,\\s*(\\w+)\\)|\\))","i").exec(A);if(e?.[2]){const A=e[2];let t=!1;return"true"===e[3]&&"app.launchURL"===e[1]&&(t=!0),{url:A,newWindow:t}}return null}function jA(A){if(Number.isInteger(A))return A.toString();const e=Math.round(100*A);return e%100==0?(e/100).toString():e%10==0?A.toFixed(1):A.toFixed(2)}function zA(A){if(!A)return null;const e=new Map;for(const[t,i]of A){if(!t.startsWith(g))continue;let A=e.get(i.pageIndex);A||(A=[],e.set(i.pageIndex,A)),A.push(i)}return e.size>0?e:null}function _A(A){return function(A){return/^[\x00-\x7F]*$/.test(A)}(A)?A:Ae(A,!0)}function $A(A){const e=[];for(let t=0,i=A.length;t>8&255).toString(16).padStart(2,"0"),(255&i).toString(16).padStart(2,"0"))}return e.join("")}function Ae(A,e=!1){const t=[];e&&t.push("þÿ");for(let e=0,i=A.length;e>8&255),String.fromCharCode(255&i))}return t.join("")}function ee(A,e,t){switch(A){case 90:return[0,1,-1,0,e,0];case 180:return[-1,0,0,-1,e,t];case 270:return[0,-1,1,0,0,t];default:throw new Error("Invalid rotation")}}function te(A){return Math.ceil(Math.ceil(Math.log2(1+A))/8)}class ie extends dA{constructor(A,e,t,i){super(),this.bytes=A instanceof Uint8Array?A:new Uint8Array(A),this.start=e||0,this.pos=this.start,this.end=e+t||this.bytes.length,this.dict=i}get length(){return this.end-this.start}get isEmpty(){return 0===this.length}getByte(){return this.pos>=this.end?-1:this.bytes[this.pos++]}getBytes(A){const e=this.bytes,t=this.pos,i=this.end;if(!A)return e.subarray(t,i);let a=t+A;return a>i&&(a=i),this.pos=a,e.subarray(t,a)}getByteRange(A,e){return A<0&&(A=0),e>this.end&&(e=this.end),this.bytes.subarray(A,e)}reset(){this.pos=this.start}moveStart(){this.start=this.pos}makeSubStream(A,e,t=null){return new ie(this.bytes.buffer,A,e,t)}}class ae extends ie{constructor(A){super(T(A))}}class se extends ie{constructor(){super(new Uint8Array(0))}}class ne extends ie{constructor(A,e,t){super(new Uint8Array(A),0,A,null),this.chunkSize=e,this._loadedChunks=new Set,this.numChunks=Math.ceil(A/e),this.manager=t,this.progressiveDataLength=0,this.lastSuccessfulEnsureByteChunk=-1}getMissingChunks(){const A=[];for(let e=0,t=this.numChunks;e=this.end?this.numChunks:Math.floor(e/this.chunkSize);for(let A=t;Athis.numChunks)&&e!==this.lastSuccessfulEnsureByteChunk){if(!this._loadedChunks.has(e))throw new mA(A,A+1);this.lastSuccessfulEnsureByteChunk=e}}ensureRange(A,e){if(A>=e)return;if(e<=this.progressiveDataLength)return;const t=Math.floor(A/this.chunkSize);if(t>this.numChunks)return;const i=Math.min(Math.floor((e-1)/this.chunkSize)+1,this.numChunks);for(let a=t;a=this.end?-1:(A>=this.progressiveDataLength&&this.ensureByte(A),this.bytes[this.pos++])}getBytes(A){const e=this.bytes,t=this.pos,i=this.end;if(!A)return i>this.progressiveDataLength&&this.ensureRange(t,i),e.subarray(t,i);let a=t+A;return a>i&&(a=i),a>this.progressiveDataLength&&this.ensureRange(t,a),this.pos=a,e.subarray(t,a)}getByteRange(A,e){return A<0&&(A=0),e>this.end&&(e=this.end),e>this.progressiveDataLength&&this.ensureRange(A,e),this.bytes.subarray(A,e)}makeSubStream(A,e,t=null){function i(){}e?A+e>this.progressiveDataLength&&this.ensureRange(A,A+e):A>=this.progressiveDataLength&&this.ensureByte(A),i.prototype=Object.create(this),i.prototype.getMissingChunks=function(){const A=this.chunkSize,e=Math.floor(this.start/A),t=Math.floor((this.end-1)/A)+1,i=[];for(let A=e;A{const s=({value:n,done:g})=>{try{if(g){const e=bA(i);return i=null,void A(e)}a+=n.byteLength,t.isStreamingSupported&&this.onProgress({loaded:a}),i.push(n),t.read().then(s,e)}catch(A){e(A)}};t.read().then(s,e)})).then((e=>{this.aborted||this.onReceiveData({chunk:e,begin:A})}))}requestAllChunks(A=!1){if(!A){const A=this.stream.getMissingChunks();this._requestChunks(A)}return this._loadedStreamCapability.promise}_requestChunks(A){const e=this.currRequestId++,t=new Set;this._chunksNeededByRequest.set(e,t);for(const e of A)this.stream.hasChunk(e)||t.add(e);if(0===t.size)return Promise.resolve();const i=Promise.withResolvers();this._promisesByRequest.set(e,i);const a=[];for(const A of t){let t=this._requestsByChunk.get(A);t||(t=[],this._requestsByChunk.set(A,t),a.push(A)),t.push(e)}if(a.length>0){const A=this.groupChunks(a);for(const e of A){const A=e.beginChunk*this.chunkSize,t=Math.min(e.endChunk*this.chunkSize,this.length);this.sendRequest(A,t).catch(i.reject)}}return i.promise.catch((A=>{if(!this.aborted)throw A}))}getStream(){return this.stream}requestRange(A,e){e=Math.min(e,this.length);const t=this.getBeginChunk(A),i=this.getEndChunk(e),a=[];for(let A=t;A=0&&i+1!==s&&(e.push({beginChunk:t,endChunk:i+1}),t=s),a+1===A.length&&e.push({beginChunk:t,endChunk:s+1}),i=s}return e}onProgress(A){this.msgHandler.send("DocProgress",{loaded:this.stream.numChunksLoaded*this.chunkSize+A.loaded,total:this.length})}onReceiveData(A){const e=A.chunk,t=void 0===A.begin,i=t?this.progressiveDataLength:A.begin,a=i+e.byteLength,s=Math.floor(i/this.chunkSize),n=a0||g.push(t)}}}if(!this.disableAutoFetch&&0===this._requestsByChunk.size){let A;if(1===this.stream.numChunksLoaded){const e=this.stream.numChunks-1;this.stream.hasChunk(e)||(A=e)}else A=this.stream.nextEmptyChunk(n);Number.isInteger(A)&&this._requestChunks([A])}for(const A of g){const e=this._promisesByRequest.get(A);this._promisesByRequest.delete(A),e.resolve()}this.msgHandler.send("DocProgress",{loaded:this.stream.numChunksLoaded*this.chunkSize,total:this.length})}onError(A){this._loadedStreamCapability.reject(A)}getBeginChunk(A){return Math.floor(A/this.chunkSize)}getEndChunk(A){return Math.floor((A-1)/this.chunkSize)+1}abort(A){this.aborted=!0,this.pdfNetworkStream?.cancelAllRequests(A);for(const e of this._promisesByRequest.values())e.reject(A)}}class re{constructor(A,e){this.name=A,this.numComps=e}getRgb(A,e){const t=new Uint8ClampedArray(3);return this.getRgbItem(A,e,t,0),t}getRgbItem(A,e,t,i){R("Should not call ColorSpace.getRgbItem")}getRgbBuffer(A,e,t,i,a,s,n){R("Should not call ColorSpace.getRgbBuffer")}getOutputLength(A,e){R("Should not call ColorSpace.getOutputLength")}isPassthrough(A){return!1}isDefaultDecode(A,e){return re.isDefaultDecode(A,this.numComps)}fillRgb(A,e,t,i,a,s,n,g,r){const o=e*t;let I=null;const c=1<c&&"DeviceGray"!==this.name&&"DeviceRGB"!==this.name){const e=n<=8?new Uint8Array(c):new Uint16Array(c);for(let A=0;A=.99554525?1:this.#Q(0,1,1.055*A**(1/2.4)-.055)}#Q(A,e,t){return Math.max(A,Math.min(e,t))}#l(A){return A<0?-this.#l(-A):A>8?((A+16)/116)**3:A*Ee.#I}#E(A,e,t){if(0===A[0]&&0===A[1]&&0===A[2])return t[0]=e[0],t[1]=e[1],void(t[2]=e[2]);const i=this.#l(0),a=(1-i)/(1-this.#l(A[0])),s=1-a,n=(1-i)/(1-this.#l(A[1])),g=1-n,r=(1-i)/(1-this.#l(A[2])),o=1-r;t[0]=e[0]*a+s,t[1]=e[1]*n+g,t[2]=e[2]*r+o}#u(A,e,t){if(1===A[0]&&1===A[2])return t[0]=e[0],t[1]=e[1],void(t[2]=e[2]);const i=t;this.#c(Ee.#i,e,i);const a=Ee.#g;this.#C(A,i,a),this.#c(Ee.#a,a,t)}#d(A,e,t){const i=t;this.#c(Ee.#i,e,i);const a=Ee.#g;this.#B(A,i,a),this.#c(Ee.#a,a,t)}#t(A,e,t,i,a){const s=this.#Q(0,1,A[e]*a),n=this.#Q(0,1,A[e+1]*a),g=this.#Q(0,1,A[e+2]*a),r=1===s?1:s**this.GR,o=1===n?1:n**this.GG,I=1===g?1:g**this.GB,c=this.MXA*r+this.MXB*o+this.MXC*I,C=this.MYA*r+this.MYB*o+this.MYC*I,B=this.MZA*r+this.MZB*o+this.MZC*I,h=Ee.#r;h[0]=c,h[1]=C,h[2]=B;const Q=Ee.#o;this.#u(this.whitePoint,h,Q);const l=Ee.#r;this.#E(this.blackPoint,Q,l);const E=Ee.#o;this.#d(Ee.#n,l,E);const u=Ee.#r;this.#c(Ee.#s,E,u),t[i]=255*this.#h(u[0]),t[i+1]=255*this.#h(u[1]),t[i+2]=255*this.#h(u[2])}getRgbItem(A,e,t,i){this.#t(A,e,t,i,1)}getRgbBuffer(A,e,t,i,a,s,n){const g=1/((1<this.amax||this.bmin>this.bmax)&&(F("Invalid Range, falling back to defaults"),this.amin=-100,this.amax=100,this.bmin=-100,this.bmax=100)}#f(A){return A>=6/29?A**3:108/841*(A-4/29)}#p(A,e,t,i){return t+A*(i-t)/e}#t(A,e,t,i,a){let s=A[e],n=A[e+1],g=A[e+2];!1!==t&&(s=this.#p(s,t,0,100),n=this.#p(n,t,this.amin,this.amax),g=this.#p(g,t,this.bmin,this.bmax)),n>this.amax?n=this.amax:nthis.bmax?g=this.bmax:g>>0}function fe(A,e){return 1===e?String.fromCharCode(A[0],A[1]):3===e?String.fromCharCode(A[0],A[1],A[2],A[3]):String.fromCharCode(...A.subarray(0,e+1))}function pe(A,e,t){let i=0;for(let a=t;a>=0;a--)i+=A[a]+e[a],A[a]=255&i,i>>=8}function me(A,e){let t=1;for(let i=e;i>=0&&t>0;i--)t+=A[i],A[i]=255&t,t>>=8}const ye=16;class we{constructor(A){this.buffer=A,this.pos=0,this.end=A.length,this.tmpBuf=new Uint8Array(19)}readByte(){return this.pos>=this.end?-1:this.buffer[this.pos++]}readNumber(){let A,e=0;do{const t=this.readByte();if(t<0)throw new v("unexpected EOF in bcmap");A=!(128&t),e=e<<7|127&t}while(!A);return e}readSigned(){const A=this.readNumber();return 1&A?~(A>>>1):A>>>1}readHex(A,e){A.set(this.buffer.subarray(this.pos,this.pos+e+1)),this.pos+=e+1}readHexNumber(A,e){let t;const i=this.tmpBuf;let a=0;do{const A=this.readByte();if(A<0)throw new v("unexpected EOF in bcmap");t=!(128&A),i[a++]=127&A}while(!t);let s=e,n=0,g=0;for(;s>=0;){for(;g<8&&i.length>0;)n|=i[--a]<>=8,g-=8}}readHexSigned(A,e){this.readHexNumber(A,e);const t=1&A[e]?255:0;let i=0;for(let a=0;a<=e;a++)i=(1&i)<<8|A[a],A[a]=i>>1^t}readString(){const A=this.readNumber(),e=new Array(A);for(let t=0;t=0;){const A=C>>5;if(7===A){switch(31&C){case 0:i.readString();break;case 1:s=i.readString()}continue}const t=!!(16&C),a=15&C;if(a+1>ye)throw new Error("BinaryCMapReader.process: Invalid dataSize.");const B=1,h=i.readNumber();switch(A){case 0:i.readHex(n,a),i.readHexNumber(g,a),pe(g,n,a),e.addCodespaceRange(a+1,de(n,a),de(g,a));for(let A=1;Aa&&(i=a)}else{for(;!this.eof;)this.readBlock(e);i=this.bufferLength}return this.pos=i,this.buffer.subarray(t,i)}async getImageData(A,e=null){if(!this.canAsyncDecodeImageFromBuffer)return this.getBytes(A,e);const t=await this.stream.asyncGetBytes();return this.decodeImage(t,e)}reset(){this.pos=0}makeSubStream(A,e,t=null){if(void 0===e)for(;!this.eof;)this.readBlock();else{const t=A+e;for(;this.bufferLength<=t&&!this.eof;)this.readBlock()}return new ie(this.buffer,A,e,t)}getBaseStreams(){return this.str?this.str.getBaseStreams():null}}class Fe extends ke{constructor(A,e=null){let t=0;for(const e of A)t+=e instanceof ke?e._rawMinBufferLength:e.length;super(t),this.streams=A,this._onError=e}readBlock(){const A=this.streams;if(0===A.length)return void(this.eof=!0);const e=A.shift();let t;try{t=e.getBytes()}catch(A){if(this._onError)return void this._onError(A,e.dict?.objId);throw A}const i=this.bufferLength,a=i+t.length;this.ensureBuffer(a).set(t,i),this.bufferLength=a}getBaseStreams(){const A=[];for(const e of this.streams){const t=e.getBaseStreams();t&&A.push(...t)}return A.length>0?A:null}}class Se extends ke{constructor(A,e){e&&(e*=.8),super(e),this.str=A,this.dict=A.dict,this.input=new Uint8Array(5)}readBlock(){const A=this.str;let e=A.getByte();for(;UA(e);)e=A.getByte();if(-1===e||126===e)return void(this.eof=!0);const t=this.bufferLength;let i,a;if(122===e){for(i=this.ensureBuffer(t+4),a=0;a<4;++a)i[t+a]=0;this.bufferLength+=4}else{const s=this.input;for(s[0]=e,a=1;a<5;++a){for(e=A.getByte();UA(e);)e=A.getByte();if(s[a]=e,-1===e||126===e)break}if(i=this.ensureBuffer(t+a-1),this.bufferLength+=a-1,a<5){for(;a<5;++a)s[a]=117;this.eof=!0}let n=0;for(a=0;a<5;++a)n=85*n+(s[a]-33);for(a=3;a>=0;--a)i[t+a]=255&n,n>>=8}}}class Re extends ke{constructor(A,e){e&&(e*=.5),super(e),this.str=A,this.dict=A.dict,this.firstDigit=-1}readBlock(){const A=this.str.getBytes(8e3);if(!A.length)return void(this.eof=!0);const e=A.length+1>>1,t=this.ensureBuffer(this.bufferLength+e);let i=this.bufferLength,a=this.firstDigit;for(const e of A){let A;if(e>=48&&e<=57)A=15&e;else{if(!(e>=65&&e<=70||e>=97&&e<=102)){if(62===e){this.eof=!0;break}continue}A=9+(15&e)}a<0?a=A:(t[i++]=a<<4|A,a=-1)}a>=0&&this.eof&&(t[i++]=a<<4,a=-1),this.firstDigit=a,this.bufferLength=i}}const Ge=-1,Ne=[[-1,-1],[-1,-1],[7,8],[7,7],[6,6],[6,6],[6,5],[6,5],[4,0],[4,0],[4,0],[4,0],[4,0],[4,0],[4,0],[4,0],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,3],[3,3],[3,3],[3,3],[3,3],[3,3],[3,3],[3,3],[3,3],[3,3],[3,3],[3,3],[3,3],[3,3],[3,3],[3,3],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2]],xe=[[-1,-1],[12,-2],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[11,1792],[11,1792],[12,1984],[12,2048],[12,2112],[12,2176],[12,2240],[12,2304],[11,1856],[11,1856],[11,1920],[11,1920],[12,2368],[12,2432],[12,2496],[12,2560]],Ue=[[-1,-1],[-1,-1],[-1,-1],[-1,-1],[8,29],[8,29],[8,30],[8,30],[8,45],[8,45],[8,46],[8,46],[7,22],[7,22],[7,22],[7,22],[7,23],[7,23],[7,23],[7,23],[8,47],[8,47],[8,48],[8,48],[6,13],[6,13],[6,13],[6,13],[6,13],[6,13],[6,13],[6,13],[7,20],[7,20],[7,20],[7,20],[8,33],[8,33],[8,34],[8,34],[8,35],[8,35],[8,36],[8,36],[8,37],[8,37],[8,38],[8,38],[7,19],[7,19],[7,19],[7,19],[8,31],[8,31],[8,32],[8,32],[6,1],[6,1],[6,1],[6,1],[6,1],[6,1],[6,1],[6,1],[6,12],[6,12],[6,12],[6,12],[6,12],[6,12],[6,12],[6,12],[8,53],[8,53],[8,54],[8,54],[7,26],[7,26],[7,26],[7,26],[8,39],[8,39],[8,40],[8,40],[8,41],[8,41],[8,42],[8,42],[8,43],[8,43],[8,44],[8,44],[7,21],[7,21],[7,21],[7,21],[7,28],[7,28],[7,28],[7,28],[8,61],[8,61],[8,62],[8,62],[8,63],[8,63],[8,0],[8,0],[8,320],[8,320],[8,384],[8,384],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[7,27],[7,27],[7,27],[7,27],[8,59],[8,59],[8,60],[8,60],[9,1472],[9,1536],[9,1600],[9,1728],[7,18],[7,18],[7,18],[7,18],[7,24],[7,24],[7,24],[7,24],[8,49],[8,49],[8,50],[8,50],[8,51],[8,51],[8,52],[8,52],[7,25],[7,25],[7,25],[7,25],[8,55],[8,55],[8,56],[8,56],[8,57],[8,57],[8,58],[8,58],[6,192],[6,192],[6,192],[6,192],[6,192],[6,192],[6,192],[6,192],[6,1664],[6,1664],[6,1664],[6,1664],[6,1664],[6,1664],[6,1664],[6,1664],[8,448],[8,448],[8,512],[8,512],[9,704],[9,768],[8,640],[8,640],[8,576],[8,576],[9,832],[9,896],[9,960],[9,1024],[9,1088],[9,1152],[9,1216],[9,1280],[9,1344],[9,1408],[7,256],[7,256],[7,256],[7,256],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[6,16],[6,16],[6,16],[6,16],[6,16],[6,16],[6,16],[6,16],[6,17],[6,17],[6,17],[6,17],[6,17],[6,17],[6,17],[6,17],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[6,14],[6,14],[6,14],[6,14],[6,14],[6,14],[6,14],[6,14],[6,15],[6,15],[6,15],[6,15],[6,15],[6,15],[6,15],[6,15],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7]],Me=[[-1,-1],[-1,-1],[12,-2],[12,-2],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[11,1792],[11,1792],[11,1792],[11,1792],[12,1984],[12,1984],[12,2048],[12,2048],[12,2112],[12,2112],[12,2176],[12,2176],[12,2240],[12,2240],[12,2304],[12,2304],[11,1856],[11,1856],[11,1856],[11,1856],[11,1920],[11,1920],[11,1920],[11,1920],[12,2368],[12,2368],[12,2432],[12,2432],[12,2496],[12,2496],[12,2560],[12,2560],[10,18],[10,18],[10,18],[10,18],[10,18],[10,18],[10,18],[10,18],[12,52],[12,52],[13,640],[13,704],[13,768],[13,832],[12,55],[12,55],[12,56],[12,56],[13,1280],[13,1344],[13,1408],[13,1472],[12,59],[12,59],[12,60],[12,60],[13,1536],[13,1600],[11,24],[11,24],[11,24],[11,24],[11,25],[11,25],[11,25],[11,25],[13,1664],[13,1728],[12,320],[12,320],[12,384],[12,384],[12,448],[12,448],[13,512],[13,576],[12,53],[12,53],[12,54],[12,54],[13,896],[13,960],[13,1024],[13,1088],[13,1152],[13,1216],[10,64],[10,64],[10,64],[10,64],[10,64],[10,64],[10,64],[10,64]],Le=[[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[11,23],[11,23],[12,50],[12,51],[12,44],[12,45],[12,46],[12,47],[12,57],[12,58],[12,61],[12,256],[10,16],[10,16],[10,16],[10,16],[10,17],[10,17],[10,17],[10,17],[12,48],[12,49],[12,62],[12,63],[12,30],[12,31],[12,32],[12,33],[12,40],[12,41],[11,22],[11,22],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[9,15],[9,15],[9,15],[9,15],[9,15],[9,15],[9,15],[9,15],[12,128],[12,192],[12,26],[12,27],[12,28],[12,29],[11,19],[11,19],[11,20],[11,20],[12,34],[12,35],[12,36],[12,37],[12,38],[12,39],[11,21],[11,21],[12,42],[12,43],[10,0],[10,0],[10,0],[10,0],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12]],Je=[[-1,-1],[-1,-1],[-1,-1],[-1,-1],[6,9],[6,8],[5,7],[5,7],[4,6],[4,6],[4,6],[4,6],[4,5],[4,5],[4,5],[4,5],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2]];class He{constructor(A,e={}){if(!A||"function"!=typeof A.next)throw new Error('CCITTFaxDecoder - invalid "source" parameter.');let t;for(this.source=A,this.eof=!1,this.encoding=e.K||0,this.eoline=e.EndOfLine||!1,this.byteAlign=e.EncodedByteAlign||!1,this.columns=e.Columns||1728,this.rows=e.Rows||0,this.eoblock=e.EndOfBlock??!0,this.black=e.BlackIs1||!1,this.codingLine=new Uint32Array(this.columns+1),this.refLine=new Uint32Array(this.columns+2),this.codingLine[0]=this.columns,this.codingPos=0,this.row=0,this.nextLine2D=this.encoding<0,this.inputBits=0,this.inputBuf=0,this.outputBits=0,this.rowsDone=!1;0===(t=this._lookBits(12));)this._eatBits(1);1===t&&this._eatBits(12),this.encoding>0&&(this.nextLine2D=!this._lookBits(1),this._eatBits(1))}readNextChar(){if(this.eof)return-1;const A=this.refLine,e=this.codingLine,t=this.columns;let i,a,s,n,g;if(0===this.outputBits){if(this.rowsDone&&(this.eof=!0),this.eof)return-1;let s,g,r;if(this.err=!1,this.nextLine2D){for(n=0;e[n]=64);do{g+=r=this._getWhiteCode()}while(r>=64)}else{do{s+=r=this._getWhiteCode()}while(r>=64);do{g+=r=this._getBlackCode()}while(r>=64)}for(this._addPixels(e[this.codingPos]+s,a),e[this.codingPos]0?--i:++i;A[i]<=e[this.codingPos]&&A[i]0?--i:++i;A[i]<=e[this.codingPos]&&A[i]0?--i:++i;A[i]<=e[this.codingPos]&&A[i]=64);else do{s+=r=this._getWhiteCode()}while(r>=64);this._addPixels(e[this.codingPos]+s,a),a^=1}let o=!1;if(this.byteAlign&&(this.inputBits&=-8),this.eoblock||this.row!==this.rows-1){if(s=this._lookBits(12),this.eoline)for(;s!==Ge&&1!==s;)this._eatBits(1),s=this._lookBits(12);else for(;0===s;)this._eatBits(1),s=this._lookBits(12);1===s?(this._eatBits(12),o=!0):s===Ge&&(this.eof=!0)}else this.rowsDone=!0;if(!this.eof&&this.encoding>0&&!this.rowsDone&&(this.nextLine2D=!this._lookBits(1),this._eatBits(1)),this.eoblock&&o&&this.byteAlign){if(s=this._lookBits(12),1===s){if(this._eatBits(12),this.encoding>0&&(this._lookBits(1),this._eatBits(1)),this.encoding>=0)for(n=0;n<4;++n)s=this._lookBits(12),1!==s&&F("bad rtc code: "+s),this._eatBits(12),this.encoding>0&&(this._lookBits(1),this._eatBits(1));this.eof=!0}}else if(this.err&&this.eoline){for(;;){if(s=this._lookBits(13),s===Ge)return this.eof=!0,-1;if(s>>1==1)break;this._eatBits(1)}this._eatBits(12),this.encoding>0&&(this._eatBits(1),this.nextLine2D=!(1&s))}this.outputBits=e[0]>0?e[this.codingPos=0]:e[this.codingPos=1],this.row++}if(this.outputBits>=8)g=1&this.codingPos?0:255,this.outputBits-=8,0===this.outputBits&&e[this.codingPos]s?(g<<=s,1&this.codingPos||(g|=255>>8-s),this.outputBits-=s,s=0):(g<<=this.outputBits,1&this.codingPos||(g|=255>>8-this.outputBits),s-=this.outputBits,this.outputBits=0,e[this.codingPos]0&&(g<<=s,s=0))}while(s)}return this.black&&(g^=255),g}_addPixels(A,e){const t=this.codingLine;let i=this.codingPos;A>t[i]&&(A>this.columns&&(F("row is wrong length"),this.err=!0,A=this.columns),1&i^e&&++i,t[i]=A),this.codingPos=i}_addPixelsNeg(A,e){const t=this.codingLine;let i=this.codingPos;if(A>t[i])A>this.columns&&(F("row is wrong length"),this.err=!0,A=this.columns),1&i^e&&++i,t[i]=A;else if(A0&&A=a){const e=t[A-a];if(e[0]===i)return this._eatBits(i),[!0,e[1],!0]}}return[!1,0,!1]}_getTwoDimCode(){let A,e=0;if(this.eoblock){if(e=this._lookBits(7),A=Ne[e],A?.[0]>0)return this._eatBits(A[0]),A[1]}else{const A=this._findTableCode(1,7,Ne);if(A[0]&&A[2])return A[1]}return F("Bad two dim code"),Ge}_getWhiteCode(){let A,e=0;if(this.eoblock){if(e=this._lookBits(12),e===Ge)return 1;if(A=e>>5?Ue[e>>3]:xe[e],A[0]>0)return this._eatBits(A[0]),A[1]}else{let A=this._findTableCode(1,9,Ue);if(A[0])return A[1];if(A=this._findTableCode(11,12,xe),A[0])return A[1]}return F("bad white code"),this._eatBits(1),1}_getBlackCode(){let A,e;if(this.eoblock){if(A=this._lookBits(13),A===Ge)return 1;if(e=A>>7?!(A>>9)&&A>>7?Le[(A>>1)-64]:Je[A>>7]:Me[A],e[0]>0)return this._eatBits(e[0]),e[1]}else{let A=this._findTableCode(2,6,Je);if(A[0])return A[1];if(A=this._findTableCode(7,12,Le,64),A[0])return A[1];if(A=this._findTableCode(10,13,Me),A[0])return A[1]}return F("bad black code"),this._eatBits(1),1}_lookBits(A){let e;for(;this.inputBits>16-A;this.inputBuf=this.inputBuf<<8|e,this.inputBits+=8}return this.inputBuf>>this.inputBits-A&65535>>16-A}_eatBits(A){(this.inputBits-=A)<0&&(this.inputBits=0)}}class Ye extends ke{constructor(A,e,t){super(e),this.str=A,this.dict=A.dict,t instanceof cA||(t=cA.empty);const i={next:()=>A.getByte()};this.ccittFaxDecoder=new He(i,{K:t.get("K"),EndOfLine:t.get("EndOfLine"),EncodedByteAlign:t.get("EncodedByteAlign"),Columns:t.get("Columns"),Rows:t.get("Rows"),EndOfBlock:t.get("EndOfBlock"),BlackIs1:t.get("BlackIs1")})}readBlock(){for(;!this.eof;){const A=this.ccittFaxDecoder.readNextChar();if(-1===A)return void(this.eof=!0);this.ensureBuffer(this.bufferLength+1),this.buffer[this.bufferLength++]=A}}}const ve=new Int32Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Ke=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]),qe=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]),Te=[new Int32Array([459008,524368,524304,524568,459024,524400,524336,590016,459016,524384,524320,589984,524288,524416,524352,590048,459012,524376,524312,589968,459028,524408,524344,590032,459020,524392,524328,59e4,524296,524424,524360,590064,459010,524372,524308,524572,459026,524404,524340,590024,459018,524388,524324,589992,524292,524420,524356,590056,459014,524380,524316,589976,459030,524412,524348,590040,459022,524396,524332,590008,524300,524428,524364,590072,459009,524370,524306,524570,459025,524402,524338,590020,459017,524386,524322,589988,524290,524418,524354,590052,459013,524378,524314,589972,459029,524410,524346,590036,459021,524394,524330,590004,524298,524426,524362,590068,459011,524374,524310,524574,459027,524406,524342,590028,459019,524390,524326,589996,524294,524422,524358,590060,459015,524382,524318,589980,459031,524414,524350,590044,459023,524398,524334,590012,524302,524430,524366,590076,459008,524369,524305,524569,459024,524401,524337,590018,459016,524385,524321,589986,524289,524417,524353,590050,459012,524377,524313,589970,459028,524409,524345,590034,459020,524393,524329,590002,524297,524425,524361,590066,459010,524373,524309,524573,459026,524405,524341,590026,459018,524389,524325,589994,524293,524421,524357,590058,459014,524381,524317,589978,459030,524413,524349,590042,459022,524397,524333,590010,524301,524429,524365,590074,459009,524371,524307,524571,459025,524403,524339,590022,459017,524387,524323,589990,524291,524419,524355,590054,459013,524379,524315,589974,459029,524411,524347,590038,459021,524395,524331,590006,524299,524427,524363,590070,459011,524375,524311,524575,459027,524407,524343,590030,459019,524391,524327,589998,524295,524423,524359,590062,459015,524383,524319,589982,459031,524415,524351,590046,459023,524399,524335,590014,524303,524431,524367,590078,459008,524368,524304,524568,459024,524400,524336,590017,459016,524384,524320,589985,524288,524416,524352,590049,459012,524376,524312,589969,459028,524408,524344,590033,459020,524392,524328,590001,524296,524424,524360,590065,459010,524372,524308,524572,459026,524404,524340,590025,459018,524388,524324,589993,524292,524420,524356,590057,459014,524380,524316,589977,459030,524412,524348,590041,459022,524396,524332,590009,524300,524428,524364,590073,459009,524370,524306,524570,459025,524402,524338,590021,459017,524386,524322,589989,524290,524418,524354,590053,459013,524378,524314,589973,459029,524410,524346,590037,459021,524394,524330,590005,524298,524426,524362,590069,459011,524374,524310,524574,459027,524406,524342,590029,459019,524390,524326,589997,524294,524422,524358,590061,459015,524382,524318,589981,459031,524414,524350,590045,459023,524398,524334,590013,524302,524430,524366,590077,459008,524369,524305,524569,459024,524401,524337,590019,459016,524385,524321,589987,524289,524417,524353,590051,459012,524377,524313,589971,459028,524409,524345,590035,459020,524393,524329,590003,524297,524425,524361,590067,459010,524373,524309,524573,459026,524405,524341,590027,459018,524389,524325,589995,524293,524421,524357,590059,459014,524381,524317,589979,459030,524413,524349,590043,459022,524397,524333,590011,524301,524429,524365,590075,459009,524371,524307,524571,459025,524403,524339,590023,459017,524387,524323,589991,524291,524419,524355,590055,459013,524379,524315,589975,459029,524411,524347,590039,459021,524395,524331,590007,524299,524427,524363,590071,459011,524375,524311,524575,459027,524407,524343,590031,459019,524391,524327,589999,524295,524423,524359,590063,459015,524383,524319,589983,459031,524415,524351,590047,459023,524399,524335,590015,524303,524431,524367,590079]),9],Pe=[new Int32Array([327680,327696,327688,327704,327684,327700,327692,327708,327682,327698,327690,327706,327686,327702,327694,0,327681,327697,327689,327705,327685,327701,327693,327709,327683,327699,327691,327707,327687,327703,327695,0]),5];class We extends ke{constructor(A,e){super(e),this.str=A,this.dict=A.dict;const t=A.getByte(),i=A.getByte();if(-1===t||-1===i)throw new v(`Invalid header in flate stream: ${t}, ${i}`);if(8!=(15&t))throw new v(`Unknown compression method in flate stream: ${t}, ${i}`);if(((t<<8)+i)%31!=0)throw new v(`Bad FCHECK in flate stream: ${t}, ${i}`);if(32&i)throw new v(`FDICT bit set in flate stream: ${t}, ${i}`);this.codeSize=0,this.codeBuf=0}async getImageData(A,e){const t=await this.asyncGetBytes();return t?.subarray(0,A)||this.getBytes(A)}async asyncGetBytes(){this.str.reset();const A=this.str.getBytes();try{const{readable:e,writable:t}=new DecompressionStream("deflate"),i=t.getWriter();i.write(A),i.close();const a=[];let s=0;for await(const A of e)a.push(A),s+=A.byteLength;const n=new Uint8Array(s);let g=0;for(const A of a)n.set(A,g),g+=A.byteLength;return n}catch{return this.str=new ie(A,2,A.length,this.str.dict),this.reset(),null}}get isAsync(){return!0}getBits(A){const e=this.str;let t,i=this.codeSize,a=this.codeBuf;for(;i>A,this.codeSize=i-=A,t}getCode(A){const e=this.str,t=A[0],i=A[1];let a,s=this.codeSize,n=this.codeBuf;for(;s>16,o=65535&g;if(r<1||s>r,this.codeSize=s-r,o}generateHuffmanTable(A){const e=A.length;let t,i=0;for(t=0;ti&&(i=A[t]);const a=1<>=1;for(t=A;t>=1,0===e){let e;if(-1===(e=i.getByte()))return void this.#m("Bad block header in flate stream");let t=e;if(-1===(e=i.getByte()))return void this.#m("Bad block header in flate stream");if(t|=e<<8,-1===(e=i.getByte()))return void this.#m("Bad block header in flate stream");let a=e;if(-1===(e=i.getByte()))return void this.#m("Bad block header in flate stream");if(a|=e<<8,a!==(65535&~t)&&(0!==t||0!==a))throw new v("Bad uncompressed block length in flate stream");this.codeBuf=0,this.codeSize=0;const s=this.bufferLength,n=s+t;if(A=this.ensureBuffer(n),this.bufferLength=n,0===t)-1===i.peekByte()&&(this.eof=!0);else{const e=i.getBytes(t);A.set(e,s),e.length0;)I[g++]=B}a=this.generateHuffmanTable(I.subarray(0,A)),s=this.generateHuffmanTable(I.subarray(A,o))}}A=this.buffer;let n=A?A.length:0,g=this.bufferLength;for(;;){let e=this.getCode(a);if(e<256){g+1>=n&&(A=this.ensureBuffer(g+1),n=A.length),A[g++]=e;continue}if(256===e)return void(this.bufferLength=g);e-=257,e=Ke[e];let i=e>>16;i>0&&(i=this.getBits(i)),t=(65535&e)+i,e=this.getCode(s),e=qe[e],i=e>>16,i>0&&(i=this.getBits(i));const r=(65535&e)+i;g+t>=n&&(A=this.ensureBuffer(g+t),n=A.length);for(let e=0;e>9&127,this.clow=this.clow<<7&65535,this.ct-=7,this.a=32768}byteIn(){const A=this.data;let e=this.bp;255===A[e]?A[e+1]>143?(this.clow+=65280,this.ct=8):(e++,this.clow+=A[e]<<9,this.ct=7,this.bp=e):(e++,this.clow+=e65535&&(this.chigh+=this.clow>>16,this.clow&=65535)}readBit(A,e){let t=A[e]>>1,i=1&A[e];const a=Ze[t],s=a.qe;let n,g=this.a-s;if(this.chigh>15&1,this.clow=this.clow<<1&65535,this.ct--}while(!(32768&g));return this.a=g,A[e]=t<<1|i,n}}class Xe extends U{constructor(A){super(A,"Jbig2Error")}}class Ve{getContexts(A){return A in this?this[A]:this[A]=new Int8Array(65536)}}class je{constructor(A,e,t){this.data=A,this.start=e,this.end=t}get decoder(){return x(this,"decoder",new Oe(this.data,this.start,this.end))}get contextCache(){return x(this,"contextCache",new Ve)}}function ze(A,e,t){const i=A.getContexts(e);let a=1;function s(A){let e=0;for(let s=0;s>>0}const n=s(1),g=s(1)?s(1)?s(1)?s(1)?s(1)?s(32)+4436:s(12)+340:s(8)+84:s(6)+20:s(4)+4:s(2);let r;return 0===n?r=g:g>0&&(r=-g),r>=-2147483648&&r<=2147483647?r:null}function _e(A,e,t){const i=A.getContexts("IAID");let a=1;for(let A=0;A=w&&N=D)for(H=H<<1&l,Q=0;Q=0&&U=0&&(M=S[x][U],M&&(H|=M<=A?o<<=1:o=o<<1|p[g][r];for(B=0;B=d||r<0||r>=u?o<<=1:o=o<<1|i[g][r];const h=m.readBit(y,o);e[n]=h}}return p}function nt(A,e,t,i,a,s,n,g,r,o,I,c,C,B,h,Q,l,E,u){if(A&&e)throw new Xe("refinement with Huffman is not supported");const d=[];let f,p;for(f=0;f1&&(a=A?u.readBits(E):ze(y,"IAIT",m));const s=n*w+a,D=A?B.symbolIDTable.decode(u):_e(y,m,r),b=e&&(A?u.readBit():ze(y,"IARI",m));let k=g[D],F=k[0].length,S=k.length;if(b){const A=ze(y,"IARDW",m),e=ze(y,"IARDH",m);F+=A,S+=e,k=st(F,S,h,k,(A>>1)+ze(y,"IARDX",m),(e>>1)+ze(y,"IARDY",m),!1,Q,l)}let R=0;o?1&c?R=S-1:i+=S-1:c>1?i+=F-1:R=F-1;const G=s-(1&c?0:S-1),N=i-(2&c?F-1:0);let x,U,M;if(o)for(x=0;x>5&7;const r=[31&n];let o=e+6;if(7===n){g=536870911&xA(A,o-1),o+=3;let e=g+7>>3;for(r[0]=A[o++];--e>0;)r.push(A[o++])}else if(5===n||6===n)throw new Xe("invalid referred-to flags");t.retainBits=r;let I=4;t.number<=256?I=1:t.number<=65536&&(I=2);const c=[];let C,B;for(C=0;C>>24&255,s[3]=e.height>>16&255,s[4]=e.height>>8&255,s[5]=255&e.height,C=o,B=A.length;C>2&3,A.huffmanDWSelector=e>>4&3,A.bitmapSizeSelector=e>>6&1,A.aggregationInstancesSelector=e>>7&1,A.bitmapCodingContextUsed=!!(256&e),A.bitmapCodingContextRetained=!!(512&e),A.template=e>>10&3,A.refinementTemplate=e>>12&1,o+=2,!A.huffman){for(r=0===A.template?4:1,n=[],g=0;g>2&3,I.stripSize=1<>4&3,I.transposed=!!(64&c),I.combinationOperator=c>>7&3,I.defaultPixelValue=c>>9&1,I.dsOffset=c<<17>>27,I.refinementTemplate=c>>15&1,I.huffman){const A=NA(i,o);o+=2,I.huffmanFS=3&A,I.huffmanDS=A>>2&3,I.huffmanDT=A>>4&3,I.huffmanRefinementDW=A>>6&3,I.huffmanRefinementDH=A>>8&3,I.huffmanRefinementDX=A>>10&3,I.huffmanRefinementDY=A>>12&3,I.huffmanRefinementSizeSelector=!!(16384&A)}if(I.refinement&&!I.refinementTemplate){for(n=[],g=0;g<2;g++)n.push({x:GA(i,o),y:GA(i,o+1)}),o+=2;I.refinementAt=n}I.numberOfSymbolInstances=xA(i,o),o+=4,s=[I,t.referredTo,i,o,a];break;case 16:const C={},B=i[o++];C.mmr=!!(1&B),C.template=B>>1&3,C.patternWidth=i[o++],C.patternHeight=i[o++],C.maxPatternIndex=xA(i,o),o+=4,s=[C,t.number,i,o,a];break;case 22:case 23:const h={};h.info=ot(i,o),o+=It;const Q=i[o++];h.mmr=!!(1&Q),h.template=Q>>1&3,h.enableSkip=!!(8&Q),h.combinationOperator=Q>>4&7,h.defaultPixelValue=Q>>7&1,h.gridWidth=xA(i,o),o+=4,h.gridHeight=xA(i,o),o+=4,h.gridOffsetX=4294967295&xA(i,o),o+=4,h.gridOffsetY=4294967295&xA(i,o),o+=4,h.gridVectorX=NA(i,o),o+=2,h.gridVectorY=NA(i,o),o+=2,s=[h,t.referredTo,i,o,a];break;case 38:case 39:const l={};l.info=ot(i,o),o+=It;const E=i[o++];if(l.mmr=!!(1&E),l.template=E>>1&3,l.prediction=!!(8&E),!l.mmr){for(r=0===l.template?4:1,n=[],g=0;g>2&1,u.combinationOperator=d>>3&3,u.requiresBuffer=!!(32&d),u.combinationOperatorOverride=!!(64&d),s=[u];break;case 49:case 50:case 51:case 62:break;case 53:s=[t.number,i,o,a];break;default:throw new Xe(`segment type ${t.typeName}(${t.type}) is not implemented`)}const I="on"+t.typeName;I in e&&e[I].apply(e,s)}function Ct(A,e){for(let t=0,i=A.length;t>3,t=new Uint8ClampedArray(e*A.height);A.defaultPixelValue&&t.fill(255),this.buffer=t}drawBitmap(A,e){const t=this.currentPageInfo,i=A.width,a=A.height,s=t.width+7>>3,n=t.combinationOperatorOverride?A.combinationOperator:t.combinationOperator,g=this.buffer,r=128>>(7&A.x);let o,I,c,C,B=A.y*s+(A.x>>3);switch(n){case 0:for(o=0;o>=1,c||(c=128,C++);B+=s}break;case 2:for(o=0;o>=1,c||(c=128,C++);B+=s}break;default:throw new Xe(`operator ${n} is not supported`)}}onImmediateGenericRegion(A,e,t,i){const a=A.info,s=new je(e,t,i),n=at(A.mmr,a.width,a.height,A.template,A.prediction,null,A.at,s);this.drawBitmap(a,n)}onImmediateLosslessGenericRegion(){this.onImmediateGenericRegion(...arguments)}onSymbolDictionary(A,e,t,i,a,s){let n,g;A.huffman&&(n=function(A,e,t){let i,a,s,n,g=0;switch(A.huffmanDHSelector){case 0:case 1:i=ut(A.huffmanDHSelector+4);break;case 3:i=ft(g,e,t),g++;break;default:throw new Xe("invalid Huffman DH selector")}switch(A.huffmanDWSelector){case 0:case 1:a=ut(A.huffmanDWSelector+2);break;case 3:a=ft(g,e,t),g++;break;default:throw new Xe("invalid Huffman DW selector")}return A.bitmapSizeSelector?(s=ft(g,e,t),g++):s=ut(1),n=A.aggregationInstancesSelector?ft(g,e,t):ut(1),{tableDeltaHeight:i,tableDeltaWidth:a,tableBitmapSize:s,tableAggregateInstances:n}}(A,t,this.customTables),g=new dt(i,a,s));let r=this.symbols;r||(this.symbols=r={});const o=[];for(const A of t){const e=r[A];e&&o.push(...e)}const I=new je(i,a,s);r[e]=function(A,e,t,i,a,s,n,g,r,o,I,c){if(A&&e)throw new Xe("symbol refinement with Huffman is not supported");const C=[];let B=0,h=RA(t.length+i);const Q=I.decoder,l=I.contextCache;let E,u;for(A&&(E=ut(1),u=[],h=Math.max(h,1));C.length1)d=nt(A,e,i,B,0,a,1,t.concat(C),h,0,0,1,0,s,r,o,I,0,c);else{const A=_e(l,Q,h),e=ze(l,"IARDX",Q),a=ze(l,"IARDY",Q);d=st(i,B,r,A=32){let t,i,n;switch(e){case 32:if(0===A)throw new Xe("no previous value in symbol ID table");i=a.readBits(2)+3,t=s[A-1].prefixLength;break;case 33:i=a.readBits(3)+3,t=0;break;case 34:i=a.readBits(7)+11,t=0;break;default:throw new Xe("invalid code length in symbol ID table")}for(n=0;n=0;l--)k=A?mt(b,r,o,!0):at(!1,r,o,t,!1,null,w,h),D[l]=k;for(F=0;F=0;E--)R^=D[E][F][S],G|=R<>8,U=c+F*C-S*B>>8,x>=0&&x+p<=i&&U>=0&&U+m<=a)for(l=0;l=a))for(L=Q[e],M=N[l],E=0;E=0&&A>1&7),r=1+(i>>4&7),o=[];let I,c,C=a;do{I=n.readBits(g),c=n.readBits(r),o.push(new ht([C,I,c,0])),C+=1<>e&1;if(e<=0)this.children[t]=new Qt(A);else{let i=this.children[t];i||(this.children[t]=i=new Qt(null)),i.buildTree(A,e-1)}}decodeNode(A){if(this.isLeaf){if(this.isOOB)return null;const e=A.readBits(this.rangeLength);return this.rangeLow+(this.isLowerRange?-e:e)}const e=this.children[A.readBit()];if(!e)throw new Xe("invalid Huffman data");return e.decodeNode(A)}}class lt{constructor(A,e){e||this.assignPrefixCodes(A),this.rootNode=new Qt(null);for(let e=0,t=A.length;e0&&this.rootNode.buildTree(t,t.prefixLength-1)}}decode(A){return this.rootNode.decodeNode(A)}assignPrefixCodes(A){const e=A.length;let t=0;for(let i=0;i=this.end)throw new Xe("end of data while reading bit");this.currentByte=this.data[this.position++],this.shift=7}const A=this.currentByte>>this.shift&1;return this.shift--,A}readBits(A){let e,t=0;for(e=A-1;e>=0;e--)t|=this.readBit()<=this.end?-1:this.data[this.position++]}}function ft(A,e,t){let i=0;for(let a=0,s=e.length;a>t&1,t--}if(i&&!g){const A=5;for(let e=0;e>3,c=7&i,C=A.length;t=new Uint32Array(t.buffer);let B=0;for(let i=0;i0&&!A[s-1];)s--;const n=[{children:[],index:0}];let g,r=n[0];for(t=0;t0;)r=n.pop();for(r.index++,n.push(r);n.length<=t;)n.push(g={children:[],index:0}),r.children[r.index]=g.children,r=g;a++}t+10)return h--,B>>h&1;if(B=A[e++],255===B){const i=A[e++];if(i){if(220===i&&o){const i=NA(A,e+=2);if(e+=2,i>0&&i!==t.scanLines)throw new kt("Found DNL marker (0xFFDC) while parsing scan data",i)}else if(217===i){if(o){const A=m*(8===t.precision?8:0);if(A>0&&Math.round(t.scanLines/A)>=5)throw new kt("Found EOI marker (0xFFD9) while parsing scan data, possibly caused by incorrect `scanLines` parameter",A)}throw new Ft("Found EOI marker (0xFFD9) while parsing scan data")}throw new bt(`unexpected marker ${(B<<8|i).toString(16)}`)}}return h=7,B>>>7}function l(A){let e=A;for(;;){switch(e=e[Q()],typeof e){case"number":return e;case"object":continue}throw new bt("invalid huffman sequence")}}function E(A){let e=0;for(;A>0;)e=e<<1|Q(),A--;return e}function u(A){if(1===A)return 1===Q()?1:-1;const e=E(A);return e>=1<0)return void f--;let t=s;const i=n;for(;t<=i;){const i=l(A.huffmanTableAC),a=15&i,s=i>>4;if(0===a){if(s<15){f=E(s)+(1<>4,0===a)o<15?(f=E(o)+(1<>4;if(0===i){if(s<15)break;a+=16;continue}a+=s;const n=St[a];A.blockData[e+n]=u(i),a++}};let x,U=0;const M=1===D?i[0].blocksPerLine*i[0].blocksPerColumn:I*t.mcusPerColumn;let L,J;for(;U<=M;){const t=a?Math.min(M-U,a):M;if(t>0){for(k=0;k0?"unexpected":"excessive"} MCU data, current marker is: ${x.invalid}`),e=x.offset),!(x.marker>=65488&&x.marker<=65495))break;e+=2}return e-C}function Kt(A,e,t){const i=A.quantizationTable,a=A.blockData;let s,n,g,r,o,I,c,C,B,h,Q,l,E,u,d,f,p;if(!i)throw new bt("missing required Quantization Table.");for(let A=0;A<64;A+=8)B=a[e+A],h=a[e+A+1],Q=a[e+A+2],l=a[e+A+3],E=a[e+A+4],u=a[e+A+5],d=a[e+A+6],f=a[e+A+7],B*=i[A],h|Q|l|E|u|d|f?(h*=i[A+1],Q*=i[A+2],l*=i[A+3],E*=i[A+4],u*=i[A+5],d*=i[A+6],f*=i[A+7],s=Lt*B+128>>8,n=Lt*E+128>>8,g=Q,r=d,o=Jt*(h-f)+128>>8,C=Jt*(h+f)+128>>8,I=l<<4,c=u<<4,s=s+n+1>>1,n=s-n,p=g*Mt+r*Ut+128>>8,g=g*Ut-r*Mt+128>>8,r=p,o=o+c+1>>1,c=o-c,C=C+I+1>>1,I=C-I,s=s+r+1>>1,r=s-r,n=n+g+1>>1,g=n-g,p=o*xt+C*Nt+2048>>12,o=o*Nt-C*xt+2048>>12,C=p,p=I*Gt+c*Rt+2048>>12,I=I*Rt-c*Gt+2048>>12,c=p,t[A]=s+C,t[A+7]=s-C,t[A+1]=n+c,t[A+6]=n-c,t[A+2]=g+I,t[A+5]=g-I,t[A+3]=r+o,t[A+4]=r-o):(p=Lt*B+512>>10,t[A]=p,t[A+1]=p,t[A+2]=p,t[A+3]=p,t[A+4]=p,t[A+5]=p,t[A+6]=p,t[A+7]=p);for(let A=0;A<8;++A)B=t[A],h=t[A+8],Q=t[A+16],l=t[A+24],E=t[A+32],u=t[A+40],d=t[A+48],f=t[A+56],h|Q|l|E|u|d|f?(s=Lt*B+2048>>12,n=Lt*E+2048>>12,g=Q,r=d,o=Jt*(h-f)+2048>>12,C=Jt*(h+f)+2048>>12,I=l,c=u,s=4112+(s+n+1>>1),n=s-n,p=g*Mt+r*Ut+2048>>12,g=g*Ut-r*Mt+2048>>12,r=p,o=o+c+1>>1,c=o-c,C=C+I+1>>1,I=C-I,s=s+r+1>>1,r=s-r,n=n+g+1>>1,g=n-g,p=o*xt+C*Nt+2048>>12,o=o*Nt-C*xt+2048>>12,C=p,p=I*Gt+c*Rt+2048>>12,I=I*Rt-c*Gt+2048>>12,c=p,B=s+C,f=s-C,h=n+c,d=n-c,Q=g+I,u=g-I,l=r+o,E=r-o,B<16?B=0:B>=4080?B=255:B>>=4,h<16?h=0:h>=4080?h=255:h>>=4,Q<16?Q=0:Q>=4080?Q=255:Q>>=4,l<16?l=0:l>=4080?l=255:l>>=4,E<16?E=0:E>=4080?E=255:E>>=4,u<16?u=0:u>=4080?u=255:u>>=4,d<16?d=0:d>=4080?d=255:d>>=4,f<16?f=0:f>=4080?f=255:f>>=4,a[e+A]=B,a[e+A+8]=h,a[e+A+16]=Q,a[e+A+24]=l,a[e+A+32]=E,a[e+A+40]=u,a[e+A+48]=d,a[e+A+56]=f):(p=Lt*B+8192>>14,p=p<-2040?0:p>=2024?255:p+2056>>4,a[e+A]=p,a[e+A+8]=p,a[e+A+16]=p,a[e+A+24]=p,a[e+A+32]=p,a[e+A+40]=p,a[e+A+48]=p,a[e+A+56]=p)}function qt(A,e){const t=e.blocksPerLine,i=e.blocksPerColumn,a=new Int16Array(64);for(let A=0;A=i)return null;const s=NA(A,e);if(s>=65472&&s<=65534)return{invalid:null,marker:s,offset:e};let n=NA(A,a);for(;!(n>=65472&&n<=65534);){if(++a>=i)return null;n=NA(A,a)}return{invalid:s.toString(16),marker:n,offset:a}}class Pt{constructor({decodeTransform:A=null,colorTransform:e=-1}={}){this._decodeTransform=A,this._colorTransform=e}parse(A,{dnlScanLines:e=null}={}){function t(){const e=NA(A,n);n+=2;let t=n+e-2;const i=Tt(A,t,n);i?.invalid&&(S("readDataBlock - incorrect length, current marker is: "+i.invalid),t=i.offset);const a=A.subarray(n,t);return n+=a.length,a}function i(A){const e=Math.ceil(A.samplesPerLine/8/A.maxH),t=Math.ceil(A.scanLines/8/A.maxV);for(const i of A.components){const a=Math.ceil(Math.ceil(A.samplesPerLine/8)*i.h/A.maxH),s=Math.ceil(Math.ceil(A.scanLines/8)*i.v/A.maxV),n=e*i.h,g=t*i.v*64*(n+1);i.blockData=new Int16Array(g),i.blocksPerLine=a,i.blocksPerColumn=s}A.mcusPerLine=e,A.mcusPerColumn=t}let a,s,n=0,g=null,r=null,o=0;const I=[],c=[],C=[];let B=NA(A,n);if(n+=2,65496!==B)throw new bt("SOI not found");B=NA(A,n),n+=2;A:for(;65497!==B;){let h,Q,l;switch(B){case 65504:case 65505:case 65506:case 65507:case 65508:case 65509:case 65510:case 65511:case 65512:case 65513:case 65514:case 65515:case 65516:case 65517:case 65518:case 65519:case 65534:const E=t();65504===B&&74===E[0]&&70===E[1]&&73===E[2]&&70===E[3]&&0===E[4]&&(g={version:{major:E[5],minor:E[6]},densityUnits:E[7],xDensity:E[8]<<8|E[9],yDensity:E[10]<<8|E[11],thumbWidth:E[12],thumbHeight:E[13],thumbData:E.subarray(14,14+3*E[12]*E[13])}),65518===B&&65===E[0]&&100===E[1]&&111===E[2]&&98===E[3]&&101===E[4]&&(r={version:E[5]<<8|E[6],flags0:E[7]<<8|E[8],flags1:E[9]<<8|E[10],transformCode:E[11]});break;case 65499:const u=NA(A,n);n+=2;const d=u+n-2;let f;for(;n>4){if(e>>4!=1)throw new bt("DQT - invalid table spec");for(Q=0;Q<64;Q++)f=St[Q],t[f]=NA(A,n),n+=2}else for(Q=0;Q<64;Q++)f=St[Q],t[f]=A[n++];I[15&e]=t}break;case 65472:case 65473:case 65474:if(a)throw new bt("Only single frame JPEGs supported");n+=2,a={},a.extended=65473===B,a.progressive=65474===B,a.precision=A[n++];const p=NA(A,n);n+=2,a.scanLines=e||p,a.samplesPerLine=NA(A,n),n+=2,a.components=[],a.componentIds={};const m=A[n++];let y=0,w=0;for(h=0;h>4,i=15&A[n+1];y>4?c:C)[15&e]=Ht(t,a)}break;case 65501:n+=2,s=NA(A,n),n+=2;break;case 65498:const b=1==++o&&!e;n+=2;const k=A[n++],F=[];for(h=0;h>4],i.huffmanTableAC=c[15&s],F.push(i)}const R=A[n++],G=A[n++],N=A[n++];try{const e=vt(A,n,a,F,s,R,G,N>>4,15&N,b);n+=e}catch(e){if(e instanceof kt)return S(`${e.message} -- attempting to re-parse the JPEG image.`),this.parse(A,{dnlScanLines:e.scanLines});if(e instanceof Ft){S(`${e.message} -- ignoring the rest of the image data.`);break A}throw e}break;case 65500:n+=4;break;case 65535:255!==A[n]&&n--;break;default:const x=Tt(A,n-2,n-3);if(x?.invalid){S("JpegImage.parse - unexpected data, current marker is: "+x.invalid),n=x.offset;break}if(!x||n>=A.length-1){S("JpegImage.parse - reached the end of the image data without finding an EOI marker (0xFFD9).");break A}throw new bt("JpegImage.parse - unknown marker: "+B.toString(16))}B=NA(A,n),n+=2}if(!a)throw new bt("JpegImage.parse - no frame data found.");this.width=a.samplesPerLine,this.height=a.scanLines,this.jfif=g,this.adobe=r,this.components=[];for(const A of a.components){const e=I[A.quantizationId];e&&(A.quantizationTable=e),this.components.push({index:A.index,output:qt(0,A),scaleX:A.h/a.maxH,scaleY:A.v/a.maxV,blocksPerLine:A.blocksPerLine,blocksPerColumn:A.blocksPerColumn})}this.numComponents=this.components.length}_getLinearizedBlockData(A,e,t=!1){const i=this.width/A,a=this.height/e;let s,n,g,r,o,I,c,C,B,h,Q,l=0;const E=this.components.length,u=A*e*E,d=new Uint8ClampedArray(u),f=new Uint32Array(A),p=4294967288;let m;for(c=0;c>8)+y[B+1];return d}get _isColorConversionNeeded(){return this.adobe?!!this.adobe.transformCode:3===this.numComponents?0!==this._colorTransform&&(82!==this.components[0].index||71!==this.components[1].index||66!==this.components[2].index):1===this._colorTransform}_convertYccToRgb(A){let e,t,i;for(let a=0,s=A.length;a4)throw new bt("Unsupported color mode");const s=this._getLinearizedBlockData(A,e,a);if(1===this.numComponents&&(t||i)){const A=s.length*(t?4:3),e=new Uint8ClampedArray(A);let i=0;if(t)!function(A,e){if(Z.isLittleEndian)for(let t=0,i=A.length;t0&&(A=A.subarray(e));break}const e={decodeTransform:void 0,colorTransform:void 0},t=this.dict.getArray("D","Decode");if((this.forceRGBA||this.forceRGB)&&Array.isArray(t)){const A=this.dict.get("BPC","BitsPerComponent")||8,i=t.length,a=new Int32Array(i);let s=!1;const n=(1<{e=A,t=i})),i.decode=function(A,{numComponents:e=4,isIndexedColormap:t=!1,smaskInData:a=!1}){const s=A.length,n=i._malloc(s);i.HEAPU8.set(A,n);const g=i._jp2_decode(n,s,e>0?e:0,!!t,!!a);if(i._free(n),g){const{errorMessages:A}=i;return A?(delete i.errorMessages,A):"Unknown error"}const{imageData:r}=i;return i.imageData=null,r};var a=Object.assign({},i),s="./this.program",n="";"undefined"!=typeof document&&document.currentScript&&(n=document.currentScript.src),Zt&&(n=Zt),n=n.startsWith("blob:")?"":n.substr(0,n.replace(/[?#].*/,"").lastIndexOf("/")+1);var g,r,o,I,c,C=i.print||console.log.bind(console),B=i.printErr||console.error.bind(console);function h(){var A=r.buffer;i.HEAP8=o=new Int8Array(A),i.HEAP16=new Int16Array(A),i.HEAPU8=I=new Uint8Array(A),i.HEAPU16=new Uint16Array(A),i.HEAP32=new Int32Array(A),i.HEAPU32=c=new Uint32Array(A),i.HEAPF32=new Float32Array(A),i.HEAPF64=new Float64Array(A)}Object.assign(i,a),a=null,i.arguments&&i.arguments,i.thisProgram&&(s=i.thisProgram),i.quit&&i.quit,i.wasmBinary&&(g=i.wasmBinary);var Q,l=[],E=[],u=[],d=0,f=null,p=null,m="data:application/octet-stream;base64,",y=A=>A.startsWith(m);function w(A,e){var t,i=function(A){if(A==Q&&g)return new Uint8Array(g);var e=function(A){if(y(A))return function(A){for(var e=atob(A),t=new Uint8Array(e.length),i=0;i{for(;A.length>0;)A.shift()(i)};i.noExitRuntime;var b,k=A=>{var e=(A-r.buffer.byteLength+65535)/65536;try{return r.grow(e),h(),1}catch(A){}},F={},S=()=>{if(!S.strings){var A={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:("object"==typeof navigator&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:s||"./this.program"};for(var e in F)void 0===F[e]?delete A[e]:A[e]=F[e];var t=[];for(var e in A)t.push(`${e}=${A[e]}`);S.strings=t}return S.strings},R=[null,[],[]],G="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0,N=(A,e,t)=>{for(var i=e+t,a=e;A[a]&&!(a>=i);)++a;if(a-e>16&&A.buffer&&G)return G.decode(A.subarray(e,a));for(var s="";e>10,56320|1023&o)}}else s+=String.fromCharCode((31&n)<<6|g)}else s+=String.fromCharCode(n)}return s},x=(A,e)=>A?N(I,A,e):"",U={c:(A,e,t)=>I.copyWithin(A,e,e+t),g:function(A,e){A>>=2;const t=i.imageData=new Uint8ClampedArray(e),a=i.HEAP32.subarray(A,A+e);t.set(a)},f:function(A,e,t,a){A>>=2,e>>=2,t>>=2;const s=i.imageData=new Uint8ClampedArray(3*a),n=i.HEAP32.subarray(A,A+a),g=i.HEAP32.subarray(e,e+a),r=i.HEAP32.subarray(t,t+a);for(let A=0;A>=2,e>>=2,t>>=2,a>>=2;const n=i.imageData=new Uint8ClampedArray(4*s),g=i.HEAP32.subarray(A,A+s),r=i.HEAP32.subarray(e,e+s),o=i.HEAP32.subarray(t,t+s),I=i.HEAP32.subarray(a,a+s);for(let A=0;A{var e=I.length,t=2147483648;if((A>>>=0)>t)return!1;for(var i,a=1;a<=4;a*=2){var s=e*(1+.2/a);s=Math.min(s,A+100663296);var n=Math.min(t,(i=Math.max(A,s))+(65536-i%65536)%65536);if(k(n))return!0}return!1},l:(A,e)=>{var t=0;return S().forEach(((i,a)=>{var s=e+t;c[A+4*a>>2]=s,((A,e)=>{for(var t=0;t{var t=S();c[A>>2]=t.length;var i=0;return t.forEach((A=>i+=A.length+1)),c[e>>2]=i,0},n:A=>52,j:function(A,e,t,i,a){return 70},b:(A,e,t,i)=>{for(var a,s,n,g=0,r=0;r>2],h=c[e+4>>2];e+=8;for(var Q=0;Q>2]=g,0},o:function(A,e){A>>=2;const t=i.imageData=new Uint8ClampedArray(4*e),a=i.HEAP32.subarray(A,A+e);for(let A=0;A>=2,e>>=2;const a=i.imageData=new Uint8ClampedArray(4*t),s=i.HEAP32.subarray(A,A+t),n=i.HEAP32.subarray(e,e+t);for(let A=0;A>=2,e>>=2,t>>=2;const s=i.imageData=new Uint8ClampedArray(4*a),n=i.HEAP32.subarray(A,A+a),g=i.HEAP32.subarray(e,e+a),r=i.HEAP32.subarray(t,t+a);for(let A=0;A0||(function(){if(i.preRun)for("function"==typeof i.preRun&&(i.preRun=[i.preRun]);i.preRun.length;)A=i.preRun.shift(),l.unshift(A);var A;D(l)}(),d>0||(i.setStatus?(i.setStatus("Running..."),setTimeout((function(){setTimeout((function(){i.setStatus("")}),1),A()}),1)):A()))}if(M.q,i._malloc=M.r,i._free=M.s,i._jp2_decode=M.u,p=function A(){b||L(),b||(p=A)},i.preInit)for("function"==typeof i.preInit&&(i.preInit=[i.preInit]);i.preInit.length>0;)i.preInit.pop()();return L(),i});const Xt=Ot;class Vt extends U{constructor(A){super(A,"JpxError")}}class jt{static#y=null;static decode(A,e){e||={},this.#y||=Xt({warn:S});const t=this.#y.decode(A,e);if("string"==typeof t)throw new Vt(t);return t}static cleanup(){this.#y=null}static parseImageProperties(A){let e=A.getByte();for(;e>=0;){const t=e;if(e=A.getByte(),65361==(t<<8|e)){A.skip(4);const e=A.getInt32()>>>0,t=A.getInt32()>>>0,i=A.getInt32()>>>0,a=A.getInt32()>>>0;return A.skip(16),{width:e-i,height:t-a,bitsPerComponent:8,componentsCount:A.getUint16()}}}throw new Vt("No size marker found in JPX stream")}}class zt extends ke{constructor(A,e,t){super(e),this.stream=A,this.dict=A.dict,this.maybeLength=e,this.params=t}get bytes(){return x(this,"bytes",this.stream.getBytes(this.maybeLength))}ensureBuffer(A){}readBlock(A){this.decodeImage(null,A)}decodeImage(A,e){return this.eof||(A||=this.bytes,this.buffer=jt.decode(A,e),this.bufferLength=this.buffer.length,this.eof=!0),this.buffer}get canAsyncDecodeImageFromBuffer(){return this.stream.isAsync}}class _t extends ke{constructor(A,e,t){super(e),this.str=A,this.dict=A.dict,this.cachedData=0,this.bitsCached=0;const i=4096,a={earlyChange:t,codeLength:9,nextCode:258,dictionaryValues:new Uint8Array(i),dictionaryLengths:new Uint16Array(i),dictionaryPrevCodes:new Uint16Array(i),currentSequence:new Uint8Array(i),currentSequenceLength:0};for(let A=0;A<256;++A)a.dictionaryValues[A]=A,a.dictionaryLengths[A]=1;this.lzwState=a}readBits(A){let e=this.bitsCached,t=this.cachedData;for(;e>>e&(1<0;if(A<256)C[0]=A,B=1;else{if(!(A>=258)){if(256===A){I=9,n=258,B=0;continue}this.eof=!0,delete this.lzwState;break}if(A=0;e--)C[e]=g[t],t=o[t];else C[B++]=C[0]}if(a&&(o[n]=c,r[n]=r[c]+1,g[n]=C[0],n++,I=n+s&n+s-1?I:0|Math.min(Math.log(n+s)/.6931471805599453+1,12)),c=A,h+=B,i15))throw new v(`Unsupported predictor: ${i}`);this.readBlock=2===i?this.readBlockTiff:this.readBlockPng,this.str=A,this.dict=A.dict;const a=this.colors=t.get("Colors")||1,s=this.bits=t.get("BPC","BitsPerComponent")||8,n=this.columns=t.get("Columns")||1;return this.pixBytes=a*s+7>>3,this.rowBytes=n*a*s+7>>3,this}readBlockTiff(){const A=this.rowBytes,e=this.bufferLength,t=this.ensureBuffer(e+A),i=this.bits,a=this.colors,s=this.str.getBytes(A);if(this.eof=!s.length,this.eof)return;let n,g=0,r=0,o=0,I=0,c=e;if(1===i&&1===a)for(n=0;n>1,A^=A>>2,A^=A>>4,g=(1&A)<<7,t[c++]=A}else if(8===i){for(n=0;n>8&255,t[c++]=255&A}}else{const A=new Uint8Array(a+1),c=(1<>o-i)&c,o-=i,r=r<=8&&(t[B++]=r>>I-8&255,I-=8);I>0&&(t[B++]=(r<<8-I)+(g&(1<<8-I)-1))}this.bufferLength+=A}readBlockPng(){const A=this.rowBytes,e=this.pixBytes,t=this.str.getByte(),i=this.str.getBytes(A);if(this.eof=!i.length,this.eof)return;const a=this.bufferLength,s=this.ensureBuffer(a+A);let n=s.subarray(a-A,a);0===n.length&&(n=new Uint8Array(A));let g,r,o,I=a;switch(t){case 0:for(g=0;g>1)+i[g];for(;g>1)+i[g]&255,I++;break;case 4:for(g=0;g0){const A=this.str.getBytes(i);e.set(A,t),t+=i}}else{i=257-i;const a=A[1];e=this.ensureBuffer(t+i+1);for(let A=0;A>")&&this.buf1!==aA;){if(!(this.buf1 instanceof rA)){F("Malformed dictionary: key must be a name object"),this.shift();continue}const e=this.buf1.name;if(this.shift(),this.buf1===aA)break;i.set(e,this.getObj(A))}if(this.buf1===aA){if(this.recoveryMode)return i;throw new yA("End of file inside dictionary.")}return lA(this.buf2,"stream")?this.allowStreams?this.makeStream(i,A):i:(this.shift(),i);default:return e}if(Number.isInteger(e)){if(Number.isInteger(this.buf1)&&lA(this.buf2,"R")){const A=CA.get(e,this.buf1);return this.shift(),this.shift(),A}return e}return"string"==typeof e&&A?A.decryptString(e):e}findDefaultInlineStreamEnd(A){const{knownCommands:e}=this.lexer,t=A.pos;let i,a,s=0;for(;-1!==(i=A.getByte());)if(0===s)s=69===i?1:0;else if(1===s)s=73===i?2:0;else if(32===i||10===i||13===i){a=A.pos;const t=A.peekBytes(15),n=t.length;if(0===n)break;for(let A=0;A127)){s=0;break}if(2!==s)continue;if(!e){S("findDefaultInlineStreamEnd - `lexer.knownCommands` is undefined.");continue}const g=new ai(new ie(t.slice()),e);g._hexStringWarn=()=>{};let r=0;for(;;){const A=g.getObj();if(A===aA){s=0;break}if(A instanceof oA){const t=e[A.cmd];if(!t){s=0;break}if(t.variableArgs?r<=t.numArgs:r===t.numArgs)break;r=0}else r++}if(2===s)break}else s=0;-1===i&&(S("findDefaultInlineStreamEnd: Reached the end of the stream without finding a valid EI marker"),a&&(S('... trying to recover by using the last "EI" occurrence.'),A.skip(-(A.pos-a))));let n=4;return A.skip(-n),i=A.peekByte(),A.skip(n),UA(i)||n--,A.pos-n-t}findDCTDecodeInlineStreamEnd(A){const e=A.pos;let t,i,a=!1;for(;-1!==(t=A.getByte());)if(255===t){switch(A.getByte()){case 0:break;case 255:A.skip(-1);break;case 217:a=!0;break;case 192:case 193:case 194:case 195:case 197:case 198:case 199:case 201:case 202:case 203:case 205:case 206:case 207:case 196:case 204:case 218:case 219:case 220:case 221:case 222:case 223:case 224:case 225:case 226:case 227:case 228:case 229:case 230:case 231:case 232:case 233:case 234:case 235:case 236:case 237:case 238:case 239:case 254:i=A.getUint16(),i>2?A.skip(i-2):A.skip(-2)}if(a)break}const s=A.pos-e;return-1===t?(S("Inline DCTDecode image stream: EOI marker not found, searching for /EI/ instead."),A.skip(-s),this.findDefaultInlineStreamEnd(A)):(this.inlineStreamSkipEI(A),s)}findASCII85DecodeInlineStreamEnd(A){const e=A.pos;let t;for(;-1!==(t=A.getByte());)if(126===t){const e=A.pos;for(t=A.peekByte();UA(t);)A.skip(),t=A.peekByte();if(62===t){A.skip();break}if(A.pos>e){const e=A.peekBytes(2);if(69===e[0]&&73===e[1])break}}const i=A.pos-e;return-1===t?(S("Inline ASCII85Decode image stream: EOD marker not found, searching for /EI/ instead."),A.skip(-i),this.findDefaultInlineStreamEnd(A)):(this.inlineStreamSkipEI(A),i)}findASCIIHexDecodeInlineStreamEnd(A){const e=A.pos;let t;for(;-1!==(t=A.getByte())&&62!==t;);const i=A.pos-e;return-1===t?(S("Inline ASCIIHexDecode image stream: EOD marker not found, searching for /EI/ instead."),A.skip(-i),this.findDefaultInlineStreamEnd(A)):(this.inlineStreamSkipEI(A),i)}inlineStreamSkipEI(A){let e,t=0;for(;-1!==(e=A.getByte());)if(0===t)t=69===e?1:0;else if(1===t)t=73===e?2:0;else if(2===t)break}makeInlineImage(A){const e=this.lexer,t=e.stream,i=Object.create(null);let a;for(;!lA(this.buf1,"ID")&&this.buf1!==aA;){if(!(this.buf1 instanceof rA))throw new v("Dictionary key must be a name object");const e=this.buf1.name;if(this.shift(),this.buf1===aA)break;i[e]=this.getObj(A)}-1!==e.beginInlineImagePos&&(a=t.pos-e.beginInlineImagePos);const s=this.xref.fetchIfRef(i.F||i.Filter);let n;if(s instanceof rA)n=s.name;else if(Array.isArray(s)){const A=this.xref.fetchIfRef(s[0]);A instanceof rA&&(n=A.name)}const g=t.pos;let r,o;switch(n){case"DCT":case"DCTDecode":r=this.findDCTDecodeInlineStreamEnd(t);break;case"A85":case"ASCII85Decode":r=this.findASCII85DecodeInlineStreamEnd(t);break;case"AHx":case"ASCIIHexDecode":r=this.findASCIIHexDecodeInlineStreamEnd(t);break;default:r=this.findDefaultInlineStreamEnd(t)}if(r<1e3&&a>0){const A=t.pos;t.pos=e.beginInlineImagePos,o=function(A){const e=[],t=A.length;let i=0;for(;i=i){let i=!1;for(const A of a){const e=A.length;let a=0;for(;a=s){i=!0;break}if(a>=e){UA(n[r+g+a])&&(F(`Found "${q([...t,...A])}" when searching for endstream command.`),i=!0);break}}if(i)return e.pos+=r,e.pos-A}r++}e.pos+=g}return-1}makeStream(A,e){const t=this.lexer;let i=t.stream;t.skipToNextLine();const a=i.pos-1;let s=A.get("Length");if(Number.isInteger(s)||(F(`Bad length "${s&&s.toString()}" in stream.`),s=0),i.pos=a+s,t.nextChar(),this.tryShift()&&lA(this.buf2,"endstream"))this.shift();else{if(s=this.#w(a),s<0)throw new v("Missing endstream command.");t.nextChar(),this.shift(),this.shift()}return this.shift(),i=i.makeSubStream(a,s,A),e&&(i=e.createStream(i,s)),i=this.filter(i,A,s),i.dict=A,i}filter(A,e,t){let i=e.get("F","Filter"),a=e.get("DP","DecodeParms");if(i instanceof rA)return Array.isArray(a)&&S("/DecodeParms should not be an Array, when /Filter is a Name."),this.makeFilter(A,i.name,t,a);let s=t;if(Array.isArray(i)){const e=i,t=a;for(let n=0,g=e.length;n=48&&A<=57?15&A:A>=65&&A<=70||A>=97&&A<=102?9+(15&A):-1}class ai{constructor(A,e=null){this.stream=A,this.nextChar(),this.strBuf=[],this.knownCommands=e,this._hexStringNumWarn=0,this.beginInlineImagePos=-1}nextChar(){return this.currentChar=this.stream.getByte()}peekChar(){return this.stream.peekByte()}getNumber(){let A=this.currentChar,e=!1,t=0,i=1;if(45===A?(i=-1,A=this.nextChar(),45===A&&(A=this.nextChar())):43===A&&(A=this.nextChar()),10===A||13===A)do{A=this.nextChar()}while(10===A||13===A);if(46===A&&(t=10,A=this.nextChar()),A<48||A>57){const e=`Invalid number: ${String.fromCharCode(A)} (charCode ${A})`;if(UA(A)||-1===A)return F(`Lexer.getNumber - "${e}".`),0;throw new v(e)}let a=A-48,s=0,n=1;for(;(A=this.nextChar())>=0;)if(A>=48&&A<=57){const i=A-48;e?s=10*s+i:(0!==t&&(t*=10),a=10*a+i)}else if(46===A){if(0!==t)break;t=1}else if(45===A)S("Badly formatted number: minus sign in the middle");else{if(69!==A&&101!==A)break;if(A=this.peekChar(),43===A||45===A)n=45===A?-1:1,this.nextChar();else if(A<48||A>57)break;e=!0}return 0!==t&&(a/=t),e&&(a*=10**(n*s)),i*a}getString(){let A=1,e=!1;const t=this.strBuf;t.length=0;let i=this.nextChar();for(;;){let a=!1;switch(0|i){case-1:S("Unterminated string"),e=!0;break;case 40:++A,t.push("(");break;case 41:0==--A?(this.nextChar(),e=!0):t.push(")");break;case 92:switch(i=this.nextChar(),i){case-1:S("Unterminated string"),e=!0;break;case 110:t.push("\n");break;case 114:t.push("\r");break;case 116:t.push("\t");break;case 98:t.push("\b");break;case 102:t.push("\f");break;case 92:case 40:case 41:t.push(String.fromCharCode(i));break;case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:let A=15&i;i=this.nextChar(),a=!0,i>=48&&i<=55&&(A=(A<<3)+(15&i),i=this.nextChar(),i>=48&&i<=55&&(a=!1,A=(A<<3)+(15&i))),t.push(String.fromCharCode(A));break;case 13:10===this.peekChar()&&this.nextChar();break;case 10:break;default:t.push(String.fromCharCode(i))}break;default:t.push(String.fromCharCode(i))}if(e)break;a||(i=this.nextChar())}return t.join("")}getName(){let A,e;const t=this.strBuf;for(t.length=0;(A=this.nextChar())>=0&&!ti[A];)if(35===A){if(A=this.nextChar(),ti[A]){S("Lexer_getName: NUMBER SIGN (#) should be followed by a hexadecimal number."),t.push("#");break}const i=ii(A);if(-1!==i){e=A,A=this.nextChar();const a=ii(A);if(-1===a){if(S(`Lexer_getName: Illegal digit (${String.fromCharCode(A)}) in hexadecimal number.`),t.push("#",String.fromCharCode(e)),ti[A])break;t.push(String.fromCharCode(A));continue}t.push(String.fromCharCode(i<<4|a))}else t.push("#",String.fromCharCode(A))}else t.push(String.fromCharCode(A));return t.length>127&&S(`Name token is longer than allowed by the spec: ${t.length}`),rA.get(t.join(""))}_hexStringWarn(A){5!=this._hexStringNumWarn++?this._hexStringNumWarn>5||S(`getHexString - ignoring invalid character: ${A}`):S("getHexString - ignoring additional invalid characters.")}getHexString(){const A=this.strBuf;A.length=0;let e=this.currentChar,t=-1,i=-1;for(this._hexStringNumWarn=0;;){if(e<0){S("Unterminated hex string");break}if(62===e){this.nextChar();break}1!==ti[e]?(i=ii(e),-1===i?this._hexStringWarn(e):-1===t?t=i:(A.push(String.fromCharCode(t<<4|i)),t=-1),e=this.nextChar()):e=this.nextChar()}return-1!==t&&A.push(String.fromCharCode(t<<4)),A.join("")}getObj(){let A=!1,e=this.currentChar;for(;;){if(e<0)return aA;if(A)10!==e&&13!==e||(A=!1);else if(37===e)A=!0;else if(1!==ti[e])break;e=this.nextChar()}switch(0|e){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(),oA.get("[");case 93:return this.nextChar(),oA.get("]");case 60:return e=this.nextChar(),60===e?(this.nextChar(),oA.get("<<")):this.getHexString();case 62:return e=this.nextChar(),62===e?(this.nextChar(),oA.get(">>")):oA.get(">");case 123:return this.nextChar(),oA.get("{");case 125:return this.nextChar(),oA.get("}");case 41:throw this.nextChar(),new v(`Illegal character: ${e}`)}let t=String.fromCharCode(e);if(e<32||e>127){const A=this.peekChar();if(A>=32&&A<=127)return this.nextChar(),oA.get(t)}const i=this.knownCommands;let a=void 0!==i?.[t];for(;(e=this.nextChar())>=0&&!ti[e];){const A=t+String.fromCharCode(e);if(a&&void 0===i[A])break;if(128===t.length)throw new v(`Command token too long: ${t.length}`);t=A,a=void 0!==i?.[t]}return"true"===t||"false"!==t&&("null"===t?null:("BI"===t&&(this.beginInlineImagePos=this.stream.pos),oA.get(t)))}skipToNextLine(){let A=this.currentChar;for(;A>=0;){if(13===A){A=this.nextChar(),10===A&&this.nextChar();break}if(10===A){this.nextChar();break}A=this.nextChar()}}}class si{static create(A){function e(A,e,t=!1){const i=A.get(e);if(Number.isInteger(i)&&(t?i>=0:i>0))return i;throw new Error(`The "${e}" parameter in the linearization dictionary is invalid.`)}const t=new ei({lexer:new ai(A),xref:null}),i=t.getObj(),a=t.getObj(),s=t.getObj(),n=t.getObj();let g,r;if(!(Number.isInteger(i)&&Number.isInteger(a)&&lA(s,"obj")&&n instanceof cA&&"number"==typeof(g=n.get("Linearized"))&&g>0))return null;if((r=e(n,"L"))!==A.length)throw new Error('The "L" parameter in the linearization dictionary does not equal the stream length.');return{length:r,hints:function(A){const e=A.get("H");let t;if(Array.isArray(e)&&(2===(t=e.length)||4===t)){for(let A=0;A0))throw new Error(`Hint (${A}) in the linearization dictionary is invalid.`)}return e}throw new Error("Hint array in the linearization dictionary is invalid.")}(n),objectNumberFirst:e(n,"O"),endFirst:e(n,"E"),numPages:e(n,"N"),mainXRefEntriesOffset:e(n,"T"),pageFirst:n.has("P")?e(n,"P",!0):0}}}const ni=["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","EUC-H","EUC-V","Ext-H","Ext-RKSJ-H","Ext-RKSJ-V","Ext-V","GB-EUC-H","GB-EUC-V","GB-H","GB-V","GBK-EUC-H","GBK-EUC-V","GBK2K-H","GBK2K-V","GBKp-EUC-H","GBKp-EUC-V","GBT-EUC-H","GBT-EUC-V","GBT-H","GBT-V","GBTpc-EUC-H","GBTpc-EUC-V","GBpc-EUC-H","GBpc-EUC-V","H","HKdla-B5-H","HKdla-B5-V","HKdlb-B5-H","HKdlb-B5-V","HKgccs-B5-H","HKgccs-B5-V","HKm314-B5-H","HKm314-B5-V","HKm471-B5-H","HKm471-B5-V","HKscs-B5-H","HKscs-B5-V","Hankaku","Hiragana","KSC-EUC-H","KSC-EUC-V","KSC-H","KSC-Johab-H","KSC-Johab-V","KSC-V","KSCms-UHC-H","KSCms-UHC-HW-H","KSCms-UHC-HW-V","KSCms-UHC-V","KSCpc-EUC-H","KSCpc-EUC-V","Katakana","NWP-H","NWP-V","RKSJ-H","RKSJ-V","Roman","UniCNS-UCS2-H","UniCNS-UCS2-V","UniCNS-UTF16-H","UniCNS-UTF16-V","UniCNS-UTF32-H","UniCNS-UTF32-V","UniCNS-UTF8-H","UniCNS-UTF8-V","UniGB-UCS2-H","UniGB-UCS2-V","UniGB-UTF16-H","UniGB-UTF16-V","UniGB-UTF32-H","UniGB-UTF32-V","UniGB-UTF8-H","UniGB-UTF8-V","UniJIS-UCS2-H","UniJIS-UCS2-HW-H","UniJIS-UCS2-HW-V","UniJIS-UCS2-V","UniJIS-UTF16-H","UniJIS-UTF16-V","UniJIS-UTF32-H","UniJIS-UTF32-V","UniJIS-UTF8-H","UniJIS-UTF8-V","UniJIS2004-UTF16-H","UniJIS2004-UTF16-V","UniJIS2004-UTF32-H","UniJIS2004-UTF32-V","UniJIS2004-UTF8-H","UniJIS2004-UTF8-V","UniJISPro-UCS2-HW-V","UniJISPro-UCS2-V","UniJISPro-UTF8-V","UniJISX0213-UTF32-H","UniJISX0213-UTF32-V","UniJISX02132004-UTF32-H","UniJISX02132004-UTF32-V","UniKS-UCS2-H","UniKS-UCS2-V","UniKS-UTF16-H","UniKS-UTF16-V","UniKS-UTF32-H","UniKS-UTF32-V","UniKS-UTF8-H","UniKS-UTF8-V","V","WP-Symbol"],gi=2**24-1;class ri{constructor(A=!1){this.codespaceRanges=[[],[],[],[]],this.numCodespaceRanges=0,this._map=[],this.name="",this.vertical=!1,this.useCMap=null,this.builtInCMap=A}addCodespaceRange(A,e,t){this.codespaceRanges[A-1].push(e,t),this.numCodespaceRanges++}mapCidRange(A,e,t){if(e-A>gi)throw new Error("mapCidRange - ignoring data above MAX_MAP_RANGE.");for(;A<=e;)this._map[A++]=t++}mapBfRange(A,e,t){if(e-A>gi)throw new Error("mapBfRange - ignoring data above MAX_MAP_RANGE.");const i=t.length-1;for(;A<=e;){this._map[A++]=t;const e=t.charCodeAt(i)+1;t=e>255?t.substring(0,i-1)+String.fromCharCode(t.charCodeAt(i-1)+1)+"\0":t.substring(0,i)+String.fromCharCode(e)}}mapBfRangeToArray(A,e,t){if(e-A>gi)throw new Error("mapBfRangeToArray - ignoring data above MAX_MAP_RANGE.");const i=t.length;let a=0;for(;A<=e&&a>>0;const n=a[s];for(let A=0,e=n.length;A=e&&i<=a)return t.charcode=i,void(t.length=s+1)}}t.charcode=0,t.length=1}getCharCodeLength(A){const e=this.codespaceRanges;for(let t=0,i=e.length;t=a&&A<=s)return t+1}}return 1}get length(){return this._map.length}get isIdentityCMap(){if("Identity-H"!==this.name&&"Identity-V"!==this.name)return!1;if(65536!==this._map.length)return!1;for(let A=0;A<65536;A++)if(this._map[A]!==A)return!1;return!0}}class oi extends ri{constructor(A,e){super(),this.vertical=A,this.addCodespaceRange(e,0,65535)}mapCidRange(A,e,t){R("should not call mapCidRange")}mapBfRange(A,e,t){R("should not call mapBfRange")}mapBfRangeToArray(A,e,t){R("should not call mapBfRangeToArray")}mapOne(A,e){R("should not call mapCidOne")}lookup(A){return Number.isInteger(A)&&A<=65535?A:void 0}contains(A){return Number.isInteger(A)&&A<=65535}forEach(A){for(let e=0;e<=65535;e++)A(e,e)}charCodeOf(A){return Number.isInteger(A)&&A<=65535?A:-1}getMap(){const A=new Array(65536);for(let e=0;e<=65535;e++)A[e]=e;return A}get length(){return 65536}get isIdentityCMap(){R("should not access .isIdentityCMap")}}function Ii(A){let e=0;for(let t=0;t>>0}function ci(A){if("string"!=typeof A)throw new v("Malformed CMap: expected string.")}function Ci(A){if(!Number.isInteger(A))throw new v("Malformed CMap: expected int.")}function Bi(A,e){for(;;){let t=e.getObj();if(t===aA)break;if(lA(t,"endbfchar"))return;ci(t);const i=Ii(t);t=e.getObj(),ci(t);const a=t;A.mapOne(i,a)}}function hi(A,e){for(;;){let t=e.getObj();if(t===aA)break;if(lA(t,"endbfrange"))return;ci(t);const i=Ii(t);t=e.getObj(),ci(t);const a=Ii(t);if(t=e.getObj(),Number.isInteger(t)||"string"==typeof t){const e=Number.isInteger(t)?String.fromCharCode(t):t;A.mapBfRange(i,a,e)}else{if(!lA(t,"["))break;{t=e.getObj();const s=[];for(;!lA(t,"]")&&t!==aA;)s.push(t),t=e.getObj();A.mapBfRangeToArray(i,a,s)}}}throw new v("Invalid bf range.")}function Qi(A,e){for(;;){let t=e.getObj();if(t===aA)break;if(lA(t,"endcidchar"))return;ci(t);const i=Ii(t);t=e.getObj(),Ci(t);const a=t;A.mapOne(i,a)}}function li(A,e){for(;;){let t=e.getObj();if(t===aA)break;if(lA(t,"endcidrange"))return;ci(t);const i=Ii(t);t=e.getObj(),ci(t);const a=Ii(t);t=e.getObj(),Ci(t);const s=t;A.mapCidRange(i,a,s)}}function Ei(A,e){for(;;){let t=e.getObj();if(t===aA)break;if(lA(t,"endcodespacerange"))return;if("string"!=typeof t)break;const i=Ii(t);if(t=e.getObj(),"string"!=typeof t)break;const a=Ii(t);A.addCodespaceRange(t.length,i,a)}throw new v("Invalid codespace range.")}function ui(A,e){const t=e.getObj();Number.isInteger(t)&&(A.vertical=!!t)}function di(A,e){const t=e.getObj();t instanceof rA&&(A.name=t.name)}async function fi(A,e,t,i){let a,s;A:for(;;)try{const t=e.getObj();if(t===aA)break;if(t instanceof rA)"WMode"===t.name?ui(A,e):"CMapName"===t.name&&di(A,e),a=t;else if(t instanceof oA)switch(t.cmd){case"endcmap":break A;case"usecmap":a instanceof rA&&(s=a.name);break;case"begincodespacerange":Ei(A,e);break;case"beginbfchar":Bi(A,e);break;case"begincidchar":Qi(A,e);break;case"beginbfrange":hi(A,e);break;case"begincidrange":li(A,e)}}catch(A){if(A instanceof mA)throw A;S("Invalid cMap data: "+A);continue}return!i&&s&&(i=s),i?pi(A,t,i):A}async function pi(A,e,t){if(A.useCMap=await mi(t,e),0===A.numCodespaceRanges){const e=A.useCMap.codespaceRanges;for(let t=0;tpi(a,e,A)));if(0===i){const A=new ai(new ie(t));return fi(a,A,e,null)}throw new Error(`Invalid CMap "compressionType" value: ${i}`)}class yi{static async create({encoding:A,fetchBuiltInCMap:e,useCMap:t}){if(A instanceof rA)return mi(A.name,e);if(A instanceof dA){const i=await fi(new ri,new ai(A),e,t);return i.isIdentityCMap?mi(i.name,e):i}throw new Error("Encoding required.")}}const wi=[".notdef","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quoteright","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","quoteleft","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","exclamdown","cent","sterling","fraction","yen","florin","section","currency","quotesingle","quotedblleft","guillemotleft","guilsinglleft","guilsinglright","fi","fl","endash","dagger","daggerdbl","periodcentered","paragraph","bullet","quotesinglbase","quotedblbase","quotedblright","guillemotright","ellipsis","perthousand","questiondown","grave","acute","circumflex","tilde","macron","breve","dotaccent","dieresis","ring","cedilla","hungarumlaut","ogonek","caron","emdash","AE","ordfeminine","Lslash","Oslash","OE","ordmasculine","ae","dotlessi","lslash","oslash","oe","germandbls","onesuperior","logicalnot","mu","trademark","Eth","onehalf","plusminus","Thorn","onequarter","divide","brokenbar","degree","thorn","threequarters","twosuperior","registered","minus","eth","multiply","threesuperior","copyright","Aacute","Acircumflex","Adieresis","Agrave","Aring","Atilde","Ccedilla","Eacute","Ecircumflex","Edieresis","Egrave","Iacute","Icircumflex","Idieresis","Igrave","Ntilde","Oacute","Ocircumflex","Odieresis","Ograve","Otilde","Scaron","Uacute","Ucircumflex","Udieresis","Ugrave","Yacute","Ydieresis","Zcaron","aacute","acircumflex","adieresis","agrave","aring","atilde","ccedilla","eacute","ecircumflex","edieresis","egrave","iacute","icircumflex","idieresis","igrave","ntilde","oacute","ocircumflex","odieresis","ograve","otilde","scaron","uacute","ucircumflex","udieresis","ugrave","yacute","ydieresis","zcaron"],Di=[".notdef","space","exclamsmall","Hungarumlautsmall","dollaroldstyle","dollarsuperior","ampersandsmall","Acutesmall","parenleftsuperior","parenrightsuperior","twodotenleader","onedotenleader","comma","hyphen","period","fraction","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","colon","semicolon","commasuperior","threequartersemdash","periodsuperior","questionsmall","asuperior","bsuperior","centsuperior","dsuperior","esuperior","isuperior","lsuperior","msuperior","nsuperior","osuperior","rsuperior","ssuperior","tsuperior","ff","fi","fl","ffi","ffl","parenleftinferior","parenrightinferior","Circumflexsmall","hyphensuperior","Gravesmall","Asmall","Bsmall","Csmall","Dsmall","Esmall","Fsmall","Gsmall","Hsmall","Ismall","Jsmall","Ksmall","Lsmall","Msmall","Nsmall","Osmall","Psmall","Qsmall","Rsmall","Ssmall","Tsmall","Usmall","Vsmall","Wsmall","Xsmall","Ysmall","Zsmall","colonmonetary","onefitted","rupiah","Tildesmall","exclamdownsmall","centoldstyle","Lslashsmall","Scaronsmall","Zcaronsmall","Dieresissmall","Brevesmall","Caronsmall","Dotaccentsmall","Macronsmall","figuredash","hypheninferior","Ogoneksmall","Ringsmall","Cedillasmall","onequarter","onehalf","threequarters","questiondownsmall","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","zerosuperior","onesuperior","twosuperior","threesuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","eightsuperior","ninesuperior","zeroinferior","oneinferior","twoinferior","threeinferior","fourinferior","fiveinferior","sixinferior","seveninferior","eightinferior","nineinferior","centinferior","dollarinferior","periodinferior","commainferior","Agravesmall","Aacutesmall","Acircumflexsmall","Atildesmall","Adieresissmall","Aringsmall","AEsmall","Ccedillasmall","Egravesmall","Eacutesmall","Ecircumflexsmall","Edieresissmall","Igravesmall","Iacutesmall","Icircumflexsmall","Idieresissmall","Ethsmall","Ntildesmall","Ogravesmall","Oacutesmall","Ocircumflexsmall","Otildesmall","Odieresissmall","OEsmall","Oslashsmall","Ugravesmall","Uacutesmall","Ucircumflexsmall","Udieresissmall","Yacutesmall","Thornsmall","Ydieresissmall"],bi=[".notdef","space","dollaroldstyle","dollarsuperior","parenleftsuperior","parenrightsuperior","twodotenleader","onedotenleader","comma","hyphen","period","fraction","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","colon","semicolon","commasuperior","threequartersemdash","periodsuperior","asuperior","bsuperior","centsuperior","dsuperior","esuperior","isuperior","lsuperior","msuperior","nsuperior","osuperior","rsuperior","ssuperior","tsuperior","ff","fi","fl","ffi","ffl","parenleftinferior","parenrightinferior","hyphensuperior","colonmonetary","onefitted","rupiah","centoldstyle","figuredash","hypheninferior","onequarter","onehalf","threequarters","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","zerosuperior","onesuperior","twosuperior","threesuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","eightsuperior","ninesuperior","zeroinferior","oneinferior","twoinferior","threeinferior","fourinferior","fiveinferior","sixinferior","seveninferior","eightinferior","nineinferior","centinferior","dollarinferior","periodinferior","commainferior"],ki=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","space","exclamsmall","Hungarumlautsmall","","dollaroldstyle","dollarsuperior","ampersandsmall","Acutesmall","parenleftsuperior","parenrightsuperior","twodotenleader","onedotenleader","comma","hyphen","period","fraction","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","colon","semicolon","commasuperior","threequartersemdash","periodsuperior","questionsmall","","asuperior","bsuperior","centsuperior","dsuperior","esuperior","","","","isuperior","","","lsuperior","msuperior","nsuperior","osuperior","","","rsuperior","ssuperior","tsuperior","","ff","fi","fl","ffi","ffl","parenleftinferior","","parenrightinferior","Circumflexsmall","hyphensuperior","Gravesmall","Asmall","Bsmall","Csmall","Dsmall","Esmall","Fsmall","Gsmall","Hsmall","Ismall","Jsmall","Ksmall","Lsmall","Msmall","Nsmall","Osmall","Psmall","Qsmall","Rsmall","Ssmall","Tsmall","Usmall","Vsmall","Wsmall","Xsmall","Ysmall","Zsmall","colonmonetary","onefitted","rupiah","Tildesmall","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","exclamdownsmall","centoldstyle","Lslashsmall","","","Scaronsmall","Zcaronsmall","Dieresissmall","Brevesmall","Caronsmall","","Dotaccentsmall","","","Macronsmall","","","figuredash","hypheninferior","","","Ogoneksmall","Ringsmall","Cedillasmall","","","","onequarter","onehalf","threequarters","questiondownsmall","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","","","zerosuperior","onesuperior","twosuperior","threesuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","eightsuperior","ninesuperior","zeroinferior","oneinferior","twoinferior","threeinferior","fourinferior","fiveinferior","sixinferior","seveninferior","eightinferior","nineinferior","centinferior","dollarinferior","periodinferior","commainferior","Agravesmall","Aacutesmall","Acircumflexsmall","Atildesmall","Adieresissmall","Aringsmall","AEsmall","Ccedillasmall","Egravesmall","Eacutesmall","Ecircumflexsmall","Edieresissmall","Igravesmall","Iacutesmall","Icircumflexsmall","Idieresissmall","Ethsmall","Ntildesmall","Ogravesmall","Oacutesmall","Ocircumflexsmall","Otildesmall","Odieresissmall","OEsmall","Oslashsmall","Ugravesmall","Uacutesmall","Ucircumflexsmall","Udieresissmall","Yacutesmall","Thornsmall","Ydieresissmall"],Fi=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","space","exclamsmall","Hungarumlautsmall","centoldstyle","dollaroldstyle","dollarsuperior","ampersandsmall","Acutesmall","parenleftsuperior","parenrightsuperior","twodotenleader","onedotenleader","comma","hyphen","period","fraction","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","colon","semicolon","","threequartersemdash","","questionsmall","","","","","Ethsmall","","","onequarter","onehalf","threequarters","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","","","","","","","ff","fi","fl","ffi","ffl","parenleftinferior","","parenrightinferior","Circumflexsmall","hypheninferior","Gravesmall","Asmall","Bsmall","Csmall","Dsmall","Esmall","Fsmall","Gsmall","Hsmall","Ismall","Jsmall","Ksmall","Lsmall","Msmall","Nsmall","Osmall","Psmall","Qsmall","Rsmall","Ssmall","Tsmall","Usmall","Vsmall","Wsmall","Xsmall","Ysmall","Zsmall","colonmonetary","onefitted","rupiah","Tildesmall","","","asuperior","centsuperior","","","","","Aacutesmall","Agravesmall","Acircumflexsmall","Adieresissmall","Atildesmall","Aringsmall","Ccedillasmall","Eacutesmall","Egravesmall","Ecircumflexsmall","Edieresissmall","Iacutesmall","Igravesmall","Icircumflexsmall","Idieresissmall","Ntildesmall","Oacutesmall","Ogravesmall","Ocircumflexsmall","Odieresissmall","Otildesmall","Uacutesmall","Ugravesmall","Ucircumflexsmall","Udieresissmall","","eightsuperior","fourinferior","threeinferior","sixinferior","eightinferior","seveninferior","Scaronsmall","","centinferior","twoinferior","","Dieresissmall","","Caronsmall","osuperior","fiveinferior","","commainferior","periodinferior","Yacutesmall","","dollarinferior","","","Thornsmall","","nineinferior","zeroinferior","Zcaronsmall","AEsmall","Oslashsmall","questiondownsmall","oneinferior","Lslashsmall","","","","","","","Cedillasmall","","","","","","OEsmall","figuredash","hyphensuperior","","","","","exclamdownsmall","","Ydieresissmall","","onesuperior","twosuperior","threesuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","ninesuperior","zerosuperior","","esuperior","rsuperior","tsuperior","","","isuperior","ssuperior","dsuperior","","","","","","lsuperior","Ogoneksmall","Brevesmall","Macronsmall","bsuperior","nsuperior","msuperior","commasuperior","periodsuperior","Dotaccentsmall","Ringsmall","","","",""],Si=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quotesingle","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","grave","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","","Adieresis","Aring","Ccedilla","Eacute","Ntilde","Odieresis","Udieresis","aacute","agrave","acircumflex","adieresis","atilde","aring","ccedilla","eacute","egrave","ecircumflex","edieresis","iacute","igrave","icircumflex","idieresis","ntilde","oacute","ograve","ocircumflex","odieresis","otilde","uacute","ugrave","ucircumflex","udieresis","dagger","degree","cent","sterling","section","bullet","paragraph","germandbls","registered","copyright","trademark","acute","dieresis","notequal","AE","Oslash","infinity","plusminus","lessequal","greaterequal","yen","mu","partialdiff","summation","product","pi","integral","ordfeminine","ordmasculine","Omega","ae","oslash","questiondown","exclamdown","logicalnot","radical","florin","approxequal","Delta","guillemotleft","guillemotright","ellipsis","space","Agrave","Atilde","Otilde","OE","oe","endash","emdash","quotedblleft","quotedblright","quoteleft","quoteright","divide","lozenge","ydieresis","Ydieresis","fraction","currency","guilsinglleft","guilsinglright","fi","fl","daggerdbl","periodcentered","quotesinglbase","quotedblbase","perthousand","Acircumflex","Ecircumflex","Aacute","Edieresis","Egrave","Iacute","Icircumflex","Idieresis","Igrave","Oacute","Ocircumflex","apple","Ograve","Uacute","Ucircumflex","Ugrave","dotlessi","circumflex","tilde","macron","breve","dotaccent","ring","cedilla","hungarumlaut","ogonek","caron"],Ri=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quoteright","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","quoteleft","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","exclamdown","cent","sterling","fraction","yen","florin","section","currency","quotesingle","quotedblleft","guillemotleft","guilsinglleft","guilsinglright","fi","fl","","endash","dagger","daggerdbl","periodcentered","","paragraph","bullet","quotesinglbase","quotedblbase","quotedblright","guillemotright","ellipsis","perthousand","","questiondown","","grave","acute","circumflex","tilde","macron","breve","dotaccent","dieresis","","ring","cedilla","","hungarumlaut","ogonek","caron","emdash","","","","","","","","","","","","","","","","","AE","","ordfeminine","","","","","Lslash","Oslash","OE","ordmasculine","","","","","","ae","","","","dotlessi","","","lslash","oslash","oe","germandbls","","","",""],Gi=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quotesingle","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","grave","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","bullet","Euro","bullet","quotesinglbase","florin","quotedblbase","ellipsis","dagger","daggerdbl","circumflex","perthousand","Scaron","guilsinglleft","OE","bullet","Zcaron","bullet","bullet","quoteleft","quoteright","quotedblleft","quotedblright","bullet","endash","emdash","tilde","trademark","scaron","guilsinglright","oe","bullet","zcaron","Ydieresis","space","exclamdown","cent","sterling","currency","yen","brokenbar","section","dieresis","copyright","ordfeminine","guillemotleft","logicalnot","hyphen","registered","macron","degree","plusminus","twosuperior","threesuperior","acute","mu","paragraph","periodcentered","cedilla","onesuperior","ordmasculine","guillemotright","onequarter","onehalf","threequarters","questiondown","Agrave","Aacute","Acircumflex","Atilde","Adieresis","Aring","AE","Ccedilla","Egrave","Eacute","Ecircumflex","Edieresis","Igrave","Iacute","Icircumflex","Idieresis","Eth","Ntilde","Ograve","Oacute","Ocircumflex","Otilde","Odieresis","multiply","Oslash","Ugrave","Uacute","Ucircumflex","Udieresis","Yacute","Thorn","germandbls","agrave","aacute","acircumflex","atilde","adieresis","aring","ae","ccedilla","egrave","eacute","ecircumflex","edieresis","igrave","iacute","icircumflex","idieresis","eth","ntilde","ograve","oacute","ocircumflex","otilde","odieresis","divide","oslash","ugrave","uacute","ucircumflex","udieresis","yacute","thorn","ydieresis"],Ni=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","space","exclam","universal","numbersign","existential","percent","ampersand","suchthat","parenleft","parenright","asteriskmath","plus","comma","minus","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","congruent","Alpha","Beta","Chi","Delta","Epsilon","Phi","Gamma","Eta","Iota","theta1","Kappa","Lambda","Mu","Nu","Omicron","Pi","Theta","Rho","Sigma","Tau","Upsilon","sigma1","Omega","Xi","Psi","Zeta","bracketleft","therefore","bracketright","perpendicular","underscore","radicalex","alpha","beta","chi","delta","epsilon","phi","gamma","eta","iota","phi1","kappa","lambda","mu","nu","omicron","pi","theta","rho","sigma","tau","upsilon","omega1","omega","xi","psi","zeta","braceleft","bar","braceright","similar","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","Euro","Upsilon1","minute","lessequal","fraction","infinity","florin","club","diamond","heart","spade","arrowboth","arrowleft","arrowup","arrowright","arrowdown","degree","plusminus","second","greaterequal","multiply","proportional","partialdiff","bullet","divide","notequal","equivalence","approxequal","ellipsis","arrowvertex","arrowhorizex","carriagereturn","aleph","Ifraktur","Rfraktur","weierstrass","circlemultiply","circleplus","emptyset","intersection","union","propersuperset","reflexsuperset","notsubset","propersubset","reflexsubset","element","notelement","angle","gradient","registerserif","copyrightserif","trademarkserif","product","radical","dotmath","logicalnot","logicaland","logicalor","arrowdblboth","arrowdblleft","arrowdblup","arrowdblright","arrowdbldown","lozenge","angleleft","registersans","copyrightsans","trademarksans","summation","parenlefttp","parenleftex","parenleftbt","bracketlefttp","bracketleftex","bracketleftbt","bracelefttp","braceleftmid","braceleftbt","braceex","","angleright","integral","integraltp","integralex","integralbt","parenrighttp","parenrightex","parenrightbt","bracketrighttp","bracketrightex","bracketrightbt","bracerighttp","bracerightmid","bracerightbt",""],xi=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","space","a1","a2","a202","a3","a4","a5","a119","a118","a117","a11","a12","a13","a14","a15","a16","a105","a17","a18","a19","a20","a21","a22","a23","a24","a25","a26","a27","a28","a6","a7","a8","a9","a10","a29","a30","a31","a32","a33","a34","a35","a36","a37","a38","a39","a40","a41","a42","a43","a44","a45","a46","a47","a48","a49","a50","a51","a52","a53","a54","a55","a56","a57","a58","a59","a60","a61","a62","a63","a64","a65","a66","a67","a68","a69","a70","a71","a72","a73","a74","a203","a75","a204","a76","a77","a78","a79","a81","a82","a83","a84","a97","a98","a99","a100","","a89","a90","a93","a94","a91","a92","a205","a85","a206","a86","a87","a88","a95","a96","","","","","","","","","","","","","","","","","","","","a101","a102","a103","a104","a106","a107","a108","a112","a111","a110","a109","a120","a121","a122","a123","a124","a125","a126","a127","a128","a129","a130","a131","a132","a133","a134","a135","a136","a137","a138","a139","a140","a141","a142","a143","a144","a145","a146","a147","a148","a149","a150","a151","a152","a153","a154","a155","a156","a157","a158","a159","a160","a161","a163","a164","a196","a165","a192","a166","a167","a168","a169","a170","a171","a172","a173","a162","a174","a175","a176","a177","a178","a179","a193","a180","a199","a181","a200","a182","","a201","a183","a184","a197","a185","a194","a198","a186","a195","a187","a188","a189","a190","a191",""];function Ui(A){switch(A){case"WinAnsiEncoding":return Gi;case"StandardEncoding":return Ri;case"MacRomanEncoding":return Si;case"SymbolSetEncoding":return Ni;case"ZapfDingbatsEncoding":return xi;case"ExpertEncoding":return ki;case"MacExpertEncoding":return Fi;default:return null}}const Mi=[".notdef","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quoteright","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","quoteleft","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","exclamdown","cent","sterling","fraction","yen","florin","section","currency","quotesingle","quotedblleft","guillemotleft","guilsinglleft","guilsinglright","fi","fl","endash","dagger","daggerdbl","periodcentered","paragraph","bullet","quotesinglbase","quotedblbase","quotedblright","guillemotright","ellipsis","perthousand","questiondown","grave","acute","circumflex","tilde","macron","breve","dotaccent","dieresis","ring","cedilla","hungarumlaut","ogonek","caron","emdash","AE","ordfeminine","Lslash","Oslash","OE","ordmasculine","ae","dotlessi","lslash","oslash","oe","germandbls","onesuperior","logicalnot","mu","trademark","Eth","onehalf","plusminus","Thorn","onequarter","divide","brokenbar","degree","thorn","threequarters","twosuperior","registered","minus","eth","multiply","threesuperior","copyright","Aacute","Acircumflex","Adieresis","Agrave","Aring","Atilde","Ccedilla","Eacute","Ecircumflex","Edieresis","Egrave","Iacute","Icircumflex","Idieresis","Igrave","Ntilde","Oacute","Ocircumflex","Odieresis","Ograve","Otilde","Scaron","Uacute","Ucircumflex","Udieresis","Ugrave","Yacute","Ydieresis","Zcaron","aacute","acircumflex","adieresis","agrave","aring","atilde","ccedilla","eacute","ecircumflex","edieresis","egrave","iacute","icircumflex","idieresis","igrave","ntilde","oacute","ocircumflex","odieresis","ograve","otilde","scaron","uacute","ucircumflex","udieresis","ugrave","yacute","ydieresis","zcaron","exclamsmall","Hungarumlautsmall","dollaroldstyle","dollarsuperior","ampersandsmall","Acutesmall","parenleftsuperior","parenrightsuperior","twodotenleader","onedotenleader","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","commasuperior","threequartersemdash","periodsuperior","questionsmall","asuperior","bsuperior","centsuperior","dsuperior","esuperior","isuperior","lsuperior","msuperior","nsuperior","osuperior","rsuperior","ssuperior","tsuperior","ff","ffi","ffl","parenleftinferior","parenrightinferior","Circumflexsmall","hyphensuperior","Gravesmall","Asmall","Bsmall","Csmall","Dsmall","Esmall","Fsmall","Gsmall","Hsmall","Ismall","Jsmall","Ksmall","Lsmall","Msmall","Nsmall","Osmall","Psmall","Qsmall","Rsmall","Ssmall","Tsmall","Usmall","Vsmall","Wsmall","Xsmall","Ysmall","Zsmall","colonmonetary","onefitted","rupiah","Tildesmall","exclamdownsmall","centoldstyle","Lslashsmall","Scaronsmall","Zcaronsmall","Dieresissmall","Brevesmall","Caronsmall","Dotaccentsmall","Macronsmall","figuredash","hypheninferior","Ogoneksmall","Ringsmall","Cedillasmall","questiondownsmall","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","zerosuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","eightsuperior","ninesuperior","zeroinferior","oneinferior","twoinferior","threeinferior","fourinferior","fiveinferior","sixinferior","seveninferior","eightinferior","nineinferior","centinferior","dollarinferior","periodinferior","commainferior","Agravesmall","Aacutesmall","Acircumflexsmall","Atildesmall","Adieresissmall","Aringsmall","AEsmall","Ccedillasmall","Egravesmall","Eacutesmall","Ecircumflexsmall","Edieresissmall","Igravesmall","Iacutesmall","Icircumflexsmall","Idieresissmall","Ethsmall","Ntildesmall","Ogravesmall","Oacutesmall","Ocircumflexsmall","Otildesmall","Odieresissmall","OEsmall","Oslashsmall","Ugravesmall","Uacutesmall","Ucircumflexsmall","Udieresissmall","Yacutesmall","Thornsmall","Ydieresissmall","001.000","001.001","001.002","001.003","Black","Bold","Book","Light","Medium","Regular","Roman","Semibold"],Li=[null,{id:"hstem",min:2,stackClearing:!0,stem:!0},null,{id:"vstem",min:2,stackClearing:!0,stem:!0},{id:"vmoveto",min:1,stackClearing:!0},{id:"rlineto",min:2,resetStack:!0},{id:"hlineto",min:1,resetStack:!0},{id:"vlineto",min:1,resetStack:!0},{id:"rrcurveto",min:6,resetStack:!0},null,{id:"callsubr",min:1,undefStack:!0},{id:"return",min:0,undefStack:!0},null,null,{id:"endchar",min:0,stackClearing:!0},null,null,null,{id:"hstemhm",min:2,stackClearing:!0,stem:!0},{id:"hintmask",min:0,stackClearing:!0},{id:"cntrmask",min:0,stackClearing:!0},{id:"rmoveto",min:2,stackClearing:!0},{id:"hmoveto",min:1,stackClearing:!0},{id:"vstemhm",min:2,stackClearing:!0,stem:!0},{id:"rcurveline",min:8,resetStack:!0},{id:"rlinecurve",min:8,resetStack:!0},{id:"vvcurveto",min:4,resetStack:!0},{id:"hhcurveto",min:4,resetStack:!0},null,{id:"callgsubr",min:1,undefStack:!0},{id:"vhcurveto",min:4,resetStack:!0},{id:"hvcurveto",min:4,resetStack:!0}],Ji=[null,null,null,{id:"and",min:2,stackDelta:-1},{id:"or",min:2,stackDelta:-1},{id:"not",min:1,stackDelta:0},null,null,null,{id:"abs",min:1,stackDelta:0},{id:"add",min:2,stackDelta:-1,stackFn(A,e){A[e-2]=A[e-2]+A[e-1]}},{id:"sub",min:2,stackDelta:-1,stackFn(A,e){A[e-2]=A[e-2]-A[e-1]}},{id:"div",min:2,stackDelta:-1,stackFn(A,e){A[e-2]=A[e-2]/A[e-1]}},null,{id:"neg",min:1,stackDelta:0,stackFn(A,e){A[e-1]=-A[e-1]}},{id:"eq",min:2,stackDelta:-1},null,null,{id:"drop",min:1,stackDelta:-1},null,{id:"put",min:2,stackDelta:-2},{id:"get",min:1,stackDelta:0},{id:"ifelse",min:4,stackDelta:-3},{id:"random",min:0,stackDelta:1},{id:"mul",min:2,stackDelta:-1,stackFn(A,e){A[e-2]=A[e-2]*A[e-1]}},null,{id:"sqrt",min:1,stackDelta:0},{id:"dup",min:1,stackDelta:1},{id:"exch",min:2,stackDelta:0},{id:"index",min:2,stackDelta:0},{id:"roll",min:3,stackDelta:-2},null,null,null,{id:"hflex",min:7,resetStack:!0},{id:"flex",min:13,resetStack:!0},{id:"hflex1",min:9,resetStack:!0},{id:"flex1",min:11,resetStack:!0}];class Hi{constructor(A,e,t){this.bytes=A.getBytes(),this.properties=e,this.seacAnalysisEnabled=!!t}parse(){const A=this.properties,e=new Yi;this.cff=e;const t=this.parseHeader(),i=this.parseIndex(t.endPos),a=this.parseIndex(i.endPos),s=this.parseIndex(a.endPos),n=this.parseIndex(s.endPos),g=this.parseDict(a.obj.get(0)),r=this.createDict(Wi,g,e.strings);e.header=t.obj,e.names=this.parseNameIndex(i.obj),e.strings=this.parseStringIndex(s.obj),e.topDict=r,e.globalSubrIndex=n.obj,this.parsePrivateDict(e.topDict),e.isCIDFont=r.hasName("ROS");const o=r.getByName("CharStrings"),I=this.parseIndex(o).obj,c=r.getByName("FontMatrix");c&&(A.fontMatrix=c);const C=r.getByName("FontBBox");let B,h;if(C&&(A.ascent=Math.max(C[3],C[1]),A.descent=Math.min(C[1],C[3]),A.ascentScaled=!0),e.isCIDFont){const A=this.parseIndex(r.getByName("FDArray")).obj;for(let t=0,i=A.count;t=e)throw new v("Invalid CFF header");0!==t&&(F("cff data is shifted"),A=A.subarray(t),this.bytes=A);const i=A[0],a=A[1],s=A[2],n=A[3];return{obj:new vi(i,a,s,n),endPos:s}}parseDict(A){let e=0;function t(){let t=A[e++];return 30===t?function(){let t="";const i=["0","1","2","3","4","5","6","7","8","9",".","E","E-",null,"-"],a=A.length;for(;e>4,n=15&a;if(15===s)break;if(t+=i[s],15===n)break;t+=i[n]}return parseFloat(t)}():28===t?(t=A[e++],t=(t<<24|A[e++]<<16)>>16,t):29===t?(t=A[e++],t=t<<8|A[e++],t=t<<8|A[e++],t=t<<8|A[e++],t):t>=32&&t<=246?t-139:t>=247&&t<=250?256*(t-247)+A[e++]+108:t>=251&&t<=254?-256*(t-251)-A[e++]-108:(S('CFFParser_parseDict: "'+t+'" is a reserved command.'),NaN)}let i=[];const a=[];e=0;const s=A.length;for(;e10)return!1;let a=A.stackSize;const s=A.stack;let n=e.length;for(let g=0;g>16,g+=2,a++;else if(14===r){if(a>=4&&(a-=4,this.seacAnalysisEnabled))return A.seac=s.slice(a,a+4),!1;o=Li[r]}else if(r>=32&&r<=246)s[a]=r-139,a++;else if(r>=247&&r<=254)s[a]=r<251?(r-247<<8)+e[g]+108:-(r-251<<8)-e[g]-108,g++,a++;else if(255===r)s[a]=(e[g]<<24|e[g+1]<<16|e[g+2]<<8|e[g+3])/65536,g+=4,a++;else if(19===r||20===r){if(A.hints+=a>>1,0===A.hints){e.copyWithin(g-1,g,-1),g-=1,n-=1;continue}g+=A.hints+7>>3,a%=2,o=Li[r]}else{if(10===r||29===r){const e=10===r?t:i;if(!e)return o=Li[r],S("Missing subrsIndex for "+o.id),!1;let n=32768;e.count<1240?n=107:e.count<33900&&(n=1131);const g=s[--a]+n;if(g<0||g>=e.count||isNaN(g))return o=Li[r],S("Out of bounds subrIndex for "+o.id),!1;if(A.stackSize=a,A.callDepth++,!this.parseCharString(A,e.get(g),t,i))return!1;A.callDepth--,a=A.stackSize;continue}if(11===r)return A.stackSize=a,!0;if(0===r&&g===e.length)e[g-1]=14,o=Li[14];else{if(9===r){e.copyWithin(g-1,g,-1),g-=1,n-=1;continue}o=Li[r]}}if(o){if(o.stem&&(A.hints+=a>>1,3===r||23===r?A.hasVStems=!0:!A.hasVStems||1!==r&&18!==r||(S("CFF stem hints are in wrong order"),e[g-1]=1===r?3:23)),"min"in o&&!A.undefStack&&a=2&&o.stem?a%=2:a>1&&S("Found too many parameters for stack-clearing command"),a>0&&(A.width=s[a-1])),"stackDelta"in o?("stackFn"in o&&o.stackFn(s,a),a+=o.stackDelta):o.stackClearing?a=0:o.resetStack?(a=0,A.undefStack=!1):o.undefStack&&(a=0,A.undefStack=!0,A.firstStackClearing=!1)}}return n=a.length&&(S("Invalid fd index for glyph index."),c=!1),c&&(B=a[A].privateDict,C=B.subrsIndex)}else e&&(C=e);if(c&&(c=this.parseCharString(I,r,C,t)),null!==I.width){const A=B.getByName("nominalWidthX");g[o]=A+I.width}else{const A=B.getByName("defaultWidthX");g[o]=A}null!==I.seac&&(n[o]=I.seac),c||A.set(o,new Uint8Array([14]))}return{charStrings:A,seacs:n,widths:g}}emptyPrivateDictionary(A){const e=this.createDict(Oi,[],A.strings);A.setByKey(18,[0,0]),A.privateDict=e}parsePrivateDict(A){if(!A.hasName("Private"))return void this.emptyPrivateDictionary(A);const e=A.getByName("Private");if(!Array.isArray(e)||2!==e.length)return void A.removeByName("Private");const t=e[0],i=e[1];if(0===t||i>=this.bytes.length)return void this.emptyPrivateDictionary(A);const a=i+t,s=this.bytes.subarray(i,a),n=this.parseDict(s),g=this.createDict(Oi,n,A.strings);if(A.privateDict=g,0===g.getByName("ExpansionFactor")&&g.setByName("ExpansionFactor",.06),!g.getByName("Subrs"))return;const r=g.getByName("Subrs"),o=i+r;if(0===r||o>=this.bytes.length)return void this.emptyPrivateDictionary(A);const I=this.parseIndex(o);g.subrsIndex=I.obj}parseCharsets(A,e,t,i){if(0===A)return new Vi(!0,Xi.ISO_ADOBE,wi);if(1===A)return new Vi(!0,Xi.EXPERT,Di);if(2===A)return new Vi(!0,Xi.EXPERT_SUBSET,bi);const a=this.bytes,s=A,n=a[A++],g=[i?0:".notdef"];let r,o,I;switch(e-=1,n){case 0:for(I=0;I=65535)return void S("Not enough space in charstrings to duplicate first glyph.");const A=this.charStrings.get(0);this.charStrings.add(A),this.isCIDFont&&this.fdSelect.fdSelect.push(this.fdSelect.fdSelect[0])}hasGlyphId(A){return!(A<0||A>=this.charStrings.count)&&this.charStrings.get(A).length>0}}class vi{constructor(A,e,t,i){this.major=A,this.minor=e,this.hdrSize=t,this.offSize=i}}class Ki{constructor(){this.strings=[]}get(A){return A>=0&&A<=390?Mi[A]:A-391<=this.strings.length?this.strings[A-391]:Mi[0]}getSID(A){let e=Mi.indexOf(A);return-1!==e?e:(e=this.strings.indexOf(A),-1!==e?e+391:-1)}add(A){this.strings.push(A)}get count(){return this.strings.length}}class qi{constructor(){this.objects=[],this.length=0}add(A){this.length+=A.length,this.objects.push(A)}set(A,e){this.length+=e.length-this.objects[A].length,this.objects[A]=e}get(A){return this.objects[A]}get count(){return this.objects.length}}class Ti{constructor(A,e){this.keyToNameMap=A.keyToNameMap,this.nameToKeyMap=A.nameToKeyMap,this.defaults=A.defaults,this.types=A.types,this.opcodes=A.opcodes,this.order=A.order,this.strings=e,this.values=Object.create(null)}setByKey(A,e){if(!(A in this.keyToNameMap))return!1;if(0===e.length)return!0;for(const t of e)if(isNaN(t))return S(`Invalid CFFDict value: "${e}" for key "${A}".`),!0;const t=this.types[A];return"num"!==t&&"sid"!==t&&"offset"!==t||(e=e[0]),this.values[A]=e,!0}setByName(A,e){if(!(A in this.nameToKeyMap))throw new v(`Invalid dictionary name "${A}"`);this.values[this.nameToKeyMap[A]]=e}hasName(A){return this.nameToKeyMap[A]in this.values}getByName(A){if(!(A in this.nameToKeyMap))throw new v(`Invalid dictionary name ${A}"`);const e=this.nameToKeyMap[A];return e in this.values?this.values[e]:this.defaults[e]}removeByName(A){delete this.values[this.nameToKeyMap[A]]}static createTables(A){const e={keyToNameMap:{},nameToKeyMap:{},defaults:{},types:{},opcodes:{},order:[]};for(const t of A){const A=Array.isArray(t[0])?(t[0][0]<<8)+t[0][1]:t[0];e.keyToNameMap[A]=t[1],e.nameToKeyMap[t[1]]=A,e.types[A]=t[2],e.defaults[A]=t[3],e.opcodes[A]=Array.isArray(t[0])?t[0]:[t[0]],e.order.push(A)}return e}}const Pi=[[[12,30],"ROS",["sid","sid","num"],null],[[12,20],"SyntheticBase","num",null],[0,"version","sid",null],[1,"Notice","sid",null],[[12,0],"Copyright","sid",null],[2,"FullName","sid",null],[3,"FamilyName","sid",null],[4,"Weight","sid",null],[[12,1],"isFixedPitch","num",0],[[12,2],"ItalicAngle","num",0],[[12,3],"UnderlinePosition","num",-100],[[12,4],"UnderlineThickness","num",50],[[12,5],"PaintType","num",0],[[12,6],"CharstringType","num",2],[[12,7],"FontMatrix",["num","num","num","num","num","num"],[.001,0,0,.001,0,0]],[13,"UniqueID","num",null],[5,"FontBBox",["num","num","num","num"],[0,0,0,0]],[[12,8],"StrokeWidth","num",0],[14,"XUID","array",null],[15,"charset","offset",0],[16,"Encoding","offset",0],[17,"CharStrings","offset",0],[18,"Private",["offset","offset"],null],[[12,21],"PostScript","sid",null],[[12,22],"BaseFontName","sid",null],[[12,23],"BaseFontBlend","delta",null],[[12,31],"CIDFontVersion","num",0],[[12,32],"CIDFontRevision","num",0],[[12,33],"CIDFontType","num",0],[[12,34],"CIDCount","num",8720],[[12,35],"UIDBase","num",null],[[12,37],"FDSelect","offset",null],[[12,36],"FDArray","offset",null],[[12,38],"FontName","sid",null]];class Wi extends Ti{static get tables(){return x(this,"tables",this.createTables(Pi))}constructor(A){super(Wi.tables,A),this.privateDict=null}}const Zi=[[6,"BlueValues","delta",null],[7,"OtherBlues","delta",null],[8,"FamilyBlues","delta",null],[9,"FamilyOtherBlues","delta",null],[[12,9],"BlueScale","num",.039625],[[12,10],"BlueShift","num",7],[[12,11],"BlueFuzz","num",1],[10,"StdHW","num",null],[11,"StdVW","num",null],[[12,12],"StemSnapH","delta",null],[[12,13],"StemSnapV","delta",null],[[12,14],"ForceBold","num",0],[[12,17],"LanguageGroup","num",0],[[12,18],"ExpansionFactor","num",.06],[[12,19],"initialRandomSeed","num",0],[20,"defaultWidthX","num",0],[21,"nominalWidthX","num",0],[19,"Subrs","offset",null]];class Oi extends Ti{static get tables(){return x(this,"tables",this.createTables(Zi))}constructor(A){super(Oi.tables,A),this.subrsIndex=null}}const Xi={ISO_ADOBE:0,EXPERT:1,EXPERT_SUBSET:2};class Vi{constructor(A,e,t,i){this.predefined=A,this.format=e,this.charset=t,this.raw=i}}class ji{constructor(A,e,t,i){this.predefined=A,this.format=e,this.encoding=t,this.raw=i}}class zi{constructor(A,e){this.format=A,this.fdSelect=e}getFDIndex(A){return A<0||A>=this.fdSelect.length?-1:this.fdSelect[A]}}class _i{constructor(){this.offsets=Object.create(null)}isTracking(A){return A in this.offsets}track(A,e){if(A in this.offsets)throw new v(`Already tracking location of ${A}`);this.offsets[A]=e}offset(A){for(const e in this.offsets)this.offsets[e]+=A}setEntryLocation(A,e,t){if(!(A in this.offsets))throw new v(`Not tracking location of ${A}`);const i=t.data,a=this.offsets[A];for(let A=0,t=e.length;A>24&255,i[n]=o>>16&255,i[g]=o>>8&255,i[r]=255&o}}}class $i{constructor(A){this.cff=A}compile(){const A=this.cff,e={data:[],length:0,add(A){try{this.data.push(...A)}catch{this.data=this.data.concat(A)}this.length=this.data.length}},t=this.compileHeader(A.header);e.add(t);const i=this.compileNameIndex(A.names);if(e.add(i),A.isCIDFont&&A.topDict.hasName("FontMatrix")){const e=A.topDict.getByName("FontMatrix");A.topDict.removeByName("FontMatrix");for(const t of A.fdArray){let A=e.slice(0);t.hasName("FontMatrix")&&(A=X.transform(A,t.getByName("FontMatrix"))),t.setByName("FontMatrix",A)}}const a=A.topDict.getByName("XUID");a?.length>16&&A.topDict.removeByName("XUID"),A.topDict.setByName("charset",0);let s=this.compileTopDicts([A.topDict],e.length,A.isCIDFont);e.add(s.output);const n=s.trackers[0],g=this.compileStringIndex(A.strings.strings);e.add(g);const r=this.compileIndex(A.globalSubrIndex);if(e.add(r),A.encoding&&A.topDict.hasName("Encoding"))if(A.encoding.predefined)n.setEntryLocation("Encoding",[A.encoding.format],e);else{const t=this.compileEncoding(A.encoding);n.setEntryLocation("Encoding",[e.length],e),e.add(t)}const o=this.compileCharset(A.charset,A.charStrings.count,A.strings,A.isCIDFont);n.setEntryLocation("charset",[e.length],e),e.add(o);const I=this.compileCharStrings(A.charStrings);if(n.setEntryLocation("CharStrings",[e.length],e),e.add(I),A.isCIDFont){n.setEntryLocation("FDSelect",[e.length],e);const t=this.compileFDSelect(A.fdSelect);e.add(t),s=this.compileTopDicts(A.fdArray,e.length,!0),n.setEntryLocation("FDArray",[e.length],e),e.add(s.output);const i=s.trackers;this.compilePrivateDicts(A.fdArray,i,e)}return this.compilePrivateDicts([A.topDict],[n],e),e.add([0]),e.data}encodeNumber(A){return Number.isInteger(A)?this.encodeInteger(A):this.encodeFloat(A)}static get EncodeFloatRegExp(){return x(this,"EncodeFloatRegExp",/\.(\d*?)(?:9{5,20}|0{5,20})\d{0,2}(?:e(.+)|$)/)}encodeFloat(A){let e=A.toString();const t=$i.EncodeFloatRegExp.exec(e);if(t){const i=parseFloat("1e"+((t[2]?+t[2]:0)+t[1].length));e=(Math.round(A*i)/i).toString()}let i,a,s="";for(i=0,a=e.length;i=-107&&A<=107?[A+139]:A>=108&&A<=1131?[247+((A-=108)>>8),255&A]:A>=-1131&&A<=-108?[251+((A=-A-108)>>8),255&A]:A>=-32768&&A<=32767?[28,A>>8&255,255&A]:[29,A>>24&255,A>>16&255,A>>8&255,255&A],e}compileHeader(A){return[A.major,A.minor,4,A.offSize]}compileNameIndex(A){const e=new qi;for(const t of A){const A=Math.min(t.length,127);let i=new Array(A);for(let e=0;e"~"||"["===A||"]"===A||"("===A||")"===A||"{"===A||"}"===A||"<"===A||">"===A||"/"===A||"%"===A)&&(A="_"),i[e]=A}i=i.join(""),""===i&&(i="Bad_Font_Name"),e.add(T(i))}return this.compileIndex(e)}compileTopDicts(A,e,t){const i=[];let a=new qi;for(const s of A){t&&(s.removeByName("CIDFontVersion"),s.removeByName("CIDFontRevision"),s.removeByName("CIDFontType"),s.removeByName("CIDCount"),s.removeByName("UIDBase"));const A=new _i,n=this.compileDict(s,A);i.push(A),a.add(n),A.offset(e)}return a=this.compileIndex(a,i),{trackers:i,output:a}}compilePrivateDicts(A,e,t){for(let i=0,a=A.length;i>8&255,255&s]);else{a=new Uint8Array(1+2*s),a[0]=0;let e=0;const i=A.charset.length;let n=!1;for(let s=1;s>8&255,a[s+1]=255&g}}return this.compileTypedArray(a)}compileEncoding(A){return this.compileTypedArray(A.raw)}compileFDSelect(A){const e=A.format;let t,i;switch(e){case 0:for(t=new Uint8Array(1+A.fdSelect.length),t[0]=e,i=0;i>8&255,255&a,s];for(i=1;i>8&255,255&i,e),s=e)}const g=(n.length-3)/3;n[1]=g>>8&255,n[2]=255&g,n.push(i>>8&255,255&i),t=new Uint8Array(n)}return this.compileTypedArray(t)}compileTypedArray(A){return Array.from(A)}compileIndex(A,e=[]){const t=A.objects,i=t.length;if(0===i)return[0,0];const a=[i>>8&255,255&i];let s,n,g=1;for(s=0;s>8&255,255&r):3===n?a.push(r>>16&255,r>>8&255,255&r):a.push(r>>>24&255,r>>16&255,r>>8&255,255&r),t[s]&&(r+=t[s].length);for(s=0;s=5&&e<=7))return-1;i=A.substring(1)}if(i===i.toUpperCase()&&(t=parseInt(i,16),t>=0))return t}return-1}const aa=[[0,127],[128,255],[256,383],[384,591],[592,687,7424,7551,7552,7615],[688,767,42752,42783],[768,879,7616,7679],[880,1023],[11392,11519],[1024,1279,1280,1327,11744,11775,42560,42655],[1328,1423],[1424,1535],[42240,42559],[1536,1791,1872,1919],[1984,2047],[2304,2431],[2432,2559],[2560,2687],[2688,2815],[2816,2943],[2944,3071],[3072,3199],[3200,3327],[3328,3455],[3584,3711],[3712,3839],[4256,4351,11520,11567],[6912,7039],[4352,4607],[7680,7935,11360,11391,42784,43007],[7936,8191],[8192,8303,11776,11903],[8304,8351],[8352,8399],[8400,8447],[8448,8527],[8528,8591],[8592,8703,10224,10239,10496,10623,11008,11263],[8704,8959,10752,11007,10176,10223,10624,10751],[8960,9215],[9216,9279],[9280,9311],[9312,9471],[9472,9599],[9600,9631],[9632,9727],[9728,9983],[9984,10175],[12288,12351],[12352,12447],[12448,12543,12784,12799],[12544,12591,12704,12735],[12592,12687],[43072,43135],[12800,13055],[13056,13311],[44032,55215],[55296,57343],[67840,67871],[19968,40959,11904,12031,12032,12255,12272,12287,13312,19903,131072,173791,12688,12703],[57344,63743],[12736,12783,63744,64255,194560,195103],[64256,64335],[64336,65023],[65056,65071],[65040,65055],[65104,65135],[65136,65279],[65280,65519],[65520,65535],[3840,4095],[1792,1871],[1920,1983],[3456,3583],[4096,4255],[4608,4991,4992,5023,11648,11743],[5024,5119],[5120,5759],[5760,5791],[5792,5887],[6016,6143],[6144,6319],[10240,10495],[40960,42127],[5888,5919,5920,5951,5952,5983,5984,6015],[66304,66351],[66352,66383],[66560,66639],[118784,119039,119040,119295,119296,119375],[119808,120831],[1044480,1048573],[65024,65039,917760,917999],[917504,917631],[6400,6479],[6480,6527],[6528,6623],[6656,6687],[11264,11359],[11568,11647],[19904,19967],[43008,43055],[65536,65663,65664,65791,65792,65855],[65856,65935],[66432,66463],[66464,66527],[66640,66687],[66688,66735],[67584,67647],[68096,68191],[119552,119647],[73728,74751,74752,74879],[119648,119679],[7040,7103],[7168,7247],[7248,7295],[43136,43231],[43264,43311],[43312,43359],[43520,43615],[65936,65999],[66e3,66047],[66208,66271,66176,66207,67872,67903],[127024,127135,126976,127023]];function sa(A,e=-1){if(-1!==e){const t=aa[e];for(let i=0,a=t.length;i=t[i]&&A<=t[i+1])return e}for(let e=0,t=aa.length;e=t[i]&&A<=t[i+1])return e}return-1}const na=new RegExp("^(\\s)|(\\p{Mn})|(\\p{Cf})$","u"),ga=new Map,ra=!0,oa=[".notdef",".null","nonmarkingreturn","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quotesingle","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","grave","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","Adieresis","Aring","Ccedilla","Eacute","Ntilde","Odieresis","Udieresis","aacute","agrave","acircumflex","adieresis","atilde","aring","ccedilla","eacute","egrave","ecircumflex","edieresis","iacute","igrave","icircumflex","idieresis","ntilde","oacute","ograve","ocircumflex","odieresis","otilde","uacute","ugrave","ucircumflex","udieresis","dagger","degree","cent","sterling","section","bullet","paragraph","germandbls","registered","copyright","trademark","acute","dieresis","notequal","AE","Oslash","infinity","plusminus","lessequal","greaterequal","yen","mu","partialdiff","summation","product","pi","integral","ordfeminine","ordmasculine","Omega","ae","oslash","questiondown","exclamdown","logicalnot","radical","florin","approxequal","Delta","guillemotleft","guillemotright","ellipsis","nonbreakingspace","Agrave","Atilde","Otilde","OE","oe","endash","emdash","quotedblleft","quotedblright","quoteleft","quoteright","divide","lozenge","ydieresis","Ydieresis","fraction","currency","guilsinglleft","guilsinglright","fi","fl","daggerdbl","periodcentered","quotesinglbase","quotedblbase","perthousand","Acircumflex","Ecircumflex","Aacute","Edieresis","Egrave","Iacute","Icircumflex","Idieresis","Igrave","Oacute","Ocircumflex","apple","Ograve","Uacute","Ucircumflex","Ugrave","dotlessi","circumflex","tilde","macron","breve","dotaccent","ring","cedilla","hungarumlaut","ogonek","caron","Lslash","lslash","Scaron","scaron","Zcaron","zcaron","brokenbar","Eth","eth","Yacute","yacute","Thorn","thorn","minus","multiply","onesuperior","twosuperior","threesuperior","onehalf","onequarter","threequarters","franc","Gbreve","gbreve","Idotaccent","Scedilla","scedilla","Cacute","cacute","Ccaron","ccaron","dcroat"];function Ia(A,e){if(void 0!==e[A])return A;const t=ia(A,e);if(-1!==t)for(const A in e)if(e[A]===t)return A;return F("Unable to recover a standard glyph name for: "+A),A}function ca(A,e,t){const i=Object.create(null);let a,s,n;const g=!!(4&A.flags);if(A.isInternalFont)for(n=e,s=0;s=0?a:0;else if(A.baseEncodingName)for(n=Ui(A.baseEncodingName),s=0;s=0?a:0;else if(g)for(s in e)i[s]=e[s];else for(n=Ri,s=0;s=0?a:0;const r=A.differences;let o;if(r)for(s in r){const A=r[s];if(a=t.indexOf(A),-1===a){o||(o=Aa());const e=Ia(A,o);e!==A&&(a=t.indexOf(e))}i[s]=a>=0?a:0}return i}function Ca(A){return A.replaceAll(/[,_]/g,"-").replaceAll(/\s/g,"")}const Ba=pA((A=>{A[8211]=65074,A[8212]=65073,A[8229]=65072,A[8230]=65049,A[12289]=65041,A[12290]=65042,A[12296]=65087,A[12297]=65088,A[12298]=65085,A[12299]=65086,A[12300]=65089,A[12301]=65090,A[12302]=65091,A[12303]=65092,A[12304]=65083,A[12305]=65084,A[12308]=65081,A[12309]=65082,A[12310]=65047,A[12311]=65048,A[65103]=65076,A[65281]=65045,A[65288]=65077,A[65289]=65078,A[65292]=65040,A[65306]=65043,A[65307]=65044,A[65311]=65046,A[65339]=65095,A[65341]=65096,A[65343]=65075,A[65371]=65079,A[65373]=65080})),ha=pA((function(A){A["Times-Roman"]="Times-Roman",A.Helvetica="Helvetica",A.Courier="Courier",A.Symbol="Symbol",A["Times-Bold"]="Times-Bold",A["Helvetica-Bold"]="Helvetica-Bold",A["Courier-Bold"]="Courier-Bold",A.ZapfDingbats="ZapfDingbats",A["Times-Italic"]="Times-Italic",A["Helvetica-Oblique"]="Helvetica-Oblique",A["Courier-Oblique"]="Courier-Oblique",A["Times-BoldItalic"]="Times-BoldItalic",A["Helvetica-BoldOblique"]="Helvetica-BoldOblique",A["Courier-BoldOblique"]="Courier-BoldOblique",A.ArialNarrow="Helvetica",A["ArialNarrow-Bold"]="Helvetica-Bold",A["ArialNarrow-BoldItalic"]="Helvetica-BoldOblique",A["ArialNarrow-Italic"]="Helvetica-Oblique",A.ArialBlack="Helvetica",A["ArialBlack-Bold"]="Helvetica-Bold",A["ArialBlack-BoldItalic"]="Helvetica-BoldOblique",A["ArialBlack-Italic"]="Helvetica-Oblique",A["Arial-Black"]="Helvetica",A["Arial-Black-Bold"]="Helvetica-Bold",A["Arial-Black-BoldItalic"]="Helvetica-BoldOblique",A["Arial-Black-Italic"]="Helvetica-Oblique",A.Arial="Helvetica",A["Arial-Bold"]="Helvetica-Bold",A["Arial-BoldItalic"]="Helvetica-BoldOblique",A["Arial-Italic"]="Helvetica-Oblique",A.ArialMT="Helvetica",A["Arial-BoldItalicMT"]="Helvetica-BoldOblique",A["Arial-BoldMT"]="Helvetica-Bold",A["Arial-ItalicMT"]="Helvetica-Oblique",A["Arial-BoldItalicMT-BoldItalic"]="Helvetica-BoldOblique",A["Arial-BoldMT-Bold"]="Helvetica-Bold",A["Arial-ItalicMT-Italic"]="Helvetica-Oblique",A.ArialUnicodeMS="Helvetica",A["ArialUnicodeMS-Bold"]="Helvetica-Bold",A["ArialUnicodeMS-BoldItalic"]="Helvetica-BoldOblique",A["ArialUnicodeMS-Italic"]="Helvetica-Oblique",A["Courier-BoldItalic"]="Courier-BoldOblique",A["Courier-Italic"]="Courier-Oblique",A.CourierNew="Courier",A["CourierNew-Bold"]="Courier-Bold",A["CourierNew-BoldItalic"]="Courier-BoldOblique",A["CourierNew-Italic"]="Courier-Oblique",A["CourierNewPS-BoldItalicMT"]="Courier-BoldOblique",A["CourierNewPS-BoldMT"]="Courier-Bold",A["CourierNewPS-ItalicMT"]="Courier-Oblique",A.CourierNewPSMT="Courier",A["Helvetica-BoldItalic"]="Helvetica-BoldOblique",A["Helvetica-Italic"]="Helvetica-Oblique",A["Symbol-Bold"]="Symbol",A["Symbol-BoldItalic"]="Symbol",A["Symbol-Italic"]="Symbol",A.TimesNewRoman="Times-Roman",A["TimesNewRoman-Bold"]="Times-Bold",A["TimesNewRoman-BoldItalic"]="Times-BoldItalic",A["TimesNewRoman-Italic"]="Times-Italic",A.TimesNewRomanPS="Times-Roman",A["TimesNewRomanPS-Bold"]="Times-Bold",A["TimesNewRomanPS-BoldItalic"]="Times-BoldItalic",A["TimesNewRomanPS-BoldItalicMT"]="Times-BoldItalic",A["TimesNewRomanPS-BoldMT"]="Times-Bold",A["TimesNewRomanPS-Italic"]="Times-Italic",A["TimesNewRomanPS-ItalicMT"]="Times-Italic",A.TimesNewRomanPSMT="Times-Roman",A["TimesNewRomanPSMT-Bold"]="Times-Bold",A["TimesNewRomanPSMT-BoldItalic"]="Times-BoldItalic",A["TimesNewRomanPSMT-Italic"]="Times-Italic"})),Qa=pA((function(A){A.Courier="FoxitFixed.pfb",A["Courier-Bold"]="FoxitFixedBold.pfb",A["Courier-BoldOblique"]="FoxitFixedBoldItalic.pfb",A["Courier-Oblique"]="FoxitFixedItalic.pfb",A.Helvetica="LiberationSans-Regular.ttf",A["Helvetica-Bold"]="LiberationSans-Bold.ttf",A["Helvetica-BoldOblique"]="LiberationSans-BoldItalic.ttf",A["Helvetica-Oblique"]="LiberationSans-Italic.ttf",A["Times-Roman"]="FoxitSerif.pfb",A["Times-Bold"]="FoxitSerifBold.pfb",A["Times-BoldItalic"]="FoxitSerifBoldItalic.pfb",A["Times-Italic"]="FoxitSerifItalic.pfb",A.Symbol="FoxitSymbol.pfb",A.ZapfDingbats="FoxitDingbats.pfb",A["LiberationSans-Regular"]="LiberationSans-Regular.ttf",A["LiberationSans-Bold"]="LiberationSans-Bold.ttf",A["LiberationSans-Italic"]="LiberationSans-Italic.ttf",A["LiberationSans-BoldItalic"]="LiberationSans-BoldItalic.ttf"})),la=pA((function(A){A.Calibri="Helvetica",A["Calibri-Bold"]="Helvetica-Bold",A["Calibri-BoldItalic"]="Helvetica-BoldOblique",A["Calibri-Italic"]="Helvetica-Oblique",A.CenturyGothic="Helvetica",A["CenturyGothic-Bold"]="Helvetica-Bold",A["CenturyGothic-BoldItalic"]="Helvetica-BoldOblique",A["CenturyGothic-Italic"]="Helvetica-Oblique",A.ComicSansMS="Comic Sans MS",A["ComicSansMS-Bold"]="Comic Sans MS-Bold",A["ComicSansMS-BoldItalic"]="Comic Sans MS-BoldItalic",A["ComicSansMS-Italic"]="Comic Sans MS-Italic",A.Impact="Helvetica",A["ItcSymbol-Bold"]="Helvetica-Bold",A["ItcSymbol-BoldItalic"]="Helvetica-BoldOblique",A["ItcSymbol-Book"]="Helvetica",A["ItcSymbol-BookItalic"]="Helvetica-Oblique",A["ItcSymbol-Medium"]="Helvetica",A["ItcSymbol-MediumItalic"]="Helvetica-Oblique",A.LucidaConsole="Courier",A["LucidaConsole-Bold"]="Courier-Bold",A["LucidaConsole-BoldItalic"]="Courier-BoldOblique",A["LucidaConsole-Italic"]="Courier-Oblique",A["LucidaSans-Demi"]="Helvetica-Bold",A["MS-Gothic"]="MS Gothic",A["MS-Gothic-Bold"]="MS Gothic-Bold",A["MS-Gothic-BoldItalic"]="MS Gothic-BoldItalic",A["MS-Gothic-Italic"]="MS Gothic-Italic",A["MS-Mincho"]="MS Mincho",A["MS-Mincho-Bold"]="MS Mincho-Bold",A["MS-Mincho-BoldItalic"]="MS Mincho-BoldItalic",A["MS-Mincho-Italic"]="MS Mincho-Italic",A["MS-PGothic"]="MS PGothic",A["MS-PGothic-Bold"]="MS PGothic-Bold",A["MS-PGothic-BoldItalic"]="MS PGothic-BoldItalic",A["MS-PGothic-Italic"]="MS PGothic-Italic",A["MS-PMincho"]="MS PMincho",A["MS-PMincho-Bold"]="MS PMincho-Bold",A["MS-PMincho-BoldItalic"]="MS PMincho-BoldItalic",A["MS-PMincho-Italic"]="MS PMincho-Italic",A.NuptialScript="Times-Italic",A.SegoeUISymbol="Helvetica"})),Ea=pA((function(A){A["Adobe Jenson"]=!0,A["Adobe Text"]=!0,A.Albertus=!0,A.Aldus=!0,A.Alexandria=!0,A.Algerian=!0,A["American Typewriter"]=!0,A.Antiqua=!0,A.Apex=!0,A.Arno=!0,A.Aster=!0,A.Aurora=!0,A.Baskerville=!0,A.Bell=!0,A.Bembo=!0,A["Bembo Schoolbook"]=!0,A.Benguiat=!0,A["Berkeley Old Style"]=!0,A["Bernhard Modern"]=!0,A["Berthold City"]=!0,A.Bodoni=!0,A["Bauer Bodoni"]=!0,A["Book Antiqua"]=!0,A.Bookman=!0,A["Bordeaux Roman"]=!0,A["Californian FB"]=!0,A.Calisto=!0,A.Calvert=!0,A.Capitals=!0,A.Cambria=!0,A.Cartier=!0,A.Caslon=!0,A.Catull=!0,A.Centaur=!0,A["Century Old Style"]=!0,A["Century Schoolbook"]=!0,A.Chaparral=!0,A["Charis SIL"]=!0,A.Cheltenham=!0,A["Cholla Slab"]=!0,A.Clarendon=!0,A.Clearface=!0,A.Cochin=!0,A.Colonna=!0,A["Computer Modern"]=!0,A["Concrete Roman"]=!0,A.Constantia=!0,A["Cooper Black"]=!0,A.Corona=!0,A.Ecotype=!0,A.Egyptienne=!0,A.Elephant=!0,A.Excelsior=!0,A.Fairfield=!0,A["FF Scala"]=!0,A.Folkard=!0,A.Footlight=!0,A.FreeSerif=!0,A["Friz Quadrata"]=!0,A.Garamond=!0,A.Gentium=!0,A.Georgia=!0,A.Gloucester=!0,A["Goudy Old Style"]=!0,A["Goudy Schoolbook"]=!0,A["Goudy Pro Font"]=!0,A.Granjon=!0,A["Guardian Egyptian"]=!0,A.Heather=!0,A.Hercules=!0,A["High Tower Text"]=!0,A.Hiroshige=!0,A["Hoefler Text"]=!0,A["Humana Serif"]=!0,A.Imprint=!0,A["Ionic No. 5"]=!0,A.Janson=!0,A.Joanna=!0,A.Korinna=!0,A.Lexicon=!0,A.LiberationSerif=!0,A["Liberation Serif"]=!0,A["Linux Libertine"]=!0,A.Literaturnaya=!0,A.Lucida=!0,A["Lucida Bright"]=!0,A.Melior=!0,A.Memphis=!0,A.Miller=!0,A.Minion=!0,A.Modern=!0,A["Mona Lisa"]=!0,A["Mrs Eaves"]=!0,A["MS Serif"]=!0,A["Museo Slab"]=!0,A["New York"]=!0,A["Nimbus Roman"]=!0,A["NPS Rawlinson Roadway"]=!0,A.NuptialScript=!0,A.Palatino=!0,A.Perpetua=!0,A.Plantin=!0,A["Plantin Schoolbook"]=!0,A.Playbill=!0,A["Poor Richard"]=!0,A["Rawlinson Roadway"]=!0,A.Renault=!0,A.Requiem=!0,A.Rockwell=!0,A.Roman=!0,A["Rotis Serif"]=!0,A.Sabon=!0,A.Scala=!0,A.Seagull=!0,A.Sistina=!0,A.Souvenir=!0,A.STIX=!0,A["Stone Informal"]=!0,A["Stone Serif"]=!0,A.Sylfaen=!0,A.Times=!0,A.Trajan=!0,A["Trinité"]=!0,A["Trump Mediaeval"]=!0,A.Utopia=!0,A["Vale Type"]=!0,A["Bitstream Vera"]=!0,A["Vera Serif"]=!0,A.Versailles=!0,A.Wanted=!0,A.Weiss=!0,A["Wide Latin"]=!0,A.Windsor=!0,A.XITS=!0})),ua=pA((function(A){A.Dingbats=!0,A.Symbol=!0,A.ZapfDingbats=!0,A.Wingdings=!0,A["Wingdings-Bold"]=!0,A["Wingdings-Regular"]=!0})),da=pA((function(A){A[2]=10,A[3]=32,A[4]=33,A[5]=34,A[6]=35,A[7]=36,A[8]=37,A[9]=38,A[10]=39,A[11]=40,A[12]=41,A[13]=42,A[14]=43,A[15]=44,A[16]=45,A[17]=46,A[18]=47,A[19]=48,A[20]=49,A[21]=50,A[22]=51,A[23]=52,A[24]=53,A[25]=54,A[26]=55,A[27]=56,A[28]=57,A[29]=58,A[30]=894,A[31]=60,A[32]=61,A[33]=62,A[34]=63,A[35]=64,A[36]=65,A[37]=66,A[38]=67,A[39]=68,A[40]=69,A[41]=70,A[42]=71,A[43]=72,A[44]=73,A[45]=74,A[46]=75,A[47]=76,A[48]=77,A[49]=78,A[50]=79,A[51]=80,A[52]=81,A[53]=82,A[54]=83,A[55]=84,A[56]=85,A[57]=86,A[58]=87,A[59]=88,A[60]=89,A[61]=90,A[62]=91,A[63]=92,A[64]=93,A[65]=94,A[66]=95,A[67]=96,A[68]=97,A[69]=98,A[70]=99,A[71]=100,A[72]=101,A[73]=102,A[74]=103,A[75]=104,A[76]=105,A[77]=106,A[78]=107,A[79]=108,A[80]=109,A[81]=110,A[82]=111,A[83]=112,A[84]=113,A[85]=114,A[86]=115,A[87]=116,A[88]=117,A[89]=118,A[90]=119,A[91]=120,A[92]=121,A[93]=122,A[94]=123,A[95]=124,A[96]=125,A[97]=126,A[98]=196,A[99]=197,A[100]=199,A[101]=201,A[102]=209,A[103]=214,A[104]=220,A[105]=225,A[106]=224,A[107]=226,A[108]=228,A[109]=227,A[110]=229,A[111]=231,A[112]=233,A[113]=232,A[114]=234,A[115]=235,A[116]=237,A[117]=236,A[118]=238,A[119]=239,A[120]=241,A[121]=243,A[122]=242,A[123]=244,A[124]=246,A[125]=245,A[126]=250,A[127]=249,A[128]=251,A[129]=252,A[130]=8224,A[131]=176,A[132]=162,A[133]=163,A[134]=167,A[135]=8226,A[136]=182,A[137]=223,A[138]=174,A[139]=169,A[140]=8482,A[141]=180,A[142]=168,A[143]=8800,A[144]=198,A[145]=216,A[146]=8734,A[147]=177,A[148]=8804,A[149]=8805,A[150]=165,A[151]=181,A[152]=8706,A[153]=8721,A[154]=8719,A[156]=8747,A[157]=170,A[158]=186,A[159]=8486,A[160]=230,A[161]=248,A[162]=191,A[163]=161,A[164]=172,A[165]=8730,A[166]=402,A[167]=8776,A[168]=8710,A[169]=171,A[170]=187,A[171]=8230,A[179]=8220,A[180]=8221,A[181]=8216,A[182]=8217,A[200]=193,A[203]=205,A[207]=211,A[210]=218,A[223]=711,A[224]=321,A[225]=322,A[226]=352,A[227]=353,A[228]=381,A[229]=382,A[233]=221,A[234]=253,A[252]=263,A[253]=268,A[254]=269,A[258]=258,A[260]=260,A[261]=261,A[265]=280,A[266]=281,A[267]=282,A[268]=283,A[269]=313,A[275]=323,A[276]=324,A[278]=328,A[283]=344,A[284]=345,A[285]=346,A[286]=347,A[292]=367,A[295]=377,A[296]=378,A[298]=380,A[305]=963,A[306]=964,A[307]=966,A[308]=8215,A[309]=8252,A[310]=8319,A[311]=8359,A[312]=8592,A[313]=8593,A[337]=9552,A[493]=1039,A[494]=1040,A[672]=1488,A[673]=1489,A[674]=1490,A[675]=1491,A[676]=1492,A[677]=1493,A[678]=1494,A[679]=1495,A[680]=1496,A[681]=1497,A[682]=1498,A[683]=1499,A[684]=1500,A[685]=1501,A[686]=1502,A[687]=1503,A[688]=1504,A[689]=1505,A[690]=1506,A[691]=1507,A[692]=1508,A[693]=1509,A[694]=1510,A[695]=1511,A[696]=1512,A[697]=1513,A[698]=1514,A[705]=1524,A[706]=8362,A[710]=64288,A[711]=64298,A[759]=1617,A[761]=1776,A[763]=1778,A[775]=1652,A[777]=1764,A[778]=1780,A[779]=1781,A[780]=1782,A[782]=771,A[783]=64726,A[786]=8363,A[788]=8532,A[790]=768,A[791]=769,A[792]=768,A[795]=803,A[797]=64336,A[798]=64337,A[799]=64342,A[800]=64343,A[801]=64344,A[802]=64345,A[803]=64362,A[804]=64363,A[805]=64364,A[2424]=7821,A[2425]=7822,A[2426]=7823,A[2427]=7824,A[2428]=7825,A[2429]=7826,A[2430]=7827,A[2433]=7682,A[2678]=8045,A[2679]=8046,A[2830]=1552,A[2838]=686,A[2840]=751,A[2842]=753,A[2843]=754,A[2844]=755,A[2846]=757,A[2856]=767,A[2857]=848,A[2858]=849,A[2862]=853,A[2863]=854,A[2864]=855,A[2865]=861,A[2866]=862,A[2906]=7460,A[2908]=7462,A[2909]=7463,A[2910]=7464,A[2912]=7466,A[2913]=7467,A[2914]=7468,A[2916]=7470,A[2917]=7471,A[2918]=7472,A[2920]=7474,A[2921]=7475,A[2922]=7476,A[2924]=7478,A[2925]=7479,A[2926]=7480,A[2928]=7482,A[2929]=7483,A[2930]=7484,A[2932]=7486,A[2933]=7487,A[2934]=7488,A[2936]=7490,A[2937]=7491,A[2938]=7492,A[2940]=7494,A[2941]=7495,A[2942]=7496,A[2944]=7498,A[2946]=7500,A[2948]=7502,A[2950]=7504,A[2951]=7505,A[2952]=7506,A[2954]=7508,A[2955]=7509,A[2956]=7510,A[2958]=7512,A[2959]=7513,A[2960]=7514,A[2962]=7516,A[2963]=7517,A[2964]=7518,A[2966]=7520,A[2967]=7521,A[2968]=7522,A[2970]=7524,A[2971]=7525,A[2972]=7526,A[2974]=7528,A[2975]=7529,A[2976]=7530,A[2978]=1537,A[2979]=1538,A[2980]=1539,A[2982]=1549,A[2983]=1551,A[2984]=1552,A[2986]=1554,A[2987]=1555,A[2988]=1556,A[2990]=1623,A[2991]=1624,A[2995]=1775,A[2999]=1791,A[3002]=64290,A[3003]=64291,A[3004]=64292,A[3006]=64294,A[3007]=64295,A[3008]=64296,A[3011]=1900,A[3014]=8223,A[3015]=8244,A[3017]=7532,A[3018]=7533,A[3019]=7534,A[3075]=7590,A[3076]=7591,A[3079]=7594,A[3080]=7595,A[3083]=7598,A[3084]=7599,A[3087]=7602,A[3088]=7603,A[3091]=7606,A[3092]=7607,A[3095]=7610,A[3096]=7611,A[3099]=7614,A[3100]=7615,A[3103]=7618,A[3104]=7619,A[3107]=8337,A[3108]=8338,A[3116]=1884,A[3119]=1885,A[3120]=1885,A[3123]=1886,A[3124]=1886,A[3127]=1887,A[3128]=1887,A[3131]=1888,A[3132]=1888,A[3135]=1889,A[3136]=1889,A[3139]=1890,A[3140]=1890,A[3143]=1891,A[3144]=1891,A[3147]=1892,A[3148]=1892,A[3153]=580,A[3154]=581,A[3157]=584,A[3158]=585,A[3161]=588,A[3162]=589,A[3165]=891,A[3166]=892,A[3169]=1274,A[3170]=1275,A[3173]=1278,A[3174]=1279,A[3181]=7622,A[3182]=7623,A[3282]=11799,A[3316]=578,A[3379]=42785,A[3393]=1159,A[3416]=8377})),fa=pA((function(A){A[227]=322,A[264]=261,A[291]=346})),pa=pA((function(A){A[1]=32,A[4]=65,A[5]=192,A[6]=193,A[9]=196,A[17]=66,A[18]=67,A[21]=268,A[24]=68,A[28]=69,A[29]=200,A[30]=201,A[32]=282,A[38]=70,A[39]=71,A[44]=72,A[47]=73,A[48]=204,A[49]=205,A[58]=74,A[60]=75,A[62]=76,A[68]=77,A[69]=78,A[75]=79,A[76]=210,A[80]=214,A[87]=80,A[89]=81,A[90]=82,A[92]=344,A[94]=83,A[97]=352,A[100]=84,A[104]=85,A[109]=220,A[115]=86,A[116]=87,A[121]=88,A[122]=89,A[124]=221,A[127]=90,A[129]=381,A[258]=97,A[259]=224,A[260]=225,A[263]=228,A[268]=261,A[271]=98,A[272]=99,A[273]=263,A[275]=269,A[282]=100,A[286]=101,A[287]=232,A[288]=233,A[290]=283,A[295]=281,A[296]=102,A[336]=103,A[346]=104,A[349]=105,A[350]=236,A[351]=237,A[361]=106,A[364]=107,A[367]=108,A[371]=322,A[373]=109,A[374]=110,A[381]=111,A[382]=242,A[383]=243,A[386]=246,A[393]=112,A[395]=113,A[396]=114,A[398]=345,A[400]=115,A[401]=347,A[403]=353,A[410]=116,A[437]=117,A[442]=252,A[448]=118,A[449]=119,A[454]=120,A[455]=121,A[457]=253,A[460]=122,A[462]=382,A[463]=380,A[853]=44,A[855]=58,A[856]=46,A[876]=47,A[878]=45,A[882]=45,A[894]=40,A[895]=41,A[896]=91,A[897]=93,A[923]=64,A[1004]=48,A[1005]=49,A[1006]=50,A[1007]=51,A[1008]=52,A[1009]=53,A[1010]=54,A[1011]=55,A[1012]=56,A[1013]=57,A[1081]=37,A[1085]=43,A[1086]=45}));function ma(A){const e=Ca(A);return ha()[e]}function ya(A){const e=Ca(A);return!!(ha()[e]||la()[e]||Ea()[e]||ua()[e])}class wa{constructor(A=[]){this._map=A}get length(){return this._map.length}forEach(A){for(const e in this._map)A(e,this._map[e].charCodeAt(0))}has(A){return void 0!==this._map[A]}get(A){return this._map[A]}charCodeOf(A){const e=this._map;if(e.length<=65536)return e.indexOf(A);for(const t in e)if(e[t]===A)return 0|t;return-1}amend(A){for(const e in A)this._map[e]=A[e]}}class Da{constructor(A,e){this.firstChar=A,this.lastChar=e}get length(){return this.lastChar+1-this.firstChar}forEach(A){for(let e=this.firstChar,t=this.lastChar;e<=t;e++)A(e,e)}has(A){return this.firstChar<=A&&A<=this.lastChar}get(A){if(this.firstChar<=A&&A<=this.lastChar)return String.fromCharCode(A)}charCodeOf(A){return Number.isInteger(A)&&A>=this.firstChar&&A<=this.lastChar?A:-1}amend(A){R("Should not call amend()")}}class ba{constructor(A,e){this.properties=e;const t=new Hi(A,e,ra);this.cff=t.parse(),this.cff.duplicateFirstGlyph();const i=new $i(this.cff);this.seacs=this.cff.seacs;try{this.data=i.compile()}catch{S("Failed to compile font "+e.loadedName),this.data=A}this._createBuiltInEncoding()}get numGlyphs(){return this.cff.charStrings.count}getCharset(){return this.cff.charset.charset}getGlyphMapping(){const A=this.cff,e=this.properties,{cidToGidMap:t,cMap:i}=e,a=A.charset.charset;let s,n;if(e.composite){let e,g;if(t?.length>0){e=Object.create(null);for(let A=0,i=t.length;A=0){const i=t[e];i&&(a[A]=i)}}a.length>0&&(this.properties.builtInEncoding=a)}}function ka(A,e){return(A[e]<<24|A[e+1]<<16|A[e+2]<<8|A[e+3])>>>0}function Fa(A,e){return A[e]<<8|A[e+1]}function Sa(A,e){return(A[e]<<24|A[e+1]<<16)>>16}function Ra(A,e){return A[e]<<24>>24}function Ga(A,e){return Sa(A,e)/16384}function Na(A){const e=A.length;let t=32768;return e<1240?t=107:e<33900&&(t=1131),t}function xa(A,e,t){const i=1===Fa(A,e+2)?ka(A,e+8):ka(A,e+16),a=Fa(A,e+i);let s,n,g;if(4===a){Fa(A,e+i+2);const t=Fa(A,e+i+6)>>1;for(n=e+i+14,s=[],g=0;g>1;t0;)B.push({flags:r})}for(t=0;t>1,m=!0;break;case 4:o+=g.pop(),a(r,o),m=!0;break;case 5:for(;g.length>0;)r+=g.shift(),o+=g.shift(),s(r,o);break;case 6:for(;g.length>0&&(r+=g.shift(),s(r,o),0!==g.length);)o+=g.shift(),s(r,o);break;case 7:for(;g.length>0&&(o+=g.shift(),s(r,o),0!==g.length);)r+=g.shift(),s(r,o);break;case 8:for(;g.length>0;)B=r+g.shift(),Q=o+g.shift(),h=B+g.shift(),l=Q+g.shift(),r=h+g.shift(),o=l+g.shift(),n(B,Q,h,l,r,o);break;case 10:if(f=g.pop(),p=null,t.isCFFCIDFont){const A=t.fdSelect.getFDIndex(i);if(A>=0&&AMath.abs(o-e)?r+=g.shift():o+=g.shift(),n(B,Q,h,l,r,o);break;default:throw new v(`unknown operator: 12 ${y}`)}break;case 14:if(g.length>=4){const A=g.pop(),i=g.pop();o=g.pop(),r=g.pop(),e.add(5),e.add(8,[r,o]);let a=Ma(t.cmap,String.fromCharCode(t.glyphNameMap[Ri[A]]));Ja(t.glyphs[a.glyphId],e,t,a.glyphId),e.add(4),a=Ma(t.cmap,String.fromCharCode(t.glyphNameMap[Ri[i]])),Ja(t.glyphs[a.glyphId],e,t,a.glyphId)}return;case 19:case 20:I+=g.length>>1,C+=I+7>>3,m=!0;break;case 21:o+=g.pop(),r+=g.pop(),a(r,o),m=!0;break;case 22:r+=g.pop(),a(r,o),m=!0;break;case 24:for(;g.length>2;)B=r+g.shift(),Q=o+g.shift(),h=B+g.shift(),l=Q+g.shift(),r=h+g.shift(),o=l+g.shift(),n(B,Q,h,l,r,o);r+=g.shift(),o+=g.shift(),s(r,o);break;case 25:for(;g.length>6;)r+=g.shift(),o+=g.shift(),s(r,o);B=r+g.shift(),Q=o+g.shift(),h=B+g.shift(),l=Q+g.shift(),r=h+g.shift(),o=l+g.shift(),n(B,Q,h,l,r,o);break;case 26:for(g.length%2&&(r+=g.shift());g.length>0;)B=r,Q=o+g.shift(),h=B+g.shift(),l=Q+g.shift(),r=h,o=l+g.shift(),n(B,Q,h,l,r,o);break;case 27:for(g.length%2&&(o+=g.shift());g.length>0;)B=r+g.shift(),Q=o,h=B+g.shift(),l=Q+g.shift(),r=h+g.shift(),o=l,n(B,Q,h,l,r,o);break;case 28:g.push((c[C]<<24|c[C+1]<<16)>>16),C+=2;break;case 29:f=g.pop()+t.gsubrsBias,p=t.gsubrs[f],p&&A(p);break;case 30:for(;g.length>0&&(B=r,Q=o+g.shift(),h=B+g.shift(),l=Q+g.shift(),r=h+g.shift(),o=l+(1===g.length?g.shift():0),n(B,Q,h,l,r,o),0!==g.length);)B=r+g.shift(),Q=o,h=B+g.shift(),l=Q+g.shift(),o=l+g.shift(),r=h+(1===g.length?g.shift():0),n(B,Q,h,l,r,o);break;case 31:for(;g.length>0&&(B=r+g.shift(),Q=o,h=B+g.shift(),l=Q+g.shift(),o=l+g.shift(),r=h+(1===g.length?g.shift():0),n(B,Q,h,l,r,o),0!==g.length);)B=r,Q=o+g.shift(),h=B+g.shift(),l=Q+g.shift(),r=h+g.shift(),o=l+(1===g.length?g.shift():0),n(B,Q,h,l,r,o);break;default:if(y<32)throw new v(`unknown operator: ${y}`);y<247?g.push(y-139):y<251?g.push(256*(y-247)+c[C++]+108):y<255?g.push(256*-(y-251)-c[C++]-108):(g.push((c[C]<<24|c[C+1]<<16|c[C+2]<<8|c[C+3])/65536),C+=4)}m&&(g.length=0)}}(A)}const Ha=[];class Ya{cmds=[];add(A,e){if(e)if(MA(e,null))this.cmds.push(A,...e);else{S(`Commands.add - "${A}" has at least one non-number arg: "${e}".`);const t=e.map((A=>"number"==typeof A?A:0));this.cmds.push(A,...t)}else this.cmds.push(A)}}class va{constructor(A){this.fontMatrix=A,this.compiledGlyphs=Object.create(null),this.compiledCharCodeToGlyphId=Object.create(null)}getPathJs(A){const{charCode:e,glyphId:t}=Ma(this.cmap,A);let i,a=this.compiledGlyphs[t];if(!a){try{a=this.compileGlyph(this.glyphs[t],t)}catch(A){a=Ha,i=A}this.compiledGlyphs[t]=a}if(this.compiledCharCodeToGlyphId[e]??=t,i)throw i;return a}compileGlyph(A,e){if(!A||0===A.length||14===A[0])return Ha;let t=this.fontMatrix;if(this.isCFFCIDFont){const A=this.fdSelect.getFDIndex(e);A>=0&&A2*Fa(A,e));const s=[];let n=a(e,0);for(let t=i;tA+(e.getSize()+3&-4)),0)}write(){const A=this.getSize(),e=new DataView(new ArrayBuffer(A)),t=A>131070,i=t?4:2,a=new DataView(new ArrayBuffer((this.glyphs.length+1)*i));t?a.setUint32(0,0):a.setUint16(0,0);let s=0,n=0;for(const A of this.glyphs)s+=A.write(s,e),s=s+3&-4,n+=i,t?a.setUint32(n,s):a.setUint16(n,s>>1);return{isLocationLong:t,loca:new Uint8Array(a.buffer),glyf:new Uint8Array(e.buffer)}}scale(A){for(let e=0,t=this.glyphs.length;eA+e.getSize()),0);return this.header.getSize()+A}write(A,e){if(!this.header)return 0;const t=A;if(A+=this.header.write(A,e),this.simple)A+=this.simple.write(A,e);else for(const t of this.composites)A+=t.write(A,e);return A-t}scale(A){if(!this.header)return;const e=(this.header.xMin+this.header.xMax)/2;if(this.header.scale(e,A),this.simple)this.simple.scale(e,A);else for(const t of this.composites)t.scale(e,A)}}class Xa{constructor({numberOfContours:A,xMin:e,yMin:t,xMax:i,yMax:a}){this.numberOfContours=A,this.xMin=e,this.yMin=t,this.xMax=i,this.yMax=a}static parse(A,e){return[10,new Xa({numberOfContours:e.getInt16(A),xMin:e.getInt16(A+2),yMin:e.getInt16(A+4),xMax:e.getInt16(A+6),yMax:e.getInt16(A+8)})]}getSize(){return 10}write(A,e){return e.setInt16(A,this.numberOfContours),e.setInt16(A+2,this.xMin),e.setInt16(A+4,this.yMin),e.setInt16(A+6,this.xMax),e.setInt16(A+8,this.yMax),10}scale(A,e){this.xMin=Math.round(A+(this.xMin-A)*e),this.xMax=Math.round(A+(this.xMax-A)*e)}}class Va{constructor({flags:A,xCoordinates:e,yCoordinates:t}){this.xCoordinates=e,this.yCoordinates=t,this.flags=A}}class ja{constructor({contours:A,instructions:e}){this.contours=A,this.instructions=e}static parse(A,e,t){const i=[];for(let a=0;a255?A+=2:g>0&&(A+=1),e=s,g=Math.abs(n-t),g>255?A+=2:g>0&&(A+=1),t=n}}return A}write(A,e){const t=A,i=[],a=[],s=[];let n=0,g=0;for(const t of this.contours){for(let A=0,e=t.xCoordinates.length;A=0?18:2,i.push(A)):i.push(o)}n=r;const I=t.yCoordinates[A];if(o=I-g,0===o)e|=32,a.push(0);else{const A=Math.abs(o);A<=255?(e|=o>=0?36:4,a.push(A)):a.push(o)}g=I,s.push(e)}e.setUint16(A,i.length-1),A+=2}e.setUint16(A,this.instructions.length),A+=2,this.instructions.length&&(new Uint8Array(e.buffer,0,e.buffer.byteLength).set(this.instructions,A),A+=this.instructions.length);for(const t of s)e.setUint8(A++,t);for(let t=0,a=i.length;t=-128&&this.argument1<=127&&this.argument2>=-128&&this.argument2<=127||(A+=2):this.argument1>=0&&this.argument1<=255&&this.argument2>=0&&this.argument2<=255||(A+=2),A}write(A,e){const t=A;return 2&this.flags?this.argument1>=-128&&this.argument1<=127&&this.argument2>=-128&&this.argument2<=127||(this.flags|=1):this.argument1>=0&&this.argument1<=255&&this.argument2>=0&&this.argument2<=255||(this.flags|=1),e.setUint16(A,this.flags),e.setUint16(A+2,this.glyphIndex),A+=4,1&this.flags?(2&this.flags?(e.setInt16(A,this.argument1),e.setInt16(A+2,this.argument2)):(e.setUint16(A,this.argument1),e.setUint16(A+2,this.argument2)),A+=4):(e.setUint8(A,this.argument1),e.setUint8(A+1,this.argument2),A+=2),256&this.flags&&(e.setUint16(A,this.instructions.length),A+=2,this.instructions.length&&(new Uint8Array(e.buffer,0,e.buffer.byteLength).set(this.instructions,A),A+=this.instructions.length)),A-t}scale(A,e){}}function _a(A,e,t){A[e]=t>>8&255,A[e+1]=255&t}function $a(A,e,t){A[e]=t>>24&255,A[e+1]=t>>16&255,A[e+2]=t>>8&255,A[e+3]=255&t}function As(A,e,t){if(t instanceof Uint8Array)A.set(t,e);else if("string"==typeof t)for(let i=0,a=t.length;it;)t<<=1,i++;const a=t*e;return{range:a,entry:i,rangeShift:e*A-a}}toArray(){let A=this.sfnt;const e=this.tables,t=Object.keys(e);t.sort();const i=t.length;let a,s,n,g,r,o=12+16*i;const I=[o];for(a=0;a>>0,I.push(o);const c=new Uint8Array(o);for(a=0;a>>0;$a(c,o+4,A),$a(c,o+8,I[a]),$a(c,o+12,e[r].length),o+=16}return c}addTable(A,e){if(A in this.tables)throw new Error("Table "+A+" already exists");this.tables[A]=e}}const ts=[4],is=[5],as=[6],ss=[7],ns=[8],gs=[12,35],rs=[14],os=[21],Is=[22],cs=[30],Cs=[31];class Bs{constructor(){this.width=0,this.lsb=0,this.flexing=!1,this.output=[],this.stack=[]}convert(A,e,t){const i=A.length;let a,s,n,g=!1;for(let r=0;ri)return!0;const a=i-A;for(let A=a;A>8&255,255&e):(e=65536*e|0,this.output.push(255,e>>24&255,e>>16&255,e>>8&255,255&e))}return this.output.push(...e),t?this.stack.splice(a,A):this.stack.length=0,!1}}function hs(A){return A>=48&&A<=57||A>=65&&A<=70||A>=97&&A<=102}function Qs(A,e,t){if(t>=A.length)return new Uint8Array(0);let i,a,s=0|e;for(i=0;i>8,s=52845*(e+s)+22719&65535}return g}function ls(A){return 47===A||91===A||93===A||123===A||125===A||40===A||41===A}class Es{constructor(A,e,t){if(e){const e=A.getBytes(),t=!((hs(e[0])||UA(e[0]))&&hs(e[1])&&hs(e[2])&&hs(e[3])&&hs(e[4])&&hs(e[5])&&hs(e[6])&&hs(e[7]));A=new ie(t?Qs(e,55665,4):function(A){let e=55665;const t=A.length,i=new Uint8Array(t>>>1);let a,s;for(a=0,s=0;a>8,e=52845*(A+e)+22719&65535}}return i.slice(4,s)}(e))}this.seacAnalysisEnabled=!!t,this.stream=A,this.nextChar()}readNumberArray(){this.getToken();const A=[];for(;;){const e=this.getToken();if(null===e||"]"===e||"}"===e)break;A.push(parseFloat(e||0))}return A}readNumber(){const A=this.getToken();return parseFloat(A||0)}readInt(){const A=this.getToken();return 0|parseInt(A||0,10)}readBoolean(){return"true"===this.getToken()?1:0}nextChar(){return this.currentChar=this.stream.getByte()}prevChar(){return this.stream.skip(-2),this.currentChar=this.stream.getByte()}getToken(){let A=!1,e=this.currentChar;for(;;){if(-1===e)return null;if(A)10!==e&&13!==e||(A=!1);else if(37===e)A=!0;else if(!UA(e))break;e=this.nextChar()}if(ls(e))return this.nextChar(),String.fromCharCode(e);let t="";do{t+=String.fromCharCode(e),e=this.nextChar()}while(e>=0&&!UA(e)&&!ls(e));return t}readCharStrings(A,e){return-1===e?A:Qs(A,4330,e)}extractFontProgram(A){const e=this.stream,t=[],i=[],a=Object.create(null);a.lenIV=4;const s={subrs:[],charstrings:[],properties:{privateData:a}};let n,g,r,o;for(;null!==(n=this.getToken());)if("/"===n)switch(n=this.getToken(),n){case"CharStrings":for(this.getToken(),this.getToken(),this.getToken(),this.getToken();n=this.getToken(),null!==n&&"end"!==n;){if("/"!==n)continue;const A=this.getToken();g=this.readInt(),this.getToken(),r=g>0?e.getBytes(g):new Uint8Array(0),o=s.properties.privateData.lenIV;const t=this.readCharStrings(r,o);this.nextChar(),n=this.getToken(),"noaccess"===n?this.getToken():"/"===n&&this.prevChar(),i.push({glyph:A,encoded:t})}break;case"Subrs":for(this.readInt(),this.getToken();"dup"===this.getToken();){const A=this.readInt();g=this.readInt(),this.getToken(),r=g>0?e.getBytes(g):new Uint8Array(0),o=s.properties.privateData.lenIV;const i=this.readCharStrings(r,o);this.nextChar(),n=this.getToken(),"noaccess"===n&&this.getToken(),t[A]=i}break;case"BlueValues":case"OtherBlues":case"FamilyBlues":case"FamilyOtherBlues":const A=this.readNumberArray();A.length>0&&A.length;break;case"StemSnapH":case"StemSnapV":s.properties.privateData[n]=this.readNumberArray();break;case"StdHW":case"StdVW":s.properties.privateData[n]=this.readNumberArray()[0];break;case"BlueShift":case"lenIV":case"BlueFuzz":case"BlueScale":case"LanguageGroup":s.properties.privateData[n]=this.readNumber();break;case"ExpansionFactor":s.properties.privateData[n]=this.readNumber()||.06;break;case"ForceBold":s.properties.privateData[n]=this.readBoolean()}for(const{encoded:e,glyph:a}of i){const i=new Bs,n=i.convert(e,t,this.seacAnalysisEnabled);let g=i.output;n&&(g=[14]);const r={glyphName:a,charstring:g,width:i.width,lsb:i.lsb,seac:i.seac};if(".notdef"===a?s.charstrings.unshift(r):s.charstrings.push(r),A.builtInEncoding){const e=A.builtInEncoding.indexOf(a);e>-1&&void 0===A.widths[e]&&e>=A.firstChar&&e<=A.lastChar&&(A.widths[e]=i.width)}}return s}extractFontHeader(A){let e;for(;null!==(e=this.getToken());)if("/"===e)switch(e=this.getToken(),e){case"FontMatrix":const t=this.readNumberArray();A.fontMatrix=t;break;case"Encoding":const i=this.getToken();let a;if(/^\d+$/.test(i)){a=[];const A=0|parseInt(i,10);this.getToken();for(let t=0;t=a){for(n+=t;n=0&&(i[A]=a)}return ca(A,i,t)}hasGlyphId(A){return!(A<0||A>=this.numGlyphs)&&(0===A||this.charstrings[A-1].charstring.length>0)}getSeacs(A){const e=[];for(let t=0,i=A.length;t0;A--)e[A]-=e[A-1];B.setByName(A,e)}s.topDict.privateDict=B;const Q=new qi;for(I=0,c=i.length;I0&&A.toUnicode.amend(e)}class bs{constructor(A,e,t,i,a,s,n,g,r){this.originalCharCode=A,this.fontChar=e,this.unicode=t,this.accent=i,this.width=a,this.vmetric=s,this.operatorListId=n,this.isSpace=g,this.isInFont=r}get category(){return x(this,"category",function(A){const e=ga.get(A);if(e)return e;const t=A.match(na),i={isWhitespace:!!t?.[1],isZeroWidthDiacritic:!!t?.[2],isInvisibleFormatMark:!!t?.[3]};return ga.set(A,i),i}(this.unicode),!0)}}function ks(A,e){return(A<<8)+e}function Fs(A,e,t){A[e+1]=t,A[e]=t>>>8}function Ss(A,e){const t=(A<<8)+e;return 32768&t?t-65536:t}function Rs(A){return String.fromCharCode(A>>8&255,255&A)}function Gs(A){return A>32767?A=32767:A<-32768&&(A=-32768),String.fromCharCode(A>>8&255,255&A)}function Ns(A){return"ttcf"===q(A.peekBytes(4))}function xs(A,e){for(const t in e)A[+t]=e[t]}function Us(A,e,t){const i=[];let a;for(let t=0,s=A.length;tI){if(r++,r>=fs.length){S("Ran out of space in font private use area.");break}o=fs[r][0],I=fs[r][1]}const h=o++;0===B&&(B=t);let Q=i.get(C);"string"==typeof Q&&(Q=Q.codePointAt(0)),!Q||(c=Q,fs[0][0]<=c&&c<=fs[0][1]||fs[1][0]<=c&&c<=fs[1][1])||g.has(B)||(s.set(Q,B),g.add(B)),a[h]=B,n[C]=h}var c;return{toFontChar:n,charCodeToGlyphId:a,toUnicodeExtraMap:s,nextAvailableFontCharCode:o}}function Ys(A,e,t){const i=function(A,e,t){const i=[];for(const e in A)A[e]>=t||i.push({fontCharCode:0|e,glyphId:A[e]});if(e)for(const[A,a]of e)a>=t||i.push({fontCharCode:A,glyphId:a});0===i.length&&i.push({fontCharCode:0,glyphId:0}),i.sort((function(A,e){return A.fontCharCode-e.fontCharCode}));const a=[],s=i.length;for(let A=0;A65535?2:1;let s,n,g,r,o="\0\0"+Rs(a)+"\0\0"+P(4+8*a);for(s=i.length-1;s>=0&&!(i[s][0]<=65535);--s);const I=s+1;i[s][0]<65535&&65535===i[s][1]&&(i[s][1]=65534);const c=i[s][1]<65535?1:0,C=I+c,B=es.getSearchParams(C,2);let h,Q,l,E,u="",d="",f="",p="",m="",y=0;for(s=0,n=I;s0&&(d+="ÿÿ",u+="ÿÿ",f+="\0",p+="\0\0");const w="\0\0"+Rs(2*C)+Rs(B.range)+Rs(B.entry)+Rs(B.rangeShift)+d+"\0\0"+u+f+p+m;let D="",b="";if(a>1){for(o+="\0\0\n"+P(4+8*a+4+w.length),D="",s=0,n=i.length;sA||!g)&&(g=A),r 123 are reserved for internal usage");n|=1<65535&&(r=65535)}else g=0,r=255;const I=A.bbox||[0,0,0,0],c=t.unitsPerEm||(A.fontMatrix?1/Math.max(...A.fontMatrix.slice(0,4).map(Math.abs)):1e3),C=A.ascentScaled?1:c/ps,B=t.ascent||Math.round(C*(A.ascent||I[3]));let h=t.descent||Math.round(C*(A.descent||I[1]));h>0&&A.descent>0&&I[1]<0&&(h=-h);const Q=t.yMax||B,l=-t.yMin||-h;return"\0$ô\0\0\0Š»\0\0\0ŒŠ»\0\0ß\x001\0\0\0\0"+String.fromCharCode(A.fixedPitch?9:0)+"\0\0\0\0\0\0"+P(i)+P(a)+P(s)+P(n)+"*21*"+Rs(A.italicAngle?1:0)+Rs(g||A.firstChar)+Rs(r||A.lastChar)+Rs(B)+Rs(h)+"\0d"+Rs(Q)+Rs(l)+"\0\0\0\0\0\0\0\0"+Rs(A.xHeight)+Rs(A.capHeight)+Rs(0)+Rs(g||A.firstChar)+"\0"}function Ks(A){return"\0\0\0"+P(Math.floor(65536*A.italicAngle))+"\0\0\0\0"+P(A.fixedPitch?1:0)+"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"}function qs(A){return A.replaceAll(/[^\x21-\x7E]|[[\](){}<>/%]/g,"").slice(0,63)}function Ts(A,e){e||(e=[[],[]]);const t=[e[0][0]||"Original licence",e[0][1]||A,e[0][2]||"Unknown",e[0][3]||"uniqueID",e[0][4]||A,e[0][5]||"Version 0.11",e[0][6]||qs(A),e[0][7]||"Unknown",e[0][8]||"Unknown",e[0][9]||"Unknown"],i=[];let a,s,n,g,r;for(a=0,s=t.length;a=1&&e[3]>=1&&e[3]<=4}(A)?i?(a="CIDFontType0",s="CIDFontType0C"):(a="MMType1"===e?"MMType1":"Type1",s="Type1C"):(S("getFontFileType: Unable to detect correct font file Type/Subtype."),a=e,s=t),[a,s]}(e,t),a===this.type&&s===this.subtype||F(`Inconsistent font file Type/SubType, expected: ${this.type}/${this.subtype} but found: ${a}/${s}.`);try{switch(a){case"MMType1":F("MMType1 font ("+A+"), falling back to Type1.");case"Type1":case"CIDFontType0":this.mimetype="font/opentype";const i="Type1C"===s||"CIDFontType0C"===s?new ba(e,t):new ds(A,e,t);ws(t),g=this.convert(A,i,t);break;case"OpenType":case"TrueType":case"CIDFontType2":this.mimetype="font/opentype",g=this.checkAndRepair(A,e,t),this.isOpenType&&(ws(t),a="OpenType");break;default:throw new v(`Font ${a} is not supported`)}}catch(A){return S(A),void this.fallbackToSystemFont(t)}Ds(t),this.data=g,this.type=a,this.subtype=s,this.fontMatrix=t.fontMatrix,this.widths=t.widths,this.defaultWidth=t.defaultWidth,this.toUnicode=t.toUnicode,this.seacMap=t.seacMap}get renderer(){return x(this,"renderer",Ta.create(this,ra))}exportData(A=!1){const e=A?[...ms,...ys]:ms,t=Object.create(null);let i,a;for(i of e)a=this[i],void 0!==a&&(t[i]=a);return t}fallbackToSystemFont(A){this.missingFile=!0;const{name:e,type:t}=this;let i=Ca(e);const a=ha(),s=la(),n=!!a[i],g=!(!s[i]||!a[s[i]]);i=a[i]||s[i]||i;const r=Wa()[i];r&&(isNaN(this.ascent)&&(this.ascent=r.ascent/ps),isNaN(this.descent)&&(this.descent=r.descent/ps),isNaN(this.capHeight)&&(this.capHeight=r.capHeight/ps)),this.bold=/bold/gi.test(i),this.italic=/oblique|italic/gi.test(i),this.black=/Black/g.test(e);const o=/Narrow/g.test(e);if(this.remeasure=(!n||o)&&Object.keys(this.widths).length>0,(n||g)&&"CIDFontType2"===t&&this.cidEncoding.startsWith("Identity-")){const t=A.cidToGidMap,i=[];if(xs(i,da()),/Arial-?Black/i.test(e)?xs(i,fa()):/Calibri/i.test(e)&&xs(i,pa()),t){for(const A in i){const e=i[A];void 0!==t[e]&&(i[+A]=t[e])}t.length!==this.toUnicode.length&&A.hasIncludedToUnicodeMap&&this.toUnicode instanceof Da&&this.toUnicode.forEach((function(A,e){const a=i[A];void 0===t[a]&&(i[+A]=e)}))}this.toUnicode instanceof Da||this.toUnicode.forEach((function(A,e){i[+A]=e})),this.toFontChar=i,this.toUnicode=new wa(i)}else if(/Symbol/i.test(i))this.toFontChar=Us(Ni,Aa(),this.differences);else if(/Dingbats/i.test(i))this.toFontChar=Us(xi,ea(),this.differences);else if(n||g){const A=Us(this.defaultEncoding,Aa(),this.differences);"CIDFontType2"!==t||this.cidEncoding.startsWith("Identity-")||this.toUnicode instanceof Da||this.toUnicode.forEach((function(e,t){A[+e]=t})),this.toFontChar=A}else{const A=Aa(),t=[];this.toUnicode.forEach(((e,i)=>{if(!this.composite){const t=ia(this.differences[e]||this.defaultEncoding[e],A);-1!==t&&(i=t)}t[+e]=i})),this.composite&&this.toUnicode instanceof Da&&/Tahoma|Verdana/i.test(e)&&xs(t,da()),this.toFontChar=t}Ds(A),this.loadedName=i.split("-",1)[0]}checkAndRepair(A,e,t){const i=["OS/2","cmap","head","hhea","hmtx","maxp","name","post","loca","glyf","fpgm","prep","cvt ","CFF "];function a(A,e){const t=Object.create(null);t["OS/2"]=null,t.cmap=null,t.head=null,t.hhea=null,t.hmtx=null,t.maxp=null,t.name=null,t.post=null;for(let a=0;a>>0,i=A.getInt32()>>>0,a=A.getInt32()>>>0,s=A.pos;A.pos=A.start||0,A.skip(i);const n=A.getBytes(a);return A.pos=s,"head"===e&&(n[8]=n[9]=n[10]=n[11]=0,n[17]|=32),{tag:e,checksum:t,length:a,offset:i,data:n}}function n(A){return{version:A.getString(4),numTables:A.getUint16(),searchRange:A.getUint16(),entrySelector:A.getUint16(),rangeShift:A.getUint16()}}function g(A,e,t,i,a,s){const n={length:0,sizeOfInstructions:0};if(e<0||e>=A.length||t>A.length||t-e<=12)return n;const g=A.subarray(e,t),r=Ss(g[2],g[3]),o=Ss(g[4],g[5]),I=Ss(g[6],g[7]),c=Ss(g[8],g[9]);r>I&&(Fs(g,2,I),Fs(g,6,r)),o>c&&(Fs(g,4,c),Fs(g,8,o));const C=Ss(g[0],g[1]);if(C<0)return C<-1||(i.set(g,a),n.length=g.length),n;let B,h=10,Q=0;for(B=0;Bg.length?n:!s&&E>0?(i.set(g.subarray(0,l),a),i.set([0,0],a+l),i.set(g.subarray(u,f),a+l+2),f-=E,g.length-f>3&&(f=f+3&-4),n.length=f,n):g.length-f>3?(f=f+3&-4,i.set(g.subarray(0,f),a),n.length=f,n):(i.set(g,a),n.length=g.length,n)}function r(A){const t=(e.start||0)+A.offset;e.pos=t;const i=[[],[]],a=[],s=A.length,n=t+s;if(0!==e.getUint16()||s<6)return[i,a];const g=e.getUint16(),r=e.getUint16();let o,I;for(o=0;on)continue;e.pos=s;const g=A.name;if(A.encoding){let t="";for(let i=0,a=A.length;i0&&(r+=A-1)}}else(l||u)&&(S("TT: nested FDEFs not allowed"),Q=!0),l=!0,c=r,s=C.pop(),e.functionsDefined[s]={data:g,i:r};else if(!l&&!u)if(s=C.at(-1),isNaN(s))F("TT: CALL empty stack (or invalid entry).");else if(e.functionsUsed[s]=!0,s in e.functionsStackDeltas){const A=C.length+e.functionsStackDeltas[s];if(A<0)return S("TT: CALL invalid functions stack delta."),void(e.hintsValid=!1);C.length=A}else if(s in e.functionsDefined&&!h.includes(s)){if(B.push({data:g,i:r,stackTop:C.length-1}),h.push(s),n=e.functionsDefined[s],!n)return S("TT: CALL non-existent function"),void(e.hintsValid=!1);g=n.data,r=n.i}if(!l&&!u){let e=0;for(A<=142?e=o[A]:A>=192&&A<=223?e=-1:A>=224&&(e=-2),A>=113&&A<=117&&(i=C.pop(),isNaN(i)||(e=2*-i));e<0&&C.length>0;)C.pop(),e++;for(;e>0;)C.push(NaN),e--}}e.tooComplexToFollowFunctions=Q;const d=[g];r>g.length&&d.push(new Uint8Array(r-g.length)),c>I&&(S("TT: complementing a missing function tail"),d.push(new Uint8Array([34,45]))),function(A,e){if(e.length>1){let t,i,a=0;for(t=0,i=e.length;t>>0,s=[];for(let e=0;e>>0);const n={ttcTag:e,majorVersion:t,minorVersion:i,numFonts:a,offsetTable:s};switch(t){case 1:return n;case 2:return n.dsigTag=A.getInt32()>>>0,n.dsigLength=A.getInt32()>>>0,n.dsigOffset=A.getInt32()>>>0,n}throw new v(`Invalid TrueType Collection majorVersion: ${t}.`)}(A),s=e.split("+");let g;for(let o=0;o0||!(t.cMap instanceof oi));if("OTTO"===c.version&&!e||!C.head||!C.hhea||!C.maxp||!C.post)return h=new ie(C["CFF "].data),B=new ba(h,t),ws(t),this.convert(A,B,t);delete C.glyf,delete C.loca,delete C.fpgm,delete C.prep,delete C["cvt "],this.isOpenType=!0}if(!C.maxp)throw new v('Required "maxp" table is not found');e.pos=(e.start||0)+C.maxp.offset;let l=e.getInt32();const E=e.getUint16();if(65536!==l&&20480!==l){if(6===C.maxp.length)l=20480;else{if(!(C.maxp.length>=32))throw new v('"maxp" table has a wrong version number');l=65536}d=l,(u=C.maxp.data)[3+0]=255&d,u[2]=d>>>8,u[1]=d>>>16,u[0]=d>>>24}var u,d;if(t.scaleFactors?.length===E&&Q){const{scaleFactors:A}=t,e=ks(C.head.data[50],C.head.data[51]),i=new Za({glyfTable:C.glyf.data,isGlyphLocationsLong:e,locaTable:C.loca.data,numGlyphs:E});i.scale(A);const{glyf:a,loca:s,isLocationLong:n}=i.write();C.glyf.data=a,C.loca.data=s,n!==!!e&&(C.head.data[50]=0,C.head.data[51]=n?1:0);const g=C.hmtx.data;for(let e=0;e>8&255,g[t+1]=255&i,Fs(g,t+2,Math.round(A[e]*Ss(g[t+2],g[t+3])))}}let f=E+1,p=!0;f>65535&&(p=!1,f=E,S("Not enough space in glyfs to duplicate first glyph."));let m=0,y=0;l>=65536&&C.maxp.length>=32&&(e.pos+=8,e.getUint16()>2&&(C.maxp.data[14]=0,C.maxp.data[15]=2),e.pos+=4,m=e.getUint16(),e.pos+=4,y=e.getUint16()),C.maxp.data[4]=f>>8,C.maxp.data[5]=255&f;const w=function(A,e,t,i){const a={functionsDefined:[],functionsUsed:[],functionsStackDeltas:[],tooComplexToFollowFunctions:!1,hintsValid:!0};if(A&&I(A,a),e&&I(e,a),A&&function(A,e){if(!A.tooComplexToFollowFunctions){if(A.functionsDefined.length>e)return S("TT: more functions defined than expected"),void(A.hintsValid=!1);for(let t=0,i=A.functionsUsed.length;te)return S("TT: invalid function id: "+t),void(A.hintsValid=!1);if(A.functionsUsed[t]&&!A.functionsDefined[t])return S("TT: undefined function: "+t),void(A.hintsValid=!1)}}}(a,i),t&&1&t.length){const A=new Uint8Array(t.length+1);A.set(t.data),t.data=A}return a.hintsValid}(C.fpgm,C.prep,C["cvt "],m);if(w||(delete C.fpgm,delete C.prep,delete C["cvt "]),function(A,e,t,i,a,s){if(!e)return void(t&&(t.data=null));A.pos=(A.start||0)+e.offset,A.pos+=4,A.pos+=2,A.pos+=2,A.pos+=2,A.pos+=2,A.pos+=2,A.pos+=2,A.pos+=2,A.pos+=2,A.pos+=2;const n=A.getUint16();A.pos+=8,A.pos+=2;let g=A.getUint16();0!==n&&(2&ks(i.data[44],i.data[45])||(e.data[22]=0,e.data[23]=0)),g>a&&(F(`The numOfMetrics (${g}) should not be greater than the numGlyphs (${a}).`),g=a,e.data[34]=(65280&g)>>8,e.data[35]=255&g);const r=a-g-(t.length-4*g>>1);if(r>0){const A=new Uint8Array(t.length+2*r);A.set(t.data),s&&(A[t.length]=t.data[2],A[t.length+1]=t.data[3]),t.data=A}}(e,C.hhea,C.hmtx,C.head,f,p),!C.head)throw new v('Required "head" table is not found');!function(A,e,t){const i=A.data,a=(i[0]<<24)+(i[1]<<16)+(i[2]<<8)+i[3];a>>16!=1&&(F("Attempting to fix invalid version in head table: "+a),i[0]=0,i[1]=1,i[2]=0,i[3]=0);const s=ks(i[50],i[51]);if(s<0||s>1){F("Attempting to fix invalid indexToLocFormat in head table: "+s);const A=e+1;if(t===A<<1)i[50]=0,i[51]=0;else{if(t!==A<<2)throw new v("Could not fix indexToLocFormat: "+s);i[50]=0,i[51]=1}}}(C.head,E,Q?C.loca.length:0);let D=Object.create(null);if(Q){const A=ks(C.head.data[50],C.head.data[51]),e=function(A,e,t,i,a,s,n){let r,o,I;i?(r=4,o=function(A,e){return A[e]<<24|A[e+1]<<16|A[e+2]<<8|A[e+3]},I=function(A,e,t){A[e]=t>>>24&255,A[e+1]=t>>16&255,A[e+2]=t>>8&255,A[e+3]=255&t}):(r=2,o=function(A,e){return A[e]<<9|A[e+1]<<1},I=function(A,e,t){A[e]=t>>9&255,A[e+1]=t>>1&255});const c=s?t+1:t,C=r*(1+c),B=new Uint8Array(C);B.set(A.data.subarray(0,C)),A.data=B;const h=e.data,Q=h.length,l=new Uint8Array(Q);let E,u;const d=[];for(E=0,u=0;EQ&&(A=Q),d.push({index:E,offset:A,endOffset:0})}for(d.sort(((A,e)=>A.offset-e.offset)),E=0;EA.index-e.index)),E=0;En&&(n=A.sizeOfInstructions),m+=e,I(B,u,m)}if(0===m){const A=new Uint8Array([0,1,0,0,0,0,0,0,0,0,0,0,0,0,49,0]);for(E=0,u=r;Et+m?e.data=l.subarray(0,t+m):(e.data=new Uint8Array(t+m),e.data.set(l.subarray(0,m))),e.data.set(l.subarray(0,t),m),I(A.data,B.length-r,m+t)}else e.data=l.subarray(0,m);return{missingGlyphs:p,maxSizeOfInstructions:n}}(C.loca,C.glyf,E,A,w,p,y);D=e.missingGlyphs,l>=65536&&C.maxp.length>=32&&(C.maxp.data[26]=e.maxSizeOfInstructions>>8,C.maxp.data[27]=255&e.maxSizeOfInstructions)}if(!C.hhea)throw new v('Required "hhea" table is not found');0===C.hhea.data[10]&&0===C.hhea.data[11]&&(C.hhea.data[10]=255,C.hhea.data[11]=255);const b={unitsPerEm:ks(C.head.data[18],C.head.data[19]),yMax:Ss(C.head.data[42],C.head.data[43]),yMin:Ss(C.head.data[38],C.head.data[39]),ascent:Ss(C.hhea.data[4],C.hhea.data[5]),descent:Ss(C.hhea.data[6],C.hhea.data[7]),lineGap:Ss(C.hhea.data[8],C.hhea.data[9])};this.ascent=b.ascent/b.unitsPerEm,this.descent=b.descent/b.unitsPerEm,this.lineGap=b.lineGap/b.unitsPerEm,this.cssFontInfo?.lineHeight?(this.lineHeight=this.cssFontInfo.metrics.lineHeight,this.lineGap=this.cssFontInfo.metrics.lineGap):this.lineHeight=this.ascent-this.descent+this.lineGap,C.post&&function(A,t,i){const a=(e.start||0)+A.offset;e.pos=a;const s=a+A.length,n=e.getInt32();let g;e.skip(28);let r,o=!0;switch(n){case 65536:g=oa;break;case 131072:const A=e.getUint16();if(A!==i){o=!1;break}const a=[];for(r=0;r=32768){o=!1;break}a.push(A)}if(!o)break;const I=[],c=[];for(;e.pos65535)throw new v("Max size of CID is 65,535");let a=-1;e?a=i:void 0!==A[i]&&(a=A[i]),a>=0&&a>>0;let I=!1;if(g?.platformId!==a||g?.encodingId!==s){if(0!==a||0!==s&&1!==s&&3!==s)if(1===a&&0===s)I=!0;else if(3!==a||1!==s||!i&&g){if(t&&3===a&&0===s){I=!0;let t=!0;if(A>3;A.push(i),t=Math.max(i,t)}const i=[];for(let A=0;A<=t;A++)i.push({firstCode:e.getUint16(),entryCount:e.getUint16(),idDelta:Ss(e.getByte(),e.getByte()),idRangePos:e.pos+e.getUint16()});for(let t=0;t<256;t++)if(0===A[t])e.pos=i[0].idRangePos+2*t,B=e.getUint16(),c.push({charCode:t,glyphId:B});else{const a=i[A[t]];for(C=0;C>1;e.skip(6);const t=[];let i;for(i=0;i>1)-(A-i),a.offsetIndex=n,g=Math.max(g,n+a.end-a.start+1)):a.offsetIndex=-1}const r=[];for(C=0;C>>0;for(C=0;C>>0,t=e.getInt32()>>>0;let i=e.getInt32()>>>0;for(let e=A;e<=t;e++)c.push({charCode:e,glyphId:i++})}}}c.sort((function(A,e){return A.charCode-e.charCode}));for(let A=1;A=61440&&e<=61695&&(e&=255),k[e]=A.glyphId}else for(const A of s)k[A.charCode]=A.glyphId;if(t.glyphNames&&(n.length||this.differences.length))for(let A=0;A<256;++A){if(!g&&void 0!==k[A])continue;const e=this.differences[A]||n[A];if(!e)continue;const i=t.glyphNames.indexOf(e);i>0&&R(i)&&(k[A]=i)}}0===k.length&&(k[0]=0);let N=f-1;if(p||(N=0),!t.cssFontInfo){const A=Hs(k,R,N,this.toUnicode);this.toFontChar=A.toFontChar,C.cmap={tag:"cmap",data:Ys(A.charCodeToGlyphId,A.toUnicodeExtraMap,f)},C["OS/2"]&&function(A,e){e.pos=(e.start||0)+A.offset;const t=e.getUint16();e.skip(60);const i=e.getUint16();return!(t<4&&768&i||e.getUint16()>e.getUint16()||(e.skip(6),0===e.getUint16()||(A.data[8]=A.data[9]=0,0)))}(C["OS/2"],e)||(C["OS/2"]={tag:"OS/2",data:vs(t,A.charCodeToGlyphId,b)})}if(!Q)try{h=new ie(C["CFF "].data),B=new Hi(h,t,ra).parse(),B.duplicateFirstGlyph();const A=new $i(B);C["CFF "].data=A.compile()}catch{S("Failed to compile font "+t.loadedName)}if(C.name){const[e,i]=r(C.name);C.name.data=Ts(A,e),this.psName=e[0][6]||null,t.composite||function(A,e,t){if(A.isInternalFont)return;if(A.hasIncludedToUnicodeMap)return;if(A.hasEncoding)return;if(A.toUnicode instanceof Da)return;if(!e)return;if(0===t.length)return;if(A.defaultEncoding===Gi)return;for(const A of t)if(!Ls(A))return;const i=Gi,a=[],s=Aa();for(const A in i){const e=i[A];if(""===e)continue;const t=s[e];void 0!==t&&(a[A]=String.fromCharCode(t))}a.length>0&&A.toUnicode.amend(a)}(t,this.isSymbolicFont,i)}else C.name={tag:"name",data:Ts(this.name)};const x=new es(c.version);for(const A in C)x.addTable(A,C[A].data);return x.toArray()}convert(A,e,t){t.fixedPitch=!1,t.builtInEncoding&&function(A,e){if(A.isInternalFont)return;if(A.hasIncludedToUnicodeMap)return;if(e===A.defaultEncoding)return;if(A.toUnicode instanceof Da)return;const t=[],i=Aa();for(const a in e){if(A.hasEncoding&&(A.baseEncodingName||void 0!==A.differences[a]))continue;const s=ia(e[a],i);-1!==s&&(t[a]=String.fromCharCode(s))}t.length>0&&A.toUnicode.amend(t)}(t,t.builtInEncoding);let i=1;e instanceof ba&&(i=e.numGlyphs-1);const s=e.getGlyphMapping(t);let n=null,g=s,r=null;t.cssFontInfo||(n=Hs(s,e.hasGlyphId.bind(e),i,this.toUnicode),this.toFontChar=n.toFontChar,g=n.charCodeToGlyphId,r=n.toUnicodeExtraMap);const o=e.numGlyphs;function I(A,e){let t=null;for(const i in A)e===A[i]&&(t||=[]).push(0|i);return t}function c(A,e){for(const t in A)if(e===A[t])return 0|t;return n.charCodeToGlyphId[n.nextAvailableFontCharCode]=e,n.nextAvailableFontCharCode++}const C=e.seacs;if(n&&C?.length){const A=t.fontMatrix||a,i=e.getCharset(),g=Object.create(null);for(let e in C){e|=0;const t=C[e],a=Ri[t[2]],r=Ri[t[3]],o=i.indexOf(a),B=i.indexOf(r);if(o<0||B<0)continue;const h={x:t[0]*A[0]+t[1]*A[2]+A[4],y:t[0]*A[1]+t[1]*A[3]+A[5]},Q=I(s,e);if(Q)for(const A of Q){const e=n.charCodeToGlyphId,t=c(e,o),i=c(e,B);g[A]={baseFontCharCode:t,accentFontCharCode:i,accentOffset:h}}}t.seacMap=g}const B=t.fontMatrix?1/Math.max(...t.fontMatrix.slice(0,4).map(Math.abs)):1e3,h=new es("OTTO");return h.addTable("CFF ",e.data),h.addTable("OS/2",vs(t,g)),h.addTable("cmap",Ys(g,r,o)),h.addTable("head","\0\0\0\0\0\0\0\0\0\0_<õ\0\0"+Gs(B)+"\0\0\0\0ž\v~'\0\0\0\0ž\v~'\0\0"+Gs(t.descent)+"ÿ"+Gs(t.ascent)+Rs(t.italicAngle?2:0)+"\0\0\0\0\0\0\0"),h.addTable("hhea","\0\0\0"+Gs(t.ascent)+Gs(t.descent)+"\0\0ÿÿ\0\0\0\0\0\0"+Gs(t.capHeight)+Gs(Math.tan(t.italicAngle)*t.xHeight)+"\0\0\0\0\0\0\0\0\0\0\0\0"+Rs(o)),h.addTable("hmtx",function(){const A=e.charstrings,t=e.cff?e.cff.widths:null;let i="\0\0\0\0";for(let e=1,a=o;e=65520&&I<=65535?0:I>=62976&&I<=63743?ta()[I]||I:173===I?45:I}var I;this.isType3Font&&(a=t);let c=null;if(this.seacMap?.[A]){o=!0;const e=this.seacMap[A];t=e.baseFontCharCode,c={fontChar:String.fromCodePoint(e.accentFontCharCode),offset:e.accentOffset}}let C="";if("number"==typeof t&&(t<=1114111?C=String.fromCodePoint(t):S(`charToGlyph - invalid fontCharCode: ${t}`)),this.missingFile&&this.vertical&&1===C.length){const A=Ba()[C.charCodeAt(0)];A&&(C=r=String.fromCharCode(A))}return s=new bs(A,C,r,c,i,g,a,e,o),this._glyphCache[A]=s}charsToGlyphs(A){let e=this._charsCache[A];if(e)return e;if(e=[],this.cMap){const t=Object.create(null),i=A.length;let a=0;for(;ae.length%2==1,a=this.toUnicode instanceof Da?A=>this.toUnicode.charCodeOf(A):A=>this.toUnicode.charCodeOf(String.fromCodePoint(A));for(let s=0,n=A.length;s55295&&(n<57344||n>65533)&&s++,this.toUnicode){const A=a(n);if(-1!==A){i()&&(e.push(t.join("")),t.length=0);for(let e=(this.cMap?this.cMap.getCharCodeLength(A):1)-1;e>=0;e--)t.push(String.fromCharCode(A>>8*e&255));continue}}i()||(e.push(t.join("")),t.length=0),t.push(String.fromCodePoint(n))}return e.push(t.join("")),e}}class Ws{constructor(A){this.error=A,this.loadedName="g_font_error",this.missingFile=!0}charsToGlyphs(){return[]}encodeString(A){return[A]}exportData(A=!1){return{error:this.error}}}class Zs{constructor(){R("Cannot initialize Pattern.")}static parseShading(A,e,t,i,a){const s=A instanceof dA?A.dict:A,n=s.get("ShadingType");try{switch(n){case 2:case 3:return new Xs(s,e,t,i,a);case 4:case 5:case 6:case 7:return new _s(A,e,t,i,a);default:throw new v("Unsupported ShadingType: "+n)}}catch(A){if(A instanceof mA)throw A;return S(A),new $s}}}class Os{static SMALL_NUMBER=1e-6;getIR(){R("Abstract method `getIR` called.")}}class Xs extends Os{constructor(A,e,t,i,a){super(),this.shadingType=A.get("ShadingType");let s=0;if(2===this.shadingType?s=4:3===this.shadingType&&(s=6),this.coordsArr=A.getArray("Coords"),!MA(this.coordsArr,s))throw new v("RadialAxialShading: Invalid /Coords array.");const n=re.parse({cs:A.getRaw("CS")||A.getRaw("ColorSpace"),xref:e,resources:t,pdfFunctionFactory:i,localColorSpaceCache:a});this.bbox=HA(A.getArray("BBox"),null);let g=0,r=1;const o=A.getArray("Domain");MA(o,2)&&([g,r]=o);let I=!1,c=!1;const C=A.getArray("Extend");var B;if(B=C,Array.isArray(B)&&2===B.length&&B.every((A=>"boolean"==typeof A))&&([I,c]=C),!(3!==this.shadingType||I&&c)){const[A,e,t,i,a,s]=this.coordsArr,n=Math.hypot(A-i,e-a);t<=s+n&&s<=t+n&&S("Unsupported radial gradient.")}this.extendStart=I,this.extendEnd=c;const h=A.getRaw("Function"),Q=i.createFromArray(h),l=(r-g)/840,E=this.colorStops=[];if(g>=r||l<=0)return void F("Bad shading domain.");const u=new Float32Array(n.numComps),d=new Float32Array(1);let f,p=0;d[0]=g,Q(d,0,u,0);let m=n.getRgb(u,0);const y=X.makeHexColor(m[0],m[1],m[2]);E.push([0,y]);let w=1;d[0]=g+l,Q(d,0,u,0);let D=n.getRgb(u,0),b=D[0]-m[0]+1,k=D[1]-m[1]+1,R=D[2]-m[2]+1,G=D[0]-m[0]-1,N=D[1]-m[1]-1,x=D[2]-m[2]-1;for(let A=2;A<840;A++){d[0]=g+A*l,Q(d,0,u,0),f=n.getRgb(u,0);const e=A-p;if(b=Math.min(b,(f[0]-m[0]+1)/e),k=Math.min(k,(f[1]-m[1]+1)/e),R=Math.min(R,(f[2]-m[2]+1)/e),G=Math.max(G,(f[0]-m[0]-1)/e),N=Math.max(N,(f[1]-m[1]-1)/e),x=Math.max(x,(f[2]-m[2]-1)/e),!(G<=b&&N<=k&&x<=R)){const A=X.makeHexColor(D[0],D[1],D[2]);E.push([w/840,A]),b=f[0]-D[0]+1,k=f[1]-D[1]+1,R=f[2]-D[2]+1,G=f[0]-D[0]-1,N=f[1]-D[1]-1,x=f[2]-D[2]-1,p=w,m=D}w=A,D=f}const U=X.makeHexColor(D[0],D[1],D[2]);E.push([1,U]);let M="transparent";A.has("Background")&&(f=n.getRgb(A.get("Background"),0),M=X.makeHexColor(f[0],f[1],f[2])),I||(E.unshift([0,M]),E[1][0]+=Os.SMALL_NUMBER),c||(E.at(-1)[0]-=Os.SMALL_NUMBER,E.push([1,M])),this.colorStops=E}getIR(){const{coordsArr:A,shadingType:e}=this;let t,i,a,s,n;return 2===e?(i=[A[0],A[1]],a=[A[2],A[3]],s=null,n=null,t="axial"):3===e?(i=[A[0],A[1]],a=[A[3],A[4]],s=A[2],n=A[5],t="radial"):R(`getPattern type unknown: ${e}`),["RadialAxial",t,this.bbox,this.colorStops,i,a,s,n]}}class Vs{constructor(A,e){this.stream=A,this.context=e,this.buffer=0,this.bufferLength=0;const t=e.numComps;this.tmpCompsBuf=new Float32Array(t);const i=e.colorSpace.numComps;this.tmpCsCompsBuf=e.colorFn?new Float32Array(i):this.tmpCompsBuf}get hasData(){if(this.stream.end)return this.stream.pos0)return!0;const A=this.stream.getByte();return!(A<0||(this.buffer=A,this.bufferLength=8,0))}readBits(A){let e=this.buffer,t=this.bufferLength;if(32===A){if(0===t)return(this.stream.getByte()<<24|this.stream.getByte()<<16|this.stream.getByte()<<8|this.stream.getByte())>>>0;e=e<<24|this.stream.getByte()<<16|this.stream.getByte()<<8|this.stream.getByte();const A=this.stream.getByte();return this.buffer=A&(1<>t)>>>0}if(8===A&&0===t)return this.stream.getByte();for(;t>t}align(){this.buffer=0,this.bufferLength=0}readFlag(){return this.readBits(this.context.bitsPerFlag)}readCoordinate(){const A=this.context.bitsPerCoordinate,e=this.readBits(A),t=this.readBits(A),i=this.context.decode,a=A<32?1/((1<s?s:A,e=e>n?n:e,t=tA*a[e])):t;let n,g=-2;const r=[];for(const[A,e]of i.map(((A,e)=>[A,e])).sort((([A],[e])=>A-e)))-1!==A&&(A===g+1?(n.push(s[e]),g+=1):(g=A,n=[s[e]],r.push(A,n)));return r}(A),t=new cA(null);t.set("BaseFont",rA.get(A)),t.set("Type",rA.get("Font")),t.set("Subtype",rA.get("CIDFontType2")),t.set("Encoding",rA.get("Identity-H")),t.set("CIDToGIDMap",rA.get("Identity")),t.set("W",e),t.set("FirstChar",e[0]),t.set("LastChar",e.at(-2)+e.at(-1).length-1);const i=new cA(null);t.set("FontDescriptor",i);const a=new cA(null);return a.set("Ordering","Identity"),a.set("Registry","Adobe"),a.set("Supplement",0),t.set("CIDSystemInfo",a),t}class Wn{constructor(A){this.lexer=A,this.operators=[],this.token=null,this.prev=null}nextToken(){this.prev=this.token,this.token=this.lexer.getToken()}accept(A){return this.token.type===A&&(this.nextToken(),!0)}expect(A){if(this.accept(A))return!0;throw new v(`Unexpected symbol: found ${this.token.type} expected ${A}.`)}parse(){return this.nextToken(),this.expect(Zn.LBRACE),this.parseBlock(),this.expect(Zn.RBRACE),this.operators}parseBlock(){for(;;)if(this.accept(Zn.NUMBER))this.operators.push(this.prev.value);else if(this.accept(Zn.OPERATOR))this.operators.push(this.prev.value);else{if(!this.accept(Zn.LBRACE))return;this.parseCondition()}}parseCondition(){const A=this.operators.length;if(this.operators.push(null,null),this.parseBlock(),this.expect(Zn.RBRACE),this.accept(Zn.IF))this.operators[A]=this.operators.length,this.operators[A+1]="jz";else{if(!this.accept(Zn.LBRACE))throw new v("PS Function: error parsing conditional.");{const e=this.operators.length;this.operators.push(null,null);const t=this.operators.length;this.parseBlock(),this.expect(Zn.RBRACE),this.expect(Zn.IFELSE),this.operators[e]=this.operators.length,this.operators[e+1]="j",this.operators[A]=t,this.operators[A+1]="jz"}}}}const Zn={LBRACE:0,RBRACE:1,NUMBER:2,OPERATOR:3,IF:4,IFELSE:5};class On{static get opCache(){return x(this,"opCache",Object.create(null))}constructor(A,e){this.type=A,this.value=e}static getOperator(A){return On.opCache[A]||=new On(Zn.OPERATOR,A)}static get LBRACE(){return x(this,"LBRACE",new On(Zn.LBRACE,"{"))}static get RBRACE(){return x(this,"RBRACE",new On(Zn.RBRACE,"}"))}static get IF(){return x(this,"IF",new On(Zn.IF,"IF"))}static get IFELSE(){return x(this,"IFELSE",new On(Zn.IFELSE,"IFELSE"))}}class Xn{constructor(A){this.stream=A,this.nextChar(),this.strBuf=[]}nextChar(){return this.currentChar=this.stream.getByte()}getToken(){let A=!1,e=this.currentChar;for(;;){if(e<0)return aA;if(A)10!==e&&13!==e||(A=!1);else if(37===e)A=!0;else if(!UA(e))break;e=this.nextChar()}switch(0|e){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 new On(Zn.NUMBER,this.getNumber());case 123:return this.nextChar(),On.LBRACE;case 125:return this.nextChar(),On.RBRACE}const t=this.strBuf;for(t.length=0,t[0]=String.fromCharCode(e);(e=this.nextChar())>=0&&(e>=65&&e<=90||e>=97&&e<=122);)t.push(String.fromCharCode(e));const i=t.join("");switch(i.toLowerCase()){case"if":return On.IF;case"ifelse":return On.IFELSE;default:return On.getOperator(i)}}getNumber(){let A=this.currentChar;const e=this.strBuf;for(e.length=0,e[0]=String.fromCharCode(A);(A=this.nextChar())>=0&&(A>=48&&A<=57||45===A||46===A);)e.push(String.fromCharCode(A));const t=parseFloat(e.join(""));if(isNaN(t))throw new v(`Invalid floating point number: ${t}`);return t}}class Vn{constructor(A){this._onlyRefs=!0===A?.onlyRefs,this._onlyRefs||(this._nameRefMap=new Map,this._imageMap=new Map),this._imageCache=new hA}getByName(A){this._onlyRefs&&R("Should not call `getByName` method.");const e=this._nameRefMap.get(A);return e?this.getByRef(e):this._imageMap.get(A)||null}getByRef(A){return this._imageCache.get(A)||null}set(A,e,t){R("Abstract method `set` called.")}}class jn extends Vn{set(A,e=null,t){if("string"!=typeof A)throw new Error('LocalImageCache.set - expected "name" argument.');if(e){if(this._imageCache.has(e))return;return this._nameRefMap.set(A,e),void this._imageCache.put(e,t)}this._imageMap.has(A)||this._imageMap.set(A,t)}}class zn extends Vn{set(A=null,e=null,t){if("string"!=typeof A&&!e)throw new Error('LocalColorSpaceCache.set - expected "name" and/or "ref" argument.');if(e){if(this._imageCache.has(e))return;return null!==A&&this._nameRefMap.set(A,e),void this._imageCache.put(e,t)}this._imageMap.has(A)||this._imageMap.set(A,t)}}class _n extends Vn{constructor(A){super({onlyRefs:!0})}set(A=null,e,t){if(!e)throw new Error('LocalFunctionCache.set - expected "ref" argument.');this._imageCache.has(e)||this._imageCache.put(e,t)}}class $n extends Vn{set(A,e=null,t){if("string"!=typeof A)throw new Error('LocalGStateCache.set - expected "name" argument.');if(e){if(this._imageCache.has(e))return;return this._nameRefMap.set(A,e),void this._imageCache.put(e,t)}this._imageMap.has(A)||this._imageMap.set(A,t)}}class Ag extends Vn{constructor(A){super({onlyRefs:!0})}set(A=null,e,t){if(!e)throw new Error('LocalTilingPatternCache.set - expected "ref" argument.');this._imageCache.has(e)||this._imageCache.put(e,t)}}class eg extends Vn{constructor(A){super({onlyRefs:!0})}set(A=null,e,t){if(!e)throw new Error('RegionalImageCache.set - expected "ref" argument.');this._imageCache.has(e)||this._imageCache.put(e,t)}}class tg{static NUM_PAGES_THRESHOLD=2;static MIN_IMAGES_TO_CACHE=10;static MAX_BYTE_SIZE=5e7;#D=new BA;constructor(){this._refCache=new hA,this._imageCache=new hA}get#b(){let A=0;for(const e of this._imageCache)A+=e.byteSize;return A}get#k(){return!(this._imageCache.size+A)):null}class sg{static getSampleArray(A,e,t,i){let a,s,n=1;for(a=0,s=A.length;a>r)*I,o&=(1<t?A=t:A0&&(C=s[c-1]);let B=i[1];c>1,o=a.length>>1,I=new rg(g),c=Object.create(null);let C=8192;const B=new Float32Array(o);return function(A,e,t,i){let a,n,g="";const h=B;for(a=0;aA&&(n=A)),l[a]=n}C>0&&(C--,c[g]=l),t.set(l,i)}}}function ng(A){let e;if(A instanceof cA)e=A;else{if(!(A instanceof dA))return!1;e=A.dict}return e.has("FunctionType")}class gg{static MAX_STACK_SIZE=100;constructor(A){this.stack=A?Array.from(A):[]}push(A){if(this.stack.length>=gg.MAX_STACK_SIZE)throw new Error("PostScript function stack overflow.");this.stack.push(A)}pop(){if(this.stack.length<=0)throw new Error("PostScript function stack underflow.");return this.stack.pop()}copy(A){if(this.stack.length+A>=gg.MAX_STACK_SIZE)throw new Error("PostScript function stack overflow.");const e=this.stack;for(let t=e.length-A,i=A-1;i>=0;i--,t++)e.push(e[t])}index(A){this.push(this.stack[this.stack.length-A-1])}roll(A,e){const t=this.stack,i=t.length-A,a=t.length-1,s=i+(e-Math.floor(e/A)*A);for(let A=i,e=a;A0?e.push(n<>g);break;case"ceiling":n=e.pop(),e.push(Math.ceil(n));break;case"copy":n=e.pop(),e.copy(n);break;case"cos":n=e.pop(),e.push(Math.cos(n%360/180*Math.PI));break;case"cvi":n=0|e.pop(),e.push(n);break;case"cvr":break;case"div":g=e.pop(),n=e.pop(),e.push(n/g);break;case"dup":e.copy(1);break;case"eq":g=e.pop(),n=e.pop(),e.push(n===g);break;case"exch":e.roll(2,1);break;case"exp":g=e.pop(),n=e.pop(),e.push(n**g);break;case"false":e.push(!1);break;case"floor":n=e.pop(),e.push(Math.floor(n));break;case"ge":g=e.pop(),n=e.pop(),e.push(n>=g);break;case"gt":g=e.pop(),n=e.pop(),e.push(n>g);break;case"idiv":g=e.pop(),n=e.pop(),e.push(n/g|0);break;case"index":n=e.pop(),e.index(n);break;case"le":g=e.pop(),n=e.pop(),e.push(n<=g);break;case"ln":n=e.pop(),e.push(Math.log(n));break;case"log":n=e.pop(),e.push(Math.log10(n));break;case"lt":g=e.pop(),n=e.pop(),e.push(n=e?new cg(e):A.max<=e?A:new Bg(A,e)}class pg{compile(A,e,t){const i=[],a=[],s=e.length>>1,n=t.length>>1;let g,r,o,I,c,C,B,h,Q=0;for(let A=0;Ae.min&&(g.unshift("Math.max(",s,", "),g.push(")")),n4?(i=!0,e=0):(i=!1,e=1));const r=[];for(s=0;s=0&&"ET"===Gg[A];--A)Gg[A]="EN";for(let A=s+1;A0&&(e=Gg[s-1]);let t=c;A+1h&&wg(h)&&(l=h);for(h=Q;h>=l;--h){let A=-1;for(s=0,n=r.length;s=0&&(Fg(Rg,A,s),A=-1):A<0&&(A=s);A>=0&&Fg(Rg,A,r.length)}for(s=0,n=Rg.length;s"!==A||(Rg[s]="")}return Sg(Rg.join(""),i)}const xg={style:"normal",weight:"normal"},Ug={style:"normal",weight:"bold"},Mg={style:"italic",weight:"normal"},Lg={style:"italic",weight:"bold"},Jg=new Map([["Times-Roman",{local:["Times New Roman","Times-Roman","Times","Liberation Serif","Nimbus Roman","Nimbus Roman L","Tinos","Thorndale","TeX Gyre Termes","FreeSerif","Linux Libertine O","Libertinus Serif","DejaVu Serif","Bitstream Vera Serif","Ubuntu"],style:xg,ultimate:"serif"}],["Times-Bold",{alias:"Times-Roman",style:Ug,ultimate:"serif"}],["Times-Italic",{alias:"Times-Roman",style:Mg,ultimate:"serif"}],["Times-BoldItalic",{alias:"Times-Roman",style:Lg,ultimate:"serif"}],["Helvetica",{local:["Helvetica","Helvetica Neue","Arial","Arial Nova","Liberation Sans","Arimo","Nimbus Sans","Nimbus Sans L","A030","TeX Gyre Heros","FreeSans","DejaVu Sans","Albany","Bitstream Vera Sans","Arial Unicode MS","Microsoft Sans Serif","Apple Symbols","Cantarell"],path:"LiberationSans-Regular.ttf",style:xg,ultimate:"sans-serif"}],["Helvetica-Bold",{alias:"Helvetica",path:"LiberationSans-Bold.ttf",style:Ug,ultimate:"sans-serif"}],["Helvetica-Oblique",{alias:"Helvetica",path:"LiberationSans-Italic.ttf",style:Mg,ultimate:"sans-serif"}],["Helvetica-BoldOblique",{alias:"Helvetica",path:"LiberationSans-BoldItalic.ttf",style:Lg,ultimate:"sans-serif"}],["Courier",{local:["Courier","Courier New","Liberation Mono","Nimbus Mono","Nimbus Mono L","Cousine","Cumberland","TeX Gyre Cursor","FreeMono","Linux Libertine Mono O","Libertinus Mono"],style:xg,ultimate:"monospace"}],["Courier-Bold",{alias:"Courier",style:Ug,ultimate:"monospace"}],["Courier-Oblique",{alias:"Courier",style:Mg,ultimate:"monospace"}],["Courier-BoldOblique",{alias:"Courier",style:Lg,ultimate:"monospace"}],["ArialBlack",{local:["Arial Black"],style:{style:"normal",weight:"900"},fallback:"Helvetica-Bold"}],["ArialBlack-Bold",{alias:"ArialBlack"}],["ArialBlack-Italic",{alias:"ArialBlack",style:{style:"italic",weight:"900"},fallback:"Helvetica-BoldOblique"}],["ArialBlack-BoldItalic",{alias:"ArialBlack-Italic"}],["ArialNarrow",{local:["Arial Narrow","Liberation Sans Narrow","Helvetica Condensed","Nimbus Sans Narrow","TeX Gyre Heros Cn"],style:xg,fallback:"Helvetica"}],["ArialNarrow-Bold",{alias:"ArialNarrow",style:Ug,fallback:"Helvetica-Bold"}],["ArialNarrow-Italic",{alias:"ArialNarrow",style:Mg,fallback:"Helvetica-Oblique"}],["ArialNarrow-BoldItalic",{alias:"ArialNarrow",style:Lg,fallback:"Helvetica-BoldOblique"}],["Calibri",{local:["Calibri","Carlito"],style:xg,fallback:"Helvetica"}],["Calibri-Bold",{alias:"Calibri",style:Ug,fallback:"Helvetica-Bold"}],["Calibri-Italic",{alias:"Calibri",style:Mg,fallback:"Helvetica-Oblique"}],["Calibri-BoldItalic",{alias:"Calibri",style:Lg,fallback:"Helvetica-BoldOblique"}],["Wingdings",{local:["Wingdings","URW Dingbats"],style:xg}],["Wingdings-Regular",{alias:"Wingdings"}],["Wingdings-Bold",{alias:"Wingdings"}]]),Hg=new Map([["Arial-Black","ArialBlack"]]);function Yg(A){const e=new Set(["thin","extralight","ultralight","demilight","semilight","light","book","regular","normal","medium","demibold","semibold","bold","extrabold","ultrabold","black","heavy","extrablack","ultrablack","roman","italic","oblique","ultracondensed","extracondensed","condensed","semicondensed","normal","semiexpanded","expanded","extraexpanded","ultraexpanded","bolditalic"]);return A.split(/[- ,+]+/g).filter((A=>!e.has(A.toLowerCase()))).join(" ")}function vg({alias:A,local:e,path:t,fallback:i,style:a,ultimate:s},n,g,r=!0,o=!0,I=""){const c={style:null,ultimate:null};if(e){const A=I?` ${I}`:"";for(const t of e)n.push(`local(${t}${A})`)}if(A){const e=Jg.get(A),s=I||function(A){switch(A){case Ug:return"Bold";case Mg:return"Italic";case Lg:return"Bold Italic";default:if("bold"===A?.weight)return"Bold";if("italic"===A?.style)return"Italic"}return""}(a);Object.assign(c,vg(e,n,g,r&&!i,o&&!t,s))}if(a&&(c.style=a),s&&(c.ultimate=s),r&&i){const A=Jg.get(i),{ultimate:e}=vg(A,n,g,r,o&&!t,I);c.ultimate||=e}return o&&t&&g&&n.push(`url(${g}${t})`),c}function Kg(A,e,t,i,a,s){if(i.startsWith("InvalidPDFjsFont_"))return null;"TrueType"!==s&&"Type1"!==s||!/^[A-Z]{6}\+/.test(i)||(i=i.slice(7));const n=i=Ca(i);let g=A.get(n);if(g)return g;let r=Jg.get(i);if(!r)for(const[A,e]of Hg)if(i.startsWith(A)){i=`${e}${i.substring(A.length)}`,r=Jg.get(i);break}let o=!1;r||(r=Jg.get(a),o=!0);const I=`${e.getDocId()}_s${e.createFontId()}`;if(!r){if(!OA(i))return S(`Cannot substitute the font because of its name: ${i}`),A.set(n,null),null;const e=/bold/gi.test(i),t=/oblique|italic/gi.test(i),a=e&&t&&Lg||e&&Ug||t&&Mg||xg;return g={css:`"${Yg(i)}",${I}`,guessFallback:!0,loadedName:I,baseFontName:i,src:`local(${i})`,style:a},A.set(n,g),g}const c=[];o&&OA(i)&&c.push(`local(${i})`);const{style:C,ultimate:B}=vg(r,c,t),h=null===B,Q=h?"":`,${B}`;return g={css:`"${Yg(i)}",${I}${Q}`,guessFallback:h,loadedName:I,baseFontName:i,src:c.join(","),style:C},A.set(n,g),g}class qg{constructor(A,e){this._imgData=A,this._isMask=e}static needsToBeResized(A,e){if(A<=this._goodSquareLength&&e<=this._goodSquareLength)return!1;const{MAX_DIM:t}=this;if(A>t||e>t)return!0;const i=A*e;return this._hasMaxArea?i>this.MAX_AREA:!(i(this.MAX_AREA=this._goodSquareLength**2)))}static get MAX_DIM(){return x(this,"MAX_DIM",this._guessMax(2048,65537,0,1))}static get MAX_AREA(){return this._hasMaxArea=!0,x(this,"MAX_AREA",this._guessMax(qg._goodSquareLength,this.MAX_DIM,128,0)**2)}static set MAX_AREA(A){A>=0&&(this._hasMaxArea=!0,x(this,"MAX_AREA",A))}static setMaxArea(A){this._hasMaxArea||(this.MAX_AREA=A>>2)}static _areGoodDims(A,e){try{const t=new OffscreenCanvas(A,e),i=t.getContext("2d");i.fillRect(0,0,1,1);const a=i.getImageData(0,0,1,1).data[3];return t.width=t.height=1,0!==a}catch{return!1}}static _guessMax(A,e,t,i){for(;A+t+1>3,n=t+3&-4;if(t!==n){const A=new Uint8Array(n*e);let i=0;for(let s=0,g=e*t;s>>8,e[t++]=255&a)}}else{if(!ArrayBuffer.isView(A))throw new Error("Invalid data format, must be a string or TypedArray.");e=A.slice(),t=e.byteLength}const i=t>>2,a=t-4*i,s=new Uint32Array(e.buffer,0,i);let n=0,g=0,r=this.h1,o=this.h2;const I=3432918353,c=461845907,C=11601,B=13715;for(let A=0;A>>17,n=n*c&Pg|n*B&Wg,r^=n,r=r<<13|r>>>19,r=5*r+3864292196):(g=s[A],g=g*I&Pg|g*C&Wg,g=g<<15|g>>>17,g=g*c&Pg|g*B&Wg,o^=g,o=o<<13|o>>>19,o=5*o+3864292196);switch(n=0,a){case 3:n^=e[4*i+2]<<16;case 2:n^=e[4*i+1]<<8;case 1:n^=e[4*i],n=n*I&Pg|n*C&Wg,n=n<<15|n>>>17,n=n*c&Pg|n*B&Wg,1&i?r^=n:o^=n}this.h1=r,this.h2=o}hexdigest(){let A=this.h1,e=this.h2;return A^=e>>>1,A=3981806797*A&Pg|36045*A&Wg,e=4283543511*e&Pg|(2950163797*(e<<16|A>>>16)&Pg)>>>16,A^=e>>>1,A=444984403*A&Pg|60499*A&Wg,e=3301882366*e&Pg|(3120437893*(e<<16|A>>>16)&Pg)>>>16,A^=e>>>1,(A>>>0).toString(16).padStart(8,"0")+(e>>>0).toString(16).padStart(8,"0")}}function Og(A,e,t,i,a){let s=A;for(let A=0,t=e.length-1;A1e3&&(o=Math.max(o,C),B+=c+2,C=0,c=0),I.push({transform:e,x:C,y:B,w:t.width,h:t.height}),C+=t.width+2,c=Math.max(c,t.height)}const h=Math.max(o,C)+1,Q=B+c+1,l=new Uint8Array(h*Q*4),E=h<<2;for(let A=0;A=0;)e[s-4]=e[s],e[s-3]=e[s+1],e[s-2]=e[s+2],e[s-1]=e[s+3],e[s+t]=e[s+t-4],e[s+t+1]=e[s+t-3],e[s+t+2]=e[s+t-2],e[s+t+3]=e[s+t-1],s-=E}const u={width:h,height:Q};if(A.isOffscreenCanvasSupported){const A=new OffscreenCanvas(h,Q);A.getContext("2d").putImageData(new ImageData(new Uint8ClampedArray(l.buffer),h,Q),0,0),u.bitmap=A.transferToImageBitmap(),u.data=null}else u.kind=3,u.data=l;return t.splice(s,4*r,87),i.splice(s,4*r,[u,I]),s+1})),Og(Xg,[Q,E,w,l],null,(function(A,e){const t=A.fnArray,i=(e-(A.iCurr-3))%4;switch(i){case 0:return t[e]===Q;case 1:return t[e]===E;case 2:return t[e]===w;case 3:return t[e]===l}throw new Error(`iterateImageMaskGroup - invalid pos: ${i}`)}),(function(A,e){const t=A.fnArray,i=A.argsArray,a=A.iCurr,s=a-3,n=a-2,g=a-1;let r=Math.floor((e-s)/4);if(r<10)return e-(e-s)%4;let o,I,c=!1;const C=i[g][0],B=i[n][0],h=i[n][1],Q=i[n][2],l=i[n][3];if(h===Q){c=!0,o=n+4;let A=g+4;for(let e=1;e=4&&t[s-4]===t[n]&&t[s-3]===t[g]&&t[s-2]===t[r]&&t[s-1]===t[o]&&i[s-4][0]===I&&i[s-4][1]===c&&(C++,B-=5);let h=B+4;for(let A=1;A=t)break}i=(i||Xg)[A[e]],i&&!Array.isArray(i)?(s.iCurr=e,e++,!i.checkFn||(0,i.checkFn)(s)?(a=i,i=null):i=null):e++}this.state=i,this.match=a,this.lastProcessed=e}flush(){for(;this.match;){const A=this.queue.fnArray.length;this.lastProcessed=(0,this.match.processFn)(this.context,A),this.match=null,this.state=null,this._optimize()}}reset(){this.state=null,this.match=null,this.lastProcessed=0}}class zg{static CHUNK_SIZE=1e3;static CHUNK_SIZE_ABOUT=this.CHUNK_SIZE-5;constructor(A=0,e){this._streamSink=e,this.fnArray=[],this.argsArray=[],this.optimizer=!e||256&A?new Vg(this):new jg(this),this.dependencies=new Set,this._totalLength=0,this.weight=0,this._resolved=e?null:Promise.resolve()}set isOffscreenCanvasSupported(A){this.optimizer.isOffscreenCanvasSupported=A}get length(){return this.argsArray.length}get ready(){return this._resolved||this._streamSink.ready}get totalLength(){return this._totalLength+this.length}addOp(A,e){this.optimizer.push(A,e),this.weight++,this._streamSink&&(this.weight>=zg.CHUNK_SIZE||this.weight>=zg.CHUNK_SIZE_ABOUT&&(A===l||32===A))&&this.flush()}addImageOps(A,e,t){void 0!==t&&this.addOp(m,["OC",t]),this.addOp(A,e),void 0!==t&&this.addOp(y,[])}addDependency(A){this.dependencies.has(A)||(this.dependencies.add(A),this.addOp(1,[A]))}addDependencies(A){for(const e of A)this.addDependency(e)}addOpList(A){if(A instanceof zg){for(const e of A.dependencies)this.dependencies.add(e);for(let e=0,t=A.length;ei&&(A=i),A}function $g(A,e,t,i,a,s){const n=a*s;let g;g=e<=8?new Uint8Array(n):e<=16?new Uint16Array(n):new Uint32Array(n);const r=t/a,o=i/s;let I,c,C,B,h=0;const Q=new Uint16Array(a),l=t;for(I=0;I0&&Number.isInteger(t.height)&&t.height>0&&(t.width!==C||t.height!==B)&&(S("PDFImage - using the Width/Height of the image data, rather than the image dictionary."),C=t.width,B=t.height),C<1||B<1)throw new v(`Invalid image width: ${C} or height: ${B}`);this.width=C,this.height=B,this.interpolate=o.get("I","Interpolate"),this.imageMask=o.get("IM","ImageMask")||!1,this.matte=o.get("Matte")||!1;let h=t.bitsPerComponent;if(!h&&(h=o.get("BPC","BitsPerComponent"),!h)){if(!this.imageMask)throw new v(`Bits per component missing in image: ${this.imageMask}`);h=1}if(this.bpc=h,!this.imageMask){let a=o.getRaw("CS")||o.getRaw("ColorSpace");const s=!!a;if(s)this.jpxDecoderOptions?.smaskInData&&(a=rA.get("DeviceRGBA"));else if(this.jpxDecoderOptions)a=rA.get("DeviceRGBA");else switch(t.numComps){case 1:a=rA.get("DeviceGray");break;case 3:a=rA.get("DeviceRGB");break;case 4:a=rA.get("DeviceCMYK");break;default:throw new Error(`Images with ${t.numComps} color components not supported.`)}this.colorSpace=re.parse({cs:a,xref:A,resources:i?e:null,pdfFunctionFactory:g,localColorSpaceCache:r}),this.numComps=this.colorSpace.numComps,this.jpxDecoderOptions&&(this.jpxDecoderOptions.numComponents=s?this.numComp:0,this.jpxDecoderOptions.isIndexedColormap="Indexed"===this.colorSpace.name)}if(this.decode=o.getArray("D","Decode"),this.needsDecode=!1,this.decode&&(this.colorSpace&&!this.colorSpace.isDefaultDecode(this.decode,h)||n&&!re.isDefaultDecode(this.decode,1))){this.needsDecode=!0;const A=(1<>3)*t,g=A.byteLength;let r,o;if(!i||a&&n!==g?a?(r=new Uint8Array(n),r.set(A),r.fill(255,g)):r=new Uint8Array(A):r=A,a)for(o=0;o>7&1,n[C+1]=c>>6&1,n[C+2]=c>>5&1,n[C+3]=c>>4&1,n[C+4]=c>>3&1,n[C+5]=c>>2&1,n[C+6]=c>>1&1,n[C+7]=1&c,C+=8;if(C>=1}}else{let t=0;for(c=0,C=0,I=s;C>i;a<0?a=0:a>o&&(a=o),n[C]=a,c&=(1<n[i+1]){e=255;break}}g[I]=e}}}if(g)for(I=0,C=3,c=e*i;I>3,I=e&&qg.needsToBeResized(t,i);if("DeviceRGBA"===this.colorSpace.name){a.kind=3;const A=a.data=await this.getImageBytes(g*n*4,{});return e?I?qg.createImage(a,!1):this.createBitmap(3,t,i,A):a}if(!A){let A;if("DeviceGray"===this.colorSpace.name&&1===r?A=1:"DeviceRGB"!==this.colorSpace.name||8!==r||this.needsDecode||(A=2),A&&!this.smask&&!this.mask&&t===n&&i===g){const s=await this.getImageBytes(g*o,{});if(e)return I?qg.createImage({data:s,kind:A,width:t,height:i,interpolate:this.interpolate},this.needsDecode):this.createBitmap(A,n,g,s);if(a.kind=A,a.data=s,this.needsDecode){G(1===A,"PDFImage.createImageData: The image must be grayscale.");const e=a.data;for(let A=0,t=e.length;A>3,n=await this.getImageBytes(i*s,{internal:!0}),g=this.getComponents(n);let r,o;if(1===a){if(o=t*i,this.needsDecode)for(r=0;r>2,r=new Uint32Array(A.buffer,e,g);if(Z.isLittleEndian){for(;n>>24|e<<8|4278190080,t[i+2]=e>>>16|a<<16|4278190080,t[i+3]=a>>>8|4278190080}for(let e=4*n,a=A.length;e>>8|255,t[i+2]=e<<16|a>>>16|255,t[i+3]=a<<8|255}for(let e=4*n,a=A.length;e0&&e.args[0].count++}class sr{static TIME_SLOT_DURATION_MS=20;static CHECK_TIME_EVERY=100;constructor(){this.reset()}check(){return!(++this.checkedc){const A="Image exceeded maximum allowed size and was removed.";if(this.options.ignoreErrors)return void S(A);throw new Error(A)}let C,B,h;if(g.has("OC")&&(C=await this.parseMarkedContentProps(g.get("OC"),A)),g.get("IM","ImageMask")){const A=g.get("I","Interpolate"),t=o+7>>3,n=e.getBytes(t*I),c=g.getArray("D","Decode");if(this.parsingType3Font){if(B=Ar.createRawMask({imgArray:n,width:o,height:I,imageIsFromDecodeStream:e instanceof ke,inverseDecode:c?.[0]>0,interpolate:A}),B.cached=!!a,h=[B],i.addImageOps(w,h,C),a){const A={fn:w,args:h,optionalContent:C};s.set(a,r,A),r&&this._regionalImageCache.set(null,r,A)}return}if(B=await Ar.createMask({imgArray:n,width:o,height:I,imageIsFromDecodeStream:e instanceof ke,inverseDecode:c?.[0]>0,interpolate:A,isOffscreenCanvasSupported:this.options.isOffscreenCanvasSupported}),B.isSingleOpaquePixel){if(i.addImageOps(90,[],C),a){const A={fn:90,args:[],optionalContent:C};s.set(a,r,A),r&&this._regionalImageCache.set(null,r,A)}return}const Q=`mask_${this.idFactory.createObjId()}`;if(i.addDependency(Q),B.dataLen=B.bitmap?B.width*B.height*4:B.data.length,this._sendImgData(Q,B),h=[{data:Q,width:B.width,height:B.height,interpolate:B.interpolate,count:1}],i.addImageOps(w,h,C),a){const A={objId:Q,fn:w,args:h,optionalContent:C};s.set(a,r,A),r&&this._regionalImageCache.set(null,r,A)}return}if(t&&o+I<200&&!g.has("SMask")&&!g.has("Mask")){try{const a=new Ar({xref:this.xref,res:A,image:e,isInline:t,pdfFunctionFactory:this._pdfFunctionFactory,localColorSpaceCache:n});B=await a.createImageData(!0,!1),i.isOffscreenCanvasSupported=this.options.isOffscreenCanvasSupported,i.addImageOps(86,[B],C)}catch(A){const e=`Unable to decode inline image: "${A}".`;if(!this.options.ignoreErrors)throw new Error(e);S(e)}return}let Q=`img_${this.idFactory.createObjId()}`,l=!1;if(this.parsingType3Font?Q=`${this.idFactory.getDocId()}_type3_${Q}`:a&&r&&(l=this.globalImageCache.shouldCache(r,this.pageIndex),l&&(G(!t,"Cannot cache an inline image globally."),Q=`${this.idFactory.getDocId()}_${Q}`)),i.addDependency(Q),h=[Q,o,I],i.addImageOps(D,h,C),l){if(this.globalImageCache.hasDecodeFailed(r))return this.globalImageCache.setData(r,{objId:Q,fn:D,args:h,optionalContent:C,byteSize:0}),void this._sendImgData(Q,null,l);if(o*I>25e4||g.has("SMask")||g.has("Mask")){const A=await this.handler.sendWithPromise("commonobj",[Q,"CopyLocalImage",{imageRef:r}]);if(A)return this.globalImageCache.setData(r,{objId:Q,fn:D,args:h,optionalContent:C,byteSize:0}),void this.globalImageCache.addByteSize(r,A)}}if(Ar.buildImage({xref:this.xref,res:A,image:e,isInline:t,pdfFunctionFactory:this._pdfFunctionFactory,localColorSpaceCache:n}).then((async A=>(B=await A.createImageData(!1,this.options.isOffscreenCanvasSupported),B.dataLen=B.bitmap?B.width*B.height*4:B.data.length,B.ref=r,l&&this.globalImageCache.addByteSize(r,B.dataLen),this._sendImgData(Q,B,l)))).catch((A=>(S(`Unable to decode image "${Q}": "${A}".`),r&&this.globalImageCache.addDecodeFailed(r),this._sendImgData(Q,null,l)))),a){const A={objId:Q,fn:D,args:h,optionalContent:C};s.set(a,r,A),r&&(this._regionalImageCache.set(null,r,A),l&&this.globalImageCache.setData(r,{objId:Q,fn:D,args:h,optionalContent:C,byteSize:0}))}}handleSMask(A,e,t,i,a,s){const n=A.get("G"),g={subtype:A.get("S").name,backdrop:A.get("BC")},r=A.get("TR");if(ng(r)){const A=this._pdfFunctionFactory.create(r),e=new Uint8Array(256),t=new Float32Array(1);for(let i=0;i<256;i++)t[0]=i/255,A(t,0,t,0),e[i]=255*t[0]|0;g.transferMap=e}return this.buildFormXObject(e,n,g,t,i,a.state.clone(),s)}handleTransferFunction(A){let e;if(Array.isArray(A))e=A;else{if(!ng(A))return null;e=[A]}const t=[];let i=0,a=0;for(const A of e){const e=this.xref.fetchIfRef(A);if(i++,QA(e,"Identity")){t.push(null);continue}if(!ng(e))return null;const s=this._pdfFunctionFactory.create(e),n=new Uint8Array(256),g=new Float32Array(1);for(let A=0;A<256;A++)g[0]=A/255,s(g,0,g,0),n[A]=255*g[0]|0;t.push(n),a++}return 1!==i&&4!==i||0===a?null:t}handleTilingType(A,e,t,i,a,s,n,g){const r=new zg,o=cA.merge({xref:this.xref,dictArray:[a.get("Resources"),t]});return this.getOperatorList({stream:i,task:n,resources:o,operatorList:r}).then((function(){const t=r.getIR(),i=An(t,a,e);s.addDependencies(r.dependencies),s.addOp(A,i),a.objId&&g.set(null,a.objId,{operatorListIR:t,dict:a})})).catch((A=>{if(!(A instanceof K)){if(!this.options.ignoreErrors)throw A;S(`handleTilingType - ignoring pattern: "${A}".`)}}))}async handleSetFont(A,e,t,i,a,s,n=null,g=null){const r=e?.[0]instanceof rA?e[0].name:null;let o=await this.loadFont(r,t,A,n,g);if(o.font.isType3Font)try{await o.loadType3Data(this,A,a),i.addDependencies(o.type3Dependencies)}catch(A){o=new gr({loadedName:"g_font_error",font:new Ws(`Type3 font load error: ${A}`),dict:o.font,evaluatorOptions:this.options})}return s.font=o.font,o.send(this.handler),o.loadedName}handleText(A,e){const t=e.font,i=t.charsToGlyphs(A);return t.data&&(4&e.textRenderingMode||"Pattern"===e.fillColorSpace.name||t.disableFontFace||this.options.disableFontFace)&&nr.buildFontPaths(t,i,this.handler,this.options),i}ensureStateFont(A){if(A.font)return;const e=new v("Missing setFont (Tf) operator before text rendering operator.");if(!this.options.ignoreErrors)throw e;S(`ensureStateFont: "${e}".`)}async setGState({resources:A,gState:e,operatorList:t,cacheKey:i,task:a,stateManager:s,localGStateCache:n,localColorSpaceCache:g}){const r=e.objId;let o=!0;const I=[];let c=Promise.resolve();for(const i of e.getKeys()){const n=e.get(i);switch(i){case"Type":break;case"LW":case"LC":case"LJ":case"ML":case"D":case"RI":case"FL":case"CA":case"ca":I.push([i,n]);break;case"Font":o=!1,c=c.then((()=>this.handleSetFont(A,null,n[0],t,a,s.state).then((function(A){t.addDependency(A),I.push([i,[A,n[1]]])}))));break;case"BM":I.push([i,ir(n)]);break;case"SMask":if(QA(n,"None")){I.push([i,!1]);break}n instanceof cA?(o=!1,c=c.then((()=>this.handleSMask(n,A,t,a,s,g))),I.push([i,!0])):S("Unsupported SMask type");break;case"TR":const e=this.handleTransferFunction(n);I.push([i,e]);break;case"OP":case"op":case"OPM":case"BG":case"BG2":case"UCR":case"UCR2":case"TR2":case"HT":case"SM":case"SA":case"AIS":case"TK":F("graphic state operator "+i);break;default:F("Unknown graphic state operator "+i)}}await c,I.length>0&&t.addOp(9,[I]),o&&n.set(i,r,I)}loadFont(A,e,t,i=null,a=null){const s=async()=>new gr({loadedName:"g_font_error",font:new Ws(`Font "${A}" is not available.`),dict:e,evaluatorOptions:this.options});let n;if(e)e instanceof CA&&(n=e);else{const e=t.get("Font");e&&(n=e.getRaw(A))}if(n){if(this.type3FontRefs?.has(n))return s();if(this.fontCache.has(n))return this.fontCache.get(n);try{e=this.xref.fetchIfRef(n)}catch(A){S(`loadFont - lookup failed: "${A}".`)}}if(!(e instanceof cA)){if(!this.options.ignoreErrors&&!this.parsingType3Font)return S(`Font "${A}" is not available.`),s();S(`Font "${A}" is not available -- attempting to fallback to a default font.`),e=i||nr.fallbackFontDict}if(e.cacheKey&&this.fontCache.has(e.cacheKey))return this.fontCache.get(e.cacheKey);const{promise:g,resolve:r}=Promise.withResolvers();let o;try{o=this.preEvaluateFont(e),o.cssFontInfo=a}catch(A){return S(`loadFont - preEvaluateFont failed: "${A}".`),s()}const{descriptor:I,hash:c}=o,C=n instanceof CA;let B;if(c&&I instanceof cA){const A=I.fontAliases||=Object.create(null);if(A[c]){const e=A[c].aliasRef;if(C&&e&&this.fontCache.has(e))return this.fontCache.putAlias(n,e),this.fontCache.get(n)}else A[c]={fontID:this.idFactory.createFontId()};C&&(A[c].aliasRef=n),B=A[c].fontID}else B=this.idFactory.createFontId();return G(B?.startsWith("f"),'The "fontID" must be (correctly) defined.'),C?this.fontCache.put(n,g):(e.cacheKey=`cacheKey_${B}`,this.fontCache.put(e.cacheKey,g)),e.loadedName=`${this.idFactory.getDocId()}_${B}`,this.translateFont(o).then((A=>{r(new gr({loadedName:e.loadedName,font:A,dict:e,evaluatorOptions:this.options}))})).catch((A=>{S(`loadFont - translateFont failed: "${A}".`),r(new gr({loadedName:e.loadedName,font:new Ws(A instanceof Error?A.message:A),dict:e,evaluatorOptions:this.options}))})),g}buildPath(A,e,t,i=!1){const a=A.length-1;if(t||(t=[]),a<0||91!==A.fnArray[a]){let a;switch(i&&(S(`Encountered path operator "${e}" inside of a text object.`),A.addOp(Q,null)),e){case 19:const A=t[0]+t[2],e=t[1]+t[3];a=[Math.min(t[0],A),Math.min(t[1],e),Math.max(t[0],A),Math.max(t[1],e)];break;case 13:case 14:a=[t[0],t[1],t[0],t[1]];break;default:a=[1/0,1/0,-1/0,-1/0]}A.addOp(91,[[e],t,a]),i&&A.addOp(l,null)}else{const i=A.argsArray[a];i[0].push(e),i[1].push(...t);const s=i[2];switch(e){case 19:const A=t[0]+t[2],e=t[1]+t[3];s[0]=Math.min(s[0],t[0],A),s[1]=Math.min(s[1],t[1],e),s[2]=Math.max(s[2],t[0],A),s[3]=Math.max(s[3],t[1],e);break;case 13:case 14:s[0]=Math.min(s[0],t[0]),s[1]=Math.min(s[1],t[1]),s[2]=Math.max(s[2],t[0]),s[3]=Math.max(s[3],t[1])}}}parseColorSpace({cs:A,resources:e,localColorSpaceCache:t}){return re.parseAsync({cs:A,xref:this.xref,resources:e,pdfFunctionFactory:this._pdfFunctionFactory,localColorSpaceCache:t}).catch((A=>{if(A instanceof K)return null;if(this.options.ignoreErrors)return S(`parseColorSpace - ignoring ColorSpace: "${A}".`),null;throw A}))}parseShading({shading:A,resources:e,localColorSpaceCache:t,localShadingPatternCache:i}){let a,s=i.get(A);if(s)return s;try{a=Zs.parseShading(A,this.xref,e,this._pdfFunctionFactory,t).getIR()}catch(e){if(e instanceof K)return null;if(this.options.ignoreErrors)return S(`parseShading - ignoring shading: "${e}".`),i.set(A,null),null;throw e}return s=`pattern_${this.idFactory.createObjId()}`,this.parsingType3Font&&(s=`${this.idFactory.getDocId()}_type3_${s}`),i.set(A,s),this.parsingType3Font?this.handler.send("commonobj",[s,"Pattern",a]):this.handler.send("obj",[s,this.pageIndex,"Pattern",a]),s}handleColorN(A,e,t,i,a,s,n,g,r,o){const I=t.pop();if(I instanceof rA){const c=a.getRaw(I.name),C=c instanceof CA&&r.getByRef(c);if(C)try{const a=i.base?i.base.getRgb(t,0):null,s=An(C.operatorListIR,C.dict,a);return void A.addOp(e,s)}catch{}const B=this.xref.fetchIfRef(c);if(B){const a=B instanceof dA?B.dict:B,I=a.get("PatternType");if(1===I){const g=i.base?i.base.getRgb(t,0):null;return this.handleTilingType(e,g,s,B,a,A,n,r)}if(2===I){const t=a.get("Shading"),i=this.parseShading({shading:t,resources:s,localColorSpaceCache:g,localShadingPatternCache:o});if(i){const t=LA(a.getArray("Matrix"),null);A.addOp(e,["Shading",i,t])}return}throw new v(`Unknown PatternType: ${I}`)}}throw new v(`Unknown PatternName: ${I}`)}_parseVisibilityExpression(A,e,t){if(++e>10)return void S("Visibility expression is too deeply nested");const i=A.length,a=this.xref.fetchIfRef(A[0]);if(!(i<2)&&a instanceof rA){switch(a.name){case"And":case"Or":case"Not":t.push(a.name);break;default:return void S(`Invalid operator ${a.name} in visibility expression`)}for(let a=1;a0)return{type:"OCMD",expression:e}}const e=t.get("OCGs");if(Array.isArray(e)||e instanceof cA){const A=[];if(Array.isArray(e))for(const t of e)A.push(t.toString());else A.push(e.objId);return{type:i,ids:A,policy:t.get("P")instanceof rA?t.get("P").name:null,expression:null}}if(e instanceof CA)return{type:i,id:e.toString()}}return null}getOperatorList({stream:A,task:e,resources:t,operatorList:i,initialState:a=null,fallbackFontDict:s=null}){if(t||=cA.empty,a||=new Ir,!i)throw new Error('getOperatorList: missing "operatorList" parameter');const n=this,g=this.xref;let r=!1;const o=new jn,I=new zn,c=new $n,C=new Ag,B=new Map,h=t.get("XObject")||cA.empty,Q=t.get("Pattern")||cA.empty,E=new rr(a),y=new cr(A,g,E),w=new sr;function D(A){for(let A=0,e=y.savedStatesDepth;A0&&i.addOp(9,[e]),A=null;continue}}return void b(new Promise((function(A,a){if(!M)throw new v("GState must be referred to by name.");const s=t.get("ExtGState");if(!(s instanceof cA))throw new v("ExtGState should be a dictionary.");const g=s.get(U);if(!(g instanceof cA))throw new v("GState should be a dictionary.");n.setGState({resources:t,gState:g,operatorList:i,cacheKey:U,task:e,stateManager:E,localGStateCache:c,localColorSpaceCache:I}).then(A,a)})).catch((function(A){if(!(A instanceof K)){if(!n.options.ignoreErrors)throw A;S(`getOperatorList - ignoring ExtGState: "${A}".`)}})));case 13:case 14:case 15:case 16:case 17:case 18:case 19:n.buildPath(i,a,A,r);continue;case 67:case 68:case 72:case 73:continue;case m:if(!(A[0]instanceof rA)){S(`Expected name for beginMarkedContentProps arg0=${A[0]}`),i.addOp(m,["OC",null]);continue}if("OC"===A[0].name)return void b(n.parseMarkedContentProps(A[1],t).then((A=>{i.addOp(m,["OC",A])})).catch((A=>{if(!(A instanceof K)){if(n.options.ignoreErrors)return S(`getOperatorList - ignoring beginMarkedContentProps: "${A}".`),void i.addOp(m,["OC",null]);throw A}})));A=[A[0].name,A[1]instanceof cA?A[1].get("MCID"):null];break;default:if(null!==A){for(G=0,N=A.length;G{if(!(A instanceof K)){if(this.options.ignoreErrors)return S(`getOperatorList - ignoring errors during "${e.name}" task: "${A}".`),void D();throw A}}))}getTextContent({stream:A,task:e,resources:t,stateManager:s=null,includeMarkedContent:n=!1,sink:g,seenStyles:r=new Set,viewBox:o,lang:I=null,markedContentData:c=null,disableNormalization:C=!1,keepWhiteSpace:B=!1}){t||=cA.empty,s||=new rr(new or),n&&(c||={level:0});const h={items:[],styles:Object.create(null),lang:I},Q={initialized:!1,str:[],totalWidth:0,totalHeight:0,width:0,height:0,vertical:!1,prevTransform:null,textAdvanceScale:0,spaceInFlowMin:0,spaceInFlowMax:0,trackingSpaceMin:1/0,negativeSpaceMax:-1/0,notASpace:-1/0,transform:null,fontName:null,hasEOL:!1},E=[" "," "];let f=0;function p(A){const e=(f+1)%2,t=" "!==E[f]&&" "===E[e];return E[f]=A,f=e,!B&&t}function w(){return!B&&" "!==E[f]&&" "===E[(f+1)%2]}function D(){E[0]=E[1]=" ",f=0}const b=this,k=this.xref,F=[];let R=null;const G=new jn,N=new $n,x=new cr(A,k,s);let U;function M({width:A=0,height:e=0,transform:t=Q.prevTransform,fontName:i=Q.fontName}){h.items.push({str:" ",dir:"ltr",width:A,height:e,transform:t,fontName:i,hasEOL:!1})}function L(){const A=U.font,e=[U.fontSize*U.textHScale,0,0,U.fontSize,0,U.textRise];if(A.isType3Font&&(U.fontSize<=1||A.isCharBBox)&&!$(U.fontMatrix,a)){const t=A.bbox[3]-A.bbox[1];t>0&&(e[3]*=t*U.fontMatrix[3])}return X.transform(U.ctm,X.transform(U.textMatrix,e))}function J(){if(Q.initialized)return Q;const{font:A,loadedName:e}=U;if(!r.has(e)&&(r.add(e),h.styles[e]={fontFamily:A.fallbackName,ascent:A.ascent,descent:A.descent,vertical:A.vertical},b.options.fontExtraProperties&&A.systemFontInfo)){const t=h.styles[e];t.fontSubstitution=A.systemFontInfo.css,t.fontSubstitutionLoadedName=A.systemFontInfo.loadedName}Q.fontName=e;const t=Q.transform=L();A.vertical?(Q.width=Q.totalWidth=Math.hypot(t[0],t[1]),Q.height=Q.totalHeight=0,Q.vertical=!0):(Q.width=Q.totalWidth=0,Q.height=Q.totalHeight=Math.hypot(t[2],t[3]),Q.vertical=!1);const i=Math.hypot(U.textLineMatrix[0],U.textLineMatrix[1]),a=Math.hypot(U.ctm[0],U.ctm[1]);Q.textAdvanceScale=a*i;const{fontSize:s}=U;return Q.trackingSpaceMin=.102*s,Q.notASpace=.03*s,Q.negativeSpaceMax=-.2*s,Q.spaceInFlowMin=.102*s,Q.spaceInFlowMax=.6*s,Q.hasEOL=!1,Q.initialized=!0,Q}function H(){if(!Q.initialized)return;const A=Math.hypot(U.textLineMatrix[0],U.textLineMatrix[1]),e=Math.hypot(U.ctm[0],U.ctm[1])*A;e!==Q.textAdvanceScale&&(Q.vertical?(Q.totalHeight+=Q.height*Q.textAdvanceScale,Q.height=0):(Q.totalWidth+=Q.width*Q.textAdvanceScale,Q.width=0),Q.textAdvanceScale=e)}async function Y(A,i){const s=await b.loadFont(A,i,t);if(s.font.isType3Font)try{await s.loadType3Data(b,t,e)}catch{}U.loadedName=s.loadedName,U.font=s.font,U.fontMatrix=s.font.fontMatrix||a}function q(A,e,t){const i=Math.hypot(t[0],t[1]);return[(t[0]*A+t[1]*e)/i,(t[2]*A+t[3]*e)/i]}function T(A){const e=L();let t=e[4],i=e[5];if(U.font?.vertical){if(to[2]||i+Ao[3])return!1}else if(t+Ao[2]||io[3])return!1;if(!U.font||!Q.prevTransform)return!0;let a=Q.prevTransform[4],s=Q.prevTransform[5];if(a===t&&s===i)return!0;let n=-1;switch(e[0]&&0===e[1]&&0===e[2]?n=e[0]>0?0:180:e[1]&&0===e[0]&&0===e[3]&&(n=e[1]>0?90:270),n){case 0:break;case 90:[t,i]=[i,t],[a,s]=[s,a];break;case 180:[t,i,a,s]=[-t,-i,-a,-s];break;case 270:[t,i]=[-i,-t],[a,s]=[-s,-a];break;default:[t,i]=q(t,i,e),[a,s]=q(a,s,Q.prevTransform)}if(U.font.vertical){const A=(s-i)/Q.textAdvanceScale,e=t-a,n=Math.sign(Q.height);return A.5*Q.width?(W(),!0):(D(),O(),!0):Math.abs(e)>Q.width?(W(),!0):(A<=n*Q.notASpace&&D(),A<=n*Q.trackingSpaceMin?w()?(D(),O(),M({height:Math.abs(A)})):Q.height+=A:Z(A,Q.prevTransform,n)||(0===Q.str.length?(D(),M({height:Math.abs(A)})):Q.height+=A),Math.abs(e)>.25*Q.width&&O(),!0)}const g=(t-a)/Q.textAdvanceScale,r=i-s,I=Math.sign(Q.width);return g.5*Q.height?(W(),!0):(D(),O(),!0):Math.abs(r)>Q.height?(W(),!0):(g<=I*Q.notASpace&&D(),g<=I*Q.trackingSpaceMin?w()?(D(),O(),M({width:Math.abs(g)})):Q.width+=g:Z(g,Q.prevTransform,I)||(0===Q.str.length?(D(),M({width:Math.abs(g)})):Q.width+=g),Math.abs(r)>.25*Q.height&&O(),!0)}function P({chars:A,extraSpacing:e}){const t=U.font;if(!A){const A=U.charSpacing+e;return A&&(t.vertical?U.translateTextMatrix(0,-A):U.translateTextMatrix(A*U.textHScale,0)),void(B&&T(0))}const i=t.charsToGlyphs(A),a=U.fontMatrix[0]*U.fontSize;for(let A=0,s=i.length;Ae?e.normalize("NFKC"):tA.get(t))));const i=Ng(e,-1,A.vertical);return{str:i.str,dir:i.dir,width:Math.abs(A.totalWidth),height:Math.abs(A.totalHeight),transform:A.transform,fontName:A.fontName,hasEOL:A.hasEOL}}(Q)),Q.initialized=!1,Q.str.length=0)}function V(A=!1){const e=h.items.length;0!==e&&(A&&e<10||(g.enqueue(h,e),h.items=[],h.styles=Object.create(null)))}const j=new sr;return new Promise((function A(a,Q){const E=function(e){V(!0),Promise.all([e,g.ready]).then((function(){try{A(a,Q)}catch(A){Q(A)}}),Q)};e.ensureNotTerminated(),j.reset();const f={};let p,w=[];for(;!(p=j.check())&&(w.length=0,f.args=w,x.read(f));){const A=U;U=s.state;const a=f.fn;switch(w=f.args,0|a){case u:var D=w[0].name,M=w[1];if(U.font&&D===U.fontName&&M===U.fontSize)break;return O(),U.fontName=D,U.fontSize=M,void E(Y(D,null));case 39:U.textRise=w[0];break;case 35:U.textHScale=w[0]/100;break;case 36:U.leading=w[0];break;case 40:U.translateTextLineMatrix(w[0],w[1]),U.textMatrix=U.textLineMatrix.slice();break;case 41:U.leading=-w[1],U.translateTextLineMatrix(w[0],w[1]),U.textMatrix=U.textLineMatrix.slice();break;case 43:U.carriageReturn();break;case 42:U.setTextMatrix(w[0],w[1],w[2],w[3],w[4],w[5]),U.setTextLineMatrix(w[0],w[1],w[2],w[3],w[4],w[5]),H();break;case 33:U.charSpacing=w[0];break;case 34:U.wordSpacing=w[0];break;case 31:U.textMatrix=i.slice(),U.textLineMatrix=i.slice();break;case 45:if(!s.state.font){b.ensureStateFont(s.state);continue}const a=(U.font.vertical?1:-1)*U.fontSize/1e3,Q=w[0];for(let A=0,e=Q.length;A0){const A=F.join("");F.length=0,P({chars:A,extraSpacing:0})}break;case d:if(!s.state.font){b.ensureStateFont(s.state);continue}P({chars:w[0],extraSpacing:0});break;case 46:if(!s.state.font){b.ensureStateFont(s.state);continue}U.carriageReturn(),P({chars:w[0],extraSpacing:0});break;case 47:if(!s.state.font){b.ensureStateFont(s.state);continue}U.wordSpacing=w[0],U.charSpacing=w[1],U.carriageReturn(),P({chars:w[2],extraSpacing:0});break;case 66:O(),R||(R=t.get("XObject")||cA.empty);var L=w[0]instanceof rA,J=w[0].name;if(L&&G.getByName(J))break;return void E(new Promise((function(A,i){if(!L)throw new v("XObject must be referred to by name.");let a=R.getRaw(J);if(a instanceof CA){if(G.getByRef(a))return void A();if(b.globalImageCache.getData(a,b.pageIndex))return void A();a=k.fetch(a)}if(!(a instanceof dA))throw new v("XObject should be a stream");const h=a.dict.get("Subtype");if(!(h instanceof rA))throw new v("XObject should have a Name subtype");if("Form"!==h.name)return G.set(J,a.dict.objId,!0),void A();const Q=s.state.clone(),l=new rr(Q),E=LA(a.dict.getArray("Matrix"),null);E&&l.transform(E),V();const u={enqueueInvoked:!1,enqueue(A,e){this.enqueueInvoked=!0,g.enqueue(A,e)},get desiredSize(){return g.desiredSize},get ready(){return g.ready}};b.getTextContent({stream:a,task:e,resources:a.dict.get("Resources")||t,stateManager:l,includeMarkedContent:n,sink:u,seenStyles:r,viewBox:o,lang:I,markedContentData:c,disableNormalization:C,keepWhiteSpace:B}).then((function(){u.enqueueInvoked||G.set(J,a.dict.objId,!0),A()}),i)})).catch((function(A){if(!(A instanceof K)){if(!b.options.ignoreErrors)throw A;S(`getTextContent - ignoring XObject: "${A}".`)}})));case 9:if(L=w[0]instanceof rA,J=w[0].name,L&&N.getByName(J))break;return void E(new Promise((function(A,e){if(!L)throw new v("GState must be referred to by name.");const i=t.get("ExtGState");if(!(i instanceof cA))throw new v("ExtGState should be a dictionary.");const a=i.get(J);if(!(a instanceof cA))throw new v("GState should be a dictionary.");const s=a.get("Font");if(!s)return N.set(J,a.objId,!0),void A();O(),U.fontName=null,U.fontSize=s[1],Y(null,s[0]).then(A,e)})).catch((function(A){if(!(A instanceof K)){if(!b.options.ignoreErrors)throw A;S(`getTextContent - ignoring ExtGState: "${A}".`)}})));case 69:O(),n&&(c.level++,h.items.push({type:"beginMarkedContent",tag:w[0]instanceof rA?w[0].name:null}));break;case m:if(O(),n){c.level++;let A=null;w[1]instanceof cA&&(A=w[1].get("MCID")),h.items.push({type:"beginMarkedContentProps",id:Number.isInteger(A)?`${b.idFactory.getPageObjId()}_mc${A}`:null,tag:w[0]instanceof rA?w[0].name:null})}break;case y:if(O(),n){if(0===c.level)break;c.level--,h.items.push({type:"endMarkedContent"})}break;case l:!A||A.font===U.font&&A.fontSize===U.fontSize&&A.fontName===U.fontName||O()}if(h.items.length>=g.desiredSize){p=!0;break}}p?E(tr):(O(),V(),a())})).catch((A=>{if(!(A instanceof K)){if(this.options.ignoreErrors)return S(`getTextContent - ignoring errors during "${e.name}" task: "${A}".`),O(),void V();throw A}}))}async extractDataStructures(A,e){const t=this.xref;let i;const a=this.readToUnicode(e.toUnicode);if(e.composite){const t=A.get("CIDSystemInfo");t instanceof cA&&(e.cidSystemInfo={registry:j(t.get("Registry")),ordering:j(t.get("Ordering")),supplement:t.get("Supplement")});try{const e=A.get("CIDToGIDMap");e instanceof dA&&(i=e.getBytes())}catch(A){if(!this.options.ignoreErrors)throw A;S(`extractDataStructures - ignoring CIDToGIDMap data: "${A}".`)}}const s=[];let n,g=null;if(A.has("Encoding")){if(n=A.get("Encoding"),n instanceof cA){if(g=n.get("BaseEncoding"),g=g instanceof rA?g.name:null,n.has("Differences")){const A=n.get("Differences");let e=0;for(const i of A){const A=t.fetchIfRef(i);if("number"==typeof A)e=A;else{if(!(A instanceof rA))throw new v(`Invalid entry in 'Differences' array: ${A}`);s[e++]=A.name}}}}else if(n instanceof rA)g=n.name;else{const A="Encoding is not a Name nor a Dict";if(!this.options.ignoreErrors)throw new v(A);S(A)}"MacRomanEncoding"!==g&&"MacExpertEncoding"!==g&&"WinAnsiEncoding"!==g&&(g=null)}const r=!e.file||e.isInternalFont,o=ua()[e.name];if(g&&r&&o&&(g=null),g)e.defaultEncoding=Ui(g);else{const A=!!(4&e.flags),t=!!(32&e.flags);n=Ri,"TrueType"!==e.type||t||(n=Gi),(A||o)&&(n=Si,r&&(/Symbol/i.test(e.name)?n=Ni:/Dingbats/i.test(e.name)?n=xi:/Wingdings/i.test(e.name)&&(n=Gi))),e.defaultEncoding=n}e.differences=s,e.baseEncodingName=g,e.hasEncoding=!!g||s.length>0,e.dict=A,e.toUnicode=await a;const I=await this.buildToUnicode(e);return e.toUnicode=I,i&&(e.cidToGidMap=this.readCidToGidMap(i,I)),e}_simpleFontToUnicode(A,e=!1){G(!A.composite,"Must be a simple font.");const t=[],i=A.defaultEncoding.slice(),a=A.baseEncodingName,s=A.differences;for(const A in s){const e=s[A];".notdef"!==e&&(i[A]=e)}const n=Aa();for(const s in i){let g=i[s];if(""===g)continue;let r=n[g];if(void 0!==r){t[s]=String.fromCharCode(r);continue}let o=0;switch(g[0]){case"G":3===g.length&&(o=parseInt(g.substring(1),16));break;case"g":5===g.length&&(o=parseInt(g.substring(1),16));break;case"C":case"c":if(g.length>=3&&g.length<=4){const t=g.substring(1);if(e){o=parseInt(t,16);break}if(o=+t,Number.isNaN(o)&&Number.isInteger(parseInt(t,16)))return this._simpleFontToUnicode(A,!0)}break;case"u":r=ia(g,n),-1!==r&&(o=r);break;default:switch(g){case"f_h":case"f_t":case"T_h":t[s]=g.replaceAll("_","");continue}}if(o>0&&o<=1114111&&Number.isInteger(o)){if(a&&o===+s){const A=Ui(a);if(A&&(g=A[s])){t[s]=String.fromCharCode(n[g]);continue}}t[s]=String.fromCodePoint(o)}}return t}async buildToUnicode(A){if(A.hasIncludedToUnicodeMap=A.toUnicode?.length>0,A.hasIncludedToUnicodeMap)return!A.composite&&A.hasEncoding&&(A.fallbackToUnicode=this._simpleFontToUnicode(A)),A.toUnicode;if(!A.composite)return new wa(this._simpleFontToUnicode(A));if(A.composite&&(A.cMap.builtInCMap&&!(A.cMap instanceof oi)||"Adobe"===A.cidSystemInfo?.registry&&("GB1"===A.cidSystemInfo.ordering||"CNS1"===A.cidSystemInfo.ordering||"Japan1"===A.cidSystemInfo.ordering||"Korea1"===A.cidSystemInfo.ordering))){const{registry:e,ordering:t}=A.cidSystemInfo,i=rA.get(`${e}-${t}-UCS2`),a=await yi.create({encoding:i,fetchBuiltInCMap:this._fetchBuiltInCMapBound,useCMap:null}),s=[],n=[];return A.cMap.forEach((function(A,e){if(e>65535)throw new v("Max size of CID is 65,535");const t=a.lookup(e);if(t){n.length=0;for(let A=0,e=t.length;A>1;(0!==a||e.has(s))&&(t[s]=a)}return t}extractWidths(A,e,t){const i=this.xref;let a=[],s=0;const n=[];let g;if(t.composite){const e=A.get("DW");s="number"==typeof e?Math.ceil(e):1e3;const r=A.get("W");if(Array.isArray(r))for(let A=0,e=r.length;A{const e=r.get(A),a=new zg;return i.getOperatorList({stream:e,task:t,resources:o,operatorList:a}).then((()=>{49===a.fnArray[0]&&this._removeType3ColorOperators(a,h),I[A]=a.getIR();for(const A of a.dependencies)n.add(A)})).catch((function(e){S(`Type3 font resource "${A}" is not available.`);const t=new zg;I[A]=t.getIR()}))}));return this.type3Loaded=g.then((()=>{s.charProcOperatorList=I,this._bbox&&(s.isCharBBox=!0,s.bbox=this._bbox)})),this.type3Loaded}_removeType3ColorOperators(A,e=NaN){const t=X.normalizeRect(A.argsArray[0].slice(2)),i=t[2]-t[0],a=t[3]-t[1],s=Math.hypot(i,a);0===i||0===a?(A.fnArray.splice(0,1),A.argsArray.splice(0,1)):(0===e||Math.round(s/e)>=10)&&(this._bbox||(this._bbox=[1/0,1/0,-1/0,-1/0]),this._bbox[0]=Math.min(this._bbox[0],t[0]),this._bbox[1]=Math.min(this._bbox[1],t[1]),this._bbox[2]=Math.max(this._bbox[2],t[2]),this._bbox[3]=Math.max(this._bbox[3],t[3]));let n=0,g=A.length;for(;n=13&&s<=28,a.variableArgs)g>n&&F(`Command ${i}: expected [0, ${n}] args, but received ${g} args.`);else{if(g!==n){const A=this.nonProcessedArgs;for(;g>n;)A.push(e.shift()),g--;for(;gcr.MAX_INVALID_PATH_OPS)throw new v(`Invalid ${A}`);S(`Skipping ${A}`),null!==e&&(e.length=0);continue}}return this.preprocessCommand(s,e),A.fn=s,A.args=e,!0}if(t===aA)return!1;if(null!==t&&(null===e&&(e=[]),e.push(t),e.length>33))throw new v("Too many arguments")}}preprocessCommand(A,e){switch(0|A){case Q:this.stateManager.save();break;case l:this.stateManager.restore();break;case E:this.stateManager.transform(e)}}}class Cr extends cr{constructor(A){super(new ae(A))}parse(){const A={fn:0,args:[]},e={fontSize:0,fontName:"",fontColor:new Uint8ClampedArray(3)};try{for(;A.args.length=0,this.read(A);){if(0!==this.savedStatesDepth)continue;const{fn:t,args:i}=A;switch(0|t){case u:const[A,t]=i;A instanceof rA&&(e.fontName=A.name),"number"==typeof t&&t>0&&(e.fontSize=t);break;case p:re.singletons.rgb.getRgbItem(i,0,e.fontColor,0);break;case 57:re.singletons.gray.getRgbItem(i,0,e.fontColor,0);break;case 61:re.singletons.cmyk.getRgbItem(i,0,e.fontColor,0)}}}catch(A){S(`parseDefaultAppearance - ignoring errors: "${A}".`)}return e}}function Br(A){return new Cr(A).parse()}class hr extends cr{constructor(A,e,t){super(A),this.stream=A,this.evaluatorOptions=e,this.xref=t,this.resources=A.dict?.get("Resources")}parse(){const A={fn:0,args:[]};let e={scaleFactor:1,fontSize:0,fontName:"",fontColor:new Uint8ClampedArray(3),fillColorSpace:re.singletons.gray},t=!1;const i=[];try{for(;A.args.length=0,!t&&this.read(A);){const{fn:a,args:s}=A;switch(0|a){case Q:i.push({scaleFactor:e.scaleFactor,fontSize:e.fontSize,fontName:e.fontName,fontColor:e.fontColor.slice(),fillColorSpace:e.fillColorSpace});break;case l:e=i.pop()||e;break;case 42:e.scaleFactor*=Math.hypot(s[0],s[1]);break;case u:const[A,a]=s;A instanceof rA&&(e.fontName=A.name),"number"==typeof a&&a>0&&(e.fontSize=a*e.scaleFactor);break;case 51:e.fillColorSpace=re.parse({cs:s[0],xref:this.xref,resources:this.resources,pdfFunctionFactory:this._pdfFunctionFactory,localColorSpaceCache:this._localColorSpaceCache});break;case 54:e.fillColorSpace.getRgbItem(s,0,e.fontColor,0);break;case p:re.singletons.rgb.getRgbItem(s,0,e.fontColor,0);break;case 57:re.singletons.gray.getRgbItem(s,0,e.fontColor,0);break;case 61:re.singletons.cmyk.getRgbItem(s,0,e.fontColor,0);break;case d:case 45:case 46:case 47:t=!0}}}catch(A){S(`parseAppearanceStream - ignoring errors: "${A}".`)}return this.stream.reset(),delete e.scaleFactor,delete e.fillColorSpace,e}get _localColorSpaceCache(){return x(this,"_localColorSpaceCache",new zn)}get _pdfFunctionFactory(){return x(this,"_pdfFunctionFactory",new ig({xref:this.xref,isEvalSupported:this.evaluatorOptions.isEvalSupported}))}}function Qr(A,e){return A[0]===A[1]&&A[1]===A[2]?`${jA(A[0]/255)} ${e?"g":"G"}`:Array.from(A,(A=>jA(A/255))).join(" ")+" "+(e?"rg":"RG")}class lr{constructor(A,e){this.xref=A,this.widths=null,this.firstChar=1/0,this.lastChar=-1/0,this.fontFamily=e;const t=new OffscreenCanvas(1,1);this.ctxMeasure=t.getContext("2d",{willReadFrequently:!0}),lr._fontNameId||(lr._fontNameId=1),this.fontName=rA.get(`InvalidPDFjsFont_${e}_${lr._fontNameId++}`)}get fontDescriptorRef(){if(!lr._fontDescriptorRef){const A=new cA(this.xref);A.set("Type",rA.get("FontDescriptor")),A.set("FontName",this.fontName),A.set("FontFamily","MyriadPro Regular"),A.set("FontBBox",[0,0,0,0]),A.set("FontStretch",rA.get("Normal")),A.set("FontWeight",400),A.set("ItalicAngle",0),lr._fontDescriptorRef=this.xref.getNewPersistentRef(A)}return lr._fontDescriptorRef}get descendantFontRef(){const A=new cA(this.xref);A.set("BaseFont",this.fontName),A.set("Type",rA.get("Font")),A.set("Subtype",rA.get("CIDFontType0")),A.set("CIDToGIDMap",rA.get("Identity")),A.set("FirstChar",this.firstChar),A.set("LastChar",this.lastChar),A.set("FontDescriptor",this.fontDescriptorRef),A.set("DW",1e3);const e=[],t=[...this.widths.entries()].sort();let i=null,a=null;for(const[A,s]of t)i?A===i+a.length?a.push(s):(e.push(i,a),i=A,a=[s]):(i=A,a=[s]);i&&e.push(i,a),A.set("W",e);const s=new cA(this.xref);return s.set("Ordering","Identity"),s.set("Registry","Adobe"),s.set("Supplement",0),A.set("CIDSystemInfo",s),this.xref.getNewPersistentRef(A)}get baseFontRef(){const A=new cA(this.xref);return A.set("BaseFont",this.fontName),A.set("Type",rA.get("Font")),A.set("Subtype",rA.get("Type0")),A.set("Encoding",rA.get("Identity-H")),A.set("DescendantFonts",[this.descendantFontRef]),A.set("ToUnicode",rA.get("Identity-H")),this.xref.getNewPersistentRef(A)}get resources(){const A=new cA(this.xref),e=new cA(this.xref);return e.set(this.fontName.name,this.baseFontRef),A.set("Font",e),A}_createContext(){return this.widths=new Map,this.ctxMeasure.font=`1000px ${this.fontFamily}`,this.ctxMeasure}createFontResources(A){const e=this._createContext();for(const t of A.split(/\r\n?|\n/))for(const A of t.split("")){const t=A.charCodeAt(0);if(this.widths.has(t))continue;const i=e.measureText(A),a=Math.ceil(i.width);this.widths.set(t,a),this.firstChar=Math.min(t,this.firstChar),this.lastChar=Math.max(t,this.lastChar)}return this.resources}static getFirstPositionInfo(A,e,t){const[i,a,n,g]=A;let r=n-i,o=g-a;e%180!=0&&([r,o]=[o,r]);const I=s*t;return{coords:[0,o+.35*t-I],bbox:[0,0,r,o],matrix:0!==e?ee(e,o,I):void 0}}createAppearance(A,e,t,i,a,n){const g=this._createContext(),r=[];let o=-1/0;for(const e of A.split(/\r\n?|\n/)){r.push(e);const A=g.measureText(e).width;o=Math.max(o,A);for(const A of WA(e)){const e=String.fromCodePoint(A);let t=this.widths.get(A);if(void 0===t){const i=g.measureText(e);t=Math.ceil(i.width),this.widths.set(A,t),this.firstChar=Math.min(A,this.firstChar),this.lastChar=Math.max(A,this.lastChar)}}}o*=i/1e3;const[I,c,C,B]=e;let h=C-I,Q=B-c;t%180!=0&&([h,Q]=[Q,h]);let l=1;o>h&&(l=h/o);let E=1;const u=s*i,d=.35*i,f=u*r.length;f>Q&&(E=Q/f);const p=i*Math.min(l,E),m=["q",`0 0 ${jA(h)} ${jA(Q)} re W n`,"BT",`1 0 0 1 0 ${jA(Q+d)} Tm 0 Tc ${Qr(a,!0)}`,`/${this.fontName.name} ${jA(p)} Tf`],{resources:y}=this;if(1!==(n="number"==typeof n&&n>=0&&n<=1?n:1)){m.push("/R0 gs");const A=new cA(this.xref),e=new cA(this.xref);e.set("ca",n),e.set("CA",n),e.set("Type",rA.get("ExtGState")),A.set("R0",e),y.set("ExtGState",A)}const w=jA(u);for(const A of r)m.push(`0 -${w} Td <${$A(A)}> Tj`);m.push("ET","Q");const D=m.join("\n"),b=new cA(this.xref);if(b.set("Subtype",rA.get("Form")),b.set("Type",rA.get("XObject")),b.set("BBox",[0,0,h,Q]),b.set("Length",D.length),b.set("Resources",y),t){const A=ee(t,h,Q);b.set("Matrix",A)}const k=new ae(D);return k.dict=b,k}}class Er{constructor(A,e,t){this.root=A,this.xref=e,this._type=t}getAll(){const A=new Map;if(!this.root)return A;const e=this.xref,t=new BA;t.put(this.root);const i=[this.root];for(;i.length>0;){const a=e.fetchIfRef(i.shift());if(!(a instanceof cA))continue;if(a.has("Kids")){const A=a.get("Kids");if(!Array.isArray(A))continue;for(const e of A){if(t.has(e))throw new v(`Duplicate entry in "${this._type}" tree.`);i.push(e),t.put(e)}continue}const s=a.get(this._type);if(Array.isArray(s))for(let t=0,i=s.length;t10)return S(`Search depth limit reached for "${this._type}" tree.`),null;const a=t.get("Kids");if(!Array.isArray(a))return null;let s=0,n=a.length-1;for(;s<=n;){const i=s+n>>1,g=e.fetchIfRef(a[i]),r=g.get("Limits");if(Ae.fetchIfRef(r[1]))){t=g;break}s=i+1}}if(s>n)return null}const a=t.get(this._type);if(Array.isArray(a)){let t=0,i=a.length-2;for(;t<=i;){const s=t+i>>1,n=s+(1&s),g=e.fetchIfRef(a[n]);if(Ag))return e.fetchIfRef(a[n+1]);t=n+2}}}return null}}class ur extends Er{constructor(A,e){super(A,e,"Names")}}class dr extends Er{constructor(A,e){super(A,e,"Nums")}}function fr(){js=Object.create(null),sA=Object.create(null),nA=Object.create(null),gA=Object.create(null),ga.clear(),jt.cleanup()}function pr(A){return A instanceof cA?A.has("UF")?A.get("UF"):A.has("F")?A.get("F"):A.has("Unix")?A.get("Unix"):A.has("Mac")?A.get("Mac"):A.has("DOS")?A.get("DOS"):null:null}class mr{#F=!1;constructor(A,e,t=!1){A instanceof cA&&(this.xref=e,this.root=A,A.has("FS")&&(this.fs=A.get("FS")),A.has("RF")&&S("Related file specifications are not supported"),t||(A.has("EF")?this.#F=!0:S("Non-embedded file specifications are not supported")))}get filename(){let A="";const e=pr(this.root);return e&&"string"==typeof e&&(A=j(e).replaceAll("\\\\","\\").replaceAll("\\/","/").replaceAll("\\","/")),x(this,"filename",A||"unnamed")}get content(){if(!this.#F)return null;this._contentRef||=pr(this.root?.get("EF"));let A=null;if(this._contentRef){const e=this.xref.fetchIfRef(this._contentRef);e instanceof dA?A=e.getBytes():S("Embedded file specification points to non-existing/invalid content")}else S("Embedded file specification does not have any content");return A}get description(){let A="";const e=this.root?.get("Desc");return e&&"string"==typeof e&&(A=j(e)),x(this,"description",A)}get serializable(){return{rawFilename:this.filename,filename:(A=this.filename,A.substring(A.lastIndexOf("/")+1)),content:this.content,description:this.description};var A}}function yr(A,e){const t=A[e];return" "===t||"\n"===t||"\r"===t||"\t"===t}class wr{_resolveEntities(A){return A.replaceAll(/&([^;]+);/g,((A,e)=>{if("#x"===e.substring(0,2))return String.fromCodePoint(parseInt(e.substring(2),16));if("#"===e.substring(0,1))return String.fromCodePoint(parseInt(e.substring(1),10));switch(e){case"lt":return"<";case"gt":return">";case"amp":return"&";case"quot":return'"';case"apos":return"'"}return this.onResolveEntity(e)}))}_parseContent(A,e){const t=[];let i=e;function a(){for(;i"!==A[i]&&"/"!==A[i];)++i;const s=A.substring(e,i);for(a();i"!==A[i]&&"/"!==A[i]&&"?"!==A[i];){a();let e="",s="";for(;i"!==A[t]&&"?"!==A[t]&&"/"!==A[t];)++t;const i=A.substring(e,t);!function(){for(;t"!==A[t+1]);)++t;return{name:i,value:A.substring(a,t),parsed:t-e}}parseXml(A){let e=0;for(;e",t),e<0)return void this.onError(-9);this.onEndElement(A.substring(t,e)),t=e+1;break;case"?":++t;const i=this._parseProcessingInstruction(A,t);if("?>"!==A.substring(t+i.parsed,t+i.parsed+2))return void this.onError(-3);this.onPi(i.name,i.value),t+=i.parsed+2;break;case"!":if("--"===A.substring(t+1,t+3)){if(e=A.indexOf("--\x3e",t+3),e<0)return void this.onError(-5);this.onComment(A.substring(t+3,e)),t=e+3}else if("[CDATA["===A.substring(t+1,t+8)){if(e=A.indexOf("]]>",t+8),e<0)return void this.onError(-2);this.onCdata(A.substring(t+8,e)),t=e+3}else{if("DOCTYPE"!==A.substring(t+1,t+8))return void this.onError(-6);{const i=A.indexOf("[",t+8);let a=!1;if(e=A.indexOf(">",t+8),e<0)return void this.onError(-4);if(i>0&&e>i){if(e=A.indexOf("]>",t+8),e<0)return void this.onError(-4);a=!0}const s=A.substring(t+8,e+(a?1:0));this.onDoctype(s),t=e+(a?2:1)}}break;default:const a=this._parseContent(A,t);if(null===a)return void this.onError(-6);let s=!1;if("/>"===A.substring(t+a.parsed,t+a.parsed+2))s=!0;else if(">"!==A.substring(t+a.parsed,t+a.parsed+1))return void this.onError(-9);this.onBeginElement(a.name,a.attributes,s),t+=a.parsed+(s?2:1)}}else{for(;t0}searchNode(A,e){if(e>=A.length)return this;const t=A[e];if(t.name.startsWith("#")&&e0)i.push([a,0]),a=a.childNodes[0];else{if(0===i.length)return null;for(;0!==i.length;){const[A,e]=i.pop(),t=e+1;if(t");for(const e of this.childNodes)e.dump(A);A.push(``)}else this.nodeValue?A.push(`>${ZA(this.nodeValue)}`):A.push("/>")}else A.push(ZA(this.nodeValue))}}class br extends wr{constructor({hasAttributes:A=!1,lowerCaseName:e=!1}){super(),this._currentFragment=null,this._stack=null,this._errorCode=0,this._hasAttributes=A,this._lowerCaseName=e}parseFromString(A){if(this._currentFragment=[],this._stack=[],this._errorCode=0,this.parseXml(A),0!==this._errorCode)return;const[e]=this._currentFragment;return e?{documentElement:e}:void 0}onText(A){if(function(A){for(let e=0,t=A.length;e\\376\\377([^<]+)/g,(function(A,e){const t=e.replaceAll(/\\([0-3])([0-7])([0-7])/g,(function(A,e,t,i){return String.fromCharCode(64*e+8*t+1*i)})).replaceAll(/&(amp|apos|gt|lt|quot);/g,(function(A,e){switch(e){case"amp":return"&";case"apos":return"'";case"gt":return">";case"lt":return"<";case"quot":return'"'}throw new Error(`_repair: ${e} isn't defined.`)})),i=[">"];for(let A=0,e=t.length;A=32&&e<127&&60!==e&&62!==e&&38!==e?i.push(String.fromCharCode(e)):i.push("&#x"+(65536+e).toString(16).substring(1)+";")}return i.join("")}))}_getSequence(A){const e=A.nodeName;return"rdf:bag"!==e&&"rdf:seq"!==e&&"rdf:alt"!==e?null:A.childNodes.filter((A=>"rdf:li"===A.nodeName))}_parseArray(A){if(!A.hasChildNodes())return;const[e]=A.childNodes,t=this._getSequence(e)||[];this._metadataMap.set(A.nodeName,t.map((A=>A.textContent.trim())))}_parse(A){let e=A.documentElement;if("rdf:rdf"!==e.nodeName)for(e=e.firstChild;e&&"rdf:rdf"!==e.nodeName;)e=e.nextSibling;if(e&&"rdf:rdf"===e.nodeName&&e.hasChildNodes())for(const A of e.childNodes)if("rdf:description"===A.nodeName)for(const e of A.childNodes){const A=e.nodeName;switch(A){case"#text":continue;case"dc:creator":case"dc:subject":this._parseArray(e);continue}this._metadataMap.set(A,e.textContent.trim())}}get serializable(){return{parsedData:this._metadataMap,rawData:this._data}}}class Fr extends ke{constructor(A,e,t){super(e),this.str=A,this.dict=A.dict,this.decrypt=t,this.nextChunk=null,this.initialized=!1}readBlock(){let A;if(this.initialized?A=this.nextChunk:(A=this.str.getBytes(512),this.initialized=!0),!A||0===A.length)return void(this.eof=!0);this.nextChunk=this.str.getBytes(512);const e=this.nextChunk?.length>0;A=(0,this.decrypt)(A,!e);const t=this.bufferLength,i=t+A.length;this.ensureBuffer(i).set(A,t),this.bufferLength=i}}class Sr{constructor(A){this.a=0,this.b=0;const e=new Uint8Array(256),t=A.length;for(let A=0;A<256;++A)e[A]=A;for(let i=0,a=0;i<256;++i){const s=e[i];a=a+s+A[i%t]&255,e[i]=e[a],e[a]=s}this.s=e}encryptBlock(A){let e=this.a,t=this.b;const i=this.s,a=A.length,s=new Uint8Array(a);for(let n=0;n>5&255,I[c++]=a>>13&255,I[c++]=a>>21&255,I[c++]=a>>>29&255,I[c++]=0,I[c++]=0,I[c++]=0;const h=new Int32Array(16);for(c=0;c>>32-g)|0,a=s}s=s+a|0,n=n+o|0,g=g+B|0,r=r+Q|0}return new Uint8Array([255&s,s>>8&255,s>>16&255,s>>>24&255,255&n,n>>8&255,n>>16&255,n>>>24&255,255&g,g>>8&255,g>>16&255,g>>>24&255,255&r,r>>8&255,r>>16&255,r>>>24&255])}}();class Gr{constructor(A,e){this.high=0|A,this.low=0|e}and(A){this.high&=A.high,this.low&=A.low}xor(A){this.high^=A.high,this.low^=A.low}or(A){this.high|=A.high,this.low|=A.low}shiftRight(A){A>=32?(this.low=this.high>>>A-32|0,this.high=0):(this.low=this.low>>>A|this.high<<32-A,this.high=this.high>>>A|0)}shiftLeft(A){A>=32?(this.high=this.low<>>32-A,this.low<<=A)}rotateRight(A){let e,t;32&A?(t=this.low,e=this.high):(e=this.low,t=this.high),A&=31,this.low=e>>>A|t<<32-A,this.high=t>>>A|e<<32-A}not(){this.high=~this.high,this.low=~this.low}add(A){const e=(this.low>>>0)+(A.low>>>0);let t=(this.high>>>0)+(A.high>>>0);e>4294967295&&(t+=1),this.low=0|e,this.high=0|t}copyTo(A,e){A[e]=this.high>>>24&255,A[e+1]=this.high>>16&255,A[e+2]=this.high>>8&255,A[e+3]=255&this.high,A[e+4]=this.low>>>24&255,A[e+5]=this.low>>16&255,A[e+6]=this.low>>8&255,A[e+7]=255&this.low}assign(A){this.high=A.high,this.low=A.low}}const Nr=function(){function A(A,e){return A>>>e|A<<32-e}function e(A,e,t){return A&e^~A&t}function t(A,e,t){return A&e^A&t^e&t}function i(e){return A(e,2)^A(e,13)^A(e,22)}function a(e){return A(e,6)^A(e,11)^A(e,25)}function s(e){return A(e,7)^A(e,18)^e>>>3}const n=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];return function(g,r,o){let I=1779033703,c=3144134277,C=1013904242,B=2773480762,h=1359893119,Q=2600822924,l=528734635,E=1541459225;const u=64*Math.ceil((o+9)/64),d=new Uint8Array(u);let f,p;for(f=0;f>>29&255,d[f++]=o>>21&255,d[f++]=o>>13&255,d[f++]=o>>5&255,d[f++]=o<<3&255;const y=new Uint32Array(64);for(f=0;f>>10)+y[p-7]+s(y[p-15])+y[p-16];let g,r,o=I,u=c,m=C,D=B,b=h,k=Q,F=l,S=E;for(p=0;p<64;++p)g=S+a(b)+e(b,k,F)+n[p]+y[p],r=i(o)+t(o,u,m),S=F,F=k,k=b,b=D+g|0,D=m,m=u,u=o,o=g+r|0;I=I+o|0,c=c+u|0,C=C+m|0,B=B+D|0,h=h+b|0,Q=Q+k|0,l=l+F|0,E=E+S|0}var w;return new Uint8Array([I>>24&255,I>>16&255,I>>8&255,255&I,c>>24&255,c>>16&255,c>>8&255,255&c,C>>24&255,C>>16&255,C>>8&255,255&C,B>>24&255,B>>16&255,B>>8&255,255&B,h>>24&255,h>>16&255,h>>8&255,255&h,Q>>24&255,Q>>16&255,Q>>8&255,255&Q,l>>24&255,l>>16&255,l>>8&255,255&l,E>>24&255,E>>16&255,E>>8&255,255&E])}}(),xr=function(){function A(A,e,t,i,a){A.assign(e),A.and(t),a.assign(e),a.not(),a.and(i),A.xor(a)}function e(A,e,t,i,a){A.assign(e),A.and(t),a.assign(e),a.and(i),A.xor(a),a.assign(t),a.and(i),A.xor(a)}function t(A,e,t){A.assign(e),A.rotateRight(28),t.assign(e),t.rotateRight(34),A.xor(t),t.assign(e),t.rotateRight(39),A.xor(t)}function i(A,e,t){A.assign(e),A.rotateRight(14),t.assign(e),t.rotateRight(18),A.xor(t),t.assign(e),t.rotateRight(41),A.xor(t)}function a(A,e,t){A.assign(e),A.rotateRight(1),t.assign(e),t.rotateRight(8),A.xor(t),t.assign(e),t.shiftRight(7),A.xor(t)}function s(A,e,t){A.assign(e),A.rotateRight(19),t.assign(e),t.rotateRight(61),A.xor(t),t.assign(e),t.shiftRight(6),A.xor(t)}const n=[new Gr(1116352408,3609767458),new Gr(1899447441,602891725),new Gr(3049323471,3964484399),new Gr(3921009573,2173295548),new Gr(961987163,4081628472),new Gr(1508970993,3053834265),new Gr(2453635748,2937671579),new Gr(2870763221,3664609560),new Gr(3624381080,2734883394),new Gr(310598401,1164996542),new Gr(607225278,1323610764),new Gr(1426881987,3590304994),new Gr(1925078388,4068182383),new Gr(2162078206,991336113),new Gr(2614888103,633803317),new Gr(3248222580,3479774868),new Gr(3835390401,2666613458),new Gr(4022224774,944711139),new Gr(264347078,2341262773),new Gr(604807628,2007800933),new Gr(770255983,1495990901),new Gr(1249150122,1856431235),new Gr(1555081692,3175218132),new Gr(1996064986,2198950837),new Gr(2554220882,3999719339),new Gr(2821834349,766784016),new Gr(2952996808,2566594879),new Gr(3210313671,3203337956),new Gr(3336571891,1034457026),new Gr(3584528711,2466948901),new Gr(113926993,3758326383),new Gr(338241895,168717936),new Gr(666307205,1188179964),new Gr(773529912,1546045734),new Gr(1294757372,1522805485),new Gr(1396182291,2643833823),new Gr(1695183700,2343527390),new Gr(1986661051,1014477480),new Gr(2177026350,1206759142),new Gr(2456956037,344077627),new Gr(2730485921,1290863460),new Gr(2820302411,3158454273),new Gr(3259730800,3505952657),new Gr(3345764771,106217008),new Gr(3516065817,3606008344),new Gr(3600352804,1432725776),new Gr(4094571909,1467031594),new Gr(275423344,851169720),new Gr(430227734,3100823752),new Gr(506948616,1363258195),new Gr(659060556,3750685593),new Gr(883997877,3785050280),new Gr(958139571,3318307427),new Gr(1322822218,3812723403),new Gr(1537002063,2003034995),new Gr(1747873779,3602036899),new Gr(1955562222,1575990012),new Gr(2024104815,1125592928),new Gr(2227730452,2716904306),new Gr(2361852424,442776044),new Gr(2428436474,593698344),new Gr(2756734187,3733110249),new Gr(3204031479,2999351573),new Gr(3329325298,3815920427),new Gr(3391569614,3928383900),new Gr(3515267271,566280711),new Gr(3940187606,3454069534),new Gr(4118630271,4000239992),new Gr(116418474,1914138554),new Gr(174292421,2731055270),new Gr(289380356,3203993006),new Gr(460393269,320620315),new Gr(685471733,587496836),new Gr(852142971,1086792851),new Gr(1017036298,365543100),new Gr(1126000580,2618297676),new Gr(1288033470,3409855158),new Gr(1501505948,4234509866),new Gr(1607167915,987167468),new Gr(1816402316,1246189591)];return function(g,r,o,I=!1){let c,C,B,h,Q,l,E,u;I?(c=new Gr(3418070365,3238371032),C=new Gr(1654270250,914150663),B=new Gr(2438529370,812702999),h=new Gr(355462360,4144912697),Q=new Gr(1731405415,4290775857),l=new Gr(2394180231,1750603025),E=new Gr(3675008525,1694076839),u=new Gr(1203062813,3204075428)):(c=new Gr(1779033703,4089235720),C=new Gr(3144134277,2227873595),B=new Gr(1013904242,4271175723),h=new Gr(2773480762,1595750129),Q=new Gr(1359893119,2917565137),l=new Gr(2600822924,725511199),E=new Gr(528734635,4215389547),u=new Gr(1541459225,327033209));const d=128*Math.ceil((o+17)/128),f=new Uint8Array(d);let p,m;for(p=0;p>>29&255,f[p++]=o>>21&255,f[p++]=o>>13&255,f[p++]=o>>5&255,f[p++]=o<<3&255;const w=new Array(80);for(p=0;p<80;p++)w[p]=new Gr(0,0);let D=new Gr(0,0),b=new Gr(0,0),k=new Gr(0,0),F=new Gr(0,0),S=new Gr(0,0),R=new Gr(0,0),G=new Gr(0,0),N=new Gr(0,0);const x=new Gr(0,0),U=new Gr(0,0),M=new Gr(0,0),L=new Gr(0,0);let J,H;for(p=0;p=1;--A){t=s[13],s[13]=s[9],s[9]=s[5],s[5]=s[1],s[1]=t,t=s[14],i=s[10],s[14]=s[6],s[10]=s[2],s[6]=t,s[2]=i,t=s[15],i=s[11],a=s[7],s[15]=s[3],s[11]=t,s[7]=i,s[3]=a;for(let A=0;A<16;++A)s[A]=this._inv_s[s[A]];for(let t=0,i=16*A;t<16;++t,++i)s[t]^=e[i];for(let A=0;A<16;A+=4){const e=this._mix[s[A]],i=this._mix[s[A+1]],a=this._mix[s[A+2]],n=this._mix[s[A+3]];t=e^i>>>8^i<<24^a>>>16^a<<16^n>>>24^n<<8,s[A]=t>>>24&255,s[A+1]=t>>16&255,s[A+2]=t>>8&255,s[A+3]=255&t}}t=s[13],s[13]=s[9],s[9]=s[5],s[5]=s[1],s[1]=t,t=s[14],i=s[10],s[14]=s[6],s[10]=s[2],s[6]=t,s[2]=i,t=s[15],i=s[11],a=s[7],s[15]=s[3],s[11]=t,s[7]=i,s[3]=a;for(let A=0;A<16;++A)s[A]=this._inv_s[s[A]],s[A]^=e[A];return s}_encrypt(A,e){const t=this._s;let i,a,s;const n=new Uint8Array(16);n.set(A);for(let A=0;A<16;++A)n[A]^=e[A];for(let A=1;A=i;--t)if(A[t]!==e){e=0;break}g-=e,s[s.length-1]=A.subarray(0,16-e)}}const r=new Uint8Array(g);for(let A=0,e=0,t=s.length;A=256&&(g=255&(27^g)));for(let e=0;e<4;++e)t[A]=i^=t[A-32],A++,t[A]=a^=t[A-32],A++,t[A]=s^=t[A-32],A++,t[A]=n^=t[A-32],A++}return t}}class Hr{checkOwnerPassword(A,e,t,i){const a=new Uint8Array(A.length+56);return a.set(A,0),a.set(e,A.length),a.set(t,A.length+e.length),$(Nr(a,0,a.length),i)}checkUserPassword(A,e,t){const i=new Uint8Array(A.length+8);return i.set(A,0),i.set(e,A.length),$(Nr(i,0,i.length),t)}getOwnerKey(A,e,t,i){const a=new Uint8Array(A.length+56);a.set(A,0),a.set(e,A.length),a.set(t,A.length+e.length);const s=Nr(a,0,a.length);return new Jr(s).decryptBlock(i,!1,new Uint8Array(16))}getUserKey(A,e,t){const i=new Uint8Array(A.length+8);i.set(A,0),i.set(e,A.length);const a=Nr(i,0,i.length);return new Jr(a).decryptBlock(t,!1,new Uint8Array(16))}}class Yr{_hash(A,e,t){let i=Nr(e,0,e.length).subarray(0,32),a=[0],s=0;for(;s<64||a.at(-1)>s-32;){const e=A.length+i.length+t.length,r=new Uint8Array(e);let o=0;r.set(A,o),o+=A.length,r.set(i,o),o+=i.length,r.set(t,o);const I=new Uint8Array(64*e);for(let A=0,t=0;A<64;A++,t+=e)I.set(r,t);a=new Lr(i.subarray(0,16)).encrypt(I,i.subarray(16,32));const c=a.slice(0,16).reduce(((A,e)=>A+e),0)%3;0===c?i=Nr(a,0,a.length):1===c?(n=a,g=a.length,i=xr(n,0,g,!0)):2===c&&(i=xr(a,0,a.length)),s++}var n,g;return i.subarray(0,32)}checkOwnerPassword(A,e,t,i){const a=new Uint8Array(A.length+56);return a.set(A,0),a.set(e,A.length),a.set(t,A.length+e.length),$(this._hash(A,a,t),i)}checkUserPassword(A,e,t){const i=new Uint8Array(A.length+8);return i.set(A,0),i.set(e,A.length),$(this._hash(A,i,[]),t)}getOwnerKey(A,e,t,i){const a=new Uint8Array(A.length+56);a.set(A,0),a.set(e,A.length),a.set(t,A.length+e.length);const s=this._hash(A,a,t);return new Jr(s).decryptBlock(i,!1,new Uint8Array(16))}getUserKey(A,e,t){const i=new Uint8Array(A.length+8);i.set(A,0),i.set(e,A.length);const a=this._hash(A,i,[]);return new Jr(a).decryptBlock(t,!1,new Uint8Array(16))}}class vr{constructor(A,e){this.StringCipherConstructor=A,this.StreamCipherConstructor=e}createStream(A,e){const t=new this.StreamCipherConstructor;return new Fr(A,e,(function(A,e){return t.decryptBlock(A,e)}))}decryptString(A){const e=new this.StringCipherConstructor;let t=T(A);return t=e.decryptBlock(t,!0),q(t)}encryptString(A){const e=new this.StringCipherConstructor;if(e instanceof Mr){const t=16-A.length%16;A+=String.fromCharCode(t).repeat(t);const i=new Uint8Array(16);if("undefined"!=typeof crypto)crypto.getRandomValues(i);else for(let A=0;A<16;A++)i[A]=Math.floor(256*Math.random());let a=T(A);a=e.encrypt(a,i);const s=new Uint8Array(16+a.length);return s.set(i),s.set(a,16),q(s)}let t=T(A);return t=e.encrypt(t),q(t)}}class Kr{static#S=new Uint8Array([40,191,78,94,78,117,138,65,100,0,78,86,255,250,1,8,46,46,0,182,208,104,62,128,47,12,169,254,100,83,105,122]);#R(A,e,t,i,a,s,n,g,r,o,I,c){if(e){const A=Math.min(127,e.length);e=e.subarray(0,A)}else e=[];const C=6===A?new Yr:new Hr;return C.checkUserPassword(e,g,n)?C.getUserKey(e,r,I):e.length&&C.checkOwnerPassword(e,i,s,t)?C.getOwnerKey(e,a,s,o):null}#G(A,e,t,i,a,s,n,g){const r=40+t.length+A.length,o=new Uint8Array(r);let I,c,C=0;if(e)for(c=Math.min(32,e.length);C>8&255,o[C++]=a>>16&255,o[C++]=a>>>24&255,I=0,c=A.length;I=4&&!g&&(o[C++]=255,o[C++]=255,o[C++]=255,o[C++]=255);let B=Rr(o,0,C);const h=n>>3;if(s>=3)for(I=0;I<50;++I)B=Rr(B,0,h);const Q=B.subarray(0,h);let l,E;if(s>=3){for(C=0;C<32;++C)o[C]=Kr.#S[C];for(I=0,c=A.length;I>3;if(t>=3)for(g=0;g<50;++g)r=Rr(r,0,r.length);let I,c;if(t>=3){c=e;const A=new Uint8Array(o);for(g=19;g>=0;g--){for(let e=0;e>8&255,a[n++]=A>>16&255,a[n++]=255&e,a[n++]=e>>8&255,i&&(a[n++]=115,a[n++]=65,a[n++]=108,a[n++]=84),Rr(a,0,n).subarray(0,Math.min(t.length+5,16))}#U(A,e,t,i,a){if(!(e instanceof rA))throw new v("Invalid crypt filter name.");const s=this,n=A.get(e.name),g=n?.get("CFM");if(!g||"None"===g.name)return function(){return new Ur};if("V2"===g.name)return function(){return new Sr(s.#x(t,i,a,!1))};if("AESV2"===g.name)return function(){return new Lr(s.#x(t,i,a,!0))};if("AESV3"===g.name)return function(){return new Jr(a)};throw new v("Unknown crypto method")}constructor(A,e,t){const i=A.get("Filter");if(!QA(i,"Standard"))throw new v("unknown encryption method");this.filterName=i.name,this.dict=A;const a=A.get("V");if(!Number.isInteger(a)||1!==a&&2!==a&&4!==a&&5!==a)throw new v("unsupported encryption algorithm");this.algorithm=a;let s=A.get("Length");if(!s)if(a<=3)s=40;else{const e=A.get("CF"),t=A.get("StmF");if(e instanceof cA&&t instanceof rA){e.suppressEncryption=!0;const A=e.get(t.name);s=A?.get("Length")||128,s<40&&(s<<=3)}}if(!Number.isInteger(s)||s<40||s%8!=0)throw new v("invalid key length");const n=T(A.get("O")),g=T(A.get("U")),r=n.subarray(0,32),o=g.subarray(0,32),I=A.get("P"),c=A.get("R"),C=(4===a||5===a)&&!1!==A.get("EncryptMetadata");this.encryptMetadata=C;const B=T(e);let h,Q;if(t){if(6===c)try{t=_(t)}catch{S("CipherTransformFactory: Unable to convert UTF8 encoded password.")}h=T(t)}if(5!==a)Q=this.#G(B,h,r,o,I,c,s,C);else{const e=n.subarray(32,40),t=n.subarray(40,48),i=g.subarray(0,48),a=g.subarray(32,40),s=g.subarray(40,48),I=T(A.get("OE")),C=T(A.get("UE")),B=T(A.get("Perms"));Q=this.#R(c,h,r,e,t,i,o,a,s,I,C,B)}if(!Q&&!t)throw new M("No password given",1);if(!Q&&t){const A=this.#N(h,r,c,s);Q=this.#G(B,A,r,o,I,c,s,C)}if(!Q)throw new M("Incorrect Password",2);if(this.encryptionKey=Q,a>=4){const e=A.get("CF");e instanceof cA&&(e.suppressEncryption=!0),this.cf=e,this.stmf=A.get("StmF")||rA.get("Identity"),this.strf=A.get("StrF")||rA.get("Identity"),this.eff=A.get("EFF")||this.stmf}}createCipherTransform(A,e){if(4===this.algorithm||5===this.algorithm)return new vr(this.#U(this.cf,this.strf,A,e,this.encryptionKey),this.#U(this.cf,this.stmf,A,e,this.encryptionKey));const t=this.#x(A,e,this.encryptionKey,!1),i=function(){return new Sr(t)};return new vr(i,i)}}async function qr(A,e,t,{encrypt:i=null}){const a=i?.createCipherTransform(A.num,A.gen);t.push(`${A.num} ${A.gen} obj\n`),e instanceof cA?await Tr(e,t,a):e instanceof dA?await Pr(e,t,a):(Array.isArray(e)||ArrayBuffer.isView(e))&&await Wr(e,t,a),t.push("\nendobj\n")}async function Tr(A,e,t){e.push("<<");for(const i of A.getKeys())e.push(` /${vA(i)} `),await Zr(A.getRaw(i),e,t);e.push(">>")}async function Pr(A,e,t){let i=A.getBytes();const{dict:a}=A,[s,n]=await Promise.all([a.getAsync("Filter"),a.getAsync("DecodeParms")]),g=QA(Array.isArray(s)?await a.xref.fetchIfRefAsync(s[0]):s,"FlateDecode");if(i.length>=256||g)try{const A=new CompressionStream("deflate"),e=A.writable.getWriter();e.write(i),e.close();const t=await new Response(A.readable).arrayBuffer();let r,o;i=new Uint8Array(t),s?g||(r=Array.isArray(s)?[rA.get("FlateDecode"),...s]:[rA.get("FlateDecode"),s],n&&(o=Array.isArray(n)?[null,...n]:[null,n])):r=rA.get("FlateDecode"),r&&a.set("Filter",r),o&&a.set("DecodeParms",o)}catch(A){F(`writeStream - cannot compress data: "${A}".`)}let r=q(i);t&&(r=t.encryptString(r)),a.set("Length",r.length),await Tr(a,e,t),e.push(" stream\n",r,"\nendstream")}async function Wr(A,e,t){e.push("[");let i=!0;for(const a of A)i?i=!1:e.push(" "),await Zr(a,e,t);e.push("]")}async function Zr(A,e,t){A instanceof rA?e.push(`/${vA(A.name)}`):A instanceof CA?e.push(`${A.num} ${A.gen} R`):Array.isArray(A)||ArrayBuffer.isView(A)?await Wr(A,e,t):"string"==typeof A?(t&&(A=t.encryptString(A)),e.push(`(${KA(A)})`)):"number"==typeof A?e.push(jA(A)):"boolean"==typeof A?e.push(A.toString()):A instanceof cA?await Tr(A,e,t):A instanceof dA?await Pr(A,e,t):null===A?e.push("null"):S(`Unhandled value in writer: ${typeof A}, please file a bug.`)}function Or(A,e,t,i){for(let a=e+t-1;a>t-1;a--)i[a]=255&A,A>>=8;return t+e}function Xr(A,e,t){for(let i=0,a=A.length;i0){const i=function(A,e){const t=Math.floor(Date.now()/1e3),i=e.filename||"",a=[t.toString(),i,A.toString()];let s=a.reduce(((A,e)=>A+e.length),0);for(const A of Object.values(e.info))a.push(A),s+=A.length;const n=new Uint8Array(s);let g=0;for(const A of a)Xr(A,g,n),g+=A.length;return q(Rr(n))}(A,e);t.set("ID",[e.fileIds[0],i])}}async function zr({originalData:A,xrefInfo:e,newRefs:t,xref:i=null,hasXfa:a=!1,xfaDatasetsRef:s=null,hasXfaDatasetsEntry:n=!1,needAppearances:g,acroFormRef:r=null,acroForm:o=null,xfaData:I=null,useXrefStream:c=!1}){await async function({xref:A,acroForm:e,acroFormRef:t,hasXfa:i,hasXfaDatasetsEntry:a,xfaDatasetsRef:s,needAppearances:n,newRefs:g}){if(!i||a||s||S("XFA - Cannot save it"),!n&&(!i||!s||a))return;const r=e.clone();if(i&&!a){const A=e.get("XFA").slice();A.splice(2,0,"datasets"),A.splice(3,0,s),r.set("XFA",A)}n&&r.set("NeedAppearances",!0);const o=[];await qr(t,r,o,A),g.push({ref:t,data:o.join("")})}({xref:i,acroForm:o,acroFormRef:r,hasXfa:a,hasXfaDatasetsEntry:n,xfaDatasetsRef:s,needAppearances:g,newRefs:t}),a&&function({xfaData:A,xfaDatasetsRef:e,newRefs:t,xref:i}){null===A&&(A=function(A,e){const t=new br({hasAttributes:!0}).parseFromString(A);for(const{xfa:A}of e){if(!A)continue;const{path:e,value:i}=A;if(!e)continue;const a=YA(e);let s=t.documentElement.searchNode(a,0);!s&&a.length>1&&(s=t.documentElement.searchNode([a.at(-1)],0)),s?s.childNodes=Array.isArray(i)?i.map((A=>new Dr("value",A))):[new Dr("#text",i)]:S(`Node not found for path: ${e}`)}const i=[];return t.documentElement.dump(i),i.join("")}(i.fetchIfRef(e).getString(),t));const a=i.encrypt;a&&(A=a.createCipherTransform(e.num,e.gen).encryptString(A));const s=`${e.num} ${e.gen} obj\n<< /Type /EmbeddedFile /Length ${A.length}>>\nstream\n`+A+"\nendstream\nendobj\n";t.push({ref:e,data:s})}({xfaData:I,xfaDatasetsRef:s,newRefs:t,xref:i});const C=[];let B=A.length;const h=A.at(-1);10!==h&&13!==h&&(C.push("\n"),B+=1);const Q=function(A,e,t){const i=new cA(null);i.set("Prev",A.startXRef);const a=A.newRef;return t?(e.push({ref:a,data:""}),i.set("Size",a.num+1),i.set("Type",rA.get("XRef"))):i.set("Size",a.num),null!==A.rootRef&&i.set("Root",A.rootRef),null!==A.infoRef&&i.set("Info",A.infoRef),null!==A.encryptRef&&i.set("Encrypt",A.encryptRef),i}(e,t,c);t=t.sort(((A,e)=>A.ref.num-e.ref.num));for(const{data:A}of t)null!==A&&C.push(A);await(c?async function(A,e,t,i,a){const s=[];let n=0,g=0;for(const{ref:A,data:i}of t){let t;n=Math.max(n,e),null!==i?(t=Math.min(A.gen,65535),s.push([1,e,t]),e+=i.length):(t=Math.min(A.gen+1,65535),s.push([0,0,t])),g=Math.max(g,t)}i.set("Index",Vr(t));const r=[1,te(n),te(g)];i.set("W",r),jr(e,A,i);const o=r.reduce(((A,e)=>A+e),0),I=new Uint8Array(o*s.length),c=new ie(I);c.dict=i;let C=0;for(const[A,e,t]of s)C=Or(A,r[0],C,I),C=Or(e,r[1],C,I),C=Or(t,r[2],C,I);await qr(A.newRef,c,a,{}),a.push("startxref\n",e.toString(),"\n%%EOF\n")}(e,B,t,Q,C):async function(A,e,t,i,a){a.push("xref\n");const s=Vr(t);let n=0;for(const{ref:A,data:i}of t)A.num===s[n]&&(a.push(`${s[n]} ${s[n+1]}\n`),n+=2),null!==i?(a.push(`${e.toString().padStart(10,"0")} ${Math.min(A.gen,65535).toString().padStart(5,"0")} n\r\n`),e+=i.length):a.push(`0000000000 ${Math.min(A.gen+1,65535).toString().padStart(5,"0")} f\r\n`);jr(e,A,i),a.push("trailer\n"),await Tr(i,a),a.push("\nstartxref\n",e.toString(),"\n%%EOF\n")}(e,B,t,Q,C));const l=C.reduce(((A,e)=>A+e.length),A.length),E=new Uint8Array(l);E.set(A);let u=A.length;for(const A of C)Xr(A,u,E),u+=A.length;return E}class _r{constructor(A,e){this.dict=A,this.ref=e instanceof CA?e:null,this.roleMap=new Map,this.structParentIds=null}init(){this.readRoleMap()}#M(A,e,t){if(!(A instanceof CA)||e<0)return;this.structParentIds||=new hA;let i=this.structParentIds.get(A);i||(i=[],this.structParentIds.put(A,i)),i.push([e,t])}addAnnotationIdToPage(A,e){this.#M(A,e,4)}readRoleMap(){const A=this.dict.get("RoleMap");A instanceof cA&&A.forEach(((A,e)=>{e instanceof rA&&this.roleMap.set(A,e.name)}))}static async canCreateStructureTree({catalogRef:A,pdfManager:e,newAnnotationsByPage:t}){if(!(A instanceof CA))return S("Cannot save the struct tree: no catalog reference."),!1;let i=0,a=!0;for(const[A,s]of t){const{ref:t}=await e.getPage(A);if(!(t instanceof CA)){S(`Cannot save the struct tree: page ${A} has no ref.`),a=!0;break}for(const A of s)A.accessibilityData?.type&&(A.parentTreeId=i++,a=!1)}if(a){for(const A of t.values())for(const e of A)delete e.parentTreeId;return!1}return!0}static async createStructureTree({newAnnotationsByPage:A,xref:e,catalogRef:t,pdfManager:i,newRefs:a}){const s=i.catalog.cloneDict(),n=new hA;n.put(t,s);const g=e.getNewTemporaryRef();s.set("StructTreeRoot",g);const r=new cA(e);r.set("Type",rA.get("StructTreeRoot"));const o=e.getNewTemporaryRef();r.set("ParentTree",o);const I=[];r.set("K",I),n.put(g,r);const c=new cA(e),C=[];c.set("Nums",C);const B=await this.#L({newAnnotationsByPage:A,structTreeRootRef:g,kids:I,nums:C,xref:e,pdfManager:i,cache:n});r.set("ParentTreeNextKey",B),n.put(o,c);const h=[];for(const[A,t]of n.items())h.length=0,await qr(A,t,h,e),a.push({ref:A,data:h.join("")})}async canUpdateStructTree({pdfManager:A,xref:e,newAnnotationsByPage:t}){if(!this.ref)return S("Cannot update the struct tree: no root reference."),!1;let i=this.dict.get("ParentTreeNextKey");if(!Number.isInteger(i)||i<0)return S("Cannot update the struct tree: invalid next key."),!1;const a=this.dict.get("ParentTree");if(!(a instanceof cA))return S("Cannot update the struct tree: ParentTree isn't a dict."),!1;const s=a.get("Nums");if(!Array.isArray(s))return S("Cannot update the struct tree: nums isn't an array."),!1;const n=new dr(a,e);for(const e of t.keys()){const{pageDict:t}=await A.getPage(e);if(!t.has("StructParents"))continue;const i=t.get("StructParents");if(!Number.isInteger(i)||!Array.isArray(n.get(i)))return S(`Cannot save the struct tree: page ${e} has a wrong id.`),!1}let g=!0;for(const[e,a]of t){const{pageDict:t}=await A.getPage(e);_r.#J({elements:a,xref:this.dict.xref,pageDict:t,numberTree:n});for(const A of a)A.accessibilityData?.type&&(A.parentTreeId=i++,g=!1)}if(g){for(const A of t.values())for(const e of A)delete e.parentTreeId,delete e.structTreeParent;return!1}return!0}async updateStructureTree({newAnnotationsByPage:A,pdfManager:e,newRefs:t}){const i=this.dict.xref,a=this.dict.clone(),s=this.ref,n=new hA;n.put(s,a);let g,r=a.getRaw("ParentTree");r instanceof CA?g=i.fetch(r):(g=r,r=i.getNewTemporaryRef(),a.set("ParentTree",r)),g=g.clone(),n.put(r,g);let o=g.getRaw("Nums"),I=null;o instanceof CA&&(I=o,o=i.fetch(I)),o=o.slice(),I||g.set("Nums",o);const c=await _r.#L({newAnnotationsByPage:A,structTreeRootRef:s,kids:null,nums:o,xref:i,pdfManager:e,cache:n});a.set("ParentTreeNextKey",c),I&&n.put(I,o);const C=[];for(const[A,e]of n.items())C.length=0,await qr(A,e,C,i),t.push({ref:A,data:C.join("")})}static async#L({newAnnotationsByPage:A,structTreeRootRef:e,kids:t,nums:i,xref:a,pdfManager:s,cache:n}){const g=rA.get("OBJR");let r=-1/0;for(const[o,I]of A){const{ref:A}=await s.getPage(o),c=A instanceof CA;for(const{accessibilityData:s,ref:o,parentTreeId:C,structTreeParent:B}of I){if(!s?.type)continue;const{type:I,title:h,lang:Q,alt:l,expanded:E,actualText:u}=s;r=Math.max(r,C);const d=a.getNewTemporaryRef(),f=new cA(a);f.set("S",rA.get(I)),h&&f.set("T",_A(h)),Q&&f.set("Lang",Q),l&&f.set("Alt",_A(l)),E&&f.set("E",_A(E)),u&&f.set("ActualText",_A(u)),await this.#H({structTreeParent:B,tagDict:f,newTagRef:d,structTreeRootRef:e,fallbackKids:t,xref:a,cache:n});const p=new cA(a);f.set("K",p),p.set("Type",g),c&&p.set("Pg",A),p.set("Obj",o),n.put(d,f),i.push(C,d)}}return r+1}static#J({elements:A,xref:e,pageDict:t,numberTree:i}){const a=new Map;for(const e of A)if(e.structTreeParentId){const A=parseInt(e.structTreeParentId.split("_mc")[1],10);let t=a.get(A);t||(t=[],a.set(A,t)),t.push(e)}const s=t.get("StructParents");if(!Number.isInteger(s))return;const n=i.get(s),g=(A,t,i)=>{const s=a.get(A);if(s){const A=t.getRaw("P"),a=e.fetchIfRef(A);if(A instanceof CA&&a instanceof cA){const A={ref:i,dict:t};for(const e of s)e.structTreeParent=A}return!0}return!1};for(const A of n){if(!(A instanceof CA))continue;const t=e.fetch(A),i=t.get("K");if(Number.isInteger(i))g(i,t,A);else if(Array.isArray(i))for(let a of i){if(a=e.fetchIfRef(a),Number.isInteger(a)&&g(a,t,A))break;if(!(a instanceof cA))continue;if(!QA(a.get("Type"),"MCR"))break;const i=a.get("MCID");if(Number.isInteger(i)&&g(i,t,A))break}}}static async#H({structTreeParent:A,tagDict:e,newTagRef:t,structTreeRootRef:i,fallbackKids:a,xref:s,cache:n}){let g,r=null;A?(({ref:r}=A),g=A.dict.getRaw("P")||i):g=i,e.set("P",g);const o=s.fetchIfRef(g);if(!o)return void a.push(t);let I=n.get(g);I||(I=o.clone(),n.put(g,I));const c=I.getRaw("K");let C=c instanceof CA?n.get(c):null;if(!C){C=s.fetchIfRef(c),C=Array.isArray(C)?C.slice():[c];const A=s.getNewTemporaryRef();I.set("K",A),n.put(A,C)}const B=C.indexOf(r);C.splice(B>=0?B+1:C.length,0,t)}}class $r{constructor(A,e){this.tree=A,this.dict=e,this.kids=[],this.parseKids()}get role(){const A=this.dict.get("S"),e=A instanceof rA?A.name:"",{root:t}=this.tree;return t.roleMap.has(e)?t.roleMap.get(e):e}parseKids(){let A=null;const e=this.dict.getRaw("Pg");e instanceof CA&&(A=e.toString());const t=this.dict.get("K");if(Array.isArray(t))for(const e of t){const t=this.parseKid(A,e);t&&this.kids.push(t)}else{const e=this.parseKid(A,t);e&&this.kids.push(e)}}parseKid(A,e){if(Number.isInteger(e))return this.tree.pageDict.objId!==A?null:new Ao({type:1,mcid:e,pageObjId:A});let t=null;if(e instanceof CA?t=this.dict.xref.fetch(e):e instanceof cA&&(t=e),!t)return null;const i=t.getRaw("Pg");i instanceof CA&&(A=i.toString());const a=t.get("Type")instanceof rA?t.get("Type").name:null;if("MCR"===a){if(this.tree.pageDict.objId!==A)return null;const e=t.getRaw("Stm");return new Ao({type:2,refObjId:e instanceof CA?e.toString():null,pageObjId:A,mcid:t.get("MCID")})}if("OBJR"===a){if(this.tree.pageDict.objId!==A)return null;const e=t.getRaw("Obj");return new Ao({type:3,refObjId:e instanceof CA?e.toString():null,pageObjId:A})}return new Ao({type:5,dict:t})}}class Ao{constructor({type:A,dict:e=null,mcid:t=null,pageObjId:i=null,refObjId:a=null}){this.type=A,this.dict=e,this.mcid=t,this.pageObjId=i,this.refObjId=a,this.parentNode=null}}class eo{constructor(A,e){this.root=A,this.rootDict=A?A.dict:null,this.pageDict=e,this.nodes=[]}parse(A){if(!this.root||!this.rootDict)return;const e=this.rootDict.get("ParentTree");if(!e)return;const t=this.pageDict.get("StructParents"),i=A instanceof CA&&this.root.structParentIds?.get(A);if(!Number.isInteger(t)&&!i)return;const a=new Map,s=new dr(e,this.rootDict.xref);if(Number.isInteger(t)){const A=s.get(t);if(Array.isArray(A))for(const e of A)e instanceof CA&&this.addNode(this.rootDict.xref.fetch(e),a)}if(i)for(const[A,e]of i){const t=s.get(A);if(t){const A=this.addNode(this.rootDict.xref.fetchIfRef(t),a);1===A?.kids?.length&&3===A.kids[0].type&&(A.kids[0].type=e)}}}addNode(A,e,t=0){if(t>40)return S("StructTree MAX_DEPTH reached."),null;if(!(A instanceof cA))return null;if(e.has(A))return e.get(A);const i=new $r(this,A);e.set(A,i);const a=A.get("P");if(!a||QA(a.get("Type"),"StructTreeRoot"))return this.addTopLevelNode(A,i)||e.delete(A),i;const s=this.addNode(a,e,t+1);if(!s)return i;let n=!1;for(const e of s.kids)5===e.type&&e.dict===A&&(e.parentNode=i,n=!0);return n||e.delete(A),i}addTopLevelNode(A,e){const t=this.rootDict.get("K");if(!t)return!1;if(t instanceof cA)return t.objId===A.objId&&(this.nodes[0]=e,!0);if(!Array.isArray(t))return!0;let i=!1;for(let a=0;a40)return void S("StructTree too deep to be fully serialized.");const a=Object.create(null);a.role=e.role,a.children=[],t.children.push(a);const s=e.dict.get("Alt");"string"==typeof s&&(a.alt=j(s));const n=e.dict.get("Lang");"string"==typeof n&&(a.lang=j(n));for(const t of e.kids){const e=5===t.type?t.parentNode:null;e?A(e,a,i+1):1===t.type||2===t.type?a.children.push({type:"content",id:`p${t.pageObjId}_mc${t.mcid}`}):3===t.type?a.children.push({type:"object",id:t.refObjId}):4===t.type&&a.children.push({type:"annotation",id:`pdfjs_internal_id_${t.refObjId}`})}}const e=Object.create(null);e.children=[],e.role="Root";for(const t of this.nodes)t&&A(t,e);return e}}function to(A){if(!Array.isArray(A)||A.length<2)return!1;const[e,t,...i]=A;if(!(e instanceof CA||Number.isInteger(e)))return!1;if(!(t instanceof rA))return!1;const a=i.length;let s=!0;switch(t.name){case"XYZ":if(a<2||a>3)return!1;break;case"Fit":case"FitB":return 0===a;case"FitH":case"FitBH":case"FitV":case"FitBV":if(a>1)return!1;break;case"FitR":if(4!==a)return!1;s=!1;break;default:return!1}for(const A of i)if(!("number"==typeof A||s&&null===A))return!1;return!0}function io(A){return A instanceof cA&&(A=A.get("D")),to(A)?A:null}function ao(A){let e=A.get("D");if(e){if(e instanceof rA&&(e=e.name),"string"==typeof e)return j(e);if(to(e))return JSON.stringify(e)}return null}class so{constructor(A,e){if(this.pdfManager=A,this.xref=e,this._catDict=e.getCatalogObj(),!(this._catDict instanceof cA))throw new v("Catalog object is not a dictionary.");this.toplevelPagesDict,this._actualNumPages=null,this.fontCache=new hA,this.builtInCMapCache=new Map,this.standardFontDataCache=new Map,this.globalImageCache=new tg,this.pageKidsCountCache=new hA,this.pageIndexCache=new hA,this.pageDictCache=new hA,this.nonBlendModesSet=new BA,this.systemFontCache=new Map}cloneDict(){return this._catDict.clone()}get version(){const A=this._catDict.get("Version");if(A instanceof rA){if(fA.test(A.name))return x(this,"version",A.name);S(`Invalid PDF catalog version: ${A.name}`)}return x(this,"version",null)}get lang(){const A=this._catDict.get("Lang");return x(this,"lang",A&&"string"==typeof A?j(A):null)}get needsRendering(){const A=this._catDict.get("NeedsRendering");return x(this,"needsRendering","boolean"==typeof A&&A)}get collection(){let A=null;try{const e=this._catDict.get("Collection");e instanceof cA&&e.size>0&&(A=e)}catch(A){if(A instanceof mA)throw A;F("Cannot fetch Collection entry; assuming no collection is present.")}return x(this,"collection",A)}get acroForm(){let A=null;try{const e=this._catDict.get("AcroForm");e instanceof cA&&e.size>0&&(A=e)}catch(A){if(A instanceof mA)throw A;F("Cannot fetch AcroForm entry; assuming no forms are present.")}return x(this,"acroForm",A)}get acroFormRef(){const A=this._catDict.getRaw("AcroForm");return x(this,"acroFormRef",A instanceof CA?A:null)}get metadata(){const A=this._catDict.getRaw("Metadata");if(!(A instanceof CA))return x(this,"metadata",null);let e=null;try{const t=this.xref.fetch(A,!this.xref.encrypt?.encryptMetadata);if(t instanceof dA&&t.dict instanceof cA){const A=t.dict.get("Type"),i=t.dict.get("Subtype");if(QA(A,"Metadata")&&QA(i,"XML")){const A=z(t.getString());A&&(e=new kr(A).serializable)}}}catch(A){if(A instanceof mA)throw A;F(`Skipping invalid Metadata: "${A}".`)}return x(this,"metadata",e)}get markInfo(){let A=null;try{A=this._readMarkInfo()}catch(A){if(A instanceof mA)throw A;S("Unable to read mark info.")}return x(this,"markInfo",A)}_readMarkInfo(){const A=this._catDict.get("MarkInfo");if(!(A instanceof cA))return null;const e={Marked:!1,UserProperties:!1,Suspects:!1};for(const t in e){const i=A.get(t);"boolean"==typeof i&&(e[t]=i)}return e}get structTreeRoot(){let A=null;try{A=this._readStructTreeRoot()}catch(A){if(A instanceof mA)throw A;S("Unable read to structTreeRoot info.")}return x(this,"structTreeRoot",A)}_readStructTreeRoot(){const A=this._catDict.getRaw("StructTreeRoot"),e=this.xref.fetchIfRef(A);if(!(e instanceof cA))return null;const t=new _r(e,A);return t.init(),t}get toplevelPagesDict(){const A=this._catDict.get("Pages");if(!(A instanceof cA))throw new v("Invalid top-level pages dictionary.");return x(this,"toplevelPagesDict",A)}get documentOutline(){let A=null;try{A=this._readDocumentOutline()}catch(A){if(A instanceof mA)throw A;S("Unable to read document outline.")}return x(this,"documentOutline",A)}_readDocumentOutline(){let A=this._catDict.get("Outlines");if(!(A instanceof cA))return null;if(A=A.getRaw("First"),!(A instanceof CA))return null;const e={items:[]},t=[{obj:A,parent:e}],i=new BA;i.put(A);const a=this.xref,s=new Uint8ClampedArray(3);for(;t.length>0;){const e=t.shift(),n=a.fetchIfRef(e.obj);if(null===n)continue;n.has("Title")||S("Invalid outline item encountered.");const g={url:null,dest:null,action:null};so.parseDestDictionary({destDict:n,resultObj:g,docBaseUrl:this.baseUrl,docAttachments:this.attachments});const r=n.get("Title"),o=n.get("F")||0,I=n.getArray("C"),c=n.get("Count");let C=s;!MA(I,3)||0===I[0]&&0===I[1]&&0===I[2]||(C=re.singletons.rgb.getRgb(I,0));const B={action:g.action,attachment:g.attachment,dest:g.dest,url:g.url,unsafeUrl:g.unsafeUrl,newWindow:g.newWindow,setOCGState:g.setOCGState,title:"string"==typeof r?j(r):"",color:C,count:Number.isInteger(c)?c:void 0,bold:!!(2&o),italic:!!(1&o),items:[]};e.parent.items.push(B),A=n.getRaw("First"),A instanceof CA&&!i.has(A)&&(t.push({obj:A,parent:B}),i.put(A)),A=n.getRaw("Next"),A instanceof CA&&!i.has(A)&&(t.push({obj:A,parent:e.parent}),i.put(A))}return e.items.length>0?e.items:null}get permissions(){let A=null;try{A=this._readPermissions()}catch(A){if(A instanceof mA)throw A;S("Unable to read permissions.")}return x(this,"permissions",A)}_readPermissions(){const A=this.xref.trailer.get("Encrypt");if(!(A instanceof cA))return null;let e=A.get("P");if("number"!=typeof e)return null;e+=2**32;const t=[];for(const A in r){const i=r[A];e&i&&t.push(i)}return t}get optionalContentConfig(){let A=null;try{const e=this._catDict.get("OCProperties");if(!e)return x(this,"optionalContentConfig",null);const t=e.get("D");if(!t)return x(this,"optionalContentConfig",null);const i=e.get("OCGs");if(!Array.isArray(i))return x(this,"optionalContentConfig",null);const a=[],s=new BA;for(const A of i)A instanceof CA&&!s.has(A)&&(s.put(A),a.push(this.#Y(A)));A=this.#v(t,s),A.groups=a}catch(A){if(A instanceof mA)throw A;S(`Unable to read optional content config: ${A}`)}return x(this,"optionalContentConfig",A)}#Y(A){const e=this.xref.fetch(A),t={id:A.toString(),name:null,intent:null,usage:{print:null,view:null}},i=e.get("Name");"string"==typeof i&&(t.name=j(i));let a=e.getArray("Intent");Array.isArray(a)||(a=[a]),a.every((A=>A instanceof rA))&&(t.intent=a.map((A=>A.name)));const s=e.get("Usage");if(!(s instanceof cA))return t;const n=t.usage,g=s.get("Print");if(g instanceof cA){const A=g.get("PrintState");if(A instanceof rA)switch(A.name){case"ON":case"OFF":n.print={printState:A.name}}}const r=s.get("View");if(r instanceof cA){const A=r.get("ViewState");if(A instanceof rA)switch(A.name){case"ON":case"OFF":n.view={viewState:A.name}}}return t}#v(A,e){function t(A){const t=[];if(Array.isArray(A))for(const i of A)i instanceof CA&&e.has(i)&&t.push(i.toString());return t}function i(A,t=0){if(!Array.isArray(A))return null;const i=[];for(const s of A){if(s instanceof CA&&e.has(s)){n.put(s),i.push(s.toString());continue}const A=a(s,t);A&&i.push(A)}if(t>0)return i;const s=[];for(const A of e)n.has(A)||s.push(A.toString());return s.length&&i.push({name:null,order:s}),i}function a(A,e){if(++e>g)return S("parseNestedOrder - reached MAX_NESTED_LEVELS."),null;const t=s.fetchIfRef(A);if(!Array.isArray(t))return null;const a=s.fetchIfRef(t[0]);if("string"!=typeof a)return null;const n=i(t.slice(1),e);return n&&n.length?{name:j(a),order:n}:null}const s=this.xref,n=new BA,g=10;return{name:"string"==typeof A.get("Name")?j(A.get("Name")):null,creator:"string"==typeof A.get("Creator")?j(A.get("Creator")):null,baseState:A.get("BaseState")instanceof rA?A.get("BaseState").name:null,on:t(A.get("ON")),off:t(A.get("OFF")),order:i(A.get("Order")),groups:null}}setActualNumPages(A=null){this._actualNumPages=A}get hasActualNumPages(){return null!==this._actualNumPages}get _pagesCount(){const A=this.toplevelPagesDict.get("Count");if(!Number.isInteger(A))throw new v("Page count in top-level pages dictionary is not an integer.");return x(this,"_pagesCount",A)}get numPages(){return this.hasActualNumPages?this._actualNumPages:this._pagesCount}get destinations(){const A=this._readDests(),e=Object.create(null);if(A instanceof ur)for(const[t,i]of A.getAll()){const A=io(i);A&&(e[j(t)]=A)}else A instanceof cA&&A.forEach((function(A,t){const i=io(t);i&&(e[A]=i)}));return x(this,"destinations",e)}getDestination(A){const e=this._readDests();if(e instanceof ur){const t=io(e.get(A));if(t)return t;const i=this.destinations[A];if(i)return S(`Found "${A}" at an incorrect position in the NameTree.`),i}else if(e instanceof cA){const t=io(e.get(A));if(t)return t}return null}_readDests(){const A=this._catDict.get("Names");return A?.has("Dests")?new ur(A.getRaw("Dests"),this.xref):this._catDict.has("Dests")?this._catDict.get("Dests"):void 0}get pageLabels(){let A=null;try{A=this._readPageLabels()}catch(A){if(A instanceof mA)throw A;S("Unable to read page labels.")}return x(this,"pageLabels",A)}_readPageLabels(){const A=this._catDict.getRaw("PageLabels");if(!A)return null;const e=new Array(this.numPages);let t=null,i="";const a=new dr(A,this.xref).getAll();let s="",n=1;for(let A=0,g=this.numPages;A=1))throw new v("Invalid start in PageLabel dictionary.");n=A}else n=1}switch(t){case"D":s=n;break;case"R":case"r":s=SA(n,"r"===t);break;case"A":case"a":const A=26,e="a"===t?97:65,i=n-1;s=String.fromCharCode(e+i%A).repeat(Math.floor(i/A)+1);break;default:if(t)throw new v(`Invalid style "${t}" in PageLabel dictionary.`);s=""}e[A]=i+s,n++}return e}get pageLayout(){const A=this._catDict.get("PageLayout");let e="";if(A instanceof rA)switch(A.name){case"SinglePage":case"OneColumn":case"TwoColumnLeft":case"TwoColumnRight":case"TwoPageLeft":case"TwoPageRight":e=A.name}return x(this,"pageLayout",e)}get pageMode(){const A=this._catDict.get("PageMode");let e="UseNone";if(A instanceof rA)switch(A.name){case"UseNone":case"UseOutlines":case"UseThumbs":case"FullScreen":case"UseOC":case"UseAttachments":e=A.name}return x(this,"pageMode",e)}get viewerPreferences(){const A=this._catDict.get("ViewerPreferences");if(!(A instanceof cA))return x(this,"viewerPreferences",null);let e=null;for(const t of A.getKeys()){const i=A.get(t);let a;switch(t){case"HideToolbar":case"HideMenubar":case"HideWindowUI":case"FitWindow":case"CenterWindow":case"DisplayDocTitle":case"PickTrayByPDFSize":"boolean"==typeof i&&(a=i);break;case"NonFullScreenPageMode":if(i instanceof rA)switch(i.name){case"UseNone":case"UseOutlines":case"UseThumbs":case"UseOC":a=i.name;break;default:a="UseNone"}break;case"Direction":if(i instanceof rA)switch(i.name){case"L2R":case"R2L":a=i.name;break;default:a="L2R"}break;case"ViewArea":case"ViewClip":case"PrintArea":case"PrintClip":if(i instanceof rA)switch(i.name){case"MediaBox":case"CropBox":case"BleedBox":case"TrimBox":case"ArtBox":a=i.name;break;default:a="CropBox"}break;case"PrintScaling":if(i instanceof rA)switch(i.name){case"None":case"AppDefault":a=i.name;break;default:a="AppDefault"}break;case"Duplex":if(i instanceof rA)switch(i.name){case"Simplex":case"DuplexFlipShortEdge":case"DuplexFlipLongEdge":a=i.name;break;default:a="None"}break;case"PrintPageRange":Array.isArray(i)&&i.length%2==0&&i.every(((A,e,t)=>Number.isInteger(A)&&A>0&&(0===e||A>=t[e-1])&&A<=this.numPages))&&(a=i);break;case"NumCopies":Number.isInteger(i)&&i>0&&(a=i);break;default:S(`Ignoring non-standard key in ViewerPreferences: ${t}.`);continue}void 0!==a?(e||(e=Object.create(null)),e[t]=a):S(`Bad value, for key "${t}", in ViewerPreferences: ${i}.`)}return x(this,"viewerPreferences",e)}get openAction(){const A=this._catDict.get("OpenAction"),e=Object.create(null);if(A instanceof cA){const t=new cA(this.xref);t.set("A",A);const i={url:null,dest:null,action:null};so.parseDestDictionary({destDict:t,resultObj:i}),Array.isArray(i.dest)?e.dest=i.dest:i.action&&(e.action=i.action)}else Array.isArray(A)&&(e.dest=A);return x(this,"openAction",W(e)>0?e:null)}get attachments(){const A=this._catDict.get("Names");let e=null;if(A instanceof cA&&A.has("EmbeddedFiles")){const t=new ur(A.getRaw("EmbeddedFiles"),this.xref);for(const[A,i]of t.getAll()){const t=new mr(i,this.xref);e||(e=Object.create(null)),e[j(A)]=t.serializable}}return x(this,"attachments",e)}get xfaImages(){const A=this._catDict.get("Names");let e=null;if(A instanceof cA&&A.has("XFAImages")){const t=new ur(A.getRaw("XFAImages"),this.xref);for(const[A,i]of t.getAll())e||(e=new cA(this.xref)),e.set(j(A),i)}return x(this,"xfaImages",e)}_collectJavaScript(){const A=this._catDict.get("Names");let e=null;function t(A,t){if(!(t instanceof cA))return;if(!QA(t.get("S"),"JavaScript"))return;let i=t.get("JS");if(i instanceof dA)i=i.getString();else if("string"!=typeof i)return;i=j(i).replaceAll("\0",""),i&&(e||=new Map).set(A,i)}if(A instanceof cA&&A.has("JavaScript")){const e=new ur(A.getRaw("JavaScript"),this.xref);for(const[A,i]of e.getAll())t(j(A),i)}const i=this._catDict.get("OpenAction");return i&&t("OpenAction",i),e}get jsActions(){const A=this._collectJavaScript();let e=TA(this.xref,this._catDict,B);if(A){e||=Object.create(null);for(const[t,i]of A)t in e?e[t].push(i):e[t]=[i]}return x(this,"jsActions",e)}async fontFallback(A,e){const t=await Promise.all(this.fontCache);for(const i of t)if(i.loadedName===A)return void i.fallback(e)}async cleanup(A=!1){fr(),this.globalImageCache.clear(A),this.pageKidsCountCache.clear(),this.pageIndexCache.clear(),this.pageDictCache.clear(),this.nonBlendModesSet.clear();const e=await Promise.all(this.fontCache);for(const{dict:A}of e)delete A.cacheKey;this.fontCache.clear(),this.builtInCMapCache.clear(),this.standardFontDataCache.clear(),this.systemFontCache.clear()}async getPageDict(A){const e=[this.toplevelPagesDict],t=new BA,i=this._catDict.getRaw("Pages");i instanceof CA&&t.put(i);const a=this.xref,s=this.pageKidsCountCache,n=this.pageIndexCache,g=this.pageDictCache;let r=0;for(;e.length;){const i=e.pop();if(i instanceof CA){const o=s.get(i);if(o>=0&&r+o<=A){r+=o;continue}if(t.has(i))throw new v("Pages tree contains circular reference.");t.put(i);const I=await(g.get(i)||a.fetchAsync(i));if(I instanceof cA){let e=I.getRaw("Type");if(e instanceof CA&&(e=await a.fetchAsync(e)),QA(e,"Page")||!I.has("Kids")){if(s.has(i)||s.put(i,1),n.has(i)||n.put(i,r),r===A)return[I,i];r++;continue}}e.push(I);continue}if(!(i instanceof cA))throw new v("Page dictionary kid reference points to wrong type of object.");const{objId:o}=i;let I=i.getRaw("Count");if(I instanceof CA&&(I=await a.fetchAsync(I)),Number.isInteger(I)&&I>=0&&(o&&!s.has(o)&&s.put(o,I),r+I<=A)){r+=I;continue}let c=i.getRaw("Kids");if(c instanceof CA&&(c=await a.fetchAsync(c)),!Array.isArray(c)){let e=i.getRaw("Type");if(e instanceof CA&&(e=await a.fetchAsync(e)),QA(e,"Page")||!i.has("Kids")){if(r===A)return[i,null];r++;continue}throw new v("Page dictionary kids object is not an array.")}for(let A=c.length-1;A>=0;A--){const t=c[A];e.push(t),i===this.toplevelPagesDict&&t instanceof CA&&!g.has(t)&&g.put(t,a.fetchAsync(t))}}throw new Error(`Page index ${A} not found.`)}async getAllPageDicts(A=!1){const{ignoreErrors:e}=this.pdfManager.evaluatorOptions,t=[{currentNode:this.toplevelPagesDict,posInKids:0}],i=new BA,a=this._catDict.getRaw("Pages");a instanceof CA&&i.put(a);const s=new Map,n=this.xref,g=this.pageIndexCache;let r=0;function o(t){if(t instanceof wA&&!A)throw t;A&&e&&0===r&&(S(`getAllPageDicts - Skipping invalid first page: "${t}".`),t=cA.empty),s.set(r++,[t,null])}for(;t.length>0;){const A=t.at(-1),{currentNode:e,posInKids:a}=A;let C=e.getRaw("Kids");if(C instanceof CA)try{C=await n.fetchAsync(C)}catch(A){o(A);break}if(!Array.isArray(C)){o(new v("Page dictionary kids object is not an array."));break}if(a>=C.length){t.pop();continue}const B=C[a];let h;if(B instanceof CA){if(i.has(B)){o(new v("Pages tree contains circular reference."));break}i.put(B);try{h=await n.fetchAsync(B)}catch(A){o(A);break}}else h=B;if(!(h instanceof cA)){o(new v("Page dictionary kid reference points to wrong type of object."));break}let Q=h.getRaw("Type");if(Q instanceof CA)try{Q=await n.fetchAsync(Q)}catch(A){o(A);break}QA(Q,"Page")||!h.has("Kids")?(I=h,(c=B instanceof CA?B:null)&&!g.has(c)&&g.put(c,r),s.set(r++,[I,c])):t.push({currentNode:h,posInKids:0}),A.posInKids++}var I,c;return s}getPageIndex(A){const e=this.pageIndexCache.get(A);if(void 0!==e)return Promise.resolve(e);const t=this.xref;let i=0;const a=e=>function(e){let i,a=0;return t.fetchAsync(e).then((function(t){if(uA(e,A)&&!EA(t,"Page")&&!(t instanceof cA&&!t.has("Type")&&t.has("Contents")))throw new v("The reference does not point to a /Page dictionary.");if(!t)return null;if(!(t instanceof cA))throw new v("Node must be a dictionary.");return i=t.getRaw("Parent"),t.getAsync("Parent")})).then((function(A){if(!A)return null;if(!(A instanceof cA))throw new v("Parent must be a dictionary.");return A.getAsync("Kids")})).then((function(A){if(!A)return null;const s=[];let n=!1;for(const i of A){if(!(i instanceof CA))throw new v("Kid must be a reference.");if(uA(i,e)){n=!0;break}s.push(t.fetchAsync(i).then((function(A){if(!(A instanceof cA))throw new v("Kid node must be a dictionary.");A.has("Count")?a+=A.get("Count"):a++})))}if(!n)throw new v("Kid reference not found in parent's kids.");return Promise.all(s).then((function(){return[a,i]}))}))}(e).then((e=>{if(!e)return this.pageIndexCache.put(A,i),i;const[t,s]=e;return i+=t,a(s)}));return a(A)}get baseUrl(){const A=this._catDict.get("URI");if(A instanceof cA){const e=A.get("Base");if("string"==typeof e){const A=N(e,null,{tryConvertEncoding:!0});if(A)return x(this,"baseUrl",A.href)}}return x(this,"baseUrl",this.pdfManager.docBaseUrl)}static parseDestDictionary({destDict:A,resultObj:e,docBaseUrl:t=null,docAttachments:i=null}){if(!(A instanceof cA))return void S("parseDestDictionary: `destDict` must be a dictionary.");let a,s,n=A.get("A");if(n instanceof cA||(A.has("Dest")?n=A.get("Dest"):(n=A.get("AA"),n instanceof cA&&(n.has("D")?n=n.get("D"):n.has("U")&&(n=n.get("U"))))),n instanceof cA){const A=n.get("S");if(!(A instanceof rA))return void S("parseDestDictionary: Invalid type in Action dictionary.");const t=A.name;switch(t){case"ResetForm":const A=n.get("Flags"),g=!(1&("number"==typeof A?A:0)),r=[],o=[];for(const A of n.get("Fields")||[])A instanceof CA?o.push(A.toString()):"string"==typeof A&&r.push(j(A));e.resetForm={fields:r,refs:o,include:g};break;case"URI":a=n.get("URI"),a instanceof rA&&(a="/"+a.name);break;case"GoTo":s=n.get("D");break;case"Launch":case"GoToR":const I=n.get("F");if(I instanceof cA){const A=new mr(I,null,!0),{rawFilename:e}=A.serializable;a=e}else"string"==typeof I&&(a=I);const c=ao(n);c&&"string"==typeof a&&(a=a.split("#",1)[0]+"#"+c);const C=n.get("NewWindow");"boolean"==typeof C&&(e.newWindow=C);break;case"GoToE":const B=n.get("T");let h;if(i&&B instanceof cA){const A=B.get("R"),e=B.get("N");QA(A,"C")&&"string"==typeof e&&(h=i[j(e)])}if(h){e.attachment=h;const A=ao(n);A&&(e.attachmentDest=A)}else S('parseDestDictionary - unimplemented "GoToE" action.');break;case"Named":const Q=n.get("N");Q instanceof rA&&(e.action=Q.name);break;case"SetOCGState":const l=n.get("State"),E=n.get("PreserveRB");if(!Array.isArray(l)||0===l.length)break;const u=[];for(const A of l)if(A instanceof rA)switch(A.name){case"ON":case"OFF":case"Toggle":u.push(A.name)}else A instanceof CA&&u.push(A.toString());if(u.length!==l.length)break;e.setOCGState={state:u,preserveRB:"boolean"!=typeof E||E};break;case"JavaScript":const d=n.get("JS");let f;d instanceof dA?f=d.getString():"string"==typeof d&&(f=d);const p=f&&VA(j(f));if(p){a=p.url,e.newWindow=p.newWindow;break}default:if("JavaScript"===t||"SubmitForm"===t)break;S(`parseDestDictionary - unsupported action: "${t}".`)}}else A.has("Dest")&&(s=A.get("Dest"));if("string"==typeof a){const A=N(a,t,{addDefaultProtocol:!0,tryConvertEncoding:!0});A&&(e.url=A.href),e.unsafeUrl=a}s&&(s instanceof rA&&(s=s.name),"string"==typeof s?e.dest=j(s):to(s)&&(e.dest=s))}}function no(A,e){if(A instanceof cA)A=A.getRawValues();else if(A instanceof dA)A=A.dict.getRawValues();else if(!Array.isArray(A))return;for(const i of A)((t=i)instanceof CA||t instanceof cA||t instanceof dA||Array.isArray(t))&&e.push(i);var t}class go{constructor(A,e,t){this.dict=A,this.keys=e,this.xref=t,this.refSet=null}async load(){if(this.xref.stream.isDataLoaded)return;const{keys:A,dict:e}=this;this.refSet=new BA;const t=[];for(const i of A){const A=e.getRaw(i);void 0!==A&&t.push(A)}return this._walk(t)}async _walk(A){const e=[],t=[];for(;A.length;){let i=A.pop();if(i instanceof CA){if(this.refSet.has(i))continue;try{this.refSet.put(i),i=this.xref.fetch(i)}catch(A){if(!(A instanceof mA)){S(`ObjectLoader._walk - requesting all data: "${A}".`),this.refSet=null;const{manager:e}=this.xref.stream;return e.requestAllChunks()}e.push(i),t.push({begin:A.begin,end:A.end})}}if(i instanceof dA){const A=i.getBaseStreams();if(A){let a=!1;for(const e of A)e.isDataLoaded||(a=!0,t.push({begin:e.start,end:e.end}));a&&e.push(i)}}no(i,A)}if(t.length){await this.xref.stream.manager.requestRanges(t);for(const A of e)A instanceof CA&&this.refSet.remove(A);return this._walk(e)}this.refSet=null}}const ro=Symbol(),oo=Symbol(),Io=Symbol(),co=Symbol(),Co=Symbol(),Bo=Symbol(),ho=Symbol(),Qo=Symbol(),lo=Symbol(),Eo=Symbol("content"),uo=Symbol("data"),fo=Symbol(),po=Symbol("extra"),mo=Symbol(),yo=Symbol(),wo=Symbol(),Do=Symbol(),bo=Symbol(),ko=Symbol(),Fo=Symbol(),So=Symbol(),Ro=Symbol(),Go=Symbol(),No=Symbol(),xo=Symbol(),Uo=Symbol(),Mo=Symbol(),Lo=Symbol(),Jo=Symbol(),Ho=Symbol(),Yo=Symbol(),vo=Symbol(),Ko=Symbol(),qo=Symbol(),To=Symbol(),Po=Symbol(),Wo=Symbol(),Zo=Symbol(),Oo=Symbol(),Xo=Symbol(),Vo=Symbol(),jo=Symbol(),zo=Symbol(),_o=Symbol(),$o=Symbol(),AI=Symbol("namespaceId"),eI=Symbol("nodeName"),tI=Symbol(),iI=Symbol(),aI=Symbol(),sI=Symbol(),nI=Symbol(),gI=Symbol(),rI=Symbol(),oI=Symbol(),II=Symbol("root"),cI=Symbol(),CI=Symbol(),BI=Symbol(),hI=Symbol(),QI=Symbol(),lI=Symbol(),EI=Symbol(),uI=Symbol(),dI=Symbol(),fI=Symbol(),pI=Symbol(),mI=Symbol("uid"),yI=Symbol(),wI={config:{id:0,check:A=>A.startsWith("http://www.xfa.org/schema/xci/")},connectionSet:{id:1,check:A=>A.startsWith("http://www.xfa.org/schema/xfa-connection-set/")},datasets:{id:2,check:A=>A.startsWith("http://www.xfa.org/schema/xfa-data/")},form:{id:3,check:A=>A.startsWith("http://www.xfa.org/schema/xfa-form/")},localeSet:{id:4,check:A=>A.startsWith("http://www.xfa.org/schema/xfa-locale-set/")},pdf:{id:5,check:A=>"http://ns.adobe.com/xdp/pdf/"===A},signature:{id:6,check:A=>"http://www.w3.org/2000/09/xmldsig#"===A},sourceSet:{id:7,check:A=>A.startsWith("http://www.xfa.org/schema/xfa-source-set/")},stylesheet:{id:8,check:A=>"http://www.w3.org/1999/XSL/Transform"===A},template:{id:9,check:A=>A.startsWith("http://www.xfa.org/schema/xfa-template/")},xdc:{id:10,check:A=>A.startsWith("http://www.xfa.org/schema/xdc/")},xdp:{id:11,check:A=>"http://ns.adobe.com/xdp/"===A},xfdf:{id:12,check:A=>"http://ns.adobe.com/xfdf/"===A},xhtml:{id:13,check:A=>"http://www.w3.org/1999/xhtml"===A},xmpmeta:{id:14,check:A=>"http://ns.adobe.com/xmpmeta/"===A}},DI={pt:A=>A,cm:A=>A/2.54*72,mm:A=>A/25.4*72,in:A=>72*A,px:A=>A},bI=/([+-]?\d+\.?\d*)(.*)/;function kI(A){return A.startsWith("'")||A.startsWith('"')?A.slice(1,-1):A}function FI({data:A,defaultValue:e,validate:t}){if(!A)return e;A=A.trim();const i=parseInt(A,10);return!isNaN(i)&&t(i)?i:e}function SI({data:A,defaultValue:e,validate:t}){if(!A)return e;A=A.trim();const i=parseFloat(A);return!isNaN(i)&&t(i)?i:e}function RI({data:A,defaultValue:e,validate:t}){return A&&t(A=A.trim())?A:e}function GI(A,e){return RI({data:A,defaultValue:e[0],validate:A=>e.includes(A)})}function NI(A,e="0"){if(e||="0",!A)return NI(e);const t=A.trim().match(bI);if(!t)return NI(e);const[,i,a]=t,s=parseFloat(i);if(isNaN(s))return NI(e);if(0===s)return 0;const n=DI[a];return n?n(s):s}function xI(A){if(!A)return{num:1,den:1};const e=A.trim().split(/\s*:\s*/).map((A=>parseFloat(A))).filter((A=>!isNaN(A)));if(1===e.length&&e.push(1),0===e.length)return{num:1,den:1};const[t,i]=e;return{num:t,den:i}}function UI(A){return A?A.trim().split(/\s+/).map((A=>({excluded:"-"===A[0],viewname:A.substring(1)}))):[]}class MI{static get FAILURE(){return x(this,"FAILURE",new MI(!1,null,null,null))}static get EMPTY(){return x(this,"EMPTY",new MI(!0,null,null,null))}constructor(A,e,t,i){this.success=A,this.html=e,this.bbox=t,this.breakNode=i}isBreak(){return!!this.breakNode}static breakNode(A){return new MI(!1,null,null,A)}static success(A,e=null){return new MI(!0,A,e,null)}}class LI{constructor(A){this.fonts=new Map,this.cache=new Map,this.warned=new Set,this.defaultFont=null,this.add(A)}add(A,e=null){for(const e of A)this.addPdfFont(e);for(const A of this.fonts.values())A.regular||(A.regular=A.italic||A.bold||A.bolditalic);if(!e||0===e.size)return;const t=this.fonts.get("PdfJS-Fallback-PdfJS-XFA");for(const A of e)this.fonts.set(A,t)}addPdfFont(A){const e=A.cssFontInfo,t=e.fontFamily;let i=this.fonts.get(t);i||(i=Object.create(null),this.fonts.set(t,i),this.defaultFont||(this.defaultFont=i));let a="";const s=parseFloat(e.fontWeight);0!==parseFloat(e.italicAngle)?a=s>=700?"bolditalic":"italic":s>=700&&(a="bold"),a||((A.name.includes("Bold")||A.psName?.includes("Bold"))&&(a="bold"),(A.name.includes("Italic")||A.name.endsWith("It")||A.psName?.includes("Italic")||A.psName?.endsWith("It"))&&(a+="italic")),a||(a="regular"),i[a]=A}getDefault(){return this.defaultFont}find(A,e=!0){let t=this.fonts.get(A)||this.cache.get(A);if(t)return t;const i=/,|-|_| |bolditalic|bold|italic|regular|it/gi;let a=A.replaceAll(i,"");if(t=this.fonts.get(a),t)return this.cache.set(A,t),t;a=a.toLowerCase();const s=[];for(const[A,e]of this.fonts.entries())A.replaceAll(i,"").toLowerCase().startsWith(a)&&s.push(e);if(0===s.length)for(const[,A]of this.fonts.entries())A.regular.name?.replaceAll(i,"").toLowerCase().startsWith(a)&&s.push(A);if(0===s.length){a=a.replaceAll(/psmt|mt/gi,"");for(const[A,e]of this.fonts.entries())A.replaceAll(i,"").toLowerCase().startsWith(a)&&s.push(e)}if(0===s.length)for(const A of this.fonts.values())A.regular.name?.replaceAll(i,"").toLowerCase().startsWith(a)&&s.push(A);return s.length>=1?(1!==s.length&&e&&S(`XFA - Too many choices to guess the correct font: ${A}`),this.cache.set(A,s[0]),s[0]):(e&&!this.warned.has(A)&&(this.warned.add(A),S(`XFA - Cannot find the font: ${A}`)),null)}}function JI(A,e){return"italic"===A.posture?"bold"===A.weight?e.bolditalic:e.italic:"bold"===A.weight?e.bold:e.regular}class HI{constructor(A,e,t,i){if(this.lineHeight=t,this.paraMargin=e||{top:0,bottom:0,left:0,right:0},!A)return void([this.pdfFont,this.xfaFont]=this.defaultFont(i));this.xfaFont={typeface:A.typeface,posture:A.posture,weight:A.weight,size:A.size,letterSpacing:A.letterSpacing};const a=i.find(A.typeface);a?(this.pdfFont=JI(A,a),this.pdfFont||([this.pdfFont,this.xfaFont]=this.defaultFont(i))):[this.pdfFont,this.xfaFont]=this.defaultFont(i)}defaultFont(A){const e=A.find("Helvetica",!1)||A.find("Myriad Pro",!1)||A.find("Arial",!1)||A.getDefault();if(e?.regular){const A=e.regular;return[A,{typeface:A.cssFontInfo.fontFamily,posture:"normal",weight:"normal",size:10,letterSpacing:0}]}return[null,{typeface:"Courier",posture:"normal",weight:"normal",size:10,letterSpacing:0}]}}class YI{constructor(A,e,t,i){this.fontFinder=i,this.stack=[new HI(A,e,t,i)]}pushData(A,e,t){const i=this.stack.at(-1);for(const e of["typeface","posture","weight","size","letterSpacing"])A[e]||(A[e]=i.xfaFont[e]);for(const A of["top","bottom","left","right"])isNaN(e[A])&&(e[A]=i.paraMargin[A]);const a=new HI(A,e,t||i.lineHeight,this.fontFinder);a.pdfFont||(a.pdfFont=i.pdfFont),this.stack.push(a)}popFont(){this.stack.pop()}topFont(){return this.stack.at(-1)}}class vI{constructor(A,e,t,i){this.glyphs=[],this.fontSelector=new YI(A,e,t,i),this.extraHeight=0}pushData(A,e,t){this.fontSelector.pushData(A,e,t)}popFont(A){return this.fontSelector.popFont()}addPara(){const A=this.fontSelector.topFont();this.extraHeight+=A.paraMargin.top+A.paraMargin.bottom}addString(A){if(!A)return;const e=this.fontSelector.topFont(),t=e.xfaFont.size;if(e.pdfFont){const i=e.xfaFont.letterSpacing,a=e.pdfFont,s=a.lineHeight||1.2,n=e.lineHeight||Math.max(1.2,s)*t,g=s-(void 0===a.lineGap?.2:a.lineGap),r=Math.max(1,g)*t,o=t/1e3,I=a.defaultWidth||a.charsToGlyphs(" ")[0].width;for(const e of A.split(/[\u2029\n]/)){const A=a.encodeString(e).join(""),t=a.charsToGlyphs(A);for(const A of t){const e=A.width||I;this.glyphs.push([e*o+i,n,r,A.unicode,!1])}this.glyphs.push([0,0,0,"\n",!0])}this.glyphs.pop()}else{for(const e of A.split(/[\u2029\n]/)){for(const A of e.split(""))this.glyphs.push([t,1.2*t,t,A,!1]);this.glyphs.push([0,0,0,"\n",!0])}this.glyphs.pop()}}compute(A){let e=-1,t=0,i=0,a=0,s=0,n=0,g=!1,r=!0;for(let o=0,I=this.glyphs.length;oA?(i=Math.max(i,s),s=0,a+=n,n=l,e=-1,t=0,g=!0,r=!1):(n=Math.max(l,n),t=s,s+=I,e=o):s+I>A?(a+=n,n=l,-1!==e?(o=e,i=Math.max(i,t),s=0,e=-1,t=0):(i=Math.max(i,s),s=I),g=!0,r=!1):(s+=I,n=Math.max(l,n))}return i=Math.max(i,s),a+=n+this.extraHeight,{width:1.02*i,height:a,isBroken:g}}}const KI=/^[^.[]+/,qI=/^[^\]]+/,TI=new Map([["$data",(A,e)=>A.datasets?A.datasets.data:A],["$record",(A,e)=>(A.datasets?A.datasets.data:A)[xo]()[0]],["$template",(A,e)=>A.template],["$connectionSet",(A,e)=>A.connectionSet],["$form",(A,e)=>A.form],["$layout",(A,e)=>A.layout],["$host",(A,e)=>A.host],["$dataWindow",(A,e)=>A.dataWindow],["$event",(A,e)=>A.event],["!",(A,e)=>A.datasets],["$xfa",(A,e)=>A],["xfa",(A,e)=>A],["$",(A,e)=>e]]),PI=new WeakMap;function WI(A,e,t=!0){let i=A.match(KI);if(!i)return null;let[a]=i;const s=[{name:a,cacheName:"."+a,index:0,js:null,formCalc:null,operator:0}];let n=a.length;for(;n0&&I.push(A)}if(0!==I.length||g||0!==r)A=isFinite(o)?I.filter((A=>oA[o])):I.flat();else{const t=e[Jo]();if(!(e=t))return null;r=-1,A=[e]}}return 0===A.length?null:A}function OI(A,e,t){const i=WI(t);if(!i)return null;if(i.some((A=>1===A.operator)))return null;const a=TI.get(i[0].name);let s=0;a?(A=a(A,e),s=1):A=e||A;for(let e=i.length;sA[EI]())).join("")}get[jI](){const A=Object.getPrototypeOf(this);if(!A._attributes){const e=A._attributes=new Set;for(const A of Object.getOwnPropertyNames(this)){if(null===this[A]||this[A]instanceof Bc||this[A]instanceof hc)break;e.add(A)}}return x(this,jI,A._attributes)}[Oo](A){let e=this;for(;e;){if(e===A)return!0;e=e[Jo]()}return!1}[Jo](){return this[gc]}[Lo](){return this[Jo]()}[xo](A=null){return A?this[A]:this[zI]}[fo](){const A=Object.create(null);this[Eo]&&(A.$content=this[Eo]);for(const e of Object.getOwnPropertyNames(this)){const t=this[e];null!==t&&(t instanceof Bc?A[e]=t[fo]():t instanceof hc?t.isEmpty()||(A[e]=t.dump()):A[e]=t)}return A}[pI](){return null}[dI](){return MI.EMPTY}*[Uo](){for(const A of this[xo]())yield A}*[ec](A,e){for(const t of this[Uo]())if(!A||e===A.has(t[eI])){const A=this[bo](),e=t[dI](A);e.success||(this[po].failingNode=t),yield e}}[yo](){return null}[oo](A,e){this[po].children.push(A)}[bo](){}[co]({filter:A=null,include:e=!0}){if(this[po].generator){const A=this[bo](),e=this[po].failingNode[dI](A);if(!e.success)return e;e.html&&this[oo](e.html,e.bbox),delete this[po].failingNode}else this[po].generator=this[ec](A,e);for(;;){const A=this[po].generator.next();if(A.done)break;const e=A.value;if(!e.success)return e;e.html&&this[oo](e.html,e.bbox)}return this[po].generator=null,MI.EMPTY}[hI](A){this[oc]=new Set(Object.keys(A))}[ic](A){const e=this[jI],t=this[oc];return[...A].filter((A=>e.has(A)&&!t.has(A)))}[cI](A,e=new Set){for(const t of this[zI])t[rc](A,e)}[rc](A,e){const t=this[tc](A,e);t?this[XI](t,A,e):this[cI](A,e)}[tc](A,e){const{use:t,usehref:i}=this;if(!t&&!i)return null;let a=null,s=null,n=null,g=t;if(i?(g=i,i.startsWith("#som(")&&i.endsWith(")")?s=i.slice(5,-1):i.startsWith(".#som(")&&i.endsWith(")")?s=i.slice(6,-1):i.startsWith("#")?n=i.slice(1):i.startsWith(".#")&&(n=i.slice(2))):t.startsWith("#")?n=t.slice(1):s=t,this.use=this.usehref="",n?a=A.get(n):(a=ZI(A.get(II),this,s,!0,!1),a&&(a=a[0])),!a)return S(`XFA - Invalid prototype reference: ${g}.`),null;if(a[eI]!==this[eI])return S(`XFA - Incompatible prototype: ${a[eI]} !== ${this[eI]}.`),null;if(e.has(a))return S("XFA - Cycle detected in prototypes use."),null;e.add(a);const r=a[tc](A,e);return r&&a[XI](r,A,e),a[cI](A,e),e.delete(a),a}[XI](A,e,t){if(t.has(A))S("XFA - Cycle detected in prototypes use.");else{!this[Eo]&&A[Eo]&&(this[Eo]=A[Eo]),new Set(t).add(A);for(const e of this[ic](A[oc]))this[e]=A[e],this[oc]&&this[oc].add(e);for(const i of Object.getOwnPropertyNames(this)){if(this[jI].has(i))continue;const a=this[i],s=A[i];if(a instanceof hc){for(const A of a[zI])A[rc](e,t);for(let i=a[zI].length,n=s[zI].length;iBc[_I](A))):"object"==typeof A&&null!==A?Object.assign({},A):A}[Qo](){const A=Object.create(Object.getPrototypeOf(this));for(const e of Object.getOwnPropertySymbols(this))try{A[e]=this[e]}catch{x(A,e,this[e])}A[mI]=`${A[eI]}${cc++}`,A[zI]=[];for(const e of Object.getOwnPropertyNames(this)){if(this[jI].has(e)){A[e]=Bc[_I](this[e]);continue}const t=this[e];A[e]=t instanceof hc?new hc(t[sc]):null}for(const e of this[zI]){const t=e[eI],i=e[Qo]();A[zI].push(i),i[gc]=A,null===A[t]?A[t]=i:A[t][zI].push(i)}return A}[xo](A=null){return A?this[zI].filter((e=>e[eI]===A)):this[zI]}[ko](A){return this[A]}[Fo](A,e,t=!0){return Array.from(this[So](A,e,t))}*[So](A,e,t=!0){if("parent"!==A){for(const t of this[zI])t[eI]===A&&(yield t),t.name===A&&(yield t),(e||t[zo]())&&(yield*t[So](A,e,!1));t&&this[jI].has(A)&&(yield new Qc(this,A,this[A]))}else yield this[gc]}}class hc{constructor(A=1/0){this[sc]=A,this[zI]=[]}get isXFAObject(){return!1}get isXFAObjectArray(){return!0}push(A){return this[zI].length<=this[sc]?(this[zI].push(A),!0):(S(`XFA - node "${A[eI]}" accepts no more than ${this[sc]} children`),!1)}isEmpty(){return 0===this[zI].length}dump(){return 1===this[zI].length?this[zI][0][fo]():this[zI].map((A=>A[fo]()))}[Qo](){const A=new hc(this[sc]);return A[zI]=this[zI].map((A=>A[Qo]())),A}get children(){return this[zI]}clear(){this[zI].length=0}}class Qc{constructor(A,e,t){this[gc]=A,this[eI]=e,this[Eo]=t,this[lo]=!1,this[mI]="attribute"+cc++}[Jo](){return this[gc]}[Zo](){return!0}[Ro](){return this[Eo].trim()}[QI](A){A=A.value||"",this[Eo]=A.toString()}[EI](){return this[Eo]}[Oo](A){return this[gc]===A||this[gc][Oo](A)}}class lc extends Bc{constructor(A,e,t={}){if(super(A,e),this[Eo]="",this[$I]=null,"#text"!==e){const A=new Map;this[VI]=A;for(const[e,i]of Object.entries(t))A.set(e,new Qc(this,e,i));if(t.hasOwnProperty(tI)){const A=t[tI].xfa.dataNode;void 0!==A&&("dataGroup"===A?this[$I]=!1:"dataValue"===A&&(this[$I]=!0))}}this[lo]=!1}[fI](A){const e=this[eI];if("#text"===e)return void A.push(ZA(this[Eo]));const t=_(e),i=this[AI]===Cc?"xfa:":"";A.push(`<${i}${t}`);for(const[e,t]of this[VI].entries()){const i=_(e);A.push(` ${i}="${ZA(t[Eo])}"`)}if(null!==this[$I]&&(this[$I]?A.push(' xfa:dataNode="dataValue"'):A.push(' xfa:dataNode="dataGroup"')),this[Eo]||0!==this[zI].length){if(A.push(">"),this[Eo])"string"==typeof this[Eo]?A.push(ZA(this[Eo])):this[Eo][fI](A);else for(const e of this[zI])e[fI](A);A.push(``)}else A.push("/>")}[iI](A){if(this[Eo]){const A=new lc(this[AI],"#text");this[Io](A),A[Eo]=this[Eo],this[Eo]=""}return this[Io](A),!0}[sI](A){this[Eo]+=A}[mo](){if(this[Eo]&&this[zI].length>0){const A=new lc(this[AI],"#text");this[Io](A),A[Eo]=this[Eo],delete this[Eo]}}[dI](){return"#text"===this[eI]?MI.success({name:"#text",value:this[Eo]}):MI.EMPTY}[xo](A=null){return A?this[zI].filter((e=>e[eI]===A)):this[zI]}[Do](){return this[VI]}[ko](A){const e=this[VI].get(A);return void 0!==e?e:this[xo](A)}*[So](A,e){const t=this[VI].get(A);t&&(yield t);for(const t of this[zI])t[eI]===A&&(yield t),e&&(yield*t[So](A,e))}*[wo](A,e){const t=this[VI].get(A);!t||e&&t[lo]||(yield t);for(const t of this[zI])yield*t[wo](A,e)}*[No](A,e,t){for(const i of this[zI])i[eI]!==A||t&&i[lo]||(yield i),e&&(yield*i[No](A,e,t))}[Zo](){return null===this[$I]?0===this[zI].length||this[zI][0][AI]===wI.xhtml.id:this[$I]}[Ro](){return null===this[$I]?0===this[zI].length?this[Eo].trim():this[zI][0][AI]===wI.xhtml.id?this[zI][0][EI]().trim():null:this[Eo].trim()}[QI](A){A=A.value||"",this[Eo]=A.toString()}[fo](A=!1){const e=Object.create(null);A&&(e.$ns=this[AI]),this[Eo]&&(e.$content=this[Eo]),e.$name=this[eI],e.children=[];for(const t of this[zI])e.children.push(t[fo](A));e.attributes=Object.create(null);for(const[A,t]of this[VI])e.attributes[A]=t[Eo];return e}}class Ec extends Bc{constructor(A,e){super(A,e),this[Eo]=""}[sI](A){this[Eo]+=A}[mo](){}}class uc extends Ec{constructor(A,e,t){super(A,e),this[nc]=t}[mo](){this[Eo]=RI({data:this[Eo],defaultValue:this[nc][0],validate:A=>this[nc].includes(A)})}[Co](A){super[Co](A),delete this[nc]}}class dc extends Ec{[mo](){this[Eo]=this[Eo].trim()}}class fc extends Ec{constructor(A,e,t,i){super(A,e),this[Ac]=t,this[Ic]=i}[mo](){this[Eo]=FI({data:this[Eo],defaultValue:this[Ac],validate:this[Ic]})}[Co](A){super[Co](A),delete this[Ac],delete this[Ic]}}class pc extends fc{constructor(A,e){super(A,e,0,(A=>1===A))}}class mc extends fc{constructor(A,e){super(A,e,1,(A=>0===A))}}function yc(A){return"string"==typeof A?"0px":Number.isInteger(A)?`${A}px`:`${A.toFixed(2)}px`}const wc={anchorType(A,e){const t=A[Lo]();if(t&&(!t.layout||"position"===t.layout))switch("transform"in e||(e.transform=""),A.anchorType){case"bottomCenter":e.transform+="translate(-50%, -100%)";break;case"bottomLeft":e.transform+="translate(0,-100%)";break;case"bottomRight":e.transform+="translate(-100%,-100%)";break;case"middleCenter":e.transform+="translate(-50%,-50%)";break;case"middleLeft":e.transform+="translate(0,-50%)";break;case"middleRight":e.transform+="translate(-100%,-50%)";break;case"topCenter":e.transform+="translate(-50%,0)";break;case"topRight":e.transform+="translate(-100%,0)"}},dimensions(A,e){const t=A[Lo]();let i=A.w;const a=A.h;if(t.layout?.includes("row")){const e=t[po],a=A.colSpan;let s;-1===a?(s=e.columnWidths.slice(e.currentColumn).reduce(((A,e)=>A+e),0),e.currentColumn=0):(s=e.columnWidths.slice(e.currentColumn,e.currentColumn+a).reduce(((A,e)=>A+e),0),e.currentColumn=(e.currentColumn+A.colSpan)%e.columnWidths.length),isNaN(s)||(i=A.w=s)}e.width=""!==i?yc(i):"auto",e.height=""!==a?yc(a):"auto"},position(A,e){const t=A[Lo]();t?.layout&&"position"!==t.layout||(e.position="absolute",e.left=yc(A.x),e.top=yc(A.y))},rotate(A,e){A.rotate&&("transform"in e||(e.transform=""),e.transform+=`rotate(-${A.rotate}deg)`,e.transformOrigin="top left")},presence(A,e){switch(A.presence){case"invisible":e.visibility="hidden";break;case"hidden":case"inactive":e.display="none"}},hAlign(A,e){if("para"===A[eI])switch(A.hAlign){case"justifyAll":e.textAlign="justify-all";break;case"radix":e.textAlign="left";break;default:e.textAlign=A.hAlign}else switch(A.hAlign){case"left":e.alignSelf="start";break;case"center":e.alignSelf="center";break;case"right":e.alignSelf="end"}},margin(A,e){A.margin&&(e.margin=A.margin[pI]().margin)}};function Dc(A,e){"position"===A[Lo]().layout&&(A.minW>0&&(e.minWidth=yc(A.minW)),A.maxW>0&&(e.maxWidth=yc(A.maxW)),A.minH>0&&(e.minHeight=yc(A.minH)),A.maxH>0&&(e.maxHeight=yc(A.maxH)))}function bc(A,e,t,i,a,s){const n=new vI(e,t,i,a);return"string"==typeof A?n.addString(A):A[nI](n),n.compute(s)}function kc(A,e){let t=null,i=null,a=!1;if((!A.w||!A.h)&&A.value){let s=0,n=0;A.margin&&(s=A.margin.leftInset+A.margin.rightInset,n=A.margin.topInset+A.margin.bottomInset);let g=null,r=null;A.para&&(r=Object.create(null),g=""===A.para.lineHeight?null:A.para.lineHeight,r.top=""===A.para.spaceAbove?0:A.para.spaceAbove,r.bottom=""===A.para.spaceBelow?0:A.para.spaceBelow,r.left=""===A.para.marginLeft?0:A.para.marginLeft,r.right=""===A.para.marginRight?0:A.para.marginRight);let o=A.font;if(!o){const e=A[Ho]();let t=A[Jo]();for(;t&&t!==e;){if(t.font){o=t.font;break}t=t[Jo]()}}const I=(A.w||e.width)-s,c=A[Yo].fontFinder;if(A.value.exData&&A.value.exData[Eo]&&"text/html"===A.value.exData.contentType){const e=bc(A.value.exData[Eo],o,r,g,c,I);i=e.width,t=e.height,a=e.isBroken}else{const e=A.value[EI]();if(e){const A=bc(e,o,r,g,c,I);i=A.width,t=A.height,a=A.isBroken}}null===i||A.w||(i+=s),null===t||A.h||(t+=n)}return{w:i,h:t,isBroken:a}}function Fc(A,e,t){let i;if(""!==A.w&&""!==A.h)i=[A.x,A.y,A.w,A.h];else{if(!t)return null;let a=A.w;if(""===a){if(0===A.maxW){const e=A[Lo]();a="position"===e.layout&&""!==e.w?0:A.minW}else a=Math.min(A.maxW,t.width);e.attributes.style.width=yc(a)}let s=A.h;if(""===s){if(0===A.maxH){const e=A[Lo]();s="position"===e.layout&&""!==e.h?0:A.minH}else s=Math.min(A.maxH,t.height);e.attributes.style.height=yc(s)}i=[A.x,A.y,a,s]}return i}function Sc(A){const e=A[Lo]();if(e.layout?.includes("row")){const t=e[po],i=A.colSpan;let a;a=-1===i?t.columnWidths.slice(t.currentColumn).reduce(((A,e)=>A+e),0):t.columnWidths.slice(t.currentColumn,t.currentColumn+i).reduce(((A,e)=>A+e),0),isNaN(a)||(A.w=a)}e.layout&&"position"!==e.layout&&(A.x=A.y=0),"table"===A.layout&&""===A.w&&Array.isArray(A.columnWidths)&&(A.w=A.columnWidths.reduce(((A,e)=>A+e),0))}function Rc(A){switch(A.layout){case"position":default:return"xfaPosition";case"lr-tb":return"xfaLrTb";case"rl-row":return"xfaRlRow";case"rl-tb":return"xfaRlTb";case"row":return"xfaRow";case"table":return"xfaTable";case"tb":return"xfaTb"}}function Gc(A,...e){const t=Object.create(null);for(const i of e){const e=A[i];if(null!==e)if(wc.hasOwnProperty(i))wc[i](A,t);else if(e instanceof Bc){const A=e[pI]();A?Object.assign(t,A):S(`(DEBUG) - XFA - style for ${i} not implemented yet`)}}return t}function Nc(A,e){const{attributes:t}=e,{style:i}=t,a={name:"div",attributes:{class:["xfaWrapper"],style:Object.create(null)},children:[]};if(t.class.push("xfaWrapped"),A.border){const{widths:t,insets:s}=A.border[po];let n,g,r=s[0],o=s[3];const I=s[0]+s[2],c=s[1]+s[3];switch(A.border.hand){case"even":r-=t[0]/2,o-=t[3]/2,n=`calc(100% + ${(t[1]+t[3])/2-c}px)`,g=`calc(100% + ${(t[0]+t[2])/2-I}px)`;break;case"left":r-=t[0],o-=t[3],n=`calc(100% + ${t[1]+t[3]-c}px)`,g=`calc(100% + ${t[0]+t[2]-I}px)`;break;case"right":n=c?`calc(100% - ${c}px)`:"100%",g=I?`calc(100% - ${I}px)`:"100%"}const C=["xfaBorder"];Mc(A.border)&&C.push("xfaPrintOnly");const B={name:"div",attributes:{class:C,style:{top:`${r}px`,left:`${o}px`,width:n,height:g}},children:[]};for(const A of["border","borderWidth","borderColor","borderRadius","borderStyle"])void 0!==i[A]&&(B.attributes.style[A]=i[A],delete i[A]);a.children.push(B,e)}else a.children.push(e);for(const A of["background","backgroundClip","top","left","width","height","minWidth","minHeight","maxWidth","maxHeight","transform","transformOrigin","visibility"])void 0!==i[A]&&(a.attributes.style[A]=i[A],delete i[A]);return a.attributes.style.position="absolute"===i.position?"absolute":"relative",delete i.position,i.alignSelf&&(a.attributes.style.alignSelf=i.alignSelf,delete i.alignSelf),a}function xc(A){const e=NI(A.textIndent,"0px");if(e>=0)return;const t="padding"+("left"==("right"===A.textAlign?"right":"left")?"Left":"Right"),i=NI(A[t],"0px");A[t]=i-e+"px"}function Uc(A,e){switch(A.access){case"nonInteractive":e.push("xfaNonInteractive");break;case"readOnly":e.push("xfaReadOnly");break;case"protected":e.push("xfaDisabled")}}function Mc(A){return A.relevant.length>0&&!A.relevant[0].excluded&&"print"===A.relevant[0].viewname}function Lc(A){const e=A[Ho]()[po].paraStack;return e.length?e.at(-1):null}function Jc(A,e,t){if(t.attributes.class?.includes("xfaRich")){e&&(""===A.h&&(e.height="auto"),""===A.w&&(e.width="auto"));const i=Lc(A);if(i){const A=t.attributes.style;switch(A.display="flex",A.flexDirection="column",i.vAlign){case"top":A.justifyContent="start";break;case"bottom":A.justifyContent="end";break;case"middle":A.justifyContent="center"}const e=i[pI]();for(const[t,i]of Object.entries(e))t in A||(A[t]=i)}}}function Hc(A,e,t,i){if(!t)return void delete i.fontFamily;const a=kI(A.typeface);i.fontFamily=`"${a}"`;const s=t.find(a);if(s){const{fontFamily:t}=s.regular.cssFontInfo;t!==a&&(i.fontFamily=`"${t}"`);const n=Lc(e);if(n&&""!==n.lineHeight)return;if(i.lineHeight)return;const g=JI(A,s);g&&(i.lineHeight=Math.max(1.2,g.lineHeight))}}function Yc(A){const e=N(A,null,{addDefaultProtocol:!0,tryConvertEncoding:!0});return e?e.href:null}function vc(A,e){return{name:"div",attributes:{class:["lr-tb"===A.layout?"xfaLr":"xfaRl"]},children:e}}function Kc(A){if(!A[po])return null;const e={name:"div",attributes:A[po].attributes,children:A[po].children};if(A[po].failingNode){const t=A[po].failingNode[yo]();t&&(A.layout.endsWith("-tb")?e.children.push(vc(A,[t])):e.children.push(t))}return 0===e.children.length?null:e}function qc(A,e,t){const i=A[po],a=i.availableSpace,[s,n,g,r]=t;switch(A.layout){case"position":i.width=Math.max(i.width,s+g),i.height=Math.max(i.height,n+r),i.children.push(e);break;case"lr-tb":case"rl-tb":i.line&&1!==i.attempt||(i.line=vc(A,[]),i.children.push(i.line),i.numberInLine=0),i.numberInLine+=1,i.line.children.push(e),0===i.attempt?(i.currentWidth+=g,i.height=Math.max(i.height,i.prevHeight+r)):(i.currentWidth=g,i.prevHeight=i.height,i.height+=r,i.attempt=0),i.width=Math.max(i.width,i.currentWidth);break;case"rl-row":case"row":{i.children.push(e),i.width+=g,i.height=Math.max(i.height,r);const A=yc(i.height);for(const e of i.children)e.attributes.style.height=A;break}case"table":case"tb":i.width=Math.min(a.width,Math.max(i.width,g)),i.height+=r,i.children.push(e)}}function Tc(A){const e=A[po].availableSpace,t=A.margin?A.margin.topInset+A.margin.bottomInset:0,i=A.margin?A.margin.leftInset+A.margin.rightInset:0;switch(A.layout){case"lr-tb":case"rl-tb":return 0===A[po].attempt?{width:e.width-i-A[po].currentWidth,height:e.height-t-A[po].prevHeight}:{width:e.width-i,height:e.height-t-A[po].height};case"rl-row":case"row":return{width:A[po].columnWidths.slice(A[po].currentColumn).reduce(((A,e)=>A+e)),height:e.height-i};case"table":case"tb":return{width:e.width-i,height:e.height-t-A[po].height};default:return e}}function Pc(A,e){if(null===A[Ho]()[po].firstUnsplittable)return!0;if(0===A.w||0===A.h)return!0;const t=A[Lo](),i=t[po]?.attempt||0,[,a,s,n]=function(A){let e,t,i=""===A.w?NaN:A.w,a=""===A.h?NaN:A.h,[s,n]=[0,0];switch(A.anchorType||""){case"bottomCenter":[s,n]=[i/2,a];break;case"bottomLeft":[s,n]=[0,a];break;case"bottomRight":[s,n]=[i,a];break;case"middleCenter":[s,n]=[i/2,a/2];break;case"middleLeft":[s,n]=[0,a/2];break;case"middleRight":[s,n]=[i,a/2];break;case"topCenter":[s,n]=[i/2,0];break;case"topRight":[s,n]=[i,0]}switch(A.rotate||0){case 0:[e,t]=[-s,-n];break;case 90:[e,t]=[-n,s],[i,a]=[a,-i];break;case 180:[e,t]=[s,n],[i,a]=[-i,-a];break;case 270:[e,t]=[n,-s],[i,a]=[-a,i]}return[A.x+e+Math.min(0,i),A.y+t+Math.min(0,a),Math.abs(i),Math.abs(a)]}(A);switch(t.layout){case"lr-tb":case"rl-tb":return 0===i?A[Ho]()[po].noLayoutFailure?""!==A.w?Math.round(s-e.width)<=2:e.width>2:!(""!==A.h&&Math.round(n-e.height)>2)&&(""!==A.w?Math.round(s-e.width)<=2||0===t[po].numberInLine&&e.height>2:e.width>2):!!A[Ho]()[po].noLayoutFailure||!(""!==A.h&&Math.round(n-e.height)>2)&&(""===A.w||Math.round(s-e.width)<=2||!t[jo]())&&e.height>2;case"table":case"tb":return!!A[Ho]()[po].noLayoutFailure||(""===A.h||A[Vo]()?(""===A.w||Math.round(s-e.width)<=2||!t[jo]())&&e.height>2:Math.round(n-e.height)<=2);case"position":return!!A[Ho]()[po].noLayoutFailure||(""===A.h||Math.round(n+a-e.height)<=2||n+a>A[Ho]()[po].currentContentArea.h);case"rl-row":case"row":return!!A[Ho]()[po].noLayoutFailure||""===A.h||Math.round(n-e.height)<=2;default:return!0}}const Wc=wI.template.id,Zc="http://www.w3.org/2000/svg",Oc=/^H(\d+)$/,Xc=new Set(["image/gif","image/jpeg","image/jpg","image/pjpeg","image/png","image/apng","image/x-png","image/bmp","image/x-ms-bmp","image/tiff","image/tif","application/octet-stream"]),Vc=[[[66,77],"image/bmp"],[[255,216,255],"image/jpeg"],[[73,73,42,0],"image/tiff"],[[77,77,0,42],"image/tiff"],[[71,73,70,56,57,97],"image/gif"],[[137,80,78,71,13,10,26,10],"image/png"]];function jc(A){if(!A||!A.border)return{w:0,h:0};const e=A.border[Go]();return e?{w:e.widths[0]+e.widths[2]+e.insets[0]+e.insets[2],h:e.widths[1]+e.widths[3]+e.insets[1]+e.insets[3]}:{w:0,h:0}}function zc(A){return A.margin&&(A.margin.topInset||A.margin.rightInset||A.margin.bottomInset||A.margin.leftInset)}function _c(A,e){if(!A.value){const e=new Ch({});A[Io](e),A.value=e}A.value[QI](e)}function*$c(A){for(const e of A[xo]())e instanceof _B?yield*e[Uo]():yield e}function AC(A){return"error"===A.validate?.nullTest}function eC(A){for(;A;){if(!A.traversal)return void(A[lI]=A[Jo]()[lI]);if(A[lI])return;let e=null;for(const t of A.traversal[xo]())if("next"===t.operation){e=t;break}if(!e||!e.ref)return void(A[lI]=A[Jo]()[lI]);const t=A[Ho]();A[lI]=++t[lI];const i=t[CI](e.ref,A);if(!i)return;A=i[0]}}function tC(A,e){const t=A.assist;if(t){const A=t[dI]();A&&(e.title=A);const i=t.role.match(Oc);if(i){const A="heading",t=i[1];e.role=A,e["aria-level"]=t}}if("table"===A.layout)e.role="table";else if("row"===A.layout)e.role="row";else{const t=A[Jo]();"row"===t.layout&&(e.role="TH"===t.assist?.role?"columnheader":"cell")}}function iC(A){if(!A.assist)return null;const e=A.assist;return e.speak&&""!==e.speak[Eo]?e.speak[Eo]:e.toolTip?e.toolTip[Eo]:null}function aC(A){return MI.success({name:"div",attributes:{class:["xfaRich"],style:Object.create(null)},children:[{name:"span",attributes:{style:Object.create(null)},value:A}]})}function sC(A){const e=A[Ho]();null===e[po].firstUnsplittable&&(e[po].firstUnsplittable=A,e[po].noLayoutFailure=!0)}function nC(A){const e=A[Ho]();e[po].firstUnsplittable===A&&(e[po].noLayoutFailure=!1)}function gC(A){if(A[po])return!1;if(A[po]=Object.create(null),"auto"===A.targetType)return!1;const e=A[Ho]();let t=null;if(A.target){if(t=e[CI](A.target,A[Jo]()),!t)return!1;t=t[0]}const{currentPageArea:i,currentContentArea:a}=e[po];if("pageArea"===A.targetType)return t instanceof GB||(t=null),A.startNew?(A[po].target=t||i,!0):!(!t||t===i||(A[po].target=t,0));t instanceof NC||(t=null);const s=t&&t[Jo]();let n,g=s;if(A.startNew)if(t){const A=s.contentArea.children,e=A.indexOf(a),i=A.indexOf(t);-1!==e&&eA,i[po].noLayoutFailure=!0;const n=e[dI](t);A[oo](n.html,n.bbox),i[po].noLayoutFailure=a,e[Lo]=s}class oC extends dc{constructor(A){super(Wc,"appearanceFilter"),this.id=A.id||"",this.type=GI(A.type,["optional","required"]),this.use=A.use||"",this.usehref=A.usehref||""}}class IC extends Bc{constructor(A){super(Wc,"arc",!0),this.circular=FI({data:A.circular,defaultValue:0,validate:A=>1===A}),this.hand=GI(A.hand,["even","left","right"]),this.id=A.id||"",this.startAngle=SI({data:A.startAngle,defaultValue:0,validate:A=>!0}),this.sweepAngle=SI({data:A.sweepAngle,defaultValue:360,validate:A=>!0}),this.use=A.use||"",this.usehref=A.usehref||"",this.edge=null,this.fill=null}[dI](){const A=this.edge||new TC({}),e=A[pI](),t=Object.create(null);let i;"visible"===this.fill?.presence?Object.assign(t,this.fill[pI]()):t.fill="transparent",t.strokeWidth=yc("visible"===A.presence?A.thickness:0),t.stroke=e.color;const a={xmlns:Zc,style:{width:"100%",height:"100%",overflow:"visible"}};if(360===this.sweepAngle)i={name:"ellipse",attributes:{xmlns:Zc,cx:"50%",cy:"50%",rx:"50%",ry:"50%",style:t}};else{const A=this.startAngle*Math.PI/180,e=this.sweepAngle*Math.PI/180,s=this.sweepAngle>180?1:0,[n,g,r,o]=[50*(1+Math.cos(A)),50*(1-Math.sin(A)),50*(1+Math.cos(A+e)),50*(1-Math.sin(A+e))];i={name:"path",attributes:{xmlns:Zc,d:`M ${n} ${g} A 50 50 0 ${s} 0 ${r} ${o}`,vectorEffect:"non-scaling-stroke",style:t}},Object.assign(a,{viewBox:"0 0 100 100",preserveAspectRatio:"none"})}const s={name:"svg",children:[i],attributes:a};return zc(this[Jo]()[Jo]())?MI.success({name:"div",attributes:{style:{display:"inline",width:"100%",height:"100%"}},children:[s]}):(s.attributes.style.position="absolute",MI.success(s))}}class cC extends Bc{constructor(A){super(Wc,"area",!0),this.colSpan=FI({data:A.colSpan,defaultValue:1,validate:A=>A>=1||-1===A}),this.id=A.id||"",this.name=A.name||"",this.relevant=UI(A.relevant),this.use=A.use||"",this.usehref=A.usehref||"",this.x=NI(A.x,"0pt"),this.y=NI(A.y,"0pt"),this.desc=null,this.extras=null,this.area=new hc,this.draw=new hc,this.exObject=new hc,this.exclGroup=new hc,this.field=new hc,this.subform=new hc,this.subformSet=new hc}*[Uo](){yield*$c(this)}[zo](){return!0}[Wo](){return!0}[oo](A,e){const[t,i,a,s]=e;this[po].width=Math.max(this[po].width,t+a),this[po].height=Math.max(this[po].height,i+s),this[po].children.push(A)}[bo](){return this[po].availableSpace}[dI](A){const e=Gc(this,"position"),t={style:e,id:this[mI],class:["xfaArea"]};Mc(this)&&t.class.push("xfaPrintOnly"),this.name&&(t.xfaName=this.name);const i=[];this[po]={children:i,width:0,height:0,availableSpace:A};const a=this[co]({filter:new Set(["area","draw","field","exclGroup","subform","subformSet"]),include:!0});if(!a.success)return a.isBreak()?a:(delete this[po],MI.FAILURE);e.width=yc(this[po].width),e.height=yc(this[po].height);const s={name:"div",attributes:t,children:i},n=[this.x,this.y,this[po].width,this[po].height];return delete this[po],MI.success(s,n)}}class CC extends Bc{constructor(A){super(Wc,"assist",!0),this.id=A.id||"",this.role=A.role||"",this.use=A.use||"",this.usehref=A.usehref||"",this.speak=null,this.toolTip=null}[dI](){return this.toolTip?.[Eo]||null}}class BC extends Bc{constructor(A){super(Wc,"barcode",!0),this.charEncoding=RI({data:A.charEncoding?A.charEncoding.toLowerCase():"",defaultValue:"",validate:A=>["utf-8","big-five","fontspecific","gbk","gb-18030","gb-2312","ksc-5601","none","shift-jis","ucs-2","utf-16"].includes(A)||A.match(/iso-8859-\d{2}/)}),this.checksum=GI(A.checksum,["none","1mod10","1mod10_1mod11","2mod10","auto"]),this.dataColumnCount=FI({data:A.dataColumnCount,defaultValue:-1,validate:A=>A>=0}),this.dataLength=FI({data:A.dataLength,defaultValue:-1,validate:A=>A>=0}),this.dataPrep=GI(A.dataPrep,["none","flateCompress"]),this.dataRowCount=FI({data:A.dataRowCount,defaultValue:-1,validate:A=>A>=0}),this.endChar=A.endChar||"",this.errorCorrectionLevel=FI({data:A.errorCorrectionLevel,defaultValue:-1,validate:A=>A>=0&&A<=8}),this.id=A.id||"",this.moduleHeight=NI(A.moduleHeight,"5mm"),this.moduleWidth=NI(A.moduleWidth,"0.25mm"),this.printCheckDigit=FI({data:A.printCheckDigit,defaultValue:0,validate:A=>1===A}),this.rowColumnRatio=xI(A.rowColumnRatio),this.startChar=A.startChar||"",this.textLocation=GI(A.textLocation,["below","above","aboveEmbedded","belowEmbedded","none"]),this.truncate=FI({data:A.truncate,defaultValue:0,validate:A=>1===A}),this.type=GI(A.type?A.type.toLowerCase():"",["aztec","codabar","code2of5industrial","code2of5interleaved","code2of5matrix","code2of5standard","code3of9","code3of9extended","code11","code49","code93","code128","code128a","code128b","code128c","code128sscc","datamatrix","ean8","ean8add2","ean8add5","ean13","ean13add2","ean13add5","ean13pwcd","fim","logmars","maxicode","msi","pdf417","pdf417macro","plessey","postauscust2","postauscust3","postausreplypaid","postausstandard","postukrm4scc","postusdpbc","postusimb","postusstandard","postus5zip","qrcode","rfid","rss14","rss14expanded","rss14limited","rss14stacked","rss14stackedomni","rss14truncated","telepen","ucc128","ucc128random","ucc128sscc","upca","upcaadd2","upcaadd5","upcapwcd","upce","upceadd2","upceadd5","upcean2","upcean5","upsmaxicode"]),this.upsMode=GI(A.upsMode,["usCarrier","internationalCarrier","secureSymbol","standardSymbol"]),this.use=A.use||"",this.usehref=A.usehref||"",this.wideNarrowRatio=xI(A.wideNarrowRatio),this.encrypt=null,this.extras=null}}class hC extends Bc{constructor(A){super(Wc,"bind",!0),this.match=GI(A.match,["once","dataRef","global","none"]),this.ref=A.ref||"",this.picture=null}}class QC extends Bc{constructor(A){super(Wc,"bindItems"),this.connection=A.connection||"",this.labelRef=A.labelRef||"",this.ref=A.ref||"",this.valueRef=A.valueRef||""}}class lC extends Bc{constructor(A){super(Wc,"bookend"),this.id=A.id||"",this.leader=A.leader||"",this.trailer=A.trailer||"",this.use=A.use||"",this.usehref=A.usehref||""}}class EC extends pc{constructor(A){super(Wc,"boolean"),this.id=A.id||"",this.name=A.name||"",this.use=A.use||"",this.usehref=A.usehref||""}[dI](A){return aC(1===this[Eo]?"1":"0")}}class uC extends Bc{constructor(A){super(Wc,"border",!0),this.break=GI(A.break,["close","open"]),this.hand=GI(A.hand,["even","left","right"]),this.id=A.id||"",this.presence=GI(A.presence,["visible","hidden","inactive","invisible"]),this.relevant=UI(A.relevant),this.use=A.use||"",this.usehref=A.usehref||"",this.corner=new hc(4),this.edge=new hc(4),this.extras=null,this.fill=null,this.margin=null}[Go](){if(!this[po]){const A=this.edge.children.slice();if(A.length<4){const e=A.at(-1)||new TC({});for(let t=A.length;t<4;t++)A.push(e)}const e=A.map((A=>A.thickness)),t=[0,0,0,0];this.margin&&(t[0]=this.margin.topInset,t[1]=this.margin.rightInset,t[2]=this.margin.bottomInset,t[3]=this.margin.leftInset),this[po]={widths:e,insets:t,edges:A}}return this[po]}[pI](){const{edges:A}=this[Go](),e=A.map((A=>{const e=A[pI]();return e.color||="#000000",e})),t=Object.create(null);if(this.margin&&Object.assign(t,this.margin[pI]()),"visible"===this.fill?.presence&&Object.assign(t,this.fill[pI]()),this.corner.children.some((A=>0!==A.radius))){const A=this.corner.children.map((A=>A[pI]()));if(2===A.length||3===A.length){const e=A.at(-1);for(let t=A.length;t<4;t++)A.push(e)}t.borderRadius=A.map((A=>A.radius)).join(" ")}switch(this.presence){case"invisible":case"hidden":t.borderStyle="";break;case"inactive":t.borderStyle="none";break;default:t.borderStyle=e.map((A=>A.style)).join(" ")}return t.borderWidth=e.map((A=>A.width)).join(" "),t.borderColor=e.map((A=>A.color)).join(" "),t}}class dC extends Bc{constructor(A){super(Wc,"break",!0),this.after=GI(A.after,["auto","contentArea","pageArea","pageEven","pageOdd"]),this.afterTarget=A.afterTarget||"",this.before=GI(A.before,["auto","contentArea","pageArea","pageEven","pageOdd"]),this.beforeTarget=A.beforeTarget||"",this.bookendLeader=A.bookendLeader||"",this.bookendTrailer=A.bookendTrailer||"",this.id=A.id||"",this.overflowLeader=A.overflowLeader||"",this.overflowTarget=A.overflowTarget||"",this.overflowTrailer=A.overflowTrailer||"",this.startNew=FI({data:A.startNew,defaultValue:0,validate:A=>1===A}),this.use=A.use||"",this.usehref=A.usehref||"",this.extras=null}}class fC extends Bc{constructor(A){super(Wc,"breakAfter",!0),this.id=A.id||"",this.leader=A.leader||"",this.startNew=FI({data:A.startNew,defaultValue:0,validate:A=>1===A}),this.target=A.target||"",this.targetType=GI(A.targetType,["auto","contentArea","pageArea"]),this.trailer=A.trailer||"",this.use=A.use||"",this.usehref=A.usehref||"",this.script=null}}class pC extends Bc{constructor(A){super(Wc,"breakBefore",!0),this.id=A.id||"",this.leader=A.leader||"",this.startNew=FI({data:A.startNew,defaultValue:0,validate:A=>1===A}),this.target=A.target||"",this.targetType=GI(A.targetType,["auto","contentArea","pageArea"]),this.trailer=A.trailer||"",this.use=A.use||"",this.usehref=A.usehref||"",this.script=null}[dI](A){return this[po]={},MI.FAILURE}}class mC extends Bc{constructor(A){super(Wc,"button",!0),this.highlight=GI(A.highlight,["inverted","none","outline","push"]),this.id=A.id||"",this.use=A.use||"",this.usehref=A.usehref||"",this.extras=null}[dI](A){const e=this[Jo]()[Jo](),t={name:"button",attributes:{id:this[mI],class:["xfaButton"],style:{}},children:[]};for(const A of e.event.children){if("click"!==A.activity||!A.script)continue;const e=VA(A.script[Eo]);if(!e)continue;const i=Yc(e.url);i&&t.children.push({name:"a",attributes:{id:"link"+this[mI],href:i,newWindow:e.newWindow,class:["xfaLink"],style:{}},children:[]})}return MI.success(t)}}class yC extends Bc{constructor(A){super(Wc,"calculate",!0),this.id=A.id||"",this.override=GI(A.override,["disabled","error","ignore","warning"]),this.use=A.use||"",this.usehref=A.usehref||"",this.extras=null,this.message=null,this.script=null}}class wC extends Bc{constructor(A){super(Wc,"caption",!0),this.id=A.id||"",this.placement=GI(A.placement,["left","bottom","inline","right","top"]),this.presence=GI(A.presence,["visible","hidden","inactive","invisible"]),this.reserve=Math.ceil(NI(A.reserve)),this.use=A.use||"",this.usehref=A.usehref||"",this.extras=null,this.font=null,this.margin=null,this.para=null,this.value=null}[QI](A){_c(this,A)}[Go](A){if(!this[po]){let{width:e,height:t}=A;switch(this.placement){case"left":case"right":case"inline":e=this.reserve<=0?e:this.reserve;break;case"top":case"bottom":t=this.reserve<=0?t:this.reserve}this[po]=kc(this,{width:e,height:t})}return this[po]}[dI](A){if(!this.value)return MI.EMPTY;this[rI]();const e=this.value[dI](A).html;if(!e)return this[gI](),MI.EMPTY;const t=this.reserve;if(this.reserve<=0){const{w:e,h:t}=this[Go](A);switch(this.placement){case"left":case"right":case"inline":this.reserve=e;break;case"top":case"bottom":this.reserve=t}}const i=[];"string"==typeof e?i.push({name:"#text",value:e}):i.push(e);const a=Gc(this,"font","margin","visibility");switch(this.placement){case"left":case"right":this.reserve>0&&(a.width=yc(this.reserve));break;case"top":case"bottom":this.reserve>0&&(a.height=yc(this.reserve))}return Jc(this,null,e),this[gI](),this.reserve=t,MI.success({name:"div",attributes:{style:a,class:["xfaCaption"]},children:i})}}class DC extends dc{constructor(A){super(Wc,"certificate"),this.id=A.id||"",this.name=A.name||"",this.use=A.use||"",this.usehref=A.usehref||""}}class bC extends Bc{constructor(A){super(Wc,"certificates",!0),this.credentialServerPolicy=GI(A.credentialServerPolicy,["optional","required"]),this.id=A.id||"",this.url=A.url||"",this.urlPolicy=A.urlPolicy||"",this.use=A.use||"",this.usehref=A.usehref||"",this.encryption=null,this.issuers=null,this.keyUsage=null,this.oids=null,this.signing=null,this.subjectDNs=null}}class kC extends Bc{constructor(A){super(Wc,"checkButton",!0),this.id=A.id||"",this.mark=GI(A.mark,["default","check","circle","cross","diamond","square","star"]),this.shape=GI(A.shape,["square","round"]),this.size=NI(A.size,"10pt"),this.use=A.use||"",this.usehref=A.usehref||"",this.border=null,this.extras=null,this.margin=null}[dI](A){const e=Gc("margin"),t=yc(this.size);let i,a,s;e.width=e.height=t;const n=this[Jo]()[Jo](),g=n.items.children.length&&n.items.children[0][dI]().html||[],r={on:(void 0!==g[0]?g[0]:"on").toString(),off:(void 0!==g[1]?g[1]:"off").toString()},o=(n.value?.[EI]()||"off")===r.on||void 0,I=n[Lo](),c=n[mI];let C;I instanceof AB?(s=I[mI],i="radio",a="xfaRadio",C=I[uo]?.[mI]||I[mI]):(i="checkbox",a="xfaCheckbox",C=n[uo]?.[mI]||n[mI]);const B={name:"input",attributes:{class:[a],style:e,fieldId:c,dataId:C,type:i,checked:o,xfaOn:r.on,xfaOff:r.off,"aria-label":iC(n),"aria-required":!1}};return s&&(B.attributes.name=s),AC(n)&&(B.attributes["aria-required"]=!0,B.attributes.required=!0),MI.success({name:"label",attributes:{class:["xfaLabel"]},children:[B]})}}class FC extends Bc{constructor(A){super(Wc,"choiceList",!0),this.commitOn=GI(A.commitOn,["select","exit"]),this.id=A.id||"",this.open=GI(A.open,["userControl","always","multiSelect","onEntry"]),this.textEntry=FI({data:A.textEntry,defaultValue:0,validate:A=>1===A}),this.use=A.use||"",this.usehref=A.usehref||"",this.border=null,this.extras=null,this.margin=null}[dI](A){const e=Gc(this,"border","margin"),t=this[Jo]()[Jo](),i={fontSize:`calc(${t.font?.size||10}px * var(--scale-factor))`},a=[];if(t.items.children.length>0){const A=t.items;let e=0,s=0;2===A.children.length&&(e=A.children[0].save,s=1-e);const n=A.children[e][dI]().html,g=A.children[s][dI]().html;let r=!1;const o=t.value?.[EI]()||"";for(let A=0,e=n.length;AMath.min(Math.max(0,parseInt(A.trim(),10)),255))).map((A=>isNaN(A)?0:A));return s.length<3||([t,i,a]=s),{r:t,g:i,b:a}}(A.value):"",this.extras=null}[vo](){return!1}[pI](){return this.value?X.makeHexColor(this.value.r,this.value.g,this.value.b):null}}class RC extends Bc{constructor(A){super(Wc,"comb"),this.id=A.id||"",this.numberOfCells=FI({data:A.numberOfCells,defaultValue:0,validate:A=>A>=0}),this.use=A.use||"",this.usehref=A.usehref||""}}class GC extends Bc{constructor(A){super(Wc,"connect",!0),this.connection=A.connection||"",this.id=A.id||"",this.ref=A.ref||"",this.usage=GI(A.usage,["exportAndImport","exportOnly","importOnly"]),this.use=A.use||"",this.usehref=A.usehref||"",this.picture=null}}class NC extends Bc{constructor(A){super(Wc,"contentArea",!0),this.h=NI(A.h),this.id=A.id||"",this.name=A.name||"",this.relevant=UI(A.relevant),this.use=A.use||"",this.usehref=A.usehref||"",this.w=NI(A.w),this.x=NI(A.x,"0pt"),this.y=NI(A.y,"0pt"),this.desc=null,this.extras=null}[dI](A){const e={left:yc(this.x),top:yc(this.y),width:yc(this.w),height:yc(this.h)},t=["xfaContentarea"];return Mc(this)&&t.push("xfaPrintOnly"),MI.success({name:"div",children:[],attributes:{style:e,class:t,id:this[mI]}})}}class xC extends Bc{constructor(A){super(Wc,"corner",!0),this.id=A.id||"",this.inverted=FI({data:A.inverted,defaultValue:0,validate:A=>1===A}),this.join=GI(A.join,["square","round"]),this.presence=GI(A.presence,["visible","hidden","inactive","invisible"]),this.radius=NI(A.radius),this.stroke=GI(A.stroke,["solid","dashDot","dashDotDot","dashed","dotted","embossed","etched","lowered","raised"]),this.thickness=NI(A.thickness,"0.5pt"),this.use=A.use||"",this.usehref=A.usehref||"",this.color=null,this.extras=null}[pI](){const A=Gc(this,"visibility");return A.radius=yc("square"===this.join?0:this.radius),A}}class UC extends Ec{constructor(A){super(Wc,"date"),this.id=A.id||"",this.name=A.name||"",this.use=A.use||"",this.usehref=A.usehref||""}[mo](){const A=this[Eo].trim();this[Eo]=A?new Date(A):null}[dI](A){return aC(this[Eo]?this[Eo].toString():"")}}class MC extends Ec{constructor(A){super(Wc,"dateTime"),this.id=A.id||"",this.name=A.name||"",this.use=A.use||"",this.usehref=A.usehref||""}[mo](){const A=this[Eo].trim();this[Eo]=A?new Date(A):null}[dI](A){return aC(this[Eo]?this[Eo].toString():"")}}class LC extends Bc{constructor(A){super(Wc,"dateTimeEdit",!0),this.hScrollPolicy=GI(A.hScrollPolicy,["auto","off","on"]),this.id=A.id||"",this.picker=GI(A.picker,["host","none"]),this.use=A.use||"",this.usehref=A.usehref||"",this.border=null,this.comb=null,this.extras=null,this.margin=null}[dI](A){const e=Gc(this,"border","font","margin"),t=this[Jo]()[Jo](),i={name:"input",attributes:{type:"text",fieldId:t[mI],dataId:t[uo]?.[mI]||t[mI],class:["xfaTextfield"],style:e,"aria-label":iC(t),"aria-required":!1}};return AC(t)&&(i.attributes["aria-required"]=!0,i.attributes.required=!0),MI.success({name:"label",attributes:{class:["xfaLabel"]},children:[i]})}}class JC extends Ec{constructor(A){super(Wc,"decimal"),this.fracDigits=FI({data:A.fracDigits,defaultValue:2,validate:A=>!0}),this.id=A.id||"",this.leadDigits=FI({data:A.leadDigits,defaultValue:-1,validate:A=>!0}),this.name=A.name||"",this.use=A.use||"",this.usehref=A.usehref||""}[mo](){const A=parseFloat(this[Eo].trim());this[Eo]=isNaN(A)?null:A}[dI](A){return aC(null!==this[Eo]?this[Eo].toString():"")}}class HC extends Bc{constructor(A){super(Wc,"defaultUi",!0),this.id=A.id||"",this.use=A.use||"",this.usehref=A.usehref||"",this.extras=null}}class YC extends Bc{constructor(A){super(Wc,"desc",!0),this.id=A.id||"",this.use=A.use||"",this.usehref=A.usehref||"",this.boolean=new hc,this.date=new hc,this.dateTime=new hc,this.decimal=new hc,this.exData=new hc,this.float=new hc,this.image=new hc,this.integer=new hc,this.text=new hc,this.time=new hc}}class vC extends uc{constructor(A){super(Wc,"digestMethod",["","SHA1","SHA256","SHA512","RIPEMD160"]),this.id=A.id||"",this.use=A.use||"",this.usehref=A.usehref||""}}class KC extends Bc{constructor(A){super(Wc,"digestMethods",!0),this.id=A.id||"",this.type=GI(A.type,["optional","required"]),this.use=A.use||"",this.usehref=A.usehref||"",this.digestMethod=new hc}}class qC extends Bc{constructor(A){super(Wc,"draw",!0),this.anchorType=GI(A.anchorType,["topLeft","bottomCenter","bottomLeft","bottomRight","middleCenter","middleLeft","middleRight","topCenter","topRight"]),this.colSpan=FI({data:A.colSpan,defaultValue:1,validate:A=>A>=1||-1===A}),this.h=A.h?NI(A.h):"",this.hAlign=GI(A.hAlign,["left","center","justify","justifyAll","radix","right"]),this.id=A.id||"",this.locale=A.locale||"",this.maxH=NI(A.maxH,"0pt"),this.maxW=NI(A.maxW,"0pt"),this.minH=NI(A.minH,"0pt"),this.minW=NI(A.minW,"0pt"),this.name=A.name||"",this.presence=GI(A.presence,["visible","hidden","inactive","invisible"]),this.relevant=UI(A.relevant),this.rotate=FI({data:A.rotate,defaultValue:0,validate:A=>A%90==0}),this.use=A.use||"",this.usehref=A.usehref||"",this.w=A.w?NI(A.w):"",this.x=NI(A.x,"0pt"),this.y=NI(A.y,"0pt"),this.assist=null,this.border=null,this.caption=null,this.desc=null,this.extras=null,this.font=null,this.keep=null,this.margin=null,this.para=null,this.traversal=null,this.ui=null,this.value=null,this.setProperty=new hc}[QI](A){_c(this,A)}[dI](A){if(eC(this),"hidden"===this.presence||"inactive"===this.presence)return MI.EMPTY;Sc(this),this[rI]();const e=this.w,t=this.h,{w:i,h:a,isBroken:s}=kc(this,A);if(i&&""===this.w){if(s&&this[Lo]()[jo]())return this[gI](),MI.FAILURE;this.w=i}if(a&&""===this.h&&(this.h=a),sC(this),!Pc(this,A))return this.w=e,this.h=t,this[gI](),MI.FAILURE;nC(this);const n=Gc(this,"font","hAlign","dimensions","position","presence","rotate","anchorType","border","margin");Dc(this,n),n.margin&&(n.padding=n.margin,delete n.margin);const g=["xfaDraw"];this.font&&g.push("xfaFont"),Mc(this)&&g.push("xfaPrintOnly");const r={style:n,id:this[mI],class:g};this.name&&(r.xfaName=this.name);const o={name:"div",attributes:r,children:[]};tC(this,r);const I=Fc(this,o,A),c=this.value?this.value[dI](A).html:null;return null===c?(this.w=e,this.h=t,this[gI](),MI.success(Nc(this,o),I)):(o.children.push(c),Jc(this,n,c),this.w=e,this.h=t,this[gI](),MI.success(Nc(this,o),I))}}class TC extends Bc{constructor(A){super(Wc,"edge",!0),this.cap=GI(A.cap,["square","butt","round"]),this.id=A.id||"",this.presence=GI(A.presence,["visible","hidden","inactive","invisible"]),this.stroke=GI(A.stroke,["solid","dashDot","dashDotDot","dashed","dotted","embossed","etched","lowered","raised"]),this.thickness=NI(A.thickness,"0.5pt"),this.use=A.use||"",this.usehref=A.usehref||"",this.color=null,this.extras=null}[pI](){const A=Gc(this,"visibility");if(Object.assign(A,{linecap:this.cap,width:yc(this.thickness),color:this.color?this.color[pI]():"#000000",style:""}),"visible"!==this.presence)A.style="none";else switch(this.stroke){case"solid":A.style="solid";break;case"dashDot":case"dashDotDot":case"dashed":A.style="dashed";break;case"dotted":A.style="dotted";break;case"embossed":A.style="ridge";break;case"etched":A.style="groove";break;case"lowered":A.style="inset";break;case"raised":A.style="outset"}return A}}class PC extends uc{constructor(A){super(Wc,"encoding",["adbe.x509.rsa_sha1","adbe.pkcs7.detached","adbe.pkcs7.sha1"]),this.id=A.id||"",this.use=A.use||"",this.usehref=A.usehref||""}}class WC extends Bc{constructor(A){super(Wc,"encodings",!0),this.id=A.id||"",this.type=GI(A.type,["optional","required"]),this.use=A.use||"",this.usehref=A.usehref||"",this.encoding=new hc}}class ZC extends Bc{constructor(A){super(Wc,"encrypt",!0),this.id=A.id||"",this.use=A.use||"",this.usehref=A.usehref||"",this.certificate=null}}class OC extends Bc{constructor(A){super(Wc,"encryptData",!0),this.id=A.id||"",this.operation=GI(A.operation,["encrypt","decrypt"]),this.target=A.target||"",this.use=A.use||"",this.usehref=A.usehref||"",this.filter=null,this.manifest=null}}class XC extends Bc{constructor(A){super(Wc,"encryption",!0),this.id=A.id||"",this.type=GI(A.type,["optional","required"]),this.use=A.use||"",this.usehref=A.usehref||"",this.certificate=new hc}}class VC extends uc{constructor(A){super(Wc,"encryptionMethod",["","AES256-CBC","TRIPLEDES-CBC","AES128-CBC","AES192-CBC"]),this.id=A.id||"",this.use=A.use||"",this.usehref=A.usehref||""}}class jC extends Bc{constructor(A){super(Wc,"encryptionMethods",!0),this.id=A.id||"",this.type=GI(A.type,["optional","required"]),this.use=A.use||"",this.usehref=A.usehref||"",this.encryptionMethod=new hc}}class zC extends Bc{constructor(A){super(Wc,"event",!0),this.activity=GI(A.activity,["click","change","docClose","docReady","enter","exit","full","indexChange","initialize","mouseDown","mouseEnter","mouseExit","mouseUp","postExecute","postOpen","postPrint","postSave","postSign","postSubmit","preExecute","preOpen","prePrint","preSave","preSign","preSubmit","ready","validationState"]),this.id=A.id||"",this.listen=GI(A.listen,["refOnly","refAndDescendents"]),this.name=A.name||"",this.ref=A.ref||"",this.use=A.use||"",this.usehref=A.usehref||"",this.extras=null,this.encryptData=null,this.execute=null,this.script=null,this.signData=null,this.submit=null}}class _C extends Ec{constructor(A){super(Wc,"exData"),this.contentType=A.contentType||"",this.href=A.href||"",this.id=A.id||"",this.maxLength=FI({data:A.maxLength,defaultValue:-1,validate:A=>A>=-1}),this.name=A.name||"",this.rid=A.rid||"",this.transferEncoding=GI(A.transferEncoding,["none","base64","package"]),this.use=A.use||"",this.usehref=A.usehref||""}[Po](){return"text/html"===this.contentType}[iI](A){return("text/html"===this.contentType&&A[AI]===wI.xhtml.id||"text/xml"===this.contentType)&&(this[Eo]=A,!0)}[dI](A){return"text/html"===this.contentType&&this[Eo]?this[Eo][dI](A):MI.EMPTY}}class $C extends Bc{constructor(A){super(Wc,"exObject",!0),this.archive=A.archive||"",this.classId=A.classId||"",this.codeBase=A.codeBase||"",this.codeType=A.codeType||"",this.id=A.id||"",this.name=A.name||"",this.use=A.use||"",this.usehref=A.usehref||"",this.extras=null,this.boolean=new hc,this.date=new hc,this.dateTime=new hc,this.decimal=new hc,this.exData=new hc,this.exObject=new hc,this.float=new hc,this.image=new hc,this.integer=new hc,this.text=new hc,this.time=new hc}}class AB extends Bc{constructor(A){super(Wc,"exclGroup",!0),this.access=GI(A.access,["open","nonInteractive","protected","readOnly"]),this.accessKey=A.accessKey||"",this.anchorType=GI(A.anchorType,["topLeft","bottomCenter","bottomLeft","bottomRight","middleCenter","middleLeft","middleRight","topCenter","topRight"]),this.colSpan=FI({data:A.colSpan,defaultValue:1,validate:A=>A>=1||-1===A}),this.h=A.h?NI(A.h):"",this.hAlign=GI(A.hAlign,["left","center","justify","justifyAll","radix","right"]),this.id=A.id||"",this.layout=GI(A.layout,["position","lr-tb","rl-row","rl-tb","row","table","tb"]),this.maxH=NI(A.maxH,"0pt"),this.maxW=NI(A.maxW,"0pt"),this.minH=NI(A.minH,"0pt"),this.minW=NI(A.minW,"0pt"),this.name=A.name||"",this.presence=GI(A.presence,["visible","hidden","inactive","invisible"]),this.relevant=UI(A.relevant),this.use=A.use||"",this.usehref=A.usehref||"",this.w=A.w?NI(A.w):"",this.x=NI(A.x,"0pt"),this.y=NI(A.y,"0pt"),this.assist=null,this.bind=null,this.border=null,this.calculate=null,this.caption=null,this.desc=null,this.extras=null,this.margin=null,this.para=null,this.traversal=null,this.validate=null,this.connect=new hc,this.event=new hc,this.field=new hc,this.setProperty=new hc}[Wo](){return!0}[vo](){return!0}[QI](A){for(const e of this.field.children){if(!e.value){const A=new Ch({});e[Io](A),e.value=A}e.value[QI](A)}}[jo](){return this.layout.endsWith("-tb")&&0===this[po].attempt&&this[po].numberInLine>0||this[Jo]()[jo]()}[Vo](){const A=this[Lo]();return!!A[Vo]()&&(void 0!==this[po]._isSplittable?this[po]._isSplittable:"position"===this.layout||this.layout.includes("row")?(this[po]._isSplittable=!1,!1):!(A.layout?.endsWith("-tb")&&0!==A[po].numberInLine||(this[po]._isSplittable=!0,0)))}[yo](){return Kc(this)}[oo](A,e){qc(this,A,e)}[bo](){return Tc(this)}[dI](A){if(eC(this),"hidden"===this.presence||"inactive"===this.presence||0===this.h||0===this.w)return MI.EMPTY;Sc(this);const e=[],t={id:this[mI],class:[]};Uc(this,t.class),this[po]||(this[po]=Object.create(null)),Object.assign(this[po],{children:e,attributes:t,attempt:0,line:null,numberInLine:0,availableSpace:{width:Math.min(this.w||1/0,A.width),height:Math.min(this.h||1/0,A.height)},width:0,height:0,prevHeight:0,currentWidth:0});const i=this[Vo]();if(i||sC(this),!Pc(this,A))return MI.FAILURE;const a=new Set(["field"]);if(this.layout.includes("row")){const A=this[Lo]().columnWidths;Array.isArray(A)&&A.length>0&&(this[po].columnWidths=A,this[po].currentColumn=0)}const s=Gc(this,"anchorType","dimensions","position","presence","border","margin","hAlign"),n=["xfaExclgroup"],g=Rc(this);g&&n.push(g),Mc(this)&&n.push("xfaPrintOnly"),t.style=s,t.class=n,this.name&&(t.xfaName=this.name),this[rI]();const r="lr-tb"===this.layout||"rl-tb"===this.layout,o=r?2:1;for(;this[po].attemptA>=1||-1===A}),this.h=A.h?NI(A.h):"",this.hAlign=GI(A.hAlign,["left","center","justify","justifyAll","radix","right"]),this.id=A.id||"",this.locale=A.locale||"",this.maxH=NI(A.maxH,"0pt"),this.maxW=NI(A.maxW,"0pt"),this.minH=NI(A.minH,"0pt"),this.minW=NI(A.minW,"0pt"),this.name=A.name||"",this.presence=GI(A.presence,["visible","hidden","inactive","invisible"]),this.relevant=UI(A.relevant),this.rotate=FI({data:A.rotate,defaultValue:0,validate:A=>A%90==0}),this.use=A.use||"",this.usehref=A.usehref||"",this.w=A.w?NI(A.w):"",this.x=NI(A.x,"0pt"),this.y=NI(A.y,"0pt"),this.assist=null,this.bind=null,this.border=null,this.calculate=null,this.caption=null,this.desc=null,this.extras=null,this.font=null,this.format=null,this.items=new hc(2),this.keep=null,this.margin=null,this.para=null,this.traversal=null,this.ui=null,this.validate=null,this.value=null,this.bindItems=new hc,this.connect=new hc,this.event=new hc,this.setProperty=new hc}[Wo](){return!0}[QI](A){_c(this,A)}[dI](A){if(eC(this),!this.ui){let A;switch(this.ui=new Ih({}),this.ui[Yo]=this[Yo],this[Io](this.ui),this.items.children.length){case 0:A=new ah({}),this.ui.textEdit=A;break;case 1:A=new kC({}),this.ui.checkButton=A;break;case 2:A=new FC({}),this.ui.choiceList=A}this.ui[Io](A)}if(!this.ui||"hidden"===this.presence||"inactive"===this.presence||0===this.h||0===this.w)return MI.EMPTY;this.caption&&delete this.caption[po],this[rI]();const e=this.caption?this.caption[dI](A).html:null,t=this.w,i=this.h;let a=0,s=0;this.margin&&(a=this.margin.leftInset+this.margin.rightInset,s=this.margin.topInset+this.margin.bottomInset);let n=null;if(""===this.w||""===this.h){let e=null,t=null,i=0,g=0;if(this.ui.checkButton)i=g=this.ui.checkButton.size;else{const{w:e,h:t}=kc(this,A);null!==e?(i=e,g=t):g=function(A,e=!1){let t=null;if(A){const e=kI(A.typeface),i=A[Yo].fontFinder.find(e);t=JI(A,i)}if(!t)return{lineHeight:12,lineGap:2,lineNoGap:10};const i=A.size||10,a=t.lineHeight?Math.max(e?0:1.2,t.lineHeight):1.2,s=void 0===t.lineGap?.2:t.lineGap;return{lineHeight:a*i,lineGap:s*i,lineNoGap:Math.max(1,a-s)*i}}(this.font,!0).lineNoGap}if(n=jc(this.ui[Go]()),i+=n.w,g+=n.h,this.caption){const{w:a,h:s,isBroken:n}=this.caption[Go](A);if(n&&this[Lo]()[jo]())return this[gI](),MI.FAILURE;switch(e=a,t=s,this.caption.placement){case"left":case"right":case"inline":e+=i;break;case"top":case"bottom":t+=g}}else e=i,t=g;e&&""===this.w&&(e+=a,this.w=Math.min(this.maxW<=0?1/0:this.maxW,this.minW+1A>=1&&A<=5}),this.appearanceFilter=null,this.certificates=null,this.digestMethods=null,this.encodings=null,this.encryptionMethods=null,this.handler=null,this.lockDocument=null,this.mdp=null,this.reasons=null,this.timeStamp=null}}class nB extends Ec{constructor(A){super(Wc,"float"),this.id=A.id||"",this.name=A.name||"",this.use=A.use||"",this.usehref=A.usehref||""}[mo](){const A=parseFloat(this[Eo].trim());this[Eo]=isNaN(A)?null:A}[dI](A){return aC(null!==this[Eo]?this[Eo].toString():"")}}class gB extends Bc{constructor(A){super(Wc,"font",!0),this.baselineShift=NI(A.baselineShift),this.fontHorizontalScale=SI({data:A.fontHorizontalScale,defaultValue:100,validate:A=>A>=0}),this.fontVerticalScale=SI({data:A.fontVerticalScale,defaultValue:100,validate:A=>A>=0}),this.id=A.id||"",this.kerningMode=GI(A.kerningMode,["none","pair"]),this.letterSpacing=NI(A.letterSpacing,"0"),this.lineThrough=FI({data:A.lineThrough,defaultValue:0,validate:A=>1===A||2===A}),this.lineThroughPeriod=GI(A.lineThroughPeriod,["all","word"]),this.overline=FI({data:A.overline,defaultValue:0,validate:A=>1===A||2===A}),this.overlinePeriod=GI(A.overlinePeriod,["all","word"]),this.posture=GI(A.posture,["normal","italic"]),this.size=NI(A.size,"10pt"),this.typeface=A.typeface||"Courier",this.underline=FI({data:A.underline,defaultValue:0,validate:A=>1===A||2===A}),this.underlinePeriod=GI(A.underlinePeriod,["all","word"]),this.use=A.use||"",this.usehref=A.usehref||"",this.weight=GI(A.weight,["normal","bold"]),this.extras=null,this.fill=null}[Co](A){super[Co](A),this[Yo].usedTypefaces.add(this.typeface)}[pI](){const A=Gc(this,"fill"),e=A.color;return e&&("#000000"===e?delete A.color:e.startsWith("#")||(A.background=e,A.backgroundClip="text",A.color="transparent")),this.baselineShift&&(A.verticalAlign=yc(this.baselineShift)),A.fontKerning="none"===this.kerningMode?"none":"normal",A.letterSpacing=yc(this.letterSpacing),0!==this.lineThrough&&(A.textDecoration="line-through",2===this.lineThrough&&(A.textDecorationStyle="double")),0!==this.overline&&(A.textDecoration="overline",2===this.overline&&(A.textDecorationStyle="double")),A.fontStyle=this.posture,A.fontSize=yc(.99*this.size),Hc(this,this,this[Yo].fontFinder,A),0!==this.underline&&(A.textDecoration="underline",2===this.underline&&(A.textDecorationStyle="double")),A.fontWeight=this.weight,A}}class rB extends Bc{constructor(A){super(Wc,"format",!0),this.id=A.id||"",this.use=A.use||"",this.usehref=A.usehref||"",this.extras=null,this.picture=null}}class oB extends dc{constructor(A){super(Wc,"handler"),this.id=A.id||"",this.type=GI(A.type,["optional","required"]),this.use=A.use||"",this.usehref=A.usehref||""}}class IB extends Bc{constructor(A){super(Wc,"hyphenation"),this.excludeAllCaps=FI({data:A.excludeAllCaps,defaultValue:0,validate:A=>1===A}),this.excludeInitialCap=FI({data:A.excludeInitialCap,defaultValue:0,validate:A=>1===A}),this.hyphenate=FI({data:A.hyphenate,defaultValue:0,validate:A=>1===A}),this.id=A.id||"",this.pushCharacterCount=FI({data:A.pushCharacterCount,defaultValue:3,validate:A=>A>=0}),this.remainCharacterCount=FI({data:A.remainCharacterCount,defaultValue:3,validate:A=>A>=0}),this.use=A.use||"",this.usehref=A.usehref||"",this.wordCharacterCount=FI({data:A.wordCharacterCount,defaultValue:7,validate:A=>A>=0})}}class cB extends dc{constructor(A){super(Wc,"image"),this.aspect=GI(A.aspect,["fit","actual","height","none","width"]),this.contentType=A.contentType||"",this.href=A.href||"",this.id=A.id||"",this.name=A.name||"",this.transferEncoding=GI(A.transferEncoding,["base64","none","package"]),this.use=A.use||"",this.usehref=A.usehref||""}[dI](){if(this.contentType&&!Xc.has(this.contentType.toLowerCase()))return MI.EMPTY;let A=this[Yo].images&&this[Yo].images.get(this.href);if(!A&&(this.href||!this[Eo]))return MI.EMPTY;if(A||"base64"!==this.transferEncoding||(A=T(atob(this[Eo]))),!A)return MI.EMPTY;if(!this.contentType){for(const[e,t]of Vc)if(A.length>e.length&&e.every(((e,t)=>e===A[t]))){this.contentType=t;break}if(!this.contentType)return MI.EMPTY}const e=new Blob([A],{type:this.contentType});let t;switch(this.aspect){case"fit":case"actual":break;case"height":t={height:"100%",objectFit:"fill"};break;case"none":t={width:"100%",height:"100%",objectFit:"fill"};break;case"width":t={width:"100%",objectFit:"fill"}}const i=this[Jo]();return MI.success({name:"img",attributes:{class:["xfaImage"],style:t,src:URL.createObjectURL(e),alt:i?iC(i[Jo]()):null}})}}class CB extends Bc{constructor(A){super(Wc,"imageEdit",!0),this.data=GI(A.data,["link","embed"]),this.id=A.id||"",this.use=A.use||"",this.usehref=A.usehref||"",this.border=null,this.extras=null,this.margin=null}[dI](A){return"embed"===this.data?MI.success({name:"div",children:[],attributes:{}}):MI.EMPTY}}class BB extends Ec{constructor(A){super(Wc,"integer"),this.id=A.id||"",this.name=A.name||"",this.use=A.use||"",this.usehref=A.usehref||""}[mo](){const A=parseInt(this[Eo].trim(),10);this[Eo]=isNaN(A)?null:A}[dI](A){return aC(null!==this[Eo]?this[Eo].toString():"")}}class hB extends Bc{constructor(A){super(Wc,"issuers",!0),this.id=A.id||"",this.type=GI(A.type,["optional","required"]),this.use=A.use||"",this.usehref=A.usehref||"",this.certificate=new hc}}class QB extends Bc{constructor(A){super(Wc,"items",!0),this.id=A.id||"",this.name=A.name||"",this.presence=GI(A.presence,["visible","hidden","inactive","invisible"]),this.ref=A.ref||"",this.save=FI({data:A.save,defaultValue:0,validate:A=>1===A}),this.use=A.use||"",this.usehref=A.usehref||"",this.boolean=new hc,this.date=new hc,this.dateTime=new hc,this.decimal=new hc,this.exData=new hc,this.float=new hc,this.image=new hc,this.integer=new hc,this.text=new hc,this.time=new hc}[dI](){const A=[];for(const e of this[xo]())A.push(e[EI]());return MI.success(A)}}class lB extends Bc{constructor(A){super(Wc,"keep",!0),this.id=A.id||"";const e=["none","contentArea","pageArea"];this.intact=GI(A.intact,e),this.next=GI(A.next,e),this.previous=GI(A.previous,e),this.use=A.use||"",this.usehref=A.usehref||"",this.extras=null}}class EB extends Bc{constructor(A){super(Wc,"keyUsage");const e=["","yes","no"];this.crlSign=GI(A.crlSign,e),this.dataEncipherment=GI(A.dataEncipherment,e),this.decipherOnly=GI(A.decipherOnly,e),this.digitalSignature=GI(A.digitalSignature,e),this.encipherOnly=GI(A.encipherOnly,e),this.id=A.id||"",this.keyAgreement=GI(A.keyAgreement,e),this.keyCertSign=GI(A.keyCertSign,e),this.keyEncipherment=GI(A.keyEncipherment,e),this.nonRepudiation=GI(A.nonRepudiation,e),this.type=GI(A.type,["optional","required"]),this.use=A.use||"",this.usehref=A.usehref||""}}class uB extends Bc{constructor(A){super(Wc,"line",!0),this.hand=GI(A.hand,["even","left","right"]),this.id=A.id||"",this.slope=GI(A.slope,["\\","/"]),this.use=A.use||"",this.usehref=A.usehref||"",this.edge=null}[dI](){const A=this[Jo]()[Jo](),e=this.edge||new TC({}),t=e[pI](),i=Object.create(null),a="visible"===e.presence?e.thickness:0;let s,n,g,r;i.strokeWidth=yc(a),i.stroke=t.color;let o="100%",I="100%";A.w<=a?([s,n,g,r]=["50%",0,"50%","100%"],o=i.strokeWidth):A.h<=a?([s,n,g,r]=[0,"50%","100%","50%"],I=i.strokeWidth):"\\"===this.slope?[s,n,g,r]=[0,0,"100%","100%"]:[s,n,g,r]=[0,"100%","100%",0];const c={name:"svg",children:[{name:"line",attributes:{xmlns:Zc,x1:s,y1:n,x2:g,y2:r,style:i}}],attributes:{xmlns:Zc,width:o,height:I,style:{overflow:"visible"}}};return zc(A)?MI.success({name:"div",attributes:{style:{display:"inline",width:"100%",height:"100%"}},children:[c]}):(c.attributes.style.position="absolute",MI.success(c))}}class dB extends Bc{constructor(A){super(Wc,"linear",!0),this.id=A.id||"",this.type=GI(A.type,["toRight","toBottom","toLeft","toTop"]),this.use=A.use||"",this.usehref=A.usehref||"",this.color=null,this.extras=null}[pI](A){return A=A?A[pI]():"#FFFFFF",`linear-gradient(${this.type.replace(/([RBLT])/," $1").toLowerCase()}, ${A}, ${this.color?this.color[pI]():"#000000"})`}}class fB extends Ec{constructor(A){super(Wc,"lockDocument"),this.id=A.id||"",this.type=GI(A.type,["optional","required"]),this.use=A.use||"",this.usehref=A.usehref||""}[mo](){this[Eo]=GI(this[Eo],["auto","0","1"])}}class pB extends Bc{constructor(A){super(Wc,"manifest",!0),this.action=GI(A.action,["include","all","exclude"]),this.id=A.id||"",this.name=A.name||"",this.use=A.use||"",this.usehref=A.usehref||"",this.extras=null,this.ref=new hc}}class mB extends Bc{constructor(A){super(Wc,"margin",!0),this.bottomInset=NI(A.bottomInset,"0"),this.id=A.id||"",this.leftInset=NI(A.leftInset,"0"),this.rightInset=NI(A.rightInset,"0"),this.topInset=NI(A.topInset,"0"),this.use=A.use||"",this.usehref=A.usehref||"",this.extras=null}[pI](){return{margin:yc(this.topInset)+" "+yc(this.rightInset)+" "+yc(this.bottomInset)+" "+yc(this.leftInset)}}}class yB extends Bc{constructor(A){super(Wc,"mdp"),this.id=A.id||"",this.permissions=FI({data:A.permissions,defaultValue:2,validate:A=>1===A||3===A}),this.signatureType=GI(A.signatureType,["filler","author"]),this.use=A.use||"",this.usehref=A.usehref||""}}class wB extends Bc{constructor(A){super(Wc,"medium"),this.id=A.id||"",this.imagingBBox=function(A){const e=-1;if(!A)return{x:e,y:e,width:e,height:e};const t=A.trim().split(/\s*,\s*/).map((A=>NI(A,"-1")));if(t.length<4||t[2]<0||t[3]<0)return{x:e,y:e,width:e,height:e};const[i,a,s,n]=t;return{x:i,y:a,width:s,height:n}}(A.imagingBBox),this.long=NI(A.long),this.orientation=GI(A.orientation,["portrait","landscape"]),this.short=NI(A.short),this.stock=A.stock||"",this.trayIn=GI(A.trayIn,["auto","delegate","pageFront"]),this.trayOut=GI(A.trayOut,["auto","delegate"]),this.use=A.use||"",this.usehref=A.usehref||""}}class DB extends Bc{constructor(A){super(Wc,"message",!0),this.id=A.id||"",this.use=A.use||"",this.usehref=A.usehref||"",this.text=new hc}}class bB extends Bc{constructor(A){super(Wc,"numericEdit",!0),this.hScrollPolicy=GI(A.hScrollPolicy,["auto","off","on"]),this.id=A.id||"",this.use=A.use||"",this.usehref=A.usehref||"",this.border=null,this.comb=null,this.extras=null,this.margin=null}[dI](A){const e=Gc(this,"border","font","margin"),t=this[Jo]()[Jo](),i={name:"input",attributes:{type:"text",fieldId:t[mI],dataId:t[uo]?.[mI]||t[mI],class:["xfaTextfield"],style:e,"aria-label":iC(t),"aria-required":!1}};return AC(t)&&(i.attributes["aria-required"]=!0,i.attributes.required=!0),MI.success({name:"label",attributes:{class:["xfaLabel"]},children:[i]})}}class kB extends Bc{constructor(A){super(Wc,"occur",!0),this.id=A.id||"",this.initial=""!==A.initial?FI({data:A.initial,defaultValue:"",validate:A=>!0}):"",this.max=""!==A.max?FI({data:A.max,defaultValue:1,validate:A=>!0}):"",this.min=""!==A.min?FI({data:A.min,defaultValue:1,validate:A=>!0}):"",this.use=A.use||"",this.usehref=A.usehref||"",this.extras=null}[Co](){const A=this[Jo](),e=this.min;""===this.min&&(this.min=A instanceof GB||A instanceof NB?0:1),""===this.max&&(this.max=""===e?A instanceof GB||A instanceof NB?-1:1:this.min),-1!==this.max&&this.max!0}),this.name=A.name||"",this.numbered=FI({data:A.numbered,defaultValue:1,validate:A=>!0}),this.oddOrEven=GI(A.oddOrEven,["any","even","odd"]),this.pagePosition=GI(A.pagePosition,["any","first","last","only","rest"]),this.relevant=UI(A.relevant),this.use=A.use||"",this.usehref=A.usehref||"",this.desc=null,this.extras=null,this.medium=null,this.occur=null,this.area=new hc,this.contentArea=new hc,this.draw=new hc,this.exclGroup=new hc,this.field=new hc,this.subform=new hc}[_o](){return this[po]?!this.occur||-1===this.occur.max||this[po].numberOfUseA.oddOrEven===e&&A.pagePosition===t));return i||(i=this.pageArea.children.find((A=>"any"===A.oddOrEven&&A.pagePosition===t)),i||(i=this.pageArea.children.find((A=>"any"===A.oddOrEven&&"any"===A.pagePosition)),i||this.pageArea.children[0]))}}class xB extends Bc{constructor(A){super(Wc,"para",!0),this.hAlign=GI(A.hAlign,["left","center","justify","justifyAll","radix","right"]),this.id=A.id||"",this.lineHeight=A.lineHeight?NI(A.lineHeight,"0pt"):"",this.marginLeft=A.marginLeft?NI(A.marginLeft,"0pt"):"",this.marginRight=A.marginRight?NI(A.marginRight,"0pt"):"",this.orphans=FI({data:A.orphans,defaultValue:0,validate:A=>A>=0}),this.preserve=A.preserve||"",this.radixOffset=A.radixOffset?NI(A.radixOffset,"0pt"):"",this.spaceAbove=A.spaceAbove?NI(A.spaceAbove,"0pt"):"",this.spaceBelow=A.spaceBelow?NI(A.spaceBelow,"0pt"):"",this.tabDefault=A.tabDefault?NI(this.tabDefault):"",this.tabStops=(A.tabStops||"").trim().split(/\s+/).map(((A,e)=>e%2==1?NI(A):A)),this.textIndent=A.textIndent?NI(A.textIndent,"0pt"):"",this.use=A.use||"",this.usehref=A.usehref||"",this.vAlign=GI(A.vAlign,["top","bottom","middle"]),this.widows=FI({data:A.widows,defaultValue:0,validate:A=>A>=0}),this.hyphenation=null}[pI](){const A=Gc(this,"hAlign");return""!==this.marginLeft&&(A.paddingLeft=yc(this.marginLeft)),""!==this.marginRight&&(A.paddingight=yc(this.marginRight)),""!==this.spaceAbove&&(A.paddingTop=yc(this.spaceAbove)),""!==this.spaceBelow&&(A.paddingBottom=yc(this.spaceBelow)),""!==this.textIndent&&(A.textIndent=yc(this.textIndent),xc(A)),this.lineHeight>0&&(A.lineHeight=yc(this.lineHeight)),""!==this.tabDefault&&(A.tabSize=yc(this.tabDefault)),this.tabStops.length,this.hyphenatation&&Object.assign(A,this.hyphenatation[pI]()),A}}class UB extends Bc{constructor(A){super(Wc,"passwordEdit",!0),this.hScrollPolicy=GI(A.hScrollPolicy,["auto","off","on"]),this.id=A.id||"",this.passwordChar=A.passwordChar||"*",this.use=A.use||"",this.usehref=A.usehref||"",this.border=null,this.extras=null,this.margin=null}}class MB extends Bc{constructor(A){super(Wc,"pattern",!0),this.id=A.id||"",this.type=GI(A.type,["crossHatch","crossDiagonal","diagonalLeft","diagonalRight","horizontal","vertical"]),this.use=A.use||"",this.usehref=A.usehref||"",this.color=null,this.extras=null}[pI](A){A=A?A[pI]():"#FFFFFF";const e=this.color?this.color[pI]():"#000000",t="repeating-linear-gradient",i=`${A},${A} 5px,${e} 5px,${e} 10px`;switch(this.type){case"crossHatch":return`${t}(to top,${i}) ${t}(to right,${i})`;case"crossDiagonal":return`${t}(45deg,${i}) ${t}(-45deg,${i})`;case"diagonalLeft":return`${t}(45deg,${i})`;case"diagonalRight":return`${t}(-45deg,${i})`;case"horizontal":return`${t}(to top,${i})`;case"vertical":return`${t}(to right,${i})`}return""}}class LB extends dc{constructor(A){super(Wc,"picture"),this.id=A.id||"",this.use=A.use||"",this.usehref=A.usehref||""}}class JB extends Bc{constructor(A){super(Wc,"proto",!0),this.appearanceFilter=new hc,this.arc=new hc,this.area=new hc,this.assist=new hc,this.barcode=new hc,this.bindItems=new hc,this.bookend=new hc,this.boolean=new hc,this.border=new hc,this.break=new hc,this.breakAfter=new hc,this.breakBefore=new hc,this.button=new hc,this.calculate=new hc,this.caption=new hc,this.certificate=new hc,this.certificates=new hc,this.checkButton=new hc,this.choiceList=new hc,this.color=new hc,this.comb=new hc,this.connect=new hc,this.contentArea=new hc,this.corner=new hc,this.date=new hc,this.dateTime=new hc,this.dateTimeEdit=new hc,this.decimal=new hc,this.defaultUi=new hc,this.desc=new hc,this.digestMethod=new hc,this.digestMethods=new hc,this.draw=new hc,this.edge=new hc,this.encoding=new hc,this.encodings=new hc,this.encrypt=new hc,this.encryptData=new hc,this.encryption=new hc,this.encryptionMethod=new hc,this.encryptionMethods=new hc,this.event=new hc,this.exData=new hc,this.exObject=new hc,this.exclGroup=new hc,this.execute=new hc,this.extras=new hc,this.field=new hc,this.fill=new hc,this.filter=new hc,this.float=new hc,this.font=new hc,this.format=new hc,this.handler=new hc,this.hyphenation=new hc,this.image=new hc,this.imageEdit=new hc,this.integer=new hc,this.issuers=new hc,this.items=new hc,this.keep=new hc,this.keyUsage=new hc,this.line=new hc,this.linear=new hc,this.lockDocument=new hc,this.manifest=new hc,this.margin=new hc,this.mdp=new hc,this.medium=new hc,this.message=new hc,this.numericEdit=new hc,this.occur=new hc,this.oid=new hc,this.oids=new hc,this.overflow=new hc,this.pageArea=new hc,this.pageSet=new hc,this.para=new hc,this.passwordEdit=new hc,this.pattern=new hc,this.picture=new hc,this.radial=new hc,this.reason=new hc,this.reasons=new hc,this.rectangle=new hc,this.ref=new hc,this.script=new hc,this.setProperty=new hc,this.signData=new hc,this.signature=new hc,this.signing=new hc,this.solid=new hc,this.speak=new hc,this.stipple=new hc,this.subform=new hc,this.subformSet=new hc,this.subjectDN=new hc,this.subjectDNs=new hc,this.submit=new hc,this.text=new hc,this.textEdit=new hc,this.time=new hc,this.timeStamp=new hc,this.toolTip=new hc,this.traversal=new hc,this.traverse=new hc,this.ui=new hc,this.validate=new hc,this.value=new hc,this.variables=new hc}}class HB extends Bc{constructor(A){super(Wc,"radial",!0),this.id=A.id||"",this.type=GI(A.type,["toEdge","toCenter"]),this.use=A.use||"",this.usehref=A.usehref||"",this.color=null,this.extras=null}[pI](A){A=A?A[pI]():"#FFFFFF";const e=this.color?this.color[pI]():"#000000";return`radial-gradient(circle at center, ${"toEdge"===this.type?`${A},${e}`:`${e},${A}`})`}}class YB extends dc{constructor(A){super(Wc,"reason"),this.id=A.id||"",this.name=A.name||"",this.use=A.use||"",this.usehref=A.usehref||""}}class vB extends Bc{constructor(A){super(Wc,"reasons",!0),this.id=A.id||"",this.type=GI(A.type,["optional","required"]),this.use=A.use||"",this.usehref=A.usehref||"",this.reason=new hc}}class KB extends Bc{constructor(A){super(Wc,"rectangle",!0),this.hand=GI(A.hand,["even","left","right"]),this.id=A.id||"",this.use=A.use||"",this.usehref=A.usehref||"",this.corner=new hc(4),this.edge=new hc(4),this.fill=null}[dI](){const A=this.edge.children.length?this.edge.children[0]:new TC({}),e=A[pI](),t=Object.create(null);"visible"===this.fill?.presence?Object.assign(t,this.fill[pI]()):t.fill="transparent",t.strokeWidth=yc("visible"===A.presence?A.thickness:0),t.stroke=e.color;const i=(this.corner.children.length?this.corner.children[0]:new xC({}))[pI](),a={name:"svg",children:[{name:"rect",attributes:{xmlns:Zc,width:"100%",height:"100%",x:0,y:0,rx:i.radius,ry:i.radius,style:t}}],attributes:{xmlns:Zc,style:{overflow:"visible"},width:"100%",height:"100%"}};return zc(this[Jo]()[Jo]())?MI.success({name:"div",attributes:{style:{display:"inline",width:"100%",height:"100%"}},children:[a]}):(a.attributes.style.position="absolute",MI.success(a))}}class qB extends dc{constructor(A){super(Wc,"ref"),this.id=A.id||"",this.use=A.use||"",this.usehref=A.usehref||""}}class TB extends dc{constructor(A){super(Wc,"script"),this.binding=A.binding||"",this.contentType=A.contentType||"",this.id=A.id||"",this.name=A.name||"",this.runAt=GI(A.runAt,["client","both","server"]),this.use=A.use||"",this.usehref=A.usehref||""}}class PB extends Bc{constructor(A){super(Wc,"setProperty"),this.connection=A.connection||"",this.ref=A.ref||"",this.target=A.target||""}}class WB extends Bc{constructor(A){super(Wc,"signData",!0),this.id=A.id||"",this.operation=GI(A.operation,["sign","clear","verify"]),this.ref=A.ref||"",this.target=A.target||"",this.use=A.use||"",this.usehref=A.usehref||"",this.filter=null,this.manifest=null}}class ZB extends Bc{constructor(A){super(Wc,"signature",!0),this.id=A.id||"",this.type=GI(A.type,["PDF1.3","PDF1.6"]),this.use=A.use||"",this.usehref=A.usehref||"",this.border=null,this.extras=null,this.filter=null,this.manifest=null,this.margin=null}}class OB extends Bc{constructor(A){super(Wc,"signing",!0),this.id=A.id||"",this.type=GI(A.type,["optional","required"]),this.use=A.use||"",this.usehref=A.usehref||"",this.certificate=new hc}}class XB extends Bc{constructor(A){super(Wc,"solid",!0),this.id=A.id||"",this.use=A.use||"",this.usehref=A.usehref||"",this.extras=null}[pI](A){return A?A[pI]():"#FFFFFF"}}class VB extends dc{constructor(A){super(Wc,"speak"),this.disable=FI({data:A.disable,defaultValue:0,validate:A=>1===A}),this.id=A.id||"",this.priority=GI(A.priority,["custom","caption","name","toolTip"]),this.rid=A.rid||"",this.use=A.use||"",this.usehref=A.usehref||""}}class jB extends Bc{constructor(A){super(Wc,"stipple",!0),this.id=A.id||"",this.rate=FI({data:A.rate,defaultValue:50,validate:A=>A>=0&&A<=100}),this.use=A.use||"",this.usehref=A.usehref||"",this.color=null,this.extras=null}[pI](A){const e=this.rate/100;return X.makeHexColor(Math.round(A.value.r*(1-e)+this.value.r*e),Math.round(A.value.g*(1-e)+this.value.g*e),Math.round(A.value.b*(1-e)+this.value.b*e))}}class zB extends Bc{constructor(A){super(Wc,"subform",!0),this.access=GI(A.access,["open","nonInteractive","protected","readOnly"]),this.allowMacro=FI({data:A.allowMacro,defaultValue:0,validate:A=>1===A}),this.anchorType=GI(A.anchorType,["topLeft","bottomCenter","bottomLeft","bottomRight","middleCenter","middleLeft","middleRight","topCenter","topRight"]),this.colSpan=FI({data:A.colSpan,defaultValue:1,validate:A=>A>=1||-1===A}),this.columnWidths=(A.columnWidths||"").trim().split(/\s+/).map((A=>"-1"===A?-1:NI(A))),this.h=A.h?NI(A.h):"",this.hAlign=GI(A.hAlign,["left","center","justify","justifyAll","radix","right"]),this.id=A.id||"",this.layout=GI(A.layout,["position","lr-tb","rl-row","rl-tb","row","table","tb"]),this.locale=A.locale||"",this.maxH=NI(A.maxH,"0pt"),this.maxW=NI(A.maxW,"0pt"),this.mergeMode=GI(A.mergeMode,["consumeData","matchTemplate"]),this.minH=NI(A.minH,"0pt"),this.minW=NI(A.minW,"0pt"),this.name=A.name||"",this.presence=GI(A.presence,["visible","hidden","inactive","invisible"]),this.relevant=UI(A.relevant),this.restoreState=GI(A.restoreState,["manual","auto"]),this.scope=GI(A.scope,["name","none"]),this.use=A.use||"",this.usehref=A.usehref||"",this.w=A.w?NI(A.w):"",this.x=NI(A.x,"0pt"),this.y=NI(A.y,"0pt"),this.assist=null,this.bind=null,this.bookend=null,this.border=null,this.break=null,this.calculate=null,this.desc=null,this.extras=null,this.keep=null,this.margin=null,this.occur=null,this.overflow=null,this.pageSet=null,this.para=null,this.traversal=null,this.validate=null,this.variables=null,this.area=new hc,this.breakAfter=new hc,this.breakBefore=new hc,this.connect=new hc,this.draw=new hc,this.event=new hc,this.exObject=new hc,this.exclGroup=new hc,this.field=new hc,this.proto=new hc,this.setProperty=new hc,this.subform=new hc,this.subformSet=new hc}[Lo](){const A=this[Jo]();return A instanceof _B?A[Lo]():A}[Wo](){return!0}[jo](){return this.layout.endsWith("-tb")&&0===this[po].attempt&&this[po].numberInLine>0||this[Jo]()[jo]()}*[Uo](){yield*$c(this)}[yo](){return Kc(this)}[oo](A,e){qc(this,A,e)}[bo](){return Tc(this)}[Vo](){const A=this[Lo]();return!!A[Vo]()&&(void 0!==this[po]._isSplittable?this[po]._isSplittable:"position"===this.layout||this.layout.includes("row")||this.keep&&"none"!==this.keep.intact?(this[po]._isSplittable=!1,!1):!(A.layout?.endsWith("-tb")&&0!==A[po].numberInLine||(this[po]._isSplittable=!0,0)))}[dI](A){if(eC(this),this.break){if("auto"!==this.break.after||""!==this.break.afterTarget){const A=new fC({targetType:this.break.after,target:this.break.afterTarget,startNew:this.break.startNew.toString()});A[Yo]=this[Yo],this[Io](A),this.breakAfter.push(A)}if("auto"!==this.break.before||""!==this.break.beforeTarget){const A=new pC({targetType:this.break.before,target:this.break.beforeTarget,startNew:this.break.startNew.toString()});A[Yo]=this[Yo],this[Io](A),this.breakBefore.push(A)}if(""!==this.break.overflowTarget){const A=new RB({target:this.break.overflowTarget,leader:this.break.overflowLeader,trailer:this.break.overflowTrailer});A[Yo]=this[Yo],this[Io](A),this.overflow.push(A)}this[oI](this.break),this.break=null}if("hidden"===this.presence||"inactive"===this.presence)return MI.EMPTY;if((this.breakBefore.children.length>1||this.breakAfter.children.length>1)&&S("XFA - Several breakBefore or breakAfter in subforms: please file a bug."),this.breakBefore.children.length>=1){const A=this.breakBefore.children[0];if(gC(A))return MI.breakNode(A)}if(this[po]?.afterBreakAfter)return MI.EMPTY;Sc(this);const e=[],t={id:this[mI],class:[]};Uc(this,t.class),this[po]||(this[po]=Object.create(null)),Object.assign(this[po],{children:e,line:null,attributes:t,attempt:0,numberInLine:0,availableSpace:{width:Math.min(this.w||1/0,A.width),height:Math.min(this.h||1/0,A.height)},width:0,height:0,prevHeight:0,currentWidth:0});const i=this[Ho](),a=i[po].noLayoutFailure,s=this[Vo]();if(s||sC(this),!Pc(this,A))return MI.FAILURE;const n=new Set(["area","draw","exclGroup","field","subform","subformSet"]);if(this.layout.includes("row")){const A=this[Lo]().columnWidths;Array.isArray(A)&&A.length>0&&(this[po].columnWidths=A,this[po].currentColumn=0)}const g=Gc(this,"anchorType","dimensions","position","presence","border","margin","hAlign"),r=["xfaSubform"],o=Rc(this);if(o&&r.push(o),t.style=g,t.class=r,this.name&&(t.xfaName=this.name),this.overflow){const e=this.overflow[Go]();e.addLeader&&(e.addLeader=!1,rC(this,e.leader,A))}this[rI]();const I="lr-tb"===this.layout||"rl-tb"===this.layout,c=I?2:1;for(;this[po].attempt=1){const A=this.breakAfter.children[0];if(gC(A))return this[po].afterBreakAfter=u,MI.breakNode(A)}return delete this[po],u}}class _B extends Bc{constructor(A){super(Wc,"subformSet",!0),this.id=A.id||"",this.name=A.name||"",this.relation=GI(A.relation,["ordered","choice","unordered"]),this.relevant=UI(A.relevant),this.use=A.use||"",this.usehref=A.usehref||"",this.bookend=null,this.break=null,this.desc=null,this.extras=null,this.occur=null,this.overflow=null,this.breakAfter=new hc,this.breakBefore=new hc,this.subform=new hc,this.subformSet=new hc}*[Uo](){yield*$c(this)}[Lo](){let A=this[Jo]();for(;!(A instanceof zB);)A=A[Jo]();return A}[Wo](){return!0}}class $B extends Ec{constructor(A){super(Wc,"subjectDN"),this.delimiter=A.delimiter||",",this.id=A.id||"",this.name=A.name||"",this.use=A.use||"",this.usehref=A.usehref||""}[mo](){this[Eo]=new Map(this[Eo].split(this.delimiter).map((A=>((A=A.split("=",2))[0]=A[0].trim(),A))))}}class Ah extends Bc{constructor(A){super(Wc,"subjectDNs",!0),this.id=A.id||"",this.type=GI(A.type,["optional","required"]),this.use=A.use||"",this.usehref=A.usehref||"",this.subjectDN=new hc}}class eh extends Bc{constructor(A){super(Wc,"submit",!0),this.embedPDF=FI({data:A.embedPDF,defaultValue:0,validate:A=>1===A}),this.format=GI(A.format,["xdp","formdata","pdf","urlencoded","xfd","xml"]),this.id=A.id||"",this.target=A.target||"",this.textEncoding=RI({data:A.textEncoding?A.textEncoding.toLowerCase():"",defaultValue:"",validate:A=>["utf-8","big-five","fontspecific","gbk","gb-18030","gb-2312","ksc-5601","none","shift-jis","ucs-2","utf-16"].includes(A)||A.match(/iso-8859-\d{2}/)}),this.use=A.use||"",this.usehref=A.usehref||"",this.xdpContent=A.xdpContent||"",this.encrypt=null,this.encryptData=new hc,this.signData=new hc}}class th extends Bc{constructor(A){super(Wc,"template",!0),this.baseProfile=GI(A.baseProfile,["full","interactiveForms"]),this.extras=null,this.subform=new hc}[mo](){0===this.subform.children.length&&S("XFA - No subforms in template node."),this.subform.children.length>=2&&S("XFA - Several subforms in template node: please file a bug."),this[lI]=5e3}[Vo](){return!0}[CI](A,e){return A.startsWith("#")?[this[Ko].get(A.slice(1))]:ZI(this,e,A,!0,!0)}*[uI](){if(!this.subform.children.length)return MI.success({name:"div",children:[]});this[po]={overflowNode:null,firstUnsplittable:null,currentContentArea:null,currentPageArea:null,noLayoutFailure:!1,pageNumber:1,pagePosition:"first",oddOrEven:"odd",blankOrNotBlank:"nonBlank",paraStack:[]};const A=this.subform.children[0];A.pageSet[Bo]();const e=A.pageSet.pageArea.children,t={name:"div",children:[]};let i=null,a=null,s=null;if(A.breakBefore.children.length>=1?(a=A.breakBefore.children[0],s=a.target):A.subform.children.length>=1&&A.subform.children[0].breakBefore.children.length>=1?(a=A.subform.children[0].breakBefore.children[0],s=a.target):A.break?.beforeTarget?(a=A.break,s=a.beforeTarget):A.subform.children.length>=1&&A.subform.children[0].break?.beforeTarget&&(a=A.subform.children[0].break,s=a.beforeTarget),a){const A=this[CI](s,a[Jo]());A instanceof GB&&(i=A,a[po]={})}i||(i=e[0]),i[po]={numberOfUse:1};const n=i[Jo]();let g;n[po]={numberOfUse:1,pageIndex:n.pageArea.children.indexOf(i),pageSetIndex:0};let r=null,o=null,I=!0,c=0,C=0;for(;;){if(I)c=0;else if(t.children.pop(),3==++c)return S("XFA - Something goes wrong: please file a bug."),t;g=null,this[po].currentPageArea=i;const e=i[dI]().html;t.children.push(e),r&&(this[po].noLayoutFailure=!0,e.children.push(r[dI](i[po].space).html),r=null),o&&(this[po].noLayoutFailure=!0,e.children.push(o[dI](i[po].space).html),o=null);const a=i.contentArea.children,s=e.children.filter((A=>A.attributes.class.includes("xfaContentarea")));I=!1,this[po].firstUnsplittable=null,this[po].noLayoutFailure=!1;const n=e=>{const t=A[yo]();t&&(I||=t.children?.length>0,s[e].children.push(t))};for(let e=C,i=a.length;e0,s[e].children.push(B.html)):!I&&t.children.length>1&&t.children.pop(),t;if(B.isBreak()){const A=B.breakNode;if(n(e),"auto"===A.targetType)continue;A.leader&&(r=this[CI](A.leader,A[Jo]()),r=r?r[0]:null),A.trailer&&(o=this[CI](A.trailer,A[Jo]()),o=o?o[0]:null),"pageArea"===A.targetType?(g=A[po].target,e=1/0):A[po].target?(g=A[po].target,C=A[po].index+1,e=1/0):e=A[po].index}else if(this[po].overflowNode){const A=this[po].overflowNode;this[po].overflowNode=null;const t=A[Go](),i=t.target;t.addLeader=null!==t.leader,t.addTrailer=null!==t.trailer,n(e);const s=e;if(e=1/0,i instanceof GB)g=i;else if(i instanceof NC){const A=a.indexOf(i);-1!==A?A>s?e=A-1:C=A:(g=i[Jo](),C=g.contentArea.children.indexOf(i))}}else n(e)}this[po].pageNumber+=1,g&&(g[_o]()?g[po].numberOfUse+=1:g=null),i=g||i[Mo](),yield null}}}class ih extends Ec{constructor(A){super(Wc,"text"),this.id=A.id||"",this.maxChars=FI({data:A.maxChars,defaultValue:0,validate:A=>A>=0}),this.name=A.name||"",this.rid=A.rid||"",this.use=A.use||"",this.usehref=A.usehref||""}[ro](){return!0}[iI](A){return A[AI]===wI.xhtml.id?(this[Eo]=A,!0):(S(`XFA - Invalid content in Text: ${A[eI]}.`),!1)}[sI](A){this[Eo]instanceof Bc||super[sI](A)}[mo](){"string"==typeof this[Eo]&&(this[Eo]=this[Eo].replaceAll("\r\n","\n"))}[Go](){return"string"==typeof this[Eo]?this[Eo].split(/[\u2029\u2028\n]/).reduce(((A,e)=>(e&&A.push(e),A)),[]).join("\n"):this[Eo][EI]()}[dI](A){if("string"==typeof this[Eo]){const A=aC(this[Eo]).html;return this[Eo].includes("\u2029")?(A.name="div",A.children=[],this[Eo].split("\u2029").map((A=>A.split(/[\u2028\n]/).reduce(((A,e)=>(A.push({name:"span",value:e},{name:"br"}),A)),[]))).forEach((e=>{A.children.push({name:"p",children:e})}))):/[\u2028\n]/.test(this[Eo])&&(A.name="div",A.children=[],this[Eo].split(/[\u2028\n]/).forEach((e=>{A.children.push({name:"span",value:e},{name:"br"})}))),MI.success(A)}return this[Eo][dI](A)}}class ah extends Bc{constructor(A){super(Wc,"textEdit",!0),this.allowRichText=FI({data:A.allowRichText,defaultValue:0,validate:A=>1===A}),this.hScrollPolicy=GI(A.hScrollPolicy,["auto","off","on"]),this.id=A.id||"",this.multiLine=FI({data:A.multiLine,defaultValue:"",validate:A=>0===A||1===A}),this.use=A.use||"",this.usehref=A.usehref||"",this.vScrollPolicy=GI(A.vScrollPolicy,["auto","off","on"]),this.border=null,this.comb=null,this.extras=null,this.margin=null}[dI](A){const e=Gc(this,"border","font","margin");let t;const i=this[Jo]()[Jo]();return""===this.multiLine&&(this.multiLine=i instanceof qC?1:0),t=1===this.multiLine?{name:"textarea",attributes:{dataId:i[uo]?.[mI]||i[mI],fieldId:i[mI],class:["xfaTextfield"],style:e,"aria-label":iC(i),"aria-required":!1}}:{name:"input",attributes:{type:"text",dataId:i[uo]?.[mI]||i[mI],fieldId:i[mI],class:["xfaTextfield"],style:e,"aria-label":iC(i),"aria-required":!1}},AC(i)&&(t.attributes["aria-required"]=!0,t.attributes.required=!0),MI.success({name:"label",attributes:{class:["xfaLabel"]},children:[t]})}}class sh extends dc{constructor(A){super(Wc,"time"),this.id=A.id||"",this.name=A.name||"",this.use=A.use||"",this.usehref=A.usehref||""}[mo](){const A=this[Eo].trim();this[Eo]=A?new Date(A):null}[dI](A){return aC(this[Eo]?this[Eo].toString():"")}}class nh extends Bc{constructor(A){super(Wc,"timeStamp"),this.id=A.id||"",this.server=A.server||"",this.type=GI(A.type,["optional","required"]),this.use=A.use||"",this.usehref=A.usehref||""}}class gh extends dc{constructor(A){super(Wc,"toolTip"),this.id=A.id||"",this.rid=A.rid||"",this.use=A.use||"",this.usehref=A.usehref||""}}class rh extends Bc{constructor(A){super(Wc,"traversal",!0),this.id=A.id||"",this.use=A.use||"",this.usehref=A.usehref||"",this.extras=null,this.traverse=new hc}}class oh extends Bc{constructor(A){super(Wc,"traverse",!0),this.id=A.id||"",this.operation=GI(A.operation,["next","back","down","first","left","right","up"]),this.ref=A.ref||"",this.use=A.use||"",this.usehref=A.usehref||"",this.extras=null,this.script=null}get name(){return this.operation}[zo](){return!1}}class Ih extends Bc{constructor(A){super(Wc,"ui",!0),this.id=A.id||"",this.use=A.use||"",this.usehref=A.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}[Go](){if(void 0===this[po]){for(const A of Object.getOwnPropertyNames(this)){if("extras"===A||"picture"===A)continue;const e=this[A];if(e instanceof Bc)return this[po]=e,e}this[po]=null}return this[po]}[dI](A){const e=this[Go]();return e?e[dI](A):MI.EMPTY}}class ch extends Bc{constructor(A){super(Wc,"validate",!0),this.formatTest=GI(A.formatTest,["warning","disabled","error"]),this.id=A.id||"",this.nullTest=GI(A.nullTest,["disabled","error","warning"]),this.scriptTest=GI(A.scriptTest,["error","disabled","warning"]),this.use=A.use||"",this.usehref=A.usehref||"",this.extras=null,this.message=null,this.picture=null,this.script=null}}class Ch extends Bc{constructor(A){super(Wc,"value",!0),this.id=A.id||"",this.override=FI({data:A.override,defaultValue:0,validate:A=>1===A}),this.relevant=UI(A.relevant),this.use=A.use||"",this.usehref=A.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}[QI](A){const e=this[Jo]();if(e instanceof iB&&e.ui?.imageEdit)return this.image||(this.image=new cB({}),this[Io](this.image)),void(this.image[Eo]=A[Eo]);const t=A[eI];if(null===this[t]){for(const A of Object.getOwnPropertyNames(this)){const e=this[A];e instanceof Bc&&(this[A]=null,this[oI](e))}this[A[eI]]=A,this[Io](A)}else this[t][Eo]=A[Eo]}[EI](){if(this.exData)return"string"==typeof this.exData[Eo]?this.exData[Eo].trim():this.exData[Eo][EI]().trim();for(const A of Object.getOwnPropertyNames(this)){if("image"===A)continue;const e=this[A];if(e instanceof Bc)return(e[Eo]||"").toString().trim()}return null}[dI](A){for(const e of Object.getOwnPropertyNames(this)){const t=this[e];if(t instanceof Bc)return t[dI](A)}return MI.EMPTY}}class Bh extends Bc{constructor(A){super(Wc,"variables",!0),this.id=A.id||"",this.use=A.use||"",this.usehref=A.usehref||"",this.boolean=new hc,this.date=new hc,this.dateTime=new hc,this.decimal=new hc,this.exData=new hc,this.float=new hc,this.image=new hc,this.integer=new hc,this.manifest=new hc,this.script=new hc,this.text=new hc,this.time=new hc}[zo](){return!0}}class hh{static[yI](A,e){if(hh.hasOwnProperty(A)){const t=hh[A](e);return t[hI](e),t}}static appearanceFilter(A){return new oC(A)}static arc(A){return new IC(A)}static area(A){return new cC(A)}static assist(A){return new CC(A)}static barcode(A){return new BC(A)}static bind(A){return new hC(A)}static bindItems(A){return new QC(A)}static bookend(A){return new lC(A)}static boolean(A){return new EC(A)}static border(A){return new uC(A)}static break(A){return new dC(A)}static breakAfter(A){return new fC(A)}static breakBefore(A){return new pC(A)}static button(A){return new mC(A)}static calculate(A){return new yC(A)}static caption(A){return new wC(A)}static certificate(A){return new DC(A)}static certificates(A){return new bC(A)}static checkButton(A){return new kC(A)}static choiceList(A){return new FC(A)}static color(A){return new SC(A)}static comb(A){return new RC(A)}static connect(A){return new GC(A)}static contentArea(A){return new NC(A)}static corner(A){return new xC(A)}static date(A){return new UC(A)}static dateTime(A){return new MC(A)}static dateTimeEdit(A){return new LC(A)}static decimal(A){return new JC(A)}static defaultUi(A){return new HC(A)}static desc(A){return new YC(A)}static digestMethod(A){return new vC(A)}static digestMethods(A){return new KC(A)}static draw(A){return new qC(A)}static edge(A){return new TC(A)}static encoding(A){return new PC(A)}static encodings(A){return new WC(A)}static encrypt(A){return new ZC(A)}static encryptData(A){return new OC(A)}static encryption(A){return new XC(A)}static encryptionMethod(A){return new VC(A)}static encryptionMethods(A){return new jC(A)}static event(A){return new zC(A)}static exData(A){return new _C(A)}static exObject(A){return new $C(A)}static exclGroup(A){return new AB(A)}static execute(A){return new eB(A)}static extras(A){return new tB(A)}static field(A){return new iB(A)}static fill(A){return new aB(A)}static filter(A){return new sB(A)}static float(A){return new nB(A)}static font(A){return new gB(A)}static format(A){return new rB(A)}static handler(A){return new oB(A)}static hyphenation(A){return new IB(A)}static image(A){return new cB(A)}static imageEdit(A){return new CB(A)}static integer(A){return new BB(A)}static issuers(A){return new hB(A)}static items(A){return new QB(A)}static keep(A){return new lB(A)}static keyUsage(A){return new EB(A)}static line(A){return new uB(A)}static linear(A){return new dB(A)}static lockDocument(A){return new fB(A)}static manifest(A){return new pB(A)}static margin(A){return new mB(A)}static mdp(A){return new yB(A)}static medium(A){return new wB(A)}static message(A){return new DB(A)}static numericEdit(A){return new bB(A)}static occur(A){return new kB(A)}static oid(A){return new FB(A)}static oids(A){return new SB(A)}static overflow(A){return new RB(A)}static pageArea(A){return new GB(A)}static pageSet(A){return new NB(A)}static para(A){return new xB(A)}static passwordEdit(A){return new UB(A)}static pattern(A){return new MB(A)}static picture(A){return new LB(A)}static proto(A){return new JB(A)}static radial(A){return new HB(A)}static reason(A){return new YB(A)}static reasons(A){return new vB(A)}static rectangle(A){return new KB(A)}static ref(A){return new qB(A)}static script(A){return new TB(A)}static setProperty(A){return new PB(A)}static signData(A){return new WB(A)}static signature(A){return new ZB(A)}static signing(A){return new OB(A)}static solid(A){return new XB(A)}static speak(A){return new VB(A)}static stipple(A){return new jB(A)}static subform(A){return new zB(A)}static subformSet(A){return new _B(A)}static subjectDN(A){return new $B(A)}static subjectDNs(A){return new Ah(A)}static submit(A){return new eh(A)}static template(A){return new th(A)}static text(A){return new ih(A)}static textEdit(A){return new ah(A)}static time(A){return new sh(A)}static timeStamp(A){return new nh(A)}static toolTip(A){return new gh(A)}static traversal(A){return new rh(A)}static traverse(A){return new oh(A)}static ui(A){return new Ih(A)}static validate(A){return new ch(A)}static value(A){return new Ch(A)}static variables(A){return new Bh(A)}}const Qh=wI.datasets.id;function lh(A){const e=new ih({});return e[Eo]=A,e}class Eh{constructor(A){this.root=A,this.datasets=A.datasets,this.data=A.datasets?.data||new lc(wI.datasets.id,"data"),this.emptyMerge=0===this.data[xo]().length,this.root.form=this.form=A.template[Qo]()}_isConsumeData(){return!this.emptyMerge&&this._mergeMode}_isMatchTemplate(){return!this._isConsumeData()}bind(){return this._bindElement(this.form,this.data),this.form}getData(){return this.data}_bindValue(A,e,t){if(A[uo]=e,A[vo]())if(e[Zo]()){const t=e[Ro]();A[QI](lh(t))}else if(A instanceof iB&&"multiSelect"===A.ui?.choiceList?.open){const t=e[xo]().map((A=>A[Eo].trim())).join("\n");A[QI](lh(t))}else this._isConsumeData()&&S("XFA - Nodes haven't the same type.");else!e[Zo]()||this._isMatchTemplate()?this._bindElement(A,e):S("XFA - Nodes haven't the same type.")}_findDataByNameToConsume(A,e,t,i){if(!A)return null;let a,s;for(let i=0;i<3;i++){for(a=t[No](A,!1,!0);s=a.next().value,s;)if(e===s[Zo]())return s;if(t[AI]===wI.datasets.id&&"data"===t[eI])break;t=t[Jo]()}return i?(a=this.data[No](A,!0,!1),s=a.next().value,s||(a=this.data[wo](A,!0),s=a.next().value,s?.[Zo]()?s:null)):null}_setProperties(A,e){if(A.hasOwnProperty("setProperty"))for(const{ref:t,target:i,connection:a}of A.setProperty.children){if(a)continue;if(!t)continue;const s=ZI(this.root,e,t,!1,!1);if(!s){S(`XFA - Invalid reference: ${t}.`);continue}const[n]=s;if(!n[Oo](this.data)){S("XFA - Invalid node: must be a data node.");continue}const g=ZI(this.root,A,i,!1,!1);if(!g){S(`XFA - Invalid target: ${i}.`);continue}const[r]=g;if(!r[Oo](A)){S("XFA - Invalid target: must be a property or subproperty.");continue}const o=r[Jo]();if(r instanceof PB||o instanceof PB){S("XFA - Invalid target: cannot be a setProperty or one of its properties.");continue}if(r instanceof QC||o instanceof QC){S("XFA - Invalid target: cannot be a bindItems or one of its properties.");continue}const I=n[EI](),c=r[eI];if(r instanceof Qc){const A=Object.create(null);A[c]=I;const e=Reflect.construct(Object.getPrototypeOf(o).constructor,[A]);o[c]=e[c]}else r.hasOwnProperty(Eo)?(r[uo]=n,r[Eo]=I,r[mo]()):S("XFA - Invalid node to use in setProperty")}}_bindItems(A,e){if(!A.hasOwnProperty("items")||!A.hasOwnProperty("bindItems")||A.bindItems.isEmpty())return;for(const e of A.items.children)A[oI](e);A.items.clear();const t=new QB({}),i=new QB({});A[Io](t),A.items.push(t),A[Io](i),A.items.push(i);for(const{ref:a,labelRef:s,valueRef:n,connection:g}of A.bindItems.children){if(g)continue;if(!a)continue;const A=ZI(this.root,e,a,!1,!1);if(A)for(const e of A){if(!e[Oo](this.datasets)){S(`XFA - Invalid ref (${a}): must be a datasets child.`);continue}const A=ZI(this.root,e,s,!0,!1);if(!A){S(`XFA - Invalid label: ${s}.`);continue}const[g]=A;if(!g[Oo](this.datasets)){S("XFA - Invalid label: must be a datasets child.");continue}const r=ZI(this.root,e,n,!0,!1);if(!r){S(`XFA - Invalid value: ${n}.`);continue}const[o]=r;if(!o[Oo](this.datasets)){S("XFA - Invalid value: must be a datasets child.");continue}const I=lh(g[EI]()),c=lh(o[EI]());t[Io](I),t.text.push(I),i[Io](c),i.text.push(c)}else S(`XFA - Invalid reference: ${a}.`)}}_bindOccurrences(A,e,t){let i;if(e.length>1&&(i=A[Qo](),i[oI](i.occur),i.occur=null),this._bindValue(A,e[0],t),this._setProperties(A,e[0]),this._bindItems(A,e[0]),1===e.length)return;const a=A[Jo](),s=A[eI],n=a[qo](A);for(let A=1,g=e.length;Ae.name===A.name)).length:t[i].children.length;const s=t[qo](A)+1,n=e.initial-a;if(n){const e=A[Qo]();e[oI](e.occur),e.occur=null,t[i].push(e),t[To](s,e);for(let A=1;A0)this._bindOccurrences(i,[A[0]],null);else if(this.emptyMerge){const A=e[AI]===Qh?-1:e[AI],t=i[uo]=new lc(A,i.name||"root");e[Io](t),this._bindElement(i,t)}continue}if(!i[Wo]())continue;let A=!1,a=null,s=null,n=null;if(i.bind){switch(i.bind.match){case"none":this._setAndBind(i,e);continue;case"global":A=!0;break;case"dataRef":if(!i.bind.ref){S(`XFA - ref is empty in node ${i[eI]}.`),this._setAndBind(i,e);continue}s=i.bind.ref}i.bind.picture&&(a=i.bind.picture[Eo])}const[g,r]=this._getOccurInfo(i);if(s){if(n=ZI(this.root,e,s,!0,!1),null===n){if(n=OI(this.data,e,s),!n)continue;this._isConsumeData()&&(n[lo]=!0),this._setAndBind(i,n);continue}this._isConsumeData()&&(n=n.filter((A=>!A[lo]))),n.length>r?n=n.slice(0,r):0===n.length&&(n=null),n&&this._isConsumeData()&&n.forEach((A=>{A[lo]=!0}))}else{if(!i.name){this._setAndBind(i,e);continue}if(this._isConsumeData()){const t=[];for(;t.length0?t:null}else{if(n=e[No](i.name,!1,this.emptyMerge).next().value,!n){if(0===g){t.push(i);continue}const A=e[AI]===Qh?-1:e[AI];n=i[uo]=new lc(A,i.name),this.emptyMerge&&(n[lo]=!0),e[Io](n),this._setAndBind(i,n);continue}this.emptyMerge&&(n[lo]=!0),n=[n]}}n?this._bindOccurrences(i,n,a):g>0?this._setAndBind(i,e):t.push(i)}t.forEach((A=>A[Jo]()[oI](A)))}}class uh{constructor(A,e){this.data=e,this.dataset=A.datasets||null}serialize(A){const e=[[-1,this.data[xo]()]];for(;e.length>0;){const t=e.at(-1),[i,a]=t;if(i+1===a.length){e.pop();continue}const s=a[++t[0]],n=A.get(s[mI]);if(n)s[QI](n);else{const e=s[Do]();for(const t of e.values()){const e=A.get(t[mI]);if(e){t[QI](e);break}}}const g=s[xo]();g.length>0&&e.push([-1,g])}const t=[''];if(this.dataset)for(const A of this.dataset[xo]())"data"!==A[eI]&&A[fI](t);return this.data[fI](t),t.push(""),t.join("")}}const dh=wI.config.id;class fh extends Bc{constructor(A){super(dh,"acrobat",!0),this.acrobat7=null,this.autoSave=null,this.common=null,this.validate=null,this.validateApprovalSignatures=null,this.submitUrl=new hc}}class ph extends Bc{constructor(A){super(dh,"acrobat7",!0),this.dynamicRender=null}}class mh extends uc{constructor(A){super(dh,"ADBE_JSConsole",["delegate","Enable","Disable"])}}class yh extends uc{constructor(A){super(dh,"ADBE_JSDebugger",["delegate","Enable","Disable"])}}class wh extends pc{constructor(A){super(dh,"addSilentPrint")}}class Dh extends pc{constructor(A){super(dh,"addViewerPreferences")}}class bh extends mc{constructor(A){super(dh,"adjustData")}}class kh extends fc{constructor(A){super(dh,"adobeExtensionLevel",0,(A=>A>=1&&A<=8))}}class Fh extends Bc{constructor(A){super(dh,"agent",!0),this.name=A.name?A.name.trim():"",this.common=new hc}}class Sh extends Ec{constructor(A){super(dh,"alwaysEmbed")}}class Rh extends dc{constructor(A){super(dh,"amd")}}class Gh extends Bc{constructor(A){super(dh,"area"),this.level=FI({data:A.level,defaultValue:0,validate:A=>A>=1&&A<=3}),this.name=GI(A.name,["","barcode","coreinit","deviceDriver","font","general","layout","merge","script","signature","sourceSet","templateCache"])}}class Nh extends uc{constructor(A){super(dh,"attributes",["preserve","delegate","ignore"])}}class xh extends uc{constructor(A){super(dh,"autoSave",["disabled","enabled"])}}class Uh extends dc{constructor(A){super(dh,"base")}}class Mh extends Bc{constructor(A){super(dh,"batchOutput"),this.format=GI(A.format,["none","concat","zip","zipCompress"])}}class Lh extends Ec{constructor(A){super(dh,"behaviorOverride")}[mo](){this[Eo]=new Map(this[Eo].trim().split(/\s+/).filter((A=>A.includes(":"))).map((A=>A.split(":",2))))}}class Jh extends Bc{constructor(A){super(dh,"cache",!0),this.templateCache=null}}class Hh extends pc{constructor(A){super(dh,"change")}}class Yh extends Bc{constructor(A){super(dh,"common",!0),this.data=null,this.locale=null,this.localeSet=null,this.messaging=null,this.suppressBanner=null,this.template=null,this.validationMessaging=null,this.versionControl=null,this.log=new hc}}class vh extends Bc{constructor(A){super(dh,"compress"),this.scope=GI(A.scope,["imageOnly","document"])}}class Kh extends pc{constructor(A){super(dh,"compressLogicalStructure")}}class qh extends mc{constructor(A){super(dh,"compressObjectStream")}}class Th extends Bc{constructor(A){super(dh,"compression",!0),this.compressLogicalStructure=null,this.compressObjectStream=null,this.level=null,this.type=null}}class Ph extends Bc{constructor(A){super(dh,"config",!0),this.acrobat=null,this.present=null,this.trace=null,this.agent=new hc}}class Wh extends uc{constructor(A){super(dh,"conformance",["A","B"])}}class Zh extends pc{constructor(A){super(dh,"contentCopy")}}class Oh extends fc{constructor(A){super(dh,"copies",1,(A=>A>=1))}}class Xh extends dc{constructor(A){super(dh,"creator")}}class Vh extends fc{constructor(A){super(dh,"currentPage",0,(A=>A>=0))}}class jh extends Bc{constructor(A){super(dh,"data",!0),this.adjustData=null,this.attributes=null,this.incrementalLoad=null,this.outputXSL=null,this.range=null,this.record=null,this.startNode=null,this.uri=null,this.window=null,this.xsl=null,this.excludeNS=new hc,this.transform=new hc}}class zh extends Bc{constructor(A){super(dh,"debug",!0),this.uri=null}}class _h extends Ec{constructor(A){super(dh,"defaultTypeface"),this.writingScript=GI(A.writingScript,["*","Arabic","Cyrillic","EastEuropeanRoman","Greek","Hebrew","Japanese","Korean","Roman","SimplifiedChinese","Thai","TraditionalChinese","Vietnamese"])}}class $h extends uc{constructor(A){super(dh,"destination",["pdf","pcl","ps","webClient","zpl"])}}class AQ extends pc{constructor(A){super(dh,"documentAssembly")}}class eQ extends Bc{constructor(A){super(dh,"driver",!0),this.name=A.name?A.name.trim():"",this.fontInfo=null,this.xdc=null}}class tQ extends uc{constructor(A){super(dh,"duplexOption",["simplex","duplexFlipLongEdge","duplexFlipShortEdge"])}}class iQ extends uc{constructor(A){super(dh,"dynamicRender",["forbidden","required"])}}class aQ extends pc{constructor(A){super(dh,"embed")}}class sQ extends pc{constructor(A){super(dh,"encrypt")}}class nQ extends Bc{constructor(A){super(dh,"encryption",!0),this.encrypt=null,this.encryptionLevel=null,this.permissions=null}}class gQ extends uc{constructor(A){super(dh,"encryptionLevel",["40bit","128bit"])}}class rQ extends dc{constructor(A){super(dh,"enforce")}}class oQ extends Bc{constructor(A){super(dh,"equate"),this.force=FI({data:A.force,defaultValue:1,validate:A=>0===A}),this.from=A.from||"",this.to=A.to||""}}class IQ extends Bc{constructor(A){super(dh,"equateRange"),this.from=A.from||"",this.to=A.to||"",this._unicodeRange=A.unicodeRange||""}get unicodeRange(){const A=[],e=/U\+([0-9a-fA-F]+)/,t=this._unicodeRange;for(let i of t.split(",").map((A=>A.trim())).filter((A=>!!A)))i=i.split("-",2).map((A=>{const t=A.match(e);return t?parseInt(t[1],16):0})),1===i.length&&i.push(i[0]),A.push(i);return x(this,"unicodeRange",A)}}class cQ extends Ec{constructor(A){super(dh,"exclude")}[mo](){this[Eo]=this[Eo].trim().split(/\s+/).filter((A=>A&&["calculate","close","enter","exit","initialize","ready","validate"].includes(A)))}}class CQ extends dc{constructor(A){super(dh,"excludeNS")}}class BQ extends uc{constructor(A){super(dh,"flipLabel",["usePrinterSetting","on","off"])}}class hQ extends Bc{constructor(A){super(dh,"fontInfo",!0),this.embed=null,this.map=null,this.subsetBelow=null,this.alwaysEmbed=new hc,this.defaultTypeface=new hc,this.neverEmbed=new hc}}class QQ extends pc{constructor(A){super(dh,"formFieldFilling")}}class lQ extends dc{constructor(A){super(dh,"groupParent")}}class EQ extends uc{constructor(A){super(dh,"ifEmpty",["dataValue","dataGroup","ignore","remove"])}}class uQ extends dc{constructor(A){super(dh,"includeXDPContent")}}class dQ extends uc{constructor(A){super(dh,"incrementalLoad",["none","forwardOnly"])}}class fQ extends pc{constructor(A){super(dh,"incrementalMerge")}}class pQ extends pc{constructor(A){super(dh,"interactive")}}class mQ extends uc{constructor(A){super(dh,"jog",["usePrinterSetting","none","pageSet"])}}class yQ extends Bc{constructor(A){super(dh,"labelPrinter",!0),this.name=GI(A.name,["zpl","dpl","ipl","tcpl"]),this.batchOutput=null,this.flipLabel=null,this.fontInfo=null,this.xdc=null}}class wQ extends uc{constructor(A){super(dh,"layout",["paginate","panel"])}}class DQ extends fc{constructor(A){super(dh,"level",0,(A=>A>0))}}class bQ extends pc{constructor(A){super(dh,"linearized")}}class kQ extends dc{constructor(A){super(dh,"locale")}}class FQ extends dc{constructor(A){super(dh,"localeSet")}}class SQ extends Bc{constructor(A){super(dh,"log",!0),this.mode=null,this.threshold=null,this.to=null,this.uri=null}}class RQ extends Bc{constructor(A){super(dh,"map",!0),this.equate=new hc,this.equateRange=new hc}}class GQ extends Bc{constructor(A){super(dh,"mediumInfo",!0),this.map=null}}class NQ extends Bc{constructor(A){super(dh,"message",!0),this.msgId=null,this.severity=null}}class xQ extends Bc{constructor(A){super(dh,"messaging",!0),this.message=new hc}}class UQ extends uc{constructor(A){super(dh,"mode",["append","overwrite"])}}class MQ extends pc{constructor(A){super(dh,"modifyAnnots")}}class LQ extends fc{constructor(A){super(dh,"msgId",1,(A=>A>=1))}}class JQ extends dc{constructor(A){super(dh,"nameAttr")}}class HQ extends Ec{constructor(A){super(dh,"neverEmbed")}}class YQ extends fc{constructor(A){super(dh,"numberOfCopies",null,(A=>A>=2&&A<=5))}}class vQ extends Bc{constructor(A){super(dh,"openAction",!0),this.destination=null}}class KQ extends Bc{constructor(A){super(dh,"output",!0),this.to=null,this.type=null,this.uri=null}}class qQ extends dc{constructor(A){super(dh,"outputBin")}}class TQ extends Bc{constructor(A){super(dh,"outputXSL",!0),this.uri=null}}class PQ extends uc{constructor(A){super(dh,"overprint",["none","both","draw","field"])}}class WQ extends dc{constructor(A){super(dh,"packets")}[mo](){"*"!==this[Eo]&&(this[Eo]=this[Eo].trim().split(/\s+/).filter((A=>["config","datasets","template","xfdf","xslt"].includes(A))))}}class ZQ extends Bc{constructor(A){super(dh,"pageOffset"),this.x=FI({data:A.x,defaultValue:"useXDCSetting",validate:A=>!0}),this.y=FI({data:A.y,defaultValue:"useXDCSetting",validate:A=>!0})}}class OQ extends dc{constructor(A){super(dh,"pageRange")}[mo](){const A=this[Eo].trim().split(/\s+/).map((A=>parseInt(A,10))),e=[];for(let t=0,i=A.length;t!1))}}class zQ extends Bc{constructor(A){super(dh,"pcl",!0),this.name=A.name||"",this.batchOutput=null,this.fontInfo=null,this.jog=null,this.mediumInfo=null,this.outputBin=null,this.pageOffset=null,this.staple=null,this.xdc=null}}class _Q extends Bc{constructor(A){super(dh,"pdf",!0),this.name=A.name||"",this.adobeExtensionLevel=null,this.batchOutput=null,this.compression=null,this.creator=null,this.encryption=null,this.fontInfo=null,this.interactive=null,this.linearized=null,this.openAction=null,this.pdfa=null,this.producer=null,this.renderPolicy=null,this.scriptModel=null,this.silentPrint=null,this.submitFormat=null,this.tagged=null,this.version=null,this.viewerPreferences=null,this.xdc=null}}class $Q extends Bc{constructor(A){super(dh,"pdfa",!0),this.amd=null,this.conformance=null,this.includeXDPContent=null,this.part=null}}class Al extends Bc{constructor(A){super(dh,"permissions",!0),this.accessibleContent=null,this.change=null,this.contentCopy=null,this.documentAssembly=null,this.formFieldFilling=null,this.modifyAnnots=null,this.plaintextMetadata=null,this.print=null,this.printHighQuality=null}}class el extends pc{constructor(A){super(dh,"pickTrayByPDFSize")}}class tl extends dc{constructor(A){super(dh,"picture")}}class il extends pc{constructor(A){super(dh,"plaintextMetadata")}}class al extends uc{constructor(A){super(dh,"presence",["preserve","dissolve","dissolveStructure","ignore","remove"])}}class sl extends Bc{constructor(A){super(dh,"present",!0),this.behaviorOverride=null,this.cache=null,this.common=null,this.copies=null,this.destination=null,this.incrementalMerge=null,this.layout=null,this.output=null,this.overprint=null,this.pagination=null,this.paginationOverride=null,this.script=null,this.validate=null,this.xdp=null,this.driver=new hc,this.labelPrinter=new hc,this.pcl=new hc,this.pdf=new hc,this.ps=new hc,this.submitUrl=new hc,this.webClient=new hc,this.zpl=new hc}}class nl extends pc{constructor(A){super(dh,"print")}}class gl extends pc{constructor(A){super(dh,"printHighQuality")}}class rl extends uc{constructor(A){super(dh,"printScaling",["appdefault","noScaling"])}}class ol extends dc{constructor(A){super(dh,"printerName")}}class Il extends dc{constructor(A){super(dh,"producer")}}class cl extends Bc{constructor(A){super(dh,"ps",!0),this.name=A.name||"",this.batchOutput=null,this.fontInfo=null,this.jog=null,this.mediumInfo=null,this.outputBin=null,this.staple=null,this.xdc=null}}class Cl extends Ec{constructor(A){super(dh,"range")}[mo](){this[Eo]=this[Eo].trim().split(/\s*,\s*/,2).map((A=>A.split("-").map((A=>parseInt(A.trim(),10))))).filter((A=>A.every((A=>!isNaN(A))))).map((A=>(1===A.length&&A.push(A[0]),A)))}}class Bl extends Ec{constructor(A){super(dh,"record")}[mo](){this[Eo]=this[Eo].trim();const A=parseInt(this[Eo],10);!isNaN(A)&&A>=0&&(this[Eo]=A)}}class hl extends Ec{constructor(A){super(dh,"relevant")}[mo](){this[Eo]=this[Eo].trim().split(/\s+/)}}class Ql extends Ec{constructor(A){super(dh,"rename")}[mo](){this[Eo]=this[Eo].trim(),(this[Eo].toLowerCase().startsWith("xml")||new RegExp("[\\p{L}_][\\p{L}\\d._\\p{M}-]*","u").test(this[Eo]))&&S("XFA - Rename: invalid XFA name")}}class ll extends uc{constructor(A){super(dh,"renderPolicy",["server","client"])}}class El extends uc{constructor(A){super(dh,"runScripts",["both","client","none","server"])}}class ul extends Bc{constructor(A){super(dh,"script",!0),this.currentPage=null,this.exclude=null,this.runScripts=null}}class dl extends uc{constructor(A){super(dh,"scriptModel",["XFA","none"])}}class fl extends uc{constructor(A){super(dh,"severity",["ignore","error","information","trace","warning"])}}class pl extends Bc{constructor(A){super(dh,"silentPrint",!0),this.addSilentPrint=null,this.printerName=null}}class ml extends Bc{constructor(A){super(dh,"staple"),this.mode=GI(A.mode,["usePrinterSetting","on","off"])}}class yl extends dc{constructor(A){super(dh,"startNode")}}class wl extends fc{constructor(A){super(dh,"startPage",0,(A=>!0))}}class Dl extends uc{constructor(A){super(dh,"submitFormat",["html","delegate","fdf","xml","pdf"])}}class bl extends dc{constructor(A){super(dh,"submitUrl")}}class kl extends fc{constructor(A){super(dh,"subsetBelow",100,(A=>A>=0&&A<=100))}}class Fl extends pc{constructor(A){super(dh,"suppressBanner")}}class Sl extends pc{constructor(A){super(dh,"tagged")}}class Rl extends Bc{constructor(A){super(dh,"template",!0),this.base=null,this.relevant=null,this.startPage=null,this.uri=null,this.xsl=null}}class Gl extends uc{constructor(A){super(dh,"threshold",["trace","error","information","warning"])}}class Nl extends uc{constructor(A){super(dh,"to",["null","memory","stderr","stdout","system","uri"])}}class xl extends Bc{constructor(A){super(dh,"templateCache"),this.maxEntries=FI({data:A.maxEntries,defaultValue:5,validate:A=>A>=0})}}class Ul extends Bc{constructor(A){super(dh,"trace",!0),this.area=new hc}}class Ml extends Bc{constructor(A){super(dh,"transform",!0),this.groupParent=null,this.ifEmpty=null,this.nameAttr=null,this.picture=null,this.presence=null,this.rename=null,this.whitespace=null}}class Ll extends uc{constructor(A){super(dh,"type",["none","ascii85","asciiHex","ccittfax","flate","lzw","runLength","native","xdp","mergedXDP"])}}class Jl extends dc{constructor(A){super(dh,"uri")}}class Hl extends uc{constructor(A){super(dh,"validate",["preSubmit","prePrint","preExecute","preSave"])}}class Yl extends Ec{constructor(A){super(dh,"validateApprovalSignatures")}[mo](){this[Eo]=this[Eo].trim().split(/\s+/).filter((A=>["docReady","postSign"].includes(A)))}}class vl extends uc{constructor(A){super(dh,"validationMessaging",["allMessagesIndividually","allMessagesTogether","firstMessageOnly","noMessages"])}}class Kl extends uc{constructor(A){super(dh,"version",["1.7","1.6","1.5","1.4","1.3","1.2"])}}class ql extends Bc{constructor(A){super(dh,"VersionControl"),this.outputBelow=GI(A.outputBelow,["warn","error","update"]),this.sourceAbove=GI(A.sourceAbove,["warn","error"]),this.sourceBelow=GI(A.sourceBelow,["update","maintain"])}}class Tl extends Bc{constructor(A){super(dh,"viewerPreferences",!0),this.ADBE_JSConsole=null,this.ADBE_JSDebugger=null,this.addViewerPreferences=null,this.duplexOption=null,this.enforce=null,this.numberOfCopies=null,this.pageRange=null,this.pickTrayByPDFSize=null,this.printScaling=null}}class Pl extends Bc{constructor(A){super(dh,"webClient",!0),this.name=A.name?A.name.trim():"",this.fontInfo=null,this.xdc=null}}class Wl extends uc{constructor(A){super(dh,"whitespace",["preserve","ltrim","normalize","rtrim","trim"])}}class Zl extends Ec{constructor(A){super(dh,"window")}[mo](){const A=this[Eo].trim().split(/\s*,\s*/,2).map((A=>parseInt(A,10)));A.some((A=>isNaN(A)))?this[Eo]=[0,0]:(1===A.length&&A.push(A[0]),this[Eo]=A)}}class Ol extends Bc{constructor(A){super(dh,"xdc",!0),this.uri=new hc,this.xsl=new hc}}class Xl extends Bc{constructor(A){super(dh,"xdp",!0),this.packets=null}}class Vl extends Bc{constructor(A){super(dh,"xsl",!0),this.debug=null,this.uri=null}}class jl extends Bc{constructor(A){super(dh,"zpl",!0),this.name=A.name?A.name.trim():"",this.batchOutput=null,this.flipLabel=null,this.fontInfo=null,this.xdc=null}}class zl{static[yI](A,e){if(zl.hasOwnProperty(A))return zl[A](e)}static acrobat(A){return new fh(A)}static acrobat7(A){return new ph(A)}static ADBE_JSConsole(A){return new mh(A)}static ADBE_JSDebugger(A){return new yh(A)}static addSilentPrint(A){return new wh(A)}static addViewerPreferences(A){return new Dh(A)}static adjustData(A){return new bh(A)}static adobeExtensionLevel(A){return new kh(A)}static agent(A){return new Fh(A)}static alwaysEmbed(A){return new Sh(A)}static amd(A){return new Rh(A)}static area(A){return new Gh(A)}static attributes(A){return new Nh(A)}static autoSave(A){return new xh(A)}static base(A){return new Uh(A)}static batchOutput(A){return new Mh(A)}static behaviorOverride(A){return new Lh(A)}static cache(A){return new Jh(A)}static change(A){return new Hh(A)}static common(A){return new Yh(A)}static compress(A){return new vh(A)}static compressLogicalStructure(A){return new Kh(A)}static compressObjectStream(A){return new qh(A)}static compression(A){return new Th(A)}static config(A){return new Ph(A)}static conformance(A){return new Wh(A)}static contentCopy(A){return new Zh(A)}static copies(A){return new Oh(A)}static creator(A){return new Xh(A)}static currentPage(A){return new Vh(A)}static data(A){return new jh(A)}static debug(A){return new zh(A)}static defaultTypeface(A){return new _h(A)}static destination(A){return new $h(A)}static documentAssembly(A){return new AQ(A)}static driver(A){return new eQ(A)}static duplexOption(A){return new tQ(A)}static dynamicRender(A){return new iQ(A)}static embed(A){return new aQ(A)}static encrypt(A){return new sQ(A)}static encryption(A){return new nQ(A)}static encryptionLevel(A){return new gQ(A)}static enforce(A){return new rQ(A)}static equate(A){return new oQ(A)}static equateRange(A){return new IQ(A)}static exclude(A){return new cQ(A)}static excludeNS(A){return new CQ(A)}static flipLabel(A){return new BQ(A)}static fontInfo(A){return new hQ(A)}static formFieldFilling(A){return new QQ(A)}static groupParent(A){return new lQ(A)}static ifEmpty(A){return new EQ(A)}static includeXDPContent(A){return new uQ(A)}static incrementalLoad(A){return new dQ(A)}static incrementalMerge(A){return new fQ(A)}static interactive(A){return new pQ(A)}static jog(A){return new mQ(A)}static labelPrinter(A){return new yQ(A)}static layout(A){return new wQ(A)}static level(A){return new DQ(A)}static linearized(A){return new bQ(A)}static locale(A){return new kQ(A)}static localeSet(A){return new FQ(A)}static log(A){return new SQ(A)}static map(A){return new RQ(A)}static mediumInfo(A){return new GQ(A)}static message(A){return new NQ(A)}static messaging(A){return new xQ(A)}static mode(A){return new UQ(A)}static modifyAnnots(A){return new MQ(A)}static msgId(A){return new LQ(A)}static nameAttr(A){return new JQ(A)}static neverEmbed(A){return new HQ(A)}static numberOfCopies(A){return new YQ(A)}static openAction(A){return new vQ(A)}static output(A){return new KQ(A)}static outputBin(A){return new qQ(A)}static outputXSL(A){return new TQ(A)}static overprint(A){return new PQ(A)}static packets(A){return new WQ(A)}static pageOffset(A){return new ZQ(A)}static pageRange(A){return new OQ(A)}static pagination(A){return new XQ(A)}static paginationOverride(A){return new VQ(A)}static part(A){return new jQ(A)}static pcl(A){return new zQ(A)}static pdf(A){return new _Q(A)}static pdfa(A){return new $Q(A)}static permissions(A){return new Al(A)}static pickTrayByPDFSize(A){return new el(A)}static picture(A){return new tl(A)}static plaintextMetadata(A){return new il(A)}static presence(A){return new al(A)}static present(A){return new sl(A)}static print(A){return new nl(A)}static printHighQuality(A){return new gl(A)}static printScaling(A){return new rl(A)}static printerName(A){return new ol(A)}static producer(A){return new Il(A)}static ps(A){return new cl(A)}static range(A){return new Cl(A)}static record(A){return new Bl(A)}static relevant(A){return new hl(A)}static rename(A){return new Ql(A)}static renderPolicy(A){return new ll(A)}static runScripts(A){return new El(A)}static script(A){return new ul(A)}static scriptModel(A){return new dl(A)}static severity(A){return new fl(A)}static silentPrint(A){return new pl(A)}static staple(A){return new ml(A)}static startNode(A){return new yl(A)}static startPage(A){return new wl(A)}static submitFormat(A){return new Dl(A)}static submitUrl(A){return new bl(A)}static subsetBelow(A){return new kl(A)}static suppressBanner(A){return new Fl(A)}static tagged(A){return new Sl(A)}static template(A){return new Rl(A)}static templateCache(A){return new xl(A)}static threshold(A){return new Gl(A)}static to(A){return new Nl(A)}static trace(A){return new Ul(A)}static transform(A){return new Ml(A)}static type(A){return new Ll(A)}static uri(A){return new Jl(A)}static validate(A){return new Hl(A)}static validateApprovalSignatures(A){return new Yl(A)}static validationMessaging(A){return new vl(A)}static version(A){return new Kl(A)}static versionControl(A){return new ql(A)}static viewerPreferences(A){return new Tl(A)}static webClient(A){return new Pl(A)}static whitespace(A){return new Wl(A)}static window(A){return new Zl(A)}static xdc(A){return new Ol(A)}static xdp(A){return new Xl(A)}static xsl(A){return new Vl(A)}static zpl(A){return new jl(A)}}const _l=wI.connectionSet.id;class $l extends Bc{constructor(A){super(_l,"connectionSet",!0),this.wsdlConnection=new hc,this.xmlConnection=new hc,this.xsdConnection=new hc}}class AE extends Bc{constructor(A){super(_l,"effectiveInputPolicy"),this.id=A.id||"",this.name=A.name||"",this.use=A.use||"",this.usehref=A.usehref||""}}class eE extends Bc{constructor(A){super(_l,"effectiveOutputPolicy"),this.id=A.id||"",this.name=A.name||"",this.use=A.use||"",this.usehref=A.usehref||""}}class tE extends dc{constructor(A){super(_l,"operation"),this.id=A.id||"",this.input=A.input||"",this.name=A.name||"",this.output=A.output||"",this.use=A.use||"",this.usehref=A.usehref||""}}class iE extends dc{constructor(A){super(_l,"rootElement"),this.id=A.id||"",this.name=A.name||"",this.use=A.use||"",this.usehref=A.usehref||""}}class aE extends dc{constructor(A){super(_l,"soapAction"),this.id=A.id||"",this.name=A.name||"",this.use=A.use||"",this.usehref=A.usehref||""}}class sE extends dc{constructor(A){super(_l,"soapAddress"),this.id=A.id||"",this.name=A.name||"",this.use=A.use||"",this.usehref=A.usehref||""}}class nE extends dc{constructor(A){super(_l,"uri"),this.id=A.id||"",this.name=A.name||"",this.use=A.use||"",this.usehref=A.usehref||""}}class gE extends dc{constructor(A){super(_l,"wsdlAddress"),this.id=A.id||"",this.name=A.name||"",this.use=A.use||"",this.usehref=A.usehref||""}}class rE extends Bc{constructor(A){super(_l,"wsdlConnection",!0),this.dataDescription=A.dataDescription||"",this.name=A.name||"",this.effectiveInputPolicy=null,this.effectiveOutputPolicy=null,this.operation=null,this.soapAction=null,this.soapAddress=null,this.wsdlAddress=null}}class oE extends Bc{constructor(A){super(_l,"xmlConnection",!0),this.dataDescription=A.dataDescription||"",this.name=A.name||"",this.uri=null}}class IE extends Bc{constructor(A){super(_l,"xsdConnection",!0),this.dataDescription=A.dataDescription||"",this.name=A.name||"",this.rootElement=null,this.uri=null}}class cE{static[yI](A,e){if(cE.hasOwnProperty(A))return cE[A](e)}static connectionSet(A){return new $l(A)}static effectiveInputPolicy(A){return new AE(A)}static effectiveOutputPolicy(A){return new eE(A)}static operation(A){return new tE(A)}static rootElement(A){return new iE(A)}static soapAction(A){return new aE(A)}static soapAddress(A){return new sE(A)}static uri(A){return new nE(A)}static wsdlAddress(A){return new gE(A)}static wsdlConnection(A){return new rE(A)}static xmlConnection(A){return new oE(A)}static xsdConnection(A){return new IE(A)}}const CE=wI.datasets.id;class BE extends lc{constructor(A){super(CE,"data",A)}[Xo](){return!0}}class hE extends Bc{constructor(A){super(CE,"datasets",!0),this.data=null,this.Signature=null}[iI](A){const e=A[eI];("data"===e&&A[AI]===CE||"Signature"===e&&A[AI]===wI.signature.id)&&(this[e]=A),this[Io](A)}}class QE{static[yI](A,e){if(QE.hasOwnProperty(A))return QE[A](e)}static datasets(A){return new hE(A)}static data(A){return new BE(A)}}const lE=wI.localeSet.id;class EE extends Bc{constructor(A){super(lE,"calendarSymbols",!0),this.name="gregorian",this.dayNames=new hc(2),this.eraNames=null,this.meridiemNames=null,this.monthNames=new hc(2)}}class uE extends dc{constructor(A){super(lE,"currencySymbol"),this.name=GI(A.name,["symbol","isoname","decimal"])}}class dE extends Bc{constructor(A){super(lE,"currencySymbols",!0),this.currencySymbol=new hc(3)}}class fE extends dc{constructor(A){super(lE,"datePattern"),this.name=GI(A.name,["full","long","med","short"])}}class pE extends Bc{constructor(A){super(lE,"datePatterns",!0),this.datePattern=new hc(4)}}class mE extends Ec{constructor(A){super(lE,"dateTimeSymbols")}}class yE extends dc{constructor(A){super(lE,"day")}}class wE extends Bc{constructor(A){super(lE,"dayNames",!0),this.abbr=FI({data:A.abbr,defaultValue:0,validate:A=>1===A}),this.day=new hc(7)}}class DE extends dc{constructor(A){super(lE,"era")}}class bE extends Bc{constructor(A){super(lE,"eraNames",!0),this.era=new hc(2)}}class kE extends Bc{constructor(A){super(lE,"locale",!0),this.desc=A.desc||"",this.name="isoname",this.calendarSymbols=null,this.currencySymbols=null,this.datePatterns=null,this.dateTimeSymbols=null,this.numberPatterns=null,this.numberSymbols=null,this.timePatterns=null,this.typeFaces=null}}class FE extends Bc{constructor(A){super(lE,"localeSet",!0),this.locale=new hc}}class SE extends dc{constructor(A){super(lE,"meridiem")}}class RE extends Bc{constructor(A){super(lE,"meridiemNames",!0),this.meridiem=new hc(2)}}class GE extends dc{constructor(A){super(lE,"month")}}class NE extends Bc{constructor(A){super(lE,"monthNames",!0),this.abbr=FI({data:A.abbr,defaultValue:0,validate:A=>1===A}),this.month=new hc(12)}}class xE extends dc{constructor(A){super(lE,"numberPattern"),this.name=GI(A.name,["full","long","med","short"])}}class UE extends Bc{constructor(A){super(lE,"numberPatterns",!0),this.numberPattern=new hc(4)}}class ME extends dc{constructor(A){super(lE,"numberSymbol"),this.name=GI(A.name,["decimal","grouping","percent","minus","zero"])}}class LE extends Bc{constructor(A){super(lE,"numberSymbols",!0),this.numberSymbol=new hc(5)}}class JE extends dc{constructor(A){super(lE,"timePattern"),this.name=GI(A.name,["full","long","med","short"])}}class HE extends Bc{constructor(A){super(lE,"timePatterns",!0),this.timePattern=new hc(4)}}class YE extends Bc{constructor(A){super(lE,"typeFace",!0),this.name=""|A.name}}class vE extends Bc{constructor(A){super(lE,"typeFaces",!0),this.typeFace=new hc}}class KE{static[yI](A,e){if(KE.hasOwnProperty(A))return KE[A](e)}static calendarSymbols(A){return new EE(A)}static currencySymbol(A){return new uE(A)}static currencySymbols(A){return new dE(A)}static datePattern(A){return new fE(A)}static datePatterns(A){return new pE(A)}static dateTimeSymbols(A){return new mE(A)}static day(A){return new yE(A)}static dayNames(A){return new wE(A)}static era(A){return new DE(A)}static eraNames(A){return new bE(A)}static locale(A){return new kE(A)}static localeSet(A){return new FE(A)}static meridiem(A){return new SE(A)}static meridiemNames(A){return new RE(A)}static month(A){return new GE(A)}static monthNames(A){return new NE(A)}static numberPattern(A){return new xE(A)}static numberPatterns(A){return new UE(A)}static numberSymbol(A){return new ME(A)}static numberSymbols(A){return new LE(A)}static timePattern(A){return new JE(A)}static timePatterns(A){return new HE(A)}static typeFace(A){return new YE(A)}static typeFaces(A){return new vE(A)}}const qE=wI.signature.id;class TE extends Bc{constructor(A){super(qE,"signature",!0)}}class PE{static[yI](A,e){if(PE.hasOwnProperty(A))return PE[A](e)}static signature(A){return new TE(A)}}const WE=wI.stylesheet.id;class ZE extends Bc{constructor(A){super(WE,"stylesheet",!0)}}class OE{static[yI](A,e){if(OE.hasOwnProperty(A))return OE[A](e)}static stylesheet(A){return new ZE(A)}}const XE=wI.xdp.id;class VE extends Bc{constructor(A){super(XE,"xdp",!0),this.uuid=A.uuid||"",this.timeStamp=A.timeStamp||"",this.config=null,this.connectionSet=null,this.datasets=null,this.localeSet=null,this.stylesheet=new hc,this.template=null}[aI](A){const e=wI[A[eI]];return e&&A[AI]===e.id}}class jE{static[yI](A,e){if(jE.hasOwnProperty(A))return jE[A](e)}static xdp(A){return new VE(A)}}const zE=wI.xhtml.id,_E=Symbol(),$E=new Set(["color","font","font-family","font-size","font-stretch","font-style","font-weight","margin","margin-bottom","margin-left","margin-right","margin-top","letter-spacing","line-height","orphans","page-break-after","page-break-before","page-break-inside","tab-interval","tab-stop","text-align","text-decoration","text-indent","vertical-align","widows","kerning-mode","xfa-font-horizontal-scale","xfa-font-vertical-scale","xfa-spacerun","xfa-tab-stops"]),Au=new Map([["page-break-after","breakAfter"],["page-break-before","breakBefore"],["page-break-inside","breakInside"],["kerning-mode",A=>"none"===A?"none":"normal"],["xfa-font-horizontal-scale",A=>`scaleX(${Math.max(0,Math.min(parseInt(A)/100)).toFixed(2)})`],["xfa-font-vertical-scale",A=>`scaleY(${Math.max(0,Math.min(parseInt(A)/100)).toFixed(2)})`],["xfa-spacerun",""],["xfa-tab-stops",""],["font-size",(A,e)=>yc(.99*(A=e.fontSize=NI(A)))],["letter-spacing",A=>yc(NI(A))],["line-height",A=>yc(NI(A))],["margin",A=>yc(NI(A))],["margin-bottom",A=>yc(NI(A))],["margin-left",A=>yc(NI(A))],["margin-right",A=>yc(NI(A))],["margin-top",A=>yc(NI(A))],["text-indent",A=>yc(NI(A))],["font-family",A=>A],["vertical-align",A=>yc(NI(A))]]),eu=/\s+/g,tu=/[\r\n]+/g,iu=/\r\n?/g;function au(A,e,t){const i=Object.create(null);if(!A)return i;const a=Object.create(null);for(const[e,t]of A.split(";").map((A=>A.split(":",2)))){const A=Au.get(e);if(""===A)continue;let s=t;A&&(s="string"==typeof A?A:A(t,a)),e.endsWith("scale")?i.transform=i.transform?`${i[e]} ${s}`:s:i[e.replaceAll(/-([a-zA-Z])/g,((A,e)=>e.toUpperCase()))]=s}if(i.fontFamily&&Hc({typeface:i.fontFamily,weight:i.fontWeight||"normal",posture:i.fontStyle||"normal",size:a.fontSize||0},e,e[Yo].fontFinder,i),t&&i.verticalAlign&&"0px"!==i.verticalAlign&&i.fontSize){const A=.583,e=.333,t=NI(i.fontSize);i.fontSize=yc(t*A),i.verticalAlign=yc(Math.sign(NI(i.verticalAlign))*t*e)}return t&&i.fontSize&&(i.fontSize=`calc(${i.fontSize} * var(--scale-factor))`),xc(i),i}const su=new Set(["body","html"]);class nu extends lc{constructor(A,e){super(zE,e),this[_E]=!1,this.style=A.style||""}[Co](A){var e;super[Co](A),this.style=(e=this).style?e.style.trim().split(/\s*;\s*/).filter((A=>!!A)).map((A=>A.split(/\s*:\s*/,2))).filter((([A,t])=>("font-family"===A&&e[Yo].usedTypefaces.add(t),$E.has(A)))).map((A=>A.join(":"))).join(";"):""}[ro](){return!su.has(this[eI])}[sI](A,e=!1){e?this[_E]=!0:(A=A.replaceAll(tu,""),this.style.includes("xfa-spacerun:yes")||(A=A.replaceAll(eu," "))),A&&(this[Eo]+=A)}[nI](A,e=!0){const t=Object.create(null),i={top:NaN,bottom:NaN,left:NaN,right:NaN};let a=null;for(const[A,e]of this.style.split(";").map((A=>A.split(":",2))))switch(A){case"font-family":t.typeface=kI(e);break;case"font-size":t.size=NI(e);break;case"font-weight":t.weight=e;break;case"font-style":t.posture=e;break;case"letter-spacing":t.letterSpacing=NI(e);break;case"margin":const A=e.split(/ \t/).map((A=>NI(A)));switch(A.length){case 1:i.top=i.bottom=i.left=i.right=A[0];break;case 2:i.top=i.bottom=A[0],i.left=i.right=A[1];break;case 3:i.top=A[0],i.bottom=A[2],i.left=i.right=A[1];break;case 4:i.top=A[0],i.left=A[1],i.bottom=A[2],i.right=A[3]}break;case"margin-top":i.top=NI(e);break;case"margin-bottom":i.bottom=NI(e);break;case"margin-left":i.left=NI(e);break;case"margin-right":i.right=NI(e);break;case"line-height":a=NI(e)}if(A.pushData(t,i,a),this[Eo])A.addString(this[Eo]);else for(const e of this[xo]())"#text"!==e[eI]?e[nI](A):A.addString(e[Eo]);e&&A.popFont()}[dI](A){const e=[];if(this[po]={children:e},this[co]({}),0===e.length&&!this[Eo])return MI.EMPTY;let t;return t=this[_E]?this[Eo]?this[Eo].replaceAll(iu,"\n"):void 0:this[Eo]||void 0,MI.success({name:this[eI],attributes:{href:this.href,style:au(this.style,this,this[_E])},children:e,value:t})}}class gu extends nu{constructor(A){super(A,"a"),this.href=Yc(A.href)||""}}class ru extends nu{constructor(A){super(A,"b")}[nI](A){A.pushFont({weight:"bold"}),super[nI](A),A.popFont()}}class ou extends nu{constructor(A){super(A,"body")}[dI](A){const e=super[dI](A),{html:t}=e;return t?(t.name="div",t.attributes.class=["xfaRich"],e):MI.EMPTY}}class Iu extends nu{constructor(A){super(A,"br")}[EI](){return"\n"}[nI](A){A.addString("\n")}[dI](A){return MI.success({name:"br"})}}class cu extends nu{constructor(A){super(A,"html")}[dI](A){const e=[];if(this[po]={children:e},this[co]({}),0===e.length)return MI.success({name:"div",attributes:{class:["xfaRich"],style:{}},value:this[Eo]||""});if(1===e.length){const A=e[0];if(A.attributes?.class.includes("xfaRich"))return MI.success(A)}return MI.success({name:"div",attributes:{class:["xfaRich"],style:{}},children:e})}}class Cu extends nu{constructor(A){super(A,"i")}[nI](A){A.pushFont({posture:"italic"}),super[nI](A),A.popFont()}}class Bu extends nu{constructor(A){super(A,"li")}}class hu extends nu{constructor(A){super(A,"ol")}}class Qu extends nu{constructor(A){super(A,"p")}[nI](A){super[nI](A,!1),A.addString("\n"),A.addPara(),A.popFont()}[EI](){return this[Jo]()[xo]().at(-1)===this?super[EI]():super[EI]()+"\n"}}class lu extends nu{constructor(A){super(A,"span")}}class Eu extends nu{constructor(A){super(A,"sub")}}class uu extends nu{constructor(A){super(A,"sup")}}class du extends nu{constructor(A){super(A,"ul")}}class fu{static[yI](A,e){if(fu.hasOwnProperty(A))return fu[A](e)}static a(A){return new gu(A)}static b(A){return new ru(A)}static body(A){return new ou(A)}static br(A){return new Iu(A)}static html(A){return new cu(A)}static i(A){return new Cu(A)}static li(A){return new Bu(A)}static ol(A){return new hu(A)}static p(A){return new Qu(A)}static span(A){return new lu(A)}static sub(A){return new Eu(A)}static sup(A){return new uu(A)}static ul(A){return new du(A)}}const pu={config:zl,connection:cE,datasets:QE,localeSet:KE,signature:PE,stylesheet:OE,template:hh,xdp:jE,xhtml:fu};class mu{constructor(A){this.namespaceId=A}[yI](A,e){return new lc(this.namespaceId,A,e)}}class yu extends Bc{constructor(A){super(-1,"root",Object.create(null)),this.element=null,this[Ko]=A}[iI](A){return this.element=A,!0}[mo](){super[mo](),this.element.template instanceof th&&(this[Ko].set(II,this.element),this.element.template[cI](this[Ko]),this.element.template[Ko]=this[Ko])}}class wu extends Bc{constructor(){super(-1,"",Object.create(null))}[iI](A){return!1}}class Du{constructor(A=null){this._namespaceStack=[],this._nsAgnosticLevel=0,this._namespacePrefixes=new Map,this._namespaces=new Map,this._nextNsId=Math.max(...Object.values(wI).map((({id:A})=>A))),this._currentNamespace=A||new mu(++this._nextNsId)}buildRoot(A){return new yu(A)}build({nsPrefix:A,name:e,attributes:t,namespace:i,prefixes:a}){const s=null!==i;if(s&&(this._namespaceStack.push(this._currentNamespace),this._currentNamespace=this._searchNamespace(i)),a&&this._addNamespacePrefix(a),t.hasOwnProperty(tI)){const A=pu.datasets,e=t[tI];let i=null;for(const[t,a]of Object.entries(e))if(this._getNamespaceToUse(t)===A){i={xfa:a};break}i?t[tI]=i:delete t[tI]}const n=this._getNamespaceToUse(A),g=n?.[yI](e,t)||new wu;return g[Xo]()&&this._nsAgnosticLevel++,(s||a||g[Xo]())&&(g[ho]={hasNamespace:s,prefixes:a,nsAgnostic:g[Xo]()}),g}isNsAgnostic(){return this._nsAgnosticLevel>0}_searchNamespace(A){let e=this._namespaces.get(A);if(e)return e;for(const[t,{check:i}]of Object.entries(wI))if(i(A)){if(e=pu[t],e)return this._namespaces.set(A,e),e;break}return e=new mu(++this._nextNsId),this._namespaces.set(A,e),e}_addNamespacePrefix(A){for(const{prefix:e,value:t}of A){const A=this._searchNamespace(t);let i=this._namespacePrefixes.get(e);i||(i=[],this._namespacePrefixes.set(e,i)),i.push(A)}}_getNamespaceToUse(A){if(!A)return this._currentNamespace;const e=this._namespacePrefixes.get(A);return e?.length>0?e.at(-1):(S(`Unknown namespace prefix: ${A}.`),null)}clean(A){const{hasNamespace:e,prefixes:t,nsAgnostic:i}=A;e&&(this._currentNamespace=this._namespaceStack.pop()),t&&t.forEach((({prefix:A})=>{this._namespacePrefixes.get(A).pop()})),i&&this._nsAgnosticLevel--}}class bu extends wr{constructor(A=null,e=!1){super(),this._builder=new Du(A),this._stack=[],this._globalData={usedTypefaces:new Set},this._ids=new Map,this._current=this._builder.buildRoot(this._ids),this._errorCode=0,this._whiteRegex=/^\s+$/,this._nbsps=/\xa0+/g,this._richText=e}parse(A){if(this.parseXml(A),0===this._errorCode)return this._current[mo](),this._current.element}onText(A){A=A.replace(this._nbsps,(A=>A.slice(1)+" ")),this._richText||this._current[ro]()?this._current[sI](A,this._richText):this._whiteRegex.test(A)||this._current[sI](A.trim())}onCdata(A){this._current[sI](A)}_mkAttributes(A,e){let t=null,i=null;const a=Object.create({});for(const{name:s,value:n}of A)if("xmlns"===s)t?S(`XFA - multiple namespace definition in <${e}>`):t=n;else if(s.startsWith("xmlns:")){const A=s.substring(6);i||(i=[]),i.push({prefix:A,value:n})}else{const A=s.indexOf(":");if(-1===A)a[s]=n;else{let e=a[tI];e||(e=a[tI]=Object.create(null));const[t,i]=[s.slice(0,A),s.slice(A+1)];(e[t]||=Object.create(null))[i]=n}}return[t,i,a]}_getNameAndPrefix(A,e){const t=A.indexOf(":");return-1===t?[A,null]:[A.substring(t+1),e?"":A.substring(0,t)]}onBeginElement(A,e,t){const[i,a,s]=this._mkAttributes(e,A),[n,g]=this._getNameAndPrefix(A,this._builder.isNsAgnostic()),r=this._builder.build({nsPrefix:g,name:n,attributes:s,namespace:i,prefixes:a});if(r[Yo]=this._globalData,t)return r[mo](),this._current[iI](r)&&r[BI](this._ids),void r[Co](this._builder);this._stack.push(this._current),this._current=r}onEndElement(A){const e=this._current;if(e[Po]()&&"string"==typeof e[Eo]){const A=new bu;A._globalData=this._globalData;const t=A.parse(e[Eo]);e[Eo]=null,e[iI](t)}e[mo](),this._current=this._stack.pop(),this._current[iI](e)&&e[BI](this._ids),e[Co](this._builder)}onError(A){this._errorCode=A}}class ku{constructor(A){try{this.root=(new bu).parse(ku._createDocument(A));const e=new Eh(this.root);this.form=e.bind(),this.dataHandler=new uh(this.root,e.getData()),this.form[Yo].template=this.form}catch(A){S(`XFA - an error occurred during parsing and binding: ${A}`)}}isValid(){return this.root&&this.form}_createPagesHelper(){const A=this.form[uI]();return new Promise(((e,t)=>{const i=()=>{try{const t=A.next();t.done?e(t.value):setTimeout(i,0)}catch(A){t(A)}};setTimeout(i,0)}))}async _createPages(){try{this.pages=await this._createPagesHelper(),this.dims=this.pages.children.map((A=>{const{width:e,height:t}=A.attributes.style;return[0,0,parseInt(e),parseInt(t)]}))}catch(A){S(`XFA - an error occurred during layout: ${A}`)}}getBoundingBox(A){return this.dims[A]}async getNumPages(){return this.pages||await this._createPages(),this.dims.length}setImages(A){this.form[Yo].images=A}setFonts(A){this.form[Yo].fontFinder=new LI(A);const e=[];for(let A of this.form[Yo].usedTypefaces)A=kI(A),this.form[Yo].fontFinder.find(A)||e.push(A);return e.length>0?e:null}appendFonts(A,e){this.form[Yo].fontFinder.add(A,e)}async getPages(){this.pages||await this._createPages();const A=this.pages;return this.pages=null,A}serializeData(A){return this.dataHandler.serialize(A)}static _createDocument(A){return A["/xdp:xdp"]?Object.values(A).join(""):A["xdp:xdp"]}static getRichTextAsHtml(A){if(!A||"string"!=typeof A)return null;try{let e=new bu(fu,!0).parse(A);if(!["body","xhtml"].includes(e[eI])){const A=fu.body({});A[Io](e),e=A}const t=e[dI]();if(!t.success)return null;const{html:i}=t,{attributes:a}=i;return a&&(a.class&&(a.class=a.class.filter((A=>!A.startsWith("xfa")))),a.dir="auto"),{html:i,str:e[EI]()}}catch(A){S(`XFA - an error occurred during parsing of rich text: ${A}`)}return null}}class Fu{static createGlobals(A){return Promise.all([A.ensureCatalog("acroForm"),A.ensureDoc("xfaDatasets"),A.ensureCatalog("structTreeRoot"),A.ensureCatalog("baseUrl"),A.ensureCatalog("attachments")]).then((([e,t,i,a,s])=>({pdfManager:A,acroForm:e instanceof cA?e:cA.empty,xfaDatasets:t,structTreeRoot:i,baseUrl:a,attachments:s})),(A=>(S(`createGlobals: "${A}".`),null)))}static async create(A,e,t,i,a,s){const n=a?await this._getPageIndex(A,e,t.pdfManager):null;return t.pdfManager.ensure(this,"_create",[A,e,t,i,a,n,s])}static _create(A,e,t,i,a=!1,s=null,n=null){const g=A.fetchIfRef(e);if(!(g instanceof cA))return;const{acroForm:r,pdfManager:o}=t,I=e instanceof CA?e.toString():`annot_${i.createObjId()}`;let c=g.get("Subtype");c=c instanceof rA?c.name:null;const C={xref:A,ref:e,dict:g,subtype:c,id:I,annotationGlobals:t,collectFields:a,needAppearances:!a&&!0===r.get("NeedAppearances"),pageIndex:s,evaluatorOptions:o.evaluatorOptions,pageRef:n};switch(c){case"Link":return new qu(C);case"Text":return new Ku(C);case"Widget":let A=kA({dict:g,key:"FT"});switch(A=A instanceof rA?A.name:null,A){case"Tx":return new Ju(C);case"Btn":return new Hu(C);case"Ch":return new Yu(C);case"Sig":return new vu(C)}return S(`Unimplemented widget field type "${A}", falling back to base field type.`),new Lu(C);case"Popup":return new Tu(C);case"FreeText":return new Pu(C);case"Line":return new Wu(C);case"Square":return new Zu(C);case"Circle":return new Ou(C);case"PolyLine":return new Xu(C);case"Polygon":return new Vu(C);case"Caret":return new ju(C);case"Ink":return new zu(C);case"Highlight":return new _u(C);case"Underline":return new $u(C);case"Squiggly":return new Ad(C);case"StrikeOut":return new ed(C);case"Stamp":return new td(C);case"FileAttachment":return new id(C);default:return a||S(c?`Unimplemented annotation type "${c}", falling back to base annotation.`:"Annotation is missing the required /Subtype."),new xu(C)}}static async _getPageIndex(A,e,t){try{const i=await A.fetchIfRefAsync(e);if(!(i instanceof cA))return-1;const a=i.getRaw("P");if(a instanceof CA)try{return await t.ensureCatalog("getPageIndex",[a])}catch(A){F(`_getPageIndex -- not a valid page reference: "${A}".`)}if(i.has("Kids"))return-1;const s=await t.ensureDoc("numPages");for(let A=0;AA/255))}function Gu(A,e){const t=A.getArray("QuadPoints");if(!MA(t,null)||0===t.length||t.length%8>0)return null;const i=new Float32Array(t.length);for(let A=0,a=t.length;Ae[2]||he[3]))return null;i.set([C,Q,B,Q,C,h,B,h],A)}return i}function Nu(A,e,t){const[i,a,s,n]=X.getAxialAlignedBoundingBox(e,t);if(i===s||a===n)return[1,0,0,1,A[0],A[1]];const g=(A[2]-A[0])/(s-i),r=(A[3]-A[1])/(n-a);return[g,0,0,r,A[0]-i*g,A[1]-a*r]}class xu{constructor(A){const{dict:e,xref:t,annotationGlobals:i}=A;this.setTitle(e.get("T")),this.setContents(e.get("Contents")),this.setModificationDate(e.get("M")),this.setFlags(e.get("F")),this.setRectangle(e.getArray("Rect")),this.setColor(e.getArray("C")),this.setBorderStyle(e),this.setAppearance(e),this.setOptionalContent(e);const a=e.get("MK");this.setBorderAndBackgroundColors(a),this.setRotation(a,e),this.ref=A.ref instanceof CA?A.ref:null,this._streams=[],this.appearance&&this._streams.push(this.appearance);const s=!!(128&this.flags),n=!!(512&this.flags);if(i.structTreeRoot){let t=e.get("StructParent");t=Number.isInteger(t)&&t>=0?t:-1,i.structTreeRoot.addAnnotationIdToPage(A.pageRef,t)}if(this.data={annotationFlags:this.flags,borderStyle:this.borderStyle,color:this.color,backgroundColor:this.backgroundColor,borderColor:this.borderColor,rotation:this.rotation,contentsObj:this._contents,hasAppearance:!!this.appearance,id:A.id,modificationDate:this.modificationDate,rect:this.rectangle,subtype:A.subtype,hasOwnCanvas:!1,noRotate:!!(16&this.flags),noHTML:s&&n,isEditable:!1},A.collectFields){const i=e.get("Kids");if(Array.isArray(i)){const A=[];for(const e of i)e instanceof CA&&A.push(e.toString());0!==A.length&&(this.data.kidIds=A)}this.data.actions=TA(t,e,C),this.data.fieldName=this._constructFieldName(e),this.data.pageIndex=A.pageIndex}this._isOffscreenCanvasSupported=A.evaluatorOptions.isOffscreenCanvasSupported,this._fallbackFontDict=null,this._needAppearances=!1}_hasFlag(A,e){return!!(A&e)}_isViewable(A){return!this._hasFlag(A,1)&&!this._hasFlag(A,32)}_isPrintable(A){return this._hasFlag(A,4)&&!this._hasFlag(A,2)&&!this._hasFlag(A,1)}mustBeViewed(A,e){const t=A?.get(this.data.id)?.noView;return void 0!==t?!t:this.viewable&&!this._hasFlag(this.flags,2)}mustBePrinted(A){const e=A?.get(this.data.id)?.noPrint;return void 0!==e?!e:this.printable}mustBeViewedWhenEditing(A,e=null){return A?!this.data.isEditable:!e?.has(this.data.id)}get viewable(){return null!==this.data.quadPoints&&(0===this.flags||this._isViewable(this.flags))}get printable(){return null!==this.data.quadPoints&&0!==this.flags&&this._isPrintable(this.flags)}_parseStringHelper(A){const e="string"==typeof A?j(A):"";return{str:e,dir:e&&"rtl"===Ng(e).dir?"rtl":"ltr"}}setDefaultAppearance(A){const{dict:e,annotationGlobals:t}=A,i=kA({dict:e,key:"DA"})||t.acroForm.get("DA");this._defaultAppearance="string"==typeof i?i:"",this.data.defaultAppearanceData=Br(this._defaultAppearance)}setTitle(A){this._title=this._parseStringHelper(A)}setContents(A){this._contents=this._parseStringHelper(A)}setModificationDate(A){this.modificationDate="string"==typeof A?A:null}setFlags(A){this.flags=Number.isInteger(A)&&A>0?A:0,1&this.flags&&"Annotation"!==this.constructor.name&&(this.flags^=1)}hasFlag(A){return this._hasFlag(this.flags,A)}setRectangle(A){this.rectangle=HA(A,[0,0,0,0])}setColor(A){this.color=Su(A)}setLineEndings(A){if(this.lineEndings=["None","None"],Array.isArray(A)&&2===A.length)for(let e=0;e<2;e++){const t=A[e];if(t instanceof rA)switch(t.name){case"None":continue;case"Square":case"Circle":case"Diamond":case"OpenArrow":case"ClosedArrow":case"Butt":case"ROpenArrow":case"RClosedArrow":case"Slash":this.lineEndings[e]=t.name;continue}S(`Ignoring invalid lineEnding: ${t}`)}}setRotation(A,e){this.rotation=0;let t=A instanceof cA?A.get("R")||0:e.get("Rotate")||0;Number.isInteger(t)&&0!==t&&(t%=360,t<0&&(t+=360),t%90==0&&(this.rotation=t))}setBorderAndBackgroundColors(A){A instanceof cA?(this.borderColor=Su(A.getArray("BC"),null),this.backgroundColor=Su(A.getArray("BG"),null)):this.borderColor=this.backgroundColor=null}setBorderStyle(A){if(this.borderStyle=new Uu,A instanceof cA)if(A.has("BS")){const e=A.get("BS");if(e instanceof cA){const A=e.get("Type");A&&!QA(A,"Border")||(this.borderStyle.setWidth(e.get("W"),this.rectangle),this.borderStyle.setStyle(e.get("S")),this.borderStyle.setDashArray(e.getArray("D")))}}else if(A.has("Border")){const e=A.getArray("Border");Array.isArray(e)&&e.length>=3&&(this.borderStyle.setHorizontalCornerRadius(e[0]),this.borderStyle.setVerticalCornerRadius(e[1]),this.borderStyle.setWidth(e[2],this.rectangle),4===e.length&&this.borderStyle.setDashArray(e[3],!0))}else this.borderStyle.setWidth(0)}setAppearance(A){this.appearance=null;const e=A.get("AP");if(!(e instanceof cA))return;const t=e.get("N");if(t instanceof dA)return void(this.appearance=t);if(!(t instanceof cA))return;const i=A.get("AS");if(!(i instanceof rA&&t.has(i.name)))return;const a=t.get(i.name);a instanceof dA&&(this.appearance=a)}setOptionalContent(A){this.oc=null;const e=A.get("OC");e instanceof rA?S("setOptionalContent: Support for /Name-entry is not implemented."):e instanceof cA&&(this.oc=e)}loadResources(A,e){return e.dict.getAsync("Resources").then((e=>{if(e)return new go(e,A,e.xref).load().then((function(){return e}))}))}async getOperatorList(A,e,t,a){const{hasOwnCanvas:s,id:n,rect:g}=this.data;let r=this.appearance;const o=!!(s&&2&t);if(o&&(g[0]===g[2]||g[1]===g[3]))return this.data.hasOwnCanvas=!1,{opList:new zg,separateForm:!1,separateCanvas:!1};if(!r){if(!o)return{opList:new zg,separateForm:!1,separateCanvas:!1};r=new ae(""),r.dict=new cA}const I=r.dict,c=await this.loadResources(["ExtGState","ColorSpace","Pattern","Shading","XObject","Font"],r),C=JA(I.getArray("BBox"),[0,0,1,1]),B=LA(I.getArray("Matrix"),i),h=Nu(g,C,B),Q=new zg;let l;return this.oc&&(l=await A.parseMarkedContentProps(this.oc,null)),void 0!==l&&Q.addOp(m,["OC",l]),Q.addOp(80,[n,g,h,B,o]),await A.getOperatorList({stream:r,task:e,resources:c,operatorList:Q,fallbackFontDict:this._fallbackFontDict}),Q.addOp(81,[]),void 0!==l&&Q.addOp(y,[]),this.reset(),{opList:Q,separateForm:!1,separateCanvas:o}}async save(A,e,t){return null}get hasTextContent(){return!1}async extractTextContent(A,e,t){if(!this.appearance)return;const i=await this.loadResources(["ExtGState","Font","Properties","XObject"],this.appearance),a=[],s=[];let n=null;const g={desiredSize:Math.Infinity,ready:!0,enqueue(A,e){for(const e of A.items)void 0!==e.str&&(n||=e.transform.slice(-2),s.push(e.str),e.hasEOL&&(a.push(s.join("").trimEnd()),s.length=0))}};if(await A.getTextContent({stream:this.appearance,task:e,resources:i,includeMarkedContent:!0,keepWhiteSpace:!0,sink:g,viewBox:t}),this.reset(),s.length&&a.push(s.join("").trimEnd()),a.length>1||a[0]){const A=this.appearance.dict,e=JA(A.getArray("BBox"),null),t=LA(A.getArray("Matrix"),null);this.data.textPosition=this._transformPoint(n,e,t),this.data.textContent=a}}_transformPoint(A,e,t){const{rect:i}=this.data;e||=[0,0,1,1],t||=[1,0,0,1,0,0];const a=Nu(i,e,t);return a[4]-=i[0],a[5]-=i[1],A=X.applyTransform(A,a),X.applyTransform(A,t)}getFieldObject(){return this.data.kidIds?{id:this.data.id,actions:this.data.actions,name:this.data.fieldName,strokeColor:this.data.borderColor,fillColor:this.data.backgroundColor,type:"",kidIds:this.data.kidIds,page:this.data.pageIndex,rotation:this.rotation}:null}reset(){for(const A of this._streams)A.reset()}_constructFieldName(A){if(!A.has("T")&&!A.has("Parent"))return S("Unknown field name, falling back to empty field name."),"";if(!A.has("Parent"))return j(A.get("T"));const e=[];A.has("T")&&e.unshift(j(A.get("T")));let t=A;const i=new BA;for(A.objId&&i.put(A.objId);t.has("Parent")&&(t=t.get("Parent"),t instanceof cA&&(!t.objId||!i.has(t.objId)));)t.objId&&i.put(t.objId),t.has("T")&&e.unshift(j(t.get("T")));return e.join(".")}}class Uu{constructor(){this.width=1,this.style=1,this.dashArray=[3],this.horizontalCornerRadius=0,this.verticalCornerRadius=0}setWidth(A,e=[0,0,0,0]){if(A instanceof rA)this.width=0;else if("number"==typeof A){if(A>0){const t=(e[2]-e[0])/2,i=(e[3]-e[1])/2;t>0&&i>0&&(A>t||A>i)&&(S(`AnnotationBorderStyle.setWidth - ignoring width: ${A}`),A=1)}this.width=A}}setStyle(A){if(A instanceof rA)switch(A.name){case"S":this.style=1;break;case"D":this.style=2;break;case"B":this.style=3;break;case"I":this.style=4;break;case"U":this.style=5}}setDashArray(A,e=!1){if(Array.isArray(A)){let t=!0,i=!0;for(const e of A){if(!(+e>=0)){t=!1;break}e>0&&(i=!1)}0===A.length||t&&!i?(this.dashArray=A,e&&this.setStyle(rA.get("D"))):this.width=0}else A&&(this.width=0)}setHorizontalCornerRadius(A){Number.isInteger(A)&&(this.horizontalCornerRadius=A)}setVerticalCornerRadius(A){Number.isInteger(A)&&(this.verticalCornerRadius=A)}}class Mu extends xu{constructor(A){super(A);const{dict:e}=A;if(e.has("IRT")){const A=e.getRaw("IRT");this.data.inReplyTo=A instanceof CA?A.toString():null;const t=e.get("RT");this.data.replyType=t instanceof rA?t.name:"R"}let t=null;if(this.data.replyType===o){const A=e.get("IRT");this.setTitle(A.get("T")),this.data.titleObj=this._title,this.setContents(A.get("Contents")),this.data.contentsObj=this._contents,A.has("CreationDate")?(this.setCreationDate(A.get("CreationDate")),this.data.creationDate=this.creationDate):this.data.creationDate=null,A.has("M")?(this.setModificationDate(A.get("M")),this.data.modificationDate=this.modificationDate):this.data.modificationDate=null,t=A.getRaw("Popup"),A.has("C")?(this.setColor(A.getArray("C")),this.data.color=this.color):this.data.color=null}else this.data.titleObj=this._title,this.setCreationDate(e.get("CreationDate")),this.data.creationDate=this.creationDate,t=e.getRaw("Popup"),e.has("C")||(this.data.color=null);this.data.popupRef=t instanceof CA?t.toString():null,e.has("RC")&&(this.data.richText=ku.getRichTextAsHtml(e.get("RC")))}setCreationDate(A){this.creationDate="string"==typeof A?A:null}_setDefaultAppearance({xref:A,extra:e,strokeColor:t,fillColor:i,blendMode:a,strokeAlpha:s,fillAlpha:n,pointsCallback:g}){let r=Number.MAX_VALUE,o=Number.MAX_VALUE,I=Number.MIN_VALUE,c=Number.MIN_VALUE;const C=["q"];e&&C.push(e),t&&C.push(`${t[0]} ${t[1]} ${t[2]} RG`),i&&C.push(`${i[0]} ${i[1]} ${i[2]} rg`);let B=this.data.quadPoints;B||(B=Float32Array.from([this.rectangle[0],this.rectangle[3],this.rectangle[2],this.rectangle[3],this.rectangle[0],this.rectangle[1],this.rectangle[2],this.rectangle[1]]));for(let A=0,e=B.length;A"string"==typeof A)).map((A=>j(A))):A instanceof rA?j(A.name):"string"==typeof A?j(A):null}hasFieldFlag(A){return!!(this.data.fieldFlags&A)}_isViewable(A){return!0}mustBeViewed(A,e){return e?this.viewable:super.mustBeViewed(A,e)&&!this._hasFlag(this.flags,32)}getRotationMatrix(A){let e=A?.get(this.data.id)?.rotation;return void 0===e&&(e=this.rotation),0===e?i:ee(e,this.data.rect[2]-this.data.rect[0],this.data.rect[3]-this.data.rect[1])}getBorderAndBackgroundAppearances(A){let e=A?.get(this.data.id)?.rotation;if(void 0===e&&(e=this.rotation),!this.backgroundColor&&!this.borderColor)return"";const t=this.data.rect[2]-this.data.rect[0],i=this.data.rect[3]-this.data.rect[1],a=0===e||180===e?`0 0 ${t} ${i} re`:`0 0 ${i} ${t} re`;let s="";return this.backgroundColor&&(s=`${Qr(this.backgroundColor,!0)} ${a} f `),this.borderColor&&(s+=`${this.borderStyle.width||1} w ${Qr(this.borderColor,!1)} ${a} S `),s}async getOperatorList(A,e,t,i){if(16&t&&!(this instanceof vu)&&!this.data.noHTML&&!this.data.hasOwnCanvas)return{opList:new zg,separateForm:!0,separateCanvas:!1};if(!this._hasText)return super.getOperatorList(A,e,t,i);const a=await this._getAppearance(A,e,t,i);if(this.appearance&&null===a)return super.getOperatorList(A,e,t,i);const s=new zg;if(!this._defaultAppearance||null===a)return{opList:s,separateForm:!1,separateCanvas:!1};const n=!!(this.data.hasOwnCanvas&&2&t),g=[0,0,this.data.rect[2]-this.data.rect[0],this.data.rect[3]-this.data.rect[1]],r=Nu(this.data.rect,g,[1,0,0,1,0,0]);let o;this.oc&&(o=await A.parseMarkedContentProps(this.oc,null)),void 0!==o&&s.addOp(m,["OC",o]),s.addOp(80,[this.data.id,this.data.rect,r,this.getRotationMatrix(i),n]);const I=new ae(a);return await A.getOperatorList({stream:I,task:e,resources:this._fieldResources.mergedResources,operatorList:s}),s.addOp(81,[]),void 0!==o&&s.addOp(y,[]),{opList:s,separateForm:!1,separateCanvas:n}}_getMKDict(A){const e=new cA(null);return A&&e.set("R",A),this.borderColor&&e.set("BC",Ru(this.borderColor)),this.backgroundColor&&e.set("BG",Ru(this.backgroundColor)),e.size>0?e:null}amendSavedDict(A,e){}async save(A,e,t){const a=t?.get(this.data.id);let s=a?.value,n=a?.rotation;if(s===this.data.fieldValue||void 0===s){if(!this._hasValueFromXFA&&void 0===n)return null;s||=this.data.fieldValue}if(void 0===n&&!this._hasValueFromXFA&&Array.isArray(s)&&Array.isArray(this.data.fieldValue)&&s.length===this.data.fieldValue.length&&s.every(((A,e)=>A===this.data.fieldValue[e])))return null;void 0===n&&(n=this.rotation);let g=null;if(!this._needAppearances&&(g=await this._getAppearance(A,e,8,t),null===g))return null;let r=!1;g?.needAppearances&&(r=!0,g=null);const{xref:o}=A,I=o.fetchIfRef(this.ref);if(!(I instanceof cA))return null;const c=new cA(o);for(const A of I.getKeys())"AP"!==A&&c.set(A,I.getRaw(A));const C={path:this.data.fieldName,value:s};c.set("V",Array.isArray(s)?s.map(_A):_A(s)),this.amendSavedDict(t,c);const B=this._getMKDict(n);B&&c.set("MK",B);const h=[],Q=[{ref:this.ref,data:"",xfa:C,needAppearances:r}];if(null!==g){const A=o.getNewTemporaryRef(),e=new cA(o);c.set("AP",e),e.set("N",A);const a=this._getSaveFieldResources(o),s=new ae(g),n=s.dict=new cA(o);n.set("Subtype",rA.get("Form")),n.set("Resources",a),n.set("BBox",[0,0,this.data.rect[2]-this.data.rect[0],this.data.rect[3]-this.data.rect[1]]);const r=this.getRotationMatrix(t);r!==i&&n.set("Matrix",r),await qr(A,s,h,o),Q.push({ref:A,data:h.join(""),xfa:null,needAppearances:!1}),h.length=0}return c.set("M",`D:${AA()}`),await qr(this.ref,c,h,o),Q[0].data=h.join(""),Q}async _getAppearance(A,e,t,i){if(this.hasFieldFlag(I))return null;const a=i?.get(this.data.id);let s,g;if(a&&(s=a.formattedValue||a.value,g=a.rotation),void 0===g&&void 0===s&&!this._needAppearances&&(!this._hasValueFromXFA||this.appearance))return null;const r=this.getBorderAndBackgroundAppearances(i);if(void 0===s&&(s=this.data.fieldValue,!s))return`/Tx BMC q ${r}Q EMC`;if(Array.isArray(s)&&1===s.length&&(s=s[0]),G("string"==typeof s,"Expected `value` to be a string."),s=s.trim(),this.data.combo){const A=this.data.options.find((({exportValue:A})=>s===A));s=A?.displayValue||s}if(""===s)return`/Tx BMC q ${r}Q EMC`;void 0===g&&(g=this.rotation);let o,c=-1;this.data.multiLine?(o=s.split(/\r\n?|\n/).map((A=>A.normalize("NFC"))),c=o.length):o=[s.replace(/\r\n?|\n/,"").normalize("NFC")];let C=this.data.rect[3]-this.data.rect[1],B=this.data.rect[2]-this.data.rect[0];90!==g&&270!==g||([B,C]=[C,B]),this._defaultAppearance||(this.data.defaultAppearanceData=Br(this._defaultAppearance="/Helvetica 0 Tf 0 g"));let h,Q,l,E=await Lu._getFontData(A,e,this.data.defaultAppearanceData,this._fieldResources.mergedResources);const u=[];let d=!1;for(const A of o){const e=E.encodeString(A);e.length>1&&(d=!0),u.push(e.join(""))}if(d&&8&t)return{needAppearances:!0};if(d&&this._isOffscreenCanvasSupported){const t=this.data.comb?"monospace":"sans-serif",i=new lr(A.xref,t),a=i.createFontResources(o.join("")),n=a.getRaw("Font");if(this._fieldResources.mergedResources.has("Font")){const A=this._fieldResources.mergedResources.get("Font");for(const e of n.getKeys())A.set(e,n.getRaw(e))}else this._fieldResources.mergedResources.set("Font",n);const g=i.fontName.name;E=await Lu._getFontData(A,e,{fontName:g,fontSize:0},a);for(let A=0,e=u.length;A2?`/Tx BMC q ${r}BT `+h+` 1 0 0 1 ${jA(2)} ${jA(y)} Tm (${KA(u[0])}) Tj ET Q EMC`:`/Tx BMC q ${r}BT `+h+` 1 0 0 1 0 0 Tm ${this._renderText(u[0],E,Q,B,m,{shift:0},2,y)} ET Q EMC`}static async _getFontData(A,e,t,i){const a=new zg,s={font:null,clone(){return this}},{fontName:n,fontSize:g}=t;return await A.handleSetFont(i,[n&&rA.get(n),g],null,a,e,s,null),s.font}_getTextWidth(A,e){return e.charsToGlyphs(A).reduce(((A,e)=>A+e.width),0)/1e3}_computeFontSize(A,e,t,i,a){let{fontSize:n}=this.data.defaultAppearanceData,g=(n||12)*s,r=Math.round(A/g);if(!n){const o=A=>Math.floor(100*A)/100;if(-1===a){const a=this._getTextWidth(t,i);n=o(Math.min(A/s,a>e?e/a:1/0)),r=1}else{const I=t.split(/\r\n?|\n/),c=[];for(const A of I){const e=i.encodeString(A).join(""),t=i.charsToGlyphs(e),a=i.getCharPositions(e);c.push({line:e,glyphs:t,positions:a})}const C=t=>{let a=0;for(const s of c)if(a+=this._splitLine(null,i,t,e,s).length*t,a>A)return!0;return!1};for(r=Math.max(r,a);g=A/r,n=o(g/s),C(n);)r++}const{fontName:I,fontColor:c}=this.data.defaultAppearanceData;this._defaultAppearance=function({fontSize:A,fontName:e,fontColor:t}){return`/${vA(e)} ${A} Tf ${Qr(t,!0)}`}({fontSize:n,fontName:I,fontColor:c})}return[this._defaultAppearance,n,A/r]}_renderText(A,e,t,i,a,s,n,g){let r;r=1===a?(i-this._getTextWidth(A,e)*t)/2:2===a?i-this._getTextWidth(A,e)*t-n:n;const o=jA(r-s.shift);return s.shift=r,`${o} ${g=jA(g)} Td (${KA(A)}) Tj`}_getSaveFieldResources(A){const{localResources:e,appearanceResources:t,acroFormResources:i}=this._fieldResources,a=this.data.defaultAppearanceData?.fontName;if(!a)return e||cA.empty;for(const A of[e,t])if(A instanceof cA){const e=A.get("Font");if(e instanceof cA&&e.has(a))return A}if(i instanceof cA){const t=i.get("Font");if(t instanceof cA&&t.has(a)){const i=new cA(A);i.set(a,t.getRaw(a));const s=new cA(A);return s.set("Font",i),cA.merge({xref:A,dictArray:[s,e],mergeSubDicts:!0})}}return e||cA.empty}getFieldObject(){return null}}class Ju extends Lu{constructor(A){super(A);const{dict:e}=A;e.has("PMD")&&(this.flags|=2,this.data.hidden=!0,S("Barcodes are not supported")),this.data.hasOwnCanvas=this.data.readOnly&&!this.data.noHTML,this._hasText=!0,"string"!=typeof this.data.fieldValue&&(this.data.fieldValue="");let t=kA({dict:e,key:"Q"});(!Number.isInteger(t)||t<0||t>2)&&(t=null),this.data.textAlignment=t;let i=kA({dict:e,key:"MaxLen"});(!Number.isInteger(i)||i<0)&&(i=0),this.data.maxLen=i,this.data.multiLine=this.hasFieldFlag(4096),this.data.comb=this.hasFieldFlag(16777216)&&!this.hasFieldFlag(4096)&&!this.hasFieldFlag(I)&&!this.hasFieldFlag(1048576)&&0!==this.data.maxLen,this.data.doNotScroll=this.hasFieldFlag(8388608)}get hasTextContent(){return!!this.appearance&&!this._needAppearances}_getCombAppearance(A,e,t,i,a,s,n,g,r,o,I){const c=a/this.data.maxLen,C=this.getBorderAndBackgroundAppearances(I),B=[],h=e.getCharPositions(t);for(const[A,e]of h)B.push(`(${KA(t.substring(A,e))}) Tj`);const Q=B.join(` ${jA(c)} 0 Td `);return`/Tx BMC q ${C}BT `+A+` 1 0 0 1 ${jA(n)} ${jA(g+r)} Tm ${Q} ET Q EMC`}_getMultilineAppearance(A,e,t,i,a,s,n,g,r,o,I,c){const C=[],B=a-2*g,h={shift:0};for(let A=0,s=e.length;Ai?(r.push(A.substring(C,t)),C=t,B=Q,o=-1,c=-1):(B+=Q,o=t,I=a,c=e):B+Q>i?-1!==o?(r.push(A.substring(C,I)),C=I,e=c+1,o=-1,B=0):(r.push(A.substring(C,t)),C=t,B=Q):B+=Q}return C"Off"!==A));s.length=0,s.push("Off",A)}s.includes(this.data.fieldValue)||(this.data.fieldValue="Off"),this.data.exportValue=s[1];const n=t.get(this.data.exportValue);this.checkedAppearance=n instanceof dA?n:null;const g=t.get("Off");this.uncheckedAppearance=g instanceof dA?g:null,this.checkedAppearance?this._streams.push(this.checkedAppearance):this._getDefaultCheckedAppearance(A,"check"),this.uncheckedAppearance&&this._streams.push(this.uncheckedAppearance),this._fallbackFontDict=this.fallbackFontDict,null===this.data.defaultFieldValue&&(this.data.defaultFieldValue="Off")}_processRadioButton(A){this.data.buttonValue=null;const e=A.dict.get("Parent");if(e instanceof cA){this.parent=A.dict.getRaw("Parent");const t=e.get("V");t instanceof rA&&(this.data.fieldValue=this._decodeFormValue(t))}const t=A.dict.get("AP");if(!(t instanceof cA))return;const i=t.get("N");if(!(i instanceof cA))return;for(const A of i.getKeys())if("Off"!==A){this.data.buttonValue=this._decodeFormValue(A);break}const a=i.get(this.data.buttonValue);this.checkedAppearance=a instanceof dA?a:null;const s=i.get("Off");this.uncheckedAppearance=s instanceof dA?s:null,this.checkedAppearance?this._streams.push(this.checkedAppearance):this._getDefaultCheckedAppearance(A,"disc"),this.uncheckedAppearance&&this._streams.push(this.uncheckedAppearance),this._fallbackFontDict=this.fallbackFontDict,null===this.data.defaultFieldValue&&(this.data.defaultFieldValue="Off")}_processPushButton(A){const{dict:e,annotationGlobals:t}=A;e.has("A")||e.has("AA")||this.data.alternativeText?(this.data.isTooltipOnly=!e.has("A")&&!e.has("AA"),so.parseDestDictionary({destDict:e,resultObj:this.data,docBaseUrl:t.baseUrl,docAttachments:t.attachments})):S("Push buttons without action dictionaries are not supported")}getFieldObject(){let A,e="button";return this.data.checkBox?(e="checkbox",A=this.data.exportValue):this.data.radioButton&&(e="radiobutton",A=this.data.buttonValue),{id:this.data.id,value:this.data.fieldValue||"Off",defaultValue:this.data.defaultFieldValue,exportValues:A,editable:!this.data.readOnly,name:this.data.fieldName,rect:this.data.rect,hidden:this.data.hidden,actions:this.data.actions,page:this.data.pageIndex,strokeColor:this.data.borderColor,fillColor:this.data.backgroundColor,rotation:this.rotation,type:e}}get fallbackFontDict(){const A=new cA;return A.set("BaseFont",rA.get("ZapfDingbats")),A.set("Type",rA.get("FallbackType")),A.set("Subtype",rA.get("FallbackType")),A.set("Encoding",rA.get("ZapfDingbatsEncoding")),x(this,"fallbackFontDict",A)}}class Yu extends Lu{constructor(A){super(A);const{dict:e,xref:t}=A;this.indices=e.getArray("I"),this.hasIndices=Array.isArray(this.indices)&&this.indices.length>0,this.data.options=[];const i=kA({dict:e,key:"Opt"});if(Array.isArray(i))for(let A=0,e=i.length;A=0&&e0?this.data.fieldValue[0]:null;return{id:this.data.id,value:e,defaultValue:this.data.defaultFieldValue,editable:!this.data.readOnly,name:this.data.fieldName,rect:this.data.rect,numItems:this.data.fieldValue.length,multipleSelection:this.data.multiSelect,hidden:this.data.hidden,actions:this.data.actions,items:this.data.options,page:this.data.pageIndex,strokeColor:this.data.borderColor,fillColor:this.data.backgroundColor,rotation:this.rotation,type:A}}amendSavedDict(A,e){if(!this.hasIndices)return;let t=A?.get(this.data.id)?.value;Array.isArray(t)||(t=[t]);const i=[],{options:a}=this.data;for(let A=0,e=0,s=a.length;At&&(t=i,e=A)}[B,h]=this._computeFontSize(A,o-4,e,C,-1)}const Q=h*s,l=(Q-h)/2,E=Math.floor(r/Q);let u=0;if(c.length>0){const A=Math.min(...c),e=Math.max(...c);u=Math.max(0,e-E+1),u>A&&(u=A)}const d=Math.min(u+E+1,I),f=["/Tx BMC q",`1 1 ${o} ${r} re W n`];if(c.length){f.push("0.600006 0.756866 0.854904 rg");for(const A of c)u<=A&&AA.trimEnd()));const{coords:A,bbox:e,matrix:t}=lr.getFirstPositionInfo(this.rectangle,this.rotation,i);this.data.textPosition=this._transformPoint(A,e,t)}if(this._isOffscreenCanvasSupported){const a=A.dict.get("CA"),s=new lr(t,"sans-serif");this.appearance=s.createAppearance(this._contents.str,this.rectangle,this.rotation,i,e,a),this._streams.push(this.appearance)}else S("FreeTextAnnotation: OffscreenCanvas is not supported, annotation may not render correctly.")}}get hasTextContent(){return this._hasAppearance}static createNewDict(A,e,{apRef:t,ap:i,oldAnnotation:a}){const{color:s,fontSize:n,rect:g,rotation:r,user:o,value:I}=A,c=a||new cA(e);c.set("Type",rA.get("Annot")),c.set("Subtype",rA.get("FreeText")),a?(c.set("M",`D:${AA()}`),c.delete("RC")):c.set("CreationDate",`D:${AA()}`),c.set("Rect",g);const C=`/Helv ${n} Tf ${Qr(s,!0)}`;if(c.set("DA",C),c.set("Contents",_A(I)),c.set("F",4),c.set("Border",[0,0,0]),c.set("Rotate",r),o&&c.set("T",_A(o)),t||i){const A=new cA(e);c.set("AP",A),t?A.set("N",t):A.set("N",i)}return c}static async createNewAppearanceStream(A,e,t){const{baseFontRef:i,evaluator:a,task:n}=t,{color:g,fontSize:r,rect:o,rotation:I,value:c}=A,C=new cA(e),B=new cA(e);if(i)B.set("Helv",i);else{const A=new cA(e);A.set("BaseFont",rA.get("Helvetica")),A.set("Type",rA.get("Font")),A.set("Subtype",rA.get("Type1")),A.set("Encoding",rA.get("WinAnsiEncoding")),B.set("Helv",A)}C.set("Font",B);const h=await Lu._getFontData(a,n,{fontName:"Helv",fontSize:r},C),[Q,l,E,u]=o;let d=E-Q,f=u-l;I%180!=0&&([d,f]=[f,d]);const p=c.split("\n"),m=r/1e3;let y=-1/0;const w=[];for(let A of p){const e=h.encodeString(A);if(e.length>1)return null;A=e.join(""),w.push(A);let t=0;const i=h.charsToGlyphs(A);for(const A of i)t+=A.width*m;y=Math.max(y,t)}let D=1;y>d&&(D=d/y);let b=1;const k=s*r,F=1*r,S=k*p.length;S>f&&(b=f/S);const R=r*Math.min(D,b);let G,N,x;switch(I){case 0:x=[1,0,0,1],N=[o[0],o[1],d,f],G=[o[0],o[3]-F];break;case 90:x=[0,1,-1,0],N=[o[1],-o[2],d,f],G=[o[1],-o[0]-F];break;case 180:x=[-1,0,0,-1],N=[-o[2],-o[3],d,f],G=[-o[2],-o[1]-F];break;case 270:x=[0,-1,1,0],N=[-o[3],o[0],d,f],G=[-o[3],o[2]-F]}const U=["q",`${x.join(" ")} 0 0 cm`,`${N.join(" ")} re W n`,"BT",`${Qr(g,!0)}`,`0 Tc /Helv ${jA(R)} Tf`];U.push(`${G.join(" ")} Td (${KA(w[0])}) Tj`);const M=jA(k);for(let A=1,e=w.length;A(A.push(`${i[0]} ${i[1]} m`,`${i[2]} ${i[3]} l`,"S"),[e[0]-r,e[2]+r,e[7]-r,e[3]+r])})}}}class Zu extends Mu{constructor(A){super(A);const{dict:e,xref:t}=A;if(this.data.annotationType=5,this.data.hasOwnCanvas=this.data.noRotate,this.data.noHTML=!1,!this.appearance){const A=this.color?Ru(this.color):[0,0,0],i=e.get("CA"),a=Su(e.getArray("IC"),null),s=a?Ru(a):null,n=s?i:null;if(0===this.borderStyle.width&&!s)return;this._setDefaultAppearance({xref:t,extra:`${this.borderStyle.width} w`,strokeColor:A,fillColor:s,strokeAlpha:i,fillAlpha:n,pointsCallback:(A,e)=>{const t=e[4]+this.borderStyle.width/2,i=e[5]+this.borderStyle.width/2,a=e[6]-e[4]-this.borderStyle.width,n=e[3]-e[7]-this.borderStyle.width;return A.push(`${t} ${i} ${a} ${n} re`),s?A.push("B"):A.push("S"),[e[0],e[2],e[7],e[3]]}})}}}class Ou extends Mu{constructor(A){super(A);const{dict:e,xref:t}=A;if(this.data.annotationType=6,!this.appearance){const A=this.color?Ru(this.color):[0,0,0],i=e.get("CA"),a=Su(e.getArray("IC"),null),s=a?Ru(a):null,n=s?i:null;if(0===this.borderStyle.width&&!s)return;const g=4/3*Math.tan(Math.PI/8);this._setDefaultAppearance({xref:t,extra:`${this.borderStyle.width} w`,strokeColor:A,fillColor:s,strokeAlpha:i,fillAlpha:n,pointsCallback:(A,e)=>{const t=e[0]+this.borderStyle.width/2,i=e[1]-this.borderStyle.width/2,a=e[6]-this.borderStyle.width/2,n=e[7]+this.borderStyle.width/2,r=t+(a-t)/2,o=i+(n-i)/2,I=(a-t)/2*g,c=(n-i)/2*g;return A.push(`${r} ${n} m`,`${r+I} ${n} ${a} ${o+c} ${a} ${o} c`,`${a} ${o-c} ${r+I} ${i} ${r} ${i} c`,`${r-I} ${i} ${t} ${o-c} ${t} ${o} c`,`${t} ${o+c} ${r-I} ${n} ${r} ${n} c`,"h"),s?A.push("B"):A.push("S"),[e[0],e[2],e[7],e[3]]}})}}}class Xu extends Mu{constructor(A){super(A);const{dict:e,xref:t}=A;this.data.annotationType=8,this.data.hasOwnCanvas=this.data.noRotate,this.data.noHTML=!1,this.data.vertices=null,this instanceof Vu||(this.setLineEndings(e.getArray("LE")),this.data.lineEndings=this.lineEndings);const i=e.getArray("Vertices");if(!MA(i,null))return;const a=this.data.vertices=Float32Array.from(i);if(!this.appearance){const A=this.color?Ru(this.color):[0,0,0],i=e.get("CA"),s=this.borderStyle.width||1,n=2*s,g=[1/0,1/0,-1/0,-1/0];for(let A=0,e=a.length;A{for(let e=0,t=a.length;e{for(const e of this.data.inkLists){for(let t=0,i=e.length;tA.points))),c.set("F",4),c.set("Rotate",o),g&&c.set("IT",rA.get("InkHighlight"));const C=new cA(e);c.set("BS",C),C.set("W",I),c.set("C",Array.from(a,(A=>A/255))),c.set("CA",s);const B=new cA(e);return c.set("AP",B),t?B.set("N",t):B.set("N",i),c}static async createNewAppearanceStream(A,e,t){if(A.outlines)return this.createNewAppearanceStreamForHighlight(A,e,t);const{color:i,rect:a,paths:s,thickness:n,opacity:g}=A,r=[`${n} w 1 J 1 j`,`${Qr(i,!1)}`];1!==g&&r.push("/R0 gs");const o=[];for(const{bezier:A}of s){if(o.length=0,o.push(`${jA(A[0])} ${jA(A[1])} m`),2===A.length)o.push(`${jA(A[0])} ${jA(A[1])} l S`);else{for(let e=2,t=A.length;e(A.push(`${e[0]} ${e[1]} m`,`${e[2]} ${e[3]} l`,`${e[6]} ${e[7]} l`,`${e[4]} ${e[5]} l`,"f"),[e[0],e[2],e[7],e[3]])})}}else this.data.popupRef=null}static createNewDict(A,e,{apRef:t,ap:i}){const{color:a,opacity:s,rect:n,rotation:g,user:r,quadPoints:o}=A,I=new cA(e);if(I.set("Type",rA.get("Annot")),I.set("Subtype",rA.get("Highlight")),I.set("CreationDate",`D:${AA()}`),I.set("Rect",n),I.set("F",4),I.set("Border",[0,0,0]),I.set("Rotate",g),I.set("QuadPoints",o),I.set("C",Array.from(a,(A=>A/255))),I.set("CA",s),r&&I.set("T",_A(r)),t||i){const A=new cA(e);I.set("AP",A),A.set("N",t||i)}return I}static async createNewAppearanceStream(A,e,t){const{color:i,rect:a,outlines:s,opacity:n}=A,g=[`${Qr(i,!0)}`,"/R0 gs"],r=[];for(const A of s){r.length=0,r.push(`${jA(A[0])} ${jA(A[1])} m`);for(let e=2,t=A.length;e(A.push(`${e[4]} ${e[5]+1.3} m`,`${e[6]} ${e[7]+1.3} l`,"S"),[e[0],e[2],e[7],e[3]])})}}else this.data.popupRef=null}}class Ad extends Mu{constructor(A){super(A);const{dict:e,xref:t}=A;if(this.data.annotationType=11,this.data.quadPoints=Gu(e,null)){if(!this.appearance){const A=this.color?Ru(this.color):[0,0,0],i=e.get("CA");this._setDefaultAppearance({xref:t,extra:"[] 0 d 1 w",strokeColor:A,strokeAlpha:i,pointsCallback:(A,e)=>{const t=(e[1]-e[5])/6;let i=t,a=e[4];const s=e[5],n=e[6];A.push(`${a} ${s+i} m`);do{a+=2,i=0===i?t:0,A.push(`${a} ${s+i} l`)}while(a(A.push((e[0]+e[4])/2+" "+(e[1]+e[5])/2+" m",(e[2]+e[6])/2+" "+(e[3]+e[7])/2+" l","S"),[e[0],e[2],e[7],e[3]])})}}else this.data.popupRef=null}}class td extends Mu{constructor(A){super(A),this.data.annotationType=13,this.data.hasOwnCanvas=this.data.noRotate,this.data.noHTML=!1}static async createImage(A,e){const{width:t,height:i}=A,a=new OffscreenCanvas(t,i),s=a.getContext("2d",{alpha:!0});s.drawImage(A,0,0);const n=s.getImageData(0,0,t,i).data,g=new Uint32Array(n.buffer),r=g.some(Z.isLittleEndian?A=>A>>>24!=255:A=>!!(255&~A));r&&(s.fillStyle="white",s.fillRect(0,0,t,i),s.drawImage(A,0,0));const o=a.convertToBlob({type:"image/jpeg",quality:1}).then((A=>A.arrayBuffer())),I=rA.get("XObject"),c=rA.get("Image"),C=new cA(e);C.set("Type",I),C.set("Subtype",c),C.set("BitsPerComponent",8),C.set("ColorSpace",rA.get("DeviceRGB")),C.set("Filter",rA.get("DCTDecode")),C.set("BBox",[0,0,t,i]),C.set("Width",t),C.set("Height",i);let B=null;if(r){const A=new Uint8Array(g.length);if(Z.isLittleEndian)for(let e=0,t=g.length;e>>24;else for(let e=0,t=g.length;e=0&&s<=1?s:null}}function ad(A){try{return z(A)}catch(e){return S(`UTF-8 decoding failed: "${e}".`),A}}class sd extends br{constructor(A){super(A),this.node=null}onEndElement(A){const e=super.onEndElement(A);if(e&&"xfa:datasets"===A)throw this.node=e,new Error("Aborting DatasetXMLParser.")}}class nd{constructor(A){if(A.datasets)this.node=new br({hasAttributes:!0}).parseFromString(A.datasets).documentElement;else{const e=new sd({hasAttributes:!0});try{e.parseFromString(A["xdp:xdp"])}catch{}this.node=e.node}}getValue(A){if(!this.node||!A)return"";const e=this.node.searchNode(YA(A),0);if(!e)return"";const t=e.firstChild;return"value"===t?.nodeName?e.children.map((A=>ad(A.textContent))):ad(e.textContent)}}class gd{#K=null;constructor(A,e){this.stream=A,this.pdfManager=e,this.entries=[],this._xrefStms=new Set,this._cacheMap=new Map,this._pendingRefs=new BA,this._newPersistentRefNum=null,this._newTemporaryRefNum=null,this._persistentRefsCache=null}getNewPersistentRef(A){null===this._newPersistentRefNum&&(this._newPersistentRefNum=this.entries.length||1);const e=this._newPersistentRefNum++;return this._cacheMap.set(e,A),CA.get(e,0)}getNewTemporaryRef(){if(null===this._newTemporaryRefNum&&(this._newTemporaryRefNum=this.entries.length||1,this._newPersistentRefNum)){this._persistentRefsCache=new Map;for(let A=this._newTemporaryRefNum;A0;){const[n,g]=s;if(!Number.isInteger(n)||!Number.isInteger(g))throw new v(`Invalid XRef range fields: ${n}, ${g}`);if(!Number.isInteger(t)||!Number.isInteger(i)||!Number.isInteger(a))throw new v(`Invalid XRef entry fields length: ${n}, ${g}`);for(let s=e.entryNum;s=A.length);)t+=String.fromCharCode(i),i=A[e];return t}function e(A,e,t){const i=t.length,a=A.length;let s=0;for(;e=i)break;e++,s++}return s}const t=/\b(endobj|\d+\s+\d+\s+obj|xref|trailer\s*<<)\b/g,i=/\b(startxref|\d+\s+\d+\s+obj)\b/g,a=/^(\d+)\s+(\d+)\s+obj\b/,s=new Uint8Array([116,114,97,105,108,101,114]),n=new Uint8Array([115,116,97,114,116,120,114,101,102]),g=new Uint8Array([47,88,82,101,102]);this.entries.length=0,this._cacheMap.clear();const r=this.stream;r.pos=0;const o=r.getBytes(),I=q(o),c=o.length;let C=r.start;const B=[],h=[];for(;C=c)break;Q=o[C]}while(10!==Q&&13!==Q);continue}const l=A(o,C);let E;if(l.startsWith("xref")&&(4===l.length||/\s/.test(l[4])))C+=e(o,C,s),B.push(C),C+=e(o,C,n);else if(E=a.exec(l)){const A=0|E[1],i=0|E[2],a=C+l.length;let s,n=!1;if(this.entries[A]){if(this.entries[A].gen===i)try{new ei({lexer:new ai(r.makeSubStream(a))}).getObj(),n=!0}catch(A){A instanceof yA?S(`indexObjects -- checking object (${l}): "${A}".`):n=!0}}else n=!0;n&&(this.entries[A]={offset:C-r.start,gen:i,uncompressed:!0}),t.lastIndex=a;const B=t.exec(I);B?(s=t.lastIndex+1-C,"endobj"!==B[1]&&(S(`indexObjects: Found "${B[1]}" inside of another "obj", caused by missing "endobj" -- trying to recover.`),s-=B[1].length+1)):s=c-C;const Q=o.subarray(C,C+s),u=e(Q,0,g);u0?Math.max(...this._xrefStms):null)}getEntry(A){const e=this.entries[A];return e&&!e.free&&e.offset?e:null}fetchIfRef(A,e=!1){return A instanceof CA?this.fetch(A,e):A}fetch(A,e=!1){if(!(A instanceof CA))throw new Error("ref object is not a reference");const t=A.num,i=this._cacheMap.get(t);if(void 0!==i)return i instanceof cA&&!i.objId&&(i.objId=A.toString()),i;let a=this.getEntry(t);if(null===a)return this._cacheMap.set(t,a),a;if(this._pendingRefs.has(A))return this._pendingRefs.remove(A),S(`Ignoring circular reference: ${A}.`),iA;this._pendingRefs.put(A);try{a=a.uncompressed?this.fetchUncompressed(A,a,e):this.fetchCompressed(A,a,e),this._pendingRefs.remove(A)}catch(e){throw this._pendingRefs.remove(A),e}return a instanceof cA?a.objId=A.toString():a instanceof dA&&(a.dict.objId=A.toString()),a}fetchUncompressed(A,e,t=!1){const i=A.gen;let a=A.num;if(e.gen!==i){const s=`Inconsistent generation in XRef: ${A}`;if(this._generationFallback&&e.gen0&&e[3]-e[1]>0)return e;S(`Empty, or invalid, /${A} entry.`)}return null}get mediaBox(){return x(this,"mediaBox",this._getBoundingBox("MediaBox")||rd)}get cropBox(){return x(this,"cropBox",this._getBoundingBox("CropBox")||this.mediaBox)}get userUnit(){let A=this.pageDict.get("UserUnit");return("number"!=typeof A||A<=0)&&(A=1),x(this,"userUnit",A)}get view(){const{cropBox:A,mediaBox:e}=this;if(A!==e&&!$(A,e)){const t=X.intersect(A,e);if(t&&t[2]-t[0]>0&&t[3]-t[1]>0)return x(this,"view",t);S("Empty /CropBox and /MediaBox intersection.")}return x(this,"view",e)}get rotate(){let A=this._getInheritableProperty("Rotate")||0;return A%90!=0?A=0:A>=360?A%=360:A<0&&(A=(A%360+360)%360),x(this,"rotate",A)}_onSubStreamError(A,e){if(!this.evaluatorOptions.ignoreErrors)throw A;S(`getContentStream - ignoring sub-stream (${e}): "${A}".`)}getContentStream(){return this.pdfManager.ensure(this,"content").then((A=>A instanceof dA?A:Array.isArray(A)?new Fe(A,this._onSubStreamError.bind(this)):new se))}get xfaData(){return x(this,"xfaData",this.xfaFactory?{bbox:this.xfaFactory.getBoundingBox(this.pageIndex)}:null)}#q(A,e,t){for(const i of A)if(i.id){const A=CA.fromString(i.id);if(!A){S(`A non-linked annotation cannot be modified: ${i.id}`);continue}if(i.deleted){e.put(A,A);continue}t?.put(A),i.ref=A,delete i.id}}async saveNewAnnotations(A,e,t,i){if(this.xfaFactory)throw new Error("XFA: Cannot save new annotations.");const a=new nr({xref:this.xref,handler:A,pageIndex:this.pageIndex,idFactory:this._localIdFactory,fontCache:this.fontCache,builtInCMapCache:this.builtInCMapCache,standardFontDataCache:this.standardFontDataCache,globalImageCache:this.globalImageCache,systemFontCache:this.systemFontCache,options:this.evaluatorOptions}),s=new hA,n=new BA;this.#q(t,s,n);const g=this.pageDict,r=this.annotations.filter((A=>!(A instanceof CA&&s.has(A)))),o=await Fu.saveNewAnnotations(a,e,t,i);for(const{ref:A}of o.annotations)A instanceof CA&&!n.has(A)&&r.push(A);const I=g.get("Annots");g.set("Annots",r);const c=[];await qr(this.ref,g,c,this.xref),I&&g.set("Annots",I);const C=o.dependencies;C.push({ref:this.ref,data:c.join("")},...o.annotations);for(const A of s)C.push({ref:A,data:null});return C}save(A,e,t){const i=new nr({xref:this.xref,handler:A,pageIndex:this.pageIndex,idFactory:this._localIdFactory,fontCache:this.fontCache,builtInCMapCache:this.builtInCMapCache,standardFontDataCache:this.standardFontDataCache,globalImageCache:this.globalImageCache,systemFontCache:this.systemFontCache,options:this.evaluatorOptions});return this._parsedAnnotations.then((function(A){const a=[];for(const s of A)s.mustBePrinted(t)&&a.push(s.save(i,e,t).catch((function(A){return S(`save - ignoring annotation data during "${e.name}" task: "${A}".`),null})));return Promise.all(a).then((function(A){return A.filter((A=>!!A))}))}))}loadResources(A){return this.resourcesPromise||=this.pdfManager.ensure(this,"resources"),this.resourcesPromise.then((()=>new go(this.resources,A,this.xref).load()))}getOperatorList({handler:A,sink:e,task:t,intent:i,cacheKey:a,annotationStorage:s=null,modifiedIds:n=null}){const r=this.getContentStream(),o=this.loadResources(["ColorSpace","ExtGState","Font","Pattern","Properties","Shading","XObject"]),I=new nr({xref:this.xref,handler:A,pageIndex:this.pageIndex,idFactory:this._localIdFactory,fontCache:this.fontCache,builtInCMapCache:this.builtInCMapCache,standardFontDataCache:this.standardFontDataCache,globalImageCache:this.globalImageCache,systemFontCache:this.systemFontCache,options:this.evaluatorOptions}),c=this.xfaFactory?null:zA(s),C=c?.get(this.pageIndex);let B=Promise.resolve(null),h=null;if(C){const A=this.pdfManager.ensureDoc("annotationGlobals");let e;const i=new Set;for(const{bitmapId:A,bitmap:e}of C)!A||e||i.has(A)||i.add(A);const{isOffscreenCanvasSupported:a}=this.evaluatorOptions;if(i.size>0){const A=C.slice();for(const[e,t]of s)e.startsWith(g)&&t.bitmap&&i.has(t.bitmapId)&&A.push(t);e=Fu.generateImages(A,this.xref,a)}else e=Fu.generateImages(C,this.xref,a);h=new BA,this.#q(C,h,null),B=A.then((A=>A?Fu.printNewAnnotations(A,I,t,C,e):null))}const Q=Promise.all([r,o]).then((([s])=>{const n=new zg(i,e);return A.send("StartRenderPage",{transparency:I.hasBlendModes(this.resources,this.nonBlendModesSet),pageIndex:this.pageIndex,cacheKey:a}),I.getOperatorList({stream:s,task:t,resources:this.resources,operatorList:n}).then((function(){return n}))}));return Promise.all([Q,this._parsedAnnotations,B]).then((function([A,e,a]){if(a){e=e.filter((A=>!(A.ref&&h.has(A.ref))));for(let A=0,t=a.length;AA.ref&&uA(A.ref,i.refToReplace)));s>=0&&(e.splice(s,1,i),a.splice(A--,1),t--)}}e=e.concat(a)}if(0===e.length||64&i)return A.flush(!0),{length:A.totalLength};const g=!!(16&i),r=!!(128&i),o=!!(1&i),c=!!(2&i),C=!!(4&i),B=[];for(const A of e)(o||c&&A.mustBeViewed(s,g)&&A.mustBeViewedWhenEditing(r,n)||C&&A.mustBePrinted(s))&&B.push(A.getOperatorList(I,t,i,s).catch((function(A){return S(`getOperatorList - ignoring annotation data during "${t.name}" task: "${A}".`),{opList:null,separateForm:!1,separateCanvas:!1}})));return Promise.all(B).then((function(e){let t=!1,i=!1;for(const{opList:a,separateForm:s,separateCanvas:n}of e)A.addOpList(a),t||=s,i||=n;return A.flush(!0,{form:t,canvas:i}),{length:A.totalLength}}))}))}async extractTextContent({handler:A,task:e,includeMarkedContent:t,disableNormalization:i,sink:a}){const s=this.getContentStream(),n=this.loadResources(["ExtGState","Font","Properties","XObject"]),g=this.pdfManager.ensureCatalog("lang"),[r,,o]=await Promise.all([s,n,g]);return new nr({xref:this.xref,handler:A,pageIndex:this.pageIndex,idFactory:this._localIdFactory,fontCache:this.fontCache,builtInCMapCache:this.builtInCMapCache,standardFontDataCache:this.standardFontDataCache,globalImageCache:this.globalImageCache,systemFontCache:this.systemFontCache,options:this.evaluatorOptions}).getTextContent({stream:r,task:e,resources:this.resources,includeMarkedContent:t,disableNormalization:i,sink:a,viewBox:this.view,lang:o})}async getStructTree(){const A=await this.pdfManager.ensureCatalog("structTreeRoot");return A?(await this._parsedAnnotations,(await this.pdfManager.ensure(this,"_parseStructTree",[A])).serializable):null}_parseStructTree(A){const e=new eo(A,this.pageDict);return e.parse(this.ref),e}async getAnnotationsData(A,e,t){const i=await this._parsedAnnotations;if(0===i.length)return i;const a=[],s=[];let n;const g=!!(1&t),r=!!(2&t),o=!!(4&t);for(const t of i){const i=g||r&&t.viewable;(i||o&&t.printable)&&a.push(t.data),t.hasTextContent&&i&&(n||=new nr({xref:this.xref,handler:A,pageIndex:this.pageIndex,idFactory:this._localIdFactory,fontCache:this.fontCache,builtInCMapCache:this.builtInCMapCache,standardFontDataCache:this.standardFontDataCache,globalImageCache:this.globalImageCache,systemFontCache:this.systemFontCache,options:this.evaluatorOptions}),s.push(t.extractTextContent(n,e,[-1/0,-1/0,1/0,1/0]).catch((function(A){S(`getAnnotationsData - ignoring textContent during "${e.name}" task: "${A}".`)}))))}return await Promise.all(s),a}get annotations(){const A=this._getInheritableProperty("Annots");return x(this,"annotations",Array.isArray(A)?A:[])}get _parsedAnnotations(){return x(this,"_parsedAnnotations",this.pdfManager.ensure(this,"annotations").then((async A=>{if(0===A.length)return A;const e=await this.pdfManager.ensureDoc("annotationGlobals");if(!e)return[];const t=[];for(const i of A)t.push(Fu.create(this.xref,i,e,this._localIdFactory,!1,this.ref).catch((function(A){return S(`_parsedAnnotations: "${A}".`),null})));const i=[];let a,s;for(const A of await Promise.all(t))A&&(A instanceof Lu?(s||=[]).push(A):A instanceof Tu?(a||=[]).push(A):i.push(A));return s&&i.push(...s),a&&i.push(...a),i})))}get jsActions(){return x(this,"jsActions",TA(this.xref,this.pageDict,h))}}const Id=new Uint8Array([37,80,68,70,45]),cd=new Uint8Array([115,116,97,114,116,120,114,101,102]),Cd=new Uint8Array([101,110,100,111,98,106]);function Bd(A,e,t=1024,i=!1){const a=e.length,s=A.peekBytes(t),n=s.length-a;if(n<=0)return!1;if(i){const t=a-1;let i=s.length-1;for(;i>=t;){let n=0;for(;n=a)return A.pos+=i-t,!0;i--}}else{let t=0;for(;t<=n;){let i=0;for(;i=a)return A.pos+=t,!0;t++}}return!1}class hd{constructor(A,e){if(e.length<=0)throw new J("The PDF file is empty, i.e. its size is zero bytes.");this.pdfManager=A,this.stream=e,this.xref=new gd(e,A),this._pagePromises=new Map,this._version=null;const t={font:0};this._globalIdFactory=class{static getDocId(){return`g_${A.docId}`}static createFontId(){return"f"+ ++t.font}static createObjId(){R("Abstract method `createObjId` called.")}static getPageObjId(){R("Abstract method `getPageObjId` called.")}}}parse(A){this.xref.parse(A),this.catalog=new so(this.pdfManager,this.xref)}get linearization(){let A=null;try{A=si.create(this.stream)}catch(A){if(A instanceof mA)throw A;F(A)}return x(this,"linearization",A)}get startXRef(){const A=this.stream;let e=0;if(this.linearization){if(A.reset(),Bd(A,Cd)){A.skip(6);let t=A.peekByte();for(;UA(t);)A.pos++,t=A.peekByte();e=A.pos-A.start}}else{const t=1024,i=cd.length;let a=!1,s=A.end;for(;!a&&s>0;)s-=t-i,s<0&&(s=0),A.pos=s,a=Bd(A,cd,t,!0);if(a){let t;A.skip(9);do{t=A.getByte()}while(UA(t));let i="";for(;t>=32&&t<=57;)i+=String.fromCharCode(t),t=A.getByte();e=parseInt(i,10),isNaN(e)&&(e=0)}}return x(this,"startXRef",e)}checkHeader(){const A=this.stream;if(A.reset(),!Bd(A,Id))return;A.moveStart(),A.skip(Id.length);let e,t="";for(;(e=A.getByte())>32&&t.length<7;)t+=String.fromCharCode(e);fA.test(t)?this._version=t:S(`Invalid PDF header version: ${t}`)}parseStartXRef(){this.xref.setStartXRef(this.startXRef)}get numPages(){let A=0;return A=this.catalog.hasActualNumPages?this.catalog.numPages:this.xfaFactory?this.xfaFactory.getNumPages():this.linearization?this.linearization.numPages:this.catalog.numPages,x(this,"numPages",A)}_hasOnlyDocumentSignatures(A,e=0){return!!Array.isArray(A)&&A.every((A=>{if(!((A=this.xref.fetchIfRef(A))instanceof cA))return!1;if(A.has("Kids"))return++e>10?(S("_hasOnlyDocumentSignatures: maximum recursion depth reached"),!1):this._hasOnlyDocumentSignatures(A.get("Kids"),e);const t=QA(A.get("FT"),"Sig"),i=A.get("Rect"),a=Array.isArray(i)&&i.every((A=>0===A));return t&&a}))}get _xfaStreams(){const A=this.catalog.acroForm;if(!A)return null;const e=A.get("XFA"),t={"xdp:xdp":"",template:"",datasets:"",config:"",connectionSet:"",localeSet:"",stylesheet:"","/xdp:xdp":""};if(e instanceof dA&&!e.isEmpty)return t["xdp:xdp"]=e,t;if(!Array.isArray(e)||0===e.length)return null;for(let A=0,i=e.length;A{c.set(A,e)}));const C=[];for(const[A,t]of c){const a=t.get("FontDescriptor");if(!(a instanceof cA))continue;let s=a.get("FontFamily");s=s.replaceAll(/[ ]+(\d)/g,"$1");const n={fontFamily:s,fontWeight:a.get("FontWeight"),italicAngle:-a.get("ItalicAngle")};XA(n)&&C.push(g.handleSetFont(i,[rA.get(A),1],null,r,e,I,null,n).catch((function(A){return S(`loadXfaFonts: "${A}".`),null})))}await Promise.all(C);const B=this.xfaFactory.setFonts(o);if(!B)return;n.ignoreErrors=!0,C.length=0,o.length=0;const h=new Set;for(const A of B)Tn(`${A}-Regular`)||h.add(A);h.size&&B.push("PdfJS-Fallback");for(const A of B)if(!h.has(A))for(const t of[{name:"Regular",fontWeight:400,italicAngle:0},{name:"Bold",fontWeight:700,italicAngle:0},{name:"Italic",fontWeight:400,italicAngle:12},{name:"BoldItalic",fontWeight:700,italicAngle:12}]){const a=`${A}-${t.name}`,s=Pn(a);C.push(g.handleSetFont(i,[rA.get(a),1],null,r,e,I,s,{fontFamily:A,fontWeight:t.fontWeight,italicAngle:t.italicAngle}).catch((function(A){return S(`loadXfaFonts: "${A}".`),null})))}await Promise.all(C),this.xfaFactory.appendFonts(o,h)}async serializeXfaData(A){return this.xfaFactory?this.xfaFactory.serializeData(A):null}get version(){return this.catalog.version||this._version}get formInfo(){const A={hasFields:!1,hasAcroForm:!1,hasXfa:!1,hasSignatures:!1},e=this.catalog.acroForm;if(!e)return x(this,"formInfo",A);try{const t=e.get("Fields"),i=Array.isArray(t)&&t.length>0;A.hasFields=i;const a=e.get("XFA");A.hasXfa=Array.isArray(a)&&a.length>0||a instanceof dA&&!a.isEmpty;const s=!!(1&e.get("SigFlags")),n=s&&this._hasOnlyDocumentSignatures(t);A.hasAcroForm=i&&!n,A.hasSignatures=s}catch(A){if(A instanceof mA)throw A;S(`Cannot fetch form information: "${A}".`)}return x(this,"formInfo",A)}get documentInfo(){const A={PDFFormatVersion:this.version,Language:this.catalog.lang,EncryptFilterName:this.xref.encrypt?this.xref.encrypt.filterName:null,IsLinearized:!!this.linearization,IsAcroFormPresent:this.formInfo.hasAcroForm,IsXFAPresent:this.formInfo.hasXfa,IsCollectionPresent:!!this.catalog.collection,IsSignaturesPresent:this.formInfo.hasSignatures};let e;try{e=this.xref.trailer.get("Info")}catch(A){if(A instanceof mA)throw A;F("The document information dictionary is invalid.")}if(!(e instanceof cA))return x(this,"documentInfo",A);for(const t of e.getKeys()){const i=e.get(t);switch(t){case"Title":case"Author":case"Subject":case"Keywords":case"Creator":case"Producer":case"CreationDate":case"ModDate":if("string"==typeof i){A[t]=j(i);continue}break;case"Trapped":if(i instanceof rA){A[t]=i;continue}break;default:let e;switch(typeof i){case"string":e=j(i);break;case"number":case"boolean":e=i;break;default:i instanceof rA&&(e=i)}if(void 0===e){S(`Bad value, for custom key "${t}", in Info: ${i}.`);continue}A.Custom||(A.Custom=Object.create(null)),A.Custom[t]=e;continue}S(`Bad value, for key "${t}", in Info: ${i}.`)}return x(this,"documentInfo",A)}get fingerprints(){function A(A){return"string"==typeof A&&A.length>0&&"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"!==A}function e(A){const e=[];for(const t of A){const A=t.toString(16);e.push(A.padStart(2,"0"))}return e.join("")}const t=this.xref.trailer.get("ID");let i,a;return Array.isArray(t)&&A(t[0])?(i=T(t[0]),t[1]!==t[0]&&A(t[1])&&(a=T(t[1]))):i=Rr(this.stream.getByteRange(0,1024),0,1024),x(this,"fingerprints",[e(i),a?e(a):null])}async _getLinearizationPage(A){const{catalog:e,linearization:t,xref:i}=this,a=CA.get(t.objectNumberFirst,0);try{const A=await i.fetchAsync(a);if(A instanceof cA){let t=A.getRaw("Type");if(t instanceof CA&&(t=await i.fetchAsync(t)),QA(t,"Page")||!A.has("Type")&&!A.has("Kids")&&A.has("Contents"))return e.pageKidsCountCache.has(a)||e.pageKidsCountCache.put(a,1),e.pageIndexCache.has(a)||e.pageIndexCache.put(a,0),[A,a]}throw new v("The Linearization dictionary doesn't point to a valid Page dictionary.")}catch(t){return S(`_getLinearizationPage: "${t.message}".`),e.getPageDict(A)}}getPage(A){const e=this._pagePromises.get(A);if(e)return e;const{catalog:t,linearization:i,xfaFactory:a}=this;let s;return s=a?Promise.resolve([cA.empty,null]):i?.pageFirst===A?this._getLinearizationPage(A):t.getPageDict(A),s=s.then((([e,i])=>new od({pdfManager:this.pdfManager,xref:this.xref,pageIndex:A,pageDict:e,ref:i,globalIdFactory:this._globalIdFactory,fontCache:t.fontCache,builtInCMapCache:t.builtInCMapCache,standardFontDataCache:t.standardFontDataCache,globalImageCache:t.globalImageCache,systemFontCache:t.systemFontCache,nonBlendModesSet:t.nonBlendModesSet,xfaFactory:a}))),this._pagePromises.set(A,s),s}async checkFirstPage(A=!1){if(!A)try{await this.getPage(0)}catch(A){if(A instanceof wA)throw this._pagePromises.delete(0),await this.cleanup(),new DA}}async checkLastPage(A=!1){const{catalog:e,pdfManager:t}=this;let i;e.setActualNumPages();try{if(await Promise.all([t.ensureDoc("xfaFactory"),t.ensureDoc("linearization"),t.ensureCatalog("numPages")]),this.xfaFactory)return;if(i=this.linearization?this.linearization.numPages:e.numPages,!Number.isInteger(i))throw new v("Page count is not an integer.");if(i<=1)return;await this.getPage(i-1)}catch(a){if(this._pagePromises.delete(i-1),await this.cleanup(),a instanceof wA&&!A)throw new DA;let s;S(`checkLastPage - invalid /Pages tree /Count: ${i}.`);try{s=await e.getAllPageDicts(A)}catch(t){if(t instanceof wA&&!A)throw new DA;return void e.setActualNumPages(1)}for(const[A,[i,a]]of s){let s;i instanceof Error?(s=Promise.reject(i),s.catch((()=>{}))):s=Promise.resolve(new od({pdfManager:t,xref:this.xref,pageIndex:A,pageDict:i,ref:a,globalIdFactory:this._globalIdFactory,fontCache:e.fontCache,builtInCMapCache:e.builtInCMapCache,standardFontDataCache:e.standardFontDataCache,globalImageCache:e.globalImageCache,systemFontCache:e.systemFontCache,nonBlendModesSet:e.nonBlendModesSet,xfaFactory:null})),this._pagePromises.set(A,s)}e.setActualNumPages(s.size)}}fontFallback(A,e){return this.catalog.fontFallback(A,e)}async cleanup(A=!1){return this.catalog?this.catalog.cleanup(A):fr()}async#T(A,e,t,i,a){const{xref:s}=this;if(!(e instanceof CA)||a.has(e))return;a.put(e);const n=await s.fetchAsync(e);if(!(n instanceof cA))return;if(n.has("T")){const e=j(await n.getAsync("T"));A=""===A?e:`${A}.${e}`}else{let e=n;for(;;){if(e=e.getRaw("Parent"),e instanceof CA){if(a.has(e))break;e=await s.fetchAsync(e)}if(!(e instanceof cA))break;if(e.has("T")){const t=j(await e.getAsync("T"));A=""===A?t:`${A}.${t}`;break}}}if(t.has(A)||t.set(A,[]),t.get(A).push(Fu.create(s,e,i,null,!0,null).then((A=>A?.getFieldObject())).catch((function(A){return S(`#collectFieldObjects: "${A}".`),null}))),!n.has("Kids"))return;const g=await n.getAsync("Kids");if(Array.isArray(g))for(const e of g)await this.#T(A,e,t,i,a)}get fieldObjects(){return this.formInfo.hasFields?x(this,"fieldObjects",Promise.all([this.pdfManager.ensureDoc("annotationGlobals"),this.pdfManager.ensureCatalog("acroForm")]).then((async([A,e])=>{if(!A)return null;const t=new BA,i=Object.create(null),a=new Map;for(const i of await e.getAsync("Fields"))await this.#T("",i,a,A,t);const s=[];for(const[A,e]of a)s.push(Promise.all(e).then((e=>{(e=e.filter((A=>!!A))).length>0&&(i[A]=e)})));return await Promise.all(s),i}))):x(this,"fieldObjects",Promise.resolve(null))}get hasJSActions(){return x(this,"hasJSActions",this.pdfManager.ensureDoc("_parseHasJSActions"))}async _parseHasJSActions(){const[A,e]=await Promise.all([this.pdfManager.ensureCatalog("jsActions"),this.pdfManager.ensureDoc("fieldObjects")]);return!!A||!!e&&Object.values(e).some((A=>A.some((A=>null!==A.actions))))}get calculationOrderIds(){const A=this.catalog.acroForm;if(!A?.has("CO"))return x(this,"calculationOrderIds",null);const e=A.get("CO");if(!Array.isArray(e)||0===e.length)return x(this,"calculationOrderIds",null);const t=[];for(const A of e)A instanceof CA&&t.push(A.toString());return 0===t.length?x(this,"calculationOrderIds",null):x(this,"calculationOrderIds",t)}get annotationGlobals(){return x(this,"annotationGlobals",Fu.createGlobals(this.pdfManager))}}class Qd{constructor(A){this._docBaseUrl=function(A){if(A){const e=N(A);if(e)return e.href;S(`Invalid absolute docBaseUrl: "${A}".`)}return null}(A.docBaseUrl),this._docId=A.docId,this._password=A.password,this.enableXfa=A.enableXfa,A.evaluatorOptions.isOffscreenCanvasSupported&&=Z.isOffscreenCanvasSupported,this.evaluatorOptions=Object.freeze(A.evaluatorOptions)}get docId(){return this._docId}get password(){return this._password}get docBaseUrl(){return this._docBaseUrl}get catalog(){return this.pdfDocument.catalog}ensureDoc(A,e){return this.ensure(this.pdfDocument,A,e)}ensureXRef(A,e){return this.ensure(this.pdfDocument.xref,A,e)}ensureCatalog(A,e){return this.ensure(this.pdfDocument.catalog,A,e)}getPage(A){return this.pdfDocument.getPage(A)}fontFallback(A,e){return this.pdfDocument.fontFallback(A,e)}loadXfaFonts(A,e){return this.pdfDocument.loadXfaFonts(A,e)}loadXfaImages(){return this.pdfDocument.loadXfaImages()}serializeXfaData(A){return this.pdfDocument.serializeXfaData(A)}cleanup(A=!1){return this.pdfDocument.cleanup(A)}async ensure(A,e,t){R("Abstract method `ensure` called")}requestRange(A,e){R("Abstract method `requestRange` called")}requestLoadedStream(A=!1){R("Abstract method `requestLoadedStream` called")}sendProgressiveData(A){R("Abstract method `sendProgressiveData` called")}updatePassword(A){this._password=A}terminate(A){R("Abstract method `terminate` called")}}class ld extends Qd{constructor(A){super(A);const e=new ie(A.source);this.pdfDocument=new hd(this,e),this._loadedStreamPromise=Promise.resolve(e)}async ensure(A,e,t){const i=A[e];return"function"==typeof i?i.apply(A,t):i}requestRange(A,e){return Promise.resolve()}requestLoadedStream(A=!1){return this._loadedStreamPromise}terminate(A){}}class Ed extends Qd{constructor(A){super(A),this.streamManager=new ge(A.source,{msgHandler:A.handler,length:A.length,disableAutoFetch:A.disableAutoFetch,rangeChunkSize:A.rangeChunkSize}),this.pdfDocument=new hd(this,this.streamManager.getStream())}async ensure(A,e,t){try{const i=A[e];return"function"==typeof i?i.apply(A,t):i}catch(i){if(!(i instanceof mA))throw i;return await this.requestRange(i.begin,i.end),this.ensure(A,e,t)}}requestRange(A,e){return this.streamManager.requestRange(A,e)}requestLoadedStream(A=!1){return this.streamManager.requestAllChunks(A)}sendProgressiveData(A){this.streamManager.onReceiveData({chunk:A})}terminate(A){this.streamManager.abort(A)}}function ud(A){switch(A instanceof Error||"object"==typeof A&&null!==A||R('wrapReason: Expected "reason" to be a (possibly cloned) Error.'),A.name){case"AbortException":return new K(A.message);case"MissingPDFException":return new H(A.message);case"PasswordException":return new M(A.message,A.code);case"UnexpectedResponseException":return new Y(A.message,A.status);case"UnknownErrorException":return new L(A.message,A.details);default:return new L(A.message,A.toString())}}class dd{constructor(A,e,t){this.sourceName=A,this.targetName=e,this.comObj=t,this.callbackId=1,this.streamId=1,this.streamSinks=Object.create(null),this.streamControllers=Object.create(null),this.callbackCapabilities=Object.create(null),this.actionHandler=Object.create(null),this._onComObjOnMessage=A=>{const e=A.data;if(e.targetName!==this.sourceName)return;if(e.stream)return void this.#P(e);if(e.callback){const A=e.callbackId,t=this.callbackCapabilities[A];if(!t)throw new Error(`Cannot resolve callback ${A}`);if(delete this.callbackCapabilities[A],1===e.callback)t.resolve(e.data);else{if(2!==e.callback)throw new Error("Unexpected callback case");t.reject(ud(e.reason))}return}const i=this.actionHandler[e.action];if(!i)throw new Error(`Unknown action from worker: ${e.action}`);if(e.callbackId){const A=this.sourceName,a=e.sourceName;new Promise((function(A){A(i(e.data))})).then((function(i){t.postMessage({sourceName:A,targetName:a,callback:1,callbackId:e.callbackId,data:i})}),(function(i){t.postMessage({sourceName:A,targetName:a,callback:2,callbackId:e.callbackId,reason:ud(i)})}))}else e.streamId?this.#W(e):i(e.data)},t.addEventListener("message",this._onComObjOnMessage)}on(A,e){const t=this.actionHandler;if(t[A])throw new Error(`There is already an actionName called "${A}"`);t[A]=e}send(A,e,t){this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:A,data:e},t)}sendWithPromise(A,e,t){const i=this.callbackId++,a=Promise.withResolvers();this.callbackCapabilities[i]=a;try{this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:A,callbackId:i,data:e},t)}catch(A){a.reject(A)}return a.promise}sendWithStream(A,e,t,i){const a=this.streamId++,s=this.sourceName,n=this.targetName,g=this.comObj;return new ReadableStream({start:t=>{const r=Promise.withResolvers();return this.streamControllers[a]={controller:t,startCall:r,pullCall:null,cancelCall:null,isClosed:!1},g.postMessage({sourceName:s,targetName:n,action:A,streamId:a,data:e,desiredSize:t.desiredSize},i),r.promise},pull:A=>{const e=Promise.withResolvers();return this.streamControllers[a].pullCall=e,g.postMessage({sourceName:s,targetName:n,stream:6,streamId:a,desiredSize:A.desiredSize}),e.promise},cancel:A=>{G(A instanceof Error,"cancel must have a valid reason");const e=Promise.withResolvers();return this.streamControllers[a].cancelCall=e,this.streamControllers[a].isClosed=!0,g.postMessage({sourceName:s,targetName:n,stream:1,streamId:a,reason:ud(A)}),e.promise}},t)}#W(A){const e=A.streamId,t=this.sourceName,i=A.sourceName,a=this.comObj,s=this,n=this.actionHandler[A.action],g={enqueue(A,s=1,n){if(this.isCancelled)return;const g=this.desiredSize;this.desiredSize-=s,g>0&&this.desiredSize<=0&&(this.sinkCapability=Promise.withResolvers(),this.ready=this.sinkCapability.promise),a.postMessage({sourceName:t,targetName:i,stream:4,streamId:e,chunk:A},n)},close(){this.isCancelled||(this.isCancelled=!0,a.postMessage({sourceName:t,targetName:i,stream:3,streamId:e}),delete s.streamSinks[e])},error(A){G(A instanceof Error,"error must have a valid reason"),this.isCancelled||(this.isCancelled=!0,a.postMessage({sourceName:t,targetName:i,stream:5,streamId:e,reason:ud(A)}))},sinkCapability:Promise.withResolvers(),onPull:null,onCancel:null,isCancelled:!1,desiredSize:A.desiredSize,ready:null};g.sinkCapability.resolve(),g.ready=g.sinkCapability.promise,this.streamSinks[e]=g,new Promise((function(e){e(n(A.data,g))})).then((function(){a.postMessage({sourceName:t,targetName:i,stream:8,streamId:e,success:!0})}),(function(A){a.postMessage({sourceName:t,targetName:i,stream:8,streamId:e,reason:ud(A)})}))}#P(A){const e=A.streamId,t=this.sourceName,i=A.sourceName,a=this.comObj,s=this.streamControllers[e],n=this.streamSinks[e];switch(A.stream){case 8:A.success?s.startCall.resolve():s.startCall.reject(ud(A.reason));break;case 7:A.success?s.pullCall.resolve():s.pullCall.reject(ud(A.reason));break;case 6:if(!n){a.postMessage({sourceName:t,targetName:i,stream:7,streamId:e,success:!0});break}n.desiredSize<=0&&A.desiredSize>0&&n.sinkCapability.resolve(),n.desiredSize=A.desiredSize,new Promise((function(A){A(n.onPull?.())})).then((function(){a.postMessage({sourceName:t,targetName:i,stream:7,streamId:e,success:!0})}),(function(A){a.postMessage({sourceName:t,targetName:i,stream:7,streamId:e,reason:ud(A)})}));break;case 4:if(G(s,"enqueue should have stream controller"),s.isClosed)break;s.controller.enqueue(A.chunk);break;case 3:if(G(s,"close should have stream controller"),s.isClosed)break;s.isClosed=!0,s.controller.close(),this.#Z(s,e);break;case 5:G(s,"error should have stream controller"),s.controller.error(ud(A.reason)),this.#Z(s,e);break;case 2:A.success?s.cancelCall.resolve():s.cancelCall.reject(ud(A.reason)),this.#Z(s,e);break;case 1:if(!n)break;new Promise((function(e){e(n.onCancel?.(ud(A.reason)))})).then((function(){a.postMessage({sourceName:t,targetName:i,stream:2,streamId:e,success:!0})}),(function(A){a.postMessage({sourceName:t,targetName:i,stream:2,streamId:e,reason:ud(A)})})),n.sinkCapability.reject(ud(A.reason)),n.isCancelled=!0,delete this.streamSinks[e];break;default:throw new Error("Unexpected stream case")}}async#Z(A,e){await Promise.allSettled([A.startCall?.promise,A.pullCall?.promise,A.cancelCall?.promise]),delete this.streamControllers[e]}destroy(){this.comObj.removeEventListener("message",this._onComObjOnMessage)}}class fd{constructor(A){this._msgHandler=A,this._contentLength=null,this._fullRequestReader=null,this._rangeRequestReaders=[]}getFullReader(){return G(!this._fullRequestReader,"PDFWorkerStream.getFullReader can only be called once."),this._fullRequestReader=new pd(this._msgHandler),this._fullRequestReader}getRangeReader(A,e){const t=new md(A,e,this._msgHandler);return this._rangeRequestReaders.push(t),t}cancelAllRequests(A){this._fullRequestReader?.cancel(A);for(const e of this._rangeRequestReaders.slice(0))e.cancel(A)}}class pd{constructor(A){this._msgHandler=A,this.onProgress=null,this._contentLength=null,this._isRangeSupported=!1,this._isStreamingSupported=!1;const e=this._msgHandler.sendWithStream("GetReader");this._reader=e.getReader(),this._headersReady=this._msgHandler.sendWithPromise("ReaderHeadersReady").then((A=>{this._isStreamingSupported=A.isStreamingSupported,this._isRangeSupported=A.isRangeSupported,this._contentLength=A.contentLength}))}get headersReady(){return this._headersReady}get contentLength(){return this._contentLength}get isStreamingSupported(){return this._isStreamingSupported}get isRangeSupported(){return this._isRangeSupported}async read(){const{value:A,done:e}=await this._reader.read();return e?{value:void 0,done:!0}:{value:A.buffer,done:!1}}cancel(A){this._reader.cancel(A)}}class md{constructor(A,e,t){this._msgHandler=t,this.onProgress=null;const i=this._msgHandler.sendWithStream("GetRangeReader",{begin:A,end:e});this._reader=i.getReader()}get isStreamingSupported(){return!1}async read(){const{value:A,done:e}=await this._reader.read();return e?{value:void 0,done:!0}:{value:A.buffer,done:!1}}cancel(A){this._reader.cancel(A)}}class yd{constructor(A){this.name=A,this.terminated=!1,this._capability=Promise.withResolvers()}get finished(){return this._capability.promise}finish(){this._capability.resolve()}terminate(){this.terminated=!0}ensureNotTerminated(){if(this.terminated)throw new Error("Worker task was terminated")}}class wd{static setup(A,e){let t=!1;A.on("test",(function(e){t||(t=!0,A.send("test",e instanceof Uint8Array))})),A.on("configure",(function(A){var e;e=A.verbosity,Number.isInteger(e)&&(b=e)})),A.on("GetDocRequest",(function(A){return wd.createDocumentHandler(A,e)}))}static createDocumentHandler(A,e){let t,i=!1,a=null;const s=new Set,n=k(),{docId:g,apiVersion:r}=A,o="4.6.82";if(r!==o)throw new Error(`The API version "${r}" does not match the Worker version "${o}".`);const I=[];for(const A in[])I.push(A);if(I.length)throw new Error("The `Array.prototype` contains unexpected enumerable properties: "+I.join(", ")+"; thus breaking e.g. `for...in` iteration of `Array`s.");const c=g+"_worker";let C=new dd(c,g,e);function B(){if(i)throw new Error("Worker was terminated")}function h(A){s.add(A)}function Q(A){A.finish(),s.delete(A)}async function l(A){await t.ensureDoc("checkHeader"),await t.ensureDoc("parseStartXRef"),await t.ensureDoc("parse",[A]),await t.ensureDoc("checkFirstPage",[A]),await t.ensureDoc("checkLastPage",[A]);const e=await t.ensureDoc("isPureXfa");if(e){const A=new yd("loadXfaFonts");h(A),await Promise.all([t.loadXfaFonts(C,A).catch((A=>{})).then((()=>Q(A))),t.loadXfaImages()])}const[i,a]=await Promise.all([t.ensureDoc("numPages"),t.ensureDoc("fingerprints")]);return{numPages:i,fingerprints:a,htmlForXfa:e?await t.ensureDoc("htmlForXfa"):null}}return C.on("GetPage",(function(A){return t.getPage(A.pageIndex).then((function(A){return Promise.all([t.ensure(A,"rotate"),t.ensure(A,"ref"),t.ensure(A,"userUnit"),t.ensure(A,"view")]).then((function([A,e,t,i]){return{rotate:A,ref:e,refStr:e?.toString()??null,userUnit:t,view:i}}))}))})),C.on("GetPageIndex",(function(A){const e=CA.get(A.num,A.gen);return t.ensureCatalog("getPageIndex",[e])})),C.on("GetDestinations",(function(A){return t.ensureCatalog("destinations")})),C.on("GetDestination",(function(A){return t.ensureCatalog("getDestination",[A.id])})),C.on("GetPageLabels",(function(A){return t.ensureCatalog("pageLabels")})),C.on("GetPageLayout",(function(A){return t.ensureCatalog("pageLayout")})),C.on("GetPageMode",(function(A){return t.ensureCatalog("pageMode")})),C.on("GetViewerPreferences",(function(A){return t.ensureCatalog("viewerPreferences")})),C.on("GetOpenAction",(function(A){return t.ensureCatalog("openAction")})),C.on("GetAttachments",(function(A){return t.ensureCatalog("attachments")})),C.on("GetDocJSActions",(function(A){return t.ensureCatalog("jsActions")})),C.on("GetPageJSActions",(function({pageIndex:A}){return t.getPage(A).then((function(A){return t.ensure(A,"jsActions")}))})),C.on("GetOutline",(function(A){return t.ensureCatalog("documentOutline")})),C.on("GetOptionalContentConfig",(function(A){return t.ensureCatalog("optionalContentConfig")})),C.on("GetPermissions",(function(A){return t.ensureCatalog("permissions")})),C.on("GetMetadata",(function(A){return Promise.all([t.ensureDoc("documentInfo"),t.ensureCatalog("metadata")])})),C.on("GetMarkInfo",(function(A){return t.ensureCatalog("markInfo")})),C.on("GetData",(function(A){return t.requestLoadedStream().then((function(A){return A.bytes}))})),C.on("GetAnnotations",(function({pageIndex:A,intent:e}){return t.getPage(A).then((function(t){const i=new yd(`GetAnnotations: page ${A}`);return h(i),t.getAnnotationsData(C,i,e).then((A=>(Q(i),A)),(A=>{throw Q(i),A}))}))})),C.on("GetFieldObjects",(function(A){return t.ensureDoc("fieldObjects")})),C.on("HasJSActions",(function(A){return t.ensureDoc("hasJSActions")})),C.on("GetCalculationOrderIds",(function(A){return t.ensureDoc("calculationOrderIds")})),C.on("SaveDocument",(async function({isPureXfa:A,numPages:e,annotationStorage:i,filename:a}){const s=[t.requestLoadedStream(),t.ensureCatalog("acroForm"),t.ensureCatalog("acroFormRef"),t.ensureDoc("startXRef"),t.ensureDoc("xref"),t.ensureDoc("linearization"),t.ensureCatalog("structTreeRoot")],n=[],g=A?null:zA(i),[r,o,I,c,B,h,l]=await Promise.all(s),E=B.trailer.getRaw("Root")||null;let u;if(g){l?await l.canUpdateStructTree({pdfManager:t,xref:B,newAnnotationsByPage:g})&&(u=l):await _r.canCreateStructureTree({catalogRef:E,pdfManager:t,newAnnotationsByPage:g})&&(u=null);const A=Fu.generateImages(i.values(),B,t.evaluatorOptions.isOffscreenCanvasSupported),e=void 0===u?n:[];for(const[i,a]of g)e.push(t.getPage(i).then((e=>{const t=new yd(`Save (editor): page ${i}`);return e.saveNewAnnotations(C,t,a,A).finally((function(){Q(t)}))})));null===u?n.push(Promise.all(e).then((async A=>(await _r.createStructureTree({newAnnotationsByPage:g,xref:B,catalogRef:E,pdfManager:t,newRefs:A}),A)))):u&&n.push(Promise.all(e).then((async A=>(await u.updateStructureTree({newAnnotationsByPage:g,pdfManager:t,newRefs:A}),A))))}if(A)n.push(t.serializeXfaData(i));else for(let A=0;AA.needAppearances)),y=o instanceof cA&&o.get("XFA")||null;let w=null,D=!1;if(Array.isArray(y)){for(let A=0,e=y.length;A{"string"==typeof t&&(A[e]=j(t))})),b={rootRef:E,encryptRef:B.trailer.getRaw("Encrypt")||null,newRef:B.getNewTemporaryRef(),infoRef:B.trailer.getRaw("Info")||null,info:A,fileIds:B.trailer.get("ID")||null,startXRef:h?c:B.lastXRefStreamPos??c,filename:a}}return zr({originalData:r.bytes,xrefInfo:b,newRefs:f,xref:B,hasXfa:!!y,xfaDatasetsRef:w,hasXfaDatasetsEntry:D,needAppearances:m,acroFormRef:I,acroForm:o,xfaData:p,useXrefStream:EA(B.topDict,"XRef")}).finally((()=>{B.resetNewTemporaryRef()}))})),C.on("GetOperatorList",(function(A,e){const i=A.pageIndex;t.getPage(i).then((function(t){const a=new yd(`GetOperatorList: page ${i}`);h(a);const s=n>=5?Date.now():0;t.getOperatorList({handler:C,sink:e,task:a,intent:A.intent,cacheKey:A.cacheKey,annotationStorage:A.annotationStorage,modifiedIds:A.modifiedIds}).then((function(A){Q(a),s&&F(`page=${i+1} - getOperatorList: time=${Date.now()-s}ms, len=${A.length}`),e.close()}),(function(A){Q(a),a.terminated||e.error(A)}))}))})),C.on("GetTextContent",(function(A,e){const{pageIndex:i,includeMarkedContent:a,disableNormalization:s}=A;t.getPage(i).then((function(A){const t=new yd("GetTextContent: page "+i);h(t);const g=n>=5?Date.now():0;A.extractTextContent({handler:C,task:t,sink:e,includeMarkedContent:a,disableNormalization:s}).then((function(){Q(t),g&&F(`page=${i+1} - getTextContent: time=`+(Date.now()-g)+"ms"),e.close()}),(function(A){Q(t),t.terminated||e.error(A)}))}))})),C.on("GetStructTree",(function(A){return t.getPage(A.pageIndex).then((function(A){return t.ensure(A,"getStructTree")}))})),C.on("FontFallback",(function(A){return t.fontFallback(A.id,C)})),C.on("Cleanup",(function(A){return t.cleanup(!0)})),C.on("Terminate",(function(A){i=!0;const e=[];if(t){t.terminate(new K("Worker was terminated."));const A=t.cleanup();e.push(A),t=null}else fr();a&&a(new K("Worker was terminated."));for(const A of s)e.push(A.finished),A.terminate();return Promise.all(e).then((function(){C.destroy(),C=null}))})),C.on("Ready",(function(e){!function(A){function e(A){B(),C.send("GetDoc",{pdfInfo:A})}function s(A){if(B(),A instanceof M){const e=new yd(`PasswordException: response ${A.code}`);h(e),C.sendWithPromise("PasswordRequest",A).then((function({password:A}){Q(e),t.updatePassword(A),n()})).catch((function(){Q(e),C.send("DocException",A)}))}else A instanceof J||A instanceof H||A instanceof Y||A instanceof L?C.send("DocException",A):C.send("DocException",new L(A.message,A.toString()))}function n(){B(),l(!1).then(e,(function(A){B(),A instanceof DA?t.requestLoadedStream().then((function(){B(),l(!0).then(e,s)})):s(A)}))}B(),function({data:A,password:e,disableAutoFetch:t,rangeChunkSize:i,length:s,docBaseUrl:n,enableXfa:r,evaluatorOptions:o}){const I={source:null,disableAutoFetch:t,docBaseUrl:n,docId:g,enableXfa:r,evaluatorOptions:o,handler:C,length:s,password:e,rangeChunkSize:i},c=Promise.withResolvers();let h;if(A){try{I.source=A,h=new ld(I),c.resolve(h)}catch(A){c.reject(A)}return c.promise}let Q,l=[];try{Q=new fd(C)}catch(A){return c.reject(A),c.promise}const E=Q.getFullReader();E.headersReady.then((function(){if(E.isRangeSupported){I.source=Q,I.length=E.contentLength,I.disableAutoFetch||=E.isStreamingSupported,h=new Ed(I);for(const A of l)h.sendProgressiveData(A);l=[],c.resolve(h),a=null}})).catch((function(A){c.reject(A),a=null}));let u=0;return new Promise((function(A,e){const t=function({value:A,done:i}){try{if(B(),i)return h||function(){const A=bA(l);s&&A.length!==s&&S("reported HTTP length is different from actual");try{I.source=A,h=new ld(I),c.resolve(h)}catch(A){c.reject(A)}l=[]}(),void(a=null);u+=A.byteLength,E.isStreamingSupported||C.send("DocProgress",{loaded:u,total:Math.max(u,E.contentLength||0)}),h?h.sendProgressiveData(A):l.push(A),E.read().then(t,e)}catch(A){e(A)}};E.read().then(t,e)})).catch((function(A){c.reject(A),a=null})),a=function(A){Q.cancelAllRequests(A)},c.promise}(A).then((function(A){if(i)throw A.terminate(new K("Worker was terminated.")),new Error("Worker was terminated");t=A,t.requestLoadedStream(!0).then((A=>{C.send("DataLoaded",{length:A.bytes.byteLength})}))})).then(n,s)}(A),A=null})),c}static initializeFromPort(A){const e=new dd("worker","main",A);wd.setup(e,A),e.send("ready",null)}}var Dd;"undefined"==typeof window&&!t&&"undefined"!=typeof self&&"function"==typeof(Dd=self).postMessage&&"onmessage"in Dd&&wd.initializeFromPort(self);var bd={}.false;export{bd as WorkerMessageHandler}; \ No newline at end of file diff --git a/dist/assessment/index.js b/dist/assessment/index.js index c05be4e..0d6d902 100644 --- a/dist/assessment/index.js +++ b/dist/assessment/index.js @@ -1,2 +1,2 @@ /*! For license information please see index.js.LICENSE.txt */ -var t={8097:(t,e,i)=>{i.d(e,{LT:()=>g});var n=i(4113),s=i(173),r=i(1433),a=i(7518),o=i(77),l=i(3963),c=i(7028);function d(t){return d="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},d(t)}function h(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,n)}return i}function u(t){for(var e=1;e{i.r(e),i.d(e,{activity:()=>a,activityId:()=>o,activitySubTitle:()=>d,activityTags:()=>h,activityTemplateId:()=>l,activityTitle:()=>c,adaptiveType:()=>u,annotationsConfig:()=>p,autoSaveConfig:()=>f,elapsedTime:()=>g,hasActivityTemplate:()=>m,hasAnnotations:()=>v,hasAnswerMasking:()=>b,hasAutoSave:()=>y,hasEvents:()=>w,hasItemPool:()=>A,hasLineReader:()=>x,hasResourceItems:()=>E,hasSections:()=>S,hasShuffledItems:()=>_,hasTryAgain:()=>T,isAdaptive:()=>C,isResuming:()=>k,itemBank:()=>M,itemPool:()=>I,maxTime:()=>L,region:()=>P,resourceItems:()=>R,sessionId:()=>D,state:()=>F,timeRemaining:()=>O,totalItems:()=>N,userId:()=>B});var n=i(4113),s=i(7028),r=i(5059);function a(){return n.appInstance().getActivity()}function o(){return a().activity_id}function l(){return a().activity_template_id}function c(){return a().config.title}function d(){return a().config.subtitle}function h(){return n.appInstance().getTags()}function u(){return C()&&a().adaptive.hasOwnProperty("type")?a().adaptive.type:""}function p(){var t;return v()&&null!==(t=a())&&void 0!==t&&null!==(t=t.config)&&void 0!==t&&t.annotations_api_init_options?a().config.annotations_api_init_options:{}}function f(){var t,e=a();return null!=e&&null!==(t=e.config)&&void 0!==t&&null!==(t=t.navigation)&&void 0!==t&&t.auto_save?e.config.navigation.auto_save:{}}function g(){return n.appInstance().getTime()}function m(){return a().hasOwnProperty("activity_template_id")}function v(){var t,e,i=a();return Boolean(!0===(null==i||null===(t=i.config)||void 0===t?void 0:t.annotations)||(null==i||null===(e=i.config)||void 0===e?void 0:e.annotations_api_init_options))}function b(){return!!document.querySelector(".test-answer-masking")}function y(){var t=a();return t.hasOwnProperty("config")&&t.config.hasOwnProperty("navigation")&&t.config.navigation.hasOwnProperty("auto_save")&&!1!==t.config.navigation.auto_save}function _(){var t;return Boolean(null===(t=a())||void 0===t||null===(t=t.config)||void 0===t||null===(t=t.configuration)||void 0===t?void 0:t.shuffle_items)}function w(){var t=a();return t.hasOwnProperty("events")&&!1!==t.events}function A(){return a().hasOwnProperty("item_pool_id")}function x(){return!!document.querySelector(".lrn_linereader-toggle")}function E(){var t;return Boolean(null===(t=a())||void 0===t||null===(t=t.config)||void 0===t||null===(t=t.navigation)||void 0===t?void 0:t.resource_items)}function S(){return a().hasOwnProperty("sections")}function T(){var t;return null===(t=a())||void 0===t?void 0:t.dynamic_items.hasOwnProperty("try_again")}function C(){return a().hasOwnProperty("adaptive")}function k(){return a().existing_session}function M(){var t;return null===(t=a())||void 0===t?void 0:t.organisation_id}function I(){var t;return null===(t=a())||void 0===t?void 0:t.item_pool_id}function L(){var t;return null!==(t=a())&&void 0!==t&&null!==(t=t.config)&&void 0!==t&&null!==(t=t.time)&&void 0!==t&&t.max_time?a().config.time.max_time:0}function P(){var t;return null===(t=a())||void 0===t||null===(t=t.config)||void 0===t?void 0:t.regions}function R(){var t;return null===(t=a())||void 0===t||null===(t=t.config)||void 0===t||null===(t=t.navigation)||void 0===t?void 0:t.resource_items}function D(){var t;return null===(t=a())||void 0===t?void 0:t.session_id}function F(){var t;return void 0===(null===(t=a())||void 0===t?void 0:t.state)?"initial":a().state}function O(){return 0===L()?null:L()-g()}function N(){if(S()){for(var t=0,e=s.sections(),i=0;i{i.r(e),i.d(e,{annotationsApp:()=>l,appInstance:()=>o,assessApp:()=>c,eventsApp:()=>d,init:()=>a,questionsApp:()=>h});var n=i(1433),s=i(3963),r={};function a(t){r.app=t,r.app.on("all",(function(t){(0,n.handleEvent)(t)})),r.app.on("item:load",(function(t){(0,s.questionResponseIds)().forEach((function(t){r.app.question(t).on("changed",(function(t){(0,n.handleEvent)("changed")}))}))}))}function o(){return r.app}function l(){return void 0!==o().annotationsApp()?o().annotationsApp():null}function c(){return o().assessApp()}function d(){return o().eventsApp()}function h(){return o().questionsApp()}},1433:(t,e,i)=>{i.r(e),i.d(e,{diagnostics:()=>l,filterEvent:()=>c,handleEvent:()=>d,listen:()=>h});var n=i(4113),s=i(173),r=i(5059),a="2.16.0",o={events:{broadcast:!1,listenFor:"item"}};function l(){var t=window.LearnosityApp?LearnosityApp.versions:{};return{apps:{annotations:{app:n.annotationsApp(),config:s.annotationsConfig(),enabled:s.hasAnnotations()},assess:{app:n.assessApp()},events:{app:n.eventsApp(),enabled:s.hasEvents()},items:{app:n.appInstance(),metadata:s.activity().config.metadata},questions:{app:n.questionsApp()}},activity:{activity:s.activityId(),activityTemplate:s.activityTemplateId(),autoSave:{config:s.autoSaveConfig(),enabled:s.hasAutoSave()},itemBank:s.itemBank(),itemPool:s.itemPool(),session:s.sessionId(),state:s.state(),type:s.activity().type,user:s.userId()},LT:{version:a},versions:t}}function c(t){/^[a-zA-Z:*]*$/.test(t)?o.events.listenFor=t:r.A.warn("Invalid event type")}function d(t){if(o.events.broadcast){var e=o.events.listenFor,i=e.replaceAll("*","");1===e.length&&"*"===e||"all"===e?r.A.info(t):e.startsWith("*")&&!e.endsWith("*")?t.endsWith(i)&&r.A.info(t):e.endsWith("*")&&!e.startsWith("*")?t.startsWith(i)&&r.A.info(t):e.startsWith("*")&&e.endsWith("*")?t.includes(i)&&r.A.info(t):t.startsWith(i)&&r.A.info(t)}}function h(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];o.events.broadcast=Boolean(t),Boolean(t)?r.A.info("👂 listening for '".concat(o.events.listenFor,"'")):r.A.info("🚫👂 not listening")}},7518:(t,e,i)=>{i.r(e),i.d(e,{dynamic:()=>l,flag:()=>c,isDynamicItem:()=>d,isFirstItem:()=>h,isFlagged:()=>p,isItemFullyAttempted:()=>f,isLastItem:()=>u,isMaskingEnabled:()=>g,item:()=>m,itemAttemptStatus:()=>v,itemByResponseId:()=>b,itemElement:()=>y,itemPosition:()=>_,itemReference:()=>w,itemTags:()=>A});var n=i(4113),s=i(173),r=i(3963),a=i(7028);function o(t){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o(t)}function l(){var t=w();return n.assessApp().item(t).dynamic||{}}function c(){var t=w();n.assessApp().item(t).flag()}function d(){var t;return null===(t=m())||void 0===t?void 0:t.source.hasOwnProperty("data_table_seed")}function h(){return s.hasSections()?("object"===o(a.sections()[0].items[0])?a.sections()[0].items[0].reference:a.sections()[0].items[0])===m().reference:("object"===o(s.activity().items[0])?s.activity().items[0].reference:s.activity().items[0])===m().reference}function u(){return m().is_last_item}function p(){return m().user_flagged}function f(t){var e,i,s;if(e=t?n.appInstance().getItems()[t].questions:r.questions(),Array.isArray(e)&&e.length)for(var a=0;a{i.r(e),i.d(e,{answerMasking:()=>o,dialog:()=>l,hideDialog:()=>c,isResponsiveMode:()=>d,isReviewScreen:()=>h,lineReader:()=>u,navigate:()=>p,next:()=>f,previous:()=>g,review:()=>m,submit:()=>v}),i(173);var n=i(4113),s=i(7518),r=i(5059),a={answerMasking:{enabled:null},lineReader:{enabled:null,id:null}};function o(t){if(null===a.answerMasking.enabled){var e=document.querySelector(".test-answer-masking");a.answerMasking.enabled=!!e}a.answerMasking.enabled?void 0!==t&&n.appInstance().questionsApp().masking(t):r.A.warn("Answer masking is not enabled in the Items API configuration.")}function l(t){n.assessApp().dialogs().custom.show(t)}function c(){n.assessApp().dialogs().custom.hide()}function d(){return Boolean(document.querySelector(".has-menu-region"))}function h(){var t=!1;setTimeout((function(){return null===document.getElementsByClassName("review-screen")[0].getAttribute("aria-hidden")&&(t=!0),t}),500)}function u(t){if(null===a.lineReader.enabled){var e=document.querySelector(".lrn_linereader-toggle");if(e){a.lineReader.enabled=!0;var i=e.querySelector("[data-lrn-widget-container]").getAttribute("data-lrn-widget-container").match(/\d+$/);i?a.lineReader.id=i[0]:r.A.warn("Could not find the line reader unique id.")}else a.lineReader.enabled=!1}if(a.lineReader.enabled&&null!==a.lineReader.id){var s=n.appInstance().features()["lrn-assessapp-feature_".concat(a.lineReader.id)];switch(t){case"show":s.show();break;case"hide":s.hide();break;default:s.toggle()}}else r.A.warn("Line reader is not enabled in the Items API configuration.")}function p(t){switch(t){case"previous":n.appInstance().items().previous();break;case"next":s.isLastItem()||n.appInstance().items().next();break;case"review":null===document.getElementsByClassName("review-screen")[0].getAttribute("aria-hidden")?n.appInstance().dialogs().reviewScreen.hide():n.appInstance().dialogs().reviewScreen.show();break;case"submit":var e={show_submit_confirmation:!0,show_submit_ui:!0,success:function(t){alert("Test saved!")},error:function(t){alert("Test submit failed...check browser log"),console.log("Submission failed: ",t)}};n.appInstance().submit(e);break;default:"number"==typeof Number(t)&&Number(t)>=0?n.appInstance().items().goto(Number(t)):r.A.warn("Invalid target (".concat(t,")"))}}function f(){p("next")}function g(){p("previous")}function m(){p("review")}function v(){p("submit")}},3963:(t,e,i)=>{i.r(e),i.d(e,{hasCheckAnswer:()=>o,isAutoScorable:()=>l,question:()=>c,questionInstance:()=>d,questionResponse:()=>u,questionResponseIds:()=>p,questionScore:()=>f,questions:()=>h});var n=i(4113),s=i(7518),r=i(173),a=i(5059);function o(t){var e;if(!l(t))return!1;var i=(null===(e=(0,r.activity)())||void 0===e||null===(e=e.config)||void 0===e||null===(e=e.questions_api_init_options)||void 0===e?void 0:e.attribute_overrides)&&(0,r.activity)().config.questions_api_init_options.attribute_overrides.hasOwnProperty("instant_feedback")&&"boolean"==typeof(0,r.activity)().config.questions_api_init_options.attribute_overrides.instant_feedback,n=c(t);return i?(0,r.activity)().config.questions_api_init_options.attribute_overrides.instant_feedback:!(!n.hasOwnProperty("instant_feedback")||"boolean"!=typeof n.instant_feedback)&&n.instant_feedback}function l(t){return c(t),d(t).checkValidation().has_validation}function c(t){var e=t||p()[0];return e?n.appInstance().question(e).getQuestion():(a.A.error("Question not found (index ".concat(e,")")),{})}function d(t){var e=t||p()[0];return e?n.appInstance().question(e):{}}function h(){return s.item().questions}function u(t){var e=t||p()[0];return e?function(t){return n.appInstance().question(t)?n.appInstance().question(t).getResponse():void a.A.error("Response not found ".concat(t))}(e):{}}function p(){return h().map((function(t){return t.response_id}))}function f(t){var e=t||p()[0];return e&&n.appInstance().getScores()[e]||{}}},7028:(t,e,i)=>{i.r(e),i.d(e,{isFirstItemInSection:()=>r,isLastItemInSection:()=>a,section:()=>o,sectionHasShuffledItems:()=>l,sectionIndex:()=>c,sectionItemPosition:()=>d,sections:()=>h,totalItemsInSection:()=>u});var n=i(173),s=i(7518);function r(){return 1===d()}function a(){return d()===u()}function o(){if(n.hasSections()){for(var t=s.itemReference(),e=h(),i=-1,r=!1,a=0;a{i.d(e,{A:()=>n});const n={debug:function(t,e){"DEBUG"===e&&console.log(t)},error:function(t){console.error("%cError:%c "+t,"display:inline-block;background-color:#e0005a;color:#fff;font-weight:bold;padding:3px 7px;border-radius:3px","")},info:function(t){console.info("%cInfo:%c "+t,"display:inline-block;background-color:#46C0FF;color:#000;font-weight:bold;padding:3px 7px;border-radius:3px","")},log:function(t){console.log(t)},warn:function(t){console.warn("%cWarning:%c "+t,"display:inline-block;background-color:gold;color:#000;font-weight:bold;padding:3px 7px;border-radius:3px","")}}},4196:(t,e,i)=>{var n;!function(){var s=function(){this.init()};s.prototype={init:function(){var t=this||r;return t._counter=1e3,t._html5AudioPool=[],t.html5PoolSize=10,t._codecs={},t._howls=[],t._muted=!1,t._volume=1,t._canPlayEvent="canplaythrough",t._navigator="undefined"!=typeof window&&window.navigator?window.navigator:null,t.masterGain=null,t.noAudio=!1,t.usingWebAudio=!0,t.autoSuspend=!0,t.ctx=null,t.autoUnlock=!0,t._setup(),t},volume:function(t){var e=this||r;if(t=parseFloat(t),e.ctx||p(),void 0!==t&&t>=0&&t<=1){if(e._volume=t,e._muted)return e;e.usingWebAudio&&e.masterGain.gain.setValueAtTime(t,r.ctx.currentTime);for(var i=0;i=0;e--)t._howls[e].unload();return t.usingWebAudio&&t.ctx&&void 0!==t.ctx.close&&(t.ctx.close(),t.ctx=null,p()),t},codecs:function(t){return(this||r)._codecs[t.replace(/^x-/,"")]},_setup:function(){var t=this||r;if(t.state=t.ctx&&t.ctx.state||"suspended",t._autoSuspend(),!t.usingWebAudio)if("undefined"!=typeof Audio)try{void 0===(new Audio).oncanplaythrough&&(t._canPlayEvent="canplay")}catch(e){t.noAudio=!0}else t.noAudio=!0;try{(new Audio).muted&&(t.noAudio=!0)}catch(t){}return t.noAudio||t._setupCodecs(),t},_setupCodecs:function(){var t=this||r,e=null;try{e="undefined"!=typeof Audio?new Audio:null}catch(e){return t}if(!e||"function"!=typeof e.canPlayType)return t;var i=e.canPlayType("audio/mpeg;").replace(/^no$/,""),n=t._navigator?t._navigator.userAgent:"",s=n.match(/OPR\/(\d+)/g),a=s&&parseInt(s[0].split("/")[1],10)<33,o=-1!==n.indexOf("Safari")&&-1===n.indexOf("Chrome"),l=n.match(/Version\/(.*?) /),c=o&&l&&parseInt(l[1],10)<15;return t._codecs={mp3:!(a||!i&&!e.canPlayType("audio/mp3;").replace(/^no$/,"")),mpeg:!!i,opus:!!e.canPlayType('audio/ogg; codecs="opus"').replace(/^no$/,""),ogg:!!e.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,""),oga:!!e.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,""),wav:!!(e.canPlayType('audio/wav; codecs="1"')||e.canPlayType("audio/wav")).replace(/^no$/,""),aac:!!e.canPlayType("audio/aac;").replace(/^no$/,""),caf:!!e.canPlayType("audio/x-caf;").replace(/^no$/,""),m4a:!!(e.canPlayType("audio/x-m4a;")||e.canPlayType("audio/m4a;")||e.canPlayType("audio/aac;")).replace(/^no$/,""),m4b:!!(e.canPlayType("audio/x-m4b;")||e.canPlayType("audio/m4b;")||e.canPlayType("audio/aac;")).replace(/^no$/,""),mp4:!!(e.canPlayType("audio/x-mp4;")||e.canPlayType("audio/mp4;")||e.canPlayType("audio/aac;")).replace(/^no$/,""),weba:!(c||!e.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/,"")),webm:!(c||!e.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/,"")),dolby:!!e.canPlayType('audio/mp4; codecs="ec-3"').replace(/^no$/,""),flac:!!(e.canPlayType("audio/x-flac;")||e.canPlayType("audio/flac;")).replace(/^no$/,"")},t},_unlockAudio:function(){var t=this||r;if(!t._audioUnlocked&&t.ctx){t._audioUnlocked=!1,t.autoUnlock=!1,t._mobileUnloaded||44100===t.ctx.sampleRate||(t._mobileUnloaded=!0,t.unload()),t._scratchBuffer=t.ctx.createBuffer(1,1,22050);var e=function(i){for(;t._html5AudioPool.length0?o._seek:i._sprite[t][0]/1e3),d=Math.max(0,(i._sprite[t][0]+i._sprite[t][1])/1e3-c),h=1e3*d/Math.abs(o._rate),u=i._sprite[t][0]/1e3,p=(i._sprite[t][0]+i._sprite[t][1])/1e3;o._sprite=t,o._ended=!1;var f=function(){o._paused=!1,o._seek=c,o._start=u,o._stop=p,o._loop=!(!o._loop&&!i._sprite[t][2])};if(!(c>=p)){var g=o._node;if(i._webAudio){var m=function(){i._playLock=!1,f(),i._refreshBuffer(o);var t=o._muted||i._muted?0:o._volume;g.gain.setValueAtTime(t,r.ctx.currentTime),o._playStart=r.ctx.currentTime,void 0===g.bufferSource.start?o._loop?g.bufferSource.noteGrainOn(0,c,86400):g.bufferSource.noteGrainOn(0,c,d):o._loop?g.bufferSource.start(0,c,86400):g.bufferSource.start(0,c,d),h!==1/0&&(i._endTimers[o._id]=setTimeout(i._ended.bind(i,o),h)),e||setTimeout((function(){i._emit("play",o._id),i._loadQueue()}),0)};"running"===r.state&&"interrupted"!==r.ctx.state?m():(i._playLock=!0,i.once("resume",m),i._clearTimer(o._id))}else{var v=function(){g.currentTime=c,g.muted=o._muted||i._muted||r._muted||g.muted,g.volume=o._volume*r.volume(),g.playbackRate=o._rate;try{var n=g.play();if(n&&"undefined"!=typeof Promise&&(n instanceof Promise||"function"==typeof n.then)?(i._playLock=!0,f(),n.then((function(){i._playLock=!1,g._unlocked=!0,e?i._loadQueue():i._emit("play",o._id)})).catch((function(){i._playLock=!1,i._emit("playerror",o._id,"Playback was unable to start. This is most commonly an issue on mobile devices and Chrome where playback was not within a user interaction."),o._ended=!0,o._paused=!0}))):e||(i._playLock=!1,f(),i._emit("play",o._id)),g.playbackRate=o._rate,g.paused)return void i._emit("playerror",o._id,"Playback was unable to start. This is most commonly an issue on mobile devices and Chrome where playback was not within a user interaction.");"__default"!==t||o._loop?i._endTimers[o._id]=setTimeout(i._ended.bind(i,o),h):(i._endTimers[o._id]=function(){i._ended(o),g.removeEventListener("ended",i._endTimers[o._id],!1)},g.addEventListener("ended",i._endTimers[o._id],!1))}catch(t){i._emit("playerror",o._id,t)}};"data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA"===g.src&&(g.src=i._src,g.load());var b=window&&window.ejecta||!g.readyState&&r._navigator.isCocoonJS;if(g.readyState>=3||b)v();else{i._playLock=!0,i._state="loading";var y=function(){i._state="loaded",v(),g.removeEventListener(r._canPlayEvent,y,!1)};g.addEventListener(r._canPlayEvent,y,!1),i._clearTimer(o._id)}}return o._id}i._ended(o)},pause:function(t){var e=this;if("loaded"!==e._state||e._playLock)return e._queue.push({event:"pause",action:function(){e.pause(t)}}),e;for(var i=e._getSoundIds(t),n=0;n=0?e=parseInt(s[0],10):t=parseFloat(s[0]):s.length>=2&&(t=parseFloat(s[0]),e=parseInt(s[1],10)),!(void 0!==t&&t>=0&&t<=1))return(i=e?n._soundById(e):n._sounds[0])?i._volume:0;if("loaded"!==n._state||n._playLock)return n._queue.push({event:"volume",action:function(){n.volume.apply(n,s)}}),n;void 0===e&&(n._volume=t),e=n._getSoundIds(e);for(var a=0;a0?n/c:n),h=Date.now();t._fadeTo=i,t._interval=setInterval((function(){var s=(Date.now()-h)/n;h=Date.now(),o+=l*s,o=Math.round(100*o)/100,o=l<0?Math.max(i,o):Math.min(i,o),a._webAudio?t._volume=o:a.volume(o,t._id,!0),r&&(a._volume=o),(ie&&o>=i)&&(clearInterval(t._interval),t._interval=null,t._fadeTo=null,a.volume(i,t._id),a._emit("fade",t._id))}),d)},_stopFade:function(t){var e=this,i=e._soundById(t);return i&&i._interval&&(e._webAudio&&i._node.gain.cancelScheduledValues(r.ctx.currentTime),clearInterval(i._interval),i._interval=null,e.volume(i._fadeTo,t),i._fadeTo=null,e._emit("fade",t)),e},loop:function(){var t,e,i,n=this,s=arguments;if(0===s.length)return n._loop;if(1===s.length){if("boolean"!=typeof s[0])return!!(i=n._soundById(parseInt(s[0],10)))&&i._loop;t=s[0],n._loop=t}else 2===s.length&&(t=s[0],e=parseInt(s[1],10));for(var r=n._getSoundIds(e),a=0;a=0?e=parseInt(s[0],10):t=parseFloat(s[0]):2===s.length&&(t=parseFloat(s[0]),e=parseInt(s[1],10)),"number"!=typeof t)return(i=n._soundById(e))?i._rate:n._rate;if("loaded"!==n._state||n._playLock)return n._queue.push({event:"rate",action:function(){n.rate.apply(n,s)}}),n;void 0===e&&(n._rate=t),e=n._getSoundIds(e);for(var a=0;a=0?e=parseInt(n[0],10):i._sounds.length&&(e=i._sounds[0]._id,t=parseFloat(n[0])):2===n.length&&(t=parseFloat(n[0]),e=parseInt(n[1],10)),void 0===e)return 0;if("number"==typeof t&&("loaded"!==i._state||i._playLock))return i._queue.push({event:"seek",action:function(){i.seek.apply(i,n)}}),i;var s=i._soundById(e);if(s){if(!("number"==typeof t&&t>=0)){if(i._webAudio){var a=i.playing(e)?r.ctx.currentTime-s._playStart:0,o=s._rateSeek?s._rateSeek-s._seek:0;return s._seek+(o+a*Math.abs(s._rate))}return s._node.currentTime}var l=i.playing(e);l&&i.pause(e,!0),s._seek=t,s._ended=!1,i._clearTimer(e),i._webAudio||!s._node||isNaN(s._node.duration)||(s._node.currentTime=t);var c=function(){l&&i.play(e,!0),i._emit("seek",e)};if(l&&!i._webAudio){var d=function(){i._playLock?setTimeout(d,0):c()};setTimeout(d,0)}else c()}return i},playing:function(t){var e=this;if("number"==typeof t){var i=e._soundById(t);return!!i&&!i._paused}for(var n=0;n=0&&r._howls.splice(n,1);var s=!0;for(i=0;i=0){s=!1;break}return l&&s&&delete l[t._src],r.noAudio=!1,t._state="unloaded",t._sounds=[],t=null,null},on:function(t,e,i,n){var s=this["_on"+t];return"function"==typeof e&&s.push(n?{id:i,fn:e,once:n}:{id:i,fn:e}),this},off:function(t,e,i){var n=this,s=n["_on"+t],r=0;if("number"==typeof e&&(i=e,e=null),e||i)for(r=0;r=0;r--)s[r].id&&s[r].id!==e&&"load"!==t||(setTimeout(function(t){t.call(this,e,i)}.bind(n,s[r].fn),0),s[r].once&&n.off(t,s[r].fn,s[r].id));return n._loadQueue(t),n},_loadQueue:function(t){var e=this;if(e._queue.length>0){var i=e._queue[0];i.event===t&&(e._queue.shift(),e._loadQueue()),t||i.action()}return e},_ended:function(t){var e=this,i=t._sprite;if(!e._webAudio&&t._node&&!t._node.paused&&!t._node.ended&&t._node.currentTime=0;n--){if(i<=e)return;t._sounds[n]._ended&&(t._webAudio&&t._sounds[n]._node&&t._sounds[n]._node.disconnect(0),t._sounds.splice(n,1),i--)}}},_getSoundIds:function(t){if(void 0===t){for(var e=[],i=0;i=0;if(!t.bufferSource)return this;if(r._scratchBuffer&&t.bufferSource&&(t.bufferSource.onended=null,t.bufferSource.disconnect(0),e))try{t.bufferSource.buffer=r._scratchBuffer}catch(t){}return t.bufferSource=null,this},_clearSound:function(t){/MSIE |Trident\//.test(r._navigator&&r._navigator.userAgent)||(t.src="data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA")}};var o=function(t){this._parent=t,this.init()};o.prototype={init:function(){var t=this,e=t._parent;return t._muted=e._muted,t._loop=e._loop,t._volume=e._volume,t._rate=e._rate,t._seek=0,t._paused=!0,t._ended=!0,t._sprite="__default",t._id=++r._counter,e._sounds.push(t),t.create(),t},create:function(){var t=this,e=t._parent,i=r._muted||t._muted||t._parent._muted?0:t._volume;return e._webAudio?(t._node=void 0===r.ctx.createGain?r.ctx.createGainNode():r.ctx.createGain(),t._node.gain.setValueAtTime(i,r.ctx.currentTime),t._node.paused=!0,t._node.connect(r.masterGain)):r.noAudio||(t._node=r._obtainHtml5Audio(),t._errorFn=t._errorListener.bind(t),t._node.addEventListener("error",t._errorFn,!1),t._loadFn=t._loadListener.bind(t),t._node.addEventListener(r._canPlayEvent,t._loadFn,!1),t._endFn=t._endListener.bind(t),t._node.addEventListener("ended",t._endFn,!1),t._node.src=e._src,t._node.preload=!0===e._preload?"auto":e._preload,t._node.volume=i*r.volume(),t._node.load()),t},reset:function(){var t=this,e=t._parent;return t._muted=e._muted,t._loop=e._loop,t._volume=e._volume,t._rate=e._rate,t._seek=0,t._rateSeek=0,t._paused=!0,t._ended=!0,t._sprite="__default",t._id=++r._counter,t},_errorListener:function(){var t=this;t._parent._emit("loaderror",t._id,t._node.error?t._node.error.code:0),t._node.removeEventListener("error",t._errorFn,!1)},_loadListener:function(){var t=this,e=t._parent;e._duration=Math.ceil(10*t._node.duration)/10,0===Object.keys(e._sprite).length&&(e._sprite={__default:[0,1e3*e._duration]}),"loaded"!==e._state&&(e._state="loaded",e._emit("load"),e._loadQueue()),t._node.removeEventListener(r._canPlayEvent,t._loadFn,!1)},_endListener:function(){var t=this,e=t._parent;e._duration===1/0&&(e._duration=Math.ceil(10*t._node.duration)/10,e._sprite.__default[1]===1/0&&(e._sprite.__default[1]=1e3*e._duration),e._ended(t)),t._node.removeEventListener("ended",t._endFn,!1)}};var l={},c=function(t){var e=t._src;if(l[e])return t._duration=l[e].duration,void u(t);if(/^data:[^;]+;base64,/.test(e)){for(var i=atob(e.split(",")[1]),n=new Uint8Array(i.length),s=0;s0?(l[e._src]=t,u(e,t)):i()};"undefined"!=typeof Promise&&1===r.ctx.decodeAudioData.length?r.ctx.decodeAudioData(t).then(n).catch(i):r.ctx.decodeAudioData(t,n,i)},u=function(t,e){e&&!t._duration&&(t._duration=e.duration),0===Object.keys(t._sprite).length&&(t._sprite={__default:[0,1e3*t._duration]}),"loaded"!==t._state&&(t._state="loaded",t._emit("load"),t._loadQueue())},p=function(){if(r.usingWebAudio){try{"undefined"!=typeof AudioContext?r.ctx=new AudioContext:"undefined"!=typeof webkitAudioContext?r.ctx=new webkitAudioContext:r.usingWebAudio=!1}catch(t){r.usingWebAudio=!1}r.ctx||(r.usingWebAudio=!1);var t=/iP(hone|od|ad)/.test(r._navigator&&r._navigator.platform),e=r._navigator&&r._navigator.appVersion.match(/OS (\d+)_(\d+)_?(\d+)?/),i=e?parseInt(e[1],10):null;if(t&&i&&i<9){var n=/safari/.test(r._navigator&&r._navigator.userAgent.toLowerCase());r._navigator&&!n&&(r.usingWebAudio=!1)}r.usingWebAudio&&(r.masterGain=void 0===r.ctx.createGain?r.ctx.createGainNode():r.ctx.createGain(),r.masterGain.gain.setValueAtTime(r._muted?0:r._volume,r.ctx.currentTime),r.masterGain.connect(r.ctx.destination)),r._setup()}};void 0===(n=function(){return{Howler:r,Howl:a}}.apply(e,[]))||(t.exports=n),e.Howler=r,e.Howl=a,void 0!==i.g?(i.g.HowlerGlobal=s,i.g.Howler=r,i.g.Howl=a,i.g.Sound=o):"undefined"!=typeof window&&(window.HowlerGlobal=s,window.Howler=r,window.Howl=a,window.Sound=o)}(),function(){var t;HowlerGlobal.prototype._pos=[0,0,0],HowlerGlobal.prototype._orientation=[0,0,-1,0,1,0],HowlerGlobal.prototype.stereo=function(t){var e=this;if(!e.ctx||!e.ctx.listener)return e;for(var i=e._howls.length-1;i>=0;i--)e._howls[i].stereo(t);return e},HowlerGlobal.prototype.pos=function(t,e,i){var n=this;return n.ctx&&n.ctx.listener?(e="number"!=typeof e?n._pos[1]:e,i="number"!=typeof i?n._pos[2]:i,"number"!=typeof t?n._pos:(n._pos=[t,e,i],void 0!==n.ctx.listener.positionX?(n.ctx.listener.positionX.setTargetAtTime(n._pos[0],Howler.ctx.currentTime,.1),n.ctx.listener.positionY.setTargetAtTime(n._pos[1],Howler.ctx.currentTime,.1),n.ctx.listener.positionZ.setTargetAtTime(n._pos[2],Howler.ctx.currentTime,.1)):n.ctx.listener.setPosition(n._pos[0],n._pos[1],n._pos[2]),n)):n},HowlerGlobal.prototype.orientation=function(t,e,i,n,s,r){var a=this;if(!a.ctx||!a.ctx.listener)return a;var o=a._orientation;return e="number"!=typeof e?o[1]:e,i="number"!=typeof i?o[2]:i,n="number"!=typeof n?o[3]:n,s="number"!=typeof s?o[4]:s,r="number"!=typeof r?o[5]:r,"number"!=typeof t?o:(a._orientation=[t,e,i,n,s,r],void 0!==a.ctx.listener.forwardX?(a.ctx.listener.forwardX.setTargetAtTime(t,Howler.ctx.currentTime,.1),a.ctx.listener.forwardY.setTargetAtTime(e,Howler.ctx.currentTime,.1),a.ctx.listener.forwardZ.setTargetAtTime(i,Howler.ctx.currentTime,.1),a.ctx.listener.upX.setTargetAtTime(n,Howler.ctx.currentTime,.1),a.ctx.listener.upY.setTargetAtTime(s,Howler.ctx.currentTime,.1),a.ctx.listener.upZ.setTargetAtTime(r,Howler.ctx.currentTime,.1)):a.ctx.listener.setOrientation(t,e,i,n,s,r),a)},Howl.prototype.init=(t=Howl.prototype.init,function(e){var i=this;return i._orientation=e.orientation||[1,0,0],i._stereo=e.stereo||null,i._pos=e.pos||null,i._pannerAttr={coneInnerAngle:void 0!==e.coneInnerAngle?e.coneInnerAngle:360,coneOuterAngle:void 0!==e.coneOuterAngle?e.coneOuterAngle:360,coneOuterGain:void 0!==e.coneOuterGain?e.coneOuterGain:0,distanceModel:void 0!==e.distanceModel?e.distanceModel:"inverse",maxDistance:void 0!==e.maxDistance?e.maxDistance:1e4,panningModel:void 0!==e.panningModel?e.panningModel:"HRTF",refDistance:void 0!==e.refDistance?e.refDistance:1,rolloffFactor:void 0!==e.rolloffFactor?e.rolloffFactor:1},i._onstereo=e.onstereo?[{fn:e.onstereo}]:[],i._onpos=e.onpos?[{fn:e.onpos}]:[],i._onorientation=e.onorientation?[{fn:e.onorientation}]:[],t.call(this,e)}),Howl.prototype.stereo=function(t,i){var n=this;if(!n._webAudio)return n;if("loaded"!==n._state)return n._queue.push({event:"stereo",action:function(){n.stereo(t,i)}}),n;var s=void 0===Howler.ctx.createStereoPanner?"spatial":"stereo";if(void 0===i){if("number"!=typeof t)return n._stereo;n._stereo=t,n._pos=[t,0,0]}for(var r=n._getSoundIds(i),a=0;a{var n;!function(s,r){if(s){for(var a,o={8:"backspace",9:"tab",13:"enter",16:"shift",17:"ctrl",18:"alt",20:"capslock",27:"esc",32:"space",33:"pageup",34:"pagedown",35:"end",36:"home",37:"left",38:"up",39:"right",40:"down",45:"ins",46:"del",91:"meta",93:"meta",224:"meta"},l={106:"*",107:"+",109:"-",110:".",111:"/",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},c={"~":"`","!":"1","@":"2","#":"3",$:"4","%":"5","^":"6","&":"7","*":"8","(":"9",")":"0",_:"-","+":"=",":":";",'"':"'","<":",",">":".","?":"/","|":"\\"},d={option:"alt",command:"meta",return:"enter",escape:"esc",plus:"+",mod:/Mac|iPod|iPhone|iPad/.test(navigator.platform)?"meta":"ctrl"},h=1;h<20;++h)o[111+h]="f"+h;for(h=0;h<=9;++h)o[h+96]=h.toString();b.prototype.bind=function(t,e,i){var n=this;return t=t instanceof Array?t:[t],n._bindMultiple.call(n,t,e,i),n},b.prototype.unbind=function(t,e){return this.bind.call(this,t,(function(){}),e)},b.prototype.trigger=function(t,e){var i=this;return i._directMap[t+":"+e]&&i._directMap[t+":"+e]({},t),i},b.prototype.reset=function(){var t=this;return t._callbacks={},t._directMap={},t},b.prototype.stopCallback=function(t,e){if((" "+e.className+" ").indexOf(" mousetrap ")>-1)return!1;if(v(e,this.target))return!1;if("composedPath"in t&&"function"==typeof t.composedPath){var i=t.composedPath()[0];i!==t.target&&(e=i)}return"INPUT"==e.tagName||"SELECT"==e.tagName||"TEXTAREA"==e.tagName||e.isContentEditable},b.prototype.handleKey=function(){return this._handleKey.apply(this,arguments)},b.addKeycodes=function(t){for(var e in t)t.hasOwnProperty(e)&&(o[e]=t[e]);a=null},b.init=function(){var t=b(r);for(var e in t)"_"!==e.charAt(0)&&(b[e]=function(e){return function(){return t[e].apply(t,arguments)}}(e))},b.init(),s.Mousetrap=b,t.exports&&(t.exports=b),void 0===(n=function(){return b}.call(e,i,e,t))||(t.exports=n)}function u(t,e,i){t.addEventListener?t.addEventListener(e,i,!1):t.attachEvent("on"+e,i)}function p(t){if("keypress"==t.type){var e=String.fromCharCode(t.which);return t.shiftKey||(e=e.toLowerCase()),e}return o[t.which]?o[t.which]:l[t.which]?l[t.which]:String.fromCharCode(t.which).toLowerCase()}function f(t){return"shift"==t||"ctrl"==t||"alt"==t||"meta"==t}function g(t,e,i){return i||(i=function(){if(!a)for(var t in a={},o)t>95&&t<112||o.hasOwnProperty(t)&&(a[o[t]]=t);return a}()[t]?"keydown":"keypress"),"keypress"==i&&e.length&&(i="keydown"),i}function m(t,e){var i,n,s,r=[];for(i=function(t){return"+"===t?["+"]:(t=t.replace(/\+{2}/g,"+plus")).split("+")}(t),s=0;s1?function(t,e,r,a){function c(e){return function(){o=e,++n[t],clearTimeout(i),i=setTimeout(l,1e3)}}function h(e){d(r,e,t),"keyup"!==a&&(s=p(e)),setTimeout(l,10)}n[t]=0;for(var u=0;u0,r.tv=s.includes("TV"),l=navigator.getGamepads?Array.from(navigator.getGamepads()).filter((function(t){return null!=t})).length:0,r.gamepad=l>0,t("(orientation: portrait)",(function(t){r.portrait=t,r.landscape=!t,r.orientation=t?"portrait":"landscape",o("portrait",r.portrait),o("landscape",r.landscape),o("orientation",r.orientation)})),t("(any-pointer: coarse)",(function(t){e("touch",t),e("formfactor",d())&&c()})),t("(hover: hover)",(function(t){e("mouse",t),e("input",t?"mouse":"touch"),e("formfactor",d())&&c()}))}}return r.csp=r.uwp||!1,r.nwjs?r.dev="sdk"===process.versions["nw-flavor"]:r.electron?r.dev=process.execPath.replace(/\\/g,"/").includes("node_modules/electron/"):r.uwp?r.dev=Windows.ApplicationModel.Package.current.isDevelopmentMode:r.node?r.dev=!1:r.dev=void 0,r}()},7391:(t,e,i)=>{var n=i(7180),s=i(3181),r=i(3031),a=i(9067),o=i(6833),l=i(3717),c=i(4801);c.alea=n,c.xor128=s,c.xorwow=r,c.xorshift7=a,c.xor4096=o,c.tychei=l,t.exports=c},7180:function(t,e,i){var n;!function(t,s){function r(t){var e,i=this,n=(e=4022871197,function(t){t=String(t);for(var i=0;i>>0,e=(n*=e)>>>0,e+=4294967296*(n-=e)}return 2.3283064365386963e-10*(e>>>0)});i.next=function(){var t=2091639*i.s0+2.3283064365386963e-10*i.c;return i.s0=i.s1,i.s1=i.s2,i.s2=t-(i.c=0|t)},i.c=1,i.s0=n(" "),i.s1=n(" "),i.s2=n(" "),i.s0-=n(t),i.s0<0&&(i.s0+=1),i.s1-=n(t),i.s1<0&&(i.s1+=1),i.s2-=n(t),i.s2<0&&(i.s2+=1),n=null}function a(t,e){return e.c=t.c,e.s0=t.s0,e.s1=t.s1,e.s2=t.s2,e}function o(t,e){var i=new r(t),n=e&&e.state,s=i.next;return s.int32=function(){return 4294967296*i.next()|0},s.double=function(){return s()+11102230246251565e-32*(2097152*s()|0)},s.quick=s,n&&("object"==typeof n&&a(n,i),s.state=function(){return a(i,{})}),s}s&&s.exports?s.exports=o:i.amdD&&i.amdO?void 0===(n=function(){return o}.call(e,i,e,s))||(s.exports=n):this.alea=o}(0,t=i.nmd(t),i.amdD)},3717:function(t,e,i){var n;!function(t,s){function r(t){var e=this,i="";e.next=function(){var t=e.b,i=e.c,n=e.d,s=e.a;return t=t<<25^t>>>7^i,i=i-n|0,n=n<<24^n>>>8^s,s=s-t|0,e.b=t=t<<20^t>>>12^i,e.c=i=i-n|0,e.d=n<<16^i>>>16^s,e.a=s-t|0},e.a=0,e.b=0,e.c=-1640531527,e.d=1367130551,t===Math.floor(t)?(e.a=t/4294967296|0,e.b=0|t):i+=t;for(var n=0;n>>0)/4294967296};return s.double=function(){do{var t=((i.next()>>>11)+(i.next()>>>0)/4294967296)/(1<<21)}while(0===t);return t},s.int32=i.next,s.quick=s,n&&("object"==typeof n&&a(n,i),s.state=function(){return a(i,{})}),s}s&&s.exports?s.exports=o:i.amdD&&i.amdO?void 0===(n=function(){return o}.call(e,i,e,s))||(s.exports=n):this.tychei=o}(0,t=i.nmd(t),i.amdD)},3181:function(t,e,i){var n;!function(t,s){function r(t){var e=this,i="";e.x=0,e.y=0,e.z=0,e.w=0,e.next=function(){var t=e.x^e.x<<11;return e.x=e.y,e.y=e.z,e.z=e.w,e.w^=e.w>>>19^t^t>>>8},t===(0|t)?e.x=t:i+=t;for(var n=0;n>>0)/4294967296};return s.double=function(){do{var t=((i.next()>>>11)+(i.next()>>>0)/4294967296)/(1<<21)}while(0===t);return t},s.int32=i.next,s.quick=s,n&&("object"==typeof n&&a(n,i),s.state=function(){return a(i,{})}),s}s&&s.exports?s.exports=o:i.amdD&&i.amdO?void 0===(n=function(){return o}.call(e,i,e,s))||(s.exports=n):this.xor128=o}(0,t=i.nmd(t),i.amdD)},6833:function(t,e,i){var n;!function(t,s){function r(t){var e=this;e.next=function(){var t,i,n=e.w,s=e.X,r=e.i;return e.w=n=n+1640531527|0,i=s[r+34&127],t=s[r=r+1&127],i^=i<<13,t^=t<<17,i^=i>>>15,t^=t>>>12,i=s[r]=i^t,e.i=r,i+(n^n>>>16)|0},function(t,e){var i,n,s,r,a,o=[],l=128;for(e===(0|e)?(n=e,e=null):(e+="\0",n=0,l=Math.max(l,e.length)),s=0,r=-32;r>>15,n^=n<<4,n^=n>>>13,r>=0&&(a=a+1640531527|0,s=0==(i=o[127&r]^=n+a)?s+1:0);for(s>=128&&(o[127&(e&&e.length||0)]=-1),s=127,r=512;r>0;--r)n=o[s+34&127],i=o[s=s+1&127],n^=n<<13,i^=i<<17,n^=n>>>15,i^=i>>>12,o[s]=n^i;t.w=a,t.X=o,t.i=s}(e,t)}function a(t,e){return e.i=t.i,e.w=t.w,e.X=t.X.slice(),e}function o(t,e){null==t&&(t=+new Date);var i=new r(t),n=e&&e.state,s=function(){return(i.next()>>>0)/4294967296};return s.double=function(){do{var t=((i.next()>>>11)+(i.next()>>>0)/4294967296)/(1<<21)}while(0===t);return t},s.int32=i.next,s.quick=s,n&&(n.X&&a(n,i),s.state=function(){return a(i,{})}),s}s&&s.exports?s.exports=o:i.amdD&&i.amdO?void 0===(n=function(){return o}.call(e,i,e,s))||(s.exports=n):this.xor4096=o}(0,t=i.nmd(t),i.amdD)},9067:function(t,e,i){var n;!function(t,s){function r(t){var e=this;e.next=function(){var t,i,n=e.x,s=e.i;return t=n[s],i=(t^=t>>>7)^t<<24,i^=(t=n[s+1&7])^t>>>10,i^=(t=n[s+3&7])^t>>>3,i^=(t=n[s+4&7])^t<<7,t=n[s+7&7],i^=(t^=t<<13)^t<<9,n[s]=i,e.i=s+1&7,i},function(t,e){var i,n=[];if(e===(0|e))n[0]=e;else for(e=""+e,i=0;i0;--i)t.next()}(e,t)}function a(t,e){return e.x=t.x.slice(),e.i=t.i,e}function o(t,e){null==t&&(t=+new Date);var i=new r(t),n=e&&e.state,s=function(){return(i.next()>>>0)/4294967296};return s.double=function(){do{var t=((i.next()>>>11)+(i.next()>>>0)/4294967296)/(1<<21)}while(0===t);return t},s.int32=i.next,s.quick=s,n&&(n.x&&a(n,i),s.state=function(){return a(i,{})}),s}s&&s.exports?s.exports=o:i.amdD&&i.amdO?void 0===(n=function(){return o}.call(e,i,e,s))||(s.exports=n):this.xorshift7=o}(0,t=i.nmd(t),i.amdD)},3031:function(t,e,i){var n;!function(t,s){function r(t){var e=this,i="";e.next=function(){var t=e.x^e.x>>>2;return e.x=e.y,e.y=e.z,e.z=e.w,e.w=e.v,(e.d=e.d+362437|0)+(e.v=e.v^e.v<<4^t^t<<1)|0},e.x=0,e.y=0,e.z=0,e.w=0,e.v=0,t===(0|t)?e.x=t:i+=t;for(var n=0;n>>4),e.next()}function a(t,e){return e.x=t.x,e.y=t.y,e.z=t.z,e.w=t.w,e.v=t.v,e.d=t.d,e}function o(t,e){var i=new r(t),n=e&&e.state,s=function(){return(i.next()>>>0)/4294967296};return s.double=function(){do{var t=((i.next()>>>11)+(i.next()>>>0)/4294967296)/(1<<21)}while(0===t);return t},s.int32=i.next,s.quick=s,n&&("object"==typeof n&&a(n,i),s.state=function(){return a(i,{})}),s}s&&s.exports?s.exports=o:i.amdD&&i.amdO?void 0===(n=function(){return o}.call(e,i,e,s))||(s.exports=n):this.xorwow=o}(0,t=i.nmd(t),i.amdD)},4801:function(t,e,i){var n;!function(s,r,a){var o,l=256,c=a.pow(l,6),d=a.pow(2,52),h=2*d,u=l-1;function p(t,e,i){var n=[],u=v(m((e=1==e?{entropy:!0}:e||{}).entropy?[t,b(r)]:null==t?function(){try{var t;return o&&(t=o.randomBytes)?t=t(l):(t=new Uint8Array(l),(s.crypto||s.msCrypto).getRandomValues(t)),b(t)}catch(t){var e=s.navigator,i=e&&e.plugins;return[+new Date,s,i,s.screen,b(r)]}}():t,3),n),p=new f(n),y=function(){for(var t=p.g(6),e=c,i=0;t=h;)t/=2,e/=2,i>>>=1;return(t+i)/e};return y.int32=function(){return 0|p.g(4)},y.quick=function(){return p.g(4)/4294967296},y.double=y,v(b(p.S),r),(e.pass||i||function(t,e,i,n){return n&&(n.S&&g(n,p),t.state=function(){return g(p,{})}),i?(a.random=t,e):t})(y,u,"global"in e?e.global:this==a,e.state)}function f(t){var e,i=t.length,n=this,s=0,r=n.i=n.j=0,a=n.S=[];for(i||(t=[i++]);s{}},e={};function i(n){var s=e[n];if(void 0!==s)return s.exports;var r=e[n]={id:n,loaded:!1,exports:{}};return t[n].call(r.exports,r,r.exports,i),r.loaded=!0,r.exports}i.m=t,i.amdD=function(){throw new Error("define cannot be used indirect")},i.amdO={},i.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return i.d(e,{a:e}),e},i.d=(t,e)=>{for(var n in e)i.o(e,n)&&!i.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},i.u=t=>t+".js",i.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),i.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),i.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.nmd=t=>(t.paths=[],t.children||(t.children=[]),t),(()=>{var t;if("string"==typeof import.meta.url&&(t=import.meta.url),!t)throw new Error("Automatic publicPath is not supported in this browser");t=t.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),i.p=t+"../"})(),i.b=document.baseURI||self.location.href;var n={};i.d(n,{LT:()=>xa});var s={};i.r(s),i.d(s,{run:()=>A});var r={};i.r(r),i.d(r,{run:()=>x});var a={};i.r(a),i.d(a,{run:()=>R});var o={};i.r(o),i.d(o,{run:()=>O});var l={};i.r(l),i.d(l,{run:()=>at});var c={};i.r(c),i.d(c,{run:()=>ce});var d={};i.r(d),i.d(d,{run:()=>fe});var h={};i.r(h),i.d(h,{run:()=>ve,setupButtons:()=>be,toggle:()=>ye});var u={};i.r(u),i.d(u,{run:()=>Ee});var p={};i.r(p),i.d(p,{run:()=>Re});var f={};i.r(f),i.d(f,{halt:()=>ze,run:()=>He});var g={};i.r(g),i.d(g,{run:()=>ea});var m={};i.r(m),i.d(m,{run:()=>ra});var v={};i.r(v),i.d(v,{run:()=>ca,toggle:()=>da});var b={};i.r(b),i.d(b,{launchPlayer:()=>fa,run:()=>pa});var y=i(8097),_=i(4113),w=i(173);function A(){_.appInstance().on("item:load",(function(){for(var t=w.totalItems(),e=Array.from(document.getElementsByClassName("item-prev")),i=Array.from(document.getElementsByClassName("item-next")),n=e.concat(i),s=0;s=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:s}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var r,a=!0,o=!1;return{s:function(){i=i.call(t)},n:function(){var t=i.next();return a=t.done,t},e:function(t){o=!0,r=t},f:function(){try{a||null==i.return||i.return()}finally{if(o)throw r}}}}function I(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=Array(e);iBefore moving on, attempt all questions and click the "Check Answer" button.

\n

Note: the "Check Answer" button may not appear on every question.

'}};function R(t){var e,i;t&&null!=t&&t.message&&(null!==(e=P.message)&&void 0!==e&&e.header.length&&(P.message.header=t.message.header),null!==(i=P.message)&&void 0!==i&&i.body.length&&(P.message.body=t.message.body)),_.appInstance().on("item:beforeunload",(function(t){!function(t){(function(){var t,e=!1,i=M(T.questions());try{for(i.s();!(t=i.n()).done;){var n=t.value.response_id;if(T.hasCheckAnswer(n)){e=!0;break}}}catch(t){i.e(t)}finally{i.f()}return e})()&&(function(){var t,e=M(T.questions());try{for(e.s();!(t=e.n()).done;){var i=t.value.response_id;if(T.hasCheckAnswer(i)&&(!T.questionResponse(i)||!T.questionResponse(i).hasOwnProperty("feedbackAttemptsCount")))return!1}}catch(t){e.e(t)}finally{e.f()}return!0}()||(C.A.debug("Disabling navigation.",L),t.preventDefault(),(0,k.dialog)({header:P.message.header,body:P.message.body,buttons:[{button_id:"lt__check_answer_validation",label:"Close",is_primary:!1}]}),_.assessApp().on("button:lt__check_answer_validation:clicked",(function(){(0,k.hideDialog)()}))))}(t)}))}var D=i(7518),F={renderedCss:!1,resize:{triggered:!1}};function O(){var t;F.renderedCss||((t=document.createElement("style")).textContent="\n/* Learnosity column resizer styles */\n.lrn-resizer {\n background-color: #e8e8e8;\n cursor: grab;\n width: 3px;\n padding: 0;\n position: relative;\n}\n.lrn-resizer span {\n position: relative;\n width: 45px;\n height: 30px;\n border: 1px solid #e4e4e4;\n left: -22px;\n border-radius: 3px;\n cursor: grab;\n display: flex;\n align-items: center;\n justify-content: center;\n font-size: 1.5em;\n z-index: 2;\n padding-bottom: 3px;\n color: #444;\n\n -webkit-user-select: none;\n user-select: none;\n\n background: rgb(233,233,233);\n background: linear-gradient(0deg, rgba(233,233,233,1) 0%, rgba(250,250,250,1) 51%, rgba(238,238,238,1) 100%);\n}\n.row {\n display: flex;\n}\n.col-xs-6.lrn-column-left {\n display: flex;\n min-width: 5em;\n overflow: hidden;\n}\n.col-xs-6.lrn-column-right {\n display: flex;\n\n flex: 1;\n display: flex;\n flex-direction: column;\n min-width: 5em;\n overflow: hidden;\n}\n.lrn-column-left .lrn_widget,\n.lrn-column-right .lrn_widget {\n padding: 1.5em;\n}\n@media (max-width: 650px) {\n .lrn-resizer {\n display: none;\n }\n}\n",document.head.append(t),F.renderedCss=!0),_.appInstance().on("item:load",(function(){N()})),window.addEventListener("resize",function(t){var e,i=this;return F.resize.triggered||(F.resize.triggered=!0,t.apply(this)),function(){for(var n=arguments.length,s=new Array(n),r=0;r=10&&a<=90&&(e.style.width=a+"%")},a=function(){document.removeEventListener("mousemove",r),document.removeEventListener("mouseup",a),document.removeEventListener("touchmove",r),document.removeEventListener("touchend",a)};t.addEventListener("mousedown",s),t.addEventListener("touchstart",s)}(e)}(t)}}const B=new Uint16Array('ᵁ<Õıʊҝջאٵ۞ޢߖࠏ੊ઑඡ๭༉༦჊ረዡᐕᒝᓃᓟᔥ\0\0\0\0\0\0ᕫᛍᦍᰒᷝ὾⁠↰⊍⏀⏻⑂⠤⤒ⴈ⹈⿎〖㊺㘹㞬㣾㨨㩱㫠㬮ࠀEMabcfglmnoprstu\\bfms„‹•˜¦³¹ÈÏlig耻Æ䃆P耻&䀦cute耻Á䃁reve;䄂Āiyx}rc耻Â䃂;䐐r;쀀𝔄rave耻À䃀pha;䎑acr;䄀d;橓Āgp¡on;䄄f;쀀𝔸plyFunction;恡ing耻Å䃅Ācs¾Ãr;쀀𝒜ign;扔ilde耻Ã䃃ml耻Ä䃄ЀaceforsuåûþėĜĢħĪĀcrêòkslash;或Ŷöø;櫧ed;挆y;䐑ƀcrtąċĔause;戵noullis;愬a;䎒r;쀀𝔅pf;쀀𝔹eve;䋘còēmpeq;扎܀HOacdefhilorsuōőŖƀƞƢƵƷƺǜȕɳɸɾcy;䐧PY耻©䂩ƀcpyŝŢźute;䄆Ā;iŧŨ拒talDifferentialD;慅leys;愭ȀaeioƉƎƔƘron;䄌dil耻Ç䃇rc;䄈nint;戰ot;䄊ĀdnƧƭilla;䂸terDot;䂷òſi;䎧rcleȀDMPTLJNjǑǖot;抙inus;抖lus;投imes;抗oĀcsǢǸkwiseContourIntegral;戲eCurlyĀDQȃȏoubleQuote;思uote;怙ȀlnpuȞȨɇɕonĀ;eȥȦ户;橴ƀgitȯȶȺruent;扡nt;戯ourIntegral;戮ĀfrɌɎ;愂oduct;成nterClockwiseContourIntegral;戳oss;樯cr;쀀𝒞pĀ;Cʄʅ拓ap;才րDJSZacefiosʠʬʰʴʸˋ˗ˡ˦̳ҍĀ;oŹʥtrahd;椑cy;䐂cy;䐅cy;䐏ƀgrsʿ˄ˇger;怡r;憡hv;櫤Āayː˕ron;䄎;䐔lĀ;t˝˞戇a;䎔r;쀀𝔇Āaf˫̧Ācm˰̢riticalȀADGT̖̜̀̆cute;䂴oŴ̋̍;䋙bleAcute;䋝rave;䁠ilde;䋜ond;拄ferentialD;慆Ѱ̽\0\0\0͔͂\0Ѕf;쀀𝔻ƀ;DE͈͉͍䂨ot;惜qual;扐blèCDLRUVͣͲ΂ϏϢϸontourIntegraìȹoɴ͹\0\0ͻ»͉nArrow;懓Āeo·ΤftƀARTΐΖΡrrow;懐ightArrow;懔eåˊngĀLRΫτeftĀARγιrrow;柸ightArrow;柺ightArrow;柹ightĀATϘϞrrow;懒ee;抨pɁϩ\0\0ϯrrow;懑ownArrow;懕erticalBar;戥ǹABLRTaВЪаўѿͼrrowƀ;BUНОТ憓ar;椓pArrow;懵reve;䌑eft˒к\0ц\0ѐightVector;楐eeVector;楞ectorĀ;Bљњ憽ar;楖ightǔѧ\0ѱeeVector;楟ectorĀ;BѺѻ懁ar;楗eeĀ;A҆҇护rrow;憧ĀctҒҗr;쀀𝒟rok;䄐ࠀNTacdfglmopqstuxҽӀӄӋӞӢӧӮӵԡԯԶՒ՝ՠեG;䅊H耻Ð䃐cute耻É䃉ƀaiyӒӗӜron;䄚rc耻Ê䃊;䐭ot;䄖r;쀀𝔈rave耻È䃈ement;戈ĀapӺӾcr;䄒tyɓԆ\0\0ԒmallSquare;旻erySmallSquare;斫ĀgpԦԪon;䄘f;쀀𝔼silon;䎕uĀaiԼՉlĀ;TՂՃ橵ilde;扂librium;懌Āci՗՚r;愰m;橳a;䎗ml耻Ë䃋Āipժկsts;戃onentialE;慇ʀcfiosօֈ֍ֲ׌y;䐤r;쀀𝔉lledɓ֗\0\0֣mallSquare;旼erySmallSquare;斪Ͱֺ\0ֿ\0\0ׄf;쀀𝔽All;戀riertrf;愱cò׋؀JTabcdfgorstר׬ׯ׺؀ؒؖ؛؝أ٬ٲcy;䐃耻>䀾mmaĀ;d׷׸䎓;䏜reve;䄞ƀeiy؇،ؐdil;䄢rc;䄜;䐓ot;䄠r;쀀𝔊;拙pf;쀀𝔾eater̀EFGLSTصلَٖٛ٦qualĀ;Lؾؿ扥ess;招ullEqual;执reater;檢ess;扷lantEqual;橾ilde;扳cr;쀀𝒢;扫ЀAacfiosuڅڋږڛڞڪھۊRDcy;䐪Āctڐڔek;䋇;䁞irc;䄤r;愌lbertSpace;愋ǰگ\0ڲf;愍izontalLine;攀Āctۃۅòکrok;䄦mpńېۘownHumðįqual;扏܀EJOacdfgmnostuۺ۾܃܇܎ܚܞܡܨ݄ݸދޏޕcy;䐕lig;䄲cy;䐁cute耻Í䃍Āiyܓܘrc耻Î䃎;䐘ot;䄰r;愑rave耻Ì䃌ƀ;apܠܯܿĀcgܴܷr;䄪inaryI;慈lieóϝǴ݉\0ݢĀ;eݍݎ戬Āgrݓݘral;戫section;拂isibleĀCTݬݲomma;恣imes;恢ƀgptݿރވon;䄮f;쀀𝕀a;䎙cr;愐ilde;䄨ǫޚ\0ޞcy;䐆l耻Ï䃏ʀcfosuެ޷޼߂ߐĀiyޱ޵rc;䄴;䐙r;쀀𝔍pf;쀀𝕁ǣ߇\0ߌr;쀀𝒥rcy;䐈kcy;䐄΀HJacfosߤߨ߽߬߱ࠂࠈcy;䐥cy;䐌ppa;䎚Āey߶߻dil;䄶;䐚r;쀀𝔎pf;쀀𝕂cr;쀀𝒦րJTaceflmostࠥࠩࠬࡐࡣ঳সে্਷ੇcy;䐉耻<䀼ʀcmnpr࠷࠼ࡁࡄࡍute;䄹bda;䎛g;柪lacetrf;愒r;憞ƀaeyࡗ࡜ࡡron;䄽dil;䄻;䐛Āfsࡨ॰tԀACDFRTUVarࡾࢩࢱࣦ࣠ࣼयज़ΐ४Ānrࢃ࢏gleBracket;柨rowƀ;BR࢙࢚࢞憐ar;懤ightArrow;懆eiling;挈oǵࢷ\0ࣃbleBracket;柦nǔࣈ\0࣒eeVector;楡ectorĀ;Bࣛࣜ懃ar;楙loor;挊ightĀAV࣯ࣵrrow;憔ector;楎Āerँगeƀ;AVउऊऐ抣rrow;憤ector;楚iangleƀ;BEतथऩ抲ar;槏qual;抴pƀDTVषूौownVector;楑eeVector;楠ectorĀ;Bॖॗ憿ar;楘ectorĀ;B॥०憼ar;楒ightáΜs̀EFGLSTॾঋকঝঢভqualGreater;拚ullEqual;扦reater;扶ess;檡lantEqual;橽ilde;扲r;쀀𝔏Ā;eঽা拘ftarrow;懚idot;䄿ƀnpw৔ਖਛgȀLRlr৞৷ਂਐeftĀAR০৬rrow;柵ightArrow;柷ightArrow;柶eftĀarγਊightáοightáϊf;쀀𝕃erĀLRਢਬeftArrow;憙ightArrow;憘ƀchtਾੀੂòࡌ;憰rok;䅁;扪Ѐacefiosuਗ਼੝੠੷੼અઋ઎p;椅y;䐜Ādl੥੯iumSpace;恟lintrf;愳r;쀀𝔐nusPlus;戓pf;쀀𝕄cò੶;䎜ҀJacefostuણધભીଔଙඑ඗ඞcy;䐊cute;䅃ƀaey઴હાron;䅇dil;䅅;䐝ƀgswે૰଎ativeƀMTV૓૟૨ediumSpace;怋hiĀcn૦૘ë૙eryThiî૙tedĀGL૸ଆreaterGreateòٳessLesóੈLine;䀊r;쀀𝔑ȀBnptଢନଷ଺reak;恠BreakingSpace;䂠f;愕ڀ;CDEGHLNPRSTV୕ୖ୪୼஡௫ఄ౞಄ದ೘ൡඅ櫬Āou୛୤ngruent;扢pCap;扭oubleVerticalBar;戦ƀlqxஃஊ஛ement;戉ualĀ;Tஒஓ扠ilde;쀀≂̸ists;戄reater΀;EFGLSTஶஷ஽௉௓௘௥扯qual;扱ullEqual;쀀≧̸reater;쀀≫̸ess;批lantEqual;쀀⩾̸ilde;扵umpń௲௽ownHump;쀀≎̸qual;쀀≏̸eĀfsఊధtTriangleƀ;BEచఛడ拪ar;쀀⧏̸qual;括s̀;EGLSTవశ఼ౄోౘ扮qual;扰reater;扸ess;쀀≪̸lantEqual;쀀⩽̸ilde;扴estedĀGL౨౹reaterGreater;쀀⪢̸essLess;쀀⪡̸recedesƀ;ESಒಓಛ技qual;쀀⪯̸lantEqual;拠ĀeiಫಹverseElement;戌ghtTriangleƀ;BEೋೌ೒拫ar;쀀⧐̸qual;拭ĀquೝഌuareSuĀbp೨೹setĀ;E೰ೳ쀀⊏̸qual;拢ersetĀ;Eഃആ쀀⊐̸qual;拣ƀbcpഓതൎsetĀ;Eഛഞ쀀⊂⃒qual;抈ceedsȀ;ESTലള഻െ抁qual;쀀⪰̸lantEqual;拡ilde;쀀≿̸ersetĀ;E൘൛쀀⊃⃒qual;抉ildeȀ;EFT൮൯൵ൿ扁qual;扄ullEqual;扇ilde;扉erticalBar;戤cr;쀀𝒩ilde耻Ñ䃑;䎝܀Eacdfgmoprstuvලෂ෉෕ෛ෠෧෼ขภยา฿ไlig;䅒cute耻Ó䃓Āiy෎ීrc耻Ô䃔;䐞blac;䅐r;쀀𝔒rave耻Ò䃒ƀaei෮ෲ෶cr;䅌ga;䎩cron;䎟pf;쀀𝕆enCurlyĀDQฎบoubleQuote;怜uote;怘;橔Āclวฬr;쀀𝒪ash耻Ø䃘iŬื฼de耻Õ䃕es;樷ml耻Ö䃖erĀBP๋๠Āar๐๓r;怾acĀek๚๜;揞et;掴arenthesis;揜Ҁacfhilors๿ງຊຏຒດຝະ໼rtialD;戂y;䐟r;쀀𝔓i;䎦;䎠usMinus;䂱Āipຢອncareplanåڝf;愙Ȁ;eio຺ູ໠໤檻cedesȀ;EST່້໏໚扺qual;檯lantEqual;扼ilde;找me;怳Ādp໩໮uct;戏ortionĀ;aȥ໹l;戝Āci༁༆r;쀀𝒫;䎨ȀUfos༑༖༛༟OT耻"䀢r;쀀𝔔pf;愚cr;쀀𝒬؀BEacefhiorsu༾གྷཇའཱིྦྷྪྭ႖ႩႴႾarr;椐G耻®䂮ƀcnrཎནབute;䅔g;柫rĀ;tཛྷཝ憠l;椖ƀaeyཧཬཱron;䅘dil;䅖;䐠Ā;vླྀཹ愜erseĀEUྂྙĀlq྇ྎement;戋uilibrium;懋pEquilibrium;楯r»ཹo;䎡ghtЀACDFTUVa࿁࿫࿳ဢဨၛႇϘĀnr࿆࿒gleBracket;柩rowƀ;BL࿜࿝࿡憒ar;懥eftArrow;懄eiling;按oǵ࿹\0စbleBracket;柧nǔည\0နeeVector;楝ectorĀ;Bဝသ懂ar;楕loor;挋Āerိ၃eƀ;AVဵံြ抢rrow;憦ector;楛iangleƀ;BEၐၑၕ抳ar;槐qual;抵pƀDTVၣၮၸownVector;楏eeVector;楜ectorĀ;Bႂႃ憾ar;楔ectorĀ;B႑႒懀ar;楓Āpuႛ႞f;愝ndImplies;楰ightarrow;懛ĀchႹႼr;愛;憱leDelayed;槴ڀHOacfhimoqstuფჱჷჽᄙᄞᅑᅖᅡᅧᆵᆻᆿĀCcჩხHcy;䐩y;䐨FTcy;䐬cute;䅚ʀ;aeiyᄈᄉᄎᄓᄗ檼ron;䅠dil;䅞rc;䅜;䐡r;쀀𝔖ortȀDLRUᄪᄴᄾᅉownArrow»ОeftArrow»࢚ightArrow»࿝pArrow;憑gma;䎣allCircle;战pf;쀀𝕊ɲᅭ\0\0ᅰt;戚areȀ;ISUᅻᅼᆉᆯ斡ntersection;抓uĀbpᆏᆞsetĀ;Eᆗᆘ抏qual;抑ersetĀ;Eᆨᆩ抐qual;抒nion;抔cr;쀀𝒮ar;拆ȀbcmpᇈᇛሉላĀ;sᇍᇎ拐etĀ;Eᇍᇕqual;抆ĀchᇠህeedsȀ;ESTᇭᇮᇴᇿ扻qual;檰lantEqual;扽ilde;承Tháྌ;我ƀ;esሒሓሣ拑rsetĀ;Eሜም抃qual;抇et»ሓրHRSacfhiorsሾቄ቉ቕ቞ቱቶኟዂወዑORN耻Þ䃞ADE;愢ĀHc቎ቒcy;䐋y;䐦Ābuቚቜ;䀉;䎤ƀaeyብቪቯron;䅤dil;䅢;䐢r;쀀𝔗Āeiቻ኉Dzኀ\0ኇefore;戴a;䎘Ācn኎ኘkSpace;쀀  Space;怉ldeȀ;EFTካኬኲኼ戼qual;扃ullEqual;扅ilde;扈pf;쀀𝕋ipleDot;惛Āctዖዛr;쀀𝒯rok;䅦ૡዷጎጚጦ\0ጬጱ\0\0\0\0\0ጸጽ፷ᎅ\0᏿ᐄᐊᐐĀcrዻጁute耻Ú䃚rĀ;oጇገ憟cir;楉rǣጓ\0጖y;䐎ve;䅬Āiyጞጣrc耻Û䃛;䐣blac;䅰r;쀀𝔘rave耻Ù䃙acr;䅪Ādiፁ፩erĀBPፈ፝Āarፍፐr;䁟acĀekፗፙ;揟et;掵arenthesis;揝onĀ;P፰፱拃lus;抎Āgp፻፿on;䅲f;쀀𝕌ЀADETadps᎕ᎮᎸᏄϨᏒᏗᏳrrowƀ;BDᅐᎠᎤar;椒ownArrow;懅ownArrow;憕quilibrium;楮eeĀ;AᏋᏌ报rrow;憥ownáϳerĀLRᏞᏨeftArrow;憖ightArrow;憗iĀ;lᏹᏺ䏒on;䎥ing;䅮cr;쀀𝒰ilde;䅨ml耻Ü䃜ҀDbcdefosvᐧᐬᐰᐳᐾᒅᒊᒐᒖash;披ar;櫫y;䐒ashĀ;lᐻᐼ抩;櫦Āerᑃᑅ;拁ƀbtyᑌᑐᑺar;怖Ā;iᑏᑕcalȀBLSTᑡᑥᑪᑴar;戣ine;䁼eparator;杘ilde;所ThinSpace;怊r;쀀𝔙pf;쀀𝕍cr;쀀𝒱dash;抪ʀcefosᒧᒬᒱᒶᒼirc;䅴dge;拀r;쀀𝔚pf;쀀𝕎cr;쀀𝒲Ȁfiosᓋᓐᓒᓘr;쀀𝔛;䎞pf;쀀𝕏cr;쀀𝒳ҀAIUacfosuᓱᓵᓹᓽᔄᔏᔔᔚᔠcy;䐯cy;䐇cy;䐮cute耻Ý䃝Āiyᔉᔍrc;䅶;䐫r;쀀𝔜pf;쀀𝕐cr;쀀𝒴ml;䅸ЀHacdefosᔵᔹᔿᕋᕏᕝᕠᕤcy;䐖cute;䅹Āayᕄᕉron;䅽;䐗ot;䅻Dzᕔ\0ᕛoWidtè૙a;䎖r;愨pf;愤cr;쀀𝒵௡ᖃᖊᖐ\0ᖰᖶᖿ\0\0\0\0ᗆᗛᗫᙟ᙭\0ᚕ᚛ᚲᚹ\0ᚾcute耻á䃡reve;䄃̀;Ediuyᖜᖝᖡᖣᖨᖭ戾;쀀∾̳;房rc耻â䃢te肻´̆;䐰lig耻æ䃦Ā;r²ᖺ;쀀𝔞rave耻à䃠ĀepᗊᗖĀfpᗏᗔsym;愵èᗓha;䎱ĀapᗟcĀclᗤᗧr;䄁g;樿ɤᗰ\0\0ᘊʀ;adsvᗺᗻᗿᘁᘇ戧nd;橕;橜lope;橘;橚΀;elmrszᘘᘙᘛᘞᘿᙏᙙ戠;榤e»ᘙsdĀ;aᘥᘦ戡ѡᘰᘲᘴᘶᘸᘺᘼᘾ;榨;榩;榪;榫;榬;榭;榮;榯tĀ;vᙅᙆ戟bĀ;dᙌᙍ抾;榝Āptᙔᙗh;戢»¹arr;捼Āgpᙣᙧon;䄅f;쀀𝕒΀;Eaeiop዁ᙻᙽᚂᚄᚇᚊ;橰cir;橯;扊d;手s;䀧roxĀ;e዁ᚒñᚃing耻å䃥ƀctyᚡᚦᚨr;쀀𝒶;䀪mpĀ;e዁ᚯñʈilde耻ã䃣ml耻ä䃤Āciᛂᛈoninôɲnt;樑ࠀNabcdefiklnoprsu᛭ᛱᜰ᜼ᝃᝈ᝸᝽០៦ᠹᡐᜍ᤽᥈ᥰot;櫭Ācrᛶ᜞kȀcepsᜀᜅᜍᜓong;扌psilon;䏶rime;怵imĀ;e᜚᜛戽q;拍Ŷᜢᜦee;抽edĀ;gᜬᜭ挅e»ᜭrkĀ;t፜᜷brk;掶Āoyᜁᝁ;䐱quo;怞ʀcmprtᝓ᝛ᝡᝤᝨausĀ;eĊĉptyv;榰séᜌnoõēƀahwᝯ᝱ᝳ;䎲;愶een;扬r;쀀𝔟g΀costuvwឍឝឳេ៕៛៞ƀaiuបពរðݠrc;旯p»፱ƀdptឤឨឭot;樀lus;樁imes;樂ɱឹ\0\0ើcup;樆ar;昅riangleĀdu៍្own;施p;斳plus;樄eåᑄåᒭarow;植ƀako៭ᠦᠵĀcn៲ᠣkƀlst៺֫᠂ozenge;槫riangleȀ;dlr᠒᠓᠘᠝斴own;斾eft;旂ight;斸k;搣Ʊᠫ\0ᠳƲᠯ\0ᠱ;斒;斑4;斓ck;斈ĀeoᠾᡍĀ;qᡃᡆ쀀=⃥uiv;쀀≡⃥t;挐Ȁptwxᡙᡞᡧᡬf;쀀𝕓Ā;tᏋᡣom»Ꮜtie;拈؀DHUVbdhmptuvᢅᢖᢪᢻᣗᣛᣬ᣿ᤅᤊᤐᤡȀLRlrᢎᢐᢒᢔ;敗;敔;敖;敓ʀ;DUduᢡᢢᢤᢦᢨ敐;敦;敩;敤;敧ȀLRlrᢳᢵᢷᢹ;敝;敚;敜;教΀;HLRhlrᣊᣋᣍᣏᣑᣓᣕ救;敬;散;敠;敫;敢;敟ox;槉ȀLRlrᣤᣦᣨᣪ;敕;敒;攐;攌ʀ;DUduڽ᣷᣹᣻᣽;敥;敨;攬;攴inus;抟lus;択imes;抠ȀLRlrᤙᤛᤝ᤟;敛;敘;攘;攔΀;HLRhlrᤰᤱᤳᤵᤷ᤻᤹攂;敪;敡;敞;攼;攤;攜Āevģ᥂bar耻¦䂦Ȁceioᥑᥖᥚᥠr;쀀𝒷mi;恏mĀ;e᜚᜜lƀ;bhᥨᥩᥫ䁜;槅sub;柈Ŭᥴ᥾lĀ;e᥹᥺怢t»᥺pƀ;Eeįᦅᦇ;檮Ā;qۜۛೡᦧ\0᧨ᨑᨕᨲ\0ᨷᩐ\0\0᪴\0\0᫁\0\0ᬡᬮ᭍᭒\0᯽\0ᰌƀcpr᦭ᦲ᧝ute;䄇̀;abcdsᦿᧀᧄ᧊᧕᧙戩nd;橄rcup;橉Āau᧏᧒p;橋p;橇ot;橀;쀀∩︀Āeo᧢᧥t;恁îړȀaeiu᧰᧻ᨁᨅǰ᧵\0᧸s;橍on;䄍dil耻ç䃧rc;䄉psĀ;sᨌᨍ橌m;橐ot;䄋ƀdmnᨛᨠᨦil肻¸ƭptyv;榲t脀¢;eᨭᨮ䂢räƲr;쀀𝔠ƀceiᨽᩀᩍy;䑇ckĀ;mᩇᩈ朓ark»ᩈ;䏇r΀;Ecefms᩟᩠ᩢᩫ᪤᪪᪮旋;槃ƀ;elᩩᩪᩭ䋆q;扗eɡᩴ\0\0᪈rrowĀlr᩼᪁eft;憺ight;憻ʀRSacd᪒᪔᪖᪚᪟»ཇ;擈st;抛irc;抚ash;抝nint;樐id;櫯cir;槂ubsĀ;u᪻᪼晣it»᪼ˬ᫇᫔᫺\0ᬊonĀ;eᫍᫎ䀺Ā;qÇÆɭ᫙\0\0᫢aĀ;t᫞᫟䀬;䁀ƀ;fl᫨᫩᫫戁îᅠeĀmx᫱᫶ent»᫩eóɍǧ᫾\0ᬇĀ;dኻᬂot;橭nôɆƀfryᬐᬔᬗ;쀀𝕔oäɔ脀©;sŕᬝr;愗Āaoᬥᬩrr;憵ss;朗Ācuᬲᬷr;쀀𝒸Ābpᬼ᭄Ā;eᭁᭂ櫏;櫑Ā;eᭉᭊ櫐;櫒dot;拯΀delprvw᭠᭬᭷ᮂᮬᯔ᯹arrĀlr᭨᭪;椸;椵ɰ᭲\0\0᭵r;拞c;拟arrĀ;p᭿ᮀ憶;椽̀;bcdosᮏᮐᮖᮡᮥᮨ截rcap;橈Āauᮛᮞp;橆p;橊ot;抍r;橅;쀀∪︀Ȁalrv᮵ᮿᯞᯣrrĀ;mᮼᮽ憷;椼yƀevwᯇᯔᯘqɰᯎ\0\0ᯒreã᭳uã᭵ee;拎edge;拏en耻¤䂤earrowĀlrᯮ᯳eft»ᮀight»ᮽeäᯝĀciᰁᰇoninôǷnt;戱lcty;挭ঀAHabcdefhijlorstuwz᰸᰻᰿ᱝᱩᱵᲊᲞᲬᲷ᳻᳿ᴍᵻᶑᶫᶻ᷆᷍rò΁ar;楥Ȁglrs᱈ᱍ᱒᱔ger;怠eth;愸òᄳhĀ;vᱚᱛ怐»ऊūᱡᱧarow;椏aã̕Āayᱮᱳron;䄏;䐴ƀ;ao̲ᱼᲄĀgrʿᲁr;懊tseq;橷ƀglmᲑᲔᲘ耻°䂰ta;䎴ptyv;榱ĀirᲣᲨsht;楿;쀀𝔡arĀlrᲳᲵ»ࣜ»သʀaegsv᳂͸᳖᳜᳠mƀ;oș᳊᳔ndĀ;ș᳑uit;晦amma;䏝in;拲ƀ;io᳧᳨᳸䃷de脀÷;o᳧ᳰntimes;拇nø᳷cy;䑒cɯᴆ\0\0ᴊrn;挞op;挍ʀlptuwᴘᴝᴢᵉᵕlar;䀤f;쀀𝕕ʀ;emps̋ᴭᴷᴽᵂqĀ;d͒ᴳot;扑inus;戸lus;戔quare;抡blebarwedgåúnƀadhᄮᵝᵧownarrowóᲃarpoonĀlrᵲᵶefôᲴighôᲶŢᵿᶅkaro÷གɯᶊ\0\0ᶎrn;挟op;挌ƀcotᶘᶣᶦĀryᶝᶡ;쀀𝒹;䑕l;槶rok;䄑Ādrᶰᶴot;拱iĀ;fᶺ᠖斿Āah᷀᷃ròЩaòྦangle;榦Āci᷒ᷕy;䑟grarr;柿ऀDacdefglmnopqrstuxḁḉḙḸոḼṉṡṾấắẽỡἪἷὄ὎὚ĀDoḆᴴoôᲉĀcsḎḔute耻é䃩ter;橮ȀaioyḢḧḱḶron;䄛rĀ;cḭḮ扖耻ê䃪lon;払;䑍ot;䄗ĀDrṁṅot;扒;쀀𝔢ƀ;rsṐṑṗ檚ave耻è䃨Ā;dṜṝ檖ot;檘Ȁ;ilsṪṫṲṴ檙nters;揧;愓Ā;dṹṺ檕ot;檗ƀapsẅẉẗcr;䄓tyƀ;svẒẓẕ戅et»ẓpĀ1;ẝẤijạả;怄;怅怃ĀgsẪẬ;䅋p;怂ĀgpẴẸon;䄙f;쀀𝕖ƀalsỄỎỒrĀ;sỊị拕l;槣us;橱iƀ;lvỚớở䎵on»ớ;䏵ȀcsuvỪỳἋἣĀioữḱrc»Ḯɩỹ\0\0ỻíՈantĀglἂἆtr»ṝess»Ṻƀaeiἒ἖Ἒls;䀽st;扟vĀ;DȵἠD;橸parsl;槥ĀDaἯἳot;打rr;楱ƀcdiἾὁỸr;愯oô͒ĀahὉὋ;䎷耻ð䃰Āmrὓὗl耻ë䃫o;悬ƀcipὡὤὧl;䀡sôծĀeoὬὴctatioîՙnentialåչৡᾒ\0ᾞ\0ᾡᾧ\0\0ῆῌ\0ΐ\0ῦῪ \0 ⁚llingdotseñṄy;䑄male;晀ƀilrᾭᾳ῁lig;耀ffiɩᾹ\0\0᾽g;耀ffig;耀ffl;쀀𝔣lig;耀filig;쀀fjƀaltῙ῜ῡt;晭ig;耀flns;斱of;䆒ǰ΅\0ῳf;쀀𝕗ĀakֿῷĀ;vῼ´拔;櫙artint;樍Āao‌⁕Ācs‑⁒ႉ‸⁅⁈\0⁐β•‥‧‪‬\0‮耻½䂽;慓耻¼䂼;慕;慙;慛Ƴ‴\0‶;慔;慖ʴ‾⁁\0\0⁃耻¾䂾;慗;慜5;慘ƶ⁌\0⁎;慚;慝8;慞l;恄wn;挢cr;쀀𝒻ࢀEabcdefgijlnorstv₂₉₟₥₰₴⃰⃵⃺⃿℃ℒℸ̗ℾ⅒↞Ā;lٍ₇;檌ƀcmpₐₕ₝ute;䇵maĀ;dₜ᳚䎳;檆reve;䄟Āiy₪₮rc;䄝;䐳ot;䄡Ȁ;lqsؾق₽⃉ƀ;qsؾٌ⃄lanô٥Ȁ;cdl٥⃒⃥⃕c;檩otĀ;o⃜⃝檀Ā;l⃢⃣檂;檄Ā;e⃪⃭쀀⋛︀s;檔r;쀀𝔤Ā;gٳ؛mel;愷cy;䑓Ȁ;Eajٚℌℎℐ;檒;檥;檤ȀEaesℛℝ℩ℴ;扩pĀ;p℣ℤ檊rox»ℤĀ;q℮ℯ檈Ā;q℮ℛim;拧pf;쀀𝕘Āci⅃ⅆr;愊mƀ;el٫ⅎ⅐;檎;檐茀>;cdlqr׮ⅠⅪⅮⅳⅹĀciⅥⅧ;檧r;橺ot;拗Par;榕uest;橼ʀadelsↄⅪ←ٖ↛ǰ↉\0↎proø₞r;楸qĀlqؿ↖lesó₈ií٫Āen↣↭rtneqq;쀀≩︀Å↪ԀAabcefkosy⇄⇇⇱⇵⇺∘∝∯≨≽ròΠȀilmr⇐⇔⇗⇛rsðᒄf»․ilôکĀdr⇠⇤cy;䑊ƀ;cwࣴ⇫⇯ir;楈;憭ar;意irc;䄥ƀalr∁∎∓rtsĀ;u∉∊晥it»∊lip;怦con;抹r;쀀𝔥sĀew∣∩arow;椥arow;椦ʀamopr∺∾≃≞≣rr;懿tht;戻kĀlr≉≓eftarrow;憩ightarrow;憪f;쀀𝕙bar;怕ƀclt≯≴≸r;쀀𝒽asè⇴rok;䄧Ābp⊂⊇ull;恃hen»ᱛૡ⊣\0⊪\0⊸⋅⋎\0⋕⋳\0\0⋸⌢⍧⍢⍿\0⎆⎪⎴cute耻í䃭ƀ;iyݱ⊰⊵rc耻î䃮;䐸Ācx⊼⊿y;䐵cl耻¡䂡ĀfrΟ⋉;쀀𝔦rave耻ì䃬Ȁ;inoܾ⋝⋩⋮Āin⋢⋦nt;樌t;戭fin;槜ta;愩lig;䄳ƀaop⋾⌚⌝ƀcgt⌅⌈⌗r;䄫ƀelpܟ⌏⌓inåގarôܠh;䄱f;抷ed;䆵ʀ;cfotӴ⌬⌱⌽⍁are;愅inĀ;t⌸⌹戞ie;槝doô⌙ʀ;celpݗ⍌⍐⍛⍡al;抺Āgr⍕⍙eróᕣã⍍arhk;樗rod;樼Ȁcgpt⍯⍲⍶⍻y;䑑on;䄯f;쀀𝕚a;䎹uest耻¿䂿Āci⎊⎏r;쀀𝒾nʀ;EdsvӴ⎛⎝⎡ӳ;拹ot;拵Ā;v⎦⎧拴;拳Ā;iݷ⎮lde;䄩ǫ⎸\0⎼cy;䑖l耻ï䃯̀cfmosu⏌⏗⏜⏡⏧⏵Āiy⏑⏕rc;䄵;䐹r;쀀𝔧ath;䈷pf;쀀𝕛ǣ⏬\0⏱r;쀀𝒿rcy;䑘kcy;䑔Ѐacfghjos␋␖␢␧␭␱␵␻ppaĀ;v␓␔䎺;䏰Āey␛␠dil;䄷;䐺r;쀀𝔨reen;䄸cy;䑅cy;䑜pf;쀀𝕜cr;쀀𝓀஀ABEHabcdefghjlmnoprstuv⑰⒁⒆⒍⒑┎┽╚▀♎♞♥♹♽⚚⚲⛘❝❨➋⟀⠁⠒ƀart⑷⑺⑼rò৆òΕail;椛arr;椎Ā;gঔ⒋;檋ar;楢ॣ⒥\0⒪\0⒱\0\0\0\0\0⒵Ⓔ\0ⓆⓈⓍ\0⓹ute;䄺mptyv;榴raîࡌbda;䎻gƀ;dlࢎⓁⓃ;榑åࢎ;檅uo耻«䂫rЀ;bfhlpst࢙ⓞⓦⓩ⓫⓮⓱⓵Ā;f࢝ⓣs;椟s;椝ë≒p;憫l;椹im;楳l;憢ƀ;ae⓿─┄檫il;椙Ā;s┉┊檭;쀀⪭︀ƀabr┕┙┝rr;椌rk;杲Āak┢┬cĀek┨┪;䁻;䁛Āes┱┳;榋lĀdu┹┻;榏;榍Ȁaeuy╆╋╖╘ron;䄾Ādi═╔il;䄼ìࢰâ┩;䐻Ȁcqrs╣╦╭╽a;椶uoĀ;rนᝆĀdu╲╷har;楧shar;楋h;憲ʀ;fgqs▋▌উ◳◿扤tʀahlrt▘▤▷◂◨rrowĀ;t࢙□aé⓶arpoonĀdu▯▴own»њp»०eftarrows;懇ightƀahs◍◖◞rrowĀ;sࣴࢧarpoonó྘quigarro÷⇰hreetimes;拋ƀ;qs▋ও◺lanôবʀ;cdgsব☊☍☝☨c;檨otĀ;o☔☕橿Ā;r☚☛檁;檃Ā;e☢☥쀀⋚︀s;檓ʀadegs☳☹☽♉♋pproøⓆot;拖qĀgq♃♅ôউgtò⒌ôছiíলƀilr♕࣡♚sht;楼;쀀𝔩Ā;Eজ♣;檑š♩♶rĀdu▲♮Ā;l॥♳;楪lk;斄cy;䑙ʀ;achtੈ⚈⚋⚑⚖rò◁orneòᴈard;楫ri;旺Āio⚟⚤dot;䅀ustĀ;a⚬⚭掰che»⚭ȀEaes⚻⚽⛉⛔;扨pĀ;p⛃⛄檉rox»⛄Ā;q⛎⛏檇Ā;q⛎⚻im;拦Ѐabnoptwz⛩⛴⛷✚✯❁❇❐Ānr⛮⛱g;柬r;懽rëࣁgƀlmr⛿✍✔eftĀar০✇ightá৲apsto;柼ightá৽parrowĀlr✥✩efô⓭ight;憬ƀafl✶✹✽r;榅;쀀𝕝us;樭imes;樴š❋❏st;戗áፎƀ;ef❗❘᠀旊nge»❘arĀ;l❤❥䀨t;榓ʀachmt❳❶❼➅➇ròࢨorneòᶌarĀ;d྘➃;業;怎ri;抿̀achiqt➘➝ੀ➢➮➻quo;怹r;쀀𝓁mƀ;egল➪➬;檍;檏Ābu┪➳oĀ;rฟ➹;怚rok;䅂萀<;cdhilqrࠫ⟒☹⟜⟠⟥⟪⟰Āci⟗⟙;檦r;橹reå◲mes;拉arr;楶uest;橻ĀPi⟵⟹ar;榖ƀ;ef⠀भ᠛旃rĀdu⠇⠍shar;楊har;楦Āen⠗⠡rtneqq;쀀≨︀Å⠞܀Dacdefhilnopsu⡀⡅⢂⢎⢓⢠⢥⢨⣚⣢⣤ઃ⣳⤂Dot;戺Ȁclpr⡎⡒⡣⡽r耻¯䂯Āet⡗⡙;時Ā;e⡞⡟朠se»⡟Ā;sျ⡨toȀ;dluျ⡳⡷⡻owîҌefôएðᏑker;斮Āoy⢇⢌mma;権;䐼ash;怔asuredangle»ᘦr;쀀𝔪o;愧ƀcdn⢯⢴⣉ro耻µ䂵Ȁ;acdᑤ⢽⣀⣄sôᚧir;櫰ot肻·Ƶusƀ;bd⣒ᤃ⣓戒Ā;uᴼ⣘;横ţ⣞⣡p;櫛ò−ðઁĀdp⣩⣮els;抧f;쀀𝕞Āct⣸⣽r;쀀𝓂pos»ᖝƀ;lm⤉⤊⤍䎼timap;抸ఀGLRVabcdefghijlmoprstuvw⥂⥓⥾⦉⦘⧚⧩⨕⨚⩘⩝⪃⪕⪤⪨⬄⬇⭄⭿⮮ⰴⱧⱼ⳩Āgt⥇⥋;쀀⋙̸Ā;v⥐௏쀀≫⃒ƀelt⥚⥲⥶ftĀar⥡⥧rrow;懍ightarrow;懎;쀀⋘̸Ā;v⥻ే쀀≪⃒ightarrow;懏ĀDd⦎⦓ash;抯ash;抮ʀbcnpt⦣⦧⦬⦱⧌la»˞ute;䅄g;쀀∠⃒ʀ;Eiop඄⦼⧀⧅⧈;쀀⩰̸d;쀀≋̸s;䅉roø඄urĀ;a⧓⧔普lĀ;s⧓ସdz⧟\0⧣p肻 ଷmpĀ;e௹ఀʀaeouy⧴⧾⨃⨐⨓ǰ⧹\0⧻;橃on;䅈dil;䅆ngĀ;dൾ⨊ot;쀀⩭̸p;橂;䐽ash;怓΀;Aadqsxஒ⨩⨭⨻⩁⩅⩐rr;懗rĀhr⨳⨶k;椤Ā;oᏲᏰot;쀀≐̸uiöୣĀei⩊⩎ar;椨í஘istĀ;s஠டr;쀀𝔫ȀEest௅⩦⩹⩼ƀ;qs஼⩭௡ƀ;qs஼௅⩴lanô௢ií௪Ā;rஶ⪁»ஷƀAap⪊⪍⪑rò⥱rr;憮ar;櫲ƀ;svྍ⪜ྌĀ;d⪡⪢拼;拺cy;䑚΀AEadest⪷⪺⪾⫂⫅⫶⫹rò⥦;쀀≦̸rr;憚r;急Ȁ;fqs఻⫎⫣⫯tĀar⫔⫙rro÷⫁ightarro÷⪐ƀ;qs఻⪺⫪lanôౕĀ;sౕ⫴»శiíౝĀ;rవ⫾iĀ;eచథiäඐĀpt⬌⬑f;쀀𝕟膀¬;in⬙⬚⬶䂬nȀ;Edvஉ⬤⬨⬮;쀀⋹̸ot;쀀⋵̸ǡஉ⬳⬵;拷;拶iĀ;vಸ⬼ǡಸ⭁⭃;拾;拽ƀaor⭋⭣⭩rȀ;ast୻⭕⭚⭟lleì୻l;쀀⫽⃥;쀀∂̸lint;樔ƀ;ceಒ⭰⭳uåಥĀ;cಘ⭸Ā;eಒ⭽ñಘȀAait⮈⮋⮝⮧rò⦈rrƀ;cw⮔⮕⮙憛;쀀⤳̸;쀀↝̸ghtarrow»⮕riĀ;eೋೖ΀chimpqu⮽⯍⯙⬄୸⯤⯯Ȁ;cerല⯆ഷ⯉uå൅;쀀𝓃ortɭ⬅\0\0⯖ará⭖mĀ;e൮⯟Ā;q൴൳suĀbp⯫⯭å೸åഋƀbcp⯶ⰑⰙȀ;Ees⯿ⰀഢⰄ抄;쀀⫅̸etĀ;eഛⰋqĀ;qണⰀcĀ;eലⰗñസȀ;EesⰢⰣൟⰧ抅;쀀⫆̸etĀ;e൘ⰮqĀ;qൠⰣȀgilrⰽⰿⱅⱇìௗlde耻ñ䃱çృiangleĀlrⱒⱜeftĀ;eచⱚñదightĀ;eೋⱥñ೗Ā;mⱬⱭ䎽ƀ;esⱴⱵⱹ䀣ro;愖p;怇ҀDHadgilrsⲏⲔⲙⲞⲣⲰⲶⳓⳣash;抭arr;椄p;쀀≍⃒ash;抬ĀetⲨⲬ;쀀≥⃒;쀀>⃒nfin;槞ƀAetⲽⳁⳅrr;椂;쀀≤⃒Ā;rⳊⳍ쀀<⃒ie;쀀⊴⃒ĀAtⳘⳜrr;椃rie;쀀⊵⃒im;쀀∼⃒ƀAan⳰⳴ⴂrr;懖rĀhr⳺⳽k;椣Ā;oᏧᏥear;椧ቓ᪕\0\0\0\0\0\0\0\0\0\0\0\0\0ⴭ\0ⴸⵈⵠⵥ⵲ⶄᬇ\0\0ⶍⶫ\0ⷈⷎ\0ⷜ⸙⸫⸾⹃Ācsⴱ᪗ute耻ó䃳ĀiyⴼⵅrĀ;c᪞ⵂ耻ô䃴;䐾ʀabios᪠ⵒⵗLjⵚlac;䅑v;樸old;榼lig;䅓Ācr⵩⵭ir;榿;쀀𝔬ͯ⵹\0\0⵼\0ⶂn;䋛ave耻ò䃲;槁Ābmⶈ෴ar;榵Ȁacitⶕ⶘ⶥⶨrò᪀Āir⶝ⶠr;榾oss;榻nå๒;槀ƀaeiⶱⶵⶹcr;䅍ga;䏉ƀcdnⷀⷅǍron;䎿;榶pf;쀀𝕠ƀaelⷔ⷗ǒr;榷rp;榹΀;adiosvⷪⷫⷮ⸈⸍⸐⸖戨rò᪆Ȁ;efmⷷⷸ⸂⸅橝rĀ;oⷾⷿ愴f»ⷿ耻ª䂪耻º䂺gof;抶r;橖lope;橗;橛ƀclo⸟⸡⸧ò⸁ash耻ø䃸l;折iŬⸯ⸴de耻õ䃵esĀ;aǛ⸺s;樶ml耻ö䃶bar;挽ૡ⹞\0⹽\0⺀⺝\0⺢⺹\0\0⻋ຜ\0⼓\0\0⼫⾼\0⿈rȀ;astЃ⹧⹲຅脀¶;l⹭⹮䂶leìЃɩ⹸\0\0⹻m;櫳;櫽y;䐿rʀcimpt⺋⺏⺓ᡥ⺗nt;䀥od;䀮il;怰enk;怱r;쀀𝔭ƀimo⺨⺰⺴Ā;v⺭⺮䏆;䏕maô੶ne;明ƀ;tv⺿⻀⻈䏀chfork»´;䏖Āau⻏⻟nĀck⻕⻝kĀ;h⇴⻛;愎ö⇴sҀ;abcdemst⻳⻴ᤈ⻹⻽⼄⼆⼊⼎䀫cir;樣ir;樢Āouᵀ⼂;樥;橲n肻±ຝim;樦wo;樧ƀipu⼙⼠⼥ntint;樕f;쀀𝕡nd耻£䂣Ԁ;Eaceinosu່⼿⽁⽄⽇⾁⾉⾒⽾⾶;檳p;檷uå໙Ā;c໎⽌̀;acens່⽙⽟⽦⽨⽾pproø⽃urlyeñ໙ñ໎ƀaes⽯⽶⽺pprox;檹qq;檵im;拨iíໟmeĀ;s⾈ຮ怲ƀEas⽸⾐⽺ð⽵ƀdfp໬⾙⾯ƀals⾠⾥⾪lar;挮ine;挒urf;挓Ā;t໻⾴ï໻rel;抰Āci⿀⿅r;쀀𝓅;䏈ncsp;怈̀fiopsu⿚⋢⿟⿥⿫⿱r;쀀𝔮pf;쀀𝕢rime;恗cr;쀀𝓆ƀaeo⿸〉〓tĀei⿾々rnionóڰnt;樖stĀ;e【】䀿ñἙô༔઀ABHabcdefhilmnoprstux぀けさすムㄎㄫㅇㅢㅲㆎ㈆㈕㈤㈩㉘㉮㉲㊐㊰㊷ƀartぇおがròႳòϝail;検aròᱥar;楤΀cdenqrtとふへみわゔヌĀeuねぱ;쀀∽̱te;䅕iãᅮmptyv;榳gȀ;del࿑らるろ;榒;榥å࿑uo耻»䂻rր;abcfhlpstw࿜ガクシスゼゾダッデナp;極Ā;f࿠ゴs;椠;椳s;椞ë≝ð✮l;楅im;楴l;憣;憝Āaiパフil;椚oĀ;nホボ戶aló༞ƀabrョリヮrò៥rk;杳ĀakンヽcĀekヹ・;䁽;䁝Āes㄂㄄;榌lĀduㄊㄌ;榎;榐Ȁaeuyㄗㄜㄧㄩron;䅙Ādiㄡㄥil;䅗ì࿲âヺ;䑀Ȁclqsㄴㄷㄽㅄa;椷dhar;楩uoĀ;rȎȍh;憳ƀacgㅎㅟངlȀ;ipsླྀㅘㅛႜnåႻarôྩt;断ƀilrㅩဣㅮsht;楽;쀀𝔯ĀaoㅷㆆrĀduㅽㅿ»ѻĀ;l႑ㆄ;楬Ā;vㆋㆌ䏁;䏱ƀgns㆕ㇹㇼht̀ahlrstㆤㆰ㇂㇘㇤㇮rrowĀ;t࿜ㆭaéトarpoonĀduㆻㆿowîㅾp»႒eftĀah㇊㇐rrowó࿪arpoonóՑightarrows;應quigarro÷ニhreetimes;拌g;䋚ingdotseñἲƀahm㈍㈐㈓rò࿪aòՑ;怏oustĀ;a㈞㈟掱che»㈟mid;櫮Ȁabpt㈲㈽㉀㉒Ānr㈷㈺g;柭r;懾rëဃƀafl㉇㉊㉎r;榆;쀀𝕣us;樮imes;樵Āap㉝㉧rĀ;g㉣㉤䀩t;榔olint;樒arò㇣Ȁachq㉻㊀Ⴜ㊅quo;怺r;쀀𝓇Ābu・㊊oĀ;rȔȓƀhir㊗㊛㊠reåㇸmes;拊iȀ;efl㊪ၙᠡ㊫方tri;槎luhar;楨;愞ൡ㋕㋛㋟㌬㌸㍱\0㍺㎤\0\0㏬㏰\0㐨㑈㑚㒭㒱㓊㓱\0㘖\0\0㘳cute;䅛quï➺Ԁ;Eaceinpsyᇭ㋳㋵㋿㌂㌋㌏㌟㌦㌩;檴ǰ㋺\0㋼;檸on;䅡uåᇾĀ;dᇳ㌇il;䅟rc;䅝ƀEas㌖㌘㌛;檶p;檺im;择olint;樓iíሄ;䑁otƀ;be㌴ᵇ㌵担;橦΀Aacmstx㍆㍊㍗㍛㍞㍣㍭rr;懘rĀhr㍐㍒ë∨Ā;oਸ਼਴t耻§䂧i;䀻war;椩mĀin㍩ðnuóñt;朶rĀ;o㍶⁕쀀𝔰Ȁacoy㎂㎆㎑㎠rp;景Āhy㎋㎏cy;䑉;䑈rtɭ㎙\0\0㎜iäᑤaraì⹯耻­䂭Āgm㎨㎴maƀ;fv㎱㎲㎲䏃;䏂Ѐ;deglnprካ㏅㏉㏎㏖㏞㏡㏦ot;橪Ā;q኱ኰĀ;E㏓㏔檞;檠Ā;E㏛㏜檝;檟e;扆lus;樤arr;楲aròᄽȀaeit㏸㐈㐏㐗Āls㏽㐄lsetmé㍪hp;樳parsl;槤Ādlᑣ㐔e;挣Ā;e㐜㐝檪Ā;s㐢㐣檬;쀀⪬︀ƀflp㐮㐳㑂tcy;䑌Ā;b㐸㐹䀯Ā;a㐾㐿槄r;挿f;쀀𝕤aĀdr㑍ЂesĀ;u㑔㑕晠it»㑕ƀcsu㑠㑹㒟Āau㑥㑯pĀ;sᆈ㑫;쀀⊓︀pĀ;sᆴ㑵;쀀⊔︀uĀbp㑿㒏ƀ;esᆗᆜ㒆etĀ;eᆗ㒍ñᆝƀ;esᆨᆭ㒖etĀ;eᆨ㒝ñᆮƀ;afᅻ㒦ְrť㒫ֱ»ᅼaròᅈȀcemt㒹㒾㓂㓅r;쀀𝓈tmîñiì㐕aræᆾĀar㓎㓕rĀ;f㓔ឿ昆Āan㓚㓭ightĀep㓣㓪psiloîỠhé⺯s»⡒ʀbcmnp㓻㕞ሉ㖋㖎Ҁ;Edemnprs㔎㔏㔑㔕㔞㔣㔬㔱㔶抂;櫅ot;檽Ā;dᇚ㔚ot;櫃ult;櫁ĀEe㔨㔪;櫋;把lus;檿arr;楹ƀeiu㔽㕒㕕tƀ;en㔎㕅㕋qĀ;qᇚ㔏eqĀ;q㔫㔨m;櫇Ābp㕚㕜;櫕;櫓c̀;acensᇭ㕬㕲㕹㕻㌦pproø㋺urlyeñᇾñᇳƀaes㖂㖈㌛pproø㌚qñ㌗g;晪ڀ123;Edehlmnps㖩㖬㖯ሜ㖲㖴㗀㗉㗕㗚㗟㗨㗭耻¹䂹耻²䂲耻³䂳;櫆Āos㖹㖼t;檾ub;櫘Ā;dሢ㗅ot;櫄sĀou㗏㗒l;柉b;櫗arr;楻ult;櫂ĀEe㗤㗦;櫌;抋lus;櫀ƀeiu㗴㘉㘌tƀ;enሜ㗼㘂qĀ;qሢ㖲eqĀ;q㗧㗤m;櫈Ābp㘑㘓;櫔;櫖ƀAan㘜㘠㘭rr;懙rĀhr㘦㘨ë∮Ā;oਫ਩war;椪lig耻ß䃟௡㙑㙝㙠ዎ㙳㙹\0㙾㛂\0\0\0\0\0㛛㜃\0㜉㝬\0\0\0㞇ɲ㙖\0\0㙛get;挖;䏄rë๟ƀaey㙦㙫㙰ron;䅥dil;䅣;䑂lrec;挕r;쀀𝔱Ȁeiko㚆㚝㚵㚼Dz㚋\0㚑eĀ4fኄኁaƀ;sv㚘㚙㚛䎸ym;䏑Ācn㚢㚲kĀas㚨㚮pproø዁im»ኬsðኞĀas㚺㚮ð዁rn耻þ䃾Ǭ̟㛆⋧es膀×;bd㛏㛐㛘䃗Ā;aᤏ㛕r;樱;樰ƀeps㛡㛣㜀á⩍Ȁ;bcf҆㛬㛰㛴ot;挶ir;櫱Ā;o㛹㛼쀀𝕥rk;櫚á㍢rime;怴ƀaip㜏㜒㝤dåቈ΀adempst㜡㝍㝀㝑㝗㝜㝟ngleʀ;dlqr㜰㜱㜶㝀㝂斵own»ᶻeftĀ;e⠀㜾ñम;扜ightĀ;e㊪㝋ñၚot;旬inus;樺lus;樹b;槍ime;樻ezium;揢ƀcht㝲㝽㞁Āry㝷㝻;쀀𝓉;䑆cy;䑛rok;䅧Āio㞋㞎xô᝷headĀlr㞗㞠eftarro÷ࡏightarrow»ཝऀAHabcdfghlmoprstuw㟐㟓㟗㟤㟰㟼㠎㠜㠣㠴㡑㡝㡫㢩㣌㣒㣪㣶ròϭar;楣Ācr㟜㟢ute耻ú䃺òᅐrǣ㟪\0㟭y;䑞ve;䅭Āiy㟵㟺rc耻û䃻;䑃ƀabh㠃㠆㠋ròᎭlac;䅱aòᏃĀir㠓㠘sht;楾;쀀𝔲rave耻ù䃹š㠧㠱rĀlr㠬㠮»ॗ»ႃlk;斀Āct㠹㡍ɯ㠿\0\0㡊rnĀ;e㡅㡆挜r»㡆op;挏ri;旸Āal㡖㡚cr;䅫肻¨͉Āgp㡢㡦on;䅳f;쀀𝕦̀adhlsuᅋ㡸㡽፲㢑㢠ownáᎳarpoonĀlr㢈㢌efô㠭ighô㠯iƀ;hl㢙㢚㢜䏅»ᏺon»㢚parrows;懈ƀcit㢰㣄㣈ɯ㢶\0\0㣁rnĀ;e㢼㢽挝r»㢽op;挎ng;䅯ri;旹cr;쀀𝓊ƀdir㣙㣝㣢ot;拰lde;䅩iĀ;f㜰㣨»᠓Āam㣯㣲rò㢨l耻ü䃼angle;榧ހABDacdeflnoprsz㤜㤟㤩㤭㦵㦸㦽㧟㧤㧨㧳㧹㧽㨁㨠ròϷarĀ;v㤦㤧櫨;櫩asèϡĀnr㤲㤷grt;榜΀eknprst㓣㥆㥋㥒㥝㥤㦖appá␕othinçẖƀhir㓫⻈㥙opô⾵Ā;hᎷ㥢ïㆍĀiu㥩㥭gmá㎳Ābp㥲㦄setneqĀ;q㥽㦀쀀⊊︀;쀀⫋︀setneqĀ;q㦏㦒쀀⊋︀;쀀⫌︀Āhr㦛㦟etá㚜iangleĀlr㦪㦯eft»थight»ၑy;䐲ash»ံƀelr㧄㧒㧗ƀ;beⷪ㧋㧏ar;抻q;扚lip;拮Ābt㧜ᑨaòᑩr;쀀𝔳tré㦮suĀbp㧯㧱»ജ»൙pf;쀀𝕧roð໻tré㦴Ācu㨆㨋r;쀀𝓋Ābp㨐㨘nĀEe㦀㨖»㥾nĀEe㦒㨞»㦐igzag;榚΀cefoprs㨶㨻㩖㩛㩔㩡㩪irc;䅵Ādi㩀㩑Ābg㩅㩉ar;機eĀ;qᗺ㩏;扙erp;愘r;쀀𝔴pf;쀀𝕨Ā;eᑹ㩦atèᑹcr;쀀𝓌ૣណ㪇\0㪋\0㪐㪛\0\0㪝㪨㪫㪯\0\0㫃㫎\0㫘ៜ៟tré៑r;쀀𝔵ĀAa㪔㪗ròσrò৶;䎾ĀAa㪡㪤ròθrò৫að✓is;拻ƀdptឤ㪵㪾Āfl㪺ឩ;쀀𝕩imåឲĀAa㫇㫊ròώròਁĀcq㫒ីr;쀀𝓍Āpt៖㫜ré។Ѐacefiosu㫰㫽㬈㬌㬑㬕㬛㬡cĀuy㫶㫻te耻ý䃽;䑏Āiy㬂㬆rc;䅷;䑋n耻¥䂥r;쀀𝔶cy;䑗pf;쀀𝕪cr;쀀𝓎Ācm㬦㬩y;䑎l耻ÿ䃿Ԁacdefhiosw㭂㭈㭔㭘㭤㭩㭭㭴㭺㮀cute;䅺Āay㭍㭒ron;䅾;䐷ot;䅼Āet㭝㭡træᕟa;䎶r;쀀𝔷cy;䐶grarr;懝pf;쀀𝕫cr;쀀𝓏Ājn㮅㮇;怍j;怌'.split("").map((t=>t.charCodeAt(0)))),q=new Uint16Array("Ȁaglq\tɭ\0\0p;䀦os;䀧t;䀾t;䀼uot;䀢".split("").map((t=>t.charCodeAt(0))));var H;const z=new Map([[0,65533],[128,8364],[130,8218],[131,402],[132,8222],[133,8230],[134,8224],[135,8225],[136,710],[137,8240],[138,352],[139,8249],[140,338],[142,381],[145,8216],[146,8217],[147,8220],[148,8221],[149,8226],[150,8211],[151,8212],[152,732],[153,8482],[154,353],[155,8250],[156,339],[158,382],[159,376]]),j=null!==(H=String.fromCodePoint)&&void 0!==H?H:function(t){let e="";return t>65535&&(t-=65536,e+=String.fromCharCode(t>>>10&1023|55296),t=56320|1023&t),e+=String.fromCharCode(t),e};var U,V,G,W,$;function X(t){return t>=U.ZERO&&t<=U.NINE}!function(t){t[t.NUM=35]="NUM",t[t.SEMI=59]="SEMI",t[t.EQUALS=61]="EQUALS",t[t.ZERO=48]="ZERO",t[t.NINE=57]="NINE",t[t.LOWER_A=97]="LOWER_A",t[t.LOWER_F=102]="LOWER_F",t[t.LOWER_X=120]="LOWER_X",t[t.LOWER_Z=122]="LOWER_Z",t[t.UPPER_A=65]="UPPER_A",t[t.UPPER_F=70]="UPPER_F",t[t.UPPER_Z=90]="UPPER_Z"}(U||(U={})),function(t){t[t.VALUE_LENGTH=49152]="VALUE_LENGTH",t[t.BRANCH_LENGTH=16256]="BRANCH_LENGTH",t[t.JUMP_TABLE=127]="JUMP_TABLE"}(V||(V={})),function(t){t[t.EntityStart=0]="EntityStart",t[t.NumericStart=1]="NumericStart",t[t.NumericDecimal=2]="NumericDecimal",t[t.NumericHex=3]="NumericHex",t[t.NamedEntity=4]="NamedEntity"}(G||(G={})),($=W||(W={}))[$.Legacy=0]="Legacy",$[$.Strict=1]="Strict",$[$.Attribute=2]="Attribute";class K{constructor(t,e,i){this.decodeTree=t,this.emitCodePoint=e,this.errors=i,this.state=G.EntityStart,this.consumed=1,this.result=0,this.treeIndex=0,this.excess=1,this.decodeMode=W.Strict}startEntity(t){this.decodeMode=t,this.state=G.EntityStart,this.result=0,this.treeIndex=0,this.excess=1,this.consumed=1}write(t,e){switch(this.state){case G.EntityStart:return t.charCodeAt(e)===U.NUM?(this.state=G.NumericStart,this.consumed+=1,this.stateNumericStart(t,e+1)):(this.state=G.NamedEntity,this.stateNamedEntity(t,e));case G.NumericStart:return this.stateNumericStart(t,e);case G.NumericDecimal:return this.stateNumericDecimal(t,e);case G.NumericHex:return this.stateNumericHex(t,e);case G.NamedEntity:return this.stateNamedEntity(t,e)}}stateNumericStart(t,e){return e>=t.length?-1:(32|t.charCodeAt(e))===U.LOWER_X?(this.state=G.NumericHex,this.consumed+=1,this.stateNumericHex(t,e+1)):(this.state=G.NumericDecimal,this.stateNumericDecimal(t,e))}addToNumericResult(t,e,i,n){if(e!==i){const s=i-e;this.result=this.result*Math.pow(n,s)+parseInt(t.substr(e,s),n),this.consumed+=s}}stateNumericHex(t,e){const i=e;for(;e=U.UPPER_A&&n<=U.UPPER_F||n>=U.LOWER_A&&n<=U.LOWER_F)))return this.addToNumericResult(t,i,e,16),this.emitNumericEntity(s,3);e+=1}var n;return this.addToNumericResult(t,i,e,16),-1}stateNumericDecimal(t,e){const i=e;for(;e=55296&&t<=57343||t>1114111?65533:null!==(e=z.get(t))&&void 0!==e?e:t}(this.result),this.consumed),this.errors&&(t!==U.SEMI&&this.errors.missingSemicolonAfterCharacterReference(),this.errors.validateNumericCharacterReference(this.result)),this.consumed}stateNamedEntity(t,e){const{decodeTree:i}=this;let n=i[this.treeIndex],s=(n&V.VALUE_LENGTH)>>14;for(;e=U.UPPER_A&&t<=U.UPPER_Z||t>=U.LOWER_A&&t<=U.LOWER_Z||X(t)}(r)))?0:this.emitNotTerminatedNamedEntity();if(n=i[this.treeIndex],s=(n&V.VALUE_LENGTH)>>14,0!==s){if(a===U.SEMI)return this.emitNamedEntityData(this.treeIndex,s,this.consumed+this.excess);this.decodeMode!==W.Strict&&(this.result=this.treeIndex,this.consumed+=this.excess,this.excess=0)}}var r;return-1}emitNotTerminatedNamedEntity(){var t;const{result:e,decodeTree:i}=this,n=(i[e]&V.VALUE_LENGTH)>>14;return this.emitNamedEntityData(e,n,this.consumed),null===(t=this.errors)||void 0===t||t.missingSemicolonAfterCharacterReference(),this.consumed}emitNamedEntityData(t,e,i){const{decodeTree:n}=this;return this.emitCodePoint(1===e?n[t]&~V.VALUE_LENGTH:n[t+1],i),3===e&&this.emitCodePoint(n[t+2],i),i}end(){var t;switch(this.state){case G.NamedEntity:return 0===this.result||this.decodeMode===W.Attribute&&this.result!==this.treeIndex?0:this.emitNotTerminatedNamedEntity();case G.NumericDecimal:return this.emitNumericEntity(0,2);case G.NumericHex:return this.emitNumericEntity(0,3);case G.NumericStart:return null===(t=this.errors)||void 0===t||t.absenceOfDigitsInNumericCharacterReference(this.consumed),0;case G.EntityStart:return 0}}}function Y(t){let e="";const i=new K(t,(t=>e+=j(t)));return function(t,n){let s=0,r=0;for(;(r=t.indexOf("&",r))>=0;){e+=t.slice(s,r),i.startEntity(n);const a=i.write(t,r+1);if(a<0){s=r+i.end();break}s=r+a,r=0===a?s+1:s}const a=e+t.slice(s);return e="",a}}function Q(t,e,i,n){const s=(e&V.BRANCH_LENGTH)>>7,r=e&V.JUMP_TABLE;if(0===s)return 0!==r&&n===r?i:-1;if(r){const e=n-r;return e<0||e>=s?-1:t[i+e]-1}let a=i,o=a+s-1;for(;a<=o;){const e=a+o>>>1,i=t[e];if(in))return t[e+s];o=e-1}}return-1}const J=Y(B);function Z(t){for(let e=1;et.length)&&(e=t.length);for(var i=0,n=Array(e);i'"]/g,tt),et(/["&\u00A0]/g,new Map([[34,"""],[38,"&"],[160," "]])),et(/[&<>\u00A0]/g,new Map([[38,"&"],[60,"<"],[62,">"],[160," "]])),function(t){t[t.XML=0]="XML",t[t.HTML=1]="HTML"}(it||(it={})),function(t){t[t.UTF8=0]="UTF8",t[t.ASCII=1]="ASCII",t[t.Extensive=2]="Extensive",t[t.Attribute=3]="Attribute",t[t.Text=4]="Text"}(nt||(nt={}));var rt={includeSpaces:!1,renderedCss:!1,validTypes:["longtextV2","plaintext"]};function at(){var t,e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];rt.includeSpaces=Boolean(e),rt.renderedCss||((t=document.createElement("style")).textContent="\n/* Learnosity essay limit by character styles */\n.lrn_widget .lrn_word_count,\n.lrn_widget .lrn_character_count {\n margin-right: 0px;\n}\n",document.head.append(t),rt.renderedCss=!0),function(){for(var t=_.appInstance().getQuestions(),e=function(){var t,e,s=(t=n[i],e=2,function(t){if(Array.isArray(t))return t}(t)||function(t,e){var i=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=i){var n,s,r,a,o=[],l=!0,c=!1;try{if(r=(i=i.call(t)).next,0===e){if(Object(i)!==i)return;l=!1}else for(;!(l=(n=r.call(i)).done)&&(o.push(n.value),o.length!==e);l=!0);}catch(t){c=!0,s=t}finally{try{if(!l&&null!=i.return&&(a=i.return(),Object(a)!==a))return}finally{if(c)throw s}}return o}}(t,e)||function(t,e){if(t){if("string"==typeof t)return st(t,e);var i={}.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?st(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),r=(s[0],s[1]);if(rt.validTypes.indexOf(r.type)>=0){var a=_.appInstance().question(r.response_id);_.appInstance().question(r.response_id).on("rendered",(function(){!function(t){var e;if(!(null===(e=w.activity())||void 0===e||null===(e=e.config)||void 0===e||null===(e=e.questions_api_init_options)||void 0===e||null===(e=e.labelBundle)||void 0===e?void 0:e.wordLength)){var i=t.getQuestion().response_id,n=document.getElementById(i).querySelector(".lrn_word_limit"),s=n.textContent.replace("Word","Character");n.textContent=s}}(a),w.isResuming()&&ot(a)})),a.on("changed",(function(){ot(a)}))}},i=0,n=Object.entries(t);i1&&void 0!==arguments[1])||arguments[1],r=t.getQuestion().type,a=t.getQuestion().max_length,o=null!==(e=t.getResponse())&&void 0!==e&&e.value?null===(i=t.getResponse())||void 0===i?void 0:i.value:"",l=!0;return n="plaintext"===r?(rt.includeSpaces?o:dt(o)).length:function(t,e=W.Legacy){return J(t,e)}(rt.includeSpaces?ct(o):dt(ct(o))).length,a&&n>a&&(l=!1),s&&function(t,e,i){var n=t.getQuestion().response_id,s=document.getElementById(n),r=s.querySelector(".lrn_texteditor_editable"),a=s.querySelector(".lrn_word_count"),o=s.querySelector(".lrn_length_indicator"),l="lrn_wordcount_warning_label",c="lrn_wordcount_warning",d=i;function h(){a.textContent=d,e?(r.classList.remove(c),o.classList.remove(l)):(r.classList.add(c),o.classList.add(l))}"plaintext"===t.getQuestion().type?(d=i+" /",setTimeout((function(){h()}),10)):h()}(t,l,n),l}function lt(t){var e=_.appInstance().getQuestions(),i=[];for(var n in e){var s;rt.validTypes.includes(e[n].type)&&(null!==(s=e[n])&&void 0!==s&&s.submit_over_limit||ot(T.questionInstance(n),!1)||i.push(n))}if(i.length){C.A.warn("Invalid essay response length found."),t.preventDefault(),t.stopPropagation();for(var r=[],a=0;a\n
    \n "),o=0;o').concat(r.question,"");a+="
",_.assessApp().on("button:btn_essay_character_limit_cancel:clicked",(function(){k.hideDialog()})),_.appInstance().on("test:panel:show",(function(){setTimeout((function(){var t=document.querySelectorAll(".essay-limit-character-item");t&&t.forEach((function(t){var e=t.getAttribute("data-item-reference");t.addEventListener("click",(function(){_.appInstance().items().goto(e),k.hideDialog()}))}))}),500)})),k.dialog({header:r.submitTest,body:a,buttons:[{button_id:"btn_essay_character_limit_cancel",label:r.decline,is_primary:!0}]})}(r)}else!function(){var t=document.getElementById("lrn_assess_next_btn");if(t)t.click();else{var e={show_submit_confirmation:!0,show_submit_ui:!0,success:function(t){C.A.info("Submit was successful",t)},error:function(t){C.A.error("Submit has failed",t)}};_.appInstance().submit(e)}}()}function ct(t){return t.replace(/<[^>]*>/g,"").trim()}function dt(t){return t.replace(/\s+/g,"")}var ht=i(7391),ut=i.n(ht);var pt=Math.floor,ft=Math.random;const gt=function(t,e){var i,n,s=-1,r=t.length,a=r-1;for(e=void 0===e?r:e;++s-1&&t%1==0&&t-1&&t%1==0&&t<=9007199254740991};var Ut={};Ut["[object Float32Array]"]=Ut["[object Float64Array]"]=Ut["[object Int8Array]"]=Ut["[object Int16Array]"]=Ut["[object Int32Array]"]=Ut["[object Uint8Array]"]=Ut["[object Uint8ClampedArray]"]=Ut["[object Uint16Array]"]=Ut["[object Uint32Array]"]=!0,Ut["[object Arguments]"]=Ut["[object Array]"]=Ut["[object ArrayBuffer]"]=Ut["[object Boolean]"]=Ut["[object DataView]"]=Ut["[object Date]"]=Ut["[object Error]"]=Ut["[object Function]"]=Ut["[object Map]"]=Ut["[object Number]"]=Ut["[object Object]"]=Ut["[object RegExp]"]=Ut["[object Set]"]=Ut["[object String]"]=Ut["[object WeakMap]"]=!1;var Vt="object"==typeof exports&&exports&&!exports.nodeType&&exports,Gt=Vt&&"object"==typeof module&&module&&!module.nodeType&&module,Wt=Gt&&Gt.exports===Vt&&bt.process,$t=function(){try{return Gt&&Gt.require&&Gt.require("util").types||Wt&&Wt.binding&&Wt.binding("util")}catch(t){}}(),Xt=$t&&$t.isTypedArray;const Kt=Xt?(Yt=Xt,function(t){return Yt(t)}):function(t){return Mt(t)&&jt(t.length)&&!!Ut[kt(t)]};var Yt,Qt=Object.prototype.hasOwnProperty;const Jt=function(t,e){var i=Ft(t),n=!i&&Dt(t),s=!i&&!n&&qt(t),r=!i&&!n&&!s&&Kt(t),a=i||n||s||r,o=a?function(t,e){for(var i=-1,n=Array(t);++i=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:s}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var r,a=!0,o=!1;return{s:function(){i=i.call(t)},n:function(){var t=i.next();return a=t.done,t},e:function(t){o=!0,r=t},f:function(){try{a||null==i.return||i.return()}finally{if(o)throw r}}}}function le(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=Array(e);i1}(t,e))if(function(t){return"validation"in t&&t.validation}(t))if(p=t.validation,Boolean(p.valid_response.value&&p.valid_response.value.length)){var n=[],s=function(t){return t.valid_response.value}(t.validation);Object.values(s).forEach((function(e){Object.values(t.options).forEach((function(t){e!==t.value&&n.push(t.value)}))}));for(var r=[],a=0;a0&&void 0!==arguments[0]?arguments[0]:{global:[{bindings:{chromeos:["ctrl+shift+v"],macos:["command+shift+v"],windows:["ctrl+shift+v"]},type:"item.flag"},{bindings:{chromeos:["ctrl+alt+0"],macos:["command+option+0"],windows:["ctrl+alt+0"]},type:"masking.enable"}],item:[{bindings:{chromeos:["ctrl+shift+1","ctrl+shift+2","ctrl+shift+3","ctrl+shift+4","ctrl+shift+5","ctrl+shift+6"],macos:["command+ctrl+1","command+ctrl+2","command+ctrl+3","command+ctrl+4","command+ctrl+5","command+ctrl+6"],windows:["ctrl+shift+1","ctrl+shift+2","ctrl+shift+3","ctrl+shift+4","ctrl+shift+5","ctrl+shift+6"]},restrictTo:["mcq"],type:"response.set"},{bindings:{chromeos:["ctrl+alt+1","ctrl+alt+2","ctrl+alt+3","ctrl+alt+4","ctrl+alt+5","ctrl+alt+6"],macos:["command+option+1","command+option+2","command+option+3","command+option+4","command+option+5","command+option+6"],windows:["ctrl+alt+1","ctrl+alt+2","ctrl+alt+3","ctrl+alt+4","ctrl+alt+5","ctrl+alt+6"]},type:"response.mask"}]},e=function(){var t;return pe.supportedPlatforms.forEach((function(e){he[e]&&(t=e)})),t}();pe.bindings=t,e&&(ue.prototype.stopCallback=function(t,e,i){var n=document.activeElement;return"radio"!==n.getAttribute("type")&&"checkbox"!==n.getAttribute("type")&&!((" "+e.className+" ").indexOf(" mousetrap ")>-1)&&("INPUT"==e.tagName||"SELECT"==e.tagName||"TEXTAREA"==e.tagName||e.contentEditable&&"true"==e.contentEditable)},pe.bindings.hasOwnProperty("global")&&Array.isArray(pe.bindings.global)&&pe.bindings.global.forEach((function(t){if(t.hasOwnProperty("type"))switch(t.type){case"item.flag":i=t.bindings[e],ue.bind(i,(function(t,e){D.flag()}));break;case"masking.enable":!function(t){T.questionInstance().isMaskable()&&ue.bind(t,(function(t){_.appInstance().questionsApp().masking(!D.isMaskingEnabled())}))}(t.bindings[e])}var i})),pe.bindings.hasOwnProperty("item")&&Array.isArray(pe.bindings.item)&&_.appInstance().on("item:load",(function(){pe.bindings.item.forEach((function(t){if(t.hasOwnProperty("type"))switch(t.type){case"response.mask":i=t.bindings[e],n=T.questions(),s=0,n.forEach((function(t){"mcq"===t.type&&s++})),1===s&&Object.values(n).forEach((function(t){"mcq"===t.type&&ue.bind(i,(function(e,i){if(D.isMaskingEnabled()){var n,s=Number(i.at(-1));if((null===(n=t.options)||void 0===n?void 0:n.length)>=s){var r=D.itemElement().querySelectorAll(".lrn-mcq-option")[s-1].querySelector(".lrn-mask");r&&r.click()}}}))}));break;case"response.set":!function(t){var e=T.questions(),i=0;e.forEach((function(t){"mcq"===t.type&&i++})),1===i&&Object.values(e).forEach((function(e){"mcq"===e.type&&ue.bind(t,(function(t){var i;(null===(i=e.options)||void 0===i?void 0:i.length)>=t.key&&document.getElementById("".concat(e.response_id)).querySelectorAll(".lrn-input")[t.key-1].click()}))}))}(t.bindings[e])}var i,n,s}))})))}var ge="ERROR",me={_initialised:!1,magnifier:null};function ve(t){me._initialised?C.A.debug("Magnifier already initialised, ignoring run();",ge):(t||(t={zoom:4,shape:"square",width:350,height:350}),me.magnifier=new _e(t),me._initialised=!0)}function be(){var t,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"lrn__magnifier";document.querySelectorAll(".".concat(e)).forEach((function(t){t.addEventListener("click",(function(){me.magnifier.toggle()}))})),_.appInstance().on("item:load",void((t=D.itemElement().querySelectorAll("img"))&&t.forEach((function(t){t.addEventListener("click",(function(t){me.magnifier.isVisible()||me.magnifier.show(t)}))}))))}function ye(){me.magnifier.toggle()}function _e(t){var e=this;e.options=Object.assign({zoom:2,shape:"square",width:200,height:200},t),window.MutationObserver||window.WebKitMutationObserver;var i,n,s,r,a,o,l=!1,c={};function d(t,e,i){t.style.left="".concat(e,"px"),t.style.top="".concat(i,"px")}function h(t,e,i){t.style.width="".concat(e,"px"),t.style.height="".concat(i,"px")}function u(){switch(e.options.shape){case"square":h(i,e.options.width,e.options.height);break;case"circle":h(i,e.options.width,e.options.height),i.style.borderRadius="50%"}n.style.WebkitTransform=n.style.MozTransform=n.style.OTransform=n.style.MsTransform=n.style.transform="scale(".concat(e.options.zoom,")")}function p(t,e){for(var i=e;null!=i;){if(i==t)return!0;i=i.parentNode}return!1}function f(){l&&(_(),b(),A())}function g(){l&&(window.clearTimeout(r),r=window.setTimeout(f,100))}function m(){l&&g()}function v(t,i){var n=c[t];if(n)for(var s=0;s0)for(var n=0;n0&&r.length===o.length)for(var l=0;l0&&e.push(n[s]);for(var r=0;r