1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
| var sp=Object.defineProperty;var Cd=u=>{throw TypeError(u)};var ip=(u,e,t)=>e in u?sp(u,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):u[e]=t;var ft=(u,e,t)=>ip(u,typeof e!="symbol"?e+"":e,t),Hl=(u,e,t)=>e.has(u)||Cd("Cannot "+t);var o=(u,e,t)=>(Hl(u,e,"read from private field"),t?t.call(u):e.get(u)),S=(u,e,t)=>e.has(u)?Cd("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(u):e.set(u,t),w=(u,e,t,s)=>(Hl(u,e,"write to private field"),s?s.call(u,t):e.set(u,t),t),E=(u,e,t)=>(Hl(u,e,"access private method"),t);var Le=(u,e,t,s)=>({set _(i){w(u,e,i,t)},get _(){return o(u,e,s)}});import{_ as Qd,r as Vt,A as Jd,a9 as tu,o as bs,b as _a,e as se,ae as Eh,af as Sh,u as np,s as rp,d as ee,w as Je,R as kd,ab as ap,a7 as op,H as hp,k as lp,ag as cp,g as Td,J as dp,F as Rd,h as Pd,l as pa,f as Ul,t as up,ah as Ld,a4 as fp,D as pp,ai as gp,aj as mp,q as bp,v as _p,K as vp,Q as yp,S as Ap}from"./index-Daa5jh-U.js";/* empty css *//* empty css *//* empty css *//* empty css */import"./el-tag-BY50phaj.js";import{_ as wp}from"./index-LzutKPut.js";/* empty css *//* empty css */import"./el-tooltip-l0sNRNKZ.js";/* empty css */import{s as eu}from"./index-B3MU8m7V.js";import{u as Ep}from"./useWebScoket-kRbyd4OX.js";const Sp=u=>eu.get("/api/student/education/resource/page",{params:u}),xp=()=>eu.post("/api/student/subject/list"),Cp={class:"video-container"},kp={class:"video-content"},Tp=["src"],Rp={__name:"index",props:{videoUrl:{type:String,required:!0},poster:{type:String,default:""}},setup(u){const e=u,t=Vt(null);return Jd(()=>{}),tu(()=>{t.value.pause()}),(s,i)=>(bs(),_a("div",Cp,[se("div",kp,[se("video",{src:e.videoUrl,class:"video-player",controls:"",ref_key:"player",ref:t},null,8,Tp)])]))}},Pp=Qd(Rp,[["__scopeId","data-v-f000ad5c"]]);function xh(u){throw new Error('Could not dynamically require "'+u+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var Lp={exports:{}};/*!
|
| JSZip v3.10.1 - A JavaScript class for generating and reading zip files
| <http://stuartk.com/jszip>
|
| (c) 2009-2016 Stuart Knightley <stuart [at] stuartk.com>
| Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/jszip/main/LICENSE.markdown.
|
| JSZip uses the library pako released under the MIT license :
| https://github.com/nodeca/pako/blob/main/LICENSE
| */(function(u,e){(function(t){u.exports=t()})(function(){return function t(s,i,n){function r(l,c){if(!i[l]){if(!s[l]){var d=typeof xh=="function"&&xh;if(!c&&d)return d(l,!0);if(a)return a(l,!0);var p=new Error("Cannot find module '"+l+"'");throw p.code="MODULE_NOT_FOUND",p}var f=i[l]={exports:{}};s[l][0].call(f.exports,function(g){var m=s[l][1][g];return r(m||g)},f,f.exports,t,s,i,n)}return i[l].exports}for(var a=typeof xh=="function"&&xh,h=0;h<n.length;h++)r(n[h]);return r}({1:[function(t,s,i){var n=t("./utils"),r=t("./support"),a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";i.encode=function(h){for(var l,c,d,p,f,g,m,v=[],b=0,A=h.length,x=A,k=n.getTypeOf(h)!=="string";b<h.length;)x=A-b,d=k?(l=h[b++],c=b<A?h[b++]:0,b<A?h[b++]:0):(l=h.charCodeAt(b++),c=b<A?h.charCodeAt(b++):0,b<A?h.charCodeAt(b++):0),p=l>>2,f=(3&l)<<4|c>>4,g=1<x?(15&c)<<2|d>>6:64,m=2<x?63&d:64,v.push(a.charAt(p)+a.charAt(f)+a.charAt(g)+a.charAt(m));return v.join("")},i.decode=function(h){var l,c,d,p,f,g,m=0,v=0,b="data:";if(h.substr(0,b.length)===b)throw new Error("Invalid base64 input, it looks like a data url.");var A,x=3*(h=h.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(h.charAt(h.length-1)===a.charAt(64)&&x--,h.charAt(h.length-2)===a.charAt(64)&&x--,x%1!=0)throw new Error("Invalid base64 input, bad content length.");for(A=r.uint8array?new Uint8Array(0|x):new Array(0|x);m<h.length;)l=a.indexOf(h.charAt(m++))<<2|(p=a.indexOf(h.charAt(m++)))>>4,c=(15&p)<<4|(f=a.indexOf(h.charAt(m++)))>>2,d=(3&f)<<6|(g=a.indexOf(h.charAt(m++))),A[v++]=l,f!==64&&(A[v++]=c),g!==64&&(A[v++]=d);return A}},{"./support":30,"./utils":32}],2:[function(t,s,i){var n=t("./external"),r=t("./stream/DataWorker"),a=t("./stream/Crc32Probe"),h=t("./stream/DataLengthProbe");function l(c,d,p,f,g){this.compressedSize=c,this.uncompressedSize=d,this.crc32=p,this.compression=f,this.compressedContent=g}l.prototype={getContentWorker:function(){var c=new r(n.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new h("data_length")),d=this;return c.on("end",function(){if(this.streamInfo.data_length!==d.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),c},getCompressedWorker:function(){return new r(n.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},l.createWorkerFrom=function(c,d,p){return c.pipe(new a).pipe(new h("uncompressedSize")).pipe(d.compressWorker(p)).pipe(new h("compressedSize")).withStreamInfo("compression",d)},s.exports=l},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(t,s,i){var n=t("./stream/GenericWorker");i.STORE={magic:"\0\0",compressWorker:function(){return new n("STORE compression")},uncompressWorker:function(){return new n("STORE decompression")}},i.DEFLATE=t("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(t,s,i){var n=t("./utils"),r=function(){for(var a,h=[],l=0;l<256;l++){a=l;for(var c=0;c<8;c++)a=1&a?3988292384^a>>>1:a>>>1;h[l]=a}return h}();s.exports=function(a,h){return a!==void 0&&a.length?n.getTypeOf(a)!=="string"?function(l,c,d,p){var f=r,g=p+d;l^=-1;for(var m=p;m<g;m++)l=l>>>8^f[255&(l^c[m])];return-1^l}(0|h,a,a.length,0):function(l,c,d,p){var f=r,g=p+d;l^=-1;for(var m=p;m<g;m++)l=l>>>8^f[255&(l^c.charCodeAt(m))];return-1^l}(0|h,a,a.length,0):0}},{"./utils":32}],5:[function(t,s,i){i.base64=!1,i.binary=!1,i.dir=!1,i.createFolders=!0,i.date=null,i.compression=null,i.compressionOptions=null,i.comment=null,i.unixPermissions=null,i.dosPermissions=null},{}],6:[function(t,s,i){var n=null;n=typeof Promise<"u"?Promise:t("lie"),s.exports={Promise:n}},{lie:37}],7:[function(t,s,i){var n=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",r=t("pako"),a=t("./utils"),h=t("./stream/GenericWorker"),l=n?"uint8array":"array";function c(d,p){h.call(this,"FlateWorker/"+d),this._pako=null,this._pakoAction=d,this._pakoOptions=p,this.meta={}}i.magic="\b\0",a.inherits(c,h),c.prototype.processChunk=function(d){this.meta=d.meta,this._pako===null&&this._createPako(),this._pako.push(a.transformTo(l,d.data),!1)},c.prototype.flush=function(){h.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},c.prototype.cleanUp=function(){h.prototype.cleanUp.call(this),this._pako=null},c.prototype._createPako=function(){this._pako=new r[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var d=this;this._pako.onData=function(p){d.push({data:p,meta:d.meta})}},i.compressWorker=function(d){return new c("Deflate",d)},i.uncompressWorker=function(){return new c("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(t,s,i){function n(f,g){var m,v="";for(m=0;m<g;m++)v+=String.fromCharCode(255&f),f>>>=8;return v}function r(f,g,m,v,b,A){var x,k,T=f.file,L=f.compression,I=A!==l.utf8encode,B=a.transformTo("string",A(T.name)),D=a.transformTo("string",l.utf8encode(T.name)),W=T.comment,q=a.transformTo("string",A(W)),P=a.transformTo("string",l.utf8encode(W)),z=D.length!==T.name.length,y=P.length!==W.length,H="",rt="",U="",Q=T.dir,X=T.date,ht={crc32:0,compressedSize:0,uncompressedSize:0};g&&!m||(ht.crc32=f.crc32,ht.compressedSize=f.compressedSize,ht.uncompressedSize=f.uncompressedSize);var M=0;g&&(M|=8),I||!z&&!y||(M|=2048);var O=0,st=0;Q&&(O|=16),b==="UNIX"?(st=798,O|=function(Y,_t){var pt=Y;return Y||(pt=_t?16893:33204),(65535&pt)<<16}(T.unixPermissions,Q)):(st=20,O|=function(Y){return 63&(Y||0)}(T.dosPermissions)),x=X.getUTCHours(),x<<=6,x|=X.getUTCMinutes(),x<<=5,x|=X.getUTCSeconds()/2,k=X.getUTCFullYear()-1980,k<<=4,k|=X.getUTCMonth()+1,k<<=5,k|=X.getUTCDate(),z&&(rt=n(1,1)+n(c(B),4)+D,H+="up"+n(rt.length,2)+rt),y&&(U=n(1,1)+n(c(q),4)+P,H+="uc"+n(U.length,2)+U);var J="";return J+=`
| \0`,J+=n(M,2),J+=L.magic,J+=n(x,2),J+=n(k,2),J+=n(ht.crc32,4),J+=n(ht.compressedSize,4),J+=n(ht.uncompressedSize,4),J+=n(B.length,2),J+=n(H.length,2),{fileRecord:d.LOCAL_FILE_HEADER+J+B+H,dirRecord:d.CENTRAL_FILE_HEADER+n(st,2)+J+n(q.length,2)+"\0\0\0\0"+n(O,4)+n(v,4)+B+H+q}}var a=t("../utils"),h=t("../stream/GenericWorker"),l=t("../utf8"),c=t("../crc32"),d=t("../signature");function p(f,g,m,v){h.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=g,this.zipPlatform=m,this.encodeFileName=v,this.streamFiles=f,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}a.inherits(p,h),p.prototype.push=function(f){var g=f.meta.percent||0,m=this.entriesCount,v=this._sources.length;this.accumulate?this.contentBuffer.push(f):(this.bytesWritten+=f.data.length,h.prototype.push.call(this,{data:f.data,meta:{currentFile:this.currentFile,percent:m?(g+100*(m-v-1))/m:100}}))},p.prototype.openedSource=function(f){this.currentSourceOffset=this.bytesWritten,this.currentFile=f.file.name;var g=this.streamFiles&&!f.file.dir;if(g){var m=r(f,g,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:m.fileRecord,meta:{percent:0}})}else this.accumulate=!0},p.prototype.closedSource=function(f){this.accumulate=!1;var g=this.streamFiles&&!f.file.dir,m=r(f,g,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(m.dirRecord),g)this.push({data:function(v){return d.DATA_DESCRIPTOR+n(v.crc32,4)+n(v.compressedSize,4)+n(v.uncompressedSize,4)}(f),meta:{percent:100}});else for(this.push({data:m.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},p.prototype.flush=function(){for(var f=this.bytesWritten,g=0;g<this.dirRecords.length;g++)this.push({data:this.dirRecords[g],meta:{percent:100}});var m=this.bytesWritten-f,v=function(b,A,x,k,T){var L=a.transformTo("string",T(k));return d.CENTRAL_DIRECTORY_END+"\0\0\0\0"+n(b,2)+n(b,2)+n(A,4)+n(x,4)+n(L.length,2)+L}(this.dirRecords.length,m,f,this.zipComment,this.encodeFileName);this.push({data:v,meta:{percent:100}})},p.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()},p.prototype.registerPrevious=function(f){this._sources.push(f);var g=this;return f.on("data",function(m){g.processChunk(m)}),f.on("end",function(){g.closedSource(g.previous.streamInfo),g._sources.length?g.prepareNextSource():g.end()}),f.on("error",function(m){g.error(m)}),this},p.prototype.resume=function(){return!!h.prototype.resume.call(this)&&(!this.previous&&this._sources.length?(this.prepareNextSource(),!0):this.previous||this._sources.length||this.generatedError?void 0:(this.end(),!0))},p.prototype.error=function(f){var g=this._sources;if(!h.prototype.error.call(this,f))return!1;for(var m=0;m<g.length;m++)try{g[m].error(f)}catch{}return!0},p.prototype.lock=function(){h.prototype.lock.call(this);for(var f=this._sources,g=0;g<f.length;g++)f[g].lock()},s.exports=p},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(t,s,i){var n=t("../compressions"),r=t("./ZipFileWorker");i.generateWorker=function(a,h,l){var c=new r(h.streamFiles,l,h.platform,h.encodeFileName),d=0;try{a.forEach(function(p,f){d++;var g=function(A,x){var k=A||x,T=n[k];if(!T)throw new Error(k+" is not a valid compression method !");return T}(f.options.compression,h.compression),m=f.options.compressionOptions||h.compressionOptions||{},v=f.dir,b=f.date;f._compressWorker(g,m).withStreamInfo("file",{name:p,dir:v,date:b,comment:f.comment||"",unixPermissions:f.unixPermissions,dosPermissions:f.dosPermissions}).pipe(c)}),c.entriesCount=d}catch(p){c.error(p)}return c}},{"../compressions":3,"./ZipFileWorker":8}],10:[function(t,s,i){function n(){if(!(this instanceof n))return new n;if(arguments.length)throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files=Object.create(null),this.comment=null,this.root="",this.clone=function(){var r=new n;for(var a in this)typeof this[a]!="function"&&(r[a]=this[a]);return r}}(n.prototype=t("./object")).loadAsync=t("./load"),n.support=t("./support"),n.defaults=t("./defaults"),n.version="3.10.1",n.loadAsync=function(r,a){return new n().loadAsync(r,a)},n.external=t("./external"),s.exports=n},{"./defaults":5,"./external":6,"./load":11,"./object":15,"./support":30}],11:[function(t,s,i){var n=t("./utils"),r=t("./external"),a=t("./utf8"),h=t("./zipEntries"),l=t("./stream/Crc32Probe"),c=t("./nodejsUtils");function d(p){return new r.Promise(function(f,g){var m=p.decompressed.getContentWorker().pipe(new l);m.on("error",function(v){g(v)}).on("end",function(){m.streamInfo.crc32!==p.decompressed.crc32?g(new Error("Corrupted zip : CRC32 mismatch")):f()}).resume()})}s.exports=function(p,f){var g=this;return f=n.extend(f||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:a.utf8decode}),c.isNode&&c.isStream(p)?r.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):n.prepareContent("the loaded zip file",p,!0,f.optimizedBinaryString,f.base64).then(function(m){var v=new h(f);return v.load(m),v}).then(function(m){var v=[r.Promise.resolve(m)],b=m.files;if(f.checkCRC32)for(var A=0;A<b.length;A++)v.push(d(b[A]));return r.Promise.all(v)}).then(function(m){for(var v=m.shift(),b=v.files,A=0;A<b.length;A++){var x=b[A],k=x.fileNameStr,T=n.resolve(x.fileNameStr);g.file(T,x.decompressed,{binary:!0,optimizedBinaryString:!0,date:x.date,dir:x.dir,comment:x.fileCommentStr.length?x.fileCommentStr:null,unixPermissions:x.unixPermissions,dosPermissions:x.dosPermissions,createFolders:f.createFolders}),x.dir||(g.file(T).unsafeOriginalName=k)}return v.zipComment.length&&(g.comment=v.zipComment),g})}},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(t,s,i){var n=t("../utils"),r=t("../stream/GenericWorker");function a(h,l){r.call(this,"Nodejs stream input adapter for "+h),this._upstreamEnded=!1,this._bindStream(l)}n.inherits(a,r),a.prototype._bindStream=function(h){var l=this;(this._stream=h).pause(),h.on("data",function(c){l.push({data:c,meta:{percent:0}})}).on("error",function(c){l.isPaused?this.generatedError=c:l.error(c)}).on("end",function(){l.isPaused?l._upstreamEnded=!0:l.end()})},a.prototype.pause=function(){return!!r.prototype.pause.call(this)&&(this._stream.pause(),!0)},a.prototype.resume=function(){return!!r.prototype.resume.call(this)&&(this._upstreamEnded?this.end():this._stream.resume(),!0)},s.exports=a},{"../stream/GenericWorker":28,"../utils":32}],13:[function(t,s,i){var n=t("readable-stream").Readable;function r(a,h,l){n.call(this,h),this._helper=a;var c=this;a.on("data",function(d,p){c.push(d)||c._helper.pause(),l&&l(p)}).on("error",function(d){c.emit("error",d)}).on("end",function(){c.push(null)})}t("../utils").inherits(r,n),r.prototype._read=function(){this._helper.resume()},s.exports=r},{"../utils":32,"readable-stream":16}],14:[function(t,s,i){s.exports={isNode:typeof Buffer<"u",newBufferFrom:function(n,r){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from(n,r);if(typeof n=="number")throw new Error('The "data" argument must not be a number');return new Buffer(n,r)},allocBuffer:function(n){if(Buffer.alloc)return Buffer.alloc(n);var r=new Buffer(n);return r.fill(0),r},isBuffer:function(n){return Buffer.isBuffer(n)},isStream:function(n){return n&&typeof n.on=="function"&&typeof n.pause=="function"&&typeof n.resume=="function"}}},{}],15:[function(t,s,i){function n(T,L,I){var B,D=a.getTypeOf(L),W=a.extend(I||{},c);W.date=W.date||new Date,W.compression!==null&&(W.compression=W.compression.toUpperCase()),typeof W.unixPermissions=="string"&&(W.unixPermissions=parseInt(W.unixPermissions,8)),W.unixPermissions&&16384&W.unixPermissions&&(W.dir=!0),W.dosPermissions&&16&W.dosPermissions&&(W.dir=!0),W.dir&&(T=b(T)),W.createFolders&&(B=v(T))&&A.call(this,B,!0);var q=D==="string"&&W.binary===!1&&W.base64===!1;I&&I.binary!==void 0||(W.binary=!q),(L instanceof d&&L.uncompressedSize===0||W.dir||!L||L.length===0)&&(W.base64=!1,W.binary=!0,L="",W.compression="STORE",D="string");var P=null;P=L instanceof d||L instanceof h?L:g.isNode&&g.isStream(L)?new m(T,L):a.prepareContent(T,L,W.binary,W.optimizedBinaryString,W.base64);var z=new p(T,P,W);this.files[T]=z}var r=t("./utf8"),a=t("./utils"),h=t("./stream/GenericWorker"),l=t("./stream/StreamHelper"),c=t("./defaults"),d=t("./compressedObject"),p=t("./zipObject"),f=t("./generate"),g=t("./nodejsUtils"),m=t("./nodejs/NodejsStreamInputAdapter"),v=function(T){T.slice(-1)==="/"&&(T=T.substring(0,T.length-1));var L=T.lastIndexOf("/");return 0<L?T.substring(0,L):""},b=function(T){return T.slice(-1)!=="/"&&(T+="/"),T},A=function(T,L){return L=L!==void 0?L:c.createFolders,T=b(T),this.files[T]||n.call(this,T,null,{dir:!0,createFolders:L}),this.files[T]};function x(T){return Object.prototype.toString.call(T)==="[object RegExp]"}var k={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(T){var L,I,B;for(L in this.files)B=this.files[L],(I=L.slice(this.root.length,L.length))&&L.slice(0,this.root.length)===this.root&&T(I,B)},filter:function(T){var L=[];return this.forEach(function(I,B){T(I,B)&&L.push(B)}),L},file:function(T,L,I){if(arguments.length!==1)return T=this.root+T,n.call(this,T,L,I),this;if(x(T)){var B=T;return this.filter(function(W,q){return!q.dir&&B.test(W)})}var D=this.files[this.root+T];return D&&!D.dir?D:null},folder:function(T){if(!T)return this;if(x(T))return this.filter(function(D,W){return W.dir&&T.test(D)});var L=this.root+T,I=A.call(this,L),B=this.clone();return B.root=I.name,B},remove:function(T){T=this.root+T;var L=this.files[T];if(L||(T.slice(-1)!=="/"&&(T+="/"),L=this.files[T]),L&&!L.dir)delete this.files[T];else for(var I=this.filter(function(D,W){return W.name.slice(0,T.length)===T}),B=0;B<I.length;B++)delete this.files[I[B].name];return this},generate:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(T){var L,I={};try{if((I=a.extend(T||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:r.utf8encode})).type=I.type.toLowerCase(),I.compression=I.compression.toUpperCase(),I.type==="binarystring"&&(I.type="string"),!I.type)throw new Error("No output type specified.");a.checkSupport(I.type),I.platform!=="darwin"&&I.platform!=="freebsd"&&I.platform!=="linux"&&I.platform!=="sunos"||(I.platform="UNIX"),I.platform==="win32"&&(I.platform="DOS");var B=I.comment||this.comment||"";L=f.generateWorker(this,I,B)}catch(D){(L=new h("error")).error(D)}return new l(L,I.type||"string",I.mimeType)},generateAsync:function(T,L){return this.generateInternalStream(T).accumulate(L)},generateNodeStream:function(T,L){return(T=T||{}).type||(T.type="nodebuffer"),this.generateInternalStream(T).toNodejsStream(L)}};s.exports=k},{"./compressedObject":2,"./defaults":5,"./generate":9,"./nodejs/NodejsStreamInputAdapter":12,"./nodejsUtils":14,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31,"./utils":32,"./zipObject":35}],16:[function(t,s,i){s.exports=t("stream")},{stream:void 0}],17:[function(t,s,i){var n=t("./DataReader");function r(a){n.call(this,a);for(var h=0;h<this.data.length;h++)a[h]=255&a[h]}t("../utils").inherits(r,n),r.prototype.byteAt=function(a){return this.data[this.zero+a]},r.prototype.lastIndexOfSignature=function(a){for(var h=a.charCodeAt(0),l=a.charCodeAt(1),c=a.charCodeAt(2),d=a.charCodeAt(3),p=this.length-4;0<=p;--p)if(this.data[p]===h&&this.data[p+1]===l&&this.data[p+2]===c&&this.data[p+3]===d)return p-this.zero;return-1},r.prototype.readAndCheckSignature=function(a){var h=a.charCodeAt(0),l=a.charCodeAt(1),c=a.charCodeAt(2),d=a.charCodeAt(3),p=this.readData(4);return h===p[0]&&l===p[1]&&c===p[2]&&d===p[3]},r.prototype.readData=function(a){if(this.checkOffset(a),a===0)return[];var h=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,h},s.exports=r},{"../utils":32,"./DataReader":18}],18:[function(t,s,i){var n=t("../utils");function r(a){this.data=a,this.length=a.length,this.index=0,this.zero=0}r.prototype={checkOffset:function(a){this.checkIndex(this.index+a)},checkIndex:function(a){if(this.length<this.zero+a||a<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+a+"). Corrupted zip ?")},setIndex:function(a){this.checkIndex(a),this.index=a},skip:function(a){this.setIndex(this.index+a)},byteAt:function(){},readInt:function(a){var h,l=0;for(this.checkOffset(a),h=this.index+a-1;h>=this.index;h--)l=(l<<8)+this.byteAt(h);return this.index+=a,l},readString:function(a){return n.transformTo("string",this.readData(a))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var a=this.readInt(4);return new Date(Date.UTC(1980+(a>>25&127),(a>>21&15)-1,a>>16&31,a>>11&31,a>>5&63,(31&a)<<1))}},s.exports=r},{"../utils":32}],19:[function(t,s,i){var n=t("./Uint8ArrayReader");function r(a){n.call(this,a)}t("../utils").inherits(r,n),r.prototype.readData=function(a){this.checkOffset(a);var h=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,h},s.exports=r},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(t,s,i){var n=t("./DataReader");function r(a){n.call(this,a)}t("../utils").inherits(r,n),r.prototype.byteAt=function(a){return this.data.charCodeAt(this.zero+a)},r.prototype.lastIndexOfSignature=function(a){return this.data.lastIndexOf(a)-this.zero},r.prototype.readAndCheckSignature=function(a){return a===this.readData(4)},r.prototype.readData=function(a){this.checkOffset(a);var h=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,h},s.exports=r},{"../utils":32,"./DataReader":18}],21:[function(t,s,i){var n=t("./ArrayReader");function r(a){n.call(this,a)}t("../utils").inherits(r,n),r.prototype.readData=function(a){if(this.checkOffset(a),a===0)return new Uint8Array(0);var h=this.data.subarray(this.zero+this.index,this.zero+this.index+a);return this.index+=a,h},s.exports=r},{"../utils":32,"./ArrayReader":17}],22:[function(t,s,i){var n=t("../utils"),r=t("../support"),a=t("./ArrayReader"),h=t("./StringReader"),l=t("./NodeBufferReader"),c=t("./Uint8ArrayReader");s.exports=function(d){var p=n.getTypeOf(d);return n.checkSupport(p),p!=="string"||r.uint8array?p==="nodebuffer"?new l(d):r.uint8array?new c(n.transformTo("uint8array",d)):new a(n.transformTo("array",d)):new h(d)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(t,s,i){i.LOCAL_FILE_HEADER="PK",i.CENTRAL_FILE_HEADER="PK",i.CENTRAL_DIRECTORY_END="PK",i.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",i.ZIP64_CENTRAL_DIRECTORY_END="PK",i.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(t,s,i){var n=t("./GenericWorker"),r=t("../utils");function a(h){n.call(this,"ConvertWorker to "+h),this.destType=h}r.inherits(a,n),a.prototype.processChunk=function(h){this.push({data:r.transformTo(this.destType,h.data),meta:h.meta})},s.exports=a},{"../utils":32,"./GenericWorker":28}],25:[function(t,s,i){var n=t("./GenericWorker"),r=t("../crc32");function a(){n.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}t("../utils").inherits(a,n),a.prototype.processChunk=function(h){this.streamInfo.crc32=r(h.data,this.streamInfo.crc32||0),this.push(h)},s.exports=a},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(t,s,i){var n=t("../utils"),r=t("./GenericWorker");function a(h){r.call(this,"DataLengthProbe for "+h),this.propName=h,this.withStreamInfo(h,0)}n.inherits(a,r),a.prototype.processChunk=function(h){if(h){var l=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=l+h.data.length}r.prototype.processChunk.call(this,h)},s.exports=a},{"../utils":32,"./GenericWorker":28}],27:[function(t,s,i){var n=t("../utils"),r=t("./GenericWorker");function a(h){r.call(this,"DataWorker");var l=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,h.then(function(c){l.dataIsReady=!0,l.data=c,l.max=c&&c.length||0,l.type=n.getTypeOf(c),l.isPaused||l._tickAndRepeat()},function(c){l.error(c)})}n.inherits(a,r),a.prototype.cleanUp=function(){r.prototype.cleanUp.call(this),this.data=null},a.prototype.resume=function(){return!!r.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,n.delay(this._tickAndRepeat,[],this)),!0)},a.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(n.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},a.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var h=null,l=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":h=this.data.substring(this.index,l);break;case"uint8array":h=this.data.subarray(this.index,l);break;case"array":case"nodebuffer":h=this.data.slice(this.index,l)}return this.index=l,this.push({data:h,meta:{percent:this.max?this.index/this.max*100:0}})},s.exports=a},{"../utils":32,"./GenericWorker":28}],28:[function(t,s,i){function n(r){this.name=r||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}n.prototype={push:function(r){this.emit("data",r)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(r){this.emit("error",r)}return!0},error:function(r){return!this.isFinished&&(this.isPaused?this.generatedError=r:(this.isFinished=!0,this.emit("error",r),this.previous&&this.previous.error(r),this.cleanUp()),!0)},on:function(r,a){return this._listeners[r].push(a),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(r,a){if(this._listeners[r])for(var h=0;h<this._listeners[r].length;h++)this._listeners[r][h].call(this,a)},pipe:function(r){return r.registerPrevious(this)},registerPrevious:function(r){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=r.streamInfo,this.mergeStreamInfo(),this.previous=r;var a=this;return r.on("data",function(h){a.processChunk(h)}),r.on("end",function(){a.end()}),r.on("error",function(h){a.error(h)}),this},pause:function(){return!this.isPaused&&!this.isFinished&&(this.isPaused=!0,this.previous&&this.previous.pause(),!0)},resume:function(){if(!this.isPaused||this.isFinished)return!1;var r=this.isPaused=!1;return this.generatedError&&(this.error(this.generatedError),r=!0),this.previous&&this.previous.resume(),!r},flush:function(){},processChunk:function(r){this.push(r)},withStreamInfo:function(r,a){return this.extraStreamInfo[r]=a,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var r in this.extraStreamInfo)Object.prototype.hasOwnProperty.call(this.extraStreamInfo,r)&&(this.streamInfo[r]=this.extraStreamInfo[r])},lock:function(){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.isLocked=!0,this.previous&&this.previous.lock()},toString:function(){var r="Worker "+this.name;return this.previous?this.previous+" -> "+r:r}},s.exports=n},{}],29:[function(t,s,i){var n=t("../utils"),r=t("./ConvertWorker"),a=t("./GenericWorker"),h=t("../base64"),l=t("../support"),c=t("../external"),d=null;if(l.nodestream)try{d=t("../nodejs/NodejsStreamOutputAdapter")}catch{}function p(g,m){return new c.Promise(function(v,b){var A=[],x=g._internalType,k=g._outputType,T=g._mimeType;g.on("data",function(L,I){A.push(L),m&&m(I)}).on("error",function(L){A=[],b(L)}).on("end",function(){try{var L=function(I,B,D){switch(I){case"blob":return n.newBlob(n.transformTo("arraybuffer",B),D);case"base64":return h.encode(B);default:return n.transformTo(I,B)}}(k,function(I,B){var D,W=0,q=null,P=0;for(D=0;D<B.length;D++)P+=B[D].length;switch(I){case"string":return B.join("");case"array":return Array.prototype.concat.apply([],B);case"uint8array":for(q=new Uint8Array(P),D=0;D<B.length;D++)q.set(B[D],W),W+=B[D].length;return q;case"nodebuffer":return Buffer.concat(B);default:throw new Error("concat : unsupported type '"+I+"'")}}(x,A),T);v(L)}catch(I){b(I)}A=[]}).resume()})}function f(g,m,v){var b=m;switch(m){case"blob":case"arraybuffer":b="uint8array";break;case"base64":b="string"}try{this._internalType=b,this._outputType=m,this._mimeType=v,n.checkSupport(b),this._worker=g.pipe(new r(b)),g.lock()}catch(A){this._worker=new a("error"),this._worker.error(A)}}f.prototype={accumulate:function(g){return p(this,g)},on:function(g,m){var v=this;return g==="data"?this._worker.on(g,function(b){m.call(v,b.data,b.meta)}):this._worker.on(g,function(){n.delay(m,arguments,v)}),this},resume:function(){return n.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(g){if(n.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw new Error(this._outputType+" is not supported by this method");return new d(this,{objectMode:this._outputType!=="nodebuffer"},g)}},s.exports=f},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(t,s,i){if(i.base64=!0,i.array=!0,i.string=!0,i.arraybuffer=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u",i.nodebuffer=typeof Buffer<"u",i.uint8array=typeof Uint8Array<"u",typeof ArrayBuffer>"u")i.blob=!1;else{var n=new ArrayBuffer(0);try{i.blob=new Blob([n],{type:"application/zip"}).size===0}catch{try{var r=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);r.append(n),i.blob=r.getBlob("application/zip").size===0}catch{i.blob=!1}}}try{i.nodestream=!!t("readable-stream").Readable}catch{i.nodestream=!1}},{"readable-stream":16}],31:[function(t,s,i){for(var n=t("./utils"),r=t("./support"),a=t("./nodejsUtils"),h=t("./stream/GenericWorker"),l=new Array(256),c=0;c<256;c++)l[c]=252<=c?6:248<=c?5:240<=c?4:224<=c?3:192<=c?2:1;l[254]=l[254]=1;function d(){h.call(this,"utf-8 decode"),this.leftOver=null}function p(){h.call(this,"utf-8 encode")}i.utf8encode=function(f){return r.nodebuffer?a.newBufferFrom(f,"utf-8"):function(g){var m,v,b,A,x,k=g.length,T=0;for(A=0;A<k;A++)(64512&(v=g.charCodeAt(A)))==55296&&A+1<k&&(64512&(b=g.charCodeAt(A+1)))==56320&&(v=65536+(v-55296<<10)+(b-56320),A++),T+=v<128?1:v<2048?2:v<65536?3:4;for(m=r.uint8array?new Uint8Array(T):new Array(T),A=x=0;x<T;A++)(64512&(v=g.charCodeAt(A)))==55296&&A+1<k&&(64512&(b=g.charCodeAt(A+1)))==56320&&(v=65536+(v-55296<<10)+(b-56320),A++),v<128?m[x++]=v:(v<2048?m[x++]=192|v>>>6:(v<65536?m[x++]=224|v>>>12:(m[x++]=240|v>>>18,m[x++]=128|v>>>12&63),m[x++]=128|v>>>6&63),m[x++]=128|63&v);return m}(f)},i.utf8decode=function(f){return r.nodebuffer?n.transformTo("nodebuffer",f).toString("utf-8"):function(g){var m,v,b,A,x=g.length,k=new Array(2*x);for(m=v=0;m<x;)if((b=g[m++])<128)k[v++]=b;else if(4<(A=l[b]))k[v++]=65533,m+=A-1;else{for(b&=A===2?31:A===3?15:7;1<A&&m<x;)b=b<<6|63&g[m++],A--;1<A?k[v++]=65533:b<65536?k[v++]=b:(b-=65536,k[v++]=55296|b>>10&1023,k[v++]=56320|1023&b)}return k.length!==v&&(k.subarray?k=k.subarray(0,v):k.length=v),n.applyFromCharCode(k)}(f=n.transformTo(r.uint8array?"uint8array":"array",f))},n.inherits(d,h),d.prototype.processChunk=function(f){var g=n.transformTo(r.uint8array?"uint8array":"array",f.data);if(this.leftOver&&this.leftOver.length){if(r.uint8array){var m=g;(g=new Uint8Array(m.length+this.leftOver.length)).set(this.leftOver,0),g.set(m,this.leftOver.length)}else g=this.leftOver.concat(g);this.leftOver=null}var v=function(A,x){var k;for((x=x||A.length)>A.length&&(x=A.length),k=x-1;0<=k&&(192&A[k])==128;)k--;return k<0||k===0?x:k+l[A[k]]>x?k:x}(g),b=g;v!==g.length&&(r.uint8array?(b=g.subarray(0,v),this.leftOver=g.subarray(v,g.length)):(b=g.slice(0,v),this.leftOver=g.slice(v,g.length))),this.push({data:i.utf8decode(b),meta:f.meta})},d.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:i.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},i.Utf8DecodeWorker=d,n.inherits(p,h),p.prototype.processChunk=function(f){this.push({data:i.utf8encode(f.data),meta:f.meta})},i.Utf8EncodeWorker=p},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(t,s,i){var n=t("./support"),r=t("./base64"),a=t("./nodejsUtils"),h=t("./external");function l(m){return m}function c(m,v){for(var b=0;b<m.length;++b)v[b]=255&m.charCodeAt(b);return v}t("setimmediate"),i.newBlob=function(m,v){i.checkSupport("blob");try{return new Blob([m],{type:v})}catch{try{var b=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return b.append(m),b.getBlob(v)}catch{throw new Error("Bug : can't construct the Blob.")}}};var d={stringifyByChunk:function(m,v,b){var A=[],x=0,k=m.length;if(k<=b)return String.fromCharCode.apply(null,m);for(;x<k;)v==="array"||v==="nodebuffer"?A.push(String.fromCharCode.apply(null,m.slice(x,Math.min(x+b,k)))):A.push(String.fromCharCode.apply(null,m.subarray(x,Math.min(x+b,k)))),x+=b;return A.join("")},stringifyByChar:function(m){for(var v="",b=0;b<m.length;b++)v+=String.fromCharCode(m[b]);return v},applyCanBeUsed:{uint8array:function(){try{return n.uint8array&&String.fromCharCode.apply(null,new Uint8Array(1)).length===1}catch{return!1}}(),nodebuffer:function(){try{return n.nodebuffer&&String.fromCharCode.apply(null,a.allocBuffer(1)).length===1}catch{return!1}}()}};function p(m){var v=65536,b=i.getTypeOf(m),A=!0;if(b==="uint8array"?A=d.applyCanBeUsed.uint8array:b==="nodebuffer"&&(A=d.applyCanBeUsed.nodebuffer),A)for(;1<v;)try{return d.stringifyByChunk(m,b,v)}catch{v=Math.floor(v/2)}return d.stringifyByChar(m)}function f(m,v){for(var b=0;b<m.length;b++)v[b]=m[b];return v}i.applyFromCharCode=p;var g={};g.string={string:l,array:function(m){return c(m,new Array(m.length))},arraybuffer:function(m){return g.string.uint8array(m).buffer},uint8array:function(m){return c(m,new Uint8Array(m.length))},nodebuffer:function(m){return c(m,a.allocBuffer(m.length))}},g.array={string:p,array:l,arraybuffer:function(m){return new Uint8Array(m).buffer},uint8array:function(m){return new Uint8Array(m)},nodebuffer:function(m){return a.newBufferFrom(m)}},g.arraybuffer={string:function(m){return p(new Uint8Array(m))},array:function(m){return f(new Uint8Array(m),new Array(m.byteLength))},arraybuffer:l,uint8array:function(m){return new Uint8Array(m)},nodebuffer:function(m){return a.newBufferFrom(new Uint8Array(m))}},g.uint8array={string:p,array:function(m){return f(m,new Array(m.length))},arraybuffer:function(m){return m.buffer},uint8array:l,nodebuffer:function(m){return a.newBufferFrom(m)}},g.nodebuffer={string:p,array:function(m){return f(m,new Array(m.length))},arraybuffer:function(m){return g.nodebuffer.uint8array(m).buffer},uint8array:function(m){return f(m,new Uint8Array(m.length))},nodebuffer:l},i.transformTo=function(m,v){if(v=v||"",!m)return v;i.checkSupport(m);var b=i.getTypeOf(v);return g[b][m](v)},i.resolve=function(m){for(var v=m.split("/"),b=[],A=0;A<v.length;A++){var x=v[A];x==="."||x===""&&A!==0&&A!==v.length-1||(x===".."?b.pop():b.push(x))}return b.join("/")},i.getTypeOf=function(m){return typeof m=="string"?"string":Object.prototype.toString.call(m)==="[object Array]"?"array":n.nodebuffer&&a.isBuffer(m)?"nodebuffer":n.uint8array&&m instanceof Uint8Array?"uint8array":n.arraybuffer&&m instanceof ArrayBuffer?"arraybuffer":void 0},i.checkSupport=function(m){if(!n[m.toLowerCase()])throw new Error(m+" is not supported by this platform")},i.MAX_VALUE_16BITS=65535,i.MAX_VALUE_32BITS=-1,i.pretty=function(m){var v,b,A="";for(b=0;b<(m||"").length;b++)A+="\\x"+((v=m.charCodeAt(b))<16?"0":"")+v.toString(16).toUpperCase();return A},i.delay=function(m,v,b){setImmediate(function(){m.apply(b||null,v||[])})},i.inherits=function(m,v){function b(){}b.prototype=v.prototype,m.prototype=new b},i.extend=function(){var m,v,b={};for(m=0;m<arguments.length;m++)for(v in arguments[m])Object.prototype.hasOwnProperty.call(arguments[m],v)&&b[v]===void 0&&(b[v]=arguments[m][v]);return b},i.prepareContent=function(m,v,b,A,x){return h.Promise.resolve(v).then(function(k){return n.blob&&(k instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(k))!==-1)&&typeof FileReader<"u"?new h.Promise(function(T,L){var I=new FileReader;I.onload=function(B){T(B.target.result)},I.onerror=function(B){L(B.target.error)},I.readAsArrayBuffer(k)}):k}).then(function(k){var T=i.getTypeOf(k);return T?(T==="arraybuffer"?k=i.transformTo("uint8array",k):T==="string"&&(x?k=r.decode(k):b&&A!==!0&&(k=function(L){return c(L,n.uint8array?new Uint8Array(L.length):new Array(L.length))}(k))),k):h.Promise.reject(new Error("Can't read the data of '"+m+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))})}},{"./base64":1,"./external":6,"./nodejsUtils":14,"./support":30,setimmediate:54}],33:[function(t,s,i){var n=t("./reader/readerFor"),r=t("./utils"),a=t("./signature"),h=t("./zipEntry"),l=t("./support");function c(d){this.files=[],this.loadOptions=d}c.prototype={checkSignature:function(d){if(!this.reader.readAndCheckSignature(d)){this.reader.index-=4;var p=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+r.pretty(p)+", expected "+r.pretty(d)+")")}},isSignature:function(d,p){var f=this.reader.index;this.reader.setIndex(d);var g=this.reader.readString(4)===p;return this.reader.setIndex(f),g},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var d=this.reader.readData(this.zipCommentLength),p=l.uint8array?"uint8array":"array",f=r.transformTo(p,d);this.zipComment=this.loadOptions.decodeFileName(f)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.reader.skip(4),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};for(var d,p,f,g=this.zip64EndOfCentralSize-44;0<g;)d=this.reader.readInt(2),p=this.reader.readInt(4),f=this.reader.readData(p),this.zip64ExtensibleData[d]={id:d,length:p,value:f}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),1<this.disksCount)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var d,p;for(d=0;d<this.files.length;d++)p=this.files[d],this.reader.setIndex(p.localHeaderOffset),this.checkSignature(a.LOCAL_FILE_HEADER),p.readLocalPart(this.reader),p.handleUTF8(),p.processAttributes()},readCentralDir:function(){var d;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(a.CENTRAL_FILE_HEADER);)(d=new h({zip64:this.zip64},this.loadOptions)).readCentralPart(this.reader),this.files.push(d);if(this.centralDirRecords!==this.files.length&&this.centralDirRecords!==0&&this.files.length===0)throw new Error("Corrupted zip or bug: expected "+this.centralDirRecords+" records in central dir, got "+this.files.length)},readEndOfCentral:function(){var d=this.reader.lastIndexOfSignature(a.CENTRAL_DIRECTORY_END);if(d<0)throw this.isSignature(0,a.LOCAL_FILE_HEADER)?new Error("Corrupted zip: can't find end of central directory"):new Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html");this.reader.setIndex(d);var p=d;if(this.checkSignature(a.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===r.MAX_VALUE_16BITS||this.diskWithCentralDirStart===r.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===r.MAX_VALUE_16BITS||this.centralDirRecords===r.MAX_VALUE_16BITS||this.centralDirSize===r.MAX_VALUE_32BITS||this.centralDirOffset===r.MAX_VALUE_32BITS){if(this.zip64=!0,(d=this.reader.lastIndexOfSignature(a.ZIP64_CENTRAL_DIRECTORY_LOCATOR))<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(d),this.checkSignature(a.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,a.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(a.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0))throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(a.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var f=this.centralDirOffset+this.centralDirSize;this.zip64&&(f+=20,f+=12+this.zip64EndOfCentralSize);var g=p-f;if(0<g)this.isSignature(p,a.CENTRAL_FILE_HEADER)||(this.reader.zero=g);else if(g<0)throw new Error("Corrupted zip: missing "+Math.abs(g)+" bytes.")},prepareReader:function(d){this.reader=n(d)},load:function(d){this.prepareReader(d),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},s.exports=c},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utils":32,"./zipEntry":34}],34:[function(t,s,i){var n=t("./reader/readerFor"),r=t("./utils"),a=t("./compressedObject"),h=t("./crc32"),l=t("./utf8"),c=t("./compressions"),d=t("./support");function p(f,g){this.options=f,this.loadOptions=g}p.prototype={isEncrypted:function(){return(1&this.bitFlag)==1},useUTF8:function(){return(2048&this.bitFlag)==2048},readLocalPart:function(f){var g,m;if(f.skip(22),this.fileNameLength=f.readInt(2),m=f.readInt(2),this.fileName=f.readData(this.fileNameLength),f.skip(m),this.compressedSize===-1||this.uncompressedSize===-1)throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if((g=function(v){for(var b in c)if(Object.prototype.hasOwnProperty.call(c,b)&&c[b].magic===v)return c[b];return null}(this.compressionMethod))===null)throw new Error("Corrupted zip : compression "+r.pretty(this.compressionMethod)+" unknown (inner file : "+r.transformTo("string",this.fileName)+")");this.decompressed=new a(this.compressedSize,this.uncompressedSize,this.crc32,g,f.readData(this.compressedSize))},readCentralPart:function(f){this.versionMadeBy=f.readInt(2),f.skip(2),this.bitFlag=f.readInt(2),this.compressionMethod=f.readString(2),this.date=f.readDate(),this.crc32=f.readInt(4),this.compressedSize=f.readInt(4),this.uncompressedSize=f.readInt(4);var g=f.readInt(2);if(this.extraFieldsLength=f.readInt(2),this.fileCommentLength=f.readInt(2),this.diskNumberStart=f.readInt(2),this.internalFileAttributes=f.readInt(2),this.externalFileAttributes=f.readInt(4),this.localHeaderOffset=f.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");f.skip(g),this.readExtraFields(f),this.parseZIP64ExtraField(f),this.fileComment=f.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var f=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),f==0&&(this.dosPermissions=63&this.externalFileAttributes),f==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var f=n(this.extraFields[1].value);this.uncompressedSize===r.MAX_VALUE_32BITS&&(this.uncompressedSize=f.readInt(8)),this.compressedSize===r.MAX_VALUE_32BITS&&(this.compressedSize=f.readInt(8)),this.localHeaderOffset===r.MAX_VALUE_32BITS&&(this.localHeaderOffset=f.readInt(8)),this.diskNumberStart===r.MAX_VALUE_32BITS&&(this.diskNumberStart=f.readInt(4))}},readExtraFields:function(f){var g,m,v,b=f.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});f.index+4<b;)g=f.readInt(2),m=f.readInt(2),v=f.readData(m),this.extraFields[g]={id:g,length:m,value:v};f.setIndex(b)},handleUTF8:function(){var f=d.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=l.utf8decode(this.fileName),this.fileCommentStr=l.utf8decode(this.fileComment);else{var g=this.findExtraFieldUnicodePath();if(g!==null)this.fileNameStr=g;else{var m=r.transformTo(f,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(m)}var v=this.findExtraFieldUnicodeComment();if(v!==null)this.fileCommentStr=v;else{var b=r.transformTo(f,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(b)}}},findExtraFieldUnicodePath:function(){var f=this.extraFields[28789];if(f){var g=n(f.value);return g.readInt(1)!==1||h(this.fileName)!==g.readInt(4)?null:l.utf8decode(g.readData(f.length-5))}return null},findExtraFieldUnicodeComment:function(){var f=this.extraFields[25461];if(f){var g=n(f.value);return g.readInt(1)!==1||h(this.fileComment)!==g.readInt(4)?null:l.utf8decode(g.readData(f.length-5))}return null}},s.exports=p},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(t,s,i){function n(g,m,v){this.name=g,this.dir=v.dir,this.date=v.date,this.comment=v.comment,this.unixPermissions=v.unixPermissions,this.dosPermissions=v.dosPermissions,this._data=m,this._dataBinary=v.binary,this.options={compression:v.compression,compressionOptions:v.compressionOptions}}var r=t("./stream/StreamHelper"),a=t("./stream/DataWorker"),h=t("./utf8"),l=t("./compressedObject"),c=t("./stream/GenericWorker");n.prototype={internalStream:function(g){var m=null,v="string";try{if(!g)throw new Error("No output type specified.");var b=(v=g.toLowerCase())==="string"||v==="text";v!=="binarystring"&&v!=="text"||(v="string"),m=this._decompressWorker();var A=!this._dataBinary;A&&!b&&(m=m.pipe(new h.Utf8EncodeWorker)),!A&&b&&(m=m.pipe(new h.Utf8DecodeWorker))}catch(x){(m=new c("error")).error(x)}return new r(m,v,"")},async:function(g,m){return this.internalStream(g).accumulate(m)},nodeStream:function(g,m){return this.internalStream(g||"nodebuffer").toNodejsStream(m)},_compressWorker:function(g,m){if(this._data instanceof l&&this._data.compression.magic===g.magic)return this._data.getCompressedWorker();var v=this._decompressWorker();return this._dataBinary||(v=v.pipe(new h.Utf8EncodeWorker)),l.createWorkerFrom(v,g,m)},_decompressWorker:function(){return this._data instanceof l?this._data.getContentWorker():this._data instanceof c?this._data:new a(this._data)}};for(var d=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],p=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},f=0;f<d.length;f++)n.prototype[d[f]]=p;s.exports=n},{"./compressedObject":2,"./stream/DataWorker":27,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31}],36:[function(t,s,i){(function(n){var r,a,h=n.MutationObserver||n.WebKitMutationObserver;if(h){var l=0,c=new h(g),d=n.document.createTextNode("");c.observe(d,{characterData:!0}),r=function(){d.data=l=++l%2}}else if(n.setImmediate||n.MessageChannel===void 0)r="document"in n&&"onreadystatechange"in n.document.createElement("script")?function(){var m=n.document.createElement("script");m.onreadystatechange=function(){g(),m.onreadystatechange=null,m.parentNode.removeChild(m),m=null},n.document.documentElement.appendChild(m)}:function(){setTimeout(g,0)};else{var p=new n.MessageChannel;p.port1.onmessage=g,r=function(){p.port2.postMessage(0)}}var f=[];function g(){var m,v;a=!0;for(var b=f.length;b;){for(v=f,f=[],m=-1;++m<b;)v[m]();b=f.length}a=!1}s.exports=function(m){f.push(m)!==1||a||r()}}).call(this,typeof Eh<"u"?Eh:typeof self<"u"?self:typeof window<"u"?window:{})},{}],37:[function(t,s,i){var n=t("immediate");function r(){}var a={},h=["REJECTED"],l=["FULFILLED"],c=["PENDING"];function d(b){if(typeof b!="function")throw new TypeError("resolver must be a function");this.state=c,this.queue=[],this.outcome=void 0,b!==r&&m(this,b)}function p(b,A,x){this.promise=b,typeof A=="function"&&(this.onFulfilled=A,this.callFulfilled=this.otherCallFulfilled),typeof x=="function"&&(this.onRejected=x,this.callRejected=this.otherCallRejected)}function f(b,A,x){n(function(){var k;try{k=A(x)}catch(T){return a.reject(b,T)}k===b?a.reject(b,new TypeError("Cannot resolve promise with itself")):a.resolve(b,k)})}function g(b){var A=b&&b.then;if(b&&(typeof b=="object"||typeof b=="function")&&typeof A=="function")return function(){A.apply(b,arguments)}}function m(b,A){var x=!1;function k(I){x||(x=!0,a.reject(b,I))}function T(I){x||(x=!0,a.resolve(b,I))}var L=v(function(){A(T,k)});L.status==="error"&&k(L.value)}function v(b,A){var x={};try{x.value=b(A),x.status="success"}catch(k){x.status="error",x.value=k}return x}(s.exports=d).prototype.finally=function(b){if(typeof b!="function")return this;var A=this.constructor;return this.then(function(x){return A.resolve(b()).then(function(){return x})},function(x){return A.resolve(b()).then(function(){throw x})})},d.prototype.catch=function(b){return this.then(null,b)},d.prototype.then=function(b,A){if(typeof b!="function"&&this.state===l||typeof A!="function"&&this.state===h)return this;var x=new this.constructor(r);return this.state!==c?f(x,this.state===l?b:A,this.outcome):this.queue.push(new p(x,b,A)),x},p.prototype.callFulfilled=function(b){a.resolve(this.promise,b)},p.prototype.otherCallFulfilled=function(b){f(this.promise,this.onFulfilled,b)},p.prototype.callRejected=function(b){a.reject(this.promise,b)},p.prototype.otherCallRejected=function(b){f(this.promise,this.onRejected,b)},a.resolve=function(b,A){var x=v(g,A);if(x.status==="error")return a.reject(b,x.value);var k=x.value;if(k)m(b,k);else{b.state=l,b.outcome=A;for(var T=-1,L=b.queue.length;++T<L;)b.queue[T].callFulfilled(A)}return b},a.reject=function(b,A){b.state=h,b.outcome=A;for(var x=-1,k=b.queue.length;++x<k;)b.queue[x].callRejected(A);return b},d.resolve=function(b){return b instanceof this?b:a.resolve(new this(r),b)},d.reject=function(b){var A=new this(r);return a.reject(A,b)},d.all=function(b){var A=this;if(Object.prototype.toString.call(b)!=="[object Array]")return this.reject(new TypeError("must be an array"));var x=b.length,k=!1;if(!x)return this.resolve([]);for(var T=new Array(x),L=0,I=-1,B=new this(r);++I<x;)D(b[I],I);return B;function D(W,q){A.resolve(W).then(function(P){T[q]=P,++L!==x||k||(k=!0,a.resolve(B,T))},function(P){k||(k=!0,a.reject(B,P))})}},d.race=function(b){var A=this;if(Object.prototype.toString.call(b)!=="[object Array]")return this.reject(new TypeError("must be an array"));var x=b.length,k=!1;if(!x)return this.resolve([]);for(var T=-1,L=new this(r);++T<x;)I=b[T],A.resolve(I).then(function(B){k||(k=!0,a.resolve(L,B))},function(B){k||(k=!0,a.reject(L,B))});var I;return L}},{immediate:36}],38:[function(t,s,i){var n={};(0,t("./lib/utils/common").assign)(n,t("./lib/deflate"),t("./lib/inflate"),t("./lib/zlib/constants")),s.exports=n},{"./lib/deflate":39,"./lib/inflate":40,"./lib/utils/common":41,"./lib/zlib/constants":44}],39:[function(t,s,i){var n=t("./zlib/deflate"),r=t("./utils/common"),a=t("./utils/strings"),h=t("./zlib/messages"),l=t("./zlib/zstream"),c=Object.prototype.toString,d=0,p=-1,f=0,g=8;function m(b){if(!(this instanceof m))return new m(b);this.options=r.assign({level:p,method:g,chunkSize:16384,windowBits:15,memLevel:8,strategy:f,to:""},b||{});var A=this.options;A.raw&&0<A.windowBits?A.windowBits=-A.windowBits:A.gzip&&0<A.windowBits&&A.windowBits<16&&(A.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new l,this.strm.avail_out=0;var x=n.deflateInit2(this.strm,A.level,A.method,A.windowBits,A.memLevel,A.strategy);if(x!==d)throw new Error(h[x]);if(A.header&&n.deflateSetHeader(this.strm,A.header),A.dictionary){var k;if(k=typeof A.dictionary=="string"?a.string2buf(A.dictionary):c.call(A.dictionary)==="[object ArrayBuffer]"?new Uint8Array(A.dictionary):A.dictionary,(x=n.deflateSetDictionary(this.strm,k))!==d)throw new Error(h[x]);this._dict_set=!0}}function v(b,A){var x=new m(A);if(x.push(b,!0),x.err)throw x.msg||h[x.err];return x.result}m.prototype.push=function(b,A){var x,k,T=this.strm,L=this.options.chunkSize;if(this.ended)return!1;k=A===~~A?A:A===!0?4:0,typeof b=="string"?T.input=a.string2buf(b):c.call(b)==="[object ArrayBuffer]"?T.input=new Uint8Array(b):T.input=b,T.next_in=0,T.avail_in=T.input.length;do{if(T.avail_out===0&&(T.output=new r.Buf8(L),T.next_out=0,T.avail_out=L),(x=n.deflate(T,k))!==1&&x!==d)return this.onEnd(x),!(this.ended=!0);T.avail_out!==0&&(T.avail_in!==0||k!==4&&k!==2)||(this.options.to==="string"?this.onData(a.buf2binstring(r.shrinkBuf(T.output,T.next_out))):this.onData(r.shrinkBuf(T.output,T.next_out)))}while((0<T.avail_in||T.avail_out===0)&&x!==1);return k===4?(x=n.deflateEnd(this.strm),this.onEnd(x),this.ended=!0,x===d):k!==2||(this.onEnd(d),!(T.avail_out=0))},m.prototype.onData=function(b){this.chunks.push(b)},m.prototype.onEnd=function(b){b===d&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=r.flattenChunks(this.chunks)),this.chunks=[],this.err=b,this.msg=this.strm.msg},i.Deflate=m,i.deflate=v,i.deflateRaw=function(b,A){return(A=A||{}).raw=!0,v(b,A)},i.gzip=function(b,A){return(A=A||{}).gzip=!0,v(b,A)}},{"./utils/common":41,"./utils/strings":42,"./zlib/deflate":46,"./zlib/messages":51,"./zlib/zstream":53}],40:[function(t,s,i){var n=t("./zlib/inflate"),r=t("./utils/common"),a=t("./utils/strings"),h=t("./zlib/constants"),l=t("./zlib/messages"),c=t("./zlib/zstream"),d=t("./zlib/gzheader"),p=Object.prototype.toString;function f(m){if(!(this instanceof f))return new f(m);this.options=r.assign({chunkSize:16384,windowBits:0,to:""},m||{});var v=this.options;v.raw&&0<=v.windowBits&&v.windowBits<16&&(v.windowBits=-v.windowBits,v.windowBits===0&&(v.windowBits=-15)),!(0<=v.windowBits&&v.windowBits<16)||m&&m.windowBits||(v.windowBits+=32),15<v.windowBits&&v.windowBits<48&&!(15&v.windowBits)&&(v.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new c,this.strm.avail_out=0;var b=n.inflateInit2(this.strm,v.windowBits);if(b!==h.Z_OK)throw new Error(l[b]);this.header=new d,n.inflateGetHeader(this.strm,this.header)}function g(m,v){var b=new f(v);if(b.push(m,!0),b.err)throw b.msg||l[b.err];return b.result}f.prototype.push=function(m,v){var b,A,x,k,T,L,I=this.strm,B=this.options.chunkSize,D=this.options.dictionary,W=!1;if(this.ended)return!1;A=v===~~v?v:v===!0?h.Z_FINISH:h.Z_NO_FLUSH,typeof m=="string"?I.input=a.binstring2buf(m):p.call(m)==="[object ArrayBuffer]"?I.input=new Uint8Array(m):I.input=m,I.next_in=0,I.avail_in=I.input.length;do{if(I.avail_out===0&&(I.output=new r.Buf8(B),I.next_out=0,I.avail_out=B),(b=n.inflate(I,h.Z_NO_FLUSH))===h.Z_NEED_DICT&&D&&(L=typeof D=="string"?a.string2buf(D):p.call(D)==="[object ArrayBuffer]"?new Uint8Array(D):D,b=n.inflateSetDictionary(this.strm,L)),b===h.Z_BUF_ERROR&&W===!0&&(b=h.Z_OK,W=!1),b!==h.Z_STREAM_END&&b!==h.Z_OK)return this.onEnd(b),!(this.ended=!0);I.next_out&&(I.avail_out!==0&&b!==h.Z_STREAM_END&&(I.avail_in!==0||A!==h.Z_FINISH&&A!==h.Z_SYNC_FLUSH)||(this.options.to==="string"?(x=a.utf8border(I.output,I.next_out),k=I.next_out-x,T=a.buf2string(I.output,x),I.next_out=k,I.avail_out=B-k,k&&r.arraySet(I.output,I.output,x,k,0),this.onData(T)):this.onData(r.shrinkBuf(I.output,I.next_out)))),I.avail_in===0&&I.avail_out===0&&(W=!0)}while((0<I.avail_in||I.avail_out===0)&&b!==h.Z_STREAM_END);return b===h.Z_STREAM_END&&(A=h.Z_FINISH),A===h.Z_FINISH?(b=n.inflateEnd(this.strm),this.onEnd(b),this.ended=!0,b===h.Z_OK):A!==h.Z_SYNC_FLUSH||(this.onEnd(h.Z_OK),!(I.avail_out=0))},f.prototype.onData=function(m){this.chunks.push(m)},f.prototype.onEnd=function(m){m===h.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=r.flattenChunks(this.chunks)),this.chunks=[],this.err=m,this.msg=this.strm.msg},i.Inflate=f,i.inflate=g,i.inflateRaw=function(m,v){return(v=v||{}).raw=!0,g(m,v)},i.ungzip=g},{"./utils/common":41,"./utils/strings":42,"./zlib/constants":44,"./zlib/gzheader":47,"./zlib/inflate":49,"./zlib/messages":51,"./zlib/zstream":53}],41:[function(t,s,i){var n=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";i.assign=function(h){for(var l=Array.prototype.slice.call(arguments,1);l.length;){var c=l.shift();if(c){if(typeof c!="object")throw new TypeError(c+"must be non-object");for(var d in c)c.hasOwnProperty(d)&&(h[d]=c[d])}}return h},i.shrinkBuf=function(h,l){return h.length===l?h:h.subarray?h.subarray(0,l):(h.length=l,h)};var r={arraySet:function(h,l,c,d,p){if(l.subarray&&h.subarray)h.set(l.subarray(c,c+d),p);else for(var f=0;f<d;f++)h[p+f]=l[c+f]},flattenChunks:function(h){var l,c,d,p,f,g;for(l=d=0,c=h.length;l<c;l++)d+=h[l].length;for(g=new Uint8Array(d),l=p=0,c=h.length;l<c;l++)f=h[l],g.set(f,p),p+=f.length;return g}},a={arraySet:function(h,l,c,d,p){for(var f=0;f<d;f++)h[p+f]=l[c+f]},flattenChunks:function(h){return[].concat.apply([],h)}};i.setTyped=function(h){h?(i.Buf8=Uint8Array,i.Buf16=Uint16Array,i.Buf32=Int32Array,i.assign(i,r)):(i.Buf8=Array,i.Buf16=Array,i.Buf32=Array,i.assign(i,a))},i.setTyped(n)},{}],42:[function(t,s,i){var n=t("./common"),r=!0,a=!0;try{String.fromCharCode.apply(null,[0])}catch{r=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{a=!1}for(var h=new n.Buf8(256),l=0;l<256;l++)h[l]=252<=l?6:248<=l?5:240<=l?4:224<=l?3:192<=l?2:1;function c(d,p){if(p<65537&&(d.subarray&&a||!d.subarray&&r))return String.fromCharCode.apply(null,n.shrinkBuf(d,p));for(var f="",g=0;g<p;g++)f+=String.fromCharCode(d[g]);return f}h[254]=h[254]=1,i.string2buf=function(d){var p,f,g,m,v,b=d.length,A=0;for(m=0;m<b;m++)(64512&(f=d.charCodeAt(m)))==55296&&m+1<b&&(64512&(g=d.charCodeAt(m+1)))==56320&&(f=65536+(f-55296<<10)+(g-56320),m++),A+=f<128?1:f<2048?2:f<65536?3:4;for(p=new n.Buf8(A),m=v=0;v<A;m++)(64512&(f=d.charCodeAt(m)))==55296&&m+1<b&&(64512&(g=d.charCodeAt(m+1)))==56320&&(f=65536+(f-55296<<10)+(g-56320),m++),f<128?p[v++]=f:(f<2048?p[v++]=192|f>>>6:(f<65536?p[v++]=224|f>>>12:(p[v++]=240|f>>>18,p[v++]=128|f>>>12&63),p[v++]=128|f>>>6&63),p[v++]=128|63&f);return p},i.buf2binstring=function(d){return c(d,d.length)},i.binstring2buf=function(d){for(var p=new n.Buf8(d.length),f=0,g=p.length;f<g;f++)p[f]=d.charCodeAt(f);return p},i.buf2string=function(d,p){var f,g,m,v,b=p||d.length,A=new Array(2*b);for(f=g=0;f<b;)if((m=d[f++])<128)A[g++]=m;else if(4<(v=h[m]))A[g++]=65533,f+=v-1;else{for(m&=v===2?31:v===3?15:7;1<v&&f<b;)m=m<<6|63&d[f++],v--;1<v?A[g++]=65533:m<65536?A[g++]=m:(m-=65536,A[g++]=55296|m>>10&1023,A[g++]=56320|1023&m)}return c(A,g)},i.utf8border=function(d,p){var f;for((p=p||d.length)>d.length&&(p=d.length),f=p-1;0<=f&&(192&d[f])==128;)f--;return f<0||f===0?p:f+h[d[f]]>p?f:p}},{"./common":41}],43:[function(t,s,i){s.exports=function(n,r,a,h){for(var l=65535&n|0,c=n>>>16&65535|0,d=0;a!==0;){for(a-=d=2e3<a?2e3:a;c=c+(l=l+r[h++]|0)|0,--d;);l%=65521,c%=65521}return l|c<<16|0}},{}],44:[function(t,s,i){s.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],45:[function(t,s,i){var n=function(){for(var r,a=[],h=0;h<256;h++){r=h;for(var l=0;l<8;l++)r=1&r?3988292384^r>>>1:r>>>1;a[h]=r}return a}();s.exports=function(r,a,h,l){var c=n,d=l+h;r^=-1;for(var p=l;p<d;p++)r=r>>>8^c[255&(r^a[p])];return-1^r}},{}],46:[function(t,s,i){var n,r=t("../utils/common"),a=t("./trees"),h=t("./adler32"),l=t("./crc32"),c=t("./messages"),d=0,p=4,f=0,g=-2,m=-1,v=4,b=2,A=8,x=9,k=286,T=30,L=19,I=2*k+1,B=15,D=3,W=258,q=W+D+1,P=42,z=113,y=1,H=2,rt=3,U=4;function Q(_,G){return _.msg=c[G],G}function X(_){return(_<<1)-(4<_?9:0)}function ht(_){for(var G=_.length;0<=--G;)_[G]=0}function M(_){var G=_.state,j=G.pending;j>_.avail_out&&(j=_.avail_out),j!==0&&(r.arraySet(_.output,G.pending_buf,G.pending_out,j,_.next_out),_.next_out+=j,G.pending_out+=j,_.total_out+=j,_.avail_out-=j,G.pending-=j,G.pending===0&&(G.pending_out=0))}function O(_,G){a._tr_flush_block(_,0<=_.block_start?_.block_start:-1,_.strstart-_.block_start,G),_.block_start=_.strstart,M(_.strm)}function st(_,G){_.pending_buf[_.pending++]=G}function J(_,G){_.pending_buf[_.pending++]=G>>>8&255,_.pending_buf[_.pending++]=255&G}function Y(_,G){var j,R,C=_.max_chain_length,F=_.strstart,$=_.prev_length,V=_.nice_match,N=_.strstart>_.w_size-q?_.strstart-(_.w_size-q):0,K=_.window,it=_.w_mask,Z=_.prev,lt=_.strstart+W,Ft=K[F+$-1],At=K[F+$];_.prev_length>=_.good_match&&(C>>=2),V>_.lookahead&&(V=_.lookahead);do if(K[(j=G)+$]===At&&K[j+$-1]===Ft&&K[j]===K[F]&&K[++j]===K[F+1]){F+=2,j++;do;while(K[++F]===K[++j]&&K[++F]===K[++j]&&K[++F]===K[++j]&&K[++F]===K[++j]&&K[++F]===K[++j]&&K[++F]===K[++j]&&K[++F]===K[++j]&&K[++F]===K[++j]&&F<lt);if(R=W-(lt-F),F=lt-W,$<R){if(_.match_start=G,V<=($=R))break;Ft=K[F+$-1],At=K[F+$]}}while((G=Z[G&it])>N&&--C!=0);return $<=_.lookahead?$:_.lookahead}function _t(_){var G,j,R,C,F,$,V,N,K,it,Z=_.w_size;do{if(C=_.window_size-_.lookahead-_.strstart,_.strstart>=Z+(Z-q)){for(r.arraySet(_.window,_.window,Z,Z,0),_.match_start-=Z,_.strstart-=Z,_.block_start-=Z,G=j=_.hash_size;R=_.head[--G],_.head[G]=Z<=R?R-Z:0,--j;);for(G=j=Z;R=_.prev[--G],_.prev[G]=Z<=R?R-Z:0,--j;);C+=Z}if(_.strm.avail_in===0)break;if($=_.strm,V=_.window,N=_.strstart+_.lookahead,K=C,it=void 0,it=$.avail_in,K<it&&(it=K),j=it===0?0:($.avail_in-=it,r.arraySet(V,$.input,$.next_in,it,N),$.state.wrap===1?$.adler=h($.adler,V,it,N):$.state.wrap===2&&($.adler=l($.adler,V,it,N)),$.next_in+=it,$.total_in+=it,it),_.lookahead+=j,_.lookahead+_.insert>=D)for(F=_.strstart-_.insert,_.ins_h=_.window[F],_.ins_h=(_.ins_h<<_.hash_shift^_.window[F+1])&_.hash_mask;_.insert&&(_.ins_h=(_.ins_h<<_.hash_shift^_.window[F+D-1])&_.hash_mask,_.prev[F&_.w_mask]=_.head[_.ins_h],_.head[_.ins_h]=F,F++,_.insert--,!(_.lookahead+_.insert<D)););}while(_.lookahead<q&&_.strm.avail_in!==0)}function pt(_,G){for(var j,R;;){if(_.lookahead<q){if(_t(_),_.lookahead<q&&G===d)return y;if(_.lookahead===0)break}if(j=0,_.lookahead>=D&&(_.ins_h=(_.ins_h<<_.hash_shift^_.window[_.strstart+D-1])&_.hash_mask,j=_.prev[_.strstart&_.w_mask]=_.head[_.ins_h],_.head[_.ins_h]=_.strstart),j!==0&&_.strstart-j<=_.w_size-q&&(_.match_length=Y(_,j)),_.match_length>=D)if(R=a._tr_tally(_,_.strstart-_.match_start,_.match_length-D),_.lookahead-=_.match_length,_.match_length<=_.max_lazy_match&&_.lookahead>=D){for(_.match_length--;_.strstart++,_.ins_h=(_.ins_h<<_.hash_shift^_.window[_.strstart+D-1])&_.hash_mask,j=_.prev[_.strstart&_.w_mask]=_.head[_.ins_h],_.head[_.ins_h]=_.strstart,--_.match_length!=0;);_.strstart++}else _.strstart+=_.match_length,_.match_length=0,_.ins_h=_.window[_.strstart],_.ins_h=(_.ins_h<<_.hash_shift^_.window[_.strstart+1])&_.hash_mask;else R=a._tr_tally(_,0,_.window[_.strstart]),_.lookahead--,_.strstart++;if(R&&(O(_,!1),_.strm.avail_out===0))return y}return _.insert=_.strstart<D-1?_.strstart:D-1,G===p?(O(_,!0),_.strm.avail_out===0?rt:U):_.last_lit&&(O(_,!1),_.strm.avail_out===0)?y:H}function dt(_,G){for(var j,R,C;;){if(_.lookahead<q){if(_t(_),_.lookahead<q&&G===d)return y;if(_.lookahead===0)break}if(j=0,_.lookahead>=D&&(_.ins_h=(_.ins_h<<_.hash_shift^_.window[_.strstart+D-1])&_.hash_mask,j=_.prev[_.strstart&_.w_mask]=_.head[_.ins_h],_.head[_.ins_h]=_.strstart),_.prev_length=_.match_length,_.prev_match=_.match_start,_.match_length=D-1,j!==0&&_.prev_length<_.max_lazy_match&&_.strstart-j<=_.w_size-q&&(_.match_length=Y(_,j),_.match_length<=5&&(_.strategy===1||_.match_length===D&&4096<_.strstart-_.match_start)&&(_.match_length=D-1)),_.prev_length>=D&&_.match_length<=_.prev_length){for(C=_.strstart+_.lookahead-D,R=a._tr_tally(_,_.strstart-1-_.prev_match,_.prev_length-D),_.lookahead-=_.prev_length-1,_.prev_length-=2;++_.strstart<=C&&(_.ins_h=(_.ins_h<<_.hash_shift^_.window[_.strstart+D-1])&_.hash_mask,j=_.prev[_.strstart&_.w_mask]=_.head[_.ins_h],_.head[_.ins_h]=_.strstart),--_.prev_length!=0;);if(_.match_available=0,_.match_length=D-1,_.strstart++,R&&(O(_,!1),_.strm.avail_out===0))return y}else if(_.match_available){if((R=a._tr_tally(_,0,_.window[_.strstart-1]))&&O(_,!1),_.strstart++,_.lookahead--,_.strm.avail_out===0)return y}else _.match_available=1,_.strstart++,_.lookahead--}return _.match_available&&(R=a._tr_tally(_,0,_.window[_.strstart-1]),_.match_available=0),_.insert=_.strstart<D-1?_.strstart:D-1,G===p?(O(_,!0),_.strm.avail_out===0?rt:U):_.last_lit&&(O(_,!1),_.strm.avail_out===0)?y:H}function vt(_,G,j,R,C){this.good_length=_,this.max_lazy=G,this.nice_length=j,this.max_chain=R,this.func=C}function Wt(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=A,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new r.Buf16(2*I),this.dyn_dtree=new r.Buf16(2*(2*T+1)),this.bl_tree=new r.Buf16(2*(2*L+1)),ht(this.dyn_ltree),ht(this.dyn_dtree),ht(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new r.Buf16(B+1),this.heap=new r.Buf16(2*k+1),ht(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new r.Buf16(2*k+1),ht(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function Ot(_){var G;return _&&_.state?(_.total_in=_.total_out=0,_.data_type=b,(G=_.state).pending=0,G.pending_out=0,G.wrap<0&&(G.wrap=-G.wrap),G.status=G.wrap?P:z,_.adler=G.wrap===2?0:1,G.last_flush=d,a._tr_init(G),f):Q(_,g)}function We(_){var G=Ot(_);return G===f&&function(j){j.window_size=2*j.w_size,ht(j.head),j.max_lazy_match=n[j.level].max_lazy,j.good_match=n[j.level].good_length,j.nice_match=n[j.level].nice_length,j.max_chain_length=n[j.level].max_chain,j.strstart=0,j.block_start=0,j.lookahead=0,j.insert=0,j.match_length=j.prev_length=D-1,j.match_available=0,j.ins_h=0}(_.state),G}function Pe(_,G,j,R,C,F){if(!_)return g;var $=1;if(G===m&&(G=6),R<0?($=0,R=-R):15<R&&($=2,R-=16),C<1||x<C||j!==A||R<8||15<R||G<0||9<G||F<0||v<F)return Q(_,g);R===8&&(R=9);var V=new Wt;return(_.state=V).strm=_,V.wrap=$,V.gzhead=null,V.w_bits=R,V.w_size=1<<V.w_bits,V.w_mask=V.w_size-1,V.hash_bits=C+7,V.hash_size=1<<V.hash_bits,V.hash_mask=V.hash_size-1,V.hash_shift=~~((V.hash_bits+D-1)/D),V.window=new r.Buf8(2*V.w_size),V.head=new r.Buf16(V.hash_size),V.prev=new r.Buf16(V.w_size),V.lit_bufsize=1<<C+6,V.pending_buf_size=4*V.lit_bufsize,V.pending_buf=new r.Buf8(V.pending_buf_size),V.d_buf=1*V.lit_bufsize,V.l_buf=3*V.lit_bufsize,V.level=G,V.strategy=F,V.method=j,We(_)}n=[new vt(0,0,0,0,function(_,G){var j=65535;for(j>_.pending_buf_size-5&&(j=_.pending_buf_size-5);;){if(_.lookahead<=1){if(_t(_),_.lookahead===0&&G===d)return y;if(_.lookahead===0)break}_.strstart+=_.lookahead,_.lookahead=0;var R=_.block_start+j;if((_.strstart===0||_.strstart>=R)&&(_.lookahead=_.strstart-R,_.strstart=R,O(_,!1),_.strm.avail_out===0)||_.strstart-_.block_start>=_.w_size-q&&(O(_,!1),_.strm.avail_out===0))return y}return _.insert=0,G===p?(O(_,!0),_.strm.avail_out===0?rt:U):(_.strstart>_.block_start&&(O(_,!1),_.strm.avail_out),y)}),new vt(4,4,8,4,pt),new vt(4,5,16,8,pt),new vt(4,6,32,32,pt),new vt(4,4,16,16,dt),new vt(8,16,32,32,dt),new vt(8,16,128,128,dt),new vt(8,32,128,256,dt),new vt(32,128,258,1024,dt),new vt(32,258,258,4096,dt)],i.deflateInit=function(_,G){return Pe(_,G,A,15,8,0)},i.deflateInit2=Pe,i.deflateReset=We,i.deflateResetKeep=Ot,i.deflateSetHeader=function(_,G){return _&&_.state?_.state.wrap!==2?g:(_.state.gzhead=G,f):g},i.deflate=function(_,G){var j,R,C,F;if(!_||!_.state||5<G||G<0)return _?Q(_,g):g;if(R=_.state,!_.output||!_.input&&_.avail_in!==0||R.status===666&&G!==p)return Q(_,_.avail_out===0?-5:g);if(R.strm=_,j=R.last_flush,R.last_flush=G,R.status===P)if(R.wrap===2)_.adler=0,st(R,31),st(R,139),st(R,8),R.gzhead?(st(R,(R.gzhead.text?1:0)+(R.gzhead.hcrc?2:0)+(R.gzhead.extra?4:0)+(R.gzhead.name?8:0)+(R.gzhead.comment?16:0)),st(R,255&R.gzhead.time),st(R,R.gzhead.time>>8&255),st(R,R.gzhead.time>>16&255),st(R,R.gzhead.time>>24&255),st(R,R.level===9?2:2<=R.strategy||R.level<2?4:0),st(R,255&R.gzhead.os),R.gzhead.extra&&R.gzhead.extra.length&&(st(R,255&R.gzhead.extra.length),st(R,R.gzhead.extra.length>>8&255)),R.gzhead.hcrc&&(_.adler=l(_.adler,R.pending_buf,R.pending,0)),R.gzindex=0,R.status=69):(st(R,0),st(R,0),st(R,0),st(R,0),st(R,0),st(R,R.level===9?2:2<=R.strategy||R.level<2?4:0),st(R,3),R.status=z);else{var $=A+(R.w_bits-8<<4)<<8;$|=(2<=R.strategy||R.level<2?0:R.level<6?1:R.level===6?2:3)<<6,R.strstart!==0&&($|=32),$+=31-$%31,R.status=z,J(R,$),R.strstart!==0&&(J(R,_.adler>>>16),J(R,65535&_.adler)),_.adler=1}if(R.status===69)if(R.gzhead.extra){for(C=R.pending;R.gzindex<(65535&R.gzhead.extra.length)&&(R.pending!==R.pending_buf_size||(R.gzhead.hcrc&&R.pending>C&&(_.adler=l(_.adler,R.pending_buf,R.pending-C,C)),M(_),C=R.pending,R.pending!==R.pending_buf_size));)st(R,255&R.gzhead.extra[R.gzindex]),R.gzindex++;R.gzhead.hcrc&&R.pending>C&&(_.adler=l(_.adler,R.pending_buf,R.pending-C,C)),R.gzindex===R.gzhead.extra.length&&(R.gzindex=0,R.status=73)}else R.status=73;if(R.status===73)if(R.gzhead.name){C=R.pending;do{if(R.pending===R.pending_buf_size&&(R.gzhead.hcrc&&R.pending>C&&(_.adler=l(_.adler,R.pending_buf,R.pending-C,C)),M(_),C=R.pending,R.pending===R.pending_buf_size)){F=1;break}F=R.gzindex<R.gzhead.name.length?255&R.gzhead.name.charCodeAt(R.gzindex++):0,st(R,F)}while(F!==0);R.gzhead.hcrc&&R.pending>C&&(_.adler=l(_.adler,R.pending_buf,R.pending-C,C)),F===0&&(R.gzindex=0,R.status=91)}else R.status=91;if(R.status===91)if(R.gzhead.comment){C=R.pending;do{if(R.pending===R.pending_buf_size&&(R.gzhead.hcrc&&R.pending>C&&(_.adler=l(_.adler,R.pending_buf,R.pending-C,C)),M(_),C=R.pending,R.pending===R.pending_buf_size)){F=1;break}F=R.gzindex<R.gzhead.comment.length?255&R.gzhead.comment.charCodeAt(R.gzindex++):0,st(R,F)}while(F!==0);R.gzhead.hcrc&&R.pending>C&&(_.adler=l(_.adler,R.pending_buf,R.pending-C,C)),F===0&&(R.status=103)}else R.status=103;if(R.status===103&&(R.gzhead.hcrc?(R.pending+2>R.pending_buf_size&&M(_),R.pending+2<=R.pending_buf_size&&(st(R,255&_.adler),st(R,_.adler>>8&255),_.adler=0,R.status=z)):R.status=z),R.pending!==0){if(M(_),_.avail_out===0)return R.last_flush=-1,f}else if(_.avail_in===0&&X(G)<=X(j)&&G!==p)return Q(_,-5);if(R.status===666&&_.avail_in!==0)return Q(_,-5);if(_.avail_in!==0||R.lookahead!==0||G!==d&&R.status!==666){var V=R.strategy===2?function(N,K){for(var it;;){if(N.lookahead===0&&(_t(N),N.lookahead===0)){if(K===d)return y;break}if(N.match_length=0,it=a._tr_tally(N,0,N.window[N.strstart]),N.lookahead--,N.strstart++,it&&(O(N,!1),N.strm.avail_out===0))return y}return N.insert=0,K===p?(O(N,!0),N.strm.avail_out===0?rt:U):N.last_lit&&(O(N,!1),N.strm.avail_out===0)?y:H}(R,G):R.strategy===3?function(N,K){for(var it,Z,lt,Ft,At=N.window;;){if(N.lookahead<=W){if(_t(N),N.lookahead<=W&&K===d)return y;if(N.lookahead===0)break}if(N.match_length=0,N.lookahead>=D&&0<N.strstart&&(Z=At[lt=N.strstart-1])===At[++lt]&&Z===At[++lt]&&Z===At[++lt]){Ft=N.strstart+W;do;while(Z===At[++lt]&&Z===At[++lt]&&Z===At[++lt]&&Z===At[++lt]&&Z===At[++lt]&&Z===At[++lt]&&Z===At[++lt]&&Z===At[++lt]&<<Ft);N.match_length=W-(Ft-lt),N.match_length>N.lookahead&&(N.match_length=N.lookahead)}if(N.match_length>=D?(it=a._tr_tally(N,1,N.match_length-D),N.lookahead-=N.match_length,N.strstart+=N.match_length,N.match_length=0):(it=a._tr_tally(N,0,N.window[N.strstart]),N.lookahead--,N.strstart++),it&&(O(N,!1),N.strm.avail_out===0))return y}return N.insert=0,K===p?(O(N,!0),N.strm.avail_out===0?rt:U):N.last_lit&&(O(N,!1),N.strm.avail_out===0)?y:H}(R,G):n[R.level].func(R,G);if(V!==rt&&V!==U||(R.status=666),V===y||V===rt)return _.avail_out===0&&(R.last_flush=-1),f;if(V===H&&(G===1?a._tr_align(R):G!==5&&(a._tr_stored_block(R,0,0,!1),G===3&&(ht(R.head),R.lookahead===0&&(R.strstart=0,R.block_start=0,R.insert=0))),M(_),_.avail_out===0))return R.last_flush=-1,f}return G!==p?f:R.wrap<=0?1:(R.wrap===2?(st(R,255&_.adler),st(R,_.adler>>8&255),st(R,_.adler>>16&255),st(R,_.adler>>24&255),st(R,255&_.total_in),st(R,_.total_in>>8&255),st(R,_.total_in>>16&255),st(R,_.total_in>>24&255)):(J(R,_.adler>>>16),J(R,65535&_.adler)),M(_),0<R.wrap&&(R.wrap=-R.wrap),R.pending!==0?f:1)},i.deflateEnd=function(_){var G;return _&&_.state?(G=_.state.status)!==P&&G!==69&&G!==73&&G!==91&&G!==103&&G!==z&&G!==666?Q(_,g):(_.state=null,G===z?Q(_,-3):f):g},i.deflateSetDictionary=function(_,G){var j,R,C,F,$,V,N,K,it=G.length;if(!_||!_.state||(F=(j=_.state).wrap)===2||F===1&&j.status!==P||j.lookahead)return g;for(F===1&&(_.adler=h(_.adler,G,it,0)),j.wrap=0,it>=j.w_size&&(F===0&&(ht(j.head),j.strstart=0,j.block_start=0,j.insert=0),K=new r.Buf8(j.w_size),r.arraySet(K,G,it-j.w_size,j.w_size,0),G=K,it=j.w_size),$=_.avail_in,V=_.next_in,N=_.input,_.avail_in=it,_.next_in=0,_.input=G,_t(j);j.lookahead>=D;){for(R=j.strstart,C=j.lookahead-(D-1);j.ins_h=(j.ins_h<<j.hash_shift^j.window[R+D-1])&j.hash_mask,j.prev[R&j.w_mask]=j.head[j.ins_h],j.head[j.ins_h]=R,R++,--C;);j.strstart=R,j.lookahead=D-1,_t(j)}return j.strstart+=j.lookahead,j.block_start=j.strstart,j.insert=j.lookahead,j.lookahead=0,j.match_length=j.prev_length=D-1,j.match_available=0,_.next_in=V,_.input=N,_.avail_in=$,j.wrap=F,f},i.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./messages":51,"./trees":52}],47:[function(t,s,i){s.exports=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}},{}],48:[function(t,s,i){s.exports=function(n,r){var a,h,l,c,d,p,f,g,m,v,b,A,x,k,T,L,I,B,D,W,q,P,z,y,H;a=n.state,h=n.next_in,y=n.input,l=h+(n.avail_in-5),c=n.next_out,H=n.output,d=c-(r-n.avail_out),p=c+(n.avail_out-257),f=a.dmax,g=a.wsize,m=a.whave,v=a.wnext,b=a.window,A=a.hold,x=a.bits,k=a.lencode,T=a.distcode,L=(1<<a.lenbits)-1,I=(1<<a.distbits)-1;t:do{x<15&&(A+=y[h++]<<x,x+=8,A+=y[h++]<<x,x+=8),B=k[A&L];e:for(;;){if(A>>>=D=B>>>24,x-=D,(D=B>>>16&255)===0)H[c++]=65535&B;else{if(!(16&D)){if(!(64&D)){B=k[(65535&B)+(A&(1<<D)-1)];continue e}if(32&D){a.mode=12;break t}n.msg="invalid literal/length code",a.mode=30;break t}W=65535&B,(D&=15)&&(x<D&&(A+=y[h++]<<x,x+=8),W+=A&(1<<D)-1,A>>>=D,x-=D),x<15&&(A+=y[h++]<<x,x+=8,A+=y[h++]<<x,x+=8),B=T[A&I];s:for(;;){if(A>>>=D=B>>>24,x-=D,!(16&(D=B>>>16&255))){if(!(64&D)){B=T[(65535&B)+(A&(1<<D)-1)];continue s}n.msg="invalid distance code",a.mode=30;break t}if(q=65535&B,x<(D&=15)&&(A+=y[h++]<<x,(x+=8)<D&&(A+=y[h++]<<x,x+=8)),f<(q+=A&(1<<D)-1)){n.msg="invalid distance too far back",a.mode=30;break t}if(A>>>=D,x-=D,(D=c-d)<q){if(m<(D=q-D)&&a.sane){n.msg="invalid distance too far back",a.mode=30;break t}if(z=b,(P=0)===v){if(P+=g-D,D<W){for(W-=D;H[c++]=b[P++],--D;);P=c-q,z=H}}else if(v<D){if(P+=g+v-D,(D-=v)<W){for(W-=D;H[c++]=b[P++],--D;);if(P=0,v<W){for(W-=D=v;H[c++]=b[P++],--D;);P=c-q,z=H}}}else if(P+=v-D,D<W){for(W-=D;H[c++]=b[P++],--D;);P=c-q,z=H}for(;2<W;)H[c++]=z[P++],H[c++]=z[P++],H[c++]=z[P++],W-=3;W&&(H[c++]=z[P++],1<W&&(H[c++]=z[P++]))}else{for(P=c-q;H[c++]=H[P++],H[c++]=H[P++],H[c++]=H[P++],2<(W-=3););W&&(H[c++]=H[P++],1<W&&(H[c++]=H[P++]))}break}}break}}while(h<l&&c<p);h-=W=x>>3,A&=(1<<(x-=W<<3))-1,n.next_in=h,n.next_out=c,n.avail_in=h<l?l-h+5:5-(h-l),n.avail_out=c<p?p-c+257:257-(c-p),a.hold=A,a.bits=x}},{}],49:[function(t,s,i){var n=t("../utils/common"),r=t("./adler32"),a=t("./crc32"),h=t("./inffast"),l=t("./inftrees"),c=1,d=2,p=0,f=-2,g=1,m=852,v=592;function b(P){return(P>>>24&255)+(P>>>8&65280)+((65280&P)<<8)+((255&P)<<24)}function A(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new n.Buf16(320),this.work=new n.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function x(P){var z;return P&&P.state?(z=P.state,P.total_in=P.total_out=z.total=0,P.msg="",z.wrap&&(P.adler=1&z.wrap),z.mode=g,z.last=0,z.havedict=0,z.dmax=32768,z.head=null,z.hold=0,z.bits=0,z.lencode=z.lendyn=new n.Buf32(m),z.distcode=z.distdyn=new n.Buf32(v),z.sane=1,z.back=-1,p):f}function k(P){var z;return P&&P.state?((z=P.state).wsize=0,z.whave=0,z.wnext=0,x(P)):f}function T(P,z){var y,H;return P&&P.state?(H=P.state,z<0?(y=0,z=-z):(y=1+(z>>4),z<48&&(z&=15)),z&&(z<8||15<z)?f:(H.window!==null&&H.wbits!==z&&(H.window=null),H.wrap=y,H.wbits=z,k(P))):f}function L(P,z){var y,H;return P?(H=new A,(P.state=H).window=null,(y=T(P,z))!==p&&(P.state=null),y):f}var I,B,D=!0;function W(P){if(D){var z;for(I=new n.Buf32(512),B=new n.Buf32(32),z=0;z<144;)P.lens[z++]=8;for(;z<256;)P.lens[z++]=9;for(;z<280;)P.lens[z++]=7;for(;z<288;)P.lens[z++]=8;for(l(c,P.lens,0,288,I,0,P.work,{bits:9}),z=0;z<32;)P.lens[z++]=5;l(d,P.lens,0,32,B,0,P.work,{bits:5}),D=!1}P.lencode=I,P.lenbits=9,P.distcode=B,P.distbits=5}function q(P,z,y,H){var rt,U=P.state;return U.window===null&&(U.wsize=1<<U.wbits,U.wnext=0,U.whave=0,U.window=new n.Buf8(U.wsize)),H>=U.wsize?(n.arraySet(U.window,z,y-U.wsize,U.wsize,0),U.wnext=0,U.whave=U.wsize):(H<(rt=U.wsize-U.wnext)&&(rt=H),n.arraySet(U.window,z,y-H,rt,U.wnext),(H-=rt)?(n.arraySet(U.window,z,y-H,H,0),U.wnext=H,U.whave=U.wsize):(U.wnext+=rt,U.wnext===U.wsize&&(U.wnext=0),U.whave<U.wsize&&(U.whave+=rt))),0}i.inflateReset=k,i.inflateReset2=T,i.inflateResetKeep=x,i.inflateInit=function(P){return L(P,15)},i.inflateInit2=L,i.inflate=function(P,z){var y,H,rt,U,Q,X,ht,M,O,st,J,Y,_t,pt,dt,vt,Wt,Ot,We,Pe,_,G,j,R,C=0,F=new n.Buf8(4),$=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!P||!P.state||!P.output||!P.input&&P.avail_in!==0)return f;(y=P.state).mode===12&&(y.mode=13),Q=P.next_out,rt=P.output,ht=P.avail_out,U=P.next_in,H=P.input,X=P.avail_in,M=y.hold,O=y.bits,st=X,J=ht,G=p;t:for(;;)switch(y.mode){case g:if(y.wrap===0){y.mode=13;break}for(;O<16;){if(X===0)break t;X--,M+=H[U++]<<O,O+=8}if(2&y.wrap&&M===35615){F[y.check=0]=255&M,F[1]=M>>>8&255,y.check=a(y.check,F,2,0),O=M=0,y.mode=2;break}if(y.flags=0,y.head&&(y.head.done=!1),!(1&y.wrap)||(((255&M)<<8)+(M>>8))%31){P.msg="incorrect header check",y.mode=30;break}if((15&M)!=8){P.msg="unknown compression method",y.mode=30;break}if(O-=4,_=8+(15&(M>>>=4)),y.wbits===0)y.wbits=_;else if(_>y.wbits){P.msg="invalid window size",y.mode=30;break}y.dmax=1<<_,P.adler=y.check=1,y.mode=512&M?10:12,O=M=0;break;case 2:for(;O<16;){if(X===0)break t;X--,M+=H[U++]<<O,O+=8}if(y.flags=M,(255&y.flags)!=8){P.msg="unknown compression method",y.mode=30;break}if(57344&y.flags){P.msg="unknown header flags set",y.mode=30;break}y.head&&(y.head.text=M>>8&1),512&y.flags&&(F[0]=255&M,F[1]=M>>>8&255,y.check=a(y.check,F,2,0)),O=M=0,y.mode=3;case 3:for(;O<32;){if(X===0)break t;X--,M+=H[U++]<<O,O+=8}y.head&&(y.head.time=M),512&y.flags&&(F[0]=255&M,F[1]=M>>>8&255,F[2]=M>>>16&255,F[3]=M>>>24&255,y.check=a(y.check,F,4,0)),O=M=0,y.mode=4;case 4:for(;O<16;){if(X===0)break t;X--,M+=H[U++]<<O,O+=8}y.head&&(y.head.xflags=255&M,y.head.os=M>>8),512&y.flags&&(F[0]=255&M,F[1]=M>>>8&255,y.check=a(y.check,F,2,0)),O=M=0,y.mode=5;case 5:if(1024&y.flags){for(;O<16;){if(X===0)break t;X--,M+=H[U++]<<O,O+=8}y.length=M,y.head&&(y.head.extra_len=M),512&y.flags&&(F[0]=255&M,F[1]=M>>>8&255,y.check=a(y.check,F,2,0)),O=M=0}else y.head&&(y.head.extra=null);y.mode=6;case 6:if(1024&y.flags&&(X<(Y=y.length)&&(Y=X),Y&&(y.head&&(_=y.head.extra_len-y.length,y.head.extra||(y.head.extra=new Array(y.head.extra_len)),n.arraySet(y.head.extra,H,U,Y,_)),512&y.flags&&(y.check=a(y.check,H,Y,U)),X-=Y,U+=Y,y.length-=Y),y.length))break t;y.length=0,y.mode=7;case 7:if(2048&y.flags){if(X===0)break t;for(Y=0;_=H[U+Y++],y.head&&_&&y.length<65536&&(y.head.name+=String.fromCharCode(_)),_&&Y<X;);if(512&y.flags&&(y.check=a(y.check,H,Y,U)),X-=Y,U+=Y,_)break t}else y.head&&(y.head.name=null);y.length=0,y.mode=8;case 8:if(4096&y.flags){if(X===0)break t;for(Y=0;_=H[U+Y++],y.head&&_&&y.length<65536&&(y.head.comment+=String.fromCharCode(_)),_&&Y<X;);if(512&y.flags&&(y.check=a(y.check,H,Y,U)),X-=Y,U+=Y,_)break t}else y.head&&(y.head.comment=null);y.mode=9;case 9:if(512&y.flags){for(;O<16;){if(X===0)break t;X--,M+=H[U++]<<O,O+=8}if(M!==(65535&y.check)){P.msg="header crc mismatch",y.mode=30;break}O=M=0}y.head&&(y.head.hcrc=y.flags>>9&1,y.head.done=!0),P.adler=y.check=0,y.mode=12;break;case 10:for(;O<32;){if(X===0)break t;X--,M+=H[U++]<<O,O+=8}P.adler=y.check=b(M),O=M=0,y.mode=11;case 11:if(y.havedict===0)return P.next_out=Q,P.avail_out=ht,P.next_in=U,P.avail_in=X,y.hold=M,y.bits=O,2;P.adler=y.check=1,y.mode=12;case 12:if(z===5||z===6)break t;case 13:if(y.last){M>>>=7&O,O-=7&O,y.mode=27;break}for(;O<3;){if(X===0)break t;X--,M+=H[U++]<<O,O+=8}switch(y.last=1&M,O-=1,3&(M>>>=1)){case 0:y.mode=14;break;case 1:if(W(y),y.mode=20,z!==6)break;M>>>=2,O-=2;break t;case 2:y.mode=17;break;case 3:P.msg="invalid block type",y.mode=30}M>>>=2,O-=2;break;case 14:for(M>>>=7&O,O-=7&O;O<32;){if(X===0)break t;X--,M+=H[U++]<<O,O+=8}if((65535&M)!=(M>>>16^65535)){P.msg="invalid stored block lengths",y.mode=30;break}if(y.length=65535&M,O=M=0,y.mode=15,z===6)break t;case 15:y.mode=16;case 16:if(Y=y.length){if(X<Y&&(Y=X),ht<Y&&(Y=ht),Y===0)break t;n.arraySet(rt,H,U,Y,Q),X-=Y,U+=Y,ht-=Y,Q+=Y,y.length-=Y;break}y.mode=12;break;case 17:for(;O<14;){if(X===0)break t;X--,M+=H[U++]<<O,O+=8}if(y.nlen=257+(31&M),M>>>=5,O-=5,y.ndist=1+(31&M),M>>>=5,O-=5,y.ncode=4+(15&M),M>>>=4,O-=4,286<y.nlen||30<y.ndist){P.msg="too many length or distance symbols",y.mode=30;break}y.have=0,y.mode=18;case 18:for(;y.have<y.ncode;){for(;O<3;){if(X===0)break t;X--,M+=H[U++]<<O,O+=8}y.lens[$[y.have++]]=7&M,M>>>=3,O-=3}for(;y.have<19;)y.lens[$[y.have++]]=0;if(y.lencode=y.lendyn,y.lenbits=7,j={bits:y.lenbits},G=l(0,y.lens,0,19,y.lencode,0,y.work,j),y.lenbits=j.bits,G){P.msg="invalid code lengths set",y.mode=30;break}y.have=0,y.mode=19;case 19:for(;y.have<y.nlen+y.ndist;){for(;vt=(C=y.lencode[M&(1<<y.lenbits)-1])>>>16&255,Wt=65535&C,!((dt=C>>>24)<=O);){if(X===0)break t;X--,M+=H[U++]<<O,O+=8}if(Wt<16)M>>>=dt,O-=dt,y.lens[y.have++]=Wt;else{if(Wt===16){for(R=dt+2;O<R;){if(X===0)break t;X--,M+=H[U++]<<O,O+=8}if(M>>>=dt,O-=dt,y.have===0){P.msg="invalid bit length repeat",y.mode=30;break}_=y.lens[y.have-1],Y=3+(3&M),M>>>=2,O-=2}else if(Wt===17){for(R=dt+3;O<R;){if(X===0)break t;X--,M+=H[U++]<<O,O+=8}O-=dt,_=0,Y=3+(7&(M>>>=dt)),M>>>=3,O-=3}else{for(R=dt+7;O<R;){if(X===0)break t;X--,M+=H[U++]<<O,O+=8}O-=dt,_=0,Y=11+(127&(M>>>=dt)),M>>>=7,O-=7}if(y.have+Y>y.nlen+y.ndist){P.msg="invalid bit length repeat",y.mode=30;break}for(;Y--;)y.lens[y.have++]=_}}if(y.mode===30)break;if(y.lens[256]===0){P.msg="invalid code -- missing end-of-block",y.mode=30;break}if(y.lenbits=9,j={bits:y.lenbits},G=l(c,y.lens,0,y.nlen,y.lencode,0,y.work,j),y.lenbits=j.bits,G){P.msg="invalid literal/lengths set",y.mode=30;break}if(y.distbits=6,y.distcode=y.distdyn,j={bits:y.distbits},G=l(d,y.lens,y.nlen,y.ndist,y.distcode,0,y.work,j),y.distbits=j.bits,G){P.msg="invalid distances set",y.mode=30;break}if(y.mode=20,z===6)break t;case 20:y.mode=21;case 21:if(6<=X&&258<=ht){P.next_out=Q,P.avail_out=ht,P.next_in=U,P.avail_in=X,y.hold=M,y.bits=O,h(P,J),Q=P.next_out,rt=P.output,ht=P.avail_out,U=P.next_in,H=P.input,X=P.avail_in,M=y.hold,O=y.bits,y.mode===12&&(y.back=-1);break}for(y.back=0;vt=(C=y.lencode[M&(1<<y.lenbits)-1])>>>16&255,Wt=65535&C,!((dt=C>>>24)<=O);){if(X===0)break t;X--,M+=H[U++]<<O,O+=8}if(vt&&!(240&vt)){for(Ot=dt,We=vt,Pe=Wt;vt=(C=y.lencode[Pe+((M&(1<<Ot+We)-1)>>Ot)])>>>16&255,Wt=65535&C,!(Ot+(dt=C>>>24)<=O);){if(X===0)break t;X--,M+=H[U++]<<O,O+=8}M>>>=Ot,O-=Ot,y.back+=Ot}if(M>>>=dt,O-=dt,y.back+=dt,y.length=Wt,vt===0){y.mode=26;break}if(32&vt){y.back=-1,y.mode=12;break}if(64&vt){P.msg="invalid literal/length code",y.mode=30;break}y.extra=15&vt,y.mode=22;case 22:if(y.extra){for(R=y.extra;O<R;){if(X===0)break t;X--,M+=H[U++]<<O,O+=8}y.length+=M&(1<<y.extra)-1,M>>>=y.extra,O-=y.extra,y.back+=y.extra}y.was=y.length,y.mode=23;case 23:for(;vt=(C=y.distcode[M&(1<<y.distbits)-1])>>>16&255,Wt=65535&C,!((dt=C>>>24)<=O);){if(X===0)break t;X--,M+=H[U++]<<O,O+=8}if(!(240&vt)){for(Ot=dt,We=vt,Pe=Wt;vt=(C=y.distcode[Pe+((M&(1<<Ot+We)-1)>>Ot)])>>>16&255,Wt=65535&C,!(Ot+(dt=C>>>24)<=O);){if(X===0)break t;X--,M+=H[U++]<<O,O+=8}M>>>=Ot,O-=Ot,y.back+=Ot}if(M>>>=dt,O-=dt,y.back+=dt,64&vt){P.msg="invalid distance code",y.mode=30;break}y.offset=Wt,y.extra=15&vt,y.mode=24;case 24:if(y.extra){for(R=y.extra;O<R;){if(X===0)break t;X--,M+=H[U++]<<O,O+=8}y.offset+=M&(1<<y.extra)-1,M>>>=y.extra,O-=y.extra,y.back+=y.extra}if(y.offset>y.dmax){P.msg="invalid distance too far back",y.mode=30;break}y.mode=25;case 25:if(ht===0)break t;if(Y=J-ht,y.offset>Y){if((Y=y.offset-Y)>y.whave&&y.sane){P.msg="invalid distance too far back",y.mode=30;break}_t=Y>y.wnext?(Y-=y.wnext,y.wsize-Y):y.wnext-Y,Y>y.length&&(Y=y.length),pt=y.window}else pt=rt,_t=Q-y.offset,Y=y.length;for(ht<Y&&(Y=ht),ht-=Y,y.length-=Y;rt[Q++]=pt[_t++],--Y;);y.length===0&&(y.mode=21);break;case 26:if(ht===0)break t;rt[Q++]=y.length,ht--,y.mode=21;break;case 27:if(y.wrap){for(;O<32;){if(X===0)break t;X--,M|=H[U++]<<O,O+=8}if(J-=ht,P.total_out+=J,y.total+=J,J&&(P.adler=y.check=y.flags?a(y.check,rt,J,Q-J):r(y.check,rt,J,Q-J)),J=ht,(y.flags?M:b(M))!==y.check){P.msg="incorrect data check",y.mode=30;break}O=M=0}y.mode=28;case 28:if(y.wrap&&y.flags){for(;O<32;){if(X===0)break t;X--,M+=H[U++]<<O,O+=8}if(M!==(4294967295&y.total)){P.msg="incorrect length check",y.mode=30;break}O=M=0}y.mode=29;case 29:G=1;break t;case 30:G=-3;break t;case 31:return-4;case 32:default:return f}return P.next_out=Q,P.avail_out=ht,P.next_in=U,P.avail_in=X,y.hold=M,y.bits=O,(y.wsize||J!==P.avail_out&&y.mode<30&&(y.mode<27||z!==4))&&q(P,P.output,P.next_out,J-P.avail_out)?(y.mode=31,-4):(st-=P.avail_in,J-=P.avail_out,P.total_in+=st,P.total_out+=J,y.total+=J,y.wrap&&J&&(P.adler=y.check=y.flags?a(y.check,rt,J,P.next_out-J):r(y.check,rt,J,P.next_out-J)),P.data_type=y.bits+(y.last?64:0)+(y.mode===12?128:0)+(y.mode===20||y.mode===15?256:0),(st==0&&J===0||z===4)&&G===p&&(G=-5),G)},i.inflateEnd=function(P){if(!P||!P.state)return f;var z=P.state;return z.window&&(z.window=null),P.state=null,p},i.inflateGetHeader=function(P,z){var y;return P&&P.state&&2&(y=P.state).wrap?((y.head=z).done=!1,p):f},i.inflateSetDictionary=function(P,z){var y,H=z.length;return P&&P.state?(y=P.state).wrap!==0&&y.mode!==11?f:y.mode===11&&r(1,z,H,0)!==y.check?-3:q(P,z,H,H)?(y.mode=31,-4):(y.havedict=1,p):f},i.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./inffast":48,"./inftrees":50}],50:[function(t,s,i){var n=t("../utils/common"),r=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],a=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],h=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],l=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];s.exports=function(c,d,p,f,g,m,v,b){var A,x,k,T,L,I,B,D,W,q=b.bits,P=0,z=0,y=0,H=0,rt=0,U=0,Q=0,X=0,ht=0,M=0,O=null,st=0,J=new n.Buf16(16),Y=new n.Buf16(16),_t=null,pt=0;for(P=0;P<=15;P++)J[P]=0;for(z=0;z<f;z++)J[d[p+z]]++;for(rt=q,H=15;1<=H&&J[H]===0;H--);if(H<rt&&(rt=H),H===0)return g[m++]=20971520,g[m++]=20971520,b.bits=1,0;for(y=1;y<H&&J[y]===0;y++);for(rt<y&&(rt=y),P=X=1;P<=15;P++)if(X<<=1,(X-=J[P])<0)return-1;if(0<X&&(c===0||H!==1))return-1;for(Y[1]=0,P=1;P<15;P++)Y[P+1]=Y[P]+J[P];for(z=0;z<f;z++)d[p+z]!==0&&(v[Y[d[p+z]]++]=z);if(I=c===0?(O=_t=v,19):c===1?(O=r,st-=257,_t=a,pt-=257,256):(O=h,_t=l,-1),P=y,L=m,Q=z=M=0,k=-1,T=(ht=1<<(U=rt))-1,c===1&&852<ht||c===2&&592<ht)return 1;for(;;){for(B=P-Q,W=v[z]<I?(D=0,v[z]):v[z]>I?(D=_t[pt+v[z]],O[st+v[z]]):(D=96,0),A=1<<P-Q,y=x=1<<U;g[L+(M>>Q)+(x-=A)]=B<<24|D<<16|W|0,x!==0;);for(A=1<<P-1;M&A;)A>>=1;if(A!==0?(M&=A-1,M+=A):M=0,z++,--J[P]==0){if(P===H)break;P=d[p+v[z]]}if(rt<P&&(M&T)!==k){for(Q===0&&(Q=rt),L+=y,X=1<<(U=P-Q);U+Q<H&&!((X-=J[U+Q])<=0);)U++,X<<=1;if(ht+=1<<U,c===1&&852<ht||c===2&&592<ht)return 1;g[k=M&T]=rt<<24|U<<16|L-m|0}}return M!==0&&(g[L+M]=P-Q<<24|64<<16|0),b.bits=rt,0}},{"../utils/common":41}],51:[function(t,s,i){s.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],52:[function(t,s,i){var n=t("../utils/common"),r=0,a=1;function h(C){for(var F=C.length;0<=--F;)C[F]=0}var l=0,c=29,d=256,p=d+1+c,f=30,g=19,m=2*p+1,v=15,b=16,A=7,x=256,k=16,T=17,L=18,I=[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],B=[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],D=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],W=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],q=new Array(2*(p+2));h(q);var P=new Array(2*f);h(P);var z=new Array(512);h(z);var y=new Array(256);h(y);var H=new Array(c);h(H);var rt,U,Q,X=new Array(f);function ht(C,F,$,V,N){this.static_tree=C,this.extra_bits=F,this.extra_base=$,this.elems=V,this.max_length=N,this.has_stree=C&&C.length}function M(C,F){this.dyn_tree=C,this.max_code=0,this.stat_desc=F}function O(C){return C<256?z[C]:z[256+(C>>>7)]}function st(C,F){C.pending_buf[C.pending++]=255&F,C.pending_buf[C.pending++]=F>>>8&255}function J(C,F,$){C.bi_valid>b-$?(C.bi_buf|=F<<C.bi_valid&65535,st(C,C.bi_buf),C.bi_buf=F>>b-C.bi_valid,C.bi_valid+=$-b):(C.bi_buf|=F<<C.bi_valid&65535,C.bi_valid+=$)}function Y(C,F,$){J(C,$[2*F],$[2*F+1])}function _t(C,F){for(var $=0;$|=1&C,C>>>=1,$<<=1,0<--F;);return $>>>1}function pt(C,F,$){var V,N,K=new Array(v+1),it=0;for(V=1;V<=v;V++)K[V]=it=it+$[V-1]<<1;for(N=0;N<=F;N++){var Z=C[2*N+1];Z!==0&&(C[2*N]=_t(K[Z]++,Z))}}function dt(C){var F;for(F=0;F<p;F++)C.dyn_ltree[2*F]=0;for(F=0;F<f;F++)C.dyn_dtree[2*F]=0;for(F=0;F<g;F++)C.bl_tree[2*F]=0;C.dyn_ltree[2*x]=1,C.opt_len=C.static_len=0,C.last_lit=C.matches=0}function vt(C){8<C.bi_valid?st(C,C.bi_buf):0<C.bi_valid&&(C.pending_buf[C.pending++]=C.bi_buf),C.bi_buf=0,C.bi_valid=0}function Wt(C,F,$,V){var N=2*F,K=2*$;return C[N]<C[K]||C[N]===C[K]&&V[F]<=V[$]}function Ot(C,F,$){for(var V=C.heap[$],N=$<<1;N<=C.heap_len&&(N<C.heap_len&&Wt(F,C.heap[N+1],C.heap[N],C.depth)&&N++,!Wt(F,V,C.heap[N],C.depth));)C.heap[$]=C.heap[N],$=N,N<<=1;C.heap[$]=V}function We(C,F,$){var V,N,K,it,Z=0;if(C.last_lit!==0)for(;V=C.pending_buf[C.d_buf+2*Z]<<8|C.pending_buf[C.d_buf+2*Z+1],N=C.pending_buf[C.l_buf+Z],Z++,V===0?Y(C,N,F):(Y(C,(K=y[N])+d+1,F),(it=I[K])!==0&&J(C,N-=H[K],it),Y(C,K=O(--V),$),(it=B[K])!==0&&J(C,V-=X[K],it)),Z<C.last_lit;);Y(C,x,F)}function Pe(C,F){var $,V,N,K=F.dyn_tree,it=F.stat_desc.static_tree,Z=F.stat_desc.has_stree,lt=F.stat_desc.elems,Ft=-1;for(C.heap_len=0,C.heap_max=m,$=0;$<lt;$++)K[2*$]!==0?(C.heap[++C.heap_len]=Ft=$,C.depth[$]=0):K[2*$+1]=0;for(;C.heap_len<2;)K[2*(N=C.heap[++C.heap_len]=Ft<2?++Ft:0)]=1,C.depth[N]=0,C.opt_len--,Z&&(C.static_len-=it[2*N+1]);for(F.max_code=Ft,$=C.heap_len>>1;1<=$;$--)Ot(C,K,$);for(N=lt;$=C.heap[1],C.heap[1]=C.heap[C.heap_len--],Ot(C,K,1),V=C.heap[1],C.heap[--C.heap_max]=$,C.heap[--C.heap_max]=V,K[2*N]=K[2*$]+K[2*V],C.depth[N]=(C.depth[$]>=C.depth[V]?C.depth[$]:C.depth[V])+1,K[2*$+1]=K[2*V+1]=N,C.heap[1]=N++,Ot(C,K,1),2<=C.heap_len;);C.heap[--C.heap_max]=C.heap[1],function(At,Ge){var da,gs,ua,Ht,Ah,zl,Ns=Ge.dyn_tree,Sd=Ge.max_code,Jf=Ge.stat_desc.static_tree,tp=Ge.stat_desc.has_stree,ep=Ge.stat_desc.extra_bits,xd=Ge.stat_desc.extra_base,fa=Ge.stat_desc.max_length,wh=0;for(Ht=0;Ht<=v;Ht++)At.bl_count[Ht]=0;for(Ns[2*At.heap[At.heap_max]+1]=0,da=At.heap_max+1;da<m;da++)fa<(Ht=Ns[2*Ns[2*(gs=At.heap[da])+1]+1]+1)&&(Ht=fa,wh++),Ns[2*gs+1]=Ht,Sd<gs||(At.bl_count[Ht]++,Ah=0,xd<=gs&&(Ah=ep[gs-xd]),zl=Ns[2*gs],At.opt_len+=zl*(Ht+Ah),tp&&(At.static_len+=zl*(Jf[2*gs+1]+Ah)));if(wh!==0){do{for(Ht=fa-1;At.bl_count[Ht]===0;)Ht--;At.bl_count[Ht]--,At.bl_count[Ht+1]+=2,At.bl_count[fa]--,wh-=2}while(0<wh);for(Ht=fa;Ht!==0;Ht--)for(gs=At.bl_count[Ht];gs!==0;)Sd<(ua=At.heap[--da])||(Ns[2*ua+1]!==Ht&&(At.opt_len+=(Ht-Ns[2*ua+1])*Ns[2*ua],Ns[2*ua+1]=Ht),gs--)}}(C,F),pt(K,Ft,C.bl_count)}function _(C,F,$){var V,N,K=-1,it=F[1],Z=0,lt=7,Ft=4;for(it===0&&(lt=138,Ft=3),F[2*($+1)+1]=65535,V=0;V<=$;V++)N=it,it=F[2*(V+1)+1],++Z<lt&&N===it||(Z<Ft?C.bl_tree[2*N]+=Z:N!==0?(N!==K&&C.bl_tree[2*N]++,C.bl_tree[2*k]++):Z<=10?C.bl_tree[2*T]++:C.bl_tree[2*L]++,K=N,Ft=(Z=0)===it?(lt=138,3):N===it?(lt=6,3):(lt=7,4))}function G(C,F,$){var V,N,K=-1,it=F[1],Z=0,lt=7,Ft=4;for(it===0&&(lt=138,Ft=3),V=0;V<=$;V++)if(N=it,it=F[2*(V+1)+1],!(++Z<lt&&N===it)){if(Z<Ft)for(;Y(C,N,C.bl_tree),--Z!=0;);else N!==0?(N!==K&&(Y(C,N,C.bl_tree),Z--),Y(C,k,C.bl_tree),J(C,Z-3,2)):Z<=10?(Y(C,T,C.bl_tree),J(C,Z-3,3)):(Y(C,L,C.bl_tree),J(C,Z-11,7));K=N,Ft=(Z=0)===it?(lt=138,3):N===it?(lt=6,3):(lt=7,4)}}h(X);var j=!1;function R(C,F,$,V){J(C,(l<<1)+(V?1:0),3),function(N,K,it,Z){vt(N),st(N,it),st(N,~it),n.arraySet(N.pending_buf,N.window,K,it,N.pending),N.pending+=it}(C,F,$)}i._tr_init=function(C){j||(function(){var F,$,V,N,K,it=new Array(v+1);for(N=V=0;N<c-1;N++)for(H[N]=V,F=0;F<1<<I[N];F++)y[V++]=N;for(y[V-1]=N,N=K=0;N<16;N++)for(X[N]=K,F=0;F<1<<B[N];F++)z[K++]=N;for(K>>=7;N<f;N++)for(X[N]=K<<7,F=0;F<1<<B[N]-7;F++)z[256+K++]=N;for($=0;$<=v;$++)it[$]=0;for(F=0;F<=143;)q[2*F+1]=8,F++,it[8]++;for(;F<=255;)q[2*F+1]=9,F++,it[9]++;for(;F<=279;)q[2*F+1]=7,F++,it[7]++;for(;F<=287;)q[2*F+1]=8,F++,it[8]++;for(pt(q,p+1,it),F=0;F<f;F++)P[2*F+1]=5,P[2*F]=_t(F,5);rt=new ht(q,I,d+1,p,v),U=new ht(P,B,0,f,v),Q=new ht(new Array(0),D,0,g,A)}(),j=!0),C.l_desc=new M(C.dyn_ltree,rt),C.d_desc=new M(C.dyn_dtree,U),C.bl_desc=new M(C.bl_tree,Q),C.bi_buf=0,C.bi_valid=0,dt(C)},i._tr_stored_block=R,i._tr_flush_block=function(C,F,$,V){var N,K,it=0;0<C.level?(C.strm.data_type===2&&(C.strm.data_type=function(Z){var lt,Ft=4093624447;for(lt=0;lt<=31;lt++,Ft>>>=1)if(1&Ft&&Z.dyn_ltree[2*lt]!==0)return r;if(Z.dyn_ltree[18]!==0||Z.dyn_ltree[20]!==0||Z.dyn_ltree[26]!==0)return a;for(lt=32;lt<d;lt++)if(Z.dyn_ltree[2*lt]!==0)return a;return r}(C)),Pe(C,C.l_desc),Pe(C,C.d_desc),it=function(Z){var lt;for(_(Z,Z.dyn_ltree,Z.l_desc.max_code),_(Z,Z.dyn_dtree,Z.d_desc.max_code),Pe(Z,Z.bl_desc),lt=g-1;3<=lt&&Z.bl_tree[2*W[lt]+1]===0;lt--);return Z.opt_len+=3*(lt+1)+5+5+4,lt}(C),N=C.opt_len+3+7>>>3,(K=C.static_len+3+7>>>3)<=N&&(N=K)):N=K=$+5,$+4<=N&&F!==-1?R(C,F,$,V):C.strategy===4||K===N?(J(C,2+(V?1:0),3),We(C,q,P)):(J(C,4+(V?1:0),3),function(Z,lt,Ft,At){var Ge;for(J(Z,lt-257,5),J(Z,Ft-1,5),J(Z,At-4,4),Ge=0;Ge<At;Ge++)J(Z,Z.bl_tree[2*W[Ge]+1],3);G(Z,Z.dyn_ltree,lt-1),G(Z,Z.dyn_dtree,Ft-1)}(C,C.l_desc.max_code+1,C.d_desc.max_code+1,it+1),We(C,C.dyn_ltree,C.dyn_dtree)),dt(C),V&&vt(C)},i._tr_tally=function(C,F,$){return C.pending_buf[C.d_buf+2*C.last_lit]=F>>>8&255,C.pending_buf[C.d_buf+2*C.last_lit+1]=255&F,C.pending_buf[C.l_buf+C.last_lit]=255&$,C.last_lit++,F===0?C.dyn_ltree[2*$]++:(C.matches++,F--,C.dyn_ltree[2*(y[$]+d+1)]++,C.dyn_dtree[2*O(F)]++),C.last_lit===C.lit_bufsize-1},i._tr_align=function(C){J(C,2,3),Y(C,x,q),function(F){F.bi_valid===16?(st(F,F.bi_buf),F.bi_buf=0,F.bi_valid=0):8<=F.bi_valid&&(F.pending_buf[F.pending++]=255&F.bi_buf,F.bi_buf>>=8,F.bi_valid-=8)}(C)}},{"../utils/common":41}],53:[function(t,s,i){s.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(t,s,i){(function(n){(function(r,a){if(!r.setImmediate){var h,l,c,d,p=1,f={},g=!1,m=r.document,v=Object.getPrototypeOf&&Object.getPrototypeOf(r);v=v&&v.setTimeout?v:r,h={}.toString.call(r.process)==="[object process]"?function(k){process.nextTick(function(){A(k)})}:function(){if(r.postMessage&&!r.importScripts){var k=!0,T=r.onmessage;return r.onmessage=function(){k=!1},r.postMessage("","*"),r.onmessage=T,k}}()?(d="setImmediate$"+Math.random()+"$",r.addEventListener?r.addEventListener("message",x,!1):r.attachEvent("onmessage",x),function(k){r.postMessage(d+k,"*")}):r.MessageChannel?((c=new MessageChannel).port1.onmessage=function(k){A(k.data)},function(k){c.port2.postMessage(k)}):m&&"onreadystatechange"in m.createElement("script")?(l=m.documentElement,function(k){var T=m.createElement("script");T.onreadystatechange=function(){A(k),T.onreadystatechange=null,l.removeChild(T),T=null},l.appendChild(T)}):function(k){setTimeout(A,0,k)},v.setImmediate=function(k){typeof k!="function"&&(k=new Function(""+k));for(var T=new Array(arguments.length-1),L=0;L<T.length;L++)T[L]=arguments[L+1];var I={callback:k,args:T};return f[p]=I,h(p),p++},v.clearImmediate=b}function b(k){delete f[k]}function A(k){if(g)setTimeout(A,0,k);else{var T=f[k];if(T){g=!0;try{(function(L){var I=L.callback,B=L.args;switch(B.length){case 0:I();break;case 1:I(B[0]);break;case 2:I(B[0],B[1]);break;case 3:I(B[0],B[1],B[2]);break;default:I.apply(a,B)}})(T)}finally{b(k),g=!1}}}}function x(k){k.source===r&&typeof k.data=="string"&&k.data.indexOf(d)===0&&A(+k.data.slice(d.length))}})(typeof self>"u"?n===void 0?this:n:self)}).call(this,typeof Eh<"u"?Eh:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(Lp);var dr;(function(u){u.OfficeDocument="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument",u.FontTable="http://schemas.openxmlformats.org/officeDocument/2006/relationships/fontTable",u.Image="http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",u.Numbering="http://schemas.openxmlformats.org/officeDocument/2006/relationships/numbering",u.Styles="http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles",u.StylesWithEffects="http://schemas.microsoft.com/office/2007/relationships/stylesWithEffects",u.Theme="http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme",u.Settings="http://schemas.openxmlformats.org/officeDocument/2006/relationships/settings",u.WebSettings="http://schemas.openxmlformats.org/officeDocument/2006/relationships/webSettings",u.Hyperlink="http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink",u.Footnotes="http://schemas.openxmlformats.org/officeDocument/2006/relationships/footnotes",u.Endnotes="http://schemas.openxmlformats.org/officeDocument/2006/relationships/endnotes",u.Footer="http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer",u.Header="http://schemas.openxmlformats.org/officeDocument/2006/relationships/header",u.ExtendedProperties="http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties",u.CoreProperties="http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties",u.CustomProperties="http://schemas.openxmlformats.org/package/2006/relationships/metadata/custom-properties",u.Comments="http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments",u.CommentsExtended="http://schemas.microsoft.com/office/2011/relationships/commentsExtended"})(dr||(dr={}));var Id;(function(u){u.Continuous="continuous",u.NextPage="nextPage",u.NextColumn="nextColumn",u.EvenPage="evenPage",u.OddPage="oddPage"})(Id||(Id={}));var Lt;(function(u){u.Document="document",u.Paragraph="paragraph",u.Run="run",u.Break="break",u.NoBreakHyphen="noBreakHyphen",u.Table="table",u.Row="row",u.Cell="cell",u.Hyperlink="hyperlink",u.SmartTag="smartTag",u.Drawing="drawing",u.Image="image",u.Text="text",u.Tab="tab",u.Symbol="symbol",u.BookmarkStart="bookmarkStart",u.BookmarkEnd="bookmarkEnd",u.Footer="footer",u.Header="header",u.FootnoteReference="footnoteReference",u.EndnoteReference="endnoteReference",u.Footnote="footnote",u.Endnote="endnote",u.SimpleField="simpleField",u.ComplexField="complexField",u.Instruction="instruction",u.VmlPicture="vmlPicture",u.MmlMath="mmlMath",u.MmlMathParagraph="mmlMathParagraph",u.MmlFraction="mmlFraction",u.MmlFunction="mmlFunction",u.MmlFunctionName="mmlFunctionName",u.MmlNumerator="mmlNumerator",u.MmlDenominator="mmlDenominator",u.MmlRadical="mmlRadical",u.MmlBase="mmlBase",u.MmlDegree="mmlDegree",u.MmlSuperscript="mmlSuperscript",u.MmlSubscript="mmlSubscript",u.MmlPreSubSuper="mmlPreSubSuper",u.MmlSubArgument="mmlSubArgument",u.MmlSuperArgument="mmlSuperArgument",u.MmlNary="mmlNary",u.MmlDelimiter="mmlDelimiter",u.MmlRun="mmlRun",u.MmlEquationArray="mmlEquationArray",u.MmlLimit="mmlLimit",u.MmlLimitLower="mmlLimitLower",u.MmlMatrix="mmlMatrix",u.MmlMatrixRow="mmlMatrixRow",u.MmlBox="mmlBox",u.MmlBar="mmlBar",u.MmlGroupChar="mmlGroupChar",u.VmlElement="vmlElement",u.Inserted="inserted",u.Deleted="deleted",u.DeletedText="deletedText",u.Comment="comment",u.CommentReference="commentReference",u.CommentRangeStart="commentRangeStart",u.CommentRangeEnd="commentRangeEnd"})(Lt||(Lt={}));dr.OfficeDocument,dr.ExtendedProperties,dr.CoreProperties,dr.CustomProperties;Lt.MmlMath,Lt.MmlMathParagraph,Lt.MmlFraction,Lt.MmlFunction,Lt.MmlFunctionName,Lt.MmlNumerator,Lt.MmlDenominator,Lt.MmlRadical,Lt.MmlDegree,Lt.MmlBase,Lt.MmlSuperscript,Lt.MmlSubscript,Lt.MmlPreSubSuper,Lt.MmlSuperArgument,Lt.MmlSubArgument,Lt.MmlDelimiter,Lt.MmlNary,Lt.MmlEquationArray,Lt.MmlLimit,Lt.MmlLimitLower,Lt.MmlMatrix,Lt.MmlMatrixRow,Lt.MmlBox,Lt.MmlBar,Lt.MmlGroupChar;var Fa={};Fa.d=(u,e)=>{for(var t in e)Fa.o(e,t)&&!Fa.o(u,t)&&Object.defineProperty(u,t,{enumerable:!0,get:e[t]})};Fa.o=(u,e)=>Object.prototype.hasOwnProperty.call(u,e);var ct=globalThis.pdfjsLib={};Fa.d(ct,{AbortException:()=>ir,AnnotationEditorLayer:()=>id,AnnotationEditorParamsType:()=>ut,AnnotationEditorType:()=>wt,AnnotationEditorUIManager:()=>Qn,AnnotationLayer:()=>Rm,AnnotationMode:()=>Si,CMapCompressionType:()=>Yl,ColorPicker:()=>hl,DOMSVGFactory:()=>ud,DrawLayer:()=>od,FeatureTest:()=>ke,GlobalWorkerOptions:()=>gi,ImageKind:()=>Lh,InvalidPDFException:()=>iu,MissingPDFException:()=>sr,OPS:()=>es,Outliner:()=>Bc,PDFDataRangeTransport:()=>Qu,PDFDateString:()=>cu,PDFWorker:()=>pr,PasswordResponses:()=>Dp,PermissionFlag:()=>Fp,PixelsPerInch:()=>Vi,RenderingCancelledException:()=>fd,TextLayer:()=>ca,UnexpectedResponseException:()=>Il,Util:()=>at,VerbosityLevel:()=>Rl,XfaLayer:()=>tf,build:()=>lm,createValidAbsoluteUrl:()=>zp,fetchData:()=>Nl,getDocument:()=>tm,getFilenameFromUrl:()=>Yp,getPdfFilenameFromUrl:()=>Kp,getXfaPageViewport:()=>Zp,isDataScheme:()=>pd,isPdfFile:()=>gd,noContextMenu:()=>Re,normalizeUnicode:()=>$p,renderTextLayer:()=>$g,setLayerDimensions:()=>Zn,shadow:()=>Et,updateTextLayer:()=>Vg,version:()=>hm});const me=typeof process=="object"&&process+""=="[object process]"&&!process.versions.nw&&!(process.versions.electron&&process.type&&process.type!=="browser"),su=[1,0,0,1,0,0],Xl=[.001,0,0,.001,0,0],Ip=1e7,jl=1.35,Ke={ANY:1,DISPLAY:2,PRINT:4,SAVE:8,ANNOTATIONS_FORMS:16,ANNOTATIONS_STORAGE:32,ANNOTATIONS_DISABLE:64,OPLIST:256},Si={DISABLE:0,ENABLE:1,ENABLE_FORMS:2,ENABLE_STORAGE:3},Mp="pdfjs_internal_editor_",wt={DISABLE:-1,NONE:0,FREETEXT:3,HIGHLIGHT:9,STAMP:13,INK:15},ut={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_DEFAULT_COLOR:32,HIGHLIGHT_THICKNESS:33,HIGHLIGHT_FREE:34,HIGHLIGHT_SHOW_ALL:35},Fp={PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048},de={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},Lh={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3},qt={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},ga={SOLID:1,DASHED:2,BEVELED:3,INSET:4,UNDERLINE:5},Rl={ERRORS:0,WARNINGS:1,INFOS:5},Yl={NONE:0,BINARY:1},es={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},Dp={NEED_PASSWORD:1,INCORRECT_PASSWORD:2};let Pl=Rl.WARNINGS;function Op(u){Number.isInteger(u)&&(Pl=u)}function Np(){return Pl}function Ll(u){Pl>=Rl.INFOS&&console.log(`Info: ${u}`)}function gt(u){Pl>=Rl.WARNINGS&&console.log(`Warning: ${u}`)}function Rt(u){throw new Error(u)}function Qt(u,e){u||Rt(e)}function Bp(u){switch(u==null?void 0:u.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":return!0;default:return!1}}function zp(u,e=null,t=null){if(!u)return null;try{if(t&&typeof u=="string"){if(t.addDefaultProtocol&&u.startsWith("www.")){const i=u.match(/\./g);(i==null?void 0:i.length)>=2&&(u=`http://${u}`)}if(t.tryConvertEncoding)try{u=Gp(u)}catch{}}const s=e?new URL(u,e):new URL(u);if(Bp(s))return s}catch{}return null}function Et(u,e,t,s=!1){return Object.defineProperty(u,e,{value:t,enumerable:!s,configurable:!0,writable:!1}),t}const Yi=function(){function e(t,s){this.constructor===e&&Rt("Cannot initialize BaseException."),this.message=t,this.name=s}return e.prototype=new Error,e.constructor=e,e}();class Kl extends Yi{constructor(e,t){super(e,"PasswordException"),this.code=t}}class Zl extends Yi{constructor(e,t){super(e,"UnknownErrorException"),this.details=t}}class iu extends Yi{constructor(e){super(e,"InvalidPDFException")}}class sr extends Yi{constructor(e){super(e,"MissingPDFException")}}class Il extends Yi{constructor(e,t){super(e,"UnexpectedResponseException"),this.status=t}}class Hp extends Yi{constructor(e){super(e,"FormatError")}}class ir extends Yi{constructor(e){super(e,"AbortException")}}function nu(u){(typeof u!="object"||(u==null?void 0:u.length)===void 0)&&Rt("Invalid argument for bytesToString");const e=u.length,t=8192;if(e<t)return String.fromCharCode.apply(null,u);const s=[];for(let i=0;i<e;i+=t){const n=Math.min(i+t,e),r=u.subarray(i,n);s.push(String.fromCharCode.apply(null,r))}return s.join("")}function Ml(u){typeof u!="string"&&Rt("Invalid argument for stringToBytes");const e=u.length,t=new Uint8Array(e);for(let s=0;s<e;++s)t[s]=u.charCodeAt(s)&255;return t}function Up(u){return String.fromCharCode(u>>24&255,u>>16&255,u>>8&255,u&255)}function cd(u){const e=Object.create(null);for(const[t,s]of u)e[t]=s;return e}function jp(){const u=new Uint8Array(4);return u[0]=1,new Uint32Array(u.buffer,0,1)[0]===1}function Wp(){try{return new Function(""),!0}catch{return!1}}class ke{static get isLittleEndian(){return Et(this,"isLittleEndian",jp())}static get isEvalSupported(){return Et(this,"isEvalSupported",Wp())}static get isOffscreenCanvasSupported(){return Et(this,"isOffscreenCanvasSupported",typeof OffscreenCanvas<"u")}static get platform(){return typeof navigator<"u"&&typeof(navigator==null?void 0:navigator.platform)=="string"?Et(this,"platform",{isMac:navigator.platform.includes("Mac")}):Et(this,"platform",{isMac:!1})}static get isCSSRoundSupported(){var e,t;return Et(this,"isCSSRoundSupported",(t=(e=globalThis.CSS)==null?void 0:e.supports)==null?void 0:t.call(e,"width: round(1.5px, 1px)"))}}const Wl=Array.from(Array(256).keys(),u=>u.toString(16).padStart(2,"0"));var bi,Ih,Ql;class at{static makeHexColor(e,t,s){return`#${Wl[e]}${Wl[t]}${Wl[s]}`}static scaleMinMax(e,t){let s;e[0]?(e[0]<0&&(s=t[0],t[0]=t[2],t[2]=s),t[0]*=e[0],t[2]*=e[0],e[3]<0&&(s=t[1],t[1]=t[3],t[3]=s),t[1]*=e[3],t[3]*=e[3]):(s=t[0],t[0]=t[1],t[1]=s,s=t[2],t[2]=t[3],t[3]=s,e[1]<0&&(s=t[1],t[1]=t[3],t[3]=s),t[1]*=e[1],t[3]*=e[1],e[2]<0&&(s=t[0],t[0]=t[2],t[2]=s),t[0]*=e[2],t[2]*=e[2]),t[0]+=e[4],t[1]+=e[5],t[2]+=e[4],t[3]+=e[5]}static transform(e,t){return[e[0]*t[0]+e[2]*t[1],e[1]*t[0]+e[3]*t[1],e[0]*t[2]+e[2]*t[3],e[1]*t[2]+e[3]*t[3],e[0]*t[4]+e[2]*t[5]+e[4],e[1]*t[4]+e[3]*t[5]+e[5]]}static applyTransform(e,t){const s=e[0]*t[0]+e[1]*t[2]+t[4],i=e[0]*t[1]+e[1]*t[3]+t[5];return[s,i]}static applyInverseTransform(e,t){const s=t[0]*t[3]-t[1]*t[2],i=(e[0]*t[3]-e[1]*t[2]+t[2]*t[5]-t[4]*t[3])/s,n=(-e[0]*t[1]+e[1]*t[0]+t[4]*t[1]-t[5]*t[0])/s;return[i,n]}static getAxialAlignedBoundingBox(e,t){const s=this.applyTransform(e,t),i=this.applyTransform(e.slice(2,4),t),n=this.applyTransform([e[0],e[3]],t),r=this.applyTransform([e[2],e[1]],t);return[Math.min(s[0],i[0],n[0],r[0]),Math.min(s[1],i[1],n[1],r[1]),Math.max(s[0],i[0],n[0],r[0]),Math.max(s[1],i[1],n[1],r[1])]}static inverseTransform(e){const t=e[0]*e[3]-e[1]*e[2];return[e[3]/t,-e[1]/t,-e[2]/t,e[0]/t,(e[2]*e[5]-e[4]*e[3])/t,(e[4]*e[1]-e[5]*e[0])/t]}static singularValueDecompose2dScale(e){const t=[e[0],e[2],e[1],e[3]],s=e[0]*t[0]+e[1]*t[2],i=e[0]*t[1]+e[1]*t[3],n=e[2]*t[0]+e[3]*t[2],r=e[2]*t[1]+e[3]*t[3],a=(s+r)/2,h=Math.sqrt((s+r)**2-4*(s*r-n*i))/2,l=a+h||1,c=a-h||1;return[Math.sqrt(l),Math.sqrt(c)]}static normalizeRect(e){const t=e.slice(0);return e[0]>e[2]&&(t[0]=e[2],t[2]=e[0]),e[1]>e[3]&&(t[1]=e[3],t[3]=e[1]),t}static intersect(e,t){const s=Math.max(Math.min(e[0],e[2]),Math.min(t[0],t[2])),i=Math.min(Math.max(e[0],e[2]),Math.max(t[0],t[2]));if(s>i)return null;const n=Math.max(Math.min(e[1],e[3]),Math.min(t[1],t[3])),r=Math.min(Math.max(e[1],e[3]),Math.max(t[1],t[3]));return n>r?null:[s,n,i,r]}static bezierBoundingBox(e,t,s,i,n,r,a,h,l){return l?(l[0]=Math.min(l[0],e,a),l[1]=Math.min(l[1],t,h),l[2]=Math.max(l[2],e,a),l[3]=Math.max(l[3],t,h)):l=[Math.min(e,a),Math.min(t,h),Math.max(e,a),Math.max(t,h)],E(this,bi,Ql).call(this,e,s,n,a,t,i,r,h,3*(-e+3*(s-n)+a),6*(e-2*s+n),3*(s-e),l),E(this,bi,Ql).call(this,e,s,n,a,t,i,r,h,3*(-t+3*(i-r)+h),6*(t-2*i+r),3*(i-t),l),l}}bi=new WeakSet,Ih=function(e,t,s,i,n,r,a,h,l,c){if(l<=0||l>=1)return;const d=1-l,p=l*l,f=p*l,g=d*(d*(d*e+3*l*t)+3*p*s)+f*i,m=d*(d*(d*n+3*l*r)+3*p*a)+f*h;c[0]=Math.min(c[0],g),c[1]=Math.min(c[1],m),c[2]=Math.max(c[2],g),c[3]=Math.max(c[3],m)},Ql=function(e,t,s,i,n,r,a,h,l,c,d,p){if(Math.abs(l)<1e-12){Math.abs(c)>=1e-12&&E(this,bi,Ih).call(this,e,t,s,i,n,r,a,h,-d/c,p);return}const f=c**2-4*d*l;if(f<0)return;const g=Math.sqrt(f),m=2*l;E(this,bi,Ih).call(this,e,t,s,i,n,r,a,h,(-c+g)/m,p),E(this,bi,Ih).call(this,e,t,s,i,n,r,a,h,(-c-g)/m,p)},S(at,bi);function Gp(u){return decodeURIComponent(escape(u))}let Gl=null,Md=null;function $p(u){return Gl||(Gl=/([\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,Md=new Map([["ſt","ſt"]])),u.replaceAll(Gl,(e,t,s)=>t?t.normalize("NFKC"):Md.get(s))}function Vp(){if(typeof crypto<"u"&&typeof(crypto==null?void 0:crypto.randomUUID)=="function")return crypto.randomUUID();const u=new Uint8Array(32);if(typeof crypto<"u"&&typeof(crypto==null?void 0:crypto.getRandomValues)=="function")crypto.getRandomValues(u);else for(let e=0;e<32;e++)u[e]=Math.floor(Math.random()*255);return nu(u)}const ru="pdfjs_internal_id_",Bs={BEZIER_CURVE_TO:0,MOVE_TO:1,LINE_TO:2,QUADRATIC_CURVE_TO:3,RESTORE:4,SAVE:5,SCALE:6,TRANSFORM:7,TRANSLATE:8};class Fl{constructor(){this.constructor===Fl&&Rt("Cannot initialize BaseFilterFactory.")}addFilter(e){return"none"}addHCMFilter(e,t){return"none"}addAlphaFilter(e){return"none"}addLuminosityFilter(e){return"none"}addHighlightHCMFilter(e,t,s,i,n){return"none"}destroy(e=!1){}}var Ba;const yd=class yd{constructor({enableHWA:e=!1}={}){S(this,Ba,!1);this.constructor===yd&&Rt("Cannot initialize BaseCanvasFactory."),w(this,Ba,e)}create(e,t){if(e<=0||t<=0)throw new Error("Invalid canvas size");const s=this._createCanvas(e,t);return{canvas:s,context:s.getContext("2d",{willReadFrequently:!o(this,Ba)})}}reset(e,t,s){if(!e.canvas)throw new Error("Canvas is not specified");if(t<=0||s<=0)throw new Error("Invalid canvas size");e.canvas.width=t,e.canvas.height=s}destroy(e){if(!e.canvas)throw new Error("Canvas is not specified");e.canvas.width=0,e.canvas.height=0,e.canvas=null,e.context=null}_createCanvas(e,t){Rt("Abstract method `_createCanvas` called.")}};Ba=new WeakMap;let il=yd;class Dl{constructor({baseUrl:e=null,isCompressed:t=!0}){this.constructor===Dl&&Rt("Cannot initialize BaseCMapReaderFactory."),this.baseUrl=e,this.isCompressed=t}async fetch({name:e}){if(!this.baseUrl)throw new Error('The CMap "baseUrl" parameter must be specified, ensure that the "cMapUrl" and "cMapPacked" API parameters are provided.');if(!e)throw new Error("CMap name must be specified.");const t=this.baseUrl+e+(this.isCompressed?".bcmap":""),s=this.isCompressed?Yl.BINARY:Yl.NONE;return this._fetchData(t,s).catch(i=>{throw new Error(`Unable to load ${this.isCompressed?"binary ":""}CMap at: ${t}`)})}_fetchData(e,t){Rt("Abstract method `_fetchData` called.")}}class Ol{constructor({baseUrl:e=null}){this.constructor===Ol&&Rt("Cannot initialize BaseStandardFontDataFactory."),this.baseUrl=e}async fetch({filename:e}){if(!this.baseUrl)throw new Error('The standard font "baseUrl" parameter must be specified, ensure that the "standardFontDataUrl" API parameter is provided.');if(!e)throw new Error("Font filename must be specified.");const t=`${this.baseUrl}${e}`;return this._fetchData(t).catch(s=>{throw new Error(`Unable to load font data at: ${t}`)})}_fetchData(e){Rt("Abstract method `_fetchData` called.")}}class dd{constructor(){this.constructor===dd&&Rt("Cannot initialize BaseSVGFactory.")}create(e,t,s=!1){if(e<=0||t<=0)throw new Error("Invalid SVG dimensions");const i=this._createSVG("svg:svg");return i.setAttribute("version","1.1"),s||(i.setAttribute("width",`${e}px`),i.setAttribute("height",`${t}px`)),i.setAttribute("preserveAspectRatio","none"),i.setAttribute("viewBox",`0 0 ${e} ${t}`),i}createElement(e){if(typeof e!="string")throw new Error("Invalid SVG element type");return this._createSVG(e)}_createSVG(e){Rt("Abstract method `_createSVG` called.")}}const Hs="http://www.w3.org/2000/svg",Ji=class Ji{};ft(Ji,"CSS",96),ft(Ji,"PDF",72),ft(Ji,"PDF_TO_CSS_UNITS",Ji.CSS/Ji.PDF);let Vi=Ji;var en,_s,$s,Se,cl,sn,nt,ue,rr,ar,Mh,au,Jl,or,va,ya,tc,Aa;class qp extends Fl{constructor({docId:t,ownerDocument:s=globalThis.document}={}){super();S(this,nt);S(this,en);S(this,_s);S(this,$s);S(this,Se);S(this,cl);S(this,sn,0);w(this,$s,t),w(this,Se,s)}addFilter(t){if(!t)return"none";let s=o(this,nt,ue).get(t);if(s)return s;const[i,n,r]=E(this,nt,Mh).call(this,t),a=t.length===1?i:`${i}${n}${r}`;if(s=o(this,nt,ue).get(a),s)return o(this,nt,ue).set(t,s),s;const h=`g_${o(this,$s)}_transfer_map_${Le(this,sn)._++}`,l=`url(#${h})`;o(this,nt,ue).set(t,l),o(this,nt,ue).set(a,l);const c=E(this,nt,or).call(this,h);return E(this,nt,ya).call(this,i,n,r,c),l}addHCMFilter(t,s){var g;const i=`${t}-${s}`,n="base";let r=o(this,nt,rr).get(n);if((r==null?void 0:r.key)===i||(r?((g=r.filter)==null||g.remove(),r.key=i,r.url="none",r.filter=null):(r={key:i,url:"none",filter:null},o(this,nt,rr).set(n,r)),!t||!s))return r.url;const a=E(this,nt,Aa).call(this,t);t=at.makeHexColor(...a);const h=E(this,nt,Aa).call(this,s);if(s=at.makeHexColor(...h),o(this,nt,ar).style.color="",t==="#000000"&&s==="#ffffff"||t===s)return r.url;const l=new Array(256);for(let m=0;m<=255;m++){const v=m/255;l[m]=v<=.03928?v/12.92:((v+.055)/1.055)**2.4}const c=l.join(","),d=`g_${o(this,$s)}_hcm_filter`,p=r.filter=E(this,nt,or).call(this,d);E(this,nt,ya).call(this,c,c,c,p),E(this,nt,Jl).call(this,p);const f=(m,v)=>{const b=a[m]/255,A=h[m]/255,x=new Array(v+1);for(let k=0;k<=v;k++)x[k]=b+k/v*(A-b);return x.join(",")};return E(this,nt,ya).call(this,f(0,5),f(1,5),f(2,5),p),r.url=`url(#${d})`,r.url}addAlphaFilter(t){let s=o(this,nt,ue).get(t);if(s)return s;const[i]=E(this,nt,Mh).call(this,[t]),n=`alpha_${i}`;if(s=o(this,nt,ue).get(n),s)return o(this,nt,ue).set(t,s),s;const r=`g_${o(this,$s)}_alpha_map_${Le(this,sn)._++}`,a=`url(#${r})`;o(this,nt,ue).set(t,a),o(this,nt,ue).set(n,a);const h=E(this,nt,or).call(this,r);return E(this,nt,tc).call(this,i,h),a}addLuminosityFilter(t){let s=o(this,nt,ue).get(t||"luminosity");if(s)return s;let i,n;if(t?([i]=E(this,nt,Mh).call(this,[t]),n=`luminosity_${i}`):n="luminosity",s=o(this,nt,ue).get(n),s)return o(this,nt,ue).set(t,s),s;const r=`g_${o(this,$s)}_luminosity_map_${Le(this,sn)._++}`,a=`url(#${r})`;o(this,nt,ue).set(t,a),o(this,nt,ue).set(n,a);const h=E(this,nt,or).call(this,r);return E(this,nt,au).call(this,h),t&&E(this,nt,tc).call(this,i,h),a}addHighlightHCMFilter(t,s,i,n,r){var A;const a=`${s}-${i}-${n}-${r}`;let h=o(this,nt,rr).get(t);if((h==null?void 0:h.key)===a||(h?((A=h.filter)==null||A.remove(),h.key=a,h.url="none",h.filter=null):(h={key:a,url:"none",filter:null},o(this,nt,rr).set(t,h)),!s||!i))return h.url;const[l,c]=[s,i].map(E(this,nt,Aa).bind(this));let d=Math.round(.2126*l[0]+.7152*l[1]+.0722*l[2]),p=Math.round(.2126*c[0]+.7152*c[1]+.0722*c[2]),[f,g]=[n,r].map(E(this,nt,Aa).bind(this));p<d&&([d,p,f,g]=[p,d,g,f]),o(this,nt,ar).style.color="";const m=(x,k,T)=>{const L=new Array(256),I=(p-d)/T,B=x/255,D=(k-x)/(255*T);let W=0;for(let q=0;q<=T;q++){const P=Math.round(d+q*I),z=B+q*D;for(let y=W;y<=P;y++)L[y]=z;W=P+1}for(let q=W;q<256;q++)L[q]=L[W-1];return L.join(",")},v=`g_${o(this,$s)}_hcm_${t}_filter`,b=h.filter=E(this,nt,or).call(this,v);return E(this,nt,Jl).call(this,b),E(this,nt,ya).call(this,m(f[0],g[0],5),m(f[1],g[1],5),m(f[2],g[2],5),b),h.url=`url(#${v})`,h.url}destroy(t=!1){t&&o(this,nt,rr).size!==0||(o(this,_s)&&(o(this,_s).parentNode.parentNode.remove(),w(this,_s,null)),o(this,en)&&(o(this,en).clear(),w(this,en,null)),w(this,sn,0))}}en=new WeakMap,_s=new WeakMap,$s=new WeakMap,Se=new WeakMap,cl=new WeakMap,sn=new WeakMap,nt=new WeakSet,ue=function(){return o(this,en)||w(this,en,new Map)},rr=function(){return o(this,cl)||w(this,cl,new Map)},ar=function(){if(!o(this,_s)){const t=o(this,Se).createElement("div"),{style:s}=t;s.visibility="hidden",s.contain="strict",s.width=s.height=0,s.position="absolute",s.top=s.left=0,s.zIndex=-1;const i=o(this,Se).createElementNS(Hs,"svg");i.setAttribute("width",0),i.setAttribute("height",0),w(this,_s,o(this,Se).createElementNS(Hs,"defs")),t.append(i),i.append(o(this,_s)),o(this,Se).body.append(t)}return o(this,_s)},Mh=function(t){if(t.length===1){const l=t[0],c=new Array(256);for(let p=0;p<256;p++)c[p]=l[p]/255;const d=c.join(",");return[d,d,d]}const[s,i,n]=t,r=new Array(256),a=new Array(256),h=new Array(256);for(let l=0;l<256;l++)r[l]=s[l]/255,a[l]=i[l]/255,h[l]=n[l]/255;return[r.join(","),a.join(","),h.join(",")]},au=function(t){const s=o(this,Se).createElementNS(Hs,"feColorMatrix");s.setAttribute("type","matrix"),s.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"),t.append(s)},Jl=function(t){const s=o(this,Se).createElementNS(Hs,"feColorMatrix");s.setAttribute("type","matrix"),s.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"),t.append(s)},or=function(t){const s=o(this,Se).createElementNS(Hs,"filter");return s.setAttribute("color-interpolation-filters","sRGB"),s.setAttribute("id",t),o(this,nt,ar).append(s),s},va=function(t,s,i){const n=o(this,Se).createElementNS(Hs,s);n.setAttribute("type","discrete"),n.setAttribute("tableValues",i),t.append(n)},ya=function(t,s,i,n){const r=o(this,Se).createElementNS(Hs,"feComponentTransfer");n.append(r),E(this,nt,va).call(this,r,"feFuncR",t),E(this,nt,va).call(this,r,"feFuncG",s),E(this,nt,va).call(this,r,"feFuncB",i)},tc=function(t,s){const i=o(this,Se).createElementNS(Hs,"feComponentTransfer");s.append(i),E(this,nt,va).call(this,i,"feFuncA",t)},Aa=function(t){return o(this,nt,ar).style.color=t,md(getComputedStyle(o(this,nt,ar)).getPropertyValue("color"))};class Xp extends il{constructor({ownerDocument:e=globalThis.document,enableHWA:t=!1}={}){super({enableHWA:t}),this._document=e}_createCanvas(e,t){const s=this._document.createElement("canvas");return s.width=e,s.height=t,s}}async function Nl(u,e="text"){if(wa(u,document.baseURI)){const t=await fetch(u);if(!t.ok)throw new Error(t.statusText);switch(e){case"arraybuffer":return t.arrayBuffer();case"blob":return t.blob();case"json":return t.json()}return t.text()}return new Promise((t,s)=>{const i=new XMLHttpRequest;i.open("GET",u,!0),i.responseType=e,i.onreadystatechange=()=>{if(i.readyState===XMLHttpRequest.DONE){if(i.status===200||i.status===0){switch(e){case"arraybuffer":case"blob":case"json":t(i.response);return}t(i.responseText);return}s(new Error(i.statusText))}},i.send(null)})}class ou extends Dl{_fetchData(e,t){return Nl(e,this.isCompressed?"arraybuffer":"text").then(s=>({cMapData:s instanceof ArrayBuffer?new Uint8Array(s):Ml(s),compressionType:t}))}}class hu extends Ol{_fetchData(e){return Nl(e,"arraybuffer").then(t=>new Uint8Array(t))}}class ud extends dd{_createSVG(e){return document.createElementNS(Hs,e)}}class bh{constructor({viewBox:e,scale:t,rotation:s,offsetX:i=0,offsetY:n=0,dontFlip:r=!1}){this.viewBox=e,this.scale=t,this.rotation=s,this.offsetX=i,this.offsetY=n;const a=(e[2]+e[0])/2,h=(e[3]+e[1])/2;let l,c,d,p;switch(s%=360,s<0&&(s+=360),s){case 180:l=-1,c=0,d=0,p=1;break;case 90:l=0,c=1,d=1,p=0;break;case 270:l=0,c=-1,d=-1,p=0;break;case 0:l=1,c=0,d=0,p=-1;break;default:throw new Error("PageViewport: Invalid rotation, must be a multiple of 90 degrees.")}r&&(d=-d,p=-p);let f,g,m,v;l===0?(f=Math.abs(h-e[1])*t+i,g=Math.abs(a-e[0])*t+n,m=(e[3]-e[1])*t,v=(e[2]-e[0])*t):(f=Math.abs(a-e[0])*t+i,g=Math.abs(h-e[1])*t+n,m=(e[2]-e[0])*t,v=(e[3]-e[1])*t),this.transform=[l*t,c*t,d*t,p*t,f-l*t*a-d*t*h,g-c*t*a-p*t*h],this.width=m,this.height=v}get rawDims(){const{viewBox:e}=this;return Et(this,"rawDims",{pageWidth:e[2]-e[0],pageHeight:e[3]-e[1],pageX:e[0],pageY:e[1]})}clone({scale:e=this.scale,rotation:t=this.rotation,offsetX:s=this.offsetX,offsetY:i=this.offsetY,dontFlip:n=!1}={}){return new bh({viewBox:this.viewBox.slice(),scale:e,rotation:t,offsetX:s,offsetY:i,dontFlip:n})}convertToViewportPoint(e,t){return at.applyTransform([e,t],this.transform)}convertToViewportRectangle(e){const t=at.applyTransform([e[0],e[1]],this.transform),s=at.applyTransform([e[2],e[3]],this.transform);return[t[0],t[1],s[0],s[1]]}convertToPdfPoint(e,t){return at.applyInverseTransform([e,t],this.transform)}}class fd extends Yi{constructor(e,t=0){super(e,"RenderingCancelledException"),this.extraDelay=t}}function pd(u){const e=u.length;let t=0;for(;t<e&&u[t].trim()==="";)t++;return u.substring(t,t+5).toLowerCase()==="data:"}function gd(u){return typeof u=="string"&&/\.pdf$/i.test(u)}function Yp(u){return[u]=u.split(/[#?]/,1),u.substring(u.lastIndexOf("/")+1)}function Kp(u,e="document.pdf"){if(typeof u!="string")return e;if(pd(u))return gt('getPdfFilenameFromUrl: ignore "data:"-URL for performance reasons.'),e;const t=/^(?:(?:[^:]+:)?\/\/[^/]+)?([^?#]*)(\?[^#]*)?(#.*)?$/,s=/[^/?#=]+\.pdf\b(?!.*\.pdf\b)/i,i=t.exec(u);let n=s.exec(i[1])||s.exec(i[2])||s.exec(i[3]);if(n&&(n=n[0],n.includes("%")))try{n=s.exec(decodeURIComponent(n))[0]}catch{}return n||e}class Fd{constructor(){ft(this,"started",Object.create(null));ft(this,"times",[])}time(e){e in this.started&>(`Timer is already running for ${e}`),this.started[e]=Date.now()}timeEnd(e){e in this.started||gt(`Timer has not been started for ${e}`),this.times.push({name:e,start:this.started[e],end:Date.now()}),delete this.started[e]}toString(){const e=[];let t=0;for(const{name:s}of this.times)t=Math.max(s.length,t);for(const{name:s,start:i,end:n}of this.times)e.push(`${s.padEnd(t)} ${n-i}ms
| `);return e.join("")}}function wa(u,e){try{const{protocol:t}=e?new URL(u,e):new URL(u);return t==="http:"||t==="https:"}catch{return!1}}function Re(u){u.preventDefault()}function lu(u){console.log("Deprecated API usage: "+u)}let Dd;class cu{static toDateObject(e){if(!e||typeof e!="string")return null;Dd||(Dd=new RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+|-])?(\\d{2})?'?(\\d{2})?'?"));const t=Dd.exec(e);if(!t)return null;const s=parseInt(t[1],10);let i=parseInt(t[2],10);i=i>=1&&i<=12?i-1:0;let n=parseInt(t[3],10);n=n>=1&&n<=31?n:1;let r=parseInt(t[4],10);r=r>=0&&r<=23?r:0;let a=parseInt(t[5],10);a=a>=0&&a<=59?a:0;let h=parseInt(t[6],10);h=h>=0&&h<=59?h:0;const l=t[7]||"Z";let c=parseInt(t[8],10);c=c>=0&&c<=23?c:0;let d=parseInt(t[9],10)||0;return d=d>=0&&d<=59?d:0,l==="-"?(r+=c,a+=d):l==="+"&&(r-=c,a-=d),new Date(Date.UTC(s,i,n,r,a,h))}}function Zp(u,{scale:e=1,rotation:t=0}){const{width:s,height:i}=u.attributes.style,n=[0,0,parseInt(s),parseInt(i)];return new bh({viewBox:n,scale:e,rotation:t})}function md(u){if(u.startsWith("#")){const e=parseInt(u.slice(1),16);return[(e&16711680)>>16,(e&65280)>>8,e&255]}return u.startsWith("rgb(")?u.slice(4,-1).split(",").map(e=>parseInt(e)):u.startsWith("rgba(")?u.slice(5,-1).split(",").map(e=>parseInt(e)).slice(0,3):(gt(`Not a valid color format: "${u}"`),[0,0,0])}function Qp(u){const e=document.createElement("span");e.style.visibility="hidden",document.body.append(e);for(const t of u.keys()){e.style.color=t;const s=window.getComputedStyle(e).color;u.set(t,md(s))}e.remove()}function Bt(u){const{a:e,b:t,c:s,d:i,e:n,f:r}=u.getTransform();return[e,t,s,i,n,r]}function zs(u){const{a:e,b:t,c:s,d:i,e:n,f:r}=u.getTransform().invertSelf();return[e,t,s,i,n,r]}function Zn(u,e,t=!1,s=!0){if(e instanceof bh){const{pageWidth:i,pageHeight:n}=e.rawDims,{style:r}=u,a=ke.isCSSRoundSupported,h=`var(--scale-factor) * ${i}px`,l=`var(--scale-factor) * ${n}px`,c=a?`round(${h}, 1px)`:`calc(${h})`,d=a?`round(${l}, 1px)`:`calc(${l})`;!t||e.rotation%180===0?(r.width=c,r.height=d):(r.width=d,r.height=c)}s&&u.setAttribute("data-main-rotation",e.rotation)}var nn,rn,Fe,an,dl,du,Ae,uu,fu,Fh,pu,sc;const ul=class ul{constructor(e){S(this,Ae);S(this,nn,null);S(this,rn,null);S(this,Fe);S(this,an,null);w(this,Fe,e)}render(){const e=w(this,nn,document.createElement("div"));e.className="editToolbar",e.setAttribute("role","toolbar");const t=o(this,Fe)._uiManager._signal;e.addEventListener("contextmenu",Re,{signal:t}),e.addEventListener("pointerdown",E(ul,dl,du),{signal:t});const s=w(this,an,document.createElement("div"));s.className="buttons",e.append(s);const i=o(this,Fe).toolbarPosition;if(i){const{style:n}=e,r=o(this,Fe)._uiManager.direction==="ltr"?1-i[0]:i[0];n.insetInlineEnd=`${100*r}%`,n.top=`calc(${100*i[1]}% + var(--editor-toolbar-vert-offset))`}return E(this,Ae,pu).call(this),e}hide(){var e;o(this,nn).classList.add("hidden"),(e=o(this,rn))==null||e.hideDropdown()}show(){o(this,nn).classList.remove("hidden")}addAltTextButton(e){E(this,Ae,Fh).call(this,e),o(this,an).prepend(e,o(this,Ae,sc))}addColorPicker(e){w(this,rn,e);const t=e.renderButton();E(this,Ae,Fh).call(this,t),o(this,an).prepend(t,o(this,Ae,sc))}remove(){var e;o(this,nn).remove(),(e=o(this,rn))==null||e.destroy(),w(this,rn,null)}};nn=new WeakMap,rn=new WeakMap,Fe=new WeakMap,an=new WeakMap,dl=new WeakSet,du=function(e){e.stopPropagation()},Ae=new WeakSet,uu=function(e){o(this,Fe)._focusEventsAllowed=!1,e.preventDefault(),e.stopPropagation()},fu=function(e){o(this,Fe)._focusEventsAllowed=!0,e.preventDefault(),e.stopPropagation()},Fh=function(e){const t=o(this,Fe)._uiManager._signal;e.addEventListener("focusin",E(this,Ae,uu).bind(this),{capture:!0,signal:t}),e.addEventListener("focusout",E(this,Ae,fu).bind(this),{capture:!0,signal:t}),e.addEventListener("contextmenu",Re,{signal:t})},pu=function(){const e=document.createElement("button");e.className="delete",e.tabIndex=0,e.setAttribute("data-l10n-id",`pdfjs-editor-remove-${o(this,Fe).editorType}-button`),E(this,Ae,Fh).call(this,e),e.addEventListener("click",t=>{o(this,Fe)._uiManager.delete()},{signal:o(this,Fe)._uiManager._signal}),o(this,an).append(e)},sc=function(){const e=document.createElement("div");return e.className="divider",e},S(ul,dl);let ec=ul;var za,on,hn,qi,gu,mu,bu;class Jp{constructor(e){S(this,qi);S(this,za,null);S(this,on,null);S(this,hn);w(this,hn,e)}show(e,t,s){const[i,n]=E(this,qi,mu).call(this,t,s),{style:r}=o(this,on)||w(this,on,E(this,qi,gu).call(this));e.append(o(this,on)),r.insetInlineEnd=`${100*i}%`,r.top=`calc(${100*n}% + var(--editor-toolbar-vert-offset))`}hide(){o(this,on).remove()}}za=new WeakMap,on=new WeakMap,hn=new WeakMap,qi=new WeakSet,gu=function(){const e=w(this,on,document.createElement("div"));e.className="editToolbar",e.setAttribute("role","toolbar"),e.addEventListener("contextmenu",Re,{signal:o(this,hn)._signal});const t=w(this,za,document.createElement("div"));return t.className="buttons",e.append(t),E(this,qi,bu).call(this),e},mu=function(e,t){let s=0,i=0;for(const n of e){const r=n.y+n.height;if(r<s)continue;const a=n.x+(t?n.width:0);if(r>s){i=a,s=r;continue}t?a>i&&(i=a):a<i&&(i=a)}return[t?1-i:i,s]},bu=function(){const e=document.createElement("button");e.className="highlightButton",e.tabIndex=0,e.setAttribute("data-l10n-id","pdfjs-highlight-floating-button1");const t=document.createElement("span");e.append(t),t.className="visuallyHidden",t.setAttribute("data-l10n-id","pdfjs-highlight-floating-button-label");const s=o(this,hn)._signal;e.addEventListener("contextmenu",Re,{signal:s}),e.addEventListener("click",()=>{o(this,hn).highlightSelection("floating_button")},{signal:s}),o(this,za).append(e)};function nl(u,e,t){for(const s of t)e.addEventListener(s,u[s].bind(u))}function tg(u){return Math.round(Math.min(255,Math.max(1,255*u))).toString(16).padStart(2,"0")}var fl;class eg{constructor(){S(this,fl,0)}get id(){return`${Mp}${Le(this,fl)._++}`}}fl=new WeakMap;var Ha,pl,Ve,Ua,nc;const Ad=class Ad{constructor(){S(this,Ua);S(this,Ha,Vp());S(this,pl,0);S(this,Ve,null)}static get _isSVGFittingCanvas(){const e='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>',s=new OffscreenCanvas(1,3).getContext("2d",{willReadFrequently:!0}),i=new Image;i.src=e;const n=i.decode().then(()=>(s.drawImage(i,0,0,1,1,0,0,1,3),new Uint32Array(s.getImageData(0,0,1,1).data.buffer)[0]===0));return Et(this,"_isSVGFittingCanvas",n)}async getFromFile(e){const{lastModified:t,name:s,size:i,type:n}=e;return E(this,Ua,nc).call(this,`${t}_${s}_${i}_${n}`,e)}async getFromUrl(e){return E(this,Ua,nc).call(this,e,e)}async getFromId(e){o(this,Ve)||w(this,Ve,new Map);const t=o(this,Ve).get(e);return t?t.bitmap?(t.refCounter+=1,t):t.file?this.getFromFile(t.file):this.getFromUrl(t.url):null}getSvgUrl(e){const t=o(this,Ve).get(e);return t!=null&&t.isSvg?t.svgUrl:null}deleteId(e){o(this,Ve)||w(this,Ve,new Map);const t=o(this,Ve).get(e);t&&(t.refCounter-=1,t.refCounter===0&&(t.bitmap=null))}isValidId(e){return e.startsWith(`image_${o(this,Ha)}_`)}};Ha=new WeakMap,pl=new WeakMap,Ve=new WeakMap,Ua=new WeakSet,nc=async function(e,t){o(this,Ve)||w(this,Ve,new Map);let s=o(this,Ve).get(e);if(s===null)return null;if(s!=null&&s.bitmap)return s.refCounter+=1,s;try{s||(s={bitmap:null,id:`image_${o(this,Ha)}_${Le(this,pl)._++}`,refCounter:0,isSvg:!1});let i;if(typeof t=="string"?(s.url=t,i=await Nl(t,"blob")):i=s.file=t,i.type==="image/svg+xml"){const n=Ad._isSVGFittingCanvas,r=new FileReader,a=new Image,h=new Promise((l,c)=>{a.onload=()=>{s.bitmap=a,s.isSvg=!0,l()},r.onload=async()=>{const d=s.svgUrl=r.result;a.src=await n?`${d}#svgView(preserveAspectRatio(none))`:d},a.onerror=r.onerror=c});r.readAsDataURL(i),await h}else s.bitmap=await createImageBitmap(i);s.refCounter=1}catch(i){console.error(i),s=null}return o(this,Ve).set(e,s),s&&o(this,Ve).set(s.id,s),s};let ic=Ad;var Jt,xi,ja,te;class sg{constructor(e=128){S(this,Jt,[]);S(this,xi,!1);S(this,ja);S(this,te,-1);w(this,ja,e)}add({cmd:e,undo:t,post:s,mustExec:i,type:n=NaN,overwriteIfSameType:r=!1,keepUndo:a=!1}){if(i&&e(),o(this,xi))return;const h={cmd:e,undo:t,post:s,type:n};if(o(this,te)===-1){o(this,Jt).length>0&&(o(this,Jt).length=0),w(this,te,0),o(this,Jt).push(h);return}if(r&&o(this,Jt)[o(this,te)].type===n){a&&(h.undo=o(this,Jt)[o(this,te)].undo),o(this,Jt)[o(this,te)]=h;return}const l=o(this,te)+1;l===o(this,ja)?o(this,Jt).splice(0,1):(w(this,te,l),l<o(this,Jt).length&&o(this,Jt).splice(l)),o(this,Jt).push(h)}undo(){if(o(this,te)===-1)return;w(this,xi,!0);const{undo:e,post:t}=o(this,Jt)[o(this,te)];e(),t==null||t(),w(this,xi,!1),w(this,te,o(this,te)-1)}redo(){if(o(this,te)<o(this,Jt).length-1){w(this,te,o(this,te)+1),w(this,xi,!0);const{cmd:e,post:t}=o(this,Jt)[o(this,te)];e(),t==null||t(),w(this,xi,!1)}}hasSomethingToUndo(){return o(this,te)!==-1}hasSomethingToRedo(){return o(this,te)<o(this,Jt).length-1}destroy(){w(this,Jt,null)}}Jt=new WeakMap,xi=new WeakMap,ja=new WeakMap,te=new WeakMap;var gl,_u;class _h{constructor(e){S(this,gl);this.buffer=[],this.callbacks=new Map,this.allKeys=new Set;const{isMac:t}=ke.platform;for(const[s,i,n={}]of e)for(const r of s){const a=r.startsWith("mac+");t&&a?(this.callbacks.set(r.slice(4),{callback:i,options:n}),this.allKeys.add(r.split("+").at(-1))):!t&&!a&&(this.callbacks.set(r,{callback:i,options:n}),this.allKeys.add(r.split("+").at(-1)))}}exec(e,t){if(!this.allKeys.has(t.key))return;const s=this.callbacks.get(E(this,gl,_u).call(this,t));if(!s)return;const{callback:i,options:{bubbles:n=!1,args:r=[],checker:a=null}}=s;a&&!a(e,t)||(i.bind(e,...r,t)(),n||(t.stopPropagation(),t.preventDefault()))}}gl=new WeakSet,_u=function(e){e.altKey&&this.buffer.push("alt"),e.ctrlKey&&this.buffer.push("ctrl"),e.metaKey&&this.buffer.push("meta"),e.shiftKey&&this.buffer.push("shift"),this.buffer.push(e.key);const t=this.buffer.join("+");return this.buffer.length=0,t};const ml=class ml{get _colors(){const e=new Map([["CanvasText",null],["Canvas",null]]);return Qp(e),Et(this,"_colors",e)}convert(e){const t=md(e);if(!window.matchMedia("(forced-colors: active)").matches)return t;for(const[s,i]of this._colors)if(i.every((n,r)=>n===t[r]))return ml._colorsMapping.get(s);return t}getHexCode(e){const t=this._colors.get(e);return t?at.makeHexColor(...t):e}};ft(ml,"_colorsMapping",new Map([["CanvasText",[0,0,0]],["Canvas",[255,255,255]]]));let rc=ml;var gr,De,Xt,ne,mr,Vs,br,ss,_r,ln,vs,is,cn,Wa,Ga,ys,vr,Ci,As,bl,ki,$a,dn,Va,yr,re,Ct,qs,un,qa,Xa,Ya,Ka,Za,Qa,Ja,to,eo,so,io,no,ro,Ti,ws,Xs,ao,tt,Dh,vu,yu,Oh,Au,wu,Eu,ac,Su,oc,hc,xu,be,Ai,Cu,ku,lc,Tu,Ea,cc;const ur=class ur{constructor(e,t,s,i,n,r,a,h,l){S(this,tt);S(this,gr,new AbortController);S(this,De,null);S(this,Xt,new Map);S(this,ne,new Map);S(this,mr,null);S(this,Vs,null);S(this,br,null);S(this,ss,new sg);S(this,_r,0);S(this,ln,new Set);S(this,vs,null);S(this,is,null);S(this,cn,new Set);S(this,Wa,!1);S(this,Ga,null);S(this,ys,null);S(this,vr,null);S(this,Ci,!1);S(this,As,null);S(this,bl,new eg);S(this,ki,!1);S(this,$a,!1);S(this,dn,null);S(this,Va,null);S(this,yr,null);S(this,re,wt.NONE);S(this,Ct,new Set);S(this,qs,null);S(this,un,null);S(this,qa,null);S(this,Xa,this.blur.bind(this));S(this,Ya,this.focus.bind(this));S(this,Ka,this.copy.bind(this));S(this,Za,this.cut.bind(this));S(this,Qa,this.paste.bind(this));S(this,Ja,this.keydown.bind(this));S(this,to,this.keyup.bind(this));S(this,eo,this.onEditingAction.bind(this));S(this,so,this.onPageChanging.bind(this));S(this,io,this.onScaleChanging.bind(this));S(this,no,this.onRotationChanging.bind(this));S(this,ro,{isEditing:!1,isEmpty:!0,hasSomethingToUndo:!1,hasSomethingToRedo:!1,hasSelectedEditor:!1,hasSelectedText:!1});S(this,Ti,[0,0]);S(this,ws,null);S(this,Xs,null);S(this,ao,null);this._signal=o(this,gr).signal,w(this,Xs,e),w(this,ao,t),w(this,mr,s),this._eventBus=i,this._eventBus._on("editingaction",o(this,eo)),this._eventBus._on("pagechanging",o(this,so)),this._eventBus._on("scalechanging",o(this,io)),this._eventBus._on("rotationchanging",o(this,no)),E(this,tt,Au).call(this),E(this,tt,xu).call(this),E(this,tt,ac).call(this),w(this,Vs,n.annotationStorage),w(this,Ga,n.filterFactory),w(this,un,r),w(this,vr,a||null),w(this,Wa,h),w(this,yr,l||null),this.viewParameters={realScale:Vi.PDF_TO_CSS_UNITS,rotation:0},this.isShiftKeyDown=!1}static get _keyboardManager(){const e=ur.prototype,t=r=>o(r,Xs).contains(document.activeElement)&&document.activeElement.tagName!=="BUTTON"&&r.hasSomethingToControl(),s=(r,{target:a})=>{if(a instanceof HTMLInputElement){const{type:h}=a;return h!=="text"&&h!=="number"}return!0},i=this.TRANSLATE_SMALL,n=this.TRANSLATE_BIG;return Et(this,"_keyboardManager",new _h([[["ctrl+a","mac+meta+a"],e.selectAll,{checker:s}],[["ctrl+z","mac+meta+z"],e.undo,{checker:s}],[["ctrl+y","ctrl+shift+z","mac+meta+shift+z","ctrl+shift+Z","mac+meta+shift+Z"],e.redo,{checker:s}],[["Backspace","alt+Backspace","ctrl+Backspace","shift+Backspace","mac+Backspace","mac+alt+Backspace","mac+ctrl+Backspace","Delete","ctrl+Delete","shift+Delete","mac+Delete"],e.delete,{checker:s}],[["Enter","mac+Enter"],e.addNewEditorFromKeyboard,{checker:(r,{target:a})=>!(a instanceof HTMLButtonElement)&&o(r,Xs).contains(a)&&!r.isEnterHandled}],[[" ","mac+ "],e.addNewEditorFromKeyboard,{checker:(r,{target:a})=>!(a instanceof HTMLButtonElement)&&o(r,Xs).contains(document.activeElement)}],[["Escape","mac+Escape"],e.unselectAll],[["ArrowLeft","mac+ArrowLeft"],e.translateSelectedEditors,{args:[-i,0],checker:t}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],e.translateSelectedEditors,{args:[-n,0],checker:t}],[["ArrowRight","mac+ArrowRight"],e.translateSelectedEditors,{args:[i,0],checker:t}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],e.translateSelectedEditors,{args:[n,0],checker:t}],[["ArrowUp","mac+ArrowUp"],e.translateSelectedEditors,{args:[0,-i],checker:t}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],e.translateSelectedEditors,{args:[0,-n],checker:t}],[["ArrowDown","mac+ArrowDown"],e.translateSelectedEditors,{args:[0,i],checker:t}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],e.translateSelectedEditors,{args:[0,n],checker:t}]]))}destroy(){var e,t,s;(e=o(this,gr))==null||e.abort(),w(this,gr,null),this._signal=null,this._eventBus._off("editingaction",o(this,eo)),this._eventBus._off("pagechanging",o(this,so)),this._eventBus._off("scalechanging",o(this,io)),this._eventBus._off("rotationchanging",o(this,no));for(const i of o(this,ne).values())i.destroy();o(this,ne).clear(),o(this,Xt).clear(),o(this,cn).clear(),w(this,De,null),o(this,Ct).clear(),o(this,ss).destroy(),(t=o(this,mr))==null||t.destroy(),(s=o(this,As))==null||s.hide(),w(this,As,null),o(this,ys)&&(clearTimeout(o(this,ys)),w(this,ys,null)),o(this,ws)&&(clearTimeout(o(this,ws)),w(this,ws,null))}async mlGuess(e){var t;return((t=o(this,yr))==null?void 0:t.guess(e))||null}get hasMLManager(){return!!o(this,yr)}get hcmFilter(){return Et(this,"hcmFilter",o(this,un)?o(this,Ga).addHCMFilter(o(this,un).foreground,o(this,un).background):"none")}get direction(){return Et(this,"direction",getComputedStyle(o(this,Xs)).direction)}get highlightColors(){return Et(this,"highlightColors",o(this,vr)?new Map(o(this,vr).split(",").map(e=>e.split("=").map(t=>t.trim()))):null)}get highlightColorNames(){return Et(this,"highlightColorNames",this.highlightColors?new Map(Array.from(this.highlightColors,e=>e.reverse())):null)}setMainHighlightColorPicker(e){w(this,Va,e)}editAltText(e){var t;(t=o(this,mr))==null||t.editAltText(this,e)}onPageChanging({pageNumber:e}){w(this,_r,e-1)}focusMainContainer(){o(this,Xs).focus()}findParent(e,t){for(const s of o(this,ne).values()){const{x:i,y:n,width:r,height:a}=s.div.getBoundingClientRect();if(e>=i&&e<=i+r&&t>=n&&t<=n+a)return s}return null}disableUserSelect(e=!1){o(this,ao).classList.toggle("noUserSelect",e)}addShouldRescale(e){o(this,cn).add(e)}removeShouldRescale(e){o(this,cn).delete(e)}onScaleChanging({scale:e}){this.commitOrRemove(),this.viewParameters.realScale=e*Vi.PDF_TO_CSS_UNITS;for(const t of o(this,cn))t.onScaleChanging()}onRotationChanging({pagesRotation:e}){this.commitOrRemove(),this.viewParameters.rotation=e}highlightSelection(e=""){const t=document.getSelection();if(!t||t.isCollapsed)return;const{anchorNode:s,anchorOffset:i,focusNode:n,focusOffset:r}=t,a=t.toString(),l=E(this,tt,Dh).call(this,t).closest(".textLayer"),c=this.getSelectionBoxes(l);if(c){t.empty(),o(this,re)===wt.NONE&&(this._eventBus.dispatch("showannotationeditorui",{source:this,mode:wt.HIGHLIGHT}),this.showAllEditors("highlight",!0,!0));for(const d of o(this,ne).values())if(d.hasTextLayer(l)){d.createAndAddNewEditor({x:0,y:0},!1,{methodOfCreation:e,boxes:c,anchorNode:s,anchorOffset:i,focusNode:n,focusOffset:r,text:a});break}}}addToAnnotationStorage(e){!e.isEmpty()&&o(this,Vs)&&!o(this,Vs).has(e.id)&&o(this,Vs).setValue(e.id,e)}blur(){if(this.isShiftKeyDown=!1,o(this,Ci)&&(w(this,Ci,!1),E(this,tt,Oh).call(this,"main_toolbar")),!this.hasSelection)return;const{activeElement:e}=document;for(const t of o(this,Ct))if(t.div.contains(e)){w(this,dn,[t,e]),t._focusEventsAllowed=!1;break}}focus(){if(!o(this,dn))return;const[e,t]=o(this,dn);w(this,dn,null),t.addEventListener("focusin",()=>{e._focusEventsAllowed=!0},{once:!0,signal:this._signal}),t.focus()}addEditListeners(){E(this,tt,ac).call(this),E(this,tt,oc).call(this)}removeEditListeners(){E(this,tt,Su).call(this),E(this,tt,hc).call(this)}dragOver(e){for(const{type:t}of e.dataTransfer.items)for(const s of o(this,is))if(s.isHandlingMimeForPasting(t)){e.dataTransfer.dropEffect="copy",e.preventDefault();return}}drop(e){for(const t of e.dataTransfer.items)for(const s of o(this,is))if(s.isHandlingMimeForPasting(t.type)){s.paste(t,this.currentLayer),e.preventDefault();return}}copy(e){var s;if(e.preventDefault(),(s=o(this,De))==null||s.commitOrRemove(),!this.hasSelection)return;const t=[];for(const i of o(this,Ct)){const n=i.serialize(!0);n&&t.push(n)}t.length!==0&&e.clipboardData.setData("application/pdfjs",JSON.stringify(t))}cut(e){this.copy(e),this.delete()}paste(e){e.preventDefault();const{clipboardData:t}=e;for(const n of t.items)for(const r of o(this,is))if(r.isHandlingMimeForPasting(n.type)){r.paste(n,this.currentLayer);return}let s=t.getData("application/pdfjs");if(!s)return;try{s=JSON.parse(s)}catch(n){gt(`paste: "${n.message}".`);return}if(!Array.isArray(s))return;this.unselectAll();const i=this.currentLayer;try{const n=[];for(const h of s){const l=i.deserialize(h);if(!l)return;n.push(l)}const r=()=>{for(const h of n)E(this,tt,lc).call(this,h);E(this,tt,cc).call(this,n)},a=()=>{for(const h of n)h.remove()};this.addCommands({cmd:r,undo:a,mustExec:!0})}catch(n){gt(`paste: "${n.message}".`)}}keydown(e){!this.isShiftKeyDown&&e.key==="Shift"&&(this.isShiftKeyDown=!0),o(this,re)!==wt.NONE&&!this.isEditorHandlingKeyboard&&ur._keyboardManager.exec(this,e)}keyup(e){this.isShiftKeyDown&&e.key==="Shift"&&(this.isShiftKeyDown=!1,o(this,Ci)&&(w(this,Ci,!1),E(this,tt,Oh).call(this,"main_toolbar")))}onEditingAction({name:e}){switch(e){case"undo":case"redo":case"delete":case"selectAll":this[e]();break;case"highlightSelection":this.highlightSelection("context_menu");break}}setEditingState(e){e?(E(this,tt,wu).call(this),E(this,tt,oc).call(this),E(this,tt,be).call(this,{isEditing:o(this,re)!==wt.NONE,isEmpty:E(this,tt,Ea).call(this),hasSomethingToUndo:o(this,ss).hasSomethingToUndo(),hasSomethingToRedo:o(this,ss).hasSomethingToRedo(),hasSelectedEditor:!1})):(E(this,tt,Eu).call(this),E(this,tt,hc).call(this),E(this,tt,be).call(this,{isEditing:!1}),this.disableUserSelect(!1))}registerEditorTypes(e){if(!o(this,is)){w(this,is,e);for(const t of o(this,is))E(this,tt,Ai).call(this,t.defaultPropertiesToUpdate)}}getId(){return o(this,bl).id}get currentLayer(){return o(this,ne).get(o(this,_r))}getLayer(e){return o(this,ne).get(e)}get currentPageIndex(){return o(this,_r)}addLayer(e){o(this,ne).set(e.pageIndex,e),o(this,ki)?e.enable():e.disable()}removeLayer(e){o(this,ne).delete(e.pageIndex)}updateMode(e,t=null,s=!1){if(o(this,re)!==e){if(w(this,re,e),e===wt.NONE){this.setEditingState(!1),E(this,tt,ku).call(this);return}this.setEditingState(!0),E(this,tt,Cu).call(this),this.unselectAll();for(const i of o(this,ne).values())i.updateMode(e);if(!t&&s){this.addNewEditorFromKeyboard();return}if(t){for(const i of o(this,Xt).values())if(i.annotationElementId===t){this.setSelected(i),i.enterInEditMode();break}}}}addNewEditorFromKeyboard(){this.currentLayer.canCreateNewEmptyEditor()&&this.currentLayer.addNewEditor()}updateToolbar(e){e!==o(this,re)&&this._eventBus.dispatch("switchannotationeditormode",{source:this,mode:e})}updateParams(e,t){var s;if(o(this,is)){switch(e){case ut.CREATE:this.currentLayer.addNewEditor();return;case ut.HIGHLIGHT_DEFAULT_COLOR:(s=o(this,Va))==null||s.updateColor(t);break;case ut.HIGHLIGHT_SHOW_ALL:this._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:{type:"highlight",action:"toggle_visibility"}}}),(o(this,qa)||w(this,qa,new Map)).set(e,t),this.showAllEditors("highlight",t);break}for(const i of o(this,Ct))i.updateParams(e,t);for(const i of o(this,is))i.updateDefaultParams(e,t)}}showAllEditors(e,t,s=!1){var n;for(const r of o(this,Xt).values())r.editorType===e&&r.show(t);(((n=o(this,qa))==null?void 0:n.get(ut.HIGHLIGHT_SHOW_ALL))??!0)!==t&&E(this,tt,Ai).call(this,[[ut.HIGHLIGHT_SHOW_ALL,t]])}enableWaiting(e=!1){if(o(this,$a)!==e){w(this,$a,e);for(const t of o(this,ne).values())e?t.disableClick():t.enableClick(),t.div.classList.toggle("waiting",e)}}getEditors(e){const t=[];for(const s of o(this,Xt).values())s.pageIndex===e&&t.push(s);return t}getEditor(e){return o(this,Xt).get(e)}addEditor(e){o(this,Xt).set(e.id,e)}removeEditor(e){var t;e.div.contains(document.activeElement)&&(o(this,ys)&&clearTimeout(o(this,ys)),w(this,ys,setTimeout(()=>{this.focusMainContainer(),w(this,ys,null)},0))),o(this,Xt).delete(e.id),this.unselect(e),(!e.annotationElementId||!o(this,ln).has(e.annotationElementId))&&((t=o(this,Vs))==null||t.remove(e.id))}addDeletedAnnotationElement(e){o(this,ln).add(e.annotationElementId),this.addChangedExistingAnnotation(e),e.deleted=!0}isDeletedAnnotationElement(e){return o(this,ln).has(e)}removeDeletedAnnotationElement(e){o(this,ln).delete(e.annotationElementId),this.removeChangedExistingAnnotation(e),e.deleted=!1}setActiveEditor(e){o(this,De)!==e&&(w(this,De,e),e&&E(this,tt,Ai).call(this,e.propertiesToUpdate))}updateUI(e){o(this,tt,Tu)===e&&E(this,tt,Ai).call(this,e.propertiesToUpdate)}toggleSelected(e){if(o(this,Ct).has(e)){o(this,Ct).delete(e),e.unselect(),E(this,tt,be).call(this,{hasSelectedEditor:this.hasSelection});return}o(this,Ct).add(e),e.select(),E(this,tt,Ai).call(this,e.propertiesToUpdate),E(this,tt,be).call(this,{hasSelectedEditor:!0})}setSelected(e){for(const t of o(this,Ct))t!==e&&t.unselect();o(this,Ct).clear(),o(this,Ct).add(e),e.select(),E(this,tt,Ai).call(this,e.propertiesToUpdate),E(this,tt,be).call(this,{hasSelectedEditor:!0})}isSelected(e){return o(this,Ct).has(e)}get firstSelectedEditor(){return o(this,Ct).values().next().value}unselect(e){e.unselect(),o(this,Ct).delete(e),E(this,tt,be).call(this,{hasSelectedEditor:this.hasSelection})}get hasSelection(){return o(this,Ct).size!==0}get isEnterHandled(){return o(this,Ct).size===1&&this.firstSelectedEditor.isEnterHandled}undo(){o(this,ss).undo(),E(this,tt,be).call(this,{hasSomethingToUndo:o(this,ss).hasSomethingToUndo(),hasSomethingToRedo:!0,isEmpty:E(this,tt,Ea).call(this)})}redo(){o(this,ss).redo(),E(this,tt,be).call(this,{hasSomethingToUndo:!0,hasSomethingToRedo:o(this,ss).hasSomethingToRedo(),isEmpty:E(this,tt,Ea).call(this)})}addCommands(e){o(this,ss).add(e),E(this,tt,be).call(this,{hasSomethingToUndo:!0,hasSomethingToRedo:!1,isEmpty:E(this,tt,Ea).call(this)})}delete(){if(this.commitOrRemove(),!this.hasSelection)return;const e=[...o(this,Ct)],t=()=>{for(const i of e)i.remove()},s=()=>{for(const i of e)E(this,tt,lc).call(this,i)};this.addCommands({cmd:t,undo:s,mustExec:!0})}commitOrRemove(){var e;(e=o(this,De))==null||e.commitOrRemove()}hasSomethingToControl(){return o(this,De)||this.hasSelection}selectAll(){for(const e of o(this,Ct))e.commit();E(this,tt,cc).call(this,o(this,Xt).values())}unselectAll(){if(!(o(this,De)&&(o(this,De).commitOrRemove(),o(this,re)!==wt.NONE))&&this.hasSelection){for(const e of o(this,Ct))e.unselect();o(this,Ct).clear(),E(this,tt,be).call(this,{hasSelectedEditor:!1})}}translateSelectedEditors(e,t,s=!1){if(s||this.commitOrRemove(),!this.hasSelection)return;o(this,Ti)[0]+=e,o(this,Ti)[1]+=t;const[i,n]=o(this,Ti),r=[...o(this,Ct)],a=1e3;o(this,ws)&&clearTimeout(o(this,ws)),w(this,ws,setTimeout(()=>{w(this,ws,null),o(this,Ti)[0]=o(this,Ti)[1]=0,this.addCommands({cmd:()=>{for(const h of r)o(this,Xt).has(h.id)&&h.translateInPage(i,n)},undo:()=>{for(const h of r)o(this,Xt).has(h.id)&&h.translateInPage(-i,-n)},mustExec:!1})},a));for(const h of r)h.translateInPage(e,t)}setUpDragSession(){if(this.hasSelection){this.disableUserSelect(!0),w(this,vs,new Map);for(const e of o(this,Ct))o(this,vs).set(e,{savedX:e.x,savedY:e.y,savedPageIndex:e.pageIndex,newX:0,newY:0,newPageIndex:-1})}}endDragSession(){if(!o(this,vs))return!1;this.disableUserSelect(!1);const e=o(this,vs);w(this,vs,null);let t=!1;for(const[{x:i,y:n,pageIndex:r},a]of e)a.newX=i,a.newY=n,a.newPageIndex=r,t||(t=i!==a.savedX||n!==a.savedY||r!==a.savedPageIndex);if(!t)return!1;const s=(i,n,r,a)=>{if(o(this,Xt).has(i.id)){const h=o(this,ne).get(a);h?i._setParentAndPosition(h,n,r):(i.pageIndex=a,i.x=n,i.y=r)}};return this.addCommands({cmd:()=>{for(const[i,{newX:n,newY:r,newPageIndex:a}]of e)s(i,n,r,a)},undo:()=>{for(const[i,{savedX:n,savedY:r,savedPageIndex:a}]of e)s(i,n,r,a)},mustExec:!0}),!0}dragSelectedEditors(e,t){if(o(this,vs))for(const s of o(this,vs).keys())s.drag(e,t)}rebuild(e){if(e.parent===null){const t=this.getLayer(e.pageIndex);t?(t.changeParent(e),t.addOrRebuild(e)):(this.addEditor(e),this.addToAnnotationStorage(e),e.rebuild())}else e.parent.addOrRebuild(e)}get isEditorHandlingKeyboard(){var e;return((e=this.getActive())==null?void 0:e.shouldGetKeyboardEvents())||o(this,Ct).size===1&&this.firstSelectedEditor.shouldGetKeyboardEvents()}isActive(e){return o(this,De)===e}getActive(){return o(this,De)}getMode(){return o(this,re)}get imageManager(){return Et(this,"imageManager",new ic)}getSelectionBoxes(e){if(!e)return null;const t=document.getSelection();for(let l=0,c=t.rangeCount;l<c;l++)if(!e.contains(t.getRangeAt(l).commonAncestorContainer))return null;const{x:s,y:i,width:n,height:r}=e.getBoundingClientRect();let a;switch(e.getAttribute("data-main-rotation")){case"90":a=(l,c,d,p)=>({x:(c-i)/r,y:1-(l+d-s)/n,width:p/r,height:d/n});break;case"180":a=(l,c,d,p)=>({x:1-(l+d-s)/n,y:1-(c+p-i)/r,width:d/n,height:p/r});break;case"270":a=(l,c,d,p)=>({x:1-(c+p-i)/r,y:(l-s)/n,width:p/r,height:d/n});break;default:a=(l,c,d,p)=>({x:(l-s)/n,y:(c-i)/r,width:d/n,height:p/r});break}const h=[];for(let l=0,c=t.rangeCount;l<c;l++){const d=t.getRangeAt(l);if(!d.collapsed)for(const{x:p,y:f,width:g,height:m}of d.getClientRects())g===0||m===0||h.push(a(p,f,g,m))}return h.length===0?null:h}addChangedExistingAnnotation({annotationElementId:e,id:t}){(o(this,br)||w(this,br,new Map)).set(e,t)}removeChangedExistingAnnotation({annotationElementId:e}){var t;(t=o(this,br))==null||t.delete(e)}renderAnnotationElement(e){var i;const t=(i=o(this,br))==null?void 0:i.get(e.data.id);if(!t)return;const s=o(this,Vs).getRawValue(t);s&&(o(this,re)===wt.NONE&&!s.hasBeenModified||s.renderAnnotationElement(e))}};gr=new WeakMap,De=new WeakMap,Xt=new WeakMap,ne=new WeakMap,mr=new WeakMap,Vs=new WeakMap,br=new WeakMap,ss=new WeakMap,_r=new WeakMap,ln=new WeakMap,vs=new WeakMap,is=new WeakMap,cn=new WeakMap,Wa=new WeakMap,Ga=new WeakMap,ys=new WeakMap,vr=new WeakMap,Ci=new WeakMap,As=new WeakMap,bl=new WeakMap,ki=new WeakMap,$a=new WeakMap,dn=new WeakMap,Va=new WeakMap,yr=new WeakMap,re=new WeakMap,Ct=new WeakMap,qs=new WeakMap,un=new WeakMap,qa=new WeakMap,Xa=new WeakMap,Ya=new WeakMap,Ka=new WeakMap,Za=new WeakMap,Qa=new WeakMap,Ja=new WeakMap,to=new WeakMap,eo=new WeakMap,so=new WeakMap,io=new WeakMap,no=new WeakMap,ro=new WeakMap,Ti=new WeakMap,ws=new WeakMap,Xs=new WeakMap,ao=new WeakMap,tt=new WeakSet,Dh=function({anchorNode:e}){return e.nodeType===Node.TEXT_NODE?e.parentElement:e},vu=function(){const e=document.getSelection();if(!e||e.isCollapsed)return;const s=E(this,tt,Dh).call(this,e).closest(".textLayer"),i=this.getSelectionBoxes(s);i&&(o(this,As)||w(this,As,new Jp(this)),o(this,As).show(s,i,this.direction==="ltr"))},yu=function(){var n,r,a;const e=document.getSelection();if(!e||e.isCollapsed){o(this,qs)&&((n=o(this,As))==null||n.hide(),w(this,qs,null),E(this,tt,be).call(this,{hasSelectedText:!1}));return}const{anchorNode:t}=e;if(t===o(this,qs))return;if(!E(this,tt,Dh).call(this,e).closest(".textLayer")){o(this,qs)&&((r=o(this,As))==null||r.hide(),w(this,qs,null),E(this,tt,be).call(this,{hasSelectedText:!1}));return}if((a=o(this,As))==null||a.hide(),w(this,qs,t),E(this,tt,be).call(this,{hasSelectedText:!0}),!(o(this,re)!==wt.HIGHLIGHT&&o(this,re)!==wt.NONE)&&(o(this,re)===wt.HIGHLIGHT&&this.showAllEditors("highlight",!0,!0),w(this,Ci,this.isShiftKeyDown),!this.isShiftKeyDown)){const h=this._signal,l=c=>{c.type==="pointerup"&&c.button!==0||(window.removeEventListener("pointerup",l),window.removeEventListener("blur",l),c.type==="pointerup"&&E(this,tt,Oh).call(this,"main_toolbar"))};window.addEventListener("pointerup",l,{signal:h}),window.addEventListener("blur",l,{signal:h})}},Oh=function(e=""){o(this,re)===wt.HIGHLIGHT?this.highlightSelection(e):o(this,Wa)&&E(this,tt,vu).call(this)},Au=function(){document.addEventListener("selectionchange",E(this,tt,yu).bind(this),{signal:this._signal})},wu=function(){const e=this._signal;window.addEventListener("focus",o(this,Ya),{signal:e}),window.addEventListener("blur",o(this,Xa),{signal:e})},Eu=function(){window.removeEventListener("focus",o(this,Ya)),window.removeEventListener("blur",o(this,Xa))},ac=function(){const e=this._signal;window.addEventListener("keydown",o(this,Ja),{signal:e}),window.addEventListener("keyup",o(this,to),{signal:e})},Su=function(){window.removeEventListener("keydown",o(this,Ja)),window.removeEventListener("keyup",o(this,to))},oc=function(){const e=this._signal;document.addEventListener("copy",o(this,Ka),{signal:e}),document.addEventListener("cut",o(this,Za),{signal:e}),document.addEventListener("paste",o(this,Qa),{signal:e})},hc=function(){document.removeEventListener("copy",o(this,Ka)),document.removeEventListener("cut",o(this,Za)),document.removeEventListener("paste",o(this,Qa))},xu=function(){const e=this._signal;document.addEventListener("dragover",this.dragOver.bind(this),{signal:e}),document.addEventListener("drop",this.drop.bind(this),{signal:e})},be=function(e){Object.entries(e).some(([s,i])=>o(this,ro)[s]!==i)&&(this._eventBus.dispatch("annotationeditorstateschanged",{source:this,details:Object.assign(o(this,ro),e)}),o(this,re)===wt.HIGHLIGHT&&e.hasSelectedEditor===!1&&E(this,tt,Ai).call(this,[[ut.HIGHLIGHT_FREE,!0]]))},Ai=function(e){this._eventBus.dispatch("annotationeditorparamschanged",{source:this,details:e})},Cu=function(){if(!o(this,ki)){w(this,ki,!0);for(const e of o(this,ne).values())e.enable();for(const e of o(this,Xt).values())e.enable()}},ku=function(){if(this.unselectAll(),o(this,ki)){w(this,ki,!1);for(const e of o(this,ne).values())e.disable();for(const e of o(this,Xt).values())e.disable()}},lc=function(e){const t=o(this,ne).get(e.pageIndex);t?t.addOrRebuild(e):(this.addEditor(e),this.addToAnnotationStorage(e))},Tu=function(){let e=null;for(e of o(this,Ct));return e},Ea=function(){if(o(this,Xt).size===0)return!0;if(o(this,Xt).size===1)for(const e of o(this,Xt).values())return e.isEmpty();return!1},cc=function(e){for(const t of o(this,Ct))t.unselect();o(this,Ct).clear();for(const t of e)t.isEmpty()||(o(this,Ct).add(t),t.select());E(this,tt,be).call(this,{hasSelectedEditor:this.hasSelection})},ft(ur,"TRANSLATE_SMALL",1),ft(ur,"TRANSLATE_BIG",10);let Qn=ur;var Ys,Ks,ns,Zs,Oe,Ar,rs,oo,dc;const Us=class Us{constructor(e){S(this,oo);S(this,Ys,"");S(this,Ks,!1);S(this,ns,null);S(this,Zs,null);S(this,Oe,null);S(this,Ar,!1);S(this,rs,null);w(this,rs,e)}static initialize(e){Us._l10nPromise||(Us._l10nPromise=e)}async render(){const e=w(this,ns,document.createElement("button"));e.className="altText";const t=await Us._l10nPromise.get("pdfjs-editor-alt-text-button-label");e.textContent=t,e.setAttribute("aria-label",t),e.tabIndex="0";const s=o(this,rs)._uiManager._signal;e.addEventListener("contextmenu",Re,{signal:s}),e.addEventListener("pointerdown",n=>n.stopPropagation(),{signal:s});const i=n=>{n.preventDefault(),o(this,rs)._uiManager.editAltText(o(this,rs))};return e.addEventListener("click",i,{capture:!0,signal:s}),e.addEventListener("keydown",n=>{n.target===e&&n.key==="Enter"&&(w(this,Ar,!0),i(n))},{signal:s}),await E(this,oo,dc).call(this),e}finish(){o(this,ns)&&(o(this,ns).focus({focusVisible:o(this,Ar)}),w(this,Ar,!1))}isEmpty(){return!o(this,Ys)&&!o(this,Ks)}get data(){return{altText:o(this,Ys),decorative:o(this,Ks)}}set data({altText:e,decorative:t}){o(this,Ys)===e&&o(this,Ks)===t||(w(this,Ys,e),w(this,Ks,t),E(this,oo,dc).call(this))}toggle(e=!1){o(this,ns)&&(!e&&o(this,Oe)&&(clearTimeout(o(this,Oe)),w(this,Oe,null)),o(this,ns).disabled=!e)}destroy(){var e;(e=o(this,ns))==null||e.remove(),w(this,ns,null),w(this,Zs,null)}};Ys=new WeakMap,Ks=new WeakMap,ns=new WeakMap,Zs=new WeakMap,Oe=new WeakMap,Ar=new WeakMap,rs=new WeakMap,oo=new WeakSet,dc=async function(){var i;const e=o(this,ns);if(!e)return;if(!o(this,Ys)&&!o(this,Ks)){e.classList.remove("done"),(i=o(this,Zs))==null||i.remove();return}e.classList.add("done"),Us._l10nPromise.get("pdfjs-editor-alt-text-edit-button-label").then(n=>{e.setAttribute("aria-label",n)});let t=o(this,Zs);if(!t){w(this,Zs,t=document.createElement("span")),t.className="tooltip",t.setAttribute("role","tooltip");const n=t.id=`alt-text-tooltip-${o(this,rs).id}`;e.setAttribute("aria-describedby",n);const r=100,a=o(this,rs)._uiManager._signal;a.addEventListener("abort",()=>{clearTimeout(o(this,Oe)),w(this,Oe,null)},{once:!0}),e.addEventListener("mouseenter",()=>{w(this,Oe,setTimeout(()=>{w(this,Oe,null),o(this,Zs).classList.add("show"),o(this,rs)._reportTelemetry({action:"alt_text_tooltip"})},r))},{signal:a}),e.addEventListener("mouseleave",()=>{var h;o(this,Oe)&&(clearTimeout(o(this,Oe)),w(this,Oe,null)),(h=o(this,Zs))==null||h.classList.remove("show")},{signal:a})}t.innerText=o(this,Ks)?await Us._l10nPromise.get("pdfjs-editor-alt-text-decorative-tooltip"):o(this,Ys),t.parentNode||e.append(t);const s=o(this,rs).getImageForAltText();s==null||s.setAttribute("aria-describedby",t.id)},ft(Us,"_l10nPromise",null);let rl=Us;var fn,as,pe,wr,pn,ae,gn,Er,Sr,ge,ho,mn,Ri,lo,bn,Qs,Es,xr,Cr,qe,co,_l,mt,uc,uo,fc,pc,Ru,Pu,gc,mc,bc,Lu,Iu,Mu,Fu,_c,Sa;const It=class It{constructor(e){S(this,mt);S(this,fn,null);S(this,as,null);S(this,pe,null);S(this,wr,!1);S(this,pn,!1);S(this,ae,null);S(this,gn,null);S(this,Er,this.focusin.bind(this));S(this,Sr,this.focusout.bind(this));S(this,ge,null);S(this,ho,"");S(this,mn,!1);S(this,Ri,null);S(this,lo,!1);S(this,bn,!1);S(this,Qs,!1);S(this,Es,null);S(this,xr,0);S(this,Cr,0);S(this,qe,null);ft(this,"_initialOptions",Object.create(null));ft(this,"_isVisible",!0);ft(this,"_uiManager",null);ft(this,"_focusEventsAllowed",!0);ft(this,"_l10nPromise",null);S(this,co,!1);S(this,_l,It._zIndex++);this.constructor===It&&Rt("Cannot initialize AnnotationEditor."),this.parent=e.parent,this.id=e.id,this.width=this.height=null,this.pageIndex=e.parent.pageIndex,this.name=e.name,this.div=null,this._uiManager=e.uiManager,this.annotationElementId=null,this._willKeepAspectRatio=!1,this._initialOptions.isCentered=e.isCentered,this._structTreeParentId=null;const{rotation:t,rawDims:{pageWidth:s,pageHeight:i,pageX:n,pageY:r}}=this.parent.viewport;this.rotation=t,this.pageRotation=(360+t-this._uiManager.viewParameters.rotation)%360,this.pageDimensions=[s,i],this.pageTranslation=[n,r];const[a,h]=this.parentDimensions;this.x=e.x/a,this.y=e.y/h,this.isAttachedToDOM=!1,this.deleted=!1}static get _resizerKeyboardManager(){const e=It.prototype._resizeWithKeyboard,t=Qn.TRANSLATE_SMALL,s=Qn.TRANSLATE_BIG;return Et(this,"_resizerKeyboardManager",new _h([[["ArrowLeft","mac+ArrowLeft"],e,{args:[-t,0]}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],e,{args:[-s,0]}],[["ArrowRight","mac+ArrowRight"],e,{args:[t,0]}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],e,{args:[s,0]}],[["ArrowUp","mac+ArrowUp"],e,{args:[0,-t]}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],e,{args:[0,-s]}],[["ArrowDown","mac+ArrowDown"],e,{args:[0,t]}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],e,{args:[0,s]}],[["Escape","mac+Escape"],It.prototype._stopResizingWithKeyboard]]))}get editorType(){return Object.getPrototypeOf(this).constructor._type}static get _defaultLineColor(){return Et(this,"_defaultLineColor",this._colorManager.getHexCode("CanvasText"))}static deleteAnnotationElement(e){const t=new ig({id:e.parent.getNextId(),parent:e.parent,uiManager:e._uiManager});t.annotationElementId=e.annotationElementId,t.deleted=!0,t._uiManager.addToAnnotationStorage(t)}static initialize(e,t,s){if(It._l10nPromise||(It._l10nPromise=new Map(["pdfjs-editor-alt-text-button-label","pdfjs-editor-alt-text-edit-button-label","pdfjs-editor-alt-text-decorative-tooltip","pdfjs-editor-resizer-label-topLeft","pdfjs-editor-resizer-label-topMiddle","pdfjs-editor-resizer-label-topRight","pdfjs-editor-resizer-label-middleRight","pdfjs-editor-resizer-label-bottomRight","pdfjs-editor-resizer-label-bottomMiddle","pdfjs-editor-resizer-label-bottomLeft","pdfjs-editor-resizer-label-middleLeft"].map(n=>[n,e.get(n.replaceAll(/([A-Z])/g,r=>`-${r.toLowerCase()}`))]))),s!=null&&s.strings)for(const n of s.strings)It._l10nPromise.set(n,e.get(n));if(It._borderLineWidth!==-1)return;const i=getComputedStyle(document.documentElement);It._borderLineWidth=parseFloat(i.getPropertyValue("--outline-width"))||0}static updateDefaultParams(e,t){}static get defaultPropertiesToUpdate(){return[]}static isHandlingMimeForPasting(e){return!1}static paste(e,t){Rt("Not implemented")}get propertiesToUpdate(){return[]}get _isDraggable(){return o(this,co)}set _isDraggable(e){var t;w(this,co,e),(t=this.div)==null||t.classList.toggle("draggable",e)}get isEnterHandled(){return!0}center(){const[e,t]=this.pageDimensions;switch(this.parentRotation){case 90:this.x-=this.height*t/(e*2),this.y+=this.width*e/(t*2);break;case 180:this.x+=this.width/2,this.y+=this.height/2;break;case 270:this.x+=this.height*t/(e*2),this.y-=this.width*e/(t*2);break;default:this.x-=this.width/2,this.y-=this.height/2;break}this.fixAndSetPosition()}addCommands(e){this._uiManager.addCommands(e)}get currentLayer(){return this._uiManager.currentLayer}setInBackground(){this.div.style.zIndex=0}setInForeground(){this.div.style.zIndex=o(this,_l)}setParent(e){e!==null?(this.pageIndex=e.pageIndex,this.pageDimensions=e.pageDimensions):E(this,mt,Sa).call(this),this.parent=e}focusin(e){this._focusEventsAllowed&&(o(this,mn)?w(this,mn,!1):this.parent.setSelected(this))}focusout(e){var s;if(!this._focusEventsAllowed||!this.isAttachedToDOM)return;const t=e.relatedTarget;t!=null&&t.closest(`#${this.id}`)||(e.preventDefault(),(s=this.parent)!=null&&s.isMultipleSelection||this.commitOrRemove())}commitOrRemove(){this.isEmpty()?this.remove():this.commit()}commit(){this.addToAnnotationStorage()}addToAnnotationStorage(){this._uiManager.addToAnnotationStorage(this)}setAt(e,t,s,i){const[n,r]=this.parentDimensions;[s,i]=this.screenToPageTranslation(s,i),this.x=(e+s)/n,this.y=(t+i)/r,this.fixAndSetPosition()}translate(e,t){E(this,mt,uc).call(this,this.parentDimensions,e,t)}translateInPage(e,t){o(this,Ri)||w(this,Ri,[this.x,this.y]),E(this,mt,uc).call(this,this.pageDimensions,e,t),this.div.scrollIntoView({block:"nearest"})}drag(e,t){o(this,Ri)||w(this,Ri,[this.x,this.y]);const[s,i]=this.parentDimensions;if(this.x+=e/s,this.y+=t/i,this.parent&&(this.x<0||this.x>1||this.y<0||this.y>1)){const{x:l,y:c}=this.div.getBoundingClientRect();this.parent.findNewParent(this,l,c)&&(this.x-=Math.floor(this.x),this.y-=Math.floor(this.y))}let{x:n,y:r}=this;const[a,h]=this.getBaseTranslation();n+=a,r+=h,this.div.style.left=`${(100*n).toFixed(2)}%`,this.div.style.top=`${(100*r).toFixed(2)}%`,this.div.scrollIntoView({block:"nearest"})}get _hasBeenMoved(){return!!o(this,Ri)&&(o(this,Ri)[0]!==this.x||o(this,Ri)[1]!==this.y)}getBaseTranslation(){const[e,t]=this.parentDimensions,{_borderLineWidth:s}=It,i=s/e,n=s/t;switch(this.rotation){case 90:return[-i,n];case 180:return[i,n];case 270:return[i,-n];default:return[-i,-n]}}get _mustFixPosition(){return!0}fixAndSetPosition(e=this.rotation){const[t,s]=this.pageDimensions;let{x:i,y:n,width:r,height:a}=this;if(r*=t,a*=s,i*=t,n*=s,this._mustFixPosition)switch(e){case 0:i=Math.max(0,Math.min(t-r,i)),n=Math.max(0,Math.min(s-a,n));break;case 90:i=Math.max(0,Math.min(t-a,i)),n=Math.min(s,Math.max(r,n));break;case 180:i=Math.min(t,Math.max(r,i)),n=Math.min(s,Math.max(a,n));break;case 270:i=Math.min(t,Math.max(a,i)),n=Math.max(0,Math.min(s-r,n));break}this.x=i/=t,this.y=n/=s;const[h,l]=this.getBaseTranslation();i+=h,n+=l;const{style:c}=this.div;c.left=`${(100*i).toFixed(2)}%`,c.top=`${(100*n).toFixed(2)}%`,this.moveInDOM()}screenToPageTranslation(e,t){var s;return E(s=It,uo,fc).call(s,e,t,this.parentRotation)}pageTranslationToScreen(e,t){var s;return E(s=It,uo,fc).call(s,e,t,360-this.parentRotation)}get parentScale(){return this._uiManager.viewParameters.realScale}get parentRotation(){return(this._uiManager.viewParameters.rotation+this.pageRotation)%360}get parentDimensions(){const{parentScale:e,pageDimensions:[t,s]}=this,i=t*e,n=s*e;return ke.isCSSRoundSupported?[Math.round(i),Math.round(n)]:[i,n]}setDims(e,t){const[s,i]=this.parentDimensions;this.div.style.width=`${(100*e/s).toFixed(2)}%`,o(this,pn)||(this.div.style.height=`${(100*t/i).toFixed(2)}%`)}fixDims(){const{style:e}=this.div,{height:t,width:s}=e,i=s.endsWith("%"),n=!o(this,pn)&&t.endsWith("%");if(i&&n)return;const[r,a]=this.parentDimensions;i||(e.width=`${(100*parseFloat(s)/r).toFixed(2)}%`),!o(this,pn)&&!n&&(e.height=`${(100*parseFloat(t)/a).toFixed(2)}%`)}getInitialTranslation(){return[0,0]}altTextFinish(){var e;(e=o(this,pe))==null||e.finish()}async addEditToolbar(){return o(this,ge)||o(this,bn)?o(this,ge):(w(this,ge,new ec(this)),this.div.append(o(this,ge).render()),o(this,pe)&&o(this,ge).addAltTextButton(await o(this,pe).render()),o(this,ge))}removeEditToolbar(){var e;o(this,ge)&&(o(this,ge).remove(),w(this,ge,null),(e=o(this,pe))==null||e.destroy())}getClientDimensions(){return this.div.getBoundingClientRect()}async addAltTextButton(){o(this,pe)||(rl.initialize(It._l10nPromise),w(this,pe,new rl(this)),o(this,fn)&&(o(this,pe).data=o(this,fn),w(this,fn,null)),await this.addEditToolbar())}get altTextData(){var e;return(e=o(this,pe))==null?void 0:e.data}set altTextData(e){o(this,pe)&&(o(this,pe).data=e)}hasAltText(){var e;return!((e=o(this,pe))!=null&&e.isEmpty())}render(){this.div=document.createElement("div"),this.div.setAttribute("data-editor-rotation",(360-this.rotation)%360),this.div.className=this.name,this.div.setAttribute("id",this.id),this.div.tabIndex=o(this,wr)?-1:0,this._isVisible||this.div.classList.add("hidden"),this.setInForeground();const e=this._uiManager._signal;this.div.addEventListener("focusin",o(this,Er),{signal:e}),this.div.addEventListener("focusout",o(this,Sr),{signal:e});const[t,s]=this.parentDimensions;this.parentRotation%180!==0&&(this.div.style.maxWidth=`${(100*s/t).toFixed(2)}%`,this.div.style.maxHeight=`${(100*t/s).toFixed(2)}%`);const[i,n]=this.getInitialTranslation();return this.translate(i,n),nl(this,this.div,["pointerdown"]),this.div}pointerdown(e){const{isMac:t}=ke.platform;if(e.button!==0||e.ctrlKey&&t){e.preventDefault();return}if(w(this,mn,!0),this._isDraggable){E(this,mt,Lu).call(this,e);return}E(this,mt,bc).call(this,e)}moveInDOM(){o(this,Es)&&clearTimeout(o(this,Es)),w(this,Es,setTimeout(()=>{var e;w(this,Es,null),(e=this.parent)==null||e.moveEditorInDOM(this)},0))}_setParentAndPosition(e,t,s){e.changeParent(this),this.x=t,this.y=s,this.fixAndSetPosition()}getRect(e,t,s=this.rotation){const i=this.parentScale,[n,r]=this.pageDimensions,[a,h]=this.pageTranslation,l=e/i,c=t/i,d=this.x*n,p=this.y*r,f=this.width*n,g=this.height*r;switch(s){case 0:return[d+l+a,r-p-c-g+h,d+l+f+a,r-p-c+h];case 90:return[d+c+a,r-p+l+h,d+c+g+a,r-p+l+f+h];case 180:return[d-l-f+a,r-p+c+h,d-l+a,r-p+c+g+h];case 270:return[d-c-g+a,r-p-l-f+h,d-c+a,r-p-l+h];default:throw new Error("Invalid rotation")}}getRectInCurrentCoords(e,t){const[s,i,n,r]=e,a=n-s,h=r-i;switch(this.rotation){case 0:return[s,t-r,a,h];case 90:return[s,t-i,h,a];case 180:return[n,t-i,a,h];case 270:return[n,t-r,h,a];default:throw new Error("Invalid rotation")}}onceAdded(){}isEmpty(){return!1}enableEditMode(){w(this,bn,!0)}disableEditMode(){w(this,bn,!1)}isInEditMode(){return o(this,bn)}shouldGetKeyboardEvents(){return o(this,Qs)}needsToBeRebuilt(){return this.div&&!this.isAttachedToDOM}rebuild(){var t,s;const e=this._uiManager._signal;(t=this.div)==null||t.addEventListener("focusin",o(this,Er),{signal:e}),(s=this.div)==null||s.addEventListener("focusout",o(this,Sr),{signal:e})}rotate(e){}serialize(e=!1,t=null){Rt("An editor must be serializable")}static deserialize(e,t,s){const i=new this.prototype.constructor({parent:t,id:t.getNextId(),uiManager:s});i.rotation=e.rotation,w(i,fn,e.accessibilityData);const[n,r]=i.pageDimensions,[a,h,l,c]=i.getRectInCurrentCoords(e.rect,r);return i.x=a/n,i.y=h/r,i.width=l/n,i.height=c/r,i}get hasBeenModified(){return!!this.annotationElementId&&(this.deleted||this.serialize()!==null)}remove(){if(this.div.removeEventListener("focusin",o(this,Er)),this.div.removeEventListener("focusout",o(this,Sr)),this.isEmpty()||this.commit(),this.parent?this.parent.remove(this):this._uiManager.removeEditor(this),o(this,Es)&&(clearTimeout(o(this,Es)),w(this,Es,null)),E(this,mt,Sa).call(this),this.removeEditToolbar(),o(this,qe)){for(const e of o(this,qe).values())clearTimeout(e);w(this,qe,null)}this.parent=null}get isResizable(){return!1}makeResizable(){this.isResizable&&(E(this,mt,Ru).call(this),o(this,ae).classList.remove("hidden"),nl(this,this.div,["keydown"]))}get toolbarPosition(){return null}keydown(e){if(!this.isResizable||e.target!==this.div||e.key!=="Enter")return;this._uiManager.setSelected(this),w(this,gn,{savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height});const t=o(this,ae).children;if(!o(this,as)){w(this,as,Array.from(t));const r=E(this,mt,Iu).bind(this),a=E(this,mt,Mu).bind(this),h=this._uiManager._signal;for(const l of o(this,as)){const c=l.getAttribute("data-resizer-name");l.setAttribute("role","spinbutton"),l.addEventListener("keydown",r,{signal:h}),l.addEventListener("blur",a,{signal:h}),l.addEventListener("focus",E(this,mt,Fu).bind(this,c),{signal:h}),It._l10nPromise.get(`pdfjs-editor-resizer-label-${c}`).then(d=>l.setAttribute("aria-label",d))}}const s=o(this,as)[0];let i=0;for(const r of t){if(r===s)break;i++}const n=(360-this.rotation+this.parentRotation)%360/90*(o(this,as).length/4);if(n!==i){if(n<i)for(let a=0;a<i-n;a++)o(this,ae).append(o(this,ae).firstChild);else if(n>i)for(let a=0;a<n-i;a++)o(this,ae).firstChild.before(o(this,ae).lastChild);let r=0;for(const a of t){const l=o(this,as)[r++].getAttribute("data-resizer-name");It._l10nPromise.get(`pdfjs-editor-resizer-label-${l}`).then(c=>a.setAttribute("aria-label",c))}}E(this,mt,_c).call(this,0),w(this,Qs,!0),o(this,ae).firstChild.focus({focusVisible:!0}),e.preventDefault(),e.stopImmediatePropagation()}_resizeWithKeyboard(e,t){o(this,Qs)&&E(this,mt,mc).call(this,o(this,ho),{movementX:e,movementY:t})}_stopResizingWithKeyboard(){E(this,mt,Sa).call(this),this.div.focus()}select(){var e,t;if(this.makeResizable(),(e=this.div)==null||e.classList.add("selectedEditor"),!o(this,ge)){this.addEditToolbar().then(()=>{var s,i;(s=this.div)!=null&&s.classList.contains("selectedEditor")&&((i=o(this,ge))==null||i.show())});return}(t=o(this,ge))==null||t.show()}unselect(){var e,t,s,i;(e=o(this,ae))==null||e.classList.add("hidden"),(t=this.div)==null||t.classList.remove("selectedEditor"),(s=this.div)!=null&&s.contains(document.activeElement)&&this._uiManager.currentLayer.div.focus({preventScroll:!0}),(i=o(this,ge))==null||i.hide()}updateParams(e,t){}disableEditing(){}enableEditing(){}enterInEditMode(){}getImageForAltText(){return null}get contentDiv(){return this.div}get isEditing(){return o(this,lo)}set isEditing(e){w(this,lo,e),this.parent&&(e?(this.parent.setSelected(this),this.parent.setActiveEditor(this)):this.parent.setActiveEditor(null))}setAspectRatio(e,t){w(this,pn,!0);const s=e/t,{style:i}=this.div;i.aspectRatio=s,i.height="auto"}static get MIN_SIZE(){return 16}static canCreateNewEmptyEditor(){return!0}get telemetryInitialData(){return{action:"added"}}get telemetryFinalData(){return null}_reportTelemetry(e,t=!1){if(t){o(this,qe)||w(this,qe,new Map);const{action:s}=e;let i=o(this,qe).get(s);i&&clearTimeout(i),i=setTimeout(()=>{this._reportTelemetry(e),o(this,qe).delete(s),o(this,qe).size===0&&w(this,qe,null)},It._telemetryTimeout),o(this,qe).set(s,i);return}e.type||(e.type=this.editorType),this._uiManager._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:e}})}show(e=this._isVisible){this.div.classList.toggle("hidden",!e),this._isVisible=e}enable(){this.div&&(this.div.tabIndex=0),w(this,wr,!1)}disable(){this.div&&(this.div.tabIndex=-1),w(this,wr,!0)}renderAnnotationElement(e){let t=e.container.querySelector(".annotationContent");if(!t)t=document.createElement("div"),t.classList.add("annotationContent",this.editorType),e.container.prepend(t);else if(t.nodeName==="CANVAS"){const s=t;t=document.createElement("div"),t.classList.add("annotationContent",this.editorType),s.before(t)}return t}resetAnnotationElement(e){const{firstChild:t}=e.container;t.nodeName==="DIV"&&t.classList.contains("annotationContent")&&t.remove()}};fn=new WeakMap,as=new WeakMap,pe=new WeakMap,wr=new WeakMap,pn=new WeakMap,ae=new WeakMap,gn=new WeakMap,Er=new WeakMap,Sr=new WeakMap,ge=new WeakMap,ho=new WeakMap,mn=new WeakMap,Ri=new WeakMap,lo=new WeakMap,bn=new WeakMap,Qs=new WeakMap,Es=new WeakMap,xr=new WeakMap,Cr=new WeakMap,qe=new WeakMap,co=new WeakMap,_l=new WeakMap,mt=new WeakSet,uc=function([e,t],s,i){[s,i]=this.screenToPageTranslation(s,i),this.x+=s/e,this.y+=i/t,this.fixAndSetPosition()},uo=new WeakSet,fc=function(e,t,s){switch(s){case 90:return[t,-e];case 180:return[-e,-t];case 270:return[-t,e];default:return[e,t]}},pc=function(e){switch(e){case 90:{const[t,s]=this.pageDimensions;return[0,-t/s,s/t,0]}case 180:return[-1,0,0,-1];case 270:{const[t,s]=this.pageDimensions;return[0,t/s,-s/t,0]}default:return[1,0,0,1]}},Ru=function(){if(o(this,ae))return;w(this,ae,document.createElement("div")),o(this,ae).classList.add("resizers");const e=this._willKeepAspectRatio?["topLeft","topRight","bottomRight","bottomLeft"]:["topLeft","topMiddle","topRight","middleRight","bottomRight","bottomMiddle","bottomLeft","middleLeft"],t=this._uiManager._signal;for(const s of e){const i=document.createElement("div");o(this,ae).append(i),i.classList.add("resizer",s),i.setAttribute("data-resizer-name",s),i.addEventListener("pointerdown",E(this,mt,Pu).bind(this,s),{signal:t}),i.addEventListener("contextmenu",Re,{signal:t}),i.tabIndex=-1}this.div.prepend(o(this,ae))},Pu=function(e,t){var m;t.preventDefault();const{isMac:s}=ke.platform;if(t.button!==0||t.ctrlKey&&s)return;(m=o(this,pe))==null||m.toggle(!1);const i=E(this,mt,mc).bind(this,e),n=this._isDraggable;this._isDraggable=!1;const r=this._uiManager._signal,a={passive:!0,capture:!0,signal:r};this.parent.togglePointerEvents(!1),window.addEventListener("pointermove",i,a),window.addEventListener("contextmenu",Re,{signal:r});const h=this.x,l=this.y,c=this.width,d=this.height,p=this.parent.div.style.cursor,f=this.div.style.cursor;this.div.style.cursor=this.parent.div.style.cursor=window.getComputedStyle(t.target).cursor;const g=()=>{var v;this.parent.togglePointerEvents(!0),(v=o(this,pe))==null||v.toggle(!0),this._isDraggable=n,window.removeEventListener("pointerup",g),window.removeEventListener("blur",g),window.removeEventListener("pointermove",i,a),window.removeEventListener("contextmenu",Re),this.parent.div.style.cursor=p,this.div.style.cursor=f,E(this,mt,gc).call(this,h,l,c,d)};window.addEventListener("pointerup",g,{signal:r}),window.addEventListener("blur",g,{signal:r})},gc=function(e,t,s,i){const n=this.x,r=this.y,a=this.width,h=this.height;n===e&&r===t&&a===s&&h===i||this.addCommands({cmd:()=>{this.width=a,this.height=h,this.x=n,this.y=r;const[l,c]=this.parentDimensions;this.setDims(l*a,c*h),this.fixAndSetPosition()},undo:()=>{this.width=s,this.height=i,this.x=e,this.y=t;const[l,c]=this.parentDimensions;this.setDims(l*s,c*i),this.fixAndSetPosition()},mustExec:!0})},mc=function(e,t){const[s,i]=this.parentDimensions,n=this.x,r=this.y,a=this.width,h=this.height,l=It.MIN_SIZE/s,c=It.MIN_SIZE/i,d=U=>Math.round(U*1e4)/1e4,p=E(this,mt,pc).call(this,this.rotation),f=(U,Q)=>[p[0]*U+p[2]*Q,p[1]*U+p[3]*Q],g=E(this,mt,pc).call(this,360-this.rotation),m=(U,Q)=>[g[0]*U+g[2]*Q,g[1]*U+g[3]*Q];let v,b,A=!1,x=!1;switch(e){case"topLeft":A=!0,v=(U,Q)=>[0,0],b=(U,Q)=>[U,Q];break;case"topMiddle":v=(U,Q)=>[U/2,0],b=(U,Q)=>[U/2,Q];break;case"topRight":A=!0,v=(U,Q)=>[U,0],b=(U,Q)=>[0,Q];break;case"middleRight":x=!0,v=(U,Q)=>[U,Q/2],b=(U,Q)=>[0,Q/2];break;case"bottomRight":A=!0,v=(U,Q)=>[U,Q],b=(U,Q)=>[0,0];break;case"bottomMiddle":v=(U,Q)=>[U/2,Q],b=(U,Q)=>[U/2,0];break;case"bottomLeft":A=!0,v=(U,Q)=>[0,Q],b=(U,Q)=>[U,0];break;case"middleLeft":x=!0,v=(U,Q)=>[0,Q/2],b=(U,Q)=>[U,Q/2];break}const k=v(a,h),T=b(a,h);let L=f(...T);const I=d(n+L[0]),B=d(r+L[1]);let D=1,W=1,[q,P]=this.screenToPageTranslation(t.movementX,t.movementY);if([q,P]=m(q/s,P/i),A){const U=Math.hypot(a,h);D=W=Math.max(Math.min(Math.hypot(T[0]-k[0]-q,T[1]-k[1]-P)/U,1/a,1/h),l/a,c/h)}else x?D=Math.max(l,Math.min(1,Math.abs(T[0]-k[0]-q)))/a:W=Math.max(c,Math.min(1,Math.abs(T[1]-k[1]-P)))/h;const z=d(a*D),y=d(h*W);L=f(...b(z,y));const H=I-L[0],rt=B-L[1];this.width=z,this.height=y,this.x=H,this.y=rt,this.setDims(s*z,i*y),this.fixAndSetPosition()},bc=function(e){const{isMac:t}=ke.platform;e.ctrlKey&&!t||e.shiftKey||e.metaKey&&t?this.parent.toggleSelected(this):this.parent.setSelected(this)},Lu=function(e){const t=this._uiManager.isSelected(this);this._uiManager.setUpDragSession();let s,i;const n=this._uiManager._signal;t&&(this.div.classList.add("moving"),s={passive:!0,capture:!0,signal:n},w(this,xr,e.clientX),w(this,Cr,e.clientY),i=a=>{const{clientX:h,clientY:l}=a,[c,d]=this.screenToPageTranslation(h-o(this,xr),l-o(this,Cr));w(this,xr,h),w(this,Cr,l),this._uiManager.dragSelectedEditors(c,d)},window.addEventListener("pointermove",i,s));const r=()=>{window.removeEventListener("pointerup",r),window.removeEventListener("blur",r),t&&(this.div.classList.remove("moving"),window.removeEventListener("pointermove",i,s)),w(this,mn,!1),this._uiManager.endDragSession()||E(this,mt,bc).call(this,e)};window.addEventListener("pointerup",r,{signal:n}),window.addEventListener("blur",r,{signal:n})},Iu=function(e){It._resizerKeyboardManager.exec(this,e)},Mu=function(e){var t;o(this,Qs)&&((t=e.relatedTarget)==null?void 0:t.parentNode)!==o(this,ae)&&E(this,mt,Sa).call(this)},Fu=function(e){w(this,ho,o(this,Qs)?e:"")},_c=function(e){if(o(this,as))for(const t of o(this,as))t.tabIndex=e},Sa=function(){if(w(this,Qs,!1),E(this,mt,_c).call(this,-1),o(this,gn)){const{savedX:e,savedY:t,savedWidth:s,savedHeight:i}=o(this,gn);E(this,mt,gc).call(this,e,t,s,i),w(this,gn,null)}},S(It,uo),ft(It,"_borderLineWidth",-1),ft(It,"_colorManager",new rc),ft(It,"_zIndex",1),ft(It,"_telemetryTimeout",1e3);let kt=It;class ig extends kt{constructor(e){super(e),this.annotationElementId=e.annotationElementId,this.deleted=!0}serialize(){return{id:this.annotationElementId,deleted:!0,pageIndex:this.pageIndex}}}const Od=3285377520,$e=4294901760,ms=65535;class Du{constructor(e){this.h1=e?e&4294967295:Od,this.h2=e?e&4294967295:Od}update(e){let t,s;if(typeof e=="string"){t=new Uint8Array(e.length*2),s=0;for(let m=0,v=e.length;m<v;m++){const b=e.charCodeAt(m);b<=255?t[s++]=b:(t[s++]=b>>>8,t[s++]=b&255)}}else if(ArrayBuffer.isView(e))t=e.slice(),s=t.byteLength;else throw new Error("Invalid data format, must be a string or TypedArray.");const i=s>>2,n=s-i*4,r=new Uint32Array(t.buffer,0,i);let a=0,h=0,l=this.h1,c=this.h2;const d=3432918353,p=461845907,f=d&ms,g=p&ms;for(let m=0;m<i;m++)m&1?(a=r[m],a=a*d&$e|a*f&ms,a=a<<15|a>>>17,a=a*p&$e|a*g&ms,l^=a,l=l<<13|l>>>19,l=l*5+3864292196):(h=r[m],h=h*d&$e|h*f&ms,h=h<<15|h>>>17,h=h*p&$e|h*g&ms,c^=h,c=c<<13|c>>>19,c=c*5+3864292196);switch(a=0,n){case 3:a^=t[i*4+2]<<16;case 2:a^=t[i*4+1]<<8;case 1:a^=t[i*4],a=a*d&$e|a*f&ms,a=a<<15|a>>>17,a=a*p&$e|a*g&ms,i&1?l^=a:c^=a}this.h1=l,this.h2=c}hexdigest(){let e=this.h1,t=this.h2;return e^=t>>>1,e=e*3981806797&$e|e*36045&ms,t=t*4283543511&$e|((t<<16|e>>>16)*2950163797&$e)>>>16,e^=t>>>1,e=e*444984403&$e|e*60499&ms,t=t*3301882366&$e|((t<<16|e>>>16)*3120437893&$e)>>>16,e^=t>>>1,(e>>>0).toString(16).padStart(8,"0")+(t>>>0).toString(16).padStart(8,"0")}}const vc=Object.freeze({map:null,hash:"",transfer:void 0});var _n,oe,vl,Ou;class bd{constructor(){S(this,vl);S(this,_n,!1);S(this,oe,new Map);this.onSetModified=null,this.onResetModified=null,this.onAnnotationEditor=null}getValue(e,t){const s=o(this,oe).get(e);return s===void 0?t:Object.assign(t,s)}getRawValue(e){return o(this,oe).get(e)}remove(e){if(o(this,oe).delete(e),o(this,oe).size===0&&this.resetModified(),typeof this.onAnnotationEditor=="function"){for(const t of o(this,oe).values())if(t instanceof kt)return;this.onAnnotationEditor(null)}}setValue(e,t){const s=o(this,oe).get(e);let i=!1;if(s!==void 0)for(const[n,r]of Object.entries(t))s[n]!==r&&(i=!0,s[n]=r);else i=!0,o(this,oe).set(e,t);i&&E(this,vl,Ou).call(this),t instanceof kt&&typeof this.onAnnotationEditor=="function"&&this.onAnnotationEditor(t.constructor._type)}has(e){return o(this,oe).has(e)}getAll(){return o(this,oe).size>0?cd(o(this,oe)):null}setAll(e){for(const[t,s]of Object.entries(e))this.setValue(t,s)}get size(){return o(this,oe).size}resetModified(){o(this,_n)&&(w(this,_n,!1),typeof this.onResetModified=="function"&&this.onResetModified())}get print(){return new Nu(this)}get serializable(){if(o(this,oe).size===0)return vc;const e=new Map,t=new Du,s=[],i=Object.create(null);let n=!1;for(const[r,a]of o(this,oe)){const h=a instanceof kt?a.serialize(!1,i):a;h&&(e.set(r,h),t.update(`${r}:${JSON.stringify(h)}`),n||(n=!!h.bitmap))}if(n)for(const r of e.values())r.bitmap&&s.push(r.bitmap);return e.size>0?{map:e,hash:t.hexdigest(),transfer:s}:vc}get editorStats(){let e=null;const t=new Map;for(const s of o(this,oe).values()){if(!(s instanceof kt))continue;const i=s.telemetryFinalData;if(!i)continue;const{type:n}=i;t.has(n)||t.set(n,Object.getPrototypeOf(s).constructor),e||(e=Object.create(null));const r=e[n]||(e[n]=new Map);for(const[a,h]of Object.entries(i)){if(a==="type")continue;let l=r.get(a);l||(l=new Map,r.set(a,l));const c=l.get(h)??0;l.set(h,c+1)}}for(const[s,i]of t)e[s]=i.computeTelemetryFinalData(e[s]);return e}}_n=new WeakMap,oe=new WeakMap,vl=new WeakSet,Ou=function(){o(this,_n)||(w(this,_n,!0),typeof this.onSetModified=="function"&&this.onSetModified())};var fo;class Nu extends bd{constructor(t){super();S(this,fo);const{map:s,hash:i,transfer:n}=t.serializable,r=structuredClone(s,n?{transfer:n}:null);w(this,fo,{map:r,hash:i,transfer:n})}get print(){Rt("Should not call PrintAnnotationStorage.print")}get serializable(){return o(this,fo)}}fo=new WeakMap;var kr;class ng{constructor({ownerDocument:e=globalThis.document,styleElement:t=null}){S(this,kr,new Set);this._document=e,this.nativeFontFaces=new Set,this.styleElement=null,this.loadingRequests=[],this.loadTestFontId=0}addNativeFontFace(e){this.nativeFontFaces.add(e),this._document.fonts.add(e)}removeNativeFontFace(e){this.nativeFontFaces.delete(e),this._document.fonts.delete(e)}insertRule(e){this.styleElement||(this.styleElement=this._document.createElement("style"),this._document.documentElement.getElementsByTagName("head")[0].append(this.styleElement));const t=this.styleElement.sheet;t.insertRule(e,t.cssRules.length)}clear(){for(const e of this.nativeFontFaces)this._document.fonts.delete(e);this.nativeFontFaces.clear(),o(this,kr).clear(),this.styleElement&&(this.styleElement.remove(),this.styleElement=null)}async loadSystemFont({systemFontInfo:e,_inspectFont:t}){if(!(!e||o(this,kr).has(e.loadedName))){if(Qt(!this.disableFontFace,"loadSystemFont shouldn't be called when `disableFontFace` is set."),this.isFontLoadingAPISupported){const{loadedName:s,src:i,style:n}=e,r=new FontFace(s,i,n);this.addNativeFontFace(r);try{await r.load(),o(this,kr).add(s),t==null||t(e)}catch{gt(`Cannot load system font: ${e.baseFontName}, installing it could help to improve PDF rendering.`),this.removeNativeFontFace(r)}return}Rt("Not implemented: loadSystemFont without the Font Loading API.")}}async bind(e){if(e.attached||e.missingFile&&!e.systemFontInfo)return;if(e.attached=!0,e.systemFontInfo){await this.loadSystemFont(e);return}if(this.isFontLoadingAPISupported){const s=e.createNativeFontFace();if(s){this.addNativeFontFace(s);try{await s.loaded}catch(i){throw gt(`Failed to load font '${s.family}': '${i}'.`),e.disableFontFace=!0,i}}return}const t=e.createFontFaceRule();if(t){if(this.insertRule(t),this.isSyncFontLoadingSupported)return;await new Promise(s=>{const i=this._queueLoadingCallback(s);this._prepareFontLoadEvent(e,i)})}}get isFontLoadingAPISupported(){var t;const e=!!((t=this._document)!=null&&t.fonts);return Et(this,"isFontLoadingAPISupported",e)}get isSyncFontLoadingSupported(){let e=!1;return(me||typeof navigator<"u"&&typeof(navigator==null?void 0:navigator.userAgent)=="string"&&/Mozilla\/5.0.*?rv:\d+.*? Gecko/.test(navigator.userAgent))&&(e=!0),Et(this,"isSyncFontLoadingSupported",e)}_queueLoadingCallback(e){function t(){for(Qt(!i.done,"completeRequest() cannot be called twice."),i.done=!0;s.length>0&&s[0].done;){const n=s.shift();setTimeout(n.callback,0)}}const{loadingRequests:s}=this,i={done:!1,complete:t,callback:e};return s.push(i),i}get _loadTestFont(){const e=atob("T1RUTwALAIAAAwAwQ0ZGIDHtZg4AAAOYAAAAgUZGVE1lkzZwAAAEHAAAABxHREVGABQAFQAABDgAAAAeT1MvMlYNYwkAAAEgAAAAYGNtYXABDQLUAAACNAAAAUJoZWFk/xVFDQAAALwAAAA2aGhlYQdkA+oAAAD0AAAAJGhtdHgD6AAAAAAEWAAAAAZtYXhwAAJQAAAAARgAAAAGbmFtZVjmdH4AAAGAAAAAsXBvc3T/hgAzAAADeAAAACAAAQAAAAEAALZRFsRfDzz1AAsD6AAAAADOBOTLAAAAAM4KHDwAAAAAA+gDIQAAAAgAAgAAAAAAAAABAAADIQAAAFoD6AAAAAAD6AABAAAAAAAAAAAAAAAAAAAAAQAAUAAAAgAAAAQD6AH0AAUAAAKKArwAAACMAooCvAAAAeAAMQECAAACAAYJAAAAAAAAAAAAAQAAAAAAAAAAAAAAAFBmRWQAwAAuAC4DIP84AFoDIQAAAAAAAQAAAAAAAAAAACAAIAABAAAADgCuAAEAAAAAAAAAAQAAAAEAAAAAAAEAAQAAAAEAAAAAAAIAAQAAAAEAAAAAAAMAAQAAAAEAAAAAAAQAAQAAAAEAAAAAAAUAAQAAAAEAAAAAAAYAAQAAAAMAAQQJAAAAAgABAAMAAQQJAAEAAgABAAMAAQQJAAIAAgABAAMAAQQJAAMAAgABAAMAAQQJAAQAAgABAAMAAQQJAAUAAgABAAMAAQQJAAYAAgABWABYAAAAAAAAAwAAAAMAAAAcAAEAAAAAADwAAwABAAAAHAAEACAAAAAEAAQAAQAAAC7//wAAAC7////TAAEAAAAAAAABBgAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAD/gwAyAAAAAQAAAAAAAAAAAAAAAAAAAAABAAQEAAEBAQJYAAEBASH4DwD4GwHEAvgcA/gXBIwMAYuL+nz5tQXkD5j3CBLnEQACAQEBIVhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYAAABAQAADwACAQEEE/t3Dov6fAH6fAT+fPp8+nwHDosMCvm1Cvm1DAz6fBQAAAAAAAABAAAAAMmJbzEAAAAAzgTjFQAAAADOBOQpAAEAAAAAAAAADAAUAAQAAAABAAAAAgABAAAAAAAAAAAD6AAAAAAAAA==");return Et(this,"_loadTestFont",e)}_prepareFontLoadEvent(e,t){function s(k,T){return k.charCodeAt(T)<<24|k.charCodeAt(T+1)<<16|k.charCodeAt(T+2)<<8|k.charCodeAt(T+3)&255}function i(k,T,L,I){const B=k.substring(0,T),D=k.substring(T+L);return B+I+D}let n,r;const a=this._document.createElement("canvas");a.width=1,a.height=1;const h=a.getContext("2d");let l=0;function c(k,T){if(++l>30){gt("Load test font never loaded."),T();return}if(h.font="30px "+k,h.fillText(".",0,20),h.getImageData(0,0,1,1).data[3]>0){T();return}setTimeout(c.bind(null,k,T))}const d=`lt${Date.now()}${this.loadTestFontId++}`;let p=this._loadTestFont;p=i(p,976,d.length,d);const g=16,m=1482184792;let v=s(p,g);for(n=0,r=d.length-3;n<r;n+=4)v=v-m+s(d,n)|0;n<d.length&&(v=v-m+s(d+"XXX",n)|0),p=i(p,g,4,Up(v));const b=`url(data:font/opentype;base64,${btoa(p)});`,A=`@font-face {font-family:"${d}";src:${b}}`;this.insertRule(A);const x=this._document.createElement("div");x.style.visibility="hidden",x.style.width=x.style.height="10px",x.style.position="absolute",x.style.top=x.style.left="0px";for(const k of[e.loadedName,d]){const T=this._document.createElement("span");T.textContent="Hi",T.style.fontFamily=k,x.append(T)}this._document.body.append(x),c(d,()=>{x.remove(),t.complete()})}}kr=new WeakMap;class rg{constructor(e,{disableFontFace:t=!1,inspectFont:s=null}){this.compiledGlyphs=Object.create(null);for(const i in e)this[i]=e[i];this.disableFontFace=t===!0,this._inspectFont=s}createNativeFontFace(){var t;if(!this.data||this.disableFontFace)return null;let e;if(!this.cssFontInfo)e=new FontFace(this.loadedName,this.data,{});else{const s={weight:this.cssFontInfo.fontWeight};this.cssFontInfo.italicAngle&&(s.style=`oblique ${this.cssFontInfo.italicAngle}deg`),e=new FontFace(this.cssFontInfo.fontFamily,this.data,s)}return(t=this._inspectFont)==null||t.call(this,this),e}createFontFaceRule(){var i;if(!this.data||this.disableFontFace)return null;const e=nu(this.data),t=`url(data:${this.mimetype};base64,${btoa(e)});`;let s;if(!this.cssFontInfo)s=`@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;`),s=`@font-face {font-family:"${this.cssFontInfo.fontFamily}";${n}src:${t}}`}return(i=this._inspectFont)==null||i.call(this,this,t),s}getPathGenerator(e,t){if(this.compiledGlyphs[t]!==void 0)return this.compiledGlyphs[t];let s;try{s=e.get(this.loadedName+"_path_"+t)}catch(n){gt(`getPathGenerator - ignoring character: "${n}".`)}if(!Array.isArray(s)||s.length===0)return this.compiledGlyphs[t]=function(n,r){};const i=[];for(let n=0,r=s.length;n<r;)switch(s[n++]){case Bs.BEZIER_CURVE_TO:{const[a,h,l,c,d,p]=s.slice(n,n+6);i.push(f=>f.bezierCurveTo(a,h,l,c,d,p)),n+=6}break;case Bs.MOVE_TO:{const[a,h]=s.slice(n,n+2);i.push(l=>l.moveTo(a,h)),n+=2}break;case Bs.LINE_TO:{const[a,h]=s.slice(n,n+2);i.push(l=>l.lineTo(a,h)),n+=2}break;case Bs.QUADRATIC_CURVE_TO:{const[a,h,l,c]=s.slice(n,n+4);i.push(d=>d.quadraticCurveTo(a,h,l,c)),n+=4}break;case Bs.RESTORE:i.push(a=>a.restore());break;case Bs.SAVE:i.push(a=>a.save());break;case Bs.SCALE:Qt(i.length===2,"Scale command is only valid at the third position.");break;case Bs.TRANSFORM:{const[a,h,l,c,d,p]=s.slice(n,n+6);i.push(f=>f.transform(a,h,l,c,d,p)),n+=6}break;case Bs.TRANSLATE:{const[a,h]=s.slice(n,n+2);i.push(l=>l.translate(a,h)),n+=2}break}return this.compiledGlyphs[t]=function(r,a){i[0](r),i[1](r),r.scale(a,-a);for(let h=2,l=i.length;h<l;h++)i[h](r)}}}if(me){var yc=Promise.withResolvers(),Da=null;(async()=>{const e=await Sh(()=>import("./__vite-browser-external-BIHI7g3E.js"),[]),t=await Sh(()=>import("./__vite-browser-external-BIHI7g3E.js"),[]),s=await Sh(()=>import("./__vite-browser-external-BIHI7g3E.js"),[]),i=await Sh(()=>import("./__vite-browser-external-BIHI7g3E.js"),[]);let n,r;return new Map(Object.entries({fs:e,http:t,https:s,url:i,canvas:n,path2d:r}))})().then(e=>{Da=e,yc.resolve()},e=>{gt(`loadPackages: ${e}`),Da=new Map,yc.resolve()})}class Os{static get promise(){return yc.promise}static get(e){return Da==null?void 0:Da.get(e)}}const Bu=function(u){return Os.get("fs").promises.readFile(u).then(t=>new Uint8Array(t))};class ag extends Fl{}class og extends il{_createCanvas(e,t){return Os.get("canvas").createCanvas(e,t)}}class hg extends Dl{_fetchData(e,t){return Bu(e).then(s=>({cMapData:s,compressionType:t}))}}class lg extends Ol{_fetchData(e){return Bu(e)}}const ye={FILL:"Fill",STROKE:"Stroke",SHADING:"Shading"};function Ac(u,e){if(!e)return;const t=e[2]-e[0],s=e[3]-e[1],i=new Path2D;i.rect(e[0],e[1],t,s),u.clip(i)}class vh{constructor(){this.constructor===vh&&Rt("Cannot initialize BaseShadingPattern.")}getPattern(){Rt("Abstract method `getPattern` called.")}}class cg extends vh{constructor(e){super(),this._type=e[1],this._bbox=e[2],this._colorStops=e[3],this._p0=e[4],this._p1=e[5],this._r0=e[6],this._r1=e[7],this.matrix=null}_createGradient(e){let t;this._type==="axial"?t=e.createLinearGradient(this._p0[0],this._p0[1],this._p1[0],this._p1[1]):this._type==="radial"&&(t=e.createRadialGradient(this._p0[0],this._p0[1],this._r0,this._p1[0],this._p1[1],this._r1));for(const s of this._colorStops)t.addColorStop(s[0],s[1]);return t}getPattern(e,t,s,i){let n;if(i===ye.STROKE||i===ye.FILL){const r=t.current.getClippedPathBoundingBox(i,Bt(e))||[0,0,0,0],a=Math.ceil(r[2]-r[0])||1,h=Math.ceil(r[3]-r[1])||1,l=t.cachedCanvases.getCanvas("pattern",a,h,!0),c=l.context;c.clearRect(0,0,c.canvas.width,c.canvas.height),c.beginPath(),c.rect(0,0,c.canvas.width,c.canvas.height),c.translate(-r[0],-r[1]),s=at.transform(s,[1,0,0,1,r[0],r[1]]),c.transform(...t.baseTransform),this.matrix&&c.transform(...this.matrix),Ac(c,this._bbox),c.fillStyle=this._createGradient(c),c.fill(),n=e.createPattern(l.canvas,"no-repeat");const d=new DOMMatrix(s);n.setTransform(d)}else Ac(e,this._bbox),n=this._createGradient(e);return n}}function $l(u,e,t,s,i,n,r,a){const h=e.coords,l=e.colors,c=u.data,d=u.width*4;let p;h[t+1]>h[s+1]&&(p=t,t=s,s=p,p=n,n=r,r=p),h[s+1]>h[i+1]&&(p=s,s=i,i=p,p=r,r=a,a=p),h[t+1]>h[s+1]&&(p=t,t=s,s=p,p=n,n=r,r=p);const f=(h[t]+e.offsetX)*e.scaleX,g=(h[t+1]+e.offsetY)*e.scaleY,m=(h[s]+e.offsetX)*e.scaleX,v=(h[s+1]+e.offsetY)*e.scaleY,b=(h[i]+e.offsetX)*e.scaleX,A=(h[i+1]+e.offsetY)*e.scaleY;if(g>=A)return;const x=l[n],k=l[n+1],T=l[n+2],L=l[r],I=l[r+1],B=l[r+2],D=l[a],W=l[a+1],q=l[a+2],P=Math.round(g),z=Math.round(A);let y,H,rt,U,Q,X,ht,M;for(let O=P;O<=z;O++){if(O<v){const pt=O<g?0:(g-O)/(g-v);y=f-(f-m)*pt,H=x-(x-L)*pt,rt=k-(k-I)*pt,U=T-(T-B)*pt}else{let pt;O>A?pt=1:v===A?pt=0:pt=(v-O)/(v-A),y=m-(m-b)*pt,H=L-(L-D)*pt,rt=I-(I-W)*pt,U=B-(B-q)*pt}let st;O<g?st=0:O>A?st=1:st=(g-O)/(g-A),Q=f-(f-b)*st,X=x-(x-D)*st,ht=k-(k-W)*st,M=T-(T-q)*st;const J=Math.round(Math.min(y,Q)),Y=Math.round(Math.max(y,Q));let _t=d*O+J*4;for(let pt=J;pt<=Y;pt++)st=(y-pt)/(y-Q),st<0?st=0:st>1&&(st=1),c[_t++]=H-(H-X)*st|0,c[_t++]=rt-(rt-ht)*st|0,c[_t++]=U-(U-M)*st|0,c[_t++]=255}}function dg(u,e,t){const s=e.coords,i=e.colors;let n,r;switch(e.type){case"lattice":const a=e.verticesPerRow,h=Math.floor(s.length/a)-1,l=a-1;for(n=0;n<h;n++){let c=n*a;for(let d=0;d<l;d++,c++)$l(u,t,s[c],s[c+1],s[c+a],i[c],i[c+1],i[c+a]),$l(u,t,s[c+a+1],s[c+1],s[c+a],i[c+a+1],i[c+1],i[c+a])}break;case"triangles":for(n=0,r=s.length;n<r;n+=3)$l(u,t,s[n],s[n+1],s[n+2],i[n],i[n+1],i[n+2]);break;default:throw new Error("illegal figure")}}class ug extends vh{constructor(e){super(),this._coords=e[2],this._colors=e[3],this._figures=e[4],this._bounds=e[5],this._bbox=e[7],this._background=e[8],this.matrix=null}_createMeshCanvas(e,t,s){const a=Math.floor(this._bounds[0]),h=Math.floor(this._bounds[1]),l=Math.ceil(this._bounds[2])-a,c=Math.ceil(this._bounds[3])-h,d=Math.min(Math.ceil(Math.abs(l*e[0]*1.1)),3e3),p=Math.min(Math.ceil(Math.abs(c*e[1]*1.1)),3e3),f=l/d,g=c/p,m={coords:this._coords,colors:this._colors,offsetX:-a,offsetY:-h,scaleX:1/f,scaleY:1/g},v=d+2*2,b=p+2*2,A=s.getCanvas("mesh",v,b,!1),x=A.context,k=x.createImageData(d,p);if(t){const L=k.data;for(let I=0,B=L.length;I<B;I+=4)L[I]=t[0],L[I+1]=t[1],L[I+2]=t[2],L[I+3]=255}for(const L of this._figures)dg(k,L,m);return x.putImageData(k,2,2),{canvas:A.canvas,offsetX:a-2*f,offsetY:h-2*g,scaleX:f,scaleY:g}}getPattern(e,t,s,i){Ac(e,this._bbox);let n;if(i===ye.SHADING)n=at.singularValueDecompose2dScale(Bt(e));else if(n=at.singularValueDecompose2dScale(t.baseTransform),this.matrix){const a=at.singularValueDecompose2dScale(this.matrix);n=[n[0]*a[0],n[1]*a[1]]}const r=this._createMeshCanvas(n,i===ye.SHADING?null:this._background,t.cachedCanvases);return i!==ye.SHADING&&(e.setTransform(...t.baseTransform),this.matrix&&e.transform(...this.matrix)),e.translate(r.offsetX,r.offsetY),e.scale(r.scaleX,r.scaleY),e.createPattern(r.canvas,"no-repeat")}}class fg extends vh{getPattern(){return"hotpink"}}function pg(u){switch(u[0]){case"RadialAxial":return new cg(u);case"Mesh":return new ug(u);case"Dummy":return new fg}throw new Error(`Unknown IR type: ${u[0]}`)}const Nd={COLORED:1,UNCOLORED:2},yl=class yl{constructor(e,t,s,i,n){this.operatorList=e[2],this.matrix=e[3],this.bbox=e[4],this.xstep=e[5],this.ystep=e[6],this.paintType=e[7],this.tilingType=e[8],this.color=t,this.ctx=s,this.canvasGraphicsFactory=i,this.baseTransform=n}createPatternCanvas(e){const t=this.operatorList,s=this.bbox,i=this.xstep,n=this.ystep,r=this.paintType,a=this.tilingType,h=this.color,l=this.canvasGraphicsFactory;Ll("TilingType: "+a);const c=s[0],d=s[1],p=s[2],f=s[3],g=at.singularValueDecompose2dScale(this.matrix),m=at.singularValueDecompose2dScale(this.baseTransform),v=[g[0]*m[0],g[1]*m[1]],b=this.getSizeAndScale(i,this.ctx.canvas.width,v[0]),A=this.getSizeAndScale(n,this.ctx.canvas.height,v[1]),x=e.cachedCanvases.getCanvas("pattern",b.size,A.size,!0),k=x.context,T=l.createCanvasGraphics(k);T.groupLevel=e.groupLevel,this.setFillAndStrokeStyleToContext(T,r,h);let L=c,I=d,B=p,D=f;return c<0&&(L=0,B+=Math.abs(c)),d<0&&(I=0,D+=Math.abs(d)),k.translate(-(b.scale*L),-(A.scale*I)),T.transform(b.scale,0,0,A.scale,0,0),k.save(),this.clipBbox(T,L,I,B,D),T.baseTransform=Bt(T.ctx),T.executeOperatorList(t),T.endDrawing(),{canvas:x.canvas,scaleX:b.scale,scaleY:A.scale,offsetX:L,offsetY:I}}getSizeAndScale(e,t,s){e=Math.abs(e);const i=Math.max(yl.MAX_PATTERN_SIZE,t);let n=Math.ceil(e*s);return n>=i?n=i:s=n/e,{scale:s,size:n}}clipBbox(e,t,s,i,n){const r=i-t,a=n-s;e.ctx.rect(t,s,r,a),e.current.updateRectMinMax(Bt(e.ctx),[t,s,i,n]),e.clip(),e.endPath()}setFillAndStrokeStyleToContext(e,t,s){const i=e.ctx,n=e.current;switch(t){case Nd.COLORED:const r=this.ctx;i.fillStyle=r.fillStyle,i.strokeStyle=r.strokeStyle,n.fillColor=r.fillStyle,n.strokeColor=r.strokeStyle;break;case Nd.UNCOLORED:const a=at.makeHexColor(s[0],s[1],s[2]);i.fillStyle=a,i.strokeStyle=a,n.fillColor=a,n.strokeColor=a;break;default:throw new Hp(`Unsupported paint type: ${t}`)}}getPattern(e,t,s,i){let n=s;i!==ye.SHADING&&(n=at.transform(n,t.baseTransform),this.matrix&&(n=at.transform(n,this.matrix)));const r=this.createPatternCanvas(t);let a=new DOMMatrix(n);a=a.translate(r.offsetX,r.offsetY),a=a.scale(1/r.scaleX,1/r.scaleY);const h=e.createPattern(r.canvas,"repeat");return h.setTransform(a),h}};ft(yl,"MAX_PATTERN_SIZE",3e3);let wc=yl;function gg({src:u,srcPos:e=0,dest:t,width:s,height:i,nonBlackColor:n=4294967295,inverseDecode:r=!1}){const a=ke.isLittleEndian?4278190080:255,[h,l]=r?[n,a]:[a,n],c=s>>3,d=s&7,p=u.length;t=new Uint32Array(t.buffer);let f=0;for(let g=0;g<i;g++){for(const v=e+c;e<v;e++){const b=e<p?u[e]:255;t[f++]=b&128?l:h,t[f++]=b&64?l:h,t[f++]=b&32?l:h,t[f++]=b&16?l:h,t[f++]=b&8?l:h,t[f++]=b&4?l:h,t[f++]=b&2?l:h,t[f++]=b&1?l:h}if(d===0)continue;const m=e<p?u[e++]:255;for(let v=0;v<d;v++)t[f++]=m&1<<7-v?l:h}return{srcPos:e,destPos:f}}const Bd=16,zd=100,mg=15,Hd=10,Ud=1e3,Ce=16;function bg(u,e){if(u._removeMirroring)throw new Error("Context is already forwarding operations.");u.__originalSave=u.save,u.__originalRestore=u.restore,u.__originalRotate=u.rotate,u.__originalScale=u.scale,u.__originalTranslate=u.translate,u.__originalTransform=u.transform,u.__originalSetTransform=u.setTransform,u.__originalResetTransform=u.resetTransform,u.__originalClip=u.clip,u.__originalMoveTo=u.moveTo,u.__originalLineTo=u.lineTo,u.__originalBezierCurveTo=u.bezierCurveTo,u.__originalRect=u.rect,u.__originalClosePath=u.closePath,u.__originalBeginPath=u.beginPath,u._removeMirroring=()=>{u.save=u.__originalSave,u.restore=u.__originalRestore,u.rotate=u.__originalRotate,u.scale=u.__originalScale,u.translate=u.__originalTranslate,u.transform=u.__originalTransform,u.setTransform=u.__originalSetTransform,u.resetTransform=u.__originalResetTransform,u.clip=u.__originalClip,u.moveTo=u.__originalMoveTo,u.lineTo=u.__originalLineTo,u.bezierCurveTo=u.__originalBezierCurveTo,u.rect=u.__originalRect,u.closePath=u.__originalClosePath,u.beginPath=u.__originalBeginPath,delete u._removeMirroring},u.save=function(){e.save(),this.__originalSave()},u.restore=function(){e.restore(),this.__originalRestore()},u.translate=function(s,i){e.translate(s,i),this.__originalTranslate(s,i)},u.scale=function(s,i){e.scale(s,i),this.__originalScale(s,i)},u.transform=function(s,i,n,r,a,h){e.transform(s,i,n,r,a,h),this.__originalTransform(s,i,n,r,a,h)},u.setTransform=function(s,i,n,r,a,h){e.setTransform(s,i,n,r,a,h),this.__originalSetTransform(s,i,n,r,a,h)},u.resetTransform=function(){e.resetTransform(),this.__originalResetTransform()},u.rotate=function(s){e.rotate(s),this.__originalRotate(s)},u.clip=function(s){e.clip(s),this.__originalClip(s)},u.moveTo=function(t,s){e.moveTo(t,s),this.__originalMoveTo(t,s)},u.lineTo=function(t,s){e.lineTo(t,s),this.__originalLineTo(t,s)},u.bezierCurveTo=function(t,s,i,n,r,a){e.bezierCurveTo(t,s,i,n,r,a),this.__originalBezierCurveTo(t,s,i,n,r,a)},u.rect=function(t,s,i,n){e.rect(t,s,i,n),this.__originalRect(t,s,i,n)},u.closePath=function(){e.closePath(),this.__originalClosePath()},u.beginPath=function(){e.beginPath(),this.__originalBeginPath()}}class _g{constructor(e){this.canvasFactory=e,this.cache=Object.create(null)}getCanvas(e,t,s){let i;return this.cache[e]!==void 0?(i=this.cache[e],this.canvasFactory.reset(i,t,s)):(i=this.canvasFactory.create(t,s),this.cache[e]=i),i}delete(e){delete this.cache[e]}clear(){for(const e in this.cache){const t=this.cache[e];this.canvasFactory.destroy(t),delete this.cache[e]}}}function Ch(u,e,t,s,i,n,r,a,h,l){const[c,d,p,f,g,m]=Bt(u);if(d===0&&p===0){const A=r*c+g,x=Math.round(A),k=a*f+m,T=Math.round(k),L=(r+h)*c+g,I=Math.abs(Math.round(L)-x)||1,B=(a+l)*f+m,D=Math.abs(Math.round(B)-T)||1;return u.setTransform(Math.sign(c),0,0,Math.sign(f),x,T),u.drawImage(e,t,s,i,n,0,0,I,D),u.setTransform(c,d,p,f,g,m),[I,D]}if(c===0&&f===0){const A=a*p+g,x=Math.round(A),k=r*d+m,T=Math.round(k),L=(a+l)*p+g,I=Math.abs(Math.round(L)-x)||1,B=(r+h)*d+m,D=Math.abs(Math.round(B)-T)||1;return u.setTransform(0,Math.sign(d),Math.sign(p),0,x,T),u.drawImage(e,t,s,i,n,0,0,D,I),u.setTransform(c,d,p,f,g,m),[D,I]}u.drawImage(e,t,s,i,n,r,a,h,l);const v=Math.hypot(c,d),b=Math.hypot(p,f);return[v*h,b*l]}function vg(u){const{width:e,height:t}=u;if(e>Ud||t>Ud)return null;const s=1e3,i=new Uint8Array([0,2,4,0,1,0,5,4,8,10,0,8,0,2,1,0]),n=e+1;let r=new Uint8Array(n*(t+1)),a,h,l;const c=e+7&-8;let d=new Uint8Array(c*t),p=0;for(const b of u.data){let A=128;for(;A>0;)d[p++]=b&A?0:255,A>>=1}let f=0;for(p=0,d[p]!==0&&(r[0]=1,++f),h=1;h<e;h++)d[p]!==d[p+1]&&(r[h]=d[p]?2:1,++f),p++;for(d[p]!==0&&(r[h]=2,++f),a=1;a<t;a++){p=a*c,l=a*n,d[p-c]!==d[p]&&(r[l]=d[p]?1:8,++f);let b=(d[p]?4:0)+(d[p-c]?8:0);for(h=1;h<e;h++)b=(b>>2)+(d[p+1]?4:0)+(d[p-c+1]?8:0),i[b]&&(r[l+h]=i[b],++f),p++;if(d[p-c]!==d[p]&&(r[l+h]=d[p]?2:4,++f),f>s)return null}for(p=c*(t-1),l=a*n,d[p]!==0&&(r[l]=8,++f),h=1;h<e;h++)d[p]!==d[p+1]&&(r[l+h]=d[p]?4:8,++f),p++;if(d[p]!==0&&(r[l+h]=4,++f),f>s)return null;const g=new Int32Array([0,n,-1,0,-n,0,0,0,1]),m=new Path2D;for(a=0;f&&a<=t;a++){let b=a*n;const A=b+e;for(;b<A&&!r[b];)b++;if(b===A)continue;m.moveTo(b%n,a);const x=b;let k=r[b];do{const T=g[k];do b+=T;while(!r[b]);const L=r[b];L!==5&&L!==10?(k=L,r[b]=0):(k=L&51*k>>4,r[b]&=k>>2|k<<2),m.lineTo(b%n,b/n|0),r[b]||--f}while(x!==b);--a}return d=null,r=null,function(b){b.save(),b.scale(1/e,-1/t),b.translate(0,-t),b.fill(m),b.beginPath(),b.restore()}}class jd{constructor(e,t){this.alphaIsShape=!1,this.fontSize=0,this.fontSizeScale=1,this.textMatrix=su,this.textMatrixScale=1,this.fontMatrix=Xl,this.leading=0,this.x=0,this.y=0,this.lineX=0,this.lineY=0,this.charSpacing=0,this.wordSpacing=0,this.textHScale=1,this.textRenderingMode=de.FILL,this.textRise=0,this.fillColor="#000000",this.strokeColor="#000000",this.patternFill=!1,this.fillAlpha=1,this.strokeAlpha=1,this.lineWidth=1,this.activeSMask=null,this.transferMaps="none",this.startNewPathAndClipBox([0,0,e,t])}clone(){const e=Object.create(this);return e.clipBox=this.clipBox.slice(),e}setCurrentPoint(e,t){this.x=e,this.y=t}updatePathMinMax(e,t,s){[t,s]=at.applyTransform([t,s],e),this.minX=Math.min(this.minX,t),this.minY=Math.min(this.minY,s),this.maxX=Math.max(this.maxX,t),this.maxY=Math.max(this.maxY,s)}updateRectMinMax(e,t){const s=at.applyTransform(t,e),i=at.applyTransform(t.slice(2),e),n=at.applyTransform([t[0],t[3]],e),r=at.applyTransform([t[2],t[1]],e);this.minX=Math.min(this.minX,s[0],i[0],n[0],r[0]),this.minY=Math.min(this.minY,s[1],i[1],n[1],r[1]),this.maxX=Math.max(this.maxX,s[0],i[0],n[0],r[0]),this.maxY=Math.max(this.maxY,s[1],i[1],n[1],r[1])}updateScalingPathMinMax(e,t){at.scaleMinMax(e,t),this.minX=Math.min(this.minX,t[0]),this.minY=Math.min(this.minY,t[1]),this.maxX=Math.max(this.maxX,t[2]),this.maxY=Math.max(this.maxY,t[3])}updateCurvePathMinMax(e,t,s,i,n,r,a,h,l,c){const d=at.bezierBoundingBox(t,s,i,n,r,a,h,l,c);c||this.updateRectMinMax(e,d)}getPathBoundingBox(e=ye.FILL,t=null){const s=[this.minX,this.minY,this.maxX,this.maxY];if(e===ye.STROKE){t||Rt("Stroke bounding box must include transform.");const i=at.singularValueDecompose2dScale(t),n=i[0]*this.lineWidth/2,r=i[1]*this.lineWidth/2;s[0]-=n,s[1]-=r,s[2]+=n,s[3]+=r}return s}updateClipFromPath(){const e=at.intersect(this.clipBox,this.getPathBoundingBox());this.startNewPathAndClipBox(e||[0,0,0,0])}isEmptyClip(){return this.minX===1/0}startNewPathAndClipBox(e){this.clipBox=e,this.minX=1/0,this.minY=1/0,this.maxX=0,this.maxY=0}getClippedPathBoundingBox(e=ye.FILL,t=null){return at.intersect(this.clipBox,this.getPathBoundingBox(e,t))}}function Wd(u,e){if(typeof ImageData<"u"&&e instanceof ImageData){u.putImageData(e,0,0);return}const t=e.height,s=e.width,i=t%Ce,n=(t-i)/Ce,r=i===0?n:n+1,a=u.createImageData(s,Ce);let h=0,l;const c=e.data,d=a.data;let p,f,g,m;if(e.kind===Lh.GRAYSCALE_1BPP){const v=c.byteLength,b=new Uint32Array(d.buffer,0,d.byteLength>>2),A=b.length,x=s+7>>3,k=4294967295,T=ke.isLittleEndian?4278190080:255;for(p=0;p<r;p++){for(g=p<n?Ce:i,l=0,f=0;f<g;f++){const L=v-h;let I=0;const B=L>x?s:L*8-7,D=B&-8;let W=0,q=0;for(;I<D;I+=8)q=c[h++],b[l++]=q&128?k:T,b[l++]=q&64?k:T,b[l++]=q&32?k:T,b[l++]=q&16?k:T,b[l++]=q&8?k:T,b[l++]=q&4?k:T,b[l++]=q&2?k:T,b[l++]=q&1?k:T;for(;I<B;I++)W===0&&(q=c[h++],W=128),b[l++]=q&W?k:T,W>>=1}for(;l<A;)b[l++]=0;u.putImageData(a,0,p*Ce)}}else if(e.kind===Lh.RGBA_32BPP){for(f=0,m=s*Ce*4,p=0;p<n;p++)d.set(c.subarray(h,h+m)),h+=m,u.putImageData(a,0,f),f+=Ce;p<r&&(m=s*i*4,d.set(c.subarray(h,h+m)),u.putImageData(a,0,f))}else if(e.kind===Lh.RGB_24BPP)for(g=Ce,m=s*g,p=0;p<r;p++){for(p>=n&&(g=i,m=s*g),l=0,f=m;f--;)d[l++]=c[h++],d[l++]=c[h++],d[l++]=c[h++],d[l++]=255;u.putImageData(a,0,p*Ce)}else throw new Error(`bad image kind: ${e.kind}`)}function Gd(u,e){if(e.bitmap){u.drawImage(e.bitmap,0,0);return}const t=e.height,s=e.width,i=t%Ce,n=(t-i)/Ce,r=i===0?n:n+1,a=u.createImageData(s,Ce);let h=0;const l=e.data,c=a.data;for(let d=0;d<r;d++){const p=d<n?Ce:i;({srcPos:h}=gg({src:l,srcPos:h,dest:c,width:s,height:p,nonBlackColor:0})),u.putImageData(a,0,d*Ce)}}function ma(u,e){const t=["strokeStyle","fillStyle","fillRule","globalAlpha","lineWidth","lineCap","lineJoin","miterLimit","globalCompositeOperation","font","filter"];for(const s of t)u[s]!==void 0&&(e[s]=u[s]);u.setLineDash!==void 0&&(e.setLineDash(u.getLineDash()),e.lineDashOffset=u.lineDashOffset)}function kh(u){if(u.strokeStyle=u.fillStyle="#000000",u.fillRule="nonzero",u.globalAlpha=1,u.lineWidth=1,u.lineCap="butt",u.lineJoin="miter",u.miterLimit=10,u.globalCompositeOperation="source-over",u.font="10px sans-serif",u.setLineDash!==void 0&&(u.setLineDash([]),u.lineDashOffset=0),!me){const{filter:e}=u;e!=="none"&&e!==""&&(u.filter="none")}}function $d(u,e){if(e)return!0;const t=at.singularValueDecompose2dScale(u);t[0]=Math.fround(t[0]),t[1]=Math.fround(t[1]);const s=Math.fround((globalThis.devicePixelRatio||1)*Vi.PDF_TO_CSS_UNITS);return t[0]<=s&&t[1]<=s}const yg=["butt","round","square"],Ag=["miter","round","bevel"],wg={},Vd={};var Xi,Ec,Sc;const wd=class wd{constructor(e,t,s,i,n,{optionalContentConfig:r,markedContentStack:a=null},h,l){S(this,Xi);this.ctx=e,this.current=new jd(this.ctx.canvas.width,this.ctx.canvas.height),this.stateStack=[],this.pendingClip=null,this.pendingEOFill=!1,this.res=null,this.xobjs=null,this.commonObjs=t,this.objs=s,this.canvasFactory=i,this.filterFactory=n,this.groupStack=[],this.processingType3=null,this.baseTransform=null,this.baseTransformStack=[],this.groupLevel=0,this.smaskStack=[],this.smaskCounter=0,this.tempSMask=null,this.suspendedCtx=null,this.contentVisible=!0,this.markedContentStack=a||[],this.optionalContentConfig=r,this.cachedCanvases=new _g(this.canvasFactory),this.cachedPatterns=new Map,this.annotationCanvasMap=h,this.viewportScale=1,this.outputScaleX=1,this.outputScaleY=1,this.pageColors=l,this._cachedScaleForStroking=[-1,0],this._cachedGetSinglePixelWidth=null,this._cachedBitmapsMap=new Map}getObject(e,t=null){return typeof e=="string"?e.startsWith("g_")?this.commonObjs.get(e):this.objs.get(e):t}beginDrawing({transform:e,viewport:t,transparency:s=!1,background:i=null}){const n=this.ctx.canvas.width,r=this.ctx.canvas.height,a=this.ctx.fillStyle;if(this.ctx.fillStyle=i||"#ffffff",this.ctx.fillRect(0,0,n,r),this.ctx.fillStyle=a,s){const h=this.cachedCanvases.getCanvas("transparent",n,r);this.compositeCtx=this.ctx,this.transparentCanvas=h.canvas,this.ctx=h.context,this.ctx.save(),this.ctx.transform(...Bt(this.compositeCtx))}this.ctx.save(),kh(this.ctx),e&&(this.ctx.transform(...e),this.outputScaleX=e[0],this.outputScaleY=e[0]),this.ctx.transform(...t.transform),this.viewportScale=t.scale,this.baseTransform=Bt(this.ctx)}executeOperatorList(e,t,s,i){const n=e.argsArray,r=e.fnArray;let a=t||0;const h=n.length;if(h===a)return a;const l=h-a>Hd&&typeof s=="function",c=l?Date.now()+mg:0;let d=0;const p=this.commonObjs,f=this.objs;let g;for(;;){if(i!==void 0&&a===i.nextBreakPoint)return i.breakIt(a,s),a;if(g=r[a],g!==es.dependency)this[g].apply(this,n[a]);else for(const m of n[a]){const v=m.startsWith("g_")?p:f;if(!v.has(m))return v.get(m,s),a}if(a++,a===h)return a;if(l&&++d>Hd){if(Date.now()>c)return s(),a;d=0}}}endDrawing(){E(this,Xi,Ec).call(this),this.cachedCanvases.clear(),this.cachedPatterns.clear();for(const e of this._cachedBitmapsMap.values()){for(const t of e.values())typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement&&(t.width=t.height=0);e.clear()}this._cachedBitmapsMap.clear(),E(this,Xi,Sc).call(this)}_scaleImage(e,t){const s=e.width,i=e.height;let n=Math.max(Math.hypot(t[0],t[1]),1),r=Math.max(Math.hypot(t[2],t[3]),1),a=s,h=i,l="prescale1",c,d;for(;n>2&&a>1||r>2&&h>1;){let p=a,f=h;n>2&&a>1&&(p=a>=16384?Math.floor(a/2)-1||1:Math.ceil(a/2),n/=a/p),r>2&&h>1&&(f=h>=16384?Math.floor(h/2)-1||1:Math.ceil(h)/2,r/=h/f),c=this.cachedCanvases.getCanvas(l,p,f),d=c.context,d.clearRect(0,0,p,f),d.drawImage(e,0,0,a,h,0,0,p,f),e=c.canvas,a=p,h=f,l=l==="prescale1"?"prescale2":"prescale1"}return{img:e,paintWidth:a,paintHeight:h}}_createMaskCanvas(e){const t=this.ctx,{width:s,height:i}=e,n=this.current.fillColor,r=this.current.patternFill,a=Bt(t);let h,l,c,d;if((e.bitmap||e.data)&&e.count>1){const B=e.bitmap||e.data.buffer;l=JSON.stringify(r?a:[a.slice(0,4),n]),h=this._cachedBitmapsMap.get(B),h||(h=new Map,this._cachedBitmapsMap.set(B,h));const D=h.get(l);if(D&&!r){const W=Math.round(Math.min(a[0],a[2])+a[4]),q=Math.round(Math.min(a[1],a[3])+a[5]);return{canvas:D,offsetX:W,offsetY:q}}c=D}c||(d=this.cachedCanvases.getCanvas("maskCanvas",s,i),Gd(d.context,e));let p=at.transform(a,[1/s,0,0,-1/i,0,0]);p=at.transform(p,[1,0,0,1,0,-i]);const[f,g,m,v]=at.getAxialAlignedBoundingBox([0,0,s,i],p),b=Math.round(m-f)||1,A=Math.round(v-g)||1,x=this.cachedCanvases.getCanvas("fillCanvas",b,A),k=x.context,T=f,L=g;k.translate(-T,-L),k.transform(...p),c||(c=this._scaleImage(d.canvas,zs(k)),c=c.img,h&&r&&h.set(l,c)),k.imageSmoothingEnabled=$d(Bt(k),e.interpolate),Ch(k,c,0,0,c.width,c.height,0,0,s,i),k.globalCompositeOperation="source-in";const I=at.transform(zs(k),[1,0,0,1,-T,-L]);return k.fillStyle=r?n.getPattern(t,this,I,ye.FILL):n,k.fillRect(0,0,s,i),h&&!r&&(this.cachedCanvases.delete("fillCanvas"),h.set(l,x.canvas)),{canvas:x.canvas,offsetX:Math.round(T),offsetY:Math.round(L)}}setLineWidth(e){e!==this.current.lineWidth&&(this._cachedScaleForStroking[0]=-1),this.current.lineWidth=e,this.ctx.lineWidth=e}setLineCap(e){this.ctx.lineCap=yg[e]}setLineJoin(e){this.ctx.lineJoin=Ag[e]}setMiterLimit(e){this.ctx.miterLimit=e}setDash(e,t){const s=this.ctx;s.setLineDash!==void 0&&(s.setLineDash(e),s.lineDashOffset=t)}setRenderingIntent(e){}setFlatness(e){}setGState(e){for(const[t,s]of e)switch(t){case"LW":this.setLineWidth(s);break;case"LC":this.setLineCap(s);break;case"LJ":this.setLineJoin(s);break;case"ML":this.setMiterLimit(s);break;case"D":this.setDash(s[0],s[1]);break;case"RI":this.setRenderingIntent(s);break;case"FL":this.setFlatness(s);break;case"Font":this.setFont(s[0],s[1]);break;case"CA":this.current.strokeAlpha=s;break;case"ca":this.current.fillAlpha=s,this.ctx.globalAlpha=s;break;case"BM":this.ctx.globalCompositeOperation=s;break;case"SMask":this.current.activeSMask=s?this.tempSMask:null,this.tempSMask=null,this.checkSMaskState();break;case"TR":this.ctx.filter=this.current.transferMaps=this.filterFactory.addFilter(s);break}}get inSMaskMode(){return!!this.suspendedCtx}checkSMaskState(){const e=this.inSMaskMode;this.current.activeSMask&&!e?this.beginSMaskMode():!this.current.activeSMask&&e&&this.endSMaskMode()}beginSMaskMode(){if(this.inSMaskMode)throw new Error("beginSMaskMode called while already in smask mode");const e=this.ctx.canvas.width,t=this.ctx.canvas.height,s="smaskGroupAt"+this.groupLevel,i=this.cachedCanvases.getCanvas(s,e,t);this.suspendedCtx=this.ctx,this.ctx=i.context;const n=this.ctx;n.setTransform(...Bt(this.suspendedCtx)),ma(this.suspendedCtx,n),bg(n,this.suspendedCtx),this.setGState([["BM","source-over"],["ca",1],["CA",1]])}endSMaskMode(){if(!this.inSMaskMode)throw new Error("endSMaskMode called while not in smask mode");this.ctx._removeMirroring(),ma(this.ctx,this.suspendedCtx),this.ctx=this.suspendedCtx,this.suspendedCtx=null}compose(e){if(!this.current.activeSMask)return;e?(e[0]=Math.floor(e[0]),e[1]=Math.floor(e[1]),e[2]=Math.ceil(e[2]),e[3]=Math.ceil(e[3])):e=[0,0,this.ctx.canvas.width,this.ctx.canvas.height];const t=this.current.activeSMask,s=this.suspendedCtx;this.composeSMask(s,t,this.ctx,e),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(e,t,s,i){const n=i[0],r=i[1],a=i[2]-n,h=i[3]-r;a===0||h===0||(this.genericComposeSMask(t.context,s,a,h,t.subtype,t.backdrop,t.transferMap,n,r,t.offsetX,t.offsetY),e.save(),e.globalAlpha=1,e.globalCompositeOperation="source-over",e.setTransform(1,0,0,1,0,0),e.drawImage(s.canvas,0,0),e.restore())}genericComposeSMask(e,t,s,i,n,r,a,h,l,c,d){let p=e.canvas,f=h-c,g=l-d;if(r){if(f<0||g<0||f+s>p.width||g+i>p.height){const v=this.cachedCanvases.getCanvas("maskExtension",s,i),b=v.context;b.drawImage(p,-f,-g),r.some(A=>A!==0)&&(b.globalCompositeOperation="destination-atop",b.fillStyle=at.makeHexColor(...r),b.fillRect(0,0,s,i),b.globalCompositeOperation="source-over"),p=v.canvas,f=g=0}else if(r.some(v=>v!==0)){e.save(),e.globalAlpha=1,e.setTransform(1,0,0,1,0,0);const v=new Path2D;v.rect(f,g,s,i),e.clip(v),e.globalCompositeOperation="destination-atop",e.fillStyle=at.makeHexColor(...r),e.fillRect(f,g,s,i),e.restore()}}t.save(),t.globalAlpha=1,t.setTransform(1,0,0,1,0,0),n==="Alpha"&&a?t.filter=this.filterFactory.addAlphaFilter(a):n==="Luminosity"&&(t.filter=this.filterFactory.addLuminosityFilter(a));const m=new Path2D;m.rect(h,l,s,i),t.clip(m),t.globalCompositeOperation="destination-in",t.drawImage(p,f,g,s,i,h,l,s,i),t.restore()}save(){this.inSMaskMode?(ma(this.ctx,this.suspendedCtx),this.suspendedCtx.save()):this.ctx.save();const e=this.current;this.stateStack.push(e),this.current=e.clone()}restore(){this.stateStack.length===0&&this.inSMaskMode&&this.endSMaskMode(),this.stateStack.length!==0&&(this.current=this.stateStack.pop(),this.inSMaskMode?(this.suspendedCtx.restore(),ma(this.suspendedCtx,this.ctx)):this.ctx.restore(),this.checkSMaskState(),this.pendingClip=null,this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null)}transform(e,t,s,i,n,r){this.ctx.transform(e,t,s,i,n,r),this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null}constructPath(e,t,s){const i=this.ctx,n=this.current;let r=n.x,a=n.y,h,l;const c=Bt(i),d=c[0]===0&&c[3]===0||c[1]===0&&c[2]===0,p=d?s.slice(0):null;for(let f=0,g=0,m=e.length;f<m;f++)switch(e[f]|0){case es.rectangle:r=t[g++],a=t[g++];const v=t[g++],b=t[g++],A=r+v,x=a+b;i.moveTo(r,a),v===0||b===0?i.lineTo(A,x):(i.lineTo(A,a),i.lineTo(A,x),i.lineTo(r,x)),d||n.updateRectMinMax(c,[r,a,A,x]),i.closePath();break;case es.moveTo:r=t[g++],a=t[g++],i.moveTo(r,a),d||n.updatePathMinMax(c,r,a);break;case es.lineTo:r=t[g++],a=t[g++],i.lineTo(r,a),d||n.updatePathMinMax(c,r,a);break;case es.curveTo:h=r,l=a,r=t[g+4],a=t[g+5],i.bezierCurveTo(t[g],t[g+1],t[g+2],t[g+3],r,a),n.updateCurvePathMinMax(c,h,l,t[g],t[g+1],t[g+2],t[g+3],r,a,p),g+=6;break;case es.curveTo2:h=r,l=a,i.bezierCurveTo(r,a,t[g],t[g+1],t[g+2],t[g+3]),n.updateCurvePathMinMax(c,h,l,r,a,t[g],t[g+1],t[g+2],t[g+3],p),r=t[g+2],a=t[g+3],g+=4;break;case es.curveTo3:h=r,l=a,r=t[g+2],a=t[g+3],i.bezierCurveTo(t[g],t[g+1],r,a,r,a),n.updateCurvePathMinMax(c,h,l,t[g],t[g+1],r,a,r,a,p),g+=4;break;case es.closePath:i.closePath();break}d&&n.updateScalingPathMinMax(c,p),n.setCurrentPoint(r,a)}closePath(){this.ctx.closePath()}stroke(e=!0){const t=this.ctx,s=this.current.strokeColor;t.globalAlpha=this.current.strokeAlpha,this.contentVisible&&(typeof s=="object"&&(s!=null&&s.getPattern)?(t.save(),t.strokeStyle=s.getPattern(t,this,zs(t),ye.STROKE),this.rescaleAndStroke(!1),t.restore()):this.rescaleAndStroke(!0)),e&&this.consumePath(this.current.getClippedPathBoundingBox()),t.globalAlpha=this.current.fillAlpha}closeStroke(){this.closePath(),this.stroke()}fill(e=!0){const t=this.ctx,s=this.current.fillColor,i=this.current.patternFill;let n=!1;i&&(t.save(),t.fillStyle=s.getPattern(t,this,zs(t),ye.FILL),n=!0);const r=this.current.getClippedPathBoundingBox();this.contentVisible&&r!==null&&(this.pendingEOFill?(t.fill("evenodd"),this.pendingEOFill=!1):t.fill()),n&&t.restore(),e&&this.consumePath(r)}eoFill(){this.pendingEOFill=!0,this.fill()}fillStroke(){this.fill(!1),this.stroke(!1),this.consumePath()}eoFillStroke(){this.pendingEOFill=!0,this.fillStroke()}closeFillStroke(){this.closePath(),this.fillStroke()}closeEOFillStroke(){this.pendingEOFill=!0,this.closePath(),this.fillStroke()}endPath(){this.consumePath()}clip(){this.pendingClip=wg}eoClip(){this.pendingClip=Vd}beginText(){this.current.textMatrix=su,this.current.textMatrixScale=1,this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0}endText(){const e=this.pendingTextPaths,t=this.ctx;if(e===void 0){t.beginPath();return}t.save(),t.beginPath();for(const s of e)t.setTransform(...s.transform),t.translate(s.x,s.y),s.addToPath(t,s.fontSize);t.restore(),t.clip(),t.beginPath(),delete this.pendingTextPaths}setCharSpacing(e){this.current.charSpacing=e}setWordSpacing(e){this.current.wordSpacing=e}setHScale(e){this.current.textHScale=e/100}setLeading(e){this.current.leading=-e}setFont(e,t){var c;const s=this.commonObjs.get(e),i=this.current;if(!s)throw new Error(`Can't find font for ${e}`);if(i.fontMatrix=s.fontMatrix||Xl,(i.fontMatrix[0]===0||i.fontMatrix[3]===0)&>("Invalid font matrix for font "+e),t<0?(t=-t,i.fontDirection=-1):i.fontDirection=1,this.current.font=s,this.current.fontSize=t,s.isType3Font)return;const n=s.loadedName||"sans-serif",r=((c=s.systemFontInfo)==null?void 0:c.css)||`"${n}", ${s.fallbackName}`;let a="normal";s.black?a="900":s.bold&&(a="bold");const h=s.italic?"italic":"normal";let l=t;t<Bd?l=Bd:t>zd&&(l=zd),this.current.fontSizeScale=t/l,this.ctx.font=`${h} ${a} ${l}px ${r}`}setTextRenderingMode(e){this.current.textRenderingMode=e}setTextRise(e){this.current.textRise=e}moveText(e,t){this.current.x=this.current.lineX+=e,this.current.y=this.current.lineY+=t}setLeadingMoveText(e,t){this.setLeading(-t),this.moveText(e,t)}setTextMatrix(e,t,s,i,n,r){this.current.textMatrix=[e,t,s,i,n,r],this.current.textMatrixScale=Math.hypot(e,t),this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0}nextLine(){this.moveText(0,this.current.leading)}paintChar(e,t,s,i){const n=this.ctx,r=this.current,a=r.font,h=r.textRenderingMode,l=r.fontSize/r.fontSizeScale,c=h&de.FILL_STROKE_MASK,d=!!(h&de.ADD_TO_PATH_FLAG),p=r.patternFill&&!a.missingFile;let f;(a.disableFontFace||d||p)&&(f=a.getPathGenerator(this.commonObjs,e)),a.disableFontFace||p?(n.save(),n.translate(t,s),n.beginPath(),f(n,l),i&&n.setTransform(...i),(c===de.FILL||c===de.FILL_STROKE)&&n.fill(),(c===de.STROKE||c===de.FILL_STROKE)&&n.stroke(),n.restore()):((c===de.FILL||c===de.FILL_STROKE)&&n.fillText(e,t,s),(c===de.STROKE||c===de.FILL_STROKE)&&n.strokeText(e,t,s)),d&&(this.pendingTextPaths||(this.pendingTextPaths=[])).push({transform:Bt(n),x:t,y:s,fontSize:l,addToPath:f})}get isFontSubpixelAAEnabled(){const{context:e}=this.cachedCanvases.getCanvas("isFontSubpixelAAEnabled",10,10);e.scale(1.5,1),e.fillText("I",0,10);const t=e.getImageData(0,0,10,10).data;let s=!1;for(let i=3;i<t.length;i+=4)if(t[i]>0&&t[i]<255){s=!0;break}return Et(this,"isFontSubpixelAAEnabled",s)}showText(e){const t=this.current,s=t.font;if(s.isType3Font)return this.showType3Text(e);const i=t.fontSize;if(i===0)return;const n=this.ctx,r=t.fontSizeScale,a=t.charSpacing,h=t.wordSpacing,l=t.fontDirection,c=t.textHScale*l,d=e.length,p=s.vertical,f=p?1:-1,g=s.defaultVMetrics,m=i*t.fontMatrix[0],v=t.textRenderingMode===de.FILL&&!s.disableFontFace&&!t.patternFill;n.save(),n.transform(...t.textMatrix),n.translate(t.x,t.y+t.textRise),l>0?n.scale(c,-1):n.scale(c,1);let b;if(t.patternFill){n.save();const L=t.fillColor.getPattern(n,this,zs(n),ye.FILL);b=Bt(n),n.restore(),n.fillStyle=L}let A=t.lineWidth;const x=t.textMatrixScale;if(x===0||A===0){const L=t.textRenderingMode&de.FILL_STROKE_MASK;(L===de.STROKE||L===de.FILL_STROKE)&&(A=this.getSinglePixelWidth())}else A/=x;if(r!==1&&(n.scale(r,r),A/=r),n.lineWidth=A,s.isInvalidPDFjsFont){const L=[];let I=0;for(const B of e)L.push(B.unicode),I+=B.width;n.fillText(L.join(""),0,0),t.x+=I*m*c,n.restore(),this.compose();return}let k=0,T;for(T=0;T<d;++T){const L=e[T];if(typeof L=="number"){k+=f*L*i/1e3;continue}let I=!1;const B=(L.isSpace?h:0)+a,D=L.fontChar,W=L.accent;let q,P,z=L.width;if(p){const H=L.vmetric||g,rt=-(L.vmetric?H[1]:z*.5)*m,U=H[2]*m;z=H?-H[0]:z,q=rt/r,P=(k+U)/r}else q=k/r,P=0;if(s.remeasure&&z>0){const H=n.measureText(D).width*1e3/i*r;if(z<H&&this.isFontSubpixelAAEnabled){const rt=z/H;I=!0,n.save(),n.scale(rt,1),q/=rt}else z!==H&&(q+=(z-H)/2e3*i/r)}if(this.contentVisible&&(L.isInFont||s.missingFile)){if(v&&!W)n.fillText(D,q,P);else if(this.paintChar(D,q,P,b),W){const H=q+i*W.offset.x/r,rt=P-i*W.offset.y/r;this.paintChar(W.fontChar,H,rt,b)}}const y=p?z*m-B*l:z*m+B*l;k+=y,I&&n.restore()}p?t.y-=k:t.x+=k*c,n.restore(),this.compose()}showType3Text(e){const t=this.ctx,s=this.current,i=s.font,n=s.fontSize,r=s.fontDirection,a=i.vertical?1:-1,h=s.charSpacing,l=s.wordSpacing,c=s.textHScale*r,d=s.fontMatrix||Xl,p=e.length,f=s.textRenderingMode===de.INVISIBLE;let g,m,v,b;if(!(f||n===0)){for(this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null,t.save(),t.transform(...s.textMatrix),t.translate(s.x,s.y),t.scale(c,r),g=0;g<p;++g){if(m=e[g],typeof m=="number"){b=a*m*n/1e3,this.ctx.translate(b,0),s.x+=b*c;continue}const A=(m.isSpace?l:0)+h,x=i.charProcOperatorList[m.operatorListId];if(!x){gt(`Type3 character "${m.operatorListId}" is not available.`);continue}this.contentVisible&&(this.processingType3=m,this.save(),t.scale(n,n),t.transform(...d),this.executeOperatorList(x),this.restore()),v=at.applyTransform([m.width,0],d)[0]*n+A,t.translate(v,0),s.x+=v*c}t.restore(),this.processingType3=null}}setCharWidth(e,t){}setCharWidthAndBounds(e,t,s,i,n,r){this.ctx.rect(s,i,n-s,r-i),this.ctx.clip(),this.endPath()}getColorN_Pattern(e){let t;if(e[0]==="TilingPattern"){const s=e[1],i=this.baseTransform||Bt(this.ctx),n={createCanvasGraphics:r=>new wd(r,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:this.optionalContentConfig,markedContentStack:this.markedContentStack})};t=new wc(e,s,this.ctx,n,i)}else t=this._getPattern(e[1],e[2]);return t}setStrokeColorN(){this.current.strokeColor=this.getColorN_Pattern(arguments)}setFillColorN(){this.current.fillColor=this.getColorN_Pattern(arguments),this.current.patternFill=!0}setStrokeRGBColor(e,t,s){const i=at.makeHexColor(e,t,s);this.ctx.strokeStyle=i,this.current.strokeColor=i}setFillRGBColor(e,t,s){const i=at.makeHexColor(e,t,s);this.ctx.fillStyle=i,this.current.fillColor=i,this.current.patternFill=!1}_getPattern(e,t=null){let s;return this.cachedPatterns.has(e)?s=this.cachedPatterns.get(e):(s=pg(this.getObject(e)),this.cachedPatterns.set(e,s)),t&&(s.matrix=t),s}shadingFill(e){if(!this.contentVisible)return;const t=this.ctx;this.save();const s=this._getPattern(e);t.fillStyle=s.getPattern(t,this,zs(t),ye.SHADING);const i=zs(t);if(i){const{width:n,height:r}=t.canvas,[a,h,l,c]=at.getAxialAlignedBoundingBox([0,0,n,r],i);this.ctx.fillRect(a,h,l-a,c-h)}else this.ctx.fillRect(-1e10,-1e10,2e10,2e10);this.compose(this.current.getClippedPathBoundingBox()),this.restore()}beginInlineImage(){Rt("Should not call beginInlineImage")}beginImageData(){Rt("Should not call beginImageData")}paintFormXObjectBegin(e,t){if(this.contentVisible&&(this.save(),this.baseTransformStack.push(this.baseTransform),e&&this.transform(...e),this.baseTransform=Bt(this.ctx),t)){const s=t[2]-t[0],i=t[3]-t[1];this.ctx.rect(t[0],t[1],s,i),this.current.updateRectMinMax(Bt(this.ctx),t),this.clip(),this.endPath()}}paintFormXObjectEnd(){this.contentVisible&&(this.restore(),this.baseTransform=this.baseTransformStack.pop())}beginGroup(e){if(!this.contentVisible)return;this.save(),this.inSMaskMode&&(this.endSMaskMode(),this.current.activeSMask=null);const t=this.ctx;e.isolated||Ll("TODO: Support non-isolated groups."),e.knockout&>("Knockout groups not supported.");const s=Bt(t);if(e.matrix&&t.transform(...e.matrix),!e.bbox)throw new Error("Bounding box is required.");let i=at.getAxialAlignedBoundingBox(e.bbox,Bt(t));const n=[0,0,t.canvas.width,t.canvas.height];i=at.intersect(i,n)||[0,0,0,0];const r=Math.floor(i[0]),a=Math.floor(i[1]),h=Math.max(Math.ceil(i[2])-r,1),l=Math.max(Math.ceil(i[3])-a,1);this.current.startNewPathAndClipBox([0,0,h,l]);let c="groupAt"+this.groupLevel;e.smask&&(c+="_smask_"+this.smaskCounter++%2);const d=this.cachedCanvases.getCanvas(c,h,l),p=d.context;p.translate(-r,-a),p.transform(...s),e.smask?this.smaskStack.push({canvas:d.canvas,context:p,offsetX:r,offsetY:a,subtype:e.smask.subtype,backdrop:e.smask.backdrop,transferMap:e.smask.transferMap||null,startTransformInverse:null}):(t.setTransform(1,0,0,1,0,0),t.translate(r,a),t.save()),ma(t,p),this.ctx=p,this.setGState([["BM","source-over"],["ca",1],["CA",1]]),this.groupStack.push(t),this.groupLevel++}endGroup(e){if(!this.contentVisible)return;this.groupLevel--;const t=this.ctx,s=this.groupStack.pop();if(this.ctx=s,this.ctx.imageSmoothingEnabled=!1,e.smask)this.tempSMask=this.smaskStack.pop(),this.restore();else{this.ctx.restore();const i=Bt(this.ctx);this.restore(),this.ctx.save(),this.ctx.setTransform(...i);const n=at.getAxialAlignedBoundingBox([0,0,t.canvas.width,t.canvas.height],i);this.ctx.drawImage(t.canvas,0,0),this.ctx.restore(),this.compose(n)}}beginAnnotation(e,t,s,i,n){if(E(this,Xi,Ec).call(this),kh(this.ctx),this.ctx.save(),this.save(),this.baseTransform&&this.ctx.setTransform(...this.baseTransform),t){const r=t[2]-t[0],a=t[3]-t[1];if(n&&this.annotationCanvasMap){s=s.slice(),s[4]-=t[0],s[5]-=t[1],t=t.slice(),t[0]=t[1]=0,t[2]=r,t[3]=a;const[h,l]=at.singularValueDecompose2dScale(Bt(this.ctx)),{viewportScale:c}=this,d=Math.ceil(r*this.outputScaleX*c),p=Math.ceil(a*this.outputScaleY*c);this.annotationCanvas=this.canvasFactory.create(d,p);const{canvas:f,context:g}=this.annotationCanvas;this.annotationCanvasMap.set(e,f),this.annotationCanvas.savedCtx=this.ctx,this.ctx=g,this.ctx.save(),this.ctx.setTransform(h,0,0,-l,0,a*l),kh(this.ctx)}else kh(this.ctx),this.ctx.rect(t[0],t[1],r,a),this.ctx.clip(),this.endPath()}this.current=new jd(this.ctx.canvas.width,this.ctx.canvas.height),this.transform(...s),this.transform(...i)}endAnnotation(){this.annotationCanvas&&(this.ctx.restore(),E(this,Xi,Sc).call(this),this.ctx=this.annotationCanvas.savedCtx,delete this.annotationCanvas.savedCtx,delete this.annotationCanvas)}paintImageMaskXObject(e){if(!this.contentVisible)return;const t=e.count;e=this.getObject(e.data,e),e.count=t;const s=this.ctx,i=this.processingType3;if(i&&(i.compiled===void 0&&(i.compiled=vg(e)),i.compiled)){i.compiled(s);return}const n=this._createMaskCanvas(e),r=n.canvas;s.save(),s.setTransform(1,0,0,1,0,0),s.drawImage(r,n.offsetX,n.offsetY),s.restore(),this.compose()}paintImageMaskXObjectRepeat(e,t,s=0,i=0,n,r){if(!this.contentVisible)return;e=this.getObject(e.data,e);const a=this.ctx;a.save();const h=Bt(a);a.transform(t,s,i,n,0,0);const l=this._createMaskCanvas(e);a.setTransform(1,0,0,1,l.offsetX-h[4],l.offsetY-h[5]);for(let c=0,d=r.length;c<d;c+=2){const p=at.transform(h,[t,s,i,n,r[c],r[c+1]]),[f,g]=at.applyTransform([0,0],p);a.drawImage(l.canvas,f,g)}a.restore(),this.compose()}paintImageMaskXObjectGroup(e){if(!this.contentVisible)return;const t=this.ctx,s=this.current.fillColor,i=this.current.patternFill;for(const n of e){const{data:r,width:a,height:h,transform:l}=n,c=this.cachedCanvases.getCanvas("maskCanvas",a,h),d=c.context;d.save();const p=this.getObject(r,n);Gd(d,p),d.globalCompositeOperation="source-in",d.fillStyle=i?s.getPattern(d,this,zs(t),ye.FILL):s,d.fillRect(0,0,a,h),d.restore(),t.save(),t.transform(...l),t.scale(1,-1),Ch(t,c.canvas,0,0,a,h,0,-1,1,1),t.restore()}this.compose()}paintImageXObject(e){if(!this.contentVisible)return;const t=this.getObject(e);if(!t){gt("Dependent image isn't ready yet");return}this.paintInlineImageXObject(t)}paintImageXObjectRepeat(e,t,s,i){if(!this.contentVisible)return;const n=this.getObject(e);if(!n){gt("Dependent image isn't ready yet");return}const r=n.width,a=n.height,h=[];for(let l=0,c=i.length;l<c;l+=2)h.push({transform:[t,0,0,s,i[l],i[l+1]],x:0,y:0,w:r,h:a});this.paintInlineImageXObjectGroup(n,h)}applyTransferMapsToCanvas(e){return this.current.transferMaps!=="none"&&(e.filter=this.current.transferMaps,e.drawImage(e.canvas,0,0),e.filter="none"),e.canvas}applyTransferMapsToBitmap(e){if(this.current.transferMaps==="none")return e.bitmap;const{bitmap:t,width:s,height:i}=e,n=this.cachedCanvases.getCanvas("inlineImage",s,i),r=n.context;return r.filter=this.current.transferMaps,r.drawImage(t,0,0),r.filter="none",n.canvas}paintInlineImageXObject(e){if(!this.contentVisible)return;const t=e.width,s=e.height,i=this.ctx;if(this.save(),!me){const{filter:a}=i;a!=="none"&&a!==""&&(i.filter="none")}i.scale(1/t,-1/s);let n;if(e.bitmap)n=this.applyTransferMapsToBitmap(e);else if(typeof HTMLElement=="function"&&e instanceof HTMLElement||!e.data)n=e;else{const h=this.cachedCanvases.getCanvas("inlineImage",t,s).context;Wd(h,e),n=this.applyTransferMapsToCanvas(h)}const r=this._scaleImage(n,zs(i));i.imageSmoothingEnabled=$d(Bt(i),e.interpolate),Ch(i,r.img,0,0,r.paintWidth,r.paintHeight,0,-s,t,s),this.compose(),this.restore()}paintInlineImageXObjectGroup(e,t){if(!this.contentVisible)return;const s=this.ctx;let i;if(e.bitmap)i=e.bitmap;else{const n=e.width,r=e.height,h=this.cachedCanvases.getCanvas("inlineImage",n,r).context;Wd(h,e),i=this.applyTransferMapsToCanvas(h)}for(const n of t)s.save(),s.transform(...n.transform),s.scale(1,-1),Ch(s,i,n.x,n.y,n.w,n.h,0,-1,1,1),s.restore();this.compose()}paintSolidColorImageMask(){this.contentVisible&&(this.ctx.fillRect(0,0,1,1),this.compose())}markPoint(e){}markPointProps(e,t){}beginMarkedContent(e){this.markedContentStack.push({visible:!0})}beginMarkedContentProps(e,t){e==="OC"?this.markedContentStack.push({visible:this.optionalContentConfig.isVisible(t)}):this.markedContentStack.push({visible:!0}),this.contentVisible=this.isContentVisible()}endMarkedContent(){this.markedContentStack.pop(),this.contentVisible=this.isContentVisible()}beginCompat(){}endCompat(){}consumePath(e){const t=this.current.isEmptyClip();this.pendingClip&&this.current.updateClipFromPath(),this.pendingClip||this.compose(e);const s=this.ctx;this.pendingClip&&(t||(this.pendingClip===Vd?s.clip("evenodd"):s.clip()),this.pendingClip=null),this.current.startNewPathAndClipBox(this.current.clipBox),s.beginPath()}getSinglePixelWidth(){if(!this._cachedGetSinglePixelWidth){const e=Bt(this.ctx);if(e[1]===0&&e[2]===0)this._cachedGetSinglePixelWidth=1/Math.min(Math.abs(e[0]),Math.abs(e[3]));else{const t=Math.abs(e[0]*e[3]-e[2]*e[1]),s=Math.hypot(e[0],e[2]),i=Math.hypot(e[1],e[3]);this._cachedGetSinglePixelWidth=Math.max(s,i)/t}}return this._cachedGetSinglePixelWidth}getScaleForStroking(){if(this._cachedScaleForStroking[0]===-1){const{lineWidth:e}=this.current,{a:t,b:s,c:i,d:n}=this.ctx.getTransform();let r,a;if(s===0&&i===0){const h=Math.abs(t),l=Math.abs(n);if(h===l)if(e===0)r=a=1/h;else{const c=h*e;r=a=c<1?1/c:1}else if(e===0)r=1/h,a=1/l;else{const c=h*e,d=l*e;r=c<1?1/c:1,a=d<1?1/d:1}}else{const h=Math.abs(t*n-s*i),l=Math.hypot(t,s),c=Math.hypot(i,n);if(e===0)r=c/h,a=l/h;else{const d=e*h;r=c>d?c/d:1,a=l>d?l/d:1}}this._cachedScaleForStroking[0]=r,this._cachedScaleForStroking[1]=a}return this._cachedScaleForStroking}rescaleAndStroke(e){const{ctx:t}=this,{lineWidth:s}=this.current,[i,n]=this.getScaleForStroking();if(t.lineWidth=s||1,i===1&&n===1){t.stroke();return}const r=t.getLineDash();if(e&&t.save(),t.scale(i,n),r.length>0){const a=Math.max(i,n);t.setLineDash(r.map(h=>h/a)),t.lineDashOffset/=a}t.stroke(),e&&t.restore()}isContentVisible(){for(let e=this.markedContentStack.length-1;e>=0;e--)if(!this.markedContentStack[e].visible)return!1;return!0}};Xi=new WeakSet,Ec=function(){for(;this.stateStack.length||this.inSMaskMode;)this.restore();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.transparentCanvas=null)},Sc=function(){if(this.pageColors){const e=this.filterFactory.addHCMFilter(this.pageColors.foreground,this.pageColors.background);if(e!=="none"){const t=this.ctx.filter;this.ctx.filter=e,this.ctx.drawImage(this.ctx.canvas,0,0),this.ctx.filter=t}}};let fr=wd;for(const u in es)fr.prototype[u]!==void 0&&(fr.prototype[es[u]]=fr.prototype[u]);var po,go;class gi{static get workerPort(){return o(this,po)}static set workerPort(e){if(!(typeof Worker<"u"&&e instanceof Worker)&&e!==null)throw new Error("Invalid `workerPort` type.");w(this,po,e)}static get workerSrc(){return o(this,go)}static set workerSrc(e){if(typeof e!="string")throw new Error("Invalid `workerSrc` type.");w(this,go,e)}}po=new WeakMap,go=new WeakMap,S(gi,po,null),S(gi,go,"");const Th={UNKNOWN:0,DATA:1,ERROR:2},Gt={UNKNOWN:0,CANCEL:1,CANCEL_COMPLETE:2,CLOSE:3,ENQUEUE:4,ERROR:5,PULL:6,PULL_COMPLETE:7,START_COMPLETE:8};function Ie(u){switch(u instanceof Error||typeof u=="object"&&u!==null||Rt('wrapReason: Expected "reason" to be a (possibly cloned) Error.'),u.name){case"AbortException":return new ir(u.message);case"MissingPDFException":return new sr(u.message);case"PasswordException":return new Kl(u.message,u.code);case"UnexpectedResponseException":return new Il(u.message,u.status);case"UnknownErrorException":return new Zl(u.message,u.details);default:return new Zl(u.message,u.toString())}}var Fs,zu,Hu,Nh;class xa{constructor(e,t,s){S(this,Fs);this.sourceName=e,this.targetName=t,this.comObj=s,this.callbackId=1,this.streamId=1,this.streamSinks=Object.create(null),this.streamControllers=Object.create(null),this.callbackCapabilities=Object.create(null),this.actionHandler=Object.create(null),this._onComObjOnMessage=i=>{const n=i.data;if(n.targetName!==this.sourceName)return;if(n.stream){E(this,Fs,Hu).call(this,n);return}if(n.callback){const a=n.callbackId,h=this.callbackCapabilities[a];if(!h)throw new Error(`Cannot resolve callback ${a}`);if(delete this.callbackCapabilities[a],n.callback===Th.DATA)h.resolve(n.data);else if(n.callback===Th.ERROR)h.reject(Ie(n.reason));else throw new Error("Unexpected callback case");return}const r=this.actionHandler[n.action];if(!r)throw new Error(`Unknown action from worker: ${n.action}`);if(n.callbackId){const a=this.sourceName,h=n.sourceName;new Promise(function(l){l(r(n.data))}).then(function(l){s.postMessage({sourceName:a,targetName:h,callback:Th.DATA,callbackId:n.callbackId,data:l})},function(l){s.postMessage({sourceName:a,targetName:h,callback:Th.ERROR,callbackId:n.callbackId,reason:Ie(l)})});return}if(n.streamId){E(this,Fs,zu).call(this,n);return}r(n.data)},s.addEventListener("message",this._onComObjOnMessage)}on(e,t){const s=this.actionHandler;if(s[e])throw new Error(`There is already an actionName called "${e}"`);s[e]=t}send(e,t,s){this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:e,data:t},s)}sendWithPromise(e,t,s){const i=this.callbackId++,n=Promise.withResolvers();this.callbackCapabilities[i]=n;try{this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:e,callbackId:i,data:t},s)}catch(r){n.reject(r)}return n.promise}sendWithStream(e,t,s,i){const n=this.streamId++,r=this.sourceName,a=this.targetName,h=this.comObj;return new ReadableStream({start:l=>{const c=Promise.withResolvers();return this.streamControllers[n]={controller:l,startCall:c,pullCall:null,cancelCall:null,isClosed:!1},h.postMessage({sourceName:r,targetName:a,action:e,streamId:n,data:t,desiredSize:l.desiredSize},i),c.promise},pull:l=>{const c=Promise.withResolvers();return this.streamControllers[n].pullCall=c,h.postMessage({sourceName:r,targetName:a,stream:Gt.PULL,streamId:n,desiredSize:l.desiredSize}),c.promise},cancel:l=>{Qt(l instanceof Error,"cancel must have a valid reason");const c=Promise.withResolvers();return this.streamControllers[n].cancelCall=c,this.streamControllers[n].isClosed=!0,h.postMessage({sourceName:r,targetName:a,stream:Gt.CANCEL,streamId:n,reason:Ie(l)}),c.promise}},s)}destroy(){this.comObj.removeEventListener("message",this._onComObjOnMessage)}}Fs=new WeakSet,zu=function(e){const t=e.streamId,s=this.sourceName,i=e.sourceName,n=this.comObj,r=this,a=this.actionHandler[e.action],h={enqueue(l,c=1,d){if(this.isCancelled)return;const p=this.desiredSize;this.desiredSize-=c,p>0&&this.desiredSize<=0&&(this.sinkCapability=Promise.withResolvers(),this.ready=this.sinkCapability.promise),n.postMessage({sourceName:s,targetName:i,stream:Gt.ENQUEUE,streamId:t,chunk:l},d)},close(){this.isCancelled||(this.isCancelled=!0,n.postMessage({sourceName:s,targetName:i,stream:Gt.CLOSE,streamId:t}),delete r.streamSinks[t])},error(l){Qt(l instanceof Error,"error must have a valid reason"),!this.isCancelled&&(this.isCancelled=!0,n.postMessage({sourceName:s,targetName:i,stream:Gt.ERROR,streamId:t,reason:Ie(l)}))},sinkCapability:Promise.withResolvers(),onPull:null,onCancel:null,isCancelled:!1,desiredSize:e.desiredSize,ready:null};h.sinkCapability.resolve(),h.ready=h.sinkCapability.promise,this.streamSinks[t]=h,new Promise(function(l){l(a(e.data,h))}).then(function(){n.postMessage({sourceName:s,targetName:i,stream:Gt.START_COMPLETE,streamId:t,success:!0})},function(l){n.postMessage({sourceName:s,targetName:i,stream:Gt.START_COMPLETE,streamId:t,reason:Ie(l)})})},Hu=function(e){const t=e.streamId,s=this.sourceName,i=e.sourceName,n=this.comObj,r=this.streamControllers[t],a=this.streamSinks[t];switch(e.stream){case Gt.START_COMPLETE:e.success?r.startCall.resolve():r.startCall.reject(Ie(e.reason));break;case Gt.PULL_COMPLETE:e.success?r.pullCall.resolve():r.pullCall.reject(Ie(e.reason));break;case Gt.PULL:if(!a){n.postMessage({sourceName:s,targetName:i,stream:Gt.PULL_COMPLETE,streamId:t,success:!0});break}a.desiredSize<=0&&e.desiredSize>0&&a.sinkCapability.resolve(),a.desiredSize=e.desiredSize,new Promise(function(h){var l;h((l=a.onPull)==null?void 0:l.call(a))}).then(function(){n.postMessage({sourceName:s,targetName:i,stream:Gt.PULL_COMPLETE,streamId:t,success:!0})},function(h){n.postMessage({sourceName:s,targetName:i,stream:Gt.PULL_COMPLETE,streamId:t,reason:Ie(h)})});break;case Gt.ENQUEUE:if(Qt(r,"enqueue should have stream controller"),r.isClosed)break;r.controller.enqueue(e.chunk);break;case Gt.CLOSE:if(Qt(r,"close should have stream controller"),r.isClosed)break;r.isClosed=!0,r.controller.close(),E(this,Fs,Nh).call(this,r,t);break;case Gt.ERROR:Qt(r,"error should have stream controller"),r.controller.error(Ie(e.reason)),E(this,Fs,Nh).call(this,r,t);break;case Gt.CANCEL_COMPLETE:e.success?r.cancelCall.resolve():r.cancelCall.reject(Ie(e.reason)),E(this,Fs,Nh).call(this,r,t);break;case Gt.CANCEL:if(!a)break;new Promise(function(h){var l;h((l=a.onCancel)==null?void 0:l.call(a,Ie(e.reason)))}).then(function(){n.postMessage({sourceName:s,targetName:i,stream:Gt.CANCEL_COMPLETE,streamId:t,success:!0})},function(h){n.postMessage({sourceName:s,targetName:i,stream:Gt.CANCEL_COMPLETE,streamId:t,reason:Ie(h)})}),a.sinkCapability.reject(Ie(e.reason)),a.isCancelled=!0,delete this.streamSinks[t];break;default:throw new Error("Unexpected stream case")}},Nh=async function(e,t){var s,i,n;await Promise.allSettled([(s=e.startCall)==null?void 0:s.promise,(i=e.pullCall)==null?void 0:i.promise,(n=e.cancelCall)==null?void 0:n.promise]),delete this.streamControllers[t]};var vn,mo;class Eg{constructor({parsedData:e,rawData:t}){S(this,vn);S(this,mo);w(this,vn,e),w(this,mo,t)}getRaw(){return o(this,mo)}get(e){return o(this,vn).get(e)??null}getAll(){return cd(o(this,vn))}has(e){return o(this,vn).has(e)}}vn=new WeakMap,mo=new WeakMap;const wi=Symbol("INTERNAL");var bo,_o,vo,Tr;class Sg{constructor(e,{name:t,intent:s,usage:i}){S(this,bo,!1);S(this,_o,!1);S(this,vo,!1);S(this,Tr,!0);w(this,bo,!!(e&Ke.DISPLAY)),w(this,_o,!!(e&Ke.PRINT)),this.name=t,this.intent=s,this.usage=i}get visible(){if(o(this,vo))return o(this,Tr);if(!o(this,Tr))return!1;const{print:e,view:t}=this.usage;return o(this,bo)?(t==null?void 0:t.viewState)!=="OFF":o(this,_o)?(e==null?void 0:e.printState)!=="OFF":!0}_setVisible(e,t,s=!1){e!==wi&&Rt("Internal method `_setVisible` called."),w(this,vo,s),w(this,Tr,t)}}bo=new WeakMap,_o=new WeakMap,vo=new WeakMap,Tr=new WeakMap;var Pi,Tt,Rr,Pr,yo,xc;class xg{constructor(e,t=Ke.DISPLAY){S(this,yo);S(this,Pi,null);S(this,Tt,new Map);S(this,Rr,null);S(this,Pr,null);if(this.renderingIntent=t,this.name=null,this.creator=null,e!==null){this.name=e.name,this.creator=e.creator,w(this,Pr,e.order);for(const s of e.groups)o(this,Tt).set(s.id,new Sg(t,s));if(e.baseState==="OFF")for(const s of o(this,Tt).values())s._setVisible(wi,!1);for(const s of e.on)o(this,Tt).get(s)._setVisible(wi,!0);for(const s of e.off)o(this,Tt).get(s)._setVisible(wi,!1);w(this,Rr,this.getHash())}}isVisible(e){if(o(this,Tt).size===0)return!0;if(!e)return Ll("Optional content group not defined."),!0;if(e.type==="OCG")return o(this,Tt).has(e.id)?o(this,Tt).get(e.id).visible:(gt(`Optional content group not found: ${e.id}`),!0);if(e.type==="OCMD"){if(e.expression)return E(this,yo,xc).call(this,e.expression);if(!e.policy||e.policy==="AnyOn"){for(const t of e.ids){if(!o(this,Tt).has(t))return gt(`Optional content group not found: ${t}`),!0;if(o(this,Tt).get(t).visible)return!0}return!1}else if(e.policy==="AllOn"){for(const t of e.ids){if(!o(this,Tt).has(t))return gt(`Optional content group not found: ${t}`),!0;if(!o(this,Tt).get(t).visible)return!1}return!0}else if(e.policy==="AnyOff"){for(const t of e.ids){if(!o(this,Tt).has(t))return gt(`Optional content group not found: ${t}`),!0;if(!o(this,Tt).get(t).visible)return!0}return!1}else if(e.policy==="AllOff"){for(const t of e.ids){if(!o(this,Tt).has(t))return gt(`Optional content group not found: ${t}`),!0;if(o(this,Tt).get(t).visible)return!1}return!0}return gt(`Unknown optional content policy ${e.policy}.`),!0}return gt(`Unknown group type ${e.type}.`),!0}setVisibility(e,t=!0){const s=o(this,Tt).get(e);if(!s){gt(`Optional content group not found: ${e}`);return}s._setVisible(wi,!!t,!0),w(this,Pi,null)}setOCGState({state:e,preserveRB:t}){let s;for(const i of e){switch(i){case"ON":case"OFF":case"Toggle":s=i;continue}const n=o(this,Tt).get(i);if(n)switch(s){case"ON":n._setVisible(wi,!0);break;case"OFF":n._setVisible(wi,!1);break;case"Toggle":n._setVisible(wi,!n.visible);break}}w(this,Pi,null)}get hasInitialVisibility(){return o(this,Rr)===null||this.getHash()===o(this,Rr)}getOrder(){return o(this,Tt).size?o(this,Pr)?o(this,Pr).slice():[...o(this,Tt).keys()]:null}getGroups(){return o(this,Tt).size>0?cd(o(this,Tt)):null}getGroup(e){return o(this,Tt).get(e)||null}getHash(){if(o(this,Pi)!==null)return o(this,Pi);const e=new Du;for(const[t,s]of o(this,Tt))e.update(`${t}:${s.visible}`);return w(this,Pi,e.hexdigest())}}Pi=new WeakMap,Tt=new WeakMap,Rr=new WeakMap,Pr=new WeakMap,yo=new WeakSet,xc=function(e){const t=e.length;if(t<2)return!0;const s=e[0];for(let i=1;i<t;i++){const n=e[i];let r;if(Array.isArray(n))r=E(this,yo,xc).call(this,n);else if(o(this,Tt).has(n))r=o(this,Tt).get(n).visible;else return gt(`Optional content group not found: ${n}`),!0;switch(s){case"And":if(!r)return!1;break;case"Or":if(r)return!0;break;case"Not":return!r;default:return!0}}return s==="And"};class Cg{constructor(e,{disableRange:t=!1,disableStream:s=!1}){Qt(e,'PDFDataTransportStream - missing required "pdfDataRangeTransport" argument.');const{length:i,initialData:n,progressiveDone:r,contentDispositionFilename:a}=e;if(this._queuedChunks=[],this._progressiveDone=r,this._contentDispositionFilename=a,(n==null?void 0:n.length)>0){const h=n instanceof Uint8Array&&n.byteLength===n.buffer.byteLength?n.buffer:new Uint8Array(n).buffer;this._queuedChunks.push(h)}this._pdfDataRangeTransport=e,this._isStreamingSupported=!s,this._isRangeSupported=!t,this._contentLength=i,this._fullRequestReader=null,this._rangeReaders=[],e.addRangeListener((h,l)=>{this._onReceiveData({begin:h,chunk:l})}),e.addProgressListener((h,l)=>{this._onProgress({loaded:h,total:l})}),e.addProgressiveReadListener(h=>{this._onReceiveData({chunk:h})}),e.addProgressiveDoneListener(()=>{this._onProgressiveDone()}),e.transportReady()}_onReceiveData({begin:e,chunk:t}){const s=t instanceof Uint8Array&&t.byteLength===t.buffer.byteLength?t.buffer:new Uint8Array(t).buffer;if(e===void 0)this._fullRequestReader?this._fullRequestReader._enqueue(s):this._queuedChunks.push(s);else{const i=this._rangeReaders.some(function(n){return n._begin!==e?!1:(n._enqueue(s),!0)});Qt(i,"_onReceiveData - no `PDFDataTransportStreamRangeReader` instance found.")}}get _progressiveDataLength(){var e;return((e=this._fullRequestReader)==null?void 0:e._loaded)??0}_onProgress(e){var t,s,i,n;e.total===void 0?(s=(t=this._rangeReaders[0])==null?void 0:t.onProgress)==null||s.call(t,{loaded:e.loaded}):(n=(i=this._fullRequestReader)==null?void 0:i.onProgress)==null||n.call(i,{loaded:e.loaded,total:e.total})}_onProgressiveDone(){var e;(e=this._fullRequestReader)==null||e.progressiveDone(),this._progressiveDone=!0}_removeRangeReader(e){const t=this._rangeReaders.indexOf(e);t>=0&&this._rangeReaders.splice(t,1)}getFullReader(){Qt(!this._fullRequestReader,"PDFDataTransportStream.getFullReader can only be called once.");const e=this._queuedChunks;return this._queuedChunks=null,new kg(this,e,this._progressiveDone,this._contentDispositionFilename)}getRangeReader(e,t){if(t<=this._progressiveDataLength)return null;const s=new Tg(this,e,t);return this._pdfDataRangeTransport.requestDataRange(e,t),this._rangeReaders.push(s),s}cancelAllRequests(e){var t;(t=this._fullRequestReader)==null||t.cancel(e);for(const s of this._rangeReaders.slice(0))s.cancel(e);this._pdfDataRangeTransport.abort()}}class kg{constructor(e,t,s=!1,i=null){this._stream=e,this._done=s||!1,this._filename=gd(i)?i:null,this._queuedChunks=t||[],this._loaded=0;for(const n of this._queuedChunks)this._loaded+=n.byteLength;this._requests=[],this._headersReady=Promise.resolve(),e._fullRequestReader=this,this.onProgress=null}_enqueue(e){this._done||(this._requests.length>0?this._requests.shift().resolve({value:e,done:!1}):this._queuedChunks.push(e),this._loaded+=e.byteLength)}get headersReady(){return this._headersReady}get filename(){return this._filename}get isRangeSupported(){return this._stream._isRangeSupported}get isStreamingSupported(){return this._stream._isStreamingSupported}get contentLength(){return this._stream._contentLength}async read(){if(this._queuedChunks.length>0)return{value:this._queuedChunks.shift(),done:!1};if(this._done)return{value:void 0,done:!0};const e=Promise.withResolvers();return this._requests.push(e),e.promise}cancel(e){this._done=!0;for(const t of this._requests)t.resolve({value:void 0,done:!0});this._requests.length=0}progressiveDone(){this._done||(this._done=!0)}}class Tg{constructor(e,t,s){this._stream=e,this._begin=t,this._end=s,this._queuedChunk=null,this._requests=[],this._done=!1,this.onProgress=null}_enqueue(e){if(!this._done){if(this._requests.length===0)this._queuedChunk=e;else{this._requests.shift().resolve({value:e,done:!1});for(const s of this._requests)s.resolve({value:void 0,done:!0});this._requests.length=0}this._done=!0,this._stream._removeRangeReader(this)}}get isStreamingSupported(){return!1}async read(){if(this._queuedChunk){const t=this._queuedChunk;return this._queuedChunk=null,{value:t,done:!1}}if(this._done)return{value:void 0,done:!0};const e=Promise.withResolvers();return this._requests.push(e),e.promise}cancel(e){this._done=!0;for(const t of this._requests)t.resolve({value:void 0,done:!0});this._requests.length=0,this._stream._removeRangeReader(this)}}function Rg(u){let e=!0,t=s("filename\\*","i").exec(u);if(t){t=t[1];let c=a(t);return c=unescape(c),c=h(c),c=l(c),n(c)}if(t=r(u),t){const c=l(t);return n(c)}if(t=s("filename","i").exec(u),t){t=t[1];let c=a(t);return c=l(c),n(c)}function s(c,d){return new RegExp("(?:^|;)\\s*"+c+'\\s*=\\s*([^";\\s][^;\\s]*|"(?:[^"\\\\]|\\\\"?)+"?)',d)}function i(c,d){if(c){if(!/^[\x00-\xFF]+$/.test(d))return d;try{const p=new TextDecoder(c,{fatal:!0}),f=Ml(d);d=p.decode(f),e=!1}catch{}}return d}function n(c){return e&&/[\x80-\xff]/.test(c)&&(c=i("utf-8",c),e&&(c=i("iso-8859-1",c))),c}function r(c){const d=[];let p;const f=s("filename\\*((?!0\\d)\\d+)(\\*?)","ig");for(;(p=f.exec(c))!==null;){let[,m,v,b]=p;if(m=parseInt(m,10),m in d){if(m===0)break;continue}d[m]=[v,b]}const g=[];for(let m=0;m<d.length&&m in d;++m){let[v,b]=d[m];b=a(b),v&&(b=unescape(b),m===0&&(b=h(b))),g.push(b)}return g.join("")}function a(c){if(c.startsWith('"')){const d=c.slice(1).split('\\"');for(let p=0;p<d.length;++p){const f=d[p].indexOf('"');f!==-1&&(d[p]=d[p].slice(0,f),d.length=p+1),d[p]=d[p].replaceAll(/\\(.)/g,"$1")}c=d.join('"')}return c}function h(c){const d=c.indexOf("'");if(d===-1)return c;const p=c.slice(0,d),g=c.slice(d+1).replace(/^[^']*'/,"");return i(p,g)}function l(c){return!c.startsWith("=?")||/[\x00-\x19\x80-\xff]/.test(c)?c:c.replaceAll(/=\?([\w-]*)\?([QqBb])\?((?:[^?]|\?(?!=))*)\?=/g,function(d,p,f,g){if(f==="q"||f==="Q")return g=g.replaceAll("_"," "),g=g.replaceAll(/=([0-9a-fA-F]{2})/g,function(m,v){return String.fromCharCode(parseInt(v,16))}),i(p,g);try{g=atob(g)}catch{}return i(p,g)})}return""}function _d({getResponseHeader:u,isHttp:e,rangeChunkSize:t,disableRange:s}){const i={allowRangeRequests:!1,suggestedLength:void 0},n=parseInt(u("Content-Length"),10);return!Number.isInteger(n)||(i.suggestedLength=n,n<=2*t)||s||!e||u("Accept-Ranges")!=="bytes"||(u("Content-Encoding")||"identity")!=="identity"||(i.allowRangeRequests=!0),i}function vd(u){const e=u("Content-Disposition");if(e){let t=Rg(e);if(t.includes("%"))try{t=decodeURIComponent(t)}catch{}if(gd(t))return t}return null}function Bl(u,e){return u===404||u===0&&e.startsWith("file:")?new sr('Missing PDF "'+e+'".'):new Il(`Unexpected server response (${u}) while retrieving PDF "${e}".`,u)}function Uu(u){return u===200||u===206}function ju(u,e,t){return{method:"GET",headers:u,signal:t.signal,mode:"cors",credentials:e?"include":"same-origin",redirect:"follow"}}function Wu(u){const e=new Headers;for(const t in u){const s=u[t];s!==void 0&&e.append(t,s)}return e}function Gu(u){return u instanceof Uint8Array?u.buffer:u instanceof ArrayBuffer?u:(gt(`getArrayBuffer - unexpected data format: ${u}`),new Uint8Array(u).buffer)}class qd{constructor(e){this.source=e,this.isHttp=/^https?:/i.test(e.url),this.httpHeaders=this.isHttp&&e.httpHeaders||{},this._fullRequestReader=null,this._rangeRequestReaders=[]}get _progressiveDataLength(){var e;return((e=this._fullRequestReader)==null?void 0:e._loaded)??0}getFullReader(){return Qt(!this._fullRequestReader,"PDFFetchStream.getFullReader can only be called once."),this._fullRequestReader=new Pg(this),this._fullRequestReader}getRangeReader(e,t){if(t<=this._progressiveDataLength)return null;const s=new Lg(this,e,t);return this._rangeRequestReaders.push(s),s}cancelAllRequests(e){var t;(t=this._fullRequestReader)==null||t.cancel(e);for(const s of this._rangeRequestReaders.slice(0))s.cancel(e)}}class Pg{constructor(e){this._stream=e,this._reader=null,this._loaded=0,this._filename=null;const t=e.source;this._withCredentials=t.withCredentials||!1,this._contentLength=t.length,this._headersCapability=Promise.withResolvers(),this._disableRange=t.disableRange||!1,this._rangeChunkSize=t.rangeChunkSize,!this._rangeChunkSize&&!this._disableRange&&(this._disableRange=!0),this._abortController=new AbortController,this._isStreamingSupported=!t.disableStream,this._isRangeSupported=!t.disableRange,this._headers=Wu(this._stream.httpHeaders);const s=t.url;fetch(s,ju(this._headers,this._withCredentials,this._abortController)).then(i=>{if(!Uu(i.status))throw Bl(i.status,s);this._reader=i.body.getReader(),this._headersCapability.resolve();const n=h=>i.headers.get(h),{allowRangeRequests:r,suggestedLength:a}=_d({getResponseHeader:n,isHttp:this._stream.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=r,this._contentLength=a||this._contentLength,this._filename=vd(n),!this._isStreamingSupported&&this._isRangeSupported&&this.cancel(new ir("Streaming is disabled."))}).catch(this._headersCapability.reject),this.onProgress=null}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(){var s;await this._headersCapability.promise;const{value:e,done:t}=await this._reader.read();return t?{value:e,done:t}:(this._loaded+=e.byteLength,(s=this.onProgress)==null||s.call(this,{loaded:this._loaded,total:this._contentLength}),{value:Gu(e),done:!1})}cancel(e){var t;(t=this._reader)==null||t.cancel(e),this._abortController.abort()}}class Lg{constructor(e,t,s){this._stream=e,this._reader=null,this._loaded=0;const i=e.source;this._withCredentials=i.withCredentials||!1,this._readCapability=Promise.withResolvers(),this._isStreamingSupported=!i.disableStream,this._abortController=new AbortController,this._headers=Wu(this._stream.httpHeaders),this._headers.append("Range",`bytes=${t}-${s-1}`);const n=i.url;fetch(n,ju(this._headers,this._withCredentials,this._abortController)).then(r=>{if(!Uu(r.status))throw Bl(r.status,n);this._readCapability.resolve(),this._reader=r.body.getReader()}).catch(this._readCapability.reject),this.onProgress=null}get isStreamingSupported(){return this._isStreamingSupported}async read(){var s;await this._readCapability.promise;const{value:e,done:t}=await this._reader.read();return t?{value:e,done:t}:(this._loaded+=e.byteLength,(s=this.onProgress)==null||s.call(this,{loaded:this._loaded}),{value:Gu(e),done:!1})}cancel(e){var t;(t=this._reader)==null||t.cancel(e),this._abortController.abort()}}const Vl=200,ql=206;function Ig(u){const e=u.response;return typeof e!="string"?e:Ml(e).buffer}class Mg{constructor(e,t={}){this.url=e,this.isHttp=/^https?:/i.test(e),this.httpHeaders=this.isHttp&&t.httpHeaders||Object.create(null),this.withCredentials=t.withCredentials||!1,this.currXhrId=0,this.pendingRequests=Object.create(null)}requestRange(e,t,s){const i={begin:e,end:t};for(const n in s)i[n]=s[n];return this.request(i)}requestFull(e){return this.request(e)}request(e){const t=new XMLHttpRequest,s=this.currXhrId++,i=this.pendingRequests[s]={xhr:t};t.open("GET",this.url),t.withCredentials=this.withCredentials;for(const n in this.httpHeaders){const r=this.httpHeaders[n];r!==void 0&&t.setRequestHeader(n,r)}return this.isHttp&&"begin"in e&&"end"in e?(t.setRequestHeader("Range",`bytes=${e.begin}-${e.end-1}`),i.expectedStatus=ql):i.expectedStatus=Vl,t.responseType="arraybuffer",e.onError&&(t.onerror=function(n){e.onError(t.status)}),t.onreadystatechange=this.onStateChange.bind(this,s),t.onprogress=this.onProgress.bind(this,s),i.onHeadersReceived=e.onHeadersReceived,i.onDone=e.onDone,i.onError=e.onError,i.onProgress=e.onProgress,t.send(null),s}onProgress(e,t){var i;const s=this.pendingRequests[e];s&&((i=s.onProgress)==null||i.call(s,t))}onStateChange(e,t){var h,l,c;const s=this.pendingRequests[e];if(!s)return;const i=s.xhr;if(i.readyState>=2&&s.onHeadersReceived&&(s.onHeadersReceived(),delete s.onHeadersReceived),i.readyState!==4||!(e in this.pendingRequests))return;if(delete this.pendingRequests[e],i.status===0&&this.isHttp){(h=s.onError)==null||h.call(s,i.status);return}const n=i.status||Vl;if(!(n===Vl&&s.expectedStatus===ql)&&n!==s.expectedStatus){(l=s.onError)==null||l.call(s,i.status);return}const a=Ig(i);if(n===ql){const d=i.getResponseHeader("Content-Range"),p=/bytes (\d+)-(\d+)\/(\d+)/.exec(d);s.onDone({begin:parseInt(p[1],10),chunk:a})}else a?s.onDone({begin:0,chunk:a}):(c=s.onError)==null||c.call(s,i.status)}getRequestXhr(e){return this.pendingRequests[e].xhr}isPendingRequest(e){return e in this.pendingRequests}abortRequest(e){const t=this.pendingRequests[e].xhr;delete this.pendingRequests[e],t.abort()}}class Fg{constructor(e){this._source=e,this._manager=new Mg(e.url,{httpHeaders:e.httpHeaders,withCredentials:e.withCredentials}),this._rangeChunkSize=e.rangeChunkSize,this._fullRequestReader=null,this._rangeRequestReaders=[]}_onRangeRequestReaderClosed(e){const t=this._rangeRequestReaders.indexOf(e);t>=0&&this._rangeRequestReaders.splice(t,1)}getFullReader(){return Qt(!this._fullRequestReader,"PDFNetworkStream.getFullReader can only be called once."),this._fullRequestReader=new Dg(this._manager,this._source),this._fullRequestReader}getRangeReader(e,t){const s=new Og(this._manager,e,t);return s.onClosed=this._onRangeRequestReaderClosed.bind(this),this._rangeRequestReaders.push(s),s}cancelAllRequests(e){var t;(t=this._fullRequestReader)==null||t.cancel(e);for(const s of this._rangeRequestReaders.slice(0))s.cancel(e)}}class Dg{constructor(e,t){this._manager=e;const s={onHeadersReceived:this._onHeadersReceived.bind(this),onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)};this._url=t.url,this._fullRequestId=e.requestFull(s),this._headersReceivedCapability=Promise.withResolvers(),this._disableRange=t.disableRange||!1,this._contentLength=t.length,this._rangeChunkSize=t.rangeChunkSize,!this._rangeChunkSize&&!this._disableRange&&(this._disableRange=!0),this._isStreamingSupported=!1,this._isRangeSupported=!1,this._cachedChunks=[],this._requests=[],this._done=!1,this._storedError=void 0,this._filename=null,this.onProgress=null}_onHeadersReceived(){const e=this._fullRequestId,t=this._manager.getRequestXhr(e),s=r=>t.getResponseHeader(r),{allowRangeRequests:i,suggestedLength:n}=_d({getResponseHeader:s,isHttp:this._manager.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});i&&(this._isRangeSupported=!0),this._contentLength=n||this._contentLength,this._filename=vd(s),this._isRangeSupported&&this._manager.abortRequest(e),this._headersReceivedCapability.resolve()}_onDone(e){if(e&&(this._requests.length>0?this._requests.shift().resolve({value:e.chunk,done:!1}):this._cachedChunks.push(e.chunk)),this._done=!0,!(this._cachedChunks.length>0)){for(const t of this._requests)t.resolve({value:void 0,done:!0});this._requests.length=0}}_onError(e){this._storedError=Bl(e,this._url),this._headersReceivedCapability.reject(this._storedError);for(const t of this._requests)t.reject(this._storedError);this._requests.length=0,this._cachedChunks.length=0}_onProgress(e){var t;(t=this.onProgress)==null||t.call(this,{loaded:e.loaded,total:e.lengthComputable?e.total:this._contentLength})}get filename(){return this._filename}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}get contentLength(){return this._contentLength}get headersReady(){return this._headersReceivedCapability.promise}async read(){if(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};const e=Promise.withResolvers();return this._requests.push(e),e.promise}cancel(e){this._done=!0,this._headersReceivedCapability.reject(e);for(const t of this._requests)t.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._fullRequestId)&&this._manager.abortRequest(this._fullRequestId),this._fullRequestReader=null}}class Og{constructor(e,t,s){this._manager=e;const i={onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)};this._url=e.url,this._requestId=e.requestRange(t,s,i),this._requests=[],this._queuedChunk=null,this._done=!1,this._storedError=void 0,this.onProgress=null,this.onClosed=null}_close(){var e;(e=this.onClosed)==null||e.call(this,this)}_onDone(e){const t=e.chunk;this._requests.length>0?this._requests.shift().resolve({value:t,done:!1}):this._queuedChunk=t,this._done=!0;for(const s of this._requests)s.resolve({value:void 0,done:!0});this._requests.length=0,this._close()}_onError(e){this._storedError=Bl(e,this._url);for(const t of this._requests)t.reject(this._storedError);this._requests.length=0,this._queuedChunk=null}_onProgress(e){var t;this.isStreamingSupported||(t=this.onProgress)==null||t.call(this,{loaded:e.loaded})}get isStreamingSupported(){return!1}async read(){if(this._storedError)throw this._storedError;if(this._queuedChunk!==null){const t=this._queuedChunk;return this._queuedChunk=null,{value:t,done:!1}}if(this._done)return{value:void 0,done:!0};const e=Promise.withResolvers();return this._requests.push(e),e.promise}cancel(e){this._done=!0;for(const t of this._requests)t.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._requestId)&&this._manager.abortRequest(this._requestId),this._close()}}const $u=/^file:\/\/\/[a-zA-Z]:\//;function Ng(u){const e=Os.get("url"),t=e.parse(u);return t.protocol==="file:"||t.host?t:/^[a-z]:[/\\]/i.test(u)?e.parse(`file:///${u}`):(t.host||(t.protocol="file:"),t)}class Bg{constructor(e){this.source=e,this.url=Ng(e.url),this.isHttp=this.url.protocol==="http:"||this.url.protocol==="https:",this.isFsUrl=this.url.protocol==="file:",this.httpHeaders=this.isHttp&&e.httpHeaders||{},this._fullRequestReader=null,this._rangeRequestReaders=[]}get _progressiveDataLength(){var e;return((e=this._fullRequestReader)==null?void 0:e._loaded)??0}getFullReader(){return Qt(!this._fullRequestReader,"PDFNodeStream.getFullReader can only be called once."),this._fullRequestReader=this.isFsUrl?new Ug(this):new zg(this),this._fullRequestReader}getRangeReader(e,t){if(t<=this._progressiveDataLength)return null;const s=this.isFsUrl?new jg(this,e,t):new Hg(this,e,t);return this._rangeRequestReaders.push(s),s}cancelAllRequests(e){var t;(t=this._fullRequestReader)==null||t.cancel(e);for(const s of this._rangeRequestReaders.slice(0))s.cancel(e)}}class Vu{constructor(e){this._url=e.url,this._done=!1,this._storedError=null,this.onProgress=null;const t=e.source;this._contentLength=t.length,this._loaded=0,this._filename=null,this._disableRange=t.disableRange||!1,this._rangeChunkSize=t.rangeChunkSize,!this._rangeChunkSize&&!this._disableRange&&(this._disableRange=!0),this._isStreamingSupported=!t.disableStream,this._isRangeSupported=!t.disableRange,this._readableStream=null,this._readCapability=Promise.withResolvers(),this._headersCapability=Promise.withResolvers()}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(){var s;if(await this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;const e=this._readableStream.read();return e===null?(this._readCapability=Promise.withResolvers(),this.read()):(this._loaded+=e.length,(s=this.onProgress)==null||s.call(this,{loaded:this._loaded,total:this._contentLength}),{value:new Uint8Array(e).buffer,done:!1})}cancel(e){if(!this._readableStream){this._error(e);return}this._readableStream.destroy(e)}_error(e){this._storedError=e,this._readCapability.resolve()}_setReadableStream(e){this._readableStream=e,e.on("readable",()=>{this._readCapability.resolve()}),e.on("end",()=>{e.destroy(),this._done=!0,this._readCapability.resolve()}),e.on("error",t=>{this._error(t)}),!this._isStreamingSupported&&this._isRangeSupported&&this._error(new ir("streaming is disabled")),this._storedError&&this._readableStream.destroy(this._storedError)}}class qu{constructor(e){this._url=e.url,this._done=!1,this._storedError=null,this.onProgress=null,this._loaded=0,this._readableStream=null,this._readCapability=Promise.withResolvers();const t=e.source;this._isStreamingSupported=!t.disableStream}get isStreamingSupported(){return this._isStreamingSupported}async read(){var s;if(await this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;const e=this._readableStream.read();return e===null?(this._readCapability=Promise.withResolvers(),this.read()):(this._loaded+=e.length,(s=this.onProgress)==null||s.call(this,{loaded:this._loaded}),{value:new Uint8Array(e).buffer,done:!1})}cancel(e){if(!this._readableStream){this._error(e);return}this._readableStream.destroy(e)}_error(e){this._storedError=e,this._readCapability.resolve()}_setReadableStream(e){this._readableStream=e,e.on("readable",()=>{this._readCapability.resolve()}),e.on("end",()=>{e.destroy(),this._done=!0,this._readCapability.resolve()}),e.on("error",t=>{this._error(t)}),this._storedError&&this._readableStream.destroy(this._storedError)}}function al(u,e){return{protocol:u.protocol,auth:u.auth,host:u.hostname,port:u.port,path:u.path,method:"GET",headers:e}}class zg extends Vu{constructor(e){super(e);const t=s=>{if(s.statusCode===404){const a=new sr(`Missing PDF "${this._url}".`);this._storedError=a,this._headersCapability.reject(a);return}this._headersCapability.resolve(),this._setReadableStream(s);const i=a=>this._readableStream.headers[a.toLowerCase()],{allowRangeRequests:n,suggestedLength:r}=_d({getResponseHeader:i,isHttp:e.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=n,this._contentLength=r||this._contentLength,this._filename=vd(i)};if(this._request=null,this._url.protocol==="http:"){const s=Os.get("http");this._request=s.request(al(this._url,e.httpHeaders),t)}else{const s=Os.get("https");this._request=s.request(al(this._url,e.httpHeaders),t)}this._request.on("error",s=>{this._storedError=s,this._headersCapability.reject(s)}),this._request.end()}}class Hg extends qu{constructor(e,t,s){super(e),this._httpHeaders={};for(const n in e.httpHeaders){const r=e.httpHeaders[n];r!==void 0&&(this._httpHeaders[n]=r)}this._httpHeaders.Range=`bytes=${t}-${s-1}`;const i=n=>{if(n.statusCode===404){const r=new sr(`Missing PDF "${this._url}".`);this._storedError=r;return}this._setReadableStream(n)};if(this._request=null,this._url.protocol==="http:"){const n=Os.get("http");this._request=n.request(al(this._url,this._httpHeaders),i)}else{const n=Os.get("https");this._request=n.request(al(this._url,this._httpHeaders),i)}this._request.on("error",n=>{this._storedError=n}),this._request.end()}}class Ug extends Vu{constructor(e){super(e);let t=decodeURIComponent(this._url.path);$u.test(this._url.href)&&(t=t.replace(/^\//,""));const s=Os.get("fs");s.promises.lstat(t).then(i=>{this._contentLength=i.size,this._setReadableStream(s.createReadStream(t)),this._headersCapability.resolve()},i=>{i.code==="ENOENT"&&(i=new sr(`Missing PDF "${t}".`)),this._storedError=i,this._headersCapability.reject(i)})}}class jg extends qu{constructor(e,t,s){super(e);let i=decodeURIComponent(this._url.path);$u.test(this._url.href)&&(i=i.replace(/^\//,""));const n=Os.get("fs");this._setReadableStream(n.createReadStream(i,{start:t,end:s-1}))}}const Wg=1e5,Ee=30,Gg=.8;var Zd,Li,xe,Ao,wo,yn,Js,Eo,So,An,Lr,Ir,Ii,Mr,xo,Fr,wn,Co,ko,En,Sn,Mi,Dr,vi,Xu,Yu,Cc,Ds,Bh,Ku,Zu;const fe=class fe{constructor({textContentSource:e,container:t,viewport:s}){S(this,vi);S(this,Li,Promise.withResolvers());S(this,xe,null);S(this,Ao,!1);S(this,wo,!!((Zd=globalThis.FontInspector)!=null&&Zd.enabled));S(this,yn,null);S(this,Js,null);S(this,Eo,0);S(this,So,0);S(this,An,null);S(this,Lr,null);S(this,Ir,0);S(this,Ii,0);S(this,Mr,Object.create(null));S(this,xo,[]);S(this,Fr,null);S(this,wn,[]);S(this,Co,new WeakMap);S(this,ko,null);var h;if(e instanceof ReadableStream)w(this,Fr,e);else if(typeof e=="object")w(this,Fr,new ReadableStream({start(l){l.enqueue(e),l.close()}}));else throw new Error('No "textContentSource" parameter specified.');w(this,xe,w(this,Lr,t)),w(this,Ii,s.scale*(globalThis.devicePixelRatio||1)),w(this,Ir,s.rotation),w(this,Js,{prevFontSize:null,prevFontFamily:null,div:null,properties:null,ctx:null});const{pageWidth:i,pageHeight:n,pageX:r,pageY:a}=s.rawDims;w(this,ko,[1,0,0,-1,-r,a+n]),w(this,So,i),w(this,Eo,n),E(h=fe,Ds,Ku).call(h),Zn(t,s),o(this,Li).promise.catch(()=>{}).then(()=>{o(fe,Dr).delete(this),w(this,Js,null),w(this,Mr,null)})}render(){const e=()=>{o(this,An).read().then(({value:t,done:s})=>{if(s){o(this,Li).resolve();return}o(this,yn)??w(this,yn,t.lang),Object.assign(o(this,Mr),t.styles),E(this,vi,Xu).call(this,t.items),e()},o(this,Li).reject)};return w(this,An,o(this,Fr).getReader()),o(fe,Dr).add(this),e(),o(this,Li).promise}update({viewport:e,onBefore:t=null}){var n;const s=e.scale*(globalThis.devicePixelRatio||1),i=e.rotation;if(i!==o(this,Ir)&&(t==null||t(),w(this,Ir,i),Zn(o(this,Lr),{rotation:i})),s!==o(this,Ii)){t==null||t(),w(this,Ii,s);const r={prevFontSize:null,prevFontFamily:null,div:null,properties:null,ctx:E(n=fe,Ds,Bh).call(n,o(this,yn))};for(const a of o(this,wn))r.properties=o(this,Co).get(a),r.div=a,E(this,vi,Cc).call(this,r)}}cancel(){var t;const e=new ir("TextLayer task cancelled.");(t=o(this,An))==null||t.cancel(e).catch(()=>{}),w(this,An,null),o(this,Li).reject(e)}get textDivs(){return o(this,wn)}get textContentItemsStr(){return o(this,xo)}static cleanup(){if(!(o(this,Dr).size>0)){o(this,En).clear();for(const{canvas:e}of o(this,Sn).values())e.remove();o(this,Sn).clear()}}};Li=new WeakMap,xe=new WeakMap,Ao=new WeakMap,wo=new WeakMap,yn=new WeakMap,Js=new WeakMap,Eo=new WeakMap,So=new WeakMap,An=new WeakMap,Lr=new WeakMap,Ir=new WeakMap,Ii=new WeakMap,Mr=new WeakMap,xo=new WeakMap,Fr=new WeakMap,wn=new WeakMap,Co=new WeakMap,ko=new WeakMap,En=new WeakMap,Sn=new WeakMap,Mi=new WeakMap,Dr=new WeakMap,vi=new WeakSet,Xu=function(e){var i,n;if(o(this,Ao))return;(n=o(this,Js)).ctx??(n.ctx=E(i=fe,Ds,Bh).call(i,o(this,yn)));const t=o(this,wn),s=o(this,xo);for(const r of e){if(t.length>Wg){gt("Ignoring additional textDivs for performance reasons."),w(this,Ao,!0);return}if(r.str===void 0){if(r.type==="beginMarkedContentProps"||r.type==="beginMarkedContent"){const a=o(this,xe);w(this,xe,document.createElement("span")),o(this,xe).classList.add("markedContent"),r.id!==null&&o(this,xe).setAttribute("id",`${r.id}`),a.append(o(this,xe))}else r.type==="endMarkedContent"&&w(this,xe,o(this,xe).parentNode);continue}s.push(r.str),E(this,vi,Yu).call(this,r)}},Yu=function(e){var m;const t=document.createElement("span"),s={angle:0,canvasWidth:0,hasText:e.str!=="",hasEOL:e.hasEOL,fontSize:0};o(this,wn).push(t);const i=at.transform(o(this,ko),e.transform);let n=Math.atan2(i[1],i[0]);const r=o(this,Mr)[e.fontName];r.vertical&&(n+=Math.PI/2);const a=o(this,wo)&&r.fontSubstitution||r.fontFamily,h=Math.hypot(i[2],i[3]),l=h*E(m=fe,Ds,Zu).call(m,a,o(this,yn));let c,d;n===0?(c=i[4],d=i[5]-l):(c=i[4]+l*Math.sin(n),d=i[5]-l*Math.cos(n));const p="calc(var(--scale-factor)*",f=t.style;o(this,xe)===o(this,Lr)?(f.left=`${(100*c/o(this,So)).toFixed(2)}%`,f.top=`${(100*d/o(this,Eo)).toFixed(2)}%`):(f.left=`${p}${c.toFixed(2)}px)`,f.top=`${p}${d.toFixed(2)}px)`),f.fontSize=`${p}${(o(fe,Mi)*h).toFixed(2)}px)`,f.fontFamily=a,s.fontSize=h,t.setAttribute("role","presentation"),t.textContent=e.str,t.dir=e.dir,o(this,wo)&&(t.dataset.fontName=r.fontSubstitutionLoadedName||e.fontName),n!==0&&(s.angle=n*(180/Math.PI));let g=!1;if(e.str.length>1)g=!0;else if(e.str!==" "&&e.transform[0]!==e.transform[3]){const v=Math.abs(e.transform[0]),b=Math.abs(e.transform[3]);v!==b&&Math.max(v,b)/Math.min(v,b)>1.5&&(g=!0)}if(g&&(s.canvasWidth=r.vertical?e.height:e.width),o(this,Co).set(t,s),o(this,Js).div=t,o(this,Js).properties=s,E(this,vi,Cc).call(this,o(this,Js)),s.hasText&&o(this,xe).append(t),s.hasEOL){const v=document.createElement("br");v.setAttribute("role","presentation"),o(this,xe).append(v)}},Cc=function(e){const{div:t,properties:s,ctx:i,prevFontSize:n,prevFontFamily:r}=e,{style:a}=t;let h="";if(o(fe,Mi)>1&&(h=`scale(${1/o(fe,Mi)})`),s.canvasWidth!==0&&s.hasText){const{fontFamily:l}=a,{canvasWidth:c,fontSize:d}=s;(n!==d||r!==l)&&(i.font=`${d*o(this,Ii)}px ${l}`,e.prevFontSize=d,e.prevFontFamily=l);const{width:p}=i.measureText(t.textContent);p>0&&(h=`scaleX(${c*o(this,Ii)/p}) ${h}`)}s.angle!==0&&(h=`rotate(${s.angle}deg) ${h}`),h.length>0&&(a.transform=h)},Ds=new WeakSet,Bh=function(e=null){let t=o(this,Sn).get(e||(e=""));if(!t){const s=document.createElement("canvas");s.className="hiddenCanvasElement",s.lang=e,document.body.append(s),t=s.getContext("2d",{alpha:!1,willReadFrequently:!0}),o(this,Sn).set(e,t)}return t},Ku=function(){if(o(this,Mi)!==null)return;const e=document.createElement("div");e.style.opacity=0,e.style.lineHeight=1,e.style.fontSize="1px",e.textContent="X",document.body.append(e),w(this,Mi,e.getBoundingClientRect().height),e.remove()},Zu=function(e,t){const s=o(this,En).get(e);if(s)return s;const i=E(this,Ds,Bh).call(this,t),n=i.font;i.canvas.width=i.canvas.height=Ee,i.font=`${Ee}px ${e}`;const r=i.measureText("");let a=r.fontBoundingBoxAscent,h=Math.abs(r.fontBoundingBoxDescent);if(a){const d=a/(a+h);return o(this,En).set(e,d),i.canvas.width=i.canvas.height=0,i.font=n,d}i.strokeStyle="red",i.clearRect(0,0,Ee,Ee),i.strokeText("g",0,0);let l=i.getImageData(0,0,Ee,Ee).data;h=0;for(let d=l.length-1-3;d>=0;d-=4)if(l[d]>0){h=Math.ceil(d/4/Ee);break}i.clearRect(0,0,Ee,Ee),i.strokeText("A",0,Ee),l=i.getImageData(0,0,Ee,Ee).data,a=0;for(let d=0,p=l.length;d<p;d+=4)if(l[d]>0){a=Ee-Math.floor(d/4/Ee);break}i.canvas.width=i.canvas.height=0,i.font=n;const c=a?a/(a+h):Gg;return o(this,En).set(e,c),c},S(fe,Ds),S(fe,En,new Map),S(fe,Sn,new Map),S(fe,Mi,null),S(fe,Dr,new Set);let ca=fe;function $g(){lu("`renderTextLayer`, please use `TextLayer` instead.");const{textContentSource:u,container:e,viewport:t,...s}=arguments[0],i=Object.keys(s);i.length>0&>("Ignoring `renderTextLayer` parameters: "+i.join(", "));const n=new ca({textContentSource:u,container:e,viewport:t}),{textDivs:r,textContentItemsStr:a}=n;return{promise:n.render(),textDivs:r,textContentItemsStr:a}}function Vg(){lu("`updateTextLayer`, please use `TextLayer` instead.")}class Na{static textContent(e){const t=[],s={items:t,styles:Object.create(null)};function i(n){var h;if(!n)return;let r=null;const a=n.name;if(a==="#text")r=n.value;else if(Na.shouldBuildText(a))(h=n==null?void 0:n.attributes)!=null&&h.textContent?r=n.attributes.textContent:n.value&&(r=n.value);else return;if(r!==null&&t.push({str:r}),!!n.children)for(const l of n.children)i(l)}return i(e),s}static shouldBuildText(e){return!(e==="textarea"||e==="input"||e==="option"||e==="select")}}const qg=65536,Xg=100,Yg=5e3,Kg=me?og:Xp,Zg=me?hg:ou,Qg=me?ag:qp,Jg=me?lg:hu;function tm(u={}){typeof u=="string"||u instanceof URL?u={url:u}:(u instanceof ArrayBuffer||ArrayBuffer.isView(u))&&(u={data:u});const e=new kc,{docId:t}=e,s=u.url?em(u.url):null,i=u.data?sm(u.data):null,n=u.httpHeaders||null,r=u.withCredentials===!0,a=u.password??null,h=u.range instanceof Qu?u.range:null,l=Number.isInteger(u.rangeChunkSize)&&u.rangeChunkSize>0?u.rangeChunkSize:qg;let c=u.worker instanceof pr?u.worker:null;const d=u.verbosity,p=typeof u.docBaseUrl=="string"&&!pd(u.docBaseUrl)?u.docBaseUrl:null,f=typeof u.cMapUrl=="string"?u.cMapUrl:null,g=u.cMapPacked!==!1,m=u.CMapReaderFactory||Zg,v=typeof u.standardFontDataUrl=="string"?u.standardFontDataUrl:null,b=u.StandardFontDataFactory||Jg,A=u.stopAtErrors!==!0,x=Number.isInteger(u.maxImageSize)&&u.maxImageSize>-1?u.maxImageSize:-1,k=u.isEvalSupported!==!1,T=typeof u.isOffscreenCanvasSupported=="boolean"?u.isOffscreenCanvasSupported:!me,L=Number.isInteger(u.canvasMaxAreaInBytes)?u.canvasMaxAreaInBytes:-1,I=typeof u.disableFontFace=="boolean"?u.disableFontFace:me,B=u.fontExtraProperties===!0,D=u.enableXfa===!0,W=u.ownerDocument||globalThis.document,q=u.disableRange===!0,P=u.disableStream===!0,z=u.disableAutoFetch===!0,y=u.pdfBug===!0,H=u.enableHWA===!0,rt=h?h.length:u.length??NaN,U=typeof u.useSystemFonts=="boolean"?u.useSystemFonts:!me&&!I,Q=typeof u.useWorkerFetch=="boolean"?u.useWorkerFetch:m===ou&&b===hu&&f&&v&&wa(f,document.baseURI)&&wa(v,document.baseURI),X=u.canvasFactory||new Kg({ownerDocument:W,enableHWA:H}),ht=u.filterFactory||new Qg({docId:t,ownerDocument:W}),M=null;Op(d);const O={canvasFactory:X,filterFactory:ht};if(Q||(O.cMapReaderFactory=new m({baseUrl:f,isCompressed:g}),O.standardFontDataFactory=new b({baseUrl:v})),!c){const Y={verbosity:d,port:gi.workerPort};c=Y.port?pr.fromPort(Y):new pr(Y),e._worker=c}const st={docId:t,apiVersion:"4.4.168",data:i,password:a,disableAutoFetch:z,rangeChunkSize:l,length:rt,docBaseUrl:p,enableXfa:D,evaluatorOptions:{maxImageSize:x,disableFontFace:I,ignoreErrors:A,isEvalSupported:k,isOffscreenCanvasSupported:T,canvasMaxAreaInBytes:L,fontExtraProperties:B,useSystemFonts:U,cMapUrl:Q?f:null,standardFontDataUrl:Q?v:null}},J={disableFontFace:I,fontExtraProperties:B,ownerDocument:W,pdfBug:y,styleElement:M,loadingParams:{disableAutoFetch:z,enableXfa:D}};return c.promise.then(function(){if(e.destroyed)throw new Error("Loading aborted");if(c.destroyed)throw new Error("Worker was destroyed");const Y=c.messageHandler.sendWithPromise("GetDocRequest",st,i?[i.buffer]:null);let _t;if(h)_t=new Cg(h,{disableRange:q,disableStream:P});else if(!i){if(!s)throw new Error("getDocument - no `url` parameter provided.");_t=(dt=>me?function(){return typeof fetch<"u"&&typeof Response<"u"&&"body"in Response.prototype}()&&wa(dt.url)?new qd(dt):new Bg(dt):wa(dt.url)?new qd(dt):new Fg(dt))({url:s,length:rt,httpHeaders:n,withCredentials:r,rangeChunkSize:l,disableRange:q,disableStream:P})}return Y.then(pt=>{if(e.destroyed)throw new Error("Loading aborted");if(c.destroyed)throw new Error("Worker was destroyed");const dt=new xa(t,pt,c.port),vt=new am(dt,e,_t,J,O);e._transport=vt,dt.send("Ready",null)})}).catch(e._capability.reject),e}function em(u){if(u instanceof URL)return u.href;try{return new URL(u,window.location).href}catch{if(me&&typeof u=="string")return u}throw new Error("Invalid PDF url data: either string or URL-object is expected in the url property.")}function sm(u){if(me&&typeof Buffer<"u"&&u instanceof Buffer)throw new Error("Please provide binary data as `Uint8Array`, rather than `Buffer`.");if(u instanceof Uint8Array&&u.byteLength===u.buffer.byteLength)return u;if(typeof u=="string")return Ml(u);if(u instanceof ArrayBuffer||ArrayBuffer.isView(u)||typeof u=="object"&&!isNaN(u==null?void 0:u.length))return new Uint8Array(u);throw new Error("Invalid PDF binary data: either TypedArray, string, or array-like object is expected in the data property.")}function Xd(u){return typeof u=="object"&&Number.isInteger(u==null?void 0:u.num)&&u.num>=0&&Number.isInteger(u==null?void 0:u.gen)&&u.gen>=0}var Al;const wl=class wl{constructor(){this._capability=Promise.withResolvers(),this._transport=null,this._worker=null,this.docId=`d${Le(wl,Al)._++}`,this.destroyed=!1,this.onPassword=null,this.onProgress=null}get promise(){return this._capability.promise}async destroy(){var e,t,s;this.destroyed=!0;try{(e=this._worker)!=null&&e.port&&(this._worker._pendingDestroy=!0),await((t=this._transport)==null?void 0:t.destroy())}catch(i){throw(s=this._worker)!=null&&s.port&&delete this._worker._pendingDestroy,i}this._transport=null,this._worker&&(this._worker.destroy(),this._worker=null)}};Al=new WeakMap,S(wl,Al,0);let kc=wl;class Qu{constructor(e,t,s=!1,i=null){this.length=e,this.initialData=t,this.progressiveDone=s,this.contentDispositionFilename=i,this._rangeListeners=[],this._progressListeners=[],this._progressiveReadListeners=[],this._progressiveDoneListeners=[],this._readyCapability=Promise.withResolvers()}addRangeListener(e){this._rangeListeners.push(e)}addProgressListener(e){this._progressListeners.push(e)}addProgressiveReadListener(e){this._progressiveReadListeners.push(e)}addProgressiveDoneListener(e){this._progressiveDoneListeners.push(e)}onDataRange(e,t){for(const s of this._rangeListeners)s(e,t)}onDataProgress(e,t){this._readyCapability.promise.then(()=>{for(const s of this._progressListeners)s(e,t)})}onDataProgressiveRead(e){this._readyCapability.promise.then(()=>{for(const t of this._progressiveReadListeners)t(e)})}onDataProgressiveDone(){this._readyCapability.promise.then(()=>{for(const e of this._progressiveDoneListeners)e()})}transportReady(){this._readyCapability.resolve()}requestDataRange(e,t){Rt("Abstract method PDFDataRangeTransport.requestDataRange")}abort(){}}class im{constructor(e,t){this._pdfInfo=e,this._transport=t}get annotationStorage(){return this._transport.annotationStorage}get filterFactory(){return this._transport.filterFactory}get numPages(){return this._pdfInfo.numPages}get fingerprints(){return this._pdfInfo.fingerprints}get isPureXfa(){return Et(this,"isPureXfa",!!this._transport._htmlForXfa)}get allXfaHtml(){return this._transport._htmlForXfa}getPage(e){return this._transport.getPage(e)}getPageIndex(e){return this._transport.getPageIndex(e)}getDestinations(){return this._transport.getDestinations()}getDestination(e){return this._transport.getDestination(e)}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()}getJSActions(){return this._transport.getDocJSActions()}getOutline(){return this._transport.getOutline()}getOptionalContentConfig({intent:e="display"}={}){const{renderingIntent:t}=this._transport.getRenderingIntent(e);return this._transport.getOptionalContentConfig(t)}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()}getDownloadInfo(){return this._transport.downloadInfoCapability.promise}cleanup(e=!1){return this._transport.startCleanup(e||this.isPureXfa)}destroy(){return this.loadingTask.destroy()}cachedPageNumber(e){return this._transport.cachedPageNumber(e)}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()}}var Fi,ti,Ze,hr,zh;class nm{constructor(e,t,s,i=!1){S(this,Ze);S(this,Fi,null);S(this,ti,!1);this._pageIndex=e,this._pageInfo=t,this._transport=s,this._stats=i?new Fd:null,this._pdfBug=i,this.commonObjs=s.commonObjs,this.objs=new Ju,this._maybeCleanupAfterRender=!1,this._intentStates=new Map,this.destroyed=!1}get pageNumber(){return this._pageIndex+1}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:e,rotation:t=this.rotate,offsetX:s=0,offsetY:i=0,dontFlip:n=!1}={}){return new bh({viewBox:this.view,scale:e,rotation:t,offsetX:s,offsetY:i,dontFlip:n})}getAnnotations({intent:e="display"}={}){const{renderingIntent:t}=this._transport.getRenderingIntent(e);return this._transport.getAnnotations(this._pageIndex,t)}getJSActions(){return this._transport.getPageJSActions(this._pageIndex)}get filterFactory(){return this._transport.filterFactory}get isPureXfa(){return Et(this,"isPureXfa",!!this._transport._htmlForXfa)}async getXfa(){var e;return((e=this._transport._htmlForXfa)==null?void 0:e.children[this._pageIndex])||null}render({canvasContext:e,viewport:t,intent:s="display",annotationMode:i=Si.ENABLE,transform:n=null,background:r=null,optionalContentConfigPromise:a=null,annotationCanvasMap:h=null,pageColors:l=null,printAnnotationStorage:c=null}){var x,k;(x=this._stats)==null||x.time("Overall");const d=this._transport.getRenderingIntent(s,i,c),{renderingIntent:p,cacheKey:f}=d;w(this,ti,!1),E(this,Ze,zh).call(this),a||(a=this._transport.getOptionalContentConfig(p));let g=this._intentStates.get(f);g||(g=Object.create(null),this._intentStates.set(f,g)),g.streamReaderCancelTimeout&&(clearTimeout(g.streamReaderCancelTimeout),g.streamReaderCancelTimeout=null);const m=!!(p&Ke.PRINT);g.displayReadyCapability||(g.displayReadyCapability=Promise.withResolvers(),g.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},(k=this._stats)==null||k.time("Page Request"),this._pumpOperatorList(d));const v=T=>{var L;g.renderTasks.delete(b),(this._maybeCleanupAfterRender||m)&&w(this,ti,!0),E(this,Ze,hr).call(this,!m),T?(b.capability.reject(T),this._abortOperatorList({intentState:g,reason:T instanceof Error?T:new Error(T)})):b.capability.resolve(),this._stats&&(this._stats.timeEnd("Rendering"),this._stats.timeEnd("Overall"),(L=globalThis.Stats)!=null&&L.enabled&&globalThis.Stats.add(this.pageNumber,this._stats))},b=new Rc({callback:v,params:{canvasContext:e,viewport:t,transform:n,background:r},objs:this.objs,commonObjs:this.commonObjs,annotationCanvasMap:h,operatorList:g.operatorList,pageIndex:this._pageIndex,canvasFactory:this._transport.canvasFactory,filterFactory:this._transport.filterFactory,useRequestAnimationFrame:!m,pdfBug:this._pdfBug,pageColors:l});(g.renderTasks||(g.renderTasks=new Set)).add(b);const A=b.task;return Promise.all([g.displayReadyCapability.promise,a]).then(([T,L])=>{var I;if(this.destroyed){v();return}if((I=this._stats)==null||I.time("Rendering"),!(L.renderingIntent&p))throw new Error("Must use the same `intent`-argument when calling the `PDFPageProxy.render` and `PDFDocumentProxy.getOptionalContentConfig` methods.");b.initializeGraphics({transparency:T,optionalContentConfig:L}),b.operatorListChanged()}).catch(v),A}getOperatorList({intent:e="display",annotationMode:t=Si.ENABLE,printAnnotationStorage:s=null}={}){var h;function i(){r.operatorList.lastChunk&&(r.opListReadCapability.resolve(r.operatorList),r.renderTasks.delete(a))}const n=this._transport.getRenderingIntent(e,t,s,!0);let r=this._intentStates.get(n.cacheKey);r||(r=Object.create(null),this._intentStates.set(n.cacheKey,r));let a;return r.opListReadCapability||(a=Object.create(null),a.operatorListChanged=i,r.opListReadCapability=Promise.withResolvers(),(r.renderTasks||(r.renderTasks=new Set)).add(a),r.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},(h=this._stats)==null||h.time("Page Request"),this._pumpOperatorList(n)),r.opListReadCapability.promise}streamTextContent({includeMarkedContent:e=!1,disableNormalization:t=!1}={}){return this._transport.messageHandler.sendWithStream("GetTextContent",{pageIndex:this._pageIndex,includeMarkedContent:e===!0,disableNormalization:t===!0},{highWaterMark:100,size(i){return i.items.length}})}getTextContent(e={}){if(this._transport._htmlForXfa)return this.getXfa().then(s=>Na.textContent(s));const t=this.streamTextContent(e);return new Promise(function(s,i){function n(){r.read().then(function({value:h,done:l}){if(l){s(a);return}a.lang??(a.lang=h.lang),Object.assign(a.styles,h.styles),a.items.push(...h.items),n()},i)}const r=t.getReader(),a={items:[],styles:Object.create(null),lang:null};n()})}getStructTree(){return this._transport.getStructTree(this._pageIndex)}_destroy(){this.destroyed=!0;const e=[];for(const t of this._intentStates.values())if(this._abortOperatorList({intentState:t,reason:new Error("Page was destroyed."),force:!0}),!t.opListReadCapability)for(const s of t.renderTasks)e.push(s.completed),s.cancel();return this.objs.clear(),w(this,ti,!1),E(this,Ze,zh).call(this),Promise.all(e)}cleanup(e=!1){w(this,ti,!0);const t=E(this,Ze,hr).call(this,!1);return e&&t&&this._stats&&(this._stats=new Fd),t}_startRenderPage(e,t){var i,n;const s=this._intentStates.get(t);s&&((i=this._stats)==null||i.timeEnd("Page Request"),(n=s.displayReadyCapability)==null||n.resolve(e))}_renderPageChunk(e,t){for(let s=0,i=e.length;s<i;s++)t.operatorList.fnArray.push(e.fnArray[s]),t.operatorList.argsArray.push(e.argsArray[s]);t.operatorList.lastChunk=e.lastChunk,t.operatorList.separateAnnots=e.separateAnnots;for(const s of t.renderTasks)s.operatorListChanged();e.lastChunk&&E(this,Ze,hr).call(this,!0)}_pumpOperatorList({renderingIntent:e,cacheKey:t,annotationStorageSerializable:s}){const{map:i,transfer:n}=s,a=this._transport.messageHandler.sendWithStream("GetOperatorList",{pageIndex:this._pageIndex,intent:e,cacheKey:t,annotationStorage:i},n).getReader(),h=this._intentStates.get(t);h.streamReader=a;const l=()=>{a.read().then(({value:c,done:d})=>{if(d){h.streamReader=null;return}this._transport.destroyed||(this._renderPageChunk(c,h),l())},c=>{if(h.streamReader=null,!this._transport.destroyed){if(h.operatorList){h.operatorList.lastChunk=!0;for(const d of h.renderTasks)d.operatorListChanged();E(this,Ze,hr).call(this,!0)}if(h.displayReadyCapability)h.displayReadyCapability.reject(c);else if(h.opListReadCapability)h.opListReadCapability.reject(c);else throw c}})};l()}_abortOperatorList({intentState:e,reason:t,force:s=!1}){if(e.streamReader){if(e.streamReaderCancelTimeout&&(clearTimeout(e.streamReaderCancelTimeout),e.streamReaderCancelTimeout=null),!s){if(e.renderTasks.size>0)return;if(t instanceof fd){let i=Xg;t.extraDelay>0&&t.extraDelay<1e3&&(i+=t.extraDelay),e.streamReaderCancelTimeout=setTimeout(()=>{e.streamReaderCancelTimeout=null,this._abortOperatorList({intentState:e,reason:t,force:!0})},i);return}}if(e.streamReader.cancel(new ir(t.message)).catch(()=>{}),e.streamReader=null,!this._transport.destroyed){for(const[i,n]of this._intentStates)if(n===e){this._intentStates.delete(i);break}this.cleanup()}}}get stats(){return this._stats}}Fi=new WeakMap,ti=new WeakMap,Ze=new WeakSet,hr=function(e=!1){if(E(this,Ze,zh).call(this),!o(this,ti)||this.destroyed)return!1;if(e)return w(this,Fi,setTimeout(()=>{w(this,Fi,null),E(this,Ze,hr).call(this,!1)},Yg)),!1;for(const{renderTasks:t,operatorList:s}of this._intentStates.values())if(t.size>0||!s.lastChunk)return!1;return this._intentStates.clear(),this.objs.clear(),w(this,ti,!1),!0},zh=function(){o(this,Fi)&&(clearTimeout(o(this,Fi)),w(this,Fi,null))};var xn,El;class rm{constructor(){S(this,xn,new Set);S(this,El,Promise.resolve())}postMessage(e,t){const s={data:structuredClone(e,t?{transfer:t}:null)};o(this,El).then(()=>{for(const i of o(this,xn))i.call(this,s)})}addEventListener(e,t){o(this,xn).add(t)}removeEventListener(e,t){o(this,xn).delete(t)}terminate(){o(this,xn).clear()}}xn=new WeakMap,El=new WeakMap;const Gs={isWorkerDisabled:!1,fakeWorkerId:0};me&&(Gs.isWorkerDisabled=!0,gi.workerSrc||(gi.workerSrc="./pdf.worker.mjs")),Gs.isSameOrigin=function(u,e){let t;try{if(t=new URL(u),!t.origin||t.origin==="null")return!1}catch{return!1}const s=new URL(e,t);return t.origin===s.origin},Gs.createCDNWrapper=function(u){const e=`await import("${u}");`;return URL.createObjectURL(new Blob([e],{type:"text/javascript"}))};var Cn,Or,Hh,Nr,Uh;const Me=class Me{constructor({name:e=null,port:t=null,verbosity:s=Np()}={}){S(this,Or);var i;if(this.name=e,this.destroyed=!1,this.verbosity=s,this._readyCapability=Promise.withResolvers(),this._port=null,this._webWorker=null,this._messageHandler=null,t){if((i=o(Me,Cn))!=null&&i.has(t))throw new Error("Cannot use more than one PDFWorker per port.");(o(Me,Cn)||w(Me,Cn,new WeakMap)).set(t,this),this._initializeFromPort(t);return}this._initialize()}get promise(){return me?Promise.all([Os.promise,this._readyCapability.promise]):this._readyCapability.promise}get port(){return this._port}get messageHandler(){return this._messageHandler}_initializeFromPort(e){this._port=e,this._messageHandler=new xa("main","worker",e),this._messageHandler.on("ready",function(){}),E(this,Or,Hh).call(this)}_initialize(){if(Gs.isWorkerDisabled||o(Me,Nr,Uh)){this._setupFakeWorker();return}let{workerSrc:e}=Me;try{Gs.isSameOrigin(window.location.href,e)||(e=Gs.createCDNWrapper(new URL(e,window.location).href));const t=new Worker(e,{type:"module"}),s=new xa("main","worker",t),i=()=>{n.abort(),s.destroy(),t.terminate(),this.destroyed?this._readyCapability.reject(new Error("Worker was destroyed")):this._setupFakeWorker()},n=new AbortController;t.addEventListener("error",()=>{this._webWorker||i()},{signal:n.signal}),s.on("test",a=>{if(n.abort(),this.destroyed||!a){i();return}this._messageHandler=s,this._port=t,this._webWorker=t,E(this,Or,Hh).call(this)}),s.on("ready",a=>{if(n.abort(),this.destroyed){i();return}try{r()}catch{this._setupFakeWorker()}});const r=()=>{const a=new Uint8Array;s.send("test",a,[a.buffer])};r();return}catch{Ll("The worker has been disabled.")}this._setupFakeWorker()}_setupFakeWorker(){Gs.isWorkerDisabled||(gt("Setting up fake worker."),Gs.isWorkerDisabled=!0),Me._setupFakeWorkerGlobal.then(e=>{if(this.destroyed){this._readyCapability.reject(new Error("Worker was destroyed"));return}const t=new rm;this._port=t;const s=`fake${Gs.fakeWorkerId++}`,i=new xa(s+"_worker",s,t);e.setup(i,t),this._messageHandler=new xa(s,s+"_worker",t),E(this,Or,Hh).call(this)}).catch(e=>{this._readyCapability.reject(new Error(`Setting up fake worker failed: "${e.message}".`))})}destroy(){var e;this.destroyed=!0,this._webWorker&&(this._webWorker.terminate(),this._webWorker=null),(e=o(Me,Cn))==null||e.delete(this._port),this._port=null,this._messageHandler&&(this._messageHandler.destroy(),this._messageHandler=null)}static fromPort(e){var s;if(!(e!=null&&e.port))throw new Error("PDFWorker.fromPort - invalid method signature.");const t=(s=o(this,Cn))==null?void 0:s.get(e.port);if(t){if(t._pendingDestroy)throw new Error("PDFWorker.fromPort - the worker is being destroyed.\nPlease remember to await `PDFDocumentLoadingTask.destroy()`-calls.");return t}return new Me(e)}static get workerSrc(){if(gi.workerSrc)return gi.workerSrc;throw new Error('No "GlobalWorkerOptions.workerSrc" specified.')}static get _setupFakeWorkerGlobal(){return Et(this,"_setupFakeWorkerGlobal",(async()=>o(this,Nr,Uh)?o(this,Nr,Uh):(await import(this.workerSrc)).WorkerMessageHandler)())}};Cn=new WeakMap,Or=new WeakSet,Hh=function(){this._readyCapability.resolve(),this._messageHandler.send("configure",{verbosity:this.verbosity})},Nr=new WeakSet,Uh=function(){var e;try{return((e=globalThis.pdfjsWorker)==null?void 0:e.WorkerMessageHandler)||null}catch{return null}},S(Me,Nr),S(Me,Cn);let pr=Me;var ei,Ss,Br,zr,xs,kn,Ca;class am{constructor(e,t,s,i,n){S(this,kn);S(this,ei,new Map);S(this,Ss,new Map);S(this,Br,new Map);S(this,zr,new Map);S(this,xs,null);this.messageHandler=e,this.loadingTask=t,this.commonObjs=new Ju,this.fontLoader=new ng({ownerDocument:i.ownerDocument,styleElement:i.styleElement}),this.loadingParams=i.loadingParams,this._params=i,this.canvasFactory=n.canvasFactory,this.filterFactory=n.filterFactory,this.cMapReaderFactory=n.cMapReaderFactory,this.standardFontDataFactory=n.standardFontDataFactory,this.destroyed=!1,this.destroyCapability=null,this._networkStream=s,this._fullReader=null,this._lastProgress=null,this.downloadInfoCapability=Promise.withResolvers(),this.setupMessageHandler()}get annotationStorage(){return Et(this,"annotationStorage",new bd)}getRenderingIntent(e,t=Si.ENABLE,s=null,i=!1){let n=Ke.DISPLAY,r=vc;switch(e){case"any":n=Ke.ANY;break;case"display":break;case"print":n=Ke.PRINT;break;default:gt(`getRenderingIntent - invalid intent: ${e}`)}switch(t){case Si.DISABLE:n+=Ke.ANNOTATIONS_DISABLE;break;case Si.ENABLE:break;case Si.ENABLE_FORMS:n+=Ke.ANNOTATIONS_FORMS;break;case Si.ENABLE_STORAGE:n+=Ke.ANNOTATIONS_STORAGE,r=(n&Ke.PRINT&&s instanceof Nu?s:this.annotationStorage).serializable;break;default:gt(`getRenderingIntent - invalid annotationMode: ${t}`)}return i&&(n+=Ke.OPLIST),{renderingIntent:n,cacheKey:`${n}_${r.hash}`,annotationStorageSerializable:r}}destroy(){var s;if(this.destroyCapability)return this.destroyCapability.promise;this.destroyed=!0,this.destroyCapability=Promise.withResolvers(),(s=o(this,xs))==null||s.reject(new Error("Worker was destroyed during onPassword callback"));const e=[];for(const i of o(this,Ss).values())e.push(i._destroy());o(this,Ss).clear(),o(this,Br).clear(),o(this,zr).clear(),this.hasOwnProperty("annotationStorage")&&this.annotationStorage.resetModified();const t=this.messageHandler.sendWithPromise("Terminate",null);return e.push(t),Promise.all(e).then(()=>{var i;this.commonObjs.clear(),this.fontLoader.clear(),o(this,ei).clear(),this.filterFactory.destroy(),ca.cleanup(),(i=this._networkStream)==null||i.cancelAllRequests(new ir("Worker was terminated.")),this.messageHandler&&(this.messageHandler.destroy(),this.messageHandler=null),this.destroyCapability.resolve()},this.destroyCapability.reject),this.destroyCapability.promise}setupMessageHandler(){const{messageHandler:e,loadingTask:t}=this;e.on("GetReader",(s,i)=>{Qt(this._networkStream,"GetReader - no `IPDFStream` instance available."),this._fullReader=this._networkStream.getFullReader(),this._fullReader.onProgress=n=>{this._lastProgress={loaded:n.loaded,total:n.total}},i.onPull=()=>{this._fullReader.read().then(function({value:n,done:r}){if(r){i.close();return}Qt(n instanceof ArrayBuffer,"GetReader - expected an ArrayBuffer."),i.enqueue(new Uint8Array(n),1,[n])}).catch(n=>{i.error(n)})},i.onCancel=n=>{this._fullReader.cancel(n),i.ready.catch(r=>{if(!this.destroyed)throw r})}}),e.on("ReaderHeadersReady",s=>{const i=Promise.withResolvers(),n=this._fullReader;return n.headersReady.then(()=>{var r;(!n.isStreamingSupported||!n.isRangeSupported)&&(this._lastProgress&&((r=t.onProgress)==null||r.call(t,this._lastProgress)),n.onProgress=a=>{var h;(h=t.onProgress)==null||h.call(t,{loaded:a.loaded,total:a.total})}),i.resolve({isStreamingSupported:n.isStreamingSupported,isRangeSupported:n.isRangeSupported,contentLength:n.contentLength})},i.reject),i.promise}),e.on("GetRangeReader",(s,i)=>{Qt(this._networkStream,"GetRangeReader - no `IPDFStream` instance available.");const n=this._networkStream.getRangeReader(s.begin,s.end);if(!n){i.close();return}i.onPull=()=>{n.read().then(function({value:r,done:a}){if(a){i.close();return}Qt(r instanceof ArrayBuffer,"GetRangeReader - expected an ArrayBuffer."),i.enqueue(new Uint8Array(r),1,[r])}).catch(r=>{i.error(r)})},i.onCancel=r=>{n.cancel(r),i.ready.catch(a=>{if(!this.destroyed)throw a})}}),e.on("GetDoc",({pdfInfo:s})=>{this._numPages=s.numPages,this._htmlForXfa=s.htmlForXfa,delete s.htmlForXfa,t._capability.resolve(new im(s,this))}),e.on("DocException",function(s){let i;switch(s.name){case"PasswordException":i=new Kl(s.message,s.code);break;case"InvalidPDFException":i=new iu(s.message);break;case"MissingPDFException":i=new sr(s.message);break;case"UnexpectedResponseException":i=new Il(s.message,s.status);break;case"UnknownErrorException":i=new Zl(s.message,s.details);break;default:Rt("DocException - expected a valid Error.")}t._capability.reject(i)}),e.on("PasswordRequest",s=>{if(w(this,xs,Promise.withResolvers()),t.onPassword){const i=n=>{n instanceof Error?o(this,xs).reject(n):o(this,xs).resolve({password:n})};try{t.onPassword(i,s.code)}catch(n){o(this,xs).reject(n)}}else o(this,xs).reject(new Kl(s.message,s.code));return o(this,xs).promise}),e.on("DataLoaded",s=>{var i;(i=t.onProgress)==null||i.call(t,{loaded:s.length,total:s.length}),this.downloadInfoCapability.resolve(s)}),e.on("StartRenderPage",s=>{if(this.destroyed)return;o(this,Ss).get(s.pageIndex)._startRenderPage(s.transparency,s.cacheKey)}),e.on("commonobj",([s,i,n])=>{var r;if(this.destroyed||this.commonObjs.has(s))return null;switch(i){case"Font":const{disableFontFace:a,fontExtraProperties:h,pdfBug:l}=this._params;if("error"in n){const f=n.error;gt(`Error during font loading: ${f}`),this.commonObjs.resolve(s,f);break}const c=l&&((r=globalThis.FontInspector)!=null&&r.enabled)?(f,g)=>globalThis.FontInspector.fontAdded(f,g):null,d=new rg(n,{disableFontFace:a,inspectFont:c});this.fontLoader.bind(d).catch(()=>e.sendWithPromise("FontFallback",{id:s})).finally(()=>{!h&&d.data&&(d.data=null),this.commonObjs.resolve(s,d)});break;case"CopyLocalImage":const{imageRef:p}=n;Qt(p,"The imageRef must be defined.");for(const f of o(this,Ss).values())for(const[,g]of f.objs)if((g==null?void 0:g.ref)===p)return g.dataLen?(this.commonObjs.resolve(s,structuredClone(g)),g.dataLen):null;break;case"FontPath":case"Image":case"Pattern":this.commonObjs.resolve(s,n);break;default:throw new Error(`Got unknown common object type ${i}`)}return null}),e.on("obj",([s,i,n,r])=>{var h;if(this.destroyed)return;const a=o(this,Ss).get(i);if(!a.objs.has(s)){if(a._intentStates.size===0){(h=r==null?void 0:r.bitmap)==null||h.close();return}switch(n){case"Image":a.objs.resolve(s,r),(r==null?void 0:r.dataLen)>Ip&&(a._maybeCleanupAfterRender=!0);break;case"Pattern":a.objs.resolve(s,r);break;default:throw new Error(`Got unknown object type ${n}`)}}}),e.on("DocProgress",s=>{var i;this.destroyed||(i=t.onProgress)==null||i.call(t,{loaded:s.loaded,total:s.total})}),e.on("FetchBuiltInCMap",s=>this.destroyed?Promise.reject(new Error("Worker was destroyed.")):this.cMapReaderFactory?this.cMapReaderFactory.fetch(s):Promise.reject(new Error("CMapReaderFactory not initialized, see the `useWorkerFetch` parameter."))),e.on("FetchStandardFontData",s=>this.destroyed?Promise.reject(new Error("Worker was destroyed.")):this.standardFontDataFactory?this.standardFontDataFactory.fetch(s):Promise.reject(new Error("StandardFontDataFactory not initialized, see the `useWorkerFetch` parameter.")))}getData(){return this.messageHandler.sendWithPromise("GetData",null)}saveDocument(){var s;this.annotationStorage.size<=0&>("saveDocument called while `annotationStorage` is empty, please use the getData-method instead.");const{map:e,transfer:t}=this.annotationStorage.serializable;return this.messageHandler.sendWithPromise("SaveDocument",{isPureXfa:!!this._htmlForXfa,numPages:this._numPages,annotationStorage:e,filename:((s=this._fullReader)==null?void 0:s.filename)??null},t).finally(()=>{this.annotationStorage.resetModified()})}getPage(e){if(!Number.isInteger(e)||e<=0||e>this._numPages)return Promise.reject(new Error("Invalid page request."));const t=e-1,s=o(this,Br).get(t);if(s)return s;const i=this.messageHandler.sendWithPromise("GetPage",{pageIndex:t}).then(n=>{if(this.destroyed)throw new Error("Transport destroyed");n.refStr&&o(this,zr).set(n.refStr,e);const r=new nm(t,n,this,this._params.pdfBug);return o(this,Ss).set(t,r),r});return o(this,Br).set(t,i),i}getPageIndex(e){return Xd(e)?this.messageHandler.sendWithPromise("GetPageIndex",{num:e.num,gen:e.gen}):Promise.reject(new Error("Invalid pageIndex request."))}getAnnotations(e,t){return this.messageHandler.sendWithPromise("GetAnnotations",{pageIndex:e,intent:t})}getFieldObjects(){return E(this,kn,Ca).call(this,"GetFieldObjects")}hasJSActions(){return E(this,kn,Ca).call(this,"HasJSActions")}getCalculationOrderIds(){return this.messageHandler.sendWithPromise("GetCalculationOrderIds",null)}getDestinations(){return this.messageHandler.sendWithPromise("GetDestinations",null)}getDestination(e){return typeof e!="string"?Promise.reject(new Error("Invalid destination request.")):this.messageHandler.sendWithPromise("GetDestination",{id:e})}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)}getDocJSActions(){return E(this,kn,Ca).call(this,"GetDocJSActions")}getPageJSActions(e){return this.messageHandler.sendWithPromise("GetPageJSActions",{pageIndex:e})}getStructTree(e){return this.messageHandler.sendWithPromise("GetStructTree",{pageIndex:e})}getOutline(){return this.messageHandler.sendWithPromise("GetOutline",null)}getOptionalContentConfig(e){return E(this,kn,Ca).call(this,"GetOptionalContentConfig").then(t=>new xg(t,e))}getPermissions(){return this.messageHandler.sendWithPromise("GetPermissions",null)}getMetadata(){const e="GetMetadata",t=o(this,ei).get(e);if(t)return t;const s=this.messageHandler.sendWithPromise(e,null).then(i=>{var n,r;return{info:i[0],metadata:i[1]?new Eg(i[1]):null,contentDispositionFilename:((n=this._fullReader)==null?void 0:n.filename)??null,contentLength:((r=this._fullReader)==null?void 0:r.contentLength)??null}});return o(this,ei).set(e,s),s}getMarkInfo(){return this.messageHandler.sendWithPromise("GetMarkInfo",null)}async startCleanup(e=!1){if(!this.destroyed){await this.messageHandler.sendWithPromise("Cleanup",null);for(const t of o(this,Ss).values())if(!t.cleanup())throw new Error(`startCleanup: Page ${t.pageNumber} is currently rendering.`);this.commonObjs.clear(),e||this.fontLoader.clear(),o(this,ei).clear(),this.filterFactory.destroy(!0),ca.cleanup()}}cachedPageNumber(e){if(!Xd(e))return null;const t=e.gen===0?`${e.num}R`:`${e.num}R${e.gen}`;return o(this,zr).get(t)??null}}ei=new WeakMap,Ss=new WeakMap,Br=new WeakMap,zr=new WeakMap,xs=new WeakMap,kn=new WeakSet,Ca=function(e,t=null){const s=o(this,ei).get(e);if(s)return s;const i=this.messageHandler.sendWithPromise(e,t);return o(this,ei).set(e,i),i};const Rh=Symbol("INITIAL_DATA");var os,To,Tc;class Ju{constructor(){S(this,To);S(this,os,Object.create(null))}get(e,t=null){if(t){const i=E(this,To,Tc).call(this,e);return i.promise.then(()=>t(i.data)),null}const s=o(this,os)[e];if(!s||s.data===Rh)throw new Error(`Requesting object that isn't resolved yet ${e}.`);return s.data}has(e){const t=o(this,os)[e];return!!t&&t.data!==Rh}resolve(e,t=null){const s=E(this,To,Tc).call(this,e);s.data=t,s.resolve()}clear(){var e;for(const t in o(this,os)){const{data:s}=o(this,os)[t];(e=s==null?void 0:s.bitmap)==null||e.close()}w(this,os,Object.create(null))}*[Symbol.iterator](){for(const e in o(this,os)){const{data:t}=o(this,os)[e];t!==Rh&&(yield[e,t])}}}os=new WeakMap,To=new WeakSet,Tc=function(e){var t;return(t=o(this,os))[e]||(t[e]={...Promise.withResolvers(),data:Rh})};var Di;class om{constructor(e){S(this,Di,null);w(this,Di,e),this.onContinue=null}get promise(){return o(this,Di).capability.promise}cancel(e=0){o(this,Di).cancel(null,e)}get separateAnnots(){const{separateAnnots:e}=o(this,Di).operatorList;if(!e)return!1;const{annotationCanvasMap:t}=o(this,Di);return e.form||e.canvas&&(t==null?void 0:t.size)>0}}Di=new WeakMap;var Oi,Tn;const tn=class tn{constructor({callback:e,params:t,objs:s,commonObjs:i,annotationCanvasMap:n,operatorList:r,pageIndex:a,canvasFactory:h,filterFactory:l,useRequestAnimationFrame:c=!1,pdfBug:d=!1,pageColors:p=null}){S(this,Oi,null);this.callback=e,this.params=t,this.objs=s,this.commonObjs=i,this.annotationCanvasMap=n,this.operatorListIdx=null,this.operatorList=r,this._pageIndex=a,this.canvasFactory=h,this.filterFactory=l,this._pdfBug=d,this.pageColors=p,this.running=!1,this.graphicsReadyCallback=null,this.graphicsReady=!1,this._useRequestAnimationFrame=c===!0&&typeof window<"u",this.cancelled=!1,this.capability=Promise.withResolvers(),this.task=new om(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=t.canvasContext.canvas}get completed(){return this.capability.promise.catch(function(){})}initializeGraphics({transparency:e=!1,optionalContentConfig:t}){var a,h;if(this.cancelled)return;if(this._canvas){if(o(tn,Tn).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(tn,Tn).add(this._canvas)}this._pdfBug&&((a=globalThis.StepperManager)!=null&&a.enabled)&&(this.stepper=globalThis.StepperManager.create(this._pageIndex),this.stepper.init(this.operatorList),this.stepper.nextBreakPoint=this.stepper.getNextBreakPoint());const{canvasContext:s,viewport:i,transform:n,background:r}=this.params;this.gfx=new fr(s,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:t},this.annotationCanvasMap,this.pageColors),this.gfx.beginDrawing({transform:n,viewport:i,transparency:e,background:r}),this.operatorListIdx=0,this.graphicsReady=!0,(h=this.graphicsReadyCallback)==null||h.call(this)}cancel(e=null,t=0){var s;this.running=!1,this.cancelled=!0,(s=this.gfx)==null||s.endDrawing(),o(this,Oi)&&(window.cancelAnimationFrame(o(this,Oi)),w(this,Oi,null)),o(tn,Tn).delete(this._canvas),this.callback(e||new fd(`Rendering cancelled, page ${this._pageIndex+1}`,t))}operatorListChanged(){var e;if(!this.graphicsReady){this.graphicsReadyCallback||(this.graphicsReadyCallback=this._continueBound);return}(e=this.stepper)==null||e.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?w(this,Oi,window.requestAnimationFrame(()=>{w(this,Oi,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.operatorListIdx===this.operatorList.argsArray.length&&(this.running=!1,this.operatorList.lastChunk&&(this.gfx.endDrawing(),o(tn,Tn).delete(this._canvas),this.callback())))}};Oi=new WeakMap,Tn=new WeakMap,S(tn,Tn,new WeakSet);let Rc=tn;const hm="4.4.168",lm="19fbc8998";function Yd(u){return Math.floor(Math.max(0,Math.min(1,u))*255).toString(16).padStart(2,"0")}function ba(u){return Math.max(0,Math.min(255,255*u))}class Kd{static CMYK_G([e,t,s,i]){return["G",1-Math.min(1,.3*e+.59*s+.11*t+i)]}static G_CMYK([e]){return["CMYK",0,0,0,1-e]}static G_RGB([e]){return["RGB",e,e,e]}static G_rgb([e]){return e=ba(e),[e,e,e]}static G_HTML([e]){const t=Yd(e);return`#${t}${t}${t}`}static RGB_G([e,t,s]){return["G",.3*e+.59*t+.11*s]}static RGB_rgb(e){return e.map(ba)}static RGB_HTML(e){return`#${e.map(Yd).join("")}`}static T_HTML(){return"#00000000"}static T_rgb(){return[null]}static CMYK_RGB([e,t,s,i]){return["RGB",1-Math.min(1,e+i),1-Math.min(1,s+i),1-Math.min(1,t+i)]}static CMYK_rgb([e,t,s,i]){return[ba(1-Math.min(1,e+i)),ba(1-Math.min(1,s+i)),ba(1-Math.min(1,t+i))]}static CMYK_HTML(e){const t=this.CMYK_RGB(e).slice(1);return this.RGB_HTML(t)}static RGB_CMYK([e,t,s]){const i=1-e,n=1-t,r=1-s,a=Math.min(i,n,r);return["CMYK",i,n,r,a]}}class tf{static setupStorage(e,t,s,i,n){const r=i.getValue(t,{value:null});switch(s.name){case"textarea":if(r.value!==null&&(e.textContent=r.value),n==="print")break;e.addEventListener("input",a=>{i.setValue(t,{value:a.target.value})});break;case"input":if(s.attributes.type==="radio"||s.attributes.type==="checkbox"){if(r.value===s.attributes.xfaOn?e.setAttribute("checked",!0):r.value===s.attributes.xfaOff&&e.removeAttribute("checked"),n==="print")break;e.addEventListener("change",a=>{i.setValue(t,{value:a.target.checked?a.target.getAttribute("xfaOn"):a.target.getAttribute("xfaOff")})})}else{if(r.value!==null&&e.setAttribute("value",r.value),n==="print")break;e.addEventListener("input",a=>{i.setValue(t,{value:a.target.value})})}break;case"select":if(r.value!==null){e.setAttribute("value",r.value);for(const a of s.children)a.attributes.value===r.value?a.attributes.selected=!0:a.attributes.hasOwnProperty("selected")&&delete a.attributes.selected}e.addEventListener("input",a=>{const h=a.target.options,l=h.selectedIndex===-1?"":h[h.selectedIndex].value;i.setValue(t,{value:l})});break}}static setAttributes({html:e,element:t,storage:s=null,intent:i,linkService:n}){const{attributes:r}=t,a=e instanceof HTMLAnchorElement;r.type==="radio"&&(r.name=`${r.name}-${i}`);for(const[h,l]of Object.entries(r))if(l!=null)switch(h){case"class":l.length&&e.setAttribute(h,l.join(" "));break;case"dataId":break;case"id":e.setAttribute("data-element-id",l);break;case"style":Object.assign(e.style,l);break;case"textContent":e.textContent=l;break;default:(!a||h!=="href"&&h!=="newWindow")&&e.setAttribute(h,l)}a&&n.addLinkAttributes(e,r.href,r.newWindow),s&&r.dataId&&this.setupStorage(e,r.dataId,t,s)}static render(e){var d,p;const t=e.annotationStorage,s=e.linkService,i=e.xfaHtml,n=e.intent||"display",r=document.createElement(i.name);i.attributes&&this.setAttributes({html:r,element:i,intent:n,linkService:s});const a=n!=="richText",h=e.div;if(h.append(r),e.viewport){const f=`matrix(${e.viewport.transform.join(",")})`;h.style.transform=f}a&&h.setAttribute("class","xfaLayer xfaFont");const l=[];if(i.children.length===0){if(i.value){const f=document.createTextNode(i.value);r.append(f),a&&Na.shouldBuildText(i.name)&&l.push(f)}return{textDivs:l}}const c=[[i,-1,r]];for(;c.length>0;){const[f,g,m]=c.at(-1);if(g+1===f.children.length){c.pop();continue}const v=f.children[++c.at(-1)[1]];if(v===null)continue;const{name:b}=v;if(b==="#text"){const x=document.createTextNode(v.value);l.push(x),m.append(x);continue}const A=(d=v==null?void 0:v.attributes)!=null&&d.xmlns?document.createElementNS(v.attributes.xmlns,b):document.createElement(b);if(m.append(A),v.attributes&&this.setAttributes({html:A,element:v,storage:t,intent:n,linkService:s}),((p=v.children)==null?void 0:p.length)>0)c.push([v,-1,A]);else if(v.value){const x=document.createTextNode(v.value);a&&Na.shouldBuildText(b)&&l.push(x),A.append(x)}}for(const f of h.querySelectorAll(".xfaNonInteractive input, .xfaNonInteractive textarea"))f.setAttribute("readOnly",!0);return{textDivs:l}}static update(e){const t=`matrix(${e.viewport.transform.join(",")})`;e.div.style.transform=t,e.div.hidden=!1}}const yh=1e3,cm=9,Jn=new WeakSet;function mi(u){return{width:u[2]-u[0],height:u[3]-u[1]}}class dm{static create(e){switch(e.data.annotationType){case qt.LINK:return new ef(e);case qt.TEXT:return new um(e);case qt.WIDGET:switch(e.data.fieldType){case"Tx":return new fm(e);case"Btn":return e.data.radioButton?new rf(e):e.data.checkBox?new gm(e):new mm(e);case"Ch":return new bm(e);case"Sig":return new pm(e)}return new nr(e);case qt.POPUP:return new Lc(e);case qt.FREETEXT:return new cf(e);case qt.LINE:return new vm(e);case qt.SQUARE:return new ym(e);case qt.CIRCLE:return new Am(e);case qt.POLYLINE:return new df(e);case qt.CARET:return new Em(e);case qt.INK:return new uf(e);case qt.POLYGON:return new wm(e);case qt.HIGHLIGHT:return new Sm(e);case qt.UNDERLINE:return new xm(e);case qt.SQUIGGLY:return new Cm(e);case qt.STRIKEOUT:return new km(e);case qt.STAMP:return new ff(e);case qt.FILEATTACHMENT:return new Tm(e);default:return new jt(e)}}}var Rn,Hr,Ur,Ro,Pc;const Ed=class Ed{constructor(e,{isRenderable:t=!1,ignoreBorder:s=!1,createQuadrilaterals:i=!1}={}){S(this,Ro);S(this,Rn,null);S(this,Hr,!1);S(this,Ur,null);this.isRenderable=t,this.data=e.data,this.layer=e.layer,this.linkService=e.linkService,this.downloadManager=e.downloadManager,this.imageResourcesPath=e.imageResourcesPath,this.renderForms=e.renderForms,this.svgFactory=e.svgFactory,this.annotationStorage=e.annotationStorage,this.enableScripting=e.enableScripting,this.hasJSActions=e.hasJSActions,this._fieldObjects=e.fieldObjects,this.parent=e.parent,t&&(this.container=this._createContainer(s)),i&&this._createQuadrilaterals()}static _hasPopupData({titleObj:e,contentsObj:t,richText:s}){return!!(e!=null&&e.str||t!=null&&t.str||s!=null&&s.str)}get hasPopupData(){return Ed._hasPopupData(this.data)}updateEdited(e){var s;if(!this.container)return;o(this,Rn)||w(this,Rn,{rect:this.data.rect.slice(0)});const{rect:t}=e;t&&E(this,Ro,Pc).call(this,t),(s=o(this,Ur))==null||s.popup.updateEdited(e)}resetEdited(){var e;o(this,Rn)&&(E(this,Ro,Pc).call(this,o(this,Rn).rect),(e=o(this,Ur))==null||e.popup.resetEdited(),w(this,Rn,null))}_createContainer(e){const{data:t,parent:{page:s,viewport:i}}=this,n=document.createElement("section");n.setAttribute("data-annotation-id",t.id),this instanceof nr||(n.tabIndex=yh);const{style:r}=n;if(r.zIndex=this.parent.zIndex++,t.popupRef&&n.setAttribute("aria-haspopup","dialog"),t.alternativeText&&(n.title=t.alternativeText),t.noRotate&&n.classList.add("norotate"),!t.rect||this instanceof Lc){const{rotation:m}=t;return!t.hasOwnCanvas&&m!==0&&this.setRotation(m,n),n}const{width:a,height:h}=mi(t.rect);if(!e&&t.borderStyle.width>0){r.borderWidth=`${t.borderStyle.width}px`;const m=t.borderStyle.horizontalCornerRadius,v=t.borderStyle.verticalCornerRadius;if(m>0||v>0){const A=`calc(${m}px * var(--scale-factor)) / calc(${v}px * var(--scale-factor))`;r.borderRadius=A}else if(this instanceof rf){const A=`calc(${a}px * var(--scale-factor)) / calc(${h}px * var(--scale-factor))`;r.borderRadius=A}switch(t.borderStyle.style){case ga.SOLID:r.borderStyle="solid";break;case ga.DASHED:r.borderStyle="dashed";break;case ga.BEVELED:gt("Unimplemented border style: beveled");break;case ga.INSET:gt("Unimplemented border style: inset");break;case ga.UNDERLINE:r.borderBottomStyle="solid";break}const b=t.borderColor||null;b?(w(this,Hr,!0),r.borderColor=at.makeHexColor(b[0]|0,b[1]|0,b[2]|0)):r.borderWidth=0}const l=at.normalizeRect([t.rect[0],s.view[3]-t.rect[1]+s.view[1],t.rect[2],s.view[3]-t.rect[3]+s.view[1]]),{pageWidth:c,pageHeight:d,pageX:p,pageY:f}=i.rawDims;r.left=`${100*(l[0]-p)/c}%`,r.top=`${100*(l[1]-f)/d}%`;const{rotation:g}=t;return t.hasOwnCanvas||g===0?(r.width=`${100*a/c}%`,r.height=`${100*h/d}%`):this.setRotation(g,n),n}setRotation(e,t=this.container){if(!this.data.rect)return;const{pageWidth:s,pageHeight:i}=this.parent.viewport.rawDims,{width:n,height:r}=mi(this.data.rect);let a,h;e%180===0?(a=100*n/s,h=100*r/i):(a=100*r/s,h=100*n/i),t.style.width=`${a}%`,t.style.height=`${h}%`,t.setAttribute("data-main-rotation",(360-e)%360)}get _commonActions(){const e=(t,s,i)=>{const n=i.detail[t],r=n[0],a=n.slice(1);i.target.style[s]=Kd[`${r}_HTML`](a),this.annotationStorage.setValue(this.data.id,{[s]:Kd[`${r}_rgb`](a)})};return Et(this,"_commonActions",{display:t=>{const{display:s}=t.detail,i=s%2===1;this.container.style.visibility=i?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noView:i,noPrint:s===1||s===2})},print:t=>{this.annotationStorage.setValue(this.data.id,{noPrint:!t.detail.print})},hidden:t=>{const{hidden:s}=t.detail;this.container.style.visibility=s?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noPrint:s,noView:s})},focus:t=>{setTimeout(()=>t.target.focus({preventScroll:!1}),0)},userName:t=>{t.target.title=t.detail.userName},readonly:t=>{t.target.disabled=t.detail.readonly},required:t=>{this._setRequired(t.target,t.detail.required)},bgColor:t=>{e("bgColor","backgroundColor",t)},fillColor:t=>{e("fillColor","backgroundColor",t)},fgColor:t=>{e("fgColor","color",t)},textColor:t=>{e("textColor","color",t)},borderColor:t=>{e("borderColor","borderColor",t)},strokeColor:t=>{e("strokeColor","borderColor",t)},rotation:t=>{const s=t.detail.rotation;this.setRotation(s),this.annotationStorage.setValue(this.data.id,{rotation:s})}})}_dispatchEventFromSandbox(e,t){const s=this._commonActions;for(const i of Object.keys(t.detail)){const n=e[i]||s[i];n==null||n(t)}}_setDefaultPropertiesFromJS(e){if(!this.enableScripting)return;const t=this.annotationStorage.getRawValue(this.data.id);if(!t)return;const s=this._commonActions;for(const[i,n]of Object.entries(t)){const r=s[i];if(r){const a={detail:{[i]:n},target:e};r(a),delete t[i]}}}_createQuadrilaterals(){if(!this.container)return;const{quadPoints:e}=this.data;if(!e)return;const[t,s,i,n]=this.data.rect.map(m=>Math.fround(m));if(e.length===8){const[m,v,b,A]=e.subarray(2,6);if(i===m&&n===v&&t===b&&s===A)return}const{style:r}=this.container;let a;if(o(this,Hr)){const{borderColor:m,borderWidth:v}=r;r.borderWidth=0,a=["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="${m}" stroke-width="${v}">`],this.container.classList.add("hasBorder")}const h=i-t,l=n-s,{svgFactory:c}=this,d=c.createElement("svg");d.classList.add("quadrilateralsContainer"),d.setAttribute("width",0),d.setAttribute("height",0);const p=c.createElement("defs");d.append(p);const f=c.createElement("clipPath"),g=`clippath_${this.data.id}`;f.setAttribute("id",g),f.setAttribute("clipPathUnits","objectBoundingBox"),p.append(f);for(let m=2,v=e.length;m<v;m+=8){const b=e[m],A=e[m+1],x=e[m+2],k=e[m+3],T=c.createElement("rect"),L=(x-t)/h,I=(n-A)/l,B=(b-x)/h,D=(A-k)/l;T.setAttribute("x",L),T.setAttribute("y",I),T.setAttribute("width",B),T.setAttribute("height",D),f.append(T),a==null||a.push(`<rect vector-effect="non-scaling-stroke" x="${L}" y="${I}" width="${B}" height="${D}"/>`)}o(this,Hr)&&(a.push("</g></svg>')"),r.backgroundImage=a.join("")),this.container.append(d),this.container.style.clipPath=`url(#${g})`}_createPopup(){const{container:e,data:t}=this;e.setAttribute("aria-haspopup","dialog");const s=w(this,Ur,new Lc({data:{color:t.color,titleObj:t.titleObj,modificationDate:t.modificationDate,contentsObj:t.contentsObj,richText:t.richText,parentRect:t.rect,borderStyle:0,id:`popup_${t.id}`,rotation:t.rotation},parent:this.parent,elements:[this]}));this.parent.div.append(s.render())}render(){Rt("Abstract method `AnnotationElement.render` called")}_getElementsByName(e,t=null){const s=[];if(this._fieldObjects){const i=this._fieldObjects[e];if(i)for(const{page:n,id:r,exportValues:a}of i){if(n===-1||r===t)continue;const h=typeof a=="string"?a:null,l=document.querySelector(`[data-element-id="${r}"]`);if(l&&!Jn.has(l)){gt(`_getElementsByName - element not allowed: ${r}`);continue}s.push({id:r,exportValue:h,domElement:l})}return s}for(const i of document.getElementsByName(e)){const{exportValue:n}=i,r=i.getAttribute("data-element-id");r!==t&&Jn.has(i)&&s.push({id:r,exportValue:n,domElement:i})}return s}show(){var e;this.container&&(this.container.hidden=!1),(e=this.popup)==null||e.maybeShow()}hide(){var e;this.container&&(this.container.hidden=!0),(e=this.popup)==null||e.forceHide()}getElementsToTriggerPopup(){return this.container}addHighlightArea(){const e=this.getElementsToTriggerPopup();if(Array.isArray(e))for(const t of e)t.classList.add("highlightArea");else e.classList.add("highlightArea")}get _isEditable(){return!1}_editOnDoubleClick(){if(!this._isEditable)return;const{annotationEditorType:e,data:{id:t}}=this;this.container.addEventListener("dblclick",()=>{var s;(s=this.linkService.eventBus)==null||s.dispatch("switchannotationeditormode",{source:this,mode:e,editId:t})})}};Rn=new WeakMap,Hr=new WeakMap,Ur=new WeakMap,Ro=new WeakSet,Pc=function(e){const{container:{style:t},data:{rect:s,rotation:i},parent:{viewport:{rawDims:{pageWidth:n,pageHeight:r,pageX:a,pageY:h}}}}=this;s==null||s.splice(0,4,...e);const{width:l,height:c}=mi(e);t.left=`${100*(e[0]-a)/n}%`,t.top=`${100*(r-e[3]+h)/r}%`,i===0?(t.width=`${100*l/n}%`,t.height=`${100*c/r}%`):this.setRotation(i)};let jt=Ed;var je,Ki,sf,nf;class ef extends jt{constructor(t,s=null){super(t,{isRenderable:!0,ignoreBorder:!!(s!=null&&s.ignoreBorder),createQuadrilaterals:!0});S(this,je);this.isTooltipOnly=t.data.isTooltipOnly}render(){const{data:t,linkService:s}=this,i=document.createElement("a");i.setAttribute("data-element-id",t.id);let n=!1;return t.url?(s.addLinkAttributes(i,t.url,t.newWindow),n=!0):t.action?(this._bindNamedAction(i,t.action),n=!0):t.attachment?(E(this,je,sf).call(this,i,t.attachment,t.attachmentDest),n=!0):t.setOCGState?(E(this,je,nf).call(this,i,t.setOCGState),n=!0):t.dest?(this._bindLink(i,t.dest),n=!0):(t.actions&&(t.actions.Action||t.actions["Mouse Up"]||t.actions["Mouse Down"])&&this.enableScripting&&this.hasJSActions&&(this._bindJSAction(i,t),n=!0),t.resetForm?(this._bindResetFormAction(i,t.resetForm),n=!0):this.isTooltipOnly&&!n&&(this._bindLink(i,""),n=!0)),this.container.classList.add("linkAnnotation"),n&&this.container.append(i),this.container}_bindLink(t,s){t.href=this.linkService.getDestinationHash(s),t.onclick=()=>(s&&this.linkService.goToDestination(s),!1),(s||s==="")&&E(this,je,Ki).call(this)}_bindNamedAction(t,s){t.href=this.linkService.getAnchorUrl(""),t.onclick=()=>(this.linkService.executeNamedAction(s),!1),E(this,je,Ki).call(this)}_bindJSAction(t,s){t.href=this.linkService.getAnchorUrl("");const i=new Map([["Action","onclick"],["Mouse Up","onmouseup"],["Mouse Down","onmousedown"]]);for(const n of Object.keys(s.actions)){const r=i.get(n);r&&(t[r]=()=>{var a;return(a=this.linkService.eventBus)==null||a.dispatch("dispatcheventinsandbox",{source:this,detail:{id:s.id,name:n}}),!1})}t.onclick||(t.onclick=()=>!1),E(this,je,Ki).call(this)}_bindResetFormAction(t,s){const i=t.onclick;if(i||(t.href=this.linkService.getAnchorUrl("")),E(this,je,Ki).call(this),!this._fieldObjects){gt('_bindResetFormAction - "resetForm" action not supported, ensure that the `fieldObjects` parameter is provided.'),i||(t.onclick=()=>!1);return}t.onclick=()=>{var d;i==null||i();const{fields:n,refs:r,include:a}=s,h=[];if(n.length!==0||r.length!==0){const p=new Set(r);for(const f of n){const g=this._fieldObjects[f]||[];for(const{id:m}of g)p.add(m)}for(const f of Object.values(this._fieldObjects))for(const g of f)p.has(g.id)===a&&h.push(g)}else for(const p of Object.values(this._fieldObjects))h.push(...p);const l=this.annotationStorage,c=[];for(const p of h){const{id:f}=p;switch(c.push(f),p.type){case"text":{const m=p.defaultValue||"";l.setValue(f,{value:m});break}case"checkbox":case"radiobutton":{const m=p.defaultValue===p.exportValues;l.setValue(f,{value:m});break}case"combobox":case"listbox":{const m=p.defaultValue||"";l.setValue(f,{value:m});break}default:continue}const g=document.querySelector(`[data-element-id="${f}"]`);if(g){if(!Jn.has(g)){gt(`_bindResetFormAction - element not allowed: ${f}`);continue}}else continue;g.dispatchEvent(new Event("resetform"))}return this.enableScripting&&((d=this.linkService.eventBus)==null||d.dispatch("dispatcheventinsandbox",{source:this,detail:{id:"app",ids:c,name:"ResetForm"}})),!1}}}je=new WeakSet,Ki=function(){this.container.setAttribute("data-internal-link","")},sf=function(t,s,i=null){t.href=this.linkService.getAnchorUrl(""),s.description&&(t.title=s.description),t.onclick=()=>{var n;return(n=this.downloadManager)==null||n.openOrDownloadData(s.content,s.filename,i),!1},E(this,je,Ki).call(this)},nf=function(t,s){t.href=this.linkService.getAnchorUrl(""),t.onclick=()=>(this.linkService.executeSetOCGState(s),!1),E(this,je,Ki).call(this)};class um extends jt{constructor(e){super(e,{isRenderable:!0})}render(){this.container.classList.add("textAnnotation");const e=document.createElement("img");return e.src=this.imageResourcesPath+"annotation-"+this.data.name.toLowerCase()+".svg",e.setAttribute("data-l10n-id","pdfjs-text-annotation-type"),e.setAttribute("data-l10n-args",JSON.stringify({type:this.data.name})),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.append(e),this.container}}class nr extends jt{render(){return this.container}showElementAndHideCanvas(e){var t;this.data.hasOwnCanvas&&(((t=e.previousSibling)==null?void 0:t.nodeName)==="CANVAS"&&(e.previousSibling.hidden=!0),e.hidden=!1)}_getKeyModifier(e){return ke.platform.isMac?e.metaKey:e.ctrlKey}_setEventListener(e,t,s,i,n){s.includes("mouse")?e.addEventListener(s,r=>{var a;(a=this.linkService.eventBus)==null||a.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:i,value:n(r),shift:r.shiftKey,modifier:this._getKeyModifier(r)}})}):e.addEventListener(s,r=>{var a;if(s==="blur"){if(!t.focused||!r.relatedTarget)return;t.focused=!1}else if(s==="focus"){if(t.focused)return;t.focused=!0}n&&((a=this.linkService.eventBus)==null||a.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:i,value:n(r)}}))})}_setEventListeners(e,t,s,i){var n,r,a;for(const[h,l]of s)(l==="Action"||(n=this.data.actions)!=null&&n[l])&&((l==="Focus"||l==="Blur")&&(t||(t={focused:!1})),this._setEventListener(e,t,h,l,i),l==="Focus"&&!((r=this.data.actions)!=null&&r.Blur)?this._setEventListener(e,t,"blur","Blur",null):l==="Blur"&&!((a=this.data.actions)!=null&&a.Focus)&&this._setEventListener(e,t,"focus","Focus",null))}_setBackgroundColor(e){const t=this.data.backgroundColor||null;e.style.backgroundColor=t===null?"transparent":at.makeHexColor(t[0],t[1],t[2])}_setTextStyle(e){const t=["left","center","right"],{fontColor:s}=this.data.defaultAppearanceData,i=this.data.defaultAppearanceData.fontSize||cm,n=e.style;let r;const a=2,h=l=>Math.round(10*l)/10;if(this.data.multiLine){const l=Math.abs(this.data.rect[3]-this.data.rect[1]-a),c=Math.round(l/(jl*i))||1,d=l/c;r=Math.min(i,h(d/jl))}else{const l=Math.abs(this.data.rect[3]-this.data.rect[1]-a);r=Math.min(i,h(l/jl))}n.fontSize=`calc(${r}px * var(--scale-factor))`,n.color=at.makeHexColor(s[0],s[1],s[2]),this.data.textAlignment!==null&&(n.textAlign=t[this.data.textAlignment])}_setRequired(e,t){t?e.setAttribute("required",!0):e.removeAttribute("required"),e.setAttribute("aria-required",t)}}class fm extends nr{constructor(e){const t=e.renderForms||e.data.hasOwnCanvas||!e.data.hasAppearance&&!!e.data.fieldValue;super(e,{isRenderable:t})}setPropertyOnSiblings(e,t,s,i){const n=this.annotationStorage;for(const r of this._getElementsByName(e.name,e.id))r.domElement&&(r.domElement[t]=s),n.setValue(r.id,{[i]:s})}render(){var i,n;const e=this.annotationStorage,t=this.data.id;this.container.classList.add("textWidgetAnnotation");let s=null;if(this.renderForms){const r=e.getValue(t,{value:this.data.fieldValue});let a=r.value||"";const h=e.getValue(t,{charLimit:this.data.maxLen}).charLimit;h&&a.length>h&&(a=a.slice(0,h));let l=r.formattedValue||((i=this.data.textContent)==null?void 0:i.join(`
| `))||null;l&&this.data.comb&&(l=l.replaceAll(/\s+/g,""));const c={userValue:a,formattedValue:l,lastCommittedValue:null,commitKey:1,focused:!1};this.data.multiLine?(s=document.createElement("textarea"),s.textContent=l??a,this.data.doNotScroll&&(s.style.overflowY="hidden")):(s=document.createElement("input"),s.type="text",s.setAttribute("value",l??a),this.data.doNotScroll&&(s.style.overflowX="hidden")),this.data.hasOwnCanvas&&(s.hidden=!0),Jn.add(s),s.setAttribute("data-element-id",t),s.disabled=this.data.readOnly,s.name=this.data.fieldName,s.tabIndex=yh,this._setRequired(s,this.data.required),h&&(s.maxLength=h),s.addEventListener("input",p=>{e.setValue(t,{value:p.target.value}),this.setPropertyOnSiblings(s,"value",p.target.value,"value"),c.formattedValue=null}),s.addEventListener("resetform",p=>{const f=this.data.defaultFieldValue??"";s.value=c.userValue=f,c.formattedValue=null});let d=p=>{const{formattedValue:f}=c;f!=null&&(p.target.value=f),p.target.scrollLeft=0};if(this.enableScripting&&this.hasJSActions){s.addEventListener("focus",f=>{var m;if(c.focused)return;const{target:g}=f;c.userValue&&(g.value=c.userValue),c.lastCommittedValue=g.value,c.commitKey=1,(m=this.data.actions)!=null&&m.Focus||(c.focused=!0)}),s.addEventListener("updatefromsandbox",f=>{this.showElementAndHideCanvas(f.target);const g={value(m){c.userValue=m.detail.value??"",e.setValue(t,{value:c.userValue.toString()}),m.target.value=c.userValue},formattedValue(m){const{formattedValue:v}=m.detail;c.formattedValue=v,v!=null&&m.target!==document.activeElement&&(m.target.value=v),e.setValue(t,{formattedValue:v})},selRange(m){m.target.setSelectionRange(...m.detail.selRange)},charLimit:m=>{var x;const{charLimit:v}=m.detail,{target:b}=m;if(v===0){b.removeAttribute("maxLength");return}b.setAttribute("maxLength",v);let A=c.userValue;!A||A.length<=v||(A=A.slice(0,v),b.value=c.userValue=A,e.setValue(t,{value:A}),(x=this.linkService.eventBus)==null||x.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t,name:"Keystroke",value:A,willCommit:!0,commitKey:1,selStart:b.selectionStart,selEnd:b.selectionEnd}}))}};this._dispatchEventFromSandbox(g,f)}),s.addEventListener("keydown",f=>{var v;c.commitKey=1;let g=-1;if(f.key==="Escape"?g=0:f.key==="Enter"&&!this.data.multiLine?g=2:f.key==="Tab"&&(c.commitKey=3),g===-1)return;const{value:m}=f.target;c.lastCommittedValue!==m&&(c.lastCommittedValue=m,c.userValue=m,(v=this.linkService.eventBus)==null||v.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t,name:"Keystroke",value:m,willCommit:!0,commitKey:g,selStart:f.target.selectionStart,selEnd:f.target.selectionEnd}}))});const p=d;d=null,s.addEventListener("blur",f=>{var m,v;if(!c.focused||!f.relatedTarget)return;(m=this.data.actions)!=null&&m.Blur||(c.focused=!1);const{value:g}=f.target;c.userValue=g,c.lastCommittedValue!==g&&((v=this.linkService.eventBus)==null||v.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t,name:"Keystroke",value:g,willCommit:!0,commitKey:c.commitKey,selStart:f.target.selectionStart,selEnd:f.target.selectionEnd}})),p(f)}),(n=this.data.actions)!=null&&n.Keystroke&&s.addEventListener("beforeinput",f=>{var T;c.lastCommittedValue=null;const{data:g,target:m}=f,{value:v,selectionStart:b,selectionEnd:A}=m;let x=b,k=A;switch(f.inputType){case"deleteWordBackward":{const L=v.substring(0,b).match(/\w*[^\w]*$/);L&&(x-=L[0].length);break}case"deleteWordForward":{const L=v.substring(b).match(/^[^\w]*\w*/);L&&(k+=L[0].length);break}case"deleteContentBackward":b===A&&(x-=1);break;case"deleteContentForward":b===A&&(k+=1);break}f.preventDefault(),(T=this.linkService.eventBus)==null||T.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t,name:"Keystroke",value:v,change:g||"",willCommit:!1,selStart:x,selEnd:k}})}),this._setEventListeners(s,c,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],f=>f.target.value)}if(d&&s.addEventListener("blur",d),this.data.comb){const f=(this.data.rect[2]-this.data.rect[0])/h;s.classList.add("comb"),s.style.letterSpacing=`calc(${f}px * var(--scale-factor) - 1ch)`}}else s=document.createElement("div"),s.textContent=this.data.fieldValue,s.style.verticalAlign="middle",s.style.display="table-cell",this.data.hasOwnCanvas&&(s.hidden=!0);return this._setTextStyle(s),this._setBackgroundColor(s),this._setDefaultPropertiesFromJS(s),this.container.append(s),this.container}}class pm extends nr{constructor(e){super(e,{isRenderable:!!e.data.hasOwnCanvas})}}class gm extends nr{constructor(e){super(e,{isRenderable:e.renderForms})}render(){const e=this.annotationStorage,t=this.data,s=t.id;let i=e.getValue(s,{value:t.exportValue===t.fieldValue}).value;typeof i=="string"&&(i=i!=="Off",e.setValue(s,{value:i})),this.container.classList.add("buttonWidgetAnnotation","checkBox");const n=document.createElement("input");return Jn.add(n),n.setAttribute("data-element-id",s),n.disabled=t.readOnly,this._setRequired(n,this.data.required),n.type="checkbox",n.name=t.fieldName,i&&n.setAttribute("checked",!0),n.setAttribute("exportValue",t.exportValue),n.tabIndex=yh,n.addEventListener("change",r=>{const{name:a,checked:h}=r.target;for(const l of this._getElementsByName(a,s)){const c=h&&l.exportValue===t.exportValue;l.domElement&&(l.domElement.checked=c),e.setValue(l.id,{value:c})}e.setValue(s,{value:h})}),n.addEventListener("resetform",r=>{const a=t.defaultFieldValue||"Off";r.target.checked=a===t.exportValue}),this.enableScripting&&this.hasJSActions&&(n.addEventListener("updatefromsandbox",r=>{const a={value(h){h.target.checked=h.detail.value!=="Off",e.setValue(s,{value:h.target.checked})}};this._dispatchEventFromSandbox(a,r)}),this._setEventListeners(n,null,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],r=>r.target.checked)),this._setBackgroundColor(n),this._setDefaultPropertiesFromJS(n),this.container.append(n),this.container}}class rf extends nr{constructor(e){super(e,{isRenderable:e.renderForms})}render(){this.container.classList.add("buttonWidgetAnnotation","radioButton");const e=this.annotationStorage,t=this.data,s=t.id;let i=e.getValue(s,{value:t.fieldValue===t.buttonValue}).value;if(typeof i=="string"&&(i=i!==t.buttonValue,e.setValue(s,{value:i})),i)for(const r of this._getElementsByName(t.fieldName,s))e.setValue(r.id,{value:!1});const n=document.createElement("input");if(Jn.add(n),n.setAttribute("data-element-id",s),n.disabled=t.readOnly,this._setRequired(n,this.data.required),n.type="radio",n.name=t.fieldName,i&&n.setAttribute("checked",!0),n.tabIndex=yh,n.addEventListener("change",r=>{const{name:a,checked:h}=r.target;for(const l of this._getElementsByName(a,s))e.setValue(l.id,{value:!1});e.setValue(s,{value:h})}),n.addEventListener("resetform",r=>{const a=t.defaultFieldValue;r.target.checked=a!=null&&a===t.buttonValue}),this.enableScripting&&this.hasJSActions){const r=t.buttonValue;n.addEventListener("updatefromsandbox",a=>{const h={value:l=>{const c=r===l.detail.value;for(const d of this._getElementsByName(l.target.name)){const p=c&&d.id===s;d.domElement&&(d.domElement.checked=p),e.setValue(d.id,{value:p})}}};this._dispatchEventFromSandbox(h,a)}),this._setEventListeners(n,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)}return this._setBackgroundColor(n),this._setDefaultPropertiesFromJS(n),this.container.append(n),this.container}}class mm extends ef{constructor(e){super(e,{ignoreBorder:e.data.hasAppearance})}render(){const e=super.render();e.classList.add("buttonWidgetAnnotation","pushButton");const t=e.lastChild;return this.enableScripting&&this.hasJSActions&&t&&(this._setDefaultPropertiesFromJS(t),t.addEventListener("updatefromsandbox",s=>{this._dispatchEventFromSandbox({},s)})),e}}class bm extends nr{constructor(e){super(e,{isRenderable:e.renderForms})}render(){this.container.classList.add("choiceWidgetAnnotation");const e=this.annotationStorage,t=this.data.id,s=e.getValue(t,{value:this.data.fieldValue}),i=document.createElement("select");Jn.add(i),i.setAttribute("data-element-id",t),i.disabled=this.data.readOnly,this._setRequired(i,this.data.required),i.name=this.data.fieldName,i.tabIndex=yh;let n=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",c=>{const d=this.data.defaultFieldValue;for(const p of i.options)p.selected=p.value===d});for(const c of this.data.options){const d=document.createElement("option");d.textContent=c.displayValue,d.value=c.exportValue,s.value.includes(c.exportValue)&&(d.setAttribute("selected",!0),n=!1),i.append(d)}let r=null;if(n){const c=document.createElement("option");c.value=" ",c.setAttribute("hidden",!0),c.setAttribute("selected",!0),i.prepend(c),r=()=>{c.remove(),i.removeEventListener("input",r),r=null},i.addEventListener("input",r)}const a=c=>{const d=c?"value":"textContent",{options:p,multiple:f}=i;return f?Array.prototype.filter.call(p,g=>g.selected).map(g=>g[d]):p.selectedIndex===-1?null:p[p.selectedIndex][d]};let h=a(!1);const l=c=>{const d=c.target.options;return Array.prototype.map.call(d,p=>({displayValue:p.textContent,exportValue:p.value}))};return this.enableScripting&&this.hasJSActions?(i.addEventListener("updatefromsandbox",c=>{const d={value(p){r==null||r();const f=p.detail.value,g=new Set(Array.isArray(f)?f:[f]);for(const m of i.options)m.selected=g.has(m.value);e.setValue(t,{value:a(!0)}),h=a(!1)},multipleSelection(p){i.multiple=!0},remove(p){const f=i.options,g=p.detail.remove;f[g].selected=!1,i.remove(g),f.length>0&&Array.prototype.findIndex.call(f,v=>v.selected)===-1&&(f[0].selected=!0),e.setValue(t,{value:a(!0),items:l(p)}),h=a(!1)},clear(p){for(;i.length!==0;)i.remove(0);e.setValue(t,{value:null,items:[]}),h=a(!1)},insert(p){const{index:f,displayValue:g,exportValue:m}=p.detail.insert,v=i.children[f],b=document.createElement("option");b.textContent=g,b.value=m,v?v.before(b):i.append(b),e.setValue(t,{value:a(!0),items:l(p)}),h=a(!1)},items(p){const{items:f}=p.detail;for(;i.length!==0;)i.remove(0);for(const g of f){const{displayValue:m,exportValue:v}=g,b=document.createElement("option");b.textContent=m,b.value=v,i.append(b)}i.options.length>0&&(i.options[0].selected=!0),e.setValue(t,{value:a(!0),items:l(p)}),h=a(!1)},indices(p){const f=new Set(p.detail.indices);for(const g of p.target.options)g.selected=f.has(g.index);e.setValue(t,{value:a(!0)}),h=a(!1)},editable(p){p.target.disabled=!p.detail.editable}};this._dispatchEventFromSandbox(d,c)}),i.addEventListener("input",c=>{var f;const d=a(!0),p=a(!1);e.setValue(t,{value:d}),c.preventDefault(),(f=this.linkService.eventBus)==null||f.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t,name:"Keystroke",value:h,change:p,changeEx:d,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"]],c=>c.target.value)):i.addEventListener("input",function(c){e.setValue(t,{value:a(!0)})}),this.data.combo&&this._setTextStyle(i),this._setBackgroundColor(i),this._setDefaultPropertiesFromJS(i),this.container.append(i),this.container}}class Lc extends jt{constructor(e){const{data:t,elements:s}=e;super(e,{isRenderable:jt._hasPopupData(t)}),this.elements=s,this.popup=null}render(){this.container.classList.add("popupAnnotation");const e=this.popup=new _m({container:this.container,color:this.data.color,titleObj:this.data.titleObj,modificationDate:this.data.modificationDate,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}),t=[];for(const s of this.elements)s.popup=e,t.push(s.data.id),s.addHighlightArea();return this.container.setAttribute("aria-controls",t.map(s=>`${ru}${s}`).join(",")),this.container}}var jr,Sl,xl,Wr,Pn,zt,si,Ln,Po,Lo,Gr,ii,hs,ni,Io,ri,Mo,In,Mn,Pt,jh,Ic,af,of,hf,lf,Wh,Gh,Mc;class _m{constructor({container:e,color:t,elements:s,titleObj:i,modificationDate:n,contentsObj:r,richText:a,parent:h,rect:l,parentRect:c,open:d}){S(this,Pt);S(this,jr,E(this,Pt,hf).bind(this));S(this,Sl,E(this,Pt,Mc).bind(this));S(this,xl,E(this,Pt,Gh).bind(this));S(this,Wr,E(this,Pt,Wh).bind(this));S(this,Pn,null);S(this,zt,null);S(this,si,null);S(this,Ln,null);S(this,Po,null);S(this,Lo,null);S(this,Gr,null);S(this,ii,!1);S(this,hs,null);S(this,ni,null);S(this,Io,null);S(this,ri,null);S(this,Mo,null);S(this,In,null);S(this,Mn,!1);var p;w(this,zt,e),w(this,Mo,i),w(this,si,r),w(this,ri,a),w(this,Lo,h),w(this,Pn,t),w(this,Io,l),w(this,Gr,c),w(this,Po,s),w(this,Ln,cu.toDateObject(n)),this.trigger=s.flatMap(f=>f.getElementsToTriggerPopup());for(const f of this.trigger)f.addEventListener("click",o(this,Wr)),f.addEventListener("mouseenter",o(this,xl)),f.addEventListener("mouseleave",o(this,Sl)),f.classList.add("popupTriggerArea");for(const f of s)(p=f.container)==null||p.addEventListener("keydown",o(this,jr));o(this,zt).hidden=!0,d&&E(this,Pt,Wh).call(this)}render(){if(o(this,hs))return;const e=w(this,hs,document.createElement("div"));if(e.className="popup",o(this,Pn)){const n=e.style.outlineColor=at.makeHexColor(...o(this,Pn));CSS.supports("background-color","color-mix(in srgb, red 30%, white)")?e.style.backgroundColor=`color-mix(in srgb, ${n} 30%, white)`:e.style.backgroundColor=at.makeHexColor(...o(this,Pn).map(a=>Math.floor(.7*(255-a)+a)))}const t=document.createElement("span");t.className="header";const s=document.createElement("h1");if(t.append(s),{dir:s.dir,str:s.textContent}=o(this,Mo),e.append(t),o(this,Ln)){const n=document.createElement("span");n.classList.add("popupDate"),n.setAttribute("data-l10n-id","pdfjs-annotation-date-string"),n.setAttribute("data-l10n-args",JSON.stringify({date:o(this,Ln).toLocaleDateString(),time:o(this,Ln).toLocaleTimeString()})),t.append(n)}const i=o(this,Pt,jh);if(i)tf.render({xfaHtml:i,intent:"richText",div:e}),e.lastChild.classList.add("richText","popupContent");else{const n=this._formatContents(o(this,si));e.append(n)}o(this,zt).append(e)}_formatContents({str:e,dir:t}){const s=document.createElement("p");s.classList.add("popupContent"),s.dir=t;const i=e.split(/(?:\r\n?|\n)/);for(let n=0,r=i.length;n<r;++n){const a=i[n];s.append(document.createTextNode(a)),n<r-1&&s.append(document.createElement("br"))}return s}updateEdited({rect:e,popupContent:t}){var s;o(this,In)||w(this,In,{contentsObj:o(this,si),richText:o(this,ri)}),e&&w(this,ni,null),t&&(w(this,ri,E(this,Pt,of).call(this,t)),w(this,si,null)),(s=o(this,hs))==null||s.remove(),w(this,hs,null)}resetEdited(){var e;o(this,In)&&({contentsObj:Le(this,si)._,richText:Le(this,ri)._}=o(this,In),w(this,In,null),(e=o(this,hs))==null||e.remove(),w(this,hs,null),w(this,ni,null))}forceHide(){w(this,Mn,this.isVisible),o(this,Mn)&&(o(this,zt).hidden=!0)}maybeShow(){o(this,Mn)&&(o(this,hs)||E(this,Pt,Gh).call(this),w(this,Mn,!1),o(this,zt).hidden=!1)}get isVisible(){return o(this,zt).hidden===!1}}jr=new WeakMap,Sl=new WeakMap,xl=new WeakMap,Wr=new WeakMap,Pn=new WeakMap,zt=new WeakMap,si=new WeakMap,Ln=new WeakMap,Po=new WeakMap,Lo=new WeakMap,Gr=new WeakMap,ii=new WeakMap,hs=new WeakMap,ni=new WeakMap,Io=new WeakMap,ri=new WeakMap,Mo=new WeakMap,In=new WeakMap,Mn=new WeakMap,Pt=new WeakSet,jh=function(){const e=o(this,ri),t=o(this,si);return e!=null&&e.str&&(!(t!=null&&t.str)||t.str===e.str)&&o(this,ri).html||null},Ic=function(){var e,t,s;return((s=(t=(e=o(this,Pt,jh))==null?void 0:e.attributes)==null?void 0:t.style)==null?void 0:s.fontSize)||0},af=function(){var e,t,s;return((s=(t=(e=o(this,Pt,jh))==null?void 0:e.attributes)==null?void 0:t.style)==null?void 0:s.color)||null},of=function(e){const t=[],s={str:e,html:{name:"div",attributes:{dir:"auto"},children:[{name:"p",children:t}]}},i={style:{color:o(this,Pt,af),fontSize:o(this,Pt,Ic)?`calc(${o(this,Pt,Ic)}px * var(--scale-factor))`:""}};for(const n of e.split(`
| `))t.push({name:"span",value:n,attributes:i});return s},hf=function(e){e.altKey||e.shiftKey||e.ctrlKey||e.metaKey||(e.key==="Enter"||e.key==="Escape"&&o(this,ii))&&E(this,Pt,Wh).call(this)},lf=function(){if(o(this,ni)!==null)return;const{page:{view:e},viewport:{rawDims:{pageWidth:t,pageHeight:s,pageX:i,pageY:n}}}=o(this,Lo);let r=!!o(this,Gr),a=r?o(this,Gr):o(this,Io);for(const g of o(this,Po))if(!a||at.intersect(g.data.rect,a)!==null){a=g.data.rect,r=!0;break}const h=at.normalizeRect([a[0],e[3]-a[1]+e[1],a[2],e[3]-a[3]+e[1]]),c=r?a[2]-a[0]+5:0,d=h[0]+c,p=h[1];w(this,ni,[100*(d-i)/t,100*(p-n)/s]);const{style:f}=o(this,zt);f.left=`${o(this,ni)[0]}%`,f.top=`${o(this,ni)[1]}%`},Wh=function(){w(this,ii,!o(this,ii)),o(this,ii)?(E(this,Pt,Gh).call(this),o(this,zt).addEventListener("click",o(this,Wr)),o(this,zt).addEventListener("keydown",o(this,jr))):(E(this,Pt,Mc).call(this),o(this,zt).removeEventListener("click",o(this,Wr)),o(this,zt).removeEventListener("keydown",o(this,jr)))},Gh=function(){o(this,hs)||this.render(),this.isVisible?o(this,ii)&&o(this,zt).classList.add("focused"):(E(this,Pt,lf).call(this),o(this,zt).hidden=!1,o(this,zt).style.zIndex=parseInt(o(this,zt).style.zIndex)+1e3)},Mc=function(){o(this,zt).classList.remove("focused"),!(o(this,ii)||!this.isVisible)&&(o(this,zt).hidden=!0,o(this,zt).style.zIndex=parseInt(o(this,zt).style.zIndex)-1e3)};class cf extends jt{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0}),this.textContent=e.data.textContent,this.textPosition=e.data.textPosition,this.annotationEditorType=wt.FREETEXT}render(){if(this.container.classList.add("freeTextAnnotation"),this.textContent){const e=document.createElement("div");e.classList.add("annotationTextContent"),e.setAttribute("role","comment");for(const t of this.textContent){const s=document.createElement("span");s.textContent=t,e.append(s)}this.container.append(e)}return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this._editOnDoubleClick(),this.container}get _isEditable(){return this.data.hasOwnCanvas}}var Fo;class vm extends jt{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0});S(this,Fo,null)}render(){this.container.classList.add("lineAnnotation");const t=this.data,{width:s,height:i}=mi(t.rect),n=this.svgFactory.create(s,i,!0),r=w(this,Fo,this.svgFactory.createElement("svg:line"));return r.setAttribute("x1",t.rect[2]-t.lineCoordinates[0]),r.setAttribute("y1",t.rect[3]-t.lineCoordinates[1]),r.setAttribute("x2",t.rect[2]-t.lineCoordinates[2]),r.setAttribute("y2",t.rect[3]-t.lineCoordinates[3]),r.setAttribute("stroke-width",t.borderStyle.width||1),r.setAttribute("stroke","transparent"),r.setAttribute("fill","transparent"),n.append(r),this.container.append(n),!t.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return o(this,Fo)}addHighlightArea(){this.container.classList.add("highlightArea")}}Fo=new WeakMap;var Do;class ym extends jt{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0});S(this,Do,null)}render(){this.container.classList.add("squareAnnotation");const t=this.data,{width:s,height:i}=mi(t.rect),n=this.svgFactory.create(s,i,!0),r=t.borderStyle.width,a=w(this,Do,this.svgFactory.createElement("svg:rect"));return a.setAttribute("x",r/2),a.setAttribute("y",r/2),a.setAttribute("width",s-r),a.setAttribute("height",i-r),a.setAttribute("stroke-width",r||1),a.setAttribute("stroke","transparent"),a.setAttribute("fill","transparent"),n.append(a),this.container.append(n),!t.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return o(this,Do)}addHighlightArea(){this.container.classList.add("highlightArea")}}Do=new WeakMap;var Oo;class Am extends jt{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0});S(this,Oo,null)}render(){this.container.classList.add("circleAnnotation");const t=this.data,{width:s,height:i}=mi(t.rect),n=this.svgFactory.create(s,i,!0),r=t.borderStyle.width,a=w(this,Oo,this.svgFactory.createElement("svg:ellipse"));return a.setAttribute("cx",s/2),a.setAttribute("cy",i/2),a.setAttribute("rx",s/2-r/2),a.setAttribute("ry",i/2-r/2),a.setAttribute("stroke-width",r||1),a.setAttribute("stroke","transparent"),a.setAttribute("fill","transparent"),n.append(a),this.container.append(n),!t.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return o(this,Oo)}addHighlightArea(){this.container.classList.add("highlightArea")}}Oo=new WeakMap;var No;class df extends jt{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0});S(this,No,null);this.containerClassName="polylineAnnotation",this.svgElementName="svg:polyline"}render(){this.container.classList.add(this.containerClassName);const{data:{rect:t,vertices:s,borderStyle:i,popupRef:n}}=this;if(!s)return this.container;const{width:r,height:a}=mi(t),h=this.svgFactory.create(r,a,!0);let l=[];for(let d=0,p=s.length;d<p;d+=2){const f=s[d]-t[0],g=t[3]-s[d+1];l.push(`${f},${g}`)}l=l.join(" ");const c=w(this,No,this.svgFactory.createElement(this.svgElementName));return c.setAttribute("points",l),c.setAttribute("stroke-width",i.width||1),c.setAttribute("stroke","transparent"),c.setAttribute("fill","transparent"),h.append(c),this.container.append(h),!n&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return o(this,No)}addHighlightArea(){this.container.classList.add("highlightArea")}}No=new WeakMap;class wm extends df{constructor(e){super(e),this.containerClassName="polygonAnnotation",this.svgElementName="svg:polygon"}}class Em extends jt{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0})}render(){return this.container.classList.add("caretAnnotation"),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container}}var Bo;class uf extends jt{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0});S(this,Bo,[]);this.containerClassName="inkAnnotation",this.svgElementName="svg:polyline",this.annotationEditorType=wt.INK}render(){this.container.classList.add(this.containerClassName);const{data:{rect:t,inkLists:s,borderStyle:i,popupRef:n}}=this,{width:r,height:a}=mi(t),h=this.svgFactory.create(r,a,!0);for(const l of s){let c=[];for(let p=0,f=l.length;p<f;p+=2){const g=l[p]-t[0],m=t[3]-l[p+1];c.push(`${g},${m}`)}c=c.join(" ");const d=this.svgFactory.createElement(this.svgElementName);o(this,Bo).push(d),d.setAttribute("points",c),d.setAttribute("stroke-width",i.width||1),d.setAttribute("stroke","transparent"),d.setAttribute("fill","transparent"),!n&&this.hasPopupData&&this._createPopup(),h.append(d)}return this.container.append(h),this.container}getElementsToTriggerPopup(){return o(this,Bo)}addHighlightArea(){this.container.classList.add("highlightArea")}}Bo=new WeakMap;class Sm extends jt{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("highlightAnnotation"),this.container}}class xm extends jt{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("underlineAnnotation"),this.container}}class Cm extends jt{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("squigglyAnnotation"),this.container}}class km extends jt{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("strikeoutAnnotation"),this.container}}class ff extends jt{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0})}render(){return this.container.classList.add("stampAnnotation"),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container}}var zo,Ho,Fc;class Tm extends jt{constructor(t){var i;super(t,{isRenderable:!0});S(this,Ho);S(this,zo,null);const{file:s}=this.data;this.filename=s.filename,this.content=s.content,(i=this.linkService.eventBus)==null||i.dispatch("fileattachmentannotation",{source:this,...s})}render(){this.container.classList.add("fileAttachmentAnnotation");const{container:t,data:s}=this;let i;s.hasAppearance||s.fillAlpha===0?i=document.createElement("div"):(i=document.createElement("img"),i.src=`${this.imageResourcesPath}annotation-${/paperclip/i.test(s.name)?"paperclip":"pushpin"}.svg`,s.fillAlpha&&s.fillAlpha<1&&(i.style=`filter: opacity(${Math.round(s.fillAlpha*100)}%);`)),i.addEventListener("dblclick",E(this,Ho,Fc).bind(this)),w(this,zo,i);const{isMac:n}=ke.platform;return t.addEventListener("keydown",r=>{r.key==="Enter"&&(n?r.metaKey:r.ctrlKey)&&E(this,Ho,Fc).call(this)}),!s.popupRef&&this.hasPopupData?this._createPopup():i.classList.add("popupTriggerArea"),t.append(i),t}getElementsToTriggerPopup(){return o(this,zo)}addHighlightArea(){this.container.classList.add("highlightArea")}}zo=new WeakMap,Ho=new WeakSet,Fc=function(){var t;(t=this.downloadManager)==null||t.openOrDownloadData(this.content,this.filename)};var Uo,Fn,$r,tr,pf,Dc;class Rm{constructor({div:e,accessibilityManager:t,annotationCanvasMap:s,annotationEditorUIManager:i,page:n,viewport:r}){S(this,tr);S(this,Uo,null);S(this,Fn,null);S(this,$r,new Map);this.div=e,w(this,Uo,t),w(this,Fn,s),this.page=n,this.viewport=r,this.zIndex=0,this._annotationEditorUIManager=i}async render(e){var r;const{annotations:t}=e,s=this.div;Zn(s,this.viewport);const i=new Map,n={data:null,layer:s,linkService:e.linkService,downloadManager:e.downloadManager,imageResourcesPath:e.imageResourcesPath||"",renderForms:e.renderForms!==!1,svgFactory:new ud,annotationStorage:e.annotationStorage||new bd,enableScripting:e.enableScripting===!0,hasJSActions:e.hasJSActions,fieldObjects:e.fieldObjects,parent:this,elements:null};for(const a of t){if(a.noHTML)continue;const h=a.annotationType===qt.POPUP;if(h){const d=i.get(a.id);if(!d)continue;n.elements=d}else{const{width:d,height:p}=mi(a.rect);if(d<=0||p<=0)continue}n.data=a;const l=dm.create(n);if(!l.isRenderable)continue;if(!h&&a.popupRef){const d=i.get(a.popupRef);d?d.push(l):i.set(a.popupRef,[l])}const c=l.render();a.hidden&&(c.style.visibility="hidden"),E(this,tr,pf).call(this,c,a.id),l.annotationEditorType>0&&(o(this,$r).set(l.data.id,l),(r=this._annotationEditorUIManager)==null||r.renderAnnotationElement(l))}E(this,tr,Dc).call(this)}update({viewport:e}){const t=this.div;this.viewport=e,Zn(t,{rotation:e.rotation}),E(this,tr,Dc).call(this),t.hidden=!1}getEditableAnnotations(){return Array.from(o(this,$r).values())}getEditableAnnotation(e){return o(this,$r).get(e)}}Uo=new WeakMap,Fn=new WeakMap,$r=new WeakMap,tr=new WeakSet,pf=function(e,t){var i;const s=e.firstChild||e;s.id=`${ru}${t}`,this.div.append(e),(i=o(this,Uo))==null||i.moveElementInDOM(this.div,e,s,!1)},Dc=function(){if(!o(this,Fn))return;const e=this.div;for(const[t,s]of o(this,Fn)){const i=e.querySelector(`[data-annotation-id="${t}"]`);if(!i)continue;s.className="annotationContent";const{firstChild:n}=i;n?n.nodeName==="CANVAS"?n.replaceWith(s):n.classList.contains("annotationContent")?n.after(s):n.before(s):i.append(s)}o(this,Fn).clear()};const Ph=/\r\n?|\n/g;var jo,Wo,Go,$o,Vo,ls,Ne,qo,Be,Vr,$t,gf,mf,bf,$h,_i,Vh,qh,_f,Nc,vf;const Dt=class Dt extends kt{constructor(t){super({...t,name:"freeTextEditor"});S(this,$t);S(this,jo,this.editorDivBlur.bind(this));S(this,Wo,this.editorDivFocus.bind(this));S(this,Go,this.editorDivInput.bind(this));S(this,$o,this.editorDivKeydown.bind(this));S(this,Vo,this.editorDivPaste.bind(this));S(this,ls);S(this,Ne,"");S(this,qo,`${this.id}-editor`);S(this,Be);S(this,Vr,null);w(this,ls,t.color||Dt._defaultColor||kt._defaultLineColor),w(this,Be,t.fontSize||Dt._defaultFontSize)}static get _keyboardManager(){const t=Dt.prototype,s=r=>r.isEmpty(),i=Qn.TRANSLATE_SMALL,n=Qn.TRANSLATE_BIG;return Et(this,"_keyboardManager",new _h([[["ctrl+s","mac+meta+s","ctrl+p","mac+meta+p"],t.commitOrRemove,{bubbles:!0}],[["ctrl+Enter","mac+meta+Enter","Escape","mac+Escape"],t.commitOrRemove],[["ArrowLeft","mac+ArrowLeft"],t._translateEmpty,{args:[-i,0],checker:s}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],t._translateEmpty,{args:[-n,0],checker:s}],[["ArrowRight","mac+ArrowRight"],t._translateEmpty,{args:[i,0],checker:s}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],t._translateEmpty,{args:[n,0],checker:s}],[["ArrowUp","mac+ArrowUp"],t._translateEmpty,{args:[0,-i],checker:s}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],t._translateEmpty,{args:[0,-n],checker:s}],[["ArrowDown","mac+ArrowDown"],t._translateEmpty,{args:[0,i],checker:s}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],t._translateEmpty,{args:[0,n],checker:s}]]))}static initialize(t,s){kt.initialize(t,s,{strings:["pdfjs-free-text-default-content"]});const i=getComputedStyle(document.documentElement);this._internalPadding=parseFloat(i.getPropertyValue("--freetext-padding"))}static updateDefaultParams(t,s){switch(t){case ut.FREETEXT_SIZE:Dt._defaultFontSize=s;break;case ut.FREETEXT_COLOR:Dt._defaultColor=s;break}}updateParams(t,s){switch(t){case ut.FREETEXT_SIZE:E(this,$t,gf).call(this,s);break;case ut.FREETEXT_COLOR:E(this,$t,mf).call(this,s);break}}static get defaultPropertiesToUpdate(){return[[ut.FREETEXT_SIZE,Dt._defaultFontSize],[ut.FREETEXT_COLOR,Dt._defaultColor||kt._defaultLineColor]]}get propertiesToUpdate(){return[[ut.FREETEXT_SIZE,o(this,Be)],[ut.FREETEXT_COLOR,o(this,ls)]]}_translateEmpty(t,s){this._uiManager.translateSelectedEditors(t,s,!0)}getInitialTranslation(){const t=this.parentScale;return[-Dt._internalPadding*t,-(Dt._internalPadding+o(this,Be))*t]}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(this.isAttachedToDOM||this.parent.add(this)))}enableEditMode(){if(this.isInEditMode())return;this.parent.setEditingState(!1),this.parent.updateToolbar(wt.FREETEXT),super.enableEditMode(),this.overlayDiv.classList.remove("enabled"),this.editorDiv.contentEditable=!0,this._isDraggable=!1,this.div.removeAttribute("aria-activedescendant");const t=this._uiManager._signal;this.editorDiv.addEventListener("keydown",o(this,$o),{signal:t}),this.editorDiv.addEventListener("focus",o(this,Wo),{signal:t}),this.editorDiv.addEventListener("blur",o(this,jo),{signal:t}),this.editorDiv.addEventListener("input",o(this,Go),{signal:t}),this.editorDiv.addEventListener("paste",o(this,Vo),{signal:t})}disableEditMode(){this.isInEditMode()&&(this.parent.setEditingState(!0),super.disableEditMode(),this.overlayDiv.classList.add("enabled"),this.editorDiv.contentEditable=!1,this.div.setAttribute("aria-activedescendant",o(this,qo)),this._isDraggable=!0,this.editorDiv.removeEventListener("keydown",o(this,$o)),this.editorDiv.removeEventListener("focus",o(this,Wo)),this.editorDiv.removeEventListener("blur",o(this,jo)),this.editorDiv.removeEventListener("input",o(this,Go)),this.editorDiv.removeEventListener("paste",o(this,Vo)),this.div.focus({preventScroll:!0}),this.isEditing=!1,this.parent.div.classList.add("freetextEditing"))}focusin(t){this._focusEventsAllowed&&(super.focusin(t),t.target!==this.editorDiv&&this.editorDiv.focus())}onceAdded(){var t;this.width||(this.enableEditMode(),this.editorDiv.focus(),(t=this._initialOptions)!=null&&t.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();const t=o(this,Ne),s=w(this,Ne,E(this,$t,bf).call(this).trimEnd());if(t===s)return;const i=n=>{if(w(this,Ne,n),!n){this.remove();return}E(this,$t,qh).call(this),this._uiManager.rebuild(this),E(this,$t,$h).call(this)};this.addCommands({cmd:()=>{i(s)},undo:()=>{i(t)},mustExec:!1}),E(this,$t,$h).call(this)}shouldGetKeyboardEvents(){return this.isInEditMode()}enterInEditMode(){this.enableEditMode(),this.editorDiv.focus()}dblclick(t){this.enterInEditMode()}keydown(t){t.target===this.div&&t.key==="Enter"&&(this.enterInEditMode(),t.preventDefault())}editorDivKeydown(t){Dt._keyboardManager.exec(this,t)}editorDivFocus(t){this.isEditing=!0}editorDivBlur(t){this.isEditing=!1}editorDivInput(t){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)}render(){if(this.div)return this.div;let t,s;this.width&&(t=this.x,s=this.y),super.render(),this.editorDiv=document.createElement("div"),this.editorDiv.className="internal",this.editorDiv.setAttribute("id",o(this,qo)),this.editorDiv.setAttribute("data-l10n-id","pdfjs-free-text"),this.enableEditing(),kt._l10nPromise.get("pdfjs-free-text-default-content").then(n=>{var r;return(r=this.editorDiv)==null?void 0:r.setAttribute("default-content",n)}),this.editorDiv.contentEditable=!0;const{style:i}=this.editorDiv;if(i.fontSize=`calc(${o(this,Be)}px * var(--scale-factor))`,i.color=o(this,ls),this.div.append(this.editorDiv),this.overlayDiv=document.createElement("div"),this.overlayDiv.classList.add("overlay","enabled"),this.div.append(this.overlayDiv),nl(this,this.div,["dblclick","keydown"]),this.width){const[n,r]=this.parentDimensions;if(this.annotationElementId){const{position:a}=o(this,Vr);let[h,l]=this.getInitialTranslation();[h,l]=this.pageTranslationToScreen(h,l);const[c,d]=this.pageDimensions,[p,f]=this.pageTranslation;let g,m;switch(this.rotation){case 0:g=t+(a[0]-p)/c,m=s+this.height-(a[1]-f)/d;break;case 90:g=t+(a[0]-p)/c,m=s-(a[1]-f)/d,[h,l]=[l,-h];break;case 180:g=t-this.width+(a[0]-p)/c,m=s-(a[1]-f)/d,[h,l]=[-h,-l];break;case 270:g=t+(a[0]-p-this.height*d)/c,m=s+(a[1]-f-this.width*c)/d,[h,l]=[-l,h];break}this.setAt(g*n,m*r,h,l)}else this.setAt(t*n,s*r,this.width*n,this.height*r);E(this,$t,qh).call(this),this._isDraggable=!0,this.editorDiv.contentEditable=!1}else this._isDraggable=!1,this.editorDiv.contentEditable=!0;return this.div}editorDivPaste(t){var g,m,v;const s=t.clipboardData||window.clipboardData,{types:i}=s;if(i.length===1&&i[0]==="text/plain")return;t.preventDefault();const n=E(g=Dt,_i,Nc).call(g,s.getData("text")||"").replaceAll(Ph,`
| `);if(!n)return;const r=window.getSelection();if(!r.rangeCount)return;this.editorDiv.normalize(),r.deleteFromDocument();const a=r.getRangeAt(0);if(!n.includes(`
| `)){a.insertNode(document.createTextNode(n)),this.editorDiv.normalize(),r.collapseToStart();return}const{startContainer:h,startOffset:l}=a,c=[],d=[];if(h.nodeType===Node.TEXT_NODE){const b=h.parentElement;if(d.push(h.nodeValue.slice(l).replaceAll(Ph,"")),b!==this.editorDiv){let A=c;for(const x of this.editorDiv.childNodes){if(x===b){A=d;continue}A.push(E(m=Dt,_i,Vh).call(m,x))}}c.push(h.nodeValue.slice(0,l).replaceAll(Ph,""))}else if(h===this.editorDiv){let b=c,A=0;for(const x of this.editorDiv.childNodes)A++===l&&(b=d),b.push(E(v=Dt,_i,Vh).call(v,x))}w(this,Ne,`${c.join(`
| `)}${n}${d.join(`
| `)}`),E(this,$t,qh).call(this);const p=new Range;let f=c.reduce((b,A)=>b+A.length,0);for(const{firstChild:b}of this.editorDiv.childNodes)if(b.nodeType===Node.TEXT_NODE){const A=b.nodeValue.length;if(f<=A){p.setStart(b,f),p.setEnd(b,f);break}f-=A}r.removeAllRanges(),r.addRange(p)}get contentDiv(){return this.editorDiv}static deserialize(t,s,i){var a;let n=null;if(t instanceof cf){const{data:{defaultAppearanceData:{fontSize:h,fontColor:l},rect:c,rotation:d,id:p},textContent:f,textPosition:g,parent:{page:{pageNumber:m}}}=t;if(!f||f.length===0)return null;n=t={annotationType:wt.FREETEXT,color:Array.from(l),fontSize:h,value:f.join(`
| `),position:g,pageIndex:m-1,rect:c.slice(0),rotation:d,id:p,deleted:!1}}const r=super.deserialize(t,s,i);return w(r,Be,t.fontSize),w(r,ls,at.makeHexColor(...t.color)),w(r,Ne,E(a=Dt,_i,Nc).call(a,t.value)),r.annotationElementId=t.id||null,w(r,Vr,n),r}serialize(t=!1){if(this.isEmpty())return null;if(this.deleted)return{pageIndex:this.pageIndex,id:this.annotationElementId,deleted:!0};const s=Dt._internalPadding*this.parentScale,i=this.getRect(s,s),n=kt._colorManager.convert(this.isAttachedToDOM?getComputedStyle(this.editorDiv).color:o(this,ls)),r={annotationType:wt.FREETEXT,color:n,fontSize:o(this,Be),value:E(this,$t,_f).call(this),pageIndex:this.pageIndex,rect:i,rotation:this.rotation,structTreeParentId:this._structTreeParentId};return t?r:this.annotationElementId&&!E(this,$t,vf).call(this,r)?null:(r.id=this.annotationElementId,r)}renderAnnotationElement(t){const s=super.renderAnnotationElement(t);if(this.deleted)return s;const{style:i}=s;i.fontSize=`calc(${o(this,Be)}px * var(--scale-factor))`,i.color=o(this,ls),s.replaceChildren();for(const r of o(this,Ne).split(`
| `)){const a=document.createElement("div");a.append(r?document.createTextNode(r):document.createElement("br")),s.append(a)}const n=Dt._internalPadding*this.parentScale;return t.updateEdited({rect:this.getRect(n,n),popupContent:o(this,Ne)}),s}resetAnnotationElement(t){super.resetAnnotationElement(t),t.resetEdited()}};jo=new WeakMap,Wo=new WeakMap,Go=new WeakMap,$o=new WeakMap,Vo=new WeakMap,ls=new WeakMap,Ne=new WeakMap,qo=new WeakMap,Be=new WeakMap,Vr=new WeakMap,$t=new WeakSet,gf=function(t){const s=n=>{this.editorDiv.style.fontSize=`calc(${n}px * var(--scale-factor))`,this.translate(0,-(n-o(this,Be))*this.parentScale),w(this,Be,n),E(this,$t,$h).call(this)},i=o(this,Be);this.addCommands({cmd:s.bind(this,t),undo:s.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:ut.FREETEXT_SIZE,overwriteIfSameType:!0,keepUndo:!0})},mf=function(t){const s=n=>{w(this,ls,this.editorDiv.style.color=n)},i=o(this,ls);this.addCommands({cmd:s.bind(this,t),undo:s.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:ut.FREETEXT_COLOR,overwriteIfSameType:!0,keepUndo:!0})},bf=function(){var s;const t=[];this.editorDiv.normalize();for(const i of this.editorDiv.childNodes)t.push(E(s=Dt,_i,Vh).call(s,i));return t.join(`
| `)},$h=function(){const[t,s]=this.parentDimensions;let i;if(this.isAttachedToDOM)i=this.div.getBoundingClientRect();else{const{currentLayer:n,div:r}=this,a=r.style.display,h=r.classList.contains("hidden");r.classList.remove("hidden"),r.style.display="hidden",n.div.append(this.div),i=r.getBoundingClientRect(),r.remove(),r.style.display=a,r.classList.toggle("hidden",h)}this.rotation%180===this.parentRotation%180?(this.width=i.width/t,this.height=i.height/s):(this.width=i.height/t,this.height=i.width/s),this.fixAndSetPosition()},_i=new WeakSet,Vh=function(t){return(t.nodeType===Node.TEXT_NODE?t.nodeValue:t.innerText).replaceAll(Ph,"")},qh=function(){if(this.editorDiv.replaceChildren(),!!o(this,Ne))for(const t of o(this,Ne).split(`
| `)){const s=document.createElement("div");s.append(t?document.createTextNode(t):document.createElement("br")),this.editorDiv.append(s)}},_f=function(){return o(this,Ne).replaceAll(" "," ")},Nc=function(t){return t.replaceAll(" "," ")},vf=function(t){const{value:s,fontSize:i,color:n,pageIndex:r}=o(this,Vr);return this._hasBeenMoved||t.value!==s||t.fontSize!==i||t.color.some((a,h)=>a!==n[h])||t.pageIndex!==r},S(Dt,_i),ft(Dt,"_freeTextDefaultContent",""),ft(Dt,"_internalPadding",0),ft(Dt,"_defaultColor",null),ft(Dt,"_defaultFontSize",10),ft(Dt,"_type","freetext"),ft(Dt,"_editorType",wt.FREETEXT);let Oc=Dt;var Xo,Ni,cs,we,yf,Xh,Af,wf,zc;class Bc{constructor(e,t=0,s=0,i=!0){S(this,we);S(this,Xo);S(this,Ni,[]);S(this,cs,[]);let n=1/0,r=-1/0,a=1/0,h=-1/0;const c=10**-4;for(const{x:b,y:A,width:x,height:k}of e){const T=Math.floor((b-t)/c)*c,L=Math.ceil((b+x+t)/c)*c,I=Math.floor((A-t)/c)*c,B=Math.ceil((A+k+t)/c)*c,D=[T,I,B,!0],W=[L,I,B,!1];o(this,Ni).push(D,W),n=Math.min(n,T),r=Math.max(r,L),a=Math.min(a,I),h=Math.max(h,B)}const d=r-n+2*s,p=h-a+2*s,f=n-s,g=a-s,m=o(this,Ni).at(i?-1:-2),v=[m[0],m[2]];for(const b of o(this,Ni)){const[A,x,k]=b;b[0]=(A-f)/d,b[1]=(x-g)/p,b[2]=(k-g)/p}w(this,Xo,{x:f,y:g,width:d,height:p,lastPoint:v})}getOutlines(){o(this,Ni).sort((t,s)=>t[0]-s[0]||t[1]-s[1]||t[2]-s[2]);const e=[];for(const t of o(this,Ni))t[3]?(e.push(...E(this,we,zc).call(this,t)),E(this,we,Af).call(this,t)):(E(this,we,wf).call(this,t),e.push(...E(this,we,zc).call(this,t)));return E(this,we,yf).call(this,e)}}Xo=new WeakMap,Ni=new WeakMap,cs=new WeakMap,we=new WeakSet,yf=function(e){const t=[],s=new Set;for(const r of e){const[a,h,l]=r;t.push([a,h,r],[a,l,r])}t.sort((r,a)=>r[1]-a[1]||r[0]-a[0]);for(let r=0,a=t.length;r<a;r+=2){const h=t[r][2],l=t[r+1][2];h.push(l),l.push(h),s.add(h),s.add(l)}const i=[];let n;for(;s.size>0;){const r=s.values().next().value;let[a,h,l,c,d]=r;s.delete(r);let p=a,f=h;for(n=[a,l],i.push(n);;){let g;if(s.has(c))g=c;else if(s.has(d))g=d;else break;s.delete(g),[a,h,l,c,d]=g,p!==a&&(n.push(p,f,a,f===h?h:l),p=a),f=f===h?l:h}n.push(p,f)}return new Pm(i,o(this,Xo))},Xh=function(e){const t=o(this,cs);let s=0,i=t.length-1;for(;s<=i;){const n=s+i>>1,r=t[n][0];if(r===e)return n;r<e?s=n+1:i=n-1}return i+1},Af=function([,e,t]){const s=E(this,we,Xh).call(this,e);o(this,cs).splice(s,0,[e,t])},wf=function([,e,t]){const s=E(this,we,Xh).call(this,e);for(let i=s;i<o(this,cs).length;i++){const[n,r]=o(this,cs)[i];if(n!==e)break;if(n===e&&r===t){o(this,cs).splice(i,1);return}}for(let i=s-1;i>=0;i--){const[n,r]=o(this,cs)[i];if(n!==e)break;if(n===e&&r===t){o(this,cs).splice(i,1);return}}},zc=function(e){const[t,s,i]=e,n=[[t,s,i]],r=E(this,we,Xh).call(this,i);for(let a=0;a<r;a++){const[h,l]=o(this,cs)[a];for(let c=0,d=n.length;c<d;c++){const[,p,f]=n[c];if(!(l<=p||f<=h)){if(p>=h){if(f>l)n[c][1]=l;else{if(d===1)return[];n.splice(c,1),c--,d--}continue}n[c][2]=h,f>l&&n.push([t,l,f])}}}return n};class Ef{toSVGPath(){throw new Error("Abstract method `toSVGPath` must be implemented.")}get box(){throw new Error("Abstract getter `box` must be implemented.")}serialize(e,t){throw new Error("Abstract method `serialize` must be implemented.")}get free(){return this instanceof Uc}}var Yo,qr;class Pm extends Ef{constructor(t,s){super();S(this,Yo);S(this,qr);w(this,qr,t),w(this,Yo,s)}toSVGPath(){const t=[];for(const s of o(this,qr)){let[i,n]=s;t.push(`M${i} ${n}`);for(let r=2;r<s.length;r+=2){const a=s[r],h=s[r+1];a===i?(t.push(`V${h}`),n=h):h===n&&(t.push(`H${a}`),i=a)}t.push("Z")}return t.join(" ")}serialize([t,s,i,n],r){const a=[],h=i-t,l=n-s;for(const c of o(this,qr)){const d=new Array(c.length);for(let p=0;p<c.length;p+=2)d[p]=t+c[p]*h,d[p+1]=n-c[p+1]*l;a.push(d)}return a}get box(){return o(this,Yo)}}Yo=new WeakMap,qr=new WeakMap;var Cs,ai,Xr,Yr,ks,yt,Dn,On,Ko,Zo,Kr,Zr,Bi,Qo,Cl,kl,Jo,Hc;const js=class js{constructor({x:e,y:t},s,i,n,r,a=0){S(this,Jo);S(this,Cs);S(this,ai,[]);S(this,Xr);S(this,Yr);S(this,ks,[]);S(this,yt,new Float64Array(18));S(this,Dn);S(this,On);S(this,Ko);S(this,Zo);S(this,Kr);S(this,Zr);S(this,Bi,[]);w(this,Cs,s),w(this,Zr,n*i),w(this,Yr,r),o(this,yt).set([NaN,NaN,NaN,NaN,e,t],6),w(this,Xr,a),w(this,Zo,o(js,Qo)*i),w(this,Ko,o(js,kl)*i),w(this,Kr,i),o(this,Bi).push(e,t)}get free(){return!0}isEmpty(){return isNaN(o(this,yt)[8])}add({x:e,y:t}){var D;w(this,Dn,e),w(this,On,t);const[s,i,n,r]=o(this,Cs);let[a,h,l,c]=o(this,yt).subarray(8,12);const d=e-l,p=t-c,f=Math.hypot(d,p);if(f<o(this,Ko))return!1;const g=f-o(this,Zo),m=g/f,v=m*d,b=m*p;let A=a,x=h;a=l,h=c,l+=v,c+=b,(D=o(this,Bi))==null||D.push(e,t);const k=-b/g,T=v/g,L=k*o(this,Zr),I=T*o(this,Zr);return o(this,yt).set(o(this,yt).subarray(2,8),0),o(this,yt).set([l+L,c+I],4),o(this,yt).set(o(this,yt).subarray(14,18),12),o(this,yt).set([l-L,c-I],16),isNaN(o(this,yt)[6])?(o(this,ks).length===0&&(o(this,yt).set([a+L,h+I],2),o(this,ks).push(NaN,NaN,NaN,NaN,(a+L-s)/n,(h+I-i)/r),o(this,yt).set([a-L,h-I],14),o(this,ai).push(NaN,NaN,NaN,NaN,(a-L-s)/n,(h-I-i)/r)),o(this,yt).set([A,x,a,h,l,c],6),!this.isEmpty()):(o(this,yt).set([A,x,a,h,l,c],6),Math.abs(Math.atan2(x-h,A-a)-Math.atan2(b,v))<Math.PI/2?([a,h,l,c]=o(this,yt).subarray(2,6),o(this,ks).push(NaN,NaN,NaN,NaN,((a+l)/2-s)/n,((h+c)/2-i)/r),[a,h,A,x]=o(this,yt).subarray(14,18),o(this,ai).push(NaN,NaN,NaN,NaN,((A+a)/2-s)/n,((x+h)/2-i)/r),!0):([A,x,a,h,l,c]=o(this,yt).subarray(0,6),o(this,ks).push(((A+5*a)/6-s)/n,((x+5*h)/6-i)/r,((5*a+l)/6-s)/n,((5*h+c)/6-i)/r,((a+l)/2-s)/n,((h+c)/2-i)/r),[l,c,a,h,A,x]=o(this,yt).subarray(12,18),o(this,ai).push(((A+5*a)/6-s)/n,((x+5*h)/6-i)/r,((5*a+l)/6-s)/n,((5*h+c)/6-i)/r,((a+l)/2-s)/n,((h+c)/2-i)/r),!0))}toSVGPath(){if(this.isEmpty())return"";const e=o(this,ks),t=o(this,ai),s=o(this,yt).subarray(4,6),i=o(this,yt).subarray(16,18),[n,r,a,h]=o(this,Cs),[l,c,d,p]=E(this,Jo,Hc).call(this);if(isNaN(o(this,yt)[6])&&!this.isEmpty())return`M${(o(this,yt)[2]-n)/a} ${(o(this,yt)[3]-r)/h} L${(o(this,yt)[4]-n)/a} ${(o(this,yt)[5]-r)/h} L${l} ${c} L${d} ${p} L${(o(this,yt)[16]-n)/a} ${(o(this,yt)[17]-r)/h} L${(o(this,yt)[14]-n)/a} ${(o(this,yt)[15]-r)/h} Z`;const f=[];f.push(`M${e[4]} ${e[5]}`);for(let g=6;g<e.length;g+=6)isNaN(e[g])?f.push(`L${e[g+4]} ${e[g+5]}`):f.push(`C${e[g]} ${e[g+1]} ${e[g+2]} ${e[g+3]} ${e[g+4]} ${e[g+5]}`);f.push(`L${(s[0]-n)/a} ${(s[1]-r)/h} L${l} ${c} L${d} ${p} L${(i[0]-n)/a} ${(i[1]-r)/h}`);for(let g=t.length-6;g>=6;g-=6)isNaN(t[g])?f.push(`L${t[g+4]} ${t[g+5]}`):f.push(`C${t[g]} ${t[g+1]} ${t[g+2]} ${t[g+3]} ${t[g+4]} ${t[g+5]}`);return f.push(`L${t[4]} ${t[5]} Z`),f.join(" ")}getOutlines(){var b;const e=o(this,ks),t=o(this,ai),s=o(this,yt),i=s.subarray(4,6),n=s.subarray(16,18),[r,a,h,l]=o(this,Cs),c=new Float64Array((((b=o(this,Bi))==null?void 0:b.length)??0)+2);for(let A=0,x=c.length-2;A<x;A+=2)c[A]=(o(this,Bi)[A]-r)/h,c[A+1]=(o(this,Bi)[A+1]-a)/l;c[c.length-2]=(o(this,Dn)-r)/h,c[c.length-1]=(o(this,On)-a)/l;const[d,p,f,g]=E(this,Jo,Hc).call(this);if(isNaN(s[6])&&!this.isEmpty()){const A=new Float64Array(36);return A.set([NaN,NaN,NaN,NaN,(s[2]-r)/h,(s[3]-a)/l,NaN,NaN,NaN,NaN,(s[4]-r)/h,(s[5]-a)/l,NaN,NaN,NaN,NaN,d,p,NaN,NaN,NaN,NaN,f,g,NaN,NaN,NaN,NaN,(s[16]-r)/h,(s[17]-a)/l,NaN,NaN,NaN,NaN,(s[14]-r)/h,(s[15]-a)/l],0),new Uc(A,c,o(this,Cs),o(this,Kr),o(this,Xr),o(this,Yr))}const m=new Float64Array(o(this,ks).length+24+o(this,ai).length);let v=e.length;for(let A=0;A<v;A+=2){if(isNaN(e[A])){m[A]=m[A+1]=NaN;continue}m[A]=e[A],m[A+1]=e[A+1]}m.set([NaN,NaN,NaN,NaN,(i[0]-r)/h,(i[1]-a)/l,NaN,NaN,NaN,NaN,d,p,NaN,NaN,NaN,NaN,f,g,NaN,NaN,NaN,NaN,(n[0]-r)/h,(n[1]-a)/l],v),v+=24;for(let A=t.length-6;A>=6;A-=6)for(let x=0;x<6;x+=2){if(isNaN(t[A+x])){m[v]=m[v+1]=NaN,v+=2;continue}m[v]=t[A+x],m[v+1]=t[A+x+1],v+=2}return m.set([NaN,NaN,NaN,NaN,t[4],t[5]],v),new Uc(m,c,o(this,Cs),o(this,Kr),o(this,Xr),o(this,Yr))}};Cs=new WeakMap,ai=new WeakMap,Xr=new WeakMap,Yr=new WeakMap,ks=new WeakMap,yt=new WeakMap,Dn=new WeakMap,On=new WeakMap,Ko=new WeakMap,Zo=new WeakMap,Kr=new WeakMap,Zr=new WeakMap,Bi=new WeakMap,Qo=new WeakMap,Cl=new WeakMap,kl=new WeakMap,Jo=new WeakSet,Hc=function(){const e=o(this,yt).subarray(4,6),t=o(this,yt).subarray(16,18),[s,i,n,r]=o(this,Cs);return[(o(this,Dn)+(e[0]-t[0])/2-s)/n,(o(this,On)+(e[1]-t[1])/2-i)/r,(o(this,Dn)+(t[0]-e[0])/2-s)/n,(o(this,On)+(t[1]-e[1])/2-i)/r]},S(js,Qo,8),S(js,Cl,2),S(js,kl,o(js,Qo)+o(js,Cl));let ol=js;var Qr,Nn,oi,th,ze,eh,Ut,Te,ka,Ta,Sf;class Uc extends Ef{constructor(t,s,i,n,r,a){super();S(this,Te);S(this,Qr);S(this,Nn,null);S(this,oi);S(this,th);S(this,ze);S(this,eh);S(this,Ut);w(this,Ut,t),w(this,ze,s),w(this,Qr,i),w(this,eh,n),w(this,oi,r),w(this,th,a),E(this,Te,Sf).call(this,a);const{x:h,y:l,width:c,height:d}=o(this,Nn);for(let p=0,f=t.length;p<f;p+=2)t[p]=(t[p]-h)/c,t[p+1]=(t[p+1]-l)/d;for(let p=0,f=s.length;p<f;p+=2)s[p]=(s[p]-h)/c,s[p+1]=(s[p+1]-l)/d}toSVGPath(){const t=[`M${o(this,Ut)[4]} ${o(this,Ut)[5]}`];for(let s=6,i=o(this,Ut).length;s<i;s+=6){if(isNaN(o(this,Ut)[s])){t.push(`L${o(this,Ut)[s+4]} ${o(this,Ut)[s+5]}`);continue}t.push(`C${o(this,Ut)[s]} ${o(this,Ut)[s+1]} ${o(this,Ut)[s+2]} ${o(this,Ut)[s+3]} ${o(this,Ut)[s+4]} ${o(this,Ut)[s+5]}`)}return t.push("Z"),t.join(" ")}serialize([t,s,i,n],r){const a=i-t,h=n-s;let l,c;switch(r){case 0:l=E(this,Te,ka).call(this,o(this,Ut),t,n,a,-h),c=E(this,Te,ka).call(this,o(this,ze),t,n,a,-h);break;case 90:l=E(this,Te,Ta).call(this,o(this,Ut),t,s,a,h),c=E(this,Te,Ta).call(this,o(this,ze),t,s,a,h);break;case 180:l=E(this,Te,ka).call(this,o(this,Ut),i,s,-a,h),c=E(this,Te,ka).call(this,o(this,ze),i,s,-a,h);break;case 270:l=E(this,Te,Ta).call(this,o(this,Ut),i,n,-a,-h),c=E(this,Te,Ta).call(this,o(this,ze),i,n,-a,-h);break}return{outline:Array.from(l),points:[Array.from(c)]}}get box(){return o(this,Nn)}getNewOutline(t,s){const{x:i,y:n,width:r,height:a}=o(this,Nn),[h,l,c,d]=o(this,Qr),p=r*c,f=a*d,g=i*c+h,m=n*d+l,v=new ol({x:o(this,ze)[0]*p+g,y:o(this,ze)[1]*f+m},o(this,Qr),o(this,eh),t,o(this,th),s??o(this,oi));for(let b=2;b<o(this,ze).length;b+=2)v.add({x:o(this,ze)[b]*p+g,y:o(this,ze)[b+1]*f+m});return v.getOutlines()}}Qr=new WeakMap,Nn=new WeakMap,oi=new WeakMap,th=new WeakMap,ze=new WeakMap,eh=new WeakMap,Ut=new WeakMap,Te=new WeakSet,ka=function(t,s,i,n,r){const a=new Float64Array(t.length);for(let h=0,l=t.length;h<l;h+=2)a[h]=s+t[h]*n,a[h+1]=i+t[h+1]*r;return a},Ta=function(t,s,i,n,r){const a=new Float64Array(t.length);for(let h=0,l=t.length;h<l;h+=2)a[h]=s+t[h+1]*n,a[h+1]=i+t[h]*r;return a},Sf=function(t){const s=o(this,Ut);let i=s[4],n=s[5],r=i,a=n,h=i,l=n,c=i,d=n;const p=t?Math.max:Math.min;for(let b=6,A=s.length;b<A;b+=6){if(isNaN(s[b]))r=Math.min(r,s[b+4]),a=Math.min(a,s[b+5]),h=Math.max(h,s[b+4]),l=Math.max(l,s[b+5]),d<s[b+5]?(c=s[b+4],d=s[b+5]):d===s[b+5]&&(c=p(c,s[b+4]));else{const x=at.bezierBoundingBox(i,n,...s.slice(b,b+6));r=Math.min(r,x[0]),a=Math.min(a,x[1]),h=Math.max(h,x[2]),l=Math.max(l,x[3]),d<x[3]?(c=x[2],d=x[3]):d===x[3]&&(c=p(c,x[2]))}i=s[b+4],n=s[b+5]}const f=r-o(this,oi),g=a-o(this,oi),m=h-r+2*o(this,oi),v=l-a+2*o(this,oi);w(this,Nn,{x:f,y:g,width:m,height:v,lastPoint:[c,d]})};var sh,ih,ds,Bn,Jr,Yt,nh,ta,rh,ah,us,ea,Mt,jc,Wc,xf,Zi,Cf,Ei;const Ws=class Ws{constructor({editor:e=null,uiManager:t=null}){S(this,Mt);S(this,sh,E(this,Mt,xf).bind(this));S(this,ih,E(this,Mt,Cf).bind(this));S(this,ds,null);S(this,Bn,null);S(this,Jr);S(this,Yt,null);S(this,nh,!1);S(this,ta,!1);S(this,rh,null);S(this,ah);S(this,us,null);S(this,ea);var s;e?(w(this,ta,!1),w(this,ea,ut.HIGHLIGHT_COLOR),w(this,rh,e)):(w(this,ta,!0),w(this,ea,ut.HIGHLIGHT_DEFAULT_COLOR)),w(this,us,(e==null?void 0:e._uiManager)||t),w(this,ah,o(this,us)._eventBus),w(this,Jr,(e==null?void 0:e.color)||((s=o(this,us))==null?void 0:s.highlightColors.values().next().value)||"#FFFF98")}static get _keyboardManager(){return Et(this,"_keyboardManager",new _h([[["Escape","mac+Escape"],Ws.prototype._hideDropdownFromKeyboard],[[" ","mac+ "],Ws.prototype._colorSelectFromKeyboard],[["ArrowDown","ArrowRight","mac+ArrowDown","mac+ArrowRight"],Ws.prototype._moveToNext],[["ArrowUp","ArrowLeft","mac+ArrowUp","mac+ArrowLeft"],Ws.prototype._moveToPrevious],[["Home","mac+Home"],Ws.prototype._moveToBeginning],[["End","mac+End"],Ws.prototype._moveToEnd]]))}renderButton(){const e=w(this,ds,document.createElement("button"));e.className="colorPicker",e.tabIndex="0",e.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-button"),e.setAttribute("aria-haspopup",!0);const t=o(this,us)._signal;e.addEventListener("click",E(this,Mt,Zi).bind(this),{signal:t}),e.addEventListener("keydown",o(this,sh),{signal:t});const s=w(this,Bn,document.createElement("span"));return s.className="swatch",s.setAttribute("aria-hidden",!0),s.style.backgroundColor=o(this,Jr),e.append(s),e}renderMainDropdown(){const e=w(this,Yt,E(this,Mt,jc).call(this));return e.setAttribute("aria-orientation","horizontal"),e.setAttribute("aria-labelledby","highlightColorPickerLabel"),e}_colorSelectFromKeyboard(e){if(e.target===o(this,ds)){E(this,Mt,Zi).call(this,e);return}const t=e.target.getAttribute("data-color");t&&E(this,Mt,Wc).call(this,t,e)}_moveToNext(e){var t,s;if(!o(this,Mt,Ei)){E(this,Mt,Zi).call(this,e);return}if(e.target===o(this,ds)){(t=o(this,Yt).firstChild)==null||t.focus();return}(s=e.target.nextSibling)==null||s.focus()}_moveToPrevious(e){var t,s;if(e.target===((t=o(this,Yt))==null?void 0:t.firstChild)||e.target===o(this,ds)){o(this,Mt,Ei)&&this._hideDropdownFromKeyboard();return}o(this,Mt,Ei)||E(this,Mt,Zi).call(this,e),(s=e.target.previousSibling)==null||s.focus()}_moveToBeginning(e){var t;if(!o(this,Mt,Ei)){E(this,Mt,Zi).call(this,e);return}(t=o(this,Yt).firstChild)==null||t.focus()}_moveToEnd(e){var t;if(!o(this,Mt,Ei)){E(this,Mt,Zi).call(this,e);return}(t=o(this,Yt).lastChild)==null||t.focus()}hideDropdown(){var e;(e=o(this,Yt))==null||e.classList.add("hidden"),window.removeEventListener("pointerdown",o(this,ih))}_hideDropdownFromKeyboard(){var e;if(!o(this,ta)){if(!o(this,Mt,Ei)){(e=o(this,rh))==null||e.unselect();return}this.hideDropdown(),o(this,ds).focus({preventScroll:!0,focusVisible:o(this,nh)})}}updateColor(e){if(o(this,Bn)&&(o(this,Bn).style.backgroundColor=e),!o(this,Yt))return;const t=o(this,us).highlightColors.values();for(const s of o(this,Yt).children)s.setAttribute("aria-selected",t.next().value===e)}destroy(){var e,t;(e=o(this,ds))==null||e.remove(),w(this,ds,null),w(this,Bn,null),(t=o(this,Yt))==null||t.remove(),w(this,Yt,null)}};sh=new WeakMap,ih=new WeakMap,ds=new WeakMap,Bn=new WeakMap,Jr=new WeakMap,Yt=new WeakMap,nh=new WeakMap,ta=new WeakMap,rh=new WeakMap,ah=new WeakMap,us=new WeakMap,ea=new WeakMap,Mt=new WeakSet,jc=function(){const e=document.createElement("div"),t=o(this,us)._signal;e.addEventListener("contextmenu",Re,{signal:t}),e.className="dropdown",e.role="listbox",e.setAttribute("aria-multiselectable",!1),e.setAttribute("aria-orientation","vertical"),e.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-dropdown");for(const[s,i]of o(this,us).highlightColors){const n=document.createElement("button");n.tabIndex="0",n.role="option",n.setAttribute("data-color",i),n.title=s,n.setAttribute("data-l10n-id",`pdfjs-editor-colorpicker-${s}`);const r=document.createElement("span");n.append(r),r.className="swatch",r.style.backgroundColor=i,n.setAttribute("aria-selected",i===o(this,Jr)),n.addEventListener("click",E(this,Mt,Wc).bind(this,i),{signal:t}),e.append(n)}return e.addEventListener("keydown",o(this,sh),{signal:t}),e},Wc=function(e,t){t.stopPropagation(),o(this,ah).dispatch("switchannotationeditorparams",{source:this,type:o(this,ea),value:e})},xf=function(e){Ws._keyboardManager.exec(this,e)},Zi=function(e){if(o(this,Mt,Ei)){this.hideDropdown();return}if(w(this,nh,e.detail===0),window.addEventListener("pointerdown",o(this,ih),{signal:o(this,us)._signal}),o(this,Yt)){o(this,Yt).classList.remove("hidden");return}const t=w(this,Yt,E(this,Mt,jc).call(this));o(this,ds).append(t)},Cf=function(e){var t;(t=o(this,Yt))!=null&&t.contains(e.target)||this.hideDropdown()},Ei=function(){return o(this,Yt)&&!o(this,Yt).classList.contains("hidden")};let hl=Ws;var sa,oh,zi,zn,ia,Xe,hh,lh,Hn,fs,_e,He,Tl,na,Un,Kt,ra,Ts,ch,bt,Gc,$c,kf,Tf,Rf,Vc,Ra,Qe,lr,Pf,Yh,Pa,Lf,If,Mf,Ff;const xt=class xt extends kt{constructor(t){super({...t,name:"highlightEditor"});S(this,bt);S(this,sa,null);S(this,oh,0);S(this,zi);S(this,zn,null);S(this,ia,null);S(this,Xe,null);S(this,hh,null);S(this,lh,0);S(this,Hn,null);S(this,fs,null);S(this,_e,null);S(this,He,!1);S(this,Tl,E(this,bt,Pf).bind(this));S(this,na,null);S(this,Un);S(this,Kt,null);S(this,ra,"");S(this,Ts);S(this,ch,"");this.color=t.color||xt._defaultColor,w(this,Ts,t.thickness||xt._defaultThickness),w(this,Un,t.opacity||xt._defaultOpacity),w(this,zi,t.boxes||null),w(this,ch,t.methodOfCreation||""),w(this,ra,t.text||""),this._isDraggable=!1,t.highlightId>-1?(w(this,He,!0),E(this,bt,$c).call(this,t),E(this,bt,Ra).call(this)):(w(this,sa,t.anchorNode),w(this,oh,t.anchorOffset),w(this,hh,t.focusNode),w(this,lh,t.focusOffset),E(this,bt,Gc).call(this),E(this,bt,Ra).call(this),this.rotate(this.rotation))}static get _keyboardManager(){const t=xt.prototype;return Et(this,"_keyboardManager",new _h([[["ArrowLeft","mac+ArrowLeft"],t._moveCaret,{args:[0]}],[["ArrowRight","mac+ArrowRight"],t._moveCaret,{args:[1]}],[["ArrowUp","mac+ArrowUp"],t._moveCaret,{args:[2]}],[["ArrowDown","mac+ArrowDown"],t._moveCaret,{args:[3]}]]))}get telemetryInitialData(){return{action:"added",type:o(this,He)?"free_highlight":"highlight",color:this._uiManager.highlightColorNames.get(this.color),thickness:o(this,Ts),methodOfCreation:o(this,ch)}}get telemetryFinalData(){return{type:"highlight",color:this._uiManager.highlightColorNames.get(this.color)}}static computeTelemetryFinalData(t){return{numberOfColors:t.get("color").size}}static initialize(t,s){var i;kt.initialize(t,s),xt._defaultColor||(xt._defaultColor=((i=s.highlightColors)==null?void 0:i.values().next().value)||"#fff066")}static updateDefaultParams(t,s){switch(t){case ut.HIGHLIGHT_DEFAULT_COLOR:xt._defaultColor=s;break;case ut.HIGHLIGHT_THICKNESS:xt._defaultThickness=s;break}}translateInPage(t,s){}get toolbarPosition(){return o(this,na)}updateParams(t,s){switch(t){case ut.HIGHLIGHT_COLOR:E(this,bt,kf).call(this,s);break;case ut.HIGHLIGHT_THICKNESS:E(this,bt,Tf).call(this,s);break}}static get defaultPropertiesToUpdate(){return[[ut.HIGHLIGHT_DEFAULT_COLOR,xt._defaultColor],[ut.HIGHLIGHT_THICKNESS,xt._defaultThickness]]}get propertiesToUpdate(){return[[ut.HIGHLIGHT_COLOR,this.color||xt._defaultColor],[ut.HIGHLIGHT_THICKNESS,o(this,Ts)||xt._defaultThickness],[ut.HIGHLIGHT_FREE,o(this,He)]]}async addEditToolbar(){const t=await super.addEditToolbar();return t?(this._uiManager.highlightColors&&(w(this,ia,new hl({editor:this})),t.addColorPicker(o(this,ia))),t):null}disableEditing(){super.disableEditing(),this.div.classList.toggle("disabled",!0)}enableEditing(){super.enableEditing(),this.div.classList.toggle("disabled",!1)}fixAndSetPosition(){return super.fixAndSetPosition(E(this,bt,Pa).call(this))}getBaseTranslation(){return[0,0]}getRect(t,s){return super.getRect(t,s,E(this,bt,Pa).call(this))}onceAdded(){this.parent.addUndoableEditor(this),this.div.focus()}remove(){E(this,bt,Vc).call(this),this._reportTelemetry({action:"deleted"}),super.remove()}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(E(this,bt,Ra).call(this),this.isAttachedToDOM||this.parent.add(this)))}setParent(t){var i;let s=!1;this.parent&&!t?E(this,bt,Vc).call(this):t&&(E(this,bt,Ra).call(this,t),s=!this.parent&&((i=this.div)==null?void 0:i.classList.contains("selectedEditor"))),super.setParent(t),this.show(this._isVisible),s&&this.select()}rotate(t){var n,r,a;const{drawLayer:s}=this.parent;let i;o(this,He)?(t=(t-this.rotation+360)%360,i=E(n=xt,Qe,lr).call(n,o(this,fs).box,t)):i=E(r=xt,Qe,lr).call(r,this,t),s.rotate(o(this,_e),t),s.rotate(o(this,Kt),t),s.updateBox(o(this,_e),i),s.updateBox(o(this,Kt),E(a=xt,Qe,lr).call(a,o(this,Xe).box,t))}render(){if(this.div)return this.div;const t=super.render();o(this,ra)&&(t.setAttribute("aria-label",o(this,ra)),t.setAttribute("role","mark")),o(this,He)?t.classList.add("free"):this.div.addEventListener("keydown",o(this,Tl),{signal:this._uiManager._signal});const s=w(this,Hn,document.createElement("div"));t.append(s),s.setAttribute("aria-hidden","true"),s.className="internal",s.style.clipPath=o(this,zn);const[i,n]=this.parentDimensions;return this.setDims(this.width*i,this.height*n),nl(this,o(this,Hn),["pointerover","pointerleave"]),this.enableEditing(),t}pointerover(){this.parent.drawLayer.addClass(o(this,Kt),"hovered")}pointerleave(){this.parent.drawLayer.removeClass(o(this,Kt),"hovered")}_moveCaret(t){switch(this.parent.unselect(this),t){case 0:case 2:E(this,bt,Yh).call(this,!0);break;case 1:case 3:E(this,bt,Yh).call(this,!1);break}}select(){var t,s;super.select(),o(this,Kt)&&((t=this.parent)==null||t.drawLayer.removeClass(o(this,Kt),"hovered"),(s=this.parent)==null||s.drawLayer.addClass(o(this,Kt),"selected"))}unselect(){var t;super.unselect(),o(this,Kt)&&((t=this.parent)==null||t.drawLayer.removeClass(o(this,Kt),"selected"),o(this,He)||E(this,bt,Yh).call(this,!1))}get _mustFixPosition(){return!o(this,He)}show(t=this._isVisible){super.show(t),this.parent&&(this.parent.drawLayer.show(o(this,_e),t),this.parent.drawLayer.show(o(this,Kt),t))}static startHighlighting(t,s,{target:i,x:n,y:r}){const{x:a,y:h,width:l,height:c}=i.getBoundingClientRect(),d=v=>{E(this,Qe,Mf).call(this,t,v)},p=t._signal,f={capture:!0,passive:!1,signal:p},g=v=>{v.preventDefault(),v.stopPropagation()},m=v=>{i.removeEventListener("pointermove",d),window.removeEventListener("blur",m),window.removeEventListener("pointerup",m),window.removeEventListener("pointerdown",g,f),window.removeEventListener("contextmenu",Re),E(this,Qe,Ff).call(this,t,v)};window.addEventListener("blur",m,{signal:p}),window.addEventListener("pointerup",m,{signal:p}),window.addEventListener("pointerdown",g,f),window.addEventListener("contextmenu",Re,{signal:p}),i.addEventListener("pointermove",d,{signal:p}),this._freeHighlight=new ol({x:n,y:r},[a,h,l,c],t.scale,this._defaultThickness/2,s,.001),{id:this._freeHighlightId,clipPathId:this._freeHighlightClipId}=t.drawLayer.highlight(this._freeHighlight,this._defaultColor,this._defaultOpacity,!0)}static deserialize(t,s,i){var m;const n=super.deserialize(t,s,i),{rect:[r,a,h,l],color:c,quadPoints:d}=t;n.color=at.makeHexColor(...c),w(n,Un,t.opacity);const[p,f]=n.pageDimensions;n.width=(h-r)/p,n.height=(l-a)/f;const g=w(n,zi,[]);for(let v=0;v<d.length;v+=8)g.push({x:(d[4]-h)/p,y:(l-(1-d[v+5]))/f,width:(d[v+2]-d[v])/p,height:(d[v+5]-d[v+1])/f});return E(m=n,bt,Gc).call(m),n}serialize(t=!1){if(this.isEmpty()||t)return null;const s=this.getRect(0,0),i=kt._colorManager.convert(this.color);return{annotationType:wt.HIGHLIGHT,color:i,opacity:o(this,Un),thickness:o(this,Ts),quadPoints:E(this,bt,Lf).call(this),outlines:E(this,bt,If).call(this,s),pageIndex:this.pageIndex,rect:s,rotation:E(this,bt,Pa).call(this),structTreeParentId:this._structTreeParentId}}static canCreateNewEmptyEditor(){return!1}};sa=new WeakMap,oh=new WeakMap,zi=new WeakMap,zn=new WeakMap,ia=new WeakMap,Xe=new WeakMap,hh=new WeakMap,lh=new WeakMap,Hn=new WeakMap,fs=new WeakMap,_e=new WeakMap,He=new WeakMap,Tl=new WeakMap,na=new WeakMap,Un=new WeakMap,Kt=new WeakMap,ra=new WeakMap,Ts=new WeakMap,ch=new WeakMap,bt=new WeakSet,Gc=function(){const t=new Bc(o(this,zi),.001);w(this,fs,t.getOutlines()),{x:this.x,y:this.y,width:this.width,height:this.height}=o(this,fs).box;const s=new Bc(o(this,zi),.0025,.001,this._uiManager.direction==="ltr");w(this,Xe,s.getOutlines());const{lastPoint:i}=o(this,Xe).box;w(this,na,[(i[0]-this.x)/this.width,(i[1]-this.y)/this.height])},$c=function({highlightOutlines:t,highlightId:s,clipPathId:i}){var d,p;if(w(this,fs,t),w(this,Xe,t.getNewOutline(o(this,Ts)/2+1.5,.0025)),s>=0)w(this,_e,s),w(this,zn,i),this.parent.drawLayer.finalizeLine(s,t),w(this,Kt,this.parent.drawLayer.highlightOutline(o(this,Xe)));else if(this.parent){const f=this.parent.viewport.rotation;this.parent.drawLayer.updateLine(o(this,_e),t),this.parent.drawLayer.updateBox(o(this,_e),E(d=xt,Qe,lr).call(d,o(this,fs).box,(f-this.rotation+360)%360)),this.parent.drawLayer.updateLine(o(this,Kt),o(this,Xe)),this.parent.drawLayer.updateBox(o(this,Kt),E(p=xt,Qe,lr).call(p,o(this,Xe).box,f))}const{x:r,y:a,width:h,height:l}=t.box;switch(this.rotation){case 0:this.x=r,this.y=a,this.width=h,this.height=l;break;case 90:{const[f,g]=this.parentDimensions;this.x=a,this.y=1-r,this.width=h*g/f,this.height=l*f/g;break}case 180:this.x=1-r,this.y=1-a,this.width=h,this.height=l;break;case 270:{const[f,g]=this.parentDimensions;this.x=1-a,this.y=r,this.width=h*g/f,this.height=l*f/g;break}}const{lastPoint:c}=o(this,Xe).box;w(this,na,[(c[0]-r)/h,(c[1]-a)/l])},kf=function(t){const s=n=>{var r,a;this.color=n,(r=this.parent)==null||r.drawLayer.changeColor(o(this,_e),n),(a=o(this,ia))==null||a.updateColor(n)},i=this.color;this.addCommands({cmd:s.bind(this,t),undo:s.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:ut.HIGHLIGHT_COLOR,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"color_changed",color:this._uiManager.highlightColorNames.get(t)},!0)},Tf=function(t){const s=o(this,Ts),i=n=>{w(this,Ts,n),E(this,bt,Rf).call(this,n)};this.addCommands({cmd:i.bind(this,t),undo:i.bind(this,s),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:ut.INK_THICKNESS,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"thickness_changed",thickness:t},!0)},Rf=function(t){if(!o(this,He))return;E(this,bt,$c).call(this,{highlightOutlines:o(this,fs).getNewOutline(t/2)}),this.fixAndSetPosition();const[s,i]=this.parentDimensions;this.setDims(this.width*s,this.height*i)},Vc=function(){o(this,_e)===null||!this.parent||(this.parent.drawLayer.remove(o(this,_e)),w(this,_e,null),this.parent.drawLayer.remove(o(this,Kt)),w(this,Kt,null))},Ra=function(t=this.parent){o(this,_e)===null&&({id:Le(this,_e)._,clipPathId:Le(this,zn)._}=t.drawLayer.highlight(o(this,fs),this.color,o(this,Un)),w(this,Kt,t.drawLayer.highlightOutline(o(this,Xe))),o(this,Hn)&&(o(this,Hn).style.clipPath=o(this,zn)))},Qe=new WeakSet,lr=function({x:t,y:s,width:i,height:n},r){switch(r){case 90:return{x:1-s-n,y:t,width:n,height:i};case 180:return{x:1-t-i,y:1-s-n,width:i,height:n};case 270:return{x:s,y:1-t-i,width:n,height:i}}return{x:t,y:s,width:i,height:n}},Pf=function(t){xt._keyboardManager.exec(this,t)},Yh=function(t){if(!o(this,sa))return;const s=window.getSelection();t?s.setPosition(o(this,sa),o(this,oh)):s.setPosition(o(this,hh),o(this,lh))},Pa=function(){return o(this,He)?this.rotation:0},Lf=function(){if(o(this,He))return null;const[t,s]=this.pageDimensions,i=o(this,zi),n=new Float32Array(i.length*8);let r=0;for(const{x:a,y:h,width:l,height:c}of i){const d=a*t,p=(1-h-c)*s;n[r]=n[r+4]=d,n[r+1]=n[r+3]=p,n[r+2]=n[r+6]=d+l*t,n[r+5]=n[r+7]=p+c*s,r+=8}return n},If=function(t){return o(this,fs).serialize(t,E(this,bt,Pa).call(this))},Mf=function(t,s){this._freeHighlight.add(s)&&t.drawLayer.updatePath(this._freeHighlightId,this._freeHighlight)},Ff=function(t,s){this._freeHighlight.isEmpty()?t.drawLayer.removeFreeHighlight(this._freeHighlightId):t.createAndAddNewEditor(s,!1,{highlightId:this._freeHighlightId,highlightOutlines:this._freeHighlight.getOutlines(),clipPathId:this._freeHighlightClipId,methodOfCreation:"main_toolbar"}),this._freeHighlightId=-1,this._freeHighlight=null,this._freeHighlightClipId=""},S(xt,Qe),ft(xt,"_defaultColor",null),ft(xt,"_defaultOpacity",1),ft(xt,"_defaultThickness",12),ft(xt,"_l10nPromise"),ft(xt,"_type","highlight"),ft(xt,"_editorType",wt.HIGHLIGHT),ft(xt,"_freeHighlightId",-1),ft(xt,"_freeHighlight",null),ft(xt,"_freeHighlightClipId","");let ll=xt;var jn,Wn,dh,uh,fh,Gn,Rs,hi,Ye,$n,Vn,li,qn,Xn,Hi,et,Df,Of,Nf,Bf,Xc,zf,Yc,Hf,Uf,jf,Wf,Gf,Qi,Kc,Kh,Zh,cr,Zc,Qh,yi,$f,Qc,Vf,qf,Jc,Jh,La;const Nt=class Nt extends kt{constructor(t){super({...t,name:"inkEditor"});S(this,et);S(this,jn,0);S(this,Wn,0);S(this,dh,this.canvasPointermove.bind(this));S(this,uh,this.canvasPointerleave.bind(this));S(this,fh,this.canvasPointerup.bind(this));S(this,Gn,this.canvasPointerdown.bind(this));S(this,Rs,null);S(this,hi,new Path2D);S(this,Ye,!1);S(this,$n,!1);S(this,Vn,!1);S(this,li,null);S(this,qn,0);S(this,Xn,0);S(this,Hi,null);this.color=t.color||null,this.thickness=t.thickness||null,this.opacity=t.opacity||null,this.paths=[],this.bezierPath2D=[],this.allRawPaths=[],this.currentPath=[],this.scaleFactor=1,this.translationX=this.translationY=0,this.x=0,this.y=0,this._willKeepAspectRatio=!0}static initialize(t,s){kt.initialize(t,s)}static updateDefaultParams(t,s){switch(t){case ut.INK_THICKNESS:Nt._defaultThickness=s;break;case ut.INK_COLOR:Nt._defaultColor=s;break;case ut.INK_OPACITY:Nt._defaultOpacity=s/100;break}}updateParams(t,s){switch(t){case ut.INK_THICKNESS:E(this,et,Df).call(this,s);break;case ut.INK_COLOR:E(this,et,Of).call(this,s);break;case ut.INK_OPACITY:E(this,et,Nf).call(this,s);break}}static get defaultPropertiesToUpdate(){return[[ut.INK_THICKNESS,Nt._defaultThickness],[ut.INK_COLOR,Nt._defaultColor||kt._defaultLineColor],[ut.INK_OPACITY,Math.round(Nt._defaultOpacity*100)]]}get propertiesToUpdate(){return[[ut.INK_THICKNESS,this.thickness||Nt._defaultThickness],[ut.INK_COLOR,this.color||Nt._defaultColor||kt._defaultLineColor],[ut.INK_OPACITY,Math.round(100*(this.opacity??Nt._defaultOpacity))]]}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(this.canvas||(E(this,et,Kh).call(this),E(this,et,Zh).call(this)),this.isAttachedToDOM||(this.parent.add(this),E(this,et,cr).call(this)),E(this,et,La).call(this)))}remove(){var t;this.canvas!==null&&(this.isEmpty()||this.commit(),this.canvas.width=this.canvas.height=0,this.canvas.remove(),this.canvas=null,o(this,Rs)&&(clearTimeout(o(this,Rs)),w(this,Rs,null)),(t=o(this,li))==null||t.disconnect(),w(this,li,null),super.remove())}setParent(t){!this.parent&&t?this._uiManager.removeShouldRescale(this):this.parent&&t===null&&this._uiManager.addShouldRescale(this),super.setParent(t)}onScaleChanging(){const[t,s]=this.parentDimensions,i=this.width*t,n=this.height*s;this.setDimensions(i,n)}enableEditMode(){o(this,Ye)||this.canvas===null||(super.enableEditMode(),this._isDraggable=!1,this.canvas.addEventListener("pointerdown",o(this,Gn),{signal:this._uiManager._signal}))}disableEditMode(){!this.isInEditMode()||this.canvas===null||(super.disableEditMode(),this._isDraggable=!this.isEmpty(),this.div.classList.remove("editing"),this.canvas.removeEventListener("pointerdown",o(this,Gn)))}onceAdded(){this._isDraggable=!this.isEmpty()}isEmpty(){return this.paths.length===0||this.paths.length===1&&this.paths[0].length===0}commit(){o(this,Ye)||(super.commit(),this.isEditing=!1,this.disableEditMode(),this.setInForeground(),w(this,Ye,!0),this.div.classList.add("disabled"),E(this,et,La).call(this,!0),this.select(),this.parent.addInkEditorIfNeeded(!0),this.moveInDOM(),this.div.focus({preventScroll:!0}))}focusin(t){this._focusEventsAllowed&&(super.focusin(t),this.enableEditMode())}canvasPointerdown(t){t.button!==0||!this.isInEditMode()||o(this,Ye)||(this.setInForeground(),t.preventDefault(),this.div.contains(document.activeElement)||this.div.focus({preventScroll:!0}),E(this,et,zf).call(this,t.offsetX,t.offsetY))}canvasPointermove(t){t.preventDefault(),E(this,et,Yc).call(this,t.offsetX,t.offsetY)}canvasPointerup(t){t.preventDefault(),E(this,et,Kc).call(this,t)}canvasPointerleave(t){E(this,et,Kc).call(this,t)}get isResizable(){return!this.isEmpty()&&o(this,Ye)}render(){if(this.div)return this.div;let t,s;this.width&&(t=this.x,s=this.y),super.render(),this.div.setAttribute("data-l10n-id","pdfjs-ink");const[i,n,r,a]=E(this,et,Bf).call(this);if(this.setAt(i,n,0,0),this.setDims(r,a),E(this,et,Kh).call(this),this.width){const[h,l]=this.parentDimensions;this.setAspectRatio(this.width*h,this.height*l),this.setAt(t*h,s*l,this.width*h,this.height*l),w(this,Vn,!0),E(this,et,cr).call(this),this.setDims(this.width*h,this.height*l),E(this,et,Qi).call(this),this.div.classList.add("disabled")}else this.div.classList.add("editing"),this.enableEditMode();return E(this,et,Zh).call(this),this.div}setDimensions(t,s){const i=Math.round(t),n=Math.round(s);if(o(this,qn)===i&&o(this,Xn)===n)return;w(this,qn,i),w(this,Xn,n),this.canvas.style.visibility="hidden";const[r,a]=this.parentDimensions;this.width=t/r,this.height=s/a,this.fixAndSetPosition(),o(this,Ye)&&E(this,et,Zc).call(this,t,s),E(this,et,cr).call(this),E(this,et,Qi).call(this),this.canvas.style.visibility="visible",this.fixDims()}static deserialize(t,s,i){var v,b,A;if(t instanceof uf)return null;const n=super.deserialize(t,s,i);n.thickness=t.thickness,n.color=at.makeHexColor(...t.color),n.opacity=t.opacity;const[r,a]=n.pageDimensions,h=n.width*r,l=n.height*a,c=n.parentScale,d=t.thickness/2;w(n,Ye,!0),w(n,qn,Math.round(h)),w(n,Xn,Math.round(l));const{paths:p,rect:f,rotation:g}=t;for(let{bezier:x}of p){x=E(v=Nt,yi,Vf).call(v,x,f,g);const k=[];n.paths.push(k);let T=c*(x[0]-d),L=c*(x[1]-d);for(let B=2,D=x.length;B<D;B+=6){const W=c*(x[B]-d),q=c*(x[B+1]-d),P=c*(x[B+2]-d),z=c*(x[B+3]-d),y=c*(x[B+4]-d),H=c*(x[B+5]-d);k.push([[T,L],[W,q],[P,z],[y,H]]),T=y,L=H}const I=E(this,yi,$f).call(this,k);n.bezierPath2D.push(I)}const m=E(b=n,et,Jc).call(b);return w(n,Wn,Math.max(kt.MIN_SIZE,m[2]-m[0])),w(n,jn,Math.max(kt.MIN_SIZE,m[3]-m[1])),E(A=n,et,Zc).call(A,h,l),n}serialize(){if(this.isEmpty())return null;const t=this.getRect(0,0),s=kt._colorManager.convert(this.ctx.strokeStyle);return{annotationType:wt.INK,color:s,thickness:this.thickness,opacity:this.opacity,paths:E(this,et,qf).call(this,this.scaleFactor/this.parentScale,this.translationX,this.translationY,t),pageIndex:this.pageIndex,rect:t,rotation:this.rotation,structTreeParentId:this._structTreeParentId}}};jn=new WeakMap,Wn=new WeakMap,dh=new WeakMap,uh=new WeakMap,fh=new WeakMap,Gn=new WeakMap,Rs=new WeakMap,hi=new WeakMap,Ye=new WeakMap,$n=new WeakMap,Vn=new WeakMap,li=new WeakMap,qn=new WeakMap,Xn=new WeakMap,Hi=new WeakMap,et=new WeakSet,Df=function(t){const s=n=>{this.thickness=n,E(this,et,La).call(this)},i=this.thickness;this.addCommands({cmd:s.bind(this,t),undo:s.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:ut.INK_THICKNESS,overwriteIfSameType:!0,keepUndo:!0})},Of=function(t){const s=n=>{this.color=n,E(this,et,Qi).call(this)},i=this.color;this.addCommands({cmd:s.bind(this,t),undo:s.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:ut.INK_COLOR,overwriteIfSameType:!0,keepUndo:!0})},Nf=function(t){const s=n=>{this.opacity=n,E(this,et,Qi).call(this)};t/=100;const i=this.opacity;this.addCommands({cmd:s.bind(this,t),undo:s.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:ut.INK_OPACITY,overwriteIfSameType:!0,keepUndo:!0})},Bf=function(){const{parentRotation:t,parentDimensions:[s,i]}=this;switch(t){case 90:return[0,i,i,s];case 180:return[s,i,s,i];case 270:return[s,0,i,s];default:return[0,0,s,i]}},Xc=function(){const{ctx:t,color:s,opacity:i,thickness:n,parentScale:r,scaleFactor:a}=this;t.lineWidth=n*r/a,t.lineCap="round",t.lineJoin="round",t.miterLimit=10,t.strokeStyle=`${s}${tg(i)}`},zf=function(t,s){const i=this._uiManager._signal;this.canvas.addEventListener("contextmenu",Re,{signal:i}),this.canvas.addEventListener("pointerleave",o(this,uh),{signal:i}),this.canvas.addEventListener("pointermove",o(this,dh),{signal:i}),this.canvas.addEventListener("pointerup",o(this,fh),{signal:i}),this.canvas.removeEventListener("pointerdown",o(this,Gn)),this.isEditing=!0,o(this,Vn)||(w(this,Vn,!0),E(this,et,cr).call(this),this.thickness||(this.thickness=Nt._defaultThickness),this.color||(this.color=Nt._defaultColor||kt._defaultLineColor),this.opacity??(this.opacity=Nt._defaultOpacity)),this.currentPath.push([t,s]),w(this,$n,!1),E(this,et,Xc).call(this),w(this,Hi,()=>{E(this,et,jf).call(this),o(this,Hi)&&window.requestAnimationFrame(o(this,Hi))}),window.requestAnimationFrame(o(this,Hi))},Yc=function(t,s){const[i,n]=this.currentPath.at(-1);if(this.currentPath.length>1&&t===i&&s===n)return;const r=this.currentPath;let a=o(this,hi);if(r.push([t,s]),w(this,$n,!0),r.length<=2){a.moveTo(...r[0]),a.lineTo(t,s);return}r.length===3&&(w(this,hi,a=new Path2D),a.moveTo(...r[0])),E(this,et,Wf).call(this,a,...r.at(-3),...r.at(-2),t,s)},Hf=function(){if(this.currentPath.length===0)return;const t=this.currentPath.at(-1);o(this,hi).lineTo(...t)},Uf=function(t,s){w(this,Hi,null),t=Math.min(Math.max(t,0),this.canvas.width),s=Math.min(Math.max(s,0),this.canvas.height),E(this,et,Yc).call(this,t,s),E(this,et,Hf).call(this);let i;if(this.currentPath.length!==1)i=E(this,et,Gf).call(this);else{const l=[t,s];i=[[l,l.slice(),l.slice(),l]]}const n=o(this,hi),r=this.currentPath;this.currentPath=[],w(this,hi,new Path2D);const a=()=>{this.allRawPaths.push(r),this.paths.push(i),this.bezierPath2D.push(n),this._uiManager.rebuild(this)},h=()=>{this.allRawPaths.pop(),this.paths.pop(),this.bezierPath2D.pop(),this.paths.length===0?this.remove():(this.canvas||(E(this,et,Kh).call(this),E(this,et,Zh).call(this)),E(this,et,La).call(this))};this.addCommands({cmd:a,undo:h,mustExec:!0})},jf=function(){if(!o(this,$n))return;w(this,$n,!1);const t=Math.ceil(this.thickness*this.parentScale),s=this.currentPath.slice(-3),i=s.map(a=>a[0]),n=s.map(a=>a[1]);Math.min(...i)-t,Math.max(...i)+t,Math.min(...n)-t,Math.max(...n)+t;const{ctx:r}=this;r.save(),r.clearRect(0,0,this.canvas.width,this.canvas.height);for(const a of this.bezierPath2D)r.stroke(a);r.stroke(o(this,hi)),r.restore()},Wf=function(t,s,i,n,r,a,h){const l=(s+n)/2,c=(i+r)/2,d=(n+a)/2,p=(r+h)/2;t.bezierCurveTo(l+2*(n-l)/3,c+2*(r-c)/3,d+2*(n-d)/3,p+2*(r-p)/3,d,p)},Gf=function(){const t=this.currentPath;if(t.length<=2)return[[t[0],t[0],t.at(-1),t.at(-1)]];const s=[];let i,[n,r]=t[0];for(i=1;i<t.length-2;i++){const[f,g]=t[i],[m,v]=t[i+1],b=(f+m)/2,A=(g+v)/2,x=[n+2*(f-n)/3,r+2*(g-r)/3],k=[b+2*(f-b)/3,A+2*(g-A)/3];s.push([[n,r],x,k,[b,A]]),[n,r]=[b,A]}const[a,h]=t[i],[l,c]=t[i+1],d=[n+2*(a-n)/3,r+2*(h-r)/3],p=[l+2*(a-l)/3,c+2*(h-c)/3];return s.push([[n,r],d,p,[l,c]]),s},Qi=function(){if(this.isEmpty()){E(this,et,Qh).call(this);return}E(this,et,Xc).call(this);const{canvas:t,ctx:s}=this;s.setTransform(1,0,0,1,0,0),s.clearRect(0,0,t.width,t.height),E(this,et,Qh).call(this);for(const i of this.bezierPath2D)s.stroke(i)},Kc=function(t){this.canvas.removeEventListener("pointerleave",o(this,uh)),this.canvas.removeEventListener("pointermove",o(this,dh)),this.canvas.removeEventListener("pointerup",o(this,fh)),this.canvas.addEventListener("pointerdown",o(this,Gn),{signal:this._uiManager._signal}),o(this,Rs)&&clearTimeout(o(this,Rs)),w(this,Rs,setTimeout(()=>{w(this,Rs,null),this.canvas.removeEventListener("contextmenu",Re)},10)),E(this,et,Uf).call(this,t.offsetX,t.offsetY),this.addToAnnotationStorage(),this.setInBackground()},Kh=function(){this.canvas=document.createElement("canvas"),this.canvas.width=this.canvas.height=0,this.canvas.className="inkEditorCanvas",this.canvas.setAttribute("data-l10n-id","pdfjs-ink-canvas"),this.div.append(this.canvas),this.ctx=this.canvas.getContext("2d")},Zh=function(){w(this,li,new ResizeObserver(t=>{const s=t[0].contentRect;s.width&&s.height&&this.setDimensions(s.width,s.height)})),o(this,li).observe(this.div),this._uiManager._signal.addEventListener("abort",()=>{var t;(t=o(this,li))==null||t.disconnect(),w(this,li,null)},{once:!0})},cr=function(){if(!o(this,Vn))return;const[t,s]=this.parentDimensions;this.canvas.width=Math.ceil(this.width*t),this.canvas.height=Math.ceil(this.height*s),E(this,et,Qh).call(this)},Zc=function(t,s){const i=E(this,et,Jh).call(this),n=(t-i)/o(this,Wn),r=(s-i)/o(this,jn);this.scaleFactor=Math.min(n,r)},Qh=function(){const t=E(this,et,Jh).call(this)/2;this.ctx.setTransform(this.scaleFactor,0,0,this.scaleFactor,this.translationX*this.scaleFactor+t,this.translationY*this.scaleFactor+t)},yi=new WeakSet,$f=function(t){const s=new Path2D;for(let i=0,n=t.length;i<n;i++){const[r,a,h,l]=t[i];i===0&&s.moveTo(...r),s.bezierCurveTo(a[0],a[1],h[0],h[1],l[0],l[1])}return s},Qc=function(t,s,i){const[n,r,a,h]=s;switch(i){case 0:for(let l=0,c=t.length;l<c;l+=2)t[l]+=n,t[l+1]=h-t[l+1];break;case 90:for(let l=0,c=t.length;l<c;l+=2){const d=t[l];t[l]=t[l+1]+n,t[l+1]=d+r}break;case 180:for(let l=0,c=t.length;l<c;l+=2)t[l]=a-t[l],t[l+1]+=r;break;case 270:for(let l=0,c=t.length;l<c;l+=2){const d=t[l];t[l]=a-t[l+1],t[l+1]=h-d}break;default:throw new Error("Invalid rotation")}return t},Vf=function(t,s,i){const[n,r,a,h]=s;switch(i){case 0:for(let l=0,c=t.length;l<c;l+=2)t[l]-=n,t[l+1]=h-t[l+1];break;case 90:for(let l=0,c=t.length;l<c;l+=2){const d=t[l];t[l]=t[l+1]-r,t[l+1]=d-n}break;case 180:for(let l=0,c=t.length;l<c;l+=2)t[l]=a-t[l],t[l+1]-=r;break;case 270:for(let l=0,c=t.length;l<c;l+=2){const d=t[l];t[l]=h-t[l+1],t[l+1]=a-d}break;default:throw new Error("Invalid rotation")}return t},qf=function(t,s,i,n){var c,d;const r=[],a=this.thickness/2,h=t*s+a,l=t*i+a;for(const p of this.paths){const f=[],g=[];for(let m=0,v=p.length;m<v;m++){const[b,A,x,k]=p[m];if(b[0]===k[0]&&b[1]===k[1]&&v===1){const z=t*b[0]+h,y=t*b[1]+l;f.push(z,y),g.push(z,y);break}const T=t*b[0]+h,L=t*b[1]+l,I=t*A[0]+h,B=t*A[1]+l,D=t*x[0]+h,W=t*x[1]+l,q=t*k[0]+h,P=t*k[1]+l;m===0&&(f.push(T,L),g.push(T,L)),f.push(I,B,D,W,q,P),g.push(I,B),m===v-1&&g.push(q,P)}r.push({bezier:E(c=Nt,yi,Qc).call(c,f,n,this.rotation),points:E(d=Nt,yi,Qc).call(d,g,n,this.rotation)})}return r},Jc=function(){let t=1/0,s=-1/0,i=1/0,n=-1/0;for(const r of this.paths)for(const[a,h,l,c]of r){const d=at.bezierBoundingBox(...a,...h,...l,...c);t=Math.min(t,d[0]),i=Math.min(i,d[1]),s=Math.max(s,d[2]),n=Math.max(n,d[3])}return[t,i,s,n]},Jh=function(){return o(this,Ye)?Math.ceil(this.thickness*this.parentScale):0},La=function(t=!1){if(this.isEmpty())return;if(!o(this,Ye)){E(this,et,Qi).call(this);return}const s=E(this,et,Jc).call(this),i=E(this,et,Jh).call(this);w(this,Wn,Math.max(kt.MIN_SIZE,s[2]-s[0])),w(this,jn,Math.max(kt.MIN_SIZE,s[3]-s[1]));const n=Math.ceil(i+o(this,Wn)*this.scaleFactor),r=Math.ceil(i+o(this,jn)*this.scaleFactor),[a,h]=this.parentDimensions;this.width=n/a,this.height=r/h,this.setAspectRatio(n,r);const l=this.translationX,c=this.translationY;this.translationX=-s[0],this.translationY=-s[1],E(this,et,cr).call(this),E(this,et,Qi).call(this),w(this,qn,n),w(this,Xn,r),this.setDims(n,r);const d=t?i/this.scaleFactor/2:0;this.translate(l-this.translationX-d,c-this.translationY-d)},S(Nt,yi),ft(Nt,"_defaultColor",null),ft(Nt,"_defaultOpacity",1),ft(Nt,"_defaultThickness",1),ft(Nt,"_type","ink"),ft(Nt,"_editorType",wt.INK);let qc=Nt;var he,le,Ui,ci,ji,aa,Ps,di,Ls,ps,ph,St,Ia,Ma,tl,ed,Xf,Yf,sd,el,Kf;const Oa=class Oa extends kt{constructor(t){super({...t,name:"stampEditor"});S(this,St);S(this,he,null);S(this,le,null);S(this,Ui,null);S(this,ci,null);S(this,ji,null);S(this,aa,"");S(this,Ps,null);S(this,di,null);S(this,Ls,null);S(this,ps,!1);S(this,ph,!1);w(this,ci,t.bitmapUrl),w(this,ji,t.bitmapFile)}static initialize(t,s){kt.initialize(t,s)}static get supportedTypes(){return Et(this,"supportedTypes",["apng","avif","bmp","gif","jpeg","png","svg+xml","webp","x-icon"].map(s=>`image/${s}`))}static get supportedTypesStr(){return Et(this,"supportedTypesStr",this.supportedTypes.join(","))}static isHandlingMimeForPasting(t){return this.supportedTypes.includes(t)}static paste(t,s){s.pasteEditor(wt.STAMP,{bitmapFile:t.getAsFile()})}remove(){var t,s;o(this,le)&&(w(this,he,null),this._uiManager.imageManager.deleteId(o(this,le)),(t=o(this,Ps))==null||t.remove(),w(this,Ps,null),(s=o(this,di))==null||s.disconnect(),w(this,di,null),o(this,Ls)&&(clearTimeout(o(this,Ls)),w(this,Ls,null))),super.remove()}rebuild(){if(!this.parent){o(this,le)&&E(this,St,tl).call(this);return}super.rebuild(),this.div!==null&&(o(this,le)&&o(this,Ps)===null&&E(this,St,tl).call(this),this.isAttachedToDOM||this.parent.add(this))}onceAdded(){this._isDraggable=!0,this.div.focus()}isEmpty(){return!(o(this,Ui)||o(this,he)||o(this,ci)||o(this,ji)||o(this,le))}get isResizable(){return!0}render(){if(this.div)return this.div;let t,s;if(this.width&&(t=this.x,s=this.y),super.render(),this.div.hidden=!0,this.addAltTextButton(),o(this,he)?E(this,St,ed).call(this):E(this,St,tl).call(this),this.width){const[i,n]=this.parentDimensions;this.setAt(t*i,s*n,this.width*i,this.height*n)}return this.div}getImageForAltText(){return o(this,Ps)}static deserialize(t,s,i){if(t instanceof ff)return null;const n=super.deserialize(t,s,i),{rect:r,bitmapUrl:a,bitmapId:h,isSvg:l,accessibilityData:c}=t;h&&i.imageManager.isValidId(h)?w(n,le,h):w(n,ci,a),w(n,ps,l);const[d,p]=n.pageDimensions;return n.width=(r[2]-r[0])/d,n.height=(r[3]-r[1])/p,c&&(n.altTextData=c),n}serialize(t=!1,s=null){if(this.isEmpty())return null;const i={annotationType:wt.STAMP,bitmapId:o(this,le),pageIndex:this.pageIndex,rect:this.getRect(0,0),rotation:this.rotation,isSvg:o(this,ps),structTreeParentId:this._structTreeParentId};if(t)return i.bitmapUrl=E(this,St,el).call(this,!0),i.accessibilityData=this.altTextData,i;const{decorative:n,altText:r}=this.altTextData;if(!n&&r&&(i.accessibilityData={type:"Figure",alt:r}),s===null)return i;s.stamps||(s.stamps=new Map);const a=o(this,ps)?(i.rect[2]-i.rect[0])*(i.rect[3]-i.rect[1]):null;if(!s.stamps.has(o(this,le)))s.stamps.set(o(this,le),{area:a,serialized:i}),i.bitmap=E(this,St,el).call(this,!1);else if(o(this,ps)){const h=s.stamps.get(o(this,le));a>h.area&&(h.area=a,h.serialized.bitmap.close(),h.serialized.bitmap=E(this,St,el).call(this,!1))}return i}};he=new WeakMap,le=new WeakMap,Ui=new WeakMap,ci=new WeakMap,ji=new WeakMap,aa=new WeakMap,Ps=new WeakMap,di=new WeakMap,Ls=new WeakMap,ps=new WeakMap,ph=new WeakMap,St=new WeakSet,Ia=function(t,s=!1){if(!t){this.remove();return}w(this,he,t.bitmap),s||(w(this,le,t.id),w(this,ps,t.isSvg)),t.file&&w(this,aa,t.file.name),E(this,St,ed).call(this)},Ma=function(){w(this,Ui,null),this._uiManager.enableWaiting(!1),o(this,Ps)&&this.div.focus()},tl=function(){if(o(this,le)){this._uiManager.enableWaiting(!0),this._uiManager.imageManager.getFromId(o(this,le)).then(i=>E(this,St,Ia).call(this,i,!0)).finally(()=>E(this,St,Ma).call(this));return}if(o(this,ci)){const i=o(this,ci);w(this,ci,null),this._uiManager.enableWaiting(!0),w(this,Ui,this._uiManager.imageManager.getFromUrl(i).then(n=>E(this,St,Ia).call(this,n)).finally(()=>E(this,St,Ma).call(this)));return}if(o(this,ji)){const i=o(this,ji);w(this,ji,null),this._uiManager.enableWaiting(!0),w(this,Ui,this._uiManager.imageManager.getFromFile(i).then(n=>E(this,St,Ia).call(this,n)).finally(()=>E(this,St,Ma).call(this)));return}const t=document.createElement("input");t.type="file",t.accept=Oa.supportedTypesStr;const s=this._uiManager._signal;w(this,Ui,new Promise(i=>{t.addEventListener("change",async()=>{if(!t.files||t.files.length===0)this.remove();else{this._uiManager.enableWaiting(!0);const n=await this._uiManager.imageManager.getFromFile(t.files[0]);E(this,St,Ia).call(this,n)}i()},{signal:s}),t.addEventListener("cancel",()=>{this.remove(),i()},{signal:s})}).finally(()=>E(this,St,Ma).call(this))),t.click()},ed=function(){const{div:t}=this;let{width:s,height:i}=o(this,he);const[n,r]=this.pageDimensions,a=.75;if(this.width)s=this.width*n,i=this.height*r;else if(s>a*n||i>a*r){const d=Math.min(a*n/s,a*r/i);s*=d,i*=d}const[h,l]=this.parentDimensions;this.setDims(s*h/n,i*l/r),this._uiManager.enableWaiting(!1);const c=w(this,Ps,document.createElement("canvas"));t.append(c),t.hidden=!1,E(this,St,sd).call(this,s,i),E(this,St,Kf).call(this),o(this,ph)||(this.parent.addUndoableEditor(this),w(this,ph,!0)),this._reportTelemetry({action:"inserted_image"}),o(this,aa)&&c.setAttribute("aria-label",o(this,aa))},Xf=function(t,s){var a;const[i,n]=this.parentDimensions;this.width=t/i,this.height=s/n,this.setDims(t,s),(a=this._initialOptions)!=null&&a.isCentered?this.center():this.fixAndSetPosition(),this._initialOptions=null,o(this,Ls)!==null&&clearTimeout(o(this,Ls)),w(this,Ls,setTimeout(()=>{w(this,Ls,null),E(this,St,sd).call(this,t,s)},200))},Yf=function(t,s){const{width:i,height:n}=o(this,he);let r=i,a=n,h=o(this,he);for(;r>2*t||a>2*s;){const l=r,c=a;r>2*t&&(r=r>=16384?Math.floor(r/2)-1:Math.ceil(r/2)),a>2*s&&(a=a>=16384?Math.floor(a/2)-1:Math.ceil(a/2));const d=new OffscreenCanvas(r,a);d.getContext("2d").drawImage(h,0,0,l,c,0,0,r,a),h=d.transferToImageBitmap()}return h},sd=function(t,s){t=Math.ceil(t),s=Math.ceil(s);const i=o(this,Ps);if(!i||i.width===t&&i.height===s)return;i.width=t,i.height=s;const n=o(this,ps)?o(this,he):E(this,St,Yf).call(this,t,s);if(this._uiManager.hasMLManager&&!this.hasAltText()){const h=new OffscreenCanvas(t,s).getContext("2d");h.drawImage(n,0,0,n.width,n.height,0,0,t,s),this._uiManager.mlGuess({service:"image-to-text",request:{data:h.getImageData(0,0,t,s).data,width:t,height:s,channels:4}}).then(l=>{const c=(l==null?void 0:l.output)||"";this.parent&&c&&!this.hasAltText()&&(this.altTextData={altText:c,decorative:!1})})}const r=i.getContext("2d");r.filter=this._uiManager.hcmFilter,r.drawImage(n,0,0,n.width,n.height,0,0,t,s)},el=function(t){if(t){if(o(this,ps)){const n=this._uiManager.imageManager.getSvgUrl(o(this,le));if(n)return n}const s=document.createElement("canvas");return{width:s.width,height:s.height}=o(this,he),s.getContext("2d").drawImage(o(this,he),0,0),s.toDataURL()}if(o(this,ps)){const[s,i]=this.pageDimensions,n=Math.round(this.width*s*Vi.PDF_TO_CSS_UNITS),r=Math.round(this.height*i*Vi.PDF_TO_CSS_UNITS),a=new OffscreenCanvas(n,r);return a.getContext("2d").drawImage(o(this,he),0,0,o(this,he).width,o(this,he).height,0,0,n,r),a.transferToImageBitmap()}return structuredClone(o(this,he))},Kf=function(){this._uiManager._signal&&(w(this,di,new ResizeObserver(t=>{const s=t[0].contentRect;s.width&&s.height&&E(this,St,Xf).call(this,s.width,s.height)})),o(this,di).observe(this.div),this._uiManager._signal.addEventListener("abort",()=>{var t;(t=o(this,di))==null||t.disconnect(),w(this,di,null)},{once:!0}))},ft(Oa,"_type","stamp"),ft(Oa,"_editorType",wt.STAMP);let td=Oa;var Yn,oa,Is,Kn,ui,fi,pi,Ue,Wi,ha,la,ve,ot,Gi,ce,Zf,nd,rd,ad,sl;const ts=class ts{constructor({uiManager:e,pageIndex:t,div:s,accessibilityManager:i,annotationLayer:n,drawLayer:r,textLayer:a,viewport:h,l10n:l}){S(this,ce);S(this,Yn);S(this,oa,!1);S(this,Is,null);S(this,Kn,null);S(this,ui,null);S(this,fi,null);S(this,pi,null);S(this,Ue,new Map);S(this,Wi,!1);S(this,ha,!1);S(this,la,!1);S(this,ve,null);S(this,ot);const c=[...o(ts,Gi).values()];if(!ts._initialized){ts._initialized=!0;for(const d of c)d.initialize(l,e)}e.registerEditorTypes(c),w(this,ot,e),this.pageIndex=t,this.div=s,w(this,Yn,i),w(this,Is,n),this.viewport=h,w(this,ve,a),this.drawLayer=r,o(this,ot).addLayer(this)}get isEmpty(){return o(this,Ue).size===0}get isInvisible(){return this.isEmpty&&o(this,ot).getMode()===wt.NONE}updateToolbar(e){o(this,ot).updateToolbar(e)}updateMode(e=o(this,ot).getMode()){switch(E(this,ce,sl).call(this),e){case wt.NONE:this.disableTextSelection(),this.togglePointerEvents(!1),this.toggleAnnotationLayerPointerEvents(!0),this.disableClick();return;case wt.INK:this.addInkEditorIfNeeded(!1),this.disableTextSelection(),this.togglePointerEvents(!0),this.disableClick();break;case wt.HIGHLIGHT:this.enableTextSelection(),this.togglePointerEvents(!1),this.disableClick();break;default:this.disableTextSelection(),this.togglePointerEvents(!0),this.enableClick()}this.toggleAnnotationLayerPointerEvents(!1);const{classList:t}=this.div;for(const s of o(ts,Gi).values())t.toggle(`${s._type}Editing`,e===s._editorType);this.div.hidden=!1}hasTextLayer(e){var t;return e===((t=o(this,ve))==null?void 0:t.div)}addInkEditorIfNeeded(e){if(o(this,ot).getMode()!==wt.INK)return;if(!e){for(const s of o(this,Ue).values())if(s.isEmpty()){s.setInBackground();return}}this.createAndAddNewEditor({offsetX:0,offsetY:0},!1).setInBackground()}setEditingState(e){o(this,ot).setEditingState(e)}addCommands(e){o(this,ot).addCommands(e)}togglePointerEvents(e=!1){this.div.classList.toggle("disabled",!e)}toggleAnnotationLayerPointerEvents(e=!1){var t;(t=o(this,Is))==null||t.div.classList.toggle("disabled",!e)}enable(){this.div.tabIndex=0,this.togglePointerEvents(!0);const e=new Set;for(const s of o(this,Ue).values())s.enableEditing(),s.show(!0),s.annotationElementId&&(o(this,ot).removeChangedExistingAnnotation(s),e.add(s.annotationElementId));if(!o(this,Is))return;const t=o(this,Is).getEditableAnnotations();for(const s of t){if(s.hide(),o(this,ot).isDeletedAnnotationElement(s.data.id)||e.has(s.data.id))continue;const i=this.deserialize(s);i&&(this.addOrRebuild(i),i.enableEditing())}}disable(){var i;w(this,la,!0),this.div.tabIndex=-1,this.togglePointerEvents(!1);const e=new Map,t=new Map;for(const n of o(this,Ue).values())if(n.disableEditing(),!!n.annotationElementId){if(n.serialize()!==null){e.set(n.annotationElementId,n);continue}else t.set(n.annotationElementId,n);(i=this.getEditableAnnotation(n.annotationElementId))==null||i.show(),n.remove()}if(o(this,Is)){const n=o(this,Is).getEditableAnnotations();for(const r of n){const{id:a}=r.data;if(o(this,ot).isDeletedAnnotationElement(a))continue;let h=t.get(a);if(h){h.resetAnnotationElement(r),h.show(!1),r.show();continue}h=e.get(a),h&&(o(this,ot).addChangedExistingAnnotation(h),h.renderAnnotationElement(r),h.show(!1)),r.show()}}E(this,ce,sl).call(this),this.isEmpty&&(this.div.hidden=!0);const{classList:s}=this.div;for(const n of o(ts,Gi).values())s.remove(`${n._type}Editing`);this.disableTextSelection(),this.toggleAnnotationLayerPointerEvents(!0),w(this,la,!1)}getEditableAnnotation(e){var t;return((t=o(this,Is))==null?void 0:t.getEditableAnnotation(e))||null}setActiveEditor(e){o(this,ot).getActive()!==e&&o(this,ot).setActiveEditor(e)}enableTextSelection(){var e;this.div.tabIndex=-1,(e=o(this,ve))!=null&&e.div&&!o(this,fi)&&(w(this,fi,E(this,ce,Zf).bind(this)),o(this,ve).div.addEventListener("pointerdown",o(this,fi),{signal:o(this,ot)._signal}),o(this,ve).div.classList.add("highlighting"))}disableTextSelection(){var e;this.div.tabIndex=0,(e=o(this,ve))!=null&&e.div&&o(this,fi)&&(o(this,ve).div.removeEventListener("pointerdown",o(this,fi)),w(this,fi,null),o(this,ve).div.classList.remove("highlighting"))}enableClick(){if(o(this,ui))return;const e=o(this,ot)._signal;w(this,ui,this.pointerdown.bind(this)),w(this,Kn,this.pointerup.bind(this)),this.div.addEventListener("pointerdown",o(this,ui),{signal:e}),this.div.addEventListener("pointerup",o(this,Kn),{signal:e})}disableClick(){o(this,ui)&&(this.div.removeEventListener("pointerdown",o(this,ui)),this.div.removeEventListener("pointerup",o(this,Kn)),w(this,ui,null),w(this,Kn,null))}attach(e){o(this,Ue).set(e.id,e);const{annotationElementId:t}=e;t&&o(this,ot).isDeletedAnnotationElement(t)&&o(this,ot).removeDeletedAnnotationElement(e)}detach(e){var t;o(this,Ue).delete(e.id),(t=o(this,Yn))==null||t.removePointerInTextLayer(e.contentDiv),!o(this,la)&&e.annotationElementId&&o(this,ot).addDeletedAnnotationElement(e)}remove(e){this.detach(e),o(this,ot).removeEditor(e),e.div.remove(),e.isAttachedToDOM=!1,o(this,ha)||this.addInkEditorIfNeeded(!1)}changeParent(e){var t;e.parent!==this&&(e.parent&&e.annotationElementId&&(o(this,ot).addDeletedAnnotationElement(e.annotationElementId),kt.deleteAnnotationElement(e),e.annotationElementId=null),this.attach(e),(t=e.parent)==null||t.detach(e),e.setParent(this),e.div&&e.isAttachedToDOM&&(e.div.remove(),this.div.append(e.div)))}add(e){if(!(e.parent===this&&e.isAttachedToDOM)){if(this.changeParent(e),o(this,ot).addEditor(e),this.attach(e),!e.isAttachedToDOM){const t=e.render();this.div.append(t),e.isAttachedToDOM=!0}e.fixAndSetPosition(),e.onceAdded(),o(this,ot).addToAnnotationStorage(e),e._reportTelemetry(e.telemetryInitialData)}}moveEditorInDOM(e){var s;if(!e.isAttachedToDOM)return;const{activeElement:t}=document;e.div.contains(t)&&!o(this,pi)&&(e._focusEventsAllowed=!1,w(this,pi,setTimeout(()=>{w(this,pi,null),e.div.contains(document.activeElement)?e._focusEventsAllowed=!0:(e.div.addEventListener("focusin",()=>{e._focusEventsAllowed=!0},{once:!0,signal:o(this,ot)._signal}),t.focus())},0))),e._structTreeParentId=(s=o(this,Yn))==null?void 0:s.moveElementInDOM(this.div,e.div,e.contentDiv,!0)}addOrRebuild(e){e.needsToBeRebuilt()?(e.parent||(e.parent=this),e.rebuild(),e.show()):this.add(e)}addUndoableEditor(e){const t=()=>e._uiManager.rebuild(e),s=()=>{e.remove()};this.addCommands({cmd:t,undo:s,mustExec:!1})}getNextId(){return o(this,ot).getId()}get _signal(){return o(this,ot)._signal}canCreateNewEmptyEditor(){var e;return(e=o(this,ce,nd))==null?void 0:e.canCreateNewEmptyEditor()}pasteEditor(e,t){o(this,ot).updateToolbar(e),o(this,ot).updateMode(e);const{offsetX:s,offsetY:i}=E(this,ce,ad).call(this),n=this.getNextId(),r=E(this,ce,rd).call(this,{parent:this,id:n,x:s,y:i,uiManager:o(this,ot),isCentered:!0,...t});r&&this.add(r)}deserialize(e){var t;return((t=o(ts,Gi).get(e.annotationType??e.annotationEditorType))==null?void 0:t.deserialize(e,this,o(this,ot)))||null}createAndAddNewEditor(e,t,s={}){const i=this.getNextId(),n=E(this,ce,rd).call(this,{parent:this,id:i,x:e.offsetX,y:e.offsetY,uiManager:o(this,ot),isCentered:t,...s});return n&&this.add(n),n}addNewEditor(){this.createAndAddNewEditor(E(this,ce,ad).call(this),!0)}setSelected(e){o(this,ot).setSelected(e)}toggleSelected(e){o(this,ot).toggleSelected(e)}isSelected(e){return o(this,ot).isSelected(e)}unselect(e){o(this,ot).unselect(e)}pointerup(e){const{isMac:t}=ke.platform;if(!(e.button!==0||e.ctrlKey&&t)&&e.target===this.div&&o(this,Wi)){if(w(this,Wi,!1),!o(this,oa)){w(this,oa,!0);return}if(o(this,ot).getMode()===wt.STAMP){o(this,ot).unselectAll();return}this.createAndAddNewEditor(e,!1)}}pointerdown(e){if(o(this,ot).getMode()===wt.HIGHLIGHT&&this.enableTextSelection(),o(this,Wi)){w(this,Wi,!1);return}const{isMac:t}=ke.platform;if(e.button!==0||e.ctrlKey&&t||e.target!==this.div)return;w(this,Wi,!0);const s=o(this,ot).getActive();w(this,oa,!s||s.isEmpty())}findNewParent(e,t,s){const i=o(this,ot).findParent(t,s);return i===null||i===this?!1:(i.changeParent(e),!0)}destroy(){var e,t;((e=o(this,ot).getActive())==null?void 0:e.parent)===this&&(o(this,ot).commitOrRemove(),o(this,ot).setActiveEditor(null)),o(this,pi)&&(clearTimeout(o(this,pi)),w(this,pi,null));for(const s of o(this,Ue).values())(t=o(this,Yn))==null||t.removePointerInTextLayer(s.contentDiv),s.setParent(null),s.isAttachedToDOM=!1,s.div.remove();this.div=null,o(this,Ue).clear(),o(this,ot).removeLayer(this)}render({viewport:e}){this.viewport=e,Zn(this.div,e);for(const t of o(this,ot).getEditors(this.pageIndex))this.add(t),t.rebuild();this.updateMode()}update({viewport:e}){o(this,ot).commitOrRemove(),E(this,ce,sl).call(this);const t=this.viewport.rotation,s=e.rotation;if(this.viewport=e,Zn(this.div,{rotation:s}),t!==s)for(const i of o(this,Ue).values())i.rotate(s);this.addInkEditorIfNeeded(!1)}get pageDimensions(){const{pageWidth:e,pageHeight:t}=this.viewport.rawDims;return[e,t]}get scale(){return o(this,ot).viewParameters.realScale}};Yn=new WeakMap,oa=new WeakMap,Is=new WeakMap,Kn=new WeakMap,ui=new WeakMap,fi=new WeakMap,pi=new WeakMap,Ue=new WeakMap,Wi=new WeakMap,ha=new WeakMap,la=new WeakMap,ve=new WeakMap,ot=new WeakMap,Gi=new WeakMap,ce=new WeakSet,Zf=function(e){if(o(this,ot).unselectAll(),e.target===o(this,ve).div){const{isMac:t}=ke.platform;if(e.button!==0||e.ctrlKey&&t)return;o(this,ot).showAllEditors("highlight",!0,!0),o(this,ve).div.classList.add("free"),ll.startHighlighting(this,o(this,ot).direction==="ltr",e),o(this,ve).div.addEventListener("pointerup",()=>{o(this,ve).div.classList.remove("free")},{once:!0,signal:o(this,ot)._signal}),e.preventDefault()}},nd=function(){return o(ts,Gi).get(o(this,ot).getMode())},rd=function(e){const t=o(this,ce,nd);return t?new t.prototype.constructor(e):null},ad=function(){const{x:e,y:t,width:s,height:i}=this.div.getBoundingClientRect(),n=Math.max(0,e),r=Math.max(0,t),a=Math.min(window.innerWidth,e+s),h=Math.min(window.innerHeight,t+i),l=(n+a)/2-e,c=(r+h)/2-t,[d,p]=this.viewport.rotation%180===0?[l,c]:[c,l];return{offsetX:d,offsetY:p}},sl=function(){w(this,ha,!0);for(const e of o(this,Ue).values())e.isEmpty()&&e.remove();w(this,ha,!1)},ft(ts,"_initialized",!1),S(ts,Gi,new Map([Oc,qc,td,ll].map(e=>[e._editorType,e])));let id=ts;var Ms,gh,Zt,$i,mh,hd,er,ld,Qf;const ie=class ie{constructor({pageIndex:e}){S(this,er);S(this,Ms,null);S(this,gh,0);S(this,Zt,new Map);S(this,$i,new Map);this.pageIndex=e}setParent(e){if(!o(this,Ms)){w(this,Ms,e);return}if(o(this,Ms)!==e){if(o(this,Zt).size>0)for(const t of o(this,Zt).values())t.remove(),e.append(t);w(this,Ms,e)}}static get _svgFactory(){return Et(this,"_svgFactory",new ud)}highlight(e,t,s,i=!1){const n=Le(this,gh)._++,r=E(this,er,ld).call(this,e.box);r.classList.add("highlight"),e.free&&r.classList.add("free");const a=ie._svgFactory.createElement("defs");r.append(a);const h=ie._svgFactory.createElement("path");a.append(h);const l=`path_p${this.pageIndex}_${n}`;h.setAttribute("id",l),h.setAttribute("d",e.toSVGPath()),i&&o(this,$i).set(n,h);const c=E(this,er,Qf).call(this,a,l),d=ie._svgFactory.createElement("use");return r.append(d),r.setAttribute("fill",t),r.setAttribute("fill-opacity",s),d.setAttribute("href",`#${l}`),o(this,Zt).set(n,r),{id:n,clipPathId:`url(#${c})`}}highlightOutline(e){const t=Le(this,gh)._++,s=E(this,er,ld).call(this,e.box);s.classList.add("highlightOutline");const i=ie._svgFactory.createElement("defs");s.append(i);const n=ie._svgFactory.createElement("path");i.append(n);const r=`path_p${this.pageIndex}_${t}`;n.setAttribute("id",r),n.setAttribute("d",e.toSVGPath()),n.setAttribute("vector-effect","non-scaling-stroke");let a;if(e.free){s.classList.add("free");const c=ie._svgFactory.createElement("mask");i.append(c),a=`mask_p${this.pageIndex}_${t}`,c.setAttribute("id",a),c.setAttribute("maskUnits","objectBoundingBox");const d=ie._svgFactory.createElement("rect");c.append(d),d.setAttribute("width","1"),d.setAttribute("height","1"),d.setAttribute("fill","white");const p=ie._svgFactory.createElement("use");c.append(p),p.setAttribute("href",`#${r}`),p.setAttribute("stroke","none"),p.setAttribute("fill","black"),p.setAttribute("fill-rule","nonzero"),p.classList.add("mask")}const h=ie._svgFactory.createElement("use");s.append(h),h.setAttribute("href",`#${r}`),a&&h.setAttribute("mask",`url(#${a})`);const l=h.cloneNode();return s.append(l),h.classList.add("mainOutline"),l.classList.add("secondaryOutline"),o(this,Zt).set(t,s),t}finalizeLine(e,t){const s=o(this,$i).get(e);o(this,$i).delete(e),this.updateBox(e,t.box),s.setAttribute("d",t.toSVGPath())}updateLine(e,t){o(this,Zt).get(e).firstChild.firstChild.setAttribute("d",t.toSVGPath())}removeFreeHighlight(e){this.remove(e),o(this,$i).delete(e)}updatePath(e,t){o(this,$i).get(e).setAttribute("d",t.toSVGPath())}updateBox(e,t){var s;E(s=ie,mh,hd).call(s,o(this,Zt).get(e),t)}show(e,t){o(this,Zt).get(e).classList.toggle("hidden",!t)}rotate(e,t){o(this,Zt).get(e).setAttribute("data-main-rotation",t)}changeColor(e,t){o(this,Zt).get(e).setAttribute("fill",t)}changeOpacity(e,t){o(this,Zt).get(e).setAttribute("fill-opacity",t)}addClass(e,t){o(this,Zt).get(e).classList.add(t)}removeClass(e,t){o(this,Zt).get(e).classList.remove(t)}remove(e){o(this,Ms)!==null&&(o(this,Zt).get(e).remove(),o(this,Zt).delete(e))}destroy(){w(this,Ms,null);for(const e of o(this,Zt).values())e.remove();o(this,Zt).clear()}};Ms=new WeakMap,gh=new WeakMap,Zt=new WeakMap,$i=new WeakMap,mh=new WeakSet,hd=function(e,{x:t=0,y:s=0,width:i=1,height:n=1}={}){const{style:r}=e;r.top=`${100*s}%`,r.left=`${100*t}%`,r.width=`${100*i}%`,r.height=`${100*n}%`},er=new WeakSet,ld=function(e){var s;const t=ie._svgFactory.create(1,1,!0);return o(this,Ms).append(t),t.setAttribute("aria-hidden",!0),E(s=ie,mh,hd).call(s,t,e),t},Qf=function(e,t){const s=ie._svgFactory.createElement("clipPath");e.append(s);const i=`clip_${t}`;s.setAttribute("id",i),s.setAttribute("clipPathUnits","objectBoundingBox");const n=ie._svgFactory.createElement("use");return s.append(n),n.setAttribute("href",`#${t}`),n.classList.add("clip"),i},S(ie,mh);let od=ie;ct.AbortException;ct.AnnotationEditorLayer;ct.AnnotationEditorParamsType;ct.AnnotationEditorType;ct.AnnotationEditorUIManager;ct.AnnotationLayer;ct.AnnotationMode;ct.CMapCompressionType;ct.ColorPicker;ct.DOMSVGFactory;ct.DrawLayer;ct.FeatureTest;var Lm=ct.GlobalWorkerOptions;ct.ImageKind;ct.InvalidPDFException;ct.MissingPDFException;ct.OPS;ct.Outliner;ct.PDFDataRangeTransport;ct.PDFDateString;ct.PDFWorker;ct.PasswordResponses;ct.PermissionFlag;ct.PixelsPerInch;ct.RenderingCancelledException;ct.TextLayer;ct.UnexpectedResponseException;ct.Util;ct.VerbosityLevel;ct.XfaLayer;ct.build;ct.createValidAbsoluteUrl;ct.fetchData;ct.getDocument;ct.getFilenameFromUrl;ct.getPdfFilenameFromUrl;ct.getXfaPageViewport;ct.isDataScheme;ct.isPdfFile;ct.noContextMenu;ct.normalizeUnicode;ct.renderTextLayer;ct.setLayerDimensions;ct.shadow;ct.updateTextLayer;ct.version;const Im="/assets/pdf.worker.min-DGf6LXVo.mjs";Lm.workerSrc=Im;const Mm={class:"train-container w-screen h-screen bg-slate-50 flex flex-col items-center"},Fm={class:"list-container container grow relative"},Dm={class:"list-content absolute top-0 bottom-0 left-0 right-0 py-4"},Om={class:"list-wrapper w-full h-full"},Nm={class:"card-wrapper w-full h-full flex flex-col px-8 box-border"},Bm={class:"card-header flex justify-between items-center shrink-0"},zm={class:"header-search flex items-center"},Hm={class:"card-main flex-1 my-5 relative"},Um={class:"main-content absolute top-0 bottom-0 left-0 right-0"},jm={class:"row-info"},Wm={class:"icon"},Gm=["src"],$m={class:"label"},Vm={class:"card-footer flex justify-center mb-7 shrink-0"},qm={class:"image-container"},Xm={key:0,class:"video-container"},Ym={class:"close-btn"},Km={__name:"index",setup(u){const e=np(),{userInfo:t}=rp(e),{status:s,message:i,error:n,connect:r,disconnect:a,sendMessage:h}=Ep({url:"wss://42.193.1.25:8000/websocket/"+t.value.id,heartBeatData:"ping"}),l=Vt(null),c={img:{iconPath:"/static/icons/file_type_image.png",handle:M=>{v.value=!0,A.value=["/api/files/"+M.contentUrl.url],H()}},video:{iconPath:"/static/icons/file_type_video.png",handle:M=>{b.value=!0,k.value=["/api/files/"+M.contentUrl.url],H()}},pdf:{iconPath:"/static/icons/file_type_pdf.png",handle:M=>{m.value=!0,x.value="/api/files/"+M.contentUrl.url,H()}},word:{iconPath:"/static/icons/file_type_word.png",handle:M=>{m.value=!0,x.value="/api/files/"+M.contentUrl.url,H()}},ppt:{iconPath:"/static/icons/file_type_ppt.png",handle:M=>{m.value=!0,x.value="/api/files/"+M.contentUrl.url,H()}},audio:{iconPath:"/static/icons/file_type_audio.png",handle:M=>{console.log(M),b.value=!0,k.value="/api/files/"+M.contentUrl.url,H()}},excel:{iconPath:"/static/icons/file_type_excel.png",handle:M=>{console.log(M),m.value=!0,x.value="/api/files/"+M.contentUrl.url,H()}}},d=Vt(""),p=Vt(""),f=Vt(""),g=Vt(!1),m=Vt(!1),v=Vt(!1),b=Vt(!1),A=Vt([]),x=Vt(""),k=Vt(""),T=Vt([]),L=Vt([]),I=Vt([{name:"视频",value:"video"},{name:"图片",value:"img"},{name:"音频",value:"audio"},{name:"PDF",value:"pdf"},{name:"EXCEL",value:"excel"},{name:"WORD",value:"word"},{name:"PPT",value:"ppt"}]),B=Vt(1),D=Vt(10),W=Vt(0);Vt(!1);const q=M=>{c[M.contentType]&&c[M.contentType].handle(M)},P=()=>{m.value=!1,v.value=!1,b.value=!1,clearInterval(l.value)},z=()=>{g.value=!0,Sp({introduction:d.value,subjectId:p.value,contentType:f.value,pageSize:D.value,pageNum:B.value}).then(M=>{g.value=!1,T.value=M.data,W.value=M.total}).catch(()=>{g.value=!1})};z(),(()=>{g.value=!0,xp().then(M=>{g.value=!1,L.value=M.data}).catch(()=>{g.value=!1})})();const H=()=>{l.value&&clearInterval(l.value),h({id:t.value.id,command:"recordStudyTime"}),l.value=setInterval(()=>{h({id:t.value.id,command:"recordStudyTime"})},5e3)},rt=M=>{if(c[M])return c[M].iconPath},U=M=>{B.value=1,D.value=M,z()},Q=M=>{B.value=M,z()},X=()=>{z()},ht=M=>{window.open(M.visitUrl,"_blank")};return Jd(()=>{r()}),tu(()=>{clearInterval(l.value)}),(M,O)=>{const st=pp,J=gp,Y=mp,_t=hp,pt=bp,dt=_p,vt=vp,Wt=lp,Ot=cp,We=yp,Pe=Ap;return bs(),_a("div",Mm,[ee(wp,{class:"shrink-0"}),se("div",Fm,[se("div",Dm,[se("div",Om,[ee(Wt,{class:"h-full","body-style":{height:"100%"}},{default:Je(()=>[se("div",Nm,[se("div",Bm,[se("div",zm,[ee(st,{modelValue:d.value,"onUpdate:modelValue":O[0]||(O[0]=_=>d.value=_),placeholder:"请输入搜索内容",class:"long-input","prefix-icon":Td(dp)},null,8,["modelValue","prefix-icon"]),ee(Y,{modelValue:p.value,"onUpdate:modelValue":O[1]||(O[1]=_=>p.value=_),placeholder:"请选择科目",class:"ml-4 long-select",clearable:""},{default:Je(()=>[(bs(!0),_a(Rd,null,Pd(L.value,_=>(bs(),pa(J,{key:_.id,label:_.name,value:_.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue"]),ee(Y,{modelValue:f.value,"onUpdate:modelValue":O[2]||(O[2]=_=>f.value=_),placeholder:"请选择文件类型",class:"ml-4 long-select",clearable:""},{default:Je(()=>[(bs(!0),_a(Rd,null,Pd(I.value,_=>(bs(),pa(J,{key:_.value,label:_.name,value:_.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"]),ee(_t,{type:"primary",class:"ml-4",onClick:X},{default:Je(()=>[Ul("搜索")]),_:1})])]),se("div",Hm,[se("div",Um,[kd((bs(),pa(dt,{data:T.value,height:"100%"},{default:Je(()=>[ee(pt,{label:"文件名称"},{default:Je(_=>[se("div",jm,[se("div",Wm,[se("img",{src:rt(_.row.contentType),class:"width-img"},null,8,Gm)]),se("div",$m,up(_.row.introduction),1)])]),_:1}),ee(pt,{prop:"className",label:"班级",align:"center"}),ee(pt,{prop:"typeName",label:"科目",align:"center"}),ee(pt,{prop:"updateTime",label:"上传时间",align:"center"}),ee(pt,null,{default:Je(_=>[_.row.contentType=="video"||_.row.contentType=="audio"?(bs(),pa(_t,{key:0,link:"",type:"primary",onClick:Ld(G=>q(_.row),["prevent"])},{default:Je(()=>[Ul(" 查看 ")]),_:2},1032,["onClick"])):(bs(),pa(_t,{key:1,link:"",type:"primary",onClick:Ld(G=>ht(_.row),["prevent"])},{default:Je(()=>[Ul(" 下载 ")]),_:2},1032,["onClick"]))]),_:1})]),_:1},8,["data"])),[[Pe,g.value]])])]),se("div",Vm,[ee(vt,{background:"",layout:"total, sizes, prev, pager, next, jumper",total:W.value,"page-sizes":[10,20,50],"page-size":D.value,currentPage:B.value,onSizeChange:U,onCurrentChange:Q},null,8,["total","page-size","currentPage"])])])]),_:1})])])]),kd(se("div",qm,[ee(Ot,{"url-list":A.value,onClose:P},null,8,["url-list"])],512),[[ap,v.value]]),b.value?(bs(),_a("div",Xm,[ee(Pp,{videoUrl:k.value},null,8,["videoUrl"]),se("div",Ym,[ee(_t,{type:"danger",size:"large",circle:"",onClick:P},{icon:Je(()=>[ee(We,{size:20},{default:Je(()=>[ee(Td(fp))]),_:1})]),_:1})])])):op("",!0)])}}},db=Qd(Km,[["__scopeId","data-v-e74fc686"]]);export{db as default};
|
|