officeparser 7.0.0 → 7.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +710 -539
- package/dist/OfficeConverter.d.ts +4 -3
- package/dist/OfficeConverter.js +4 -3
- package/dist/OfficeParser.d.ts +1 -1
- package/dist/OfficeParser.js +27 -10
- package/dist/officeparser.browser.d.ts +6 -3
- package/dist/officeparser.browser.iife.js +28 -28
- package/dist/officeparser.browser.mjs +28 -28
- package/dist/sbom.cdx.json +98 -98
- package/dist/types.d.ts +2 -0
- package/dist/types.js +2 -0
- package/dist/utils/envUtils.d.ts +8 -3
- package/dist/utils/envUtils.js +113 -84
- package/dist/utils/errorUtils.js +2 -1
- package/dist/utils/moduleLoader.js +4 -2
- package/package.json +2 -2
|
@@ -3,16 +3,16 @@
|
|
|
3
3
|
if (typeof setImmediate === 'undefined') {
|
|
4
4
|
window.setImmediate = function(callback) { return setTimeout(callback, 0); };
|
|
5
5
|
}
|
|
6
|
-
var rN=Object.create;var og=Object.defineProperty;var sN=Object.getOwnPropertyDescriptor;var aN=Object.getOwnPropertyNames;var oN=Object.getPrototypeOf,lN=Object.prototype.hasOwnProperty;var kA=r=>{throw TypeError(r)};var cN=(r,t,e)=>t in r?og(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e;var iu=(r=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(r,{get:(t,e)=>(typeof require<"u"?require:t)[e]}):r)(function(r){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+r+'" is not supported')});var ne=(r,t)=>()=>(r&&(t=r(r=0)),t);var Xt=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports),lg=(r,t)=>{for(var e in t)og(r,e,{get:t[e],enumerable:!0})},uN=(r,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of aN(t))!lN.call(r,i)&&i!==e&&og(r,i,{get:()=>t[i],enumerable:!(n=sN(t,i))||n.enumerable});return r};var ru=(r,t,e)=>(e=r!=null?rN(oN(r)):{},uN(t||!r||!r.__esModule?og(e,"default",{value:r,enumerable:!0}):e,r));var U=(r,t,e)=>cN(r,typeof t!="symbol"?t+"":t,e),bb=(r,t,e)=>t.has(r)||kA("Cannot "+e);var o=(r,t,e)=>(bb(r,t,"read from private field"),e?e.call(r):t.get(r)),A=(r,t,e)=>t.has(r)?kA("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(r):t.set(r,e),g=(r,t,e,n)=>(bb(r,t,"write to private field"),n?n.call(r,e):t.set(r,e),e),v=(r,t,e)=>(bb(r,t,"access private method"),e);var an=(r,t,e,n)=>({set _(i){g(r,t,i,e)},get _(){return o(r,t,n)}});var OA=Xt(cg=>{"use strict";B();cg.byteLength=dN;cg.toByteArray=pN;cg.fromByteArray=yN;var ts=[],nr=[],hN=typeof Uint8Array<"u"?Uint8Array:Array,xb="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(sl=0,_A=xb.length;sl<_A;++sl)ts[sl]=xb[sl],nr[xb.charCodeAt(sl)]=sl;var sl,_A;nr[45]=62;nr[95]=63;function MA(r){var t=r.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var e=r.indexOf("=");e===-1&&(e=t);var n=e===t?0:4-e%4;return[e,n]}function dN(r){var t=MA(r),e=t[0],n=t[1];return(e+n)*3/4-n}function fN(r,t,e){return(t+e)*3/4-e}function pN(r){var t,e=MA(r),n=e[0],i=e[1],s=new hN(fN(r,n,i)),a=0,l=i>0?n-4:n,c;for(c=0;c<l;c+=4)t=nr[r.charCodeAt(c)]<<18|nr[r.charCodeAt(c+1)]<<12|nr[r.charCodeAt(c+2)]<<6|nr[r.charCodeAt(c+3)],s[a++]=t>>16&255,s[a++]=t>>8&255,s[a++]=t&255;return i===2&&(t=nr[r.charCodeAt(c)]<<2|nr[r.charCodeAt(c+1)]>>4,s[a++]=t&255),i===1&&(t=nr[r.charCodeAt(c)]<<10|nr[r.charCodeAt(c+1)]<<4|nr[r.charCodeAt(c+2)]>>2,s[a++]=t>>8&255,s[a++]=t&255),s}function mN(r){return ts[r>>18&63]+ts[r>>12&63]+ts[r>>6&63]+ts[r&63]}function gN(r,t,e){for(var n,i=[],s=t;s<e;s+=3)n=(r[s]<<16&16711680)+(r[s+1]<<8&65280)+(r[s+2]&255),i.push(mN(n));return i.join("")}function yN(r){for(var t,e=r.length,n=e%3,i=[],s=16383,a=0,l=e-n;a<l;a+=s)i.push(gN(r,a,a+s>l?l:a+s));return n===1?(t=r[e-1],i.push(ts[t>>2]+ts[t<<4&63]+"==")):n===2&&(t=(r[e-2]<<8)+r[e-1],i.push(ts[t>>10]+ts[t>>4&63]+ts[t<<2&63]+"=")),i.join("")}});var Ab=Xt(wb=>{B();wb.read=function(r,t,e,n,i){var s,a,l=i*8-n-1,c=(1<<l)-1,u=c>>1,h=-7,d=e?i-1:0,f=e?-1:1,p=r[t+d];for(d+=f,s=p&(1<<-h)-1,p>>=-h,h+=l;h>0;s=s*256+r[t+d],d+=f,h-=8);for(a=s&(1<<-h)-1,s>>=-h,h+=n;h>0;a=a*256+r[t+d],d+=f,h-=8);if(s===0)s=1-u;else{if(s===c)return a?NaN:(p?-1:1)*(1/0);a=a+Math.pow(2,n),s=s-u}return(p?-1:1)*a*Math.pow(2,s-n)};wb.write=function(r,t,e,n,i,s){var a,l,c,u=s*8-i-1,h=(1<<u)-1,d=h>>1,f=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:s-1,m=n?1:-1,y=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(l=isNaN(t)?1:0,a=h):(a=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-a))<1&&(a--,c*=2),a+d>=1?t+=f/c:t+=f*Math.pow(2,1-d),t*c>=2&&(a++,c/=2),a+d>=h?(l=0,a=h):a+d>=1?(l=(t*c-1)*Math.pow(2,i),a=a+d):(l=t*Math.pow(2,d-1)*Math.pow(2,i),a=0));i>=8;r[e+p]=l&255,p+=m,l/=256,i-=8);for(a=a<<i|l,u+=i;u>0;r[e+p]=a&255,p+=m,a/=256,u-=8);r[e+p-m]|=y*128}});var KA=Xt(lu=>{"use strict";B();var vb=OA(),au=Ab(),FA=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;lu.Buffer=it;lu.SlowBuffer=CN;lu.INSPECT_MAX_BYTES=50;var ug=2147483647;lu.kMaxLength=ug;it.TYPED_ARRAY_SUPPORT=bN();!it.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function bN(){try{let r=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(r,t),r.foo()===42}catch{return!1}}Object.defineProperty(it.prototype,"parent",{enumerable:!0,get:function(){if(it.isBuffer(this))return this.buffer}});Object.defineProperty(it.prototype,"offset",{enumerable:!0,get:function(){if(it.isBuffer(this))return this.byteOffset}});function zs(r){if(r>ug)throw new RangeError('The value "'+r+'" is invalid for option "size"');let t=new Uint8Array(r);return Object.setPrototypeOf(t,it.prototype),t}function it(r,t,e){if(typeof r=="number"){if(typeof t=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return Sb(r)}return BA(r,t,e)}it.poolSize=8192;function BA(r,t,e){if(typeof r=="string")return wN(r,t);if(ArrayBuffer.isView(r))return AN(r);if(r==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof r);if(es(r,ArrayBuffer)||r&&es(r.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(es(r,SharedArrayBuffer)||r&&es(r.buffer,SharedArrayBuffer)))return Eb(r,t,e);if(typeof r=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let n=r.valueOf&&r.valueOf();if(n!=null&&n!==r)return it.from(n,t,e);let i=vN(r);if(i)return i;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof r[Symbol.toPrimitive]=="function")return it.from(r[Symbol.toPrimitive]("string"),t,e);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof r)}it.from=function(r,t,e){return BA(r,t,e)};Object.setPrototypeOf(it.prototype,Uint8Array.prototype);Object.setPrototypeOf(it,Uint8Array);function UA(r){if(typeof r!="number")throw new TypeError('"size" argument must be of type number');if(r<0)throw new RangeError('The value "'+r+'" is invalid for option "size"')}function xN(r,t,e){return UA(r),r<=0?zs(r):t!==void 0?typeof e=="string"?zs(r).fill(t,e):zs(r).fill(t):zs(r)}it.alloc=function(r,t,e){return xN(r,t,e)};function Sb(r){return UA(r),zs(r<0?0:Db(r)|0)}it.allocUnsafe=function(r){return Sb(r)};it.allocUnsafeSlow=function(r){return Sb(r)};function wN(r,t){if((typeof t!="string"||t==="")&&(t="utf8"),!it.isEncoding(t))throw new TypeError("Unknown encoding: "+t);let e=$A(r,t)|0,n=zs(e),i=n.write(r,t);return i!==e&&(n=n.slice(0,i)),n}function Cb(r){let t=r.length<0?0:Db(r.length)|0,e=zs(t);for(let n=0;n<t;n+=1)e[n]=r[n]&255;return e}function AN(r){if(es(r,Uint8Array)){let t=new Uint8Array(r);return Eb(t.buffer,t.byteOffset,t.byteLength)}return Cb(r)}function Eb(r,t,e){if(t<0||r.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(r.byteLength<t+(e||0))throw new RangeError('"length" is outside of buffer bounds');let n;return t===void 0&&e===void 0?n=new Uint8Array(r):e===void 0?n=new Uint8Array(r,t):n=new Uint8Array(r,t,e),Object.setPrototypeOf(n,it.prototype),n}function vN(r){if(it.isBuffer(r)){let t=Db(r.length)|0,e=zs(t);return e.length===0||r.copy(e,0,0,t),e}if(r.length!==void 0)return typeof r.length!="number"||Ib(r.length)?zs(0):Cb(r);if(r.type==="Buffer"&&Array.isArray(r.data))return Cb(r.data)}function Db(r){if(r>=ug)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+ug.toString(16)+" bytes");return r|0}function CN(r){return+r!=r&&(r=0),it.alloc(+r)}it.isBuffer=function(t){return t!=null&&t._isBuffer===!0&&t!==it.prototype};it.compare=function(t,e){if(es(t,Uint8Array)&&(t=it.from(t,t.offset,t.byteLength)),es(e,Uint8Array)&&(e=it.from(e,e.offset,e.byteLength)),!it.isBuffer(t)||!it.isBuffer(e))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===e)return 0;let n=t.length,i=e.length;for(let s=0,a=Math.min(n,i);s<a;++s)if(t[s]!==e[s]){n=t[s],i=e[s];break}return n<i?-1:i<n?1:0};it.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}};it.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(t.length===0)return it.alloc(0);let n;if(e===void 0)for(e=0,n=0;n<t.length;++n)e+=t[n].length;let i=it.allocUnsafe(e),s=0;for(n=0;n<t.length;++n){let a=t[n];if(es(a,Uint8Array))s+a.length>i.length?(it.isBuffer(a)||(a=it.from(a)),a.copy(i,s)):Uint8Array.prototype.set.call(i,a,s);else if(it.isBuffer(a))a.copy(i,s);else throw new TypeError('"list" argument must be an Array of Buffers');s+=a.length}return i};function $A(r,t){if(it.isBuffer(r))return r.length;if(ArrayBuffer.isView(r)||es(r,ArrayBuffer))return r.byteLength;if(typeof r!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof r);let e=r.length,n=arguments.length>2&&arguments[2]===!0;if(!n&&e===0)return 0;let i=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return e;case"utf8":case"utf-8":return Tb(r).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return e*2;case"hex":return e>>>1;case"base64":return YA(r).length;default:if(i)return n?-1:Tb(r).length;t=(""+t).toLowerCase(),i=!0}}it.byteLength=$A;function EN(r,t,e){let n=!1;if((t===void 0||t<0)&&(t=0),t>this.length||((e===void 0||e>this.length)&&(e=this.length),e<=0)||(e>>>=0,t>>>=0,e<=t))return"";for(r||(r="utf8");;)switch(r){case"hex":return FN(this,t,e);case"utf8":case"utf-8":return jA(this,t,e);case"ascii":return MN(this,t,e);case"latin1":case"binary":return ON(this,t,e);case"base64":return kN(this,t,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return PN(this,t,e);default:if(n)throw new TypeError("Unknown encoding: "+r);r=(r+"").toLowerCase(),n=!0}}it.prototype._isBuffer=!0;function al(r,t,e){let n=r[t];r[t]=r[e],r[e]=n}it.prototype.swap16=function(){let t=this.length;if(t%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let e=0;e<t;e+=2)al(this,e,e+1);return this};it.prototype.swap32=function(){let t=this.length;if(t%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let e=0;e<t;e+=4)al(this,e,e+3),al(this,e+1,e+2);return this};it.prototype.swap64=function(){let t=this.length;if(t%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let e=0;e<t;e+=8)al(this,e,e+7),al(this,e+1,e+6),al(this,e+2,e+5),al(this,e+3,e+4);return this};it.prototype.toString=function(){let t=this.length;return t===0?"":arguments.length===0?jA(this,0,t):EN.apply(this,arguments)};it.prototype.toLocaleString=it.prototype.toString;it.prototype.equals=function(t){if(!it.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t?!0:it.compare(this,t)===0};it.prototype.inspect=function(){let t="",e=lu.INSPECT_MAX_BYTES;return t=this.toString("hex",0,e).replace(/(.{2})/g,"$1 ").trim(),this.length>e&&(t+=" ... "),"<Buffer "+t+">"};FA&&(it.prototype[FA]=it.prototype.inspect);it.prototype.compare=function(t,e,n,i,s){if(es(t,Uint8Array)&&(t=it.from(t,t.offset,t.byteLength)),!it.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(e===void 0&&(e=0),n===void 0&&(n=t?t.length:0),i===void 0&&(i=0),s===void 0&&(s=this.length),e<0||n>t.length||i<0||s>this.length)throw new RangeError("out of range index");if(i>=s&&e>=n)return 0;if(i>=s)return-1;if(e>=n)return 1;if(e>>>=0,n>>>=0,i>>>=0,s>>>=0,this===t)return 0;let a=s-i,l=n-e,c=Math.min(a,l),u=this.slice(i,s),h=t.slice(e,n);for(let d=0;d<c;++d)if(u[d]!==h[d]){a=u[d],l=h[d];break}return a<l?-1:l<a?1:0};function zA(r,t,e,n,i){if(r.length===0)return-1;if(typeof e=="string"?(n=e,e=0):e>2147483647?e=2147483647:e<-2147483648&&(e=-2147483648),e=+e,Ib(e)&&(e=i?0:r.length-1),e<0&&(e=r.length+e),e>=r.length){if(i)return-1;e=r.length-1}else if(e<0)if(i)e=0;else return-1;if(typeof t=="string"&&(t=it.from(t,n)),it.isBuffer(t))return t.length===0?-1:PA(r,t,e,n,i);if(typeof t=="number")return t=t&255,typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(r,t,e):Uint8Array.prototype.lastIndexOf.call(r,t,e):PA(r,[t],e,n,i);throw new TypeError("val must be string, number or Buffer")}function PA(r,t,e,n,i){let s=1,a=r.length,l=t.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(r.length<2||t.length<2)return-1;s=2,a/=2,l/=2,e/=2}function c(h,d){return s===1?h[d]:h.readUInt16BE(d*s)}let u;if(i){let h=-1;for(u=e;u<a;u++)if(c(r,u)===c(t,h===-1?0:u-h)){if(h===-1&&(h=u),u-h+1===l)return h*s}else h!==-1&&(u-=u-h),h=-1}else for(e+l>a&&(e=a-l),u=e;u>=0;u--){let h=!0;for(let d=0;d<l;d++)if(c(r,u+d)!==c(t,d)){h=!1;break}if(h)return u}return-1}it.prototype.includes=function(t,e,n){return this.indexOf(t,e,n)!==-1};it.prototype.indexOf=function(t,e,n){return zA(this,t,e,n,!0)};it.prototype.lastIndexOf=function(t,e,n){return zA(this,t,e,n,!1)};function TN(r,t,e,n){e=Number(e)||0;let i=r.length-e;n?(n=Number(n),n>i&&(n=i)):n=i;let s=t.length;n>s/2&&(n=s/2);let a;for(a=0;a<n;++a){let l=parseInt(t.substr(a*2,2),16);if(Ib(l))return a;r[e+a]=l}return a}function SN(r,t,e,n){return hg(Tb(t,r.length-e),r,e,n)}function DN(r,t,e,n){return hg(UN(t),r,e,n)}function NN(r,t,e,n){return hg(YA(t),r,e,n)}function IN(r,t,e,n){return hg($N(t,r.length-e),r,e,n)}it.prototype.write=function(t,e,n,i){if(e===void 0)i="utf8",n=this.length,e=0;else if(n===void 0&&typeof e=="string")i=e,n=this.length,e=0;else if(isFinite(e))e=e>>>0,isFinite(n)?(n=n>>>0,i===void 0&&(i="utf8")):(i=n,n=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let s=this.length-e;if((n===void 0||n>s)&&(n=s),t.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");let a=!1;for(;;)switch(i){case"hex":return TN(this,t,e,n);case"utf8":case"utf-8":return SN(this,t,e,n);case"ascii":case"latin1":case"binary":return DN(this,t,e,n);case"base64":return NN(this,t,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return IN(this,t,e,n);default:if(a)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),a=!0}};it.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function kN(r,t,e){return t===0&&e===r.length?vb.fromByteArray(r):vb.fromByteArray(r.slice(t,e))}function jA(r,t,e){e=Math.min(r.length,e);let n=[],i=t;for(;i<e;){let s=r[i],a=null,l=s>239?4:s>223?3:s>191?2:1;if(i+l<=e){let c,u,h,d;switch(l){case 1:s<128&&(a=s);break;case 2:c=r[i+1],(c&192)===128&&(d=(s&31)<<6|c&63,d>127&&(a=d));break;case 3:c=r[i+1],u=r[i+2],(c&192)===128&&(u&192)===128&&(d=(s&15)<<12|(c&63)<<6|u&63,d>2047&&(d<55296||d>57343)&&(a=d));break;case 4:c=r[i+1],u=r[i+2],h=r[i+3],(c&192)===128&&(u&192)===128&&(h&192)===128&&(d=(s&15)<<18|(c&63)<<12|(u&63)<<6|h&63,d>65535&&d<1114112&&(a=d))}}a===null?(a=65533,l=1):a>65535&&(a-=65536,n.push(a>>>10&1023|55296),a=56320|a&1023),n.push(a),i+=l}return _N(n)}var RA=4096;function _N(r){let t=r.length;if(t<=RA)return String.fromCharCode.apply(String,r);let e="",n=0;for(;n<t;)e+=String.fromCharCode.apply(String,r.slice(n,n+=RA));return e}function MN(r,t,e){let n="";e=Math.min(r.length,e);for(let i=t;i<e;++i)n+=String.fromCharCode(r[i]&127);return n}function ON(r,t,e){let n="";e=Math.min(r.length,e);for(let i=t;i<e;++i)n+=String.fromCharCode(r[i]);return n}function FN(r,t,e){let n=r.length;(!t||t<0)&&(t=0),(!e||e<0||e>n)&&(e=n);let i="";for(let s=t;s<e;++s)i+=zN[r[s]];return i}function PN(r,t,e){let n=r.slice(t,e),i="";for(let s=0;s<n.length-1;s+=2)i+=String.fromCharCode(n[s]+n[s+1]*256);return i}it.prototype.slice=function(t,e){let n=this.length;t=~~t,e=e===void 0?n:~~e,t<0?(t+=n,t<0&&(t=0)):t>n&&(t=n),e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),e<t&&(e=t);let i=this.subarray(t,e);return Object.setPrototypeOf(i,it.prototype),i};function xn(r,t,e){if(r%1!==0||r<0)throw new RangeError("offset is not uint");if(r+t>e)throw new RangeError("Trying to access beyond buffer length")}it.prototype.readUintLE=it.prototype.readUIntLE=function(t,e,n){t=t>>>0,e=e>>>0,n||xn(t,e,this.length);let i=this[t],s=1,a=0;for(;++a<e&&(s*=256);)i+=this[t+a]*s;return i};it.prototype.readUintBE=it.prototype.readUIntBE=function(t,e,n){t=t>>>0,e=e>>>0,n||xn(t,e,this.length);let i=this[t+--e],s=1;for(;e>0&&(s*=256);)i+=this[t+--e]*s;return i};it.prototype.readUint8=it.prototype.readUInt8=function(t,e){return t=t>>>0,e||xn(t,1,this.length),this[t]};it.prototype.readUint16LE=it.prototype.readUInt16LE=function(t,e){return t=t>>>0,e||xn(t,2,this.length),this[t]|this[t+1]<<8};it.prototype.readUint16BE=it.prototype.readUInt16BE=function(t,e){return t=t>>>0,e||xn(t,2,this.length),this[t]<<8|this[t+1]};it.prototype.readUint32LE=it.prototype.readUInt32LE=function(t,e){return t=t>>>0,e||xn(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+this[t+3]*16777216};it.prototype.readUint32BE=it.prototype.readUInt32BE=function(t,e){return t=t>>>0,e||xn(t,4,this.length),this[t]*16777216+(this[t+1]<<16|this[t+2]<<8|this[t+3])};it.prototype.readBigUInt64LE=Xa(function(t){t=t>>>0,ou(t,"offset");let e=this[t],n=this[t+7];(e===void 0||n===void 0)&&Ud(t,this.length-8);let i=e+this[++t]*2**8+this[++t]*2**16+this[++t]*2**24,s=this[++t]+this[++t]*2**8+this[++t]*2**16+n*2**24;return BigInt(i)+(BigInt(s)<<BigInt(32))});it.prototype.readBigUInt64BE=Xa(function(t){t=t>>>0,ou(t,"offset");let e=this[t],n=this[t+7];(e===void 0||n===void 0)&&Ud(t,this.length-8);let i=e*2**24+this[++t]*2**16+this[++t]*2**8+this[++t],s=this[++t]*2**24+this[++t]*2**16+this[++t]*2**8+n;return(BigInt(i)<<BigInt(32))+BigInt(s)});it.prototype.readIntLE=function(t,e,n){t=t>>>0,e=e>>>0,n||xn(t,e,this.length);let i=this[t],s=1,a=0;for(;++a<e&&(s*=256);)i+=this[t+a]*s;return s*=128,i>=s&&(i-=Math.pow(2,8*e)),i};it.prototype.readIntBE=function(t,e,n){t=t>>>0,e=e>>>0,n||xn(t,e,this.length);let i=e,s=1,a=this[t+--i];for(;i>0&&(s*=256);)a+=this[t+--i]*s;return s*=128,a>=s&&(a-=Math.pow(2,8*e)),a};it.prototype.readInt8=function(t,e){return t=t>>>0,e||xn(t,1,this.length),this[t]&128?(255-this[t]+1)*-1:this[t]};it.prototype.readInt16LE=function(t,e){t=t>>>0,e||xn(t,2,this.length);let n=this[t]|this[t+1]<<8;return n&32768?n|4294901760:n};it.prototype.readInt16BE=function(t,e){t=t>>>0,e||xn(t,2,this.length);let n=this[t+1]|this[t]<<8;return n&32768?n|4294901760:n};it.prototype.readInt32LE=function(t,e){return t=t>>>0,e||xn(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24};it.prototype.readInt32BE=function(t,e){return t=t>>>0,e||xn(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]};it.prototype.readBigInt64LE=Xa(function(t){t=t>>>0,ou(t,"offset");let e=this[t],n=this[t+7];(e===void 0||n===void 0)&&Ud(t,this.length-8);let i=this[t+4]+this[t+5]*2**8+this[t+6]*2**16+(n<<24);return(BigInt(i)<<BigInt(32))+BigInt(e+this[++t]*2**8+this[++t]*2**16+this[++t]*2**24)});it.prototype.readBigInt64BE=Xa(function(t){t=t>>>0,ou(t,"offset");let e=this[t],n=this[t+7];(e===void 0||n===void 0)&&Ud(t,this.length-8);let i=(e<<24)+this[++t]*2**16+this[++t]*2**8+this[++t];return(BigInt(i)<<BigInt(32))+BigInt(this[++t]*2**24+this[++t]*2**16+this[++t]*2**8+n)});it.prototype.readFloatLE=function(t,e){return t=t>>>0,e||xn(t,4,this.length),au.read(this,t,!0,23,4)};it.prototype.readFloatBE=function(t,e){return t=t>>>0,e||xn(t,4,this.length),au.read(this,t,!1,23,4)};it.prototype.readDoubleLE=function(t,e){return t=t>>>0,e||xn(t,8,this.length),au.read(this,t,!0,52,8)};it.prototype.readDoubleBE=function(t,e){return t=t>>>0,e||xn(t,8,this.length),au.read(this,t,!1,52,8)};function di(r,t,e,n,i,s){if(!it.isBuffer(r))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<s)throw new RangeError('"value" argument is out of bounds');if(e+n>r.length)throw new RangeError("Index out of range")}it.prototype.writeUintLE=it.prototype.writeUIntLE=function(t,e,n,i){if(t=+t,e=e>>>0,n=n>>>0,!i){let l=Math.pow(2,8*n)-1;di(this,t,e,n,l,0)}let s=1,a=0;for(this[e]=t&255;++a<n&&(s*=256);)this[e+a]=t/s&255;return e+n};it.prototype.writeUintBE=it.prototype.writeUIntBE=function(t,e,n,i){if(t=+t,e=e>>>0,n=n>>>0,!i){let l=Math.pow(2,8*n)-1;di(this,t,e,n,l,0)}let s=n-1,a=1;for(this[e+s]=t&255;--s>=0&&(a*=256);)this[e+s]=t/a&255;return e+n};it.prototype.writeUint8=it.prototype.writeUInt8=function(t,e,n){return t=+t,e=e>>>0,n||di(this,t,e,1,255,0),this[e]=t&255,e+1};it.prototype.writeUint16LE=it.prototype.writeUInt16LE=function(t,e,n){return t=+t,e=e>>>0,n||di(this,t,e,2,65535,0),this[e]=t&255,this[e+1]=t>>>8,e+2};it.prototype.writeUint16BE=it.prototype.writeUInt16BE=function(t,e,n){return t=+t,e=e>>>0,n||di(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=t&255,e+2};it.prototype.writeUint32LE=it.prototype.writeUInt32LE=function(t,e,n){return t=+t,e=e>>>0,n||di(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=t&255,e+4};it.prototype.writeUint32BE=it.prototype.writeUInt32BE=function(t,e,n){return t=+t,e=e>>>0,n||di(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=t&255,e+4};function GA(r,t,e,n,i){XA(t,n,i,r,e,7);let s=Number(t&BigInt(4294967295));r[e++]=s,s=s>>8,r[e++]=s,s=s>>8,r[e++]=s,s=s>>8,r[e++]=s;let a=Number(t>>BigInt(32)&BigInt(4294967295));return r[e++]=a,a=a>>8,r[e++]=a,a=a>>8,r[e++]=a,a=a>>8,r[e++]=a,e}function HA(r,t,e,n,i){XA(t,n,i,r,e,7);let s=Number(t&BigInt(4294967295));r[e+7]=s,s=s>>8,r[e+6]=s,s=s>>8,r[e+5]=s,s=s>>8,r[e+4]=s;let a=Number(t>>BigInt(32)&BigInt(4294967295));return r[e+3]=a,a=a>>8,r[e+2]=a,a=a>>8,r[e+1]=a,a=a>>8,r[e]=a,e+8}it.prototype.writeBigUInt64LE=Xa(function(t,e=0){return GA(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))});it.prototype.writeBigUInt64BE=Xa(function(t,e=0){return HA(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))});it.prototype.writeIntLE=function(t,e,n,i){if(t=+t,e=e>>>0,!i){let c=Math.pow(2,8*n-1);di(this,t,e,n,c-1,-c)}let s=0,a=1,l=0;for(this[e]=t&255;++s<n&&(a*=256);)t<0&&l===0&&this[e+s-1]!==0&&(l=1),this[e+s]=(t/a>>0)-l&255;return e+n};it.prototype.writeIntBE=function(t,e,n,i){if(t=+t,e=e>>>0,!i){let c=Math.pow(2,8*n-1);di(this,t,e,n,c-1,-c)}let s=n-1,a=1,l=0;for(this[e+s]=t&255;--s>=0&&(a*=256);)t<0&&l===0&&this[e+s+1]!==0&&(l=1),this[e+s]=(t/a>>0)-l&255;return e+n};it.prototype.writeInt8=function(t,e,n){return t=+t,e=e>>>0,n||di(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=t&255,e+1};it.prototype.writeInt16LE=function(t,e,n){return t=+t,e=e>>>0,n||di(this,t,e,2,32767,-32768),this[e]=t&255,this[e+1]=t>>>8,e+2};it.prototype.writeInt16BE=function(t,e,n){return t=+t,e=e>>>0,n||di(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=t&255,e+2};it.prototype.writeInt32LE=function(t,e,n){return t=+t,e=e>>>0,n||di(this,t,e,4,2147483647,-2147483648),this[e]=t&255,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4};it.prototype.writeInt32BE=function(t,e,n){return t=+t,e=e>>>0,n||di(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=t&255,e+4};it.prototype.writeBigInt64LE=Xa(function(t,e=0){return GA(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});it.prototype.writeBigInt64BE=Xa(function(t,e=0){return HA(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function WA(r,t,e,n,i,s){if(e+n>r.length)throw new RangeError("Index out of range");if(e<0)throw new RangeError("Index out of range")}function qA(r,t,e,n,i){return t=+t,e=e>>>0,i||WA(r,t,e,4,34028234663852886e22,-34028234663852886e22),au.write(r,t,e,n,23,4),e+4}it.prototype.writeFloatLE=function(t,e,n){return qA(this,t,e,!0,n)};it.prototype.writeFloatBE=function(t,e,n){return qA(this,t,e,!1,n)};function VA(r,t,e,n,i){return t=+t,e=e>>>0,i||WA(r,t,e,8,17976931348623157e292,-17976931348623157e292),au.write(r,t,e,n,52,8),e+8}it.prototype.writeDoubleLE=function(t,e,n){return VA(this,t,e,!0,n)};it.prototype.writeDoubleBE=function(t,e,n){return VA(this,t,e,!1,n)};it.prototype.copy=function(t,e,n,i){if(!it.isBuffer(t))throw new TypeError("argument should be a Buffer");if(n||(n=0),!i&&i!==0&&(i=this.length),e>=t.length&&(e=t.length),e||(e=0),i>0&&i<n&&(i=n),i===n||t.length===0||this.length===0)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),t.length-e<i-n&&(i=t.length-e+n);let s=i-n;return this===t&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(e,n,i):Uint8Array.prototype.set.call(t,this.subarray(n,i),e),s};it.prototype.fill=function(t,e,n,i){if(typeof t=="string"){if(typeof e=="string"?(i=e,e=0,n=this.length):typeof n=="string"&&(i=n,n=this.length),i!==void 0&&typeof i!="string")throw new TypeError("encoding must be a string");if(typeof i=="string"&&!it.isEncoding(i))throw new TypeError("Unknown encoding: "+i);if(t.length===1){let a=t.charCodeAt(0);(i==="utf8"&&a<128||i==="latin1")&&(t=a)}}else typeof t=="number"?t=t&255:typeof t=="boolean"&&(t=Number(t));if(e<0||this.length<e||this.length<n)throw new RangeError("Out of range index");if(n<=e)return this;e=e>>>0,n=n===void 0?this.length:n>>>0,t||(t=0);let s;if(typeof t=="number")for(s=e;s<n;++s)this[s]=t;else{let a=it.isBuffer(t)?t:it.from(t,i),l=a.length;if(l===0)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(s=0;s<n-e;++s)this[s+e]=a[s%l]}return this};var su={};function Nb(r,t,e){su[r]=class extends e{constructor(){super(),Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${r}]`,this.stack,delete this.name}get code(){return r}set code(i){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:i,writable:!0})}toString(){return`${this.name} [${r}]: ${this.message}`}}}Nb("ERR_BUFFER_OUT_OF_BOUNDS",function(r){return r?`${r} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError);Nb("ERR_INVALID_ARG_TYPE",function(r,t){return`The "${r}" argument must be of type number. Received type ${typeof t}`},TypeError);Nb("ERR_OUT_OF_RANGE",function(r,t,e){let n=`The value of "${r}" is out of range.`,i=e;return Number.isInteger(e)&&Math.abs(e)>2**32?i=LA(String(e)):typeof e=="bigint"&&(i=String(e),(e>BigInt(2)**BigInt(32)||e<-(BigInt(2)**BigInt(32)))&&(i=LA(i)),i+="n"),n+=` It must be ${t}. Received ${i}`,n},RangeError);function LA(r){let t="",e=r.length,n=r[0]==="-"?1:0;for(;e>=n+4;e-=3)t=`_${r.slice(e-3,e)}${t}`;return`${r.slice(0,e)}${t}`}function RN(r,t,e){ou(t,"offset"),(r[t]===void 0||r[t+e]===void 0)&&Ud(t,r.length-(e+1))}function XA(r,t,e,n,i,s){if(r>e||r<t){let a=typeof t=="bigint"?"n":"",l;throw s>3?t===0||t===BigInt(0)?l=`>= 0${a} and < 2${a} ** ${(s+1)*8}${a}`:l=`>= -(2${a} ** ${(s+1)*8-1}${a}) and < 2 ** ${(s+1)*8-1}${a}`:l=`>= ${t}${a} and <= ${e}${a}`,new su.ERR_OUT_OF_RANGE("value",l,r)}RN(n,i,s)}function ou(r,t){if(typeof r!="number")throw new su.ERR_INVALID_ARG_TYPE(t,"number",r)}function Ud(r,t,e){throw Math.floor(r)!==r?(ou(r,e),new su.ERR_OUT_OF_RANGE(e||"offset","an integer",r)):t<0?new su.ERR_BUFFER_OUT_OF_BOUNDS:new su.ERR_OUT_OF_RANGE(e||"offset",`>= ${e?1:0} and <= ${t}`,r)}var LN=/[^+/0-9A-Za-z-_]/g;function BN(r){if(r=r.split("=")[0],r=r.trim().replace(LN,""),r.length<2)return"";for(;r.length%4!==0;)r=r+"=";return r}function Tb(r,t){t=t||1/0;let e,n=r.length,i=null,s=[];for(let a=0;a<n;++a){if(e=r.charCodeAt(a),e>55295&&e<57344){if(!i){if(e>56319){(t-=3)>-1&&s.push(239,191,189);continue}else if(a+1===n){(t-=3)>-1&&s.push(239,191,189);continue}i=e;continue}if(e<56320){(t-=3)>-1&&s.push(239,191,189),i=e;continue}e=(i-55296<<10|e-56320)+65536}else i&&(t-=3)>-1&&s.push(239,191,189);if(i=null,e<128){if((t-=1)<0)break;s.push(e)}else if(e<2048){if((t-=2)<0)break;s.push(e>>6|192,e&63|128)}else if(e<65536){if((t-=3)<0)break;s.push(e>>12|224,e>>6&63|128,e&63|128)}else if(e<1114112){if((t-=4)<0)break;s.push(e>>18|240,e>>12&63|128,e>>6&63|128,e&63|128)}else throw new Error("Invalid code point")}return s}function UN(r){let t=[];for(let e=0;e<r.length;++e)t.push(r.charCodeAt(e)&255);return t}function $N(r,t){let e,n,i,s=[];for(let a=0;a<r.length&&!((t-=2)<0);++a)e=r.charCodeAt(a),n=e>>8,i=e%256,s.push(i),s.push(n);return s}function YA(r){return vb.toByteArray(BN(r))}function hg(r,t,e,n){let i;for(i=0;i<n&&!(i+e>=t.length||i>=r.length);++i)t[i+e]=r[i];return i}function es(r,t){return r instanceof t||r!=null&&r.constructor!=null&&r.constructor.name!=null&&r.constructor.name===t.name}function Ib(r){return r!==r}var zN=(function(){let r="0123456789abcdef",t=new Array(256);for(let e=0;e<16;++e){let n=e*16;for(let i=0;i<16;++i)t[n+i]=r[e]+r[i]}return t})();function Xa(r){return typeof BigInt>"u"?jN:r}function jN(){throw new Error("BigInt not supported")}});var ev=Xt((AF,tv)=>{B();var Ze=tv.exports={},ns,is;function kb(){throw new Error("setTimeout has not been defined")}function _b(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?ns=setTimeout:ns=kb}catch{ns=kb}try{typeof clearTimeout=="function"?is=clearTimeout:is=_b}catch{is=_b}})();function ZA(r){if(ns===setTimeout)return setTimeout(r,0);if((ns===kb||!ns)&&setTimeout)return ns=setTimeout,setTimeout(r,0);try{return ns(r,0)}catch{try{return ns.call(null,r,0)}catch{return ns.call(this,r,0)}}}function GN(r){if(is===clearTimeout)return clearTimeout(r);if((is===_b||!is)&&clearTimeout)return is=clearTimeout,clearTimeout(r);try{return is(r)}catch{try{return is.call(null,r)}catch{return is.call(this,r)}}}var js=[],cu=!1,ol,dg=-1;function HN(){!cu||!ol||(cu=!1,ol.length?js=ol.concat(js):dg=-1,js.length&&QA())}function QA(){if(!cu){var r=ZA(HN);cu=!0;for(var t=js.length;t;){for(ol=js,js=[];++dg<t;)ol&&ol[dg].run();dg=-1,t=js.length}ol=null,cu=!1,GN(r)}}Ze.nextTick=function(r){var t=new Array(arguments.length-1);if(arguments.length>1)for(var e=1;e<arguments.length;e++)t[e-1]=arguments[e];js.push(new JA(r,t)),js.length===1&&!cu&&ZA(QA)};function JA(r,t){this.fun=r,this.array=t}JA.prototype.run=function(){this.fun.apply(null,this.array)};Ze.title="browser";Ze.browser=!0;Ze.env={};Ze.argv=[];Ze.version="";Ze.versions={};function Gs(){}Ze.on=Gs;Ze.addListener=Gs;Ze.once=Gs;Ze.off=Gs;Ze.removeListener=Gs;Ze.removeAllListeners=Gs;Ze.emit=Gs;Ze.prependListener=Gs;Ze.prependOnceListener=Gs;Ze.listeners=function(r){return[]};Ze.binding=function(r){throw new Error("process.binding is not supported")};Ze.cwd=function(){return"/"};Ze.chdir=function(r){throw new Error("process.chdir is not supported")};Ze.umask=function(){return 0}});var ct,nt,Mb,B=ne(()=>{"use strict";ct=ru(KA()),nt=ru(ev()),Mb=[typeof globalThis<"u"?globalThis:null,typeof window<"u"?window:null,typeof self<"u"?self:null,typeof window<"u"?window:null].filter(Boolean);Mb.forEach(r=>{r.Buffer||(r.Buffer=ct.Buffer),r.process||(r.process=nt.default)});typeof nt.default<"u"&&!nt.default.env&&(nt.default.env={NODE_ENV:"production"});if(typeof Mb[0]<"u"){let r=Mb[0];r.util||(r.util={debuglog:()=>()=>{},inspect:t=>JSON.stringify(t)})}});var $v={};lg($v,{default:()=>SI,launch:()=>Uv});var Uv,SI,zv=ne(()=>{"use strict";B();Uv=()=>{throw new Error("officeparser: 'puppeteer.launch' is not supported in the browser. Browser-side PDF generation uses native print capabilities.")},SI={launch:Uv}});var cl=Xt(On=>{"use strict";B();function DI(r,t,e){if(e===void 0&&(e=Array.prototype),r&&typeof e.find=="function")return e.find.call(r,t);for(var n=0;n<r.length;n++)if(ll(r,n)){var i=r[n];if(t.call(void 0,i,n,r))return i}}function du(r,t){return t===void 0&&(t=Object),t&&typeof t.getOwnPropertyDescriptors=="function"&&(r=t.create(null,t.getOwnPropertyDescriptors(r))),t&&typeof t.freeze=="function"?t.freeze(r):r}function ll(r,t){return Object.prototype.hasOwnProperty.call(r,t)}function NI(r,t){if(r===null||typeof r!="object")throw new TypeError("target is not an object");for(var e in t)ll(t,e)&&(r[e]=t[e]);return r}var Gv=du({allowfullscreen:!0,async:!0,autofocus:!0,autoplay:!0,checked:!0,controls:!0,default:!0,defer:!0,disabled:!0,formnovalidate:!0,hidden:!0,ismap:!0,itemscope:!0,loop:!0,multiple:!0,muted:!0,nomodule:!0,novalidate:!0,open:!0,playsinline:!0,readonly:!0,required:!0,reversed:!0,selected:!0});function II(r){return ll(Gv,r.toLowerCase())}var Hv=du({area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function kI(r){return ll(Hv,r.toLowerCase())}var Wd=du({script:!1,style:!1,textarea:!0,title:!0});function _I(r){var t=r.toLowerCase();return ll(Wd,t)&&!Wd[t]}function MI(r){var t=r.toLowerCase();return ll(Wd,t)&&Wd[t]}function Wv(r){return r===qd.HTML}function OI(r){return Wv(r)||r===qd.XML_XHTML_APPLICATION}var qd=du({HTML:"text/html",XML_APPLICATION:"application/xml",XML_TEXT:"text/xml",XML_XHTML_APPLICATION:"application/xhtml+xml",XML_SVG_IMAGE:"image/svg+xml"}),FI=Object.keys(qd).map(function(r){return qd[r]});function PI(r){return FI.indexOf(r)>-1}var RI=du({HTML:"http://www.w3.org/1999/xhtml",SVG:"http://www.w3.org/2000/svg",XML:"http://www.w3.org/XML/1998/namespace",XMLNS:"http://www.w3.org/2000/xmlns/"});On.assign=NI;On.find=DI;On.freeze=du;On.HTML_BOOLEAN_ATTRIBUTES=Gv;On.HTML_RAW_TEXT_ELEMENTS=Wd;On.HTML_VOID_ELEMENTS=Hv;On.hasDefaultHTMLNamespace=OI;On.hasOwn=ll;On.isHTMLBooleanAttribute=II;On.isHTMLRawTextElement=_I;On.isHTMLEscapableRawTextElement=MI;On.isHTMLMimeType=Wv;On.isHTMLVoidElement=kI;On.isValidMimeType=PI;On.MIME_TYPE=qd;On.NAMESPACE=RI});var Zd=Xt(Kd=>{"use strict";B();var LI=cl();function Vv(r,t){r.prototype=Object.create(Error.prototype,{constructor:{value:r},name:{value:r.name,enumerable:!0,writable:t}})}var Xd=LI.freeze({Error:"Error",IndexSizeError:"IndexSizeError",DomstringSizeError:"DomstringSizeError",HierarchyRequestError:"HierarchyRequestError",WrongDocumentError:"WrongDocumentError",InvalidCharacterError:"InvalidCharacterError",NoDataAllowedError:"NoDataAllowedError",NoModificationAllowedError:"NoModificationAllowedError",NotFoundError:"NotFoundError",NotSupportedError:"NotSupportedError",InUseAttributeError:"InUseAttributeError",InvalidStateError:"InvalidStateError",SyntaxError:"SyntaxError",InvalidModificationError:"InvalidModificationError",NamespaceError:"NamespaceError",InvalidAccessError:"InvalidAccessError",ValidationError:"ValidationError",TypeMismatchError:"TypeMismatchError",SecurityError:"SecurityError",NetworkError:"NetworkError",AbortError:"AbortError",URLMismatchError:"URLMismatchError",QuotaExceededError:"QuotaExceededError",TimeoutError:"TimeoutError",InvalidNodeTypeError:"InvalidNodeTypeError",DataCloneError:"DataCloneError",EncodingError:"EncodingError",NotReadableError:"NotReadableError",UnknownError:"UnknownError",ConstraintError:"ConstraintError",DataError:"DataError",TransactionInactiveError:"TransactionInactiveError",ReadOnlyError:"ReadOnlyError",VersionError:"VersionError",OperationError:"OperationError",NotAllowedError:"NotAllowedError",OptOutError:"OptOutError"}),Xv=Object.keys(Xd);function Yv(r){return typeof r=="number"&&r>=1&&r<=25}function BI(r){return typeof r=="string"&&r.substring(r.length-Xd.Error.length)===Xd.Error}function Yd(r,t){Yv(r)?(this.name=Xv[r],this.message=t||""):(this.message=r,this.name=BI(t)?t:Xd.Error),Error.captureStackTrace&&Error.captureStackTrace(this,Yd)}Vv(Yd,!0);Object.defineProperties(Yd.prototype,{code:{enumerable:!0,get:function(){var r=Xv.indexOf(this.name);return Yv(r)?r:0}}});var Kv={INDEX_SIZE_ERR:1,DOMSTRING_SIZE_ERR:2,HIERARCHY_REQUEST_ERR:3,WRONG_DOCUMENT_ERR:4,INVALID_CHARACTER_ERR:5,NO_DATA_ALLOWED_ERR:6,NO_MODIFICATION_ALLOWED_ERR:7,NOT_FOUND_ERR:8,NOT_SUPPORTED_ERR:9,INUSE_ATTRIBUTE_ERR:10,INVALID_STATE_ERR:11,SYNTAX_ERR:12,INVALID_MODIFICATION_ERR:13,NAMESPACE_ERR:14,INVALID_ACCESS_ERR:15,VALIDATION_ERR:16,TYPE_MISMATCH_ERR:17,SECURITY_ERR:18,NETWORK_ERR:19,ABORT_ERR:20,URL_MISMATCH_ERR:21,QUOTA_EXCEEDED_ERR:22,TIMEOUT_ERR:23,INVALID_NODE_TYPE_ERR:24,DATA_CLONE_ERR:25},Vb=Object.entries(Kv);for(Vd=0;Vd<Vb.length;Vd++)qv=Vb[Vd][0],Yd[qv]=Vb[Vd][1];var qv,Vd;function Xb(r,t){this.message=r,this.locator=t,Error.captureStackTrace&&Error.captureStackTrace(this,Xb)}Vv(Xb);Kd.DOMException=Yd;Kd.DOMExceptionName=Xd;Kd.ExceptionCode=Kv;Kd.ParseError=Xb});var ex=Xt($t=>{"use strict";B();function iC(r){try{typeof r!="function"&&(r=RegExp);var t=new r("\u{1D306}","u").exec("\u{1D306}");return!!t&&t[0].length===2}catch{}return!1}var mu=iC();function Za(r){if(r.source[0]!=="[")throw new Error(r+" can not be used with chars");return r.source.slice(1,r.source.lastIndexOf("]"))}function fu(r,t){if(r.source[0]!=="[")throw new Error("/"+r.source+"/ can not be used with chars_without");if(!t||typeof t!="string")throw new Error(JSON.stringify(t)+" is not a valid search");if(r.source.indexOf(t)===-1)throw new Error('"'+t+'" is not is /'+r.source+"/");if(t==="-"&&r.source.indexOf(t)!==1)throw new Error('"'+t+'" is not at the first postion of /'+r.source+"/");return new RegExp(r.source.replace(t,""),mu?"u":"")}function qt(r){var t=this;return new RegExp(Array.prototype.slice.call(arguments).map(function(e){var n=typeof e=="string";if(n&&t===void 0&&e==="|")throw new Error("use regg instead of reg to wrap expressions with `|`!");return n?e:e.source}).join(""),mu?"mu":"m")}function Lt(r){if(arguments.length===0)throw new Error("no parameters provided");return qt.apply(Lt,["(?:"].concat(Array.prototype.slice.call(arguments),[")"]))}var UI="\uFFFD",Qa=/[-\x09\x0A\x0D\x20-\x2C\x2E-\uD7FF\uE000-\uFFFD]/;mu&&(Qa=qt("[",Za(Qa),"\\u{10000}-\\u{10FFFF}","]"));var $I=new RegExp("[^"+Za(Qa)+"]",mu?"u":""),Kb=/[\x20\x09\x0D\x0A]/,zI=Za(Kb),de=qt(Kb,"+"),Me=qt(Kb,"*"),Qd=/[:_a-zA-Z\xC0-\xD6\xD8-\xF6\xF8-\u02FF\u0370-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/;mu&&(Qd=qt("[",Za(Qd),"\\u{10000}-\\u{10FFFF}","]"));var jI=Za(Qd),Zb=qt("[",jI,Za(/[-.0-9\xB7]/),Za(/[\u0300-\u036F\u203F-\u2040]/),"]"),rr=qt(Qd,Zb,"*"),Zv=qt(Zb,"+"),GI=qt("&",rr,";"),HI=Lt(/&#[0-9]+;|&#x[0-9a-fA-F]+;/),Jd=Lt(GI,"|",HI),tf=qt("%",rr,";"),Qb=Lt(qt('"',Lt(/[^%&"]/,"|",tf,"|",Jd),"*",'"'),"|",qt("'",Lt(/[^%&']/,"|",tf,"|",Jd),"*","'")),WI=Lt('"',Lt(/[^<&"]/,"|",Jd),"*",'"',"|","'",Lt(/[^<&']/,"|",Jd),"*","'"),qI=fu(Qd,":"),VI=fu(Zb,":"),Qv=qt(qI,VI,"*"),ef=qt(Qv,Lt(":",Qv),"?"),XI=qt("^",ef,"$"),YI=qt("(",ef,")"),pu=Lt(/"[^"]*"|'[^']*'/),KI=qt(/^<\?/,"(",rr,")",Lt(de,"(",Qa,"*?)"),"?",/\?>/),Jv=/[\x20\x0D\x0Aa-zA-Z0-9-'()+,./:=?;!*#@$_%]/,nf=Lt('"',Jv,'*"',"|","'",fu(Jv,"'"),"*'"),rC="<!--",sC="-->",ZI=qt(rC,Lt(fu(Qa,"-"),"|",qt("-",fu(Qa,"-"))),"*",sC),tC="#PCDATA",QI=Lt(qt(/\(/,Me,tC,Lt(Me,/\|/,Me,ef),"*",Me,/\)\*/),"|",qt(/\(/,Me,tC,Me,/\)/)),JI=/[?*+]?/,tk=qt(/\([^>]+\)/,JI),ek=Lt("EMPTY","|","ANY","|",QI,"|",tk),nk="<!ELEMENT",ik=qt(nk,de,Lt(ef,"|",tf),de,Lt(ek,"|",tf),Me,">"),rk=qt("NOTATION",de,/\(/,Me,rr,Lt(Me,/\|/,Me,rr),"*",Me,/\)/),sk=qt(/\(/,Me,Zv,Lt(Me,/\|/,Me,Zv),"*",Me,/\)/),ak=Lt(rk,"|",sk),ok=Lt(/CDATA|ID|IDREF|IDREFS|ENTITY|ENTITIES|NMTOKEN|NMTOKENS/,"|",ak),lk=Lt(/#REQUIRED|#IMPLIED/,"|",Lt(Lt("#FIXED",de),"?",WI)),ck=Lt(de,rr,de,ok,de,lk),uk="<!ATTLIST",hk=qt(uk,de,rr,ck,"*",Me,">"),Yb="about:legacy-compat",dk=Lt('"'+Yb+'"',"|","'"+Yb+"'"),Jb="SYSTEM",_g="PUBLIC",Mg=Lt(Lt(Jb,de,pu),"|",Lt(_g,de,nf,de,pu)),fk=qt("^",Lt(Lt(Jb,de,"(?<SystemLiteralOnly>",pu,")"),"|",Lt(_g,de,"(?<PubidLiteral>",nf,")",de,"(?<SystemLiteral>",pu,")"))),pk=qt("^",nf,"$"),mk=qt("^",pu,"$"),gk=Lt(de,"NDATA",de,rr),yk=Lt(Qb,"|",Lt(Mg,gk,"?")),aC="<!ENTITY",bk=qt(aC,de,rr,de,yk,Me,">"),xk=Lt(Qb,"|",Mg),wk=qt(aC,de,"%",de,rr,de,xk,Me,">"),Ak=Lt(bk,"|",wk),vk=qt(_g,de,nf),Ck=qt("<!NOTATION",de,rr,de,Lt(Mg,"|",vk),Me,">"),tx=qt(Me,"=",Me),eC=/1[.]\d+/,Ek=qt(de,"version",tx,Lt("'",eC,"'","|",'"',eC,'"')),nC=/[A-Za-z][-A-Za-z0-9._]*/,Tk=Lt(de,"encoding",tx,Lt('"',nC,'"',"|","'",nC,"'")),Sk=Lt(de,"standalone",tx,Lt("'",Lt("yes","|","no"),"'","|",'"',Lt("yes","|","no"),'"')),Dk=qt(/^<\?xml/,Ek,Tk,"?",Sk,"?",Me,/\?>/),Nk="<!DOCTYPE",Ik="<![CDATA[",kk="]]>",_k=/<!\[CDATA\[/,Mk=/\]\]>/,Ok=qt(Qa,"*?",Mk),Fk=qt(_k,Ok);$t.chars=Za;$t.chars_without=fu;$t.detectUnicodeSupport=iC;$t.reg=qt;$t.regg=Lt;$t.ABOUT_LEGACY_COMPAT=Yb;$t.ABOUT_LEGACY_COMPAT_SystemLiteral=dk;$t.AttlistDecl=hk;$t.CDATA_START=Ik;$t.CDATA_END=kk;$t.CDSect=Fk;$t.Char=Qa;$t.Comment=ZI;$t.COMMENT_START=rC;$t.COMMENT_END=sC;$t.DOCTYPE_DECL_START=Nk;$t.elementdecl=ik;$t.EntityDecl=Ak;$t.EntityValue=Qb;$t.ExternalID=Mg;$t.ExternalID_match=fk;$t.Name=rr;$t.NotationDecl=Ck;$t.Reference=Jd;$t.PEReference=tf;$t.PI=KI;$t.PUBLIC=_g;$t.PubidLiteral=nf;$t.PubidLiteral_match=pk;$t.QName=ef;$t.QName_exact=XI;$t.QName_group=YI;$t.S=de;$t.SChar_s=zI;$t.S_OPT=Me;$t.SYSTEM=Jb;$t.SystemLiteral=pu;$t.SystemLiteral_match=mk;$t.InvalidChar=$I;$t.UNICODE_REPLACEMENT_CHARACTER=UI;$t.UNICODE_SUPPORT=mu;$t.XMLDecl=Dk});var cx=Xt(je=>{"use strict";B();var or=cl(),as=or.find,Pk=or.hasDefaultHTMLNamespace,yu=or.hasOwn,Rk=or.isHTMLMimeType,Lk=or.isHTMLRawTextElement,Bk=or.isHTMLVoidElement,rf=or.MIME_TYPE,os=or.NAMESPACE,ni=Symbol(),fC=Zd(),It=fC.DOMException,sr=fC.DOMExceptionName,Fn=ex();function pi(r){if(r!==ni)throw new TypeError("Illegal constructor")}function Uk(r){return r!==""}function $k(r){return r?r.split(/[\t\n\f\r ]+/).filter(Uk):[]}function zk(r,t){return yu(r,t)||(r[t]=!0),r}function oC(r){if(!r)return[];var t=$k(r);return Object.keys(t.reduce(zk,{}))}function jk(r){return function(t){return r&&r.indexOf(t)!==-1}}function pC(r){if(!Fn.QName_exact.test(r))throw new It(It.INVALID_CHARACTER_ERR,'invalid character in qualified name "'+r+'"')}function ix(r,t){pC(t),r=r||null;var e=null,n=t;if(t.indexOf(":")>=0){var i=t.split(":");e=i[0],n=i[1]}if(e!==null&&r===null)throw new It(It.NAMESPACE_ERR,"prefix is non-null and namespace is null");if(e==="xml"&&r!==or.NAMESPACE.XML)throw new It(It.NAMESPACE_ERR,'prefix is "xml" and namespace is not the XML namespace');if((e==="xmlns"||t==="xmlns")&&r!==or.NAMESPACE.XMLNS)throw new It(It.NAMESPACE_ERR,'either qualifiedName or prefix is "xmlns" and namespace is not the XMLNS namespace');if(r===or.NAMESPACE.XMLNS&&e!=="xmlns"&&t!=="xmlns")throw new It(It.NAMESPACE_ERR,'namespace is the XMLNS namespace and neither qualifiedName nor prefix is "xmlns"');return[r,e,n]}function wu(r,t){for(var e in r)yu(r,e)&&(t[e]=r[e])}function mi(r,t){var e=r.prototype;if(!(e instanceof t)){let n=function(){};n.prototype=t.prototype,n=new n,wu(e,n),r.prototype=e=n}e.constructor!=r&&(typeof r!="function"&&console.error("unknown Class:"+r),e.constructor=r)}var gi={},ar=gi.ELEMENT_NODE=1,bu=gi.ATTRIBUTE_NODE=2,Pg=gi.TEXT_NODE=3,mC=gi.CDATA_SECTION_NODE=4,gC=gi.ENTITY_REFERENCE_NODE=5,Gk=gi.ENTITY_NODE=6,rx=gi.PROCESSING_INSTRUCTION_NODE=7,sx=gi.COMMENT_NODE=8,gu=gi.DOCUMENT_NODE=9,yC=gi.DOCUMENT_TYPE_NODE=10,Ja=gi.DOCUMENT_FRAGMENT_NODE=11,Hk=gi.NOTATION_NODE=12,ze=or.freeze({DOCUMENT_POSITION_DISCONNECTED:1,DOCUMENT_POSITION_PRECEDING:2,DOCUMENT_POSITION_FOLLOWING:4,DOCUMENT_POSITION_CONTAINS:8,DOCUMENT_POSITION_CONTAINED_BY:16,DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC:32});function bC(r,t){if(t.length<r.length)return bC(t,r);var e=null;for(var n in r){if(r[n]!==t[n])return e;e=r[n]}return e}function lC(r){return r.guid||(r.guid=Math.random()),r.guid}function dn(){}dn.prototype={length:0,item:function(r){return r>=0&&r<this.length?this[r]:null},toString:function(r){var t;typeof r=="function"?t={requireWellFormed:!1,splitCDATASections:!0,nodeFilter:r}:r?t={requireWellFormed:!!r.requireWellFormed,splitCDATASections:r.splitCDATASections!==!1,nodeFilter:r.nodeFilter||null}:t={requireWellFormed:!1,splitCDATASections:!0,nodeFilter:null};for(var e=[],n=0;n<this.length;n++)lx(this[n],e,null,t);return e.join("")},filter:function(r){return Array.prototype.filter.call(this,r)},indexOf:function(r){return Array.prototype.indexOf.call(this,r)}};dn.prototype[Symbol.iterator]=function(){var r=this,t=0;return{next:function(){return t<r.length?{value:r[t++],done:!1}:{done:!0}},return:function(){return{done:!0}}}};function ss(r,t){this._node=r,this._refresh=t,Lg(this)}function Lg(r){var t=r._node._inc||r._node.ownerDocument._inc;if(r._inc!==t){var e=r._refresh(r._node);if(kC(r,"length",e.length),!r.$$length||e.length<r.$$length)for(var n=e.length;n in r;n++)yu(r,n)&&delete r[n];wu(e,r),r._inc=t}}ss.prototype.item=function(r){return Lg(this),this[r]||null};mi(ss,dn);function xu(){}function xC(r,t){for(var e=0;e<r.length;){if(r[e]===t)return e;e++}}function Wk(r,t,e,n){if(n?t[xC(t,n)]=e:(t[t.length]=e,t.length++),r){e.ownerElement=r;var i=r.ownerDocument;i&&(n&&vC(i,r,n),qk(i,r,e))}}function cC(r,t,e){var n=xC(t,e);if(n>=0){for(var i=t.length-1;n<=i;)t[n]=t[++n];if(t.length=i,r){var s=r.ownerDocument;s&&vC(s,r,e),e.ownerElement=null}}}xu.prototype={length:0,item:dn.prototype.item,getNamedItem:function(r){this._ownerElement&&this._ownerElement._isInHTMLDocumentAndNamespace()&&(r=r.toLowerCase());for(var t=0;t<this.length;){var e=this[t];if(e.nodeName===r)return e;t++}return null},setNamedItem:function(r){var t=r.ownerElement;if(t&&t!==this._ownerElement)throw new It(It.INUSE_ATTRIBUTE_ERR);var e=this.getNamedItemNS(r.namespaceURI,r.localName);return e===r?r:(Wk(this._ownerElement,this,r,e),e)},setNamedItemNS:function(r){return this.setNamedItem(r)},removeNamedItem:function(r){var t=this.getNamedItem(r);if(!t)throw new It(It.NOT_FOUND_ERR,r);return cC(this._ownerElement,this,t),t},removeNamedItemNS:function(r,t){var e=this.getNamedItemNS(r,t);if(!e)throw new It(It.NOT_FOUND_ERR,r?r+" : "+t:t);return cC(this._ownerElement,this,e),e},getNamedItemNS:function(r,t){r||(r=null);for(var e=0;e<this.length;){var n=this[e];if(n.localName===t&&n.namespaceURI===r)return n;e++}return null}};xu.prototype[Symbol.iterator]=function(){var r=this,t=0;return{next:function(){return t<r.length?{value:r[t++],done:!1}:{done:!0}},return:function(){return{done:!0}}}};function wC(){}wC.prototype={hasFeature:function(r,t){return!0},createDocument:function(r,t,e){var n=rf.XML_APPLICATION;r===os.HTML?n=rf.XML_XHTML_APPLICATION:r===os.SVG&&(n=rf.XML_SVG_IMAGE);var i=new Vs(ni,{contentType:n});if(i.implementation=this,i.childNodes=new dn,i.doctype=e||null,e&&i.appendChild(e),t){var s=i.createElementNS(r,t);i.appendChild(s)}return i},createDocumentType:function(r,t,e,n){pC(r);var i=new $g(ni);return i.name=r,i.nodeName=r,i.publicId=t||"",i.systemId=e||"",i.internalSubset=n||"",i.childNodes=new dn,i},createHTMLDocument:function(r){var t=new Vs(ni,{contentType:rf.HTML});if(t.implementation=this,t.childNodes=new dn,r!==!1){t.doctype=this.createDocumentType("html"),t.doctype.ownerDocument=t,t.appendChild(t.doctype);var e=t.createElement("html");t.appendChild(e);var n=t.createElement("head");if(e.appendChild(n),typeof r=="string"){var i=t.createElement("title");i.appendChild(t.createTextNode(r)),n.appendChild(i)}e.appendChild(t.createElement("body"))}return t}};function Jt(r){pi(r)}Jt.prototype={firstChild:null,lastChild:null,previousSibling:null,nextSibling:null,parentNode:null,get parentElement(){return this.parentNode&&this.parentNode.nodeType===this.ELEMENT_NODE?this.parentNode:null},childNodes:null,ownerDocument:null,nodeValue:null,namespaceURI:null,prefix:null,localName:null,baseURI:"about:blank",get isConnected(){var r=this.getRootNode();return r&&r.nodeType===r.DOCUMENT_NODE},contains:function(r){if(!r)return!1;var t=r;do{if(this===t)return!0;t=t.parentNode}while(t);return!1},getRootNode:function(r){var t=this;do{if(!t.parentNode)return t;t=t.parentNode}while(t)},isEqualNode:function(r){if(!r)return!1;for(var t=[{node:this,other:r}];t.length>0;){var e=t.pop(),n=e.node,i=e.other;if(n.nodeType!==i.nodeType)return!1;switch(n.nodeType){case n.DOCUMENT_TYPE_NODE:if(n.name!==i.name||n.publicId!==i.publicId||n.systemId!==i.systemId)return!1;break;case n.ELEMENT_NODE:if(n.namespaceURI!==i.namespaceURI||n.prefix!==i.prefix||n.localName!==i.localName||n.attributes.length!==i.attributes.length)return!1;for(var s=0;s<n.attributes.length;s++){var a=n.attributes.item(s),l=i.getAttributeNodeNS(a.namespaceURI,a.localName);if(!l)return!1;t.push({node:a,other:l})}break;case n.ATTRIBUTE_NODE:if(n.namespaceURI!==i.namespaceURI||n.localName!==i.localName||n.value!==i.value)return!1;break;case n.PROCESSING_INSTRUCTION_NODE:if(n.target!==i.target||n.data!==i.data)return!1;break;case n.TEXT_NODE:case n.CDATA_SECTION_NODE:case n.COMMENT_NODE:if(n.data!==i.data)return!1;break}if(n.childNodes.length!==i.childNodes.length)return!1;for(var s=n.childNodes.length-1;s>=0;s--)t.push({node:n.childNodes[s],other:i.childNodes[s]})}return!0},isSameNode:function(r){return this===r},insertBefore:function(r,t){return Rg(this,r,t)},replaceChild:function(r,t){Rg(this,r,t,SC),t&&this.removeChild(t)},removeChild:function(r){return EC(this,r)},appendChild:function(r){return this.insertBefore(r,null)},hasChildNodes:function(){return this.firstChild!=null},cloneNode:function(r){return IC(this.ownerDocument||this,this,r)},normalize:function(){Pn(this,null,{enter:function(r){for(var t=r.firstChild;t;){var e=t.nextSibling;e!==null&&e.nodeType===Pg&&t.nodeType===Pg?(r.removeChild(e),t.appendData(e.data)):t=e}return!0}})},isSupported:function(r,t){return this.ownerDocument.implementation.hasFeature(r,t)},lookupPrefix:function(r){for(var t=this;t;){var e=t._nsMap;if(e){for(var n in e)if(yu(e,n)&&e[n]===r)return n}t=t.nodeType==bu?t.ownerDocument:t.parentNode}return null},lookupNamespaceURI:function(r){for(var t=this;t;){var e=t._nsMap;if(e&&yu(e,r))return e[r];t=t.nodeType==bu?t.ownerDocument:t.parentNode}return null},isDefaultNamespace:function(r){var t=this.lookupPrefix(r);return t==null},compareDocumentPosition:function(r){if(this===r)return 0;var t=r,e=this,n=null,i=null;if(t instanceof ul&&(n=t,t=n.ownerElement),e instanceof ul&&(i=e,e=i.ownerElement,n&&t&&e===t))for(var s=0,a;a=e.attributes[s];s++){if(a===n)return ze.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC+ze.DOCUMENT_POSITION_PRECEDING;if(a===i)return ze.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC+ze.DOCUMENT_POSITION_FOLLOWING}if(!t||!e||e.ownerDocument!==t.ownerDocument)return ze.DOCUMENT_POSITION_DISCONNECTED+ze.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC+(lC(e.ownerDocument)>lC(t.ownerDocument)?ze.DOCUMENT_POSITION_FOLLOWING:ze.DOCUMENT_POSITION_PRECEDING);if(i&&t===e)return ze.DOCUMENT_POSITION_CONTAINS+ze.DOCUMENT_POSITION_PRECEDING;if(n&&t===e)return ze.DOCUMENT_POSITION_CONTAINED_BY+ze.DOCUMENT_POSITION_FOLLOWING;for(var l=[],c=t.parentNode;c;){if(!i&&c===e)return ze.DOCUMENT_POSITION_CONTAINED_BY+ze.DOCUMENT_POSITION_FOLLOWING;l.push(c),c=c.parentNode}l.reverse();for(var u=[],h=e.parentNode;h;){if(!n&&h===t)return ze.DOCUMENT_POSITION_CONTAINS+ze.DOCUMENT_POSITION_PRECEDING;u.push(h),h=h.parentNode}u.reverse();var d=bC(l,u);for(var f in d.childNodes){var p=d.childNodes[f];if(p===e)return ze.DOCUMENT_POSITION_FOLLOWING;if(p===t)return ze.DOCUMENT_POSITION_PRECEDING;if(u.indexOf(p)>=0)return ze.DOCUMENT_POSITION_FOLLOWING;if(l.indexOf(p)>=0)return ze.DOCUMENT_POSITION_PRECEDING}return 0}};function AC(r){return r=="<"&&"<"||r==">"&&">"||r=="&"&&"&"||r=='"'&&"""||"&#"+r.charCodeAt()+";"}wu(gi,Jt);wu(gi,Jt.prototype);wu(ze,Jt);wu(ze,Jt.prototype);function Fg(r,t){Pn(r,null,{enter:function(e){return t(e)?Pn.STOP:!0}})}function Pn(r,t,e){for(var n=[{node:r,context:t,phase:Pn.ENTER}];n.length>0;){var i=n.pop();if(i.phase===Pn.ENTER){var s=e.enter(i.node,i.context);if(s===Pn.STOP)return Pn.STOP;if(n.push({node:i.node,context:s,phase:Pn.EXIT}),s==null)continue;for(var a=i.node.lastChild;a;)n.push({node:a,context:s,phase:Pn.ENTER}),a=a.previousSibling}else e.exit&&e.exit(i.node,i.context)}}Pn.STOP=Symbol("walkDOM.STOP");Pn.ENTER=0;Pn.EXIT=1;function Vs(r,t){pi(r);var e=t||{};this.ownerDocument=this,this.contentType=e.contentType||rf.XML_APPLICATION,this.type=Rk(this.contentType)?"html":"xml"}function qk(r,t,e){r&&r._inc++;var n=e.namespaceURI;n===os.XMLNS&&(t._nsMap[e.prefix?e.localName:""]=e.value)}function vC(r,t,e,n){r&&r._inc++;var i=e.namespaceURI;i===os.XMLNS&&delete t._nsMap[e.prefix?e.localName:""]}function CC(r,t,e){if(r&&r._inc){r._inc++;var n=t.childNodes;if(e&&!e.nextSibling)n[n.length++]=e;else{for(var i=t.firstChild,s=0;i;)n[s++]=i,i=i.nextSibling;n.length=s,delete n[n.length]}}}function EC(r,t){if(r!==t.parentNode)throw new It(It.NOT_FOUND_ERR,"child's parent is not parent");var e=t.previousSibling,n=t.nextSibling;return e?e.nextSibling=n:r.firstChild=n,n?n.previousSibling=e:r.lastChild=e,CC(r.ownerDocument,r),t.parentNode=null,t.previousSibling=null,t.nextSibling=null,t}function Vk(r){return r&&(r.nodeType===Jt.DOCUMENT_NODE||r.nodeType===Jt.DOCUMENT_FRAGMENT_NODE||r.nodeType===Jt.ELEMENT_NODE)}function Xk(r){return r&&(r.nodeType===Jt.CDATA_SECTION_NODE||r.nodeType===Jt.COMMENT_NODE||r.nodeType===Jt.DOCUMENT_FRAGMENT_NODE||r.nodeType===Jt.DOCUMENT_TYPE_NODE||r.nodeType===Jt.ELEMENT_NODE||r.nodeType===Jt.PROCESSING_INSTRUCTION_NODE||r.nodeType===Jt.TEXT_NODE)}function to(r){return r&&r.nodeType===Jt.DOCUMENT_TYPE_NODE}function qs(r){return r&&r.nodeType===Jt.ELEMENT_NODE}function TC(r){return r&&r.nodeType===Jt.TEXT_NODE}function uC(r,t){var e=r.childNodes||[];if(as(e,qs)||to(t))return!1;var n=as(e,to);return!(t&&n&&e.indexOf(n)>e.indexOf(t))}function hC(r,t){var e=r.childNodes||[];function n(s){return qs(s)&&s!==t}if(as(e,n))return!1;var i=as(e,to);return!(t&&i&&e.indexOf(i)>e.indexOf(t))}function Yk(r,t,e){if(!Vk(r))throw new It(It.HIERARCHY_REQUEST_ERR,"Unexpected parent node type "+r.nodeType);if(e&&e.parentNode!==r)throw new It(It.NOT_FOUND_ERR,"child not in parent");if(!Xk(t)||to(t)&&r.nodeType!==Jt.DOCUMENT_NODE)throw new It(It.HIERARCHY_REQUEST_ERR,"Unexpected node type "+t.nodeType+" for parent node type "+r.nodeType)}function Kk(r,t,e){var n=r.childNodes||[],i=t.childNodes||[];if(t.nodeType===Jt.DOCUMENT_FRAGMENT_NODE){var s=i.filter(qs);if(s.length>1||as(i,TC))throw new It(It.HIERARCHY_REQUEST_ERR,"More than one element or text in fragment");if(s.length===1&&!uC(r,e))throw new It(It.HIERARCHY_REQUEST_ERR,"Element in fragment can not be inserted before doctype")}if(qs(t)&&!uC(r,e))throw new It(It.HIERARCHY_REQUEST_ERR,"Only one element can be added and only after doctype");if(to(t)){if(as(n,to))throw new It(It.HIERARCHY_REQUEST_ERR,"Only one doctype is allowed");var a=as(n,qs);if(e&&n.indexOf(a)<n.indexOf(e))throw new It(It.HIERARCHY_REQUEST_ERR,"Doctype can only be inserted before an element");if(!e&&a)throw new It(It.HIERARCHY_REQUEST_ERR,"Doctype can not be appended since element is present")}}function SC(r,t,e){var n=r.childNodes||[],i=t.childNodes||[];if(t.nodeType===Jt.DOCUMENT_FRAGMENT_NODE){var s=i.filter(qs);if(s.length>1||as(i,TC))throw new It(It.HIERARCHY_REQUEST_ERR,"More than one element or text in fragment");if(s.length===1&&!hC(r,e))throw new It(It.HIERARCHY_REQUEST_ERR,"Element in fragment can not be inserted before doctype")}if(qs(t)&&!hC(r,e))throw new It(It.HIERARCHY_REQUEST_ERR,"Only one element can be added and only after doctype");if(to(t)){if(as(n,function(c){return to(c)&&c!==e}))throw new It(It.HIERARCHY_REQUEST_ERR,"Only one doctype is allowed");var a=as(n,qs);if(e&&n.indexOf(a)<n.indexOf(e))throw new It(It.HIERARCHY_REQUEST_ERR,"Doctype can only be inserted before an element")}}function Rg(r,t,e,n){Yk(r,t,e),r.nodeType===Jt.DOCUMENT_NODE&&(n||Kk)(r,t,e);var i=t.parentNode;if(i&&i.removeChild(t),t.nodeType===Ja){var s=t.firstChild;if(s==null)return t;var a=t.lastChild}else s=a=t;var l=e?e.previousSibling:r.lastChild;s.previousSibling=l,a.nextSibling=e,l?l.nextSibling=s:r.firstChild=s,e==null?r.lastChild=a:e.previousSibling=a;do s.parentNode=r;while(s!==a&&(s=s.nextSibling));return CC(r.ownerDocument||r,r,t),t.nodeType==Ja&&(t.firstChild=t.lastChild=null),t}Vs.prototype={implementation:null,nodeName:"#document",nodeType:gu,doctype:null,documentElement:null,_inc:1,insertBefore:function(r,t){if(r.nodeType===Ja){for(var e=r.firstChild;e;){var n=e.nextSibling;this.insertBefore(e,t),e=n}return r}return Rg(this,r,t),r.ownerDocument=this,this.documentElement===null&&r.nodeType===ar&&(this.documentElement=r),r},removeChild:function(r){var t=EC(this,r);return t===this.documentElement&&(this.documentElement=null),t},replaceChild:function(r,t){Rg(this,r,t,SC),r.ownerDocument=this,t&&this.removeChild(t),qs(r)&&(this.documentElement=r)},importNode:function(r,t){return Zk(this,r,t)},getElementById:function(r){var t=null;return Fg(this.documentElement,function(e){if(e.nodeType==ar&&e.getAttribute("id")==r)return t=e,!0}),t},createElement:function(r){var t=new Xs(ni);t.ownerDocument=this,this.type==="html"&&(r=r.toLowerCase()),Pk(this.contentType)&&(t.namespaceURI=os.HTML),t.nodeName=r,t.tagName=r,t.localName=r,t.childNodes=new dn;var e=t.attributes=new xu;return e._ownerElement=t,t},createDocumentFragment:function(){var r=new vu(ni);return r.ownerDocument=this,r.childNodes=new dn,r},createTextNode:function(r){var t=new sf(ni);return t.ownerDocument=this,t.childNodes=new dn,t.appendData(r),t},createComment:function(r){var t=new Bg(ni);return t.ownerDocument=this,t.childNodes=new dn,t.appendData(r),t},createCDATASection:function(r){if(r.indexOf("]]>")!==-1)throw new It(It.INVALID_CHARACTER_ERR,'data contains "]]>"');var t=new Ug(ni);return t.ownerDocument=this,t.childNodes=new dn,t.appendData(r),t},createProcessingInstruction:function(r,t){var e=new jg(ni);return e.ownerDocument=this,e.childNodes=new dn,e.nodeName=e.target=r,e.nodeValue=e.data=t,e},createAttribute:function(r){if(!Fn.QName_exact.test(r))throw new It(It.INVALID_CHARACTER_ERR,'invalid character in name "'+r+'"');return this.type==="html"&&(r=r.toLowerCase()),this._createAttribute(r)},_createAttribute:function(r){var t=new ul(ni);return t.ownerDocument=this,t.childNodes=new dn,t.name=r,t.nodeName=r,t.localName=r,t.specified=!0,t},createEntityReference:function(r){if(!Fn.Name.test(r))throw new It(It.INVALID_CHARACTER_ERR,'not a valid xml name "'+r+'"');if(this.type==="html")throw new It("document is an html document",sr.NotSupportedError);var t=new zg(ni);return t.ownerDocument=this,t.childNodes=new dn,t.nodeName=r,t},createElementNS:function(r,t){var e=ix(r,t),n=new Xs(ni),i=n.attributes=new xu;return n.childNodes=new dn,n.ownerDocument=this,n.nodeName=t,n.tagName=t,n.namespaceURI=e[0],n.prefix=e[1],n.localName=e[2],i._ownerElement=n,n},createAttributeNS:function(r,t){var e=ix(r,t),n=new ul(ni);return n.ownerDocument=this,n.childNodes=new dn,n.nodeName=t,n.name=t,n.specified=!0,n.namespaceURI=e[0],n.prefix=e[1],n.localName=e[2],n}};mi(Vs,Jt);function Xs(r){pi(r),this._nsMap=Object.create(null)}Xs.prototype={nodeType:ar,attributes:null,getQualifiedName:function(){return this.prefix?this.prefix+":"+this.localName:this.localName},_isInHTMLDocumentAndNamespace:function(){return this.ownerDocument.type==="html"&&this.namespaceURI===os.HTML},hasAttributes:function(){return!!(this.attributes&&this.attributes.length)},hasAttribute:function(r){return!!this.getAttributeNode(r)},getAttribute:function(r){var t=this.getAttributeNode(r);return t?t.value:null},getAttributeNode:function(r){return this._isInHTMLDocumentAndNamespace()&&(r=r.toLowerCase()),this.attributes.getNamedItem(r)},setAttribute:function(r,t){this._isInHTMLDocumentAndNamespace()&&(r=r.toLowerCase());var e=this.getAttributeNode(r);e?e.value=e.nodeValue=""+t:(e=this.ownerDocument._createAttribute(r),e.value=e.nodeValue=""+t,this.setAttributeNode(e))},removeAttribute:function(r){var t=this.getAttributeNode(r);t&&this.removeAttributeNode(t)},setAttributeNode:function(r){return this.attributes.setNamedItem(r)},setAttributeNodeNS:function(r){return this.attributes.setNamedItemNS(r)},removeAttributeNode:function(r){return this.attributes.removeNamedItem(r.nodeName)},removeAttributeNS:function(r,t){var e=this.getAttributeNodeNS(r,t);e&&this.removeAttributeNode(e)},hasAttributeNS:function(r,t){return this.getAttributeNodeNS(r,t)!=null},getAttributeNS:function(r,t){var e=this.getAttributeNodeNS(r,t);return e?e.value:null},setAttributeNS:function(r,t,e){var n=ix(r,t),i=n[2],s=this.getAttributeNodeNS(r,i);s?s.value=s.nodeValue=""+e:(s=this.ownerDocument.createAttributeNS(r,t),s.value=s.nodeValue=""+e,this.setAttributeNode(s))},getAttributeNodeNS:function(r,t){return this.attributes.getNamedItemNS(r,t)},getElementsByClassName:function(r){var t=oC(r);return new ss(this,function(e){var n=[];return t.length>0&&Fg(e,function(i){if(i!==e&&i.nodeType===ar){var s=i.getAttribute("class");if(s){var a=r===s;if(!a){var l=oC(s);a=t.every(jk(l))}a&&n.push(i)}}}),n})},getElementsByTagName:function(r){var t=(this.nodeType===gu?this:this.ownerDocument).type==="html",e=r.toLowerCase();return new ss(this,function(n){var i=[];return Fg(n,function(s){if(!(s===n||s.nodeType!==ar))if(r==="*")i.push(s);else{var a=s.getQualifiedName(),l=t&&s.namespaceURI===os.HTML?e:r;a===l&&i.push(s)}}),i})},getElementsByTagNameNS:function(r,t){return new ss(this,function(e){var n=[];return Fg(e,function(i){i!==e&&i.nodeType===ar&&(r==="*"||i.namespaceURI===r)&&(t==="*"||i.localName==t)&&n.push(i)}),n})}};Vs.prototype.getElementsByClassName=Xs.prototype.getElementsByClassName;Vs.prototype.getElementsByTagName=Xs.prototype.getElementsByTagName;Vs.prototype.getElementsByTagNameNS=Xs.prototype.getElementsByTagNameNS;mi(Xs,Jt);function ul(r){pi(r),this.namespaceURI=null,this.prefix=null,this.ownerElement=null}ul.prototype.nodeType=bu;mi(ul,Jt);function Au(r){pi(r)}Au.prototype={data:"",substringData:function(r,t){return this.data.substring(r,r+t)},appendData:function(r){r=this.data+r,this.nodeValue=this.data=r,this.length=r.length},insertData:function(r,t){this.replaceData(r,0,t)},deleteData:function(r,t){this.replaceData(r,t,"")},replaceData:function(r,t,e){var n=this.data.substring(0,r),i=this.data.substring(r+t);e=n+e+i,this.nodeValue=this.data=e,this.length=e.length}};mi(Au,Jt);function sf(r){pi(r)}sf.prototype={nodeName:"#text",nodeType:Pg,splitText:function(r){var t=this.data,e=t.substring(r);t=t.substring(0,r),this.data=this.nodeValue=t,this.length=t.length;var n=this.ownerDocument.createTextNode(e);return this.parentNode&&this.parentNode.insertBefore(n,this.nextSibling),n}};mi(sf,Au);function Bg(r){pi(r)}Bg.prototype={nodeName:"#comment",nodeType:sx};mi(Bg,Au);function Ug(r){pi(r)}Ug.prototype={nodeName:"#cdata-section",nodeType:mC};mi(Ug,sf);function $g(r){pi(r)}$g.prototype.nodeType=yC;mi($g,Jt);function ax(r){pi(r)}ax.prototype.nodeType=Hk;mi(ax,Jt);function ox(r){pi(r)}ox.prototype.nodeType=Gk;mi(ox,Jt);function zg(r){pi(r)}zg.prototype.nodeType=gC;mi(zg,Jt);function vu(r){pi(r)}vu.prototype.nodeName="#document-fragment";vu.prototype.nodeType=Ja;mi(vu,Jt);function jg(r){pi(r)}jg.prototype.nodeType=rx;mi(jg,Au);function DC(){}DC.prototype.serializeToString=function(r,t){return NC.call(r,t)};Jt.prototype.toString=NC;function NC(r){var t;typeof r=="function"?t={requireWellFormed:!1,splitCDATASections:!0,nodeFilter:r}:r!=null?t={requireWellFormed:!!r.requireWellFormed,splitCDATASections:r.splitCDATASections!==!1,nodeFilter:r.nodeFilter||null}:t={requireWellFormed:!1,splitCDATASections:!0,nodeFilter:null};var e=[],n=this.nodeType===gu&&this.documentElement||this,i=n.prefix,s=n.namespaceURI;if(s&&i==null){var i=n.lookupPrefix(s);if(i==null)var a=[{namespace:s,prefix:null}]}return lx(this,e,a,t),e.join("")}function dC(r,t,e){var n=r.prefix||"",i=r.namespaceURI;if(!i||n==="xml"&&i===os.XML||i===os.XMLNS)return!1;for(var s=e.length;s--;){var a=e[s];if(a.prefix===n)return a.namespace!==i}return!0}function Og(r,t,e){r.push(" ",t,'="',e.replace(/[<>&"\t\n\r]/g,AC),'"')}function lx(r,t,e,n){e||(e=[]);var i=n.nodeFilter,s=n.requireWellFormed,a=n.splitCDATASections,l=r.nodeType===gu?r:r.ownerDocument,c=l.type==="html";Pn(r,{ns:e},{enter:function(u,h){var d=h.ns;if(i)if(u=i(u),u){if(typeof u=="string")return t.push(u),null}else return null;switch(u.nodeType){case ar:var f=u.attributes,p=f.length,m=u.tagName,y=m;if(!c&&!u.prefix&&u.namespaceURI){for(var x,b=0;b<f.length;b++)if(f.item(b).name==="xmlns"){x=f.item(b).value;break}if(!x)for(var w=d.length-1;w>=0;w--){var C=d[w];if(C.prefix===""&&C.namespace===u.namespaceURI){x=C.namespace;break}}if(x!==u.namespaceURI)for(var w=d.length-1;w>=0;w--){var C=d[w];if(C.namespace===u.namespaceURI){C.prefix&&(y=C.prefix+":"+m);break}}}t.push("<",y);for(var E=d.slice(),S=0;S<p;S++){var N=f.item(S);N.prefix=="xmlns"?E.push({prefix:N.localName,namespace:N.value}):N.nodeName=="xmlns"&&E.push({prefix:"",namespace:N.value})}for(var S=0;S<p;S++){var N=f.item(S);if(dC(N,c,E)){var k=N.prefix||"",M=N.namespaceURI;Og(t,k?"xmlns:"+k:"xmlns",M),E.push({prefix:k,namespace:M})}var R=i?i(N):N;R&&(typeof R=="string"?t.push(R):Og(t,R.name,R.value))}if(m===y&&dC(u,c,E)){var j=u.prefix||"",M=u.namespaceURI;Og(t,j?"xmlns:"+j:"xmlns",M),E.push({prefix:j,namespace:M})}var $=!u.firstChild;if($&&(c||u.namespaceURI===os.HTML)&&($=Bk(m)),$)return t.push("/>"),null;if(t.push(">"),c&&Lk(m)){for(var q=u.firstChild;q;)q.data?t.push(q.data):lx(q,t,E.slice(),n),q=q.nextSibling;return t.push("</",y,">"),null}return{ns:E,tag:y};case gu:case Ja:if(s&&u.nodeType===gu&&u.documentElement==null)throw new It("The Document has no documentElement",sr.InvalidStateError);return{ns:d};case bu:return Og(t,u.name,u.value),null;case Pg:if(s&&Fn.InvalidChar.test(u.data))throw new It("The Text node data contains characters outside the XML Char production",sr.InvalidStateError);return t.push(u.data.replace(/[<&>]/g,AC)),null;case mC:if(s&&u.data.indexOf("]]>")!==-1)throw new It('The CDATASection data contains "]]>"',sr.InvalidStateError);return a?t.push(Fn.CDATA_START,u.data.replace(/]]>/g,"]]]]><![CDATA[>"),Fn.CDATA_END):t.push(Fn.CDATA_START,u.data,Fn.CDATA_END),null;case sx:if(s){if(Fn.InvalidChar.test(u.data))throw new It("The comment node data contains characters outside the XML Char production",sr.InvalidStateError);if(u.data.indexOf("--")!==-1||u.data[u.data.length-1]==="-")throw new It('The comment node data contains "--" or ends with "-"',sr.InvalidStateError)}return t.push(Fn.COMMENT_START,u.data,Fn.COMMENT_END),null;case yC:var Q=u.publicId,Z=u.systemId;if(s){if(Q&&!Fn.PubidLiteral_match.test(Q))throw new It("DocumentType publicId is not a valid PubidLiteral",sr.InvalidStateError);if(Z&&Z!=="."&&!Fn.SystemLiteral_match.test(Z))throw new It("DocumentType systemId is not a valid SystemLiteral",sr.InvalidStateError);if(u.internalSubset&&u.internalSubset.indexOf("]>")!==-1)throw new It('DocumentType internalSubset contains "]>"',sr.InvalidStateError)}return t.push(Fn.DOCTYPE_DECL_START," ",u.name),Q?(t.push(" ",Fn.PUBLIC," ",Q),Z&&Z!=="."&&t.push(" ",Z)):Z&&Z!=="."&&t.push(" ",Fn.SYSTEM," ",Z),u.internalSubset&&t.push(" [",u.internalSubset,"]"),t.push(">"),null;case rx:if(s){if(u.target.indexOf(":")!==-1||u.target.toLowerCase()==="xml")throw new It("The ProcessingInstruction target is not well-formed",sr.InvalidStateError);if(Fn.InvalidChar.test(u.data))throw new It("The ProcessingInstruction data contains characters outside the XML Char production",sr.InvalidStateError);if(u.data.indexOf("?>")!==-1)throw new It('The ProcessingInstruction data contains "?>"',sr.InvalidStateError)}return t.push("<?",u.target," ",u.data,"?>"),null;case gC:return t.push("&",u.nodeName,";"),null;default:return t.push("??",u.nodeName),null}},exit:function(u,h){h&&h.tag&&t.push("</",h.tag,">")}})}function Zk(r,t,e){var n;return Pn(t,null,{enter:function(i,s){var a=i.cloneNode(!1);a.ownerDocument=r,a.parentNode=null,s===null?n=a:s.appendChild(a);var l=i.nodeType===bu||e;return l?a:null}}),n}function IC(r,t,e){var n;return Pn(t,null,{enter:function(i,s){var a=new i.constructor(ni);for(var l in i)if(yu(i,l)){var c=i[l];typeof c!="object"&&c!=a[l]&&(a[l]=c)}i.childNodes&&(a.childNodes=new dn),a.ownerDocument=r;var u=e;switch(a.nodeType){case ar:var h=i.attributes,d=a.attributes=new xu,f=h.length;d._ownerElement=a;for(var p=0;p<f;p++)a.setAttributeNode(IC(r,h.item(p),!0));break;case bu:u=!0}return s!==null?s.appendChild(a):n=a,u?a:null}}),n}function kC(r,t,e){r[t]=e}function nx(r){for(var t=[],e=r.firstChild;e;)e.nodeType===ar&&t.push(e),e=e.nextSibling;return t}try{Object.defineProperty&&(Object.defineProperty(ss.prototype,"length",{get:function(){return Lg(this),this.$$length}}),Object.defineProperty(Jt.prototype,"textContent",{get:function(){if(this.nodeType===ar||this.nodeType===Ja){var r=[];return Pn(this,null,{enter:function(t){if(t.nodeType===ar||t.nodeType===Ja)return!0;if(t.nodeType===rx||t.nodeType===sx)return null;r.push(t.nodeValue)}}),r.join("")}return this.nodeValue},set:function(r){switch(this.nodeType){case ar:case Ja:for(;this.firstChild;)this.removeChild(this.firstChild);(r||String(r))&&this.appendChild(this.ownerDocument.createTextNode(r));break;default:this.data=r,this.value=r,this.nodeValue=r}}}),Object.defineProperty(Xs.prototype,"children",{get:function(){return new ss(this,nx)}}),Object.defineProperty(Vs.prototype,"children",{get:function(){return new ss(this,nx)}}),Object.defineProperty(vu.prototype,"children",{get:function(){return new ss(this,nx)}}),kC=function(r,t,e){r["$$"+t]=e})}catch{}je._updateLiveList=Lg;je.Attr=ul;je.CDATASection=Ug;je.CharacterData=Au;je.Comment=Bg;je.Document=Vs;je.DocumentFragment=vu;je.DocumentType=$g;je.DOMImplementation=wC;je.Element=Xs;je.Entity=ox;je.EntityReference=zg;je.LiveNodeList=ss;je.NamedNodeMap=xu;je.Node=Jt;je.NodeList=dn;je.Notation=ax;je.Text=sf;je.ProcessingInstruction=jg;je.walkDOM=Pn;je.XMLSerializer=DC});var MC=Xt(af=>{"use strict";B();var _C=cl().freeze;af.XML_ENTITIES=_C({amp:"&",apos:"'",gt:">",lt:"<",quot:'"'});af.HTML_ENTITIES=_C({Aacute:"\xC1",aacute:"\xE1",Abreve:"\u0102",abreve:"\u0103",ac:"\u223E",acd:"\u223F",acE:"\u223E\u0333",Acirc:"\xC2",acirc:"\xE2",acute:"\xB4",Acy:"\u0410",acy:"\u0430",AElig:"\xC6",aelig:"\xE6",af:"\u2061",Afr:"\u{1D504}",afr:"\u{1D51E}",Agrave:"\xC0",agrave:"\xE0",alefsym:"\u2135",aleph:"\u2135",Alpha:"\u0391",alpha:"\u03B1",Amacr:"\u0100",amacr:"\u0101",amalg:"\u2A3F",AMP:"&",amp:"&",And:"\u2A53",and:"\u2227",andand:"\u2A55",andd:"\u2A5C",andslope:"\u2A58",andv:"\u2A5A",ang:"\u2220",ange:"\u29A4",angle:"\u2220",angmsd:"\u2221",angmsdaa:"\u29A8",angmsdab:"\u29A9",angmsdac:"\u29AA",angmsdad:"\u29AB",angmsdae:"\u29AC",angmsdaf:"\u29AD",angmsdag:"\u29AE",angmsdah:"\u29AF",angrt:"\u221F",angrtvb:"\u22BE",angrtvbd:"\u299D",angsph:"\u2222",angst:"\xC5",angzarr:"\u237C",Aogon:"\u0104",aogon:"\u0105",Aopf:"\u{1D538}",aopf:"\u{1D552}",ap:"\u2248",apacir:"\u2A6F",apE:"\u2A70",ape:"\u224A",apid:"\u224B",apos:"'",ApplyFunction:"\u2061",approx:"\u2248",approxeq:"\u224A",Aring:"\xC5",aring:"\xE5",Ascr:"\u{1D49C}",ascr:"\u{1D4B6}",Assign:"\u2254",ast:"*",asymp:"\u2248",asympeq:"\u224D",Atilde:"\xC3",atilde:"\xE3",Auml:"\xC4",auml:"\xE4",awconint:"\u2233",awint:"\u2A11",backcong:"\u224C",backepsilon:"\u03F6",backprime:"\u2035",backsim:"\u223D",backsimeq:"\u22CD",Backslash:"\u2216",Barv:"\u2AE7",barvee:"\u22BD",Barwed:"\u2306",barwed:"\u2305",barwedge:"\u2305",bbrk:"\u23B5",bbrktbrk:"\u23B6",bcong:"\u224C",Bcy:"\u0411",bcy:"\u0431",bdquo:"\u201E",becaus:"\u2235",Because:"\u2235",because:"\u2235",bemptyv:"\u29B0",bepsi:"\u03F6",bernou:"\u212C",Bernoullis:"\u212C",Beta:"\u0392",beta:"\u03B2",beth:"\u2136",between:"\u226C",Bfr:"\u{1D505}",bfr:"\u{1D51F}",bigcap:"\u22C2",bigcirc:"\u25EF",bigcup:"\u22C3",bigodot:"\u2A00",bigoplus:"\u2A01",bigotimes:"\u2A02",bigsqcup:"\u2A06",bigstar:"\u2605",bigtriangledown:"\u25BD",bigtriangleup:"\u25B3",biguplus:"\u2A04",bigvee:"\u22C1",bigwedge:"\u22C0",bkarow:"\u290D",blacklozenge:"\u29EB",blacksquare:"\u25AA",blacktriangle:"\u25B4",blacktriangledown:"\u25BE",blacktriangleleft:"\u25C2",blacktriangleright:"\u25B8",blank:"\u2423",blk12:"\u2592",blk14:"\u2591",blk34:"\u2593",block:"\u2588",bne:"=\u20E5",bnequiv:"\u2261\u20E5",bNot:"\u2AED",bnot:"\u2310",Bopf:"\u{1D539}",bopf:"\u{1D553}",bot:"\u22A5",bottom:"\u22A5",bowtie:"\u22C8",boxbox:"\u29C9",boxDL:"\u2557",boxDl:"\u2556",boxdL:"\u2555",boxdl:"\u2510",boxDR:"\u2554",boxDr:"\u2553",boxdR:"\u2552",boxdr:"\u250C",boxH:"\u2550",boxh:"\u2500",boxHD:"\u2566",boxHd:"\u2564",boxhD:"\u2565",boxhd:"\u252C",boxHU:"\u2569",boxHu:"\u2567",boxhU:"\u2568",boxhu:"\u2534",boxminus:"\u229F",boxplus:"\u229E",boxtimes:"\u22A0",boxUL:"\u255D",boxUl:"\u255C",boxuL:"\u255B",boxul:"\u2518",boxUR:"\u255A",boxUr:"\u2559",boxuR:"\u2558",boxur:"\u2514",boxV:"\u2551",boxv:"\u2502",boxVH:"\u256C",boxVh:"\u256B",boxvH:"\u256A",boxvh:"\u253C",boxVL:"\u2563",boxVl:"\u2562",boxvL:"\u2561",boxvl:"\u2524",boxVR:"\u2560",boxVr:"\u255F",boxvR:"\u255E",boxvr:"\u251C",bprime:"\u2035",Breve:"\u02D8",breve:"\u02D8",brvbar:"\xA6",Bscr:"\u212C",bscr:"\u{1D4B7}",bsemi:"\u204F",bsim:"\u223D",bsime:"\u22CD",bsol:"\\",bsolb:"\u29C5",bsolhsub:"\u27C8",bull:"\u2022",bullet:"\u2022",bump:"\u224E",bumpE:"\u2AAE",bumpe:"\u224F",Bumpeq:"\u224E",bumpeq:"\u224F",Cacute:"\u0106",cacute:"\u0107",Cap:"\u22D2",cap:"\u2229",capand:"\u2A44",capbrcup:"\u2A49",capcap:"\u2A4B",capcup:"\u2A47",capdot:"\u2A40",CapitalDifferentialD:"\u2145",caps:"\u2229\uFE00",caret:"\u2041",caron:"\u02C7",Cayleys:"\u212D",ccaps:"\u2A4D",Ccaron:"\u010C",ccaron:"\u010D",Ccedil:"\xC7",ccedil:"\xE7",Ccirc:"\u0108",ccirc:"\u0109",Cconint:"\u2230",ccups:"\u2A4C",ccupssm:"\u2A50",Cdot:"\u010A",cdot:"\u010B",cedil:"\xB8",Cedilla:"\xB8",cemptyv:"\u29B2",cent:"\xA2",CenterDot:"\xB7",centerdot:"\xB7",Cfr:"\u212D",cfr:"\u{1D520}",CHcy:"\u0427",chcy:"\u0447",check:"\u2713",checkmark:"\u2713",Chi:"\u03A7",chi:"\u03C7",cir:"\u25CB",circ:"\u02C6",circeq:"\u2257",circlearrowleft:"\u21BA",circlearrowright:"\u21BB",circledast:"\u229B",circledcirc:"\u229A",circleddash:"\u229D",CircleDot:"\u2299",circledR:"\xAE",circledS:"\u24C8",CircleMinus:"\u2296",CirclePlus:"\u2295",CircleTimes:"\u2297",cirE:"\u29C3",cire:"\u2257",cirfnint:"\u2A10",cirmid:"\u2AEF",cirscir:"\u29C2",ClockwiseContourIntegral:"\u2232",CloseCurlyDoubleQuote:"\u201D",CloseCurlyQuote:"\u2019",clubs:"\u2663",clubsuit:"\u2663",Colon:"\u2237",colon:":",Colone:"\u2A74",colone:"\u2254",coloneq:"\u2254",comma:",",commat:"@",comp:"\u2201",compfn:"\u2218",complement:"\u2201",complexes:"\u2102",cong:"\u2245",congdot:"\u2A6D",Congruent:"\u2261",Conint:"\u222F",conint:"\u222E",ContourIntegral:"\u222E",Copf:"\u2102",copf:"\u{1D554}",coprod:"\u2210",Coproduct:"\u2210",COPY:"\xA9",copy:"\xA9",copysr:"\u2117",CounterClockwiseContourIntegral:"\u2233",crarr:"\u21B5",Cross:"\u2A2F",cross:"\u2717",Cscr:"\u{1D49E}",cscr:"\u{1D4B8}",csub:"\u2ACF",csube:"\u2AD1",csup:"\u2AD0",csupe:"\u2AD2",ctdot:"\u22EF",cudarrl:"\u2938",cudarrr:"\u2935",cuepr:"\u22DE",cuesc:"\u22DF",cularr:"\u21B6",cularrp:"\u293D",Cup:"\u22D3",cup:"\u222A",cupbrcap:"\u2A48",CupCap:"\u224D",cupcap:"\u2A46",cupcup:"\u2A4A",cupdot:"\u228D",cupor:"\u2A45",cups:"\u222A\uFE00",curarr:"\u21B7",curarrm:"\u293C",curlyeqprec:"\u22DE",curlyeqsucc:"\u22DF",curlyvee:"\u22CE",curlywedge:"\u22CF",curren:"\xA4",curvearrowleft:"\u21B6",curvearrowright:"\u21B7",cuvee:"\u22CE",cuwed:"\u22CF",cwconint:"\u2232",cwint:"\u2231",cylcty:"\u232D",Dagger:"\u2021",dagger:"\u2020",daleth:"\u2138",Darr:"\u21A1",dArr:"\u21D3",darr:"\u2193",dash:"\u2010",Dashv:"\u2AE4",dashv:"\u22A3",dbkarow:"\u290F",dblac:"\u02DD",Dcaron:"\u010E",dcaron:"\u010F",Dcy:"\u0414",dcy:"\u0434",DD:"\u2145",dd:"\u2146",ddagger:"\u2021",ddarr:"\u21CA",DDotrahd:"\u2911",ddotseq:"\u2A77",deg:"\xB0",Del:"\u2207",Delta:"\u0394",delta:"\u03B4",demptyv:"\u29B1",dfisht:"\u297F",Dfr:"\u{1D507}",dfr:"\u{1D521}",dHar:"\u2965",dharl:"\u21C3",dharr:"\u21C2",DiacriticalAcute:"\xB4",DiacriticalDot:"\u02D9",DiacriticalDoubleAcute:"\u02DD",DiacriticalGrave:"`",DiacriticalTilde:"\u02DC",diam:"\u22C4",Diamond:"\u22C4",diamond:"\u22C4",diamondsuit:"\u2666",diams:"\u2666",die:"\xA8",DifferentialD:"\u2146",digamma:"\u03DD",disin:"\u22F2",div:"\xF7",divide:"\xF7",divideontimes:"\u22C7",divonx:"\u22C7",DJcy:"\u0402",djcy:"\u0452",dlcorn:"\u231E",dlcrop:"\u230D",dollar:"$",Dopf:"\u{1D53B}",dopf:"\u{1D555}",Dot:"\xA8",dot:"\u02D9",DotDot:"\u20DC",doteq:"\u2250",doteqdot:"\u2251",DotEqual:"\u2250",dotminus:"\u2238",dotplus:"\u2214",dotsquare:"\u22A1",doublebarwedge:"\u2306",DoubleContourIntegral:"\u222F",DoubleDot:"\xA8",DoubleDownArrow:"\u21D3",DoubleLeftArrow:"\u21D0",DoubleLeftRightArrow:"\u21D4",DoubleLeftTee:"\u2AE4",DoubleLongLeftArrow:"\u27F8",DoubleLongLeftRightArrow:"\u27FA",DoubleLongRightArrow:"\u27F9",DoubleRightArrow:"\u21D2",DoubleRightTee:"\u22A8",DoubleUpArrow:"\u21D1",DoubleUpDownArrow:"\u21D5",DoubleVerticalBar:"\u2225",DownArrow:"\u2193",Downarrow:"\u21D3",downarrow:"\u2193",DownArrowBar:"\u2913",DownArrowUpArrow:"\u21F5",DownBreve:"\u0311",downdownarrows:"\u21CA",downharpoonleft:"\u21C3",downharpoonright:"\u21C2",DownLeftRightVector:"\u2950",DownLeftTeeVector:"\u295E",DownLeftVector:"\u21BD",DownLeftVectorBar:"\u2956",DownRightTeeVector:"\u295F",DownRightVector:"\u21C1",DownRightVectorBar:"\u2957",DownTee:"\u22A4",DownTeeArrow:"\u21A7",drbkarow:"\u2910",drcorn:"\u231F",drcrop:"\u230C",Dscr:"\u{1D49F}",dscr:"\u{1D4B9}",DScy:"\u0405",dscy:"\u0455",dsol:"\u29F6",Dstrok:"\u0110",dstrok:"\u0111",dtdot:"\u22F1",dtri:"\u25BF",dtrif:"\u25BE",duarr:"\u21F5",duhar:"\u296F",dwangle:"\u29A6",DZcy:"\u040F",dzcy:"\u045F",dzigrarr:"\u27FF",Eacute:"\xC9",eacute:"\xE9",easter:"\u2A6E",Ecaron:"\u011A",ecaron:"\u011B",ecir:"\u2256",Ecirc:"\xCA",ecirc:"\xEA",ecolon:"\u2255",Ecy:"\u042D",ecy:"\u044D",eDDot:"\u2A77",Edot:"\u0116",eDot:"\u2251",edot:"\u0117",ee:"\u2147",efDot:"\u2252",Efr:"\u{1D508}",efr:"\u{1D522}",eg:"\u2A9A",Egrave:"\xC8",egrave:"\xE8",egs:"\u2A96",egsdot:"\u2A98",el:"\u2A99",Element:"\u2208",elinters:"\u23E7",ell:"\u2113",els:"\u2A95",elsdot:"\u2A97",Emacr:"\u0112",emacr:"\u0113",empty:"\u2205",emptyset:"\u2205",EmptySmallSquare:"\u25FB",emptyv:"\u2205",EmptyVerySmallSquare:"\u25AB",emsp:"\u2003",emsp13:"\u2004",emsp14:"\u2005",ENG:"\u014A",eng:"\u014B",ensp:"\u2002",Eogon:"\u0118",eogon:"\u0119",Eopf:"\u{1D53C}",eopf:"\u{1D556}",epar:"\u22D5",eparsl:"\u29E3",eplus:"\u2A71",epsi:"\u03B5",Epsilon:"\u0395",epsilon:"\u03B5",epsiv:"\u03F5",eqcirc:"\u2256",eqcolon:"\u2255",eqsim:"\u2242",eqslantgtr:"\u2A96",eqslantless:"\u2A95",Equal:"\u2A75",equals:"=",EqualTilde:"\u2242",equest:"\u225F",Equilibrium:"\u21CC",equiv:"\u2261",equivDD:"\u2A78",eqvparsl:"\u29E5",erarr:"\u2971",erDot:"\u2253",Escr:"\u2130",escr:"\u212F",esdot:"\u2250",Esim:"\u2A73",esim:"\u2242",Eta:"\u0397",eta:"\u03B7",ETH:"\xD0",eth:"\xF0",Euml:"\xCB",euml:"\xEB",euro:"\u20AC",excl:"!",exist:"\u2203",Exists:"\u2203",expectation:"\u2130",ExponentialE:"\u2147",exponentiale:"\u2147",fallingdotseq:"\u2252",Fcy:"\u0424",fcy:"\u0444",female:"\u2640",ffilig:"\uFB03",fflig:"\uFB00",ffllig:"\uFB04",Ffr:"\u{1D509}",ffr:"\u{1D523}",filig:"\uFB01",FilledSmallSquare:"\u25FC",FilledVerySmallSquare:"\u25AA",fjlig:"fj",flat:"\u266D",fllig:"\uFB02",fltns:"\u25B1",fnof:"\u0192",Fopf:"\u{1D53D}",fopf:"\u{1D557}",ForAll:"\u2200",forall:"\u2200",fork:"\u22D4",forkv:"\u2AD9",Fouriertrf:"\u2131",fpartint:"\u2A0D",frac12:"\xBD",frac13:"\u2153",frac14:"\xBC",frac15:"\u2155",frac16:"\u2159",frac18:"\u215B",frac23:"\u2154",frac25:"\u2156",frac34:"\xBE",frac35:"\u2157",frac38:"\u215C",frac45:"\u2158",frac56:"\u215A",frac58:"\u215D",frac78:"\u215E",frasl:"\u2044",frown:"\u2322",Fscr:"\u2131",fscr:"\u{1D4BB}",gacute:"\u01F5",Gamma:"\u0393",gamma:"\u03B3",Gammad:"\u03DC",gammad:"\u03DD",gap:"\u2A86",Gbreve:"\u011E",gbreve:"\u011F",Gcedil:"\u0122",Gcirc:"\u011C",gcirc:"\u011D",Gcy:"\u0413",gcy:"\u0433",Gdot:"\u0120",gdot:"\u0121",gE:"\u2267",ge:"\u2265",gEl:"\u2A8C",gel:"\u22DB",geq:"\u2265",geqq:"\u2267",geqslant:"\u2A7E",ges:"\u2A7E",gescc:"\u2AA9",gesdot:"\u2A80",gesdoto:"\u2A82",gesdotol:"\u2A84",gesl:"\u22DB\uFE00",gesles:"\u2A94",Gfr:"\u{1D50A}",gfr:"\u{1D524}",Gg:"\u22D9",gg:"\u226B",ggg:"\u22D9",gimel:"\u2137",GJcy:"\u0403",gjcy:"\u0453",gl:"\u2277",gla:"\u2AA5",glE:"\u2A92",glj:"\u2AA4",gnap:"\u2A8A",gnapprox:"\u2A8A",gnE:"\u2269",gne:"\u2A88",gneq:"\u2A88",gneqq:"\u2269",gnsim:"\u22E7",Gopf:"\u{1D53E}",gopf:"\u{1D558}",grave:"`",GreaterEqual:"\u2265",GreaterEqualLess:"\u22DB",GreaterFullEqual:"\u2267",GreaterGreater:"\u2AA2",GreaterLess:"\u2277",GreaterSlantEqual:"\u2A7E",GreaterTilde:"\u2273",Gscr:"\u{1D4A2}",gscr:"\u210A",gsim:"\u2273",gsime:"\u2A8E",gsiml:"\u2A90",Gt:"\u226B",GT:">",gt:">",gtcc:"\u2AA7",gtcir:"\u2A7A",gtdot:"\u22D7",gtlPar:"\u2995",gtquest:"\u2A7C",gtrapprox:"\u2A86",gtrarr:"\u2978",gtrdot:"\u22D7",gtreqless:"\u22DB",gtreqqless:"\u2A8C",gtrless:"\u2277",gtrsim:"\u2273",gvertneqq:"\u2269\uFE00",gvnE:"\u2269\uFE00",Hacek:"\u02C7",hairsp:"\u200A",half:"\xBD",hamilt:"\u210B",HARDcy:"\u042A",hardcy:"\u044A",hArr:"\u21D4",harr:"\u2194",harrcir:"\u2948",harrw:"\u21AD",Hat:"^",hbar:"\u210F",Hcirc:"\u0124",hcirc:"\u0125",hearts:"\u2665",heartsuit:"\u2665",hellip:"\u2026",hercon:"\u22B9",Hfr:"\u210C",hfr:"\u{1D525}",HilbertSpace:"\u210B",hksearow:"\u2925",hkswarow:"\u2926",hoarr:"\u21FF",homtht:"\u223B",hookleftarrow:"\u21A9",hookrightarrow:"\u21AA",Hopf:"\u210D",hopf:"\u{1D559}",horbar:"\u2015",HorizontalLine:"\u2500",Hscr:"\u210B",hscr:"\u{1D4BD}",hslash:"\u210F",Hstrok:"\u0126",hstrok:"\u0127",HumpDownHump:"\u224E",HumpEqual:"\u224F",hybull:"\u2043",hyphen:"\u2010",Iacute:"\xCD",iacute:"\xED",ic:"\u2063",Icirc:"\xCE",icirc:"\xEE",Icy:"\u0418",icy:"\u0438",Idot:"\u0130",IEcy:"\u0415",iecy:"\u0435",iexcl:"\xA1",iff:"\u21D4",Ifr:"\u2111",ifr:"\u{1D526}",Igrave:"\xCC",igrave:"\xEC",ii:"\u2148",iiiint:"\u2A0C",iiint:"\u222D",iinfin:"\u29DC",iiota:"\u2129",IJlig:"\u0132",ijlig:"\u0133",Im:"\u2111",Imacr:"\u012A",imacr:"\u012B",image:"\u2111",ImaginaryI:"\u2148",imagline:"\u2110",imagpart:"\u2111",imath:"\u0131",imof:"\u22B7",imped:"\u01B5",Implies:"\u21D2",in:"\u2208",incare:"\u2105",infin:"\u221E",infintie:"\u29DD",inodot:"\u0131",Int:"\u222C",int:"\u222B",intcal:"\u22BA",integers:"\u2124",Integral:"\u222B",intercal:"\u22BA",Intersection:"\u22C2",intlarhk:"\u2A17",intprod:"\u2A3C",InvisibleComma:"\u2063",InvisibleTimes:"\u2062",IOcy:"\u0401",iocy:"\u0451",Iogon:"\u012E",iogon:"\u012F",Iopf:"\u{1D540}",iopf:"\u{1D55A}",Iota:"\u0399",iota:"\u03B9",iprod:"\u2A3C",iquest:"\xBF",Iscr:"\u2110",iscr:"\u{1D4BE}",isin:"\u2208",isindot:"\u22F5",isinE:"\u22F9",isins:"\u22F4",isinsv:"\u22F3",isinv:"\u2208",it:"\u2062",Itilde:"\u0128",itilde:"\u0129",Iukcy:"\u0406",iukcy:"\u0456",Iuml:"\xCF",iuml:"\xEF",Jcirc:"\u0134",jcirc:"\u0135",Jcy:"\u0419",jcy:"\u0439",Jfr:"\u{1D50D}",jfr:"\u{1D527}",jmath:"\u0237",Jopf:"\u{1D541}",jopf:"\u{1D55B}",Jscr:"\u{1D4A5}",jscr:"\u{1D4BF}",Jsercy:"\u0408",jsercy:"\u0458",Jukcy:"\u0404",jukcy:"\u0454",Kappa:"\u039A",kappa:"\u03BA",kappav:"\u03F0",Kcedil:"\u0136",kcedil:"\u0137",Kcy:"\u041A",kcy:"\u043A",Kfr:"\u{1D50E}",kfr:"\u{1D528}",kgreen:"\u0138",KHcy:"\u0425",khcy:"\u0445",KJcy:"\u040C",kjcy:"\u045C",Kopf:"\u{1D542}",kopf:"\u{1D55C}",Kscr:"\u{1D4A6}",kscr:"\u{1D4C0}",lAarr:"\u21DA",Lacute:"\u0139",lacute:"\u013A",laemptyv:"\u29B4",lagran:"\u2112",Lambda:"\u039B",lambda:"\u03BB",Lang:"\u27EA",lang:"\u27E8",langd:"\u2991",langle:"\u27E8",lap:"\u2A85",Laplacetrf:"\u2112",laquo:"\xAB",Larr:"\u219E",lArr:"\u21D0",larr:"\u2190",larrb:"\u21E4",larrbfs:"\u291F",larrfs:"\u291D",larrhk:"\u21A9",larrlp:"\u21AB",larrpl:"\u2939",larrsim:"\u2973",larrtl:"\u21A2",lat:"\u2AAB",lAtail:"\u291B",latail:"\u2919",late:"\u2AAD",lates:"\u2AAD\uFE00",lBarr:"\u290E",lbarr:"\u290C",lbbrk:"\u2772",lbrace:"{",lbrack:"[",lbrke:"\u298B",lbrksld:"\u298F",lbrkslu:"\u298D",Lcaron:"\u013D",lcaron:"\u013E",Lcedil:"\u013B",lcedil:"\u013C",lceil:"\u2308",lcub:"{",Lcy:"\u041B",lcy:"\u043B",ldca:"\u2936",ldquo:"\u201C",ldquor:"\u201E",ldrdhar:"\u2967",ldrushar:"\u294B",ldsh:"\u21B2",lE:"\u2266",le:"\u2264",LeftAngleBracket:"\u27E8",LeftArrow:"\u2190",Leftarrow:"\u21D0",leftarrow:"\u2190",LeftArrowBar:"\u21E4",LeftArrowRightArrow:"\u21C6",leftarrowtail:"\u21A2",LeftCeiling:"\u2308",LeftDoubleBracket:"\u27E6",LeftDownTeeVector:"\u2961",LeftDownVector:"\u21C3",LeftDownVectorBar:"\u2959",LeftFloor:"\u230A",leftharpoondown:"\u21BD",leftharpoonup:"\u21BC",leftleftarrows:"\u21C7",LeftRightArrow:"\u2194",Leftrightarrow:"\u21D4",leftrightarrow:"\u2194",leftrightarrows:"\u21C6",leftrightharpoons:"\u21CB",leftrightsquigarrow:"\u21AD",LeftRightVector:"\u294E",LeftTee:"\u22A3",LeftTeeArrow:"\u21A4",LeftTeeVector:"\u295A",leftthreetimes:"\u22CB",LeftTriangle:"\u22B2",LeftTriangleBar:"\u29CF",LeftTriangleEqual:"\u22B4",LeftUpDownVector:"\u2951",LeftUpTeeVector:"\u2960",LeftUpVector:"\u21BF",LeftUpVectorBar:"\u2958",LeftVector:"\u21BC",LeftVectorBar:"\u2952",lEg:"\u2A8B",leg:"\u22DA",leq:"\u2264",leqq:"\u2266",leqslant:"\u2A7D",les:"\u2A7D",lescc:"\u2AA8",lesdot:"\u2A7F",lesdoto:"\u2A81",lesdotor:"\u2A83",lesg:"\u22DA\uFE00",lesges:"\u2A93",lessapprox:"\u2A85",lessdot:"\u22D6",lesseqgtr:"\u22DA",lesseqqgtr:"\u2A8B",LessEqualGreater:"\u22DA",LessFullEqual:"\u2266",LessGreater:"\u2276",lessgtr:"\u2276",LessLess:"\u2AA1",lesssim:"\u2272",LessSlantEqual:"\u2A7D",LessTilde:"\u2272",lfisht:"\u297C",lfloor:"\u230A",Lfr:"\u{1D50F}",lfr:"\u{1D529}",lg:"\u2276",lgE:"\u2A91",lHar:"\u2962",lhard:"\u21BD",lharu:"\u21BC",lharul:"\u296A",lhblk:"\u2584",LJcy:"\u0409",ljcy:"\u0459",Ll:"\u22D8",ll:"\u226A",llarr:"\u21C7",llcorner:"\u231E",Lleftarrow:"\u21DA",llhard:"\u296B",lltri:"\u25FA",Lmidot:"\u013F",lmidot:"\u0140",lmoust:"\u23B0",lmoustache:"\u23B0",lnap:"\u2A89",lnapprox:"\u2A89",lnE:"\u2268",lne:"\u2A87",lneq:"\u2A87",lneqq:"\u2268",lnsim:"\u22E6",loang:"\u27EC",loarr:"\u21FD",lobrk:"\u27E6",LongLeftArrow:"\u27F5",Longleftarrow:"\u27F8",longleftarrow:"\u27F5",LongLeftRightArrow:"\u27F7",Longleftrightarrow:"\u27FA",longleftrightarrow:"\u27F7",longmapsto:"\u27FC",LongRightArrow:"\u27F6",Longrightarrow:"\u27F9",longrightarrow:"\u27F6",looparrowleft:"\u21AB",looparrowright:"\u21AC",lopar:"\u2985",Lopf:"\u{1D543}",lopf:"\u{1D55D}",loplus:"\u2A2D",lotimes:"\u2A34",lowast:"\u2217",lowbar:"_",LowerLeftArrow:"\u2199",LowerRightArrow:"\u2198",loz:"\u25CA",lozenge:"\u25CA",lozf:"\u29EB",lpar:"(",lparlt:"\u2993",lrarr:"\u21C6",lrcorner:"\u231F",lrhar:"\u21CB",lrhard:"\u296D",lrm:"\u200E",lrtri:"\u22BF",lsaquo:"\u2039",Lscr:"\u2112",lscr:"\u{1D4C1}",Lsh:"\u21B0",lsh:"\u21B0",lsim:"\u2272",lsime:"\u2A8D",lsimg:"\u2A8F",lsqb:"[",lsquo:"\u2018",lsquor:"\u201A",Lstrok:"\u0141",lstrok:"\u0142",Lt:"\u226A",LT:"<",lt:"<",ltcc:"\u2AA6",ltcir:"\u2A79",ltdot:"\u22D6",lthree:"\u22CB",ltimes:"\u22C9",ltlarr:"\u2976",ltquest:"\u2A7B",ltri:"\u25C3",ltrie:"\u22B4",ltrif:"\u25C2",ltrPar:"\u2996",lurdshar:"\u294A",luruhar:"\u2966",lvertneqq:"\u2268\uFE00",lvnE:"\u2268\uFE00",macr:"\xAF",male:"\u2642",malt:"\u2720",maltese:"\u2720",Map:"\u2905",map:"\u21A6",mapsto:"\u21A6",mapstodown:"\u21A7",mapstoleft:"\u21A4",mapstoup:"\u21A5",marker:"\u25AE",mcomma:"\u2A29",Mcy:"\u041C",mcy:"\u043C",mdash:"\u2014",mDDot:"\u223A",measuredangle:"\u2221",MediumSpace:"\u205F",Mellintrf:"\u2133",Mfr:"\u{1D510}",mfr:"\u{1D52A}",mho:"\u2127",micro:"\xB5",mid:"\u2223",midast:"*",midcir:"\u2AF0",middot:"\xB7",minus:"\u2212",minusb:"\u229F",minusd:"\u2238",minusdu:"\u2A2A",MinusPlus:"\u2213",mlcp:"\u2ADB",mldr:"\u2026",mnplus:"\u2213",models:"\u22A7",Mopf:"\u{1D544}",mopf:"\u{1D55E}",mp:"\u2213",Mscr:"\u2133",mscr:"\u{1D4C2}",mstpos:"\u223E",Mu:"\u039C",mu:"\u03BC",multimap:"\u22B8",mumap:"\u22B8",nabla:"\u2207",Nacute:"\u0143",nacute:"\u0144",nang:"\u2220\u20D2",nap:"\u2249",napE:"\u2A70\u0338",napid:"\u224B\u0338",napos:"\u0149",napprox:"\u2249",natur:"\u266E",natural:"\u266E",naturals:"\u2115",nbsp:"\xA0",nbump:"\u224E\u0338",nbumpe:"\u224F\u0338",ncap:"\u2A43",Ncaron:"\u0147",ncaron:"\u0148",Ncedil:"\u0145",ncedil:"\u0146",ncong:"\u2247",ncongdot:"\u2A6D\u0338",ncup:"\u2A42",Ncy:"\u041D",ncy:"\u043D",ndash:"\u2013",ne:"\u2260",nearhk:"\u2924",neArr:"\u21D7",nearr:"\u2197",nearrow:"\u2197",nedot:"\u2250\u0338",NegativeMediumSpace:"\u200B",NegativeThickSpace:"\u200B",NegativeThinSpace:"\u200B",NegativeVeryThinSpace:"\u200B",nequiv:"\u2262",nesear:"\u2928",nesim:"\u2242\u0338",NestedGreaterGreater:"\u226B",NestedLessLess:"\u226A",NewLine:`
|
|
7
|
-
`,nexist:"\u2204",nexists:"\u2204",Nfr:"\u{1D511}",nfr:"\u{1D52B}",ngE:"\u2267\u0338",nge:"\u2271",ngeq:"\u2271",ngeqq:"\u2267\u0338",ngeqslant:"\u2A7E\u0338",nges:"\u2A7E\u0338",nGg:"\u22D9\u0338",ngsim:"\u2275",nGt:"\u226B\u20D2",ngt:"\u226F",ngtr:"\u226F",nGtv:"\u226B\u0338",nhArr:"\u21CE",nharr:"\u21AE",nhpar:"\u2AF2",ni:"\u220B",nis:"\u22FC",nisd:"\u22FA",niv:"\u220B",NJcy:"\u040A",njcy:"\u045A",nlArr:"\u21CD",nlarr:"\u219A",nldr:"\u2025",nlE:"\u2266\u0338",nle:"\u2270",nLeftarrow:"\u21CD",nleftarrow:"\u219A",nLeftrightarrow:"\u21CE",nleftrightarrow:"\u21AE",nleq:"\u2270",nleqq:"\u2266\u0338",nleqslant:"\u2A7D\u0338",nles:"\u2A7D\u0338",nless:"\u226E",nLl:"\u22D8\u0338",nlsim:"\u2274",nLt:"\u226A\u20D2",nlt:"\u226E",nltri:"\u22EA",nltrie:"\u22EC",nLtv:"\u226A\u0338",nmid:"\u2224",NoBreak:"\u2060",NonBreakingSpace:"\xA0",Nopf:"\u2115",nopf:"\u{1D55F}",Not:"\u2AEC",not:"\xAC",NotCongruent:"\u2262",NotCupCap:"\u226D",NotDoubleVerticalBar:"\u2226",NotElement:"\u2209",NotEqual:"\u2260",NotEqualTilde:"\u2242\u0338",NotExists:"\u2204",NotGreater:"\u226F",NotGreaterEqual:"\u2271",NotGreaterFullEqual:"\u2267\u0338",NotGreaterGreater:"\u226B\u0338",NotGreaterLess:"\u2279",NotGreaterSlantEqual:"\u2A7E\u0338",NotGreaterTilde:"\u2275",NotHumpDownHump:"\u224E\u0338",NotHumpEqual:"\u224F\u0338",notin:"\u2209",notindot:"\u22F5\u0338",notinE:"\u22F9\u0338",notinva:"\u2209",notinvb:"\u22F7",notinvc:"\u22F6",NotLeftTriangle:"\u22EA",NotLeftTriangleBar:"\u29CF\u0338",NotLeftTriangleEqual:"\u22EC",NotLess:"\u226E",NotLessEqual:"\u2270",NotLessGreater:"\u2278",NotLessLess:"\u226A\u0338",NotLessSlantEqual:"\u2A7D\u0338",NotLessTilde:"\u2274",NotNestedGreaterGreater:"\u2AA2\u0338",NotNestedLessLess:"\u2AA1\u0338",notni:"\u220C",notniva:"\u220C",notnivb:"\u22FE",notnivc:"\u22FD",NotPrecedes:"\u2280",NotPrecedesEqual:"\u2AAF\u0338",NotPrecedesSlantEqual:"\u22E0",NotReverseElement:"\u220C",NotRightTriangle:"\u22EB",NotRightTriangleBar:"\u29D0\u0338",NotRightTriangleEqual:"\u22ED",NotSquareSubset:"\u228F\u0338",NotSquareSubsetEqual:"\u22E2",NotSquareSuperset:"\u2290\u0338",NotSquareSupersetEqual:"\u22E3",NotSubset:"\u2282\u20D2",NotSubsetEqual:"\u2288",NotSucceeds:"\u2281",NotSucceedsEqual:"\u2AB0\u0338",NotSucceedsSlantEqual:"\u22E1",NotSucceedsTilde:"\u227F\u0338",NotSuperset:"\u2283\u20D2",NotSupersetEqual:"\u2289",NotTilde:"\u2241",NotTildeEqual:"\u2244",NotTildeFullEqual:"\u2247",NotTildeTilde:"\u2249",NotVerticalBar:"\u2224",npar:"\u2226",nparallel:"\u2226",nparsl:"\u2AFD\u20E5",npart:"\u2202\u0338",npolint:"\u2A14",npr:"\u2280",nprcue:"\u22E0",npre:"\u2AAF\u0338",nprec:"\u2280",npreceq:"\u2AAF\u0338",nrArr:"\u21CF",nrarr:"\u219B",nrarrc:"\u2933\u0338",nrarrw:"\u219D\u0338",nRightarrow:"\u21CF",nrightarrow:"\u219B",nrtri:"\u22EB",nrtrie:"\u22ED",nsc:"\u2281",nsccue:"\u22E1",nsce:"\u2AB0\u0338",Nscr:"\u{1D4A9}",nscr:"\u{1D4C3}",nshortmid:"\u2224",nshortparallel:"\u2226",nsim:"\u2241",nsime:"\u2244",nsimeq:"\u2244",nsmid:"\u2224",nspar:"\u2226",nsqsube:"\u22E2",nsqsupe:"\u22E3",nsub:"\u2284",nsubE:"\u2AC5\u0338",nsube:"\u2288",nsubset:"\u2282\u20D2",nsubseteq:"\u2288",nsubseteqq:"\u2AC5\u0338",nsucc:"\u2281",nsucceq:"\u2AB0\u0338",nsup:"\u2285",nsupE:"\u2AC6\u0338",nsupe:"\u2289",nsupset:"\u2283\u20D2",nsupseteq:"\u2289",nsupseteqq:"\u2AC6\u0338",ntgl:"\u2279",Ntilde:"\xD1",ntilde:"\xF1",ntlg:"\u2278",ntriangleleft:"\u22EA",ntrianglelefteq:"\u22EC",ntriangleright:"\u22EB",ntrianglerighteq:"\u22ED",Nu:"\u039D",nu:"\u03BD",num:"#",numero:"\u2116",numsp:"\u2007",nvap:"\u224D\u20D2",nVDash:"\u22AF",nVdash:"\u22AE",nvDash:"\u22AD",nvdash:"\u22AC",nvge:"\u2265\u20D2",nvgt:">\u20D2",nvHarr:"\u2904",nvinfin:"\u29DE",nvlArr:"\u2902",nvle:"\u2264\u20D2",nvlt:"<\u20D2",nvltrie:"\u22B4\u20D2",nvrArr:"\u2903",nvrtrie:"\u22B5\u20D2",nvsim:"\u223C\u20D2",nwarhk:"\u2923",nwArr:"\u21D6",nwarr:"\u2196",nwarrow:"\u2196",nwnear:"\u2927",Oacute:"\xD3",oacute:"\xF3",oast:"\u229B",ocir:"\u229A",Ocirc:"\xD4",ocirc:"\xF4",Ocy:"\u041E",ocy:"\u043E",odash:"\u229D",Odblac:"\u0150",odblac:"\u0151",odiv:"\u2A38",odot:"\u2299",odsold:"\u29BC",OElig:"\u0152",oelig:"\u0153",ofcir:"\u29BF",Ofr:"\u{1D512}",ofr:"\u{1D52C}",ogon:"\u02DB",Ograve:"\xD2",ograve:"\xF2",ogt:"\u29C1",ohbar:"\u29B5",ohm:"\u03A9",oint:"\u222E",olarr:"\u21BA",olcir:"\u29BE",olcross:"\u29BB",oline:"\u203E",olt:"\u29C0",Omacr:"\u014C",omacr:"\u014D",Omega:"\u03A9",omega:"\u03C9",Omicron:"\u039F",omicron:"\u03BF",omid:"\u29B6",ominus:"\u2296",Oopf:"\u{1D546}",oopf:"\u{1D560}",opar:"\u29B7",OpenCurlyDoubleQuote:"\u201C",OpenCurlyQuote:"\u2018",operp:"\u29B9",oplus:"\u2295",Or:"\u2A54",or:"\u2228",orarr:"\u21BB",ord:"\u2A5D",order:"\u2134",orderof:"\u2134",ordf:"\xAA",ordm:"\xBA",origof:"\u22B6",oror:"\u2A56",orslope:"\u2A57",orv:"\u2A5B",oS:"\u24C8",Oscr:"\u{1D4AA}",oscr:"\u2134",Oslash:"\xD8",oslash:"\xF8",osol:"\u2298",Otilde:"\xD5",otilde:"\xF5",Otimes:"\u2A37",otimes:"\u2297",otimesas:"\u2A36",Ouml:"\xD6",ouml:"\xF6",ovbar:"\u233D",OverBar:"\u203E",OverBrace:"\u23DE",OverBracket:"\u23B4",OverParenthesis:"\u23DC",par:"\u2225",para:"\xB6",parallel:"\u2225",parsim:"\u2AF3",parsl:"\u2AFD",part:"\u2202",PartialD:"\u2202",Pcy:"\u041F",pcy:"\u043F",percnt:"%",period:".",permil:"\u2030",perp:"\u22A5",pertenk:"\u2031",Pfr:"\u{1D513}",pfr:"\u{1D52D}",Phi:"\u03A6",phi:"\u03C6",phiv:"\u03D5",phmmat:"\u2133",phone:"\u260E",Pi:"\u03A0",pi:"\u03C0",pitchfork:"\u22D4",piv:"\u03D6",planck:"\u210F",planckh:"\u210E",plankv:"\u210F",plus:"+",plusacir:"\u2A23",plusb:"\u229E",pluscir:"\u2A22",plusdo:"\u2214",plusdu:"\u2A25",pluse:"\u2A72",PlusMinus:"\xB1",plusmn:"\xB1",plussim:"\u2A26",plustwo:"\u2A27",pm:"\xB1",Poincareplane:"\u210C",pointint:"\u2A15",Popf:"\u2119",popf:"\u{1D561}",pound:"\xA3",Pr:"\u2ABB",pr:"\u227A",prap:"\u2AB7",prcue:"\u227C",prE:"\u2AB3",pre:"\u2AAF",prec:"\u227A",precapprox:"\u2AB7",preccurlyeq:"\u227C",Precedes:"\u227A",PrecedesEqual:"\u2AAF",PrecedesSlantEqual:"\u227C",PrecedesTilde:"\u227E",preceq:"\u2AAF",precnapprox:"\u2AB9",precneqq:"\u2AB5",precnsim:"\u22E8",precsim:"\u227E",Prime:"\u2033",prime:"\u2032",primes:"\u2119",prnap:"\u2AB9",prnE:"\u2AB5",prnsim:"\u22E8",prod:"\u220F",Product:"\u220F",profalar:"\u232E",profline:"\u2312",profsurf:"\u2313",prop:"\u221D",Proportion:"\u2237",Proportional:"\u221D",propto:"\u221D",prsim:"\u227E",prurel:"\u22B0",Pscr:"\u{1D4AB}",pscr:"\u{1D4C5}",Psi:"\u03A8",psi:"\u03C8",puncsp:"\u2008",Qfr:"\u{1D514}",qfr:"\u{1D52E}",qint:"\u2A0C",Qopf:"\u211A",qopf:"\u{1D562}",qprime:"\u2057",Qscr:"\u{1D4AC}",qscr:"\u{1D4C6}",quaternions:"\u210D",quatint:"\u2A16",quest:"?",questeq:"\u225F",QUOT:'"',quot:'"',rAarr:"\u21DB",race:"\u223D\u0331",Racute:"\u0154",racute:"\u0155",radic:"\u221A",raemptyv:"\u29B3",Rang:"\u27EB",rang:"\u27E9",rangd:"\u2992",range:"\u29A5",rangle:"\u27E9",raquo:"\xBB",Rarr:"\u21A0",rArr:"\u21D2",rarr:"\u2192",rarrap:"\u2975",rarrb:"\u21E5",rarrbfs:"\u2920",rarrc:"\u2933",rarrfs:"\u291E",rarrhk:"\u21AA",rarrlp:"\u21AC",rarrpl:"\u2945",rarrsim:"\u2974",Rarrtl:"\u2916",rarrtl:"\u21A3",rarrw:"\u219D",rAtail:"\u291C",ratail:"\u291A",ratio:"\u2236",rationals:"\u211A",RBarr:"\u2910",rBarr:"\u290F",rbarr:"\u290D",rbbrk:"\u2773",rbrace:"}",rbrack:"]",rbrke:"\u298C",rbrksld:"\u298E",rbrkslu:"\u2990",Rcaron:"\u0158",rcaron:"\u0159",Rcedil:"\u0156",rcedil:"\u0157",rceil:"\u2309",rcub:"}",Rcy:"\u0420",rcy:"\u0440",rdca:"\u2937",rdldhar:"\u2969",rdquo:"\u201D",rdquor:"\u201D",rdsh:"\u21B3",Re:"\u211C",real:"\u211C",realine:"\u211B",realpart:"\u211C",reals:"\u211D",rect:"\u25AD",REG:"\xAE",reg:"\xAE",ReverseElement:"\u220B",ReverseEquilibrium:"\u21CB",ReverseUpEquilibrium:"\u296F",rfisht:"\u297D",rfloor:"\u230B",Rfr:"\u211C",rfr:"\u{1D52F}",rHar:"\u2964",rhard:"\u21C1",rharu:"\u21C0",rharul:"\u296C",Rho:"\u03A1",rho:"\u03C1",rhov:"\u03F1",RightAngleBracket:"\u27E9",RightArrow:"\u2192",Rightarrow:"\u21D2",rightarrow:"\u2192",RightArrowBar:"\u21E5",RightArrowLeftArrow:"\u21C4",rightarrowtail:"\u21A3",RightCeiling:"\u2309",RightDoubleBracket:"\u27E7",RightDownTeeVector:"\u295D",RightDownVector:"\u21C2",RightDownVectorBar:"\u2955",RightFloor:"\u230B",rightharpoondown:"\u21C1",rightharpoonup:"\u21C0",rightleftarrows:"\u21C4",rightleftharpoons:"\u21CC",rightrightarrows:"\u21C9",rightsquigarrow:"\u219D",RightTee:"\u22A2",RightTeeArrow:"\u21A6",RightTeeVector:"\u295B",rightthreetimes:"\u22CC",RightTriangle:"\u22B3",RightTriangleBar:"\u29D0",RightTriangleEqual:"\u22B5",RightUpDownVector:"\u294F",RightUpTeeVector:"\u295C",RightUpVector:"\u21BE",RightUpVectorBar:"\u2954",RightVector:"\u21C0",RightVectorBar:"\u2953",ring:"\u02DA",risingdotseq:"\u2253",rlarr:"\u21C4",rlhar:"\u21CC",rlm:"\u200F",rmoust:"\u23B1",rmoustache:"\u23B1",rnmid:"\u2AEE",roang:"\u27ED",roarr:"\u21FE",robrk:"\u27E7",ropar:"\u2986",Ropf:"\u211D",ropf:"\u{1D563}",roplus:"\u2A2E",rotimes:"\u2A35",RoundImplies:"\u2970",rpar:")",rpargt:"\u2994",rppolint:"\u2A12",rrarr:"\u21C9",Rrightarrow:"\u21DB",rsaquo:"\u203A",Rscr:"\u211B",rscr:"\u{1D4C7}",Rsh:"\u21B1",rsh:"\u21B1",rsqb:"]",rsquo:"\u2019",rsquor:"\u2019",rthree:"\u22CC",rtimes:"\u22CA",rtri:"\u25B9",rtrie:"\u22B5",rtrif:"\u25B8",rtriltri:"\u29CE",RuleDelayed:"\u29F4",ruluhar:"\u2968",rx:"\u211E",Sacute:"\u015A",sacute:"\u015B",sbquo:"\u201A",Sc:"\u2ABC",sc:"\u227B",scap:"\u2AB8",Scaron:"\u0160",scaron:"\u0161",sccue:"\u227D",scE:"\u2AB4",sce:"\u2AB0",Scedil:"\u015E",scedil:"\u015F",Scirc:"\u015C",scirc:"\u015D",scnap:"\u2ABA",scnE:"\u2AB6",scnsim:"\u22E9",scpolint:"\u2A13",scsim:"\u227F",Scy:"\u0421",scy:"\u0441",sdot:"\u22C5",sdotb:"\u22A1",sdote:"\u2A66",searhk:"\u2925",seArr:"\u21D8",searr:"\u2198",searrow:"\u2198",sect:"\xA7",semi:";",seswar:"\u2929",setminus:"\u2216",setmn:"\u2216",sext:"\u2736",Sfr:"\u{1D516}",sfr:"\u{1D530}",sfrown:"\u2322",sharp:"\u266F",SHCHcy:"\u0429",shchcy:"\u0449",SHcy:"\u0428",shcy:"\u0448",ShortDownArrow:"\u2193",ShortLeftArrow:"\u2190",shortmid:"\u2223",shortparallel:"\u2225",ShortRightArrow:"\u2192",ShortUpArrow:"\u2191",shy:"\xAD",Sigma:"\u03A3",sigma:"\u03C3",sigmaf:"\u03C2",sigmav:"\u03C2",sim:"\u223C",simdot:"\u2A6A",sime:"\u2243",simeq:"\u2243",simg:"\u2A9E",simgE:"\u2AA0",siml:"\u2A9D",simlE:"\u2A9F",simne:"\u2246",simplus:"\u2A24",simrarr:"\u2972",slarr:"\u2190",SmallCircle:"\u2218",smallsetminus:"\u2216",smashp:"\u2A33",smeparsl:"\u29E4",smid:"\u2223",smile:"\u2323",smt:"\u2AAA",smte:"\u2AAC",smtes:"\u2AAC\uFE00",SOFTcy:"\u042C",softcy:"\u044C",sol:"/",solb:"\u29C4",solbar:"\u233F",Sopf:"\u{1D54A}",sopf:"\u{1D564}",spades:"\u2660",spadesuit:"\u2660",spar:"\u2225",sqcap:"\u2293",sqcaps:"\u2293\uFE00",sqcup:"\u2294",sqcups:"\u2294\uFE00",Sqrt:"\u221A",sqsub:"\u228F",sqsube:"\u2291",sqsubset:"\u228F",sqsubseteq:"\u2291",sqsup:"\u2290",sqsupe:"\u2292",sqsupset:"\u2290",sqsupseteq:"\u2292",squ:"\u25A1",Square:"\u25A1",square:"\u25A1",SquareIntersection:"\u2293",SquareSubset:"\u228F",SquareSubsetEqual:"\u2291",SquareSuperset:"\u2290",SquareSupersetEqual:"\u2292",SquareUnion:"\u2294",squarf:"\u25AA",squf:"\u25AA",srarr:"\u2192",Sscr:"\u{1D4AE}",sscr:"\u{1D4C8}",ssetmn:"\u2216",ssmile:"\u2323",sstarf:"\u22C6",Star:"\u22C6",star:"\u2606",starf:"\u2605",straightepsilon:"\u03F5",straightphi:"\u03D5",strns:"\xAF",Sub:"\u22D0",sub:"\u2282",subdot:"\u2ABD",subE:"\u2AC5",sube:"\u2286",subedot:"\u2AC3",submult:"\u2AC1",subnE:"\u2ACB",subne:"\u228A",subplus:"\u2ABF",subrarr:"\u2979",Subset:"\u22D0",subset:"\u2282",subseteq:"\u2286",subseteqq:"\u2AC5",SubsetEqual:"\u2286",subsetneq:"\u228A",subsetneqq:"\u2ACB",subsim:"\u2AC7",subsub:"\u2AD5",subsup:"\u2AD3",succ:"\u227B",succapprox:"\u2AB8",succcurlyeq:"\u227D",Succeeds:"\u227B",SucceedsEqual:"\u2AB0",SucceedsSlantEqual:"\u227D",SucceedsTilde:"\u227F",succeq:"\u2AB0",succnapprox:"\u2ABA",succneqq:"\u2AB6",succnsim:"\u22E9",succsim:"\u227F",SuchThat:"\u220B",Sum:"\u2211",sum:"\u2211",sung:"\u266A",Sup:"\u22D1",sup:"\u2283",sup1:"\xB9",sup2:"\xB2",sup3:"\xB3",supdot:"\u2ABE",supdsub:"\u2AD8",supE:"\u2AC6",supe:"\u2287",supedot:"\u2AC4",Superset:"\u2283",SupersetEqual:"\u2287",suphsol:"\u27C9",suphsub:"\u2AD7",suplarr:"\u297B",supmult:"\u2AC2",supnE:"\u2ACC",supne:"\u228B",supplus:"\u2AC0",Supset:"\u22D1",supset:"\u2283",supseteq:"\u2287",supseteqq:"\u2AC6",supsetneq:"\u228B",supsetneqq:"\u2ACC",supsim:"\u2AC8",supsub:"\u2AD4",supsup:"\u2AD6",swarhk:"\u2926",swArr:"\u21D9",swarr:"\u2199",swarrow:"\u2199",swnwar:"\u292A",szlig:"\xDF",Tab:" ",target:"\u2316",Tau:"\u03A4",tau:"\u03C4",tbrk:"\u23B4",Tcaron:"\u0164",tcaron:"\u0165",Tcedil:"\u0162",tcedil:"\u0163",Tcy:"\u0422",tcy:"\u0442",tdot:"\u20DB",telrec:"\u2315",Tfr:"\u{1D517}",tfr:"\u{1D531}",there4:"\u2234",Therefore:"\u2234",therefore:"\u2234",Theta:"\u0398",theta:"\u03B8",thetasym:"\u03D1",thetav:"\u03D1",thickapprox:"\u2248",thicksim:"\u223C",ThickSpace:"\u205F\u200A",thinsp:"\u2009",ThinSpace:"\u2009",thkap:"\u2248",thksim:"\u223C",THORN:"\xDE",thorn:"\xFE",Tilde:"\u223C",tilde:"\u02DC",TildeEqual:"\u2243",TildeFullEqual:"\u2245",TildeTilde:"\u2248",times:"\xD7",timesb:"\u22A0",timesbar:"\u2A31",timesd:"\u2A30",tint:"\u222D",toea:"\u2928",top:"\u22A4",topbot:"\u2336",topcir:"\u2AF1",Topf:"\u{1D54B}",topf:"\u{1D565}",topfork:"\u2ADA",tosa:"\u2929",tprime:"\u2034",TRADE:"\u2122",trade:"\u2122",triangle:"\u25B5",triangledown:"\u25BF",triangleleft:"\u25C3",trianglelefteq:"\u22B4",triangleq:"\u225C",triangleright:"\u25B9",trianglerighteq:"\u22B5",tridot:"\u25EC",trie:"\u225C",triminus:"\u2A3A",TripleDot:"\u20DB",triplus:"\u2A39",trisb:"\u29CD",tritime:"\u2A3B",trpezium:"\u23E2",Tscr:"\u{1D4AF}",tscr:"\u{1D4C9}",TScy:"\u0426",tscy:"\u0446",TSHcy:"\u040B",tshcy:"\u045B",Tstrok:"\u0166",tstrok:"\u0167",twixt:"\u226C",twoheadleftarrow:"\u219E",twoheadrightarrow:"\u21A0",Uacute:"\xDA",uacute:"\xFA",Uarr:"\u219F",uArr:"\u21D1",uarr:"\u2191",Uarrocir:"\u2949",Ubrcy:"\u040E",ubrcy:"\u045E",Ubreve:"\u016C",ubreve:"\u016D",Ucirc:"\xDB",ucirc:"\xFB",Ucy:"\u0423",ucy:"\u0443",udarr:"\u21C5",Udblac:"\u0170",udblac:"\u0171",udhar:"\u296E",ufisht:"\u297E",Ufr:"\u{1D518}",ufr:"\u{1D532}",Ugrave:"\xD9",ugrave:"\xF9",uHar:"\u2963",uharl:"\u21BF",uharr:"\u21BE",uhblk:"\u2580",ulcorn:"\u231C",ulcorner:"\u231C",ulcrop:"\u230F",ultri:"\u25F8",Umacr:"\u016A",umacr:"\u016B",uml:"\xA8",UnderBar:"_",UnderBrace:"\u23DF",UnderBracket:"\u23B5",UnderParenthesis:"\u23DD",Union:"\u22C3",UnionPlus:"\u228E",Uogon:"\u0172",uogon:"\u0173",Uopf:"\u{1D54C}",uopf:"\u{1D566}",UpArrow:"\u2191",Uparrow:"\u21D1",uparrow:"\u2191",UpArrowBar:"\u2912",UpArrowDownArrow:"\u21C5",UpDownArrow:"\u2195",Updownarrow:"\u21D5",updownarrow:"\u2195",UpEquilibrium:"\u296E",upharpoonleft:"\u21BF",upharpoonright:"\u21BE",uplus:"\u228E",UpperLeftArrow:"\u2196",UpperRightArrow:"\u2197",Upsi:"\u03D2",upsi:"\u03C5",upsih:"\u03D2",Upsilon:"\u03A5",upsilon:"\u03C5",UpTee:"\u22A5",UpTeeArrow:"\u21A5",upuparrows:"\u21C8",urcorn:"\u231D",urcorner:"\u231D",urcrop:"\u230E",Uring:"\u016E",uring:"\u016F",urtri:"\u25F9",Uscr:"\u{1D4B0}",uscr:"\u{1D4CA}",utdot:"\u22F0",Utilde:"\u0168",utilde:"\u0169",utri:"\u25B5",utrif:"\u25B4",uuarr:"\u21C8",Uuml:"\xDC",uuml:"\xFC",uwangle:"\u29A7",vangrt:"\u299C",varepsilon:"\u03F5",varkappa:"\u03F0",varnothing:"\u2205",varphi:"\u03D5",varpi:"\u03D6",varpropto:"\u221D",vArr:"\u21D5",varr:"\u2195",varrho:"\u03F1",varsigma:"\u03C2",varsubsetneq:"\u228A\uFE00",varsubsetneqq:"\u2ACB\uFE00",varsupsetneq:"\u228B\uFE00",varsupsetneqq:"\u2ACC\uFE00",vartheta:"\u03D1",vartriangleleft:"\u22B2",vartriangleright:"\u22B3",Vbar:"\u2AEB",vBar:"\u2AE8",vBarv:"\u2AE9",Vcy:"\u0412",vcy:"\u0432",VDash:"\u22AB",Vdash:"\u22A9",vDash:"\u22A8",vdash:"\u22A2",Vdashl:"\u2AE6",Vee:"\u22C1",vee:"\u2228",veebar:"\u22BB",veeeq:"\u225A",vellip:"\u22EE",Verbar:"\u2016",verbar:"|",Vert:"\u2016",vert:"|",VerticalBar:"\u2223",VerticalLine:"|",VerticalSeparator:"\u2758",VerticalTilde:"\u2240",VeryThinSpace:"\u200A",Vfr:"\u{1D519}",vfr:"\u{1D533}",vltri:"\u22B2",vnsub:"\u2282\u20D2",vnsup:"\u2283\u20D2",Vopf:"\u{1D54D}",vopf:"\u{1D567}",vprop:"\u221D",vrtri:"\u22B3",Vscr:"\u{1D4B1}",vscr:"\u{1D4CB}",vsubnE:"\u2ACB\uFE00",vsubne:"\u228A\uFE00",vsupnE:"\u2ACC\uFE00",vsupne:"\u228B\uFE00",Vvdash:"\u22AA",vzigzag:"\u299A",Wcirc:"\u0174",wcirc:"\u0175",wedbar:"\u2A5F",Wedge:"\u22C0",wedge:"\u2227",wedgeq:"\u2259",weierp:"\u2118",Wfr:"\u{1D51A}",wfr:"\u{1D534}",Wopf:"\u{1D54E}",wopf:"\u{1D568}",wp:"\u2118",wr:"\u2240",wreath:"\u2240",Wscr:"\u{1D4B2}",wscr:"\u{1D4CC}",xcap:"\u22C2",xcirc:"\u25EF",xcup:"\u22C3",xdtri:"\u25BD",Xfr:"\u{1D51B}",xfr:"\u{1D535}",xhArr:"\u27FA",xharr:"\u27F7",Xi:"\u039E",xi:"\u03BE",xlArr:"\u27F8",xlarr:"\u27F5",xmap:"\u27FC",xnis:"\u22FB",xodot:"\u2A00",Xopf:"\u{1D54F}",xopf:"\u{1D569}",xoplus:"\u2A01",xotime:"\u2A02",xrArr:"\u27F9",xrarr:"\u27F6",Xscr:"\u{1D4B3}",xscr:"\u{1D4CD}",xsqcup:"\u2A06",xuplus:"\u2A04",xutri:"\u25B3",xvee:"\u22C1",xwedge:"\u22C0",Yacute:"\xDD",yacute:"\xFD",YAcy:"\u042F",yacy:"\u044F",Ycirc:"\u0176",ycirc:"\u0177",Ycy:"\u042B",ycy:"\u044B",yen:"\xA5",Yfr:"\u{1D51C}",yfr:"\u{1D536}",YIcy:"\u0407",yicy:"\u0457",Yopf:"\u{1D550}",yopf:"\u{1D56A}",Yscr:"\u{1D4B4}",yscr:"\u{1D4CE}",YUcy:"\u042E",yucy:"\u044E",Yuml:"\u0178",yuml:"\xFF",Zacute:"\u0179",zacute:"\u017A",Zcaron:"\u017D",zcaron:"\u017E",Zcy:"\u0417",zcy:"\u0437",Zdot:"\u017B",zdot:"\u017C",zeetrf:"\u2128",ZeroWidthSpace:"\u200B",Zeta:"\u0396",zeta:"\u03B6",Zfr:"\u2128",zfr:"\u{1D537}",ZHcy:"\u0416",zhcy:"\u0436",zigrarr:"\u21DD",Zopf:"\u2124",zopf:"\u{1D56B}",Zscr:"\u{1D4B5}",zscr:"\u{1D4CF}",zwj:"\u200D",zwnj:"\u200C"});af.entityMap=af.HTML_ENTITIES});var GC=Xt(Hg=>{"use strict";B();var Su=cl(),Gt=ex(),LC=Zd(),Qk=Su.isHTMLEscapableRawTextElement,Jk=Su.isHTMLMimeType,t_=Su.isHTMLRawTextElement,uf=Su.hasOwn,OC=Su.NAMESPACE,FC=LC.ParseError,e_=LC.DOMException,of=0,eo=1,Cu=2,lf=3,Eu=4,Tu=5,cf=6,Gg=7;function BC(){}BC.prototype={parse:function(r,t,e){var n=this.domBuilder;n.startDocument(),UC(t,t=Object.create(null)),n_(r,t,e,n,this.errorHandler),n.endDocument()}};var ux=/&#?\w+;?/g;function n_(r,t,e,n,i){var s=Jk(n.mimeType);r.indexOf(Gt.UNICODE_REPLACEMENT_CHARACTER)>=0&&i.warning("Unicode replacement character detected, source encoding issues?");function a(_){if(_>65535){_-=65536;var W=55296+(_>>10),z=56320+(_&1023);return String.fromCharCode(W,z)}else return String.fromCharCode(_)}function l(_){var W=_[_.length-1]===";"?_:_+";";if(!s&&W!==_)return i.error("EntityRef: expecting ;"),_;var z=Gt.Reference.exec(W);if(!z||z[0].length!==W.length)return i.error("entity not matching Reference production: "+_),_;var D=W.slice(1,-1);return uf(e,D)?e[D]:D.charAt(0)==="#"?a(parseInt(D.substring(1).replace("x","0x"))):(i.error("entity not found:"+_),_)}function c(_){if(_>x){var W=r.substring(x,_).replace(ux,l);f&&p(x),n.characters(W,0,_-x),x=_}}var u=0,h=0,d=/\r\n?|\n|$/g,f=n.locator;function p(_,W){for(;_>=h&&(W=d.exec(r));)u=h,h=W.index+W[0].length,f.lineNumber++;f.columnNumber=_-u+1}for(var m=[{currentNSMap:t}],y=[],x=0;;){try{var b=r.indexOf("<",x);if(b<0){if(!s&&y.length>0)return i.fatalError("unclosed xml tag(s): "+y.join(", "));if(!r.substring(x).match(/^\s*$/)){var w=n.doc,C=w.createTextNode(r.substring(x));if(w.documentElement)return i.error("Extra content at the end of the document");w.appendChild(C),n.currentElement=C}return}if(b>x){var E=r.substring(x,b);!s&&y.length===0&&(E=E.replace(new RegExp(Gt.S_OPT.source,"g"),""),E&&i.error("Unexpected content outside root element: '"+E+"'")),c(b)}switch(r.charAt(b+1)){case"/":var Z=r.indexOf(">",b+2),S=r.substring(b+2,Z>0?Z:void 0);if(!S)return i.fatalError("end tag name missing");var N=Z>0&&Gt.reg("^",Gt.QName_group,Gt.S_OPT,"$").exec(S);if(!N)return i.fatalError('end tag name contains invalid characters: "'+S+'"');if(!n.currentElement&&!n.doc.documentElement)return;var k=y[y.length-1]||n.currentElement.tagName||n.doc.documentElement.tagName||"";if(k!==N[1]){var M=N[1].toLowerCase();if(!s||k.toLowerCase()!==M)return i.fatalError('Opening and ending tag mismatch: "'+k+'" != "'+S+'"')}var R=m.pop();y.pop();var j=R.localNSMap;if(n.endElement(R.uri,R.localName,k),j)for(var $ in j)uf(j,$)&&n.endPrefixMapping($);Z++;break;case"?":f&&p(b),Z=a_(r,b,n,i);break;case"!":f&&p(b),Z=zC(r,b,n,i,s);break;default:f&&p(b);var q=new jC,Q=m[m.length-1].currentNSMap,Z=i_(r,b,q,Q,l,i,s),Y=q.length;if(q.closed||(s&&Su.isHTMLVoidElement(q.tagName)?q.closed=!0:y.push(q.tagName)),f&&Y){for(var X=PC(f,{}),T=0;T<Y;T++){var I=q[T];p(I.offset),I.locator=PC(f,{})}n.locator=X,RC(q,n,Q)&&m.push(q),n.locator=f}else RC(q,n,Q)&&m.push(q);s&&!q.closed?Z=r_(r,Z,q.tagName,l,n):Z++}}catch(_){if(_ instanceof FC)throw _;if(_ instanceof e_)throw new FC(_.name+": "+_.message,n.locator,_);i.error("element parse error: "+_),Z=-1}Z>x?x=Z:c(Math.max(b,x)+1)}}function PC(r,t){return t.lineNumber=r.lineNumber,t.columnNumber=r.columnNumber,t}function i_(r,t,e,n,i,s,a){function l(p,m,y){if(uf(e.attributeNames,p))return s.fatalError("Attribute "+p+" redefined");if(!a&&m.indexOf("<")>=0)return s.fatalError("Unescaped '<' not allowed in attributes values");e.addValue(p,m.replace(/[\t\n\r]/g," ").replace(ux,i),y)}for(var c,u,h=++t,d=of;;){var f=r.charAt(h);switch(f){case"=":if(d===eo)c=r.slice(t,h),d=lf;else if(d===Cu)d=lf;else throw new Error("attribute equal must after attrName");break;case"'":case'"':if(d===lf||d===eo)if(d===eo&&(s.warning('attribute value must after "="'),c=r.slice(t,h)),t=h+1,h=r.indexOf(f,t),h>0)u=r.slice(t,h),l(c,u,t-1),d=Tu;else throw new Error("attribute value no end '"+f+"' match");else if(d==Eu)u=r.slice(t,h),l(c,u,t),s.warning('attribute "'+c+'" missed start quot('+f+")!!"),t=h+1,d=Tu;else throw new Error('attribute value must after "="');break;case"/":switch(d){case of:e.setTagName(r.slice(t,h));case Tu:case cf:case Gg:d=Gg,e.closed=!0;case Eu:case eo:break;case Cu:e.closed=!0;break;default:throw new Error("attribute invalid close char('/')")}break;case"":return s.error("unexpected end of input"),d==of&&e.setTagName(r.slice(t,h)),h;case">":switch(d){case of:e.setTagName(r.slice(t,h));case Tu:case cf:case Gg:break;case Eu:case eo:u=r.slice(t,h),u.slice(-1)==="/"&&(e.closed=!0,u=u.slice(0,-1));case Cu:d===Cu&&(u=c),d==Eu?(s.warning('attribute "'+u+'" missed quot(")!'),l(c,u,t)):(a||s.warning('attribute "'+u+'" missed value!! "'+u+'" instead!!'),l(u,u,t));break;case lf:if(!a)return s.fatalError(`AttValue: ' or " expected`)}return h;case"\x80":f=" ";default:if(f<=" ")switch(d){case of:e.setTagName(r.slice(t,h)),d=cf;break;case eo:c=r.slice(t,h),d=Cu;break;case Eu:var u=r.slice(t,h);s.warning('attribute "'+u+'" missed quot(")!!'),l(c,u,t);case Tu:d=cf;break}else switch(d){case Cu:a||s.warning('attribute "'+c+'" missed value!! "'+c+'" instead2!!'),l(c,c,t),t=h,d=eo;break;case Tu:s.warning('attribute space is required"'+c+'"!!');case cf:d=eo,t=h;break;case lf:d=Eu,t=h;break;case Gg:throw new Error("elements closed character '/' and '>' must be connected to")}}h++}}function RC(r,t,e){for(var n=r.tagName,i=null,d=r.length;d--;){var s=r[d],a=s.qName,l=s.value,f=a.indexOf(":");if(f>0)var c=s.prefix=a.slice(0,f),u=a.slice(f+1),h=c==="xmlns"&&u;else u=a,c=null,h=a==="xmlns"&&"";s.localName=u,h!==!1&&(i==null&&(i=Object.create(null),UC(e,e=Object.create(null))),e[h]=i[h]=l,s.uri=OC.XMLNS,t.startPrefixMapping(h,l))}for(var d=r.length;d--;)s=r[d],s.prefix&&(s.prefix==="xml"&&(s.uri=OC.XML),s.prefix!=="xmlns"&&(s.uri=e[s.prefix]));var f=n.indexOf(":");f>0?(c=r.prefix=n.slice(0,f),u=r.localName=n.slice(f+1)):(c=null,u=r.localName=n);var p=r.uri=e[c||""];if(t.startElement(p,u,n,r),r.closed){if(t.endElement(p,u,n),i)for(c in i)uf(i,c)&&t.endPrefixMapping(c)}else return r.currentNSMap=e,r.localNSMap=i,!0}function r_(r,t,e,n,i){var s=Qk(e);if(s||t_(e)){var a=r.indexOf("</"+e+">",t),l=r.substring(t+1,a);return s&&(l=l.replace(ux,n)),i.characters(l,0,l.length),a}return t+1}function UC(r,t){for(var e in r)uf(r,e)&&(t[e]=r[e])}function $C(r,t){var e=t;function n(h){return h=h||0,r.charAt(e+h)}function i(h){h=h||1,e+=h}function s(){for(var h=0;e<r.length;){var d=n();if(d!==" "&&d!==`
|
|
8
|
-
`&&d!==" "&&d!=="\r")return h;h++,i()}return-1}function a(){return r.substring(e)}function l(h){return r.substring(e,e+h.length)===h}function c(h){return r.substring(e,e+h.length).toUpperCase()===h.toUpperCase()}function u(h){var d=Gt.reg("^",h),f=d.exec(a());return f?(i(f[0].length),f[0]):null}return{char:n,getIndex:function(){return e},getMatch:u,getSource:function(){return r},skip:i,skipBlanks:s,substringFromIndex:a,substringStartsWith:l,substringStartsWithCaseInsensitive:c}}function s_(r,t){function e(l,c){var u=Gt.PI.exec(l.substringFromIndex());return u?u[1].toLowerCase()==="xml"?c.fatalError("xml declaration is only allowed at the start of the document, but found at position "+l.getIndex()):(l.skip(u[0].length),u[0]):c.fatalError("processing instruction is not well-formed at position "+l.getIndex())}var n=r.getSource();if(r.char()==="["){r.skip(1);for(var i=r.getIndex();r.getIndex()<n.length;){if(r.skipBlanks(),r.char()==="]"){var s=n.substring(i,r.getIndex());return r.skip(1),s}var a=null;if(r.char()==="<"&&r.char(1)==="!")switch(r.char(2)){case"E":r.char(3)==="L"?a=r.getMatch(Gt.elementdecl):r.char(3)==="N"&&(a=r.getMatch(Gt.EntityDecl));break;case"A":a=r.getMatch(Gt.AttlistDecl);break;case"N":a=r.getMatch(Gt.NotationDecl);break;case"-":a=r.getMatch(Gt.Comment);break}else if(r.char()==="<"&&r.char(1)==="?")a=e(r,t);else if(r.char()==="%")a=r.getMatch(Gt.PEReference);else return t.fatalError("Error detected in Markup declaration");if(!a)return t.fatalError("Error in internal subset at position "+r.getIndex())}return t.fatalError("doctype internal subset is not well-formed, missing ]")}}function
|
|
6
|
+
var rN=Object.create;var og=Object.defineProperty;var sN=Object.getOwnPropertyDescriptor;var aN=Object.getOwnPropertyNames;var oN=Object.getPrototypeOf,lN=Object.prototype.hasOwnProperty;var M2=r=>{throw TypeError(r)};var cN=(r,t,e)=>t in r?og(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e;var iu=(r=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(r,{get:(t,e)=>(typeof require<"u"?require:t)[e]}):r)(function(r){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+r+'" is not supported')});var ne=(r,t)=>()=>(r&&(t=r(r=0)),t);var Xt=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports),lg=(r,t)=>{for(var e in t)og(r,e,{get:t[e],enumerable:!0})},uN=(r,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of aN(t))!lN.call(r,i)&&i!==e&&og(r,i,{get:()=>t[i],enumerable:!(n=sN(t,i))||n.enumerable});return r};var ru=(r,t,e)=>(e=r!=null?rN(oN(r)):{},uN(t||!r||!r.__esModule?og(e,"default",{value:r,enumerable:!0}):e,r));var U=(r,t,e)=>cN(r,typeof t!="symbol"?t+"":t,e),bb=(r,t,e)=>t.has(r)||M2("Cannot "+e);var o=(r,t,e)=>(bb(r,t,"read from private field"),e?e.call(r):t.get(r)),A=(r,t,e)=>t.has(r)?M2("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(r):t.set(r,e),g=(r,t,e,n)=>(bb(r,t,"write to private field"),n?n.call(r,e):t.set(r,e),e),v=(r,t,e)=>(bb(r,t,"access private method"),e);var an=(r,t,e,n)=>({set _(i){g(r,t,i,e)},get _(){return o(r,t,n)}});var P2=Xt(cg=>{"use strict";B();cg.byteLength=dN;cg.toByteArray=pN;cg.fromByteArray=yN;var ts=[],nr=[],hN=typeof Uint8Array<"u"?Uint8Array:Array,xb="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(sl=0,O2=xb.length;sl<O2;++sl)ts[sl]=xb[sl],nr[xb.charCodeAt(sl)]=sl;var sl,O2;nr[45]=62;nr[95]=63;function F2(r){var t=r.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var e=r.indexOf("=");e===-1&&(e=t);var n=e===t?0:4-e%4;return[e,n]}function dN(r){var t=F2(r),e=t[0],n=t[1];return(e+n)*3/4-n}function fN(r,t,e){return(t+e)*3/4-e}function pN(r){var t,e=F2(r),n=e[0],i=e[1],s=new hN(fN(r,n,i)),a=0,l=i>0?n-4:n,c;for(c=0;c<l;c+=4)t=nr[r.charCodeAt(c)]<<18|nr[r.charCodeAt(c+1)]<<12|nr[r.charCodeAt(c+2)]<<6|nr[r.charCodeAt(c+3)],s[a++]=t>>16&255,s[a++]=t>>8&255,s[a++]=t&255;return i===2&&(t=nr[r.charCodeAt(c)]<<2|nr[r.charCodeAt(c+1)]>>4,s[a++]=t&255),i===1&&(t=nr[r.charCodeAt(c)]<<10|nr[r.charCodeAt(c+1)]<<4|nr[r.charCodeAt(c+2)]>>2,s[a++]=t>>8&255,s[a++]=t&255),s}function mN(r){return ts[r>>18&63]+ts[r>>12&63]+ts[r>>6&63]+ts[r&63]}function gN(r,t,e){for(var n,i=[],s=t;s<e;s+=3)n=(r[s]<<16&16711680)+(r[s+1]<<8&65280)+(r[s+2]&255),i.push(mN(n));return i.join("")}function yN(r){for(var t,e=r.length,n=e%3,i=[],s=16383,a=0,l=e-n;a<l;a+=s)i.push(gN(r,a,a+s>l?l:a+s));return n===1?(t=r[e-1],i.push(ts[t>>2]+ts[t<<4&63]+"==")):n===2&&(t=(r[e-2]<<8)+r[e-1],i.push(ts[t>>10]+ts[t>>4&63]+ts[t<<2&63]+"=")),i.join("")}});var Ab=Xt(wb=>{B();wb.read=function(r,t,e,n,i){var s,a,l=i*8-n-1,c=(1<<l)-1,u=c>>1,h=-7,d=e?i-1:0,f=e?-1:1,p=r[t+d];for(d+=f,s=p&(1<<-h)-1,p>>=-h,h+=l;h>0;s=s*256+r[t+d],d+=f,h-=8);for(a=s&(1<<-h)-1,s>>=-h,h+=n;h>0;a=a*256+r[t+d],d+=f,h-=8);if(s===0)s=1-u;else{if(s===c)return a?NaN:(p?-1:1)*(1/0);a=a+Math.pow(2,n),s=s-u}return(p?-1:1)*a*Math.pow(2,s-n)};wb.write=function(r,t,e,n,i,s){var a,l,c,u=s*8-i-1,h=(1<<u)-1,d=h>>1,f=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:s-1,m=n?1:-1,y=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(l=isNaN(t)?1:0,a=h):(a=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-a))<1&&(a--,c*=2),a+d>=1?t+=f/c:t+=f*Math.pow(2,1-d),t*c>=2&&(a++,c/=2),a+d>=h?(l=0,a=h):a+d>=1?(l=(t*c-1)*Math.pow(2,i),a=a+d):(l=t*Math.pow(2,d-1)*Math.pow(2,i),a=0));i>=8;r[e+p]=l&255,p+=m,l/=256,i-=8);for(a=a<<i|l,u+=i;u>0;r[e+p]=a&255,p+=m,a/=256,u-=8);r[e+p-m]|=y*128}});var Q2=Xt(lu=>{"use strict";B();var vb=P2(),au=Ab(),R2=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;lu.Buffer=it;lu.SlowBuffer=CN;lu.INSPECT_MAX_BYTES=50;var ug=2147483647;lu.kMaxLength=ug;it.TYPED_ARRAY_SUPPORT=bN();!it.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function bN(){try{let r=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(r,t),r.foo()===42}catch{return!1}}Object.defineProperty(it.prototype,"parent",{enumerable:!0,get:function(){if(it.isBuffer(this))return this.buffer}});Object.defineProperty(it.prototype,"offset",{enumerable:!0,get:function(){if(it.isBuffer(this))return this.byteOffset}});function zs(r){if(r>ug)throw new RangeError('The value "'+r+'" is invalid for option "size"');let t=new Uint8Array(r);return Object.setPrototypeOf(t,it.prototype),t}function it(r,t,e){if(typeof r=="number"){if(typeof t=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return Sb(r)}return $2(r,t,e)}it.poolSize=8192;function $2(r,t,e){if(typeof r=="string")return wN(r,t);if(ArrayBuffer.isView(r))return AN(r);if(r==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof r);if(es(r,ArrayBuffer)||r&&es(r.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(es(r,SharedArrayBuffer)||r&&es(r.buffer,SharedArrayBuffer)))return Eb(r,t,e);if(typeof r=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let n=r.valueOf&&r.valueOf();if(n!=null&&n!==r)return it.from(n,t,e);let i=vN(r);if(i)return i;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof r[Symbol.toPrimitive]=="function")return it.from(r[Symbol.toPrimitive]("string"),t,e);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof r)}it.from=function(r,t,e){return $2(r,t,e)};Object.setPrototypeOf(it.prototype,Uint8Array.prototype);Object.setPrototypeOf(it,Uint8Array);function z2(r){if(typeof r!="number")throw new TypeError('"size" argument must be of type number');if(r<0)throw new RangeError('The value "'+r+'" is invalid for option "size"')}function xN(r,t,e){return z2(r),r<=0?zs(r):t!==void 0?typeof e=="string"?zs(r).fill(t,e):zs(r).fill(t):zs(r)}it.alloc=function(r,t,e){return xN(r,t,e)};function Sb(r){return z2(r),zs(r<0?0:Db(r)|0)}it.allocUnsafe=function(r){return Sb(r)};it.allocUnsafeSlow=function(r){return Sb(r)};function wN(r,t){if((typeof t!="string"||t==="")&&(t="utf8"),!it.isEncoding(t))throw new TypeError("Unknown encoding: "+t);let e=j2(r,t)|0,n=zs(e),i=n.write(r,t);return i!==e&&(n=n.slice(0,i)),n}function Cb(r){let t=r.length<0?0:Db(r.length)|0,e=zs(t);for(let n=0;n<t;n+=1)e[n]=r[n]&255;return e}function AN(r){if(es(r,Uint8Array)){let t=new Uint8Array(r);return Eb(t.buffer,t.byteOffset,t.byteLength)}return Cb(r)}function Eb(r,t,e){if(t<0||r.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(r.byteLength<t+(e||0))throw new RangeError('"length" is outside of buffer bounds');let n;return t===void 0&&e===void 0?n=new Uint8Array(r):e===void 0?n=new Uint8Array(r,t):n=new Uint8Array(r,t,e),Object.setPrototypeOf(n,it.prototype),n}function vN(r){if(it.isBuffer(r)){let t=Db(r.length)|0,e=zs(t);return e.length===0||r.copy(e,0,0,t),e}if(r.length!==void 0)return typeof r.length!="number"||Ib(r.length)?zs(0):Cb(r);if(r.type==="Buffer"&&Array.isArray(r.data))return Cb(r.data)}function Db(r){if(r>=ug)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+ug.toString(16)+" bytes");return r|0}function CN(r){return+r!=r&&(r=0),it.alloc(+r)}it.isBuffer=function(t){return t!=null&&t._isBuffer===!0&&t!==it.prototype};it.compare=function(t,e){if(es(t,Uint8Array)&&(t=it.from(t,t.offset,t.byteLength)),es(e,Uint8Array)&&(e=it.from(e,e.offset,e.byteLength)),!it.isBuffer(t)||!it.isBuffer(e))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===e)return 0;let n=t.length,i=e.length;for(let s=0,a=Math.min(n,i);s<a;++s)if(t[s]!==e[s]){n=t[s],i=e[s];break}return n<i?-1:i<n?1:0};it.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}};it.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(t.length===0)return it.alloc(0);let n;if(e===void 0)for(e=0,n=0;n<t.length;++n)e+=t[n].length;let i=it.allocUnsafe(e),s=0;for(n=0;n<t.length;++n){let a=t[n];if(es(a,Uint8Array))s+a.length>i.length?(it.isBuffer(a)||(a=it.from(a)),a.copy(i,s)):Uint8Array.prototype.set.call(i,a,s);else if(it.isBuffer(a))a.copy(i,s);else throw new TypeError('"list" argument must be an Array of Buffers');s+=a.length}return i};function j2(r,t){if(it.isBuffer(r))return r.length;if(ArrayBuffer.isView(r)||es(r,ArrayBuffer))return r.byteLength;if(typeof r!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof r);let e=r.length,n=arguments.length>2&&arguments[2]===!0;if(!n&&e===0)return 0;let i=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return e;case"utf8":case"utf-8":return Tb(r).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return e*2;case"hex":return e>>>1;case"base64":return Z2(r).length;default:if(i)return n?-1:Tb(r).length;t=(""+t).toLowerCase(),i=!0}}it.byteLength=j2;function EN(r,t,e){let n=!1;if((t===void 0||t<0)&&(t=0),t>this.length||((e===void 0||e>this.length)&&(e=this.length),e<=0)||(e>>>=0,t>>>=0,e<=t))return"";for(r||(r="utf8");;)switch(r){case"hex":return FN(this,t,e);case"utf8":case"utf-8":return H2(this,t,e);case"ascii":return MN(this,t,e);case"latin1":case"binary":return ON(this,t,e);case"base64":return kN(this,t,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return PN(this,t,e);default:if(n)throw new TypeError("Unknown encoding: "+r);r=(r+"").toLowerCase(),n=!0}}it.prototype._isBuffer=!0;function al(r,t,e){let n=r[t];r[t]=r[e],r[e]=n}it.prototype.swap16=function(){let t=this.length;if(t%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let e=0;e<t;e+=2)al(this,e,e+1);return this};it.prototype.swap32=function(){let t=this.length;if(t%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let e=0;e<t;e+=4)al(this,e,e+3),al(this,e+1,e+2);return this};it.prototype.swap64=function(){let t=this.length;if(t%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let e=0;e<t;e+=8)al(this,e,e+7),al(this,e+1,e+6),al(this,e+2,e+5),al(this,e+3,e+4);return this};it.prototype.toString=function(){let t=this.length;return t===0?"":arguments.length===0?H2(this,0,t):EN.apply(this,arguments)};it.prototype.toLocaleString=it.prototype.toString;it.prototype.equals=function(t){if(!it.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t?!0:it.compare(this,t)===0};it.prototype.inspect=function(){let t="",e=lu.INSPECT_MAX_BYTES;return t=this.toString("hex",0,e).replace(/(.{2})/g,"$1 ").trim(),this.length>e&&(t+=" ... "),"<Buffer "+t+">"};R2&&(it.prototype[R2]=it.prototype.inspect);it.prototype.compare=function(t,e,n,i,s){if(es(t,Uint8Array)&&(t=it.from(t,t.offset,t.byteLength)),!it.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(e===void 0&&(e=0),n===void 0&&(n=t?t.length:0),i===void 0&&(i=0),s===void 0&&(s=this.length),e<0||n>t.length||i<0||s>this.length)throw new RangeError("out of range index");if(i>=s&&e>=n)return 0;if(i>=s)return-1;if(e>=n)return 1;if(e>>>=0,n>>>=0,i>>>=0,s>>>=0,this===t)return 0;let a=s-i,l=n-e,c=Math.min(a,l),u=this.slice(i,s),h=t.slice(e,n);for(let d=0;d<c;++d)if(u[d]!==h[d]){a=u[d],l=h[d];break}return a<l?-1:l<a?1:0};function G2(r,t,e,n,i){if(r.length===0)return-1;if(typeof e=="string"?(n=e,e=0):e>2147483647?e=2147483647:e<-2147483648&&(e=-2147483648),e=+e,Ib(e)&&(e=i?0:r.length-1),e<0&&(e=r.length+e),e>=r.length){if(i)return-1;e=r.length-1}else if(e<0)if(i)e=0;else return-1;if(typeof t=="string"&&(t=it.from(t,n)),it.isBuffer(t))return t.length===0?-1:L2(r,t,e,n,i);if(typeof t=="number")return t=t&255,typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(r,t,e):Uint8Array.prototype.lastIndexOf.call(r,t,e):L2(r,[t],e,n,i);throw new TypeError("val must be string, number or Buffer")}function L2(r,t,e,n,i){let s=1,a=r.length,l=t.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(r.length<2||t.length<2)return-1;s=2,a/=2,l/=2,e/=2}function c(h,d){return s===1?h[d]:h.readUInt16BE(d*s)}let u;if(i){let h=-1;for(u=e;u<a;u++)if(c(r,u)===c(t,h===-1?0:u-h)){if(h===-1&&(h=u),u-h+1===l)return h*s}else h!==-1&&(u-=u-h),h=-1}else for(e+l>a&&(e=a-l),u=e;u>=0;u--){let h=!0;for(let d=0;d<l;d++)if(c(r,u+d)!==c(t,d)){h=!1;break}if(h)return u}return-1}it.prototype.includes=function(t,e,n){return this.indexOf(t,e,n)!==-1};it.prototype.indexOf=function(t,e,n){return G2(this,t,e,n,!0)};it.prototype.lastIndexOf=function(t,e,n){return G2(this,t,e,n,!1)};function TN(r,t,e,n){e=Number(e)||0;let i=r.length-e;n?(n=Number(n),n>i&&(n=i)):n=i;let s=t.length;n>s/2&&(n=s/2);let a;for(a=0;a<n;++a){let l=parseInt(t.substr(a*2,2),16);if(Ib(l))return a;r[e+a]=l}return a}function SN(r,t,e,n){return hg(Tb(t,r.length-e),r,e,n)}function DN(r,t,e,n){return hg(UN(t),r,e,n)}function NN(r,t,e,n){return hg(Z2(t),r,e,n)}function IN(r,t,e,n){return hg($N(t,r.length-e),r,e,n)}it.prototype.write=function(t,e,n,i){if(e===void 0)i="utf8",n=this.length,e=0;else if(n===void 0&&typeof e=="string")i=e,n=this.length,e=0;else if(isFinite(e))e=e>>>0,isFinite(n)?(n=n>>>0,i===void 0&&(i="utf8")):(i=n,n=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let s=this.length-e;if((n===void 0||n>s)&&(n=s),t.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");let a=!1;for(;;)switch(i){case"hex":return TN(this,t,e,n);case"utf8":case"utf-8":return SN(this,t,e,n);case"ascii":case"latin1":case"binary":return DN(this,t,e,n);case"base64":return NN(this,t,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return IN(this,t,e,n);default:if(a)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),a=!0}};it.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function kN(r,t,e){return t===0&&e===r.length?vb.fromByteArray(r):vb.fromByteArray(r.slice(t,e))}function H2(r,t,e){e=Math.min(r.length,e);let n=[],i=t;for(;i<e;){let s=r[i],a=null,l=s>239?4:s>223?3:s>191?2:1;if(i+l<=e){let c,u,h,d;switch(l){case 1:s<128&&(a=s);break;case 2:c=r[i+1],(c&192)===128&&(d=(s&31)<<6|c&63,d>127&&(a=d));break;case 3:c=r[i+1],u=r[i+2],(c&192)===128&&(u&192)===128&&(d=(s&15)<<12|(c&63)<<6|u&63,d>2047&&(d<55296||d>57343)&&(a=d));break;case 4:c=r[i+1],u=r[i+2],h=r[i+3],(c&192)===128&&(u&192)===128&&(h&192)===128&&(d=(s&15)<<18|(c&63)<<12|(u&63)<<6|h&63,d>65535&&d<1114112&&(a=d))}}a===null?(a=65533,l=1):a>65535&&(a-=65536,n.push(a>>>10&1023|55296),a=56320|a&1023),n.push(a),i+=l}return _N(n)}var B2=4096;function _N(r){let t=r.length;if(t<=B2)return String.fromCharCode.apply(String,r);let e="",n=0;for(;n<t;)e+=String.fromCharCode.apply(String,r.slice(n,n+=B2));return e}function MN(r,t,e){let n="";e=Math.min(r.length,e);for(let i=t;i<e;++i)n+=String.fromCharCode(r[i]&127);return n}function ON(r,t,e){let n="";e=Math.min(r.length,e);for(let i=t;i<e;++i)n+=String.fromCharCode(r[i]);return n}function FN(r,t,e){let n=r.length;(!t||t<0)&&(t=0),(!e||e<0||e>n)&&(e=n);let i="";for(let s=t;s<e;++s)i+=zN[r[s]];return i}function PN(r,t,e){let n=r.slice(t,e),i="";for(let s=0;s<n.length-1;s+=2)i+=String.fromCharCode(n[s]+n[s+1]*256);return i}it.prototype.slice=function(t,e){let n=this.length;t=~~t,e=e===void 0?n:~~e,t<0?(t+=n,t<0&&(t=0)):t>n&&(t=n),e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),e<t&&(e=t);let i=this.subarray(t,e);return Object.setPrototypeOf(i,it.prototype),i};function xn(r,t,e){if(r%1!==0||r<0)throw new RangeError("offset is not uint");if(r+t>e)throw new RangeError("Trying to access beyond buffer length")}it.prototype.readUintLE=it.prototype.readUIntLE=function(t,e,n){t=t>>>0,e=e>>>0,n||xn(t,e,this.length);let i=this[t],s=1,a=0;for(;++a<e&&(s*=256);)i+=this[t+a]*s;return i};it.prototype.readUintBE=it.prototype.readUIntBE=function(t,e,n){t=t>>>0,e=e>>>0,n||xn(t,e,this.length);let i=this[t+--e],s=1;for(;e>0&&(s*=256);)i+=this[t+--e]*s;return i};it.prototype.readUint8=it.prototype.readUInt8=function(t,e){return t=t>>>0,e||xn(t,1,this.length),this[t]};it.prototype.readUint16LE=it.prototype.readUInt16LE=function(t,e){return t=t>>>0,e||xn(t,2,this.length),this[t]|this[t+1]<<8};it.prototype.readUint16BE=it.prototype.readUInt16BE=function(t,e){return t=t>>>0,e||xn(t,2,this.length),this[t]<<8|this[t+1]};it.prototype.readUint32LE=it.prototype.readUInt32LE=function(t,e){return t=t>>>0,e||xn(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+this[t+3]*16777216};it.prototype.readUint32BE=it.prototype.readUInt32BE=function(t,e){return t=t>>>0,e||xn(t,4,this.length),this[t]*16777216+(this[t+1]<<16|this[t+2]<<8|this[t+3])};it.prototype.readBigUInt64LE=Xa(function(t){t=t>>>0,ou(t,"offset");let e=this[t],n=this[t+7];(e===void 0||n===void 0)&&Ud(t,this.length-8);let i=e+this[++t]*2**8+this[++t]*2**16+this[++t]*2**24,s=this[++t]+this[++t]*2**8+this[++t]*2**16+n*2**24;return BigInt(i)+(BigInt(s)<<BigInt(32))});it.prototype.readBigUInt64BE=Xa(function(t){t=t>>>0,ou(t,"offset");let e=this[t],n=this[t+7];(e===void 0||n===void 0)&&Ud(t,this.length-8);let i=e*2**24+this[++t]*2**16+this[++t]*2**8+this[++t],s=this[++t]*2**24+this[++t]*2**16+this[++t]*2**8+n;return(BigInt(i)<<BigInt(32))+BigInt(s)});it.prototype.readIntLE=function(t,e,n){t=t>>>0,e=e>>>0,n||xn(t,e,this.length);let i=this[t],s=1,a=0;for(;++a<e&&(s*=256);)i+=this[t+a]*s;return s*=128,i>=s&&(i-=Math.pow(2,8*e)),i};it.prototype.readIntBE=function(t,e,n){t=t>>>0,e=e>>>0,n||xn(t,e,this.length);let i=e,s=1,a=this[t+--i];for(;i>0&&(s*=256);)a+=this[t+--i]*s;return s*=128,a>=s&&(a-=Math.pow(2,8*e)),a};it.prototype.readInt8=function(t,e){return t=t>>>0,e||xn(t,1,this.length),this[t]&128?(255-this[t]+1)*-1:this[t]};it.prototype.readInt16LE=function(t,e){t=t>>>0,e||xn(t,2,this.length);let n=this[t]|this[t+1]<<8;return n&32768?n|4294901760:n};it.prototype.readInt16BE=function(t,e){t=t>>>0,e||xn(t,2,this.length);let n=this[t+1]|this[t]<<8;return n&32768?n|4294901760:n};it.prototype.readInt32LE=function(t,e){return t=t>>>0,e||xn(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24};it.prototype.readInt32BE=function(t,e){return t=t>>>0,e||xn(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]};it.prototype.readBigInt64LE=Xa(function(t){t=t>>>0,ou(t,"offset");let e=this[t],n=this[t+7];(e===void 0||n===void 0)&&Ud(t,this.length-8);let i=this[t+4]+this[t+5]*2**8+this[t+6]*2**16+(n<<24);return(BigInt(i)<<BigInt(32))+BigInt(e+this[++t]*2**8+this[++t]*2**16+this[++t]*2**24)});it.prototype.readBigInt64BE=Xa(function(t){t=t>>>0,ou(t,"offset");let e=this[t],n=this[t+7];(e===void 0||n===void 0)&&Ud(t,this.length-8);let i=(e<<24)+this[++t]*2**16+this[++t]*2**8+this[++t];return(BigInt(i)<<BigInt(32))+BigInt(this[++t]*2**24+this[++t]*2**16+this[++t]*2**8+n)});it.prototype.readFloatLE=function(t,e){return t=t>>>0,e||xn(t,4,this.length),au.read(this,t,!0,23,4)};it.prototype.readFloatBE=function(t,e){return t=t>>>0,e||xn(t,4,this.length),au.read(this,t,!1,23,4)};it.prototype.readDoubleLE=function(t,e){return t=t>>>0,e||xn(t,8,this.length),au.read(this,t,!0,52,8)};it.prototype.readDoubleBE=function(t,e){return t=t>>>0,e||xn(t,8,this.length),au.read(this,t,!1,52,8)};function di(r,t,e,n,i,s){if(!it.isBuffer(r))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<s)throw new RangeError('"value" argument is out of bounds');if(e+n>r.length)throw new RangeError("Index out of range")}it.prototype.writeUintLE=it.prototype.writeUIntLE=function(t,e,n,i){if(t=+t,e=e>>>0,n=n>>>0,!i){let l=Math.pow(2,8*n)-1;di(this,t,e,n,l,0)}let s=1,a=0;for(this[e]=t&255;++a<n&&(s*=256);)this[e+a]=t/s&255;return e+n};it.prototype.writeUintBE=it.prototype.writeUIntBE=function(t,e,n,i){if(t=+t,e=e>>>0,n=n>>>0,!i){let l=Math.pow(2,8*n)-1;di(this,t,e,n,l,0)}let s=n-1,a=1;for(this[e+s]=t&255;--s>=0&&(a*=256);)this[e+s]=t/a&255;return e+n};it.prototype.writeUint8=it.prototype.writeUInt8=function(t,e,n){return t=+t,e=e>>>0,n||di(this,t,e,1,255,0),this[e]=t&255,e+1};it.prototype.writeUint16LE=it.prototype.writeUInt16LE=function(t,e,n){return t=+t,e=e>>>0,n||di(this,t,e,2,65535,0),this[e]=t&255,this[e+1]=t>>>8,e+2};it.prototype.writeUint16BE=it.prototype.writeUInt16BE=function(t,e,n){return t=+t,e=e>>>0,n||di(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=t&255,e+2};it.prototype.writeUint32LE=it.prototype.writeUInt32LE=function(t,e,n){return t=+t,e=e>>>0,n||di(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=t&255,e+4};it.prototype.writeUint32BE=it.prototype.writeUInt32BE=function(t,e,n){return t=+t,e=e>>>0,n||di(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=t&255,e+4};function W2(r,t,e,n,i){K2(t,n,i,r,e,7);let s=Number(t&BigInt(4294967295));r[e++]=s,s=s>>8,r[e++]=s,s=s>>8,r[e++]=s,s=s>>8,r[e++]=s;let a=Number(t>>BigInt(32)&BigInt(4294967295));return r[e++]=a,a=a>>8,r[e++]=a,a=a>>8,r[e++]=a,a=a>>8,r[e++]=a,e}function q2(r,t,e,n,i){K2(t,n,i,r,e,7);let s=Number(t&BigInt(4294967295));r[e+7]=s,s=s>>8,r[e+6]=s,s=s>>8,r[e+5]=s,s=s>>8,r[e+4]=s;let a=Number(t>>BigInt(32)&BigInt(4294967295));return r[e+3]=a,a=a>>8,r[e+2]=a,a=a>>8,r[e+1]=a,a=a>>8,r[e]=a,e+8}it.prototype.writeBigUInt64LE=Xa(function(t,e=0){return W2(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))});it.prototype.writeBigUInt64BE=Xa(function(t,e=0){return q2(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))});it.prototype.writeIntLE=function(t,e,n,i){if(t=+t,e=e>>>0,!i){let c=Math.pow(2,8*n-1);di(this,t,e,n,c-1,-c)}let s=0,a=1,l=0;for(this[e]=t&255;++s<n&&(a*=256);)t<0&&l===0&&this[e+s-1]!==0&&(l=1),this[e+s]=(t/a>>0)-l&255;return e+n};it.prototype.writeIntBE=function(t,e,n,i){if(t=+t,e=e>>>0,!i){let c=Math.pow(2,8*n-1);di(this,t,e,n,c-1,-c)}let s=n-1,a=1,l=0;for(this[e+s]=t&255;--s>=0&&(a*=256);)t<0&&l===0&&this[e+s+1]!==0&&(l=1),this[e+s]=(t/a>>0)-l&255;return e+n};it.prototype.writeInt8=function(t,e,n){return t=+t,e=e>>>0,n||di(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=t&255,e+1};it.prototype.writeInt16LE=function(t,e,n){return t=+t,e=e>>>0,n||di(this,t,e,2,32767,-32768),this[e]=t&255,this[e+1]=t>>>8,e+2};it.prototype.writeInt16BE=function(t,e,n){return t=+t,e=e>>>0,n||di(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=t&255,e+2};it.prototype.writeInt32LE=function(t,e,n){return t=+t,e=e>>>0,n||di(this,t,e,4,2147483647,-2147483648),this[e]=t&255,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4};it.prototype.writeInt32BE=function(t,e,n){return t=+t,e=e>>>0,n||di(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=t&255,e+4};it.prototype.writeBigInt64LE=Xa(function(t,e=0){return W2(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});it.prototype.writeBigInt64BE=Xa(function(t,e=0){return q2(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function V2(r,t,e,n,i,s){if(e+n>r.length)throw new RangeError("Index out of range");if(e<0)throw new RangeError("Index out of range")}function X2(r,t,e,n,i){return t=+t,e=e>>>0,i||V2(r,t,e,4,34028234663852886e22,-34028234663852886e22),au.write(r,t,e,n,23,4),e+4}it.prototype.writeFloatLE=function(t,e,n){return X2(this,t,e,!0,n)};it.prototype.writeFloatBE=function(t,e,n){return X2(this,t,e,!1,n)};function Y2(r,t,e,n,i){return t=+t,e=e>>>0,i||V2(r,t,e,8,17976931348623157e292,-17976931348623157e292),au.write(r,t,e,n,52,8),e+8}it.prototype.writeDoubleLE=function(t,e,n){return Y2(this,t,e,!0,n)};it.prototype.writeDoubleBE=function(t,e,n){return Y2(this,t,e,!1,n)};it.prototype.copy=function(t,e,n,i){if(!it.isBuffer(t))throw new TypeError("argument should be a Buffer");if(n||(n=0),!i&&i!==0&&(i=this.length),e>=t.length&&(e=t.length),e||(e=0),i>0&&i<n&&(i=n),i===n||t.length===0||this.length===0)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),t.length-e<i-n&&(i=t.length-e+n);let s=i-n;return this===t&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(e,n,i):Uint8Array.prototype.set.call(t,this.subarray(n,i),e),s};it.prototype.fill=function(t,e,n,i){if(typeof t=="string"){if(typeof e=="string"?(i=e,e=0,n=this.length):typeof n=="string"&&(i=n,n=this.length),i!==void 0&&typeof i!="string")throw new TypeError("encoding must be a string");if(typeof i=="string"&&!it.isEncoding(i))throw new TypeError("Unknown encoding: "+i);if(t.length===1){let a=t.charCodeAt(0);(i==="utf8"&&a<128||i==="latin1")&&(t=a)}}else typeof t=="number"?t=t&255:typeof t=="boolean"&&(t=Number(t));if(e<0||this.length<e||this.length<n)throw new RangeError("Out of range index");if(n<=e)return this;e=e>>>0,n=n===void 0?this.length:n>>>0,t||(t=0);let s;if(typeof t=="number")for(s=e;s<n;++s)this[s]=t;else{let a=it.isBuffer(t)?t:it.from(t,i),l=a.length;if(l===0)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(s=0;s<n-e;++s)this[s+e]=a[s%l]}return this};var su={};function Nb(r,t,e){su[r]=class extends e{constructor(){super(),Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${r}]`,this.stack,delete this.name}get code(){return r}set code(i){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:i,writable:!0})}toString(){return`${this.name} [${r}]: ${this.message}`}}}Nb("ERR_BUFFER_OUT_OF_BOUNDS",function(r){return r?`${r} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError);Nb("ERR_INVALID_ARG_TYPE",function(r,t){return`The "${r}" argument must be of type number. Received type ${typeof t}`},TypeError);Nb("ERR_OUT_OF_RANGE",function(r,t,e){let n=`The value of "${r}" is out of range.`,i=e;return Number.isInteger(e)&&Math.abs(e)>2**32?i=U2(String(e)):typeof e=="bigint"&&(i=String(e),(e>BigInt(2)**BigInt(32)||e<-(BigInt(2)**BigInt(32)))&&(i=U2(i)),i+="n"),n+=` It must be ${t}. Received ${i}`,n},RangeError);function U2(r){let t="",e=r.length,n=r[0]==="-"?1:0;for(;e>=n+4;e-=3)t=`_${r.slice(e-3,e)}${t}`;return`${r.slice(0,e)}${t}`}function RN(r,t,e){ou(t,"offset"),(r[t]===void 0||r[t+e]===void 0)&&Ud(t,r.length-(e+1))}function K2(r,t,e,n,i,s){if(r>e||r<t){let a=typeof t=="bigint"?"n":"",l;throw s>3?t===0||t===BigInt(0)?l=`>= 0${a} and < 2${a} ** ${(s+1)*8}${a}`:l=`>= -(2${a} ** ${(s+1)*8-1}${a}) and < 2 ** ${(s+1)*8-1}${a}`:l=`>= ${t}${a} and <= ${e}${a}`,new su.ERR_OUT_OF_RANGE("value",l,r)}RN(n,i,s)}function ou(r,t){if(typeof r!="number")throw new su.ERR_INVALID_ARG_TYPE(t,"number",r)}function Ud(r,t,e){throw Math.floor(r)!==r?(ou(r,e),new su.ERR_OUT_OF_RANGE(e||"offset","an integer",r)):t<0?new su.ERR_BUFFER_OUT_OF_BOUNDS:new su.ERR_OUT_OF_RANGE(e||"offset",`>= ${e?1:0} and <= ${t}`,r)}var LN=/[^+/0-9A-Za-z-_]/g;function BN(r){if(r=r.split("=")[0],r=r.trim().replace(LN,""),r.length<2)return"";for(;r.length%4!==0;)r=r+"=";return r}function Tb(r,t){t=t||1/0;let e,n=r.length,i=null,s=[];for(let a=0;a<n;++a){if(e=r.charCodeAt(a),e>55295&&e<57344){if(!i){if(e>56319){(t-=3)>-1&&s.push(239,191,189);continue}else if(a+1===n){(t-=3)>-1&&s.push(239,191,189);continue}i=e;continue}if(e<56320){(t-=3)>-1&&s.push(239,191,189),i=e;continue}e=(i-55296<<10|e-56320)+65536}else i&&(t-=3)>-1&&s.push(239,191,189);if(i=null,e<128){if((t-=1)<0)break;s.push(e)}else if(e<2048){if((t-=2)<0)break;s.push(e>>6|192,e&63|128)}else if(e<65536){if((t-=3)<0)break;s.push(e>>12|224,e>>6&63|128,e&63|128)}else if(e<1114112){if((t-=4)<0)break;s.push(e>>18|240,e>>12&63|128,e>>6&63|128,e&63|128)}else throw new Error("Invalid code point")}return s}function UN(r){let t=[];for(let e=0;e<r.length;++e)t.push(r.charCodeAt(e)&255);return t}function $N(r,t){let e,n,i,s=[];for(let a=0;a<r.length&&!((t-=2)<0);++a)e=r.charCodeAt(a),n=e>>8,i=e%256,s.push(i),s.push(n);return s}function Z2(r){return vb.toByteArray(BN(r))}function hg(r,t,e,n){let i;for(i=0;i<n&&!(i+e>=t.length||i>=r.length);++i)t[i+e]=r[i];return i}function es(r,t){return r instanceof t||r!=null&&r.constructor!=null&&r.constructor.name!=null&&r.constructor.name===t.name}function Ib(r){return r!==r}var zN=(function(){let r="0123456789abcdef",t=new Array(256);for(let e=0;e<16;++e){let n=e*16;for(let i=0;i<16;++i)t[n+i]=r[e]+r[i]}return t})();function Xa(r){return typeof BigInt>"u"?jN:r}function jN(){throw new Error("BigInt not supported")}});var iv=Xt((AF,nv)=>{B();var Ze=nv.exports={},ns,is;function kb(){throw new Error("setTimeout has not been defined")}function _b(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?ns=setTimeout:ns=kb}catch{ns=kb}try{typeof clearTimeout=="function"?is=clearTimeout:is=_b}catch{is=_b}})();function J2(r){if(ns===setTimeout)return setTimeout(r,0);if((ns===kb||!ns)&&setTimeout)return ns=setTimeout,setTimeout(r,0);try{return ns(r,0)}catch{try{return ns.call(null,r,0)}catch{return ns.call(this,r,0)}}}function GN(r){if(is===clearTimeout)return clearTimeout(r);if((is===_b||!is)&&clearTimeout)return is=clearTimeout,clearTimeout(r);try{return is(r)}catch{try{return is.call(null,r)}catch{return is.call(this,r)}}}var js=[],cu=!1,ol,dg=-1;function HN(){!cu||!ol||(cu=!1,ol.length?js=ol.concat(js):dg=-1,js.length&&tv())}function tv(){if(!cu){var r=J2(HN);cu=!0;for(var t=js.length;t;){for(ol=js,js=[];++dg<t;)ol&&ol[dg].run();dg=-1,t=js.length}ol=null,cu=!1,GN(r)}}Ze.nextTick=function(r){var t=new Array(arguments.length-1);if(arguments.length>1)for(var e=1;e<arguments.length;e++)t[e-1]=arguments[e];js.push(new ev(r,t)),js.length===1&&!cu&&J2(tv)};function ev(r,t){this.fun=r,this.array=t}ev.prototype.run=function(){this.fun.apply(null,this.array)};Ze.title="browser";Ze.browser=!0;Ze.env={};Ze.argv=[];Ze.version="";Ze.versions={};function Gs(){}Ze.on=Gs;Ze.addListener=Gs;Ze.once=Gs;Ze.off=Gs;Ze.removeListener=Gs;Ze.removeAllListeners=Gs;Ze.emit=Gs;Ze.prependListener=Gs;Ze.prependOnceListener=Gs;Ze.listeners=function(r){return[]};Ze.binding=function(r){throw new Error("process.binding is not supported")};Ze.cwd=function(){return"/"};Ze.chdir=function(r){throw new Error("process.chdir is not supported")};Ze.umask=function(){return 0}});var ct,nt,Mb,B=ne(()=>{"use strict";ct=ru(Q2()),nt=ru(iv()),Mb=[typeof globalThis<"u"?globalThis:null,typeof window<"u"?window:null,typeof self<"u"?self:null,typeof window<"u"?window:null].filter(Boolean);Mb.forEach(r=>{r.Buffer||(r.Buffer=ct.Buffer),r.process||(r.process=nt.default)});typeof nt.default<"u"&&!nt.default.env&&(nt.default.env={NODE_ENV:"production"});if(typeof Mb[0]<"u"){let r=Mb[0];r.util||(r.util={debuglog:()=>()=>{},inspect:t=>JSON.stringify(t)})}});var zv={};lg(zv,{default:()=>SI,launch:()=>$v});var $v,SI,jv=ne(()=>{"use strict";B();$v=()=>{throw new Error("officeparser: 'puppeteer.launch' is not supported in the browser. Browser-side PDF generation uses native print capabilities.")},SI={launch:$v}});var cl=Xt(On=>{"use strict";B();function DI(r,t,e){if(e===void 0&&(e=Array.prototype),r&&typeof e.find=="function")return e.find.call(r,t);for(var n=0;n<r.length;n++)if(ll(r,n)){var i=r[n];if(t.call(void 0,i,n,r))return i}}function du(r,t){return t===void 0&&(t=Object),t&&typeof t.getOwnPropertyDescriptors=="function"&&(r=t.create(null,t.getOwnPropertyDescriptors(r))),t&&typeof t.freeze=="function"?t.freeze(r):r}function ll(r,t){return Object.prototype.hasOwnProperty.call(r,t)}function NI(r,t){if(r===null||typeof r!="object")throw new TypeError("target is not an object");for(var e in t)ll(t,e)&&(r[e]=t[e]);return r}var Hv=du({allowfullscreen:!0,async:!0,autofocus:!0,autoplay:!0,checked:!0,controls:!0,default:!0,defer:!0,disabled:!0,formnovalidate:!0,hidden:!0,ismap:!0,itemscope:!0,loop:!0,multiple:!0,muted:!0,nomodule:!0,novalidate:!0,open:!0,playsinline:!0,readonly:!0,required:!0,reversed:!0,selected:!0});function II(r){return ll(Hv,r.toLowerCase())}var Wv=du({area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function kI(r){return ll(Wv,r.toLowerCase())}var Wd=du({script:!1,style:!1,textarea:!0,title:!0});function _I(r){var t=r.toLowerCase();return ll(Wd,t)&&!Wd[t]}function MI(r){var t=r.toLowerCase();return ll(Wd,t)&&Wd[t]}function qv(r){return r===qd.HTML}function OI(r){return qv(r)||r===qd.XML_XHTML_APPLICATION}var qd=du({HTML:"text/html",XML_APPLICATION:"application/xml",XML_TEXT:"text/xml",XML_XHTML_APPLICATION:"application/xhtml+xml",XML_SVG_IMAGE:"image/svg+xml"}),FI=Object.keys(qd).map(function(r){return qd[r]});function PI(r){return FI.indexOf(r)>-1}var RI=du({HTML:"http://www.w3.org/1999/xhtml",SVG:"http://www.w3.org/2000/svg",XML:"http://www.w3.org/XML/1998/namespace",XMLNS:"http://www.w3.org/2000/xmlns/"});On.assign=NI;On.find=DI;On.freeze=du;On.HTML_BOOLEAN_ATTRIBUTES=Hv;On.HTML_RAW_TEXT_ELEMENTS=Wd;On.HTML_VOID_ELEMENTS=Wv;On.hasDefaultHTMLNamespace=OI;On.hasOwn=ll;On.isHTMLBooleanAttribute=II;On.isHTMLRawTextElement=_I;On.isHTMLEscapableRawTextElement=MI;On.isHTMLMimeType=qv;On.isHTMLVoidElement=kI;On.isValidMimeType=PI;On.MIME_TYPE=qd;On.NAMESPACE=RI});var Zd=Xt(Kd=>{"use strict";B();var LI=cl();function Xv(r,t){r.prototype=Object.create(Error.prototype,{constructor:{value:r},name:{value:r.name,enumerable:!0,writable:t}})}var Xd=LI.freeze({Error:"Error",IndexSizeError:"IndexSizeError",DomstringSizeError:"DomstringSizeError",HierarchyRequestError:"HierarchyRequestError",WrongDocumentError:"WrongDocumentError",InvalidCharacterError:"InvalidCharacterError",NoDataAllowedError:"NoDataAllowedError",NoModificationAllowedError:"NoModificationAllowedError",NotFoundError:"NotFoundError",NotSupportedError:"NotSupportedError",InUseAttributeError:"InUseAttributeError",InvalidStateError:"InvalidStateError",SyntaxError:"SyntaxError",InvalidModificationError:"InvalidModificationError",NamespaceError:"NamespaceError",InvalidAccessError:"InvalidAccessError",ValidationError:"ValidationError",TypeMismatchError:"TypeMismatchError",SecurityError:"SecurityError",NetworkError:"NetworkError",AbortError:"AbortError",URLMismatchError:"URLMismatchError",QuotaExceededError:"QuotaExceededError",TimeoutError:"TimeoutError",InvalidNodeTypeError:"InvalidNodeTypeError",DataCloneError:"DataCloneError",EncodingError:"EncodingError",NotReadableError:"NotReadableError",UnknownError:"UnknownError",ConstraintError:"ConstraintError",DataError:"DataError",TransactionInactiveError:"TransactionInactiveError",ReadOnlyError:"ReadOnlyError",VersionError:"VersionError",OperationError:"OperationError",NotAllowedError:"NotAllowedError",OptOutError:"OptOutError"}),Yv=Object.keys(Xd);function Kv(r){return typeof r=="number"&&r>=1&&r<=25}function BI(r){return typeof r=="string"&&r.substring(r.length-Xd.Error.length)===Xd.Error}function Yd(r,t){Kv(r)?(this.name=Yv[r],this.message=t||""):(this.message=r,this.name=BI(t)?t:Xd.Error),Error.captureStackTrace&&Error.captureStackTrace(this,Yd)}Xv(Yd,!0);Object.defineProperties(Yd.prototype,{code:{enumerable:!0,get:function(){var r=Yv.indexOf(this.name);return Kv(r)?r:0}}});var Zv={INDEX_SIZE_ERR:1,DOMSTRING_SIZE_ERR:2,HIERARCHY_REQUEST_ERR:3,WRONG_DOCUMENT_ERR:4,INVALID_CHARACTER_ERR:5,NO_DATA_ALLOWED_ERR:6,NO_MODIFICATION_ALLOWED_ERR:7,NOT_FOUND_ERR:8,NOT_SUPPORTED_ERR:9,INUSE_ATTRIBUTE_ERR:10,INVALID_STATE_ERR:11,SYNTAX_ERR:12,INVALID_MODIFICATION_ERR:13,NAMESPACE_ERR:14,INVALID_ACCESS_ERR:15,VALIDATION_ERR:16,TYPE_MISMATCH_ERR:17,SECURITY_ERR:18,NETWORK_ERR:19,ABORT_ERR:20,URL_MISMATCH_ERR:21,QUOTA_EXCEEDED_ERR:22,TIMEOUT_ERR:23,INVALID_NODE_TYPE_ERR:24,DATA_CLONE_ERR:25},Xb=Object.entries(Zv);for(Vd=0;Vd<Xb.length;Vd++)Vv=Xb[Vd][0],Yd[Vv]=Xb[Vd][1];var Vv,Vd;function Yb(r,t){this.message=r,this.locator=t,Error.captureStackTrace&&Error.captureStackTrace(this,Yb)}Xv(Yb);Kd.DOMException=Yd;Kd.DOMExceptionName=Xd;Kd.ExceptionCode=Zv;Kd.ParseError=Yb});var nx=Xt($t=>{"use strict";B();function rC(r){try{typeof r!="function"&&(r=RegExp);var t=new r("\u{1D306}","u").exec("\u{1D306}");return!!t&&t[0].length===2}catch{}return!1}var mu=rC();function Za(r){if(r.source[0]!=="[")throw new Error(r+" can not be used with chars");return r.source.slice(1,r.source.lastIndexOf("]"))}function fu(r,t){if(r.source[0]!=="[")throw new Error("/"+r.source+"/ can not be used with chars_without");if(!t||typeof t!="string")throw new Error(JSON.stringify(t)+" is not a valid search");if(r.source.indexOf(t)===-1)throw new Error('"'+t+'" is not is /'+r.source+"/");if(t==="-"&&r.source.indexOf(t)!==1)throw new Error('"'+t+'" is not at the first postion of /'+r.source+"/");return new RegExp(r.source.replace(t,""),mu?"u":"")}function qt(r){var t=this;return new RegExp(Array.prototype.slice.call(arguments).map(function(e){var n=typeof e=="string";if(n&&t===void 0&&e==="|")throw new Error("use regg instead of reg to wrap expressions with `|`!");return n?e:e.source}).join(""),mu?"mu":"m")}function Lt(r){if(arguments.length===0)throw new Error("no parameters provided");return qt.apply(Lt,["(?:"].concat(Array.prototype.slice.call(arguments),[")"]))}var UI="\uFFFD",Qa=/[-\x09\x0A\x0D\x20-\x2C\x2E-\uD7FF\uE000-\uFFFD]/;mu&&(Qa=qt("[",Za(Qa),"\\u{10000}-\\u{10FFFF}","]"));var $I=new RegExp("[^"+Za(Qa)+"]",mu?"u":""),Zb=/[\x20\x09\x0D\x0A]/,zI=Za(Zb),de=qt(Zb,"+"),Me=qt(Zb,"*"),Qd=/[:_a-zA-Z\xC0-\xD6\xD8-\xF6\xF8-\u02FF\u0370-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/;mu&&(Qd=qt("[",Za(Qd),"\\u{10000}-\\u{10FFFF}","]"));var jI=Za(Qd),Qb=qt("[",jI,Za(/[-.0-9\xB7]/),Za(/[\u0300-\u036F\u203F-\u2040]/),"]"),rr=qt(Qd,Qb,"*"),Qv=qt(Qb,"+"),GI=qt("&",rr,";"),HI=Lt(/&#[0-9]+;|&#x[0-9a-fA-F]+;/),Jd=Lt(GI,"|",HI),tf=qt("%",rr,";"),Jb=Lt(qt('"',Lt(/[^%&"]/,"|",tf,"|",Jd),"*",'"'),"|",qt("'",Lt(/[^%&']/,"|",tf,"|",Jd),"*","'")),WI=Lt('"',Lt(/[^<&"]/,"|",Jd),"*",'"',"|","'",Lt(/[^<&']/,"|",Jd),"*","'"),qI=fu(Qd,":"),VI=fu(Qb,":"),Jv=qt(qI,VI,"*"),ef=qt(Jv,Lt(":",Jv),"?"),XI=qt("^",ef,"$"),YI=qt("(",ef,")"),pu=Lt(/"[^"]*"|'[^']*'/),KI=qt(/^<\?/,"(",rr,")",Lt(de,"(",Qa,"*?)"),"?",/\?>/),tC=/[\x20\x0D\x0Aa-zA-Z0-9-'()+,./:=?;!*#@$_%]/,nf=Lt('"',tC,'*"',"|","'",fu(tC,"'"),"*'"),sC="<!--",aC="-->",ZI=qt(sC,Lt(fu(Qa,"-"),"|",qt("-",fu(Qa,"-"))),"*",aC),eC="#PCDATA",QI=Lt(qt(/\(/,Me,eC,Lt(Me,/\|/,Me,ef),"*",Me,/\)\*/),"|",qt(/\(/,Me,eC,Me,/\)/)),JI=/[?*+]?/,tk=qt(/\([^>]+\)/,JI),ek=Lt("EMPTY","|","ANY","|",QI,"|",tk),nk="<!ELEMENT",ik=qt(nk,de,Lt(ef,"|",tf),de,Lt(ek,"|",tf),Me,">"),rk=qt("NOTATION",de,/\(/,Me,rr,Lt(Me,/\|/,Me,rr),"*",Me,/\)/),sk=qt(/\(/,Me,Qv,Lt(Me,/\|/,Me,Qv),"*",Me,/\)/),ak=Lt(rk,"|",sk),ok=Lt(/CDATA|ID|IDREF|IDREFS|ENTITY|ENTITIES|NMTOKEN|NMTOKENS/,"|",ak),lk=Lt(/#REQUIRED|#IMPLIED/,"|",Lt(Lt("#FIXED",de),"?",WI)),ck=Lt(de,rr,de,ok,de,lk),uk="<!ATTLIST",hk=qt(uk,de,rr,ck,"*",Me,">"),Kb="about:legacy-compat",dk=Lt('"'+Kb+'"',"|","'"+Kb+"'"),tx="SYSTEM",_g="PUBLIC",Mg=Lt(Lt(tx,de,pu),"|",Lt(_g,de,nf,de,pu)),fk=qt("^",Lt(Lt(tx,de,"(?<SystemLiteralOnly>",pu,")"),"|",Lt(_g,de,"(?<PubidLiteral>",nf,")",de,"(?<SystemLiteral>",pu,")"))),pk=qt("^",nf,"$"),mk=qt("^",pu,"$"),gk=Lt(de,"NDATA",de,rr),yk=Lt(Jb,"|",Lt(Mg,gk,"?")),oC="<!ENTITY",bk=qt(oC,de,rr,de,yk,Me,">"),xk=Lt(Jb,"|",Mg),wk=qt(oC,de,"%",de,rr,de,xk,Me,">"),Ak=Lt(bk,"|",wk),vk=qt(_g,de,nf),Ck=qt("<!NOTATION",de,rr,de,Lt(Mg,"|",vk),Me,">"),ex=qt(Me,"=",Me),nC=/1[.]\d+/,Ek=qt(de,"version",ex,Lt("'",nC,"'","|",'"',nC,'"')),iC=/[A-Za-z][-A-Za-z0-9._]*/,Tk=Lt(de,"encoding",ex,Lt('"',iC,'"',"|","'",iC,"'")),Sk=Lt(de,"standalone",ex,Lt("'",Lt("yes","|","no"),"'","|",'"',Lt("yes","|","no"),'"')),Dk=qt(/^<\?xml/,Ek,Tk,"?",Sk,"?",Me,/\?>/),Nk="<!DOCTYPE",Ik="<![CDATA[",kk="]]>",_k=/<!\[CDATA\[/,Mk=/\]\]>/,Ok=qt(Qa,"*?",Mk),Fk=qt(_k,Ok);$t.chars=Za;$t.chars_without=fu;$t.detectUnicodeSupport=rC;$t.reg=qt;$t.regg=Lt;$t.ABOUT_LEGACY_COMPAT=Kb;$t.ABOUT_LEGACY_COMPAT_SystemLiteral=dk;$t.AttlistDecl=hk;$t.CDATA_START=Ik;$t.CDATA_END=kk;$t.CDSect=Fk;$t.Char=Qa;$t.Comment=ZI;$t.COMMENT_START=sC;$t.COMMENT_END=aC;$t.DOCTYPE_DECL_START=Nk;$t.elementdecl=ik;$t.EntityDecl=Ak;$t.EntityValue=Jb;$t.ExternalID=Mg;$t.ExternalID_match=fk;$t.Name=rr;$t.NotationDecl=Ck;$t.Reference=Jd;$t.PEReference=tf;$t.PI=KI;$t.PUBLIC=_g;$t.PubidLiteral=nf;$t.PubidLiteral_match=pk;$t.QName=ef;$t.QName_exact=XI;$t.QName_group=YI;$t.S=de;$t.SChar_s=zI;$t.S_OPT=Me;$t.SYSTEM=tx;$t.SystemLiteral=pu;$t.SystemLiteral_match=mk;$t.InvalidChar=$I;$t.UNICODE_REPLACEMENT_CHARACTER=UI;$t.UNICODE_SUPPORT=mu;$t.XMLDecl=Dk});var ux=Xt(je=>{"use strict";B();var or=cl(),as=or.find,Pk=or.hasDefaultHTMLNamespace,yu=or.hasOwn,Rk=or.isHTMLMimeType,Lk=or.isHTMLRawTextElement,Bk=or.isHTMLVoidElement,rf=or.MIME_TYPE,os=or.NAMESPACE,ni=Symbol(),pC=Zd(),It=pC.DOMException,sr=pC.DOMExceptionName,Fn=nx();function pi(r){if(r!==ni)throw new TypeError("Illegal constructor")}function Uk(r){return r!==""}function $k(r){return r?r.split(/[\t\n\f\r ]+/).filter(Uk):[]}function zk(r,t){return yu(r,t)||(r[t]=!0),r}function lC(r){if(!r)return[];var t=$k(r);return Object.keys(t.reduce(zk,{}))}function jk(r){return function(t){return r&&r.indexOf(t)!==-1}}function mC(r){if(!Fn.QName_exact.test(r))throw new It(It.INVALID_CHARACTER_ERR,'invalid character in qualified name "'+r+'"')}function rx(r,t){mC(t),r=r||null;var e=null,n=t;if(t.indexOf(":")>=0){var i=t.split(":");e=i[0],n=i[1]}if(e!==null&&r===null)throw new It(It.NAMESPACE_ERR,"prefix is non-null and namespace is null");if(e==="xml"&&r!==or.NAMESPACE.XML)throw new It(It.NAMESPACE_ERR,'prefix is "xml" and namespace is not the XML namespace');if((e==="xmlns"||t==="xmlns")&&r!==or.NAMESPACE.XMLNS)throw new It(It.NAMESPACE_ERR,'either qualifiedName or prefix is "xmlns" and namespace is not the XMLNS namespace');if(r===or.NAMESPACE.XMLNS&&e!=="xmlns"&&t!=="xmlns")throw new It(It.NAMESPACE_ERR,'namespace is the XMLNS namespace and neither qualifiedName nor prefix is "xmlns"');return[r,e,n]}function wu(r,t){for(var e in r)yu(r,e)&&(t[e]=r[e])}function mi(r,t){var e=r.prototype;if(!(e instanceof t)){let n=function(){};n.prototype=t.prototype,n=new n,wu(e,n),r.prototype=e=n}e.constructor!=r&&(typeof r!="function"&&console.error("unknown Class:"+r),e.constructor=r)}var gi={},ar=gi.ELEMENT_NODE=1,bu=gi.ATTRIBUTE_NODE=2,Pg=gi.TEXT_NODE=3,gC=gi.CDATA_SECTION_NODE=4,yC=gi.ENTITY_REFERENCE_NODE=5,Gk=gi.ENTITY_NODE=6,sx=gi.PROCESSING_INSTRUCTION_NODE=7,ax=gi.COMMENT_NODE=8,gu=gi.DOCUMENT_NODE=9,bC=gi.DOCUMENT_TYPE_NODE=10,Ja=gi.DOCUMENT_FRAGMENT_NODE=11,Hk=gi.NOTATION_NODE=12,ze=or.freeze({DOCUMENT_POSITION_DISCONNECTED:1,DOCUMENT_POSITION_PRECEDING:2,DOCUMENT_POSITION_FOLLOWING:4,DOCUMENT_POSITION_CONTAINS:8,DOCUMENT_POSITION_CONTAINED_BY:16,DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC:32});function xC(r,t){if(t.length<r.length)return xC(t,r);var e=null;for(var n in r){if(r[n]!==t[n])return e;e=r[n]}return e}function cC(r){return r.guid||(r.guid=Math.random()),r.guid}function dn(){}dn.prototype={length:0,item:function(r){return r>=0&&r<this.length?this[r]:null},toString:function(r){var t;typeof r=="function"?t={requireWellFormed:!1,splitCDATASections:!0,nodeFilter:r}:r?t={requireWellFormed:!!r.requireWellFormed,splitCDATASections:r.splitCDATASections!==!1,nodeFilter:r.nodeFilter||null}:t={requireWellFormed:!1,splitCDATASections:!0,nodeFilter:null};for(var e=[],n=0;n<this.length;n++)cx(this[n],e,null,t);return e.join("")},filter:function(r){return Array.prototype.filter.call(this,r)},indexOf:function(r){return Array.prototype.indexOf.call(this,r)}};dn.prototype[Symbol.iterator]=function(){var r=this,t=0;return{next:function(){return t<r.length?{value:r[t++],done:!1}:{done:!0}},return:function(){return{done:!0}}}};function ss(r,t){this._node=r,this._refresh=t,Lg(this)}function Lg(r){var t=r._node._inc||r._node.ownerDocument._inc;if(r._inc!==t){var e=r._refresh(r._node);if(_C(r,"length",e.length),!r.$$length||e.length<r.$$length)for(var n=e.length;n in r;n++)yu(r,n)&&delete r[n];wu(e,r),r._inc=t}}ss.prototype.item=function(r){return Lg(this),this[r]||null};mi(ss,dn);function xu(){}function wC(r,t){for(var e=0;e<r.length;){if(r[e]===t)return e;e++}}function Wk(r,t,e,n){if(n?t[wC(t,n)]=e:(t[t.length]=e,t.length++),r){e.ownerElement=r;var i=r.ownerDocument;i&&(n&&CC(i,r,n),qk(i,r,e))}}function uC(r,t,e){var n=wC(t,e);if(n>=0){for(var i=t.length-1;n<=i;)t[n]=t[++n];if(t.length=i,r){var s=r.ownerDocument;s&&CC(s,r,e),e.ownerElement=null}}}xu.prototype={length:0,item:dn.prototype.item,getNamedItem:function(r){this._ownerElement&&this._ownerElement._isInHTMLDocumentAndNamespace()&&(r=r.toLowerCase());for(var t=0;t<this.length;){var e=this[t];if(e.nodeName===r)return e;t++}return null},setNamedItem:function(r){var t=r.ownerElement;if(t&&t!==this._ownerElement)throw new It(It.INUSE_ATTRIBUTE_ERR);var e=this.getNamedItemNS(r.namespaceURI,r.localName);return e===r?r:(Wk(this._ownerElement,this,r,e),e)},setNamedItemNS:function(r){return this.setNamedItem(r)},removeNamedItem:function(r){var t=this.getNamedItem(r);if(!t)throw new It(It.NOT_FOUND_ERR,r);return uC(this._ownerElement,this,t),t},removeNamedItemNS:function(r,t){var e=this.getNamedItemNS(r,t);if(!e)throw new It(It.NOT_FOUND_ERR,r?r+" : "+t:t);return uC(this._ownerElement,this,e),e},getNamedItemNS:function(r,t){r||(r=null);for(var e=0;e<this.length;){var n=this[e];if(n.localName===t&&n.namespaceURI===r)return n;e++}return null}};xu.prototype[Symbol.iterator]=function(){var r=this,t=0;return{next:function(){return t<r.length?{value:r[t++],done:!1}:{done:!0}},return:function(){return{done:!0}}}};function AC(){}AC.prototype={hasFeature:function(r,t){return!0},createDocument:function(r,t,e){var n=rf.XML_APPLICATION;r===os.HTML?n=rf.XML_XHTML_APPLICATION:r===os.SVG&&(n=rf.XML_SVG_IMAGE);var i=new Vs(ni,{contentType:n});if(i.implementation=this,i.childNodes=new dn,i.doctype=e||null,e&&i.appendChild(e),t){var s=i.createElementNS(r,t);i.appendChild(s)}return i},createDocumentType:function(r,t,e,n){mC(r);var i=new $g(ni);return i.name=r,i.nodeName=r,i.publicId=t||"",i.systemId=e||"",i.internalSubset=n||"",i.childNodes=new dn,i},createHTMLDocument:function(r){var t=new Vs(ni,{contentType:rf.HTML});if(t.implementation=this,t.childNodes=new dn,r!==!1){t.doctype=this.createDocumentType("html"),t.doctype.ownerDocument=t,t.appendChild(t.doctype);var e=t.createElement("html");t.appendChild(e);var n=t.createElement("head");if(e.appendChild(n),typeof r=="string"){var i=t.createElement("title");i.appendChild(t.createTextNode(r)),n.appendChild(i)}e.appendChild(t.createElement("body"))}return t}};function Jt(r){pi(r)}Jt.prototype={firstChild:null,lastChild:null,previousSibling:null,nextSibling:null,parentNode:null,get parentElement(){return this.parentNode&&this.parentNode.nodeType===this.ELEMENT_NODE?this.parentNode:null},childNodes:null,ownerDocument:null,nodeValue:null,namespaceURI:null,prefix:null,localName:null,baseURI:"about:blank",get isConnected(){var r=this.getRootNode();return r&&r.nodeType===r.DOCUMENT_NODE},contains:function(r){if(!r)return!1;var t=r;do{if(this===t)return!0;t=t.parentNode}while(t);return!1},getRootNode:function(r){var t=this;do{if(!t.parentNode)return t;t=t.parentNode}while(t)},isEqualNode:function(r){if(!r)return!1;for(var t=[{node:this,other:r}];t.length>0;){var e=t.pop(),n=e.node,i=e.other;if(n.nodeType!==i.nodeType)return!1;switch(n.nodeType){case n.DOCUMENT_TYPE_NODE:if(n.name!==i.name||n.publicId!==i.publicId||n.systemId!==i.systemId)return!1;break;case n.ELEMENT_NODE:if(n.namespaceURI!==i.namespaceURI||n.prefix!==i.prefix||n.localName!==i.localName||n.attributes.length!==i.attributes.length)return!1;for(var s=0;s<n.attributes.length;s++){var a=n.attributes.item(s),l=i.getAttributeNodeNS(a.namespaceURI,a.localName);if(!l)return!1;t.push({node:a,other:l})}break;case n.ATTRIBUTE_NODE:if(n.namespaceURI!==i.namespaceURI||n.localName!==i.localName||n.value!==i.value)return!1;break;case n.PROCESSING_INSTRUCTION_NODE:if(n.target!==i.target||n.data!==i.data)return!1;break;case n.TEXT_NODE:case n.CDATA_SECTION_NODE:case n.COMMENT_NODE:if(n.data!==i.data)return!1;break}if(n.childNodes.length!==i.childNodes.length)return!1;for(var s=n.childNodes.length-1;s>=0;s--)t.push({node:n.childNodes[s],other:i.childNodes[s]})}return!0},isSameNode:function(r){return this===r},insertBefore:function(r,t){return Rg(this,r,t)},replaceChild:function(r,t){Rg(this,r,t,DC),t&&this.removeChild(t)},removeChild:function(r){return TC(this,r)},appendChild:function(r){return this.insertBefore(r,null)},hasChildNodes:function(){return this.firstChild!=null},cloneNode:function(r){return kC(this.ownerDocument||this,this,r)},normalize:function(){Pn(this,null,{enter:function(r){for(var t=r.firstChild;t;){var e=t.nextSibling;e!==null&&e.nodeType===Pg&&t.nodeType===Pg?(r.removeChild(e),t.appendData(e.data)):t=e}return!0}})},isSupported:function(r,t){return this.ownerDocument.implementation.hasFeature(r,t)},lookupPrefix:function(r){for(var t=this;t;){var e=t._nsMap;if(e){for(var n in e)if(yu(e,n)&&e[n]===r)return n}t=t.nodeType==bu?t.ownerDocument:t.parentNode}return null},lookupNamespaceURI:function(r){for(var t=this;t;){var e=t._nsMap;if(e&&yu(e,r))return e[r];t=t.nodeType==bu?t.ownerDocument:t.parentNode}return null},isDefaultNamespace:function(r){var t=this.lookupPrefix(r);return t==null},compareDocumentPosition:function(r){if(this===r)return 0;var t=r,e=this,n=null,i=null;if(t instanceof ul&&(n=t,t=n.ownerElement),e instanceof ul&&(i=e,e=i.ownerElement,n&&t&&e===t))for(var s=0,a;a=e.attributes[s];s++){if(a===n)return ze.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC+ze.DOCUMENT_POSITION_PRECEDING;if(a===i)return ze.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC+ze.DOCUMENT_POSITION_FOLLOWING}if(!t||!e||e.ownerDocument!==t.ownerDocument)return ze.DOCUMENT_POSITION_DISCONNECTED+ze.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC+(cC(e.ownerDocument)>cC(t.ownerDocument)?ze.DOCUMENT_POSITION_FOLLOWING:ze.DOCUMENT_POSITION_PRECEDING);if(i&&t===e)return ze.DOCUMENT_POSITION_CONTAINS+ze.DOCUMENT_POSITION_PRECEDING;if(n&&t===e)return ze.DOCUMENT_POSITION_CONTAINED_BY+ze.DOCUMENT_POSITION_FOLLOWING;for(var l=[],c=t.parentNode;c;){if(!i&&c===e)return ze.DOCUMENT_POSITION_CONTAINED_BY+ze.DOCUMENT_POSITION_FOLLOWING;l.push(c),c=c.parentNode}l.reverse();for(var u=[],h=e.parentNode;h;){if(!n&&h===t)return ze.DOCUMENT_POSITION_CONTAINS+ze.DOCUMENT_POSITION_PRECEDING;u.push(h),h=h.parentNode}u.reverse();var d=xC(l,u);for(var f in d.childNodes){var p=d.childNodes[f];if(p===e)return ze.DOCUMENT_POSITION_FOLLOWING;if(p===t)return ze.DOCUMENT_POSITION_PRECEDING;if(u.indexOf(p)>=0)return ze.DOCUMENT_POSITION_FOLLOWING;if(l.indexOf(p)>=0)return ze.DOCUMENT_POSITION_PRECEDING}return 0}};function vC(r){return r=="<"&&"<"||r==">"&&">"||r=="&"&&"&"||r=='"'&&"""||"&#"+r.charCodeAt()+";"}wu(gi,Jt);wu(gi,Jt.prototype);wu(ze,Jt);wu(ze,Jt.prototype);function Fg(r,t){Pn(r,null,{enter:function(e){return t(e)?Pn.STOP:!0}})}function Pn(r,t,e){for(var n=[{node:r,context:t,phase:Pn.ENTER}];n.length>0;){var i=n.pop();if(i.phase===Pn.ENTER){var s=e.enter(i.node,i.context);if(s===Pn.STOP)return Pn.STOP;if(n.push({node:i.node,context:s,phase:Pn.EXIT}),s==null)continue;for(var a=i.node.lastChild;a;)n.push({node:a,context:s,phase:Pn.ENTER}),a=a.previousSibling}else e.exit&&e.exit(i.node,i.context)}}Pn.STOP=Symbol("walkDOM.STOP");Pn.ENTER=0;Pn.EXIT=1;function Vs(r,t){pi(r);var e=t||{};this.ownerDocument=this,this.contentType=e.contentType||rf.XML_APPLICATION,this.type=Rk(this.contentType)?"html":"xml"}function qk(r,t,e){r&&r._inc++;var n=e.namespaceURI;n===os.XMLNS&&(t._nsMap[e.prefix?e.localName:""]=e.value)}function CC(r,t,e,n){r&&r._inc++;var i=e.namespaceURI;i===os.XMLNS&&delete t._nsMap[e.prefix?e.localName:""]}function EC(r,t,e){if(r&&r._inc){r._inc++;var n=t.childNodes;if(e&&!e.nextSibling)n[n.length++]=e;else{for(var i=t.firstChild,s=0;i;)n[s++]=i,i=i.nextSibling;n.length=s,delete n[n.length]}}}function TC(r,t){if(r!==t.parentNode)throw new It(It.NOT_FOUND_ERR,"child's parent is not parent");var e=t.previousSibling,n=t.nextSibling;return e?e.nextSibling=n:r.firstChild=n,n?n.previousSibling=e:r.lastChild=e,EC(r.ownerDocument,r),t.parentNode=null,t.previousSibling=null,t.nextSibling=null,t}function Vk(r){return r&&(r.nodeType===Jt.DOCUMENT_NODE||r.nodeType===Jt.DOCUMENT_FRAGMENT_NODE||r.nodeType===Jt.ELEMENT_NODE)}function Xk(r){return r&&(r.nodeType===Jt.CDATA_SECTION_NODE||r.nodeType===Jt.COMMENT_NODE||r.nodeType===Jt.DOCUMENT_FRAGMENT_NODE||r.nodeType===Jt.DOCUMENT_TYPE_NODE||r.nodeType===Jt.ELEMENT_NODE||r.nodeType===Jt.PROCESSING_INSTRUCTION_NODE||r.nodeType===Jt.TEXT_NODE)}function to(r){return r&&r.nodeType===Jt.DOCUMENT_TYPE_NODE}function qs(r){return r&&r.nodeType===Jt.ELEMENT_NODE}function SC(r){return r&&r.nodeType===Jt.TEXT_NODE}function hC(r,t){var e=r.childNodes||[];if(as(e,qs)||to(t))return!1;var n=as(e,to);return!(t&&n&&e.indexOf(n)>e.indexOf(t))}function dC(r,t){var e=r.childNodes||[];function n(s){return qs(s)&&s!==t}if(as(e,n))return!1;var i=as(e,to);return!(t&&i&&e.indexOf(i)>e.indexOf(t))}function Yk(r,t,e){if(!Vk(r))throw new It(It.HIERARCHY_REQUEST_ERR,"Unexpected parent node type "+r.nodeType);if(e&&e.parentNode!==r)throw new It(It.NOT_FOUND_ERR,"child not in parent");if(!Xk(t)||to(t)&&r.nodeType!==Jt.DOCUMENT_NODE)throw new It(It.HIERARCHY_REQUEST_ERR,"Unexpected node type "+t.nodeType+" for parent node type "+r.nodeType)}function Kk(r,t,e){var n=r.childNodes||[],i=t.childNodes||[];if(t.nodeType===Jt.DOCUMENT_FRAGMENT_NODE){var s=i.filter(qs);if(s.length>1||as(i,SC))throw new It(It.HIERARCHY_REQUEST_ERR,"More than one element or text in fragment");if(s.length===1&&!hC(r,e))throw new It(It.HIERARCHY_REQUEST_ERR,"Element in fragment can not be inserted before doctype")}if(qs(t)&&!hC(r,e))throw new It(It.HIERARCHY_REQUEST_ERR,"Only one element can be added and only after doctype");if(to(t)){if(as(n,to))throw new It(It.HIERARCHY_REQUEST_ERR,"Only one doctype is allowed");var a=as(n,qs);if(e&&n.indexOf(a)<n.indexOf(e))throw new It(It.HIERARCHY_REQUEST_ERR,"Doctype can only be inserted before an element");if(!e&&a)throw new It(It.HIERARCHY_REQUEST_ERR,"Doctype can not be appended since element is present")}}function DC(r,t,e){var n=r.childNodes||[],i=t.childNodes||[];if(t.nodeType===Jt.DOCUMENT_FRAGMENT_NODE){var s=i.filter(qs);if(s.length>1||as(i,SC))throw new It(It.HIERARCHY_REQUEST_ERR,"More than one element or text in fragment");if(s.length===1&&!dC(r,e))throw new It(It.HIERARCHY_REQUEST_ERR,"Element in fragment can not be inserted before doctype")}if(qs(t)&&!dC(r,e))throw new It(It.HIERARCHY_REQUEST_ERR,"Only one element can be added and only after doctype");if(to(t)){if(as(n,function(c){return to(c)&&c!==e}))throw new It(It.HIERARCHY_REQUEST_ERR,"Only one doctype is allowed");var a=as(n,qs);if(e&&n.indexOf(a)<n.indexOf(e))throw new It(It.HIERARCHY_REQUEST_ERR,"Doctype can only be inserted before an element")}}function Rg(r,t,e,n){Yk(r,t,e),r.nodeType===Jt.DOCUMENT_NODE&&(n||Kk)(r,t,e);var i=t.parentNode;if(i&&i.removeChild(t),t.nodeType===Ja){var s=t.firstChild;if(s==null)return t;var a=t.lastChild}else s=a=t;var l=e?e.previousSibling:r.lastChild;s.previousSibling=l,a.nextSibling=e,l?l.nextSibling=s:r.firstChild=s,e==null?r.lastChild=a:e.previousSibling=a;do s.parentNode=r;while(s!==a&&(s=s.nextSibling));return EC(r.ownerDocument||r,r,t),t.nodeType==Ja&&(t.firstChild=t.lastChild=null),t}Vs.prototype={implementation:null,nodeName:"#document",nodeType:gu,doctype:null,documentElement:null,_inc:1,insertBefore:function(r,t){if(r.nodeType===Ja){for(var e=r.firstChild;e;){var n=e.nextSibling;this.insertBefore(e,t),e=n}return r}return Rg(this,r,t),r.ownerDocument=this,this.documentElement===null&&r.nodeType===ar&&(this.documentElement=r),r},removeChild:function(r){var t=TC(this,r);return t===this.documentElement&&(this.documentElement=null),t},replaceChild:function(r,t){Rg(this,r,t,DC),r.ownerDocument=this,t&&this.removeChild(t),qs(r)&&(this.documentElement=r)},importNode:function(r,t){return Zk(this,r,t)},getElementById:function(r){var t=null;return Fg(this.documentElement,function(e){if(e.nodeType==ar&&e.getAttribute("id")==r)return t=e,!0}),t},createElement:function(r){var t=new Xs(ni);t.ownerDocument=this,this.type==="html"&&(r=r.toLowerCase()),Pk(this.contentType)&&(t.namespaceURI=os.HTML),t.nodeName=r,t.tagName=r,t.localName=r,t.childNodes=new dn;var e=t.attributes=new xu;return e._ownerElement=t,t},createDocumentFragment:function(){var r=new vu(ni);return r.ownerDocument=this,r.childNodes=new dn,r},createTextNode:function(r){var t=new sf(ni);return t.ownerDocument=this,t.childNodes=new dn,t.appendData(r),t},createComment:function(r){var t=new Bg(ni);return t.ownerDocument=this,t.childNodes=new dn,t.appendData(r),t},createCDATASection:function(r){if(r.indexOf("]]>")!==-1)throw new It(It.INVALID_CHARACTER_ERR,'data contains "]]>"');var t=new Ug(ni);return t.ownerDocument=this,t.childNodes=new dn,t.appendData(r),t},createProcessingInstruction:function(r,t){var e=new jg(ni);return e.ownerDocument=this,e.childNodes=new dn,e.nodeName=e.target=r,e.nodeValue=e.data=t,e},createAttribute:function(r){if(!Fn.QName_exact.test(r))throw new It(It.INVALID_CHARACTER_ERR,'invalid character in name "'+r+'"');return this.type==="html"&&(r=r.toLowerCase()),this._createAttribute(r)},_createAttribute:function(r){var t=new ul(ni);return t.ownerDocument=this,t.childNodes=new dn,t.name=r,t.nodeName=r,t.localName=r,t.specified=!0,t},createEntityReference:function(r){if(!Fn.Name.test(r))throw new It(It.INVALID_CHARACTER_ERR,'not a valid xml name "'+r+'"');if(this.type==="html")throw new It("document is an html document",sr.NotSupportedError);var t=new zg(ni);return t.ownerDocument=this,t.childNodes=new dn,t.nodeName=r,t},createElementNS:function(r,t){var e=rx(r,t),n=new Xs(ni),i=n.attributes=new xu;return n.childNodes=new dn,n.ownerDocument=this,n.nodeName=t,n.tagName=t,n.namespaceURI=e[0],n.prefix=e[1],n.localName=e[2],i._ownerElement=n,n},createAttributeNS:function(r,t){var e=rx(r,t),n=new ul(ni);return n.ownerDocument=this,n.childNodes=new dn,n.nodeName=t,n.name=t,n.specified=!0,n.namespaceURI=e[0],n.prefix=e[1],n.localName=e[2],n}};mi(Vs,Jt);function Xs(r){pi(r),this._nsMap=Object.create(null)}Xs.prototype={nodeType:ar,attributes:null,getQualifiedName:function(){return this.prefix?this.prefix+":"+this.localName:this.localName},_isInHTMLDocumentAndNamespace:function(){return this.ownerDocument.type==="html"&&this.namespaceURI===os.HTML},hasAttributes:function(){return!!(this.attributes&&this.attributes.length)},hasAttribute:function(r){return!!this.getAttributeNode(r)},getAttribute:function(r){var t=this.getAttributeNode(r);return t?t.value:null},getAttributeNode:function(r){return this._isInHTMLDocumentAndNamespace()&&(r=r.toLowerCase()),this.attributes.getNamedItem(r)},setAttribute:function(r,t){this._isInHTMLDocumentAndNamespace()&&(r=r.toLowerCase());var e=this.getAttributeNode(r);e?e.value=e.nodeValue=""+t:(e=this.ownerDocument._createAttribute(r),e.value=e.nodeValue=""+t,this.setAttributeNode(e))},removeAttribute:function(r){var t=this.getAttributeNode(r);t&&this.removeAttributeNode(t)},setAttributeNode:function(r){return this.attributes.setNamedItem(r)},setAttributeNodeNS:function(r){return this.attributes.setNamedItemNS(r)},removeAttributeNode:function(r){return this.attributes.removeNamedItem(r.nodeName)},removeAttributeNS:function(r,t){var e=this.getAttributeNodeNS(r,t);e&&this.removeAttributeNode(e)},hasAttributeNS:function(r,t){return this.getAttributeNodeNS(r,t)!=null},getAttributeNS:function(r,t){var e=this.getAttributeNodeNS(r,t);return e?e.value:null},setAttributeNS:function(r,t,e){var n=rx(r,t),i=n[2],s=this.getAttributeNodeNS(r,i);s?s.value=s.nodeValue=""+e:(s=this.ownerDocument.createAttributeNS(r,t),s.value=s.nodeValue=""+e,this.setAttributeNode(s))},getAttributeNodeNS:function(r,t){return this.attributes.getNamedItemNS(r,t)},getElementsByClassName:function(r){var t=lC(r);return new ss(this,function(e){var n=[];return t.length>0&&Fg(e,function(i){if(i!==e&&i.nodeType===ar){var s=i.getAttribute("class");if(s){var a=r===s;if(!a){var l=lC(s);a=t.every(jk(l))}a&&n.push(i)}}}),n})},getElementsByTagName:function(r){var t=(this.nodeType===gu?this:this.ownerDocument).type==="html",e=r.toLowerCase();return new ss(this,function(n){var i=[];return Fg(n,function(s){if(!(s===n||s.nodeType!==ar))if(r==="*")i.push(s);else{var a=s.getQualifiedName(),l=t&&s.namespaceURI===os.HTML?e:r;a===l&&i.push(s)}}),i})},getElementsByTagNameNS:function(r,t){return new ss(this,function(e){var n=[];return Fg(e,function(i){i!==e&&i.nodeType===ar&&(r==="*"||i.namespaceURI===r)&&(t==="*"||i.localName==t)&&n.push(i)}),n})}};Vs.prototype.getElementsByClassName=Xs.prototype.getElementsByClassName;Vs.prototype.getElementsByTagName=Xs.prototype.getElementsByTagName;Vs.prototype.getElementsByTagNameNS=Xs.prototype.getElementsByTagNameNS;mi(Xs,Jt);function ul(r){pi(r),this.namespaceURI=null,this.prefix=null,this.ownerElement=null}ul.prototype.nodeType=bu;mi(ul,Jt);function Au(r){pi(r)}Au.prototype={data:"",substringData:function(r,t){return this.data.substring(r,r+t)},appendData:function(r){r=this.data+r,this.nodeValue=this.data=r,this.length=r.length},insertData:function(r,t){this.replaceData(r,0,t)},deleteData:function(r,t){this.replaceData(r,t,"")},replaceData:function(r,t,e){var n=this.data.substring(0,r),i=this.data.substring(r+t);e=n+e+i,this.nodeValue=this.data=e,this.length=e.length}};mi(Au,Jt);function sf(r){pi(r)}sf.prototype={nodeName:"#text",nodeType:Pg,splitText:function(r){var t=this.data,e=t.substring(r);t=t.substring(0,r),this.data=this.nodeValue=t,this.length=t.length;var n=this.ownerDocument.createTextNode(e);return this.parentNode&&this.parentNode.insertBefore(n,this.nextSibling),n}};mi(sf,Au);function Bg(r){pi(r)}Bg.prototype={nodeName:"#comment",nodeType:ax};mi(Bg,Au);function Ug(r){pi(r)}Ug.prototype={nodeName:"#cdata-section",nodeType:gC};mi(Ug,sf);function $g(r){pi(r)}$g.prototype.nodeType=bC;mi($g,Jt);function ox(r){pi(r)}ox.prototype.nodeType=Hk;mi(ox,Jt);function lx(r){pi(r)}lx.prototype.nodeType=Gk;mi(lx,Jt);function zg(r){pi(r)}zg.prototype.nodeType=yC;mi(zg,Jt);function vu(r){pi(r)}vu.prototype.nodeName="#document-fragment";vu.prototype.nodeType=Ja;mi(vu,Jt);function jg(r){pi(r)}jg.prototype.nodeType=sx;mi(jg,Au);function NC(){}NC.prototype.serializeToString=function(r,t){return IC.call(r,t)};Jt.prototype.toString=IC;function IC(r){var t;typeof r=="function"?t={requireWellFormed:!1,splitCDATASections:!0,nodeFilter:r}:r!=null?t={requireWellFormed:!!r.requireWellFormed,splitCDATASections:r.splitCDATASections!==!1,nodeFilter:r.nodeFilter||null}:t={requireWellFormed:!1,splitCDATASections:!0,nodeFilter:null};var e=[],n=this.nodeType===gu&&this.documentElement||this,i=n.prefix,s=n.namespaceURI;if(s&&i==null){var i=n.lookupPrefix(s);if(i==null)var a=[{namespace:s,prefix:null}]}return cx(this,e,a,t),e.join("")}function fC(r,t,e){var n=r.prefix||"",i=r.namespaceURI;if(!i||n==="xml"&&i===os.XML||i===os.XMLNS)return!1;for(var s=e.length;s--;){var a=e[s];if(a.prefix===n)return a.namespace!==i}return!0}function Og(r,t,e){r.push(" ",t,'="',e.replace(/[<>&"\t\n\r]/g,vC),'"')}function cx(r,t,e,n){e||(e=[]);var i=n.nodeFilter,s=n.requireWellFormed,a=n.splitCDATASections,l=r.nodeType===gu?r:r.ownerDocument,c=l.type==="html";Pn(r,{ns:e},{enter:function(u,h){var d=h.ns;if(i)if(u=i(u),u){if(typeof u=="string")return t.push(u),null}else return null;switch(u.nodeType){case ar:var f=u.attributes,p=f.length,m=u.tagName,y=m;if(!c&&!u.prefix&&u.namespaceURI){for(var x,b=0;b<f.length;b++)if(f.item(b).name==="xmlns"){x=f.item(b).value;break}if(!x)for(var w=d.length-1;w>=0;w--){var C=d[w];if(C.prefix===""&&C.namespace===u.namespaceURI){x=C.namespace;break}}if(x!==u.namespaceURI)for(var w=d.length-1;w>=0;w--){var C=d[w];if(C.namespace===u.namespaceURI){C.prefix&&(y=C.prefix+":"+m);break}}}t.push("<",y);for(var E=d.slice(),S=0;S<p;S++){var N=f.item(S);N.prefix=="xmlns"?E.push({prefix:N.localName,namespace:N.value}):N.nodeName=="xmlns"&&E.push({prefix:"",namespace:N.value})}for(var S=0;S<p;S++){var N=f.item(S);if(fC(N,c,E)){var k=N.prefix||"",M=N.namespaceURI;Og(t,k?"xmlns:"+k:"xmlns",M),E.push({prefix:k,namespace:M})}var R=i?i(N):N;R&&(typeof R=="string"?t.push(R):Og(t,R.name,R.value))}if(m===y&&fC(u,c,E)){var j=u.prefix||"",M=u.namespaceURI;Og(t,j?"xmlns:"+j:"xmlns",M),E.push({prefix:j,namespace:M})}var $=!u.firstChild;if($&&(c||u.namespaceURI===os.HTML)&&($=Bk(m)),$)return t.push("/>"),null;if(t.push(">"),c&&Lk(m)){for(var q=u.firstChild;q;)q.data?t.push(q.data):cx(q,t,E.slice(),n),q=q.nextSibling;return t.push("</",y,">"),null}return{ns:E,tag:y};case gu:case Ja:if(s&&u.nodeType===gu&&u.documentElement==null)throw new It("The Document has no documentElement",sr.InvalidStateError);return{ns:d};case bu:return Og(t,u.name,u.value),null;case Pg:if(s&&Fn.InvalidChar.test(u.data))throw new It("The Text node data contains characters outside the XML Char production",sr.InvalidStateError);return t.push(u.data.replace(/[<&>]/g,vC)),null;case gC:if(s&&u.data.indexOf("]]>")!==-1)throw new It('The CDATASection data contains "]]>"',sr.InvalidStateError);return a?t.push(Fn.CDATA_START,u.data.replace(/]]>/g,"]]]]><![CDATA[>"),Fn.CDATA_END):t.push(Fn.CDATA_START,u.data,Fn.CDATA_END),null;case ax:if(s){if(Fn.InvalidChar.test(u.data))throw new It("The comment node data contains characters outside the XML Char production",sr.InvalidStateError);if(u.data.indexOf("--")!==-1||u.data[u.data.length-1]==="-")throw new It('The comment node data contains "--" or ends with "-"',sr.InvalidStateError)}return t.push(Fn.COMMENT_START,u.data,Fn.COMMENT_END),null;case bC:var Q=u.publicId,Z=u.systemId;if(s){if(Q&&!Fn.PubidLiteral_match.test(Q))throw new It("DocumentType publicId is not a valid PubidLiteral",sr.InvalidStateError);if(Z&&Z!=="."&&!Fn.SystemLiteral_match.test(Z))throw new It("DocumentType systemId is not a valid SystemLiteral",sr.InvalidStateError);if(u.internalSubset&&u.internalSubset.indexOf("]>")!==-1)throw new It('DocumentType internalSubset contains "]>"',sr.InvalidStateError)}return t.push(Fn.DOCTYPE_DECL_START," ",u.name),Q?(t.push(" ",Fn.PUBLIC," ",Q),Z&&Z!=="."&&t.push(" ",Z)):Z&&Z!=="."&&t.push(" ",Fn.SYSTEM," ",Z),u.internalSubset&&t.push(" [",u.internalSubset,"]"),t.push(">"),null;case sx:if(s){if(u.target.indexOf(":")!==-1||u.target.toLowerCase()==="xml")throw new It("The ProcessingInstruction target is not well-formed",sr.InvalidStateError);if(Fn.InvalidChar.test(u.data))throw new It("The ProcessingInstruction data contains characters outside the XML Char production",sr.InvalidStateError);if(u.data.indexOf("?>")!==-1)throw new It('The ProcessingInstruction data contains "?>"',sr.InvalidStateError)}return t.push("<?",u.target," ",u.data,"?>"),null;case yC:return t.push("&",u.nodeName,";"),null;default:return t.push("??",u.nodeName),null}},exit:function(u,h){h&&h.tag&&t.push("</",h.tag,">")}})}function Zk(r,t,e){var n;return Pn(t,null,{enter:function(i,s){var a=i.cloneNode(!1);a.ownerDocument=r,a.parentNode=null,s===null?n=a:s.appendChild(a);var l=i.nodeType===bu||e;return l?a:null}}),n}function kC(r,t,e){var n;return Pn(t,null,{enter:function(i,s){var a=new i.constructor(ni);for(var l in i)if(yu(i,l)){var c=i[l];typeof c!="object"&&c!=a[l]&&(a[l]=c)}i.childNodes&&(a.childNodes=new dn),a.ownerDocument=r;var u=e;switch(a.nodeType){case ar:var h=i.attributes,d=a.attributes=new xu,f=h.length;d._ownerElement=a;for(var p=0;p<f;p++)a.setAttributeNode(kC(r,h.item(p),!0));break;case bu:u=!0}return s!==null?s.appendChild(a):n=a,u?a:null}}),n}function _C(r,t,e){r[t]=e}function ix(r){for(var t=[],e=r.firstChild;e;)e.nodeType===ar&&t.push(e),e=e.nextSibling;return t}try{Object.defineProperty&&(Object.defineProperty(ss.prototype,"length",{get:function(){return Lg(this),this.$$length}}),Object.defineProperty(Jt.prototype,"textContent",{get:function(){if(this.nodeType===ar||this.nodeType===Ja){var r=[];return Pn(this,null,{enter:function(t){if(t.nodeType===ar||t.nodeType===Ja)return!0;if(t.nodeType===sx||t.nodeType===ax)return null;r.push(t.nodeValue)}}),r.join("")}return this.nodeValue},set:function(r){switch(this.nodeType){case ar:case Ja:for(;this.firstChild;)this.removeChild(this.firstChild);(r||String(r))&&this.appendChild(this.ownerDocument.createTextNode(r));break;default:this.data=r,this.value=r,this.nodeValue=r}}}),Object.defineProperty(Xs.prototype,"children",{get:function(){return new ss(this,ix)}}),Object.defineProperty(Vs.prototype,"children",{get:function(){return new ss(this,ix)}}),Object.defineProperty(vu.prototype,"children",{get:function(){return new ss(this,ix)}}),_C=function(r,t,e){r["$$"+t]=e})}catch{}je._updateLiveList=Lg;je.Attr=ul;je.CDATASection=Ug;je.CharacterData=Au;je.Comment=Bg;je.Document=Vs;je.DocumentFragment=vu;je.DocumentType=$g;je.DOMImplementation=AC;je.Element=Xs;je.Entity=lx;je.EntityReference=zg;je.LiveNodeList=ss;je.NamedNodeMap=xu;je.Node=Jt;je.NodeList=dn;je.Notation=ox;je.Text=sf;je.ProcessingInstruction=jg;je.walkDOM=Pn;je.XMLSerializer=NC});var OC=Xt(af=>{"use strict";B();var MC=cl().freeze;af.XML_ENTITIES=MC({amp:"&",apos:"'",gt:">",lt:"<",quot:'"'});af.HTML_ENTITIES=MC({Aacute:"\xC1",aacute:"\xE1",Abreve:"\u0102",abreve:"\u0103",ac:"\u223E",acd:"\u223F",acE:"\u223E\u0333",Acirc:"\xC2",acirc:"\xE2",acute:"\xB4",Acy:"\u0410",acy:"\u0430",AElig:"\xC6",aelig:"\xE6",af:"\u2061",Afr:"\u{1D504}",afr:"\u{1D51E}",Agrave:"\xC0",agrave:"\xE0",alefsym:"\u2135",aleph:"\u2135",Alpha:"\u0391",alpha:"\u03B1",Amacr:"\u0100",amacr:"\u0101",amalg:"\u2A3F",AMP:"&",amp:"&",And:"\u2A53",and:"\u2227",andand:"\u2A55",andd:"\u2A5C",andslope:"\u2A58",andv:"\u2A5A",ang:"\u2220",ange:"\u29A4",angle:"\u2220",angmsd:"\u2221",angmsdaa:"\u29A8",angmsdab:"\u29A9",angmsdac:"\u29AA",angmsdad:"\u29AB",angmsdae:"\u29AC",angmsdaf:"\u29AD",angmsdag:"\u29AE",angmsdah:"\u29AF",angrt:"\u221F",angrtvb:"\u22BE",angrtvbd:"\u299D",angsph:"\u2222",angst:"\xC5",angzarr:"\u237C",Aogon:"\u0104",aogon:"\u0105",Aopf:"\u{1D538}",aopf:"\u{1D552}",ap:"\u2248",apacir:"\u2A6F",apE:"\u2A70",ape:"\u224A",apid:"\u224B",apos:"'",ApplyFunction:"\u2061",approx:"\u2248",approxeq:"\u224A",Aring:"\xC5",aring:"\xE5",Ascr:"\u{1D49C}",ascr:"\u{1D4B6}",Assign:"\u2254",ast:"*",asymp:"\u2248",asympeq:"\u224D",Atilde:"\xC3",atilde:"\xE3",Auml:"\xC4",auml:"\xE4",awconint:"\u2233",awint:"\u2A11",backcong:"\u224C",backepsilon:"\u03F6",backprime:"\u2035",backsim:"\u223D",backsimeq:"\u22CD",Backslash:"\u2216",Barv:"\u2AE7",barvee:"\u22BD",Barwed:"\u2306",barwed:"\u2305",barwedge:"\u2305",bbrk:"\u23B5",bbrktbrk:"\u23B6",bcong:"\u224C",Bcy:"\u0411",bcy:"\u0431",bdquo:"\u201E",becaus:"\u2235",Because:"\u2235",because:"\u2235",bemptyv:"\u29B0",bepsi:"\u03F6",bernou:"\u212C",Bernoullis:"\u212C",Beta:"\u0392",beta:"\u03B2",beth:"\u2136",between:"\u226C",Bfr:"\u{1D505}",bfr:"\u{1D51F}",bigcap:"\u22C2",bigcirc:"\u25EF",bigcup:"\u22C3",bigodot:"\u2A00",bigoplus:"\u2A01",bigotimes:"\u2A02",bigsqcup:"\u2A06",bigstar:"\u2605",bigtriangledown:"\u25BD",bigtriangleup:"\u25B3",biguplus:"\u2A04",bigvee:"\u22C1",bigwedge:"\u22C0",bkarow:"\u290D",blacklozenge:"\u29EB",blacksquare:"\u25AA",blacktriangle:"\u25B4",blacktriangledown:"\u25BE",blacktriangleleft:"\u25C2",blacktriangleright:"\u25B8",blank:"\u2423",blk12:"\u2592",blk14:"\u2591",blk34:"\u2593",block:"\u2588",bne:"=\u20E5",bnequiv:"\u2261\u20E5",bNot:"\u2AED",bnot:"\u2310",Bopf:"\u{1D539}",bopf:"\u{1D553}",bot:"\u22A5",bottom:"\u22A5",bowtie:"\u22C8",boxbox:"\u29C9",boxDL:"\u2557",boxDl:"\u2556",boxdL:"\u2555",boxdl:"\u2510",boxDR:"\u2554",boxDr:"\u2553",boxdR:"\u2552",boxdr:"\u250C",boxH:"\u2550",boxh:"\u2500",boxHD:"\u2566",boxHd:"\u2564",boxhD:"\u2565",boxhd:"\u252C",boxHU:"\u2569",boxHu:"\u2567",boxhU:"\u2568",boxhu:"\u2534",boxminus:"\u229F",boxplus:"\u229E",boxtimes:"\u22A0",boxUL:"\u255D",boxUl:"\u255C",boxuL:"\u255B",boxul:"\u2518",boxUR:"\u255A",boxUr:"\u2559",boxuR:"\u2558",boxur:"\u2514",boxV:"\u2551",boxv:"\u2502",boxVH:"\u256C",boxVh:"\u256B",boxvH:"\u256A",boxvh:"\u253C",boxVL:"\u2563",boxVl:"\u2562",boxvL:"\u2561",boxvl:"\u2524",boxVR:"\u2560",boxVr:"\u255F",boxvR:"\u255E",boxvr:"\u251C",bprime:"\u2035",Breve:"\u02D8",breve:"\u02D8",brvbar:"\xA6",Bscr:"\u212C",bscr:"\u{1D4B7}",bsemi:"\u204F",bsim:"\u223D",bsime:"\u22CD",bsol:"\\",bsolb:"\u29C5",bsolhsub:"\u27C8",bull:"\u2022",bullet:"\u2022",bump:"\u224E",bumpE:"\u2AAE",bumpe:"\u224F",Bumpeq:"\u224E",bumpeq:"\u224F",Cacute:"\u0106",cacute:"\u0107",Cap:"\u22D2",cap:"\u2229",capand:"\u2A44",capbrcup:"\u2A49",capcap:"\u2A4B",capcup:"\u2A47",capdot:"\u2A40",CapitalDifferentialD:"\u2145",caps:"\u2229\uFE00",caret:"\u2041",caron:"\u02C7",Cayleys:"\u212D",ccaps:"\u2A4D",Ccaron:"\u010C",ccaron:"\u010D",Ccedil:"\xC7",ccedil:"\xE7",Ccirc:"\u0108",ccirc:"\u0109",Cconint:"\u2230",ccups:"\u2A4C",ccupssm:"\u2A50",Cdot:"\u010A",cdot:"\u010B",cedil:"\xB8",Cedilla:"\xB8",cemptyv:"\u29B2",cent:"\xA2",CenterDot:"\xB7",centerdot:"\xB7",Cfr:"\u212D",cfr:"\u{1D520}",CHcy:"\u0427",chcy:"\u0447",check:"\u2713",checkmark:"\u2713",Chi:"\u03A7",chi:"\u03C7",cir:"\u25CB",circ:"\u02C6",circeq:"\u2257",circlearrowleft:"\u21BA",circlearrowright:"\u21BB",circledast:"\u229B",circledcirc:"\u229A",circleddash:"\u229D",CircleDot:"\u2299",circledR:"\xAE",circledS:"\u24C8",CircleMinus:"\u2296",CirclePlus:"\u2295",CircleTimes:"\u2297",cirE:"\u29C3",cire:"\u2257",cirfnint:"\u2A10",cirmid:"\u2AEF",cirscir:"\u29C2",ClockwiseContourIntegral:"\u2232",CloseCurlyDoubleQuote:"\u201D",CloseCurlyQuote:"\u2019",clubs:"\u2663",clubsuit:"\u2663",Colon:"\u2237",colon:":",Colone:"\u2A74",colone:"\u2254",coloneq:"\u2254",comma:",",commat:"@",comp:"\u2201",compfn:"\u2218",complement:"\u2201",complexes:"\u2102",cong:"\u2245",congdot:"\u2A6D",Congruent:"\u2261",Conint:"\u222F",conint:"\u222E",ContourIntegral:"\u222E",Copf:"\u2102",copf:"\u{1D554}",coprod:"\u2210",Coproduct:"\u2210",COPY:"\xA9",copy:"\xA9",copysr:"\u2117",CounterClockwiseContourIntegral:"\u2233",crarr:"\u21B5",Cross:"\u2A2F",cross:"\u2717",Cscr:"\u{1D49E}",cscr:"\u{1D4B8}",csub:"\u2ACF",csube:"\u2AD1",csup:"\u2AD0",csupe:"\u2AD2",ctdot:"\u22EF",cudarrl:"\u2938",cudarrr:"\u2935",cuepr:"\u22DE",cuesc:"\u22DF",cularr:"\u21B6",cularrp:"\u293D",Cup:"\u22D3",cup:"\u222A",cupbrcap:"\u2A48",CupCap:"\u224D",cupcap:"\u2A46",cupcup:"\u2A4A",cupdot:"\u228D",cupor:"\u2A45",cups:"\u222A\uFE00",curarr:"\u21B7",curarrm:"\u293C",curlyeqprec:"\u22DE",curlyeqsucc:"\u22DF",curlyvee:"\u22CE",curlywedge:"\u22CF",curren:"\xA4",curvearrowleft:"\u21B6",curvearrowright:"\u21B7",cuvee:"\u22CE",cuwed:"\u22CF",cwconint:"\u2232",cwint:"\u2231",cylcty:"\u232D",Dagger:"\u2021",dagger:"\u2020",daleth:"\u2138",Darr:"\u21A1",dArr:"\u21D3",darr:"\u2193",dash:"\u2010",Dashv:"\u2AE4",dashv:"\u22A3",dbkarow:"\u290F",dblac:"\u02DD",Dcaron:"\u010E",dcaron:"\u010F",Dcy:"\u0414",dcy:"\u0434",DD:"\u2145",dd:"\u2146",ddagger:"\u2021",ddarr:"\u21CA",DDotrahd:"\u2911",ddotseq:"\u2A77",deg:"\xB0",Del:"\u2207",Delta:"\u0394",delta:"\u03B4",demptyv:"\u29B1",dfisht:"\u297F",Dfr:"\u{1D507}",dfr:"\u{1D521}",dHar:"\u2965",dharl:"\u21C3",dharr:"\u21C2",DiacriticalAcute:"\xB4",DiacriticalDot:"\u02D9",DiacriticalDoubleAcute:"\u02DD",DiacriticalGrave:"`",DiacriticalTilde:"\u02DC",diam:"\u22C4",Diamond:"\u22C4",diamond:"\u22C4",diamondsuit:"\u2666",diams:"\u2666",die:"\xA8",DifferentialD:"\u2146",digamma:"\u03DD",disin:"\u22F2",div:"\xF7",divide:"\xF7",divideontimes:"\u22C7",divonx:"\u22C7",DJcy:"\u0402",djcy:"\u0452",dlcorn:"\u231E",dlcrop:"\u230D",dollar:"$",Dopf:"\u{1D53B}",dopf:"\u{1D555}",Dot:"\xA8",dot:"\u02D9",DotDot:"\u20DC",doteq:"\u2250",doteqdot:"\u2251",DotEqual:"\u2250",dotminus:"\u2238",dotplus:"\u2214",dotsquare:"\u22A1",doublebarwedge:"\u2306",DoubleContourIntegral:"\u222F",DoubleDot:"\xA8",DoubleDownArrow:"\u21D3",DoubleLeftArrow:"\u21D0",DoubleLeftRightArrow:"\u21D4",DoubleLeftTee:"\u2AE4",DoubleLongLeftArrow:"\u27F8",DoubleLongLeftRightArrow:"\u27FA",DoubleLongRightArrow:"\u27F9",DoubleRightArrow:"\u21D2",DoubleRightTee:"\u22A8",DoubleUpArrow:"\u21D1",DoubleUpDownArrow:"\u21D5",DoubleVerticalBar:"\u2225",DownArrow:"\u2193",Downarrow:"\u21D3",downarrow:"\u2193",DownArrowBar:"\u2913",DownArrowUpArrow:"\u21F5",DownBreve:"\u0311",downdownarrows:"\u21CA",downharpoonleft:"\u21C3",downharpoonright:"\u21C2",DownLeftRightVector:"\u2950",DownLeftTeeVector:"\u295E",DownLeftVector:"\u21BD",DownLeftVectorBar:"\u2956",DownRightTeeVector:"\u295F",DownRightVector:"\u21C1",DownRightVectorBar:"\u2957",DownTee:"\u22A4",DownTeeArrow:"\u21A7",drbkarow:"\u2910",drcorn:"\u231F",drcrop:"\u230C",Dscr:"\u{1D49F}",dscr:"\u{1D4B9}",DScy:"\u0405",dscy:"\u0455",dsol:"\u29F6",Dstrok:"\u0110",dstrok:"\u0111",dtdot:"\u22F1",dtri:"\u25BF",dtrif:"\u25BE",duarr:"\u21F5",duhar:"\u296F",dwangle:"\u29A6",DZcy:"\u040F",dzcy:"\u045F",dzigrarr:"\u27FF",Eacute:"\xC9",eacute:"\xE9",easter:"\u2A6E",Ecaron:"\u011A",ecaron:"\u011B",ecir:"\u2256",Ecirc:"\xCA",ecirc:"\xEA",ecolon:"\u2255",Ecy:"\u042D",ecy:"\u044D",eDDot:"\u2A77",Edot:"\u0116",eDot:"\u2251",edot:"\u0117",ee:"\u2147",efDot:"\u2252",Efr:"\u{1D508}",efr:"\u{1D522}",eg:"\u2A9A",Egrave:"\xC8",egrave:"\xE8",egs:"\u2A96",egsdot:"\u2A98",el:"\u2A99",Element:"\u2208",elinters:"\u23E7",ell:"\u2113",els:"\u2A95",elsdot:"\u2A97",Emacr:"\u0112",emacr:"\u0113",empty:"\u2205",emptyset:"\u2205",EmptySmallSquare:"\u25FB",emptyv:"\u2205",EmptyVerySmallSquare:"\u25AB",emsp:"\u2003",emsp13:"\u2004",emsp14:"\u2005",ENG:"\u014A",eng:"\u014B",ensp:"\u2002",Eogon:"\u0118",eogon:"\u0119",Eopf:"\u{1D53C}",eopf:"\u{1D556}",epar:"\u22D5",eparsl:"\u29E3",eplus:"\u2A71",epsi:"\u03B5",Epsilon:"\u0395",epsilon:"\u03B5",epsiv:"\u03F5",eqcirc:"\u2256",eqcolon:"\u2255",eqsim:"\u2242",eqslantgtr:"\u2A96",eqslantless:"\u2A95",Equal:"\u2A75",equals:"=",EqualTilde:"\u2242",equest:"\u225F",Equilibrium:"\u21CC",equiv:"\u2261",equivDD:"\u2A78",eqvparsl:"\u29E5",erarr:"\u2971",erDot:"\u2253",Escr:"\u2130",escr:"\u212F",esdot:"\u2250",Esim:"\u2A73",esim:"\u2242",Eta:"\u0397",eta:"\u03B7",ETH:"\xD0",eth:"\xF0",Euml:"\xCB",euml:"\xEB",euro:"\u20AC",excl:"!",exist:"\u2203",Exists:"\u2203",expectation:"\u2130",ExponentialE:"\u2147",exponentiale:"\u2147",fallingdotseq:"\u2252",Fcy:"\u0424",fcy:"\u0444",female:"\u2640",ffilig:"\uFB03",fflig:"\uFB00",ffllig:"\uFB04",Ffr:"\u{1D509}",ffr:"\u{1D523}",filig:"\uFB01",FilledSmallSquare:"\u25FC",FilledVerySmallSquare:"\u25AA",fjlig:"fj",flat:"\u266D",fllig:"\uFB02",fltns:"\u25B1",fnof:"\u0192",Fopf:"\u{1D53D}",fopf:"\u{1D557}",ForAll:"\u2200",forall:"\u2200",fork:"\u22D4",forkv:"\u2AD9",Fouriertrf:"\u2131",fpartint:"\u2A0D",frac12:"\xBD",frac13:"\u2153",frac14:"\xBC",frac15:"\u2155",frac16:"\u2159",frac18:"\u215B",frac23:"\u2154",frac25:"\u2156",frac34:"\xBE",frac35:"\u2157",frac38:"\u215C",frac45:"\u2158",frac56:"\u215A",frac58:"\u215D",frac78:"\u215E",frasl:"\u2044",frown:"\u2322",Fscr:"\u2131",fscr:"\u{1D4BB}",gacute:"\u01F5",Gamma:"\u0393",gamma:"\u03B3",Gammad:"\u03DC",gammad:"\u03DD",gap:"\u2A86",Gbreve:"\u011E",gbreve:"\u011F",Gcedil:"\u0122",Gcirc:"\u011C",gcirc:"\u011D",Gcy:"\u0413",gcy:"\u0433",Gdot:"\u0120",gdot:"\u0121",gE:"\u2267",ge:"\u2265",gEl:"\u2A8C",gel:"\u22DB",geq:"\u2265",geqq:"\u2267",geqslant:"\u2A7E",ges:"\u2A7E",gescc:"\u2AA9",gesdot:"\u2A80",gesdoto:"\u2A82",gesdotol:"\u2A84",gesl:"\u22DB\uFE00",gesles:"\u2A94",Gfr:"\u{1D50A}",gfr:"\u{1D524}",Gg:"\u22D9",gg:"\u226B",ggg:"\u22D9",gimel:"\u2137",GJcy:"\u0403",gjcy:"\u0453",gl:"\u2277",gla:"\u2AA5",glE:"\u2A92",glj:"\u2AA4",gnap:"\u2A8A",gnapprox:"\u2A8A",gnE:"\u2269",gne:"\u2A88",gneq:"\u2A88",gneqq:"\u2269",gnsim:"\u22E7",Gopf:"\u{1D53E}",gopf:"\u{1D558}",grave:"`",GreaterEqual:"\u2265",GreaterEqualLess:"\u22DB",GreaterFullEqual:"\u2267",GreaterGreater:"\u2AA2",GreaterLess:"\u2277",GreaterSlantEqual:"\u2A7E",GreaterTilde:"\u2273",Gscr:"\u{1D4A2}",gscr:"\u210A",gsim:"\u2273",gsime:"\u2A8E",gsiml:"\u2A90",Gt:"\u226B",GT:">",gt:">",gtcc:"\u2AA7",gtcir:"\u2A7A",gtdot:"\u22D7",gtlPar:"\u2995",gtquest:"\u2A7C",gtrapprox:"\u2A86",gtrarr:"\u2978",gtrdot:"\u22D7",gtreqless:"\u22DB",gtreqqless:"\u2A8C",gtrless:"\u2277",gtrsim:"\u2273",gvertneqq:"\u2269\uFE00",gvnE:"\u2269\uFE00",Hacek:"\u02C7",hairsp:"\u200A",half:"\xBD",hamilt:"\u210B",HARDcy:"\u042A",hardcy:"\u044A",hArr:"\u21D4",harr:"\u2194",harrcir:"\u2948",harrw:"\u21AD",Hat:"^",hbar:"\u210F",Hcirc:"\u0124",hcirc:"\u0125",hearts:"\u2665",heartsuit:"\u2665",hellip:"\u2026",hercon:"\u22B9",Hfr:"\u210C",hfr:"\u{1D525}",HilbertSpace:"\u210B",hksearow:"\u2925",hkswarow:"\u2926",hoarr:"\u21FF",homtht:"\u223B",hookleftarrow:"\u21A9",hookrightarrow:"\u21AA",Hopf:"\u210D",hopf:"\u{1D559}",horbar:"\u2015",HorizontalLine:"\u2500",Hscr:"\u210B",hscr:"\u{1D4BD}",hslash:"\u210F",Hstrok:"\u0126",hstrok:"\u0127",HumpDownHump:"\u224E",HumpEqual:"\u224F",hybull:"\u2043",hyphen:"\u2010",Iacute:"\xCD",iacute:"\xED",ic:"\u2063",Icirc:"\xCE",icirc:"\xEE",Icy:"\u0418",icy:"\u0438",Idot:"\u0130",IEcy:"\u0415",iecy:"\u0435",iexcl:"\xA1",iff:"\u21D4",Ifr:"\u2111",ifr:"\u{1D526}",Igrave:"\xCC",igrave:"\xEC",ii:"\u2148",iiiint:"\u2A0C",iiint:"\u222D",iinfin:"\u29DC",iiota:"\u2129",IJlig:"\u0132",ijlig:"\u0133",Im:"\u2111",Imacr:"\u012A",imacr:"\u012B",image:"\u2111",ImaginaryI:"\u2148",imagline:"\u2110",imagpart:"\u2111",imath:"\u0131",imof:"\u22B7",imped:"\u01B5",Implies:"\u21D2",in:"\u2208",incare:"\u2105",infin:"\u221E",infintie:"\u29DD",inodot:"\u0131",Int:"\u222C",int:"\u222B",intcal:"\u22BA",integers:"\u2124",Integral:"\u222B",intercal:"\u22BA",Intersection:"\u22C2",intlarhk:"\u2A17",intprod:"\u2A3C",InvisibleComma:"\u2063",InvisibleTimes:"\u2062",IOcy:"\u0401",iocy:"\u0451",Iogon:"\u012E",iogon:"\u012F",Iopf:"\u{1D540}",iopf:"\u{1D55A}",Iota:"\u0399",iota:"\u03B9",iprod:"\u2A3C",iquest:"\xBF",Iscr:"\u2110",iscr:"\u{1D4BE}",isin:"\u2208",isindot:"\u22F5",isinE:"\u22F9",isins:"\u22F4",isinsv:"\u22F3",isinv:"\u2208",it:"\u2062",Itilde:"\u0128",itilde:"\u0129",Iukcy:"\u0406",iukcy:"\u0456",Iuml:"\xCF",iuml:"\xEF",Jcirc:"\u0134",jcirc:"\u0135",Jcy:"\u0419",jcy:"\u0439",Jfr:"\u{1D50D}",jfr:"\u{1D527}",jmath:"\u0237",Jopf:"\u{1D541}",jopf:"\u{1D55B}",Jscr:"\u{1D4A5}",jscr:"\u{1D4BF}",Jsercy:"\u0408",jsercy:"\u0458",Jukcy:"\u0404",jukcy:"\u0454",Kappa:"\u039A",kappa:"\u03BA",kappav:"\u03F0",Kcedil:"\u0136",kcedil:"\u0137",Kcy:"\u041A",kcy:"\u043A",Kfr:"\u{1D50E}",kfr:"\u{1D528}",kgreen:"\u0138",KHcy:"\u0425",khcy:"\u0445",KJcy:"\u040C",kjcy:"\u045C",Kopf:"\u{1D542}",kopf:"\u{1D55C}",Kscr:"\u{1D4A6}",kscr:"\u{1D4C0}",lAarr:"\u21DA",Lacute:"\u0139",lacute:"\u013A",laemptyv:"\u29B4",lagran:"\u2112",Lambda:"\u039B",lambda:"\u03BB",Lang:"\u27EA",lang:"\u27E8",langd:"\u2991",langle:"\u27E8",lap:"\u2A85",Laplacetrf:"\u2112",laquo:"\xAB",Larr:"\u219E",lArr:"\u21D0",larr:"\u2190",larrb:"\u21E4",larrbfs:"\u291F",larrfs:"\u291D",larrhk:"\u21A9",larrlp:"\u21AB",larrpl:"\u2939",larrsim:"\u2973",larrtl:"\u21A2",lat:"\u2AAB",lAtail:"\u291B",latail:"\u2919",late:"\u2AAD",lates:"\u2AAD\uFE00",lBarr:"\u290E",lbarr:"\u290C",lbbrk:"\u2772",lbrace:"{",lbrack:"[",lbrke:"\u298B",lbrksld:"\u298F",lbrkslu:"\u298D",Lcaron:"\u013D",lcaron:"\u013E",Lcedil:"\u013B",lcedil:"\u013C",lceil:"\u2308",lcub:"{",Lcy:"\u041B",lcy:"\u043B",ldca:"\u2936",ldquo:"\u201C",ldquor:"\u201E",ldrdhar:"\u2967",ldrushar:"\u294B",ldsh:"\u21B2",lE:"\u2266",le:"\u2264",LeftAngleBracket:"\u27E8",LeftArrow:"\u2190",Leftarrow:"\u21D0",leftarrow:"\u2190",LeftArrowBar:"\u21E4",LeftArrowRightArrow:"\u21C6",leftarrowtail:"\u21A2",LeftCeiling:"\u2308",LeftDoubleBracket:"\u27E6",LeftDownTeeVector:"\u2961",LeftDownVector:"\u21C3",LeftDownVectorBar:"\u2959",LeftFloor:"\u230A",leftharpoondown:"\u21BD",leftharpoonup:"\u21BC",leftleftarrows:"\u21C7",LeftRightArrow:"\u2194",Leftrightarrow:"\u21D4",leftrightarrow:"\u2194",leftrightarrows:"\u21C6",leftrightharpoons:"\u21CB",leftrightsquigarrow:"\u21AD",LeftRightVector:"\u294E",LeftTee:"\u22A3",LeftTeeArrow:"\u21A4",LeftTeeVector:"\u295A",leftthreetimes:"\u22CB",LeftTriangle:"\u22B2",LeftTriangleBar:"\u29CF",LeftTriangleEqual:"\u22B4",LeftUpDownVector:"\u2951",LeftUpTeeVector:"\u2960",LeftUpVector:"\u21BF",LeftUpVectorBar:"\u2958",LeftVector:"\u21BC",LeftVectorBar:"\u2952",lEg:"\u2A8B",leg:"\u22DA",leq:"\u2264",leqq:"\u2266",leqslant:"\u2A7D",les:"\u2A7D",lescc:"\u2AA8",lesdot:"\u2A7F",lesdoto:"\u2A81",lesdotor:"\u2A83",lesg:"\u22DA\uFE00",lesges:"\u2A93",lessapprox:"\u2A85",lessdot:"\u22D6",lesseqgtr:"\u22DA",lesseqqgtr:"\u2A8B",LessEqualGreater:"\u22DA",LessFullEqual:"\u2266",LessGreater:"\u2276",lessgtr:"\u2276",LessLess:"\u2AA1",lesssim:"\u2272",LessSlantEqual:"\u2A7D",LessTilde:"\u2272",lfisht:"\u297C",lfloor:"\u230A",Lfr:"\u{1D50F}",lfr:"\u{1D529}",lg:"\u2276",lgE:"\u2A91",lHar:"\u2962",lhard:"\u21BD",lharu:"\u21BC",lharul:"\u296A",lhblk:"\u2584",LJcy:"\u0409",ljcy:"\u0459",Ll:"\u22D8",ll:"\u226A",llarr:"\u21C7",llcorner:"\u231E",Lleftarrow:"\u21DA",llhard:"\u296B",lltri:"\u25FA",Lmidot:"\u013F",lmidot:"\u0140",lmoust:"\u23B0",lmoustache:"\u23B0",lnap:"\u2A89",lnapprox:"\u2A89",lnE:"\u2268",lne:"\u2A87",lneq:"\u2A87",lneqq:"\u2268",lnsim:"\u22E6",loang:"\u27EC",loarr:"\u21FD",lobrk:"\u27E6",LongLeftArrow:"\u27F5",Longleftarrow:"\u27F8",longleftarrow:"\u27F5",LongLeftRightArrow:"\u27F7",Longleftrightarrow:"\u27FA",longleftrightarrow:"\u27F7",longmapsto:"\u27FC",LongRightArrow:"\u27F6",Longrightarrow:"\u27F9",longrightarrow:"\u27F6",looparrowleft:"\u21AB",looparrowright:"\u21AC",lopar:"\u2985",Lopf:"\u{1D543}",lopf:"\u{1D55D}",loplus:"\u2A2D",lotimes:"\u2A34",lowast:"\u2217",lowbar:"_",LowerLeftArrow:"\u2199",LowerRightArrow:"\u2198",loz:"\u25CA",lozenge:"\u25CA",lozf:"\u29EB",lpar:"(",lparlt:"\u2993",lrarr:"\u21C6",lrcorner:"\u231F",lrhar:"\u21CB",lrhard:"\u296D",lrm:"\u200E",lrtri:"\u22BF",lsaquo:"\u2039",Lscr:"\u2112",lscr:"\u{1D4C1}",Lsh:"\u21B0",lsh:"\u21B0",lsim:"\u2272",lsime:"\u2A8D",lsimg:"\u2A8F",lsqb:"[",lsquo:"\u2018",lsquor:"\u201A",Lstrok:"\u0141",lstrok:"\u0142",Lt:"\u226A",LT:"<",lt:"<",ltcc:"\u2AA6",ltcir:"\u2A79",ltdot:"\u22D6",lthree:"\u22CB",ltimes:"\u22C9",ltlarr:"\u2976",ltquest:"\u2A7B",ltri:"\u25C3",ltrie:"\u22B4",ltrif:"\u25C2",ltrPar:"\u2996",lurdshar:"\u294A",luruhar:"\u2966",lvertneqq:"\u2268\uFE00",lvnE:"\u2268\uFE00",macr:"\xAF",male:"\u2642",malt:"\u2720",maltese:"\u2720",Map:"\u2905",map:"\u21A6",mapsto:"\u21A6",mapstodown:"\u21A7",mapstoleft:"\u21A4",mapstoup:"\u21A5",marker:"\u25AE",mcomma:"\u2A29",Mcy:"\u041C",mcy:"\u043C",mdash:"\u2014",mDDot:"\u223A",measuredangle:"\u2221",MediumSpace:"\u205F",Mellintrf:"\u2133",Mfr:"\u{1D510}",mfr:"\u{1D52A}",mho:"\u2127",micro:"\xB5",mid:"\u2223",midast:"*",midcir:"\u2AF0",middot:"\xB7",minus:"\u2212",minusb:"\u229F",minusd:"\u2238",minusdu:"\u2A2A",MinusPlus:"\u2213",mlcp:"\u2ADB",mldr:"\u2026",mnplus:"\u2213",models:"\u22A7",Mopf:"\u{1D544}",mopf:"\u{1D55E}",mp:"\u2213",Mscr:"\u2133",mscr:"\u{1D4C2}",mstpos:"\u223E",Mu:"\u039C",mu:"\u03BC",multimap:"\u22B8",mumap:"\u22B8",nabla:"\u2207",Nacute:"\u0143",nacute:"\u0144",nang:"\u2220\u20D2",nap:"\u2249",napE:"\u2A70\u0338",napid:"\u224B\u0338",napos:"\u0149",napprox:"\u2249",natur:"\u266E",natural:"\u266E",naturals:"\u2115",nbsp:"\xA0",nbump:"\u224E\u0338",nbumpe:"\u224F\u0338",ncap:"\u2A43",Ncaron:"\u0147",ncaron:"\u0148",Ncedil:"\u0145",ncedil:"\u0146",ncong:"\u2247",ncongdot:"\u2A6D\u0338",ncup:"\u2A42",Ncy:"\u041D",ncy:"\u043D",ndash:"\u2013",ne:"\u2260",nearhk:"\u2924",neArr:"\u21D7",nearr:"\u2197",nearrow:"\u2197",nedot:"\u2250\u0338",NegativeMediumSpace:"\u200B",NegativeThickSpace:"\u200B",NegativeThinSpace:"\u200B",NegativeVeryThinSpace:"\u200B",nequiv:"\u2262",nesear:"\u2928",nesim:"\u2242\u0338",NestedGreaterGreater:"\u226B",NestedLessLess:"\u226A",NewLine:`
|
|
7
|
+
`,nexist:"\u2204",nexists:"\u2204",Nfr:"\u{1D511}",nfr:"\u{1D52B}",ngE:"\u2267\u0338",nge:"\u2271",ngeq:"\u2271",ngeqq:"\u2267\u0338",ngeqslant:"\u2A7E\u0338",nges:"\u2A7E\u0338",nGg:"\u22D9\u0338",ngsim:"\u2275",nGt:"\u226B\u20D2",ngt:"\u226F",ngtr:"\u226F",nGtv:"\u226B\u0338",nhArr:"\u21CE",nharr:"\u21AE",nhpar:"\u2AF2",ni:"\u220B",nis:"\u22FC",nisd:"\u22FA",niv:"\u220B",NJcy:"\u040A",njcy:"\u045A",nlArr:"\u21CD",nlarr:"\u219A",nldr:"\u2025",nlE:"\u2266\u0338",nle:"\u2270",nLeftarrow:"\u21CD",nleftarrow:"\u219A",nLeftrightarrow:"\u21CE",nleftrightarrow:"\u21AE",nleq:"\u2270",nleqq:"\u2266\u0338",nleqslant:"\u2A7D\u0338",nles:"\u2A7D\u0338",nless:"\u226E",nLl:"\u22D8\u0338",nlsim:"\u2274",nLt:"\u226A\u20D2",nlt:"\u226E",nltri:"\u22EA",nltrie:"\u22EC",nLtv:"\u226A\u0338",nmid:"\u2224",NoBreak:"\u2060",NonBreakingSpace:"\xA0",Nopf:"\u2115",nopf:"\u{1D55F}",Not:"\u2AEC",not:"\xAC",NotCongruent:"\u2262",NotCupCap:"\u226D",NotDoubleVerticalBar:"\u2226",NotElement:"\u2209",NotEqual:"\u2260",NotEqualTilde:"\u2242\u0338",NotExists:"\u2204",NotGreater:"\u226F",NotGreaterEqual:"\u2271",NotGreaterFullEqual:"\u2267\u0338",NotGreaterGreater:"\u226B\u0338",NotGreaterLess:"\u2279",NotGreaterSlantEqual:"\u2A7E\u0338",NotGreaterTilde:"\u2275",NotHumpDownHump:"\u224E\u0338",NotHumpEqual:"\u224F\u0338",notin:"\u2209",notindot:"\u22F5\u0338",notinE:"\u22F9\u0338",notinva:"\u2209",notinvb:"\u22F7",notinvc:"\u22F6",NotLeftTriangle:"\u22EA",NotLeftTriangleBar:"\u29CF\u0338",NotLeftTriangleEqual:"\u22EC",NotLess:"\u226E",NotLessEqual:"\u2270",NotLessGreater:"\u2278",NotLessLess:"\u226A\u0338",NotLessSlantEqual:"\u2A7D\u0338",NotLessTilde:"\u2274",NotNestedGreaterGreater:"\u2AA2\u0338",NotNestedLessLess:"\u2AA1\u0338",notni:"\u220C",notniva:"\u220C",notnivb:"\u22FE",notnivc:"\u22FD",NotPrecedes:"\u2280",NotPrecedesEqual:"\u2AAF\u0338",NotPrecedesSlantEqual:"\u22E0",NotReverseElement:"\u220C",NotRightTriangle:"\u22EB",NotRightTriangleBar:"\u29D0\u0338",NotRightTriangleEqual:"\u22ED",NotSquareSubset:"\u228F\u0338",NotSquareSubsetEqual:"\u22E2",NotSquareSuperset:"\u2290\u0338",NotSquareSupersetEqual:"\u22E3",NotSubset:"\u2282\u20D2",NotSubsetEqual:"\u2288",NotSucceeds:"\u2281",NotSucceedsEqual:"\u2AB0\u0338",NotSucceedsSlantEqual:"\u22E1",NotSucceedsTilde:"\u227F\u0338",NotSuperset:"\u2283\u20D2",NotSupersetEqual:"\u2289",NotTilde:"\u2241",NotTildeEqual:"\u2244",NotTildeFullEqual:"\u2247",NotTildeTilde:"\u2249",NotVerticalBar:"\u2224",npar:"\u2226",nparallel:"\u2226",nparsl:"\u2AFD\u20E5",npart:"\u2202\u0338",npolint:"\u2A14",npr:"\u2280",nprcue:"\u22E0",npre:"\u2AAF\u0338",nprec:"\u2280",npreceq:"\u2AAF\u0338",nrArr:"\u21CF",nrarr:"\u219B",nrarrc:"\u2933\u0338",nrarrw:"\u219D\u0338",nRightarrow:"\u21CF",nrightarrow:"\u219B",nrtri:"\u22EB",nrtrie:"\u22ED",nsc:"\u2281",nsccue:"\u22E1",nsce:"\u2AB0\u0338",Nscr:"\u{1D4A9}",nscr:"\u{1D4C3}",nshortmid:"\u2224",nshortparallel:"\u2226",nsim:"\u2241",nsime:"\u2244",nsimeq:"\u2244",nsmid:"\u2224",nspar:"\u2226",nsqsube:"\u22E2",nsqsupe:"\u22E3",nsub:"\u2284",nsubE:"\u2AC5\u0338",nsube:"\u2288",nsubset:"\u2282\u20D2",nsubseteq:"\u2288",nsubseteqq:"\u2AC5\u0338",nsucc:"\u2281",nsucceq:"\u2AB0\u0338",nsup:"\u2285",nsupE:"\u2AC6\u0338",nsupe:"\u2289",nsupset:"\u2283\u20D2",nsupseteq:"\u2289",nsupseteqq:"\u2AC6\u0338",ntgl:"\u2279",Ntilde:"\xD1",ntilde:"\xF1",ntlg:"\u2278",ntriangleleft:"\u22EA",ntrianglelefteq:"\u22EC",ntriangleright:"\u22EB",ntrianglerighteq:"\u22ED",Nu:"\u039D",nu:"\u03BD",num:"#",numero:"\u2116",numsp:"\u2007",nvap:"\u224D\u20D2",nVDash:"\u22AF",nVdash:"\u22AE",nvDash:"\u22AD",nvdash:"\u22AC",nvge:"\u2265\u20D2",nvgt:">\u20D2",nvHarr:"\u2904",nvinfin:"\u29DE",nvlArr:"\u2902",nvle:"\u2264\u20D2",nvlt:"<\u20D2",nvltrie:"\u22B4\u20D2",nvrArr:"\u2903",nvrtrie:"\u22B5\u20D2",nvsim:"\u223C\u20D2",nwarhk:"\u2923",nwArr:"\u21D6",nwarr:"\u2196",nwarrow:"\u2196",nwnear:"\u2927",Oacute:"\xD3",oacute:"\xF3",oast:"\u229B",ocir:"\u229A",Ocirc:"\xD4",ocirc:"\xF4",Ocy:"\u041E",ocy:"\u043E",odash:"\u229D",Odblac:"\u0150",odblac:"\u0151",odiv:"\u2A38",odot:"\u2299",odsold:"\u29BC",OElig:"\u0152",oelig:"\u0153",ofcir:"\u29BF",Ofr:"\u{1D512}",ofr:"\u{1D52C}",ogon:"\u02DB",Ograve:"\xD2",ograve:"\xF2",ogt:"\u29C1",ohbar:"\u29B5",ohm:"\u03A9",oint:"\u222E",olarr:"\u21BA",olcir:"\u29BE",olcross:"\u29BB",oline:"\u203E",olt:"\u29C0",Omacr:"\u014C",omacr:"\u014D",Omega:"\u03A9",omega:"\u03C9",Omicron:"\u039F",omicron:"\u03BF",omid:"\u29B6",ominus:"\u2296",Oopf:"\u{1D546}",oopf:"\u{1D560}",opar:"\u29B7",OpenCurlyDoubleQuote:"\u201C",OpenCurlyQuote:"\u2018",operp:"\u29B9",oplus:"\u2295",Or:"\u2A54",or:"\u2228",orarr:"\u21BB",ord:"\u2A5D",order:"\u2134",orderof:"\u2134",ordf:"\xAA",ordm:"\xBA",origof:"\u22B6",oror:"\u2A56",orslope:"\u2A57",orv:"\u2A5B",oS:"\u24C8",Oscr:"\u{1D4AA}",oscr:"\u2134",Oslash:"\xD8",oslash:"\xF8",osol:"\u2298",Otilde:"\xD5",otilde:"\xF5",Otimes:"\u2A37",otimes:"\u2297",otimesas:"\u2A36",Ouml:"\xD6",ouml:"\xF6",ovbar:"\u233D",OverBar:"\u203E",OverBrace:"\u23DE",OverBracket:"\u23B4",OverParenthesis:"\u23DC",par:"\u2225",para:"\xB6",parallel:"\u2225",parsim:"\u2AF3",parsl:"\u2AFD",part:"\u2202",PartialD:"\u2202",Pcy:"\u041F",pcy:"\u043F",percnt:"%",period:".",permil:"\u2030",perp:"\u22A5",pertenk:"\u2031",Pfr:"\u{1D513}",pfr:"\u{1D52D}",Phi:"\u03A6",phi:"\u03C6",phiv:"\u03D5",phmmat:"\u2133",phone:"\u260E",Pi:"\u03A0",pi:"\u03C0",pitchfork:"\u22D4",piv:"\u03D6",planck:"\u210F",planckh:"\u210E",plankv:"\u210F",plus:"+",plusacir:"\u2A23",plusb:"\u229E",pluscir:"\u2A22",plusdo:"\u2214",plusdu:"\u2A25",pluse:"\u2A72",PlusMinus:"\xB1",plusmn:"\xB1",plussim:"\u2A26",plustwo:"\u2A27",pm:"\xB1",Poincareplane:"\u210C",pointint:"\u2A15",Popf:"\u2119",popf:"\u{1D561}",pound:"\xA3",Pr:"\u2ABB",pr:"\u227A",prap:"\u2AB7",prcue:"\u227C",prE:"\u2AB3",pre:"\u2AAF",prec:"\u227A",precapprox:"\u2AB7",preccurlyeq:"\u227C",Precedes:"\u227A",PrecedesEqual:"\u2AAF",PrecedesSlantEqual:"\u227C",PrecedesTilde:"\u227E",preceq:"\u2AAF",precnapprox:"\u2AB9",precneqq:"\u2AB5",precnsim:"\u22E8",precsim:"\u227E",Prime:"\u2033",prime:"\u2032",primes:"\u2119",prnap:"\u2AB9",prnE:"\u2AB5",prnsim:"\u22E8",prod:"\u220F",Product:"\u220F",profalar:"\u232E",profline:"\u2312",profsurf:"\u2313",prop:"\u221D",Proportion:"\u2237",Proportional:"\u221D",propto:"\u221D",prsim:"\u227E",prurel:"\u22B0",Pscr:"\u{1D4AB}",pscr:"\u{1D4C5}",Psi:"\u03A8",psi:"\u03C8",puncsp:"\u2008",Qfr:"\u{1D514}",qfr:"\u{1D52E}",qint:"\u2A0C",Qopf:"\u211A",qopf:"\u{1D562}",qprime:"\u2057",Qscr:"\u{1D4AC}",qscr:"\u{1D4C6}",quaternions:"\u210D",quatint:"\u2A16",quest:"?",questeq:"\u225F",QUOT:'"',quot:'"',rAarr:"\u21DB",race:"\u223D\u0331",Racute:"\u0154",racute:"\u0155",radic:"\u221A",raemptyv:"\u29B3",Rang:"\u27EB",rang:"\u27E9",rangd:"\u2992",range:"\u29A5",rangle:"\u27E9",raquo:"\xBB",Rarr:"\u21A0",rArr:"\u21D2",rarr:"\u2192",rarrap:"\u2975",rarrb:"\u21E5",rarrbfs:"\u2920",rarrc:"\u2933",rarrfs:"\u291E",rarrhk:"\u21AA",rarrlp:"\u21AC",rarrpl:"\u2945",rarrsim:"\u2974",Rarrtl:"\u2916",rarrtl:"\u21A3",rarrw:"\u219D",rAtail:"\u291C",ratail:"\u291A",ratio:"\u2236",rationals:"\u211A",RBarr:"\u2910",rBarr:"\u290F",rbarr:"\u290D",rbbrk:"\u2773",rbrace:"}",rbrack:"]",rbrke:"\u298C",rbrksld:"\u298E",rbrkslu:"\u2990",Rcaron:"\u0158",rcaron:"\u0159",Rcedil:"\u0156",rcedil:"\u0157",rceil:"\u2309",rcub:"}",Rcy:"\u0420",rcy:"\u0440",rdca:"\u2937",rdldhar:"\u2969",rdquo:"\u201D",rdquor:"\u201D",rdsh:"\u21B3",Re:"\u211C",real:"\u211C",realine:"\u211B",realpart:"\u211C",reals:"\u211D",rect:"\u25AD",REG:"\xAE",reg:"\xAE",ReverseElement:"\u220B",ReverseEquilibrium:"\u21CB",ReverseUpEquilibrium:"\u296F",rfisht:"\u297D",rfloor:"\u230B",Rfr:"\u211C",rfr:"\u{1D52F}",rHar:"\u2964",rhard:"\u21C1",rharu:"\u21C0",rharul:"\u296C",Rho:"\u03A1",rho:"\u03C1",rhov:"\u03F1",RightAngleBracket:"\u27E9",RightArrow:"\u2192",Rightarrow:"\u21D2",rightarrow:"\u2192",RightArrowBar:"\u21E5",RightArrowLeftArrow:"\u21C4",rightarrowtail:"\u21A3",RightCeiling:"\u2309",RightDoubleBracket:"\u27E7",RightDownTeeVector:"\u295D",RightDownVector:"\u21C2",RightDownVectorBar:"\u2955",RightFloor:"\u230B",rightharpoondown:"\u21C1",rightharpoonup:"\u21C0",rightleftarrows:"\u21C4",rightleftharpoons:"\u21CC",rightrightarrows:"\u21C9",rightsquigarrow:"\u219D",RightTee:"\u22A2",RightTeeArrow:"\u21A6",RightTeeVector:"\u295B",rightthreetimes:"\u22CC",RightTriangle:"\u22B3",RightTriangleBar:"\u29D0",RightTriangleEqual:"\u22B5",RightUpDownVector:"\u294F",RightUpTeeVector:"\u295C",RightUpVector:"\u21BE",RightUpVectorBar:"\u2954",RightVector:"\u21C0",RightVectorBar:"\u2953",ring:"\u02DA",risingdotseq:"\u2253",rlarr:"\u21C4",rlhar:"\u21CC",rlm:"\u200F",rmoust:"\u23B1",rmoustache:"\u23B1",rnmid:"\u2AEE",roang:"\u27ED",roarr:"\u21FE",robrk:"\u27E7",ropar:"\u2986",Ropf:"\u211D",ropf:"\u{1D563}",roplus:"\u2A2E",rotimes:"\u2A35",RoundImplies:"\u2970",rpar:")",rpargt:"\u2994",rppolint:"\u2A12",rrarr:"\u21C9",Rrightarrow:"\u21DB",rsaquo:"\u203A",Rscr:"\u211B",rscr:"\u{1D4C7}",Rsh:"\u21B1",rsh:"\u21B1",rsqb:"]",rsquo:"\u2019",rsquor:"\u2019",rthree:"\u22CC",rtimes:"\u22CA",rtri:"\u25B9",rtrie:"\u22B5",rtrif:"\u25B8",rtriltri:"\u29CE",RuleDelayed:"\u29F4",ruluhar:"\u2968",rx:"\u211E",Sacute:"\u015A",sacute:"\u015B",sbquo:"\u201A",Sc:"\u2ABC",sc:"\u227B",scap:"\u2AB8",Scaron:"\u0160",scaron:"\u0161",sccue:"\u227D",scE:"\u2AB4",sce:"\u2AB0",Scedil:"\u015E",scedil:"\u015F",Scirc:"\u015C",scirc:"\u015D",scnap:"\u2ABA",scnE:"\u2AB6",scnsim:"\u22E9",scpolint:"\u2A13",scsim:"\u227F",Scy:"\u0421",scy:"\u0441",sdot:"\u22C5",sdotb:"\u22A1",sdote:"\u2A66",searhk:"\u2925",seArr:"\u21D8",searr:"\u2198",searrow:"\u2198",sect:"\xA7",semi:";",seswar:"\u2929",setminus:"\u2216",setmn:"\u2216",sext:"\u2736",Sfr:"\u{1D516}",sfr:"\u{1D530}",sfrown:"\u2322",sharp:"\u266F",SHCHcy:"\u0429",shchcy:"\u0449",SHcy:"\u0428",shcy:"\u0448",ShortDownArrow:"\u2193",ShortLeftArrow:"\u2190",shortmid:"\u2223",shortparallel:"\u2225",ShortRightArrow:"\u2192",ShortUpArrow:"\u2191",shy:"\xAD",Sigma:"\u03A3",sigma:"\u03C3",sigmaf:"\u03C2",sigmav:"\u03C2",sim:"\u223C",simdot:"\u2A6A",sime:"\u2243",simeq:"\u2243",simg:"\u2A9E",simgE:"\u2AA0",siml:"\u2A9D",simlE:"\u2A9F",simne:"\u2246",simplus:"\u2A24",simrarr:"\u2972",slarr:"\u2190",SmallCircle:"\u2218",smallsetminus:"\u2216",smashp:"\u2A33",smeparsl:"\u29E4",smid:"\u2223",smile:"\u2323",smt:"\u2AAA",smte:"\u2AAC",smtes:"\u2AAC\uFE00",SOFTcy:"\u042C",softcy:"\u044C",sol:"/",solb:"\u29C4",solbar:"\u233F",Sopf:"\u{1D54A}",sopf:"\u{1D564}",spades:"\u2660",spadesuit:"\u2660",spar:"\u2225",sqcap:"\u2293",sqcaps:"\u2293\uFE00",sqcup:"\u2294",sqcups:"\u2294\uFE00",Sqrt:"\u221A",sqsub:"\u228F",sqsube:"\u2291",sqsubset:"\u228F",sqsubseteq:"\u2291",sqsup:"\u2290",sqsupe:"\u2292",sqsupset:"\u2290",sqsupseteq:"\u2292",squ:"\u25A1",Square:"\u25A1",square:"\u25A1",SquareIntersection:"\u2293",SquareSubset:"\u228F",SquareSubsetEqual:"\u2291",SquareSuperset:"\u2290",SquareSupersetEqual:"\u2292",SquareUnion:"\u2294",squarf:"\u25AA",squf:"\u25AA",srarr:"\u2192",Sscr:"\u{1D4AE}",sscr:"\u{1D4C8}",ssetmn:"\u2216",ssmile:"\u2323",sstarf:"\u22C6",Star:"\u22C6",star:"\u2606",starf:"\u2605",straightepsilon:"\u03F5",straightphi:"\u03D5",strns:"\xAF",Sub:"\u22D0",sub:"\u2282",subdot:"\u2ABD",subE:"\u2AC5",sube:"\u2286",subedot:"\u2AC3",submult:"\u2AC1",subnE:"\u2ACB",subne:"\u228A",subplus:"\u2ABF",subrarr:"\u2979",Subset:"\u22D0",subset:"\u2282",subseteq:"\u2286",subseteqq:"\u2AC5",SubsetEqual:"\u2286",subsetneq:"\u228A",subsetneqq:"\u2ACB",subsim:"\u2AC7",subsub:"\u2AD5",subsup:"\u2AD3",succ:"\u227B",succapprox:"\u2AB8",succcurlyeq:"\u227D",Succeeds:"\u227B",SucceedsEqual:"\u2AB0",SucceedsSlantEqual:"\u227D",SucceedsTilde:"\u227F",succeq:"\u2AB0",succnapprox:"\u2ABA",succneqq:"\u2AB6",succnsim:"\u22E9",succsim:"\u227F",SuchThat:"\u220B",Sum:"\u2211",sum:"\u2211",sung:"\u266A",Sup:"\u22D1",sup:"\u2283",sup1:"\xB9",sup2:"\xB2",sup3:"\xB3",supdot:"\u2ABE",supdsub:"\u2AD8",supE:"\u2AC6",supe:"\u2287",supedot:"\u2AC4",Superset:"\u2283",SupersetEqual:"\u2287",suphsol:"\u27C9",suphsub:"\u2AD7",suplarr:"\u297B",supmult:"\u2AC2",supnE:"\u2ACC",supne:"\u228B",supplus:"\u2AC0",Supset:"\u22D1",supset:"\u2283",supseteq:"\u2287",supseteqq:"\u2AC6",supsetneq:"\u228B",supsetneqq:"\u2ACC",supsim:"\u2AC8",supsub:"\u2AD4",supsup:"\u2AD6",swarhk:"\u2926",swArr:"\u21D9",swarr:"\u2199",swarrow:"\u2199",swnwar:"\u292A",szlig:"\xDF",Tab:" ",target:"\u2316",Tau:"\u03A4",tau:"\u03C4",tbrk:"\u23B4",Tcaron:"\u0164",tcaron:"\u0165",Tcedil:"\u0162",tcedil:"\u0163",Tcy:"\u0422",tcy:"\u0442",tdot:"\u20DB",telrec:"\u2315",Tfr:"\u{1D517}",tfr:"\u{1D531}",there4:"\u2234",Therefore:"\u2234",therefore:"\u2234",Theta:"\u0398",theta:"\u03B8",thetasym:"\u03D1",thetav:"\u03D1",thickapprox:"\u2248",thicksim:"\u223C",ThickSpace:"\u205F\u200A",thinsp:"\u2009",ThinSpace:"\u2009",thkap:"\u2248",thksim:"\u223C",THORN:"\xDE",thorn:"\xFE",Tilde:"\u223C",tilde:"\u02DC",TildeEqual:"\u2243",TildeFullEqual:"\u2245",TildeTilde:"\u2248",times:"\xD7",timesb:"\u22A0",timesbar:"\u2A31",timesd:"\u2A30",tint:"\u222D",toea:"\u2928",top:"\u22A4",topbot:"\u2336",topcir:"\u2AF1",Topf:"\u{1D54B}",topf:"\u{1D565}",topfork:"\u2ADA",tosa:"\u2929",tprime:"\u2034",TRADE:"\u2122",trade:"\u2122",triangle:"\u25B5",triangledown:"\u25BF",triangleleft:"\u25C3",trianglelefteq:"\u22B4",triangleq:"\u225C",triangleright:"\u25B9",trianglerighteq:"\u22B5",tridot:"\u25EC",trie:"\u225C",triminus:"\u2A3A",TripleDot:"\u20DB",triplus:"\u2A39",trisb:"\u29CD",tritime:"\u2A3B",trpezium:"\u23E2",Tscr:"\u{1D4AF}",tscr:"\u{1D4C9}",TScy:"\u0426",tscy:"\u0446",TSHcy:"\u040B",tshcy:"\u045B",Tstrok:"\u0166",tstrok:"\u0167",twixt:"\u226C",twoheadleftarrow:"\u219E",twoheadrightarrow:"\u21A0",Uacute:"\xDA",uacute:"\xFA",Uarr:"\u219F",uArr:"\u21D1",uarr:"\u2191",Uarrocir:"\u2949",Ubrcy:"\u040E",ubrcy:"\u045E",Ubreve:"\u016C",ubreve:"\u016D",Ucirc:"\xDB",ucirc:"\xFB",Ucy:"\u0423",ucy:"\u0443",udarr:"\u21C5",Udblac:"\u0170",udblac:"\u0171",udhar:"\u296E",ufisht:"\u297E",Ufr:"\u{1D518}",ufr:"\u{1D532}",Ugrave:"\xD9",ugrave:"\xF9",uHar:"\u2963",uharl:"\u21BF",uharr:"\u21BE",uhblk:"\u2580",ulcorn:"\u231C",ulcorner:"\u231C",ulcrop:"\u230F",ultri:"\u25F8",Umacr:"\u016A",umacr:"\u016B",uml:"\xA8",UnderBar:"_",UnderBrace:"\u23DF",UnderBracket:"\u23B5",UnderParenthesis:"\u23DD",Union:"\u22C3",UnionPlus:"\u228E",Uogon:"\u0172",uogon:"\u0173",Uopf:"\u{1D54C}",uopf:"\u{1D566}",UpArrow:"\u2191",Uparrow:"\u21D1",uparrow:"\u2191",UpArrowBar:"\u2912",UpArrowDownArrow:"\u21C5",UpDownArrow:"\u2195",Updownarrow:"\u21D5",updownarrow:"\u2195",UpEquilibrium:"\u296E",upharpoonleft:"\u21BF",upharpoonright:"\u21BE",uplus:"\u228E",UpperLeftArrow:"\u2196",UpperRightArrow:"\u2197",Upsi:"\u03D2",upsi:"\u03C5",upsih:"\u03D2",Upsilon:"\u03A5",upsilon:"\u03C5",UpTee:"\u22A5",UpTeeArrow:"\u21A5",upuparrows:"\u21C8",urcorn:"\u231D",urcorner:"\u231D",urcrop:"\u230E",Uring:"\u016E",uring:"\u016F",urtri:"\u25F9",Uscr:"\u{1D4B0}",uscr:"\u{1D4CA}",utdot:"\u22F0",Utilde:"\u0168",utilde:"\u0169",utri:"\u25B5",utrif:"\u25B4",uuarr:"\u21C8",Uuml:"\xDC",uuml:"\xFC",uwangle:"\u29A7",vangrt:"\u299C",varepsilon:"\u03F5",varkappa:"\u03F0",varnothing:"\u2205",varphi:"\u03D5",varpi:"\u03D6",varpropto:"\u221D",vArr:"\u21D5",varr:"\u2195",varrho:"\u03F1",varsigma:"\u03C2",varsubsetneq:"\u228A\uFE00",varsubsetneqq:"\u2ACB\uFE00",varsupsetneq:"\u228B\uFE00",varsupsetneqq:"\u2ACC\uFE00",vartheta:"\u03D1",vartriangleleft:"\u22B2",vartriangleright:"\u22B3",Vbar:"\u2AEB",vBar:"\u2AE8",vBarv:"\u2AE9",Vcy:"\u0412",vcy:"\u0432",VDash:"\u22AB",Vdash:"\u22A9",vDash:"\u22A8",vdash:"\u22A2",Vdashl:"\u2AE6",Vee:"\u22C1",vee:"\u2228",veebar:"\u22BB",veeeq:"\u225A",vellip:"\u22EE",Verbar:"\u2016",verbar:"|",Vert:"\u2016",vert:"|",VerticalBar:"\u2223",VerticalLine:"|",VerticalSeparator:"\u2758",VerticalTilde:"\u2240",VeryThinSpace:"\u200A",Vfr:"\u{1D519}",vfr:"\u{1D533}",vltri:"\u22B2",vnsub:"\u2282\u20D2",vnsup:"\u2283\u20D2",Vopf:"\u{1D54D}",vopf:"\u{1D567}",vprop:"\u221D",vrtri:"\u22B3",Vscr:"\u{1D4B1}",vscr:"\u{1D4CB}",vsubnE:"\u2ACB\uFE00",vsubne:"\u228A\uFE00",vsupnE:"\u2ACC\uFE00",vsupne:"\u228B\uFE00",Vvdash:"\u22AA",vzigzag:"\u299A",Wcirc:"\u0174",wcirc:"\u0175",wedbar:"\u2A5F",Wedge:"\u22C0",wedge:"\u2227",wedgeq:"\u2259",weierp:"\u2118",Wfr:"\u{1D51A}",wfr:"\u{1D534}",Wopf:"\u{1D54E}",wopf:"\u{1D568}",wp:"\u2118",wr:"\u2240",wreath:"\u2240",Wscr:"\u{1D4B2}",wscr:"\u{1D4CC}",xcap:"\u22C2",xcirc:"\u25EF",xcup:"\u22C3",xdtri:"\u25BD",Xfr:"\u{1D51B}",xfr:"\u{1D535}",xhArr:"\u27FA",xharr:"\u27F7",Xi:"\u039E",xi:"\u03BE",xlArr:"\u27F8",xlarr:"\u27F5",xmap:"\u27FC",xnis:"\u22FB",xodot:"\u2A00",Xopf:"\u{1D54F}",xopf:"\u{1D569}",xoplus:"\u2A01",xotime:"\u2A02",xrArr:"\u27F9",xrarr:"\u27F6",Xscr:"\u{1D4B3}",xscr:"\u{1D4CD}",xsqcup:"\u2A06",xuplus:"\u2A04",xutri:"\u25B3",xvee:"\u22C1",xwedge:"\u22C0",Yacute:"\xDD",yacute:"\xFD",YAcy:"\u042F",yacy:"\u044F",Ycirc:"\u0176",ycirc:"\u0177",Ycy:"\u042B",ycy:"\u044B",yen:"\xA5",Yfr:"\u{1D51C}",yfr:"\u{1D536}",YIcy:"\u0407",yicy:"\u0457",Yopf:"\u{1D550}",yopf:"\u{1D56A}",Yscr:"\u{1D4B4}",yscr:"\u{1D4CE}",YUcy:"\u042E",yucy:"\u044E",Yuml:"\u0178",yuml:"\xFF",Zacute:"\u0179",zacute:"\u017A",Zcaron:"\u017D",zcaron:"\u017E",Zcy:"\u0417",zcy:"\u0437",Zdot:"\u017B",zdot:"\u017C",zeetrf:"\u2128",ZeroWidthSpace:"\u200B",Zeta:"\u0396",zeta:"\u03B6",Zfr:"\u2128",zfr:"\u{1D537}",ZHcy:"\u0416",zhcy:"\u0436",zigrarr:"\u21DD",Zopf:"\u2124",zopf:"\u{1D56B}",Zscr:"\u{1D4B5}",zscr:"\u{1D4CF}",zwj:"\u200D",zwnj:"\u200C"});af.entityMap=af.HTML_ENTITIES});var HC=Xt(Hg=>{"use strict";B();var Su=cl(),Gt=nx(),BC=Zd(),Qk=Su.isHTMLEscapableRawTextElement,Jk=Su.isHTMLMimeType,t_=Su.isHTMLRawTextElement,uf=Su.hasOwn,FC=Su.NAMESPACE,PC=BC.ParseError,e_=BC.DOMException,of=0,eo=1,Cu=2,lf=3,Eu=4,Tu=5,cf=6,Gg=7;function UC(){}UC.prototype={parse:function(r,t,e){var n=this.domBuilder;n.startDocument(),$C(t,t=Object.create(null)),n_(r,t,e,n,this.errorHandler),n.endDocument()}};var hx=/&#?\w+;?/g;function n_(r,t,e,n,i){var s=Jk(n.mimeType);r.indexOf(Gt.UNICODE_REPLACEMENT_CHARACTER)>=0&&i.warning("Unicode replacement character detected, source encoding issues?");function a(_){if(_>65535){_-=65536;var W=55296+(_>>10),z=56320+(_&1023);return String.fromCharCode(W,z)}else return String.fromCharCode(_)}function l(_){var W=_[_.length-1]===";"?_:_+";";if(!s&&W!==_)return i.error("EntityRef: expecting ;"),_;var z=Gt.Reference.exec(W);if(!z||z[0].length!==W.length)return i.error("entity not matching Reference production: "+_),_;var D=W.slice(1,-1);return uf(e,D)?e[D]:D.charAt(0)==="#"?a(parseInt(D.substring(1).replace("x","0x"))):(i.error("entity not found:"+_),_)}function c(_){if(_>x){var W=r.substring(x,_).replace(hx,l);f&&p(x),n.characters(W,0,_-x),x=_}}var u=0,h=0,d=/\r\n?|\n|$/g,f=n.locator;function p(_,W){for(;_>=h&&(W=d.exec(r));)u=h,h=W.index+W[0].length,f.lineNumber++;f.columnNumber=_-u+1}for(var m=[{currentNSMap:t}],y=[],x=0;;){try{var b=r.indexOf("<",x);if(b<0){if(!s&&y.length>0)return i.fatalError("unclosed xml tag(s): "+y.join(", "));if(!r.substring(x).match(/^\s*$/)){var w=n.doc,C=w.createTextNode(r.substring(x));if(w.documentElement)return i.error("Extra content at the end of the document");w.appendChild(C),n.currentElement=C}return}if(b>x){var E=r.substring(x,b);!s&&y.length===0&&(E=E.replace(new RegExp(Gt.S_OPT.source,"g"),""),E&&i.error("Unexpected content outside root element: '"+E+"'")),c(b)}switch(r.charAt(b+1)){case"/":var Z=r.indexOf(">",b+2),S=r.substring(b+2,Z>0?Z:void 0);if(!S)return i.fatalError("end tag name missing");var N=Z>0&&Gt.reg("^",Gt.QName_group,Gt.S_OPT,"$").exec(S);if(!N)return i.fatalError('end tag name contains invalid characters: "'+S+'"');if(!n.currentElement&&!n.doc.documentElement)return;var k=y[y.length-1]||n.currentElement.tagName||n.doc.documentElement.tagName||"";if(k!==N[1]){var M=N[1].toLowerCase();if(!s||k.toLowerCase()!==M)return i.fatalError('Opening and ending tag mismatch: "'+k+'" != "'+S+'"')}var R=m.pop();y.pop();var j=R.localNSMap;if(n.endElement(R.uri,R.localName,k),j)for(var $ in j)uf(j,$)&&n.endPrefixMapping($);Z++;break;case"?":f&&p(b),Z=a_(r,b,n,i);break;case"!":f&&p(b),Z=jC(r,b,n,i,s);break;default:f&&p(b);var q=new GC,Q=m[m.length-1].currentNSMap,Z=i_(r,b,q,Q,l,i,s),Y=q.length;if(q.closed||(s&&Su.isHTMLVoidElement(q.tagName)?q.closed=!0:y.push(q.tagName)),f&&Y){for(var X=RC(f,{}),T=0;T<Y;T++){var I=q[T];p(I.offset),I.locator=RC(f,{})}n.locator=X,LC(q,n,Q)&&m.push(q),n.locator=f}else LC(q,n,Q)&&m.push(q);s&&!q.closed?Z=r_(r,Z,q.tagName,l,n):Z++}}catch(_){if(_ instanceof PC)throw _;if(_ instanceof e_)throw new PC(_.name+": "+_.message,n.locator,_);i.error("element parse error: "+_),Z=-1}Z>x?x=Z:c(Math.max(b,x)+1)}}function RC(r,t){return t.lineNumber=r.lineNumber,t.columnNumber=r.columnNumber,t}function i_(r,t,e,n,i,s,a){function l(p,m,y){if(uf(e.attributeNames,p))return s.fatalError("Attribute "+p+" redefined");if(!a&&m.indexOf("<")>=0)return s.fatalError("Unescaped '<' not allowed in attributes values");e.addValue(p,m.replace(/[\t\n\r]/g," ").replace(hx,i),y)}for(var c,u,h=++t,d=of;;){var f=r.charAt(h);switch(f){case"=":if(d===eo)c=r.slice(t,h),d=lf;else if(d===Cu)d=lf;else throw new Error("attribute equal must after attrName");break;case"'":case'"':if(d===lf||d===eo)if(d===eo&&(s.warning('attribute value must after "="'),c=r.slice(t,h)),t=h+1,h=r.indexOf(f,t),h>0)u=r.slice(t,h),l(c,u,t-1),d=Tu;else throw new Error("attribute value no end '"+f+"' match");else if(d==Eu)u=r.slice(t,h),l(c,u,t),s.warning('attribute "'+c+'" missed start quot('+f+")!!"),t=h+1,d=Tu;else throw new Error('attribute value must after "="');break;case"/":switch(d){case of:e.setTagName(r.slice(t,h));case Tu:case cf:case Gg:d=Gg,e.closed=!0;case Eu:case eo:break;case Cu:e.closed=!0;break;default:throw new Error("attribute invalid close char('/')")}break;case"":return s.error("unexpected end of input"),d==of&&e.setTagName(r.slice(t,h)),h;case">":switch(d){case of:e.setTagName(r.slice(t,h));case Tu:case cf:case Gg:break;case Eu:case eo:u=r.slice(t,h),u.slice(-1)==="/"&&(e.closed=!0,u=u.slice(0,-1));case Cu:d===Cu&&(u=c),d==Eu?(s.warning('attribute "'+u+'" missed quot(")!'),l(c,u,t)):(a||s.warning('attribute "'+u+'" missed value!! "'+u+'" instead!!'),l(u,u,t));break;case lf:if(!a)return s.fatalError(`AttValue: ' or " expected`)}return h;case"\x80":f=" ";default:if(f<=" ")switch(d){case of:e.setTagName(r.slice(t,h)),d=cf;break;case eo:c=r.slice(t,h),d=Cu;break;case Eu:var u=r.slice(t,h);s.warning('attribute "'+u+'" missed quot(")!!'),l(c,u,t);case Tu:d=cf;break}else switch(d){case Cu:a||s.warning('attribute "'+c+'" missed value!! "'+c+'" instead2!!'),l(c,c,t),t=h,d=eo;break;case Tu:s.warning('attribute space is required"'+c+'"!!');case cf:d=eo,t=h;break;case lf:d=Eu,t=h;break;case Gg:throw new Error("elements closed character '/' and '>' must be connected to")}}h++}}function LC(r,t,e){for(var n=r.tagName,i=null,d=r.length;d--;){var s=r[d],a=s.qName,l=s.value,f=a.indexOf(":");if(f>0)var c=s.prefix=a.slice(0,f),u=a.slice(f+1),h=c==="xmlns"&&u;else u=a,c=null,h=a==="xmlns"&&"";s.localName=u,h!==!1&&(i==null&&(i=Object.create(null),$C(e,e=Object.create(null))),e[h]=i[h]=l,s.uri=FC.XMLNS,t.startPrefixMapping(h,l))}for(var d=r.length;d--;)s=r[d],s.prefix&&(s.prefix==="xml"&&(s.uri=FC.XML),s.prefix!=="xmlns"&&(s.uri=e[s.prefix]));var f=n.indexOf(":");f>0?(c=r.prefix=n.slice(0,f),u=r.localName=n.slice(f+1)):(c=null,u=r.localName=n);var p=r.uri=e[c||""];if(t.startElement(p,u,n,r),r.closed){if(t.endElement(p,u,n),i)for(c in i)uf(i,c)&&t.endPrefixMapping(c)}else return r.currentNSMap=e,r.localNSMap=i,!0}function r_(r,t,e,n,i){var s=Qk(e);if(s||t_(e)){var a=r.indexOf("</"+e+">",t),l=r.substring(t+1,a);return s&&(l=l.replace(hx,n)),i.characters(l,0,l.length),a}return t+1}function $C(r,t){for(var e in r)uf(r,e)&&(t[e]=r[e])}function zC(r,t){var e=t;function n(h){return h=h||0,r.charAt(e+h)}function i(h){h=h||1,e+=h}function s(){for(var h=0;e<r.length;){var d=n();if(d!==" "&&d!==`
|
|
8
|
+
`&&d!==" "&&d!=="\r")return h;h++,i()}return-1}function a(){return r.substring(e)}function l(h){return r.substring(e,e+h.length)===h}function c(h){return r.substring(e,e+h.length).toUpperCase()===h.toUpperCase()}function u(h){var d=Gt.reg("^",h),f=d.exec(a());return f?(i(f[0].length),f[0]):null}return{char:n,getIndex:function(){return e},getMatch:u,getSource:function(){return r},skip:i,skipBlanks:s,substringFromIndex:a,substringStartsWith:l,substringStartsWithCaseInsensitive:c}}function s_(r,t){function e(l,c){var u=Gt.PI.exec(l.substringFromIndex());return u?u[1].toLowerCase()==="xml"?c.fatalError("xml declaration is only allowed at the start of the document, but found at position "+l.getIndex()):(l.skip(u[0].length),u[0]):c.fatalError("processing instruction is not well-formed at position "+l.getIndex())}var n=r.getSource();if(r.char()==="["){r.skip(1);for(var i=r.getIndex();r.getIndex()<n.length;){if(r.skipBlanks(),r.char()==="]"){var s=n.substring(i,r.getIndex());return r.skip(1),s}var a=null;if(r.char()==="<"&&r.char(1)==="!")switch(r.char(2)){case"E":r.char(3)==="L"?a=r.getMatch(Gt.elementdecl):r.char(3)==="N"&&(a=r.getMatch(Gt.EntityDecl));break;case"A":a=r.getMatch(Gt.AttlistDecl);break;case"N":a=r.getMatch(Gt.NotationDecl);break;case"-":a=r.getMatch(Gt.Comment);break}else if(r.char()==="<"&&r.char(1)==="?")a=e(r,t);else if(r.char()==="%")a=r.getMatch(Gt.PEReference);else return t.fatalError("Error detected in Markup declaration");if(!a)return t.fatalError("Error in internal subset at position "+r.getIndex())}return t.fatalError("doctype internal subset is not well-formed, missing ]")}}function jC(r,t,e,n,i){var s=zC(r,t);switch(i?s.char(2).toUpperCase():s.char(2)){case"-":var a=s.getMatch(Gt.Comment);return a?(e.comment(a,Gt.COMMENT_START.length,a.length-Gt.COMMENT_START.length-Gt.COMMENT_END.length),s.getIndex()):n.fatalError("comment is not well-formed at position "+s.getIndex());case"[":var l=s.getMatch(Gt.CDSect);return l?!i&&!e.currentElement?n.fatalError("CDATA outside of element"):(e.startCDATA(),e.characters(l,Gt.CDATA_START.length,l.length-Gt.CDATA_START.length-Gt.CDATA_END.length),e.endCDATA(),s.getIndex()):n.fatalError("Invalid CDATA starting at position "+t);case"D":{if(e.doc&&e.doc.documentElement)return n.fatalError("Doctype not allowed inside or after documentElement at position "+s.getIndex());if(i?!s.substringStartsWithCaseInsensitive(Gt.DOCTYPE_DECL_START):!s.substringStartsWith(Gt.DOCTYPE_DECL_START))return n.fatalError("Expected "+Gt.DOCTYPE_DECL_START+" at position "+s.getIndex());if(s.skip(Gt.DOCTYPE_DECL_START.length),s.skipBlanks()<1)return n.fatalError("Expected whitespace after "+Gt.DOCTYPE_DECL_START+" at position "+s.getIndex());var c={name:void 0,publicId:void 0,systemId:void 0,internalSubset:void 0};if(c.name=s.getMatch(Gt.Name),!c.name)return n.fatalError("doctype name missing or contains unexpected characters at position "+s.getIndex());if(i&&c.name.toLowerCase()!=="html"&&n.warning("Unexpected DOCTYPE in HTML document at position "+s.getIndex()),s.skipBlanks(),s.substringStartsWith(Gt.PUBLIC)||s.substringStartsWith(Gt.SYSTEM)){var u=Gt.ExternalID_match.exec(s.substringFromIndex());if(!u)return n.fatalError("doctype external id is not well-formed at position "+s.getIndex());u.groups.SystemLiteralOnly!==void 0?c.systemId=u.groups.SystemLiteralOnly:(c.systemId=u.groups.SystemLiteral,c.publicId=u.groups.PubidLiteral),s.skip(u[0].length)}else if(i&&s.substringStartsWithCaseInsensitive(Gt.SYSTEM)){if(s.skip(Gt.SYSTEM.length),s.skipBlanks()<1)return n.fatalError("Expected whitespace after "+Gt.SYSTEM+" at position "+s.getIndex());if(c.systemId=s.getMatch(Gt.ABOUT_LEGACY_COMPAT_SystemLiteral),!c.systemId)return n.fatalError("Expected "+Gt.ABOUT_LEGACY_COMPAT+" in single or double quotes after "+Gt.SYSTEM+" at position "+s.getIndex())}return i&&c.systemId&&!Gt.ABOUT_LEGACY_COMPAT_SystemLiteral.test(c.systemId)&&n.warning("Unexpected doctype.systemId in HTML document at position "+s.getIndex()),i||(s.skipBlanks(),c.internalSubset=s_(s,n)),s.skipBlanks(),s.char()!==">"?n.fatalError("doctype not terminated with > at position "+s.getIndex()):(s.skip(1),e.startDTD(c.name,c.publicId,c.systemId,c.internalSubset),e.endDTD(),s.getIndex())}default:return n.fatalError('Not well-formed XML starting with "<!" at position '+t)}}function a_(r,t,e,n){var i=r.substring(t).match(Gt.PI);if(!i)return n.fatalError("Invalid processing instruction starting at position "+t);if(i[1].toLowerCase()==="xml"){if(t>0)return n.fatalError("processing instruction at position "+t+" is an xml declaration which is only at the start of the document");if(!Gt.XMLDecl.test(r.substring(t)))return n.fatalError("xml declaration is not well-formed")}return e.processingInstruction(i[1],i[2]),t+i[0].length}function GC(){this.attributeNames=Object.create(null)}GC.prototype={setTagName:function(r){if(!Gt.QName_exact.test(r))throw new Error("invalid tagName:"+r);this.tagName=r},addValue:function(r,t,e){if(!Gt.QName_exact.test(r))throw new Error("invalid attribute:"+r);this.attributeNames[r]=this.length,this[this.length++]={qName:r,value:t,offset:e}},length:0,getLocalName:function(r){return this[r].localName},getLocator:function(r){return this[r].locator},getQName:function(r){return this[r].qName},getURI:function(r){return this[r].uri},getValue:function(r){return this[r].value}};Hg.XMLReader=UC;Hg.parseUtils=zC;Hg.parseDoctypeCommentOrCData=jC});var ZC=Xt(Nu=>{"use strict";B();var hl=cl(),o_=ux(),l_=Zd(),WC=OC(),c_=HC(),u_=o_.DOMImplementation,h_=hl.hasDefaultHTMLNamespace,d_=hl.isHTMLMimeType,f_=hl.isValidMimeType,XC=hl.MIME_TYPE,dx=hl.NAMESPACE,qC=l_.ParseError,p_=c_.XMLReader;function YC(r){return r.replace(/\r[\n\u0085]/g,`
|
|
9
9
|
`).replace(/[\r\u0085\u2028\u2029]/g,`
|
|
10
|
-
`)}function
|
|
11
|
-
@#[line:`+r.lineNumber+",col:"+r.columnNumber+"]"}function qC(r,t,e){return typeof r=="string"?r.substr(t,e):r.length>=t+e||t?new java.lang.String(r,t,e)+"":r}"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,function(r){qg.prototype[r]=function(){return null}});function Wg(r,t){r.currentElement?r.currentElement.appendChild(t):r.doc.appendChild(t)}function g_(r){if(r==="error")throw"onErrorStopParsing"}function y_(){throw"onWarningStopParsing"}Nu.__DOMHandler=qg;Nu.DOMParser=YC;Nu.normalizeLineEndings=XC;Nu.onErrorStopParsing=g_;Nu.onWarningStopParsing=y_});var ZC=Xt(te=>{"use strict";B();var Iu=cl();te.assign=Iu.assign;te.hasDefaultHTMLNamespace=Iu.hasDefaultHTMLNamespace;te.isHTMLMimeType=Iu.isHTMLMimeType;te.isValidMimeType=Iu.isValidMimeType;te.MIME_TYPE=Iu.MIME_TYPE;te.NAMESPACE=Iu.NAMESPACE;var Vg=Zd();te.DOMException=Vg.DOMException;te.DOMExceptionName=Vg.DOMExceptionName;te.ExceptionCode=Vg.ExceptionCode;te.ParseError=Vg.ParseError;var fn=cx();te.Attr=fn.Attr;te.CDATASection=fn.CDATASection;te.CharacterData=fn.CharacterData;te.Comment=fn.Comment;te.Document=fn.Document;te.DocumentFragment=fn.DocumentFragment;te.DocumentType=fn.DocumentType;te.DOMImplementation=fn.DOMImplementation;te.Element=fn.Element;te.Entity=fn.Entity;te.EntityReference=fn.EntityReference;te.LiveNodeList=fn.LiveNodeList;te.NamedNodeMap=fn.NamedNodeMap;te.Node=fn.Node;te.NodeList=fn.NodeList;te.Notation=fn.Notation;te.ProcessingInstruction=fn.ProcessingInstruction;te.Text=fn.Text;te.XMLSerializer=fn.XMLSerializer;var Xg=KC();te.DOMParser=Xg.DOMParser;te.normalizeLineEndings=Xg.normalizeLineEndings;te.onErrorStopParsing=Xg.onErrorStopParsing;te.onWarningStopParsing=Xg.onWarningStopParsing});var QC=Xt((bR,px)=>{B();var fx=(function(r){"use strict";var t=Object.prototype,e=t.hasOwnProperty,n=Object.defineProperty||function(T,I,_){T[I]=_.value},i,s=typeof Symbol=="function"?Symbol:{},a=s.iterator||"@@iterator",l=s.asyncIterator||"@@asyncIterator",c=s.toStringTag||"@@toStringTag";function u(T,I,_){return Object.defineProperty(T,I,{value:_,enumerable:!0,configurable:!0,writable:!0}),T[I]}try{u({},"")}catch{u=function(I,_,W){return I[_]=W}}function h(T,I,_,W){var z=I&&I.prototype instanceof b?I:b,D=Object.create(z.prototype),F=new Z(W||[]);return n(D,"_invoke",{value:j(T,_,F)}),D}r.wrap=h;function d(T,I,_){try{return{type:"normal",arg:T.call(I,_)}}catch(W){return{type:"throw",arg:W}}}var f="suspendedStart",p="suspendedYield",m="executing",y="completed",x={};function b(){}function w(){}function C(){}var E={};u(E,a,function(){return this});var S=Object.getPrototypeOf,N=S&&S(S(Y([])));N&&N!==t&&e.call(N,a)&&(E=N);var k=C.prototype=b.prototype=Object.create(E);w.prototype=C,n(k,"constructor",{value:C,configurable:!0}),n(C,"constructor",{value:w,configurable:!0}),w.displayName=u(C,c,"GeneratorFunction");function M(T){["next","throw","return"].forEach(function(I){u(T,I,function(_){return this._invoke(I,_)})})}r.isGeneratorFunction=function(T){var I=typeof T=="function"&&T.constructor;return I?I===w||(I.displayName||I.name)==="GeneratorFunction":!1},r.mark=function(T){return Object.setPrototypeOf?Object.setPrototypeOf(T,C):(T.__proto__=C,u(T,c,"GeneratorFunction")),T.prototype=Object.create(k),T},r.awrap=function(T){return{__await:T}};function R(T,I){function _(D,F,P,G){var H=d(T[D],T,F);if(H.type==="throw")G(H.arg);else{var V=H.arg,L=V.value;return L&&typeof L=="object"&&e.call(L,"__await")?I.resolve(L.__await).then(function(tt){_("next",tt,P,G)},function(tt){_("throw",tt,P,G)}):I.resolve(L).then(function(tt){V.value=tt,P(V)},function(tt){return _("throw",tt,P,G)})}}var W;function z(D,F){function P(){return new I(function(G,H){_(D,F,G,H)})}return W=W?W.then(P,P):P()}n(this,"_invoke",{value:z})}M(R.prototype),u(R.prototype,l,function(){return this}),r.AsyncIterator=R,r.async=function(T,I,_,W,z){z===void 0&&(z=Promise);var D=new R(h(T,I,_,W),z);return r.isGeneratorFunction(I)?D:D.next().then(function(F){return F.done?F.value:D.next()})};function j(T,I,_){var W=f;return function(D,F){if(W===m)throw new Error("Generator is already running");if(W===y){if(D==="throw")throw F;return X()}for(_.method=D,_.arg=F;;){var P=_.delegate;if(P){var G=$(P,_);if(G){if(G===x)continue;return G}}if(_.method==="next")_.sent=_._sent=_.arg;else if(_.method==="throw"){if(W===f)throw W=y,_.arg;_.dispatchException(_.arg)}else _.method==="return"&&_.abrupt("return",_.arg);W=m;var H=d(T,I,_);if(H.type==="normal"){if(W=_.done?y:p,H.arg===x)continue;return{value:H.arg,done:_.done}}else H.type==="throw"&&(W=y,_.method="throw",_.arg=H.arg)}}}function $(T,I){var _=I.method,W=T.iterator[_];if(W===i)return I.delegate=null,_==="throw"&&T.iterator.return&&(I.method="return",I.arg=i,$(T,I),I.method==="throw")||_!=="return"&&(I.method="throw",I.arg=new TypeError("The iterator does not provide a '"+_+"' method")),x;var z=d(W,T.iterator,I.arg);if(z.type==="throw")return I.method="throw",I.arg=z.arg,I.delegate=null,x;var D=z.arg;if(!D)return I.method="throw",I.arg=new TypeError("iterator result is not an object"),I.delegate=null,x;if(D.done)I[T.resultName]=D.value,I.next=T.nextLoc,I.method!=="return"&&(I.method="next",I.arg=i);else return D;return I.delegate=null,x}M(k),u(k,c,"Generator"),u(k,a,function(){return this}),u(k,"toString",function(){return"[object Generator]"});function q(T){var I={tryLoc:T[0]};1 in T&&(I.catchLoc=T[1]),2 in T&&(I.finallyLoc=T[2],I.afterLoc=T[3]),this.tryEntries.push(I)}function Q(T){var I=T.completion||{};I.type="normal",delete I.arg,T.completion=I}function Z(T){this.tryEntries=[{tryLoc:"root"}],T.forEach(q,this),this.reset(!0)}r.keys=function(T){var I=Object(T),_=[];for(var W in I)_.push(W);return _.reverse(),function z(){for(;_.length;){var D=_.pop();if(D in I)return z.value=D,z.done=!1,z}return z.done=!0,z}};function Y(T){if(T){var I=T[a];if(I)return I.call(T);if(typeof T.next=="function")return T;if(!isNaN(T.length)){var _=-1,W=function z(){for(;++_<T.length;)if(e.call(T,_))return z.value=T[_],z.done=!1,z;return z.value=i,z.done=!0,z};return W.next=W}}return{next:X}}r.values=Y;function X(){return{value:i,done:!0}}return Z.prototype={constructor:Z,reset:function(T){if(this.prev=0,this.next=0,this.sent=this._sent=i,this.done=!1,this.delegate=null,this.method="next",this.arg=i,this.tryEntries.forEach(Q),!T)for(var I in this)I.charAt(0)==="t"&&e.call(this,I)&&!isNaN(+I.slice(1))&&(this[I]=i)},stop:function(){this.done=!0;var T=this.tryEntries[0],I=T.completion;if(I.type==="throw")throw I.arg;return this.rval},dispatchException:function(T){if(this.done)throw T;var I=this;function _(G,H){return D.type="throw",D.arg=T,I.next=G,H&&(I.method="next",I.arg=i),!!H}for(var W=this.tryEntries.length-1;W>=0;--W){var z=this.tryEntries[W],D=z.completion;if(z.tryLoc==="root")return _("end");if(z.tryLoc<=this.prev){var F=e.call(z,"catchLoc"),P=e.call(z,"finallyLoc");if(F&&P){if(this.prev<z.catchLoc)return _(z.catchLoc,!0);if(this.prev<z.finallyLoc)return _(z.finallyLoc)}else if(F){if(this.prev<z.catchLoc)return _(z.catchLoc,!0)}else if(P){if(this.prev<z.finallyLoc)return _(z.finallyLoc)}else throw new Error("try statement without catch or finally")}}},abrupt:function(T,I){for(var _=this.tryEntries.length-1;_>=0;--_){var W=this.tryEntries[_];if(W.tryLoc<=this.prev&&e.call(W,"finallyLoc")&&this.prev<W.finallyLoc){var z=W;break}}z&&(T==="break"||T==="continue")&&z.tryLoc<=I&&I<=z.finallyLoc&&(z=null);var D=z?z.completion:{};return D.type=T,D.arg=I,z?(this.method="next",this.next=z.finallyLoc,x):this.complete(D)},complete:function(T,I){if(T.type==="throw")throw T.arg;return T.type==="break"||T.type==="continue"?this.next=T.arg:T.type==="return"?(this.rval=this.arg=T.arg,this.method="return",this.next="end"):T.type==="normal"&&I&&(this.next=I),x},finish:function(T){for(var I=this.tryEntries.length-1;I>=0;--I){var _=this.tryEntries[I];if(_.finallyLoc===T)return this.complete(_.completion,_.afterLoc),Q(_),x}},catch:function(T){for(var I=this.tryEntries.length-1;I>=0;--I){var _=this.tryEntries[I];if(_.tryLoc===T){var W=_.completion;if(W.type==="throw"){var z=W.arg;Q(_)}return z}}throw new Error("illegal catch attempt")},delegateYield:function(T,I,_){return this.delegate={iterator:Y(T),resultName:I,nextLoc:_},this.method==="next"&&(this.arg=i),x}},r})(typeof px=="object"?px.exports:{});try{regeneratorRuntime=fx}catch{typeof globalThis=="object"?globalThis.regeneratorRuntime=fx:Function("r","regeneratorRuntime = r")(fx)}});var Kg=Xt((wR,JC)=>{"use strict";B();JC.exports=(r,t)=>`${r}-${t}-${Math.random().toString(16).slice(3,8)}`});var mx=Xt((vR,eE)=>{"use strict";B();var T_=Kg(),tE=0;eE.exports=({id:r,action:t,payload:e={}})=>{let n=r;return typeof n>"u"&&(n=T_("Job",tE),tE+=1),{id:n,action:t,payload:e}}});var Zg=Xt(df=>{"use strict";B();var gx=!1;df.logging=gx;df.setLogging=r=>{gx=r};df.log=(...r)=>gx?console.log.apply(df,r):null});var sE=Xt((iE,rE)=>{"use strict";B();var S_=mx(),{log:Qg}=Zg(),D_=Kg(),nE=0;rE.exports=()=>{let r=D_("Scheduler",nE),t={},e={},n=[];nE+=1;let i=()=>n.length,s=()=>Object.keys(t).length,a=()=>{if(n.length!==0){let d=Object.keys(t);for(let f=0;f<d.length;f+=1)if(typeof e[d[f]]>"u"){n[0](t[d[f]]);break}}},l=(d,f)=>new Promise((p,m)=>{let y=S_({action:d,payload:f});n.push(async x=>{n.shift(),e[x.id]=y;try{p(await x[d].apply(iE,[...f,y.id]))}catch(b){m(b)}finally{delete e[x.id],a()}}),Qg(`[${r}]: Add ${y.id} to JobQueue`),Qg(`[${r}]: JobQueue length=${n.length}`),a()});return{addWorker:d=>(t[d.id]=d,Qg(`[${r}]: Add ${d.id}`),Qg(`[${r}]: Number of workers=${s()}`),a(),d.id),addJob:async(d,...f)=>{if(s()===0)throw Error(`[${r}]: You need to have at least one worker before adding jobs`);return l(d,f)},terminate:async()=>{Object.keys(t).forEach(async d=>{await t[d].terminate()}),n=[]},getQueueLen:i,getNumWorkers:s}}});var oE=Xt((DR,aE)=>{"use strict";B();aE.exports=r=>{let t={};return typeof WorkerGlobalScope<"u"?t.type="webworker":typeof document=="object"?t.type="browser":typeof nt.default=="object"&&typeof iu=="function"&&(t.type="node"),typeof r>"u"?t:t[r]}});var cE=Xt((kR,lE)=>{"use strict";B();var N_=oE()("type")==="browser",I_=N_?r=>new URL(r,window.location.href).href:r=>r;lE.exports=r=>{let t={...r};return["corePath","workerPath","langPath"].forEach(e=>{r[e]&&(t[e]=I_(t[e]))}),t}});var yx=Xt((MR,uE)=>{"use strict";B();uE.exports={TESSERACT_ONLY:0,LSTM_ONLY:1,TESSERACT_LSTM_COMBINED:2,DEFAULT:3}});var hE=Xt((FR,k_)=>{k_.exports={name:"tesseract.js",version:"7.0.0",description:"Pure Javascript Multilingual OCR",main:"src/index.js",type:"commonjs",types:"src/index.d.ts",unpkg:"dist/tesseract.min.js",jsdelivr:"dist/tesseract.min.js",scripts:{start:"node scripts/server.js",build:"rimraf dist && webpack --config scripts/webpack.config.prod.js && rollup -c scripts/rollup.esm.mjs","profile:tesseract":"webpack-bundle-analyzer dist/tesseract-stats.json","profile:worker":"webpack-bundle-analyzer dist/worker-stats.json",prepublishOnly:"npm run build",wait:"rimraf dist && wait-on http://localhost:3000/dist/tesseract.min.js",test:"npm-run-all -p -r start test:all","test:all":"npm-run-all wait test:browser test:node:all","test:browser":"karma start karma.conf.js","test:node":"nyc mocha --exit --bail --require ./scripts/test-helper.mjs","test:node:all":"npm run test:node -- ./tests/*.test.mjs",lint:"eslint src","lint:fix":"eslint --fix src",postinstall:"opencollective-postinstall || true"},browser:{"./src/worker/node/index.js":"./src/worker/browser/index.js"},author:"",contributors:["jeromewu"],license:"Apache-2.0",devDependencies:{"@babel/core":"^7.21.4","@babel/eslint-parser":"^7.21.3","@babel/preset-env":"^7.21.4","@rollup/plugin-commonjs":"^24.1.0",acorn:"^8.8.2","babel-loader":"^9.1.2",buffer:"^6.0.3",cors:"^2.8.5",eslint:"^7.32.0","eslint-config-airbnb-base":"^14.2.1","eslint-plugin-import":"^2.27.5","expect.js":"^0.3.1",express:"^4.18.2",mocha:"^10.2.0","npm-run-all":"^4.1.5",karma:"^6.4.2","karma-chrome-launcher":"^3.2.0","karma-firefox-launcher":"^2.1.2","karma-mocha":"^2.0.1","karma-webpack":"^5.0.0",nyc:"^15.1.0",rimraf:"^5.0.0",rollup:"^3.20.7","wait-on":"^7.0.1",webpack:"^5.79.0","webpack-bundle-analyzer":"^4.8.0","webpack-cli":"^5.0.1","webpack-dev-middleware":"^6.0.2","rollup-plugin-sourcemaps":"^0.6.3"},dependencies:{"bmp-js":"^0.1.0","idb-keyval":"^6.2.0","is-url":"^1.2.4","node-fetch":"^2.6.9","opencollective-postinstall":"^2.0.3","regenerator-runtime":"^0.13.3","tesseract.js-core":"^7.0.0","wasm-feature-detect":"^1.8.0",zlibjs:"^0.3.1"},overrides:{"@rollup/pluginutils":"^5.0.2"},repository:{type:"git",url:"https://github.com/naptha/tesseract.js.git"},bugs:{url:"https://github.com/naptha/tesseract.js/issues"},homepage:"https://github.com/naptha/tesseract.js",collective:{type:"opencollective",url:"https://opencollective.com/tesseractjs"}}});var fE=Xt((PR,dE)=>{"use strict";B();dE.exports={workerBlobURL:!0,logger:()=>{}}});var mE=Xt((LR,pE)=>{"use strict";B();var __=hE().version,M_=fE();pE.exports={...M_,workerPath:`https://cdn.jsdelivr.net/npm/tesseract.js@v${__}/dist/worker.min.js`}});var yE=Xt((UR,gE)=>{"use strict";B();gE.exports=({workerPath:r,workerBlobURL:t})=>{let e;if(Blob&&URL&&t){let n=new Blob([`importScripts("${r}");`],{type:"application/javascript"});e=new Worker(URL.createObjectURL(n))}else e=new Worker(r);return e}});var xE=Xt((zR,bE)=>{"use strict";B();bE.exports=r=>{r.terminate()}});var AE=Xt((GR,wE)=>{"use strict";B();wE.exports=(r,t)=>{r.onmessage=({data:e})=>{t(e)}}});var CE=Xt((WR,vE)=>{"use strict";B();vE.exports=async(r,t)=>{r.postMessage(t)}});var TE=Xt((VR,EE)=>{"use strict";B();var bx=r=>new Promise((t,e)=>{let n=new FileReader;n.onload=()=>{t(n.result)},n.onerror=({target:{error:{code:i}}})=>{e(Error(`File could not be read! Code=${i}`))},n.readAsArrayBuffer(r)}),xx=async r=>{let t=r;if(typeof r>"u")return"undefined";if(typeof r=="string")/data:image\/([a-zA-Z]*);base64,([^"]*)/.test(r)?t=atob(r.split(",")[1]).split("").map(e=>e.charCodeAt(0)):t=await(await fetch(r)).arrayBuffer();else if(typeof HTMLElement<"u"&&r instanceof HTMLElement)r.tagName==="IMG"&&(t=await xx(r.src)),r.tagName==="VIDEO"&&(t=await xx(r.poster)),r.tagName==="CANVAS"&&await new Promise(e=>{r.toBlob(async n=>{t=await bx(n),e()})});else if(typeof OffscreenCanvas<"u"&&r instanceof OffscreenCanvas){let e=await r.convertToBlob();t=await bx(e)}else(r instanceof File||r instanceof Blob)&&(t=await bx(r));return new Uint8Array(t)};EE.exports=xx});var DE=Xt((YR,SE)=>{"use strict";B();var O_=mE(),F_=yE(),P_=xE(),R_=AE(),L_=CE(),B_=TE();SE.exports={defaultOptions:O_,spawnWorker:F_,terminateWorker:P_,onMessage:R_,send:L_,loadImage:B_}});var wx=Xt((ZR,_E)=>{"use strict";B();var U_=cE(),cs=mx(),{log:NE}=Zg(),$_=Kg(),fl=yx(),{defaultOptions:z_,spawnWorker:j_,terminateWorker:G_,onMessage:H_,loadImage:IE,send:W_}=DE(),kE=0;_E.exports=async(r="eng",t=fl.LSTM_ONLY,e={},n={})=>{let i=$_("Worker",kE),{logger:s,errorHandler:a,...l}=U_({...z_,...e}),c={},u=typeof r=="string"?r.split("+"):r,h=t,d=n,f=[fl.DEFAULT,fl.LSTM_ONLY].includes(t)&&!l.legacyCore,p,m,y=new Promise((T,I)=>{m=T,p=I}),x=T=>{p(T.message)},b=j_(l);b.onerror=x,kE+=1;let w=({id:T,action:I,payload:_})=>new Promise((W,z)=>{NE(`[${i}]: Start ${T}, action=${I}`);let D=`${I}-${T}`;c[D]={resolve:W,reject:z},W_(b,{workerId:i,jobId:T,action:I,payload:_})}),C=()=>console.warn("`load` is depreciated and should be removed from code (workers now come pre-loaded)"),E=T=>w(cs({id:T,action:"load",payload:{options:{lstmOnly:f,corePath:l.corePath,logging:l.logging}}})),S=(T,I,_)=>w(cs({id:_,action:"FS",payload:{method:"writeFile",args:[T,I]}})),N=(T,I)=>w(cs({id:I,action:"FS",payload:{method:"readFile",args:[T,{encoding:"utf8"}]}})),k=(T,I)=>w(cs({id:I,action:"FS",payload:{method:"unlink",args:[T]}})),M=(T,I,_)=>w(cs({id:_,action:"FS",payload:{method:T,args:I}})),R=(T,I)=>w(cs({id:I,action:"loadLanguage",payload:{langs:T,options:{langPath:l.langPath,dataPath:l.dataPath,cachePath:l.cachePath,cacheMethod:l.cacheMethod,gzip:l.gzip,lstmOnly:[fl.DEFAULT,fl.LSTM_ONLY].includes(h)&&!l.legacyLang}}})),j=(T,I,_,W)=>w(cs({id:W,action:"initialize",payload:{langs:T,oem:I,config:_}})),$=(T="eng",I,_,W)=>{if(f&&[fl.TESSERACT_ONLY,fl.TESSERACT_LSTM_COMBINED].includes(I))throw Error("Legacy model requested but code missing.");let z=I||h;h=z;let D=_||d;d=D;let P=(typeof T=="string"?T.split("+"):T).filter(G=>!u.includes(G));return u.push(...P),P.length>0?R(P,W).then(()=>j(T,z,D,W)):j(T,z,D,W)},q=(T={},I)=>w(cs({id:I,action:"setParameters",payload:{params:T}})),Q=async(T,I={},_={text:!0},W)=>w(cs({id:W,action:"recognize",payload:{image:await IE(T),options:I,output:_}})),Z=async(T,I)=>{if(f)throw Error("`worker.detect` requires Legacy model, which was not loaded.");return w(cs({id:I,action:"detect",payload:{image:await IE(T)}}))},Y=async()=>(b!==null&&(G_(b),b=null),Promise.resolve());H_(b,({workerId:T,jobId:I,status:_,action:W,data:z})=>{let D=`${W}-${I}`;if(_==="resolve")NE(`[${T}]: Complete ${I}`),c[D].resolve({jobId:I,data:z}),delete c[D];else if(_==="reject")if(c[D].reject(z),delete c[D],W==="load"&&p(z),a)a(z);else throw Error(z);else _==="progress"&&s({...z,userJobId:I})});let X={id:i,worker:b,load:C,writeText:S,readText:N,removeFile:k,FS:M,reinitialize:$,setParameters:q,recognize:Q,detect:Z,terminate:Y};return E().then(()=>R(r)).then(()=>j(r,t,n)).then(()=>m(X)).catch(()=>{}),y}});var FE=Xt((JR,OE)=>{"use strict";B();var ME=wx(),q_=async(r,t,e)=>{let n=await ME(t,1,e);return n.recognize(r).finally(async()=>{await n.terminate()})},V_=async(r,t)=>{let e=await ME("osd",0,t);return e.detect(r).finally(async()=>{await e.terminate()})};OE.exports={recognize:q_,detect:V_}});var RE=Xt((eL,PE)=>{"use strict";B();PE.exports={AFR:"afr",AMH:"amh",ARA:"ara",ASM:"asm",AZE:"aze",AZE_CYRL:"aze_cyrl",BEL:"bel",BEN:"ben",BOD:"bod",BOS:"bos",BUL:"bul",CAT:"cat",CEB:"ceb",CES:"ces",CHI_SIM:"chi_sim",CHI_TRA:"chi_tra",CHR:"chr",CYM:"cym",DAN:"dan",DEU:"deu",DZO:"dzo",ELL:"ell",ENG:"eng",ENM:"enm",EPO:"epo",EST:"est",EUS:"eus",FAS:"fas",FIN:"fin",FRA:"fra",FRK:"frk",FRM:"frm",GLE:"gle",GLG:"glg",GRC:"grc",GUJ:"guj",HAT:"hat",HEB:"heb",HIN:"hin",HRV:"hrv",HUN:"hun",IKU:"iku",IND:"ind",ISL:"isl",ITA:"ita",ITA_OLD:"ita_old",JAV:"jav",JPN:"jpn",KAN:"kan",KAT:"kat",KAT_OLD:"kat_old",KAZ:"kaz",KHM:"khm",KIR:"kir",KOR:"kor",KUR:"kur",LAO:"lao",LAT:"lat",LAV:"lav",LIT:"lit",MAL:"mal",MAR:"mar",MKD:"mkd",MLT:"mlt",MSA:"msa",MYA:"mya",NEP:"nep",NLD:"nld",NOR:"nor",ORI:"ori",PAN:"pan",POL:"pol",POR:"por",PUS:"pus",RON:"ron",RUS:"rus",SAN:"san",SIN:"sin",SLK:"slk",SLV:"slv",SPA:"spa",SPA_OLD:"spa_old",SQI:"sqi",SRP:"srp",SRP_LATN:"srp_latn",SWA:"swa",SWE:"swe",SYR:"syr",TAM:"tam",TEL:"tel",TGK:"tgk",TGL:"tgl",THA:"tha",TIR:"tir",TUR:"tur",UIG:"uig",UKR:"ukr",URD:"urd",UZB:"uzb",UZB_CYRL:"uzb_cyrl",VIE:"vie",YID:"yid"}});var BE=Xt((iL,LE)=>{"use strict";B();LE.exports={OSD_ONLY:"0",AUTO_OSD:"1",AUTO_ONLY:"2",AUTO:"3",SINGLE_COLUMN:"4",SINGLE_BLOCK_VERT_TEXT:"5",SINGLE_BLOCK:"6",SINGLE_LINE:"7",SINGLE_WORD:"8",CIRCLE_WORD:"9",SINGLE_CHAR:"10",SPARSE_TEXT:"11",SPARSE_TEXT_OSD:"12",RAW_LINE:"13"}});var $E=Xt((sL,UE)=>{"use strict";B();QC();var X_=sE(),Y_=wx(),K_=FE(),Z_=RE(),Q_=yx(),J_=BE(),{setLogging:tM}=Zg();UE.exports={languages:Z_,OEM:Q_,PSM:J_,createScheduler:X_,createWorker:Y_,setLogging:tM,...K_}});function rM(){if(!(typeof globalThis.TextDecoder>"u"))return Jg??(Jg=new globalThis.TextDecoder("utf-8"))}function VE(r,t="utf-8"){switch(t.toLowerCase()){case"utf-8":case"utf8":{let e=rM();return e?e.decode(r):aM(r)}case"utf-16le":return oM(r);case"us-ascii":case"ascii":return lM(r);case"latin1":case"iso-8859-1":return cM(r);case"windows-1252":return uM(r);default:throw new RangeError(`Encoding '${t}' not supported`)}}function Ax(r,t){t.length!==0&&(r.push(String.fromCharCode.apply(null,t)),t.length=0)}function on(r,t,e){t.push(e),t.length>=_u&&Ax(r,t)}function sM(r,t,e){if(e<=65535){on(r,t,e);return}e-=65536,on(r,t,55296+(e>>10)),on(r,t,56320+(e&1023))}function aM(r){let t=[],e=[],n=0;for(r.length>=3&&r[0]===239&&r[1]===187&&r[2]===191&&(n=3);n<r.length;){let i=r[n];if(i<=127){on(t,e,i),n++;continue}if(i<194||i>244){on(t,e,Or),n++;continue}if(i<=223){if(n+1>=r.length){on(t,e,Or),n++;continue}let h=r[n+1];if((h&192)!==128){on(t,e,Or),n++;continue}let d=(i&31)<<6|h&63;on(t,e,d),n+=2;continue}if(i<=239){if(n+2>=r.length){on(t,e,Or),n++;continue}let h=r[n+1],d=r[n+2];if(!((h&192)===128&&(d&192)===128&&!(i===224&&h<160)&&!(i===237&&h>=160))){on(t,e,Or),n++;continue}let p=(i&15)<<12|(h&63)<<6|d&63;on(t,e,p),n+=3;continue}if(n+3>=r.length){on(t,e,Or),n++;continue}let s=r[n+1],a=r[n+2],l=r[n+3];if(!((s&192)===128&&(a&192)===128&&(l&192)===128&&!(i===240&&s<144)&&!(i===244&&s>143))){on(t,e,Or),n++;continue}let u=(i&7)<<18|(s&63)<<12|(a&63)<<6|l&63;sM(t,e,u),n+=4}return Ax(t,e),t.join("")}function oM(r){let t=[],e=[],n=r.length,i=0;for(;i+1<n;){let s=r[i]|r[i+1]<<8;if(i+=2,s>=55296&&s<=56319){if(i+1<n){let a=r[i]|r[i+1]<<8;a>=56320&&a<=57343?(on(t,e,s),on(t,e,a),i+=2):on(t,e,Or)}else on(t,e,Or);continue}if(s>=56320&&s<=57343){on(t,e,Or);continue}on(t,e,s)}return i<n&&on(t,e,Or),Ax(t,e),t.join("")}function lM(r){let t=[];for(let e=0;e<r.length;e+=_u){let n=Math.min(r.length,e+_u),i=new Array(n-e);for(let s=e,a=0;s<n;s++,a++)i[a]=r[s]&127;t.push(String.fromCharCode.apply(null,i))}return t.join("")}function cM(r){let t=[];for(let e=0;e<r.length;e+=_u){let n=Math.min(r.length,e+_u),i=new Array(n-e);for(let s=e,a=0;s<n;s++,a++)i[a]=r[s];t.push(String.fromCharCode.apply(null,i))}return t.join("")}function uM(r){let t=[],e="";for(let n=0;n<r.length;n++){let i=r[n],s=i>=128&&i<=159?qE[i]:void 0;e+=s??String.fromCharCode(i),e.length>=_u&&(t.push(e),e="")}return e&&t.push(e),t.join("")}var qE,iM,Jg,_u,Or,XE=ne(()=>{B();qE={128:"\u20AC",130:"\u201A",131:"\u0192",132:"\u201E",133:"\u2026",134:"\u2020",135:"\u2021",136:"\u02C6",137:"\u2030",138:"\u0160",139:"\u2039",140:"\u0152",142:"\u017D",145:"\u2018",146:"\u2019",147:"\u201C",148:"\u201D",149:"\u2022",150:"\u2013",151:"\u2014",152:"\u02DC",153:"\u2122",154:"\u0161",155:"\u203A",156:"\u0153",158:"\u017E",159:"\u0178"},iM={};for(let[r,t]of Object.entries(qE))iM[t]=Number.parseInt(r,10);_u=32*1024,Or=65533});function yi(r){return new DataView(r.buffer,r.byteOffset)}var YE,KE,Fe,pl,Ne,vx,ZE,QE,Vn,Ys=ne(()=>{B();YE=ru(Ab(),1);XE();KE={len:1,get(r,t){return yi(r).getUint8(t)},put(r,t,e){return yi(r).setUint8(t,e),t+1}},Fe={len:2,get(r,t){return yi(r).getUint16(t,!0)},put(r,t,e){return yi(r).setUint16(t,e,!0),t+2}},pl={len:2,get(r,t){return yi(r).getUint16(t)},put(r,t,e){return yi(r).setUint16(t,e),t+2}},Ne={len:4,get(r,t){return yi(r).getUint32(t,!0)},put(r,t,e){return yi(r).setUint32(t,e,!0),t+4}},vx={len:4,get(r,t){return yi(r).getUint32(t)},put(r,t,e){return yi(r).setUint32(t,e),t+4}},ZE={len:4,get(r,t){return yi(r).getInt32(t)},put(r,t,e){return yi(r).setInt32(t,e),t+4}},QE={len:8,get(r,t){return yi(r).getBigUint64(t,!0)},put(r,t,e){return yi(r).setBigUint64(t,e,!0),t+8}},Vn=class{constructor(t,e){this.len=t,this.encoding=e}get(t,e=0){let n=t.subarray(e,e+this.len);return VE(n,this.encoding)}}});var hM,Qt,ml,mf=ne(()=>{B();hM="End-Of-Stream",Qt=class extends Error{constructor(){super(hM),this.name="EndOfStreamError"}},ml=class extends Error{constructor(t="The operation was aborted"){super(t),this.name="AbortError"}}});var JE=ne(()=>{B()});var gl,t0=ne(()=>{B();mf();gl=class{constructor(){this.endOfStream=!1,this.interrupted=!1,this.peekQueue=[]}async peek(t,e=!1){let n=await this.read(t,e);return this.peekQueue.push(t.subarray(0,n)),n}async read(t,e=!1){if(t.length===0)return 0;let n=this.readFromPeekBuffer(t);if(this.endOfStream||(n+=await this.readRemainderFromStream(t.subarray(n),e)),n===0&&!e)throw new Qt;return n}readFromPeekBuffer(t){let e=t.length,n=0;for(;this.peekQueue.length>0&&e>0;){let i=this.peekQueue.pop();if(!i)throw new Error("peekData should be defined");let s=Math.min(i.length,e);t.set(i.subarray(0,s),n),n+=s,e-=s,s<i.length&&this.peekQueue.push(i.subarray(s))}return n}async readRemainderFromStream(t,e){let n=0;for(;n<t.length&&!this.endOfStream;){if(this.interrupted)throw new ml;let i=await this.readFromStream(t.subarray(n),e);if(i===0)break;n+=i}if(!e&&n<t.length)throw new Qt;return n}}});var t1=ne(()=>{B();mf();JE();t0()});var e0,e1=ne(()=>{B();t0();e0=class extends gl{constructor(t){super(),this.reader=t}async abort(){return this.close()}async close(){this.reader.releaseLock()}}});var gf,Cx=ne(()=>{B();e1();gf=class extends e0{async readFromStream(t,e){if(t.length===0)return 0;let n=await this.reader.read(new Uint8Array(t.length),{min:e?void 0:t.length});return n.done&&(this.endOfStream=n.done),n.value?(t.set(n.value),n.value.length):0}}});var Mu,Ex=ne(()=>{B();mf();t0();Mu=class extends gl{constructor(t){super(),this.reader=t,this.buffer=null}writeChunk(t,e){let n=Math.min(e.length,t.length);return t.set(e.subarray(0,n)),n<e.length?this.buffer=e.subarray(n):this.buffer=null,n}async readFromStream(t,e){if(t.length===0)return 0;let n=0;for(this.buffer&&(n+=this.writeChunk(t,this.buffer));n<t.length&&!this.endOfStream;){let i=await this.reader.read();if(i.done){this.endOfStream=!0;break}i.value&&(n+=this.writeChunk(t.subarray(n),i.value))}if(!e&&n===0&&this.endOfStream)throw new Qt;return n}abort(){return this.interrupted=!0,this.reader.cancel()}async close(){await this.abort(),this.reader.releaseLock()}}});function Tx(r){try{let t=r.getReader({mode:"byob"});return t instanceof ReadableStreamDefaultReader?new Mu(t):new gf(t)}catch(t){if(t instanceof TypeError)return new Mu(r.getReader());throw t}}var n1=ne(()=>{B();Cx();Ex()});var yl=ne(()=>{B();mf();t1();Cx();Ex();n1()});var Ks,yf=ne(()=>{B();yl();Ks=class{constructor(t){this.numBuffer=new Uint8Array(8),this.position=0,this.onClose=t?.onClose,t?.abortSignal&&t.abortSignal.addEventListener("abort",()=>{this.abort()})}async readToken(t,e=this.position){let n=new Uint8Array(t.len);if(await this.readBuffer(n,{position:e})<t.len)throw new Qt;return t.get(n,0)}async peekToken(t,e=this.position){let n=new Uint8Array(t.len);if(await this.peekBuffer(n,{position:e})<t.len)throw new Qt;return t.get(n,0)}async readNumber(t){if(await this.readBuffer(this.numBuffer,{length:t.len})<t.len)throw new Qt;return t.get(this.numBuffer,0)}async peekNumber(t){if(await this.peekBuffer(this.numBuffer,{length:t.len})<t.len)throw new Qt;return t.get(this.numBuffer,0)}async ignore(t){if(t<0)throw new RangeError("ignore length must be \u2265 0 bytes");if(this.fileInfo.size!==void 0){let e=this.fileInfo.size-this.position;if(t>e)return this.position+=e,e}return this.position+=t,t}async close(){await this.abort(),await this.onClose?.()}normalizeOptions(t,e){if(!this.supportsRandomAccess()&&e&&e.position!==void 0&&e.position<this.position)throw new Error("`options.position` must be equal or greater than `tokenizer.position`");return{mayBeLess:!1,offset:0,length:t.length,position:this.position,...e}}abort(){return Promise.resolve()}}});var fM,n0,i1=ne(()=>{B();yf();yl();fM=256e3,n0=class extends Ks{constructor(t,e){super(e),this.streamReader=t,this.fileInfo=e?.fileInfo??{}}async readBuffer(t,e){let n=this.normalizeOptions(t,e),i=n.position-this.position;if(i>0)return await this.ignore(i),this.readBuffer(t,e);if(i<0)throw new Error("`options.position` must be equal or greater than `tokenizer.position`");if(n.length===0)return 0;let s=await this.streamReader.read(t.subarray(0,n.length),n.mayBeLess);if(this.position+=s,(!e||!e.mayBeLess)&&s<n.length)throw new Qt;return s}async peekBuffer(t,e){let n=this.normalizeOptions(t,e),i=0;if(n.position){let s=n.position-this.position;if(s>0){let a=new Uint8Array(n.length+s);return i=await this.peekBuffer(a,{mayBeLess:n.mayBeLess}),t.set(a.subarray(s)),i-s}if(s<0)throw new Error("Cannot peek from a negative offset in a stream")}if(n.length>0){try{i=await this.streamReader.peek(t.subarray(0,n.length),n.mayBeLess)}catch(s){if(e?.mayBeLess&&s instanceof Qt)return 0;throw s}if(!n.mayBeLess&&i<n.length)throw new Qt}return i}async ignore(t){if(t<0)throw new RangeError("ignore length must be \u2265 0 bytes");let e=Math.min(fM,t),n=new Uint8Array(e),i=0;for(;i<t;){let s=t-i,a=await this.readBuffer(n,{length:Math.min(e,s)});if(a<0)return a;i+=a}return i}abort(){return this.streamReader.abort()}async close(){return this.streamReader.close()}supportsRandomAccess(){return!1}}});var i0,r1=ne(()=>{B();yl();yf();i0=class extends Ks{constructor(t,e){super(e),this.uint8Array=t,this.fileInfo={...e?.fileInfo??{},size:t.length}}async readBuffer(t,e){e?.position&&(this.position=e.position);let n=await this.peekBuffer(t,e);return this.position+=n,n}async peekBuffer(t,e){let n=this.normalizeOptions(t,e),i=Math.min(this.uint8Array.length-n.position,n.length);if(!n.mayBeLess&&i<n.length)throw new Qt;return t.set(this.uint8Array.subarray(n.position,n.position+i)),i}close(){return super.close()}supportsRandomAccess(){return!0}setPosition(t){this.position=t}}});var r0,s1=ne(()=>{B();yl();yf();r0=class extends Ks{constructor(t,e){super(e),this.blob=t,this.fileInfo={...e?.fileInfo??{},size:t.size,mimeType:t.type}}async readBuffer(t,e){e?.position&&(this.position=e.position);let n=await this.peekBuffer(t,e);return this.position+=n,n}async peekBuffer(t,e){let n=this.normalizeOptions(t,e),i=Math.min(this.blob.size-n.position,n.length);if(!n.mayBeLess&&i<n.length)throw new Qt;let s=await this.blob.slice(n.position,n.position+i).arrayBuffer();return t.set(new Uint8Array(s)),i}close(){return super.close()}supportsRandomAccess(){return!0}setPosition(t){this.position=t}}});function a1(r,t){let e=Tx(r),n=t??{},i=n.onClose;return n.onClose=async()=>{if(await e.close(),i)return i()},new n0(e,n)}function o1(r,t){return new i0(r,t)}function l1(r,t){return new r0(r,t)}var bf=ne(()=>{B();yl();i1();r1();s1();yl();yf()});var u1=Xt((HB,c1)=>{B();var Ou=1e3,Fu=Ou*60,Pu=Fu*60,bl=Pu*24,pM=bl*7,mM=bl*365.25;c1.exports=function(r,t){t=t||{};var e=typeof r;if(e==="string"&&r.length>0)return gM(r);if(e==="number"&&isFinite(r))return t.long?bM(r):yM(r);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(r))};function gM(r){if(r=String(r),!(r.length>100)){var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(r);if(t){var e=parseFloat(t[1]),n=(t[2]||"ms").toLowerCase();switch(n){case"years":case"year":case"yrs":case"yr":case"y":return e*mM;case"weeks":case"week":case"w":return e*pM;case"days":case"day":case"d":return e*bl;case"hours":case"hour":case"hrs":case"hr":case"h":return e*Pu;case"minutes":case"minute":case"mins":case"min":case"m":return e*Fu;case"seconds":case"second":case"secs":case"sec":case"s":return e*Ou;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return e;default:return}}}}function yM(r){var t=Math.abs(r);return t>=bl?Math.round(r/bl)+"d":t>=Pu?Math.round(r/Pu)+"h":t>=Fu?Math.round(r/Fu)+"m":t>=Ou?Math.round(r/Ou)+"s":r+"ms"}function bM(r){var t=Math.abs(r);return t>=bl?a0(r,t,bl,"day"):t>=Pu?a0(r,t,Pu,"hour"):t>=Fu?a0(r,t,Fu,"minute"):t>=Ou?a0(r,t,Ou,"second"):r+" ms"}function a0(r,t,e,n){var i=t>=e*1.5;return Math.round(r/e)+" "+n+(i?"s":"")}});var d1=Xt((qB,h1)=>{B();function xM(r){e.debug=e,e.default=e,e.coerce=c,e.disable=a,e.enable=i,e.enabled=l,e.humanize=u1(),e.destroy=u,Object.keys(r).forEach(h=>{e[h]=r[h]}),e.names=[],e.skips=[],e.formatters={};function t(h){let d=0;for(let f=0;f<h.length;f++)d=(d<<5)-d+h.charCodeAt(f),d|=0;return e.colors[Math.abs(d)%e.colors.length]}e.selectColor=t;function e(h){let d,f=null,p,m;function y(...x){if(!y.enabled)return;let b=y,w=Number(new Date),C=w-(d||w);b.diff=C,b.prev=d,b.curr=w,d=w,x[0]=e.coerce(x[0]),typeof x[0]!="string"&&x.unshift("%O");let E=0;x[0]=x[0].replace(/%([a-zA-Z%])/g,(N,k)=>{if(N==="%%")return"%";E++;let M=e.formatters[k];if(typeof M=="function"){let R=x[E];N=M.call(b,R),x.splice(E,1),E--}return N}),e.formatArgs.call(b,x),(b.log||e.log).apply(b,x)}return y.namespace=h,y.useColors=e.useColors(),y.color=e.selectColor(h),y.extend=n,y.destroy=e.destroy,Object.defineProperty(y,"enabled",{enumerable:!0,configurable:!1,get:()=>f!==null?f:(p!==e.namespaces&&(p=e.namespaces,m=e.enabled(h)),m),set:x=>{f=x}}),typeof e.init=="function"&&e.init(y),y}function n(h,d){let f=e(this.namespace+(typeof d>"u"?":":d)+h);return f.log=this.log,f}function i(h){e.save(h),e.namespaces=h,e.names=[],e.skips=[];let d=(typeof h=="string"?h:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(let f of d)f[0]==="-"?e.skips.push(f.slice(1)):e.names.push(f)}function s(h,d){let f=0,p=0,m=-1,y=0;for(;f<h.length;)if(p<d.length&&(d[p]===h[f]||d[p]==="*"))d[p]==="*"?(m=p,y=f,p++):(f++,p++);else if(m!==-1)p=m+1,y++,f=y;else return!1;for(;p<d.length&&d[p]==="*";)p++;return p===d.length}function a(){let h=[...e.names,...e.skips.map(d=>"-"+d)].join(",");return e.enable(""),h}function l(h){for(let d of e.skips)if(s(h,d))return!1;for(let d of e.names)if(s(h,d))return!0;return!1}function c(h){return h instanceof Error?h.stack||h.message:h}function u(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return e.enable(e.load()),e}h1.exports=xM});var f1=Xt((bi,o0)=>{B();bi.formatArgs=AM;bi.save=vM;bi.load=CM;bi.useColors=wM;bi.storage=EM();bi.destroy=(()=>{let r=!1;return()=>{r||(r=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})();bi.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function wM(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let r;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(r=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(r[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function AM(r){if(r[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+r[0]+(this.useColors?"%c ":" ")+"+"+o0.exports.humanize(this.diff),!this.useColors)return;let t="color: "+this.color;r.splice(1,0,t,"color: inherit");let e=0,n=0;r[0].replace(/%[a-zA-Z%]/g,i=>{i!=="%%"&&(e++,i==="%c"&&(n=e))}),r.splice(n,0,t)}bi.log=console.debug||console.log||(()=>{});function vM(r){try{r?bi.storage.setItem("debug",r):bi.storage.removeItem("debug")}catch{}}function CM(){let r;try{r=bi.storage.getItem("debug")||bi.storage.getItem("DEBUG")}catch{}return!r&&typeof nt.default<"u"&&"env"in nt.default&&(r=nt.default.env.DEBUG),r}function EM(){try{return localStorage}catch{}}o0.exports=d1()(bi);var{formatters:TM}=o0.exports;TM.j=function(r){try{return JSON.stringify(r)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}}});var xl,Sx,p1,m1,g1,y1=ne(()=>{B();Ys();xl={LocalFileHeader:67324752,DataDescriptor:134695760,CentralFileHeader:33639248,EndOfCentralDirectory:101010256},Sx={get(r){return{signature:Ne.get(r,0),compressedSize:Ne.get(r,8),uncompressedSize:Ne.get(r,12)}},len:16},p1={get(r){let t=Fe.get(r,6);return{signature:Ne.get(r,0),minVersion:Fe.get(r,4),dataDescriptor:!!(t&8),compressedMethod:Fe.get(r,8),compressedSize:Ne.get(r,18),uncompressedSize:Ne.get(r,22),filenameLength:Fe.get(r,26),extraFieldLength:Fe.get(r,28),filename:null}},len:30},m1={get(r){return{signature:Ne.get(r,0),nrOfThisDisk:Fe.get(r,4),nrOfThisDiskWithTheStart:Fe.get(r,6),nrOfEntriesOnThisDisk:Fe.get(r,8),nrOfEntriesOfSize:Fe.get(r,10),sizeOfCd:Ne.get(r,12),offsetOfStartOfCd:Ne.get(r,16),zipFileCommentLength:Fe.get(r,20)}},len:22},g1={get(r){let t=Fe.get(r,8);return{signature:Ne.get(r,0),minVersion:Fe.get(r,6),dataDescriptor:!!(t&8),compressedMethod:Fe.get(r,10),compressedSize:Ne.get(r,20),uncompressedSize:Ne.get(r,24),filenameLength:Fe.get(r,28),extraFieldLength:Fe.get(r,30),fileCommentLength:Fe.get(r,32),relativeOffsetOfLocalHeader:Ne.get(r,42),filename:null}},len:46}});function x1(r){let t=new Uint8Array(Ne.len);return Ne.put(t,0,r),t}function DM(r,t){let e=r.length,n=t.length;if(n>e)return-1;for(let i=0;i<=e-n;i++){let s=!0;for(let a=0;a<n;a++)if(r[i+a]!==t[a]){s=!1;break}if(s)return i}return-1}function NM(r){let t=r.reduce((i,s)=>i+s.length,0),e=new Uint8Array(t),n=0;for(let i of r)e.set(i,n),n+=i.length;return e}var b1,us,Dx,SM,l0,wl,w1=ne(()=>{B();Ys();b1=ru(f1(),1);y1();us=(0,b1.default)("tokenizer:inflate"),Dx=256*1024,SM=x1(xl.DataDescriptor),l0=x1(xl.EndOfCentralDirectory),wl=class r{constructor(t){this.tokenizer=t,this.syncBuffer=new Uint8Array(Dx)}async isZip(){return await this.peekSignature()===xl.LocalFileHeader}peekSignature(){return this.tokenizer.peekToken(Ne)}async findEndOfCentralDirectoryLocator(){let t=this.tokenizer,e=Math.min(16*1024,t.fileInfo.size),n=this.syncBuffer.subarray(0,e);await this.tokenizer.readBuffer(n,{position:t.fileInfo.size-e});for(let i=n.length-4;i>=0;i--)if(n[i]===l0[0]&&n[i+1]===l0[1]&&n[i+2]===l0[2]&&n[i+3]===l0[3])return t.fileInfo.size-e+i;return-1}async readCentralDirectory(){if(!this.tokenizer.supportsRandomAccess()){us("Cannot reading central-directory without random-read support");return}us("Reading central-directory...");let t=this.tokenizer.position,e=await this.findEndOfCentralDirectoryLocator();if(e>0){us("Central-directory 32-bit signature found");let n=await this.tokenizer.readToken(m1,e),i=[];this.tokenizer.setPosition(n.offsetOfStartOfCd);for(let s=0;s<n.nrOfEntriesOfSize;++s){let a=await this.tokenizer.readToken(g1);if(a.signature!==xl.CentralFileHeader)throw new Error("Expected Central-File-Header signature");a.filename=await this.tokenizer.readToken(new Vn(a.filenameLength,"utf-8")),await this.tokenizer.ignore(a.extraFieldLength),await this.tokenizer.ignore(a.fileCommentLength),i.push(a),us(`Add central-directory file-entry: n=${s+1}/${i.length}: filename=${i[s].filename}`)}return this.tokenizer.setPosition(t),i}this.tokenizer.setPosition(t)}async unzip(t){let e=await this.readCentralDirectory();if(e)return this.iterateOverCentralDirectory(e,t);let n=!1;do{let i=await this.readLocalFileHeader();if(!i)break;let s=t(i);n=!!s.stop;let a;if(await this.tokenizer.ignore(i.extraFieldLength),i.dataDescriptor&&i.compressedSize===0){let l=[],c=Dx;us("Compressed-file-size unknown, scanning for next data-descriptor-signature....");let u=-1;for(;u<0&&c===Dx;){c=await this.tokenizer.peekBuffer(this.syncBuffer,{mayBeLess:!0}),u=DM(this.syncBuffer.subarray(0,c),SM);let h=u>=0?u:c;if(s.handler){let d=new Uint8Array(h);await this.tokenizer.readBuffer(d),l.push(d)}else await this.tokenizer.ignore(h)}us(`Found data-descriptor-signature at pos=${this.tokenizer.position}`),s.handler&&await this.inflate(i,NM(l),s.handler)}else s.handler?(us(`Reading compressed-file-data: ${i.compressedSize} bytes`),a=new Uint8Array(i.compressedSize),await this.tokenizer.readBuffer(a),await this.inflate(i,a,s.handler)):(us(`Ignoring compressed-file-data: ${i.compressedSize} bytes`),await this.tokenizer.ignore(i.compressedSize));if(us(`Reading data-descriptor at pos=${this.tokenizer.position}`),i.dataDescriptor&&(await this.tokenizer.readToken(Sx)).signature!==134695760)throw new Error(`Expected data-descriptor-signature at position ${this.tokenizer.position-Sx.len}`)}while(!n)}async iterateOverCentralDirectory(t,e){for(let n of t){let i=e(n);if(i.handler){this.tokenizer.setPosition(n.relativeOffsetOfLocalHeader);let s=await this.readLocalFileHeader();if(s){await this.tokenizer.ignore(s.extraFieldLength);let a=new Uint8Array(n.compressedSize);await this.tokenizer.readBuffer(a),await this.inflate(s,a,i.handler)}}if(i.stop)break}}async inflate(t,e,n){if(t.compressedMethod===0)return n(e);if(t.compressedMethod!==8)throw new Error(`Unsupported ZIP compression method: ${t.compressedMethod}`);us(`Decompress filename=${t.filename}, compressed-size=${e.length}`);let i=await r.decompressDeflateRaw(e);return n(i)}static async decompressDeflateRaw(t){let e=new ReadableStream({start(s){s.enqueue(t),s.close()}}),n=new DecompressionStream("deflate-raw"),i=e.pipeThrough(n);try{let a=await new Response(i).arrayBuffer();return new Uint8Array(a)}catch(s){let a=s instanceof Error?`Failed to deflate ZIP entry: ${s.message}`:"Unknown decompression error in ZIP entry";throw new TypeError(a)}}async readLocalFileHeader(){let t=await this.tokenizer.peekToken(Ne);if(t===xl.LocalFileHeader){let e=await this.tokenizer.readToken(p1);return e.filename=await this.tokenizer.readToken(new Vn(e.filenameLength,"utf-8")),e}if(t===xl.CentralFileHeader)return!1;throw t===3759263696?new Error("Encrypted ZIP"):new Error("Unexpected signature")}}});var xf,A1=ne(()=>{B();xf=class{constructor(t){this.tokenizer=t}inflate(){let t=this.tokenizer;return new ReadableStream({async pull(e){let n=new Uint8Array(1024),i=await t.readBuffer(n,{mayBeLess:!0});if(i===0){e.close();return}e.enqueue(n.subarray(0,i))}}).pipeThrough(new DecompressionStream("gzip"))}}});var Nx=ne(()=>{B();w1();A1()});function _M(r,t,e){return r?r.constructor===t?!0:IM.call(r)===e:!1}function MM(r){return _M(r,Uint8Array,kM)}function OM(r){if(!MM(r))throw new TypeError(`Expected \`Uint8Array\`, got \`${typeof r}\``)}function v1(r,t){if(r.length===0)return new Uint8Array(0);t??(t=r.reduce((i,s)=>i+s.length,0));let e=new Uint8Array(t),n=0;for(let i of r)OM(i),e.set(i,n),n+=i.length;return e}function Ix(r){let{byteLength:t}=r;if(t===6)return r.getUint16(0)*2**32+r.getUint32(2);if(t===5)return r.getUint8(0)*2**32+r.getUint32(1);if(t===4)return r.getUint32(0);if(t===3)return r.getUint8(0)*2**16+r.getUint16(1);if(t===2)return r.getUint16(0);if(t===1)return r.getUint8(0)}var IM,kM,l3,c3,u3,kx=ne(()=>{B();IM=Object.prototype.toString,kM="[object Uint8Array]";l3={utf8:new globalThis.TextDecoder("utf8")},c3=new globalThis.TextEncoder,u3=Array.from({length:256},(r,t)=>t.toString(16).padStart(2,"0"))});function C1(r,t){if(t==="utf-16le"){let e=[];for(let n=0;n<r.length;n++){let i=r.charCodeAt(n);e.push(i&255,i>>8&255)}return e}if(t==="utf-16be"){let e=[];for(let n=0;n<r.length;n++){let i=r.charCodeAt(n);e.push(i>>8&255,i&255)}return e}return[...r].map(e=>e.charCodeAt(0))}function E1(r,t=0){let e=Number.parseInt(new Vn(6).get(r,148).replace(new RegExp("\\0.*$","v"),"").trim(),8);if(Number.isNaN(e))return!1;let n=256;for(let i=t;i<t+148;i++)n+=r[i];for(let i=t+156;i<t+512;i++)n+=r[i];return e===n}var T1,S1=ne(()=>{B();Ys();T1={get:(r,t)=>r[t+3]&127|(r[t+2]&127)<<7|(r[t+1]&127)<<14|(r[t]&127)<<21,len:4}});var D1,N1,I1=ne(()=>{B();D1=["jpg","png","apng","gif","webp","flif","xcf","cr2","cr3","orf","arw","dng","nef","rw2","raf","tif","bmp","icns","jxr","psd","indd","zip","tar","rar","gz","bz2","7z","dmg","mp4","mid","mkv","webm","mov","avi","mpg","mp2","mp3","m4a","oga","ogg","ogv","opus","flac","wav","spx","amr","pdf","epub","elf","macho","exe","swf","rtf","wasm","woff","woff2","eot","ttf","otf","ttc","ico","flv","ps","xz","sqlite","nes","crx","xpi","cab","deb","ar","rpm","Z","lz","cfb","mxf","mts","blend","bpg","docx","pptx","xlsx","3gp","3g2","j2c","jp2","jpm","jpx","mj2","aif","qcp","odt","ods","odp","xml","mobi","heic","cur","ktx","ape","wv","dcm","ics","glb","pcap","dsf","lnk","alias","voc","ac3","m4v","m4p","m4b","f4v","f4p","f4b","f4a","mie","asf","ogm","ogx","mpc","arrow","shp","aac","mp1","it","s3m","xm","skp","avif","eps","lzh","pgp","asar","stl","chm","3mf","zst","jxl","vcf","jls","pst","dwg","parquet","class","arj","cpio","ace","avro","icc","fbx","vsdx","vtt","apk","drc","lz4","potx","xltx","dotx","xltm","ott","ots","otp","odg","otg","xlsm","docm","dotm","potm","pptm","jar","jmp","rm","sav","ppsm","ppsx","tar.gz","reg","dat","key","numbers","pages"],N1=["image/jpeg","image/png","image/gif","image/webp","image/flif","image/x-xcf","image/x-canon-cr2","image/x-canon-cr3","image/tiff","image/bmp","image/vnd.ms-photo","image/vnd.adobe.photoshop","application/x-indesign","application/epub+zip","application/x-xpinstall","application/vnd.ms-powerpoint.slideshow.macroenabled.12","application/vnd.oasis.opendocument.text","application/vnd.oasis.opendocument.spreadsheet","application/vnd.oasis.opendocument.presentation","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.openxmlformats-officedocument.presentationml.presentation","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/vnd.openxmlformats-officedocument.presentationml.slideshow","application/zip","application/x-tar","application/x-rar-compressed","application/gzip","application/x-bzip2","application/x-7z-compressed","application/x-apple-diskimage","application/vnd.apache.arrow.file","video/mp4","audio/midi","video/matroska","video/webm","video/quicktime","video/vnd.avi","audio/wav","audio/qcelp","audio/x-ms-asf","video/x-ms-asf","application/vnd.ms-asf","video/mpeg","video/3gpp","audio/mpeg","audio/mp4","video/ogg","audio/ogg","audio/ogg; codecs=opus","application/ogg","audio/flac","audio/ape","audio/wavpack","audio/amr","application/pdf","application/x-elf","application/x-mach-binary","application/x-msdownload","application/x-shockwave-flash","application/rtf","application/wasm","font/woff","font/woff2","application/vnd.ms-fontobject","font/ttf","font/otf","font/collection","image/x-icon","video/x-flv","application/postscript","application/eps","application/x-xz","application/x-sqlite3","application/x-nintendo-nes-rom","application/x-google-chrome-extension","application/vnd.ms-cab-compressed","application/x-deb","application/x-unix-archive","application/x-rpm","application/x-compress","application/lzip","application/x-cfb","application/x-mie","application/mxf","video/mp2t","application/x-blender","image/bpg","image/j2c","image/jp2","image/jpx","image/jpm","image/mj2","audio/aiff","application/xml","application/x-mobipocket-ebook","image/heif","image/heif-sequence","image/heic","image/heic-sequence","image/icns","image/ktx","application/dicom","audio/x-musepack","text/calendar","text/vcard","text/vtt","model/gltf-binary","application/vnd.tcpdump.pcap","audio/x-dsf","application/x-ms-shortcut","application/x-ft-apple.alias","audio/x-voc","audio/vnd.dolby.dd-raw","audio/x-m4a","image/apng","image/x-olympus-orf","image/x-sony-arw","image/x-adobe-dng","image/x-nikon-nef","image/x-panasonic-rw2","image/x-fujifilm-raf","video/x-m4v","video/3gpp2","application/x-esri-shape","audio/aac","audio/x-it","audio/x-s3m","audio/x-xm","video/MP1S","video/MP2P","application/vnd.sketchup.skp","image/avif","application/x-lzh-compressed","application/pgp-encrypted","application/x-asar","model/stl","application/vnd.ms-htmlhelp","model/3mf","image/jxl","application/zstd","image/jls","application/vnd.ms-outlook","image/vnd.dwg","application/vnd.apache.parquet","application/java-vm","application/x-arj","application/x-cpio","application/x-ace-compressed","application/avro","application/vnd.iccprofile","application/x-ft-fbx","application/vnd.visio","application/vnd.android.package-archive","application/x-ft-draco","application/x-lz4","application/vnd.openxmlformats-officedocument.presentationml.template","application/vnd.openxmlformats-officedocument.spreadsheetml.template","application/vnd.openxmlformats-officedocument.wordprocessingml.template","application/vnd.ms-excel.template.macroenabled.12","application/vnd.oasis.opendocument.text-template","application/vnd.oasis.opendocument.spreadsheet-template","application/vnd.oasis.opendocument.presentation-template","application/vnd.oasis.opendocument.graphics","application/vnd.oasis.opendocument.graphics-template","application/vnd.ms-excel.sheet.macroenabled.12","application/vnd.ms-word.document.macroenabled.12","application/vnd.ms-word.template.macroenabled.12","application/vnd.ms-powerpoint.template.macroenabled.12","application/vnd.ms-powerpoint.presentation.macroenabled.12","application/java-archive","application/vnd.rn-realmedia","application/x-spss-sav","application/x-ms-regedit","application/x-ft-windows-registry-hive","application/x-jmp-data","application/vnd.apple.keynote","application/vnd.apple.numbers","application/vnd.apple.pages"]});function c0(r,t,e){if(!Number.isFinite(r)||r<0||r>t)throw new Di(`${e} has invalid size ${r} (maximum ${t} bytes)`);return r}async function Ni(r,t,{maximumLength:e=16777216,reason:n="skip"}={}){let i=c0(t,e,n);await r.ignore(i)}async function wf(r,t,e,{maximumLength:n=t.length,reason:i="read"}={}){let s=e?.length??t.length,a=c0(s,n,i);return r.readBuffer(t,{...e,length:a})}function cr(r,t,e){e={offset:0,...e};for(let[n,i]of t.entries())if(e.mask){if(i!==(e.mask[n]&r[n+e.offset]))return!1}else if(i!==r[n+e.offset])return!1;return!0}function Je(r){let t=r.fileInfo.size;return!Number.isFinite(t)||t===Number.MAX_SAFE_INTEGER}function Zs(r,t,e){return Je(r)&&r.position-t>e}var Di,Ru=ne(()=>{B();Di=class extends Error{}});async function BM(r,{maximumLength:t=Qs}={}){let i=new ReadableStream({start(u){u.enqueue(r),u.close()}}).pipeThrough(new DecompressionStream("deflate-raw")).getReader(),s=[],a=0;try{for(;;){let{done:u,value:h}=await i.read();if(u)break;if(a+=h.length,a>t)throw await i.cancel(),new Error(`ZIP entry decompressed data exceeds ${t} bytes`);s.push(h)}}finally{i.releaseLock()}let l=new Uint8Array(a),c=0;for(let u of s)l.set(u,c),c+=u.length;return l}function UM(r,t){let e=new Uint8Array(t),n=0;for(let i of r)e.set(i,n),n+=i.length;return e}function $M(r){let t=r.fileInfo.size,e=Number.isFinite(t)?Math.max(0,t-r.position):Number.MAX_SAFE_INTEGER;return Math.min(e,FM)}function zM(r){if(r instanceof Qt||r instanceof Di)return!0;if(!(r instanceof Error))return!1;if(PM.has(r.message)||LM.has(r.code))return!0;for(let t of RM)if(r.message.startsWith(t))return!0;return!1}function M1(r,t=Qs){let e=[r.compressedSize,r.uncompressedSize];for(let n of e)if(!Number.isFinite(n)||n<0||n>t)return!1;return!0}function jM(){return{hasDocumentEntry:!1,hasMasterSlideEntry:!1,hasTablesEntry:!1,hasCalculationEngineEntry:!1}}function GM(r,t){t==="Index/Document.iwa"&&(r.hasDocumentEntry=!0),t.startsWith("Index/MasterSlide")&&(r.hasMasterSlideEntry=!0),t.startsWith("Index/Tables/")&&(r.hasTablesEntry=!0),t==="Index/CalculationEngine.iwa"&&(r.hasCalculationEngineEntry=!0)}function O1(r){if(r.hasDocumentEntry)return r.hasMasterSlideEntry?{ext:"key",mime:"application/vnd.apple.keynote"}:r.hasTablesEntry?{ext:"numbers",mime:"application/vnd.apple.numbers"}:{ext:"pages",mime:"application/vnd.apple.pages"}}function F1(r){switch(r=r.toLowerCase(),r){case"application/epub+zip":return{ext:"epub",mime:r};case"application/vnd.oasis.opendocument.text":return{ext:"odt",mime:r};case"application/vnd.oasis.opendocument.text-template":return{ext:"ott",mime:r};case"application/vnd.oasis.opendocument.spreadsheet":return{ext:"ods",mime:r};case"application/vnd.oasis.opendocument.spreadsheet-template":return{ext:"ots",mime:r};case"application/vnd.oasis.opendocument.presentation":return{ext:"odp",mime:r};case"application/vnd.oasis.opendocument.presentation-template":return{ext:"otp",mime:r};case"application/vnd.oasis.opendocument.graphics":return{ext:"odg",mime:r};case"application/vnd.oasis.opendocument.graphics-template":return{ext:"otg",mime:r};case"application/vnd.openxmlformats-officedocument.presentationml.slideshow":return{ext:"ppsx",mime:r};case"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":return{ext:"xlsx",mime:r};case"application/vnd.ms-excel.sheet.macroenabled":return{ext:"xlsm",mime:"application/vnd.ms-excel.sheet.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.spreadsheetml.template":return{ext:"xltx",mime:r};case"application/vnd.ms-excel.template.macroenabled":return{ext:"xltm",mime:"application/vnd.ms-excel.template.macroenabled.12"};case"application/vnd.ms-powerpoint.slideshow.macroenabled":return{ext:"ppsm",mime:"application/vnd.ms-powerpoint.slideshow.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.wordprocessingml.document":return{ext:"docx",mime:r};case"application/vnd.ms-word.document.macroenabled":return{ext:"docm",mime:"application/vnd.ms-word.document.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.wordprocessingml.template":return{ext:"dotx",mime:r};case"application/vnd.ms-word.template.macroenabledtemplate":return{ext:"dotm",mime:"application/vnd.ms-word.template.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.presentationml.template":return{ext:"potx",mime:r};case"application/vnd.ms-powerpoint.template.macroenabled":return{ext:"potm",mime:"application/vnd.ms-powerpoint.template.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.presentationml.presentation":return{ext:"pptx",mime:r};case"application/vnd.ms-powerpoint.presentation.macroenabled":return{ext:"pptm",mime:"application/vnd.ms-powerpoint.presentation.macroenabled.12"};case"application/vnd.ms-visio.drawing":return{ext:"vsdx",mime:"application/vnd.visio"};case"application/vnd.ms-package.3dmanufacturing-3dmodel+xml":return{ext:"3mf",mime:"model/3mf"};default:}}function HM(){return{hasContentTypesEntry:!1,hasParsedContentTypesEntry:!1,isParsingContentTypes:!1,hasUnparseableContentTypes:!1,hasWordDirectory:!1,hasPresentationDirectory:!1,hasSpreadsheetDirectory:!1,hasThreeDimensionalModelEntry:!1}}function WM(r,t){t.startsWith("word/")&&(r.hasWordDirectory=!0),t.startsWith("ppt/")&&(r.hasPresentationDirectory=!0),t.startsWith("xl/")&&(r.hasSpreadsheetDirectory=!0),t.startsWith("3D/")&&t.endsWith(".model")&&(r.hasThreeDimensionalModelEntry=!0)}function R1(r){if(r.hasWordDirectory)return{ext:"docx",mime:"application/vnd.openxmlformats-officedocument.wordprocessingml.document"};if(r.hasPresentationDirectory)return{ext:"pptx",mime:"application/vnd.openxmlformats-officedocument.presentationml.presentation"};if(r.hasSpreadsheetDirectory)return{ext:"xlsx",mime:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"};if(r.hasThreeDimensionalModelEntry)return{ext:"3mf",mime:"model/3mf"}}function P1(r){if(!(!r.hasContentTypesEntry||r.hasUnparseableContentTypes||r.isParsingContentTypes||r.hasParsedContentTypesEntry))return R1(r)}function qM(r){let t=r.indexOf('.main+xml"');if(t===-1){let i="application/vnd.ms-package.3dmanufacturing-3dmodel+xml";return r.includes(`ContentType="${i}"`)?i:void 0}let e=r.slice(0,t),n=e.lastIndexOf('"');return e.slice(n+1)}function XM(r,t){if(r.length<u0)return-1;let e=r.length-u0;for(let n=0;n<=e;n++)if(Ne.get(r,n)===L1&&Ne.get(r,n+8)===t+n)return n;return-1}async function YM(r,{shouldBuffer:t,maximumLength:e=Qs}={}){let{syncBuffer:n}=r,{length:i}=n,s=[],a=0;for(;;){let l=await r.tokenizer.peekBuffer(n,{mayBeLess:!0}),c=XM(n.subarray(0,l),a),u=c>=0?0:l===i?Math.min(VM,l-1):0,h=c>=0?c:l-u;if(h===0)break;if(a+=h,a>e)throw new Error(`ZIP entry compressed data exceeds ${e} bytes`);if(t){let d=new Uint8Array(h);await r.tokenizer.readBuffer(d),s.push(d)}else await r.tokenizer.ignore(h);if(c>=0)break}if(Je(r.tokenizer)||(r.knownSizeDescriptorScannedBytes+=a),!!t)return UM(s,a)}function KM(r,t){return Je(r.tokenizer)?Math.max(0,16777216-(r.tokenizer.position-t)):Math.max(0,Qs-r.knownSizeDescriptorScannedBytes)}async function ZM(r,t,{shouldBuffer:e,maximumDescriptorLength:n=Qs}={}){if(t.dataDescriptor&&t.compressedSize===0)return YM(r,{shouldBuffer:e,maximumLength:n});if(!e){await Ni(r.tokenizer,t.compressedSize,{maximumLength:Je(r.tokenizer)?Qs:r.tokenizer.fileInfo.size,reason:"ZIP entry compressed data"});return}let i=$M(r.tokenizer);if(!Number.isFinite(t.compressedSize)||t.compressedSize<0||t.compressedSize>i)throw new Error(`ZIP entry compressed data exceeds ${i} bytes`);let s=new Uint8Array(t.compressedSize);return await r.tokenizer.readBuffer(s),s}async function B1(r){let t,e=HM(),n=jM();try{await new wl(r).unzip(s=>{if(WM(e,s.filename),GM(n,s.filename),n.hasDocumentEntry&&(n.hasMasterSlideEntry||n.hasTablesEntry))return t=O1(n),{stop:!0};let a=s.filename==="[Content_Types].xml",l=P1(e);if(!a&&l)return t=l,{stop:!0};switch(s.filename){case"META-INF/mozilla.rsa":return t={ext:"xpi",mime:"application/x-xpinstall"},{stop:!0};case"META-INF/MANIFEST.MF":return t={ext:"jar",mime:"application/java-archive"},{stop:!0};case"mimetype":return M1(s,_1)?{async handler(c){let u=new TextDecoder("utf-8").decode(c).trim();t=F1(u)},stop:!0}:{};case"[Content_Types].xml":return e.hasContentTypesEntry=!0,M1(s,_1)?(e.isParsingContentTypes=!0,{async handler(c){let u=new TextDecoder("utf-8").decode(c),h=qM(u);h&&(t=F1(h)),e.hasParsedContentTypesEntry=!0,e.isParsingContentTypes=!1},stop:!0}):(e.hasUnparseableContentTypes=!0,{});default:return new RegExp("classes\\d*\\.dex","v").test(s.filename)?(t={ext:"apk",mime:"application/vnd.android.package-archive"},{stop:!0}):{}}})}catch(s){if(!zM(s))throw s;e.isParsingContentTypes&&(e.isParsingContentTypes=!1,e.hasUnparseableContentTypes=!0),!t&&s instanceof Qt&&!e.hasContentTypesEntry&&(t=R1(e))}let i=Je(r)&&n.hasDocumentEntry&&!n.hasMasterSlideEntry&&!n.hasTablesEntry&&!n.hasCalculationEngineEntry?void 0:O1(n);return t??P1(e)??i??{ext:"zip",mime:"application/zip"}}var Qs,k1,FM,_1,PM,RM,LM,L1,u0,VM,U1=ne(()=>{B();Ys();bf();Nx();Ru();Qs=1024*1024,k1=1024,FM=2**31-1,_1=Qs,PM=new Set(["Unexpected signature","Encrypted ZIP","Expected Central-File-Header signature"]),RM=["ZIP entry count exceeds ","Unsupported ZIP compression method:","ZIP entry compressed data exceeds ","ZIP entry decompressed data exceeds ","Expected data-descriptor-signature at position "],LM=new Set(["Z_BUF_ERROR","Z_DATA_ERROR","ERR_INVALID_STATE"]);L1=134695760,u0=16,VM=u0-1;wl.prototype.inflate=async function(r,t,e){if(r.compressedMethod===0)return e(t);if(r.compressedMethod!==8)throw new Error(`Unsupported ZIP compression method: ${r.compressedMethod}`);let n=await BM(t,{maximumLength:Qs});return e(n)};wl.prototype.unzip=async function(r){let t=!1,e=0,n=this.tokenizer.position;this.knownSizeDescriptorScannedBytes=0;do{if(Zs(this.tokenizer,n,16777216))throw new Di(`ZIP stream probing exceeds ${16777216} bytes`);let i=await this.readLocalFileHeader();if(!i)break;if(e++,e>k1)throw new Error(`ZIP entry count exceeds ${k1}`);let s=r(i);t=!!s.stop,await this.tokenizer.ignore(i.extraFieldLength);let a=await ZM(this,i,{shouldBuffer:!!s.handler,maximumDescriptorLength:Math.min(Qs,KM(this,n))});if(s.handler&&await this.inflate(i,a,s.handler),i.dataDescriptor){let l=new Uint8Array(u0);if(await this.tokenizer.readBuffer(l),Ne.get(l,0)!==L1)throw new Error(`Expected data-descriptor-signature at position ${this.tokenizer.position-l.length}`)}if(Zs(this.tokenizer,n,16777216))throw new Di(`ZIP stream probing exceeds ${16777216} bytes`)}while(!t)}});async function j1(r){async function t(){let l=await r.peekNumber(KE),c=128,u=0;for(;(l&c)===0&&c!==0;)++u,c>>=1;let h=new Uint8Array(u+1);return await wf(r,h,void 0,{maximumLength:h.length,reason:"EBML field"}),h}async function e(){let l=await t(),c=await t();c[0]^=128>>c.length-1;let u=Math.min(6,c.length),h=new DataView(l.buffer),d=new DataView(c.buffer,c.length-u,u);return{id:Ix(h),len:Ix(d)}}async function n(l){let c=0;for(;l>0;){if(c++,c>QM||Zs(r,s,16777216))return;let u=r.position,h=await e();if(h.id===17026){if(h.len>$1)return;let d=c0(h.len,$1,"EBML DocType");return(await r.readToken(new Vn(d))).replaceAll(new RegExp("\\0.*$","gv"),"")}if(Je(r)&&(!Number.isFinite(h.len)||h.len<0||h.len>z1)||(await Ni(r,h.len,{maximumLength:Je(r)?z1:r.fileInfo.size,reason:"EBML payload"}),--l,r.position<=u))return}}let i=await e(),s=r.position;switch(await n(i.len)){case"webm":return{ext:"webm",mime:"video/webm"};case"matroska":return{ext:"mkv",mime:"video/matroska"};default:}}var $1,z1,QM,G1=ne(()=>{B();Ys();kx();Ru();$1=64,z1=1024*1024,QM=256});function eO(r){return(r.codePointAt(0)&32)!==0}async function W1(r){let t={ext:"png",mime:"image/png"},e={ext:"apng",mime:"image/apng"};await r.ignore(8);async function n(){return{length:await r.readToken(ZE),type:await r.readToken(new Vn(4,"latin1"))}}let i=Je(r),s=r.position,a=0,l=!1;do{if(a++,a>JM||Zs(r,s,tO))break;let c=r.position,u=await n();if(u.length<0)return;if(u.type==="IHDR"){if(u.length!==13)return;l=!0}switch(u.type){case"IDAT":return t;case"acTL":return e;default:if(!l&&u.type!=="CgBI")return;if(i&&u.length>H1)return l&&eO(u.type)?t:void 0;try{await Ni(r,u.length+4,{maximumLength:i?H1+4:r.fileInfo.size,reason:"PNG chunk payload"})}catch(h){if(!i&&(h instanceof Di||h instanceof Qt))return t;throw h}}if(r.position<=c)break}while(r.position+8<r.fileInfo.size);return t}var JM,tO,H1,q1=ne(()=>{B();Ys();bf();Ru();JM=512,tO=16*1024*1024,H1=1024*1024});async function X1(r){let t=!1;try{async function e(){let a=new Uint8Array(16);return await wf(r,a,void 0,{maximumLength:a.length,reason:"ASF header GUID"}),{id:a,size:Number(await r.readToken(QE))}}await Ni(r,30,{maximumLength:30,reason:"ASF header prelude"});let n=Je(r),i=r.position,s=0;for(;r.position+24<r.fileInfo.size&&(s++,!(s>nO||Zs(r,i,16777216)));){let a=r.position,l=await e(),c=l.size-24;if(!Number.isFinite(c)||c<0){t=!0;break}if(cr(l.id,[145,7,220,183,183,169,207,17,142,230,0,192,12,32,83,101])){let u=new Uint8Array(16);if(c-=await wf(r,u,void 0,{maximumLength:u.length,reason:"ASF stream type GUID"}),cr(u,[64,158,105,248,77,91,207,17,168,253,0,128,95,92,68,43]))return{ext:"asf",mime:"audio/x-ms-asf"};if(cr(u,[192,239,25,188,77,91,207,17,168,253,0,128,95,92,68,43]))return{ext:"asf",mime:"video/x-ms-asf"};break}if(n&&c>V1){t=!0;break}if(await Ni(r,c,{maximumLength:n?V1:r.fileInfo.size,reason:"ASF header payload"}),r.position<=a){t=!0;break}}}catch(e){if(e instanceof Qt||e instanceof Di)Je(r)&&(t=!0);else throw e}if(!t)return{ext:"asf",mime:"application/vnd.ms-asf"}}var nO,V1,Y1=ne(()=>{B();Ys();bf();Ru();nO=512,V1=1024*1024});var nT={};lg(nT,{FileTypeParser:()=>Js,fileTypeFromBlob:()=>pO,fileTypeFromBuffer:()=>fO,fileTypeFromFile:()=>xO,fileTypeFromStream:()=>dO,fileTypeFromTokenizer:()=>mO,fileTypeStream:()=>gO,normalizeSampleSize:()=>eT,reasonableDetectionSizeInBytes:()=>Lu,supportedExtensions:()=>yO,supportedMimeTypes:()=>bO});function eT(r){return Number.isFinite(r)?Math.max(1,Math.trunc(r)):Lu}function lO(r){return Number.isFinite(r)?Math.max(0,Math.min(iO,Math.trunc(r))):0}function cO(r){return Number.isFinite(r)?Math.max(0,r):Number.MAX_SAFE_INTEGER}function J1(r){return import(/* @vite-ignore */ /* webpackIgnore: true */ r)}function uO(r){return r.pipeThrough(new TransformStream)}function tT(r,t){return t===void 0?r.read():(t.throwIfAborted(),Promise.race([r.read(),new Promise((e,n)=>{t.addEventListener("abort",()=>{n(t.reason),r.cancel(t.reason).catch(()=>{})},{once:!0})})]))}function hO(r,t){let e=r.getReader(),n=0,i=!1,s=!1,a=async l=>{i||s||(s=!0,await e.cancel(l))};return new ReadableStream({async pull(l){if(n>=t){l.close(),await a();return}let{done:c,value:u}=await e.read();if(c||!u){i=!0,l.close();return}let h=t-n;if(u.length>h){l.enqueue(u.subarray(0,h)),n+=h,l.close(),await a();return}l.enqueue(u),n+=u.length},async cancel(l){await a(l)}})}async function dO(r,t){return new Js(t).fromStream(r)}async function fO(r,t){return new Js(t).fromBuffer(r)}async function pO(r,t){return new Js(t).fromBlob(r)}async function mO(r,t){return new Js(t).fromTokenizer(r)}async function gO(r,t){return new Js(t).toDetectionStream(r,t)}async function xO(r,t){return new Js(t).fromFile(r)}var Lu,iO,rO,sO,K1,_x,aO,Z1,oO,Q1,Js,yO,bO,iT=ne(()=>{B();Ys();bf();Nx();kx();S1();I1();Ru();U1();G1();q1();Y1();Lu=4100,iO=Lu-2,rO=16777216,sO=1,K1=100,_x=16777216,aO=512,Z1=256,oO=1024*1024,Q1=16777216;Js=class r{constructor(t){U(this,"detectConfident",async t=>{if(this.buffer=new Uint8Array(Lu),t.fileInfo.size===void 0&&(t.fileInfo.size=Number.MAX_SAFE_INTEGER),this.tokenizer=t,Je(t)&&(await t.peekBuffer(this.buffer,{length:3,mayBeLess:!0}),this.check([31,139,8])))return this.detectGzip(t);if(await t.peekBuffer(this.buffer,{length:32,mayBeLess:!0}),this.check([66,77]))return{ext:"bmp",mime:"image/bmp"};if(this.check([11,119]))return{ext:"ac3",mime:"audio/vnd.dolby.dd-raw"};if(this.check([120,1]))return{ext:"dmg",mime:"application/x-apple-diskimage"};if(this.check([77,90]))return{ext:"exe",mime:"application/x-msdownload"};if(this.check([37,33]))return await t.peekBuffer(this.buffer,{length:24,mayBeLess:!0}),this.checkString("PS-Adobe-",{offset:2})&&this.checkString(" EPSF-",{offset:14})?{ext:"eps",mime:"application/eps"}:{ext:"ps",mime:"application/postscript"};if(this.check([31,160])||this.check([31,157]))return{ext:"Z",mime:"application/x-compress"};if(this.check([199,113]))return{ext:"cpio",mime:"application/x-cpio"};if(this.check([96,234]))return{ext:"arj",mime:"application/x-arj"};if(this.check([239,187,191]))return this.detectionReentryCount>=Z1?void 0:(this.detectionReentryCount++,await this.tokenizer.ignore(3),this.detectConfident(t));if(this.check([71,73,70]))return{ext:"gif",mime:"image/gif"};if(this.check([73,73,188]))return{ext:"jxr",mime:"image/vnd.ms-photo"};if(this.check([31,139,8]))return this.detectGzip(t);if(this.check([66,90,104]))return{ext:"bz2",mime:"application/x-bzip2"};if(this.checkString("ID3")){await Ni(t,6,{maximumLength:6,reason:"ID3 header prefix"});let e=await t.readToken(T1),n=Je(t);if(!Number.isFinite(e)||e<0||n&&(e>_x||t.position+e>_x))return;if(t.position+e>t.fileInfo.size)return n?void 0:{ext:"mp3",mime:"audio/mpeg"};try{await Ni(t,e,{maximumLength:n?_x:t.fileInfo.size,reason:"ID3 payload"})}catch(i){if(i instanceof Qt)return;throw i}return this.detectionReentryCount>=Z1?void 0:(this.detectionReentryCount++,this.parseTokenizer(t,this.detectionReentryCount))}if(this.checkString("MP+"))return{ext:"mpc",mime:"audio/x-musepack"};if((this.buffer[0]===67||this.buffer[0]===70)&&this.check([87,83],{offset:1}))return{ext:"swf",mime:"application/x-shockwave-flash"};if(this.check([255,216,255]))return this.check([247],{offset:3})?{ext:"jls",mime:"image/jls"}:{ext:"jpg",mime:"image/jpeg"};if(this.check([79,98,106,1]))return{ext:"avro",mime:"application/avro"};if(this.checkString("FLIF"))return{ext:"flif",mime:"image/flif"};if(this.checkString("8BPS"))return{ext:"psd",mime:"image/vnd.adobe.photoshop"};if(this.checkString("MPCK"))return{ext:"mpc",mime:"audio/x-musepack"};if(this.checkString("FORM"))return{ext:"aif",mime:"audio/aiff"};if(this.checkString("icns",{offset:0}))return{ext:"icns",mime:"image/icns"};if(this.check([80,75,3,4]))return B1(t);if(this.checkString("OggS")){await t.ignore(28);let e=new Uint8Array(8);return await t.readBuffer(e),cr(e,[79,112,117,115,72,101,97,100])?{ext:"opus",mime:"audio/ogg; codecs=opus"}:cr(e,[128,116,104,101,111,114,97])?{ext:"ogv",mime:"video/ogg"}:cr(e,[1,118,105,100,101,111,0])?{ext:"ogm",mime:"video/ogg"}:cr(e,[127,70,76,65,67])?{ext:"oga",mime:"audio/ogg"}:cr(e,[83,112,101,101,120,32,32])?{ext:"spx",mime:"audio/ogg"}:cr(e,[1,118,111,114,98,105,115])?{ext:"ogg",mime:"audio/ogg"}:{ext:"ogx",mime:"application/ogg"}}if(this.check([80,75])&&(this.buffer[2]===3||this.buffer[2]===5||this.buffer[2]===7)&&(this.buffer[3]===4||this.buffer[3]===6||this.buffer[3]===8))return{ext:"zip",mime:"application/zip"};if(this.checkString("MThd"))return{ext:"mid",mime:"audio/midi"};if(this.checkString("wOFF")&&(this.check([0,1,0,0],{offset:4})||this.checkString("OTTO",{offset:4})))return{ext:"woff",mime:"font/woff"};if(this.checkString("wOF2")&&(this.check([0,1,0,0],{offset:4})||this.checkString("OTTO",{offset:4})))return{ext:"woff2",mime:"font/woff2"};if(this.check([212,195,178,161])||this.check([161,178,195,212]))return{ext:"pcap",mime:"application/vnd.tcpdump.pcap"};if(this.checkString("DSD "))return{ext:"dsf",mime:"audio/x-dsf"};if(this.checkString("LZIP"))return{ext:"lz",mime:"application/lzip"};if(this.checkString("fLaC"))return{ext:"flac",mime:"audio/flac"};if(this.check([66,80,71,251]))return{ext:"bpg",mime:"image/bpg"};if(this.checkString("wvpk"))return{ext:"wv",mime:"audio/wavpack"};if(this.checkString("%PDF"))return{ext:"pdf",mime:"application/pdf"};if(this.check([0,97,115,109]))return{ext:"wasm",mime:"application/wasm"};if(this.check([73,73])){let e=await this.readTiffHeader(!1);if(e)return e}if(this.check([77,77])){let e=await this.readTiffHeader(!0);if(e)return e}if(this.checkString("MAC "))return{ext:"ape",mime:"audio/ape"};if(this.check([26,69,223,163]))return j1(t);if(this.checkString("SQLi"))return{ext:"sqlite",mime:"application/x-sqlite3"};if(this.check([78,69,83,26]))return{ext:"nes",mime:"application/x-nintendo-nes-rom"};if(this.checkString("Cr24"))return{ext:"crx",mime:"application/x-google-chrome-extension"};if(this.checkString("MSCF")||this.checkString("ISc("))return{ext:"cab",mime:"application/vnd.ms-cab-compressed"};if(this.check([237,171,238,219]))return{ext:"rpm",mime:"application/x-rpm"};if(this.check([197,208,211,198]))return{ext:"eps",mime:"application/eps"};if(this.check([40,181,47,253]))return{ext:"zst",mime:"application/zstd"};if(this.check([127,69,76,70]))return{ext:"elf",mime:"application/x-elf"};if(this.check([33,66,68,78]))return{ext:"pst",mime:"application/vnd.ms-outlook"};if(this.checkString("PAR1")||this.checkString("PARE"))return{ext:"parquet",mime:"application/vnd.apache.parquet"};if(this.checkString("ttcf"))return{ext:"ttc",mime:"font/collection"};if(this.check([254,237,250,206])||this.check([254,237,250,207])||this.check([206,250,237,254])||this.check([207,250,237,254]))return{ext:"macho",mime:"application/x-mach-binary"};if(this.check([4,34,77,24]))return{ext:"lz4",mime:"application/x-lz4"};if(this.checkString("regf"))return{ext:"dat",mime:"application/x-ft-windows-registry-hive"};if(this.checkString("$FL2")||this.checkString("$FL3"))return{ext:"sav",mime:"application/x-spss-sav"};if(this.check([79,84,84,79,0]))return{ext:"otf",mime:"font/otf"};if(this.checkString("#!AMR"))return{ext:"amr",mime:"audio/amr"};if(this.checkString(String.raw`{\rtf`))return{ext:"rtf",mime:"application/rtf"};if(this.check([70,76,86,1]))return{ext:"flv",mime:"video/x-flv"};if(this.checkString("IMPM"))return{ext:"it",mime:"audio/x-it"};if(this.checkString("-lh0-",{offset:2})||this.checkString("-lh1-",{offset:2})||this.checkString("-lh2-",{offset:2})||this.checkString("-lh3-",{offset:2})||this.checkString("-lh4-",{offset:2})||this.checkString("-lh5-",{offset:2})||this.checkString("-lh6-",{offset:2})||this.checkString("-lh7-",{offset:2})||this.checkString("-lzs-",{offset:2})||this.checkString("-lz4-",{offset:2})||this.checkString("-lz5-",{offset:2})||this.checkString("-lhd-",{offset:2}))return{ext:"lzh",mime:"application/x-lzh-compressed"};if(this.check([0,0,1,186])){if(this.check([33],{offset:4,mask:[241]}))return{ext:"mpg",mime:"video/MP1S"};if(this.check([68],{offset:4,mask:[196]}))return{ext:"mpg",mime:"video/MP2P"}}if(this.checkString("ITSF"))return{ext:"chm",mime:"application/vnd.ms-htmlhelp"};if(this.check([202,254,186,190])){let e=vx.get(this.buffer,4),n=pl.get(this.buffer,6);if(e>0&&e<=30)return{ext:"macho",mime:"application/x-mach-binary"};if(n>30)return{ext:"class",mime:"application/java-vm"}}if(this.checkString(".RMF"))return{ext:"rm",mime:"application/vnd.rn-realmedia"};if(this.checkString("DRACO"))return{ext:"drc",mime:"application/x-ft-draco"};if(this.check([253,55,122,88,90,0]))return{ext:"xz",mime:"application/x-xz"};if(this.checkString("<?xml "))return{ext:"xml",mime:"application/xml"};if(this.check([55,122,188,175,39,28]))return{ext:"7z",mime:"application/x-7z-compressed"};if(this.check([82,97,114,33,26,7])&&(this.buffer[6]===0||this.buffer[6]===1))return{ext:"rar",mime:"application/x-rar-compressed"};if(this.checkString("solid "))return{ext:"stl",mime:"model/stl"};if(this.checkString("AC")){let e=new Vn(4,"latin1").get(this.buffer,2);if(new RegExp("^\\d+$","v").test(e)&&e>=1e3&&e<=1050)return{ext:"dwg",mime:"image/vnd.dwg"}}if(this.checkString("070707"))return{ext:"cpio",mime:"application/x-cpio"};if(this.checkString("BLENDER"))return{ext:"blend",mime:"application/x-blender"};if(this.checkString("!<arch>"))return await t.ignore(8),await t.readToken(new Vn(13,"ascii"))==="debian-binary"?{ext:"deb",mime:"application/x-deb"}:{ext:"ar",mime:"application/x-unix-archive"};if(this.checkString("WEBVTT")&&[`
|
|
12
|
-
`,"\r"," "," ","\0"].some(e=>this.checkString(e,{offset:6})))return{ext:"vtt",mime:"text/vtt"};if(this.check([137,80,78,71,13,10,26,10]))return
|
|
13
|
-
`))return{ext:"reg",mime:"application/x-ms-regedit"};if(this.check([82,73,70,70])){if(this.checkString("WEBP",{offset:8}))return{ext:"webp",mime:"image/webp"};if(this.check([65,86,73],{offset:8}))return{ext:"avi",mime:"video/vnd.avi"};if(this.check([87,65,86,69],{offset:8}))return{ext:"wav",mime:"audio/wav"};if(this.check([81,76,67,77],{offset:8}))return{ext:"qcp",mime:"audio/qcelp"}}if(this.check([73,73,85,0,24,0,0,0,136,231,116,216]))return{ext:"rw2",mime:"image/x-panasonic-rw2"};if(this.check([48,38,178,117,142,102,207,17,166,217]))return
|
|
14
|
-
`,{offset:2,encoding:e})?{ext:"reg",mime:"application/x-ms-regedit"}:void 0}if(this.checkString("-----BEGIN PGP MESSAGE-----"))return{ext:"pgp",mime:"application/pgp-encrypted"}});U(this,"detectImprecise",async t=>{this.buffer=new Uint8Array(Lu);let e=cO(t.fileInfo.size);if(await t.peekBuffer(this.buffer,{length:Math.min(8,e),mayBeLess:!0}),this.check([0,0,1,186])||this.check([0,0,1,179]))return{ext:"mpg",mime:"video/mpeg"};if(this.check([0,1,0,0,0]))return{ext:"ttf",mime:"font/ttf"};if(this.check([0,0,1,0]))return{ext:"ico",mime:"image/x-icon"};if(this.check([0,0,2,0]))return{ext:"cur",mime:"image/x-icon"};if(await t.peekBuffer(this.buffer,{length:Math.min(2+this.options.mpegOffsetTolerance,e),mayBeLess:!0}),this.buffer.length>=2+this.options.mpegOffsetTolerance)for(let n=0;n<=this.options.mpegOffsetTolerance;++n){let i=this.scanMpeg(n);if(i)return i}});let e=lO(t?.mpegOffsetTolerance);this.options={...t,mpegOffsetTolerance:e},this.detectors=[...this.options.customDetectors??[],{id:"core",detect:this.detectConfident},{id:"core.imprecise",detect:this.detectImprecise}],this.tokenizerOptions={abortSignal:this.options.signal},this.gzipProbeDepth=0}getTokenizerOptions(){return{...this.tokenizerOptions}}createTokenizerFromWebStream(t){return a1(uO(t),this.getTokenizerOptions())}async parseTokenizer(t,e=0){this.detectionReentryCount=e;let n=t.position;for(let i of this.detectors){let s;try{s=await i.detect(t)}catch(a){if(a instanceof Qt||a instanceof Di)return;throw a}if(s)return s;if(n!==t.position)return}}async fromTokenizer(t){try{return await this.parseTokenizer(t)}finally{await t.close()}}async fromBuffer(t){if(!(t instanceof Uint8Array||t instanceof ArrayBuffer))throw new TypeError(`Expected the \`input\` argument to be of type \`Uint8Array\` or \`ArrayBuffer\`, got \`${typeof t}\``);let e=t instanceof Uint8Array?t:new Uint8Array(t);if(e?.length>1)return this.fromTokenizer(o1(e,this.getTokenizerOptions()))}async fromBlob(t){this.options.signal?.throwIfAborted();let e=l1(t,this.getTokenizerOptions());return this.fromTokenizer(e)}async fromStream(t){this.options.signal?.throwIfAborted();let e=this.createTokenizerFromWebStream(t);return this.fromTokenizer(e)}async fromFile(t){this.options.signal?.throwIfAborted();let[{default:e},{FileTokenizer:n}]=await Promise.all([J1("node:fs/promises"),J1("strtok3")]),i=await e.open(t,e.constants.O_RDONLY|e.constants.O_NONBLOCK),s=await i.stat();if(!s.isFile()){await i.close();return}let a=new n(i,{...this.getTokenizerOptions(),fileInfo:{path:t,size:s.size}});return this.fromTokenizer(a)}async toDetectionStream(t,e){this.options.signal?.throwIfAborted();let n=eT(e?.sampleSize??Lu),i,s=!1,a=t.getReader(),l=[],c=0;try{for(;c<n;){let{value:d,done:f}=await tT(a,this.options.signal);if(f||!d){s=!0;break}l.push(d),c+=d.length}if(!s&&c===n){let{value:d,done:f}=await tT(a,this.options.signal);f||!d?s=!0:(l.push(d),c+=d.length)}}finally{a.releaseLock()}if(c>0){let d=l.length===1?l[0]:v1(l);try{i=await this.fromBuffer(d.subarray(0,n))}catch(f){if(!(f instanceof Qt))throw f;i=void 0}!s&&i?.ext==="pages"&&(i={ext:"zip",mime:"application/zip"})}let u=new TransformStream({start(d){for(let f of l)d.enqueue(f)},transform(d,f){f.enqueue(d)}}),h=t.pipeThrough(u);return h.fileType=i,h}async detectGzip(t){if(this.gzipProbeDepth>=sO)return{ext:"gz",mime:"application/gzip"};let e=new xf(t),n=hO(e.inflate(),rO),i=Je(t),s,a,l,c;if(i){let u=new AbortController;s=setTimeout(()=>{u.abort(new DOMException(`Operation timed out after ${K1} ms`,"TimeoutError"))},K1),a=this.options.signal===void 0?u.signal:AbortSignal.any([this.options.signal,u.signal]),l=new r({...this.options,signal:a}),l.gzipProbeDepth=this.gzipProbeDepth+1}else this.gzipProbeDepth++;try{c=await(l??this).fromStream(n)}catch(u){if(u?.name==="AbortError"&&a?.reason?.name!=="TimeoutError")throw u}finally{clearTimeout(s),i||this.gzipProbeDepth--}return c?.ext==="tar"?{ext:"tar.gz",mime:"application/gzip"}:{ext:"gz",mime:"application/gzip"}}check(t,e){return cr(this.buffer,t,e)}checkString(t,e){return this.check(C1(t,e?.encoding),e)}async readTiffTag(t){let e=await this.tokenizer.readToken(t?pl:Fe);switch(await this.tokenizer.ignore(10),e){case 50341:return{ext:"arw",mime:"image/x-sony-arw"};case 50706:return{ext:"dng",mime:"image/x-adobe-dng"};default:}}async readTiffIFD(t){let e=await this.tokenizer.readToken(t?pl:Fe);if(!(e>aO)&&!(Je(this.tokenizer)&&2+e*12>Q1))for(let n=0;n<e;++n){let i=await this.readTiffTag(t);if(i)return i}}async readTiffHeader(t){let e={ext:"tif",mime:"image/tiff"},n=(t?pl:Fe).get(this.buffer,2),i=(t?vx:Ne).get(this.buffer,4);if(n===42){if(i>=6){if(this.checkString("CR",{offset:8}))return{ext:"cr2",mime:"image/x-canon-cr2"};if(i>=8){let l=(t?pl:Fe).get(this.buffer,8),c=(t?pl:Fe).get(this.buffer,10);if(l===28&&c===254||l===31&&c===11)return{ext:"nef",mime:"image/x-nikon-nef"}}}if(Je(this.tokenizer)&&i>oO)return e;let s=Je(this.tokenizer)?Q1:this.tokenizer.fileInfo.size;try{await Ni(this.tokenizer,i,{maximumLength:s,reason:"TIFF IFD offset"})}catch(l){if(l instanceof Qt)return;throw l}let a;try{a=await this.readTiffIFD(t)}catch(l){if(l instanceof Qt)return;throw l}return a??e}if(n===43)return e}scanMpeg(t){if(this.check([255,224],{offset:t,mask:[255,224]})){if(this.check([16],{offset:t+1,mask:[22]}))return this.check([8],{offset:t+1,mask:[8]})?{ext:"aac",mime:"audio/aac"}:{ext:"aac",mime:"audio/aac"};if(this.check([2],{offset:t+1,mask:[6]}))return{ext:"mp3",mime:"audio/mpeg"};if(this.check([4],{offset:t+1,mask:[6]}))return{ext:"mp2",mime:"audio/mpeg"};if(this.check([6],{offset:t+1,mask:[6]}))return{ext:"mp1",mime:"audio/mpeg"}}}},yO=new Set(D1),bO=new Set(N1)});var $D={};lg($D,{AbortException:()=>Qr,AnnotationEditorLayer:()=>Fy,AnnotationEditorParamsType:()=>Zt,AnnotationEditorType:()=>Bt,AnnotationEditorUIManager:()=>nl,AnnotationLayer:()=>Dy,AnnotationMode:()=>Ba,AnnotationType:()=>tn,CSSConstants:()=>cy,ColorPicker:()=>lp,DOMSVGFactory:()=>Zc,DrawLayer:()=>Py,FeatureTest:()=>Xe,GlobalWorkerOptions:()=>Tr,ImageKind:()=>Vf,InvalidPDFException:()=>Id,MathClamp:()=>yn,OPS:()=>Nd,OutputScale:()=>Ls,PDFDataRangeTransport:()=>op,PDFDateString:()=>Xc,PDFWorker:()=>Pd,PasswordResponses:()=>IT,PermissionFlag:()=>NT,PixelsPerInch:()=>ja,RenderingCancelledException:()=>kd,ResponseException:()=>Yc,SignatureExtractor:()=>Sr,SupportedImageMimeTypes:()=>ly,TextLayer:()=>Fd,TextLayerImages:()=>Ry,TouchManager:()=>ip,Util:()=>yt,VerbosityLevel:()=>sg,XfaLayer:()=>ep,applyOpacity:()=>FT,build:()=>qS,createValidAbsoluteUrl:()=>mA,fetchData:()=>hb,findContrastColor:()=>PT,getDocument:()=>jS,getFilenameFromUrl:()=>_T,getPdfFilenameFromUrl:()=>MT,getRGB:()=>Bd,getUuid:()=>yA,getXfaPageViewport:()=>OT,isDataScheme:()=>ag,isPdfFile:()=>db,isValidExplicitDest:()=>gS,makeArr:()=>cb,makeMap:()=>ub,makeObj:()=>ay,noContextMenu:()=>tr,normalizeUnicode:()=>kT,renderRichText:()=>bA,setLayerDimensions:()=>el,shadow:()=>Ut,stopEvent:()=>Be,updateUrlHash:()=>gA,version:()=>WS});function AO(r){Number.isInteger(r)&&(ab=r)}function vO(){return ab}function ob(r){ab>=sg.INFOS&&console.info(`Info: ${r}`)}function jt(r){ab>=sg.WARNINGS&&console.warn(`Warning: ${r}`)}function ue(r){throw new Error(r)}function Ue(r,t){r||ue(t)}function CO(r){switch(r?.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":return!0;default:return!1}}function mA(r,t=null,e=null){if(!r)return null;if(e&&typeof r=="string"&&(e.addDefaultProtocol&&r.startsWith("www.")&&r.match(/\./g)?.length>=2&&(r=`http://${r}`),e.tryConvertEncoding))try{r=NO(r)}catch{}let n=t?URL.parse(r,t):URL.parse(r);return CO(n)?n:null}function gA(r,t,e=!1){let n=URL.parse(r);return n?(n.hash=t,n.href):e&&mA(r,"http://example.com")?r.split("#",1)[0]+`${t?`#${t}`:""}`:""}function Bx(r){return r.substring(r.lastIndexOf("/")+1)}function Ut(r,t,e,n=!1){return Object.defineProperty(r,t,{value:e,enumerable:!n,configurable:!0,writable:!1}),e}function EO(r){(typeof r!="object"||r?.length===void 0)&&ue("Invalid argument for bytesToString");let t=r.length,e=8192;if(t<e)return String.fromCharCode.apply(null,r);let n=[];for(let i=0;i<t;i+=e){let s=Math.min(i+e,t),a=r.subarray(i,s);n.push(String.fromCharCode.apply(null,a))}return n.join("")}function lb(r){typeof r!="string"&&ue("Invalid argument for stringToBytes");let t=r.length,e=new Uint8Array(t);for(let n=0;n<t;++n)e[n]=r.charCodeAt(n)&255;return e}function TO(r){return String.fromCharCode(r>>24&255,r>>16&255,r>>8&255,r&255)}function SO(){let r=new Uint8Array(4);return r[0]=1,new Uint32Array(r.buffer,0,1)[0]===1}function DO(){try{return new Function(""),!0}catch{return!1}}function NO(r){return decodeURIComponent(escape(r))}function kT(r){return Ox||(Ox=/([\u00a0\u00b5\u037e\u0eb3\u2000-\u200a\u202f\u2126\ufb00-\ufb04\ufb06\ufb20-\ufb36\ufb38-\ufb3c\ufb3e\ufb40-\ufb41\ufb43-\ufb44\ufb46-\ufba1\ufba4-\ufba9\ufbae-\ufbb1\ufbd3-\ufbdc\ufbde-\ufbe7\ufbea-\ufbf8\ufbfc-\ufbfd\ufc00-\ufc5d\ufc64-\ufcf1\ufcf5-\ufd3d\ufd88\ufdf4\ufdfa-\ufdfb\ufe71\ufe77\ufe79\ufe7b\ufe7d]+)|(\ufb05+)/gu,rT=new Map([["\uFB05","\u017Ft"]])),r.replaceAll(Ox,(t,e,n)=>e?e.normalize("NFKC"):rT.get(n))}function yA(){if(typeof crypto.randomUUID=="function")return crypto.randomUUID();let r=new Uint8Array(32);return crypto.getRandomValues(r),EO(r)}function IO(r,t,e){if(!Array.isArray(e)||e.length<2)return!1;let[n,i,...s]=e;if(!r(n)&&!Number.isInteger(n)||!t(i))return!1;let a=s.length,l=!0;switch(i.name){case"XYZ":if(a<2||a>3)return!1;break;case"Fit":case"FitB":return a===0;case"FitH":case"FitBH":case"FitV":case"FitBV":if(a>1)return!1;break;case"FitR":if(a!==4)return!1;l=!1;break;default:return!1}for(let c of s)if(!(typeof c=="number"||l&&c===null))return!1;return!0}function yn(r,t,e){return Math.min(Math.max(r,t),e)}async function hb(r,t="text"){if(Yf(r,document.baseURI)){let e=await fetch(r);if(!e.ok)throw new Error(e.statusText);switch(t){case"blob":return e.blob();case"bytes":return e.bytes();case"json":return e.json()}return e.text()}return new Promise((e,n)=>{let i=new XMLHttpRequest;i.open("GET",r,!0),i.responseType=t==="bytes"?"arraybuffer":t,i.onreadystatechange=()=>{if(i.readyState===XMLHttpRequest.DONE){if(i.status===200||i.status===0){switch(t){case"bytes":e(new Uint8Array(i.response));return;case"blob":case"json":e(i.response);return}e(i.responseText);return}n(new Error(i.statusText))}},i.send(null)})}function ag(r){let t=r.length,e=0;for(;e<t&&r[e].trim()==="";)e++;return r.substring(e,e+5).toLowerCase()==="data:"}function db(r){return typeof r=="string"&&/\.pdf$/i.test(r)}function _T(r){return[r]=r.split(/[#?]/,1),Bx(r)}function MT(r,t="document.pdf"){if(typeof r!="string")return t;if(ag(r))return jt('getPdfFilenameFromUrl: ignore "data:"-URL for performance reasons.'),t;let n=(l=>{try{return new URL(l)}catch{try{return new URL(decodeURIComponent(l))}catch{try{return new URL(l,"https://foo.bar")}catch{try{return new URL(decodeURIComponent(l),"https://foo.bar")}catch{return null}}}}})(r);if(!n)return t;let i=l=>{try{let c=decodeURIComponent(l);return c.includes("/")&&(c=Bx(c),/^\.pdf$/i.test(c))?l:c}catch{return l}},s=/\.pdf$/i,a=Bx(n.pathname);if(s.test(a))return i(a);if(n.searchParams.size>0){let l=u=>[...u].findLast(h=>s.test(h)),c=l(n.searchParams.values())??l(n.searchParams.keys());if(c)return i(c)}if(n.hash){let c=/[^/?#=]+\.pdf\b(?!.*\.pdf\b)/i.exec(n.hash);if(c)return i(c[0])}return t}function Yf(r,t){let e=t?URL.parse(r,t):URL.parse(r);return/https?:/.test(e?.protocol??"")}function tr(r){r.preventDefault()}function Be(r){r.preventDefault(),r.stopPropagation()}function kO(r){console.log("Deprecated API usage: "+r)}function OT(r,{scale:t=1,rotation:e=0}){let{width:n,height:i}=r.attributes.style,s=[0,0,parseInt(n),parseInt(i)];return new np({viewBox:s,userUnit:1,scale:t,rotation:e})}function Bd(r){if(r.startsWith("#")){let t=parseInt(r.slice(1),16);return[(t&16711680)>>16,(t&65280)>>8,t&255]}return r.startsWith("rgb(")?r.slice(4,-1).split(",").map(t=>parseInt(t)):r.startsWith("rgba(")?r.slice(5,-1).split(",",3).map(t=>parseInt(t)):(jt(`Not a valid color format: "${r}"`),[0,0,0])}function _O(r){let t=document.createElement("span");t.style.visibility="hidden",t.style.colorScheme="only light",document.body.append(t);for(let e of r.keys()){t.style.color=e;let n=window.getComputedStyle(t).color;r.set(e,Bd(n))}t.remove()}function Le(r){let{a:t,b:e,c:n,d:i,e:s,f:a}=r.getTransform();return[t,e,n,i,s,a]}function hs(r){let{a:t,b:e,c:n,d:i,e:s,f:a}=r.getTransform().invertSelf();return[t,e,n,i,s,a]}function el(r,t,e=!1,n=!0){if(t instanceof np){let{pageWidth:i,pageHeight:s}=t.rawDims,{style:a}=r,l=Xe.isCSSRoundSupported,c=`var(--total-scale-factor) * ${i}px`,u=`var(--total-scale-factor) * ${s}px`,h=l?`round(down, ${c}, var(--scale-round-x))`:`calc(${c})`,d=l?`round(down, ${u}, var(--scale-round-y))`:`calc(${u})`;!e||t.rotation%180===0?(a.width=h,a.height=d):(a.width=d,a.height=h)}n&&r.setAttribute("data-main-rotation",t.rotation)}function FT(r,t){t=yn(t??1,0,1);let e=255*(1-t);return r.map(n=>Math.round(n*t+e))}function sT(r,t){let e=r[0]/255,n=r[1]/255,i=r[2]/255,s=Math.max(e,n,i),a=Math.min(e,n,i),l=(s+a)/2;if(s===a)t[0]=t[1]=0;else{let c=s-a;switch(t[1]=l<.5?c/(s+a):c/(2-s-a),s){case e:t[0]=((n-i)/c+(n<i?6:0))*60;break;case n:t[0]=((i-e)/c+2)*60;break;case i:t[0]=((e-n)/c+4)*60;break}}t[2]=l}function jx(r,t){let e=r[0],n=r[1],i=r[2],s=(1-Math.abs(2*i-1))*n,a=s*(1-Math.abs(e/60%2-1)),l=i-s/2;switch(Math.floor(e/60)){case 0:t[0]=s+l,t[1]=a+l,t[2]=l;break;case 1:t[0]=a+l,t[1]=s+l,t[2]=l;break;case 2:t[0]=l,t[1]=s+l,t[2]=a+l;break;case 3:t[0]=l,t[1]=a+l,t[2]=s+l;break;case 4:t[0]=a+l,t[1]=l,t[2]=s+l;break;case 5:case 6:t[0]=s+l,t[1]=l,t[2]=a+l;break}}function aT(r){return r<=.03928?r/12.92:((r+.055)/1.055)**2.4}function oT(r,t,e){jx(r,e),e.map(aT);let n=.2126*e[0]+.7152*e[1]+.0722*e[2];jx(t,e),e.map(aT);let i=.2126*e[0]+.7152*e[1]+.0722*e[2];return n>i?(n+.05)/(i+.05):(i+.05)/(n+.05)}function PT(r,t){let e=r[0]+r[1]*256+r[2]*65536+t[0]*16777216+t[1]*4294967296+t[2]*1099511627776,n=lT.get(e);if(n)return n;let i=new Float32Array(9),s=i.subarray(0,3),a=i.subarray(3,6);sT(r,a);let l=i.subarray(6,9);sT(t,l);let c=l[2]<.5,u=c?12:4.5;if(a[2]=c?Math.sqrt(a[2]):1-Math.sqrt(1-a[2]),oT(a,l,s)<u){let h,d;c?(h=a[2],d=1):(h=0,d=a[2]);let f=.005;for(;d-h>f;){let p=a[2]=(h+d)/2;c===oT(a,l,s)<u?h=p:d=p}a[2]=c?d:h}return jx(a,s),n=yt.makeHexColor(Math.round(s[0]*255),Math.round(s[1]*255),Math.round(s[2]*255)),lT.set(e,n),n}function bA({html:r,dir:t,className:e},n){let i=document.createDocumentFragment();if(typeof r=="string"){let s=document.createElement("p");s.dir=t||"auto";let a=r.split(/(?:\r\n?|\n)/);for(let l=0,c=a.length;l<c;++l){let u=a[l];s.append(document.createTextNode(u)),l<c-1&&s.append(document.createElement("br"))}i.append(s)}else ep.render({xfaHtml:r,div:i,intent:"richText"});i.firstElementChild.classList.add("richText",e),n.append(i)}function RT(r){let t=new Path2D;if(!r)return t;for(let e=0,n=r.length;e<n;)switch(r[e++]){case Af.moveTo:t.moveTo(r[e++],r[e++]);break;case Af.lineTo:t.lineTo(r[e++],r[e++]);break;case Af.curveTo:t.bezierCurveTo(r[e++],r[e++],r[e++],r[e++],r[e++],r[e++]);break;case Af.quadraticCurveTo:t.quadraticCurveTo(r[e++],r[e++],r[e++],r[e++]);break;case Af.closePath:t.closePath();break;default:jt(`Unrecognized drawing path operator: ${r[e-1]}`);break}return t}function jT(r,t,e){for(let n of e)t.addEventListener(n,r[n].bind(r))}function dT(r,t,e,n,i,s){r[t*4+0]=Math.min(r[t*4+0],e),r[t*4+1]=Math.min(r[t*4+1],n),r[t*4+2]=Math.max(r[t*4+2],i),r[t*4+3]=Math.max(r[t*4+3],s)}function MO(r){if(r instanceof URL)return r;if(typeof r=="string"){if(Ki){if(/^[a-z][a-z0-9\-+.]+:/i.test(r))return new URL(r);let e=nt.default.getBuiltinModule("url");return new URL(e.pathToFileURL(r))}let t=URL.parse(r,window.location);if(t)return t}throw new Error("Invalid PDF url data: either string or URL-object is expected in the url property.")}function OO(r){if(Ki&&typeof ct.Buffer<"u"&&r instanceof ct.Buffer)throw new Error("Please provide binary data as `Uint8Array`, rather than `Buffer`.");if(r instanceof Uint8Array&&r.byteLength===r.buffer.byteLength)return r;if(typeof r=="string")return lb(r);if(r instanceof ArrayBuffer||ArrayBuffer.isView(r)||typeof r=="object"&&!isNaN(r?.length))return new Uint8Array(r);throw new Error("Invalid PDF binary data: either TypedArray, string, or array-like object is expected in the data property.")}function h0(r){if(typeof r!="string")return null;if(r.endsWith("/"))return r;throw new Error(`Invalid factory url: "${r}" must include trailing slash.`)}function pT(){}function xi(r){if(r instanceof Qr||r instanceof Id||r instanceof sy||r instanceof Yc||r instanceof Xf)return r;switch(r instanceof Error||typeof r=="object"&&r!==null||ue('wrapReason: Expected "reason" to be a (possibly cloned) Error.'),r.name){case"AbortException":return new Qr(r.message);case"InvalidPDFException":return new Id(r.message);case"PasswordException":return new sy(r.message,r.code);case"ResponseException":return new Yc(r.message,r.status,r.missing);case"UnknownErrorException":return new Xf(r.message,r.details)}return new Xf(r.message,r.toString())}async function PO(r){let e=await nt.default.getBuiltinModule("fs").promises.readFile(r);return new Uint8Array(e)}function LO(){xA.init()}function BO(){return xA.isReady}function UO(r,t,e,n,i,s){return xA.draw(r,t,e,n,i,s)}function O0(r,t){if(!t)return;let e=t[2]-t[0],n=t[3]-t[1],i=new Path2D;i.rect(t[0],t[1],e,n),r.clip(i)}function Fx(r,t,e,n,i,s,a,l){let c=t.coords,u=t.colors,h=r.data,d=r.width*4,f;c[e*2+1]>c[n*2+1]&&(f=e,e=n,n=f,f=s,s=a,a=f),c[n*2+1]>c[i*2+1]&&(f=n,n=i,i=f,f=a,a=l,l=f),c[e*2+1]>c[n*2+1]&&(f=e,e=n,n=f,f=s,s=a,a=f);let p=(c[e*2]+t.offsetX)*t.scaleX,m=(c[e*2+1]+t.offsetY)*t.scaleY,y=(c[n*2]+t.offsetX)*t.scaleX,x=(c[n*2+1]+t.offsetY)*t.scaleY,b=(c[i*2]+t.offsetX)*t.scaleX,w=(c[i*2+1]+t.offsetY)*t.scaleY;if(m>=w)return;let C=u[s*4],E=u[s*4+1],S=u[s*4+2],N=u[a*4],k=u[a*4+1],M=u[a*4+2],R=u[l*4],j=u[l*4+1],$=u[l*4+2],q=Math.round(m),Q=Math.round(w),Z,Y,X,T,I,_,W,z;for(let D=q;D<=Q;D++){if(D<x){let V=D<m?0:(m-D)/(m-x);Z=p-(p-y)*V,Y=C-(C-N)*V,X=E-(E-k)*V,T=S-(S-M)*V}else{let V;D>w?V=1:x===w?V=0:V=(x-D)/(x-w),Z=y-(y-b)*V,Y=N-(N-R)*V,X=k-(k-j)*V,T=M-(M-$)*V}let F;D<m?F=0:D>w?F=1:F=(m-D)/(m-w),I=p-(p-b)*F,_=C-(C-R)*F,W=E-(E-j)*F,z=S-(S-$)*F;let P=Math.round(Math.min(Z,I)),G=Math.round(Math.max(Z,I)),H=d*D+P*4;for(let V=P;V<=G;V++)F=(Z-V)/(Z-I),F<0?F=0:F>1&&(F=1),h[H++]=Y-(Y-_)*F|0,h[H++]=X-(X-W)*F|0,h[H++]=T-(T-z)*F|0,h[H++]=255}}function $O(r,t,e){let n=t.coords,i=t.colors,s,a;switch(t.type){case Dl.LATTICE:let l=t.verticesPerRow,c=Math.floor(n.length/l)-1,u=l-1;for(s=0;s<c;s++){let h=s*l;for(let d=0;d<u;d++,h++)Fx(r,e,n[h],n[h+1],n[h+l],i[h],i[h+1],i[h+l]),Fx(r,e,n[h+l+1],n[h+1],n[h+l],i[h+l+1],i[h+1],i[h+l])}break;case Dl.TRIANGLES:for(s=0,a=n.length;s<a;s+=3)Fx(r,e,n[s],n[s+1],n[s+2],i[s],i[s+1],i[s+2]);break;default:throw new Error("illegal figure")}}function zO(r){switch(r[0]){case"RadialAxial":return new Ow(r);case"Mesh":return new Fw(r);case"Dummy":return new Pw}throw new Error(`Unknown IR type: ${r[0]}`)}function jO({src:r,srcPos:t=0,dest:e,width:n,height:i,nonBlackColor:s=4294967295,inverseDecode:a=!1}){let l=Xe.isLittleEndian?4278190080:255,[c,u]=a?[s,l]:[l,s],h=n>>3,d=n&7,f=c^u,p=r.length;e=new Uint32Array(e.buffer);let m=0;for(let y=0;y<i;++y){for(let b=t+h;t<b;++t,m+=8){let w=r[t];e[m]=c^-(w>>7&1)&f,e[m+1]=c^-(w>>6&1)&f,e[m+2]=c^-(w>>5&1)&f,e[m+3]=c^-(w>>4&1)&f,e[m+4]=c^-(w>>3&1)&f,e[m+5]=c^-(w>>2&1)&f,e[m+6]=c^-(w>>1&1)&f,e[m+7]=c^-(w&1)&f}if(d===0)continue;let x=t<p?r[t++]:255;for(let b=0;b<d;++b,++m)e[m]=c^-(x>>7-b&1)&f}return{srcPos:t,destPos:m}}function HO(r,t){if(r._removeMirroring)throw new Error("Context is already forwarding operations.");r.__originalSave=r.save,r.__originalRestore=r.restore,r.__originalRotate=r.rotate,r.__originalScale=r.scale,r.__originalTranslate=r.translate,r.__originalTransform=r.transform,r.__originalSetTransform=r.setTransform,r.__originalResetTransform=r.resetTransform,r.__originalClip=r.clip,r.__originalMoveTo=r.moveTo,r.__originalLineTo=r.lineTo,r.__originalBezierCurveTo=r.bezierCurveTo,r.__originalRect=r.rect,r.__originalClosePath=r.closePath,r.__originalBeginPath=r.beginPath,r._removeMirroring=()=>{r.save=r.__originalSave,r.restore=r.__originalRestore,r.rotate=r.__originalRotate,r.scale=r.__originalScale,r.translate=r.__originalTranslate,r.transform=r.__originalTransform,r.setTransform=r.__originalSetTransform,r.resetTransform=r.__originalResetTransform,r.clip=r.__originalClip,r.moveTo=r.__originalMoveTo,r.lineTo=r.__originalLineTo,r.bezierCurveTo=r.__originalBezierCurveTo,r.rect=r.__originalRect,r.closePath=r.__originalClosePath,r.beginPath=r.__originalBeginPath,delete r._removeMirroring},r.save=function(){t.save(),this.__originalSave()},r.restore=function(){t.restore(),this.__originalRestore()},r.translate=function(e,n){t.translate(e,n),this.__originalTranslate(e,n)},r.scale=function(e,n){t.scale(e,n),this.__originalScale(e,n)},r.transform=function(e,n,i,s,a,l){t.transform(e,n,i,s,a,l),this.__originalTransform(e,n,i,s,a,l)},r.setTransform=function(e,n,i,s,a,l){t.setTransform(e,n,i,s,a,l),this.__originalSetTransform(e,n,i,s,a,l)},r.resetTransform=function(){t.resetTransform(),this.__originalResetTransform()},r.rotate=function(e){t.rotate(e),this.__originalRotate(e)},r.clip=function(e){t.clip(e),this.__originalClip(e)},r.moveTo=function(e,n){t.moveTo(e,n),this.__originalMoveTo(e,n)},r.lineTo=function(e,n){t.lineTo(e,n),this.__originalLineTo(e,n)},r.bezierCurveTo=function(e,n,i,s,a,l){t.bezierCurveTo(e,n,i,s,a,l),this.__originalBezierCurveTo(e,n,i,s,a,l)},r.rect=function(e,n,i,s){t.rect(e,n,i,s),this.__originalRect(e,n,i,s)},r.closePath=function(){t.closePath(),this.__originalClosePath()},r.beginPath=function(){t.beginPath(),this.__originalBeginPath()}}function f0(r,t,e,n,i,s,a,l,c,u){let[h,d,f,p,m,y]=Le(r);if(d===0&&f===0){let w=a*h+m,C=Math.round(w),E=l*p+y,S=Math.round(E),N=(a+c)*h+m,k=Math.abs(Math.round(N)-C)||1,M=(l+u)*p+y,R=Math.abs(Math.round(M)-S)||1;return r.setTransform(Math.sign(h),0,0,Math.sign(p),C,S),r.drawImage(t,e,n,i,s,0,0,k,R),r.setTransform(h,d,f,p,m,y),[k,R]}if(h===0&&p===0){let w=l*f+m,C=Math.round(w),E=a*d+y,S=Math.round(E),N=(l+u)*f+m,k=Math.abs(Math.round(N)-C)||1,M=(a+c)*d+y,R=Math.abs(Math.round(M)-S)||1;return r.setTransform(0,Math.sign(d),Math.sign(f),0,C,S),r.drawImage(t,e,n,i,s,0,0,R,k),r.setTransform(h,d,f,p,m,y),[R,k]}r.drawImage(t,e,n,i,s,a,l,c,u);let x=Math.hypot(h,d),b=Math.hypot(f,p);return[x*c,b*u]}function xT(r,t){if(t instanceof ImageData){r.putImageData(t,0,0);return}let e=t.height,n=t.width,i=e%Si,s=(e-i)/Si,a=i===0?s:s+1,l=r.createImageData(n,Si),c=0,u,h=t.data,d=l.data,f,p,m,y;if(t.kind===Vf.GRAYSCALE_1BPP){let x=h.byteLength,b=new Uint32Array(d.buffer,0,d.byteLength>>2),w=b.length,C=n+7>>3,E=4294967295,S=Xe.isLittleEndian?4278190080:255;for(f=0;f<a;f++){for(m=f<s?Si:i,u=0,p=0;p<m;p++){let N=x-c,k=0,M=N>C?n:N*8-7,R=M&-8,j=0,$=0;for(;k<R;k+=8)$=h[c++],b[u++]=$&128?E:S,b[u++]=$&64?E:S,b[u++]=$&32?E:S,b[u++]=$&16?E:S,b[u++]=$&8?E:S,b[u++]=$&4?E:S,b[u++]=$&2?E:S,b[u++]=$&1?E:S;for(;k<M;k++)j===0&&($=h[c++],j=128),b[u++]=$&j?E:S,j>>=1}for(;u<w;)b[u++]=0;r.putImageData(l,0,f*Si)}}else if(t.kind===Vf.RGBA_32BPP){for(p=0,y=n*Si*4,f=0;f<s;f++)d.set(h.subarray(c,c+y)),c+=y,r.putImageData(l,0,p),p+=Si;f<a&&(y=n*i*4,d.set(h.subarray(c,c+y)),r.putImageData(l,0,p))}else if(t.kind===Vf.RGB_24BPP)for(m=Si,y=n*m,f=0;f<a;f++){for(f>=s&&(m=i,y=n*m),u=0,p=y;p--;)d[u++]=h[c++],d[u++]=h[c++],d[u++]=h[c++],d[u++]=255;r.putImageData(l,0,f*Si)}else throw new Error(`bad image kind: ${t.kind}`)}function wT(r,t){if(t.bitmap){r.drawImage(t.bitmap,0,0);return}let e=t.height,n=t.width,i=e%Si,s=(e-i)/Si,a=i===0?s:s+1,l=r.createImageData(n,Si),c=0,u=t.data,h=l.data;for(let d=0;d<a;d++){let f=d<s?Si:i;({srcPos:c}=jO({src:u,srcPos:c,dest:h,width:n,height:f,nonBlackColor:0})),r.putImageData(l,0,d*Si)}}function vf(r,t){let e=["strokeStyle","fillStyle","fillRule","globalAlpha","lineWidth","lineCap","lineJoin","miterLimit","globalCompositeOperation","font","filter"];for(let n of e)r[n]!==void 0&&(t[n]=r[n]);r.setLineDash!==void 0&&(t.setLineDash(r.getLineDash()),t.lineDashOffset=r.lineDashOffset)}function p0(r){r.strokeStyle=r.fillStyle="#000000",r.fillRule="nonzero",r.globalAlpha=1,r.lineWidth=1,r.lineCap="butt",r.lineJoin="miter",r.miterLimit=10,r.globalCompositeOperation="source-over",r.font="10px sans-serif",r.setLineDash!==void 0&&(r.setLineDash([]),r.lineDashOffset=0);let{filter:t}=r;t!=="none"&&t!==""&&(r.filter="none")}function AT(r,t){if(t)return!0;yt.singularValueDecompose2dScale(r,Zi);let e=Math.fround(Ls.pixelRatio*ja.PDF_TO_CSS_UNITS);return Zi[0]<=e&&Zi[1]<=e}function XO(r){let t=!0,e=n("filename\\*","i").exec(r);if(e){e=e[1];let h=l(e);return h=unescape(h),h=c(h),h=u(h),s(h)}if(e=a(r),e){let h=u(e);return s(h)}if(e=n("filename","i").exec(r),e){e=e[1];let h=l(e);return h=u(h),s(h)}function n(h,d){return new RegExp("(?:^|;)\\s*"+h+'\\s*=\\s*([^";\\s][^;\\s]*|"(?:[^"\\\\]|\\\\"?)+"?)',d)}function i(h,d){if(h){if(!/^[\x00-\xFF]+$/.test(d))return d;try{let f=new TextDecoder(h,{fatal:!0}),p=lb(d);d=f.decode(p),t=!1}catch{}}return d}function s(h){return t&&/[\x80-\xff]/.test(h)&&(h=i("utf-8",h),t&&(h=i("iso-8859-1",h))),h}function a(h){let d=[],f,p=n("filename\\*((?!0\\d)\\d+)(\\*?)","ig");for(;(f=p.exec(h))!==null;){let[,y,x,b]=f;if(y=parseInt(y,10),y in d){if(y===0)break;continue}d[y]=[x,b]}let m=[];for(let y=0;y<d.length&&y in d;++y){let[x,b]=d[y];b=l(b),x&&(b=unescape(b),y===0&&(b=c(b))),m.push(b)}return m.join("")}function l(h){if(h.startsWith('"')){let d=h.slice(1).split('\\"');for(let f=0;f<d.length;++f){let p=d[f].indexOf('"');p!==-1&&(d[f]=d[f].slice(0,p),d.length=f+1),d[f]=d[f].replaceAll(/\\(.)/g,"$1")}h=d.join('"')}return h}function c(h){let d=h.indexOf("'");if(d===-1)return h;let f=h.slice(0,d),m=h.slice(d+1).replace(/^[^']*'/,"");return i(f,m)}function u(h){return!h.startsWith("=?")||/[\x00-\x19\x80-\xff]/.test(h)?h:h.replaceAll(/=\?([\w-]*)\?([QqBb])\?((?:[^?]|\?(?!=))*)\?=/g,function(d,f,p,m){if(p==="q"||p==="Q")return m=m.replaceAll("_"," "),m=m.replaceAll(/=([0-9a-fA-F]{2})/g,function(y,x){return String.fromCharCode(parseInt(x,16))}),i(f,m);try{m=atob(m)}catch{}return i(f,m)})}return""}function CS(r,t){let e=new Headers;if(!r||!t||typeof t!="object")return e;for(let n in t){let i=t[n];i!==void 0&&e.append(n,i)}return e}function fb(r){return URL.parse(r)?.origin??null}function ES({responseHeaders:r,isHttp:t,rangeChunkSize:e,disableRange:n}){let i={contentLength:0,isRangeSupported:!1},s=parseInt(r.get("Content-Length"),10);return!Number.isInteger(s)||(i.contentLength=s,s<=2*e)||n||!t||r.get("Accept-Ranges")!=="bytes"||(r.get("Content-Encoding")||"identity")==="identity"&&(i.isRangeSupported=!0),i}function TS(r){let t=r.get("Content-Disposition");if(t){let e=XO(t);if(e.includes("%"))try{e=decodeURIComponent(e)}catch{}if(db(e))return e}return null}function pb(r,t){return new Yc(`Unexpected server response (${r}) while retrieving PDF "${t.href}".`,r,r===404||r===0&&t.protocol==="file:")}function SS(r,t){if(r!==t)throw new Error(`Expected range response-origin "${r}" to match "${t}".`)}function DS(r,t,e,n){return fetch(r,{method:"GET",headers:t,signal:n.signal,mode:"cors",credentials:e?"include":"same-origin",redirect:"follow"})}function NS(r,t){if(r!==200&&r!==206)throw pb(r,t)}function mb(r){if(r instanceof Uint8Array)return r.buffer;if(r instanceof ArrayBuffer)return r;throw new Error(`getArrayBuffer - unexpected data: ${r}`)}function CT(r){return r instanceof Uint8Array&&r.byteLength===r.buffer.byteLength?r.buffer:new Uint8Array(r).buffer}function gb(){for(let r of this._requests)r.resolve({value:void 0,done:!0});this._requests.length=0}function YO(r){return typeof r!="string"?r:lb(r).buffer}function LS(r){let{Readable:t}=nt.default.getBuiltinModule("stream");return typeof t.toWeb=="function"?t.toWeb(r):nt.default.getBuiltinModule("module").createRequire("")("node-readable-to-web-readable-stream").makeDefaultReadableStreamFromNodeReadable(r)}function KO(r){return Yf(r)?$w:Ki?Zw:Vw}function jS(r={}){typeof r=="string"||r instanceof URL?r={url:r}:(r instanceof ArrayBuffer||ArrayBuffer.isView(r))&&(r={data:r});let t=new o2,{docId:e}=t,n=r.url?MO(r.url):null,i=r.data?OO(r.data):null,s=r.httpHeaders||null,a=r.withCredentials===!0,l=r.password??null,c=r.range instanceof op?r.range:null,u=Number.isInteger(r.rangeChunkSize)&&r.rangeChunkSize>0?r.rangeChunkSize:2**16,h=r.worker instanceof Pd?r.worker:null,d=r.verbosity,f=typeof r.docBaseUrl=="string"&&!ag(r.docBaseUrl)?r.docBaseUrl:null,p=h0(r.cMapUrl),m=r.cMapPacked!==!1,y=h0(r.iccUrl),x=h0(r.standardFontDataUrl),b=h0(r.wasmUrl),w=r.stopAtErrors!==!0,C=Number.isInteger(r.maxImageSize)&&r.maxImageSize>-1?r.maxImageSize:-1,E=r.isEvalSupported!==!1,S=typeof r.isOffscreenCanvasSupported=="boolean"?r.isOffscreenCanvasSupported:!Ki,N=typeof r.isImageDecoderSupported=="boolean"?r.isImageDecoderSupported:!Ki&&(Xe.platform.isFirefox||!globalThis.chrome),k=Number.isInteger(r.canvasMaxAreaInBytes)?r.canvasMaxAreaInBytes:-1,M=typeof r.disableFontFace=="boolean"?r.disableFontFace:Ki,R=r.fontExtraProperties===!0,j=r.enableXfa===!0,$=r.ownerDocument||globalThis.document,q=r.disableRange===!0,Q=r.disableStream===!0,Z=r.disableAutoFetch===!0,Y=r.pdfBug===!0,X=r.CanvasFactory||(Ki?kw:Tw),T=r.FilterFactory||(Ki?Iw:Sw),I=r.BinaryDataFactory||(Ki?_w:my),_=r.enableHWA===!0,W=r.enableWebGPU===!0,z=r.useWasm!==!1,D=r.pagesMapper||new r2,F=typeof r.useSystemFonts=="boolean"?r.useSystemFonts:!Ki&&!M,P=typeof r.useWorkerFetch=="boolean"?r.useWorkerFetch:!!(I===my&&p&&m&&x&&b&&Yf(p,document.baseURI)&&Yf(x,document.baseURI)&&Yf(b,document.baseURI)),G=null;AO(d);let H={canvasFactory:new X({ownerDocument:$,enableHWA:_}),filterFactory:new T({docId:e,ownerDocument:$}),binaryDataFactory:P?null:new I({cMapUrl:p,standardFontDataUrl:x,wasmUrl:b})};h||(h=Pd.create({verbosity:d,port:Tr.workerPort}),t._worker=h);let V={docId:e,apiVersion:"5.6.205",data:i,password:l,disableAutoFetch:Z,rangeChunkSize:u,docBaseUrl:f,enableXfa:j,evaluatorOptions:{maxImageSize:C,disableFontFace:M,ignoreErrors:w,isEvalSupported:E,isOffscreenCanvasSupported:S,isImageDecoderSupported:N,canvasMaxAreaInBytes:k,fontExtraProperties:R,useSystemFonts:F,useWasm:z,useWorkerFetch:P,cMapUrl:p,cMapPacked:m,iccUrl:y,standardFontDataUrl:x,wasmUrl:b,enableWebGPU:W}},L={ownerDocument:$,pdfBug:Y,styleElement:G,enableHWA:_,loadingParams:{disableAutoFetch:Z,enableXfa:j}};return h.promise.then(function(){if(t.destroyed)throw new Error("Loading aborted");if(h.destroyed)throw new Error("Worker was destroyed");let tt=h.messageHandler.sendWithPromise("GetDocRequest",V,i?[i.buffer]:null),rt;if(!i)if(c)rt=new Gw({pdfDataRangeTransport:c,disableRange:q,disableStream:Q});else if(n){let at=KO(n);rt=new at({url:n,httpHeaders:s,withCredentials:a,rangeChunkSize:u,disableRange:q,disableStream:Q})}else throw new Error("getDocument - expected either `data`, `range`, or `url` parameter.");return tt.then(at=>{if(t.destroyed)throw new Error("Loading aborted");if(h.destroyed)throw new Error("Worker was destroyed");let ft=new Nl(e,at,h.port),J=new u2(ft,t,rt,L,H,D);t._transport=J,ft.send("Ready",null)})}).catch(t._capability.reject),t}function DT(r){return Math.floor(Math.max(0,Math.min(1,r))*255).toString(16).padStart(2,"0")}function Cf(r){return Math.max(0,Math.min(255,255*r))}function y0(r){return`${(r*100).toFixed(2)}%`}var b0,Ki,Lx,x0,wO,W3,Yi,Ba,Jf,Bt,Zt,NT,Dl,pn,Vf,tn,Uu,sg,Nd,Af,IT,ab,tu,sy,Xf,Id,Yc,Ux,Qr,Xe,Mx,Ua,w0,$x,yt,Ox,rT,Xu,cb,ub,ay,tp,ep,ta,El,ja,np,kd,ao,oy,mp,Xc,Ls,ly,zx,cy,lT,oo,lo,dr,fr,gp,co,th,eh,yp,Ly,LT,Wn,BT,UT,$u,Tf,ia,Gx,bp,Il,sa,Ha,$T,zT,Wx,Hx,kl,_l,nh,Ml,ge,Kn,By,qx,ih,xp,Zn,rh,A0,wA,Vx,en,uo,wp,Pe,Xx,Uy,GT,Kc,$y,Yx,sh,Mi,ah,He,Re,oh,lh,si,ch,pr,vn,ho,fo,po,mo,ps,mr,Ol,Ap,vp,uh,Cp,ms,go,hh,yo,gs,zy,aa,dh,Ep,bo,Fl,fh,xo,Tp,cn,fe,oa,wo,Ao,Sp,ph,Dp,vo,ys,la,Np,Ip,gr,At,v0,Kx,HT,WT,qT,Sf,VT,XT,YT,Zx,KT,ZT,QT,JT,ii,ea,tS,eS,Qx,nS,Df,Jx,Zu,nl,Cn,bs,Rr,mh,xs,Oi,gh,ws,Ai,ca,Pl,As,Co,Kr,Nf,C0,ri,uy,Ln,yr,Rl,Ee,kp,Eo,br,To,So,Ll,_p,tw,Yu,yh,Bl,Mp,Op,Fp,Pp,Rp,ua,Ul,ha,$l,da,il,iS,rS,sS,AA,ip,zl,Lr,ke,pe,fa,bh,Do,Lp,Bn,jl,pa,xr,No,Bp,Gl,Fi,Up,Hl,ma,vs,xh,wh,wr,Wl,$p,jy,Rt,ew,zp,nw,E0,aS,oS,iw,T0,rw,lS,cS,uS,sw,hS,aw,dS,fS,pS,ow,If,zt,Te,lw,cT,ur,ds,hy,rp,ql,Vl,ga,Un,Gy,mS,sp,jp,dy,Bu,uT,hT,cw,Ah,Io,uw,fT,ya,ce,ye,Xl,Yl,Kl,Qn,Gp,dw,hw,vi,Ci,Zl,Br,vh,ko,_o,be,fw,xe,We,Ur,Ch,Eh,vA,fy,hr,Ql,Jl,tc,ec,nc,Hp,Zf,pw,Th,mw,we,gw,S0,D0,Yn,ki,kn,Wp,Hy,Sh,Dh,N0,yw,ic,Nh,Cs,rc,kf,bw,$r,Wy,nn,me,Fr,I0,k0,_f,ww,xw,Aw,Ih,vw,Cw,FO,gS,ba,qy,Ew,d0,ln,kh,Nr,yS,bS,xS,_0,Nl,Vy,py,my,qp,gy,Tw,yy,sc,_h,xa,wa,Jn,ac,oc,Nt,Xn,Mf,zu,M0,ju,wS,Dw,Gu,Of,Ff,Nw,Pf,Sw,Iw,kw,_w,RO,Vp,Mh,Oh,Fh,Rd,AS,vS,Mw,xA,Gn,ap,Ow,Fw,Pw,mT,Xy,Rw,gT,yT,GO,bT,Si,Px,Zi,Ku,by,WO,qO,VO,vT,Jr,Lw,Bw,Uw,CA,Ju,Xp,Yp,_d,Md,Od,$w,zw,jw,Kp,Hw,Gw,Zp,Ww,Qp,qw,Rx,ET,Es,Ld,IS,kS,Vw,Jp,Bs,_S,MS,OS,FS,Xw,tm,Wa,PS,RS,Kw,Yw,Zw,Qw,Jw,em,nm,Tr,Ph,im,t2,Hu,rm,sm,am,Rh,e2,Mo,Ae,Lh,Bh,om,i2,n2,rn,zr,$n,lc,Ts,ei,Rf,Lf,F0,r2,Wu,TT,Ar,xy,ZO,ST,Oo,ai,lm,cm,Uh,cc,Aa,um,hm,uc,dm,$h,Fo,zh,fm,jh,hc,pm,mm,Gh,dc,gm,Hh,Wh,qa,BS,US,s2,Ji,P0,a2,$S,zS,Rn,Fd,QO,Yy,Ky,o2,qh,ym,bm,xm,op,l2,va,fc,pc,Bf,EA,c2,Po,jr,Ca,mc,Zy,gc,yc,ui,R0,GS,HS,Uf,Vh,L0,Ge,Pd,Pi,bc,Ea,Gr,xc,Xh,Ta,Zr,$f,B0,u2,h2,Ro,wc,Tl,d2,WS,qS,Ri,Ac,Yh,gn,wm,Kh,Sa,Am,Lo,Hr,vm,ve,f2,p2,m2,Al,VS,so,wi,lp,Ss,Cm,Zh,Em,Sl,wy,Ay,g2,Zc,JO,Qc,tF,Kf,vc,Qh,vr,Tm,y2,TA,$e,b2,Qi,vl,XS,YS,cp,x2,Ga,w2,A2,v2,vy,C2,E2,Sm,T2,up,Li,Bo,Qy,Jy,Jh,td,qe,Ds,Uo,Cc,ed,nd,Ns,Bi,Da,Na,Ve,Ia,$o,Dm,ka,id,Ec,zo,En,jo,Wt,U0,D2,N2,I2,$0,k2,KS,ZS,QS,JS,z0,j0,_2,S2,Cy,Nm,M2,Im,O2,km,F2,_m,Ey,P2,R2,Mm,Tc,Om,L2,hp,Ty,B2,U2,$2,Sy,Fm,Pm,j2,z2,Sc,Dc,rd,Go,Rm,Nc,Ui,Lm,$a,G0,G2,SA,Dy,m0,$i,Bm,Ic,zi,un,tD,eD,nD,H0,za,W0,q0,iD,W2,rD,Ie,H2,Dt,ji,Wr,sd,ad,Is,Vt,kc,_c,Um,$m,od,ld,Ho,zm,tb,eb,bn,zf,sD,aD,oD,lD,cD,uD,ra,Ny,cd,Mc,_a,jm,Gi,Gm,sn,nb,hD,Iy,Hm,Wm,qm,Wo,qr,hi,dD,V0,fD,pD,q2,dp,Vm,ud,V2,fp,X2,hd,Xm,Ma,Oc,Ym,Ei,Km,Zm,Fc,Hi,Wi,zn,dd,fd,ti,pd,Cr,Qm,Ht,Y2,X0,mD,gD,yD,K2,Cl,Dr,qu,bD,Y0,K0,xD,wD,AD,vD,CD,oe,ky,Pc,_y,qi,md,Tn,Rc,Lc,ie,Z2,Q2,J2,jf,ED,Z0,Gf,Vu,Kt,My,ks,Sn,Dn,Bc,gd,oi,jn,Er,Uc,$c,zc,yd,Q0,tA,li,Jm,tg,Vi,_s,Ms,bd,xd,jc,Hn,na,TD,SD,DD,Jc,Oy,ib,ND,Qu,eA,pp,g0,Ef,Gc,he,nA,Vr,ID,kD,iA,J0,_D,MD,OD,rA,sA,FD,Sr,aA,oA,qo,Os,Vo,Hc,_i,lA,_e,Nn,Xo,Oa,Yo,wd,Fa,Wc,Fs,Xi,Ad,re,Wf,qf,ty,ey,ny,cA,iy,PD,Hf,qc,vd,Ko,Zo,Pa,Ti,Qo,Cd,Ed,Xr,Ra,In,La,Jo,Td,_t,tl,Ce,uA,RD,fs,hA,dA,ry,Pr,Fy,Yr,ci,Vc,eg,rb,LD,Us,fA,BD,pA,mn,Py,Sd,ng,ig,Dd,Ps,Rs,rg,sb,UD,Qf,Ry,zD=ne(()=>{B();b0={};b0.d=(r,t)=>{for(var e in t)b0.o(t,e)&&!b0.o(r,e)&&Object.defineProperty(r,e,{enumerable:!0,get:t[e]})};b0.o=(r,t)=>Object.prototype.hasOwnProperty.call(r,t);Ki=typeof nt.default=="object"&&nt.default+""=="[object process]"&&!nt.default.versions.nw&&!(nt.default.versions.electron&&nt.default.type&&nt.default.type!=="browser"),Lx=[.001,0,0,.001,0,0],x0=1.35,wO=.35,W3=wO/x0,Yi={ANY:1,DISPLAY:2,PRINT:4,SAVE:8,ANNOTATIONS_FORMS:16,ANNOTATIONS_STORAGE:32,ANNOTATIONS_DISABLE:64,IS_EDITING:128,OPLIST:256},Ba={DISABLE:0,ENABLE:1,ENABLE_FORMS:2,ENABLE_STORAGE:3},Jf="pdfjs_internal_editor_",Bt={DISABLE:-1,NONE:0,FREETEXT:3,HIGHLIGHT:9,STAMP:13,INK:15,POPUP:16,SIGNATURE:101,COMMENT:102},Zt={RESIZE:1,CREATE:2,FREETEXT_SIZE:11,FREETEXT_COLOR:12,FREETEXT_OPACITY:13,INK_COLOR:21,INK_THICKNESS:22,INK_OPACITY:23,HIGHLIGHT_COLOR:31,HIGHLIGHT_THICKNESS:32,HIGHLIGHT_FREE:33,HIGHLIGHT_SHOW_ALL:34,DRAW_STEP:41},NT={PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048},Dl={TRIANGLES:1,LATTICE:2,PATCH:3},pn={FILL:0,STROKE:1,FILL_STROKE:2,INVISIBLE:3,FILL_ADD_TO_PATH:4,STROKE_ADD_TO_PATH:5,FILL_STROKE_ADD_TO_PATH:6,ADD_TO_PATH:7,FILL_STROKE_MASK:3,ADD_TO_PATH_FLAG:4},Vf={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3},tn={TEXT:1,LINK:2,FREETEXT:3,LINE:4,SQUARE:5,CIRCLE:6,POLYGON:7,POLYLINE:8,HIGHLIGHT:9,UNDERLINE:10,SQUIGGLY:11,STRIKEOUT:12,STAMP:13,CARET:14,INK:15,POPUP:16,FILEATTACHMENT:17,SOUND:18,MOVIE:19,WIDGET:20,SCREEN:21,PRINTERMARK:22,TRAPNET:23,WATERMARK:24,THREED:25,REDACT:26},Uu={SOLID:1,DASHED:2,BEVELED:3,INSET:4,UNDERLINE:5},sg={ERRORS:0,WARNINGS:1,INFOS:5},Nd={dependency:1,setLineWidth:2,setLineCap:3,setLineJoin:4,setMiterLimit:5,setDash:6,setRenderingIntent:7,setFlatness:8,setGState:9,save:10,restore:11,transform:12,moveTo:13,lineTo:14,curveTo:15,curveTo2:16,curveTo3:17,closePath:18,rectangle:19,stroke:20,closeStroke:21,fill:22,eoFill:23,fillStroke:24,eoFillStroke:25,closeFillStroke:26,closeEOFillStroke:27,endPath:28,clip:29,eoClip:30,beginText:31,endText:32,setCharSpacing:33,setWordSpacing:34,setHScale:35,setLeading:36,setFont:37,setTextRenderingMode:38,setTextRise:39,moveText:40,setLeadingMoveText:41,setTextMatrix:42,nextLine:43,showText:44,showSpacedText:45,nextLineShowText:46,nextLineSetSpacingShowText:47,setCharWidth:48,setCharWidthAndBounds:49,setStrokeColorSpace:50,setFillColorSpace:51,setStrokeColor:52,setStrokeColorN:53,setFillColor:54,setFillColorN:55,setStrokeGray:56,setFillGray:57,setStrokeRGBColor:58,setFillRGBColor:59,setStrokeCMYKColor:60,setFillCMYKColor:61,shadingFill:62,beginInlineImage:63,beginImageData:64,endInlineImage:65,paintXObject:66,markPoint:67,markPointProps:68,beginMarkedContent:69,beginMarkedContentProps:70,endMarkedContent:71,beginCompat:72,endCompat:73,paintFormXObjectBegin:74,paintFormXObjectEnd:75,beginGroup:76,endGroup:77,beginAnnotation:80,endAnnotation:81,paintImageMaskXObject:83,paintImageMaskXObjectGroup:84,paintImageXObject:85,paintInlineImageXObject:86,paintInlineImageXObjectGroup:87,paintImageXObjectRepeat:88,paintImageMaskXObjectRepeat:89,paintSolidColorImageMask:90,constructPath:91,setStrokeTransparent:92,setFillTransparent:93,rawFillPath:94},Af={moveTo:0,lineTo:1,curveTo:2,quadraticCurveTo:3,closePath:4},IT={NEED_PASSWORD:1,INCORRECT_PASSWORD:2},ab=sg.WARNINGS;tu=(function(){function t(e,n){this.message=e,this.name=n}return t.prototype=new Error,t.constructor=t,t})(),sy=class extends tu{constructor(t,e){super(t,"PasswordException"),this.code=e}},Xf=class extends tu{constructor(t,e){super(t,"UnknownErrorException"),this.details=e}},Id=class extends tu{constructor(t){super(t,"InvalidPDFException")}},Yc=class extends tu{constructor(t,e,n){super(t,"ResponseException"),this.status=e,this.missing=n}},Ux=class extends tu{constructor(t){super(t,"FormatError")}},Qr=class extends tu{constructor(t){super(t,"AbortException")}};Xe=class{static get isLittleEndian(){return Ut(this,"isLittleEndian",SO())}static get isEvalSupported(){return Ut(this,"isEvalSupported",DO())}static get isOffscreenCanvasSupported(){return Ut(this,"isOffscreenCanvasSupported",typeof OffscreenCanvas<"u")}static get isImageDecoderSupported(){return Ut(this,"isImageDecoderSupported",typeof ImageDecoder<"u")}static get isFloat16ArraySupported(){return Ut(this,"isFloat16ArraySupported",typeof Float16Array<"u")}static get isSanitizerSupported(){return Ut(this,"isSanitizerSupported",typeof Sanitizer<"u")}static get platform(){let{platform:t,userAgent:e}=navigator;return Ut(this,"platform",{isAndroid:e.includes("Android"),isLinux:t.includes("Linux"),isMac:t.includes("Mac"),isWindows:t.includes("Win"),isFirefox:e.includes("Firefox")})}static get isCSSRoundSupported(){return Ut(this,"isCSSRoundSupported",globalThis.CSS?.supports?.("width: round(1.5px, 1px)"))}},Mx=Array.from(Array(256).keys(),r=>r.toString(16).padStart(2,"0")),yt=class{static makeHexColor(t,e,n){return`#${Mx[t]}${Mx[e]}${Mx[n]}`}static domMatrixToTransform(t){return[t.a,t.b,t.c,t.d,t.e,t.f]}static scaleMinMax(t,e){let n;t[0]?(t[0]<0&&(n=e[0],e[0]=e[2],e[2]=n),e[0]*=t[0],e[2]*=t[0],t[3]<0&&(n=e[1],e[1]=e[3],e[3]=n),e[1]*=t[3],e[3]*=t[3]):(n=e[0],e[0]=e[1],e[1]=n,n=e[2],e[2]=e[3],e[3]=n,t[1]<0&&(n=e[1],e[1]=e[3],e[3]=n),e[1]*=t[1],e[3]*=t[1],t[2]<0&&(n=e[0],e[0]=e[2],e[2]=n),e[0]*=t[2],e[2]*=t[2]),e[0]+=t[4],e[1]+=t[5],e[2]+=t[4],e[3]+=t[5]}static transform(t,e){return[t[0]*e[0]+t[2]*e[1],t[1]*e[0]+t[3]*e[1],t[0]*e[2]+t[2]*e[3],t[1]*e[2]+t[3]*e[3],t[0]*e[4]+t[2]*e[5]+t[4],t[1]*e[4]+t[3]*e[5]+t[5]]}static multiplyByDOMMatrix(t,e){return[t[0]*e.a+t[2]*e.b,t[1]*e.a+t[3]*e.b,t[0]*e.c+t[2]*e.d,t[1]*e.c+t[3]*e.d,t[0]*e.e+t[2]*e.f+t[4],t[1]*e.e+t[3]*e.f+t[5]]}static applyTransform(t,e,n=0){let i=t[n],s=t[n+1];t[n]=i*e[0]+s*e[2]+e[4],t[n+1]=i*e[1]+s*e[3]+e[5]}static applyTransformToBezier(t,e,n=0){let i=e[0],s=e[1],a=e[2],l=e[3],c=e[4],u=e[5];for(let h=0;h<6;h+=2){let d=t[n+h],f=t[n+h+1];t[n+h]=d*i+f*a+c,t[n+h+1]=d*s+f*l+u}}static applyInverseTransform(t,e){let n=t[0],i=t[1],s=e[0]*e[3]-e[1]*e[2];t[0]=(n*e[3]-i*e[2]+e[2]*e[5]-e[4]*e[3])/s,t[1]=(-n*e[1]+i*e[0]+e[4]*e[1]-e[5]*e[0])/s}static axialAlignedBoundingBox(t,e,n){let i=e[0],s=e[1],a=e[2],l=e[3],c=e[4],u=e[5],h=t[0],d=t[1],f=t[2],p=t[3],m=i*h+c,y=m,x=i*f+c,b=x,w=l*d+u,C=w,E=l*p+u,S=E;if(s!==0||a!==0){let N=s*h,k=s*f,M=a*d,R=a*p;m+=M,b+=M,x+=R,y+=R,w+=N,S+=N,E+=k,C+=k}n[0]=Math.min(n[0],m,x,y,b),n[1]=Math.min(n[1],w,E,C,S),n[2]=Math.max(n[2],m,x,y,b),n[3]=Math.max(n[3],w,E,C,S)}static inverseTransform(t){let e=t[0]*t[3]-t[1]*t[2];return[t[3]/e,-t[1]/e,-t[2]/e,t[0]/e,(t[2]*t[5]-t[4]*t[3])/e,(t[4]*t[1]-t[5]*t[0])/e]}static singularValueDecompose2dScale(t,e){let n=t[0],i=t[1],s=t[2],a=t[3],l=n**2+i**2,c=n*s+i*a,u=s**2+a**2,h=(l+u)/2,d=Math.sqrt(h**2-(l*u-c**2));e[0]=Math.sqrt(h+d||1),e[1]=Math.sqrt(h-d||1)}static normalizeRect(t){let e=t.slice(0);return t[0]>t[2]&&(e[0]=t[2],e[2]=t[0]),t[1]>t[3]&&(e[1]=t[3],e[3]=t[1]),e}static intersect(t,e){let n=Math.max(Math.min(t[0],t[2]),Math.min(e[0],e[2])),i=Math.min(Math.max(t[0],t[2]),Math.max(e[0],e[2]));if(n>i)return null;let s=Math.max(Math.min(t[1],t[3]),Math.min(e[1],e[3])),a=Math.min(Math.max(t[1],t[3]),Math.max(e[1],e[3]));return s>a?null:[n,s,i,a]}static pointBoundingBox(t,e,n){n[0]=Math.min(n[0],t),n[1]=Math.min(n[1],e),n[2]=Math.max(n[2],t),n[3]=Math.max(n[3],e)}static rectBoundingBox(t,e,n,i,s){s[0]=Math.min(s[0],t,n),s[1]=Math.min(s[1],e,i),s[2]=Math.max(s[2],t,n),s[3]=Math.max(s[3],e,i)}static bezierBoundingBox(t,e,n,i,s,a,l,c,u){u[0]=Math.min(u[0],t,l),u[1]=Math.min(u[1],e,c),u[2]=Math.max(u[2],t,l),u[3]=Math.max(u[3],e,c),v(this,Ua,$x).call(this,t,n,s,l,e,i,a,c,3*(-t+3*(n-s)+l),6*(t-2*n+s),3*(n-t),u),v(this,Ua,$x).call(this,t,n,s,l,e,i,a,c,3*(-e+3*(i-a)+c),6*(e-2*i+a),3*(i-e),u)}};Ua=new WeakSet,w0=function(t,e,n,i,s,a,l,c,u,h){if(u<=0||u>=1)return;let d=1-u,f=u*u,p=f*u,m=d*(d*(d*t+3*u*e)+3*f*n)+p*i,y=d*(d*(d*s+3*u*a)+3*f*l)+p*c;h[0]=Math.min(h[0],m),h[1]=Math.min(h[1],y),h[2]=Math.max(h[2],m),h[3]=Math.max(h[3],y)},$x=function(t,e,n,i,s,a,l,c,u,h,d,f){if(Math.abs(u)<1e-12){Math.abs(h)>=1e-12&&v(this,Ua,w0).call(this,t,e,n,i,s,a,l,c,-d/h,f);return}let p=h**2-4*d*u;if(p<0)return;let m=Math.sqrt(p),y=2*u;v(this,Ua,w0).call(this,t,e,n,i,s,a,l,c,(-h+m)/y,f),v(this,Ua,w0).call(this,t,e,n,i,s,a,l,c,(-h-m)/y,f)},A(yt,Ua);Ox=null,rT=null;Xu="pdfjs_internal_id_";cb=()=>[],ub=()=>new Map,ay=()=>Object.create(null);typeof Math.sumPrecise!="function"&&(Math.sumPrecise=function(r){return r.reduce((t,e)=>t+e,0)});tp=class r{static textContent(t){let e=[],n={items:e,styles:Object.create(null)};function i(s){if(!s)return;let a=null,l=s.name;if(l==="#text")a=s.value;else if(r.shouldBuildText(l))s?.attributes?.textContent?a=s.attributes.textContent:s.value&&(a=s.value);else return;if(a!==null&&e.push({str:a}),!!s.children)for(let c of s.children)i(c)}return i(t),n}static shouldBuildText(t){return!(t==="textarea"||t==="input"||t==="option"||t==="select")}},ep=class{static setupStorage(t,e,n,i,s){let a=i.getValue(e,{value:null});switch(n.name){case"textarea":if(a.value!==null&&(t.textContent=a.value),s==="print")break;t.addEventListener("input",l=>{i.setValue(e,{value:l.target.value})});break;case"input":if(n.attributes.type==="radio"||n.attributes.type==="checkbox"){if(a.value===n.attributes.xfaOn?t.setAttribute("checked",!0):a.value===n.attributes.xfaOff&&t.removeAttribute("checked"),s==="print")break;t.addEventListener("change",l=>{i.setValue(e,{value:l.target.checked?l.target.getAttribute("xfaOn"):l.target.getAttribute("xfaOff")})})}else{if(a.value!==null&&t.setAttribute("value",a.value),s==="print")break;t.addEventListener("input",l=>{i.setValue(e,{value:l.target.value})})}break;case"select":if(a.value!==null){t.setAttribute("value",a.value);for(let l of n.children)l.attributes.value===a.value?l.attributes.selected=!0:l.attributes.hasOwnProperty("selected")&&delete l.attributes.selected}t.addEventListener("input",l=>{let c=l.target.options,u=c.selectedIndex===-1?"":c[c.selectedIndex].value;i.setValue(e,{value:u})});break}}static setAttributes({html:t,element:e,storage:n=null,intent:i,linkService:s}){let{attributes:a}=e,l=t instanceof HTMLAnchorElement;a.type==="radio"&&(a.name=`${a.name}-${i}`);for(let[c,u]of Object.entries(a))if(u!=null)switch(c){case"class":u.length&&t.setAttribute(c,u.join(" "));break;case"dataId":break;case"id":t.setAttribute("data-element-id",u);break;case"style":Object.assign(t.style,u);break;case"textContent":t.textContent=u;break;default:(!l||c!=="href"&&c!=="newWindow")&&t.setAttribute(c,u)}l&&s.addLinkAttributes(t,a.href,a.newWindow),n&&a.dataId&&this.setupStorage(t,a.dataId,e,n)}static render(t){let e=t.annotationStorage,n=t.linkService,i=t.xfaHtml,s=t.intent||"display",a=document.createElement(i.name);i.attributes&&this.setAttributes({html:a,element:i,intent:s,linkService:n});let l=s!=="richText",c=t.div;if(c.append(a),t.viewport){let d=`matrix(${t.viewport.transform.join(",")})`;c.style.transform=d}l&&c.setAttribute("class","xfaLayer xfaFont");let u=[];if(i.children.length===0){if(i.value){let d=document.createTextNode(i.value);a.append(d),l&&tp.shouldBuildText(i.name)&&u.push(d)}return{textDivs:u}}let h=[[i,-1,a]];for(;h.length>0;){let[d,f,p]=h.at(-1);if(f+1===d.children.length){h.pop();continue}let m=d.children[++h.at(-1)[1]];if(m===null)continue;let{name:y}=m;if(y==="#text"){let b=document.createTextNode(m.value);u.push(b),p.append(b);continue}let x=m?.attributes?.xmlns?document.createElementNS(m.attributes.xmlns,y):document.createElement(y);if(p.append(x),m.attributes&&this.setAttributes({html:x,element:m,storage:e,intent:s,linkService:n}),m.children?.length>0)h.push([m,-1,x]);else if(m.value){let b=document.createTextNode(m.value);l&&tp.shouldBuildText(y)&&u.push(b),x.append(b)}}for(let d of c.querySelectorAll(".xfaNonInteractive input, .xfaNonInteractive textarea"))d.setAttribute("readOnly",!0);return{textDivs:u}}static update(t){let e=`matrix(${t.viewport.transform.join(",")})`;t.div.style.transform=e,t.div.hidden=!1}},ta="http://www.w3.org/2000/svg",El=class El{};U(El,"CSS",96),U(El,"PDF",72),U(El,"PDF_TO_CSS_UNITS",El.CSS/El.PDF);ja=El;np=class r{constructor({viewBox:t,userUnit:e,scale:n,rotation:i,offsetX:s=0,offsetY:a=0,dontFlip:l=!1}){this.viewBox=t,this.userUnit=e,this.scale=n,this.rotation=i,this.offsetX=s,this.offsetY=a,n*=e;let c=(t[2]+t[0])/2,u=(t[3]+t[1])/2,h,d,f,p;switch(i%=360,i<0&&(i+=360),i){case 180:h=-1,d=0,f=0,p=1;break;case 90:h=0,d=1,f=1,p=0;break;case 270:h=0,d=-1,f=-1,p=0;break;case 0:h=1,d=0,f=0,p=-1;break;default:throw new Error("PageViewport: Invalid rotation, must be a multiple of 90 degrees.")}l&&(f=-f,p=-p);let m,y,x,b;h===0?(m=Math.abs(u-t[1])*n+s,y=Math.abs(c-t[0])*n+a,x=(t[3]-t[1])*n,b=(t[2]-t[0])*n):(m=Math.abs(c-t[0])*n+s,y=Math.abs(u-t[1])*n+a,x=(t[2]-t[0])*n,b=(t[3]-t[1])*n),this.transform=[h*n,d*n,f*n,p*n,m-h*n*c-f*n*u,y-d*n*c-p*n*u],this.width=x,this.height=b}get rawDims(){let t=this.viewBox;return Ut(this,"rawDims",{pageWidth:t[2]-t[0],pageHeight:t[3]-t[1],pageX:t[0],pageY:t[1]})}clone({scale:t=this.scale,rotation:e=this.rotation,offsetX:n=this.offsetX,offsetY:i=this.offsetY,dontFlip:s=!1}={}){return new r({viewBox:this.viewBox.slice(),userUnit:this.userUnit,scale:t,rotation:e,offsetX:n,offsetY:i,dontFlip:s})}convertToViewportPoint(t,e){let n=[t,e];return yt.applyTransform(n,this.transform),n}convertToViewportRectangle(t){let e=[t[0],t[1]];yt.applyTransform(e,this.transform);let n=[t[2],t[3]];return yt.applyTransform(n,this.transform),[e[0],e[1],n[0],n[1]]}convertToPdfPoint(t,e){let n=[t,e];return yt.applyInverseTransform(n,this.transform),n}},kd=class extends tu{constructor(t,e=0){super(t,"RenderingCancelledException"),this.extraDelay=e}};oy=class{constructor(){A(this,ao,new Map);U(this,"times",[])}time(t){o(this,ao).has(t)&&jt(`Timer is already running for ${t}`),o(this,ao).set(t,Date.now())}timeEnd(t){o(this,ao).has(t)||jt(`Timer has not been started for ${t}`),this.times.push({name:t,start:o(this,ao).get(t),end:Date.now()}),o(this,ao).delete(t)}toString(){let t=Math.max(...this.times.map(e=>e.name.length));return this.times.map(e=>`${e.name.padEnd(t)} ${e.end-e.start}ms
|
|
15
|
-
`).join("")}};ao=new WeakMap;Xc=class{static toDateObject(t){if(t instanceof Date)return t;if(!t||typeof t!="string")return null;o(this,mp)||g(this,mp,new RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+|-])?(\\d{2})?'?(\\d{2})?'?"));let e=o(this,mp).exec(t);if(!e)return null;let n=parseInt(e[1],10),i=parseInt(e[2],10);i=i>=1&&i<=12?i-1:0;let s=parseInt(e[3],10);s=s>=1&&s<=31?s:1;let a=parseInt(e[4],10);a=a>=0&&a<=23?a:0;let l=parseInt(e[5],10);l=l>=0&&l<=59?l:0;let c=parseInt(e[6],10);c=c>=0&&c<=59?c:0;let u=e[7]||"Z",h=parseInt(e[8],10);h=h>=0&&h<=23?h:0;let d=parseInt(e[9],10)||0;return d=d>=0&&d<=59?d:0,u==="-"?(a+=h,l+=d):u==="+"&&(a-=h,l-=d),new Date(Date.UTC(n,i,s,a,l,c))}};mp=new WeakMap,A(Xc,mp);Ls=class r{constructor(){let{pixelRatio:t}=r;this.sx=t,this.sy=t}get scaled(){return this.sx!==1||this.sy!==1}get symmetric(){return this.sx===this.sy}limitCanvas(t,e,n,i,s=-1){let a=1/0,l=1/0,c=1/0;n=r.capPixels(n,s),n>0&&(a=Math.sqrt(n/(t*e))),i!==-1&&(l=i/t,c=i/e);let u=Math.min(a,l,c);return this.sx>u||this.sy>u?(this.sx=u,this.sy=u,!0):!1}static get pixelRatio(){return globalThis.devicePixelRatio||1}static capPixels(t,e){if(e>=0){let n=Math.ceil(window.screen.availWidth*window.screen.availHeight*this.pixelRatio**2*(1+e/100));return t>0?Math.min(t,n):n}return t}},ly=["image/apng","image/avif","image/bmp","image/gif","image/jpeg","image/png","image/svg+xml","image/webp","image/x-icon"],zx=class{static get isDarkMode(){return Ut(this,"isDarkMode",!!window?.matchMedia?.("(prefers-color-scheme: dark)").matches)}},cy=class{static get commentForegroundColor(){let t=document.createElement("span");t.classList.add("comment","sidebar");let{style:e}=t;e.width=e.height="0",e.display="none",e.color="var(--comment-fg-color)",document.body.append(t);let{color:n}=window.getComputedStyle(t);return t.remove(),Ut(this,"commentForegroundColor",Bd(n))}};lT=new Map;ia=class ia{constructor(t){A(this,Wn);A(this,oo,null);A(this,lo,null);A(this,dr);A(this,fr,null);A(this,gp,null);A(this,co,null);A(this,th,null);A(this,eh,null);g(this,dr,t),o(ia,yp)||g(ia,yp,Object.freeze({freetext:"pdfjs-editor-remove-freetext-button",highlight:"pdfjs-editor-remove-highlight-button",ink:"pdfjs-editor-remove-ink-button",stamp:"pdfjs-editor-remove-stamp-button",signature:"pdfjs-editor-remove-signature-button"}))}render(){let t=g(this,oo,document.createElement("div"));t.classList.add("editToolbar","hidden"),t.setAttribute("role","toolbar");let e=o(this,dr)._uiManager._signal;e instanceof AbortSignal&&!e.aborted&&(t.addEventListener("contextmenu",tr,{signal:e}),t.addEventListener("pointerdown",v(ia,Ly,LT),{signal:e}));let n=g(this,fr,document.createElement("div"));n.className="buttons",t.append(n);let i=o(this,dr).toolbarPosition;if(i){let{style:s}=t,a=o(this,dr)._uiManager.direction==="ltr"?1-i[0]:i[0];s.insetInlineEnd=`${100*a}%`,s.top=`calc(${100*i[1]}% + var(--editor-toolbar-vert-offset))`}return t}get div(){return o(this,oo)}hide(){o(this,oo).classList.add("hidden"),o(this,lo)?.hideDropdown()}show(){o(this,oo).classList.remove("hidden"),o(this,gp)?.shown(),o(this,co)?.shown()}addDeleteButton(){let{editorType:t,_uiManager:e}=o(this,dr),n=document.createElement("button");n.classList.add("basic","deleteButton"),n.tabIndex=0,n.setAttribute("data-l10n-id",o(ia,yp)[t]),v(this,Wn,$u).call(this,n)&&n.addEventListener("click",i=>{e.delete()},{signal:e._signal}),o(this,fr).append(n)}async addAltText(t){let e=await t.render();v(this,Wn,$u).call(this,e),o(this,fr).append(e,o(this,Wn,Tf)),g(this,gp,t)}addComment(t,e=null){if(o(this,co))return;let n=t.renderForToolbar();if(!n)return;v(this,Wn,$u).call(this,n);let i=g(this,th,o(this,Wn,Tf));e?(o(this,fr).insertBefore(n,e),o(this,fr).insertBefore(i,e)):o(this,fr).append(n,i),g(this,co,t),t.toolbar=this}addColorPicker(t){if(o(this,lo))return;g(this,lo,t);let e=t.renderButton();v(this,Wn,$u).call(this,e),o(this,fr).append(e,o(this,Wn,Tf))}async addEditSignatureButton(t){let e=g(this,eh,await t.renderEditButton(o(this,dr)));v(this,Wn,$u).call(this,e),o(this,fr).append(e,o(this,Wn,Tf))}removeButton(t){t==="comment"&&(o(this,co)?.removeToolbarCommentButton(),g(this,co,null),o(this,th)?.remove(),g(this,th,null))}async addButton(t,e){switch(t){case"colorPicker":e&&this.addColorPicker(e);break;case"altText":e&&await this.addAltText(e);break;case"editSignature":e&&await this.addEditSignatureButton(e);break;case"delete":this.addDeleteButton();break;case"comment":e&&this.addComment(e);break}}async addButtonBefore(t,e,n){if(!e&&t==="comment")return;let i=o(this,fr).querySelector(n);i&&t==="comment"&&this.addComment(e,i)}updateEditSignatureButton(t){o(this,eh)&&(o(this,eh).title=t)}remove(){o(this,oo).remove(),o(this,lo)?.destroy(),g(this,lo,null)}};oo=new WeakMap,lo=new WeakMap,dr=new WeakMap,fr=new WeakMap,gp=new WeakMap,co=new WeakMap,th=new WeakMap,eh=new WeakMap,yp=new WeakMap,Ly=new WeakSet,LT=function(t){t.stopPropagation()},Wn=new WeakSet,BT=function(t){o(this,dr)._focusEventsAllowed=!1,Be(t)},UT=function(t){o(this,dr)._focusEventsAllowed=!0,Be(t)},$u=function(t){let e=o(this,dr)._uiManager._signal;return!(e instanceof AbortSignal)||e.aborted?!1:(t.addEventListener("focusin",v(this,Wn,BT).bind(this),{capture:!0,signal:e}),t.addEventListener("focusout",v(this,Wn,UT).bind(this),{capture:!0,signal:e}),t.addEventListener("contextmenu",tr,{signal:e}),!0)},Tf=function(){let t=document.createElement("div");return t.className="divider",t},A(ia,Ly),A(ia,yp,null);Gx=ia,Hx=class{constructor(t){A(this,Ha);A(this,bp,null);A(this,Il,null);A(this,sa);g(this,sa,t)}show(t,e,n){let[i,s]=v(this,Ha,zT).call(this,e,n),{style:a}=o(this,Il)||g(this,Il,v(this,Ha,$T).call(this));t.append(o(this,Il)),a.insetInlineEnd=`${100*i}%`,a.top=`calc(${100*s}% + var(--editor-toolbar-vert-offset))`}hide(){o(this,Il).remove()}};bp=new WeakMap,Il=new WeakMap,sa=new WeakMap,Ha=new WeakSet,$T=function(){let t=g(this,Il,document.createElement("div"));t.className="editToolbar",t.setAttribute("role","toolbar");let e=o(this,sa)._signal;e instanceof AbortSignal&&!e.aborted&&t.addEventListener("contextmenu",tr,{signal:e});let n=g(this,bp,document.createElement("div"));return n.className="buttons",t.append(n),o(this,sa).hasCommentManager()&&v(this,Ha,Wx).call(this,"commentButton","pdfjs-comment-floating-button","pdfjs-comment-floating-button-label",()=>{o(this,sa).commentSelection("floating_button")}),v(this,Ha,Wx).call(this,"highlightButton","pdfjs-highlight-floating-button1","pdfjs-highlight-floating-button-label",()=>{o(this,sa).highlightSelection("floating_button")}),t},zT=function(t,e){let n=0,i=0;for(let s of t){let a=s.y+s.height;if(a<n)continue;let l=s.x+(e?s.width:0);if(a>n){i=l,n=a;continue}e?l>i&&(i=l):l<i&&(i=l)}return[e?1-i:i,n]},Wx=function(t,e,n,i){let s=document.createElement("button");s.classList.add("basic",t),s.tabIndex=0,s.setAttribute("data-l10n-id",e);let a=document.createElement("span");s.append(a),a.className="visuallyHidden",a.setAttribute("data-l10n-id",n);let l=o(this,sa)._signal;l instanceof AbortSignal&&!l.aborted&&(s.addEventListener("contextmenu",tr,{signal:l}),s.addEventListener("click",i,{signal:l})),o(this,bp).append(s)};ge=class ge{static initializeAndAddPointerId(t){(o(ge,_l)||g(ge,_l,new Set)).add(t)}static setPointer(t,e){o(ge,kl)||g(ge,kl,e),o(ge,Ml)??g(ge,Ml,t)}static setTimeStamp(t){g(ge,nh,t)}static isSamePointerId(t){return o(ge,kl)===t}static isSamePointerIdOrRemove(t){return o(ge,kl)===t?!0:(o(ge,_l)?.delete(t),!1)}static isSamePointerType(t){return o(ge,Ml)===t}static isInitializedAndDifferentPointerType(t){return o(ge,Ml)!==null&&!ge.isSamePointerType(t)}static isSameTimeStamp(t){return o(ge,nh)===t}static isUsingMultiplePointers(){return o(ge,_l)?.size>=1}static clearPointerType(){g(ge,Ml,null)}static clearPointerIds(){g(ge,kl,NaN),g(ge,_l,null)}static clearTimeStamp(){g(ge,nh,NaN)}};kl=new WeakMap,_l=new WeakMap,nh=new WeakMap,Ml=new WeakMap,A(ge,kl,NaN),A(ge,_l,null),A(ge,nh,NaN),A(ge,Ml,null);Kn=ge,qx=class{constructor(){A(this,By,0)}get id(){return`${Jf}${an(this,By)._++}`}};By=new WeakMap;wA=class wA{constructor(){A(this,rh);A(this,ih,yA());A(this,xp,0);A(this,Zn,null)}static get _isSVGFittingCanvas(){let t='data:image/svg+xml;charset=UTF-8,<svg viewBox="0 0 1 1" width="1" height="1" xmlns="http://www.w3.org/2000/svg"><rect width="1" height="1" style="fill:red;"/></svg>',n=new OffscreenCanvas(1,3).getContext("2d",{willReadFrequently:!0}),i=new Image;i.src=t;let s=i.decode().then(()=>(n.drawImage(i,0,0,1,1,0,0,1,3),new Uint32Array(n.getImageData(0,0,1,1).data.buffer)[0]===0));return Ut(this,"_isSVGFittingCanvas",s)}async getFromFile(t){let{lastModified:e,name:n,size:i,type:s}=t;return v(this,rh,A0).call(this,`${e}_${n}_${i}_${s}`,t)}async getFromUrl(t){return v(this,rh,A0).call(this,t,t)}async getFromBlob(t,e){let n=await e;return v(this,rh,A0).call(this,t,n)}async getFromId(t){o(this,Zn)||g(this,Zn,new Map);let e=o(this,Zn).get(t);if(!e)return null;if(e.bitmap)return e.refCounter+=1,e;if(e.file)return this.getFromFile(e.file);if(e.blobPromise){let{blobPromise:n}=e;return delete e.blobPromise,this.getFromBlob(e.id,n)}return this.getFromUrl(e.url)}getFromCanvas(t,e){o(this,Zn)||g(this,Zn,new Map);let n=o(this,Zn).get(t);if(n?.bitmap)return n.refCounter+=1,n;let i=new OffscreenCanvas(e.width,e.height);return i.getContext("2d").drawImage(e,0,0),n={bitmap:i.transferToImageBitmap(),id:`image_${o(this,ih)}_${an(this,xp)._++}`,refCounter:1,isSvg:!1},o(this,Zn).set(t,n),o(this,Zn).set(n.id,n),n}getSvgUrl(t){let e=o(this,Zn).get(t);return e?.isSvg?e.svgUrl:null}deleteId(t){o(this,Zn)||g(this,Zn,new Map);let e=o(this,Zn).get(t);if(!e||(e.refCounter-=1,e.refCounter!==0))return;let{bitmap:n}=e;if(!e.url&&!e.file){let i=new OffscreenCanvas(n.width,n.height);i.getContext("bitmaprenderer").transferFromImageBitmap(n),e.blobPromise=i.convertToBlob()}n.close?.(),e.bitmap=null}isValidId(t){return t.startsWith(`image_${o(this,ih)}_`)}};ih=new WeakMap,xp=new WeakMap,Zn=new WeakMap,rh=new WeakSet,A0=async function(t,e){o(this,Zn)||g(this,Zn,new Map);let n=o(this,Zn).get(t);if(n===null)return null;if(n?.bitmap)return n.refCounter+=1,n;try{n||(n={bitmap:null,id:`image_${o(this,ih)}_${an(this,xp)._++}`,refCounter:0,isSvg:!1});let i;if(typeof e=="string"?(n.url=e,i=await hb(e,"blob")):e instanceof File?i=n.file=e:e instanceof Blob&&(i=e),i.type==="image/svg+xml"){let s=wA._isSVGFittingCanvas,a=new FileReader,l=new Image,c=new Promise((u,h)=>{l.onload=()=>{n.bitmap=l,n.isSvg=!0,u()},a.onload=async()=>{let d=n.svgUrl=a.result;l.src=await s?`${d}#svgView(preserveAspectRatio(none))`:d},l.onerror=a.onerror=h});a.readAsDataURL(i),await c}else n.bitmap=await createImageBitmap(i);n.refCounter=1}catch(i){jt(i),n=null}return o(this,Zn).set(t,n),n&&o(this,Zn).set(n.id,n),n};Vx=wA,Xx=class{constructor(t=128){A(this,en,[]);A(this,uo,!1);A(this,wp);A(this,Pe,-1);g(this,wp,t)}add({cmd:t,undo:e,post:n,mustExec:i,type:s=NaN,overwriteIfSameType:a=!1,keepUndo:l=!1}){if(i&&t(),o(this,uo))return;let c={cmd:t,undo:e,post:n,type:s};if(o(this,Pe)===-1){o(this,en).length>0&&(o(this,en).length=0),g(this,Pe,0),o(this,en).push(c);return}if(a&&o(this,en)[o(this,Pe)].type===s){l&&(c.undo=o(this,en)[o(this,Pe)].undo),o(this,en)[o(this,Pe)]=c;return}let u=o(this,Pe)+1;u===o(this,wp)?o(this,en).splice(0,1):(g(this,Pe,u),u<o(this,en).length&&o(this,en).splice(u)),o(this,en).push(c)}undo(){if(o(this,Pe)===-1)return;g(this,uo,!0);let{undo:t,post:e}=o(this,en)[o(this,Pe)];t(),e?.(),g(this,uo,!1),g(this,Pe,o(this,Pe)-1)}redo(){if(o(this,Pe)<o(this,en).length-1){g(this,Pe,o(this,Pe)+1),g(this,uo,!0);let{cmd:t,post:e}=o(this,en)[o(this,Pe)];t(),e?.(),g(this,uo,!1)}}hasSomethingToUndo(){return o(this,Pe)!==-1}hasSomethingToRedo(){return o(this,Pe)<o(this,en).length-1}cleanType(t){if(o(this,Pe)!==-1){for(let e=o(this,Pe);e>=0;e--)if(o(this,en)[e].type!==t){o(this,en).splice(e+1,o(this,Pe)-e),g(this,Pe,e);return}o(this,en).length=0,g(this,Pe,-1)}}destroy(){g(this,en,null)}};en=new WeakMap,uo=new WeakMap,wp=new WeakMap,Pe=new WeakMap;Kc=class{constructor(t){A(this,Uy);this.buffer=[],this.callbacks=new Map,this.allKeys=new Set;let{isMac:e}=Xe.platform;for(let[n,i,s={}]of t)for(let a of n){let l=a.startsWith("mac+");e&&l?(this.callbacks.set(a.slice(4),{callback:i,options:s}),this.allKeys.add(a.split("+").at(-1))):!e&&!l&&(this.callbacks.set(a,{callback:i,options:s}),this.allKeys.add(a.split("+").at(-1)))}}exec(t,e){if(!this.allKeys.has(e.key))return;let n=this.callbacks.get(v(this,Uy,GT).call(this,e));if(!n)return;let{callback:i,options:{bubbles:s=!1,args:a=[],checker:l=null}}=n;l&&!l(t,e)||(i.bind(t,...a,e)(),s||Be(e))}};Uy=new WeakSet,GT=function(t){t.altKey&&this.buffer.push("alt"),t.ctrlKey&&this.buffer.push("ctrl"),t.metaKey&&this.buffer.push("meta"),t.shiftKey&&this.buffer.push("shift"),this.buffer.push(t.key);let e=this.buffer.join("+");return this.buffer.length=0,e};$y=class $y{get _colors(){let t=new Map([["CanvasText",null],["Canvas",null]]);return _O(t),Ut(this,"_colors",t)}convert(t){let e=Bd(t);if(!window.matchMedia("(forced-colors: active)").matches)return e;for(let[n,i]of this._colors)if(i.every((s,a)=>s===e[a]))return $y._colorsMapping.get(n);return e}getHexCode(t){let e=this._colors.get(t);return e?yt.makeHexColor(...e):t}};U($y,"_colorsMapping",new Map([["CanvasText",[0,0,0]],["Canvas",[255,255,255]]]));Yx=$y,Zu=class Zu{constructor(t,e,n,i,s,a,l,c,u,h,d,f,p,m,y,x){A(this,At);A(this,sh,new AbortController);A(this,Mi,null);A(this,ah,null);A(this,He,new Map);A(this,Re,new Map);A(this,oh,null);A(this,lh,null);A(this,si,null);A(this,ch,null);A(this,pr,new Xx);A(this,vn,null);A(this,ho,null);A(this,fo,null);A(this,po,0);A(this,mo,new Set);A(this,ps,null);A(this,mr,null);A(this,Ol,new Set);U(this,"_editorUndoBar",null);A(this,Ap,!1);A(this,vp,!1);A(this,uh,!1);A(this,Cp,null);A(this,ms,null);A(this,go,null);A(this,hh,null);A(this,yo,!1);A(this,gs,null);A(this,zy,new qx);A(this,aa,!1);A(this,dh,!1);A(this,Ep,!1);A(this,bo,null);A(this,Fl,null);A(this,fh,null);A(this,xo,null);A(this,Tp,null);A(this,cn,Bt.NONE);A(this,fe,new Set);A(this,oa,null);A(this,wo,null);A(this,Ao,null);A(this,Sp,null);A(this,ph,null);A(this,Dp,{isEditing:!1,isEmpty:!0,hasSomethingToUndo:!1,hasSomethingToRedo:!1,hasSelectedEditor:!1,hasSelectedText:!1});A(this,vo,[0,0]);A(this,ys,null);A(this,la,null);A(this,Np,null);A(this,Ip,null);A(this,gr,null);let b=this._signal=o(this,sh).signal;g(this,la,t),g(this,Np,e),g(this,Ip,n),g(this,lh,i),g(this,vn,s),g(this,wo,a),g(this,ph,c),this._eventBus=l,l._on("editingaction",this.onEditingAction.bind(this),{signal:b}),l._on("pagechanging",this.onPageChanging.bind(this),{signal:b}),l._on("scalechanging",this.onScaleChanging.bind(this),{signal:b}),l._on("rotationchanging",this.onRotationChanging.bind(this),{signal:b}),l._on("setpreference",this.onSetPreference.bind(this),{signal:b}),l._on("switchannotationeditorparams",w=>this.updateParams(w.type,w.value),{signal:b}),window.addEventListener("pointerdown",()=>{g(this,dh,!0)},{capture:!0,signal:b}),window.addEventListener("pointerup",()=>{g(this,dh,!1)},{capture:!0,signal:b}),window.addEventListener("beforeunload",v(this,At,HT).bind(this),{capture:!0,signal:b}),v(this,At,VT).call(this),v(this,At,JT).call(this),v(this,At,Zx).call(this),g(this,si,c.annotationStorage),g(this,Cp,c.filterFactory),g(this,Ao,u),g(this,hh,h||null),g(this,Ap,d),g(this,vp,f),g(this,uh,p),g(this,Tp,m||null),this.viewParameters={realScale:ja.PDF_TO_CSS_UNITS,rotation:0},this.isShiftKeyDown=!1,this._editorUndoBar=y||null,this._supportsPinchToZoom=x!==!1,s?.setSidebarUiManager(this)}static get _keyboardManager(){let t=Zu.prototype,e=a=>o(a,la).contains(document.activeElement)&&document.activeElement.tagName!=="BUTTON"&&a.hasSomethingToControl(),n=(a,{target:l})=>{if(l instanceof HTMLInputElement){let{type:c}=l;return c!=="text"&&c!=="number"}return!0},i=this.TRANSLATE_SMALL,s=this.TRANSLATE_BIG;return Ut(this,"_keyboardManager",new Kc([[["ctrl+a","mac+meta+a"],t.selectAll,{checker:n}],[["ctrl+z","mac+meta+z"],t.undo,{checker:n}],[["ctrl+y","ctrl+shift+z","mac+meta+shift+z","ctrl+shift+Z","mac+meta+shift+Z"],t.redo,{checker:n}],[["Backspace","alt+Backspace","ctrl+Backspace","shift+Backspace","mac+Backspace","mac+alt+Backspace","mac+ctrl+Backspace","Delete","ctrl+Delete","shift+Delete","mac+Delete"],t.delete,{checker:n}],[["Enter","mac+Enter"],t.addNewEditorFromKeyboard,{checker:(a,{target:l})=>!(l instanceof HTMLButtonElement)&&o(a,la).contains(l)&&!a.isEnterHandled}],[[" ","mac+ "],t.addNewEditorFromKeyboard,{checker:(a,{target:l})=>!(l instanceof HTMLButtonElement)&&o(a,la).contains(document.activeElement)}],[["Escape","mac+Escape"],t.unselectAll],[["ArrowLeft","mac+ArrowLeft"],t.translateSelectedEditors,{args:[-i,0],checker:e}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],t.translateSelectedEditors,{args:[-s,0],checker:e}],[["ArrowRight","mac+ArrowRight"],t.translateSelectedEditors,{args:[i,0],checker:e}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],t.translateSelectedEditors,{args:[s,0],checker:e}],[["ArrowUp","mac+ArrowUp"],t.translateSelectedEditors,{args:[0,-i],checker:e}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],t.translateSelectedEditors,{args:[0,-s],checker:e}],[["ArrowDown","mac+ArrowDown"],t.translateSelectedEditors,{args:[0,i],checker:e}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],t.translateSelectedEditors,{args:[0,s],checker:e}]]))}destroy(){o(this,gr)?.resolve(),g(this,gr,null),o(this,sh)?.abort(),g(this,sh,null),this._signal=null;for(let t of o(this,Re).values())t.destroy();o(this,Re).clear(),o(this,He).clear(),o(this,Ol).clear(),o(this,xo)?.clear(),g(this,Mi,null),o(this,fe).clear(),o(this,pr).destroy(),o(this,lh)?.destroy(),o(this,vn)?.destroy(),o(this,wo)?.destroy(),o(this,gs)?.hide(),g(this,gs,null),o(this,fh)?.destroy(),g(this,fh,null),g(this,ah,null),o(this,ms)&&(clearTimeout(o(this,ms)),g(this,ms,null)),o(this,ys)&&(clearTimeout(o(this,ys)),g(this,ys,null)),this._editorUndoBar?.destroy(),g(this,ph,null)}combinedSignal(t){return AbortSignal.any([this._signal,t.signal])}get mlManager(){return o(this,Tp)}get useNewAltTextFlow(){return o(this,vp)}get useNewAltTextWhenAddingImage(){return o(this,uh)}get hcmFilter(){return Ut(this,"hcmFilter",o(this,Ao)?o(this,Cp).addHCMFilter(o(this,Ao).foreground,o(this,Ao).background):"none")}get direction(){return Ut(this,"direction",getComputedStyle(o(this,la)).direction)}get _highlightColors(){return Ut(this,"_highlightColors",o(this,hh)?new Map(o(this,hh).split(",").map(t=>(t=t.split("=").map(e=>e.trim()),t[1]=t[1].toUpperCase(),t))):null)}get highlightColors(){let{_highlightColors:t}=this;if(!t)return Ut(this,"highlightColors",null);let e=new Map,n=!!o(this,Ao);for(let[i,s]of t){let a=i.endsWith("_HCM");if(n&&a){e.set(i.replace("_HCM",""),s);continue}!n&&!a&&e.set(i,s)}return Ut(this,"highlightColors",e)}get highlightColorNames(){return Ut(this,"highlightColorNames",this.highlightColors?new Map(Array.from(this.highlightColors,t=>t.reverse())):null)}getNonHCMColor(t){if(!this._highlightColors)return t;let e=this.highlightColorNames.get(t);return this._highlightColors.get(e)||t}getNonHCMColorName(t){return this.highlightColorNames.get(t)||t}setCurrentDrawingSession(t){t?(this.unselectAll(),this.disableUserSelect(!0)):this.disableUserSelect(!1),g(this,fo,t)}setMainHighlightColorPicker(t){g(this,fh,t)}editAltText(t,e=!1){o(this,lh)?.editAltText(this,t,e)}hasCommentManager(){return!!o(this,vn)}editComment(t,e,n,i){o(this,vn)?.showDialog(this,t,e,n,i)}selectComment(t,e){o(this,Re).get(t)?.getEditorByUID(e)?.toggleComment(!0,!0)}updateComment(t){o(this,vn)?.updateComment(t.getData())}updatePopupColor(t){o(this,vn)?.updatePopupColor(t)}removeComment(t){o(this,vn)?.removeComments([t.uid])}deleteComment(t,e){let n=()=>{t.comment=e},i=()=>{this._editorUndoBar?.show(n,"comment"),this.toggleComment(null),t.comment=null};this.addCommands({cmd:i,undo:n,mustExec:!0})}toggleComment(t,e,n=void 0){o(this,vn)?.toggleCommentPopup(t,e,n)}makeCommentColor(t,e){return t&&o(this,vn)?.makeCommentColor(t,e)||null}getCommentDialogElement(){return o(this,vn)?.dialogElement||null}async waitForEditorsRendered(t){if(o(this,Re).has(t-1))return;let{resolve:e,promise:n}=Promise.withResolvers(),i=s=>{s.pageNumber===t&&(this._eventBus._off("editorsrendered",i),e())};this._eventBus.on("editorsrendered",i),await n}getSignature(t){o(this,wo)?.getSignature({uiManager:this,editor:t})}get signatureManager(){return o(this,wo)}switchToMode(t,e){this._eventBus.on("annotationeditormodechanged",e,{once:!0,signal:this._signal}),this._eventBus.dispatch("showannotationeditorui",{source:this,mode:t})}setPreference(t,e){this._eventBus.dispatch("setpreference",{source:this,name:t,value:e})}onSetPreference({name:t,value:e}){t==="enableNewAltTextWhenAddingImage"&&g(this,uh,e)}onPageChanging({pageNumber:t}){g(this,po,t-1)}deletePage(t){for(let e of this.getEditors(t))e.remove();o(this,Re).delete(t),o(this,po)===t&&g(this,po,0)}focusMainContainer(){o(this,la).focus()}findParent(t,e){for(let n of o(this,Re).values()){let{x:i,y:s,width:a,height:l}=n.div.getBoundingClientRect();if(t>=i&&t<=i+a&&e>=s&&e<=s+l)return n}return null}disableUserSelect(t=!1){o(this,Np).classList.toggle("noUserSelect",t)}addShouldRescale(t){o(this,Ol).add(t)}removeShouldRescale(t){o(this,Ol).delete(t)}onScaleChanging({scale:t}){this.commitOrRemove(),this.viewParameters.realScale=t*ja.PDF_TO_CSS_UNITS;for(let e of o(this,Ol))e.onScaleChanging();o(this,fo)?.onScaleChanging()}onRotationChanging({pagesRotation:t}){this.commitOrRemove(),this.viewParameters.rotation=t}highlightSelection(t="",e=!1){let n=document.getSelection();if(!n||n.isCollapsed)return;let{anchorNode:i,anchorOffset:s,focusNode:a,focusOffset:l}=n,c=n.toString(),h=v(this,At,v0).call(this,n).closest(".textLayer"),d=this.getSelectionBoxes(h);if(!d)return;n.empty();let f=v(this,At,Kx).call(this,h),p=o(this,cn)===Bt.NONE,m=()=>{let y=f?.createAndAddNewEditor({x:0,y:0},!1,{methodOfCreation:t,boxes:d,anchorNode:i,anchorOffset:s,focusNode:a,focusOffset:l,text:c});p&&this.showAllEditors("highlight",!0,!0),e&&y?.editComment()};if(p){this.switchToMode(Bt.HIGHLIGHT,m);return}m()}commentSelection(t=""){this.highlightSelection(t,!0)}getAndRemoveDataFromAnnotationStorage(t){if(!o(this,si))return null;let e=`${Jf}${t}`,n=o(this,si).getRawValue(e);return n&&o(this,si).remove(e),n}addToAnnotationStorage(t){!t.isEmpty()&&o(this,si)&&!o(this,si).has(t.id)&&o(this,si).setValue(t.id,t)}a11yAlert(t,e=null){let n=o(this,Ip);n&&(n.setAttribute("data-l10n-id",t),e?n.setAttribute("data-l10n-args",JSON.stringify(e)):n.removeAttribute("data-l10n-args"))}blur(){if(this.isShiftKeyDown=!1,o(this,yo)&&(g(this,yo,!1),v(this,At,Sf).call(this,"main_toolbar")),!this.hasSelection)return;let{activeElement:t}=document;for(let e of o(this,fe))if(e.div.contains(t)){g(this,Fl,[e,t]),e._focusEventsAllowed=!1;break}}focus(){if(!o(this,Fl))return;let[t,e]=o(this,Fl);g(this,Fl,null),e.addEventListener("focusin",()=>{t._focusEventsAllowed=!0},{once:!0,signal:this._signal}),e.focus()}addEditListeners(){v(this,At,Zx).call(this),this.setEditingState(!0)}removeEditListeners(){v(this,At,KT).call(this),this.setEditingState(!1)}dragOver(t){for(let{type:e}of t.dataTransfer.items)for(let n of o(this,mr))if(n.isHandlingMimeForPasting(e)){t.dataTransfer.dropEffect="copy",t.preventDefault();return}}drop(t){for(let e of t.dataTransfer.items)for(let n of o(this,mr))if(n.isHandlingMimeForPasting(e.type)){n.paste(e,this.currentLayer),t.preventDefault();return}}copy(t){if(t.preventDefault(),o(this,Mi)?.commitOrRemove(),!this.hasSelection)return;let e=[];for(let n of o(this,fe)){let i=n.serialize(!0);i&&e.push(i)}e.length!==0&&t.clipboardData.setData("application/pdfjs",JSON.stringify(e))}cut(t){this.copy(t),this.delete()}async paste(t){t.preventDefault();let{clipboardData:e}=t;for(let s of e.items)for(let a of o(this,mr))if(a.isHandlingMimeForPasting(s.type)){a.paste(s,this.currentLayer);return}let n=e.getData("application/pdfjs");if(!n)return;try{n=JSON.parse(n)}catch(s){jt(`paste: "${s.message}".`);return}if(!Array.isArray(n))return;this.unselectAll();let i=this.currentLayer;try{let s=[];for(let c of n){let u=await i.deserialize(c);if(!u)return;s.push(u)}let a=()=>{for(let c of s)v(this,At,Qx).call(this,c);v(this,At,Jx).call(this,s)},l=()=>{for(let c of s)c.remove()};this.addCommands({cmd:a,undo:l,mustExec:!0})}catch(s){jt(`paste: "${s.message}".`)}}keydown(t){!this.isShiftKeyDown&&t.key==="Shift"&&(this.isShiftKeyDown=!0),o(this,cn)!==Bt.NONE&&!this.isEditorHandlingKeyboard&&Zu._keyboardManager.exec(this,t)}keyup(t){this.isShiftKeyDown&&t.key==="Shift"&&(this.isShiftKeyDown=!1,o(this,yo)&&(g(this,yo,!1),v(this,At,Sf).call(this,"main_toolbar")))}onEditingAction({name:t}){switch(t){case"undo":case"redo":case"delete":case"selectAll":this[t]();break;case"highlightSelection":this.highlightSelection("context_menu");break;case"commentSelection":this.commentSelection("context_menu");break}}updatePageIndex(t,e){for(let i of this.getEditors(t))i.pageIndex=e;let n=o(this,oh).get(t);n&&(n.pageIndex=e,o(this,Re).set(e,n),o(this,aa)?n.enable():n.disable())}startUpdatePages(){g(this,oh,new Map(o(this,Re))),o(this,Re).clear()}endUpdatePages(){g(this,oh,null)}clonePage(t,e){for(let n of this.getEditors(t)){let i=n.serialize(n.mode!==Bt.HIGHLIGHT);i&&(i.pageIndex=e,i.id=this.getId(),i.isClone=!0,delete i.popupRef,o(this,si).setValue(i.id,i))}}findClonesForPage(t){let e=[],{pageIndex:n}=t;for(let[i,s]of o(this,si))s.pageIndex===n&&s.isClone&&(o(this,si).remove(i),e.push(t.deserialize(s).then(a=>{a&&(a.isClone=!0,t.addOrRebuild(a))})));return Promise.all(e)}setEditingState(t){t?(v(this,At,XT).call(this),v(this,At,ZT).call(this),v(this,At,ii).call(this,{isEditing:o(this,cn)!==Bt.NONE,isEmpty:v(this,At,Df).call(this),hasSomethingToUndo:o(this,pr).hasSomethingToUndo(),hasSomethingToRedo:o(this,pr).hasSomethingToRedo(),hasSelectedEditor:!1})):(v(this,At,YT).call(this),v(this,At,QT).call(this),v(this,At,ii).call(this,{isEditing:!1}),this.disableUserSelect(!1))}registerEditorTypes(t){if(!o(this,mr)){g(this,mr,t);for(let e of o(this,mr))v(this,At,ea).call(this,e.defaultPropertiesToUpdate)}}getId(){return o(this,zy).id}get currentLayer(){return o(this,Re).get(o(this,po))}getLayer(t){return o(this,Re).get(t)}get currentPageIndex(){return o(this,po)}addLayer(t){o(this,Re).set(t.pageIndex,t),o(this,aa)?t.enable():t.disable()}removeLayer(t){o(this,Re).delete(t.pageIndex)}async updateMode(t,e=null,n=!1,i=!1,s=!1,a=!1){if(o(this,cn)!==t&&!(o(this,gr)&&(await o(this,gr).promise,!o(this,gr)))){if(g(this,gr,Promise.withResolvers()),o(this,fo)?.commitOrRemove(),o(this,cn)===Bt.POPUP&&o(this,vn)?.hideSidebar(),o(this,vn)?.destroyPopup(),g(this,cn,t),t===Bt.NONE){this.setEditingState(!1),v(this,At,eS).call(this);for(let l of o(this,He).values())l.hideStandaloneCommentButton();this._editorUndoBar?.hide(),this.toggleComment(null),o(this,gr).resolve();return}for(let l of o(this,He).values())l.addStandaloneCommentButton();t===Bt.SIGNATURE&&await o(this,wo)?.loadSignatures(),n&&Kn.clearPointerType(),this.setEditingState(!0),await v(this,At,tS).call(this),this.unselectAll();for(let l of o(this,Re).values())l.updateMode(t);if(t===Bt.POPUP){o(this,ah)||g(this,ah,await o(this,ph).getAnnotationsByType(new Set(o(this,mr).map(u=>u._editorType))));let l=new Set,c=[];for(let u of o(this,He).values()){let{annotationElementId:h,hasComment:d,deleted:f}=u;h&&l.add(h),d&&!f&&c.push(u.getData())}for(let u of o(this,ah)){let{id:h,popupRef:d,contentsObj:f}=u;d&&f?.str&&!l.has(h)&&!o(this,mo).has(h)&&c.push(u)}o(this,vn)?.showSidebar(c)}if(!e){i&&this.addNewEditorFromKeyboard(),o(this,gr).resolve();return}for(let l of o(this,He).values())l.uid===e?(this.setSelected(l),a?l.editComment():s?l.enterInEditMode():l.focus()):l.unselect();o(this,gr).resolve()}}addNewEditorFromKeyboard(){this.currentLayer.canCreateNewEmptyEditor()&&this.currentLayer.addNewEditor()}updateToolbar(t){t.mode!==o(this,cn)&&this._eventBus.dispatch("switchannotationeditormode",{source:this,...t})}updateParams(t,e){if(o(this,mr)){switch(t){case Zt.CREATE:this.currentLayer.addNewEditor(e);return;case Zt.HIGHLIGHT_SHOW_ALL:this._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:{type:"highlight",action:"toggle_visibility"}}}),(o(this,Sp)||g(this,Sp,new Map)).set(t,e),this.showAllEditors("highlight",e);break}if(this.hasSelection)for(let n of o(this,fe))n.updateParams(t,e);else for(let n of o(this,mr))n.updateDefaultParams(t,e)}}showAllEditors(t,e,n=!1){for(let s of o(this,He).values())s.editorType===t&&s.show(e);(o(this,Sp)?.get(Zt.HIGHLIGHT_SHOW_ALL)??!0)!==e&&v(this,At,ea).call(this,[[Zt.HIGHLIGHT_SHOW_ALL,e]])}enableWaiting(t=!1){if(o(this,Ep)!==t){g(this,Ep,t);for(let e of o(this,Re).values())t?e.disableClick():e.enableClick(),e.div.classList.toggle("waiting",t)}}*getEditors(t){for(let e of o(this,He).values())e.pageIndex===t&&(yield e)}getEditor(t){return o(this,He).get(t)}addEditor(t){o(this,He).set(t.id,t)}removeEditor(t){t.div.contains(document.activeElement)&&(o(this,ms)&&clearTimeout(o(this,ms)),g(this,ms,setTimeout(()=>{this.focusMainContainer(),g(this,ms,null)},0))),o(this,He).delete(t.id),t.annotationElementId&&o(this,xo)?.delete(t.annotationElementId),this.unselect(t),(!t.annotationElementId||!o(this,mo).has(t.annotationElementId))&&o(this,si)?.remove(t.id)}addDeletedAnnotationElement(t){o(this,mo).add(t.annotationElementId),this.addChangedExistingAnnotation(t),t.deleted=!0}isDeletedAnnotationElement(t){return o(this,mo).has(t)}removeDeletedAnnotationElement(t){o(this,mo).delete(t.annotationElementId),this.removeChangedExistingAnnotation(t),t.deleted=!1}setActiveEditor(t){o(this,Mi)!==t&&(g(this,Mi,t),t&&v(this,At,ea).call(this,t.propertiesToUpdate))}updateUI(t){o(this,At,nS)===t&&v(this,At,ea).call(this,t.propertiesToUpdate)}updateUIForDefaultProperties(t){v(this,At,ea).call(this,t.defaultPropertiesToUpdate)}toggleSelected(t){if(o(this,fe).has(t)){o(this,fe).delete(t),t.unselect(),v(this,At,ii).call(this,{hasSelectedEditor:this.hasSelection});return}o(this,fe).add(t),t.select(),v(this,At,ea).call(this,t.propertiesToUpdate),v(this,At,ii).call(this,{hasSelectedEditor:!0})}setSelected(t){this.updateToolbar({mode:t.mode,editId:t.uid}),o(this,fo)?.commitOrRemove();for(let e of o(this,fe))e!==t&&e.unselect();o(this,vn)?.destroyPopup(),o(this,fe).clear(),o(this,fe).add(t),t.select(),v(this,At,ea).call(this,t.propertiesToUpdate),v(this,At,ii).call(this,{hasSelectedEditor:!0})}isSelected(t){return o(this,fe).has(t)}get firstSelectedEditor(){return o(this,fe).values().next().value}unselect(t){t.unselect(),o(this,fe).delete(t),v(this,At,ii).call(this,{hasSelectedEditor:this.hasSelection})}get hasSelection(){return o(this,fe).size!==0}get isEnterHandled(){return o(this,fe).size===1&&this.firstSelectedEditor.isEnterHandled}undo(){o(this,pr).undo(),v(this,At,ii).call(this,{hasSomethingToUndo:o(this,pr).hasSomethingToUndo(),hasSomethingToRedo:!0,isEmpty:v(this,At,Df).call(this)}),this._editorUndoBar?.hide()}redo(){o(this,pr).redo(),v(this,At,ii).call(this,{hasSomethingToUndo:!0,hasSomethingToRedo:o(this,pr).hasSomethingToRedo(),isEmpty:v(this,At,Df).call(this)})}addCommands(t){o(this,pr).add(t),v(this,At,ii).call(this,{hasSomethingToUndo:!0,hasSomethingToRedo:!1,isEmpty:v(this,At,Df).call(this)})}cleanUndoStack(t){o(this,pr).cleanType(t)}delete(){this.commitOrRemove();let t=this.currentLayer?.endDrawingSession(!0);if(!this.hasSelection&&!t)return;let e=t?[t]:[...o(this,fe)],n=()=>{this._editorUndoBar?.show(i,e.length===1?e[0].editorType:e.length);for(let s of e)s.remove()},i=()=>{for(let s of e)v(this,At,Qx).call(this,s)};this.addCommands({cmd:n,undo:i,mustExec:!0})}commitOrRemove(){o(this,Mi)?.commitOrRemove()}hasSomethingToControl(){return o(this,Mi)||this.hasSelection}selectAll(){for(let t of o(this,fe))t.commit();v(this,At,Jx).call(this,o(this,He).values())}unselectAll(){if(!(o(this,Mi)&&(o(this,Mi).commitOrRemove(),o(this,cn)!==Bt.NONE))&&!o(this,fo)?.commitOrRemove()&&(o(this,vn)?.destroyPopup(),!!this.hasSelection)){for(let t of o(this,fe))t.unselect();o(this,fe).clear(),v(this,At,ii).call(this,{hasSelectedEditor:!1})}}translateSelectedEditors(t,e,n=!1){if(n||this.commitOrRemove(),!this.hasSelection)return;o(this,vo)[0]+=t,o(this,vo)[1]+=e;let[i,s]=o(this,vo),a=[...o(this,fe)],l=1e3;o(this,ys)&&clearTimeout(o(this,ys)),g(this,ys,setTimeout(()=>{g(this,ys,null),o(this,vo)[0]=o(this,vo)[1]=0,this.addCommands({cmd:()=>{for(let c of a)o(this,He).has(c.id)&&(c.translateInPage(i,s),c.translationDone())},undo:()=>{for(let c of a)o(this,He).has(c.id)&&(c.translateInPage(-i,-s),c.translationDone())},mustExec:!1})},l));for(let c of a)c.translateInPage(t,e),c.translationDone()}setUpDragSession(){if(this.hasSelection){this.disableUserSelect(!0),g(this,ps,new Map);for(let t of o(this,fe))o(this,ps).set(t,{savedX:t.x,savedY:t.y,savedPageIndex:t.pageIndex,newX:0,newY:0,newPageIndex:-1})}}endDragSession(){if(!o(this,ps))return!1;this.disableUserSelect(!1);let t=o(this,ps);g(this,ps,null);let e=!1;for(let[{x:i,y:s,pageIndex:a},l]of t)l.newX=i,l.newY=s,l.newPageIndex=a,e||(e=i!==l.savedX||s!==l.savedY||a!==l.savedPageIndex);if(!e)return!1;let n=(i,s,a,l)=>{if(o(this,He).has(i.id)){let c=o(this,Re).get(l);c?i._setParentAndPosition(c,s,a):(i.pageIndex=l,i.x=s,i.y=a)}};return this.addCommands({cmd:()=>{for(let[i,{newX:s,newY:a,newPageIndex:l}]of t)n(i,s,a,l)},undo:()=>{for(let[i,{savedX:s,savedY:a,savedPageIndex:l}]of t)n(i,s,a,l)},mustExec:!0}),!0}dragSelectedEditors(t,e){if(o(this,ps))for(let n of o(this,ps).keys())n.drag(t,e)}rebuild(t){if(t.parent===null){let e=this.getLayer(t.pageIndex);e?(e.changeParent(t),e.addOrRebuild(t)):(this.addEditor(t),this.addToAnnotationStorage(t),t.rebuild())}else t.parent.addOrRebuild(t)}get isEditorHandlingKeyboard(){return this.getActive()?.shouldGetKeyboardEvents()||o(this,fe).size===1&&this.firstSelectedEditor.shouldGetKeyboardEvents()}isActive(t){return o(this,Mi)===t}getActive(){return o(this,Mi)}getMode(){return o(this,cn)}isEditingMode(){return o(this,cn)!==Bt.NONE}get imageManager(){return Ut(this,"imageManager",new Vx)}getSelectionBoxes(t){if(!t)return null;let e=document.getSelection();for(let u=0,h=e.rangeCount;u<h;u++)if(!t.contains(e.getRangeAt(u).commonAncestorContainer))return null;let{x:n,y:i,width:s,height:a}=t.getBoundingClientRect(),l;switch(t.getAttribute("data-main-rotation")){case"90":l=(u,h,d,f)=>({x:(h-i)/a,y:1-(u+d-n)/s,width:f/a,height:d/s});break;case"180":l=(u,h,d,f)=>({x:1-(u+d-n)/s,y:1-(h+f-i)/a,width:d/s,height:f/a});break;case"270":l=(u,h,d,f)=>({x:1-(h+f-i)/a,y:(u-n)/s,width:f/a,height:d/s});break;default:l=(u,h,d,f)=>({x:(u-n)/s,y:(h-i)/a,width:d/s,height:f/a});break}let c=[];for(let u=0,h=e.rangeCount;u<h;u++){let d=e.getRangeAt(u);if(!d.collapsed)for(let{x:f,y:p,width:m,height:y}of d.getClientRects())m===0||y===0||c.push(l(f,p,m,y))}return c.length===0?null:c}addChangedExistingAnnotation({annotationElementId:t,id:e}){(o(this,ch)||g(this,ch,new Map)).set(t,e)}removeChangedExistingAnnotation({annotationElementId:t}){o(this,ch)?.delete(t)}renderAnnotationElement(t){let e=o(this,ch)?.get(t.data.id);if(!e)return;let n=o(this,si).getRawValue(e);n&&(o(this,cn)===Bt.NONE&&!n.hasBeenModified||n.renderAnnotationElement(t))}setMissingCanvas(t,e,n){let i=o(this,xo)?.get(t);i&&(i.setCanvas(e,n),o(this,xo).delete(t))}addMissingCanvas(t,e){(o(this,xo)||g(this,xo,new Map)).set(t,e)}};sh=new WeakMap,Mi=new WeakMap,ah=new WeakMap,He=new WeakMap,Re=new WeakMap,oh=new WeakMap,lh=new WeakMap,si=new WeakMap,ch=new WeakMap,pr=new WeakMap,vn=new WeakMap,ho=new WeakMap,fo=new WeakMap,po=new WeakMap,mo=new WeakMap,ps=new WeakMap,mr=new WeakMap,Ol=new WeakMap,Ap=new WeakMap,vp=new WeakMap,uh=new WeakMap,Cp=new WeakMap,ms=new WeakMap,go=new WeakMap,hh=new WeakMap,yo=new WeakMap,gs=new WeakMap,zy=new WeakMap,aa=new WeakMap,dh=new WeakMap,Ep=new WeakMap,bo=new WeakMap,Fl=new WeakMap,fh=new WeakMap,xo=new WeakMap,Tp=new WeakMap,cn=new WeakMap,fe=new WeakMap,oa=new WeakMap,wo=new WeakMap,Ao=new WeakMap,Sp=new WeakMap,ph=new WeakMap,Dp=new WeakMap,vo=new WeakMap,ys=new WeakMap,la=new WeakMap,Np=new WeakMap,Ip=new WeakMap,gr=new WeakMap,At=new WeakSet,v0=function({anchorNode:t}){return t.nodeType===Node.TEXT_NODE?t.parentElement:t},Kx=function(t){let{currentLayer:e}=this;if(e.hasTextLayer(t))return e;for(let n of o(this,Re).values())if(n.hasTextLayer(t))return n;return null},HT=function(t){this.commitOrRemove(),this.currentLayer?.endDrawingSession(!1)},WT=function(){let t=document.getSelection();if(!t||t.isCollapsed)return;let n=v(this,At,v0).call(this,t).closest(".textLayer"),i=this.getSelectionBoxes(n);i&&(o(this,gs)||g(this,gs,new Hx(this)),o(this,gs).show(n,i,this.direction==="ltr"))},qT=function(){let t=document.getSelection();if(!t||t.isCollapsed){o(this,oa)&&(o(this,gs)?.hide(),g(this,oa,null),v(this,At,ii).call(this,{hasSelectedText:!1}));return}let{anchorNode:e}=t;if(e===o(this,oa))return;let i=v(this,At,v0).call(this,t).closest(".textLayer");if(!i){o(this,oa)&&(o(this,gs)?.hide(),g(this,oa,null),v(this,At,ii).call(this,{hasSelectedText:!1}));return}if(o(this,gs)?.hide(),g(this,oa,e),v(this,At,ii).call(this,{hasSelectedText:!0}),!(o(this,cn)!==Bt.HIGHLIGHT&&o(this,cn)!==Bt.NONE)&&(o(this,cn)===Bt.HIGHLIGHT&&this.showAllEditors("highlight",!0,!0),g(this,yo,this.isShiftKeyDown),!this.isShiftKeyDown)){let s=o(this,cn)===Bt.HIGHLIGHT?v(this,At,Kx).call(this,i):null;if(s?.toggleDrawing(),o(this,dh)){let a=new AbortController,l=this.combinedSignal(a),c=u=>{u.type==="pointerup"&&u.button!==0||(a.abort(),s?.toggleDrawing(!0),u.type==="pointerup"&&v(this,At,Sf).call(this,"main_toolbar"))};window.addEventListener("pointerup",c,{signal:l}),window.addEventListener("blur",c,{signal:l})}else s?.toggleDrawing(!0),v(this,At,Sf).call(this,"main_toolbar")}},Sf=function(t=""){o(this,cn)===Bt.HIGHLIGHT?this.highlightSelection(t):o(this,Ap)&&v(this,At,WT).call(this)},VT=function(){document.addEventListener("selectionchange",v(this,At,qT).bind(this),{signal:this._signal})},XT=function(){if(o(this,go))return;g(this,go,new AbortController);let t=this.combinedSignal(o(this,go));window.addEventListener("focus",this.focus.bind(this),{signal:t}),window.addEventListener("blur",this.blur.bind(this),{signal:t})},YT=function(){o(this,go)?.abort(),g(this,go,null)},Zx=function(){if(o(this,bo))return;g(this,bo,new AbortController);let t=this.combinedSignal(o(this,bo));window.addEventListener("keydown",this.keydown.bind(this),{signal:t}),window.addEventListener("keyup",this.keyup.bind(this),{signal:t})},KT=function(){o(this,bo)?.abort(),g(this,bo,null)},ZT=function(){if(o(this,ho))return;g(this,ho,new AbortController);let t=this.combinedSignal(o(this,ho));document.addEventListener("copy",this.copy.bind(this),{signal:t}),document.addEventListener("cut",this.cut.bind(this),{signal:t}),document.addEventListener("paste",this.paste.bind(this),{signal:t})},QT=function(){o(this,ho)?.abort(),g(this,ho,null)},JT=function(){let t=this._signal;document.addEventListener("dragover",this.dragOver.bind(this),{signal:t}),document.addEventListener("drop",this.drop.bind(this),{signal:t})},ii=function(t){Object.entries(t).some(([n,i])=>o(this,Dp)[n]!==i)&&(this._eventBus.dispatch("editingstateschanged",{source:this,details:Object.assign(o(this,Dp),t)}),o(this,cn)===Bt.HIGHLIGHT&&t.hasSelectedEditor===!1&&v(this,At,ea).call(this,[[Zt.HIGHLIGHT_FREE,!0]]))},ea=function(t){this._eventBus.dispatch("annotationeditorparamschanged",{source:this,details:t})},tS=async function(){if(!o(this,aa)){g(this,aa,!0);let t=[];for(let e of o(this,Re).values())t.push(e.enable());await Promise.all(t);for(let e of o(this,He).values())e.enable()}},eS=function(){if(this.unselectAll(),o(this,aa)){g(this,aa,!1);for(let t of o(this,Re).values())t.disable();for(let t of o(this,He).values())t.disable()}},Qx=function(t){let e=o(this,Re).get(t.pageIndex);e?e.addOrRebuild(t):(this.addEditor(t),this.addToAnnotationStorage(t))},nS=function(){let t=null;for(t of o(this,fe));return t},Df=function(){if(o(this,He).size===0)return!0;if(o(this,He).size===1)for(let t of o(this,He).values())return t.isEmpty();return!1},Jx=function(t){for(let e of o(this,fe))e.unselect();o(this,fe).clear();for(let e of t)e.isEmpty()||(o(this,fe).add(e),e.select());v(this,At,ii).call(this,{hasSelectedEditor:this.hasSelection})},U(Zu,"TRANSLATE_SMALL",1),U(Zu,"TRANSLATE_BIG",10);nl=Zu,ri=class ri{constructor(t){A(this,Kr);A(this,Cn,null);A(this,bs,!1);A(this,Rr,null);A(this,mh,null);A(this,xs,null);A(this,Oi,null);A(this,gh,!1);A(this,ws,null);A(this,Ai,null);A(this,ca,null);A(this,Pl,null);A(this,As,!1);g(this,Ai,t),g(this,As,t._uiManager.useNewAltTextFlow),o(ri,Co)||g(ri,Co,Object.freeze({added:"pdfjs-editor-new-alt-text-added-button","added-label":"pdfjs-editor-new-alt-text-added-button-label",missing:"pdfjs-editor-new-alt-text-missing-button","missing-label":"pdfjs-editor-new-alt-text-missing-button-label",review:"pdfjs-editor-new-alt-text-to-review-button","review-label":"pdfjs-editor-new-alt-text-to-review-button-label"}))}static initialize(t){ri._l10n??(ri._l10n=t)}async render(){let t=g(this,Rr,document.createElement("button"));t.className="altText",t.tabIndex="0";let e=g(this,mh,document.createElement("span"));t.append(e),o(this,As)?(t.classList.add("new"),t.setAttribute("data-l10n-id",o(ri,Co).missing),e.setAttribute("data-l10n-id",o(ri,Co)["missing-label"])):(t.setAttribute("data-l10n-id","pdfjs-editor-alt-text-button"),e.setAttribute("data-l10n-id","pdfjs-editor-alt-text-button-label"));let n=o(this,Ai)._uiManager._signal;t.addEventListener("contextmenu",tr,{signal:n}),t.addEventListener("pointerdown",s=>s.stopPropagation(),{signal:n});let i=s=>{s.preventDefault(),o(this,Ai)._uiManager.editAltText(o(this,Ai)),o(this,As)&&o(this,Ai)._reportTelemetry({action:"pdfjs.image.alt_text.image_status_label_clicked",data:{label:o(this,Kr,Nf)}})};return t.addEventListener("click",i,{capture:!0,signal:n}),t.addEventListener("keydown",s=>{s.target===t&&s.key==="Enter"&&(g(this,gh,!0),i(s))},{signal:n}),await v(this,Kr,C0).call(this),t}finish(){o(this,Rr)&&(o(this,Rr).focus({focusVisible:o(this,gh)}),g(this,gh,!1))}isEmpty(){return o(this,As)?o(this,Cn)===null:!o(this,Cn)&&!o(this,bs)}hasData(){return o(this,As)?o(this,Cn)!==null||!!o(this,ca):this.isEmpty()}get guessedText(){return o(this,ca)}async setGuessedText(t){o(this,Cn)===null&&(g(this,ca,t),g(this,Pl,await ri._l10n.get("pdfjs-editor-new-alt-text-generated-alt-text-with-disclaimer",{generatedAltText:t})),v(this,Kr,C0).call(this))}toggleAltTextBadge(t=!1){if(!o(this,As)||o(this,Cn)){o(this,ws)?.remove(),g(this,ws,null);return}if(!o(this,ws)){let e=g(this,ws,document.createElement("div"));e.className="noAltTextBadge",o(this,Ai).div.append(e)}o(this,ws).classList.toggle("hidden",!t)}serialize(t){let e=o(this,Cn);return!t&&o(this,ca)===e&&(e=o(this,Pl)),{altText:e,decorative:o(this,bs),guessedText:o(this,ca),textWithDisclaimer:o(this,Pl)}}get data(){return{altText:o(this,Cn),decorative:o(this,bs)}}set data({altText:t,decorative:e,guessedText:n,textWithDisclaimer:i,cancel:s=!1}){n&&(g(this,ca,n),g(this,Pl,i)),!(o(this,Cn)===t&&o(this,bs)===e)&&(s||(g(this,Cn,t),g(this,bs,e)),v(this,Kr,C0).call(this))}toggle(t=!1){o(this,Rr)&&(!t&&o(this,Oi)&&(clearTimeout(o(this,Oi)),g(this,Oi,null)),o(this,Rr).disabled=!t)}shown(){o(this,Ai)._reportTelemetry({action:"pdfjs.image.alt_text.image_status_label_displayed",data:{label:o(this,Kr,Nf)}})}destroy(){o(this,Rr)?.remove(),g(this,Rr,null),g(this,mh,null),g(this,xs,null),o(this,ws)?.remove(),g(this,ws,null)}};Cn=new WeakMap,bs=new WeakMap,Rr=new WeakMap,mh=new WeakMap,xs=new WeakMap,Oi=new WeakMap,gh=new WeakMap,ws=new WeakMap,Ai=new WeakMap,ca=new WeakMap,Pl=new WeakMap,As=new WeakMap,Co=new WeakMap,Kr=new WeakSet,Nf=function(){return o(this,Cn)&&"added"||o(this,Cn)===null&&this.guessedText&&"review"||"missing"},C0=async function(){let t=o(this,Rr);if(!t)return;if(o(this,As)){if(t.classList.toggle("done",!!o(this,Cn)),t.setAttribute("data-l10n-id",o(ri,Co)[o(this,Kr,Nf)]),o(this,mh)?.setAttribute("data-l10n-id",o(ri,Co)[`${o(this,Kr,Nf)}-label`]),!o(this,Cn)){o(this,xs)?.remove();return}}else{if(!o(this,Cn)&&!o(this,bs)){t.classList.remove("done"),o(this,xs)?.remove();return}t.classList.add("done"),t.setAttribute("data-l10n-id","pdfjs-editor-alt-text-edit-button")}let e=o(this,xs);if(!e){g(this,xs,e=document.createElement("span")),e.className="tooltip",e.setAttribute("role","tooltip"),e.id=`alt-text-tooltip-${o(this,Ai).id}`;let i=100,s=o(this,Ai)._uiManager._signal;s.addEventListener("abort",()=>{clearTimeout(o(this,Oi)),g(this,Oi,null)},{once:!0}),t.addEventListener("mouseenter",()=>{g(this,Oi,setTimeout(()=>{g(this,Oi,null),o(this,xs).classList.add("show"),o(this,Ai)._reportTelemetry({action:"alt_text_tooltip"})},i))},{signal:s}),t.addEventListener("mouseleave",()=>{o(this,Oi)&&(clearTimeout(o(this,Oi)),g(this,Oi,null)),o(this,xs)?.classList.remove("show")},{signal:s})}o(this,bs)?e.setAttribute("data-l10n-id","pdfjs-editor-alt-text-decorative-tooltip"):(e.removeAttribute("data-l10n-id"),e.textContent=o(this,Cn)),e.parentNode||t.append(e),o(this,Ai).getElementForAltText()?.setAttribute("aria-describedby",e.id)},A(ri,Co,null),U(ri,"_l10n",null);uy=ri,Yu=class{constructor(t){A(this,_p);A(this,Ln,null);A(this,yr,null);A(this,Rl,!1);A(this,Ee,null);A(this,kp,null);A(this,Eo,null);A(this,br,null);A(this,To,null);A(this,So,!1);A(this,Ll,null);g(this,Ee,t)}renderForToolbar(){let t=g(this,yr,document.createElement("button"));return t.className="comment",v(this,_p,tw).call(this,t,!1)}renderForStandalone(){let t=g(this,Ln,document.createElement("button"));t.className="annotationCommentButton";let e=o(this,Ee).commentButtonPosition;if(e){let{style:n}=t;n.insetInlineEnd=`calc(${100*(o(this,Ee)._uiManager.direction==="ltr"?1-e[0]:e[0])}% - var(--comment-button-dim))`,n.top=`calc(${100*e[1]}% - var(--comment-button-dim))`;let i=o(this,Ee).commentButtonColor;i&&(n.backgroundColor=i)}return v(this,_p,tw).call(this,t,!0)}focusButton(){setTimeout(()=>{(o(this,Ln)??o(this,yr))?.focus()},0)}onUpdatedColor(){if(!o(this,Ln))return;let t=o(this,Ee).commentButtonColor;t&&(o(this,Ln).style.backgroundColor=t),o(this,Ee)._uiManager.updatePopupColor(o(this,Ee))}get commentButtonWidth(){return(o(this,Ln)?.getBoundingClientRect().width??0)/o(this,Ee).parent.boundingClientRect.width}get commentPopupPositionInLayer(){if(o(this,Ll))return o(this,Ll);if(!o(this,Ln))return null;let{x:t,y:e,height:n}=o(this,Ln).getBoundingClientRect(),{x:i,y:s,width:a,height:l}=o(this,Ee).parent.boundingClientRect;return[(t-i)/a,(e+n-s)/l]}set commentPopupPositionInLayer(t){g(this,Ll,t)}hasDefaultPopupPosition(){return o(this,Ll)===null}removeStandaloneCommentButton(){o(this,Ln)?.remove(),g(this,Ln,null)}removeToolbarCommentButton(){o(this,yr)?.remove(),g(this,yr,null)}setCommentButtonStates({selected:t,hasPopup:e}){o(this,Ln)&&(o(this,Ln).classList.toggle("selected",t),o(this,Ln).ariaExpanded=e)}edit(t){let e=this.commentPopupPositionInLayer,n,i;if(e)[n,i]=e;else{[n,i]=o(this,Ee).commentButtonPosition;let{width:h,height:d,x:f,y:p}=o(this,Ee);n=f+n*h,i=p+i*d}let s=o(this,Ee).parent.boundingClientRect,{x:a,y:l,width:c,height:u}=s;o(this,Ee)._uiManager.editComment(o(this,Ee),a+n*c,l+i*u,{...t,parentDimensions:s})}finish(){o(this,yr)&&(o(this,yr).focus({focusVisible:o(this,Rl)}),g(this,Rl,!1))}isDeleted(){return o(this,So)||o(this,br)===""}isEmpty(){return o(this,br)===null}hasBeenEdited(){return this.isDeleted()||o(this,br)!==o(this,kp)}serialize(){return this.data}get data(){return{text:o(this,br),richText:o(this,Eo),date:o(this,To),deleted:this.isDeleted()}}set data(t){if(t!==o(this,br)&&g(this,Eo,null),t===null){g(this,br,""),g(this,So,!0);return}g(this,br,t),g(this,To,new Date),g(this,So,!1)}restoreData({text:t,richText:e,date:n}){g(this,br,t),g(this,Eo,e),g(this,To,n),g(this,So,!1)}setInitialText(t,e=null){g(this,kp,t),this.data=t,g(this,To,null),g(this,Eo,e)}shown(){}destroy(){o(this,yr)?.remove(),g(this,yr,null),o(this,Ln)?.remove(),g(this,Ln,null),g(this,br,""),g(this,Eo,null),g(this,To,null),g(this,Ee,null),g(this,Rl,!1),g(this,So,!1)}};Ln=new WeakMap,yr=new WeakMap,Rl=new WeakMap,Ee=new WeakMap,kp=new WeakMap,Eo=new WeakMap,br=new WeakMap,To=new WeakMap,So=new WeakMap,Ll=new WeakMap,_p=new WeakSet,tw=function(t,e){if(!o(this,Ee)._uiManager.hasCommentManager())return null;t.tabIndex="0",t.ariaHasPopup="dialog",e?(t.ariaControls="commentPopup",t.setAttribute("data-l10n-id","pdfjs-show-comment-button")):(t.ariaControlsElements=[o(this,Ee)._uiManager.getCommentDialogElement()],t.setAttribute("data-l10n-id","pdfjs-editor-add-comment-button"));let n=o(this,Ee)._uiManager._signal;if(!(n instanceof AbortSignal)||n.aborted)return t;t.addEventListener("contextmenu",tr,{signal:n}),e&&(t.addEventListener("focusin",s=>{o(this,Ee)._focusEventsAllowed=!1,Be(s)},{capture:!0,signal:n}),t.addEventListener("focusout",s=>{o(this,Ee)._focusEventsAllowed=!0,Be(s)},{capture:!0,signal:n})),t.addEventListener("pointerdown",s=>s.stopPropagation(),{signal:n});let i=s=>{s.preventDefault(),t===o(this,yr)?this.edit():o(this,Ee).toggleComment(!0)};return t.addEventListener("click",i,{capture:!0,signal:n}),t.addEventListener("keydown",s=>{s.target===t&&s.key==="Enter"&&(g(this,Rl,!0),i(s))},{signal:n}),t.addEventListener("pointerenter",()=>{o(this,Ee).toggleComment(!1,!0)},{signal:n}),t.addEventListener("pointerleave",()=>{o(this,Ee).toggleComment(!1,!1)},{signal:n}),t};AA=class AA{constructor({container:t,isPinchingDisabled:e=null,isPinchingStopped:n=null,onPinchStart:i=null,onPinching:s=null,onPinchEnd:a=null,signal:l}){A(this,il);A(this,yh);A(this,Bl,!1);A(this,Mp,null);A(this,Op);A(this,Fp);A(this,Pp);A(this,Rp);A(this,ua,null);A(this,Ul);A(this,ha,null);A(this,$l);A(this,da,null);g(this,yh,t),g(this,Mp,n),g(this,Op,e),g(this,Fp,i),g(this,Pp,s),g(this,Rp,a),g(this,$l,new AbortController),g(this,Ul,AbortSignal.any([l,o(this,$l).signal])),t.addEventListener("touchstart",v(this,il,iS).bind(this),{passive:!1,signal:o(this,Ul)})}get MIN_TOUCH_DISTANCE_TO_PINCH(){return 35/Ls.pixelRatio}destroy(){o(this,$l)?.abort(),g(this,$l,null),o(this,ua)?.abort(),g(this,ua,null)}};yh=new WeakMap,Bl=new WeakMap,Mp=new WeakMap,Op=new WeakMap,Fp=new WeakMap,Pp=new WeakMap,Rp=new WeakMap,ua=new WeakMap,Ul=new WeakMap,ha=new WeakMap,$l=new WeakMap,da=new WeakMap,il=new WeakSet,iS=function(t){var i,s,a;if((i=o(this,Op))!=null&&i.call(this))return;if(t.touches.length===1){if(o(this,ua))return;let l=g(this,ua,new AbortController),c=AbortSignal.any([o(this,Ul),l.signal]),u=o(this,yh),h={capture:!0,signal:c,passive:!1},d=f=>{f.pointerType==="touch"&&(o(this,ua)?.abort(),g(this,ua,null))};u.addEventListener("pointerdown",f=>{f.pointerType==="touch"&&(Be(f),d(f))},h),u.addEventListener("pointerup",d,h),u.addEventListener("pointercancel",d,h);return}if(!o(this,da)){g(this,da,new AbortController);let l=AbortSignal.any([o(this,Ul),o(this,da).signal]),c=o(this,yh),u={signal:l,capture:!1,passive:!1};c.addEventListener("touchmove",v(this,il,rS).bind(this),u);let h=v(this,il,sS).bind(this);c.addEventListener("touchend",h,u),c.addEventListener("touchcancel",h,u),u.capture=!0,c.addEventListener("pointerdown",Be,u),c.addEventListener("pointermove",Be,u),c.addEventListener("pointercancel",Be,u),c.addEventListener("pointerup",Be,u),(s=o(this,Fp))==null||s.call(this)}if(Be(t),t.touches.length!==2||(a=o(this,Mp))!=null&&a.call(this)){g(this,ha,null);return}let[e,n]=t.touches;e.identifier>n.identifier&&([e,n]=[n,e]),g(this,ha,{touch0X:e.screenX,touch0Y:e.screenY,touch1X:n.screenX,touch1Y:n.screenY})},rS=function(t){var E;if(!o(this,ha)||t.touches.length!==2)return;Be(t);let[e,n]=t.touches;e.identifier>n.identifier&&([e,n]=[n,e]);let{screenX:i,screenY:s}=e,{screenX:a,screenY:l}=n,c=o(this,ha),{touch0X:u,touch0Y:h,touch1X:d,touch1Y:f}=c,p=d-u,m=f-h,y=a-i,x=l-s,b=Math.hypot(y,x)||1,w=Math.hypot(p,m)||1;if(!o(this,Bl)&&Math.abs(w-b)<=AA.MIN_TOUCH_DISTANCE_TO_PINCH)return;if(c.touch0X=i,c.touch0Y=s,c.touch1X=a,c.touch1Y=l,!o(this,Bl)){g(this,Bl,!0);return}let C=[(i+a)/2,(s+l)/2];(E=o(this,Pp))==null||E.call(this,C,w,b)},sS=function(t){var e;t.touches.length>=2||(o(this,da)&&(o(this,da).abort(),g(this,da,null),(e=o(this,Rp))==null||e.call(this)),o(this,ha)&&(Be(t),g(this,ha,null),g(this,Bl,!1)))};ip=AA,zt=class zt{constructor(t){A(this,Rt);A(this,zl,null);A(this,Lr,null);A(this,ke,null);A(this,pe,null);A(this,fa,null);A(this,bh,!1);A(this,Do,null);A(this,Lp,"");A(this,Bn,null);A(this,jl,null);A(this,pa,null);A(this,xr,null);A(this,No,null);A(this,Bp,"");A(this,Gl,!1);A(this,Fi,null);A(this,Up,!1);A(this,Hl,!1);A(this,ma,!1);A(this,vs,null);A(this,xh,0);A(this,wh,0);A(this,wr,null);A(this,Wl,null);U(this,"isSelected",!1);U(this,"_isCopy",!1);U(this,"_editToolbar",null);U(this,"_initialOptions",Object.create(null));U(this,"_initialData",null);U(this,"_isVisible",!0);U(this,"_uiManager",null);U(this,"_focusEventsAllowed",!0);A(this,$p,!1);A(this,jy,zt._zIndex++);this.parent=t.parent,this.id=t.id,this.width=this.height=null,this.pageIndex=t.parent.pageIndex,this.name=t.name,this.div=null,this._uiManager=t.uiManager,this.annotationElementId=null,this._willKeepAspectRatio=!1,this._initialOptions.isCentered=t.isCentered,this._structTreeParentId=null,this.annotationElementId=t.annotationElementId||null,this.creationDate=t.creationDate||new Date,this.modificationDate=t.modificationDate||null,this.canAddComment=!0;let{rotation:e,rawDims:{pageWidth:n,pageHeight:i,pageX:s,pageY:a}}=this.parent.viewport;this.rotation=e,this.pageRotation=(360+e-this._uiManager.viewParameters.rotation)%360,this.pageDimensions=[n,i],this.pageTranslation=[s,a];let[l,c]=this.parentDimensions;this.x=t.x/l,this.y=t.y/c,this.isAttachedToDOM=!1,this.deleted=!1}static get _resizerKeyboardManager(){let t=zt.prototype._resizeWithKeyboard,e=nl.TRANSLATE_SMALL,n=nl.TRANSLATE_BIG;return Ut(this,"_resizerKeyboardManager",new Kc([[["ArrowLeft","mac+ArrowLeft"],t,{args:[-e,0]}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],t,{args:[-n,0]}],[["ArrowRight","mac+ArrowRight"],t,{args:[e,0]}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],t,{args:[n,0]}],[["ArrowUp","mac+ArrowUp"],t,{args:[0,-e]}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],t,{args:[0,-n]}],[["ArrowDown","mac+ArrowDown"],t,{args:[0,e]}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],t,{args:[0,n]}],[["Escape","mac+Escape"],zt.prototype._stopResizingWithKeyboard]]))}updatePageIndex(t){this.pageIndex=t}get editorType(){return Object.getPrototypeOf(this).constructor._type}get mode(){return Object.getPrototypeOf(this).constructor._editorType}static get isDrawer(){return!1}static get _defaultLineColor(){return Ut(this,"_defaultLineColor",this._colorManager.getHexCode("CanvasText"))}static deleteAnnotationElement(t){let e=new lw({id:t._uiManager.getId(),parent:t.parent,uiManager:t._uiManager});e.annotationElementId=t.annotationElementId,e.deleted=!0,e._uiManager.addToAnnotationStorage(e)}static initialize(t,e){if(zt._l10n??(zt._l10n=t),zt._l10nResizer||(zt._l10nResizer=Object.freeze({topLeft:"pdfjs-editor-resizer-top-left",topMiddle:"pdfjs-editor-resizer-top-middle",topRight:"pdfjs-editor-resizer-top-right",middleRight:"pdfjs-editor-resizer-middle-right",bottomRight:"pdfjs-editor-resizer-bottom-right",bottomMiddle:"pdfjs-editor-resizer-bottom-middle",bottomLeft:"pdfjs-editor-resizer-bottom-left",middleLeft:"pdfjs-editor-resizer-middle-left"})),zt._borderLineWidth!==-1)return;let n=getComputedStyle(document.documentElement);zt._borderLineWidth=parseFloat(n.getPropertyValue("--outline-width"))||0}static updateDefaultParams(t,e){}static get defaultPropertiesToUpdate(){return[]}static isHandlingMimeForPasting(t){return!1}static paste(t,e){ue("Not implemented")}get propertiesToUpdate(){return[]}get _isDraggable(){return o(this,$p)}set _isDraggable(t){g(this,$p,t),this.div?.classList.toggle("draggable",t)}get uid(){return this.annotationElementId||this.id}get isEnterHandled(){return!0}center(){let[t,e]=this.pageDimensions;switch(this.parentRotation){case 90:this.x-=this.height*e/(t*2),this.y+=this.width*t/(e*2);break;case 180:this.x+=this.width/2,this.y+=this.height/2;break;case 270:this.x+=this.height*e/(t*2),this.y-=this.width*t/(e*2);break;default:this.x-=this.width/2,this.y-=this.height/2;break}this.fixAndSetPosition()}addCommands(t){this._uiManager.addCommands(t)}get currentLayer(){return this._uiManager.currentLayer}setInBackground(){this.div.style.zIndex=0}setInForeground(){this.div.style.zIndex=o(this,jy)}setParent(t){t!==null?(this.pageIndex=t.pageIndex,this.pageDimensions=t.pageDimensions):(v(this,Rt,If).call(this),o(this,xr)?.remove(),g(this,xr,null)),this.parent=t}focusin(t){this._focusEventsAllowed&&(o(this,Gl)?g(this,Gl,!1):this.parent.setSelected(this))}focusout(t){!this._focusEventsAllowed||!this.isAttachedToDOM||t.relatedTarget?.closest(`#${this.id}`)||(t.preventDefault(),this.parent?.isMultipleSelection||this.commitOrRemove())}commitOrRemove(){this.isEmpty()?this.remove():this.commit()}commit(){this.isInEditMode()&&this.addToAnnotationStorage()}addToAnnotationStorage(){this._uiManager.addToAnnotationStorage(this)}setAt(t,e,n,i){let[s,a]=this.parentDimensions;[n,i]=this.screenToPageTranslation(n,i),this.x=(t+n)/s,this.y=(e+i)/a,this.fixAndSetPosition()}_moveAfterPaste(t,e){if(this.isClone){delete this.isClone;return}let[n,i]=this.parentDimensions;this.setAt(t*n,e*i,this.width*n,this.height*i),this._onTranslated()}translate(t,e){v(this,Rt,ew).call(this,this.parentDimensions,t,e)}translateInPage(t,e){o(this,Fi)||g(this,Fi,[this.x,this.y,this.width,this.height]),v(this,Rt,ew).call(this,this.pageDimensions,t,e),this.div.scrollIntoView({block:"nearest"})}translationDone(){this._onTranslated(this.x,this.y)}drag(t,e){o(this,Fi)||g(this,Fi,[this.x,this.y,this.width,this.height]);let{div:n,parentDimensions:[i,s]}=this;if(this.x+=t/i,this.y+=e/s,this.parent&&(this.x<0||this.x>1||this.y<0||this.y>1)){let{x:d,y:f}=this.div.getBoundingClientRect();this.parent.findNewParent(this,d,f)&&(this.x-=Math.floor(this.x),this.y-=Math.floor(this.y))}let{x:a,y:l}=this,[c,u]=this.getBaseTranslation();a+=c,l+=u;let{style:h}=n;h.left=`${(100*a).toFixed(2)}%`,h.top=`${(100*l).toFixed(2)}%`,this._onTranslating(a,l),n.scrollIntoView({block:"nearest"})}_onTranslating(t,e){}_onTranslated(t,e){}get _hasBeenMoved(){return!!o(this,Fi)&&(o(this,Fi)[0]!==this.x||o(this,Fi)[1]!==this.y)}get _hasBeenResized(){return!!o(this,Fi)&&(o(this,Fi)[2]!==this.width||o(this,Fi)[3]!==this.height)}getBaseTranslation(){let[t,e]=this.parentDimensions,{_borderLineWidth:n}=zt,i=n/t,s=n/e;switch(this.rotation){case 90:return[-i,s];case 180:return[i,s];case 270:return[i,-s];default:return[-i,-s]}}get _mustFixPosition(){return!0}fixAndSetPosition(t=this.rotation){let{div:{style:e},pageDimensions:[n,i]}=this,{x:s,y:a,width:l,height:c}=this;if(l*=n,c*=i,s*=n,a*=i,this._mustFixPosition)switch(t){case 0:s=yn(s,0,n-l),a=yn(a,0,i-c);break;case 90:s=yn(s,0,n-c),a=yn(a,l,i);break;case 180:s=yn(s,l,n),a=yn(a,c,i);break;case 270:s=yn(s,c,n),a=yn(a,0,i-l);break}this.x=s/=n,this.y=a/=i;let[u,h]=this.getBaseTranslation();s+=u,a+=h,e.left=`${(100*s).toFixed(2)}%`,e.top=`${(100*a).toFixed(2)}%`,this.moveInDOM()}screenToPageTranslation(t,e){var n;return v(n=zt,zp,nw).call(n,t,e,this.parentRotation)}pageTranslationToScreen(t,e){var n;return v(n=zt,zp,nw).call(n,t,e,360-this.parentRotation)}get parentScale(){return this._uiManager.viewParameters.realScale}get parentRotation(){return(this._uiManager.viewParameters.rotation+this.pageRotation)%360}get parentDimensions(){let{parentScale:t,pageDimensions:[e,n]}=this;return[e*t,n*t]}setDims(){let{div:{style:t},width:e,height:n}=this;t.width=`${(100*e).toFixed(2)}%`,t.height=`${(100*n).toFixed(2)}%`}getInitialTranslation(){return[0,0]}_onResized(){}static _round(t){return Math.round(t*1e4)/1e4}_onResizing(){}altTextFinish(){o(this,ke)?.finish()}get toolbarButtons(){return null}async addEditToolbar(){if(this._editToolbar||o(this,Hl))return this._editToolbar;this._editToolbar=new Gx(this),this.div.append(this._editToolbar.render());let{toolbarButtons:t}=this;if(t)for(let[e,n]of t)await this._editToolbar.addButton(e,n);return this.hasComment||this._editToolbar.addButton("comment",this.addCommentButton()),this._editToolbar.addButton("delete"),this._editToolbar}addCommentButtonInToolbar(){this._editToolbar?.addButtonBefore("comment",this.addCommentButton(),".deleteButton")}removeCommentButtonFromToolbar(){this._editToolbar?.removeButton("comment")}removeEditToolbar(){this._editToolbar?.remove(),this._editToolbar=null,o(this,ke)?.destroy()}addContainer(t){let e=this._editToolbar?.div;e?e.before(t):this.div.append(t)}getClientDimensions(){return this.div.getBoundingClientRect()}createAltText(){return o(this,ke)||(uy.initialize(zt._l10n),g(this,ke,new uy(this)),o(this,zl)&&(o(this,ke).data=o(this,zl),g(this,zl,null))),o(this,ke)}get altTextData(){return o(this,ke)?.data}set altTextData(t){o(this,ke)&&(o(this,ke).data=t)}get guessedAltText(){return o(this,ke)?.guessedText}async setGuessedAltText(t){await o(this,ke)?.setGuessedText(t)}serializeAltText(t){return o(this,ke)?.serialize(t)}hasAltText(){return!!o(this,ke)&&!o(this,ke).isEmpty()}hasAltTextData(){return o(this,ke)?.hasData()??!1}focusCommentButton(){o(this,pe)?.focusButton()}addCommentButton(){return this.canAddComment?o(this,pe)||g(this,pe,new Yu(this)):null}addStandaloneCommentButton(){if(this._uiManager.hasCommentManager()){if(o(this,fa)){this._uiManager.isEditingMode()&&o(this,fa).classList.remove("hidden");return}this.hasComment&&(g(this,fa,o(this,pe).renderForStandalone()),this.div.append(o(this,fa)))}}removeStandaloneCommentButton(){o(this,pe).removeStandaloneCommentButton(),g(this,fa,null)}hideStandaloneCommentButton(){o(this,fa)?.classList.add("hidden")}get comment(){if(!o(this,pe))return null;let{data:{richText:t,text:e,date:n,deleted:i}}=o(this,pe);return{text:e,richText:t,date:n,deleted:i,color:this.getNonHCMColor(),opacity:this.opacity??1}}set comment(t){o(this,pe)||g(this,pe,new Yu(this)),typeof t=="object"&&t!==null?o(this,pe).restoreData(t):o(this,pe).data=t,this.hasComment?(this.removeCommentButtonFromToolbar(),this.addStandaloneCommentButton(),this._uiManager.updateComment(this)):(this.addCommentButtonInToolbar(),this.removeStandaloneCommentButton(),this._uiManager.removeComment(this))}setCommentData({comment:t,popupRef:e,richText:n}){if(!e||(o(this,pe)||g(this,pe,new Yu(this)),o(this,pe).setInitialText(t,n),!this.annotationElementId))return;let i=this._uiManager.getAndRemoveDataFromAnnotationStorage(this.annotationElementId);i&&this.updateFromAnnotationLayer(i)}get hasEditedComment(){return o(this,pe)?.hasBeenEdited()}get hasDeletedComment(){return o(this,pe)?.isDeleted()}get hasComment(){return!!o(this,pe)&&!o(this,pe).isEmpty()&&!o(this,pe).isDeleted()}async editComment(t){o(this,pe)||g(this,pe,new Yu(this)),o(this,pe).edit(t)}toggleComment(t,e=void 0){this.hasComment&&this._uiManager.toggleComment(this,t,e)}setSelectedCommentButton(t){o(this,pe).setSelectedButton(t)}addComment(t){if(this.hasEditedComment){let[,,,i]=t.rect,[s]=this.pageDimensions,[a]=this.pageTranslation,l=a+s+1,c=i-100,u=l+180;t.popup={contents:this.comment.text,deleted:this.comment.deleted,rect:[l,c,u,i]}}}updateFromAnnotationLayer({popup:{contents:t,deleted:e}}){o(this,pe).data=e?null:t}get parentBoundingClientRect(){return this.parent.boundingClientRect}render(){let t=this.div=document.createElement("div");t.setAttribute("data-editor-rotation",(360-this.rotation)%360),t.className=this.name,t.setAttribute("id",this.id),t.tabIndex=o(this,bh)?-1:0,t.setAttribute("role","application"),this.defaultL10nId&&t.setAttribute("data-l10n-id",this.defaultL10nId),this._isVisible||t.classList.add("hidden"),this.setInForeground(),v(this,Rt,aw).call(this);let[e,n]=this.parentDimensions;this.parentRotation%180!==0&&(t.style.maxWidth=`${(100*n/e).toFixed(2)}%`,t.style.maxHeight=`${(100*e/n).toFixed(2)}%`);let[i,s]=this.getInitialTranslation();return this.translate(i,s),jT(this,t,["keydown","pointerdown","dblclick"]),this.isResizable&&this._uiManager._supportsPinchToZoom&&(o(this,Wl)||g(this,Wl,new ip({container:t,isPinchingDisabled:()=>!this.isSelected,onPinchStart:v(this,Rt,lS).bind(this),onPinching:v(this,Rt,cS).bind(this),onPinchEnd:v(this,Rt,uS).bind(this),signal:this._uiManager._signal}))),this.addStandaloneCommentButton(),this._uiManager._editorUndoBar?.hide(),t}pointerdown(t){let{isMac:e}=Xe.platform;if(t.button!==0||t.ctrlKey&&e){t.preventDefault();return}if(g(this,Gl,!0),this._isDraggable){v(this,Rt,hS).call(this,t);return}v(this,Rt,sw).call(this,t)}_onStartDragging(){}_onStopDragging(){}moveInDOM(){o(this,vs)&&clearTimeout(o(this,vs)),g(this,vs,setTimeout(()=>{g(this,vs,null),this.parent?.moveEditorInDOM(this)},0))}_setParentAndPosition(t,e,n){t.changeParent(this),this.x=e,this.y=n,this.fixAndSetPosition(),this._onTranslated()}getRect(t,e,n=this.rotation){let i=this.parentScale,[s,a]=this.pageDimensions,[l,c]=this.pageTranslation,u=t/i,h=e/i,d=this.x*s,f=this.y*a,p=this.width*s,m=this.height*a;switch(n){case 0:return[d+u+l,a-f-h-m+c,d+u+p+l,a-f-h+c];case 90:return[d+h+l,a-f+u+c,d+h+m+l,a-f+u+p+c];case 180:return[d-u-p+l,a-f+h+c,d-u+l,a-f+h+m+c];case 270:return[d-h-m+l,a-f-u-p+c,d-h+l,a-f-u+c];default:throw new Error("Invalid rotation")}}getRectInCurrentCoords(t,e){let[n,i,s,a]=t,l=s-n,c=a-i;switch(this.rotation){case 0:return[n,e-a,l,c];case 90:return[n,e-i,c,l];case 180:return[s,e-i,l,c];case 270:return[s,e-a,c,l];default:throw new Error("Invalid rotation")}}getPDFRect(){return this.getRect(0,0)}getNonHCMColor(){return this.color&&zt._colorManager.convert(this._uiManager.getNonHCMColor(this.color))}onUpdatedColor(){o(this,pe)?.onUpdatedColor()}getData(){let{comment:{text:t,color:e,date:n,opacity:i,deleted:s,richText:a},uid:l,pageIndex:c,creationDate:u,modificationDate:h}=this;return{id:l,pageIndex:c,rect:this.getPDFRect(),richText:a,contentsObj:{str:t},creationDate:u,modificationDate:n||h,popupRef:!s,color:e,opacity:i}}onceAdded(t){}isEmpty(){return!1}enableEditMode(){return this.isInEditMode()?!1:(this.parent.setEditingState(!1),g(this,Hl,!0),!0)}disableEditMode(){return this.isInEditMode()?(this.parent.setEditingState(!0),g(this,Hl,!1),!0):!1}isInEditMode(){return o(this,Hl)}shouldGetKeyboardEvents(){return o(this,ma)}needsToBeRebuilt(){return this.div&&!this.isAttachedToDOM}get isOnScreen(){let{top:t,left:e,bottom:n,right:i}=this.getClientDimensions(),{innerHeight:s,innerWidth:a}=window;return e<a&&i>0&&t<s&&n>0}rebuild(){v(this,Rt,aw).call(this)}rotate(t){}resize(){}serializeDeleted(){return{id:this.annotationElementId,deleted:!0,pageIndex:this.pageIndex,popupRef:this._initialData?.popupRef||""}}serialize(t=!1,e=null){return{annotationType:this.mode,pageIndex:this.pageIndex,rect:this.getPDFRect(),rotation:this.rotation,structTreeParentId:this._structTreeParentId,popupRef:this._initialData?.popupRef||""}}static async deserialize(t,e,n){let i=new this.prototype.constructor({parent:e,id:n.getId(),uiManager:n,annotationElementId:t.annotationElementId,creationDate:t.creationDate,modificationDate:t.modificationDate});i.rotation=t.rotation,g(i,zl,t.accessibilityData),i._isCopy=t.isCopy||!1;let[s,a]=i.pageDimensions,[l,c,u,h]=i.getRectInCurrentCoords(t.rect,a);return i.x=l/s,i.y=c/a,i.width=u/s,i.height=h/a,i}get hasBeenModified(){return!!this.annotationElementId&&(this.deleted||this.serialize()!==null)}remove(){if(o(this,No)?.abort(),g(this,No,null),this.isEmpty()||this.commit(),this.parent?this.parent.remove(this):this._uiManager.removeEditor(this),this.hideCommentPopup(),o(this,vs)&&(clearTimeout(o(this,vs)),g(this,vs,null)),v(this,Rt,If).call(this),this.removeEditToolbar(),o(this,wr)){for(let t of o(this,wr).values())clearTimeout(t);g(this,wr,null)}this.parent=null,o(this,Wl)?.destroy(),g(this,Wl,null),o(this,xr)?.remove(),g(this,xr,null)}get isResizable(){return!1}makeResizable(){this.isResizable&&(v(this,Rt,aS).call(this),o(this,Bn).classList.remove("hidden"))}get toolbarPosition(){return null}get commentButtonPosition(){return this._uiManager.direction==="ltr"?[1,0]:[0,0]}get commentButtonPositionInPage(){let{commentButtonPosition:[t,e]}=this,[n,i,s,a]=this.getPDFRect();return[zt._round(n+(s-n)*t),zt._round(i+(a-i)*(1-e))]}get commentButtonColor(){return this._uiManager.makeCommentColor(this.getNonHCMColor(),this.opacity)}get commentPopupPosition(){return o(this,pe).commentPopupPositionInLayer}set commentPopupPosition(t){o(this,pe).commentPopupPositionInLayer=t}hasDefaultPopupPosition(){return o(this,pe).hasDefaultPopupPosition()}get commentButtonWidth(){return o(this,pe).commentButtonWidth}get elementBeforePopup(){return this.div}setCommentButtonStates(t){o(this,pe)?.setCommentButtonStates(t)}keydown(t){if(!this.isResizable||t.target!==this.div||t.key!=="Enter")return;this._uiManager.setSelected(this),g(this,pa,{savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height});let e=o(this,Bn).children;if(!o(this,Lr)){g(this,Lr,Array.from(e));let a=v(this,Rt,dS).bind(this),l=v(this,Rt,fS).bind(this),c=this._uiManager._signal;for(let u of o(this,Lr)){let h=u.getAttribute("data-resizer-name");u.setAttribute("role","spinbutton"),u.addEventListener("keydown",a,{signal:c}),u.addEventListener("blur",l,{signal:c}),u.addEventListener("focus",v(this,Rt,pS).bind(this,h),{signal:c}),u.setAttribute("data-l10n-id",zt._l10nResizer[h])}}let n=o(this,Lr)[0],i=0;for(let a of e){if(a===n)break;i++}let s=(360-this.rotation+this.parentRotation)%360/90*(o(this,Lr).length/4);if(s!==i){if(s<i)for(let l=0;l<i-s;l++)o(this,Bn).append(o(this,Bn).firstElementChild);else if(s>i)for(let l=0;l<s-i;l++)o(this,Bn).firstElementChild.before(o(this,Bn).lastElementChild);let a=0;for(let l of e){let u=o(this,Lr)[a++].getAttribute("data-resizer-name");l.setAttribute("data-l10n-id",zt._l10nResizer[u])}}v(this,Rt,ow).call(this,0),g(this,ma,!0),o(this,Bn).firstElementChild.focus({focusVisible:!0}),t.preventDefault(),t.stopImmediatePropagation()}_resizeWithKeyboard(t,e){o(this,ma)&&v(this,Rt,rw).call(this,o(this,Bp),{deltaX:t,deltaY:e,fromKeyboard:!0})}_stopResizingWithKeyboard(){v(this,Rt,If).call(this),this.div.focus()}select(){if(this.isSelected&&this._editToolbar){this._editToolbar.show();return}if(this.isSelected=!0,this.makeResizable(),this.div?.classList.add("selectedEditor"),!this._editToolbar){this.addEditToolbar().then(()=>{this.div?.classList.contains("selectedEditor")&&this._editToolbar?.show()});return}this._editToolbar?.show(),o(this,ke)?.toggleAltTextBadge(!1)}focus(){this.div&&!this.div.contains(document.activeElement)&&setTimeout(()=>this.div?.focus({preventScroll:!0}),0)}unselect(){this.isSelected&&(this.isSelected=!1,o(this,Bn)?.classList.add("hidden"),this.div?.classList.remove("selectedEditor"),this.div?.contains(document.activeElement)&&this._uiManager.currentLayer.div.focus({preventScroll:!0}),this._editToolbar?.hide(),o(this,ke)?.toggleAltTextBadge(!0),this.hideCommentPopup())}hideCommentPopup(){this.hasComment&&this._uiManager.toggleComment(null)}updateParams(t,e){}disableEditing(){}enableEditing(){}get canChangeContent(){return!1}enterInEditMode(){this.canChangeContent&&(this.enableEditMode(),this.div.focus())}dblclick(t){t.target.nodeName!=="BUTTON"&&(this.enterInEditMode(),this.parent.updateToolbar({mode:this.constructor._editorType,editId:this.uid}))}getElementForAltText(){return this.div}get contentDiv(){return this.div}get isEditing(){return o(this,Up)}set isEditing(t){g(this,Up,t),this.parent&&(t?(this.parent.setSelected(this),this.parent.setActiveEditor(this)):this.parent.setActiveEditor(null))}static get MIN_SIZE(){return 16}static canCreateNewEmptyEditor(){return!0}get telemetryInitialData(){return{action:"added"}}get telemetryFinalData(){return null}_reportTelemetry(t,e=!1){if(e){o(this,wr)||g(this,wr,new Map);let{action:n}=t,i=o(this,wr).get(n);i&&clearTimeout(i),i=setTimeout(()=>{this._reportTelemetry(t),o(this,wr).delete(n),o(this,wr).size===0&&g(this,wr,null)},zt._telemetryTimeout),o(this,wr).set(n,i);return}t.type||(t.type=this.editorType),this._uiManager._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:t}})}show(t=this._isVisible){this.div.classList.toggle("hidden",!t),this._isVisible=t}enable(){this.div&&(this.div.tabIndex=0),g(this,bh,!1)}disable(){this.div&&(this.div.tabIndex=-1),g(this,bh,!0)}updateFakeAnnotationElement(t){if(!o(this,xr)&&!this.deleted){g(this,xr,t.addFakeAnnotation(this));return}if(this.deleted){o(this,xr).remove(),g(this,xr,null);return}(this.hasEditedComment||this._hasBeenMoved||this._hasBeenResized)&&o(this,xr).updateEdited({rect:this.getPDFRect(),popup:this.comment})}renderAnnotationElement(t){if(this.deleted)return t.hide(),null;let e=t.container.querySelector(".annotationContent");if(!e)e=document.createElement("div"),e.classList.add("annotationContent",this.editorType),t.container.prepend(e);else if(e.nodeName==="CANVAS"){let n=e;e=document.createElement("div"),e.classList.add("annotationContent",this.editorType),n.before(e)}return e}resetAnnotationElement(t){let{firstElementChild:e}=t.container;e?.nodeName==="DIV"&&e.classList.contains("annotationContent")&&e.remove()}};zl=new WeakMap,Lr=new WeakMap,ke=new WeakMap,pe=new WeakMap,fa=new WeakMap,bh=new WeakMap,Do=new WeakMap,Lp=new WeakMap,Bn=new WeakMap,jl=new WeakMap,pa=new WeakMap,xr=new WeakMap,No=new WeakMap,Bp=new WeakMap,Gl=new WeakMap,Fi=new WeakMap,Up=new WeakMap,Hl=new WeakMap,ma=new WeakMap,vs=new WeakMap,xh=new WeakMap,wh=new WeakMap,wr=new WeakMap,Wl=new WeakMap,$p=new WeakMap,jy=new WeakMap,Rt=new WeakSet,ew=function([t,e],n,i){[n,i]=this.screenToPageTranslation(n,i),this.x+=n/t,this.y+=i/e,this._onTranslating(this.x,this.y),this.fixAndSetPosition()},zp=new WeakSet,nw=function(t,e,n){switch(n){case 90:return[e,-t];case 180:return[-t,-e];case 270:return[-e,t];default:return[t,e]}},E0=function(t){switch(t){case 90:{let[e,n]=this.pageDimensions;return[0,-e/n,n/e,0]}case 180:return[-1,0,0,-1];case 270:{let[e,n]=this.pageDimensions;return[0,e/n,-n/e,0]}default:return[1,0,0,1]}},aS=function(){if(o(this,Bn))return;g(this,Bn,document.createElement("div")),o(this,Bn).classList.add("resizers");let t=this._willKeepAspectRatio?["topLeft","topRight","bottomRight","bottomLeft"]:["topLeft","topMiddle","topRight","middleRight","bottomRight","bottomMiddle","bottomLeft","middleLeft"],e=this._uiManager._signal;for(let n of t){let i=document.createElement("div");o(this,Bn).append(i),i.classList.add("resizer",n),i.setAttribute("data-resizer-name",n),i.addEventListener("pointerdown",v(this,Rt,oS).bind(this,n),{signal:e}),i.addEventListener("contextmenu",tr,{signal:e}),i.tabIndex=-1}this.div.prepend(o(this,Bn))},oS=function(t,e){e.preventDefault();let{isMac:n}=Xe.platform;if(e.button!==0||e.ctrlKey&&n)return;o(this,ke)?.toggle(!1);let i=this._isDraggable;this._isDraggable=!1,g(this,jl,[e.screenX,e.screenY]);let s=new AbortController,a=this._uiManager.combinedSignal(s);this.parent.togglePointerEvents(!1),window.addEventListener("pointermove",v(this,Rt,rw).bind(this,t),{passive:!0,capture:!0,signal:a}),window.addEventListener("touchmove",Be,{passive:!1,signal:a}),window.addEventListener("contextmenu",tr,{signal:a}),g(this,pa,{savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height});let l=this.parent.div.style.cursor,c=this.div.style.cursor;this.div.style.cursor=this.parent.div.style.cursor=window.getComputedStyle(e.target).cursor;let u=()=>{s.abort(),this.parent.togglePointerEvents(!0),o(this,ke)?.toggle(!0),this._isDraggable=i,this.parent.div.style.cursor=l,this.div.style.cursor=c,v(this,Rt,T0).call(this)};window.addEventListener("pointerup",u,{signal:a}),window.addEventListener("blur",u,{signal:a})},iw=function(t,e,n,i){this.width=n,this.height=i,this.x=t,this.y=e,this.setDims(),this.fixAndSetPosition(),this._onResized()},T0=function(){if(!o(this,pa))return;let{savedX:t,savedY:e,savedWidth:n,savedHeight:i}=o(this,pa);g(this,pa,null);let s=this.x,a=this.y,l=this.width,c=this.height;s===t&&a===e&&l===n&&c===i||this.addCommands({cmd:v(this,Rt,iw).bind(this,s,a,l,c),undo:v(this,Rt,iw).bind(this,t,e,n,i),mustExec:!0})},rw=function(t,e){let[n,i]=this.parentDimensions,s=this.x,a=this.y,l=this.width,c=this.height,u=zt.MIN_SIZE/n,h=zt.MIN_SIZE/i,d=v(this,Rt,E0).call(this,this.rotation),f=(X,T)=>[d[0]*X+d[2]*T,d[1]*X+d[3]*T],p=v(this,Rt,E0).call(this,360-this.rotation),m=(X,T)=>[p[0]*X+p[2]*T,p[1]*X+p[3]*T],y,x,b=!1,w=!1;switch(t){case"topLeft":b=!0,y=(X,T)=>[0,0],x=(X,T)=>[X,T];break;case"topMiddle":y=(X,T)=>[X/2,0],x=(X,T)=>[X/2,T];break;case"topRight":b=!0,y=(X,T)=>[X,0],x=(X,T)=>[0,T];break;case"middleRight":w=!0,y=(X,T)=>[X,T/2],x=(X,T)=>[0,T/2];break;case"bottomRight":b=!0,y=(X,T)=>[X,T],x=(X,T)=>[0,0];break;case"bottomMiddle":y=(X,T)=>[X/2,T],x=(X,T)=>[X/2,0];break;case"bottomLeft":b=!0,y=(X,T)=>[0,T],x=(X,T)=>[X,0];break;case"middleLeft":w=!0,y=(X,T)=>[0,T/2],x=(X,T)=>[X,T/2];break}let C=y(l,c),E=x(l,c),S=f(...E),N=zt._round(s+S[0]),k=zt._round(a+S[1]),M=1,R=1,j,$;if(e.fromKeyboard)({deltaX:j,deltaY:$}=e);else{let{screenX:X,screenY:T}=e,[I,_]=o(this,jl);[j,$]=this.screenToPageTranslation(X-I,T-_),o(this,jl)[0]=X,o(this,jl)[1]=T}if([j,$]=m(j/n,$/i),b){let X=Math.hypot(l,c);M=R=Math.max(Math.min(Math.hypot(E[0]-C[0]-j,E[1]-C[1]-$)/X,1/l,1/c),u/l,h/c)}else w?M=yn(Math.abs(E[0]-C[0]-j),u,1)/l:R=yn(Math.abs(E[1]-C[1]-$),h,1)/c;let q=zt._round(l*M),Q=zt._round(c*R);S=f(...x(q,Q));let Z=N-S[0],Y=k-S[1];o(this,Fi)||g(this,Fi,[this.x,this.y,this.width,this.height]),this.width=q,this.height=Q,this.x=Z,this.y=Y,this.setDims(),this.fixAndSetPosition(),this._onResizing()},lS=function(){g(this,pa,{savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height}),o(this,ke)?.toggle(!1),this.parent.togglePointerEvents(!1)},cS=function(t,e,n){let s=.7*(n/e)+1-.7;if(s===1)return;let a=v(this,Rt,E0).call(this,this.rotation),l=(N,k)=>[a[0]*N+a[2]*k,a[1]*N+a[3]*k],[c,u]=this.parentDimensions,h=this.x,d=this.y,f=this.width,p=this.height,m=zt.MIN_SIZE/c,y=zt.MIN_SIZE/u;s=Math.max(Math.min(s,1/f,1/p),m/f,y/p);let x=zt._round(f*s),b=zt._round(p*s);if(x===f&&b===p)return;o(this,Fi)||g(this,Fi,[h,d,f,p]);let w=l(f/2,p/2),C=zt._round(h+w[0]),E=zt._round(d+w[1]),S=l(x/2,b/2);this.x=C-S[0],this.y=E-S[1],this.width=x,this.height=b,this.setDims(),this.fixAndSetPosition(),this._onResizing()},uS=function(){o(this,ke)?.toggle(!0),this.parent.togglePointerEvents(!0),v(this,Rt,T0).call(this)},sw=function(t){let{isMac:e}=Xe.platform;t.ctrlKey&&!e||t.shiftKey||t.metaKey&&e?this.parent.toggleSelected(this):this.parent.setSelected(this)},hS=function(t){let{isSelected:e}=this;this._uiManager.setUpDragSession();let n=!1,i=new AbortController,s=this._uiManager.combinedSignal(i),a={capture:!0,passive:!1,signal:s},l=u=>{i.abort(),g(this,Do,null),g(this,Gl,!1),this._uiManager.endDragSession()||v(this,Rt,sw).call(this,u),n&&this._onStopDragging()};e&&(g(this,xh,t.clientX),g(this,wh,t.clientY),g(this,Do,t.pointerId),g(this,Lp,t.pointerType),window.addEventListener("pointermove",u=>{n||(n=!0,this._uiManager.toggleComment(this,!0,!1),this._onStartDragging());let{clientX:h,clientY:d,pointerId:f}=u;if(f!==o(this,Do)){Be(u);return}let[p,m]=this.screenToPageTranslation(h-o(this,xh),d-o(this,wh));g(this,xh,h),g(this,wh,d),this._uiManager.dragSelectedEditors(p,m)},a),window.addEventListener("touchmove",Be,a),window.addEventListener("pointerdown",u=>{u.pointerType===o(this,Lp)&&(o(this,Wl)||u.isPrimary)&&l(u),Be(u)},a));let c=u=>{if(!o(this,Do)||o(this,Do)===u.pointerId){l(u);return}Be(u)};window.addEventListener("pointerup",c,{signal:s}),window.addEventListener("blur",c,{signal:s})},aw=function(){if(o(this,No)||!this.div)return;g(this,No,new AbortController);let t=this._uiManager.combinedSignal(o(this,No));this.div.addEventListener("focusin",this.focusin.bind(this),{signal:t}),this.div.addEventListener("focusout",this.focusout.bind(this),{signal:t})},dS=function(t){zt._resizerKeyboardManager.exec(this,t)},fS=function(t){o(this,ma)&&t.relatedTarget?.parentNode!==o(this,Bn)&&v(this,Rt,If).call(this)},pS=function(t){g(this,Bp,o(this,ma)?t:"")},ow=function(t){if(o(this,Lr))for(let e of o(this,Lr))e.tabIndex=t},If=function(){g(this,ma,!1),v(this,Rt,ow).call(this,-1),v(this,Rt,T0).call(this)},A(zt,zp),U(zt,"_l10n",null),U(zt,"_l10nResizer",null),U(zt,"_borderLineWidth",-1),U(zt,"_colorManager",new Yx),U(zt,"_zIndex",1),U(zt,"_telemetryTimeout",1e3);Te=zt,lw=class extends Te{constructor(t){super(t),this.annotationElementId=t.annotationElementId,this.deleted=!0}serialize(){return this.serializeDeleted()}},cT=3285377520,ur=4294901760,ds=65535,hy=class{constructor(t){this.h1=t?t&4294967295:cT,this.h2=t?t&4294967295:cT}update(t){let e,n;if(typeof t=="string"){e=new Uint8Array(t.length*2),n=0;for(let y=0,x=t.length;y<x;y++){let b=t.charCodeAt(y);b<=255?e[n++]=b:(e[n++]=b>>>8,e[n++]=b&255)}}else if(ArrayBuffer.isView(t))e=t.slice(),n=e.byteLength;else throw new Error("Invalid data format, must be a string or TypedArray.");let i=n>>2,s=n-i*4,a=new Uint32Array(e.buffer,0,i),l=0,c=0,u=this.h1,h=this.h2,d=3432918353,f=461845907,p=d&ds,m=f&ds;for(let y=0;y<i;y++)y&1?(l=a[y],l=l*d&ur|l*p&ds,l=l<<15|l>>>17,l=l*f&ur|l*m&ds,u^=l,u=u<<13|u>>>19,u=u*5+3864292196):(c=a[y],c=c*d&ur|c*p&ds,c=c<<15|c>>>17,c=c*f&ur|c*m&ds,h^=c,h=h<<13|h>>>19,h=h*5+3864292196);switch(l=0,s){case 3:l^=e[i*4+2]<<16;case 2:l^=e[i*4+1]<<8;case 1:l^=e[i*4],l=l*d&ur|l*p&ds,l=l<<15|l>>>17,l=l*f&ur|l*m&ds,i&1?u^=l:h^=l}this.h1=u,this.h2=h}hexdigest(){let t=this.h1,e=this.h2;return t^=e>>>1,t=t*3981806797&ur|t*36045&ds,e=e*4283543511&ur|((e<<16|t>>>16)*2950163797&ur)>>>16,t^=e>>>1,t=t*444984403&ur|t*60499&ds,e=e*3301882366&ur|((e<<16|t>>>16)*3120437893&ur)>>>16,t^=e>>>1,(t>>>0).toString(16).padStart(8,"0")+(e>>>0).toString(16).padStart(8,"0")}},rp=Object.freeze({map:null,hash:"",transfer:void 0}),sp=class{constructor(){A(this,Gy);A(this,ql,!1);A(this,Vl,null);A(this,ga,null);A(this,Un,new Map);U(this,"onSetModified",null);U(this,"onResetModified",null);U(this,"onAnnotationEditor",null)}getValue(t,e){let n=o(this,Un).get(t);return n===void 0?e:Object.assign(e,n)}getRawValue(t){return o(this,Un).get(t)}remove(t){let e=o(this,Un).get(t);e!==void 0&&(e instanceof Te&&o(this,ga).delete(e.annotationElementId),o(this,Un).delete(t),o(this,Un).size===0&&this.resetModified(),!o(this,Un).values().some(n=>n instanceof Te)&&this.onAnnotationEditor?.(null))}setValue(t,e){let n=o(this,Un).get(t),i=!1;if(n!==void 0)for(let[s,a]of Object.entries(e))n[s]!==a&&(i=!0,n[s]=a);else i=!0,o(this,Un).set(t,e);i&&v(this,Gy,mS).call(this),e instanceof Te&&((o(this,ga)||g(this,ga,new Map)).set(e.annotationElementId,e),this.onAnnotationEditor?.(e.constructor._type))}has(t){return o(this,Un).has(t)}get size(){return o(this,Un).size}resetModified(){o(this,ql)&&(g(this,ql,!1),this.onResetModified?.())}get print(){return new dy(this)}get serializable(){if(o(this,Un).size===0)return rp;let t=new Map,e=new hy,n=[],i=Object.create(null),s=!1;for(let[a,l]of o(this,Un)){let c=l instanceof Te?l.serialize(!1,i):l;l.page&&(l.pageIndex=l.page._pageIndex,delete l.page),c&&(t.set(a,c),e.update(`${a}:${JSON.stringify(c)}`),s||(s=!!c.bitmap))}if(s)for(let a of t.values())a.bitmap&&n.push(a.bitmap);return t.size>0?{map:t,hash:e.hexdigest(),transfer:n}:rp}get editorStats(){let t=null,e=new Map,n=0,i=0;for(let s of o(this,Un).values()){if(!(s instanceof Te)){s.popup&&(s.popup.deleted?i+=1:n+=1);continue}s.isCommentDeleted?i+=1:s.hasEditedComment&&(n+=1);let a=s.telemetryFinalData;if(!a)continue;let{type:l}=a;e.has(l)||e.set(l,Object.getPrototypeOf(s).constructor),t||(t=Object.create(null));let c=t[l]||(t[l]=new Map);for(let[u,h]of Object.entries(a)){if(u==="type")continue;let d=c.getOrInsertComputed(u,ub);d.set(h,(d.get(h)??0)+1)}}if((i>0||n>0)&&(t||(t=Object.create(null)),t.comments={deleted:i,edited:n}),!t)return null;for(let[s,a]of e)t[s]=a.computeTelemetryFinalData(t[s]);return t}resetModifiedIds(){g(this,Vl,null)}updateEditor(t,e){let n=o(this,ga)?.get(t);return n?(n.updateFromAnnotationLayer(e),!0):!1}getEditor(t){return o(this,ga)?.get(t)||null}get modifiedIds(){if(o(this,Vl))return o(this,Vl);let t=[];if(o(this,ga))for(let e of o(this,ga).values())e.serialize()&&t.push(e.annotationElementId);return g(this,Vl,{ids:new Set(t),hash:t.join(",")})}[Symbol.iterator](){return o(this,Un).entries()}};ql=new WeakMap,Vl=new WeakMap,ga=new WeakMap,Un=new WeakMap,Gy=new WeakSet,mS=function(){o(this,ql)||(g(this,ql,!0),this.onSetModified?.())};dy=class extends sp{constructor(e){super();A(this,jp,rp);let{serializable:n}=e;if(n===rp)return;let{map:i,hash:s,transfer:a}=n,l=structuredClone(i,a?{transfer:a}:null);g(this,jp,{map:l,hash:s,transfer:[]})}get print(){ue("Should not call PrintAnnotationStorage.print")}get serializable(){return o(this,jp)}get modifiedIds(){return Ut(this,"modifiedIds",{ids:new Set,hash:""})}};jp=new WeakMap;Bu="__forcedDependency",{floor:uT,ceil:hT}=Math;cw=new Uint32Array(new Uint8Array([255,255,0,0]).buffer)[0],uw=class{constructor(t,e){A(this,Ah);A(this,Io);g(this,Ah,t),g(this,Io,e)}get length(){return o(this,Ah).length}isEmpty(t){return o(this,Ah)[t]===cw}minX(t){return o(this,Io)[t*4+0]/256}minY(t){return o(this,Io)[t*4+1]/256}maxX(t){return(o(this,Io)[t*4+2]+1)/256}maxY(t){return(o(this,Io)[t*4+3]+1)/256}};Ah=new WeakMap,Io=new WeakMap;fT=(r,t)=>r?.getOrInsertComputed(t,()=>({dependencies:new Set,isRenderingOperation:!1})),hw=class{constructor(t,e){A(this,Gp);A(this,ya,[[1,0,0,1,0,0]]);A(this,ce,[-1/0,-1/0,1/0,1/0]);A(this,ye,new Float64Array([1/0,1/0,-1/0,-1/0]));U(this,"_pendingBBoxIdx",-1);A(this,Xl);A(this,Yl);A(this,Kl);A(this,Qn);U(this,"_savesStack",[]);U(this,"_markedContentStack",[]);g(this,Xl,t.width),g(this,Yl,t.height),v(this,Gp,dw).call(this,e)}growOperationsCount(t){t>=o(this,Qn).length&&v(this,Gp,dw).call(this,t,o(this,Qn))}get clipBox(){return o(this,ce)}save(t){return g(this,ce,{__proto__:o(this,ce)}),this._savesStack.push(t),this}restore(t,e){let n=Object.getPrototypeOf(o(this,ce));if(n===null)return this;g(this,ce,n);let i=this._savesStack.pop();return i!==void 0&&(e?.(i,t),o(this,Qn)[t]=o(this,Qn)[i]),this}recordOpenMarker(t){return this._savesStack.push(t),this}getOpenMarker(){return this._savesStack.length===0?null:this._savesStack.at(-1)}recordCloseMarker(t,e){let n=this._savesStack.pop();return n!==void 0&&(e?.(n,t),o(this,Qn)[t]=o(this,Qn)[n]),this}beginMarkedContent(t){return this._markedContentStack.push(t),this}endMarkedContent(t,e){let n=this._markedContentStack.pop();return n!==void 0&&(e?.(n,t),o(this,Qn)[t]=o(this,Qn)[n]),this}pushBaseTransform(t){return o(this,ya).push(yt.multiplyByDOMMatrix(o(this,ya).at(-1),t.getTransform())),this}popBaseTransform(){return o(this,ya).length>1&&o(this,ya).pop(),this}resetBBox(t){return this._pendingBBoxIdx!==t&&(this._pendingBBoxIdx=t,o(this,ye)[0]=1/0,o(this,ye)[1]=1/0,o(this,ye)[2]=-1/0,o(this,ye)[3]=-1/0),this}recordClipBox(t,e,n,i,s,a){let l=yt.multiplyByDOMMatrix(o(this,ya).at(-1),e.getTransform()),c=[1/0,1/0,-1/0,-1/0];yt.axialAlignedBoundingBox([n,s,i,a],l,c);let u=yt.intersect(o(this,ce),c);return u?(o(this,ce)[0]=u[0],o(this,ce)[1]=u[1],o(this,ce)[2]=u[2],o(this,ce)[3]=u[3]):(o(this,ce)[0]=o(this,ce)[1]=1/0,o(this,ce)[2]=o(this,ce)[3]=-1/0),this}recordBBox(t,e,n,i,s,a){let l=o(this,ce);if(l[0]===1/0)return this;let c=yt.multiplyByDOMMatrix(o(this,ya).at(-1),e.getTransform());if(l[0]===-1/0)return yt.axialAlignedBoundingBox([n,s,i,a],c,o(this,ye)),this;let u=[1/0,1/0,-1/0,-1/0];return yt.axialAlignedBoundingBox([n,s,i,a],c,u),o(this,ye)[0]=Math.min(o(this,ye)[0],Math.max(u[0],l[0])),o(this,ye)[1]=Math.min(o(this,ye)[1],Math.max(u[1],l[1])),o(this,ye)[2]=Math.max(o(this,ye)[2],Math.min(u[2],l[2])),o(this,ye)[3]=Math.max(o(this,ye)[3],Math.min(u[3],l[3])),this}recordFullPageBBox(t){return o(this,ye)[0]=Math.max(0,o(this,ce)[0]),o(this,ye)[1]=Math.max(0,o(this,ce)[1]),o(this,ye)[2]=Math.min(o(this,Xl),o(this,ce)[2]),o(this,ye)[3]=Math.min(o(this,Yl),o(this,ce)[3]),this}recordOperation(t,e=!1,n){if(this._pendingBBoxIdx!==t)return this;let i=uT(o(this,ye)[0]*256/o(this,Xl)),s=uT(o(this,ye)[1]*256/o(this,Yl)),a=hT(o(this,ye)[2]*256/o(this,Xl)),l=hT(o(this,ye)[3]*256/o(this,Yl));if(dT(o(this,Kl),t,i,s,a,l),n)for(let c of n)for(let u of c)u!==t&&dT(o(this,Kl),u,i,s,a,l);return e||(this._pendingBBoxIdx=-1),this}bboxToClipBoxDropOperation(t){return this._pendingBBoxIdx===t&&(this._pendingBBoxIdx=-1,o(this,ce)[0]=Math.max(o(this,ce)[0],o(this,ye)[0]),o(this,ce)[1]=Math.max(o(this,ce)[1],o(this,ye)[1]),o(this,ce)[2]=Math.min(o(this,ce)[2],o(this,ye)[2]),o(this,ce)[3]=Math.min(o(this,ce)[3],o(this,ye)[3])),this}take(){return new uw(o(this,Qn),o(this,Kl))}takeDebugMetadata(){throw new Error("Unreachable")}recordSimpleData(t,e){return this}recordIncrementalData(t,e){return this}resetIncrementalData(t,e){return this}recordNamedData(t,e){return this}recordSimpleDataFromNamed(t,e,n){return this}recordFutureForcedDependency(t,e){return this}inheritSimpleDataAsFutureForcedDependencies(t){return this}inheritPendingDependenciesAsFutureForcedDependencies(){return this}recordCharacterBBox(t,e,n,i=1,s=0,a=0,l){return this}getSimpleIndex(t){}recordDependencies(t,e){return this}recordNamedDependency(t,e){return this}recordShowTextOperation(t,e=!1){return this}};ya=new WeakMap,ce=new WeakMap,ye=new WeakMap,Xl=new WeakMap,Yl=new WeakMap,Kl=new WeakMap,Qn=new WeakMap,Gp=new WeakSet,dw=function(t,e){let n=new ArrayBuffer(t*4);g(this,Kl,new Uint8ClampedArray(n)),g(this,Qn,new Uint32Array(n)),e&&e.length>0?(o(this,Qn).set(e),o(this,Qn).fill(cw,e.length)):o(this,Qn).fill(cw)};fw=class{constructor(t,e=!1){A(this,vi,{__proto__:null});A(this,Ci,{__proto__:null,transform:[],moveText:[],sameLineText:[],[Bu]:[]});A(this,Zl,new Map);A(this,Br,new Set);A(this,vh,new Map);A(this,ko);A(this,_o);A(this,be);g(this,be,t),e&&(g(this,ko,new Map),g(this,_o,(n,i)=>{fT(o(this,ko),i).dependencies.add(n)}))}get clipBox(){return o(this,be).clipBox}growOperationsCount(t){o(this,be).growOperationsCount(t)}save(t){return g(this,vi,{__proto__:o(this,vi)}),g(this,Ci,{__proto__:o(this,Ci),transform:{__proto__:o(this,Ci).transform},moveText:{__proto__:o(this,Ci).moveText},sameLineText:{__proto__:o(this,Ci).sameLineText},[Bu]:{__proto__:o(this,Ci)[Bu]}}),o(this,be).save(t),this}restore(t){o(this,be).restore(t,o(this,_o));let e=Object.getPrototypeOf(o(this,vi));return e===null?this:(g(this,vi,e),g(this,Ci,Object.getPrototypeOf(o(this,Ci))),this)}recordOpenMarker(t){return o(this,be).recordOpenMarker(t,o(this,_o)),this}getOpenMarker(){return o(this,be).getOpenMarker()}recordCloseMarker(t){return o(this,be).recordCloseMarker(t,o(this,_o)),this}beginMarkedContent(t){return o(this,be).beginMarkedContent(t),this}endMarkedContent(t){return o(this,be).endMarkedContent(t,o(this,_o)),this}pushBaseTransform(t){return o(this,be).pushBaseTransform(t),this}popBaseTransform(){return o(this,be).popBaseTransform(),this}recordSimpleData(t,e){return o(this,vi)[t]=e,this}recordIncrementalData(t,e){return o(this,Ci)[t].push(e),this}resetIncrementalData(t,e){return o(this,Ci)[t].length=0,this}recordNamedData(t,e){return o(this,Zl).set(t,e),this}recordSimpleDataFromNamed(t,e,n){o(this,vi)[t]=o(this,Zl).get(e)??n}recordFutureForcedDependency(t,e){return this.recordIncrementalData(Bu,e),this}inheritSimpleDataAsFutureForcedDependencies(t){for(let e of t)e in o(this,vi)&&this.recordFutureForcedDependency(e,o(this,vi)[e]);return this}inheritPendingDependenciesAsFutureForcedDependencies(){for(let t of o(this,Br))this.recordFutureForcedDependency(Bu,t);return this}resetBBox(t){return o(this,be).resetBBox(t),this}recordClipBox(t,e,n,i,s,a){return o(this,be).recordClipBox(t,e,n,i,s,a),this}recordBBox(t,e,n,i,s,a){return o(this,be).recordBBox(t,e,n,i,s,a),this}recordCharacterBBox(t,e,n,i=1,s=0,a=0,l){let c=n.bbox,u,h;if(c&&(u=c[2]!==c[0]&&c[3]!==c[1]&&o(this,vh).get(n),u!==!1&&(h=[0,0,0,0],yt.axialAlignedBoundingBox(c,n.fontMatrix,h),(i!==1||s!==0||a!==0)&&yt.scaleMinMax([i,0,0,-i,s,a],h),u)))return this.recordBBox(t,e,h[0],h[2],h[1],h[3]);if(!l)return this.recordFullPageBBox(t);let d=l();return c&&h&&u===void 0&&(u=h[0]<=s-d.actualBoundingBoxLeft&&h[2]>=s+d.actualBoundingBoxRight&&h[1]<=a-d.actualBoundingBoxAscent&&h[3]>=a+d.actualBoundingBoxDescent,o(this,vh).set(n,u),u)?this.recordBBox(t,e,h[0],h[2],h[1],h[3]):this.recordBBox(t,e,s-d.actualBoundingBoxLeft,s+d.actualBoundingBoxRight,a-d.actualBoundingBoxAscent,a+d.actualBoundingBoxDescent)}recordFullPageBBox(t){return o(this,be).recordFullPageBBox(t),this}getSimpleIndex(t){return o(this,vi)[t]}recordDependencies(t,e){let n=o(this,Br),i=o(this,vi),s=o(this,Ci);for(let a of e)a in o(this,vi)?n.add(i[a]):a in s&&s[a].forEach(n.add,n);return this}recordNamedDependency(t,e){return o(this,Zl).has(e)&&o(this,Br).add(o(this,Zl).get(e)),this}recordOperation(t,e=!1){if(this.recordDependencies(t,[Bu]),o(this,ko)){let i=fT(o(this,ko),t),{dependencies:s}=i;o(this,Br).forEach(s.add,s),o(this,be)._savesStack.forEach(s.add,s),o(this,be)._markedContentStack.forEach(s.add,s),s.delete(t),i.isRenderingOperation=!0}let n=!e&&t===o(this,be)._pendingBBoxIdx;return o(this,be).recordOperation(t,e,[o(this,Br),o(this,be)._savesStack,o(this,be)._markedContentStack]),n&&o(this,Br).clear(),this}recordShowTextOperation(t,e=!1){let n=Array.from(o(this,Br));this.recordOperation(t,e),this.recordIncrementalData("sameLineText",t);for(let i of n)this.recordIncrementalData("sameLineText",i);return this}bboxToClipBoxDropOperation(t,e=!1){let n=!e&&t===o(this,be)._pendingBBoxIdx;return o(this,be).bboxToClipBoxDropOperation(t),n&&o(this,Br).clear(),this}take(){return o(this,vh).clear(),o(this,be).take()}takeDebugMetadata(){return o(this,ko)}};vi=new WeakMap,Ci=new WeakMap,Zl=new WeakMap,Br=new WeakMap,vh=new WeakMap,ko=new WeakMap,_o=new WeakMap,be=new WeakMap;vA=class vA{constructor(t,e,n){A(this,xe);A(this,We);A(this,Ur);A(this,Ch,0);A(this,Eh,0);if(t instanceof vA&&o(t,Ur)===!!n)return t;g(this,xe,t),g(this,We,e),g(this,Ur,!!n)}get clipBox(){return o(this,xe).clipBox}growOperationsCount(){throw new Error("Unreachable")}save(t){return an(this,Eh)._++,o(this,xe).save(o(this,We)),this}restore(t){return o(this,Eh)>0&&(o(this,xe).restore(o(this,We)),an(this,Eh)._--),this}recordOpenMarker(t){return an(this,Ch)._++,this}getOpenMarker(){return o(this,Ch)>0?o(this,We):o(this,xe).getOpenMarker()}recordCloseMarker(t){return an(this,Ch)._--,this}beginMarkedContent(t){return this}endMarkedContent(t){return this}pushBaseTransform(t){return o(this,xe).pushBaseTransform(t),this}popBaseTransform(){return o(this,xe).popBaseTransform(),this}recordSimpleData(t,e){return o(this,xe).recordSimpleData(t,o(this,We)),this}recordIncrementalData(t,e){return o(this,xe).recordIncrementalData(t,o(this,We)),this}resetIncrementalData(t,e){return o(this,xe).resetIncrementalData(t,o(this,We)),this}recordNamedData(t,e){return this}recordSimpleDataFromNamed(t,e,n){return o(this,xe).recordSimpleDataFromNamed(t,e,o(this,We)),this}recordFutureForcedDependency(t,e){return o(this,xe).recordFutureForcedDependency(t,o(this,We)),this}inheritSimpleDataAsFutureForcedDependencies(t){return o(this,xe).inheritSimpleDataAsFutureForcedDependencies(t),this}inheritPendingDependenciesAsFutureForcedDependencies(){return o(this,xe).inheritPendingDependenciesAsFutureForcedDependencies(),this}resetBBox(t){return o(this,Ur)||o(this,xe).resetBBox(o(this,We)),this}recordClipBox(t,e,n,i,s,a){return o(this,Ur)||o(this,xe).recordClipBox(o(this,We),e,n,i,s,a),this}recordBBox(t,e,n,i,s,a){return o(this,Ur)||o(this,xe).recordBBox(o(this,We),e,n,i,s,a),this}recordCharacterBBox(t,e,n,i,s,a,l){return o(this,Ur)||o(this,xe).recordCharacterBBox(o(this,We),e,n,i,s,a,l),this}recordFullPageBBox(t){return o(this,Ur)||o(this,xe).recordFullPageBBox(o(this,We)),this}getSimpleIndex(t){return o(this,xe).getSimpleIndex(t)}recordDependencies(t,e){return o(this,xe).recordDependencies(o(this,We),e),this}recordNamedDependency(t,e){return o(this,xe).recordNamedDependency(o(this,We),e),this}recordOperation(t){return o(this,xe).recordOperation(o(this,We),!0),this}recordShowTextOperation(t){return o(this,xe).recordShowTextOperation(o(this,We),!0),this}bboxToClipBoxDropOperation(t){return o(this,Ur)||o(this,xe).bboxToClipBoxDropOperation(o(this,We),!0),this}take(){throw new Error("Unreachable")}takeDebugMetadata(){throw new Error("Unreachable")}};xe=new WeakMap,We=new WeakMap,Ur=new WeakMap,Ch=new WeakMap,Eh=new WeakMap;fy=vA,hr={stroke:["path","transform","filter","strokeColor","strokeAlpha","lineWidth","lineCap","lineJoin","miterLimit","dash"],fill:["path","transform","filter","fillColor","fillAlpha","globalCompositeOperation","SMask"],imageXObject:["transform","SMask","filter","fillAlpha","strokeAlpha","globalCompositeOperation"],rawFillPath:["filter","fillColor","fillAlpha"],showText:["transform","leading","charSpacing","wordSpacing","hScale","textRise","moveText","textMatrix","font","fontObj","filter","fillColor","textRenderingMode","SMask","fillAlpha","strokeAlpha","globalCompositeOperation","sameLineText"],transform:["transform"],transformAndFill:["transform","fillColor"]},Zf=class Zf{constructor(t){A(this,Ql);A(this,Jl);A(this,tc,4);A(this,ec,0);A(this,nc,new(o(Zf,Hp))(o(this,tc)*6));g(this,Ql,t.width),g(this,Jl,t.height)}record(t,e,n,i){if(o(this,ec)===o(this,tc)){g(this,tc,o(this,tc)*2);let l=new(o(Zf,Hp))(o(this,tc)*6);l.set(o(this,nc)),g(this,nc,l)}let s=yt.domMatrixToTransform(t.getTransform()),a;if(i[0]!==1/0){let l=[1/0,1/0,-1/0,-1/0];yt.axialAlignedBoundingBox([0,-n,e,0],s,l);let c=yt.intersect(i,l);if(!c)return;let[u,h,d,f]=c;if(u!==l[0]||h!==l[1]||d!==l[2]||f!==l[3]){let p=Math.atan2(s[1],s[0]),m=Math.abs(Math.sin(p)),y=Math.abs(Math.cos(p));if(m<1e-6||y<1e-6||Math.abs(m-y)<1e-6)a=[u,h,u,f,d,h];else{let x=d-u,b=f-h,w=m*m,C=y*y,E=y*m,S=C-w,N=(b*C-x*E)/S,k=(b*E-x*w)/S;a=[u+k,h,u,h+N,d,f-N]}}}a||(a=[0,-n,0,0,e,-n],yt.applyTransform(a,s,0),yt.applyTransform(a,s,2),yt.applyTransform(a,s,4)),a[0]/=o(this,Ql),a[1]/=o(this,Jl),a[2]/=o(this,Ql),a[3]/=o(this,Jl),a[4]/=o(this,Ql),a[5]/=o(this,Jl),o(this,nc).set(a,o(this,ec)*6),an(this,ec)._++}take(){return o(this,nc).subarray(0,o(this,ec)*6)}};Ql=new WeakMap,Jl=new WeakMap,tc=new WeakMap,ec=new WeakMap,nc=new WeakMap,Hp=new WeakMap,A(Zf,Hp,Xe.isFloat16ArraySupported?Float16Array:Float32Array);pw=Zf,mw=class{constructor({ownerDocument:t=globalThis.document,styleElement:e=null}){A(this,Th,new Set);this._document=t,this.nativeFontFaces=new Set,this.styleElement=null,this.loadingRequests=[],this.loadTestFontId=0}addNativeFontFace(t){this.nativeFontFaces.add(t),this._document.fonts.add(t)}removeNativeFontFace(t){this.nativeFontFaces.delete(t),this._document.fonts.delete(t)}insertRule(t){this.styleElement||(this.styleElement=this._document.createElement("style"),this._document.documentElement.getElementsByTagName("head")[0].append(this.styleElement));let e=this.styleElement.sheet;e.insertRule(t,e.cssRules.length)}clear(){for(let t of this.nativeFontFaces)this._document.fonts.delete(t);this.nativeFontFaces.clear(),o(this,Th).clear(),this.styleElement&&(this.styleElement.remove(),this.styleElement=null)}async loadSystemFont({systemFontInfo:t,disableFontFace:e,_inspectFont:n}){if(!(!t||o(this,Th).has(t.loadedName))){if(Ue(!e,"loadSystemFont shouldn't be called when `disableFontFace` is set."),this.isFontLoadingAPISupported){let{loadedName:i,src:s,style:a}=t,l=new FontFace(i,s,a);this.addNativeFontFace(l);try{await l.load(),o(this,Th).add(i),n?.(t)}catch{jt(`Cannot load system font: ${t.baseFontName}, installing it could help to improve PDF rendering.`),this.removeNativeFontFace(l)}return}ue("Not implemented: loadSystemFont without the Font Loading API.")}}async bind(t){if(t.attached||t.missingFile&&!t.systemFontInfo)return;if(t.attached=!0,t.systemFontInfo){await this.loadSystemFont(t);return}if(this.isFontLoadingAPISupported){let n=t.createNativeFontFace();if(n){this.addNativeFontFace(n);try{await n.loaded}catch(i){throw jt(`Failed to load font '${n.family}': '${i}'.`),t.disableFontFace=!0,i}}return}let e=t.createFontFaceRule();if(e){if(this.insertRule(e),this.isSyncFontLoadingSupported)return;await new Promise(n=>{let i=this._queueLoadingCallback(n);this._prepareFontLoadEvent(t,i)})}}get isFontLoadingAPISupported(){let t=!!this._document?.fonts;return Ut(this,"isFontLoadingAPISupported",t)}get isSyncFontLoadingSupported(){return Ut(this,"isSyncFontLoadingSupported",Ki||Xe.platform.isFirefox)}_queueLoadingCallback(t){function e(){for(Ue(!i.done,"completeRequest() cannot be called twice."),i.done=!0;n.length>0&&n[0].done;){let s=n.shift();setTimeout(s.callback,0)}}let{loadingRequests:n}=this,i={done:!1,complete:e,callback:t};return n.push(i),i}get _loadTestFont(){let t=atob("T1RUTwALAIAAAwAwQ0ZGIDHtZg4AAAOYAAAAgUZGVE1lkzZwAAAEHAAAABxHREVGABQAFQAABDgAAAAeT1MvMlYNYwkAAAEgAAAAYGNtYXABDQLUAAACNAAAAUJoZWFk/xVFDQAAALwAAAA2aGhlYQdkA+oAAAD0AAAAJGhtdHgD6AAAAAAEWAAAAAZtYXhwAAJQAAAAARgAAAAGbmFtZVjmdH4AAAGAAAAAsXBvc3T/hgAzAAADeAAAACAAAQAAAAEAALZRFsRfDzz1AAsD6AAAAADOBOTLAAAAAM4KHDwAAAAAA+gDIQAAAAgAAgAAAAAAAAABAAADIQAAAFoD6AAAAAAD6AABAAAAAAAAAAAAAAAAAAAAAQAAUAAAAgAAAAQD6AH0AAUAAAKKArwAAACMAooCvAAAAeAAMQECAAACAAYJAAAAAAAAAAAAAQAAAAAAAAAAAAAAAFBmRWQAwAAuAC4DIP84AFoDIQAAAAAAAQAAAAAAAAAAACAAIAABAAAADgCuAAEAAAAAAAAAAQAAAAEAAAAAAAEAAQAAAAEAAAAAAAIAAQAAAAEAAAAAAAMAAQAAAAEAAAAAAAQAAQAAAAEAAAAAAAUAAQAAAAEAAAAAAAYAAQAAAAMAAQQJAAAAAgABAAMAAQQJAAEAAgABAAMAAQQJAAIAAgABAAMAAQQJAAMAAgABAAMAAQQJAAQAAgABAAMAAQQJAAUAAgABAAMAAQQJAAYAAgABWABYAAAAAAAAAwAAAAMAAAAcAAEAAAAAADwAAwABAAAAHAAEACAAAAAEAAQAAQAAAC7//wAAAC7////TAAEAAAAAAAABBgAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAD/gwAyAAAAAQAAAAAAAAAAAAAAAAAAAAABAAQEAAEBAQJYAAEBASH4DwD4GwHEAvgcA/gXBIwMAYuL+nz5tQXkD5j3CBLnEQACAQEBIVhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYAAABAQAADwACAQEEE/t3Dov6fAH6fAT+fPp8+nwHDosMCvm1Cvm1DAz6fBQAAAAAAAABAAAAAMmJbzEAAAAAzgTjFQAAAADOBOQpAAEAAAAAAAAADAAUAAQAAAABAAAAAgABAAAAAAAAAAAD6AAAAAAAAA==");return Ut(this,"_loadTestFont",t)}_prepareFontLoadEvent(t,e){function n(E,S){return E.charCodeAt(S)<<24|E.charCodeAt(S+1)<<16|E.charCodeAt(S+2)<<8|E.charCodeAt(S+3)&255}function i(E,S,N,k){let M=E.substring(0,S),R=E.substring(S+N);return M+k+R}let s,a,l=this._document.createElement("canvas");l.width=1,l.height=1;let c=l.getContext("2d"),u=0;function h(E,S){if(++u>30){jt("Load test font never loaded."),S();return}if(c.font="30px "+E,c.fillText(".",0,20),c.getImageData(0,0,1,1).data[3]>0){S();return}setTimeout(h.bind(null,E,S))}let d=`lt${Date.now()}${this.loadTestFontId++}`,f=this._loadTestFont;f=i(f,976,d.length,d);let m=16,y=1482184792,x=n(f,m);for(s=0,a=d.length-3;s<a;s+=4)x=x-y+n(d,s)|0;s<d.length&&(x=x-y+n(d+"XXX",s)|0),f=i(f,m,4,TO(x));let b=`url(data:font/opentype;base64,${btoa(f)});`,w=`@font-face {font-family:"${d}";src:${b}}`;this.insertRule(w);let C=this._document.createElement("div");C.style.visibility="hidden",C.style.width=C.style.height="10px",C.style.position="absolute",C.style.top=C.style.left="0px";for(let E of[t.loadedName,d]){let S=this._document.createElement("span");S.textContent="Hi",S.style.fontFamily=E,C.append(S)}this._document.body.append(C),h(d,()=>{C.remove(),e.complete()})}};Th=new WeakMap;gw=class{constructor(t,e=null,n,i){U(this,"compiledGlyphs",Object.create(null));A(this,we);g(this,we,t),this._inspectFont=e,n&&(this.charProcOperatorList=n),i&&Object.assign(this,i)}createNativeFontFace(){if(!this.data||this.disableFontFace)return null;let t;if(!this.cssFontInfo)t=new FontFace(this.loadedName,this.data,{});else{let e={weight:this.cssFontInfo.fontWeight};this.cssFontInfo.italicAngle&&(e.style=`oblique ${this.cssFontInfo.italicAngle}deg`),t=new FontFace(this.cssFontInfo.fontFamily,this.data,e)}return this._inspectFont?.(this),t}createFontFaceRule(){if(!this.data||this.disableFontFace)return null;let t=`url(data:${this.mimetype};base64,${this.data.toBase64()});`,e;if(!this.cssFontInfo)e=`@font-face {font-family:"${this.loadedName}";src:${t}}`;else{let n=`font-weight: ${this.cssFontInfo.fontWeight};`;this.cssFontInfo.italicAngle&&(n+=`font-style: oblique ${this.cssFontInfo.italicAngle}deg;`),e=`@font-face {font-family:"${this.cssFontInfo.fontFamily}";${n}src:${t}}`}return this._inspectFont?.(this,t),e}getPathGenerator(t,e){if(this.compiledGlyphs[e]!==void 0)return this.compiledGlyphs[e];let n=this.loadedName+"_path_"+e,i;try{i=t.get(n)}catch(a){jt(`getPathGenerator - ignoring character: "${a}".`)}let s=RT(i?.path);return this.fontExtraProperties||t.delete(n),this.compiledGlyphs[e]=s}get black(){return o(this,we).black}get bold(){return o(this,we).bold}get disableFontFace(){return o(this,we).disableFontFace}set disableFontFace(t){Ut(this,"disableFontFace",!!t)}get fontExtraProperties(){return o(this,we).fontExtraProperties}get isInvalidPDFjsFont(){return o(this,we).isInvalidPDFjsFont}get isType3Font(){return o(this,we).isType3Font}get italic(){return o(this,we).italic}get missingFile(){return o(this,we).missingFile}get remeasure(){return o(this,we).remeasure}get vertical(){return o(this,we).vertical}get ascent(){return o(this,we).ascent}get defaultWidth(){return o(this,we).defaultWidth}get descent(){return o(this,we).descent}get bbox(){return o(this,we).bbox}get fontMatrix(){return o(this,we).fontMatrix}get fallbackName(){return o(this,we).fallbackName}get loadedName(){return o(this,we).loadedName}get mimetype(){return o(this,we).mimetype}get name(){return o(this,we).name}get data(){return o(this,we).data}clearData(){o(this,we).clearData()}get cssFontInfo(){return o(this,we).cssFontInfo}get systemFontInfo(){return o(this,we).systemFontInfo}get defaultVMetrics(){return o(this,we).defaultVMetrics}};we=new WeakMap;S0=class{};U(S0,"strings",["fontFamily","fontWeight","italicAngle"]);D0=class{};U(D0,"strings",["css","loadedName","baseFontName","src"]);Yn=class Yn{};U(Yn,"bools",["black","bold","disableFontFace","fontExtraProperties","isInvalidPDFjsFont","isType3Font","italic","missingFile","remeasure","vertical"]),U(Yn,"numbers",["ascent","defaultWidth","descent"]),U(Yn,"strings",["fallbackName","loadedName","mimetype","name"]),U(Yn,"OFFSET_NUMBERS",Math.ceil(Yn.bools.length*2/8)),U(Yn,"OFFSET_BBOX",Yn.OFFSET_NUMBERS+Yn.numbers.length*8),U(Yn,"OFFSET_FONT_MATRIX",Yn.OFFSET_BBOX+1+8),U(Yn,"OFFSET_DEFAULT_VMETRICS",Yn.OFFSET_FONT_MATRIX+1+48),U(Yn,"OFFSET_STRINGS",Yn.OFFSET_DEFAULT_VMETRICS+1+6);ki=Yn,kn=class{};U(kn,"KIND",0),U(kn,"HAS_BBOX",1),U(kn,"HAS_BACKGROUND",2),U(kn,"SHADING_TYPE",3),U(kn,"N_COORD",4),U(kn,"N_COLOR",8),U(kn,"N_STOP",12),U(kn,"N_FIGURES",16);yw=class{constructor(t){A(this,Dh);A(this,Wp);A(this,Hy,new TextDecoder);A(this,Sh);g(this,Wp,t),g(this,Sh,new DataView(t))}get fontFamily(){return v(this,Dh,N0).call(this,0)}get fontWeight(){return v(this,Dh,N0).call(this,1)}get italicAngle(){return v(this,Dh,N0).call(this,2)}};Wp=new WeakMap,Hy=new WeakMap,Sh=new WeakMap,Dh=new WeakSet,N0=function(t){Ue(t<S0.strings.length,"Invalid string index");let e=0;for(let i=0;i<t;i++)e+=o(this,Sh).getUint32(e)+4;let n=o(this,Sh).getUint32(e);return o(this,Hy).decode(new Uint8Array(o(this,Wp),e+4,n))};bw=class{constructor(t){A(this,rc);A(this,ic);A(this,Nh,new TextDecoder);A(this,Cs);g(this,ic,t),g(this,Cs,new DataView(t))}get guessFallback(){return o(this,Cs).getUint8(0)!==0}get css(){return v(this,rc,kf).call(this,0)}get loadedName(){return v(this,rc,kf).call(this,1)}get baseFontName(){return v(this,rc,kf).call(this,2)}get src(){return v(this,rc,kf).call(this,3)}get style(){let t=1;t+=4+o(this,Cs).getUint32(t);let e=o(this,Cs).getUint32(t),n=o(this,Nh).decode(new Uint8Array(o(this,ic),t+4,e));t+=4+e;let i=o(this,Cs).getUint32(t),s=o(this,Nh).decode(new Uint8Array(o(this,ic),t+4,i));return{style:n,weight:s}}};ic=new WeakMap,Nh=new WeakMap,Cs=new WeakMap,rc=new WeakSet,kf=function(t){Ue(t<D0.strings.length,"Invalid string index");let e=5;for(let i=0;i<t;i++)e+=o(this,Cs).getUint32(e)+4;let n=o(this,Cs).getUint32(e);return o(this,Nh).decode(new Uint8Array(o(this,ic),e+4,n))};xw=class{constructor({buffer:t,extra:e}){A(this,me);A(this,$r);A(this,Wy,new TextDecoder);A(this,nn);g(this,$r,t),g(this,nn,new DataView(t)),e&&Object.assign(this,e)}get black(){return v(this,me,Fr).call(this,0)}get bold(){return v(this,me,Fr).call(this,1)}get disableFontFace(){return v(this,me,Fr).call(this,2)}get fontExtraProperties(){return v(this,me,Fr).call(this,3)}get isInvalidPDFjsFont(){return v(this,me,Fr).call(this,4)}get isType3Font(){return v(this,me,Fr).call(this,5)}get italic(){return v(this,me,Fr).call(this,6)}get missingFile(){return v(this,me,Fr).call(this,7)}get remeasure(){return v(this,me,Fr).call(this,8)}get vertical(){return v(this,me,Fr).call(this,9)}get ascent(){return v(this,me,I0).call(this,0)}get defaultWidth(){return v(this,me,I0).call(this,1)}get descent(){return v(this,me,I0).call(this,2)}get bbox(){return v(this,me,k0).call(this,ki.OFFSET_BBOX,4,"getInt16",2)}get fontMatrix(){return v(this,me,k0).call(this,ki.OFFSET_FONT_MATRIX,6,"getFloat64",8)}get defaultVMetrics(){return v(this,me,k0).call(this,ki.OFFSET_DEFAULT_VMETRICS,3,"getInt16",2)}get fallbackName(){return v(this,me,_f).call(this,0)}get loadedName(){return v(this,me,_f).call(this,1)}get mimetype(){return v(this,me,_f).call(this,2)}get name(){return v(this,me,_f).call(this,3)}get data(){let{offset:t,length:e}=v(this,me,ww).call(this);return e===0?void 0:new Uint8Array(o(this,$r),t+4,e)}clearData(){let{offset:t,length:e}=v(this,me,ww).call(this);e!==0&&(o(this,nn).setUint32(t,0),g(this,$r,new Uint8Array(o(this,$r),0,t+4).slice().buffer),g(this,nn,new DataView(o(this,$r))))}get cssFontInfo(){let t=ki.OFFSET_STRINGS,e=o(this,nn).getUint32(t);t+=4+e;let n=o(this,nn).getUint32(t);t+=4+n;let i=o(this,nn).getUint32(t);if(i===0)return null;let s=new Uint8Array(i);return s.set(new Uint8Array(o(this,$r),t+4,i)),new yw(s.buffer)}get systemFontInfo(){let t=ki.OFFSET_STRINGS,e=o(this,nn).getUint32(t);t+=4+e;let n=o(this,nn).getUint32(t);if(n===0)return null;let i=new Uint8Array(n);return i.set(new Uint8Array(o(this,$r),t+4,n)),new bw(i.buffer)}};$r=new WeakMap,Wy=new WeakMap,nn=new WeakMap,me=new WeakSet,Fr=function(t){Ue(t<ki.bools.length,"Invalid boolean index");let e=Math.floor(t/4),n=t*2%8,i=o(this,nn).getUint8(e)>>n&3;return i===0?void 0:i===2},I0=function(t){return Ue(t<ki.numbers.length,"Invalid number index"),o(this,nn).getFloat64(ki.OFFSET_NUMBERS+t*8)},k0=function(t,e,n,i){let s=o(this,nn).getUint8(t);if(s===0)return;Ue(s===e,"Invalid array length."),t+=1;let a=new Array(s);for(let l=0;l<s;l++)a[l]=o(this,nn)[n](t,!0),t+=i;return a},_f=function(t){Ue(t<ki.strings.length,"Invalid string index");let e=ki.OFFSET_STRINGS+4;for(let i=0;i<t;i++)e+=o(this,nn).getUint32(e)+4;let n=o(this,nn).getUint32(e);return o(this,Wy).decode(new Uint8Array(o(this,$r),e+4,n))},ww=function(){let t=ki.OFFSET_STRINGS,e=o(this,nn).getUint32(t);t+=4+e;let n=o(this,nn).getUint32(t);t+=4+n;let i=o(this,nn).getUint32(t);t+=4+i;let s=o(this,nn).getUint32(t);return{offset:t,length:s}};Aw=class{constructor(t){this.buffer=t,this.view=new DataView(t),this.data=new Uint8Array(t)}getIR(){let t=this.view,e=this.data[kn.KIND],n=!!this.data[kn.HAS_BBOX],i=!!this.data[kn.HAS_BACKGROUND],s=t.getUint32(kn.N_COORD,!0),a=t.getUint32(kn.N_COLOR,!0),l=t.getUint32(kn.N_STOP,!0),c=t.getUint32(kn.N_FIGURES,!0),u=20,h=new Float32Array(this.buffer,u,s*2);u+=s*8;let d=new Uint8Array(this.buffer,u,a*3);u+=a*3;let f=[];for(let x=0;x<l;++x){let b=t.getFloat32(u,!0);u+=4;let w=t.getUint32(u,!0);u+=4,f.push([b,`#${w.toString(16).padStart(6,"0")}`])}let p=null;if(n){p=[];for(let x=0;x<4;++x)p.push(t.getFloat32(u,!0)),u+=4}let m=null;i&&(m=new Uint8Array(this.buffer,u,3),u+=3);let y=[];for(let x=0;x<c;++x){let b=t.getUint8(u);u+=1,u=Math.ceil(u/4)*4;let w=t.getUint32(u,!0);u+=4;let C=new Int32Array(this.buffer,u,w);u+=w*4;let E=t.getUint32(u,!0);u+=4;let S=new Int32Array(this.buffer,u,E);u+=E*4;let N={type:b,coords:C,colors:S};b===Dl.LATTICE&&(N.verticesPerRow=t.getUint32(u,!0),u+=4),y.push(N)}if(e===1)return["RadialAxial","axial",p,f,Array.from(h.slice(0,2)),Array.from(h.slice(2,4)),null,null];if(e===2)return["RadialAxial","radial",p,f,[h[0],h[1]],[h[3],h[4]],h[2],h[5]];if(e===3){let x=this.data[kn.SHADING_TYPE],b=null;if(h.length>0){b=[1/0,1/0,-1/0,-1/0];for(let w=0,C=h.length;w<C;w+=2)yt.pointBoundingBox(h[w],h[w+1],b)}return["Mesh",x,h,d,y,b,p,m]}throw new Error(`Unsupported pattern kind: ${e}`)}},vw=class{constructor(t){A(this,Ih);g(this,Ih,t)}get path(){return Xe.isFloat16ArraySupported?new Float16Array(o(this,Ih)):new Float32Array(o(this,Ih))}};Ih=new WeakMap;Cw=r=>typeof r=="object"&&Number.isInteger(r?.num)&&r.num>=0&&Number.isInteger(r?.gen)&&r.gen>=0,FO=r=>typeof r=="object"&&typeof r?.name=="string",gS=IO.bind(null,Cw,FO),Ew=class{constructor(){A(this,ba,new Map);A(this,qy,Promise.resolve())}postMessage(t,e){let n={data:structuredClone(t,e?{transfer:e}:null)};o(this,qy).then(()=>{for(let[i]of o(this,ba))i.call(this,n)})}addEventListener(t,e,n=null){let i=null;if(n?.signal instanceof AbortSignal){let{signal:s}=n;if(s.aborted){jt("LoopbackPort - cannot use an `aborted` signal.");return}let a=()=>this.removeEventListener(t,e);i=()=>s.removeEventListener("abort",a),s.addEventListener("abort",a)}o(this,ba).set(e,i)}removeEventListener(t,e){o(this,ba).get(e)?.(),o(this,ba).delete(e)}terminate(){for(let[,t]of o(this,ba))t?.();o(this,ba).clear()}};ba=new WeakMap,qy=new WeakMap;d0={DATA:1,ERROR:2},ln={CANCEL:1,CANCEL_COMPLETE:2,CLOSE:3,ENQUEUE:4,ERROR:5,PULL:6,PULL_COMPLETE:7,START_COMPLETE:8};Nl=class{constructor(t,e,n){A(this,Nr);A(this,kh,new AbortController);this.sourceName=t,this.targetName=e,this.comObj=n,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),n.addEventListener("message",v(this,Nr,yS).bind(this),{signal:o(this,kh).signal})}on(t,e){let n=this.actionHandler;if(n[t])throw new Error(`There is already an actionName called "${t}"`);n[t]=e}send(t,e,n){this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:t,data:e},n)}sendWithPromise(t,e,n){let i=this.callbackId++,s=Promise.withResolvers();this.callbackCapabilities[i]=s;try{this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:t,callbackId:i,data:e},n)}catch(a){s.reject(a)}return s.promise}sendWithStream(t,e,n,i){let s=this.streamId++,a=this.sourceName,l=this.targetName,c=this.comObj;return new ReadableStream({start:u=>{let h=Promise.withResolvers();return this.streamControllers[s]={controller:u,startCall:h,pullCall:null,cancelCall:null,isClosed:!1},c.postMessage({sourceName:a,targetName:l,action:t,streamId:s,data:e,desiredSize:u.desiredSize},i),h.promise},pull:u=>{let h=Promise.withResolvers();return this.streamControllers[s].pullCall=h,c.postMessage({sourceName:a,targetName:l,stream:ln.PULL,streamId:s,desiredSize:u.desiredSize}),h.promise},cancel:u=>{Ue(u instanceof Error,"cancel must have a valid reason");let h=Promise.withResolvers();return this.streamControllers[s].cancelCall=h,this.streamControllers[s].isClosed=!0,c.postMessage({sourceName:a,targetName:l,stream:ln.CANCEL,streamId:s,reason:xi(u)}),h.promise}},n)}destroy(){o(this,kh)?.abort(),g(this,kh,null)}};kh=new WeakMap,Nr=new WeakSet,yS=function({data:t}){if(t.targetName!==this.sourceName)return;if(t.stream){v(this,Nr,xS).call(this,t);return}if(t.callback){let n=t.callbackId,i=this.callbackCapabilities[n];if(!i)throw new Error(`Cannot resolve callback ${n}`);if(delete this.callbackCapabilities[n],t.callback===d0.DATA)i.resolve(t.data);else if(t.callback===d0.ERROR)i.reject(xi(t.reason));else throw new Error("Unexpected callback case");return}let e=this.actionHandler[t.action];if(!e)throw new Error(`Unknown action from worker: ${t.action}`);if(t.callbackId){let n=this.sourceName,i=t.sourceName,s=this.comObj;Promise.try(e,t.data).then(function(a){s.postMessage({sourceName:n,targetName:i,callback:d0.DATA,callbackId:t.callbackId,data:a})},function(a){s.postMessage({sourceName:n,targetName:i,callback:d0.ERROR,callbackId:t.callbackId,reason:xi(a)})});return}if(t.streamId){v(this,Nr,bS).call(this,t);return}e(t.data)},bS=function(t){let e=t.streamId,n=this.sourceName,i=t.sourceName,s=this.comObj,a=this,l=this.actionHandler[t.action],c={enqueue(u,h=1,d){if(this.isCancelled)return;let f=this.desiredSize;this.desiredSize-=h,f>0&&this.desiredSize<=0&&(this.sinkCapability=Promise.withResolvers(),this.ready=this.sinkCapability.promise),s.postMessage({sourceName:n,targetName:i,stream:ln.ENQUEUE,streamId:e,chunk:u},d)},close(){this.isCancelled||(this.isCancelled=!0,s.postMessage({sourceName:n,targetName:i,stream:ln.CLOSE,streamId:e}),delete a.streamSinks[e])},error(u){Ue(u instanceof Error,"error must have a valid reason"),!this.isCancelled&&(this.isCancelled=!0,s.postMessage({sourceName:n,targetName:i,stream:ln.ERROR,streamId:e,reason:xi(u)}))},sinkCapability:Promise.withResolvers(),onPull:null,onCancel:null,isCancelled:!1,desiredSize:t.desiredSize,ready:null};c.sinkCapability.resolve(),c.ready=c.sinkCapability.promise,this.streamSinks[e]=c,Promise.try(l,t.data,c).then(function(){s.postMessage({sourceName:n,targetName:i,stream:ln.START_COMPLETE,streamId:e,success:!0})},function(u){s.postMessage({sourceName:n,targetName:i,stream:ln.START_COMPLETE,streamId:e,reason:xi(u)})})},xS=function(t){let e=t.streamId,n=this.sourceName,i=t.sourceName,s=this.comObj,a=this.streamControllers[e],l=this.streamSinks[e];switch(t.stream){case ln.START_COMPLETE:t.success?a.startCall.resolve():a.startCall.reject(xi(t.reason));break;case ln.PULL_COMPLETE:t.success?a.pullCall.resolve():a.pullCall.reject(xi(t.reason));break;case ln.PULL:if(!l){s.postMessage({sourceName:n,targetName:i,stream:ln.PULL_COMPLETE,streamId:e,success:!0});break}l.desiredSize<=0&&t.desiredSize>0&&l.sinkCapability.resolve(),l.desiredSize=t.desiredSize,Promise.try(l.onPull||pT).then(function(){s.postMessage({sourceName:n,targetName:i,stream:ln.PULL_COMPLETE,streamId:e,success:!0})},function(u){s.postMessage({sourceName:n,targetName:i,stream:ln.PULL_COMPLETE,streamId:e,reason:xi(u)})});break;case ln.ENQUEUE:if(Ue(a,"enqueue should have stream controller"),a.isClosed)break;a.controller.enqueue(t.chunk);break;case ln.CLOSE:if(Ue(a,"close should have stream controller"),a.isClosed)break;a.isClosed=!0,a.controller.close(),v(this,Nr,_0).call(this,a,e);break;case ln.ERROR:Ue(a,"error should have stream controller"),a.controller.error(xi(t.reason)),v(this,Nr,_0).call(this,a,e);break;case ln.CANCEL_COMPLETE:t.success?a.cancelCall.resolve():a.cancelCall.reject(xi(t.reason)),v(this,Nr,_0).call(this,a,e);break;case ln.CANCEL:if(!l)break;let c=xi(t.reason);Promise.try(l.onCancel||pT,c).then(function(){s.postMessage({sourceName:n,targetName:i,stream:ln.CANCEL_COMPLETE,streamId:e,success:!0})},function(u){s.postMessage({sourceName:n,targetName:i,stream:ln.CANCEL_COMPLETE,streamId:e,reason:xi(u)})}),l.sinkCapability.reject(c),l.isCancelled=!0,delete this.streamSinks[e];break;default:throw new Error("Unexpected stream case")}},_0=async function(t,e){await Promise.allSettled([t.startCall?.promise,t.pullCall?.promise,t.cancelCall?.promise]),delete this.streamControllers[e]};py=class{constructor({cMapUrl:t=null,standardFontDataUrl:e=null,wasmUrl:n=null}){A(this,Vy,Object.freeze({cMapUrl:"CMap",standardFontDataUrl:"font",wasmUrl:"wasm"}));this.cMapUrl=t,this.standardFontDataUrl=e,this.wasmUrl=n}async fetch({kind:t,filename:e}){switch(t){case"cMapUrl":case"standardFontDataUrl":case"wasmUrl":break;default:ue(`Not implemented: ${t}`)}let n=this[t];if(!n)throw new Error(`Ensure that the \`${t}\` API parameter is provided.`);let i=`${n}${e}`;return this._fetch(i,t).catch(s=>{throw new Error(`Unable to load ${o(this,Vy)[t]} data at: ${i}`)})}async _fetch(t,e){ue("Abstract method `_fetch` called.")}};Vy=new WeakMap;my=class extends py{async _fetch(t,e){let n=e==="cMapUrl"&&!t.endsWith(".bcmap")?"text":"bytes",i=await hb(t,n);return i instanceof Uint8Array?i:lb(i)}},gy=class{constructor({enableHWA:t=!1}){A(this,qp,!1);g(this,qp,t)}create(t,e){if(t<=0||e<=0)throw new Error("Invalid canvas size");let n=this._createCanvas(t,e);return{canvas:n,context:n.getContext("2d",{willReadFrequently:!o(this,qp)})}}reset({canvas:t},e,n){if(!t)throw new Error("Canvas is not specified");if(e<=0||n<=0)throw new Error("Invalid canvas size");t.width=e,t.height=n}destroy(t){let{canvas:e}=t;if(!e)throw new Error("Canvas is not specified");e.width=e.height=0,t.canvas=null,t.context=null}_createCanvas(t,e){ue("Abstract method `_createCanvas` called.")}};qp=new WeakMap;Tw=class extends gy{constructor({ownerDocument:t=globalThis.document,enableHWA:e=!1}){super({enableHWA:e}),this._document=t}_createCanvas(t,e){let n=this._document.createElement("canvas");return n.width=t,n.height=e,n}},yy=class{addFilter(t){return"none"}addHCMFilter(t,e){return"none"}addAlphaFilter(t){return"none"}addLuminosityFilter(t){return"none"}addHighlightHCMFilter(t,e,n,i,s){return"none"}destroy(t=!1){}},Sw=class extends yy{constructor({docId:e,ownerDocument:n=globalThis.document}){super();A(this,Nt);A(this,sc);A(this,_h);A(this,xa);A(this,wa);A(this,Jn);A(this,ac);A(this,oc,0);g(this,wa,e),g(this,Jn,n)}addFilter(e){if(!e)return"none";let n=o(this,Nt,Xn).get(e);if(n)return n;let[i,s,a]=v(this,Nt,M0).call(this,e),l=e.length===1?i:`${i}${s}${a}`;if(n=o(this,Nt,Xn).get(l),n)return o(this,Nt,Xn).set(e,n),n;let c=`g_${o(this,wa)}_transfer_map_${an(this,oc)._++}`,u=v(this,Nt,ju).call(this,c);o(this,Nt,Xn).set(e,u),o(this,Nt,Xn).set(l,u);let h=v(this,Nt,Gu).call(this,c);return v(this,Nt,Ff).call(this,i,s,a,h),u}addHCMFilter(e,n){let i=`${e}-${n}`,s="base",a=o(this,Nt,Mf).get(s);if(a?.key===i||(a?(a.filter?.remove(),a.key=i,a.url="none",a.filter=null):(a={key:i,url:"none",filter:null},o(this,Nt,Mf).set(s,a)),!e||!n))return a.url;let l=v(this,Nt,Pf).call(this,e);e=yt.makeHexColor(...l);let c=v(this,Nt,Pf).call(this,n);if(n=yt.makeHexColor(...c),o(this,Nt,zu).style.color="",e==="#000000"&&n==="#ffffff"||e===n)return a.url;let u=new Array(256);for(let m=0;m<=255;m++){let y=m/255;u[m]=y<=.03928?y/12.92:((y+.055)/1.055)**2.4}let h=u.join(","),d=`g_${o(this,wa)}_hcm_filter`,f=a.filter=v(this,Nt,Gu).call(this,d);v(this,Nt,Ff).call(this,h,h,h,f),v(this,Nt,Dw).call(this,f);let p=(m,y)=>{let x=l[m]/255,b=c[m]/255,w=new Array(y+1);for(let C=0;C<=y;C++)w[C]=x+C/y*(b-x);return w.join(",")};return v(this,Nt,Ff).call(this,p(0,5),p(1,5),p(2,5),f),a.url=v(this,Nt,ju).call(this,d),a.url}addAlphaFilter(e){let n=o(this,Nt,Xn).get(e);if(n)return n;let[i]=v(this,Nt,M0).call(this,[e]),s=`alpha_${i}`;if(n=o(this,Nt,Xn).get(s),n)return o(this,Nt,Xn).set(e,n),n;let a=`g_${o(this,wa)}_alpha_map_${an(this,oc)._++}`,l=v(this,Nt,ju).call(this,a);o(this,Nt,Xn).set(e,l),o(this,Nt,Xn).set(s,l);let c=v(this,Nt,Gu).call(this,a);return v(this,Nt,Nw).call(this,i,c),l}addLuminosityFilter(e){let n=o(this,Nt,Xn).get(e||"luminosity");if(n)return n;let i,s;if(e?([i]=v(this,Nt,M0).call(this,[e]),s=`luminosity_${i}`):s="luminosity",n=o(this,Nt,Xn).get(s),n)return o(this,Nt,Xn).set(e,n),n;let a=`g_${o(this,wa)}_luminosity_map_${an(this,oc)._++}`,l=v(this,Nt,ju).call(this,a);o(this,Nt,Xn).set(e,l),o(this,Nt,Xn).set(s,l);let c=v(this,Nt,Gu).call(this,a);return v(this,Nt,wS).call(this,c),e&&v(this,Nt,Nw).call(this,i,c),l}addHighlightHCMFilter(e,n,i,s,a){let l=`${n}-${i}-${s}-${a}`,c=o(this,Nt,Mf).get(e);if(c?.key===l||(c?(c.filter?.remove(),c.key=l,c.url="none",c.filter=null):(c={key:l,url:"none",filter:null},o(this,Nt,Mf).set(e,c)),!n||!i))return c.url;let[u,h]=[n,i].map(v(this,Nt,Pf).bind(this)),d=Math.round(.2126*u[0]+.7152*u[1]+.0722*u[2]),f=Math.round(.2126*h[0]+.7152*h[1]+.0722*h[2]),[p,m]=[s,a].map(v(this,Nt,Pf).bind(this));f<d&&([d,f,p,m]=[f,d,m,p]),o(this,Nt,zu).style.color="";let y=(w,C,E)=>{let S=new Array(256),N=(f-d)/E,k=w/255,M=(C-w)/(255*E),R=0;for(let j=0;j<=E;j++){let $=Math.round(d+j*N),q=k+j*M;for(let Q=R;Q<=$;Q++)S[Q]=q;R=$+1}for(let j=R;j<256;j++)S[j]=S[R-1];return S.join(",")},x=`g_${o(this,wa)}_hcm_${e}_filter`,b=c.filter=v(this,Nt,Gu).call(this,x);return v(this,Nt,Dw).call(this,b),v(this,Nt,Ff).call(this,y(p[0],m[0],5),y(p[1],m[1],5),y(p[2],m[2],5),b),c.url=v(this,Nt,ju).call(this,x),c.url}destroy(e=!1){e&&o(this,ac)?.size||(o(this,xa)?.parentNode.parentNode.remove(),g(this,xa,null),o(this,_h)?.clear(),g(this,_h,null),o(this,ac)?.clear(),g(this,ac,null),g(this,oc,0))}};sc=new WeakMap,_h=new WeakMap,xa=new WeakMap,wa=new WeakMap,Jn=new WeakMap,ac=new WeakMap,oc=new WeakMap,Nt=new WeakSet,Xn=function(){return o(this,_h)||g(this,_h,new Map)},Mf=function(){return o(this,ac)||g(this,ac,new Map)},zu=function(){if(!o(this,xa)){let e=o(this,Jn).createElement("div"),{style:n}=e;n.visibility="hidden",n.contain="strict",n.width=n.height=0,n.position="absolute",n.top=n.left=0,n.zIndex=-1;let i=o(this,Jn).createElementNS(ta,"svg");i.setAttribute("width",0),i.setAttribute("height",0),g(this,xa,o(this,Jn).createElementNS(ta,"defs")),e.append(i),i.append(o(this,xa)),o(this,Jn).body.append(e)}return o(this,xa)},M0=function(e){if(e.length===1){let u=e[0],h=new Array(256);for(let f=0;f<256;f++)h[f]=u[f]/255;let d=h.join(",");return[d,d,d]}let[n,i,s]=e,a=new Array(256),l=new Array(256),c=new Array(256);for(let u=0;u<256;u++)a[u]=n[u]/255,l[u]=i[u]/255,c[u]=s[u]/255;return[a.join(","),l.join(","),c.join(",")]},ju=function(e){if(o(this,sc)===void 0){g(this,sc,"");let n=o(this,Jn).URL;n!==o(this,Jn).baseURI&&(ag(n)?jt('#createUrl: ignore "data:"-URL for performance reasons.'):g(this,sc,gA(n,"")))}return`url(${o(this,sc)}#${e})`},wS=function(e){let n=o(this,Jn).createElementNS(ta,"feColorMatrix");n.setAttribute("type","matrix"),n.setAttribute("values","0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.3 0.59 0.11 0 0"),e.append(n)},Dw=function(e){let n=o(this,Jn).createElementNS(ta,"feColorMatrix");n.setAttribute("type","matrix"),n.setAttribute("values","0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0 0 0 1 0"),e.append(n)},Gu=function(e){let n=o(this,Jn).createElementNS(ta,"filter");return n.setAttribute("color-interpolation-filters","sRGB"),n.setAttribute("id",e),o(this,Nt,zu).append(n),n},Of=function(e,n,i){let s=o(this,Jn).createElementNS(ta,n);s.setAttribute("type","discrete"),s.setAttribute("tableValues",i),e.append(s)},Ff=function(e,n,i,s){let a=o(this,Jn).createElementNS(ta,"feComponentTransfer");s.append(a),v(this,Nt,Of).call(this,a,"feFuncR",e),v(this,Nt,Of).call(this,a,"feFuncG",n),v(this,Nt,Of).call(this,a,"feFuncB",i)},Nw=function(e,n){let i=o(this,Jn).createElementNS(ta,"feComponentTransfer");n.append(i),v(this,Nt,Of).call(this,i,"feFuncA",e)},Pf=function(e){return o(this,Nt,zu).style.color=e,Bd(getComputedStyle(o(this,Nt,zu)).getPropertyValue("color"))};Ki&&jt("Please use the `legacy` build in Node.js environments.");Iw=class extends yy{},kw=class extends gy{_createCanvas(t,e){return nt.default.getBuiltinModule("module").createRequire("")("@napi-rs/canvas").createCanvas(t,e)}},_w=class extends py{async _fetch(t,e){return PO(t)}},RO=`
|
|
10
|
+
`)}function KC(r){if(r=r||{},r.locator===void 0&&(r.locator=!0),this.assign=r.assign||hl.assign,this.domHandler=r.domHandler||qg,this.onError=r.onError||r.errorHandler,r.errorHandler&&typeof r.errorHandler!="function")throw new TypeError("errorHandler object is no longer supported, switch to onError!");r.errorHandler&&r.errorHandler("warning","The `errorHandler` option has been deprecated, use `onError` instead!",this),this.normalizeLineEndings=r.normalizeLineEndings||YC,this.locator=!!r.locator,this.xmlns=this.assign(Object.create(null),r.xmlns)}KC.prototype.parseFromString=function(r,t){if(!f_(t))throw new TypeError('DOMParser.parseFromString: the provided mimeType "'+t+'" is not valid.');var e=this.assign(Object.create(null),this.xmlns),n=WC.XML_ENTITIES,i=e[""]||null;h_(t)?(n=WC.HTML_ENTITIES,i=dx.HTML):t===XC.XML_SVG_IMAGE&&(i=dx.SVG),e[""]=i,e.xml=e.xml||dx.XML;var s=new this.domHandler({mimeType:t,defaultNamespace:i,onError:this.onError}),a=this.locator?{}:void 0;this.locator&&s.setDocumentLocator(a);var l=new p_;l.errorHandler=s,l.domBuilder=s;var c=!hl.isHTMLMimeType(t);return c&&typeof r!="string"&&l.errorHandler.fatalError("source is not a string"),l.parse(this.normalizeLineEndings(String(r)),e,n),s.doc.documentElement||l.errorHandler.fatalError("missing root element"),s.doc};function qg(r){var t=r||{};this.mimeType=t.mimeType||XC.XML_APPLICATION,this.defaultNamespace=t.defaultNamespace||null,this.cdata=!1,this.currentElement=void 0,this.doc=void 0,this.locator=void 0,this.onError=t.onError}function Du(r,t){t.lineNumber=r.lineNumber,t.columnNumber=r.columnNumber}qg.prototype={startDocument:function(){var r=new u_;this.doc=d_(this.mimeType)?r.createHTMLDocument(!1):r.createDocument(this.defaultNamespace,"")},startElement:function(r,t,e,n){var i=this.doc,s=i.createElementNS(r,e||t),a=n.length;Wg(this,s),this.currentElement=s,this.locator&&Du(this.locator,s);for(var l=0;l<a;l++){var r=n.getURI(l),c=n.getValue(l),e=n.getQName(l),u=i.createAttributeNS(r,e);this.locator&&Du(n.getLocator(l),u),u.value=u.nodeValue=c,s.setAttributeNode(u)}},endElement:function(r,t,e){this.currentElement=this.currentElement.parentNode},startPrefixMapping:function(r,t){},endPrefixMapping:function(r){},processingInstruction:function(r,t){var e=this.doc.createProcessingInstruction(r,t);this.locator&&Du(this.locator,e),Wg(this,e)},ignorableWhitespace:function(r,t,e){},characters:function(r,t,e){if(r=VC.apply(this,arguments),r){if(this.cdata)var n=this.doc.createCDATASection(r);else var n=this.doc.createTextNode(r);this.currentElement?this.currentElement.appendChild(n):/^\s*$/.test(r)&&this.doc.appendChild(n),this.locator&&Du(this.locator,n)}},skippedEntity:function(r){},endDocument:function(){this.doc.normalize()},setDocumentLocator:function(r){r&&(r.lineNumber=0),this.locator=r},comment:function(r,t,e){r=VC.apply(this,arguments);var n=this.doc.createComment(r);this.locator&&Du(this.locator,n),Wg(this,n)},startCDATA:function(){this.cdata=!0},endCDATA:function(){this.cdata=!1},startDTD:function(r,t,e,n){var i=this.doc.implementation;if(i&&i.createDocumentType){var s=i.createDocumentType(r,t,e,n);this.locator&&Du(this.locator,s),Wg(this,s),this.doc.doctype=s}},reportError:function(r,t){if(typeof this.onError=="function")try{this.onError(r,t,this)}catch(e){throw new qC("Reporting "+r+' "'+t+'" caused '+e,this.locator)}else console.error("[xmldom "+r+"] "+t,m_(this.locator))},warning:function(r){this.reportError("warning",r)},error:function(r){this.reportError("error",r)},fatalError:function(r){throw this.reportError("fatalError",r),new qC(r,this.locator)}};function m_(r){if(r)return`
|
|
11
|
+
@#[line:`+r.lineNumber+",col:"+r.columnNumber+"]"}function VC(r,t,e){return typeof r=="string"?r.substr(t,e):r.length>=t+e||t?new java.lang.String(r,t,e)+"":r}"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,function(r){qg.prototype[r]=function(){return null}});function Wg(r,t){r.currentElement?r.currentElement.appendChild(t):r.doc.appendChild(t)}function g_(r){if(r==="error")throw"onErrorStopParsing"}function y_(){throw"onWarningStopParsing"}Nu.__DOMHandler=qg;Nu.DOMParser=KC;Nu.normalizeLineEndings=YC;Nu.onErrorStopParsing=g_;Nu.onWarningStopParsing=y_});var QC=Xt(te=>{"use strict";B();var Iu=cl();te.assign=Iu.assign;te.hasDefaultHTMLNamespace=Iu.hasDefaultHTMLNamespace;te.isHTMLMimeType=Iu.isHTMLMimeType;te.isValidMimeType=Iu.isValidMimeType;te.MIME_TYPE=Iu.MIME_TYPE;te.NAMESPACE=Iu.NAMESPACE;var Vg=Zd();te.DOMException=Vg.DOMException;te.DOMExceptionName=Vg.DOMExceptionName;te.ExceptionCode=Vg.ExceptionCode;te.ParseError=Vg.ParseError;var fn=ux();te.Attr=fn.Attr;te.CDATASection=fn.CDATASection;te.CharacterData=fn.CharacterData;te.Comment=fn.Comment;te.Document=fn.Document;te.DocumentFragment=fn.DocumentFragment;te.DocumentType=fn.DocumentType;te.DOMImplementation=fn.DOMImplementation;te.Element=fn.Element;te.Entity=fn.Entity;te.EntityReference=fn.EntityReference;te.LiveNodeList=fn.LiveNodeList;te.NamedNodeMap=fn.NamedNodeMap;te.Node=fn.Node;te.NodeList=fn.NodeList;te.Notation=fn.Notation;te.ProcessingInstruction=fn.ProcessingInstruction;te.Text=fn.Text;te.XMLSerializer=fn.XMLSerializer;var Xg=ZC();te.DOMParser=Xg.DOMParser;te.normalizeLineEndings=Xg.normalizeLineEndings;te.onErrorStopParsing=Xg.onErrorStopParsing;te.onWarningStopParsing=Xg.onWarningStopParsing});var JC=Xt((bR,mx)=>{B();var px=(function(r){"use strict";var t=Object.prototype,e=t.hasOwnProperty,n=Object.defineProperty||function(T,I,_){T[I]=_.value},i,s=typeof Symbol=="function"?Symbol:{},a=s.iterator||"@@iterator",l=s.asyncIterator||"@@asyncIterator",c=s.toStringTag||"@@toStringTag";function u(T,I,_){return Object.defineProperty(T,I,{value:_,enumerable:!0,configurable:!0,writable:!0}),T[I]}try{u({},"")}catch{u=function(I,_,W){return I[_]=W}}function h(T,I,_,W){var z=I&&I.prototype instanceof b?I:b,D=Object.create(z.prototype),F=new Z(W||[]);return n(D,"_invoke",{value:j(T,_,F)}),D}r.wrap=h;function d(T,I,_){try{return{type:"normal",arg:T.call(I,_)}}catch(W){return{type:"throw",arg:W}}}var f="suspendedStart",p="suspendedYield",m="executing",y="completed",x={};function b(){}function w(){}function C(){}var E={};u(E,a,function(){return this});var S=Object.getPrototypeOf,N=S&&S(S(Y([])));N&&N!==t&&e.call(N,a)&&(E=N);var k=C.prototype=b.prototype=Object.create(E);w.prototype=C,n(k,"constructor",{value:C,configurable:!0}),n(C,"constructor",{value:w,configurable:!0}),w.displayName=u(C,c,"GeneratorFunction");function M(T){["next","throw","return"].forEach(function(I){u(T,I,function(_){return this._invoke(I,_)})})}r.isGeneratorFunction=function(T){var I=typeof T=="function"&&T.constructor;return I?I===w||(I.displayName||I.name)==="GeneratorFunction":!1},r.mark=function(T){return Object.setPrototypeOf?Object.setPrototypeOf(T,C):(T.__proto__=C,u(T,c,"GeneratorFunction")),T.prototype=Object.create(k),T},r.awrap=function(T){return{__await:T}};function R(T,I){function _(D,F,P,G){var H=d(T[D],T,F);if(H.type==="throw")G(H.arg);else{var V=H.arg,L=V.value;return L&&typeof L=="object"&&e.call(L,"__await")?I.resolve(L.__await).then(function(tt){_("next",tt,P,G)},function(tt){_("throw",tt,P,G)}):I.resolve(L).then(function(tt){V.value=tt,P(V)},function(tt){return _("throw",tt,P,G)})}}var W;function z(D,F){function P(){return new I(function(G,H){_(D,F,G,H)})}return W=W?W.then(P,P):P()}n(this,"_invoke",{value:z})}M(R.prototype),u(R.prototype,l,function(){return this}),r.AsyncIterator=R,r.async=function(T,I,_,W,z){z===void 0&&(z=Promise);var D=new R(h(T,I,_,W),z);return r.isGeneratorFunction(I)?D:D.next().then(function(F){return F.done?F.value:D.next()})};function j(T,I,_){var W=f;return function(D,F){if(W===m)throw new Error("Generator is already running");if(W===y){if(D==="throw")throw F;return X()}for(_.method=D,_.arg=F;;){var P=_.delegate;if(P){var G=$(P,_);if(G){if(G===x)continue;return G}}if(_.method==="next")_.sent=_._sent=_.arg;else if(_.method==="throw"){if(W===f)throw W=y,_.arg;_.dispatchException(_.arg)}else _.method==="return"&&_.abrupt("return",_.arg);W=m;var H=d(T,I,_);if(H.type==="normal"){if(W=_.done?y:p,H.arg===x)continue;return{value:H.arg,done:_.done}}else H.type==="throw"&&(W=y,_.method="throw",_.arg=H.arg)}}}function $(T,I){var _=I.method,W=T.iterator[_];if(W===i)return I.delegate=null,_==="throw"&&T.iterator.return&&(I.method="return",I.arg=i,$(T,I),I.method==="throw")||_!=="return"&&(I.method="throw",I.arg=new TypeError("The iterator does not provide a '"+_+"' method")),x;var z=d(W,T.iterator,I.arg);if(z.type==="throw")return I.method="throw",I.arg=z.arg,I.delegate=null,x;var D=z.arg;if(!D)return I.method="throw",I.arg=new TypeError("iterator result is not an object"),I.delegate=null,x;if(D.done)I[T.resultName]=D.value,I.next=T.nextLoc,I.method!=="return"&&(I.method="next",I.arg=i);else return D;return I.delegate=null,x}M(k),u(k,c,"Generator"),u(k,a,function(){return this}),u(k,"toString",function(){return"[object Generator]"});function q(T){var I={tryLoc:T[0]};1 in T&&(I.catchLoc=T[1]),2 in T&&(I.finallyLoc=T[2],I.afterLoc=T[3]),this.tryEntries.push(I)}function Q(T){var I=T.completion||{};I.type="normal",delete I.arg,T.completion=I}function Z(T){this.tryEntries=[{tryLoc:"root"}],T.forEach(q,this),this.reset(!0)}r.keys=function(T){var I=Object(T),_=[];for(var W in I)_.push(W);return _.reverse(),function z(){for(;_.length;){var D=_.pop();if(D in I)return z.value=D,z.done=!1,z}return z.done=!0,z}};function Y(T){if(T){var I=T[a];if(I)return I.call(T);if(typeof T.next=="function")return T;if(!isNaN(T.length)){var _=-1,W=function z(){for(;++_<T.length;)if(e.call(T,_))return z.value=T[_],z.done=!1,z;return z.value=i,z.done=!0,z};return W.next=W}}return{next:X}}r.values=Y;function X(){return{value:i,done:!0}}return Z.prototype={constructor:Z,reset:function(T){if(this.prev=0,this.next=0,this.sent=this._sent=i,this.done=!1,this.delegate=null,this.method="next",this.arg=i,this.tryEntries.forEach(Q),!T)for(var I in this)I.charAt(0)==="t"&&e.call(this,I)&&!isNaN(+I.slice(1))&&(this[I]=i)},stop:function(){this.done=!0;var T=this.tryEntries[0],I=T.completion;if(I.type==="throw")throw I.arg;return this.rval},dispatchException:function(T){if(this.done)throw T;var I=this;function _(G,H){return D.type="throw",D.arg=T,I.next=G,H&&(I.method="next",I.arg=i),!!H}for(var W=this.tryEntries.length-1;W>=0;--W){var z=this.tryEntries[W],D=z.completion;if(z.tryLoc==="root")return _("end");if(z.tryLoc<=this.prev){var F=e.call(z,"catchLoc"),P=e.call(z,"finallyLoc");if(F&&P){if(this.prev<z.catchLoc)return _(z.catchLoc,!0);if(this.prev<z.finallyLoc)return _(z.finallyLoc)}else if(F){if(this.prev<z.catchLoc)return _(z.catchLoc,!0)}else if(P){if(this.prev<z.finallyLoc)return _(z.finallyLoc)}else throw new Error("try statement without catch or finally")}}},abrupt:function(T,I){for(var _=this.tryEntries.length-1;_>=0;--_){var W=this.tryEntries[_];if(W.tryLoc<=this.prev&&e.call(W,"finallyLoc")&&this.prev<W.finallyLoc){var z=W;break}}z&&(T==="break"||T==="continue")&&z.tryLoc<=I&&I<=z.finallyLoc&&(z=null);var D=z?z.completion:{};return D.type=T,D.arg=I,z?(this.method="next",this.next=z.finallyLoc,x):this.complete(D)},complete:function(T,I){if(T.type==="throw")throw T.arg;return T.type==="break"||T.type==="continue"?this.next=T.arg:T.type==="return"?(this.rval=this.arg=T.arg,this.method="return",this.next="end"):T.type==="normal"&&I&&(this.next=I),x},finish:function(T){for(var I=this.tryEntries.length-1;I>=0;--I){var _=this.tryEntries[I];if(_.finallyLoc===T)return this.complete(_.completion,_.afterLoc),Q(_),x}},catch:function(T){for(var I=this.tryEntries.length-1;I>=0;--I){var _=this.tryEntries[I];if(_.tryLoc===T){var W=_.completion;if(W.type==="throw"){var z=W.arg;Q(_)}return z}}throw new Error("illegal catch attempt")},delegateYield:function(T,I,_){return this.delegate={iterator:Y(T),resultName:I,nextLoc:_},this.method==="next"&&(this.arg=i),x}},r})(typeof mx=="object"?mx.exports:{});try{regeneratorRuntime=px}catch{typeof globalThis=="object"?globalThis.regeneratorRuntime=px:Function("r","regeneratorRuntime = r")(px)}});var Kg=Xt((wR,tE)=>{"use strict";B();tE.exports=(r,t)=>`${r}-${t}-${Math.random().toString(16).slice(3,8)}`});var gx=Xt((vR,nE)=>{"use strict";B();var T_=Kg(),eE=0;nE.exports=({id:r,action:t,payload:e={}})=>{let n=r;return typeof n>"u"&&(n=T_("Job",eE),eE+=1),{id:n,action:t,payload:e}}});var Zg=Xt(df=>{"use strict";B();var yx=!1;df.logging=yx;df.setLogging=r=>{yx=r};df.log=(...r)=>yx?console.log.apply(df,r):null});var aE=Xt((rE,sE)=>{"use strict";B();var S_=gx(),{log:Qg}=Zg(),D_=Kg(),iE=0;sE.exports=()=>{let r=D_("Scheduler",iE),t={},e={},n=[];iE+=1;let i=()=>n.length,s=()=>Object.keys(t).length,a=()=>{if(n.length!==0){let d=Object.keys(t);for(let f=0;f<d.length;f+=1)if(typeof e[d[f]]>"u"){n[0](t[d[f]]);break}}},l=(d,f)=>new Promise((p,m)=>{let y=S_({action:d,payload:f});n.push(async x=>{n.shift(),e[x.id]=y;try{p(await x[d].apply(rE,[...f,y.id]))}catch(b){m(b)}finally{delete e[x.id],a()}}),Qg(`[${r}]: Add ${y.id} to JobQueue`),Qg(`[${r}]: JobQueue length=${n.length}`),a()});return{addWorker:d=>(t[d.id]=d,Qg(`[${r}]: Add ${d.id}`),Qg(`[${r}]: Number of workers=${s()}`),a(),d.id),addJob:async(d,...f)=>{if(s()===0)throw Error(`[${r}]: You need to have at least one worker before adding jobs`);return l(d,f)},terminate:async()=>{Object.keys(t).forEach(async d=>{await t[d].terminate()}),n=[]},getQueueLen:i,getNumWorkers:s}}});var lE=Xt((DR,oE)=>{"use strict";B();oE.exports=r=>{let t={};return typeof WorkerGlobalScope<"u"?t.type="webworker":typeof document=="object"?t.type="browser":typeof nt.default=="object"&&typeof iu=="function"&&(t.type="node"),typeof r>"u"?t:t[r]}});var uE=Xt((kR,cE)=>{"use strict";B();var N_=lE()("type")==="browser",I_=N_?r=>new URL(r,window.location.href).href:r=>r;cE.exports=r=>{let t={...r};return["corePath","workerPath","langPath"].forEach(e=>{r[e]&&(t[e]=I_(t[e]))}),t}});var bx=Xt((MR,hE)=>{"use strict";B();hE.exports={TESSERACT_ONLY:0,LSTM_ONLY:1,TESSERACT_LSTM_COMBINED:2,DEFAULT:3}});var dE=Xt((FR,k_)=>{k_.exports={name:"tesseract.js",version:"7.0.0",description:"Pure Javascript Multilingual OCR",main:"src/index.js",type:"commonjs",types:"src/index.d.ts",unpkg:"dist/tesseract.min.js",jsdelivr:"dist/tesseract.min.js",scripts:{start:"node scripts/server.js",build:"rimraf dist && webpack --config scripts/webpack.config.prod.js && rollup -c scripts/rollup.esm.mjs","profile:tesseract":"webpack-bundle-analyzer dist/tesseract-stats.json","profile:worker":"webpack-bundle-analyzer dist/worker-stats.json",prepublishOnly:"npm run build",wait:"rimraf dist && wait-on http://localhost:3000/dist/tesseract.min.js",test:"npm-run-all -p -r start test:all","test:all":"npm-run-all wait test:browser test:node:all","test:browser":"karma start karma.conf.js","test:node":"nyc mocha --exit --bail --require ./scripts/test-helper.mjs","test:node:all":"npm run test:node -- ./tests/*.test.mjs",lint:"eslint src","lint:fix":"eslint --fix src",postinstall:"opencollective-postinstall || true"},browser:{"./src/worker/node/index.js":"./src/worker/browser/index.js"},author:"",contributors:["jeromewu"],license:"Apache-2.0",devDependencies:{"@babel/core":"^7.21.4","@babel/eslint-parser":"^7.21.3","@babel/preset-env":"^7.21.4","@rollup/plugin-commonjs":"^24.1.0",acorn:"^8.8.2","babel-loader":"^9.1.2",buffer:"^6.0.3",cors:"^2.8.5",eslint:"^7.32.0","eslint-config-airbnb-base":"^14.2.1","eslint-plugin-import":"^2.27.5","expect.js":"^0.3.1",express:"^4.18.2",mocha:"^10.2.0","npm-run-all":"^4.1.5",karma:"^6.4.2","karma-chrome-launcher":"^3.2.0","karma-firefox-launcher":"^2.1.2","karma-mocha":"^2.0.1","karma-webpack":"^5.0.0",nyc:"^15.1.0",rimraf:"^5.0.0",rollup:"^3.20.7","wait-on":"^7.0.1",webpack:"^5.79.0","webpack-bundle-analyzer":"^4.8.0","webpack-cli":"^5.0.1","webpack-dev-middleware":"^6.0.2","rollup-plugin-sourcemaps":"^0.6.3"},dependencies:{"bmp-js":"^0.1.0","idb-keyval":"^6.2.0","is-url":"^1.2.4","node-fetch":"^2.6.9","opencollective-postinstall":"^2.0.3","regenerator-runtime":"^0.13.3","tesseract.js-core":"^7.0.0","wasm-feature-detect":"^1.8.0",zlibjs:"^0.3.1"},overrides:{"@rollup/pluginutils":"^5.0.2"},repository:{type:"git",url:"https://github.com/naptha/tesseract.js.git"},bugs:{url:"https://github.com/naptha/tesseract.js/issues"},homepage:"https://github.com/naptha/tesseract.js",collective:{type:"opencollective",url:"https://opencollective.com/tesseractjs"}}});var pE=Xt((PR,fE)=>{"use strict";B();fE.exports={workerBlobURL:!0,logger:()=>{}}});var gE=Xt((LR,mE)=>{"use strict";B();var __=dE().version,M_=pE();mE.exports={...M_,workerPath:`https://cdn.jsdelivr.net/npm/tesseract.js@v${__}/dist/worker.min.js`}});var bE=Xt((UR,yE)=>{"use strict";B();yE.exports=({workerPath:r,workerBlobURL:t})=>{let e;if(Blob&&URL&&t){let n=new Blob([`importScripts("${r}");`],{type:"application/javascript"});e=new Worker(URL.createObjectURL(n))}else e=new Worker(r);return e}});var wE=Xt((zR,xE)=>{"use strict";B();xE.exports=r=>{r.terminate()}});var vE=Xt((GR,AE)=>{"use strict";B();AE.exports=(r,t)=>{r.onmessage=({data:e})=>{t(e)}}});var EE=Xt((WR,CE)=>{"use strict";B();CE.exports=async(r,t)=>{r.postMessage(t)}});var SE=Xt((VR,TE)=>{"use strict";B();var xx=r=>new Promise((t,e)=>{let n=new FileReader;n.onload=()=>{t(n.result)},n.onerror=({target:{error:{code:i}}})=>{e(Error(`File could not be read! Code=${i}`))},n.readAsArrayBuffer(r)}),wx=async r=>{let t=r;if(typeof r>"u")return"undefined";if(typeof r=="string")/data:image\/([a-zA-Z]*);base64,([^"]*)/.test(r)?t=atob(r.split(",")[1]).split("").map(e=>e.charCodeAt(0)):t=await(await fetch(r)).arrayBuffer();else if(typeof HTMLElement<"u"&&r instanceof HTMLElement)r.tagName==="IMG"&&(t=await wx(r.src)),r.tagName==="VIDEO"&&(t=await wx(r.poster)),r.tagName==="CANVAS"&&await new Promise(e=>{r.toBlob(async n=>{t=await xx(n),e()})});else if(typeof OffscreenCanvas<"u"&&r instanceof OffscreenCanvas){let e=await r.convertToBlob();t=await xx(e)}else(r instanceof File||r instanceof Blob)&&(t=await xx(r));return new Uint8Array(t)};TE.exports=wx});var NE=Xt((YR,DE)=>{"use strict";B();var O_=gE(),F_=bE(),P_=wE(),R_=vE(),L_=EE(),B_=SE();DE.exports={defaultOptions:O_,spawnWorker:F_,terminateWorker:P_,onMessage:R_,send:L_,loadImage:B_}});var Ax=Xt((ZR,ME)=>{"use strict";B();var U_=uE(),cs=gx(),{log:IE}=Zg(),$_=Kg(),fl=bx(),{defaultOptions:z_,spawnWorker:j_,terminateWorker:G_,onMessage:H_,loadImage:kE,send:W_}=NE(),_E=0;ME.exports=async(r="eng",t=fl.LSTM_ONLY,e={},n={})=>{let i=$_("Worker",_E),{logger:s,errorHandler:a,...l}=U_({...z_,...e}),c={},u=typeof r=="string"?r.split("+"):r,h=t,d=n,f=[fl.DEFAULT,fl.LSTM_ONLY].includes(t)&&!l.legacyCore,p,m,y=new Promise((T,I)=>{m=T,p=I}),x=T=>{p(T.message)},b=j_(l);b.onerror=x,_E+=1;let w=({id:T,action:I,payload:_})=>new Promise((W,z)=>{IE(`[${i}]: Start ${T}, action=${I}`);let D=`${I}-${T}`;c[D]={resolve:W,reject:z},W_(b,{workerId:i,jobId:T,action:I,payload:_})}),C=()=>console.warn("`load` is depreciated and should be removed from code (workers now come pre-loaded)"),E=T=>w(cs({id:T,action:"load",payload:{options:{lstmOnly:f,corePath:l.corePath,logging:l.logging}}})),S=(T,I,_)=>w(cs({id:_,action:"FS",payload:{method:"writeFile",args:[T,I]}})),N=(T,I)=>w(cs({id:I,action:"FS",payload:{method:"readFile",args:[T,{encoding:"utf8"}]}})),k=(T,I)=>w(cs({id:I,action:"FS",payload:{method:"unlink",args:[T]}})),M=(T,I,_)=>w(cs({id:_,action:"FS",payload:{method:T,args:I}})),R=(T,I)=>w(cs({id:I,action:"loadLanguage",payload:{langs:T,options:{langPath:l.langPath,dataPath:l.dataPath,cachePath:l.cachePath,cacheMethod:l.cacheMethod,gzip:l.gzip,lstmOnly:[fl.DEFAULT,fl.LSTM_ONLY].includes(h)&&!l.legacyLang}}})),j=(T,I,_,W)=>w(cs({id:W,action:"initialize",payload:{langs:T,oem:I,config:_}})),$=(T="eng",I,_,W)=>{if(f&&[fl.TESSERACT_ONLY,fl.TESSERACT_LSTM_COMBINED].includes(I))throw Error("Legacy model requested but code missing.");let z=I||h;h=z;let D=_||d;d=D;let P=(typeof T=="string"?T.split("+"):T).filter(G=>!u.includes(G));return u.push(...P),P.length>0?R(P,W).then(()=>j(T,z,D,W)):j(T,z,D,W)},q=(T={},I)=>w(cs({id:I,action:"setParameters",payload:{params:T}})),Q=async(T,I={},_={text:!0},W)=>w(cs({id:W,action:"recognize",payload:{image:await kE(T),options:I,output:_}})),Z=async(T,I)=>{if(f)throw Error("`worker.detect` requires Legacy model, which was not loaded.");return w(cs({id:I,action:"detect",payload:{image:await kE(T)}}))},Y=async()=>(b!==null&&(G_(b),b=null),Promise.resolve());H_(b,({workerId:T,jobId:I,status:_,action:W,data:z})=>{let D=`${W}-${I}`;if(_==="resolve")IE(`[${T}]: Complete ${I}`),c[D].resolve({jobId:I,data:z}),delete c[D];else if(_==="reject")if(c[D].reject(z),delete c[D],W==="load"&&p(z),a)a(z);else throw Error(z);else _==="progress"&&s({...z,userJobId:I})});let X={id:i,worker:b,load:C,writeText:S,readText:N,removeFile:k,FS:M,reinitialize:$,setParameters:q,recognize:Q,detect:Z,terminate:Y};return E().then(()=>R(r)).then(()=>j(r,t,n)).then(()=>m(X)).catch(()=>{}),y}});var PE=Xt((JR,FE)=>{"use strict";B();var OE=Ax(),q_=async(r,t,e)=>{let n=await OE(t,1,e);return n.recognize(r).finally(async()=>{await n.terminate()})},V_=async(r,t)=>{let e=await OE("osd",0,t);return e.detect(r).finally(async()=>{await e.terminate()})};FE.exports={recognize:q_,detect:V_}});var LE=Xt((eL,RE)=>{"use strict";B();RE.exports={AFR:"afr",AMH:"amh",ARA:"ara",ASM:"asm",AZE:"aze",AZE_CYRL:"aze_cyrl",BEL:"bel",BEN:"ben",BOD:"bod",BOS:"bos",BUL:"bul",CAT:"cat",CEB:"ceb",CES:"ces",CHI_SIM:"chi_sim",CHI_TRA:"chi_tra",CHR:"chr",CYM:"cym",DAN:"dan",DEU:"deu",DZO:"dzo",ELL:"ell",ENG:"eng",ENM:"enm",EPO:"epo",EST:"est",EUS:"eus",FAS:"fas",FIN:"fin",FRA:"fra",FRK:"frk",FRM:"frm",GLE:"gle",GLG:"glg",GRC:"grc",GUJ:"guj",HAT:"hat",HEB:"heb",HIN:"hin",HRV:"hrv",HUN:"hun",IKU:"iku",IND:"ind",ISL:"isl",ITA:"ita",ITA_OLD:"ita_old",JAV:"jav",JPN:"jpn",KAN:"kan",KAT:"kat",KAT_OLD:"kat_old",KAZ:"kaz",KHM:"khm",KIR:"kir",KOR:"kor",KUR:"kur",LAO:"lao",LAT:"lat",LAV:"lav",LIT:"lit",MAL:"mal",MAR:"mar",MKD:"mkd",MLT:"mlt",MSA:"msa",MYA:"mya",NEP:"nep",NLD:"nld",NOR:"nor",ORI:"ori",PAN:"pan",POL:"pol",POR:"por",PUS:"pus",RON:"ron",RUS:"rus",SAN:"san",SIN:"sin",SLK:"slk",SLV:"slv",SPA:"spa",SPA_OLD:"spa_old",SQI:"sqi",SRP:"srp",SRP_LATN:"srp_latn",SWA:"swa",SWE:"swe",SYR:"syr",TAM:"tam",TEL:"tel",TGK:"tgk",TGL:"tgl",THA:"tha",TIR:"tir",TUR:"tur",UIG:"uig",UKR:"ukr",URD:"urd",UZB:"uzb",UZB_CYRL:"uzb_cyrl",VIE:"vie",YID:"yid"}});var UE=Xt((iL,BE)=>{"use strict";B();BE.exports={OSD_ONLY:"0",AUTO_OSD:"1",AUTO_ONLY:"2",AUTO:"3",SINGLE_COLUMN:"4",SINGLE_BLOCK_VERT_TEXT:"5",SINGLE_BLOCK:"6",SINGLE_LINE:"7",SINGLE_WORD:"8",CIRCLE_WORD:"9",SINGLE_CHAR:"10",SPARSE_TEXT:"11",SPARSE_TEXT_OSD:"12",RAW_LINE:"13"}});var zE=Xt((sL,$E)=>{"use strict";B();JC();var X_=aE(),Y_=Ax(),K_=PE(),Z_=LE(),Q_=bx(),J_=UE(),{setLogging:tM}=Zg();$E.exports={languages:Z_,OEM:Q_,PSM:J_,createScheduler:X_,createWorker:Y_,setLogging:tM,...K_}});function rM(){if(!(typeof globalThis.TextDecoder>"u"))return Jg??(Jg=new globalThis.TextDecoder("utf-8"))}function XE(r,t="utf-8"){switch(t.toLowerCase()){case"utf-8":case"utf8":{let e=rM();return e?e.decode(r):aM(r)}case"utf-16le":return oM(r);case"us-ascii":case"ascii":return lM(r);case"latin1":case"iso-8859-1":return cM(r);case"windows-1252":return uM(r);default:throw new RangeError(`Encoding '${t}' not supported`)}}function vx(r,t){t.length!==0&&(r.push(String.fromCharCode.apply(null,t)),t.length=0)}function on(r,t,e){t.push(e),t.length>=_u&&vx(r,t)}function sM(r,t,e){if(e<=65535){on(r,t,e);return}e-=65536,on(r,t,55296+(e>>10)),on(r,t,56320+(e&1023))}function aM(r){let t=[],e=[],n=0;for(r.length>=3&&r[0]===239&&r[1]===187&&r[2]===191&&(n=3);n<r.length;){let i=r[n];if(i<=127){on(t,e,i),n++;continue}if(i<194||i>244){on(t,e,Or),n++;continue}if(i<=223){if(n+1>=r.length){on(t,e,Or),n++;continue}let h=r[n+1];if((h&192)!==128){on(t,e,Or),n++;continue}let d=(i&31)<<6|h&63;on(t,e,d),n+=2;continue}if(i<=239){if(n+2>=r.length){on(t,e,Or),n++;continue}let h=r[n+1],d=r[n+2];if(!((h&192)===128&&(d&192)===128&&!(i===224&&h<160)&&!(i===237&&h>=160))){on(t,e,Or),n++;continue}let p=(i&15)<<12|(h&63)<<6|d&63;on(t,e,p),n+=3;continue}if(n+3>=r.length){on(t,e,Or),n++;continue}let s=r[n+1],a=r[n+2],l=r[n+3];if(!((s&192)===128&&(a&192)===128&&(l&192)===128&&!(i===240&&s<144)&&!(i===244&&s>143))){on(t,e,Or),n++;continue}let u=(i&7)<<18|(s&63)<<12|(a&63)<<6|l&63;sM(t,e,u),n+=4}return vx(t,e),t.join("")}function oM(r){let t=[],e=[],n=r.length,i=0;for(;i+1<n;){let s=r[i]|r[i+1]<<8;if(i+=2,s>=55296&&s<=56319){if(i+1<n){let a=r[i]|r[i+1]<<8;a>=56320&&a<=57343?(on(t,e,s),on(t,e,a),i+=2):on(t,e,Or)}else on(t,e,Or);continue}if(s>=56320&&s<=57343){on(t,e,Or);continue}on(t,e,s)}return i<n&&on(t,e,Or),vx(t,e),t.join("")}function lM(r){let t=[];for(let e=0;e<r.length;e+=_u){let n=Math.min(r.length,e+_u),i=new Array(n-e);for(let s=e,a=0;s<n;s++,a++)i[a]=r[s]&127;t.push(String.fromCharCode.apply(null,i))}return t.join("")}function cM(r){let t=[];for(let e=0;e<r.length;e+=_u){let n=Math.min(r.length,e+_u),i=new Array(n-e);for(let s=e,a=0;s<n;s++,a++)i[a]=r[s];t.push(String.fromCharCode.apply(null,i))}return t.join("")}function uM(r){let t=[],e="";for(let n=0;n<r.length;n++){let i=r[n],s=i>=128&&i<=159?VE[i]:void 0;e+=s??String.fromCharCode(i),e.length>=_u&&(t.push(e),e="")}return e&&t.push(e),t.join("")}var VE,iM,Jg,_u,Or,YE=ne(()=>{B();VE={128:"\u20AC",130:"\u201A",131:"\u0192",132:"\u201E",133:"\u2026",134:"\u2020",135:"\u2021",136:"\u02C6",137:"\u2030",138:"\u0160",139:"\u2039",140:"\u0152",142:"\u017D",145:"\u2018",146:"\u2019",147:"\u201C",148:"\u201D",149:"\u2022",150:"\u2013",151:"\u2014",152:"\u02DC",153:"\u2122",154:"\u0161",155:"\u203A",156:"\u0153",158:"\u017E",159:"\u0178"},iM={};for(let[r,t]of Object.entries(VE))iM[t]=Number.parseInt(r,10);_u=32*1024,Or=65533});function yi(r){return new DataView(r.buffer,r.byteOffset)}var KE,ZE,Fe,pl,Ne,Cx,QE,JE,Vn,Ys=ne(()=>{B();KE=ru(Ab(),1);YE();ZE={len:1,get(r,t){return yi(r).getUint8(t)},put(r,t,e){return yi(r).setUint8(t,e),t+1}},Fe={len:2,get(r,t){return yi(r).getUint16(t,!0)},put(r,t,e){return yi(r).setUint16(t,e,!0),t+2}},pl={len:2,get(r,t){return yi(r).getUint16(t)},put(r,t,e){return yi(r).setUint16(t,e),t+2}},Ne={len:4,get(r,t){return yi(r).getUint32(t,!0)},put(r,t,e){return yi(r).setUint32(t,e,!0),t+4}},Cx={len:4,get(r,t){return yi(r).getUint32(t)},put(r,t,e){return yi(r).setUint32(t,e),t+4}},QE={len:4,get(r,t){return yi(r).getInt32(t)},put(r,t,e){return yi(r).setInt32(t,e),t+4}},JE={len:8,get(r,t){return yi(r).getBigUint64(t,!0)},put(r,t,e){return yi(r).setBigUint64(t,e,!0),t+8}},Vn=class{constructor(t,e){this.len=t,this.encoding=e}get(t,e=0){let n=t.subarray(e,e+this.len);return XE(n,this.encoding)}}});var hM,Qt,ml,mf=ne(()=>{B();hM="End-Of-Stream",Qt=class extends Error{constructor(){super(hM),this.name="EndOfStreamError"}},ml=class extends Error{constructor(t="The operation was aborted"){super(t),this.name="AbortError"}}});var t1=ne(()=>{B()});var gl,t0=ne(()=>{B();mf();gl=class{constructor(){this.endOfStream=!1,this.interrupted=!1,this.peekQueue=[]}async peek(t,e=!1){let n=await this.read(t,e);return this.peekQueue.push(t.subarray(0,n)),n}async read(t,e=!1){if(t.length===0)return 0;let n=this.readFromPeekBuffer(t);if(this.endOfStream||(n+=await this.readRemainderFromStream(t.subarray(n),e)),n===0&&!e)throw new Qt;return n}readFromPeekBuffer(t){let e=t.length,n=0;for(;this.peekQueue.length>0&&e>0;){let i=this.peekQueue.pop();if(!i)throw new Error("peekData should be defined");let s=Math.min(i.length,e);t.set(i.subarray(0,s),n),n+=s,e-=s,s<i.length&&this.peekQueue.push(i.subarray(s))}return n}async readRemainderFromStream(t,e){let n=0;for(;n<t.length&&!this.endOfStream;){if(this.interrupted)throw new ml;let i=await this.readFromStream(t.subarray(n),e);if(i===0)break;n+=i}if(!e&&n<t.length)throw new Qt;return n}}});var e1=ne(()=>{B();mf();t1();t0()});var e0,n1=ne(()=>{B();t0();e0=class extends gl{constructor(t){super(),this.reader=t}async abort(){return this.close()}async close(){this.reader.releaseLock()}}});var gf,Ex=ne(()=>{B();n1();gf=class extends e0{async readFromStream(t,e){if(t.length===0)return 0;let n=await this.reader.read(new Uint8Array(t.length),{min:e?void 0:t.length});return n.done&&(this.endOfStream=n.done),n.value?(t.set(n.value),n.value.length):0}}});var Mu,Tx=ne(()=>{B();mf();t0();Mu=class extends gl{constructor(t){super(),this.reader=t,this.buffer=null}writeChunk(t,e){let n=Math.min(e.length,t.length);return t.set(e.subarray(0,n)),n<e.length?this.buffer=e.subarray(n):this.buffer=null,n}async readFromStream(t,e){if(t.length===0)return 0;let n=0;for(this.buffer&&(n+=this.writeChunk(t,this.buffer));n<t.length&&!this.endOfStream;){let i=await this.reader.read();if(i.done){this.endOfStream=!0;break}i.value&&(n+=this.writeChunk(t.subarray(n),i.value))}if(!e&&n===0&&this.endOfStream)throw new Qt;return n}abort(){return this.interrupted=!0,this.reader.cancel()}async close(){await this.abort(),this.reader.releaseLock()}}});function Sx(r){try{let t=r.getReader({mode:"byob"});return t instanceof ReadableStreamDefaultReader?new Mu(t):new gf(t)}catch(t){if(t instanceof TypeError)return new Mu(r.getReader());throw t}}var i1=ne(()=>{B();Ex();Tx()});var yl=ne(()=>{B();mf();e1();Ex();Tx();i1()});var Ks,yf=ne(()=>{B();yl();Ks=class{constructor(t){this.numBuffer=new Uint8Array(8),this.position=0,this.onClose=t?.onClose,t?.abortSignal&&t.abortSignal.addEventListener("abort",()=>{this.abort()})}async readToken(t,e=this.position){let n=new Uint8Array(t.len);if(await this.readBuffer(n,{position:e})<t.len)throw new Qt;return t.get(n,0)}async peekToken(t,e=this.position){let n=new Uint8Array(t.len);if(await this.peekBuffer(n,{position:e})<t.len)throw new Qt;return t.get(n,0)}async readNumber(t){if(await this.readBuffer(this.numBuffer,{length:t.len})<t.len)throw new Qt;return t.get(this.numBuffer,0)}async peekNumber(t){if(await this.peekBuffer(this.numBuffer,{length:t.len})<t.len)throw new Qt;return t.get(this.numBuffer,0)}async ignore(t){if(t<0)throw new RangeError("ignore length must be \u2265 0 bytes");if(this.fileInfo.size!==void 0){let e=this.fileInfo.size-this.position;if(t>e)return this.position+=e,e}return this.position+=t,t}async close(){await this.abort(),await this.onClose?.()}normalizeOptions(t,e){if(!this.supportsRandomAccess()&&e&&e.position!==void 0&&e.position<this.position)throw new Error("`options.position` must be equal or greater than `tokenizer.position`");return{mayBeLess:!1,offset:0,length:t.length,position:this.position,...e}}abort(){return Promise.resolve()}}});var fM,n0,r1=ne(()=>{B();yf();yl();fM=256e3,n0=class extends Ks{constructor(t,e){super(e),this.streamReader=t,this.fileInfo=e?.fileInfo??{}}async readBuffer(t,e){let n=this.normalizeOptions(t,e),i=n.position-this.position;if(i>0)return await this.ignore(i),this.readBuffer(t,e);if(i<0)throw new Error("`options.position` must be equal or greater than `tokenizer.position`");if(n.length===0)return 0;let s=await this.streamReader.read(t.subarray(0,n.length),n.mayBeLess);if(this.position+=s,(!e||!e.mayBeLess)&&s<n.length)throw new Qt;return s}async peekBuffer(t,e){let n=this.normalizeOptions(t,e),i=0;if(n.position){let s=n.position-this.position;if(s>0){let a=new Uint8Array(n.length+s);return i=await this.peekBuffer(a,{mayBeLess:n.mayBeLess}),t.set(a.subarray(s)),i-s}if(s<0)throw new Error("Cannot peek from a negative offset in a stream")}if(n.length>0){try{i=await this.streamReader.peek(t.subarray(0,n.length),n.mayBeLess)}catch(s){if(e?.mayBeLess&&s instanceof Qt)return 0;throw s}if(!n.mayBeLess&&i<n.length)throw new Qt}return i}async ignore(t){if(t<0)throw new RangeError("ignore length must be \u2265 0 bytes");let e=Math.min(fM,t),n=new Uint8Array(e),i=0;for(;i<t;){let s=t-i,a=await this.readBuffer(n,{length:Math.min(e,s)});if(a<0)return a;i+=a}return i}abort(){return this.streamReader.abort()}async close(){return this.streamReader.close()}supportsRandomAccess(){return!1}}});var i0,s1=ne(()=>{B();yl();yf();i0=class extends Ks{constructor(t,e){super(e),this.uint8Array=t,this.fileInfo={...e?.fileInfo??{},size:t.length}}async readBuffer(t,e){e?.position&&(this.position=e.position);let n=await this.peekBuffer(t,e);return this.position+=n,n}async peekBuffer(t,e){let n=this.normalizeOptions(t,e),i=Math.min(this.uint8Array.length-n.position,n.length);if(!n.mayBeLess&&i<n.length)throw new Qt;return t.set(this.uint8Array.subarray(n.position,n.position+i)),i}close(){return super.close()}supportsRandomAccess(){return!0}setPosition(t){this.position=t}}});var r0,a1=ne(()=>{B();yl();yf();r0=class extends Ks{constructor(t,e){super(e),this.blob=t,this.fileInfo={...e?.fileInfo??{},size:t.size,mimeType:t.type}}async readBuffer(t,e){e?.position&&(this.position=e.position);let n=await this.peekBuffer(t,e);return this.position+=n,n}async peekBuffer(t,e){let n=this.normalizeOptions(t,e),i=Math.min(this.blob.size-n.position,n.length);if(!n.mayBeLess&&i<n.length)throw new Qt;let s=await this.blob.slice(n.position,n.position+i).arrayBuffer();return t.set(new Uint8Array(s)),i}close(){return super.close()}supportsRandomAccess(){return!0}setPosition(t){this.position=t}}});function o1(r,t){let e=Sx(r),n=t??{},i=n.onClose;return n.onClose=async()=>{if(await e.close(),i)return i()},new n0(e,n)}function l1(r,t){return new i0(r,t)}function c1(r,t){return new r0(r,t)}var bf=ne(()=>{B();yl();r1();s1();a1();yl();yf()});var h1=Xt((HB,u1)=>{B();var Ou=1e3,Fu=Ou*60,Pu=Fu*60,bl=Pu*24,pM=bl*7,mM=bl*365.25;u1.exports=function(r,t){t=t||{};var e=typeof r;if(e==="string"&&r.length>0)return gM(r);if(e==="number"&&isFinite(r))return t.long?bM(r):yM(r);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(r))};function gM(r){if(r=String(r),!(r.length>100)){var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(r);if(t){var e=parseFloat(t[1]),n=(t[2]||"ms").toLowerCase();switch(n){case"years":case"year":case"yrs":case"yr":case"y":return e*mM;case"weeks":case"week":case"w":return e*pM;case"days":case"day":case"d":return e*bl;case"hours":case"hour":case"hrs":case"hr":case"h":return e*Pu;case"minutes":case"minute":case"mins":case"min":case"m":return e*Fu;case"seconds":case"second":case"secs":case"sec":case"s":return e*Ou;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return e;default:return}}}}function yM(r){var t=Math.abs(r);return t>=bl?Math.round(r/bl)+"d":t>=Pu?Math.round(r/Pu)+"h":t>=Fu?Math.round(r/Fu)+"m":t>=Ou?Math.round(r/Ou)+"s":r+"ms"}function bM(r){var t=Math.abs(r);return t>=bl?a0(r,t,bl,"day"):t>=Pu?a0(r,t,Pu,"hour"):t>=Fu?a0(r,t,Fu,"minute"):t>=Ou?a0(r,t,Ou,"second"):r+" ms"}function a0(r,t,e,n){var i=t>=e*1.5;return Math.round(r/e)+" "+n+(i?"s":"")}});var f1=Xt((qB,d1)=>{B();function xM(r){e.debug=e,e.default=e,e.coerce=c,e.disable=a,e.enable=i,e.enabled=l,e.humanize=h1(),e.destroy=u,Object.keys(r).forEach(h=>{e[h]=r[h]}),e.names=[],e.skips=[],e.formatters={};function t(h){let d=0;for(let f=0;f<h.length;f++)d=(d<<5)-d+h.charCodeAt(f),d|=0;return e.colors[Math.abs(d)%e.colors.length]}e.selectColor=t;function e(h){let d,f=null,p,m;function y(...x){if(!y.enabled)return;let b=y,w=Number(new Date),C=w-(d||w);b.diff=C,b.prev=d,b.curr=w,d=w,x[0]=e.coerce(x[0]),typeof x[0]!="string"&&x.unshift("%O");let E=0;x[0]=x[0].replace(/%([a-zA-Z%])/g,(N,k)=>{if(N==="%%")return"%";E++;let M=e.formatters[k];if(typeof M=="function"){let R=x[E];N=M.call(b,R),x.splice(E,1),E--}return N}),e.formatArgs.call(b,x),(b.log||e.log).apply(b,x)}return y.namespace=h,y.useColors=e.useColors(),y.color=e.selectColor(h),y.extend=n,y.destroy=e.destroy,Object.defineProperty(y,"enabled",{enumerable:!0,configurable:!1,get:()=>f!==null?f:(p!==e.namespaces&&(p=e.namespaces,m=e.enabled(h)),m),set:x=>{f=x}}),typeof e.init=="function"&&e.init(y),y}function n(h,d){let f=e(this.namespace+(typeof d>"u"?":":d)+h);return f.log=this.log,f}function i(h){e.save(h),e.namespaces=h,e.names=[],e.skips=[];let d=(typeof h=="string"?h:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(let f of d)f[0]==="-"?e.skips.push(f.slice(1)):e.names.push(f)}function s(h,d){let f=0,p=0,m=-1,y=0;for(;f<h.length;)if(p<d.length&&(d[p]===h[f]||d[p]==="*"))d[p]==="*"?(m=p,y=f,p++):(f++,p++);else if(m!==-1)p=m+1,y++,f=y;else return!1;for(;p<d.length&&d[p]==="*";)p++;return p===d.length}function a(){let h=[...e.names,...e.skips.map(d=>"-"+d)].join(",");return e.enable(""),h}function l(h){for(let d of e.skips)if(s(h,d))return!1;for(let d of e.names)if(s(h,d))return!0;return!1}function c(h){return h instanceof Error?h.stack||h.message:h}function u(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return e.enable(e.load()),e}d1.exports=xM});var p1=Xt((bi,o0)=>{B();bi.formatArgs=AM;bi.save=vM;bi.load=CM;bi.useColors=wM;bi.storage=EM();bi.destroy=(()=>{let r=!1;return()=>{r||(r=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})();bi.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function wM(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let r;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(r=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(r[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function AM(r){if(r[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+r[0]+(this.useColors?"%c ":" ")+"+"+o0.exports.humanize(this.diff),!this.useColors)return;let t="color: "+this.color;r.splice(1,0,t,"color: inherit");let e=0,n=0;r[0].replace(/%[a-zA-Z%]/g,i=>{i!=="%%"&&(e++,i==="%c"&&(n=e))}),r.splice(n,0,t)}bi.log=console.debug||console.log||(()=>{});function vM(r){try{r?bi.storage.setItem("debug",r):bi.storage.removeItem("debug")}catch{}}function CM(){let r;try{r=bi.storage.getItem("debug")||bi.storage.getItem("DEBUG")}catch{}return!r&&typeof nt.default<"u"&&"env"in nt.default&&(r=nt.default.env.DEBUG),r}function EM(){try{return localStorage}catch{}}o0.exports=f1()(bi);var{formatters:TM}=o0.exports;TM.j=function(r){try{return JSON.stringify(r)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}}});var xl,Dx,m1,g1,y1,b1=ne(()=>{B();Ys();xl={LocalFileHeader:67324752,DataDescriptor:134695760,CentralFileHeader:33639248,EndOfCentralDirectory:101010256},Dx={get(r){return{signature:Ne.get(r,0),compressedSize:Ne.get(r,8),uncompressedSize:Ne.get(r,12)}},len:16},m1={get(r){let t=Fe.get(r,6);return{signature:Ne.get(r,0),minVersion:Fe.get(r,4),dataDescriptor:!!(t&8),compressedMethod:Fe.get(r,8),compressedSize:Ne.get(r,18),uncompressedSize:Ne.get(r,22),filenameLength:Fe.get(r,26),extraFieldLength:Fe.get(r,28),filename:null}},len:30},g1={get(r){return{signature:Ne.get(r,0),nrOfThisDisk:Fe.get(r,4),nrOfThisDiskWithTheStart:Fe.get(r,6),nrOfEntriesOnThisDisk:Fe.get(r,8),nrOfEntriesOfSize:Fe.get(r,10),sizeOfCd:Ne.get(r,12),offsetOfStartOfCd:Ne.get(r,16),zipFileCommentLength:Fe.get(r,20)}},len:22},y1={get(r){let t=Fe.get(r,8);return{signature:Ne.get(r,0),minVersion:Fe.get(r,6),dataDescriptor:!!(t&8),compressedMethod:Fe.get(r,10),compressedSize:Ne.get(r,20),uncompressedSize:Ne.get(r,24),filenameLength:Fe.get(r,28),extraFieldLength:Fe.get(r,30),fileCommentLength:Fe.get(r,32),relativeOffsetOfLocalHeader:Ne.get(r,42),filename:null}},len:46}});function w1(r){let t=new Uint8Array(Ne.len);return Ne.put(t,0,r),t}function DM(r,t){let e=r.length,n=t.length;if(n>e)return-1;for(let i=0;i<=e-n;i++){let s=!0;for(let a=0;a<n;a++)if(r[i+a]!==t[a]){s=!1;break}if(s)return i}return-1}function NM(r){let t=r.reduce((i,s)=>i+s.length,0),e=new Uint8Array(t),n=0;for(let i of r)e.set(i,n),n+=i.length;return e}var x1,us,Nx,SM,l0,wl,A1=ne(()=>{B();Ys();x1=ru(p1(),1);b1();us=(0,x1.default)("tokenizer:inflate"),Nx=256*1024,SM=w1(xl.DataDescriptor),l0=w1(xl.EndOfCentralDirectory),wl=class r{constructor(t){this.tokenizer=t,this.syncBuffer=new Uint8Array(Nx)}async isZip(){return await this.peekSignature()===xl.LocalFileHeader}peekSignature(){return this.tokenizer.peekToken(Ne)}async findEndOfCentralDirectoryLocator(){let t=this.tokenizer,e=Math.min(16*1024,t.fileInfo.size),n=this.syncBuffer.subarray(0,e);await this.tokenizer.readBuffer(n,{position:t.fileInfo.size-e});for(let i=n.length-4;i>=0;i--)if(n[i]===l0[0]&&n[i+1]===l0[1]&&n[i+2]===l0[2]&&n[i+3]===l0[3])return t.fileInfo.size-e+i;return-1}async readCentralDirectory(){if(!this.tokenizer.supportsRandomAccess()){us("Cannot reading central-directory without random-read support");return}us("Reading central-directory...");let t=this.tokenizer.position,e=await this.findEndOfCentralDirectoryLocator();if(e>0){us("Central-directory 32-bit signature found");let n=await this.tokenizer.readToken(g1,e),i=[];this.tokenizer.setPosition(n.offsetOfStartOfCd);for(let s=0;s<n.nrOfEntriesOfSize;++s){let a=await this.tokenizer.readToken(y1);if(a.signature!==xl.CentralFileHeader)throw new Error("Expected Central-File-Header signature");a.filename=await this.tokenizer.readToken(new Vn(a.filenameLength,"utf-8")),await this.tokenizer.ignore(a.extraFieldLength),await this.tokenizer.ignore(a.fileCommentLength),i.push(a),us(`Add central-directory file-entry: n=${s+1}/${i.length}: filename=${i[s].filename}`)}return this.tokenizer.setPosition(t),i}this.tokenizer.setPosition(t)}async unzip(t){let e=await this.readCentralDirectory();if(e)return this.iterateOverCentralDirectory(e,t);let n=!1;do{let i=await this.readLocalFileHeader();if(!i)break;let s=t(i);n=!!s.stop;let a;if(await this.tokenizer.ignore(i.extraFieldLength),i.dataDescriptor&&i.compressedSize===0){let l=[],c=Nx;us("Compressed-file-size unknown, scanning for next data-descriptor-signature....");let u=-1;for(;u<0&&c===Nx;){c=await this.tokenizer.peekBuffer(this.syncBuffer,{mayBeLess:!0}),u=DM(this.syncBuffer.subarray(0,c),SM);let h=u>=0?u:c;if(s.handler){let d=new Uint8Array(h);await this.tokenizer.readBuffer(d),l.push(d)}else await this.tokenizer.ignore(h)}us(`Found data-descriptor-signature at pos=${this.tokenizer.position}`),s.handler&&await this.inflate(i,NM(l),s.handler)}else s.handler?(us(`Reading compressed-file-data: ${i.compressedSize} bytes`),a=new Uint8Array(i.compressedSize),await this.tokenizer.readBuffer(a),await this.inflate(i,a,s.handler)):(us(`Ignoring compressed-file-data: ${i.compressedSize} bytes`),await this.tokenizer.ignore(i.compressedSize));if(us(`Reading data-descriptor at pos=${this.tokenizer.position}`),i.dataDescriptor&&(await this.tokenizer.readToken(Dx)).signature!==134695760)throw new Error(`Expected data-descriptor-signature at position ${this.tokenizer.position-Dx.len}`)}while(!n)}async iterateOverCentralDirectory(t,e){for(let n of t){let i=e(n);if(i.handler){this.tokenizer.setPosition(n.relativeOffsetOfLocalHeader);let s=await this.readLocalFileHeader();if(s){await this.tokenizer.ignore(s.extraFieldLength);let a=new Uint8Array(n.compressedSize);await this.tokenizer.readBuffer(a),await this.inflate(s,a,i.handler)}}if(i.stop)break}}async inflate(t,e,n){if(t.compressedMethod===0)return n(e);if(t.compressedMethod!==8)throw new Error(`Unsupported ZIP compression method: ${t.compressedMethod}`);us(`Decompress filename=${t.filename}, compressed-size=${e.length}`);let i=await r.decompressDeflateRaw(e);return n(i)}static async decompressDeflateRaw(t){let e=new ReadableStream({start(s){s.enqueue(t),s.close()}}),n=new DecompressionStream("deflate-raw"),i=e.pipeThrough(n);try{let a=await new Response(i).arrayBuffer();return new Uint8Array(a)}catch(s){let a=s instanceof Error?`Failed to deflate ZIP entry: ${s.message}`:"Unknown decompression error in ZIP entry";throw new TypeError(a)}}async readLocalFileHeader(){let t=await this.tokenizer.peekToken(Ne);if(t===xl.LocalFileHeader){let e=await this.tokenizer.readToken(m1);return e.filename=await this.tokenizer.readToken(new Vn(e.filenameLength,"utf-8")),e}if(t===xl.CentralFileHeader)return!1;throw t===3759263696?new Error("Encrypted ZIP"):new Error("Unexpected signature")}}});var xf,v1=ne(()=>{B();xf=class{constructor(t){this.tokenizer=t}inflate(){let t=this.tokenizer;return new ReadableStream({async pull(e){let n=new Uint8Array(1024),i=await t.readBuffer(n,{mayBeLess:!0});if(i===0){e.close();return}e.enqueue(n.subarray(0,i))}}).pipeThrough(new DecompressionStream("gzip"))}}});var Ix=ne(()=>{B();A1();v1()});function _M(r,t,e){return r?r.constructor===t?!0:IM.call(r)===e:!1}function MM(r){return _M(r,Uint8Array,kM)}function OM(r){if(!MM(r))throw new TypeError(`Expected \`Uint8Array\`, got \`${typeof r}\``)}function C1(r,t){if(r.length===0)return new Uint8Array(0);t??(t=r.reduce((i,s)=>i+s.length,0));let e=new Uint8Array(t),n=0;for(let i of r)OM(i),e.set(i,n),n+=i.length;return e}function kx(r){let{byteLength:t}=r;if(t===6)return r.getUint16(0)*2**32+r.getUint32(2);if(t===5)return r.getUint8(0)*2**32+r.getUint32(1);if(t===4)return r.getUint32(0);if(t===3)return r.getUint8(0)*2**16+r.getUint16(1);if(t===2)return r.getUint16(0);if(t===1)return r.getUint8(0)}var IM,kM,l3,c3,u3,_x=ne(()=>{B();IM=Object.prototype.toString,kM="[object Uint8Array]";l3={utf8:new globalThis.TextDecoder("utf8")},c3=new globalThis.TextEncoder,u3=Array.from({length:256},(r,t)=>t.toString(16).padStart(2,"0"))});function E1(r,t){if(t==="utf-16le"){let e=[];for(let n=0;n<r.length;n++){let i=r.charCodeAt(n);e.push(i&255,i>>8&255)}return e}if(t==="utf-16be"){let e=[];for(let n=0;n<r.length;n++){let i=r.charCodeAt(n);e.push(i>>8&255,i&255)}return e}return[...r].map(e=>e.charCodeAt(0))}function T1(r,t=0){let e=Number.parseInt(new Vn(6).get(r,148).replace(new RegExp("\\0.*$","v"),"").trim(),8);if(Number.isNaN(e))return!1;let n=256;for(let i=t;i<t+148;i++)n+=r[i];for(let i=t+156;i<t+512;i++)n+=r[i];return e===n}var S1,D1=ne(()=>{B();Ys();S1={get:(r,t)=>r[t+3]&127|(r[t+2]&127)<<7|(r[t+1]&127)<<14|(r[t]&127)<<21,len:4}});var N1,I1,k1=ne(()=>{B();N1=["jpg","png","apng","gif","webp","flif","xcf","cr2","cr3","orf","arw","dng","nef","rw2","raf","tif","bmp","icns","jxr","psd","indd","zip","tar","rar","gz","bz2","7z","dmg","mp4","mid","mkv","webm","mov","avi","mpg","mp2","mp3","m4a","oga","ogg","ogv","opus","flac","wav","spx","amr","pdf","epub","elf","macho","exe","swf","rtf","wasm","woff","woff2","eot","ttf","otf","ttc","ico","flv","ps","xz","sqlite","nes","crx","xpi","cab","deb","ar","rpm","Z","lz","cfb","mxf","mts","blend","bpg","docx","pptx","xlsx","3gp","3g2","j2c","jp2","jpm","jpx","mj2","aif","qcp","odt","ods","odp","xml","mobi","heic","cur","ktx","ape","wv","dcm","ics","glb","pcap","dsf","lnk","alias","voc","ac3","m4v","m4p","m4b","f4v","f4p","f4b","f4a","mie","asf","ogm","ogx","mpc","arrow","shp","aac","mp1","it","s3m","xm","skp","avif","eps","lzh","pgp","asar","stl","chm","3mf","zst","jxl","vcf","jls","pst","dwg","parquet","class","arj","cpio","ace","avro","icc","fbx","vsdx","vtt","apk","drc","lz4","potx","xltx","dotx","xltm","ott","ots","otp","odg","otg","xlsm","docm","dotm","potm","pptm","jar","jmp","rm","sav","ppsm","ppsx","tar.gz","reg","dat","key","numbers","pages"],I1=["image/jpeg","image/png","image/gif","image/webp","image/flif","image/x-xcf","image/x-canon-cr2","image/x-canon-cr3","image/tiff","image/bmp","image/vnd.ms-photo","image/vnd.adobe.photoshop","application/x-indesign","application/epub+zip","application/x-xpinstall","application/vnd.ms-powerpoint.slideshow.macroenabled.12","application/vnd.oasis.opendocument.text","application/vnd.oasis.opendocument.spreadsheet","application/vnd.oasis.opendocument.presentation","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.openxmlformats-officedocument.presentationml.presentation","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/vnd.openxmlformats-officedocument.presentationml.slideshow","application/zip","application/x-tar","application/x-rar-compressed","application/gzip","application/x-bzip2","application/x-7z-compressed","application/x-apple-diskimage","application/vnd.apache.arrow.file","video/mp4","audio/midi","video/matroska","video/webm","video/quicktime","video/vnd.avi","audio/wav","audio/qcelp","audio/x-ms-asf","video/x-ms-asf","application/vnd.ms-asf","video/mpeg","video/3gpp","audio/mpeg","audio/mp4","video/ogg","audio/ogg","audio/ogg; codecs=opus","application/ogg","audio/flac","audio/ape","audio/wavpack","audio/amr","application/pdf","application/x-elf","application/x-mach-binary","application/x-msdownload","application/x-shockwave-flash","application/rtf","application/wasm","font/woff","font/woff2","application/vnd.ms-fontobject","font/ttf","font/otf","font/collection","image/x-icon","video/x-flv","application/postscript","application/eps","application/x-xz","application/x-sqlite3","application/x-nintendo-nes-rom","application/x-google-chrome-extension","application/vnd.ms-cab-compressed","application/x-deb","application/x-unix-archive","application/x-rpm","application/x-compress","application/lzip","application/x-cfb","application/x-mie","application/mxf","video/mp2t","application/x-blender","image/bpg","image/j2c","image/jp2","image/jpx","image/jpm","image/mj2","audio/aiff","application/xml","application/x-mobipocket-ebook","image/heif","image/heif-sequence","image/heic","image/heic-sequence","image/icns","image/ktx","application/dicom","audio/x-musepack","text/calendar","text/vcard","text/vtt","model/gltf-binary","application/vnd.tcpdump.pcap","audio/x-dsf","application/x-ms-shortcut","application/x-ft-apple.alias","audio/x-voc","audio/vnd.dolby.dd-raw","audio/x-m4a","image/apng","image/x-olympus-orf","image/x-sony-arw","image/x-adobe-dng","image/x-nikon-nef","image/x-panasonic-rw2","image/x-fujifilm-raf","video/x-m4v","video/3gpp2","application/x-esri-shape","audio/aac","audio/x-it","audio/x-s3m","audio/x-xm","video/MP1S","video/MP2P","application/vnd.sketchup.skp","image/avif","application/x-lzh-compressed","application/pgp-encrypted","application/x-asar","model/stl","application/vnd.ms-htmlhelp","model/3mf","image/jxl","application/zstd","image/jls","application/vnd.ms-outlook","image/vnd.dwg","application/vnd.apache.parquet","application/java-vm","application/x-arj","application/x-cpio","application/x-ace-compressed","application/avro","application/vnd.iccprofile","application/x-ft-fbx","application/vnd.visio","application/vnd.android.package-archive","application/x-ft-draco","application/x-lz4","application/vnd.openxmlformats-officedocument.presentationml.template","application/vnd.openxmlformats-officedocument.spreadsheetml.template","application/vnd.openxmlformats-officedocument.wordprocessingml.template","application/vnd.ms-excel.template.macroenabled.12","application/vnd.oasis.opendocument.text-template","application/vnd.oasis.opendocument.spreadsheet-template","application/vnd.oasis.opendocument.presentation-template","application/vnd.oasis.opendocument.graphics","application/vnd.oasis.opendocument.graphics-template","application/vnd.ms-excel.sheet.macroenabled.12","application/vnd.ms-word.document.macroenabled.12","application/vnd.ms-word.template.macroenabled.12","application/vnd.ms-powerpoint.template.macroenabled.12","application/vnd.ms-powerpoint.presentation.macroenabled.12","application/java-archive","application/vnd.rn-realmedia","application/x-spss-sav","application/x-ms-regedit","application/x-ft-windows-registry-hive","application/x-jmp-data","application/vnd.apple.keynote","application/vnd.apple.numbers","application/vnd.apple.pages"]});function c0(r,t,e){if(!Number.isFinite(r)||r<0||r>t)throw new Di(`${e} has invalid size ${r} (maximum ${t} bytes)`);return r}async function Ni(r,t,{maximumLength:e=16777216,reason:n="skip"}={}){let i=c0(t,e,n);await r.ignore(i)}async function wf(r,t,e,{maximumLength:n=t.length,reason:i="read"}={}){let s=e?.length??t.length,a=c0(s,n,i);return r.readBuffer(t,{...e,length:a})}function cr(r,t,e){e={offset:0,...e};for(let[n,i]of t.entries())if(e.mask){if(i!==(e.mask[n]&r[n+e.offset]))return!1}else if(i!==r[n+e.offset])return!1;return!0}function Je(r){let t=r.fileInfo.size;return!Number.isFinite(t)||t===Number.MAX_SAFE_INTEGER}function Zs(r,t,e){return Je(r)&&r.position-t>e}var Di,Ru=ne(()=>{B();Di=class extends Error{}});async function BM(r,{maximumLength:t=Qs}={}){let i=new ReadableStream({start(u){u.enqueue(r),u.close()}}).pipeThrough(new DecompressionStream("deflate-raw")).getReader(),s=[],a=0;try{for(;;){let{done:u,value:h}=await i.read();if(u)break;if(a+=h.length,a>t)throw await i.cancel(),new Error(`ZIP entry decompressed data exceeds ${t} bytes`);s.push(h)}}finally{i.releaseLock()}let l=new Uint8Array(a),c=0;for(let u of s)l.set(u,c),c+=u.length;return l}function UM(r,t){let e=new Uint8Array(t),n=0;for(let i of r)e.set(i,n),n+=i.length;return e}function $M(r){let t=r.fileInfo.size,e=Number.isFinite(t)?Math.max(0,t-r.position):Number.MAX_SAFE_INTEGER;return Math.min(e,FM)}function zM(r){if(r instanceof Qt||r instanceof Di)return!0;if(!(r instanceof Error))return!1;if(PM.has(r.message)||LM.has(r.code))return!0;for(let t of RM)if(r.message.startsWith(t))return!0;return!1}function O1(r,t=Qs){let e=[r.compressedSize,r.uncompressedSize];for(let n of e)if(!Number.isFinite(n)||n<0||n>t)return!1;return!0}function jM(){return{hasDocumentEntry:!1,hasMasterSlideEntry:!1,hasTablesEntry:!1,hasCalculationEngineEntry:!1}}function GM(r,t){t==="Index/Document.iwa"&&(r.hasDocumentEntry=!0),t.startsWith("Index/MasterSlide")&&(r.hasMasterSlideEntry=!0),t.startsWith("Index/Tables/")&&(r.hasTablesEntry=!0),t==="Index/CalculationEngine.iwa"&&(r.hasCalculationEngineEntry=!0)}function F1(r){if(r.hasDocumentEntry)return r.hasMasterSlideEntry?{ext:"key",mime:"application/vnd.apple.keynote"}:r.hasTablesEntry?{ext:"numbers",mime:"application/vnd.apple.numbers"}:{ext:"pages",mime:"application/vnd.apple.pages"}}function P1(r){switch(r=r.toLowerCase(),r){case"application/epub+zip":return{ext:"epub",mime:r};case"application/vnd.oasis.opendocument.text":return{ext:"odt",mime:r};case"application/vnd.oasis.opendocument.text-template":return{ext:"ott",mime:r};case"application/vnd.oasis.opendocument.spreadsheet":return{ext:"ods",mime:r};case"application/vnd.oasis.opendocument.spreadsheet-template":return{ext:"ots",mime:r};case"application/vnd.oasis.opendocument.presentation":return{ext:"odp",mime:r};case"application/vnd.oasis.opendocument.presentation-template":return{ext:"otp",mime:r};case"application/vnd.oasis.opendocument.graphics":return{ext:"odg",mime:r};case"application/vnd.oasis.opendocument.graphics-template":return{ext:"otg",mime:r};case"application/vnd.openxmlformats-officedocument.presentationml.slideshow":return{ext:"ppsx",mime:r};case"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":return{ext:"xlsx",mime:r};case"application/vnd.ms-excel.sheet.macroenabled":return{ext:"xlsm",mime:"application/vnd.ms-excel.sheet.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.spreadsheetml.template":return{ext:"xltx",mime:r};case"application/vnd.ms-excel.template.macroenabled":return{ext:"xltm",mime:"application/vnd.ms-excel.template.macroenabled.12"};case"application/vnd.ms-powerpoint.slideshow.macroenabled":return{ext:"ppsm",mime:"application/vnd.ms-powerpoint.slideshow.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.wordprocessingml.document":return{ext:"docx",mime:r};case"application/vnd.ms-word.document.macroenabled":return{ext:"docm",mime:"application/vnd.ms-word.document.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.wordprocessingml.template":return{ext:"dotx",mime:r};case"application/vnd.ms-word.template.macroenabledtemplate":return{ext:"dotm",mime:"application/vnd.ms-word.template.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.presentationml.template":return{ext:"potx",mime:r};case"application/vnd.ms-powerpoint.template.macroenabled":return{ext:"potm",mime:"application/vnd.ms-powerpoint.template.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.presentationml.presentation":return{ext:"pptx",mime:r};case"application/vnd.ms-powerpoint.presentation.macroenabled":return{ext:"pptm",mime:"application/vnd.ms-powerpoint.presentation.macroenabled.12"};case"application/vnd.ms-visio.drawing":return{ext:"vsdx",mime:"application/vnd.visio"};case"application/vnd.ms-package.3dmanufacturing-3dmodel+xml":return{ext:"3mf",mime:"model/3mf"};default:}}function HM(){return{hasContentTypesEntry:!1,hasParsedContentTypesEntry:!1,isParsingContentTypes:!1,hasUnparseableContentTypes:!1,hasWordDirectory:!1,hasPresentationDirectory:!1,hasSpreadsheetDirectory:!1,hasThreeDimensionalModelEntry:!1}}function WM(r,t){t.startsWith("word/")&&(r.hasWordDirectory=!0),t.startsWith("ppt/")&&(r.hasPresentationDirectory=!0),t.startsWith("xl/")&&(r.hasSpreadsheetDirectory=!0),t.startsWith("3D/")&&t.endsWith(".model")&&(r.hasThreeDimensionalModelEntry=!0)}function L1(r){if(r.hasWordDirectory)return{ext:"docx",mime:"application/vnd.openxmlformats-officedocument.wordprocessingml.document"};if(r.hasPresentationDirectory)return{ext:"pptx",mime:"application/vnd.openxmlformats-officedocument.presentationml.presentation"};if(r.hasSpreadsheetDirectory)return{ext:"xlsx",mime:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"};if(r.hasThreeDimensionalModelEntry)return{ext:"3mf",mime:"model/3mf"}}function R1(r){if(!(!r.hasContentTypesEntry||r.hasUnparseableContentTypes||r.isParsingContentTypes||r.hasParsedContentTypesEntry))return L1(r)}function qM(r){let t=r.indexOf('.main+xml"');if(t===-1){let i="application/vnd.ms-package.3dmanufacturing-3dmodel+xml";return r.includes(`ContentType="${i}"`)?i:void 0}let e=r.slice(0,t),n=e.lastIndexOf('"');return e.slice(n+1)}function XM(r,t){if(r.length<u0)return-1;let e=r.length-u0;for(let n=0;n<=e;n++)if(Ne.get(r,n)===B1&&Ne.get(r,n+8)===t+n)return n;return-1}async function YM(r,{shouldBuffer:t,maximumLength:e=Qs}={}){let{syncBuffer:n}=r,{length:i}=n,s=[],a=0;for(;;){let l=await r.tokenizer.peekBuffer(n,{mayBeLess:!0}),c=XM(n.subarray(0,l),a),u=c>=0?0:l===i?Math.min(VM,l-1):0,h=c>=0?c:l-u;if(h===0)break;if(a+=h,a>e)throw new Error(`ZIP entry compressed data exceeds ${e} bytes`);if(t){let d=new Uint8Array(h);await r.tokenizer.readBuffer(d),s.push(d)}else await r.tokenizer.ignore(h);if(c>=0)break}if(Je(r.tokenizer)||(r.knownSizeDescriptorScannedBytes+=a),!!t)return UM(s,a)}function KM(r,t){return Je(r.tokenizer)?Math.max(0,16777216-(r.tokenizer.position-t)):Math.max(0,Qs-r.knownSizeDescriptorScannedBytes)}async function ZM(r,t,{shouldBuffer:e,maximumDescriptorLength:n=Qs}={}){if(t.dataDescriptor&&t.compressedSize===0)return YM(r,{shouldBuffer:e,maximumLength:n});if(!e){await Ni(r.tokenizer,t.compressedSize,{maximumLength:Je(r.tokenizer)?Qs:r.tokenizer.fileInfo.size,reason:"ZIP entry compressed data"});return}let i=$M(r.tokenizer);if(!Number.isFinite(t.compressedSize)||t.compressedSize<0||t.compressedSize>i)throw new Error(`ZIP entry compressed data exceeds ${i} bytes`);let s=new Uint8Array(t.compressedSize);return await r.tokenizer.readBuffer(s),s}async function U1(r){let t,e=HM(),n=jM();try{await new wl(r).unzip(s=>{if(WM(e,s.filename),GM(n,s.filename),n.hasDocumentEntry&&(n.hasMasterSlideEntry||n.hasTablesEntry))return t=F1(n),{stop:!0};let a=s.filename==="[Content_Types].xml",l=R1(e);if(!a&&l)return t=l,{stop:!0};switch(s.filename){case"META-INF/mozilla.rsa":return t={ext:"xpi",mime:"application/x-xpinstall"},{stop:!0};case"META-INF/MANIFEST.MF":return t={ext:"jar",mime:"application/java-archive"},{stop:!0};case"mimetype":return O1(s,M1)?{async handler(c){let u=new TextDecoder("utf-8").decode(c).trim();t=P1(u)},stop:!0}:{};case"[Content_Types].xml":return e.hasContentTypesEntry=!0,O1(s,M1)?(e.isParsingContentTypes=!0,{async handler(c){let u=new TextDecoder("utf-8").decode(c),h=qM(u);h&&(t=P1(h)),e.hasParsedContentTypesEntry=!0,e.isParsingContentTypes=!1},stop:!0}):(e.hasUnparseableContentTypes=!0,{});default:return new RegExp("classes\\d*\\.dex","v").test(s.filename)?(t={ext:"apk",mime:"application/vnd.android.package-archive"},{stop:!0}):{}}})}catch(s){if(!zM(s))throw s;e.isParsingContentTypes&&(e.isParsingContentTypes=!1,e.hasUnparseableContentTypes=!0),!t&&s instanceof Qt&&!e.hasContentTypesEntry&&(t=L1(e))}let i=Je(r)&&n.hasDocumentEntry&&!n.hasMasterSlideEntry&&!n.hasTablesEntry&&!n.hasCalculationEngineEntry?void 0:F1(n);return t??R1(e)??i??{ext:"zip",mime:"application/zip"}}var Qs,_1,FM,M1,PM,RM,LM,B1,u0,VM,$1=ne(()=>{B();Ys();bf();Ix();Ru();Qs=1024*1024,_1=1024,FM=2**31-1,M1=Qs,PM=new Set(["Unexpected signature","Encrypted ZIP","Expected Central-File-Header signature"]),RM=["ZIP entry count exceeds ","Unsupported ZIP compression method:","ZIP entry compressed data exceeds ","ZIP entry decompressed data exceeds ","Expected data-descriptor-signature at position "],LM=new Set(["Z_BUF_ERROR","Z_DATA_ERROR","ERR_INVALID_STATE"]);B1=134695760,u0=16,VM=u0-1;wl.prototype.inflate=async function(r,t,e){if(r.compressedMethod===0)return e(t);if(r.compressedMethod!==8)throw new Error(`Unsupported ZIP compression method: ${r.compressedMethod}`);let n=await BM(t,{maximumLength:Qs});return e(n)};wl.prototype.unzip=async function(r){let t=!1,e=0,n=this.tokenizer.position;this.knownSizeDescriptorScannedBytes=0;do{if(Zs(this.tokenizer,n,16777216))throw new Di(`ZIP stream probing exceeds ${16777216} bytes`);let i=await this.readLocalFileHeader();if(!i)break;if(e++,e>_1)throw new Error(`ZIP entry count exceeds ${_1}`);let s=r(i);t=!!s.stop,await this.tokenizer.ignore(i.extraFieldLength);let a=await ZM(this,i,{shouldBuffer:!!s.handler,maximumDescriptorLength:Math.min(Qs,KM(this,n))});if(s.handler&&await this.inflate(i,a,s.handler),i.dataDescriptor){let l=new Uint8Array(u0);if(await this.tokenizer.readBuffer(l),Ne.get(l,0)!==B1)throw new Error(`Expected data-descriptor-signature at position ${this.tokenizer.position-l.length}`)}if(Zs(this.tokenizer,n,16777216))throw new Di(`ZIP stream probing exceeds ${16777216} bytes`)}while(!t)}});async function G1(r){async function t(){let l=await r.peekNumber(ZE),c=128,u=0;for(;(l&c)===0&&c!==0;)++u,c>>=1;let h=new Uint8Array(u+1);return await wf(r,h,void 0,{maximumLength:h.length,reason:"EBML field"}),h}async function e(){let l=await t(),c=await t();c[0]^=128>>c.length-1;let u=Math.min(6,c.length),h=new DataView(l.buffer),d=new DataView(c.buffer,c.length-u,u);return{id:kx(h),len:kx(d)}}async function n(l){let c=0;for(;l>0;){if(c++,c>QM||Zs(r,s,16777216))return;let u=r.position,h=await e();if(h.id===17026){if(h.len>z1)return;let d=c0(h.len,z1,"EBML DocType");return(await r.readToken(new Vn(d))).replaceAll(new RegExp("\\0.*$","gv"),"")}if(Je(r)&&(!Number.isFinite(h.len)||h.len<0||h.len>j1)||(await Ni(r,h.len,{maximumLength:Je(r)?j1:r.fileInfo.size,reason:"EBML payload"}),--l,r.position<=u))return}}let i=await e(),s=r.position;switch(await n(i.len)){case"webm":return{ext:"webm",mime:"video/webm"};case"matroska":return{ext:"mkv",mime:"video/matroska"};default:}}var z1,j1,QM,H1=ne(()=>{B();Ys();_x();Ru();z1=64,j1=1024*1024,QM=256});function eO(r){return(r.codePointAt(0)&32)!==0}async function q1(r){let t={ext:"png",mime:"image/png"},e={ext:"apng",mime:"image/apng"};await r.ignore(8);async function n(){return{length:await r.readToken(QE),type:await r.readToken(new Vn(4,"latin1"))}}let i=Je(r),s=r.position,a=0,l=!1;do{if(a++,a>JM||Zs(r,s,tO))break;let c=r.position,u=await n();if(u.length<0)return;if(u.type==="IHDR"){if(u.length!==13)return;l=!0}switch(u.type){case"IDAT":return t;case"acTL":return e;default:if(!l&&u.type!=="CgBI")return;if(i&&u.length>W1)return l&&eO(u.type)?t:void 0;try{await Ni(r,u.length+4,{maximumLength:i?W1+4:r.fileInfo.size,reason:"PNG chunk payload"})}catch(h){if(!i&&(h instanceof Di||h instanceof Qt))return t;throw h}}if(r.position<=c)break}while(r.position+8<r.fileInfo.size);return t}var JM,tO,W1,V1=ne(()=>{B();Ys();bf();Ru();JM=512,tO=16*1024*1024,W1=1024*1024});async function Y1(r){let t=!1;try{async function e(){let a=new Uint8Array(16);return await wf(r,a,void 0,{maximumLength:a.length,reason:"ASF header GUID"}),{id:a,size:Number(await r.readToken(JE))}}await Ni(r,30,{maximumLength:30,reason:"ASF header prelude"});let n=Je(r),i=r.position,s=0;for(;r.position+24<r.fileInfo.size&&(s++,!(s>nO||Zs(r,i,16777216)));){let a=r.position,l=await e(),c=l.size-24;if(!Number.isFinite(c)||c<0){t=!0;break}if(cr(l.id,[145,7,220,183,183,169,207,17,142,230,0,192,12,32,83,101])){let u=new Uint8Array(16);if(c-=await wf(r,u,void 0,{maximumLength:u.length,reason:"ASF stream type GUID"}),cr(u,[64,158,105,248,77,91,207,17,168,253,0,128,95,92,68,43]))return{ext:"asf",mime:"audio/x-ms-asf"};if(cr(u,[192,239,25,188,77,91,207,17,168,253,0,128,95,92,68,43]))return{ext:"asf",mime:"video/x-ms-asf"};break}if(n&&c>X1){t=!0;break}if(await Ni(r,c,{maximumLength:n?X1:r.fileInfo.size,reason:"ASF header payload"}),r.position<=a){t=!0;break}}}catch(e){if(e instanceof Qt||e instanceof Di)Je(r)&&(t=!0);else throw e}if(!t)return{ext:"asf",mime:"application/vnd.ms-asf"}}var nO,X1,K1=ne(()=>{B();Ys();bf();Ru();nO=512,X1=1024*1024});var iT={};lg(iT,{FileTypeParser:()=>Js,fileTypeFromBlob:()=>pO,fileTypeFromBuffer:()=>fO,fileTypeFromFile:()=>xO,fileTypeFromStream:()=>dO,fileTypeFromTokenizer:()=>mO,fileTypeStream:()=>gO,normalizeSampleSize:()=>nT,reasonableDetectionSizeInBytes:()=>Lu,supportedExtensions:()=>yO,supportedMimeTypes:()=>bO});function nT(r){return Number.isFinite(r)?Math.max(1,Math.trunc(r)):Lu}function lO(r){return Number.isFinite(r)?Math.max(0,Math.min(iO,Math.trunc(r))):0}function cO(r){return Number.isFinite(r)?Math.max(0,r):Number.MAX_SAFE_INTEGER}function tT(r){return import(/* @vite-ignore */ /* webpackIgnore: true */ r)}function uO(r){return r.pipeThrough(new TransformStream)}function eT(r,t){return t===void 0?r.read():(t.throwIfAborted(),Promise.race([r.read(),new Promise((e,n)=>{t.addEventListener("abort",()=>{n(t.reason),r.cancel(t.reason).catch(()=>{})},{once:!0})})]))}function hO(r,t){let e=r.getReader(),n=0,i=!1,s=!1,a=async l=>{i||s||(s=!0,await e.cancel(l))};return new ReadableStream({async pull(l){if(n>=t){l.close(),await a();return}let{done:c,value:u}=await e.read();if(c||!u){i=!0,l.close();return}let h=t-n;if(u.length>h){l.enqueue(u.subarray(0,h)),n+=h,l.close(),await a();return}l.enqueue(u),n+=u.length},async cancel(l){await a(l)}})}async function dO(r,t){return new Js(t).fromStream(r)}async function fO(r,t){return new Js(t).fromBuffer(r)}async function pO(r,t){return new Js(t).fromBlob(r)}async function mO(r,t){return new Js(t).fromTokenizer(r)}async function gO(r,t){return new Js(t).toDetectionStream(r,t)}async function xO(r,t){return new Js(t).fromFile(r)}var Lu,iO,rO,sO,Z1,Mx,aO,Q1,oO,J1,Js,yO,bO,rT=ne(()=>{B();Ys();bf();Ix();_x();D1();k1();Ru();$1();H1();V1();K1();Lu=4100,iO=Lu-2,rO=16777216,sO=1,Z1=100,Mx=16777216,aO=512,Q1=256,oO=1024*1024,J1=16777216;Js=class r{constructor(t){U(this,"detectConfident",async t=>{if(this.buffer=new Uint8Array(Lu),t.fileInfo.size===void 0&&(t.fileInfo.size=Number.MAX_SAFE_INTEGER),this.tokenizer=t,Je(t)&&(await t.peekBuffer(this.buffer,{length:3,mayBeLess:!0}),this.check([31,139,8])))return this.detectGzip(t);if(await t.peekBuffer(this.buffer,{length:32,mayBeLess:!0}),this.check([66,77]))return{ext:"bmp",mime:"image/bmp"};if(this.check([11,119]))return{ext:"ac3",mime:"audio/vnd.dolby.dd-raw"};if(this.check([120,1]))return{ext:"dmg",mime:"application/x-apple-diskimage"};if(this.check([77,90]))return{ext:"exe",mime:"application/x-msdownload"};if(this.check([37,33]))return await t.peekBuffer(this.buffer,{length:24,mayBeLess:!0}),this.checkString("PS-Adobe-",{offset:2})&&this.checkString(" EPSF-",{offset:14})?{ext:"eps",mime:"application/eps"}:{ext:"ps",mime:"application/postscript"};if(this.check([31,160])||this.check([31,157]))return{ext:"Z",mime:"application/x-compress"};if(this.check([199,113]))return{ext:"cpio",mime:"application/x-cpio"};if(this.check([96,234]))return{ext:"arj",mime:"application/x-arj"};if(this.check([239,187,191]))return this.detectionReentryCount>=Q1?void 0:(this.detectionReentryCount++,await this.tokenizer.ignore(3),this.detectConfident(t));if(this.check([71,73,70]))return{ext:"gif",mime:"image/gif"};if(this.check([73,73,188]))return{ext:"jxr",mime:"image/vnd.ms-photo"};if(this.check([31,139,8]))return this.detectGzip(t);if(this.check([66,90,104]))return{ext:"bz2",mime:"application/x-bzip2"};if(this.checkString("ID3")){await Ni(t,6,{maximumLength:6,reason:"ID3 header prefix"});let e=await t.readToken(S1),n=Je(t);if(!Number.isFinite(e)||e<0||n&&(e>Mx||t.position+e>Mx))return;if(t.position+e>t.fileInfo.size)return n?void 0:{ext:"mp3",mime:"audio/mpeg"};try{await Ni(t,e,{maximumLength:n?Mx:t.fileInfo.size,reason:"ID3 payload"})}catch(i){if(i instanceof Qt)return;throw i}return this.detectionReentryCount>=Q1?void 0:(this.detectionReentryCount++,this.parseTokenizer(t,this.detectionReentryCount))}if(this.checkString("MP+"))return{ext:"mpc",mime:"audio/x-musepack"};if((this.buffer[0]===67||this.buffer[0]===70)&&this.check([87,83],{offset:1}))return{ext:"swf",mime:"application/x-shockwave-flash"};if(this.check([255,216,255]))return this.check([247],{offset:3})?{ext:"jls",mime:"image/jls"}:{ext:"jpg",mime:"image/jpeg"};if(this.check([79,98,106,1]))return{ext:"avro",mime:"application/avro"};if(this.checkString("FLIF"))return{ext:"flif",mime:"image/flif"};if(this.checkString("8BPS"))return{ext:"psd",mime:"image/vnd.adobe.photoshop"};if(this.checkString("MPCK"))return{ext:"mpc",mime:"audio/x-musepack"};if(this.checkString("FORM"))return{ext:"aif",mime:"audio/aiff"};if(this.checkString("icns",{offset:0}))return{ext:"icns",mime:"image/icns"};if(this.check([80,75,3,4]))return U1(t);if(this.checkString("OggS")){await t.ignore(28);let e=new Uint8Array(8);return await t.readBuffer(e),cr(e,[79,112,117,115,72,101,97,100])?{ext:"opus",mime:"audio/ogg; codecs=opus"}:cr(e,[128,116,104,101,111,114,97])?{ext:"ogv",mime:"video/ogg"}:cr(e,[1,118,105,100,101,111,0])?{ext:"ogm",mime:"video/ogg"}:cr(e,[127,70,76,65,67])?{ext:"oga",mime:"audio/ogg"}:cr(e,[83,112,101,101,120,32,32])?{ext:"spx",mime:"audio/ogg"}:cr(e,[1,118,111,114,98,105,115])?{ext:"ogg",mime:"audio/ogg"}:{ext:"ogx",mime:"application/ogg"}}if(this.check([80,75])&&(this.buffer[2]===3||this.buffer[2]===5||this.buffer[2]===7)&&(this.buffer[3]===4||this.buffer[3]===6||this.buffer[3]===8))return{ext:"zip",mime:"application/zip"};if(this.checkString("MThd"))return{ext:"mid",mime:"audio/midi"};if(this.checkString("wOFF")&&(this.check([0,1,0,0],{offset:4})||this.checkString("OTTO",{offset:4})))return{ext:"woff",mime:"font/woff"};if(this.checkString("wOF2")&&(this.check([0,1,0,0],{offset:4})||this.checkString("OTTO",{offset:4})))return{ext:"woff2",mime:"font/woff2"};if(this.check([212,195,178,161])||this.check([161,178,195,212]))return{ext:"pcap",mime:"application/vnd.tcpdump.pcap"};if(this.checkString("DSD "))return{ext:"dsf",mime:"audio/x-dsf"};if(this.checkString("LZIP"))return{ext:"lz",mime:"application/lzip"};if(this.checkString("fLaC"))return{ext:"flac",mime:"audio/flac"};if(this.check([66,80,71,251]))return{ext:"bpg",mime:"image/bpg"};if(this.checkString("wvpk"))return{ext:"wv",mime:"audio/wavpack"};if(this.checkString("%PDF"))return{ext:"pdf",mime:"application/pdf"};if(this.check([0,97,115,109]))return{ext:"wasm",mime:"application/wasm"};if(this.check([73,73])){let e=await this.readTiffHeader(!1);if(e)return e}if(this.check([77,77])){let e=await this.readTiffHeader(!0);if(e)return e}if(this.checkString("MAC "))return{ext:"ape",mime:"audio/ape"};if(this.check([26,69,223,163]))return G1(t);if(this.checkString("SQLi"))return{ext:"sqlite",mime:"application/x-sqlite3"};if(this.check([78,69,83,26]))return{ext:"nes",mime:"application/x-nintendo-nes-rom"};if(this.checkString("Cr24"))return{ext:"crx",mime:"application/x-google-chrome-extension"};if(this.checkString("MSCF")||this.checkString("ISc("))return{ext:"cab",mime:"application/vnd.ms-cab-compressed"};if(this.check([237,171,238,219]))return{ext:"rpm",mime:"application/x-rpm"};if(this.check([197,208,211,198]))return{ext:"eps",mime:"application/eps"};if(this.check([40,181,47,253]))return{ext:"zst",mime:"application/zstd"};if(this.check([127,69,76,70]))return{ext:"elf",mime:"application/x-elf"};if(this.check([33,66,68,78]))return{ext:"pst",mime:"application/vnd.ms-outlook"};if(this.checkString("PAR1")||this.checkString("PARE"))return{ext:"parquet",mime:"application/vnd.apache.parquet"};if(this.checkString("ttcf"))return{ext:"ttc",mime:"font/collection"};if(this.check([254,237,250,206])||this.check([254,237,250,207])||this.check([206,250,237,254])||this.check([207,250,237,254]))return{ext:"macho",mime:"application/x-mach-binary"};if(this.check([4,34,77,24]))return{ext:"lz4",mime:"application/x-lz4"};if(this.checkString("regf"))return{ext:"dat",mime:"application/x-ft-windows-registry-hive"};if(this.checkString("$FL2")||this.checkString("$FL3"))return{ext:"sav",mime:"application/x-spss-sav"};if(this.check([79,84,84,79,0]))return{ext:"otf",mime:"font/otf"};if(this.checkString("#!AMR"))return{ext:"amr",mime:"audio/amr"};if(this.checkString(String.raw`{\rtf`))return{ext:"rtf",mime:"application/rtf"};if(this.check([70,76,86,1]))return{ext:"flv",mime:"video/x-flv"};if(this.checkString("IMPM"))return{ext:"it",mime:"audio/x-it"};if(this.checkString("-lh0-",{offset:2})||this.checkString("-lh1-",{offset:2})||this.checkString("-lh2-",{offset:2})||this.checkString("-lh3-",{offset:2})||this.checkString("-lh4-",{offset:2})||this.checkString("-lh5-",{offset:2})||this.checkString("-lh6-",{offset:2})||this.checkString("-lh7-",{offset:2})||this.checkString("-lzs-",{offset:2})||this.checkString("-lz4-",{offset:2})||this.checkString("-lz5-",{offset:2})||this.checkString("-lhd-",{offset:2}))return{ext:"lzh",mime:"application/x-lzh-compressed"};if(this.check([0,0,1,186])){if(this.check([33],{offset:4,mask:[241]}))return{ext:"mpg",mime:"video/MP1S"};if(this.check([68],{offset:4,mask:[196]}))return{ext:"mpg",mime:"video/MP2P"}}if(this.checkString("ITSF"))return{ext:"chm",mime:"application/vnd.ms-htmlhelp"};if(this.check([202,254,186,190])){let e=Cx.get(this.buffer,4),n=pl.get(this.buffer,6);if(e>0&&e<=30)return{ext:"macho",mime:"application/x-mach-binary"};if(n>30)return{ext:"class",mime:"application/java-vm"}}if(this.checkString(".RMF"))return{ext:"rm",mime:"application/vnd.rn-realmedia"};if(this.checkString("DRACO"))return{ext:"drc",mime:"application/x-ft-draco"};if(this.check([253,55,122,88,90,0]))return{ext:"xz",mime:"application/x-xz"};if(this.checkString("<?xml "))return{ext:"xml",mime:"application/xml"};if(this.check([55,122,188,175,39,28]))return{ext:"7z",mime:"application/x-7z-compressed"};if(this.check([82,97,114,33,26,7])&&(this.buffer[6]===0||this.buffer[6]===1))return{ext:"rar",mime:"application/x-rar-compressed"};if(this.checkString("solid "))return{ext:"stl",mime:"model/stl"};if(this.checkString("AC")){let e=new Vn(4,"latin1").get(this.buffer,2);if(new RegExp("^\\d+$","v").test(e)&&e>=1e3&&e<=1050)return{ext:"dwg",mime:"image/vnd.dwg"}}if(this.checkString("070707"))return{ext:"cpio",mime:"application/x-cpio"};if(this.checkString("BLENDER"))return{ext:"blend",mime:"application/x-blender"};if(this.checkString("!<arch>"))return await t.ignore(8),await t.readToken(new Vn(13,"ascii"))==="debian-binary"?{ext:"deb",mime:"application/x-deb"}:{ext:"ar",mime:"application/x-unix-archive"};if(this.checkString("WEBVTT")&&[`
|
|
12
|
+
`,"\r"," "," ","\0"].some(e=>this.checkString(e,{offset:6})))return{ext:"vtt",mime:"text/vtt"};if(this.check([137,80,78,71,13,10,26,10]))return q1(t);if(this.check([65,82,82,79,87,49,0,0]))return{ext:"arrow",mime:"application/vnd.apache.arrow.file"};if(this.check([103,108,84,70,2,0,0,0]))return{ext:"glb",mime:"model/gltf-binary"};if(this.check([102,114,101,101],{offset:4})||this.check([109,100,97,116],{offset:4})||this.check([109,111,111,118],{offset:4})||this.check([119,105,100,101],{offset:4}))return{ext:"mov",mime:"video/quicktime"};if(this.check([73,73,82,79,8,0,0,0,24]))return{ext:"orf",mime:"image/x-olympus-orf"};if(this.checkString("gimp xcf "))return{ext:"xcf",mime:"image/x-xcf"};if(this.checkString("ftyp",{offset:4})&&(this.buffer[8]&96)!==0){let e=new Vn(4,"latin1").get(this.buffer,8).replace("\0"," ").trim();switch(e){case"avif":case"avis":return{ext:"avif",mime:"image/avif"};case"mif1":return{ext:"heic",mime:"image/heif"};case"msf1":return{ext:"heic",mime:"image/heif-sequence"};case"heic":case"heix":return{ext:"heic",mime:"image/heic"};case"hevc":case"hevx":return{ext:"heic",mime:"image/heic-sequence"};case"qt":return{ext:"mov",mime:"video/quicktime"};case"M4V":case"M4VH":case"M4VP":return{ext:"m4v",mime:"video/x-m4v"};case"M4P":return{ext:"m4p",mime:"video/mp4"};case"M4B":return{ext:"m4b",mime:"audio/mp4"};case"M4A":return{ext:"m4a",mime:"audio/x-m4a"};case"F4V":return{ext:"f4v",mime:"video/mp4"};case"F4P":return{ext:"f4p",mime:"video/mp4"};case"F4A":return{ext:"f4a",mime:"audio/mp4"};case"F4B":return{ext:"f4b",mime:"audio/mp4"};case"crx":return{ext:"cr3",mime:"image/x-canon-cr3"};default:return e.startsWith("3g")?e.startsWith("3g2")?{ext:"3g2",mime:"video/3gpp2"}:{ext:"3gp",mime:"video/3gpp"}:{ext:"mp4",mime:"video/mp4"}}}if(this.checkString(`REGEDIT4\r
|
|
13
|
+
`))return{ext:"reg",mime:"application/x-ms-regedit"};if(this.check([82,73,70,70])){if(this.checkString("WEBP",{offset:8}))return{ext:"webp",mime:"image/webp"};if(this.check([65,86,73],{offset:8}))return{ext:"avi",mime:"video/vnd.avi"};if(this.check([87,65,86,69],{offset:8}))return{ext:"wav",mime:"audio/wav"};if(this.check([81,76,67,77],{offset:8}))return{ext:"qcp",mime:"audio/qcelp"}}if(this.check([73,73,85,0,24,0,0,0,136,231,116,216]))return{ext:"rw2",mime:"image/x-panasonic-rw2"};if(this.check([48,38,178,117,142,102,207,17,166,217]))return Y1(t);if(this.check([171,75,84,88,32,49,49,187,13,10,26,10]))return{ext:"ktx",mime:"image/ktx"};if((this.check([126,16,4])||this.check([126,24,4]))&&this.check([48,77,73,69],{offset:4}))return{ext:"mie",mime:"application/x-mie"};if(this.check([39,10,0,0,0,0,0,0,0,0,0,0],{offset:2}))return{ext:"shp",mime:"application/x-esri-shape"};if(this.check([255,79,255,81]))return{ext:"j2c",mime:"image/j2c"};if(this.check([0,0,0,12,106,80,32,32,13,10,135,10]))switch(await t.ignore(20),await t.readToken(new Vn(4,"ascii"))){case"jp2 ":return{ext:"jp2",mime:"image/jp2"};case"jpx ":return{ext:"jpx",mime:"image/jpx"};case"jpm ":return{ext:"jpm",mime:"image/jpm"};case"mjp2":return{ext:"mj2",mime:"image/mj2"};default:return}if(this.check([255,10])||this.check([0,0,0,12,74,88,76,32,13,10,135,10]))return{ext:"jxl",mime:"image/jxl"};if(this.check([254,255]))return this.checkString("<?xml ",{offset:2,encoding:"utf-16be"})?{ext:"xml",mime:"application/xml"}:void 0;if(this.check([208,207,17,224,161,177,26,225]))return{ext:"cfb",mime:"application/x-cfb"};if(await t.peekBuffer(this.buffer,{length:Math.min(256,t.fileInfo.size),mayBeLess:!0}),this.check([97,99,115,112],{offset:36}))return{ext:"icc",mime:"application/vnd.iccprofile"};if(this.checkString("**ACE",{offset:7})&&this.checkString("**",{offset:12}))return{ext:"ace",mime:"application/x-ace-compressed"};if(this.checkString("BEGIN:")){if(this.checkString("VCARD",{offset:6}))return{ext:"vcf",mime:"text/vcard"};if(this.checkString("VCALENDAR",{offset:6}))return{ext:"ics",mime:"text/calendar"}}if(this.checkString("FUJIFILMCCD-RAW"))return{ext:"raf",mime:"image/x-fujifilm-raf"};if(this.checkString("Extended Module:"))return{ext:"xm",mime:"audio/x-xm"};if(this.checkString("Creative Voice File"))return{ext:"voc",mime:"audio/x-voc"};if(this.check([4,0,0,0])&&this.buffer.length>=16){let e=new DataView(this.buffer.buffer).getUint32(12,!0);if(e>12&&this.buffer.length>=e+16)try{let n=new TextDecoder().decode(this.buffer.subarray(16,e+16));if(JSON.parse(n).files)return{ext:"asar",mime:"application/x-asar"}}catch{}}if(this.check([6,14,43,52,2,5,1,1,13,1,2,1,1,2]))return{ext:"mxf",mime:"application/mxf"};if(this.checkString("SCRM",{offset:44}))return{ext:"s3m",mime:"audio/x-s3m"};if(this.check([71])&&this.check([71],{offset:188}))return{ext:"mts",mime:"video/mp2t"};if(this.check([71],{offset:4})&&this.check([71],{offset:196}))return{ext:"mts",mime:"video/mp2t"};if(this.check([66,79,79,75,77,79,66,73],{offset:60}))return{ext:"mobi",mime:"application/x-mobipocket-ebook"};if(this.check([68,73,67,77],{offset:128}))return{ext:"dcm",mime:"application/dicom"};if(this.check([76,0,0,0,1,20,2,0,0,0,0,0,192,0,0,0,0,0,0,70]))return{ext:"lnk",mime:"application/x-ms-shortcut"};if(this.check([98,111,111,107,0,0,0,0,109,97,114,107,0,0,0,0]))return{ext:"alias",mime:"application/x-ft-apple.alias"};if(this.checkString("Kaydara FBX Binary \0"))return{ext:"fbx",mime:"application/x-ft-fbx"};if(this.check([76,80],{offset:34})&&(this.check([0,0,1],{offset:8})||this.check([1,0,2],{offset:8})||this.check([2,0,2],{offset:8})))return{ext:"eot",mime:"application/vnd.ms-fontobject"};if(this.check([6,6,237,245,216,29,70,229,189,49,239,231,254,116,183,29]))return{ext:"indd",mime:"application/x-indesign"};if(this.check([255,255,0,0,7,0,0,0,4,0,0,0,1,0,1,0])||this.check([0,0,255,255,0,0,0,7,0,0,0,4,0,1,0,1]))return{ext:"jmp",mime:"application/x-jmp-data"};if(await t.peekBuffer(this.buffer,{length:Math.min(512,t.fileInfo.size),mayBeLess:!0}),this.checkString("ustar",{offset:257})&&(this.checkString("\0",{offset:262})||this.checkString(" ",{offset:262}))||this.check([0,0,0,0,0,0],{offset:257})&&T1(this.buffer))return{ext:"tar",mime:"application/x-tar"};if(this.check([255,254])){let e="utf-16le";return this.checkString("<?xml ",{offset:2,encoding:e})?{ext:"xml",mime:"application/xml"}:this.check([255,14],{offset:2})&&this.checkString("SketchUp Model",{offset:4,encoding:e})?{ext:"skp",mime:"application/vnd.sketchup.skp"}:this.checkString(`Windows Registry Editor Version 5.00\r
|
|
14
|
+
`,{offset:2,encoding:e})?{ext:"reg",mime:"application/x-ms-regedit"}:void 0}if(this.checkString("-----BEGIN PGP MESSAGE-----"))return{ext:"pgp",mime:"application/pgp-encrypted"}});U(this,"detectImprecise",async t=>{this.buffer=new Uint8Array(Lu);let e=cO(t.fileInfo.size);if(await t.peekBuffer(this.buffer,{length:Math.min(8,e),mayBeLess:!0}),this.check([0,0,1,186])||this.check([0,0,1,179]))return{ext:"mpg",mime:"video/mpeg"};if(this.check([0,1,0,0,0]))return{ext:"ttf",mime:"font/ttf"};if(this.check([0,0,1,0]))return{ext:"ico",mime:"image/x-icon"};if(this.check([0,0,2,0]))return{ext:"cur",mime:"image/x-icon"};if(await t.peekBuffer(this.buffer,{length:Math.min(2+this.options.mpegOffsetTolerance,e),mayBeLess:!0}),this.buffer.length>=2+this.options.mpegOffsetTolerance)for(let n=0;n<=this.options.mpegOffsetTolerance;++n){let i=this.scanMpeg(n);if(i)return i}});let e=lO(t?.mpegOffsetTolerance);this.options={...t,mpegOffsetTolerance:e},this.detectors=[...this.options.customDetectors??[],{id:"core",detect:this.detectConfident},{id:"core.imprecise",detect:this.detectImprecise}],this.tokenizerOptions={abortSignal:this.options.signal},this.gzipProbeDepth=0}getTokenizerOptions(){return{...this.tokenizerOptions}}createTokenizerFromWebStream(t){return o1(uO(t),this.getTokenizerOptions())}async parseTokenizer(t,e=0){this.detectionReentryCount=e;let n=t.position;for(let i of this.detectors){let s;try{s=await i.detect(t)}catch(a){if(a instanceof Qt||a instanceof Di)return;throw a}if(s)return s;if(n!==t.position)return}}async fromTokenizer(t){try{return await this.parseTokenizer(t)}finally{await t.close()}}async fromBuffer(t){if(!(t instanceof Uint8Array||t instanceof ArrayBuffer))throw new TypeError(`Expected the \`input\` argument to be of type \`Uint8Array\` or \`ArrayBuffer\`, got \`${typeof t}\``);let e=t instanceof Uint8Array?t:new Uint8Array(t);if(e?.length>1)return this.fromTokenizer(l1(e,this.getTokenizerOptions()))}async fromBlob(t){this.options.signal?.throwIfAborted();let e=c1(t,this.getTokenizerOptions());return this.fromTokenizer(e)}async fromStream(t){this.options.signal?.throwIfAborted();let e=this.createTokenizerFromWebStream(t);return this.fromTokenizer(e)}async fromFile(t){this.options.signal?.throwIfAborted();let[{default:e},{FileTokenizer:n}]=await Promise.all([tT("node:fs/promises"),tT("strtok3")]),i=await e.open(t,e.constants.O_RDONLY|e.constants.O_NONBLOCK),s=await i.stat();if(!s.isFile()){await i.close();return}let a=new n(i,{...this.getTokenizerOptions(),fileInfo:{path:t,size:s.size}});return this.fromTokenizer(a)}async toDetectionStream(t,e){this.options.signal?.throwIfAborted();let n=nT(e?.sampleSize??Lu),i,s=!1,a=t.getReader(),l=[],c=0;try{for(;c<n;){let{value:d,done:f}=await eT(a,this.options.signal);if(f||!d){s=!0;break}l.push(d),c+=d.length}if(!s&&c===n){let{value:d,done:f}=await eT(a,this.options.signal);f||!d?s=!0:(l.push(d),c+=d.length)}}finally{a.releaseLock()}if(c>0){let d=l.length===1?l[0]:C1(l);try{i=await this.fromBuffer(d.subarray(0,n))}catch(f){if(!(f instanceof Qt))throw f;i=void 0}!s&&i?.ext==="pages"&&(i={ext:"zip",mime:"application/zip"})}let u=new TransformStream({start(d){for(let f of l)d.enqueue(f)},transform(d,f){f.enqueue(d)}}),h=t.pipeThrough(u);return h.fileType=i,h}async detectGzip(t){if(this.gzipProbeDepth>=sO)return{ext:"gz",mime:"application/gzip"};let e=new xf(t),n=hO(e.inflate(),rO),i=Je(t),s,a,l,c;if(i){let u=new AbortController;s=setTimeout(()=>{u.abort(new DOMException(`Operation timed out after ${Z1} ms`,"TimeoutError"))},Z1),a=this.options.signal===void 0?u.signal:AbortSignal.any([this.options.signal,u.signal]),l=new r({...this.options,signal:a}),l.gzipProbeDepth=this.gzipProbeDepth+1}else this.gzipProbeDepth++;try{c=await(l??this).fromStream(n)}catch(u){if(u?.name==="AbortError"&&a?.reason?.name!=="TimeoutError")throw u}finally{clearTimeout(s),i||this.gzipProbeDepth--}return c?.ext==="tar"?{ext:"tar.gz",mime:"application/gzip"}:{ext:"gz",mime:"application/gzip"}}check(t,e){return cr(this.buffer,t,e)}checkString(t,e){return this.check(E1(t,e?.encoding),e)}async readTiffTag(t){let e=await this.tokenizer.readToken(t?pl:Fe);switch(await this.tokenizer.ignore(10),e){case 50341:return{ext:"arw",mime:"image/x-sony-arw"};case 50706:return{ext:"dng",mime:"image/x-adobe-dng"};default:}}async readTiffIFD(t){let e=await this.tokenizer.readToken(t?pl:Fe);if(!(e>aO)&&!(Je(this.tokenizer)&&2+e*12>J1))for(let n=0;n<e;++n){let i=await this.readTiffTag(t);if(i)return i}}async readTiffHeader(t){let e={ext:"tif",mime:"image/tiff"},n=(t?pl:Fe).get(this.buffer,2),i=(t?Cx:Ne).get(this.buffer,4);if(n===42){if(i>=6){if(this.checkString("CR",{offset:8}))return{ext:"cr2",mime:"image/x-canon-cr2"};if(i>=8){let l=(t?pl:Fe).get(this.buffer,8),c=(t?pl:Fe).get(this.buffer,10);if(l===28&&c===254||l===31&&c===11)return{ext:"nef",mime:"image/x-nikon-nef"}}}if(Je(this.tokenizer)&&i>oO)return e;let s=Je(this.tokenizer)?J1:this.tokenizer.fileInfo.size;try{await Ni(this.tokenizer,i,{maximumLength:s,reason:"TIFF IFD offset"})}catch(l){if(l instanceof Qt)return;throw l}let a;try{a=await this.readTiffIFD(t)}catch(l){if(l instanceof Qt)return;throw l}return a??e}if(n===43)return e}scanMpeg(t){if(this.check([255,224],{offset:t,mask:[255,224]})){if(this.check([16],{offset:t+1,mask:[22]}))return this.check([8],{offset:t+1,mask:[8]})?{ext:"aac",mime:"audio/aac"}:{ext:"aac",mime:"audio/aac"};if(this.check([2],{offset:t+1,mask:[6]}))return{ext:"mp3",mime:"audio/mpeg"};if(this.check([4],{offset:t+1,mask:[6]}))return{ext:"mp2",mime:"audio/mpeg"};if(this.check([6],{offset:t+1,mask:[6]}))return{ext:"mp1",mime:"audio/mpeg"}}}},yO=new Set(N1),bO=new Set(I1)});var zD={};lg(zD,{AbortException:()=>Qr,AnnotationEditorLayer:()=>Fy,AnnotationEditorParamsType:()=>Zt,AnnotationEditorType:()=>Bt,AnnotationEditorUIManager:()=>nl,AnnotationLayer:()=>Dy,AnnotationMode:()=>Ba,AnnotationType:()=>tn,CSSConstants:()=>cy,ColorPicker:()=>lp,DOMSVGFactory:()=>Zc,DrawLayer:()=>Py,FeatureTest:()=>Xe,GlobalWorkerOptions:()=>Tr,ImageKind:()=>Vf,InvalidPDFException:()=>Id,MathClamp:()=>yn,OPS:()=>Nd,OutputScale:()=>Ls,PDFDataRangeTransport:()=>op,PDFDateString:()=>Xc,PDFWorker:()=>Pd,PasswordResponses:()=>kT,PermissionFlag:()=>IT,PixelsPerInch:()=>ja,RenderingCancelledException:()=>kd,ResponseException:()=>Yc,SignatureExtractor:()=>Sr,SupportedImageMimeTypes:()=>ly,TextLayer:()=>Fd,TextLayerImages:()=>Ry,TouchManager:()=>ip,Util:()=>yt,VerbosityLevel:()=>sg,XfaLayer:()=>ep,applyOpacity:()=>PT,build:()=>VS,createValidAbsoluteUrl:()=>g2,fetchData:()=>hb,findContrastColor:()=>RT,getDocument:()=>GS,getFilenameFromUrl:()=>MT,getPdfFilenameFromUrl:()=>OT,getRGB:()=>Bd,getUuid:()=>b2,getXfaPageViewport:()=>FT,isDataScheme:()=>ag,isPdfFile:()=>db,isValidExplicitDest:()=>yS,makeArr:()=>cb,makeMap:()=>ub,makeObj:()=>ay,noContextMenu:()=>tr,normalizeUnicode:()=>_T,renderRichText:()=>x2,setLayerDimensions:()=>el,shadow:()=>Ut,stopEvent:()=>Be,updateUrlHash:()=>y2,version:()=>qS});function AO(r){Number.isInteger(r)&&(ab=r)}function vO(){return ab}function ob(r){ab>=sg.INFOS&&console.info(`Info: ${r}`)}function jt(r){ab>=sg.WARNINGS&&console.warn(`Warning: ${r}`)}function ue(r){throw new Error(r)}function Ue(r,t){r||ue(t)}function CO(r){switch(r?.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":return!0;default:return!1}}function g2(r,t=null,e=null){if(!r)return null;if(e&&typeof r=="string"&&(e.addDefaultProtocol&&r.startsWith("www.")&&r.match(/\./g)?.length>=2&&(r=`http://${r}`),e.tryConvertEncoding))try{r=NO(r)}catch{}let n=t?URL.parse(r,t):URL.parse(r);return CO(n)?n:null}function y2(r,t,e=!1){let n=URL.parse(r);return n?(n.hash=t,n.href):e&&g2(r,"http://example.com")?r.split("#",1)[0]+`${t?`#${t}`:""}`:""}function Ux(r){return r.substring(r.lastIndexOf("/")+1)}function Ut(r,t,e,n=!1){return Object.defineProperty(r,t,{value:e,enumerable:!n,configurable:!0,writable:!1}),e}function EO(r){(typeof r!="object"||r?.length===void 0)&&ue("Invalid argument for bytesToString");let t=r.length,e=8192;if(t<e)return String.fromCharCode.apply(null,r);let n=[];for(let i=0;i<t;i+=e){let s=Math.min(i+e,t),a=r.subarray(i,s);n.push(String.fromCharCode.apply(null,a))}return n.join("")}function lb(r){typeof r!="string"&&ue("Invalid argument for stringToBytes");let t=r.length,e=new Uint8Array(t);for(let n=0;n<t;++n)e[n]=r.charCodeAt(n)&255;return e}function TO(r){return String.fromCharCode(r>>24&255,r>>16&255,r>>8&255,r&255)}function SO(){let r=new Uint8Array(4);return r[0]=1,new Uint32Array(r.buffer,0,1)[0]===1}function DO(){try{return new Function(""),!0}catch{return!1}}function NO(r){return decodeURIComponent(escape(r))}function _T(r){return Fx||(Fx=/([\u00a0\u00b5\u037e\u0eb3\u2000-\u200a\u202f\u2126\ufb00-\ufb04\ufb06\ufb20-\ufb36\ufb38-\ufb3c\ufb3e\ufb40-\ufb41\ufb43-\ufb44\ufb46-\ufba1\ufba4-\ufba9\ufbae-\ufbb1\ufbd3-\ufbdc\ufbde-\ufbe7\ufbea-\ufbf8\ufbfc-\ufbfd\ufc00-\ufc5d\ufc64-\ufcf1\ufcf5-\ufd3d\ufd88\ufdf4\ufdfa-\ufdfb\ufe71\ufe77\ufe79\ufe7b\ufe7d]+)|(\ufb05+)/gu,sT=new Map([["\uFB05","\u017Ft"]])),r.replaceAll(Fx,(t,e,n)=>e?e.normalize("NFKC"):sT.get(n))}function b2(){if(typeof crypto.randomUUID=="function")return crypto.randomUUID();let r=new Uint8Array(32);return crypto.getRandomValues(r),EO(r)}function IO(r,t,e){if(!Array.isArray(e)||e.length<2)return!1;let[n,i,...s]=e;if(!r(n)&&!Number.isInteger(n)||!t(i))return!1;let a=s.length,l=!0;switch(i.name){case"XYZ":if(a<2||a>3)return!1;break;case"Fit":case"FitB":return a===0;case"FitH":case"FitBH":case"FitV":case"FitBV":if(a>1)return!1;break;case"FitR":if(a!==4)return!1;l=!1;break;default:return!1}for(let c of s)if(!(typeof c=="number"||l&&c===null))return!1;return!0}function yn(r,t,e){return Math.min(Math.max(r,t),e)}async function hb(r,t="text"){if(Yf(r,document.baseURI)){let e=await fetch(r);if(!e.ok)throw new Error(e.statusText);switch(t){case"blob":return e.blob();case"bytes":return e.bytes();case"json":return e.json()}return e.text()}return new Promise((e,n)=>{let i=new XMLHttpRequest;i.open("GET",r,!0),i.responseType=t==="bytes"?"arraybuffer":t,i.onreadystatechange=()=>{if(i.readyState===XMLHttpRequest.DONE){if(i.status===200||i.status===0){switch(t){case"bytes":e(new Uint8Array(i.response));return;case"blob":case"json":e(i.response);return}e(i.responseText);return}n(new Error(i.statusText))}},i.send(null)})}function ag(r){let t=r.length,e=0;for(;e<t&&r[e].trim()==="";)e++;return r.substring(e,e+5).toLowerCase()==="data:"}function db(r){return typeof r=="string"&&/\.pdf$/i.test(r)}function MT(r){return[r]=r.split(/[#?]/,1),Ux(r)}function OT(r,t="document.pdf"){if(typeof r!="string")return t;if(ag(r))return jt('getPdfFilenameFromUrl: ignore "data:"-URL for performance reasons.'),t;let n=(l=>{try{return new URL(l)}catch{try{return new URL(decodeURIComponent(l))}catch{try{return new URL(l,"https://foo.bar")}catch{try{return new URL(decodeURIComponent(l),"https://foo.bar")}catch{return null}}}}})(r);if(!n)return t;let i=l=>{try{let c=decodeURIComponent(l);return c.includes("/")&&(c=Ux(c),/^\.pdf$/i.test(c))?l:c}catch{return l}},s=/\.pdf$/i,a=Ux(n.pathname);if(s.test(a))return i(a);if(n.searchParams.size>0){let l=u=>[...u].findLast(h=>s.test(h)),c=l(n.searchParams.values())??l(n.searchParams.keys());if(c)return i(c)}if(n.hash){let c=/[^/?#=]+\.pdf\b(?!.*\.pdf\b)/i.exec(n.hash);if(c)return i(c[0])}return t}function Yf(r,t){let e=t?URL.parse(r,t):URL.parse(r);return/https?:/.test(e?.protocol??"")}function tr(r){r.preventDefault()}function Be(r){r.preventDefault(),r.stopPropagation()}function kO(r){console.log("Deprecated API usage: "+r)}function FT(r,{scale:t=1,rotation:e=0}){let{width:n,height:i}=r.attributes.style,s=[0,0,parseInt(n),parseInt(i)];return new np({viewBox:s,userUnit:1,scale:t,rotation:e})}function Bd(r){if(r.startsWith("#")){let t=parseInt(r.slice(1),16);return[(t&16711680)>>16,(t&65280)>>8,t&255]}return r.startsWith("rgb(")?r.slice(4,-1).split(",").map(t=>parseInt(t)):r.startsWith("rgba(")?r.slice(5,-1).split(",",3).map(t=>parseInt(t)):(jt(`Not a valid color format: "${r}"`),[0,0,0])}function _O(r){let t=document.createElement("span");t.style.visibility="hidden",t.style.colorScheme="only light",document.body.append(t);for(let e of r.keys()){t.style.color=e;let n=window.getComputedStyle(t).color;r.set(e,Bd(n))}t.remove()}function Le(r){let{a:t,b:e,c:n,d:i,e:s,f:a}=r.getTransform();return[t,e,n,i,s,a]}function hs(r){let{a:t,b:e,c:n,d:i,e:s,f:a}=r.getTransform().invertSelf();return[t,e,n,i,s,a]}function el(r,t,e=!1,n=!0){if(t instanceof np){let{pageWidth:i,pageHeight:s}=t.rawDims,{style:a}=r,l=Xe.isCSSRoundSupported,c=`var(--total-scale-factor) * ${i}px`,u=`var(--total-scale-factor) * ${s}px`,h=l?`round(down, ${c}, var(--scale-round-x))`:`calc(${c})`,d=l?`round(down, ${u}, var(--scale-round-y))`:`calc(${u})`;!e||t.rotation%180===0?(a.width=h,a.height=d):(a.width=d,a.height=h)}n&&r.setAttribute("data-main-rotation",t.rotation)}function PT(r,t){t=yn(t??1,0,1);let e=255*(1-t);return r.map(n=>Math.round(n*t+e))}function aT(r,t){let e=r[0]/255,n=r[1]/255,i=r[2]/255,s=Math.max(e,n,i),a=Math.min(e,n,i),l=(s+a)/2;if(s===a)t[0]=t[1]=0;else{let c=s-a;switch(t[1]=l<.5?c/(s+a):c/(2-s-a),s){case e:t[0]=((n-i)/c+(n<i?6:0))*60;break;case n:t[0]=((i-e)/c+2)*60;break;case i:t[0]=((e-n)/c+4)*60;break}}t[2]=l}function Gx(r,t){let e=r[0],n=r[1],i=r[2],s=(1-Math.abs(2*i-1))*n,a=s*(1-Math.abs(e/60%2-1)),l=i-s/2;switch(Math.floor(e/60)){case 0:t[0]=s+l,t[1]=a+l,t[2]=l;break;case 1:t[0]=a+l,t[1]=s+l,t[2]=l;break;case 2:t[0]=l,t[1]=s+l,t[2]=a+l;break;case 3:t[0]=l,t[1]=a+l,t[2]=s+l;break;case 4:t[0]=a+l,t[1]=l,t[2]=s+l;break;case 5:case 6:t[0]=s+l,t[1]=l,t[2]=a+l;break}}function oT(r){return r<=.03928?r/12.92:((r+.055)/1.055)**2.4}function lT(r,t,e){Gx(r,e),e.map(oT);let n=.2126*e[0]+.7152*e[1]+.0722*e[2];Gx(t,e),e.map(oT);let i=.2126*e[0]+.7152*e[1]+.0722*e[2];return n>i?(n+.05)/(i+.05):(i+.05)/(n+.05)}function RT(r,t){let e=r[0]+r[1]*256+r[2]*65536+t[0]*16777216+t[1]*4294967296+t[2]*1099511627776,n=cT.get(e);if(n)return n;let i=new Float32Array(9),s=i.subarray(0,3),a=i.subarray(3,6);aT(r,a);let l=i.subarray(6,9);aT(t,l);let c=l[2]<.5,u=c?12:4.5;if(a[2]=c?Math.sqrt(a[2]):1-Math.sqrt(1-a[2]),lT(a,l,s)<u){let h,d;c?(h=a[2],d=1):(h=0,d=a[2]);let f=.005;for(;d-h>f;){let p=a[2]=(h+d)/2;c===lT(a,l,s)<u?h=p:d=p}a[2]=c?d:h}return Gx(a,s),n=yt.makeHexColor(Math.round(s[0]*255),Math.round(s[1]*255),Math.round(s[2]*255)),cT.set(e,n),n}function x2({html:r,dir:t,className:e},n){let i=document.createDocumentFragment();if(typeof r=="string"){let s=document.createElement("p");s.dir=t||"auto";let a=r.split(/(?:\r\n?|\n)/);for(let l=0,c=a.length;l<c;++l){let u=a[l];s.append(document.createTextNode(u)),l<c-1&&s.append(document.createElement("br"))}i.append(s)}else ep.render({xfaHtml:r,div:i,intent:"richText"});i.firstElementChild.classList.add("richText",e),n.append(i)}function LT(r){let t=new Path2D;if(!r)return t;for(let e=0,n=r.length;e<n;)switch(r[e++]){case Af.moveTo:t.moveTo(r[e++],r[e++]);break;case Af.lineTo:t.lineTo(r[e++],r[e++]);break;case Af.curveTo:t.bezierCurveTo(r[e++],r[e++],r[e++],r[e++],r[e++],r[e++]);break;case Af.quadraticCurveTo:t.quadraticCurveTo(r[e++],r[e++],r[e++],r[e++]);break;case Af.closePath:t.closePath();break;default:jt(`Unrecognized drawing path operator: ${r[e-1]}`);break}return t}function GT(r,t,e){for(let n of e)t.addEventListener(n,r[n].bind(r))}function fT(r,t,e,n,i,s){r[t*4+0]=Math.min(r[t*4+0],e),r[t*4+1]=Math.min(r[t*4+1],n),r[t*4+2]=Math.max(r[t*4+2],i),r[t*4+3]=Math.max(r[t*4+3],s)}function MO(r){if(r instanceof URL)return r;if(typeof r=="string"){if(Ki){if(/^[a-z][a-z0-9\-+.]+:/i.test(r))return new URL(r);let e=nt.default.getBuiltinModule("url");return new URL(e.pathToFileURL(r))}let t=URL.parse(r,window.location);if(t)return t}throw new Error("Invalid PDF url data: either string or URL-object is expected in the url property.")}function OO(r){if(Ki&&typeof ct.Buffer<"u"&&r instanceof ct.Buffer)throw new Error("Please provide binary data as `Uint8Array`, rather than `Buffer`.");if(r instanceof Uint8Array&&r.byteLength===r.buffer.byteLength)return r;if(typeof r=="string")return lb(r);if(r instanceof ArrayBuffer||ArrayBuffer.isView(r)||typeof r=="object"&&!isNaN(r?.length))return new Uint8Array(r);throw new Error("Invalid PDF binary data: either TypedArray, string, or array-like object is expected in the data property.")}function h0(r){if(typeof r!="string")return null;if(r.endsWith("/"))return r;throw new Error(`Invalid factory url: "${r}" must include trailing slash.`)}function mT(){}function xi(r){if(r instanceof Qr||r instanceof Id||r instanceof sy||r instanceof Yc||r instanceof Xf)return r;switch(r instanceof Error||typeof r=="object"&&r!==null||ue('wrapReason: Expected "reason" to be a (possibly cloned) Error.'),r.name){case"AbortException":return new Qr(r.message);case"InvalidPDFException":return new Id(r.message);case"PasswordException":return new sy(r.message,r.code);case"ResponseException":return new Yc(r.message,r.status,r.missing);case"UnknownErrorException":return new Xf(r.message,r.details)}return new Xf(r.message,r.toString())}async function PO(r){let e=await nt.default.getBuiltinModule("fs").promises.readFile(r);return new Uint8Array(e)}function LO(){w2.init()}function BO(){return w2.isReady}function UO(r,t,e,n,i,s){return w2.draw(r,t,e,n,i,s)}function O0(r,t){if(!t)return;let e=t[2]-t[0],n=t[3]-t[1],i=new Path2D;i.rect(t[0],t[1],e,n),r.clip(i)}function Px(r,t,e,n,i,s,a,l){let c=t.coords,u=t.colors,h=r.data,d=r.width*4,f;c[e*2+1]>c[n*2+1]&&(f=e,e=n,n=f,f=s,s=a,a=f),c[n*2+1]>c[i*2+1]&&(f=n,n=i,i=f,f=a,a=l,l=f),c[e*2+1]>c[n*2+1]&&(f=e,e=n,n=f,f=s,s=a,a=f);let p=(c[e*2]+t.offsetX)*t.scaleX,m=(c[e*2+1]+t.offsetY)*t.scaleY,y=(c[n*2]+t.offsetX)*t.scaleX,x=(c[n*2+1]+t.offsetY)*t.scaleY,b=(c[i*2]+t.offsetX)*t.scaleX,w=(c[i*2+1]+t.offsetY)*t.scaleY;if(m>=w)return;let C=u[s*4],E=u[s*4+1],S=u[s*4+2],N=u[a*4],k=u[a*4+1],M=u[a*4+2],R=u[l*4],j=u[l*4+1],$=u[l*4+2],q=Math.round(m),Q=Math.round(w),Z,Y,X,T,I,_,W,z;for(let D=q;D<=Q;D++){if(D<x){let V=D<m?0:(m-D)/(m-x);Z=p-(p-y)*V,Y=C-(C-N)*V,X=E-(E-k)*V,T=S-(S-M)*V}else{let V;D>w?V=1:x===w?V=0:V=(x-D)/(x-w),Z=y-(y-b)*V,Y=N-(N-R)*V,X=k-(k-j)*V,T=M-(M-$)*V}let F;D<m?F=0:D>w?F=1:F=(m-D)/(m-w),I=p-(p-b)*F,_=C-(C-R)*F,W=E-(E-j)*F,z=S-(S-$)*F;let P=Math.round(Math.min(Z,I)),G=Math.round(Math.max(Z,I)),H=d*D+P*4;for(let V=P;V<=G;V++)F=(Z-V)/(Z-I),F<0?F=0:F>1&&(F=1),h[H++]=Y-(Y-_)*F|0,h[H++]=X-(X-W)*F|0,h[H++]=T-(T-z)*F|0,h[H++]=255}}function $O(r,t,e){let n=t.coords,i=t.colors,s,a;switch(t.type){case Dl.LATTICE:let l=t.verticesPerRow,c=Math.floor(n.length/l)-1,u=l-1;for(s=0;s<c;s++){let h=s*l;for(let d=0;d<u;d++,h++)Px(r,e,n[h],n[h+1],n[h+l],i[h],i[h+1],i[h+l]),Px(r,e,n[h+l+1],n[h+1],n[h+l],i[h+l+1],i[h+1],i[h+l])}break;case Dl.TRIANGLES:for(s=0,a=n.length;s<a;s+=3)Px(r,e,n[s],n[s+1],n[s+2],i[s],i[s+1],i[s+2]);break;default:throw new Error("illegal figure")}}function zO(r){switch(r[0]){case"RadialAxial":return new Fw(r);case"Mesh":return new Pw(r);case"Dummy":return new Rw}throw new Error(`Unknown IR type: ${r[0]}`)}function jO({src:r,srcPos:t=0,dest:e,width:n,height:i,nonBlackColor:s=4294967295,inverseDecode:a=!1}){let l=Xe.isLittleEndian?4278190080:255,[c,u]=a?[s,l]:[l,s],h=n>>3,d=n&7,f=c^u,p=r.length;e=new Uint32Array(e.buffer);let m=0;for(let y=0;y<i;++y){for(let b=t+h;t<b;++t,m+=8){let w=r[t];e[m]=c^-(w>>7&1)&f,e[m+1]=c^-(w>>6&1)&f,e[m+2]=c^-(w>>5&1)&f,e[m+3]=c^-(w>>4&1)&f,e[m+4]=c^-(w>>3&1)&f,e[m+5]=c^-(w>>2&1)&f,e[m+6]=c^-(w>>1&1)&f,e[m+7]=c^-(w&1)&f}if(d===0)continue;let x=t<p?r[t++]:255;for(let b=0;b<d;++b,++m)e[m]=c^-(x>>7-b&1)&f}return{srcPos:t,destPos:m}}function HO(r,t){if(r._removeMirroring)throw new Error("Context is already forwarding operations.");r.__originalSave=r.save,r.__originalRestore=r.restore,r.__originalRotate=r.rotate,r.__originalScale=r.scale,r.__originalTranslate=r.translate,r.__originalTransform=r.transform,r.__originalSetTransform=r.setTransform,r.__originalResetTransform=r.resetTransform,r.__originalClip=r.clip,r.__originalMoveTo=r.moveTo,r.__originalLineTo=r.lineTo,r.__originalBezierCurveTo=r.bezierCurveTo,r.__originalRect=r.rect,r.__originalClosePath=r.closePath,r.__originalBeginPath=r.beginPath,r._removeMirroring=()=>{r.save=r.__originalSave,r.restore=r.__originalRestore,r.rotate=r.__originalRotate,r.scale=r.__originalScale,r.translate=r.__originalTranslate,r.transform=r.__originalTransform,r.setTransform=r.__originalSetTransform,r.resetTransform=r.__originalResetTransform,r.clip=r.__originalClip,r.moveTo=r.__originalMoveTo,r.lineTo=r.__originalLineTo,r.bezierCurveTo=r.__originalBezierCurveTo,r.rect=r.__originalRect,r.closePath=r.__originalClosePath,r.beginPath=r.__originalBeginPath,delete r._removeMirroring},r.save=function(){t.save(),this.__originalSave()},r.restore=function(){t.restore(),this.__originalRestore()},r.translate=function(e,n){t.translate(e,n),this.__originalTranslate(e,n)},r.scale=function(e,n){t.scale(e,n),this.__originalScale(e,n)},r.transform=function(e,n,i,s,a,l){t.transform(e,n,i,s,a,l),this.__originalTransform(e,n,i,s,a,l)},r.setTransform=function(e,n,i,s,a,l){t.setTransform(e,n,i,s,a,l),this.__originalSetTransform(e,n,i,s,a,l)},r.resetTransform=function(){t.resetTransform(),this.__originalResetTransform()},r.rotate=function(e){t.rotate(e),this.__originalRotate(e)},r.clip=function(e){t.clip(e),this.__originalClip(e)},r.moveTo=function(e,n){t.moveTo(e,n),this.__originalMoveTo(e,n)},r.lineTo=function(e,n){t.lineTo(e,n),this.__originalLineTo(e,n)},r.bezierCurveTo=function(e,n,i,s,a,l){t.bezierCurveTo(e,n,i,s,a,l),this.__originalBezierCurveTo(e,n,i,s,a,l)},r.rect=function(e,n,i,s){t.rect(e,n,i,s),this.__originalRect(e,n,i,s)},r.closePath=function(){t.closePath(),this.__originalClosePath()},r.beginPath=function(){t.beginPath(),this.__originalBeginPath()}}function f0(r,t,e,n,i,s,a,l,c,u){let[h,d,f,p,m,y]=Le(r);if(d===0&&f===0){let w=a*h+m,C=Math.round(w),E=l*p+y,S=Math.round(E),N=(a+c)*h+m,k=Math.abs(Math.round(N)-C)||1,M=(l+u)*p+y,R=Math.abs(Math.round(M)-S)||1;return r.setTransform(Math.sign(h),0,0,Math.sign(p),C,S),r.drawImage(t,e,n,i,s,0,0,k,R),r.setTransform(h,d,f,p,m,y),[k,R]}if(h===0&&p===0){let w=l*f+m,C=Math.round(w),E=a*d+y,S=Math.round(E),N=(l+u)*f+m,k=Math.abs(Math.round(N)-C)||1,M=(a+c)*d+y,R=Math.abs(Math.round(M)-S)||1;return r.setTransform(0,Math.sign(d),Math.sign(f),0,C,S),r.drawImage(t,e,n,i,s,0,0,R,k),r.setTransform(h,d,f,p,m,y),[R,k]}r.drawImage(t,e,n,i,s,a,l,c,u);let x=Math.hypot(h,d),b=Math.hypot(f,p);return[x*c,b*u]}function wT(r,t){if(t instanceof ImageData){r.putImageData(t,0,0);return}let e=t.height,n=t.width,i=e%Si,s=(e-i)/Si,a=i===0?s:s+1,l=r.createImageData(n,Si),c=0,u,h=t.data,d=l.data,f,p,m,y;if(t.kind===Vf.GRAYSCALE_1BPP){let x=h.byteLength,b=new Uint32Array(d.buffer,0,d.byteLength>>2),w=b.length,C=n+7>>3,E=4294967295,S=Xe.isLittleEndian?4278190080:255;for(f=0;f<a;f++){for(m=f<s?Si:i,u=0,p=0;p<m;p++){let N=x-c,k=0,M=N>C?n:N*8-7,R=M&-8,j=0,$=0;for(;k<R;k+=8)$=h[c++],b[u++]=$&128?E:S,b[u++]=$&64?E:S,b[u++]=$&32?E:S,b[u++]=$&16?E:S,b[u++]=$&8?E:S,b[u++]=$&4?E:S,b[u++]=$&2?E:S,b[u++]=$&1?E:S;for(;k<M;k++)j===0&&($=h[c++],j=128),b[u++]=$&j?E:S,j>>=1}for(;u<w;)b[u++]=0;r.putImageData(l,0,f*Si)}}else if(t.kind===Vf.RGBA_32BPP){for(p=0,y=n*Si*4,f=0;f<s;f++)d.set(h.subarray(c,c+y)),c+=y,r.putImageData(l,0,p),p+=Si;f<a&&(y=n*i*4,d.set(h.subarray(c,c+y)),r.putImageData(l,0,p))}else if(t.kind===Vf.RGB_24BPP)for(m=Si,y=n*m,f=0;f<a;f++){for(f>=s&&(m=i,y=n*m),u=0,p=y;p--;)d[u++]=h[c++],d[u++]=h[c++],d[u++]=h[c++],d[u++]=255;r.putImageData(l,0,f*Si)}else throw new Error(`bad image kind: ${t.kind}`)}function AT(r,t){if(t.bitmap){r.drawImage(t.bitmap,0,0);return}let e=t.height,n=t.width,i=e%Si,s=(e-i)/Si,a=i===0?s:s+1,l=r.createImageData(n,Si),c=0,u=t.data,h=l.data;for(let d=0;d<a;d++){let f=d<s?Si:i;({srcPos:c}=jO({src:u,srcPos:c,dest:h,width:n,height:f,nonBlackColor:0})),r.putImageData(l,0,d*Si)}}function vf(r,t){let e=["strokeStyle","fillStyle","fillRule","globalAlpha","lineWidth","lineCap","lineJoin","miterLimit","globalCompositeOperation","font","filter"];for(let n of e)r[n]!==void 0&&(t[n]=r[n]);r.setLineDash!==void 0&&(t.setLineDash(r.getLineDash()),t.lineDashOffset=r.lineDashOffset)}function p0(r){r.strokeStyle=r.fillStyle="#000000",r.fillRule="nonzero",r.globalAlpha=1,r.lineWidth=1,r.lineCap="butt",r.lineJoin="miter",r.miterLimit=10,r.globalCompositeOperation="source-over",r.font="10px sans-serif",r.setLineDash!==void 0&&(r.setLineDash([]),r.lineDashOffset=0);let{filter:t}=r;t!=="none"&&t!==""&&(r.filter="none")}function vT(r,t){if(t)return!0;yt.singularValueDecompose2dScale(r,Zi);let e=Math.fround(Ls.pixelRatio*ja.PDF_TO_CSS_UNITS);return Zi[0]<=e&&Zi[1]<=e}function XO(r){let t=!0,e=n("filename\\*","i").exec(r);if(e){e=e[1];let h=l(e);return h=unescape(h),h=c(h),h=u(h),s(h)}if(e=a(r),e){let h=u(e);return s(h)}if(e=n("filename","i").exec(r),e){e=e[1];let h=l(e);return h=u(h),s(h)}function n(h,d){return new RegExp("(?:^|;)\\s*"+h+'\\s*=\\s*([^";\\s][^;\\s]*|"(?:[^"\\\\]|\\\\"?)+"?)',d)}function i(h,d){if(h){if(!/^[\x00-\xFF]+$/.test(d))return d;try{let f=new TextDecoder(h,{fatal:!0}),p=lb(d);d=f.decode(p),t=!1}catch{}}return d}function s(h){return t&&/[\x80-\xff]/.test(h)&&(h=i("utf-8",h),t&&(h=i("iso-8859-1",h))),h}function a(h){let d=[],f,p=n("filename\\*((?!0\\d)\\d+)(\\*?)","ig");for(;(f=p.exec(h))!==null;){let[,y,x,b]=f;if(y=parseInt(y,10),y in d){if(y===0)break;continue}d[y]=[x,b]}let m=[];for(let y=0;y<d.length&&y in d;++y){let[x,b]=d[y];b=l(b),x&&(b=unescape(b),y===0&&(b=c(b))),m.push(b)}return m.join("")}function l(h){if(h.startsWith('"')){let d=h.slice(1).split('\\"');for(let f=0;f<d.length;++f){let p=d[f].indexOf('"');p!==-1&&(d[f]=d[f].slice(0,p),d.length=f+1),d[f]=d[f].replaceAll(/\\(.)/g,"$1")}h=d.join('"')}return h}function c(h){let d=h.indexOf("'");if(d===-1)return h;let f=h.slice(0,d),m=h.slice(d+1).replace(/^[^']*'/,"");return i(f,m)}function u(h){return!h.startsWith("=?")||/[\x00-\x19\x80-\xff]/.test(h)?h:h.replaceAll(/=\?([\w-]*)\?([QqBb])\?((?:[^?]|\?(?!=))*)\?=/g,function(d,f,p,m){if(p==="q"||p==="Q")return m=m.replaceAll("_"," "),m=m.replaceAll(/=([0-9a-fA-F]{2})/g,function(y,x){return String.fromCharCode(parseInt(x,16))}),i(f,m);try{m=atob(m)}catch{}return i(f,m)})}return""}function ES(r,t){let e=new Headers;if(!r||!t||typeof t!="object")return e;for(let n in t){let i=t[n];i!==void 0&&e.append(n,i)}return e}function fb(r){return URL.parse(r)?.origin??null}function TS({responseHeaders:r,isHttp:t,rangeChunkSize:e,disableRange:n}){let i={contentLength:0,isRangeSupported:!1},s=parseInt(r.get("Content-Length"),10);return!Number.isInteger(s)||(i.contentLength=s,s<=2*e)||n||!t||r.get("Accept-Ranges")!=="bytes"||(r.get("Content-Encoding")||"identity")==="identity"&&(i.isRangeSupported=!0),i}function SS(r){let t=r.get("Content-Disposition");if(t){let e=XO(t);if(e.includes("%"))try{e=decodeURIComponent(e)}catch{}if(db(e))return e}return null}function pb(r,t){return new Yc(`Unexpected server response (${r}) while retrieving PDF "${t.href}".`,r,r===404||r===0&&t.protocol==="file:")}function DS(r,t){if(r!==t)throw new Error(`Expected range response-origin "${r}" to match "${t}".`)}function NS(r,t,e,n){return fetch(r,{method:"GET",headers:t,signal:n.signal,mode:"cors",credentials:e?"include":"same-origin",redirect:"follow"})}function IS(r,t){if(r!==200&&r!==206)throw pb(r,t)}function mb(r){if(r instanceof Uint8Array)return r.buffer;if(r instanceof ArrayBuffer)return r;throw new Error(`getArrayBuffer - unexpected data: ${r}`)}function ET(r){return r instanceof Uint8Array&&r.byteLength===r.buffer.byteLength?r.buffer:new Uint8Array(r).buffer}function gb(){for(let r of this._requests)r.resolve({value:void 0,done:!0});this._requests.length=0}function YO(r){return typeof r!="string"?r:lb(r).buffer}function BS(r){let{Readable:t}=nt.default.getBuiltinModule("stream");return typeof t.toWeb=="function"?t.toWeb(r):nt.default.getBuiltinModule("module").createRequire("")("node-readable-to-web-readable-stream").makeDefaultReadableStreamFromNodeReadable(r)}function KO(r){return Yf(r)?zw:Ki?Qw:Xw}function GS(r={}){typeof r=="string"||r instanceof URL?r={url:r}:(r instanceof ArrayBuffer||ArrayBuffer.isView(r))&&(r={data:r});let t=new lA,{docId:e}=t,n=r.url?MO(r.url):null,i=r.data?OO(r.data):null,s=r.httpHeaders||null,a=r.withCredentials===!0,l=r.password??null,c=r.range instanceof op?r.range:null,u=Number.isInteger(r.rangeChunkSize)&&r.rangeChunkSize>0?r.rangeChunkSize:2**16,h=r.worker instanceof Pd?r.worker:null,d=r.verbosity,f=typeof r.docBaseUrl=="string"&&!ag(r.docBaseUrl)?r.docBaseUrl:null,p=h0(r.cMapUrl),m=r.cMapPacked!==!1,y=h0(r.iccUrl),x=h0(r.standardFontDataUrl),b=h0(r.wasmUrl),w=r.stopAtErrors!==!0,C=Number.isInteger(r.maxImageSize)&&r.maxImageSize>-1?r.maxImageSize:-1,E=r.isEvalSupported!==!1,S=typeof r.isOffscreenCanvasSupported=="boolean"?r.isOffscreenCanvasSupported:!Ki,N=typeof r.isImageDecoderSupported=="boolean"?r.isImageDecoderSupported:!Ki&&(Xe.platform.isFirefox||!globalThis.chrome),k=Number.isInteger(r.canvasMaxAreaInBytes)?r.canvasMaxAreaInBytes:-1,M=typeof r.disableFontFace=="boolean"?r.disableFontFace:Ki,R=r.fontExtraProperties===!0,j=r.enableXfa===!0,$=r.ownerDocument||globalThis.document,q=r.disableRange===!0,Q=r.disableStream===!0,Z=r.disableAutoFetch===!0,Y=r.pdfBug===!0,X=r.CanvasFactory||(Ki?_w:Sw),T=r.FilterFactory||(Ki?kw:Dw),I=r.BinaryDataFactory||(Ki?Mw:my),_=r.enableHWA===!0,W=r.enableWebGPU===!0,z=r.useWasm!==!1,D=r.pagesMapper||new sA,F=typeof r.useSystemFonts=="boolean"?r.useSystemFonts:!Ki&&!M,P=typeof r.useWorkerFetch=="boolean"?r.useWorkerFetch:!!(I===my&&p&&m&&x&&b&&Yf(p,document.baseURI)&&Yf(x,document.baseURI)&&Yf(b,document.baseURI)),G=null;AO(d);let H={canvasFactory:new X({ownerDocument:$,enableHWA:_}),filterFactory:new T({docId:e,ownerDocument:$}),binaryDataFactory:P?null:new I({cMapUrl:p,standardFontDataUrl:x,wasmUrl:b})};h||(h=Pd.create({verbosity:d,port:Tr.workerPort}),t._worker=h);let V={docId:e,apiVersion:"5.6.205",data:i,password:l,disableAutoFetch:Z,rangeChunkSize:u,docBaseUrl:f,enableXfa:j,evaluatorOptions:{maxImageSize:C,disableFontFace:M,ignoreErrors:w,isEvalSupported:E,isOffscreenCanvasSupported:S,isImageDecoderSupported:N,canvasMaxAreaInBytes:k,fontExtraProperties:R,useSystemFonts:F,useWasm:z,useWorkerFetch:P,cMapUrl:p,cMapPacked:m,iccUrl:y,standardFontDataUrl:x,wasmUrl:b,enableWebGPU:W}},L={ownerDocument:$,pdfBug:Y,styleElement:G,enableHWA:_,loadingParams:{disableAutoFetch:Z,enableXfa:j}};return h.promise.then(function(){if(t.destroyed)throw new Error("Loading aborted");if(h.destroyed)throw new Error("Worker was destroyed");let tt=h.messageHandler.sendWithPromise("GetDocRequest",V,i?[i.buffer]:null),rt;if(!i)if(c)rt=new Hw({pdfDataRangeTransport:c,disableRange:q,disableStream:Q});else if(n){let at=KO(n);rt=new at({url:n,httpHeaders:s,withCredentials:a,rangeChunkSize:u,disableRange:q,disableStream:Q})}else throw new Error("getDocument - expected either `data`, `range`, or `url` parameter.");return tt.then(at=>{if(t.destroyed)throw new Error("Loading aborted");if(h.destroyed)throw new Error("Worker was destroyed");let ft=new Nl(e,at,h.port),J=new hA(ft,t,rt,L,H,D);t._transport=J,ft.send("Ready",null)})}).catch(t._capability.reject),t}function NT(r){return Math.floor(Math.max(0,Math.min(1,r))*255).toString(16).padStart(2,"0")}function Cf(r){return Math.max(0,Math.min(255,255*r))}function y0(r){return`${(r*100).toFixed(2)}%`}var b0,Ki,Bx,x0,wO,W3,Yi,Ba,Jf,Bt,Zt,IT,Dl,pn,Vf,tn,Uu,sg,Nd,Af,kT,ab,tu,sy,Xf,Id,Yc,$x,Qr,Xe,Ox,Ua,w0,zx,yt,Fx,sT,Xu,cb,ub,ay,tp,ep,ta,El,ja,np,kd,ao,oy,mp,Xc,Ls,ly,jx,cy,cT,oo,lo,dr,fr,gp,co,th,eh,yp,Ly,BT,Wn,UT,$T,$u,Tf,ia,Hx,bp,Il,sa,Ha,zT,jT,qx,Wx,kl,_l,nh,Ml,ge,Kn,By,Vx,ih,xp,Zn,rh,A0,A2,Xx,en,uo,wp,Pe,Yx,Uy,HT,Kc,$y,Kx,sh,Mi,ah,He,Re,oh,lh,si,ch,pr,vn,ho,fo,po,mo,ps,mr,Ol,Ap,vp,uh,Cp,ms,go,hh,yo,gs,zy,aa,dh,Ep,bo,Fl,fh,xo,Tp,cn,fe,oa,wo,Ao,Sp,ph,Dp,vo,ys,la,Np,Ip,gr,At,v0,Zx,WT,qT,VT,Sf,XT,YT,KT,Qx,ZT,QT,JT,tS,ii,ea,eS,nS,Jx,iS,Df,tw,Zu,nl,Cn,bs,Rr,mh,xs,Oi,gh,ws,Ai,ca,Pl,As,Co,Kr,Nf,C0,ri,uy,Ln,yr,Rl,Te,kp,Eo,br,To,So,Ll,_p,ew,Yu,yh,Bl,Mp,Op,Fp,Pp,Rp,ua,Ul,ha,$l,da,il,rS,sS,aS,v2,ip,zl,Lr,ke,pe,fa,bh,Do,Lp,Bn,jl,pa,xr,No,Bp,Gl,Fi,Up,Hl,ma,vs,xh,wh,wr,Wl,$p,jy,Rt,nw,zp,iw,E0,oS,lS,rw,T0,sw,cS,uS,hS,aw,dS,ow,fS,pS,mS,lw,If,zt,Se,cw,uT,ur,ds,hy,rp,ql,Vl,ga,Un,Gy,gS,sp,jp,dy,Bu,hT,dT,uw,Ah,Io,hw,pT,ya,ce,ye,Xl,Yl,Kl,Qn,Gp,fw,dw,vi,Ci,Zl,Br,vh,ko,_o,be,pw,xe,We,Ur,Ch,Eh,C2,fy,hr,Ql,Jl,tc,ec,nc,Hp,Zf,mw,Th,gw,we,yw,S0,D0,Yn,ki,kn,Wp,Hy,Sh,Dh,N0,bw,ic,Nh,Cs,rc,kf,xw,$r,Wy,nn,me,Fr,I0,k0,_f,Aw,ww,vw,Ih,Cw,Ew,FO,yS,ba,qy,Tw,d0,ln,kh,Nr,bS,xS,wS,_0,Nl,Vy,py,my,qp,gy,Sw,yy,sc,_h,xa,wa,Jn,ac,oc,Nt,Xn,Mf,zu,M0,ju,AS,Nw,Gu,Of,Ff,Iw,Pf,Dw,kw,_w,Mw,RO,Vp,Mh,Oh,Fh,Rd,vS,CS,Ow,w2,Gn,ap,Fw,Pw,Rw,gT,Xy,Lw,yT,bT,GO,xT,Si,Rx,Zi,Ku,by,WO,qO,VO,CT,Jr,Bw,Uw,$w,E2,Ju,Xp,Yp,_d,Md,Od,zw,jw,Gw,Kp,Ww,Hw,Zp,qw,Qp,Vw,Lx,TT,Es,Ld,kS,_S,Xw,Jp,Bs,MS,OS,FS,PS,Yw,tm,Wa,RS,LS,Zw,Kw,Qw,Jw,tA,em,nm,Tr,Ph,im,eA,Hu,rm,sm,am,Rh,nA,Mo,Ae,Lh,Bh,om,rA,iA,rn,zr,$n,lc,Ts,ei,Rf,Lf,F0,sA,Wu,ST,Ar,xy,ZO,DT,Oo,ai,lm,cm,Uh,cc,Aa,um,hm,uc,dm,$h,Fo,zh,fm,jh,hc,pm,mm,Gh,dc,gm,Hh,Wh,qa,US,$S,aA,Ji,P0,oA,zS,jS,Rn,Fd,QO,Yy,Ky,lA,qh,ym,bm,xm,op,cA,va,fc,pc,Bf,T2,uA,Po,jr,Ca,mc,Zy,gc,yc,ui,R0,HS,WS,Uf,Vh,L0,Ge,Pd,Pi,bc,Ea,Gr,xc,Xh,Ta,Zr,$f,B0,hA,dA,Ro,wc,Tl,fA,qS,VS,Ri,Ac,Yh,gn,wm,Kh,Sa,Am,Lo,Hr,vm,ve,pA,mA,gA,Al,XS,so,wi,lp,Ss,Cm,Zh,Em,Sl,wy,Ay,yA,Zc,JO,Qc,tF,Kf,vc,Qh,vr,Tm,bA,S2,$e,xA,Qi,vl,YS,KS,cp,wA,Ga,AA,vA,CA,vy,EA,TA,Sm,SA,up,Li,Bo,Qy,Jy,Jh,td,qe,Ds,Uo,Cc,ed,nd,Ns,Bi,Da,Na,Ve,Ia,$o,Dm,ka,id,Ec,zo,En,jo,Wt,U0,NA,IA,kA,$0,_A,ZS,QS,JS,tD,z0,j0,MA,DA,Cy,Nm,OA,Im,FA,km,PA,_m,Ey,RA,LA,Mm,Tc,Om,BA,hp,Ty,UA,$A,zA,Sy,Fm,Pm,GA,jA,Sc,Dc,rd,Go,Rm,Nc,Ui,Lm,$a,G0,HA,D2,Dy,m0,$i,Bm,Ic,zi,un,eD,nD,iD,H0,za,W0,q0,rD,qA,sD,Ie,WA,Dt,ji,Wr,sd,ad,Is,Vt,kc,_c,Um,$m,od,ld,Ho,zm,tb,eb,bn,zf,aD,oD,lD,cD,uD,hD,ra,Ny,cd,Mc,_a,jm,Gi,Gm,sn,nb,dD,Iy,Hm,Wm,qm,Wo,qr,hi,fD,V0,pD,mD,VA,dp,Vm,ud,XA,fp,YA,hd,Xm,Ma,Oc,Ym,Ei,Km,Zm,Fc,Hi,Wi,zn,dd,fd,ti,pd,Cr,Qm,Ht,KA,X0,gD,yD,bD,ZA,Cl,Dr,qu,xD,Y0,K0,wD,AD,vD,CD,ED,oe,ky,Pc,_y,qi,md,Tn,Rc,Lc,ie,QA,JA,t2,jf,TD,Z0,Gf,Vu,Kt,My,ks,Sn,Dn,Bc,gd,oi,jn,Er,Uc,$c,zc,yd,Q0,e2,li,Jm,tg,Vi,_s,Ms,bd,xd,jc,Hn,na,SD,DD,ND,Jc,Oy,ib,ID,Qu,n2,pp,g0,Ef,Gc,he,i2,Vr,kD,_D,r2,J0,MD,OD,FD,s2,a2,PD,Sr,o2,l2,qo,Os,Vo,Hc,_i,c2,_e,Nn,Xo,Oa,Yo,wd,Fa,Wc,Fs,Xi,Ad,re,Wf,qf,ty,ey,ny,u2,iy,RD,Hf,qc,vd,Ko,Zo,Pa,Ti,Qo,Cd,Ed,Xr,Ra,In,La,Jo,Td,_t,tl,Ee,h2,LD,fs,d2,f2,ry,Pr,Fy,Yr,ci,Vc,eg,rb,BD,Us,p2,UD,m2,mn,Py,Sd,ng,ig,Dd,Ps,Rs,rg,sb,$D,Qf,Ry,jD=ne(()=>{B();b0={};b0.d=(r,t)=>{for(var e in t)b0.o(t,e)&&!b0.o(r,e)&&Object.defineProperty(r,e,{enumerable:!0,get:t[e]})};b0.o=(r,t)=>Object.prototype.hasOwnProperty.call(r,t);Ki=typeof nt.default=="object"&&nt.default+""=="[object process]"&&!nt.default.versions.nw&&!(nt.default.versions.electron&&nt.default.type&&nt.default.type!=="browser"),Bx=[.001,0,0,.001,0,0],x0=1.35,wO=.35,W3=wO/x0,Yi={ANY:1,DISPLAY:2,PRINT:4,SAVE:8,ANNOTATIONS_FORMS:16,ANNOTATIONS_STORAGE:32,ANNOTATIONS_DISABLE:64,IS_EDITING:128,OPLIST:256},Ba={DISABLE:0,ENABLE:1,ENABLE_FORMS:2,ENABLE_STORAGE:3},Jf="pdfjs_internal_editor_",Bt={DISABLE:-1,NONE:0,FREETEXT:3,HIGHLIGHT:9,STAMP:13,INK:15,POPUP:16,SIGNATURE:101,COMMENT:102},Zt={RESIZE:1,CREATE:2,FREETEXT_SIZE:11,FREETEXT_COLOR:12,FREETEXT_OPACITY:13,INK_COLOR:21,INK_THICKNESS:22,INK_OPACITY:23,HIGHLIGHT_COLOR:31,HIGHLIGHT_THICKNESS:32,HIGHLIGHT_FREE:33,HIGHLIGHT_SHOW_ALL:34,DRAW_STEP:41},IT={PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048},Dl={TRIANGLES:1,LATTICE:2,PATCH:3},pn={FILL:0,STROKE:1,FILL_STROKE:2,INVISIBLE:3,FILL_ADD_TO_PATH:4,STROKE_ADD_TO_PATH:5,FILL_STROKE_ADD_TO_PATH:6,ADD_TO_PATH:7,FILL_STROKE_MASK:3,ADD_TO_PATH_FLAG:4},Vf={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3},tn={TEXT:1,LINK:2,FREETEXT:3,LINE:4,SQUARE:5,CIRCLE:6,POLYGON:7,POLYLINE:8,HIGHLIGHT:9,UNDERLINE:10,SQUIGGLY:11,STRIKEOUT:12,STAMP:13,CARET:14,INK:15,POPUP:16,FILEATTACHMENT:17,SOUND:18,MOVIE:19,WIDGET:20,SCREEN:21,PRINTERMARK:22,TRAPNET:23,WATERMARK:24,THREED:25,REDACT:26},Uu={SOLID:1,DASHED:2,BEVELED:3,INSET:4,UNDERLINE:5},sg={ERRORS:0,WARNINGS:1,INFOS:5},Nd={dependency:1,setLineWidth:2,setLineCap:3,setLineJoin:4,setMiterLimit:5,setDash:6,setRenderingIntent:7,setFlatness:8,setGState:9,save:10,restore:11,transform:12,moveTo:13,lineTo:14,curveTo:15,curveTo2:16,curveTo3:17,closePath:18,rectangle:19,stroke:20,closeStroke:21,fill:22,eoFill:23,fillStroke:24,eoFillStroke:25,closeFillStroke:26,closeEOFillStroke:27,endPath:28,clip:29,eoClip:30,beginText:31,endText:32,setCharSpacing:33,setWordSpacing:34,setHScale:35,setLeading:36,setFont:37,setTextRenderingMode:38,setTextRise:39,moveText:40,setLeadingMoveText:41,setTextMatrix:42,nextLine:43,showText:44,showSpacedText:45,nextLineShowText:46,nextLineSetSpacingShowText:47,setCharWidth:48,setCharWidthAndBounds:49,setStrokeColorSpace:50,setFillColorSpace:51,setStrokeColor:52,setStrokeColorN:53,setFillColor:54,setFillColorN:55,setStrokeGray:56,setFillGray:57,setStrokeRGBColor:58,setFillRGBColor:59,setStrokeCMYKColor:60,setFillCMYKColor:61,shadingFill:62,beginInlineImage:63,beginImageData:64,endInlineImage:65,paintXObject:66,markPoint:67,markPointProps:68,beginMarkedContent:69,beginMarkedContentProps:70,endMarkedContent:71,beginCompat:72,endCompat:73,paintFormXObjectBegin:74,paintFormXObjectEnd:75,beginGroup:76,endGroup:77,beginAnnotation:80,endAnnotation:81,paintImageMaskXObject:83,paintImageMaskXObjectGroup:84,paintImageXObject:85,paintInlineImageXObject:86,paintInlineImageXObjectGroup:87,paintImageXObjectRepeat:88,paintImageMaskXObjectRepeat:89,paintSolidColorImageMask:90,constructPath:91,setStrokeTransparent:92,setFillTransparent:93,rawFillPath:94},Af={moveTo:0,lineTo:1,curveTo:2,quadraticCurveTo:3,closePath:4},kT={NEED_PASSWORD:1,INCORRECT_PASSWORD:2},ab=sg.WARNINGS;tu=(function(){function t(e,n){this.message=e,this.name=n}return t.prototype=new Error,t.constructor=t,t})(),sy=class extends tu{constructor(t,e){super(t,"PasswordException"),this.code=e}},Xf=class extends tu{constructor(t,e){super(t,"UnknownErrorException"),this.details=e}},Id=class extends tu{constructor(t){super(t,"InvalidPDFException")}},Yc=class extends tu{constructor(t,e,n){super(t,"ResponseException"),this.status=e,this.missing=n}},$x=class extends tu{constructor(t){super(t,"FormatError")}},Qr=class extends tu{constructor(t){super(t,"AbortException")}};Xe=class{static get isLittleEndian(){return Ut(this,"isLittleEndian",SO())}static get isEvalSupported(){return Ut(this,"isEvalSupported",DO())}static get isOffscreenCanvasSupported(){return Ut(this,"isOffscreenCanvasSupported",typeof OffscreenCanvas<"u")}static get isImageDecoderSupported(){return Ut(this,"isImageDecoderSupported",typeof ImageDecoder<"u")}static get isFloat16ArraySupported(){return Ut(this,"isFloat16ArraySupported",typeof Float16Array<"u")}static get isSanitizerSupported(){return Ut(this,"isSanitizerSupported",typeof Sanitizer<"u")}static get platform(){let{platform:t,userAgent:e}=navigator;return Ut(this,"platform",{isAndroid:e.includes("Android"),isLinux:t.includes("Linux"),isMac:t.includes("Mac"),isWindows:t.includes("Win"),isFirefox:e.includes("Firefox")})}static get isCSSRoundSupported(){return Ut(this,"isCSSRoundSupported",globalThis.CSS?.supports?.("width: round(1.5px, 1px)"))}},Ox=Array.from(Array(256).keys(),r=>r.toString(16).padStart(2,"0")),yt=class{static makeHexColor(t,e,n){return`#${Ox[t]}${Ox[e]}${Ox[n]}`}static domMatrixToTransform(t){return[t.a,t.b,t.c,t.d,t.e,t.f]}static scaleMinMax(t,e){let n;t[0]?(t[0]<0&&(n=e[0],e[0]=e[2],e[2]=n),e[0]*=t[0],e[2]*=t[0],t[3]<0&&(n=e[1],e[1]=e[3],e[3]=n),e[1]*=t[3],e[3]*=t[3]):(n=e[0],e[0]=e[1],e[1]=n,n=e[2],e[2]=e[3],e[3]=n,t[1]<0&&(n=e[1],e[1]=e[3],e[3]=n),e[1]*=t[1],e[3]*=t[1],t[2]<0&&(n=e[0],e[0]=e[2],e[2]=n),e[0]*=t[2],e[2]*=t[2]),e[0]+=t[4],e[1]+=t[5],e[2]+=t[4],e[3]+=t[5]}static transform(t,e){return[t[0]*e[0]+t[2]*e[1],t[1]*e[0]+t[3]*e[1],t[0]*e[2]+t[2]*e[3],t[1]*e[2]+t[3]*e[3],t[0]*e[4]+t[2]*e[5]+t[4],t[1]*e[4]+t[3]*e[5]+t[5]]}static multiplyByDOMMatrix(t,e){return[t[0]*e.a+t[2]*e.b,t[1]*e.a+t[3]*e.b,t[0]*e.c+t[2]*e.d,t[1]*e.c+t[3]*e.d,t[0]*e.e+t[2]*e.f+t[4],t[1]*e.e+t[3]*e.f+t[5]]}static applyTransform(t,e,n=0){let i=t[n],s=t[n+1];t[n]=i*e[0]+s*e[2]+e[4],t[n+1]=i*e[1]+s*e[3]+e[5]}static applyTransformToBezier(t,e,n=0){let i=e[0],s=e[1],a=e[2],l=e[3],c=e[4],u=e[5];for(let h=0;h<6;h+=2){let d=t[n+h],f=t[n+h+1];t[n+h]=d*i+f*a+c,t[n+h+1]=d*s+f*l+u}}static applyInverseTransform(t,e){let n=t[0],i=t[1],s=e[0]*e[3]-e[1]*e[2];t[0]=(n*e[3]-i*e[2]+e[2]*e[5]-e[4]*e[3])/s,t[1]=(-n*e[1]+i*e[0]+e[4]*e[1]-e[5]*e[0])/s}static axialAlignedBoundingBox(t,e,n){let i=e[0],s=e[1],a=e[2],l=e[3],c=e[4],u=e[5],h=t[0],d=t[1],f=t[2],p=t[3],m=i*h+c,y=m,x=i*f+c,b=x,w=l*d+u,C=w,E=l*p+u,S=E;if(s!==0||a!==0){let N=s*h,k=s*f,M=a*d,R=a*p;m+=M,b+=M,x+=R,y+=R,w+=N,S+=N,E+=k,C+=k}n[0]=Math.min(n[0],m,x,y,b),n[1]=Math.min(n[1],w,E,C,S),n[2]=Math.max(n[2],m,x,y,b),n[3]=Math.max(n[3],w,E,C,S)}static inverseTransform(t){let e=t[0]*t[3]-t[1]*t[2];return[t[3]/e,-t[1]/e,-t[2]/e,t[0]/e,(t[2]*t[5]-t[4]*t[3])/e,(t[4]*t[1]-t[5]*t[0])/e]}static singularValueDecompose2dScale(t,e){let n=t[0],i=t[1],s=t[2],a=t[3],l=n**2+i**2,c=n*s+i*a,u=s**2+a**2,h=(l+u)/2,d=Math.sqrt(h**2-(l*u-c**2));e[0]=Math.sqrt(h+d||1),e[1]=Math.sqrt(h-d||1)}static normalizeRect(t){let e=t.slice(0);return t[0]>t[2]&&(e[0]=t[2],e[2]=t[0]),t[1]>t[3]&&(e[1]=t[3],e[3]=t[1]),e}static intersect(t,e){let n=Math.max(Math.min(t[0],t[2]),Math.min(e[0],e[2])),i=Math.min(Math.max(t[0],t[2]),Math.max(e[0],e[2]));if(n>i)return null;let s=Math.max(Math.min(t[1],t[3]),Math.min(e[1],e[3])),a=Math.min(Math.max(t[1],t[3]),Math.max(e[1],e[3]));return s>a?null:[n,s,i,a]}static pointBoundingBox(t,e,n){n[0]=Math.min(n[0],t),n[1]=Math.min(n[1],e),n[2]=Math.max(n[2],t),n[3]=Math.max(n[3],e)}static rectBoundingBox(t,e,n,i,s){s[0]=Math.min(s[0],t,n),s[1]=Math.min(s[1],e,i),s[2]=Math.max(s[2],t,n),s[3]=Math.max(s[3],e,i)}static bezierBoundingBox(t,e,n,i,s,a,l,c,u){u[0]=Math.min(u[0],t,l),u[1]=Math.min(u[1],e,c),u[2]=Math.max(u[2],t,l),u[3]=Math.max(u[3],e,c),v(this,Ua,zx).call(this,t,n,s,l,e,i,a,c,3*(-t+3*(n-s)+l),6*(t-2*n+s),3*(n-t),u),v(this,Ua,zx).call(this,t,n,s,l,e,i,a,c,3*(-e+3*(i-a)+c),6*(e-2*i+a),3*(i-e),u)}};Ua=new WeakSet,w0=function(t,e,n,i,s,a,l,c,u,h){if(u<=0||u>=1)return;let d=1-u,f=u*u,p=f*u,m=d*(d*(d*t+3*u*e)+3*f*n)+p*i,y=d*(d*(d*s+3*u*a)+3*f*l)+p*c;h[0]=Math.min(h[0],m),h[1]=Math.min(h[1],y),h[2]=Math.max(h[2],m),h[3]=Math.max(h[3],y)},zx=function(t,e,n,i,s,a,l,c,u,h,d,f){if(Math.abs(u)<1e-12){Math.abs(h)>=1e-12&&v(this,Ua,w0).call(this,t,e,n,i,s,a,l,c,-d/h,f);return}let p=h**2-4*d*u;if(p<0)return;let m=Math.sqrt(p),y=2*u;v(this,Ua,w0).call(this,t,e,n,i,s,a,l,c,(-h+m)/y,f),v(this,Ua,w0).call(this,t,e,n,i,s,a,l,c,(-h-m)/y,f)},A(yt,Ua);Fx=null,sT=null;Xu="pdfjs_internal_id_";cb=()=>[],ub=()=>new Map,ay=()=>Object.create(null);typeof Math.sumPrecise!="function"&&(Math.sumPrecise=function(r){return r.reduce((t,e)=>t+e,0)});tp=class r{static textContent(t){let e=[],n={items:e,styles:Object.create(null)};function i(s){if(!s)return;let a=null,l=s.name;if(l==="#text")a=s.value;else if(r.shouldBuildText(l))s?.attributes?.textContent?a=s.attributes.textContent:s.value&&(a=s.value);else return;if(a!==null&&e.push({str:a}),!!s.children)for(let c of s.children)i(c)}return i(t),n}static shouldBuildText(t){return!(t==="textarea"||t==="input"||t==="option"||t==="select")}},ep=class{static setupStorage(t,e,n,i,s){let a=i.getValue(e,{value:null});switch(n.name){case"textarea":if(a.value!==null&&(t.textContent=a.value),s==="print")break;t.addEventListener("input",l=>{i.setValue(e,{value:l.target.value})});break;case"input":if(n.attributes.type==="radio"||n.attributes.type==="checkbox"){if(a.value===n.attributes.xfaOn?t.setAttribute("checked",!0):a.value===n.attributes.xfaOff&&t.removeAttribute("checked"),s==="print")break;t.addEventListener("change",l=>{i.setValue(e,{value:l.target.checked?l.target.getAttribute("xfaOn"):l.target.getAttribute("xfaOff")})})}else{if(a.value!==null&&t.setAttribute("value",a.value),s==="print")break;t.addEventListener("input",l=>{i.setValue(e,{value:l.target.value})})}break;case"select":if(a.value!==null){t.setAttribute("value",a.value);for(let l of n.children)l.attributes.value===a.value?l.attributes.selected=!0:l.attributes.hasOwnProperty("selected")&&delete l.attributes.selected}t.addEventListener("input",l=>{let c=l.target.options,u=c.selectedIndex===-1?"":c[c.selectedIndex].value;i.setValue(e,{value:u})});break}}static setAttributes({html:t,element:e,storage:n=null,intent:i,linkService:s}){let{attributes:a}=e,l=t instanceof HTMLAnchorElement;a.type==="radio"&&(a.name=`${a.name}-${i}`);for(let[c,u]of Object.entries(a))if(u!=null)switch(c){case"class":u.length&&t.setAttribute(c,u.join(" "));break;case"dataId":break;case"id":t.setAttribute("data-element-id",u);break;case"style":Object.assign(t.style,u);break;case"textContent":t.textContent=u;break;default:(!l||c!=="href"&&c!=="newWindow")&&t.setAttribute(c,u)}l&&s.addLinkAttributes(t,a.href,a.newWindow),n&&a.dataId&&this.setupStorage(t,a.dataId,e,n)}static render(t){let e=t.annotationStorage,n=t.linkService,i=t.xfaHtml,s=t.intent||"display",a=document.createElement(i.name);i.attributes&&this.setAttributes({html:a,element:i,intent:s,linkService:n});let l=s!=="richText",c=t.div;if(c.append(a),t.viewport){let d=`matrix(${t.viewport.transform.join(",")})`;c.style.transform=d}l&&c.setAttribute("class","xfaLayer xfaFont");let u=[];if(i.children.length===0){if(i.value){let d=document.createTextNode(i.value);a.append(d),l&&tp.shouldBuildText(i.name)&&u.push(d)}return{textDivs:u}}let h=[[i,-1,a]];for(;h.length>0;){let[d,f,p]=h.at(-1);if(f+1===d.children.length){h.pop();continue}let m=d.children[++h.at(-1)[1]];if(m===null)continue;let{name:y}=m;if(y==="#text"){let b=document.createTextNode(m.value);u.push(b),p.append(b);continue}let x=m?.attributes?.xmlns?document.createElementNS(m.attributes.xmlns,y):document.createElement(y);if(p.append(x),m.attributes&&this.setAttributes({html:x,element:m,storage:e,intent:s,linkService:n}),m.children?.length>0)h.push([m,-1,x]);else if(m.value){let b=document.createTextNode(m.value);l&&tp.shouldBuildText(y)&&u.push(b),x.append(b)}}for(let d of c.querySelectorAll(".xfaNonInteractive input, .xfaNonInteractive textarea"))d.setAttribute("readOnly",!0);return{textDivs:u}}static update(t){let e=`matrix(${t.viewport.transform.join(",")})`;t.div.style.transform=e,t.div.hidden=!1}},ta="http://www.w3.org/2000/svg",El=class El{};U(El,"CSS",96),U(El,"PDF",72),U(El,"PDF_TO_CSS_UNITS",El.CSS/El.PDF);ja=El;np=class r{constructor({viewBox:t,userUnit:e,scale:n,rotation:i,offsetX:s=0,offsetY:a=0,dontFlip:l=!1}){this.viewBox=t,this.userUnit=e,this.scale=n,this.rotation=i,this.offsetX=s,this.offsetY=a,n*=e;let c=(t[2]+t[0])/2,u=(t[3]+t[1])/2,h,d,f,p;switch(i%=360,i<0&&(i+=360),i){case 180:h=-1,d=0,f=0,p=1;break;case 90:h=0,d=1,f=1,p=0;break;case 270:h=0,d=-1,f=-1,p=0;break;case 0:h=1,d=0,f=0,p=-1;break;default:throw new Error("PageViewport: Invalid rotation, must be a multiple of 90 degrees.")}l&&(f=-f,p=-p);let m,y,x,b;h===0?(m=Math.abs(u-t[1])*n+s,y=Math.abs(c-t[0])*n+a,x=(t[3]-t[1])*n,b=(t[2]-t[0])*n):(m=Math.abs(c-t[0])*n+s,y=Math.abs(u-t[1])*n+a,x=(t[2]-t[0])*n,b=(t[3]-t[1])*n),this.transform=[h*n,d*n,f*n,p*n,m-h*n*c-f*n*u,y-d*n*c-p*n*u],this.width=x,this.height=b}get rawDims(){let t=this.viewBox;return Ut(this,"rawDims",{pageWidth:t[2]-t[0],pageHeight:t[3]-t[1],pageX:t[0],pageY:t[1]})}clone({scale:t=this.scale,rotation:e=this.rotation,offsetX:n=this.offsetX,offsetY:i=this.offsetY,dontFlip:s=!1}={}){return new r({viewBox:this.viewBox.slice(),userUnit:this.userUnit,scale:t,rotation:e,offsetX:n,offsetY:i,dontFlip:s})}convertToViewportPoint(t,e){let n=[t,e];return yt.applyTransform(n,this.transform),n}convertToViewportRectangle(t){let e=[t[0],t[1]];yt.applyTransform(e,this.transform);let n=[t[2],t[3]];return yt.applyTransform(n,this.transform),[e[0],e[1],n[0],n[1]]}convertToPdfPoint(t,e){let n=[t,e];return yt.applyInverseTransform(n,this.transform),n}},kd=class extends tu{constructor(t,e=0){super(t,"RenderingCancelledException"),this.extraDelay=e}};oy=class{constructor(){A(this,ao,new Map);U(this,"times",[])}time(t){o(this,ao).has(t)&&jt(`Timer is already running for ${t}`),o(this,ao).set(t,Date.now())}timeEnd(t){o(this,ao).has(t)||jt(`Timer has not been started for ${t}`),this.times.push({name:t,start:o(this,ao).get(t),end:Date.now()}),o(this,ao).delete(t)}toString(){let t=Math.max(...this.times.map(e=>e.name.length));return this.times.map(e=>`${e.name.padEnd(t)} ${e.end-e.start}ms
|
|
15
|
+
`).join("")}};ao=new WeakMap;Xc=class{static toDateObject(t){if(t instanceof Date)return t;if(!t||typeof t!="string")return null;o(this,mp)||g(this,mp,new RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+|-])?(\\d{2})?'?(\\d{2})?'?"));let e=o(this,mp).exec(t);if(!e)return null;let n=parseInt(e[1],10),i=parseInt(e[2],10);i=i>=1&&i<=12?i-1:0;let s=parseInt(e[3],10);s=s>=1&&s<=31?s:1;let a=parseInt(e[4],10);a=a>=0&&a<=23?a:0;let l=parseInt(e[5],10);l=l>=0&&l<=59?l:0;let c=parseInt(e[6],10);c=c>=0&&c<=59?c:0;let u=e[7]||"Z",h=parseInt(e[8],10);h=h>=0&&h<=23?h:0;let d=parseInt(e[9],10)||0;return d=d>=0&&d<=59?d:0,u==="-"?(a+=h,l+=d):u==="+"&&(a-=h,l-=d),new Date(Date.UTC(n,i,s,a,l,c))}};mp=new WeakMap,A(Xc,mp);Ls=class r{constructor(){let{pixelRatio:t}=r;this.sx=t,this.sy=t}get scaled(){return this.sx!==1||this.sy!==1}get symmetric(){return this.sx===this.sy}limitCanvas(t,e,n,i,s=-1){let a=1/0,l=1/0,c=1/0;n=r.capPixels(n,s),n>0&&(a=Math.sqrt(n/(t*e))),i!==-1&&(l=i/t,c=i/e);let u=Math.min(a,l,c);return this.sx>u||this.sy>u?(this.sx=u,this.sy=u,!0):!1}static get pixelRatio(){return globalThis.devicePixelRatio||1}static capPixels(t,e){if(e>=0){let n=Math.ceil(window.screen.availWidth*window.screen.availHeight*this.pixelRatio**2*(1+e/100));return t>0?Math.min(t,n):n}return t}},ly=["image/apng","image/avif","image/bmp","image/gif","image/jpeg","image/png","image/svg+xml","image/webp","image/x-icon"],jx=class{static get isDarkMode(){return Ut(this,"isDarkMode",!!window?.matchMedia?.("(prefers-color-scheme: dark)").matches)}},cy=class{static get commentForegroundColor(){let t=document.createElement("span");t.classList.add("comment","sidebar");let{style:e}=t;e.width=e.height="0",e.display="none",e.color="var(--comment-fg-color)",document.body.append(t);let{color:n}=window.getComputedStyle(t);return t.remove(),Ut(this,"commentForegroundColor",Bd(n))}};cT=new Map;ia=class ia{constructor(t){A(this,Wn);A(this,oo,null);A(this,lo,null);A(this,dr);A(this,fr,null);A(this,gp,null);A(this,co,null);A(this,th,null);A(this,eh,null);g(this,dr,t),o(ia,yp)||g(ia,yp,Object.freeze({freetext:"pdfjs-editor-remove-freetext-button",highlight:"pdfjs-editor-remove-highlight-button",ink:"pdfjs-editor-remove-ink-button",stamp:"pdfjs-editor-remove-stamp-button",signature:"pdfjs-editor-remove-signature-button"}))}render(){let t=g(this,oo,document.createElement("div"));t.classList.add("editToolbar","hidden"),t.setAttribute("role","toolbar");let e=o(this,dr)._uiManager._signal;e instanceof AbortSignal&&!e.aborted&&(t.addEventListener("contextmenu",tr,{signal:e}),t.addEventListener("pointerdown",v(ia,Ly,BT),{signal:e}));let n=g(this,fr,document.createElement("div"));n.className="buttons",t.append(n);let i=o(this,dr).toolbarPosition;if(i){let{style:s}=t,a=o(this,dr)._uiManager.direction==="ltr"?1-i[0]:i[0];s.insetInlineEnd=`${100*a}%`,s.top=`calc(${100*i[1]}% + var(--editor-toolbar-vert-offset))`}return t}get div(){return o(this,oo)}hide(){o(this,oo).classList.add("hidden"),o(this,lo)?.hideDropdown()}show(){o(this,oo).classList.remove("hidden"),o(this,gp)?.shown(),o(this,co)?.shown()}addDeleteButton(){let{editorType:t,_uiManager:e}=o(this,dr),n=document.createElement("button");n.classList.add("basic","deleteButton"),n.tabIndex=0,n.setAttribute("data-l10n-id",o(ia,yp)[t]),v(this,Wn,$u).call(this,n)&&n.addEventListener("click",i=>{e.delete()},{signal:e._signal}),o(this,fr).append(n)}async addAltText(t){let e=await t.render();v(this,Wn,$u).call(this,e),o(this,fr).append(e,o(this,Wn,Tf)),g(this,gp,t)}addComment(t,e=null){if(o(this,co))return;let n=t.renderForToolbar();if(!n)return;v(this,Wn,$u).call(this,n);let i=g(this,th,o(this,Wn,Tf));e?(o(this,fr).insertBefore(n,e),o(this,fr).insertBefore(i,e)):o(this,fr).append(n,i),g(this,co,t),t.toolbar=this}addColorPicker(t){if(o(this,lo))return;g(this,lo,t);let e=t.renderButton();v(this,Wn,$u).call(this,e),o(this,fr).append(e,o(this,Wn,Tf))}async addEditSignatureButton(t){let e=g(this,eh,await t.renderEditButton(o(this,dr)));v(this,Wn,$u).call(this,e),o(this,fr).append(e,o(this,Wn,Tf))}removeButton(t){t==="comment"&&(o(this,co)?.removeToolbarCommentButton(),g(this,co,null),o(this,th)?.remove(),g(this,th,null))}async addButton(t,e){switch(t){case"colorPicker":e&&this.addColorPicker(e);break;case"altText":e&&await this.addAltText(e);break;case"editSignature":e&&await this.addEditSignatureButton(e);break;case"delete":this.addDeleteButton();break;case"comment":e&&this.addComment(e);break}}async addButtonBefore(t,e,n){if(!e&&t==="comment")return;let i=o(this,fr).querySelector(n);i&&t==="comment"&&this.addComment(e,i)}updateEditSignatureButton(t){o(this,eh)&&(o(this,eh).title=t)}remove(){o(this,oo).remove(),o(this,lo)?.destroy(),g(this,lo,null)}};oo=new WeakMap,lo=new WeakMap,dr=new WeakMap,fr=new WeakMap,gp=new WeakMap,co=new WeakMap,th=new WeakMap,eh=new WeakMap,yp=new WeakMap,Ly=new WeakSet,BT=function(t){t.stopPropagation()},Wn=new WeakSet,UT=function(t){o(this,dr)._focusEventsAllowed=!1,Be(t)},$T=function(t){o(this,dr)._focusEventsAllowed=!0,Be(t)},$u=function(t){let e=o(this,dr)._uiManager._signal;return!(e instanceof AbortSignal)||e.aborted?!1:(t.addEventListener("focusin",v(this,Wn,UT).bind(this),{capture:!0,signal:e}),t.addEventListener("focusout",v(this,Wn,$T).bind(this),{capture:!0,signal:e}),t.addEventListener("contextmenu",tr,{signal:e}),!0)},Tf=function(){let t=document.createElement("div");return t.className="divider",t},A(ia,Ly),A(ia,yp,null);Hx=ia,Wx=class{constructor(t){A(this,Ha);A(this,bp,null);A(this,Il,null);A(this,sa);g(this,sa,t)}show(t,e,n){let[i,s]=v(this,Ha,jT).call(this,e,n),{style:a}=o(this,Il)||g(this,Il,v(this,Ha,zT).call(this));t.append(o(this,Il)),a.insetInlineEnd=`${100*i}%`,a.top=`calc(${100*s}% + var(--editor-toolbar-vert-offset))`}hide(){o(this,Il).remove()}};bp=new WeakMap,Il=new WeakMap,sa=new WeakMap,Ha=new WeakSet,zT=function(){let t=g(this,Il,document.createElement("div"));t.className="editToolbar",t.setAttribute("role","toolbar");let e=o(this,sa)._signal;e instanceof AbortSignal&&!e.aborted&&t.addEventListener("contextmenu",tr,{signal:e});let n=g(this,bp,document.createElement("div"));return n.className="buttons",t.append(n),o(this,sa).hasCommentManager()&&v(this,Ha,qx).call(this,"commentButton","pdfjs-comment-floating-button","pdfjs-comment-floating-button-label",()=>{o(this,sa).commentSelection("floating_button")}),v(this,Ha,qx).call(this,"highlightButton","pdfjs-highlight-floating-button1","pdfjs-highlight-floating-button-label",()=>{o(this,sa).highlightSelection("floating_button")}),t},jT=function(t,e){let n=0,i=0;for(let s of t){let a=s.y+s.height;if(a<n)continue;let l=s.x+(e?s.width:0);if(a>n){i=l,n=a;continue}e?l>i&&(i=l):l<i&&(i=l)}return[e?1-i:i,n]},qx=function(t,e,n,i){let s=document.createElement("button");s.classList.add("basic",t),s.tabIndex=0,s.setAttribute("data-l10n-id",e);let a=document.createElement("span");s.append(a),a.className="visuallyHidden",a.setAttribute("data-l10n-id",n);let l=o(this,sa)._signal;l instanceof AbortSignal&&!l.aborted&&(s.addEventListener("contextmenu",tr,{signal:l}),s.addEventListener("click",i,{signal:l})),o(this,bp).append(s)};ge=class ge{static initializeAndAddPointerId(t){(o(ge,_l)||g(ge,_l,new Set)).add(t)}static setPointer(t,e){o(ge,kl)||g(ge,kl,e),o(ge,Ml)??g(ge,Ml,t)}static setTimeStamp(t){g(ge,nh,t)}static isSamePointerId(t){return o(ge,kl)===t}static isSamePointerIdOrRemove(t){return o(ge,kl)===t?!0:(o(ge,_l)?.delete(t),!1)}static isSamePointerType(t){return o(ge,Ml)===t}static isInitializedAndDifferentPointerType(t){return o(ge,Ml)!==null&&!ge.isSamePointerType(t)}static isSameTimeStamp(t){return o(ge,nh)===t}static isUsingMultiplePointers(){return o(ge,_l)?.size>=1}static clearPointerType(){g(ge,Ml,null)}static clearPointerIds(){g(ge,kl,NaN),g(ge,_l,null)}static clearTimeStamp(){g(ge,nh,NaN)}};kl=new WeakMap,_l=new WeakMap,nh=new WeakMap,Ml=new WeakMap,A(ge,kl,NaN),A(ge,_l,null),A(ge,nh,NaN),A(ge,Ml,null);Kn=ge,Vx=class{constructor(){A(this,By,0)}get id(){return`${Jf}${an(this,By)._++}`}};By=new WeakMap;A2=class A2{constructor(){A(this,rh);A(this,ih,b2());A(this,xp,0);A(this,Zn,null)}static get _isSVGFittingCanvas(){let t='data:image/svg+xml;charset=UTF-8,<svg viewBox="0 0 1 1" width="1" height="1" xmlns="http://www.w3.org/2000/svg"><rect width="1" height="1" style="fill:red;"/></svg>',n=new OffscreenCanvas(1,3).getContext("2d",{willReadFrequently:!0}),i=new Image;i.src=t;let s=i.decode().then(()=>(n.drawImage(i,0,0,1,1,0,0,1,3),new Uint32Array(n.getImageData(0,0,1,1).data.buffer)[0]===0));return Ut(this,"_isSVGFittingCanvas",s)}async getFromFile(t){let{lastModified:e,name:n,size:i,type:s}=t;return v(this,rh,A0).call(this,`${e}_${n}_${i}_${s}`,t)}async getFromUrl(t){return v(this,rh,A0).call(this,t,t)}async getFromBlob(t,e){let n=await e;return v(this,rh,A0).call(this,t,n)}async getFromId(t){o(this,Zn)||g(this,Zn,new Map);let e=o(this,Zn).get(t);if(!e)return null;if(e.bitmap)return e.refCounter+=1,e;if(e.file)return this.getFromFile(e.file);if(e.blobPromise){let{blobPromise:n}=e;return delete e.blobPromise,this.getFromBlob(e.id,n)}return this.getFromUrl(e.url)}getFromCanvas(t,e){o(this,Zn)||g(this,Zn,new Map);let n=o(this,Zn).get(t);if(n?.bitmap)return n.refCounter+=1,n;let i=new OffscreenCanvas(e.width,e.height);return i.getContext("2d").drawImage(e,0,0),n={bitmap:i.transferToImageBitmap(),id:`image_${o(this,ih)}_${an(this,xp)._++}`,refCounter:1,isSvg:!1},o(this,Zn).set(t,n),o(this,Zn).set(n.id,n),n}getSvgUrl(t){let e=o(this,Zn).get(t);return e?.isSvg?e.svgUrl:null}deleteId(t){o(this,Zn)||g(this,Zn,new Map);let e=o(this,Zn).get(t);if(!e||(e.refCounter-=1,e.refCounter!==0))return;let{bitmap:n}=e;if(!e.url&&!e.file){let i=new OffscreenCanvas(n.width,n.height);i.getContext("bitmaprenderer").transferFromImageBitmap(n),e.blobPromise=i.convertToBlob()}n.close?.(),e.bitmap=null}isValidId(t){return t.startsWith(`image_${o(this,ih)}_`)}};ih=new WeakMap,xp=new WeakMap,Zn=new WeakMap,rh=new WeakSet,A0=async function(t,e){o(this,Zn)||g(this,Zn,new Map);let n=o(this,Zn).get(t);if(n===null)return null;if(n?.bitmap)return n.refCounter+=1,n;try{n||(n={bitmap:null,id:`image_${o(this,ih)}_${an(this,xp)._++}`,refCounter:0,isSvg:!1});let i;if(typeof e=="string"?(n.url=e,i=await hb(e,"blob")):e instanceof File?i=n.file=e:e instanceof Blob&&(i=e),i.type==="image/svg+xml"){let s=A2._isSVGFittingCanvas,a=new FileReader,l=new Image,c=new Promise((u,h)=>{l.onload=()=>{n.bitmap=l,n.isSvg=!0,u()},a.onload=async()=>{let d=n.svgUrl=a.result;l.src=await s?`${d}#svgView(preserveAspectRatio(none))`:d},l.onerror=a.onerror=h});a.readAsDataURL(i),await c}else n.bitmap=await createImageBitmap(i);n.refCounter=1}catch(i){jt(i),n=null}return o(this,Zn).set(t,n),n&&o(this,Zn).set(n.id,n),n};Xx=A2,Yx=class{constructor(t=128){A(this,en,[]);A(this,uo,!1);A(this,wp);A(this,Pe,-1);g(this,wp,t)}add({cmd:t,undo:e,post:n,mustExec:i,type:s=NaN,overwriteIfSameType:a=!1,keepUndo:l=!1}){if(i&&t(),o(this,uo))return;let c={cmd:t,undo:e,post:n,type:s};if(o(this,Pe)===-1){o(this,en).length>0&&(o(this,en).length=0),g(this,Pe,0),o(this,en).push(c);return}if(a&&o(this,en)[o(this,Pe)].type===s){l&&(c.undo=o(this,en)[o(this,Pe)].undo),o(this,en)[o(this,Pe)]=c;return}let u=o(this,Pe)+1;u===o(this,wp)?o(this,en).splice(0,1):(g(this,Pe,u),u<o(this,en).length&&o(this,en).splice(u)),o(this,en).push(c)}undo(){if(o(this,Pe)===-1)return;g(this,uo,!0);let{undo:t,post:e}=o(this,en)[o(this,Pe)];t(),e?.(),g(this,uo,!1),g(this,Pe,o(this,Pe)-1)}redo(){if(o(this,Pe)<o(this,en).length-1){g(this,Pe,o(this,Pe)+1),g(this,uo,!0);let{cmd:t,post:e}=o(this,en)[o(this,Pe)];t(),e?.(),g(this,uo,!1)}}hasSomethingToUndo(){return o(this,Pe)!==-1}hasSomethingToRedo(){return o(this,Pe)<o(this,en).length-1}cleanType(t){if(o(this,Pe)!==-1){for(let e=o(this,Pe);e>=0;e--)if(o(this,en)[e].type!==t){o(this,en).splice(e+1,o(this,Pe)-e),g(this,Pe,e);return}o(this,en).length=0,g(this,Pe,-1)}}destroy(){g(this,en,null)}};en=new WeakMap,uo=new WeakMap,wp=new WeakMap,Pe=new WeakMap;Kc=class{constructor(t){A(this,Uy);this.buffer=[],this.callbacks=new Map,this.allKeys=new Set;let{isMac:e}=Xe.platform;for(let[n,i,s={}]of t)for(let a of n){let l=a.startsWith("mac+");e&&l?(this.callbacks.set(a.slice(4),{callback:i,options:s}),this.allKeys.add(a.split("+").at(-1))):!e&&!l&&(this.callbacks.set(a,{callback:i,options:s}),this.allKeys.add(a.split("+").at(-1)))}}exec(t,e){if(!this.allKeys.has(e.key))return;let n=this.callbacks.get(v(this,Uy,HT).call(this,e));if(!n)return;let{callback:i,options:{bubbles:s=!1,args:a=[],checker:l=null}}=n;l&&!l(t,e)||(i.bind(t,...a,e)(),s||Be(e))}};Uy=new WeakSet,HT=function(t){t.altKey&&this.buffer.push("alt"),t.ctrlKey&&this.buffer.push("ctrl"),t.metaKey&&this.buffer.push("meta"),t.shiftKey&&this.buffer.push("shift"),this.buffer.push(t.key);let e=this.buffer.join("+");return this.buffer.length=0,e};$y=class $y{get _colors(){let t=new Map([["CanvasText",null],["Canvas",null]]);return _O(t),Ut(this,"_colors",t)}convert(t){let e=Bd(t);if(!window.matchMedia("(forced-colors: active)").matches)return e;for(let[n,i]of this._colors)if(i.every((s,a)=>s===e[a]))return $y._colorsMapping.get(n);return e}getHexCode(t){let e=this._colors.get(t);return e?yt.makeHexColor(...e):t}};U($y,"_colorsMapping",new Map([["CanvasText",[0,0,0]],["Canvas",[255,255,255]]]));Kx=$y,Zu=class Zu{constructor(t,e,n,i,s,a,l,c,u,h,d,f,p,m,y,x){A(this,At);A(this,sh,new AbortController);A(this,Mi,null);A(this,ah,null);A(this,He,new Map);A(this,Re,new Map);A(this,oh,null);A(this,lh,null);A(this,si,null);A(this,ch,null);A(this,pr,new Yx);A(this,vn,null);A(this,ho,null);A(this,fo,null);A(this,po,0);A(this,mo,new Set);A(this,ps,null);A(this,mr,null);A(this,Ol,new Set);U(this,"_editorUndoBar",null);A(this,Ap,!1);A(this,vp,!1);A(this,uh,!1);A(this,Cp,null);A(this,ms,null);A(this,go,null);A(this,hh,null);A(this,yo,!1);A(this,gs,null);A(this,zy,new Vx);A(this,aa,!1);A(this,dh,!1);A(this,Ep,!1);A(this,bo,null);A(this,Fl,null);A(this,fh,null);A(this,xo,null);A(this,Tp,null);A(this,cn,Bt.NONE);A(this,fe,new Set);A(this,oa,null);A(this,wo,null);A(this,Ao,null);A(this,Sp,null);A(this,ph,null);A(this,Dp,{isEditing:!1,isEmpty:!0,hasSomethingToUndo:!1,hasSomethingToRedo:!1,hasSelectedEditor:!1,hasSelectedText:!1});A(this,vo,[0,0]);A(this,ys,null);A(this,la,null);A(this,Np,null);A(this,Ip,null);A(this,gr,null);let b=this._signal=o(this,sh).signal;g(this,la,t),g(this,Np,e),g(this,Ip,n),g(this,lh,i),g(this,vn,s),g(this,wo,a),g(this,ph,c),this._eventBus=l,l._on("editingaction",this.onEditingAction.bind(this),{signal:b}),l._on("pagechanging",this.onPageChanging.bind(this),{signal:b}),l._on("scalechanging",this.onScaleChanging.bind(this),{signal:b}),l._on("rotationchanging",this.onRotationChanging.bind(this),{signal:b}),l._on("setpreference",this.onSetPreference.bind(this),{signal:b}),l._on("switchannotationeditorparams",w=>this.updateParams(w.type,w.value),{signal:b}),window.addEventListener("pointerdown",()=>{g(this,dh,!0)},{capture:!0,signal:b}),window.addEventListener("pointerup",()=>{g(this,dh,!1)},{capture:!0,signal:b}),window.addEventListener("beforeunload",v(this,At,WT).bind(this),{capture:!0,signal:b}),v(this,At,XT).call(this),v(this,At,tS).call(this),v(this,At,Qx).call(this),g(this,si,c.annotationStorage),g(this,Cp,c.filterFactory),g(this,Ao,u),g(this,hh,h||null),g(this,Ap,d),g(this,vp,f),g(this,uh,p),g(this,Tp,m||null),this.viewParameters={realScale:ja.PDF_TO_CSS_UNITS,rotation:0},this.isShiftKeyDown=!1,this._editorUndoBar=y||null,this._supportsPinchToZoom=x!==!1,s?.setSidebarUiManager(this)}static get _keyboardManager(){let t=Zu.prototype,e=a=>o(a,la).contains(document.activeElement)&&document.activeElement.tagName!=="BUTTON"&&a.hasSomethingToControl(),n=(a,{target:l})=>{if(l instanceof HTMLInputElement){let{type:c}=l;return c!=="text"&&c!=="number"}return!0},i=this.TRANSLATE_SMALL,s=this.TRANSLATE_BIG;return Ut(this,"_keyboardManager",new Kc([[["ctrl+a","mac+meta+a"],t.selectAll,{checker:n}],[["ctrl+z","mac+meta+z"],t.undo,{checker:n}],[["ctrl+y","ctrl+shift+z","mac+meta+shift+z","ctrl+shift+Z","mac+meta+shift+Z"],t.redo,{checker:n}],[["Backspace","alt+Backspace","ctrl+Backspace","shift+Backspace","mac+Backspace","mac+alt+Backspace","mac+ctrl+Backspace","Delete","ctrl+Delete","shift+Delete","mac+Delete"],t.delete,{checker:n}],[["Enter","mac+Enter"],t.addNewEditorFromKeyboard,{checker:(a,{target:l})=>!(l instanceof HTMLButtonElement)&&o(a,la).contains(l)&&!a.isEnterHandled}],[[" ","mac+ "],t.addNewEditorFromKeyboard,{checker:(a,{target:l})=>!(l instanceof HTMLButtonElement)&&o(a,la).contains(document.activeElement)}],[["Escape","mac+Escape"],t.unselectAll],[["ArrowLeft","mac+ArrowLeft"],t.translateSelectedEditors,{args:[-i,0],checker:e}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],t.translateSelectedEditors,{args:[-s,0],checker:e}],[["ArrowRight","mac+ArrowRight"],t.translateSelectedEditors,{args:[i,0],checker:e}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],t.translateSelectedEditors,{args:[s,0],checker:e}],[["ArrowUp","mac+ArrowUp"],t.translateSelectedEditors,{args:[0,-i],checker:e}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],t.translateSelectedEditors,{args:[0,-s],checker:e}],[["ArrowDown","mac+ArrowDown"],t.translateSelectedEditors,{args:[0,i],checker:e}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],t.translateSelectedEditors,{args:[0,s],checker:e}]]))}destroy(){o(this,gr)?.resolve(),g(this,gr,null),o(this,sh)?.abort(),g(this,sh,null),this._signal=null;for(let t of o(this,Re).values())t.destroy();o(this,Re).clear(),o(this,He).clear(),o(this,Ol).clear(),o(this,xo)?.clear(),g(this,Mi,null),o(this,fe).clear(),o(this,pr).destroy(),o(this,lh)?.destroy(),o(this,vn)?.destroy(),o(this,wo)?.destroy(),o(this,gs)?.hide(),g(this,gs,null),o(this,fh)?.destroy(),g(this,fh,null),g(this,ah,null),o(this,ms)&&(clearTimeout(o(this,ms)),g(this,ms,null)),o(this,ys)&&(clearTimeout(o(this,ys)),g(this,ys,null)),this._editorUndoBar?.destroy(),g(this,ph,null)}combinedSignal(t){return AbortSignal.any([this._signal,t.signal])}get mlManager(){return o(this,Tp)}get useNewAltTextFlow(){return o(this,vp)}get useNewAltTextWhenAddingImage(){return o(this,uh)}get hcmFilter(){return Ut(this,"hcmFilter",o(this,Ao)?o(this,Cp).addHCMFilter(o(this,Ao).foreground,o(this,Ao).background):"none")}get direction(){return Ut(this,"direction",getComputedStyle(o(this,la)).direction)}get _highlightColors(){return Ut(this,"_highlightColors",o(this,hh)?new Map(o(this,hh).split(",").map(t=>(t=t.split("=").map(e=>e.trim()),t[1]=t[1].toUpperCase(),t))):null)}get highlightColors(){let{_highlightColors:t}=this;if(!t)return Ut(this,"highlightColors",null);let e=new Map,n=!!o(this,Ao);for(let[i,s]of t){let a=i.endsWith("_HCM");if(n&&a){e.set(i.replace("_HCM",""),s);continue}!n&&!a&&e.set(i,s)}return Ut(this,"highlightColors",e)}get highlightColorNames(){return Ut(this,"highlightColorNames",this.highlightColors?new Map(Array.from(this.highlightColors,t=>t.reverse())):null)}getNonHCMColor(t){if(!this._highlightColors)return t;let e=this.highlightColorNames.get(t);return this._highlightColors.get(e)||t}getNonHCMColorName(t){return this.highlightColorNames.get(t)||t}setCurrentDrawingSession(t){t?(this.unselectAll(),this.disableUserSelect(!0)):this.disableUserSelect(!1),g(this,fo,t)}setMainHighlightColorPicker(t){g(this,fh,t)}editAltText(t,e=!1){o(this,lh)?.editAltText(this,t,e)}hasCommentManager(){return!!o(this,vn)}editComment(t,e,n,i){o(this,vn)?.showDialog(this,t,e,n,i)}selectComment(t,e){o(this,Re).get(t)?.getEditorByUID(e)?.toggleComment(!0,!0)}updateComment(t){o(this,vn)?.updateComment(t.getData())}updatePopupColor(t){o(this,vn)?.updatePopupColor(t)}removeComment(t){o(this,vn)?.removeComments([t.uid])}deleteComment(t,e){let n=()=>{t.comment=e},i=()=>{this._editorUndoBar?.show(n,"comment"),this.toggleComment(null),t.comment=null};this.addCommands({cmd:i,undo:n,mustExec:!0})}toggleComment(t,e,n=void 0){o(this,vn)?.toggleCommentPopup(t,e,n)}makeCommentColor(t,e){return t&&o(this,vn)?.makeCommentColor(t,e)||null}getCommentDialogElement(){return o(this,vn)?.dialogElement||null}async waitForEditorsRendered(t){if(o(this,Re).has(t-1))return;let{resolve:e,promise:n}=Promise.withResolvers(),i=s=>{s.pageNumber===t&&(this._eventBus._off("editorsrendered",i),e())};this._eventBus.on("editorsrendered",i),await n}getSignature(t){o(this,wo)?.getSignature({uiManager:this,editor:t})}get signatureManager(){return o(this,wo)}switchToMode(t,e){this._eventBus.on("annotationeditormodechanged",e,{once:!0,signal:this._signal}),this._eventBus.dispatch("showannotationeditorui",{source:this,mode:t})}setPreference(t,e){this._eventBus.dispatch("setpreference",{source:this,name:t,value:e})}onSetPreference({name:t,value:e}){t==="enableNewAltTextWhenAddingImage"&&g(this,uh,e)}onPageChanging({pageNumber:t}){g(this,po,t-1)}deletePage(t){for(let e of this.getEditors(t))e.remove();o(this,Re).delete(t),o(this,po)===t&&g(this,po,0)}focusMainContainer(){o(this,la).focus()}findParent(t,e){for(let n of o(this,Re).values()){let{x:i,y:s,width:a,height:l}=n.div.getBoundingClientRect();if(t>=i&&t<=i+a&&e>=s&&e<=s+l)return n}return null}disableUserSelect(t=!1){o(this,Np).classList.toggle("noUserSelect",t)}addShouldRescale(t){o(this,Ol).add(t)}removeShouldRescale(t){o(this,Ol).delete(t)}onScaleChanging({scale:t}){this.commitOrRemove(),this.viewParameters.realScale=t*ja.PDF_TO_CSS_UNITS;for(let e of o(this,Ol))e.onScaleChanging();o(this,fo)?.onScaleChanging()}onRotationChanging({pagesRotation:t}){this.commitOrRemove(),this.viewParameters.rotation=t}highlightSelection(t="",e=!1){let n=document.getSelection();if(!n||n.isCollapsed)return;let{anchorNode:i,anchorOffset:s,focusNode:a,focusOffset:l}=n,c=n.toString(),h=v(this,At,v0).call(this,n).closest(".textLayer"),d=this.getSelectionBoxes(h);if(!d)return;n.empty();let f=v(this,At,Zx).call(this,h),p=o(this,cn)===Bt.NONE,m=()=>{let y=f?.createAndAddNewEditor({x:0,y:0},!1,{methodOfCreation:t,boxes:d,anchorNode:i,anchorOffset:s,focusNode:a,focusOffset:l,text:c});p&&this.showAllEditors("highlight",!0,!0),e&&y?.editComment()};if(p){this.switchToMode(Bt.HIGHLIGHT,m);return}m()}commentSelection(t=""){this.highlightSelection(t,!0)}getAndRemoveDataFromAnnotationStorage(t){if(!o(this,si))return null;let e=`${Jf}${t}`,n=o(this,si).getRawValue(e);return n&&o(this,si).remove(e),n}addToAnnotationStorage(t){!t.isEmpty()&&o(this,si)&&!o(this,si).has(t.id)&&o(this,si).setValue(t.id,t)}a11yAlert(t,e=null){let n=o(this,Ip);n&&(n.setAttribute("data-l10n-id",t),e?n.setAttribute("data-l10n-args",JSON.stringify(e)):n.removeAttribute("data-l10n-args"))}blur(){if(this.isShiftKeyDown=!1,o(this,yo)&&(g(this,yo,!1),v(this,At,Sf).call(this,"main_toolbar")),!this.hasSelection)return;let{activeElement:t}=document;for(let e of o(this,fe))if(e.div.contains(t)){g(this,Fl,[e,t]),e._focusEventsAllowed=!1;break}}focus(){if(!o(this,Fl))return;let[t,e]=o(this,Fl);g(this,Fl,null),e.addEventListener("focusin",()=>{t._focusEventsAllowed=!0},{once:!0,signal:this._signal}),e.focus()}addEditListeners(){v(this,At,Qx).call(this),this.setEditingState(!0)}removeEditListeners(){v(this,At,ZT).call(this),this.setEditingState(!1)}dragOver(t){for(let{type:e}of t.dataTransfer.items)for(let n of o(this,mr))if(n.isHandlingMimeForPasting(e)){t.dataTransfer.dropEffect="copy",t.preventDefault();return}}drop(t){for(let e of t.dataTransfer.items)for(let n of o(this,mr))if(n.isHandlingMimeForPasting(e.type)){n.paste(e,this.currentLayer),t.preventDefault();return}}copy(t){if(t.preventDefault(),o(this,Mi)?.commitOrRemove(),!this.hasSelection)return;let e=[];for(let n of o(this,fe)){let i=n.serialize(!0);i&&e.push(i)}e.length!==0&&t.clipboardData.setData("application/pdfjs",JSON.stringify(e))}cut(t){this.copy(t),this.delete()}async paste(t){t.preventDefault();let{clipboardData:e}=t;for(let s of e.items)for(let a of o(this,mr))if(a.isHandlingMimeForPasting(s.type)){a.paste(s,this.currentLayer);return}let n=e.getData("application/pdfjs");if(!n)return;try{n=JSON.parse(n)}catch(s){jt(`paste: "${s.message}".`);return}if(!Array.isArray(n))return;this.unselectAll();let i=this.currentLayer;try{let s=[];for(let c of n){let u=await i.deserialize(c);if(!u)return;s.push(u)}let a=()=>{for(let c of s)v(this,At,Jx).call(this,c);v(this,At,tw).call(this,s)},l=()=>{for(let c of s)c.remove()};this.addCommands({cmd:a,undo:l,mustExec:!0})}catch(s){jt(`paste: "${s.message}".`)}}keydown(t){!this.isShiftKeyDown&&t.key==="Shift"&&(this.isShiftKeyDown=!0),o(this,cn)!==Bt.NONE&&!this.isEditorHandlingKeyboard&&Zu._keyboardManager.exec(this,t)}keyup(t){this.isShiftKeyDown&&t.key==="Shift"&&(this.isShiftKeyDown=!1,o(this,yo)&&(g(this,yo,!1),v(this,At,Sf).call(this,"main_toolbar")))}onEditingAction({name:t}){switch(t){case"undo":case"redo":case"delete":case"selectAll":this[t]();break;case"highlightSelection":this.highlightSelection("context_menu");break;case"commentSelection":this.commentSelection("context_menu");break}}updatePageIndex(t,e){for(let i of this.getEditors(t))i.pageIndex=e;let n=o(this,oh).get(t);n&&(n.pageIndex=e,o(this,Re).set(e,n),o(this,aa)?n.enable():n.disable())}startUpdatePages(){g(this,oh,new Map(o(this,Re))),o(this,Re).clear()}endUpdatePages(){g(this,oh,null)}clonePage(t,e){for(let n of this.getEditors(t)){let i=n.serialize(n.mode!==Bt.HIGHLIGHT);i&&(i.pageIndex=e,i.id=this.getId(),i.isClone=!0,delete i.popupRef,o(this,si).setValue(i.id,i))}}findClonesForPage(t){let e=[],{pageIndex:n}=t;for(let[i,s]of o(this,si))s.pageIndex===n&&s.isClone&&(o(this,si).remove(i),e.push(t.deserialize(s).then(a=>{a&&(a.isClone=!0,t.addOrRebuild(a))})));return Promise.all(e)}setEditingState(t){t?(v(this,At,YT).call(this),v(this,At,QT).call(this),v(this,At,ii).call(this,{isEditing:o(this,cn)!==Bt.NONE,isEmpty:v(this,At,Df).call(this),hasSomethingToUndo:o(this,pr).hasSomethingToUndo(),hasSomethingToRedo:o(this,pr).hasSomethingToRedo(),hasSelectedEditor:!1})):(v(this,At,KT).call(this),v(this,At,JT).call(this),v(this,At,ii).call(this,{isEditing:!1}),this.disableUserSelect(!1))}registerEditorTypes(t){if(!o(this,mr)){g(this,mr,t);for(let e of o(this,mr))v(this,At,ea).call(this,e.defaultPropertiesToUpdate)}}getId(){return o(this,zy).id}get currentLayer(){return o(this,Re).get(o(this,po))}getLayer(t){return o(this,Re).get(t)}get currentPageIndex(){return o(this,po)}addLayer(t){o(this,Re).set(t.pageIndex,t),o(this,aa)?t.enable():t.disable()}removeLayer(t){o(this,Re).delete(t.pageIndex)}async updateMode(t,e=null,n=!1,i=!1,s=!1,a=!1){if(o(this,cn)!==t&&!(o(this,gr)&&(await o(this,gr).promise,!o(this,gr)))){if(g(this,gr,Promise.withResolvers()),o(this,fo)?.commitOrRemove(),o(this,cn)===Bt.POPUP&&o(this,vn)?.hideSidebar(),o(this,vn)?.destroyPopup(),g(this,cn,t),t===Bt.NONE){this.setEditingState(!1),v(this,At,nS).call(this);for(let l of o(this,He).values())l.hideStandaloneCommentButton();this._editorUndoBar?.hide(),this.toggleComment(null),o(this,gr).resolve();return}for(let l of o(this,He).values())l.addStandaloneCommentButton();t===Bt.SIGNATURE&&await o(this,wo)?.loadSignatures(),n&&Kn.clearPointerType(),this.setEditingState(!0),await v(this,At,eS).call(this),this.unselectAll();for(let l of o(this,Re).values())l.updateMode(t);if(t===Bt.POPUP){o(this,ah)||g(this,ah,await o(this,ph).getAnnotationsByType(new Set(o(this,mr).map(u=>u._editorType))));let l=new Set,c=[];for(let u of o(this,He).values()){let{annotationElementId:h,hasComment:d,deleted:f}=u;h&&l.add(h),d&&!f&&c.push(u.getData())}for(let u of o(this,ah)){let{id:h,popupRef:d,contentsObj:f}=u;d&&f?.str&&!l.has(h)&&!o(this,mo).has(h)&&c.push(u)}o(this,vn)?.showSidebar(c)}if(!e){i&&this.addNewEditorFromKeyboard(),o(this,gr).resolve();return}for(let l of o(this,He).values())l.uid===e?(this.setSelected(l),a?l.editComment():s?l.enterInEditMode():l.focus()):l.unselect();o(this,gr).resolve()}}addNewEditorFromKeyboard(){this.currentLayer.canCreateNewEmptyEditor()&&this.currentLayer.addNewEditor()}updateToolbar(t){t.mode!==o(this,cn)&&this._eventBus.dispatch("switchannotationeditormode",{source:this,...t})}updateParams(t,e){if(o(this,mr)){switch(t){case Zt.CREATE:this.currentLayer.addNewEditor(e);return;case Zt.HIGHLIGHT_SHOW_ALL:this._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:{type:"highlight",action:"toggle_visibility"}}}),(o(this,Sp)||g(this,Sp,new Map)).set(t,e),this.showAllEditors("highlight",e);break}if(this.hasSelection)for(let n of o(this,fe))n.updateParams(t,e);else for(let n of o(this,mr))n.updateDefaultParams(t,e)}}showAllEditors(t,e,n=!1){for(let s of o(this,He).values())s.editorType===t&&s.show(e);(o(this,Sp)?.get(Zt.HIGHLIGHT_SHOW_ALL)??!0)!==e&&v(this,At,ea).call(this,[[Zt.HIGHLIGHT_SHOW_ALL,e]])}enableWaiting(t=!1){if(o(this,Ep)!==t){g(this,Ep,t);for(let e of o(this,Re).values())t?e.disableClick():e.enableClick(),e.div.classList.toggle("waiting",t)}}*getEditors(t){for(let e of o(this,He).values())e.pageIndex===t&&(yield e)}getEditor(t){return o(this,He).get(t)}addEditor(t){o(this,He).set(t.id,t)}removeEditor(t){t.div.contains(document.activeElement)&&(o(this,ms)&&clearTimeout(o(this,ms)),g(this,ms,setTimeout(()=>{this.focusMainContainer(),g(this,ms,null)},0))),o(this,He).delete(t.id),t.annotationElementId&&o(this,xo)?.delete(t.annotationElementId),this.unselect(t),(!t.annotationElementId||!o(this,mo).has(t.annotationElementId))&&o(this,si)?.remove(t.id)}addDeletedAnnotationElement(t){o(this,mo).add(t.annotationElementId),this.addChangedExistingAnnotation(t),t.deleted=!0}isDeletedAnnotationElement(t){return o(this,mo).has(t)}removeDeletedAnnotationElement(t){o(this,mo).delete(t.annotationElementId),this.removeChangedExistingAnnotation(t),t.deleted=!1}setActiveEditor(t){o(this,Mi)!==t&&(g(this,Mi,t),t&&v(this,At,ea).call(this,t.propertiesToUpdate))}updateUI(t){o(this,At,iS)===t&&v(this,At,ea).call(this,t.propertiesToUpdate)}updateUIForDefaultProperties(t){v(this,At,ea).call(this,t.defaultPropertiesToUpdate)}toggleSelected(t){if(o(this,fe).has(t)){o(this,fe).delete(t),t.unselect(),v(this,At,ii).call(this,{hasSelectedEditor:this.hasSelection});return}o(this,fe).add(t),t.select(),v(this,At,ea).call(this,t.propertiesToUpdate),v(this,At,ii).call(this,{hasSelectedEditor:!0})}setSelected(t){this.updateToolbar({mode:t.mode,editId:t.uid}),o(this,fo)?.commitOrRemove();for(let e of o(this,fe))e!==t&&e.unselect();o(this,vn)?.destroyPopup(),o(this,fe).clear(),o(this,fe).add(t),t.select(),v(this,At,ea).call(this,t.propertiesToUpdate),v(this,At,ii).call(this,{hasSelectedEditor:!0})}isSelected(t){return o(this,fe).has(t)}get firstSelectedEditor(){return o(this,fe).values().next().value}unselect(t){t.unselect(),o(this,fe).delete(t),v(this,At,ii).call(this,{hasSelectedEditor:this.hasSelection})}get hasSelection(){return o(this,fe).size!==0}get isEnterHandled(){return o(this,fe).size===1&&this.firstSelectedEditor.isEnterHandled}undo(){o(this,pr).undo(),v(this,At,ii).call(this,{hasSomethingToUndo:o(this,pr).hasSomethingToUndo(),hasSomethingToRedo:!0,isEmpty:v(this,At,Df).call(this)}),this._editorUndoBar?.hide()}redo(){o(this,pr).redo(),v(this,At,ii).call(this,{hasSomethingToUndo:!0,hasSomethingToRedo:o(this,pr).hasSomethingToRedo(),isEmpty:v(this,At,Df).call(this)})}addCommands(t){o(this,pr).add(t),v(this,At,ii).call(this,{hasSomethingToUndo:!0,hasSomethingToRedo:!1,isEmpty:v(this,At,Df).call(this)})}cleanUndoStack(t){o(this,pr).cleanType(t)}delete(){this.commitOrRemove();let t=this.currentLayer?.endDrawingSession(!0);if(!this.hasSelection&&!t)return;let e=t?[t]:[...o(this,fe)],n=()=>{this._editorUndoBar?.show(i,e.length===1?e[0].editorType:e.length);for(let s of e)s.remove()},i=()=>{for(let s of e)v(this,At,Jx).call(this,s)};this.addCommands({cmd:n,undo:i,mustExec:!0})}commitOrRemove(){o(this,Mi)?.commitOrRemove()}hasSomethingToControl(){return o(this,Mi)||this.hasSelection}selectAll(){for(let t of o(this,fe))t.commit();v(this,At,tw).call(this,o(this,He).values())}unselectAll(){if(!(o(this,Mi)&&(o(this,Mi).commitOrRemove(),o(this,cn)!==Bt.NONE))&&!o(this,fo)?.commitOrRemove()&&(o(this,vn)?.destroyPopup(),!!this.hasSelection)){for(let t of o(this,fe))t.unselect();o(this,fe).clear(),v(this,At,ii).call(this,{hasSelectedEditor:!1})}}translateSelectedEditors(t,e,n=!1){if(n||this.commitOrRemove(),!this.hasSelection)return;o(this,vo)[0]+=t,o(this,vo)[1]+=e;let[i,s]=o(this,vo),a=[...o(this,fe)],l=1e3;o(this,ys)&&clearTimeout(o(this,ys)),g(this,ys,setTimeout(()=>{g(this,ys,null),o(this,vo)[0]=o(this,vo)[1]=0,this.addCommands({cmd:()=>{for(let c of a)o(this,He).has(c.id)&&(c.translateInPage(i,s),c.translationDone())},undo:()=>{for(let c of a)o(this,He).has(c.id)&&(c.translateInPage(-i,-s),c.translationDone())},mustExec:!1})},l));for(let c of a)c.translateInPage(t,e),c.translationDone()}setUpDragSession(){if(this.hasSelection){this.disableUserSelect(!0),g(this,ps,new Map);for(let t of o(this,fe))o(this,ps).set(t,{savedX:t.x,savedY:t.y,savedPageIndex:t.pageIndex,newX:0,newY:0,newPageIndex:-1})}}endDragSession(){if(!o(this,ps))return!1;this.disableUserSelect(!1);let t=o(this,ps);g(this,ps,null);let e=!1;for(let[{x:i,y:s,pageIndex:a},l]of t)l.newX=i,l.newY=s,l.newPageIndex=a,e||(e=i!==l.savedX||s!==l.savedY||a!==l.savedPageIndex);if(!e)return!1;let n=(i,s,a,l)=>{if(o(this,He).has(i.id)){let c=o(this,Re).get(l);c?i._setParentAndPosition(c,s,a):(i.pageIndex=l,i.x=s,i.y=a)}};return this.addCommands({cmd:()=>{for(let[i,{newX:s,newY:a,newPageIndex:l}]of t)n(i,s,a,l)},undo:()=>{for(let[i,{savedX:s,savedY:a,savedPageIndex:l}]of t)n(i,s,a,l)},mustExec:!0}),!0}dragSelectedEditors(t,e){if(o(this,ps))for(let n of o(this,ps).keys())n.drag(t,e)}rebuild(t){if(t.parent===null){let e=this.getLayer(t.pageIndex);e?(e.changeParent(t),e.addOrRebuild(t)):(this.addEditor(t),this.addToAnnotationStorage(t),t.rebuild())}else t.parent.addOrRebuild(t)}get isEditorHandlingKeyboard(){return this.getActive()?.shouldGetKeyboardEvents()||o(this,fe).size===1&&this.firstSelectedEditor.shouldGetKeyboardEvents()}isActive(t){return o(this,Mi)===t}getActive(){return o(this,Mi)}getMode(){return o(this,cn)}isEditingMode(){return o(this,cn)!==Bt.NONE}get imageManager(){return Ut(this,"imageManager",new Xx)}getSelectionBoxes(t){if(!t)return null;let e=document.getSelection();for(let u=0,h=e.rangeCount;u<h;u++)if(!t.contains(e.getRangeAt(u).commonAncestorContainer))return null;let{x:n,y:i,width:s,height:a}=t.getBoundingClientRect(),l;switch(t.getAttribute("data-main-rotation")){case"90":l=(u,h,d,f)=>({x:(h-i)/a,y:1-(u+d-n)/s,width:f/a,height:d/s});break;case"180":l=(u,h,d,f)=>({x:1-(u+d-n)/s,y:1-(h+f-i)/a,width:d/s,height:f/a});break;case"270":l=(u,h,d,f)=>({x:1-(h+f-i)/a,y:(u-n)/s,width:f/a,height:d/s});break;default:l=(u,h,d,f)=>({x:(u-n)/s,y:(h-i)/a,width:d/s,height:f/a});break}let c=[];for(let u=0,h=e.rangeCount;u<h;u++){let d=e.getRangeAt(u);if(!d.collapsed)for(let{x:f,y:p,width:m,height:y}of d.getClientRects())m===0||y===0||c.push(l(f,p,m,y))}return c.length===0?null:c}addChangedExistingAnnotation({annotationElementId:t,id:e}){(o(this,ch)||g(this,ch,new Map)).set(t,e)}removeChangedExistingAnnotation({annotationElementId:t}){o(this,ch)?.delete(t)}renderAnnotationElement(t){let e=o(this,ch)?.get(t.data.id);if(!e)return;let n=o(this,si).getRawValue(e);n&&(o(this,cn)===Bt.NONE&&!n.hasBeenModified||n.renderAnnotationElement(t))}setMissingCanvas(t,e,n){let i=o(this,xo)?.get(t);i&&(i.setCanvas(e,n),o(this,xo).delete(t))}addMissingCanvas(t,e){(o(this,xo)||g(this,xo,new Map)).set(t,e)}};sh=new WeakMap,Mi=new WeakMap,ah=new WeakMap,He=new WeakMap,Re=new WeakMap,oh=new WeakMap,lh=new WeakMap,si=new WeakMap,ch=new WeakMap,pr=new WeakMap,vn=new WeakMap,ho=new WeakMap,fo=new WeakMap,po=new WeakMap,mo=new WeakMap,ps=new WeakMap,mr=new WeakMap,Ol=new WeakMap,Ap=new WeakMap,vp=new WeakMap,uh=new WeakMap,Cp=new WeakMap,ms=new WeakMap,go=new WeakMap,hh=new WeakMap,yo=new WeakMap,gs=new WeakMap,zy=new WeakMap,aa=new WeakMap,dh=new WeakMap,Ep=new WeakMap,bo=new WeakMap,Fl=new WeakMap,fh=new WeakMap,xo=new WeakMap,Tp=new WeakMap,cn=new WeakMap,fe=new WeakMap,oa=new WeakMap,wo=new WeakMap,Ao=new WeakMap,Sp=new WeakMap,ph=new WeakMap,Dp=new WeakMap,vo=new WeakMap,ys=new WeakMap,la=new WeakMap,Np=new WeakMap,Ip=new WeakMap,gr=new WeakMap,At=new WeakSet,v0=function({anchorNode:t}){return t.nodeType===Node.TEXT_NODE?t.parentElement:t},Zx=function(t){let{currentLayer:e}=this;if(e.hasTextLayer(t))return e;for(let n of o(this,Re).values())if(n.hasTextLayer(t))return n;return null},WT=function(t){this.commitOrRemove(),this.currentLayer?.endDrawingSession(!1)},qT=function(){let t=document.getSelection();if(!t||t.isCollapsed)return;let n=v(this,At,v0).call(this,t).closest(".textLayer"),i=this.getSelectionBoxes(n);i&&(o(this,gs)||g(this,gs,new Wx(this)),o(this,gs).show(n,i,this.direction==="ltr"))},VT=function(){let t=document.getSelection();if(!t||t.isCollapsed){o(this,oa)&&(o(this,gs)?.hide(),g(this,oa,null),v(this,At,ii).call(this,{hasSelectedText:!1}));return}let{anchorNode:e}=t;if(e===o(this,oa))return;let i=v(this,At,v0).call(this,t).closest(".textLayer");if(!i){o(this,oa)&&(o(this,gs)?.hide(),g(this,oa,null),v(this,At,ii).call(this,{hasSelectedText:!1}));return}if(o(this,gs)?.hide(),g(this,oa,e),v(this,At,ii).call(this,{hasSelectedText:!0}),!(o(this,cn)!==Bt.HIGHLIGHT&&o(this,cn)!==Bt.NONE)&&(o(this,cn)===Bt.HIGHLIGHT&&this.showAllEditors("highlight",!0,!0),g(this,yo,this.isShiftKeyDown),!this.isShiftKeyDown)){let s=o(this,cn)===Bt.HIGHLIGHT?v(this,At,Zx).call(this,i):null;if(s?.toggleDrawing(),o(this,dh)){let a=new AbortController,l=this.combinedSignal(a),c=u=>{u.type==="pointerup"&&u.button!==0||(a.abort(),s?.toggleDrawing(!0),u.type==="pointerup"&&v(this,At,Sf).call(this,"main_toolbar"))};window.addEventListener("pointerup",c,{signal:l}),window.addEventListener("blur",c,{signal:l})}else s?.toggleDrawing(!0),v(this,At,Sf).call(this,"main_toolbar")}},Sf=function(t=""){o(this,cn)===Bt.HIGHLIGHT?this.highlightSelection(t):o(this,Ap)&&v(this,At,qT).call(this)},XT=function(){document.addEventListener("selectionchange",v(this,At,VT).bind(this),{signal:this._signal})},YT=function(){if(o(this,go))return;g(this,go,new AbortController);let t=this.combinedSignal(o(this,go));window.addEventListener("focus",this.focus.bind(this),{signal:t}),window.addEventListener("blur",this.blur.bind(this),{signal:t})},KT=function(){o(this,go)?.abort(),g(this,go,null)},Qx=function(){if(o(this,bo))return;g(this,bo,new AbortController);let t=this.combinedSignal(o(this,bo));window.addEventListener("keydown",this.keydown.bind(this),{signal:t}),window.addEventListener("keyup",this.keyup.bind(this),{signal:t})},ZT=function(){o(this,bo)?.abort(),g(this,bo,null)},QT=function(){if(o(this,ho))return;g(this,ho,new AbortController);let t=this.combinedSignal(o(this,ho));document.addEventListener("copy",this.copy.bind(this),{signal:t}),document.addEventListener("cut",this.cut.bind(this),{signal:t}),document.addEventListener("paste",this.paste.bind(this),{signal:t})},JT=function(){o(this,ho)?.abort(),g(this,ho,null)},tS=function(){let t=this._signal;document.addEventListener("dragover",this.dragOver.bind(this),{signal:t}),document.addEventListener("drop",this.drop.bind(this),{signal:t})},ii=function(t){Object.entries(t).some(([n,i])=>o(this,Dp)[n]!==i)&&(this._eventBus.dispatch("editingstateschanged",{source:this,details:Object.assign(o(this,Dp),t)}),o(this,cn)===Bt.HIGHLIGHT&&t.hasSelectedEditor===!1&&v(this,At,ea).call(this,[[Zt.HIGHLIGHT_FREE,!0]]))},ea=function(t){this._eventBus.dispatch("annotationeditorparamschanged",{source:this,details:t})},eS=async function(){if(!o(this,aa)){g(this,aa,!0);let t=[];for(let e of o(this,Re).values())t.push(e.enable());await Promise.all(t);for(let e of o(this,He).values())e.enable()}},nS=function(){if(this.unselectAll(),o(this,aa)){g(this,aa,!1);for(let t of o(this,Re).values())t.disable();for(let t of o(this,He).values())t.disable()}},Jx=function(t){let e=o(this,Re).get(t.pageIndex);e?e.addOrRebuild(t):(this.addEditor(t),this.addToAnnotationStorage(t))},iS=function(){let t=null;for(t of o(this,fe));return t},Df=function(){if(o(this,He).size===0)return!0;if(o(this,He).size===1)for(let t of o(this,He).values())return t.isEmpty();return!1},tw=function(t){for(let e of o(this,fe))e.unselect();o(this,fe).clear();for(let e of t)e.isEmpty()||(o(this,fe).add(e),e.select());v(this,At,ii).call(this,{hasSelectedEditor:this.hasSelection})},U(Zu,"TRANSLATE_SMALL",1),U(Zu,"TRANSLATE_BIG",10);nl=Zu,ri=class ri{constructor(t){A(this,Kr);A(this,Cn,null);A(this,bs,!1);A(this,Rr,null);A(this,mh,null);A(this,xs,null);A(this,Oi,null);A(this,gh,!1);A(this,ws,null);A(this,Ai,null);A(this,ca,null);A(this,Pl,null);A(this,As,!1);g(this,Ai,t),g(this,As,t._uiManager.useNewAltTextFlow),o(ri,Co)||g(ri,Co,Object.freeze({added:"pdfjs-editor-new-alt-text-added-button","added-label":"pdfjs-editor-new-alt-text-added-button-label",missing:"pdfjs-editor-new-alt-text-missing-button","missing-label":"pdfjs-editor-new-alt-text-missing-button-label",review:"pdfjs-editor-new-alt-text-to-review-button","review-label":"pdfjs-editor-new-alt-text-to-review-button-label"}))}static initialize(t){ri._l10n??(ri._l10n=t)}async render(){let t=g(this,Rr,document.createElement("button"));t.className="altText",t.tabIndex="0";let e=g(this,mh,document.createElement("span"));t.append(e),o(this,As)?(t.classList.add("new"),t.setAttribute("data-l10n-id",o(ri,Co).missing),e.setAttribute("data-l10n-id",o(ri,Co)["missing-label"])):(t.setAttribute("data-l10n-id","pdfjs-editor-alt-text-button"),e.setAttribute("data-l10n-id","pdfjs-editor-alt-text-button-label"));let n=o(this,Ai)._uiManager._signal;t.addEventListener("contextmenu",tr,{signal:n}),t.addEventListener("pointerdown",s=>s.stopPropagation(),{signal:n});let i=s=>{s.preventDefault(),o(this,Ai)._uiManager.editAltText(o(this,Ai)),o(this,As)&&o(this,Ai)._reportTelemetry({action:"pdfjs.image.alt_text.image_status_label_clicked",data:{label:o(this,Kr,Nf)}})};return t.addEventListener("click",i,{capture:!0,signal:n}),t.addEventListener("keydown",s=>{s.target===t&&s.key==="Enter"&&(g(this,gh,!0),i(s))},{signal:n}),await v(this,Kr,C0).call(this),t}finish(){o(this,Rr)&&(o(this,Rr).focus({focusVisible:o(this,gh)}),g(this,gh,!1))}isEmpty(){return o(this,As)?o(this,Cn)===null:!o(this,Cn)&&!o(this,bs)}hasData(){return o(this,As)?o(this,Cn)!==null||!!o(this,ca):this.isEmpty()}get guessedText(){return o(this,ca)}async setGuessedText(t){o(this,Cn)===null&&(g(this,ca,t),g(this,Pl,await ri._l10n.get("pdfjs-editor-new-alt-text-generated-alt-text-with-disclaimer",{generatedAltText:t})),v(this,Kr,C0).call(this))}toggleAltTextBadge(t=!1){if(!o(this,As)||o(this,Cn)){o(this,ws)?.remove(),g(this,ws,null);return}if(!o(this,ws)){let e=g(this,ws,document.createElement("div"));e.className="noAltTextBadge",o(this,Ai).div.append(e)}o(this,ws).classList.toggle("hidden",!t)}serialize(t){let e=o(this,Cn);return!t&&o(this,ca)===e&&(e=o(this,Pl)),{altText:e,decorative:o(this,bs),guessedText:o(this,ca),textWithDisclaimer:o(this,Pl)}}get data(){return{altText:o(this,Cn),decorative:o(this,bs)}}set data({altText:t,decorative:e,guessedText:n,textWithDisclaimer:i,cancel:s=!1}){n&&(g(this,ca,n),g(this,Pl,i)),!(o(this,Cn)===t&&o(this,bs)===e)&&(s||(g(this,Cn,t),g(this,bs,e)),v(this,Kr,C0).call(this))}toggle(t=!1){o(this,Rr)&&(!t&&o(this,Oi)&&(clearTimeout(o(this,Oi)),g(this,Oi,null)),o(this,Rr).disabled=!t)}shown(){o(this,Ai)._reportTelemetry({action:"pdfjs.image.alt_text.image_status_label_displayed",data:{label:o(this,Kr,Nf)}})}destroy(){o(this,Rr)?.remove(),g(this,Rr,null),g(this,mh,null),g(this,xs,null),o(this,ws)?.remove(),g(this,ws,null)}};Cn=new WeakMap,bs=new WeakMap,Rr=new WeakMap,mh=new WeakMap,xs=new WeakMap,Oi=new WeakMap,gh=new WeakMap,ws=new WeakMap,Ai=new WeakMap,ca=new WeakMap,Pl=new WeakMap,As=new WeakMap,Co=new WeakMap,Kr=new WeakSet,Nf=function(){return o(this,Cn)&&"added"||o(this,Cn)===null&&this.guessedText&&"review"||"missing"},C0=async function(){let t=o(this,Rr);if(!t)return;if(o(this,As)){if(t.classList.toggle("done",!!o(this,Cn)),t.setAttribute("data-l10n-id",o(ri,Co)[o(this,Kr,Nf)]),o(this,mh)?.setAttribute("data-l10n-id",o(ri,Co)[`${o(this,Kr,Nf)}-label`]),!o(this,Cn)){o(this,xs)?.remove();return}}else{if(!o(this,Cn)&&!o(this,bs)){t.classList.remove("done"),o(this,xs)?.remove();return}t.classList.add("done"),t.setAttribute("data-l10n-id","pdfjs-editor-alt-text-edit-button")}let e=o(this,xs);if(!e){g(this,xs,e=document.createElement("span")),e.className="tooltip",e.setAttribute("role","tooltip"),e.id=`alt-text-tooltip-${o(this,Ai).id}`;let i=100,s=o(this,Ai)._uiManager._signal;s.addEventListener("abort",()=>{clearTimeout(o(this,Oi)),g(this,Oi,null)},{once:!0}),t.addEventListener("mouseenter",()=>{g(this,Oi,setTimeout(()=>{g(this,Oi,null),o(this,xs).classList.add("show"),o(this,Ai)._reportTelemetry({action:"alt_text_tooltip"})},i))},{signal:s}),t.addEventListener("mouseleave",()=>{o(this,Oi)&&(clearTimeout(o(this,Oi)),g(this,Oi,null)),o(this,xs)?.classList.remove("show")},{signal:s})}o(this,bs)?e.setAttribute("data-l10n-id","pdfjs-editor-alt-text-decorative-tooltip"):(e.removeAttribute("data-l10n-id"),e.textContent=o(this,Cn)),e.parentNode||t.append(e),o(this,Ai).getElementForAltText()?.setAttribute("aria-describedby",e.id)},A(ri,Co,null),U(ri,"_l10n",null);uy=ri,Yu=class{constructor(t){A(this,_p);A(this,Ln,null);A(this,yr,null);A(this,Rl,!1);A(this,Te,null);A(this,kp,null);A(this,Eo,null);A(this,br,null);A(this,To,null);A(this,So,!1);A(this,Ll,null);g(this,Te,t)}renderForToolbar(){let t=g(this,yr,document.createElement("button"));return t.className="comment",v(this,_p,ew).call(this,t,!1)}renderForStandalone(){let t=g(this,Ln,document.createElement("button"));t.className="annotationCommentButton";let e=o(this,Te).commentButtonPosition;if(e){let{style:n}=t;n.insetInlineEnd=`calc(${100*(o(this,Te)._uiManager.direction==="ltr"?1-e[0]:e[0])}% - var(--comment-button-dim))`,n.top=`calc(${100*e[1]}% - var(--comment-button-dim))`;let i=o(this,Te).commentButtonColor;i&&(n.backgroundColor=i)}return v(this,_p,ew).call(this,t,!0)}focusButton(){setTimeout(()=>{(o(this,Ln)??o(this,yr))?.focus()},0)}onUpdatedColor(){if(!o(this,Ln))return;let t=o(this,Te).commentButtonColor;t&&(o(this,Ln).style.backgroundColor=t),o(this,Te)._uiManager.updatePopupColor(o(this,Te))}get commentButtonWidth(){return(o(this,Ln)?.getBoundingClientRect().width??0)/o(this,Te).parent.boundingClientRect.width}get commentPopupPositionInLayer(){if(o(this,Ll))return o(this,Ll);if(!o(this,Ln))return null;let{x:t,y:e,height:n}=o(this,Ln).getBoundingClientRect(),{x:i,y:s,width:a,height:l}=o(this,Te).parent.boundingClientRect;return[(t-i)/a,(e+n-s)/l]}set commentPopupPositionInLayer(t){g(this,Ll,t)}hasDefaultPopupPosition(){return o(this,Ll)===null}removeStandaloneCommentButton(){o(this,Ln)?.remove(),g(this,Ln,null)}removeToolbarCommentButton(){o(this,yr)?.remove(),g(this,yr,null)}setCommentButtonStates({selected:t,hasPopup:e}){o(this,Ln)&&(o(this,Ln).classList.toggle("selected",t),o(this,Ln).ariaExpanded=e)}edit(t){let e=this.commentPopupPositionInLayer,n,i;if(e)[n,i]=e;else{[n,i]=o(this,Te).commentButtonPosition;let{width:h,height:d,x:f,y:p}=o(this,Te);n=f+n*h,i=p+i*d}let s=o(this,Te).parent.boundingClientRect,{x:a,y:l,width:c,height:u}=s;o(this,Te)._uiManager.editComment(o(this,Te),a+n*c,l+i*u,{...t,parentDimensions:s})}finish(){o(this,yr)&&(o(this,yr).focus({focusVisible:o(this,Rl)}),g(this,Rl,!1))}isDeleted(){return o(this,So)||o(this,br)===""}isEmpty(){return o(this,br)===null}hasBeenEdited(){return this.isDeleted()||o(this,br)!==o(this,kp)}serialize(){return this.data}get data(){return{text:o(this,br),richText:o(this,Eo),date:o(this,To),deleted:this.isDeleted()}}set data(t){if(t!==o(this,br)&&g(this,Eo,null),t===null){g(this,br,""),g(this,So,!0);return}g(this,br,t),g(this,To,new Date),g(this,So,!1)}restoreData({text:t,richText:e,date:n}){g(this,br,t),g(this,Eo,e),g(this,To,n),g(this,So,!1)}setInitialText(t,e=null){g(this,kp,t),this.data=t,g(this,To,null),g(this,Eo,e)}shown(){}destroy(){o(this,yr)?.remove(),g(this,yr,null),o(this,Ln)?.remove(),g(this,Ln,null),g(this,br,""),g(this,Eo,null),g(this,To,null),g(this,Te,null),g(this,Rl,!1),g(this,So,!1)}};Ln=new WeakMap,yr=new WeakMap,Rl=new WeakMap,Te=new WeakMap,kp=new WeakMap,Eo=new WeakMap,br=new WeakMap,To=new WeakMap,So=new WeakMap,Ll=new WeakMap,_p=new WeakSet,ew=function(t,e){if(!o(this,Te)._uiManager.hasCommentManager())return null;t.tabIndex="0",t.ariaHasPopup="dialog",e?(t.ariaControls="commentPopup",t.setAttribute("data-l10n-id","pdfjs-show-comment-button")):(t.ariaControlsElements=[o(this,Te)._uiManager.getCommentDialogElement()],t.setAttribute("data-l10n-id","pdfjs-editor-add-comment-button"));let n=o(this,Te)._uiManager._signal;if(!(n instanceof AbortSignal)||n.aborted)return t;t.addEventListener("contextmenu",tr,{signal:n}),e&&(t.addEventListener("focusin",s=>{o(this,Te)._focusEventsAllowed=!1,Be(s)},{capture:!0,signal:n}),t.addEventListener("focusout",s=>{o(this,Te)._focusEventsAllowed=!0,Be(s)},{capture:!0,signal:n})),t.addEventListener("pointerdown",s=>s.stopPropagation(),{signal:n});let i=s=>{s.preventDefault(),t===o(this,yr)?this.edit():o(this,Te).toggleComment(!0)};return t.addEventListener("click",i,{capture:!0,signal:n}),t.addEventListener("keydown",s=>{s.target===t&&s.key==="Enter"&&(g(this,Rl,!0),i(s))},{signal:n}),t.addEventListener("pointerenter",()=>{o(this,Te).toggleComment(!1,!0)},{signal:n}),t.addEventListener("pointerleave",()=>{o(this,Te).toggleComment(!1,!1)},{signal:n}),t};v2=class v2{constructor({container:t,isPinchingDisabled:e=null,isPinchingStopped:n=null,onPinchStart:i=null,onPinching:s=null,onPinchEnd:a=null,signal:l}){A(this,il);A(this,yh);A(this,Bl,!1);A(this,Mp,null);A(this,Op);A(this,Fp);A(this,Pp);A(this,Rp);A(this,ua,null);A(this,Ul);A(this,ha,null);A(this,$l);A(this,da,null);g(this,yh,t),g(this,Mp,n),g(this,Op,e),g(this,Fp,i),g(this,Pp,s),g(this,Rp,a),g(this,$l,new AbortController),g(this,Ul,AbortSignal.any([l,o(this,$l).signal])),t.addEventListener("touchstart",v(this,il,rS).bind(this),{passive:!1,signal:o(this,Ul)})}get MIN_TOUCH_DISTANCE_TO_PINCH(){return 35/Ls.pixelRatio}destroy(){o(this,$l)?.abort(),g(this,$l,null),o(this,ua)?.abort(),g(this,ua,null)}};yh=new WeakMap,Bl=new WeakMap,Mp=new WeakMap,Op=new WeakMap,Fp=new WeakMap,Pp=new WeakMap,Rp=new WeakMap,ua=new WeakMap,Ul=new WeakMap,ha=new WeakMap,$l=new WeakMap,da=new WeakMap,il=new WeakSet,rS=function(t){var i,s,a;if((i=o(this,Op))!=null&&i.call(this))return;if(t.touches.length===1){if(o(this,ua))return;let l=g(this,ua,new AbortController),c=AbortSignal.any([o(this,Ul),l.signal]),u=o(this,yh),h={capture:!0,signal:c,passive:!1},d=f=>{f.pointerType==="touch"&&(o(this,ua)?.abort(),g(this,ua,null))};u.addEventListener("pointerdown",f=>{f.pointerType==="touch"&&(Be(f),d(f))},h),u.addEventListener("pointerup",d,h),u.addEventListener("pointercancel",d,h);return}if(!o(this,da)){g(this,da,new AbortController);let l=AbortSignal.any([o(this,Ul),o(this,da).signal]),c=o(this,yh),u={signal:l,capture:!1,passive:!1};c.addEventListener("touchmove",v(this,il,sS).bind(this),u);let h=v(this,il,aS).bind(this);c.addEventListener("touchend",h,u),c.addEventListener("touchcancel",h,u),u.capture=!0,c.addEventListener("pointerdown",Be,u),c.addEventListener("pointermove",Be,u),c.addEventListener("pointercancel",Be,u),c.addEventListener("pointerup",Be,u),(s=o(this,Fp))==null||s.call(this)}if(Be(t),t.touches.length!==2||(a=o(this,Mp))!=null&&a.call(this)){g(this,ha,null);return}let[e,n]=t.touches;e.identifier>n.identifier&&([e,n]=[n,e]),g(this,ha,{touch0X:e.screenX,touch0Y:e.screenY,touch1X:n.screenX,touch1Y:n.screenY})},sS=function(t){var E;if(!o(this,ha)||t.touches.length!==2)return;Be(t);let[e,n]=t.touches;e.identifier>n.identifier&&([e,n]=[n,e]);let{screenX:i,screenY:s}=e,{screenX:a,screenY:l}=n,c=o(this,ha),{touch0X:u,touch0Y:h,touch1X:d,touch1Y:f}=c,p=d-u,m=f-h,y=a-i,x=l-s,b=Math.hypot(y,x)||1,w=Math.hypot(p,m)||1;if(!o(this,Bl)&&Math.abs(w-b)<=v2.MIN_TOUCH_DISTANCE_TO_PINCH)return;if(c.touch0X=i,c.touch0Y=s,c.touch1X=a,c.touch1Y=l,!o(this,Bl)){g(this,Bl,!0);return}let C=[(i+a)/2,(s+l)/2];(E=o(this,Pp))==null||E.call(this,C,w,b)},aS=function(t){var e;t.touches.length>=2||(o(this,da)&&(o(this,da).abort(),g(this,da,null),(e=o(this,Rp))==null||e.call(this)),o(this,ha)&&(Be(t),g(this,ha,null),g(this,Bl,!1)))};ip=v2,zt=class zt{constructor(t){A(this,Rt);A(this,zl,null);A(this,Lr,null);A(this,ke,null);A(this,pe,null);A(this,fa,null);A(this,bh,!1);A(this,Do,null);A(this,Lp,"");A(this,Bn,null);A(this,jl,null);A(this,pa,null);A(this,xr,null);A(this,No,null);A(this,Bp,"");A(this,Gl,!1);A(this,Fi,null);A(this,Up,!1);A(this,Hl,!1);A(this,ma,!1);A(this,vs,null);A(this,xh,0);A(this,wh,0);A(this,wr,null);A(this,Wl,null);U(this,"isSelected",!1);U(this,"_isCopy",!1);U(this,"_editToolbar",null);U(this,"_initialOptions",Object.create(null));U(this,"_initialData",null);U(this,"_isVisible",!0);U(this,"_uiManager",null);U(this,"_focusEventsAllowed",!0);A(this,$p,!1);A(this,jy,zt._zIndex++);this.parent=t.parent,this.id=t.id,this.width=this.height=null,this.pageIndex=t.parent.pageIndex,this.name=t.name,this.div=null,this._uiManager=t.uiManager,this.annotationElementId=null,this._willKeepAspectRatio=!1,this._initialOptions.isCentered=t.isCentered,this._structTreeParentId=null,this.annotationElementId=t.annotationElementId||null,this.creationDate=t.creationDate||new Date,this.modificationDate=t.modificationDate||null,this.canAddComment=!0;let{rotation:e,rawDims:{pageWidth:n,pageHeight:i,pageX:s,pageY:a}}=this.parent.viewport;this.rotation=e,this.pageRotation=(360+e-this._uiManager.viewParameters.rotation)%360,this.pageDimensions=[n,i],this.pageTranslation=[s,a];let[l,c]=this.parentDimensions;this.x=t.x/l,this.y=t.y/c,this.isAttachedToDOM=!1,this.deleted=!1}static get _resizerKeyboardManager(){let t=zt.prototype._resizeWithKeyboard,e=nl.TRANSLATE_SMALL,n=nl.TRANSLATE_BIG;return Ut(this,"_resizerKeyboardManager",new Kc([[["ArrowLeft","mac+ArrowLeft"],t,{args:[-e,0]}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],t,{args:[-n,0]}],[["ArrowRight","mac+ArrowRight"],t,{args:[e,0]}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],t,{args:[n,0]}],[["ArrowUp","mac+ArrowUp"],t,{args:[0,-e]}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],t,{args:[0,-n]}],[["ArrowDown","mac+ArrowDown"],t,{args:[0,e]}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],t,{args:[0,n]}],[["Escape","mac+Escape"],zt.prototype._stopResizingWithKeyboard]]))}updatePageIndex(t){this.pageIndex=t}get editorType(){return Object.getPrototypeOf(this).constructor._type}get mode(){return Object.getPrototypeOf(this).constructor._editorType}static get isDrawer(){return!1}static get _defaultLineColor(){return Ut(this,"_defaultLineColor",this._colorManager.getHexCode("CanvasText"))}static deleteAnnotationElement(t){let e=new cw({id:t._uiManager.getId(),parent:t.parent,uiManager:t._uiManager});e.annotationElementId=t.annotationElementId,e.deleted=!0,e._uiManager.addToAnnotationStorage(e)}static initialize(t,e){if(zt._l10n??(zt._l10n=t),zt._l10nResizer||(zt._l10nResizer=Object.freeze({topLeft:"pdfjs-editor-resizer-top-left",topMiddle:"pdfjs-editor-resizer-top-middle",topRight:"pdfjs-editor-resizer-top-right",middleRight:"pdfjs-editor-resizer-middle-right",bottomRight:"pdfjs-editor-resizer-bottom-right",bottomMiddle:"pdfjs-editor-resizer-bottom-middle",bottomLeft:"pdfjs-editor-resizer-bottom-left",middleLeft:"pdfjs-editor-resizer-middle-left"})),zt._borderLineWidth!==-1)return;let n=getComputedStyle(document.documentElement);zt._borderLineWidth=parseFloat(n.getPropertyValue("--outline-width"))||0}static updateDefaultParams(t,e){}static get defaultPropertiesToUpdate(){return[]}static isHandlingMimeForPasting(t){return!1}static paste(t,e){ue("Not implemented")}get propertiesToUpdate(){return[]}get _isDraggable(){return o(this,$p)}set _isDraggable(t){g(this,$p,t),this.div?.classList.toggle("draggable",t)}get uid(){return this.annotationElementId||this.id}get isEnterHandled(){return!0}center(){let[t,e]=this.pageDimensions;switch(this.parentRotation){case 90:this.x-=this.height*e/(t*2),this.y+=this.width*t/(e*2);break;case 180:this.x+=this.width/2,this.y+=this.height/2;break;case 270:this.x+=this.height*e/(t*2),this.y-=this.width*t/(e*2);break;default:this.x-=this.width/2,this.y-=this.height/2;break}this.fixAndSetPosition()}addCommands(t){this._uiManager.addCommands(t)}get currentLayer(){return this._uiManager.currentLayer}setInBackground(){this.div.style.zIndex=0}setInForeground(){this.div.style.zIndex=o(this,jy)}setParent(t){t!==null?(this.pageIndex=t.pageIndex,this.pageDimensions=t.pageDimensions):(v(this,Rt,If).call(this),o(this,xr)?.remove(),g(this,xr,null)),this.parent=t}focusin(t){this._focusEventsAllowed&&(o(this,Gl)?g(this,Gl,!1):this.parent.setSelected(this))}focusout(t){!this._focusEventsAllowed||!this.isAttachedToDOM||t.relatedTarget?.closest(`#${this.id}`)||(t.preventDefault(),this.parent?.isMultipleSelection||this.commitOrRemove())}commitOrRemove(){this.isEmpty()?this.remove():this.commit()}commit(){this.isInEditMode()&&this.addToAnnotationStorage()}addToAnnotationStorage(){this._uiManager.addToAnnotationStorage(this)}setAt(t,e,n,i){let[s,a]=this.parentDimensions;[n,i]=this.screenToPageTranslation(n,i),this.x=(t+n)/s,this.y=(e+i)/a,this.fixAndSetPosition()}_moveAfterPaste(t,e){if(this.isClone){delete this.isClone;return}let[n,i]=this.parentDimensions;this.setAt(t*n,e*i,this.width*n,this.height*i),this._onTranslated()}translate(t,e){v(this,Rt,nw).call(this,this.parentDimensions,t,e)}translateInPage(t,e){o(this,Fi)||g(this,Fi,[this.x,this.y,this.width,this.height]),v(this,Rt,nw).call(this,this.pageDimensions,t,e),this.div.scrollIntoView({block:"nearest"})}translationDone(){this._onTranslated(this.x,this.y)}drag(t,e){o(this,Fi)||g(this,Fi,[this.x,this.y,this.width,this.height]);let{div:n,parentDimensions:[i,s]}=this;if(this.x+=t/i,this.y+=e/s,this.parent&&(this.x<0||this.x>1||this.y<0||this.y>1)){let{x:d,y:f}=this.div.getBoundingClientRect();this.parent.findNewParent(this,d,f)&&(this.x-=Math.floor(this.x),this.y-=Math.floor(this.y))}let{x:a,y:l}=this,[c,u]=this.getBaseTranslation();a+=c,l+=u;let{style:h}=n;h.left=`${(100*a).toFixed(2)}%`,h.top=`${(100*l).toFixed(2)}%`,this._onTranslating(a,l),n.scrollIntoView({block:"nearest"})}_onTranslating(t,e){}_onTranslated(t,e){}get _hasBeenMoved(){return!!o(this,Fi)&&(o(this,Fi)[0]!==this.x||o(this,Fi)[1]!==this.y)}get _hasBeenResized(){return!!o(this,Fi)&&(o(this,Fi)[2]!==this.width||o(this,Fi)[3]!==this.height)}getBaseTranslation(){let[t,e]=this.parentDimensions,{_borderLineWidth:n}=zt,i=n/t,s=n/e;switch(this.rotation){case 90:return[-i,s];case 180:return[i,s];case 270:return[i,-s];default:return[-i,-s]}}get _mustFixPosition(){return!0}fixAndSetPosition(t=this.rotation){let{div:{style:e},pageDimensions:[n,i]}=this,{x:s,y:a,width:l,height:c}=this;if(l*=n,c*=i,s*=n,a*=i,this._mustFixPosition)switch(t){case 0:s=yn(s,0,n-l),a=yn(a,0,i-c);break;case 90:s=yn(s,0,n-c),a=yn(a,l,i);break;case 180:s=yn(s,l,n),a=yn(a,c,i);break;case 270:s=yn(s,c,n),a=yn(a,0,i-l);break}this.x=s/=n,this.y=a/=i;let[u,h]=this.getBaseTranslation();s+=u,a+=h,e.left=`${(100*s).toFixed(2)}%`,e.top=`${(100*a).toFixed(2)}%`,this.moveInDOM()}screenToPageTranslation(t,e){var n;return v(n=zt,zp,iw).call(n,t,e,this.parentRotation)}pageTranslationToScreen(t,e){var n;return v(n=zt,zp,iw).call(n,t,e,360-this.parentRotation)}get parentScale(){return this._uiManager.viewParameters.realScale}get parentRotation(){return(this._uiManager.viewParameters.rotation+this.pageRotation)%360}get parentDimensions(){let{parentScale:t,pageDimensions:[e,n]}=this;return[e*t,n*t]}setDims(){let{div:{style:t},width:e,height:n}=this;t.width=`${(100*e).toFixed(2)}%`,t.height=`${(100*n).toFixed(2)}%`}getInitialTranslation(){return[0,0]}_onResized(){}static _round(t){return Math.round(t*1e4)/1e4}_onResizing(){}altTextFinish(){o(this,ke)?.finish()}get toolbarButtons(){return null}async addEditToolbar(){if(this._editToolbar||o(this,Hl))return this._editToolbar;this._editToolbar=new Hx(this),this.div.append(this._editToolbar.render());let{toolbarButtons:t}=this;if(t)for(let[e,n]of t)await this._editToolbar.addButton(e,n);return this.hasComment||this._editToolbar.addButton("comment",this.addCommentButton()),this._editToolbar.addButton("delete"),this._editToolbar}addCommentButtonInToolbar(){this._editToolbar?.addButtonBefore("comment",this.addCommentButton(),".deleteButton")}removeCommentButtonFromToolbar(){this._editToolbar?.removeButton("comment")}removeEditToolbar(){this._editToolbar?.remove(),this._editToolbar=null,o(this,ke)?.destroy()}addContainer(t){let e=this._editToolbar?.div;e?e.before(t):this.div.append(t)}getClientDimensions(){return this.div.getBoundingClientRect()}createAltText(){return o(this,ke)||(uy.initialize(zt._l10n),g(this,ke,new uy(this)),o(this,zl)&&(o(this,ke).data=o(this,zl),g(this,zl,null))),o(this,ke)}get altTextData(){return o(this,ke)?.data}set altTextData(t){o(this,ke)&&(o(this,ke).data=t)}get guessedAltText(){return o(this,ke)?.guessedText}async setGuessedAltText(t){await o(this,ke)?.setGuessedText(t)}serializeAltText(t){return o(this,ke)?.serialize(t)}hasAltText(){return!!o(this,ke)&&!o(this,ke).isEmpty()}hasAltTextData(){return o(this,ke)?.hasData()??!1}focusCommentButton(){o(this,pe)?.focusButton()}addCommentButton(){return this.canAddComment?o(this,pe)||g(this,pe,new Yu(this)):null}addStandaloneCommentButton(){if(this._uiManager.hasCommentManager()){if(o(this,fa)){this._uiManager.isEditingMode()&&o(this,fa).classList.remove("hidden");return}this.hasComment&&(g(this,fa,o(this,pe).renderForStandalone()),this.div.append(o(this,fa)))}}removeStandaloneCommentButton(){o(this,pe).removeStandaloneCommentButton(),g(this,fa,null)}hideStandaloneCommentButton(){o(this,fa)?.classList.add("hidden")}get comment(){if(!o(this,pe))return null;let{data:{richText:t,text:e,date:n,deleted:i}}=o(this,pe);return{text:e,richText:t,date:n,deleted:i,color:this.getNonHCMColor(),opacity:this.opacity??1}}set comment(t){o(this,pe)||g(this,pe,new Yu(this)),typeof t=="object"&&t!==null?o(this,pe).restoreData(t):o(this,pe).data=t,this.hasComment?(this.removeCommentButtonFromToolbar(),this.addStandaloneCommentButton(),this._uiManager.updateComment(this)):(this.addCommentButtonInToolbar(),this.removeStandaloneCommentButton(),this._uiManager.removeComment(this))}setCommentData({comment:t,popupRef:e,richText:n}){if(!e||(o(this,pe)||g(this,pe,new Yu(this)),o(this,pe).setInitialText(t,n),!this.annotationElementId))return;let i=this._uiManager.getAndRemoveDataFromAnnotationStorage(this.annotationElementId);i&&this.updateFromAnnotationLayer(i)}get hasEditedComment(){return o(this,pe)?.hasBeenEdited()}get hasDeletedComment(){return o(this,pe)?.isDeleted()}get hasComment(){return!!o(this,pe)&&!o(this,pe).isEmpty()&&!o(this,pe).isDeleted()}async editComment(t){o(this,pe)||g(this,pe,new Yu(this)),o(this,pe).edit(t)}toggleComment(t,e=void 0){this.hasComment&&this._uiManager.toggleComment(this,t,e)}setSelectedCommentButton(t){o(this,pe).setSelectedButton(t)}addComment(t){if(this.hasEditedComment){let[,,,i]=t.rect,[s]=this.pageDimensions,[a]=this.pageTranslation,l=a+s+1,c=i-100,u=l+180;t.popup={contents:this.comment.text,deleted:this.comment.deleted,rect:[l,c,u,i]}}}updateFromAnnotationLayer({popup:{contents:t,deleted:e}}){o(this,pe).data=e?null:t}get parentBoundingClientRect(){return this.parent.boundingClientRect}render(){let t=this.div=document.createElement("div");t.setAttribute("data-editor-rotation",(360-this.rotation)%360),t.className=this.name,t.setAttribute("id",this.id),t.tabIndex=o(this,bh)?-1:0,t.setAttribute("role","application"),this.defaultL10nId&&t.setAttribute("data-l10n-id",this.defaultL10nId),this._isVisible||t.classList.add("hidden"),this.setInForeground(),v(this,Rt,ow).call(this);let[e,n]=this.parentDimensions;this.parentRotation%180!==0&&(t.style.maxWidth=`${(100*n/e).toFixed(2)}%`,t.style.maxHeight=`${(100*e/n).toFixed(2)}%`);let[i,s]=this.getInitialTranslation();return this.translate(i,s),GT(this,t,["keydown","pointerdown","dblclick"]),this.isResizable&&this._uiManager._supportsPinchToZoom&&(o(this,Wl)||g(this,Wl,new ip({container:t,isPinchingDisabled:()=>!this.isSelected,onPinchStart:v(this,Rt,cS).bind(this),onPinching:v(this,Rt,uS).bind(this),onPinchEnd:v(this,Rt,hS).bind(this),signal:this._uiManager._signal}))),this.addStandaloneCommentButton(),this._uiManager._editorUndoBar?.hide(),t}pointerdown(t){let{isMac:e}=Xe.platform;if(t.button!==0||t.ctrlKey&&e){t.preventDefault();return}if(g(this,Gl,!0),this._isDraggable){v(this,Rt,dS).call(this,t);return}v(this,Rt,aw).call(this,t)}_onStartDragging(){}_onStopDragging(){}moveInDOM(){o(this,vs)&&clearTimeout(o(this,vs)),g(this,vs,setTimeout(()=>{g(this,vs,null),this.parent?.moveEditorInDOM(this)},0))}_setParentAndPosition(t,e,n){t.changeParent(this),this.x=e,this.y=n,this.fixAndSetPosition(),this._onTranslated()}getRect(t,e,n=this.rotation){let i=this.parentScale,[s,a]=this.pageDimensions,[l,c]=this.pageTranslation,u=t/i,h=e/i,d=this.x*s,f=this.y*a,p=this.width*s,m=this.height*a;switch(n){case 0:return[d+u+l,a-f-h-m+c,d+u+p+l,a-f-h+c];case 90:return[d+h+l,a-f+u+c,d+h+m+l,a-f+u+p+c];case 180:return[d-u-p+l,a-f+h+c,d-u+l,a-f+h+m+c];case 270:return[d-h-m+l,a-f-u-p+c,d-h+l,a-f-u+c];default:throw new Error("Invalid rotation")}}getRectInCurrentCoords(t,e){let[n,i,s,a]=t,l=s-n,c=a-i;switch(this.rotation){case 0:return[n,e-a,l,c];case 90:return[n,e-i,c,l];case 180:return[s,e-i,l,c];case 270:return[s,e-a,c,l];default:throw new Error("Invalid rotation")}}getPDFRect(){return this.getRect(0,0)}getNonHCMColor(){return this.color&&zt._colorManager.convert(this._uiManager.getNonHCMColor(this.color))}onUpdatedColor(){o(this,pe)?.onUpdatedColor()}getData(){let{comment:{text:t,color:e,date:n,opacity:i,deleted:s,richText:a},uid:l,pageIndex:c,creationDate:u,modificationDate:h}=this;return{id:l,pageIndex:c,rect:this.getPDFRect(),richText:a,contentsObj:{str:t},creationDate:u,modificationDate:n||h,popupRef:!s,color:e,opacity:i}}onceAdded(t){}isEmpty(){return!1}enableEditMode(){return this.isInEditMode()?!1:(this.parent.setEditingState(!1),g(this,Hl,!0),!0)}disableEditMode(){return this.isInEditMode()?(this.parent.setEditingState(!0),g(this,Hl,!1),!0):!1}isInEditMode(){return o(this,Hl)}shouldGetKeyboardEvents(){return o(this,ma)}needsToBeRebuilt(){return this.div&&!this.isAttachedToDOM}get isOnScreen(){let{top:t,left:e,bottom:n,right:i}=this.getClientDimensions(),{innerHeight:s,innerWidth:a}=window;return e<a&&i>0&&t<s&&n>0}rebuild(){v(this,Rt,ow).call(this)}rotate(t){}resize(){}serializeDeleted(){return{id:this.annotationElementId,deleted:!0,pageIndex:this.pageIndex,popupRef:this._initialData?.popupRef||""}}serialize(t=!1,e=null){return{annotationType:this.mode,pageIndex:this.pageIndex,rect:this.getPDFRect(),rotation:this.rotation,structTreeParentId:this._structTreeParentId,popupRef:this._initialData?.popupRef||""}}static async deserialize(t,e,n){let i=new this.prototype.constructor({parent:e,id:n.getId(),uiManager:n,annotationElementId:t.annotationElementId,creationDate:t.creationDate,modificationDate:t.modificationDate});i.rotation=t.rotation,g(i,zl,t.accessibilityData),i._isCopy=t.isCopy||!1;let[s,a]=i.pageDimensions,[l,c,u,h]=i.getRectInCurrentCoords(t.rect,a);return i.x=l/s,i.y=c/a,i.width=u/s,i.height=h/a,i}get hasBeenModified(){return!!this.annotationElementId&&(this.deleted||this.serialize()!==null)}remove(){if(o(this,No)?.abort(),g(this,No,null),this.isEmpty()||this.commit(),this.parent?this.parent.remove(this):this._uiManager.removeEditor(this),this.hideCommentPopup(),o(this,vs)&&(clearTimeout(o(this,vs)),g(this,vs,null)),v(this,Rt,If).call(this),this.removeEditToolbar(),o(this,wr)){for(let t of o(this,wr).values())clearTimeout(t);g(this,wr,null)}this.parent=null,o(this,Wl)?.destroy(),g(this,Wl,null),o(this,xr)?.remove(),g(this,xr,null)}get isResizable(){return!1}makeResizable(){this.isResizable&&(v(this,Rt,oS).call(this),o(this,Bn).classList.remove("hidden"))}get toolbarPosition(){return null}get commentButtonPosition(){return this._uiManager.direction==="ltr"?[1,0]:[0,0]}get commentButtonPositionInPage(){let{commentButtonPosition:[t,e]}=this,[n,i,s,a]=this.getPDFRect();return[zt._round(n+(s-n)*t),zt._round(i+(a-i)*(1-e))]}get commentButtonColor(){return this._uiManager.makeCommentColor(this.getNonHCMColor(),this.opacity)}get commentPopupPosition(){return o(this,pe).commentPopupPositionInLayer}set commentPopupPosition(t){o(this,pe).commentPopupPositionInLayer=t}hasDefaultPopupPosition(){return o(this,pe).hasDefaultPopupPosition()}get commentButtonWidth(){return o(this,pe).commentButtonWidth}get elementBeforePopup(){return this.div}setCommentButtonStates(t){o(this,pe)?.setCommentButtonStates(t)}keydown(t){if(!this.isResizable||t.target!==this.div||t.key!=="Enter")return;this._uiManager.setSelected(this),g(this,pa,{savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height});let e=o(this,Bn).children;if(!o(this,Lr)){g(this,Lr,Array.from(e));let a=v(this,Rt,fS).bind(this),l=v(this,Rt,pS).bind(this),c=this._uiManager._signal;for(let u of o(this,Lr)){let h=u.getAttribute("data-resizer-name");u.setAttribute("role","spinbutton"),u.addEventListener("keydown",a,{signal:c}),u.addEventListener("blur",l,{signal:c}),u.addEventListener("focus",v(this,Rt,mS).bind(this,h),{signal:c}),u.setAttribute("data-l10n-id",zt._l10nResizer[h])}}let n=o(this,Lr)[0],i=0;for(let a of e){if(a===n)break;i++}let s=(360-this.rotation+this.parentRotation)%360/90*(o(this,Lr).length/4);if(s!==i){if(s<i)for(let l=0;l<i-s;l++)o(this,Bn).append(o(this,Bn).firstElementChild);else if(s>i)for(let l=0;l<s-i;l++)o(this,Bn).firstElementChild.before(o(this,Bn).lastElementChild);let a=0;for(let l of e){let u=o(this,Lr)[a++].getAttribute("data-resizer-name");l.setAttribute("data-l10n-id",zt._l10nResizer[u])}}v(this,Rt,lw).call(this,0),g(this,ma,!0),o(this,Bn).firstElementChild.focus({focusVisible:!0}),t.preventDefault(),t.stopImmediatePropagation()}_resizeWithKeyboard(t,e){o(this,ma)&&v(this,Rt,sw).call(this,o(this,Bp),{deltaX:t,deltaY:e,fromKeyboard:!0})}_stopResizingWithKeyboard(){v(this,Rt,If).call(this),this.div.focus()}select(){if(this.isSelected&&this._editToolbar){this._editToolbar.show();return}if(this.isSelected=!0,this.makeResizable(),this.div?.classList.add("selectedEditor"),!this._editToolbar){this.addEditToolbar().then(()=>{this.div?.classList.contains("selectedEditor")&&this._editToolbar?.show()});return}this._editToolbar?.show(),o(this,ke)?.toggleAltTextBadge(!1)}focus(){this.div&&!this.div.contains(document.activeElement)&&setTimeout(()=>this.div?.focus({preventScroll:!0}),0)}unselect(){this.isSelected&&(this.isSelected=!1,o(this,Bn)?.classList.add("hidden"),this.div?.classList.remove("selectedEditor"),this.div?.contains(document.activeElement)&&this._uiManager.currentLayer.div.focus({preventScroll:!0}),this._editToolbar?.hide(),o(this,ke)?.toggleAltTextBadge(!0),this.hideCommentPopup())}hideCommentPopup(){this.hasComment&&this._uiManager.toggleComment(null)}updateParams(t,e){}disableEditing(){}enableEditing(){}get canChangeContent(){return!1}enterInEditMode(){this.canChangeContent&&(this.enableEditMode(),this.div.focus())}dblclick(t){t.target.nodeName!=="BUTTON"&&(this.enterInEditMode(),this.parent.updateToolbar({mode:this.constructor._editorType,editId:this.uid}))}getElementForAltText(){return this.div}get contentDiv(){return this.div}get isEditing(){return o(this,Up)}set isEditing(t){g(this,Up,t),this.parent&&(t?(this.parent.setSelected(this),this.parent.setActiveEditor(this)):this.parent.setActiveEditor(null))}static get MIN_SIZE(){return 16}static canCreateNewEmptyEditor(){return!0}get telemetryInitialData(){return{action:"added"}}get telemetryFinalData(){return null}_reportTelemetry(t,e=!1){if(e){o(this,wr)||g(this,wr,new Map);let{action:n}=t,i=o(this,wr).get(n);i&&clearTimeout(i),i=setTimeout(()=>{this._reportTelemetry(t),o(this,wr).delete(n),o(this,wr).size===0&&g(this,wr,null)},zt._telemetryTimeout),o(this,wr).set(n,i);return}t.type||(t.type=this.editorType),this._uiManager._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:t}})}show(t=this._isVisible){this.div.classList.toggle("hidden",!t),this._isVisible=t}enable(){this.div&&(this.div.tabIndex=0),g(this,bh,!1)}disable(){this.div&&(this.div.tabIndex=-1),g(this,bh,!0)}updateFakeAnnotationElement(t){if(!o(this,xr)&&!this.deleted){g(this,xr,t.addFakeAnnotation(this));return}if(this.deleted){o(this,xr).remove(),g(this,xr,null);return}(this.hasEditedComment||this._hasBeenMoved||this._hasBeenResized)&&o(this,xr).updateEdited({rect:this.getPDFRect(),popup:this.comment})}renderAnnotationElement(t){if(this.deleted)return t.hide(),null;let e=t.container.querySelector(".annotationContent");if(!e)e=document.createElement("div"),e.classList.add("annotationContent",this.editorType),t.container.prepend(e);else if(e.nodeName==="CANVAS"){let n=e;e=document.createElement("div"),e.classList.add("annotationContent",this.editorType),n.before(e)}return e}resetAnnotationElement(t){let{firstElementChild:e}=t.container;e?.nodeName==="DIV"&&e.classList.contains("annotationContent")&&e.remove()}};zl=new WeakMap,Lr=new WeakMap,ke=new WeakMap,pe=new WeakMap,fa=new WeakMap,bh=new WeakMap,Do=new WeakMap,Lp=new WeakMap,Bn=new WeakMap,jl=new WeakMap,pa=new WeakMap,xr=new WeakMap,No=new WeakMap,Bp=new WeakMap,Gl=new WeakMap,Fi=new WeakMap,Up=new WeakMap,Hl=new WeakMap,ma=new WeakMap,vs=new WeakMap,xh=new WeakMap,wh=new WeakMap,wr=new WeakMap,Wl=new WeakMap,$p=new WeakMap,jy=new WeakMap,Rt=new WeakSet,nw=function([t,e],n,i){[n,i]=this.screenToPageTranslation(n,i),this.x+=n/t,this.y+=i/e,this._onTranslating(this.x,this.y),this.fixAndSetPosition()},zp=new WeakSet,iw=function(t,e,n){switch(n){case 90:return[e,-t];case 180:return[-t,-e];case 270:return[-e,t];default:return[t,e]}},E0=function(t){switch(t){case 90:{let[e,n]=this.pageDimensions;return[0,-e/n,n/e,0]}case 180:return[-1,0,0,-1];case 270:{let[e,n]=this.pageDimensions;return[0,e/n,-n/e,0]}default:return[1,0,0,1]}},oS=function(){if(o(this,Bn))return;g(this,Bn,document.createElement("div")),o(this,Bn).classList.add("resizers");let t=this._willKeepAspectRatio?["topLeft","topRight","bottomRight","bottomLeft"]:["topLeft","topMiddle","topRight","middleRight","bottomRight","bottomMiddle","bottomLeft","middleLeft"],e=this._uiManager._signal;for(let n of t){let i=document.createElement("div");o(this,Bn).append(i),i.classList.add("resizer",n),i.setAttribute("data-resizer-name",n),i.addEventListener("pointerdown",v(this,Rt,lS).bind(this,n),{signal:e}),i.addEventListener("contextmenu",tr,{signal:e}),i.tabIndex=-1}this.div.prepend(o(this,Bn))},lS=function(t,e){e.preventDefault();let{isMac:n}=Xe.platform;if(e.button!==0||e.ctrlKey&&n)return;o(this,ke)?.toggle(!1);let i=this._isDraggable;this._isDraggable=!1,g(this,jl,[e.screenX,e.screenY]);let s=new AbortController,a=this._uiManager.combinedSignal(s);this.parent.togglePointerEvents(!1),window.addEventListener("pointermove",v(this,Rt,sw).bind(this,t),{passive:!0,capture:!0,signal:a}),window.addEventListener("touchmove",Be,{passive:!1,signal:a}),window.addEventListener("contextmenu",tr,{signal:a}),g(this,pa,{savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height});let l=this.parent.div.style.cursor,c=this.div.style.cursor;this.div.style.cursor=this.parent.div.style.cursor=window.getComputedStyle(e.target).cursor;let u=()=>{s.abort(),this.parent.togglePointerEvents(!0),o(this,ke)?.toggle(!0),this._isDraggable=i,this.parent.div.style.cursor=l,this.div.style.cursor=c,v(this,Rt,T0).call(this)};window.addEventListener("pointerup",u,{signal:a}),window.addEventListener("blur",u,{signal:a})},rw=function(t,e,n,i){this.width=n,this.height=i,this.x=t,this.y=e,this.setDims(),this.fixAndSetPosition(),this._onResized()},T0=function(){if(!o(this,pa))return;let{savedX:t,savedY:e,savedWidth:n,savedHeight:i}=o(this,pa);g(this,pa,null);let s=this.x,a=this.y,l=this.width,c=this.height;s===t&&a===e&&l===n&&c===i||this.addCommands({cmd:v(this,Rt,rw).bind(this,s,a,l,c),undo:v(this,Rt,rw).bind(this,t,e,n,i),mustExec:!0})},sw=function(t,e){let[n,i]=this.parentDimensions,s=this.x,a=this.y,l=this.width,c=this.height,u=zt.MIN_SIZE/n,h=zt.MIN_SIZE/i,d=v(this,Rt,E0).call(this,this.rotation),f=(X,T)=>[d[0]*X+d[2]*T,d[1]*X+d[3]*T],p=v(this,Rt,E0).call(this,360-this.rotation),m=(X,T)=>[p[0]*X+p[2]*T,p[1]*X+p[3]*T],y,x,b=!1,w=!1;switch(t){case"topLeft":b=!0,y=(X,T)=>[0,0],x=(X,T)=>[X,T];break;case"topMiddle":y=(X,T)=>[X/2,0],x=(X,T)=>[X/2,T];break;case"topRight":b=!0,y=(X,T)=>[X,0],x=(X,T)=>[0,T];break;case"middleRight":w=!0,y=(X,T)=>[X,T/2],x=(X,T)=>[0,T/2];break;case"bottomRight":b=!0,y=(X,T)=>[X,T],x=(X,T)=>[0,0];break;case"bottomMiddle":y=(X,T)=>[X/2,T],x=(X,T)=>[X/2,0];break;case"bottomLeft":b=!0,y=(X,T)=>[0,T],x=(X,T)=>[X,0];break;case"middleLeft":w=!0,y=(X,T)=>[0,T/2],x=(X,T)=>[X,T/2];break}let C=y(l,c),E=x(l,c),S=f(...E),N=zt._round(s+S[0]),k=zt._round(a+S[1]),M=1,R=1,j,$;if(e.fromKeyboard)({deltaX:j,deltaY:$}=e);else{let{screenX:X,screenY:T}=e,[I,_]=o(this,jl);[j,$]=this.screenToPageTranslation(X-I,T-_),o(this,jl)[0]=X,o(this,jl)[1]=T}if([j,$]=m(j/n,$/i),b){let X=Math.hypot(l,c);M=R=Math.max(Math.min(Math.hypot(E[0]-C[0]-j,E[1]-C[1]-$)/X,1/l,1/c),u/l,h/c)}else w?M=yn(Math.abs(E[0]-C[0]-j),u,1)/l:R=yn(Math.abs(E[1]-C[1]-$),h,1)/c;let q=zt._round(l*M),Q=zt._round(c*R);S=f(...x(q,Q));let Z=N-S[0],Y=k-S[1];o(this,Fi)||g(this,Fi,[this.x,this.y,this.width,this.height]),this.width=q,this.height=Q,this.x=Z,this.y=Y,this.setDims(),this.fixAndSetPosition(),this._onResizing()},cS=function(){g(this,pa,{savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height}),o(this,ke)?.toggle(!1),this.parent.togglePointerEvents(!1)},uS=function(t,e,n){let s=.7*(n/e)+1-.7;if(s===1)return;let a=v(this,Rt,E0).call(this,this.rotation),l=(N,k)=>[a[0]*N+a[2]*k,a[1]*N+a[3]*k],[c,u]=this.parentDimensions,h=this.x,d=this.y,f=this.width,p=this.height,m=zt.MIN_SIZE/c,y=zt.MIN_SIZE/u;s=Math.max(Math.min(s,1/f,1/p),m/f,y/p);let x=zt._round(f*s),b=zt._round(p*s);if(x===f&&b===p)return;o(this,Fi)||g(this,Fi,[h,d,f,p]);let w=l(f/2,p/2),C=zt._round(h+w[0]),E=zt._round(d+w[1]),S=l(x/2,b/2);this.x=C-S[0],this.y=E-S[1],this.width=x,this.height=b,this.setDims(),this.fixAndSetPosition(),this._onResizing()},hS=function(){o(this,ke)?.toggle(!0),this.parent.togglePointerEvents(!0),v(this,Rt,T0).call(this)},aw=function(t){let{isMac:e}=Xe.platform;t.ctrlKey&&!e||t.shiftKey||t.metaKey&&e?this.parent.toggleSelected(this):this.parent.setSelected(this)},dS=function(t){let{isSelected:e}=this;this._uiManager.setUpDragSession();let n=!1,i=new AbortController,s=this._uiManager.combinedSignal(i),a={capture:!0,passive:!1,signal:s},l=u=>{i.abort(),g(this,Do,null),g(this,Gl,!1),this._uiManager.endDragSession()||v(this,Rt,aw).call(this,u),n&&this._onStopDragging()};e&&(g(this,xh,t.clientX),g(this,wh,t.clientY),g(this,Do,t.pointerId),g(this,Lp,t.pointerType),window.addEventListener("pointermove",u=>{n||(n=!0,this._uiManager.toggleComment(this,!0,!1),this._onStartDragging());let{clientX:h,clientY:d,pointerId:f}=u;if(f!==o(this,Do)){Be(u);return}let[p,m]=this.screenToPageTranslation(h-o(this,xh),d-o(this,wh));g(this,xh,h),g(this,wh,d),this._uiManager.dragSelectedEditors(p,m)},a),window.addEventListener("touchmove",Be,a),window.addEventListener("pointerdown",u=>{u.pointerType===o(this,Lp)&&(o(this,Wl)||u.isPrimary)&&l(u),Be(u)},a));let c=u=>{if(!o(this,Do)||o(this,Do)===u.pointerId){l(u);return}Be(u)};window.addEventListener("pointerup",c,{signal:s}),window.addEventListener("blur",c,{signal:s})},ow=function(){if(o(this,No)||!this.div)return;g(this,No,new AbortController);let t=this._uiManager.combinedSignal(o(this,No));this.div.addEventListener("focusin",this.focusin.bind(this),{signal:t}),this.div.addEventListener("focusout",this.focusout.bind(this),{signal:t})},fS=function(t){zt._resizerKeyboardManager.exec(this,t)},pS=function(t){o(this,ma)&&t.relatedTarget?.parentNode!==o(this,Bn)&&v(this,Rt,If).call(this)},mS=function(t){g(this,Bp,o(this,ma)?t:"")},lw=function(t){if(o(this,Lr))for(let e of o(this,Lr))e.tabIndex=t},If=function(){g(this,ma,!1),v(this,Rt,lw).call(this,-1),v(this,Rt,T0).call(this)},A(zt,zp),U(zt,"_l10n",null),U(zt,"_l10nResizer",null),U(zt,"_borderLineWidth",-1),U(zt,"_colorManager",new Kx),U(zt,"_zIndex",1),U(zt,"_telemetryTimeout",1e3);Se=zt,cw=class extends Se{constructor(t){super(t),this.annotationElementId=t.annotationElementId,this.deleted=!0}serialize(){return this.serializeDeleted()}},uT=3285377520,ur=4294901760,ds=65535,hy=class{constructor(t){this.h1=t?t&4294967295:uT,this.h2=t?t&4294967295:uT}update(t){let e,n;if(typeof t=="string"){e=new Uint8Array(t.length*2),n=0;for(let y=0,x=t.length;y<x;y++){let b=t.charCodeAt(y);b<=255?e[n++]=b:(e[n++]=b>>>8,e[n++]=b&255)}}else if(ArrayBuffer.isView(t))e=t.slice(),n=e.byteLength;else throw new Error("Invalid data format, must be a string or TypedArray.");let i=n>>2,s=n-i*4,a=new Uint32Array(e.buffer,0,i),l=0,c=0,u=this.h1,h=this.h2,d=3432918353,f=461845907,p=d&ds,m=f&ds;for(let y=0;y<i;y++)y&1?(l=a[y],l=l*d&ur|l*p&ds,l=l<<15|l>>>17,l=l*f&ur|l*m&ds,u^=l,u=u<<13|u>>>19,u=u*5+3864292196):(c=a[y],c=c*d&ur|c*p&ds,c=c<<15|c>>>17,c=c*f&ur|c*m&ds,h^=c,h=h<<13|h>>>19,h=h*5+3864292196);switch(l=0,s){case 3:l^=e[i*4+2]<<16;case 2:l^=e[i*4+1]<<8;case 1:l^=e[i*4],l=l*d&ur|l*p&ds,l=l<<15|l>>>17,l=l*f&ur|l*m&ds,i&1?u^=l:h^=l}this.h1=u,this.h2=h}hexdigest(){let t=this.h1,e=this.h2;return t^=e>>>1,t=t*3981806797&ur|t*36045&ds,e=e*4283543511&ur|((e<<16|t>>>16)*2950163797&ur)>>>16,t^=e>>>1,t=t*444984403&ur|t*60499&ds,e=e*3301882366&ur|((e<<16|t>>>16)*3120437893&ur)>>>16,t^=e>>>1,(t>>>0).toString(16).padStart(8,"0")+(e>>>0).toString(16).padStart(8,"0")}},rp=Object.freeze({map:null,hash:"",transfer:void 0}),sp=class{constructor(){A(this,Gy);A(this,ql,!1);A(this,Vl,null);A(this,ga,null);A(this,Un,new Map);U(this,"onSetModified",null);U(this,"onResetModified",null);U(this,"onAnnotationEditor",null)}getValue(t,e){let n=o(this,Un).get(t);return n===void 0?e:Object.assign(e,n)}getRawValue(t){return o(this,Un).get(t)}remove(t){let e=o(this,Un).get(t);e!==void 0&&(e instanceof Se&&o(this,ga).delete(e.annotationElementId),o(this,Un).delete(t),o(this,Un).size===0&&this.resetModified(),!o(this,Un).values().some(n=>n instanceof Se)&&this.onAnnotationEditor?.(null))}setValue(t,e){let n=o(this,Un).get(t),i=!1;if(n!==void 0)for(let[s,a]of Object.entries(e))n[s]!==a&&(i=!0,n[s]=a);else i=!0,o(this,Un).set(t,e);i&&v(this,Gy,gS).call(this),e instanceof Se&&((o(this,ga)||g(this,ga,new Map)).set(e.annotationElementId,e),this.onAnnotationEditor?.(e.constructor._type))}has(t){return o(this,Un).has(t)}get size(){return o(this,Un).size}resetModified(){o(this,ql)&&(g(this,ql,!1),this.onResetModified?.())}get print(){return new dy(this)}get serializable(){if(o(this,Un).size===0)return rp;let t=new Map,e=new hy,n=[],i=Object.create(null),s=!1;for(let[a,l]of o(this,Un)){let c=l instanceof Se?l.serialize(!1,i):l;l.page&&(l.pageIndex=l.page._pageIndex,delete l.page),c&&(t.set(a,c),e.update(`${a}:${JSON.stringify(c)}`),s||(s=!!c.bitmap))}if(s)for(let a of t.values())a.bitmap&&n.push(a.bitmap);return t.size>0?{map:t,hash:e.hexdigest(),transfer:n}:rp}get editorStats(){let t=null,e=new Map,n=0,i=0;for(let s of o(this,Un).values()){if(!(s instanceof Se)){s.popup&&(s.popup.deleted?i+=1:n+=1);continue}s.isCommentDeleted?i+=1:s.hasEditedComment&&(n+=1);let a=s.telemetryFinalData;if(!a)continue;let{type:l}=a;e.has(l)||e.set(l,Object.getPrototypeOf(s).constructor),t||(t=Object.create(null));let c=t[l]||(t[l]=new Map);for(let[u,h]of Object.entries(a)){if(u==="type")continue;let d=c.getOrInsertComputed(u,ub);d.set(h,(d.get(h)??0)+1)}}if((i>0||n>0)&&(t||(t=Object.create(null)),t.comments={deleted:i,edited:n}),!t)return null;for(let[s,a]of e)t[s]=a.computeTelemetryFinalData(t[s]);return t}resetModifiedIds(){g(this,Vl,null)}updateEditor(t,e){let n=o(this,ga)?.get(t);return n?(n.updateFromAnnotationLayer(e),!0):!1}getEditor(t){return o(this,ga)?.get(t)||null}get modifiedIds(){if(o(this,Vl))return o(this,Vl);let t=[];if(o(this,ga))for(let e of o(this,ga).values())e.serialize()&&t.push(e.annotationElementId);return g(this,Vl,{ids:new Set(t),hash:t.join(",")})}[Symbol.iterator](){return o(this,Un).entries()}};ql=new WeakMap,Vl=new WeakMap,ga=new WeakMap,Un=new WeakMap,Gy=new WeakSet,gS=function(){o(this,ql)||(g(this,ql,!0),this.onSetModified?.())};dy=class extends sp{constructor(e){super();A(this,jp,rp);let{serializable:n}=e;if(n===rp)return;let{map:i,hash:s,transfer:a}=n,l=structuredClone(i,a?{transfer:a}:null);g(this,jp,{map:l,hash:s,transfer:[]})}get print(){ue("Should not call PrintAnnotationStorage.print")}get serializable(){return o(this,jp)}get modifiedIds(){return Ut(this,"modifiedIds",{ids:new Set,hash:""})}};jp=new WeakMap;Bu="__forcedDependency",{floor:hT,ceil:dT}=Math;uw=new Uint32Array(new Uint8Array([255,255,0,0]).buffer)[0],hw=class{constructor(t,e){A(this,Ah);A(this,Io);g(this,Ah,t),g(this,Io,e)}get length(){return o(this,Ah).length}isEmpty(t){return o(this,Ah)[t]===uw}minX(t){return o(this,Io)[t*4+0]/256}minY(t){return o(this,Io)[t*4+1]/256}maxX(t){return(o(this,Io)[t*4+2]+1)/256}maxY(t){return(o(this,Io)[t*4+3]+1)/256}};Ah=new WeakMap,Io=new WeakMap;pT=(r,t)=>r?.getOrInsertComputed(t,()=>({dependencies:new Set,isRenderingOperation:!1})),dw=class{constructor(t,e){A(this,Gp);A(this,ya,[[1,0,0,1,0,0]]);A(this,ce,[-1/0,-1/0,1/0,1/0]);A(this,ye,new Float64Array([1/0,1/0,-1/0,-1/0]));U(this,"_pendingBBoxIdx",-1);A(this,Xl);A(this,Yl);A(this,Kl);A(this,Qn);U(this,"_savesStack",[]);U(this,"_markedContentStack",[]);g(this,Xl,t.width),g(this,Yl,t.height),v(this,Gp,fw).call(this,e)}growOperationsCount(t){t>=o(this,Qn).length&&v(this,Gp,fw).call(this,t,o(this,Qn))}get clipBox(){return o(this,ce)}save(t){return g(this,ce,{__proto__:o(this,ce)}),this._savesStack.push(t),this}restore(t,e){let n=Object.getPrototypeOf(o(this,ce));if(n===null)return this;g(this,ce,n);let i=this._savesStack.pop();return i!==void 0&&(e?.(i,t),o(this,Qn)[t]=o(this,Qn)[i]),this}recordOpenMarker(t){return this._savesStack.push(t),this}getOpenMarker(){return this._savesStack.length===0?null:this._savesStack.at(-1)}recordCloseMarker(t,e){let n=this._savesStack.pop();return n!==void 0&&(e?.(n,t),o(this,Qn)[t]=o(this,Qn)[n]),this}beginMarkedContent(t){return this._markedContentStack.push(t),this}endMarkedContent(t,e){let n=this._markedContentStack.pop();return n!==void 0&&(e?.(n,t),o(this,Qn)[t]=o(this,Qn)[n]),this}pushBaseTransform(t){return o(this,ya).push(yt.multiplyByDOMMatrix(o(this,ya).at(-1),t.getTransform())),this}popBaseTransform(){return o(this,ya).length>1&&o(this,ya).pop(),this}resetBBox(t){return this._pendingBBoxIdx!==t&&(this._pendingBBoxIdx=t,o(this,ye)[0]=1/0,o(this,ye)[1]=1/0,o(this,ye)[2]=-1/0,o(this,ye)[3]=-1/0),this}recordClipBox(t,e,n,i,s,a){let l=yt.multiplyByDOMMatrix(o(this,ya).at(-1),e.getTransform()),c=[1/0,1/0,-1/0,-1/0];yt.axialAlignedBoundingBox([n,s,i,a],l,c);let u=yt.intersect(o(this,ce),c);return u?(o(this,ce)[0]=u[0],o(this,ce)[1]=u[1],o(this,ce)[2]=u[2],o(this,ce)[3]=u[3]):(o(this,ce)[0]=o(this,ce)[1]=1/0,o(this,ce)[2]=o(this,ce)[3]=-1/0),this}recordBBox(t,e,n,i,s,a){let l=o(this,ce);if(l[0]===1/0)return this;let c=yt.multiplyByDOMMatrix(o(this,ya).at(-1),e.getTransform());if(l[0]===-1/0)return yt.axialAlignedBoundingBox([n,s,i,a],c,o(this,ye)),this;let u=[1/0,1/0,-1/0,-1/0];return yt.axialAlignedBoundingBox([n,s,i,a],c,u),o(this,ye)[0]=Math.min(o(this,ye)[0],Math.max(u[0],l[0])),o(this,ye)[1]=Math.min(o(this,ye)[1],Math.max(u[1],l[1])),o(this,ye)[2]=Math.max(o(this,ye)[2],Math.min(u[2],l[2])),o(this,ye)[3]=Math.max(o(this,ye)[3],Math.min(u[3],l[3])),this}recordFullPageBBox(t){return o(this,ye)[0]=Math.max(0,o(this,ce)[0]),o(this,ye)[1]=Math.max(0,o(this,ce)[1]),o(this,ye)[2]=Math.min(o(this,Xl),o(this,ce)[2]),o(this,ye)[3]=Math.min(o(this,Yl),o(this,ce)[3]),this}recordOperation(t,e=!1,n){if(this._pendingBBoxIdx!==t)return this;let i=hT(o(this,ye)[0]*256/o(this,Xl)),s=hT(o(this,ye)[1]*256/o(this,Yl)),a=dT(o(this,ye)[2]*256/o(this,Xl)),l=dT(o(this,ye)[3]*256/o(this,Yl));if(fT(o(this,Kl),t,i,s,a,l),n)for(let c of n)for(let u of c)u!==t&&fT(o(this,Kl),u,i,s,a,l);return e||(this._pendingBBoxIdx=-1),this}bboxToClipBoxDropOperation(t){return this._pendingBBoxIdx===t&&(this._pendingBBoxIdx=-1,o(this,ce)[0]=Math.max(o(this,ce)[0],o(this,ye)[0]),o(this,ce)[1]=Math.max(o(this,ce)[1],o(this,ye)[1]),o(this,ce)[2]=Math.min(o(this,ce)[2],o(this,ye)[2]),o(this,ce)[3]=Math.min(o(this,ce)[3],o(this,ye)[3])),this}take(){return new hw(o(this,Qn),o(this,Kl))}takeDebugMetadata(){throw new Error("Unreachable")}recordSimpleData(t,e){return this}recordIncrementalData(t,e){return this}resetIncrementalData(t,e){return this}recordNamedData(t,e){return this}recordSimpleDataFromNamed(t,e,n){return this}recordFutureForcedDependency(t,e){return this}inheritSimpleDataAsFutureForcedDependencies(t){return this}inheritPendingDependenciesAsFutureForcedDependencies(){return this}recordCharacterBBox(t,e,n,i=1,s=0,a=0,l){return this}getSimpleIndex(t){}recordDependencies(t,e){return this}recordNamedDependency(t,e){return this}recordShowTextOperation(t,e=!1){return this}};ya=new WeakMap,ce=new WeakMap,ye=new WeakMap,Xl=new WeakMap,Yl=new WeakMap,Kl=new WeakMap,Qn=new WeakMap,Gp=new WeakSet,fw=function(t,e){let n=new ArrayBuffer(t*4);g(this,Kl,new Uint8ClampedArray(n)),g(this,Qn,new Uint32Array(n)),e&&e.length>0?(o(this,Qn).set(e),o(this,Qn).fill(uw,e.length)):o(this,Qn).fill(uw)};pw=class{constructor(t,e=!1){A(this,vi,{__proto__:null});A(this,Ci,{__proto__:null,transform:[],moveText:[],sameLineText:[],[Bu]:[]});A(this,Zl,new Map);A(this,Br,new Set);A(this,vh,new Map);A(this,ko);A(this,_o);A(this,be);g(this,be,t),e&&(g(this,ko,new Map),g(this,_o,(n,i)=>{pT(o(this,ko),i).dependencies.add(n)}))}get clipBox(){return o(this,be).clipBox}growOperationsCount(t){o(this,be).growOperationsCount(t)}save(t){return g(this,vi,{__proto__:o(this,vi)}),g(this,Ci,{__proto__:o(this,Ci),transform:{__proto__:o(this,Ci).transform},moveText:{__proto__:o(this,Ci).moveText},sameLineText:{__proto__:o(this,Ci).sameLineText},[Bu]:{__proto__:o(this,Ci)[Bu]}}),o(this,be).save(t),this}restore(t){o(this,be).restore(t,o(this,_o));let e=Object.getPrototypeOf(o(this,vi));return e===null?this:(g(this,vi,e),g(this,Ci,Object.getPrototypeOf(o(this,Ci))),this)}recordOpenMarker(t){return o(this,be).recordOpenMarker(t,o(this,_o)),this}getOpenMarker(){return o(this,be).getOpenMarker()}recordCloseMarker(t){return o(this,be).recordCloseMarker(t,o(this,_o)),this}beginMarkedContent(t){return o(this,be).beginMarkedContent(t),this}endMarkedContent(t){return o(this,be).endMarkedContent(t,o(this,_o)),this}pushBaseTransform(t){return o(this,be).pushBaseTransform(t),this}popBaseTransform(){return o(this,be).popBaseTransform(),this}recordSimpleData(t,e){return o(this,vi)[t]=e,this}recordIncrementalData(t,e){return o(this,Ci)[t].push(e),this}resetIncrementalData(t,e){return o(this,Ci)[t].length=0,this}recordNamedData(t,e){return o(this,Zl).set(t,e),this}recordSimpleDataFromNamed(t,e,n){o(this,vi)[t]=o(this,Zl).get(e)??n}recordFutureForcedDependency(t,e){return this.recordIncrementalData(Bu,e),this}inheritSimpleDataAsFutureForcedDependencies(t){for(let e of t)e in o(this,vi)&&this.recordFutureForcedDependency(e,o(this,vi)[e]);return this}inheritPendingDependenciesAsFutureForcedDependencies(){for(let t of o(this,Br))this.recordFutureForcedDependency(Bu,t);return this}resetBBox(t){return o(this,be).resetBBox(t),this}recordClipBox(t,e,n,i,s,a){return o(this,be).recordClipBox(t,e,n,i,s,a),this}recordBBox(t,e,n,i,s,a){return o(this,be).recordBBox(t,e,n,i,s,a),this}recordCharacterBBox(t,e,n,i=1,s=0,a=0,l){let c=n.bbox,u,h;if(c&&(u=c[2]!==c[0]&&c[3]!==c[1]&&o(this,vh).get(n),u!==!1&&(h=[0,0,0,0],yt.axialAlignedBoundingBox(c,n.fontMatrix,h),(i!==1||s!==0||a!==0)&&yt.scaleMinMax([i,0,0,-i,s,a],h),u)))return this.recordBBox(t,e,h[0],h[2],h[1],h[3]);if(!l)return this.recordFullPageBBox(t);let d=l();return c&&h&&u===void 0&&(u=h[0]<=s-d.actualBoundingBoxLeft&&h[2]>=s+d.actualBoundingBoxRight&&h[1]<=a-d.actualBoundingBoxAscent&&h[3]>=a+d.actualBoundingBoxDescent,o(this,vh).set(n,u),u)?this.recordBBox(t,e,h[0],h[2],h[1],h[3]):this.recordBBox(t,e,s-d.actualBoundingBoxLeft,s+d.actualBoundingBoxRight,a-d.actualBoundingBoxAscent,a+d.actualBoundingBoxDescent)}recordFullPageBBox(t){return o(this,be).recordFullPageBBox(t),this}getSimpleIndex(t){return o(this,vi)[t]}recordDependencies(t,e){let n=o(this,Br),i=o(this,vi),s=o(this,Ci);for(let a of e)a in o(this,vi)?n.add(i[a]):a in s&&s[a].forEach(n.add,n);return this}recordNamedDependency(t,e){return o(this,Zl).has(e)&&o(this,Br).add(o(this,Zl).get(e)),this}recordOperation(t,e=!1){if(this.recordDependencies(t,[Bu]),o(this,ko)){let i=pT(o(this,ko),t),{dependencies:s}=i;o(this,Br).forEach(s.add,s),o(this,be)._savesStack.forEach(s.add,s),o(this,be)._markedContentStack.forEach(s.add,s),s.delete(t),i.isRenderingOperation=!0}let n=!e&&t===o(this,be)._pendingBBoxIdx;return o(this,be).recordOperation(t,e,[o(this,Br),o(this,be)._savesStack,o(this,be)._markedContentStack]),n&&o(this,Br).clear(),this}recordShowTextOperation(t,e=!1){let n=Array.from(o(this,Br));this.recordOperation(t,e),this.recordIncrementalData("sameLineText",t);for(let i of n)this.recordIncrementalData("sameLineText",i);return this}bboxToClipBoxDropOperation(t,e=!1){let n=!e&&t===o(this,be)._pendingBBoxIdx;return o(this,be).bboxToClipBoxDropOperation(t),n&&o(this,Br).clear(),this}take(){return o(this,vh).clear(),o(this,be).take()}takeDebugMetadata(){return o(this,ko)}};vi=new WeakMap,Ci=new WeakMap,Zl=new WeakMap,Br=new WeakMap,vh=new WeakMap,ko=new WeakMap,_o=new WeakMap,be=new WeakMap;C2=class C2{constructor(t,e,n){A(this,xe);A(this,We);A(this,Ur);A(this,Ch,0);A(this,Eh,0);if(t instanceof C2&&o(t,Ur)===!!n)return t;g(this,xe,t),g(this,We,e),g(this,Ur,!!n)}get clipBox(){return o(this,xe).clipBox}growOperationsCount(){throw new Error("Unreachable")}save(t){return an(this,Eh)._++,o(this,xe).save(o(this,We)),this}restore(t){return o(this,Eh)>0&&(o(this,xe).restore(o(this,We)),an(this,Eh)._--),this}recordOpenMarker(t){return an(this,Ch)._++,this}getOpenMarker(){return o(this,Ch)>0?o(this,We):o(this,xe).getOpenMarker()}recordCloseMarker(t){return an(this,Ch)._--,this}beginMarkedContent(t){return this}endMarkedContent(t){return this}pushBaseTransform(t){return o(this,xe).pushBaseTransform(t),this}popBaseTransform(){return o(this,xe).popBaseTransform(),this}recordSimpleData(t,e){return o(this,xe).recordSimpleData(t,o(this,We)),this}recordIncrementalData(t,e){return o(this,xe).recordIncrementalData(t,o(this,We)),this}resetIncrementalData(t,e){return o(this,xe).resetIncrementalData(t,o(this,We)),this}recordNamedData(t,e){return this}recordSimpleDataFromNamed(t,e,n){return o(this,xe).recordSimpleDataFromNamed(t,e,o(this,We)),this}recordFutureForcedDependency(t,e){return o(this,xe).recordFutureForcedDependency(t,o(this,We)),this}inheritSimpleDataAsFutureForcedDependencies(t){return o(this,xe).inheritSimpleDataAsFutureForcedDependencies(t),this}inheritPendingDependenciesAsFutureForcedDependencies(){return o(this,xe).inheritPendingDependenciesAsFutureForcedDependencies(),this}resetBBox(t){return o(this,Ur)||o(this,xe).resetBBox(o(this,We)),this}recordClipBox(t,e,n,i,s,a){return o(this,Ur)||o(this,xe).recordClipBox(o(this,We),e,n,i,s,a),this}recordBBox(t,e,n,i,s,a){return o(this,Ur)||o(this,xe).recordBBox(o(this,We),e,n,i,s,a),this}recordCharacterBBox(t,e,n,i,s,a,l){return o(this,Ur)||o(this,xe).recordCharacterBBox(o(this,We),e,n,i,s,a,l),this}recordFullPageBBox(t){return o(this,Ur)||o(this,xe).recordFullPageBBox(o(this,We)),this}getSimpleIndex(t){return o(this,xe).getSimpleIndex(t)}recordDependencies(t,e){return o(this,xe).recordDependencies(o(this,We),e),this}recordNamedDependency(t,e){return o(this,xe).recordNamedDependency(o(this,We),e),this}recordOperation(t){return o(this,xe).recordOperation(o(this,We),!0),this}recordShowTextOperation(t){return o(this,xe).recordShowTextOperation(o(this,We),!0),this}bboxToClipBoxDropOperation(t){return o(this,Ur)||o(this,xe).bboxToClipBoxDropOperation(o(this,We),!0),this}take(){throw new Error("Unreachable")}takeDebugMetadata(){throw new Error("Unreachable")}};xe=new WeakMap,We=new WeakMap,Ur=new WeakMap,Ch=new WeakMap,Eh=new WeakMap;fy=C2,hr={stroke:["path","transform","filter","strokeColor","strokeAlpha","lineWidth","lineCap","lineJoin","miterLimit","dash"],fill:["path","transform","filter","fillColor","fillAlpha","globalCompositeOperation","SMask"],imageXObject:["transform","SMask","filter","fillAlpha","strokeAlpha","globalCompositeOperation"],rawFillPath:["filter","fillColor","fillAlpha"],showText:["transform","leading","charSpacing","wordSpacing","hScale","textRise","moveText","textMatrix","font","fontObj","filter","fillColor","textRenderingMode","SMask","fillAlpha","strokeAlpha","globalCompositeOperation","sameLineText"],transform:["transform"],transformAndFill:["transform","fillColor"]},Zf=class Zf{constructor(t){A(this,Ql);A(this,Jl);A(this,tc,4);A(this,ec,0);A(this,nc,new(o(Zf,Hp))(o(this,tc)*6));g(this,Ql,t.width),g(this,Jl,t.height)}record(t,e,n,i){if(o(this,ec)===o(this,tc)){g(this,tc,o(this,tc)*2);let l=new(o(Zf,Hp))(o(this,tc)*6);l.set(o(this,nc)),g(this,nc,l)}let s=yt.domMatrixToTransform(t.getTransform()),a;if(i[0]!==1/0){let l=[1/0,1/0,-1/0,-1/0];yt.axialAlignedBoundingBox([0,-n,e,0],s,l);let c=yt.intersect(i,l);if(!c)return;let[u,h,d,f]=c;if(u!==l[0]||h!==l[1]||d!==l[2]||f!==l[3]){let p=Math.atan2(s[1],s[0]),m=Math.abs(Math.sin(p)),y=Math.abs(Math.cos(p));if(m<1e-6||y<1e-6||Math.abs(m-y)<1e-6)a=[u,h,u,f,d,h];else{let x=d-u,b=f-h,w=m*m,C=y*y,E=y*m,S=C-w,N=(b*C-x*E)/S,k=(b*E-x*w)/S;a=[u+k,h,u,h+N,d,f-N]}}}a||(a=[0,-n,0,0,e,-n],yt.applyTransform(a,s,0),yt.applyTransform(a,s,2),yt.applyTransform(a,s,4)),a[0]/=o(this,Ql),a[1]/=o(this,Jl),a[2]/=o(this,Ql),a[3]/=o(this,Jl),a[4]/=o(this,Ql),a[5]/=o(this,Jl),o(this,nc).set(a,o(this,ec)*6),an(this,ec)._++}take(){return o(this,nc).subarray(0,o(this,ec)*6)}};Ql=new WeakMap,Jl=new WeakMap,tc=new WeakMap,ec=new WeakMap,nc=new WeakMap,Hp=new WeakMap,A(Zf,Hp,Xe.isFloat16ArraySupported?Float16Array:Float32Array);mw=Zf,gw=class{constructor({ownerDocument:t=globalThis.document,styleElement:e=null}){A(this,Th,new Set);this._document=t,this.nativeFontFaces=new Set,this.styleElement=null,this.loadingRequests=[],this.loadTestFontId=0}addNativeFontFace(t){this.nativeFontFaces.add(t),this._document.fonts.add(t)}removeNativeFontFace(t){this.nativeFontFaces.delete(t),this._document.fonts.delete(t)}insertRule(t){this.styleElement||(this.styleElement=this._document.createElement("style"),this._document.documentElement.getElementsByTagName("head")[0].append(this.styleElement));let e=this.styleElement.sheet;e.insertRule(t,e.cssRules.length)}clear(){for(let t of this.nativeFontFaces)this._document.fonts.delete(t);this.nativeFontFaces.clear(),o(this,Th).clear(),this.styleElement&&(this.styleElement.remove(),this.styleElement=null)}async loadSystemFont({systemFontInfo:t,disableFontFace:e,_inspectFont:n}){if(!(!t||o(this,Th).has(t.loadedName))){if(Ue(!e,"loadSystemFont shouldn't be called when `disableFontFace` is set."),this.isFontLoadingAPISupported){let{loadedName:i,src:s,style:a}=t,l=new FontFace(i,s,a);this.addNativeFontFace(l);try{await l.load(),o(this,Th).add(i),n?.(t)}catch{jt(`Cannot load system font: ${t.baseFontName}, installing it could help to improve PDF rendering.`),this.removeNativeFontFace(l)}return}ue("Not implemented: loadSystemFont without the Font Loading API.")}}async bind(t){if(t.attached||t.missingFile&&!t.systemFontInfo)return;if(t.attached=!0,t.systemFontInfo){await this.loadSystemFont(t);return}if(this.isFontLoadingAPISupported){let n=t.createNativeFontFace();if(n){this.addNativeFontFace(n);try{await n.loaded}catch(i){throw jt(`Failed to load font '${n.family}': '${i}'.`),t.disableFontFace=!0,i}}return}let e=t.createFontFaceRule();if(e){if(this.insertRule(e),this.isSyncFontLoadingSupported)return;await new Promise(n=>{let i=this._queueLoadingCallback(n);this._prepareFontLoadEvent(t,i)})}}get isFontLoadingAPISupported(){let t=!!this._document?.fonts;return Ut(this,"isFontLoadingAPISupported",t)}get isSyncFontLoadingSupported(){return Ut(this,"isSyncFontLoadingSupported",Ki||Xe.platform.isFirefox)}_queueLoadingCallback(t){function e(){for(Ue(!i.done,"completeRequest() cannot be called twice."),i.done=!0;n.length>0&&n[0].done;){let s=n.shift();setTimeout(s.callback,0)}}let{loadingRequests:n}=this,i={done:!1,complete:e,callback:t};return n.push(i),i}get _loadTestFont(){let t=atob("T1RUTwALAIAAAwAwQ0ZGIDHtZg4AAAOYAAAAgUZGVE1lkzZwAAAEHAAAABxHREVGABQAFQAABDgAAAAeT1MvMlYNYwkAAAEgAAAAYGNtYXABDQLUAAACNAAAAUJoZWFk/xVFDQAAALwAAAA2aGhlYQdkA+oAAAD0AAAAJGhtdHgD6AAAAAAEWAAAAAZtYXhwAAJQAAAAARgAAAAGbmFtZVjmdH4AAAGAAAAAsXBvc3T/hgAzAAADeAAAACAAAQAAAAEAALZRFsRfDzz1AAsD6AAAAADOBOTLAAAAAM4KHDwAAAAAA+gDIQAAAAgAAgAAAAAAAAABAAADIQAAAFoD6AAAAAAD6AABAAAAAAAAAAAAAAAAAAAAAQAAUAAAAgAAAAQD6AH0AAUAAAKKArwAAACMAooCvAAAAeAAMQECAAACAAYJAAAAAAAAAAAAAQAAAAAAAAAAAAAAAFBmRWQAwAAuAC4DIP84AFoDIQAAAAAAAQAAAAAAAAAAACAAIAABAAAADgCuAAEAAAAAAAAAAQAAAAEAAAAAAAEAAQAAAAEAAAAAAAIAAQAAAAEAAAAAAAMAAQAAAAEAAAAAAAQAAQAAAAEAAAAAAAUAAQAAAAEAAAAAAAYAAQAAAAMAAQQJAAAAAgABAAMAAQQJAAEAAgABAAMAAQQJAAIAAgABAAMAAQQJAAMAAgABAAMAAQQJAAQAAgABAAMAAQQJAAUAAgABAAMAAQQJAAYAAgABWABYAAAAAAAAAwAAAAMAAAAcAAEAAAAAADwAAwABAAAAHAAEACAAAAAEAAQAAQAAAC7//wAAAC7////TAAEAAAAAAAABBgAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAD/gwAyAAAAAQAAAAAAAAAAAAAAAAAAAAABAAQEAAEBAQJYAAEBASH4DwD4GwHEAvgcA/gXBIwMAYuL+nz5tQXkD5j3CBLnEQACAQEBIVhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYAAABAQAADwACAQEEE/t3Dov6fAH6fAT+fPp8+nwHDosMCvm1Cvm1DAz6fBQAAAAAAAABAAAAAMmJbzEAAAAAzgTjFQAAAADOBOQpAAEAAAAAAAAADAAUAAQAAAABAAAAAgABAAAAAAAAAAAD6AAAAAAAAA==");return Ut(this,"_loadTestFont",t)}_prepareFontLoadEvent(t,e){function n(E,S){return E.charCodeAt(S)<<24|E.charCodeAt(S+1)<<16|E.charCodeAt(S+2)<<8|E.charCodeAt(S+3)&255}function i(E,S,N,k){let M=E.substring(0,S),R=E.substring(S+N);return M+k+R}let s,a,l=this._document.createElement("canvas");l.width=1,l.height=1;let c=l.getContext("2d"),u=0;function h(E,S){if(++u>30){jt("Load test font never loaded."),S();return}if(c.font="30px "+E,c.fillText(".",0,20),c.getImageData(0,0,1,1).data[3]>0){S();return}setTimeout(h.bind(null,E,S))}let d=`lt${Date.now()}${this.loadTestFontId++}`,f=this._loadTestFont;f=i(f,976,d.length,d);let m=16,y=1482184792,x=n(f,m);for(s=0,a=d.length-3;s<a;s+=4)x=x-y+n(d,s)|0;s<d.length&&(x=x-y+n(d+"XXX",s)|0),f=i(f,m,4,TO(x));let b=`url(data:font/opentype;base64,${btoa(f)});`,w=`@font-face {font-family:"${d}";src:${b}}`;this.insertRule(w);let C=this._document.createElement("div");C.style.visibility="hidden",C.style.width=C.style.height="10px",C.style.position="absolute",C.style.top=C.style.left="0px";for(let E of[t.loadedName,d]){let S=this._document.createElement("span");S.textContent="Hi",S.style.fontFamily=E,C.append(S)}this._document.body.append(C),h(d,()=>{C.remove(),e.complete()})}};Th=new WeakMap;yw=class{constructor(t,e=null,n,i){U(this,"compiledGlyphs",Object.create(null));A(this,we);g(this,we,t),this._inspectFont=e,n&&(this.charProcOperatorList=n),i&&Object.assign(this,i)}createNativeFontFace(){if(!this.data||this.disableFontFace)return null;let t;if(!this.cssFontInfo)t=new FontFace(this.loadedName,this.data,{});else{let e={weight:this.cssFontInfo.fontWeight};this.cssFontInfo.italicAngle&&(e.style=`oblique ${this.cssFontInfo.italicAngle}deg`),t=new FontFace(this.cssFontInfo.fontFamily,this.data,e)}return this._inspectFont?.(this),t}createFontFaceRule(){if(!this.data||this.disableFontFace)return null;let t=`url(data:${this.mimetype};base64,${this.data.toBase64()});`,e;if(!this.cssFontInfo)e=`@font-face {font-family:"${this.loadedName}";src:${t}}`;else{let n=`font-weight: ${this.cssFontInfo.fontWeight};`;this.cssFontInfo.italicAngle&&(n+=`font-style: oblique ${this.cssFontInfo.italicAngle}deg;`),e=`@font-face {font-family:"${this.cssFontInfo.fontFamily}";${n}src:${t}}`}return this._inspectFont?.(this,t),e}getPathGenerator(t,e){if(this.compiledGlyphs[e]!==void 0)return this.compiledGlyphs[e];let n=this.loadedName+"_path_"+e,i;try{i=t.get(n)}catch(a){jt(`getPathGenerator - ignoring character: "${a}".`)}let s=LT(i?.path);return this.fontExtraProperties||t.delete(n),this.compiledGlyphs[e]=s}get black(){return o(this,we).black}get bold(){return o(this,we).bold}get disableFontFace(){return o(this,we).disableFontFace}set disableFontFace(t){Ut(this,"disableFontFace",!!t)}get fontExtraProperties(){return o(this,we).fontExtraProperties}get isInvalidPDFjsFont(){return o(this,we).isInvalidPDFjsFont}get isType3Font(){return o(this,we).isType3Font}get italic(){return o(this,we).italic}get missingFile(){return o(this,we).missingFile}get remeasure(){return o(this,we).remeasure}get vertical(){return o(this,we).vertical}get ascent(){return o(this,we).ascent}get defaultWidth(){return o(this,we).defaultWidth}get descent(){return o(this,we).descent}get bbox(){return o(this,we).bbox}get fontMatrix(){return o(this,we).fontMatrix}get fallbackName(){return o(this,we).fallbackName}get loadedName(){return o(this,we).loadedName}get mimetype(){return o(this,we).mimetype}get name(){return o(this,we).name}get data(){return o(this,we).data}clearData(){o(this,we).clearData()}get cssFontInfo(){return o(this,we).cssFontInfo}get systemFontInfo(){return o(this,we).systemFontInfo}get defaultVMetrics(){return o(this,we).defaultVMetrics}};we=new WeakMap;S0=class{};U(S0,"strings",["fontFamily","fontWeight","italicAngle"]);D0=class{};U(D0,"strings",["css","loadedName","baseFontName","src"]);Yn=class Yn{};U(Yn,"bools",["black","bold","disableFontFace","fontExtraProperties","isInvalidPDFjsFont","isType3Font","italic","missingFile","remeasure","vertical"]),U(Yn,"numbers",["ascent","defaultWidth","descent"]),U(Yn,"strings",["fallbackName","loadedName","mimetype","name"]),U(Yn,"OFFSET_NUMBERS",Math.ceil(Yn.bools.length*2/8)),U(Yn,"OFFSET_BBOX",Yn.OFFSET_NUMBERS+Yn.numbers.length*8),U(Yn,"OFFSET_FONT_MATRIX",Yn.OFFSET_BBOX+1+8),U(Yn,"OFFSET_DEFAULT_VMETRICS",Yn.OFFSET_FONT_MATRIX+1+48),U(Yn,"OFFSET_STRINGS",Yn.OFFSET_DEFAULT_VMETRICS+1+6);ki=Yn,kn=class{};U(kn,"KIND",0),U(kn,"HAS_BBOX",1),U(kn,"HAS_BACKGROUND",2),U(kn,"SHADING_TYPE",3),U(kn,"N_COORD",4),U(kn,"N_COLOR",8),U(kn,"N_STOP",12),U(kn,"N_FIGURES",16);bw=class{constructor(t){A(this,Dh);A(this,Wp);A(this,Hy,new TextDecoder);A(this,Sh);g(this,Wp,t),g(this,Sh,new DataView(t))}get fontFamily(){return v(this,Dh,N0).call(this,0)}get fontWeight(){return v(this,Dh,N0).call(this,1)}get italicAngle(){return v(this,Dh,N0).call(this,2)}};Wp=new WeakMap,Hy=new WeakMap,Sh=new WeakMap,Dh=new WeakSet,N0=function(t){Ue(t<S0.strings.length,"Invalid string index");let e=0;for(let i=0;i<t;i++)e+=o(this,Sh).getUint32(e)+4;let n=o(this,Sh).getUint32(e);return o(this,Hy).decode(new Uint8Array(o(this,Wp),e+4,n))};xw=class{constructor(t){A(this,rc);A(this,ic);A(this,Nh,new TextDecoder);A(this,Cs);g(this,ic,t),g(this,Cs,new DataView(t))}get guessFallback(){return o(this,Cs).getUint8(0)!==0}get css(){return v(this,rc,kf).call(this,0)}get loadedName(){return v(this,rc,kf).call(this,1)}get baseFontName(){return v(this,rc,kf).call(this,2)}get src(){return v(this,rc,kf).call(this,3)}get style(){let t=1;t+=4+o(this,Cs).getUint32(t);let e=o(this,Cs).getUint32(t),n=o(this,Nh).decode(new Uint8Array(o(this,ic),t+4,e));t+=4+e;let i=o(this,Cs).getUint32(t),s=o(this,Nh).decode(new Uint8Array(o(this,ic),t+4,i));return{style:n,weight:s}}};ic=new WeakMap,Nh=new WeakMap,Cs=new WeakMap,rc=new WeakSet,kf=function(t){Ue(t<D0.strings.length,"Invalid string index");let e=5;for(let i=0;i<t;i++)e+=o(this,Cs).getUint32(e)+4;let n=o(this,Cs).getUint32(e);return o(this,Nh).decode(new Uint8Array(o(this,ic),e+4,n))};ww=class{constructor({buffer:t,extra:e}){A(this,me);A(this,$r);A(this,Wy,new TextDecoder);A(this,nn);g(this,$r,t),g(this,nn,new DataView(t)),e&&Object.assign(this,e)}get black(){return v(this,me,Fr).call(this,0)}get bold(){return v(this,me,Fr).call(this,1)}get disableFontFace(){return v(this,me,Fr).call(this,2)}get fontExtraProperties(){return v(this,me,Fr).call(this,3)}get isInvalidPDFjsFont(){return v(this,me,Fr).call(this,4)}get isType3Font(){return v(this,me,Fr).call(this,5)}get italic(){return v(this,me,Fr).call(this,6)}get missingFile(){return v(this,me,Fr).call(this,7)}get remeasure(){return v(this,me,Fr).call(this,8)}get vertical(){return v(this,me,Fr).call(this,9)}get ascent(){return v(this,me,I0).call(this,0)}get defaultWidth(){return v(this,me,I0).call(this,1)}get descent(){return v(this,me,I0).call(this,2)}get bbox(){return v(this,me,k0).call(this,ki.OFFSET_BBOX,4,"getInt16",2)}get fontMatrix(){return v(this,me,k0).call(this,ki.OFFSET_FONT_MATRIX,6,"getFloat64",8)}get defaultVMetrics(){return v(this,me,k0).call(this,ki.OFFSET_DEFAULT_VMETRICS,3,"getInt16",2)}get fallbackName(){return v(this,me,_f).call(this,0)}get loadedName(){return v(this,me,_f).call(this,1)}get mimetype(){return v(this,me,_f).call(this,2)}get name(){return v(this,me,_f).call(this,3)}get data(){let{offset:t,length:e}=v(this,me,Aw).call(this);return e===0?void 0:new Uint8Array(o(this,$r),t+4,e)}clearData(){let{offset:t,length:e}=v(this,me,Aw).call(this);e!==0&&(o(this,nn).setUint32(t,0),g(this,$r,new Uint8Array(o(this,$r),0,t+4).slice().buffer),g(this,nn,new DataView(o(this,$r))))}get cssFontInfo(){let t=ki.OFFSET_STRINGS,e=o(this,nn).getUint32(t);t+=4+e;let n=o(this,nn).getUint32(t);t+=4+n;let i=o(this,nn).getUint32(t);if(i===0)return null;let s=new Uint8Array(i);return s.set(new Uint8Array(o(this,$r),t+4,i)),new bw(s.buffer)}get systemFontInfo(){let t=ki.OFFSET_STRINGS,e=o(this,nn).getUint32(t);t+=4+e;let n=o(this,nn).getUint32(t);if(n===0)return null;let i=new Uint8Array(n);return i.set(new Uint8Array(o(this,$r),t+4,n)),new xw(i.buffer)}};$r=new WeakMap,Wy=new WeakMap,nn=new WeakMap,me=new WeakSet,Fr=function(t){Ue(t<ki.bools.length,"Invalid boolean index");let e=Math.floor(t/4),n=t*2%8,i=o(this,nn).getUint8(e)>>n&3;return i===0?void 0:i===2},I0=function(t){return Ue(t<ki.numbers.length,"Invalid number index"),o(this,nn).getFloat64(ki.OFFSET_NUMBERS+t*8)},k0=function(t,e,n,i){let s=o(this,nn).getUint8(t);if(s===0)return;Ue(s===e,"Invalid array length."),t+=1;let a=new Array(s);for(let l=0;l<s;l++)a[l]=o(this,nn)[n](t,!0),t+=i;return a},_f=function(t){Ue(t<ki.strings.length,"Invalid string index");let e=ki.OFFSET_STRINGS+4;for(let i=0;i<t;i++)e+=o(this,nn).getUint32(e)+4;let n=o(this,nn).getUint32(e);return o(this,Wy).decode(new Uint8Array(o(this,$r),e+4,n))},Aw=function(){let t=ki.OFFSET_STRINGS,e=o(this,nn).getUint32(t);t+=4+e;let n=o(this,nn).getUint32(t);t+=4+n;let i=o(this,nn).getUint32(t);t+=4+i;let s=o(this,nn).getUint32(t);return{offset:t,length:s}};vw=class{constructor(t){this.buffer=t,this.view=new DataView(t),this.data=new Uint8Array(t)}getIR(){let t=this.view,e=this.data[kn.KIND],n=!!this.data[kn.HAS_BBOX],i=!!this.data[kn.HAS_BACKGROUND],s=t.getUint32(kn.N_COORD,!0),a=t.getUint32(kn.N_COLOR,!0),l=t.getUint32(kn.N_STOP,!0),c=t.getUint32(kn.N_FIGURES,!0),u=20,h=new Float32Array(this.buffer,u,s*2);u+=s*8;let d=new Uint8Array(this.buffer,u,a*3);u+=a*3;let f=[];for(let x=0;x<l;++x){let b=t.getFloat32(u,!0);u+=4;let w=t.getUint32(u,!0);u+=4,f.push([b,`#${w.toString(16).padStart(6,"0")}`])}let p=null;if(n){p=[];for(let x=0;x<4;++x)p.push(t.getFloat32(u,!0)),u+=4}let m=null;i&&(m=new Uint8Array(this.buffer,u,3),u+=3);let y=[];for(let x=0;x<c;++x){let b=t.getUint8(u);u+=1,u=Math.ceil(u/4)*4;let w=t.getUint32(u,!0);u+=4;let C=new Int32Array(this.buffer,u,w);u+=w*4;let E=t.getUint32(u,!0);u+=4;let S=new Int32Array(this.buffer,u,E);u+=E*4;let N={type:b,coords:C,colors:S};b===Dl.LATTICE&&(N.verticesPerRow=t.getUint32(u,!0),u+=4),y.push(N)}if(e===1)return["RadialAxial","axial",p,f,Array.from(h.slice(0,2)),Array.from(h.slice(2,4)),null,null];if(e===2)return["RadialAxial","radial",p,f,[h[0],h[1]],[h[3],h[4]],h[2],h[5]];if(e===3){let x=this.data[kn.SHADING_TYPE],b=null;if(h.length>0){b=[1/0,1/0,-1/0,-1/0];for(let w=0,C=h.length;w<C;w+=2)yt.pointBoundingBox(h[w],h[w+1],b)}return["Mesh",x,h,d,y,b,p,m]}throw new Error(`Unsupported pattern kind: ${e}`)}},Cw=class{constructor(t){A(this,Ih);g(this,Ih,t)}get path(){return Xe.isFloat16ArraySupported?new Float16Array(o(this,Ih)):new Float32Array(o(this,Ih))}};Ih=new WeakMap;Ew=r=>typeof r=="object"&&Number.isInteger(r?.num)&&r.num>=0&&Number.isInteger(r?.gen)&&r.gen>=0,FO=r=>typeof r=="object"&&typeof r?.name=="string",yS=IO.bind(null,Ew,FO),Tw=class{constructor(){A(this,ba,new Map);A(this,qy,Promise.resolve())}postMessage(t,e){let n={data:structuredClone(t,e?{transfer:e}:null)};o(this,qy).then(()=>{for(let[i]of o(this,ba))i.call(this,n)})}addEventListener(t,e,n=null){let i=null;if(n?.signal instanceof AbortSignal){let{signal:s}=n;if(s.aborted){jt("LoopbackPort - cannot use an `aborted` signal.");return}let a=()=>this.removeEventListener(t,e);i=()=>s.removeEventListener("abort",a),s.addEventListener("abort",a)}o(this,ba).set(e,i)}removeEventListener(t,e){o(this,ba).get(e)?.(),o(this,ba).delete(e)}terminate(){for(let[,t]of o(this,ba))t?.();o(this,ba).clear()}};ba=new WeakMap,qy=new WeakMap;d0={DATA:1,ERROR:2},ln={CANCEL:1,CANCEL_COMPLETE:2,CLOSE:3,ENQUEUE:4,ERROR:5,PULL:6,PULL_COMPLETE:7,START_COMPLETE:8};Nl=class{constructor(t,e,n){A(this,Nr);A(this,kh,new AbortController);this.sourceName=t,this.targetName=e,this.comObj=n,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),n.addEventListener("message",v(this,Nr,bS).bind(this),{signal:o(this,kh).signal})}on(t,e){let n=this.actionHandler;if(n[t])throw new Error(`There is already an actionName called "${t}"`);n[t]=e}send(t,e,n){this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:t,data:e},n)}sendWithPromise(t,e,n){let i=this.callbackId++,s=Promise.withResolvers();this.callbackCapabilities[i]=s;try{this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:t,callbackId:i,data:e},n)}catch(a){s.reject(a)}return s.promise}sendWithStream(t,e,n,i){let s=this.streamId++,a=this.sourceName,l=this.targetName,c=this.comObj;return new ReadableStream({start:u=>{let h=Promise.withResolvers();return this.streamControllers[s]={controller:u,startCall:h,pullCall:null,cancelCall:null,isClosed:!1},c.postMessage({sourceName:a,targetName:l,action:t,streamId:s,data:e,desiredSize:u.desiredSize},i),h.promise},pull:u=>{let h=Promise.withResolvers();return this.streamControllers[s].pullCall=h,c.postMessage({sourceName:a,targetName:l,stream:ln.PULL,streamId:s,desiredSize:u.desiredSize}),h.promise},cancel:u=>{Ue(u instanceof Error,"cancel must have a valid reason");let h=Promise.withResolvers();return this.streamControllers[s].cancelCall=h,this.streamControllers[s].isClosed=!0,c.postMessage({sourceName:a,targetName:l,stream:ln.CANCEL,streamId:s,reason:xi(u)}),h.promise}},n)}destroy(){o(this,kh)?.abort(),g(this,kh,null)}};kh=new WeakMap,Nr=new WeakSet,bS=function({data:t}){if(t.targetName!==this.sourceName)return;if(t.stream){v(this,Nr,wS).call(this,t);return}if(t.callback){let n=t.callbackId,i=this.callbackCapabilities[n];if(!i)throw new Error(`Cannot resolve callback ${n}`);if(delete this.callbackCapabilities[n],t.callback===d0.DATA)i.resolve(t.data);else if(t.callback===d0.ERROR)i.reject(xi(t.reason));else throw new Error("Unexpected callback case");return}let e=this.actionHandler[t.action];if(!e)throw new Error(`Unknown action from worker: ${t.action}`);if(t.callbackId){let n=this.sourceName,i=t.sourceName,s=this.comObj;Promise.try(e,t.data).then(function(a){s.postMessage({sourceName:n,targetName:i,callback:d0.DATA,callbackId:t.callbackId,data:a})},function(a){s.postMessage({sourceName:n,targetName:i,callback:d0.ERROR,callbackId:t.callbackId,reason:xi(a)})});return}if(t.streamId){v(this,Nr,xS).call(this,t);return}e(t.data)},xS=function(t){let e=t.streamId,n=this.sourceName,i=t.sourceName,s=this.comObj,a=this,l=this.actionHandler[t.action],c={enqueue(u,h=1,d){if(this.isCancelled)return;let f=this.desiredSize;this.desiredSize-=h,f>0&&this.desiredSize<=0&&(this.sinkCapability=Promise.withResolvers(),this.ready=this.sinkCapability.promise),s.postMessage({sourceName:n,targetName:i,stream:ln.ENQUEUE,streamId:e,chunk:u},d)},close(){this.isCancelled||(this.isCancelled=!0,s.postMessage({sourceName:n,targetName:i,stream:ln.CLOSE,streamId:e}),delete a.streamSinks[e])},error(u){Ue(u instanceof Error,"error must have a valid reason"),!this.isCancelled&&(this.isCancelled=!0,s.postMessage({sourceName:n,targetName:i,stream:ln.ERROR,streamId:e,reason:xi(u)}))},sinkCapability:Promise.withResolvers(),onPull:null,onCancel:null,isCancelled:!1,desiredSize:t.desiredSize,ready:null};c.sinkCapability.resolve(),c.ready=c.sinkCapability.promise,this.streamSinks[e]=c,Promise.try(l,t.data,c).then(function(){s.postMessage({sourceName:n,targetName:i,stream:ln.START_COMPLETE,streamId:e,success:!0})},function(u){s.postMessage({sourceName:n,targetName:i,stream:ln.START_COMPLETE,streamId:e,reason:xi(u)})})},wS=function(t){let e=t.streamId,n=this.sourceName,i=t.sourceName,s=this.comObj,a=this.streamControllers[e],l=this.streamSinks[e];switch(t.stream){case ln.START_COMPLETE:t.success?a.startCall.resolve():a.startCall.reject(xi(t.reason));break;case ln.PULL_COMPLETE:t.success?a.pullCall.resolve():a.pullCall.reject(xi(t.reason));break;case ln.PULL:if(!l){s.postMessage({sourceName:n,targetName:i,stream:ln.PULL_COMPLETE,streamId:e,success:!0});break}l.desiredSize<=0&&t.desiredSize>0&&l.sinkCapability.resolve(),l.desiredSize=t.desiredSize,Promise.try(l.onPull||mT).then(function(){s.postMessage({sourceName:n,targetName:i,stream:ln.PULL_COMPLETE,streamId:e,success:!0})},function(u){s.postMessage({sourceName:n,targetName:i,stream:ln.PULL_COMPLETE,streamId:e,reason:xi(u)})});break;case ln.ENQUEUE:if(Ue(a,"enqueue should have stream controller"),a.isClosed)break;a.controller.enqueue(t.chunk);break;case ln.CLOSE:if(Ue(a,"close should have stream controller"),a.isClosed)break;a.isClosed=!0,a.controller.close(),v(this,Nr,_0).call(this,a,e);break;case ln.ERROR:Ue(a,"error should have stream controller"),a.controller.error(xi(t.reason)),v(this,Nr,_0).call(this,a,e);break;case ln.CANCEL_COMPLETE:t.success?a.cancelCall.resolve():a.cancelCall.reject(xi(t.reason)),v(this,Nr,_0).call(this,a,e);break;case ln.CANCEL:if(!l)break;let c=xi(t.reason);Promise.try(l.onCancel||mT,c).then(function(){s.postMessage({sourceName:n,targetName:i,stream:ln.CANCEL_COMPLETE,streamId:e,success:!0})},function(u){s.postMessage({sourceName:n,targetName:i,stream:ln.CANCEL_COMPLETE,streamId:e,reason:xi(u)})}),l.sinkCapability.reject(c),l.isCancelled=!0,delete this.streamSinks[e];break;default:throw new Error("Unexpected stream case")}},_0=async function(t,e){await Promise.allSettled([t.startCall?.promise,t.pullCall?.promise,t.cancelCall?.promise]),delete this.streamControllers[e]};py=class{constructor({cMapUrl:t=null,standardFontDataUrl:e=null,wasmUrl:n=null}){A(this,Vy,Object.freeze({cMapUrl:"CMap",standardFontDataUrl:"font",wasmUrl:"wasm"}));this.cMapUrl=t,this.standardFontDataUrl=e,this.wasmUrl=n}async fetch({kind:t,filename:e}){switch(t){case"cMapUrl":case"standardFontDataUrl":case"wasmUrl":break;default:ue(`Not implemented: ${t}`)}let n=this[t];if(!n)throw new Error(`Ensure that the \`${t}\` API parameter is provided.`);let i=`${n}${e}`;return this._fetch(i,t).catch(s=>{throw new Error(`Unable to load ${o(this,Vy)[t]} data at: ${i}`)})}async _fetch(t,e){ue("Abstract method `_fetch` called.")}};Vy=new WeakMap;my=class extends py{async _fetch(t,e){let n=e==="cMapUrl"&&!t.endsWith(".bcmap")?"text":"bytes",i=await hb(t,n);return i instanceof Uint8Array?i:lb(i)}},gy=class{constructor({enableHWA:t=!1}){A(this,qp,!1);g(this,qp,t)}create(t,e){if(t<=0||e<=0)throw new Error("Invalid canvas size");let n=this._createCanvas(t,e);return{canvas:n,context:n.getContext("2d",{willReadFrequently:!o(this,qp)})}}reset({canvas:t},e,n){if(!t)throw new Error("Canvas is not specified");if(e<=0||n<=0)throw new Error("Invalid canvas size");t.width=e,t.height=n}destroy(t){let{canvas:e}=t;if(!e)throw new Error("Canvas is not specified");e.width=e.height=0,t.canvas=null,t.context=null}_createCanvas(t,e){ue("Abstract method `_createCanvas` called.")}};qp=new WeakMap;Sw=class extends gy{constructor({ownerDocument:t=globalThis.document,enableHWA:e=!1}){super({enableHWA:e}),this._document=t}_createCanvas(t,e){let n=this._document.createElement("canvas");return n.width=t,n.height=e,n}},yy=class{addFilter(t){return"none"}addHCMFilter(t,e){return"none"}addAlphaFilter(t){return"none"}addLuminosityFilter(t){return"none"}addHighlightHCMFilter(t,e,n,i,s){return"none"}destroy(t=!1){}},Dw=class extends yy{constructor({docId:e,ownerDocument:n=globalThis.document}){super();A(this,Nt);A(this,sc);A(this,_h);A(this,xa);A(this,wa);A(this,Jn);A(this,ac);A(this,oc,0);g(this,wa,e),g(this,Jn,n)}addFilter(e){if(!e)return"none";let n=o(this,Nt,Xn).get(e);if(n)return n;let[i,s,a]=v(this,Nt,M0).call(this,e),l=e.length===1?i:`${i}${s}${a}`;if(n=o(this,Nt,Xn).get(l),n)return o(this,Nt,Xn).set(e,n),n;let c=`g_${o(this,wa)}_transfer_map_${an(this,oc)._++}`,u=v(this,Nt,ju).call(this,c);o(this,Nt,Xn).set(e,u),o(this,Nt,Xn).set(l,u);let h=v(this,Nt,Gu).call(this,c);return v(this,Nt,Ff).call(this,i,s,a,h),u}addHCMFilter(e,n){let i=`${e}-${n}`,s="base",a=o(this,Nt,Mf).get(s);if(a?.key===i||(a?(a.filter?.remove(),a.key=i,a.url="none",a.filter=null):(a={key:i,url:"none",filter:null},o(this,Nt,Mf).set(s,a)),!e||!n))return a.url;let l=v(this,Nt,Pf).call(this,e);e=yt.makeHexColor(...l);let c=v(this,Nt,Pf).call(this,n);if(n=yt.makeHexColor(...c),o(this,Nt,zu).style.color="",e==="#000000"&&n==="#ffffff"||e===n)return a.url;let u=new Array(256);for(let m=0;m<=255;m++){let y=m/255;u[m]=y<=.03928?y/12.92:((y+.055)/1.055)**2.4}let h=u.join(","),d=`g_${o(this,wa)}_hcm_filter`,f=a.filter=v(this,Nt,Gu).call(this,d);v(this,Nt,Ff).call(this,h,h,h,f),v(this,Nt,Nw).call(this,f);let p=(m,y)=>{let x=l[m]/255,b=c[m]/255,w=new Array(y+1);for(let C=0;C<=y;C++)w[C]=x+C/y*(b-x);return w.join(",")};return v(this,Nt,Ff).call(this,p(0,5),p(1,5),p(2,5),f),a.url=v(this,Nt,ju).call(this,d),a.url}addAlphaFilter(e){let n=o(this,Nt,Xn).get(e);if(n)return n;let[i]=v(this,Nt,M0).call(this,[e]),s=`alpha_${i}`;if(n=o(this,Nt,Xn).get(s),n)return o(this,Nt,Xn).set(e,n),n;let a=`g_${o(this,wa)}_alpha_map_${an(this,oc)._++}`,l=v(this,Nt,ju).call(this,a);o(this,Nt,Xn).set(e,l),o(this,Nt,Xn).set(s,l);let c=v(this,Nt,Gu).call(this,a);return v(this,Nt,Iw).call(this,i,c),l}addLuminosityFilter(e){let n=o(this,Nt,Xn).get(e||"luminosity");if(n)return n;let i,s;if(e?([i]=v(this,Nt,M0).call(this,[e]),s=`luminosity_${i}`):s="luminosity",n=o(this,Nt,Xn).get(s),n)return o(this,Nt,Xn).set(e,n),n;let a=`g_${o(this,wa)}_luminosity_map_${an(this,oc)._++}`,l=v(this,Nt,ju).call(this,a);o(this,Nt,Xn).set(e,l),o(this,Nt,Xn).set(s,l);let c=v(this,Nt,Gu).call(this,a);return v(this,Nt,AS).call(this,c),e&&v(this,Nt,Iw).call(this,i,c),l}addHighlightHCMFilter(e,n,i,s,a){let l=`${n}-${i}-${s}-${a}`,c=o(this,Nt,Mf).get(e);if(c?.key===l||(c?(c.filter?.remove(),c.key=l,c.url="none",c.filter=null):(c={key:l,url:"none",filter:null},o(this,Nt,Mf).set(e,c)),!n||!i))return c.url;let[u,h]=[n,i].map(v(this,Nt,Pf).bind(this)),d=Math.round(.2126*u[0]+.7152*u[1]+.0722*u[2]),f=Math.round(.2126*h[0]+.7152*h[1]+.0722*h[2]),[p,m]=[s,a].map(v(this,Nt,Pf).bind(this));f<d&&([d,f,p,m]=[f,d,m,p]),o(this,Nt,zu).style.color="";let y=(w,C,E)=>{let S=new Array(256),N=(f-d)/E,k=w/255,M=(C-w)/(255*E),R=0;for(let j=0;j<=E;j++){let $=Math.round(d+j*N),q=k+j*M;for(let Q=R;Q<=$;Q++)S[Q]=q;R=$+1}for(let j=R;j<256;j++)S[j]=S[R-1];return S.join(",")},x=`g_${o(this,wa)}_hcm_${e}_filter`,b=c.filter=v(this,Nt,Gu).call(this,x);return v(this,Nt,Nw).call(this,b),v(this,Nt,Ff).call(this,y(p[0],m[0],5),y(p[1],m[1],5),y(p[2],m[2],5),b),c.url=v(this,Nt,ju).call(this,x),c.url}destroy(e=!1){e&&o(this,ac)?.size||(o(this,xa)?.parentNode.parentNode.remove(),g(this,xa,null),o(this,_h)?.clear(),g(this,_h,null),o(this,ac)?.clear(),g(this,ac,null),g(this,oc,0))}};sc=new WeakMap,_h=new WeakMap,xa=new WeakMap,wa=new WeakMap,Jn=new WeakMap,ac=new WeakMap,oc=new WeakMap,Nt=new WeakSet,Xn=function(){return o(this,_h)||g(this,_h,new Map)},Mf=function(){return o(this,ac)||g(this,ac,new Map)},zu=function(){if(!o(this,xa)){let e=o(this,Jn).createElement("div"),{style:n}=e;n.visibility="hidden",n.contain="strict",n.width=n.height=0,n.position="absolute",n.top=n.left=0,n.zIndex=-1;let i=o(this,Jn).createElementNS(ta,"svg");i.setAttribute("width",0),i.setAttribute("height",0),g(this,xa,o(this,Jn).createElementNS(ta,"defs")),e.append(i),i.append(o(this,xa)),o(this,Jn).body.append(e)}return o(this,xa)},M0=function(e){if(e.length===1){let u=e[0],h=new Array(256);for(let f=0;f<256;f++)h[f]=u[f]/255;let d=h.join(",");return[d,d,d]}let[n,i,s]=e,a=new Array(256),l=new Array(256),c=new Array(256);for(let u=0;u<256;u++)a[u]=n[u]/255,l[u]=i[u]/255,c[u]=s[u]/255;return[a.join(","),l.join(","),c.join(",")]},ju=function(e){if(o(this,sc)===void 0){g(this,sc,"");let n=o(this,Jn).URL;n!==o(this,Jn).baseURI&&(ag(n)?jt('#createUrl: ignore "data:"-URL for performance reasons.'):g(this,sc,y2(n,"")))}return`url(${o(this,sc)}#${e})`},AS=function(e){let n=o(this,Jn).createElementNS(ta,"feColorMatrix");n.setAttribute("type","matrix"),n.setAttribute("values","0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.3 0.59 0.11 0 0"),e.append(n)},Nw=function(e){let n=o(this,Jn).createElementNS(ta,"feColorMatrix");n.setAttribute("type","matrix"),n.setAttribute("values","0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0 0 0 1 0"),e.append(n)},Gu=function(e){let n=o(this,Jn).createElementNS(ta,"filter");return n.setAttribute("color-interpolation-filters","sRGB"),n.setAttribute("id",e),o(this,Nt,zu).append(n),n},Of=function(e,n,i){let s=o(this,Jn).createElementNS(ta,n);s.setAttribute("type","discrete"),s.setAttribute("tableValues",i),e.append(s)},Ff=function(e,n,i,s){let a=o(this,Jn).createElementNS(ta,"feComponentTransfer");s.append(a),v(this,Nt,Of).call(this,a,"feFuncR",e),v(this,Nt,Of).call(this,a,"feFuncG",n),v(this,Nt,Of).call(this,a,"feFuncB",i)},Iw=function(e,n){let i=o(this,Jn).createElementNS(ta,"feComponentTransfer");n.append(i),v(this,Nt,Of).call(this,i,"feFuncA",e)},Pf=function(e){return o(this,Nt,zu).style.color=e,Bd(getComputedStyle(o(this,Nt,zu)).getPropertyValue("color"))};Ki&&jt("Please use the `legacy` build in Node.js environments.");kw=class extends yy{},_w=class extends gy{_createCanvas(t,e){return nt.default.getBuiltinModule("module").createRequire("")("@napi-rs/canvas").createCanvas(t,e)}},Mw=class extends py{async _fetch(t,e){return PO(t)}},RO=`
|
|
16
16
|
struct Uniforms {
|
|
17
17
|
offsetX : f32,
|
|
18
18
|
offsetY : f32,
|
|
@@ -55,22 +55,22 @@ fn vs_main(in : VertexInput) -> VertexOutput {
|
|
|
55
55
|
fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
56
56
|
return vec4<f32>(in.color, 1.0);
|
|
57
57
|
}
|
|
58
|
-
`,Mw=class{constructor(){A(this,Rd);A(this,Vp,null);A(this,Mh,null);A(this,Oh,null);A(this,Fh,null)}init(){o(this,Vp)===null&&g(this,Vp,v(this,Rd,AS).call(this))}get isReady(){return o(this,Mh)!==null}draw(t,e,n,i,s,a){let l=o(this,Mh),{offsetX:c,offsetY:u,scaleX:h,scaleY:d}=e,{posData:f,colData:p,vertexCount:m}=v(this,Rd,vS).call(this,t,e),y=l.createBuffer({size:Math.max(f.byteLength,4),usage:GPUBufferUsage.VERTEX|GPUBufferUsage.COPY_DST});f.byteLength>0&&l.queue.writeBuffer(y,0,f);let x=l.createBuffer({size:Math.max(p.byteLength,4),usage:GPUBufferUsage.VERTEX|GPUBufferUsage.COPY_DST});p.byteLength>0&&l.queue.writeBuffer(x,0,p);let b=l.createBuffer({size:32,usage:GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST});l.queue.writeBuffer(b,0,new Float32Array([c,u,h,d,i,s,a,0]));let w=l.createBindGroup({layout:o(this,Oh).getBindGroupLayout(0),entries:[{binding:0,resource:{buffer:b}}]}),C=new OffscreenCanvas(i,s),E=C.getContext("webgpu");E.configure({device:l,format:o(this,Fh),alphaMode:n?"opaque":"premultiplied"});let S=n?{r:n[0]/255,g:n[1]/255,b:n[2]/255,a:1}:{r:0,g:0,b:0,a:0},N=l.createCommandEncoder(),k=N.beginRenderPass({colorAttachments:[{view:E.getCurrentTexture().createView(),clearValue:S,loadOp:"clear",storeOp:"store"}]});return m>0&&(k.setPipeline(o(this,Oh)),k.setBindGroup(0,w),k.setVertexBuffer(0,y),k.setVertexBuffer(1,x),k.draw(m)),k.end(),l.queue.submit([N.finish()]),y.destroy(),x.destroy(),b.destroy(),C.transferToImageBitmap()}};Vp=new WeakMap,Mh=new WeakMap,Oh=new WeakMap,Fh=new WeakMap,Rd=new WeakSet,AS=async function(){if(!globalThis.navigator?.gpu)return!1;try{let t=await navigator.gpu.requestAdapter();if(!t)return!1;g(this,Fh,navigator.gpu.getPreferredCanvasFormat());let e=g(this,Mh,await t.requestDevice()),n=e.createShaderModule({code:RO});return g(this,Oh,e.createRenderPipeline({layout:"auto",vertex:{module:n,entryPoint:"vs_main",buffers:[{arrayStride:8,attributes:[{shaderLocation:0,offset:0,format:"float32x2"}]},{arrayStride:4,attributes:[{shaderLocation:1,offset:0,format:"unorm8x4"}]}]},fragment:{module:n,entryPoint:"fs_main",targets:[{format:o(this,Fh)}]},primitive:{topology:"triangle-list"}})),!0}catch{return!1}},vS=function(t,e){let{coords:n,colors:i}=e,s=0;for(let d of t){let f=d.coords;if(d.type===Dl.TRIANGLES)s+=f.length;else if(d.type===Dl.LATTICE){let p=d.verticesPerRow;s+=(Math.floor(f.length/p)-1)*(p-1)*6}}let a=new Float32Array(s*2),l=new Uint8Array(s*4),c=0,u=0,h=(d,f)=>{a[c++]=n[d*2],a[c++]=n[d*2+1],l[u++]=i[f*4],l[u++]=i[f*4+1],l[u++]=i[f*4+2],u++};for(let d of t){let f=d.coords,p=d.colors;if(d.type===Dl.TRIANGLES)for(let m=0,y=f.length;m<y;m+=3)h(f[m],p[m]),h(f[m+1],p[m+1]),h(f[m+2],p[m+2]);else if(d.type===Dl.LATTICE){let m=d.verticesPerRow,y=Math.floor(f.length/m)-1,x=m-1;for(let b=0;b<y;b++){let w=b*m;for(let C=0;C<x;C++,w++)h(f[w],p[w]),h(f[w+1],p[w+1]),h(f[w+m],p[w+m]),h(f[w+m+1],p[w+m+1]),h(f[w+1],p[w+1]),h(f[w+m],p[w+m])}}}return{posData:a,colData:l,vertexCount:s}};xA=new Mw;Gn={FILL:"Fill",STROKE:"Stroke",SHADING:"Shading"};ap=class{isModifyingCurrentTransform(){return!1}getPattern(){ue("Abstract method `getPattern` called.")}},Ow=class extends ap{constructor(t){super(),this._type=t[1],this._bbox=t[2],this._colorStops=t[3],this._p0=t[4],this._p1=t[5],this._r0=t[6],this._r1=t[7],this.matrix=null}isOriginBased(){return this._p0[0]===0&&this._p0[1]===0&&(!this.isRadial()||this._p1[0]===0&&this._p1[1]===0)}isRadial(){return this._type==="radial"}_isCircleCenterOutside(){return!this.isRadial()||this._r0>this._r1?!1:Math.hypot(this._p0[0]-this._p1[0],this._p0[1]-this._p1[1])>this._r1}_createGradient(t,e=null){let n,i=this._p0,s=this._p1;if(e&&(i=i.slice(),s=s.slice(),yt.applyTransform(i,e),yt.applyTransform(s,e)),this._type==="axial")n=t.createLinearGradient(i[0],i[1],s[0],s[1]);else if(this._type==="radial"){let a=this._r0,l=this._r1;if(e){let c=new Float32Array(2);yt.singularValueDecompose2dScale(e,c),a*=c[0],l*=c[0]}n=t.createRadialGradient(i[0],i[1],a,s[0],s[1],l)}for(let a of this._colorStops)n.addColorStop(a[0],a[1]);return n}_createReversedGradient(t,e=null){let n=this._p1,i=this._p0;e&&(n=n.slice(),i=i.slice(),yt.applyTransform(n,e),yt.applyTransform(i,e));let s=this._r1,a=this._r0;if(e){let u=new Float32Array(2);yt.singularValueDecompose2dScale(e,u),s*=u[0],a*=u[0]}let l=t.createRadialGradient(n[0],n[1],s,i[0],i[1],a),c=this._colorStops.map(([u,h])=>[1-u,h]).reverse();for(let[u,h]of c)l.addColorStop(u,h);return l}getPattern(t,e,n,i){let s;if(i===Gn.STROKE||i===Gn.FILL){if(this.isOriginBased()){let f=yt.transform(n,e.baseTransform);this.matrix&&(f=yt.transform(f,this.matrix));let p=.001,m=Math.hypot(f[0],f[1]),y=Math.hypot(f[2],f[3]),x=(f[0]*f[2]+f[1]*f[3])/(m*y);if(Math.abs(x)<p)if(this.isRadial()){if(Math.abs(m-y)<p)return this._createGradient(t,f)}else return this._createGradient(t,f)}let a=e.current.getClippedPathBoundingBox(i,Le(t))||[0,0,0,0],l=Math.ceil(a[2]-a[0])||1,c=Math.ceil(a[3]-a[1])||1,u=e.canvasFactory.create(l,c),h=u.context;h.clearRect(0,0,h.canvas.width,h.canvas.height),h.beginPath(),h.rect(0,0,h.canvas.width,h.canvas.height),h.translate(-a[0],-a[1]),n=yt.transform(n,[1,0,0,1,a[0],a[1]]),h.transform(...e.baseTransform),this.matrix&&h.transform(...this.matrix),O0(h,this._bbox),this._isCircleCenterOutside()&&(h.fillStyle=this._createReversedGradient(h),h.fill()),h.fillStyle=this._createGradient(h),h.fill(),s=t.createPattern(u.canvas,"no-repeat"),e.canvasFactory.destroy(u);let d=new DOMMatrix(n);s.setTransform(d)}else this._isCircleCenterOutside()&&(t.save(),O0(t,this._bbox),t.fillStyle=this._createReversedGradient(t),t.fillRect(-1e10,-1e10,2e10,2e10),t.restore()),O0(t,this._bbox),s=this._createGradient(t);return s}};Fw=class extends ap{constructor(t){super(),this._coords=t[2],this._colors=t[3],this._figures=t[4],this._bounds=t[5],this._bbox=t[6],this._background=t[7],this.matrix=null}_createMeshCanvas(t,e,n){let l=Math.floor(this._bounds[0]),c=Math.floor(this._bounds[1]),u=Math.ceil(this._bounds[2])-l,h=Math.ceil(this._bounds[3])-c,d=Math.min(Math.ceil(Math.abs(u*t[0]*1.1)),3e3)||1,f=Math.min(Math.ceil(Math.abs(h*t[1]*1.1)),3e3)||1,p=u?u/d:1,m=h?h/f:1,y={coords:this._coords,colors:this._colors,offsetX:-l,offsetY:-c,scaleX:1/p,scaleY:1/m},x=d+4,b=f+4,w=n.create(x,b);if(BO())w.context.drawImage(UO(this._figures,y,e,x,b,2),0,0);else{let C=w.context.createImageData(d,f);if(e){let E=C.data;for(let S=0,N=E.length;S<N;S+=4)E[S]=e[0],E[S+1]=e[1],E[S+2]=e[2],E[S+3]=255}for(let E of this._figures)$O(C,E,y);w.context.putImageData(C,2,2)}return{canvas:w.canvas,offsetX:l-2*p,offsetY:c-2*m,scaleX:p,scaleY:m}}isModifyingCurrentTransform(){return!0}getPattern(t,e,n,i){O0(t,this._bbox);let s=new Float32Array(2);if(i===Gn.SHADING)yt.singularValueDecompose2dScale(Le(t),s);else if(this.matrix){yt.singularValueDecompose2dScale(this.matrix,s);let[c,u]=s;yt.singularValueDecompose2dScale(e.baseTransform,s),s[0]*=c,s[1]*=u}else yt.singularValueDecompose2dScale(e.baseTransform,s);let a=this._createMeshCanvas(s,i===Gn.SHADING?null:this._background,e.canvasFactory);i!==Gn.SHADING&&(t.setTransform(...e.baseTransform),this.matrix&&t.transform(...this.matrix)),t.translate(a.offsetX,a.offsetY),t.scale(a.scaleX,a.scaleY);let l=t.createPattern(a.canvas,"no-repeat");return e.canvasFactory.destroy(a),l}},Pw=class extends ap{getPattern(){return"hotpink"}};mT={COLORED:1,UNCOLORED:2},Xy=class Xy{constructor(t,e,n,i){this.color=t[1],this.operatorList=t[2],this.matrix=t[3],this.bbox=t[4],this.xstep=t[5],this.ystep=t[6],this.paintType=t[7],this.tilingType=t[8],this.ctx=e,this.canvasGraphicsFactory=n,this.baseTransform=i}createPatternCanvas(t,e){let{bbox:n,operatorList:i,paintType:s,tilingType:a,color:l,canvasGraphicsFactory:c}=this,{xstep:u,ystep:h}=this;u=Math.abs(u),h=Math.abs(h),ob("TilingType: "+a);let d=n[0],f=n[1],p=n[2],m=n[3],y=p-d,x=m-f,b=new Float32Array(2);yt.singularValueDecompose2dScale(this.matrix,b);let[w,C]=b;yt.singularValueDecompose2dScale(this.baseTransform,b);let E=w*b[0],S=C*b[1],N=y,k=x,M=!1,R=!1,j=Math.ceil(u*E),$=Math.ceil(h*S),q=Math.ceil(y*E),Q=Math.ceil(x*S);j>=q?N=u:M=!0,$>=Q?k=h:R=!0;let Z=this.getSizeAndScale(N,this.ctx.canvas.width,E),Y=this.getSizeAndScale(k,this.ctx.canvas.height,S),X=t.canvasFactory.create(Z.size,Y.size),T=X.context,I=c.createCanvasGraphics(T,e);if(I.groupLevel=t.groupLevel,this.setFillAndStrokeStyleToContext(I,s,l),T.translate(-Z.scale*d,-Y.scale*f),I.transform(0,Z.scale,0,0,Y.scale,0,0),T.save(),I.dependencyTracker?.save(),this.clipBbox(I,d,f,p,m),I.baseTransform=Le(I.ctx),I.executeOperatorList(i),I.endDrawing(),I.dependencyTracker?.restore(),T.restore(),M||R){let _=X.canvas;M&&(N=u),R&&(k=h);let W=this.getSizeAndScale(N,this.ctx.canvas.width,E),z=this.getSizeAndScale(k,this.ctx.canvas.height,S),D=W.size,F=z.size,P=t.canvasFactory.create(D,F),G=P.context,H=M?Math.floor(y/u):0,V=R?Math.floor(x/h):0;for(let L=0;L<=H;L++)for(let tt=0;tt<=V;tt++)G.drawImage(_,D*L,F*tt,D,F,0,0,D,F);return t.canvasFactory.destroy(X),{canvas:P.canvas,canvasEntry:P,scaleX:W.scale,scaleY:z.scale,offsetX:d,offsetY:f}}return{canvas:X.canvas,canvasEntry:X,scaleX:Z.scale,scaleY:Y.scale,offsetX:d,offsetY:f}}getSizeAndScale(t,e,n){let i=Math.max(Xy.MAX_PATTERN_SIZE,e),s=Math.ceil(t*n);return s>=i?s=i:n=s/t,{scale:n,size:s}}clipBbox(t,e,n,i,s){let a=i-e,l=s-n;t.ctx.rect(e,n,a,l),yt.axialAlignedBoundingBox([e,n,i,s],Le(t.ctx),t.current.minMax),t.clip(),t.endPath()}setFillAndStrokeStyleToContext(t,e,n){let i=t.ctx,s=t.current;switch(e){case mT.COLORED:let{fillStyle:a,strokeStyle:l}=this.ctx;i.fillStyle=s.fillColor=a,i.strokeStyle=s.strokeColor=l;break;case mT.UNCOLORED:i.fillStyle=i.strokeStyle=n,s.fillColor=s.strokeColor=n;break;default:throw new Ux(`Unsupported paint type: ${e}`)}}isModifyingCurrentTransform(){return!1}getPattern(t,e,n,i,s){let a=n;i!==Gn.SHADING&&(a=yt.transform(a,e.baseTransform),this.matrix&&(a=yt.transform(a,this.matrix)));let l=this.createPatternCanvas(e,s),c=new DOMMatrix(a);c=c.translate(l.offsetX,l.offsetY),c=c.scale(1/l.scaleX,1/l.scaleY);let u=t.createPattern(l.canvas,"repeat");return e.canvasFactory.destroy(l.canvasEntry),u.setTransform(c),u}};U(Xy,"MAX_PATTERN_SIZE",3e3);Rw=Xy;gT=16,yT=100,GO=15,bT=10,Si=16,Px=new DOMMatrix,Zi=new Float32Array(2),Ku=new Float32Array([1/0,1/0,-1/0,-1/0]);by=class{constructor(t,e){U(this,"alphaIsShape",!1);U(this,"fontSize",0);U(this,"fontSizeScale",1);U(this,"textMatrix",null);U(this,"textMatrixScale",1);U(this,"fontMatrix",Lx);U(this,"leading",0);U(this,"x",0);U(this,"y",0);U(this,"lineX",0);U(this,"lineY",0);U(this,"charSpacing",0);U(this,"wordSpacing",0);U(this,"textHScale",1);U(this,"textRenderingMode",pn.FILL);U(this,"textRise",0);U(this,"fillColor","#000000");U(this,"strokeColor","#000000");U(this,"patternFill",!1);U(this,"patternStroke",!1);U(this,"fillAlpha",1);U(this,"strokeAlpha",1);U(this,"lineWidth",1);U(this,"activeSMask",null);U(this,"transferMaps","none");U(this,"minMax",Ku.slice());this.clipBox=new Float32Array([0,0,t,e])}clone(){let t=Object.create(this);return t.clipBox=this.clipBox.slice(),t.minMax=this.minMax.slice(),t}getPathBoundingBox(t=Gn.FILL,e=null){let n=this.minMax.slice();if(t===Gn.STROKE){e||ue("Stroke bounding box must include transform."),yt.singularValueDecompose2dScale(e,Zi);let i=Zi[0]*this.lineWidth/2,s=Zi[1]*this.lineWidth/2;n[0]-=i,n[1]-=s,n[2]+=i,n[3]+=s}return n}updateClipFromPath(){let t=yt.intersect(this.clipBox,this.getPathBoundingBox());this.startNewPathAndClipBox(t||[0,0,0,0])}isEmptyClip(){return this.minMax[0]===1/0}startNewPathAndClipBox(t){this.clipBox.set(t,0),this.minMax.set(Ku,0)}getClippedPathBoundingBox(t=Gn.FILL,e=null){return yt.intersect(this.clipBox,this.getPathBoundingBox(t,e))}};WO=["butt","round","square"],qO=["miter","round","bevel"],VO={},vT={},CA=class CA{constructor(t,e,n,i,s,{optionalContentConfig:a,markedContentStack:l=null},c,u,h,d){A(this,Jr);this.ctx=t,this.current=new by(this.ctx.canvas.width,this.ctx.canvas.height),this.stateStack=[],this.pendingClip=null,this.pendingEOFill=!1,this.commonObjs=e,this.objs=n,this.canvasFactory=i,this.filterFactory=s,this.groupStack=[],this.baseTransform=null,this.baseTransformStack=[],this.groupLevel=0,this.smaskStack=[],this.smaskCounter=0,this.tempSMask=null,this.smaskGroupCanvases=[],this.suspendedCtx=null,this.contentVisible=!0,this.markedContentStack=l||[],this.optionalContentConfig=a,this.cachedPatterns=new Map,this.annotationCanvasMap=c,this.viewportScale=1,this.outputScaleX=1,this.outputScaleY=1,this.pageColors=u,this._cachedScaleForStroking=[-1,0],this._cachedGetSinglePixelWidth=null,this._cachedBitmapsMap=new Map,this.dependencyTracker=h??null,this.imagesTracker=d??null}getObject(t,e,n=null){return typeof e=="string"?(this.dependencyTracker?.recordNamedDependency(t,e),e.startsWith("g_")?this.commonObjs.get(e):this.objs.get(e)):n}beginDrawing({transform:t,viewport:e,transparency:n=!1,background:i=null}){let s=this.ctx.canvas.width,a=this.ctx.canvas.height,l=this.ctx.fillStyle;if(this.ctx.fillStyle=i||"#ffffff",this.ctx.fillRect(0,0,s,a),this.ctx.fillStyle=l,n){let c=this.transparentCanvasEntry=this.canvasFactory.create(s,a);this.compositeCtx=this.ctx,{canvas:this.transparentCanvas,context:this.ctx}=c,this.ctx.save(),this.ctx.transform(...Le(this.compositeCtx))}this.ctx.save(),p0(this.ctx),t&&(this.ctx.transform(...t),this.outputScaleX=t[0],this.outputScaleY=t[0]),this.ctx.transform(...e.transform),this.viewportScale=e.scale,this.baseTransform=Le(this.ctx)}executeOperatorList(t,e,n,i,s){let a=t.argsArray,l=t.fnArray,c=e||0,u=a.length;if(u===c)return c;let h=u-c>bT&&typeof n=="function",d=h?Date.now()+GO:0,f=0,p=this.commonObjs,m=this.objs,y,x;for(;;){if(i!==void 0){if(c===i.nextBreakPoint)return i.breakIt(c,n),c;if(i.shouldSkip(c)){if(++c===u)return c;continue}}if(!s||s(c))if(y=l[c],x=a[c]??null,y!==Nd.dependency)x===null?this[y](c):this[y](c,...x);else for(let b of x){this.dependencyTracker?.recordNamedData(b,c);let w=b.startsWith("g_")?p:m;if(!w.has(b))return w.get(b,n),c}if(c++,c===u)return c;if(h&&++f>bT){if(Date.now()>d)return n(),c;f=0}}}endDrawing(){v(this,Jr,Lw).call(this);for(let t of this.smaskGroupCanvases)this.canvasFactory.destroy(t);this.smaskGroupCanvases.length=0,this.tempSMask=null,this.smaskStack.length=0,this.cachedPatterns.clear();for(let t of this._cachedBitmapsMap.values()){for(let e of t.values())typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement&&(e.width=e.height=0);t.clear()}this._cachedBitmapsMap.clear(),v(this,Jr,Bw).call(this)}_scaleImage(t,e){let n=t.width??t.displayWidth,i=t.height??t.displayHeight,s=Math.max(Math.hypot(e[0],e[1]),1),a=Math.max(Math.hypot(e[2],e[3]),1),l=[],c=s,u=a,h=n,d=i;for(;c>2&&h>1||u>2&&d>1;){let b=h,w=d;c>2&&h>1&&(b=h>=16384?Math.floor(h/2)-1||1:Math.ceil(h/2),c/=h/b),u>2&&d>1&&(w=d>=16384?Math.floor(d/2)-1||1:Math.ceil(d)/2,u/=d/w),l.push({newWidth:b,newHeight:w}),h=b,d=w}if(l.length===0)return{img:t,paintWidth:n,paintHeight:i,tmpCanvas:null};if(l.length===1){let{newWidth:b,newHeight:w}=l[0],C=this.canvasFactory.create(b,w);return C.context.drawImage(t,0,0,n,i,0,0,b,w),{img:C.canvas,paintWidth:b,paintHeight:w,tmpCanvas:C}}let f=this.canvasFactory.create(1,1),p=this.canvasFactory.create(1,1),m=n,y=i,x=t;for(let{newWidth:b,newHeight:w}of l)this.canvasFactory.reset(p,b,w),p.context.drawImage(x,0,0,m,y,0,0,b,w),[f,p]=[p,f],x=f.canvas,m=b,y=w;return this.canvasFactory.destroy(p),{img:f.canvas,paintWidth:m,paintHeight:y,tmpCanvas:f}}_createMaskCanvas(t,e){let n=this.ctx,{width:i,height:s}=e,a=this.current.fillColor,l=this.current.patternFill,c=Le(n),u,h,d,f;if((e.bitmap||e.data)&&e.count>1){let $=e.bitmap||e.data.buffer;h=JSON.stringify(l?c:[c.slice(0,4),a]),u=this._cachedBitmapsMap.getOrInsertComputed($,ub);let q=u.get(h);if(q&&!l){let Q=Math.round(Math.min(c[0],c[2])+c[4]),Z=Math.round(Math.min(c[1],c[3])+c[5]);return this.dependencyTracker?.recordDependencies(t,hr.transformAndFill),{canvas:q,offsetX:Q,offsetY:Z}}d=q}d||(f=this.canvasFactory.create(i,s),wT(f.context,e));let p=yt.transform(c,[1/i,0,0,-1/s,0,0]);p=yt.transform(p,[1,0,0,1,0,-s]);let m=Ku.slice();yt.axialAlignedBoundingBox([0,0,i,s],p,m);let[y,x,b,w]=m,C=Math.round(b-y)||1,E=Math.round(w-x)||1,S=this.canvasFactory.create(C,E),N=S.context,k=y,M=x;N.translate(-k,-M),N.transform(...p);let R=null;if(!d){let $=this._scaleImage(f.canvas,hs(N));d=$.img,R=$.tmpCanvas,d!==f.canvas&&(this.canvasFactory.destroy(f),f=null),u&&l&&(u.set(h,d),R=null,f=null)}N.imageSmoothingEnabled=AT(Le(N),e.interpolate),f0(N,d,0,0,d.width,d.height,0,0,i,s),R&&this.canvasFactory.destroy(R),f&&this.canvasFactory.destroy(f),N.globalCompositeOperation="source-in";let j=yt.transform(hs(N),[1,0,0,1,-k,-M]);return N.fillStyle=l?a.getPattern(n,this,j,Gn.FILL,t):a,N.fillRect(0,0,i,s),u&&!l&&u.set(h,S.canvas),this.dependencyTracker?.recordDependencies(t,hr.transformAndFill),{canvas:S.canvas,canvasEntry:u&&!l?null:S,offsetX:Math.round(k),offsetY:Math.round(M)}}setLineWidth(t,e){this.dependencyTracker?.recordSimpleData("lineWidth",t),e!==this.current.lineWidth&&(this._cachedScaleForStroking[0]=-1),this.current.lineWidth=e,this.ctx.lineWidth=e}setLineCap(t,e){this.dependencyTracker?.recordSimpleData("lineCap",t),this.ctx.lineCap=WO[e]}setLineJoin(t,e){this.dependencyTracker?.recordSimpleData("lineJoin",t),this.ctx.lineJoin=qO[e]}setMiterLimit(t,e){this.dependencyTracker?.recordSimpleData("miterLimit",t),this.ctx.miterLimit=e}setDash(t,e,n){this.dependencyTracker?.recordSimpleData("dash",t);let i=this.ctx;i.setLineDash!==void 0&&(i.setLineDash(e),i.lineDashOffset=n)}setRenderingIntent(t,e){}setFlatness(t,e){}setGState(t,e){for(let[n,i]of e)switch(n){case"LW":this.setLineWidth(t,i);break;case"LC":this.setLineCap(t,i);break;case"LJ":this.setLineJoin(t,i);break;case"ML":this.setMiterLimit(t,i);break;case"D":this.setDash(t,i[0],i[1]);break;case"RI":this.setRenderingIntent(t,i);break;case"FL":this.setFlatness(t,i);break;case"Font":this.setFont(t,i[0],i[1]);break;case"CA":this.dependencyTracker?.recordSimpleData("strokeAlpha",t),this.current.strokeAlpha=i;break;case"ca":this.dependencyTracker?.recordSimpleData("fillAlpha",t),this.ctx.globalAlpha=this.current.fillAlpha=i;break;case"BM":this.dependencyTracker?.recordSimpleData("globalCompositeOperation",t),this.ctx.globalCompositeOperation=i;break;case"SMask":this.dependencyTracker?.recordSimpleData("SMask",t),this.current.activeSMask=i?this.tempSMask:null,this.tempSMask=null,this.checkSMaskState();break;case"TR":this.dependencyTracker?.recordSimpleData("filter",t),this.ctx.filter=this.current.transferMaps=this.filterFactory.addFilter(i);break}}get inSMaskMode(){return!!this.suspendedCtx}checkSMaskState(){let t=this.inSMaskMode;this.current.activeSMask&&!t?this.beginSMaskMode():!this.current.activeSMask&&t&&this.endSMaskMode()}beginSMaskMode(t){if(this.inSMaskMode)throw new Error("beginSMaskMode called while already in smask mode");let e=this.ctx.canvas.width,n=this.ctx.canvas.height,i=this.canvasFactory.create(e,n);this.smaskScratchCanvas=i,this.suspendedCtx=this.ctx;let s=this.ctx=i.context;s.setTransform(this.suspendedCtx.getTransform()),vf(this.suspendedCtx,s),HO(s,this.suspendedCtx),this.setGState(t,[["BM","source-over"]])}endSMaskMode(){if(!this.inSMaskMode)throw new Error("endSMaskMode called while not in smask mode");this.ctx._removeMirroring(),vf(this.ctx,this.suspendedCtx),this.ctx=this.suspendedCtx,this.suspendedCtx=null,this.canvasFactory.destroy(this.smaskScratchCanvas),this.smaskScratchCanvas=null}compose(t){if(!this.current.activeSMask)return;t?(t[0]=Math.floor(t[0]),t[1]=Math.floor(t[1]),t[2]=Math.ceil(t[2]),t[3]=Math.ceil(t[3])):t=[0,0,this.ctx.canvas.width,this.ctx.canvas.height];let e=this.current.activeSMask,n=this.suspendedCtx;this.composeSMask(n,e,this.ctx,t),this.ctx.save(),this.ctx.setTransform(1,0,0,1,0,0),this.ctx.clearRect(0,0,this.ctx.canvas.width,this.ctx.canvas.height),this.ctx.restore()}composeSMask(t,e,n,i){let s=i[0],a=i[1],l=i[2]-s,c=i[3]-a;l===0||c===0||(this.genericComposeSMask(e.context,n,l,c,e.subtype,e.backdrop,e.transferMap,s,a,e.offsetX,e.offsetY),t.save(),t.globalAlpha=1,t.globalCompositeOperation="source-over",t.setTransform(1,0,0,1,0,0),t.drawImage(n.canvas,0,0),t.restore())}genericComposeSMask(t,e,n,i,s,a,l,c,u,h,d){let f=t.canvas,p=c-h,m=u-d,y=null;if(a)if(p<0||m<0||p+n>f.width||m+i>f.height){y=this.canvasFactory.create(n,i);let b=y.context;b.drawImage(f,-p,-m),b.globalCompositeOperation="destination-atop",b.fillStyle=a,b.fillRect(0,0,n,i),b.globalCompositeOperation="source-over",f=y.canvas,p=m=0}else{t.save(),t.globalAlpha=1,t.setTransform(1,0,0,1,0,0);let b=new Path2D;b.rect(p,m,n,i),t.clip(b),t.globalCompositeOperation="destination-atop",t.fillStyle=a,t.fillRect(p,m,n,i),t.restore()}e.save(),e.globalAlpha=1,e.setTransform(1,0,0,1,0,0),s==="Alpha"&&l?e.filter=this.filterFactory.addAlphaFilter(l):s==="Luminosity"&&(e.filter=this.filterFactory.addLuminosityFilter(l));let x=new Path2D;x.rect(c,u,n,i),e.clip(x),e.globalCompositeOperation="destination-in",e.drawImage(f,p,m,n,i,c,u,n,i),e.restore(),y&&this.canvasFactory.destroy(y)}save(t){this.inSMaskMode&&vf(this.ctx,this.suspendedCtx),this.ctx.save();let e=this.current;this.stateStack.push(e),this.current=e.clone(),this.dependencyTracker?.save(t)}restore(t){if(this.dependencyTracker?.restore(t),this.stateStack.length===0){this.inSMaskMode&&this.endSMaskMode();return}this.current=this.stateStack.pop(),this.ctx.restore(),this.inSMaskMode&&vf(this.suspendedCtx,this.ctx),this.checkSMaskState(),this.pendingClip=null,this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null}transform(t,e,n,i,s,a,l){this.dependencyTracker?.recordIncrementalData("transform",t),this.ctx.transform(e,n,i,s,a,l),this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null}constructPath(t,e,n,i){let[s]=n;if(!i){s||(s=n[0]=new Path2D),this[e](t,s);return}if(this.dependencyTracker!==null){let a=e===Nd.stroke?this.current.lineWidth/2:0;this.dependencyTracker.resetBBox(t).recordBBox(t,this.ctx,i[0]-a,i[2]+a,i[1]-a,i[3]+a).recordDependencies(t,["transform"])}s instanceof Path2D||(s=n[0]=RT(s)),yt.axialAlignedBoundingBox(i,Le(this.ctx),this.current.minMax),this[e](t,s),this._pathStartIdx=t}closePath(t){this.ctx.closePath()}stroke(t,e,n=!0){let i=this.ctx,s=this.current.strokeColor;if(i.globalAlpha=this.current.strokeAlpha,this.contentVisible)if(typeof s=="object"&&s?.getPattern){let a=s.isModifyingCurrentTransform()?i.getTransform():null;if(i.save(),i.strokeStyle=s.getPattern(i,this,hs(i),Gn.STROKE,t),a){let l=new Path2D;l.addPath(e,i.getTransform().invertSelf().multiplySelf(a)),e=l}this.rescaleAndStroke(e,!1),i.restore()}else this.rescaleAndStroke(e,!0);this.dependencyTracker?.recordDependencies(t,hr.stroke),n&&this.consumePath(t,e,this.current.getClippedPathBoundingBox(Gn.STROKE,Le(this.ctx))),i.globalAlpha=this.current.fillAlpha}closeStroke(t,e){this.stroke(t,e)}fill(t,e,n=!0){let i=this.ctx,s=this.current.fillColor,a=this.current.patternFill,l=!1;if(a){let u=s.isModifyingCurrentTransform()?i.getTransform():null;if(this.dependencyTracker?.save(t),i.save(),i.fillStyle=s.getPattern(i,this,hs(i),Gn.FILL,t),u){let h=new Path2D;h.addPath(e,i.getTransform().invertSelf().multiplySelf(u)),e=h}l=!0}let c=this.current.getClippedPathBoundingBox();this.contentVisible&&c!==null&&(this.pendingEOFill?(i.fill(e,"evenodd"),this.pendingEOFill=!1):i.fill(e)),this.dependencyTracker?.recordDependencies(t,hr.fill),l&&(i.restore(),this.dependencyTracker?.restore(t)),n&&this.consumePath(t,e,c)}eoFill(t,e){this.pendingEOFill=!0,this.fill(t,e)}fillStroke(t,e){this.fill(t,e,!1),this.stroke(t,e,!1),this.consumePath(t,e)}eoFillStroke(t,e){this.pendingEOFill=!0,this.fillStroke(t,e)}closeFillStroke(t,e){this.fillStroke(t,e)}closeEOFillStroke(t,e){this.pendingEOFill=!0,this.fillStroke(t,e)}endPath(t,e){this.consumePath(t,e)}rawFillPath(t,e){this.ctx.fill(e),this.dependencyTracker?.recordDependencies(t,hr.rawFillPath).recordOperation(t)}clip(t){this.dependencyTracker?.recordFutureForcedDependency("clipMode",t),this.pendingClip=VO}eoClip(t){this.dependencyTracker?.recordFutureForcedDependency("clipMode",t),this.pendingClip=vT}beginText(t){this.current.textMatrix=null,this.current.textMatrixScale=1,this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0,this.dependencyTracker?.recordOpenMarker(t).resetIncrementalData("sameLineText").resetIncrementalData("moveText",t)}endText(t){let e=this.pendingTextPaths,n=this.ctx;if(this.dependencyTracker){let{dependencyTracker:i}=this;e!==void 0&&i.recordFutureForcedDependency("textClip",i.getOpenMarker()).recordFutureForcedDependency("textClip",t),i.recordCloseMarker(t)}if(e!==void 0){let i=new Path2D,s=n.getTransform().invertSelf();for(let{transform:a,x:l,y:c,fontSize:u,path:h}of e)h&&i.addPath(h,new DOMMatrix(a).preMultiplySelf(s).translate(l,c).scale(u,-u));n.clip(i)}delete this.pendingTextPaths}setCharSpacing(t,e){this.dependencyTracker?.recordSimpleData("charSpacing",t),this.current.charSpacing=e}setWordSpacing(t,e){this.dependencyTracker?.recordSimpleData("wordSpacing",t),this.current.wordSpacing=e}setHScale(t,e){this.dependencyTracker?.recordSimpleData("hScale",t),this.current.textHScale=e/100}setLeading(t,e){this.dependencyTracker?.recordSimpleData("leading",t),this.current.leading=-e}setFont(t,e,n){this.dependencyTracker?.recordSimpleData("font",t).recordSimpleDataFromNamed("fontObj",e,t);let i=this.commonObjs.get(e),s=this.current;if(!i)throw new Error(`Can't find font for ${e}`);if(s.fontMatrix=i.fontMatrix||Lx,(s.fontMatrix[0]===0||s.fontMatrix[3]===0)&&jt("Invalid font matrix for font "+e),n<0?(n=-n,s.fontDirection=-1):s.fontDirection=1,this.current.font=i,this.current.fontSize=n,i.isType3Font)return;let a=i.loadedName||"sans-serif",l=i.systemFontInfo?.css||`"${a}", ${i.fallbackName}`,c="normal";i.black?c="900":i.bold&&(c="bold");let u=i.italic?"italic":"normal",h=n;n<gT?h=gT:n>yT&&(h=yT),this.current.fontSizeScale=n/h,this.ctx.font=`${u} ${c} ${h}px ${l}`}setTextRenderingMode(t,e){this.dependencyTracker?.recordSimpleData("textRenderingMode",t),this.current.textRenderingMode=e}setTextRise(t,e){this.dependencyTracker?.recordSimpleData("textRise",t),this.current.textRise=e}moveText(t,e,n){this.dependencyTracker?.resetIncrementalData("sameLineText").recordIncrementalData("moveText",t),this.current.x=this.current.lineX+=e,this.current.y=this.current.lineY+=n}setLeadingMoveText(t,e,n){this.setLeading(t,-n),this.moveText(t,e,n)}setTextMatrix(t,e){this.dependencyTracker?.resetIncrementalData("sameLineText").recordSimpleData("textMatrix",t);let{current:n}=this;n.textMatrix=e,n.textMatrixScale=Math.hypot(e[0],e[1]),n.x=n.lineX=0,n.y=n.lineY=0}nextLine(t){this.moveText(t,0,this.current.leading),this.dependencyTracker?.recordIncrementalData("moveText",this.dependencyTracker.getSimpleIndex("leading")??t)}paintChar(t,e,n,i,s,a){let l=this.ctx,c=this.current,u=c.font,h=c.textRenderingMode,d=c.fontSize/c.fontSizeScale,f=h&pn.FILL_STROKE_MASK,p=!!(h&pn.ADD_TO_PATH_FLAG),m=c.patternFill&&!u.missingFile,y=c.patternStroke&&!u.missingFile,x;if((u.disableFontFace||p||m||y)&&!u.missingFile&&(x=u.getPathGenerator(this.commonObjs,e)),x&&(u.disableFontFace||m||y)){l.save(),l.translate(n,i),l.scale(d,-d),this.dependencyTracker?.recordCharacterBBox(t,l,u);let b;if(f===pn.FILL||f===pn.FILL_STROKE)if(s){b=l.getTransform(),l.setTransform(...s);let w=v(this,Jr,Uw).call(this,x,b,s);l.fill(w)}else l.fill(x);if(f===pn.STROKE||f===pn.FILL_STROKE)if(a){b||(b=l.getTransform()),l.setTransform(...a);let{a:w,b:C,c:E,d:S}=b,N=yt.inverseTransform(a),k=yt.transform([w,C,E,S,0,0],N);yt.singularValueDecompose2dScale(k,Zi),l.lineWidth*=Math.max(Zi[0],Zi[1])/d,l.stroke(v(this,Jr,Uw).call(this,x,b,a))}else l.lineWidth/=d,l.stroke(x);l.restore()}else(f===pn.FILL||f===pn.FILL_STROKE)&&(l.fillText(e,n,i),this.dependencyTracker?.recordCharacterBBox(t,l,u,d,n,i,()=>l.measureText(e))),(f===pn.STROKE||f===pn.FILL_STROKE)&&(this.dependencyTracker&&this.dependencyTracker?.recordCharacterBBox(t,l,u,d,n,i,()=>l.measureText(e)).recordDependencies(t,hr.stroke),l.strokeText(e,n,i));p&&((this.pendingTextPaths||(this.pendingTextPaths=[])).push({transform:Le(l),x:n,y:i,fontSize:d,path:x}),this.dependencyTracker?.recordCharacterBBox(t,l,u,d,n,i))}get isFontSubpixelAAEnabled(){let t=this.canvasFactory.create(10,10),e=t.context;e.scale(1.5,1),e.fillText("I",0,10);let n=e.getImageData(0,0,10,10).data;this.canvasFactory.destroy(t);let i=!1;for(let s=3;s<n.length;s+=4)if(n[s]>0&&n[s]<255){i=!0;break}return Ut(this,"isFontSubpixelAAEnabled",i)}showText(t,e){this.dependencyTracker&&(this.dependencyTracker.recordDependencies(t,hr.showText).resetBBox(t),this.current.textRenderingMode&pn.ADD_TO_PATH_FLAG&&this.dependencyTracker.recordFutureForcedDependency("textClip",t).inheritPendingDependenciesAsFutureForcedDependencies());let n=this.current,i=n.font;if(i.isType3Font){this.showType3Text(t,e),this.dependencyTracker?.recordShowTextOperation(t);return}let s=n.fontSize;if(s===0){this.dependencyTracker?.recordOperation(t);return}let a=this.ctx,l=n.fontSizeScale,c=n.charSpacing,u=n.wordSpacing,h=n.fontDirection,d=n.textHScale*h,f=e.length,p=i.vertical,m=p?1:-1,y=i.defaultVMetrics,x=s*n.fontMatrix[0],b=n.textRenderingMode===pn.FILL&&!i.disableFontFace&&!n.patternFill;a.save(),n.textMatrix&&a.transform(...n.textMatrix),a.translate(n.x,n.y+n.textRise),h>0?a.scale(d,-1):a.scale(d,1);let w,C,E=n.textRenderingMode&pn.FILL_STROKE_MASK,S=E===pn.FILL||E===pn.FILL_STROKE,N=E===pn.STROKE||E===pn.FILL_STROKE;if(S&&n.patternFill){a.save();let $=n.fillColor.getPattern(a,this,hs(a),Gn.FILL,t);w=Le(a),a.restore(),a.fillStyle=$}if(N&&n.patternStroke){a.save();let $=n.strokeColor.getPattern(a,this,hs(a),Gn.STROKE,t);C=Le(a),a.restore(),a.strokeStyle=$}let k=n.lineWidth,M=n.textMatrixScale;if(M===0||k===0?N&&(k=this.getSinglePixelWidth()):k/=M,l!==1&&(a.scale(l,l),k/=l),a.lineWidth=k,i.isInvalidPDFjsFont){let $=[],q=0;for(let Z of e)$.push(Z.unicode),q+=Z.width;let Q=$.join("");if(a.fillText(Q,0,0),this.dependencyTracker!==null){let Z=a.measureText(Q);this.dependencyTracker.recordBBox(t,this.ctx,-Z.actualBoundingBoxLeft,Z.actualBoundingBoxRight,-Z.actualBoundingBoxAscent,Z.actualBoundingBoxDescent).recordShowTextOperation(t)}n.x+=q*x*d,a.restore(),this.compose();return}let R=0,j;for(j=0;j<f;++j){let $=e[j];if(typeof $=="number"){R+=m*$*s/1e3;continue}let q=!1,Q=($.isSpace?u:0)+c,Z=$.fontChar,Y=$.accent,X,T,I=$.width;if(p){let z=$.vmetric||y,D=-($.vmetric?z[1]:I*.5)*x,F=z[2]*x;I=z?-z[0]:I,X=D/l,T=(R+F)/l}else X=R/l,T=0;let _;if(i.remeasure&&I>0){_=a.measureText(Z);let z=_.width*1e3/s*l;if(I<z&&this.isFontSubpixelAAEnabled){let D=I/z;q=!0,a.save(),a.scale(D,1),X/=D}else I!==z&&(X+=(I-z)/2e3*s/l)}if(this.contentVisible&&($.isInFont||i.missingFile)){if(b&&!Y)a.fillText(Z,X,T),this.dependencyTracker?.recordCharacterBBox(t,a,_?{bbox:null}:i,s/l,X,T,()=>_??a.measureText(Z));else if(this.paintChar(t,Z,X,T,w,C),Y){let z=X+s*Y.offset.x/l,D=T-s*Y.offset.y/l;this.paintChar(t,Y.fontChar,z,D,w,C)}}let W=p?I*x-Q*h:I*x+Q*h;R+=W,q&&a.restore()}p?n.y-=R:n.x+=R*d,a.restore(),this.compose(),this.dependencyTracker?.recordShowTextOperation(t)}showType3Text(t,e){let n=this.ctx,i=this.current,s=i.font,a=i.fontSize,l=i.fontDirection,c=s.vertical?1:-1,u=i.charSpacing,h=i.wordSpacing,d=i.textHScale*l,f=i.fontMatrix||Lx,p=e.length,m=i.textRenderingMode===pn.INVISIBLE,y,x,b,w;if(m||a===0)return;this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null,n.save(),i.textMatrix&&n.transform(...i.textMatrix),n.translate(i.x,i.y+i.textRise),n.scale(d,l);let C=this.dependencyTracker;for(this.dependencyTracker=C?new fy(C,t):null,y=0;y<p;++y){if(x=e[y],typeof x=="number"){w=c*x*a/1e3,this.ctx.translate(w,0),i.x+=w*d;continue}let E=(x.isSpace?h:0)+u,S=s.charProcOperatorList[x.operatorListId];S?this.contentVisible&&(this.save(),n.scale(a,a),n.transform(...f),this.executeOperatorList(S),this.restore()):jt(`Type3 character "${x.operatorListId}" is not available.`);let N=[x.width,0];yt.applyTransform(N,f),b=N[0]*a+E,n.translate(b,0),i.x+=b*d}n.restore(),C&&(this.dependencyTracker=C)}setCharWidth(t,e,n){}setCharWidthAndBounds(t,e,n,i,s,a,l){let c=new Path2D;c.rect(i,s,a-i,l-s),this.ctx.clip(c),this.dependencyTracker?.recordBBox(t,this.ctx,i,a,s,l).recordClipBox(t,this.ctx,i,a,s,l),this.endPath(t)}getColorN_Pattern(t,e){let n;if(e[0]==="TilingPattern"){let i=this.baseTransform||Le(this.ctx),s={createCanvasGraphics:(a,l)=>new CA(a,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:this.optionalContentConfig,markedContentStack:this.markedContentStack},void 0,void 0,this.dependencyTracker?new fy(this.dependencyTracker,l,!0):null)};n=new Rw(e,this.ctx,s,i)}else n=this._getPattern(t,e[1],e[2]);return n}setStrokeColorN(t,...e){this.dependencyTracker?.recordSimpleData("strokeColor",t),this.current.strokeColor=this.getColorN_Pattern(t,e),this.current.patternStroke=!0}setFillColorN(t,...e){this.dependencyTracker?.recordSimpleData("fillColor",t),this.current.fillColor=this.getColorN_Pattern(t,e),this.current.patternFill=!0}setStrokeRGBColor(t,e){this.dependencyTracker?.recordSimpleData("strokeColor",t),this.ctx.strokeStyle=this.current.strokeColor=e,this.current.patternStroke=!1}setStrokeTransparent(t){this.dependencyTracker?.recordSimpleData("strokeColor",t),this.ctx.strokeStyle=this.current.strokeColor="transparent",this.current.patternStroke=!1}setFillRGBColor(t,e){this.dependencyTracker?.recordSimpleData("fillColor",t),this.ctx.fillStyle=this.current.fillColor=e,this.current.patternFill=!1}setFillTransparent(t){this.dependencyTracker?.recordSimpleData("fillColor",t),this.ctx.fillStyle=this.current.fillColor="transparent",this.current.patternFill=!1}_getPattern(t,e,n=null){let i;return this.cachedPatterns.has(e)?i=this.cachedPatterns.get(e):(i=zO(this.getObject(t,e)),this.cachedPatterns.set(e,i)),n&&(i.matrix=n),i}shadingFill(t,e){if(!this.contentVisible)return;let n=this.ctx;this.save(t);let i=this._getPattern(t,e);n.fillStyle=i.getPattern(n,this,hs(n),Gn.SHADING,t);let s=hs(n);if(s){let{width:a,height:l}=n.canvas,c=Ku.slice();yt.axialAlignedBoundingBox([0,0,a,l],s,c);let[u,h,d,f]=c;this.ctx.fillRect(u,h,d-u,f-h)}else this.ctx.fillRect(-1e10,-1e10,2e10,2e10);this.dependencyTracker?.resetBBox(t).recordFullPageBBox(t).recordDependencies(t,hr.transform).recordDependencies(t,hr.fill).recordOperation(t),this.compose(this.current.getClippedPathBoundingBox()),this.restore(t)}beginInlineImage(){ue("Should not call beginInlineImage")}beginImageData(){ue("Should not call beginImageData")}paintFormXObjectBegin(t,e,n){if(this.contentVisible&&(this.save(t),this.baseTransformStack.push(this.baseTransform),e&&this.transform(t,...e),this.baseTransform=Le(this.ctx),n)){yt.axialAlignedBoundingBox(n,this.baseTransform,this.current.minMax);let[i,s,a,l]=n,c=new Path2D;c.rect(i,s,a-i,l-s),this.ctx.clip(c),this.dependencyTracker?.recordClipBox(t,this.ctx,i,a,s,l),this.endPath(t)}}paintFormXObjectEnd(t){this.contentVisible&&(this.restore(t),this.baseTransform=this.baseTransformStack.pop())}beginGroup(t,e){if(!this.contentVisible)return;this.save(t),this.inSMaskMode&&(this.endSMaskMode(),this.current.activeSMask=null);let n=this.ctx;e.isolated||ob("TODO: Support non-isolated groups."),e.knockout&&jt("Knockout groups not supported.");let i=Le(n);e.matrix&&n.transform(...e.matrix);let s=[0,0,n.canvas.width,n.canvas.height],a;e.bbox?(a=Ku.slice(),yt.axialAlignedBoundingBox(e.bbox,Le(n),a),a=yt.intersect(a,s)||[0,0,0,0]):a=s;let l=Math.floor(a[0]),c=Math.floor(a[1]),u=Math.max(Math.ceil(a[2])-l,1),h=Math.max(Math.ceil(a[3])-c,1);this.current.startNewPathAndClipBox([0,0,u,h]),e.smask&&this.smaskCounter++;let d=this.canvasFactory.create(u,h);e.smask&&this.smaskGroupCanvases.push(d);let f=d.context;if(f.translate(-l,-c),f.transform(...i),e.bbox){let p=new Path2D,[m,y,x,b]=e.bbox;if(p.rect(m,y,x-m,b-y),e.matrix){let w=new Path2D;w.addPath(p,new DOMMatrix(e.matrix)),p=w}f.clip(p)}e.smask&&this.smaskStack.push({canvas:d.canvas,context:f,offsetX:l,offsetY:c,subtype:e.smask.subtype,backdrop:e.smask.backdrop,transferMap:e.smask.transferMap||null,startTransformInverse:null}),(!e.smask||this.dependencyTracker)&&(n.setTransform(1,0,0,1,0,0),n.translate(l,c),n.save()),vf(n,f),this.ctx=f,this.dependencyTracker?.inheritSimpleDataAsFutureForcedDependencies(["fillAlpha","strokeAlpha","globalCompositeOperation"]).pushBaseTransform(n),this.setGState(t,[["BM","source-over"],["ca",1],["CA",1],["TR",null]]),this.groupStack.push(n),this.groupLevel++}endGroup(t,e){if(!this.contentVisible)return;this.groupLevel--;let n=this.ctx,i=this.groupStack.pop();if(this.ctx=i,this.ctx.imageSmoothingEnabled=!1,this.dependencyTracker?.popBaseTransform(),e.smask)this.tempSMask=this.smaskStack.pop(),this.restore(t),this.dependencyTracker&&this.ctx.restore();else{this.ctx.restore();let s=Le(this.ctx);this.restore(t),this.ctx.save(),this.ctx.setTransform(...s);let a=Ku.slice();yt.axialAlignedBoundingBox([0,0,n.canvas.width,n.canvas.height],s,a),this.ctx.drawImage(n.canvas,0,0),this.ctx.restore(),this.canvasFactory.destroy({canvas:n.canvas,context:n}),this.compose(a)}}beginAnnotation(t,e,n,i,s,a){if(v(this,Jr,Lw).call(this),p0(this.ctx),this.ctx.save(),this.save(t),this.baseTransform&&this.ctx.setTransform(...this.baseTransform),n){let l=n[2]-n[0],c=n[3]-n[1];if(a&&this.annotationCanvasMap){i=i.slice(),i[4]-=n[0],i[5]-=n[1],n=n.slice(),n[0]=n[1]=0,n[2]=l,n[3]=c,yt.singularValueDecompose2dScale(Le(this.ctx),Zi);let{viewportScale:u}=this,h=Math.ceil(l*this.outputScaleX*u),d=Math.ceil(c*this.outputScaleY*u);this.annotationCanvas=this.canvasFactory.create(h,d);let{canvas:f,context:p}=this.annotationCanvas;this.annotationCanvasMap.set(e,f),this.annotationCanvas.savedCtx=this.ctx,this.ctx=p,this.ctx.save(),this.ctx.setTransform(Zi[0],0,0,-Zi[1],0,c*Zi[1]),p0(this.ctx)}else{p0(this.ctx),this.endPath(t);let u=new Path2D;u.rect(n[0],n[1],l,c),this.ctx.clip(u)}}this.current=new by(this.ctx.canvas.width,this.ctx.canvas.height),this.transform(t,...i),this.transform(t,...s)}endAnnotation(t){this.annotationCanvas&&(this.ctx.restore(),v(this,Jr,Bw).call(this),this.ctx=this.annotationCanvas.savedCtx,delete this.annotationCanvas.savedCtx,delete this.annotationCanvas)}paintImageMaskXObject(t,e){if(!this.contentVisible)return;let n=e.count;e=this.getObject(t,e.data,e),e.count=n;let i=this.ctx,s=this._createMaskCanvas(t,e),a=s.canvas;i.save(),i.setTransform(1,0,0,1,0,0),i.drawImage(a,s.offsetX,s.offsetY),this.dependencyTracker?.resetBBox(t).recordBBox(t,this.ctx,s.offsetX,s.offsetX+a.width,s.offsetY,s.offsetY+a.height).recordOperation(t),i.restore(),s.canvasEntry&&this.canvasFactory.destroy(s.canvasEntry),this.compose()}paintImageMaskXObjectRepeat(t,e,n,i=0,s=0,a,l){if(!this.contentVisible)return;e=this.getObject(t,e.data,e);let c=this.ctx;c.save();let u=Le(c);c.transform(n,i,s,a,0,0);let h=this._createMaskCanvas(t,e);c.setTransform(1,0,0,1,h.offsetX-u[4],h.offsetY-u[5]),this.dependencyTracker?.resetBBox(t);for(let d=0,f=l.length;d<f;d+=2){let p=yt.transform(u,[n,i,s,a,l[d],l[d+1]]);c.drawImage(h.canvas,p[4],p[5]),this.dependencyTracker?.recordBBox(t,this.ctx,p[4],p[4]+h.canvas.width,p[5],p[5]+h.canvas.height)}c.restore(),h.canvasEntry&&this.canvasFactory.destroy(h.canvasEntry),this.compose(),this.dependencyTracker?.recordOperation(t)}paintImageMaskXObjectGroup(t,e){if(!this.contentVisible)return;let n=this.ctx,i=this.current.fillColor,s=this.current.patternFill;this.dependencyTracker?.resetBBox(t).recordDependencies(t,hr.transformAndFill);for(let a of e){let{data:l,width:c,height:u,transform:h}=a,d=this.canvasFactory.create(c,u),f=d.context;f.save();let p=this.getObject(t,l,a);wT(f,p),f.globalCompositeOperation="source-in",f.fillStyle=s?i.getPattern(f,this,hs(n),Gn.FILL,t):i,f.fillRect(0,0,c,u),f.restore(),n.save(),n.transform(...h),n.scale(1,-1),f0(n,d.canvas,0,0,c,u,0,-1,1,1),this.canvasFactory.destroy(d),this.dependencyTracker?.recordBBox(t,n,0,c,0,u),n.restore()}this.compose(),this.dependencyTracker?.recordOperation(t)}paintImageXObject(t,e){if(!this.contentVisible)return;let n=this.getObject(t,e);if(!n){jt("Dependent image isn't ready yet");return}this.paintInlineImageXObject(t,n)}paintImageXObjectRepeat(t,e,n,i,s){if(!this.contentVisible)return;let a=this.getObject(t,e);if(!a){jt("Dependent image isn't ready yet");return}let l=a.width,c=a.height,u=[];for(let h=0,d=s.length;h<d;h+=2)u.push({transform:[n,0,0,i,s[h],s[h+1]],x:0,y:0,w:l,h:c});this.paintInlineImageXObjectGroup(t,a,u)}applyTransferMapsToCanvas(t){return this.current.transferMaps!=="none"&&(t.filter=this.current.transferMaps,t.drawImage(t.canvas,0,0),t.filter="none"),t.canvas}applyTransferMapsToBitmap(t){if(this.current.transferMaps==="none")return{img:t.bitmap,canvasEntry:null};let{bitmap:e,width:n,height:i}=t,s=this.canvasFactory.create(n,i),a=s.context;return a.filter=this.current.transferMaps,a.drawImage(e,0,0),a.filter="none",{img:s.canvas,canvasEntry:s}}paintInlineImageXObject(t,e){if(!this.contentVisible)return;let n=e.width,i=e.height,s=this.ctx;this.save(t);let{filter:a}=s;a!=="none"&&a!==""&&(s.filter="none"),s.scale(1/n,-1/i);let l,c=null;if(e.bitmap){let h=this.applyTransferMapsToBitmap(e);l=h.img,c=h.canvasEntry}else if(typeof HTMLElement=="function"&&e instanceof HTMLElement||!e.data)l=e;else{let h=this.canvasFactory.create(n,i);xT(h.context,e),l=this.applyTransferMapsToCanvas(h.context),c=h}let u=this._scaleImage(l,hs(s));s.imageSmoothingEnabled=AT(Le(s),e.interpolate),this.dependencyTracker&&(this.dependencyTracker.resetBBox(t).recordBBox(t,s,0,n,-i,0).recordDependencies(t,hr.imageXObject).recordOperation(t),this.imagesTracker?.record(s,n,i,this.dependencyTracker.clipBox)),f0(s,u.img,0,0,u.paintWidth,u.paintHeight,0,-i,n,i),u.tmpCanvas&&this.canvasFactory.destroy(u.tmpCanvas),c&&this.canvasFactory.destroy(c),this.compose(),this.restore(t)}paintInlineImageXObjectGroup(t,e,n){if(!this.contentVisible)return;let i=this.ctx,s,a=null;if(e.bitmap)s=e.bitmap;else{let l=e.width,c=e.height,u=this.canvasFactory.create(l,c);xT(u.context,e),s=this.applyTransferMapsToCanvas(u.context),a=u}this.dependencyTracker?.resetBBox(t);for(let l of n)i.save(),i.transform(...l.transform),i.scale(1,-1),f0(i,s,l.x,l.y,l.w,l.h,0,-1,1,1),this.dependencyTracker?.recordBBox(t,i,0,1,-1,0),i.restore();a&&this.canvasFactory.destroy(a),this.dependencyTracker?.recordOperation(t),this.compose()}paintSolidColorImageMask(t){this.contentVisible&&(this.dependencyTracker?.resetBBox(t).recordBBox(t,this.ctx,0,1,0,1).recordDependencies(t,hr.fill).recordOperation(t),this.ctx.fillRect(0,0,1,1),this.compose())}markPoint(t,e){}markPointProps(t,e,n){}beginMarkedContent(t,e){this.dependencyTracker?.beginMarkedContent(t),this.markedContentStack.push({visible:!0})}beginMarkedContentProps(t,e,n){this.dependencyTracker?.beginMarkedContent(t),e==="OC"?this.markedContentStack.push({visible:this.optionalContentConfig.isVisible(n)}):this.markedContentStack.push({visible:!0}),this.contentVisible=this.isContentVisible()}endMarkedContent(t){this.dependencyTracker?.endMarkedContent(t),this.markedContentStack.pop(),this.contentVisible=this.isContentVisible()}beginCompat(t){}endCompat(t){}consumePath(t,e,n){let i=this.current.isEmptyClip();this.pendingClip&&this.current.updateClipFromPath(),this.pendingClip||this.compose(n);let s=this.ctx;this.pendingClip?(i||(this.pendingClip===vT?s.clip(e,"evenodd"):s.clip(e)),this.pendingClip=null,this.dependencyTracker?.bboxToClipBoxDropOperation(t).recordFutureForcedDependency("clipPath",t)):this.dependencyTracker?.recordOperation(t),this.current.startNewPathAndClipBox(this.current.clipBox)}getSinglePixelWidth(){if(!this._cachedGetSinglePixelWidth){let t=Le(this.ctx);if(t[1]===0&&t[2]===0)this._cachedGetSinglePixelWidth=1/Math.min(Math.abs(t[0]),Math.abs(t[3]));else{let e=Math.abs(t[0]*t[3]-t[2]*t[1]),n=Math.hypot(t[0],t[2]),i=Math.hypot(t[1],t[3]);this._cachedGetSinglePixelWidth=Math.max(n,i)/e}}return this._cachedGetSinglePixelWidth}getScaleForStroking(){if(this._cachedScaleForStroking[0]===-1){let{lineWidth:t}=this.current,{a:e,b:n,c:i,d:s}=this.ctx.getTransform(),a,l;if(n===0&&i===0){let c=Math.abs(e),u=Math.abs(s);if(c===u)if(t===0)a=l=1/c;else{let h=c*t;a=l=h<1?1/h:1}else if(t===0)a=1/c,l=1/u;else{let h=c*t,d=u*t;a=h<1?1/h:1,l=d<1?1/d:1}}else{let c=Math.abs(e*s-n*i),u=Math.hypot(e,n),h=Math.hypot(i,s);if(t===0)a=h/c,l=u/c;else{let d=t*c;a=h>d?h/d:1,l=u>d?u/d:1}}this._cachedScaleForStroking[0]=a,this._cachedScaleForStroking[1]=l}return this._cachedScaleForStroking}rescaleAndStroke(t,e){let{ctx:n,current:{lineWidth:i}}=this,[s,a]=this.getScaleForStroking();if(s===a){n.lineWidth=(i||1)*s,n.stroke(t);return}let l=n.getLineDash();e&&n.save(),n.scale(s,a),Px.a=1/s,Px.d=1/a;let c=new Path2D;if(c.addPath(t,Px),l.length>0){let u=Math.max(s,a);n.setLineDash(l.map(h=>h/u)),n.lineDashOffset/=u}n.lineWidth=i||1,n.stroke(c),e&&n.restore()}isContentVisible(){for(let t=this.markedContentStack.length-1;t>=0;t--)if(!this.markedContentStack[t].visible)return!1;return!0}};Jr=new WeakSet,Lw=function(){for(;this.stateStack.length||this.inSMaskMode;)this.restore();this.current.activeSMask=null,this.ctx.restore(),this.transparentCanvas&&(this.ctx=this.compositeCtx,this.ctx.save(),this.ctx.setTransform(1,0,0,1,0,0),this.ctx.drawImage(this.transparentCanvas,0,0),this.ctx.restore(),this.canvasFactory.destroy(this.transparentCanvasEntry),this.transparentCanvas=null,this.transparentCanvasEntry=null)},Bw=function(){if(this.pageColors){let t=this.filterFactory.addHCMFilter(this.pageColors.foreground,this.pageColors.background);if(t!=="none"){let e=this.ctx.filter;this.ctx.filter=t,this.ctx.drawImage(this.ctx.canvas,0,0),this.ctx.filter=e}}},Uw=function(t,e,n){let i=new Path2D;return i.addPath(t,new DOMMatrix(n).invertSelf().multiplySelf(e)),i};Ju=CA;for(let r in Nd)Ju.prototype[r]!==void 0&&(Ju.prototype[Nd[r]]=Ju.prototype[r]);_d=class{constructor(t,e,n){A(this,Xp,null);A(this,Yp,null);U(this,"_fullReader",null);U(this,"_rangeReaders",new Set);U(this,"_source",null);this._source=t,g(this,Xp,e),g(this,Yp,n)}get _progressiveDataLength(){return this._fullReader?._loaded??0}getFullReader(){return Ue(!this._fullReader,"BasePDFStream.getFullReader can only be called once."),this._fullReader=new(o(this,Xp))(this)}getRangeReader(t,e){if(e<=this._progressiveDataLength)return null;let n=new(o(this,Yp))(this,t,e);return this._rangeReaders.add(n),n}cancelAllRequests(t){this._fullReader?.cancel(t);for(let e of new Set(this._rangeReaders))e.cancel(t)}};Xp=new WeakMap,Yp=new WeakMap;Md=class{constructor(t){U(this,"onProgress",null);U(this,"_contentLength",0);U(this,"_filename",null);U(this,"_headersCapability",Promise.withResolvers());U(this,"_isRangeSupported",!1);U(this,"_isStreamingSupported",!1);U(this,"_loaded",0);U(this,"_stream",null);this._stream=t}_callOnProgress(){this.onProgress?.({loaded:this._loaded,total:this._contentLength})}get headersReady(){return this._headersCapability.promise}get filename(){return this._filename}get contentLength(){return this._contentLength}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}async read(){ue("Abstract method `read` called")}cancel(t){ue("Abstract method `cancel` called")}},Od=class{constructor(t,e,n){U(this,"_stream",null);this._stream=t}async read(){ue("Abstract method `read` called")}cancel(t){ue("Abstract method `cancel` called")}};$w=class extends _d{constructor(e){super(e,zw,jw);U(this,"_responseOrigin",null);let{httpHeaders:n,url:i}=e;Ue(/https?:/.test(i.protocol),"PDFFetchStream only supports http(s):// URLs."),this.headers=CS(!0,n)}},zw=class extends Md{constructor(e){super(e);U(this,"_abortController",new AbortController);U(this,"_reader",null);let{disableRange:n,disableStream:i,rangeChunkSize:s,url:a,withCredentials:l}=e._source;this._isStreamingSupported=!i;let c=new Headers(e.headers);DS(a,c,l,this._abortController).then(u=>{e._responseOrigin=fb(u.url),NS(u.status,a),this._reader=u.body.getReader();let h=u.headers,{contentLength:d,isRangeSupported:f}=ES({responseHeaders:h,isHttp:!0,rangeChunkSize:s,disableRange:n});this._contentLength=d,this._isRangeSupported=f,this._filename=TS(h),!this._isStreamingSupported&&this._isRangeSupported&&this.cancel(new Qr("Streaming is disabled.")),this._headersCapability.resolve()}).catch(this._headersCapability.reject)}async read(){await this._headersCapability.promise;let{value:e,done:n}=await this._reader.read();return n?{value:e,done:n}:(this._loaded+=e.byteLength,this._callOnProgress(),{value:mb(e),done:!1})}cancel(e){this._reader?.cancel(e),this._abortController.abort()}},jw=class extends Od{constructor(e,n,i){super(e,n,i);U(this,"_abortController",new AbortController);U(this,"_readCapability",Promise.withResolvers());U(this,"_reader",null);let{url:s,withCredentials:a}=e._source,l=new Headers(e.headers);l.append("Range",`bytes=${n}-${i-1}`),DS(s,l,a,this._abortController).then(c=>{let u=fb(c.url);SS(u,e._responseOrigin),NS(c.status,s),this._reader=c.body.getReader(),this._readCapability.resolve()}).catch(this._readCapability.reject)}async read(){await this._readCapability.promise;let{value:e,done:n}=await this._reader.read();return n?{value:e,done:n}:{value:mb(e),done:!1}}cancel(e){this._reader?.cancel(e),this._abortController.abort()}};Gw=class extends _d{constructor(e){super(e,Ww,qw);A(this,Kp);U(this,"_progressiveDone",!1);U(this,"_queuedChunks",[]);let{pdfDataRangeTransport:n}=e,{initialData:i,progressiveDone:s}=n;if(i?.length>0){let a=CT(i);this._queuedChunks.push(a)}this._progressiveDone=s,n.addRangeListener((a,l)=>{v(this,Kp,Hw).call(this,a,l)}),n.addProgressiveReadListener(a=>{v(this,Kp,Hw).call(this,void 0,a)}),n.addProgressiveDoneListener(()=>{this._fullReader?.progressiveDone(),this._progressiveDone=!0}),n.transportReady()}getFullReader(){let e=super.getFullReader();return this._queuedChunks=null,e}getRangeReader(e,n){let i=super.getRangeReader(e,n);return i&&(i.onDone=()=>this._rangeReaders.delete(i),this._source.pdfDataRangeTransport.requestDataRange(e,n)),i}cancelAllRequests(e){super.cancelAllRequests(e),this._source.pdfDataRangeTransport.abort()}};Kp=new WeakSet,Hw=function(e,n){let i=CT(n);if(e===void 0)this._fullReader?this._fullReader._enqueue(i):this._queuedChunks.push(i);else{let s=this._rangeReaders.keys().find(a=>a._begin===e);Ue(s,"#onReceiveData - no `PDFDataTransportStreamRangeReader` instance found."),s._enqueue(i)}};Ww=class extends Md{constructor(e){super(e);A(this,Zp,gb.bind(this));U(this,"_done",!1);U(this,"_queuedChunks",null);U(this,"_requests",[]);let{pdfDataRangeTransport:n,disableRange:i,disableStream:s}=e._source,{length:a,contentDispositionFilename:l}=n;this._queuedChunks=e._queuedChunks||[];for(let u of this._queuedChunks)this._loaded+=u.byteLength;this._done=e._progressiveDone,this._contentLength=a,this._isStreamingSupported=!s,this._isRangeSupported=!i,db(l)&&(this._filename=l),this._headersCapability.resolve();let c=this._loaded;Promise.resolve().then(()=>{c>0&&this._loaded===c&&this._callOnProgress()})}_enqueue(e){this._done||(this._requests.length>0?this._requests.shift().resolve({value:e,done:!1}):this._queuedChunks.push(e),this._loaded+=e.byteLength,this._callOnProgress())}async read(){if(this._queuedChunks.length>0)return{value:this._queuedChunks.shift(),done:!1};if(this._done)return{value:void 0,done:!0};let e=Promise.withResolvers();return this._requests.push(e),e.promise}cancel(e){this._done=!0,o(this,Zp).call(this)}progressiveDone(){this._done||(this._done=!0),this._queuedChunks.length===0&&o(this,Zp).call(this)}};Zp=new WeakMap;qw=class extends Od{constructor(e,n,i){super(e,n,i);A(this,Qp,gb.bind(this));U(this,"onDone",null);U(this,"_begin",-1);U(this,"_done",!1);U(this,"_queuedChunk",null);U(this,"_requests",[]);this._begin=n}_enqueue(e){this._done||(this._requests.length===0?this._queuedChunk=e:(this._requests.shift().resolve({value:e,done:!1}),o(this,Qp).call(this)),this._done=!0,this.onDone?.())}async read(){if(this._queuedChunk){let n=this._queuedChunk;return this._queuedChunk=null,{value:n,done:!1}}if(this._done)return{value:void 0,done:!0};let e=Promise.withResolvers();return this._requests.push(e),e.promise}cancel(e){this._done=!0,o(this,Qp).call(this),this.onDone?.()}};Qp=new WeakMap;Rx=200,ET=206;Vw=class extends _d{constructor(e){super(e,Xw,Yw);A(this,Ld);A(this,Es,new WeakMap);U(this,"_responseOrigin",null);let{httpHeaders:n,url:i}=e;this.url=i,this.isHttp=/https?:/.test(i.protocol),this.headers=CS(this.isHttp,n)}_request(e){let n=new XMLHttpRequest,i={validateStatus:null,onHeadersReceived:e.onHeadersReceived,onDone:e.onDone,onError:e.onError,onProgress:e.onProgress};o(this,Es).set(n,i),n.open("GET",this.url),n.withCredentials=this._source.withCredentials;for(let[s,a]of this.headers)n.setRequestHeader(s,a);return this.isHttp&&"begin"in e&&"end"in e?(n.setRequestHeader("Range",`bytes=${e.begin}-${e.end-1}`),i.validateStatus=s=>s===ET||s===Rx):i.validateStatus=s=>s===Rx,n.responseType="arraybuffer",Ue(e.onError,"Expected `onError` callback to be provided."),n.onerror=()=>e.onError(n.status),n.onreadystatechange=v(this,Ld,kS).bind(this,n),n.onprogress=v(this,Ld,IS).bind(this,n),n.send(null),n}_abortRequest(e){o(this,Es).has(e)&&(o(this,Es).delete(e),e.abort())}getRangeReader(e,n){let i=super.getRangeReader(e,n);return i&&(i.onClosed=()=>this._rangeReaders.delete(i)),i}};Es=new WeakMap,Ld=new WeakSet,IS=function(e,n){o(this,Es).get(e)?.onProgress?.(n)},kS=function(e,n){let i=o(this,Es).get(e);if(!i||(e.readyState>=2&&i.onHeadersReceived&&(i.onHeadersReceived(),delete i.onHeadersReceived),e.readyState!==4)||!o(this,Es).has(e))return;if(o(this,Es).delete(e),e.status===0&&this.isHttp){i.onError(e.status);return}let s=e.status||Rx;if(!i.validateStatus(s)){i.onError(e.status);return}let a=YO(e.response);if(s===ET){let l=e.getResponseHeader("Content-Range");/bytes (\d+)-(\d+)\/(\d+)/.test(l)?i.onDone(a):(jt('Missing or invalid "Content-Range" header.'),i.onError(0))}else a?i.onDone(a):i.onError(e.status)};Xw=class extends Md{constructor(e){super(e);A(this,Bs);A(this,Jp,gb.bind(this));U(this,"_cachedChunks",[]);U(this,"_done",!1);U(this,"_requests",[]);U(this,"_storedError",null);this._fullRequestXhr=e._request({onHeadersReceived:v(this,Bs,_S).bind(this),onDone:v(this,Bs,MS).bind(this),onError:v(this,Bs,OS).bind(this),onProgress:v(this,Bs,FS).bind(this)})}async read(){if(await this._headersCapability.promise,this._storedError)throw this._storedError;if(this._cachedChunks.length>0)return{value:this._cachedChunks.shift(),done:!1};if(this._done)return{value:void 0,done:!0};let e=Promise.withResolvers();return this._requests.push(e),e.promise}cancel(e){this._done=!0,this._headersCapability.reject(e),o(this,Jp).call(this),this._stream._abortRequest(this._fullRequestXhr),this._fullRequestXhr=null}};Jp=new WeakMap,Bs=new WeakSet,_S=function(){let e=this._stream,{disableRange:n,rangeChunkSize:i}=e._source,s=this._fullRequestXhr;e._responseOrigin=fb(s.responseURL);let a=s.getAllResponseHeaders(),l=new Headers(a?a.trimStart().replace(/[^\S ]+$/,"").split(/[\r\n]+/).map(h=>{let[d,...f]=h.split(": ");return[d,f.join(": ")]}):[]),{contentLength:c,isRangeSupported:u}=ES({responseHeaders:l,isHttp:e.isHttp,rangeChunkSize:i,disableRange:n});this._contentLength=c,this._isRangeSupported=u,this._filename=TS(l),this._isRangeSupported&&e._abortRequest(s),this._headersCapability.resolve()},MS=function(e){this._requests.length>0?this._requests.shift().resolve({value:e,done:!1}):this._cachedChunks.push(e),this._done=!0,this._cachedChunks.length===0&&o(this,Jp).call(this)},OS=function(e){this._storedError=pb(e,this._stream.url),this._headersCapability.reject(this._storedError);for(let n of this._requests)n.reject(this._storedError);this._requests.length=0,this._cachedChunks.length=0},FS=function(e){this.onProgress?.({loaded:e.loaded,total:e.lengthComputable?e.total:this._contentLength})};Yw=class extends Od{constructor(e,n,i){super(e,n,i);A(this,Wa);A(this,tm,gb.bind(this));U(this,"onClosed",null);U(this,"_done",!1);U(this,"_queuedChunk",null);U(this,"_requests",[]);U(this,"_storedError",null);this._requestXhr=e._request({begin:n,end:i,onHeadersReceived:v(this,Wa,PS).bind(this),onDone:v(this,Wa,RS).bind(this),onError:v(this,Wa,Kw).bind(this),onProgress:null})}async read(){if(this._storedError)throw this._storedError;if(this._queuedChunk!==null){let n=this._queuedChunk;return this._queuedChunk=null,{value:n,done:!1}}if(this._done)return{value:void 0,done:!0};let e=Promise.withResolvers();return this._requests.push(e),e.promise}cancel(e){this._done=!0,o(this,tm).call(this),this._stream._abortRequest(this._requestXhr),this.onClosed?.()}};tm=new WeakMap,Wa=new WeakSet,PS=function(){let e=fb(this._requestXhr?.responseURL);try{SS(e,this._stream._responseOrigin)}catch(n){this._storedError=n,v(this,Wa,Kw).call(this,0)}},RS=function(e){this._requests.length>0?this._requests.shift().resolve({value:e,done:!1}):this._queuedChunk=e,this._done=!0,o(this,tm).call(this),this.onClosed?.()},Kw=function(e){this._storedError??(this._storedError=pb(e,this._stream.url));for(let n of this._requests)n.reject(this._storedError);this._requests.length=0,this._queuedChunk=null};Zw=class extends _d{constructor(t){super(t,Qw,Jw);let{url:e}=t;Ue(e.protocol==="file:","PDFNodeStream only supports file:// URLs.")}},Qw=class extends Md{constructor(e){super(e);U(this,"_reader",null);let{disableRange:n,disableStream:i,rangeChunkSize:s,url:a}=e._source;this._isStreamingSupported=!i;let l=nt.default.getBuiltinModule("fs");l.promises.lstat(a).then(c=>{let u=l.createReadStream(a),h=LS(u);this._reader=h.getReader();let{size:d}=c;this._contentLength=d,this._isRangeSupported=!n&&d>2*s,!this._isStreamingSupported&&this._isRangeSupported&&this.cancel(new Qr("Streaming is disabled.")),this._headersCapability.resolve()}).catch(c=>{c.code==="ENOENT"&&(c=pb(0,a)),this._headersCapability.reject(c)})}async read(){await this._headersCapability.promise;let{value:e,done:n}=await this._reader.read();return n?{value:e,done:n}:(this._loaded+=e.byteLength,this._callOnProgress(),{value:mb(e),done:!1})}cancel(e){this._reader?.cancel(e)}},Jw=class extends Od{constructor(e,n,i){super(e,n,i);U(this,"_readCapability",Promise.withResolvers());U(this,"_reader",null);let{url:s}=e._source,a=nt.default.getBuiltinModule("fs");try{let l=a.createReadStream(s,{start:n,end:i-1}),c=LS(l);this._reader=c.getReader(),this._readCapability.resolve()}catch(l){this._readCapability.reject(l)}}async read(){await this._readCapability.promise;let{value:e,done:n}=await this._reader.read();return n?{value:e,done:n}:{value:mb(e),done:!1}}cancel(e){this._reader?.cancel(e)}};Tr=class{static get workerPort(){return o(this,em)}static set workerPort(t){if(!(typeof Worker<"u"&&t instanceof Worker)&&t!==null)throw new Error("Invalid `workerPort` type.");g(this,em,t)}static get workerSrc(){return o(this,nm)}static set workerSrc(t){if(typeof t!="string")throw new Error("Invalid `workerSrc` type.");g(this,nm,t)}};em=new WeakMap,nm=new WeakMap,A(Tr,em,null),A(Tr,nm,"");t2=class{constructor({parsedData:t,rawData:e}){A(this,Ph);A(this,im);g(this,Ph,t),g(this,im,e)}getRaw(){return o(this,im)}get(t){return o(this,Ph).get(t)??null}[Symbol.iterator](){return o(this,Ph).entries()}};Ph=new WeakMap,im=new WeakMap;Hu=Symbol("INTERNAL"),e2=class{constructor(t,{name:e,intent:n,usage:i,rbGroups:s}){A(this,rm,!1);A(this,sm,!1);A(this,am,!1);A(this,Rh,!0);g(this,rm,!!(t&Yi.DISPLAY)),g(this,sm,!!(t&Yi.PRINT)),this.name=e,this.intent=n,this.usage=i,this.rbGroups=s}get visible(){if(o(this,am))return o(this,Rh);if(!o(this,Rh))return!1;let{print:t,view:e}=this.usage;return o(this,rm)?e?.viewState!=="OFF":o(this,sm)?t?.printState!=="OFF":!0}_setVisible(t,e,n=!1){t!==Hu&&ue("Internal method `_setVisible` called."),g(this,am,n),g(this,Rh,e)}};rm=new WeakMap,sm=new WeakMap,am=new WeakMap,Rh=new WeakMap;n2=class{constructor(t,e=Yi.DISPLAY){A(this,om);A(this,Mo,null);A(this,Ae,new Map);A(this,Lh,null);A(this,Bh,null);if(this.renderingIntent=e,this.name=null,this.creator=null,t!==null){this.name=t.name,this.creator=t.creator,g(this,Bh,t.order);for(let n of t.groups)o(this,Ae).set(n.id,new e2(e,n));if(t.baseState==="OFF")for(let n of o(this,Ae).values())n._setVisible(Hu,!1);for(let n of t.on)o(this,Ae).get(n)._setVisible(Hu,!0);for(let n of t.off)o(this,Ae).get(n)._setVisible(Hu,!1);g(this,Lh,this.getHash())}}isVisible(t){if(o(this,Ae).size===0)return!0;if(!t)return ob("Optional content group not defined."),!0;if(t.type==="OCG")return o(this,Ae).has(t.id)?o(this,Ae).get(t.id).visible:(jt(`Optional content group not found: ${t.id}`),!0);if(t.type==="OCMD"){if(t.expression)return v(this,om,i2).call(this,t.expression);if(!t.policy||t.policy==="AnyOn"){for(let e of t.ids){if(!o(this,Ae).has(e))return jt(`Optional content group not found: ${e}`),!0;if(o(this,Ae).get(e).visible)return!0}return!1}else if(t.policy==="AllOn"){for(let e of t.ids){if(!o(this,Ae).has(e))return jt(`Optional content group not found: ${e}`),!0;if(!o(this,Ae).get(e).visible)return!1}return!0}else if(t.policy==="AnyOff"){for(let e of t.ids){if(!o(this,Ae).has(e))return jt(`Optional content group not found: ${e}`),!0;if(!o(this,Ae).get(e).visible)return!0}return!1}else if(t.policy==="AllOff"){for(let e of t.ids){if(!o(this,Ae).has(e))return jt(`Optional content group not found: ${e}`),!0;if(o(this,Ae).get(e).visible)return!1}return!0}return jt(`Unknown optional content policy ${t.policy}.`),!0}return jt(`Unknown group type ${t.type}.`),!0}setVisibility(t,e=!0,n=!0){let i=o(this,Ae).get(t);if(!i){jt(`Optional content group not found: ${t}`);return}if(n&&e&&i.rbGroups.length)for(let s of i.rbGroups)for(let a of s)a!==t&&o(this,Ae).get(a)?._setVisible(Hu,!1,!0);i._setVisible(Hu,!!e,!0),g(this,Mo,null)}setOCGState({state:t,preserveRB:e}){let n;for(let i of t){switch(i){case"ON":case"OFF":case"Toggle":n=i;continue}let s=o(this,Ae).get(i);if(s)switch(n){case"ON":this.setVisibility(i,!0,e);break;case"OFF":this.setVisibility(i,!1,e);break;case"Toggle":this.setVisibility(i,!s.visible,e);break}}g(this,Mo,null)}get hasInitialVisibility(){return o(this,Lh)===null||this.getHash()===o(this,Lh)}getOrder(){return o(this,Ae).size?o(this,Bh)?o(this,Bh).slice():[...o(this,Ae).keys()]:null}getGroup(t){return o(this,Ae).get(t)||null}getHash(){if(o(this,Mo)!==null)return o(this,Mo);let t=new hy;for(let[e,n]of o(this,Ae))t.update(`${e}:${n.visible}`);return g(this,Mo,t.hexdigest())}[Symbol.iterator](){return o(this,Ae).entries()}};Mo=new WeakMap,Ae=new WeakMap,Lh=new WeakMap,Bh=new WeakMap,om=new WeakSet,i2=function(t){let e=t.length;if(e<2)return!0;let n=t[0];for(let i=1;i<e;i++){let s=t[i],a;if(Array.isArray(s))a=v(this,om,i2).call(this,s);else if(o(this,Ae).has(s))a=o(this,Ae).get(s).visible;else return jt(`Optional content group not found: ${s}`),!0;switch(n){case"And":if(!a)return!1;break;case"Or":if(a)return!0;break;case"Not":return!a;default:return!0}}return n==="And"};r2=class{constructor(){A(this,ei);A(this,rn,null);A(this,zr,null);A(this,$n,0);A(this,lc,null);A(this,Ts,null)}get pagesNumber(){return o(this,$n)}set pagesNumber(t){o(this,$n)!==t&&(g(this,$n,t),g(this,rn,null),g(this,zr,null))}movePages(t,e,n){v(this,ei,Rf).call(this);let i=o(this,rn),s=v(this,ei,Lf).call(this),a=e.length,l=new Uint32Array(a),c=0;for(let f=0;f<a;f++){let p=e[f]-1;l[f]=i[p],p<n&&c++}let u=o(this,$n),h=u-a,d=yn(n-c,0,h);for(let f=0,p=0;f<u;f++)t.has(f+1)||(i[p++]=i[f]);i.copyWithin(d+a,d,h),i.set(l,d),v(this,ei,F0).call(this,s),i.every((f,p)=>f===p+1)&&g(this,rn,null)}deletePages(t){v(this,ei,Rf).call(this);let e=o(this,rn),n=v(this,ei,Lf).call(this);g(this,Ts,{pageNumberToId:e.slice(),pagesNumber:o(this,$n),prevPageNumbers:o(this,zr).slice()});let i=o(this,$n)-t.length;g(this,$n,i);let s=g(this,rn,new Uint32Array(i));g(this,zr,new Int32Array(i));let a=0,l=0;for(let c of t){let u=c-1;u!==a&&(s.set(e.subarray(a,u),l),l+=u-a),a=u+1}a<e.length&&s.set(e.subarray(a),l),v(this,ei,F0).call(this,n,new Set(t))}cancelDelete(){o(this,Ts)&&(g(this,rn,o(this,Ts).pageNumberToId),g(this,$n,o(this,Ts).pagesNumber),g(this,zr,o(this,Ts).prevPageNumbers),g(this,Ts,null))}cleanSavedData(){g(this,Ts,null)}copyPages(t){v(this,ei,Rf).call(this),g(this,lc,{pageNumbers:t,pageIds:t.map(e=>o(this,rn)[e-1])})}cancelCopy(){g(this,lc,null)}pastePages(t){v(this,ei,Rf).call(this);let e=o(this,rn),n=v(this,ei,Lf).call(this),{pageNumbers:i,pageIds:s}=o(this,lc),a=o(this,$n)+i.length;g(this,$n,a);let l=g(this,rn,new Uint32Array(a));g(this,zr,new Int32Array(a)),l.set(e.subarray(0,t),0),l.set(s,t),l.set(e.subarray(t),t+i.length),v(this,ei,F0).call(this,n,null,t,i),g(this,lc,null)}hasBeenAltered(){return o(this,rn)!==null}getPageMappingForSaving(t=null){t??(t=v(this,ei,Lf).call(this));let e=0;for(let i of t.values())e=Math.max(e,i.length);let n=new Array(e);for(let i=0;i<e;i++)n[i]={document:null,pageIndices:[],includePages:[]};for(let[i,s]of t)for(let a=0,l=s.length;a<l;a++)n[a].includePages.push([i-1,s[a]-1]);for(let{includePages:i,pageIndices:s}of n){i.sort((a,l)=>a[0]-l[0]);for(let a=0,l=i.length;a<l;a++)s.push(i[a][1]),i[a]=i[a][0]}return n}extractPages(t){t=Array.from(t).sort((n,i)=>n-i);let e=new Map;for(let n=0,i=t.length;n<i;n++){let s=this.getPageId(t[n]);e.getOrInsertComputed(s,cb).push(n+1)}return this.getPageMappingForSaving(e)}getPrevPageNumber(t){return o(this,zr)?.[t-1]??0}getPageNumber(t){if(!o(this,rn))return t;let e=o(this,rn);for(let n=0,i=o(this,$n);n<i;n++)if(e[n]===t)return n+1;return 0}getPageId(t){return o(this,rn)?.[t-1]??t}getMapping(){return o(this,rn)?.subarray(0,this.pagesNumber)}};rn=new WeakMap,zr=new WeakMap,$n=new WeakMap,lc=new WeakMap,Ts=new WeakMap,ei=new WeakSet,Rf=function(){if(o(this,rn))return;let t=o(this,$n),e=g(this,rn,new Uint32Array(t));for(let n=0;n<t;n++)e[n]=n+1;g(this,zr,new Int32Array(e))},Lf=function(){let t=new Map,e=o(this,rn);for(let n=0,i=o(this,$n);n<i;n++){let s=e[n],a=t.get(s);a?a.push(n+1):t.set(s,[n+1])}return t},F0=function(t,e=null,n=-1,i=null){let s=o(this,zr),a=o(this,rn),l=n+(i?.length??0),c=new Map;for(let u=0,h=o(this,$n);u<h;u++){if(u>=n&&u<l){s[u]=-i[u-n];continue}let d=a[u],f=t.get(d),p=c.get(d)||0;if(e&&f)for(;p<f.length&&e.has(f[p]);)p++;s[u]=f?.[p],c.set(d,p+1)}};Wu=Symbol("INITIAL_DATA"),TT=()=>({...Promise.withResolvers(),data:Wu}),xy=class{constructor(){A(this,Ar,new Map)}get(t,e=null){if(e){let i=o(this,Ar).getOrInsertComputed(t,TT);return i.promise.then(()=>e(i.data)),null}let n=o(this,Ar).get(t);if(!n||n.data===Wu)throw new Error(`Requesting object that isn't resolved yet ${t}.`);return n.data}has(t){let e=o(this,Ar).get(t);return!!e&&e.data!==Wu}delete(t){let e=o(this,Ar).get(t);return!e||e.data===Wu?!1:(o(this,Ar).delete(t),!0)}resolve(t,e=null){let n=o(this,Ar).getOrInsertComputed(t,TT);if(n.data!==Wu)throw new Error(`Object already resolved ${t}.`);n.data=e,n.resolve()}clear(){for(let{data:t}of o(this,Ar).values())t?.bitmap?.close();o(this,Ar).clear()}*[Symbol.iterator](){for(let[t,{data:e}]of o(this,Ar))e!==Wu&&(yield[t,e])}};Ar=new WeakMap;ZO=1e5,ST=30,Rn=class Rn{constructor({textContentSource:t,images:e,container:n,viewport:i}){A(this,qa);A(this,Oo,Promise.withResolvers());A(this,ai,null);A(this,lm,!1);A(this,cm,!!globalThis.FontInspector?.enabled);A(this,Uh,null);A(this,cc,null);A(this,Aa,null);A(this,um,0);A(this,hm,0);A(this,uc,null);A(this,dm,null);A(this,$h,0);A(this,Fo,0);A(this,zh,Object.create(null));A(this,fm,[]);A(this,jh,null);A(this,hc,[]);A(this,pm,new WeakMap);A(this,mm,null);var u;if(t instanceof ReadableStream)g(this,jh,t);else if(typeof t=="object")g(this,jh,new ReadableStream({start(h){h.enqueue(t),h.close()}}));else throw new Error('No "textContentSource" parameter specified.');g(this,ai,g(this,dm,n)),g(this,Uh,e),g(this,Fo,i.scale*Ls.pixelRatio),g(this,$h,i.rotation),g(this,Aa,{div:null,properties:null,ctx:null});let{pageWidth:s,pageHeight:a,pageX:l,pageY:c}=i.rawDims;g(this,mm,[1,0,0,-1,-l,c+a]),g(this,hm,s),g(this,um,a),v(u=Rn,Ji,$S).call(u),n.style.setProperty("--min-font-size",o(Rn,Hh)),el(n,i),o(this,Oo).promise.finally(()=>{o(Rn,Wh).delete(this),g(this,Aa,null),g(this,zh,null)}).catch(()=>{})}static get fontFamilyMap(){let{isWindows:t,isFirefox:e}=Xe.platform;return Ut(this,"fontFamilyMap",new Map([["sans-serif",`${t&&e?"Calibri, ":""}sans-serif`],["monospace",`${t&&e?"Lucida Console, ":""}monospace`]]))}render(){o(this,Uh)&&o(this,ai).append(o(this,Uh).render());let t=()=>{o(this,uc).read().then(({value:e,done:n})=>{if(n){o(this,Oo).resolve();return}o(this,cc)??g(this,cc,e.lang),Object.assign(o(this,zh),e.styles),v(this,qa,BS).call(this,e.items),t()},o(this,Oo).reject)};return g(this,uc,o(this,jh).getReader()),o(Rn,Wh).add(this),t(),o(this,Oo).promise}update({viewport:t,onBefore:e=null}){var s;let n=t.scale*Ls.pixelRatio,i=t.rotation;if(i!==o(this,$h)&&(e?.(),g(this,$h,i),el(o(this,dm),{rotation:i})),n!==o(this,Fo)){e?.(),g(this,Fo,n);let a={div:null,properties:null,ctx:v(s=Rn,Ji,P0).call(s,o(this,cc))};for(let l of o(this,hc))a.properties=o(this,pm).get(l),a.div=l,v(this,qa,s2).call(this,a)}}cancel(){let t=new Qr("TextLayer task cancelled.");o(this,uc)?.cancel(t).catch(()=>{}),g(this,uc,null),o(this,Oo).reject(t)}get textDivs(){return o(this,hc)}get textContentItemsStr(){return o(this,fm)}static cleanup(){if(!(o(this,Wh).size>0)){o(this,Gh).clear();for(let{canvas:t}of o(this,dc).values())t.remove();o(this,dc).clear()}}};Oo=new WeakMap,ai=new WeakMap,lm=new WeakMap,cm=new WeakMap,Uh=new WeakMap,cc=new WeakMap,Aa=new WeakMap,um=new WeakMap,hm=new WeakMap,uc=new WeakMap,dm=new WeakMap,$h=new WeakMap,Fo=new WeakMap,zh=new WeakMap,fm=new WeakMap,jh=new WeakMap,hc=new WeakMap,pm=new WeakMap,mm=new WeakMap,Gh=new WeakMap,dc=new WeakMap,gm=new WeakMap,Hh=new WeakMap,Wh=new WeakMap,qa=new WeakSet,BS=function(t){var i,s;if(o(this,lm))return;(s=o(this,Aa)).ctx??(s.ctx=v(i=Rn,Ji,P0).call(i,o(this,cc)));let e=o(this,hc),n=o(this,fm);for(let a of t){if(e.length>ZO){jt("Ignoring additional textDivs for performance reasons."),g(this,lm,!0);return}if(a.str===void 0){if(a.type==="beginMarkedContentProps"||a.type==="beginMarkedContent"){let l=o(this,ai);g(this,ai,document.createElement("span")),o(this,ai).classList.add("markedContent"),a.id&&o(this,ai).setAttribute("id",`${a.id}`),a.tag==="Artifact"&&(o(this,ai).ariaHidden=!0),l.append(o(this,ai))}else a.type==="endMarkedContent"&&g(this,ai,o(this,ai).parentNode);continue}n.push(a.str),v(this,qa,US).call(this,a)}},US=function(t){var m;let e=document.createElement("span"),n={angle:0,canvasWidth:0,hasText:t.str!=="",hasEOL:t.hasEOL,fontSize:0};o(this,hc).push(e);let i=yt.transform(o(this,mm),t.transform),s=Math.atan2(i[1],i[0]),a=o(this,zh)[t.fontName];a.vertical&&(s+=Math.PI/2);let l=o(this,cm)&&a.fontSubstitution||a.fontFamily;l=Rn.fontFamilyMap.get(l)||l;let c=Math.hypot(i[2],i[3]),u=c*v(m=Rn,Ji,zS).call(m,l,a,o(this,cc)),h,d;s===0?(h=i[4],d=i[5]-u):(h=i[4]+u*Math.sin(s),d=i[5]-u*Math.cos(s));let f=e.style;f.left=`${(100*h/o(this,hm)).toFixed(2)}%`,f.top=`${(100*d/o(this,um)).toFixed(2)}%`,f.setProperty("--font-height",`${c.toFixed(2)}px`),f.fontFamily=l,n.fontSize=c,e.setAttribute("role","presentation"),e.textContent=t.str,e.dir=t.dir,o(this,cm)&&(e.dataset.fontName=a.fontSubstitutionLoadedName||t.fontName),s!==0&&(n.angle=s*(180/Math.PI));let p=!1;if(t.str.length>1)p=!0;else if(t.str!==" "&&t.transform[0]!==t.transform[3]){let y=Math.abs(t.transform[0]),x=Math.abs(t.transform[3]);y!==x&&Math.max(y,x)/Math.min(y,x)>1.5&&(p=!0)}if(p&&(n.canvasWidth=a.vertical?t.height:t.width),o(this,pm).set(e,n),o(this,Aa).div=e,o(this,Aa).properties=n,v(this,qa,s2).call(this,o(this,Aa)),n.hasText&&o(this,ai).append(e),n.hasEOL){let y=document.createElement("br");y.setAttribute("role","presentation"),o(this,ai).append(y)}},s2=function(t){var a;let{div:e,properties:n,ctx:i}=t,{style:s}=e;if(n.canvasWidth!==0&&n.hasText){let{fontFamily:l}=s,{canvasWidth:c,fontSize:u}=n;v(a=Rn,Ji,a2).call(a,i,u*o(this,Fo),l);let{width:h}=i.measureText(e.textContent);h>0&&s.setProperty("--scale-x",c*o(this,Fo)/h)}n.angle!==0&&s.setProperty("--rotate",`${n.angle}deg`)},Ji=new WeakSet,P0=function(t=null){let e=o(this,dc).get(t||(t=""));if(!e){let n=document.createElement("canvas");n.className="hiddenCanvasElement",n.lang=t,document.body.append(n),e=n.getContext("2d",{alpha:!1,willReadFrequently:!0}),o(this,dc).set(t,e),o(this,gm).set(e,{size:0,family:""})}return e},a2=function(t,e,n){let i=o(this,gm).get(t);e===i.size&&n===i.family||(t.font=`${e}px ${n}`,i.size=e,i.family=n)},$S=function(){if(o(this,Hh)!==null)return;let t=document.createElement("div");t.style.opacity=0,t.style.lineHeight=1,t.style.fontSize="1px",t.style.position="absolute",t.textContent="X",document.body.append(t),g(this,Hh,t.getBoundingClientRect().height),t.remove()},zS=function(t,e,n){let i=o(this,Gh).get(t);if(i)return i;let s=v(this,Ji,P0).call(this,n);s.canvas.width=s.canvas.height=ST,v(this,Ji,a2).call(this,s,ST,t);let a=s.measureText(""),l=a.fontBoundingBoxAscent,c=Math.abs(a.fontBoundingBoxDescent);s.canvas.width=s.canvas.height=0;let u=.8;return l?u=l/(l+c):(Xe.platform.isFirefox&&jt("Enable the `dom.textMetrics.fontBoundingBox.enabled` preference in `about:config` to improve TextLayer rendering."),e.ascent?u=e.ascent:e.descent&&(u=1+e.descent)),o(this,Gh).set(t,u),u},A(Rn,Ji),A(Rn,Gh,new Map),A(Rn,dc,new Map),A(Rn,gm,new WeakMap),A(Rn,Hh,null),A(Rn,Wh,new Set);Fd=Rn,QO=100;Ky=class Ky{constructor(){U(this,"_capability",Promise.withResolvers());U(this,"_transport",null);U(this,"_worker",null);U(this,"docId",`d${an(Ky,Yy)._++}`);U(this,"destroyed",!1);U(this,"onPassword",null);U(this,"onProgress",null)}get promise(){return this._capability.promise}async destroy(){this.destroyed=!0;try{this._worker?.port&&(this._worker._pendingDestroy=!0),await this._transport?.destroy()}catch(t){throw this._worker?.port&&delete this._worker._pendingDestroy,t}this._transport=null,this._worker?.destroy(),this._worker=null}async getData(){return this._transport.getData()}};Yy=new WeakMap,A(Ky,Yy,0);o2=Ky,op=class{constructor(t,e,n=!1,i=null){A(this,qh,Promise.withResolvers());A(this,ym,[]);A(this,bm,[]);A(this,xm,[]);this.length=t,this.initialData=e,this.progressiveDone=n,this.contentDispositionFilename=i,Object.defineProperty(this,"onDataProgress",{value:()=>{kO("`PDFDataRangeTransport.prototype.onDataProgress` - method was removed, since loading progress is now reported automatically through the `PDFDataTransportStream` class (and related code).")}})}addRangeListener(t){o(this,xm).push(t)}addProgressiveReadListener(t){o(this,bm).push(t)}addProgressiveDoneListener(t){o(this,ym).push(t)}onDataRange(t,e){for(let n of o(this,xm))n(t,e)}onDataProgressiveRead(t){o(this,qh).promise.then(()=>{for(let e of o(this,bm))e(t)})}onDataProgressiveDone(){o(this,qh).promise.then(()=>{for(let t of o(this,ym))t()})}transportReady(){o(this,qh).resolve()}requestDataRange(t,e){ue("Abstract method PDFDataRangeTransport.requestDataRange")}abort(){}};qh=new WeakMap,ym=new WeakMap,bm=new WeakMap,xm=new WeakMap;l2=class{constructor(t,e){this._pdfInfo=t,this._transport=e}get pagesMapper(){return this._transport.pagesMapper}get annotationStorage(){return this._transport.annotationStorage}get canvasFactory(){return this._transport.canvasFactory}get filterFactory(){return this._transport.filterFactory}get numPages(){return this._pdfInfo.numPages}get fingerprints(){return this._pdfInfo.fingerprints}get isPureXfa(){return Ut(this,"isPureXfa",!!this._transport._htmlForXfa)}get allXfaHtml(){return this._transport._htmlForXfa}getPage(t){return this._transport.getPage(t)}getPageIndex(t){return this._transport.getPageIndex(t)}getDestinations(){return this._transport.getDestinations()}getDestination(t){return this._transport.getDestination(t)}getPageLabels(){return this._transport.getPageLabels()}getPageLayout(){return this._transport.getPageLayout()}getPageMode(){return this._transport.getPageMode()}getViewerPreferences(){return this._transport.getViewerPreferences()}getOpenAction(){return this._transport.getOpenAction()}getAttachments(){return this._transport.getAttachments()}getAnnotationsByType(t,e){return this._transport.getAnnotationsByType(t,e)}getJSActions(){return this._transport.getDocJSActions()}getOutline(){return this._transport.getOutline()}getOptionalContentConfig({intent:t="display"}={}){let{renderingIntent:e}=this._transport.getRenderingIntent(t);return this._transport.getOptionalContentConfig(e)}getPermissions(){return this._transport.getPermissions()}getMetadata(){return this._transport.getMetadata()}getMarkInfo(){return this._transport.getMarkInfo()}getData(){return this._transport.getData()}saveDocument(){return this._transport.saveDocument()}extractPages(t){return this._transport.extractPages(t)}getDownloadInfo(){return this._transport.downloadInfoCapability.promise}getRawData(t){return this._transport.getRawData(t)}cleanup(t=!1){return this._transport.startCleanup(t||this.isPureXfa)}destroy(){return this.loadingTask.destroy()}cachedPageNumber(t){return this._transport.cachedPageNumber(t)}get loadingParams(){return this._transport.loadingParams}get loadingTask(){return this._transport.loadingTask}getFieldObjects(){return this._transport.getFieldObjects()}hasJSActions(){return this._transport.hasJSActions()}getCalculationOrderIds(){return this._transport.getCalculationOrderIds()}},EA=class EA{constructor(t,e,n,i,s=!1){A(this,pc);A(this,va,!1);A(this,fc,null);this._pageIndex=t,this._pageInfo=e,this._transport=n,this._stats=s?new oy:null,this._pdfBug=s,this.commonObjs=n.commonObjs,this.objs=new xy,this._intentStates=new Map,this.destroyed=!1,this.recordedBBoxes=null,g(this,fc,i),this.imageCoordinates=null}clone(t){let e=new EA(t,this._pageInfo,this._transport,o(this,fc),this._pdfBug);return e.clonedFromIndex=this.clonedFromIndex??this._pageIndex,this._transport.updatePage(e),e}get pageNumber(){return this._pageIndex+1}set pageNumber(t){this._pageIndex=t-1,this._transport.updatePage(this)}get rotate(){return this._pageInfo.rotate}get ref(){return this._pageInfo.ref}get userUnit(){return this._pageInfo.userUnit}get view(){return this._pageInfo.view}getViewport({scale:t,rotation:e=this.rotate,offsetX:n=0,offsetY:i=0,dontFlip:s=!1}={}){return new np({viewBox:this.view,userUnit:this.userUnit,scale:t,rotation:e,offsetX:n,offsetY:i,dontFlip:s})}getAnnotations({intent:t="display"}={}){let{renderingIntent:e}=this._transport.getRenderingIntent(t);return this._transport.getAnnotations(this._pageIndex,e)}getJSActions(){return this._transport.getPageJSActions(this._pageIndex)}get filterFactory(){return this._transport.filterFactory}get isPureXfa(){return Ut(this,"isPureXfa",!!this._transport._htmlForXfa)}async getXfa(){return this._transport._htmlForXfa?.children[this._pageIndex]||null}render({canvasContext:t,canvas:e=t.canvas,viewport:n,intent:i="display",annotationMode:s=Ba.ENABLE,transform:a=null,background:l=null,optionalContentConfigPromise:c=null,annotationCanvasMap:u=null,pageColors:h=null,printAnnotationStorage:d=null,isEditing:f=!1,recordImages:p=!1,recordOperations:m=!1,operationsFilter:y=null}){this._stats?.time("Overall");let x=this._transport.getRenderingIntent(i,s,d,f),{renderingIntent:b,cacheKey:w}=x;g(this,va,!1),c||(c=this._transport.getOptionalContentConfig(b));let C=this._intentStates.getOrInsertComputed(w,ay);C.streamReaderCancelTimeout&&(clearTimeout(C.streamReaderCancelTimeout),C.streamReaderCancelTimeout=null);let E=!!(b&Yi.PRINT);C.displayReadyCapability||(C.displayReadyCapability=Promise.withResolvers(),C.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},this._stats?.time("Page Request"),this._pumpOperatorList(x));let S=!!(this._pdfBug&&globalThis.StepperManager?.enabled),N=!!e&&!this.recordedBBoxes&&(m||S),k=!!e&&!this.imageCoordinates&&p,M=Q=>{if(C.renderTasks.delete($),N){let Z=$.gfx?.dependencyTracker.take();Z&&($.stepper?.setOperatorBBoxes(Z,$.gfx.dependencyTracker.takeDebugMetadata()),m&&(this.recordedBBoxes=Z))}k&&!Q&&(this.imageCoordinates=$.gfx?.imagesTracker.take()),E&&g(this,va,!0),v(this,pc,Bf).call(this),Q?($.capability.reject(Q),this._abortOperatorList({intentState:C,reason:Q instanceof Error?Q:new Error(Q)})):$.capability.resolve(),this._stats&&(this._stats.timeEnd("Rendering"),this._stats.timeEnd("Overall"),globalThis.Stats?.enabled&&globalThis.Stats.add(this.pageNumber,this._stats))},R=null,j=null;(N||k)&&(j=new hw(e,C.operatorList.length)),N&&(R=new fw(j,S));let $=new d2({callback:M,params:{canvas:e,canvasContext:t,dependencyTracker:R??j,imagesTracker:k?new pw(e):null,viewport:n,transform:a,background:l},objs:this.objs,commonObjs:this.commonObjs,annotationCanvasMap:u,operatorList:C.operatorList,pageIndex:this._pageIndex,canvasFactory:this._transport.canvasFactory,filterFactory:this._transport.filterFactory,useRequestAnimationFrame:!E,pdfBug:this._pdfBug,pageColors:h,enableHWA:this._transport.enableHWA,operationsFilter:y});(C.renderTasks||(C.renderTasks=new Set)).add($);let q=$.task;return Promise.all([C.displayReadyCapability.promise,c]).then(([Q,Z])=>{if(this.destroyed){M();return}if(this._stats?.time("Rendering"),!(Z.renderingIntent&b))throw new Error("Must use the same `intent`-argument when calling the `PDFPageProxy.render` and `PDFDocumentProxy.getOptionalContentConfig` methods.");$.initializeGraphics({transparency:Q,optionalContentConfig:Z}),$.operatorListChanged()}).catch(M),q}getOperatorList({intent:t="display",annotationMode:e=Ba.ENABLE,printAnnotationStorage:n=null,isEditing:i=!1}={}){function s(){l.operatorList.lastChunk&&(l.opListReadCapability.resolve(l.operatorList),l.renderTasks.delete(c))}let a=this._transport.getRenderingIntent(t,e,n,i,!0),l=this._intentStates.getOrInsertComputed(a.cacheKey,ay),c;return l.opListReadCapability||(c=Object.create(null),c.operatorListChanged=s,l.opListReadCapability=Promise.withResolvers(),(l.renderTasks||(l.renderTasks=new Set)).add(c),l.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},this._stats?.time("Page Request"),this._pumpOperatorList(a)),l.opListReadCapability.promise}streamTextContent({includeMarkedContent:t=!1,disableNormalization:e=!1}={}){return this._transport.messageHandler.sendWithStream("GetTextContent",{pageId:o(this,fc).getPageId(this._pageIndex+1)-1,pageIndex:this._pageIndex,includeMarkedContent:t===!0,disableNormalization:e===!0},{highWaterMark:100,size(i){return i.items.length}})}async getTextContent(t={}){if(this._transport._htmlForXfa)return this.getXfa().then(i=>tp.textContent(i));let e=this.streamTextContent(t),n={items:[],styles:Object.create(null),lang:null};for await(let i of e)n.lang??(n.lang=i.lang),Object.assign(n.styles,i.styles),n.items.push(...i.items);return n}getStructTree(){return this._transport.getStructTree(this._pageIndex)}_destroy(){this.destroyed=!0;let t=[];for(let e of this._intentStates.values())if(this._abortOperatorList({intentState:e,reason:new Error("Page was destroyed."),force:!0}),!e.opListReadCapability)for(let n of e.renderTasks)t.push(n.completed),n.cancel();return this.objs.clear(),g(this,va,!1),Promise.all(t)}cleanup(t=!1){g(this,va,!0);let e=v(this,pc,Bf).call(this);return t&&e&&this._stats&&(this._stats=new oy),e}_startRenderPage(t,e){let n=this._intentStates.get(e);n&&(this._stats?.timeEnd("Page Request"),n.displayReadyCapability?.resolve(t))}_renderPageChunk(t,e){for(let n=0,i=t.length;n<i;n++)e.operatorList.fnArray.push(t.fnArray[n]),e.operatorList.argsArray.push(t.argsArray[n]);e.operatorList.lastChunk=t.lastChunk,e.operatorList.separateAnnots=t.separateAnnots;for(let n of e.renderTasks)n.operatorListChanged();t.lastChunk&&v(this,pc,Bf).call(this)}_pumpOperatorList({renderingIntent:t,cacheKey:e,annotationStorageSerializable:n,modifiedIds:i}){let{map:s,transfer:a}=n,c=this._transport.messageHandler.sendWithStream("GetOperatorList",{pageId:o(this,fc).getPageId(this._pageIndex+1)-1,pageIndex:this._pageIndex,intent:t,cacheKey:e,annotationStorage:s,modifiedIds:i},void 0,a).getReader(),u=this._intentStates.get(e);u.streamReader=c;let h=()=>{c.read().then(({value:d,done:f})=>{if(f){u.streamReader=null;return}this._transport.destroyed||(this._renderPageChunk(d,u),h())},d=>{if(u.streamReader=null,!this._transport.destroyed){if(u.operatorList){u.operatorList.lastChunk=!0;for(let f of u.renderTasks)f.operatorListChanged();v(this,pc,Bf).call(this)}if(u.displayReadyCapability)u.displayReadyCapability.reject(d);else if(u.opListReadCapability)u.opListReadCapability.reject(d);else throw d}})};h()}_abortOperatorList({intentState:t,reason:e,force:n=!1}){if(t.streamReader){if(t.streamReaderCancelTimeout&&(clearTimeout(t.streamReaderCancelTimeout),t.streamReaderCancelTimeout=null),!n){if(t.renderTasks.size>0)return;if(e instanceof kd){let i=QO;e.extraDelay>0&&e.extraDelay<1e3&&(i+=e.extraDelay),t.streamReaderCancelTimeout=setTimeout(()=>{t.streamReaderCancelTimeout=null,this._abortOperatorList({intentState:t,reason:e,force:!0})},i);return}}if(t.streamReader.cancel(new Qr(e.message)).catch(()=>{}),t.streamReader=null,!this._transport.destroyed){for(let[i,s]of this._intentStates)if(s===t){this._intentStates.delete(i);break}this.cleanup()}}}get stats(){return this._stats}};va=new WeakMap,fc=new WeakMap,pc=new WeakSet,Bf=function(){if(!o(this,va)||this.destroyed)return!1;for(let{renderTasks:t,operatorList:e}of this._intentStates.values())if(t.size>0||!e.lastChunk)return!1;return this._intentStates.clear(),this.objs.clear(),g(this,va,!1),!0};c2=EA,Ge=class Ge{constructor({name:t=null,port:e=null,verbosity:n=vO()}={}){A(this,ui);A(this,Po,Promise.withResolvers());A(this,jr,null);A(this,Ca,null);A(this,mc,null);if(this.name=t,this.destroyed=!1,this.verbosity=n,e){if(o(Ge,yc).has(e))throw new Error("Cannot use more than one PDFWorker per port.");o(Ge,yc).set(e,this),v(this,ui,GS).call(this,e)}else v(this,ui,HS).call(this)}get promise(){return o(this,Po).promise}get port(){return o(this,Ca)}get messageHandler(){return o(this,jr)}destroy(){this.destroyed=!0,o(this,mc)?.terminate(),g(this,mc,null),o(Ge,yc).delete(o(this,Ca)),g(this,Ca,null),o(this,jr)?.destroy(),g(this,jr,null)}static create(t){let e=o(this,yc).get(t?.port);if(e){if(e._pendingDestroy)throw new Error("PDFWorker.create - the worker is being destroyed.\nPlease remember to await `PDFDocumentLoadingTask.destroy()`-calls.");return e}return new Ge(t)}static get workerSrc(){if(Tr.workerSrc)return Tr.workerSrc;throw new Error('No "GlobalWorkerOptions.workerSrc" specified.')}static get _setupFakeWorkerGlobal(){return Ut(this,"_setupFakeWorkerGlobal",(async()=>o(this,Vh,L0)?o(this,Vh,L0):(await import(/* @vite-ignore */ /* webpackIgnore: true */ this.workerSrc)).WorkerMessageHandler)())}};Po=new WeakMap,jr=new WeakMap,Ca=new WeakMap,mc=new WeakMap,Zy=new WeakMap,gc=new WeakMap,yc=new WeakMap,ui=new WeakSet,R0=function(){o(this,Po).resolve(),o(this,jr).send("configure",{verbosity:this.verbosity})},GS=function(t){g(this,Ca,t),g(this,jr,new Nl("main","worker",t)),o(this,jr).on("ready",()=>{}),v(this,ui,R0).call(this)},HS=function(){if(o(Ge,gc)||o(Ge,Vh,L0)){v(this,ui,Uf).call(this);return}let{workerSrc:t}=Ge;try{Ge._isSameOrigin(window.location,t)||(t=Ge._createCDNWrapper(new URL(t,window.location).href));let e=new Worker(t,{type:"module"}),n=new Nl("main","worker",e),i=()=>{s.abort(),n.destroy(),e.terminate(),this.destroyed?o(this,Po).reject(new Error("Worker was destroyed")):v(this,ui,Uf).call(this)},s=new AbortController;e.addEventListener("error",()=>{o(this,mc)||i()},{signal:s.signal}),n.on("test",l=>{if(s.abort(),this.destroyed||!l){i();return}g(this,jr,n),g(this,Ca,e),g(this,mc,e),v(this,ui,R0).call(this)}),n.on("ready",l=>{if(s.abort(),this.destroyed){i();return}try{a()}catch{v(this,ui,Uf).call(this)}});let a=()=>{let l=new Uint8Array;n.send("test",l,[l.buffer])};a();return}catch{ob("The worker has been disabled.")}v(this,ui,Uf).call(this)},Uf=function(){o(Ge,gc)||(jt("Setting up fake worker."),g(Ge,gc,!0)),Ge._setupFakeWorkerGlobal.then(t=>{if(this.destroyed){o(this,Po).reject(new Error("Worker was destroyed"));return}let e=new Ew;g(this,Ca,e);let n=`fake${an(Ge,Zy)._++}`,i=new Nl(n+"_worker",n,e);t.setup(i,e),g(this,jr,new Nl(n,n+"_worker",e)),v(this,ui,R0).call(this)}).catch(t=>{o(this,Po).reject(new Error(`Setting up fake worker failed: "${t.message}".`))})},Vh=new WeakSet,L0=function(){try{return globalThis.pdfjsWorker?.WorkerMessageHandler||null}catch{return null}},A(Ge,Vh),A(Ge,Zy,0),A(Ge,gc,!1),A(Ge,yc,new WeakMap),Ki&&(g(Ge,gc,!0),Tr.workerSrc||(Tr.workerSrc="./pdf.worker.mjs")),Ge._isSameOrigin=(t,e)=>{let n=URL.parse(t);if(!n?.origin||n.origin==="null")return!1;let i=new URL(e,n);return n.origin===i.origin},Ge._createCDNWrapper=t=>{let e=`await import("${t}");`;return URL.createObjectURL(new Blob([e],{type:"text/javascript"}))};Pd=Ge,u2=class{constructor(t,e,n,i,s,a){A(this,Zr);U(this,"downloadInfoCapability",Promise.withResolvers());A(this,Pi,null);A(this,bc,new Map);A(this,Ea,null);A(this,Gr,new Map);A(this,xc,new Map);A(this,Xh,new Map);A(this,Ta,null);this.messageHandler=t,this.loadingTask=e,g(this,Ea,n),this.commonObjs=new xy,this.fontLoader=new mw({ownerDocument:i.ownerDocument,styleElement:i.styleElement}),this.enableHWA=i.enableHWA,this.loadingParams=i.loadingParams,this._params=i,this.canvasFactory=s.canvasFactory,this.filterFactory=s.filterFactory,this.binaryDataFactory=s.binaryDataFactory,this.pagesMapper=a,this.destroyed=!1,this.destroyCapability=null,this.setupMessageHandler()}updatePage(t){let{_pageIndex:e}=t;o(this,Gr).set(e,t),o(this,xc).set(e,Promise.resolve(t))}get annotationStorage(){return Ut(this,"annotationStorage",new sp)}getRenderingIntent(t,e=Ba.ENABLE,n=null,i=!1,s=!1){let a=Yi.DISPLAY,l=rp;switch(t){case"any":a=Yi.ANY;break;case"display":break;case"print":a=Yi.PRINT;break;default:jt(`getRenderingIntent - invalid intent: ${t}`)}let c=a&Yi.PRINT&&n instanceof dy?n:this.annotationStorage;switch(e){case Ba.DISABLE:a+=Yi.ANNOTATIONS_DISABLE;break;case Ba.ENABLE:break;case Ba.ENABLE_FORMS:a+=Yi.ANNOTATIONS_FORMS;break;case Ba.ENABLE_STORAGE:a+=Yi.ANNOTATIONS_STORAGE,l=c.serializable;break;default:jt(`getRenderingIntent - invalid annotationMode: ${e}`)}i&&(a+=Yi.IS_EDITING),s&&(a+=Yi.OPLIST);let{ids:u,hash:h}=c.modifiedIds,d=[a,l.hash,h];return{renderingIntent:a,cacheKey:d.join("_"),annotationStorageSerializable:l,modifiedIds:u}}destroy(){if(this.destroyCapability)return this.destroyCapability.promise;this.destroyed=!0,this.destroyCapability=Promise.withResolvers(),o(this,Ta)?.reject(new Error("Worker was destroyed during onPassword callback"));let t=[];for(let n of o(this,Gr).values())t.push(n._destroy());o(this,Gr).clear(),o(this,xc).clear(),o(this,Xh).clear(),this.hasOwnProperty("annotationStorage")&&this.annotationStorage.resetModified();let e=this.messageHandler.sendWithPromise("Terminate",null);return t.push(e),Promise.all(t).then(()=>{this.commonObjs.clear(),this.fontLoader.clear(),o(this,bc).clear(),this.filterFactory.destroy(),Fd.cleanup(),o(this,Ea)?.cancelAllRequests(new Qr("Worker was terminated.")),this.messageHandler?.destroy(),this.messageHandler=null,this.destroyCapability.resolve()},this.destroyCapability.reject),this.destroyCapability.promise}setupMessageHandler(){let{messageHandler:t,loadingTask:e}=this;t.on("GetReader",(n,i)=>{Ue(o(this,Ea),"GetReader - no `BasePDFStream` instance available."),g(this,Pi,o(this,Ea).getFullReader()),o(this,Pi).onProgress=s=>v(this,Zr,B0).call(this,s),i.onPull=()=>{o(this,Pi).read().then(function({value:s,done:a}){if(a){i.close();return}Ue(s instanceof ArrayBuffer,"GetReader - expected an ArrayBuffer."),i.enqueue(new Uint8Array(s),1,[s])}).catch(s=>{i.error(s)})},i.onCancel=s=>{o(this,Pi).cancel(s),i.ready.catch(a=>{if(!this.destroyed)throw a})}}),t.on("ReaderHeadersReady",async n=>{await o(this,Pi).headersReady;let{isStreamingSupported:i,isRangeSupported:s,contentLength:a}=o(this,Pi);return i&&s&&(o(this,Pi).onProgress=null),{isStreamingSupported:i,isRangeSupported:s,contentLength:a}}),t.on("GetRangeReader",(n,i)=>{Ue(o(this,Ea),"GetRangeReader - no `BasePDFStream` instance available.");let s=o(this,Ea).getRangeReader(n.begin,n.end);if(!s){i.close();return}i.onPull=()=>{s.read().then(function({value:a,done:l}){if(l){i.close();return}Ue(a instanceof ArrayBuffer,"GetRangeReader - expected an ArrayBuffer."),i.enqueue(new Uint8Array(a),1,[a])}).catch(a=>{i.error(a)})},i.onCancel=a=>{s.cancel(a),i.ready.catch(l=>{if(!this.destroyed)throw l})}}),t.on("GetDoc",({pdfInfo:n})=>{this.pagesMapper.pagesNumber=n.numPages,this._numPages=n.numPages,this._htmlForXfa=n.htmlForXfa,delete n.htmlForXfa,e._capability.resolve(new l2(n,this))}),t.on("DocException",n=>{e._capability.reject(xi(n))}),t.on("PasswordRequest",n=>{g(this,Ta,Promise.withResolvers());try{if(!e.onPassword)throw xi(n);let i=s=>{s instanceof Error?o(this,Ta).reject(s):o(this,Ta).resolve({password:s})};e.onPassword(i,n.code)}catch(i){o(this,Ta).reject(i)}return o(this,Ta).promise}),t.on("DataLoaded",n=>{v(this,Zr,B0).call(this,{loaded:n.length,total:n.length}),this.downloadInfoCapability.resolve(n)}),t.on("StartRenderPage",n=>{if(this.destroyed)return;o(this,Gr).get(n.pageIndex)._startRenderPage(n.transparency,n.cacheKey)}),t.on("commonobj",([n,i,s])=>{if(this.destroyed||this.commonObjs.has(n))return null;switch(i){case"Font":if("error"in s){let d=s.error;jt(`Error during font loading: ${d}`),this.commonObjs.resolve(n,d);break}let a=new xw(s),l=this._params.pdfBug&&globalThis.FontInspector?.enabled?(d,f)=>globalThis.FontInspector.fontAdded(d,f):null,c=new gw(a,l,s.charProcOperatorList,s.extra);this.fontLoader.bind(c).catch(()=>t.sendWithPromise("FontFallback",{id:n})).finally(()=>{c.fontExtraProperties||c.clearData(),this.commonObjs.resolve(n,c)});break;case"CopyLocalImage":let{imageRef:u}=s;Ue(u,"The imageRef must be defined.");for(let d of o(this,Gr).values())for(let[,f]of d.objs)if(f?.ref===u)return f.dataLen?(this.commonObjs.resolve(n,structuredClone(f)),f.dataLen):null;break;case"FontPath":this.commonObjs.resolve(n,new vw(s));break;case"Image":this.commonObjs.resolve(n,s);break;case"Pattern":let h=new Aw(s);this.commonObjs.resolve(n,h.getIR());break;default:throw new Error(`Got unknown common object type ${i}`)}return null}),t.on("obj",([n,i,s,a])=>{if(this.destroyed)return;let l=o(this,Gr).get(i);if(!l.objs.has(n)){if(l._intentStates.size===0){a?.bitmap?.close();return}switch(s){case"Image":case"Pattern":l.objs.resolve(n,a);break;default:throw new Error(`Got unknown object type ${s}`)}}}),t.on("DocProgress",n=>{this.destroyed||v(this,Zr,B0).call(this,n)}),t.on("PrepareWebGPU",()=>{this.destroyed||LO()}),t.on("FetchBinaryData",async n=>{if(this.destroyed)throw new Error("Worker was destroyed.");if(!this.binaryDataFactory)throw new Error("`BinaryDataFactory` not initialized, see the `useWorkerFetch` parameter.");return this.binaryDataFactory.fetch(n)})}getData(){return this.messageHandler.sendWithPromise("GetData",null)}saveDocument(){this.annotationStorage.size<=0&&jt("saveDocument called while `annotationStorage` is empty, please use the getData-method instead.");let{map:t,transfer:e}=this.annotationStorage.serializable;return this.messageHandler.sendWithPromise("SaveDocument",{isPureXfa:!!this._htmlForXfa,numPages:this._numPages,annotationStorage:t,filename:o(this,Pi)?.filename??null},e).finally(()=>{this.annotationStorage.resetModified()})}extractPages(t){let e={pageInfos:t},n;if(this.annotationStorage.size>0){let{map:i,transfer:s}=this.annotationStorage.serializable;e.annotationStorage=i,n=s}return this.messageHandler.sendWithPromise("ExtractPages",e,n).finally(()=>{this.annotationStorage.resetModified()})}getPage(t){if(!Number.isInteger(t)||t<=0||t>this.pagesMapper.pagesNumber)return Promise.reject(new Error("Invalid page request."));let e=t-1,n=this.pagesMapper.getPageId(t)-1,i=o(this,xc).get(e);if(i)return i;let s=this.messageHandler.sendWithPromise("GetPage",{pageIndex:n}).then(a=>{if(this.destroyed)throw new Error("Transport destroyed");a.refStr&&o(this,Xh).set(a.refStr,n);let l=new c2(e,a,this,this.pagesMapper,this._params.pdfBug);return o(this,Gr).set(e,l),l});return o(this,xc).set(e,s),s}async getPageIndex(t){if(!Cw(t))throw new Error("Invalid pageIndex request.");let e=await this.messageHandler.sendWithPromise("GetPageIndex",{num:t.num,gen:t.gen}),n=this.pagesMapper.getPageNumber(e+1);if(n===0)throw new Error("GetPageIndex: page has been removed.");return n-1}getAnnotations(t,e){return this.messageHandler.sendWithPromise("GetAnnotations",{pageIndex:this.pagesMapper.getPageId(t+1)-1,intent:e})}getFieldObjects(){return v(this,Zr,$f).call(this,"GetFieldObjects")}hasJSActions(){return v(this,Zr,$f).call(this,"HasJSActions")}getCalculationOrderIds(){return this.messageHandler.sendWithPromise("GetCalculationOrderIds",null)}getDestinations(){return this.messageHandler.sendWithPromise("GetDestinations",null)}getDestination(t){return typeof t!="string"?Promise.reject(new Error("Invalid destination request.")):this.messageHandler.sendWithPromise("GetDestination",{id:t})}getPageLabels(){return this.messageHandler.sendWithPromise("GetPageLabels",null)}getPageLayout(){return this.messageHandler.sendWithPromise("GetPageLayout",null)}getPageMode(){return this.messageHandler.sendWithPromise("GetPageMode",null)}getViewerPreferences(){return this.messageHandler.sendWithPromise("GetViewerPreferences",null)}getOpenAction(){return this.messageHandler.sendWithPromise("GetOpenAction",null)}getAttachments(){return this.messageHandler.sendWithPromise("GetAttachments",null)}getAnnotationsByType(t,e){return this.messageHandler.sendWithPromise("GetAnnotationsByType",{types:t,pageIndexesToSkip:e})}getDocJSActions(){return v(this,Zr,$f).call(this,"GetDocJSActions")}getPageJSActions(t){return this.messageHandler.sendWithPromise("GetPageJSActions",{pageIndex:this.pagesMapper.getPageId(t+1)-1})}getStructTree(t){return this.messageHandler.sendWithPromise("GetStructTree",{pageIndex:this.pagesMapper.getPageId(t+1)-1})}getOutline(){return this.messageHandler.sendWithPromise("GetOutline",null)}getOptionalContentConfig(t){return v(this,Zr,$f).call(this,"GetOptionalContentConfig").then(e=>new n2(e,t))}getPermissions(){return this.messageHandler.sendWithPromise("GetPermissions",null)}getMetadata(){let t="GetMetadata";return o(this,bc).getOrInsertComputed(t,()=>this.messageHandler.sendWithPromise(t,null).then(e=>({info:e[0],metadata:e[1]?new t2(e[1]):null,contentDispositionFilename:o(this,Pi)?.filename??null,contentLength:o(this,Pi)?.contentLength??null,hasStructTree:e[2]})))}getMarkInfo(){return this.messageHandler.sendWithPromise("GetMarkInfo",null)}getRawData(t){return this.messageHandler.sendWithPromise("GetRawData",t)}async startCleanup(t=!1){if(!this.destroyed){await this.messageHandler.sendWithPromise("Cleanup",null);for(let e of o(this,Gr).values())if(!e.cleanup())throw new Error(`startCleanup: Page ${e.pageNumber} is currently rendering.`);this.commonObjs.clear(),t||this.fontLoader.clear(),o(this,bc).clear(),this.filterFactory.destroy(!0),Fd.cleanup()}}cachedPageNumber(t){if(!Cw(t))return null;let e=t.gen===0?`${t.num}R`:`${t.num}R${t.gen}`,n=o(this,Xh).get(e);if(n>=0){let i=this.pagesMapper.getPageNumber(n+1);if(i!==0)return i}return null}};Pi=new WeakMap,bc=new WeakMap,Ea=new WeakMap,Gr=new WeakMap,xc=new WeakMap,Xh=new WeakMap,Ta=new WeakMap,Zr=new WeakSet,$f=function(t,e=null){return o(this,bc).getOrInsertComputed(t,()=>this.messageHandler.sendWithPromise(t,e))},B0=function({loaded:t,total:e}){this.loadingTask.onProgress?.({loaded:t,total:e,percent:e?yn(Math.round(t/e*100),0,100):NaN})};h2=class{constructor(t){U(this,"_internalRenderTask",null);U(this,"onContinue",null);U(this,"onError",null);this._internalRenderTask=t}get promise(){return this._internalRenderTask.capability.promise}cancel(t=0){this._internalRenderTask.cancel(null,t)}get separateAnnots(){let{separateAnnots:t}=this._internalRenderTask.operatorList;if(!t)return!1;let{annotationCanvasMap:e}=this._internalRenderTask;return t.form||t.canvas&&e?.size>0}get imageCoordinates(){return this._internalRenderTask.imageCoordinates||null}},Tl=class Tl{constructor({callback:t,params:e,objs:n,commonObjs:i,annotationCanvasMap:s,operatorList:a,pageIndex:l,canvasFactory:c,filterFactory:u,useRequestAnimationFrame:h=!1,pdfBug:d=!1,pageColors:f=null,enableHWA:p=!1,operationsFilter:m=null}){A(this,Ro,null);this.callback=t,this.params=e,this.objs=n,this.commonObjs=i,this.annotationCanvasMap=s,this.operatorListIdx=null,this.operatorList=a,this._pageIndex=l,this.canvasFactory=c,this.filterFactory=u,this._pdfBug=d,this.pageColors=f,this.running=!1,this.graphicsReadyCallback=null,this.graphicsReady=!1,this._useRequestAnimationFrame=h===!0&&typeof window<"u",this.cancelled=!1,this.capability=Promise.withResolvers(),this.task=new h2(this),this._cancelBound=this.cancel.bind(this),this._continueBound=this._continue.bind(this),this._scheduleNextBound=this._scheduleNext.bind(this),this._nextBound=this._next.bind(this),this._canvas=e.canvas,this._canvasContext=e.canvas?null:e.canvasContext,this._enableHWA=p,this._dependencyTracker=e.dependencyTracker,this._imagesTracker=e.imagesTracker,this._operationsFilter=m}get completed(){return this.capability.promise.catch(function(){})}initializeGraphics({transparency:t=!1,optionalContentConfig:e}){if(this.cancelled)return;if(this._canvas){if(o(Tl,wc).has(this._canvas))throw new Error("Cannot use the same canvas during multiple render() operations. Use different canvas or ensure previous operations were cancelled or completed.");o(Tl,wc).add(this._canvas)}this._pdfBug&&globalThis.StepperManager?.enabled&&(this.stepper=globalThis.StepperManager.create(this._pageIndex),this.stepper.init(this.operatorList),this.stepper.nextBreakPoint=this.stepper.getNextBreakPoint());let{viewport:n,transform:i,background:s,dependencyTracker:a,imagesTracker:l}=this.params,c=this._canvasContext||this._canvas.getContext("2d",{alpha:!1,willReadFrequently:!this._enableHWA});this.gfx=new Ju(c,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:e},this.annotationCanvasMap,this.pageColors,a,l),this.gfx.beginDrawing({transform:i,viewport:n,transparency:t,background:s}),this.operatorListIdx=0,this.graphicsReady=!0,this.graphicsReadyCallback?.()}cancel(t=null,e=0){this.running=!1,this.cancelled=!0,this.gfx?.endDrawing(),o(this,Ro)&&(window.cancelAnimationFrame(o(this,Ro)),g(this,Ro,null)),o(Tl,wc).delete(this._canvas),t||(t=new kd(`Rendering cancelled, page ${this._pageIndex+1}`,e)),this.callback(t),this.task.onError?.(t)}operatorListChanged(){if(!this.graphicsReady){this.graphicsReadyCallback||(this.graphicsReadyCallback=this._continueBound);return}this.gfx.dependencyTracker?.growOperationsCount(this.operatorList.fnArray.length),this.stepper?.updateOperatorList(this.operatorList),!this.running&&this._continue()}_continue(){this.running=!0,!this.cancelled&&(this.task.onContinue?this.task.onContinue(this._scheduleNextBound):this._scheduleNext())}_scheduleNext(){this._useRequestAnimationFrame?g(this,Ro,window.requestAnimationFrame(()=>{g(this,Ro,null),this._nextBound().catch(this._cancelBound)})):Promise.resolve().then(this._nextBound).catch(this._cancelBound)}async _next(){this.cancelled||(this.operatorListIdx=this.gfx.executeOperatorList(this.operatorList,this.operatorListIdx,this._continueBound,this.stepper,this._operationsFilter),this.operatorListIdx===this.operatorList.argsArray.length&&(this.running=!1,this.operatorList.lastChunk&&(this.gfx.endDrawing(),o(Tl,wc).delete(this._canvas),this.callback())))}};Ro=new WeakMap,wc=new WeakMap,A(Tl,wc,new WeakSet);d2=Tl,WS="5.6.205",qS="ada343803",wi=class wi{constructor({editor:t=null,uiManager:e=null}){A(this,ve);A(this,Ri,null);A(this,Ac,null);A(this,Yh);A(this,gn,null);A(this,wm,!1);A(this,Kh,!1);A(this,Sa,null);A(this,Am);A(this,Lo,null);A(this,Hr,null);t?(g(this,Kh,!1),g(this,Sa,t)):g(this,Kh,!0),g(this,Hr,t?._uiManager||e),g(this,Am,o(this,Hr)._eventBus),g(this,Yh,t?.color?.toUpperCase()||o(this,Hr)?.highlightColors.values().next().value||"#FFFF98"),o(wi,vm)||g(wi,vm,Object.freeze({blue:"pdfjs-editor-colorpicker-blue",green:"pdfjs-editor-colorpicker-green",pink:"pdfjs-editor-colorpicker-pink",red:"pdfjs-editor-colorpicker-red",yellow:"pdfjs-editor-colorpicker-yellow"}))}static get _keyboardManager(){return Ut(this,"_keyboardManager",new Kc([[["Escape","mac+Escape"],wi.prototype._hideDropdownFromKeyboard],[[" ","mac+ "],wi.prototype._colorSelectFromKeyboard],[["ArrowDown","ArrowRight","mac+ArrowDown","mac+ArrowRight"],wi.prototype._moveToNext],[["ArrowUp","ArrowLeft","mac+ArrowUp","mac+ArrowLeft"],wi.prototype._moveToPrevious],[["Home","mac+Home"],wi.prototype._moveToBeginning],[["End","mac+End"],wi.prototype._moveToEnd]]))}renderButton(){let t=g(this,Ri,document.createElement("button"));t.className="colorPicker",t.tabIndex="0",t.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-button"),t.ariaHasPopup="true",o(this,Sa)&&(t.ariaControls=`${o(this,Sa).id}_colorpicker_dropdown`);let e=o(this,Hr)._signal;t.addEventListener("click",v(this,ve,Al).bind(this),{signal:e}),t.addEventListener("keydown",v(this,ve,m2).bind(this),{signal:e});let n=g(this,Ac,document.createElement("span"));return n.className="swatch",n.ariaHidden="true",n.style.backgroundColor=o(this,Yh),t.append(n),t}renderMainDropdown(){let t=g(this,gn,v(this,ve,f2).call(this));return t.ariaOrientation="horizontal",t.ariaLabelledBy="highlightColorPickerLabel",t}_colorSelectFromKeyboard(t){if(t.target===o(this,Ri)){v(this,ve,Al).call(this,t);return}let e=t.target.getAttribute("data-color");e&&v(this,ve,p2).call(this,e,t)}_moveToNext(t){if(!o(this,ve,so)){v(this,ve,Al).call(this,t);return}if(t.target===o(this,Ri)){o(this,gn).firstElementChild?.focus();return}t.target.nextSibling?.focus()}_moveToPrevious(t){if(t.target===o(this,gn)?.firstElementChild||t.target===o(this,Ri)){o(this,ve,so)&&this._hideDropdownFromKeyboard();return}o(this,ve,so)||v(this,ve,Al).call(this,t),t.target.previousSibling?.focus()}_moveToBeginning(t){if(!o(this,ve,so)){v(this,ve,Al).call(this,t);return}o(this,gn).firstElementChild?.focus()}_moveToEnd(t){if(!o(this,ve,so)){v(this,ve,Al).call(this,t);return}o(this,gn).lastElementChild?.focus()}hideDropdown(){o(this,gn)?.classList.add("hidden"),o(this,Ri).ariaExpanded="false",o(this,Lo)?.abort(),g(this,Lo,null)}_hideDropdownFromKeyboard(){if(!o(this,Kh)){if(!o(this,ve,so)){o(this,Sa)?.unselect();return}this.hideDropdown(),o(this,Ri).focus({preventScroll:!0,focusVisible:o(this,wm)})}}updateColor(t){if(o(this,Ac)&&(o(this,Ac).style.backgroundColor=t),!o(this,gn))return;let e=o(this,Hr).highlightColors.values();for(let n of o(this,gn).children)n.ariaSelected=e.next().value===t.toUpperCase()}destroy(){o(this,Ri)?.remove(),g(this,Ri,null),g(this,Ac,null),o(this,gn)?.remove(),g(this,gn,null)}};Ri=new WeakMap,Ac=new WeakMap,Yh=new WeakMap,gn=new WeakMap,wm=new WeakMap,Kh=new WeakMap,Sa=new WeakMap,Am=new WeakMap,Lo=new WeakMap,Hr=new WeakMap,vm=new WeakMap,ve=new WeakSet,f2=function(){let t=document.createElement("div"),e=o(this,Hr)._signal;t.addEventListener("contextmenu",tr,{signal:e}),t.className="dropdown",t.role="listbox",t.ariaMultiSelectable="false",t.ariaOrientation="vertical",t.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-dropdown"),o(this,Sa)&&(t.id=`${o(this,Sa).id}_colorpicker_dropdown`);for(let[n,i]of o(this,Hr).highlightColors){let s=document.createElement("button");s.tabIndex="0",s.role="option",s.setAttribute("data-color",i),s.title=n,s.setAttribute("data-l10n-id",o(wi,vm)[n]);let a=document.createElement("span");s.append(a),a.className="swatch",a.style.backgroundColor=i,s.ariaSelected=i===o(this,Yh),s.addEventListener("click",v(this,ve,p2).bind(this,i),{signal:e}),t.append(s)}return t.addEventListener("keydown",v(this,ve,m2).bind(this),{signal:e}),t},p2=function(t,e){e.stopPropagation(),o(this,Am).dispatch("switchannotationeditorparams",{source:this,type:Zt.HIGHLIGHT_COLOR,value:t}),this.updateColor(t)},m2=function(t){wi._keyboardManager.exec(this,t)},Al=function(t){if(o(this,ve,so)){this.hideDropdown();return}if(g(this,wm,t.detail===0),o(this,Lo)||(g(this,Lo,new AbortController),window.addEventListener("pointerdown",v(this,ve,VS).bind(this),{signal:o(this,Hr).combinedSignal(o(this,Lo))})),o(this,Ri).ariaExpanded="true",o(this,gn)){o(this,gn).classList.remove("hidden");return}let e=g(this,gn,v(this,ve,f2).call(this));o(this,Ri).append(e)},VS=function(t){o(this,gn)?.contains(t.target)||this.hideDropdown()},so=function(){return o(this,gn)&&!o(this,gn).classList.contains("hidden")},A(wi,vm,null);lp=wi,Sl=class Sl{constructor(t){A(this,Ss,null);A(this,Cm,null);A(this,Zh,null);g(this,Cm,t),g(this,Zh,t._uiManager),o(Sl,Em)||g(Sl,Em,Object.freeze({freetext:"pdfjs-editor-color-picker-free-text-input",ink:"pdfjs-editor-color-picker-ink-input"}))}renderButton(){if(o(this,Ss))return o(this,Ss);let{editorType:t,colorType:e,color:n}=o(this,Cm),i=g(this,Ss,document.createElement("input"));return i.type="color",i.value=n||"#000000",i.className="basicColorPicker",i.tabIndex=0,i.setAttribute("data-l10n-id",o(Sl,Em)[t]),i.addEventListener("input",()=>{o(this,Zh).updateParams(e,i.value)},{signal:o(this,Zh)._signal}),i}update(t){o(this,Ss)&&(o(this,Ss).value=t)}destroy(){o(this,Ss)?.remove(),g(this,Ss,null)}hideDropdown(){}};Ss=new WeakMap,Cm=new WeakMap,Zh=new WeakMap,Em=new WeakMap,A(Sl,Em,null);wy=Sl;Ay=class{static CMYK_G([t,e,n,i]){return["G",1-Math.min(1,.3*t+.59*n+.11*e+i)]}static G_CMYK([t]){return["CMYK",0,0,0,1-t]}static G_RGB([t]){return["RGB",t,t,t]}static G_rgb([t]){return t=Cf(t),[t,t,t]}static G_HTML([t]){let e=DT(t);return`#${e}${e}${e}`}static RGB_G([t,e,n]){return["G",.3*t+.59*e+.11*n]}static RGB_rgb(t){return t.map(Cf)}static RGB_HTML(t){return`#${t.map(DT).join("")}`}static T_HTML(){return"#00000000"}static T_rgb(){return[null]}static CMYK_RGB([t,e,n,i]){return["RGB",1-Math.min(1,t+i),1-Math.min(1,n+i),1-Math.min(1,e+i)]}static CMYK_rgb([t,e,n,i]){return[Cf(1-Math.min(1,t+i)),Cf(1-Math.min(1,n+i)),Cf(1-Math.min(1,e+i))]}static CMYK_HTML(t){let e=this.CMYK_RGB(t).slice(1);return this.RGB_HTML(e)}static RGB_CMYK([t,e,n]){let i=1-t,s=1-e,a=1-n,l=Math.min(i,s,a);return["CMYK",i,s,a,l]}},g2=class{create(t,e,n=!1){if(t<=0||e<=0)throw new Error("Invalid SVG dimensions");let i=this._createSVG("svg:svg");return i.setAttribute("version","1.1"),n||(i.setAttribute("width",`${t}px`),i.setAttribute("height",`${e}px`)),i.setAttribute("preserveAspectRatio","none"),i.setAttribute("viewBox",`0 0 ${t} ${e}`),i}createElement(t){if(typeof t!="string")throw new Error("Invalid SVG element type");return this._createSVG(t)}_createSVG(t){ue("Abstract method `_createSVG` called.")}},Zc=class extends g2{_createSVG(t){return document.createElementNS(ta,t)}},JO=9,Qc=new WeakSet,tF=new Date().getTimezoneOffset()*60*1e3,Kf=class{static create(t){switch(t.data.annotationType){case tn.LINK:return new cp(t);case tn.TEXT:return new x2(t);case tn.WIDGET:switch(t.data.fieldType){case"Tx":return new w2(t);case"Btn":return t.data.radioButton?new vy(t):t.data.checkBox?new v2(t):new C2(t);case"Ch":return new E2(t);case"Sig":return new A2(t)}return new Ga(t);case tn.POPUP:return new up(t);case tn.FREETEXT:return new Cy(t);case tn.LINE:return new M2(t);case tn.SQUARE:return new O2(t);case tn.CIRCLE:return new F2(t);case tn.POLYLINE:return new Ey(t);case tn.CARET:return new R2(t);case tn.INK:return new hp(t);case tn.POLYGON:return new P2(t);case tn.HIGHLIGHT:return new Ty(t);case tn.UNDERLINE:return new B2(t);case tn.SQUIGGLY:return new U2(t);case tn.STRIKEOUT:return new $2(t);case tn.STAMP:return new Sy(t);case tn.FILEATTACHMENT:return new z2(t);default:return new $e(t)}}},TA=class TA{constructor(t,{isRenderable:e=!1,ignoreBorder:n=!1,createQuadrilaterals:i=!1}={}){A(this,Tm);A(this,vc,null);A(this,Qh,!1);A(this,vr,null);this.isRenderable=e,this.data=t.data,this.layer=t.layer,this.linkService=t.linkService,this.downloadManager=t.downloadManager,this.imageResourcesPath=t.imageResourcesPath,this.renderForms=t.renderForms,this.svgFactory=t.svgFactory,this.annotationStorage=t.annotationStorage,this.enableComment=t.enableComment,this.enableScripting=t.enableScripting,this.hasJSActions=t.hasJSActions,this._fieldObjects=t.fieldObjects,this.parent=t.parent,this.hasOwnCommentButton=!1,e&&(this.contentElement=this.container=this._createContainer(n)),i&&this._createQuadrilaterals()}static _hasPopupData({contentsObj:t,richText:e}){return!!(t?.str||e?.str)}get _isEditable(){return this.data.isEditable}get hasPopupData(){return TA._hasPopupData(this.data)||this.enableComment&&!!this.commentText}get commentData(){let{data:t}=this,e=this.annotationStorage?.getEditor(t.id);return e?e.getData():t}get hasCommentButton(){return this.enableComment&&this.hasPopupElement}get commentButtonPosition(){let t=this.annotationStorage?.getEditor(this.data.id);if(t)return t.commentButtonPositionInPage;let{quadPoints:e,inkLists:n,rect:i}=this.data,s=-1/0,a=-1/0;if(e?.length>=8){for(let l=0;l<e.length;l+=8)e[l+1]>a?(a=e[l+1],s=e[l+2]):e[l+1]===a&&(s=Math.max(s,e[l+2]));return[s,a]}if(n?.length>=1){for(let l of n)for(let c=0,u=l.length;c<u;c+=2)l[c+1]>a?(a=l[c+1],s=l[c]):l[c+1]===a&&(s=Math.max(s,l[c]));if(s!==1/0)return[s,a]}return i?[i[2],i[3]]:null}_normalizePoint(t){let{page:{view:e},viewport:{rawDims:{pageWidth:n,pageHeight:i,pageX:s,pageY:a}}}=this.parent;return t[1]=e[3]-t[1]+e[1],t[0]=100*(t[0]-s)/n,t[1]=100*(t[1]-a)/i,t}get commentText(){let{data:t}=this;return this.annotationStorage.getRawValue(`${Jf}${t.id}`)?.popup?.contents||t.contentsObj?.str||""}set commentText(t){let{data:e}=this,n={deleted:!t,contents:t||""};this.annotationStorage.updateEditor(e.id,{popup:n})||this.annotationStorage.setValue(`${Jf}${e.id}`,{id:e.id,annotationType:e.annotationType,page:this.parent.page,popup:n,popupRef:e.popupRef,modificationDate:new Date}),t||this.removePopup()}removePopup(){(o(this,vr)?.popup||this.popup)?.remove(),g(this,vr,this.popup=null)}updateEdited(t){if(!this.container)return;t.rect&&(o(this,vc)||g(this,vc,{rect:this.data.rect.slice(0)}));let{rect:e,popup:n}=t;e&&v(this,Tm,y2).call(this,e);let i=o(this,vr)?.popup||this.popup;!i&&n?.text&&(this._createPopup(n),i=o(this,vr).popup),i&&(i.updateEdited(t),n?.deleted&&(i.remove(),g(this,vr,null),this.popup=null))}resetEdited(){o(this,vc)&&(v(this,Tm,y2).call(this,o(this,vc).rect),o(this,vr)?.popup.resetEdited(),g(this,vc,null))}_createContainer(t){let{data:e,parent:{page:n,viewport:i}}=this,s=document.createElement("section");s.setAttribute("data-annotation-id",e.id),!(this instanceof Ga)&&!(this instanceof cp)&&(s.tabIndex=0);let{style:a}=s;if(a.zIndex=this.parent.zIndex,this.parent.zIndex+=2,e.alternativeText&&(s.title=e.alternativeText),e.noRotate&&s.classList.add("norotate"),!e.rect||this instanceof up){let{rotation:y}=e;return!e.hasOwnCanvas&&y!==0&&this.setRotation(y,s),s}let{width:l,height:c}=this;if(!t&&e.borderStyle.width>0){a.borderWidth=`${e.borderStyle.width}px`;let y=e.borderStyle.horizontalCornerRadius,x=e.borderStyle.verticalCornerRadius;if(y>0||x>0){let w=`calc(${y}px * var(--total-scale-factor)) / calc(${x}px * var(--total-scale-factor))`;a.borderRadius=w}else if(this instanceof vy){let w=`calc(${l}px * var(--total-scale-factor)) / calc(${c}px * var(--total-scale-factor))`;a.borderRadius=w}switch(e.borderStyle.style){case Uu.SOLID:a.borderStyle="solid";break;case Uu.DASHED:a.borderStyle="dashed";break;case Uu.BEVELED:jt("Unimplemented border style: beveled");break;case Uu.INSET:jt("Unimplemented border style: inset");break;case Uu.UNDERLINE:a.borderBottomStyle="solid";break;default:break}let b=e.borderColor||null;b?(g(this,Qh,!0),a.borderColor=yt.makeHexColor(b[0]|0,b[1]|0,b[2]|0)):a.borderWidth=0}let u=yt.normalizeRect([e.rect[0],n.view[3]-e.rect[1]+n.view[1],e.rect[2],n.view[3]-e.rect[3]+n.view[1]]),{pageWidth:h,pageHeight:d,pageX:f,pageY:p}=i.rawDims;a.left=`${100*(u[0]-f)/h}%`,a.top=`${100*(u[1]-p)/d}%`;let{rotation:m}=e;return e.hasOwnCanvas||m===0?(a.width=`${100*l/h}%`,a.height=`${100*c/d}%`):this.setRotation(m,s),s}setRotation(t,e=this.container){if(!this.data.rect)return;let{pageWidth:n,pageHeight:i}=this.parent.viewport.rawDims,{width:s,height:a}=this;t%180!==0&&([s,a]=[a,s]),e.style.width=`${100*s/n}%`,e.style.height=`${100*a/i}%`,e.setAttribute("data-main-rotation",(360-t)%360)}get _commonActions(){let t=(e,n,i)=>{let s=i.detail[e],a=s[0],l=s.slice(1);i.target.style[n]=Ay[`${a}_HTML`](l),this.annotationStorage.setValue(this.data.id,{[n]:Ay[`${a}_rgb`](l)})};return Ut(this,"_commonActions",{display:e=>{let{display:n}=e.detail,i=n%2===1;this.container.style.visibility=i?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noView:i,noPrint:n===1||n===2})},print:e=>{this.annotationStorage.setValue(this.data.id,{noPrint:!e.detail.print})},hidden:e=>{let{hidden:n}=e.detail;this.container.style.visibility=n?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noPrint:n,noView:n})},focus:e=>{setTimeout(()=>e.target.focus({preventScroll:!1}),0)},userName:e=>{e.target.title=e.detail.userName},readonly:e=>{e.target.disabled=e.detail.readonly},required:e=>{this._setRequired(e.target,e.detail.required)},bgColor:e=>{t("bgColor","backgroundColor",e)},fillColor:e=>{t("fillColor","backgroundColor",e)},fgColor:e=>{t("fgColor","color",e)},textColor:e=>{t("textColor","color",e)},borderColor:e=>{t("borderColor","borderColor",e)},strokeColor:e=>{t("strokeColor","borderColor",e)},rotation:e=>{let n=e.detail.rotation;this.setRotation(n),this.annotationStorage.setValue(this.data.id,{rotation:n})}})}_dispatchEventFromSandbox(t,e){let n=this._commonActions;for(let i of Object.keys(e.detail))(t[i]||n[i])?.(e)}_setDefaultPropertiesFromJS(t){if(!this.enableScripting)return;let e=this.annotationStorage.getRawValue(this.data.id);if(!e)return;let n=this._commonActions;for(let[i,s]of Object.entries(e)){let a=n[i];if(a){let l={detail:{[i]:s},target:t};a(l),delete e[i]}}}_createQuadrilaterals(){if(!this.container)return;let{quadPoints:t}=this.data;if(!t)return;let[e,n,i,s]=this.data.rect.map(y=>Math.fround(y));if(t.length===8){let[y,x,b,w]=t.subarray(2,6);if(i===y&&s===x&&e===b&&n===w)return}let{style:a}=this.container,l;if(o(this,Qh)){let{borderColor:y,borderWidth:x}=a;a.borderWidth=0,l=["url('data:image/svg+xml;utf8,",'<svg xmlns="http://www.w3.org/2000/svg"',' preserveAspectRatio="none" viewBox="0 0 1 1">',`<g fill="transparent" stroke="${y}" stroke-width="${x}">`],this.container.classList.add("hasBorder")}let c=i-e,u=s-n,{svgFactory:h}=this,d=h.createElement("svg");d.classList.add("quadrilateralsContainer"),d.setAttribute("width",0),d.setAttribute("height",0),d.role="none";let f=h.createElement("defs");d.append(f);let p=h.createElement("clipPath"),m=`clippath_${this.data.id}`;p.setAttribute("id",m),p.setAttribute("clipPathUnits","objectBoundingBox"),f.append(p);for(let y=2,x=t.length;y<x;y+=8){let b=t[y],w=t[y+1],C=t[y+2],E=t[y+3],S=h.createElement("rect"),N=(C-e)/c,k=(s-w)/u,M=(b-C)/c,R=(w-E)/u;S.setAttribute("x",N),S.setAttribute("y",k),S.setAttribute("width",M),S.setAttribute("height",R),p.append(S),l?.push(`<rect vector-effect="non-scaling-stroke" x="${N}" y="${k}" width="${M}" height="${R}"/>`)}o(this,Qh)&&(l.push("</g></svg>')"),a.backgroundImage=l.join("")),this.container.append(d),this.container.style.clipPath=`url(#${m})`}_createPopup(t=null){let{data:e}=this,n,i;t?(n={str:t.text},i=t.date):(n=e.contentsObj,i=e.modificationDate),g(this,vr,new up({data:{color:e.color,titleObj:e.titleObj,modificationDate:i,contentsObj:n,richText:e.richText,parentRect:e.rect,borderStyle:0,id:`popup_${e.id}`,rotation:e.rotation,noRotate:!0},linkService:this.linkService,parent:this.parent,elements:[this]}))}get hasPopupElement(){return!!(o(this,vr)||this.popup||this.data.popupRef)}get extraPopupElement(){return o(this,vr)}render(){ue("Abstract method `AnnotationElement.render` called")}_getElementsByName(t,e=null){let n=[];if(this._fieldObjects){let i=this._fieldObjects[t];if(i)for(let{page:s,id:a,exportValues:l}of i){if(s===-1||a===e)continue;let c=typeof l=="string"?l:null,u=document.querySelector(`[data-element-id="${a}"]`);if(u&&!Qc.has(u)){jt(`_getElementsByName - element not allowed: ${a}`);continue}n.push({id:a,exportValue:c,domElement:u})}return n}for(let i of document.getElementsByName(t)){let{exportValue:s}=i,a=i.getAttribute("data-element-id");a!==e&&Qc.has(i)&&n.push({id:a,exportValue:s,domElement:i})}return n}show(){this.container&&(this.container.hidden=!1),this.popup?.maybeShow()}hide(){this.container&&(this.container.hidden=!0),this.popup?.forceHide()}getElementsToTriggerPopup(){return this.container}addHighlightArea(){let t=this.getElementsToTriggerPopup();if(Array.isArray(t))for(let e of t)e.classList.add("highlightArea");else t.classList.add("highlightArea")}_editOnDoubleClick(){if(!this._isEditable)return;let{annotationEditorType:t,data:{id:e}}=this;this.container.addEventListener("dblclick",()=>{this.linkService.eventBus?.dispatch("switchannotationeditormode",{source:this,mode:t,editId:e,mustEnterInEditMode:!0})})}get width(){return this.data.rect[2]-this.data.rect[0]}get height(){return this.data.rect[3]-this.data.rect[1]}};vc=new WeakMap,Qh=new WeakMap,vr=new WeakMap,Tm=new WeakSet,y2=function(t){let{container:{style:e},data:{rect:n,rotation:i},parent:{viewport:{rawDims:{pageWidth:s,pageHeight:a,pageX:l,pageY:c}}}}=this;n?.splice(0,4,...t),e.left=`${100*(t[0]-l)/s}%`,e.top=`${100*(a-t[3]+c)/a}%`,i===0?(e.width=`${100*(t[2]-t[0])/s}%`,e.height=`${100*(t[3]-t[1])/a}%`):this.setRotation(i)};$e=TA,b2=class extends $e{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),this.editor=t.editor}render(){return this.container.className="editorAnnotation",this.container}createOrUpdatePopup(){let{editor:t}=this;t.hasComment&&this._createPopup(t.comment)}get hasCommentButton(){return this.enableComment&&this.editor.hasComment}get commentButtonPosition(){return this.editor.commentButtonPositionInPage}get commentText(){return this.editor.comment.text}set commentText(t){this.editor.comment=t,t||this.removePopup()}get commentData(){return this.editor.getData()}remove(){this.parent.removeAnnotation(this.data.id),this.container.remove(),this.container=null,this.removePopup()}},cp=class extends $e{constructor(e,n=null){super(e,{isRenderable:!0,ignoreBorder:!!n?.ignoreBorder,createQuadrilaterals:!0});A(this,Qi);this.isTooltipOnly=e.data.isTooltipOnly}render(){let{data:e,linkService:n}=this,i=document.createElement("a");i.setAttribute("data-element-id",e.id);let s=!1;return e.url?(n.addLinkAttributes(i,e.url,e.newWindow),s=!0):e.action?(this._bindNamedAction(i,e.action,e.overlaidText),s=!0):e.attachment?(v(this,Qi,XS).call(this,i,e.attachment,e.overlaidText,e.attachmentDest),s=!0):e.setOCGState?(v(this,Qi,YS).call(this,i,e.setOCGState,e.overlaidText),s=!0):e.dest?(this._bindLink(i,e.dest,e.overlaidText),s=!0):(e.actions&&(e.actions.Action||e.actions["Mouse Up"]||e.actions["Mouse Down"])&&this.enableScripting&&this.hasJSActions&&(this._bindJSAction(i,e),s=!0),e.resetForm?(this._bindResetFormAction(i,e.resetForm),s=!0):this.isTooltipOnly&&!s&&(this._bindLink(i,""),s=!0)),this.container.classList.add("linkAnnotation"),s&&(this.contentElement=i,this.container.append(i)),this.container}_bindLink(e,n,i=""){e.href=this.linkService.getDestinationHash(n),e.onclick=()=>(n&&this.linkService.goToDestination(n),!1),(n||n==="")&&v(this,Qi,vl).call(this),i&&(e.title=i)}_bindNamedAction(e,n,i=""){e.href=this.linkService.getAnchorUrl(""),e.onclick=()=>(this.linkService.executeNamedAction(n),!1),i&&(e.title=i),v(this,Qi,vl).call(this)}_bindJSAction(e,n){e.href=this.linkService.getAnchorUrl("");let i=new Map([["Action","onclick"],["Mouse Up","onmouseup"],["Mouse Down","onmousedown"]]);for(let s of Object.keys(n.actions)){let a=i.get(s);a&&(e[a]=()=>(this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:n.id,name:s}}),!1))}n.overlaidText&&(e.title=n.overlaidText),e.onclick||(e.onclick=()=>!1),v(this,Qi,vl).call(this)}_bindResetFormAction(e,n){let i=e.onclick;if(i||(e.href=this.linkService.getAnchorUrl("")),v(this,Qi,vl).call(this),!this._fieldObjects){jt('_bindResetFormAction - "resetForm" action not supported, ensure that the `fieldObjects` parameter is provided.'),i||(e.onclick=()=>!1);return}e.onclick=()=>{i?.();let{fields:s,refs:a,include:l}=n,c=[];if(s.length!==0||a.length!==0){let d=new Set(a);for(let f of s){let p=this._fieldObjects[f]||[];for(let{id:m}of p)d.add(m)}for(let f of Object.values(this._fieldObjects))for(let p of f)d.has(p.id)===l&&c.push(p)}else for(let d of Object.values(this._fieldObjects))c.push(...d);let u=this.annotationStorage,h=[];for(let d of c){let{id:f}=d;switch(h.push(f),d.type){case"text":{let m=d.defaultValue||"";u.setValue(f,{value:m});break}case"checkbox":case"radiobutton":{let m=d.defaultValue===d.exportValues;u.setValue(f,{value:m});break}case"combobox":case"listbox":{let m=d.defaultValue||"";u.setValue(f,{value:m});break}default:continue}let p=document.querySelector(`[data-element-id="${f}"]`);if(p){if(!Qc.has(p)){jt(`_bindResetFormAction - element not allowed: ${f}`);continue}}else continue;p.dispatchEvent(new Event("resetform"))}return this.enableScripting&&this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:"app",ids:h,name:"ResetForm"}}),!1}}};Qi=new WeakSet,vl=function(){this.container.setAttribute("data-internal-link","")},XS=function(e,n,i="",s=null){e.href=this.linkService.getAnchorUrl(""),n.description?e.title=n.description:i&&(e.title=i),e.onclick=()=>(this.downloadManager?.openOrDownloadData(n.content,n.filename,s),!1),v(this,Qi,vl).call(this)},YS=function(e,n,i=""){e.href=this.linkService.getAnchorUrl(""),e.onclick=()=>(this.linkService.executeSetOCGState(n),!1),i&&(e.title=i),v(this,Qi,vl).call(this)};x2=class extends $e{constructor(t){super(t,{isRenderable:!0})}render(){this.container.classList.add("textAnnotation");let t=document.createElement("img");return t.src=this.imageResourcesPath+"annotation-"+this.data.name.toLowerCase()+".svg",t.setAttribute("data-l10n-id","pdfjs-text-annotation-type"),t.setAttribute("data-l10n-args",JSON.stringify({type:this.data.name})),!this.data.popupRef&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container.append(t),this.container}},Ga=class extends $e{render(){return this.container}showElementAndHideCanvas(t){this.data.hasOwnCanvas&&(t.previousSibling?.nodeName==="CANVAS"&&(t.previousSibling.hidden=!0),t.hidden=!1)}_getKeyModifier(t){return Xe.platform.isMac?t.metaKey:t.ctrlKey}_setEventListener(t,e,n,i,s){n.includes("mouse")?t.addEventListener(n,a=>{this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:i,value:s(a),shift:a.shiftKey,modifier:this._getKeyModifier(a)}})}):t.addEventListener(n,a=>{if(n==="blur"){if(!e.focused||!a.relatedTarget)return;e.focused=!1}else if(n==="focus"){if(e.focused)return;e.focused=!0}s&&this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:i,value:s(a)}})})}_setEventListeners(t,e,n,i){for(let[s,a]of n)(a==="Action"||this.data.actions?.[a])&&((a==="Focus"||a==="Blur")&&(e||(e={focused:!1})),this._setEventListener(t,e,s,a,i),a==="Focus"&&!this.data.actions?.Blur?this._setEventListener(t,e,"blur","Blur",null):a==="Blur"&&!this.data.actions?.Focus&&this._setEventListener(t,e,"focus","Focus",null))}_setBackgroundColor(t){let e=this.data.backgroundColor||null;t.style.backgroundColor=e===null?"transparent":yt.makeHexColor(e[0],e[1],e[2])}_setTextStyle(t){let e=["left","center","right"],{fontColor:n}=this.data.defaultAppearanceData,i=this.data.defaultAppearanceData.fontSize||JO,s=t.style,a,l=2,c=u=>Math.round(10*u)/10;if(this.data.multiLine){let u=Math.abs(this.data.rect[3]-this.data.rect[1]-l),h=Math.round(u/(x0*i))||1,d=u/h;a=Math.min(i,c(d/x0))}else{let u=Math.abs(this.data.rect[3]-this.data.rect[1]-l);a=Math.min(i,c(u/x0))}s.fontSize=`calc(${a}px * var(--total-scale-factor))`,s.color=yt.makeHexColor(n[0],n[1],n[2]),this.data.textAlignment!==null&&(s.textAlign=e[this.data.textAlignment])}_setRequired(t,e){e?t.setAttribute("required",!0):t.removeAttribute("required"),t.setAttribute("aria-required",e)}},w2=class extends Ga{constructor(t){let e=t.renderForms||t.data.hasOwnCanvas||!t.data.hasAppearance&&!!t.data.fieldValue;super(t,{isRenderable:e})}setPropertyOnSiblings(t,e,n,i){let s=this.annotationStorage;for(let a of this._getElementsByName(t.name,t.id))a.domElement&&(a.domElement[e]=n),s.setValue(a.id,{[i]:n})}render(){let t=this.annotationStorage,e=this.data.id;this.container.classList.add("textWidgetAnnotation");let n=null;if(this.renderForms){let i=t.getValue(e,{value:this.data.fieldValue}),s=i.value||"",a=t.getValue(e,{charLimit:this.data.maxLen}).charLimit;a&&s.length>a&&(s=s.slice(0,a));let l=i.formattedValue||this.data.textContent?.join(`
|
|
59
|
-
`)||null;l&&this.data.comb&&(l=l.replaceAll(/\s+/g,""));let c={userValue:s,formattedValue:l,lastCommittedValue:null,commitKey:1,focused:!1};this.data.multiLine?(n=document.createElement("textarea"),n.textContent=l??s,this.data.doNotScroll&&(n.style.overflowY="hidden")):(n=document.createElement("input"),n.type=this.data.password?"password":"text",n.setAttribute("value",l??s),this.data.doNotScroll&&(n.style.overflowX="hidden")),this.data.hasOwnCanvas&&(n.hidden=!0),Qc.add(n),this.contentElement=n,n.setAttribute("data-element-id",e),n.disabled=this.data.readOnly,n.name=this.data.fieldName,n.tabIndex=0;let{datetimeFormat:u,datetimeType:h,timeStep:d}=this.data,f=!!h&&this.enableScripting;u&&(n.title=u),this._setRequired(n,this.data.required),a&&(n.maxLength=a),n.addEventListener("input",m=>{t.setValue(e,{value:m.target.value}),this.setPropertyOnSiblings(n,"value",m.target.value,"value"),c.formattedValue=null}),n.addEventListener("resetform",m=>{let y=this.data.defaultFieldValue??"";n.value=c.userValue=y,c.formattedValue=null});let p=m=>{let{formattedValue:y}=c;y!=null&&(m.target.value=y),m.target.scrollLeft=0};if(this.enableScripting&&this.hasJSActions){n.addEventListener("focus",y=>{if(c.focused)return;let{target:x}=y;if(f&&(x.type=h,d&&(x.step=d)),c.userValue){let b=c.userValue;if(f)if(h==="time"){let w=new Date(b),C=[w.getHours(),w.getMinutes(),w.getSeconds()];x.value=C.map(E=>E.toString().padStart(2,"0")).join(":")}else x.value=new Date(b-tF).toISOString().split(h==="date"?"T":".",1)[0];else x.value=b}c.lastCommittedValue=x.value,c.commitKey=1,this.data.actions?.Focus||(c.focused=!0)}),n.addEventListener("updatefromsandbox",y=>{this.showElementAndHideCanvas(y.target);let x={value(b){c.userValue=b.detail.value??"",f||t.setValue(e,{value:c.userValue.toString()}),b.target.value=c.userValue},formattedValue(b){let{formattedValue:w}=b.detail;c.formattedValue=w,w!=null&&b.target!==document.activeElement&&(b.target.value=w);let C={formattedValue:w};f&&(C.value=w),t.setValue(e,C)},selRange(b){b.target.setSelectionRange(...b.detail.selRange)},charLimit:b=>{let{charLimit:w}=b.detail,{target:C}=b;if(w===0){C.removeAttribute("maxLength");return}C.setAttribute("maxLength",w);let E=c.userValue;!E||E.length<=w||(E=E.slice(0,w),C.value=c.userValue=E,t.setValue(e,{value:E}),this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:E,willCommit:!0,commitKey:1,selStart:C.selectionStart,selEnd:C.selectionEnd}}))}};this._dispatchEventFromSandbox(x,y)}),n.addEventListener("keydown",y=>{c.commitKey=1;let x=-1;if(y.key==="Escape"?x=0:y.key==="Enter"&&!this.data.multiLine?x=2:y.key==="Tab"&&(c.commitKey=3),x===-1)return;let{value:b}=y.target;c.lastCommittedValue!==b&&(c.lastCommittedValue=b,c.userValue=b,this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:b,willCommit:!0,commitKey:x,selStart:y.target.selectionStart,selEnd:y.target.selectionEnd}}))});let m=p;p=null,n.addEventListener("blur",y=>{if(!c.focused||!y.relatedTarget)return;this.data.actions?.Blur||(c.focused=!1);let{target:x}=y,{value:b}=x;if(f){if(b&&h==="time"){let w=b.split(":").map(C=>parseInt(C,10));b=new Date(2e3,0,1,w[0],w[1],w[2]||0).valueOf(),x.step=""}else b.includes("T")||(b=`${b}T00:00`),b=new Date(b).valueOf();x.type="text"}c.userValue=b,c.lastCommittedValue!==b&&this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:b,willCommit:!0,commitKey:c.commitKey,selStart:y.target.selectionStart,selEnd:y.target.selectionEnd}}),m(y)}),this.data.actions?.Keystroke&&n.addEventListener("beforeinput",y=>{c.lastCommittedValue=null;let{data:x,target:b}=y,{value:w,selectionStart:C,selectionEnd:E}=b,S=C,N=E;switch(y.inputType){case"deleteWordBackward":{let k=w.substring(0,C).match(/\w*[^\w]*$/);k&&(S-=k[0].length);break}case"deleteWordForward":{let k=w.substring(C).match(/^[^\w]*\w*/);k&&(N+=k[0].length);break}case"deleteContentBackward":C===E&&(S-=1);break;case"deleteContentForward":C===E&&(N+=1);break}y.preventDefault(),this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:w,change:x||"",willCommit:!1,selStart:S,selEnd:N}})}),this._setEventListeners(n,c,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],y=>y.target.value)}if(p&&n.addEventListener("blur",p),this.data.comb){let y=(this.data.rect[2]-this.data.rect[0])/a;n.classList.add("comb"),n.style.letterSpacing=`calc(${y}px * var(--total-scale-factor) - 1ch)`}}else n=document.createElement("div"),n.textContent=this.data.fieldValue,n.style.verticalAlign="middle",n.style.display="table-cell",this.data.hasOwnCanvas&&(n.hidden=!0);return this._setTextStyle(n),this._setBackgroundColor(n),this._setDefaultPropertiesFromJS(n),this.container.append(n),this.container}},A2=class extends Ga{constructor(t){super(t,{isRenderable:!!t.data.hasOwnCanvas})}},v2=class extends Ga{constructor(t){super(t,{isRenderable:t.renderForms})}render(){let t=this.annotationStorage,e=this.data,n=e.id,i=t.getValue(n,{value:e.exportValue===e.fieldValue}).value;typeof i=="string"&&(i=i!=="Off",t.setValue(n,{value:i})),this.container.classList.add("buttonWidgetAnnotation","checkBox");let s=document.createElement("input");return Qc.add(s),s.setAttribute("data-element-id",n),s.disabled=e.readOnly,this._setRequired(s,this.data.required),s.type="checkbox",s.name=e.fieldName,i&&s.setAttribute("checked",!0),s.setAttribute("exportValue",e.exportValue),s.tabIndex=0,s.addEventListener("change",a=>{let{name:l,checked:c}=a.target;for(let u of this._getElementsByName(l,n)){let h=c&&u.exportValue===e.exportValue;u.domElement&&(u.domElement.checked=h),t.setValue(u.id,{value:h})}t.setValue(n,{value:c})}),s.addEventListener("resetform",a=>{let l=e.defaultFieldValue||"Off";a.target.checked=l===e.exportValue}),this.enableScripting&&this.hasJSActions&&(s.addEventListener("updatefromsandbox",a=>{let l={value(c){c.target.checked=c.detail.value!=="Off",t.setValue(n,{value:c.target.checked})}};this._dispatchEventFromSandbox(l,a)}),this._setEventListeners(s,null,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],a=>a.target.checked)),this._setBackgroundColor(s),this._setDefaultPropertiesFromJS(s),this.container.append(s),this.container}},vy=class extends Ga{constructor(t){super(t,{isRenderable:t.renderForms})}render(){this.container.classList.add("buttonWidgetAnnotation","radioButton");let t=this.annotationStorage,e=this.data,n=e.id,i=t.getValue(n,{value:e.fieldValue===e.buttonValue}).value;if(typeof i=="string"&&(i=i!==e.buttonValue,t.setValue(n,{value:i})),i)for(let a of this._getElementsByName(e.fieldName,n))t.setValue(a.id,{value:!1});let s=document.createElement("input");if(Qc.add(s),s.setAttribute("data-element-id",n),s.disabled=e.readOnly,this._setRequired(s,this.data.required),s.type="radio",s.name=e.fieldName,i&&s.setAttribute("checked",!0),s.tabIndex=0,s.addEventListener("change",a=>{let{name:l,checked:c}=a.target;for(let u of this._getElementsByName(l,n))t.setValue(u.id,{value:!1});t.setValue(n,{value:c})}),s.addEventListener("resetform",a=>{let l=e.defaultFieldValue;a.target.checked=l!=null&&l===e.buttonValue}),this.enableScripting&&this.hasJSActions){let a=e.buttonValue;s.addEventListener("updatefromsandbox",l=>{let c={value:u=>{let h=a===u.detail.value;for(let d of this._getElementsByName(u.target.name)){let f=h&&d.id===n;d.domElement&&(d.domElement.checked=f),t.setValue(d.id,{value:f})}}};this._dispatchEventFromSandbox(c,l)}),this._setEventListeners(s,null,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],l=>l.target.checked)}return this._setBackgroundColor(s),this._setDefaultPropertiesFromJS(s),this.container.append(s),this.container}},C2=class extends cp{constructor(t){super(t,{ignoreBorder:t.data.hasAppearance})}render(){let t=super.render();t.classList.add("buttonWidgetAnnotation","pushButton");let e=t.lastChild;return this.enableScripting&&this.hasJSActions&&e&&(this._setDefaultPropertiesFromJS(e),e.addEventListener("updatefromsandbox",n=>{this._dispatchEventFromSandbox({},n)})),t}},E2=class extends Ga{constructor(t){super(t,{isRenderable:t.renderForms})}render(){this.container.classList.add("choiceWidgetAnnotation");let t=this.annotationStorage,e=this.data.id,n=t.getValue(e,{value:this.data.fieldValue}),i=document.createElement("select");Qc.add(i),i.setAttribute("data-element-id",e),i.disabled=this.data.readOnly,this._setRequired(i,this.data.required),i.name=this.data.fieldName,i.tabIndex=0;let s=this.data.combo&&this.data.options.length>0;this.data.combo||(i.size=this.data.options.length,this.data.multiSelect&&(i.multiple=!0)),i.addEventListener("resetform",d=>{let f=this.data.defaultFieldValue;for(let p of i.options)p.selected=p.value===f});let a=(d,f)=>{let p=f.replaceAll(" ","\xA0");d.textContent=p,p!==f&&d.setAttribute("display-value",f)};for(let d of this.data.options){let f=document.createElement("option");a(f,d.displayValue),f.value=d.exportValue,n.value.includes(d.exportValue)&&(f.setAttribute("selected",!0),s=!1),i.append(f)}let l=null;if(s){let d=document.createElement("option");d.value=" ",d.setAttribute("hidden",!0),d.setAttribute("selected",!0),i.prepend(d),l=()=>{d.remove(),i.removeEventListener("input",l),l=null},i.addEventListener("input",l)}let c=d=>{let f=d?"value":"textContent",{options:p,multiple:m}=i;return m?Array.prototype.filter.call(p,y=>y.selected).map(y=>y[f]):p.selectedIndex===-1?null:p[p.selectedIndex][f]},u=c(!1),h=d=>{let f=d.target.options;return Array.prototype.map.call(f,p=>({displayValue:p.getAttribute("display-value")||p.textContent,exportValue:p.value}))};return this.enableScripting&&this.hasJSActions?(i.addEventListener("updatefromsandbox",d=>{let f={value(p){l?.();let m=p.detail.value,y=new Set(Array.isArray(m)?m:[m]);for(let x of i.options)x.selected=y.has(x.value);t.setValue(e,{value:c(!0)}),u=c(!1)},multipleSelection(p){i.multiple=!0},remove(p){let m=i.options,y=p.detail.remove;m[y].selected=!1,i.remove(y),m.length>0&&Array.prototype.findIndex.call(m,b=>b.selected)===-1&&(m[0].selected=!0),t.setValue(e,{value:c(!0),items:h(p)}),u=c(!1)},clear(p){for(;i.length!==0;)i.remove(0);t.setValue(e,{value:null,items:[]}),u=c(!1)},insert(p){let{index:m,displayValue:y,exportValue:x}=p.detail.insert,b=i.children[m],w=document.createElement("option");a(w,y),w.value=x,b?b.before(w):i.append(w),t.setValue(e,{value:c(!0),items:h(p)}),u=c(!1)},items(p){let{items:m}=p.detail;for(;i.length!==0;)i.remove(0);for(let y of m){let{displayValue:x,exportValue:b}=y,w=document.createElement("option");a(w,x),w.value=b,i.append(w)}i.options.length>0&&(i.options[0].selected=!0),t.setValue(e,{value:c(!0),items:h(p)}),u=c(!1)},indices(p){let m=new Set(p.detail.indices);for(let y of p.target.options)y.selected=m.has(y.index);t.setValue(e,{value:c(!0)}),u=c(!1)},editable(p){p.target.disabled=!p.detail.editable}};this._dispatchEventFromSandbox(f,d)}),i.addEventListener("input",d=>{let f=c(!0),p=c(!1);t.setValue(e,{value:f}),d.preventDefault(),this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:u,change:p,changeEx:f,willCommit:!1,commitKey:1,keyDown:!1}})}),this._setEventListeners(i,null,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"],["input","Action"],["input","Validate"]],d=>d.target.value)):i.addEventListener("input",function(d){t.setValue(e,{value:c(!0)})}),this.data.combo&&this._setTextStyle(i),this._setBackgroundColor(i),this._setDefaultPropertiesFromJS(i),this.container.append(i),this.container}},up=class extends $e{constructor(e){let{data:n,elements:i,parent:s}=e,a=!!s._commentManager;super(e,{isRenderable:!a&&$e._hasPopupData(n)});A(this,Sm);if(this.elements=i,a&&$e._hasPopupData(n)){let l=this.popup=v(this,Sm,T2).call(this);for(let c of i)c.popup=l}else this.popup=null}render(){let{container:e}=this;e.classList.add("popupAnnotation"),e.role="comment";let n=this.popup=v(this,Sm,T2).call(this),i=[];for(let s of this.elements)s.popup=n,s.container.ariaHasPopup="dialog",i.push(s.data.id),s.addHighlightArea();return this.container.setAttribute("aria-controls",i.map(s=>`${Xu}${s}`).join(",")),this.container}};Sm=new WeakSet,T2=function(){return new S2({container:this.container,color:this.data.color,titleObj:this.data.titleObj,modificationDate:this.data.modificationDate||this.data.creationDate,contentsObj:this.data.contentsObj,richText:this.data.richText,rect:this.data.rect,parentRect:this.data.parentRect||null,parent:this.parent,elements:this.elements,open:this.data.open,commentManager:this.parent._commentManager})};S2=class{constructor({container:t,color:e,elements:n,titleObj:i,modificationDate:s,contentsObj:a,richText:l,parent:c,rect:u,parentRect:h,open:d,commentManager:f=null}){A(this,Wt);A(this,Li,null);A(this,Bo,v(this,Wt,QS).bind(this));A(this,Qy,v(this,Wt,_2).bind(this));A(this,Jy,v(this,Wt,j0).bind(this));A(this,Jh,v(this,Wt,z0).bind(this));A(this,td,null);A(this,qe,null);A(this,Ds,null);A(this,Uo,null);A(this,Cc,null);A(this,ed,null);A(this,nd,null);A(this,Ns,!1);A(this,Bi,null);A(this,Da,null);A(this,Na,null);A(this,Ve,null);A(this,Ia,null);A(this,$o,null);A(this,Dm,null);A(this,ka,null);A(this,id,null);A(this,Ec,null);A(this,zo,!1);A(this,En,null);A(this,jo,null);g(this,qe,t),g(this,id,i),g(this,Ds,a),g(this,ka,l),g(this,ed,c),g(this,td,e),g(this,Dm,u),g(this,nd,h),g(this,Cc,n),g(this,Li,f),g(this,En,n[0]),g(this,Uo,Xc.toDateObject(s)),this.trigger=n.flatMap(p=>p.getElementsToTriggerPopup()),f||(v(this,Wt,U0).call(this),o(this,qe).hidden=!0,d&&v(this,Wt,z0).call(this))}renderCommentButton(){if(o(this,Ve)){o(this,Ve).parentNode||o(this,En).container.after(o(this,Ve));return}if(o(this,Ia)||v(this,Wt,D2).call(this),!o(this,Ia))return;let{signal:t}=g(this,Da,new AbortController),e=o(this,En).hasOwnCommentButton,n=()=>{o(this,Li).toggleCommentPopup(this,!0,void 0,!e)},i=()=>{o(this,Li).toggleCommentPopup(this,!1,!0,!e)},s=()=>{o(this,Li).toggleCommentPopup(this,!1,!1)};if(e){g(this,Ve,o(this,En).container);for(let a of this.trigger)a.ariaHasPopup="dialog",a.ariaControls="commentPopup",a.addEventListener("keydown",o(this,Bo),{signal:t}),a.addEventListener("click",n,{signal:t}),a.addEventListener("pointerenter",i,{signal:t}),a.addEventListener("pointerleave",s,{signal:t}),a.classList.add("popupTriggerArea")}else{let a=g(this,Ve,document.createElement("button"));a.className="annotationCommentButton";let l=o(this,En).container;a.style.zIndex=l.style.zIndex+1,a.tabIndex=0,a.ariaHasPopup="dialog",a.ariaControls="commentPopup",a.setAttribute("data-l10n-id","pdfjs-show-comment-button"),v(this,Wt,I2).call(this),v(this,Wt,N2).call(this),a.addEventListener("keydown",o(this,Bo),{signal:t}),a.addEventListener("click",n,{signal:t}),a.addEventListener("pointerenter",i,{signal:t}),a.addEventListener("pointerleave",s,{signal:t}),l.after(a)}}get commentButtonColor(){let{color:t,opacity:e}=o(this,En).commentData;return t?o(this,ed)._commentManager.makeCommentColor(t,e):null}focusCommentButton(){setTimeout(()=>{o(this,Ve)?.focus()},0)}getData(){let{richText:t,color:e,opacity:n,creationDate:i,modificationDate:s}=o(this,En).commentData;return{contentsObj:{str:this.comment},richText:t,color:e,opacity:n,creationDate:i,modificationDate:s}}get elementBeforePopup(){return o(this,Ve)}get comment(){return o(this,jo)||g(this,jo,o(this,En).commentText),o(this,jo)}set comment(t){t!==this.comment&&(o(this,En).commentText=g(this,jo,t))}focus(){o(this,En).container?.focus()}get parentBoundingClientRect(){return o(this,En).layer.getBoundingClientRect()}setCommentButtonStates({selected:t,hasPopup:e}){o(this,Ve)&&(o(this,Ve).classList.toggle("selected",t),o(this,Ve).ariaExpanded=e)}setSelectedCommentButton(t){o(this,Ve).classList.toggle("selected",t)}get commentPopupPosition(){if(o(this,$o))return o(this,$o);let{x:t,y:e,height:n}=o(this,Ve).getBoundingClientRect(),{x:i,y:s,width:a,height:l}=o(this,En).layer.getBoundingClientRect();return[(t-i)/a,(e+n-s)/l]}set commentPopupPosition(t){g(this,$o,t)}hasDefaultPopupPosition(){return o(this,$o)===null}get commentButtonPosition(){return o(this,Ia)}get commentButtonWidth(){return o(this,Ve).getBoundingClientRect().width/this.parentBoundingClientRect.width}editComment(t){let[e,n]=o(this,$o)||this.commentButtonPosition.map(u=>u/100),i=this.parentBoundingClientRect,{x:s,y:a,width:l,height:c}=i;o(this,Li).showDialog(null,this,s+e*l,a+n*c,{...t,parentDimensions:i})}render(){if(o(this,Bi))return;let t=g(this,Bi,document.createElement("div"));if(t.className="popup",o(this,td)){let n=t.style.outlineColor=yt.makeHexColor(...o(this,td));t.style.backgroundColor=`color-mix(in srgb, ${n} 30%, white)`}let e=document.createElement("span");if(e.className="header",o(this,id)?.str){let n=document.createElement("span");n.className="title",e.append(n),{dir:n.dir,str:n.textContent}=o(this,id)}if(t.append(e),o(this,Uo)){let n=document.createElement("time");n.className="popupDate",n.setAttribute("data-l10n-id","pdfjs-annotation-date-time-string"),n.setAttribute("data-l10n-args",JSON.stringify({dateObj:o(this,Uo).valueOf()})),n.dateTime=o(this,Uo).toISOString(),e.append(n)}bA({html:o(this,Wt,$0)||o(this,Ds).str,dir:o(this,Ds)?.dir,className:"popupContent"},t),o(this,qe).append(t)}updateEdited({rect:t,popup:e,deleted:n}){if(o(this,Li)){n?(this.remove(),g(this,jo,null)):e&&(e.deleted?this.remove():(v(this,Wt,I2).call(this),g(this,jo,e.text))),t&&(g(this,Ia,null),v(this,Wt,D2).call(this),v(this,Wt,N2).call(this));return}if(n||e?.deleted){this.remove();return}v(this,Wt,U0).call(this),o(this,Ec)||g(this,Ec,{contentsObj:o(this,Ds),richText:o(this,ka)}),t&&g(this,Na,null),e&&e.text&&(g(this,ka,v(this,Wt,ZS).call(this,e.text)),g(this,Uo,Xc.toDateObject(e.date)),g(this,Ds,null)),o(this,Bi)?.remove(),g(this,Bi,null)}resetEdited(){o(this,Ec)&&({contentsObj:an(this,Ds)._,richText:an(this,ka)._}=o(this,Ec),g(this,Ec,null),o(this,Bi)?.remove(),g(this,Bi,null),g(this,Na,null))}remove(){if(o(this,Da)?.abort(),g(this,Da,null),o(this,Bi)?.remove(),g(this,Bi,null),g(this,zo,!1),g(this,Ns,!1),o(this,Ve)?.remove(),g(this,Ve,null),this.trigger)for(let t of this.trigger)t.classList.remove("popupTriggerArea")}forceHide(){g(this,zo,this.isVisible),o(this,zo)&&(o(this,qe).hidden=!0)}maybeShow(){o(this,Li)||(v(this,Wt,U0).call(this),o(this,zo)&&(o(this,Bi)||v(this,Wt,j0).call(this),g(this,zo,!1),o(this,qe).hidden=!1))}get isVisible(){return o(this,Li)?!1:o(this,qe).hidden===!1}};Li=new WeakMap,Bo=new WeakMap,Qy=new WeakMap,Jy=new WeakMap,Jh=new WeakMap,td=new WeakMap,qe=new WeakMap,Ds=new WeakMap,Uo=new WeakMap,Cc=new WeakMap,ed=new WeakMap,nd=new WeakMap,Ns=new WeakMap,Bi=new WeakMap,Da=new WeakMap,Na=new WeakMap,Ve=new WeakMap,Ia=new WeakMap,$o=new WeakMap,Dm=new WeakMap,ka=new WeakMap,id=new WeakMap,Ec=new WeakMap,zo=new WeakMap,En=new WeakMap,jo=new WeakMap,Wt=new WeakSet,U0=function(){if(o(this,Da))return;g(this,Da,new AbortController);let{signal:t}=o(this,Da);for(let e of this.trigger)e.addEventListener("click",o(this,Jh),{signal:t}),e.addEventListener("pointerenter",o(this,Jy),{signal:t}),e.addEventListener("pointerleave",o(this,Qy),{signal:t}),e.classList.add("popupTriggerArea");for(let e of o(this,Cc))e.container?.addEventListener("keydown",o(this,Bo),{signal:t})},D2=function(){let t=o(this,Cc).find(e=>e.hasCommentButton);t&&g(this,Ia,t._normalizePoint(t.commentButtonPosition))},N2=function(){if(o(this,En).extraPopupElement&&!o(this,En).editor)return;o(this,Ve)||this.renderCommentButton();let[t,e]=o(this,Ia),{style:n}=o(this,Ve);n.left=`calc(${t}%)`,n.top=`calc(${e}% - var(--comment-button-dim))`},I2=function(){o(this,En).extraPopupElement||(o(this,Ve)||this.renderCommentButton(),o(this,Ve).style.backgroundColor=this.commentButtonColor||"")},$0=function(){let t=o(this,ka),e=o(this,Ds);return t?.str&&(!e?.str||e.str===t.str)&&o(this,ka).html||null},k2=function(){return o(this,Wt,$0)?.attributes?.style?.fontSize||0},KS=function(){return o(this,Wt,$0)?.attributes?.style?.color||null},ZS=function(t){let e=[],n={str:t,html:{name:"div",attributes:{dir:"auto"},children:[{name:"p",children:e}]}},i={style:{color:o(this,Wt,KS),fontSize:o(this,Wt,k2)?`calc(${o(this,Wt,k2)}px * var(--total-scale-factor))`:""}};for(let s of t.split(`
|
|
60
|
-
`))e.push({name:"span",value:s,attributes:i});return n},QS=function(t){t.altKey||t.shiftKey||t.ctrlKey||t.metaKey||(t.key==="Enter"||t.key==="Escape"&&o(this,Ns))&&v(this,Wt,z0).call(this)},JS=function(){if(o(this,Na)!==null)return;let{page:{view:t},viewport:{rawDims:{pageWidth:e,pageHeight:n,pageX:i,pageY:s}}}=o(this,ed),a=!!o(this,nd),l=a?o(this,nd):o(this,Dm);for(let m of o(this,Cc))if(!l||yt.intersect(m.data.rect,l)!==null){l=m.data.rect,a=!0;break}let c=yt.normalizeRect([l[0],t[3]-l[1]+t[1],l[2],t[3]-l[3]+t[1]]),h=a?l[2]-l[0]+5:0,d=c[0]+h,f=c[1];g(this,Na,[100*(d-i)/e,100*(f-s)/n]);let{style:p}=o(this,qe);p.left=`${o(this,Na)[0]}%`,p.top=`${o(this,Na)[1]}%`},z0=function(){if(o(this,Li)){o(this,Li).toggleCommentPopup(this,!1);return}g(this,Ns,!o(this,Ns)),o(this,Ns)?(v(this,Wt,j0).call(this),o(this,qe).addEventListener("click",o(this,Jh)),o(this,qe).addEventListener("keydown",o(this,Bo))):(v(this,Wt,_2).call(this),o(this,qe).removeEventListener("click",o(this,Jh)),o(this,qe).removeEventListener("keydown",o(this,Bo)))},j0=function(){o(this,Bi)||this.render(),this.isVisible?o(this,Ns)&&o(this,qe).classList.add("focused"):(v(this,Wt,JS).call(this),o(this,qe).hidden=!1,o(this,qe).style.zIndex=parseInt(o(this,qe).style.zIndex)+1e3)},_2=function(){o(this,qe).classList.remove("focused"),!(o(this,Ns)||!this.isVisible)&&(o(this,qe).hidden=!0,o(this,qe).style.zIndex=parseInt(o(this,qe).style.zIndex)-1e3)};Cy=class extends $e{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),this.textContent=t.data.textContent,this.textPosition=t.data.textPosition,this.annotationEditorType=Bt.FREETEXT}render(){if(this.container.classList.add("freeTextAnnotation"),this.textContent){let t=this.contentElement=document.createElement("div");t.classList.add("annotationTextContent"),t.setAttribute("role","comment");for(let e of this.textContent){let n=document.createElement("span");n.textContent=e,t.append(n)}this.container.append(t)}return!this.data.popupRef&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this._editOnDoubleClick(),this.container}},M2=class extends $e{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0});A(this,Nm,null)}render(){this.container.classList.add("lineAnnotation");let{data:e,width:n,height:i}=this,s=this.svgFactory.create(n,i,!0),a=g(this,Nm,this.svgFactory.createElement("svg:line"));return a.setAttribute("x1",e.rect[2]-e.lineCoordinates[0]),a.setAttribute("y1",e.rect[3]-e.lineCoordinates[1]),a.setAttribute("x2",e.rect[2]-e.lineCoordinates[2]),a.setAttribute("y2",e.rect[3]-e.lineCoordinates[3]),a.setAttribute("stroke-width",e.borderStyle.width||1),a.setAttribute("stroke","transparent"),a.setAttribute("fill","transparent"),s.append(a),this.container.append(s),!e.popupRef&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container}getElementsToTriggerPopup(){return o(this,Nm)}addHighlightArea(){this.container.classList.add("highlightArea")}};Nm=new WeakMap;O2=class extends $e{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0});A(this,Im,null)}render(){this.container.classList.add("squareAnnotation");let{data:e,width:n,height:i}=this,s=this.svgFactory.create(n,i,!0),a=e.borderStyle.width,l=g(this,Im,this.svgFactory.createElement("svg:rect"));return l.setAttribute("x",a/2),l.setAttribute("y",a/2),l.setAttribute("width",n-a),l.setAttribute("height",i-a),l.setAttribute("stroke-width",a||1),l.setAttribute("stroke","transparent"),l.setAttribute("fill","transparent"),s.append(l),this.container.append(s),!e.popupRef&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container}getElementsToTriggerPopup(){return o(this,Im)}addHighlightArea(){this.container.classList.add("highlightArea")}};Im=new WeakMap;F2=class extends $e{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0});A(this,km,null)}render(){this.container.classList.add("circleAnnotation");let{data:e,width:n,height:i}=this,s=this.svgFactory.create(n,i,!0),a=e.borderStyle.width,l=g(this,km,this.svgFactory.createElement("svg:ellipse"));return l.setAttribute("cx",n/2),l.setAttribute("cy",i/2),l.setAttribute("rx",n/2-a/2),l.setAttribute("ry",i/2-a/2),l.setAttribute("stroke-width",a||1),l.setAttribute("stroke","transparent"),l.setAttribute("fill","transparent"),s.append(l),this.container.append(s),!e.popupRef&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container}getElementsToTriggerPopup(){return o(this,km)}addHighlightArea(){this.container.classList.add("highlightArea")}};km=new WeakMap;Ey=class extends $e{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0});A(this,_m,null);this.containerClassName="polylineAnnotation",this.svgElementName="svg:polyline"}render(){this.container.classList.add(this.containerClassName);let{data:{rect:e,vertices:n,borderStyle:i,popupRef:s},width:a,height:l}=this;if(!n)return this.container;let c=this.svgFactory.create(a,l,!0),u=[];for(let d=0,f=n.length;d<f;d+=2){let p=n[d]-e[0],m=e[3]-n[d+1];u.push(`${p},${m}`)}u=u.join(" ");let h=g(this,_m,this.svgFactory.createElement(this.svgElementName));return h.setAttribute("points",u),h.setAttribute("stroke-width",i.width||1),h.setAttribute("stroke","transparent"),h.setAttribute("fill","transparent"),c.append(h),this.container.append(c),!s&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container}getElementsToTriggerPopup(){return o(this,_m)}addHighlightArea(){this.container.classList.add("highlightArea")}};_m=new WeakMap;P2=class extends Ey{constructor(t){super(t),this.containerClassName="polygonAnnotation",this.svgElementName="svg:polygon"}},R2=class extends $e{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0})}render(){return this.container.classList.add("caretAnnotation"),!this.data.popupRef&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container}},hp=class extends $e{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0});A(this,Om);A(this,Mm,null);A(this,Tc,[]);this.containerClassName="inkAnnotation",this.svgElementName="svg:polyline",this.annotationEditorType=this.data.it==="InkHighlight"?Bt.HIGHLIGHT:Bt.INK}render(){this.container.classList.add(this.containerClassName);let{data:{rect:e,rotation:n,inkLists:i,borderStyle:s,popupRef:a}}=this,{transform:l,width:c,height:u}=v(this,Om,L2).call(this,n,e),h=this.svgFactory.create(c,u,!0),d=g(this,Mm,this.svgFactory.createElement("svg:g"));h.append(d),d.setAttribute("stroke-width",s.width||1),d.setAttribute("stroke-linecap","round"),d.setAttribute("stroke-linejoin","round"),d.setAttribute("stroke-miterlimit",10),d.setAttribute("stroke","transparent"),d.setAttribute("fill","transparent"),d.setAttribute("transform",l);for(let f=0,p=i.length;f<p;f++){let m=this.svgFactory.createElement(this.svgElementName);o(this,Tc).push(m),m.setAttribute("points",i[f].join(",")),d.append(m)}return!a&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container.append(h),this._editOnDoubleClick(),this.container}updateEdited(e){super.updateEdited(e);let{thickness:n,points:i,rect:s}=e,a=o(this,Mm);if(n>=0&&a.setAttribute("stroke-width",n||1),i)for(let l=0,c=o(this,Tc).length;l<c;l++)o(this,Tc)[l].setAttribute("points",i[l].join(","));if(s){let{transform:l,width:c,height:u}=v(this,Om,L2).call(this,this.data.rotation,s);a.parentElement.setAttribute("viewBox",`0 0 ${c} ${u}`),a.setAttribute("transform",l)}}getElementsToTriggerPopup(){return o(this,Tc)}addHighlightArea(){this.container.classList.add("highlightArea")}};Mm=new WeakMap,Tc=new WeakMap,Om=new WeakSet,L2=function(e,n){switch(e){case 90:return{transform:`rotate(90) translate(${-n[0]},${n[1]}) scale(1,-1)`,width:n[3]-n[1],height:n[2]-n[0]};case 180:return{transform:`rotate(180) translate(${-n[2]},${n[1]}) scale(1,-1)`,width:n[2]-n[0],height:n[3]-n[1]};case 270:return{transform:`rotate(270) translate(${-n[2]},${n[3]}) scale(1,-1)`,width:n[3]-n[1],height:n[2]-n[0]};default:return{transform:`translate(${-n[0]},${n[3]}) scale(1,-1)`,width:n[2]-n[0],height:n[3]-n[1]}}};Ty=class extends $e{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0}),this.annotationEditorType=Bt.HIGHLIGHT}render(){let{data:{overlaidText:t,popupRef:e}}=this;if(!e&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container.classList.add("highlightAnnotation"),this._editOnDoubleClick(),t){let n=document.createElement("mark");n.classList.add("overlaidText"),n.textContent=t,this.container.append(n)}return this.container}},B2=class extends $e{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){let{data:{overlaidText:t,popupRef:e}}=this;if(!e&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container.classList.add("underlineAnnotation"),t){let n=document.createElement("u");n.classList.add("overlaidText"),n.textContent=t,this.container.append(n)}return this.container}},U2=class extends $e{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){let{data:{overlaidText:t,popupRef:e}}=this;if(!e&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container.classList.add("squigglyAnnotation"),t){let n=document.createElement("u");n.classList.add("overlaidText"),n.textContent=t,this.container.append(n)}return this.container}},$2=class extends $e{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){let{data:{overlaidText:t,popupRef:e}}=this;if(!e&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container.classList.add("strikeoutAnnotation"),t){let n=document.createElement("s");n.classList.add("overlaidText"),n.textContent=t,this.container.append(n)}return this.container}},Sy=class extends $e{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),this.annotationEditorType=Bt.STAMP}render(){return this.container.classList.add("stampAnnotation"),this.container.setAttribute("role","img"),!this.data.popupRef&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this._editOnDoubleClick(),this.container}},z2=class extends $e{constructor(e){super(e,{isRenderable:!0});A(this,Pm);A(this,Fm,null);let{file:n}=this.data;this.filename=n.filename,this.content=n.content,this.linkService.eventBus?.dispatch("fileattachmentannotation",{source:this,...n})}render(){this.container.classList.add("fileAttachmentAnnotation");let{container:e,data:n}=this,i;n.hasAppearance||n.fillAlpha===0?i=document.createElement("div"):(i=document.createElement("img"),i.src=`${this.imageResourcesPath}annotation-${/paperclip/i.test(n.name)?"paperclip":"pushpin"}.svg`,n.fillAlpha&&n.fillAlpha<1&&(i.style=`filter: opacity(${Math.round(n.fillAlpha*100)}%);`)),i.addEventListener("dblclick",v(this,Pm,j2).bind(this)),g(this,Fm,i);let{isMac:s}=Xe.platform;return e.addEventListener("keydown",a=>{a.key==="Enter"&&(s?a.metaKey:a.ctrlKey)&&v(this,Pm,j2).call(this)}),!n.popupRef&&this.hasPopupData?(this.hasOwnCommentButton=!0,this._createPopup()):i.classList.add("popupTriggerArea"),e.append(i),e}getElementsToTriggerPopup(){return o(this,Fm)}addHighlightArea(){this.container.classList.add("highlightArea")}};Fm=new WeakMap,Pm=new WeakSet,j2=function(){this.downloadManager?.openOrDownloadData(this.content,this.filename)};SA=class SA{constructor({div:t,accessibilityManager:e,annotationCanvasMap:n,annotationEditorUIManager:i,page:s,viewport:a,structTreeLayer:l,commentManager:c,linkService:u,annotationStorage:h}){A(this,$a);A(this,Sc,null);A(this,Dc,null);A(this,rd,null);A(this,Go,new Map);A(this,Rm,null);A(this,Nc,null);A(this,Ui,[]);A(this,Lm,!1);this.div=t,g(this,Sc,e),g(this,Dc,n),g(this,Rm,l||null),g(this,Nc,u||null),g(this,rd,h||new sp),this.page=s,this.viewport=a,this.zIndex=0,this._annotationEditorUIManager=i,this._commentManager=c||null}hasEditableAnnotations(){return o(this,Go).size>0}async render(t){let{annotations:e}=t,n=this.div;el(n,this.viewport);let i=new Map,s=[],a={data:null,layer:n,linkService:o(this,Nc),downloadManager:t.downloadManager,imageResourcesPath:t.imageResourcesPath||"",renderForms:t.renderForms!==!1,svgFactory:new Zc,annotationStorage:o(this,rd),enableComment:t.enableComment===!0,enableScripting:t.enableScripting===!0,hasJSActions:t.hasJSActions,fieldObjects:t.fieldObjects,parent:this,elements:null};for(let l of e){if(l.noHTML)continue;let c=l.annotationType===tn.POPUP;if(c){let d=i.get(l.id);if(!d)continue;if(!this._commentManager){s.push(l);continue}a.elements=d}else if(l.rect[2]===l.rect[0]||l.rect[3]===l.rect[1])continue;a.data=l;let u=Kf.create(a);if(!u.isRenderable)continue;c||(o(this,Ui).push(u),l.popupRef&&i.getOrInsertComputed(l.popupRef,cb).push(u));let h=u.render();l.hidden&&(h.style.visibility="hidden"),u._isEditable&&(o(this,Go).set(u.data.id,u),this._annotationEditorUIManager?.renderAnnotationElement(u))}await v(this,$a,G0).call(this);for(let l of s){let c=a.elements=i.get(l.id);a.data=l;let u=Kf.create(a);if(!u.isRenderable)continue;let h=u.render();u.contentElement.id=`${Xu}${l.id}`,l.hidden&&(h.style.visibility="hidden"),c.at(-1).container.after(h)}v(this,$a,G2).call(this)}async addLinkAnnotations(t){let e={data:null,layer:this.div,linkService:o(this,Nc),svgFactory:new Zc,parent:this};for(let n of t){n.borderStyle||(n.borderStyle=SA._defaultBorderStyle),e.data=n;let i=Kf.create(e);i.isRenderable&&(i.render(),i.contentElement.id=`${Xu}${n.id}`,o(this,Ui).push(i))}await v(this,$a,G0).call(this)}update({viewport:t}){let e=this.div;this.viewport=t,el(e,{rotation:t.rotation}),v(this,$a,G2).call(this),e.hidden=!1}getEditableAnnotations(){return o(this,Go).values()}getEditableAnnotation(t){return o(this,Go).get(t)}addFakeAnnotation(t){let{div:e}=this,{id:n,rotation:i}=t,s=new b2({data:{id:n,rect:t.getPDFRect(),rotation:i},editor:t,layer:e,parent:this,enableComment:!!this._commentManager,linkService:o(this,Nc),annotationStorage:o(this,rd)});return s.render(),s.contentElement.id=`${Xu}${n}`,s.createOrUpdatePopup(),o(this,Ui).push(s),s}removeAnnotation(t){let e=o(this,Ui).findIndex(i=>i.data.id===t);if(e<0)return;let[n]=o(this,Ui).splice(e,1);o(this,Sc)?.removePointerInTextLayer(n.contentElement)}updateFakeAnnotations(t){if(t.length!==0){for(let e of t)e.updateFakeAnnotationElement(this);v(this,$a,G0).call(this)}}togglePointerEvents(t=!1){this.div.classList.toggle("disabled",!t)}static get _defaultBorderStyle(){return Ut(this,"_defaultBorderStyle",Object.freeze({width:1,rawWidth:1,style:Uu.SOLID,dashArray:[3],horizontalCornerRadius:0,verticalCornerRadius:0}))}};Sc=new WeakMap,Dc=new WeakMap,rd=new WeakMap,Go=new WeakMap,Rm=new WeakMap,Nc=new WeakMap,Ui=new WeakMap,Lm=new WeakMap,$a=new WeakSet,G0=async function(){if(o(this,Ui).length===0)return;this.div.replaceChildren();let t=[];if(!o(this,Lm)){g(this,Lm,!0);for(let{contentElement:n,data:{id:i}}of o(this,Ui)){let s=n.id=`${Xu}${i}`;t.push(o(this,Rm)?.getAriaAttributes(s).then(a=>{if(a)for(let[l,c]of a)n.setAttribute(l,c)}))}}o(this,Ui).sort(({data:{rect:[n,i,s,a]}},{data:{rect:[l,c,u,h]}})=>{if(n===s&&i===a)return 1;if(l===u&&c===h)return-1;let d=a,f=i,p=(i+a)/2,m=h,y=c,x=(c+h)/2;if(p>=m&&x<=f)return-1;if(x>=d&&p<=y)return 1;let b=(n+s)/2,w=(l+u)/2;return b-w});let e=document.createDocumentFragment();for(let n of o(this,Ui))e.append(n.container),this._commentManager?(n.extraPopupElement?.popup||n.popup)?.renderCommentButton():n.extraPopupElement&&e.append(n.extraPopupElement.render());if(this.div.append(e),await Promise.all(t),o(this,Sc))for(let n of o(this,Ui))o(this,Sc).addPointerInTextLayer(n.contentElement,!1)},G2=function(){if(!o(this,Dc))return;let t=this.div;for(let[e,n]of o(this,Dc)){let i=t.querySelector(`[data-annotation-id="${e}"]`);if(!i)continue;n.className="annotationContent";let{firstChild:s}=i;s?s.nodeName==="CANVAS"?s.replaceWith(n):s.classList.contains("annotationContent")?s.after(n):s.before(n):i.append(n);let a=o(this,Go).get(e);a&&(a._hasNoCanvas?(this._annotationEditorUIManager?.setMissingCanvas(e,i.id,n),a._hasNoCanvas=!1):a.canvas=n)}o(this,Dc).clear()};Dy=SA,m0=/\r\n?|\n/g,Ie=class Ie extends Te{constructor(e){super({...e,name:"freeTextEditor"});A(this,un);A(this,$i,"");A(this,Bm,`${this.id}-editor`);A(this,Ic,null);A(this,zi);U(this,"_colorPicker",null);this.color=e.color||Ie._defaultColor||Te._defaultLineColor,g(this,zi,e.fontSize||Ie._defaultFontSize),this.annotationElementId||this._uiManager.a11yAlert("pdfjs-editor-freetext-added-alert"),this.canAddComment=!1}static get _keyboardManager(){let e=Ie.prototype,n=a=>a.isEmpty(),i=nl.TRANSLATE_SMALL,s=nl.TRANSLATE_BIG;return Ut(this,"_keyboardManager",new Kc([[["ctrl+s","mac+meta+s","ctrl+p","mac+meta+p"],e.commitOrRemove,{bubbles:!0}],[["ctrl+Enter","mac+meta+Enter","Escape","mac+Escape"],e.commitOrRemove],[["ArrowLeft","mac+ArrowLeft"],e._translateEmpty,{args:[-i,0],checker:n}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],e._translateEmpty,{args:[-s,0],checker:n}],[["ArrowRight","mac+ArrowRight"],e._translateEmpty,{args:[i,0],checker:n}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],e._translateEmpty,{args:[s,0],checker:n}],[["ArrowUp","mac+ArrowUp"],e._translateEmpty,{args:[0,-i],checker:n}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],e._translateEmpty,{args:[0,-s],checker:n}],[["ArrowDown","mac+ArrowDown"],e._translateEmpty,{args:[0,i],checker:n}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],e._translateEmpty,{args:[0,s],checker:n}]]))}static initialize(e,n){Te.initialize(e,n);let i=getComputedStyle(document.documentElement);this._internalPadding=parseFloat(i.getPropertyValue("--freetext-padding"))}static updateDefaultParams(e,n){switch(e){case Zt.FREETEXT_SIZE:Ie._defaultFontSize=n;break;case Zt.FREETEXT_COLOR:Ie._defaultColor=n;break}}updateParams(e,n){switch(e){case Zt.FREETEXT_SIZE:v(this,un,tD).call(this,n);break;case Zt.FREETEXT_COLOR:v(this,un,eD).call(this,n);break}}static get defaultPropertiesToUpdate(){return[[Zt.FREETEXT_SIZE,Ie._defaultFontSize],[Zt.FREETEXT_COLOR,Ie._defaultColor||Te._defaultLineColor]]}get propertiesToUpdate(){return[[Zt.FREETEXT_SIZE,o(this,zi)],[Zt.FREETEXT_COLOR,this.color]]}get toolbarButtons(){return this._colorPicker||(this._colorPicker=new wy(this)),[["colorPicker",this._colorPicker]]}get colorType(){return Zt.FREETEXT_COLOR}onUpdatedColor(){this.editorDiv.style.color=this.color,this._colorPicker?.update(this.color),super.onUpdatedColor()}_translateEmpty(e,n){this._uiManager.translateSelectedEditors(e,n,!0)}getInitialTranslation(){let e=this.parentScale;return[-Ie._internalPadding*e,-(Ie._internalPadding+o(this,zi))*e]}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(this.isAttachedToDOM||this.parent.add(this)))}enableEditMode(){if(!super.enableEditMode())return!1;this.overlayDiv.classList.remove("enabled"),this.editorDiv.contentEditable=!0,this._isDraggable=!1,this.div.removeAttribute("aria-activedescendant"),g(this,Ic,new AbortController);let e=this._uiManager.combinedSignal(o(this,Ic));return this.editorDiv.addEventListener("keydown",this.editorDivKeydown.bind(this),{signal:e}),this.editorDiv.addEventListener("focus",this.editorDivFocus.bind(this),{signal:e}),this.editorDiv.addEventListener("blur",this.editorDivBlur.bind(this),{signal:e}),this.editorDiv.addEventListener("input",this.editorDivInput.bind(this),{signal:e}),this.editorDiv.addEventListener("paste",this.editorDivPaste.bind(this),{signal:e}),!0}disableEditMode(){return super.disableEditMode()?(this.overlayDiv.classList.add("enabled"),this.editorDiv.contentEditable=!1,this.div.setAttribute("aria-activedescendant",o(this,Bm)),this._isDraggable=!0,o(this,Ic)?.abort(),g(this,Ic,null),this.div.focus({preventScroll:!0}),this.isEditing=!1,this.parent.div.classList.add("freetextEditing"),!0):!1}focusin(e){this._focusEventsAllowed&&(super.focusin(e),e.target!==this.editorDiv&&this.editorDiv.focus())}onceAdded(e){this.width||(this.enableEditMode(),e&&this.editorDiv.focus(),this._initialOptions?.isCentered&&this.center(),this._initialOptions=null)}isEmpty(){return!this.editorDiv||this.editorDiv.innerText.trim()===""}remove(){this.isEditing=!1,this.parent&&(this.parent.setEditingState(!0),this.parent.div.classList.add("freetextEditing")),super.remove()}commit(){if(!this.isInEditMode())return;super.commit(),this.disableEditMode();let e=o(this,$i),n=g(this,$i,v(this,un,nD).call(this).trimEnd());if(e===n)return;let i=s=>{if(g(this,$i,s),!s){this.remove();return}v(this,un,q0).call(this),this._uiManager.rebuild(this),v(this,un,H0).call(this)};this.addCommands({cmd:()=>{i(n)},undo:()=>{i(e)},mustExec:!1}),v(this,un,H0).call(this)}shouldGetKeyboardEvents(){return this.isInEditMode()}enterInEditMode(){this.enableEditMode(),this.editorDiv.focus()}keydown(e){e.target===this.div&&e.key==="Enter"&&(this.enterInEditMode(),e.preventDefault())}editorDivKeydown(e){Ie._keyboardManager.exec(this,e)}editorDivFocus(e){this.isEditing=!0}editorDivBlur(e){this.isEditing=!1}editorDivInput(e){this.parent.div.classList.toggle("freetextEditing",this.isEmpty())}disableEditing(){this.editorDiv.setAttribute("role","comment"),this.editorDiv.removeAttribute("aria-multiline")}enableEditing(){this.editorDiv.setAttribute("role","textbox"),this.editorDiv.setAttribute("aria-multiline",!0)}get canChangeContent(){return!0}render(){if(this.div)return this.div;let e,n;(this._isCopy||this.annotationElementId)&&(e=this.x,n=this.y),super.render(),this.editorDiv=document.createElement("div"),this.editorDiv.className="internal",this.editorDiv.setAttribute("id",o(this,Bm)),this.editorDiv.setAttribute("data-l10n-id","pdfjs-free-text2"),this.editorDiv.setAttribute("data-l10n-attrs","default-content"),this.enableEditing(),this.editorDiv.contentEditable=!0;let{style:i}=this.editorDiv;if(i.fontSize=`calc(${o(this,zi)}px * var(--total-scale-factor))`,i.color=this.color,this.div.append(this.editorDiv),this.overlayDiv=document.createElement("div"),this.overlayDiv.classList.add("overlay","enabled"),this.div.append(this.overlayDiv),this._isCopy||this.annotationElementId){let[s,a]=this.parentDimensions;if(this.annotationElementId){let{position:l}=this._initialData,[c,u]=this.getInitialTranslation();[c,u]=this.pageTranslationToScreen(c,u);let[h,d]=this.pageDimensions,[f,p]=this.pageTranslation,m,y;switch(this.rotation){case 0:m=e+(l[0]-f)/h,y=n+this.height-(l[1]-p)/d;break;case 90:m=e+(l[0]-f)/h,y=n-(l[1]-p)/d,[c,u]=[u,-c];break;case 180:m=e-this.width+(l[0]-f)/h,y=n-(l[1]-p)/d,[c,u]=[-c,-u];break;case 270:m=e+(l[0]-f-this.height*d)/h,y=n+(l[1]-p-this.width*h)/d,[c,u]=[-u,c];break}this.setAt(m*s,y*a,c,u)}else this._moveAfterPaste(e,n);v(this,un,q0).call(this),this._isDraggable=!0,this.editorDiv.contentEditable=!1}else this._isDraggable=!1,this.editorDiv.contentEditable=!0;return this.div}editorDivPaste(e){var m,y,x;let n=e.clipboardData||window.clipboardData,{types:i}=n;if(i.length===1&&i[0]==="text/plain")return;e.preventDefault();let s=v(m=Ie,za,W2).call(m,n.getData("text")||"").replaceAll(m0,`
|
|
58
|
+
`,Ow=class{constructor(){A(this,Rd);A(this,Vp,null);A(this,Mh,null);A(this,Oh,null);A(this,Fh,null)}init(){o(this,Vp)===null&&g(this,Vp,v(this,Rd,vS).call(this))}get isReady(){return o(this,Mh)!==null}draw(t,e,n,i,s,a){let l=o(this,Mh),{offsetX:c,offsetY:u,scaleX:h,scaleY:d}=e,{posData:f,colData:p,vertexCount:m}=v(this,Rd,CS).call(this,t,e),y=l.createBuffer({size:Math.max(f.byteLength,4),usage:GPUBufferUsage.VERTEX|GPUBufferUsage.COPY_DST});f.byteLength>0&&l.queue.writeBuffer(y,0,f);let x=l.createBuffer({size:Math.max(p.byteLength,4),usage:GPUBufferUsage.VERTEX|GPUBufferUsage.COPY_DST});p.byteLength>0&&l.queue.writeBuffer(x,0,p);let b=l.createBuffer({size:32,usage:GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST});l.queue.writeBuffer(b,0,new Float32Array([c,u,h,d,i,s,a,0]));let w=l.createBindGroup({layout:o(this,Oh).getBindGroupLayout(0),entries:[{binding:0,resource:{buffer:b}}]}),C=new OffscreenCanvas(i,s),E=C.getContext("webgpu");E.configure({device:l,format:o(this,Fh),alphaMode:n?"opaque":"premultiplied"});let S=n?{r:n[0]/255,g:n[1]/255,b:n[2]/255,a:1}:{r:0,g:0,b:0,a:0},N=l.createCommandEncoder(),k=N.beginRenderPass({colorAttachments:[{view:E.getCurrentTexture().createView(),clearValue:S,loadOp:"clear",storeOp:"store"}]});return m>0&&(k.setPipeline(o(this,Oh)),k.setBindGroup(0,w),k.setVertexBuffer(0,y),k.setVertexBuffer(1,x),k.draw(m)),k.end(),l.queue.submit([N.finish()]),y.destroy(),x.destroy(),b.destroy(),C.transferToImageBitmap()}};Vp=new WeakMap,Mh=new WeakMap,Oh=new WeakMap,Fh=new WeakMap,Rd=new WeakSet,vS=async function(){if(!globalThis.navigator?.gpu)return!1;try{let t=await navigator.gpu.requestAdapter();if(!t)return!1;g(this,Fh,navigator.gpu.getPreferredCanvasFormat());let e=g(this,Mh,await t.requestDevice()),n=e.createShaderModule({code:RO});return g(this,Oh,e.createRenderPipeline({layout:"auto",vertex:{module:n,entryPoint:"vs_main",buffers:[{arrayStride:8,attributes:[{shaderLocation:0,offset:0,format:"float32x2"}]},{arrayStride:4,attributes:[{shaderLocation:1,offset:0,format:"unorm8x4"}]}]},fragment:{module:n,entryPoint:"fs_main",targets:[{format:o(this,Fh)}]},primitive:{topology:"triangle-list"}})),!0}catch{return!1}},CS=function(t,e){let{coords:n,colors:i}=e,s=0;for(let d of t){let f=d.coords;if(d.type===Dl.TRIANGLES)s+=f.length;else if(d.type===Dl.LATTICE){let p=d.verticesPerRow;s+=(Math.floor(f.length/p)-1)*(p-1)*6}}let a=new Float32Array(s*2),l=new Uint8Array(s*4),c=0,u=0,h=(d,f)=>{a[c++]=n[d*2],a[c++]=n[d*2+1],l[u++]=i[f*4],l[u++]=i[f*4+1],l[u++]=i[f*4+2],u++};for(let d of t){let f=d.coords,p=d.colors;if(d.type===Dl.TRIANGLES)for(let m=0,y=f.length;m<y;m+=3)h(f[m],p[m]),h(f[m+1],p[m+1]),h(f[m+2],p[m+2]);else if(d.type===Dl.LATTICE){let m=d.verticesPerRow,y=Math.floor(f.length/m)-1,x=m-1;for(let b=0;b<y;b++){let w=b*m;for(let C=0;C<x;C++,w++)h(f[w],p[w]),h(f[w+1],p[w+1]),h(f[w+m],p[w+m]),h(f[w+m+1],p[w+m+1]),h(f[w+1],p[w+1]),h(f[w+m],p[w+m])}}}return{posData:a,colData:l,vertexCount:s}};w2=new Ow;Gn={FILL:"Fill",STROKE:"Stroke",SHADING:"Shading"};ap=class{isModifyingCurrentTransform(){return!1}getPattern(){ue("Abstract method `getPattern` called.")}},Fw=class extends ap{constructor(t){super(),this._type=t[1],this._bbox=t[2],this._colorStops=t[3],this._p0=t[4],this._p1=t[5],this._r0=t[6],this._r1=t[7],this.matrix=null}isOriginBased(){return this._p0[0]===0&&this._p0[1]===0&&(!this.isRadial()||this._p1[0]===0&&this._p1[1]===0)}isRadial(){return this._type==="radial"}_isCircleCenterOutside(){return!this.isRadial()||this._r0>this._r1?!1:Math.hypot(this._p0[0]-this._p1[0],this._p0[1]-this._p1[1])>this._r1}_createGradient(t,e=null){let n,i=this._p0,s=this._p1;if(e&&(i=i.slice(),s=s.slice(),yt.applyTransform(i,e),yt.applyTransform(s,e)),this._type==="axial")n=t.createLinearGradient(i[0],i[1],s[0],s[1]);else if(this._type==="radial"){let a=this._r0,l=this._r1;if(e){let c=new Float32Array(2);yt.singularValueDecompose2dScale(e,c),a*=c[0],l*=c[0]}n=t.createRadialGradient(i[0],i[1],a,s[0],s[1],l)}for(let a of this._colorStops)n.addColorStop(a[0],a[1]);return n}_createReversedGradient(t,e=null){let n=this._p1,i=this._p0;e&&(n=n.slice(),i=i.slice(),yt.applyTransform(n,e),yt.applyTransform(i,e));let s=this._r1,a=this._r0;if(e){let u=new Float32Array(2);yt.singularValueDecompose2dScale(e,u),s*=u[0],a*=u[0]}let l=t.createRadialGradient(n[0],n[1],s,i[0],i[1],a),c=this._colorStops.map(([u,h])=>[1-u,h]).reverse();for(let[u,h]of c)l.addColorStop(u,h);return l}getPattern(t,e,n,i){let s;if(i===Gn.STROKE||i===Gn.FILL){if(this.isOriginBased()){let f=yt.transform(n,e.baseTransform);this.matrix&&(f=yt.transform(f,this.matrix));let p=.001,m=Math.hypot(f[0],f[1]),y=Math.hypot(f[2],f[3]),x=(f[0]*f[2]+f[1]*f[3])/(m*y);if(Math.abs(x)<p)if(this.isRadial()){if(Math.abs(m-y)<p)return this._createGradient(t,f)}else return this._createGradient(t,f)}let a=e.current.getClippedPathBoundingBox(i,Le(t))||[0,0,0,0],l=Math.ceil(a[2]-a[0])||1,c=Math.ceil(a[3]-a[1])||1,u=e.canvasFactory.create(l,c),h=u.context;h.clearRect(0,0,h.canvas.width,h.canvas.height),h.beginPath(),h.rect(0,0,h.canvas.width,h.canvas.height),h.translate(-a[0],-a[1]),n=yt.transform(n,[1,0,0,1,a[0],a[1]]),h.transform(...e.baseTransform),this.matrix&&h.transform(...this.matrix),O0(h,this._bbox),this._isCircleCenterOutside()&&(h.fillStyle=this._createReversedGradient(h),h.fill()),h.fillStyle=this._createGradient(h),h.fill(),s=t.createPattern(u.canvas,"no-repeat"),e.canvasFactory.destroy(u);let d=new DOMMatrix(n);s.setTransform(d)}else this._isCircleCenterOutside()&&(t.save(),O0(t,this._bbox),t.fillStyle=this._createReversedGradient(t),t.fillRect(-1e10,-1e10,2e10,2e10),t.restore()),O0(t,this._bbox),s=this._createGradient(t);return s}};Pw=class extends ap{constructor(t){super(),this._coords=t[2],this._colors=t[3],this._figures=t[4],this._bounds=t[5],this._bbox=t[6],this._background=t[7],this.matrix=null}_createMeshCanvas(t,e,n){let l=Math.floor(this._bounds[0]),c=Math.floor(this._bounds[1]),u=Math.ceil(this._bounds[2])-l,h=Math.ceil(this._bounds[3])-c,d=Math.min(Math.ceil(Math.abs(u*t[0]*1.1)),3e3)||1,f=Math.min(Math.ceil(Math.abs(h*t[1]*1.1)),3e3)||1,p=u?u/d:1,m=h?h/f:1,y={coords:this._coords,colors:this._colors,offsetX:-l,offsetY:-c,scaleX:1/p,scaleY:1/m},x=d+4,b=f+4,w=n.create(x,b);if(BO())w.context.drawImage(UO(this._figures,y,e,x,b,2),0,0);else{let C=w.context.createImageData(d,f);if(e){let E=C.data;for(let S=0,N=E.length;S<N;S+=4)E[S]=e[0],E[S+1]=e[1],E[S+2]=e[2],E[S+3]=255}for(let E of this._figures)$O(C,E,y);w.context.putImageData(C,2,2)}return{canvas:w.canvas,offsetX:l-2*p,offsetY:c-2*m,scaleX:p,scaleY:m}}isModifyingCurrentTransform(){return!0}getPattern(t,e,n,i){O0(t,this._bbox);let s=new Float32Array(2);if(i===Gn.SHADING)yt.singularValueDecompose2dScale(Le(t),s);else if(this.matrix){yt.singularValueDecompose2dScale(this.matrix,s);let[c,u]=s;yt.singularValueDecompose2dScale(e.baseTransform,s),s[0]*=c,s[1]*=u}else yt.singularValueDecompose2dScale(e.baseTransform,s);let a=this._createMeshCanvas(s,i===Gn.SHADING?null:this._background,e.canvasFactory);i!==Gn.SHADING&&(t.setTransform(...e.baseTransform),this.matrix&&t.transform(...this.matrix)),t.translate(a.offsetX,a.offsetY),t.scale(a.scaleX,a.scaleY);let l=t.createPattern(a.canvas,"no-repeat");return e.canvasFactory.destroy(a),l}},Rw=class extends ap{getPattern(){return"hotpink"}};gT={COLORED:1,UNCOLORED:2},Xy=class Xy{constructor(t,e,n,i){this.color=t[1],this.operatorList=t[2],this.matrix=t[3],this.bbox=t[4],this.xstep=t[5],this.ystep=t[6],this.paintType=t[7],this.tilingType=t[8],this.ctx=e,this.canvasGraphicsFactory=n,this.baseTransform=i}createPatternCanvas(t,e){let{bbox:n,operatorList:i,paintType:s,tilingType:a,color:l,canvasGraphicsFactory:c}=this,{xstep:u,ystep:h}=this;u=Math.abs(u),h=Math.abs(h),ob("TilingType: "+a);let d=n[0],f=n[1],p=n[2],m=n[3],y=p-d,x=m-f,b=new Float32Array(2);yt.singularValueDecompose2dScale(this.matrix,b);let[w,C]=b;yt.singularValueDecompose2dScale(this.baseTransform,b);let E=w*b[0],S=C*b[1],N=y,k=x,M=!1,R=!1,j=Math.ceil(u*E),$=Math.ceil(h*S),q=Math.ceil(y*E),Q=Math.ceil(x*S);j>=q?N=u:M=!0,$>=Q?k=h:R=!0;let Z=this.getSizeAndScale(N,this.ctx.canvas.width,E),Y=this.getSizeAndScale(k,this.ctx.canvas.height,S),X=t.canvasFactory.create(Z.size,Y.size),T=X.context,I=c.createCanvasGraphics(T,e);if(I.groupLevel=t.groupLevel,this.setFillAndStrokeStyleToContext(I,s,l),T.translate(-Z.scale*d,-Y.scale*f),I.transform(0,Z.scale,0,0,Y.scale,0,0),T.save(),I.dependencyTracker?.save(),this.clipBbox(I,d,f,p,m),I.baseTransform=Le(I.ctx),I.executeOperatorList(i),I.endDrawing(),I.dependencyTracker?.restore(),T.restore(),M||R){let _=X.canvas;M&&(N=u),R&&(k=h);let W=this.getSizeAndScale(N,this.ctx.canvas.width,E),z=this.getSizeAndScale(k,this.ctx.canvas.height,S),D=W.size,F=z.size,P=t.canvasFactory.create(D,F),G=P.context,H=M?Math.floor(y/u):0,V=R?Math.floor(x/h):0;for(let L=0;L<=H;L++)for(let tt=0;tt<=V;tt++)G.drawImage(_,D*L,F*tt,D,F,0,0,D,F);return t.canvasFactory.destroy(X),{canvas:P.canvas,canvasEntry:P,scaleX:W.scale,scaleY:z.scale,offsetX:d,offsetY:f}}return{canvas:X.canvas,canvasEntry:X,scaleX:Z.scale,scaleY:Y.scale,offsetX:d,offsetY:f}}getSizeAndScale(t,e,n){let i=Math.max(Xy.MAX_PATTERN_SIZE,e),s=Math.ceil(t*n);return s>=i?s=i:n=s/t,{scale:n,size:s}}clipBbox(t,e,n,i,s){let a=i-e,l=s-n;t.ctx.rect(e,n,a,l),yt.axialAlignedBoundingBox([e,n,i,s],Le(t.ctx),t.current.minMax),t.clip(),t.endPath()}setFillAndStrokeStyleToContext(t,e,n){let i=t.ctx,s=t.current;switch(e){case gT.COLORED:let{fillStyle:a,strokeStyle:l}=this.ctx;i.fillStyle=s.fillColor=a,i.strokeStyle=s.strokeColor=l;break;case gT.UNCOLORED:i.fillStyle=i.strokeStyle=n,s.fillColor=s.strokeColor=n;break;default:throw new $x(`Unsupported paint type: ${e}`)}}isModifyingCurrentTransform(){return!1}getPattern(t,e,n,i,s){let a=n;i!==Gn.SHADING&&(a=yt.transform(a,e.baseTransform),this.matrix&&(a=yt.transform(a,this.matrix)));let l=this.createPatternCanvas(e,s),c=new DOMMatrix(a);c=c.translate(l.offsetX,l.offsetY),c=c.scale(1/l.scaleX,1/l.scaleY);let u=t.createPattern(l.canvas,"repeat");return e.canvasFactory.destroy(l.canvasEntry),u.setTransform(c),u}};U(Xy,"MAX_PATTERN_SIZE",3e3);Lw=Xy;yT=16,bT=100,GO=15,xT=10,Si=16,Rx=new DOMMatrix,Zi=new Float32Array(2),Ku=new Float32Array([1/0,1/0,-1/0,-1/0]);by=class{constructor(t,e){U(this,"alphaIsShape",!1);U(this,"fontSize",0);U(this,"fontSizeScale",1);U(this,"textMatrix",null);U(this,"textMatrixScale",1);U(this,"fontMatrix",Bx);U(this,"leading",0);U(this,"x",0);U(this,"y",0);U(this,"lineX",0);U(this,"lineY",0);U(this,"charSpacing",0);U(this,"wordSpacing",0);U(this,"textHScale",1);U(this,"textRenderingMode",pn.FILL);U(this,"textRise",0);U(this,"fillColor","#000000");U(this,"strokeColor","#000000");U(this,"patternFill",!1);U(this,"patternStroke",!1);U(this,"fillAlpha",1);U(this,"strokeAlpha",1);U(this,"lineWidth",1);U(this,"activeSMask",null);U(this,"transferMaps","none");U(this,"minMax",Ku.slice());this.clipBox=new Float32Array([0,0,t,e])}clone(){let t=Object.create(this);return t.clipBox=this.clipBox.slice(),t.minMax=this.minMax.slice(),t}getPathBoundingBox(t=Gn.FILL,e=null){let n=this.minMax.slice();if(t===Gn.STROKE){e||ue("Stroke bounding box must include transform."),yt.singularValueDecompose2dScale(e,Zi);let i=Zi[0]*this.lineWidth/2,s=Zi[1]*this.lineWidth/2;n[0]-=i,n[1]-=s,n[2]+=i,n[3]+=s}return n}updateClipFromPath(){let t=yt.intersect(this.clipBox,this.getPathBoundingBox());this.startNewPathAndClipBox(t||[0,0,0,0])}isEmptyClip(){return this.minMax[0]===1/0}startNewPathAndClipBox(t){this.clipBox.set(t,0),this.minMax.set(Ku,0)}getClippedPathBoundingBox(t=Gn.FILL,e=null){return yt.intersect(this.clipBox,this.getPathBoundingBox(t,e))}};WO=["butt","round","square"],qO=["miter","round","bevel"],VO={},CT={},E2=class E2{constructor(t,e,n,i,s,{optionalContentConfig:a,markedContentStack:l=null},c,u,h,d){A(this,Jr);this.ctx=t,this.current=new by(this.ctx.canvas.width,this.ctx.canvas.height),this.stateStack=[],this.pendingClip=null,this.pendingEOFill=!1,this.commonObjs=e,this.objs=n,this.canvasFactory=i,this.filterFactory=s,this.groupStack=[],this.baseTransform=null,this.baseTransformStack=[],this.groupLevel=0,this.smaskStack=[],this.smaskCounter=0,this.tempSMask=null,this.smaskGroupCanvases=[],this.suspendedCtx=null,this.contentVisible=!0,this.markedContentStack=l||[],this.optionalContentConfig=a,this.cachedPatterns=new Map,this.annotationCanvasMap=c,this.viewportScale=1,this.outputScaleX=1,this.outputScaleY=1,this.pageColors=u,this._cachedScaleForStroking=[-1,0],this._cachedGetSinglePixelWidth=null,this._cachedBitmapsMap=new Map,this.dependencyTracker=h??null,this.imagesTracker=d??null}getObject(t,e,n=null){return typeof e=="string"?(this.dependencyTracker?.recordNamedDependency(t,e),e.startsWith("g_")?this.commonObjs.get(e):this.objs.get(e)):n}beginDrawing({transform:t,viewport:e,transparency:n=!1,background:i=null}){let s=this.ctx.canvas.width,a=this.ctx.canvas.height,l=this.ctx.fillStyle;if(this.ctx.fillStyle=i||"#ffffff",this.ctx.fillRect(0,0,s,a),this.ctx.fillStyle=l,n){let c=this.transparentCanvasEntry=this.canvasFactory.create(s,a);this.compositeCtx=this.ctx,{canvas:this.transparentCanvas,context:this.ctx}=c,this.ctx.save(),this.ctx.transform(...Le(this.compositeCtx))}this.ctx.save(),p0(this.ctx),t&&(this.ctx.transform(...t),this.outputScaleX=t[0],this.outputScaleY=t[0]),this.ctx.transform(...e.transform),this.viewportScale=e.scale,this.baseTransform=Le(this.ctx)}executeOperatorList(t,e,n,i,s){let a=t.argsArray,l=t.fnArray,c=e||0,u=a.length;if(u===c)return c;let h=u-c>xT&&typeof n=="function",d=h?Date.now()+GO:0,f=0,p=this.commonObjs,m=this.objs,y,x;for(;;){if(i!==void 0){if(c===i.nextBreakPoint)return i.breakIt(c,n),c;if(i.shouldSkip(c)){if(++c===u)return c;continue}}if(!s||s(c))if(y=l[c],x=a[c]??null,y!==Nd.dependency)x===null?this[y](c):this[y](c,...x);else for(let b of x){this.dependencyTracker?.recordNamedData(b,c);let w=b.startsWith("g_")?p:m;if(!w.has(b))return w.get(b,n),c}if(c++,c===u)return c;if(h&&++f>xT){if(Date.now()>d)return n(),c;f=0}}}endDrawing(){v(this,Jr,Bw).call(this);for(let t of this.smaskGroupCanvases)this.canvasFactory.destroy(t);this.smaskGroupCanvases.length=0,this.tempSMask=null,this.smaskStack.length=0,this.cachedPatterns.clear();for(let t of this._cachedBitmapsMap.values()){for(let e of t.values())typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement&&(e.width=e.height=0);t.clear()}this._cachedBitmapsMap.clear(),v(this,Jr,Uw).call(this)}_scaleImage(t,e){let n=t.width??t.displayWidth,i=t.height??t.displayHeight,s=Math.max(Math.hypot(e[0],e[1]),1),a=Math.max(Math.hypot(e[2],e[3]),1),l=[],c=s,u=a,h=n,d=i;for(;c>2&&h>1||u>2&&d>1;){let b=h,w=d;c>2&&h>1&&(b=h>=16384?Math.floor(h/2)-1||1:Math.ceil(h/2),c/=h/b),u>2&&d>1&&(w=d>=16384?Math.floor(d/2)-1||1:Math.ceil(d)/2,u/=d/w),l.push({newWidth:b,newHeight:w}),h=b,d=w}if(l.length===0)return{img:t,paintWidth:n,paintHeight:i,tmpCanvas:null};if(l.length===1){let{newWidth:b,newHeight:w}=l[0],C=this.canvasFactory.create(b,w);return C.context.drawImage(t,0,0,n,i,0,0,b,w),{img:C.canvas,paintWidth:b,paintHeight:w,tmpCanvas:C}}let f=this.canvasFactory.create(1,1),p=this.canvasFactory.create(1,1),m=n,y=i,x=t;for(let{newWidth:b,newHeight:w}of l)this.canvasFactory.reset(p,b,w),p.context.drawImage(x,0,0,m,y,0,0,b,w),[f,p]=[p,f],x=f.canvas,m=b,y=w;return this.canvasFactory.destroy(p),{img:f.canvas,paintWidth:m,paintHeight:y,tmpCanvas:f}}_createMaskCanvas(t,e){let n=this.ctx,{width:i,height:s}=e,a=this.current.fillColor,l=this.current.patternFill,c=Le(n),u,h,d,f;if((e.bitmap||e.data)&&e.count>1){let $=e.bitmap||e.data.buffer;h=JSON.stringify(l?c:[c.slice(0,4),a]),u=this._cachedBitmapsMap.getOrInsertComputed($,ub);let q=u.get(h);if(q&&!l){let Q=Math.round(Math.min(c[0],c[2])+c[4]),Z=Math.round(Math.min(c[1],c[3])+c[5]);return this.dependencyTracker?.recordDependencies(t,hr.transformAndFill),{canvas:q,offsetX:Q,offsetY:Z}}d=q}d||(f=this.canvasFactory.create(i,s),AT(f.context,e));let p=yt.transform(c,[1/i,0,0,-1/s,0,0]);p=yt.transform(p,[1,0,0,1,0,-s]);let m=Ku.slice();yt.axialAlignedBoundingBox([0,0,i,s],p,m);let[y,x,b,w]=m,C=Math.round(b-y)||1,E=Math.round(w-x)||1,S=this.canvasFactory.create(C,E),N=S.context,k=y,M=x;N.translate(-k,-M),N.transform(...p);let R=null;if(!d){let $=this._scaleImage(f.canvas,hs(N));d=$.img,R=$.tmpCanvas,d!==f.canvas&&(this.canvasFactory.destroy(f),f=null),u&&l&&(u.set(h,d),R=null,f=null)}N.imageSmoothingEnabled=vT(Le(N),e.interpolate),f0(N,d,0,0,d.width,d.height,0,0,i,s),R&&this.canvasFactory.destroy(R),f&&this.canvasFactory.destroy(f),N.globalCompositeOperation="source-in";let j=yt.transform(hs(N),[1,0,0,1,-k,-M]);return N.fillStyle=l?a.getPattern(n,this,j,Gn.FILL,t):a,N.fillRect(0,0,i,s),u&&!l&&u.set(h,S.canvas),this.dependencyTracker?.recordDependencies(t,hr.transformAndFill),{canvas:S.canvas,canvasEntry:u&&!l?null:S,offsetX:Math.round(k),offsetY:Math.round(M)}}setLineWidth(t,e){this.dependencyTracker?.recordSimpleData("lineWidth",t),e!==this.current.lineWidth&&(this._cachedScaleForStroking[0]=-1),this.current.lineWidth=e,this.ctx.lineWidth=e}setLineCap(t,e){this.dependencyTracker?.recordSimpleData("lineCap",t),this.ctx.lineCap=WO[e]}setLineJoin(t,e){this.dependencyTracker?.recordSimpleData("lineJoin",t),this.ctx.lineJoin=qO[e]}setMiterLimit(t,e){this.dependencyTracker?.recordSimpleData("miterLimit",t),this.ctx.miterLimit=e}setDash(t,e,n){this.dependencyTracker?.recordSimpleData("dash",t);let i=this.ctx;i.setLineDash!==void 0&&(i.setLineDash(e),i.lineDashOffset=n)}setRenderingIntent(t,e){}setFlatness(t,e){}setGState(t,e){for(let[n,i]of e)switch(n){case"LW":this.setLineWidth(t,i);break;case"LC":this.setLineCap(t,i);break;case"LJ":this.setLineJoin(t,i);break;case"ML":this.setMiterLimit(t,i);break;case"D":this.setDash(t,i[0],i[1]);break;case"RI":this.setRenderingIntent(t,i);break;case"FL":this.setFlatness(t,i);break;case"Font":this.setFont(t,i[0],i[1]);break;case"CA":this.dependencyTracker?.recordSimpleData("strokeAlpha",t),this.current.strokeAlpha=i;break;case"ca":this.dependencyTracker?.recordSimpleData("fillAlpha",t),this.ctx.globalAlpha=this.current.fillAlpha=i;break;case"BM":this.dependencyTracker?.recordSimpleData("globalCompositeOperation",t),this.ctx.globalCompositeOperation=i;break;case"SMask":this.dependencyTracker?.recordSimpleData("SMask",t),this.current.activeSMask=i?this.tempSMask:null,this.tempSMask=null,this.checkSMaskState();break;case"TR":this.dependencyTracker?.recordSimpleData("filter",t),this.ctx.filter=this.current.transferMaps=this.filterFactory.addFilter(i);break}}get inSMaskMode(){return!!this.suspendedCtx}checkSMaskState(){let t=this.inSMaskMode;this.current.activeSMask&&!t?this.beginSMaskMode():!this.current.activeSMask&&t&&this.endSMaskMode()}beginSMaskMode(t){if(this.inSMaskMode)throw new Error("beginSMaskMode called while already in smask mode");let e=this.ctx.canvas.width,n=this.ctx.canvas.height,i=this.canvasFactory.create(e,n);this.smaskScratchCanvas=i,this.suspendedCtx=this.ctx;let s=this.ctx=i.context;s.setTransform(this.suspendedCtx.getTransform()),vf(this.suspendedCtx,s),HO(s,this.suspendedCtx),this.setGState(t,[["BM","source-over"]])}endSMaskMode(){if(!this.inSMaskMode)throw new Error("endSMaskMode called while not in smask mode");this.ctx._removeMirroring(),vf(this.ctx,this.suspendedCtx),this.ctx=this.suspendedCtx,this.suspendedCtx=null,this.canvasFactory.destroy(this.smaskScratchCanvas),this.smaskScratchCanvas=null}compose(t){if(!this.current.activeSMask)return;t?(t[0]=Math.floor(t[0]),t[1]=Math.floor(t[1]),t[2]=Math.ceil(t[2]),t[3]=Math.ceil(t[3])):t=[0,0,this.ctx.canvas.width,this.ctx.canvas.height];let e=this.current.activeSMask,n=this.suspendedCtx;this.composeSMask(n,e,this.ctx,t),this.ctx.save(),this.ctx.setTransform(1,0,0,1,0,0),this.ctx.clearRect(0,0,this.ctx.canvas.width,this.ctx.canvas.height),this.ctx.restore()}composeSMask(t,e,n,i){let s=i[0],a=i[1],l=i[2]-s,c=i[3]-a;l===0||c===0||(this.genericComposeSMask(e.context,n,l,c,e.subtype,e.backdrop,e.transferMap,s,a,e.offsetX,e.offsetY),t.save(),t.globalAlpha=1,t.globalCompositeOperation="source-over",t.setTransform(1,0,0,1,0,0),t.drawImage(n.canvas,0,0),t.restore())}genericComposeSMask(t,e,n,i,s,a,l,c,u,h,d){let f=t.canvas,p=c-h,m=u-d,y=null;if(a)if(p<0||m<0||p+n>f.width||m+i>f.height){y=this.canvasFactory.create(n,i);let b=y.context;b.drawImage(f,-p,-m),b.globalCompositeOperation="destination-atop",b.fillStyle=a,b.fillRect(0,0,n,i),b.globalCompositeOperation="source-over",f=y.canvas,p=m=0}else{t.save(),t.globalAlpha=1,t.setTransform(1,0,0,1,0,0);let b=new Path2D;b.rect(p,m,n,i),t.clip(b),t.globalCompositeOperation="destination-atop",t.fillStyle=a,t.fillRect(p,m,n,i),t.restore()}e.save(),e.globalAlpha=1,e.setTransform(1,0,0,1,0,0),s==="Alpha"&&l?e.filter=this.filterFactory.addAlphaFilter(l):s==="Luminosity"&&(e.filter=this.filterFactory.addLuminosityFilter(l));let x=new Path2D;x.rect(c,u,n,i),e.clip(x),e.globalCompositeOperation="destination-in",e.drawImage(f,p,m,n,i,c,u,n,i),e.restore(),y&&this.canvasFactory.destroy(y)}save(t){this.inSMaskMode&&vf(this.ctx,this.suspendedCtx),this.ctx.save();let e=this.current;this.stateStack.push(e),this.current=e.clone(),this.dependencyTracker?.save(t)}restore(t){if(this.dependencyTracker?.restore(t),this.stateStack.length===0){this.inSMaskMode&&this.endSMaskMode();return}this.current=this.stateStack.pop(),this.ctx.restore(),this.inSMaskMode&&vf(this.suspendedCtx,this.ctx),this.checkSMaskState(),this.pendingClip=null,this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null}transform(t,e,n,i,s,a,l){this.dependencyTracker?.recordIncrementalData("transform",t),this.ctx.transform(e,n,i,s,a,l),this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null}constructPath(t,e,n,i){let[s]=n;if(!i){s||(s=n[0]=new Path2D),this[e](t,s);return}if(this.dependencyTracker!==null){let a=e===Nd.stroke?this.current.lineWidth/2:0;this.dependencyTracker.resetBBox(t).recordBBox(t,this.ctx,i[0]-a,i[2]+a,i[1]-a,i[3]+a).recordDependencies(t,["transform"])}s instanceof Path2D||(s=n[0]=LT(s)),yt.axialAlignedBoundingBox(i,Le(this.ctx),this.current.minMax),this[e](t,s),this._pathStartIdx=t}closePath(t){this.ctx.closePath()}stroke(t,e,n=!0){let i=this.ctx,s=this.current.strokeColor;if(i.globalAlpha=this.current.strokeAlpha,this.contentVisible)if(typeof s=="object"&&s?.getPattern){let a=s.isModifyingCurrentTransform()?i.getTransform():null;if(i.save(),i.strokeStyle=s.getPattern(i,this,hs(i),Gn.STROKE,t),a){let l=new Path2D;l.addPath(e,i.getTransform().invertSelf().multiplySelf(a)),e=l}this.rescaleAndStroke(e,!1),i.restore()}else this.rescaleAndStroke(e,!0);this.dependencyTracker?.recordDependencies(t,hr.stroke),n&&this.consumePath(t,e,this.current.getClippedPathBoundingBox(Gn.STROKE,Le(this.ctx))),i.globalAlpha=this.current.fillAlpha}closeStroke(t,e){this.stroke(t,e)}fill(t,e,n=!0){let i=this.ctx,s=this.current.fillColor,a=this.current.patternFill,l=!1;if(a){let u=s.isModifyingCurrentTransform()?i.getTransform():null;if(this.dependencyTracker?.save(t),i.save(),i.fillStyle=s.getPattern(i,this,hs(i),Gn.FILL,t),u){let h=new Path2D;h.addPath(e,i.getTransform().invertSelf().multiplySelf(u)),e=h}l=!0}let c=this.current.getClippedPathBoundingBox();this.contentVisible&&c!==null&&(this.pendingEOFill?(i.fill(e,"evenodd"),this.pendingEOFill=!1):i.fill(e)),this.dependencyTracker?.recordDependencies(t,hr.fill),l&&(i.restore(),this.dependencyTracker?.restore(t)),n&&this.consumePath(t,e,c)}eoFill(t,e){this.pendingEOFill=!0,this.fill(t,e)}fillStroke(t,e){this.fill(t,e,!1),this.stroke(t,e,!1),this.consumePath(t,e)}eoFillStroke(t,e){this.pendingEOFill=!0,this.fillStroke(t,e)}closeFillStroke(t,e){this.fillStroke(t,e)}closeEOFillStroke(t,e){this.pendingEOFill=!0,this.fillStroke(t,e)}endPath(t,e){this.consumePath(t,e)}rawFillPath(t,e){this.ctx.fill(e),this.dependencyTracker?.recordDependencies(t,hr.rawFillPath).recordOperation(t)}clip(t){this.dependencyTracker?.recordFutureForcedDependency("clipMode",t),this.pendingClip=VO}eoClip(t){this.dependencyTracker?.recordFutureForcedDependency("clipMode",t),this.pendingClip=CT}beginText(t){this.current.textMatrix=null,this.current.textMatrixScale=1,this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0,this.dependencyTracker?.recordOpenMarker(t).resetIncrementalData("sameLineText").resetIncrementalData("moveText",t)}endText(t){let e=this.pendingTextPaths,n=this.ctx;if(this.dependencyTracker){let{dependencyTracker:i}=this;e!==void 0&&i.recordFutureForcedDependency("textClip",i.getOpenMarker()).recordFutureForcedDependency("textClip",t),i.recordCloseMarker(t)}if(e!==void 0){let i=new Path2D,s=n.getTransform().invertSelf();for(let{transform:a,x:l,y:c,fontSize:u,path:h}of e)h&&i.addPath(h,new DOMMatrix(a).preMultiplySelf(s).translate(l,c).scale(u,-u));n.clip(i)}delete this.pendingTextPaths}setCharSpacing(t,e){this.dependencyTracker?.recordSimpleData("charSpacing",t),this.current.charSpacing=e}setWordSpacing(t,e){this.dependencyTracker?.recordSimpleData("wordSpacing",t),this.current.wordSpacing=e}setHScale(t,e){this.dependencyTracker?.recordSimpleData("hScale",t),this.current.textHScale=e/100}setLeading(t,e){this.dependencyTracker?.recordSimpleData("leading",t),this.current.leading=-e}setFont(t,e,n){this.dependencyTracker?.recordSimpleData("font",t).recordSimpleDataFromNamed("fontObj",e,t);let i=this.commonObjs.get(e),s=this.current;if(!i)throw new Error(`Can't find font for ${e}`);if(s.fontMatrix=i.fontMatrix||Bx,(s.fontMatrix[0]===0||s.fontMatrix[3]===0)&&jt("Invalid font matrix for font "+e),n<0?(n=-n,s.fontDirection=-1):s.fontDirection=1,this.current.font=i,this.current.fontSize=n,i.isType3Font)return;let a=i.loadedName||"sans-serif",l=i.systemFontInfo?.css||`"${a}", ${i.fallbackName}`,c="normal";i.black?c="900":i.bold&&(c="bold");let u=i.italic?"italic":"normal",h=n;n<yT?h=yT:n>bT&&(h=bT),this.current.fontSizeScale=n/h,this.ctx.font=`${u} ${c} ${h}px ${l}`}setTextRenderingMode(t,e){this.dependencyTracker?.recordSimpleData("textRenderingMode",t),this.current.textRenderingMode=e}setTextRise(t,e){this.dependencyTracker?.recordSimpleData("textRise",t),this.current.textRise=e}moveText(t,e,n){this.dependencyTracker?.resetIncrementalData("sameLineText").recordIncrementalData("moveText",t),this.current.x=this.current.lineX+=e,this.current.y=this.current.lineY+=n}setLeadingMoveText(t,e,n){this.setLeading(t,-n),this.moveText(t,e,n)}setTextMatrix(t,e){this.dependencyTracker?.resetIncrementalData("sameLineText").recordSimpleData("textMatrix",t);let{current:n}=this;n.textMatrix=e,n.textMatrixScale=Math.hypot(e[0],e[1]),n.x=n.lineX=0,n.y=n.lineY=0}nextLine(t){this.moveText(t,0,this.current.leading),this.dependencyTracker?.recordIncrementalData("moveText",this.dependencyTracker.getSimpleIndex("leading")??t)}paintChar(t,e,n,i,s,a){let l=this.ctx,c=this.current,u=c.font,h=c.textRenderingMode,d=c.fontSize/c.fontSizeScale,f=h&pn.FILL_STROKE_MASK,p=!!(h&pn.ADD_TO_PATH_FLAG),m=c.patternFill&&!u.missingFile,y=c.patternStroke&&!u.missingFile,x;if((u.disableFontFace||p||m||y)&&!u.missingFile&&(x=u.getPathGenerator(this.commonObjs,e)),x&&(u.disableFontFace||m||y)){l.save(),l.translate(n,i),l.scale(d,-d),this.dependencyTracker?.recordCharacterBBox(t,l,u);let b;if(f===pn.FILL||f===pn.FILL_STROKE)if(s){b=l.getTransform(),l.setTransform(...s);let w=v(this,Jr,$w).call(this,x,b,s);l.fill(w)}else l.fill(x);if(f===pn.STROKE||f===pn.FILL_STROKE)if(a){b||(b=l.getTransform()),l.setTransform(...a);let{a:w,b:C,c:E,d:S}=b,N=yt.inverseTransform(a),k=yt.transform([w,C,E,S,0,0],N);yt.singularValueDecompose2dScale(k,Zi),l.lineWidth*=Math.max(Zi[0],Zi[1])/d,l.stroke(v(this,Jr,$w).call(this,x,b,a))}else l.lineWidth/=d,l.stroke(x);l.restore()}else(f===pn.FILL||f===pn.FILL_STROKE)&&(l.fillText(e,n,i),this.dependencyTracker?.recordCharacterBBox(t,l,u,d,n,i,()=>l.measureText(e))),(f===pn.STROKE||f===pn.FILL_STROKE)&&(this.dependencyTracker&&this.dependencyTracker?.recordCharacterBBox(t,l,u,d,n,i,()=>l.measureText(e)).recordDependencies(t,hr.stroke),l.strokeText(e,n,i));p&&((this.pendingTextPaths||(this.pendingTextPaths=[])).push({transform:Le(l),x:n,y:i,fontSize:d,path:x}),this.dependencyTracker?.recordCharacterBBox(t,l,u,d,n,i))}get isFontSubpixelAAEnabled(){let t=this.canvasFactory.create(10,10),e=t.context;e.scale(1.5,1),e.fillText("I",0,10);let n=e.getImageData(0,0,10,10).data;this.canvasFactory.destroy(t);let i=!1;for(let s=3;s<n.length;s+=4)if(n[s]>0&&n[s]<255){i=!0;break}return Ut(this,"isFontSubpixelAAEnabled",i)}showText(t,e){this.dependencyTracker&&(this.dependencyTracker.recordDependencies(t,hr.showText).resetBBox(t),this.current.textRenderingMode&pn.ADD_TO_PATH_FLAG&&this.dependencyTracker.recordFutureForcedDependency("textClip",t).inheritPendingDependenciesAsFutureForcedDependencies());let n=this.current,i=n.font;if(i.isType3Font){this.showType3Text(t,e),this.dependencyTracker?.recordShowTextOperation(t);return}let s=n.fontSize;if(s===0){this.dependencyTracker?.recordOperation(t);return}let a=this.ctx,l=n.fontSizeScale,c=n.charSpacing,u=n.wordSpacing,h=n.fontDirection,d=n.textHScale*h,f=e.length,p=i.vertical,m=p?1:-1,y=i.defaultVMetrics,x=s*n.fontMatrix[0],b=n.textRenderingMode===pn.FILL&&!i.disableFontFace&&!n.patternFill;a.save(),n.textMatrix&&a.transform(...n.textMatrix),a.translate(n.x,n.y+n.textRise),h>0?a.scale(d,-1):a.scale(d,1);let w,C,E=n.textRenderingMode&pn.FILL_STROKE_MASK,S=E===pn.FILL||E===pn.FILL_STROKE,N=E===pn.STROKE||E===pn.FILL_STROKE;if(S&&n.patternFill){a.save();let $=n.fillColor.getPattern(a,this,hs(a),Gn.FILL,t);w=Le(a),a.restore(),a.fillStyle=$}if(N&&n.patternStroke){a.save();let $=n.strokeColor.getPattern(a,this,hs(a),Gn.STROKE,t);C=Le(a),a.restore(),a.strokeStyle=$}let k=n.lineWidth,M=n.textMatrixScale;if(M===0||k===0?N&&(k=this.getSinglePixelWidth()):k/=M,l!==1&&(a.scale(l,l),k/=l),a.lineWidth=k,i.isInvalidPDFjsFont){let $=[],q=0;for(let Z of e)$.push(Z.unicode),q+=Z.width;let Q=$.join("");if(a.fillText(Q,0,0),this.dependencyTracker!==null){let Z=a.measureText(Q);this.dependencyTracker.recordBBox(t,this.ctx,-Z.actualBoundingBoxLeft,Z.actualBoundingBoxRight,-Z.actualBoundingBoxAscent,Z.actualBoundingBoxDescent).recordShowTextOperation(t)}n.x+=q*x*d,a.restore(),this.compose();return}let R=0,j;for(j=0;j<f;++j){let $=e[j];if(typeof $=="number"){R+=m*$*s/1e3;continue}let q=!1,Q=($.isSpace?u:0)+c,Z=$.fontChar,Y=$.accent,X,T,I=$.width;if(p){let z=$.vmetric||y,D=-($.vmetric?z[1]:I*.5)*x,F=z[2]*x;I=z?-z[0]:I,X=D/l,T=(R+F)/l}else X=R/l,T=0;let _;if(i.remeasure&&I>0){_=a.measureText(Z);let z=_.width*1e3/s*l;if(I<z&&this.isFontSubpixelAAEnabled){let D=I/z;q=!0,a.save(),a.scale(D,1),X/=D}else I!==z&&(X+=(I-z)/2e3*s/l)}if(this.contentVisible&&($.isInFont||i.missingFile)){if(b&&!Y)a.fillText(Z,X,T),this.dependencyTracker?.recordCharacterBBox(t,a,_?{bbox:null}:i,s/l,X,T,()=>_??a.measureText(Z));else if(this.paintChar(t,Z,X,T,w,C),Y){let z=X+s*Y.offset.x/l,D=T-s*Y.offset.y/l;this.paintChar(t,Y.fontChar,z,D,w,C)}}let W=p?I*x-Q*h:I*x+Q*h;R+=W,q&&a.restore()}p?n.y-=R:n.x+=R*d,a.restore(),this.compose(),this.dependencyTracker?.recordShowTextOperation(t)}showType3Text(t,e){let n=this.ctx,i=this.current,s=i.font,a=i.fontSize,l=i.fontDirection,c=s.vertical?1:-1,u=i.charSpacing,h=i.wordSpacing,d=i.textHScale*l,f=i.fontMatrix||Bx,p=e.length,m=i.textRenderingMode===pn.INVISIBLE,y,x,b,w;if(m||a===0)return;this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null,n.save(),i.textMatrix&&n.transform(...i.textMatrix),n.translate(i.x,i.y+i.textRise),n.scale(d,l);let C=this.dependencyTracker;for(this.dependencyTracker=C?new fy(C,t):null,y=0;y<p;++y){if(x=e[y],typeof x=="number"){w=c*x*a/1e3,this.ctx.translate(w,0),i.x+=w*d;continue}let E=(x.isSpace?h:0)+u,S=s.charProcOperatorList[x.operatorListId];S?this.contentVisible&&(this.save(),n.scale(a,a),n.transform(...f),this.executeOperatorList(S),this.restore()):jt(`Type3 character "${x.operatorListId}" is not available.`);let N=[x.width,0];yt.applyTransform(N,f),b=N[0]*a+E,n.translate(b,0),i.x+=b*d}n.restore(),C&&(this.dependencyTracker=C)}setCharWidth(t,e,n){}setCharWidthAndBounds(t,e,n,i,s,a,l){let c=new Path2D;c.rect(i,s,a-i,l-s),this.ctx.clip(c),this.dependencyTracker?.recordBBox(t,this.ctx,i,a,s,l).recordClipBox(t,this.ctx,i,a,s,l),this.endPath(t)}getColorN_Pattern(t,e){let n;if(e[0]==="TilingPattern"){let i=this.baseTransform||Le(this.ctx),s={createCanvasGraphics:(a,l)=>new E2(a,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:this.optionalContentConfig,markedContentStack:this.markedContentStack},void 0,void 0,this.dependencyTracker?new fy(this.dependencyTracker,l,!0):null)};n=new Lw(e,this.ctx,s,i)}else n=this._getPattern(t,e[1],e[2]);return n}setStrokeColorN(t,...e){this.dependencyTracker?.recordSimpleData("strokeColor",t),this.current.strokeColor=this.getColorN_Pattern(t,e),this.current.patternStroke=!0}setFillColorN(t,...e){this.dependencyTracker?.recordSimpleData("fillColor",t),this.current.fillColor=this.getColorN_Pattern(t,e),this.current.patternFill=!0}setStrokeRGBColor(t,e){this.dependencyTracker?.recordSimpleData("strokeColor",t),this.ctx.strokeStyle=this.current.strokeColor=e,this.current.patternStroke=!1}setStrokeTransparent(t){this.dependencyTracker?.recordSimpleData("strokeColor",t),this.ctx.strokeStyle=this.current.strokeColor="transparent",this.current.patternStroke=!1}setFillRGBColor(t,e){this.dependencyTracker?.recordSimpleData("fillColor",t),this.ctx.fillStyle=this.current.fillColor=e,this.current.patternFill=!1}setFillTransparent(t){this.dependencyTracker?.recordSimpleData("fillColor",t),this.ctx.fillStyle=this.current.fillColor="transparent",this.current.patternFill=!1}_getPattern(t,e,n=null){let i;return this.cachedPatterns.has(e)?i=this.cachedPatterns.get(e):(i=zO(this.getObject(t,e)),this.cachedPatterns.set(e,i)),n&&(i.matrix=n),i}shadingFill(t,e){if(!this.contentVisible)return;let n=this.ctx;this.save(t);let i=this._getPattern(t,e);n.fillStyle=i.getPattern(n,this,hs(n),Gn.SHADING,t);let s=hs(n);if(s){let{width:a,height:l}=n.canvas,c=Ku.slice();yt.axialAlignedBoundingBox([0,0,a,l],s,c);let[u,h,d,f]=c;this.ctx.fillRect(u,h,d-u,f-h)}else this.ctx.fillRect(-1e10,-1e10,2e10,2e10);this.dependencyTracker?.resetBBox(t).recordFullPageBBox(t).recordDependencies(t,hr.transform).recordDependencies(t,hr.fill).recordOperation(t),this.compose(this.current.getClippedPathBoundingBox()),this.restore(t)}beginInlineImage(){ue("Should not call beginInlineImage")}beginImageData(){ue("Should not call beginImageData")}paintFormXObjectBegin(t,e,n){if(this.contentVisible&&(this.save(t),this.baseTransformStack.push(this.baseTransform),e&&this.transform(t,...e),this.baseTransform=Le(this.ctx),n)){yt.axialAlignedBoundingBox(n,this.baseTransform,this.current.minMax);let[i,s,a,l]=n,c=new Path2D;c.rect(i,s,a-i,l-s),this.ctx.clip(c),this.dependencyTracker?.recordClipBox(t,this.ctx,i,a,s,l),this.endPath(t)}}paintFormXObjectEnd(t){this.contentVisible&&(this.restore(t),this.baseTransform=this.baseTransformStack.pop())}beginGroup(t,e){if(!this.contentVisible)return;this.save(t),this.inSMaskMode&&(this.endSMaskMode(),this.current.activeSMask=null);let n=this.ctx;e.isolated||ob("TODO: Support non-isolated groups."),e.knockout&&jt("Knockout groups not supported.");let i=Le(n);e.matrix&&n.transform(...e.matrix);let s=[0,0,n.canvas.width,n.canvas.height],a;e.bbox?(a=Ku.slice(),yt.axialAlignedBoundingBox(e.bbox,Le(n),a),a=yt.intersect(a,s)||[0,0,0,0]):a=s;let l=Math.floor(a[0]),c=Math.floor(a[1]),u=Math.max(Math.ceil(a[2])-l,1),h=Math.max(Math.ceil(a[3])-c,1);this.current.startNewPathAndClipBox([0,0,u,h]),e.smask&&this.smaskCounter++;let d=this.canvasFactory.create(u,h);e.smask&&this.smaskGroupCanvases.push(d);let f=d.context;if(f.translate(-l,-c),f.transform(...i),e.bbox){let p=new Path2D,[m,y,x,b]=e.bbox;if(p.rect(m,y,x-m,b-y),e.matrix){let w=new Path2D;w.addPath(p,new DOMMatrix(e.matrix)),p=w}f.clip(p)}e.smask&&this.smaskStack.push({canvas:d.canvas,context:f,offsetX:l,offsetY:c,subtype:e.smask.subtype,backdrop:e.smask.backdrop,transferMap:e.smask.transferMap||null,startTransformInverse:null}),(!e.smask||this.dependencyTracker)&&(n.setTransform(1,0,0,1,0,0),n.translate(l,c),n.save()),vf(n,f),this.ctx=f,this.dependencyTracker?.inheritSimpleDataAsFutureForcedDependencies(["fillAlpha","strokeAlpha","globalCompositeOperation"]).pushBaseTransform(n),this.setGState(t,[["BM","source-over"],["ca",1],["CA",1],["TR",null]]),this.groupStack.push(n),this.groupLevel++}endGroup(t,e){if(!this.contentVisible)return;this.groupLevel--;let n=this.ctx,i=this.groupStack.pop();if(this.ctx=i,this.ctx.imageSmoothingEnabled=!1,this.dependencyTracker?.popBaseTransform(),e.smask)this.tempSMask=this.smaskStack.pop(),this.restore(t),this.dependencyTracker&&this.ctx.restore();else{this.ctx.restore();let s=Le(this.ctx);this.restore(t),this.ctx.save(),this.ctx.setTransform(...s);let a=Ku.slice();yt.axialAlignedBoundingBox([0,0,n.canvas.width,n.canvas.height],s,a),this.ctx.drawImage(n.canvas,0,0),this.ctx.restore(),this.canvasFactory.destroy({canvas:n.canvas,context:n}),this.compose(a)}}beginAnnotation(t,e,n,i,s,a){if(v(this,Jr,Bw).call(this),p0(this.ctx),this.ctx.save(),this.save(t),this.baseTransform&&this.ctx.setTransform(...this.baseTransform),n){let l=n[2]-n[0],c=n[3]-n[1];if(a&&this.annotationCanvasMap){i=i.slice(),i[4]-=n[0],i[5]-=n[1],n=n.slice(),n[0]=n[1]=0,n[2]=l,n[3]=c,yt.singularValueDecompose2dScale(Le(this.ctx),Zi);let{viewportScale:u}=this,h=Math.ceil(l*this.outputScaleX*u),d=Math.ceil(c*this.outputScaleY*u);this.annotationCanvas=this.canvasFactory.create(h,d);let{canvas:f,context:p}=this.annotationCanvas;this.annotationCanvasMap.set(e,f),this.annotationCanvas.savedCtx=this.ctx,this.ctx=p,this.ctx.save(),this.ctx.setTransform(Zi[0],0,0,-Zi[1],0,c*Zi[1]),p0(this.ctx)}else{p0(this.ctx),this.endPath(t);let u=new Path2D;u.rect(n[0],n[1],l,c),this.ctx.clip(u)}}this.current=new by(this.ctx.canvas.width,this.ctx.canvas.height),this.transform(t,...i),this.transform(t,...s)}endAnnotation(t){this.annotationCanvas&&(this.ctx.restore(),v(this,Jr,Uw).call(this),this.ctx=this.annotationCanvas.savedCtx,delete this.annotationCanvas.savedCtx,delete this.annotationCanvas)}paintImageMaskXObject(t,e){if(!this.contentVisible)return;let n=e.count;e=this.getObject(t,e.data,e),e.count=n;let i=this.ctx,s=this._createMaskCanvas(t,e),a=s.canvas;i.save(),i.setTransform(1,0,0,1,0,0),i.drawImage(a,s.offsetX,s.offsetY),this.dependencyTracker?.resetBBox(t).recordBBox(t,this.ctx,s.offsetX,s.offsetX+a.width,s.offsetY,s.offsetY+a.height).recordOperation(t),i.restore(),s.canvasEntry&&this.canvasFactory.destroy(s.canvasEntry),this.compose()}paintImageMaskXObjectRepeat(t,e,n,i=0,s=0,a,l){if(!this.contentVisible)return;e=this.getObject(t,e.data,e);let c=this.ctx;c.save();let u=Le(c);c.transform(n,i,s,a,0,0);let h=this._createMaskCanvas(t,e);c.setTransform(1,0,0,1,h.offsetX-u[4],h.offsetY-u[5]),this.dependencyTracker?.resetBBox(t);for(let d=0,f=l.length;d<f;d+=2){let p=yt.transform(u,[n,i,s,a,l[d],l[d+1]]);c.drawImage(h.canvas,p[4],p[5]),this.dependencyTracker?.recordBBox(t,this.ctx,p[4],p[4]+h.canvas.width,p[5],p[5]+h.canvas.height)}c.restore(),h.canvasEntry&&this.canvasFactory.destroy(h.canvasEntry),this.compose(),this.dependencyTracker?.recordOperation(t)}paintImageMaskXObjectGroup(t,e){if(!this.contentVisible)return;let n=this.ctx,i=this.current.fillColor,s=this.current.patternFill;this.dependencyTracker?.resetBBox(t).recordDependencies(t,hr.transformAndFill);for(let a of e){let{data:l,width:c,height:u,transform:h}=a,d=this.canvasFactory.create(c,u),f=d.context;f.save();let p=this.getObject(t,l,a);AT(f,p),f.globalCompositeOperation="source-in",f.fillStyle=s?i.getPattern(f,this,hs(n),Gn.FILL,t):i,f.fillRect(0,0,c,u),f.restore(),n.save(),n.transform(...h),n.scale(1,-1),f0(n,d.canvas,0,0,c,u,0,-1,1,1),this.canvasFactory.destroy(d),this.dependencyTracker?.recordBBox(t,n,0,c,0,u),n.restore()}this.compose(),this.dependencyTracker?.recordOperation(t)}paintImageXObject(t,e){if(!this.contentVisible)return;let n=this.getObject(t,e);if(!n){jt("Dependent image isn't ready yet");return}this.paintInlineImageXObject(t,n)}paintImageXObjectRepeat(t,e,n,i,s){if(!this.contentVisible)return;let a=this.getObject(t,e);if(!a){jt("Dependent image isn't ready yet");return}let l=a.width,c=a.height,u=[];for(let h=0,d=s.length;h<d;h+=2)u.push({transform:[n,0,0,i,s[h],s[h+1]],x:0,y:0,w:l,h:c});this.paintInlineImageXObjectGroup(t,a,u)}applyTransferMapsToCanvas(t){return this.current.transferMaps!=="none"&&(t.filter=this.current.transferMaps,t.drawImage(t.canvas,0,0),t.filter="none"),t.canvas}applyTransferMapsToBitmap(t){if(this.current.transferMaps==="none")return{img:t.bitmap,canvasEntry:null};let{bitmap:e,width:n,height:i}=t,s=this.canvasFactory.create(n,i),a=s.context;return a.filter=this.current.transferMaps,a.drawImage(e,0,0),a.filter="none",{img:s.canvas,canvasEntry:s}}paintInlineImageXObject(t,e){if(!this.contentVisible)return;let n=e.width,i=e.height,s=this.ctx;this.save(t);let{filter:a}=s;a!=="none"&&a!==""&&(s.filter="none"),s.scale(1/n,-1/i);let l,c=null;if(e.bitmap){let h=this.applyTransferMapsToBitmap(e);l=h.img,c=h.canvasEntry}else if(typeof HTMLElement=="function"&&e instanceof HTMLElement||!e.data)l=e;else{let h=this.canvasFactory.create(n,i);wT(h.context,e),l=this.applyTransferMapsToCanvas(h.context),c=h}let u=this._scaleImage(l,hs(s));s.imageSmoothingEnabled=vT(Le(s),e.interpolate),this.dependencyTracker&&(this.dependencyTracker.resetBBox(t).recordBBox(t,s,0,n,-i,0).recordDependencies(t,hr.imageXObject).recordOperation(t),this.imagesTracker?.record(s,n,i,this.dependencyTracker.clipBox)),f0(s,u.img,0,0,u.paintWidth,u.paintHeight,0,-i,n,i),u.tmpCanvas&&this.canvasFactory.destroy(u.tmpCanvas),c&&this.canvasFactory.destroy(c),this.compose(),this.restore(t)}paintInlineImageXObjectGroup(t,e,n){if(!this.contentVisible)return;let i=this.ctx,s,a=null;if(e.bitmap)s=e.bitmap;else{let l=e.width,c=e.height,u=this.canvasFactory.create(l,c);wT(u.context,e),s=this.applyTransferMapsToCanvas(u.context),a=u}this.dependencyTracker?.resetBBox(t);for(let l of n)i.save(),i.transform(...l.transform),i.scale(1,-1),f0(i,s,l.x,l.y,l.w,l.h,0,-1,1,1),this.dependencyTracker?.recordBBox(t,i,0,1,-1,0),i.restore();a&&this.canvasFactory.destroy(a),this.dependencyTracker?.recordOperation(t),this.compose()}paintSolidColorImageMask(t){this.contentVisible&&(this.dependencyTracker?.resetBBox(t).recordBBox(t,this.ctx,0,1,0,1).recordDependencies(t,hr.fill).recordOperation(t),this.ctx.fillRect(0,0,1,1),this.compose())}markPoint(t,e){}markPointProps(t,e,n){}beginMarkedContent(t,e){this.dependencyTracker?.beginMarkedContent(t),this.markedContentStack.push({visible:!0})}beginMarkedContentProps(t,e,n){this.dependencyTracker?.beginMarkedContent(t),e==="OC"?this.markedContentStack.push({visible:this.optionalContentConfig.isVisible(n)}):this.markedContentStack.push({visible:!0}),this.contentVisible=this.isContentVisible()}endMarkedContent(t){this.dependencyTracker?.endMarkedContent(t),this.markedContentStack.pop(),this.contentVisible=this.isContentVisible()}beginCompat(t){}endCompat(t){}consumePath(t,e,n){let i=this.current.isEmptyClip();this.pendingClip&&this.current.updateClipFromPath(),this.pendingClip||this.compose(n);let s=this.ctx;this.pendingClip?(i||(this.pendingClip===CT?s.clip(e,"evenodd"):s.clip(e)),this.pendingClip=null,this.dependencyTracker?.bboxToClipBoxDropOperation(t).recordFutureForcedDependency("clipPath",t)):this.dependencyTracker?.recordOperation(t),this.current.startNewPathAndClipBox(this.current.clipBox)}getSinglePixelWidth(){if(!this._cachedGetSinglePixelWidth){let t=Le(this.ctx);if(t[1]===0&&t[2]===0)this._cachedGetSinglePixelWidth=1/Math.min(Math.abs(t[0]),Math.abs(t[3]));else{let e=Math.abs(t[0]*t[3]-t[2]*t[1]),n=Math.hypot(t[0],t[2]),i=Math.hypot(t[1],t[3]);this._cachedGetSinglePixelWidth=Math.max(n,i)/e}}return this._cachedGetSinglePixelWidth}getScaleForStroking(){if(this._cachedScaleForStroking[0]===-1){let{lineWidth:t}=this.current,{a:e,b:n,c:i,d:s}=this.ctx.getTransform(),a,l;if(n===0&&i===0){let c=Math.abs(e),u=Math.abs(s);if(c===u)if(t===0)a=l=1/c;else{let h=c*t;a=l=h<1?1/h:1}else if(t===0)a=1/c,l=1/u;else{let h=c*t,d=u*t;a=h<1?1/h:1,l=d<1?1/d:1}}else{let c=Math.abs(e*s-n*i),u=Math.hypot(e,n),h=Math.hypot(i,s);if(t===0)a=h/c,l=u/c;else{let d=t*c;a=h>d?h/d:1,l=u>d?u/d:1}}this._cachedScaleForStroking[0]=a,this._cachedScaleForStroking[1]=l}return this._cachedScaleForStroking}rescaleAndStroke(t,e){let{ctx:n,current:{lineWidth:i}}=this,[s,a]=this.getScaleForStroking();if(s===a){n.lineWidth=(i||1)*s,n.stroke(t);return}let l=n.getLineDash();e&&n.save(),n.scale(s,a),Rx.a=1/s,Rx.d=1/a;let c=new Path2D;if(c.addPath(t,Rx),l.length>0){let u=Math.max(s,a);n.setLineDash(l.map(h=>h/u)),n.lineDashOffset/=u}n.lineWidth=i||1,n.stroke(c),e&&n.restore()}isContentVisible(){for(let t=this.markedContentStack.length-1;t>=0;t--)if(!this.markedContentStack[t].visible)return!1;return!0}};Jr=new WeakSet,Bw=function(){for(;this.stateStack.length||this.inSMaskMode;)this.restore();this.current.activeSMask=null,this.ctx.restore(),this.transparentCanvas&&(this.ctx=this.compositeCtx,this.ctx.save(),this.ctx.setTransform(1,0,0,1,0,0),this.ctx.drawImage(this.transparentCanvas,0,0),this.ctx.restore(),this.canvasFactory.destroy(this.transparentCanvasEntry),this.transparentCanvas=null,this.transparentCanvasEntry=null)},Uw=function(){if(this.pageColors){let t=this.filterFactory.addHCMFilter(this.pageColors.foreground,this.pageColors.background);if(t!=="none"){let e=this.ctx.filter;this.ctx.filter=t,this.ctx.drawImage(this.ctx.canvas,0,0),this.ctx.filter=e}}},$w=function(t,e,n){let i=new Path2D;return i.addPath(t,new DOMMatrix(n).invertSelf().multiplySelf(e)),i};Ju=E2;for(let r in Nd)Ju.prototype[r]!==void 0&&(Ju.prototype[Nd[r]]=Ju.prototype[r]);_d=class{constructor(t,e,n){A(this,Xp,null);A(this,Yp,null);U(this,"_fullReader",null);U(this,"_rangeReaders",new Set);U(this,"_source",null);this._source=t,g(this,Xp,e),g(this,Yp,n)}get _progressiveDataLength(){return this._fullReader?._loaded??0}getFullReader(){return Ue(!this._fullReader,"BasePDFStream.getFullReader can only be called once."),this._fullReader=new(o(this,Xp))(this)}getRangeReader(t,e){if(e<=this._progressiveDataLength)return null;let n=new(o(this,Yp))(this,t,e);return this._rangeReaders.add(n),n}cancelAllRequests(t){this._fullReader?.cancel(t);for(let e of new Set(this._rangeReaders))e.cancel(t)}};Xp=new WeakMap,Yp=new WeakMap;Md=class{constructor(t){U(this,"onProgress",null);U(this,"_contentLength",0);U(this,"_filename",null);U(this,"_headersCapability",Promise.withResolvers());U(this,"_isRangeSupported",!1);U(this,"_isStreamingSupported",!1);U(this,"_loaded",0);U(this,"_stream",null);this._stream=t}_callOnProgress(){this.onProgress?.({loaded:this._loaded,total:this._contentLength})}get headersReady(){return this._headersCapability.promise}get filename(){return this._filename}get contentLength(){return this._contentLength}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}async read(){ue("Abstract method `read` called")}cancel(t){ue("Abstract method `cancel` called")}},Od=class{constructor(t,e,n){U(this,"_stream",null);this._stream=t}async read(){ue("Abstract method `read` called")}cancel(t){ue("Abstract method `cancel` called")}};zw=class extends _d{constructor(e){super(e,jw,Gw);U(this,"_responseOrigin",null);let{httpHeaders:n,url:i}=e;Ue(/https?:/.test(i.protocol),"PDFFetchStream only supports http(s):// URLs."),this.headers=ES(!0,n)}},jw=class extends Md{constructor(e){super(e);U(this,"_abortController",new AbortController);U(this,"_reader",null);let{disableRange:n,disableStream:i,rangeChunkSize:s,url:a,withCredentials:l}=e._source;this._isStreamingSupported=!i;let c=new Headers(e.headers);NS(a,c,l,this._abortController).then(u=>{e._responseOrigin=fb(u.url),IS(u.status,a),this._reader=u.body.getReader();let h=u.headers,{contentLength:d,isRangeSupported:f}=TS({responseHeaders:h,isHttp:!0,rangeChunkSize:s,disableRange:n});this._contentLength=d,this._isRangeSupported=f,this._filename=SS(h),!this._isStreamingSupported&&this._isRangeSupported&&this.cancel(new Qr("Streaming is disabled.")),this._headersCapability.resolve()}).catch(this._headersCapability.reject)}async read(){await this._headersCapability.promise;let{value:e,done:n}=await this._reader.read();return n?{value:e,done:n}:(this._loaded+=e.byteLength,this._callOnProgress(),{value:mb(e),done:!1})}cancel(e){this._reader?.cancel(e),this._abortController.abort()}},Gw=class extends Od{constructor(e,n,i){super(e,n,i);U(this,"_abortController",new AbortController);U(this,"_readCapability",Promise.withResolvers());U(this,"_reader",null);let{url:s,withCredentials:a}=e._source,l=new Headers(e.headers);l.append("Range",`bytes=${n}-${i-1}`),NS(s,l,a,this._abortController).then(c=>{let u=fb(c.url);DS(u,e._responseOrigin),IS(c.status,s),this._reader=c.body.getReader(),this._readCapability.resolve()}).catch(this._readCapability.reject)}async read(){await this._readCapability.promise;let{value:e,done:n}=await this._reader.read();return n?{value:e,done:n}:{value:mb(e),done:!1}}cancel(e){this._reader?.cancel(e),this._abortController.abort()}};Hw=class extends _d{constructor(e){super(e,qw,Vw);A(this,Kp);U(this,"_progressiveDone",!1);U(this,"_queuedChunks",[]);let{pdfDataRangeTransport:n}=e,{initialData:i,progressiveDone:s}=n;if(i?.length>0){let a=ET(i);this._queuedChunks.push(a)}this._progressiveDone=s,n.addRangeListener((a,l)=>{v(this,Kp,Ww).call(this,a,l)}),n.addProgressiveReadListener(a=>{v(this,Kp,Ww).call(this,void 0,a)}),n.addProgressiveDoneListener(()=>{this._fullReader?.progressiveDone(),this._progressiveDone=!0}),n.transportReady()}getFullReader(){let e=super.getFullReader();return this._queuedChunks=null,e}getRangeReader(e,n){let i=super.getRangeReader(e,n);return i&&(i.onDone=()=>this._rangeReaders.delete(i),this._source.pdfDataRangeTransport.requestDataRange(e,n)),i}cancelAllRequests(e){super.cancelAllRequests(e),this._source.pdfDataRangeTransport.abort()}};Kp=new WeakSet,Ww=function(e,n){let i=ET(n);if(e===void 0)this._fullReader?this._fullReader._enqueue(i):this._queuedChunks.push(i);else{let s=this._rangeReaders.keys().find(a=>a._begin===e);Ue(s,"#onReceiveData - no `PDFDataTransportStreamRangeReader` instance found."),s._enqueue(i)}};qw=class extends Md{constructor(e){super(e);A(this,Zp,gb.bind(this));U(this,"_done",!1);U(this,"_queuedChunks",null);U(this,"_requests",[]);let{pdfDataRangeTransport:n,disableRange:i,disableStream:s}=e._source,{length:a,contentDispositionFilename:l}=n;this._queuedChunks=e._queuedChunks||[];for(let u of this._queuedChunks)this._loaded+=u.byteLength;this._done=e._progressiveDone,this._contentLength=a,this._isStreamingSupported=!s,this._isRangeSupported=!i,db(l)&&(this._filename=l),this._headersCapability.resolve();let c=this._loaded;Promise.resolve().then(()=>{c>0&&this._loaded===c&&this._callOnProgress()})}_enqueue(e){this._done||(this._requests.length>0?this._requests.shift().resolve({value:e,done:!1}):this._queuedChunks.push(e),this._loaded+=e.byteLength,this._callOnProgress())}async read(){if(this._queuedChunks.length>0)return{value:this._queuedChunks.shift(),done:!1};if(this._done)return{value:void 0,done:!0};let e=Promise.withResolvers();return this._requests.push(e),e.promise}cancel(e){this._done=!0,o(this,Zp).call(this)}progressiveDone(){this._done||(this._done=!0),this._queuedChunks.length===0&&o(this,Zp).call(this)}};Zp=new WeakMap;Vw=class extends Od{constructor(e,n,i){super(e,n,i);A(this,Qp,gb.bind(this));U(this,"onDone",null);U(this,"_begin",-1);U(this,"_done",!1);U(this,"_queuedChunk",null);U(this,"_requests",[]);this._begin=n}_enqueue(e){this._done||(this._requests.length===0?this._queuedChunk=e:(this._requests.shift().resolve({value:e,done:!1}),o(this,Qp).call(this)),this._done=!0,this.onDone?.())}async read(){if(this._queuedChunk){let n=this._queuedChunk;return this._queuedChunk=null,{value:n,done:!1}}if(this._done)return{value:void 0,done:!0};let e=Promise.withResolvers();return this._requests.push(e),e.promise}cancel(e){this._done=!0,o(this,Qp).call(this),this.onDone?.()}};Qp=new WeakMap;Lx=200,TT=206;Xw=class extends _d{constructor(e){super(e,Yw,Kw);A(this,Ld);A(this,Es,new WeakMap);U(this,"_responseOrigin",null);let{httpHeaders:n,url:i}=e;this.url=i,this.isHttp=/https?:/.test(i.protocol),this.headers=ES(this.isHttp,n)}_request(e){let n=new XMLHttpRequest,i={validateStatus:null,onHeadersReceived:e.onHeadersReceived,onDone:e.onDone,onError:e.onError,onProgress:e.onProgress};o(this,Es).set(n,i),n.open("GET",this.url),n.withCredentials=this._source.withCredentials;for(let[s,a]of this.headers)n.setRequestHeader(s,a);return this.isHttp&&"begin"in e&&"end"in e?(n.setRequestHeader("Range",`bytes=${e.begin}-${e.end-1}`),i.validateStatus=s=>s===TT||s===Lx):i.validateStatus=s=>s===Lx,n.responseType="arraybuffer",Ue(e.onError,"Expected `onError` callback to be provided."),n.onerror=()=>e.onError(n.status),n.onreadystatechange=v(this,Ld,_S).bind(this,n),n.onprogress=v(this,Ld,kS).bind(this,n),n.send(null),n}_abortRequest(e){o(this,Es).has(e)&&(o(this,Es).delete(e),e.abort())}getRangeReader(e,n){let i=super.getRangeReader(e,n);return i&&(i.onClosed=()=>this._rangeReaders.delete(i)),i}};Es=new WeakMap,Ld=new WeakSet,kS=function(e,n){o(this,Es).get(e)?.onProgress?.(n)},_S=function(e,n){let i=o(this,Es).get(e);if(!i||(e.readyState>=2&&i.onHeadersReceived&&(i.onHeadersReceived(),delete i.onHeadersReceived),e.readyState!==4)||!o(this,Es).has(e))return;if(o(this,Es).delete(e),e.status===0&&this.isHttp){i.onError(e.status);return}let s=e.status||Lx;if(!i.validateStatus(s)){i.onError(e.status);return}let a=YO(e.response);if(s===TT){let l=e.getResponseHeader("Content-Range");/bytes (\d+)-(\d+)\/(\d+)/.test(l)?i.onDone(a):(jt('Missing or invalid "Content-Range" header.'),i.onError(0))}else a?i.onDone(a):i.onError(e.status)};Yw=class extends Md{constructor(e){super(e);A(this,Bs);A(this,Jp,gb.bind(this));U(this,"_cachedChunks",[]);U(this,"_done",!1);U(this,"_requests",[]);U(this,"_storedError",null);this._fullRequestXhr=e._request({onHeadersReceived:v(this,Bs,MS).bind(this),onDone:v(this,Bs,OS).bind(this),onError:v(this,Bs,FS).bind(this),onProgress:v(this,Bs,PS).bind(this)})}async read(){if(await this._headersCapability.promise,this._storedError)throw this._storedError;if(this._cachedChunks.length>0)return{value:this._cachedChunks.shift(),done:!1};if(this._done)return{value:void 0,done:!0};let e=Promise.withResolvers();return this._requests.push(e),e.promise}cancel(e){this._done=!0,this._headersCapability.reject(e),o(this,Jp).call(this),this._stream._abortRequest(this._fullRequestXhr),this._fullRequestXhr=null}};Jp=new WeakMap,Bs=new WeakSet,MS=function(){let e=this._stream,{disableRange:n,rangeChunkSize:i}=e._source,s=this._fullRequestXhr;e._responseOrigin=fb(s.responseURL);let a=s.getAllResponseHeaders(),l=new Headers(a?a.trimStart().replace(/[^\S ]+$/,"").split(/[\r\n]+/).map(h=>{let[d,...f]=h.split(": ");return[d,f.join(": ")]}):[]),{contentLength:c,isRangeSupported:u}=TS({responseHeaders:l,isHttp:e.isHttp,rangeChunkSize:i,disableRange:n});this._contentLength=c,this._isRangeSupported=u,this._filename=SS(l),this._isRangeSupported&&e._abortRequest(s),this._headersCapability.resolve()},OS=function(e){this._requests.length>0?this._requests.shift().resolve({value:e,done:!1}):this._cachedChunks.push(e),this._done=!0,this._cachedChunks.length===0&&o(this,Jp).call(this)},FS=function(e){this._storedError=pb(e,this._stream.url),this._headersCapability.reject(this._storedError);for(let n of this._requests)n.reject(this._storedError);this._requests.length=0,this._cachedChunks.length=0},PS=function(e){this.onProgress?.({loaded:e.loaded,total:e.lengthComputable?e.total:this._contentLength})};Kw=class extends Od{constructor(e,n,i){super(e,n,i);A(this,Wa);A(this,tm,gb.bind(this));U(this,"onClosed",null);U(this,"_done",!1);U(this,"_queuedChunk",null);U(this,"_requests",[]);U(this,"_storedError",null);this._requestXhr=e._request({begin:n,end:i,onHeadersReceived:v(this,Wa,RS).bind(this),onDone:v(this,Wa,LS).bind(this),onError:v(this,Wa,Zw).bind(this),onProgress:null})}async read(){if(this._storedError)throw this._storedError;if(this._queuedChunk!==null){let n=this._queuedChunk;return this._queuedChunk=null,{value:n,done:!1}}if(this._done)return{value:void 0,done:!0};let e=Promise.withResolvers();return this._requests.push(e),e.promise}cancel(e){this._done=!0,o(this,tm).call(this),this._stream._abortRequest(this._requestXhr),this.onClosed?.()}};tm=new WeakMap,Wa=new WeakSet,RS=function(){let e=fb(this._requestXhr?.responseURL);try{DS(e,this._stream._responseOrigin)}catch(n){this._storedError=n,v(this,Wa,Zw).call(this,0)}},LS=function(e){this._requests.length>0?this._requests.shift().resolve({value:e,done:!1}):this._queuedChunk=e,this._done=!0,o(this,tm).call(this),this.onClosed?.()},Zw=function(e){this._storedError??(this._storedError=pb(e,this._stream.url));for(let n of this._requests)n.reject(this._storedError);this._requests.length=0,this._queuedChunk=null};Qw=class extends _d{constructor(t){super(t,Jw,tA);let{url:e}=t;Ue(e.protocol==="file:","PDFNodeStream only supports file:// URLs.")}},Jw=class extends Md{constructor(e){super(e);U(this,"_reader",null);let{disableRange:n,disableStream:i,rangeChunkSize:s,url:a}=e._source;this._isStreamingSupported=!i;let l=nt.default.getBuiltinModule("fs");l.promises.lstat(a).then(c=>{let u=l.createReadStream(a),h=BS(u);this._reader=h.getReader();let{size:d}=c;this._contentLength=d,this._isRangeSupported=!n&&d>2*s,!this._isStreamingSupported&&this._isRangeSupported&&this.cancel(new Qr("Streaming is disabled.")),this._headersCapability.resolve()}).catch(c=>{c.code==="ENOENT"&&(c=pb(0,a)),this._headersCapability.reject(c)})}async read(){await this._headersCapability.promise;let{value:e,done:n}=await this._reader.read();return n?{value:e,done:n}:(this._loaded+=e.byteLength,this._callOnProgress(),{value:mb(e),done:!1})}cancel(e){this._reader?.cancel(e)}},tA=class extends Od{constructor(e,n,i){super(e,n,i);U(this,"_readCapability",Promise.withResolvers());U(this,"_reader",null);let{url:s}=e._source,a=nt.default.getBuiltinModule("fs");try{let l=a.createReadStream(s,{start:n,end:i-1}),c=BS(l);this._reader=c.getReader(),this._readCapability.resolve()}catch(l){this._readCapability.reject(l)}}async read(){await this._readCapability.promise;let{value:e,done:n}=await this._reader.read();return n?{value:e,done:n}:{value:mb(e),done:!1}}cancel(e){this._reader?.cancel(e)}};Tr=class{static get workerPort(){return o(this,em)}static set workerPort(t){if(!(typeof Worker<"u"&&t instanceof Worker)&&t!==null)throw new Error("Invalid `workerPort` type.");g(this,em,t)}static get workerSrc(){return o(this,nm)}static set workerSrc(t){if(typeof t!="string")throw new Error("Invalid `workerSrc` type.");g(this,nm,t)}};em=new WeakMap,nm=new WeakMap,A(Tr,em,null),A(Tr,nm,"");eA=class{constructor({parsedData:t,rawData:e}){A(this,Ph);A(this,im);g(this,Ph,t),g(this,im,e)}getRaw(){return o(this,im)}get(t){return o(this,Ph).get(t)??null}[Symbol.iterator](){return o(this,Ph).entries()}};Ph=new WeakMap,im=new WeakMap;Hu=Symbol("INTERNAL"),nA=class{constructor(t,{name:e,intent:n,usage:i,rbGroups:s}){A(this,rm,!1);A(this,sm,!1);A(this,am,!1);A(this,Rh,!0);g(this,rm,!!(t&Yi.DISPLAY)),g(this,sm,!!(t&Yi.PRINT)),this.name=e,this.intent=n,this.usage=i,this.rbGroups=s}get visible(){if(o(this,am))return o(this,Rh);if(!o(this,Rh))return!1;let{print:t,view:e}=this.usage;return o(this,rm)?e?.viewState!=="OFF":o(this,sm)?t?.printState!=="OFF":!0}_setVisible(t,e,n=!1){t!==Hu&&ue("Internal method `_setVisible` called."),g(this,am,n),g(this,Rh,e)}};rm=new WeakMap,sm=new WeakMap,am=new WeakMap,Rh=new WeakMap;iA=class{constructor(t,e=Yi.DISPLAY){A(this,om);A(this,Mo,null);A(this,Ae,new Map);A(this,Lh,null);A(this,Bh,null);if(this.renderingIntent=e,this.name=null,this.creator=null,t!==null){this.name=t.name,this.creator=t.creator,g(this,Bh,t.order);for(let n of t.groups)o(this,Ae).set(n.id,new nA(e,n));if(t.baseState==="OFF")for(let n of o(this,Ae).values())n._setVisible(Hu,!1);for(let n of t.on)o(this,Ae).get(n)._setVisible(Hu,!0);for(let n of t.off)o(this,Ae).get(n)._setVisible(Hu,!1);g(this,Lh,this.getHash())}}isVisible(t){if(o(this,Ae).size===0)return!0;if(!t)return ob("Optional content group not defined."),!0;if(t.type==="OCG")return o(this,Ae).has(t.id)?o(this,Ae).get(t.id).visible:(jt(`Optional content group not found: ${t.id}`),!0);if(t.type==="OCMD"){if(t.expression)return v(this,om,rA).call(this,t.expression);if(!t.policy||t.policy==="AnyOn"){for(let e of t.ids){if(!o(this,Ae).has(e))return jt(`Optional content group not found: ${e}`),!0;if(o(this,Ae).get(e).visible)return!0}return!1}else if(t.policy==="AllOn"){for(let e of t.ids){if(!o(this,Ae).has(e))return jt(`Optional content group not found: ${e}`),!0;if(!o(this,Ae).get(e).visible)return!1}return!0}else if(t.policy==="AnyOff"){for(let e of t.ids){if(!o(this,Ae).has(e))return jt(`Optional content group not found: ${e}`),!0;if(!o(this,Ae).get(e).visible)return!0}return!1}else if(t.policy==="AllOff"){for(let e of t.ids){if(!o(this,Ae).has(e))return jt(`Optional content group not found: ${e}`),!0;if(o(this,Ae).get(e).visible)return!1}return!0}return jt(`Unknown optional content policy ${t.policy}.`),!0}return jt(`Unknown group type ${t.type}.`),!0}setVisibility(t,e=!0,n=!0){let i=o(this,Ae).get(t);if(!i){jt(`Optional content group not found: ${t}`);return}if(n&&e&&i.rbGroups.length)for(let s of i.rbGroups)for(let a of s)a!==t&&o(this,Ae).get(a)?._setVisible(Hu,!1,!0);i._setVisible(Hu,!!e,!0),g(this,Mo,null)}setOCGState({state:t,preserveRB:e}){let n;for(let i of t){switch(i){case"ON":case"OFF":case"Toggle":n=i;continue}let s=o(this,Ae).get(i);if(s)switch(n){case"ON":this.setVisibility(i,!0,e);break;case"OFF":this.setVisibility(i,!1,e);break;case"Toggle":this.setVisibility(i,!s.visible,e);break}}g(this,Mo,null)}get hasInitialVisibility(){return o(this,Lh)===null||this.getHash()===o(this,Lh)}getOrder(){return o(this,Ae).size?o(this,Bh)?o(this,Bh).slice():[...o(this,Ae).keys()]:null}getGroup(t){return o(this,Ae).get(t)||null}getHash(){if(o(this,Mo)!==null)return o(this,Mo);let t=new hy;for(let[e,n]of o(this,Ae))t.update(`${e}:${n.visible}`);return g(this,Mo,t.hexdigest())}[Symbol.iterator](){return o(this,Ae).entries()}};Mo=new WeakMap,Ae=new WeakMap,Lh=new WeakMap,Bh=new WeakMap,om=new WeakSet,rA=function(t){let e=t.length;if(e<2)return!0;let n=t[0];for(let i=1;i<e;i++){let s=t[i],a;if(Array.isArray(s))a=v(this,om,rA).call(this,s);else if(o(this,Ae).has(s))a=o(this,Ae).get(s).visible;else return jt(`Optional content group not found: ${s}`),!0;switch(n){case"And":if(!a)return!1;break;case"Or":if(a)return!0;break;case"Not":return!a;default:return!0}}return n==="And"};sA=class{constructor(){A(this,ei);A(this,rn,null);A(this,zr,null);A(this,$n,0);A(this,lc,null);A(this,Ts,null)}get pagesNumber(){return o(this,$n)}set pagesNumber(t){o(this,$n)!==t&&(g(this,$n,t),g(this,rn,null),g(this,zr,null))}movePages(t,e,n){v(this,ei,Rf).call(this);let i=o(this,rn),s=v(this,ei,Lf).call(this),a=e.length,l=new Uint32Array(a),c=0;for(let f=0;f<a;f++){let p=e[f]-1;l[f]=i[p],p<n&&c++}let u=o(this,$n),h=u-a,d=yn(n-c,0,h);for(let f=0,p=0;f<u;f++)t.has(f+1)||(i[p++]=i[f]);i.copyWithin(d+a,d,h),i.set(l,d),v(this,ei,F0).call(this,s),i.every((f,p)=>f===p+1)&&g(this,rn,null)}deletePages(t){v(this,ei,Rf).call(this);let e=o(this,rn),n=v(this,ei,Lf).call(this);g(this,Ts,{pageNumberToId:e.slice(),pagesNumber:o(this,$n),prevPageNumbers:o(this,zr).slice()});let i=o(this,$n)-t.length;g(this,$n,i);let s=g(this,rn,new Uint32Array(i));g(this,zr,new Int32Array(i));let a=0,l=0;for(let c of t){let u=c-1;u!==a&&(s.set(e.subarray(a,u),l),l+=u-a),a=u+1}a<e.length&&s.set(e.subarray(a),l),v(this,ei,F0).call(this,n,new Set(t))}cancelDelete(){o(this,Ts)&&(g(this,rn,o(this,Ts).pageNumberToId),g(this,$n,o(this,Ts).pagesNumber),g(this,zr,o(this,Ts).prevPageNumbers),g(this,Ts,null))}cleanSavedData(){g(this,Ts,null)}copyPages(t){v(this,ei,Rf).call(this),g(this,lc,{pageNumbers:t,pageIds:t.map(e=>o(this,rn)[e-1])})}cancelCopy(){g(this,lc,null)}pastePages(t){v(this,ei,Rf).call(this);let e=o(this,rn),n=v(this,ei,Lf).call(this),{pageNumbers:i,pageIds:s}=o(this,lc),a=o(this,$n)+i.length;g(this,$n,a);let l=g(this,rn,new Uint32Array(a));g(this,zr,new Int32Array(a)),l.set(e.subarray(0,t),0),l.set(s,t),l.set(e.subarray(t),t+i.length),v(this,ei,F0).call(this,n,null,t,i),g(this,lc,null)}hasBeenAltered(){return o(this,rn)!==null}getPageMappingForSaving(t=null){t??(t=v(this,ei,Lf).call(this));let e=0;for(let i of t.values())e=Math.max(e,i.length);let n=new Array(e);for(let i=0;i<e;i++)n[i]={document:null,pageIndices:[],includePages:[]};for(let[i,s]of t)for(let a=0,l=s.length;a<l;a++)n[a].includePages.push([i-1,s[a]-1]);for(let{includePages:i,pageIndices:s}of n){i.sort((a,l)=>a[0]-l[0]);for(let a=0,l=i.length;a<l;a++)s.push(i[a][1]),i[a]=i[a][0]}return n}extractPages(t){t=Array.from(t).sort((n,i)=>n-i);let e=new Map;for(let n=0,i=t.length;n<i;n++){let s=this.getPageId(t[n]);e.getOrInsertComputed(s,cb).push(n+1)}return this.getPageMappingForSaving(e)}getPrevPageNumber(t){return o(this,zr)?.[t-1]??0}getPageNumber(t){if(!o(this,rn))return t;let e=o(this,rn);for(let n=0,i=o(this,$n);n<i;n++)if(e[n]===t)return n+1;return 0}getPageId(t){return o(this,rn)?.[t-1]??t}getMapping(){return o(this,rn)?.subarray(0,this.pagesNumber)}};rn=new WeakMap,zr=new WeakMap,$n=new WeakMap,lc=new WeakMap,Ts=new WeakMap,ei=new WeakSet,Rf=function(){if(o(this,rn))return;let t=o(this,$n),e=g(this,rn,new Uint32Array(t));for(let n=0;n<t;n++)e[n]=n+1;g(this,zr,new Int32Array(e))},Lf=function(){let t=new Map,e=o(this,rn);for(let n=0,i=o(this,$n);n<i;n++){let s=e[n],a=t.get(s);a?a.push(n+1):t.set(s,[n+1])}return t},F0=function(t,e=null,n=-1,i=null){let s=o(this,zr),a=o(this,rn),l=n+(i?.length??0),c=new Map;for(let u=0,h=o(this,$n);u<h;u++){if(u>=n&&u<l){s[u]=-i[u-n];continue}let d=a[u],f=t.get(d),p=c.get(d)||0;if(e&&f)for(;p<f.length&&e.has(f[p]);)p++;s[u]=f?.[p],c.set(d,p+1)}};Wu=Symbol("INITIAL_DATA"),ST=()=>({...Promise.withResolvers(),data:Wu}),xy=class{constructor(){A(this,Ar,new Map)}get(t,e=null){if(e){let i=o(this,Ar).getOrInsertComputed(t,ST);return i.promise.then(()=>e(i.data)),null}let n=o(this,Ar).get(t);if(!n||n.data===Wu)throw new Error(`Requesting object that isn't resolved yet ${t}.`);return n.data}has(t){let e=o(this,Ar).get(t);return!!e&&e.data!==Wu}delete(t){let e=o(this,Ar).get(t);return!e||e.data===Wu?!1:(o(this,Ar).delete(t),!0)}resolve(t,e=null){let n=o(this,Ar).getOrInsertComputed(t,ST);if(n.data!==Wu)throw new Error(`Object already resolved ${t}.`);n.data=e,n.resolve()}clear(){for(let{data:t}of o(this,Ar).values())t?.bitmap?.close();o(this,Ar).clear()}*[Symbol.iterator](){for(let[t,{data:e}]of o(this,Ar))e!==Wu&&(yield[t,e])}};Ar=new WeakMap;ZO=1e5,DT=30,Rn=class Rn{constructor({textContentSource:t,images:e,container:n,viewport:i}){A(this,qa);A(this,Oo,Promise.withResolvers());A(this,ai,null);A(this,lm,!1);A(this,cm,!!globalThis.FontInspector?.enabled);A(this,Uh,null);A(this,cc,null);A(this,Aa,null);A(this,um,0);A(this,hm,0);A(this,uc,null);A(this,dm,null);A(this,$h,0);A(this,Fo,0);A(this,zh,Object.create(null));A(this,fm,[]);A(this,jh,null);A(this,hc,[]);A(this,pm,new WeakMap);A(this,mm,null);var u;if(t instanceof ReadableStream)g(this,jh,t);else if(typeof t=="object")g(this,jh,new ReadableStream({start(h){h.enqueue(t),h.close()}}));else throw new Error('No "textContentSource" parameter specified.');g(this,ai,g(this,dm,n)),g(this,Uh,e),g(this,Fo,i.scale*Ls.pixelRatio),g(this,$h,i.rotation),g(this,Aa,{div:null,properties:null,ctx:null});let{pageWidth:s,pageHeight:a,pageX:l,pageY:c}=i.rawDims;g(this,mm,[1,0,0,-1,-l,c+a]),g(this,hm,s),g(this,um,a),v(u=Rn,Ji,zS).call(u),n.style.setProperty("--min-font-size",o(Rn,Hh)),el(n,i),o(this,Oo).promise.finally(()=>{o(Rn,Wh).delete(this),g(this,Aa,null),g(this,zh,null)}).catch(()=>{})}static get fontFamilyMap(){let{isWindows:t,isFirefox:e}=Xe.platform;return Ut(this,"fontFamilyMap",new Map([["sans-serif",`${t&&e?"Calibri, ":""}sans-serif`],["monospace",`${t&&e?"Lucida Console, ":""}monospace`]]))}render(){o(this,Uh)&&o(this,ai).append(o(this,Uh).render());let t=()=>{o(this,uc).read().then(({value:e,done:n})=>{if(n){o(this,Oo).resolve();return}o(this,cc)??g(this,cc,e.lang),Object.assign(o(this,zh),e.styles),v(this,qa,US).call(this,e.items),t()},o(this,Oo).reject)};return g(this,uc,o(this,jh).getReader()),o(Rn,Wh).add(this),t(),o(this,Oo).promise}update({viewport:t,onBefore:e=null}){var s;let n=t.scale*Ls.pixelRatio,i=t.rotation;if(i!==o(this,$h)&&(e?.(),g(this,$h,i),el(o(this,dm),{rotation:i})),n!==o(this,Fo)){e?.(),g(this,Fo,n);let a={div:null,properties:null,ctx:v(s=Rn,Ji,P0).call(s,o(this,cc))};for(let l of o(this,hc))a.properties=o(this,pm).get(l),a.div=l,v(this,qa,aA).call(this,a)}}cancel(){let t=new Qr("TextLayer task cancelled.");o(this,uc)?.cancel(t).catch(()=>{}),g(this,uc,null),o(this,Oo).reject(t)}get textDivs(){return o(this,hc)}get textContentItemsStr(){return o(this,fm)}static cleanup(){if(!(o(this,Wh).size>0)){o(this,Gh).clear();for(let{canvas:t}of o(this,dc).values())t.remove();o(this,dc).clear()}}};Oo=new WeakMap,ai=new WeakMap,lm=new WeakMap,cm=new WeakMap,Uh=new WeakMap,cc=new WeakMap,Aa=new WeakMap,um=new WeakMap,hm=new WeakMap,uc=new WeakMap,dm=new WeakMap,$h=new WeakMap,Fo=new WeakMap,zh=new WeakMap,fm=new WeakMap,jh=new WeakMap,hc=new WeakMap,pm=new WeakMap,mm=new WeakMap,Gh=new WeakMap,dc=new WeakMap,gm=new WeakMap,Hh=new WeakMap,Wh=new WeakMap,qa=new WeakSet,US=function(t){var i,s;if(o(this,lm))return;(s=o(this,Aa)).ctx??(s.ctx=v(i=Rn,Ji,P0).call(i,o(this,cc)));let e=o(this,hc),n=o(this,fm);for(let a of t){if(e.length>ZO){jt("Ignoring additional textDivs for performance reasons."),g(this,lm,!0);return}if(a.str===void 0){if(a.type==="beginMarkedContentProps"||a.type==="beginMarkedContent"){let l=o(this,ai);g(this,ai,document.createElement("span")),o(this,ai).classList.add("markedContent"),a.id&&o(this,ai).setAttribute("id",`${a.id}`),a.tag==="Artifact"&&(o(this,ai).ariaHidden=!0),l.append(o(this,ai))}else a.type==="endMarkedContent"&&g(this,ai,o(this,ai).parentNode);continue}n.push(a.str),v(this,qa,$S).call(this,a)}},$S=function(t){var m;let e=document.createElement("span"),n={angle:0,canvasWidth:0,hasText:t.str!=="",hasEOL:t.hasEOL,fontSize:0};o(this,hc).push(e);let i=yt.transform(o(this,mm),t.transform),s=Math.atan2(i[1],i[0]),a=o(this,zh)[t.fontName];a.vertical&&(s+=Math.PI/2);let l=o(this,cm)&&a.fontSubstitution||a.fontFamily;l=Rn.fontFamilyMap.get(l)||l;let c=Math.hypot(i[2],i[3]),u=c*v(m=Rn,Ji,jS).call(m,l,a,o(this,cc)),h,d;s===0?(h=i[4],d=i[5]-u):(h=i[4]+u*Math.sin(s),d=i[5]-u*Math.cos(s));let f=e.style;f.left=`${(100*h/o(this,hm)).toFixed(2)}%`,f.top=`${(100*d/o(this,um)).toFixed(2)}%`,f.setProperty("--font-height",`${c.toFixed(2)}px`),f.fontFamily=l,n.fontSize=c,e.setAttribute("role","presentation"),e.textContent=t.str,e.dir=t.dir,o(this,cm)&&(e.dataset.fontName=a.fontSubstitutionLoadedName||t.fontName),s!==0&&(n.angle=s*(180/Math.PI));let p=!1;if(t.str.length>1)p=!0;else if(t.str!==" "&&t.transform[0]!==t.transform[3]){let y=Math.abs(t.transform[0]),x=Math.abs(t.transform[3]);y!==x&&Math.max(y,x)/Math.min(y,x)>1.5&&(p=!0)}if(p&&(n.canvasWidth=a.vertical?t.height:t.width),o(this,pm).set(e,n),o(this,Aa).div=e,o(this,Aa).properties=n,v(this,qa,aA).call(this,o(this,Aa)),n.hasText&&o(this,ai).append(e),n.hasEOL){let y=document.createElement("br");y.setAttribute("role","presentation"),o(this,ai).append(y)}},aA=function(t){var a;let{div:e,properties:n,ctx:i}=t,{style:s}=e;if(n.canvasWidth!==0&&n.hasText){let{fontFamily:l}=s,{canvasWidth:c,fontSize:u}=n;v(a=Rn,Ji,oA).call(a,i,u*o(this,Fo),l);let{width:h}=i.measureText(e.textContent);h>0&&s.setProperty("--scale-x",c*o(this,Fo)/h)}n.angle!==0&&s.setProperty("--rotate",`${n.angle}deg`)},Ji=new WeakSet,P0=function(t=null){let e=o(this,dc).get(t||(t=""));if(!e){let n=document.createElement("canvas");n.className="hiddenCanvasElement",n.lang=t,document.body.append(n),e=n.getContext("2d",{alpha:!1,willReadFrequently:!0}),o(this,dc).set(t,e),o(this,gm).set(e,{size:0,family:""})}return e},oA=function(t,e,n){let i=o(this,gm).get(t);e===i.size&&n===i.family||(t.font=`${e}px ${n}`,i.size=e,i.family=n)},zS=function(){if(o(this,Hh)!==null)return;let t=document.createElement("div");t.style.opacity=0,t.style.lineHeight=1,t.style.fontSize="1px",t.style.position="absolute",t.textContent="X",document.body.append(t),g(this,Hh,t.getBoundingClientRect().height),t.remove()},jS=function(t,e,n){let i=o(this,Gh).get(t);if(i)return i;let s=v(this,Ji,P0).call(this,n);s.canvas.width=s.canvas.height=DT,v(this,Ji,oA).call(this,s,DT,t);let a=s.measureText(""),l=a.fontBoundingBoxAscent,c=Math.abs(a.fontBoundingBoxDescent);s.canvas.width=s.canvas.height=0;let u=.8;return l?u=l/(l+c):(Xe.platform.isFirefox&&jt("Enable the `dom.textMetrics.fontBoundingBox.enabled` preference in `about:config` to improve TextLayer rendering."),e.ascent?u=e.ascent:e.descent&&(u=1+e.descent)),o(this,Gh).set(t,u),u},A(Rn,Ji),A(Rn,Gh,new Map),A(Rn,dc,new Map),A(Rn,gm,new WeakMap),A(Rn,Hh,null),A(Rn,Wh,new Set);Fd=Rn,QO=100;Ky=class Ky{constructor(){U(this,"_capability",Promise.withResolvers());U(this,"_transport",null);U(this,"_worker",null);U(this,"docId",`d${an(Ky,Yy)._++}`);U(this,"destroyed",!1);U(this,"onPassword",null);U(this,"onProgress",null)}get promise(){return this._capability.promise}async destroy(){this.destroyed=!0;try{this._worker?.port&&(this._worker._pendingDestroy=!0),await this._transport?.destroy()}catch(t){throw this._worker?.port&&delete this._worker._pendingDestroy,t}this._transport=null,this._worker?.destroy(),this._worker=null}async getData(){return this._transport.getData()}};Yy=new WeakMap,A(Ky,Yy,0);lA=Ky,op=class{constructor(t,e,n=!1,i=null){A(this,qh,Promise.withResolvers());A(this,ym,[]);A(this,bm,[]);A(this,xm,[]);this.length=t,this.initialData=e,this.progressiveDone=n,this.contentDispositionFilename=i,Object.defineProperty(this,"onDataProgress",{value:()=>{kO("`PDFDataRangeTransport.prototype.onDataProgress` - method was removed, since loading progress is now reported automatically through the `PDFDataTransportStream` class (and related code).")}})}addRangeListener(t){o(this,xm).push(t)}addProgressiveReadListener(t){o(this,bm).push(t)}addProgressiveDoneListener(t){o(this,ym).push(t)}onDataRange(t,e){for(let n of o(this,xm))n(t,e)}onDataProgressiveRead(t){o(this,qh).promise.then(()=>{for(let e of o(this,bm))e(t)})}onDataProgressiveDone(){o(this,qh).promise.then(()=>{for(let t of o(this,ym))t()})}transportReady(){o(this,qh).resolve()}requestDataRange(t,e){ue("Abstract method PDFDataRangeTransport.requestDataRange")}abort(){}};qh=new WeakMap,ym=new WeakMap,bm=new WeakMap,xm=new WeakMap;cA=class{constructor(t,e){this._pdfInfo=t,this._transport=e}get pagesMapper(){return this._transport.pagesMapper}get annotationStorage(){return this._transport.annotationStorage}get canvasFactory(){return this._transport.canvasFactory}get filterFactory(){return this._transport.filterFactory}get numPages(){return this._pdfInfo.numPages}get fingerprints(){return this._pdfInfo.fingerprints}get isPureXfa(){return Ut(this,"isPureXfa",!!this._transport._htmlForXfa)}get allXfaHtml(){return this._transport._htmlForXfa}getPage(t){return this._transport.getPage(t)}getPageIndex(t){return this._transport.getPageIndex(t)}getDestinations(){return this._transport.getDestinations()}getDestination(t){return this._transport.getDestination(t)}getPageLabels(){return this._transport.getPageLabels()}getPageLayout(){return this._transport.getPageLayout()}getPageMode(){return this._transport.getPageMode()}getViewerPreferences(){return this._transport.getViewerPreferences()}getOpenAction(){return this._transport.getOpenAction()}getAttachments(){return this._transport.getAttachments()}getAnnotationsByType(t,e){return this._transport.getAnnotationsByType(t,e)}getJSActions(){return this._transport.getDocJSActions()}getOutline(){return this._transport.getOutline()}getOptionalContentConfig({intent:t="display"}={}){let{renderingIntent:e}=this._transport.getRenderingIntent(t);return this._transport.getOptionalContentConfig(e)}getPermissions(){return this._transport.getPermissions()}getMetadata(){return this._transport.getMetadata()}getMarkInfo(){return this._transport.getMarkInfo()}getData(){return this._transport.getData()}saveDocument(){return this._transport.saveDocument()}extractPages(t){return this._transport.extractPages(t)}getDownloadInfo(){return this._transport.downloadInfoCapability.promise}getRawData(t){return this._transport.getRawData(t)}cleanup(t=!1){return this._transport.startCleanup(t||this.isPureXfa)}destroy(){return this.loadingTask.destroy()}cachedPageNumber(t){return this._transport.cachedPageNumber(t)}get loadingParams(){return this._transport.loadingParams}get loadingTask(){return this._transport.loadingTask}getFieldObjects(){return this._transport.getFieldObjects()}hasJSActions(){return this._transport.hasJSActions()}getCalculationOrderIds(){return this._transport.getCalculationOrderIds()}},T2=class T2{constructor(t,e,n,i,s=!1){A(this,pc);A(this,va,!1);A(this,fc,null);this._pageIndex=t,this._pageInfo=e,this._transport=n,this._stats=s?new oy:null,this._pdfBug=s,this.commonObjs=n.commonObjs,this.objs=new xy,this._intentStates=new Map,this.destroyed=!1,this.recordedBBoxes=null,g(this,fc,i),this.imageCoordinates=null}clone(t){let e=new T2(t,this._pageInfo,this._transport,o(this,fc),this._pdfBug);return e.clonedFromIndex=this.clonedFromIndex??this._pageIndex,this._transport.updatePage(e),e}get pageNumber(){return this._pageIndex+1}set pageNumber(t){this._pageIndex=t-1,this._transport.updatePage(this)}get rotate(){return this._pageInfo.rotate}get ref(){return this._pageInfo.ref}get userUnit(){return this._pageInfo.userUnit}get view(){return this._pageInfo.view}getViewport({scale:t,rotation:e=this.rotate,offsetX:n=0,offsetY:i=0,dontFlip:s=!1}={}){return new np({viewBox:this.view,userUnit:this.userUnit,scale:t,rotation:e,offsetX:n,offsetY:i,dontFlip:s})}getAnnotations({intent:t="display"}={}){let{renderingIntent:e}=this._transport.getRenderingIntent(t);return this._transport.getAnnotations(this._pageIndex,e)}getJSActions(){return this._transport.getPageJSActions(this._pageIndex)}get filterFactory(){return this._transport.filterFactory}get isPureXfa(){return Ut(this,"isPureXfa",!!this._transport._htmlForXfa)}async getXfa(){return this._transport._htmlForXfa?.children[this._pageIndex]||null}render({canvasContext:t,canvas:e=t.canvas,viewport:n,intent:i="display",annotationMode:s=Ba.ENABLE,transform:a=null,background:l=null,optionalContentConfigPromise:c=null,annotationCanvasMap:u=null,pageColors:h=null,printAnnotationStorage:d=null,isEditing:f=!1,recordImages:p=!1,recordOperations:m=!1,operationsFilter:y=null}){this._stats?.time("Overall");let x=this._transport.getRenderingIntent(i,s,d,f),{renderingIntent:b,cacheKey:w}=x;g(this,va,!1),c||(c=this._transport.getOptionalContentConfig(b));let C=this._intentStates.getOrInsertComputed(w,ay);C.streamReaderCancelTimeout&&(clearTimeout(C.streamReaderCancelTimeout),C.streamReaderCancelTimeout=null);let E=!!(b&Yi.PRINT);C.displayReadyCapability||(C.displayReadyCapability=Promise.withResolvers(),C.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},this._stats?.time("Page Request"),this._pumpOperatorList(x));let S=!!(this._pdfBug&&globalThis.StepperManager?.enabled),N=!!e&&!this.recordedBBoxes&&(m||S),k=!!e&&!this.imageCoordinates&&p,M=Q=>{if(C.renderTasks.delete($),N){let Z=$.gfx?.dependencyTracker.take();Z&&($.stepper?.setOperatorBBoxes(Z,$.gfx.dependencyTracker.takeDebugMetadata()),m&&(this.recordedBBoxes=Z))}k&&!Q&&(this.imageCoordinates=$.gfx?.imagesTracker.take()),E&&g(this,va,!0),v(this,pc,Bf).call(this),Q?($.capability.reject(Q),this._abortOperatorList({intentState:C,reason:Q instanceof Error?Q:new Error(Q)})):$.capability.resolve(),this._stats&&(this._stats.timeEnd("Rendering"),this._stats.timeEnd("Overall"),globalThis.Stats?.enabled&&globalThis.Stats.add(this.pageNumber,this._stats))},R=null,j=null;(N||k)&&(j=new dw(e,C.operatorList.length)),N&&(R=new pw(j,S));let $=new fA({callback:M,params:{canvas:e,canvasContext:t,dependencyTracker:R??j,imagesTracker:k?new mw(e):null,viewport:n,transform:a,background:l},objs:this.objs,commonObjs:this.commonObjs,annotationCanvasMap:u,operatorList:C.operatorList,pageIndex:this._pageIndex,canvasFactory:this._transport.canvasFactory,filterFactory:this._transport.filterFactory,useRequestAnimationFrame:!E,pdfBug:this._pdfBug,pageColors:h,enableHWA:this._transport.enableHWA,operationsFilter:y});(C.renderTasks||(C.renderTasks=new Set)).add($);let q=$.task;return Promise.all([C.displayReadyCapability.promise,c]).then(([Q,Z])=>{if(this.destroyed){M();return}if(this._stats?.time("Rendering"),!(Z.renderingIntent&b))throw new Error("Must use the same `intent`-argument when calling the `PDFPageProxy.render` and `PDFDocumentProxy.getOptionalContentConfig` methods.");$.initializeGraphics({transparency:Q,optionalContentConfig:Z}),$.operatorListChanged()}).catch(M),q}getOperatorList({intent:t="display",annotationMode:e=Ba.ENABLE,printAnnotationStorage:n=null,isEditing:i=!1}={}){function s(){l.operatorList.lastChunk&&(l.opListReadCapability.resolve(l.operatorList),l.renderTasks.delete(c))}let a=this._transport.getRenderingIntent(t,e,n,i,!0),l=this._intentStates.getOrInsertComputed(a.cacheKey,ay),c;return l.opListReadCapability||(c=Object.create(null),c.operatorListChanged=s,l.opListReadCapability=Promise.withResolvers(),(l.renderTasks||(l.renderTasks=new Set)).add(c),l.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},this._stats?.time("Page Request"),this._pumpOperatorList(a)),l.opListReadCapability.promise}streamTextContent({includeMarkedContent:t=!1,disableNormalization:e=!1}={}){return this._transport.messageHandler.sendWithStream("GetTextContent",{pageId:o(this,fc).getPageId(this._pageIndex+1)-1,pageIndex:this._pageIndex,includeMarkedContent:t===!0,disableNormalization:e===!0},{highWaterMark:100,size(i){return i.items.length}})}async getTextContent(t={}){if(this._transport._htmlForXfa)return this.getXfa().then(i=>tp.textContent(i));let e=this.streamTextContent(t),n={items:[],styles:Object.create(null),lang:null};for await(let i of e)n.lang??(n.lang=i.lang),Object.assign(n.styles,i.styles),n.items.push(...i.items);return n}getStructTree(){return this._transport.getStructTree(this._pageIndex)}_destroy(){this.destroyed=!0;let t=[];for(let e of this._intentStates.values())if(this._abortOperatorList({intentState:e,reason:new Error("Page was destroyed."),force:!0}),!e.opListReadCapability)for(let n of e.renderTasks)t.push(n.completed),n.cancel();return this.objs.clear(),g(this,va,!1),Promise.all(t)}cleanup(t=!1){g(this,va,!0);let e=v(this,pc,Bf).call(this);return t&&e&&this._stats&&(this._stats=new oy),e}_startRenderPage(t,e){let n=this._intentStates.get(e);n&&(this._stats?.timeEnd("Page Request"),n.displayReadyCapability?.resolve(t))}_renderPageChunk(t,e){for(let n=0,i=t.length;n<i;n++)e.operatorList.fnArray.push(t.fnArray[n]),e.operatorList.argsArray.push(t.argsArray[n]);e.operatorList.lastChunk=t.lastChunk,e.operatorList.separateAnnots=t.separateAnnots;for(let n of e.renderTasks)n.operatorListChanged();t.lastChunk&&v(this,pc,Bf).call(this)}_pumpOperatorList({renderingIntent:t,cacheKey:e,annotationStorageSerializable:n,modifiedIds:i}){let{map:s,transfer:a}=n,c=this._transport.messageHandler.sendWithStream("GetOperatorList",{pageId:o(this,fc).getPageId(this._pageIndex+1)-1,pageIndex:this._pageIndex,intent:t,cacheKey:e,annotationStorage:s,modifiedIds:i},void 0,a).getReader(),u=this._intentStates.get(e);u.streamReader=c;let h=()=>{c.read().then(({value:d,done:f})=>{if(f){u.streamReader=null;return}this._transport.destroyed||(this._renderPageChunk(d,u),h())},d=>{if(u.streamReader=null,!this._transport.destroyed){if(u.operatorList){u.operatorList.lastChunk=!0;for(let f of u.renderTasks)f.operatorListChanged();v(this,pc,Bf).call(this)}if(u.displayReadyCapability)u.displayReadyCapability.reject(d);else if(u.opListReadCapability)u.opListReadCapability.reject(d);else throw d}})};h()}_abortOperatorList({intentState:t,reason:e,force:n=!1}){if(t.streamReader){if(t.streamReaderCancelTimeout&&(clearTimeout(t.streamReaderCancelTimeout),t.streamReaderCancelTimeout=null),!n){if(t.renderTasks.size>0)return;if(e instanceof kd){let i=QO;e.extraDelay>0&&e.extraDelay<1e3&&(i+=e.extraDelay),t.streamReaderCancelTimeout=setTimeout(()=>{t.streamReaderCancelTimeout=null,this._abortOperatorList({intentState:t,reason:e,force:!0})},i);return}}if(t.streamReader.cancel(new Qr(e.message)).catch(()=>{}),t.streamReader=null,!this._transport.destroyed){for(let[i,s]of this._intentStates)if(s===t){this._intentStates.delete(i);break}this.cleanup()}}}get stats(){return this._stats}};va=new WeakMap,fc=new WeakMap,pc=new WeakSet,Bf=function(){if(!o(this,va)||this.destroyed)return!1;for(let{renderTasks:t,operatorList:e}of this._intentStates.values())if(t.size>0||!e.lastChunk)return!1;return this._intentStates.clear(),this.objs.clear(),g(this,va,!1),!0};uA=T2,Ge=class Ge{constructor({name:t=null,port:e=null,verbosity:n=vO()}={}){A(this,ui);A(this,Po,Promise.withResolvers());A(this,jr,null);A(this,Ca,null);A(this,mc,null);if(this.name=t,this.destroyed=!1,this.verbosity=n,e){if(o(Ge,yc).has(e))throw new Error("Cannot use more than one PDFWorker per port.");o(Ge,yc).set(e,this),v(this,ui,HS).call(this,e)}else v(this,ui,WS).call(this)}get promise(){return o(this,Po).promise}get port(){return o(this,Ca)}get messageHandler(){return o(this,jr)}destroy(){this.destroyed=!0,o(this,mc)?.terminate(),g(this,mc,null),o(Ge,yc).delete(o(this,Ca)),g(this,Ca,null),o(this,jr)?.destroy(),g(this,jr,null)}static create(t){let e=o(this,yc).get(t?.port);if(e){if(e._pendingDestroy)throw new Error("PDFWorker.create - the worker is being destroyed.\nPlease remember to await `PDFDocumentLoadingTask.destroy()`-calls.");return e}return new Ge(t)}static get workerSrc(){if(Tr.workerSrc)return Tr.workerSrc;throw new Error('No "GlobalWorkerOptions.workerSrc" specified.')}static get _setupFakeWorkerGlobal(){return Ut(this,"_setupFakeWorkerGlobal",(async()=>o(this,Vh,L0)?o(this,Vh,L0):(await import(/* @vite-ignore */ /* webpackIgnore: true */ this.workerSrc)).WorkerMessageHandler)())}};Po=new WeakMap,jr=new WeakMap,Ca=new WeakMap,mc=new WeakMap,Zy=new WeakMap,gc=new WeakMap,yc=new WeakMap,ui=new WeakSet,R0=function(){o(this,Po).resolve(),o(this,jr).send("configure",{verbosity:this.verbosity})},HS=function(t){g(this,Ca,t),g(this,jr,new Nl("main","worker",t)),o(this,jr).on("ready",()=>{}),v(this,ui,R0).call(this)},WS=function(){if(o(Ge,gc)||o(Ge,Vh,L0)){v(this,ui,Uf).call(this);return}let{workerSrc:t}=Ge;try{Ge._isSameOrigin(window.location,t)||(t=Ge._createCDNWrapper(new URL(t,window.location).href));let e=new Worker(t,{type:"module"}),n=new Nl("main","worker",e),i=()=>{s.abort(),n.destroy(),e.terminate(),this.destroyed?o(this,Po).reject(new Error("Worker was destroyed")):v(this,ui,Uf).call(this)},s=new AbortController;e.addEventListener("error",()=>{o(this,mc)||i()},{signal:s.signal}),n.on("test",l=>{if(s.abort(),this.destroyed||!l){i();return}g(this,jr,n),g(this,Ca,e),g(this,mc,e),v(this,ui,R0).call(this)}),n.on("ready",l=>{if(s.abort(),this.destroyed){i();return}try{a()}catch{v(this,ui,Uf).call(this)}});let a=()=>{let l=new Uint8Array;n.send("test",l,[l.buffer])};a();return}catch{ob("The worker has been disabled.")}v(this,ui,Uf).call(this)},Uf=function(){o(Ge,gc)||(jt("Setting up fake worker."),g(Ge,gc,!0)),Ge._setupFakeWorkerGlobal.then(t=>{if(this.destroyed){o(this,Po).reject(new Error("Worker was destroyed"));return}let e=new Tw;g(this,Ca,e);let n=`fake${an(Ge,Zy)._++}`,i=new Nl(n+"_worker",n,e);t.setup(i,e),g(this,jr,new Nl(n,n+"_worker",e)),v(this,ui,R0).call(this)}).catch(t=>{o(this,Po).reject(new Error(`Setting up fake worker failed: "${t.message}".`))})},Vh=new WeakSet,L0=function(){try{return globalThis.pdfjsWorker?.WorkerMessageHandler||null}catch{return null}},A(Ge,Vh),A(Ge,Zy,0),A(Ge,gc,!1),A(Ge,yc,new WeakMap),Ki&&(g(Ge,gc,!0),Tr.workerSrc||(Tr.workerSrc="./pdf.worker.mjs")),Ge._isSameOrigin=(t,e)=>{let n=URL.parse(t);if(!n?.origin||n.origin==="null")return!1;let i=new URL(e,n);return n.origin===i.origin},Ge._createCDNWrapper=t=>{let e=`await import("${t}");`;return URL.createObjectURL(new Blob([e],{type:"text/javascript"}))};Pd=Ge,hA=class{constructor(t,e,n,i,s,a){A(this,Zr);U(this,"downloadInfoCapability",Promise.withResolvers());A(this,Pi,null);A(this,bc,new Map);A(this,Ea,null);A(this,Gr,new Map);A(this,xc,new Map);A(this,Xh,new Map);A(this,Ta,null);this.messageHandler=t,this.loadingTask=e,g(this,Ea,n),this.commonObjs=new xy,this.fontLoader=new gw({ownerDocument:i.ownerDocument,styleElement:i.styleElement}),this.enableHWA=i.enableHWA,this.loadingParams=i.loadingParams,this._params=i,this.canvasFactory=s.canvasFactory,this.filterFactory=s.filterFactory,this.binaryDataFactory=s.binaryDataFactory,this.pagesMapper=a,this.destroyed=!1,this.destroyCapability=null,this.setupMessageHandler()}updatePage(t){let{_pageIndex:e}=t;o(this,Gr).set(e,t),o(this,xc).set(e,Promise.resolve(t))}get annotationStorage(){return Ut(this,"annotationStorage",new sp)}getRenderingIntent(t,e=Ba.ENABLE,n=null,i=!1,s=!1){let a=Yi.DISPLAY,l=rp;switch(t){case"any":a=Yi.ANY;break;case"display":break;case"print":a=Yi.PRINT;break;default:jt(`getRenderingIntent - invalid intent: ${t}`)}let c=a&Yi.PRINT&&n instanceof dy?n:this.annotationStorage;switch(e){case Ba.DISABLE:a+=Yi.ANNOTATIONS_DISABLE;break;case Ba.ENABLE:break;case Ba.ENABLE_FORMS:a+=Yi.ANNOTATIONS_FORMS;break;case Ba.ENABLE_STORAGE:a+=Yi.ANNOTATIONS_STORAGE,l=c.serializable;break;default:jt(`getRenderingIntent - invalid annotationMode: ${e}`)}i&&(a+=Yi.IS_EDITING),s&&(a+=Yi.OPLIST);let{ids:u,hash:h}=c.modifiedIds,d=[a,l.hash,h];return{renderingIntent:a,cacheKey:d.join("_"),annotationStorageSerializable:l,modifiedIds:u}}destroy(){if(this.destroyCapability)return this.destroyCapability.promise;this.destroyed=!0,this.destroyCapability=Promise.withResolvers(),o(this,Ta)?.reject(new Error("Worker was destroyed during onPassword callback"));let t=[];for(let n of o(this,Gr).values())t.push(n._destroy());o(this,Gr).clear(),o(this,xc).clear(),o(this,Xh).clear(),this.hasOwnProperty("annotationStorage")&&this.annotationStorage.resetModified();let e=this.messageHandler.sendWithPromise("Terminate",null);return t.push(e),Promise.all(t).then(()=>{this.commonObjs.clear(),this.fontLoader.clear(),o(this,bc).clear(),this.filterFactory.destroy(),Fd.cleanup(),o(this,Ea)?.cancelAllRequests(new Qr("Worker was terminated.")),this.messageHandler?.destroy(),this.messageHandler=null,this.destroyCapability.resolve()},this.destroyCapability.reject),this.destroyCapability.promise}setupMessageHandler(){let{messageHandler:t,loadingTask:e}=this;t.on("GetReader",(n,i)=>{Ue(o(this,Ea),"GetReader - no `BasePDFStream` instance available."),g(this,Pi,o(this,Ea).getFullReader()),o(this,Pi).onProgress=s=>v(this,Zr,B0).call(this,s),i.onPull=()=>{o(this,Pi).read().then(function({value:s,done:a}){if(a){i.close();return}Ue(s instanceof ArrayBuffer,"GetReader - expected an ArrayBuffer."),i.enqueue(new Uint8Array(s),1,[s])}).catch(s=>{i.error(s)})},i.onCancel=s=>{o(this,Pi).cancel(s),i.ready.catch(a=>{if(!this.destroyed)throw a})}}),t.on("ReaderHeadersReady",async n=>{await o(this,Pi).headersReady;let{isStreamingSupported:i,isRangeSupported:s,contentLength:a}=o(this,Pi);return i&&s&&(o(this,Pi).onProgress=null),{isStreamingSupported:i,isRangeSupported:s,contentLength:a}}),t.on("GetRangeReader",(n,i)=>{Ue(o(this,Ea),"GetRangeReader - no `BasePDFStream` instance available.");let s=o(this,Ea).getRangeReader(n.begin,n.end);if(!s){i.close();return}i.onPull=()=>{s.read().then(function({value:a,done:l}){if(l){i.close();return}Ue(a instanceof ArrayBuffer,"GetRangeReader - expected an ArrayBuffer."),i.enqueue(new Uint8Array(a),1,[a])}).catch(a=>{i.error(a)})},i.onCancel=a=>{s.cancel(a),i.ready.catch(l=>{if(!this.destroyed)throw l})}}),t.on("GetDoc",({pdfInfo:n})=>{this.pagesMapper.pagesNumber=n.numPages,this._numPages=n.numPages,this._htmlForXfa=n.htmlForXfa,delete n.htmlForXfa,e._capability.resolve(new cA(n,this))}),t.on("DocException",n=>{e._capability.reject(xi(n))}),t.on("PasswordRequest",n=>{g(this,Ta,Promise.withResolvers());try{if(!e.onPassword)throw xi(n);let i=s=>{s instanceof Error?o(this,Ta).reject(s):o(this,Ta).resolve({password:s})};e.onPassword(i,n.code)}catch(i){o(this,Ta).reject(i)}return o(this,Ta).promise}),t.on("DataLoaded",n=>{v(this,Zr,B0).call(this,{loaded:n.length,total:n.length}),this.downloadInfoCapability.resolve(n)}),t.on("StartRenderPage",n=>{if(this.destroyed)return;o(this,Gr).get(n.pageIndex)._startRenderPage(n.transparency,n.cacheKey)}),t.on("commonobj",([n,i,s])=>{if(this.destroyed||this.commonObjs.has(n))return null;switch(i){case"Font":if("error"in s){let d=s.error;jt(`Error during font loading: ${d}`),this.commonObjs.resolve(n,d);break}let a=new ww(s),l=this._params.pdfBug&&globalThis.FontInspector?.enabled?(d,f)=>globalThis.FontInspector.fontAdded(d,f):null,c=new yw(a,l,s.charProcOperatorList,s.extra);this.fontLoader.bind(c).catch(()=>t.sendWithPromise("FontFallback",{id:n})).finally(()=>{c.fontExtraProperties||c.clearData(),this.commonObjs.resolve(n,c)});break;case"CopyLocalImage":let{imageRef:u}=s;Ue(u,"The imageRef must be defined.");for(let d of o(this,Gr).values())for(let[,f]of d.objs)if(f?.ref===u)return f.dataLen?(this.commonObjs.resolve(n,structuredClone(f)),f.dataLen):null;break;case"FontPath":this.commonObjs.resolve(n,new Cw(s));break;case"Image":this.commonObjs.resolve(n,s);break;case"Pattern":let h=new vw(s);this.commonObjs.resolve(n,h.getIR());break;default:throw new Error(`Got unknown common object type ${i}`)}return null}),t.on("obj",([n,i,s,a])=>{if(this.destroyed)return;let l=o(this,Gr).get(i);if(!l.objs.has(n)){if(l._intentStates.size===0){a?.bitmap?.close();return}switch(s){case"Image":case"Pattern":l.objs.resolve(n,a);break;default:throw new Error(`Got unknown object type ${s}`)}}}),t.on("DocProgress",n=>{this.destroyed||v(this,Zr,B0).call(this,n)}),t.on("PrepareWebGPU",()=>{this.destroyed||LO()}),t.on("FetchBinaryData",async n=>{if(this.destroyed)throw new Error("Worker was destroyed.");if(!this.binaryDataFactory)throw new Error("`BinaryDataFactory` not initialized, see the `useWorkerFetch` parameter.");return this.binaryDataFactory.fetch(n)})}getData(){return this.messageHandler.sendWithPromise("GetData",null)}saveDocument(){this.annotationStorage.size<=0&&jt("saveDocument called while `annotationStorage` is empty, please use the getData-method instead.");let{map:t,transfer:e}=this.annotationStorage.serializable;return this.messageHandler.sendWithPromise("SaveDocument",{isPureXfa:!!this._htmlForXfa,numPages:this._numPages,annotationStorage:t,filename:o(this,Pi)?.filename??null},e).finally(()=>{this.annotationStorage.resetModified()})}extractPages(t){let e={pageInfos:t},n;if(this.annotationStorage.size>0){let{map:i,transfer:s}=this.annotationStorage.serializable;e.annotationStorage=i,n=s}return this.messageHandler.sendWithPromise("ExtractPages",e,n).finally(()=>{this.annotationStorage.resetModified()})}getPage(t){if(!Number.isInteger(t)||t<=0||t>this.pagesMapper.pagesNumber)return Promise.reject(new Error("Invalid page request."));let e=t-1,n=this.pagesMapper.getPageId(t)-1,i=o(this,xc).get(e);if(i)return i;let s=this.messageHandler.sendWithPromise("GetPage",{pageIndex:n}).then(a=>{if(this.destroyed)throw new Error("Transport destroyed");a.refStr&&o(this,Xh).set(a.refStr,n);let l=new uA(e,a,this,this.pagesMapper,this._params.pdfBug);return o(this,Gr).set(e,l),l});return o(this,xc).set(e,s),s}async getPageIndex(t){if(!Ew(t))throw new Error("Invalid pageIndex request.");let e=await this.messageHandler.sendWithPromise("GetPageIndex",{num:t.num,gen:t.gen}),n=this.pagesMapper.getPageNumber(e+1);if(n===0)throw new Error("GetPageIndex: page has been removed.");return n-1}getAnnotations(t,e){return this.messageHandler.sendWithPromise("GetAnnotations",{pageIndex:this.pagesMapper.getPageId(t+1)-1,intent:e})}getFieldObjects(){return v(this,Zr,$f).call(this,"GetFieldObjects")}hasJSActions(){return v(this,Zr,$f).call(this,"HasJSActions")}getCalculationOrderIds(){return this.messageHandler.sendWithPromise("GetCalculationOrderIds",null)}getDestinations(){return this.messageHandler.sendWithPromise("GetDestinations",null)}getDestination(t){return typeof t!="string"?Promise.reject(new Error("Invalid destination request.")):this.messageHandler.sendWithPromise("GetDestination",{id:t})}getPageLabels(){return this.messageHandler.sendWithPromise("GetPageLabels",null)}getPageLayout(){return this.messageHandler.sendWithPromise("GetPageLayout",null)}getPageMode(){return this.messageHandler.sendWithPromise("GetPageMode",null)}getViewerPreferences(){return this.messageHandler.sendWithPromise("GetViewerPreferences",null)}getOpenAction(){return this.messageHandler.sendWithPromise("GetOpenAction",null)}getAttachments(){return this.messageHandler.sendWithPromise("GetAttachments",null)}getAnnotationsByType(t,e){return this.messageHandler.sendWithPromise("GetAnnotationsByType",{types:t,pageIndexesToSkip:e})}getDocJSActions(){return v(this,Zr,$f).call(this,"GetDocJSActions")}getPageJSActions(t){return this.messageHandler.sendWithPromise("GetPageJSActions",{pageIndex:this.pagesMapper.getPageId(t+1)-1})}getStructTree(t){return this.messageHandler.sendWithPromise("GetStructTree",{pageIndex:this.pagesMapper.getPageId(t+1)-1})}getOutline(){return this.messageHandler.sendWithPromise("GetOutline",null)}getOptionalContentConfig(t){return v(this,Zr,$f).call(this,"GetOptionalContentConfig").then(e=>new iA(e,t))}getPermissions(){return this.messageHandler.sendWithPromise("GetPermissions",null)}getMetadata(){let t="GetMetadata";return o(this,bc).getOrInsertComputed(t,()=>this.messageHandler.sendWithPromise(t,null).then(e=>({info:e[0],metadata:e[1]?new eA(e[1]):null,contentDispositionFilename:o(this,Pi)?.filename??null,contentLength:o(this,Pi)?.contentLength??null,hasStructTree:e[2]})))}getMarkInfo(){return this.messageHandler.sendWithPromise("GetMarkInfo",null)}getRawData(t){return this.messageHandler.sendWithPromise("GetRawData",t)}async startCleanup(t=!1){if(!this.destroyed){await this.messageHandler.sendWithPromise("Cleanup",null);for(let e of o(this,Gr).values())if(!e.cleanup())throw new Error(`startCleanup: Page ${e.pageNumber} is currently rendering.`);this.commonObjs.clear(),t||this.fontLoader.clear(),o(this,bc).clear(),this.filterFactory.destroy(!0),Fd.cleanup()}}cachedPageNumber(t){if(!Ew(t))return null;let e=t.gen===0?`${t.num}R`:`${t.num}R${t.gen}`,n=o(this,Xh).get(e);if(n>=0){let i=this.pagesMapper.getPageNumber(n+1);if(i!==0)return i}return null}};Pi=new WeakMap,bc=new WeakMap,Ea=new WeakMap,Gr=new WeakMap,xc=new WeakMap,Xh=new WeakMap,Ta=new WeakMap,Zr=new WeakSet,$f=function(t,e=null){return o(this,bc).getOrInsertComputed(t,()=>this.messageHandler.sendWithPromise(t,e))},B0=function({loaded:t,total:e}){this.loadingTask.onProgress?.({loaded:t,total:e,percent:e?yn(Math.round(t/e*100),0,100):NaN})};dA=class{constructor(t){U(this,"_internalRenderTask",null);U(this,"onContinue",null);U(this,"onError",null);this._internalRenderTask=t}get promise(){return this._internalRenderTask.capability.promise}cancel(t=0){this._internalRenderTask.cancel(null,t)}get separateAnnots(){let{separateAnnots:t}=this._internalRenderTask.operatorList;if(!t)return!1;let{annotationCanvasMap:e}=this._internalRenderTask;return t.form||t.canvas&&e?.size>0}get imageCoordinates(){return this._internalRenderTask.imageCoordinates||null}},Tl=class Tl{constructor({callback:t,params:e,objs:n,commonObjs:i,annotationCanvasMap:s,operatorList:a,pageIndex:l,canvasFactory:c,filterFactory:u,useRequestAnimationFrame:h=!1,pdfBug:d=!1,pageColors:f=null,enableHWA:p=!1,operationsFilter:m=null}){A(this,Ro,null);this.callback=t,this.params=e,this.objs=n,this.commonObjs=i,this.annotationCanvasMap=s,this.operatorListIdx=null,this.operatorList=a,this._pageIndex=l,this.canvasFactory=c,this.filterFactory=u,this._pdfBug=d,this.pageColors=f,this.running=!1,this.graphicsReadyCallback=null,this.graphicsReady=!1,this._useRequestAnimationFrame=h===!0&&typeof window<"u",this.cancelled=!1,this.capability=Promise.withResolvers(),this.task=new dA(this),this._cancelBound=this.cancel.bind(this),this._continueBound=this._continue.bind(this),this._scheduleNextBound=this._scheduleNext.bind(this),this._nextBound=this._next.bind(this),this._canvas=e.canvas,this._canvasContext=e.canvas?null:e.canvasContext,this._enableHWA=p,this._dependencyTracker=e.dependencyTracker,this._imagesTracker=e.imagesTracker,this._operationsFilter=m}get completed(){return this.capability.promise.catch(function(){})}initializeGraphics({transparency:t=!1,optionalContentConfig:e}){if(this.cancelled)return;if(this._canvas){if(o(Tl,wc).has(this._canvas))throw new Error("Cannot use the same canvas during multiple render() operations. Use different canvas or ensure previous operations were cancelled or completed.");o(Tl,wc).add(this._canvas)}this._pdfBug&&globalThis.StepperManager?.enabled&&(this.stepper=globalThis.StepperManager.create(this._pageIndex),this.stepper.init(this.operatorList),this.stepper.nextBreakPoint=this.stepper.getNextBreakPoint());let{viewport:n,transform:i,background:s,dependencyTracker:a,imagesTracker:l}=this.params,c=this._canvasContext||this._canvas.getContext("2d",{alpha:!1,willReadFrequently:!this._enableHWA});this.gfx=new Ju(c,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:e},this.annotationCanvasMap,this.pageColors,a,l),this.gfx.beginDrawing({transform:i,viewport:n,transparency:t,background:s}),this.operatorListIdx=0,this.graphicsReady=!0,this.graphicsReadyCallback?.()}cancel(t=null,e=0){this.running=!1,this.cancelled=!0,this.gfx?.endDrawing(),o(this,Ro)&&(window.cancelAnimationFrame(o(this,Ro)),g(this,Ro,null)),o(Tl,wc).delete(this._canvas),t||(t=new kd(`Rendering cancelled, page ${this._pageIndex+1}`,e)),this.callback(t),this.task.onError?.(t)}operatorListChanged(){if(!this.graphicsReady){this.graphicsReadyCallback||(this.graphicsReadyCallback=this._continueBound);return}this.gfx.dependencyTracker?.growOperationsCount(this.operatorList.fnArray.length),this.stepper?.updateOperatorList(this.operatorList),!this.running&&this._continue()}_continue(){this.running=!0,!this.cancelled&&(this.task.onContinue?this.task.onContinue(this._scheduleNextBound):this._scheduleNext())}_scheduleNext(){this._useRequestAnimationFrame?g(this,Ro,window.requestAnimationFrame(()=>{g(this,Ro,null),this._nextBound().catch(this._cancelBound)})):Promise.resolve().then(this._nextBound).catch(this._cancelBound)}async _next(){this.cancelled||(this.operatorListIdx=this.gfx.executeOperatorList(this.operatorList,this.operatorListIdx,this._continueBound,this.stepper,this._operationsFilter),this.operatorListIdx===this.operatorList.argsArray.length&&(this.running=!1,this.operatorList.lastChunk&&(this.gfx.endDrawing(),o(Tl,wc).delete(this._canvas),this.callback())))}};Ro=new WeakMap,wc=new WeakMap,A(Tl,wc,new WeakSet);fA=Tl,qS="5.6.205",VS="ada343803",wi=class wi{constructor({editor:t=null,uiManager:e=null}){A(this,ve);A(this,Ri,null);A(this,Ac,null);A(this,Yh);A(this,gn,null);A(this,wm,!1);A(this,Kh,!1);A(this,Sa,null);A(this,Am);A(this,Lo,null);A(this,Hr,null);t?(g(this,Kh,!1),g(this,Sa,t)):g(this,Kh,!0),g(this,Hr,t?._uiManager||e),g(this,Am,o(this,Hr)._eventBus),g(this,Yh,t?.color?.toUpperCase()||o(this,Hr)?.highlightColors.values().next().value||"#FFFF98"),o(wi,vm)||g(wi,vm,Object.freeze({blue:"pdfjs-editor-colorpicker-blue",green:"pdfjs-editor-colorpicker-green",pink:"pdfjs-editor-colorpicker-pink",red:"pdfjs-editor-colorpicker-red",yellow:"pdfjs-editor-colorpicker-yellow"}))}static get _keyboardManager(){return Ut(this,"_keyboardManager",new Kc([[["Escape","mac+Escape"],wi.prototype._hideDropdownFromKeyboard],[[" ","mac+ "],wi.prototype._colorSelectFromKeyboard],[["ArrowDown","ArrowRight","mac+ArrowDown","mac+ArrowRight"],wi.prototype._moveToNext],[["ArrowUp","ArrowLeft","mac+ArrowUp","mac+ArrowLeft"],wi.prototype._moveToPrevious],[["Home","mac+Home"],wi.prototype._moveToBeginning],[["End","mac+End"],wi.prototype._moveToEnd]]))}renderButton(){let t=g(this,Ri,document.createElement("button"));t.className="colorPicker",t.tabIndex="0",t.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-button"),t.ariaHasPopup="true",o(this,Sa)&&(t.ariaControls=`${o(this,Sa).id}_colorpicker_dropdown`);let e=o(this,Hr)._signal;t.addEventListener("click",v(this,ve,Al).bind(this),{signal:e}),t.addEventListener("keydown",v(this,ve,gA).bind(this),{signal:e});let n=g(this,Ac,document.createElement("span"));return n.className="swatch",n.ariaHidden="true",n.style.backgroundColor=o(this,Yh),t.append(n),t}renderMainDropdown(){let t=g(this,gn,v(this,ve,pA).call(this));return t.ariaOrientation="horizontal",t.ariaLabelledBy="highlightColorPickerLabel",t}_colorSelectFromKeyboard(t){if(t.target===o(this,Ri)){v(this,ve,Al).call(this,t);return}let e=t.target.getAttribute("data-color");e&&v(this,ve,mA).call(this,e,t)}_moveToNext(t){if(!o(this,ve,so)){v(this,ve,Al).call(this,t);return}if(t.target===o(this,Ri)){o(this,gn).firstElementChild?.focus();return}t.target.nextSibling?.focus()}_moveToPrevious(t){if(t.target===o(this,gn)?.firstElementChild||t.target===o(this,Ri)){o(this,ve,so)&&this._hideDropdownFromKeyboard();return}o(this,ve,so)||v(this,ve,Al).call(this,t),t.target.previousSibling?.focus()}_moveToBeginning(t){if(!o(this,ve,so)){v(this,ve,Al).call(this,t);return}o(this,gn).firstElementChild?.focus()}_moveToEnd(t){if(!o(this,ve,so)){v(this,ve,Al).call(this,t);return}o(this,gn).lastElementChild?.focus()}hideDropdown(){o(this,gn)?.classList.add("hidden"),o(this,Ri).ariaExpanded="false",o(this,Lo)?.abort(),g(this,Lo,null)}_hideDropdownFromKeyboard(){if(!o(this,Kh)){if(!o(this,ve,so)){o(this,Sa)?.unselect();return}this.hideDropdown(),o(this,Ri).focus({preventScroll:!0,focusVisible:o(this,wm)})}}updateColor(t){if(o(this,Ac)&&(o(this,Ac).style.backgroundColor=t),!o(this,gn))return;let e=o(this,Hr).highlightColors.values();for(let n of o(this,gn).children)n.ariaSelected=e.next().value===t.toUpperCase()}destroy(){o(this,Ri)?.remove(),g(this,Ri,null),g(this,Ac,null),o(this,gn)?.remove(),g(this,gn,null)}};Ri=new WeakMap,Ac=new WeakMap,Yh=new WeakMap,gn=new WeakMap,wm=new WeakMap,Kh=new WeakMap,Sa=new WeakMap,Am=new WeakMap,Lo=new WeakMap,Hr=new WeakMap,vm=new WeakMap,ve=new WeakSet,pA=function(){let t=document.createElement("div"),e=o(this,Hr)._signal;t.addEventListener("contextmenu",tr,{signal:e}),t.className="dropdown",t.role="listbox",t.ariaMultiSelectable="false",t.ariaOrientation="vertical",t.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-dropdown"),o(this,Sa)&&(t.id=`${o(this,Sa).id}_colorpicker_dropdown`);for(let[n,i]of o(this,Hr).highlightColors){let s=document.createElement("button");s.tabIndex="0",s.role="option",s.setAttribute("data-color",i),s.title=n,s.setAttribute("data-l10n-id",o(wi,vm)[n]);let a=document.createElement("span");s.append(a),a.className="swatch",a.style.backgroundColor=i,s.ariaSelected=i===o(this,Yh),s.addEventListener("click",v(this,ve,mA).bind(this,i),{signal:e}),t.append(s)}return t.addEventListener("keydown",v(this,ve,gA).bind(this),{signal:e}),t},mA=function(t,e){e.stopPropagation(),o(this,Am).dispatch("switchannotationeditorparams",{source:this,type:Zt.HIGHLIGHT_COLOR,value:t}),this.updateColor(t)},gA=function(t){wi._keyboardManager.exec(this,t)},Al=function(t){if(o(this,ve,so)){this.hideDropdown();return}if(g(this,wm,t.detail===0),o(this,Lo)||(g(this,Lo,new AbortController),window.addEventListener("pointerdown",v(this,ve,XS).bind(this),{signal:o(this,Hr).combinedSignal(o(this,Lo))})),o(this,Ri).ariaExpanded="true",o(this,gn)){o(this,gn).classList.remove("hidden");return}let e=g(this,gn,v(this,ve,pA).call(this));o(this,Ri).append(e)},XS=function(t){o(this,gn)?.contains(t.target)||this.hideDropdown()},so=function(){return o(this,gn)&&!o(this,gn).classList.contains("hidden")},A(wi,vm,null);lp=wi,Sl=class Sl{constructor(t){A(this,Ss,null);A(this,Cm,null);A(this,Zh,null);g(this,Cm,t),g(this,Zh,t._uiManager),o(Sl,Em)||g(Sl,Em,Object.freeze({freetext:"pdfjs-editor-color-picker-free-text-input",ink:"pdfjs-editor-color-picker-ink-input"}))}renderButton(){if(o(this,Ss))return o(this,Ss);let{editorType:t,colorType:e,color:n}=o(this,Cm),i=g(this,Ss,document.createElement("input"));return i.type="color",i.value=n||"#000000",i.className="basicColorPicker",i.tabIndex=0,i.setAttribute("data-l10n-id",o(Sl,Em)[t]),i.addEventListener("input",()=>{o(this,Zh).updateParams(e,i.value)},{signal:o(this,Zh)._signal}),i}update(t){o(this,Ss)&&(o(this,Ss).value=t)}destroy(){o(this,Ss)?.remove(),g(this,Ss,null)}hideDropdown(){}};Ss=new WeakMap,Cm=new WeakMap,Zh=new WeakMap,Em=new WeakMap,A(Sl,Em,null);wy=Sl;Ay=class{static CMYK_G([t,e,n,i]){return["G",1-Math.min(1,.3*t+.59*n+.11*e+i)]}static G_CMYK([t]){return["CMYK",0,0,0,1-t]}static G_RGB([t]){return["RGB",t,t,t]}static G_rgb([t]){return t=Cf(t),[t,t,t]}static G_HTML([t]){let e=NT(t);return`#${e}${e}${e}`}static RGB_G([t,e,n]){return["G",.3*t+.59*e+.11*n]}static RGB_rgb(t){return t.map(Cf)}static RGB_HTML(t){return`#${t.map(NT).join("")}`}static T_HTML(){return"#00000000"}static T_rgb(){return[null]}static CMYK_RGB([t,e,n,i]){return["RGB",1-Math.min(1,t+i),1-Math.min(1,n+i),1-Math.min(1,e+i)]}static CMYK_rgb([t,e,n,i]){return[Cf(1-Math.min(1,t+i)),Cf(1-Math.min(1,n+i)),Cf(1-Math.min(1,e+i))]}static CMYK_HTML(t){let e=this.CMYK_RGB(t).slice(1);return this.RGB_HTML(e)}static RGB_CMYK([t,e,n]){let i=1-t,s=1-e,a=1-n,l=Math.min(i,s,a);return["CMYK",i,s,a,l]}},yA=class{create(t,e,n=!1){if(t<=0||e<=0)throw new Error("Invalid SVG dimensions");let i=this._createSVG("svg:svg");return i.setAttribute("version","1.1"),n||(i.setAttribute("width",`${t}px`),i.setAttribute("height",`${e}px`)),i.setAttribute("preserveAspectRatio","none"),i.setAttribute("viewBox",`0 0 ${t} ${e}`),i}createElement(t){if(typeof t!="string")throw new Error("Invalid SVG element type");return this._createSVG(t)}_createSVG(t){ue("Abstract method `_createSVG` called.")}},Zc=class extends yA{_createSVG(t){return document.createElementNS(ta,t)}},JO=9,Qc=new WeakSet,tF=new Date().getTimezoneOffset()*60*1e3,Kf=class{static create(t){switch(t.data.annotationType){case tn.LINK:return new cp(t);case tn.TEXT:return new wA(t);case tn.WIDGET:switch(t.data.fieldType){case"Tx":return new AA(t);case"Btn":return t.data.radioButton?new vy(t):t.data.checkBox?new CA(t):new EA(t);case"Ch":return new TA(t);case"Sig":return new vA(t)}return new Ga(t);case tn.POPUP:return new up(t);case tn.FREETEXT:return new Cy(t);case tn.LINE:return new OA(t);case tn.SQUARE:return new FA(t);case tn.CIRCLE:return new PA(t);case tn.POLYLINE:return new Ey(t);case tn.CARET:return new LA(t);case tn.INK:return new hp(t);case tn.POLYGON:return new RA(t);case tn.HIGHLIGHT:return new Ty(t);case tn.UNDERLINE:return new UA(t);case tn.SQUIGGLY:return new $A(t);case tn.STRIKEOUT:return new zA(t);case tn.STAMP:return new Sy(t);case tn.FILEATTACHMENT:return new jA(t);default:return new $e(t)}}},S2=class S2{constructor(t,{isRenderable:e=!1,ignoreBorder:n=!1,createQuadrilaterals:i=!1}={}){A(this,Tm);A(this,vc,null);A(this,Qh,!1);A(this,vr,null);this.isRenderable=e,this.data=t.data,this.layer=t.layer,this.linkService=t.linkService,this.downloadManager=t.downloadManager,this.imageResourcesPath=t.imageResourcesPath,this.renderForms=t.renderForms,this.svgFactory=t.svgFactory,this.annotationStorage=t.annotationStorage,this.enableComment=t.enableComment,this.enableScripting=t.enableScripting,this.hasJSActions=t.hasJSActions,this._fieldObjects=t.fieldObjects,this.parent=t.parent,this.hasOwnCommentButton=!1,e&&(this.contentElement=this.container=this._createContainer(n)),i&&this._createQuadrilaterals()}static _hasPopupData({contentsObj:t,richText:e}){return!!(t?.str||e?.str)}get _isEditable(){return this.data.isEditable}get hasPopupData(){return S2._hasPopupData(this.data)||this.enableComment&&!!this.commentText}get commentData(){let{data:t}=this,e=this.annotationStorage?.getEditor(t.id);return e?e.getData():t}get hasCommentButton(){return this.enableComment&&this.hasPopupElement}get commentButtonPosition(){let t=this.annotationStorage?.getEditor(this.data.id);if(t)return t.commentButtonPositionInPage;let{quadPoints:e,inkLists:n,rect:i}=this.data,s=-1/0,a=-1/0;if(e?.length>=8){for(let l=0;l<e.length;l+=8)e[l+1]>a?(a=e[l+1],s=e[l+2]):e[l+1]===a&&(s=Math.max(s,e[l+2]));return[s,a]}if(n?.length>=1){for(let l of n)for(let c=0,u=l.length;c<u;c+=2)l[c+1]>a?(a=l[c+1],s=l[c]):l[c+1]===a&&(s=Math.max(s,l[c]));if(s!==1/0)return[s,a]}return i?[i[2],i[3]]:null}_normalizePoint(t){let{page:{view:e},viewport:{rawDims:{pageWidth:n,pageHeight:i,pageX:s,pageY:a}}}=this.parent;return t[1]=e[3]-t[1]+e[1],t[0]=100*(t[0]-s)/n,t[1]=100*(t[1]-a)/i,t}get commentText(){let{data:t}=this;return this.annotationStorage.getRawValue(`${Jf}${t.id}`)?.popup?.contents||t.contentsObj?.str||""}set commentText(t){let{data:e}=this,n={deleted:!t,contents:t||""};this.annotationStorage.updateEditor(e.id,{popup:n})||this.annotationStorage.setValue(`${Jf}${e.id}`,{id:e.id,annotationType:e.annotationType,page:this.parent.page,popup:n,popupRef:e.popupRef,modificationDate:new Date}),t||this.removePopup()}removePopup(){(o(this,vr)?.popup||this.popup)?.remove(),g(this,vr,this.popup=null)}updateEdited(t){if(!this.container)return;t.rect&&(o(this,vc)||g(this,vc,{rect:this.data.rect.slice(0)}));let{rect:e,popup:n}=t;e&&v(this,Tm,bA).call(this,e);let i=o(this,vr)?.popup||this.popup;!i&&n?.text&&(this._createPopup(n),i=o(this,vr).popup),i&&(i.updateEdited(t),n?.deleted&&(i.remove(),g(this,vr,null),this.popup=null))}resetEdited(){o(this,vc)&&(v(this,Tm,bA).call(this,o(this,vc).rect),o(this,vr)?.popup.resetEdited(),g(this,vc,null))}_createContainer(t){let{data:e,parent:{page:n,viewport:i}}=this,s=document.createElement("section");s.setAttribute("data-annotation-id",e.id),!(this instanceof Ga)&&!(this instanceof cp)&&(s.tabIndex=0);let{style:a}=s;if(a.zIndex=this.parent.zIndex,this.parent.zIndex+=2,e.alternativeText&&(s.title=e.alternativeText),e.noRotate&&s.classList.add("norotate"),!e.rect||this instanceof up){let{rotation:y}=e;return!e.hasOwnCanvas&&y!==0&&this.setRotation(y,s),s}let{width:l,height:c}=this;if(!t&&e.borderStyle.width>0){a.borderWidth=`${e.borderStyle.width}px`;let y=e.borderStyle.horizontalCornerRadius,x=e.borderStyle.verticalCornerRadius;if(y>0||x>0){let w=`calc(${y}px * var(--total-scale-factor)) / calc(${x}px * var(--total-scale-factor))`;a.borderRadius=w}else if(this instanceof vy){let w=`calc(${l}px * var(--total-scale-factor)) / calc(${c}px * var(--total-scale-factor))`;a.borderRadius=w}switch(e.borderStyle.style){case Uu.SOLID:a.borderStyle="solid";break;case Uu.DASHED:a.borderStyle="dashed";break;case Uu.BEVELED:jt("Unimplemented border style: beveled");break;case Uu.INSET:jt("Unimplemented border style: inset");break;case Uu.UNDERLINE:a.borderBottomStyle="solid";break;default:break}let b=e.borderColor||null;b?(g(this,Qh,!0),a.borderColor=yt.makeHexColor(b[0]|0,b[1]|0,b[2]|0)):a.borderWidth=0}let u=yt.normalizeRect([e.rect[0],n.view[3]-e.rect[1]+n.view[1],e.rect[2],n.view[3]-e.rect[3]+n.view[1]]),{pageWidth:h,pageHeight:d,pageX:f,pageY:p}=i.rawDims;a.left=`${100*(u[0]-f)/h}%`,a.top=`${100*(u[1]-p)/d}%`;let{rotation:m}=e;return e.hasOwnCanvas||m===0?(a.width=`${100*l/h}%`,a.height=`${100*c/d}%`):this.setRotation(m,s),s}setRotation(t,e=this.container){if(!this.data.rect)return;let{pageWidth:n,pageHeight:i}=this.parent.viewport.rawDims,{width:s,height:a}=this;t%180!==0&&([s,a]=[a,s]),e.style.width=`${100*s/n}%`,e.style.height=`${100*a/i}%`,e.setAttribute("data-main-rotation",(360-t)%360)}get _commonActions(){let t=(e,n,i)=>{let s=i.detail[e],a=s[0],l=s.slice(1);i.target.style[n]=Ay[`${a}_HTML`](l),this.annotationStorage.setValue(this.data.id,{[n]:Ay[`${a}_rgb`](l)})};return Ut(this,"_commonActions",{display:e=>{let{display:n}=e.detail,i=n%2===1;this.container.style.visibility=i?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noView:i,noPrint:n===1||n===2})},print:e=>{this.annotationStorage.setValue(this.data.id,{noPrint:!e.detail.print})},hidden:e=>{let{hidden:n}=e.detail;this.container.style.visibility=n?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noPrint:n,noView:n})},focus:e=>{setTimeout(()=>e.target.focus({preventScroll:!1}),0)},userName:e=>{e.target.title=e.detail.userName},readonly:e=>{e.target.disabled=e.detail.readonly},required:e=>{this._setRequired(e.target,e.detail.required)},bgColor:e=>{t("bgColor","backgroundColor",e)},fillColor:e=>{t("fillColor","backgroundColor",e)},fgColor:e=>{t("fgColor","color",e)},textColor:e=>{t("textColor","color",e)},borderColor:e=>{t("borderColor","borderColor",e)},strokeColor:e=>{t("strokeColor","borderColor",e)},rotation:e=>{let n=e.detail.rotation;this.setRotation(n),this.annotationStorage.setValue(this.data.id,{rotation:n})}})}_dispatchEventFromSandbox(t,e){let n=this._commonActions;for(let i of Object.keys(e.detail))(t[i]||n[i])?.(e)}_setDefaultPropertiesFromJS(t){if(!this.enableScripting)return;let e=this.annotationStorage.getRawValue(this.data.id);if(!e)return;let n=this._commonActions;for(let[i,s]of Object.entries(e)){let a=n[i];if(a){let l={detail:{[i]:s},target:t};a(l),delete e[i]}}}_createQuadrilaterals(){if(!this.container)return;let{quadPoints:t}=this.data;if(!t)return;let[e,n,i,s]=this.data.rect.map(y=>Math.fround(y));if(t.length===8){let[y,x,b,w]=t.subarray(2,6);if(i===y&&s===x&&e===b&&n===w)return}let{style:a}=this.container,l;if(o(this,Qh)){let{borderColor:y,borderWidth:x}=a;a.borderWidth=0,l=["url('data:image/svg+xml;utf8,",'<svg xmlns="http://www.w3.org/2000/svg"',' preserveAspectRatio="none" viewBox="0 0 1 1">',`<g fill="transparent" stroke="${y}" stroke-width="${x}">`],this.container.classList.add("hasBorder")}let c=i-e,u=s-n,{svgFactory:h}=this,d=h.createElement("svg");d.classList.add("quadrilateralsContainer"),d.setAttribute("width",0),d.setAttribute("height",0),d.role="none";let f=h.createElement("defs");d.append(f);let p=h.createElement("clipPath"),m=`clippath_${this.data.id}`;p.setAttribute("id",m),p.setAttribute("clipPathUnits","objectBoundingBox"),f.append(p);for(let y=2,x=t.length;y<x;y+=8){let b=t[y],w=t[y+1],C=t[y+2],E=t[y+3],S=h.createElement("rect"),N=(C-e)/c,k=(s-w)/u,M=(b-C)/c,R=(w-E)/u;S.setAttribute("x",N),S.setAttribute("y",k),S.setAttribute("width",M),S.setAttribute("height",R),p.append(S),l?.push(`<rect vector-effect="non-scaling-stroke" x="${N}" y="${k}" width="${M}" height="${R}"/>`)}o(this,Qh)&&(l.push("</g></svg>')"),a.backgroundImage=l.join("")),this.container.append(d),this.container.style.clipPath=`url(#${m})`}_createPopup(t=null){let{data:e}=this,n,i;t?(n={str:t.text},i=t.date):(n=e.contentsObj,i=e.modificationDate),g(this,vr,new up({data:{color:e.color,titleObj:e.titleObj,modificationDate:i,contentsObj:n,richText:e.richText,parentRect:e.rect,borderStyle:0,id:`popup_${e.id}`,rotation:e.rotation,noRotate:!0},linkService:this.linkService,parent:this.parent,elements:[this]}))}get hasPopupElement(){return!!(o(this,vr)||this.popup||this.data.popupRef)}get extraPopupElement(){return o(this,vr)}render(){ue("Abstract method `AnnotationElement.render` called")}_getElementsByName(t,e=null){let n=[];if(this._fieldObjects){let i=this._fieldObjects[t];if(i)for(let{page:s,id:a,exportValues:l}of i){if(s===-1||a===e)continue;let c=typeof l=="string"?l:null,u=document.querySelector(`[data-element-id="${a}"]`);if(u&&!Qc.has(u)){jt(`_getElementsByName - element not allowed: ${a}`);continue}n.push({id:a,exportValue:c,domElement:u})}return n}for(let i of document.getElementsByName(t)){let{exportValue:s}=i,a=i.getAttribute("data-element-id");a!==e&&Qc.has(i)&&n.push({id:a,exportValue:s,domElement:i})}return n}show(){this.container&&(this.container.hidden=!1),this.popup?.maybeShow()}hide(){this.container&&(this.container.hidden=!0),this.popup?.forceHide()}getElementsToTriggerPopup(){return this.container}addHighlightArea(){let t=this.getElementsToTriggerPopup();if(Array.isArray(t))for(let e of t)e.classList.add("highlightArea");else t.classList.add("highlightArea")}_editOnDoubleClick(){if(!this._isEditable)return;let{annotationEditorType:t,data:{id:e}}=this;this.container.addEventListener("dblclick",()=>{this.linkService.eventBus?.dispatch("switchannotationeditormode",{source:this,mode:t,editId:e,mustEnterInEditMode:!0})})}get width(){return this.data.rect[2]-this.data.rect[0]}get height(){return this.data.rect[3]-this.data.rect[1]}};vc=new WeakMap,Qh=new WeakMap,vr=new WeakMap,Tm=new WeakSet,bA=function(t){let{container:{style:e},data:{rect:n,rotation:i},parent:{viewport:{rawDims:{pageWidth:s,pageHeight:a,pageX:l,pageY:c}}}}=this;n?.splice(0,4,...t),e.left=`${100*(t[0]-l)/s}%`,e.top=`${100*(a-t[3]+c)/a}%`,i===0?(e.width=`${100*(t[2]-t[0])/s}%`,e.height=`${100*(t[3]-t[1])/a}%`):this.setRotation(i)};$e=S2,xA=class extends $e{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),this.editor=t.editor}render(){return this.container.className="editorAnnotation",this.container}createOrUpdatePopup(){let{editor:t}=this;t.hasComment&&this._createPopup(t.comment)}get hasCommentButton(){return this.enableComment&&this.editor.hasComment}get commentButtonPosition(){return this.editor.commentButtonPositionInPage}get commentText(){return this.editor.comment.text}set commentText(t){this.editor.comment=t,t||this.removePopup()}get commentData(){return this.editor.getData()}remove(){this.parent.removeAnnotation(this.data.id),this.container.remove(),this.container=null,this.removePopup()}},cp=class extends $e{constructor(e,n=null){super(e,{isRenderable:!0,ignoreBorder:!!n?.ignoreBorder,createQuadrilaterals:!0});A(this,Qi);this.isTooltipOnly=e.data.isTooltipOnly}render(){let{data:e,linkService:n}=this,i=document.createElement("a");i.setAttribute("data-element-id",e.id);let s=!1;return e.url?(n.addLinkAttributes(i,e.url,e.newWindow),s=!0):e.action?(this._bindNamedAction(i,e.action,e.overlaidText),s=!0):e.attachment?(v(this,Qi,YS).call(this,i,e.attachment,e.overlaidText,e.attachmentDest),s=!0):e.setOCGState?(v(this,Qi,KS).call(this,i,e.setOCGState,e.overlaidText),s=!0):e.dest?(this._bindLink(i,e.dest,e.overlaidText),s=!0):(e.actions&&(e.actions.Action||e.actions["Mouse Up"]||e.actions["Mouse Down"])&&this.enableScripting&&this.hasJSActions&&(this._bindJSAction(i,e),s=!0),e.resetForm?(this._bindResetFormAction(i,e.resetForm),s=!0):this.isTooltipOnly&&!s&&(this._bindLink(i,""),s=!0)),this.container.classList.add("linkAnnotation"),s&&(this.contentElement=i,this.container.append(i)),this.container}_bindLink(e,n,i=""){e.href=this.linkService.getDestinationHash(n),e.onclick=()=>(n&&this.linkService.goToDestination(n),!1),(n||n==="")&&v(this,Qi,vl).call(this),i&&(e.title=i)}_bindNamedAction(e,n,i=""){e.href=this.linkService.getAnchorUrl(""),e.onclick=()=>(this.linkService.executeNamedAction(n),!1),i&&(e.title=i),v(this,Qi,vl).call(this)}_bindJSAction(e,n){e.href=this.linkService.getAnchorUrl("");let i=new Map([["Action","onclick"],["Mouse Up","onmouseup"],["Mouse Down","onmousedown"]]);for(let s of Object.keys(n.actions)){let a=i.get(s);a&&(e[a]=()=>(this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:n.id,name:s}}),!1))}n.overlaidText&&(e.title=n.overlaidText),e.onclick||(e.onclick=()=>!1),v(this,Qi,vl).call(this)}_bindResetFormAction(e,n){let i=e.onclick;if(i||(e.href=this.linkService.getAnchorUrl("")),v(this,Qi,vl).call(this),!this._fieldObjects){jt('_bindResetFormAction - "resetForm" action not supported, ensure that the `fieldObjects` parameter is provided.'),i||(e.onclick=()=>!1);return}e.onclick=()=>{i?.();let{fields:s,refs:a,include:l}=n,c=[];if(s.length!==0||a.length!==0){let d=new Set(a);for(let f of s){let p=this._fieldObjects[f]||[];for(let{id:m}of p)d.add(m)}for(let f of Object.values(this._fieldObjects))for(let p of f)d.has(p.id)===l&&c.push(p)}else for(let d of Object.values(this._fieldObjects))c.push(...d);let u=this.annotationStorage,h=[];for(let d of c){let{id:f}=d;switch(h.push(f),d.type){case"text":{let m=d.defaultValue||"";u.setValue(f,{value:m});break}case"checkbox":case"radiobutton":{let m=d.defaultValue===d.exportValues;u.setValue(f,{value:m});break}case"combobox":case"listbox":{let m=d.defaultValue||"";u.setValue(f,{value:m});break}default:continue}let p=document.querySelector(`[data-element-id="${f}"]`);if(p){if(!Qc.has(p)){jt(`_bindResetFormAction - element not allowed: ${f}`);continue}}else continue;p.dispatchEvent(new Event("resetform"))}return this.enableScripting&&this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:"app",ids:h,name:"ResetForm"}}),!1}}};Qi=new WeakSet,vl=function(){this.container.setAttribute("data-internal-link","")},YS=function(e,n,i="",s=null){e.href=this.linkService.getAnchorUrl(""),n.description?e.title=n.description:i&&(e.title=i),e.onclick=()=>(this.downloadManager?.openOrDownloadData(n.content,n.filename,s),!1),v(this,Qi,vl).call(this)},KS=function(e,n,i=""){e.href=this.linkService.getAnchorUrl(""),e.onclick=()=>(this.linkService.executeSetOCGState(n),!1),i&&(e.title=i),v(this,Qi,vl).call(this)};wA=class extends $e{constructor(t){super(t,{isRenderable:!0})}render(){this.container.classList.add("textAnnotation");let t=document.createElement("img");return t.src=this.imageResourcesPath+"annotation-"+this.data.name.toLowerCase()+".svg",t.setAttribute("data-l10n-id","pdfjs-text-annotation-type"),t.setAttribute("data-l10n-args",JSON.stringify({type:this.data.name})),!this.data.popupRef&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container.append(t),this.container}},Ga=class extends $e{render(){return this.container}showElementAndHideCanvas(t){this.data.hasOwnCanvas&&(t.previousSibling?.nodeName==="CANVAS"&&(t.previousSibling.hidden=!0),t.hidden=!1)}_getKeyModifier(t){return Xe.platform.isMac?t.metaKey:t.ctrlKey}_setEventListener(t,e,n,i,s){n.includes("mouse")?t.addEventListener(n,a=>{this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:i,value:s(a),shift:a.shiftKey,modifier:this._getKeyModifier(a)}})}):t.addEventListener(n,a=>{if(n==="blur"){if(!e.focused||!a.relatedTarget)return;e.focused=!1}else if(n==="focus"){if(e.focused)return;e.focused=!0}s&&this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:i,value:s(a)}})})}_setEventListeners(t,e,n,i){for(let[s,a]of n)(a==="Action"||this.data.actions?.[a])&&((a==="Focus"||a==="Blur")&&(e||(e={focused:!1})),this._setEventListener(t,e,s,a,i),a==="Focus"&&!this.data.actions?.Blur?this._setEventListener(t,e,"blur","Blur",null):a==="Blur"&&!this.data.actions?.Focus&&this._setEventListener(t,e,"focus","Focus",null))}_setBackgroundColor(t){let e=this.data.backgroundColor||null;t.style.backgroundColor=e===null?"transparent":yt.makeHexColor(e[0],e[1],e[2])}_setTextStyle(t){let e=["left","center","right"],{fontColor:n}=this.data.defaultAppearanceData,i=this.data.defaultAppearanceData.fontSize||JO,s=t.style,a,l=2,c=u=>Math.round(10*u)/10;if(this.data.multiLine){let u=Math.abs(this.data.rect[3]-this.data.rect[1]-l),h=Math.round(u/(x0*i))||1,d=u/h;a=Math.min(i,c(d/x0))}else{let u=Math.abs(this.data.rect[3]-this.data.rect[1]-l);a=Math.min(i,c(u/x0))}s.fontSize=`calc(${a}px * var(--total-scale-factor))`,s.color=yt.makeHexColor(n[0],n[1],n[2]),this.data.textAlignment!==null&&(s.textAlign=e[this.data.textAlignment])}_setRequired(t,e){e?t.setAttribute("required",!0):t.removeAttribute("required"),t.setAttribute("aria-required",e)}},AA=class extends Ga{constructor(t){let e=t.renderForms||t.data.hasOwnCanvas||!t.data.hasAppearance&&!!t.data.fieldValue;super(t,{isRenderable:e})}setPropertyOnSiblings(t,e,n,i){let s=this.annotationStorage;for(let a of this._getElementsByName(t.name,t.id))a.domElement&&(a.domElement[e]=n),s.setValue(a.id,{[i]:n})}render(){let t=this.annotationStorage,e=this.data.id;this.container.classList.add("textWidgetAnnotation");let n=null;if(this.renderForms){let i=t.getValue(e,{value:this.data.fieldValue}),s=i.value||"",a=t.getValue(e,{charLimit:this.data.maxLen}).charLimit;a&&s.length>a&&(s=s.slice(0,a));let l=i.formattedValue||this.data.textContent?.join(`
|
|
59
|
+
`)||null;l&&this.data.comb&&(l=l.replaceAll(/\s+/g,""));let c={userValue:s,formattedValue:l,lastCommittedValue:null,commitKey:1,focused:!1};this.data.multiLine?(n=document.createElement("textarea"),n.textContent=l??s,this.data.doNotScroll&&(n.style.overflowY="hidden")):(n=document.createElement("input"),n.type=this.data.password?"password":"text",n.setAttribute("value",l??s),this.data.doNotScroll&&(n.style.overflowX="hidden")),this.data.hasOwnCanvas&&(n.hidden=!0),Qc.add(n),this.contentElement=n,n.setAttribute("data-element-id",e),n.disabled=this.data.readOnly,n.name=this.data.fieldName,n.tabIndex=0;let{datetimeFormat:u,datetimeType:h,timeStep:d}=this.data,f=!!h&&this.enableScripting;u&&(n.title=u),this._setRequired(n,this.data.required),a&&(n.maxLength=a),n.addEventListener("input",m=>{t.setValue(e,{value:m.target.value}),this.setPropertyOnSiblings(n,"value",m.target.value,"value"),c.formattedValue=null}),n.addEventListener("resetform",m=>{let y=this.data.defaultFieldValue??"";n.value=c.userValue=y,c.formattedValue=null});let p=m=>{let{formattedValue:y}=c;y!=null&&(m.target.value=y),m.target.scrollLeft=0};if(this.enableScripting&&this.hasJSActions){n.addEventListener("focus",y=>{if(c.focused)return;let{target:x}=y;if(f&&(x.type=h,d&&(x.step=d)),c.userValue){let b=c.userValue;if(f)if(h==="time"){let w=new Date(b),C=[w.getHours(),w.getMinutes(),w.getSeconds()];x.value=C.map(E=>E.toString().padStart(2,"0")).join(":")}else x.value=new Date(b-tF).toISOString().split(h==="date"?"T":".",1)[0];else x.value=b}c.lastCommittedValue=x.value,c.commitKey=1,this.data.actions?.Focus||(c.focused=!0)}),n.addEventListener("updatefromsandbox",y=>{this.showElementAndHideCanvas(y.target);let x={value(b){c.userValue=b.detail.value??"",f||t.setValue(e,{value:c.userValue.toString()}),b.target.value=c.userValue},formattedValue(b){let{formattedValue:w}=b.detail;c.formattedValue=w,w!=null&&b.target!==document.activeElement&&(b.target.value=w);let C={formattedValue:w};f&&(C.value=w),t.setValue(e,C)},selRange(b){b.target.setSelectionRange(...b.detail.selRange)},charLimit:b=>{let{charLimit:w}=b.detail,{target:C}=b;if(w===0){C.removeAttribute("maxLength");return}C.setAttribute("maxLength",w);let E=c.userValue;!E||E.length<=w||(E=E.slice(0,w),C.value=c.userValue=E,t.setValue(e,{value:E}),this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:E,willCommit:!0,commitKey:1,selStart:C.selectionStart,selEnd:C.selectionEnd}}))}};this._dispatchEventFromSandbox(x,y)}),n.addEventListener("keydown",y=>{c.commitKey=1;let x=-1;if(y.key==="Escape"?x=0:y.key==="Enter"&&!this.data.multiLine?x=2:y.key==="Tab"&&(c.commitKey=3),x===-1)return;let{value:b}=y.target;c.lastCommittedValue!==b&&(c.lastCommittedValue=b,c.userValue=b,this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:b,willCommit:!0,commitKey:x,selStart:y.target.selectionStart,selEnd:y.target.selectionEnd}}))});let m=p;p=null,n.addEventListener("blur",y=>{if(!c.focused||!y.relatedTarget)return;this.data.actions?.Blur||(c.focused=!1);let{target:x}=y,{value:b}=x;if(f){if(b&&h==="time"){let w=b.split(":").map(C=>parseInt(C,10));b=new Date(2e3,0,1,w[0],w[1],w[2]||0).valueOf(),x.step=""}else b.includes("T")||(b=`${b}T00:00`),b=new Date(b).valueOf();x.type="text"}c.userValue=b,c.lastCommittedValue!==b&&this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:b,willCommit:!0,commitKey:c.commitKey,selStart:y.target.selectionStart,selEnd:y.target.selectionEnd}}),m(y)}),this.data.actions?.Keystroke&&n.addEventListener("beforeinput",y=>{c.lastCommittedValue=null;let{data:x,target:b}=y,{value:w,selectionStart:C,selectionEnd:E}=b,S=C,N=E;switch(y.inputType){case"deleteWordBackward":{let k=w.substring(0,C).match(/\w*[^\w]*$/);k&&(S-=k[0].length);break}case"deleteWordForward":{let k=w.substring(C).match(/^[^\w]*\w*/);k&&(N+=k[0].length);break}case"deleteContentBackward":C===E&&(S-=1);break;case"deleteContentForward":C===E&&(N+=1);break}y.preventDefault(),this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:w,change:x||"",willCommit:!1,selStart:S,selEnd:N}})}),this._setEventListeners(n,c,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],y=>y.target.value)}if(p&&n.addEventListener("blur",p),this.data.comb){let y=(this.data.rect[2]-this.data.rect[0])/a;n.classList.add("comb"),n.style.letterSpacing=`calc(${y}px * var(--total-scale-factor) - 1ch)`}}else n=document.createElement("div"),n.textContent=this.data.fieldValue,n.style.verticalAlign="middle",n.style.display="table-cell",this.data.hasOwnCanvas&&(n.hidden=!0);return this._setTextStyle(n),this._setBackgroundColor(n),this._setDefaultPropertiesFromJS(n),this.container.append(n),this.container}},vA=class extends Ga{constructor(t){super(t,{isRenderable:!!t.data.hasOwnCanvas})}},CA=class extends Ga{constructor(t){super(t,{isRenderable:t.renderForms})}render(){let t=this.annotationStorage,e=this.data,n=e.id,i=t.getValue(n,{value:e.exportValue===e.fieldValue}).value;typeof i=="string"&&(i=i!=="Off",t.setValue(n,{value:i})),this.container.classList.add("buttonWidgetAnnotation","checkBox");let s=document.createElement("input");return Qc.add(s),s.setAttribute("data-element-id",n),s.disabled=e.readOnly,this._setRequired(s,this.data.required),s.type="checkbox",s.name=e.fieldName,i&&s.setAttribute("checked",!0),s.setAttribute("exportValue",e.exportValue),s.tabIndex=0,s.addEventListener("change",a=>{let{name:l,checked:c}=a.target;for(let u of this._getElementsByName(l,n)){let h=c&&u.exportValue===e.exportValue;u.domElement&&(u.domElement.checked=h),t.setValue(u.id,{value:h})}t.setValue(n,{value:c})}),s.addEventListener("resetform",a=>{let l=e.defaultFieldValue||"Off";a.target.checked=l===e.exportValue}),this.enableScripting&&this.hasJSActions&&(s.addEventListener("updatefromsandbox",a=>{let l={value(c){c.target.checked=c.detail.value!=="Off",t.setValue(n,{value:c.target.checked})}};this._dispatchEventFromSandbox(l,a)}),this._setEventListeners(s,null,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],a=>a.target.checked)),this._setBackgroundColor(s),this._setDefaultPropertiesFromJS(s),this.container.append(s),this.container}},vy=class extends Ga{constructor(t){super(t,{isRenderable:t.renderForms})}render(){this.container.classList.add("buttonWidgetAnnotation","radioButton");let t=this.annotationStorage,e=this.data,n=e.id,i=t.getValue(n,{value:e.fieldValue===e.buttonValue}).value;if(typeof i=="string"&&(i=i!==e.buttonValue,t.setValue(n,{value:i})),i)for(let a of this._getElementsByName(e.fieldName,n))t.setValue(a.id,{value:!1});let s=document.createElement("input");if(Qc.add(s),s.setAttribute("data-element-id",n),s.disabled=e.readOnly,this._setRequired(s,this.data.required),s.type="radio",s.name=e.fieldName,i&&s.setAttribute("checked",!0),s.tabIndex=0,s.addEventListener("change",a=>{let{name:l,checked:c}=a.target;for(let u of this._getElementsByName(l,n))t.setValue(u.id,{value:!1});t.setValue(n,{value:c})}),s.addEventListener("resetform",a=>{let l=e.defaultFieldValue;a.target.checked=l!=null&&l===e.buttonValue}),this.enableScripting&&this.hasJSActions){let a=e.buttonValue;s.addEventListener("updatefromsandbox",l=>{let c={value:u=>{let h=a===u.detail.value;for(let d of this._getElementsByName(u.target.name)){let f=h&&d.id===n;d.domElement&&(d.domElement.checked=f),t.setValue(d.id,{value:f})}}};this._dispatchEventFromSandbox(c,l)}),this._setEventListeners(s,null,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],l=>l.target.checked)}return this._setBackgroundColor(s),this._setDefaultPropertiesFromJS(s),this.container.append(s),this.container}},EA=class extends cp{constructor(t){super(t,{ignoreBorder:t.data.hasAppearance})}render(){let t=super.render();t.classList.add("buttonWidgetAnnotation","pushButton");let e=t.lastChild;return this.enableScripting&&this.hasJSActions&&e&&(this._setDefaultPropertiesFromJS(e),e.addEventListener("updatefromsandbox",n=>{this._dispatchEventFromSandbox({},n)})),t}},TA=class extends Ga{constructor(t){super(t,{isRenderable:t.renderForms})}render(){this.container.classList.add("choiceWidgetAnnotation");let t=this.annotationStorage,e=this.data.id,n=t.getValue(e,{value:this.data.fieldValue}),i=document.createElement("select");Qc.add(i),i.setAttribute("data-element-id",e),i.disabled=this.data.readOnly,this._setRequired(i,this.data.required),i.name=this.data.fieldName,i.tabIndex=0;let s=this.data.combo&&this.data.options.length>0;this.data.combo||(i.size=this.data.options.length,this.data.multiSelect&&(i.multiple=!0)),i.addEventListener("resetform",d=>{let f=this.data.defaultFieldValue;for(let p of i.options)p.selected=p.value===f});let a=(d,f)=>{let p=f.replaceAll(" ","\xA0");d.textContent=p,p!==f&&d.setAttribute("display-value",f)};for(let d of this.data.options){let f=document.createElement("option");a(f,d.displayValue),f.value=d.exportValue,n.value.includes(d.exportValue)&&(f.setAttribute("selected",!0),s=!1),i.append(f)}let l=null;if(s){let d=document.createElement("option");d.value=" ",d.setAttribute("hidden",!0),d.setAttribute("selected",!0),i.prepend(d),l=()=>{d.remove(),i.removeEventListener("input",l),l=null},i.addEventListener("input",l)}let c=d=>{let f=d?"value":"textContent",{options:p,multiple:m}=i;return m?Array.prototype.filter.call(p,y=>y.selected).map(y=>y[f]):p.selectedIndex===-1?null:p[p.selectedIndex][f]},u=c(!1),h=d=>{let f=d.target.options;return Array.prototype.map.call(f,p=>({displayValue:p.getAttribute("display-value")||p.textContent,exportValue:p.value}))};return this.enableScripting&&this.hasJSActions?(i.addEventListener("updatefromsandbox",d=>{let f={value(p){l?.();let m=p.detail.value,y=new Set(Array.isArray(m)?m:[m]);for(let x of i.options)x.selected=y.has(x.value);t.setValue(e,{value:c(!0)}),u=c(!1)},multipleSelection(p){i.multiple=!0},remove(p){let m=i.options,y=p.detail.remove;m[y].selected=!1,i.remove(y),m.length>0&&Array.prototype.findIndex.call(m,b=>b.selected)===-1&&(m[0].selected=!0),t.setValue(e,{value:c(!0),items:h(p)}),u=c(!1)},clear(p){for(;i.length!==0;)i.remove(0);t.setValue(e,{value:null,items:[]}),u=c(!1)},insert(p){let{index:m,displayValue:y,exportValue:x}=p.detail.insert,b=i.children[m],w=document.createElement("option");a(w,y),w.value=x,b?b.before(w):i.append(w),t.setValue(e,{value:c(!0),items:h(p)}),u=c(!1)},items(p){let{items:m}=p.detail;for(;i.length!==0;)i.remove(0);for(let y of m){let{displayValue:x,exportValue:b}=y,w=document.createElement("option");a(w,x),w.value=b,i.append(w)}i.options.length>0&&(i.options[0].selected=!0),t.setValue(e,{value:c(!0),items:h(p)}),u=c(!1)},indices(p){let m=new Set(p.detail.indices);for(let y of p.target.options)y.selected=m.has(y.index);t.setValue(e,{value:c(!0)}),u=c(!1)},editable(p){p.target.disabled=!p.detail.editable}};this._dispatchEventFromSandbox(f,d)}),i.addEventListener("input",d=>{let f=c(!0),p=c(!1);t.setValue(e,{value:f}),d.preventDefault(),this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:u,change:p,changeEx:f,willCommit:!1,commitKey:1,keyDown:!1}})}),this._setEventListeners(i,null,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"],["input","Action"],["input","Validate"]],d=>d.target.value)):i.addEventListener("input",function(d){t.setValue(e,{value:c(!0)})}),this.data.combo&&this._setTextStyle(i),this._setBackgroundColor(i),this._setDefaultPropertiesFromJS(i),this.container.append(i),this.container}},up=class extends $e{constructor(e){let{data:n,elements:i,parent:s}=e,a=!!s._commentManager;super(e,{isRenderable:!a&&$e._hasPopupData(n)});A(this,Sm);if(this.elements=i,a&&$e._hasPopupData(n)){let l=this.popup=v(this,Sm,SA).call(this);for(let c of i)c.popup=l}else this.popup=null}render(){let{container:e}=this;e.classList.add("popupAnnotation"),e.role="comment";let n=this.popup=v(this,Sm,SA).call(this),i=[];for(let s of this.elements)s.popup=n,s.container.ariaHasPopup="dialog",i.push(s.data.id),s.addHighlightArea();return this.container.setAttribute("aria-controls",i.map(s=>`${Xu}${s}`).join(",")),this.container}};Sm=new WeakSet,SA=function(){return new DA({container:this.container,color:this.data.color,titleObj:this.data.titleObj,modificationDate:this.data.modificationDate||this.data.creationDate,contentsObj:this.data.contentsObj,richText:this.data.richText,rect:this.data.rect,parentRect:this.data.parentRect||null,parent:this.parent,elements:this.elements,open:this.data.open,commentManager:this.parent._commentManager})};DA=class{constructor({container:t,color:e,elements:n,titleObj:i,modificationDate:s,contentsObj:a,richText:l,parent:c,rect:u,parentRect:h,open:d,commentManager:f=null}){A(this,Wt);A(this,Li,null);A(this,Bo,v(this,Wt,JS).bind(this));A(this,Qy,v(this,Wt,MA).bind(this));A(this,Jy,v(this,Wt,j0).bind(this));A(this,Jh,v(this,Wt,z0).bind(this));A(this,td,null);A(this,qe,null);A(this,Ds,null);A(this,Uo,null);A(this,Cc,null);A(this,ed,null);A(this,nd,null);A(this,Ns,!1);A(this,Bi,null);A(this,Da,null);A(this,Na,null);A(this,Ve,null);A(this,Ia,null);A(this,$o,null);A(this,Dm,null);A(this,ka,null);A(this,id,null);A(this,Ec,null);A(this,zo,!1);A(this,En,null);A(this,jo,null);g(this,qe,t),g(this,id,i),g(this,Ds,a),g(this,ka,l),g(this,ed,c),g(this,td,e),g(this,Dm,u),g(this,nd,h),g(this,Cc,n),g(this,Li,f),g(this,En,n[0]),g(this,Uo,Xc.toDateObject(s)),this.trigger=n.flatMap(p=>p.getElementsToTriggerPopup()),f||(v(this,Wt,U0).call(this),o(this,qe).hidden=!0,d&&v(this,Wt,z0).call(this))}renderCommentButton(){if(o(this,Ve)){o(this,Ve).parentNode||o(this,En).container.after(o(this,Ve));return}if(o(this,Ia)||v(this,Wt,NA).call(this),!o(this,Ia))return;let{signal:t}=g(this,Da,new AbortController),e=o(this,En).hasOwnCommentButton,n=()=>{o(this,Li).toggleCommentPopup(this,!0,void 0,!e)},i=()=>{o(this,Li).toggleCommentPopup(this,!1,!0,!e)},s=()=>{o(this,Li).toggleCommentPopup(this,!1,!1)};if(e){g(this,Ve,o(this,En).container);for(let a of this.trigger)a.ariaHasPopup="dialog",a.ariaControls="commentPopup",a.addEventListener("keydown",o(this,Bo),{signal:t}),a.addEventListener("click",n,{signal:t}),a.addEventListener("pointerenter",i,{signal:t}),a.addEventListener("pointerleave",s,{signal:t}),a.classList.add("popupTriggerArea")}else{let a=g(this,Ve,document.createElement("button"));a.className="annotationCommentButton";let l=o(this,En).container;a.style.zIndex=l.style.zIndex+1,a.tabIndex=0,a.ariaHasPopup="dialog",a.ariaControls="commentPopup",a.setAttribute("data-l10n-id","pdfjs-show-comment-button"),v(this,Wt,kA).call(this),v(this,Wt,IA).call(this),a.addEventListener("keydown",o(this,Bo),{signal:t}),a.addEventListener("click",n,{signal:t}),a.addEventListener("pointerenter",i,{signal:t}),a.addEventListener("pointerleave",s,{signal:t}),l.after(a)}}get commentButtonColor(){let{color:t,opacity:e}=o(this,En).commentData;return t?o(this,ed)._commentManager.makeCommentColor(t,e):null}focusCommentButton(){setTimeout(()=>{o(this,Ve)?.focus()},0)}getData(){let{richText:t,color:e,opacity:n,creationDate:i,modificationDate:s}=o(this,En).commentData;return{contentsObj:{str:this.comment},richText:t,color:e,opacity:n,creationDate:i,modificationDate:s}}get elementBeforePopup(){return o(this,Ve)}get comment(){return o(this,jo)||g(this,jo,o(this,En).commentText),o(this,jo)}set comment(t){t!==this.comment&&(o(this,En).commentText=g(this,jo,t))}focus(){o(this,En).container?.focus()}get parentBoundingClientRect(){return o(this,En).layer.getBoundingClientRect()}setCommentButtonStates({selected:t,hasPopup:e}){o(this,Ve)&&(o(this,Ve).classList.toggle("selected",t),o(this,Ve).ariaExpanded=e)}setSelectedCommentButton(t){o(this,Ve).classList.toggle("selected",t)}get commentPopupPosition(){if(o(this,$o))return o(this,$o);let{x:t,y:e,height:n}=o(this,Ve).getBoundingClientRect(),{x:i,y:s,width:a,height:l}=o(this,En).layer.getBoundingClientRect();return[(t-i)/a,(e+n-s)/l]}set commentPopupPosition(t){g(this,$o,t)}hasDefaultPopupPosition(){return o(this,$o)===null}get commentButtonPosition(){return o(this,Ia)}get commentButtonWidth(){return o(this,Ve).getBoundingClientRect().width/this.parentBoundingClientRect.width}editComment(t){let[e,n]=o(this,$o)||this.commentButtonPosition.map(u=>u/100),i=this.parentBoundingClientRect,{x:s,y:a,width:l,height:c}=i;o(this,Li).showDialog(null,this,s+e*l,a+n*c,{...t,parentDimensions:i})}render(){if(o(this,Bi))return;let t=g(this,Bi,document.createElement("div"));if(t.className="popup",o(this,td)){let n=t.style.outlineColor=yt.makeHexColor(...o(this,td));t.style.backgroundColor=`color-mix(in srgb, ${n} 30%, white)`}let e=document.createElement("span");if(e.className="header",o(this,id)?.str){let n=document.createElement("span");n.className="title",e.append(n),{dir:n.dir,str:n.textContent}=o(this,id)}if(t.append(e),o(this,Uo)){let n=document.createElement("time");n.className="popupDate",n.setAttribute("data-l10n-id","pdfjs-annotation-date-time-string"),n.setAttribute("data-l10n-args",JSON.stringify({dateObj:o(this,Uo).valueOf()})),n.dateTime=o(this,Uo).toISOString(),e.append(n)}x2({html:o(this,Wt,$0)||o(this,Ds).str,dir:o(this,Ds)?.dir,className:"popupContent"},t),o(this,qe).append(t)}updateEdited({rect:t,popup:e,deleted:n}){if(o(this,Li)){n?(this.remove(),g(this,jo,null)):e&&(e.deleted?this.remove():(v(this,Wt,kA).call(this),g(this,jo,e.text))),t&&(g(this,Ia,null),v(this,Wt,NA).call(this),v(this,Wt,IA).call(this));return}if(n||e?.deleted){this.remove();return}v(this,Wt,U0).call(this),o(this,Ec)||g(this,Ec,{contentsObj:o(this,Ds),richText:o(this,ka)}),t&&g(this,Na,null),e&&e.text&&(g(this,ka,v(this,Wt,QS).call(this,e.text)),g(this,Uo,Xc.toDateObject(e.date)),g(this,Ds,null)),o(this,Bi)?.remove(),g(this,Bi,null)}resetEdited(){o(this,Ec)&&({contentsObj:an(this,Ds)._,richText:an(this,ka)._}=o(this,Ec),g(this,Ec,null),o(this,Bi)?.remove(),g(this,Bi,null),g(this,Na,null))}remove(){if(o(this,Da)?.abort(),g(this,Da,null),o(this,Bi)?.remove(),g(this,Bi,null),g(this,zo,!1),g(this,Ns,!1),o(this,Ve)?.remove(),g(this,Ve,null),this.trigger)for(let t of this.trigger)t.classList.remove("popupTriggerArea")}forceHide(){g(this,zo,this.isVisible),o(this,zo)&&(o(this,qe).hidden=!0)}maybeShow(){o(this,Li)||(v(this,Wt,U0).call(this),o(this,zo)&&(o(this,Bi)||v(this,Wt,j0).call(this),g(this,zo,!1),o(this,qe).hidden=!1))}get isVisible(){return o(this,Li)?!1:o(this,qe).hidden===!1}};Li=new WeakMap,Bo=new WeakMap,Qy=new WeakMap,Jy=new WeakMap,Jh=new WeakMap,td=new WeakMap,qe=new WeakMap,Ds=new WeakMap,Uo=new WeakMap,Cc=new WeakMap,ed=new WeakMap,nd=new WeakMap,Ns=new WeakMap,Bi=new WeakMap,Da=new WeakMap,Na=new WeakMap,Ve=new WeakMap,Ia=new WeakMap,$o=new WeakMap,Dm=new WeakMap,ka=new WeakMap,id=new WeakMap,Ec=new WeakMap,zo=new WeakMap,En=new WeakMap,jo=new WeakMap,Wt=new WeakSet,U0=function(){if(o(this,Da))return;g(this,Da,new AbortController);let{signal:t}=o(this,Da);for(let e of this.trigger)e.addEventListener("click",o(this,Jh),{signal:t}),e.addEventListener("pointerenter",o(this,Jy),{signal:t}),e.addEventListener("pointerleave",o(this,Qy),{signal:t}),e.classList.add("popupTriggerArea");for(let e of o(this,Cc))e.container?.addEventListener("keydown",o(this,Bo),{signal:t})},NA=function(){let t=o(this,Cc).find(e=>e.hasCommentButton);t&&g(this,Ia,t._normalizePoint(t.commentButtonPosition))},IA=function(){if(o(this,En).extraPopupElement&&!o(this,En).editor)return;o(this,Ve)||this.renderCommentButton();let[t,e]=o(this,Ia),{style:n}=o(this,Ve);n.left=`calc(${t}%)`,n.top=`calc(${e}% - var(--comment-button-dim))`},kA=function(){o(this,En).extraPopupElement||(o(this,Ve)||this.renderCommentButton(),o(this,Ve).style.backgroundColor=this.commentButtonColor||"")},$0=function(){let t=o(this,ka),e=o(this,Ds);return t?.str&&(!e?.str||e.str===t.str)&&o(this,ka).html||null},_A=function(){return o(this,Wt,$0)?.attributes?.style?.fontSize||0},ZS=function(){return o(this,Wt,$0)?.attributes?.style?.color||null},QS=function(t){let e=[],n={str:t,html:{name:"div",attributes:{dir:"auto"},children:[{name:"p",children:e}]}},i={style:{color:o(this,Wt,ZS),fontSize:o(this,Wt,_A)?`calc(${o(this,Wt,_A)}px * var(--total-scale-factor))`:""}};for(let s of t.split(`
|
|
60
|
+
`))e.push({name:"span",value:s,attributes:i});return n},JS=function(t){t.altKey||t.shiftKey||t.ctrlKey||t.metaKey||(t.key==="Enter"||t.key==="Escape"&&o(this,Ns))&&v(this,Wt,z0).call(this)},tD=function(){if(o(this,Na)!==null)return;let{page:{view:t},viewport:{rawDims:{pageWidth:e,pageHeight:n,pageX:i,pageY:s}}}=o(this,ed),a=!!o(this,nd),l=a?o(this,nd):o(this,Dm);for(let m of o(this,Cc))if(!l||yt.intersect(m.data.rect,l)!==null){l=m.data.rect,a=!0;break}let c=yt.normalizeRect([l[0],t[3]-l[1]+t[1],l[2],t[3]-l[3]+t[1]]),h=a?l[2]-l[0]+5:0,d=c[0]+h,f=c[1];g(this,Na,[100*(d-i)/e,100*(f-s)/n]);let{style:p}=o(this,qe);p.left=`${o(this,Na)[0]}%`,p.top=`${o(this,Na)[1]}%`},z0=function(){if(o(this,Li)){o(this,Li).toggleCommentPopup(this,!1);return}g(this,Ns,!o(this,Ns)),o(this,Ns)?(v(this,Wt,j0).call(this),o(this,qe).addEventListener("click",o(this,Jh)),o(this,qe).addEventListener("keydown",o(this,Bo))):(v(this,Wt,MA).call(this),o(this,qe).removeEventListener("click",o(this,Jh)),o(this,qe).removeEventListener("keydown",o(this,Bo)))},j0=function(){o(this,Bi)||this.render(),this.isVisible?o(this,Ns)&&o(this,qe).classList.add("focused"):(v(this,Wt,tD).call(this),o(this,qe).hidden=!1,o(this,qe).style.zIndex=parseInt(o(this,qe).style.zIndex)+1e3)},MA=function(){o(this,qe).classList.remove("focused"),!(o(this,Ns)||!this.isVisible)&&(o(this,qe).hidden=!0,o(this,qe).style.zIndex=parseInt(o(this,qe).style.zIndex)-1e3)};Cy=class extends $e{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),this.textContent=t.data.textContent,this.textPosition=t.data.textPosition,this.annotationEditorType=Bt.FREETEXT}render(){if(this.container.classList.add("freeTextAnnotation"),this.textContent){let t=this.contentElement=document.createElement("div");t.classList.add("annotationTextContent"),t.setAttribute("role","comment");for(let e of this.textContent){let n=document.createElement("span");n.textContent=e,t.append(n)}this.container.append(t)}return!this.data.popupRef&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this._editOnDoubleClick(),this.container}},OA=class extends $e{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0});A(this,Nm,null)}render(){this.container.classList.add("lineAnnotation");let{data:e,width:n,height:i}=this,s=this.svgFactory.create(n,i,!0),a=g(this,Nm,this.svgFactory.createElement("svg:line"));return a.setAttribute("x1",e.rect[2]-e.lineCoordinates[0]),a.setAttribute("y1",e.rect[3]-e.lineCoordinates[1]),a.setAttribute("x2",e.rect[2]-e.lineCoordinates[2]),a.setAttribute("y2",e.rect[3]-e.lineCoordinates[3]),a.setAttribute("stroke-width",e.borderStyle.width||1),a.setAttribute("stroke","transparent"),a.setAttribute("fill","transparent"),s.append(a),this.container.append(s),!e.popupRef&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container}getElementsToTriggerPopup(){return o(this,Nm)}addHighlightArea(){this.container.classList.add("highlightArea")}};Nm=new WeakMap;FA=class extends $e{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0});A(this,Im,null)}render(){this.container.classList.add("squareAnnotation");let{data:e,width:n,height:i}=this,s=this.svgFactory.create(n,i,!0),a=e.borderStyle.width,l=g(this,Im,this.svgFactory.createElement("svg:rect"));return l.setAttribute("x",a/2),l.setAttribute("y",a/2),l.setAttribute("width",n-a),l.setAttribute("height",i-a),l.setAttribute("stroke-width",a||1),l.setAttribute("stroke","transparent"),l.setAttribute("fill","transparent"),s.append(l),this.container.append(s),!e.popupRef&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container}getElementsToTriggerPopup(){return o(this,Im)}addHighlightArea(){this.container.classList.add("highlightArea")}};Im=new WeakMap;PA=class extends $e{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0});A(this,km,null)}render(){this.container.classList.add("circleAnnotation");let{data:e,width:n,height:i}=this,s=this.svgFactory.create(n,i,!0),a=e.borderStyle.width,l=g(this,km,this.svgFactory.createElement("svg:ellipse"));return l.setAttribute("cx",n/2),l.setAttribute("cy",i/2),l.setAttribute("rx",n/2-a/2),l.setAttribute("ry",i/2-a/2),l.setAttribute("stroke-width",a||1),l.setAttribute("stroke","transparent"),l.setAttribute("fill","transparent"),s.append(l),this.container.append(s),!e.popupRef&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container}getElementsToTriggerPopup(){return o(this,km)}addHighlightArea(){this.container.classList.add("highlightArea")}};km=new WeakMap;Ey=class extends $e{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0});A(this,_m,null);this.containerClassName="polylineAnnotation",this.svgElementName="svg:polyline"}render(){this.container.classList.add(this.containerClassName);let{data:{rect:e,vertices:n,borderStyle:i,popupRef:s},width:a,height:l}=this;if(!n)return this.container;let c=this.svgFactory.create(a,l,!0),u=[];for(let d=0,f=n.length;d<f;d+=2){let p=n[d]-e[0],m=e[3]-n[d+1];u.push(`${p},${m}`)}u=u.join(" ");let h=g(this,_m,this.svgFactory.createElement(this.svgElementName));return h.setAttribute("points",u),h.setAttribute("stroke-width",i.width||1),h.setAttribute("stroke","transparent"),h.setAttribute("fill","transparent"),c.append(h),this.container.append(c),!s&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container}getElementsToTriggerPopup(){return o(this,_m)}addHighlightArea(){this.container.classList.add("highlightArea")}};_m=new WeakMap;RA=class extends Ey{constructor(t){super(t),this.containerClassName="polygonAnnotation",this.svgElementName="svg:polygon"}},LA=class extends $e{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0})}render(){return this.container.classList.add("caretAnnotation"),!this.data.popupRef&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container}},hp=class extends $e{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0});A(this,Om);A(this,Mm,null);A(this,Tc,[]);this.containerClassName="inkAnnotation",this.svgElementName="svg:polyline",this.annotationEditorType=this.data.it==="InkHighlight"?Bt.HIGHLIGHT:Bt.INK}render(){this.container.classList.add(this.containerClassName);let{data:{rect:e,rotation:n,inkLists:i,borderStyle:s,popupRef:a}}=this,{transform:l,width:c,height:u}=v(this,Om,BA).call(this,n,e),h=this.svgFactory.create(c,u,!0),d=g(this,Mm,this.svgFactory.createElement("svg:g"));h.append(d),d.setAttribute("stroke-width",s.width||1),d.setAttribute("stroke-linecap","round"),d.setAttribute("stroke-linejoin","round"),d.setAttribute("stroke-miterlimit",10),d.setAttribute("stroke","transparent"),d.setAttribute("fill","transparent"),d.setAttribute("transform",l);for(let f=0,p=i.length;f<p;f++){let m=this.svgFactory.createElement(this.svgElementName);o(this,Tc).push(m),m.setAttribute("points",i[f].join(",")),d.append(m)}return!a&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container.append(h),this._editOnDoubleClick(),this.container}updateEdited(e){super.updateEdited(e);let{thickness:n,points:i,rect:s}=e,a=o(this,Mm);if(n>=0&&a.setAttribute("stroke-width",n||1),i)for(let l=0,c=o(this,Tc).length;l<c;l++)o(this,Tc)[l].setAttribute("points",i[l].join(","));if(s){let{transform:l,width:c,height:u}=v(this,Om,BA).call(this,this.data.rotation,s);a.parentElement.setAttribute("viewBox",`0 0 ${c} ${u}`),a.setAttribute("transform",l)}}getElementsToTriggerPopup(){return o(this,Tc)}addHighlightArea(){this.container.classList.add("highlightArea")}};Mm=new WeakMap,Tc=new WeakMap,Om=new WeakSet,BA=function(e,n){switch(e){case 90:return{transform:`rotate(90) translate(${-n[0]},${n[1]}) scale(1,-1)`,width:n[3]-n[1],height:n[2]-n[0]};case 180:return{transform:`rotate(180) translate(${-n[2]},${n[1]}) scale(1,-1)`,width:n[2]-n[0],height:n[3]-n[1]};case 270:return{transform:`rotate(270) translate(${-n[2]},${n[3]}) scale(1,-1)`,width:n[3]-n[1],height:n[2]-n[0]};default:return{transform:`translate(${-n[0]},${n[3]}) scale(1,-1)`,width:n[2]-n[0],height:n[3]-n[1]}}};Ty=class extends $e{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0}),this.annotationEditorType=Bt.HIGHLIGHT}render(){let{data:{overlaidText:t,popupRef:e}}=this;if(!e&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container.classList.add("highlightAnnotation"),this._editOnDoubleClick(),t){let n=document.createElement("mark");n.classList.add("overlaidText"),n.textContent=t,this.container.append(n)}return this.container}},UA=class extends $e{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){let{data:{overlaidText:t,popupRef:e}}=this;if(!e&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container.classList.add("underlineAnnotation"),t){let n=document.createElement("u");n.classList.add("overlaidText"),n.textContent=t,this.container.append(n)}return this.container}},$A=class extends $e{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){let{data:{overlaidText:t,popupRef:e}}=this;if(!e&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container.classList.add("squigglyAnnotation"),t){let n=document.createElement("u");n.classList.add("overlaidText"),n.textContent=t,this.container.append(n)}return this.container}},zA=class extends $e{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){let{data:{overlaidText:t,popupRef:e}}=this;if(!e&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container.classList.add("strikeoutAnnotation"),t){let n=document.createElement("s");n.classList.add("overlaidText"),n.textContent=t,this.container.append(n)}return this.container}},Sy=class extends $e{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),this.annotationEditorType=Bt.STAMP}render(){return this.container.classList.add("stampAnnotation"),this.container.setAttribute("role","img"),!this.data.popupRef&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this._editOnDoubleClick(),this.container}},jA=class extends $e{constructor(e){super(e,{isRenderable:!0});A(this,Pm);A(this,Fm,null);let{file:n}=this.data;this.filename=n.filename,this.content=n.content,this.linkService.eventBus?.dispatch("fileattachmentannotation",{source:this,...n})}render(){this.container.classList.add("fileAttachmentAnnotation");let{container:e,data:n}=this,i;n.hasAppearance||n.fillAlpha===0?i=document.createElement("div"):(i=document.createElement("img"),i.src=`${this.imageResourcesPath}annotation-${/paperclip/i.test(n.name)?"paperclip":"pushpin"}.svg`,n.fillAlpha&&n.fillAlpha<1&&(i.style=`filter: opacity(${Math.round(n.fillAlpha*100)}%);`)),i.addEventListener("dblclick",v(this,Pm,GA).bind(this)),g(this,Fm,i);let{isMac:s}=Xe.platform;return e.addEventListener("keydown",a=>{a.key==="Enter"&&(s?a.metaKey:a.ctrlKey)&&v(this,Pm,GA).call(this)}),!n.popupRef&&this.hasPopupData?(this.hasOwnCommentButton=!0,this._createPopup()):i.classList.add("popupTriggerArea"),e.append(i),e}getElementsToTriggerPopup(){return o(this,Fm)}addHighlightArea(){this.container.classList.add("highlightArea")}};Fm=new WeakMap,Pm=new WeakSet,GA=function(){this.downloadManager?.openOrDownloadData(this.content,this.filename)};D2=class D2{constructor({div:t,accessibilityManager:e,annotationCanvasMap:n,annotationEditorUIManager:i,page:s,viewport:a,structTreeLayer:l,commentManager:c,linkService:u,annotationStorage:h}){A(this,$a);A(this,Sc,null);A(this,Dc,null);A(this,rd,null);A(this,Go,new Map);A(this,Rm,null);A(this,Nc,null);A(this,Ui,[]);A(this,Lm,!1);this.div=t,g(this,Sc,e),g(this,Dc,n),g(this,Rm,l||null),g(this,Nc,u||null),g(this,rd,h||new sp),this.page=s,this.viewport=a,this.zIndex=0,this._annotationEditorUIManager=i,this._commentManager=c||null}hasEditableAnnotations(){return o(this,Go).size>0}async render(t){let{annotations:e}=t,n=this.div;el(n,this.viewport);let i=new Map,s=[],a={data:null,layer:n,linkService:o(this,Nc),downloadManager:t.downloadManager,imageResourcesPath:t.imageResourcesPath||"",renderForms:t.renderForms!==!1,svgFactory:new Zc,annotationStorage:o(this,rd),enableComment:t.enableComment===!0,enableScripting:t.enableScripting===!0,hasJSActions:t.hasJSActions,fieldObjects:t.fieldObjects,parent:this,elements:null};for(let l of e){if(l.noHTML)continue;let c=l.annotationType===tn.POPUP;if(c){let d=i.get(l.id);if(!d)continue;if(!this._commentManager){s.push(l);continue}a.elements=d}else if(l.rect[2]===l.rect[0]||l.rect[3]===l.rect[1])continue;a.data=l;let u=Kf.create(a);if(!u.isRenderable)continue;c||(o(this,Ui).push(u),l.popupRef&&i.getOrInsertComputed(l.popupRef,cb).push(u));let h=u.render();l.hidden&&(h.style.visibility="hidden"),u._isEditable&&(o(this,Go).set(u.data.id,u),this._annotationEditorUIManager?.renderAnnotationElement(u))}await v(this,$a,G0).call(this);for(let l of s){let c=a.elements=i.get(l.id);a.data=l;let u=Kf.create(a);if(!u.isRenderable)continue;let h=u.render();u.contentElement.id=`${Xu}${l.id}`,l.hidden&&(h.style.visibility="hidden"),c.at(-1).container.after(h)}v(this,$a,HA).call(this)}async addLinkAnnotations(t){let e={data:null,layer:this.div,linkService:o(this,Nc),svgFactory:new Zc,parent:this};for(let n of t){n.borderStyle||(n.borderStyle=D2._defaultBorderStyle),e.data=n;let i=Kf.create(e);i.isRenderable&&(i.render(),i.contentElement.id=`${Xu}${n.id}`,o(this,Ui).push(i))}await v(this,$a,G0).call(this)}update({viewport:t}){let e=this.div;this.viewport=t,el(e,{rotation:t.rotation}),v(this,$a,HA).call(this),e.hidden=!1}getEditableAnnotations(){return o(this,Go).values()}getEditableAnnotation(t){return o(this,Go).get(t)}addFakeAnnotation(t){let{div:e}=this,{id:n,rotation:i}=t,s=new xA({data:{id:n,rect:t.getPDFRect(),rotation:i},editor:t,layer:e,parent:this,enableComment:!!this._commentManager,linkService:o(this,Nc),annotationStorage:o(this,rd)});return s.render(),s.contentElement.id=`${Xu}${n}`,s.createOrUpdatePopup(),o(this,Ui).push(s),s}removeAnnotation(t){let e=o(this,Ui).findIndex(i=>i.data.id===t);if(e<0)return;let[n]=o(this,Ui).splice(e,1);o(this,Sc)?.removePointerInTextLayer(n.contentElement)}updateFakeAnnotations(t){if(t.length!==0){for(let e of t)e.updateFakeAnnotationElement(this);v(this,$a,G0).call(this)}}togglePointerEvents(t=!1){this.div.classList.toggle("disabled",!t)}static get _defaultBorderStyle(){return Ut(this,"_defaultBorderStyle",Object.freeze({width:1,rawWidth:1,style:Uu.SOLID,dashArray:[3],horizontalCornerRadius:0,verticalCornerRadius:0}))}};Sc=new WeakMap,Dc=new WeakMap,rd=new WeakMap,Go=new WeakMap,Rm=new WeakMap,Nc=new WeakMap,Ui=new WeakMap,Lm=new WeakMap,$a=new WeakSet,G0=async function(){if(o(this,Ui).length===0)return;this.div.replaceChildren();let t=[];if(!o(this,Lm)){g(this,Lm,!0);for(let{contentElement:n,data:{id:i}}of o(this,Ui)){let s=n.id=`${Xu}${i}`;t.push(o(this,Rm)?.getAriaAttributes(s).then(a=>{if(a)for(let[l,c]of a)n.setAttribute(l,c)}))}}o(this,Ui).sort(({data:{rect:[n,i,s,a]}},{data:{rect:[l,c,u,h]}})=>{if(n===s&&i===a)return 1;if(l===u&&c===h)return-1;let d=a,f=i,p=(i+a)/2,m=h,y=c,x=(c+h)/2;if(p>=m&&x<=f)return-1;if(x>=d&&p<=y)return 1;let b=(n+s)/2,w=(l+u)/2;return b-w});let e=document.createDocumentFragment();for(let n of o(this,Ui))e.append(n.container),this._commentManager?(n.extraPopupElement?.popup||n.popup)?.renderCommentButton():n.extraPopupElement&&e.append(n.extraPopupElement.render());if(this.div.append(e),await Promise.all(t),o(this,Sc))for(let n of o(this,Ui))o(this,Sc).addPointerInTextLayer(n.contentElement,!1)},HA=function(){if(!o(this,Dc))return;let t=this.div;for(let[e,n]of o(this,Dc)){let i=t.querySelector(`[data-annotation-id="${e}"]`);if(!i)continue;n.className="annotationContent";let{firstChild:s}=i;s?s.nodeName==="CANVAS"?s.replaceWith(n):s.classList.contains("annotationContent")?s.after(n):s.before(n):i.append(n);let a=o(this,Go).get(e);a&&(a._hasNoCanvas?(this._annotationEditorUIManager?.setMissingCanvas(e,i.id,n),a._hasNoCanvas=!1):a.canvas=n)}o(this,Dc).clear()};Dy=D2,m0=/\r\n?|\n/g,Ie=class Ie extends Se{constructor(e){super({...e,name:"freeTextEditor"});A(this,un);A(this,$i,"");A(this,Bm,`${this.id}-editor`);A(this,Ic,null);A(this,zi);U(this,"_colorPicker",null);this.color=e.color||Ie._defaultColor||Se._defaultLineColor,g(this,zi,e.fontSize||Ie._defaultFontSize),this.annotationElementId||this._uiManager.a11yAlert("pdfjs-editor-freetext-added-alert"),this.canAddComment=!1}static get _keyboardManager(){let e=Ie.prototype,n=a=>a.isEmpty(),i=nl.TRANSLATE_SMALL,s=nl.TRANSLATE_BIG;return Ut(this,"_keyboardManager",new Kc([[["ctrl+s","mac+meta+s","ctrl+p","mac+meta+p"],e.commitOrRemove,{bubbles:!0}],[["ctrl+Enter","mac+meta+Enter","Escape","mac+Escape"],e.commitOrRemove],[["ArrowLeft","mac+ArrowLeft"],e._translateEmpty,{args:[-i,0],checker:n}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],e._translateEmpty,{args:[-s,0],checker:n}],[["ArrowRight","mac+ArrowRight"],e._translateEmpty,{args:[i,0],checker:n}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],e._translateEmpty,{args:[s,0],checker:n}],[["ArrowUp","mac+ArrowUp"],e._translateEmpty,{args:[0,-i],checker:n}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],e._translateEmpty,{args:[0,-s],checker:n}],[["ArrowDown","mac+ArrowDown"],e._translateEmpty,{args:[0,i],checker:n}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],e._translateEmpty,{args:[0,s],checker:n}]]))}static initialize(e,n){Se.initialize(e,n);let i=getComputedStyle(document.documentElement);this._internalPadding=parseFloat(i.getPropertyValue("--freetext-padding"))}static updateDefaultParams(e,n){switch(e){case Zt.FREETEXT_SIZE:Ie._defaultFontSize=n;break;case Zt.FREETEXT_COLOR:Ie._defaultColor=n;break}}updateParams(e,n){switch(e){case Zt.FREETEXT_SIZE:v(this,un,eD).call(this,n);break;case Zt.FREETEXT_COLOR:v(this,un,nD).call(this,n);break}}static get defaultPropertiesToUpdate(){return[[Zt.FREETEXT_SIZE,Ie._defaultFontSize],[Zt.FREETEXT_COLOR,Ie._defaultColor||Se._defaultLineColor]]}get propertiesToUpdate(){return[[Zt.FREETEXT_SIZE,o(this,zi)],[Zt.FREETEXT_COLOR,this.color]]}get toolbarButtons(){return this._colorPicker||(this._colorPicker=new wy(this)),[["colorPicker",this._colorPicker]]}get colorType(){return Zt.FREETEXT_COLOR}onUpdatedColor(){this.editorDiv.style.color=this.color,this._colorPicker?.update(this.color),super.onUpdatedColor()}_translateEmpty(e,n){this._uiManager.translateSelectedEditors(e,n,!0)}getInitialTranslation(){let e=this.parentScale;return[-Ie._internalPadding*e,-(Ie._internalPadding+o(this,zi))*e]}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(this.isAttachedToDOM||this.parent.add(this)))}enableEditMode(){if(!super.enableEditMode())return!1;this.overlayDiv.classList.remove("enabled"),this.editorDiv.contentEditable=!0,this._isDraggable=!1,this.div.removeAttribute("aria-activedescendant"),g(this,Ic,new AbortController);let e=this._uiManager.combinedSignal(o(this,Ic));return this.editorDiv.addEventListener("keydown",this.editorDivKeydown.bind(this),{signal:e}),this.editorDiv.addEventListener("focus",this.editorDivFocus.bind(this),{signal:e}),this.editorDiv.addEventListener("blur",this.editorDivBlur.bind(this),{signal:e}),this.editorDiv.addEventListener("input",this.editorDivInput.bind(this),{signal:e}),this.editorDiv.addEventListener("paste",this.editorDivPaste.bind(this),{signal:e}),!0}disableEditMode(){return super.disableEditMode()?(this.overlayDiv.classList.add("enabled"),this.editorDiv.contentEditable=!1,this.div.setAttribute("aria-activedescendant",o(this,Bm)),this._isDraggable=!0,o(this,Ic)?.abort(),g(this,Ic,null),this.div.focus({preventScroll:!0}),this.isEditing=!1,this.parent.div.classList.add("freetextEditing"),!0):!1}focusin(e){this._focusEventsAllowed&&(super.focusin(e),e.target!==this.editorDiv&&this.editorDiv.focus())}onceAdded(e){this.width||(this.enableEditMode(),e&&this.editorDiv.focus(),this._initialOptions?.isCentered&&this.center(),this._initialOptions=null)}isEmpty(){return!this.editorDiv||this.editorDiv.innerText.trim()===""}remove(){this.isEditing=!1,this.parent&&(this.parent.setEditingState(!0),this.parent.div.classList.add("freetextEditing")),super.remove()}commit(){if(!this.isInEditMode())return;super.commit(),this.disableEditMode();let e=o(this,$i),n=g(this,$i,v(this,un,iD).call(this).trimEnd());if(e===n)return;let i=s=>{if(g(this,$i,s),!s){this.remove();return}v(this,un,q0).call(this),this._uiManager.rebuild(this),v(this,un,H0).call(this)};this.addCommands({cmd:()=>{i(n)},undo:()=>{i(e)},mustExec:!1}),v(this,un,H0).call(this)}shouldGetKeyboardEvents(){return this.isInEditMode()}enterInEditMode(){this.enableEditMode(),this.editorDiv.focus()}keydown(e){e.target===this.div&&e.key==="Enter"&&(this.enterInEditMode(),e.preventDefault())}editorDivKeydown(e){Ie._keyboardManager.exec(this,e)}editorDivFocus(e){this.isEditing=!0}editorDivBlur(e){this.isEditing=!1}editorDivInput(e){this.parent.div.classList.toggle("freetextEditing",this.isEmpty())}disableEditing(){this.editorDiv.setAttribute("role","comment"),this.editorDiv.removeAttribute("aria-multiline")}enableEditing(){this.editorDiv.setAttribute("role","textbox"),this.editorDiv.setAttribute("aria-multiline",!0)}get canChangeContent(){return!0}render(){if(this.div)return this.div;let e,n;(this._isCopy||this.annotationElementId)&&(e=this.x,n=this.y),super.render(),this.editorDiv=document.createElement("div"),this.editorDiv.className="internal",this.editorDiv.setAttribute("id",o(this,Bm)),this.editorDiv.setAttribute("data-l10n-id","pdfjs-free-text2"),this.editorDiv.setAttribute("data-l10n-attrs","default-content"),this.enableEditing(),this.editorDiv.contentEditable=!0;let{style:i}=this.editorDiv;if(i.fontSize=`calc(${o(this,zi)}px * var(--total-scale-factor))`,i.color=this.color,this.div.append(this.editorDiv),this.overlayDiv=document.createElement("div"),this.overlayDiv.classList.add("overlay","enabled"),this.div.append(this.overlayDiv),this._isCopy||this.annotationElementId){let[s,a]=this.parentDimensions;if(this.annotationElementId){let{position:l}=this._initialData,[c,u]=this.getInitialTranslation();[c,u]=this.pageTranslationToScreen(c,u);let[h,d]=this.pageDimensions,[f,p]=this.pageTranslation,m,y;switch(this.rotation){case 0:m=e+(l[0]-f)/h,y=n+this.height-(l[1]-p)/d;break;case 90:m=e+(l[0]-f)/h,y=n-(l[1]-p)/d,[c,u]=[u,-c];break;case 180:m=e-this.width+(l[0]-f)/h,y=n-(l[1]-p)/d,[c,u]=[-c,-u];break;case 270:m=e+(l[0]-f-this.height*d)/h,y=n+(l[1]-p-this.width*h)/d,[c,u]=[-u,c];break}this.setAt(m*s,y*a,c,u)}else this._moveAfterPaste(e,n);v(this,un,q0).call(this),this._isDraggable=!0,this.editorDiv.contentEditable=!1}else this._isDraggable=!1,this.editorDiv.contentEditable=!0;return this.div}editorDivPaste(e){var m,y,x;let n=e.clipboardData||window.clipboardData,{types:i}=n;if(i.length===1&&i[0]==="text/plain")return;e.preventDefault();let s=v(m=Ie,za,qA).call(m,n.getData("text")||"").replaceAll(m0,`
|
|
61
61
|
`);if(!s)return;let a=window.getSelection();if(!a.rangeCount)return;this.editorDiv.normalize(),a.deleteFromDocument();let l=a.getRangeAt(0);if(!s.includes(`
|
|
62
62
|
`)){l.insertNode(document.createTextNode(s)),this.editorDiv.normalize(),a.collapseToStart();return}let{startContainer:c,startOffset:u}=l,h=[],d=[];if(c.nodeType===Node.TEXT_NODE){let b=c.parentElement;if(d.push(c.nodeValue.slice(u).replaceAll(m0,"")),b!==this.editorDiv){let w=h;for(let C of this.editorDiv.childNodes){if(C===b){w=d;continue}w.push(v(y=Ie,za,W0).call(y,C))}}h.push(c.nodeValue.slice(0,u).replaceAll(m0,""))}else if(c===this.editorDiv){let b=h,w=0;for(let C of this.editorDiv.childNodes)w++===u&&(b=d),b.push(v(x=Ie,za,W0).call(x,C))}g(this,$i,`${h.join(`
|
|
63
63
|
`)}${s}${d.join(`
|
|
64
64
|
`)}`),v(this,un,q0).call(this);let f=new Range,p=Math.sumPrecise(h.map(b=>b.length));for(let{firstChild:b}of this.editorDiv.childNodes)if(b.nodeType===Node.TEXT_NODE){let w=b.nodeValue.length;if(p<=w){f.setStart(b,p),f.setEnd(b,p);break}p-=w}a.removeAllRanges(),a.addRange(f)}get contentDiv(){return this.editorDiv}getPDFRect(){let e=Ie._internalPadding*this.parentScale;return this.getRect(e,e)}static async deserialize(e,n,i){var l;let s=null;if(e instanceof Cy){let{data:{defaultAppearanceData:{fontSize:c,fontColor:u},rect:h,rotation:d,id:f,popupRef:p,richText:m,contentsObj:y,creationDate:x,modificationDate:b},textContent:w,textPosition:C,parent:{page:{pageNumber:E}}}=e;if(!w||w.length===0)return null;s=e={annotationType:Bt.FREETEXT,color:Array.from(u),fontSize:c,value:w.join(`
|
|
65
|
-
`),position:C,pageIndex:E-1,rect:h.slice(0),rotation:d,annotationElementId:f,id:f,deleted:!1,popupRef:p,comment:y?.str||null,richText:m,creationDate:x,modificationDate:b}}let a=await super.deserialize(e,n,i);return g(a,zi,e.fontSize),a.color=yt.makeHexColor(...e.color),g(a,$i,v(l=Ie,za,
|
|
66
|
-
`)){let a=document.createElement("div");a.append(s?document.createTextNode(s):document.createElement("br")),n.append(a)}return e.updateEdited({rect:this.getPDFRect(),popup:this._uiManager.hasCommentManager()||this.hasEditedComment?this.comment:{text:o(this,$i)}}),n}resetAnnotationElement(e){super.resetAnnotationElement(e),e.resetEdited()}};$i=new WeakMap,Bm=new WeakMap,Ic=new WeakMap,zi=new WeakMap,un=new WeakSet,
|
|
65
|
+
`),position:C,pageIndex:E-1,rect:h.slice(0),rotation:d,annotationElementId:f,id:f,deleted:!1,popupRef:p,comment:y?.str||null,richText:m,creationDate:x,modificationDate:b}}let a=await super.deserialize(e,n,i);return g(a,zi,e.fontSize),a.color=yt.makeHexColor(...e.color),g(a,$i,v(l=Ie,za,qA).call(l,e.value)),a._initialData=s,e.comment&&a.setCommentData(e),a}serialize(e=!1){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();let n=Se._colorManager.convert(this.isAttachedToDOM?getComputedStyle(this.editorDiv).color:this.color),i=Object.assign(super.serialize(e),{color:n,fontSize:o(this,zi),value:v(this,un,rD).call(this)});return this.addComment(i),e?(i.isCopy=!0,i):this.annotationElementId&&!v(this,un,sD).call(this,i)?null:(i.id=this.annotationElementId,i)}renderAnnotationElement(e){let n=super.renderAnnotationElement(e);if(!n)return null;let{style:i}=n;i.fontSize=`calc(${o(this,zi)}px * var(--total-scale-factor))`,i.color=this.color,n.replaceChildren();for(let s of o(this,$i).split(`
|
|
66
|
+
`)){let a=document.createElement("div");a.append(s?document.createTextNode(s):document.createElement("br")),n.append(a)}return e.updateEdited({rect:this.getPDFRect(),popup:this._uiManager.hasCommentManager()||this.hasEditedComment?this.comment:{text:o(this,$i)}}),n}resetAnnotationElement(e){super.resetAnnotationElement(e),e.resetEdited()}};$i=new WeakMap,Bm=new WeakMap,Ic=new WeakMap,zi=new WeakMap,un=new WeakSet,eD=function(e){let n=s=>{this.editorDiv.style.fontSize=`calc(${s}px * var(--total-scale-factor))`,this.translate(0,-(s-o(this,zi))*this.parentScale),g(this,zi,s),v(this,un,H0).call(this)},i=o(this,zi);this.addCommands({cmd:n.bind(this,e),undo:n.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:Zt.FREETEXT_SIZE,overwriteIfSameType:!0,keepUndo:!0})},nD=function(e){let n=s=>{this.color=s,this.onUpdatedColor()},i=this.color;this.addCommands({cmd:n.bind(this,e),undo:n.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:Zt.FREETEXT_COLOR,overwriteIfSameType:!0,keepUndo:!0})},iD=function(){var i;let e=[];this.editorDiv.normalize();let n=null;for(let s of this.editorDiv.childNodes)n?.nodeType===Node.TEXT_NODE&&s.nodeName==="BR"||(e.push(v(i=Ie,za,W0).call(i,s)),n=s);return e.join(`
|
|
67
67
|
`)},H0=function(){let[e,n]=this.parentDimensions,i;if(this.isAttachedToDOM)i=this.div.getBoundingClientRect();else{let{currentLayer:s,div:a}=this,l=a.style.display,c=a.classList.contains("hidden");a.classList.remove("hidden"),a.style.display="hidden",s.div.append(this.div),i=a.getBoundingClientRect(),a.remove(),a.style.display=l,a.classList.toggle("hidden",c)}this.rotation%180===this.parentRotation%180?(this.width=i.width/e,this.height=i.height/n):(this.width=i.height/e,this.height=i.width/n),this.fixAndSetPosition()},za=new WeakSet,W0=function(e){return(e.nodeType===Node.TEXT_NODE?e.nodeValue:e.innerText).replaceAll(m0,"")},q0=function(){if(this.editorDiv.replaceChildren(),!!o(this,$i))for(let e of o(this,$i).split(`
|
|
68
|
-
`)){let n=document.createElement("div");n.append(e?document.createTextNode(e):document.createElement("br")),this.editorDiv.append(n)}},iD=function(){return o(this,$i).replaceAll("\xA0"," ")},W2=function(e){return e.replaceAll(" ","\xA0")},rD=function(e){let{value:n,fontSize:i,color:s,pageIndex:a}=this._initialData;return this.hasEditedComment||this._hasBeenMoved||e.value!==n||e.fontSize!==i||e.color.some((l,c)=>l!==s[c])||e.pageIndex!==a},A(Ie,za),U(Ie,"_freeTextDefaultContent",""),U(Ie,"_internalPadding",0),U(Ie,"_defaultColor",null),U(Ie,"_defaultFontSize",10),U(Ie,"_type","freetext"),U(Ie,"_editorType",Bt.FREETEXT);H2=Ie,Dt=class{toSVGPath(){ue("Abstract method `toSVGPath` must be implemented.")}get box(){ue("Abstract getter `box` must be implemented.")}serialize(t,e){ue("Abstract method `serialize` must be implemented.")}static _rescale(t,e,n,i,s,a){a||(a=new Float32Array(t.length));for(let l=0,c=t.length;l<c;l+=2)a[l]=e+t[l]*i,a[l+1]=n+t[l+1]*s;return a}static _rescaleAndSwap(t,e,n,i,s,a){a||(a=new Float32Array(t.length));for(let l=0,c=t.length;l<c;l+=2)a[l]=e+t[l+1]*i,a[l+1]=n+t[l]*s;return a}static _translate(t,e,n,i){i||(i=new Float32Array(t.length));for(let s=0,a=t.length;s<a;s+=2)i[s]=e+t[s],i[s+1]=n+t[s+1];return i}static svgRound(t){return Math.round(t*1e4)}static _normalizePoint(t,e,n,i,s){switch(s){case 90:return[1-e/n,t/i];case 180:return[1-t/n,1-e/i];case 270:return[e/n,1-t/i];default:return[t/n,e/i]}}static _normalizePagePoint(t,e,n){switch(n){case 90:return[1-e,t];case 180:return[1-t,1-e];case 270:return[e,1-t];default:return[t,e]}}static createBezierPoints(t,e,n,i,s,a){return[(t+5*n)/6,(e+5*i)/6,(5*n+s)/6,(5*i+a)/6,(n+s)/2,(i+a)/2]}};U(Dt,"PRECISION",1e-4);ra=class ra{constructor({x:t,y:e},n,i,s,a,l=0){A(this,bn);A(this,ji);A(this,Wr,[]);A(this,sd);A(this,ad);A(this,Is,[]);A(this,Vt,new Float32Array(18));A(this,kc);A(this,_c);A(this,Um);A(this,$m);A(this,od);A(this,ld);A(this,Ho,[]);g(this,ji,n),g(this,ld,s*i),g(this,ad,a),o(this,Vt).set([NaN,NaN,NaN,NaN,t,e],6),g(this,sd,l),g(this,$m,o(ra,zm)*i),g(this,Um,o(ra,eb)*i),g(this,od,i),o(this,Ho).push(t,e)}isEmpty(){return isNaN(o(this,Vt)[8])}add({x:t,y:e}){g(this,kc,t),g(this,_c,e);let[n,i,s,a]=o(this,ji),[l,c,u,h]=o(this,Vt).subarray(8,12),d=t-u,f=e-h,p=Math.hypot(d,f);if(p<o(this,Um))return!1;let m=p-o(this,$m),y=m/p,x=y*d,b=y*f,w=l,C=c;l=u,c=h,u+=x,h+=b,o(this,Ho)?.push(t,e);let E=-b/m,S=x/m,N=E*o(this,ld),k=S*o(this,ld);return o(this,Vt).set(o(this,Vt).subarray(2,8),0),o(this,Vt).set([u+N,h+k],4),o(this,Vt).set(o(this,Vt).subarray(14,18),12),o(this,Vt).set([u-N,h-k],16),isNaN(o(this,Vt)[6])?(o(this,Is).length===0&&(o(this,Vt).set([l+N,c+k],2),o(this,Is).push(NaN,NaN,NaN,NaN,(l+N-n)/s,(c+k-i)/a),o(this,Vt).set([l-N,c-k],14),o(this,Wr).push(NaN,NaN,NaN,NaN,(l-N-n)/s,(c-k-i)/a)),o(this,Vt).set([w,C,l,c,u,h],6),!this.isEmpty()):(o(this,Vt).set([w,C,l,c,u,h],6),Math.abs(Math.atan2(C-c,w-l)-Math.atan2(b,x))<Math.PI/2?([l,c,u,h]=o(this,Vt).subarray(2,6),o(this,Is).push(NaN,NaN,NaN,NaN,((l+u)/2-n)/s,((c+h)/2-i)/a),[l,c,w,C]=o(this,Vt).subarray(14,18),o(this,Wr).push(NaN,NaN,NaN,NaN,((w+l)/2-n)/s,((C+c)/2-i)/a),!0):([w,C,l,c,u,h]=o(this,Vt).subarray(0,6),o(this,Is).push(((w+5*l)/6-n)/s,((C+5*c)/6-i)/a,((5*l+u)/6-n)/s,((5*c+h)/6-i)/a,((l+u)/2-n)/s,((c+h)/2-i)/a),[u,h,l,c,w,C]=o(this,Vt).subarray(12,18),o(this,Wr).push(((w+5*l)/6-n)/s,((C+5*c)/6-i)/a,((5*l+u)/6-n)/s,((5*c+h)/6-i)/a,((l+u)/2-n)/s,((c+h)/2-i)/a),!0))}toSVGPath(){if(this.isEmpty())return"";let t=o(this,Is),e=o(this,Wr);if(isNaN(o(this,Vt)[6])&&!this.isEmpty())return v(this,bn,sD).call(this);let n=[];n.push(`M${t[4]} ${t[5]}`);for(let i=6;i<t.length;i+=6)isNaN(t[i])?n.push(`L${t[i+4]} ${t[i+5]}`):n.push(`C${t[i]} ${t[i+1]} ${t[i+2]} ${t[i+3]} ${t[i+4]} ${t[i+5]}`);v(this,bn,oD).call(this,n);for(let i=e.length-6;i>=6;i-=6)isNaN(e[i])?n.push(`L${e[i+4]} ${e[i+5]}`):n.push(`C${e[i]} ${e[i+1]} ${e[i+2]} ${e[i+3]} ${e[i+4]} ${e[i+5]}`);return v(this,bn,aD).call(this,n),n.join(" ")}newFreeDrawOutline(t,e,n,i,s,a){return new Iy(t,e,n,i,s,a)}getOutlines(){let t=o(this,Is),e=o(this,Wr),n=o(this,Vt),[i,s,a,l]=o(this,ji),c=new Float32Array((o(this,Ho)?.length??0)+2);for(let d=0,f=c.length-2;d<f;d+=2)c[d]=(o(this,Ho)[d]-i)/a,c[d+1]=(o(this,Ho)[d+1]-s)/l;if(c[c.length-2]=(o(this,kc)-i)/a,c[c.length-1]=(o(this,_c)-s)/l,isNaN(n[6])&&!this.isEmpty())return v(this,bn,lD).call(this,c);let u=new Float32Array(o(this,Is).length+24+o(this,Wr).length),h=t.length;for(let d=0;d<h;d+=2){if(isNaN(t[d])){u[d]=u[d+1]=NaN;continue}u[d]=t[d],u[d+1]=t[d+1]}h=v(this,bn,uD).call(this,u,h);for(let d=e.length-6;d>=6;d-=6)for(let f=0;f<6;f+=2){if(isNaN(e[d+f])){u[h]=u[h+1]=NaN,h+=2;continue}u[h]=e[d+f],u[h+1]=e[d+f+1],h+=2}return v(this,bn,cD).call(this,u,h),this.newFreeDrawOutline(u,c,o(this,ji),o(this,od),o(this,sd),o(this,ad))}};ji=new WeakMap,Wr=new WeakMap,sd=new WeakMap,ad=new WeakMap,Is=new WeakMap,Vt=new WeakMap,kc=new WeakMap,_c=new WeakMap,Um=new WeakMap,$m=new WeakMap,od=new WeakMap,ld=new WeakMap,Ho=new WeakMap,zm=new WeakMap,tb=new WeakMap,eb=new WeakMap,bn=new WeakSet,zf=function(){let t=o(this,Vt).subarray(4,6),e=o(this,Vt).subarray(16,18),[n,i,s,a]=o(this,ji);return[(o(this,kc)+(t[0]-e[0])/2-n)/s,(o(this,_c)+(t[1]-e[1])/2-i)/a,(o(this,kc)+(e[0]-t[0])/2-n)/s,(o(this,_c)+(e[1]-t[1])/2-i)/a]},sD=function(){let[t,e,n,i]=o(this,ji),[s,a,l,c]=v(this,bn,zf).call(this);return`M${(o(this,Vt)[2]-t)/n} ${(o(this,Vt)[3]-e)/i} L${(o(this,Vt)[4]-t)/n} ${(o(this,Vt)[5]-e)/i} L${s} ${a} L${l} ${c} L${(o(this,Vt)[16]-t)/n} ${(o(this,Vt)[17]-e)/i} L${(o(this,Vt)[14]-t)/n} ${(o(this,Vt)[15]-e)/i} Z`},aD=function(t){let e=o(this,Wr);t.push(`L${e[4]} ${e[5]} Z`)},oD=function(t){let[e,n,i,s]=o(this,ji),a=o(this,Vt).subarray(4,6),l=o(this,Vt).subarray(16,18),[c,u,h,d]=v(this,bn,zf).call(this);t.push(`L${(a[0]-e)/i} ${(a[1]-n)/s} L${c} ${u} L${h} ${d} L${(l[0]-e)/i} ${(l[1]-n)/s}`)},lD=function(t){let e=o(this,Vt),[n,i,s,a]=o(this,ji),[l,c,u,h]=v(this,bn,zf).call(this),d=new Float32Array(36);return d.set([NaN,NaN,NaN,NaN,(e[2]-n)/s,(e[3]-i)/a,NaN,NaN,NaN,NaN,(e[4]-n)/s,(e[5]-i)/a,NaN,NaN,NaN,NaN,l,c,NaN,NaN,NaN,NaN,u,h,NaN,NaN,NaN,NaN,(e[16]-n)/s,(e[17]-i)/a,NaN,NaN,NaN,NaN,(e[14]-n)/s,(e[15]-i)/a],0),this.newFreeDrawOutline(d,t,o(this,ji),o(this,od),o(this,sd),o(this,ad))},cD=function(t,e){let n=o(this,Wr);return t.set([NaN,NaN,NaN,NaN,n[4],n[5]],e),e+=6},uD=function(t,e){let n=o(this,Vt).subarray(4,6),i=o(this,Vt).subarray(16,18),[s,a,l,c]=o(this,ji),[u,h,d,f]=v(this,bn,zf).call(this);return t.set([NaN,NaN,NaN,NaN,(n[0]-s)/l,(n[1]-a)/c,NaN,NaN,NaN,NaN,u,h,NaN,NaN,NaN,NaN,d,f,NaN,NaN,NaN,NaN,(i[0]-s)/l,(i[1]-a)/c],e),e+=24},A(ra,zm,8),A(ra,tb,2),A(ra,eb,o(ra,zm)+o(ra,tb));Ny=ra,Iy=class extends Dt{constructor(e,n,i,s,a,l){super();A(this,nb);A(this,cd);A(this,Mc,new Float32Array(4));A(this,_a);A(this,jm);A(this,Gi);A(this,Gm);A(this,sn);g(this,sn,e),g(this,Gi,n),g(this,cd,i),g(this,Gm,s),g(this,_a,a),g(this,jm,l),this.firstPoint=[NaN,NaN],this.lastPoint=[NaN,NaN],v(this,nb,hD).call(this,l);let[c,u,h,d]=o(this,Mc);for(let f=0,p=e.length;f<p;f+=2)e[f]=(e[f]-c)/h,e[f+1]=(e[f+1]-u)/d;for(let f=0,p=n.length;f<p;f+=2)n[f]=(n[f]-c)/h,n[f+1]=(n[f+1]-u)/d}toSVGPath(){let e=[`M${o(this,sn)[4]} ${o(this,sn)[5]}`];for(let n=6,i=o(this,sn).length;n<i;n+=6){if(isNaN(o(this,sn)[n])){e.push(`L${o(this,sn)[n+4]} ${o(this,sn)[n+5]}`);continue}e.push(`C${o(this,sn)[n]} ${o(this,sn)[n+1]} ${o(this,sn)[n+2]} ${o(this,sn)[n+3]} ${o(this,sn)[n+4]} ${o(this,sn)[n+5]}`)}return e.push("Z"),e.join(" ")}serialize([e,n,i,s],a){let l=i-e,c=s-n,u,h;switch(a){case 0:u=Dt._rescale(o(this,sn),e,s,l,-c),h=Dt._rescale(o(this,Gi),e,s,l,-c);break;case 90:u=Dt._rescaleAndSwap(o(this,sn),e,n,l,c),h=Dt._rescaleAndSwap(o(this,Gi),e,n,l,c);break;case 180:u=Dt._rescale(o(this,sn),i,n,-l,c),h=Dt._rescale(o(this,Gi),i,n,-l,c);break;case 270:u=Dt._rescaleAndSwap(o(this,sn),i,s,-l,-c),h=Dt._rescaleAndSwap(o(this,Gi),i,s,-l,-c);break}return{outline:Array.from(u),points:[Array.from(h)]}}get box(){return o(this,Mc)}newOutliner(e,n,i,s,a,l=0){return new Ny(e,n,i,s,a,l)}getNewOutline(e,n){let[i,s,a,l]=o(this,Mc),[c,u,h,d]=o(this,cd),f=a*h,p=l*d,m=i*h+c,y=s*d+u,x=this.newOutliner({x:o(this,Gi)[0]*f+m,y:o(this,Gi)[1]*p+y},o(this,cd),o(this,Gm),e,o(this,jm),n??o(this,_a));for(let b=2;b<o(this,Gi).length;b+=2)x.add({x:o(this,Gi)[b]*f+m,y:o(this,Gi)[b+1]*p+y});return x.getOutlines()}};cd=new WeakMap,Mc=new WeakMap,_a=new WeakMap,jm=new WeakMap,Gi=new WeakMap,Gm=new WeakMap,sn=new WeakMap,nb=new WeakSet,hD=function(e){let n=o(this,sn),i=n[4],s=n[5],a=[i,s,i,s],l=i,c=s,u=i,h=s,d=e?Math.max:Math.min,f=new Float32Array(4);for(let m=6,y=n.length;m<y;m+=6){let x=n[m+4],b=n[m+5];isNaN(n[m])?(yt.pointBoundingBox(x,b,a),c>b?(l=x,c=b):c===b&&(l=d(l,x)),h<b?(u=x,h=b):h===b&&(u=d(u,x))):(f[0]=f[1]=1/0,f[2]=f[3]=-1/0,yt.bezierBoundingBox(i,s,...n.slice(m,m+6),f),yt.rectBoundingBox(f[0],f[1],f[2],f[3],a),c>f[1]?(l=f[0],c=f[1]):c===f[1]&&(l=d(l,f[0])),h<f[3]?(u=f[2],h=f[3]):h===f[3]&&(u=d(u,f[2]))),i=x,s=b}let p=o(this,Mc);p[0]=a[0]-o(this,_a),p[1]=a[1]-o(this,_a),p[2]=a[2]-a[0]+2*o(this,_a),p[3]=a[3]-a[1]+2*o(this,_a),this.firstPoint=[l,c],this.lastPoint=[u,h]};dp=class{constructor(t,e=0,n=0,i=!0){A(this,hi);A(this,Hm);A(this,Wm);A(this,qm);A(this,Wo,[]);A(this,qr,[]);let s=[1/0,1/0,-1/0,-1/0],l=10**-4;for(let{x,y:b,width:w,height:C}of t){let E=Math.floor((x-e)/l)*l,S=Math.ceil((x+w+e)/l)*l,N=Math.floor((b-e)/l)*l,k=Math.ceil((b+C+e)/l)*l,M=[E,N,k,!0],R=[S,N,k,!1];o(this,Wo).push(M,R),yt.rectBoundingBox(E,N,S,k,s)}let c=s[2]-s[0]+2*n,u=s[3]-s[1]+2*n,h=s[0]-n,d=s[1]-n,f=i?-1/0:1/0,p=1/0,m=o(this,Wo).at(i?-1:-2),y=[m[0],m[2]];for(let x of o(this,Wo)){let[b,w,C,E]=x;!E&&i?w<p?(p=w,f=b):w===p&&(f=Math.max(f,b)):E&&!i&&(w<p?(p=w,f=b):w===p&&(f=Math.min(f,b))),x[0]=(b-h)/c,x[1]=(w-d)/u,x[2]=(C-d)/u}g(this,Hm,new Float32Array([h,d,c,u])),g(this,Wm,[f,p]),g(this,qm,y)}getOutlines(){o(this,Wo).sort((e,n)=>e[0]-n[0]||e[1]-n[1]||e[2]-n[2]);let t=[];for(let e of o(this,Wo))e[3]?(t.push(...v(this,hi,q2).call(this,e)),v(this,hi,fD).call(this,e)):(v(this,hi,pD).call(this,e),t.push(...v(this,hi,q2).call(this,e)));return v(this,hi,dD).call(this,t)}};Hm=new WeakMap,Wm=new WeakMap,qm=new WeakMap,Wo=new WeakMap,qr=new WeakMap,hi=new WeakSet,dD=function(t){let e=[],n=new Set;for(let a of t){let[l,c,u]=a;e.push([l,c,a],[l,u,a])}e.sort((a,l)=>a[1]-l[1]||a[0]-l[0]);for(let a=0,l=e.length;a<l;a+=2){let c=e[a][2],u=e[a+1][2];c.push(u),u.push(c),n.add(c),n.add(u)}let i=[],s;for(;n.size>0;){let a=n.values().next().value,[l,c,u,h,d]=a;n.delete(a);let f=l,p=c;for(s=[l,u],i.push(s);;){let m;if(n.has(h))m=h;else if(n.has(d))m=d;else break;n.delete(m),[l,c,u,h,d]=m,f!==l&&(s.push(f,p,l,p===c?c:u),f=l),p=p===c?u:c}s.push(f,p)}return new V2(i,o(this,Hm),o(this,Wm),o(this,qm))},V0=function(t){let e=o(this,qr),n=0,i=e.length-1;for(;n<=i;){let s=n+i>>1,a=e[s][0];if(a===t)return s;a<t?n=s+1:i=s-1}return i+1},fD=function([,t,e]){let n=v(this,hi,V0).call(this,t);o(this,qr).splice(n,0,[t,e])},pD=function([,t,e]){let n=v(this,hi,V0).call(this,t);for(let i=n;i<o(this,qr).length;i++){let[s,a]=o(this,qr)[i];if(s!==t)break;if(s===t&&a===e){o(this,qr).splice(i,1);return}}for(let i=n-1;i>=0;i--){let[s,a]=o(this,qr)[i];if(s!==t)break;if(s===t&&a===e){o(this,qr).splice(i,1);return}}},q2=function(t){let[e,n,i]=t,s=[[e,n,i]],a=v(this,hi,V0).call(this,i);for(let l=0;l<a;l++){let[c,u]=o(this,qr)[l];for(let h=0,d=s.length;h<d;h++){let[,f,p]=s[h];if(!(u<=f||p<=c)){if(f>=c){if(p>u)s[h][1]=u;else{if(d===1)return[];s.splice(h,1),h--,d--}continue}s[h][2]=c,p>u&&s.push([e,u,p])}}}return s};V2=class extends Dt{constructor(e,n,i,s){super();A(this,Vm);A(this,ud);g(this,ud,e),g(this,Vm,n),this.firstPoint=i,this.lastPoint=s}toSVGPath(){let e=[];for(let n of o(this,ud)){let[i,s]=n;e.push(`M${i} ${s}`);for(let a=2;a<n.length;a+=2){let l=n[a],c=n[a+1];l===i?(e.push(`V${c}`),s=c):c===s&&(e.push(`H${l}`),i=l)}e.push("Z")}return e.join(" ")}serialize([e,n,i,s],a){let l=[],c=i-e,u=s-n;for(let h of o(this,ud)){let d=new Array(h.length);for(let f=0;f<h.length;f+=2)d[f]=e+h[f]*c,d[f+1]=s-h[f+1]*u;l.push(d)}return l}get box(){return o(this,Vm)}get classNamesForOutlining(){return["highlightOutline"]}};Vm=new WeakMap,ud=new WeakMap;fp=class extends Ny{newFreeDrawOutline(t,e,n,i,s,a){return new X2(t,e,n,i,s,a)}},X2=class extends Iy{newOutliner(t,e,n,i,s,a=0){return new fp(t,e,n,i,s,a)}},oe=class oe extends Te{constructor(e){super({...e,name:"highlightEditor"});A(this,Ht);A(this,hd,null);A(this,Xm,0);A(this,Ma);A(this,Oc,null);A(this,Ym,null);A(this,Ei,null);A(this,Km,null);A(this,Zm,0);A(this,Fc,null);A(this,Hi,null);A(this,Wi,null);A(this,zn,!1);A(this,dd,null);A(this,fd,null);A(this,ti,null);A(this,pd,"");A(this,Cr);A(this,Qm,"");this.color=e.color||oe._defaultColor,g(this,Cr,e.thickness||oe._defaultThickness),this.opacity=e.opacity||oe._defaultOpacity,g(this,Ma,e.boxes||null),g(this,Qm,e.methodOfCreation||""),g(this,pd,e.text||""),this._isDraggable=!1,this.defaultL10nId="pdfjs-editor-highlight-editor",e.highlightId>-1?(g(this,zn,!0),v(this,Ht,X0).call(this,e),v(this,Ht,Cl).call(this)):o(this,Ma)&&(g(this,hd,e.anchorNode),g(this,Xm,e.anchorOffset),g(this,Km,e.focusNode),g(this,Zm,e.focusOffset),v(this,Ht,Y2).call(this),v(this,Ht,Cl).call(this),this.rotate(this.rotation)),this.annotationElementId||this._uiManager.a11yAlert("pdfjs-editor-highlight-added-alert")}static get _keyboardManager(){let e=oe.prototype;return Ut(this,"_keyboardManager",new Kc([[["ArrowLeft","mac+ArrowLeft"],e._moveCaret,{args:[0]}],[["ArrowRight","mac+ArrowRight"],e._moveCaret,{args:[1]}],[["ArrowUp","mac+ArrowUp"],e._moveCaret,{args:[2]}],[["ArrowDown","mac+ArrowDown"],e._moveCaret,{args:[3]}]]))}get telemetryInitialData(){return{action:"added",type:o(this,zn)?"free_highlight":"highlight",color:this._uiManager.getNonHCMColorName(this.color),thickness:o(this,Cr),methodOfCreation:o(this,Qm)}}get telemetryFinalData(){return{type:"highlight",color:this._uiManager.getNonHCMColorName(this.color)}}static computeTelemetryFinalData(e){return{numberOfColors:e.get("color").size}}static initialize(e,n){Te.initialize(e,n),oe._defaultColor||(oe._defaultColor=n.highlightColors?.values().next().value||"#fff066")}static updateDefaultParams(e,n){switch(e){case Zt.HIGHLIGHT_COLOR:oe._defaultColor=n;break;case Zt.HIGHLIGHT_THICKNESS:oe._defaultThickness=n;break}}translateInPage(e,n){}get toolbarPosition(){return o(this,fd)}get commentButtonPosition(){return o(this,dd)}updateParams(e,n){switch(e){case Zt.HIGHLIGHT_COLOR:v(this,Ht,mD).call(this,n);break;case Zt.HIGHLIGHT_THICKNESS:v(this,Ht,gD).call(this,n);break}}static get defaultPropertiesToUpdate(){return[[Zt.HIGHLIGHT_COLOR,oe._defaultColor],[Zt.HIGHLIGHT_THICKNESS,oe._defaultThickness]]}get propertiesToUpdate(){return[[Zt.HIGHLIGHT_COLOR,this.color||oe._defaultColor],[Zt.HIGHLIGHT_THICKNESS,o(this,Cr)||oe._defaultThickness],[Zt.HIGHLIGHT_FREE,o(this,zn)]]}onUpdatedColor(){this.parent?.drawLayer.updateProperties(o(this,Wi),{root:{fill:this.color,"fill-opacity":this.opacity}}),o(this,Ym)?.updateColor(this.color),super.onUpdatedColor()}get toolbarButtons(){return this._uiManager.highlightColors?[["colorPicker",g(this,Ym,new lp({editor:this}))]]:super.toolbarButtons}disableEditing(){super.disableEditing(),this.div.classList.toggle("disabled",!0)}enableEditing(){super.enableEditing(),this.div.classList.toggle("disabled",!1)}fixAndSetPosition(){return super.fixAndSetPosition(v(this,Ht,K0).call(this))}getBaseTranslation(){return[0,0]}getRect(e,n){return super.getRect(e,n,v(this,Ht,K0).call(this))}onceAdded(e){this.annotationElementId||this.parent.addUndoableEditor(this),e&&this.div.focus()}remove(){v(this,Ht,K2).call(this),this._reportTelemetry({action:"deleted"}),super.remove()}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(v(this,Ht,Cl).call(this),this.isAttachedToDOM||this.parent.add(this)))}setParent(e){let n=!1;this.parent&&!e?v(this,Ht,K2).call(this):e&&(v(this,Ht,Cl).call(this,e),n=!this.parent&&this.div?.classList.contains("selectedEditor")),super.setParent(e),this.show(this._isVisible),n&&this.select()}rotate(e){var s,a,l;let{drawLayer:n}=this.parent,i;o(this,zn)?(e=(e-this.rotation+360)%360,i=v(s=oe,Dr,qu).call(s,o(this,Hi).box,e)):i=v(a=oe,Dr,qu).call(a,[this.x,this.y,this.width,this.height],e),n.updateProperties(o(this,Wi),{bbox:i,root:{"data-main-rotation":e}}),n.updateProperties(o(this,ti),{bbox:v(l=oe,Dr,qu).call(l,o(this,Ei).box,e),root:{"data-main-rotation":e}})}render(){if(this.div)return this.div;let e=super.render();o(this,pd)&&(e.setAttribute("aria-label",o(this,pd)),e.setAttribute("role","mark")),o(this,zn)?e.classList.add("free"):this.div.addEventListener("keydown",v(this,Ht,bD).bind(this),{signal:this._uiManager._signal});let n=g(this,Fc,document.createElement("div"));return e.append(n),n.setAttribute("aria-hidden","true"),n.className="internal",n.style.clipPath=o(this,Oc),this.setDims(),jT(this,o(this,Fc),["pointerover","pointerleave"]),this.enableEditing(),e}pointerover(){this.isSelected||this.parent?.drawLayer.updateProperties(o(this,ti),{rootClass:{hovered:!0}})}pointerleave(){this.isSelected||this.parent?.drawLayer.updateProperties(o(this,ti),{rootClass:{hovered:!1}})}_moveCaret(e){switch(this.parent.unselect(this),e){case 0:case 2:v(this,Ht,Y0).call(this,!0);break;case 1:case 3:v(this,Ht,Y0).call(this,!1);break}}select(){super.select(),o(this,ti)&&this.parent?.drawLayer.updateProperties(o(this,ti),{rootClass:{hovered:!1,selected:!0}})}unselect(){super.unselect(),o(this,ti)&&(this.parent?.drawLayer.updateProperties(o(this,ti),{rootClass:{selected:!1}}),o(this,zn)||v(this,Ht,Y0).call(this,!1))}get _mustFixPosition(){return!o(this,zn)}show(e=this._isVisible){super.show(e),this.parent&&(this.parent.drawLayer.updateProperties(o(this,Wi),{rootClass:{hidden:!e}}),this.parent.drawLayer.updateProperties(o(this,ti),{rootClass:{hidden:!e}}))}static startHighlighting(e,n,{target:i,x:s,y:a}){let{x:l,y:c,width:u,height:h}=i.getBoundingClientRect(),d=new AbortController,f=e.combinedSignal(d),p=m=>{d.abort(),v(this,Dr,vD).call(this,e,m)};window.addEventListener("blur",p,{signal:f}),window.addEventListener("pointerup",p,{signal:f}),window.addEventListener("pointerdown",Be,{capture:!0,passive:!1,signal:f}),window.addEventListener("contextmenu",tr,{signal:f}),i.addEventListener("pointermove",v(this,Dr,AD).bind(this,e),{signal:f}),this._freeHighlight=new fp({x:s,y:a},[l,c,u,h],e.scale,this._defaultThickness/2,n,.001),{id:this._freeHighlightId,clipPathId:this._freeHighlightClipId}=e.drawLayer.draw({bbox:[0,0,1,1],root:{viewBox:"0 0 1 1",fill:this._defaultColor,"fill-opacity":this._defaultOpacity},rootClass:{highlight:!0,free:!0},path:{d:this._freeHighlight.toSVGPath()}},!0,!0)}static async deserialize(e,n,i){var x,b,w,C;let s=null;if(e instanceof Ty){let{data:{quadPoints:E,rect:S,rotation:N,id:k,color:M,opacity:R,popupRef:j,richText:$,contentsObj:q,creationDate:Q,modificationDate:Z},parent:{page:{pageNumber:Y}}}=e;s=e={annotationType:Bt.HIGHLIGHT,color:Array.from(M),opacity:R,quadPoints:E,boxes:null,pageIndex:Y-1,rect:S.slice(0),rotation:N,annotationElementId:k,id:k,deleted:!1,popupRef:j,richText:$,comment:q?.str||null,creationDate:Q,modificationDate:Z}}else if(e instanceof hp){let{data:{inkLists:E,rect:S,rotation:N,id:k,color:M,borderStyle:{rawWidth:R},popupRef:j,richText:$,contentsObj:q,creationDate:Q,modificationDate:Z},parent:{page:{pageNumber:Y}}}=e;s=e={annotationType:Bt.HIGHLIGHT,color:Array.from(M),thickness:R,inkLists:E,boxes:null,pageIndex:Y-1,rect:S.slice(0),rotation:N,annotationElementId:k,id:k,deleted:!1,popupRef:j,richText:$,comment:q?.str||null,creationDate:Q,modificationDate:Z}}let{color:a,quadPoints:l,inkLists:c,outlines:u,opacity:h}=e,d=await super.deserialize(e,n,i);d.color=yt.makeHexColor(...a),d.opacity=h||1,c&&g(d,Cr,e.thickness),d._initialData=s,e.comment&&d.setCommentData(e);let[f,p]=d.pageDimensions,[m,y]=d.pageTranslation;if(l){let E=g(d,Ma,[]);for(let S=0;S<l.length;S+=8)E.push({x:(l[S]-m)/f,y:1-(l[S+1]-y)/p,width:(l[S+2]-l[S])/f,height:(l[S+1]-l[S+5])/p});v(x=d,Ht,Y2).call(x),v(b=d,Ht,Cl).call(b),d.rotate(d.rotation)}else if(c||u){g(d,zn,!0);let E=(c||u.points)[0],S={x:E[0]-m,y:p-(E[1]-y)},N=new fp(S,[0,0,f,p],1,o(d,Cr)/2,!0,.001);for(let R=0,j=E.length;R<j;R+=2)S.x=E[R]-m,S.y=p-(E[R+1]-y),N.add(S);let{id:k,clipPathId:M}=n.drawLayer.draw({bbox:[0,0,1,1],root:{viewBox:"0 0 1 1",fill:d.color,"fill-opacity":d._defaultOpacity},rootClass:{highlight:!0,free:!0},path:{d:N.toSVGPath()}},!0,!0);v(w=d,Ht,X0).call(w,{highlightOutlines:N.getOutlines(),highlightId:k,clipPathId:M}),v(C=d,Ht,Cl).call(C),d.rotate(d.parentRotation)}return d}serialize(e=!1){if(this.isEmpty()||e)return null;if(this.deleted)return this.serializeDeleted();let n=Te._colorManager.convert(this._uiManager.getNonHCMColor(this.color)),i=super.serialize(e);return Object.assign(i,{color:n,opacity:this.opacity,thickness:o(this,Cr),quadPoints:v(this,Ht,xD).call(this),outlines:v(this,Ht,wD).call(this,i.rect)}),this.addComment(i),this.annotationElementId&&!v(this,Ht,CD).call(this,i)?null:(i.id=this.annotationElementId,i)}renderAnnotationElement(e){return this.deleted?(e.hide(),null):(e.updateEdited({rect:this.getPDFRect(),popup:this.comment}),null)}static canCreateNewEmptyEditor(){return!1}};hd=new WeakMap,Xm=new WeakMap,Ma=new WeakMap,Oc=new WeakMap,Ym=new WeakMap,Ei=new WeakMap,Km=new WeakMap,Zm=new WeakMap,Fc=new WeakMap,Hi=new WeakMap,Wi=new WeakMap,zn=new WeakMap,dd=new WeakMap,fd=new WeakMap,ti=new WeakMap,pd=new WeakMap,Cr=new WeakMap,Qm=new WeakMap,Ht=new WeakSet,Y2=function(){let e=new dp(o(this,Ma),.001);g(this,Hi,e.getOutlines()),[this.x,this.y,this.width,this.height]=o(this,Hi).box;let n=new dp(o(this,Ma),.0025,.001,this._uiManager.direction==="ltr");g(this,Ei,n.getOutlines());let{firstPoint:i}=o(this,Hi);g(this,dd,[(i[0]-this.x)/this.width,(i[1]-this.y)/this.height]);let{lastPoint:s}=o(this,Ei);g(this,fd,[(s[0]-this.x)/this.width,(s[1]-this.y)/this.height])},X0=function({highlightOutlines:e,highlightId:n,clipPathId:i}){var f,p;if(g(this,Hi,e),g(this,Ei,e.getNewOutline(o(this,Cr)/2+1.5,.0025)),n>=0)g(this,Wi,n),g(this,Oc,i),this.parent.drawLayer.finalizeDraw(n,{bbox:e.box,path:{d:e.toSVGPath()}}),g(this,ti,this.parent.drawLayer.drawOutline({rootClass:{highlightOutline:!0,free:!0},bbox:o(this,Ei).box,path:{d:o(this,Ei).toSVGPath()}},!0));else if(this.parent){let m=this.parent.viewport.rotation;this.parent.drawLayer.updateProperties(o(this,Wi),{bbox:v(f=oe,Dr,qu).call(f,o(this,Hi).box,(m-this.rotation+360)%360),path:{d:e.toSVGPath()}}),this.parent.drawLayer.updateProperties(o(this,ti),{bbox:v(p=oe,Dr,qu).call(p,o(this,Ei).box,m),path:{d:o(this,Ei).toSVGPath()}})}let[a,l,c,u]=e.box;switch(this.rotation){case 0:this.x=a,this.y=l,this.width=c,this.height=u;break;case 90:{let[m,y]=this.parentDimensions;this.x=l,this.y=1-a,this.width=c*y/m,this.height=u*m/y;break}case 180:this.x=1-a,this.y=1-l,this.width=c,this.height=u;break;case 270:{let[m,y]=this.parentDimensions;this.x=1-l,this.y=a,this.width=c*y/m,this.height=u*m/y;break}}let{firstPoint:h}=e;g(this,dd,[(h[0]-a)/c,(h[1]-l)/u]);let{lastPoint:d}=o(this,Ei);g(this,fd,[(d[0]-a)/c,(d[1]-l)/u])},mD=function(e){let n=(a,l)=>{this.color=a,this.opacity=l,this.onUpdatedColor()},i=this.color,s=this.opacity;this.addCommands({cmd:n.bind(this,e,oe._defaultOpacity),undo:n.bind(this,i,s),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:Zt.HIGHLIGHT_COLOR,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"color_changed",color:this._uiManager.getNonHCMColorName(e)},!0)},gD=function(e){let n=o(this,Cr),i=s=>{g(this,Cr,s),v(this,Ht,yD).call(this,s)};this.addCommands({cmd:i.bind(this,e),undo:i.bind(this,n),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:Zt.INK_THICKNESS,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"thickness_changed",thickness:e},!0)},yD=function(e){o(this,zn)&&(v(this,Ht,X0).call(this,{highlightOutlines:o(this,Hi).getNewOutline(e/2)}),this.fixAndSetPosition(),this.setDims())},K2=function(){o(this,Wi)===null||!this.parent||(this.parent.drawLayer.remove(o(this,Wi)),g(this,Wi,null),this.parent.drawLayer.remove(o(this,ti)),g(this,ti,null))},Cl=function(e=this.parent){o(this,Wi)===null&&({id:an(this,Wi)._,clipPathId:an(this,Oc)._}=e.drawLayer.draw({bbox:o(this,Hi).box,root:{viewBox:"0 0 1 1",fill:this.color,"fill-opacity":this.opacity},rootClass:{highlight:!0,free:o(this,zn)},path:{d:o(this,Hi).toSVGPath()}},!1,!0),g(this,ti,e.drawLayer.drawOutline({rootClass:{highlightOutline:!0,free:o(this,zn)},bbox:o(this,Ei).box,path:{d:o(this,Ei).toSVGPath()}},o(this,zn))),o(this,Fc)&&(o(this,Fc).style.clipPath=o(this,Oc)))},Dr=new WeakSet,qu=function([e,n,i,s],a){switch(a){case 90:return[1-n-s,e,s,i];case 180:return[1-e-i,1-n-s,i,s];case 270:return[n,1-e-i,s,i]}return[e,n,i,s]},bD=function(e){oe._keyboardManager.exec(this,e)},Y0=function(e){if(!o(this,hd))return;let n=window.getSelection();e?n.setPosition(o(this,hd),o(this,Xm)):n.setPosition(o(this,Km),o(this,Zm))},K0=function(){return o(this,zn)?this.rotation:0},xD=function(){if(o(this,zn))return null;let[e,n]=this.pageDimensions,[i,s]=this.pageTranslation,a=o(this,Ma),l=new Float32Array(a.length*8),c=0;for(let{x:u,y:h,width:d,height:f}of a){let p=u*e+i,m=(1-h)*n+s;l[c]=l[c+4]=p,l[c+1]=l[c+3]=m,l[c+2]=l[c+6]=p+d*e,l[c+5]=l[c+7]=m-f*n,c+=8}return l},wD=function(e){return o(this,Hi).serialize(e,v(this,Ht,K0).call(this))},AD=function(e,n){this._freeHighlight.add(n)&&e.drawLayer.updateProperties(this._freeHighlightId,{path:{d:this._freeHighlight.toSVGPath()}})},vD=function(e,n){this._freeHighlight.isEmpty()?e.drawLayer.remove(this._freeHighlightId):e.createAndAddNewEditor(n,!1,{highlightId:this._freeHighlightId,highlightOutlines:this._freeHighlight.getOutlines(),clipPathId:this._freeHighlightClipId,methodOfCreation:"main_toolbar"}),this._freeHighlightId=-1,this._freeHighlight=null,this._freeHighlightClipId=""},CD=function(e){let{color:n}=this._initialData;return this.hasEditedComment||e.color.some((i,s)=>i!==n[s])},A(oe,Dr),U(oe,"_defaultColor",null),U(oe,"_defaultOpacity",1),U(oe,"_defaultThickness",12),U(oe,"_type","highlight"),U(oe,"_editorType",Bt.HIGHLIGHT),U(oe,"_freeHighlightId",-1),U(oe,"_freeHighlight",null),U(oe,"_freeHighlightClipId","");ky=oe,_y=class{constructor(){A(this,Pc,Object.create(null))}updateProperty(t,e){this[t]=e,this.updateSVGProperty(t,e)}updateProperties(t){if(t)for(let[e,n]of Object.entries(t))e.startsWith("_")||this.updateProperty(e,n)}updateSVGProperty(t,e){o(this,Pc)[t]=e}toSVGProperties(){let t=o(this,Pc);return g(this,Pc,Object.create(null)),{root:t}}reset(){g(this,Pc,Object.create(null))}updateAll(t=this){this.updateProperties(t)}clone(){ue("Not implemented")}};Pc=new WeakMap;Kt=class Kt extends Te{constructor(e){super(e);A(this,ie);A(this,qi,null);A(this,md);U(this,"_colorPicker",null);U(this,"_drawId",null);g(this,md,e.mustBeCommitted||!1),this._addOutlines(e)}onUpdatedColor(){this._colorPicker?.update(this.color),super.onUpdatedColor()}_addOutlines(e){e.drawOutlines&&(v(this,ie,Z2).call(this,e),v(this,ie,jf).call(this))}static _mergeSVGProperties(e,n){let i=new Set(Object.keys(e));for(let[s,a]of Object.entries(n))i.has(s)?Object.assign(e[s],a):e[s]=a;return e}static getDefaultDrawingOptions(e){ue("Not implemented")}static get typesMap(){ue("Not implemented")}static get isDrawer(){return!0}static get supportMultipleDrawings(){return!1}static updateDefaultParams(e,n){let i=this.typesMap.get(e);i&&this._defaultDrawingOptions.updateProperty(i,n),this._currentParent&&(o(Kt,Tn).updateProperty(i,n),this._currentParent.drawLayer.updateProperties(this._currentDrawId,this._defaultDrawingOptions.toSVGProperties()))}updateParams(e,n){let i=this.constructor.typesMap.get(e);i&&this._updateProperty(e,i,n)}static get defaultPropertiesToUpdate(){let e=[],n=this._defaultDrawingOptions;for(let[i,s]of this.typesMap)e.push([i,n[s]]);return e}get propertiesToUpdate(){let e=[],{_drawingOptions:n}=this;for(let[i,s]of this.constructor.typesMap)e.push([i,n[s]]);return e}_updateProperty(e,n,i){let s=this._drawingOptions,a=s[n],l=c=>{s.updateProperty(n,c);let u=o(this,qi).updateProperty(n,c);u&&v(this,ie,Gf).call(this,u),this.parent?.drawLayer.updateProperties(this._drawId,s.toSVGProperties()),e===this.colorType&&this.onUpdatedColor()};this.addCommands({cmd:l.bind(this,i),undo:l.bind(this,a),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:e,overwriteIfSameType:!0,keepUndo:!0})}_onResizing(){this.parent?.drawLayer.updateProperties(this._drawId,Kt._mergeSVGProperties(o(this,qi).getPathResizingSVGProperties(v(this,ie,Z0).call(this)),{bbox:v(this,ie,Vu).call(this)}))}_onResized(){this.parent?.drawLayer.updateProperties(this._drawId,Kt._mergeSVGProperties(o(this,qi).getPathResizedSVGProperties(v(this,ie,Z0).call(this)),{bbox:v(this,ie,Vu).call(this)}))}_onTranslating(e,n){this.parent?.drawLayer.updateProperties(this._drawId,{bbox:v(this,ie,Vu).call(this)})}_onTranslated(){this.parent?.drawLayer.updateProperties(this._drawId,Kt._mergeSVGProperties(o(this,qi).getPathTranslatedSVGProperties(v(this,ie,Z0).call(this),this.parentDimensions),{bbox:v(this,ie,Vu).call(this)}))}_onStartDragging(){this.parent?.drawLayer.updateProperties(this._drawId,{rootClass:{moving:!0}})}_onStopDragging(){this.parent?.drawLayer.updateProperties(this._drawId,{rootClass:{moving:!1}})}commit(){super.commit(),this.disableEditMode(),this.disableEditing()}disableEditing(){super.disableEditing(),this.div.classList.toggle("disabled",!0)}enableEditing(){super.enableEditing(),this.div.classList.toggle("disabled",!1)}getBaseTranslation(){return[0,0]}get isResizable(){return!0}onceAdded(e){this.annotationElementId||this.parent.addUndoableEditor(this),this._isDraggable=!0,o(this,md)&&(g(this,md,!1),this.commit(),this.parent.setSelected(this),e&&this.isOnScreen&&this.div.focus())}remove(){v(this,ie,J2).call(this),super.remove()}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(v(this,ie,jf).call(this),v(this,ie,Gf).call(this,o(this,qi).box),this.isAttachedToDOM||this.parent.add(this)))}setParent(e){let n=!1;this.parent&&!e?(this._uiManager.removeShouldRescale(this),v(this,ie,J2).call(this)):e&&(this._uiManager.addShouldRescale(this),v(this,ie,jf).call(this,e),n=!this.parent&&this.div?.classList.contains("selectedEditor")),super.setParent(e),n&&this.select()}rotate(){this.parent&&this.parent.drawLayer.updateProperties(this._drawId,Kt._mergeSVGProperties({bbox:v(this,ie,Vu).call(this)},o(this,qi).updateRotation((this.parentRotation-this.rotation+360)%360)))}onScaleChanging(){this.parent&&v(this,ie,Gf).call(this,o(this,qi).updateParentDimensions(this.parentDimensions,this.parent.scale))}static onScaleChangingWhenDrawing(){}render(){if(this.div)return this.div;let e,n;this._isCopy&&(e=this.x,n=this.y);let i=super.render();i.classList.add("draw");let s=document.createElement("div");return i.append(s),s.setAttribute("aria-hidden","true"),s.className="internal",this.setDims(),this._uiManager.addShouldRescale(this),this.disableEditing(),this._isCopy&&this._moveAfterPaste(e,n),i}static createDrawerInstance(e,n,i,s,a){ue("Not implemented")}static startDrawing(e,n,i,s){let{target:a,offsetX:l,offsetY:c,pointerId:u,pointerType:h}=s;if(Kn.isInitializedAndDifferentPointerType(h))return;let{viewport:{rotation:d}}=e,{width:f,height:p}=a.getBoundingClientRect(),m=g(Kt,Rc,new AbortController),y=e.combinedSignal(m);if(Kn.setPointer(h,u),window.addEventListener("pointerup",x=>{Kn.isSamePointerIdOrRemove(x.pointerId)&&this._endDraw(x)},{signal:y}),window.addEventListener("pointercancel",x=>{Kn.isSamePointerIdOrRemove(x.pointerId)&&this._currentParent.endDrawingSession()},{signal:y}),window.addEventListener("pointerdown",x=>{Kn.isSamePointerType(x.pointerType)&&(Kn.initializeAndAddPointerId(x.pointerId),o(Kt,Tn).isCancellable()&&(o(Kt,Tn).removeLastElement(),o(Kt,Tn).isEmpty()?this._currentParent.endDrawingSession(!0):this._endDraw(null)))},{capture:!0,passive:!1,signal:y}),window.addEventListener("contextmenu",tr,{signal:y}),a.addEventListener("pointermove",this._drawMove.bind(this),{signal:y}),a.addEventListener("touchmove",x=>{Kn.isSameTimeStamp(x.timeStamp)&&Be(x)},{signal:y}),e.toggleDrawing(),n._editorUndoBar?.hide(),o(Kt,Tn)){e.drawLayer.updateProperties(this._currentDrawId,o(Kt,Tn).startNew(l,c,f,p,d));return}n.updateUIForDefaultProperties(this),g(Kt,Tn,this.createDrawerInstance(l,c,f,p,d)),g(Kt,Lc,this.getDefaultDrawingOptions()),this._currentParent=e,{id:this._currentDrawId}=e.drawLayer.draw(this._mergeSVGProperties(o(Kt,Lc).toSVGProperties(),o(Kt,Tn).defaultSVGProperties),!0,!1)}static _drawMove(e){if(Kn.isSameTimeStamp(e.timeStamp),!o(Kt,Tn))return;let{offsetX:n,offsetY:i,pointerId:s}=e;if(Kn.isSamePointerId(s)){if(Kn.isUsingMultiplePointers()){this._endDraw(e);return}this._currentParent.drawLayer.updateProperties(this._currentDrawId,o(Kt,Tn).add(n,i)),Kn.setTimeStamp(e.timeStamp),Be(e)}}static _cleanup(e){e&&(this._currentDrawId=-1,this._currentParent=null,g(Kt,Tn,null),g(Kt,Lc,null),Kn.clearTimeStamp()),o(Kt,Rc)&&(o(Kt,Rc).abort(),g(Kt,Rc,null),Kn.clearPointerIds())}static _endDraw(e){let n=this._currentParent;if(n){if(n.toggleDrawing(!0),this._cleanup(!1),e?.target===n.div&&n.drawLayer.updateProperties(this._currentDrawId,o(Kt,Tn).end(e.offsetX,e.offsetY)),this.supportMultipleDrawings){let i=o(Kt,Tn),s=this._currentDrawId,a=i.getLastElement();n.addCommands({cmd:()=>{n.drawLayer.updateProperties(s,i.setLastElement(a))},undo:()=>{n.drawLayer.updateProperties(s,i.removeLastElement())},mustExec:!1,type:Zt.DRAW_STEP});return}this.endDrawing(!1)}}static endDrawing(e){let n=this._currentParent;if(!n)return null;if(n.toggleDrawing(!0),n.cleanUndoStack(Zt.DRAW_STEP),!o(Kt,Tn).isEmpty()){let{pageDimensions:[i,s],scale:a}=n,l=n.createAndAddNewEditor({offsetX:0,offsetY:0},!1,{drawId:this._currentDrawId,drawOutlines:o(Kt,Tn).getOutlines(i*a,s*a,a,this._INNER_MARGIN),drawingOptions:o(Kt,Lc),mustBeCommitted:!e});return this._cleanup(!0),l}return n.drawLayer.remove(this._currentDrawId),this._cleanup(!0),null}createDrawingOptions(e){}static deserializeDraw(e,n,i,s,a,l){ue("Not implemented")}static async deserialize(e,n,i){var d,f;let{rawDims:{pageWidth:s,pageHeight:a,pageX:l,pageY:c}}=n.viewport,u=this.deserializeDraw(l,c,s,a,this._INNER_MARGIN,e),h=await super.deserialize(e,n,i);return h.createDrawingOptions(e),v(d=h,ie,Z2).call(d,{drawOutlines:u}),v(f=h,ie,jf).call(f),h.onScaleChanging(),h.rotate(),h}serializeDraw(e){let[n,i]=this.pageTranslation,[s,a]=this.pageDimensions;return o(this,qi).serialize([n,i,s,a],e)}renderAnnotationElement(e){return e.updateEdited({rect:this.getPDFRect()}),null}static canCreateNewEmptyEditor(){return!1}};qi=new WeakMap,md=new WeakMap,Tn=new WeakMap,Rc=new WeakMap,Lc=new WeakMap,ie=new WeakSet,Z2=function({drawOutlines:e,drawId:n,drawingOptions:i}){g(this,qi,e),this._drawingOptions||(this._drawingOptions=i),this.annotationElementId||this._uiManager.a11yAlert(`pdfjs-editor-${this.editorType}-added-alert`),n>=0?(this._drawId=n,this.parent.drawLayer.finalizeDraw(n,e.defaultProperties)):this._drawId=v(this,ie,Q2).call(this,e,this.parent),v(this,ie,Gf).call(this,e.box)},Q2=function(e,n){let{id:i}=n.drawLayer.draw(Kt._mergeSVGProperties(this._drawingOptions.toSVGProperties(),e.defaultSVGProperties),!1,!1);return i},J2=function(){this._drawId===null||!this.parent||(this.parent.drawLayer.remove(this._drawId),this._drawId=null,this._drawingOptions.reset())},jf=function(e=this.parent){if(!(this._drawId!==null&&this.parent===e)){if(this._drawId!==null){this.parent.drawLayer.updateParent(this._drawId,e.drawLayer);return}this._drawingOptions.updateAll(),this._drawId=v(this,ie,Q2).call(this,o(this,qi),e)}},ED=function([e,n,i,s]){let{parentDimensions:[a,l],rotation:c}=this;switch(c){case 90:return[n,1-e,i*(l/a),s*(a/l)];case 180:return[1-e,1-n,i,s];case 270:return[1-n,e,i*(l/a),s*(a/l)];default:return[e,n,i,s]}},Z0=function(){let{x:e,y:n,width:i,height:s,parentDimensions:[a,l],rotation:c}=this;switch(c){case 90:return[1-n,e,i*(a/l),s*(l/a)];case 180:return[1-e,1-n,i,s];case 270:return[n,1-e,i*(a/l),s*(l/a)];default:return[e,n,i,s]}},Gf=function(e){[this.x,this.y,this.width,this.height]=v(this,ie,ED).call(this,e),this.div&&(this.fixAndSetPosition(),this.setDims()),this._onResized()},Vu=function(){let{x:e,y:n,width:i,height:s,rotation:a,parentRotation:l,parentDimensions:[c,u]}=this;switch((a*4+l)/90){case 1:return[1-n-s,e,s,i];case 2:return[1-e-i,1-n-s,i,s];case 3:return[n,1-e-i,s,i];case 4:return[e,n-i*(c/u),s*(u/c),i*(c/u)];case 5:return[1-n,e,i*(c/u),s*(u/c)];case 6:return[1-e-s*(u/c),1-n,s*(u/c),i*(c/u)];case 7:return[n-i*(c/u),1-e-s*(u/c),i*(c/u),s*(u/c)];case 8:return[e-i,n-s,i,s];case 9:return[1-n,e-i,s,i];case 10:return[1-e,1-n,i,s];case 11:return[n-s,1-e,s,i];case 12:return[e-s*(u/c),n,s*(u/c),i*(c/u)];case 13:return[1-n-i*(c/u),e-s*(u/c),i*(c/u),s*(u/c)];case 14:return[1-e,1-n-i*(c/u),s*(u/c),i*(c/u)];case 15:return[n,1-e,i*(c/u),s*(u/c)];default:return[e,n,i,s]}},U(Kt,"_currentDrawId",-1),U(Kt,"_currentParent",null),A(Kt,Tn,null),A(Kt,Rc,null),A(Kt,Lc,null),U(Kt,"_INNER_MARGIN",3);My=Kt,tA=class{constructor(t,e,n,i,s,a){A(this,yd);A(this,ks,new Float64Array(6));A(this,Sn);A(this,Dn);A(this,Bc);A(this,gd);A(this,oi);A(this,jn,"");A(this,Er,0);A(this,Uc,new Jc);A(this,$c);A(this,zc);g(this,$c,n),g(this,zc,i),g(this,Bc,s),g(this,gd,a),[t,e]=v(this,yd,Q0).call(this,t,e);let l=g(this,Sn,[NaN,NaN,NaN,NaN,t,e]);g(this,oi,[t,e]),g(this,Dn,[{line:l,points:o(this,oi)}]),o(this,ks).set(l,0)}updateProperty(t,e){t==="stroke-width"&&g(this,gd,e)}isEmpty(){return!o(this,Dn)||o(this,Dn).length===0}isCancellable(){return o(this,oi).length<=10}add(t,e){[t,e]=v(this,yd,Q0).call(this,t,e);let[n,i,s,a]=o(this,ks).subarray(2,6),l=t-s,c=e-a;return Math.hypot(o(this,$c)*l,o(this,zc)*c)<=2?null:(o(this,oi).push(t,e),isNaN(n)?(o(this,ks).set([s,a,t,e],2),o(this,Sn).push(NaN,NaN,NaN,NaN,t,e),{path:{d:this.toSVGPath()}}):(isNaN(o(this,ks)[0])&&o(this,Sn).splice(6,6),o(this,ks).set([n,i,s,a,t,e],0),o(this,Sn).push(...Dt.createBezierPoints(n,i,s,a,t,e)),{path:{d:this.toSVGPath()}}))}end(t,e){let n=this.add(t,e);return n||(o(this,oi).length===2?{path:{d:this.toSVGPath()}}:null)}startNew(t,e,n,i,s){g(this,$c,n),g(this,zc,i),g(this,Bc,s),[t,e]=v(this,yd,Q0).call(this,t,e);let a=g(this,Sn,[NaN,NaN,NaN,NaN,t,e]);g(this,oi,[t,e]);let l=o(this,Dn).at(-1);return l&&(l.line=new Float32Array(l.line),l.points=new Float32Array(l.points)),o(this,Dn).push({line:a,points:o(this,oi)}),o(this,ks).set(a,0),g(this,Er,0),this.toSVGPath(),null}getLastElement(){return o(this,Dn).at(-1)}setLastElement(t){return o(this,Dn)?(o(this,Dn).push(t),g(this,Sn,t.line),g(this,oi,t.points),g(this,Er,0),{path:{d:this.toSVGPath()}}):o(this,Uc).setLastElement(t)}removeLastElement(){if(!o(this,Dn))return o(this,Uc).removeLastElement();o(this,Dn).pop(),g(this,jn,"");for(let t=0,e=o(this,Dn).length;t<e;t++){let{line:n,points:i}=o(this,Dn)[t];g(this,Sn,n),g(this,oi,i),g(this,Er,0),this.toSVGPath()}return{path:{d:o(this,jn)}}}toSVGPath(){let t=Dt.svgRound(o(this,Sn)[4]),e=Dt.svgRound(o(this,Sn)[5]);if(o(this,oi).length===2)return g(this,jn,`${o(this,jn)} M ${t} ${e} Z`),o(this,jn);if(o(this,oi).length<=6){let i=o(this,jn).lastIndexOf("M");g(this,jn,`${o(this,jn).slice(0,i)} M ${t} ${e}`),g(this,Er,6)}if(o(this,oi).length===4){let i=Dt.svgRound(o(this,Sn)[10]),s=Dt.svgRound(o(this,Sn)[11]);return g(this,jn,`${o(this,jn)} L ${i} ${s}`),g(this,Er,12),o(this,jn)}let n=[];o(this,Er)===0&&(n.push(`M ${t} ${e}`),g(this,Er,6));for(let i=o(this,Er),s=o(this,Sn).length;i<s;i+=6){let[a,l,c,u,h,d]=o(this,Sn).slice(i,i+6).map(Dt.svgRound);n.push(`C${a} ${l} ${c} ${u} ${h} ${d}`)}return g(this,jn,o(this,jn)+n.join(" ")),g(this,Er,o(this,Sn).length),o(this,jn)}getOutlines(t,e,n,i){let s=o(this,Dn).at(-1);return s.line=new Float32Array(s.line),s.points=new Float32Array(s.points),o(this,Uc).build(o(this,Dn),t,e,n,o(this,Bc),o(this,gd),i),g(this,ks,null),g(this,Sn,null),g(this,Dn,null),g(this,jn,null),o(this,Uc)}get defaultSVGProperties(){return{root:{viewBox:"0 0 10000 10000"},rootClass:{draw:!0},bbox:[0,0,1,1]}}};ks=new WeakMap,Sn=new WeakMap,Dn=new WeakMap,Bc=new WeakMap,gd=new WeakMap,oi=new WeakMap,jn=new WeakMap,Er=new WeakMap,Uc=new WeakMap,$c=new WeakMap,zc=new WeakMap,yd=new WeakSet,Q0=function(t,e){return Dt._normalizePoint(t,e,o(this,$c),o(this,zc),o(this,Bc))};Jc=class extends Dt{constructor(){super(...arguments);A(this,Hn);A(this,li);A(this,Jm,0);A(this,tg);A(this,Vi);A(this,_s);A(this,Ms);A(this,bd);A(this,xd);A(this,jc)}build(e,n,i,s,a,l,c){g(this,_s,n),g(this,Ms,i),g(this,bd,s),g(this,xd,a),g(this,jc,l),g(this,tg,c??0),g(this,Vi,e),v(this,Hn,SD).call(this)}get thickness(){return o(this,jc)}setLastElement(e){return o(this,Vi).push(e),{path:{d:this.toSVGPath()}}}removeLastElement(){return o(this,Vi).pop(),{path:{d:this.toSVGPath()}}}toSVGPath(){let e=[];for(let{line:n}of o(this,Vi)){if(e.push(`M${Dt.svgRound(n[4])} ${Dt.svgRound(n[5])}`),n.length===6){e.push("Z");continue}if(n.length===12&&isNaN(n[6])){e.push(`L${Dt.svgRound(n[10])} ${Dt.svgRound(n[11])}`);continue}for(let i=6,s=n.length;i<s;i+=6){let[a,l,c,u,h,d]=n.subarray(i,i+6).map(Dt.svgRound);e.push(`C${a} ${l} ${c} ${u} ${h} ${d}`)}}return e.join("")}serialize([e,n,i,s],a){let l=[],c=[],[u,h,d,f]=v(this,Hn,TD).call(this),p,m,y,x,b,w,C,E,S;switch(o(this,xd)){case 0:S=Dt._rescale,p=e,m=n+s,y=i,x=-s,b=e+u*i,w=n+(1-h-f)*s,C=e+(u+d)*i,E=n+(1-h)*s;break;case 90:S=Dt._rescaleAndSwap,p=e,m=n,y=i,x=s,b=e+h*i,w=n+u*s,C=e+(h+f)*i,E=n+(u+d)*s;break;case 180:S=Dt._rescale,p=e+i,m=n,y=-i,x=s,b=e+(1-u-d)*i,w=n+h*s,C=e+(1-u)*i,E=n+(h+f)*s;break;case 270:S=Dt._rescaleAndSwap,p=e+i,m=n+s,y=-i,x=-s,b=e+(1-h-f)*i,w=n+(1-u-d)*s,C=e+(1-h)*i,E=n+(1-u)*s;break}for(let{line:N,points:k}of o(this,Vi))l.push(S(N,p,m,y,x,a?new Array(N.length):null)),c.push(S(k,p,m,y,x,a?new Array(k.length):null));return{lines:l,points:c,rect:[b,w,C,E]}}static deserialize(e,n,i,s,a,{paths:{lines:l,points:c},rotation:u,thickness:h}){let d=[],f,p,m,y,x;switch(u){case 0:x=Dt._rescale,f=-e/i,p=n/s+1,m=1/i,y=-1/s;break;case 90:x=Dt._rescaleAndSwap,f=-n/s,p=-e/i,m=1/s,y=1/i;break;case 180:x=Dt._rescale,f=e/i+1,p=-n/s,m=-1/i,y=1/s;break;case 270:x=Dt._rescaleAndSwap,f=n/s+1,p=e/i+1,m=-1/s,y=-1/i;break}if(!l){l=[];for(let w of c){let C=w.length;if(C===2){l.push(new Float32Array([NaN,NaN,NaN,NaN,w[0],w[1]]));continue}if(C===4){l.push(new Float32Array([NaN,NaN,NaN,NaN,w[0],w[1],NaN,NaN,NaN,NaN,w[2],w[3]]));continue}let E=new Float32Array(3*(C-2));l.push(E);let[S,N,k,M]=w.subarray(0,4);E.set([NaN,NaN,NaN,NaN,S,N],0);for(let R=4;R<C;R+=2){let j=w[R],$=w[R+1];E.set(Dt.createBezierPoints(S,N,k,M,j,$),(R-2)*3),[S,N,k,M]=[k,M,j,$]}}}for(let w=0,C=l.length;w<C;w++)d.push({line:x(l[w].map(E=>E??NaN),f,p,m,y),points:x(c[w].map(E=>E??NaN),f,p,m,y)});let b=new this.prototype.constructor;return b.build(d,i,s,1,u,h,a),b}get box(){return o(this,li)}updateProperty(e,n){return e==="stroke-width"?v(this,Hn,DD).call(this,n):null}updateParentDimensions([e,n],i){let[s,a]=v(this,Hn,na).call(this);g(this,_s,e),g(this,Ms,n),g(this,bd,i);let[l,c]=v(this,Hn,na).call(this),u=l-s,h=c-a,d=o(this,li);return d[0]-=u,d[1]-=h,d[2]+=2*u,d[3]+=2*h,d}updateRotation(e){return g(this,Jm,e),{path:{transform:this.rotationTransform}}}get viewBox(){return o(this,li).map(Dt.svgRound).join(" ")}get defaultProperties(){let[e,n]=o(this,li);return{root:{viewBox:this.viewBox},path:{"transform-origin":`${Dt.svgRound(e)} ${Dt.svgRound(n)}`}}}get rotationTransform(){let[,,e,n]=o(this,li),i=0,s=0,a=0,l=0,c=0,u=0;switch(o(this,Jm)){case 90:s=n/e,a=-e/n,c=e;break;case 180:i=-1,l=-1,c=e,u=n;break;case 270:s=-n/e,a=e/n,u=n;break;default:return""}return`matrix(${i} ${s} ${a} ${l} ${Dt.svgRound(c)} ${Dt.svgRound(u)})`}getPathResizingSVGProperties([e,n,i,s]){let[a,l]=v(this,Hn,na).call(this),[c,u,h,d]=o(this,li);if(Math.abs(h-a)<=Dt.PRECISION||Math.abs(d-l)<=Dt.PRECISION){let x=e+i/2-(c+h/2),b=n+s/2-(u+d/2);return{path:{"transform-origin":`${Dt.svgRound(e)} ${Dt.svgRound(n)}`,transform:`${this.rotationTransform} translate(${x} ${b})`}}}let f=(i-2*a)/(h-2*a),p=(s-2*l)/(d-2*l),m=h/i,y=d/s;return{path:{"transform-origin":`${Dt.svgRound(c)} ${Dt.svgRound(u)}`,transform:`${this.rotationTransform} scale(${m} ${y}) translate(${Dt.svgRound(a)} ${Dt.svgRound(l)}) scale(${f} ${p}) translate(${Dt.svgRound(-a)} ${Dt.svgRound(-l)})`}}}getPathResizedSVGProperties([e,n,i,s]){let[a,l]=v(this,Hn,na).call(this),c=o(this,li),[u,h,d,f]=c;if(c[0]=e,c[1]=n,c[2]=i,c[3]=s,Math.abs(d-a)<=Dt.PRECISION||Math.abs(f-l)<=Dt.PRECISION){let b=e+i/2-(u+d/2),w=n+s/2-(h+f/2);for(let{line:C,points:E}of o(this,Vi))Dt._translate(C,b,w,C),Dt._translate(E,b,w,E);return{root:{viewBox:this.viewBox},path:{"transform-origin":`${Dt.svgRound(e)} ${Dt.svgRound(n)}`,transform:this.rotationTransform||null,d:this.toSVGPath()}}}let p=(i-2*a)/(d-2*a),m=(s-2*l)/(f-2*l),y=-p*(u+a)+e+a,x=-m*(h+l)+n+l;if(p!==1||m!==1||y!==0||x!==0)for(let{line:b,points:w}of o(this,Vi))Dt._rescale(b,y,x,p,m,b),Dt._rescale(w,y,x,p,m,w);return{root:{viewBox:this.viewBox},path:{"transform-origin":`${Dt.svgRound(e)} ${Dt.svgRound(n)}`,transform:this.rotationTransform||null,d:this.toSVGPath()}}}getPathTranslatedSVGProperties([e,n],i){let[s,a]=i,l=o(this,li),c=e-l[0],u=n-l[1];if(o(this,_s)===s&&o(this,Ms)===a)for(let{line:h,points:d}of o(this,Vi))Dt._translate(h,c,u,h),Dt._translate(d,c,u,d);else{let h=o(this,_s)/s,d=o(this,Ms)/a;g(this,_s,s),g(this,Ms,a);for(let{line:f,points:p}of o(this,Vi))Dt._rescale(f,c,u,h,d,f),Dt._rescale(p,c,u,h,d,p);l[2]*=h,l[3]*=d}return l[0]=e,l[1]=n,{root:{viewBox:this.viewBox},path:{d:this.toSVGPath(),"transform-origin":`${Dt.svgRound(e)} ${Dt.svgRound(n)}`}}}get defaultSVGProperties(){let e=o(this,li);return{root:{viewBox:this.viewBox},rootClass:{draw:!0},path:{d:this.toSVGPath(),"transform-origin":`${Dt.svgRound(e[0])} ${Dt.svgRound(e[1])}`,transform:this.rotationTransform||null},bbox:e}}};li=new WeakMap,Jm=new WeakMap,tg=new WeakMap,Vi=new WeakMap,_s=new WeakMap,Ms=new WeakMap,bd=new WeakMap,xd=new WeakMap,jc=new WeakMap,Hn=new WeakSet,na=function(e=o(this,jc)){let n=o(this,tg)+e/2*o(this,bd);return o(this,xd)%180===0?[n/o(this,_s),n/o(this,Ms)]:[n/o(this,Ms),n/o(this,_s)]},TD=function(){let[e,n,i,s]=o(this,li),[a,l]=v(this,Hn,na).call(this,0);return[e+a,n+l,i-2*a,s-2*l]},SD=function(){let e=g(this,li,new Float32Array([1/0,1/0,-1/0,-1/0]));for(let{line:s}of o(this,Vi)){if(s.length<=12){for(let c=4,u=s.length;c<u;c+=6)yt.pointBoundingBox(s[c],s[c+1],e);continue}let a=s[4],l=s[5];for(let c=6,u=s.length;c<u;c+=6){let[h,d,f,p,m,y]=s.subarray(c,c+6);yt.bezierBoundingBox(a,l,h,d,f,p,m,y,e),a=m,l=y}}let[n,i]=v(this,Hn,na).call(this);e[0]=yn(e[0]-n,0,1),e[1]=yn(e[1]-i,0,1),e[2]=yn(e[2]+n,0,1),e[3]=yn(e[3]+i,0,1),e[2]-=e[0],e[3]-=e[1]},DD=function(e){let[n,i]=v(this,Hn,na).call(this);g(this,jc,e);let[s,a]=v(this,Hn,na).call(this),[l,c]=[s-n,a-i],u=o(this,li);return u[0]-=l,u[1]-=c,u[2]+=2*l,u[3]+=2*c,u};Oy=class r extends _y{constructor(t){super(),this._viewParameters=t,super.updateProperties({fill:"none",stroke:Te._defaultLineColor,"stroke-opacity":1,"stroke-width":1,"stroke-linecap":"round","stroke-linejoin":"round","stroke-miterlimit":10})}updateSVGProperty(t,e){t==="stroke-width"&&(e??(e=this["stroke-width"]),e*=this._viewParameters.realScale),super.updateSVGProperty(t,e)}clone(){let t=new r(this._viewParameters);return t.updateAll(this),t}},Qu=class Qu extends My{constructor(e){super({...e,name:"inkEditor"});A(this,ib);this._willKeepAspectRatio=!0,this.defaultL10nId="pdfjs-editor-ink-editor"}static initialize(e,n){Te.initialize(e,n),this._defaultDrawingOptions=new Oy(n.viewParameters)}static getDefaultDrawingOptions(e){let n=this._defaultDrawingOptions.clone();return n.updateProperties(e),n}static get supportMultipleDrawings(){return!0}static get typesMap(){return Ut(this,"typesMap",new Map([[Zt.INK_THICKNESS,"stroke-width"],[Zt.INK_COLOR,"stroke"],[Zt.INK_OPACITY,"stroke-opacity"]]))}static createDrawerInstance(e,n,i,s,a){return new tA(e,n,i,s,a,this._defaultDrawingOptions["stroke-width"])}static deserializeDraw(e,n,i,s,a,l){return Jc.deserialize(e,n,i,s,a,l)}static async deserialize(e,n,i){let s=null;if(e instanceof hp){let{data:{inkLists:l,rect:c,rotation:u,id:h,color:d,opacity:f,borderStyle:{rawWidth:p},popupRef:m,richText:y,contentsObj:x,creationDate:b,modificationDate:w},parent:{page:{pageNumber:C}}}=e;s=e={annotationType:Bt.INK,color:Array.from(d),thickness:p,opacity:f,paths:{points:l},boxes:null,pageIndex:C-1,rect:c.slice(0),rotation:u,annotationElementId:h,id:h,deleted:!1,popupRef:m,richText:y,comment:x?.str||null,creationDate:b,modificationDate:w}}let a=await super.deserialize(e,n,i);return a._initialData=s,e.comment&&a.setCommentData(e),a}get toolbarButtons(){return this._colorPicker||(this._colorPicker=new wy(this)),[["colorPicker",this._colorPicker]]}get colorType(){return Zt.INK_COLOR}get color(){return this._drawingOptions.stroke}get opacity(){return this._drawingOptions["stroke-opacity"]}onScaleChanging(){if(!this.parent)return;super.onScaleChanging();let{_drawId:e,_drawingOptions:n,parent:i}=this;n.updateSVGProperty("stroke-width"),i.drawLayer.updateProperties(e,n.toSVGProperties())}static onScaleChangingWhenDrawing(){let e=this._currentParent;e&&(super.onScaleChangingWhenDrawing(),this._defaultDrawingOptions.updateSVGProperty("stroke-width"),e.drawLayer.updateProperties(this._currentDrawId,this._defaultDrawingOptions.toSVGProperties()))}createDrawingOptions({color:e,thickness:n,opacity:i}){this._drawingOptions=Qu.getDefaultDrawingOptions({stroke:yt.makeHexColor(...e),"stroke-width":n,"stroke-opacity":i})}serialize(e=!1){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();let{lines:n,points:i}=this.serializeDraw(e),{_drawingOptions:{stroke:s,"stroke-opacity":a,"stroke-width":l}}=this,c=Object.assign(super.serialize(e),{color:Te._colorManager.convert(s),opacity:a,thickness:l,paths:{lines:n,points:i}});return this.addComment(c),e?(c.isCopy=!0,c):this.annotationElementId&&!v(this,ib,ND).call(this,c)?null:(c.id=this.annotationElementId,c)}renderAnnotationElement(e){if(this.deleted)return e.hide(),null;let{points:n,rect:i}=this.serializeDraw(!1);return e.updateEdited({rect:i,thickness:this._drawingOptions["stroke-width"],points:n,popup:this.comment}),null}};ib=new WeakSet,ND=function(e){let{color:n,thickness:i,opacity:s,pageIndex:a}=this._initialData;return this.hasEditedComment||this._hasBeenMoved||this._hasBeenResized||e.color.some((l,c)=>l!==n[c])||e.thickness!==i||e.opacity!==s||e.pageIndex!==a},U(Qu,"_type","ink"),U(Qu,"_editorType",Bt.INK),U(Qu,"_defaultDrawingOptions",null);eA=Qu,pp=class extends Jc{toSVGPath(){let t=super.toSVGPath();return t.endsWith("Z")||(t+="Z"),t}},g0=8,Ef=3,Sr=class{static extractContoursFromText(t,{fontFamily:e,fontStyle:n,fontWeight:i},s,a,l,c){let u=new OffscreenCanvas(1,1),h=u.getContext("2d",{alpha:!1}),d=200,f=h.font=`${n} ${i} ${d}px ${e}`,{actualBoundingBoxLeft:p,actualBoundingBoxRight:m,actualBoundingBoxAscent:y,actualBoundingBoxDescent:x,fontBoundingBoxAscent:b,fontBoundingBoxDescent:w,width:C}=h.measureText(t),E=1.5,S=Math.ceil(Math.max(Math.abs(p)+Math.abs(m)||0,C)*E),N=Math.ceil(Math.max(Math.abs(y)+Math.abs(x)||d,Math.abs(b)+Math.abs(w)||d)*E);u=new OffscreenCanvas(S,N),h=u.getContext("2d",{alpha:!0,willReadFrequently:!0}),h.font=f,h.filter="grayscale(1)",h.fillStyle="white",h.fillRect(0,0,S,N),h.fillStyle="black",h.fillText(t,S*(E-1)/2,N*(3-E)/2);let k=v(this,he,rA).call(this,h.getImageData(0,0,S,N).data),M=v(this,he,OD).call(this,k),R=v(this,he,sA).call(this,M),j=v(this,he,iA).call(this,k,S,N,R);return this.processDrawnLines({lines:{curves:j,width:S,height:N},pageWidth:s,pageHeight:a,rotation:l,innerMargin:c,mustSmooth:!0,areContours:!0})}static process(t,e,n,i,s){let[a,l,c]=v(this,he,FD).call(this,t),[u,h]=v(this,he,MD).call(this,a,l,c,Math.hypot(l,c)*o(this,Gc).sigmaSFactor,o(this,Gc).sigmaR,o(this,Gc).kernelSize),d=v(this,he,sA).call(this,h),f=v(this,he,iA).call(this,u,l,c,d);return this.processDrawnLines({lines:{curves:f,width:l,height:c},pageWidth:e,pageHeight:n,rotation:i,innerMargin:s,mustSmooth:!0,areContours:!0})}static processDrawnLines({lines:t,pageWidth:e,pageHeight:n,rotation:i,innerMargin:s,mustSmooth:a,areContours:l}){i%180!==0&&([e,n]=[n,e]);let{curves:c,width:u,height:h}=t,d=t.thickness??0,f=[],p=Math.min(e/u,n/h),m=p/e,y=p/n,x=[];for(let{points:w}of c){let C=a?v(this,he,_D).call(this,w):w;if(!C)continue;x.push(C);let E=C.length,S=new Float32Array(E),N=new Float32Array(3*(E===2?2:E-2));if(f.push({line:N,points:S}),E===2){S[0]=C[0]*m,S[1]=C[1]*y,N.set([NaN,NaN,NaN,NaN,S[0],S[1]],0);continue}let[k,M,R,j]=C;k*=m,M*=y,R*=m,j*=y,S.set([k,M,R,j],0),N.set([NaN,NaN,NaN,NaN,k,M],0);for(let $=4;$<E;$+=2){let q=S[$]=C[$]*m,Q=S[$+1]=C[$+1]*y;N.set(Dt.createBezierPoints(k,M,R,j,q,Q),($-2)*3),[k,M,R,j]=[R,j,q,Q]}}if(f.length===0)return null;let b=l?new pp:new Jc;return b.build(f,e,n,1,i,l?0:d,s),{outline:b,newCurves:x,areContours:l,thickness:d,width:u,height:h}}static async compressSignature({outlines:t,areContours:e,thickness:n,width:i,height:s}){let a=1/0,l=-1/0,c=0;for(let w of t){c+=w.length;for(let C=2,E=w.length;C<E;C++){let S=w[C]-w[C-2];a=Math.min(a,S),l=Math.max(l,S)}}let u;a>=-128&&l<=127?u=Int8Array:a>=-32768&&l<=32767?u=Int16Array:u=Int32Array;let h=t.length,d=g0+Ef*h,f=new Uint32Array(d),p=0;f[p++]=d*Uint32Array.BYTES_PER_ELEMENT+(c-2*h)*u.BYTES_PER_ELEMENT,f[p++]=0,f[p++]=i,f[p++]=s,f[p++]=e?0:1,f[p++]=Math.max(0,Math.floor(n??0)),f[p++]=h,f[p++]=u.BYTES_PER_ELEMENT;for(let w of t)f[p++]=w.length-2,f[p++]=w[0],f[p++]=w[1];let m=new CompressionStream("deflate-raw"),y=m.writable.getWriter();await y.ready,y.write(f);let x=u.prototype.constructor;for(let w of t){let C=new x(w.length-2);for(let E=2,S=w.length;E<S;E++)C[E-2]=w[E]-w[E-2];y.write(C)}return y.close(),(await new Response(m.readable).bytes()).toBase64()}static async decompressSignature(t){try{let e=Uint8Array.fromBase64(t),{readable:n,writable:i}=new DecompressionStream("deflate-raw"),s=i.getWriter();await s.ready,s.write(e).then(async()=>{await s.ready,await s.close()}).catch(()=>{});let a=null,l=0;for await(let C of n)a||(a=new Uint8Array(new Uint32Array(C.buffer,0,4)[0])),a.set(C,l),l+=C.length;let c=new Uint32Array(a.buffer,0,a.length>>2),u=c[1];if(u!==0)throw new Error(`Invalid version: ${u}`);let h=c[2],d=c[3],f=c[4]===0,p=c[5],m=c[6],y=c[7],x=[],b=(g0+Ef*m)*Uint32Array.BYTES_PER_ELEMENT,w;switch(y){case Int8Array.BYTES_PER_ELEMENT:w=new Int8Array(a.buffer,b);break;case Int16Array.BYTES_PER_ELEMENT:w=new Int16Array(a.buffer,b);break;case Int32Array.BYTES_PER_ELEMENT:w=new Int32Array(a.buffer,b);break}l=0;for(let C=0;C<m;C++){let E=c[Ef*C+g0],S=new Float32Array(E+2);x.push(S);for(let N=0;N<Ef-1;N++)S[N]=c[Ef*C+g0+N+1];for(let N=0;N<E;N++)S[N+2]=S[N]+w[l++]}return{areContours:f,thickness:p,outlines:x,width:h,height:d}}catch(e){return jt(`decompressSignature: ${e}`),null}}};Gc=new WeakMap,he=new WeakSet,nA=function(t,e,n,i){return n-=t,i-=e,n===0?i>0?0:4:n===1?i+6:2-i},Vr=new WeakMap,ID=function(t,e,n,i,s,a,l){let c=v(this,he,nA).call(this,n,i,s,a);for(let u=0;u<8;u++){let h=(-u+c-l+16)%8,d=o(this,Vr)[2*h],f=o(this,Vr)[2*h+1];if(t[(n+d)*e+(i+f)]!==0)return h}return-1},kD=function(t,e,n,i,s,a,l){let c=v(this,he,nA).call(this,n,i,s,a);for(let u=0;u<8;u++){let h=(u+c+l+16)%8,d=o(this,Vr)[2*h],f=o(this,Vr)[2*h+1];if(t[(n+d)*e+(i+f)]!==0)return h}return-1},iA=function(t,e,n,i){let s=t.length,a=new Int32Array(s);for(let h=0;h<s;h++)a[h]=t[h]<=i?1:0;for(let h=1;h<n-1;h++)a[h*e]=a[h*e+e-1]=0;for(let h=0;h<e;h++)a[h]=a[e*n-1-h]=0;let l=1,c,u=[];for(let h=1;h<n-1;h++){c=1;for(let d=1;d<e-1;d++){let f=h*e+d,p=a[f];if(p===0)continue;let m=h,y=d;if(p===1&&a[f-1]===0)l+=1,y-=1;else if(p>=1&&a[f+1]===0)l+=1,y+=1,p>1&&(c=p);else{p!==1&&(c=Math.abs(p));continue}let x=[d,h],b=y===d+1,w={isHole:b,points:x,id:l,parent:0};u.push(w);let C;for(let $ of u)if($.id===c){C=$;break}C?C.isHole?w.parent=b?C.parent:c:w.parent=b?c:C.parent:w.parent=b?c:0;let E=v(this,he,ID).call(this,a,e,h,d,m,y,0);if(E===-1){a[f]=-l,a[f]!==1&&(c=Math.abs(a[f]));continue}let S=o(this,Vr)[2*E],N=o(this,Vr)[2*E+1],k=h+S,M=d+N;m=k,y=M;let R=h,j=d;for(;;){let $=v(this,he,kD).call(this,a,e,R,j,m,y,1);S=o(this,Vr)[2*$],N=o(this,Vr)[2*$+1];let q=R+S,Q=j+N;x.push(Q,q);let Z=R*e+j;if(a[Z+1]===0?a[Z]=-l:a[Z]===1&&(a[Z]=l),q===h&&Q===d&&R===k&&j===M){a[f]!==1&&(c=Math.abs(a[f]));break}else m=R,y=j,R=q,j=Q}}}return u},J0=function(t,e,n,i){if(n-e<=4){for(let k=e;k<n-2;k+=2)i.push(t[k],t[k+1]);return}let s=t[e],a=t[e+1],l=t[n-4]-s,c=t[n-3]-a,u=Math.hypot(l,c),h=l/u,d=c/u,f=h*a-d*s,p=c/l,m=1/u,y=Math.atan(p),x=Math.cos(y),b=Math.sin(y),w=m*(Math.abs(x)+Math.abs(b)),C=m*(1-w+w**2),E=Math.max(Math.atan(Math.abs(b+x)*C),Math.atan(Math.abs(b-x)*C)),S=0,N=e;for(let k=e+2;k<n-2;k+=2){let M=Math.abs(f-h*t[k+1]+d*t[k]);M>S&&(N=k,S=M)}S>(u*E)**2?(v(this,he,J0).call(this,t,e,N+2,i),v(this,he,J0).call(this,t,N,n,i)):i.push(s,a)},_D=function(t){let e=[],n=t.length;return v(this,he,J0).call(this,t,0,n,e),e.push(t[n-2],t[n-1]),e.length<=4?null:e},MD=function(t,e,n,i,s,a){let l=new Float32Array(a**2),c=-2*i**2,u=a>>1;for(let y=0;y<a;y++){let x=(y-u)**2;for(let b=0;b<a;b++)l[y*a+b]=Math.exp((x+(b-u)**2)/c)}let h=new Float32Array(256),d=-2*s**2;for(let y=0;y<256;y++)h[y]=Math.exp(y**2/d);let f=t.length,p=new Uint8Array(f),m=new Uint32Array(256);for(let y=0;y<n;y++)for(let x=0;x<e;x++){let b=y*e+x,w=t[b],C=0,E=0;for(let N=0;N<a;N++){let k=y+N-u;if(!(k<0||k>=n))for(let M=0;M<a;M++){let R=x+M-u;if(R<0||R>=e)continue;let j=t[k*e+R],$=l[N*a+M]*h[Math.abs(j-w)];C+=j*$,E+=$}}let S=p[b]=Math.round(C/E);m[S]++}return[p,m]},OD=function(t){let e=new Uint32Array(256);for(let n of t)e[n]++;return e},rA=function(t){let e=t.length,n=new Uint8ClampedArray(e>>2),i=-1/0,s=1/0;for(let l=0,c=n.length;l<c;l++){let u=n[l]=t[l<<2];i=Math.max(i,u),s=Math.min(s,u)}let a=255/(i-s);for(let l=0,c=n.length;l<c;l++)n[l]=(n[l]-s)*a;return n},sA=function(t){let e,n=-1/0,i=-1/0,s=t.findIndex(c=>c!==0),a=s,l=s;for(e=s;e<256;e++){let c=t[e];c>n&&(e-a>i&&(i=e-a,l=e-1),n=c,a=e)}for(e=l-1;e>=0&&!(t[e]>t[e+1]);e--);return e},FD=function(t){let e=t,{width:n,height:i}=t,{maxDim:s}=o(this,Gc),a=n,l=i;if(n>s||i>s){let f=n,p=i,m=Math.log2(Math.max(n,i)/s),y=Math.floor(m);m=m===y?y-1:y;for(let b=0;b<m;b++){a=Math.ceil(f/2),l=Math.ceil(p/2);let w=new OffscreenCanvas(a,l);w.getContext("2d").drawImage(t,0,0,f,p,0,0,a,l),f=a,p=l,t!==e&&t.close(),t=w.transferToImageBitmap()}let x=Math.min(s/a,s/l);a=Math.round(a*x),l=Math.round(l*x)}let u=new OffscreenCanvas(a,l).getContext("2d",{willReadFrequently:!0});u.fillStyle="white",u.fillRect(0,0,a,l),u.filter="grayscale(1)",u.drawImage(t,0,0,t.width,t.height,0,0,a,l);let h=u.getImageData(0,0,a,l).data;return[v(this,he,rA).call(this,h),a,l]},A(Sr,he),A(Sr,Gc,{maxDim:512,sigmaSFactor:.02,sigmaR:25,kernelSize:16}),A(Sr,Vr,new Int32Array([0,1,-1,1,-1,0,-1,-1,0,-1,1,-1,1,0,1,1]));aA=class r extends _y{constructor(){super(),super.updateProperties({fill:Te._defaultLineColor,"stroke-width":0})}clone(){let t=new r;return t.updateAll(this),t}},oA=class r extends Oy{constructor(t){super(t),super.updateProperties({stroke:Te._defaultLineColor,"stroke-width":1})}clone(){let t=new r(this._viewParameters);return t.updateAll(this),t}},_i=class _i extends My{constructor(e){super({...e,mustBeCommitted:!0,name:"signatureEditor"});A(this,qo,!1);A(this,Os,null);A(this,Vo,null);A(this,Hc,null);this._willKeepAspectRatio=!0,g(this,Vo,e.signatureData||null),g(this,Os,null),this.defaultL10nId="pdfjs-editor-signature-editor1"}static initialize(e,n){Te.initialize(e,n),this._defaultDrawingOptions=new aA,this._defaultDrawnSignatureOptions=new oA(n.viewParameters)}static getDefaultDrawingOptions(e){let n=this._defaultDrawingOptions.clone();return n.updateProperties(e),n}static get supportMultipleDrawings(){return!1}static get typesMap(){return Ut(this,"typesMap",new Map)}static get isDrawer(){return!1}get telemetryFinalData(){return{type:"signature",hasDescription:!!o(this,Os)}}static computeTelemetryFinalData(e){let n=e.get("hasDescription");return{hasAltText:n.get(!0)??0,hasNoAltText:n.get(!1)??0}}get isResizable(){return!0}onScaleChanging(){this._drawId!==null&&super.onScaleChanging()}render(){if(this.div)return this.div;let e,n,{_isCopy:i}=this;if(i&&(this._isCopy=!1,e=this.x,n=this.y),super.render(),this._drawId===null)if(o(this,Vo)){let{lines:s,mustSmooth:a,areContours:l,description:c,uuid:u,heightInPage:h}=o(this,Vo),{rawDims:{pageWidth:d,pageHeight:f},rotation:p}=this.parent.viewport,m=Sr.processDrawnLines({lines:s,pageWidth:d,pageHeight:f,rotation:p,innerMargin:_i._INNER_MARGIN,mustSmooth:a,areContours:l});this.addSignature(m,h,c,u)}else this.div.setAttribute("data-l10n-args",JSON.stringify({description:""})),this.div.hidden=!0,this._uiManager.getSignature(this);else this.div.setAttribute("data-l10n-args",JSON.stringify({description:o(this,Os)||""}));return i&&(this._isCopy=!0,this._moveAfterPaste(e,n)),this.div}setUuid(e){g(this,Hc,e),this.addEditToolbar()}getUuid(){return o(this,Hc)}get description(){return o(this,Os)}set description(e){g(this,Os,e),this.div&&(this.div.setAttribute("data-l10n-args",JSON.stringify({description:e})),super.addEditToolbar().then(n=>{n?.updateEditSignatureButton(e)}))}getSignaturePreview(){let{newCurves:e,areContours:n,thickness:i,width:s,height:a}=o(this,Vo),l=Math.max(s,a),c=Sr.processDrawnLines({lines:{curves:e.map(u=>({points:u})),thickness:i,width:s,height:a},pageWidth:l,pageHeight:l,rotation:0,innerMargin:0,mustSmooth:!1,areContours:n});return{areContours:n,outline:c.outline}}get toolbarButtons(){return this._uiManager.signatureManager?[["editSignature",this._uiManager.signatureManager]]:super.toolbarButtons}addSignature(e,n,i,s){let{x:a,y:l}=this,{outline:c}=g(this,Vo,e);g(this,qo,c instanceof pp),this.description=i;let u;o(this,qo)?u=_i.getDefaultDrawingOptions():(u=_i._defaultDrawnSignatureOptions.clone(),u.updateProperties({"stroke-width":c.thickness})),this._addOutlines({drawOutlines:c,drawingOptions:u});let[,h]=this.pageDimensions,d=n/h;d=d>=1?.5:d,this.width*=d/this.height,this.width>=1&&(d*=.9/this.width,this.width=.9),this.height=d,this.setDims(),this.x=a,this.y=l,this.center(),this._onResized(),this.onScaleChanging(),this.rotate(),this._uiManager.addToAnnotationStorage(this),this.setUuid(s),this._reportTelemetry({action:"pdfjs.signature.inserted",data:{hasBeenSaved:!!s,hasDescription:!!i}}),this.div.hidden=!1}getFromImage(e){let{rawDims:{pageWidth:n,pageHeight:i},rotation:s}=this.parent.viewport;return Sr.process(e,n,i,s,_i._INNER_MARGIN)}getFromText(e,n){let{rawDims:{pageWidth:i,pageHeight:s},rotation:a}=this.parent.viewport;return Sr.extractContoursFromText(e,n,i,s,a,_i._INNER_MARGIN)}getDrawnSignature(e){let{rawDims:{pageWidth:n,pageHeight:i},rotation:s}=this.parent.viewport;return Sr.processDrawnLines({lines:e,pageWidth:n,pageHeight:i,rotation:s,innerMargin:_i._INNER_MARGIN,mustSmooth:!1,areContours:!1})}createDrawingOptions({areContours:e,thickness:n}){e?this._drawingOptions=_i.getDefaultDrawingOptions():(this._drawingOptions=_i._defaultDrawnSignatureOptions.clone(),this._drawingOptions.updateProperties({"stroke-width":n}))}serialize(e=!1){if(this.isEmpty())return null;let{lines:n,points:i}=this.serializeDraw(e),{_drawingOptions:{"stroke-width":s}}=this,a=Object.assign(super.serialize(e),{isSignature:!0,areContours:o(this,qo),color:[0,0,0],thickness:o(this,qo)?0:s});return this.addComment(a),e?(a.paths={lines:n,points:i},a.uuid=o(this,Hc),a.isCopy=!0):a.lines=n,o(this,Os)&&(a.accessibilityData={type:"Figure",alt:o(this,Os)}),a}static deserializeDraw(e,n,i,s,a,l){return l.areContours?pp.deserialize(e,n,i,s,a,l):Jc.deserialize(e,n,i,s,a,l)}static async deserialize(e,n,i){let s=await super.deserialize(e,n,i);return g(s,qo,e.areContours),s.description=e.accessibilityData?.alt||"",g(s,Hc,e.uuid),s}};qo=new WeakMap,Os=new WeakMap,Vo=new WeakMap,Hc=new WeakMap,U(_i,"_type","signature"),U(_i,"_editorType",Bt.SIGNATURE),U(_i,"_defaultDrawingOptions",null);lA=_i,Hf=class extends Te{constructor(e){super({...e,name:"stampEditor"});A(this,re);A(this,_e,null);A(this,Nn,null);A(this,Xo,null);A(this,Oa,null);A(this,Yo,null);A(this,wd,"");A(this,Fa,null);A(this,Wc,!1);A(this,Fs,null);A(this,Xi,!1);A(this,Ad,!1);g(this,Oa,e.bitmapUrl),g(this,Yo,e.bitmapFile),this.defaultL10nId="pdfjs-editor-stamp-editor"}static initialize(e,n){Te.initialize(e,n)}static isHandlingMimeForPasting(e){return ly.includes(e)}static paste(e,n){n.pasteEditor({mode:Bt.STAMP},{bitmapFile:e.getAsFile()})}altTextFinish(){this._uiManager.useNewAltTextFlow&&(this.div.hidden=!1),super.altTextFinish()}get telemetryFinalData(){return{type:"stamp",hasAltText:!!this.altTextData?.altText}}static computeTelemetryFinalData(e){let n=e.get("hasAltText");return{hasAltText:n.get(!0)??0,hasNoAltText:n.get(!1)??0}}async mlGuessAltText(e=null,n=!0){if(this.hasAltTextData())return null;let{mlManager:i}=this._uiManager;if(!i)throw new Error("No ML.");if(!await i.isEnabledFor("altText"))throw new Error("ML isn't enabled for alt text.");let{data:s,width:a,height:l}=e||this.copyCanvas(null,null,!0).imageData,c=await i.guess({name:"altText",request:{data:s,width:a,height:l,channels:s.length/(a*l)}});if(!c)throw new Error("No response from the AI service.");if(c.error)throw new Error("Error from the AI service.");if(c.cancel)return null;if(!c.output)throw new Error("No valid response from the AI service.");let u=c.output;return await this.setGuessedAltText(u),n&&!this.hasAltTextData()&&(this.altTextData={alt:u,decorative:!1}),u}remove(){o(this,Nn)&&(g(this,_e,null),this._uiManager.imageManager.deleteId(o(this,Nn)),o(this,Fa)?.remove(),g(this,Fa,null),o(this,Fs)&&(clearTimeout(o(this,Fs)),g(this,Fs,null))),super.remove()}rebuild(){if(!this.parent){o(this,Nn)&&v(this,re,ty).call(this);return}super.rebuild(),this.div!==null&&(o(this,Nn)&&o(this,Fa)===null&&v(this,re,ty).call(this),this.isAttachedToDOM||this.parent.add(this))}onceAdded(e){this._isDraggable=!0,e&&this.div.focus()}isEmpty(){return!(o(this,Xo)||o(this,_e)||o(this,Oa)||o(this,Yo)||o(this,Nn)||o(this,Wc))}get toolbarButtons(){return[["altText",this.createAltText()]]}get isResizable(){return!0}render(){if(this.div)return this.div;let e,n;return this._isCopy&&(e=this.x,n=this.y),super.render(),this.div.hidden=!0,this.createAltText(),o(this,Wc)||(o(this,_e)?v(this,re,ey).call(this):v(this,re,ty).call(this)),this._isCopy&&this._moveAfterPaste(e,n),this._uiManager.addShouldRescale(this),this.div}setCanvas(e,n){let{id:i,bitmap:s}=this._uiManager.imageManager.getFromCanvas(e,n);n.remove(),i&&this._uiManager.imageManager.isValidId(i)&&(g(this,Nn,i),s&&g(this,_e,s),g(this,Wc,!1),v(this,re,ey).call(this))}_onResized(){this.onScaleChanging()}onScaleChanging(){if(!this.parent)return;o(this,Fs)!==null&&clearTimeout(o(this,Fs)),g(this,Fs,setTimeout(()=>{g(this,Fs,null),v(this,re,cA).call(this)},200))}copyCanvas(e,n,i=!1){e||(e=224);let{width:s,height:a}=o(this,_e),l=new Ls,c=o(this,_e),u=s,h=a,d=null;if(n){if(s>n||a>n){let k=Math.min(n/s,n/a);u=Math.floor(s*k),h=Math.floor(a*k)}d=document.createElement("canvas");let p=d.width=Math.ceil(u*l.sx),m=d.height=Math.ceil(h*l.sy);o(this,Xi)||(c=v(this,re,ny).call(this,p,m));let y=d.getContext("2d");y.filter=this._uiManager.hcmFilter;let x="white",b="#cfcfd8";this._uiManager.hcmFilter!=="none"?b="black":zx.isDarkMode&&(x="#8f8f9d",b="#42414d");let w=15,C=w*l.sx,E=w*l.sy,S=new OffscreenCanvas(C*2,E*2),N=S.getContext("2d");N.fillStyle=x,N.fillRect(0,0,C*2,E*2),N.fillStyle=b,N.fillRect(0,0,C,E),N.fillRect(C,E,C,E),y.fillStyle=y.createPattern(S,"repeat"),y.fillRect(0,0,p,m),y.drawImage(c,0,0,c.width,c.height,0,0,p,m)}let f=null;if(i){let p,m;if(l.symmetric&&c.width<e&&c.height<e)p=c.width,m=c.height;else if(c=o(this,_e),s>e||a>e){let b=Math.min(e/s,e/a);p=Math.floor(s*b),m=Math.floor(a*b),o(this,Xi)||(c=v(this,re,ny).call(this,p,m))}let x=new OffscreenCanvas(p,m).getContext("2d",{willReadFrequently:!0});x.drawImage(c,0,0,c.width,c.height,0,0,p,m),f={width:p,height:m,data:x.getImageData(0,0,p,m).data}}return{canvas:d,width:u,height:h,imageData:f}}static async deserialize(e,n,i){let s=null,a=!1;if(e instanceof Sy){let{data:{rect:x,rotation:b,id:w,structParent:C,popupRef:E,richText:S,contentsObj:N,creationDate:k,modificationDate:M},container:R,parent:{page:{pageNumber:j}},canvas:$}=e,q,Q;$?(delete e.canvas,{id:q,bitmap:Q}=i.imageManager.getFromCanvas(R.id,$),$.remove()):(a=!0,e._hasNoCanvas=!0);let Z=(await n._structTree.getAriaAttributes(`${Xu}${w}`))?.get("aria-label")||"";s=e={annotationType:Bt.STAMP,bitmapId:q,bitmap:Q,pageIndex:j-1,rect:x.slice(0),rotation:b,annotationElementId:w,id:w,deleted:!1,accessibilityData:{decorative:!1,altText:Z},isSvg:!1,structParent:C,popupRef:E,richText:S,comment:N?.str||null,creationDate:k,modificationDate:M}}let l=await super.deserialize(e,n,i),{rect:c,bitmap:u,bitmapUrl:h,bitmapId:d,isSvg:f,accessibilityData:p}=e;a?(i.addMissingCanvas(e.id,l),g(l,Wc,!0)):d&&i.imageManager.isValidId(d)?(g(l,Nn,d),u&&g(l,_e,u)):g(l,Oa,h),g(l,Xi,f);let[m,y]=l.pageDimensions;return l.width=(c[2]-c[0])/m,l.height=(c[3]-c[1])/y,p&&(l.altTextData=p),l._initialData=s,e.comment&&l.setCommentData(e),g(l,Ad,!!s),l}serialize(e=!1,n=null){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();let i=Object.assign(super.serialize(e),{bitmapId:o(this,Nn),isSvg:o(this,Xi)});if(this.addComment(i),e)return i.bitmapUrl=v(this,re,iy).call(this,!0),i.accessibilityData=this.serializeAltText(!0),i.isCopy=!0,i;let{decorative:s,altText:a}=this.serializeAltText(!1);if(!s&&a&&(i.accessibilityData={type:"Figure",alt:a}),this.annotationElementId){let c=v(this,re,PD).call(this,i);return c.isSame?null:(c.isSameAltText?delete i.accessibilityData:i.accessibilityData.structParent=this._initialData.structParent??-1,i.id=this.annotationElementId,delete i.bitmapId,i)}if(n===null)return i;n.stamps||(n.stamps=new Map);let l=o(this,Xi)?(i.rect[2]-i.rect[0])*(i.rect[3]-i.rect[1]):null;if(!n.stamps.has(o(this,Nn)))n.stamps.set(o(this,Nn),{area:l,serialized:i}),i.bitmap=v(this,re,iy).call(this,!1);else if(o(this,Xi)){let c=n.stamps.get(o(this,Nn));l>c.area&&(c.area=l,c.serialized.bitmap.close(),c.serialized.bitmap=v(this,re,iy).call(this,!1))}return i}renderAnnotationElement(e){return this.deleted?(e.hide(),null):(e.updateEdited({rect:this.getPDFRect(),popup:this.comment}),null)}};_e=new WeakMap,Nn=new WeakMap,Xo=new WeakMap,Oa=new WeakMap,Yo=new WeakMap,wd=new WeakMap,Fa=new WeakMap,Wc=new WeakMap,Fs=new WeakMap,Xi=new WeakMap,Ad=new WeakMap,re=new WeakSet,Wf=function(e,n=!1){if(!e){this.remove();return}g(this,_e,e.bitmap),n||(g(this,Nn,e.id),g(this,Xi,e.isSvg)),e.file&&g(this,wd,e.file.name),v(this,re,ey).call(this)},qf=function(){if(g(this,Xo,null),this._uiManager.enableWaiting(!1),!!o(this,Fa)){if(this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&o(this,_e)){this.addEditToolbar().then(()=>{this._editToolbar.hide(),this._uiManager.editAltText(this,!0)});return}if(!this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&o(this,_e)){this._reportTelemetry({action:"pdfjs.image.image_added",data:{alt_text_modal:!1,alt_text_type:"empty"}});try{this.mlGuessAltText()}catch{}}this.div.focus()}},ty=function(){if(o(this,Nn)){this._uiManager.enableWaiting(!0),this._uiManager.imageManager.getFromId(o(this,Nn)).then(i=>v(this,re,Wf).call(this,i,!0)).finally(()=>v(this,re,qf).call(this));return}if(o(this,Oa)){let i=o(this,Oa);g(this,Oa,null),this._uiManager.enableWaiting(!0),g(this,Xo,this._uiManager.imageManager.getFromUrl(i).then(s=>v(this,re,Wf).call(this,s)).finally(()=>v(this,re,qf).call(this)));return}if(o(this,Yo)){let i=o(this,Yo);g(this,Yo,null),this._uiManager.enableWaiting(!0),g(this,Xo,this._uiManager.imageManager.getFromFile(i).then(s=>v(this,re,Wf).call(this,s)).finally(()=>v(this,re,qf).call(this)));return}let e=document.createElement("input");e.type="file",e.accept=ly.join(",");let n=this._uiManager._signal;g(this,Xo,new Promise(i=>{e.addEventListener("change",async()=>{if(!e.files||e.files.length===0)this.remove();else{this._uiManager.enableWaiting(!0);let s=await this._uiManager.imageManager.getFromFile(e.files[0]);this._reportTelemetry({action:"pdfjs.image.image_selected",data:{alt_text_modal:this._uiManager.useNewAltTextFlow}}),v(this,re,Wf).call(this,s)}i()},{signal:n}),e.addEventListener("cancel",()=>{this.remove(),i()},{signal:n})}).finally(()=>v(this,re,qf).call(this))),e.click()},ey=function(){let{div:e}=this,{width:n,height:i}=o(this,_e),[s,a]=this.pageDimensions,l=.75;if(this.width)n=this.width*s,i=this.height*a;else if(n>l*s||i>l*a){let u=Math.min(l*s/n,l*a/i);n*=u,i*=u}this._uiManager.enableWaiting(!1);let c=g(this,Fa,document.createElement("canvas"));c.setAttribute("role","img"),this.addContainer(c),this.width=n/s,this.height=i/a,this.setDims(),this._initialOptions?.isCentered?this.center():this.fixAndSetPosition(),this._initialOptions=null,(!this._uiManager.useNewAltTextWhenAddingImage||!this._uiManager.useNewAltTextFlow||this.annotationElementId)&&(e.hidden=!1),v(this,re,cA).call(this),o(this,Ad)||(this.parent.addUndoableEditor(this),g(this,Ad,!0)),this._reportTelemetry({action:"inserted_image"}),o(this,wd)&&this.div.setAttribute("aria-description",o(this,wd)),this.annotationElementId||this._uiManager.a11yAlert("pdfjs-editor-stamp-added-alert")},ny=function(e,n){let{width:i,height:s}=o(this,_e),a=i,l=s,c=o(this,_e);for(;a>2*e||l>2*n;){let u=a,h=l;a>2*e&&(a=a>=16384?Math.floor(a/2)-1:Math.ceil(a/2)),l>2*n&&(l=l>=16384?Math.floor(l/2)-1:Math.ceil(l/2));let d=new OffscreenCanvas(a,l);d.getContext("2d").drawImage(c,0,0,u,h,0,0,a,l),c=d.transferToImageBitmap()}return c},cA=function(){let[e,n]=this.parentDimensions,{width:i,height:s}=this,a=new Ls,l=Math.ceil(i*e*a.sx),c=Math.ceil(s*n*a.sy),u=o(this,Fa);if(!u||u.width===l&&u.height===c)return;u.width=l,u.height=c;let h=o(this,Xi)?o(this,_e):v(this,re,ny).call(this,l,c),d=u.getContext("2d");d.filter=this._uiManager.hcmFilter,d.drawImage(h,0,0,h.width,h.height,0,0,l,c)},iy=function(e){if(e){if(o(this,Xi)){let s=this._uiManager.imageManager.getSvgUrl(o(this,Nn));if(s)return s}let n=document.createElement("canvas");return{width:n.width,height:n.height}=o(this,_e),n.getContext("2d").drawImage(o(this,_e),0,0),n.toDataURL()}if(o(this,Xi)){let[n,i]=this.pageDimensions,s=Math.round(this.width*n*ja.PDF_TO_CSS_UNITS),a=Math.round(this.height*i*ja.PDF_TO_CSS_UNITS),l=new OffscreenCanvas(s,a);return l.getContext("2d").drawImage(o(this,_e),0,0,o(this,_e).width,o(this,_e).height,0,0,s,a),l.transferToImageBitmap()}return structuredClone(o(this,_e))},PD=function(e){let{pageIndex:n,accessibilityData:{altText:i}}=this._initialData,s=e.pageIndex===n,a=(e.accessibilityData?.alt||"")===i;return{isSame:!this.hasEditedComment&&!this._hasBeenMoved&&!this._hasBeenResized&&s&&a,isSameAltText:a}},U(Hf,"_type","stamp"),U(Hf,"_editorType",Bt.STAMP);Pr=class Pr{constructor({uiManager:t,pageIndex:e,div:n,structTreeLayer:i,accessibilityManager:s,annotationLayer:a,drawLayer:l,textLayer:c,viewport:u,l10n:h}){A(this,Ce);A(this,qc);A(this,vd,!1);A(this,Ko,null);A(this,Zo,null);A(this,Pa,null);A(this,Ti,new Map);A(this,Qo,!1);A(this,Cd,!1);A(this,Ed,!1);A(this,Xr,null);A(this,Ra,null);A(this,In,null);A(this,La,null);A(this,Jo,null);A(this,Td,-1);A(this,_t);let d=[...o(Pr,tl).values()];if(!Pr._initialized){Pr._initialized=!0;for(let f of d)f.initialize(h,t)}t.registerEditorTypes(d),g(this,_t,t),this.pageIndex=e,this.div=n,g(this,qc,s),g(this,Ko,a),this.viewport=u,g(this,In,c),this.drawLayer=l,this._structTree=i,o(this,_t).addLayer(this)}get isEmpty(){return o(this,Ti).size===0}get isInvisible(){return this.isEmpty&&o(this,_t).getMode()===Bt.NONE}updateToolbar(t){o(this,_t).updateToolbar(t)}updateMode(t=o(this,_t).getMode()){switch(v(this,Ce,ry).call(this),t){case Bt.NONE:this.div.classList.toggle("nonEditing",!0),this.disableTextSelection(),this.togglePointerEvents(!1),this.toggleAnnotationLayerPointerEvents(!0),this.disableClick();return;case Bt.INK:this.disableTextSelection(),this.togglePointerEvents(!0),this.enableClick();break;case Bt.HIGHLIGHT:this.enableTextSelection(),this.togglePointerEvents(!1),this.disableClick();break;default:this.disableTextSelection(),this.togglePointerEvents(!0),this.enableClick()}this.toggleAnnotationLayerPointerEvents(!1);let{classList:e}=this.div;if(e.toggle("nonEditing",!1),t===Bt.POPUP)e.toggle("commentEditing",!0);else{e.toggle("commentEditing",!1);for(let n of o(Pr,tl).values())e.toggle(`${n._type}Editing`,t===n._editorType)}this.div.hidden=!1}hasTextLayer(t){return t===o(this,In)?.div}setEditingState(t){o(this,_t).setEditingState(t)}addCommands(t){o(this,_t).addCommands(t)}cleanUndoStack(t){o(this,_t).cleanUndoStack(t)}toggleDrawing(t=!1){this.div.classList.toggle("drawing",!t)}togglePointerEvents(t=!1){this.div.classList.toggle("disabled",!t)}toggleAnnotationLayerPointerEvents(t=!1){o(this,Ko)?.togglePointerEvents(t)}async enable(){g(this,Ed,!0),this.div.tabIndex=0,this.togglePointerEvents(!0),this.div.classList.toggle("nonEditing",!1),o(this,Jo)?.abort(),g(this,Jo,null);let t=new Set;for(let n of o(this,Ce,uA))n.enableEditing(),n.show(!0),n.annotationElementId&&(o(this,_t).removeChangedExistingAnnotation(n),t.add(n.annotationElementId));let e=o(this,Ko);if(e)for(let n of e.getEditableAnnotations()){if(n.hide(),o(this,_t).isDeletedAnnotationElement(n.data.id)||t.has(n.data.id))continue;let i=await this.deserialize(n);i&&(this.addOrRebuild(i),i.enableEditing())}g(this,Ed,!1),o(this,_t)._eventBus.dispatch("editorsrendered",{source:this,pageNumber:this.pageIndex+1})}disable(){if(g(this,Cd,!0),this.div.tabIndex=-1,this.togglePointerEvents(!1),this.div.classList.toggle("nonEditing",!0),o(this,In)&&!o(this,Jo)){g(this,Jo,new AbortController);let i=o(this,_t).combinedSignal(o(this,Jo));o(this,In).div.addEventListener("pointerdown",s=>{let{clientX:l,clientY:c,timeStamp:u}=s,h=o(this,Td);if(u-h>500){g(this,Td,u);return}g(this,Td,-1);let{classList:d}=this.div;d.toggle("getElements",!0);let f=document.elementsFromPoint(l,c);if(d.toggle("getElements",!1),!this.div.contains(f[0]))return;let p,m=new RegExp(`^${Jf}[0-9]+$`);for(let x of f)if(m.test(x.id)){p=x.id;break}if(!p)return;let y=o(this,Ti).get(p);y?.annotationElementId===null&&(s.stopPropagation(),s.preventDefault(),y.dblclick(s))},{signal:i,capture:!0})}let t=o(this,Ko),e=[];if(t){let i=new Map,s=new Map;for(let a of o(this,Ce,uA)){if(a.disableEditing(),!a.annotationElementId){e.push(a);continue}if(a.serialize()!==null){i.set(a.annotationElementId,a);continue}else s.set(a.annotationElementId,a);this.getEditableAnnotation(a.annotationElementId)?.show(),a.remove()}for(let a of t.getEditableAnnotations()){let{id:l}=a.data;if(o(this,_t).isDeletedAnnotationElement(l)){a.updateEdited({deleted:!0});continue}let c=s.get(l);if(c){c.resetAnnotationElement(a),c.show(!1),a.show();continue}c=i.get(l),c&&(o(this,_t).addChangedExistingAnnotation(c),c.renderAnnotationElement(a)&&c.show(!1)),a.show()}}v(this,Ce,ry).call(this),this.isEmpty&&(this.div.hidden=!0);let{classList:n}=this.div;for(let i of o(Pr,tl).values())n.remove(`${i._type}Editing`);this.disableTextSelection(),this.toggleAnnotationLayerPointerEvents(!0),t?.updateFakeAnnotations(e),g(this,Cd,!1)}getEditableAnnotation(t){return o(this,Ko)?.getEditableAnnotation(t)||null}setActiveEditor(t){o(this,_t).getActive()!==t&&o(this,_t).setActiveEditor(t)}enableTextSelection(){if(this.div.tabIndex=-1,o(this,In)?.div&&!o(this,La)){g(this,La,new AbortController);let t=o(this,_t).combinedSignal(o(this,La));o(this,In).div.addEventListener("pointerdown",v(this,Ce,RD).bind(this),{signal:t}),o(this,In).div.classList.add("highlighting")}}disableTextSelection(){this.div.tabIndex=0,o(this,In)?.div&&o(this,La)&&(o(this,La).abort(),g(this,La,null),o(this,In).div.classList.remove("highlighting"))}enableClick(){if(o(this,Zo))return;g(this,Zo,new AbortController);let t=o(this,_t).combinedSignal(o(this,Zo));this.div.addEventListener("pointerdown",this.pointerdown.bind(this),{signal:t});let e=this.pointerup.bind(this);this.div.addEventListener("pointerup",e,{signal:t}),this.div.addEventListener("pointercancel",e,{signal:t})}disableClick(){o(this,Zo)?.abort(),g(this,Zo,null)}attach(t){o(this,Ti).set(t.id,t);let{annotationElementId:e}=t;e&&o(this,_t).isDeletedAnnotationElement(e)&&o(this,_t).removeDeletedAnnotationElement(t)}detach(t){o(this,Ti).delete(t.id),o(this,qc)?.removePointerInTextLayer(t.contentDiv),!o(this,Cd)&&t.annotationElementId&&o(this,_t).addDeletedAnnotationElement(t)}remove(t){this.detach(t),o(this,_t).removeEditor(t),t.div.remove(),t.isAttachedToDOM=!1}changeParent(t){t.parent!==this&&(t.parent&&t.annotationElementId&&(o(this,_t).addDeletedAnnotationElement(t),Te.deleteAnnotationElement(t),t.annotationElementId=null),this.attach(t),t.parent?.detach(t),t.setParent(this),t.div&&t.isAttachedToDOM&&(t.div.remove(),this.div.append(t.div)))}add(t){if(!(t.parent===this&&t.isAttachedToDOM)){if(this.changeParent(t),o(this,_t).addEditor(t),this.attach(t),!t.isAttachedToDOM){let e=t.render();this.div.append(e),t.isAttachedToDOM=!0}t.fixAndSetPosition(),t.onceAdded(!o(this,Ed)),o(this,_t).addToAnnotationStorage(t),t._reportTelemetry(t.telemetryInitialData)}}moveEditorInDOM(t){if(!t.isAttachedToDOM)return;let{activeElement:e}=document;t.div.contains(e)&&!o(this,Pa)&&(t._focusEventsAllowed=!1,g(this,Pa,setTimeout(()=>{g(this,Pa,null),t.div.contains(document.activeElement)?t._focusEventsAllowed=!0:(t.div.addEventListener("focusin",()=>{t._focusEventsAllowed=!0},{once:!0,signal:o(this,_t)._signal}),e.focus())},0))),t._structTreeParentId=o(this,qc)?.moveElementInDOM(this.div,t.div,t.contentDiv,!0)}addOrRebuild(t){t.needsToBeRebuilt()?(t.parent||(t.parent=this),t.rebuild(),t.show()):this.add(t)}addUndoableEditor(t){let e=()=>t._uiManager.rebuild(t),n=()=>{t.remove()};this.addCommands({cmd:e,undo:n,mustExec:!1})}getEditorByUID(t){for(let e of o(this,Ti).values())if(e.uid===t)return e;return null}combinedSignal(t){return o(this,_t).combinedSignal(t)}canCreateNewEmptyEditor(){return o(this,Ce,fs)?.canCreateNewEmptyEditor()}async pasteEditor(t,e){this.updateToolbar(t),await o(this,_t).updateMode(t.mode);let{offsetX:n,offsetY:i}=v(this,Ce,dA).call(this),s=o(this,_t).getId(),a=v(this,Ce,hA).call(this,{parent:this,id:s,x:n,y:i,uiManager:o(this,_t),isCentered:!0,...e});a&&this.add(a)}async deserialize(t){return await o(Pr,tl).get(t.annotationType??t.annotationEditorType)?.deserialize(t,this,o(this,_t))||null}createAndAddNewEditor(t,e,n={}){let i=o(this,_t).getId(),s=v(this,Ce,hA).call(this,{parent:this,id:i,x:t.offsetX,y:t.offsetY,uiManager:o(this,_t),isCentered:e,...n});return s&&this.add(s),s}get boundingClientRect(){return this.div.getBoundingClientRect()}addNewEditor(t={}){this.createAndAddNewEditor(v(this,Ce,dA).call(this),!0,t)}setSelected(t){o(this,_t).setSelected(t)}toggleSelected(t){o(this,_t).toggleSelected(t)}unselect(t){o(this,_t).unselect(t)}pointerup(t){let{isMac:e}=Xe.platform;if(t.button!==0||t.ctrlKey&&e||t.target!==this.div||!o(this,Qo)||(g(this,Qo,!1),o(this,Ce,fs)?.isDrawer&&o(this,Ce,fs).supportMultipleDrawings))return;if(!o(this,vd)){g(this,vd,!0);return}let n=o(this,_t).getMode();if(n===Bt.STAMP||n===Bt.POPUP||n===Bt.SIGNATURE){o(this,_t).unselectAll();return}this.createAndAddNewEditor(t,!1)}pointerdown(t){if(o(this,_t).getMode()===Bt.HIGHLIGHT&&this.enableTextSelection(),o(this,Qo)){g(this,Qo,!1);return}let{isMac:e}=Xe.platform;if(t.button!==0||t.ctrlKey&&e||t.target!==this.div)return;if(g(this,Qo,!0),o(this,Ce,fs)?.isDrawer){this.startDrawingSession(t);return}let n=o(this,_t).getActive();g(this,vd,!n||n.isEmpty())}startDrawingSession(t){if(this.div.focus({preventScroll:!0}),o(this,Xr)){o(this,Ce,fs).startDrawing(this,o(this,_t),!1,t);return}o(this,_t).setCurrentDrawingSession(this),g(this,Xr,new AbortController);let e=o(this,_t).combinedSignal(o(this,Xr));this.div.addEventListener("blur",({relatedTarget:n})=>{n&&!this.div.contains(n)&&(g(this,Ra,null),this.commitOrRemove())},{signal:e}),o(this,Ce,fs).startDrawing(this,o(this,_t),!1,t)}pause(t){if(t){let{activeElement:e}=document;this.div.contains(e)&&g(this,Ra,e);return}o(this,Ra)&&setTimeout(()=>{o(this,Ra)?.focus(),g(this,Ra,null)},0)}endDrawingSession(t=!1){return o(this,Xr)?(o(this,_t).setCurrentDrawingSession(null),o(this,Xr).abort(),g(this,Xr,null),g(this,Ra,null),o(this,Ce,fs).endDrawing(t)):null}findNewParent(t,e,n){let i=o(this,_t).findParent(e,n);return i===null||i===this?!1:(i.changeParent(t),!0)}commitOrRemove(){return o(this,Xr)?(this.endDrawingSession(),!0):!1}onScaleChanging(){o(this,Xr)&&o(this,Ce,fs).onScaleChangingWhenDrawing(this)}destroy(){this.commitOrRemove(),o(this,_t).getActive()?.parent===this&&(o(this,_t).commitOrRemove(),o(this,_t).setActiveEditor(null)),o(this,Pa)&&(clearTimeout(o(this,Pa)),g(this,Pa,null));for(let t of o(this,Ti).values())o(this,qc)?.removePointerInTextLayer(t.contentDiv),t.setParent(null),t.isAttachedToDOM=!1,t.div.remove();this.div=null,o(this,Ti).clear(),o(this,_t).removeLayer(this)}async render({viewport:t}){this.viewport=t,el(this.div,t);for(let e of o(this,_t).getEditors(this.pageIndex))this.add(e),e.rebuild();await o(this,_t).findClonesForPage(this),this.div.hidden=this.isEmpty,this.updateMode()}update({viewport:t}){o(this,_t).commitOrRemove(),v(this,Ce,ry).call(this);let e=this.viewport.rotation,n=t.rotation;if(this.viewport=t,el(this.div,{rotation:n}),e!==n)for(let i of o(this,Ti).values())i.rotate(n)}get pageDimensions(){let{pageWidth:t,pageHeight:e}=this.viewport.rawDims;return[t,e]}get scale(){return o(this,_t).viewParameters.realScale}};qc=new WeakMap,vd=new WeakMap,Ko=new WeakMap,Zo=new WeakMap,Pa=new WeakMap,Ti=new WeakMap,Qo=new WeakMap,Cd=new WeakMap,Ed=new WeakMap,Xr=new WeakMap,Ra=new WeakMap,In=new WeakMap,La=new WeakMap,Jo=new WeakMap,Td=new WeakMap,_t=new WeakMap,tl=new WeakMap,Ce=new WeakSet,uA=function(){return o(this,Ti).size!==0?o(this,Ti).values():o(this,_t).getEditors(this.pageIndex)},RD=function(t){o(this,_t).unselectAll();let{target:e}=t;if(e===o(this,In).div||(e.getAttribute("role")==="img"||e.classList.contains("endOfContent"))&&o(this,In).div.contains(e)){let{isMac:n}=Xe.platform;if(t.button!==0||t.ctrlKey&&n)return;o(this,_t).showAllEditors("highlight",!0,!0),o(this,In).div.classList.add("free"),this.toggleDrawing(),ky.startHighlighting(this,o(this,_t).direction==="ltr",{target:o(this,In).div,x:t.x,y:t.y}),o(this,In).div.addEventListener("pointerup",()=>{o(this,In).div.classList.remove("free"),this.toggleDrawing(!0)},{once:!0,signal:o(this,_t)._signal}),t.preventDefault()}},fs=function(){return o(Pr,tl).get(o(this,_t).getMode())},hA=function(t){let e=o(this,Ce,fs);return e?new e.prototype.constructor(t):null},dA=function(){let{x:t,y:e,width:n,height:i}=this.boundingClientRect,s=Math.max(0,t),a=Math.max(0,e),l=Math.min(window.innerWidth,t+n),c=Math.min(window.innerHeight,e+i),u=(s+l)/2-t,h=(a+c)/2-e,[d,f]=this.viewport.rotation%180===0?[u,h]:[h,u];return{offsetX:d,offsetY:f}},ry=function(){for(let t of o(this,Ti).values())t.isEmpty()&&t.remove()},U(Pr,"_initialized",!1),A(Pr,tl,new Map([H2,eA,Hf,ky,lA].map(t=>[t._editorType,t])));Fy=Pr,mn=class mn{constructor(){A(this,Us);A(this,Yr,null);A(this,ci,new Map);A(this,Vc,new Map)}setParent(t){if(!o(this,Yr)){g(this,Yr,t);return}if(o(this,Yr)!==t){if(o(this,ci).size>0)for(let e of o(this,ci).values())e.remove(),t.append(e);g(this,Yr,t)}}static get _svgFactory(){return Ut(this,"_svgFactory",new Zc)}draw(t,e=!1,n=!1){let i=an(mn,eg)._++,s=v(this,Us,fA).call(this),a=mn._svgFactory.createElement("defs");s.append(a);let l=mn._svgFactory.createElement("path");a.append(l);let c=`path_${i}`;l.setAttribute("id",c),l.setAttribute("vector-effect","non-scaling-stroke"),e&&o(this,Vc).set(i,l);let u=n?v(this,Us,BD).call(this,a,c):null,h=mn._svgFactory.createElement("use");return s.append(h),h.setAttribute("href",`#${c}`),this.updateProperties(s,t),o(this,ci).set(i,s),{id:i,clipPathId:`url(#${u})`}}drawOutline(t,e){let n=an(mn,eg)._++,i=v(this,Us,fA).call(this),s=mn._svgFactory.createElement("defs");i.append(s);let a=mn._svgFactory.createElement("path");s.append(a);let l=`path_${n}`;a.setAttribute("id",l),a.setAttribute("vector-effect","non-scaling-stroke");let c;if(e){let d=mn._svgFactory.createElement("mask");s.append(d),c=`mask_${n}`,d.setAttribute("id",c),d.setAttribute("maskUnits","objectBoundingBox");let f=mn._svgFactory.createElement("rect");d.append(f),f.setAttribute("width","1"),f.setAttribute("height","1"),f.setAttribute("fill","white");let p=mn._svgFactory.createElement("use");d.append(p),p.setAttribute("href",`#${l}`),p.setAttribute("stroke","none"),p.setAttribute("fill","black"),p.setAttribute("fill-rule","nonzero"),p.classList.add("mask")}let u=mn._svgFactory.createElement("use");i.append(u),u.setAttribute("href",`#${l}`),c&&u.setAttribute("mask",`url(#${c})`);let h=u.cloneNode();return i.append(h),u.classList.add("mainOutline"),h.classList.add("secondaryOutline"),this.updateProperties(i,t),o(this,ci).set(n,i),n}finalizeDraw(t,e){o(this,Vc).delete(t),this.updateProperties(t,e)}updateProperties(t,e){var c;if(!e)return;let{root:n,bbox:i,rootClass:s,path:a}=e,l=typeof t=="number"?o(this,ci).get(t):t;if(l){if(n&&v(this,Us,pA).call(this,l,n),i&&v(c=mn,rb,LD).call(c,l,i),s){let{classList:u}=l;for(let[h,d]of Object.entries(s))u.toggle(h,d)}if(a){let h=l.firstElementChild.firstElementChild;v(this,Us,pA).call(this,h,a)}}}updateParent(t,e){if(e===this)return;let n=o(this,ci).get(t);n&&(o(e,Yr).append(n),o(this,ci).delete(t),o(e,ci).set(t,n))}remove(t){o(this,Vc).delete(t),o(this,Yr)!==null&&(o(this,ci).get(t).remove(),o(this,ci).delete(t))}destroy(){g(this,Yr,null);for(let t of o(this,ci).values())t.remove();o(this,ci).clear(),o(this,Vc).clear()}};Yr=new WeakMap,ci=new WeakMap,Vc=new WeakMap,eg=new WeakMap,rb=new WeakSet,LD=function(t,[e,n,i,s]){let{style:a}=t;a.top=`${100*n}%`,a.left=`${100*e}%`,a.width=`${100*i}%`,a.height=`${100*s}%`},Us=new WeakSet,fA=function(){let t=mn._svgFactory.create(1,1,!0);return o(this,Yr).append(t),t.setAttribute("aria-hidden",!0),t},BD=function(t,e){let n=mn._svgFactory.createElement("clipPath");t.append(n);let i=`clip_${e}`;n.setAttribute("id",i),n.setAttribute("clipPathUnits","objectBoundingBox");let s=mn._svgFactory.createElement("use");return n.append(s),s.setAttribute("href",`#${e}`),s.classList.add("clip"),i},pA=function(t,e){for(let[n,i]of Object.entries(e))i===null?t.removeAttribute(n):t.setAttribute(n,i)},A(mn,rb),A(mn,eg,0);Py=mn;Qf=class Qf{constructor(t,e,n,i){A(this,sb);A(this,Sd,[]);A(this,ng,new Map);A(this,ig,null);A(this,Dd,0);A(this,Ps,0);A(this,Rs,0);g(this,Dd,t),g(this,Sd,e),g(this,Ps,n.rawDims.pageWidth),g(this,Rs,n.rawDims.pageHeight),g(this,ig,i)}render(){let t=document.createElement("div");t.className="textLayerImages";for(let e=0;e<o(this,Sd).length;e+=6){let n=v(this,sb,UD).call(this,o(this,Sd).subarray(e,e+6));n&&t.append(n)}return t.addEventListener("contextmenu",e=>{if(!(e.target instanceof HTMLCanvasElement))return;let n=e.target,i=o(this,ng).get(n);if(!i)return;let s=o(Qf,rg)?.deref();if(s===n)return;s&&(s.width=0,s.height=0),g(Qf,rg,new WeakRef(n));let{inverseTransform:a,x1:l,y1:c,width:u,height:h}=i,d=o(this,ig).call(this),f=Math.ceil(l*d.width),p=Math.ceil(c*d.height),m=Math.floor((l+u/o(this,Ps))*d.width),y=Math.floor((c+h/o(this,Rs))*d.height);n.width=m-f,n.height=y-p;let x=n.getContext("2d");x.setTransform(...a),x.translate(-f,-p),x.drawImage(d,0,0)}),t}};Sd=new WeakMap,ng=new WeakMap,ig=new WeakMap,Dd=new WeakMap,Ps=new WeakMap,Rs=new WeakMap,rg=new WeakMap,sb=new WeakSet,UD=function([t,e,n,i,s,a]){let l=Math.hypot((s-t)*o(this,Ps),(a-e)*o(this,Rs)),c=Math.hypot((n-t)*o(this,Ps),(i-e)*o(this,Rs));if(l<o(this,Dd)||c<o(this,Dd))return null;let u=[(s-t)*o(this,Ps)/l,(a-e)*o(this,Rs)/l,(n-t)*o(this,Ps)/c,(i-e)*o(this,Rs)/c,0,0],h=yt.inverseTransform(u),d=document.createElement("canvas");return d.className="textLayerImagePlaceholder",d.width=0,d.height=0,Object.assign(d.style,{opacity:0,position:"absolute",left:y0(t),top:y0(e),width:y0(l/o(this,Ps)),height:y0(c/o(this,Rs)),transformOrigin:"0% 0%",transform:`matrix(${u.join(",")})`}),o(this,ng).set(d,{inverseTransform:h,width:l,height:c,x1:t,y1:e}),d},A(Qf,rg,null);Ry=Qf;globalThis._pdfjsTestingUtils={HighlightOutliner:dp};globalThis.pdfjsLib={AbortException:Qr,AnnotationEditorLayer:Fy,AnnotationEditorParamsType:Zt,AnnotationEditorType:Bt,AnnotationEditorUIManager:nl,AnnotationLayer:Dy,AnnotationMode:Ba,AnnotationType:tn,applyOpacity:FT,build:qS,ColorPicker:lp,createValidAbsoluteUrl:mA,CSSConstants:cy,DOMSVGFactory:Zc,DrawLayer:Py,FeatureTest:Xe,fetchData:hb,findContrastColor:PT,getDocument:jS,getFilenameFromUrl:_T,getPdfFilenameFromUrl:MT,getRGB:Bd,getUuid:yA,getXfaPageViewport:OT,GlobalWorkerOptions:Tr,ImageKind:Vf,InvalidPDFException:Id,isDataScheme:ag,isPdfFile:db,isValidExplicitDest:gS,makeArr:cb,makeMap:ub,makeObj:ay,MathClamp:yn,noContextMenu:tr,normalizeUnicode:kT,OPS:Nd,OutputScale:Ls,PasswordResponses:IT,PDFDataRangeTransport:op,PDFDateString:Xc,PDFWorker:Pd,PermissionFlag:NT,PixelsPerInch:ja,RenderingCancelledException:kd,renderRichText:bA,ResponseException:Yc,setLayerDimensions:el,shadow:Ut,SignatureExtractor:Sr,stopEvent:Be,SupportedImageMimeTypes:ly,TextLayer:Fd,TextLayerImages:Ry,TouchManager:ip,updateUrlHash:gA,Util:yt,VerbosityLevel:sg,version:WS,XfaLayer:ep}});var nN={};lg(nN,{default:()=>dF,existsSync:()=>KD,lstatSync:()=>QD,mkdirSync:()=>tN,readFile:()=>YD,readFileSync:()=>XD,readdirSync:()=>JD,statSync:()=>ZD,writeFileSync:()=>eN});function eu(r){throw new Error(`officeparser: 'fs.${r}' is not supported in the browser. Callers must pass file content as Buffer or Uint8Array directly to the parser.`)}var XD,YD,KD,ZD,QD,JD,tN,eN,dF,iN=ne(()=>{"use strict";B();XD=r=>eu("readFileSync"),YD=(r,t)=>eu("readFile"),KD=r=>!1,ZD=r=>eu("statSync"),QD=r=>eu("lstatSync"),JD=r=>eu("readdirSync"),tN=r=>eu("mkdirSync"),eN=(r,t)=>eu("writeFileSync"),dF={readFileSync:XD,readFile:YD,existsSync:KD,statSync:ZD,lstatSync:QD,readdirSync:JD,mkdirSync:tN,writeFileSync:eN,promises:{readFile:r=>Promise.reject(new Error("officeparser: 'fs.promises.readFile' is not supported in the browser.")),writeFile:(r,t)=>Promise.reject(new Error("officeparser: 'fs.promises.writeFile' is not supported in the browser.")),readdir:r=>Promise.reject(new Error("officeparser: 'fs.promises.readdir' is not supported in the browser."))}}});B();B();B();B();B();B();B();var WN="5.6.205",qN=`https://cdn.jsdelivr.net/npm/pdfjs-dist@${WN}/build/pdf.worker.min.mjs`,Ob=/[.!?。!?]/,Fb=["Mr","Dr","Ms","Inc","Ltd","Prof","Sr","Jr","vs","etc"],VN={language:"eng",workerPath:"",corePath:"",langPath:"",autoTerminateTimeout:1e4},fg={outputErrorToConsole:!1,onWarning:()=>{},newlineDelimiter:`
|
|
68
|
+
`)){let n=document.createElement("div");n.append(e?document.createTextNode(e):document.createElement("br")),this.editorDiv.append(n)}},rD=function(){return o(this,$i).replaceAll("\xA0"," ")},qA=function(e){return e.replaceAll(" ","\xA0")},sD=function(e){let{value:n,fontSize:i,color:s,pageIndex:a}=this._initialData;return this.hasEditedComment||this._hasBeenMoved||e.value!==n||e.fontSize!==i||e.color.some((l,c)=>l!==s[c])||e.pageIndex!==a},A(Ie,za),U(Ie,"_freeTextDefaultContent",""),U(Ie,"_internalPadding",0),U(Ie,"_defaultColor",null),U(Ie,"_defaultFontSize",10),U(Ie,"_type","freetext"),U(Ie,"_editorType",Bt.FREETEXT);WA=Ie,Dt=class{toSVGPath(){ue("Abstract method `toSVGPath` must be implemented.")}get box(){ue("Abstract getter `box` must be implemented.")}serialize(t,e){ue("Abstract method `serialize` must be implemented.")}static _rescale(t,e,n,i,s,a){a||(a=new Float32Array(t.length));for(let l=0,c=t.length;l<c;l+=2)a[l]=e+t[l]*i,a[l+1]=n+t[l+1]*s;return a}static _rescaleAndSwap(t,e,n,i,s,a){a||(a=new Float32Array(t.length));for(let l=0,c=t.length;l<c;l+=2)a[l]=e+t[l+1]*i,a[l+1]=n+t[l]*s;return a}static _translate(t,e,n,i){i||(i=new Float32Array(t.length));for(let s=0,a=t.length;s<a;s+=2)i[s]=e+t[s],i[s+1]=n+t[s+1];return i}static svgRound(t){return Math.round(t*1e4)}static _normalizePoint(t,e,n,i,s){switch(s){case 90:return[1-e/n,t/i];case 180:return[1-t/n,1-e/i];case 270:return[e/n,1-t/i];default:return[t/n,e/i]}}static _normalizePagePoint(t,e,n){switch(n){case 90:return[1-e,t];case 180:return[1-t,1-e];case 270:return[e,1-t];default:return[t,e]}}static createBezierPoints(t,e,n,i,s,a){return[(t+5*n)/6,(e+5*i)/6,(5*n+s)/6,(5*i+a)/6,(n+s)/2,(i+a)/2]}};U(Dt,"PRECISION",1e-4);ra=class ra{constructor({x:t,y:e},n,i,s,a,l=0){A(this,bn);A(this,ji);A(this,Wr,[]);A(this,sd);A(this,ad);A(this,Is,[]);A(this,Vt,new Float32Array(18));A(this,kc);A(this,_c);A(this,Um);A(this,$m);A(this,od);A(this,ld);A(this,Ho,[]);g(this,ji,n),g(this,ld,s*i),g(this,ad,a),o(this,Vt).set([NaN,NaN,NaN,NaN,t,e],6),g(this,sd,l),g(this,$m,o(ra,zm)*i),g(this,Um,o(ra,eb)*i),g(this,od,i),o(this,Ho).push(t,e)}isEmpty(){return isNaN(o(this,Vt)[8])}add({x:t,y:e}){g(this,kc,t),g(this,_c,e);let[n,i,s,a]=o(this,ji),[l,c,u,h]=o(this,Vt).subarray(8,12),d=t-u,f=e-h,p=Math.hypot(d,f);if(p<o(this,Um))return!1;let m=p-o(this,$m),y=m/p,x=y*d,b=y*f,w=l,C=c;l=u,c=h,u+=x,h+=b,o(this,Ho)?.push(t,e);let E=-b/m,S=x/m,N=E*o(this,ld),k=S*o(this,ld);return o(this,Vt).set(o(this,Vt).subarray(2,8),0),o(this,Vt).set([u+N,h+k],4),o(this,Vt).set(o(this,Vt).subarray(14,18),12),o(this,Vt).set([u-N,h-k],16),isNaN(o(this,Vt)[6])?(o(this,Is).length===0&&(o(this,Vt).set([l+N,c+k],2),o(this,Is).push(NaN,NaN,NaN,NaN,(l+N-n)/s,(c+k-i)/a),o(this,Vt).set([l-N,c-k],14),o(this,Wr).push(NaN,NaN,NaN,NaN,(l-N-n)/s,(c-k-i)/a)),o(this,Vt).set([w,C,l,c,u,h],6),!this.isEmpty()):(o(this,Vt).set([w,C,l,c,u,h],6),Math.abs(Math.atan2(C-c,w-l)-Math.atan2(b,x))<Math.PI/2?([l,c,u,h]=o(this,Vt).subarray(2,6),o(this,Is).push(NaN,NaN,NaN,NaN,((l+u)/2-n)/s,((c+h)/2-i)/a),[l,c,w,C]=o(this,Vt).subarray(14,18),o(this,Wr).push(NaN,NaN,NaN,NaN,((w+l)/2-n)/s,((C+c)/2-i)/a),!0):([w,C,l,c,u,h]=o(this,Vt).subarray(0,6),o(this,Is).push(((w+5*l)/6-n)/s,((C+5*c)/6-i)/a,((5*l+u)/6-n)/s,((5*c+h)/6-i)/a,((l+u)/2-n)/s,((c+h)/2-i)/a),[u,h,l,c,w,C]=o(this,Vt).subarray(12,18),o(this,Wr).push(((w+5*l)/6-n)/s,((C+5*c)/6-i)/a,((5*l+u)/6-n)/s,((5*c+h)/6-i)/a,((l+u)/2-n)/s,((c+h)/2-i)/a),!0))}toSVGPath(){if(this.isEmpty())return"";let t=o(this,Is),e=o(this,Wr);if(isNaN(o(this,Vt)[6])&&!this.isEmpty())return v(this,bn,aD).call(this);let n=[];n.push(`M${t[4]} ${t[5]}`);for(let i=6;i<t.length;i+=6)isNaN(t[i])?n.push(`L${t[i+4]} ${t[i+5]}`):n.push(`C${t[i]} ${t[i+1]} ${t[i+2]} ${t[i+3]} ${t[i+4]} ${t[i+5]}`);v(this,bn,lD).call(this,n);for(let i=e.length-6;i>=6;i-=6)isNaN(e[i])?n.push(`L${e[i+4]} ${e[i+5]}`):n.push(`C${e[i]} ${e[i+1]} ${e[i+2]} ${e[i+3]} ${e[i+4]} ${e[i+5]}`);return v(this,bn,oD).call(this,n),n.join(" ")}newFreeDrawOutline(t,e,n,i,s,a){return new Iy(t,e,n,i,s,a)}getOutlines(){let t=o(this,Is),e=o(this,Wr),n=o(this,Vt),[i,s,a,l]=o(this,ji),c=new Float32Array((o(this,Ho)?.length??0)+2);for(let d=0,f=c.length-2;d<f;d+=2)c[d]=(o(this,Ho)[d]-i)/a,c[d+1]=(o(this,Ho)[d+1]-s)/l;if(c[c.length-2]=(o(this,kc)-i)/a,c[c.length-1]=(o(this,_c)-s)/l,isNaN(n[6])&&!this.isEmpty())return v(this,bn,cD).call(this,c);let u=new Float32Array(o(this,Is).length+24+o(this,Wr).length),h=t.length;for(let d=0;d<h;d+=2){if(isNaN(t[d])){u[d]=u[d+1]=NaN;continue}u[d]=t[d],u[d+1]=t[d+1]}h=v(this,bn,hD).call(this,u,h);for(let d=e.length-6;d>=6;d-=6)for(let f=0;f<6;f+=2){if(isNaN(e[d+f])){u[h]=u[h+1]=NaN,h+=2;continue}u[h]=e[d+f],u[h+1]=e[d+f+1],h+=2}return v(this,bn,uD).call(this,u,h),this.newFreeDrawOutline(u,c,o(this,ji),o(this,od),o(this,sd),o(this,ad))}};ji=new WeakMap,Wr=new WeakMap,sd=new WeakMap,ad=new WeakMap,Is=new WeakMap,Vt=new WeakMap,kc=new WeakMap,_c=new WeakMap,Um=new WeakMap,$m=new WeakMap,od=new WeakMap,ld=new WeakMap,Ho=new WeakMap,zm=new WeakMap,tb=new WeakMap,eb=new WeakMap,bn=new WeakSet,zf=function(){let t=o(this,Vt).subarray(4,6),e=o(this,Vt).subarray(16,18),[n,i,s,a]=o(this,ji);return[(o(this,kc)+(t[0]-e[0])/2-n)/s,(o(this,_c)+(t[1]-e[1])/2-i)/a,(o(this,kc)+(e[0]-t[0])/2-n)/s,(o(this,_c)+(e[1]-t[1])/2-i)/a]},aD=function(){let[t,e,n,i]=o(this,ji),[s,a,l,c]=v(this,bn,zf).call(this);return`M${(o(this,Vt)[2]-t)/n} ${(o(this,Vt)[3]-e)/i} L${(o(this,Vt)[4]-t)/n} ${(o(this,Vt)[5]-e)/i} L${s} ${a} L${l} ${c} L${(o(this,Vt)[16]-t)/n} ${(o(this,Vt)[17]-e)/i} L${(o(this,Vt)[14]-t)/n} ${(o(this,Vt)[15]-e)/i} Z`},oD=function(t){let e=o(this,Wr);t.push(`L${e[4]} ${e[5]} Z`)},lD=function(t){let[e,n,i,s]=o(this,ji),a=o(this,Vt).subarray(4,6),l=o(this,Vt).subarray(16,18),[c,u,h,d]=v(this,bn,zf).call(this);t.push(`L${(a[0]-e)/i} ${(a[1]-n)/s} L${c} ${u} L${h} ${d} L${(l[0]-e)/i} ${(l[1]-n)/s}`)},cD=function(t){let e=o(this,Vt),[n,i,s,a]=o(this,ji),[l,c,u,h]=v(this,bn,zf).call(this),d=new Float32Array(36);return d.set([NaN,NaN,NaN,NaN,(e[2]-n)/s,(e[3]-i)/a,NaN,NaN,NaN,NaN,(e[4]-n)/s,(e[5]-i)/a,NaN,NaN,NaN,NaN,l,c,NaN,NaN,NaN,NaN,u,h,NaN,NaN,NaN,NaN,(e[16]-n)/s,(e[17]-i)/a,NaN,NaN,NaN,NaN,(e[14]-n)/s,(e[15]-i)/a],0),this.newFreeDrawOutline(d,t,o(this,ji),o(this,od),o(this,sd),o(this,ad))},uD=function(t,e){let n=o(this,Wr);return t.set([NaN,NaN,NaN,NaN,n[4],n[5]],e),e+=6},hD=function(t,e){let n=o(this,Vt).subarray(4,6),i=o(this,Vt).subarray(16,18),[s,a,l,c]=o(this,ji),[u,h,d,f]=v(this,bn,zf).call(this);return t.set([NaN,NaN,NaN,NaN,(n[0]-s)/l,(n[1]-a)/c,NaN,NaN,NaN,NaN,u,h,NaN,NaN,NaN,NaN,d,f,NaN,NaN,NaN,NaN,(i[0]-s)/l,(i[1]-a)/c],e),e+=24},A(ra,zm,8),A(ra,tb,2),A(ra,eb,o(ra,zm)+o(ra,tb));Ny=ra,Iy=class extends Dt{constructor(e,n,i,s,a,l){super();A(this,nb);A(this,cd);A(this,Mc,new Float32Array(4));A(this,_a);A(this,jm);A(this,Gi);A(this,Gm);A(this,sn);g(this,sn,e),g(this,Gi,n),g(this,cd,i),g(this,Gm,s),g(this,_a,a),g(this,jm,l),this.firstPoint=[NaN,NaN],this.lastPoint=[NaN,NaN],v(this,nb,dD).call(this,l);let[c,u,h,d]=o(this,Mc);for(let f=0,p=e.length;f<p;f+=2)e[f]=(e[f]-c)/h,e[f+1]=(e[f+1]-u)/d;for(let f=0,p=n.length;f<p;f+=2)n[f]=(n[f]-c)/h,n[f+1]=(n[f+1]-u)/d}toSVGPath(){let e=[`M${o(this,sn)[4]} ${o(this,sn)[5]}`];for(let n=6,i=o(this,sn).length;n<i;n+=6){if(isNaN(o(this,sn)[n])){e.push(`L${o(this,sn)[n+4]} ${o(this,sn)[n+5]}`);continue}e.push(`C${o(this,sn)[n]} ${o(this,sn)[n+1]} ${o(this,sn)[n+2]} ${o(this,sn)[n+3]} ${o(this,sn)[n+4]} ${o(this,sn)[n+5]}`)}return e.push("Z"),e.join(" ")}serialize([e,n,i,s],a){let l=i-e,c=s-n,u,h;switch(a){case 0:u=Dt._rescale(o(this,sn),e,s,l,-c),h=Dt._rescale(o(this,Gi),e,s,l,-c);break;case 90:u=Dt._rescaleAndSwap(o(this,sn),e,n,l,c),h=Dt._rescaleAndSwap(o(this,Gi),e,n,l,c);break;case 180:u=Dt._rescale(o(this,sn),i,n,-l,c),h=Dt._rescale(o(this,Gi),i,n,-l,c);break;case 270:u=Dt._rescaleAndSwap(o(this,sn),i,s,-l,-c),h=Dt._rescaleAndSwap(o(this,Gi),i,s,-l,-c);break}return{outline:Array.from(u),points:[Array.from(h)]}}get box(){return o(this,Mc)}newOutliner(e,n,i,s,a,l=0){return new Ny(e,n,i,s,a,l)}getNewOutline(e,n){let[i,s,a,l]=o(this,Mc),[c,u,h,d]=o(this,cd),f=a*h,p=l*d,m=i*h+c,y=s*d+u,x=this.newOutliner({x:o(this,Gi)[0]*f+m,y:o(this,Gi)[1]*p+y},o(this,cd),o(this,Gm),e,o(this,jm),n??o(this,_a));for(let b=2;b<o(this,Gi).length;b+=2)x.add({x:o(this,Gi)[b]*f+m,y:o(this,Gi)[b+1]*p+y});return x.getOutlines()}};cd=new WeakMap,Mc=new WeakMap,_a=new WeakMap,jm=new WeakMap,Gi=new WeakMap,Gm=new WeakMap,sn=new WeakMap,nb=new WeakSet,dD=function(e){let n=o(this,sn),i=n[4],s=n[5],a=[i,s,i,s],l=i,c=s,u=i,h=s,d=e?Math.max:Math.min,f=new Float32Array(4);for(let m=6,y=n.length;m<y;m+=6){let x=n[m+4],b=n[m+5];isNaN(n[m])?(yt.pointBoundingBox(x,b,a),c>b?(l=x,c=b):c===b&&(l=d(l,x)),h<b?(u=x,h=b):h===b&&(u=d(u,x))):(f[0]=f[1]=1/0,f[2]=f[3]=-1/0,yt.bezierBoundingBox(i,s,...n.slice(m,m+6),f),yt.rectBoundingBox(f[0],f[1],f[2],f[3],a),c>f[1]?(l=f[0],c=f[1]):c===f[1]&&(l=d(l,f[0])),h<f[3]?(u=f[2],h=f[3]):h===f[3]&&(u=d(u,f[2]))),i=x,s=b}let p=o(this,Mc);p[0]=a[0]-o(this,_a),p[1]=a[1]-o(this,_a),p[2]=a[2]-a[0]+2*o(this,_a),p[3]=a[3]-a[1]+2*o(this,_a),this.firstPoint=[l,c],this.lastPoint=[u,h]};dp=class{constructor(t,e=0,n=0,i=!0){A(this,hi);A(this,Hm);A(this,Wm);A(this,qm);A(this,Wo,[]);A(this,qr,[]);let s=[1/0,1/0,-1/0,-1/0],l=10**-4;for(let{x,y:b,width:w,height:C}of t){let E=Math.floor((x-e)/l)*l,S=Math.ceil((x+w+e)/l)*l,N=Math.floor((b-e)/l)*l,k=Math.ceil((b+C+e)/l)*l,M=[E,N,k,!0],R=[S,N,k,!1];o(this,Wo).push(M,R),yt.rectBoundingBox(E,N,S,k,s)}let c=s[2]-s[0]+2*n,u=s[3]-s[1]+2*n,h=s[0]-n,d=s[1]-n,f=i?-1/0:1/0,p=1/0,m=o(this,Wo).at(i?-1:-2),y=[m[0],m[2]];for(let x of o(this,Wo)){let[b,w,C,E]=x;!E&&i?w<p?(p=w,f=b):w===p&&(f=Math.max(f,b)):E&&!i&&(w<p?(p=w,f=b):w===p&&(f=Math.min(f,b))),x[0]=(b-h)/c,x[1]=(w-d)/u,x[2]=(C-d)/u}g(this,Hm,new Float32Array([h,d,c,u])),g(this,Wm,[f,p]),g(this,qm,y)}getOutlines(){o(this,Wo).sort((e,n)=>e[0]-n[0]||e[1]-n[1]||e[2]-n[2]);let t=[];for(let e of o(this,Wo))e[3]?(t.push(...v(this,hi,VA).call(this,e)),v(this,hi,pD).call(this,e)):(v(this,hi,mD).call(this,e),t.push(...v(this,hi,VA).call(this,e)));return v(this,hi,fD).call(this,t)}};Hm=new WeakMap,Wm=new WeakMap,qm=new WeakMap,Wo=new WeakMap,qr=new WeakMap,hi=new WeakSet,fD=function(t){let e=[],n=new Set;for(let a of t){let[l,c,u]=a;e.push([l,c,a],[l,u,a])}e.sort((a,l)=>a[1]-l[1]||a[0]-l[0]);for(let a=0,l=e.length;a<l;a+=2){let c=e[a][2],u=e[a+1][2];c.push(u),u.push(c),n.add(c),n.add(u)}let i=[],s;for(;n.size>0;){let a=n.values().next().value,[l,c,u,h,d]=a;n.delete(a);let f=l,p=c;for(s=[l,u],i.push(s);;){let m;if(n.has(h))m=h;else if(n.has(d))m=d;else break;n.delete(m),[l,c,u,h,d]=m,f!==l&&(s.push(f,p,l,p===c?c:u),f=l),p=p===c?u:c}s.push(f,p)}return new XA(i,o(this,Hm),o(this,Wm),o(this,qm))},V0=function(t){let e=o(this,qr),n=0,i=e.length-1;for(;n<=i;){let s=n+i>>1,a=e[s][0];if(a===t)return s;a<t?n=s+1:i=s-1}return i+1},pD=function([,t,e]){let n=v(this,hi,V0).call(this,t);o(this,qr).splice(n,0,[t,e])},mD=function([,t,e]){let n=v(this,hi,V0).call(this,t);for(let i=n;i<o(this,qr).length;i++){let[s,a]=o(this,qr)[i];if(s!==t)break;if(s===t&&a===e){o(this,qr).splice(i,1);return}}for(let i=n-1;i>=0;i--){let[s,a]=o(this,qr)[i];if(s!==t)break;if(s===t&&a===e){o(this,qr).splice(i,1);return}}},VA=function(t){let[e,n,i]=t,s=[[e,n,i]],a=v(this,hi,V0).call(this,i);for(let l=0;l<a;l++){let[c,u]=o(this,qr)[l];for(let h=0,d=s.length;h<d;h++){let[,f,p]=s[h];if(!(u<=f||p<=c)){if(f>=c){if(p>u)s[h][1]=u;else{if(d===1)return[];s.splice(h,1),h--,d--}continue}s[h][2]=c,p>u&&s.push([e,u,p])}}}return s};XA=class extends Dt{constructor(e,n,i,s){super();A(this,Vm);A(this,ud);g(this,ud,e),g(this,Vm,n),this.firstPoint=i,this.lastPoint=s}toSVGPath(){let e=[];for(let n of o(this,ud)){let[i,s]=n;e.push(`M${i} ${s}`);for(let a=2;a<n.length;a+=2){let l=n[a],c=n[a+1];l===i?(e.push(`V${c}`),s=c):c===s&&(e.push(`H${l}`),i=l)}e.push("Z")}return e.join(" ")}serialize([e,n,i,s],a){let l=[],c=i-e,u=s-n;for(let h of o(this,ud)){let d=new Array(h.length);for(let f=0;f<h.length;f+=2)d[f]=e+h[f]*c,d[f+1]=s-h[f+1]*u;l.push(d)}return l}get box(){return o(this,Vm)}get classNamesForOutlining(){return["highlightOutline"]}};Vm=new WeakMap,ud=new WeakMap;fp=class extends Ny{newFreeDrawOutline(t,e,n,i,s,a){return new YA(t,e,n,i,s,a)}},YA=class extends Iy{newOutliner(t,e,n,i,s,a=0){return new fp(t,e,n,i,s,a)}},oe=class oe extends Se{constructor(e){super({...e,name:"highlightEditor"});A(this,Ht);A(this,hd,null);A(this,Xm,0);A(this,Ma);A(this,Oc,null);A(this,Ym,null);A(this,Ei,null);A(this,Km,null);A(this,Zm,0);A(this,Fc,null);A(this,Hi,null);A(this,Wi,null);A(this,zn,!1);A(this,dd,null);A(this,fd,null);A(this,ti,null);A(this,pd,"");A(this,Cr);A(this,Qm,"");this.color=e.color||oe._defaultColor,g(this,Cr,e.thickness||oe._defaultThickness),this.opacity=e.opacity||oe._defaultOpacity,g(this,Ma,e.boxes||null),g(this,Qm,e.methodOfCreation||""),g(this,pd,e.text||""),this._isDraggable=!1,this.defaultL10nId="pdfjs-editor-highlight-editor",e.highlightId>-1?(g(this,zn,!0),v(this,Ht,X0).call(this,e),v(this,Ht,Cl).call(this)):o(this,Ma)&&(g(this,hd,e.anchorNode),g(this,Xm,e.anchorOffset),g(this,Km,e.focusNode),g(this,Zm,e.focusOffset),v(this,Ht,KA).call(this),v(this,Ht,Cl).call(this),this.rotate(this.rotation)),this.annotationElementId||this._uiManager.a11yAlert("pdfjs-editor-highlight-added-alert")}static get _keyboardManager(){let e=oe.prototype;return Ut(this,"_keyboardManager",new Kc([[["ArrowLeft","mac+ArrowLeft"],e._moveCaret,{args:[0]}],[["ArrowRight","mac+ArrowRight"],e._moveCaret,{args:[1]}],[["ArrowUp","mac+ArrowUp"],e._moveCaret,{args:[2]}],[["ArrowDown","mac+ArrowDown"],e._moveCaret,{args:[3]}]]))}get telemetryInitialData(){return{action:"added",type:o(this,zn)?"free_highlight":"highlight",color:this._uiManager.getNonHCMColorName(this.color),thickness:o(this,Cr),methodOfCreation:o(this,Qm)}}get telemetryFinalData(){return{type:"highlight",color:this._uiManager.getNonHCMColorName(this.color)}}static computeTelemetryFinalData(e){return{numberOfColors:e.get("color").size}}static initialize(e,n){Se.initialize(e,n),oe._defaultColor||(oe._defaultColor=n.highlightColors?.values().next().value||"#fff066")}static updateDefaultParams(e,n){switch(e){case Zt.HIGHLIGHT_COLOR:oe._defaultColor=n;break;case Zt.HIGHLIGHT_THICKNESS:oe._defaultThickness=n;break}}translateInPage(e,n){}get toolbarPosition(){return o(this,fd)}get commentButtonPosition(){return o(this,dd)}updateParams(e,n){switch(e){case Zt.HIGHLIGHT_COLOR:v(this,Ht,gD).call(this,n);break;case Zt.HIGHLIGHT_THICKNESS:v(this,Ht,yD).call(this,n);break}}static get defaultPropertiesToUpdate(){return[[Zt.HIGHLIGHT_COLOR,oe._defaultColor],[Zt.HIGHLIGHT_THICKNESS,oe._defaultThickness]]}get propertiesToUpdate(){return[[Zt.HIGHLIGHT_COLOR,this.color||oe._defaultColor],[Zt.HIGHLIGHT_THICKNESS,o(this,Cr)||oe._defaultThickness],[Zt.HIGHLIGHT_FREE,o(this,zn)]]}onUpdatedColor(){this.parent?.drawLayer.updateProperties(o(this,Wi),{root:{fill:this.color,"fill-opacity":this.opacity}}),o(this,Ym)?.updateColor(this.color),super.onUpdatedColor()}get toolbarButtons(){return this._uiManager.highlightColors?[["colorPicker",g(this,Ym,new lp({editor:this}))]]:super.toolbarButtons}disableEditing(){super.disableEditing(),this.div.classList.toggle("disabled",!0)}enableEditing(){super.enableEditing(),this.div.classList.toggle("disabled",!1)}fixAndSetPosition(){return super.fixAndSetPosition(v(this,Ht,K0).call(this))}getBaseTranslation(){return[0,0]}getRect(e,n){return super.getRect(e,n,v(this,Ht,K0).call(this))}onceAdded(e){this.annotationElementId||this.parent.addUndoableEditor(this),e&&this.div.focus()}remove(){v(this,Ht,ZA).call(this),this._reportTelemetry({action:"deleted"}),super.remove()}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(v(this,Ht,Cl).call(this),this.isAttachedToDOM||this.parent.add(this)))}setParent(e){let n=!1;this.parent&&!e?v(this,Ht,ZA).call(this):e&&(v(this,Ht,Cl).call(this,e),n=!this.parent&&this.div?.classList.contains("selectedEditor")),super.setParent(e),this.show(this._isVisible),n&&this.select()}rotate(e){var s,a,l;let{drawLayer:n}=this.parent,i;o(this,zn)?(e=(e-this.rotation+360)%360,i=v(s=oe,Dr,qu).call(s,o(this,Hi).box,e)):i=v(a=oe,Dr,qu).call(a,[this.x,this.y,this.width,this.height],e),n.updateProperties(o(this,Wi),{bbox:i,root:{"data-main-rotation":e}}),n.updateProperties(o(this,ti),{bbox:v(l=oe,Dr,qu).call(l,o(this,Ei).box,e),root:{"data-main-rotation":e}})}render(){if(this.div)return this.div;let e=super.render();o(this,pd)&&(e.setAttribute("aria-label",o(this,pd)),e.setAttribute("role","mark")),o(this,zn)?e.classList.add("free"):this.div.addEventListener("keydown",v(this,Ht,xD).bind(this),{signal:this._uiManager._signal});let n=g(this,Fc,document.createElement("div"));return e.append(n),n.setAttribute("aria-hidden","true"),n.className="internal",n.style.clipPath=o(this,Oc),this.setDims(),GT(this,o(this,Fc),["pointerover","pointerleave"]),this.enableEditing(),e}pointerover(){this.isSelected||this.parent?.drawLayer.updateProperties(o(this,ti),{rootClass:{hovered:!0}})}pointerleave(){this.isSelected||this.parent?.drawLayer.updateProperties(o(this,ti),{rootClass:{hovered:!1}})}_moveCaret(e){switch(this.parent.unselect(this),e){case 0:case 2:v(this,Ht,Y0).call(this,!0);break;case 1:case 3:v(this,Ht,Y0).call(this,!1);break}}select(){super.select(),o(this,ti)&&this.parent?.drawLayer.updateProperties(o(this,ti),{rootClass:{hovered:!1,selected:!0}})}unselect(){super.unselect(),o(this,ti)&&(this.parent?.drawLayer.updateProperties(o(this,ti),{rootClass:{selected:!1}}),o(this,zn)||v(this,Ht,Y0).call(this,!1))}get _mustFixPosition(){return!o(this,zn)}show(e=this._isVisible){super.show(e),this.parent&&(this.parent.drawLayer.updateProperties(o(this,Wi),{rootClass:{hidden:!e}}),this.parent.drawLayer.updateProperties(o(this,ti),{rootClass:{hidden:!e}}))}static startHighlighting(e,n,{target:i,x:s,y:a}){let{x:l,y:c,width:u,height:h}=i.getBoundingClientRect(),d=new AbortController,f=e.combinedSignal(d),p=m=>{d.abort(),v(this,Dr,CD).call(this,e,m)};window.addEventListener("blur",p,{signal:f}),window.addEventListener("pointerup",p,{signal:f}),window.addEventListener("pointerdown",Be,{capture:!0,passive:!1,signal:f}),window.addEventListener("contextmenu",tr,{signal:f}),i.addEventListener("pointermove",v(this,Dr,vD).bind(this,e),{signal:f}),this._freeHighlight=new fp({x:s,y:a},[l,c,u,h],e.scale,this._defaultThickness/2,n,.001),{id:this._freeHighlightId,clipPathId:this._freeHighlightClipId}=e.drawLayer.draw({bbox:[0,0,1,1],root:{viewBox:"0 0 1 1",fill:this._defaultColor,"fill-opacity":this._defaultOpacity},rootClass:{highlight:!0,free:!0},path:{d:this._freeHighlight.toSVGPath()}},!0,!0)}static async deserialize(e,n,i){var x,b,w,C;let s=null;if(e instanceof Ty){let{data:{quadPoints:E,rect:S,rotation:N,id:k,color:M,opacity:R,popupRef:j,richText:$,contentsObj:q,creationDate:Q,modificationDate:Z},parent:{page:{pageNumber:Y}}}=e;s=e={annotationType:Bt.HIGHLIGHT,color:Array.from(M),opacity:R,quadPoints:E,boxes:null,pageIndex:Y-1,rect:S.slice(0),rotation:N,annotationElementId:k,id:k,deleted:!1,popupRef:j,richText:$,comment:q?.str||null,creationDate:Q,modificationDate:Z}}else if(e instanceof hp){let{data:{inkLists:E,rect:S,rotation:N,id:k,color:M,borderStyle:{rawWidth:R},popupRef:j,richText:$,contentsObj:q,creationDate:Q,modificationDate:Z},parent:{page:{pageNumber:Y}}}=e;s=e={annotationType:Bt.HIGHLIGHT,color:Array.from(M),thickness:R,inkLists:E,boxes:null,pageIndex:Y-1,rect:S.slice(0),rotation:N,annotationElementId:k,id:k,deleted:!1,popupRef:j,richText:$,comment:q?.str||null,creationDate:Q,modificationDate:Z}}let{color:a,quadPoints:l,inkLists:c,outlines:u,opacity:h}=e,d=await super.deserialize(e,n,i);d.color=yt.makeHexColor(...a),d.opacity=h||1,c&&g(d,Cr,e.thickness),d._initialData=s,e.comment&&d.setCommentData(e);let[f,p]=d.pageDimensions,[m,y]=d.pageTranslation;if(l){let E=g(d,Ma,[]);for(let S=0;S<l.length;S+=8)E.push({x:(l[S]-m)/f,y:1-(l[S+1]-y)/p,width:(l[S+2]-l[S])/f,height:(l[S+1]-l[S+5])/p});v(x=d,Ht,KA).call(x),v(b=d,Ht,Cl).call(b),d.rotate(d.rotation)}else if(c||u){g(d,zn,!0);let E=(c||u.points)[0],S={x:E[0]-m,y:p-(E[1]-y)},N=new fp(S,[0,0,f,p],1,o(d,Cr)/2,!0,.001);for(let R=0,j=E.length;R<j;R+=2)S.x=E[R]-m,S.y=p-(E[R+1]-y),N.add(S);let{id:k,clipPathId:M}=n.drawLayer.draw({bbox:[0,0,1,1],root:{viewBox:"0 0 1 1",fill:d.color,"fill-opacity":d._defaultOpacity},rootClass:{highlight:!0,free:!0},path:{d:N.toSVGPath()}},!0,!0);v(w=d,Ht,X0).call(w,{highlightOutlines:N.getOutlines(),highlightId:k,clipPathId:M}),v(C=d,Ht,Cl).call(C),d.rotate(d.parentRotation)}return d}serialize(e=!1){if(this.isEmpty()||e)return null;if(this.deleted)return this.serializeDeleted();let n=Se._colorManager.convert(this._uiManager.getNonHCMColor(this.color)),i=super.serialize(e);return Object.assign(i,{color:n,opacity:this.opacity,thickness:o(this,Cr),quadPoints:v(this,Ht,wD).call(this),outlines:v(this,Ht,AD).call(this,i.rect)}),this.addComment(i),this.annotationElementId&&!v(this,Ht,ED).call(this,i)?null:(i.id=this.annotationElementId,i)}renderAnnotationElement(e){return this.deleted?(e.hide(),null):(e.updateEdited({rect:this.getPDFRect(),popup:this.comment}),null)}static canCreateNewEmptyEditor(){return!1}};hd=new WeakMap,Xm=new WeakMap,Ma=new WeakMap,Oc=new WeakMap,Ym=new WeakMap,Ei=new WeakMap,Km=new WeakMap,Zm=new WeakMap,Fc=new WeakMap,Hi=new WeakMap,Wi=new WeakMap,zn=new WeakMap,dd=new WeakMap,fd=new WeakMap,ti=new WeakMap,pd=new WeakMap,Cr=new WeakMap,Qm=new WeakMap,Ht=new WeakSet,KA=function(){let e=new dp(o(this,Ma),.001);g(this,Hi,e.getOutlines()),[this.x,this.y,this.width,this.height]=o(this,Hi).box;let n=new dp(o(this,Ma),.0025,.001,this._uiManager.direction==="ltr");g(this,Ei,n.getOutlines());let{firstPoint:i}=o(this,Hi);g(this,dd,[(i[0]-this.x)/this.width,(i[1]-this.y)/this.height]);let{lastPoint:s}=o(this,Ei);g(this,fd,[(s[0]-this.x)/this.width,(s[1]-this.y)/this.height])},X0=function({highlightOutlines:e,highlightId:n,clipPathId:i}){var f,p;if(g(this,Hi,e),g(this,Ei,e.getNewOutline(o(this,Cr)/2+1.5,.0025)),n>=0)g(this,Wi,n),g(this,Oc,i),this.parent.drawLayer.finalizeDraw(n,{bbox:e.box,path:{d:e.toSVGPath()}}),g(this,ti,this.parent.drawLayer.drawOutline({rootClass:{highlightOutline:!0,free:!0},bbox:o(this,Ei).box,path:{d:o(this,Ei).toSVGPath()}},!0));else if(this.parent){let m=this.parent.viewport.rotation;this.parent.drawLayer.updateProperties(o(this,Wi),{bbox:v(f=oe,Dr,qu).call(f,o(this,Hi).box,(m-this.rotation+360)%360),path:{d:e.toSVGPath()}}),this.parent.drawLayer.updateProperties(o(this,ti),{bbox:v(p=oe,Dr,qu).call(p,o(this,Ei).box,m),path:{d:o(this,Ei).toSVGPath()}})}let[a,l,c,u]=e.box;switch(this.rotation){case 0:this.x=a,this.y=l,this.width=c,this.height=u;break;case 90:{let[m,y]=this.parentDimensions;this.x=l,this.y=1-a,this.width=c*y/m,this.height=u*m/y;break}case 180:this.x=1-a,this.y=1-l,this.width=c,this.height=u;break;case 270:{let[m,y]=this.parentDimensions;this.x=1-l,this.y=a,this.width=c*y/m,this.height=u*m/y;break}}let{firstPoint:h}=e;g(this,dd,[(h[0]-a)/c,(h[1]-l)/u]);let{lastPoint:d}=o(this,Ei);g(this,fd,[(d[0]-a)/c,(d[1]-l)/u])},gD=function(e){let n=(a,l)=>{this.color=a,this.opacity=l,this.onUpdatedColor()},i=this.color,s=this.opacity;this.addCommands({cmd:n.bind(this,e,oe._defaultOpacity),undo:n.bind(this,i,s),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:Zt.HIGHLIGHT_COLOR,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"color_changed",color:this._uiManager.getNonHCMColorName(e)},!0)},yD=function(e){let n=o(this,Cr),i=s=>{g(this,Cr,s),v(this,Ht,bD).call(this,s)};this.addCommands({cmd:i.bind(this,e),undo:i.bind(this,n),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:Zt.INK_THICKNESS,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"thickness_changed",thickness:e},!0)},bD=function(e){o(this,zn)&&(v(this,Ht,X0).call(this,{highlightOutlines:o(this,Hi).getNewOutline(e/2)}),this.fixAndSetPosition(),this.setDims())},ZA=function(){o(this,Wi)===null||!this.parent||(this.parent.drawLayer.remove(o(this,Wi)),g(this,Wi,null),this.parent.drawLayer.remove(o(this,ti)),g(this,ti,null))},Cl=function(e=this.parent){o(this,Wi)===null&&({id:an(this,Wi)._,clipPathId:an(this,Oc)._}=e.drawLayer.draw({bbox:o(this,Hi).box,root:{viewBox:"0 0 1 1",fill:this.color,"fill-opacity":this.opacity},rootClass:{highlight:!0,free:o(this,zn)},path:{d:o(this,Hi).toSVGPath()}},!1,!0),g(this,ti,e.drawLayer.drawOutline({rootClass:{highlightOutline:!0,free:o(this,zn)},bbox:o(this,Ei).box,path:{d:o(this,Ei).toSVGPath()}},o(this,zn))),o(this,Fc)&&(o(this,Fc).style.clipPath=o(this,Oc)))},Dr=new WeakSet,qu=function([e,n,i,s],a){switch(a){case 90:return[1-n-s,e,s,i];case 180:return[1-e-i,1-n-s,i,s];case 270:return[n,1-e-i,s,i]}return[e,n,i,s]},xD=function(e){oe._keyboardManager.exec(this,e)},Y0=function(e){if(!o(this,hd))return;let n=window.getSelection();e?n.setPosition(o(this,hd),o(this,Xm)):n.setPosition(o(this,Km),o(this,Zm))},K0=function(){return o(this,zn)?this.rotation:0},wD=function(){if(o(this,zn))return null;let[e,n]=this.pageDimensions,[i,s]=this.pageTranslation,a=o(this,Ma),l=new Float32Array(a.length*8),c=0;for(let{x:u,y:h,width:d,height:f}of a){let p=u*e+i,m=(1-h)*n+s;l[c]=l[c+4]=p,l[c+1]=l[c+3]=m,l[c+2]=l[c+6]=p+d*e,l[c+5]=l[c+7]=m-f*n,c+=8}return l},AD=function(e){return o(this,Hi).serialize(e,v(this,Ht,K0).call(this))},vD=function(e,n){this._freeHighlight.add(n)&&e.drawLayer.updateProperties(this._freeHighlightId,{path:{d:this._freeHighlight.toSVGPath()}})},CD=function(e,n){this._freeHighlight.isEmpty()?e.drawLayer.remove(this._freeHighlightId):e.createAndAddNewEditor(n,!1,{highlightId:this._freeHighlightId,highlightOutlines:this._freeHighlight.getOutlines(),clipPathId:this._freeHighlightClipId,methodOfCreation:"main_toolbar"}),this._freeHighlightId=-1,this._freeHighlight=null,this._freeHighlightClipId=""},ED=function(e){let{color:n}=this._initialData;return this.hasEditedComment||e.color.some((i,s)=>i!==n[s])},A(oe,Dr),U(oe,"_defaultColor",null),U(oe,"_defaultOpacity",1),U(oe,"_defaultThickness",12),U(oe,"_type","highlight"),U(oe,"_editorType",Bt.HIGHLIGHT),U(oe,"_freeHighlightId",-1),U(oe,"_freeHighlight",null),U(oe,"_freeHighlightClipId","");ky=oe,_y=class{constructor(){A(this,Pc,Object.create(null))}updateProperty(t,e){this[t]=e,this.updateSVGProperty(t,e)}updateProperties(t){if(t)for(let[e,n]of Object.entries(t))e.startsWith("_")||this.updateProperty(e,n)}updateSVGProperty(t,e){o(this,Pc)[t]=e}toSVGProperties(){let t=o(this,Pc);return g(this,Pc,Object.create(null)),{root:t}}reset(){g(this,Pc,Object.create(null))}updateAll(t=this){this.updateProperties(t)}clone(){ue("Not implemented")}};Pc=new WeakMap;Kt=class Kt extends Se{constructor(e){super(e);A(this,ie);A(this,qi,null);A(this,md);U(this,"_colorPicker",null);U(this,"_drawId",null);g(this,md,e.mustBeCommitted||!1),this._addOutlines(e)}onUpdatedColor(){this._colorPicker?.update(this.color),super.onUpdatedColor()}_addOutlines(e){e.drawOutlines&&(v(this,ie,QA).call(this,e),v(this,ie,jf).call(this))}static _mergeSVGProperties(e,n){let i=new Set(Object.keys(e));for(let[s,a]of Object.entries(n))i.has(s)?Object.assign(e[s],a):e[s]=a;return e}static getDefaultDrawingOptions(e){ue("Not implemented")}static get typesMap(){ue("Not implemented")}static get isDrawer(){return!0}static get supportMultipleDrawings(){return!1}static updateDefaultParams(e,n){let i=this.typesMap.get(e);i&&this._defaultDrawingOptions.updateProperty(i,n),this._currentParent&&(o(Kt,Tn).updateProperty(i,n),this._currentParent.drawLayer.updateProperties(this._currentDrawId,this._defaultDrawingOptions.toSVGProperties()))}updateParams(e,n){let i=this.constructor.typesMap.get(e);i&&this._updateProperty(e,i,n)}static get defaultPropertiesToUpdate(){let e=[],n=this._defaultDrawingOptions;for(let[i,s]of this.typesMap)e.push([i,n[s]]);return e}get propertiesToUpdate(){let e=[],{_drawingOptions:n}=this;for(let[i,s]of this.constructor.typesMap)e.push([i,n[s]]);return e}_updateProperty(e,n,i){let s=this._drawingOptions,a=s[n],l=c=>{s.updateProperty(n,c);let u=o(this,qi).updateProperty(n,c);u&&v(this,ie,Gf).call(this,u),this.parent?.drawLayer.updateProperties(this._drawId,s.toSVGProperties()),e===this.colorType&&this.onUpdatedColor()};this.addCommands({cmd:l.bind(this,i),undo:l.bind(this,a),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:e,overwriteIfSameType:!0,keepUndo:!0})}_onResizing(){this.parent?.drawLayer.updateProperties(this._drawId,Kt._mergeSVGProperties(o(this,qi).getPathResizingSVGProperties(v(this,ie,Z0).call(this)),{bbox:v(this,ie,Vu).call(this)}))}_onResized(){this.parent?.drawLayer.updateProperties(this._drawId,Kt._mergeSVGProperties(o(this,qi).getPathResizedSVGProperties(v(this,ie,Z0).call(this)),{bbox:v(this,ie,Vu).call(this)}))}_onTranslating(e,n){this.parent?.drawLayer.updateProperties(this._drawId,{bbox:v(this,ie,Vu).call(this)})}_onTranslated(){this.parent?.drawLayer.updateProperties(this._drawId,Kt._mergeSVGProperties(o(this,qi).getPathTranslatedSVGProperties(v(this,ie,Z0).call(this),this.parentDimensions),{bbox:v(this,ie,Vu).call(this)}))}_onStartDragging(){this.parent?.drawLayer.updateProperties(this._drawId,{rootClass:{moving:!0}})}_onStopDragging(){this.parent?.drawLayer.updateProperties(this._drawId,{rootClass:{moving:!1}})}commit(){super.commit(),this.disableEditMode(),this.disableEditing()}disableEditing(){super.disableEditing(),this.div.classList.toggle("disabled",!0)}enableEditing(){super.enableEditing(),this.div.classList.toggle("disabled",!1)}getBaseTranslation(){return[0,0]}get isResizable(){return!0}onceAdded(e){this.annotationElementId||this.parent.addUndoableEditor(this),this._isDraggable=!0,o(this,md)&&(g(this,md,!1),this.commit(),this.parent.setSelected(this),e&&this.isOnScreen&&this.div.focus())}remove(){v(this,ie,t2).call(this),super.remove()}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(v(this,ie,jf).call(this),v(this,ie,Gf).call(this,o(this,qi).box),this.isAttachedToDOM||this.parent.add(this)))}setParent(e){let n=!1;this.parent&&!e?(this._uiManager.removeShouldRescale(this),v(this,ie,t2).call(this)):e&&(this._uiManager.addShouldRescale(this),v(this,ie,jf).call(this,e),n=!this.parent&&this.div?.classList.contains("selectedEditor")),super.setParent(e),n&&this.select()}rotate(){this.parent&&this.parent.drawLayer.updateProperties(this._drawId,Kt._mergeSVGProperties({bbox:v(this,ie,Vu).call(this)},o(this,qi).updateRotation((this.parentRotation-this.rotation+360)%360)))}onScaleChanging(){this.parent&&v(this,ie,Gf).call(this,o(this,qi).updateParentDimensions(this.parentDimensions,this.parent.scale))}static onScaleChangingWhenDrawing(){}render(){if(this.div)return this.div;let e,n;this._isCopy&&(e=this.x,n=this.y);let i=super.render();i.classList.add("draw");let s=document.createElement("div");return i.append(s),s.setAttribute("aria-hidden","true"),s.className="internal",this.setDims(),this._uiManager.addShouldRescale(this),this.disableEditing(),this._isCopy&&this._moveAfterPaste(e,n),i}static createDrawerInstance(e,n,i,s,a){ue("Not implemented")}static startDrawing(e,n,i,s){let{target:a,offsetX:l,offsetY:c,pointerId:u,pointerType:h}=s;if(Kn.isInitializedAndDifferentPointerType(h))return;let{viewport:{rotation:d}}=e,{width:f,height:p}=a.getBoundingClientRect(),m=g(Kt,Rc,new AbortController),y=e.combinedSignal(m);if(Kn.setPointer(h,u),window.addEventListener("pointerup",x=>{Kn.isSamePointerIdOrRemove(x.pointerId)&&this._endDraw(x)},{signal:y}),window.addEventListener("pointercancel",x=>{Kn.isSamePointerIdOrRemove(x.pointerId)&&this._currentParent.endDrawingSession()},{signal:y}),window.addEventListener("pointerdown",x=>{Kn.isSamePointerType(x.pointerType)&&(Kn.initializeAndAddPointerId(x.pointerId),o(Kt,Tn).isCancellable()&&(o(Kt,Tn).removeLastElement(),o(Kt,Tn).isEmpty()?this._currentParent.endDrawingSession(!0):this._endDraw(null)))},{capture:!0,passive:!1,signal:y}),window.addEventListener("contextmenu",tr,{signal:y}),a.addEventListener("pointermove",this._drawMove.bind(this),{signal:y}),a.addEventListener("touchmove",x=>{Kn.isSameTimeStamp(x.timeStamp)&&Be(x)},{signal:y}),e.toggleDrawing(),n._editorUndoBar?.hide(),o(Kt,Tn)){e.drawLayer.updateProperties(this._currentDrawId,o(Kt,Tn).startNew(l,c,f,p,d));return}n.updateUIForDefaultProperties(this),g(Kt,Tn,this.createDrawerInstance(l,c,f,p,d)),g(Kt,Lc,this.getDefaultDrawingOptions()),this._currentParent=e,{id:this._currentDrawId}=e.drawLayer.draw(this._mergeSVGProperties(o(Kt,Lc).toSVGProperties(),o(Kt,Tn).defaultSVGProperties),!0,!1)}static _drawMove(e){if(Kn.isSameTimeStamp(e.timeStamp),!o(Kt,Tn))return;let{offsetX:n,offsetY:i,pointerId:s}=e;if(Kn.isSamePointerId(s)){if(Kn.isUsingMultiplePointers()){this._endDraw(e);return}this._currentParent.drawLayer.updateProperties(this._currentDrawId,o(Kt,Tn).add(n,i)),Kn.setTimeStamp(e.timeStamp),Be(e)}}static _cleanup(e){e&&(this._currentDrawId=-1,this._currentParent=null,g(Kt,Tn,null),g(Kt,Lc,null),Kn.clearTimeStamp()),o(Kt,Rc)&&(o(Kt,Rc).abort(),g(Kt,Rc,null),Kn.clearPointerIds())}static _endDraw(e){let n=this._currentParent;if(n){if(n.toggleDrawing(!0),this._cleanup(!1),e?.target===n.div&&n.drawLayer.updateProperties(this._currentDrawId,o(Kt,Tn).end(e.offsetX,e.offsetY)),this.supportMultipleDrawings){let i=o(Kt,Tn),s=this._currentDrawId,a=i.getLastElement();n.addCommands({cmd:()=>{n.drawLayer.updateProperties(s,i.setLastElement(a))},undo:()=>{n.drawLayer.updateProperties(s,i.removeLastElement())},mustExec:!1,type:Zt.DRAW_STEP});return}this.endDrawing(!1)}}static endDrawing(e){let n=this._currentParent;if(!n)return null;if(n.toggleDrawing(!0),n.cleanUndoStack(Zt.DRAW_STEP),!o(Kt,Tn).isEmpty()){let{pageDimensions:[i,s],scale:a}=n,l=n.createAndAddNewEditor({offsetX:0,offsetY:0},!1,{drawId:this._currentDrawId,drawOutlines:o(Kt,Tn).getOutlines(i*a,s*a,a,this._INNER_MARGIN),drawingOptions:o(Kt,Lc),mustBeCommitted:!e});return this._cleanup(!0),l}return n.drawLayer.remove(this._currentDrawId),this._cleanup(!0),null}createDrawingOptions(e){}static deserializeDraw(e,n,i,s,a,l){ue("Not implemented")}static async deserialize(e,n,i){var d,f;let{rawDims:{pageWidth:s,pageHeight:a,pageX:l,pageY:c}}=n.viewport,u=this.deserializeDraw(l,c,s,a,this._INNER_MARGIN,e),h=await super.deserialize(e,n,i);return h.createDrawingOptions(e),v(d=h,ie,QA).call(d,{drawOutlines:u}),v(f=h,ie,jf).call(f),h.onScaleChanging(),h.rotate(),h}serializeDraw(e){let[n,i]=this.pageTranslation,[s,a]=this.pageDimensions;return o(this,qi).serialize([n,i,s,a],e)}renderAnnotationElement(e){return e.updateEdited({rect:this.getPDFRect()}),null}static canCreateNewEmptyEditor(){return!1}};qi=new WeakMap,md=new WeakMap,Tn=new WeakMap,Rc=new WeakMap,Lc=new WeakMap,ie=new WeakSet,QA=function({drawOutlines:e,drawId:n,drawingOptions:i}){g(this,qi,e),this._drawingOptions||(this._drawingOptions=i),this.annotationElementId||this._uiManager.a11yAlert(`pdfjs-editor-${this.editorType}-added-alert`),n>=0?(this._drawId=n,this.parent.drawLayer.finalizeDraw(n,e.defaultProperties)):this._drawId=v(this,ie,JA).call(this,e,this.parent),v(this,ie,Gf).call(this,e.box)},JA=function(e,n){let{id:i}=n.drawLayer.draw(Kt._mergeSVGProperties(this._drawingOptions.toSVGProperties(),e.defaultSVGProperties),!1,!1);return i},t2=function(){this._drawId===null||!this.parent||(this.parent.drawLayer.remove(this._drawId),this._drawId=null,this._drawingOptions.reset())},jf=function(e=this.parent){if(!(this._drawId!==null&&this.parent===e)){if(this._drawId!==null){this.parent.drawLayer.updateParent(this._drawId,e.drawLayer);return}this._drawingOptions.updateAll(),this._drawId=v(this,ie,JA).call(this,o(this,qi),e)}},TD=function([e,n,i,s]){let{parentDimensions:[a,l],rotation:c}=this;switch(c){case 90:return[n,1-e,i*(l/a),s*(a/l)];case 180:return[1-e,1-n,i,s];case 270:return[1-n,e,i*(l/a),s*(a/l)];default:return[e,n,i,s]}},Z0=function(){let{x:e,y:n,width:i,height:s,parentDimensions:[a,l],rotation:c}=this;switch(c){case 90:return[1-n,e,i*(a/l),s*(l/a)];case 180:return[1-e,1-n,i,s];case 270:return[n,1-e,i*(a/l),s*(l/a)];default:return[e,n,i,s]}},Gf=function(e){[this.x,this.y,this.width,this.height]=v(this,ie,TD).call(this,e),this.div&&(this.fixAndSetPosition(),this.setDims()),this._onResized()},Vu=function(){let{x:e,y:n,width:i,height:s,rotation:a,parentRotation:l,parentDimensions:[c,u]}=this;switch((a*4+l)/90){case 1:return[1-n-s,e,s,i];case 2:return[1-e-i,1-n-s,i,s];case 3:return[n,1-e-i,s,i];case 4:return[e,n-i*(c/u),s*(u/c),i*(c/u)];case 5:return[1-n,e,i*(c/u),s*(u/c)];case 6:return[1-e-s*(u/c),1-n,s*(u/c),i*(c/u)];case 7:return[n-i*(c/u),1-e-s*(u/c),i*(c/u),s*(u/c)];case 8:return[e-i,n-s,i,s];case 9:return[1-n,e-i,s,i];case 10:return[1-e,1-n,i,s];case 11:return[n-s,1-e,s,i];case 12:return[e-s*(u/c),n,s*(u/c),i*(c/u)];case 13:return[1-n-i*(c/u),e-s*(u/c),i*(c/u),s*(u/c)];case 14:return[1-e,1-n-i*(c/u),s*(u/c),i*(c/u)];case 15:return[n,1-e,i*(c/u),s*(u/c)];default:return[e,n,i,s]}},U(Kt,"_currentDrawId",-1),U(Kt,"_currentParent",null),A(Kt,Tn,null),A(Kt,Rc,null),A(Kt,Lc,null),U(Kt,"_INNER_MARGIN",3);My=Kt,e2=class{constructor(t,e,n,i,s,a){A(this,yd);A(this,ks,new Float64Array(6));A(this,Sn);A(this,Dn);A(this,Bc);A(this,gd);A(this,oi);A(this,jn,"");A(this,Er,0);A(this,Uc,new Jc);A(this,$c);A(this,zc);g(this,$c,n),g(this,zc,i),g(this,Bc,s),g(this,gd,a),[t,e]=v(this,yd,Q0).call(this,t,e);let l=g(this,Sn,[NaN,NaN,NaN,NaN,t,e]);g(this,oi,[t,e]),g(this,Dn,[{line:l,points:o(this,oi)}]),o(this,ks).set(l,0)}updateProperty(t,e){t==="stroke-width"&&g(this,gd,e)}isEmpty(){return!o(this,Dn)||o(this,Dn).length===0}isCancellable(){return o(this,oi).length<=10}add(t,e){[t,e]=v(this,yd,Q0).call(this,t,e);let[n,i,s,a]=o(this,ks).subarray(2,6),l=t-s,c=e-a;return Math.hypot(o(this,$c)*l,o(this,zc)*c)<=2?null:(o(this,oi).push(t,e),isNaN(n)?(o(this,ks).set([s,a,t,e],2),o(this,Sn).push(NaN,NaN,NaN,NaN,t,e),{path:{d:this.toSVGPath()}}):(isNaN(o(this,ks)[0])&&o(this,Sn).splice(6,6),o(this,ks).set([n,i,s,a,t,e],0),o(this,Sn).push(...Dt.createBezierPoints(n,i,s,a,t,e)),{path:{d:this.toSVGPath()}}))}end(t,e){let n=this.add(t,e);return n||(o(this,oi).length===2?{path:{d:this.toSVGPath()}}:null)}startNew(t,e,n,i,s){g(this,$c,n),g(this,zc,i),g(this,Bc,s),[t,e]=v(this,yd,Q0).call(this,t,e);let a=g(this,Sn,[NaN,NaN,NaN,NaN,t,e]);g(this,oi,[t,e]);let l=o(this,Dn).at(-1);return l&&(l.line=new Float32Array(l.line),l.points=new Float32Array(l.points)),o(this,Dn).push({line:a,points:o(this,oi)}),o(this,ks).set(a,0),g(this,Er,0),this.toSVGPath(),null}getLastElement(){return o(this,Dn).at(-1)}setLastElement(t){return o(this,Dn)?(o(this,Dn).push(t),g(this,Sn,t.line),g(this,oi,t.points),g(this,Er,0),{path:{d:this.toSVGPath()}}):o(this,Uc).setLastElement(t)}removeLastElement(){if(!o(this,Dn))return o(this,Uc).removeLastElement();o(this,Dn).pop(),g(this,jn,"");for(let t=0,e=o(this,Dn).length;t<e;t++){let{line:n,points:i}=o(this,Dn)[t];g(this,Sn,n),g(this,oi,i),g(this,Er,0),this.toSVGPath()}return{path:{d:o(this,jn)}}}toSVGPath(){let t=Dt.svgRound(o(this,Sn)[4]),e=Dt.svgRound(o(this,Sn)[5]);if(o(this,oi).length===2)return g(this,jn,`${o(this,jn)} M ${t} ${e} Z`),o(this,jn);if(o(this,oi).length<=6){let i=o(this,jn).lastIndexOf("M");g(this,jn,`${o(this,jn).slice(0,i)} M ${t} ${e}`),g(this,Er,6)}if(o(this,oi).length===4){let i=Dt.svgRound(o(this,Sn)[10]),s=Dt.svgRound(o(this,Sn)[11]);return g(this,jn,`${o(this,jn)} L ${i} ${s}`),g(this,Er,12),o(this,jn)}let n=[];o(this,Er)===0&&(n.push(`M ${t} ${e}`),g(this,Er,6));for(let i=o(this,Er),s=o(this,Sn).length;i<s;i+=6){let[a,l,c,u,h,d]=o(this,Sn).slice(i,i+6).map(Dt.svgRound);n.push(`C${a} ${l} ${c} ${u} ${h} ${d}`)}return g(this,jn,o(this,jn)+n.join(" ")),g(this,Er,o(this,Sn).length),o(this,jn)}getOutlines(t,e,n,i){let s=o(this,Dn).at(-1);return s.line=new Float32Array(s.line),s.points=new Float32Array(s.points),o(this,Uc).build(o(this,Dn),t,e,n,o(this,Bc),o(this,gd),i),g(this,ks,null),g(this,Sn,null),g(this,Dn,null),g(this,jn,null),o(this,Uc)}get defaultSVGProperties(){return{root:{viewBox:"0 0 10000 10000"},rootClass:{draw:!0},bbox:[0,0,1,1]}}};ks=new WeakMap,Sn=new WeakMap,Dn=new WeakMap,Bc=new WeakMap,gd=new WeakMap,oi=new WeakMap,jn=new WeakMap,Er=new WeakMap,Uc=new WeakMap,$c=new WeakMap,zc=new WeakMap,yd=new WeakSet,Q0=function(t,e){return Dt._normalizePoint(t,e,o(this,$c),o(this,zc),o(this,Bc))};Jc=class extends Dt{constructor(){super(...arguments);A(this,Hn);A(this,li);A(this,Jm,0);A(this,tg);A(this,Vi);A(this,_s);A(this,Ms);A(this,bd);A(this,xd);A(this,jc)}build(e,n,i,s,a,l,c){g(this,_s,n),g(this,Ms,i),g(this,bd,s),g(this,xd,a),g(this,jc,l),g(this,tg,c??0),g(this,Vi,e),v(this,Hn,DD).call(this)}get thickness(){return o(this,jc)}setLastElement(e){return o(this,Vi).push(e),{path:{d:this.toSVGPath()}}}removeLastElement(){return o(this,Vi).pop(),{path:{d:this.toSVGPath()}}}toSVGPath(){let e=[];for(let{line:n}of o(this,Vi)){if(e.push(`M${Dt.svgRound(n[4])} ${Dt.svgRound(n[5])}`),n.length===6){e.push("Z");continue}if(n.length===12&&isNaN(n[6])){e.push(`L${Dt.svgRound(n[10])} ${Dt.svgRound(n[11])}`);continue}for(let i=6,s=n.length;i<s;i+=6){let[a,l,c,u,h,d]=n.subarray(i,i+6).map(Dt.svgRound);e.push(`C${a} ${l} ${c} ${u} ${h} ${d}`)}}return e.join("")}serialize([e,n,i,s],a){let l=[],c=[],[u,h,d,f]=v(this,Hn,SD).call(this),p,m,y,x,b,w,C,E,S;switch(o(this,xd)){case 0:S=Dt._rescale,p=e,m=n+s,y=i,x=-s,b=e+u*i,w=n+(1-h-f)*s,C=e+(u+d)*i,E=n+(1-h)*s;break;case 90:S=Dt._rescaleAndSwap,p=e,m=n,y=i,x=s,b=e+h*i,w=n+u*s,C=e+(h+f)*i,E=n+(u+d)*s;break;case 180:S=Dt._rescale,p=e+i,m=n,y=-i,x=s,b=e+(1-u-d)*i,w=n+h*s,C=e+(1-u)*i,E=n+(h+f)*s;break;case 270:S=Dt._rescaleAndSwap,p=e+i,m=n+s,y=-i,x=-s,b=e+(1-h-f)*i,w=n+(1-u-d)*s,C=e+(1-h)*i,E=n+(1-u)*s;break}for(let{line:N,points:k}of o(this,Vi))l.push(S(N,p,m,y,x,a?new Array(N.length):null)),c.push(S(k,p,m,y,x,a?new Array(k.length):null));return{lines:l,points:c,rect:[b,w,C,E]}}static deserialize(e,n,i,s,a,{paths:{lines:l,points:c},rotation:u,thickness:h}){let d=[],f,p,m,y,x;switch(u){case 0:x=Dt._rescale,f=-e/i,p=n/s+1,m=1/i,y=-1/s;break;case 90:x=Dt._rescaleAndSwap,f=-n/s,p=-e/i,m=1/s,y=1/i;break;case 180:x=Dt._rescale,f=e/i+1,p=-n/s,m=-1/i,y=1/s;break;case 270:x=Dt._rescaleAndSwap,f=n/s+1,p=e/i+1,m=-1/s,y=-1/i;break}if(!l){l=[];for(let w of c){let C=w.length;if(C===2){l.push(new Float32Array([NaN,NaN,NaN,NaN,w[0],w[1]]));continue}if(C===4){l.push(new Float32Array([NaN,NaN,NaN,NaN,w[0],w[1],NaN,NaN,NaN,NaN,w[2],w[3]]));continue}let E=new Float32Array(3*(C-2));l.push(E);let[S,N,k,M]=w.subarray(0,4);E.set([NaN,NaN,NaN,NaN,S,N],0);for(let R=4;R<C;R+=2){let j=w[R],$=w[R+1];E.set(Dt.createBezierPoints(S,N,k,M,j,$),(R-2)*3),[S,N,k,M]=[k,M,j,$]}}}for(let w=0,C=l.length;w<C;w++)d.push({line:x(l[w].map(E=>E??NaN),f,p,m,y),points:x(c[w].map(E=>E??NaN),f,p,m,y)});let b=new this.prototype.constructor;return b.build(d,i,s,1,u,h,a),b}get box(){return o(this,li)}updateProperty(e,n){return e==="stroke-width"?v(this,Hn,ND).call(this,n):null}updateParentDimensions([e,n],i){let[s,a]=v(this,Hn,na).call(this);g(this,_s,e),g(this,Ms,n),g(this,bd,i);let[l,c]=v(this,Hn,na).call(this),u=l-s,h=c-a,d=o(this,li);return d[0]-=u,d[1]-=h,d[2]+=2*u,d[3]+=2*h,d}updateRotation(e){return g(this,Jm,e),{path:{transform:this.rotationTransform}}}get viewBox(){return o(this,li).map(Dt.svgRound).join(" ")}get defaultProperties(){let[e,n]=o(this,li);return{root:{viewBox:this.viewBox},path:{"transform-origin":`${Dt.svgRound(e)} ${Dt.svgRound(n)}`}}}get rotationTransform(){let[,,e,n]=o(this,li),i=0,s=0,a=0,l=0,c=0,u=0;switch(o(this,Jm)){case 90:s=n/e,a=-e/n,c=e;break;case 180:i=-1,l=-1,c=e,u=n;break;case 270:s=-n/e,a=e/n,u=n;break;default:return""}return`matrix(${i} ${s} ${a} ${l} ${Dt.svgRound(c)} ${Dt.svgRound(u)})`}getPathResizingSVGProperties([e,n,i,s]){let[a,l]=v(this,Hn,na).call(this),[c,u,h,d]=o(this,li);if(Math.abs(h-a)<=Dt.PRECISION||Math.abs(d-l)<=Dt.PRECISION){let x=e+i/2-(c+h/2),b=n+s/2-(u+d/2);return{path:{"transform-origin":`${Dt.svgRound(e)} ${Dt.svgRound(n)}`,transform:`${this.rotationTransform} translate(${x} ${b})`}}}let f=(i-2*a)/(h-2*a),p=(s-2*l)/(d-2*l),m=h/i,y=d/s;return{path:{"transform-origin":`${Dt.svgRound(c)} ${Dt.svgRound(u)}`,transform:`${this.rotationTransform} scale(${m} ${y}) translate(${Dt.svgRound(a)} ${Dt.svgRound(l)}) scale(${f} ${p}) translate(${Dt.svgRound(-a)} ${Dt.svgRound(-l)})`}}}getPathResizedSVGProperties([e,n,i,s]){let[a,l]=v(this,Hn,na).call(this),c=o(this,li),[u,h,d,f]=c;if(c[0]=e,c[1]=n,c[2]=i,c[3]=s,Math.abs(d-a)<=Dt.PRECISION||Math.abs(f-l)<=Dt.PRECISION){let b=e+i/2-(u+d/2),w=n+s/2-(h+f/2);for(let{line:C,points:E}of o(this,Vi))Dt._translate(C,b,w,C),Dt._translate(E,b,w,E);return{root:{viewBox:this.viewBox},path:{"transform-origin":`${Dt.svgRound(e)} ${Dt.svgRound(n)}`,transform:this.rotationTransform||null,d:this.toSVGPath()}}}let p=(i-2*a)/(d-2*a),m=(s-2*l)/(f-2*l),y=-p*(u+a)+e+a,x=-m*(h+l)+n+l;if(p!==1||m!==1||y!==0||x!==0)for(let{line:b,points:w}of o(this,Vi))Dt._rescale(b,y,x,p,m,b),Dt._rescale(w,y,x,p,m,w);return{root:{viewBox:this.viewBox},path:{"transform-origin":`${Dt.svgRound(e)} ${Dt.svgRound(n)}`,transform:this.rotationTransform||null,d:this.toSVGPath()}}}getPathTranslatedSVGProperties([e,n],i){let[s,a]=i,l=o(this,li),c=e-l[0],u=n-l[1];if(o(this,_s)===s&&o(this,Ms)===a)for(let{line:h,points:d}of o(this,Vi))Dt._translate(h,c,u,h),Dt._translate(d,c,u,d);else{let h=o(this,_s)/s,d=o(this,Ms)/a;g(this,_s,s),g(this,Ms,a);for(let{line:f,points:p}of o(this,Vi))Dt._rescale(f,c,u,h,d,f),Dt._rescale(p,c,u,h,d,p);l[2]*=h,l[3]*=d}return l[0]=e,l[1]=n,{root:{viewBox:this.viewBox},path:{d:this.toSVGPath(),"transform-origin":`${Dt.svgRound(e)} ${Dt.svgRound(n)}`}}}get defaultSVGProperties(){let e=o(this,li);return{root:{viewBox:this.viewBox},rootClass:{draw:!0},path:{d:this.toSVGPath(),"transform-origin":`${Dt.svgRound(e[0])} ${Dt.svgRound(e[1])}`,transform:this.rotationTransform||null},bbox:e}}};li=new WeakMap,Jm=new WeakMap,tg=new WeakMap,Vi=new WeakMap,_s=new WeakMap,Ms=new WeakMap,bd=new WeakMap,xd=new WeakMap,jc=new WeakMap,Hn=new WeakSet,na=function(e=o(this,jc)){let n=o(this,tg)+e/2*o(this,bd);return o(this,xd)%180===0?[n/o(this,_s),n/o(this,Ms)]:[n/o(this,Ms),n/o(this,_s)]},SD=function(){let[e,n,i,s]=o(this,li),[a,l]=v(this,Hn,na).call(this,0);return[e+a,n+l,i-2*a,s-2*l]},DD=function(){let e=g(this,li,new Float32Array([1/0,1/0,-1/0,-1/0]));for(let{line:s}of o(this,Vi)){if(s.length<=12){for(let c=4,u=s.length;c<u;c+=6)yt.pointBoundingBox(s[c],s[c+1],e);continue}let a=s[4],l=s[5];for(let c=6,u=s.length;c<u;c+=6){let[h,d,f,p,m,y]=s.subarray(c,c+6);yt.bezierBoundingBox(a,l,h,d,f,p,m,y,e),a=m,l=y}}let[n,i]=v(this,Hn,na).call(this);e[0]=yn(e[0]-n,0,1),e[1]=yn(e[1]-i,0,1),e[2]=yn(e[2]+n,0,1),e[3]=yn(e[3]+i,0,1),e[2]-=e[0],e[3]-=e[1]},ND=function(e){let[n,i]=v(this,Hn,na).call(this);g(this,jc,e);let[s,a]=v(this,Hn,na).call(this),[l,c]=[s-n,a-i],u=o(this,li);return u[0]-=l,u[1]-=c,u[2]+=2*l,u[3]+=2*c,u};Oy=class r extends _y{constructor(t){super(),this._viewParameters=t,super.updateProperties({fill:"none",stroke:Se._defaultLineColor,"stroke-opacity":1,"stroke-width":1,"stroke-linecap":"round","stroke-linejoin":"round","stroke-miterlimit":10})}updateSVGProperty(t,e){t==="stroke-width"&&(e??(e=this["stroke-width"]),e*=this._viewParameters.realScale),super.updateSVGProperty(t,e)}clone(){let t=new r(this._viewParameters);return t.updateAll(this),t}},Qu=class Qu extends My{constructor(e){super({...e,name:"inkEditor"});A(this,ib);this._willKeepAspectRatio=!0,this.defaultL10nId="pdfjs-editor-ink-editor"}static initialize(e,n){Se.initialize(e,n),this._defaultDrawingOptions=new Oy(n.viewParameters)}static getDefaultDrawingOptions(e){let n=this._defaultDrawingOptions.clone();return n.updateProperties(e),n}static get supportMultipleDrawings(){return!0}static get typesMap(){return Ut(this,"typesMap",new Map([[Zt.INK_THICKNESS,"stroke-width"],[Zt.INK_COLOR,"stroke"],[Zt.INK_OPACITY,"stroke-opacity"]]))}static createDrawerInstance(e,n,i,s,a){return new e2(e,n,i,s,a,this._defaultDrawingOptions["stroke-width"])}static deserializeDraw(e,n,i,s,a,l){return Jc.deserialize(e,n,i,s,a,l)}static async deserialize(e,n,i){let s=null;if(e instanceof hp){let{data:{inkLists:l,rect:c,rotation:u,id:h,color:d,opacity:f,borderStyle:{rawWidth:p},popupRef:m,richText:y,contentsObj:x,creationDate:b,modificationDate:w},parent:{page:{pageNumber:C}}}=e;s=e={annotationType:Bt.INK,color:Array.from(d),thickness:p,opacity:f,paths:{points:l},boxes:null,pageIndex:C-1,rect:c.slice(0),rotation:u,annotationElementId:h,id:h,deleted:!1,popupRef:m,richText:y,comment:x?.str||null,creationDate:b,modificationDate:w}}let a=await super.deserialize(e,n,i);return a._initialData=s,e.comment&&a.setCommentData(e),a}get toolbarButtons(){return this._colorPicker||(this._colorPicker=new wy(this)),[["colorPicker",this._colorPicker]]}get colorType(){return Zt.INK_COLOR}get color(){return this._drawingOptions.stroke}get opacity(){return this._drawingOptions["stroke-opacity"]}onScaleChanging(){if(!this.parent)return;super.onScaleChanging();let{_drawId:e,_drawingOptions:n,parent:i}=this;n.updateSVGProperty("stroke-width"),i.drawLayer.updateProperties(e,n.toSVGProperties())}static onScaleChangingWhenDrawing(){let e=this._currentParent;e&&(super.onScaleChangingWhenDrawing(),this._defaultDrawingOptions.updateSVGProperty("stroke-width"),e.drawLayer.updateProperties(this._currentDrawId,this._defaultDrawingOptions.toSVGProperties()))}createDrawingOptions({color:e,thickness:n,opacity:i}){this._drawingOptions=Qu.getDefaultDrawingOptions({stroke:yt.makeHexColor(...e),"stroke-width":n,"stroke-opacity":i})}serialize(e=!1){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();let{lines:n,points:i}=this.serializeDraw(e),{_drawingOptions:{stroke:s,"stroke-opacity":a,"stroke-width":l}}=this,c=Object.assign(super.serialize(e),{color:Se._colorManager.convert(s),opacity:a,thickness:l,paths:{lines:n,points:i}});return this.addComment(c),e?(c.isCopy=!0,c):this.annotationElementId&&!v(this,ib,ID).call(this,c)?null:(c.id=this.annotationElementId,c)}renderAnnotationElement(e){if(this.deleted)return e.hide(),null;let{points:n,rect:i}=this.serializeDraw(!1);return e.updateEdited({rect:i,thickness:this._drawingOptions["stroke-width"],points:n,popup:this.comment}),null}};ib=new WeakSet,ID=function(e){let{color:n,thickness:i,opacity:s,pageIndex:a}=this._initialData;return this.hasEditedComment||this._hasBeenMoved||this._hasBeenResized||e.color.some((l,c)=>l!==n[c])||e.thickness!==i||e.opacity!==s||e.pageIndex!==a},U(Qu,"_type","ink"),U(Qu,"_editorType",Bt.INK),U(Qu,"_defaultDrawingOptions",null);n2=Qu,pp=class extends Jc{toSVGPath(){let t=super.toSVGPath();return t.endsWith("Z")||(t+="Z"),t}},g0=8,Ef=3,Sr=class{static extractContoursFromText(t,{fontFamily:e,fontStyle:n,fontWeight:i},s,a,l,c){let u=new OffscreenCanvas(1,1),h=u.getContext("2d",{alpha:!1}),d=200,f=h.font=`${n} ${i} ${d}px ${e}`,{actualBoundingBoxLeft:p,actualBoundingBoxRight:m,actualBoundingBoxAscent:y,actualBoundingBoxDescent:x,fontBoundingBoxAscent:b,fontBoundingBoxDescent:w,width:C}=h.measureText(t),E=1.5,S=Math.ceil(Math.max(Math.abs(p)+Math.abs(m)||0,C)*E),N=Math.ceil(Math.max(Math.abs(y)+Math.abs(x)||d,Math.abs(b)+Math.abs(w)||d)*E);u=new OffscreenCanvas(S,N),h=u.getContext("2d",{alpha:!0,willReadFrequently:!0}),h.font=f,h.filter="grayscale(1)",h.fillStyle="white",h.fillRect(0,0,S,N),h.fillStyle="black",h.fillText(t,S*(E-1)/2,N*(3-E)/2);let k=v(this,he,s2).call(this,h.getImageData(0,0,S,N).data),M=v(this,he,FD).call(this,k),R=v(this,he,a2).call(this,M),j=v(this,he,r2).call(this,k,S,N,R);return this.processDrawnLines({lines:{curves:j,width:S,height:N},pageWidth:s,pageHeight:a,rotation:l,innerMargin:c,mustSmooth:!0,areContours:!0})}static process(t,e,n,i,s){let[a,l,c]=v(this,he,PD).call(this,t),[u,h]=v(this,he,OD).call(this,a,l,c,Math.hypot(l,c)*o(this,Gc).sigmaSFactor,o(this,Gc).sigmaR,o(this,Gc).kernelSize),d=v(this,he,a2).call(this,h),f=v(this,he,r2).call(this,u,l,c,d);return this.processDrawnLines({lines:{curves:f,width:l,height:c},pageWidth:e,pageHeight:n,rotation:i,innerMargin:s,mustSmooth:!0,areContours:!0})}static processDrawnLines({lines:t,pageWidth:e,pageHeight:n,rotation:i,innerMargin:s,mustSmooth:a,areContours:l}){i%180!==0&&([e,n]=[n,e]);let{curves:c,width:u,height:h}=t,d=t.thickness??0,f=[],p=Math.min(e/u,n/h),m=p/e,y=p/n,x=[];for(let{points:w}of c){let C=a?v(this,he,MD).call(this,w):w;if(!C)continue;x.push(C);let E=C.length,S=new Float32Array(E),N=new Float32Array(3*(E===2?2:E-2));if(f.push({line:N,points:S}),E===2){S[0]=C[0]*m,S[1]=C[1]*y,N.set([NaN,NaN,NaN,NaN,S[0],S[1]],0);continue}let[k,M,R,j]=C;k*=m,M*=y,R*=m,j*=y,S.set([k,M,R,j],0),N.set([NaN,NaN,NaN,NaN,k,M],0);for(let $=4;$<E;$+=2){let q=S[$]=C[$]*m,Q=S[$+1]=C[$+1]*y;N.set(Dt.createBezierPoints(k,M,R,j,q,Q),($-2)*3),[k,M,R,j]=[R,j,q,Q]}}if(f.length===0)return null;let b=l?new pp:new Jc;return b.build(f,e,n,1,i,l?0:d,s),{outline:b,newCurves:x,areContours:l,thickness:d,width:u,height:h}}static async compressSignature({outlines:t,areContours:e,thickness:n,width:i,height:s}){let a=1/0,l=-1/0,c=0;for(let w of t){c+=w.length;for(let C=2,E=w.length;C<E;C++){let S=w[C]-w[C-2];a=Math.min(a,S),l=Math.max(l,S)}}let u;a>=-128&&l<=127?u=Int8Array:a>=-32768&&l<=32767?u=Int16Array:u=Int32Array;let h=t.length,d=g0+Ef*h,f=new Uint32Array(d),p=0;f[p++]=d*Uint32Array.BYTES_PER_ELEMENT+(c-2*h)*u.BYTES_PER_ELEMENT,f[p++]=0,f[p++]=i,f[p++]=s,f[p++]=e?0:1,f[p++]=Math.max(0,Math.floor(n??0)),f[p++]=h,f[p++]=u.BYTES_PER_ELEMENT;for(let w of t)f[p++]=w.length-2,f[p++]=w[0],f[p++]=w[1];let m=new CompressionStream("deflate-raw"),y=m.writable.getWriter();await y.ready,y.write(f);let x=u.prototype.constructor;for(let w of t){let C=new x(w.length-2);for(let E=2,S=w.length;E<S;E++)C[E-2]=w[E]-w[E-2];y.write(C)}return y.close(),(await new Response(m.readable).bytes()).toBase64()}static async decompressSignature(t){try{let e=Uint8Array.fromBase64(t),{readable:n,writable:i}=new DecompressionStream("deflate-raw"),s=i.getWriter();await s.ready,s.write(e).then(async()=>{await s.ready,await s.close()}).catch(()=>{});let a=null,l=0;for await(let C of n)a||(a=new Uint8Array(new Uint32Array(C.buffer,0,4)[0])),a.set(C,l),l+=C.length;let c=new Uint32Array(a.buffer,0,a.length>>2),u=c[1];if(u!==0)throw new Error(`Invalid version: ${u}`);let h=c[2],d=c[3],f=c[4]===0,p=c[5],m=c[6],y=c[7],x=[],b=(g0+Ef*m)*Uint32Array.BYTES_PER_ELEMENT,w;switch(y){case Int8Array.BYTES_PER_ELEMENT:w=new Int8Array(a.buffer,b);break;case Int16Array.BYTES_PER_ELEMENT:w=new Int16Array(a.buffer,b);break;case Int32Array.BYTES_PER_ELEMENT:w=new Int32Array(a.buffer,b);break}l=0;for(let C=0;C<m;C++){let E=c[Ef*C+g0],S=new Float32Array(E+2);x.push(S);for(let N=0;N<Ef-1;N++)S[N]=c[Ef*C+g0+N+1];for(let N=0;N<E;N++)S[N+2]=S[N]+w[l++]}return{areContours:f,thickness:p,outlines:x,width:h,height:d}}catch(e){return jt(`decompressSignature: ${e}`),null}}};Gc=new WeakMap,he=new WeakSet,i2=function(t,e,n,i){return n-=t,i-=e,n===0?i>0?0:4:n===1?i+6:2-i},Vr=new WeakMap,kD=function(t,e,n,i,s,a,l){let c=v(this,he,i2).call(this,n,i,s,a);for(let u=0;u<8;u++){let h=(-u+c-l+16)%8,d=o(this,Vr)[2*h],f=o(this,Vr)[2*h+1];if(t[(n+d)*e+(i+f)]!==0)return h}return-1},_D=function(t,e,n,i,s,a,l){let c=v(this,he,i2).call(this,n,i,s,a);for(let u=0;u<8;u++){let h=(u+c+l+16)%8,d=o(this,Vr)[2*h],f=o(this,Vr)[2*h+1];if(t[(n+d)*e+(i+f)]!==0)return h}return-1},r2=function(t,e,n,i){let s=t.length,a=new Int32Array(s);for(let h=0;h<s;h++)a[h]=t[h]<=i?1:0;for(let h=1;h<n-1;h++)a[h*e]=a[h*e+e-1]=0;for(let h=0;h<e;h++)a[h]=a[e*n-1-h]=0;let l=1,c,u=[];for(let h=1;h<n-1;h++){c=1;for(let d=1;d<e-1;d++){let f=h*e+d,p=a[f];if(p===0)continue;let m=h,y=d;if(p===1&&a[f-1]===0)l+=1,y-=1;else if(p>=1&&a[f+1]===0)l+=1,y+=1,p>1&&(c=p);else{p!==1&&(c=Math.abs(p));continue}let x=[d,h],b=y===d+1,w={isHole:b,points:x,id:l,parent:0};u.push(w);let C;for(let $ of u)if($.id===c){C=$;break}C?C.isHole?w.parent=b?C.parent:c:w.parent=b?c:C.parent:w.parent=b?c:0;let E=v(this,he,kD).call(this,a,e,h,d,m,y,0);if(E===-1){a[f]=-l,a[f]!==1&&(c=Math.abs(a[f]));continue}let S=o(this,Vr)[2*E],N=o(this,Vr)[2*E+1],k=h+S,M=d+N;m=k,y=M;let R=h,j=d;for(;;){let $=v(this,he,_D).call(this,a,e,R,j,m,y,1);S=o(this,Vr)[2*$],N=o(this,Vr)[2*$+1];let q=R+S,Q=j+N;x.push(Q,q);let Z=R*e+j;if(a[Z+1]===0?a[Z]=-l:a[Z]===1&&(a[Z]=l),q===h&&Q===d&&R===k&&j===M){a[f]!==1&&(c=Math.abs(a[f]));break}else m=R,y=j,R=q,j=Q}}}return u},J0=function(t,e,n,i){if(n-e<=4){for(let k=e;k<n-2;k+=2)i.push(t[k],t[k+1]);return}let s=t[e],a=t[e+1],l=t[n-4]-s,c=t[n-3]-a,u=Math.hypot(l,c),h=l/u,d=c/u,f=h*a-d*s,p=c/l,m=1/u,y=Math.atan(p),x=Math.cos(y),b=Math.sin(y),w=m*(Math.abs(x)+Math.abs(b)),C=m*(1-w+w**2),E=Math.max(Math.atan(Math.abs(b+x)*C),Math.atan(Math.abs(b-x)*C)),S=0,N=e;for(let k=e+2;k<n-2;k+=2){let M=Math.abs(f-h*t[k+1]+d*t[k]);M>S&&(N=k,S=M)}S>(u*E)**2?(v(this,he,J0).call(this,t,e,N+2,i),v(this,he,J0).call(this,t,N,n,i)):i.push(s,a)},MD=function(t){let e=[],n=t.length;return v(this,he,J0).call(this,t,0,n,e),e.push(t[n-2],t[n-1]),e.length<=4?null:e},OD=function(t,e,n,i,s,a){let l=new Float32Array(a**2),c=-2*i**2,u=a>>1;for(let y=0;y<a;y++){let x=(y-u)**2;for(let b=0;b<a;b++)l[y*a+b]=Math.exp((x+(b-u)**2)/c)}let h=new Float32Array(256),d=-2*s**2;for(let y=0;y<256;y++)h[y]=Math.exp(y**2/d);let f=t.length,p=new Uint8Array(f),m=new Uint32Array(256);for(let y=0;y<n;y++)for(let x=0;x<e;x++){let b=y*e+x,w=t[b],C=0,E=0;for(let N=0;N<a;N++){let k=y+N-u;if(!(k<0||k>=n))for(let M=0;M<a;M++){let R=x+M-u;if(R<0||R>=e)continue;let j=t[k*e+R],$=l[N*a+M]*h[Math.abs(j-w)];C+=j*$,E+=$}}let S=p[b]=Math.round(C/E);m[S]++}return[p,m]},FD=function(t){let e=new Uint32Array(256);for(let n of t)e[n]++;return e},s2=function(t){let e=t.length,n=new Uint8ClampedArray(e>>2),i=-1/0,s=1/0;for(let l=0,c=n.length;l<c;l++){let u=n[l]=t[l<<2];i=Math.max(i,u),s=Math.min(s,u)}let a=255/(i-s);for(let l=0,c=n.length;l<c;l++)n[l]=(n[l]-s)*a;return n},a2=function(t){let e,n=-1/0,i=-1/0,s=t.findIndex(c=>c!==0),a=s,l=s;for(e=s;e<256;e++){let c=t[e];c>n&&(e-a>i&&(i=e-a,l=e-1),n=c,a=e)}for(e=l-1;e>=0&&!(t[e]>t[e+1]);e--);return e},PD=function(t){let e=t,{width:n,height:i}=t,{maxDim:s}=o(this,Gc),a=n,l=i;if(n>s||i>s){let f=n,p=i,m=Math.log2(Math.max(n,i)/s),y=Math.floor(m);m=m===y?y-1:y;for(let b=0;b<m;b++){a=Math.ceil(f/2),l=Math.ceil(p/2);let w=new OffscreenCanvas(a,l);w.getContext("2d").drawImage(t,0,0,f,p,0,0,a,l),f=a,p=l,t!==e&&t.close(),t=w.transferToImageBitmap()}let x=Math.min(s/a,s/l);a=Math.round(a*x),l=Math.round(l*x)}let u=new OffscreenCanvas(a,l).getContext("2d",{willReadFrequently:!0});u.fillStyle="white",u.fillRect(0,0,a,l),u.filter="grayscale(1)",u.drawImage(t,0,0,t.width,t.height,0,0,a,l);let h=u.getImageData(0,0,a,l).data;return[v(this,he,s2).call(this,h),a,l]},A(Sr,he),A(Sr,Gc,{maxDim:512,sigmaSFactor:.02,sigmaR:25,kernelSize:16}),A(Sr,Vr,new Int32Array([0,1,-1,1,-1,0,-1,-1,0,-1,1,-1,1,0,1,1]));o2=class r extends _y{constructor(){super(),super.updateProperties({fill:Se._defaultLineColor,"stroke-width":0})}clone(){let t=new r;return t.updateAll(this),t}},l2=class r extends Oy{constructor(t){super(t),super.updateProperties({stroke:Se._defaultLineColor,"stroke-width":1})}clone(){let t=new r(this._viewParameters);return t.updateAll(this),t}},_i=class _i extends My{constructor(e){super({...e,mustBeCommitted:!0,name:"signatureEditor"});A(this,qo,!1);A(this,Os,null);A(this,Vo,null);A(this,Hc,null);this._willKeepAspectRatio=!0,g(this,Vo,e.signatureData||null),g(this,Os,null),this.defaultL10nId="pdfjs-editor-signature-editor1"}static initialize(e,n){Se.initialize(e,n),this._defaultDrawingOptions=new o2,this._defaultDrawnSignatureOptions=new l2(n.viewParameters)}static getDefaultDrawingOptions(e){let n=this._defaultDrawingOptions.clone();return n.updateProperties(e),n}static get supportMultipleDrawings(){return!1}static get typesMap(){return Ut(this,"typesMap",new Map)}static get isDrawer(){return!1}get telemetryFinalData(){return{type:"signature",hasDescription:!!o(this,Os)}}static computeTelemetryFinalData(e){let n=e.get("hasDescription");return{hasAltText:n.get(!0)??0,hasNoAltText:n.get(!1)??0}}get isResizable(){return!0}onScaleChanging(){this._drawId!==null&&super.onScaleChanging()}render(){if(this.div)return this.div;let e,n,{_isCopy:i}=this;if(i&&(this._isCopy=!1,e=this.x,n=this.y),super.render(),this._drawId===null)if(o(this,Vo)){let{lines:s,mustSmooth:a,areContours:l,description:c,uuid:u,heightInPage:h}=o(this,Vo),{rawDims:{pageWidth:d,pageHeight:f},rotation:p}=this.parent.viewport,m=Sr.processDrawnLines({lines:s,pageWidth:d,pageHeight:f,rotation:p,innerMargin:_i._INNER_MARGIN,mustSmooth:a,areContours:l});this.addSignature(m,h,c,u)}else this.div.setAttribute("data-l10n-args",JSON.stringify({description:""})),this.div.hidden=!0,this._uiManager.getSignature(this);else this.div.setAttribute("data-l10n-args",JSON.stringify({description:o(this,Os)||""}));return i&&(this._isCopy=!0,this._moveAfterPaste(e,n)),this.div}setUuid(e){g(this,Hc,e),this.addEditToolbar()}getUuid(){return o(this,Hc)}get description(){return o(this,Os)}set description(e){g(this,Os,e),this.div&&(this.div.setAttribute("data-l10n-args",JSON.stringify({description:e})),super.addEditToolbar().then(n=>{n?.updateEditSignatureButton(e)}))}getSignaturePreview(){let{newCurves:e,areContours:n,thickness:i,width:s,height:a}=o(this,Vo),l=Math.max(s,a),c=Sr.processDrawnLines({lines:{curves:e.map(u=>({points:u})),thickness:i,width:s,height:a},pageWidth:l,pageHeight:l,rotation:0,innerMargin:0,mustSmooth:!1,areContours:n});return{areContours:n,outline:c.outline}}get toolbarButtons(){return this._uiManager.signatureManager?[["editSignature",this._uiManager.signatureManager]]:super.toolbarButtons}addSignature(e,n,i,s){let{x:a,y:l}=this,{outline:c}=g(this,Vo,e);g(this,qo,c instanceof pp),this.description=i;let u;o(this,qo)?u=_i.getDefaultDrawingOptions():(u=_i._defaultDrawnSignatureOptions.clone(),u.updateProperties({"stroke-width":c.thickness})),this._addOutlines({drawOutlines:c,drawingOptions:u});let[,h]=this.pageDimensions,d=n/h;d=d>=1?.5:d,this.width*=d/this.height,this.width>=1&&(d*=.9/this.width,this.width=.9),this.height=d,this.setDims(),this.x=a,this.y=l,this.center(),this._onResized(),this.onScaleChanging(),this.rotate(),this._uiManager.addToAnnotationStorage(this),this.setUuid(s),this._reportTelemetry({action:"pdfjs.signature.inserted",data:{hasBeenSaved:!!s,hasDescription:!!i}}),this.div.hidden=!1}getFromImage(e){let{rawDims:{pageWidth:n,pageHeight:i},rotation:s}=this.parent.viewport;return Sr.process(e,n,i,s,_i._INNER_MARGIN)}getFromText(e,n){let{rawDims:{pageWidth:i,pageHeight:s},rotation:a}=this.parent.viewport;return Sr.extractContoursFromText(e,n,i,s,a,_i._INNER_MARGIN)}getDrawnSignature(e){let{rawDims:{pageWidth:n,pageHeight:i},rotation:s}=this.parent.viewport;return Sr.processDrawnLines({lines:e,pageWidth:n,pageHeight:i,rotation:s,innerMargin:_i._INNER_MARGIN,mustSmooth:!1,areContours:!1})}createDrawingOptions({areContours:e,thickness:n}){e?this._drawingOptions=_i.getDefaultDrawingOptions():(this._drawingOptions=_i._defaultDrawnSignatureOptions.clone(),this._drawingOptions.updateProperties({"stroke-width":n}))}serialize(e=!1){if(this.isEmpty())return null;let{lines:n,points:i}=this.serializeDraw(e),{_drawingOptions:{"stroke-width":s}}=this,a=Object.assign(super.serialize(e),{isSignature:!0,areContours:o(this,qo),color:[0,0,0],thickness:o(this,qo)?0:s});return this.addComment(a),e?(a.paths={lines:n,points:i},a.uuid=o(this,Hc),a.isCopy=!0):a.lines=n,o(this,Os)&&(a.accessibilityData={type:"Figure",alt:o(this,Os)}),a}static deserializeDraw(e,n,i,s,a,l){return l.areContours?pp.deserialize(e,n,i,s,a,l):Jc.deserialize(e,n,i,s,a,l)}static async deserialize(e,n,i){let s=await super.deserialize(e,n,i);return g(s,qo,e.areContours),s.description=e.accessibilityData?.alt||"",g(s,Hc,e.uuid),s}};qo=new WeakMap,Os=new WeakMap,Vo=new WeakMap,Hc=new WeakMap,U(_i,"_type","signature"),U(_i,"_editorType",Bt.SIGNATURE),U(_i,"_defaultDrawingOptions",null);c2=_i,Hf=class extends Se{constructor(e){super({...e,name:"stampEditor"});A(this,re);A(this,_e,null);A(this,Nn,null);A(this,Xo,null);A(this,Oa,null);A(this,Yo,null);A(this,wd,"");A(this,Fa,null);A(this,Wc,!1);A(this,Fs,null);A(this,Xi,!1);A(this,Ad,!1);g(this,Oa,e.bitmapUrl),g(this,Yo,e.bitmapFile),this.defaultL10nId="pdfjs-editor-stamp-editor"}static initialize(e,n){Se.initialize(e,n)}static isHandlingMimeForPasting(e){return ly.includes(e)}static paste(e,n){n.pasteEditor({mode:Bt.STAMP},{bitmapFile:e.getAsFile()})}altTextFinish(){this._uiManager.useNewAltTextFlow&&(this.div.hidden=!1),super.altTextFinish()}get telemetryFinalData(){return{type:"stamp",hasAltText:!!this.altTextData?.altText}}static computeTelemetryFinalData(e){let n=e.get("hasAltText");return{hasAltText:n.get(!0)??0,hasNoAltText:n.get(!1)??0}}async mlGuessAltText(e=null,n=!0){if(this.hasAltTextData())return null;let{mlManager:i}=this._uiManager;if(!i)throw new Error("No ML.");if(!await i.isEnabledFor("altText"))throw new Error("ML isn't enabled for alt text.");let{data:s,width:a,height:l}=e||this.copyCanvas(null,null,!0).imageData,c=await i.guess({name:"altText",request:{data:s,width:a,height:l,channels:s.length/(a*l)}});if(!c)throw new Error("No response from the AI service.");if(c.error)throw new Error("Error from the AI service.");if(c.cancel)return null;if(!c.output)throw new Error("No valid response from the AI service.");let u=c.output;return await this.setGuessedAltText(u),n&&!this.hasAltTextData()&&(this.altTextData={alt:u,decorative:!1}),u}remove(){o(this,Nn)&&(g(this,_e,null),this._uiManager.imageManager.deleteId(o(this,Nn)),o(this,Fa)?.remove(),g(this,Fa,null),o(this,Fs)&&(clearTimeout(o(this,Fs)),g(this,Fs,null))),super.remove()}rebuild(){if(!this.parent){o(this,Nn)&&v(this,re,ty).call(this);return}super.rebuild(),this.div!==null&&(o(this,Nn)&&o(this,Fa)===null&&v(this,re,ty).call(this),this.isAttachedToDOM||this.parent.add(this))}onceAdded(e){this._isDraggable=!0,e&&this.div.focus()}isEmpty(){return!(o(this,Xo)||o(this,_e)||o(this,Oa)||o(this,Yo)||o(this,Nn)||o(this,Wc))}get toolbarButtons(){return[["altText",this.createAltText()]]}get isResizable(){return!0}render(){if(this.div)return this.div;let e,n;return this._isCopy&&(e=this.x,n=this.y),super.render(),this.div.hidden=!0,this.createAltText(),o(this,Wc)||(o(this,_e)?v(this,re,ey).call(this):v(this,re,ty).call(this)),this._isCopy&&this._moveAfterPaste(e,n),this._uiManager.addShouldRescale(this),this.div}setCanvas(e,n){let{id:i,bitmap:s}=this._uiManager.imageManager.getFromCanvas(e,n);n.remove(),i&&this._uiManager.imageManager.isValidId(i)&&(g(this,Nn,i),s&&g(this,_e,s),g(this,Wc,!1),v(this,re,ey).call(this))}_onResized(){this.onScaleChanging()}onScaleChanging(){if(!this.parent)return;o(this,Fs)!==null&&clearTimeout(o(this,Fs)),g(this,Fs,setTimeout(()=>{g(this,Fs,null),v(this,re,u2).call(this)},200))}copyCanvas(e,n,i=!1){e||(e=224);let{width:s,height:a}=o(this,_e),l=new Ls,c=o(this,_e),u=s,h=a,d=null;if(n){if(s>n||a>n){let k=Math.min(n/s,n/a);u=Math.floor(s*k),h=Math.floor(a*k)}d=document.createElement("canvas");let p=d.width=Math.ceil(u*l.sx),m=d.height=Math.ceil(h*l.sy);o(this,Xi)||(c=v(this,re,ny).call(this,p,m));let y=d.getContext("2d");y.filter=this._uiManager.hcmFilter;let x="white",b="#cfcfd8";this._uiManager.hcmFilter!=="none"?b="black":jx.isDarkMode&&(x="#8f8f9d",b="#42414d");let w=15,C=w*l.sx,E=w*l.sy,S=new OffscreenCanvas(C*2,E*2),N=S.getContext("2d");N.fillStyle=x,N.fillRect(0,0,C*2,E*2),N.fillStyle=b,N.fillRect(0,0,C,E),N.fillRect(C,E,C,E),y.fillStyle=y.createPattern(S,"repeat"),y.fillRect(0,0,p,m),y.drawImage(c,0,0,c.width,c.height,0,0,p,m)}let f=null;if(i){let p,m;if(l.symmetric&&c.width<e&&c.height<e)p=c.width,m=c.height;else if(c=o(this,_e),s>e||a>e){let b=Math.min(e/s,e/a);p=Math.floor(s*b),m=Math.floor(a*b),o(this,Xi)||(c=v(this,re,ny).call(this,p,m))}let x=new OffscreenCanvas(p,m).getContext("2d",{willReadFrequently:!0});x.drawImage(c,0,0,c.width,c.height,0,0,p,m),f={width:p,height:m,data:x.getImageData(0,0,p,m).data}}return{canvas:d,width:u,height:h,imageData:f}}static async deserialize(e,n,i){let s=null,a=!1;if(e instanceof Sy){let{data:{rect:x,rotation:b,id:w,structParent:C,popupRef:E,richText:S,contentsObj:N,creationDate:k,modificationDate:M},container:R,parent:{page:{pageNumber:j}},canvas:$}=e,q,Q;$?(delete e.canvas,{id:q,bitmap:Q}=i.imageManager.getFromCanvas(R.id,$),$.remove()):(a=!0,e._hasNoCanvas=!0);let Z=(await n._structTree.getAriaAttributes(`${Xu}${w}`))?.get("aria-label")||"";s=e={annotationType:Bt.STAMP,bitmapId:q,bitmap:Q,pageIndex:j-1,rect:x.slice(0),rotation:b,annotationElementId:w,id:w,deleted:!1,accessibilityData:{decorative:!1,altText:Z},isSvg:!1,structParent:C,popupRef:E,richText:S,comment:N?.str||null,creationDate:k,modificationDate:M}}let l=await super.deserialize(e,n,i),{rect:c,bitmap:u,bitmapUrl:h,bitmapId:d,isSvg:f,accessibilityData:p}=e;a?(i.addMissingCanvas(e.id,l),g(l,Wc,!0)):d&&i.imageManager.isValidId(d)?(g(l,Nn,d),u&&g(l,_e,u)):g(l,Oa,h),g(l,Xi,f);let[m,y]=l.pageDimensions;return l.width=(c[2]-c[0])/m,l.height=(c[3]-c[1])/y,p&&(l.altTextData=p),l._initialData=s,e.comment&&l.setCommentData(e),g(l,Ad,!!s),l}serialize(e=!1,n=null){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();let i=Object.assign(super.serialize(e),{bitmapId:o(this,Nn),isSvg:o(this,Xi)});if(this.addComment(i),e)return i.bitmapUrl=v(this,re,iy).call(this,!0),i.accessibilityData=this.serializeAltText(!0),i.isCopy=!0,i;let{decorative:s,altText:a}=this.serializeAltText(!1);if(!s&&a&&(i.accessibilityData={type:"Figure",alt:a}),this.annotationElementId){let c=v(this,re,RD).call(this,i);return c.isSame?null:(c.isSameAltText?delete i.accessibilityData:i.accessibilityData.structParent=this._initialData.structParent??-1,i.id=this.annotationElementId,delete i.bitmapId,i)}if(n===null)return i;n.stamps||(n.stamps=new Map);let l=o(this,Xi)?(i.rect[2]-i.rect[0])*(i.rect[3]-i.rect[1]):null;if(!n.stamps.has(o(this,Nn)))n.stamps.set(o(this,Nn),{area:l,serialized:i}),i.bitmap=v(this,re,iy).call(this,!1);else if(o(this,Xi)){let c=n.stamps.get(o(this,Nn));l>c.area&&(c.area=l,c.serialized.bitmap.close(),c.serialized.bitmap=v(this,re,iy).call(this,!1))}return i}renderAnnotationElement(e){return this.deleted?(e.hide(),null):(e.updateEdited({rect:this.getPDFRect(),popup:this.comment}),null)}};_e=new WeakMap,Nn=new WeakMap,Xo=new WeakMap,Oa=new WeakMap,Yo=new WeakMap,wd=new WeakMap,Fa=new WeakMap,Wc=new WeakMap,Fs=new WeakMap,Xi=new WeakMap,Ad=new WeakMap,re=new WeakSet,Wf=function(e,n=!1){if(!e){this.remove();return}g(this,_e,e.bitmap),n||(g(this,Nn,e.id),g(this,Xi,e.isSvg)),e.file&&g(this,wd,e.file.name),v(this,re,ey).call(this)},qf=function(){if(g(this,Xo,null),this._uiManager.enableWaiting(!1),!!o(this,Fa)){if(this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&o(this,_e)){this.addEditToolbar().then(()=>{this._editToolbar.hide(),this._uiManager.editAltText(this,!0)});return}if(!this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&o(this,_e)){this._reportTelemetry({action:"pdfjs.image.image_added",data:{alt_text_modal:!1,alt_text_type:"empty"}});try{this.mlGuessAltText()}catch{}}this.div.focus()}},ty=function(){if(o(this,Nn)){this._uiManager.enableWaiting(!0),this._uiManager.imageManager.getFromId(o(this,Nn)).then(i=>v(this,re,Wf).call(this,i,!0)).finally(()=>v(this,re,qf).call(this));return}if(o(this,Oa)){let i=o(this,Oa);g(this,Oa,null),this._uiManager.enableWaiting(!0),g(this,Xo,this._uiManager.imageManager.getFromUrl(i).then(s=>v(this,re,Wf).call(this,s)).finally(()=>v(this,re,qf).call(this)));return}if(o(this,Yo)){let i=o(this,Yo);g(this,Yo,null),this._uiManager.enableWaiting(!0),g(this,Xo,this._uiManager.imageManager.getFromFile(i).then(s=>v(this,re,Wf).call(this,s)).finally(()=>v(this,re,qf).call(this)));return}let e=document.createElement("input");e.type="file",e.accept=ly.join(",");let n=this._uiManager._signal;g(this,Xo,new Promise(i=>{e.addEventListener("change",async()=>{if(!e.files||e.files.length===0)this.remove();else{this._uiManager.enableWaiting(!0);let s=await this._uiManager.imageManager.getFromFile(e.files[0]);this._reportTelemetry({action:"pdfjs.image.image_selected",data:{alt_text_modal:this._uiManager.useNewAltTextFlow}}),v(this,re,Wf).call(this,s)}i()},{signal:n}),e.addEventListener("cancel",()=>{this.remove(),i()},{signal:n})}).finally(()=>v(this,re,qf).call(this))),e.click()},ey=function(){let{div:e}=this,{width:n,height:i}=o(this,_e),[s,a]=this.pageDimensions,l=.75;if(this.width)n=this.width*s,i=this.height*a;else if(n>l*s||i>l*a){let u=Math.min(l*s/n,l*a/i);n*=u,i*=u}this._uiManager.enableWaiting(!1);let c=g(this,Fa,document.createElement("canvas"));c.setAttribute("role","img"),this.addContainer(c),this.width=n/s,this.height=i/a,this.setDims(),this._initialOptions?.isCentered?this.center():this.fixAndSetPosition(),this._initialOptions=null,(!this._uiManager.useNewAltTextWhenAddingImage||!this._uiManager.useNewAltTextFlow||this.annotationElementId)&&(e.hidden=!1),v(this,re,u2).call(this),o(this,Ad)||(this.parent.addUndoableEditor(this),g(this,Ad,!0)),this._reportTelemetry({action:"inserted_image"}),o(this,wd)&&this.div.setAttribute("aria-description",o(this,wd)),this.annotationElementId||this._uiManager.a11yAlert("pdfjs-editor-stamp-added-alert")},ny=function(e,n){let{width:i,height:s}=o(this,_e),a=i,l=s,c=o(this,_e);for(;a>2*e||l>2*n;){let u=a,h=l;a>2*e&&(a=a>=16384?Math.floor(a/2)-1:Math.ceil(a/2)),l>2*n&&(l=l>=16384?Math.floor(l/2)-1:Math.ceil(l/2));let d=new OffscreenCanvas(a,l);d.getContext("2d").drawImage(c,0,0,u,h,0,0,a,l),c=d.transferToImageBitmap()}return c},u2=function(){let[e,n]=this.parentDimensions,{width:i,height:s}=this,a=new Ls,l=Math.ceil(i*e*a.sx),c=Math.ceil(s*n*a.sy),u=o(this,Fa);if(!u||u.width===l&&u.height===c)return;u.width=l,u.height=c;let h=o(this,Xi)?o(this,_e):v(this,re,ny).call(this,l,c),d=u.getContext("2d");d.filter=this._uiManager.hcmFilter,d.drawImage(h,0,0,h.width,h.height,0,0,l,c)},iy=function(e){if(e){if(o(this,Xi)){let s=this._uiManager.imageManager.getSvgUrl(o(this,Nn));if(s)return s}let n=document.createElement("canvas");return{width:n.width,height:n.height}=o(this,_e),n.getContext("2d").drawImage(o(this,_e),0,0),n.toDataURL()}if(o(this,Xi)){let[n,i]=this.pageDimensions,s=Math.round(this.width*n*ja.PDF_TO_CSS_UNITS),a=Math.round(this.height*i*ja.PDF_TO_CSS_UNITS),l=new OffscreenCanvas(s,a);return l.getContext("2d").drawImage(o(this,_e),0,0,o(this,_e).width,o(this,_e).height,0,0,s,a),l.transferToImageBitmap()}return structuredClone(o(this,_e))},RD=function(e){let{pageIndex:n,accessibilityData:{altText:i}}=this._initialData,s=e.pageIndex===n,a=(e.accessibilityData?.alt||"")===i;return{isSame:!this.hasEditedComment&&!this._hasBeenMoved&&!this._hasBeenResized&&s&&a,isSameAltText:a}},U(Hf,"_type","stamp"),U(Hf,"_editorType",Bt.STAMP);Pr=class Pr{constructor({uiManager:t,pageIndex:e,div:n,structTreeLayer:i,accessibilityManager:s,annotationLayer:a,drawLayer:l,textLayer:c,viewport:u,l10n:h}){A(this,Ee);A(this,qc);A(this,vd,!1);A(this,Ko,null);A(this,Zo,null);A(this,Pa,null);A(this,Ti,new Map);A(this,Qo,!1);A(this,Cd,!1);A(this,Ed,!1);A(this,Xr,null);A(this,Ra,null);A(this,In,null);A(this,La,null);A(this,Jo,null);A(this,Td,-1);A(this,_t);let d=[...o(Pr,tl).values()];if(!Pr._initialized){Pr._initialized=!0;for(let f of d)f.initialize(h,t)}t.registerEditorTypes(d),g(this,_t,t),this.pageIndex=e,this.div=n,g(this,qc,s),g(this,Ko,a),this.viewport=u,g(this,In,c),this.drawLayer=l,this._structTree=i,o(this,_t).addLayer(this)}get isEmpty(){return o(this,Ti).size===0}get isInvisible(){return this.isEmpty&&o(this,_t).getMode()===Bt.NONE}updateToolbar(t){o(this,_t).updateToolbar(t)}updateMode(t=o(this,_t).getMode()){switch(v(this,Ee,ry).call(this),t){case Bt.NONE:this.div.classList.toggle("nonEditing",!0),this.disableTextSelection(),this.togglePointerEvents(!1),this.toggleAnnotationLayerPointerEvents(!0),this.disableClick();return;case Bt.INK:this.disableTextSelection(),this.togglePointerEvents(!0),this.enableClick();break;case Bt.HIGHLIGHT:this.enableTextSelection(),this.togglePointerEvents(!1),this.disableClick();break;default:this.disableTextSelection(),this.togglePointerEvents(!0),this.enableClick()}this.toggleAnnotationLayerPointerEvents(!1);let{classList:e}=this.div;if(e.toggle("nonEditing",!1),t===Bt.POPUP)e.toggle("commentEditing",!0);else{e.toggle("commentEditing",!1);for(let n of o(Pr,tl).values())e.toggle(`${n._type}Editing`,t===n._editorType)}this.div.hidden=!1}hasTextLayer(t){return t===o(this,In)?.div}setEditingState(t){o(this,_t).setEditingState(t)}addCommands(t){o(this,_t).addCommands(t)}cleanUndoStack(t){o(this,_t).cleanUndoStack(t)}toggleDrawing(t=!1){this.div.classList.toggle("drawing",!t)}togglePointerEvents(t=!1){this.div.classList.toggle("disabled",!t)}toggleAnnotationLayerPointerEvents(t=!1){o(this,Ko)?.togglePointerEvents(t)}async enable(){g(this,Ed,!0),this.div.tabIndex=0,this.togglePointerEvents(!0),this.div.classList.toggle("nonEditing",!1),o(this,Jo)?.abort(),g(this,Jo,null);let t=new Set;for(let n of o(this,Ee,h2))n.enableEditing(),n.show(!0),n.annotationElementId&&(o(this,_t).removeChangedExistingAnnotation(n),t.add(n.annotationElementId));let e=o(this,Ko);if(e)for(let n of e.getEditableAnnotations()){if(n.hide(),o(this,_t).isDeletedAnnotationElement(n.data.id)||t.has(n.data.id))continue;let i=await this.deserialize(n);i&&(this.addOrRebuild(i),i.enableEditing())}g(this,Ed,!1),o(this,_t)._eventBus.dispatch("editorsrendered",{source:this,pageNumber:this.pageIndex+1})}disable(){if(g(this,Cd,!0),this.div.tabIndex=-1,this.togglePointerEvents(!1),this.div.classList.toggle("nonEditing",!0),o(this,In)&&!o(this,Jo)){g(this,Jo,new AbortController);let i=o(this,_t).combinedSignal(o(this,Jo));o(this,In).div.addEventListener("pointerdown",s=>{let{clientX:l,clientY:c,timeStamp:u}=s,h=o(this,Td);if(u-h>500){g(this,Td,u);return}g(this,Td,-1);let{classList:d}=this.div;d.toggle("getElements",!0);let f=document.elementsFromPoint(l,c);if(d.toggle("getElements",!1),!this.div.contains(f[0]))return;let p,m=new RegExp(`^${Jf}[0-9]+$`);for(let x of f)if(m.test(x.id)){p=x.id;break}if(!p)return;let y=o(this,Ti).get(p);y?.annotationElementId===null&&(s.stopPropagation(),s.preventDefault(),y.dblclick(s))},{signal:i,capture:!0})}let t=o(this,Ko),e=[];if(t){let i=new Map,s=new Map;for(let a of o(this,Ee,h2)){if(a.disableEditing(),!a.annotationElementId){e.push(a);continue}if(a.serialize()!==null){i.set(a.annotationElementId,a);continue}else s.set(a.annotationElementId,a);this.getEditableAnnotation(a.annotationElementId)?.show(),a.remove()}for(let a of t.getEditableAnnotations()){let{id:l}=a.data;if(o(this,_t).isDeletedAnnotationElement(l)){a.updateEdited({deleted:!0});continue}let c=s.get(l);if(c){c.resetAnnotationElement(a),c.show(!1),a.show();continue}c=i.get(l),c&&(o(this,_t).addChangedExistingAnnotation(c),c.renderAnnotationElement(a)&&c.show(!1)),a.show()}}v(this,Ee,ry).call(this),this.isEmpty&&(this.div.hidden=!0);let{classList:n}=this.div;for(let i of o(Pr,tl).values())n.remove(`${i._type}Editing`);this.disableTextSelection(),this.toggleAnnotationLayerPointerEvents(!0),t?.updateFakeAnnotations(e),g(this,Cd,!1)}getEditableAnnotation(t){return o(this,Ko)?.getEditableAnnotation(t)||null}setActiveEditor(t){o(this,_t).getActive()!==t&&o(this,_t).setActiveEditor(t)}enableTextSelection(){if(this.div.tabIndex=-1,o(this,In)?.div&&!o(this,La)){g(this,La,new AbortController);let t=o(this,_t).combinedSignal(o(this,La));o(this,In).div.addEventListener("pointerdown",v(this,Ee,LD).bind(this),{signal:t}),o(this,In).div.classList.add("highlighting")}}disableTextSelection(){this.div.tabIndex=0,o(this,In)?.div&&o(this,La)&&(o(this,La).abort(),g(this,La,null),o(this,In).div.classList.remove("highlighting"))}enableClick(){if(o(this,Zo))return;g(this,Zo,new AbortController);let t=o(this,_t).combinedSignal(o(this,Zo));this.div.addEventListener("pointerdown",this.pointerdown.bind(this),{signal:t});let e=this.pointerup.bind(this);this.div.addEventListener("pointerup",e,{signal:t}),this.div.addEventListener("pointercancel",e,{signal:t})}disableClick(){o(this,Zo)?.abort(),g(this,Zo,null)}attach(t){o(this,Ti).set(t.id,t);let{annotationElementId:e}=t;e&&o(this,_t).isDeletedAnnotationElement(e)&&o(this,_t).removeDeletedAnnotationElement(t)}detach(t){o(this,Ti).delete(t.id),o(this,qc)?.removePointerInTextLayer(t.contentDiv),!o(this,Cd)&&t.annotationElementId&&o(this,_t).addDeletedAnnotationElement(t)}remove(t){this.detach(t),o(this,_t).removeEditor(t),t.div.remove(),t.isAttachedToDOM=!1}changeParent(t){t.parent!==this&&(t.parent&&t.annotationElementId&&(o(this,_t).addDeletedAnnotationElement(t),Se.deleteAnnotationElement(t),t.annotationElementId=null),this.attach(t),t.parent?.detach(t),t.setParent(this),t.div&&t.isAttachedToDOM&&(t.div.remove(),this.div.append(t.div)))}add(t){if(!(t.parent===this&&t.isAttachedToDOM)){if(this.changeParent(t),o(this,_t).addEditor(t),this.attach(t),!t.isAttachedToDOM){let e=t.render();this.div.append(e),t.isAttachedToDOM=!0}t.fixAndSetPosition(),t.onceAdded(!o(this,Ed)),o(this,_t).addToAnnotationStorage(t),t._reportTelemetry(t.telemetryInitialData)}}moveEditorInDOM(t){if(!t.isAttachedToDOM)return;let{activeElement:e}=document;t.div.contains(e)&&!o(this,Pa)&&(t._focusEventsAllowed=!1,g(this,Pa,setTimeout(()=>{g(this,Pa,null),t.div.contains(document.activeElement)?t._focusEventsAllowed=!0:(t.div.addEventListener("focusin",()=>{t._focusEventsAllowed=!0},{once:!0,signal:o(this,_t)._signal}),e.focus())},0))),t._structTreeParentId=o(this,qc)?.moveElementInDOM(this.div,t.div,t.contentDiv,!0)}addOrRebuild(t){t.needsToBeRebuilt()?(t.parent||(t.parent=this),t.rebuild(),t.show()):this.add(t)}addUndoableEditor(t){let e=()=>t._uiManager.rebuild(t),n=()=>{t.remove()};this.addCommands({cmd:e,undo:n,mustExec:!1})}getEditorByUID(t){for(let e of o(this,Ti).values())if(e.uid===t)return e;return null}combinedSignal(t){return o(this,_t).combinedSignal(t)}canCreateNewEmptyEditor(){return o(this,Ee,fs)?.canCreateNewEmptyEditor()}async pasteEditor(t,e){this.updateToolbar(t),await o(this,_t).updateMode(t.mode);let{offsetX:n,offsetY:i}=v(this,Ee,f2).call(this),s=o(this,_t).getId(),a=v(this,Ee,d2).call(this,{parent:this,id:s,x:n,y:i,uiManager:o(this,_t),isCentered:!0,...e});a&&this.add(a)}async deserialize(t){return await o(Pr,tl).get(t.annotationType??t.annotationEditorType)?.deserialize(t,this,o(this,_t))||null}createAndAddNewEditor(t,e,n={}){let i=o(this,_t).getId(),s=v(this,Ee,d2).call(this,{parent:this,id:i,x:t.offsetX,y:t.offsetY,uiManager:o(this,_t),isCentered:e,...n});return s&&this.add(s),s}get boundingClientRect(){return this.div.getBoundingClientRect()}addNewEditor(t={}){this.createAndAddNewEditor(v(this,Ee,f2).call(this),!0,t)}setSelected(t){o(this,_t).setSelected(t)}toggleSelected(t){o(this,_t).toggleSelected(t)}unselect(t){o(this,_t).unselect(t)}pointerup(t){let{isMac:e}=Xe.platform;if(t.button!==0||t.ctrlKey&&e||t.target!==this.div||!o(this,Qo)||(g(this,Qo,!1),o(this,Ee,fs)?.isDrawer&&o(this,Ee,fs).supportMultipleDrawings))return;if(!o(this,vd)){g(this,vd,!0);return}let n=o(this,_t).getMode();if(n===Bt.STAMP||n===Bt.POPUP||n===Bt.SIGNATURE){o(this,_t).unselectAll();return}this.createAndAddNewEditor(t,!1)}pointerdown(t){if(o(this,_t).getMode()===Bt.HIGHLIGHT&&this.enableTextSelection(),o(this,Qo)){g(this,Qo,!1);return}let{isMac:e}=Xe.platform;if(t.button!==0||t.ctrlKey&&e||t.target!==this.div)return;if(g(this,Qo,!0),o(this,Ee,fs)?.isDrawer){this.startDrawingSession(t);return}let n=o(this,_t).getActive();g(this,vd,!n||n.isEmpty())}startDrawingSession(t){if(this.div.focus({preventScroll:!0}),o(this,Xr)){o(this,Ee,fs).startDrawing(this,o(this,_t),!1,t);return}o(this,_t).setCurrentDrawingSession(this),g(this,Xr,new AbortController);let e=o(this,_t).combinedSignal(o(this,Xr));this.div.addEventListener("blur",({relatedTarget:n})=>{n&&!this.div.contains(n)&&(g(this,Ra,null),this.commitOrRemove())},{signal:e}),o(this,Ee,fs).startDrawing(this,o(this,_t),!1,t)}pause(t){if(t){let{activeElement:e}=document;this.div.contains(e)&&g(this,Ra,e);return}o(this,Ra)&&setTimeout(()=>{o(this,Ra)?.focus(),g(this,Ra,null)},0)}endDrawingSession(t=!1){return o(this,Xr)?(o(this,_t).setCurrentDrawingSession(null),o(this,Xr).abort(),g(this,Xr,null),g(this,Ra,null),o(this,Ee,fs).endDrawing(t)):null}findNewParent(t,e,n){let i=o(this,_t).findParent(e,n);return i===null||i===this?!1:(i.changeParent(t),!0)}commitOrRemove(){return o(this,Xr)?(this.endDrawingSession(),!0):!1}onScaleChanging(){o(this,Xr)&&o(this,Ee,fs).onScaleChangingWhenDrawing(this)}destroy(){this.commitOrRemove(),o(this,_t).getActive()?.parent===this&&(o(this,_t).commitOrRemove(),o(this,_t).setActiveEditor(null)),o(this,Pa)&&(clearTimeout(o(this,Pa)),g(this,Pa,null));for(let t of o(this,Ti).values())o(this,qc)?.removePointerInTextLayer(t.contentDiv),t.setParent(null),t.isAttachedToDOM=!1,t.div.remove();this.div=null,o(this,Ti).clear(),o(this,_t).removeLayer(this)}async render({viewport:t}){this.viewport=t,el(this.div,t);for(let e of o(this,_t).getEditors(this.pageIndex))this.add(e),e.rebuild();await o(this,_t).findClonesForPage(this),this.div.hidden=this.isEmpty,this.updateMode()}update({viewport:t}){o(this,_t).commitOrRemove(),v(this,Ee,ry).call(this);let e=this.viewport.rotation,n=t.rotation;if(this.viewport=t,el(this.div,{rotation:n}),e!==n)for(let i of o(this,Ti).values())i.rotate(n)}get pageDimensions(){let{pageWidth:t,pageHeight:e}=this.viewport.rawDims;return[t,e]}get scale(){return o(this,_t).viewParameters.realScale}};qc=new WeakMap,vd=new WeakMap,Ko=new WeakMap,Zo=new WeakMap,Pa=new WeakMap,Ti=new WeakMap,Qo=new WeakMap,Cd=new WeakMap,Ed=new WeakMap,Xr=new WeakMap,Ra=new WeakMap,In=new WeakMap,La=new WeakMap,Jo=new WeakMap,Td=new WeakMap,_t=new WeakMap,tl=new WeakMap,Ee=new WeakSet,h2=function(){return o(this,Ti).size!==0?o(this,Ti).values():o(this,_t).getEditors(this.pageIndex)},LD=function(t){o(this,_t).unselectAll();let{target:e}=t;if(e===o(this,In).div||(e.getAttribute("role")==="img"||e.classList.contains("endOfContent"))&&o(this,In).div.contains(e)){let{isMac:n}=Xe.platform;if(t.button!==0||t.ctrlKey&&n)return;o(this,_t).showAllEditors("highlight",!0,!0),o(this,In).div.classList.add("free"),this.toggleDrawing(),ky.startHighlighting(this,o(this,_t).direction==="ltr",{target:o(this,In).div,x:t.x,y:t.y}),o(this,In).div.addEventListener("pointerup",()=>{o(this,In).div.classList.remove("free"),this.toggleDrawing(!0)},{once:!0,signal:o(this,_t)._signal}),t.preventDefault()}},fs=function(){return o(Pr,tl).get(o(this,_t).getMode())},d2=function(t){let e=o(this,Ee,fs);return e?new e.prototype.constructor(t):null},f2=function(){let{x:t,y:e,width:n,height:i}=this.boundingClientRect,s=Math.max(0,t),a=Math.max(0,e),l=Math.min(window.innerWidth,t+n),c=Math.min(window.innerHeight,e+i),u=(s+l)/2-t,h=(a+c)/2-e,[d,f]=this.viewport.rotation%180===0?[u,h]:[h,u];return{offsetX:d,offsetY:f}},ry=function(){for(let t of o(this,Ti).values())t.isEmpty()&&t.remove()},U(Pr,"_initialized",!1),A(Pr,tl,new Map([WA,n2,Hf,ky,c2].map(t=>[t._editorType,t])));Fy=Pr,mn=class mn{constructor(){A(this,Us);A(this,Yr,null);A(this,ci,new Map);A(this,Vc,new Map)}setParent(t){if(!o(this,Yr)){g(this,Yr,t);return}if(o(this,Yr)!==t){if(o(this,ci).size>0)for(let e of o(this,ci).values())e.remove(),t.append(e);g(this,Yr,t)}}static get _svgFactory(){return Ut(this,"_svgFactory",new Zc)}draw(t,e=!1,n=!1){let i=an(mn,eg)._++,s=v(this,Us,p2).call(this),a=mn._svgFactory.createElement("defs");s.append(a);let l=mn._svgFactory.createElement("path");a.append(l);let c=`path_${i}`;l.setAttribute("id",c),l.setAttribute("vector-effect","non-scaling-stroke"),e&&o(this,Vc).set(i,l);let u=n?v(this,Us,UD).call(this,a,c):null,h=mn._svgFactory.createElement("use");return s.append(h),h.setAttribute("href",`#${c}`),this.updateProperties(s,t),o(this,ci).set(i,s),{id:i,clipPathId:`url(#${u})`}}drawOutline(t,e){let n=an(mn,eg)._++,i=v(this,Us,p2).call(this),s=mn._svgFactory.createElement("defs");i.append(s);let a=mn._svgFactory.createElement("path");s.append(a);let l=`path_${n}`;a.setAttribute("id",l),a.setAttribute("vector-effect","non-scaling-stroke");let c;if(e){let d=mn._svgFactory.createElement("mask");s.append(d),c=`mask_${n}`,d.setAttribute("id",c),d.setAttribute("maskUnits","objectBoundingBox");let f=mn._svgFactory.createElement("rect");d.append(f),f.setAttribute("width","1"),f.setAttribute("height","1"),f.setAttribute("fill","white");let p=mn._svgFactory.createElement("use");d.append(p),p.setAttribute("href",`#${l}`),p.setAttribute("stroke","none"),p.setAttribute("fill","black"),p.setAttribute("fill-rule","nonzero"),p.classList.add("mask")}let u=mn._svgFactory.createElement("use");i.append(u),u.setAttribute("href",`#${l}`),c&&u.setAttribute("mask",`url(#${c})`);let h=u.cloneNode();return i.append(h),u.classList.add("mainOutline"),h.classList.add("secondaryOutline"),this.updateProperties(i,t),o(this,ci).set(n,i),n}finalizeDraw(t,e){o(this,Vc).delete(t),this.updateProperties(t,e)}updateProperties(t,e){var c;if(!e)return;let{root:n,bbox:i,rootClass:s,path:a}=e,l=typeof t=="number"?o(this,ci).get(t):t;if(l){if(n&&v(this,Us,m2).call(this,l,n),i&&v(c=mn,rb,BD).call(c,l,i),s){let{classList:u}=l;for(let[h,d]of Object.entries(s))u.toggle(h,d)}if(a){let h=l.firstElementChild.firstElementChild;v(this,Us,m2).call(this,h,a)}}}updateParent(t,e){if(e===this)return;let n=o(this,ci).get(t);n&&(o(e,Yr).append(n),o(this,ci).delete(t),o(e,ci).set(t,n))}remove(t){o(this,Vc).delete(t),o(this,Yr)!==null&&(o(this,ci).get(t).remove(),o(this,ci).delete(t))}destroy(){g(this,Yr,null);for(let t of o(this,ci).values())t.remove();o(this,ci).clear(),o(this,Vc).clear()}};Yr=new WeakMap,ci=new WeakMap,Vc=new WeakMap,eg=new WeakMap,rb=new WeakSet,BD=function(t,[e,n,i,s]){let{style:a}=t;a.top=`${100*n}%`,a.left=`${100*e}%`,a.width=`${100*i}%`,a.height=`${100*s}%`},Us=new WeakSet,p2=function(){let t=mn._svgFactory.create(1,1,!0);return o(this,Yr).append(t),t.setAttribute("aria-hidden",!0),t},UD=function(t,e){let n=mn._svgFactory.createElement("clipPath");t.append(n);let i=`clip_${e}`;n.setAttribute("id",i),n.setAttribute("clipPathUnits","objectBoundingBox");let s=mn._svgFactory.createElement("use");return n.append(s),s.setAttribute("href",`#${e}`),s.classList.add("clip"),i},m2=function(t,e){for(let[n,i]of Object.entries(e))i===null?t.removeAttribute(n):t.setAttribute(n,i)},A(mn,rb),A(mn,eg,0);Py=mn;Qf=class Qf{constructor(t,e,n,i){A(this,sb);A(this,Sd,[]);A(this,ng,new Map);A(this,ig,null);A(this,Dd,0);A(this,Ps,0);A(this,Rs,0);g(this,Dd,t),g(this,Sd,e),g(this,Ps,n.rawDims.pageWidth),g(this,Rs,n.rawDims.pageHeight),g(this,ig,i)}render(){let t=document.createElement("div");t.className="textLayerImages";for(let e=0;e<o(this,Sd).length;e+=6){let n=v(this,sb,$D).call(this,o(this,Sd).subarray(e,e+6));n&&t.append(n)}return t.addEventListener("contextmenu",e=>{if(!(e.target instanceof HTMLCanvasElement))return;let n=e.target,i=o(this,ng).get(n);if(!i)return;let s=o(Qf,rg)?.deref();if(s===n)return;s&&(s.width=0,s.height=0),g(Qf,rg,new WeakRef(n));let{inverseTransform:a,x1:l,y1:c,width:u,height:h}=i,d=o(this,ig).call(this),f=Math.ceil(l*d.width),p=Math.ceil(c*d.height),m=Math.floor((l+u/o(this,Ps))*d.width),y=Math.floor((c+h/o(this,Rs))*d.height);n.width=m-f,n.height=y-p;let x=n.getContext("2d");x.setTransform(...a),x.translate(-f,-p),x.drawImage(d,0,0)}),t}};Sd=new WeakMap,ng=new WeakMap,ig=new WeakMap,Dd=new WeakMap,Ps=new WeakMap,Rs=new WeakMap,rg=new WeakMap,sb=new WeakSet,$D=function([t,e,n,i,s,a]){let l=Math.hypot((s-t)*o(this,Ps),(a-e)*o(this,Rs)),c=Math.hypot((n-t)*o(this,Ps),(i-e)*o(this,Rs));if(l<o(this,Dd)||c<o(this,Dd))return null;let u=[(s-t)*o(this,Ps)/l,(a-e)*o(this,Rs)/l,(n-t)*o(this,Ps)/c,(i-e)*o(this,Rs)/c,0,0],h=yt.inverseTransform(u),d=document.createElement("canvas");return d.className="textLayerImagePlaceholder",d.width=0,d.height=0,Object.assign(d.style,{opacity:0,position:"absolute",left:y0(t),top:y0(e),width:y0(l/o(this,Ps)),height:y0(c/o(this,Rs)),transformOrigin:"0% 0%",transform:`matrix(${u.join(",")})`}),o(this,ng).set(d,{inverseTransform:h,width:l,height:c,x1:t,y1:e}),d},A(Qf,rg,null);Ry=Qf;globalThis._pdfjsTestingUtils={HighlightOutliner:dp};globalThis.pdfjsLib={AbortException:Qr,AnnotationEditorLayer:Fy,AnnotationEditorParamsType:Zt,AnnotationEditorType:Bt,AnnotationEditorUIManager:nl,AnnotationLayer:Dy,AnnotationMode:Ba,AnnotationType:tn,applyOpacity:PT,build:VS,ColorPicker:lp,createValidAbsoluteUrl:g2,CSSConstants:cy,DOMSVGFactory:Zc,DrawLayer:Py,FeatureTest:Xe,fetchData:hb,findContrastColor:RT,getDocument:GS,getFilenameFromUrl:MT,getPdfFilenameFromUrl:OT,getRGB:Bd,getUuid:b2,getXfaPageViewport:FT,GlobalWorkerOptions:Tr,ImageKind:Vf,InvalidPDFException:Id,isDataScheme:ag,isPdfFile:db,isValidExplicitDest:yS,makeArr:cb,makeMap:ub,makeObj:ay,MathClamp:yn,noContextMenu:tr,normalizeUnicode:_T,OPS:Nd,OutputScale:Ls,PasswordResponses:kT,PDFDataRangeTransport:op,PDFDateString:Xc,PDFWorker:Pd,PermissionFlag:IT,PixelsPerInch:ja,RenderingCancelledException:kd,renderRichText:x2,ResponseException:Yc,setLayerDimensions:el,shadow:Ut,SignatureExtractor:Sr,stopEvent:Be,SupportedImageMimeTypes:ly,TextLayer:Fd,TextLayerImages:Ry,TouchManager:ip,updateUrlHash:y2,Util:yt,VerbosityLevel:sg,version:qS,XfaLayer:ep}});var nN={};lg(nN,{default:()=>dF,existsSync:()=>KD,lstatSync:()=>QD,mkdirSync:()=>tN,readFile:()=>YD,readFileSync:()=>XD,readdirSync:()=>JD,statSync:()=>ZD,writeFileSync:()=>eN});function eu(r){throw new Error(`officeparser: 'fs.${r}' is not supported in the browser. Callers must pass file content as Buffer or Uint8Array directly to the parser.`)}var XD,YD,KD,ZD,QD,JD,tN,eN,dF,iN=ne(()=>{"use strict";B();XD=r=>eu("readFileSync"),YD=(r,t)=>eu("readFile"),KD=r=>!1,ZD=r=>eu("statSync"),QD=r=>eu("lstatSync"),JD=r=>eu("readdirSync"),tN=r=>eu("mkdirSync"),eN=(r,t)=>eu("writeFileSync"),dF={readFileSync:XD,readFile:YD,existsSync:KD,statSync:ZD,lstatSync:QD,readdirSync:JD,mkdirSync:tN,writeFileSync:eN,promises:{readFile:r=>Promise.reject(new Error("officeparser: 'fs.promises.readFile' is not supported in the browser.")),writeFile:(r,t)=>Promise.reject(new Error("officeparser: 'fs.promises.writeFile' is not supported in the browser.")),readdir:r=>Promise.reject(new Error("officeparser: 'fs.promises.readdir' is not supported in the browser."))}}});B();B();B();B();B();B();B();var WN="5.6.205",qN=`https://cdn.jsdelivr.net/npm/pdfjs-dist@${WN}/build/pdf.worker.min.mjs`,Ob=/[.!?。!?]/,Fb=["Mr","Dr","Ms","Inc","Ltd","Prof","Sr","Jr","vs","etc"],VN={language:"eng",workerPath:"",corePath:"",langPath:"",autoTerminateTimeout:1e4},fg={outputErrorToConsole:!1,onWarning:()=>{},newlineDelimiter:`
|
|
69
69
|
`,ignoreNotes:!1,putNotesAtLast:!1,extractAttachments:!1,includeRawContent:!1,ocr:!1,ocrLanguage:"eng",ocrConfig:VN,serializeRawContent:!0,preserveXmlWhitespace:!1,pdfWorkerSrc:qN,includeBreakNodes:!1,ignoreInternalLinks:!1,fileType:null,csvDelimiter:","},XN={standalone:!0,chartJsSrc:"https://cdn.jsdelivr.net/npm/chart.js"},YN={format:"A4",width:"",height:"",landscape:!1,printBackground:!0,scale:1,margin:{top:0,right:0,bottom:0,left:0},displayHeaderFooter:!1,headerTemplate:"",footerTemplate:"",launchOptions:{headless:!0,args:["--no-sandbox","--disable-setuid-sandbox"]}},KN={sheets:"",mergeSheets:!0,columnDelimiter:","},ZN={fallbackToHtml:!0},QN={newlineDelimiter:`
|
|
70
|
-
`,preserveLayout:!1},
|
|
70
|
+
`,preserveLayout:!1},rv={strategy:"fixed-size",chunkSize:1e3,chunkOverlap:200,separators:[`
|
|
71
71
|
|
|
72
72
|
`,`
|
|
73
|
-
`," ",""],stripWhitespace:!0,includeMetadata:!0,addStartIndex:!1,lengthFunction:r=>r.length,sentenceBoundaryRegex:Ob,abbreviations:Fb},Pb={strategy:"document-structure",splitBy:"paragraph",maxChunkSize:1e3,tableSplitStrategy:"row",stripWhitespace:!0,includeMetadata:!0,addStartIndex:!1,lengthFunction:r=>r.length,sentenceBoundaryRegex:Ob,abbreviations:Fb},iv={strategy:"semantic",similarityThreshold:.8,maxChunkSize:2e3,bufferSize:1,embeddingBatchSize:50,stripWhitespace:!0,includeMetadata:!0,addStartIndex:!1,lengthFunction:r=>r.length,sentenceBoundaryRegex:Ob,abbreviations:Fb},JN=Pb,rv={onNode:()=>{},onWarning:()=>{},styleMap:[],includeFormatting:!0,generateIds:!0,renderMetadata:!1,ignoreDefaultStyleMap:!1,includeImages:!0,includeCharts:!0,ignoreInternalLinks:!1,htmlConfig:XN,mdConfig:ZN,pdfConfig:YN,csvConfig:KN,textConfig:QN,rtfConfig:{},chunksConfig:JN};B();var sv=(p=>(p.EXTENSION_UNSUPPORTED="EXTENSION_UNSUPPORTED",p.FILE_CORRUPTED="FILE_CORRUPTED",p.FILE_DOES_NOT_EXIST="FILE_DOES_NOT_EXIST",p.LOCATION_NOT_FOUND="LOCATION_NOT_FOUND",p.IMPROPER_ARGUMENTS="IMPROPER_ARGUMENTS",p.IMPROPER_BUFFERS="IMPROPER_BUFFERS",p.INVALID_INPUT="INVALID_INPUT",p.PDF_WORKER_MISSING="PDF_WORKER_MISSING",p.FEATURE_NOT_SUPPORTED_IN_BROWSER="FEATURE_NOT_SUPPORTED_IN_BROWSER",p.INVALID_STYLE_MAPPING="INVALID_STYLE_MAPPING",p.INVALID_SELECTOR="INVALID_SELECTOR",p.INVALID_OUTPUT_MAPPING="INVALID_OUTPUT_MAPPING",p.MISSING_EMBEDDING_FUNCTION="MISSING_EMBEDDING_FUNCTION",p))(sv||{}),av=(y=>(y.PERFORMANCE_TIP="PERFORMANCE_TIP",y.OCR_FAILED="OCR_FAILED",y.CHART_DATA_EXTRACTION_FAILED="CHART_DATA_EXTRACTION_FAILED",y.PDF_WORKER_FALLBACK="PDF_WORKER_FALLBACK",y.ATTACHMENT_EXTRACTION_FAILED="ATTACHMENT_EXTRACTION_FAILED",y.PAGE_LOAD_FAILED="PAGE_LOAD_FAILED",y.DEPENDENCY_LOAD_FAILED="DEPENDENCY_LOAD_FAILED",y.IMAGE_EXTRACTION_FAILED="IMAGE_EXTRACTION_FAILED",y.ANNOTATION_EXTRACTION_FAILED="ANNOTATION_EXTRACTION_FAILED",y.IMAGE_PROCESSING_FAILED="IMAGE_PROCESSING_FAILED",y.BROWSER_GENERATION_LIMITATION="BROWSER_GENERATION_LIMITATION",y.SHEET_RANGE_NOT_FOUND="SHEET_RANGE_NOT_FOUND",y.BUFFER_TYPE_MISMATCH="BUFFER_TYPE_MISMATCH",y.EMPTY_CHUNK_GENERATED="EMPTY_CHUNK_GENERATED",y.WHITESPACE_NODE_SKIPPED="WHITESPACE_NODE_SKIPPED",y))(av||{});B();var Rb="[OfficeParser]: ",tI={EXTENSION_UNSUPPORTED:r=>`Sorry, OfficeParser currently supports docx, pptx, xlsx, odt, odp, ods, pdf, rtf, md, html, csv files only. Create a ticket in Issues on github to add support for ${r} files. Stay tuned for further updates.`,FILE_CORRUPTED:r=>`Your file ${r} seems to be corrupted. If you are sure it is fine, please create a ticket in Issues on github with the file to reproduce error.`,FILE_DOES_NOT_EXIST:r=>`File ${r} could not be found! Check if the file exists or verify if the relative path to the file is correct from your terminal's location.`,LOCATION_NOT_FOUND:r=>`Entered location ${r} is not reachable! Please make sure that the entered directory location exists. Check relative paths and reenter.`,IMPROPER_ARGUMENTS:"Improper arguments",IMPROPER_BUFFERS:"Error occured while reading the file buffers. If you are passing text-based formats like md, html, or csv as a Buffer, you must provide the 'fileType' hint in the configuration as they lack magic bytes for auto-detection.",INVALID_INPUT:"Invalid input type: Expected a Buffer or a valid file path",PDF_WORKER_MISSING:'Missing PDF worker configuration. PDF parsing in browser environments requires a worker source. Please provide "pdfWorkerSrc" in your configuration.',FEATURE_NOT_SUPPORTED_IN_BROWSER:r=>`'${r}' is not supported in the browser. Browser users must pass file content as Buffer or ArrayBuffer directly.`,INVALID_STYLE_MAPPING:r=>`Invalid style mapping string: ${r}`,INVALID_SELECTOR:r=>`Invalid selector: ${r}`,INVALID_OUTPUT_MAPPING:r=>`Invalid output mapping: ${r}`,MISSING_EMBEDDING_FUNCTION:'Semantic chunking requires an "embeddingFunction" to be provided in chunksConfig. This function must accept a string and return a Promise resolving to a number array (vector).'},ov={PERFORMANCE_TIP:r=>`\u26A1\uFE0F Performance Tip: ${r}`,OCR_FAILED:r=>`OCR failed for ${r}:`,CHART_DATA_EXTRACTION_FAILED:r=>`Failed to extract chart data from ${r}:`,PDF_WORKER_FALLBACK:"Could not auto-resolve local worker path, falling back to CDN:",ATTACHMENT_EXTRACTION_FAILED:"Error extracting embedded attachments:",PAGE_LOAD_FAILED:r=>`Error loading page ${r}:`,DEPENDENCY_LOAD_FAILED:r=>`Failed to load dependency ${r}:`,IMAGE_EXTRACTION_FAILED:r=>`Error extracting images ${r}:`,ANNOTATION_EXTRACTION_FAILED:r=>`Error extracting annotations from page ${r}:`,IMAGE_PROCESSING_FAILED:"Failed to extract from ImageBitmap:",BROWSER_GENERATION_LIMITATION:r=>r,SHEET_RANGE_NOT_FOUND:r=>`No sheets found matching the range: ${r}`,BUFFER_TYPE_MISMATCH:r=>`File content type mismatch: Detected '${r.detected}' but expected/provided '${r.expected}'. Parsing will proceed with '${r.expected}' as requested.`,EMPTY_CHUNK_GENERATED:r=>`No chunks generated for document. Check if the document content is compatible with the '${r}' strategy.`,WHITESPACE_NODE_SKIPPED:r=>`Skipped whitespace-only node of type: ${r}`},lv=(r,t)=>{let e=ov[r];return typeof e=="function"?e(t):e},cv=(r,t)=>{let e=tI[r];return typeof e=="function"?e(t):e},Lb=(r,t)=>{if(t?.onWarning)t.onWarning(r);else if(!t||t.outputErrorToConsole){let e=Rb+r.message;r.type==="error"?console.error(e,r.details||""):console.warn(e,r.details||"")}},hn=(r,t,e)=>{let n=cv(r,e);return Lb({type:"error",code:r,message:n,details:e},t),new Error(Rb+n)},uv=(r,t,e)=>{let n=r.message||r,i="FILE_CORRUPTED";e&&(n.includes("end of central directory record")||n.includes("invalid XML")||n.includes("Failed to open zip file")||n.includes("invalid distance too far back"))&&(n=cv("FILE_CORRUPTED",e));let s={type:"error",code:"FILE_CORRUPTED",message:n,details:e?{filePath:e,originalError:r}:r};return Lb(s,t),new Error(Rb+n)},Se=(r,t,e,n)=>{let i,s=e,a=ov[r];typeof a=="function"?(i=a(e),s=n||e):(i=a,e instanceof Error&&!n&&(s=e)),Lb({type:"warning",code:r,message:i,details:s},t)};B();B();function pg(r){if(r===null||typeof r!="object")return r;if(Array.isArray(r))return r.map(e=>pg(e));let t={};for(let e in r)Object.prototype.hasOwnProperty.call(r,e)&&(t[e]=pg(r[e]));return t}function eI(r){return!!(r&&typeof r=="object"&&"textConfig"in r&&"htmlConfig"in r&&"pdfConfig"in r&&"csvConfig"in r&&"onNode"in r)}function nI(r){return!!(r&&typeof r=="object"&&"ocrConfig"in r&&typeof r.ocrConfig=="object"&&"language"in r.ocrConfig&&"workerPath"in r.ocrConfig)}function hv(r){if(nI(r))return r;let t=pg(fg);if(!r)return t;let{ocrConfig:e,...n}=r;return Object.assign(t,n),e&&(t.ocrConfig={...t.ocrConfig,...e}),r.ocrLanguage&&!r.ocrConfig?.language&&(t.ocrConfig.language=r.ocrLanguage),t}function dv(r,t,e){if(eI(e)&&!t)return e;let n=pg(rv);if(e){let{htmlConfig:i,mdConfig:s,pdfConfig:a,csvConfig:l,textConfig:c,chunksConfig:u,...h}=e;Object.assign(n,h);let d=(f,p)=>{if(p)for(let m in p)p[m]!==void 0&&(f[m]=p[m])};i&&d(n.htmlConfig,i),s&&d(n.mdConfig,s),a&&d(n.pdfConfig,a),l&&d(n.csvConfig,l),c&&d(n.textConfig,c),u&&d(n.chunksConfig,u)}if(t){e?.onWarning===void 0&&(n.onWarning=t.onWarning||n.onWarning);let i=t.newlineDelimiter;i&&["text","md","rtf"].includes(r)&&r==="text"&&e?.textConfig?.newlineDelimiter===void 0&&(n.textConfig.newlineDelimiter=i)}return n}B();var iI=[{selector:{nodeType:"paragraph",attributes:{"style-name":"Heading 1"}},output:{tag:"h1"}},{selector:{nodeType:"paragraph",attributes:{"style-name":"Heading 2"}},output:{tag:"h2"}},{selector:{nodeType:"paragraph",attributes:{"style-name":"Heading 3"}},output:{tag:"h3"}},{selector:{nodeType:"paragraph",attributes:{"style-name":"Heading 4"}},output:{tag:"h4"}},{selector:{nodeType:"paragraph",attributes:{"style-name":"Heading 5"}},output:{tag:"h5"}},{selector:{nodeType:"paragraph",attributes:{"style-name":"Heading 6"}},output:{tag:"h6"}},{selector:{nodeType:"paragraph",attributes:{"style-name":"Title"}},output:{tag:"h1",classes:["title"]}},{selector:{nodeType:"paragraph",attributes:{"style-name":"Subtitle"}},output:{tag:"p",classes:["subtitle"]}},{selector:{nodeType:"paragraph",attributes:{"style-name":"Quote"}},output:{tag:"blockquote"}},{selector:{nodeType:"paragraph",attributes:{"style-name":"Intense Quote"}},output:{tag:"blockquote",classes:["intense"]}}],mg=class{constructor(t,e=!1){U(this,"mappings",[]);if(t)if(Array.isArray(t))for(let n of t)typeof n=="string"?this.mappings.push(this.parseMappingString(n)):this.mappings.push(this.convertStructuredMapping(n));else for(let[n,i]of Object.entries(t))this.mappings.push({selector:{attributes:{style:{value:n,operator:"="}}},output:{tag:i.tag||"div",classes:i.class?i.class.split(" "):[],attributes:{},fresh:!1}});e||this.mappings.push(...iI.map(n=>this.convertStructuredMapping(n)))}getMapping(t){for(let e of this.mappings)if(this.matches(t,e.selector))return e.output}matches(t,e){if(e.nodeType&&t.type!==e.nodeType)return!1;for(let[n,{value:i,operator:s,compiled:a}]of Object.entries(e.attributes)){let l=this.getNodeAttribute(t,n);if(l===void 0)return!1;if(s==="="){if(String(l)!==String(i))return!1}else if(s==="~="&&!(a||new RegExp(String(i))).test(String(l)))return!1}return!0}getNodeAttribute(t,e){if(e==="style"||e==="style-name")return t.metadata?.style||t.formatting?.font;if(t.metadata&&e in t.metadata)return t.metadata[e];if(t.formatting&&e in t.formatting)return t.formatting[e]}convertStructuredMapping(t){let e={};if(t.selector.attributes)for(let[n,i]of Object.entries(t.selector.attributes))if(typeof i=="object"&&i!==null&&"value"in i){let s=i.operator||"=";e[n]={value:i.value,operator:s,compiled:s==="~="?new RegExp(String(i.value)):void 0}}else e[n]={value:i,operator:"="};return{selector:{nodeType:t.selector.nodeType,attributes:e},output:{tag:t.output.tag,classes:t.output.classes||[],attributes:t.output.attributes||{},fresh:t.output.fresh||!1}}}parseMappingString(t){let e=t.lastIndexOf("=>");if(e===-1)throw hn("INVALID_STYLE_MAPPING",void 0,t);let n=t.substring(0,e).trim(),i=t.substring(e+2).trim(),s=n.match(/^([a-z]+)?(?:\[(.+?)\])?$/);if(!s)throw hn("INVALID_SELECTOR",void 0,n);let a={p:"paragraph",h:"heading",t:"table",tr:"row",td:"cell",li:"list",img:"image"},l=s[1]?a[s[1]]||s[1]:void 0,c=s[2],u={};if(c){let b=[],w="",C=!1;for(let E=0;E<c.length;E++){let S=c[E];(S==="'"||S==='"')&&(C=!C),S===","&&!C?(b.push(w.trim()),w=""):w+=S}w&&b.push(w.trim());for(let E of b){let S=E.match(/^([\w-]+)\s*(=|~=)\s*(?:(["'])(.*?)\3|(.+))$/);if(S){let N=S[2],k=S[4]!==void 0?S[4]:S[5];u[S[1]]={operator:N,value:k,compiled:N==="~="?new RegExp(k):void 0}}}}let h=i.split(":"),d=h.includes("fresh"),f=h[0],p=f.match(/^([a-z0-9]+)?((?:\.[\w-]+)*)(?:\[(.+?)\])?$/);if(!p)throw hn("INVALID_OUTPUT_MAPPING",void 0,f);let m=p[1]||"div",y=p[2]?p[2].split(".").filter(Boolean):[],x={};if(p[3]){let b=p[3].split(",").map(w=>w.trim());for(let w of b){let C=w.match(/^([\w-]+)\s*=\s*(?:(["'])(.*?)\2|(.+))$/);C&&(x[C[1]]=C[3]!==void 0?C[3]:C[4])}}return{selector:{nodeType:l,attributes:u},output:{tag:m,classes:y,attributes:x,fresh:d}}}};var qn=class{constructor(t,e,n){this.destination=t;U(this,"config");U(this,"ast");U(this,"messages",[]);U(this,"styleMapper");this.config=dv(t,e.config,n),this.ast=e,this.styleMapper=new mg(this.config.styleMap,this.config.ignoreDefaultStyleMap)}getSemanticMapping(t){if(this.config.includeFormatting!==!1)return this.styleMapper.getMapping(t)}async handleOnNode(t){let e=await this.config.onNode(t);if(e===!1)return!1;if(typeof e=="string")return e}async processNodeRecursive(t,e){let n=await this.handleOnNode(t);if(n===!1)return"";if(typeof n=="string")return n;let i="";if(t.children)for(let s of t.children)i+=await this.processNodeRecursive(s,e);return await e(t,i)}slugify(t){return t.toLowerCase().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}getNodeText(t){return t.text?t.text:t.children?t.children.map(e=>this.getNodeText(e)).join(""):""}warn(t,e,n){let i=lv(t,e),s={type:"warning",code:t,message:i,node:n,details:e};this.messages.push(s),this.config.onWarning(s)}};var gg=class extends qn{constructor(e,n){super("chunks",e,n);U(this,"chunkConfig");U(this,"isCustomRegex");this.chunkConfig=this.resolveChunkingConfig(this.config.chunksConfig),this.isCustomRegex=!!n?.chunksConfig?.sentenceBoundaryRegex}resolveChunkingConfig(e){switch(e?.strategy??"document-structure"){case"fixed-size":return{...nv,...e};case"semantic":return{...iv,...e};case"document-structure":return{...Pb,...e}}}async generate(){let e;switch(this.chunkConfig.strategy){case"fixed-size":e=await this.generateFixedSize(this.chunkConfig);break;case"semantic":e=await this.generateSemantic(this.chunkConfig);break;case"document-structure":e=await this.generateDocumentStructure(this.chunkConfig);break}return{value:e,messages:this.messages}}async generateFixedSize(e){let{chunkSize:n,chunkOverlap:i,separators:s,lengthFunction:a}=e,{text:l,nodeMap:c}=await this.buildFlatTextWithPositions();return this.splitTextRecursively(l,n,i,s,a).map(({text:h,start:d,end:f})=>{let p={text:h,metadata:{sourceType:this.ast.type}};return(e.includeMetadata??!0)&&this.enrichMetadataFromPosition(p,c,d),e.addStartIndex&&(p.startIndex=d,p.endIndex=f),p})}splitTextRecursively(e,n,i,s,a){if(a(e)<=n)return e.trim()?[{text:e,start:0,end:e.length}]:[];let l,c=[],u=[],h="",d=this.splitIntoSentences(e);if(d.length>1)u=d,h=" ",l="SENTENCE_SPLIT",c=s;else for(let x=0;x<s.length;x++){let b=s[x];if(u=b?e.split(b):[...e],u.length>1){l=b,h=b,c=s.slice(x+1);break}}if(l===void 0){let x=[],b=0;for(;b<e.length;){let w=e.slice(b,b+n);x.push({text:w,start:b,end:b+w.length}),b+=Math.max(1,n-i)}return x}let f=[],p="",m=0,y=0;for(let x=0;x<u.length;x++){let b=u[x],w=p?p+h+b:b;if(a(w)<=n)p=w;else{if(p.trim())if(a(p)>n){let C=this.splitTextRecursively(p,n,i,c,a);for(let E of C)f.push({text:E.text,start:m+E.start,end:m+E.end})}else f.push({text:p,start:m,end:m+p.length});if(i>0&&p.length>i&&a(p)<=n){let C=p.slice(-i);m=y-i,p=C+h+b}else m=y,p=b}y+=b.length+h.length}if(p.trim())if(a(p)>n){let x=this.splitTextRecursively(p,n,i,c,a);for(let b of x)f.push({text:b.text,start:m+b.start,end:m+b.end})}else f.push({text:p,start:m,end:m+p.length});return f}async generateDocumentStructure(e){let{splitBy:n,maxChunkSize:i,lengthFunction:s}=e,a=[],l={};for(let c of this.ast.content)await this.processNodeForStructure(c,e,n,i,s,a,l);return this.finalizeChunks(a,e)}async processNodeForStructure(e,n,i,s,a,l,c){let u=await this.handleOnNode(e);if(u===!1)return;if(e.type==="slide"){let p=e.metadata;c.slideNumber=p?.slideNumber}else if(e.type==="page"){let p=e.metadata;c.pageNumber=p?.pageNumber}else if(e.type==="sheet"){let p=e.metadata;c.sheetName=p?.sheetName}else e.type==="heading"&&(c.heading=e.text);let h=this.isStructuralBoundary(e,i);if(i==="slide"&&e.type==="slide"||i==="page"&&e.type==="page"||i==="sheet"&&e.type==="sheet"){if(e.children){let p=[];for(let m of e.children)await this.processNodeForStructure(m,n,"paragraph",s,a,p,c);for(let m of p)m.metadata.slideNumber=c.slideNumber,m.metadata.pageNumber=c.pageNumber,m.metadata.sheetName=c.sheetName,l.push(m)}return}if(e.type==="table"){await this.processTableNode(e,n,s,a,l,c);return}let f=e.type==="paragraph"||e.type==="heading"||e.type==="list"||e.type==="code"||e.type==="cell"||e.text&&(!e.children||e.children.length===0);if(h||f){let p=typeof u=="string"?u:e.text??"";if(!p.trim()&&!p.includes("\xA0")&&p.length>0){e.type!=="cell"&&this.warn("WHITESPACE_NODE_SKIPPED",e.type,e);return}e.type==="heading"&&(c.heading=p);let y={text:p,metadata:{sourceType:this.ast.type,closestHeading:c.heading,slideNumber:c.slideNumber,pageNumber:c.pageNumber,sheetName:c.sheetName}};if(a(p)>s){let x=this.splitTextRecursively(p,s,0,[`
|
|
73
|
+
`," ",""],stripWhitespace:!0,includeMetadata:!0,addStartIndex:!1,lengthFunction:r=>r.length,sentenceBoundaryRegex:Ob,abbreviations:Fb},Pb={strategy:"document-structure",splitBy:"paragraph",maxChunkSize:1e3,tableSplitStrategy:"row",stripWhitespace:!0,includeMetadata:!0,addStartIndex:!1,lengthFunction:r=>r.length,sentenceBoundaryRegex:Ob,abbreviations:Fb},sv={strategy:"semantic",similarityThreshold:.8,maxChunkSize:2e3,bufferSize:1,embeddingBatchSize:50,stripWhitespace:!0,includeMetadata:!0,addStartIndex:!1,lengthFunction:r=>r.length,sentenceBoundaryRegex:Ob,abbreviations:Fb},JN=Pb,av={onNode:()=>{},onWarning:()=>{},styleMap:[],includeFormatting:!0,generateIds:!0,renderMetadata:!1,ignoreDefaultStyleMap:!1,includeImages:!0,includeCharts:!0,ignoreInternalLinks:!1,htmlConfig:XN,mdConfig:ZN,pdfConfig:YN,csvConfig:KN,textConfig:QN,rtfConfig:{},chunksConfig:JN};B();var ov=(p=>(p.EXTENSION_UNSUPPORTED="EXTENSION_UNSUPPORTED",p.FILE_CORRUPTED="FILE_CORRUPTED",p.FILE_DOES_NOT_EXIST="FILE_DOES_NOT_EXIST",p.LOCATION_NOT_FOUND="LOCATION_NOT_FOUND",p.IMPROPER_ARGUMENTS="IMPROPER_ARGUMENTS",p.IMPROPER_BUFFERS="IMPROPER_BUFFERS",p.INVALID_INPUT="INVALID_INPUT",p.PDF_WORKER_MISSING="PDF_WORKER_MISSING",p.FEATURE_NOT_SUPPORTED_IN_BROWSER="FEATURE_NOT_SUPPORTED_IN_BROWSER",p.INVALID_STYLE_MAPPING="INVALID_STYLE_MAPPING",p.INVALID_SELECTOR="INVALID_SELECTOR",p.INVALID_OUTPUT_MAPPING="INVALID_OUTPUT_MAPPING",p.MISSING_EMBEDDING_FUNCTION="MISSING_EMBEDDING_FUNCTION",p))(ov||{}),lv=(x=>(x.PERFORMANCE_TIP="PERFORMANCE_TIP",x.OCR_FAILED="OCR_FAILED",x.CHART_DATA_EXTRACTION_FAILED="CHART_DATA_EXTRACTION_FAILED",x.PDF_WORKER_FALLBACK="PDF_WORKER_FALLBACK",x.ATTACHMENT_EXTRACTION_FAILED="ATTACHMENT_EXTRACTION_FAILED",x.PAGE_LOAD_FAILED="PAGE_LOAD_FAILED",x.DEPENDENCY_LOAD_FAILED="DEPENDENCY_LOAD_FAILED",x.IMAGE_EXTRACTION_FAILED="IMAGE_EXTRACTION_FAILED",x.ANNOTATION_EXTRACTION_FAILED="ANNOTATION_EXTRACTION_FAILED",x.IMAGE_PROCESSING_FAILED="IMAGE_PROCESSING_FAILED",x.BROWSER_GENERATION_LIMITATION="BROWSER_GENERATION_LIMITATION",x.SHEET_RANGE_NOT_FOUND="SHEET_RANGE_NOT_FOUND",x.BUFFER_TYPE_MISMATCH="BUFFER_TYPE_MISMATCH",x.FILE_TYPE_DETECTION_FAILED="FILE_TYPE_DETECTION_FAILED",x.EMPTY_CHUNK_GENERATED="EMPTY_CHUNK_GENERATED",x.WHITESPACE_NODE_SKIPPED="WHITESPACE_NODE_SKIPPED",x))(lv||{});B();var Rb="[OfficeParser]: ",tI={EXTENSION_UNSUPPORTED:r=>`Sorry, OfficeParser currently supports docx, pptx, xlsx, odt, odp, ods, pdf, rtf, md, html, csv files only. Create a ticket in Issues on github to add support for ${r} files. Stay tuned for further updates.`,FILE_CORRUPTED:r=>`Your file ${r} seems to be corrupted. If you are sure it is fine, please create a ticket in Issues on github with the file to reproduce error.`,FILE_DOES_NOT_EXIST:r=>`File ${r} could not be found! Check if the file exists or verify if the relative path to the file is correct from your terminal's location.`,LOCATION_NOT_FOUND:r=>`Entered location ${r} is not reachable! Please make sure that the entered directory location exists. Check relative paths and reenter.`,IMPROPER_ARGUMENTS:"Improper arguments",IMPROPER_BUFFERS:"Auto-detection of file type from buffer failed. This can happen if the format lacks magic bytes (like md, html, or csv) or if the detection library is incompatible with your Node.js version. Please provide the 'fileType' hint in your configuration (e.g., { fileType: 'docx' }) to proceed.",INVALID_INPUT:"Invalid input type: Expected a Buffer or a valid file path",PDF_WORKER_MISSING:'Missing PDF worker configuration. PDF parsing in browser environments requires a worker source. Please provide "pdfWorkerSrc" in your configuration.',FEATURE_NOT_SUPPORTED_IN_BROWSER:r=>`'${r}' is not supported in the browser. Browser users must pass file content as Buffer or ArrayBuffer directly.`,INVALID_STYLE_MAPPING:r=>`Invalid style mapping string: ${r}`,INVALID_SELECTOR:r=>`Invalid selector: ${r}`,INVALID_OUTPUT_MAPPING:r=>`Invalid output mapping: ${r}`,MISSING_EMBEDDING_FUNCTION:'Semantic chunking requires an "embeddingFunction" to be provided in chunksConfig. This function must accept a string and return a Promise resolving to a number array (vector).'},cv={PERFORMANCE_TIP:r=>`\u26A1\uFE0F Performance Tip: ${r}`,OCR_FAILED:r=>`OCR failed for ${r}:`,CHART_DATA_EXTRACTION_FAILED:r=>`Failed to extract chart data from ${r}:`,PDF_WORKER_FALLBACK:"Could not auto-resolve local worker path, falling back to CDN:",ATTACHMENT_EXTRACTION_FAILED:"Error extracting embedded attachments:",PAGE_LOAD_FAILED:r=>`Error loading page ${r}:`,DEPENDENCY_LOAD_FAILED:r=>`Failed to load dependency ${r}:`,IMAGE_EXTRACTION_FAILED:r=>`Error extracting images ${r}:`,ANNOTATION_EXTRACTION_FAILED:r=>`Error extracting annotations from page ${r}:`,IMAGE_PROCESSING_FAILED:"Failed to extract from ImageBitmap:",BROWSER_GENERATION_LIMITATION:r=>r,SHEET_RANGE_NOT_FOUND:r=>`No sheets found matching the range: ${r}`,BUFFER_TYPE_MISMATCH:r=>`File content type mismatch: Detected '${r.detected}' but expected/provided '${r.expected}'. Parsing will proceed with '${r.expected}' as requested.`,FILE_TYPE_DETECTION_FAILED:"Auto-detection of file type failed. This can happen on older Node.js versions with modern file-type versions. Please provide the 'fileType' hint in the configuration if parsing fails.",EMPTY_CHUNK_GENERATED:r=>`No chunks generated for document. Check if the document content is compatible with the '${r}' strategy.`,WHITESPACE_NODE_SKIPPED:r=>`Skipped whitespace-only node of type: ${r}`},uv=(r,t)=>{let e=cv[r];return typeof e=="function"?e(t):e},hv=(r,t)=>{let e=tI[r];return typeof e=="function"?e(t):e},Lb=(r,t)=>{if(t?.onWarning)t.onWarning(r);else if(!t||t.outputErrorToConsole){let e=Rb+r.message;r.type==="error"?console.error(e,r.details||""):console.warn(e,r.details||"")}},hn=(r,t,e)=>{let n=hv(r,e);return Lb({type:"error",code:r,message:n,details:e},t),new Error(Rb+n)},dv=(r,t,e)=>{let n=r.message||r,i="FILE_CORRUPTED";e&&(n.includes("end of central directory record")||n.includes("invalid XML")||n.includes("Failed to open zip file")||n.includes("invalid distance too far back"))&&(n=hv("FILE_CORRUPTED",e));let s={type:"error",code:"FILE_CORRUPTED",message:n,details:e?{filePath:e,originalError:r}:r};return Lb(s,t),new Error(Rb+n)},Ce=(r,t,e,n)=>{let i,s=e,a=cv[r];typeof a=="function"?(i=a(e),s=n||e):(i=a,e instanceof Error&&!n&&(s=e)),Lb({type:"warning",code:r,message:i,details:s},t)};B();B();function pg(r){if(r===null||typeof r!="object")return r;if(Array.isArray(r))return r.map(e=>pg(e));let t={};for(let e in r)Object.prototype.hasOwnProperty.call(r,e)&&(t[e]=pg(r[e]));return t}function eI(r){return!!(r&&typeof r=="object"&&"textConfig"in r&&"htmlConfig"in r&&"pdfConfig"in r&&"csvConfig"in r&&"onNode"in r)}function nI(r){return!!(r&&typeof r=="object"&&"ocrConfig"in r&&typeof r.ocrConfig=="object"&&"language"in r.ocrConfig&&"workerPath"in r.ocrConfig)}function fv(r){if(nI(r))return r;let t=pg(fg);if(!r)return t;let{ocrConfig:e,...n}=r;return Object.assign(t,n),e&&(t.ocrConfig={...t.ocrConfig,...e}),r.ocrLanguage&&!r.ocrConfig?.language&&(t.ocrConfig.language=r.ocrLanguage),t}function pv(r,t,e){if(eI(e)&&!t)return e;let n=pg(av);if(e){let{htmlConfig:i,mdConfig:s,pdfConfig:a,csvConfig:l,textConfig:c,chunksConfig:u,...h}=e;Object.assign(n,h);let d=(f,p)=>{if(p)for(let m in p)p[m]!==void 0&&(f[m]=p[m])};i&&d(n.htmlConfig,i),s&&d(n.mdConfig,s),a&&d(n.pdfConfig,a),l&&d(n.csvConfig,l),c&&d(n.textConfig,c),u&&d(n.chunksConfig,u)}if(t){e?.onWarning===void 0&&(n.onWarning=t.onWarning||n.onWarning);let i=t.newlineDelimiter;i&&["text","md","rtf"].includes(r)&&r==="text"&&e?.textConfig?.newlineDelimiter===void 0&&(n.textConfig.newlineDelimiter=i)}return n}B();var iI=[{selector:{nodeType:"paragraph",attributes:{"style-name":"Heading 1"}},output:{tag:"h1"}},{selector:{nodeType:"paragraph",attributes:{"style-name":"Heading 2"}},output:{tag:"h2"}},{selector:{nodeType:"paragraph",attributes:{"style-name":"Heading 3"}},output:{tag:"h3"}},{selector:{nodeType:"paragraph",attributes:{"style-name":"Heading 4"}},output:{tag:"h4"}},{selector:{nodeType:"paragraph",attributes:{"style-name":"Heading 5"}},output:{tag:"h5"}},{selector:{nodeType:"paragraph",attributes:{"style-name":"Heading 6"}},output:{tag:"h6"}},{selector:{nodeType:"paragraph",attributes:{"style-name":"Title"}},output:{tag:"h1",classes:["title"]}},{selector:{nodeType:"paragraph",attributes:{"style-name":"Subtitle"}},output:{tag:"p",classes:["subtitle"]}},{selector:{nodeType:"paragraph",attributes:{"style-name":"Quote"}},output:{tag:"blockquote"}},{selector:{nodeType:"paragraph",attributes:{"style-name":"Intense Quote"}},output:{tag:"blockquote",classes:["intense"]}}],mg=class{constructor(t,e=!1){U(this,"mappings",[]);if(t)if(Array.isArray(t))for(let n of t)typeof n=="string"?this.mappings.push(this.parseMappingString(n)):this.mappings.push(this.convertStructuredMapping(n));else for(let[n,i]of Object.entries(t))this.mappings.push({selector:{attributes:{style:{value:n,operator:"="}}},output:{tag:i.tag||"div",classes:i.class?i.class.split(" "):[],attributes:{},fresh:!1}});e||this.mappings.push(...iI.map(n=>this.convertStructuredMapping(n)))}getMapping(t){for(let e of this.mappings)if(this.matches(t,e.selector))return e.output}matches(t,e){if(e.nodeType&&t.type!==e.nodeType)return!1;for(let[n,{value:i,operator:s,compiled:a}]of Object.entries(e.attributes)){let l=this.getNodeAttribute(t,n);if(l===void 0)return!1;if(s==="="){if(String(l)!==String(i))return!1}else if(s==="~="&&!(a||new RegExp(String(i))).test(String(l)))return!1}return!0}getNodeAttribute(t,e){if(e==="style"||e==="style-name")return t.metadata?.style||t.formatting?.font;if(t.metadata&&e in t.metadata)return t.metadata[e];if(t.formatting&&e in t.formatting)return t.formatting[e]}convertStructuredMapping(t){let e={};if(t.selector.attributes)for(let[n,i]of Object.entries(t.selector.attributes))if(typeof i=="object"&&i!==null&&"value"in i){let s=i.operator||"=";e[n]={value:i.value,operator:s,compiled:s==="~="?new RegExp(String(i.value)):void 0}}else e[n]={value:i,operator:"="};return{selector:{nodeType:t.selector.nodeType,attributes:e},output:{tag:t.output.tag,classes:t.output.classes||[],attributes:t.output.attributes||{},fresh:t.output.fresh||!1}}}parseMappingString(t){let e=t.lastIndexOf("=>");if(e===-1)throw hn("INVALID_STYLE_MAPPING",void 0,t);let n=t.substring(0,e).trim(),i=t.substring(e+2).trim(),s=n.match(/^([a-z]+)?(?:\[(.+?)\])?$/);if(!s)throw hn("INVALID_SELECTOR",void 0,n);let a={p:"paragraph",h:"heading",t:"table",tr:"row",td:"cell",li:"list",img:"image"},l=s[1]?a[s[1]]||s[1]:void 0,c=s[2],u={};if(c){let b=[],w="",C=!1;for(let E=0;E<c.length;E++){let S=c[E];(S==="'"||S==='"')&&(C=!C),S===","&&!C?(b.push(w.trim()),w=""):w+=S}w&&b.push(w.trim());for(let E of b){let S=E.match(/^([\w-]+)\s*(=|~=)\s*(?:(["'])(.*?)\3|(.+))$/);if(S){let N=S[2],k=S[4]!==void 0?S[4]:S[5];u[S[1]]={operator:N,value:k,compiled:N==="~="?new RegExp(k):void 0}}}}let h=i.split(":"),d=h.includes("fresh"),f=h[0],p=f.match(/^([a-z0-9]+)?((?:\.[\w-]+)*)(?:\[(.+?)\])?$/);if(!p)throw hn("INVALID_OUTPUT_MAPPING",void 0,f);let m=p[1]||"div",y=p[2]?p[2].split(".").filter(Boolean):[],x={};if(p[3]){let b=p[3].split(",").map(w=>w.trim());for(let w of b){let C=w.match(/^([\w-]+)\s*=\s*(?:(["'])(.*?)\2|(.+))$/);C&&(x[C[1]]=C[3]!==void 0?C[3]:C[4])}}return{selector:{nodeType:l,attributes:u},output:{tag:m,classes:y,attributes:x,fresh:d}}}};var qn=class{constructor(t,e,n){this.destination=t;U(this,"config");U(this,"ast");U(this,"messages",[]);U(this,"styleMapper");this.config=pv(t,e.config,n),this.ast=e,this.styleMapper=new mg(this.config.styleMap,this.config.ignoreDefaultStyleMap)}getSemanticMapping(t){if(this.config.includeFormatting!==!1)return this.styleMapper.getMapping(t)}async handleOnNode(t){let e=await this.config.onNode(t);if(e===!1)return!1;if(typeof e=="string")return e}async processNodeRecursive(t,e){let n=await this.handleOnNode(t);if(n===!1)return"";if(typeof n=="string")return n;let i="";if(t.children)for(let s of t.children)i+=await this.processNodeRecursive(s,e);return await e(t,i)}slugify(t){return t.toLowerCase().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}getNodeText(t){return t.text?t.text:t.children?t.children.map(e=>this.getNodeText(e)).join(""):""}warn(t,e,n){let i=uv(t,e),s={type:"warning",code:t,message:i,node:n,details:e};this.messages.push(s),this.config.onWarning(s)}};var gg=class extends qn{constructor(e,n){super("chunks",e,n);U(this,"chunkConfig");U(this,"isCustomRegex");this.chunkConfig=this.resolveChunkingConfig(this.config.chunksConfig),this.isCustomRegex=!!n?.chunksConfig?.sentenceBoundaryRegex}resolveChunkingConfig(e){switch(e?.strategy??"document-structure"){case"fixed-size":return{...rv,...e};case"semantic":return{...sv,...e};case"document-structure":return{...Pb,...e}}}async generate(){let e;switch(this.chunkConfig.strategy){case"fixed-size":e=await this.generateFixedSize(this.chunkConfig);break;case"semantic":e=await this.generateSemantic(this.chunkConfig);break;case"document-structure":e=await this.generateDocumentStructure(this.chunkConfig);break}return{value:e,messages:this.messages}}async generateFixedSize(e){let{chunkSize:n,chunkOverlap:i,separators:s,lengthFunction:a}=e,{text:l,nodeMap:c}=await this.buildFlatTextWithPositions();return this.splitTextRecursively(l,n,i,s,a).map(({text:h,start:d,end:f})=>{let p={text:h,metadata:{sourceType:this.ast.type}};return(e.includeMetadata??!0)&&this.enrichMetadataFromPosition(p,c,d),e.addStartIndex&&(p.startIndex=d,p.endIndex=f),p})}splitTextRecursively(e,n,i,s,a){if(a(e)<=n)return e.trim()?[{text:e,start:0,end:e.length}]:[];let l,c=[],u=[],h="",d=this.splitIntoSentences(e);if(d.length>1)u=d,h=" ",l="SENTENCE_SPLIT",c=s;else for(let x=0;x<s.length;x++){let b=s[x];if(u=b?e.split(b):[...e],u.length>1){l=b,h=b,c=s.slice(x+1);break}}if(l===void 0){let x=[],b=0;for(;b<e.length;){let w=e.slice(b,b+n);x.push({text:w,start:b,end:b+w.length}),b+=Math.max(1,n-i)}return x}let f=[],p="",m=0,y=0;for(let x=0;x<u.length;x++){let b=u[x],w=p?p+h+b:b;if(a(w)<=n)p=w;else{if(p.trim())if(a(p)>n){let C=this.splitTextRecursively(p,n,i,c,a);for(let E of C)f.push({text:E.text,start:m+E.start,end:m+E.end})}else f.push({text:p,start:m,end:m+p.length});if(i>0&&p.length>i&&a(p)<=n){let C=p.slice(-i);m=y-i,p=C+h+b}else m=y,p=b}y+=b.length+h.length}if(p.trim())if(a(p)>n){let x=this.splitTextRecursively(p,n,i,c,a);for(let b of x)f.push({text:b.text,start:m+b.start,end:m+b.end})}else f.push({text:p,start:m,end:m+p.length});return f}async generateDocumentStructure(e){let{splitBy:n,maxChunkSize:i,lengthFunction:s}=e,a=[],l={};for(let c of this.ast.content)await this.processNodeForStructure(c,e,n,i,s,a,l);return this.finalizeChunks(a,e)}async processNodeForStructure(e,n,i,s,a,l,c){let u=await this.handleOnNode(e);if(u===!1)return;if(e.type==="slide"){let p=e.metadata;c.slideNumber=p?.slideNumber}else if(e.type==="page"){let p=e.metadata;c.pageNumber=p?.pageNumber}else if(e.type==="sheet"){let p=e.metadata;c.sheetName=p?.sheetName}else e.type==="heading"&&(c.heading=e.text);let h=this.isStructuralBoundary(e,i);if(i==="slide"&&e.type==="slide"||i==="page"&&e.type==="page"||i==="sheet"&&e.type==="sheet"){if(e.children){let p=[];for(let m of e.children)await this.processNodeForStructure(m,n,"paragraph",s,a,p,c);for(let m of p)m.metadata.slideNumber=c.slideNumber,m.metadata.pageNumber=c.pageNumber,m.metadata.sheetName=c.sheetName,l.push(m)}return}if(e.type==="table"){await this.processTableNode(e,n,s,a,l,c);return}let f=e.type==="paragraph"||e.type==="heading"||e.type==="list"||e.type==="code"||e.type==="cell"||e.text&&(!e.children||e.children.length===0);if(h||f){let p=typeof u=="string"?u:e.text??"";if(!p.trim()&&!p.includes("\xA0")&&p.length>0){e.type!=="cell"&&this.warn("WHITESPACE_NODE_SKIPPED",e.type,e);return}e.type==="heading"&&(c.heading=p);let y={text:p,metadata:{sourceType:this.ast.type,closestHeading:c.heading,slideNumber:c.slideNumber,pageNumber:c.pageNumber,sheetName:c.sheetName}};if(a(p)>s){let x=this.splitTextRecursively(p,s,0,[`
|
|
74
74
|
|
|
75
75
|
`,`
|
|
76
76
|
`," ",""],a);for(let b of x)l.push({...y,text:b.text})}else l.push(y);return}if(e.children)for(let p of e.children)await this.processNodeForStructure(p,n,i,s,a,l,c)}isStructuralBoundary(e,n){return n==="heading"?e.type==="heading":n==="paragraph"?e.type==="paragraph"||e.type==="heading"||e.type==="cell":!1}async processTableNode(e,n,i,s,a,l){if(n.tableSplitStrategy==="flatten"||!e.children||e.children.length===0){let b=e.text??"";if(!b.trim())return;a.push({text:b,metadata:{sourceType:this.ast.type,closestHeading:l.heading,slideNumber:l.slideNumber,pageNumber:l.pageNumber,sheetName:l.sheetName}});return}let u=e.children,h=[],d=[];if(u.length>0){let b=u[0];await this.handleOnNode(b)!==!1&&h.push(b);for(let C=1;C<u.length;C++)d.push(u[C])}let f=await this.renderRowsAsText(h),p={sourceType:this.ast.type,closestHeading:l.heading,slideNumber:l.slideNumber,pageNumber:l.pageNumber,sheetName:l.sheetName,isTableChunk:!0},m=[],y=f?s(f):0,x=async()=>{if(m.length===0)return;let b=await this.renderRowsAsText(m),w=f?`${f}
|
|
@@ -79,9 +79,9 @@ ${b}`:b;if(w.trim())if(s(w)>i){let C=this.splitTextRecursively(w,i,0,[`
|
|
|
79
79
|
${w}`:w;a.push({text:S,metadata:{...p}});continue}m.push(b),y+=E}await x()}async renderRowsAsText(e){let n=[];for(let i of e){let s=await this.handleOnNode(i);if(s===!1)continue;if(typeof s=="string"){n.push(s);continue}if(!i.children){n.push(i.text??"");continue}let a=i.children.map(l=>(l.text??"").replace(/\n/g," ").trim());n.push(`| ${a.join(" | ")} |`)}return n.join(`
|
|
80
80
|
`)}async generateSemantic(e){let{similarityThreshold:n,maxChunkSize:i,bufferSize:s,lengthFunction:a,embeddingBatchSize:l}=e;if(typeof e.embeddingFunction!="function")throw hn("MISSING_EMBEDDING_FUNCTION",this.config);let c=await this.extractSentences();if(c.length===0)return[];let u=await this.batchEmbeddings(c,e.embeddingFunction,l),h=[],d=[],f=0;for(let p=0;p<c.length;p++){let m=c[p].text;d.push(c[p]),f+=a(m);let y=p===c.length-1,x=f>i,b=y||x;if(!b&&p<c.length-1){let w=Math.min(p+s,c.length-1),C=p+1,E=Math.min(p+1+s,c.length-1),S=this.averageEmbeddings(u.slice(Math.max(0,p-s+1),w+1)),N=this.averageEmbeddings(u.slice(C,E+1));this.cosineSimilarity(S,N)<n&&(b=!0)}if(b&&d.length>0){let w=d.map(S=>S.text).join(" "),C=d[0],E={sourceType:this.ast.type,closestHeading:C.closestHeading,slideNumber:C.slideNumber,pageNumber:C.pageNumber,sheetName:C.sheetName};if(a(w)>i){let S=this.splitTextRecursively(w,i,0,[`
|
|
81
81
|
`," ",""],a);for(let N of S)h.push({text:N.text,metadata:{...E}})}else h.push({text:w,metadata:E});d=[],f=0}}return this.finalizeChunks(h,e)}async extractSentences(){let e=[],n,i,s,a,l=async c=>{let u=await this.handleOnNode(c);if(u===!1)return;if(c.type==="heading"&&(n=c.text),c.type==="slide"&&(i=c.metadata?.slideNumber),c.type==="page"&&(s=c.metadata?.pageNumber),c.type==="sheet"&&(a=c.metadata?.sheetName),c.type==="paragraph"||c.type==="heading"||c.type==="list"||c.type==="cell"||c.text&&(!c.children||c.children.length===0)){let d=(typeof u=="string"?u:c.text??"").trim();if(!d)return;let f=this.splitIntoSentences(d);for(let p of f)p.trim()&&e.push({text:p.trim(),closestHeading:n,slideNumber:i,pageNumber:s,sheetName:a});return}if(c.children)for(let d of c.children)await l(d)};for(let c of this.ast.content)await l(c);return e}async buildFlatTextWithPositions(){let e=[],n=[],i=0,s,a,l,c,u=async h=>{let d=await this.handleOnNode(h);if(d===!1)return;if(h.type==="heading"&&(s=h.text),h.type==="slide"&&(a=h.metadata?.slideNumber),h.type==="page"&&(l=h.metadata?.pageNumber),h.type==="sheet"&&(c=h.metadata?.sheetName),h.type==="paragraph"||h.type==="heading"||h.type==="list"||h.type==="code"||h.type==="cell"||h.text&&(!h.children||h.children.length===0)){let m=(typeof d=="string"?d:h.text||"")+`
|
|
82
|
-
`;n.push({offset:i,heading:s,slideNumber:a,pageNumber:l,sheetName:c}),e.push(m),i+=m.length;return}if(h.children)for(let p of h.children)await u(p)};for(let h of this.ast.content)await u(h);return{text:e.join(""),nodeMap:n}}enrichMetadataFromPosition(e,n,i){let s=n[0];for(let a of n)if(a.offset<=i)s=a;else break;s&&(e.metadata.closestHeading=s.heading,e.metadata.slideNumber=s.slideNumber,e.metadata.pageNumber=s.pageNumber,e.metadata.sheetName=s.sheetName)}finalizeChunks(e,n){return e.length===0&&this.warn("EMPTY_CHUNK_GENERATED",this.chunkConfig.strategy),e.map(i=>{let a={text:n.stripWhitespace!==!1?i.text.trim():i.text,metadata:{sourceType:this.ast.type}};return n.includeMetadata!==!1&&(a.metadata=i.metadata),a}).filter(i=>i.text.length>0)}async batchEmbeddings(e,n,i=50){let s=[];for(let a=0;a<e.length;a+=i){let l=e.slice(a,a+i),c=await Promise.all(l.map(u=>n(u.text)));s.push(...c)}return s}cosineSimilarity(e,n){if(e.length!==n.length||e.length===0)return 0;let i=0,s=0,a=0;for(let c=0;c<e.length;c++)i+=e[c]*n[c],s+=e[c]*e[c],a+=n[c]*n[c];let l=Math.sqrt(s)*Math.sqrt(a);return l===0?0:i/l}averageEmbeddings(e){if(e.length===0)return[];let n=e[0].length,i=new Array(n).fill(0);for(let s of e)for(let a=0;a<n;a++)i[a]+=s[a];return i.map(s=>s/e.length)}splitIntoSentences(e){if(this.isCustomRegex){let c=this.chunkConfig.sentenceBoundaryRegex,u=typeof c=="string"?new RegExp(c,"g"):c;return e.split(u).map(h=>h.trim()).filter(Boolean)}let n=this.chunkConfig.abbreviations,i=[],s=0,a=/[.!?。!?]/g,l;for(;(l=a.exec(e))!==null;){let c=l[0],u=l.index,h=e[u+1],d=u===e.length-1,f=!h||/\s/.test(h),p=/[。!?]/.test(c);if(f||p){if(c==="."){let m=e.lastIndexOf(" ",u-1),y=e.substring(m+1,u);if(y=y.replace(/^[^\w]+|[^\w]+$/g,""),n.includes(y))continue}i.push(e.substring(s,u+1).trim()),s=u+1}}if(s<e.length){let c=e.substring(s).trim();c&&i.push(c)}return i.length>0?i:[e]}};B();B();var fv={},rI=(function(r,t,e,n,i){var s=new Worker(fv[t]||(fv[t]=URL.createObjectURL(new Blob([r+';addEventListener("error",function(e){e=e.error;postMessage({$e$:[e.message,e.code,e.stack]})})'],{type:"text/javascript"}))));return s.onmessage=function(a){var l=a.data,c=l.$e$;if(c){var u=new Error(c[0]);u.code=c[1],u.stack=c[2],i(u,null)}else i(null,l)},s.postMessage(e,n),s}),De=Uint8Array,fi=Uint16Array,vg=Int32Array,Gd=new De([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Hd=new De([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),wg=new De([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),vv=function(r,t){for(var e=new fi(31),n=0;n<31;++n)e[n]=t+=1<<r[n-1];for(var i=new vg(e[30]),n=1;n<30;++n)for(var s=e[n];s<e[n+1];++s)i[s]=s-e[n]<<5|n;return{b:e,r:i}},Cv=vv(Gd,2),Hb=Cv.b,$b=Cv.r;Hb[28]=258,$b[258]=28;var Ev=vv(Hd,0),Tv=Ev.b,pv=Ev.r,Ag=new fi(32768);for(ae=0;ae<32768;++ae)Hs=(ae&43690)>>1|(ae&21845)<<1,Hs=(Hs&52428)>>2|(Hs&13107)<<2,Hs=(Hs&61680)>>4|(Hs&3855)<<4,Ag[ae]=((Hs&65280)>>8|(Hs&255)<<8)>>1;var Hs,ae,kr=(function(r,t,e){for(var n=r.length,i=0,s=new fi(t);i<n;++i)r[i]&&++s[r[i]-1];var a=new fi(t);for(i=1;i<t;++i)a[i]=a[i-1]+s[i-1]<<1;var l;if(e){l=new fi(1<<t);var c=15-t;for(i=0;i<n;++i)if(r[i])for(var u=i<<4|r[i],h=t-r[i],d=a[r[i]-1]++<<h,f=d|(1<<h)-1;d<=f;++d)l[Ag[d]>>c]=u}else for(l=new fi(n),i=0;i<n;++i)r[i]&&(l[i]=Ag[a[r[i]-1]++]>>15-r[i]);return l}),Ya=new De(288);for(ae=0;ae<144;++ae)Ya[ae]=8;var ae;for(ae=144;ae<256;++ae)Ya[ae]=9;var ae;for(ae=256;ae<280;++ae)Ya[ae]=7;var ae;for(ae=280;ae<288;++ae)Ya[ae]=8;var ae,jd=new De(32);for(ae=0;ae<32;++ae)jd[ae]=5;var ae,sI=kr(Ya,9,0),Sv=kr(Ya,9,1),aI=kr(jd,5,0),Dv=kr(jd,5,1),bg=function(r){for(var t=r[0],e=1;e<r.length;++e)r[e]>t&&(t=r[e]);return t},ir=function(r,t,e){var n=t/8|0;return(r[n]|r[n+1]<<8)>>(t&7)&e},xg=function(r,t){var e=t/8|0;return(r[e]|r[e+1]<<8|r[e+2]<<16)>>(t&7)},Cg=function(r){return(r+7)/8|0},uu=function(r,t,e){return(t==null||t<0)&&(t=0),(e==null||e>r.length)&&(e=r.length),new De(r.subarray(t,e))};var Nv=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],wn=function(r,t,e){var n=new Error(t||Nv[r]);if(n.code=r,Error.captureStackTrace&&Error.captureStackTrace(n,wn),!e)throw n;return n},Iv=function(r,t,e,n){var i=r.length,s=n?n.length:0;if(!i||t.f&&!t.l)return e||new De(0);var a=!e,l=a||t.i!=2,c=t.i;a&&(e=new De(i*3));var u=function(at){var ft=e.length;if(at>ft){var J=new De(Math.max(ft*2,at));J.set(e),e=J}},h=t.f||0,d=t.p||0,f=t.b||0,p=t.l,m=t.d,y=t.m,x=t.n,b=i*8;do{if(!p){h=ir(r,d,1);var w=ir(r,d+1,3);if(d+=3,w)if(w==1)p=Sv,m=Dv,y=9,x=5;else if(w==2){var N=ir(r,d,31)+257,k=ir(r,d+10,15)+4,M=N+ir(r,d+5,31)+1;d+=14;for(var R=new De(M),j=new De(19),$=0;$<k;++$)j[wg[$]]=ir(r,d+$*3,7);d+=k*3;for(var q=bg(j),Q=(1<<q)-1,Z=kr(j,q,1),$=0;$<M;){var Y=Z[ir(r,d,Q)];d+=Y&15;var C=Y>>4;if(C<16)R[$++]=C;else{var X=0,T=0;for(C==16?(T=3+ir(r,d,3),d+=2,X=R[$-1]):C==17?(T=3+ir(r,d,7),d+=3):C==18&&(T=11+ir(r,d,127),d+=7);T--;)R[$++]=X}}var I=R.subarray(0,N),_=R.subarray(N);y=bg(I),x=bg(_),p=kr(I,y,1),m=kr(_,x,1)}else wn(1);else{var C=Cg(d)+4,E=r[C-4]|r[C-3]<<8,S=C+E;if(S>i){c&&wn(0);break}l&&u(f+E),e.set(r.subarray(C,S),f),t.b=f+=E,t.p=d=S*8,t.f=h;continue}if(d>b){c&&wn(0);break}}l&&u(f+131072);for(var W=(1<<y)-1,z=(1<<x)-1,D=d;;D=d){var X=p[xg(r,d)&W],F=X>>4;if(d+=X&15,d>b){c&&wn(0);break}if(X||wn(2),F<256)e[f++]=F;else if(F==256){D=d,p=null;break}else{var P=F-254;if(F>264){var $=F-257,G=Gd[$];P=ir(r,d,(1<<G)-1)+Hb[$],d+=G}var H=m[xg(r,d)&z],V=H>>4;H||wn(3),d+=H&15;var _=Tv[V];if(V>3){var G=Hd[V];_+=xg(r,d)&(1<<G)-1,d+=G}if(d>b){c&&wn(0);break}l&&u(f+131072);var L=f+P;if(f<_){var tt=s-_,rt=Math.min(_,L);for(tt+f<0&&wn(3);f<rt;++f)e[f]=n[tt+f]}for(;f<L;++f)e[f]=e[f-_]}}t.l=p,t.p=D,t.b=f,t.f=h,p&&(h=1,t.m=y,t.d=m,t.n=x)}while(!h);return f!=e.length&&a?uu(e,0,f):e.subarray(0,f)},Ws=function(r,t,e){e<<=t&7;var n=t/8|0;r[n]|=e,r[n+1]|=e>>8},$d=function(r,t,e){e<<=t&7;var n=t/8|0;r[n]|=e,r[n+1]|=e>>8,r[n+2]|=e>>16},Bb=function(r,t){for(var e=[],n=0;n<r.length;++n)r[n]&&e.push({s:n,f:r[n]});var i=e.length,s=e.slice();if(!i)return{t:_v,l:0};if(i==1){var a=new De(e[0].s+1);return a[e[0].s]=1,{t:a,l:1}}e.sort(function(S,N){return S.f-N.f}),e.push({s:-1,f:25001});var l=e[0],c=e[1],u=0,h=1,d=2;for(e[0]={s:-1,f:l.f+c.f,l,r:c};h!=i-1;)l=e[e[u].f<e[d].f?u++:d++],c=e[u!=h&&e[u].f<e[d].f?u++:d++],e[h++]={s:-1,f:l.f+c.f,l,r:c};for(var f=s[0].s,n=1;n<i;++n)s[n].s>f&&(f=s[n].s);var p=new fi(f+1),m=zb(e[h-1],p,0);if(m>t){var n=0,y=0,x=m-t,b=1<<x;for(s.sort(function(N,k){return p[k.s]-p[N.s]||N.f-k.f});n<i;++n){var w=s[n].s;if(p[w]>t)y+=b-(1<<m-p[w]),p[w]=t;else break}for(y>>=x;y>0;){var C=s[n].s;p[C]<t?y-=1<<t-p[C]++-1:++n}for(;n>=0&&y;--n){var E=s[n].s;p[E]==t&&(--p[E],++y)}m=t}return{t:new De(p),l:m}},zb=function(r,t,e){return r.s==-1?Math.max(zb(r.l,t,e+1),zb(r.r,t,e+1)):t[r.s]=e},mv=function(r){for(var t=r.length;t&&!r[--t];);for(var e=new fi(++t),n=0,i=r[0],s=1,a=function(c){e[n++]=c},l=1;l<=t;++l)if(r[l]==i&&l!=t)++s;else{if(!i&&s>2){for(;s>138;s-=138)a(32754);s>2&&(a(s>10?s-11<<5|28690:s-3<<5|12305),s=0)}else if(s>3){for(a(i),--s;s>6;s-=6)a(8304);s>2&&(a(s-3<<5|8208),s=0)}for(;s--;)a(i);s=1,i=r[l]}return{c:e.subarray(0,n),n:t}},zd=function(r,t){for(var e=0,n=0;n<t.length;++n)e+=r[n]*t[n];return e},kv=function(r,t,e){var n=e.length,i=Cg(t+2);r[i]=n&255,r[i+1]=n>>8,r[i+2]=r[i]^255,r[i+3]=r[i+1]^255;for(var s=0;s<n;++s)r[i+s+4]=e[s];return(i+4+n)*8},gv=function(r,t,e,n,i,s,a,l,c,u,h){Ws(t,h++,e),++i[256];for(var d=Bb(i,15),f=d.t,p=d.l,m=Bb(s,15),y=m.t,x=m.l,b=mv(f),w=b.c,C=b.n,E=mv(y),S=E.c,N=E.n,k=new fi(19),M=0;M<w.length;++M)++k[w[M]&31];for(var M=0;M<S.length;++M)++k[S[M]&31];for(var R=Bb(k,7),j=R.t,$=R.l,q=19;q>4&&!j[wg[q-1]];--q);var Q=u+5<<3,Z=zd(i,Ya)+zd(s,jd)+a,Y=zd(i,f)+zd(s,y)+a+14+3*q+zd(k,j)+2*k[16]+3*k[17]+7*k[18];if(c>=0&&Q<=Z&&Q<=Y)return kv(t,h,r.subarray(c,c+u));var X,T,I,_;if(Ws(t,h,1+(Y<Z)),h+=2,Y<Z){X=kr(f,p,0),T=f,I=kr(y,x,0),_=y;var W=kr(j,$,0);Ws(t,h,C-257),Ws(t,h+5,N-1),Ws(t,h+10,q-4),h+=14;for(var M=0;M<q;++M)Ws(t,h+3*M,j[wg[M]]);h+=3*q;for(var z=[w,S],D=0;D<2;++D)for(var F=z[D],M=0;M<F.length;++M){var P=F[M]&31;Ws(t,h,W[P]),h+=j[P],P>15&&(Ws(t,h,F[M]>>5&127),h+=F[M]>>12)}}else X=sI,T=Ya,I=aI,_=jd;for(var M=0;M<l;++M){var G=n[M];if(G>255){var P=G>>18&31;$d(t,h,X[P+257]),h+=T[P+257],P>7&&(Ws(t,h,G>>23&31),h+=Gd[P]);var H=G&31;$d(t,h,I[H]),h+=_[H],H>3&&($d(t,h,G>>5&8191),h+=Hd[H])}else $d(t,h,X[G]),h+=T[G]}return $d(t,h,X[256]),h+T[256]},oI=new vg([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),_v=new De(0),lI=function(r,t,e,n,i,s){var a=s.z||r.length,l=new De(n+a+5*(1+Math.ceil(a/7e3))+i),c=l.subarray(n,l.length-i),u=s.l,h=(s.r||0)&7;if(t){h&&(c[0]=s.r>>3);for(var d=oI[t-1],f=d>>13,p=d&8191,m=(1<<e)-1,y=s.p||new fi(32768),x=s.h||new fi(m+1),b=Math.ceil(e/3),w=2*b,C=function(st){return(r[st]^r[st+1]<<b^r[st+2]<<w)&m},E=new vg(25e3),S=new fi(288),N=new fi(32),k=0,M=0,R=s.i||0,j=0,$=s.w||0,q=0;R+2<a;++R){var Q=C(R),Z=R&32767,Y=x[Q];if(y[Z]=Y,x[Q]=Z,$<=R){var X=a-R;if((k>7e3||j>24576)&&(X>423||!u)){h=gv(r,c,0,E,S,N,M,j,q,R-q,h),j=k=M=0,q=R;for(var T=0;T<286;++T)S[T]=0;for(var T=0;T<30;++T)N[T]=0}var I=2,_=0,W=p,z=Z-Y&32767;if(X>2&&Q==C(R-z))for(var D=Math.min(f,X)-1,F=Math.min(32767,R),P=Math.min(258,X);z<=F&&--W&&Z!=Y;){if(r[R+I]==r[R+I-z]){for(var G=0;G<P&&r[R+G]==r[R+G-z];++G);if(G>I){if(I=G,_=z,G>D)break;for(var H=Math.min(z,G-2),V=0,T=0;T<H;++T){var L=R-z+T&32767,tt=y[L],rt=L-tt&32767;rt>V&&(V=rt,Y=L)}}}Z=Y,Y=y[Z],z+=Z-Y&32767}if(_){E[j++]=268435456|$b[I]<<18|pv[_];var at=$b[I]&31,ft=pv[_]&31;M+=Gd[at]+Hd[ft],++S[257+at],++N[ft],$=R+I,++k}else E[j++]=r[R],++S[r[R]]}}for(R=Math.max(R,$);R<a;++R)E[j++]=r[R],++S[r[R]];h=gv(r,c,u,E,S,N,M,j,q,R-q,h),u||(s.r=h&7|c[h/8|0]<<3,h-=7,s.h=x,s.p=y,s.i=R,s.w=$)}else{for(var R=s.w||0;R<a+u;R+=65535){var J=R+65535;J>=a&&(c[h/8|0]=u,J=a),h=kv(c,h+1,r.subarray(R,J))}s.i=a}return uu(l,0,n+Cg(h)+i)},cI=(function(){for(var r=new Int32Array(256),t=0;t<256;++t){for(var e=t,n=9;--n;)e=(e&1&&-306674912)^e>>>1;r[t]=e}return r})(),uI=function(){var r=-1;return{p:function(t){for(var e=r,n=0;n<t.length;++n)e=cI[e&255^t[n]]^e>>>8;r=e},d:function(){return~r}}};var hI=function(r,t,e,n,i){if(!i&&(i={l:1},t.dictionary)){var s=t.dictionary.subarray(-32768),a=new De(s.length+r.length);a.set(s),a.set(r,s.length),r=a,i.w=s.length}return lI(r,t.level==null?6:t.level,t.mem==null?i.l?Math.ceil(Math.max(8,Math.min(13,Math.log(r.length)))*1.5):20:12+t.mem,e,n,i)},Wb=function(r,t){var e={};for(var n in r)e[n]=r[n];for(var n in t)e[n]=t[n];return e},yv=function(r,t,e){for(var n=r(),i=r.toString(),s=i.slice(i.indexOf("[")+1,i.lastIndexOf("]")).replace(/\s+/g,"").split(","),a=0;a<n.length;++a){var l=n[a],c=s[a];if(typeof l=="function"){t+=";"+c+"=";var u=l.toString();if(l.prototype)if(u.indexOf("[native code]")!=-1){var h=u.indexOf(" ",8)+1;t+=u.slice(h,u.indexOf("(",h))}else{t+=u;for(var d in l.prototype)t+=";"+c+".prototype."+d+"="+l.prototype[d].toString()}else t+=u}else e[c]=l}return t},yg=[],dI=function(r){var t=[];for(var e in r)r[e].buffer&&t.push((r[e]=new r[e].constructor(r[e])).buffer);return t},fI=function(r,t,e,n){if(!yg[e]){for(var i="",s={},a=r.length-1,l=0;l<a;++l)i=yv(r[l],i,s);yg[e]={c:yv(r[a],i,s),e:s}}var c=Wb({},yg[e].e);return rI(yg[e].c+";onmessage=function(e){for(var k in e.data)self[k]=e.data[k];onmessage="+t.toString()+"}",e,c,dI(c),n)},pI=function(){return[De,fi,vg,Gd,Hd,wg,Hb,Tv,Sv,Dv,Ag,Nv,kr,bg,ir,xg,Cg,uu,wn,Iv,qb,Mv,Ov]};var Mv=function(r){return postMessage(r,[r.buffer])},Ov=function(r){return r&&{out:r.size&&new De(r.size),dictionary:r.dictionary}},mI=function(r,t,e,n,i,s){var a=fI(e,n,i,function(l,c){a.terminate(),s(l,c)});return a.postMessage([r,t],t.consume?[r.buffer]:[]),function(){a.terminate()}};var rs=function(r,t){return r[t]|r[t+1]<<8},Ir=function(r,t){return(r[t]|r[t+1]<<8|r[t+2]<<16|r[t+3]<<24)>>>0},Ub=function(r,t){return Ir(r,t)+Ir(r,t+4)*4294967296},Mn=function(r,t,e){for(;e;++t)r[t]=e,e>>>=8};function gI(r,t){return hI(r,t||{},0,0)}function yI(r,t,e){return e||(e=t,t={}),typeof e!="function"&&wn(7),mI(r,t,[pI],function(n){return Mv(qb(n.data[0],Ov(n.data[1])))},1,e)}function qb(r,t){return Iv(r,{i:2},t&&t.out,t&&t.dictionary)}var Fv=function(r,t,e,n){for(var i in r){var s=r[i],a=t+i,l=n;Array.isArray(s)&&(l=Wb(n,s[1]),s=s[0]),s instanceof De?e[a]=[s,l]:(e[a+="/"]=[new De(0),l],Fv(s,a,e,n))}},bv=typeof TextEncoder<"u"&&new TextEncoder,jb=typeof TextDecoder<"u"&&new TextDecoder,bI=0;try{jb.decode(_v,{stream:!0}),bI=1}catch{}var xI=function(r){for(var t="",e=0;;){var n=r[e++],i=(n>127)+(n>223)+(n>239);if(e+i>r.length)return{s:t,r:uu(r,e-1)};i?i==3?(n=((n&15)<<18|(r[e++]&63)<<12|(r[e++]&63)<<6|r[e++]&63)-65536,t+=String.fromCharCode(55296|n>>10,56320|n&1023)):i&1?t+=String.fromCharCode((n&31)<<6|r[e++]&63):t+=String.fromCharCode((n&15)<<12|(r[e++]&63)<<6|r[e++]&63):t+=String.fromCharCode(n)}};function xv(r,t){if(t){for(var e=new De(r.length),n=0;n<r.length;++n)e[n]=r.charCodeAt(n);return e}if(bv)return bv.encode(r);for(var i=r.length,s=new De(r.length+(r.length>>1)),a=0,l=function(h){s[a++]=h},n=0;n<i;++n){if(a+5>s.length){var c=new De(a+8+(i-n<<1));c.set(s),s=c}var u=r.charCodeAt(n);u<128||t?l(u):u<2048?(l(192|u>>6),l(128|u&63)):u>55295&&u<57344?(u=65536+(u&1047552)|r.charCodeAt(++n)&1023,l(240|u>>18),l(128|u>>12&63),l(128|u>>6&63),l(128|u&63)):(l(224|u>>12),l(128|u>>6&63),l(128|u&63))}return uu(s,0,a)}function wI(r,t){if(t){for(var e="",n=0;n<r.length;n+=16384)e+=String.fromCharCode.apply(null,r.subarray(n,n+16384));return e}else{if(jb)return jb.decode(r);var i=xI(r),s=i.s,e=i.r;return e.length&&wn(8),s}}var AI=function(r,t){return t+30+rs(r,t+26)+rs(r,t+28)},vI=function(r,t,e){var n=rs(r,t+28),i=wI(r.subarray(t+46,t+46+n),!(rs(r,t+8)&2048)),s=t+46+n,a=Ir(r,t+20),l=e&&a==4294967295?CI(r,s):[a,Ir(r,t+24),Ir(r,t+42)],c=l[0],u=l[1],h=l[2];return[rs(r,t+10),c,u,i,s+rs(r,t+30)+rs(r,t+32),h]},CI=function(r,t){for(;rs(r,t)!=1;t+=4+rs(r,t+2));return[Ub(r,t+12),Ub(r,t+4),Ub(r,t+20)]},Gb=function(r){var t=0;if(r)for(var e in r){var n=r[e].length;n>65535&&wn(9),t+=n+4}return t},wv=function(r,t,e,n,i,s,a,l){var c=n.length,u=e.extra,h=l&&l.length,d=Gb(u);Mn(r,t,a!=null?33639248:67324752),t+=4,a!=null&&(r[t++]=20,r[t++]=e.os),r[t]=20,t+=2,r[t++]=e.flag<<1|(s<0&&8),r[t++]=i&&8,r[t++]=e.compression&255,r[t++]=e.compression>>8;var f=new Date(e.mtime==null?Date.now():e.mtime),p=f.getFullYear()-1980;if((p<0||p>119)&&wn(10),Mn(r,t,p<<25|f.getMonth()+1<<21|f.getDate()<<16|f.getHours()<<11|f.getMinutes()<<5|f.getSeconds()>>1),t+=4,s!=-1&&(Mn(r,t,e.crc),Mn(r,t+4,s<0?-s-2:s),Mn(r,t+8,e.size)),Mn(r,t+12,c),Mn(r,t+14,d),t+=16,a!=null&&(Mn(r,t,h),Mn(r,t+6,e.attrs),Mn(r,t+10,a),t+=14),r.set(n,t),t+=c,d)for(var m in u){var y=u[m],x=y.length;Mn(r,t,+m),Mn(r,t+2,x),r.set(y,t+4),t+=4+x}return h&&(r.set(l,t),t+=h),t},EI=function(r,t,e,n,i){Mn(r,t,101010256),Mn(r,t+8,e),Mn(r,t+10,e),Mn(r,t+12,n),Mn(r,t+16,i)};function Pv(r,t){t||(t={});var e={},n=[];Fv(r,"",e,t);var i=0,s=0;for(var a in e){var l=e[a],c=l[0],u=l[1],h=u.level==0?0:8,d=xv(a),f=d.length,p=u.comment,m=p&&xv(p),y=m&&m.length,x=Gb(u.extra);f>65535&&wn(11);var b=h?gI(c,u):c,w=b.length,C=uI();C.p(c),n.push(Wb(u,{size:c.length,crc:C.d(),c:b,f:d,m,u:f!=a.length||m&&p.length!=y,o:i,compression:h})),i+=30+f+x+w,s+=76+2*(f+x)+(y||0)+w}for(var E=new De(s+22),S=i,N=s-i,k=0;k<n.length;++k){var d=n[k];wv(E,d.o,d,d.f,d.u,d.c.length);var M=30+d.f.length+Gb(d.extra);E.set(d.c,d.o+M),wv(E,i,d,d.f,d.u,d.c.length,d.o,d.m),i+=16+M+(d.m?d.m.length:0)}return EI(E,i,n.length,N,S),E}var Av=typeof queueMicrotask=="function"?queueMicrotask:typeof setTimeout=="function"?setTimeout:function(r){r()};function Rv(r,t,e){e||(e=t,t={}),typeof e!="function"&&wn(7);var n=[],i=function(){for(var x=0;x<n.length;++x)n[x]()},s={},a=function(x,b){Av(function(){e(x,b)})};Av(function(){a=e});for(var l=r.length-22;Ir(r,l)!=101010256;--l)if(!l||r.length-l>65558)return a(wn(13,0,1),null),i;var c=rs(r,l+8);if(c){var u=c,h=Ir(r,l+16),d=h==4294967295||u==65535;if(d){var f=Ir(r,l-12);d=Ir(r,f)==101075792,d&&(u=c=Ir(r,f+32),h=Ir(r,f+48))}for(var p=t&&t.filter,m=function(x){var b=vI(r,h,d),w=b[0],C=b[1],E=b[2],S=b[3],N=b[4],k=b[5],M=AI(r,k);h=N;var R=function($,q){$?(i(),a($,null)):(q&&(s[S]=q),--c||a(null,s))};if(!p||p({name:S,size:C,originalSize:E,compression:w}))if(!w)R(null,uu(r,M,M+C));else if(w==8){var j=r.subarray(M,M+C);if(E<524288||C>.8*E)try{R(null,qb(j,{out:new De(E)}))}catch($){R($,null)}else n.push(yI(j,{size:E},R))}else R(wn(14,"unknown compression type "+w,1),null);else R(null,null)},y=0;y<u;++y)m(y)}else a(null,{});return i}B();function Lv(r){let t=new Set,e=r.split(",");for(let n of e){let i=n.trim();if(i.includes("-")){let[s,a]=i.split("-"),l=parseInt(s,10),c=parseInt(a,10);if(!isNaN(l)&&!isNaN(c)){let u=Math.min(l,c),h=Math.max(l,c);for(let d=u;d<=h;d++)t.add(d)}}else{let s=parseInt(i,10);isNaN(s)||t.add(s)}}return Array.from(t).sort((n,i)=>n-i)}var Eg=class extends qn{constructor(t,e){super("csv",t,e)}async generate(){let t=this.config.csvConfig,e=t.columnDelimiter,n=t.mergeSheets,i=await this.collectSheetLikeNodes(this.ast.content);if(i.length===0)return{value:"",messages:this.messages};let s=this.config.renderMetadata?this.renderMetadata(this.ast):"",a=i;if(t.sheets&&(a=Lv(t.sheets).filter(h=>h>0&&h<=i.length).map(h=>i[h-1])),a.length===0)return this.warn("SHEET_RANGE_NOT_FOUND",t.sheets),{value:"",messages:this.messages};let l=[],c=0;for(let u=0;u<a.length;u++){let h=a[u],d=h.metadata?.sheetName||`Sheet${u+1}`,f=await this.renderNodeToRows(h),p=Math.max(...f.map(m=>m.length),0);n&&(c=Math.max(c,p)),l.push({name:d,rows:f})}if(n){let u=[];s&&u.push(s.trim());for(let h of l){l.length>1&&u.push(`# Sheet: ${h.name}`);for(let d of h.rows){let f=[...d];if(d.length>1||d.length===1&&!d[0].startsWith("#"))for(;f.length<c;)f.push("");u.push(f.map(p=>this.escapeCsvValue(p,e)).join(e))}u.push("")}return{value:u.join(`
|
|
82
|
+
`;n.push({offset:i,heading:s,slideNumber:a,pageNumber:l,sheetName:c}),e.push(m),i+=m.length;return}if(h.children)for(let p of h.children)await u(p)};for(let h of this.ast.content)await u(h);return{text:e.join(""),nodeMap:n}}enrichMetadataFromPosition(e,n,i){let s=n[0];for(let a of n)if(a.offset<=i)s=a;else break;s&&(e.metadata.closestHeading=s.heading,e.metadata.slideNumber=s.slideNumber,e.metadata.pageNumber=s.pageNumber,e.metadata.sheetName=s.sheetName)}finalizeChunks(e,n){return e.length===0&&this.warn("EMPTY_CHUNK_GENERATED",this.chunkConfig.strategy),e.map(i=>{let a={text:n.stripWhitespace!==!1?i.text.trim():i.text,metadata:{sourceType:this.ast.type}};return n.includeMetadata!==!1&&(a.metadata=i.metadata),a}).filter(i=>i.text.length>0)}async batchEmbeddings(e,n,i=50){let s=[];for(let a=0;a<e.length;a+=i){let l=e.slice(a,a+i),c=await Promise.all(l.map(u=>n(u.text)));s.push(...c)}return s}cosineSimilarity(e,n){if(e.length!==n.length||e.length===0)return 0;let i=0,s=0,a=0;for(let c=0;c<e.length;c++)i+=e[c]*n[c],s+=e[c]*e[c],a+=n[c]*n[c];let l=Math.sqrt(s)*Math.sqrt(a);return l===0?0:i/l}averageEmbeddings(e){if(e.length===0)return[];let n=e[0].length,i=new Array(n).fill(0);for(let s of e)for(let a=0;a<n;a++)i[a]+=s[a];return i.map(s=>s/e.length)}splitIntoSentences(e){if(this.isCustomRegex){let c=this.chunkConfig.sentenceBoundaryRegex,u=typeof c=="string"?new RegExp(c,"g"):c;return e.split(u).map(h=>h.trim()).filter(Boolean)}let n=this.chunkConfig.abbreviations,i=[],s=0,a=/[.!?。!?]/g,l;for(;(l=a.exec(e))!==null;){let c=l[0],u=l.index,h=e[u+1],d=u===e.length-1,f=!h||/\s/.test(h),p=/[。!?]/.test(c);if(f||p){if(c==="."){let m=e.lastIndexOf(" ",u-1),y=e.substring(m+1,u);if(y=y.replace(/^[^\w]+|[^\w]+$/g,""),n.includes(y))continue}i.push(e.substring(s,u+1).trim()),s=u+1}}if(s<e.length){let c=e.substring(s).trim();c&&i.push(c)}return i.length>0?i:[e]}};B();B();var mv={},rI=(function(r,t,e,n,i){var s=new Worker(mv[t]||(mv[t]=URL.createObjectURL(new Blob([r+';addEventListener("error",function(e){e=e.error;postMessage({$e$:[e.message,e.code,e.stack]})})'],{type:"text/javascript"}))));return s.onmessage=function(a){var l=a.data,c=l.$e$;if(c){var u=new Error(c[0]);u.code=c[1],u.stack=c[2],i(u,null)}else i(null,l)},s.postMessage(e,n),s}),De=Uint8Array,fi=Uint16Array,vg=Int32Array,Gd=new De([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Hd=new De([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),wg=new De([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Ev=function(r,t){for(var e=new fi(31),n=0;n<31;++n)e[n]=t+=1<<r[n-1];for(var i=new vg(e[30]),n=1;n<30;++n)for(var s=e[n];s<e[n+1];++s)i[s]=s-e[n]<<5|n;return{b:e,r:i}},Tv=Ev(Gd,2),Hb=Tv.b,$b=Tv.r;Hb[28]=258,$b[258]=28;var Sv=Ev(Hd,0),Dv=Sv.b,gv=Sv.r,Ag=new fi(32768);for(ae=0;ae<32768;++ae)Hs=(ae&43690)>>1|(ae&21845)<<1,Hs=(Hs&52428)>>2|(Hs&13107)<<2,Hs=(Hs&61680)>>4|(Hs&3855)<<4,Ag[ae]=((Hs&65280)>>8|(Hs&255)<<8)>>1;var Hs,ae,kr=(function(r,t,e){for(var n=r.length,i=0,s=new fi(t);i<n;++i)r[i]&&++s[r[i]-1];var a=new fi(t);for(i=1;i<t;++i)a[i]=a[i-1]+s[i-1]<<1;var l;if(e){l=new fi(1<<t);var c=15-t;for(i=0;i<n;++i)if(r[i])for(var u=i<<4|r[i],h=t-r[i],d=a[r[i]-1]++<<h,f=d|(1<<h)-1;d<=f;++d)l[Ag[d]>>c]=u}else for(l=new fi(n),i=0;i<n;++i)r[i]&&(l[i]=Ag[a[r[i]-1]++]>>15-r[i]);return l}),Ya=new De(288);for(ae=0;ae<144;++ae)Ya[ae]=8;var ae;for(ae=144;ae<256;++ae)Ya[ae]=9;var ae;for(ae=256;ae<280;++ae)Ya[ae]=7;var ae;for(ae=280;ae<288;++ae)Ya[ae]=8;var ae,jd=new De(32);for(ae=0;ae<32;++ae)jd[ae]=5;var ae,sI=kr(Ya,9,0),Nv=kr(Ya,9,1),aI=kr(jd,5,0),Iv=kr(jd,5,1),bg=function(r){for(var t=r[0],e=1;e<r.length;++e)r[e]>t&&(t=r[e]);return t},ir=function(r,t,e){var n=t/8|0;return(r[n]|r[n+1]<<8)>>(t&7)&e},xg=function(r,t){var e=t/8|0;return(r[e]|r[e+1]<<8|r[e+2]<<16)>>(t&7)},Cg=function(r){return(r+7)/8|0},uu=function(r,t,e){return(t==null||t<0)&&(t=0),(e==null||e>r.length)&&(e=r.length),new De(r.subarray(t,e))};var kv=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],wn=function(r,t,e){var n=new Error(t||kv[r]);if(n.code=r,Error.captureStackTrace&&Error.captureStackTrace(n,wn),!e)throw n;return n},_v=function(r,t,e,n){var i=r.length,s=n?n.length:0;if(!i||t.f&&!t.l)return e||new De(0);var a=!e,l=a||t.i!=2,c=t.i;a&&(e=new De(i*3));var u=function(at){var ft=e.length;if(at>ft){var J=new De(Math.max(ft*2,at));J.set(e),e=J}},h=t.f||0,d=t.p||0,f=t.b||0,p=t.l,m=t.d,y=t.m,x=t.n,b=i*8;do{if(!p){h=ir(r,d,1);var w=ir(r,d+1,3);if(d+=3,w)if(w==1)p=Nv,m=Iv,y=9,x=5;else if(w==2){var N=ir(r,d,31)+257,k=ir(r,d+10,15)+4,M=N+ir(r,d+5,31)+1;d+=14;for(var R=new De(M),j=new De(19),$=0;$<k;++$)j[wg[$]]=ir(r,d+$*3,7);d+=k*3;for(var q=bg(j),Q=(1<<q)-1,Z=kr(j,q,1),$=0;$<M;){var Y=Z[ir(r,d,Q)];d+=Y&15;var C=Y>>4;if(C<16)R[$++]=C;else{var X=0,T=0;for(C==16?(T=3+ir(r,d,3),d+=2,X=R[$-1]):C==17?(T=3+ir(r,d,7),d+=3):C==18&&(T=11+ir(r,d,127),d+=7);T--;)R[$++]=X}}var I=R.subarray(0,N),_=R.subarray(N);y=bg(I),x=bg(_),p=kr(I,y,1),m=kr(_,x,1)}else wn(1);else{var C=Cg(d)+4,E=r[C-4]|r[C-3]<<8,S=C+E;if(S>i){c&&wn(0);break}l&&u(f+E),e.set(r.subarray(C,S),f),t.b=f+=E,t.p=d=S*8,t.f=h;continue}if(d>b){c&&wn(0);break}}l&&u(f+131072);for(var W=(1<<y)-1,z=(1<<x)-1,D=d;;D=d){var X=p[xg(r,d)&W],F=X>>4;if(d+=X&15,d>b){c&&wn(0);break}if(X||wn(2),F<256)e[f++]=F;else if(F==256){D=d,p=null;break}else{var P=F-254;if(F>264){var $=F-257,G=Gd[$];P=ir(r,d,(1<<G)-1)+Hb[$],d+=G}var H=m[xg(r,d)&z],V=H>>4;H||wn(3),d+=H&15;var _=Dv[V];if(V>3){var G=Hd[V];_+=xg(r,d)&(1<<G)-1,d+=G}if(d>b){c&&wn(0);break}l&&u(f+131072);var L=f+P;if(f<_){var tt=s-_,rt=Math.min(_,L);for(tt+f<0&&wn(3);f<rt;++f)e[f]=n[tt+f]}for(;f<L;++f)e[f]=e[f-_]}}t.l=p,t.p=D,t.b=f,t.f=h,p&&(h=1,t.m=y,t.d=m,t.n=x)}while(!h);return f!=e.length&&a?uu(e,0,f):e.subarray(0,f)},Ws=function(r,t,e){e<<=t&7;var n=t/8|0;r[n]|=e,r[n+1]|=e>>8},$d=function(r,t,e){e<<=t&7;var n=t/8|0;r[n]|=e,r[n+1]|=e>>8,r[n+2]|=e>>16},Bb=function(r,t){for(var e=[],n=0;n<r.length;++n)r[n]&&e.push({s:n,f:r[n]});var i=e.length,s=e.slice();if(!i)return{t:Ov,l:0};if(i==1){var a=new De(e[0].s+1);return a[e[0].s]=1,{t:a,l:1}}e.sort(function(S,N){return S.f-N.f}),e.push({s:-1,f:25001});var l=e[0],c=e[1],u=0,h=1,d=2;for(e[0]={s:-1,f:l.f+c.f,l,r:c};h!=i-1;)l=e[e[u].f<e[d].f?u++:d++],c=e[u!=h&&e[u].f<e[d].f?u++:d++],e[h++]={s:-1,f:l.f+c.f,l,r:c};for(var f=s[0].s,n=1;n<i;++n)s[n].s>f&&(f=s[n].s);var p=new fi(f+1),m=zb(e[h-1],p,0);if(m>t){var n=0,y=0,x=m-t,b=1<<x;for(s.sort(function(N,k){return p[k.s]-p[N.s]||N.f-k.f});n<i;++n){var w=s[n].s;if(p[w]>t)y+=b-(1<<m-p[w]),p[w]=t;else break}for(y>>=x;y>0;){var C=s[n].s;p[C]<t?y-=1<<t-p[C]++-1:++n}for(;n>=0&&y;--n){var E=s[n].s;p[E]==t&&(--p[E],++y)}m=t}return{t:new De(p),l:m}},zb=function(r,t,e){return r.s==-1?Math.max(zb(r.l,t,e+1),zb(r.r,t,e+1)):t[r.s]=e},yv=function(r){for(var t=r.length;t&&!r[--t];);for(var e=new fi(++t),n=0,i=r[0],s=1,a=function(c){e[n++]=c},l=1;l<=t;++l)if(r[l]==i&&l!=t)++s;else{if(!i&&s>2){for(;s>138;s-=138)a(32754);s>2&&(a(s>10?s-11<<5|28690:s-3<<5|12305),s=0)}else if(s>3){for(a(i),--s;s>6;s-=6)a(8304);s>2&&(a(s-3<<5|8208),s=0)}for(;s--;)a(i);s=1,i=r[l]}return{c:e.subarray(0,n),n:t}},zd=function(r,t){for(var e=0,n=0;n<t.length;++n)e+=r[n]*t[n];return e},Mv=function(r,t,e){var n=e.length,i=Cg(t+2);r[i]=n&255,r[i+1]=n>>8,r[i+2]=r[i]^255,r[i+3]=r[i+1]^255;for(var s=0;s<n;++s)r[i+s+4]=e[s];return(i+4+n)*8},bv=function(r,t,e,n,i,s,a,l,c,u,h){Ws(t,h++,e),++i[256];for(var d=Bb(i,15),f=d.t,p=d.l,m=Bb(s,15),y=m.t,x=m.l,b=yv(f),w=b.c,C=b.n,E=yv(y),S=E.c,N=E.n,k=new fi(19),M=0;M<w.length;++M)++k[w[M]&31];for(var M=0;M<S.length;++M)++k[S[M]&31];for(var R=Bb(k,7),j=R.t,$=R.l,q=19;q>4&&!j[wg[q-1]];--q);var Q=u+5<<3,Z=zd(i,Ya)+zd(s,jd)+a,Y=zd(i,f)+zd(s,y)+a+14+3*q+zd(k,j)+2*k[16]+3*k[17]+7*k[18];if(c>=0&&Q<=Z&&Q<=Y)return Mv(t,h,r.subarray(c,c+u));var X,T,I,_;if(Ws(t,h,1+(Y<Z)),h+=2,Y<Z){X=kr(f,p,0),T=f,I=kr(y,x,0),_=y;var W=kr(j,$,0);Ws(t,h,C-257),Ws(t,h+5,N-1),Ws(t,h+10,q-4),h+=14;for(var M=0;M<q;++M)Ws(t,h+3*M,j[wg[M]]);h+=3*q;for(var z=[w,S],D=0;D<2;++D)for(var F=z[D],M=0;M<F.length;++M){var P=F[M]&31;Ws(t,h,W[P]),h+=j[P],P>15&&(Ws(t,h,F[M]>>5&127),h+=F[M]>>12)}}else X=sI,T=Ya,I=aI,_=jd;for(var M=0;M<l;++M){var G=n[M];if(G>255){var P=G>>18&31;$d(t,h,X[P+257]),h+=T[P+257],P>7&&(Ws(t,h,G>>23&31),h+=Gd[P]);var H=G&31;$d(t,h,I[H]),h+=_[H],H>3&&($d(t,h,G>>5&8191),h+=Hd[H])}else $d(t,h,X[G]),h+=T[G]}return $d(t,h,X[256]),h+T[256]},oI=new vg([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Ov=new De(0),lI=function(r,t,e,n,i,s){var a=s.z||r.length,l=new De(n+a+5*(1+Math.ceil(a/7e3))+i),c=l.subarray(n,l.length-i),u=s.l,h=(s.r||0)&7;if(t){h&&(c[0]=s.r>>3);for(var d=oI[t-1],f=d>>13,p=d&8191,m=(1<<e)-1,y=s.p||new fi(32768),x=s.h||new fi(m+1),b=Math.ceil(e/3),w=2*b,C=function(st){return(r[st]^r[st+1]<<b^r[st+2]<<w)&m},E=new vg(25e3),S=new fi(288),N=new fi(32),k=0,M=0,R=s.i||0,j=0,$=s.w||0,q=0;R+2<a;++R){var Q=C(R),Z=R&32767,Y=x[Q];if(y[Z]=Y,x[Q]=Z,$<=R){var X=a-R;if((k>7e3||j>24576)&&(X>423||!u)){h=bv(r,c,0,E,S,N,M,j,q,R-q,h),j=k=M=0,q=R;for(var T=0;T<286;++T)S[T]=0;for(var T=0;T<30;++T)N[T]=0}var I=2,_=0,W=p,z=Z-Y&32767;if(X>2&&Q==C(R-z))for(var D=Math.min(f,X)-1,F=Math.min(32767,R),P=Math.min(258,X);z<=F&&--W&&Z!=Y;){if(r[R+I]==r[R+I-z]){for(var G=0;G<P&&r[R+G]==r[R+G-z];++G);if(G>I){if(I=G,_=z,G>D)break;for(var H=Math.min(z,G-2),V=0,T=0;T<H;++T){var L=R-z+T&32767,tt=y[L],rt=L-tt&32767;rt>V&&(V=rt,Y=L)}}}Z=Y,Y=y[Z],z+=Z-Y&32767}if(_){E[j++]=268435456|$b[I]<<18|gv[_];var at=$b[I]&31,ft=gv[_]&31;M+=Gd[at]+Hd[ft],++S[257+at],++N[ft],$=R+I,++k}else E[j++]=r[R],++S[r[R]]}}for(R=Math.max(R,$);R<a;++R)E[j++]=r[R],++S[r[R]];h=bv(r,c,u,E,S,N,M,j,q,R-q,h),u||(s.r=h&7|c[h/8|0]<<3,h-=7,s.h=x,s.p=y,s.i=R,s.w=$)}else{for(var R=s.w||0;R<a+u;R+=65535){var J=R+65535;J>=a&&(c[h/8|0]=u,J=a),h=Mv(c,h+1,r.subarray(R,J))}s.i=a}return uu(l,0,n+Cg(h)+i)},cI=(function(){for(var r=new Int32Array(256),t=0;t<256;++t){for(var e=t,n=9;--n;)e=(e&1&&-306674912)^e>>>1;r[t]=e}return r})(),uI=function(){var r=-1;return{p:function(t){for(var e=r,n=0;n<t.length;++n)e=cI[e&255^t[n]]^e>>>8;r=e},d:function(){return~r}}};var hI=function(r,t,e,n,i){if(!i&&(i={l:1},t.dictionary)){var s=t.dictionary.subarray(-32768),a=new De(s.length+r.length);a.set(s),a.set(r,s.length),r=a,i.w=s.length}return lI(r,t.level==null?6:t.level,t.mem==null?i.l?Math.ceil(Math.max(8,Math.min(13,Math.log(r.length)))*1.5):20:12+t.mem,e,n,i)},Wb=function(r,t){var e={};for(var n in r)e[n]=r[n];for(var n in t)e[n]=t[n];return e},xv=function(r,t,e){for(var n=r(),i=r.toString(),s=i.slice(i.indexOf("[")+1,i.lastIndexOf("]")).replace(/\s+/g,"").split(","),a=0;a<n.length;++a){var l=n[a],c=s[a];if(typeof l=="function"){t+=";"+c+"=";var u=l.toString();if(l.prototype)if(u.indexOf("[native code]")!=-1){var h=u.indexOf(" ",8)+1;t+=u.slice(h,u.indexOf("(",h))}else{t+=u;for(var d in l.prototype)t+=";"+c+".prototype."+d+"="+l.prototype[d].toString()}else t+=u}else e[c]=l}return t},yg=[],dI=function(r){var t=[];for(var e in r)r[e].buffer&&t.push((r[e]=new r[e].constructor(r[e])).buffer);return t},fI=function(r,t,e,n){if(!yg[e]){for(var i="",s={},a=r.length-1,l=0;l<a;++l)i=xv(r[l],i,s);yg[e]={c:xv(r[a],i,s),e:s}}var c=Wb({},yg[e].e);return rI(yg[e].c+";onmessage=function(e){for(var k in e.data)self[k]=e.data[k];onmessage="+t.toString()+"}",e,c,dI(c),n)},pI=function(){return[De,fi,vg,Gd,Hd,wg,Hb,Dv,Nv,Iv,Ag,kv,kr,bg,ir,xg,Cg,uu,wn,_v,qb,Fv,Pv]};var Fv=function(r){return postMessage(r,[r.buffer])},Pv=function(r){return r&&{out:r.size&&new De(r.size),dictionary:r.dictionary}},mI=function(r,t,e,n,i,s){var a=fI(e,n,i,function(l,c){a.terminate(),s(l,c)});return a.postMessage([r,t],t.consume?[r.buffer]:[]),function(){a.terminate()}};var rs=function(r,t){return r[t]|r[t+1]<<8},Ir=function(r,t){return(r[t]|r[t+1]<<8|r[t+2]<<16|r[t+3]<<24)>>>0},Ub=function(r,t){return Ir(r,t)+Ir(r,t+4)*4294967296},Mn=function(r,t,e){for(;e;++t)r[t]=e,e>>>=8};function gI(r,t){return hI(r,t||{},0,0)}function yI(r,t,e){return e||(e=t,t={}),typeof e!="function"&&wn(7),mI(r,t,[pI],function(n){return Fv(qb(n.data[0],Pv(n.data[1])))},1,e)}function qb(r,t){return _v(r,{i:2},t&&t.out,t&&t.dictionary)}var Rv=function(r,t,e,n){for(var i in r){var s=r[i],a=t+i,l=n;Array.isArray(s)&&(l=Wb(n,s[1]),s=s[0]),s instanceof De?e[a]=[s,l]:(e[a+="/"]=[new De(0),l],Rv(s,a,e,n))}},wv=typeof TextEncoder<"u"&&new TextEncoder,jb=typeof TextDecoder<"u"&&new TextDecoder,bI=0;try{jb.decode(Ov,{stream:!0}),bI=1}catch{}var xI=function(r){for(var t="",e=0;;){var n=r[e++],i=(n>127)+(n>223)+(n>239);if(e+i>r.length)return{s:t,r:uu(r,e-1)};i?i==3?(n=((n&15)<<18|(r[e++]&63)<<12|(r[e++]&63)<<6|r[e++]&63)-65536,t+=String.fromCharCode(55296|n>>10,56320|n&1023)):i&1?t+=String.fromCharCode((n&31)<<6|r[e++]&63):t+=String.fromCharCode((n&15)<<12|(r[e++]&63)<<6|r[e++]&63):t+=String.fromCharCode(n)}};function Av(r,t){if(t){for(var e=new De(r.length),n=0;n<r.length;++n)e[n]=r.charCodeAt(n);return e}if(wv)return wv.encode(r);for(var i=r.length,s=new De(r.length+(r.length>>1)),a=0,l=function(h){s[a++]=h},n=0;n<i;++n){if(a+5>s.length){var c=new De(a+8+(i-n<<1));c.set(s),s=c}var u=r.charCodeAt(n);u<128||t?l(u):u<2048?(l(192|u>>6),l(128|u&63)):u>55295&&u<57344?(u=65536+(u&1047552)|r.charCodeAt(++n)&1023,l(240|u>>18),l(128|u>>12&63),l(128|u>>6&63),l(128|u&63)):(l(224|u>>12),l(128|u>>6&63),l(128|u&63))}return uu(s,0,a)}function wI(r,t){if(t){for(var e="",n=0;n<r.length;n+=16384)e+=String.fromCharCode.apply(null,r.subarray(n,n+16384));return e}else{if(jb)return jb.decode(r);var i=xI(r),s=i.s,e=i.r;return e.length&&wn(8),s}}var AI=function(r,t){return t+30+rs(r,t+26)+rs(r,t+28)},vI=function(r,t,e){var n=rs(r,t+28),i=wI(r.subarray(t+46,t+46+n),!(rs(r,t+8)&2048)),s=t+46+n,a=Ir(r,t+20),l=e&&a==4294967295?CI(r,s):[a,Ir(r,t+24),Ir(r,t+42)],c=l[0],u=l[1],h=l[2];return[rs(r,t+10),c,u,i,s+rs(r,t+30)+rs(r,t+32),h]},CI=function(r,t){for(;rs(r,t)!=1;t+=4+rs(r,t+2));return[Ub(r,t+12),Ub(r,t+4),Ub(r,t+20)]},Gb=function(r){var t=0;if(r)for(var e in r){var n=r[e].length;n>65535&&wn(9),t+=n+4}return t},vv=function(r,t,e,n,i,s,a,l){var c=n.length,u=e.extra,h=l&&l.length,d=Gb(u);Mn(r,t,a!=null?33639248:67324752),t+=4,a!=null&&(r[t++]=20,r[t++]=e.os),r[t]=20,t+=2,r[t++]=e.flag<<1|(s<0&&8),r[t++]=i&&8,r[t++]=e.compression&255,r[t++]=e.compression>>8;var f=new Date(e.mtime==null?Date.now():e.mtime),p=f.getFullYear()-1980;if((p<0||p>119)&&wn(10),Mn(r,t,p<<25|f.getMonth()+1<<21|f.getDate()<<16|f.getHours()<<11|f.getMinutes()<<5|f.getSeconds()>>1),t+=4,s!=-1&&(Mn(r,t,e.crc),Mn(r,t+4,s<0?-s-2:s),Mn(r,t+8,e.size)),Mn(r,t+12,c),Mn(r,t+14,d),t+=16,a!=null&&(Mn(r,t,h),Mn(r,t+6,e.attrs),Mn(r,t+10,a),t+=14),r.set(n,t),t+=c,d)for(var m in u){var y=u[m],x=y.length;Mn(r,t,+m),Mn(r,t+2,x),r.set(y,t+4),t+=4+x}return h&&(r.set(l,t),t+=h),t},EI=function(r,t,e,n,i){Mn(r,t,101010256),Mn(r,t+8,e),Mn(r,t+10,e),Mn(r,t+12,n),Mn(r,t+16,i)};function Lv(r,t){t||(t={});var e={},n=[];Rv(r,"",e,t);var i=0,s=0;for(var a in e){var l=e[a],c=l[0],u=l[1],h=u.level==0?0:8,d=Av(a),f=d.length,p=u.comment,m=p&&Av(p),y=m&&m.length,x=Gb(u.extra);f>65535&&wn(11);var b=h?gI(c,u):c,w=b.length,C=uI();C.p(c),n.push(Wb(u,{size:c.length,crc:C.d(),c:b,f:d,m,u:f!=a.length||m&&p.length!=y,o:i,compression:h})),i+=30+f+x+w,s+=76+2*(f+x)+(y||0)+w}for(var E=new De(s+22),S=i,N=s-i,k=0;k<n.length;++k){var d=n[k];vv(E,d.o,d,d.f,d.u,d.c.length);var M=30+d.f.length+Gb(d.extra);E.set(d.c,d.o+M),vv(E,i,d,d.f,d.u,d.c.length,d.o,d.m),i+=16+M+(d.m?d.m.length:0)}return EI(E,i,n.length,N,S),E}var Cv=typeof queueMicrotask=="function"?queueMicrotask:typeof setTimeout=="function"?setTimeout:function(r){r()};function Bv(r,t,e){e||(e=t,t={}),typeof e!="function"&&wn(7);var n=[],i=function(){for(var x=0;x<n.length;++x)n[x]()},s={},a=function(x,b){Cv(function(){e(x,b)})};Cv(function(){a=e});for(var l=r.length-22;Ir(r,l)!=101010256;--l)if(!l||r.length-l>65558)return a(wn(13,0,1),null),i;var c=rs(r,l+8);if(c){var u=c,h=Ir(r,l+16),d=h==4294967295||u==65535;if(d){var f=Ir(r,l-12);d=Ir(r,f)==101075792,d&&(u=c=Ir(r,f+32),h=Ir(r,f+48))}for(var p=t&&t.filter,m=function(x){var b=vI(r,h,d),w=b[0],C=b[1],E=b[2],S=b[3],N=b[4],k=b[5],M=AI(r,k);h=N;var R=function($,q){$?(i(),a($,null)):(q&&(s[S]=q),--c||a(null,s))};if(!p||p({name:S,size:C,originalSize:E,compression:w}))if(!w)R(null,uu(r,M,M+C));else if(w==8){var j=r.subarray(M,M+C);if(E<524288||C>.8*E)try{R(null,qb(j,{out:new De(E)}))}catch($){R($,null)}else n.push(yI(j,{size:E},R))}else R(wn(14,"unknown compression type "+w,1),null);else R(null,null)},y=0;y<u;++y)m(y)}else a(null,{});return i}B();function Uv(r){let t=new Set,e=r.split(",");for(let n of e){let i=n.trim();if(i.includes("-")){let[s,a]=i.split("-"),l=parseInt(s,10),c=parseInt(a,10);if(!isNaN(l)&&!isNaN(c)){let u=Math.min(l,c),h=Math.max(l,c);for(let d=u;d<=h;d++)t.add(d)}}else{let s=parseInt(i,10);isNaN(s)||t.add(s)}}return Array.from(t).sort((n,i)=>n-i)}var Eg=class extends qn{constructor(t,e){super("csv",t,e)}async generate(){let t=this.config.csvConfig,e=t.columnDelimiter,n=t.mergeSheets,i=await this.collectSheetLikeNodes(this.ast.content);if(i.length===0)return{value:"",messages:this.messages};let s=this.config.renderMetadata?this.renderMetadata(this.ast):"",a=i;if(t.sheets&&(a=Uv(t.sheets).filter(h=>h>0&&h<=i.length).map(h=>i[h-1])),a.length===0)return this.warn("SHEET_RANGE_NOT_FOUND",t.sheets),{value:"",messages:this.messages};let l=[],c=0;for(let u=0;u<a.length;u++){let h=a[u],d=h.metadata?.sheetName||`Sheet${u+1}`,f=await this.renderNodeToRows(h),p=Math.max(...f.map(m=>m.length),0);n&&(c=Math.max(c,p)),l.push({name:d,rows:f})}if(n){let u=[];s&&u.push(s.trim());for(let h of l){l.length>1&&u.push(`# Sheet: ${h.name}`);for(let d of h.rows){let f=[...d];if(d.length>1||d.length===1&&!d[0].startsWith("#"))for(;f.length<c;)f.push("");u.push(f.map(p=>this.escapeCsvValue(p,e)).join(e))}u.push("")}return{value:u.join(`
|
|
83
83
|
`),messages:this.messages}}else if(l.length>1){let u={};for(let d of l){let f=Math.max(...d.rows.map(y=>y.length),0),p=[];s&&p.push(s.trim());for(let y of d.rows){let x=[...y];if(y.length>1||y.length===1&&!y[0].startsWith("#"))for(;x.length<f;)x.push("");p.push(x.map(b=>this.escapeCsvValue(b,e)).join(e))}let m=`${d.name.replace(/[^\w\s-]/g,"_")}.csv`;u[m]=new TextEncoder().encode(p.join(`
|
|
84
|
-
`))}return{value:
|
|
84
|
+
`))}return{value:Lv(u),messages:this.messages}}else{let u=l[0],h=Math.max(...u.rows.map(f=>f.length),0),d=[];s&&d.push(s.trim());for(let f of u.rows){let p=[...f];if(f.length>1||f.length===1&&!f[0].startsWith("#"))for(;p.length<h;)p.push("");d.push(p.map(m=>this.escapeCsvValue(m,e)).join(e))}return{value:d.join(`
|
|
85
85
|
`),messages:this.messages}}}async collectSheetLikeNodes(t){let e=[];for(let n of t)await this.handleOnNode(n)!==!1&&(n.type==="sheet"||n.type==="table"?e.push(n):n.children&&e.push(...await this.collectSheetLikeNodes(n.children)));return e}async renderNodeToRows(t){if(!t.children)return[];let e=[],n=t.children.filter(s=>s.type==="row"||s.type==="comment"),i=(s,a)=>s.type==="text"||s.type==="code"?s.text||"":s.type==="break"?`
|
|
86
86
|
`:a;for(let s of n){let a=await this.handleOnNode(s);if(a===!1)continue;if(typeof a=="string"){e.push([a]);continue}if(s.type==="comment"){e.push([s.text||""]);continue}if(!s.children){e.push([]);continue}let l=s.children.filter(h=>h.type==="cell"),c=[],u=-1;for(let h of l){let d=h.metadata?.col??u+1;for(;u<d-1;)c.push(""),u++;let f=await this.processNodeRecursive(h,i);c.push(f);let p=h.metadata?.colSpan||1;u=d+p-1}e.push(c)}return e}escapeCsvValue(t,e){return t.includes(e)||t.includes('"')||t.includes(`
|
|
87
87
|
`)||t.includes("\r")?`"${t.replace(/"/g,'""')}"`:t}renderMetadata(t){if(!t.metadata)return"";let e=t.metadata,n="";if(e.title&&(n+=`# Title: ${e.title}
|
|
@@ -697,7 +697,7 @@ ${i}</table>
|
|
|
697
697
|
`}else if(e.type==="row"){let i="";if(e.children)for(let s of e.children)i+=await this.renderTableAsHtml(s,await this.handleOnNode(s));return` <tr>
|
|
698
698
|
${i} </tr>
|
|
699
699
|
`}else if(e.type==="cell"){let i=e.metadata,s=i?.rowSpan>1?` rowspan="${i.rowSpan}"`:"",a=i?.colSpan>1?` colspan="${i.colSpan}"`:"",l="";if(e.children)for(let c of this.optimizeNodes(e.children))l+=await this.processNodeRecursive(c,async(u,h)=>{switch(u.type){case"text":{let d=u.text||"";return u.formatting?.bold&&(d=`<b>${d}</b>`),u.formatting?.italic&&(d=`<i>${d}</i>`),u.formatting?.underline&&(d=`<u>${d}</u>`),u.formatting?.subscript&&(d=`<sub>${d}</sub>`),u.formatting?.superscript&&(d=`<sup>${d}</sup>`),d}case"paragraph":return`<p>${h}</p>`;case"heading":{let d=u.metadata?.level||1;return`<h${d}>${h}</h${d}>`}case"table":return await this.renderTableAsHtml(u);default:return h}});return` <td${s}${a}>${l}</td>
|
|
700
|
-
`}return""}};B();B();var _r=typeof window<"u"&&typeof window.document<"u",TI={fs:"direct file system access","path-parsing":"parsing from file path string","pdf-worker-auto-resolution":"automatic PDF worker resolution from node_modules"};function Dg(r){if(_r)throw hn("FEATURE_NOT_SUPPORTED_IN_BROWSER",void 0,TI[r])}function
|
|
700
|
+
`}return""}};B();B();var _r=typeof window<"u"&&typeof window.document<"u",TI={fs:"direct file system access","path-parsing":"parsing from file path string","pdf-worker-auto-resolution":"automatic PDF worker resolution from node_modules"};function Dg(r){if(_r)throw hn("FEATURE_NOT_SUPPORTED_IN_BROWSER",void 0,TI[r])}function Vb(){if(typeof window<"u"){window.DOMMatrix||(window.DOMMatrix=class Sg{constructor(e){U(this,"a");U(this,"b");U(this,"c");U(this,"d");U(this,"e");U(this,"f");Array.isArray(e)&&e.length>=6?(this.a=e[0],this.b=e[1],this.c=e[2],this.d=e[3],this.e=e[4],this.f=e[5]):typeof e=="object"&&e!==null?(this.a=e.a,this.b=e.b,this.c=e.c,this.d=e.d,this.e=e.e,this.f=e.f):(this.a=this.d=1,this.b=this.c=this.e=this.f=0)}get m11(){return this.a}get m12(){return this.b}get m21(){return this.c}get m22(){return this.d}get m41(){return this.e}get m42(){return this.f}multiply(e){return new Sg([this.a*e.a+this.c*e.b,this.b*e.a+this.d*e.b,this.a*e.c+this.c*e.d,this.b*e.c+this.d*e.d,this.a*e.e+this.c*e.f+this.e,this.b*e.e+this.d*e.f+this.f])}inverse(){let e=this.a*this.d-this.b*this.c;return e===0?new Sg:new Sg([this.d/e,-this.b/e,-this.c/e,this.a/e,(this.c*this.f-this.d*this.e)/e,(this.b*this.e-this.a*this.f)/e])}transformPoint(e){let n=e?.x??0,i=e?.y??0;return{x:n*this.a+i*this.c+this.e,y:n*this.b+i*this.d+this.f}}}),window.ImageData||(window.ImageData=class{constructor(e,n,i){U(this,"width");U(this,"height");U(this,"data");this.data=e,this.width=n,this.height=i}});let r=window.RegExp;try{new r("","v")}catch{let e=function(n,i){return typeof i=="string"&&i.includes("v")?new r(n,i.replace("v","u")):new r(n,i)};e.prototype=r.prototype,Object.setPrototypeOf(e,r),window.RegExp=e}}}var Ng=class extends qn{constructor(t,e){super("pdf",t,e)}async generate(){let e=await new hu(this.ast,{...this.config,htmlConfig:{...this.config.htmlConfig,standalone:!0},mdConfig:void 0,chunksConfig:void 0,csvConfig:void 0,textConfig:void 0,pdfConfig:void 0,rtfConfig:void 0}).generate(),n=typeof e.value=="string"?e.value:"";return _r?this.generateInBrowser(n):this.generateInNode(n)}async generateInNode(t){try{let e=await Promise.resolve().then(()=>(jv(),zv)),n=e.default||e,i={...this.config.pdfConfig.launchOptions},s=nt.default.platform==="darwin",a=nt.default.arch==="x64",l=!1;if(s&&a)try{let{execSync:f}=await import("child_process");l=f("sysctl -n hw.optional.arm64",{stdio:"pipe"}).toString().trim()==="1"}catch{}l&&this.warn("PERFORMANCE_TIP","You are running on Apple Silicon using an x64 Node.js installation. PDF generation will be significantly faster (avoiding Rosetta translation) if you switch to a native arm64 Node.js version.");let c=await n.launch(i),u=await c.newPage();await u.setContent(t,{waitUntil:"networkidle0"});let h=this.config.pdfConfig,d=await u.pdf({format:h.format,width:h.width,height:h.height,landscape:h.landscape,printBackground:h.printBackground,scale:h.scale,margin:h.margin,displayHeaderFooter:h.displayHeaderFooter,headerTemplate:h.headerTemplate,footerTemplate:h.footerTemplate});return await c.close(),{value:new Uint8Array(d),messages:this.messages}}catch(e){return this.warn("DEPENDENCY_LOAD_FAILED",`puppeteer. Please install it with 'npm install puppeteer'. Error: ${e.message}`),{value:"",messages:this.messages}}}async generateInBrowser(t){return this.warn("BROWSER_GENERATION_LIMITATION","Browser-based PDF generation triggered. For automated 'Save as PDF' without user interaction, we recommend using 'html2pdf.js' as a custom generator hook."),{value:t,messages:this.messages}}};B();var Ig=class extends qn{constructor(e,n){super("rtf",e,n);U(this,"colorTable",[]);U(this,"inTable",!1)}async generate(){this.colorTable=[];let e=await this.renderBody(this.ast),n=`{\\rtf1\\ansi\\deff0
|
|
701
701
|
`;if(this.config.renderMetadata&&this.ast.metadata&&(n+="{\\info",this.ast.metadata.title&&(n+=`{\\title ${this.escapeRtf(this.ast.metadata.title)}}`),this.ast.metadata.author&&(n+=`{\\author ${this.escapeRtf(this.ast.metadata.author)}}`),this.ast.metadata.description&&(n+=`{\\comm ${this.escapeRtf(this.ast.metadata.description)}}`),n+=`}
|
|
702
702
|
`),n+=`{\\fonttbl{\\f0\\fnil\\fcharset0 Arial;}{\\f1\\fnil\\fcharset0 Times New Roman;}}
|
|
703
703
|
`,this.colorTable.length>0){n+="{\\colortbl;";for(let i of this.colorTable){let s=parseInt(i.substring(1,3),16),a=parseInt(i.substring(3,5),16),l=parseInt(i.substring(5,7),16);n+=`\\red${s}\\green${a}\\blue${l};`}n+=`}
|
|
@@ -713,14 +713,14 @@ ${a}\\row
|
|
|
713
713
|
`;case"cell":return`${this.inTable?"\\pard\\intbl":"\\pard"}\\intbl\\sb60\\sa60 ${a}\\cell
|
|
714
714
|
`;case"break":return s.metadata?.breakType==="page"?`\\page
|
|
715
715
|
`:`\\line
|
|
716
|
-
`;default:return a}};for(let s of e.content)n+=await this.processNodeRecursive(s,i);return n}getColorIndex(e){let n=e.toUpperCase(),i=this.colorTable.indexOf(n);return i===-1&&(i=this.colorTable.length,this.colorTable.push(n)),i}escapeRtf(e){return e.replace(/\\/g,"\\\\").replace(/{/g,"\\{").replace(/}/g,"\\}").replace(/[^\x00-\x7F]/g,n=>`\\u${n.charCodeAt(0)}?`)}};B();var kg=class extends qn{constructor(t,e){super("text",t,e)}async generate(){let t="",e=this.config.textConfig.newlineDelimiter;this.config.renderMetadata&&this.ast.metadata&&(this.ast.metadata.title&&(t+=`Title: ${this.ast.metadata.title}${e}`),this.ast.metadata.author&&(t+=`Author: ${this.ast.metadata.author}${e}`),this.ast.metadata.created&&(t+=`Created: ${new Date(this.ast.metadata.created).toLocaleString()}${e}`),t+=`-------------------${e}${e}`);let n=async(i,s)=>{if(i.type==="text"||i.type==="code")return i.text||"";if(i.type==="break")return e;if(i.type==="image"){if(!this.config.includeImages)return"";let l=i.metadata;return`[Image: ${l?.altText||l?.attachmentName||"Untitled"}]${e}`}if(i.type==="table"&&this.config.textConfig.preserveLayout)return await this.renderTable(i,n,e);if(i.type==="list"&&this.config.textConfig.preserveLayout){let l=i.metadata,u=" ".repeat(4).repeat(l?.indentation||0),h=l?.listType==="ordered"?`${(l.itemIndex??0)+1}. `:"- ";return`${u}${h}${s.trimStart()}`+(s.endsWith(e)?"":e)}return["paragraph","heading","row","sheet","slide","note","list","table","code"].includes(i.type)?s.trim()===""?"":s+(s.endsWith(e)?"":e):s};for(let i of this.ast.content)t+=await this.processNodeRecursive(i,n);return{value:t.trim(),messages:this.messages}}async renderTable(t,e,n){if(!t.children||t.children.length===0)return"";let i=[],s=[];for(let l of t.children){let c=await this.handleOnNode(l);if(c===!1)continue;if(typeof c=="string"){i.push([c]);continue}let u=[];if(l.children)for(let h=0;h<l.children.length;h++){let d=l.children[h],f=(await this.processNodeRecursive(d,e)).trim().replace(/\r?\n/g," ");u.push(f),s[h]=Math.max(s[h]||0,f.length)}i.push(u)}let a=n;for(let l of i){a+="| ";for(let c=0;c<l.length;c++)a+=(l[c]||"").padEnd(s[c]||0)+" | ";a+=n}return a+n}};var Ka=class{static async generate(t,e,n){switch(e.toLowerCase()){case"text":return new kg(t,n).generate();case"md":return new Tg(t,n).generate();case"html":return new hu(t,n).generate();case"pdf":return new Ng(t,n).generate();case"csv":return new Eg(t,n).generate();case"rtf":return new Ig(t,n).generate();case"chunks":return new gg(t,n).generate();default:throw hn("EXTENSION_UNSUPPORTED",void 0,e)}}};function An(r,t,e,n,i,s){return{config:i,type:r,metadata:t,content:e,attachments:n,warnings:[],toText:s,async to(a,l){return Ka.generate(this,a,l)}}}var
|
|
716
|
+
`;default:return a}};for(let s of e.content)n+=await this.processNodeRecursive(s,i);return n}getColorIndex(e){let n=e.toUpperCase(),i=this.colorTable.indexOf(n);return i===-1&&(i=this.colorTable.length,this.colorTable.push(n)),i}escapeRtf(e){return e.replace(/\\/g,"\\\\").replace(/{/g,"\\{").replace(/}/g,"\\}").replace(/[^\x00-\x7F]/g,n=>`\\u${n.charCodeAt(0)}?`)}};B();var kg=class extends qn{constructor(t,e){super("text",t,e)}async generate(){let t="",e=this.config.textConfig.newlineDelimiter;this.config.renderMetadata&&this.ast.metadata&&(this.ast.metadata.title&&(t+=`Title: ${this.ast.metadata.title}${e}`),this.ast.metadata.author&&(t+=`Author: ${this.ast.metadata.author}${e}`),this.ast.metadata.created&&(t+=`Created: ${new Date(this.ast.metadata.created).toLocaleString()}${e}`),t+=`-------------------${e}${e}`);let n=async(i,s)=>{if(i.type==="text"||i.type==="code")return i.text||"";if(i.type==="break")return e;if(i.type==="image"){if(!this.config.includeImages)return"";let l=i.metadata;return`[Image: ${l?.altText||l?.attachmentName||"Untitled"}]${e}`}if(i.type==="table"&&this.config.textConfig.preserveLayout)return await this.renderTable(i,n,e);if(i.type==="list"&&this.config.textConfig.preserveLayout){let l=i.metadata,u=" ".repeat(4).repeat(l?.indentation||0),h=l?.listType==="ordered"?`${(l.itemIndex??0)+1}. `:"- ";return`${u}${h}${s.trimStart()}`+(s.endsWith(e)?"":e)}return["paragraph","heading","row","sheet","slide","note","list","table","code"].includes(i.type)?s.trim()===""?"":s+(s.endsWith(e)?"":e):s};for(let i of this.ast.content)t+=await this.processNodeRecursive(i,n);return{value:t.trim(),messages:this.messages}}async renderTable(t,e,n){if(!t.children||t.children.length===0)return"";let i=[],s=[];for(let l of t.children){let c=await this.handleOnNode(l);if(c===!1)continue;if(typeof c=="string"){i.push([c]);continue}let u=[];if(l.children)for(let h=0;h<l.children.length;h++){let d=l.children[h],f=(await this.processNodeRecursive(d,e)).trim().replace(/\r?\n/g," ");u.push(f),s[h]=Math.max(s[h]||0,f.length)}i.push(u)}let a=n;for(let l of i){a+="| ";for(let c=0;c<l.length;c++)a+=(l[c]||"").padEnd(s[c]||0)+" | ";a+=n}return a+n}};var Ka=class{static async generate(t,e,n){switch(e.toLowerCase()){case"text":return new kg(t,n).generate();case"md":return new Tg(t,n).generate();case"html":return new hu(t,n).generate();case"pdf":return new Ng(t,n).generate();case"csv":return new Eg(t,n).generate();case"rtf":return new Ig(t,n).generate();case"chunks":return new gg(t,n).generate();default:throw hn("EXTENSION_UNSUPPORTED",void 0,e)}}};function An(r,t,e,n,i,s){return{config:i,type:r,metadata:t,content:e,attachments:n,warnings:[],toText:s,async to(a,l){return Ka.generate(this,a,l)}}}var Gv=async(r,t)=>{let e=r.toString("utf-8"),n=t.csvDelimiter,i=[],s=[],a="",l=!1;for(let f=0;f<e.length;f++){let p=e[f],m=e[f+1];l?p==='"'?m==='"'?(a+='"',f++):l=!1:a+=p:p==='"'?l=!0:e.substring(f,f+n.length)===n?(s.push(a),a="",f+=n.length-1):p===`
|
|
717
717
|
`?(s.push(a),i.push(s),s=[],a=""):p==="\r"||(a+=p)}(a!==""||s.length>0)&&(s.push(a),i.push(s)),i.length>0&&i[i.length-1].length===1&&i[i.length-1][0]===""&&i.pop();let c=[];i.forEach((f,p)=>{if(f.length===1&&f[0].startsWith("#")){c.push({type:"comment",text:f[0]});return}let m=[];f.forEach((y,x)=>{if(y&&y.trim()!==""){let b={row:p,col:x};m.push({type:"cell",text:y,metadata:b,children:[{type:"text",text:y}]})}}),m.length>0&&c.push({type:"row",children:m})});let h={type:"sheet",metadata:{sheetName:"Sheet1"},children:c,rawContent:t.includeRawContent?e:void 0};return An("csv",{title:"Sheet1"},[h],[],t,()=>i.map(f=>f.filter(p=>p.trim()!=="").join(t.newlineDelimiter)).join(t.newlineDelimiter).replace(/\n{3,}/g,`
|
|
718
718
|
|
|
719
|
-
`))};B();B();B();var Yg=ru(
|
|
720
|
-
`),n=0;for(let i=0;i<r.lineNumber-1;i++)n+=e[i].length+1;if(n+=r.columnNumber-1,Oe(r)){let s=`</${r.tagName}>`,a=t.indexOf(s,n);if(a!==-1)return t.substring(n,a+s.length);let l=t.indexOf("/>",n),c=t.indexOf("<",n+1);if(l!==-1&&(c===-1||l<c))return t.substring(n,l+2)}},ee=(r,t,e)=>{if(e.serializeRawContent===!1){let n=w_(r,t);if(n)return n}return dx(r,{preserveWhitespace:e.preserveXmlWhitespace})},pt=(r,t)=>{let e=r.getElementsByTagName(t);if(e&&e.length>0)return e[0]};var Qe=(r,t)=>{let e=[];if(!r.childNodes)return e;for(let n=0;n<r.childNodes.length;n++){let i=r.childNodes[n];Oe(i)&&i.tagName===t&&e.push(i)}return e},no=r=>{let t=le(r),e={},n=ut(t,"cp:coreProperties")[0];if(n){let s=ut(n,"dc:title")[0];s&&s.textContent&&(e.title=s.textContent);let a=ut(n,"dc:creator")[0];a&&a.textContent&&(e.author=a.textContent);let l=ut(n,"cp:lastModifiedBy")[0];l&&l.textContent&&(e.lastModifiedBy=l.textContent);let c=ut(n,"dcterms:created")[0];c&&c.textContent&&(e.created=ls(c.textContent));let u=ut(n,"dcterms:modified")[0];u&&u.textContent&&(e.modified=ls(u.textContent));let h=ut(n,"dc:description")[0];h&&h.textContent&&(e.description=h.textContent);let d=ut(n,"dc:subject")[0];return d&&d.textContent&&(e.subject=d.textContent),e}let i=ut(t,"office:meta")[0];if(i){let s=ut(i,"dc:title")[0];s&&s.textContent&&(e.title=s.textContent);let a=ut(i,"dc:creator")[0];a&&a.textContent&&(e.author=a.textContent);let l=ut(i,"dc:description")[0];l&&l.textContent&&(e.description=l.textContent);let c=ut(i,"dc:subject")[0];c&&c.textContent&&(e.subject=c.textContent);let u=ut(i,"meta:creation-date")[0];u&&u.textContent&&(e.created=ls(u.textContent));let h=ut(i,"dc:date")[0];h&&h.textContent&&(e.modified=ls(h.textContent));let d=ut(i,"meta:user-defined");if(d.length>0){let f={};for(let p of d){let m=p.getAttribute("meta:name");if(!m||!p.textContent)continue;let y=p.getAttribute("meta:value-type")||"string",x=p.textContent;if(y==="boolean")f[m]=x.toLowerCase()==="true";else if(y==="float"){let b=Number(x);isNaN(b)||(f[m]=b)}else if(y==="date"||y==="time"){let b=ls(x);b?f[m]=b:f[m]=x}else f[m]=x}Object.keys(f).length>0&&(e.customProperties=f)}}return e},ku=r=>{let t=le(r),e={},n=ut(t,"property");for(let i of n){let s=i.getAttribute("name");if(s)for(let a=0;a<i.childNodes.length;a++){let l=i.childNodes[a];if(l.nodeType!==1)continue;let c=l,u=c.tagName||"",h=c.textContent||"";if(/vt:lpwstr|vt:lpstr|vt:bstr/.test(u))e[s]=h;else if(/vt:bool/.test(u))e[s]=h.toLowerCase()==="true";else if(/vt:(i[1248]|ui[1248]|int|uint|r4|r8|decimal)/.test(u)){let d=Number(h);isNaN(d)||(e[s]=d)}else if(/vt:filetime|vt:date/.test(u)){let d=ls(h);d?e[s]=d:e[s]=h}else h&&(e[s]=h);break}}return e};var hf=(r,t)=>{let e=r.localName===t||r.tagName===t?r:r.getElementsByTagName(t)[0];if(!e)return;let n=e.getElementsByTagName("c:rich"),i=e.getElementsByTagName("a:p"),s=n.length>0?Array.from(n):Array.from(i);if(s.length>0){let l="";for(let c of s){let u=c.getElementsByTagName("a:t");for(let h=0;h<u.length;h++)l+=(u[h].textContent||"")+" "}if(l.trim())return l.trim()}let a=e.getElementsByTagName("c:v")[0];if(a&&a.textContent)return a.textContent.trim()||void 0},A_=r=>{let t=r.toString("utf8"),n=le(t).documentElement;if(!n)return{title:void 0,xAxisTitle:void 0,yAxisTitle:void 0,dataSets:[],labels:[],rawTexts:[]};let i=hf(n,"c:title"),s,a,l=n.getElementsByTagName("c:catAx");l.length>0&&(s=hf(l[0],"c:title"));let c=n.getElementsByTagName("c:valAx");c.length>0&&(a=hf(c[0],"c:title"));let u=n.getElementsByTagName("c:ser"),h=[],d=[];for(let p=0;p<u.length;p++){let m=u[p],y=hf(m,"c:tx"),x=[],b=m.getElementsByTagName("c:val")[0]||m.getElementsByTagName("c:yVal")[0];if(b){let S=b.getElementsByTagName("c:v");for(let N=0;N<S.length;N++){let k=S[N].textContent?.trim();k&&x.push(k)}}let w=[],C=m.getElementsByTagName("c:dLbl");for(let S=0;S<C.length;S++){let N=hf(C[S],"c:tx");N&&w.push(N)}let E=m.getElementsByTagName("c:cat")[0]||m.getElementsByTagName("c:xVal")[0];if(E){let S=E.getElementsByTagName("c:v"),N=[];for(let k=0;k<S.length;k++){let M=S[k].textContent?.trim();M&&N.push(M)}N.length>0&&d.length===0&&d.push(...N)}h.push({name:y,values:x,pointLabels:w})}let f=[];for(let p of h)p.name&&f.push(p.name),f.push(...d),f.push(...p.values);return{title:i,xAxisTitle:s,yAxisTitle:a,dataSets:h,labels:d,rawTexts:f}},v_=r=>{let t=r.toString("utf8"),e=le(t),n=ut(e,"chart:chart")[0]||e.documentElement,i=ut(n,"chart:title")[0],s=i&&ut(i,"text:p")[0]?.textContent||void 0,a=ut(n,"table:table")[0],l=[],c=[],u=[];if(a){let p=[],m=Qe(a,"table:table-header-rows")[0];if(m&&p.push(...Qe(m,"table:table-row")),p.push(...Qe(a,"table:table-row")),p.length>0){let y=Qe(p[0],"table:table-cell");for(let x=1;x<y.length;x++){let b=parseInt(y[x].getAttribute("table:number-columns-repeated")||"1"),w=Qe(y[x],"text:p")[0]?.textContent||void 0;for(let C=0;C<b;C++)l.push({name:w,values:[],pointLabels:[]})}for(let x=1;x<p.length;x++){let b=Qe(p[x],"table:table-cell");if(b.length>0){let w=Qe(b[0],"text:p")[0]?.textContent||void 0;w&&c.push(w);let C=0;for(let E=1;E<b.length;E++){let S=parseInt(b[E].getAttribute("table:number-columns-repeated")||"1"),N=b[E].getAttribute("office:value")||Qe(b[E],"text:p")[0]?.textContent||"";for(let k=0;k<S;k++)l[C]&&l[C].values.push(N),C++}}}}}else{let p=ut(n,"chart:series");for(let y of p){let x=y.getAttribute("chart:label-cell-address"),b=y.getAttribute("chart:values-cell-range-address"),w,C=ut(y,"text:p");C.length>0&&(w=C[0].textContent||void 0),!w&&x&&(w=`Series ${x.split(".").pop()?.replace(/\$/g,"")||x}`);let E={name:w,values:[],pointLabels:[]};b&&E.values.push(`[${b}]`),l.push(E)}let m=ut(n,"chart:categories")[0];if(m){let y=m.getAttribute("table:cell-range-address");y&&c.push(`[${y}]`)}}let h=ut(e,"chart:axis"),d,f;for(let p of h){let m=p.getAttribute("chart:dimension"),y=ut(p,"chart:title")[0],x=y&&ut(y,"text:p")[0]?.textContent||void 0;m==="x"?d=x:m==="y"&&(f=x)}s&&u.push(s);for(let p of l)p.name&&u.push(p.name),u.push(...c),u.push(...p.values);return{title:s,xAxisTitle:d,yAxisTitle:f,dataSets:l,labels:c,rawTexts:u}},dl=r=>r.toString("utf8",0,500).includes("urn:oasis:names:tc:opendocument:xmlns:chart:1.0")?v_(r):A_(r);B();var C_=r=>{switch(r.toLowerCase()){case"jpg":case"jpeg":return"image/jpeg";case"png":return"image/png";case"gif":return"image/gif";case"bmp":return"image/bmp";case"tiff":return"image/tiff";case"webp":return"image/webp";default:return"application/octet-stream"}},E_=r=>{if(!(r.length<4)){if(r[0]===137&&r[1]===80&&r[2]===78&&r[3]===71)return"image/png";if(r[0]===255&&r[1]===216&&r[2]===255)return"image/jpeg";if(r[0]===71&&r[1]===73&&r[2]===70&&r[3]===56)return"image/gif";if(r[0]===66&&r[1]===77)return"image/bmp";if(r[0]===73&&r[1]===73&&r[2]===42&&r[3]===0||r[0]===77&&r[1]===77&&r[2]===0&&r[3]===42)return"image/tiff";if(r.length>=12&&r[0]===82&&r[1]===73&&r[2]===70&&r[3]===70&&r[8]===87&&r[9]===69&&r[10]===66&&r[11]===80)return"image/webp"}},Mr=(r,t)=>{let e=r.split(".").pop()||"",n=E_(t);return n||(n=C_(e)),{type:"image",mimeType:n,data:t.toString("base64"),name:r,extension:e}};B();var io=class io{constructor(){U(this,"pool",[]);U(this,"queue",[]);U(this,"MAX_WORKERS",4);U(this,"idleTimeout",1e4);U(this,"timeoutId",null)}static getInstance(){return io.instance||(io.instance=new io),io.instance}static hasInstance(){return!!io.instance}resetIdleTimer(){this.timeoutId&&clearTimeout(this.timeoutId),this.idleTimeout>0&&(this.timeoutId=setTimeout(async()=>{await this.terminate()},this.idleTimeout))}async recognize(t,e){return new Promise((n,i)=>{e?.autoTerminateTimeout!==void 0&&(this.idleTimeout=e.autoTerminateTimeout),this.resetIdleTimer(),this.queue.push({image:t,config:e||{},resolve:n,reject:i}),this.processQueue()})}async processQueue(){if(this.queue.length===0)return;let t=this.queue[0],e=t.config.language||"eng",n=this.pool.find(i=>!i.isBusy&&i.language===e);if(!n&&this.pool.length<this.MAX_WORKERS)try{let{createWorker:i}=await Promise.resolve().then(()=>ru($E())),s={logger:()=>{}};t.config.workerPath&&(s.workerPath=t.config.workerPath),t.config.corePath&&(s.corePath=t.config.corePath),t.config.langPath&&(s.langPath=t.config.langPath),n={worker:await i(e,1,s),language:e,lastUsed:Date.now(),isBusy:!1},this.pool.push(n)}catch(i){this.queue.shift()?.reject(i),this.processQueue();return}if(!n){let i=this.pool.filter(s=>!s.isBusy);if(i.length>0){n=i.reduce((s,a)=>s.lastUsed<a.lastUsed?s:a);try{await n.worker.reinitialize(e),n.language=e}catch(s){this.queue.shift()?.reject(s),this.processQueue();return}}}if(n){let i=this.queue.shift();if(!i)return;n.isBusy=!0,n.lastUsed=Date.now();try{let{data:{text:s}}=await n.worker.recognize(i.image);i.resolve(s)}catch(s){i.reject(s)}finally{n.isBusy=!1,n.lastUsed=Date.now(),this.processQueue()}}}async terminate(){this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=null);let t=this.pool.map(e=>e.worker.terminate());await Promise.all(t),this.pool=[]}};U(io,"instance");var ff=io,lr=async(r,t)=>{let e=r;return _r&&typeof Blob<"u"&&ct.Buffer.isBuffer(r)&&(e=new Blob([r],{type:"image/bmp"})),await ff.getInstance().recognize(e,t)},zE=async()=>{ff.hasInstance()&&await ff.getInstance().terminate()};B();var ro=(r,t)=>new Promise((e,n)=>{Rv(new Uint8Array(r.buffer,r.byteOffset,r.byteLength),{filter:i=>t(i.name)},(i,s)=>{if(i)return n(i);e(Object.entries(s).map(([a,l])=>({path:a,content:ct.Buffer.from(l)})))})});var jE=async(r,t)=>{let e=/xl\/worksheets\/sheet\d+.xml/g,n=/xl\/drawings\/drawing\d+.xml/g,i=/xl\/charts\/chart\d+.xml/g,s="xl/sharedStrings.xml",a=/xl\/media\/.*/,l=/docProps\/core\.xml/,c=/docProps\/custom\.xml/,u=/xl\/worksheets\/_rels\/sheet\d+\.xml\.rels/g,h=/xl\/drawings\/_rels\/drawing\d+\.xml\.rels/g,d=await ro(r,Y=>!!Y.match(e)||!!Y.match(n)||!!Y.match(i)||Y===s||Y==="xl/styles.xml"||Y==="xl/workbook.xml"||Y==="xl/_rels/workbook.xml.rels"||!!Y.match(l)||!!Y.match(c)||!!t.extractAttachments&&(!!Y.match(a)||!!Y.match(u)||!!Y.match(h))),f=d.find(Y=>Y.path===s),p=[];if(f){let Y=le(f.content.toString()),X=ut(Y,"si");for(let T of X){let I=ut(T,"r");if(I.length>0){let _=[];for(let W of I){let z=ut(W,"t")[0];if(z){let D=z.textContent||"",F=ut(W,"rPr")[0],P={};if(F){ut(F,"b").length>0&&(P.bold=!0),ut(F,"i").length>0&&(P.italic=!0),ut(F,"u").length>0&&(P.underline=!0),ut(F,"strike").length>0&&(P.strikethrough=!0);let G=ut(F,"sz")[0];G&&(P.size=G.getAttribute("val")+"pt");let H=ut(F,"color")[0];if(H){let tt=H.getAttribute("rgb");tt&&(P.color="#"+tt.substring(2))}let V=ut(F,"rFont")[0];V&&(P.font=V.getAttribute("val")||void 0);let L=ut(F,"vertAlign")[0];if(L){let tt=L.getAttribute("val");tt==="subscript"&&(P.subscript=!0),tt==="superscript"&&(P.superscript=!0)}}_.push({type:"text",text:D,formatting:Object.keys(P).length>0?P:void 0})}}p.push(_)}else{let _=ut(T,"t"),W="";for(let z of _)W+=z.textContent||"";p.push(W)}}}let m=d.find(Y=>Y.path==="xl/styles.xml"),y={};if(m){let Y=le(m.content.toString()),X=ut(Y,"fonts")[0],T=[];if(X){let z=ut(X,"font");for(let D of z){let F={};ut(D,"b").length>0&&(F.bold=!0),ut(D,"i").length>0&&(F.italic=!0),ut(D,"u").length>0&&(F.underline=!0),ut(D,"strike").length>0&&(F.strikethrough=!0);let P=ut(D,"sz")[0];if(P){let L=P.getAttribute("val");L&&(F.size=L+"pt")}let G=ut(D,"color")[0];if(G){let L=G.getAttribute("rgb");L&&(F.color="#"+L.substring(2))}let H=ut(D,"name")[0];if(H){let L=H.getAttribute("val");L&&(F.font=L)}let V=ut(D,"vertAlign")[0];if(V){let L=V.getAttribute("val");L==="subscript"&&(F.subscript=!0),L==="superscript"&&(F.superscript=!0)}T.push(F)}}let I=ut(Y,"fills")[0],_=[];if(I){let z=ut(I,"fill");for(let D of z){let F={},P=ut(D,"patternFill")[0];if(P){let G=ut(P,"fgColor")[0];if(G){let H=G.getAttribute("rgb"),V=G.getAttribute("theme");if(H&&H!=="00000000")F.backgroundColor="#"+H.substring(2);else if(V){let L=parseInt(V);L===0?F.backgroundColor="#FFFFFF":L===1?F.backgroundColor="#000000":L===2?F.backgroundColor="#EEECE1":L===3&&(F.backgroundColor="#1F497D")}}}_.push(F)}}let W=ut(Y,"cellXfs")[0];if(W){let z=ut(W,"xf");for(let D=0;D<z.length;D++){let F=z[D],P={},G=F.getAttribute("fontId");if(G){let L=parseInt(G);T[L]&&Object.assign(P,T[L])}let H=F.getAttribute("fillId");if(H){let L=parseInt(H);_[L]&&_[L].backgroundColor&&(P.backgroundColor=_[L].backgroundColor)}let V=ut(F,"alignment")[0];if(V){let L=V.getAttribute("horizontal");(L==="center"||L==="right"||L==="justify"||L==="left")&&(P.alignment=L)}y[D]=P}}}let x=[],b=d.filter(Y=>Y.path.match(/xl\/media\/.*/)),w=d.filter(Y=>Y.path.match(i)),C={};if(t.extractAttachments){let Y=d.filter(T=>T.path.match(h));for(let T of Y){let _=`xl/drawings/${T.path.split("/").pop()?.replace(".rels","")||""}`,W=le(T.content.toString()),z=ut(W,"Relationship");C[_]||(C[_]={});for(let D of z){let F=D.getAttribute("Id"),P=D.getAttribute("Target");if(F&&P&&P.includes("media/")){let G="xl/"+P.replace("../","");C[_][F]={path:G}}}}let X=d.filter(T=>T.path.match(n));for(let T of X){let I=le(T.content.toString()),_=ut(I,"xdr:pic"),W=C[T.path]||{};for(let z of _){let D=ut(z,"xdr:blipFill")[0],F=D?ut(D,"a:blip")[0]:null,P=F?F.getAttribute("r:embed"):null,G=ut(z,"xdr:nvPicPr")[0],H=G?ut(G,"xdr:cNvPr")[0]:null,V=H?H.getAttribute("descr")||H.getAttribute("name"):void 0;P&&W[P]&&(W[P].altText=V||"")}}for(let T of b){let I=Mr(T.path.split("/").pop()||"image",T.content),_="";for(let W in C){for(let z in C[W])if(C[W][z].path===T.path){_=C[W][z].altText||"";break}if(_)break}if(_&&(I.altText=_),x.push(I),t.ocr&&I.mimeType.startsWith("image/"))try{let W=(await lr(T.content,{...t.ocrConfig})).trim();W&&(I.ocrText=W)}catch(W){Se("OCR_FAILED",t,I.name,W)}}for(let T of w){let I={type:"chart",mimeType:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",data:T.content.toString("base64"),name:T.path.split("/").pop()||"",extension:"xml"};try{let _=dl(T.content);I.chartData=_}catch(_){Se("CHART_DATA_EXTRACTION_FAILED",t,T.path,_)}x.push(I)}}let E={};if(t.extractAttachments){let Y=d.filter(X=>X.path.match(h));for(let X of Y){let I=`xl/drawings/${X.path.split("/").pop()?.replace(".rels","")||""}`,_=le(X.content.toString()),W=ut(_,"Relationship");E[I]||(E[I]={});for(let z of W){let D=z.getAttribute("Id"),F=z.getAttribute("Target"),P=z.getAttribute("Type");if(D&&F&&P&&P.includes("chart")){let G=F.split("/").pop()||"";E[I][D]=G}}}}let S={},N=d.find(Y=>Y.path==="xl/workbook.xml"),k=d.find(Y=>Y.path==="xl/_rels/workbook.xml.rels");if(N&&k){let Y=le(k.content.toString()),X=ut(Y,"Relationship"),T={};for(let W of X){let z=W.getAttribute("Id"),D=W.getAttribute("Target");if(z&&D){let F=D.split("/").pop()||"";T[z]=F}}let I=le(N.content.toString()),_=ut(I,"sheet");for(let W of _){let z=W.getAttribute("name"),D=W.getAttribute("r:id");z&&D&&T[D]&&(S[T[D]]=z)}}let M=[],R=[];for(let Y of d)if(!Y.path.match(a)&&Y.path!==s&&Y.path!=="xl/styles.xml"&&!Y.path.match(n)&&!Y.path.match(i)&&!Y.path.match(u)&&!Y.path.match(h)&&Y.path.match(e)){t.includeRawContent&&R.push(Y.content.toString());let X=[],T=Y.content.toString(),I=/<row\b([^>]*?)(?:(\/>)|(>([\s\S]*?)<\/row>))/g,_=T.matchAll(I),W=P=>{let G=0;for(let H=0;H<P.length;H++)G=G*26+(P.charCodeAt(H)-65+1);return G-1},z=-1;for(let P of _){let G=P[0],H=P[1],V=!!P[2],L=P[4]||"";if(!V&&!L.includes("<c"))continue;let tt=[],rt=/<c\b([^>]*?)(?:(\/>)|(>([\s\S]*?)<\/c>))/g,at=L.matchAll(rt),ft=H.match(/r="(\d+)"/),J=ft?parseInt(ft[1])-1:z+1;z=J;let st=-1;for(let lt of at){let dt=lt[0],et=lt[1],vt=lt[4]||"",bt=et.match(/t="([a-zA-Z]+)"/),Ft=bt?bt[1]:"n",Ct=vt.match(/<v>([\s\S]*?)<\/v>/),mt=vt.match(/<t>([\s\S]*?)<\/t>/),ot="",ht=[];if(Ft==="s"&&Ct){let Pt=parseInt(Ct[1]),wt=p[Pt];Array.isArray(wt)?(ht=JSON.parse(JSON.stringify(wt)),ot=ht.map(kt=>kt.text).join("")):ot=wt||""}else Ft==="inlineStr"&&mt?ot=mt[1].trim():Ct&&(ot=Ct[1].trim());let gt=et.match(/r="([A-Z]+)(\d+)"/),Et;if(gt?Et=W(gt[1]):Et=st+1,st=Et,ot||ht.length>0){let Pt=et.match(/s="(\d+)"/),wt=Pt?parseInt(Pt[1]):void 0,kt=wt!==void 0&&y[wt]?y[wt]:{};if(ht.length>0)for(let O of ht)O.formatting||(O.formatting={}),kt.backgroundColor&&(O.formatting.backgroundColor=kt.backgroundColor),kt.alignment&&(O.formatting.alignment=kt.alignment),!O.formatting.font&&kt.font&&(O.formatting.font=kt.font),!O.formatting.size&&kt.size&&(O.formatting.size=kt.size);else ht.push({type:"text",text:ot,formatting:kt});let St={type:"cell",text:ot,children:ht,metadata:{row:J,col:Et}};t.includeRawContent&&(St.rawContent=dt),tt.push(St)}}if(tt.length>0){let lt={type:"row",children:tt,metadata:void 0};t.includeRawContent&&(lt.rawContent=G),X.push(lt)}}if(t.extractAttachments){let G=`xl/worksheets/_rels/${Y.path.split("/").pop()||""}.rels`,H=d.find(tt=>tt.path===G),V={};if(H){let tt=le(H.content.toString()),rt=ut(tt,"Relationship");for(let at of rt){let ft=at.getAttribute("Id"),J=at.getAttribute("Target"),st=at.getAttribute("Type");ft&&J&&st&&st.includes("drawing")&&(V[ft]="xl/drawings/"+J.replace("../drawings/",""))}}let L=Y.content.toString().match(/<drawing r:id="(.*?)"/g);if(L)for(let tt of L){let rt=tt.match(/r:id="(.*?)"/),at=rt?rt[1]:null;if(at&&V[at]){let ft=V[at],J=C[ft];if(J)for(let lt in J){let dt=J[lt],et=x.find(vt=>vt.name===dt.path.split("/").pop());if(et){let vt={type:"image",text:"",children:[],metadata:{attachmentName:et.name||"unknown",altText:dt.altText||void 0}};X.push(vt)}}let st=E[ft];if(st)for(let lt in st){let dt=st[lt];if(x.find(vt=>vt.name===dt)){let vt={type:"chart",text:"",children:[],metadata:{attachmentName:dt}};X.push(vt)}}}}}let D=Y.path.split("/").pop()||"Sheet",F=S[D]||D;M.push({type:"sheet",children:X,metadata:{sheetName:F},rawContent:t.includeRawContent?Y.content.toString():void 0})}let j=d.find(Y=>Y.path.match(l)),$=j?no(j.content.toString()):{},q=d.find(Y=>Y.path.match(c));if(q){let Y=ku(q.content.toString());Object.keys(Y).length>0&&($.customProperties=Y)}let Q=Y=>{for(let X of Y){if("attachmentName"in(X.metadata||{})){let T=X.metadata,I=x.find(_=>_.name===T.attachmentName);I&&(X.type==="image"&&(I.ocrText&&(X.text=I.ocrText),T.altText&&(I.altText=T.altText)),X.type==="chart"&&I.chartData&&(X.text=I.chartData.rawTexts.join(t.newlineDelimiter)))}X.children&&Q(X.children)}};return Q(M),An("xlsx",$,M,x,t,()=>M.map(Y=>{let X=T=>{let I="";return T.children?I+=T.children.map(X).filter(_=>_!="").join(T.children[0]?.children?t.newlineDelimiter:""):I+=T.text||"",I};return X(Y)}).filter(Y=>Y!="").join(t.newlineDelimiter))};B();var eM=r=>{let t={},e=/([a-zA-Z0-9\-:]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+)))?/g,n;for(;(n=e.exec(r))!==null;){let i=n[1].toLowerCase(),s=n[2]!==void 0?n[2]:n[3]!==void 0?n[3]:n[4]||"";t[i]=s}return t},nM=r=>{let t={type:"element",tagName:"root",children:[],attributes:{}},e=t,n=0;for(;n<r.length;){let i=r.indexOf("<",n);if(i===-1){let p=r.substring(n);p&&e.children.push({type:"text",text:p,children:[],parent:e});break}if(i>n){let p=r.substring(n,i);p&&e.children.push({type:"text",text:p,children:[],parent:e})}if(r.startsWith("<!--",i)){let p=r.indexOf("-->",i+4);n=p!==-1?p+3:r.length;continue}let s=r.substring(i).match(/>/);if(!s){let p=r.substring(i);e.children.push({type:"text",text:p,children:[],parent:e});break}let a=r.substring(i+1,i+s.index);n=i+s.index+1;let l=a.startsWith("/"),c=a.endsWith("/"),u=a.replace(/^\/|\/$/g,"").trim(),h=u.search(/\s/),d=(h===-1?u:u.substring(0,h)).toLowerCase(),f=h===-1?"":u.substring(h);if(!d||!d.match(/^[a-z0-9\-]+$/)){e.children.push({type:"text",text:`<${a}>`,children:[],parent:e});continue}if(l){let p=e;for(;p&&p.tagName!==d;)p=p.parent;p&&p.parent&&(e=p.parent)}else{let p={type:"element",tagName:d,attributes:eM(f),children:[],parent:e};if(e.children.push(p),!c&&!new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr","!doctype"]).has(d)&&(e=p,d==="script"||d==="style")){let y=`</${d}>`,x=r.toLowerCase().indexOf(y,n);x!==-1&&(p.children.push({type:"text",text:r.substring(n,x),children:[],parent:p}),n=x+y.length,e=p.parent)}}}return t},GE=async(r,t)=>{let e=r.toString("utf-8"),n=nM(e),i,s=n,a=(m,y)=>{if(m.tagName===y)return m;for(let x of m.children){let b=a(x,y);if(b)return b}},l=a(n,"html");l&&(i=a(l,"head"),s=a(l,"body")||l);let c={},u=[];if(i){let m=a(i,"title");m&&m.children.length>0&&m.children[0].text&&(c.title=m.children[0].text);let y=N=>{for(let k of i.children)if(k.tagName==="meta"&&(k.attributes?.name===N||k.attributes?.property===N))return k.attributes?.content},x=y("author");x&&(c.author=x);let b=y("description");b&&(c.description=b);let w=y("dcterms.created");w&&(c.created=new Date(w));let C=y("dcterms.modified");C&&(c.modified=new Date(C));let E=y("lastModifiedBy");E&&(c.lastModifiedBy=E);let S={};for(let N of i.children)if(N.tagName==="meta"&&N.attributes?.name?.startsWith("custom:")){let k=N.attributes.name.substring(7),M=N.attributes.content||"";M==="true"?S[k]=!0:M==="false"?S[k]=!1:!isNaN(Number(M))&&M.trim()!==""?S[k]=Number(M):!isNaN(Date.parse(M))&&M.includes(":")?S[k]=new Date(M):S[k]=M}Object.keys(S).length>0&&(c.customProperties=S)}let h=[],d=1,f=(m,y={},x)=>{if(m.type==="text"){let b=(m.text||"").replace(/ /g," ").replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&").replace(/"/g,'"').replace(/'/g,"'");if(t.preserveXmlWhitespace||(b=b.replace(/\s+/g," ")),!b.trim()&&!t.preserveXmlWhitespace)return null;let w={type:"text",text:b,formatting:Object.keys(y).length>0?{...y}:void 0};return t.includeRawContent&&m.text&&(w.rawContent=m.text),w}if(m.type==="element"&&m.tagName){let b=m.tagName,w={...y};(b==="b"||b==="strong")&&(w.bold=!0),(b==="i"||b==="em")&&(w.italic=!0),b==="u"&&(w.underline=!0),(b==="strike"||b==="s"||b==="del")&&(w.strikethrough=!0),b==="sub"&&(w.subscript=!0),b==="sup"&&(w.superscript=!0),b==="code"&&(w.font="monospace");let C=m.attributes?.style||"",E=m.attributes?.align||"";if(C||E){C.includes("font-weight: bold")&&(w.bold=!0),C.includes("font-style: italic")&&(w.italic=!0),C.includes("text-decoration: underline")&&(w.underline=!0),C.includes("text-decoration: line-through")&&(w.strikethrough=!0);let k=C.match(/color:\s*([^;]+)/);k&&(w.color=k[1].trim());let M=C.match(/background-color:\s*([^;]+)/);M&&(w.backgroundColor=M[1].trim());let R=C.match(/font-size:\s*([^;]+)/);R&&(w.size=R[1].trim());let j=C.match(/font-family:\s*([^;]+)/);j&&(w.font=j[1].trim().split(",")[0].replace(/['"]/g,""));let $=C.match(/text-align:\s*(left|center|right|justify)/);if($)w.alignment=$[1].toLowerCase();else if(E){let q=E.toLowerCase();["left","center","right","justify"].includes(q)&&(w.alignment=q)}}let S=m.attributes?.id?[m.attributes.id]:[],N=(k,M,R)=>{let j=[];for(let $ of k.children){let q=f($,M,R);q&&(Array.isArray(q)?j.push(...q):j.push(q))}return j};if(b==="div"&&(m.attributes?.class==="container"||m.attributes?.class==="spreadsheet-container"||m.attributes?.class==="presentation-container"||m.attributes?.class==="pdf-container"||m.attributes?.class==="metadata-summary"||m.attributes?.class==="image-container"||m.attributes?.class==="chart-container"||m.attributes?.class==="table-container"||m.attributes?.class==="caption"||m.attributes?.class==="sheet"||m.attributes?.class==="page"||m.attributes?.class==="slide"||m.attributes?.class==="note-content")||b==="article")return N(m,w,x);if(b==="p"||b==="div"){let k=N(m,w,x),M=k.some($=>["paragraph","table","heading","list","image","chart","code"].includes($.type));if(b==="div"&&M)return k;let R=[];for(let $ of k)$.type==="paragraph"&&$.children?R.push(...$.children):R.push($);let j={type:"paragraph",metadata:{alignment:w.alignment,anchorIds:S.length>0?S:void 0},children:R};return t.includeRawContent,j}if(b.match(/^h[1-6]$/))return{type:"heading",metadata:{level:parseInt(b.substring(1)),alignment:w.alignment,anchorIds:S.length>0?S:void 0},children:N(m,w,x)};if(b==="ul"||b==="ol"){let k=!x,M={listId:k?`html-list-${d++}`:x.listId,type:b==="ol"?"ordered":"unordered",level:k?0:x.level+1,counters:k?{}:{...x.counters}};if(b==="ol"&&m.attributes?.start){let R=parseInt(m.attributes.start,10);M.counters[M.level]=isNaN(R)?0:R-1}else M.counters[M.level]=0;return N(m,y,M)}if(b==="li"){if(x)if(m.attributes?.value){let $=parseInt(m.attributes.value,10);isNaN($)||(x.counters[x.level]=$)}else x.counters[x.level]++;let k=N(m,w,x),M=k.filter($=>$.type==="list"),R=k.filter($=>$.type!=="list");return[{type:"list",text:R.map($=>$.text||"").join(""),metadata:{listType:x?.type||"unordered",indentation:x?.level||0,alignment:w.alignment||"left",listId:x?.listId||"html-list-none",itemIndex:(x?.counters[x.level]??1)-1,anchorIds:S.length>0?S:void 0},children:R},...M]}if(b==="table"){let k={type:"table",metadata:{anchorIds:S.length>0?S:void 0},children:N(m,w,x)};return t.includeRawContent&&(k.rawContent="<table>...</table>"),k}if(b==="tr"){let k={type:"row",children:N(m,w,x)};return t.includeRawContent&&(k.rawContent="<tr>...</tr>"),k}if(b==="td"||b==="th"){let k={type:"cell",children:N(m,w,x)};return t.includeRawContent&&(k.rawContent="<td>...</td>"),k}if(b==="img"){let k=m.attributes?.src,M=m.attributes?.alt,R;if(k?.startsWith("data:")){let j=k.match(/^data:([^;]+);base64,(.*)$/);if(j&&t.extractAttachments){let $=j[1],q=j[2],Q=`image_${u.length+1}.${$.split("/")[1]}`;u.push({type:"image",mimeType:$,data:q,name:Q,extension:$.split("/")[1]}),R={type:"image",metadata:{attachmentName:Q,altText:M}}}else R={type:"image",metadata:{url:k,altText:M}}}else R={type:"image",metadata:{url:k,altText:M,anchorIds:S.length>0?S:void 0}};return t.includeRawContent&&(R.rawContent="<img>"),R}if(b==="a"){let k=m.attributes?.href,M=N(m,w,x);if(k){let R=k.startsWith("#")?"internal":"external";M.forEach(j=>{j.type==="text"&&(j.metadata={...j.metadata,link:k,linkType:R})})}return M}if(b==="br"){let k={type:"break",metadata:{breakType:"textWrapping"}};return t.includeRawContent&&(k.rawContent="<br/>"),k}if(b==="pre"){let k=m.children.find($=>$.tagName==="code"),M,R="";if(k){let q=(k.attributes?.class||"").split(" ").find(Q=>Q.startsWith("language-"));q&&(M=q.replace("language-","")),R=k.children.map(Q=>Q.text||"").join("")}else R=m.children.map($=>$.text||"").join("");let j={type:"code",text:R,metadata:{language:M,anchorIds:S.length>0?S:void 0}};return t.includeRawContent&&(j.rawContent="<pre>...</pre>"),j}return b==="script"||b==="style"||b==="!doctype"?null:N(m,w,x)}return null};for(let m of s.children){let y=f(m);y&&(Array.isArray(y)?y.forEach(x=>{x.type==="text"?h.push({type:"paragraph",children:[x]}):h.push(x)}):y.type==="text"?h.push({type:"paragraph",children:[y]}):h.push(y))}return An("html",c,h,u,t,()=>h.map(m=>{let y=x=>{if(x.type==="text"||x.type==="code")return x.text||"";if(x.type==="break")return`
|
|
719
|
+
`))};B();B();B();var Yg=ru(QC());B();function ls(r){if(r)try{if(r.startsWith("D:"))return b_(r);let t=new Date(r);return isNaN(t.getTime())?void 0:t}catch{return}}function b_(r){try{let t=r.slice(2),e=parseInt(t.slice(0,4),10),n=parseInt(t.slice(4,6),10)-1,i=parseInt(t.slice(6,8),10)||1,s=parseInt(t.slice(8,10),10)||0,a=parseInt(t.slice(10,12),10)||0,l=parseInt(t.slice(12,14),10)||0,c=t.slice(14).match(/([+-Z])(\d{2})'?(\d{2})?'?/);if(c){if(c[1]==="Z")return new Date(Date.UTC(e,n,i,s,a,l));let u=c[1]==="-"?-1:1,h=parseInt(c[2],10)||0,d=parseInt(c[3],10)||0,f=u*(h*60+d),p=Date.UTC(e,n,i,s,a,l);return new Date(p-f*6e4)}return new Date(e,n,i,s,a,l)}catch{return}}var Oe=r=>r.nodeType===1,le=(r,t={})=>{let e=new Yg.DOMParser(t),n=r.charCodeAt(0)===65279?r.slice(1):r.trim();return e.parseFromString(n,"text/xml")},ut=(r,t)=>{let e=Array.from(r.getElementsByTagName(t));if(e.length===0&&t.includes(":")){let n=t.split(":").pop();return Array.from(r.getElementsByTagName(n))}return e},x_=new Yg.XMLSerializer,fx=(r,t={})=>x_.serializeToString(r),w_=(r,t)=>{if(!r||typeof r.lineNumber!="number"||typeof r.columnNumber!="number")return;let e=t.split(`
|
|
720
|
+
`),n=0;for(let i=0;i<r.lineNumber-1;i++)n+=e[i].length+1;if(n+=r.columnNumber-1,Oe(r)){let s=`</${r.tagName}>`,a=t.indexOf(s,n);if(a!==-1)return t.substring(n,a+s.length);let l=t.indexOf("/>",n),c=t.indexOf("<",n+1);if(l!==-1&&(c===-1||l<c))return t.substring(n,l+2)}},ee=(r,t,e)=>{if(e.serializeRawContent===!1){let n=w_(r,t);if(n)return n}return fx(r,{preserveWhitespace:e.preserveXmlWhitespace})},pt=(r,t)=>{let e=r.getElementsByTagName(t);if(e&&e.length>0)return e[0]};var Qe=(r,t)=>{let e=[];if(!r.childNodes)return e;for(let n=0;n<r.childNodes.length;n++){let i=r.childNodes[n];Oe(i)&&i.tagName===t&&e.push(i)}return e},no=r=>{let t=le(r),e={},n=ut(t,"cp:coreProperties")[0];if(n){let s=ut(n,"dc:title")[0];s&&s.textContent&&(e.title=s.textContent);let a=ut(n,"dc:creator")[0];a&&a.textContent&&(e.author=a.textContent);let l=ut(n,"cp:lastModifiedBy")[0];l&&l.textContent&&(e.lastModifiedBy=l.textContent);let c=ut(n,"dcterms:created")[0];c&&c.textContent&&(e.created=ls(c.textContent));let u=ut(n,"dcterms:modified")[0];u&&u.textContent&&(e.modified=ls(u.textContent));let h=ut(n,"dc:description")[0];h&&h.textContent&&(e.description=h.textContent);let d=ut(n,"dc:subject")[0];return d&&d.textContent&&(e.subject=d.textContent),e}let i=ut(t,"office:meta")[0];if(i){let s=ut(i,"dc:title")[0];s&&s.textContent&&(e.title=s.textContent);let a=ut(i,"dc:creator")[0];a&&a.textContent&&(e.author=a.textContent);let l=ut(i,"dc:description")[0];l&&l.textContent&&(e.description=l.textContent);let c=ut(i,"dc:subject")[0];c&&c.textContent&&(e.subject=c.textContent);let u=ut(i,"meta:creation-date")[0];u&&u.textContent&&(e.created=ls(u.textContent));let h=ut(i,"dc:date")[0];h&&h.textContent&&(e.modified=ls(h.textContent));let d=ut(i,"meta:user-defined");if(d.length>0){let f={};for(let p of d){let m=p.getAttribute("meta:name");if(!m||!p.textContent)continue;let y=p.getAttribute("meta:value-type")||"string",x=p.textContent;if(y==="boolean")f[m]=x.toLowerCase()==="true";else if(y==="float"){let b=Number(x);isNaN(b)||(f[m]=b)}else if(y==="date"||y==="time"){let b=ls(x);b?f[m]=b:f[m]=x}else f[m]=x}Object.keys(f).length>0&&(e.customProperties=f)}}return e},ku=r=>{let t=le(r),e={},n=ut(t,"property");for(let i of n){let s=i.getAttribute("name");if(s)for(let a=0;a<i.childNodes.length;a++){let l=i.childNodes[a];if(l.nodeType!==1)continue;let c=l,u=c.tagName||"",h=c.textContent||"";if(/vt:lpwstr|vt:lpstr|vt:bstr/.test(u))e[s]=h;else if(/vt:bool/.test(u))e[s]=h.toLowerCase()==="true";else if(/vt:(i[1248]|ui[1248]|int|uint|r4|r8|decimal)/.test(u)){let d=Number(h);isNaN(d)||(e[s]=d)}else if(/vt:filetime|vt:date/.test(u)){let d=ls(h);d?e[s]=d:e[s]=h}else h&&(e[s]=h);break}}return e};var hf=(r,t)=>{let e=r.localName===t||r.tagName===t?r:r.getElementsByTagName(t)[0];if(!e)return;let n=e.getElementsByTagName("c:rich"),i=e.getElementsByTagName("a:p"),s=n.length>0?Array.from(n):Array.from(i);if(s.length>0){let l="";for(let c of s){let u=c.getElementsByTagName("a:t");for(let h=0;h<u.length;h++)l+=(u[h].textContent||"")+" "}if(l.trim())return l.trim()}let a=e.getElementsByTagName("c:v")[0];if(a&&a.textContent)return a.textContent.trim()||void 0},A_=r=>{let t=r.toString("utf8"),n=le(t).documentElement;if(!n)return{title:void 0,xAxisTitle:void 0,yAxisTitle:void 0,dataSets:[],labels:[],rawTexts:[]};let i=hf(n,"c:title"),s,a,l=n.getElementsByTagName("c:catAx");l.length>0&&(s=hf(l[0],"c:title"));let c=n.getElementsByTagName("c:valAx");c.length>0&&(a=hf(c[0],"c:title"));let u=n.getElementsByTagName("c:ser"),h=[],d=[];for(let p=0;p<u.length;p++){let m=u[p],y=hf(m,"c:tx"),x=[],b=m.getElementsByTagName("c:val")[0]||m.getElementsByTagName("c:yVal")[0];if(b){let S=b.getElementsByTagName("c:v");for(let N=0;N<S.length;N++){let k=S[N].textContent?.trim();k&&x.push(k)}}let w=[],C=m.getElementsByTagName("c:dLbl");for(let S=0;S<C.length;S++){let N=hf(C[S],"c:tx");N&&w.push(N)}let E=m.getElementsByTagName("c:cat")[0]||m.getElementsByTagName("c:xVal")[0];if(E){let S=E.getElementsByTagName("c:v"),N=[];for(let k=0;k<S.length;k++){let M=S[k].textContent?.trim();M&&N.push(M)}N.length>0&&d.length===0&&d.push(...N)}h.push({name:y,values:x,pointLabels:w})}let f=[];for(let p of h)p.name&&f.push(p.name),f.push(...d),f.push(...p.values);return{title:i,xAxisTitle:s,yAxisTitle:a,dataSets:h,labels:d,rawTexts:f}},v_=r=>{let t=r.toString("utf8"),e=le(t),n=ut(e,"chart:chart")[0]||e.documentElement,i=ut(n,"chart:title")[0],s=i&&ut(i,"text:p")[0]?.textContent||void 0,a=ut(n,"table:table")[0],l=[],c=[],u=[];if(a){let p=[],m=Qe(a,"table:table-header-rows")[0];if(m&&p.push(...Qe(m,"table:table-row")),p.push(...Qe(a,"table:table-row")),p.length>0){let y=Qe(p[0],"table:table-cell");for(let x=1;x<y.length;x++){let b=parseInt(y[x].getAttribute("table:number-columns-repeated")||"1"),w=Qe(y[x],"text:p")[0]?.textContent||void 0;for(let C=0;C<b;C++)l.push({name:w,values:[],pointLabels:[]})}for(let x=1;x<p.length;x++){let b=Qe(p[x],"table:table-cell");if(b.length>0){let w=Qe(b[0],"text:p")[0]?.textContent||void 0;w&&c.push(w);let C=0;for(let E=1;E<b.length;E++){let S=parseInt(b[E].getAttribute("table:number-columns-repeated")||"1"),N=b[E].getAttribute("office:value")||Qe(b[E],"text:p")[0]?.textContent||"";for(let k=0;k<S;k++)l[C]&&l[C].values.push(N),C++}}}}}else{let p=ut(n,"chart:series");for(let y of p){let x=y.getAttribute("chart:label-cell-address"),b=y.getAttribute("chart:values-cell-range-address"),w,C=ut(y,"text:p");C.length>0&&(w=C[0].textContent||void 0),!w&&x&&(w=`Series ${x.split(".").pop()?.replace(/\$/g,"")||x}`);let E={name:w,values:[],pointLabels:[]};b&&E.values.push(`[${b}]`),l.push(E)}let m=ut(n,"chart:categories")[0];if(m){let y=m.getAttribute("table:cell-range-address");y&&c.push(`[${y}]`)}}let h=ut(e,"chart:axis"),d,f;for(let p of h){let m=p.getAttribute("chart:dimension"),y=ut(p,"chart:title")[0],x=y&&ut(y,"text:p")[0]?.textContent||void 0;m==="x"?d=x:m==="y"&&(f=x)}s&&u.push(s);for(let p of l)p.name&&u.push(p.name),u.push(...c),u.push(...p.values);return{title:s,xAxisTitle:d,yAxisTitle:f,dataSets:l,labels:c,rawTexts:u}},dl=r=>r.toString("utf8",0,500).includes("urn:oasis:names:tc:opendocument:xmlns:chart:1.0")?v_(r):A_(r);B();var C_=r=>{switch(r.toLowerCase()){case"jpg":case"jpeg":return"image/jpeg";case"png":return"image/png";case"gif":return"image/gif";case"bmp":return"image/bmp";case"tiff":return"image/tiff";case"webp":return"image/webp";default:return"application/octet-stream"}},E_=r=>{if(!(r.length<4)){if(r[0]===137&&r[1]===80&&r[2]===78&&r[3]===71)return"image/png";if(r[0]===255&&r[1]===216&&r[2]===255)return"image/jpeg";if(r[0]===71&&r[1]===73&&r[2]===70&&r[3]===56)return"image/gif";if(r[0]===66&&r[1]===77)return"image/bmp";if(r[0]===73&&r[1]===73&&r[2]===42&&r[3]===0||r[0]===77&&r[1]===77&&r[2]===0&&r[3]===42)return"image/tiff";if(r.length>=12&&r[0]===82&&r[1]===73&&r[2]===70&&r[3]===70&&r[8]===87&&r[9]===69&&r[10]===66&&r[11]===80)return"image/webp"}},Mr=(r,t)=>{let e=r.split(".").pop()||"",n=E_(t);return n||(n=C_(e)),{type:"image",mimeType:n,data:t.toString("base64"),name:r,extension:e}};B();var io=class io{constructor(){U(this,"pool",[]);U(this,"queue",[]);U(this,"MAX_WORKERS",4);U(this,"idleTimeout",1e4);U(this,"timeoutId",null)}static getInstance(){return io.instance||(io.instance=new io),io.instance}static hasInstance(){return!!io.instance}resetIdleTimer(){this.timeoutId&&clearTimeout(this.timeoutId),this.idleTimeout>0&&(this.timeoutId=setTimeout(async()=>{await this.terminate()},this.idleTimeout))}async recognize(t,e){return new Promise((n,i)=>{e?.autoTerminateTimeout!==void 0&&(this.idleTimeout=e.autoTerminateTimeout),this.resetIdleTimer(),this.queue.push({image:t,config:e||{},resolve:n,reject:i}),this.processQueue()})}async processQueue(){if(this.queue.length===0)return;let t=this.queue[0],e=t.config.language||"eng",n=this.pool.find(i=>!i.isBusy&&i.language===e);if(!n&&this.pool.length<this.MAX_WORKERS)try{let{createWorker:i}=await Promise.resolve().then(()=>ru(zE())),s={logger:()=>{}};t.config.workerPath&&(s.workerPath=t.config.workerPath),t.config.corePath&&(s.corePath=t.config.corePath),t.config.langPath&&(s.langPath=t.config.langPath),n={worker:await i(e,1,s),language:e,lastUsed:Date.now(),isBusy:!1},this.pool.push(n)}catch(i){this.queue.shift()?.reject(i),this.processQueue();return}if(!n){let i=this.pool.filter(s=>!s.isBusy);if(i.length>0){n=i.reduce((s,a)=>s.lastUsed<a.lastUsed?s:a);try{await n.worker.reinitialize(e),n.language=e}catch(s){this.queue.shift()?.reject(s),this.processQueue();return}}}if(n){let i=this.queue.shift();if(!i)return;n.isBusy=!0,n.lastUsed=Date.now();try{let{data:{text:s}}=await n.worker.recognize(i.image);i.resolve(s)}catch(s){i.reject(s)}finally{n.isBusy=!1,n.lastUsed=Date.now(),this.processQueue()}}}async terminate(){this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=null);let t=this.pool.map(e=>e.worker.terminate());await Promise.all(t),this.pool=[]}};U(io,"instance");var ff=io,lr=async(r,t)=>{let e=r;return _r&&typeof Blob<"u"&&ct.Buffer.isBuffer(r)&&(e=new Blob([r],{type:"image/bmp"})),await ff.getInstance().recognize(e,t)},jE=async()=>{ff.hasInstance()&&await ff.getInstance().terminate()};B();var ro=(r,t)=>new Promise((e,n)=>{Bv(new Uint8Array(r.buffer,r.byteOffset,r.byteLength),{filter:i=>t(i.name)},(i,s)=>{if(i)return n(i);e(Object.entries(s).map(([a,l])=>({path:a,content:ct.Buffer.from(l)})))})});var GE=async(r,t)=>{let e=/xl\/worksheets\/sheet\d+.xml/g,n=/xl\/drawings\/drawing\d+.xml/g,i=/xl\/charts\/chart\d+.xml/g,s="xl/sharedStrings.xml",a=/xl\/media\/.*/,l=/docProps\/core\.xml/,c=/docProps\/custom\.xml/,u=/xl\/worksheets\/_rels\/sheet\d+\.xml\.rels/g,h=/xl\/drawings\/_rels\/drawing\d+\.xml\.rels/g,d=await ro(r,Y=>!!Y.match(e)||!!Y.match(n)||!!Y.match(i)||Y===s||Y==="xl/styles.xml"||Y==="xl/workbook.xml"||Y==="xl/_rels/workbook.xml.rels"||!!Y.match(l)||!!Y.match(c)||!!t.extractAttachments&&(!!Y.match(a)||!!Y.match(u)||!!Y.match(h))),f=d.find(Y=>Y.path===s),p=[];if(f){let Y=le(f.content.toString()),X=ut(Y,"si");for(let T of X){let I=ut(T,"r");if(I.length>0){let _=[];for(let W of I){let z=ut(W,"t")[0];if(z){let D=z.textContent||"",F=ut(W,"rPr")[0],P={};if(F){ut(F,"b").length>0&&(P.bold=!0),ut(F,"i").length>0&&(P.italic=!0),ut(F,"u").length>0&&(P.underline=!0),ut(F,"strike").length>0&&(P.strikethrough=!0);let G=ut(F,"sz")[0];G&&(P.size=G.getAttribute("val")+"pt");let H=ut(F,"color")[0];if(H){let tt=H.getAttribute("rgb");tt&&(P.color="#"+tt.substring(2))}let V=ut(F,"rFont")[0];V&&(P.font=V.getAttribute("val")||void 0);let L=ut(F,"vertAlign")[0];if(L){let tt=L.getAttribute("val");tt==="subscript"&&(P.subscript=!0),tt==="superscript"&&(P.superscript=!0)}}_.push({type:"text",text:D,formatting:Object.keys(P).length>0?P:void 0})}}p.push(_)}else{let _=ut(T,"t"),W="";for(let z of _)W+=z.textContent||"";p.push(W)}}}let m=d.find(Y=>Y.path==="xl/styles.xml"),y={};if(m){let Y=le(m.content.toString()),X=ut(Y,"fonts")[0],T=[];if(X){let z=ut(X,"font");for(let D of z){let F={};ut(D,"b").length>0&&(F.bold=!0),ut(D,"i").length>0&&(F.italic=!0),ut(D,"u").length>0&&(F.underline=!0),ut(D,"strike").length>0&&(F.strikethrough=!0);let P=ut(D,"sz")[0];if(P){let L=P.getAttribute("val");L&&(F.size=L+"pt")}let G=ut(D,"color")[0];if(G){let L=G.getAttribute("rgb");L&&(F.color="#"+L.substring(2))}let H=ut(D,"name")[0];if(H){let L=H.getAttribute("val");L&&(F.font=L)}let V=ut(D,"vertAlign")[0];if(V){let L=V.getAttribute("val");L==="subscript"&&(F.subscript=!0),L==="superscript"&&(F.superscript=!0)}T.push(F)}}let I=ut(Y,"fills")[0],_=[];if(I){let z=ut(I,"fill");for(let D of z){let F={},P=ut(D,"patternFill")[0];if(P){let G=ut(P,"fgColor")[0];if(G){let H=G.getAttribute("rgb"),V=G.getAttribute("theme");if(H&&H!=="00000000")F.backgroundColor="#"+H.substring(2);else if(V){let L=parseInt(V);L===0?F.backgroundColor="#FFFFFF":L===1?F.backgroundColor="#000000":L===2?F.backgroundColor="#EEECE1":L===3&&(F.backgroundColor="#1F497D")}}}_.push(F)}}let W=ut(Y,"cellXfs")[0];if(W){let z=ut(W,"xf");for(let D=0;D<z.length;D++){let F=z[D],P={},G=F.getAttribute("fontId");if(G){let L=parseInt(G);T[L]&&Object.assign(P,T[L])}let H=F.getAttribute("fillId");if(H){let L=parseInt(H);_[L]&&_[L].backgroundColor&&(P.backgroundColor=_[L].backgroundColor)}let V=ut(F,"alignment")[0];if(V){let L=V.getAttribute("horizontal");(L==="center"||L==="right"||L==="justify"||L==="left")&&(P.alignment=L)}y[D]=P}}}let x=[],b=d.filter(Y=>Y.path.match(/xl\/media\/.*/)),w=d.filter(Y=>Y.path.match(i)),C={};if(t.extractAttachments){let Y=d.filter(T=>T.path.match(h));for(let T of Y){let _=`xl/drawings/${T.path.split("/").pop()?.replace(".rels","")||""}`,W=le(T.content.toString()),z=ut(W,"Relationship");C[_]||(C[_]={});for(let D of z){let F=D.getAttribute("Id"),P=D.getAttribute("Target");if(F&&P&&P.includes("media/")){let G="xl/"+P.replace("../","");C[_][F]={path:G}}}}let X=d.filter(T=>T.path.match(n));for(let T of X){let I=le(T.content.toString()),_=ut(I,"xdr:pic"),W=C[T.path]||{};for(let z of _){let D=ut(z,"xdr:blipFill")[0],F=D?ut(D,"a:blip")[0]:null,P=F?F.getAttribute("r:embed"):null,G=ut(z,"xdr:nvPicPr")[0],H=G?ut(G,"xdr:cNvPr")[0]:null,V=H?H.getAttribute("descr")||H.getAttribute("name"):void 0;P&&W[P]&&(W[P].altText=V||"")}}for(let T of b){let I=Mr(T.path.split("/").pop()||"image",T.content),_="";for(let W in C){for(let z in C[W])if(C[W][z].path===T.path){_=C[W][z].altText||"";break}if(_)break}if(_&&(I.altText=_),x.push(I),t.ocr&&I.mimeType.startsWith("image/"))try{let W=(await lr(T.content,{...t.ocrConfig})).trim();W&&(I.ocrText=W)}catch(W){Ce("OCR_FAILED",t,I.name,W)}}for(let T of w){let I={type:"chart",mimeType:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",data:T.content.toString("base64"),name:T.path.split("/").pop()||"",extension:"xml"};try{let _=dl(T.content);I.chartData=_}catch(_){Ce("CHART_DATA_EXTRACTION_FAILED",t,T.path,_)}x.push(I)}}let E={};if(t.extractAttachments){let Y=d.filter(X=>X.path.match(h));for(let X of Y){let I=`xl/drawings/${X.path.split("/").pop()?.replace(".rels","")||""}`,_=le(X.content.toString()),W=ut(_,"Relationship");E[I]||(E[I]={});for(let z of W){let D=z.getAttribute("Id"),F=z.getAttribute("Target"),P=z.getAttribute("Type");if(D&&F&&P&&P.includes("chart")){let G=F.split("/").pop()||"";E[I][D]=G}}}}let S={},N=d.find(Y=>Y.path==="xl/workbook.xml"),k=d.find(Y=>Y.path==="xl/_rels/workbook.xml.rels");if(N&&k){let Y=le(k.content.toString()),X=ut(Y,"Relationship"),T={};for(let W of X){let z=W.getAttribute("Id"),D=W.getAttribute("Target");if(z&&D){let F=D.split("/").pop()||"";T[z]=F}}let I=le(N.content.toString()),_=ut(I,"sheet");for(let W of _){let z=W.getAttribute("name"),D=W.getAttribute("r:id");z&&D&&T[D]&&(S[T[D]]=z)}}let M=[],R=[];for(let Y of d)if(!Y.path.match(a)&&Y.path!==s&&Y.path!=="xl/styles.xml"&&!Y.path.match(n)&&!Y.path.match(i)&&!Y.path.match(u)&&!Y.path.match(h)&&Y.path.match(e)){t.includeRawContent&&R.push(Y.content.toString());let X=[],T=Y.content.toString(),I=/<row\b([^>]*?)(?:(\/>)|(>([\s\S]*?)<\/row>))/g,_=T.matchAll(I),W=P=>{let G=0;for(let H=0;H<P.length;H++)G=G*26+(P.charCodeAt(H)-65+1);return G-1},z=-1;for(let P of _){let G=P[0],H=P[1],V=!!P[2],L=P[4]||"";if(!V&&!L.includes("<c"))continue;let tt=[],rt=/<c\b([^>]*?)(?:(\/>)|(>([\s\S]*?)<\/c>))/g,at=L.matchAll(rt),ft=H.match(/r="(\d+)"/),J=ft?parseInt(ft[1])-1:z+1;z=J;let st=-1;for(let lt of at){let dt=lt[0],et=lt[1],vt=lt[4]||"",bt=et.match(/t="([a-zA-Z]+)"/),Ft=bt?bt[1]:"n",Ct=vt.match(/<v>([\s\S]*?)<\/v>/),mt=vt.match(/<t>([\s\S]*?)<\/t>/),ot="",ht=[];if(Ft==="s"&&Ct){let Pt=parseInt(Ct[1]),wt=p[Pt];Array.isArray(wt)?(ht=JSON.parse(JSON.stringify(wt)),ot=ht.map(kt=>kt.text).join("")):ot=wt||""}else Ft==="inlineStr"&&mt?ot=mt[1].trim():Ct&&(ot=Ct[1].trim());let gt=et.match(/r="([A-Z]+)(\d+)"/),Et;if(gt?Et=W(gt[1]):Et=st+1,st=Et,ot||ht.length>0){let Pt=et.match(/s="(\d+)"/),wt=Pt?parseInt(Pt[1]):void 0,kt=wt!==void 0&&y[wt]?y[wt]:{};if(ht.length>0)for(let O of ht)O.formatting||(O.formatting={}),kt.backgroundColor&&(O.formatting.backgroundColor=kt.backgroundColor),kt.alignment&&(O.formatting.alignment=kt.alignment),!O.formatting.font&&kt.font&&(O.formatting.font=kt.font),!O.formatting.size&&kt.size&&(O.formatting.size=kt.size);else ht.push({type:"text",text:ot,formatting:kt});let St={type:"cell",text:ot,children:ht,metadata:{row:J,col:Et}};t.includeRawContent&&(St.rawContent=dt),tt.push(St)}}if(tt.length>0){let lt={type:"row",children:tt,metadata:void 0};t.includeRawContent&&(lt.rawContent=G),X.push(lt)}}if(t.extractAttachments){let G=`xl/worksheets/_rels/${Y.path.split("/").pop()||""}.rels`,H=d.find(tt=>tt.path===G),V={};if(H){let tt=le(H.content.toString()),rt=ut(tt,"Relationship");for(let at of rt){let ft=at.getAttribute("Id"),J=at.getAttribute("Target"),st=at.getAttribute("Type");ft&&J&&st&&st.includes("drawing")&&(V[ft]="xl/drawings/"+J.replace("../drawings/",""))}}let L=Y.content.toString().match(/<drawing r:id="(.*?)"/g);if(L)for(let tt of L){let rt=tt.match(/r:id="(.*?)"/),at=rt?rt[1]:null;if(at&&V[at]){let ft=V[at],J=C[ft];if(J)for(let lt in J){let dt=J[lt],et=x.find(vt=>vt.name===dt.path.split("/").pop());if(et){let vt={type:"image",text:"",children:[],metadata:{attachmentName:et.name||"unknown",altText:dt.altText||void 0}};X.push(vt)}}let st=E[ft];if(st)for(let lt in st){let dt=st[lt];if(x.find(vt=>vt.name===dt)){let vt={type:"chart",text:"",children:[],metadata:{attachmentName:dt}};X.push(vt)}}}}}let D=Y.path.split("/").pop()||"Sheet",F=S[D]||D;M.push({type:"sheet",children:X,metadata:{sheetName:F},rawContent:t.includeRawContent?Y.content.toString():void 0})}let j=d.find(Y=>Y.path.match(l)),$=j?no(j.content.toString()):{},q=d.find(Y=>Y.path.match(c));if(q){let Y=ku(q.content.toString());Object.keys(Y).length>0&&($.customProperties=Y)}let Q=Y=>{for(let X of Y){if("attachmentName"in(X.metadata||{})){let T=X.metadata,I=x.find(_=>_.name===T.attachmentName);I&&(X.type==="image"&&(I.ocrText&&(X.text=I.ocrText),T.altText&&(I.altText=T.altText)),X.type==="chart"&&I.chartData&&(X.text=I.chartData.rawTexts.join(t.newlineDelimiter)))}X.children&&Q(X.children)}};return Q(M),An("xlsx",$,M,x,t,()=>M.map(Y=>{let X=T=>{let I="";return T.children?I+=T.children.map(X).filter(_=>_!="").join(T.children[0]?.children?t.newlineDelimiter:""):I+=T.text||"",I};return X(Y)}).filter(Y=>Y!="").join(t.newlineDelimiter))};B();var eM=r=>{let t={},e=/([a-zA-Z0-9\-:]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+)))?/g,n;for(;(n=e.exec(r))!==null;){let i=n[1].toLowerCase(),s=n[2]!==void 0?n[2]:n[3]!==void 0?n[3]:n[4]||"";t[i]=s}return t},nM=r=>{let t={type:"element",tagName:"root",children:[],attributes:{}},e=t,n=0;for(;n<r.length;){let i=r.indexOf("<",n);if(i===-1){let p=r.substring(n);p&&e.children.push({type:"text",text:p,children:[],parent:e});break}if(i>n){let p=r.substring(n,i);p&&e.children.push({type:"text",text:p,children:[],parent:e})}if(r.startsWith("<!--",i)){let p=r.indexOf("-->",i+4);n=p!==-1?p+3:r.length;continue}let s=r.substring(i).match(/>/);if(!s){let p=r.substring(i);e.children.push({type:"text",text:p,children:[],parent:e});break}let a=r.substring(i+1,i+s.index);n=i+s.index+1;let l=a.startsWith("/"),c=a.endsWith("/"),u=a.replace(/^\/|\/$/g,"").trim(),h=u.search(/\s/),d=(h===-1?u:u.substring(0,h)).toLowerCase(),f=h===-1?"":u.substring(h);if(!d||!d.match(/^[a-z0-9\-]+$/)){e.children.push({type:"text",text:`<${a}>`,children:[],parent:e});continue}if(l){let p=e;for(;p&&p.tagName!==d;)p=p.parent;p&&p.parent&&(e=p.parent)}else{let p={type:"element",tagName:d,attributes:eM(f),children:[],parent:e};if(e.children.push(p),!c&&!new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr","!doctype"]).has(d)&&(e=p,d==="script"||d==="style")){let y=`</${d}>`,x=r.toLowerCase().indexOf(y,n);x!==-1&&(p.children.push({type:"text",text:r.substring(n,x),children:[],parent:p}),n=x+y.length,e=p.parent)}}}return t},HE=async(r,t)=>{let e=r.toString("utf-8"),n=nM(e),i,s=n,a=(m,y)=>{if(m.tagName===y)return m;for(let x of m.children){let b=a(x,y);if(b)return b}},l=a(n,"html");l&&(i=a(l,"head"),s=a(l,"body")||l);let c={},u=[];if(i){let m=a(i,"title");m&&m.children.length>0&&m.children[0].text&&(c.title=m.children[0].text);let y=N=>{for(let k of i.children)if(k.tagName==="meta"&&(k.attributes?.name===N||k.attributes?.property===N))return k.attributes?.content},x=y("author");x&&(c.author=x);let b=y("description");b&&(c.description=b);let w=y("dcterms.created");w&&(c.created=new Date(w));let C=y("dcterms.modified");C&&(c.modified=new Date(C));let E=y("lastModifiedBy");E&&(c.lastModifiedBy=E);let S={};for(let N of i.children)if(N.tagName==="meta"&&N.attributes?.name?.startsWith("custom:")){let k=N.attributes.name.substring(7),M=N.attributes.content||"";M==="true"?S[k]=!0:M==="false"?S[k]=!1:!isNaN(Number(M))&&M.trim()!==""?S[k]=Number(M):!isNaN(Date.parse(M))&&M.includes(":")?S[k]=new Date(M):S[k]=M}Object.keys(S).length>0&&(c.customProperties=S)}let h=[],d=1,f=(m,y={},x)=>{if(m.type==="text"){let b=(m.text||"").replace(/ /g," ").replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&").replace(/"/g,'"').replace(/'/g,"'");if(t.preserveXmlWhitespace||(b=b.replace(/\s+/g," ")),!b.trim()&&!t.preserveXmlWhitespace)return null;let w={type:"text",text:b,formatting:Object.keys(y).length>0?{...y}:void 0};return t.includeRawContent&&m.text&&(w.rawContent=m.text),w}if(m.type==="element"&&m.tagName){let b=m.tagName,w={...y};(b==="b"||b==="strong")&&(w.bold=!0),(b==="i"||b==="em")&&(w.italic=!0),b==="u"&&(w.underline=!0),(b==="strike"||b==="s"||b==="del")&&(w.strikethrough=!0),b==="sub"&&(w.subscript=!0),b==="sup"&&(w.superscript=!0),b==="code"&&(w.font="monospace");let C=m.attributes?.style||"",E=m.attributes?.align||"";if(C||E){C.includes("font-weight: bold")&&(w.bold=!0),C.includes("font-style: italic")&&(w.italic=!0),C.includes("text-decoration: underline")&&(w.underline=!0),C.includes("text-decoration: line-through")&&(w.strikethrough=!0);let k=C.match(/color:\s*([^;]+)/);k&&(w.color=k[1].trim());let M=C.match(/background-color:\s*([^;]+)/);M&&(w.backgroundColor=M[1].trim());let R=C.match(/font-size:\s*([^;]+)/);R&&(w.size=R[1].trim());let j=C.match(/font-family:\s*([^;]+)/);j&&(w.font=j[1].trim().split(",")[0].replace(/['"]/g,""));let $=C.match(/text-align:\s*(left|center|right|justify)/);if($)w.alignment=$[1].toLowerCase();else if(E){let q=E.toLowerCase();["left","center","right","justify"].includes(q)&&(w.alignment=q)}}let S=m.attributes?.id?[m.attributes.id]:[],N=(k,M,R)=>{let j=[];for(let $ of k.children){let q=f($,M,R);q&&(Array.isArray(q)?j.push(...q):j.push(q))}return j};if(b==="div"&&(m.attributes?.class==="container"||m.attributes?.class==="spreadsheet-container"||m.attributes?.class==="presentation-container"||m.attributes?.class==="pdf-container"||m.attributes?.class==="metadata-summary"||m.attributes?.class==="image-container"||m.attributes?.class==="chart-container"||m.attributes?.class==="table-container"||m.attributes?.class==="caption"||m.attributes?.class==="sheet"||m.attributes?.class==="page"||m.attributes?.class==="slide"||m.attributes?.class==="note-content")||b==="article")return N(m,w,x);if(b==="p"||b==="div"){let k=N(m,w,x),M=k.some($=>["paragraph","table","heading","list","image","chart","code"].includes($.type));if(b==="div"&&M)return k;let R=[];for(let $ of k)$.type==="paragraph"&&$.children?R.push(...$.children):R.push($);let j={type:"paragraph",metadata:{alignment:w.alignment,anchorIds:S.length>0?S:void 0},children:R};return t.includeRawContent,j}if(b.match(/^h[1-6]$/))return{type:"heading",metadata:{level:parseInt(b.substring(1)),alignment:w.alignment,anchorIds:S.length>0?S:void 0},children:N(m,w,x)};if(b==="ul"||b==="ol"){let k=!x,M={listId:k?`html-list-${d++}`:x.listId,type:b==="ol"?"ordered":"unordered",level:k?0:x.level+1,counters:k?{}:{...x.counters}};if(b==="ol"&&m.attributes?.start){let R=parseInt(m.attributes.start,10);M.counters[M.level]=isNaN(R)?0:R-1}else M.counters[M.level]=0;return N(m,y,M)}if(b==="li"){if(x)if(m.attributes?.value){let $=parseInt(m.attributes.value,10);isNaN($)||(x.counters[x.level]=$)}else x.counters[x.level]++;let k=N(m,w,x),M=k.filter($=>$.type==="list"),R=k.filter($=>$.type!=="list");return[{type:"list",text:R.map($=>$.text||"").join(""),metadata:{listType:x?.type||"unordered",indentation:x?.level||0,alignment:w.alignment||"left",listId:x?.listId||"html-list-none",itemIndex:(x?.counters[x.level]??1)-1,anchorIds:S.length>0?S:void 0},children:R},...M]}if(b==="table"){let k={type:"table",metadata:{anchorIds:S.length>0?S:void 0},children:N(m,w,x)};return t.includeRawContent&&(k.rawContent="<table>...</table>"),k}if(b==="tr"){let k={type:"row",children:N(m,w,x)};return t.includeRawContent&&(k.rawContent="<tr>...</tr>"),k}if(b==="td"||b==="th"){let k={type:"cell",children:N(m,w,x)};return t.includeRawContent&&(k.rawContent="<td>...</td>"),k}if(b==="img"){let k=m.attributes?.src,M=m.attributes?.alt,R;if(k?.startsWith("data:")){let j=k.match(/^data:([^;]+);base64,(.*)$/);if(j&&t.extractAttachments){let $=j[1],q=j[2],Q=`image_${u.length+1}.${$.split("/")[1]}`;u.push({type:"image",mimeType:$,data:q,name:Q,extension:$.split("/")[1]}),R={type:"image",metadata:{attachmentName:Q,altText:M}}}else R={type:"image",metadata:{url:k,altText:M}}}else R={type:"image",metadata:{url:k,altText:M,anchorIds:S.length>0?S:void 0}};return t.includeRawContent&&(R.rawContent="<img>"),R}if(b==="a"){let k=m.attributes?.href,M=N(m,w,x);if(k){let R=k.startsWith("#")?"internal":"external";M.forEach(j=>{j.type==="text"&&(j.metadata={...j.metadata,link:k,linkType:R})})}return M}if(b==="br"){let k={type:"break",metadata:{breakType:"textWrapping"}};return t.includeRawContent&&(k.rawContent="<br/>"),k}if(b==="pre"){let k=m.children.find($=>$.tagName==="code"),M,R="";if(k){let q=(k.attributes?.class||"").split(" ").find(Q=>Q.startsWith("language-"));q&&(M=q.replace("language-","")),R=k.children.map(Q=>Q.text||"").join("")}else R=m.children.map($=>$.text||"").join("");let j={type:"code",text:R,metadata:{language:M,anchorIds:S.length>0?S:void 0}};return t.includeRawContent&&(j.rawContent="<pre>...</pre>"),j}return b==="script"||b==="style"||b==="!doctype"?null:N(m,w,x)}return null};for(let m of s.children){let y=f(m);y&&(Array.isArray(y)?y.forEach(x=>{x.type==="text"?h.push({type:"paragraph",children:[x]}):h.push(x)}):y.type==="text"?h.push({type:"paragraph",children:[y]}):h.push(y))}return An("html",c,h,u,t,()=>h.map(m=>{let y=x=>{if(x.type==="text"||x.type==="code")return x.text||"";if(x.type==="break")return`
|
|
721
721
|
`;if(x.children){let b=["table","row","list","sheet","slide"].includes(x.type);return x.children.map(y).join(b?t.newlineDelimiter:"")}return""};return y(m)}).join(t.newlineDelimiter).replace(/\n{3,}/g,`
|
|
722
722
|
|
|
723
|
-
`))};B();var
|
|
723
|
+
`))};B();var WE=async(r,t)=>{let e=r.toString("utf-8");e=e.replace(/\r\n/g,`
|
|
724
724
|
`);let n=[],i={},s=[];if(e.startsWith(`---
|
|
725
725
|
`)){let p=e.indexOf(`
|
|
726
726
|
---
|
|
@@ -738,18 +738,18 @@ ${x}
|
|
|
738
738
|
`),S=[];for(let N=0;N<E.length;N++){if(E[N].match(/^\|?[-:| ]*---[-:| ]*\|?$/))continue;let M=E[N].replace(/^\||\|$/g,"").split("|").map(R=>({type:"cell",children:l(R.trim(),N===0?{bold:!0}:{})}));S.push({type:"row",children:M})}n.push({type:"table",children:S});continue}if(p.match(/^---+|^\*\*\*+|___+$/)){n.push({type:"break",metadata:{breakType:"page"}});continue}n.push({type:"paragraph",metadata:{alignment:y},children:l(p.replace(/\n/g," "))})}return An("md",i,n,s,t,()=>n.map(p=>{let m=y=>{if(y.type==="text"||y.type==="code")return y.text||"";if(y.type==="break")return`
|
|
739
739
|
`;if(y.children){let x=["table","row","list","sheet","slide"].includes(y.type);return y.children.map(m).join(x?t.newlineDelimiter:"")}return""};return m(p)}).join(t.newlineDelimiter).replace(/\n{3,}/g,`
|
|
740
740
|
|
|
741
|
-
`))};B();var
|
|
741
|
+
`))};B();var qE=async(r,t)=>{let e=/content\.xml/,n=/Object \d+\/content\.xml/,i=/(Pictures|media)\/.*/,s=/meta\.xml/,a=/styles\.xml/,l=/mimetype/,c=await ro(r,D=>!!D.match(e)||!!D.match(n)||!!D.match(s)||!!D.match(a)||!!D.match(l)||!!t.extractAttachments&&!!D.match(i)),u=c.find(D=>D.path==="mimetype"),h="odt";if(u){let D=u.content.toString().trim();D.includes("spreadsheet")?h="ods":D.includes("presentation")?h="odp":D.includes("text")&&(h="odt")}let d=c.find(D=>D.path==="content.xml")||c.find(D=>D.path.match(e)),f=c.find(D=>D.path==="styles.xml"),p=f?le(f.content.toString()):void 0,m=[],y=[],x={},b={},w={},C=null,E=null,S=null,N=0,k=!1;p&&(D=>{let F=ut(D,"style:style");for(let P of F){let G=P.getAttribute("style:name");if(!G)continue;let H={},V=pt(P,"style:paragraph-properties");if(V){let at=V.getAttribute("fo:text-align");if(at){let J={start:"left",left:"left",center:"center",end:"right",right:"right",justify:"justify"};J[at]&&(H.alignment=J[at])}pt(V,"style:drop-cap")&&(H.dropCap=!0)}Object.keys(H).length>0&&(b[G]=H);let L=pt(P,"style:text-properties"),tt=pt(P,"style:table-cell-properties"),rt={};if(tt){let at=tt.getAttribute("fo:background-color");at&&at!=="transparent"&&(rt.backgroundColor=at)}if(L){(L.getAttribute("fo:font-weight")==="bold"||L.getAttribute("style:font-weight-asian")==="bold")&&(rt.bold=!0),(L.getAttribute("fo:font-style")==="italic"||L.getAttribute("style:font-style-asian")==="italic")&&(rt.italic=!0),L.getAttribute("style:text-underline-style")==="solid"&&(rt.underline=!0),L.getAttribute("style:text-line-through-style")==="solid"&&(rt.strikethrough=!0);let at=L.getAttribute("fo:font-size")||L.getAttribute("style:font-size-asian");at&&(rt.size=at);let ft=L.getAttribute("fo:color");ft&&(rt.color=ft);let J=L.getAttribute("fo:background-color");J&&J!=="transparent"&&(rt.backgroundColor=J);let st=L.getAttribute("style:font-name")||L.getAttribute("fo:font-family");st&&(rt.font=st);let lt=L.getAttribute("style:text-position");lt&&(lt.startsWith("sub")&&(rt.subscript=!0),lt.startsWith("super")&&(rt.superscript=!0)),Object.keys(rt).length>0&&(x[G]=rt)}}})(p);let R=(D,F,P,G,H,V={},L,tt="")=>{let rt=[],at=[],ft="";if(!D.childNodes)return{text:"",children:[],anchorIds:[]};for(let J=0;J<D.childNodes.length;J++){let st=D.childNodes[J];if(st.nodeType===3){let lt=st.textContent||"";lt&&(ft+=lt,rt.push({type:"text",text:lt,formatting:V,metadata:L?{...L}:void 0}))}else if(Oe(st)){let lt=st,dt=lt.tagName;if(dt==="text:bookmark"||dt==="text:bookmark-start"){let et=lt.getAttribute("text:name");et&&at.push(et)}else if(dt==="text:s"){let et=parseInt(lt.getAttribute("text:c")||"1"),vt=" ".repeat(et);ft+=vt,rt.push({type:"text",text:vt,formatting:V,metadata:L?{...L}:void 0})}else if(dt==="text:tab")ft+=" ",rt.push({type:"text",text:" ",formatting:V,metadata:L?{...L}:void 0});else if(dt==="text:line-break")ft+=`
|
|
742
742
|
`,rt.push({type:"text",text:`
|
|
743
743
|
`,formatting:V,metadata:{...L||{},isLineBreak:!0}});else if(dt==="text:span"){let et=lt.getAttribute("text:style-name"),vt=et?{...V,...F[et]}:V,bt=R(lt,F,P,G,H,vt,L,tt);ft+=bt.text,rt.push(...bt.children),at.push(...bt.anchorIds)}else if(dt==="text:a"){let et=lt.getAttribute("xlink:href")||"",vt=et.startsWith("#"),bt=vt?"internal":"external";if(vt){try{et=decodeURIComponent(et).split("|")[0]}catch{et=et.split("|")[0]}et.includes("#")&&(et="#"+et.split("#").pop())}let Ft;(!vt||!P.ignoreInternalLinks)&&(Ft={link:et,linkType:bt});let Ct=R(lt,F,P,G,H,V,Ft,tt);ft+=Ct.text,rt.push(...Ct.children),at.push(...Ct.anchorIds)}else if(dt==="text:note"&&!P.ignoreNotes){let et=lt.getAttribute("text:note-class")||"footnote",vt=lt.getAttribute("text:id")||lt.getAttribute("xml:id")||void 0,bt=pt(lt,"text:note-body");if(bt){let Ft=ut(bt,"text:p"),Ct=[],mt="";for(let ht of Ft){let gt=j(ht,H,F,P,tt);mt+=(mt?" ":"")+gt.text;let Et={type:"paragraph",text:gt.text,children:gt.children,metadata:{...gt.alignment?{alignment:gt.alignment}:{},...gt.anchorIds?.length?{anchorIds:gt.anchorIds}:{}}};Ct.push(Et)}let ot={type:"note",text:mt,children:Ct,metadata:{noteType:et,noteId:vt}};P.putNotesAtLast?G.push(ot):rt.push(ot)}}else if(dt==="draw:frame"){let et=lt,vt="",bt=pt(et,"svg:title"),Ft=pt(et,"svg:desc");bt&&bt.textContent?vt=bt.textContent:Ft&&Ft.textContent&&(vt=Ft.textContent);let Ct="",mt=ut(et,"draw:image");if(mt.length>0&&(Ct=mt[0].getAttribute("xlink:href")||"",Ct)){let ht=Ct.split("/");Ct=ht[ht.length-1]}let ot={type:"image",text:"",children:[],metadata:{attachmentName:Ct,...vt?{altText:vt}:{}}};P.includeRawContent&&(ot.rawContent=ee(et,tt,P)),rt.push(ot)}}}return{text:ft,children:rt,anchorIds:at}},j=(D,F,P,G,H)=>{let V=D.getAttribute("text:style-name"),L=V?F[V]:void 0,tt=L?.alignment,rt=L?.dropCap,at=R(D,P,G,y,F,{},void 0,H);if(V&&at.children.forEach(ft=>{if(ft.type==="text"){ft.metadata||(ft.metadata={});let J=ft.metadata;J.style||(J.style=V)}}),at.children.length===0&&D.textContent){let ft=D.textContent;ft.trim()&&(at.text=ft,at.children.push({type:"text",text:ft}))}if(rt&&at.children.length>0){let ft=at.children[0];if(ft.type==="text"&&ft.text)if(ft.text.length===1)ft.formatting={...ft.formatting,size:"58.5pt"};else{let J=ft.text[0],st=ft.text.substring(1),lt={type:"text",text:J,formatting:{...ft.formatting,size:"58.5pt"},metadata:ft.metadata};ft.text=st,at.children.unshift(lt)}}return{text:at.text,children:at.children,alignment:tt,style:V||void 0,anchorIds:at.anchorIds}},$=D=>{let F=[],P="",G=[];for(let H of D.children)H.type==="text"&&H.metadata?.isLineBreak?(F.push({text:P,children:G}),P="",G=[]):(P+=H.text||"",G.push(H));return F.push({text:P,children:G}),F},q=(D,F,P,G,H)=>{let V=[],L=Qe(D,"table:table-row"),tt=0;for(let rt of L){let at=[],ft=Qe(rt,"table:table-cell"),J=parseInt(rt.getAttribute("table:number-rows-repeated")||"1"),st=0;for(let lt of ft){let dt=[],et={value:""},vt=parseInt(lt.getAttribute("table:number-columns-repeated")||"1"),bt=parseInt(lt.getAttribute("table:number-columns-spanned")||"1"),Ft=parseInt(lt.getAttribute("table:number-rows-spanned")||"1"),Ct=ot=>{if(ot.childNodes)for(let ht=0;ht<ot.childNodes.length;ht++){let gt=ot.childNodes[ht];if(Oe(gt)){let Et=gt;if(Et.tagName==="text:p"||Et.tagName==="text:h"){let Pt=j(Et,F,P,G,H),wt={type:Et.tagName==="text:h"?"heading":"paragraph",text:Pt.text,children:Pt.children,metadata:{...Pt.alignment?{alignment:Pt.alignment}:{},...Pt.style?{style:Pt.style}:{}}};Object.keys(wt.metadata||{}).length===0&&delete wt.metadata,Et.tagName==="text:h"&&(wt.metadata||(wt.metadata={}),wt.metadata.level=parseInt(Et.getAttribute("text:outline-level")||"1")),G.includeRawContent&&(wt.rawContent=ee(Et,H,G)),dt.push(wt),et.value+=Pt.text,et.value&&!et.value.endsWith(`
|
|
744
744
|
`)&&(et.value+=`
|
|
745
745
|
`)}else if(Et.tagName==="table:table"){let Pt=q(Et,F,P,G,H);dt.push(Pt)}else(Et.tagName==="draw:frame"||Et.tagName==="draw:text-box")&&Ct(Et)}}};Ct(lt);let mt=et.value;mt.endsWith(`
|
|
746
746
|
`)&&(mt=mt.slice(0,-1));for(let ot=0;ot<vt;ot++){let ht={type:"cell",text:mt,children:dt.length>0?ot===0?dt:JSON.parse(JSON.stringify(dt)):[],metadata:{row:tt,col:st}},gt=ht.metadata;bt>1&&(gt.colSpan=bt),Ft>1&&(gt.rowSpan=Ft),G.includeRawContent&&(ht.rawContent=ee(lt,H,G)),at.push(ht),st++}}for(let lt=0;lt<J;lt++){let dt={type:"row",children:lt===0?at:JSON.parse(JSON.stringify(at))};lt>0&&dt.children?.forEach(et=>{et.metadata&&"row"in et.metadata&&(et.metadata.row=tt)}),G.includeRawContent&&(dt.rawContent=ee(rt,H,G)),V.push(dt),tt++}}return{type:"table",children:V}};d&&(D=>{let F=le(D,{locator:t.includeRawContent}),P=pt(F,"office:body");if(!P)return;let G=pt(F,"office:automatic-styles");if(G){let L=ut(G,"style:style");for(let tt of L){let rt=tt.getAttribute("style:name");if(!rt)continue;let at=pt(tt,"style:paragraph-properties"),ft={};if(at){let st=at.getAttribute("fo:text-align");if(st){let dt={start:"left",left:"left",center:"center",end:"right",right:"right",justify:"justify"};dt[st]&&(ft.alignment=dt[st])}pt(at,"style:drop-cap")&&(ft.dropCap=!0)}Object.keys(ft).length>0&&(b[rt]=ft);let J=pt(tt,"style:text-properties");if(J){let st={};(J.getAttribute("fo:font-weight")==="bold"||J.getAttribute("style:font-weight-asian")==="bold")&&(st.bold=!0),(J.getAttribute("fo:font-style")==="italic"||J.getAttribute("style:font-style-asian")==="italic")&&(st.italic=!0),J.getAttribute("style:text-underline-style")==="solid"&&(st.underline=!0),J.getAttribute("style:text-line-through-style")==="solid"&&(st.strikethrough=!0);let lt=J.getAttribute("fo:font-size")||J.getAttribute("style:font-size-asian");lt&&(st.size=lt);let dt=J.getAttribute("fo:color");dt&&(st.color=dt);let et=J.getAttribute("fo:background-color");et&&et!=="transparent"&&(st.backgroundColor=et);let vt=J.getAttribute("style:font-name")||J.getAttribute("fo:font-family");vt&&(st.font=vt);let bt=J.getAttribute("style:text-position");bt&&(bt.startsWith("sub")&&(st.subscript=!0),bt.startsWith("super")&&(st.superscript=!0)),Object.keys(st).length>0&&(x[rt]=st)}}}let H=pt(F,"office:body");if(H){let L=Qe(H,"office:text")[0]||Qe(H,"office:presentation")[0]||Qe(H,"office:spreadsheet")[0];if(L){let tt=Qe(L,"*"),rt=L.tagName==="office:spreadsheet";for(let at of tt)V(at,m,!1,D,rt)}}function V(L,tt,rt=!1,at,ft=!1){if(L.tagName==="text:p"){let J=j(L,b,x,t,at),st=rt||(L.getAttribute("text:style-name")||"").toLowerCase().includes("title")?"heading":"paragraph",lt={...J.alignment?{alignment:J.alignment}:{},...J.style?{style:J.style}:{},...J.anchorIds?.length?{anchorIds:J.anchorIds}:{}},dt=L.getAttribute("xml:id")||L.getAttribute("text:id");dt&&(lt.anchorIds||(lt.anchorIds=[]),lt.anchorIds.push(dt));let et={type:st,text:J.text,children:J.children,metadata:lt};st==="heading"&&et.metadata&&(et.metadata.level=et.metadata.level||1),Object.keys(et.metadata||{}).length===0&&delete et.metadata,t.includeRawContent&&(et.rawContent=ee(L,at,t)),tt.push(et),k=!1}else if(L.tagName==="text:h"){let J=parseInt(L.getAttribute("text:outline-level")||"1"),st=j(L,b,x,t,at),lt={level:J,...st.alignment?{alignment:st.alignment}:{},...st.style?{style:st.style}:{},...st.anchorIds?.length?{anchorIds:st.anchorIds}:{}},dt=L.getAttribute("xml:id")||L.getAttribute("text:id");dt&&(lt.anchorIds||(lt.anchorIds=[]),lt.anchorIds.push(dt));let et={type:"heading",text:st.text,children:st.children,metadata:lt};t.includeRawContent&&(et.rawContent=ee(L,at,t)),tt.push(et),k=!1}else if(L.tagName==="table:table"){let J=q(L,b,x,t,at);if(ft){J.type="sheet";let lt=L.getAttribute("table:name");lt&&(J.metadata={...J.metadata,sheetName:lt})}let st=L.getAttribute("xml:id")||L.getAttribute("table:name");st&&(J.metadata||(J.metadata={}),J.metadata.anchorIds=J.metadata.anchorIds||[],J.metadata.anchorIds.push(st)),t.includeRawContent&&(J.rawContent=ee(L,at,t)),tt.push(J),k=!1}else if(L.tagName==="text:list"){let J=Qe(L,"text:list-item"),st="unordered",lt=!1,et=L.getAttribute("text:style-name")||L.getAttribute("xml:id");if(!et){let gt=L.parentNode;for(;gt&&!et&&!(gt.nodeName==="text:list"&&(et=gt.getAttribute("text:style-name"),et));)gt=gt.parentNode}if(et){if(G){let gt=ut(G,"text:list-style");for(let Et of gt)if(Et.getAttribute("style:name")===et){let Pt=ut(Et,"text:list-level-style-bullet"),wt=ut(Et,"text:list-level-style-number"),kt=ut(Et,"text:list-level-style-image");wt.length>0?(st="ordered",lt=wt.some(St=>!!St.getAttribute("style:num-format"))):Pt.length>0?(st="unordered",lt=Pt.some(St=>!!St.getAttribute("text:bullet-char"))):kt.length>0&&(st="unordered",lt=!0);break}}if(!lt&&p){let gt=pt(p,"office:styles");if(gt){let Et=ut(gt,"text:list-style");for(let Pt of Et)if(Pt.getAttribute("style:name")===et){let wt=ut(Pt,"text:list-level-style-bullet"),kt=ut(Pt,"text:list-level-style-number");kt.length>0?(st="ordered",lt=kt.some(St=>!!St.getAttribute("style:num-format"))):wt.length>0&&(st="unordered",lt=wt.some(St=>!!St.getAttribute("text:bullet-char")));break}}}}if(!lt){k=!1;for(let gt=0;gt<J.length;gt++){let Et=J[gt];if(Et.childNodes)for(let Pt=0;Pt<Et.childNodes.length;Pt++){let wt=Et.childNodes[Pt];Oe(wt)&&V(wt,tt,rt,at)}}return}let vt=h==="odp",bt=et&&et===S,Ft=st===E,Ct;k&&(bt||vt&&Ft)?Ct=C:(Ct=et||`list-${++N}`,C=Ct,E=st,S=et),k=!0;let mt=0,ot=L.parentNode;for(;ot;)ot.nodeName==="text:list"&&mt++,ot=ot.parentNode;w[Ct]||(w[Ct]={});let ht=mt.toString();w[Ct][ht]===void 0&&(w[Ct][ht]=-1);for(let gt=0;gt<J.length;gt++){let Et=J[gt],Pt=!1;if(Et.childNodes)for(let wt=0;wt<Et.childNodes.length;wt++){let kt=Et.childNodes[wt];if(Oe(kt)){let St=kt;if(St.tagName==="text:p"||St.tagName==="text:h"){if(!Pt){w[Ct][ht]++,Pt=!0;for(let xt=mt+1;xt<10;xt++)w[Ct][xt.toString()]!==void 0&&(w[Ct][xt.toString()]=-1)}let O=w[Ct][ht],K=j(St,b,x,t,at),Tt=$(K);for(let xt=0;xt<Tt.length;xt++){let Mt=Tt[xt];if(!Mt.text.trim()&&Mt.children.length===0)continue;let Ot=xt===0,se={type:Ot?"list":"paragraph",text:Mt.text,children:Mt.children,metadata:Ot?{listType:st,indentation:mt,itemIndex:O,listId:Ct,alignment:K.alignment||"left",style:K.style}:{alignment:K.alignment||"left",style:K.style}};if(Ot&&St.tagName==="text:h"){let _n=parseInt(St.getAttribute("text:outline-level")||"1");se.metadata.level=_n}t.includeRawContent&&(se.rawContent=ee(St,at,t)),tt.push(se)}}else St.tagName==="text:list"&&V(St,tt,rt,at)}}}}else if(L.tagName==="draw:frame"){let J=L.getAttribute("presentation:class"),st=J==="title"||J==="sub-title",lt=pt(L,"draw:text-box"),dt=pt(L,"draw:image"),et=pt(L,"table:table"),vt=pt(L,"draw:object");if(lt)V(lt,tt,st||rt,at);else if(et){let bt=q(et,b,x,t,at);t.includeRawContent&&(bt.rawContent=ee(et,at,t)),tt.push(bt)}else if(dt){let bt="",Ft=pt(L,"svg:title"),Ct=pt(L,"svg:desc");Ft&&Ft.textContent?bt=Ft.textContent:Ct&&Ct.textContent&&(bt=Ct.textContent);let mt=dt.getAttribute("xlink:href")||"";if(mt){let Et=mt.split("/");mt=Et[Et.length-1]}let ot={attachmentName:mt,...bt?{altText:bt}:{}},ht=L.getAttribute("xml:id")||L.getAttribute("draw:name");ht&&(ot.anchorIds=[ht]);let gt={type:"image",text:"",children:[],metadata:ot};t.includeRawContent&&(gt.rawContent=ee(L,at,t)),tt.push(gt)}else if(vt){let bt=vt.getAttribute("xlink:href");if(bt){let Ft=bt.split("/")[0],Ct=`${Ft}/content.xml`,mt=c.find(ot=>ot.path===Ct||ot.path.endsWith(Ct));if(mt){let ot=dl(mt.content),ht={type:"chart",text:ot.rawTexts.join(" "),metadata:{attachmentName:Ft,chartData:ot}};t.includeRawContent&&(ht.rawContent=ee(L,at,t)),tt.push(ht)}else{let ot={type:"chart",text:"",metadata:{attachmentName:Ft}};t.includeRawContent&&(ot.rawContent=ee(L,at,t)),tt.push(ot)}}}}else if(L.childNodes)for(let J=0;J<L.childNodes.length;J++){let st=L.childNodes[J];Oe(st)&&V(st,tt,rt,at)}}if(h==="ods"){let L=pt(P,"office:spreadsheet");if(L){let tt=ut(L,"table:table");for(let rt=0;rt<tt.length;rt++){let at=tt[rt],ft=at.getAttribute("table:name")||`Sheet${rt+1}`,J=[],st=ut(at,"table:table-row"),lt=0;for(let et=0;et<st.length;et++){let vt=st[et],bt=[],Ft=ut(vt,"table:table-cell"),Ct=0,mt=parseInt(vt.getAttribute("table:number-rows-repeated")||"1");for(let ot=0;ot<Ft.length;ot++){let ht=Ft[ot],gt=parseInt(ht.getAttribute("table:number-columns-repeated")||"1"),Et="",Pt=[],wt=ut(ht,"text:p");for(let St=0;St<wt.length;St++){let O=wt[St],K=ut(O,"text:span");if(K.length>0)for(let Tt of K){let xt=Tt.getAttribute("text:style-name"),Mt=xt?x[xt]:{},Ot=Tt.textContent||"";Et+=Ot;let Yt={type:"text",text:Ot,formatting:Mt};Pt.push(Yt)}else{let Tt=O.textContent||"";if(Et+=Tt,Tt.trim()){let xt={type:"text",text:Tt,formatting:{}};Pt.push(xt)}}St<wt.length-1&&(Et+=`
|
|
747
|
-
`)}let kt=ut(ht,"draw:frame");for(let St of kt){let O="",K=pt(St,"svg:title"),Tt=pt(St,"svg:desc");K&&K.textContent?O=K.textContent:Tt&&Tt.textContent&&(O=Tt.textContent);let xt="",Mt=ut(St,"draw:image");if(Mt.length>0){let se=Mt[0].getAttribute("xlink:href");if(se){let _n=se.split("/");xt=_n[_n.length-1]}}let Ot="",Yt=ut(St,"draw:object");if(Yt.length>0){let se=Yt[0].getAttribute("xlink:href");se&&(Ot=se.split("/")[0])}if(Mt.length>0){let se={type:"image",text:"",children:[],metadata:{attachmentName:xt,...O?{altText:O}:{}}};t.includeRawContent&&(se.rawContent=ee(St,D,t)),Pt.push(se)}else if(Ot){let se={type:"chart",text:"",children:[],metadata:{attachmentName:Ot}};Pt.push(se)}}for(let St=0;St<gt;St++){if(Et||Pt.length>0||h!=="ods"){let O={type:"cell",text:Et,children:Pt,metadata:{row:lt,col:Ct}};t.includeRawContent&&(O.rawContent=ee(ht,D,t)),bt.push(O)}Ct++}}if(bt.length>0)for(let ot=0;ot<mt;ot++){let ht={type:"row",children:JSON.parse(JSON.stringify(bt)),metadata:void 0};ot>0&&ht.children?.forEach(gt=>{gt.metadata&&"row"in gt.metadata&&(gt.metadata.row=lt)}),t.includeRawContent&&(ht.rawContent=ee(vt,D,t)),J.push(ht),lt++}else lt+=mt}let dt={type:"sheet",children:J,metadata:{sheetName:ft}};t.includeRawContent&&(dt.rawContent=ee(at,D,t)),m.push(dt)}}}else if(h==="odp"){let L=pt(P,"office:presentation");if(L){let tt=Qe(L,"draw:page"),rt=[];for(let at=0;at<tt.length;at++){let ft=tt[at],J={type:"slide",children:[],metadata:{slideNumber:at+1}},st,lt=ft.childNodes;if(lt)for(let dt=0;dt<lt.length;dt++){let et=lt[dt];if(Oe(et)){let vt=et;if(vt.tagName==="presentation:notes"){t.ignoreNotes||(st={type:"note",children:[],metadata:{slideNumber:at+1,noteId:`slide-note-${at+1}`}},V(vt,st.children,!1,D));continue}V(vt,J.children,!1,D)}}t.includeRawContent&&(J.rawContent=ee(ft,D,t)),m.push(J),st&&st.children&&st.children.length>0&&(t.putNotesAtLast?rt.push(st):m.push(st))}rt.length>0&&m.push(...rt)}}else{let L=pt(P,"office:text");L&&V(L,m,!1,D)}})(d.content.toString());let Z=[],Y=c.filter(D=>D.path.match(/(Pictures|media)\/.*/));if(t.extractAttachments){let D=c.filter(F=>F.path.match(/Object \d+\/content\.xml/));for(let F of D){let P=le(F.content.toString());if(ut(P,"chart:chart").length>0){let H=F.path.split("/")[0],V={type:"chart",mimeType:"application/vnd.oasis.opendocument.chart",data:F.content.toString("base64"),name:H,extension:"xml"},L=dl(F.content);L.rawTexts.length>0&&(V.chartData=L),Z.push(V)}}}if(t.extractAttachments)for(let D of Y){let F=Mr(D.path.split("/").pop()||"image",D.content);if(Z.push(F),t.ocr&&F.mimeType.startsWith("image/"))try{F.ocrText=(await lr(D.content,{...t.ocrConfig})).trim()}catch(P){Se("OCR_FAILED",t,F.name,P)}}let X=c.find(D=>D.path.match(s)),T=X?no(X.content.toString()):{},I=(D,F)=>{let P=H=>{let V=H.replace(/^\[|\]$/g,""),[L,tt]=V.split(":"),rt=L.lastIndexOf(".");if(rt===-1)return[H];let at=L.substring(0,rt).replace(/^'|'$/g,""),ft=L.substring(rt+1).replace(/\$/g,""),J=ft;if(tt)if(tt.startsWith("."))J=tt.substring(1).replace(/\$/g,"");else{let bt=tt.lastIndexOf(".");J=tt.substring(bt+1).replace(/\$/g,"")}let st=bt=>{let Ft=bt.match(/[A-Z]+/),Ct=bt.match(/\d+/);if(!Ft||!Ct)return null;let mt=Ft[0],ot=0;for(let gt=0;gt<mt.length;gt++)ot=ot*26+(mt.charCodeAt(gt)-65+1);return ot-=1,{r:parseInt(Ct[0])-1,c:ot}},lt=st(ft),dt=st(J);if(!lt||!dt)return[H];let et=F.find(bt=>bt.type==="sheet"&&bt.metadata?.sheetName===at);if(!et||!et.children)return[H];let vt=[];for(let bt of et.children)if(bt.children)for(let Ft of bt.children){let Ct=Ft.metadata;Ct&&Ct.row>=lt.r&&Ct.row<=dt.r&&Ct.col>=lt.c&&Ct.col<=dt.c&&vt.push(Ft.text||"")}return vt.length>0?vt:[]};for(let H of D.dataSets){let V=[];for(let L of H.values)L.startsWith("[")?V.push(...P(L)):V.push(L);H.values=V}let G=[];for(let H of D.labels)H.startsWith("[")?G.push(...P(H)):G.push(H);D.labels=G,D.rawTexts=[],D.title&&D.rawTexts.push(D.title);for(let H of D.dataSets)H.name&&D.rawTexts.push(H.name),D.rawTexts.push(...D.labels),D.rawTexts.push(...H.values)};for(let D of Z)D.type==="chart"&&D.chartData&&I(D.chartData,m);(D=>{let F=new Set,P=L=>{for(let tt of L){if(tt.metadata&&"attachmentName"in tt.metadata){let rt=tt.metadata.attachmentName;rt&&F.add(rt)}tt.children&&P(tt.children)}};P(D);let G=Z.filter(L=>L.type==="image"&&L.name&&!F.has(L.name)),H=0,V=L=>{if((L.type==="image"||L.type==="chart")&&L.metadata&&"attachmentName"in L.metadata){let tt=L.metadata.attachmentName;if(!tt&&L.type==="image"&&H<G.length&&(tt=G[H++].name,L.metadata.attachmentName=tt),tt){let rt=Z.find(at=>at.name===tt);rt&&(rt.ocrText&&(L.text=rt.ocrText),rt.chartData&&L.type==="chart"&&(L.text=rt.chartData.rawTexts.join(t.newlineDelimiter)))}}L.children&&L.children.forEach(V)};D.forEach(V)})(m);let W={};for(let D in x)W[D]={formatting:x[D],alignment:b[D]?.alignment};for(let D in b)W[D]||(W[D]={formatting:{},alignment:b[D]?.alignment});t.putNotesAtLast&&y.length>0&&m.push(...y);let z=()=>m.map(D=>{let F=P=>{let G="";if(P.children&&P.children.length>0){let V=P.children.some(L=>L.children&&L.children.length>0)?t.newlineDelimiter:"";G+=P.children.map(F).filter(L=>L!="").join(V)}else G+=P.text||"";return G};return F(D)}).filter(D=>D!="").join(t.newlineDelimiter);return An(h,{...T,styleMap:W},m,Z,t,z)};B();B();async function DA(r){try{let{pathToFileURL:t}=await import("url"),e=iu.resolve(r),n=t(e).href;return new Function("s","return import(/* @vite-ignore */ /* webpackIgnore: true */ s)")(n)}catch{return new Function("s","return import(/* @vite-ignore */ /* webpackIgnore: true */ s)")(r)}}async function jD(){return _r?Promise.resolve().then(()=>(iT(),nT)):DA("file-type")}async function GD(){if(!_r){Bv();try{return await DA("pdfjs-dist/legacy/build/pdf.mjs")}catch{return await DA("pdfjs-dist")}}return Promise.resolve().then(()=>(zD(),$D))}function eF(r){return r&&typeof r.str=="string"&&Array.isArray(r.transform)&&r.transform.length>=6}function nF(r){let t=[];for(let i of r)for(let s of i)s.type==="text"&&s.height>0&&t.push(s.height);if(t.length===0)return{median:12,max:12};t.sort((i,s)=>i-s);let e=t[Math.floor(t.length/2)],n=t[t.length-1];return{median:e,max:n}}function iF(r,t){if(r<=t.median*1.2)return 0;let e=r/t.median;return e>=2?1:e>=1.7?2:e>=1.5?3:e>=1.35?4:e>=1.2?5:0}function rF(r,t){let e=r.x,n=r.x+r.width,i=r.y,s=r.y+r.height;for(let a of t){let[l,c,u,h]=a.rect,d=Math.min(l,u),f=Math.max(l,u),p=Math.min(c,h),m=Math.max(c,h);if(e<f&&n>d&&i<m&&s>p)return a}}function sF(r,t,e){let n=Math.floor((24*r+31)/32)*4,i=n-r*3,s=54,a=n*t,l=s+a,c=ct.Buffer.alloc(l);c.write("BM",0),c.writeUInt32LE(l,2),c.writeUInt32LE(0,6),c.writeUInt32LE(s,10),c.writeUInt32LE(40,14),c.writeInt32LE(r,18),c.writeInt32LE(-t,22),c.writeUInt16LE(1,26),c.writeUInt16LE(24,28),c.writeUInt32LE(0,30),c.writeUInt32LE(a,34),c.writeInt32LE(2835,38),c.writeInt32LE(2835,42),c.writeUInt32LE(0,46),c.writeUInt32LE(0,50);let u=s;for(let h=0;h<t;h++){for(let d=0;d<r;d++){let f=(h*r+d)*4,p=e[f+0],m=e[f+1],y=e[f+2],b=e[f+3]/255,w=Math.round(p*b+255*(1-b)),C=Math.round(m*b+255*(1-b)),E=Math.round(y*b+255*(1-b));c[u+0]=E,c[u+1]=C,c[u+2]=w,u+=3}for(let d=0;d<i;d++)c[u]=0,u++}return c}function aF(r,t,e,n){let i;if(n===1){i=new Uint8ClampedArray(t*e*4);for(let s=0;s<t*e;s++){let a=r[s];i[s*4]=a,i[s*4+1]=a,i[s*4+2]=a,i[s*4+3]=255}}else if(n===2||r.length===t*e*3){i=new Uint8ClampedArray(t*e*4);for(let s=0;s<t*e;s++)i[s*4]=r[s*3],i[s*4+1]=r[s*3+1],i[s*4+2]=r[s*3+2],i[s*4+3]=255}else i=r instanceof Uint8ClampedArray?r:new Uint8ClampedArray(r);return ct.Buffer.from(i.buffer,i.byteOffset,i.byteLength)}var HD=async(r,t)=>{let e=await GD(),n=t.pdfWorkerSrc;if(_r)e.GlobalWorkerOptions.workerSrc=n;else{Dg("pdf-worker-auto-resolution");let b=!1;if(n!==fg.pdfWorkerSrc&&n!=="")e.GlobalWorkerOptions.workerSrc=n,b=!0;else try{let w=iu.resolve("pdfjs-dist/legacy/build/pdf.worker.mjs"),{pathToFileURL:C}=await import("url");e.GlobalWorkerOptions.workerSrc=C(w).href,b=!0}catch(w){Se("PDF_WORKER_FALLBACK",t,void 0,w)}b||(e.GlobalWorkerOptions.workerSrc=n)}let i=new Uint8Array(r),s=e.getDocument({data:i,verbosity:0}),a;try{a=await s.promise}catch(b){let w=b instanceof Error?b.message:String(b);throw w.includes("workerSrc")||w.includes('No "GlobalWorkerOptions.workerSrc" specified')?hn("PDF_WORKER_MISSING",t):b}let l=[],c=[],u=a.numPages,h=[],f=(await a.getMetadata().catch(()=>({info:{}}))).info,p={pages:u,title:f?.Title,author:f?.Author,subject:f?.Subject,description:f?.Keywords,created:ls(f?.CreationDate),modified:ls(f?.ModDate)},m=new Set(["Title","Author","Subject","Keywords","Creator","Producer","CreationDate","ModDate","Trapped","IsAcroFormPresent","IsXFAPresent","IsCollectionPresent","IsSignaturesPresent","PDFFormatVersion"]);if(f){let b={};for(let w of Object.keys(f)){if(m.has(w))continue;let C=f[w];if(C!=null){if(w==="Custom"&&typeof C=="object"&&!Array.isArray(C)&&!(C instanceof Date)){for(let[E,S]of Object.entries(C))S!=null&&(typeof S=="string"||typeof S=="number"||typeof S=="boolean"||S instanceof Date)&&(b[E]=S);continue}(typeof C=="string"||typeof C=="number"||typeof C=="boolean"||C instanceof Date)&&(b[w]=C)}}Object.keys(b).length>0&&(p.customProperties=b)}try{let b=await a.getAttachments();if(b&&t.extractAttachments)for(let w in b){let C=b[w],E=ct.Buffer.from(C.content),S=Mr(C.filename,E);c.push(S)}}catch(b){Se("ATTACHMENT_EXTRACTION_FAILED",t,void 0,b)}for(let b=1;b<=u;b++){let w,C,E=[];try{w=await a.getPage(b),C=await w.getTextContent()}catch(k){Se("PAGE_LOAD_FAILED",t,b,k),h.push(E);continue}let S=w.commonObjs,N=new Map;for(let k of C.items){if(!eF(k))continue;let M=k,R=M.transform,j=R[4],$=R[5],q=M.width||0,Q=M.height||Math.abs(R[3])||12,Z={},Y;if(M.fontName&&S)try{if(S.has(M.fontName)){let X=N.get(M.fontName);if(X||(X=await new Promise(T=>{S.get(M.fontName,I=>T(I))}),N.set(M.fontName,X)),X?.name&&typeof X.name=="string"){Y=X.name.replace(/^[A-Z]{6}\+/,""),Z.font=Y;let T=X.name.toLowerCase();T.includes("bold")&&(Z.bold=!0),(T.includes("italic")||T.includes("oblique"))&&(Z.italic=!0)}}}catch{}Q>0&&(Z.size=Math.round(Q).toString()),E.push({type:"text",x:j,y:$,width:q,height:Q,text:M.str,fontName:Y,formatting:Z})}if(t.extractAttachments||t.ocr)try{let k=await w.getOperatorList(),M=k.fnArray,R=k.argsArray;for(let j=0;j<M.length;j++){let $=M[j];if($===e.OPS.dependency){let q=R[j];for(let Q of q)try{if(w.objs.has(Q))continue;await new Promise(Z=>{let Y=setTimeout(()=>{Z()},500);w.objs.get(Q,X=>{clearTimeout(Y),Z()})})}catch(Z){Se("DEPENDENCY_LOAD_FAILED",t,Q,Z)}}if($===e.OPS.paintImageXObject||$===e.OPS.paintXObject){let q=R[j][0];try{let Q=w.objs.has(q),Z=w.objs;if(!Q&&w.commonObjs.has(q)&&(Q=!0,Z=w.commonObjs),Q){let Y=await new Promise(X=>{Z.get(q,T=>X(T))});if(_r&&!Y.data&&Y.bitmap)try{let X=document.createElement("canvas");X.width=Y.width,X.height=Y.height;let T=X.getContext("2d");T&&(T.drawImage(Y.bitmap,0,0),Y.data=T.getImageData(0,0,Y.width,Y.height).data,Y.kind=3)}catch(X){Se("IMAGE_PROCESSING_FAILED",t,void 0,X)}if(Y?.data&&Y.width>0&&Y.height>0){let X=0,T=0;for(let I=j-1;I>=0;I--)if(M[I]===e.OPS.transform){X=R[I][4],T=R[I][5];break}E.push({type:"image",x:X,y:T,name:q,data:Y.data,width:Y.width,height:Y.height,kind:Y.kind})}}}catch{}}}}catch(k){Se("IMAGE_EXTRACTION_FAILED",t,`from page ${b}`,k)}h.push(E)}let y=nF(h);for(let b=0;b<h.length;b++){let w=b+1,C;try{C=await a.getPage(w)}catch(q){Se("PAGE_LOAD_FAILED",t,w,q);continue}let E=h[b],S=[],N=[],k=new Set;try{let q=await C.getAnnotations();for(let Q of q)if(Q.subtype==="Link"&&Q.rect){let Z=Q.url||Q.unsafeUrl||Q.data?.url;N.push({rect:Q.rect,url:Z,dest:Q.dest})}}catch(q){Se("ANNOTATION_EXTRACTION_FAILED",t,w,q)}E.sort((q,Q)=>Math.abs(Q.y-q.y)>7?Q.y-q.y:q.x-Q.x);let M=null,R=0,j=-1,$=0;for(let q of E)if(q.type==="text"){let Q=q.text;if(!Q)continue;if(j!==-1&&Math.abs(q.y-j)>5&&M&&((M.text||"").trim().length>0&&S.push(M),M=null),!M&&Q.trim().length===0){j=q.y;continue}let Y=iF(q.height,y);if(M||(Y>0?M={type:"heading",text:"",children:[],metadata:{level:Y}}:M={type:"paragraph",text:"",children:[]},R=q.height),Q.trim().length===0){if(M.children&&M.children.length>0){let _=M.children[M.children.length-1];_.type==="text"&&_.text&&(_.text+=Q,M.text+=Q)}j=q.y;continue}if(M.text&&M.text.length>0&&!M.text.endsWith(" ")&&(M.text+=" ",M.children&&M.children.length>0)){let _=M.children[M.children.length-1];_.type==="text"&&_.text&&(_.text+=" ")}M.text+=Q;let X=rF(q,N);X&&k.add(X);let T;X&&(X.url?T={link:X.url,linkType:X.url.startsWith("#")?"internal":"external"}:X.dest&&(T={link:typeof X.dest=="string"?`#${X.dest}`:"#internal",linkType:"internal"}));let I=!1;if(M.children&&M.children.length>0&&!T){let _=M.children[M.children.length-1];_.type==="text"&&oF(_.formatting,q.formatting)&&!_.metadata&&(_.text=(_.text||"")+Q,I=!0)}if(!I){let _={type:"text",text:Q,formatting:Object.keys(q.formatting).length>0?q.formatting:void 0};T&&(_.metadata=T),M.children?.push(_)}j=q.y}else if(q.type==="image"){M&&((M.text||"").trim().length>0&&S.push(M),M=null),$++;let Q=`pdf_image_p${w}_${$}.bmp`;if(t.extractAttachments)try{let Z=aF(q.data,q.width,q.height,q.kind),Y=sF(q.width,q.height,new Uint8Array(Z)),X=Mr(Q,Y);if(X.mimeType="image/bmp",t.ocr)try{q.width>=10&&q.height>=10&&(X.ocrText=(await lr(Y,{...t.ocrConfig})).trim())}catch(I){Se("OCR_FAILED",t,Q,I)}c.push(X);let T={attachmentName:Q};S.push({type:"image",text:X.ocrText||"",metadata:{...T}})}catch(Z){Se("IMAGE_EXTRACTION_FAILED",t,Q,Z)}}M&&(M.text||"").trim().length>0&&S.push(M),l.push({type:"page",children:S,text:S.map(q=>q.text).join(t.newlineDelimiter),metadata:{pageNumber:w}})}return An("pdf",p,l,c,t,()=>l.map(b=>b.text).join(t.newlineDelimiter))};function oF(r,t){if(!r&&!t)return!0;if(!r||!t)return!1;let e=Object.keys(r).sort(),n=Object.keys(t).sort();if(e.length!==n.length)return!1;for(let i=0;i<e.length;i++){let s=e[i];if(e[i]!==n[i]||r[s]!==t[s])return!1}return!0}B();var WD=async(r,t)=>{let e=/ppt\/(notesSlides|slides)\/(notesSlide|slide)\d+.xml/g,n=/ppt\/slides\/slide\d+.xml/g,i=/ppt\/slides\/_rels\/slide\d+\.xml\.rels/,s=/lide(\d+)\.xml/,a=/ppt\/media\/.*/,l=/ppt\/charts\/chart\d+\.xml/,c=/docProps\/core\.xml/,u=/docProps\/custom\.xml/,h=await ro(r,T=>!!T.match(t.ignoreNotes?n:e)||!!T.match(c)||!!T.match(u)||!!T.match(i)||!!t.extractAttachments&&(!!T.match(a)||!!T.match(l))),d=h.find(T=>T.path.match(c)),f=d?no(d.content.toString()):{},p=h.find(T=>T.path.match(u));if(p){let T=ku(p.content.toString());Object.keys(T).length>0&&(f.customProperties=T)}h.sort((T,I)=>{let _=T.path.match(s),W=I.path.match(s),z=_?parseInt(_[1]):0,D=W?parseInt(W[1]):0;return z-D});let m=[],y=[],x={},b=0,w=0,C=!1,E=null,S=0,N={},k=(T,I)=>{let _=[],W=ut(T,"a:tr");for(let z=0;z<W.length;z++){let D=W[z],F=[],P=ut(D,"a:tc");for(let H=0;H<P.length;H++){let V=P[H],L=[],tt="",rt=pt(V,"a:txBody");if(rt){let ft=ut(rt,"a:p");for(let J of ft){let st={type:"paragraph",text:"",children:[],metadata:{}};t.includeRawContent&&(st.rawContent=ee(J,I,t));let lt=ut(J,"a:r");for(let dt of lt){let et=pt(dt,"a:t");if(et&&et.childNodes[0]){let vt=et.childNodes[0].nodeValue||"";st.text+=vt;let bt=pt(dt,"a:rPr"),Ft={};if(bt){bt.getAttribute("b")==="1"&&(Ft.bold=!0),bt.getAttribute("i")==="1"&&(Ft.italic=!0),bt.getAttribute("u")==="sng"&&(Ft.underline=!0),bt.getAttribute("strike")==="sngStrike"&&(Ft.strikethrough=!0);let Ct=bt.getAttribute("sz");Ct&&(Ft.size=(parseInt(Ct)/100).toString()+"pt");let mt=pt(bt,"a:solidFill");if(mt){let ht=pt(mt,"a:srgbClr");if(ht){let gt=ht.getAttribute("val");gt&&(Ft.color="#"+gt)}}let ot=pt(bt,"a:latin");if(ot){let ht=ot.getAttribute("typeface");ht&&(Ft.font=ht)}}st.children?.push({type:"text",text:vt,formatting:Ft})}}L.push(st),tt+=st.text}}let at={type:"cell",text:tt,children:L,metadata:{row:z,col:H}};F.push(at)}let G={type:"row",children:F};_.push(G)}return{type:"table",children:_}},M=(T,I,_)=>{let W=pt(T,"a:blip");if(!W)return null;let z=W.getAttribute("r:embed");if(!z)return null;let D=x[I]?.[z];if(!D||D.type!=="image")return null;let F=D.target,P=pt(T,"p:nvPicPr"),H=(P?pt(P,"p:cNvPr"):null)?.getAttribute("descr")||void 0;return{type:"image",text:"",metadata:{attachmentName:F,altText:H}}},R=(T,I,_)=>{let W=pt(T,"a:graphicData");if(!W||!(W.getAttribute("uri")==="http://schemas.openxmlformats.org/drawingml/2006/chart"))return null;let F=pt(W,"c:chart");if(!F)return null;let P=F.getAttribute("r:id");if(!P)return null;let G=x[I]?.[P];if(!G||G.type!=="chart")return null;let V={type:"chart",text:"",metadata:{attachmentName:G.target}};return t.includeRawContent&&(V.rawContent=ee(T,_,t)),V},j=(T,I,_)=>{let W=pt(T,"a:tbl");if(W){let z=k(W,_);if(t.includeRawContent&&(z.rawContent=ee(T,_,t)),z.children&&z.children.length>0)return z}if(T.getElementsByTagName("c:chart").length>0){let z=R(T,I,_);if(z)return z}return null},$=(T,I,_)=>{let W=[],z=pt(T,"p:nvSpPr"),D=z?pt(z,"p:nvPr"):null,F=D?pt(D,"p:ph"):null,P=F?F.getAttribute("type"):"body",G=P==="title"||P==="ctrTitle",H=pt(T,"p:txBody");if(H){let V=ut(H,"a:p");for(let L=0;L<V.length;L++){let tt=V[L],rt={type:G?"heading":"paragraph",text:"",children:[],metadata:G?{level:1}:{}},at=pt(tt,"a:pPr"),ft=!1,J="unordered",st=0;if(at){let et=at.getAttribute("lvl");et&&(st=parseInt(et));let vt=pt(at,"a:buAutoNum"),bt=pt(at,"a:buChar"),Ft=pt(at,"a:buBlip"),Ct=pt(at,"a:bu");vt?(ft=!0,J="ordered"):(bt||Ft||Ct)&&(ft=!0,J="unordered");let mt=at.getAttribute("algn");if(mt){let ot={l:"left",ctr:"center",r:"right",just:"justify"};ot[mt]&&(rt.metadata.alignment=ot[mt])}}if(ft){rt.type="list";let et=st;if(!C||J!==E){b++;for(let bt in N)delete N[bt];w=0,N[et]=0}else if(et>S)w=0,N[et]=0;else if(et<S){for(let Ft in N){let Ct=parseInt(Ft);Ct>et&&delete N[Ct]}w=(N[et]||0)+1,N[et]=w}else w=(N[et]||0)+1,N[et]=w;C=!0,E=J,S=et,rt.metadata={...rt.metadata,listType:J,indentation:et,listId:b.toString(),itemIndex:w,alignment:rt.metadata?.alignment||"left"}}else C=!1,E=null,S=0;G&&(rt.metadata={...rt.metadata,level:1}),t.includeRawContent&&(rt.rawContent=ee(tt,_,t));let lt=Array.from(tt.childNodes),dt=rt;W.push(dt);for(let et of lt){if(!Oe(et))continue;let vt=et,bt=vt.tagName;if(bt==="a:r"||bt==="a:fld"){let Ft=pt(vt,"a:t");if(Ft&&Ft.childNodes[0]){let Ct=Ft.childNodes[0].nodeValue||"";dt.text+=Ct;let mt=pt(vt,"a:rPr"),ot={};if(mt){mt.getAttribute("b")==="1"&&(ot.bold=!0),mt.getAttribute("i")==="1"&&(ot.italic=!0),mt.getAttribute("u")==="sng"&&(ot.underline=!0),mt.getAttribute("strike")==="sngStrike"&&(ot.strikethrough=!0);let Et=mt.getAttribute("sz");Et&&(ot.size=(parseInt(Et)/100).toString()+"pt");let Pt=pt(mt,"a:solidFill");if(Pt){let O=pt(Pt,"a:srgbClr");if(O){let K=O.getAttribute("val");K&&(ot.color="#"+K)}}let wt=pt(mt,"a:highlight");if(wt){let O=pt(wt,"a:srgbClr");if(O){let K=O.getAttribute("val");K&&(ot.backgroundColor="#"+K)}}let kt=pt(mt,"a:latin");if(kt){let O=kt.getAttribute("typeface");O&&(ot.font=O)}let St=mt.getAttribute("baseline");if(St){let O=parseInt(St);O<0&&(ot.subscript=!0),O>0&&(ot.superscript=!0)}}let ht={type:"text",text:Ct,formatting:ot},gt=pt(vt,"a:hlinkClick");if(gt){let Et=gt.getAttribute("r:id"),Pt=gt.getAttribute("action"),wt,kt;Et&&x[I]&&x[I][Et]&&x[I][Et].type==="hyperlink"?(wt=x[I][Et].target,kt="external"):Et&&x[I]&&x[I][Et]&&x[I][Et].type==="slide"?(wt=x[I][Et].target,kt="internal"):Pt&&(wt=Pt,kt="internal"),wt&&(ht.metadata={link:wt,linkType:kt})}dt.children?.push(ht)}}else bt==="a:br"&&(ft?(dt={type:"paragraph",text:"",children:[],metadata:{indentation:st,alignment:rt.metadata?.alignment||"left"}},t.includeRawContent&&(dt.rawContent=ee(tt,_,t)),W.push(dt)):(dt.text+=`
|
|
747
|
+
`)}let kt=ut(ht,"draw:frame");for(let St of kt){let O="",K=pt(St,"svg:title"),Tt=pt(St,"svg:desc");K&&K.textContent?O=K.textContent:Tt&&Tt.textContent&&(O=Tt.textContent);let xt="",Mt=ut(St,"draw:image");if(Mt.length>0){let se=Mt[0].getAttribute("xlink:href");if(se){let _n=se.split("/");xt=_n[_n.length-1]}}let Ot="",Yt=ut(St,"draw:object");if(Yt.length>0){let se=Yt[0].getAttribute("xlink:href");se&&(Ot=se.split("/")[0])}if(Mt.length>0){let se={type:"image",text:"",children:[],metadata:{attachmentName:xt,...O?{altText:O}:{}}};t.includeRawContent&&(se.rawContent=ee(St,D,t)),Pt.push(se)}else if(Ot){let se={type:"chart",text:"",children:[],metadata:{attachmentName:Ot}};Pt.push(se)}}for(let St=0;St<gt;St++){if(Et||Pt.length>0||h!=="ods"){let O={type:"cell",text:Et,children:Pt,metadata:{row:lt,col:Ct}};t.includeRawContent&&(O.rawContent=ee(ht,D,t)),bt.push(O)}Ct++}}if(bt.length>0)for(let ot=0;ot<mt;ot++){let ht={type:"row",children:JSON.parse(JSON.stringify(bt)),metadata:void 0};ot>0&&ht.children?.forEach(gt=>{gt.metadata&&"row"in gt.metadata&&(gt.metadata.row=lt)}),t.includeRawContent&&(ht.rawContent=ee(vt,D,t)),J.push(ht),lt++}else lt+=mt}let dt={type:"sheet",children:J,metadata:{sheetName:ft}};t.includeRawContent&&(dt.rawContent=ee(at,D,t)),m.push(dt)}}}else if(h==="odp"){let L=pt(P,"office:presentation");if(L){let tt=Qe(L,"draw:page"),rt=[];for(let at=0;at<tt.length;at++){let ft=tt[at],J={type:"slide",children:[],metadata:{slideNumber:at+1}},st,lt=ft.childNodes;if(lt)for(let dt=0;dt<lt.length;dt++){let et=lt[dt];if(Oe(et)){let vt=et;if(vt.tagName==="presentation:notes"){t.ignoreNotes||(st={type:"note",children:[],metadata:{slideNumber:at+1,noteId:`slide-note-${at+1}`}},V(vt,st.children,!1,D));continue}V(vt,J.children,!1,D)}}t.includeRawContent&&(J.rawContent=ee(ft,D,t)),m.push(J),st&&st.children&&st.children.length>0&&(t.putNotesAtLast?rt.push(st):m.push(st))}rt.length>0&&m.push(...rt)}}else{let L=pt(P,"office:text");L&&V(L,m,!1,D)}})(d.content.toString());let Z=[],Y=c.filter(D=>D.path.match(/(Pictures|media)\/.*/));if(t.extractAttachments){let D=c.filter(F=>F.path.match(/Object \d+\/content\.xml/));for(let F of D){let P=le(F.content.toString());if(ut(P,"chart:chart").length>0){let H=F.path.split("/")[0],V={type:"chart",mimeType:"application/vnd.oasis.opendocument.chart",data:F.content.toString("base64"),name:H,extension:"xml"},L=dl(F.content);L.rawTexts.length>0&&(V.chartData=L),Z.push(V)}}}if(t.extractAttachments)for(let D of Y){let F=Mr(D.path.split("/").pop()||"image",D.content);if(Z.push(F),t.ocr&&F.mimeType.startsWith("image/"))try{F.ocrText=(await lr(D.content,{...t.ocrConfig})).trim()}catch(P){Ce("OCR_FAILED",t,F.name,P)}}let X=c.find(D=>D.path.match(s)),T=X?no(X.content.toString()):{},I=(D,F)=>{let P=H=>{let V=H.replace(/^\[|\]$/g,""),[L,tt]=V.split(":"),rt=L.lastIndexOf(".");if(rt===-1)return[H];let at=L.substring(0,rt).replace(/^'|'$/g,""),ft=L.substring(rt+1).replace(/\$/g,""),J=ft;if(tt)if(tt.startsWith("."))J=tt.substring(1).replace(/\$/g,"");else{let bt=tt.lastIndexOf(".");J=tt.substring(bt+1).replace(/\$/g,"")}let st=bt=>{let Ft=bt.match(/[A-Z]+/),Ct=bt.match(/\d+/);if(!Ft||!Ct)return null;let mt=Ft[0],ot=0;for(let gt=0;gt<mt.length;gt++)ot=ot*26+(mt.charCodeAt(gt)-65+1);return ot-=1,{r:parseInt(Ct[0])-1,c:ot}},lt=st(ft),dt=st(J);if(!lt||!dt)return[H];let et=F.find(bt=>bt.type==="sheet"&&bt.metadata?.sheetName===at);if(!et||!et.children)return[H];let vt=[];for(let bt of et.children)if(bt.children)for(let Ft of bt.children){let Ct=Ft.metadata;Ct&&Ct.row>=lt.r&&Ct.row<=dt.r&&Ct.col>=lt.c&&Ct.col<=dt.c&&vt.push(Ft.text||"")}return vt.length>0?vt:[]};for(let H of D.dataSets){let V=[];for(let L of H.values)L.startsWith("[")?V.push(...P(L)):V.push(L);H.values=V}let G=[];for(let H of D.labels)H.startsWith("[")?G.push(...P(H)):G.push(H);D.labels=G,D.rawTexts=[],D.title&&D.rawTexts.push(D.title);for(let H of D.dataSets)H.name&&D.rawTexts.push(H.name),D.rawTexts.push(...D.labels),D.rawTexts.push(...H.values)};for(let D of Z)D.type==="chart"&&D.chartData&&I(D.chartData,m);(D=>{let F=new Set,P=L=>{for(let tt of L){if(tt.metadata&&"attachmentName"in tt.metadata){let rt=tt.metadata.attachmentName;rt&&F.add(rt)}tt.children&&P(tt.children)}};P(D);let G=Z.filter(L=>L.type==="image"&&L.name&&!F.has(L.name)),H=0,V=L=>{if((L.type==="image"||L.type==="chart")&&L.metadata&&"attachmentName"in L.metadata){let tt=L.metadata.attachmentName;if(!tt&&L.type==="image"&&H<G.length&&(tt=G[H++].name,L.metadata.attachmentName=tt),tt){let rt=Z.find(at=>at.name===tt);rt&&(rt.ocrText&&(L.text=rt.ocrText),rt.chartData&&L.type==="chart"&&(L.text=rt.chartData.rawTexts.join(t.newlineDelimiter)))}}L.children&&L.children.forEach(V)};D.forEach(V)})(m);let W={};for(let D in x)W[D]={formatting:x[D],alignment:b[D]?.alignment};for(let D in b)W[D]||(W[D]={formatting:{},alignment:b[D]?.alignment});t.putNotesAtLast&&y.length>0&&m.push(...y);let z=()=>m.map(D=>{let F=P=>{let G="";if(P.children&&P.children.length>0){let V=P.children.some(L=>L.children&&L.children.length>0)?t.newlineDelimiter:"";G+=P.children.map(F).filter(L=>L!="").join(V)}else G+=P.text||"";return G};return F(D)}).filter(D=>D!="").join(t.newlineDelimiter);return An(h,{...T,styleMap:W},m,Z,t,z)};B();B();async function N2(r){try{let{pathToFileURL:t}=await import("url"),e=iu.resolve(r),n=t(e).href;return new Function("s","return import(/* @vite-ignore */ /* webpackIgnore: true */ s)")(n)}catch{return new Function("s","return import(/* @vite-ignore */ /* webpackIgnore: true */ s)")(r)}}async function I2(){return _r?Promise.resolve().then(()=>(rT(),iT)):(Vb(),N2("file-type"))}async function GD(){if(!_r){Vb();try{return await N2("pdfjs-dist/legacy/build/pdf.mjs")}catch{return await N2("pdfjs-dist")}}return Promise.resolve().then(()=>(jD(),zD))}function eF(r){return r&&typeof r.str=="string"&&Array.isArray(r.transform)&&r.transform.length>=6}function nF(r){let t=[];for(let i of r)for(let s of i)s.type==="text"&&s.height>0&&t.push(s.height);if(t.length===0)return{median:12,max:12};t.sort((i,s)=>i-s);let e=t[Math.floor(t.length/2)],n=t[t.length-1];return{median:e,max:n}}function iF(r,t){if(r<=t.median*1.2)return 0;let e=r/t.median;return e>=2?1:e>=1.7?2:e>=1.5?3:e>=1.35?4:e>=1.2?5:0}function rF(r,t){let e=r.x,n=r.x+r.width,i=r.y,s=r.y+r.height;for(let a of t){let[l,c,u,h]=a.rect,d=Math.min(l,u),f=Math.max(l,u),p=Math.min(c,h),m=Math.max(c,h);if(e<f&&n>d&&i<m&&s>p)return a}}function sF(r,t,e){let n=Math.floor((24*r+31)/32)*4,i=n-r*3,s=54,a=n*t,l=s+a,c=ct.Buffer.alloc(l);c.write("BM",0),c.writeUInt32LE(l,2),c.writeUInt32LE(0,6),c.writeUInt32LE(s,10),c.writeUInt32LE(40,14),c.writeInt32LE(r,18),c.writeInt32LE(-t,22),c.writeUInt16LE(1,26),c.writeUInt16LE(24,28),c.writeUInt32LE(0,30),c.writeUInt32LE(a,34),c.writeInt32LE(2835,38),c.writeInt32LE(2835,42),c.writeUInt32LE(0,46),c.writeUInt32LE(0,50);let u=s;for(let h=0;h<t;h++){for(let d=0;d<r;d++){let f=(h*r+d)*4,p=e[f+0],m=e[f+1],y=e[f+2],b=e[f+3]/255,w=Math.round(p*b+255*(1-b)),C=Math.round(m*b+255*(1-b)),E=Math.round(y*b+255*(1-b));c[u+0]=E,c[u+1]=C,c[u+2]=w,u+=3}for(let d=0;d<i;d++)c[u]=0,u++}return c}function aF(r,t,e,n){let i;if(n===1){i=new Uint8ClampedArray(t*e*4);for(let s=0;s<t*e;s++){let a=r[s];i[s*4]=a,i[s*4+1]=a,i[s*4+2]=a,i[s*4+3]=255}}else if(n===2||r.length===t*e*3){i=new Uint8ClampedArray(t*e*4);for(let s=0;s<t*e;s++)i[s*4]=r[s*3],i[s*4+1]=r[s*3+1],i[s*4+2]=r[s*3+2],i[s*4+3]=255}else i=r instanceof Uint8ClampedArray?r:new Uint8ClampedArray(r);return ct.Buffer.from(i.buffer,i.byteOffset,i.byteLength)}var HD=async(r,t)=>{let e=await GD(),n=t.pdfWorkerSrc;if(_r)e.GlobalWorkerOptions.workerSrc=n;else{Dg("pdf-worker-auto-resolution");let b=!1;if(n!==fg.pdfWorkerSrc&&n!=="")e.GlobalWorkerOptions.workerSrc=n,b=!0;else try{let w=iu.resolve("pdfjs-dist/legacy/build/pdf.worker.mjs"),{pathToFileURL:C}=await import("url");e.GlobalWorkerOptions.workerSrc=C(w).href,b=!0}catch(w){Ce("PDF_WORKER_FALLBACK",t,void 0,w)}b||(e.GlobalWorkerOptions.workerSrc=n)}let i=new Uint8Array(r),s=e.getDocument({data:i,verbosity:0}),a;try{a=await s.promise}catch(b){let w=b instanceof Error?b.message:String(b);throw w.includes("workerSrc")||w.includes('No "GlobalWorkerOptions.workerSrc" specified')?hn("PDF_WORKER_MISSING",t):b}let l=[],c=[],u=a.numPages,h=[],f=(await a.getMetadata().catch(()=>({info:{}}))).info,p={pages:u,title:f?.Title,author:f?.Author,subject:f?.Subject,description:f?.Keywords,created:ls(f?.CreationDate),modified:ls(f?.ModDate)},m=new Set(["Title","Author","Subject","Keywords","Creator","Producer","CreationDate","ModDate","Trapped","IsAcroFormPresent","IsXFAPresent","IsCollectionPresent","IsSignaturesPresent","PDFFormatVersion"]);if(f){let b={};for(let w of Object.keys(f)){if(m.has(w))continue;let C=f[w];if(C!=null){if(w==="Custom"&&typeof C=="object"&&!Array.isArray(C)&&!(C instanceof Date)){for(let[E,S]of Object.entries(C))S!=null&&(typeof S=="string"||typeof S=="number"||typeof S=="boolean"||S instanceof Date)&&(b[E]=S);continue}(typeof C=="string"||typeof C=="number"||typeof C=="boolean"||C instanceof Date)&&(b[w]=C)}}Object.keys(b).length>0&&(p.customProperties=b)}try{let b=await a.getAttachments();if(b&&t.extractAttachments)for(let w in b){let C=b[w],E=ct.Buffer.from(C.content),S=Mr(C.filename,E);c.push(S)}}catch(b){Ce("ATTACHMENT_EXTRACTION_FAILED",t,void 0,b)}for(let b=1;b<=u;b++){let w,C,E=[];try{w=await a.getPage(b),C=await w.getTextContent()}catch(k){Ce("PAGE_LOAD_FAILED",t,b,k),h.push(E);continue}let S=w.commonObjs,N=new Map;for(let k of C.items){if(!eF(k))continue;let M=k,R=M.transform,j=R[4],$=R[5],q=M.width||0,Q=M.height||Math.abs(R[3])||12,Z={},Y;if(M.fontName&&S)try{if(S.has(M.fontName)){let X=N.get(M.fontName);if(X||(X=await new Promise(T=>{S.get(M.fontName,I=>T(I))}),N.set(M.fontName,X)),X?.name&&typeof X.name=="string"){Y=X.name.replace(/^[A-Z]{6}\+/,""),Z.font=Y;let T=X.name.toLowerCase();T.includes("bold")&&(Z.bold=!0),(T.includes("italic")||T.includes("oblique"))&&(Z.italic=!0)}}}catch{}Q>0&&(Z.size=Math.round(Q).toString()),E.push({type:"text",x:j,y:$,width:q,height:Q,text:M.str,fontName:Y,formatting:Z})}if(t.extractAttachments||t.ocr)try{let k=await w.getOperatorList(),M=k.fnArray,R=k.argsArray;for(let j=0;j<M.length;j++){let $=M[j];if($===e.OPS.dependency){let q=R[j];for(let Q of q)try{if(w.objs.has(Q))continue;await new Promise(Z=>{let Y=setTimeout(()=>{Z()},500);w.objs.get(Q,X=>{clearTimeout(Y),Z()})})}catch(Z){Ce("DEPENDENCY_LOAD_FAILED",t,Q,Z)}}if($===e.OPS.paintImageXObject||$===e.OPS.paintXObject){let q=R[j][0];try{let Q=w.objs.has(q),Z=w.objs;if(!Q&&w.commonObjs.has(q)&&(Q=!0,Z=w.commonObjs),Q){let Y=await new Promise(X=>{Z.get(q,T=>X(T))});if(_r&&!Y.data&&Y.bitmap)try{let X=document.createElement("canvas");X.width=Y.width,X.height=Y.height;let T=X.getContext("2d");T&&(T.drawImage(Y.bitmap,0,0),Y.data=T.getImageData(0,0,Y.width,Y.height).data,Y.kind=3)}catch(X){Ce("IMAGE_PROCESSING_FAILED",t,void 0,X)}if(Y?.data&&Y.width>0&&Y.height>0){let X=0,T=0;for(let I=j-1;I>=0;I--)if(M[I]===e.OPS.transform){X=R[I][4],T=R[I][5];break}E.push({type:"image",x:X,y:T,name:q,data:Y.data,width:Y.width,height:Y.height,kind:Y.kind})}}}catch{}}}}catch(k){Ce("IMAGE_EXTRACTION_FAILED",t,`from page ${b}`,k)}h.push(E)}let y=nF(h);for(let b=0;b<h.length;b++){let w=b+1,C;try{C=await a.getPage(w)}catch(q){Ce("PAGE_LOAD_FAILED",t,w,q);continue}let E=h[b],S=[],N=[],k=new Set;try{let q=await C.getAnnotations();for(let Q of q)if(Q.subtype==="Link"&&Q.rect){let Z=Q.url||Q.unsafeUrl||Q.data?.url;N.push({rect:Q.rect,url:Z,dest:Q.dest})}}catch(q){Ce("ANNOTATION_EXTRACTION_FAILED",t,w,q)}E.sort((q,Q)=>Math.abs(Q.y-q.y)>7?Q.y-q.y:q.x-Q.x);let M=null,R=0,j=-1,$=0;for(let q of E)if(q.type==="text"){let Q=q.text;if(!Q)continue;if(j!==-1&&Math.abs(q.y-j)>5&&M&&((M.text||"").trim().length>0&&S.push(M),M=null),!M&&Q.trim().length===0){j=q.y;continue}let Y=iF(q.height,y);if(M||(Y>0?M={type:"heading",text:"",children:[],metadata:{level:Y}}:M={type:"paragraph",text:"",children:[]},R=q.height),Q.trim().length===0){if(M.children&&M.children.length>0){let _=M.children[M.children.length-1];_.type==="text"&&_.text&&(_.text+=Q,M.text+=Q)}j=q.y;continue}if(M.text&&M.text.length>0&&!M.text.endsWith(" ")&&(M.text+=" ",M.children&&M.children.length>0)){let _=M.children[M.children.length-1];_.type==="text"&&_.text&&(_.text+=" ")}M.text+=Q;let X=rF(q,N);X&&k.add(X);let T;X&&(X.url?T={link:X.url,linkType:X.url.startsWith("#")?"internal":"external"}:X.dest&&(T={link:typeof X.dest=="string"?`#${X.dest}`:"#internal",linkType:"internal"}));let I=!1;if(M.children&&M.children.length>0&&!T){let _=M.children[M.children.length-1];_.type==="text"&&oF(_.formatting,q.formatting)&&!_.metadata&&(_.text=(_.text||"")+Q,I=!0)}if(!I){let _={type:"text",text:Q,formatting:Object.keys(q.formatting).length>0?q.formatting:void 0};T&&(_.metadata=T),M.children?.push(_)}j=q.y}else if(q.type==="image"){M&&((M.text||"").trim().length>0&&S.push(M),M=null),$++;let Q=`pdf_image_p${w}_${$}.bmp`;if(t.extractAttachments)try{let Z=aF(q.data,q.width,q.height,q.kind),Y=sF(q.width,q.height,new Uint8Array(Z)),X=Mr(Q,Y);if(X.mimeType="image/bmp",t.ocr)try{q.width>=10&&q.height>=10&&(X.ocrText=(await lr(Y,{...t.ocrConfig})).trim())}catch(I){Ce("OCR_FAILED",t,Q,I)}c.push(X);let T={attachmentName:Q};S.push({type:"image",text:X.ocrText||"",metadata:{...T}})}catch(Z){Ce("IMAGE_EXTRACTION_FAILED",t,Q,Z)}}M&&(M.text||"").trim().length>0&&S.push(M),l.push({type:"page",children:S,text:S.map(q=>q.text).join(t.newlineDelimiter),metadata:{pageNumber:w}})}return An("pdf",p,l,c,t,()=>l.map(b=>b.text).join(t.newlineDelimiter))};function oF(r,t){if(!r&&!t)return!0;if(!r||!t)return!1;let e=Object.keys(r).sort(),n=Object.keys(t).sort();if(e.length!==n.length)return!1;for(let i=0;i<e.length;i++){let s=e[i];if(e[i]!==n[i]||r[s]!==t[s])return!1}return!0}B();var WD=async(r,t)=>{let e=/ppt\/(notesSlides|slides)\/(notesSlide|slide)\d+.xml/g,n=/ppt\/slides\/slide\d+.xml/g,i=/ppt\/slides\/_rels\/slide\d+\.xml\.rels/,s=/lide(\d+)\.xml/,a=/ppt\/media\/.*/,l=/ppt\/charts\/chart\d+\.xml/,c=/docProps\/core\.xml/,u=/docProps\/custom\.xml/,h=await ro(r,T=>!!T.match(t.ignoreNotes?n:e)||!!T.match(c)||!!T.match(u)||!!T.match(i)||!!t.extractAttachments&&(!!T.match(a)||!!T.match(l))),d=h.find(T=>T.path.match(c)),f=d?no(d.content.toString()):{},p=h.find(T=>T.path.match(u));if(p){let T=ku(p.content.toString());Object.keys(T).length>0&&(f.customProperties=T)}h.sort((T,I)=>{let _=T.path.match(s),W=I.path.match(s),z=_?parseInt(_[1]):0,D=W?parseInt(W[1]):0;return z-D});let m=[],y=[],x={},b=0,w=0,C=!1,E=null,S=0,N={},k=(T,I)=>{let _=[],W=ut(T,"a:tr");for(let z=0;z<W.length;z++){let D=W[z],F=[],P=ut(D,"a:tc");for(let H=0;H<P.length;H++){let V=P[H],L=[],tt="",rt=pt(V,"a:txBody");if(rt){let ft=ut(rt,"a:p");for(let J of ft){let st={type:"paragraph",text:"",children:[],metadata:{}};t.includeRawContent&&(st.rawContent=ee(J,I,t));let lt=ut(J,"a:r");for(let dt of lt){let et=pt(dt,"a:t");if(et&&et.childNodes[0]){let vt=et.childNodes[0].nodeValue||"";st.text+=vt;let bt=pt(dt,"a:rPr"),Ft={};if(bt){bt.getAttribute("b")==="1"&&(Ft.bold=!0),bt.getAttribute("i")==="1"&&(Ft.italic=!0),bt.getAttribute("u")==="sng"&&(Ft.underline=!0),bt.getAttribute("strike")==="sngStrike"&&(Ft.strikethrough=!0);let Ct=bt.getAttribute("sz");Ct&&(Ft.size=(parseInt(Ct)/100).toString()+"pt");let mt=pt(bt,"a:solidFill");if(mt){let ht=pt(mt,"a:srgbClr");if(ht){let gt=ht.getAttribute("val");gt&&(Ft.color="#"+gt)}}let ot=pt(bt,"a:latin");if(ot){let ht=ot.getAttribute("typeface");ht&&(Ft.font=ht)}}st.children?.push({type:"text",text:vt,formatting:Ft})}}L.push(st),tt+=st.text}}let at={type:"cell",text:tt,children:L,metadata:{row:z,col:H}};F.push(at)}let G={type:"row",children:F};_.push(G)}return{type:"table",children:_}},M=(T,I,_)=>{let W=pt(T,"a:blip");if(!W)return null;let z=W.getAttribute("r:embed");if(!z)return null;let D=x[I]?.[z];if(!D||D.type!=="image")return null;let F=D.target,P=pt(T,"p:nvPicPr"),H=(P?pt(P,"p:cNvPr"):null)?.getAttribute("descr")||void 0;return{type:"image",text:"",metadata:{attachmentName:F,altText:H}}},R=(T,I,_)=>{let W=pt(T,"a:graphicData");if(!W||!(W.getAttribute("uri")==="http://schemas.openxmlformats.org/drawingml/2006/chart"))return null;let F=pt(W,"c:chart");if(!F)return null;let P=F.getAttribute("r:id");if(!P)return null;let G=x[I]?.[P];if(!G||G.type!=="chart")return null;let V={type:"chart",text:"",metadata:{attachmentName:G.target}};return t.includeRawContent&&(V.rawContent=ee(T,_,t)),V},j=(T,I,_)=>{let W=pt(T,"a:tbl");if(W){let z=k(W,_);if(t.includeRawContent&&(z.rawContent=ee(T,_,t)),z.children&&z.children.length>0)return z}if(T.getElementsByTagName("c:chart").length>0){let z=R(T,I,_);if(z)return z}return null},$=(T,I,_)=>{let W=[],z=pt(T,"p:nvSpPr"),D=z?pt(z,"p:nvPr"):null,F=D?pt(D,"p:ph"):null,P=F?F.getAttribute("type"):"body",G=P==="title"||P==="ctrTitle",H=pt(T,"p:txBody");if(H){let V=ut(H,"a:p");for(let L=0;L<V.length;L++){let tt=V[L],rt={type:G?"heading":"paragraph",text:"",children:[],metadata:G?{level:1}:{}},at=pt(tt,"a:pPr"),ft=!1,J="unordered",st=0;if(at){let et=at.getAttribute("lvl");et&&(st=parseInt(et));let vt=pt(at,"a:buAutoNum"),bt=pt(at,"a:buChar"),Ft=pt(at,"a:buBlip"),Ct=pt(at,"a:bu");vt?(ft=!0,J="ordered"):(bt||Ft||Ct)&&(ft=!0,J="unordered");let mt=at.getAttribute("algn");if(mt){let ot={l:"left",ctr:"center",r:"right",just:"justify"};ot[mt]&&(rt.metadata.alignment=ot[mt])}}if(ft){rt.type="list";let et=st;if(!C||J!==E){b++;for(let bt in N)delete N[bt];w=0,N[et]=0}else if(et>S)w=0,N[et]=0;else if(et<S){for(let Ft in N){let Ct=parseInt(Ft);Ct>et&&delete N[Ct]}w=(N[et]||0)+1,N[et]=w}else w=(N[et]||0)+1,N[et]=w;C=!0,E=J,S=et,rt.metadata={...rt.metadata,listType:J,indentation:et,listId:b.toString(),itemIndex:w,alignment:rt.metadata?.alignment||"left"}}else C=!1,E=null,S=0;G&&(rt.metadata={...rt.metadata,level:1}),t.includeRawContent&&(rt.rawContent=ee(tt,_,t));let lt=Array.from(tt.childNodes),dt=rt;W.push(dt);for(let et of lt){if(!Oe(et))continue;let vt=et,bt=vt.tagName;if(bt==="a:r"||bt==="a:fld"){let Ft=pt(vt,"a:t");if(Ft&&Ft.childNodes[0]){let Ct=Ft.childNodes[0].nodeValue||"";dt.text+=Ct;let mt=pt(vt,"a:rPr"),ot={};if(mt){mt.getAttribute("b")==="1"&&(ot.bold=!0),mt.getAttribute("i")==="1"&&(ot.italic=!0),mt.getAttribute("u")==="sng"&&(ot.underline=!0),mt.getAttribute("strike")==="sngStrike"&&(ot.strikethrough=!0);let Et=mt.getAttribute("sz");Et&&(ot.size=(parseInt(Et)/100).toString()+"pt");let Pt=pt(mt,"a:solidFill");if(Pt){let O=pt(Pt,"a:srgbClr");if(O){let K=O.getAttribute("val");K&&(ot.color="#"+K)}}let wt=pt(mt,"a:highlight");if(wt){let O=pt(wt,"a:srgbClr");if(O){let K=O.getAttribute("val");K&&(ot.backgroundColor="#"+K)}}let kt=pt(mt,"a:latin");if(kt){let O=kt.getAttribute("typeface");O&&(ot.font=O)}let St=mt.getAttribute("baseline");if(St){let O=parseInt(St);O<0&&(ot.subscript=!0),O>0&&(ot.superscript=!0)}}let ht={type:"text",text:Ct,formatting:ot},gt=pt(vt,"a:hlinkClick");if(gt){let Et=gt.getAttribute("r:id"),Pt=gt.getAttribute("action"),wt,kt;Et&&x[I]&&x[I][Et]&&x[I][Et].type==="hyperlink"?(wt=x[I][Et].target,kt="external"):Et&&x[I]&&x[I][Et]&&x[I][Et].type==="slide"?(wt=x[I][Et].target,kt="internal"):Pt&&(wt=Pt,kt="internal"),wt&&(ht.metadata={link:wt,linkType:kt})}dt.children?.push(ht)}}else bt==="a:br"&&(ft?(dt={type:"paragraph",text:"",children:[],metadata:{indentation:st,alignment:rt.metadata?.alignment||"left"}},t.includeRawContent&&(dt.rawContent=ee(tt,_,t)),W.push(dt)):(dt.text+=`
|
|
748
748
|
`,dt.children?.push({type:"text",text:`
|
|
749
|
-
`})))}}}return W.filter(V=>V.text?.trim()||V.children&&V.children.length>0)};function q(T,I,_){let W=[];for(let z of Array.from(T?.childNodes||[])){if(!Oe(z))continue;let D=z,F=D.tagName;if(F==="p:sp")W.push(...$(D,I,_));else if(F==="p:pic"){let P=M(D,I,_);P&&W.push(P)}else if(F==="p:graphicFrame"){let P=j(D,I,_);P&&W.push(P)}else if(F==="p:grpSp"){let P=pt(D,"p:spTree");P&&W.push(...q(P,I,_))}}return W}for(let T of h)if(T.path.match(i)){let I=T.path.match(/slide(\d+)\.xml\.rels/);if(I){let _=parseInt(I[1]);x[_]={};let W=le(T.content.toString()),z=ut(W,"Relationship");for(let D=0;D<z.length;D++){let F=z[D].getAttribute("Id"),P=z[D].getAttribute("Type"),G=z[D].getAttribute("Target");if(F&&P&&G){let H="other";P.includes("relationships/image")?H="image":P.includes("relationships/hyperlink")?H="hyperlink":P.includes("relationships/chart")?H="chart":P.includes("relationships/slide")?H="slide":P.includes("relationships/notesSlide")&&(H="notes");let V=G;G.startsWith("http://")||G.startsWith("https://")||(V=V.split("/").pop()||""),x[_][F]={type:H,target:V}}}}}for(let T of h){if(T.path.match(a)||T.path.match(l)||T.path.match(i)||T.path.match(c))continue;let I=T.content.toString(),_=le(I,{locator:t.includeRawContent});t.includeRawContent&&y.push(I);let W=T.path.match(s),z=W?parseInt(W[1]):0,D=T.path.includes("notesSlide"),F={type:D?"note":"slide",children:[],metadata:{slideNumber:z,...D?{noteId:`slide-note-${z}`}:{}}};t.includeRawContent&&(F.rawContent=ee(_,I,t));let P=pt(_,"p:spTree");P&&F.children?.push(...q(P,z,I)),F.children&&F.children.length>0&&m.push(F)}let Q=[],Z=h.filter(T=>T.path.match(/ppt\/media\/.*/)),Y=h.filter(T=>T.path.match(/ppt\/charts\/chart\d+\.xml/));if(t.extractAttachments){for(let I of Z){let _=Mr(I.path.split("/").pop()||"image",I.content);if(Q.push(_),t.ocr&&_.mimeType.startsWith("image/"))try{_.ocrText=(await lr(I.content,{...t.ocrConfig})).trim()}catch(W){
|
|
749
|
+
`})))}}}return W.filter(V=>V.text?.trim()||V.children&&V.children.length>0)};function q(T,I,_){let W=[];for(let z of Array.from(T?.childNodes||[])){if(!Oe(z))continue;let D=z,F=D.tagName;if(F==="p:sp")W.push(...$(D,I,_));else if(F==="p:pic"){let P=M(D,I,_);P&&W.push(P)}else if(F==="p:graphicFrame"){let P=j(D,I,_);P&&W.push(P)}else if(F==="p:grpSp"){let P=pt(D,"p:spTree");P&&W.push(...q(P,I,_))}}return W}for(let T of h)if(T.path.match(i)){let I=T.path.match(/slide(\d+)\.xml\.rels/);if(I){let _=parseInt(I[1]);x[_]={};let W=le(T.content.toString()),z=ut(W,"Relationship");for(let D=0;D<z.length;D++){let F=z[D].getAttribute("Id"),P=z[D].getAttribute("Type"),G=z[D].getAttribute("Target");if(F&&P&&G){let H="other";P.includes("relationships/image")?H="image":P.includes("relationships/hyperlink")?H="hyperlink":P.includes("relationships/chart")?H="chart":P.includes("relationships/slide")?H="slide":P.includes("relationships/notesSlide")&&(H="notes");let V=G;G.startsWith("http://")||G.startsWith("https://")||(V=V.split("/").pop()||""),x[_][F]={type:H,target:V}}}}}for(let T of h){if(T.path.match(a)||T.path.match(l)||T.path.match(i)||T.path.match(c))continue;let I=T.content.toString(),_=le(I,{locator:t.includeRawContent});t.includeRawContent&&y.push(I);let W=T.path.match(s),z=W?parseInt(W[1]):0,D=T.path.includes("notesSlide"),F={type:D?"note":"slide",children:[],metadata:{slideNumber:z,...D?{noteId:`slide-note-${z}`}:{}}};t.includeRawContent&&(F.rawContent=ee(_,I,t));let P=pt(_,"p:spTree");P&&F.children?.push(...q(P,z,I)),F.children&&F.children.length>0&&m.push(F)}let Q=[],Z=h.filter(T=>T.path.match(/ppt\/media\/.*/)),Y=h.filter(T=>T.path.match(/ppt\/charts\/chart\d+\.xml/));if(t.extractAttachments){for(let I of Z){let _=Mr(I.path.split("/").pop()||"image",I.content);if(Q.push(_),t.ocr&&_.mimeType.startsWith("image/"))try{_.ocrText=(await lr(I.content,{...t.ocrConfig})).trim()}catch(W){Ce("OCR_FAILED",t,_.name,W)}}for(let I of Y){let _={type:"chart",mimeType:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",data:I.content.toString("base64"),name:I.path.split("/").pop()||"",extension:"xml"};Q.push(_);try{let W=await dl(I.content);_.chartData=W}catch(W){Ce("CHART_DATA_EXTRACTION_FAILED",t,I.path,W)}}let T=I=>{for(let _ of I){if("attachmentName"in(_.metadata||{})){let W=_.metadata,z=Q.find(D=>D.name===W.attachmentName);z&&(_.type==="image"&&(z.altText=W.altText,z.ocrText&&(_.text=z.ocrText)),_.type==="chart"&&(_.text=z.chartData?.rawTexts.join(t.newlineDelimiter)))}_.children&&T(_.children)}};T(m)}return!t.ignoreNotes&&t.putNotesAtLast&&m.sort((T,I)=>{let _=T.type==="note"?1:0,W=I.type==="note"?1:0;return _-W}),An("pptx",f,m,Q,t,()=>m.map(T=>{let I=_=>{let W="";return _.children?W+=_.children.map(I).filter(z=>z!="").join(_.children[0]?.children?t.newlineDelimiter:""):W+=_.text||"",W};return I(T)}).filter(T=>T!="").join(t.newlineDelimiter))};B();var lF={pngblip:"png",jpegblip:"jpeg",gifblip:"gif",tiffblip:"tiff",dibitmap:"bmp",wbitmap:"bmp"},cF={png:"image/png",jpeg:"image/jpeg",gif:"image/gif",tiff:"image/tiff",bmp:"image/bmp"},k2=class{constructor(t){U(this,"index",0);U(this,"buffer");U(this,"codePage",1252);U(this,"decoders",{});U(this,"pendingBytes",[]);U(this,"length");this.buffer=t,this.length=t.length}parse(){let t={type:"group",content:[]},e=[t];for(;this.index<this.length;){let n=this.buffer[this.index],i=e[e.length-1];if(n===123){this.index++,this.flushPendingText(i);let s={type:"group",content:[]};i.content.push(s),e.push(s)}else n===125?(this.index++,this.flushPendingText(i),e.length>1&&e.pop()):n===92?(this.index++,this.parseControl(i)):n===13||n===10?this.index++:this.parseText(i)}return this.flushPendingText(t),t}parseControl(t){if(this.index>=this.length)return;let e=this.buffer[this.index];if(e===123||e===125||e===92){this.pendingBytes.push(e),this.index++;return}if(e===39){if(this.index++,this.index+1<this.length){let l=String.fromCharCode(this.buffer[this.index],this.buffer[this.index+1]),c=parseInt(l,16);isNaN(c)||this.pendingBytes.push(c),this.index+=2}return}if(this.flushPendingText(t),e===42){t.content.push({type:"control",value:"*"}),this.index++;return}let n="";for(;this.index<this.length;){let l=this.buffer[this.index];if(l>=97&&l<=122||l>=65&&l<=90)n+=String.fromCharCode(l),this.index++;else break}let i,s=!1,a="";for(this.index<this.length&&this.buffer[this.index]===45&&(a+="-",this.index++);this.index<this.length;){let l=this.buffer[this.index];if(l>=48&&l<=57)a+=String.fromCharCode(l),this.index++,s=!0;else break}if(s&&(i=parseInt(a,10)),n!==""&&this.index<this.length&&this.buffer[this.index]===32&&this.index++,n==="bin"&&i!==void 0&&i>0){this.index+=i;return}n==="ansicpg"&&i!==void 0?this.codePage=i:n==="ansi"?this.codePage=1252:n==="mac"?this.codePage=1e4:n==="pc"?this.codePage=437:n==="pca"&&(this.codePage=850),t.content.push({type:"control",value:n,param:i}),(t.content.length===1&&t.type==="group"||t.content.length===2&&t.content[0].type==="control"&&t.content[0].value==="*")&&(t.destination=n)}parseText(t){for(;this.index<this.length;){let e=this.buffer[this.index];if(e===void 0||e===123||e===125||e===92||e===13||e===10)break;this.pendingBytes.push(e),this.index++}}flushPendingText(t){this.pendingBytes.length>0&&(t.content.push({type:"text",value:this.decodeBytes(this.pendingBytes,this.codePage)}),this.pendingBytes=[])}decodeBytes(t,e){let n=new Uint8Array(t);if(t.some(s=>s>127))try{return new TextDecoder("utf-8",{fatal:!0}).decode(n)}catch{}if(!this.decoders[e]){let s=`windows-${e}`;e===1e4?s="macintosh":e===437?s="ibm437":e===850&&(s="ibm850");try{this.decoders[e]=new TextDecoder(s)}catch{if(e!==1252)try{this.decoders[e]=new TextDecoder("windows-1252")}catch{return String.fromCharCode(...t)}else return String.fromCharCode(...t)}}let i=this.decoders[e].decode(n);if(e===1252&&/[\u0080-\u009F]/.test(i)){let s={"\x80":"\u20AC","\x82":"\u201A","\x83":"\u0192","\x84":"\u201E","\x85":"\u2026","\x86":"\u2020","\x87":"\u2021","\x88":"\u02C6","\x89":"\u2030","\x8A":"\u0160","\x8B":"\u2039","\x8C":"\u0152","\x8E":"\u017D","\x91":"\u2018","\x92":"\u2019","\x93":"\u201C","\x94":"\u201D","\x95":"\u2022","\x96":"\u2013","\x97":"\u2014","\x98":"\u02DC","\x99":"\u2122","\x9A":"\u0161","\x9B":"\u203A","\x9C":"\u0153","\x9E":"\u017E","\x9F":"\u0178"};return i.replace(/[\u0080-\u009F]/g,a=>s[a]||a)}return i}},qD=async(r,t)=>{let n=new k2(r).parse(),i=uF(n),s=hF(n),a=[],l=[],c=[],u=[],h=[],d=[],f=[],p={},m=a,y=0,x="left",b=!1,w,C,E,S=[],N,k,M=[],R=0,j=0,$=()=>M.length>0?M[M.length-1]:void 0,q=()=>{M.length===0&&M.push({rows:[],currentCells:[],currentCellContent:[],rowIndex:0})},Q=!1,Z=!1,Y=0,X=[],T={isMergedContinuation:!1},I=0,_=0,W={},z=!1,D=!1,F,P,G={},H=!1,V,L,tt={},rt={},at,ft=(O,K)=>O.bold!==K.bold||O.italic!==K.italic||O.underline!==K.underline||O.strikethrough!==K.strikethrough||O.size!==K.size||O.font!==K.font||O.color!==K.color||O.backgroundColor!==K.backgroundColor||O.subscript!==K.subscript||O.superscript!==K.superscript,J=()=>{if(f.length>0){let O=f.join(""),K={type:"text",text:O,formatting:{...p}};at&&(K.metadata={link:at,linkType:Ft(at)}),h.push(K),u.push(O),f=[]}},st=!1,lt=()=>{J();let O=u.length>0||h.length>0;if(Q&&!Z&&!st&&O){let K=[...u],Tt=[...h],xt=[...d];u=[],h=[],d=[],vt(),u=K,h=Tt,d=xt}if(O){let K=u.join(""),Tt="paragraph",xt;if(C===void 0&&h.length>0){let Ot=h[0];if(Ot.type==="text"&&Ot.formatting?.bold){let Yt=parseInt(Ot.formatting.size||"12");Yt>=14&&K.length<300&&(Yt>=22?C=1:Yt>=18?C=2:Yt>=16?C=3:C=4)}}if(!b&&y>300){let Ot=K.trim();(/^[\u2022\u00b7\-\u25cf\u25cb]/.test(Ot)||/^\d+[.\)]/.test(Ot))&&(b=!0,w=/^\d+[.\)]/.test(Ot)?"ordered":"unordered")}if(C!==void 0&&C>0)Tt="heading",xt={level:C},N=void 0,k=void 0;else if(b){Tt="list";let Ot=E||N,Yt=w||k||"unordered",se=0;if(Ot){rt[Ot]||(rt[Ot]={});let _n=Object.keys(rt[Ot]).map($s=>parseInt($s));for(let $s of _n)$s>y&&delete rt[Ot][$s];rt[Ot][y]===void 0?rt[Ot][y]=0:rt[Ot][y]++,se=rt[Ot][y]}xt={listType:Yt,indentation:y,listId:Ot||"",itemIndex:se,alignment:x},Ot&&(N=Ot),Yt&&(k=Yt)}let Mt={type:Tt,text:K,children:h,formatting:void 0,metadata:{...xt,anchorIds:S.length>0?[...S]:void 0}};t.includeRawContent&&d.length>0&&(Mt.rawContent=d.join("")),Q&&Z?(q(),$().currentCellContent.push(Mt)):m.push(Mt),u=[],h=[],d=[],S=[]}},dt=O=>{lt();let K=O||$();if(!K)return;let Tt={type:"cell",text:K.currentCellContent.map(xt=>xt.text).join(`
|
|
750
750
|
`),children:[...K.currentCellContent],metadata:{row:K.rowIndex,col:K.currentCells.length}};return K.currentCellContent=[],Tt},et=O=>{let K=O||$();if(!K)return;let Tt=dt(K);if(Tt&&(Tt.children&&Tt.children.length>0||Tt.text)&&K.currentCells.push(Tt),K.currentCells.length>0){let xt={type:"row",text:K.currentCells.map(Mt=>Mt.text).filter(Mt=>Mt!=="").join(t.newlineDelimiter),children:[...K.currentCells]};K.rows.push(xt),K.currentCells=[],K.rowIndex++}},vt=()=>{if(st)return;st=!0;let O=$();if(!O){st=!1;return}if(et(O),O.rows.length>0){Y++;let K={type:"table",text:O.rows.map(Tt=>Tt.text).join(`
|
|
751
751
|
`),children:[...O.rows]};M.length>1?M[M.length-2].currentCellContent.push(K):m.push(K)}M.pop(),M.length===0&&(Q=!1,Z=!1),st=!1},bt=O=>{let K,Tt=xt=>{if(xt.type==="text"){let Mt=xt.value,Ot=Mt.match(/HYPERLINK\s+"([^"]+)"/i);if(Ot)return Ot[1];let Yt=Mt.match(/"(https?:\/\/[^"]+|mailto:[^"]+|#[^"]+)"/);if(Yt)return Yt[1]}else if(xt.type==="group"){let Mt=!1,Ot,Yt=!1;for(let se of xt.content)if(se.type==="text"){let _n=se.value.toUpperCase();_n.includes("HYPERLINK")&&(Mt=!0),_n.includes("\\L")&&(Yt=!0);let $s=se.value.match(/"([^"]+)"/);$s&&Mt&&(Ot=$s[1])}else if(se.type==="group"){let _n=Tt(se);_n&&(Ot=_n)}if(Ot)return Yt&&!Ot.startsWith("#")?"#"+Ot:Ot}};for(let xt of O.content)if(xt.type==="group"){let Mt=Tt(xt);if(Mt)return Mt}return K},Ft=O=>{let K=O.trim();return K.startsWith("#")||!/^[a-zA-Z][a-zA-Z0-9+.-]*:/.test(K)?"internal":"external"},Ct=O=>{let K="",Tt=xt=>{if(xt.type==="text")K+=xt.value;else if(xt.type==="group")for(let Mt of xt.content)Tt(Mt)};for(let xt of O.content)Tt(xt);return K},mt=O=>{let K,Tt=[];for(let Ot of O.content)if(Ot.type==="control"){let Yt=lF[Ot.value];Yt&&(K=Yt)}else Ot.type==="text"?Tt.push(Ot.value.replace(/[^0-9a-fA-F]/g,"")):Ot.type;let xt=Tt.join("");if(!K||xt.length===0)return;let Mt=cF[K];if(Mt)try{let Ot=ct.Buffer.from(xt,"hex"),Yt=K,se=`image_${c.length+1}.${Yt}`;return{type:"image",mimeType:Mt,data:Ot.toString("base64"),name:se,extension:Yt}}catch{return}},ot=O=>{if(!/^[a-zA-Z]/.test(O.value))return`\\${O.value}`;let K=`\\${O.value}`;return O.param!==void 0&&(K+=O.param),K+=" ",K},ht=O=>{let K="";for(let Tt of O.content)Tt.type==="text"?K+=Tt.value:Tt.type==="group"&&(K+=ht(Tt));return K.trim()},gt=O=>O.value.replace(/([\\{}])/g,"\\$1"),Et=(O,K,Tt=0)=>{if(O.type==="group"){let xt=["fonttbl","colortbl","stylesheet","info","macpict","pmmetafile","wmetafile","dibitmap","bitmap","object","nextGenerator","header","footer","nonshppict","xml","private","upnp","ud","filetbl","operator","author","creatim","revtim","printim","comment","fldinst","listtext","pntext"],Mt=!1,Ot=!1,Yt=!1,se=!1;if(O.destination){if(O.destination==="footnote")Ot=!0;else if(O.destination==="field"){let Ye=bt(O);Ye&&(J(),Yt=!0,at=Ye)}else if(O.destination==="listtable")z=!0;else if(z&&O.destination==="list")D=!0,F=void 0,P=void 0;else if(O.destination==="listoverridetable")H=!0;else if(H&&O.destination==="listoverride")V=void 0,L=void 0;else if(O.destination==="pict")t.extractAttachments?se=!0:Mt=!0;else if(xt.includes(O.destination))Mt=!0;else if(O.content.length>0&&O.content[0].type==="control"&&O.content[0].value==="*"){let Ye=["fldinst","nesttableprops"];if(t.extractAttachments&&Ye.push("shppict","listpicture"),!Ye.includes(O.destination||""))if(O.destination==="bkmkstart"){let Ke=ht(O);Ke&&!S.includes(Ke)&&S.push(Ke),Mt=!0}else O.destination,Mt=!0}}if(O.destination==="listtext"||O.destination==="pntext"){b||(y=0),b=!0;let Ye=Ct(O);if(Ye){let Ke=Ye.trim();["\xB7","\u2022","o","\xA7","\u25A0","\u25A1","\u25CF","\u25CB","\u25C6","\u25C7","\u25BA","\u25B8","\xB7","\u2022","\u25CF","\u25CB"].some(Va=>Ke.includes(Va))||Ke.length===1&&!/[0-9a-zA-Z]/.test(Ke)?w="unordered":(/^[0-9ivxlcdm]+[\.\)]/i.test(Ke)||/^[a-z][\.\)]/i.test(Ke))&&(w="ordered")}Mt=!0}if(Mt)return;if(d.push("{"),se){let Ye=mt(O);Ye&&(c.push(Ye),!z&&!D&&(lt(),m.push({type:"image",text:"",metadata:{attachmentName:Ye.name||`image_${c.length}`}})));for(let Ke of O.content)if(Ke.type==="control")d.push(ot(Ke));else if(Ke.type==="text")d.push(gt(Ke));else if(Ke.type==="group"){let nu=er=>{for(let Va of er.content)Va.type==="control"?d.push(ot(Va)):Va.type==="text"?d.push(gt(Va)):Va.type==="group"&&(d.push("{"),nu(Va),d.push("}"))};nu(O)}d.push("}");return}let _n=m;if(Ot){if(t.ignoreNotes)return;lt(),R++;let Ye="footnote";j===1?Ye="endnote":j===2&&(Ye=O.content.some(er=>er.type==="control"&&er.value==="ftnalt")?"endnote":"footnote");let Ke={type:"note",children:[],metadata:{noteId:R.toString(),noteType:Ye}};l.push(Ke),m=Ke.children}let $s={...K};for(let Ye of O.content){if(Ye.type==="group"&&Ye.destination==="fldinst"){d.push("{");let Ke=nu=>{for(let er of nu.content)er.type==="control"?d.push(ot(er)):er.type==="text"?d.push(gt(er)):er.type==="group"&&(d.push("{"),Ke(er),d.push("}"))};Ke(Ye),d.push("}");continue}Et(Ye,$s,Tt+1)}O.destination==="listtable"?z=!1:O.destination==="list"?(D=!1,F!==void 0&&P!==void 0&&(G[F]=P)):O.destination==="listoverridetable"?H=!1:H&&O.destination==="listoverride"&&L!==void 0&&V!==void 0&&(tt[L]=V),Ot&&(lt(),m=_n),Yt&&(J(),at=void 0),d.push("}")}else if(O.type==="text"){if(z||H){d.push(gt(O));return}ft(p,K)&&(J(),p={...K}),f.push(O.value),d.push(gt(O))}else if(O.type==="control"){if(d.push(ot(O)),z){if(O.value==="listid")F=O.param;else if(O.value==="levelnfc"||O.value==="levelnfcn"){let xt=O.param!==void 0&&(O.param===0||O.param>=0&&O.param<=4);(!P||P==="unordered"&&xt)&&(P=xt?"ordered":"unordered")}return}if(H){O.value==="listid"?V=O.param:O.value==="ls"&&(L=O.param);return}if(O.value==="par")lt(),p={...K};else if(O.value==="trowd"){let xt=$();Q&&xt&&xt.currentCellContent.length>0?(q(),M.push({rows:[],currentCells:[],currentCellContent:[],rowIndex:0})):Q||(Q=!0,q()),Z=!0,X=[],T={isMergedContinuation:!1},I=0}else if(O.value==="clvmrg")T.isMergedContinuation=!0;else if(O.value==="clmgf")T.isMergedContinuation=!1;else if(O.value==="cellx")X.push({...T}),T={isMergedContinuation:!1};else if(O.value==="cell"){Z=!0;let xt=!1;I<X.length&&(xt=X[I].isMergedContinuation),I++;let Mt=dt();if(Mt&&!xt){let Ot=$();Ot&&Ot.currentCells.push(Mt)}p={...K}}else if(O.value==="nestcell"){if(M.length>1){let Mt=$();Mt&&(Mt.rows.length>0||Mt.currentCells.length>0)&&vt()}Z=!0;let xt=dt();if(xt){let Mt=$();Mt&&Mt.currentCells.push(xt)}p={...K}}else if(O.value==="row")et(),p={...K},I=0,Z=!1;else if(O.value==="nestrow")M.length>1&&vt(),et(),p={...K},I=0;else if(O.value==="intbl")Q=!0,Z=!0,q();else if(O.value==="pard")Z=!1,y=0,x="left",b=!1,w=void 0,C=void 0,E=void 0,K.backgroundColor=void 0;else if(O.value==="tab")ft(p,K)&&(J(),p={...K}),f.push(" ");else if(O.value==="line")ft(p,K)&&(J(),p={...K}),f.push(`
|
|
752
|
-
`);else if(O.value==="lquote")ft(p,K)&&(J(),p={...K}),f.push("\u2018");else if(O.value==="rquote")ft(p,K)&&(J(),p={...K}),f.push("\u2019");else if(O.value==="ldblquote")ft(p,K)&&(J(),p={...K}),f.push("\u201C");else if(O.value==="rdblquote")ft(p,K)&&(J(),p={...K}),f.push("\u201D");else if(O.value==="u"){if(O.param!==void 0){let xt=O.param;xt<0&&(xt+=65536),ft(p,K)&&(J(),p={...K}),f.push(String.fromCharCode(xt))}}else if(O.value==="b")K.bold=O.param!==0;else if(O.value==="i")K.italic=O.param!==0;else if(O.value==="ul")K.underline=O.param!==0;else if(O.value==="ulnone")K.underline=!1;else if(O.value==="strike")K.strikethrough=O.param!==0;else if(O.value==="plain")K.bold=!1,K.italic=!1,K.underline=!1,K.strikethrough=!1,K.subscript=!1,K.superscript=!1,K.size=void 0,K.font=void 0,K.color=void 0,K.backgroundColor=void 0;else if(O.value==="fs")O.param!==void 0&&(K.size=(O.param/2).toString()+"pt");else if(O.value==="f")O.param!==void 0&&i[O.param]&&(K.font=i[O.param]);else if(O.value==="cf")O.param!==void 0&&s[O.param]&&(K.color=s[O.param]);else if(O.value==="fet")O.param!==void 0&&(j=O.param);else if(O.value==="cb"||O.value==="highlight"||O.value==="chcbpat"||O.value==="cbpat")O.param!==void 0&&s[O.param]&&(K.backgroundColor=s[O.param]);else if(O.value==="sub")K.subscript=!0,K.superscript=!1;else if(O.value==="super")K.superscript=!0,K.subscript=!1;else if(O.value==="nosupersub")K.subscript=!1,K.superscript=!1;else if(O.value==="li"){if(O.param!==void 0){let xt=Math.round(O.param/720);b||(y=xt)}}else if(O.value==="ls"){if(O.param!==void 0){b||(y=0),b=!0,W[O.param]||(_++,W[O.param]=`rtf-list-${_}`),E=W[O.param];let xt=tt[O.param]!==void 0?tt[O.param]:O.param;G[xt]&&(w=G[xt])}}else O.value==="ilvl"?O.param!==void 0&&(b=!0,y=O.param):O.value==="pnlvl"?(b=!0,O.param!==void 0&&(y=O.param)):O.value==="levelnfc"||O.value==="pnf"?O.param!==void 0&&(b=!0,O.param===23?w="unordered":w="ordered"):O.value==="pndec"||O.value==="pnord"||O.value==="pnlcltr"||O.value==="pnucltr"?(b||(y=0),b=!0,w="ordered"):O.value==="pnbullet"||O.value==="pncard"?(b||(y=0),b=!0,w="unordered"):O.value==="s"?O.param!==void 0&&O.param>=1&&O.param<=9&&(C=O.param):O.value==="ql"?x="left":O.value==="qc"?x="center":O.value==="qr"?x="right":O.value==="qj"&&(x="justify")}};Et(n,{});let Pt=$();if((Q||Pt&&(Pt.rows.length>0||Pt.currentCells.length>0))&&vt(),lt(),!t.putNotesAtLast&&l.length>0&&(a.push(...l),l.length=0),t.ocr&&t.extractAttachments){for(let K of c)if(K.mimeType.startsWith("image/"))try{let Tt=ct.Buffer.from(K.data,"base64");K.ocrText=(await lr(Tt,{...t.ocrConfig})).trim()}catch(Tt){Se("OCR_FAILED",t,K.name,Tt)}let O=K=>{for(let Tt of K){if(Tt.type==="image"&&Tt.metadata&&"attachmentName"in Tt.metadata){let xt=Tt.metadata,Mt=c.find(Ot=>Ot.name===xt.attachmentName);Mt&&(Mt.ocrText&&(Tt.text=Mt.ocrText),Mt.altText&&(xt.altText=Mt.altText))}Tt.children&&O(Tt.children)}};O(a)}let wt=O=>{for(let K of O){if(K.type==="note"&&K.children){let Tt=xt=>xt.children&&xt.children.length>0?xt.children.map(Tt).join(""):xt.text||"";K.text=K.children.map(Tt).join("").trim()}K.children&&wt(K.children)}};wt(a),wt(l);let St=An("rtf",{},a,c,t,()=>{let O=a.map(K=>K.text).join(t.newlineDelimiter);return t.putNotesAtLast&&l.length>0&&(O+=t.newlineDelimiter+l.map(K=>K.text).join(t.newlineDelimiter)),O});return t.putNotesAtLast&&l.length>0&&a.push(...l),St};function IA(r,t){for(let e of r.content)if(e.type==="group"){if(e.destination===t)return e;let n=IA(e,t);if(n)return n}return null}function uF(r){let t={},e=IA(r,"fonttbl");if(e){for(let n of e.content)if(n.type==="group"){let i,s="";for(let a of n.content)a.type==="control"&&a.value==="f"?i=a.param:a.type==="text"&&(s+=a.value);i!==void 0&&s&&(t[i]=s.replace(/;$/,"").trim())}}return t}function hF(r){let t={},e=IA(r,"colortbl");if(e){let n=0,i=0,s=0,a=0;for(let l of e.content)if(l.type==="control")l.value==="red"&&l.param!==void 0?i=l.param:l.value==="green"&&l.param!==void 0?s=l.param:l.value==="blue"&&l.param!==void 0&&(a=l.param);else if(l.type==="text"&&l.value===";"){let c=`#${i.toString(16).padStart(2,"0")}${s.toString(16).padStart(2,"0")}${a.toString(16).padStart(2,"0")}`;t[n]=c,n++,i=0,s=0,a=0}}return t}B();var VD=async(r,t)=>{let e=/word\/document[\d+]?.xml/,n=/word\/footnotes[\d+]?.xml/,i=/word\/endnotes[\d+]?.xml/,s=/word\/numbering[\d+]?.xml/,a=/(word\/)?media\/.*/,l=/docProps\/core[\d+]?.xml/,c=/docProps\/custom\.xml/,u=/word\/_rels\/document[\d+]?.xml\.rels/,h=/word\/styles[\d+]?.xml/,d=D=>{let F={},P=(dt,et)=>{let vt=pt(dt,et);if(vt){let bt=vt.getAttribute("w:val");return bt===null?!0:bt==="1"||bt==="true"||bt==="on"}return null},G=P(D,"w:b");G!==null&&(F.bold=G);let H=P(D,"w:i");H!==null&&(F.italic=H);let V=pt(D,"w:u");if(V){let dt=V.getAttribute("w:val");(!dt||dt!=="none")&&(F.underline=!0)}let L=P(D,"w:strike"),tt=P(D,"w:dstrike");L!==null?F.strikethrough=L:tt!==null&&(F.strikethrough=tt);let rt=pt(D,"w:sz");if(rt){let dt=rt.getAttribute("w:val");dt&&(F.size=(parseInt(dt,10)/2).toString()+"pt")}let at=pt(D,"w:color");if(at){let dt=at.getAttribute("w:val");dt&&dt!=="auto"&&(F.color="#"+dt)}let ft=pt(D,"w:shd");if(ft){let dt=ft.getAttribute("w:fill");dt&&dt!=="auto"&&(F.backgroundColor="#"+dt)}let J=pt(D,"w:highlight");if(J){let dt=J.getAttribute("w:val");if(dt&&dt!=="none"){let et={yellow:"#FFFF00",green:"#00FF00",cyan:"#00FFFF",magenta:"#FF00FF",blue:"#0000FF",red:"#FF0000",darkBlue:"#00008B",darkCyan:"#008B8B",darkGreen:"#006400",darkMagenta:"#8B008B",darkRed:"#8B0000",darkYellow:"#808000",darkGray:"#A9A9A9",lightGray:"#D3D3D3",black:"#000000"};F.backgroundColor=et[dt]||dt}}let st=pt(D,"w:rFonts");if(st){let dt=st.getAttribute("w:ascii")||st.getAttribute("w:hAnsi");dt&&(F.font=dt)}let lt=pt(D,"w:vertAlign");if(lt){let dt=lt.getAttribute("w:val");dt==="subscript"?F.subscript=!0:dt==="superscript"&&(F.superscript=!0)}return F},f=D=>{let F=pt(D,"w:ind");if(F){let P={},G=F.getAttribute("w:left")||F.getAttribute("w:start"),H=F.getAttribute("w:right")||F.getAttribute("w:end"),V=F.getAttribute("w:firstLine"),L=F.getAttribute("w:hanging");return G&&(P.left=parseInt(G,10)),H&&(P.right=parseInt(H,10)),V&&(P.firstLine=parseInt(V,10)),L&&(P.hanging=parseInt(L,10)),Object.keys(P).length>0?P:void 0}},p=D=>{let F=pt(D,"mc:Choice");if(F)return Array.from(F.childNodes);let P=pt(D,"mc:Fallback");return Array.from(P?P.childNodes:D.childNodes)},m=await ro(r,D=>!!D.match(e)||!!D.match(n)||!!D.match(i)||!!D.match(s)||!!D.match(l)||!!D.match(c)||!!D.match(u)||!!D.match(h)||!!t.extractAttachments&&!!D.match(a)),y=m.find(D=>D.path.match(l)),x=y?no(y.content.toString()):{},b=m.find(D=>D.path.match(c));if(b){let D=ku(b.content.toString());Object.keys(D).length>0&&(x.customProperties=D)}let w=new Map,C=new Map,E=[],S=[],N=m.filter(D=>D.path.match(a)),k=m.find(D=>D.path.match(u)),M={};if(k){let D=le(k.content.toString()),F=ut(D,"Relationship");for(let P of F){let G=P.getAttribute("Id"),H=P.getAttribute("Target");G&&H&&(M[G]=H)}}let R=m.find(D=>D.path.match(s)),j={};if(R){let D=le(R.content.toString()),F=ut(D,"w:num"),P=ut(D,"w:abstractNum"),G={};for(let H of P){let V=H.getAttribute("w:abstractNumId");V&&(G[V]=H)}for(let H of F){let V=H.getAttribute("w:numId"),tt=pt(H,"w:abstractNumId")?.getAttribute("w:val");if(V&&tt&&G[tt]){j[V]={};let rt=ut(G[tt],"w:lvl");for(let ft of rt){let J=ft.getAttribute("w:ilvl"),st=pt(ft,"w:numFmt"),lt=pt(ft,"w:lvlText"),dt=pt(ft,"w:start");J&&(j[V][J]={numFmt:st?.getAttribute("w:val")||"decimal",lvlText:lt?.getAttribute("w:val")||"",start:parseInt(dt?.getAttribute("w:val")||"1",10)})}let at=ut(H,"w:lvlOverride");for(let ft of at){let J=ft.getAttribute("w:ilvl");if(J&&j[V][J]){let st=pt(ft,"w:startOverride");st&&(j[V][J].start=parseInt(st.getAttribute("w:val")||"1",10))}}}}}let $=m.find(D=>D.path.match(h)),q={};if($){let D=le($.content.toString()),F=ut(D,"w:style");for(let P of F){let G=P.getAttribute("w:styleId");if(G){let H=pt(P,"w:rPr"),V=pt(P,"w:pPr"),L=H?d(H):{},tt,rt,at;if(V){let ft=pt(V,"w:jc");if(ft){let lt=ft.getAttribute("w:val");(lt==="left"||lt==="center"||lt==="right"||lt==="justify")&&(tt=lt)}let J=pt(V,"w:shd");if(J){let lt=J.getAttribute("w:fill");lt&<!=="auto"&&(rt="#"+lt)}let st=f(V);st&&(at=st)}q[G]={formatting:L,alignment:tt,backgroundColor:rt,paragraphIndentation:at}}}}let Q={};if($){let D=le($.content.toString()),F=pt(D,"w:docDefaults");if(F){let P=pt(F,"w:rPrDefault");if(P){let G=pt(P,"w:rPr");G&&(Q=d(G))}}}let Z;if($){let D=le($.content.toString()),F=ut(D,"w:style");for(let P of F){let G=P.getAttribute("w:type"),H=P.getAttribute("w:default"),V=P.getAttribute("w:styleId");if(G==="paragraph"&&H==="1"&&V){Z=V;break}}!Z&&q.Normal&&(Z="Normal")}let Y=[],X=[],T={},I={},_=(D,F,P=[])=>{let G=pt(D,"w:numPr"),H=!!G,V=pt(D,"w:pPr"),tt=(V?pt(V,"w:pStyle"):null)?.getAttribute("w:val"),rt=tt?tt.startsWith("Heading")||tt==="Title":!1,at=tt&&q[tt]?q[tt]:{formatting:{}},ft=at.alignment;if(V){let mt=pt(V,"w:jc");if(mt){let ot=mt.getAttribute("w:val");(ot==="left"||ot==="center"||ot==="right"||ot==="justify")&&(ft=ot)}}let J=at.paragraphIndentation;if(V){let mt=f(V);mt&&(J={...J,...mt})}let st=at.backgroundColor;if(V){let mt=pt(V,"w:shd");if(mt){let ot=mt.getAttribute("w:fill");ot&&ot!=="auto"&&(st="#"+ot)}}let lt={...at.formatting};if(V){let mt=pt(V,"w:rPr");if(mt){let ot=d(mt);for(let ht in ot){let gt=ot[ht];gt===!1?delete lt[ht]:gt!==void 0&&(lt[ht]=gt)}}}let dt="",et=[],vt=mt=>{if(Oe(mt)&&mt.nodeName==="w:r"){let ot=mt,ht=pt(ot,"w:rPr"),gt={};for(let wt in lt)gt[wt]=lt[wt];let Et=ht?pt(ht,"w:rStyle"):null,Pt=Et?Et.getAttribute("w:val"):tt;if(Pt&&q[Pt])for(let wt in q[Pt].formatting)gt[wt]=q[Pt].formatting[wt];if(ht){let wt=d(ht);for(let kt in wt){let St=wt[kt];St===!1?delete gt[kt]:St!==void 0&&(gt[kt]=St)}}!gt.backgroundColor&&st&&(gt.backgroundColor=st);for(let wt of ot.childNodes)if(Oe(wt)){if(wt.tagName==="w:t"||wt.tagName==="t"){let kt=wt,St=kt.textContent||"";dt+=St;let O={type:"text",text:St,formatting:gt};t.includeRawContent&&(O.rawContent=ee(kt,F,t));let K=Pt||tt||Z;K&&(O.metadata={style:K}),et.push(O)}else if(t.includeBreakNodes&&(wt.tagName==="w:br"||wt.tagName==="br"||wt.tagName==="w:cr"||wt.tagName==="cr")){let kt=wt,St="textWrapping";if(wt.tagName==="w:cr"||wt.tagName==="cr")St="carriageReturn";else{let Tt=kt.getAttribute("w:type")||kt.getAttribute("type");Tt!==null&&(St=Tt)}let O;St==="textWrapping"&&kt.getAttribute("w:clear")!==null&&(O=kt.getAttribute("w:clear"));let K={type:"break",metadata:{breakType:St,clear:O}};t.includeRawContent&&(K.rawContent=ee(kt,F,t)),et.push(K)}else if(t.includeBreakNodes&&(wt.tagName==="w:lastRenderedPageBreak"||wt.tagName==="lastRenderedPageBreak")){let kt={type:"break",metadata:{breakType:"lastRenderedPage"}};t.includeRawContent&&(kt.rawContent=ee(wt,F,t)),et.push(kt)}}if(t.extractAttachments){let wt=ut(ot,"w:drawing"),kt=ut(ot,"w:pict"),St=[...wt,...kt];for(let O of St){let K=dx(O),Tt="",xt=pt(O,"wp:docPr");xt&&(Tt=xt.getAttribute("descr")||xt.getAttribute("title")||"");let Mt="",Ot=pt(O,"a:blip");if(Ot)Mt=Ot.getAttribute("r:embed")||"";else{let Yt=pt(O,"v:imagedata");Yt&&(Mt=Yt.getAttribute("r:id")||"")}if(Mt&&M[Mt]){let se=M[Mt].split("/").pop();if(se){let _n={type:"image",text:"",metadata:{attachmentName:se,altText:Tt}};t.includeRawContent&&(_n.rawContent=ee(O,F,t)),et.push(_n)}}else{let Yt={type:"image",text:""};t.includeRawContent&&(Yt.rawContent=ee(O,F,t)),et.push(Yt)}}}if(!t.ignoreNotes){let wt=pt(ot,"w:footnoteReference");if(wt){let St=wt.getAttribute("w:id");if(St&&w.has(St)){let O=w.get(St),K={type:"note",text:O.map(Tt=>Tt.text).join(" "),children:O,metadata:{noteType:"footnote",noteId:St}};t.putNotesAtLast?E.push(K):et.push(K)}}let kt=pt(ot,"w:endnoteReference");if(kt){let St=kt.getAttribute("w:id");if(St&&C.has(St)){let O=C.get(St),K={type:"note",text:O.map(Tt=>Tt.text).join(" "),children:O,metadata:{noteType:"endnote",noteId:St}};t.putNotesAtLast?E.push(K):et.push(K)}}}}else if(Oe(mt)&&mt.nodeName==="w:hyperlink"){let ot=mt,ht=ot.getAttribute("r:id"),gt=ot.getAttribute("w:anchor"),Et;gt&&!t.ignoreInternalLinks?Et={link:"#"+gt,linkType:"internal"}:ht&&M[ht]&&(Et={link:M[ht],linkType:"external"});let Pt=Array.from(ot.childNodes);for(let wt of Pt){let kt=et.length;if(vt(wt),Et)for(let St=kt;St<et.length;St++)et[St].type==="text"&&(et[St].metadata={...et[St].metadata??{},...Et})}}else if(Oe(mt)&&mt.nodeName==="w:bookmarkStart"){let ot=mt.getAttribute("w:name");ot&&!ot.startsWith("_GoBack")&&!t.ignoreInternalLinks&&bt.push(ot)}else if(Oe(mt)&&(mt.nodeName==="mc:AlternateContent"||mt.nodeName==="AlternateContent")){let ot=p(mt);for(let ht of ot)vt(ht)}else if(Oe(mt)&&(mt.nodeName==="w:pict"||mt.nodeName==="pict"||mt.nodeName==="w:drawing"||mt.nodeName==="drawing")){let ot=ut(mt,"w:txbxContent");for(let ht of ot){let gt=Array.from(ht.childNodes);for(let Et of gt)if(Oe(Et)&&Et.nodeName==="w:p"){let Pt=_(Et,F);et.push(...Pt.children||[]),dt+=Pt.text}}}else if(mt.childNodes.length>0)for(let ot of Array.from(mt.childNodes))vt(ot)},bt=[...P],Ft=Array.from(D.childNodes);for(let mt of Ft)vt(mt);let Ct=bt.length>0?{anchorIds:bt}:{};if(H){let mt=pt(G,"w:numId"),ot=pt(G,"w:ilvl"),ht=mt&&mt.getAttribute("w:val")||"0",gt=ot?parseInt(ot.getAttribute("w:val")||"0",10):0,Et="ordered",Pt=0;if(ht&&j[ht]){let kt=gt.toString();T[ht]||(T[ht]={}),T[ht][kt]||(T[ht][kt]=0),T[ht][kt]++;for(let O=gt+1;O<10;O++)T[ht][O.toString()]&&(T[ht][O.toString()]=0);Et=(j[ht][kt]?.numFmt||"decimal")==="bullet"?"unordered":"ordered",I[ht]||(I[ht]={}),I[ht][kt]===void 0?I[ht][kt]=(j[ht][kt]?.start??1)-1:I[ht][kt]++,Pt=I[ht][kt]}let wt={type:"list",text:dt,children:et,metadata:{listType:Et,indentation:gt,paragraphIndentation:J,alignment:ft||"left",listId:ht,itemIndex:Pt,style:tt,...Ct}};return t.includeRawContent&&(wt.rawContent=ee(D,F,t)),wt}else if(rt){let mt=tt&&parseInt(tt.replace("Heading",""),10)||1,ot={type:"heading",text:dt,children:et,metadata:{level:mt,alignment:ft,paragraphIndentation:J,style:tt??void 0,...Ct}};return t.includeRawContent&&(ot.rawContent=ee(D,F,t)),ot}else{let mt={type:"paragraph",text:dt,children:et,metadata:{alignment:ft,paragraphIndentation:J,style:tt??void 0,...Ct}};return t.includeRawContent&&(mt.rawContent=ee(D,F,t)),mt}},W=(D,F,P=[])=>{let G=[],H=Qe(D,"w:tr"),V=new Map;for(let L=0;L<H.length;L++){let tt=H[L],rt=[],at=Qe(tt,"w:tc"),ft=0;for(let st=0;st<at.length;st++){let lt=at[st],dt=pt(lt,"w:tcPr"),et=1;if(dt){let ht=pt(dt,"w:gridSpan");ht&&(et=parseInt(ht.getAttribute("w:val")||"1",10))}let vt=!1,bt=!1;if(dt){let ht=pt(dt,"w:vMerge");ht&&(bt=!0,(ht.getAttribute("w:val")==="restart"||!V.has(ft))&&(vt=!0))}let Ft=[],Ct="",mt=Array.from(lt.childNodes);for(let ht of mt)if(Oe(ht)&&ht.nodeName==="w:p"){let gt=_(ht,F);Ft.push(gt),Ct+=gt.text}else if(Oe(ht)&&ht.nodeName==="w:tbl"){let gt=W(ht,F);Ft.push(gt)}let ot={type:"cell",text:Ct,children:Ft,metadata:{row:L,col:ft}};if(et>1&&(ot.metadata.colSpan=et),bt)if(vt)V.set(ft,{node:ot,span:1}),rt.push(ot);else{let ht=V.get(ft);ht?(ht.span++,ht.node.metadata.rowSpan=ht.span,Ft.length>0&&(ht.node.children||(ht.node.children=[]),ht.node.children.push(...Ft),ht.node.text+=" "+Ct)):rt.push(ot)}else V.delete(ft),rt.push(ot);ft+=et}let J={type:"row",children:rt};G.push(J)}return{type:"table",children:G}};if(!t.ignoreNotes){let D=m.find(P=>P.path.match(n));if(D){let P=le(D.content.toString()),G=D.content.toString(),H=ut(P,"w:footnote");for(let V of H){let L=V.getAttribute("w:id");if(!L||L==="-1"||L==="0")continue;let tt=ut(V,"w:p");w.set(L,tt.map(rt=>_(rt,G)))}}let F=m.find(P=>P.path.match(i));if(F){let P=le(F.content.toString()),G=F.content.toString(),H=ut(P,"w:endnote");for(let V of H){let L=V.getAttribute("w:id");if(!L||L==="-1"||L==="0")continue;let tt=ut(V,"w:p");C.set(L,tt.map(rt=>_(rt,G)))}}}for(let D of m){if(D.path.match(a)||D.path.match(s)||D.path.match(u)||D.path.match(h)||D.path.match(n)||D.path.match(i))continue;let F=D.content.toString();t.includeRawContent&&X.push(F);let P=le(F,{locator:t.includeRawContent}),G=pt(P,"w:body");if(G){let H=Array.from(G.childNodes),V=[];for(let L of H)if(Oe(L)){if(L.nodeName==="w:p")Y.push(_(L,F,V)),V=[];else if(L.nodeName==="w:tbl")Y.push(W(L,F,V)),V=[];else if(L.nodeName==="w:bookmarkStart"){let tt=L.getAttribute("w:name");tt&&!tt.startsWith("_GoBack")&&!t.ignoreInternalLinks&&V.push(tt)}}}}if(t.extractAttachments){for(let D of N){let F=Mr(D.path.split("/").pop()||"image",D.content);if(S.push(F),t.ocr&&F.mimeType.startsWith("image/"))try{F.ocrText=(await lr(D.content,{...t.ocrConfig})).trim()}catch(P){Se("OCR_FAILED",t,F.name,P)}}if(t.ocr){let D=F=>{for(let P of F){if(P.type==="image"&&"attachmentName"in(P.metadata||{})){let G=P.metadata,H=S.find(V=>V.name===G.attachmentName);H&&H.ocrText&&(P.text=H.ocrText,H.altText=G.altText)}P.children&&D(P.children)}};D(Y)}}t.putNotesAtLast&&E.length>0&&Y.push(...E);let z=()=>Y.map(D=>{let F=P=>{let G="";return P.children?G+=P.children.map(F).filter(H=>H!="").join(P.children[0]?.children?t.newlineDelimiter:""):P.type==="break"?G+=t.newlineDelimiter:G+=P.text||"",G};return F(D)}).filter(D=>D!="").join(t.newlineDelimiter);return An("docx",{...x,formatting:Q,styleMap:q},Y,S,t,z)};var rl=class{static async parseOffice(t,e,n){let i,s={};typeof e=="function"?(i=e,s=n||{}):s=e||{};let a=hv(s),l=[],c=a.onWarning;a.onWarning=f=>{l.push(f),c&&c(f)};let u=ct.Buffer.alloc(0),h=a.fileType??"",d;try{if(!t)throw hn("IMPROPER_ARGUMENTS",a);if(t instanceof ArrayBuffer)u=ct.Buffer.from(t);else if(ct.Buffer.isBuffer(t))u=t;else if(typeof t=="string"){d=t,Dg("path-parsing");let p=await Promise.resolve().then(()=>(iN(),nN));if(!p.existsSync(t))throw hn("FILE_DOES_NOT_EXIST",a,t);if(p.lstatSync(t).isDirectory())throw hn("LOCATION_NOT_FOUND",a,t);u=p.readFileSync(t),h=h||t.split(".").pop()||""}else throw hn("INVALID_INPUT",a);if(u.length>0){let{fileTypeFromBuffer:p}=await jD(),m=await p(u);h?m&&m.ext.toLowerCase()!==h.toLowerCase()&&Se("BUFFER_TYPE_MISMATCH",a,{detected:m.ext,expected:h}):m&&(h=m.ext)}if(!h)throw hn("IMPROPER_BUFFERS",a);let f;switch(h.toLowerCase()){case"docx":f=await VD(u,a);break;case"pptx":f=await WD(u,a);break;case"xlsx":f=await jE(u,a);break;case"odt":case"odp":case"ods":f=await WE(u,a);break;case"pdf":f=await HD(u,a);break;case"rtf":f=await qD(u,a);break;case"csv":f=await jv(u,a);break;case"html":f=await GE(u,a);break;case"md":f=await HE(u,a);break;default:throw hn("EXTENSION_UNSUPPORTED",a,h)}return f.warnings=l,i&&i(f),f}catch(f){let p=uv(f,a,d);throw i&&i(void 0,p),p}}static async terminateOcr(){await zE()}};B();var yb=class{static async convert(t,e,n){let i={...n?.parseConfig,onWarning:n?.onWarning||n?.parseConfig?.onWarning};i.ocr=!1,Object.keys(i).forEach(c=>i[c]===void 0&&delete i[c]),i.extractAttachments=n?.generatorConfig?.includeImages!==!1||n?.generatorConfig?.includeCharts!==!1;let s=await rl.parseOffice(t,i),a={...n?.generatorConfig,onWarning:n?.onWarning||n?.generatorConfig?.onWarning},l=await Ka.generate(s,e,a);return l.messages=[...s.warnings||[],...l.messages],l}};var M4=rl.parseOffice,O4=rl.terminateOcr,F4=yb.convert,P4=Ka.generate;var R4=rl;export{yb as OfficeConverter,sv as OfficeErrorType,Ka as OfficeGenerator,rl as OfficeParser,av as OfficeWarningType,F4 as convert,R4 as default,P4 as generate,M4 as parseOffice,O4 as terminateOcr};
|
|
752
|
+
`);else if(O.value==="lquote")ft(p,K)&&(J(),p={...K}),f.push("\u2018");else if(O.value==="rquote")ft(p,K)&&(J(),p={...K}),f.push("\u2019");else if(O.value==="ldblquote")ft(p,K)&&(J(),p={...K}),f.push("\u201C");else if(O.value==="rdblquote")ft(p,K)&&(J(),p={...K}),f.push("\u201D");else if(O.value==="u"){if(O.param!==void 0){let xt=O.param;xt<0&&(xt+=65536),ft(p,K)&&(J(),p={...K}),f.push(String.fromCharCode(xt))}}else if(O.value==="b")K.bold=O.param!==0;else if(O.value==="i")K.italic=O.param!==0;else if(O.value==="ul")K.underline=O.param!==0;else if(O.value==="ulnone")K.underline=!1;else if(O.value==="strike")K.strikethrough=O.param!==0;else if(O.value==="plain")K.bold=!1,K.italic=!1,K.underline=!1,K.strikethrough=!1,K.subscript=!1,K.superscript=!1,K.size=void 0,K.font=void 0,K.color=void 0,K.backgroundColor=void 0;else if(O.value==="fs")O.param!==void 0&&(K.size=(O.param/2).toString()+"pt");else if(O.value==="f")O.param!==void 0&&i[O.param]&&(K.font=i[O.param]);else if(O.value==="cf")O.param!==void 0&&s[O.param]&&(K.color=s[O.param]);else if(O.value==="fet")O.param!==void 0&&(j=O.param);else if(O.value==="cb"||O.value==="highlight"||O.value==="chcbpat"||O.value==="cbpat")O.param!==void 0&&s[O.param]&&(K.backgroundColor=s[O.param]);else if(O.value==="sub")K.subscript=!0,K.superscript=!1;else if(O.value==="super")K.superscript=!0,K.subscript=!1;else if(O.value==="nosupersub")K.subscript=!1,K.superscript=!1;else if(O.value==="li"){if(O.param!==void 0){let xt=Math.round(O.param/720);b||(y=xt)}}else if(O.value==="ls"){if(O.param!==void 0){b||(y=0),b=!0,W[O.param]||(_++,W[O.param]=`rtf-list-${_}`),E=W[O.param];let xt=tt[O.param]!==void 0?tt[O.param]:O.param;G[xt]&&(w=G[xt])}}else O.value==="ilvl"?O.param!==void 0&&(b=!0,y=O.param):O.value==="pnlvl"?(b=!0,O.param!==void 0&&(y=O.param)):O.value==="levelnfc"||O.value==="pnf"?O.param!==void 0&&(b=!0,O.param===23?w="unordered":w="ordered"):O.value==="pndec"||O.value==="pnord"||O.value==="pnlcltr"||O.value==="pnucltr"?(b||(y=0),b=!0,w="ordered"):O.value==="pnbullet"||O.value==="pncard"?(b||(y=0),b=!0,w="unordered"):O.value==="s"?O.param!==void 0&&O.param>=1&&O.param<=9&&(C=O.param):O.value==="ql"?x="left":O.value==="qc"?x="center":O.value==="qr"?x="right":O.value==="qj"&&(x="justify")}};Et(n,{});let Pt=$();if((Q||Pt&&(Pt.rows.length>0||Pt.currentCells.length>0))&&vt(),lt(),!t.putNotesAtLast&&l.length>0&&(a.push(...l),l.length=0),t.ocr&&t.extractAttachments){for(let K of c)if(K.mimeType.startsWith("image/"))try{let Tt=ct.Buffer.from(K.data,"base64");K.ocrText=(await lr(Tt,{...t.ocrConfig})).trim()}catch(Tt){Ce("OCR_FAILED",t,K.name,Tt)}let O=K=>{for(let Tt of K){if(Tt.type==="image"&&Tt.metadata&&"attachmentName"in Tt.metadata){let xt=Tt.metadata,Mt=c.find(Ot=>Ot.name===xt.attachmentName);Mt&&(Mt.ocrText&&(Tt.text=Mt.ocrText),Mt.altText&&(xt.altText=Mt.altText))}Tt.children&&O(Tt.children)}};O(a)}let wt=O=>{for(let K of O){if(K.type==="note"&&K.children){let Tt=xt=>xt.children&&xt.children.length>0?xt.children.map(Tt).join(""):xt.text||"";K.text=K.children.map(Tt).join("").trim()}K.children&&wt(K.children)}};wt(a),wt(l);let St=An("rtf",{},a,c,t,()=>{let O=a.map(K=>K.text).join(t.newlineDelimiter);return t.putNotesAtLast&&l.length>0&&(O+=t.newlineDelimiter+l.map(K=>K.text).join(t.newlineDelimiter)),O});return t.putNotesAtLast&&l.length>0&&a.push(...l),St};function _2(r,t){for(let e of r.content)if(e.type==="group"){if(e.destination===t)return e;let n=_2(e,t);if(n)return n}return null}function uF(r){let t={},e=_2(r,"fonttbl");if(e){for(let n of e.content)if(n.type==="group"){let i,s="";for(let a of n.content)a.type==="control"&&a.value==="f"?i=a.param:a.type==="text"&&(s+=a.value);i!==void 0&&s&&(t[i]=s.replace(/;$/,"").trim())}}return t}function hF(r){let t={},e=_2(r,"colortbl");if(e){let n=0,i=0,s=0,a=0;for(let l of e.content)if(l.type==="control")l.value==="red"&&l.param!==void 0?i=l.param:l.value==="green"&&l.param!==void 0?s=l.param:l.value==="blue"&&l.param!==void 0&&(a=l.param);else if(l.type==="text"&&l.value===";"){let c=`#${i.toString(16).padStart(2,"0")}${s.toString(16).padStart(2,"0")}${a.toString(16).padStart(2,"0")}`;t[n]=c,n++,i=0,s=0,a=0}}return t}B();var VD=async(r,t)=>{let e=/word\/document[\d+]?.xml/,n=/word\/footnotes[\d+]?.xml/,i=/word\/endnotes[\d+]?.xml/,s=/word\/numbering[\d+]?.xml/,a=/(word\/)?media\/.*/,l=/docProps\/core[\d+]?.xml/,c=/docProps\/custom\.xml/,u=/word\/_rels\/document[\d+]?.xml\.rels/,h=/word\/styles[\d+]?.xml/,d=D=>{let F={},P=(dt,et)=>{let vt=pt(dt,et);if(vt){let bt=vt.getAttribute("w:val");return bt===null?!0:bt==="1"||bt==="true"||bt==="on"}return null},G=P(D,"w:b");G!==null&&(F.bold=G);let H=P(D,"w:i");H!==null&&(F.italic=H);let V=pt(D,"w:u");if(V){let dt=V.getAttribute("w:val");(!dt||dt!=="none")&&(F.underline=!0)}let L=P(D,"w:strike"),tt=P(D,"w:dstrike");L!==null?F.strikethrough=L:tt!==null&&(F.strikethrough=tt);let rt=pt(D,"w:sz");if(rt){let dt=rt.getAttribute("w:val");dt&&(F.size=(parseInt(dt,10)/2).toString()+"pt")}let at=pt(D,"w:color");if(at){let dt=at.getAttribute("w:val");dt&&dt!=="auto"&&(F.color="#"+dt)}let ft=pt(D,"w:shd");if(ft){let dt=ft.getAttribute("w:fill");dt&&dt!=="auto"&&(F.backgroundColor="#"+dt)}let J=pt(D,"w:highlight");if(J){let dt=J.getAttribute("w:val");if(dt&&dt!=="none"){let et={yellow:"#FFFF00",green:"#00FF00",cyan:"#00FFFF",magenta:"#FF00FF",blue:"#0000FF",red:"#FF0000",darkBlue:"#00008B",darkCyan:"#008B8B",darkGreen:"#006400",darkMagenta:"#8B008B",darkRed:"#8B0000",darkYellow:"#808000",darkGray:"#A9A9A9",lightGray:"#D3D3D3",black:"#000000"};F.backgroundColor=et[dt]||dt}}let st=pt(D,"w:rFonts");if(st){let dt=st.getAttribute("w:ascii")||st.getAttribute("w:hAnsi");dt&&(F.font=dt)}let lt=pt(D,"w:vertAlign");if(lt){let dt=lt.getAttribute("w:val");dt==="subscript"?F.subscript=!0:dt==="superscript"&&(F.superscript=!0)}return F},f=D=>{let F=pt(D,"w:ind");if(F){let P={},G=F.getAttribute("w:left")||F.getAttribute("w:start"),H=F.getAttribute("w:right")||F.getAttribute("w:end"),V=F.getAttribute("w:firstLine"),L=F.getAttribute("w:hanging");return G&&(P.left=parseInt(G,10)),H&&(P.right=parseInt(H,10)),V&&(P.firstLine=parseInt(V,10)),L&&(P.hanging=parseInt(L,10)),Object.keys(P).length>0?P:void 0}},p=D=>{let F=pt(D,"mc:Choice");if(F)return Array.from(F.childNodes);let P=pt(D,"mc:Fallback");return Array.from(P?P.childNodes:D.childNodes)},m=await ro(r,D=>!!D.match(e)||!!D.match(n)||!!D.match(i)||!!D.match(s)||!!D.match(l)||!!D.match(c)||!!D.match(u)||!!D.match(h)||!!t.extractAttachments&&!!D.match(a)),y=m.find(D=>D.path.match(l)),x=y?no(y.content.toString()):{},b=m.find(D=>D.path.match(c));if(b){let D=ku(b.content.toString());Object.keys(D).length>0&&(x.customProperties=D)}let w=new Map,C=new Map,E=[],S=[],N=m.filter(D=>D.path.match(a)),k=m.find(D=>D.path.match(u)),M={};if(k){let D=le(k.content.toString()),F=ut(D,"Relationship");for(let P of F){let G=P.getAttribute("Id"),H=P.getAttribute("Target");G&&H&&(M[G]=H)}}let R=m.find(D=>D.path.match(s)),j={};if(R){let D=le(R.content.toString()),F=ut(D,"w:num"),P=ut(D,"w:abstractNum"),G={};for(let H of P){let V=H.getAttribute("w:abstractNumId");V&&(G[V]=H)}for(let H of F){let V=H.getAttribute("w:numId"),tt=pt(H,"w:abstractNumId")?.getAttribute("w:val");if(V&&tt&&G[tt]){j[V]={};let rt=ut(G[tt],"w:lvl");for(let ft of rt){let J=ft.getAttribute("w:ilvl"),st=pt(ft,"w:numFmt"),lt=pt(ft,"w:lvlText"),dt=pt(ft,"w:start");J&&(j[V][J]={numFmt:st?.getAttribute("w:val")||"decimal",lvlText:lt?.getAttribute("w:val")||"",start:parseInt(dt?.getAttribute("w:val")||"1",10)})}let at=ut(H,"w:lvlOverride");for(let ft of at){let J=ft.getAttribute("w:ilvl");if(J&&j[V][J]){let st=pt(ft,"w:startOverride");st&&(j[V][J].start=parseInt(st.getAttribute("w:val")||"1",10))}}}}}let $=m.find(D=>D.path.match(h)),q={};if($){let D=le($.content.toString()),F=ut(D,"w:style");for(let P of F){let G=P.getAttribute("w:styleId");if(G){let H=pt(P,"w:rPr"),V=pt(P,"w:pPr"),L=H?d(H):{},tt,rt,at;if(V){let ft=pt(V,"w:jc");if(ft){let lt=ft.getAttribute("w:val");(lt==="left"||lt==="center"||lt==="right"||lt==="justify")&&(tt=lt)}let J=pt(V,"w:shd");if(J){let lt=J.getAttribute("w:fill");lt&<!=="auto"&&(rt="#"+lt)}let st=f(V);st&&(at=st)}q[G]={formatting:L,alignment:tt,backgroundColor:rt,paragraphIndentation:at}}}}let Q={};if($){let D=le($.content.toString()),F=pt(D,"w:docDefaults");if(F){let P=pt(F,"w:rPrDefault");if(P){let G=pt(P,"w:rPr");G&&(Q=d(G))}}}let Z;if($){let D=le($.content.toString()),F=ut(D,"w:style");for(let P of F){let G=P.getAttribute("w:type"),H=P.getAttribute("w:default"),V=P.getAttribute("w:styleId");if(G==="paragraph"&&H==="1"&&V){Z=V;break}}!Z&&q.Normal&&(Z="Normal")}let Y=[],X=[],T={},I={},_=(D,F,P=[])=>{let G=pt(D,"w:numPr"),H=!!G,V=pt(D,"w:pPr"),tt=(V?pt(V,"w:pStyle"):null)?.getAttribute("w:val"),rt=tt?tt.startsWith("Heading")||tt==="Title":!1,at=tt&&q[tt]?q[tt]:{formatting:{}},ft=at.alignment;if(V){let mt=pt(V,"w:jc");if(mt){let ot=mt.getAttribute("w:val");(ot==="left"||ot==="center"||ot==="right"||ot==="justify")&&(ft=ot)}}let J=at.paragraphIndentation;if(V){let mt=f(V);mt&&(J={...J,...mt})}let st=at.backgroundColor;if(V){let mt=pt(V,"w:shd");if(mt){let ot=mt.getAttribute("w:fill");ot&&ot!=="auto"&&(st="#"+ot)}}let lt={...at.formatting};if(V){let mt=pt(V,"w:rPr");if(mt){let ot=d(mt);for(let ht in ot){let gt=ot[ht];gt===!1?delete lt[ht]:gt!==void 0&&(lt[ht]=gt)}}}let dt="",et=[],vt=mt=>{if(Oe(mt)&&mt.nodeName==="w:r"){let ot=mt,ht=pt(ot,"w:rPr"),gt={};for(let wt in lt)gt[wt]=lt[wt];let Et=ht?pt(ht,"w:rStyle"):null,Pt=Et?Et.getAttribute("w:val"):tt;if(Pt&&q[Pt])for(let wt in q[Pt].formatting)gt[wt]=q[Pt].formatting[wt];if(ht){let wt=d(ht);for(let kt in wt){let St=wt[kt];St===!1?delete gt[kt]:St!==void 0&&(gt[kt]=St)}}!gt.backgroundColor&&st&&(gt.backgroundColor=st);for(let wt of ot.childNodes)if(Oe(wt)){if(wt.tagName==="w:t"||wt.tagName==="t"){let kt=wt,St=kt.textContent||"";dt+=St;let O={type:"text",text:St,formatting:gt};t.includeRawContent&&(O.rawContent=ee(kt,F,t));let K=Pt||tt||Z;K&&(O.metadata={style:K}),et.push(O)}else if(t.includeBreakNodes&&(wt.tagName==="w:br"||wt.tagName==="br"||wt.tagName==="w:cr"||wt.tagName==="cr")){let kt=wt,St="textWrapping";if(wt.tagName==="w:cr"||wt.tagName==="cr")St="carriageReturn";else{let Tt=kt.getAttribute("w:type")||kt.getAttribute("type");Tt!==null&&(St=Tt)}let O;St==="textWrapping"&&kt.getAttribute("w:clear")!==null&&(O=kt.getAttribute("w:clear"));let K={type:"break",metadata:{breakType:St,clear:O}};t.includeRawContent&&(K.rawContent=ee(kt,F,t)),et.push(K)}else if(t.includeBreakNodes&&(wt.tagName==="w:lastRenderedPageBreak"||wt.tagName==="lastRenderedPageBreak")){let kt={type:"break",metadata:{breakType:"lastRenderedPage"}};t.includeRawContent&&(kt.rawContent=ee(wt,F,t)),et.push(kt)}}if(t.extractAttachments){let wt=ut(ot,"w:drawing"),kt=ut(ot,"w:pict"),St=[...wt,...kt];for(let O of St){let K=fx(O),Tt="",xt=pt(O,"wp:docPr");xt&&(Tt=xt.getAttribute("descr")||xt.getAttribute("title")||"");let Mt="",Ot=pt(O,"a:blip");if(Ot)Mt=Ot.getAttribute("r:embed")||"";else{let Yt=pt(O,"v:imagedata");Yt&&(Mt=Yt.getAttribute("r:id")||"")}if(Mt&&M[Mt]){let se=M[Mt].split("/").pop();if(se){let _n={type:"image",text:"",metadata:{attachmentName:se,altText:Tt}};t.includeRawContent&&(_n.rawContent=ee(O,F,t)),et.push(_n)}}else{let Yt={type:"image",text:""};t.includeRawContent&&(Yt.rawContent=ee(O,F,t)),et.push(Yt)}}}if(!t.ignoreNotes){let wt=pt(ot,"w:footnoteReference");if(wt){let St=wt.getAttribute("w:id");if(St&&w.has(St)){let O=w.get(St),K={type:"note",text:O.map(Tt=>Tt.text).join(" "),children:O,metadata:{noteType:"footnote",noteId:St}};t.putNotesAtLast?E.push(K):et.push(K)}}let kt=pt(ot,"w:endnoteReference");if(kt){let St=kt.getAttribute("w:id");if(St&&C.has(St)){let O=C.get(St),K={type:"note",text:O.map(Tt=>Tt.text).join(" "),children:O,metadata:{noteType:"endnote",noteId:St}};t.putNotesAtLast?E.push(K):et.push(K)}}}}else if(Oe(mt)&&mt.nodeName==="w:hyperlink"){let ot=mt,ht=ot.getAttribute("r:id"),gt=ot.getAttribute("w:anchor"),Et;gt&&!t.ignoreInternalLinks?Et={link:"#"+gt,linkType:"internal"}:ht&&M[ht]&&(Et={link:M[ht],linkType:"external"});let Pt=Array.from(ot.childNodes);for(let wt of Pt){let kt=et.length;if(vt(wt),Et)for(let St=kt;St<et.length;St++)et[St].type==="text"&&(et[St].metadata={...et[St].metadata??{},...Et})}}else if(Oe(mt)&&mt.nodeName==="w:bookmarkStart"){let ot=mt.getAttribute("w:name");ot&&!ot.startsWith("_GoBack")&&!t.ignoreInternalLinks&&bt.push(ot)}else if(Oe(mt)&&(mt.nodeName==="mc:AlternateContent"||mt.nodeName==="AlternateContent")){let ot=p(mt);for(let ht of ot)vt(ht)}else if(Oe(mt)&&(mt.nodeName==="w:pict"||mt.nodeName==="pict"||mt.nodeName==="w:drawing"||mt.nodeName==="drawing")){let ot=ut(mt,"w:txbxContent");for(let ht of ot){let gt=Array.from(ht.childNodes);for(let Et of gt)if(Oe(Et)&&Et.nodeName==="w:p"){let Pt=_(Et,F);et.push(...Pt.children||[]),dt+=Pt.text}}}else if(mt.childNodes.length>0)for(let ot of Array.from(mt.childNodes))vt(ot)},bt=[...P],Ft=Array.from(D.childNodes);for(let mt of Ft)vt(mt);let Ct=bt.length>0?{anchorIds:bt}:{};if(H){let mt=pt(G,"w:numId"),ot=pt(G,"w:ilvl"),ht=mt&&mt.getAttribute("w:val")||"0",gt=ot?parseInt(ot.getAttribute("w:val")||"0",10):0,Et="ordered",Pt=0;if(ht&&j[ht]){let kt=gt.toString();T[ht]||(T[ht]={}),T[ht][kt]||(T[ht][kt]=0),T[ht][kt]++;for(let O=gt+1;O<10;O++)T[ht][O.toString()]&&(T[ht][O.toString()]=0);Et=(j[ht][kt]?.numFmt||"decimal")==="bullet"?"unordered":"ordered",I[ht]||(I[ht]={}),I[ht][kt]===void 0?I[ht][kt]=(j[ht][kt]?.start??1)-1:I[ht][kt]++,Pt=I[ht][kt]}let wt={type:"list",text:dt,children:et,metadata:{listType:Et,indentation:gt,paragraphIndentation:J,alignment:ft||"left",listId:ht,itemIndex:Pt,style:tt,...Ct}};return t.includeRawContent&&(wt.rawContent=ee(D,F,t)),wt}else if(rt){let mt=tt&&parseInt(tt.replace("Heading",""),10)||1,ot={type:"heading",text:dt,children:et,metadata:{level:mt,alignment:ft,paragraphIndentation:J,style:tt??void 0,...Ct}};return t.includeRawContent&&(ot.rawContent=ee(D,F,t)),ot}else{let mt={type:"paragraph",text:dt,children:et,metadata:{alignment:ft,paragraphIndentation:J,style:tt??void 0,...Ct}};return t.includeRawContent&&(mt.rawContent=ee(D,F,t)),mt}},W=(D,F,P=[])=>{let G=[],H=Qe(D,"w:tr"),V=new Map;for(let L=0;L<H.length;L++){let tt=H[L],rt=[],at=Qe(tt,"w:tc"),ft=0;for(let st=0;st<at.length;st++){let lt=at[st],dt=pt(lt,"w:tcPr"),et=1;if(dt){let ht=pt(dt,"w:gridSpan");ht&&(et=parseInt(ht.getAttribute("w:val")||"1",10))}let vt=!1,bt=!1;if(dt){let ht=pt(dt,"w:vMerge");ht&&(bt=!0,(ht.getAttribute("w:val")==="restart"||!V.has(ft))&&(vt=!0))}let Ft=[],Ct="",mt=Array.from(lt.childNodes);for(let ht of mt)if(Oe(ht)&&ht.nodeName==="w:p"){let gt=_(ht,F);Ft.push(gt),Ct+=gt.text}else if(Oe(ht)&&ht.nodeName==="w:tbl"){let gt=W(ht,F);Ft.push(gt)}let ot={type:"cell",text:Ct,children:Ft,metadata:{row:L,col:ft}};if(et>1&&(ot.metadata.colSpan=et),bt)if(vt)V.set(ft,{node:ot,span:1}),rt.push(ot);else{let ht=V.get(ft);ht?(ht.span++,ht.node.metadata.rowSpan=ht.span,Ft.length>0&&(ht.node.children||(ht.node.children=[]),ht.node.children.push(...Ft),ht.node.text+=" "+Ct)):rt.push(ot)}else V.delete(ft),rt.push(ot);ft+=et}let J={type:"row",children:rt};G.push(J)}return{type:"table",children:G}};if(!t.ignoreNotes){let D=m.find(P=>P.path.match(n));if(D){let P=le(D.content.toString()),G=D.content.toString(),H=ut(P,"w:footnote");for(let V of H){let L=V.getAttribute("w:id");if(!L||L==="-1"||L==="0")continue;let tt=ut(V,"w:p");w.set(L,tt.map(rt=>_(rt,G)))}}let F=m.find(P=>P.path.match(i));if(F){let P=le(F.content.toString()),G=F.content.toString(),H=ut(P,"w:endnote");for(let V of H){let L=V.getAttribute("w:id");if(!L||L==="-1"||L==="0")continue;let tt=ut(V,"w:p");C.set(L,tt.map(rt=>_(rt,G)))}}}for(let D of m){if(D.path.match(a)||D.path.match(s)||D.path.match(u)||D.path.match(h)||D.path.match(n)||D.path.match(i))continue;let F=D.content.toString();t.includeRawContent&&X.push(F);let P=le(F,{locator:t.includeRawContent}),G=pt(P,"w:body");if(G){let H=Array.from(G.childNodes),V=[];for(let L of H)if(Oe(L)){if(L.nodeName==="w:p")Y.push(_(L,F,V)),V=[];else if(L.nodeName==="w:tbl")Y.push(W(L,F,V)),V=[];else if(L.nodeName==="w:bookmarkStart"){let tt=L.getAttribute("w:name");tt&&!tt.startsWith("_GoBack")&&!t.ignoreInternalLinks&&V.push(tt)}}}}if(t.extractAttachments){for(let D of N){let F=Mr(D.path.split("/").pop()||"image",D.content);if(S.push(F),t.ocr&&F.mimeType.startsWith("image/"))try{F.ocrText=(await lr(D.content,{...t.ocrConfig})).trim()}catch(P){Ce("OCR_FAILED",t,F.name,P)}}if(t.ocr){let D=F=>{for(let P of F){if(P.type==="image"&&"attachmentName"in(P.metadata||{})){let G=P.metadata,H=S.find(V=>V.name===G.attachmentName);H&&H.ocrText&&(P.text=H.ocrText,H.altText=G.altText)}P.children&&D(P.children)}};D(Y)}}t.putNotesAtLast&&E.length>0&&Y.push(...E);let z=()=>Y.map(D=>{let F=P=>{let G="";return P.children?G+=P.children.map(F).filter(H=>H!="").join(P.children[0]?.children?t.newlineDelimiter:""):P.type==="break"?G+=t.newlineDelimiter:G+=P.text||"",G};return F(D)}).filter(D=>D!="").join(t.newlineDelimiter);return An("docx",{...x,formatting:Q,styleMap:q},Y,S,t,z)};var rl=class{static async parseOffice(t,e,n){let i,s={};typeof e=="function"?(i=e,s=n||{}):s=e||{};let a=fv(s),l=[],c=a.onWarning;a.onWarning=f=>{l.push(f),c&&c(f)};let u=ct.Buffer.alloc(0),h=a.fileType??"",d;try{if(!t)throw hn("IMPROPER_ARGUMENTS",a);if(t instanceof ArrayBuffer)u=ct.Buffer.from(t);else if(ct.Buffer.isBuffer(t))u=t;else if(typeof t=="string"){d=t,Dg("path-parsing");let p=await Promise.resolve().then(()=>(iN(),nN));if(!p.existsSync(t))throw hn("FILE_DOES_NOT_EXIST",a,t);if(p.lstatSync(t).isDirectory())throw hn("LOCATION_NOT_FOUND",a,t);u=p.readFileSync(t),h=h||t.split(".").pop()||""}else throw hn("INVALID_INPUT",a);if(u.length>0&&!h)try{let{fileTypeFromBuffer:p}=await I2(),m=await p(u);m&&(h=m.ext)}catch(p){Ce("FILE_TYPE_DETECTION_FAILED",a,{error:p})}else if(u.length>0&&h)try{let{fileTypeFromBuffer:p}=await I2(),m=await p(u);m&&m.ext.toLowerCase()!==h.toLowerCase()&&Ce("BUFFER_TYPE_MISMATCH",a,{detected:m.ext,expected:h})}catch(p){Ce("FILE_TYPE_DETECTION_FAILED",a,{error:p})}if(!h)throw hn("IMPROPER_BUFFERS",a);let f;switch(h.toLowerCase()){case"docx":f=await VD(u,a);break;case"pptx":f=await WD(u,a);break;case"xlsx":f=await GE(u,a);break;case"odt":case"odp":case"ods":f=await qE(u,a);break;case"pdf":f=await HD(u,a);break;case"rtf":f=await qD(u,a);break;case"csv":f=await Gv(u,a);break;case"html":f=await HE(u,a);break;case"md":f=await WE(u,a);break;default:throw hn("EXTENSION_UNSUPPORTED",a,h)}return f.warnings=l,i&&i(f),f}catch(f){let p=dv(f,a,d);throw i&&i(void 0,p),p}}static async terminateOcr(){await jE()}};B();var yb=class{static async convert(t,e,n){let i={...n?.parseConfig,onWarning:n?.onWarning||n?.parseConfig?.onWarning};i.ocr=!1,Object.keys(i).forEach(c=>i[c]===void 0&&delete i[c]),i.extractAttachments=n?.generatorConfig?.includeImages!==!1||n?.generatorConfig?.includeCharts!==!1;let s=await rl.parseOffice(t,i),a={...n?.generatorConfig,onWarning:n?.onWarning||n?.generatorConfig?.onWarning},l=await Ka.generate(s,e,a);return l.messages=[...s.warnings||[],...l.messages],l}};var M4=rl.parseOffice,O4=rl.terminateOcr,F4=yb.convert,P4=Ka.generate;var R4=rl;export{yb as OfficeConverter,ov as OfficeErrorType,Ka as OfficeGenerator,rl as OfficeParser,lv as OfficeWarningType,F4 as convert,R4 as default,P4 as generate,M4 as parseOffice,O4 as terminateOcr};
|
|
753
753
|
/*! Bundled license information:
|
|
754
754
|
|
|
755
755
|
ieee754/index.js:
|